Skip to content

Commit

Permalink
build: update to latest @nuxt/module-builder (#712)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <[email protected]>
  • Loading branch information
danielroe and antfu committed Aug 24, 2024
1 parent d8dfc89 commit b3f386a
Show file tree
Hide file tree
Showing 9 changed files with 282 additions and 1,313 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@antfu/ni": "^0.22.4",
"@nuxt/devtools": "workspace:*",
"@nuxt/devtools-ui-kit": "workspace:*",
"@nuxt/module-builder": "~0.6.0",
"@nuxt/module-builder": "^0.8.3",
"@nuxt/schema": "^3.13.0",
"@types/markdown-it": "^14.1.2",
"@types/node": "^22.5.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools-kit/host-client.mjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './dist/runtime/host-client.mjs'
export * from './dist/runtime/host-client.js'
2 changes: 1 addition & 1 deletion packages/devtools-kit/iframe-client.mjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './dist/runtime/iframe-client.mjs'
export * from './dist/runtime/iframe-client.js'
29 changes: 0 additions & 29 deletions packages/devtools/build.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { fileURLToPath } from 'node:url'
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
Expand All @@ -23,32 +22,4 @@ export default defineBuildConfig({
rollup: {
inlineDependencies: true,
},
hooks: {
// Patch @nuxt/[email protected] not adding .mjs extension for runtime files
// https://github.com/nuxt/module-builder/issues/261
'rollup:options': (_, options) => {
options.plugins ||= []
if (!Array.isArray(options.plugins))
options.plugins = [options.plugins]

const runtimeDir = fileURLToPath(new URL('./src/runtime', import.meta.url))
options.plugins.unshift({
name: 'unbuild:runtime-build:patch',
async resolveId(id, importter) {
if (!id.includes('runtime'))
return
const resolved = await this.resolve(id, importter, { skipSelf: true })
if (resolved?.id.startsWith(runtimeDir)) {
let id = resolved.id
if (!id.endsWith('.mjs'))
id += '.mjs'
return {
external: true,
id,
}
}
},
})
},
},
})
2 changes: 1 addition & 1 deletion packages/devtools/src/integrations/vue-devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function setup({ nuxt }: NuxtDevtoolsServerContext) {
const appendTo = /\/entry\.m?js$/

if (!options?.ssr && appendTo.test(filename))
code = `import 'virtual:vue-devtools-path:overlay.mjs';\n${code}`
code = `import 'virtual:vue-devtools-path:overlay.js';\n${code}`

return code
},
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools/src/server-rpc/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function setupOptionsRPC({ nuxt }: NuxtDevtoolsServerContext) {
)
nuxt.callHook('builder:generateApp', {
filter(template) {
return template.filename.includes('devtools/settings.mjs')
return template.filename.includes('devtools/settings.js')
},
})
},
Expand Down
2 changes: 1 addition & 1 deletion playgrounds/module-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@iconify-json/carbon": "^1.1.37",
"@nuxt/devtools": "workspace:*",
"@nuxt/devtools-ui-kit": "workspace:*",
"@nuxt/module-builder": "~0.6.0",
"@nuxt/module-builder": "^0.8.3",
"@nuxt/schema": "^3.13.0",
"@nuxt/test-utils": "^3.14.1",
"eslint": "^9.9.0",
Expand Down
1,554 changes: 276 additions & 1,278 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

0 comments on commit b3f386a

Please sign in to comment.