From a4e903e55eb512a5615636a01af434624927cba0 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Mon, 11 Oct 2021 16:21:45 +0800 Subject: [PATCH] fix(bridge): use esm for `unplugin-vue2-script-setup` (#690) --- packages/bridge/package.json | 2 +- packages/bridge/src/setup.ts | 5 +- yarn.lock | 282 ++++------------------------------- 3 files changed, 33 insertions(+), 256 deletions(-) diff --git a/packages/bridge/package.json b/packages/bridge/package.json index 706f12825a..3a05167b0d 100644 --- a/packages/bridge/package.json +++ b/packages/bridge/package.json @@ -34,7 +34,7 @@ "pathe": "^0.2.0", "ufo": "^0.7.9", "unplugin": "^0.2.16", - "unplugin-vue2-script-setup": "^0.6.7" + "unplugin-vue2-script-setup": "0.6.10" }, "devDependencies": { "@types/fs-extra": "^9.0.13", diff --git a/packages/bridge/src/setup.ts b/packages/bridge/src/setup.ts index e270a69212..351e0cd1e3 100644 --- a/packages/bridge/src/setup.ts +++ b/packages/bridge/src/setup.ts @@ -1,8 +1,5 @@ -import { createRequire } from 'module' import { addVitePlugin, addWebpackPlugin, useNuxt } from '@nuxt/kit' - -const _require = createRequire(import.meta.url) -const scriptSetupPlugin = _require('unplugin-vue2-script-setup').default +import scriptSetupPlugin from 'unplugin-vue2-script-setup' export const setupScriptSetup = () => { const nuxt = useNuxt() diff --git a/yarn.lock b/yarn.lock index 30c3f32d1a..9a3f7ef52c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,6 +5,15 @@ __metadata: version: 4 cacheKey: 8 +"@antfu/utils@npm:^0.3.0": + version: 0.3.0 + resolution: "@antfu/utils@npm:0.3.0" + dependencies: + "@types/throttle-debounce": ^2.1.0 + checksum: 1f42790560e1768e16d05e302c9f1a69e64c3e048ab5a79d2d9f5c0d92d350e910f54c097475a0ed702a576ce0d306a6af68c7b0c53335df109358cf13f0cd0c + languageName: node + linkType: hard + "@babel/code-frame@npm:7.12.11": version: 7.12.11 resolution: "@babel/code-frame@npm:7.12.11" @@ -343,7 +352,7 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.13.10, @babel/parser@npm:^7.15.0, @babel/parser@npm:^7.15.4, @babel/parser@npm:^7.15.6, @babel/parser@npm:^7.15.8, @babel/parser@npm:^7.6.0, @babel/parser@npm:^7.9.6": +"@babel/parser@npm:^7.13.10, @babel/parser@npm:^7.15.0, @babel/parser@npm:^7.15.4, @babel/parser@npm:^7.15.6, @babel/parser@npm:^7.15.8": version: 7.15.8 resolution: "@babel/parser@npm:7.15.8" bin: @@ -1313,7 +1322,7 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.15.4, @babel/types@npm:^7.15.6, @babel/types@npm:^7.4.4, @babel/types@npm:^7.6.1, @babel/types@npm:^7.8.3, @babel/types@npm:^7.9.6": +"@babel/types@npm:^7.15.4, @babel/types@npm:^7.15.6, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": version: 7.15.6 resolution: "@babel/types@npm:7.15.6" dependencies: @@ -2402,7 +2411,7 @@ __metadata: ufo: ^0.7.9 unbuild: latest unplugin: ^0.2.16 - unplugin-vue2-script-setup: ^0.6.7 + unplugin-vue2-script-setup: 0.6.10 vue-router: 3 languageName: unknown linkType: soft @@ -3634,6 +3643,13 @@ __metadata: languageName: node linkType: hard +"@types/throttle-debounce@npm:^2.1.0": + version: 2.1.0 + resolution: "@types/throttle-debounce@npm:2.1.0" + checksum: 70e219d000595108fce0dc624c8296e37cdb174b528e09c939da18e619da1c6df86b088659f5eb93cb146bd5fe2954597823c2e1f0849dc8f6585d87cbbf71b7 + languageName: node + linkType: hard + "@types/tough-cookie@npm:*": version: 4.0.1 resolution: "@types/tough-cookie@npm:4.0.1" @@ -4977,7 +4993,7 @@ __metadata: languageName: node linkType: hard -"asap@npm:^2.0.0, asap@npm:~2.0.3": +"asap@npm:^2.0.0": version: 2.0.6 resolution: "asap@npm:2.0.6" checksum: b296c92c4b969e973260e47523207cd5769abd27c245a68c26dc7a0fe8053c55bb04360237cb51cab1df52be939da77150ace99ad331fb7fb13b3423ed73ff3d @@ -5014,13 +5030,6 @@ __metadata: languageName: node linkType: hard -"assert-never@npm:^1.2.1": - version: 1.2.1 - resolution: "assert-never@npm:1.2.1" - checksum: ea4f1756d90f55254c4dc7a20d6c5d5bc169160562aefe3d8756b598c10e695daf568f21b6d6b12245d7f3782d3ff83ef6a01ab75d487adfc6909470a813bf8c - languageName: node - linkType: hard - "assert-plus@npm:1.0.0, assert-plus@npm:^1.0.0": version: 1.0.0 resolution: "assert-plus@npm:1.0.0" @@ -5754,15 +5763,6 @@ __metadata: languageName: node linkType: hard -"babel-walk@npm:3.0.0-canary-5": - version: 3.0.0-canary-5 - resolution: "babel-walk@npm:3.0.0-canary-5" - dependencies: - "@babel/types": ^7.9.6 - checksum: 6fe7ee3889343a6602f665c28ea135956a0767d7f7ca5fc1d72c5243e2f6e9d8a64f51254bf2fd0cce47b79fceeccf7a357f37cfa755a509dfb930a21151837c - languageName: node - linkType: hard - "babylon@npm:^6.18.0": version: 6.18.0 resolution: "babylon@npm:6.18.0" @@ -6442,15 +6442,6 @@ __metadata: languageName: node linkType: hard -"character-parser@npm:^2.2.0": - version: 2.2.0 - resolution: "character-parser@npm:2.2.0" - dependencies: - is-regex: ^1.0.3 - checksum: 71826fae509d4dc3ef07c2e824da9c8853f910ba0d8fe699edaab263051fd3b8db77bb96e46ed896bb36ed1d86108e6d6ceedff436bec7786ba7f0b585a0bc93 - languageName: node - linkType: hard - "chardet@npm:^0.7.0": version: 0.7.0 resolution: "chardet@npm:0.7.0" @@ -7037,16 +7028,6 @@ __metadata: languageName: node linkType: hard -"constantinople@npm:^4.0.1": - version: 4.0.1 - resolution: "constantinople@npm:4.0.1" - dependencies: - "@babel/parser": ^7.6.0 - "@babel/types": ^7.6.1 - checksum: 8f70f16ddf97cdc263ca16b398bc52470c25e2ec5ed27bc015f251b849597223ce3a123e6924f43efddeb75422c1f55b7e56e0e2e594e4dd2964bfc9392b9b82 - languageName: node - linkType: hard - "constants-browserify@npm:^1.0.0": version: 1.0.0 resolution: "constants-browserify@npm:1.0.0" @@ -8212,13 +8193,6 @@ __metadata: languageName: node linkType: hard -"doctypes@npm:^1.1.0": - version: 1.1.0 - resolution: "doctypes@npm:1.1.0" - checksum: 6e6c2d1a80f2072dc4831994c914c44455e341c5ab18c16797368a0afd59d7c22f3335805ba2c1dd2931e9539d1ba8b613b7650dc63f6ab56b77b8d888055de8 - languageName: node - linkType: hard - "dom-converter@npm:^0.2.0": version: 0.2.0 resolution: "dom-converter@npm:0.2.0" @@ -11239,16 +11213,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"is-expression@npm:^4.0.0": - version: 4.0.0 - resolution: "is-expression@npm:4.0.0" - dependencies: - acorn: ^7.1.1 - object-assign: ^4.1.1 - checksum: 0f01d0ff53fbbec36abae8fbb7ef056c6d024f7128646856a3e6c500b205788d3e0f337025e72df979d7d7cf4674a00370633d7f8974c668b2d3fdb7e8a83bdb - languageName: node - linkType: hard - "is-extendable@npm:^0.1.0, is-extendable@npm:^0.1.1": version: 0.1.1 resolution: "is-extendable@npm:0.1.1" @@ -11419,13 +11383,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"is-promise@npm:^2.0.0": - version: 2.2.2 - resolution: "is-promise@npm:2.2.2" - checksum: 18bf7d1c59953e0ad82a1ed963fb3dc0d135c8f299a14f89a17af312fc918373136e56028e8831700e1933519630cc2fd4179a777030330fde20d34e96f40c78 - languageName: node - linkType: hard - "is-promise@npm:^4.0.0": version: 4.0.0 resolution: "is-promise@npm:4.0.0" @@ -11442,7 +11399,7 @@ fsevents@~2.3.2: languageName: node linkType: hard -"is-regex@npm:^1.0.3, is-regex@npm:^1.1.4": +"is-regex@npm:^1.1.4": version: 1.1.4 resolution: "is-regex@npm:1.1.4" dependencies: @@ -11657,13 +11614,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"js-stringify@npm:^1.0.2": - version: 1.0.2 - resolution: "js-stringify@npm:1.0.2" - checksum: f9701d9e535d3ac0f62bbf2624b76c5d0af5b889187232817ae284a41ba21fd7a8b464c2dce3815d8cf52c8bea3480be6b368cfc2c67da799cad458058e8bbf5 - languageName: node - linkType: hard - "js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0": version: 4.0.0 resolution: "js-tokens@npm:4.0.0" @@ -11862,16 +11812,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"jstransformer@npm:1.0.0": - version: 1.0.0 - resolution: "jstransformer@npm:1.0.0" - dependencies: - is-promise: ^2.0.0 - promise: ^7.0.1 - checksum: 1e019fde17a38766a5b96bccf0738156badc60cfa61e2ba8a8bbd3b855e7d5d7e17492b8a66e4aaabc39483e335d23217343ae32d0f7e5a81af42a95c3e075f9 - languageName: node - linkType: hard - "kind-of@npm:^3.0.2, kind-of@npm:^3.0.3, kind-of@npm:^3.2.0": version: 3.2.2 resolution: "kind-of@npm:3.2.2" @@ -15988,15 +15928,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"promise@npm:^7.0.1": - version: 7.3.1 - resolution: "promise@npm:7.3.1" - dependencies: - asap: ~2.0.3 - checksum: 475bb069130179fbd27ed2ab45f26d8862376a137a57314cf53310bdd85cc986a826fd585829be97ebc0aaf10e9d8e68be1bfe5a4a0364144b1f9eedfa940cf1 - languageName: node - linkType: hard - "promzard@npm:^0.3.0": version: 0.3.0 resolution: "promzard@npm:0.3.0" @@ -16066,133 +15997,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"pug-attrs@npm:^3.0.0": - version: 3.0.0 - resolution: "pug-attrs@npm:3.0.0" - dependencies: - constantinople: ^4.0.1 - js-stringify: ^1.0.2 - pug-runtime: ^3.0.0 - checksum: 2ca2d34de3065239f01f0fc3c0e104c17f7a7105684d088bb71df623005a45f40a2301e65f49ec4581bb31794c74e691862643d4e34062d1509e92fa56a15aa5 - languageName: node - linkType: hard - -"pug-code-gen@npm:^3.0.2": - version: 3.0.2 - resolution: "pug-code-gen@npm:3.0.2" - dependencies: - constantinople: ^4.0.1 - doctypes: ^1.1.0 - js-stringify: ^1.0.2 - pug-attrs: ^3.0.0 - pug-error: ^2.0.0 - pug-runtime: ^3.0.0 - void-elements: ^3.1.0 - with: ^7.0.0 - checksum: 1644d3a4d673392794248749eb146299704639a8197746454b7d03b240b83ee102f25b76d203381501e283be3927ab01eb3f4563ff51c45a478de1f3435a400d - languageName: node - linkType: hard - -"pug-error@npm:^2.0.0": - version: 2.0.0 - resolution: "pug-error@npm:2.0.0" - checksum: c5372d018c897c1d6a141dd803c50957feecfda1f3d84a6adc6149801315d6c7f8c28b05f3e186d98d774fc9718699d1e1caa675630dd3c4453f8c5ec4e4a986 - languageName: node - linkType: hard - -"pug-filters@npm:^4.0.0": - version: 4.0.0 - resolution: "pug-filters@npm:4.0.0" - dependencies: - constantinople: ^4.0.1 - jstransformer: 1.0.0 - pug-error: ^2.0.0 - pug-walk: ^2.0.0 - resolve: ^1.15.1 - checksum: 44eb3273195e3f42f034ad81109452236377780557eaf5a28db6e478f297675e19b8598cca9de65a0ba9c1d57e2ca2a93e332f0ab4be79dc5dd042375228cdff - languageName: node - linkType: hard - -"pug-lexer@npm:^5.0.1": - version: 5.0.1 - resolution: "pug-lexer@npm:5.0.1" - dependencies: - character-parser: ^2.2.0 - is-expression: ^4.0.0 - pug-error: ^2.0.0 - checksum: afdd2f43f2c3ba96001a7b734c0c3bc745eb5d7dd68c787c2690c606d34573ca46ba807e4b4c7e70db9b4556fb938625dbb9c25b79cdb8857868e6deb2574d3e - languageName: node - linkType: hard - -"pug-linker@npm:^4.0.0": - version: 4.0.0 - resolution: "pug-linker@npm:4.0.0" - dependencies: - pug-error: ^2.0.0 - pug-walk: ^2.0.0 - checksum: 7433aa65181cd5b7bc631ab5f14baae7496fd8da98608cbd55bbea9bc72fe69a863e72026781a9fe76ab429d7037465b942145455420ee1178e2875ec87a1e12 - languageName: node - linkType: hard - -"pug-load@npm:^3.0.0": - version: 3.0.0 - resolution: "pug-load@npm:3.0.0" - dependencies: - object-assign: ^4.1.1 - pug-walk: ^2.0.0 - checksum: 1800ec51994c92338401bcf79bbfa0d5ef9aa312bc415c2618263d6c04d1d7c5be5ac4a333c47a0eaa823f6231b4ade1a1c40f5784b99eb576d25853597bff2f - languageName: node - linkType: hard - -"pug-parser@npm:^6.0.0": - version: 6.0.0 - resolution: "pug-parser@npm:6.0.0" - dependencies: - pug-error: ^2.0.0 - token-stream: 1.0.0 - checksum: a6954d1383601233ec9d58e8fb22339f4809cf938272db16c551d8574566f388af3bf5560ec95ad5e23902bc358e6fa857409e840de4ed1ff5120a1dd6892cca - languageName: node - linkType: hard - -"pug-runtime@npm:^3.0.0, pug-runtime@npm:^3.0.1": - version: 3.0.1 - resolution: "pug-runtime@npm:3.0.1" - checksum: 48a71b587caa08a5bccf9c1164206a34067edc1d13c2164bebad2dc562b529317578f889a0c41f0e16ddab3853c599696ff29a085f2d4554b783228f0002c41b - languageName: node - linkType: hard - -"pug-strip-comments@npm:^2.0.0": - version: 2.0.0 - resolution: "pug-strip-comments@npm:2.0.0" - dependencies: - pug-error: ^2.0.0 - checksum: 2cfcbf506c14bb3e64204a1d93f12ca61658d2540475b0f0911c35531ad28421e8d1e73a646d841d58cfa2c20f8593c52e492dfe5b6bec968e20b614e4dea1e4 - languageName: node - linkType: hard - -"pug-walk@npm:^2.0.0": - version: 2.0.0 - resolution: "pug-walk@npm:2.0.0" - checksum: bee64e133b711e1ed58022c0869b59e62f9f3ebb7084293857f074120b3cb588e7b8f74c4566426bf2b26dc1ec176ca6b64a2d1e53782f3fbbe039c5d4816638 - languageName: node - linkType: hard - -"pug@npm:^3.0.2": - version: 3.0.2 - resolution: "pug@npm:3.0.2" - dependencies: - pug-code-gen: ^3.0.2 - pug-filters: ^4.0.0 - pug-lexer: ^5.0.1 - pug-linker: ^4.0.0 - pug-load: ^3.0.0 - pug-parser: ^6.0.0 - pug-runtime: ^3.0.1 - pug-strip-comments: ^2.0.0 - checksum: 3e1a3d48897c0c7dedd4f959ce8afaf6417a63756b149e1b5382bef16de5792ec7c7ae6a7d41641059cb149520f20b0d1ecf57014c0661526e96f0bad88541e5 - languageName: node - linkType: hard - "pump@npm:^2.0.0": version: 2.0.1 resolution: "pump@npm:2.0.1" @@ -16896,7 +16700,7 @@ fsevents@~2.3.2: languageName: node linkType: hard -"resolve@^1.1.7, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.17.0, resolve@^1.19.0, resolve@^1.2.0, resolve@^1.20.0": +"resolve@^1.1.7, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.19.0, resolve@^1.2.0, resolve@^1.20.0": version: 1.20.0 resolution: "resolve@npm:1.20.0" dependencies: @@ -16906,7 +16710,7 @@ fsevents@~2.3.2: languageName: node linkType: hard -"resolve@patch:resolve@^1.1.7#~builtin, resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.10.1#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.15.1#~builtin, resolve@patch:resolve@^1.17.0#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.2.0#~builtin, resolve@patch:resolve@^1.20.0#~builtin": +"resolve@patch:resolve@^1.1.7#~builtin, resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.10.1#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.17.0#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.2.0#~builtin, resolve@patch:resolve@^1.20.0#~builtin": version: 1.20.0 resolution: "resolve@patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=00b1ff" dependencies: @@ -18548,13 +18352,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"token-stream@npm:1.0.0": - version: 1.0.0 - resolution: "token-stream@npm:1.0.0" - checksum: e8adb56f31b813b6157130e7fc2fe14eb60e7cbf7b746e70e8293c7e55664d8e7ad5d93d7ae3aa4cad7fcb2b0aaf59dad6f2fd4ee0269204e55af5b05bc369e2 - languageName: node - linkType: hard - "totalist@npm:^1.0.0": version: 1.1.0 resolution: "totalist@npm:1.1.0" @@ -19033,10 +18830,11 @@ fsevents@~2.3.2: languageName: node linkType: hard -"unplugin-vue2-script-setup@npm:^0.6.7": - version: 0.6.7 - resolution: "unplugin-vue2-script-setup@npm:0.6.7" +"unplugin-vue2-script-setup@npm:0.6.10": + version: 0.6.10 + resolution: "unplugin-vue2-script-setup@npm:0.6.10" dependencies: + "@antfu/utils": ^0.3.0 "@babel/core": ^7.15.5 "@babel/generator": ^7.15.4 "@babel/parser": ^7.15.6 @@ -19048,12 +18846,13 @@ fsevents@~2.3.2: defu: ^5.0.0 htmlparser2: ^7.1.2 magic-string: ^0.25.7 - pug: ^3.0.2 unplugin: ^0.2.11 - dependenciesMeta: + peerDependencies: + pug: ^3.0.2 + peerDependenciesMeta: pug: optional: true - checksum: eb2884b2e18d0dd2833835d68f25133b3f27f18ffb6ef80d845c5a375b8cdd48fdbb8a0cfc2eb03c89dd09c0f399b81dbbed3bb2718340da5592db50219b95ee + checksum: 975c39c467398f8f5a4cde1801123fa6b413ab69a35af570ade8ac7e4cdefd302591af906ae3e6bc01fda74720efb173daf3985782547fb6b3d444b1030d0c52 languageName: node linkType: hard @@ -19438,13 +19237,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"void-elements@npm:^3.1.0": - version: 3.1.0 - resolution: "void-elements@npm:3.1.0" - checksum: 0390f818107fa8fce55bb0a5c3f661056001c1d5a2a48c28d582d4d847347c2ab5b7f8272314cac58acf62345126b6b09bea623a185935f6b1c3bbce0dfd7f7f - languageName: node - linkType: hard - "vue-bundle-renderer@npm:^0.3.1": version: 0.3.1 resolution: "vue-bundle-renderer@npm:0.3.1" @@ -20069,18 +19861,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"with@npm:^7.0.0": - version: 7.0.2 - resolution: "with@npm:7.0.2" - dependencies: - "@babel/parser": ^7.9.6 - "@babel/types": ^7.9.6 - assert-never: ^1.2.1 - babel-walk: 3.0.0-canary-5 - checksum: a00fe87b736e434bd8b9d3e62ddcd664bde7d3990a011a0f1bdeb499db0d6c28e6d2ef921dcc47650b8d436eee55459bcae8fab4ce1ed89f4926ddda407ab755 - languageName: node - linkType: hard - "word-wrap@npm:^1.2.3": version: 1.2.3 resolution: "word-wrap@npm:1.2.3"