Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix: support plug and play #685

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ plugins:
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.0.2.cjs

packageExtensions:
"@vitejs/plugin-vue@*":
peerDependencies:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we use it in vite-builder directly that also applies to end users out of workspace?

vue: "*"
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"version": "yarn && git add yarn.lock"
},
"resolutions": {
"nuxt3": "workspace:./packages/nuxt3",
"nuxt3": "workspace:*",
"unbuild": "^0.5.6",
"jiti": "^1.12.6"
},
Expand All @@ -45,7 +45,7 @@
"lerna": "^4.0.0",
"miniflare": "^1.4.1",
"mocha": "^9.1.2",
"nuxi": "workspace:./packages/nuxi",
"nuxi": "workspace:*",
"object-hash": "^2.2.0",
"pathe": "^0.2.0",
"typescript": "^4.4.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"estree-walker": "^2.0.2",
"fs-extra": "^10.0.0",
"magic-string": "^0.25.7",
"mlly": "^0.2.4",
"mlly": "^0.2.5",
"node-fetch": "^3.0.0",
"nuxi": "3.0.0",
"nuxt-vite": "^0.3.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/nitro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"jiti": "^1.12.6",
"listhen": "^0.2.4",
"mime": "^2.5.2",
"mlly": "^0.2.4",
"mlly": "^0.2.5",
"node-fetch": "^3.0.0",
"ohmyfetch": "^0.3.1",
"ora": "^6.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/nuxi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"devDependencies": {
"@nuxt/design": "0.0.6",
"@nuxt/kit": "workspace:packages/kit",
"@nuxt/kit": "workspace:*",
"@types/clear": "^0",
"@types/debounce-promise": "^3",
"@types/mri": "^1.1.1",
Expand All @@ -39,7 +39,7 @@
"flat": "^5.0.2",
"jiti": "^1.12.6",
"listhen": "^0.2.4",
"mlly": "^0.2.4",
"mlly": "^0.2.5",
"mri": "^1.2.0",
"pathe": "^0.2.0",
"scule": "^0.2.1",
Expand Down
5 changes: 3 additions & 2 deletions packages/nuxi/src/utils/cjs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createRequire } from 'module'
import { pathToFileURL } from 'url'
import { normalize, dirname } from 'pathe'
import { interopDefault } from 'mlly'

