fix(bridge): plugin default detection (#1847)

Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
Anthony Fu 2021-11-11 21:58:43 +08:00 committed by GitHub
parent e609f9f542
commit 202617bdd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 23 additions and 16 deletions

View File

@ -35,7 +35,7 @@
"globby": "^11.0.4",
"hash-sum": "^2.0.0",
"magic-string": "^0.25.7",
"mlly": "^0.3.12",
"mlly": "^0.3.13",
"node-fetch": "^3.1.0",
"nuxi": "3.0.0",
"p-debounce": "^4.0.0",

View File

@ -26,7 +26,7 @@ export function defaultExportPlugin () {
if (hasPrefix(id)) {
let code = await fse.readFile(removePrefix(id), 'utf8')
const exports = findExports(code)
if (!exports.find(i => i.type === 'default' || i.name === 'default')) {
if (!exports.find(i => i.names.includes('default'))) {
code = addDefaultExport(code)
}
return { map: null, code }

View File

@ -28,7 +28,7 @@
"hookable": "^5.0.0",
"jiti": "^1.12.9",
"lodash.template": "^4.5.0",
"mlly": "^0.3.12",
"mlly": "^0.3.13",
"pathe": "^0.2.0",
"pkg-types": "^0.3.1",
"rc9": "^1.2.0",

View File

@ -50,7 +50,7 @@
"jiti": "^1.12.9",
"listhen": "^0.2.5",
"mime": "^3.0.0",
"mlly": "^0.3.12",
"mlly": "^0.3.13",
"node-fetch": "^3.1.0",
"ohmyfetch": "^0.4.6",
"ora": "^6.0.1",

View File

@ -34,7 +34,7 @@
"flat": "^5.0.2",
"jiti": "^1.12.9",
"listhen": "^0.2.5",
"mlly": "^0.3.12",
"mlly": "^0.3.13",
"mri": "^1.2.0",
"p-debounce": "^4.0.0",
"pathe": "^0.2.0",

View File

@ -34,7 +34,7 @@
"hash-sum": "^2.0.0",
"hookable": "^5.0.0",
"ignore": "^5.1.9",
"mlly": "^0.3.12",
"mlly": "^0.3.13",
"murmurhash-es": "^0.1.1",
"nuxi": "3.0.0",
"ohmyfetch": "^0.4.6",

View File

@ -28,7 +28,7 @@
"externality": "^0.1.5",
"fs-extra": "^10.0.0",
"magic-string": "^0.25.7",
"mlly": "^0.3.12",
"mlly": "^0.3.13",
"p-debounce": "^4.0.0",
"pathe": "^0.2.0",
"postcss-import": "^14.0.2",

View File

@ -34,7 +34,7 @@
"lodash-es": "^4.17.21",
"memfs": "^3.3.0",
"mini-css-extract-plugin": "^2.4.4",
"mlly": "^0.3.12",
"mlly": "^0.3.13",
"pathe": "^0.2.0",
"pify": "^5.0.0",
"postcss": "^8.3.11",

View File

@ -2411,7 +2411,7 @@ __metadata:
globby: ^11.0.4
hash-sum: ^2.0.0
magic-string: ^0.25.7
mlly: ^0.3.12
mlly: ^0.3.13
node-fetch: ^3.1.0
nuxi: 3.0.0
nuxt: ^2
@ -2615,7 +2615,7 @@ __metadata:
hookable: ^5.0.0
jiti: ^1.12.9
lodash.template: ^4.5.0
mlly: ^0.3.12
mlly: ^0.3.13
pathe: ^0.2.0
pkg-types: ^0.3.1
rc9: ^1.2.0
@ -2687,7 +2687,7 @@ __metadata:
jiti: ^1.12.9
listhen: ^0.2.5
mime: ^3.0.0
mlly: ^0.3.12
mlly: ^0.3.13
node-fetch: ^3.1.0
ohmyfetch: ^0.4.6
ora: ^6.0.1
@ -2856,7 +2856,7 @@ __metadata:
externality: ^0.1.5
fs-extra: ^10.0.0
magic-string: ^0.25.7
mlly: ^0.3.12
mlly: ^0.3.13
p-debounce: ^4.0.0
pathe: ^0.2.0
postcss-import: ^14.0.2
@ -2937,7 +2937,7 @@ __metadata:
lodash-es: ^4.17.21
memfs: ^3.3.0
mini-css-extract-plugin: ^2.4.4
mlly: ^0.3.12
mlly: ^0.3.13
pathe: ^0.2.0
pify: ^5.0.0
postcss: ^8.3.11
@ -13769,13 +13769,20 @@ __metadata:
languageName: node
linkType: hard
"mlly@npm:^0.3.0, mlly@npm:^0.3.10, mlly@npm:^0.3.12, mlly@npm:^0.3.6":
"mlly@npm:^0.3.0, mlly@npm:^0.3.10, mlly@npm:^0.3.6":
version: 0.3.12
resolution: "mlly@npm:0.3.12"
checksum: f9f93622023f4a9adfd27c465ff40146725cbb17176eb3610f4cec73f31edca41dc571030d185406d30044aaa0565a75782ac74a69be3cc58c10fc50505bb74d
languageName: node
linkType: hard
"mlly@npm:^0.3.13":
version: 0.3.13
resolution: "mlly@npm:0.3.13"
checksum: cd17c0efd85a65ac50e2c7fb30357341b772c6167fb3efc7f74a021443a126fdf1bc3952ce98bb3aed3018ba77baddf6a813ece2f29be2310a545f5be2657c99
languageName: node
linkType: hard
"mocha@npm:^9.1.3":
version: 9.1.3
resolution: "mocha@npm:9.1.3"
@ -14550,7 +14557,7 @@ __metadata:
fsevents: ~2.3.2
jiti: ^1.12.9
listhen: ^0.2.5
mlly: ^0.3.12
mlly: ^0.3.13
mri: ^1.2.0
p-debounce: ^4.0.0
pathe: ^0.2.0
@ -14627,7 +14634,7 @@ __metadata:
hash-sum: ^2.0.0
hookable: ^5.0.0
ignore: ^5.1.9
mlly: ^0.3.12
mlly: ^0.3.13
murmurhash-es: ^0.1.1
nuxi: 3.0.0
ohmyfetch: ^0.4.6