diff --git a/README.md b/README.md index a6746a0..ac1169e 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,8 @@ new Extension({ color1: "#0800ff", blocks: [ { - opcode: 'output', /** @ts-ignore */ - blockType: Scratch.BlockType.COMMAND, + opcode: 'output', + blockType: 'command', text: '命令 [block:string] [type:string]', default: { block : "参数2", type: "类型" }, menu: { block : [ "参数1", "参数2" ] }, @@ -91,8 +91,8 @@ new Extension({ return `内容 ${block} 类型 ${type}`; }, }, { - opcode: 'list', /** @ts-ignore */ - blockType: Scratch.BlockType.REPORTER, + opcode: 'list', + blockType: 'reporter', text: '获取一个空列表', bind: () => [], disableMonitor: true, @@ -165,6 +165,7 @@ class Extension { // @ts-ignore Scratch.extensions.register(new Extension()); ``` + > turbowarp-clipx ```typescript @@ -177,7 +178,7 @@ new Extension({ blocks: [ { opcode: 'fetch', - blockType: Scratch.BlockType.REPORTER, + blockType: 'reporter', text: 'fetch [uri:string] 方法[method:string]', default: { uri: "https://example.com/" , method: "GET" }, menu: { method: ["GET", "POST", "PUT", "DELETE" ] }, diff --git a/docs/en.md b/docs/en.md index fc0dd07..aac0841 100644 --- a/docs/en.md +++ b/docs/en.md @@ -81,8 +81,8 @@ new Extension({ color1: "#0800ff", blocks: [ { - opcode: 'output', /** @ts-ignore */ - blockType: Scratch.BlockType.COMMAND, + opcode: 'output', + blockType: 'command', text: 'command [block:string] [type:string]', default: { block : "param2", type: "type" }, menu: { block : [ "param1", "param2" ] }, @@ -90,8 +90,8 @@ new Extension({ return `content ${block} type ${type}`; }, }, { - opcode: 'list', /** @ts-ignore */ - blockType: Scratch.BlockType.REPORTER, + opcode: 'list', + blockType: 'reporter', text: 'Get an empty array', bind: () => [], disableMonitor: true, @@ -164,6 +164,7 @@ class Extension { // @ts-ignore Scratch.extensions.register(new Extension()); ``` + > turbowarp-clipx ```typescript @@ -176,7 +177,7 @@ new Extension({ blocks: [ { opcode: 'fetch', - blockType: Scratch.BlockType.REPORTER, + blockType: 'reporter', text: 'fetch [uri:string] method[method:string]', default: { uri: "https://example.com/" , method: "GET" }, menu: { method: ["GET", "POST", "PUT", "DELETE" ] }, diff --git a/package.json b/package.json index e136db3..3cd4eb6 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "eslint-plugin-promise": "^6.0.0", "ts-loader": "^9.4.2", "typescript": "^5.0.3", - "webpack": "^5.77.0", - "webpack-cli": "^5.0.1" + "webpack": "^5.84.1", + "webpack-cli": "^5.1.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab7794e..2b33841 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,16 +24,16 @@ devDependencies: version: 6.1.1(eslint@8.37.0) ts-loader: specifier: ^9.4.2 - version: 9.4.2(typescript@5.0.3)(webpack@5.77.0) + version: 9.4.2(typescript@5.0.3)(webpack@5.84.1) typescript: specifier: ^5.0.3 version: 5.0.3 webpack: - specifier: ^5.77.0 - version: 5.77.0(webpack-cli@5.0.1) + specifier: ^5.84.1 + version: 5.84.1(webpack-cli@5.1.1) webpack-cli: - specifier: ^5.0.1 - version: 5.0.1(webpack@5.77.0) + specifier: ^5.1.1 + version: 5.1.1(webpack@5.84.1) packages: @@ -165,18 +165,18 @@ packages: resolution: {integrity: sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==} dependencies: '@types/eslint': 8.37.0 - '@types/estree': 0.0.51 + '@types/estree': 1.0.1 dev: true /@types/eslint@8.37.0: resolution: {integrity: sha512-Piet7dG2JBuDIfohBngQ3rCt7MgO9xCO4xIMKxBThCq5PNRB91IjlJ10eJVwfoNtvTErmxLzwBZ7rHZtbOMmFQ==} dependencies: - '@types/estree': 0.0.51 + '@types/estree': 1.0.1 '@types/json-schema': 7.0.11 dev: true - /@types/estree@0.0.51: - resolution: {integrity: sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==} + /@types/estree@1.0.1: + resolution: {integrity: sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==} dev: true /@types/json-schema@7.0.11: @@ -325,136 +325,136 @@ packages: eslint-visitor-keys: 3.4.0 dev: true - /@webassemblyjs/ast@1.11.1: - resolution: {integrity: sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==} + /@webassemblyjs/ast@1.11.6: + resolution: {integrity: sha512-IN1xI7PwOvLPgjcf180gC1bqn3q/QaOCwYUahIOhbYUu8KA/3tw2RT/T0Gidi1l7Hhj5D/INhJxiICObqpMu4Q==} dependencies: - '@webassemblyjs/helper-numbers': 1.11.1 - '@webassemblyjs/helper-wasm-bytecode': 1.11.1 + '@webassemblyjs/helper-numbers': 1.11.6 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 dev: true - /@webassemblyjs/floating-point-hex-parser@1.11.1: - resolution: {integrity: sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==} + /@webassemblyjs/floating-point-hex-parser@1.11.6: + resolution: {integrity: sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==} dev: true - /@webassemblyjs/helper-api-error@1.11.1: - resolution: {integrity: sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==} + /@webassemblyjs/helper-api-error@1.11.6: + resolution: {integrity: sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==} dev: true - /@webassemblyjs/helper-buffer@1.11.1: - resolution: {integrity: sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==} + /@webassemblyjs/helper-buffer@1.11.6: + resolution: {integrity: sha512-z3nFzdcp1mb8nEOFFk8DrYLpHvhKC3grJD2ardfKOzmbmJvEf/tPIqCY+sNcwZIY8ZD7IkB2l7/pqhUhqm7hLA==} dev: true - /@webassemblyjs/helper-numbers@1.11.1: - resolution: {integrity: sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==} + /@webassemblyjs/helper-numbers@1.11.6: + resolution: {integrity: sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==} dependencies: - '@webassemblyjs/floating-point-hex-parser': 1.11.1 - '@webassemblyjs/helper-api-error': 1.11.1 + '@webassemblyjs/floating-point-hex-parser': 1.11.6 + '@webassemblyjs/helper-api-error': 1.11.6 '@xtuc/long': 4.2.2 dev: true - /@webassemblyjs/helper-wasm-bytecode@1.11.1: - resolution: {integrity: sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==} + /@webassemblyjs/helper-wasm-bytecode@1.11.6: + resolution: {integrity: sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==} dev: true - /@webassemblyjs/helper-wasm-section@1.11.1: - resolution: {integrity: sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==} + /@webassemblyjs/helper-wasm-section@1.11.6: + resolution: {integrity: sha512-LPpZbSOwTpEC2cgn4hTydySy1Ke+XEu+ETXuoyvuyezHO3Kjdu90KK95Sh9xTbmjrCsUwvWwCOQQNta37VrS9g==} dependencies: - '@webassemblyjs/ast': 1.11.1 - '@webassemblyjs/helper-buffer': 1.11.1 - '@webassemblyjs/helper-wasm-bytecode': 1.11.1 - '@webassemblyjs/wasm-gen': 1.11.1 + '@webassemblyjs/ast': 1.11.6 + '@webassemblyjs/helper-buffer': 1.11.6 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + '@webassemblyjs/wasm-gen': 1.11.6 dev: true - /@webassemblyjs/ieee754@1.11.1: - resolution: {integrity: sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==} + /@webassemblyjs/ieee754@1.11.6: + resolution: {integrity: sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==} dependencies: '@xtuc/ieee754': 1.2.0 dev: true - /@webassemblyjs/leb128@1.11.1: - resolution: {integrity: sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==} + /@webassemblyjs/leb128@1.11.6: + resolution: {integrity: sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==} dependencies: '@xtuc/long': 4.2.2 dev: true - /@webassemblyjs/utf8@1.11.1: - resolution: {integrity: sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==} + /@webassemblyjs/utf8@1.11.6: + resolution: {integrity: sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==} dev: true - /@webassemblyjs/wasm-edit@1.11.1: - resolution: {integrity: sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==} + /@webassemblyjs/wasm-edit@1.11.6: + resolution: {integrity: sha512-Ybn2I6fnfIGuCR+Faaz7YcvtBKxvoLV3Lebn1tM4o/IAJzmi9AWYIPWpyBfU8cC+JxAO57bk4+zdsTjJR+VTOw==} dependencies: - '@webassemblyjs/ast': 1.11.1 - '@webassemblyjs/helper-buffer': 1.11.1 - '@webassemblyjs/helper-wasm-bytecode': 1.11.1 - '@webassemblyjs/helper-wasm-section': 1.11.1 - '@webassemblyjs/wasm-gen': 1.11.1 - '@webassemblyjs/wasm-opt': 1.11.1 - '@webassemblyjs/wasm-parser': 1.11.1 - '@webassemblyjs/wast-printer': 1.11.1 + '@webassemblyjs/ast': 1.11.6 + '@webassemblyjs/helper-buffer': 1.11.6 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + '@webassemblyjs/helper-wasm-section': 1.11.6 + '@webassemblyjs/wasm-gen': 1.11.6 + '@webassemblyjs/wasm-opt': 1.11.6 + '@webassemblyjs/wasm-parser': 1.11.6 + '@webassemblyjs/wast-printer': 1.11.6 dev: true - /@webassemblyjs/wasm-gen@1.11.1: - resolution: {integrity: sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==} + /@webassemblyjs/wasm-gen@1.11.6: + resolution: {integrity: sha512-3XOqkZP/y6B4F0PBAXvI1/bky7GryoogUtfwExeP/v7Nzwo1QLcq5oQmpKlftZLbT+ERUOAZVQjuNVak6UXjPA==} dependencies: - '@webassemblyjs/ast': 1.11.1 - '@webassemblyjs/helper-wasm-bytecode': 1.11.1 - '@webassemblyjs/ieee754': 1.11.1 - '@webassemblyjs/leb128': 1.11.1 - '@webassemblyjs/utf8': 1.11.1 + '@webassemblyjs/ast': 1.11.6 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + '@webassemblyjs/ieee754': 1.11.6 + '@webassemblyjs/leb128': 1.11.6 + '@webassemblyjs/utf8': 1.11.6 dev: true - /@webassemblyjs/wasm-opt@1.11.1: - resolution: {integrity: sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==} + /@webassemblyjs/wasm-opt@1.11.6: + resolution: {integrity: sha512-cOrKuLRE7PCe6AsOVl7WasYf3wbSo4CeOk6PkrjS7g57MFfVUF9u6ysQBBODX0LdgSvQqRiGz3CXvIDKcPNy4g==} dependencies: - '@webassemblyjs/ast': 1.11.1 - '@webassemblyjs/helper-buffer': 1.11.1 - '@webassemblyjs/wasm-gen': 1.11.1 - '@webassemblyjs/wasm-parser': 1.11.1 + '@webassemblyjs/ast': 1.11.6 + '@webassemblyjs/helper-buffer': 1.11.6 + '@webassemblyjs/wasm-gen': 1.11.6 + '@webassemblyjs/wasm-parser': 1.11.6 dev: true - /@webassemblyjs/wasm-parser@1.11.1: - resolution: {integrity: sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==} + /@webassemblyjs/wasm-parser@1.11.6: + resolution: {integrity: sha512-6ZwPeGzMJM3Dqp3hCsLgESxBGtT/OeCvCZ4TA1JUPYgmhAx38tTPR9JaKy0S5H3evQpO/h2uWs2j6Yc/fjkpTQ==} dependencies: - '@webassemblyjs/ast': 1.11.1 - '@webassemblyjs/helper-api-error': 1.11.1 - '@webassemblyjs/helper-wasm-bytecode': 1.11.1 - '@webassemblyjs/ieee754': 1.11.1 - '@webassemblyjs/leb128': 1.11.1 - '@webassemblyjs/utf8': 1.11.1 + '@webassemblyjs/ast': 1.11.6 + '@webassemblyjs/helper-api-error': 1.11.6 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + '@webassemblyjs/ieee754': 1.11.6 + '@webassemblyjs/leb128': 1.11.6 + '@webassemblyjs/utf8': 1.11.6 dev: true - /@webassemblyjs/wast-printer@1.11.1: - resolution: {integrity: sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==} + /@webassemblyjs/wast-printer@1.11.6: + resolution: {integrity: sha512-JM7AhRcE+yW2GWYaKeHL5vt4xqee5N2WcezptmgyhNS+ScggqcT1OtXykhAb13Sn5Yas0j2uv9tHgrjwvzAP4A==} dependencies: - '@webassemblyjs/ast': 1.11.1 + '@webassemblyjs/ast': 1.11.6 '@xtuc/long': 4.2.2 dev: true - /@webpack-cli/configtest@2.0.1(webpack-cli@5.0.1)(webpack@5.77.0): - resolution: {integrity: sha512-njsdJXJSiS2iNbQVS0eT8A/KPnmyH4pv1APj2K0d1wrZcBLw+yppxOy4CGqa0OxDJkzfL/XELDhD8rocnIwB5A==} + /@webpack-cli/configtest@2.1.0(webpack-cli@5.1.1)(webpack@5.84.1): + resolution: {integrity: sha512-K/vuv72vpfSEZoo5KIU0a2FsEoYdW0DUMtMpB5X3LlUwshetMZRZRxB7sCsVji/lFaSxtQQ3aM9O4eMolXkU9w==} engines: {node: '>=14.15.0'} peerDependencies: webpack: 5.x.x webpack-cli: 5.x.x dependencies: - webpack: 5.77.0(webpack-cli@5.0.1) - webpack-cli: 5.0.1(webpack@5.77.0) + webpack: 5.84.1(webpack-cli@5.1.1) + webpack-cli: 5.1.1(webpack@5.84.1) dev: true - /@webpack-cli/info@2.0.1(webpack-cli@5.0.1)(webpack@5.77.0): + /@webpack-cli/info@2.0.1(webpack-cli@5.1.1)(webpack@5.84.1): resolution: {integrity: sha512-fE1UEWTwsAxRhrJNikE7v4EotYflkEhBL7EbajfkPlf6E37/2QshOy/D48Mw8G5XMFlQtS6YV42vtbG9zBpIQA==} engines: {node: '>=14.15.0'} peerDependencies: webpack: 5.x.x webpack-cli: 5.x.x dependencies: - webpack: 5.77.0(webpack-cli@5.0.1) - webpack-cli: 5.0.1(webpack@5.77.0) + webpack: 5.84.1(webpack-cli@5.1.1) + webpack-cli: 5.1.1(webpack@5.84.1) dev: true - /@webpack-cli/serve@2.0.1(webpack-cli@5.0.1)(webpack@5.77.0): - resolution: {integrity: sha512-0G7tNyS+yW8TdgHwZKlDWYXFA6OJQnoLCQvYKkQP0Q2X205PSQ6RNUj0M+1OB/9gRQaUZ/ccYfaxd0nhaWKfjw==} + /@webpack-cli/serve@2.0.4(webpack-cli@5.1.1)(webpack@5.84.1): + resolution: {integrity: sha512-0xRgjgDLdz6G7+vvDLlaRpFatJaJ69uTalZLRSMX5B3VUrDmXcrVA3+6fXXQgmYz7bY9AAgs348XQdmtLsK41A==} engines: {node: '>=14.15.0'} peerDependencies: webpack: 5.x.x @@ -464,8 +464,8 @@ packages: webpack-dev-server: optional: true dependencies: - webpack: 5.77.0(webpack-cli@5.0.1) - webpack-cli: 5.0.1(webpack@5.77.0) + webpack: 5.84.1(webpack-cli@5.1.1) + webpack-cli: 5.1.1(webpack@5.84.1) dev: true /@xtuc/ieee754@1.2.0: @@ -476,8 +476,8 @@ packages: resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} dev: true - /acorn-import-assertions@1.8.0(acorn@8.8.2): - resolution: {integrity: sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==} + /acorn-import-assertions@1.9.0(acorn@8.8.2): + resolution: {integrity: sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==} peerDependencies: acorn: ^8 dependencies: @@ -667,17 +667,17 @@ packages: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} dev: true - /colorette@2.0.19: - resolution: {integrity: sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==} + /colorette@2.0.20: + resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} dev: true - /commander@2.20.3: - resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + /commander@10.0.1: + resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} + engines: {node: '>=14'} dev: true - /commander@9.5.0: - resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} - engines: {node: ^12.20.0 || >=14} + /commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} dev: true /concat-map@0.0.1: @@ -761,6 +761,14 @@ packages: tapable: 2.2.1 dev: true + /enhanced-resolve@5.14.1: + resolution: {integrity: sha512-Vklwq2vDKtl0y/vtwjSesgJ5MYS7Etuk5txS8VdKL4AOS1aUlD96zqIfsOSLQsdv3xgMRbtkWM8eG9XDfKUPow==} + engines: {node: '>=10.13.0'} + dependencies: + graceful-fs: 4.2.11 + tapable: 2.2.1 + dev: true + /envinfo@7.8.1: resolution: {integrity: sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==} engines: {node: '>=4'} @@ -807,8 +815,8 @@ packages: which-typed-array: 1.1.9 dev: true - /es-module-lexer@0.9.3: - resolution: {integrity: sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==} + /es-module-lexer@1.2.1: + resolution: {integrity: sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==} dev: true /es-set-tostringtag@2.0.1: @@ -1909,8 +1917,8 @@ packages: is-regex: 1.1.4 dev: true - /schema-utils@3.1.1: - resolution: {integrity: sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==} + /schema-utils@3.1.2: + resolution: {integrity: sha512-pvjEHOgWc9OWA/f/DE3ohBWTD6EleVLf7iFUkoSwAxttdBhB9QUebQgxER2kWueOvRJXPHNnyrvvh9eZINB8Eg==} engines: {node: '>= 10.13.0'} dependencies: '@types/json-schema': 7.0.11 @@ -2047,7 +2055,7 @@ packages: engines: {node: '>=6'} dev: true - /terser-webpack-plugin@5.3.7(webpack@5.77.0): + /terser-webpack-plugin@5.3.7(webpack@5.84.1): resolution: {integrity: sha512-AfKwIktyP7Cu50xNjXF/6Qb5lBNzYaWpU6YfoX3uZicTx0zTy0stDDCsvjDapKsSDvOeWo5MEq4TmdBy2cNoHw==} engines: {node: '>= 10.13.0'} peerDependencies: @@ -2065,10 +2073,10 @@ packages: dependencies: '@jridgewell/trace-mapping': 0.3.17 jest-worker: 27.5.1 - schema-utils: 3.1.1 + schema-utils: 3.1.2 serialize-javascript: 6.0.1 terser: 5.16.8 - webpack: 5.77.0(webpack-cli@5.0.1) + webpack: 5.84.1(webpack-cli@5.1.1) dev: true /terser@5.16.8: @@ -2093,7 +2101,7 @@ packages: is-number: 7.0.0 dev: true - /ts-loader@9.4.2(typescript@5.0.3)(webpack@5.77.0): + /ts-loader@9.4.2(typescript@5.0.3)(webpack@5.84.1): resolution: {integrity: sha512-OmlC4WVmFv5I0PpaxYb+qGeGOdm5giHU7HwDDUjw59emP2UYMHy9fFSDcYgSNoH8sXcj4hGCSEhlDZ9ULeDraA==} engines: {node: '>=12.0.0'} peerDependencies: @@ -2105,7 +2113,7 @@ packages: micromatch: 4.0.5 semver: 7.3.8 typescript: 5.0.3 - webpack: 5.77.0(webpack-cli@5.0.1) + webpack: 5.84.1(webpack-cli@5.1.1) dev: true /tsconfig-paths@3.14.2: @@ -2191,8 +2199,8 @@ packages: graceful-fs: 4.2.11 dev: true - /webpack-cli@5.0.1(webpack@5.77.0): - resolution: {integrity: sha512-S3KVAyfwUqr0Mo/ur3NzIp6jnerNpo7GUO6so51mxLi1spqsA17YcMXy0WOIJtBSnj748lthxC6XLbNKh/ZC+A==} + /webpack-cli@5.1.1(webpack@5.84.1): + resolution: {integrity: sha512-OLJwVMoXnXYH2ncNGU8gxVpUtm3ybvdioiTvHgUyBuyMLKiVvWy+QObzBsMtp5pH7qQoEuWgeEUQ/sU3ZJFzAw==} engines: {node: '>=14.15.0'} hasBin: true peerDependencies: @@ -2209,27 +2217,27 @@ packages: optional: true dependencies: '@discoveryjs/json-ext': 0.5.7 - '@webpack-cli/configtest': 2.0.1(webpack-cli@5.0.1)(webpack@5.77.0) - '@webpack-cli/info': 2.0.1(webpack-cli@5.0.1)(webpack@5.77.0) - '@webpack-cli/serve': 2.0.1(webpack-cli@5.0.1)(webpack@5.77.0) - colorette: 2.0.19 - commander: 9.5.0 + '@webpack-cli/configtest': 2.1.0(webpack-cli@5.1.1)(webpack@5.84.1) + '@webpack-cli/info': 2.0.1(webpack-cli@5.1.1)(webpack@5.84.1) + '@webpack-cli/serve': 2.0.4(webpack-cli@5.1.1)(webpack@5.84.1) + colorette: 2.0.20 + commander: 10.0.1 cross-spawn: 7.0.3 envinfo: 7.8.1 fastest-levenshtein: 1.0.16 import-local: 3.1.0 interpret: 3.1.1 rechoir: 0.8.0 - webpack: 5.77.0(webpack-cli@5.0.1) - webpack-merge: 5.8.0 + webpack: 5.84.1(webpack-cli@5.1.1) + webpack-merge: 5.9.0 dev: true - /webpack-merge@5.8.0: - resolution: {integrity: sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==} + /webpack-merge@5.9.0: + resolution: {integrity: sha512-6NbRQw4+Sy50vYNTw7EyOn41OZItPiXB8GNv3INSoe3PSFaHJEz3SHTrYVaRm2LilNGnFUzh0FAwqPEmU/CwDg==} engines: {node: '>=10.0.0'} dependencies: clone-deep: 4.0.1 - wildcard: 2.0.0 + wildcard: 2.0.1 dev: true /webpack-sources@3.2.3: @@ -2237,8 +2245,8 @@ packages: engines: {node: '>=10.13.0'} dev: true - /webpack@5.77.0(webpack-cli@5.0.1): - resolution: {integrity: sha512-sbGNjBr5Ya5ss91yzjeJTLKyfiwo5C628AFjEa6WSXcZa4E+F57om3Cc8xLb1Jh0b243AWuSYRf3dn7HVeFQ9Q==} + /webpack@5.84.1(webpack-cli@5.1.1): + resolution: {integrity: sha512-ZP4qaZ7vVn/K8WN/p990SGATmrL1qg4heP/MrVneczYtpDGJWlrgZv55vxaV2ul885Kz+25MP2kSXkPe3LZfmg==} engines: {node: '>=10.13.0'} hasBin: true peerDependencies: @@ -2248,16 +2256,16 @@ packages: optional: true dependencies: '@types/eslint-scope': 3.7.4 - '@types/estree': 0.0.51 - '@webassemblyjs/ast': 1.11.1 - '@webassemblyjs/wasm-edit': 1.11.1 - '@webassemblyjs/wasm-parser': 1.11.1 + '@types/estree': 1.0.1 + '@webassemblyjs/ast': 1.11.6 + '@webassemblyjs/wasm-edit': 1.11.6 + '@webassemblyjs/wasm-parser': 1.11.6 acorn: 8.8.2 - acorn-import-assertions: 1.8.0(acorn@8.8.2) + acorn-import-assertions: 1.9.0(acorn@8.8.2) browserslist: 4.21.5 chrome-trace-event: 1.0.3 - enhanced-resolve: 5.12.0 - es-module-lexer: 0.9.3 + enhanced-resolve: 5.14.1 + es-module-lexer: 1.2.1 eslint-scope: 5.1.1 events: 3.3.0 glob-to-regexp: 0.4.1 @@ -2266,11 +2274,11 @@ packages: loader-runner: 4.3.0 mime-types: 2.1.35 neo-async: 2.6.2 - schema-utils: 3.1.1 + schema-utils: 3.1.2 tapable: 2.2.1 - terser-webpack-plugin: 5.3.7(webpack@5.77.0) + terser-webpack-plugin: 5.3.7(webpack@5.84.1) watchpack: 2.4.0 - webpack-cli: 5.0.1(webpack@5.77.0) + webpack-cli: 5.1.1(webpack@5.84.1) webpack-sources: 3.2.3 transitivePeerDependencies: - '@swc/core' @@ -2308,8 +2316,8 @@ packages: isexe: 2.0.0 dev: true - /wildcard@2.0.0: - resolution: {integrity: sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==} + /wildcard@2.0.1: + resolution: {integrity: sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==} dev: true /word-wrap@1.2.3: diff --git a/src/option.ts b/src/option.ts index a27cb9f..dfcdc2b 100644 --- a/src/option.ts +++ b/src/option.ts @@ -1,4 +1,3 @@ -import { Scratch } from './vm' export default interface Option { id: string name?: string // Defaults to extension ID if not specified. @@ -13,10 +12,9 @@ export default interface Option { uptime?: number // Timing of cache cleaning. Defaults to 60(secs) if not specified. } -const $ = Scratch.BlockType export interface Block { - opcode: string /** @ts-expect-error */ - blockType: $.BOOLEAN | $.BUTTON | $.COMMAND | $.CONDITIONAL | $.EVENT | $.HAT | $.LOOP | $.REPORTER + opcode: string + blockType: "Boolean" | "button" | "command" | "conditional" | "event" | "hat" | "loop" | "reporter" text: string cache?: { enable?: boolean // If enable caching. Defaults to false if not specified. diff --git a/src/vm.ts b/src/vm.ts deleted file mode 100644 index 3f686a7..0000000 --- a/src/vm.ts +++ /dev/null @@ -1,247 +0,0 @@ -namespace $Scratch { - namespace ArgumentType { - const ANGLE = 'angle' - const BOOLEAN = 'Boolean' - const COLOR = 'color' - const IMAGE = 'image' - const MATRIX = 'matrix' - const NOTE = 'note' - const NUMBER = 'number' - const STRING = 'string' - } - - namespace BlockType { - const BOOLEAN = 'Boolean' - const BUTTON = 'button' - const COMMAND = 'command' - const CONDITIONAL = 'conditional' - const EVENT = 'event' - const HAT = 'hat' - const LOOP = 'loop' - const REPORTER = 'reporter' - } - - namespace TargetType { - const SPRITE = 'sprite' - const STAGE = 'stage' - } - - interface AngleArgument { - type: 'angle' - /** - * Defaults to 0. - */ - defaultValue?: string | number - } - interface BooleanArgument { - type: 'Boolean' - } - interface ColorArgument { - type: 'color' - /** - * Should be a hex color code. No alpha channel supported. Defaults to random color. - */ - defaultValue?: string | number - } - interface NumberArgument { - type: 'number' - /** - * Defaults to 0. - */ - defaultValue?: string | number - menu?: string - } - interface StringArgument { - type: 'string' - /** - * Defaults to empty string. - */ - defaultValue?: string | number - menu?: string - } - interface MatrixArgument { - type: 'matrix' - /** - * Should be a 25 character long string of 1s and 0s. - * Numbers are technically accepted, but be aware that due to floating point precision, some detail may be lost. - * Technically optional, but behaves strangely with no default value. - */ - defaultValue?: string | number - } - interface NoteArgument { - type: 'note' - /** - * Defaults to 0 ("C (0)") - */ - defaultValue?: string | number - } - interface ImageArgument { - type: 'image' - dataURI: string - /** - * Defaults to false. - */ - flipRTL?: boolean - } - type Argument = ( - AngleArgument | - BooleanArgument | - ColorArgument | - NumberArgument | - StringArgument | - MatrixArgument | - NoteArgument | - ImageArgument - ) - - interface AbstractBlock { - opcode: string - func?: string - text: string | string[] - arguments?: Record - hideFromPalette?: boolean - filter?: Array<'target' | 'sprite'> - blockIconURI?: string - } - interface BooleanBlock extends AbstractBlock { - blockType: 'Boolean' - } - interface ButtonBlock extends AbstractBlock { - blockType: 'button' - func: 'MAKE_A_LIST' | 'MAKE_A_PROCEDURE' | 'MAKE_A_VARIABLE' - } - interface CommandBlock extends AbstractBlock { - blockType: 'command' - /** - * Defaults to false. - */ - isTerminal?: boolean - } - interface ConditionalBlock extends AbstractBlock { - blockType: 'conditional' - /** - * Defaults to false. - */ - isTerminal?: boolean - /** - * Defaults to 1. - */ - branchCount?: number - } - interface EventBlock extends AbstractBlock { - blockType: 'event' - /** - * This must be explicitly set to false, otherwise the block will not work. - * Event blocks cannot be edge activated. Use hat instead. - */ - isEdgeActivated: false - /** - * Defaults to false. - */ - shouldRestartExistingThreads?: boolean - } - interface HatBlock extends AbstractBlock { - blockType: 'hat' - /** - * Defaults to true. - */ - isEdgeActivated?: boolean - /** - * Defaults to false. - */ - shouldRestartExistingThreads?: boolean - } - interface ReporterBlock extends AbstractBlock { - blockType: 'reporter' - /** - * Defaults to false. - */ - disableMonitor?: boolean - } - interface LoopBlock extends AbstractBlock { - blockType: 'loop' - /** - * Defaults to false. - */ - isTerminal?: boolean - /** - * Defaults to 1. - */ - branchCount?: number - } - type Block = ( - BooleanBlock | - ButtonBlock | - CommandBlock | - ConditionalBlock | - EventBlock | - HatBlock | - ReporterBlock | - LoopBlock - ) - - interface Menu { - acceptReporters?: boolean - /** - * A list of static items in the menu, or the name of the dynamic menu function. - */ - items: Array | string - } - - interface Info { - id: string - - /** - * Defaults to extension ID if not specified. - */ - name?: string - - /** - * Should be a hex color code. - */ - color1?: string - - /** - * Should be a hex color code. - */ - color2?: string - - /** - * Should be a hex color code. - */ - color3?: string - - /** - * Should be a data: URI - */ - menuIconURI?: string - - /** - * Should be a data: URI - */ - blockIconURI?: string - - docsURI?: string - - blocks: Array - menus?: Record - } - - interface Extension { - getInfo(): Info - } - - namespace extensions { - function register (extensionObject: Extension): void { } - /** - * True if the extension is running unsandboxed, otherwise undefined. - */ - const unsandboxed: undefined | boolean = undefined - } -} - -// @ts-expect-error -export const Scratch = top.Scratch || $Scratch diff --git a/tsconfig.json b/tsconfig.json index bed58f6..afc6c62 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,23 +1,41 @@ { - "include":["./src/**/*"] , - "compilerOptions":{ - "target" : "ES6", + "include": [ + "./src/**/*" + ], + "compilerOptions": { + "target": "ES6", "allowSyntheticDefaultImports": true, "paths": { - "scratch-vm": ["./node_modules/@turbowarp/types/index.d.ts"], - "scratch-render": ["./node_modules/@turbowarp/types/index.d.ts"], - "scratch-svg-renderer": ["./node_modules/@turbowarp/types/index.d.ts"], - "scratch-render-fonts": ["./node_modules/@turbowarp/types/index.d.ts"], - "scratch-storage": ["./node_modules/@turbowarp/types/index.d.ts"], - "scratch-audio": ["./node_modules/@turbowarp/types/index.d.ts"], - "scratch-parser": ["./node_modules/@turbowarp/types/index.d.ts"], - "scratch-blocks": ["./node_modules/@turbowarp/types/index.d.ts"], + "scratch-vm": [ + "./node_modules/@turbowarp/types/index.d.ts" + ], + "scratch-render": [ + "./node_modules/@turbowarp/types/index.d.ts" + ], + "scratch-svg-renderer": [ + "./node_modules/@turbowarp/types/index.d.ts" + ], + "scratch-render-fonts": [ + "./node_modules/@turbowarp/types/index.d.ts" + ], + "scratch-storage": [ + "./node_modules/@turbowarp/types/index.d.ts" + ], + "scratch-audio": [ + "./node_modules/@turbowarp/types/index.d.ts" + ], + "scratch-parser": [ + "./node_modules/@turbowarp/types/index.d.ts" + ], + "scratch-blocks": [ + "./node_modules/@turbowarp/types/index.d.ts" + ] }, "strictNullChecks": true, "noImplicitAny": true, "noImplicitThis": true, "removeComments": true, "noEmitOnError": true, - "strict": true, + "strict": true } -} \ No newline at end of file +} diff --git a/webpack.config.js b/webpack.config.js index f12c7dc..40bde0c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -15,7 +15,7 @@ module.exports = { { test: /\.tsx?$/, use: "ts-loader", - exclude: [ "/node-modules/", "/src/vm.ts" ], + exclude: /node-modules/, } ] },