export function getModulePaths (paths?: string | string[]): string[] {
return [].concat(
Expand All @@ -26,12 +27,12 @@ export function tryResolveModule (id: string, paths?: string | string[]) {
}

export function requireModule (id: string, paths?: string | string[]) {
return _require(resolveModule(id, paths))
return interopDefault(_require(resolveModule(id, paths)))
}

export function importModule (id: string, paths?: string | string[]) {
const resolvedPath = resolveModule(id, paths)
return import(pathToFileURL(resolvedPath).href)
return import(pathToFileURL(resolvedPath).href).then(interopDefault)
}

export function getNearestPackage (id: string, paths?: string | string[]) {
Expand Down
3 changes: 2 additions & 1 deletion packages/nuxt3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"hash-sum": "^2.0.0",
"hookable": "^5.0.0",
"ignore": "^5.1.8",
"mlly": "^0.2.4",
"mlly": "^0.2.5",
"nuxi": "3.0.0",
"ohmyfetch": "^0.3.1",
"pathe": "^0.2.0",
Expand All @@ -49,6 +49,7 @@
"@types/hash-sum": "^1.0.0",
"jiti": "^1.12.6",
"unbuild": "latest",
"unenv": "^0.3.10",
"vue-meta": "next"
},
"peerDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"debounce": "^1.2.1",
"fs-extra": "^10.0.0",
"magic-string": "^0.25.7",
"p-debounce": "^4.0.0",
"pathe": "^0.2.0",
"ufo": "^0.7.9",
"vite": "^2.6.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"lodash-es": "^4.17.21",
"memfs": "^3.3.0",
"mini-css-extract-plugin": "^2.3.0",
"mlly": "^0.2.4",
"mlly": "^0.2.5",
"pathe": "^0.2.0",
"pify": "^5.0.0",
"postcss": "^8.3.9",
Expand Down
2 changes: 1 addition & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nuxt-playground",
"private": true,
"devDependencies": {
"@nuxt/kit": "workspace:packages/kit",
"@nuxt/kit": "workspace:*",
"nuxt3": "latest"
},
"scripts": {
Expand Down
24 changes: 13 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ __metadata:
fs-extra: ^10.0.0
jiti: ^1.12.6
magic-string: ^0.25.7
mlly: ^0.2.4
mlly: ^0.2.5
node-fetch: ^3.0.0
nuxi: 3.0.0
nuxt-vite: ^0.3.4
Expand Down Expand Up @@ -1476,7 +1476,7 @@ __metadata:
languageName: node
linkType: hard

"@nuxt/kit@3.0.0, @nuxt/kit@workspace:packages/kit":
"@nuxt/kit@3.0.0, @nuxt/kit@workspace:*, @nuxt/kit@workspace:packages/kit":
version: 0.0.0-use.local
resolution: "@nuxt/kit@workspace:packages/kit"
dependencies:
Expand Down Expand Up @@ -1550,7 +1550,7 @@ __metadata:
jiti: ^1.12.6
listhen: ^0.2.4
mime: ^2.5.2
mlly: ^0.2.4
mlly: ^0.2.5
node-fetch: ^3.0.0
ohmyfetch: ^0.3.1
ora: ^6.0.1
Expand Down Expand Up @@ -1603,6 +1603,7 @@ __metadata:
fs-extra: ^10.0.0
jiti: ^1.12.6
magic-string: ^0.25.7
p-debounce: ^4.0.0
pathe: ^0.2.0
ufo: ^0.7.9
unbuild: latest
Expand Down Expand Up @@ -1640,7 +1641,7 @@ __metadata:
lodash-es: ^4.17.21
memfs: ^3.3.0
mini-css-extract-plugin: ^2.3.0
mlly: ^0.2.4
mlly: ^0.2.5
pathe: ^0.2.0
pify: ^5.0.0
postcss: ^8.3.9
Expand Down Expand Up @@ -10033,12 +10034,12 @@ fsevents@~2.3.2:
languageName: node
linkType: hard

"nuxi@3.0.0, nuxi@workspace:./packages/nuxi, nuxi@workspace:packages/nuxi":
"nuxi@3.0.0, nuxi@workspace:*, nuxi@workspace:packages/nuxi":
version: 0.0.0-use.local
resolution: "nuxi@workspace:packages/nuxi"
dependencies:
"@nuxt/design": 0.0.6
"@nuxt/kit": "workspace:packages/kit"
"@nuxt/kit": "workspace:*"
"@types/clear": ^0
"@types/debounce-promise": ^3
"@types/mri": ^1.1.1
Expand All @@ -10054,7 +10055,7 @@ fsevents@~2.3.2:
fsevents: ~2.3.2
jiti: ^1.12.6
listhen: ^0.2.4
mlly: ^0.2.4
mlly: ^0.2.5
mri: ^1.2.0
pathe: ^0.2.0
scule: ^0.2.1
Expand Down Expand Up @@ -10090,7 +10091,7 @@ fsevents@~2.3.2:
lerna: ^4.0.0
miniflare: ^1.4.1
mocha: ^9.1.2
nuxi: "workspace:./packages/nuxi"
nuxi: "workspace:*"
object-hash: ^2.2.0
pathe: ^0.2.0
typescript: ^4.4.3
Expand All @@ -10102,7 +10103,7 @@ fsevents@~2.3.2:
version: 0.0.0-use.local
resolution: "nuxt-playground@workspace:playground"
dependencies:
"@nuxt/kit": "workspace:packages/kit"
"@nuxt/kit": "workspace:*"
nuxt3: latest
languageName: unknown
linkType: soft
Expand All @@ -10128,7 +10129,7 @@ fsevents@~2.3.2:
languageName: node
linkType: hard

"nuxt3@workspace:./packages/nuxt3, nuxt3@workspace:packages/nuxt3":
"nuxt3@workspace:*, nuxt3@workspace:packages/nuxt3":
version: 0.0.0-use.local
resolution: "nuxt3@workspace:packages/nuxt3"
dependencies:
Expand All @@ -10150,13 +10151,14 @@ fsevents@~2.3.2:
hookable: ^5.0.0
ignore: ^5.1.8
jiti: ^1.12.6
mlly: ^0.2.4
mlly: ^0.2.5
nuxi: 3.0.0
ohmyfetch: ^0.3.1
pathe: ^0.2.0
scule: ^0.2.1
ufo: ^0.7.9
unbuild: latest
unenv: ^0.3.10
unplugin: ^0.2.16
vue: ^3.2.19
vue-meta: next
Expand Down