feat: use native esm for all packages (#539)

This commit is contained in:
pooya parsa 2021-10-02 18:01:17 +02:00 committed by GitHub
parent f21b7de3d1
commit 6e496373f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
83 changed files with 472 additions and 366 deletions

View File

@ -48,8 +48,8 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: yarn --immutable run: yarn --immutable
- name: Stub - name: Build
run: yarn stub run: yarn build
- name: Test (unit) - name: Test (unit)
run: yarn test:unit run: yarn test:unit
@ -81,8 +81,8 @@ jobs:
- name: Install dependencies (bridge fixture) - name: Install dependencies (bridge fixture)
run: yarn --immutable && cd test/fixtures/bridge && yarn --immutable run: yarn --immutable && cd test/fixtures/bridge && yarn --immutable
- name: Stub - name: Build
run: yarn stub run: yarn build
- name: Test (presets bridge) - name: Test (presets bridge)
run: yarn test:bridge run: yarn test:bridge

View File

@ -1,6 +1,7 @@
{ {
"name": "nuxt-framework", "name": "nuxt-framework",
"license": "MIT", "license": "MIT",
"type": "module",
"workspaces": [ "workspaces": [
"packages/*", "packages/*",
"examples/*", "examples/*",

View File

@ -1,6 +1,7 @@
import { defineBuildConfig } from 'unbuild' import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig({ export default defineBuildConfig({
emitCJS: false,
entries: [ entries: [
'src/module', 'src/module',
{ input: 'src/runtime/', outDir: 'dist/runtime', format: 'esm' } { input: 'src/runtime/', outDir: 'dist/runtime', format: 'esm' }

View File

@ -0,0 +1,4 @@
// CommonJS proxy to bypass jiti transforms from nuxt 2
module.exports = function (...args) {
return import('./dist/module.mjs').then(m => m.default.call(this, ...args))
}

View File

@ -3,9 +3,11 @@
"version": "0.0.0", "version": "0.0.0",
"repository": "nuxt/framework", "repository": "nuxt/framework",
"license": "MIT", "license": "MIT",
"main": "./dist/module.cjs", "type": "module",
"exports": "./module.cjs",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"files": [ "files": [
"module.cjs",
"dist" "dist"
], ],
"scripts": { "scripts": {
@ -22,6 +24,7 @@
"estree-walker": "^2.0.2", "estree-walker": "^2.0.2",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"magic-string": "^0.25.7", "magic-string": "^0.25.7",
"mlly": "^0.2.2",
"node-fetch": "^3.0.0", "node-fetch": "^3.0.0",
"nuxi": "^0.10.0", "nuxi": "^0.10.0",
"nuxt-swc": "^0.1.0", "nuxt-swc": "^0.1.0",

View File

@ -1,15 +1,24 @@
// Based on https://github.com/webpack/webpack/blob/v4.46.0/lib/node/NodeMainTemplatePlugin.js#L81-L191 // Based on https://github.com/webpack/webpack/blob/v4.46.0/lib/node/NodeMainTemplatePlugin.js#L81-L191
import { createRequire } from 'module'
import type { Compiler } from 'webpack' import type { Compiler } from 'webpack'
export class AsyncLoadingPlugin { export class AsyncLoadingPlugin {
private opts: any
private Template: any
constructor (opts) {
this.opts = opts
const _require = createRequire(import.meta.url)
const TemplatePath = _require.resolve('webpack/lib/Template', { paths: [...this.opts.modulesDir] })
this.Template = _require(TemplatePath)
}
apply (compiler: Compiler) { apply (compiler: Compiler) {
const Template = require('webpack/lib/Template')
compiler.hooks.compilation.tap('AsyncLoading', (compilation) => { compiler.hooks.compilation.tap('AsyncLoading', (compilation) => {
const mainTemplate = compilation.mainTemplate const mainTemplate = compilation.mainTemplate
mainTemplate.hooks.requireEnsure.tap( mainTemplate.hooks.requireEnsure.tap(
'AsyncLoading', 'AsyncLoading',
(_source, chunk, hash) => { (_source, chunk, hash) => {
const Template = this.Template
const chunkFilename = mainTemplate.outputOptions.chunkFilename const chunkFilename = mainTemplate.outputOptions.chunkFilename
const chunkMaps = chunk.getChunkMaps() const chunkMaps = chunk.getChunkMaps()
const insertMoreModules = [ const insertMoreModules = [

View File

@ -1,6 +1,6 @@
import { createRequire } from 'module'
import { useNuxt, addPlugin, addPluginTemplate, addVitePlugin, addWebpackPlugin } from '@nuxt/kit' import { useNuxt, addPlugin, addPluginTemplate, addVitePlugin, addWebpackPlugin } from '@nuxt/kit'
import { resolve } from 'pathe' import { resolve } from 'pathe'
import { distDir } from './dirs' import { distDir } from './dirs'
import { KeyPlugin } from './capi-legacy-key-plugin' import { KeyPlugin } from './capi-legacy-key-plugin'
@ -13,7 +13,8 @@ export function setupCAPIBridge (_options: any) {
} }
// Add composition-api support // Add composition-api support
const vueCapiEntry = require.resolve('@vue/composition-api/dist/vue-composition-api.mjs') const _require = createRequire(import.meta.url)
const vueCapiEntry = _require.resolve('@vue/composition-api/dist/vue-composition-api.mjs')
nuxt.options.alias['@vue/composition-api/dist/vue-composition-api.common.js'] = vueCapiEntry nuxt.options.alias['@vue/composition-api/dist/vue-composition-api.common.js'] = vueCapiEntry
nuxt.options.alias['@vue/composition-api/dist/vue-composition-api.common.prod.js'] = vueCapiEntry nuxt.options.alias['@vue/composition-api/dist/vue-composition-api.common.prod.js'] = vueCapiEntry
nuxt.options.alias['@vue/composition-api/dist/vue-composition-api.esm.js'] = vueCapiEntry nuxt.options.alias['@vue/composition-api/dist/vue-composition-api.esm.js'] = vueCapiEntry

View File

@ -1,4 +1,5 @@
import { resolve } from 'pathe' import { fileURLToPath } from 'url'
import { dirname, resolve } from 'pathe'
export const distDir = __dirname export const distDir = dirname(fileURLToPath(import.meta.url))
export const pkgDir = resolve(distDir, '..') export const pkgDir = resolve(distDir, '..')

View File

@ -1,3 +1,4 @@
import { createRequire } from 'module'
import { defineNuxtModule, installModule } from '@nuxt/kit' import { defineNuxtModule, installModule } from '@nuxt/kit'
import { setupNitroBridge } from './nitro' import { setupNitroBridge } from './nitro'
import { setupAppBridge } from './app' import { setupAppBridge } from './app'
@ -30,14 +31,15 @@ export default defineNuxtModule({
} }
await setupCAPIBridge(opts.capi) await setupCAPIBridge(opts.capi)
} }
const _require = createRequire(import.meta.url)
if (opts.vite) { if (opts.vite) {
await installModule(nuxt, require.resolve('nuxt-vite')) await installModule(nuxt, _require.resolve('nuxt-vite'))
} }
if (opts.postcss8) { if (opts.postcss8) {
await installModule(nuxt, require.resolve('@nuxt/postcss8')) await installModule(nuxt, _require.resolve('@nuxt/postcss8'))
} }
if (opts.swc) { if (opts.swc) {
await installModule(nuxt, require.resolve('nuxt-swc')) await installModule(nuxt, _require.resolve('nuxt-swc'))
} }
if (opts.resolve) { if (opts.resolve) {
setupBetterResolve() setupBetterResolve()

View File

@ -1,8 +1,8 @@
import { promises as fsp } from 'fs'
import fetch from 'node-fetch' import fetch from 'node-fetch'
import { addPluginTemplate, useNuxt } from '@nuxt/kit' import { addPluginTemplate, useNuxt } from '@nuxt/kit'
import { stringifyQuery } from 'ufo' import { stringifyQuery } from 'ufo'
import { resolve } from 'pathe' import { resolve } from 'pathe'
import { readFile, writeFile } from 'fs-extra'
import { build, generate, prepare, getNitroContext, NitroContext, createDevServer, wpfs, resolveMiddleware } from '@nuxt/nitro' import { build, generate, prepare, getNitroContext, NitroContext, createDevServer, wpfs, resolveMiddleware } from '@nuxt/nitro'
import { AsyncLoadingPlugin } from './async-loading' import { AsyncLoadingPlugin } from './async-loading'
import { distDir } from './dirs' import { distDir } from './dirs'
@ -68,7 +68,9 @@ export function setupNitroBridge () {
const serverConfig = webpackConfigs.find(config => config.name === 'server') const serverConfig = webpackConfigs.find(config => config.name === 'server')
if (serverConfig) { if (serverConfig) {
serverConfig.plugins = serverConfig.plugins || [] serverConfig.plugins = serverConfig.plugins || []
serverConfig.plugins.push(new AsyncLoadingPlugin()) serverConfig.plugins.push(new AsyncLoadingPlugin({
modulesDir: nuxt.options.modulesDir
}))
} }
}) })
@ -98,11 +100,11 @@ export function setupNitroBridge () {
nuxt.hook('build:compiled', async ({ name }) => { nuxt.hook('build:compiled', async ({ name }) => {
if (name === 'server') { if (name === 'server') {
const jsServerEntry = resolve(nuxt.options.buildDir, 'dist/server/server.js') const jsServerEntry = resolve(nuxt.options.buildDir, 'dist/server/server.js')
await writeFile(jsServerEntry.replace(/.js$/, '.cjs'), 'module.exports = require("./server.js")', 'utf8') await fsp.writeFile(jsServerEntry.replace(/.js$/, '.cjs'), 'module.exports = require("./server.js")', 'utf8')
await writeFile(jsServerEntry.replace(/.js$/, '.mjs'), 'export { default } from "./server.cjs"', 'utf8') await fsp.writeFile(jsServerEntry.replace(/.js$/, '.mjs'), 'export { default } from "./server.cjs"', 'utf8')
} else if (name === 'client') { } else if (name === 'client') {
const manifest = await readFile(resolve(nuxt.options.buildDir, 'dist/server/client.manifest.json'), 'utf8') const manifest = await fsp.readFile(resolve(nuxt.options.buildDir, 'dist/server/client.manifest.json'), 'utf8')
await writeFile(resolve(nuxt.options.buildDir, 'dist/server/client.manifest.mjs'), 'export default ' + manifest, 'utf8') await fsp.writeFile(resolve(nuxt.options.buildDir, 'dist/server/client.manifest.mjs'), 'export default ' + manifest, 'utf8')
} }
}) })

View File

@ -1,16 +1,15 @@
import fs from 'fs' import fs from 'fs'
import { promisify } from 'util' import { promisify } from 'util'
import defu from 'defu' import defu from 'defu'
import enhancedResolve from 'enhanced-resolve'
import { CachedInputFileSystem, ResolveContext, ResolverFactory } from 'enhanced-resolve'
import { ResolveOptions } from 'webpack/types' import { ResolveOptions } from 'webpack/types'
import { extendWebpackConfig, useNuxt } from '@nuxt/kit' import { extendWebpackConfig, useNuxt } from '@nuxt/kit'
type UserResolveOptions = Parameters<typeof ResolverFactory['createResolver']>[0] type UserResolveOptions = Parameters<typeof enhancedResolve.ResolverFactory['createResolver']>[0]
type ResolverOptions = Omit<UserResolveOptions, 'fileSystem'> & { fileSystem?: CachedInputFileSystem } type ResolverOptions = Omit<UserResolveOptions, 'fileSystem'> & { fileSystem?: enhancedResolve.CachedInputFileSystem }
const DEFAULTS: UserResolveOptions = { const DEFAULTS: UserResolveOptions = {
fileSystem: new CachedInputFileSystem(fs, 4000), fileSystem: new enhancedResolve.CachedInputFileSystem(fs, 4000),
extensions: ['.ts', '.mjs', '.cjs', '.js', '.json'], extensions: ['.ts', '.mjs', '.cjs', '.js', '.json'],
mainFields: ['module', 'main'] mainFields: ['module', 'main']
} }
@ -18,11 +17,11 @@ const DEFAULTS: UserResolveOptions = {
// Abstracted resolver factory which can be used in rollup, webpack, etc. // Abstracted resolver factory which can be used in rollup, webpack, etc.
const createResolver = (resolveOptions: ResolverOptions) => { const createResolver = (resolveOptions: ResolverOptions) => {
const options = defu(resolveOptions, DEFAULTS) as UserResolveOptions const options = defu(resolveOptions, DEFAULTS) as UserResolveOptions
const resolver = ResolverFactory.createResolver(options) const resolver = enhancedResolve.ResolverFactory.createResolver(options)
const root = options.roots?.[0] || '.' const root = options.roots?.[0] || '.'
const promisifiedResolve = promisify(resolver.resolve.bind(resolver)) as (context: object, path: string, request: string, resolveContext: ResolveContext) => Promise<string | false> const promisifiedResolve = promisify(resolver.resolve.bind(resolver)) as (context: object, path: string, request: string, resolveContext: enhancedResolve.ResolveContext) => Promise<string | false>
const resolve = (id: string, importer?: string) => promisifiedResolve({}, importer || root, id, {}) const resolve = (id: string, importer?: string) => promisifiedResolve({}, importer || root, id, {})

View File

@ -2,6 +2,7 @@ import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig({ export default defineBuildConfig({
declaration: true, declaration: true,
emitCJS: false,
entries: [ entries: [
{ {
input: 'src/config/schema/index', input: 'src/config/schema/index',

View File

@ -3,7 +3,8 @@
"version": "0.10.0", "version": "0.10.0",
"repository": "nuxt/framework", "repository": "nuxt/framework",
"license": "MIT", "license": "MIT",
"main": "./dist/index.cjs", "type": "module",
"exports": "./dist/index.mjs",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"files": [ "files": [
"dist", "dist",
@ -13,7 +14,7 @@
"prepack": "unbuild" "prepack": "unbuild"
}, },
"devDependencies": { "devDependencies": {
"@types/lodash": "^4.14.175", "@types/lodash.template": "^4",
"unbuild": "latest" "unbuild": "latest"
}, },
"dependencies": { "dependencies": {
@ -25,7 +26,7 @@
"hash-sum": "^2.0.0", "hash-sum": "^2.0.0",
"hookable": "^5.0.0", "hookable": "^5.0.0",
"jiti": "^1.12.6", "jiti": "^1.12.6",
"lodash": "^4.17.21", "lodash.template": "^4.5.0",
"pathe": "^0.2.0", "pathe": "^0.2.0",
"rc9": "^1.2.0", "rc9": "^1.2.0",
"scule": "^0.2.1", "scule": "^0.2.1",

View File

@ -1,6 +1,6 @@
import { existsSync, promises as fsp } from 'fs' import { existsSync, promises as fsp } from 'fs'
import { resolve } from 'pathe' import { resolve } from 'pathe'
import dotenv from 'dotenv' import { parse as parseDotEnv } from 'dotenv'
import { LoadNuxtConfigOptions } from './load' import { LoadNuxtConfigOptions } from './load'
export interface LoadDotEnvOptions { export interface LoadDotEnvOptions {
@ -62,7 +62,7 @@ export async function loadDotenv (opts: LoadDotEnvOptions) {
const dotenvFile = resolve(opts.rootDir, opts.dotenvFile) const dotenvFile = resolve(opts.rootDir, opts.dotenvFile)
if (existsSync(dotenvFile)) { if (existsSync(dotenvFile)) {
const parsed = dotenv.parse(await fsp.readFile(dotenvFile, 'utf-8')) const parsed = parseDotEnv(await fsp.readFile(dotenvFile, 'utf-8'))
Object.assign(env, parsed) Object.assign(env, parsed)
} }

View File

@ -627,7 +627,7 @@ export default {
* @example * @example
* ```js * ```js
* import fs from 'fs' * import fs from 'fs'
* import path from 'pathe' * import path from 'path'
* export default { * export default {
* hooks: { * hooks: {
* build: { * build: {

View File

@ -1,4 +1,4 @@
import path from 'pathe' import { parse, relative } from 'pathe'
import consola from 'consola' import consola from 'consola'
import type { Nuxt, NuxtPluginTemplate, NuxtTemplate } from '../types/nuxt' import type { Nuxt, NuxtPluginTemplate, NuxtTemplate } from '../types/nuxt'
import { chainFn } from '../utils/task' import { chainFn } from '../utils/task'
@ -66,7 +66,7 @@ export function createModuleContainer (nuxt: Nuxt) {
/** Register a custom layout. If its name is 'error' it will override the default error layout. */ /** Register a custom layout. If its name is 'error' it will override the default error layout. */
addLayout (tmpl: NuxtTemplate, name: string) { addLayout (tmpl: NuxtTemplate, name: string) {
const { filename, src } = addTemplate(tmpl) const { filename, src } = addTemplate(tmpl)
const layoutName = name || path.parse(src).name const layoutName = name || parse(src).name
const layout = nuxt.options.layouts[layoutName] const layout = nuxt.options.layouts[layoutName]
if (layout) { if (layout) {
@ -88,7 +88,7 @@ export function createModuleContainer (nuxt: Nuxt) {
* @param dst - Path to layout file within the buildDir (`.nuxt/<dst>.vue`) * @param dst - Path to layout file within the buildDir (`.nuxt/<dst>.vue`)
*/ */
addErrorLayout (dst: string) { addErrorLayout (dst: string) {
const relativeBuildDir = path.relative(nuxt.options.rootDir, nuxt.options.buildDir) const relativeBuildDir = relative(nuxt.options.rootDir, nuxt.options.buildDir)
nuxt.options.ErrorPage = `~/${relativeBuildDir}/${dst}` nuxt.options.ErrorPage = `~/${relativeBuildDir}/${dst}`
}, },

View File

@ -1,6 +1,6 @@
import { existsSync, promises as fsp } from 'fs' import { existsSync, promises as fsp } from 'fs'
import { basename, extname, parse, resolve } from 'pathe' import { basename, extname, parse, resolve } from 'pathe'
import lodashTemplate from 'lodash/template' import lodashTemplate from 'lodash.template'
import hash from 'hash-sum' import hash from 'hash-sum'
import type { WebpackPluginInstance, Configuration as WebpackConfig } from 'webpack' import type { WebpackPluginInstance, Configuration as WebpackConfig } from 'webpack'
import type { Plugin as VitePlugin, UserConfig as ViteConfig } from 'vite' import type { Plugin as VitePlugin, UserConfig as ViteConfig } from 'vite'

View File

@ -1,5 +1,5 @@
import { getContext } from 'unctx' import { getContext } from 'unctx'
import { requireModule, tryRequireModule, tryResolveModule } from './utils/cjs' import { importModule, tryImportModule, tryResolveModule } from './utils/cjs'
import type { Nuxt } from './types/nuxt' import type { Nuxt } from './types/nuxt'
import type { NuxtConfig } from './types/config' import type { NuxtConfig } from './types/config'
import type { LoadNuxtConfigOptions } from './config/load' import type { LoadNuxtConfigOptions } from './config/load'
@ -50,14 +50,14 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
// Nuxt 3 // Nuxt 3
if (opts.version !== 2) { if (opts.version !== 2) {
const { loadNuxt } = requireModule('nuxt3', resolveOpts) const { loadNuxt } = await importModule('nuxt3', resolveOpts)
const nuxt = await loadNuxt(opts) const nuxt = await loadNuxt(opts)
return nuxt return nuxt
} }
// Nuxt 2 // Nuxt 2
// @ts-ignore // @ts-ignore
const { loadNuxt } = tryRequireModule('nuxt-edge', resolveOpts) || requireModule('nuxt', resolveOpts) const { loadNuxt } = await tryImportModule('nuxt-edge', resolveOpts) || await importModule('nuxt', resolveOpts)
const nuxt = await loadNuxt({ const nuxt = await loadNuxt({
rootDir: opts.rootDir, rootDir: opts.rootDir,
for: opts.dev ? 'dev' : 'build', for: opts.dev ? 'dev' : 'build',
@ -68,17 +68,17 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
return nuxt as Nuxt return nuxt as Nuxt
} }
export function buildNuxt (nuxt: Nuxt): Promise<any> { export async function buildNuxt (nuxt: Nuxt): Promise<any> {
const resolveOpts = { paths: nuxt.options.rootDir } const resolveOpts = { paths: nuxt.options.rootDir }
// Nuxt 3 // Nuxt 3
if (nuxt.options._majorVersion === 3) { if (nuxt.options._majorVersion === 3) {
const { build } = requireModule('nuxt3', resolveOpts) const { build } = await importModule('nuxt3', resolveOpts)
return build(nuxt) return build(nuxt)
} }
// Nuxt 2 // Nuxt 2
// @ts-ignore // @ts-ignore
const { build } = tryRequireModule('nuxt-edge', resolveOpts) || requireModule('nuxt', resolveOpts) const { build } = tryImportModule('nuxt-edge', resolveOpts) || tryImportModule('nuxt', resolveOpts)
return build(nuxt) return build(nuxt)
} }

View File

@ -1,8 +1,9 @@
import { pathToFileURL } from 'url'
import { join, normalize } from 'pathe' import { join, normalize } from 'pathe'
import jiti from 'jiti' import jiti from 'jiti'
// TODO: use create-require for jest environment // TODO: use create-require for jest environment
const _require = jiti(process.cwd()) const _require = jiti(process.cwd(), { interopDefault: true })
export interface ResolveModuleOptions { export interface ResolveModuleOptions {
paths?: string | string[] paths?: string | string[]
@ -125,6 +126,15 @@ export function requireModule (id: string, opts: RequireModuleOptions = {}) {
return requiredModule return requiredModule
} }
export function importModule (id: string, opts: RequireModuleOptions = {}) {
const resolvedPath = resolveModule(id, opts)
return import(pathToFileURL(resolvedPath).href)
}
export function tryImportModule (id: string, opts: RequireModuleOptions = {}) {
return importModule(id, opts).catch(() => undefined)
}
/** Try to require a module, but don't emit an error if the module can't be required. */ /** Try to require a module, but don't emit an error if the module can't be required. */
export function tryRequireModule (id: string, opts: RequireModuleOptions = {}) { export function tryRequireModule (id: string, opts: RequireModuleOptions = {}) {
try { try {

View File

@ -2,6 +2,7 @@ import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig({ export default defineBuildConfig({
declaration: true, declaration: true,
emitCJS: false,
entries: [ entries: [
'src/index', 'src/index',
{ input: 'src/runtime/', outDir: 'dist/runtime', format: 'esm' }, { input: 'src/runtime/', outDir: 'dist/runtime', format: 'esm' },

View File

@ -1,3 +0,0 @@
export default function () {
throw new Error('Nitro compat for nuxt2 moved to nuxt bridge. Please check documentation for more details.')
}

View File

@ -2,12 +2,12 @@
"name": "@nuxt/nitro", "name": "@nuxt/nitro",
"version": "0.10.0", "version": "0.10.0",
"license": "MIT", "license": "MIT",
"main": "./dist/index.cjs", "type": "module",
"exports": "./dist/index.mjs",
"types": "./types/index.d.ts", "types": "./types/index.d.ts",
"files": [ "files": [
"dist", "dist",
"types", "types"
"compat.js"
], ],
"scripts": { "scripts": {
"prepack": "unbuild" "prepack": "unbuild"
@ -50,6 +50,7 @@
"jiti": "^1.12.6", "jiti": "^1.12.6",
"listhen": "^0.2.4", "listhen": "^0.2.4",
"mime": "^2.5.2", "mime": "^2.5.2",
"mlly": "^0.2.2",
"node-fetch": "^3.0.0", "node-fetch": "^3.0.0",
"ohmyfetch": "^0.3.1", "ohmyfetch": "^0.3.1",
"ora": "^6.0.1", "ora": "^6.0.1",
@ -65,7 +66,6 @@
"ufo": "^0.7.9", "ufo": "^0.7.9",
"unenv": "^0.3.10", "unenv": "^0.3.10",
"unstorage": "^0.2.8", "unstorage": "^0.2.8",
"upath": "^2.0.1",
"vue": "3.2.19", "vue": "3.2.19",
"vue-bundle-renderer": "^0.3.1", "vue-bundle-renderer": "^0.3.1",
"vue-server-renderer": "^2.6.14" "vue-server-renderer": "^2.6.14"

View File

@ -1,7 +1,7 @@
import { resolve, join } from 'pathe' import { resolve, join } from 'pathe'
import consola from 'consola' import consola from 'consola'
import { rollup, watch as rollupWatch } from 'rollup' import { rollup, watch as rollupWatch } from 'rollup'
import { readFile, emptyDir, copy } from 'fs-extra' import fse from 'fs-extra'
import { printFSTree } from './utils/tree' import { printFSTree } from './utils/tree'
import { getRollupConfig } from './rollup/config' import { getRollupConfig } from './rollup/config'
import { hl, prettyPath, serializeTemplate, writeFile, isDirectory } from './utils' import { hl, prettyPath, serializeTemplate, writeFile, isDirectory } from './utils'
@ -24,7 +24,7 @@ export async function prepare (nitroContext: NitroContext) {
async function cleanupDir (dir: string) { async function cleanupDir (dir: string) {
consola.info('Cleaning up', prettyPath(dir)) consola.info('Cleaning up', prettyPath(dir))
await emptyDir(dir) await fse.emptyDir(dir)
} }
export async function generate (nitroContext: NitroContext) { export async function generate (nitroContext: NitroContext) {
@ -32,12 +32,12 @@ export async function generate (nitroContext: NitroContext) {
const clientDist = resolve(nitroContext._nuxt.buildDir, 'dist/client') const clientDist = resolve(nitroContext._nuxt.buildDir, 'dist/client')
if (await isDirectory(clientDist)) { if (await isDirectory(clientDist)) {
await copy(clientDist, join(nitroContext.output.publicDir, nitroContext._nuxt.publicPath)) await fse.copy(clientDist, join(nitroContext.output.publicDir, nitroContext._nuxt.publicPath))
} }
const publicDir = nitroContext._nuxt.publicDir const publicDir = nitroContext._nuxt.publicDir
if (await isDirectory(publicDir)) { if (await isDirectory(publicDir)) {
await copy(publicDir, nitroContext.output.publicDir) await fse.copy(publicDir, nitroContext.output.publicDir)
} }
consola.success('Generated public ' + prettyPath(nitroContext.output.publicDir)) consola.success('Generated public ' + prettyPath(nitroContext.output.publicDir))
@ -48,7 +48,7 @@ export async function build (nitroContext: NitroContext) {
const htmlSrc = resolve(nitroContext._nuxt.buildDir, `views/${{ 2: 'app', 3: 'document' }[2]}.template.html`) const htmlSrc = resolve(nitroContext._nuxt.buildDir, `views/${{ 2: 'app', 3: 'document' }[2]}.template.html`)
const htmlTemplate = { src: htmlSrc, contents: '', dst: '', compiled: '' } const htmlTemplate = { src: htmlSrc, contents: '', dst: '', compiled: '' }
htmlTemplate.dst = htmlTemplate.src.replace(/.html$/, '.mjs').replace('app.', 'document.') htmlTemplate.dst = htmlTemplate.src.replace(/.html$/, '.mjs').replace('app.', 'document.')
htmlTemplate.contents = nitroContext.vfs[htmlTemplate.src] || await readFile(htmlTemplate.src, 'utf-8') htmlTemplate.contents = nitroContext.vfs[htmlTemplate.src] || await fse.readFile(htmlTemplate.src, 'utf-8')
await nitroContext._internal.hooks.callHook('nitro:document', htmlTemplate) await nitroContext._internal.hooks.callHook('nitro:document', htmlTemplate)
htmlTemplate.compiled = 'export default ' + serializeTemplate(htmlTemplate.contents) htmlTemplate.compiled = 'export default ' + serializeTemplate(htmlTemplate.contents)
await writeFile(htmlTemplate.dst, htmlTemplate.compiled) await writeFile(htmlTemplate.dst, htmlTemplate.compiled)

View File

@ -1,6 +1,5 @@
/* eslint-disable no-use-before-define */ /* eslint-disable no-use-before-define */
import { resolve } from 'pathe'
import { resolve, dirname } from 'pathe'
import defu from 'defu' import defu from 'defu'
import { createHooks, Hookable, NestedHooks } from 'hookable' import { createHooks, Hookable, NestedHooks } from 'hookable'
import type { Preset } from 'unenv' import type { Preset } from 'unenv'
@ -13,6 +12,7 @@ import type { AssetOptions } from './rollup/plugins/assets'
import type { ServerMiddleware } from './server/middleware' import type { ServerMiddleware } from './server/middleware'
import type { RollupConfig } from './rollup/config' import type { RollupConfig } from './rollup/config'
import type { Options as EsbuildOptions } from './rollup/plugins/esbuild' import type { Options as EsbuildOptions } from './rollup/plugins/esbuild'
import { runtimeDir } from './dirs'
export interface NitroHooks { export interface NitroHooks {
'nitro:document': (htmlTemplate: { src: string, contents: string, dst: string, compiled: string }) => void 'nitro:document': (htmlTemplate: { src: string, contents: string, dst: string, compiled: string }) => void
@ -136,7 +136,7 @@ export function getNitroContext (nuxtOptions: NuxtOptions, input: NitroInput): N
} }
}, },
_internal: { _internal: {
runtimeDir: resolve(dirname(require.resolve('@nuxt/nitro')), 'runtime'), runtimeDir,
hooks: createHooks<NitroHooks>() hooks: createHooks<NitroHooks>()
} }
} }

View File

@ -0,0 +1,6 @@
import { fileURLToPath } from 'url'
import { dirname, resolve } from 'pathe'
export const distDir = dirname(fileURLToPath(import.meta.url))
export const pkgDir = resolve(distDir, '..')
export const runtimeDir = resolve(distDir, 'runtime')

View File

@ -1,6 +1,6 @@
import { createWriteStream } from 'fs'
import archiver from 'archiver' import archiver from 'archiver'
import consola from 'consola' import consola from 'consola'
import { createWriteStream } from 'fs-extra'
import { join, resolve } from 'pathe' import { join, resolve } from 'pathe'
import { prettyPath, writeFile } from '../utils' import { prettyPath, writeFile } from '../utils'
import { NitroPreset, NitroContext } from '../context' import { NitroPreset, NitroContext } from '../context'

View File

@ -1,4 +1,4 @@
import { existsSync, writeFile } from 'fs-extra' import { existsSync, promises as fsp } from 'fs'
import { resolve } from 'pathe' import { resolve } from 'pathe'
import consola from 'consola' import consola from 'consola'
import { extendPreset, prettyPath } from '../utils' import { extendPreset, prettyPath } from '../utils'
@ -62,17 +62,17 @@ if ('serviceWorker' in navigator) {
tmpl.compiled = tmpl.compiled.replace('</body>', script + '</body>') tmpl.compiled = tmpl.compiled.replace('</body>', script + '</body>')
}, },
async 'nitro:compiled' ({ output }: NitroContext) { async 'nitro:compiled' ({ output }: NitroContext) {
await writeFile(resolve(output.publicDir, 'sw.js'), `self.importScripts('${input._nuxt.routerBase}_server/index.mjs');`) await fsp.writeFile(resolve(output.publicDir, 'sw.js'), `self.importScripts('${input._nuxt.routerBase}_server/index.mjs');`, 'utf8')
// Temp fix // Temp fix
if (!existsSync(resolve(output.publicDir, 'index.html'))) { if (!existsSync(resolve(output.publicDir, 'index.html'))) {
await writeFile(resolve(output.publicDir, 'index.html'), html) await fsp.writeFile(resolve(output.publicDir, 'index.html'), html, 'utf8')
} }
if (!existsSync(resolve(output.publicDir, '200.html'))) { if (!existsSync(resolve(output.publicDir, '200.html'))) {
await writeFile(resolve(output.publicDir, '200.html'), html) await fsp.writeFile(resolve(output.publicDir, '200.html'), html, 'utf8')
} }
if (!existsSync(resolve(output.publicDir, '404.html'))) { if (!existsSync(resolve(output.publicDir, '404.html'))) {
await writeFile(resolve(output.publicDir, '404.html'), html) await fsp.writeFile(resolve(output.publicDir, '404.html'), html, 'utf8')
} }
consola.info('Ready to deploy to static hosting:', prettyPath(output.publicDir as string)) consola.info('Ready to deploy to static hosting:', prettyPath(output.publicDir as string))
} }

View File

@ -1,5 +1,6 @@
import { createRequire } from 'module'
import { join, relative, resolve } from 'pathe' import { join, relative, resolve } from 'pathe'
import { existsSync, readJSONSync } from 'fs-extra' import fse from 'fs-extra'
import consola from 'consola' import consola from 'consola'
import globby from 'globby' import globby from 'globby'
@ -16,7 +17,7 @@ export const firebase: NitroPreset = {
} }
async function writeRoutes ({ output: { publicDir, serverDir }, _nuxt: { rootDir } }: NitroContext) { async function writeRoutes ({ output: { publicDir, serverDir }, _nuxt: { rootDir } }: NitroContext) {
if (!existsSync(join(rootDir, 'firebase.json'))) { if (!fse.existsSync(join(rootDir, 'firebase.json'))) {
const firebase = { const firebase = {
functions: { functions: {
source: relative(rootDir, serverDir) source: relative(rootDir, serverDir)
@ -38,20 +39,22 @@ async function writeRoutes ({ output: { publicDir, serverDir }, _nuxt: { rootDir
await writeFile(resolve(rootDir, 'firebase.json'), JSON.stringify(firebase)) await writeFile(resolve(rootDir, 'firebase.json'), JSON.stringify(firebase))
} }
const _require = createRequire(import.meta.url)
const jsons = await globby(`${serverDir}/node_modules/**/package.json`) const jsons = await globby(`${serverDir}/node_modules/**/package.json`)
const prefixLength = `${serverDir}/node_modules/`.length const prefixLength = `${serverDir}/node_modules/`.length
const suffixLength = '/package.json'.length const suffixLength = '/package.json'.length
const dependencies = jsons.reduce((obj, packageJson) => { const dependencies = jsons.reduce((obj, packageJson) => {
const dirname = packageJson.slice(prefixLength, -suffixLength) const dirname = packageJson.slice(prefixLength, -suffixLength)
if (!dirname.includes('node_modules')) { if (!dirname.includes('node_modules')) {
obj[dirname] = require(packageJson).version obj[dirname] = _require(packageJson).version
} }
return obj return obj
}, {} as Record<string, string>) }, {} as Record<string, string>)
let nodeVersion = '12' let nodeVersion = '12'
try { try {
const currentNodeVersion = readJSONSync(join(rootDir, 'package.json')).engines.node const currentNodeVersion = fse.readJSONSync(join(rootDir, 'package.json')).engines.node
if (['12', '10'].includes(currentNodeVersion)) { if (['12', '10'].includes(currentNodeVersion)) {
nodeVersion = currentNodeVersion nodeVersion = currentNodeVersion
} }
@ -66,8 +69,8 @@ async function writeRoutes ({ output: { publicDir, serverDir }, _nuxt: { rootDir
dependencies, dependencies,
devDependencies: { devDependencies: {
'firebase-functions-test': 'latest', 'firebase-functions-test': 'latest',
'firebase-admin': require('firebase-admin/package.json').version, 'firebase-admin': _require('firebase-admin/package.json').version,
'firebase-functions': require('firebase-functions/package.json') 'firebase-functions': _require('firebase-functions/package.json')
.version .version
}, },
engines: { node: nodeVersion } engines: { node: nodeVersion }

View File

@ -1,5 +1,5 @@
import { existsSync, promises as fsp } from 'fs'
import { join } from 'pathe' import { join } from 'pathe'
import { existsSync, readFile, writeFile } from 'fs-extra'
import consola from 'consola' import consola from 'consola'
import { extendPreset } from '../utils' import { extendPreset } from '../utils'
import { NitroContext, NitroPreset } from '../context' import { NitroContext, NitroPreset } from '../context'
@ -15,7 +15,7 @@ export const netlify: NitroPreset = extendPreset(lambda, {
const redirectsPath = join(ctx.output.publicDir, '_redirects') const redirectsPath = join(ctx.output.publicDir, '_redirects')
let contents = '/* /.netlify/functions/server 200' let contents = '/* /.netlify/functions/server 200'
if (existsSync(redirectsPath)) { if (existsSync(redirectsPath)) {
const currentRedirects = await readFile(redirectsPath, 'utf-8') const currentRedirects = await fsp.readFile(redirectsPath, 'utf-8')
if (currentRedirects.match(/^\/\* /m)) { if (currentRedirects.match(/^\/\* /m)) {
consola.info('Not adding Nitro fallback to `_redirects` (as an existing fallback was found).') consola.info('Not adding Nitro fallback to `_redirects` (as an existing fallback was found).')
return return
@ -23,7 +23,7 @@ export const netlify: NitroPreset = extendPreset(lambda, {
consola.info('Adding Nitro fallback to `_redirects` to handle all unmatched routes.') consola.info('Adding Nitro fallback to `_redirects` to handle all unmatched routes.')
contents = currentRedirects + '\n' + contents contents = currentRedirects + '\n' + contents
} }
await writeFile(redirectsPath, contents) await fsp.writeFile(redirectsPath, contents)
}, },
'nitro:rollup:before' (ctx: NitroContext) { 'nitro:rollup:before' (ctx: NitroContext) {
ctx.rollupConfig.output.entryFileNames = 'server.ts' ctx.rollupConfig.output.entryFileNames = 'server.ts'

View File

@ -1,5 +1,6 @@
import { pathToFileURL } from 'url' import { pathToFileURL } from 'url'
import { dirname, join, normalize, relative, resolve } from 'pathe' import { createRequire } from 'module'
import { dirname, join, relative, resolve } from 'pathe'
import type { InputOptions, OutputOptions } from 'rollup' import type { InputOptions, OutputOptions } from 'rollup'
import defu from 'defu' import defu from 'defu'
import { terser } from 'rollup-plugin-terser' import { terser } from 'rollup-plugin-terser'
@ -15,7 +16,8 @@ import * as unenv from 'unenv'
import type { Preset } from 'unenv' import type { Preset } from 'unenv'
import { NitroContext } from '../context' import { NitroContext } from '../context'
import { resolvePath, MODULE_DIR } from '../utils' import { resolvePath } from '../utils'
import { pkgDir } from '../dirs'
import { dynamicRequire } from './plugins/dynamic-require' import { dynamicRequire } from './plugins/dynamic-require'
import { externals } from './plugins/externals' import { externals } from './plugins/externals'
@ -63,10 +65,11 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
} }
// TODO: #590 // TODO: #590
const _require = createRequire(import.meta.url)
if (nitroContext._nuxt.majorVersion === 3) { if (nitroContext._nuxt.majorVersion === 3) {
env.alias['vue/server-renderer'] = 'vue/server-renderer' env.alias['vue/server-renderer'] = 'vue/server-renderer'
env.alias['vue/compiler-sfc'] = 'vue/compiler-sfc' env.alias['vue/compiler-sfc'] = 'vue/compiler-sfc'
env.alias.vue = require.resolve(`vue/dist/vue.cjs${nitroContext._nuxt.dev ? '' : '.prod'}.js`) env.alias.vue = _require.resolve(`vue/dist/vue.cjs${nitroContext._nuxt.dev ? '' : '.prod'}.js`)
} }
const buildServerDir = join(nitroContext._nuxt.buildDir, 'dist/server') const buildServerDir = join(nitroContext._nuxt.buildDir, 'dist/server')
@ -216,8 +219,8 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
rollupConfig.plugins.push(alias({ rollupConfig.plugins.push(alias({
entries: { entries: {
'#nitro': nitroContext._internal.runtimeDir, '#nitro': nitroContext._internal.runtimeDir,
'#nitro-renderer': normalize(require.resolve(resolve(nitroContext._internal.runtimeDir, 'app', renderer))), '#nitro-renderer': resolve(nitroContext._internal.runtimeDir, 'app', renderer),
'#config': normalize(require.resolve(resolve(nitroContext._internal.runtimeDir, 'app/config'))), '#config': resolve(nitroContext._internal.runtimeDir, 'app/config'),
'#nitro-vue-renderer': vue2ServerRenderer, '#nitro-vue-renderer': vue2ServerRenderer,
// Only file and data URLs are supported by the default ESM loader on Windows (#427) // Only file and data URLs are supported by the default ESM loader on Windows (#427)
'#build': nitroContext._nuxt.dev && process.platform === 'win32' '#build': nitroContext._nuxt.dev && process.platform === 'win32'
@ -234,7 +237,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
const moduleDirectories = [ const moduleDirectories = [
resolve(nitroContext._nuxt.rootDir, 'node_modules'), resolve(nitroContext._nuxt.rootDir, 'node_modules'),
...nitroContext._nuxt.modulesDir, ...nitroContext._nuxt.modulesDir,
resolve(MODULE_DIR, '../node_modules'), resolve(pkgDir, '../node_modules'),
'node_modules' 'node_modules'
] ]

View File

@ -1,10 +1,11 @@
import { pathToFileURL } from 'url'
import { resolve } from 'pathe' import { resolve } from 'pathe'
import globby from 'globby' import globby from 'globby'
import type { Plugin } from 'rollup' import type { Plugin } from 'rollup'
import { serializeImportName } from '../../utils' import { serializeImportName } from '../../utils'
const PLUGIN_NAME = 'dynamic-require' const PLUGIN_NAME = 'dynamic-require'
const HELPER_DYNAMIC = `\0${PLUGIN_NAME}.js` const HELPER_DYNAMIC = `\0${PLUGIN_NAME}.mjs`
const DYNAMIC_REQUIRE_RE = /import\("\.\/" ?\+(.*)\).then/g const DYNAMIC_REQUIRE_RE = /import\("\.\/" ?\+(.*)\).then/g
interface Options { interface Options {
@ -57,24 +58,25 @@ export function dynamicRequire ({ dir, ignore, inline }: Options): Plugin {
let files = [] let files = []
try { try {
const wpManifest = resolve(dir, './server.manifest.json') const wpManifest = resolve(dir, './server.manifest.json')
files = await import(wpManifest).then(r => Object.keys(r.files).filter(file => !ignore.includes(file))) files = await import(pathToFileURL(wpManifest).href).then(r => Object.keys(r.files).filter(file => !ignore.includes(file)))
} catch { } catch {
files = await globby('**/*.{cjs,mjs,js}', { cwd: dir, absolute: false, ignore }) files = await globby('**/*.{cjs,mjs,js}', { cwd: dir, absolute: false, ignore })
} }
const chunks = files.map(id => ({
const chunks = (await Promise.all(files.map(async id => ({
id, id,
src: resolve(dir, id).replace(/\\/g, '/'), src: resolve(dir, id).replace(/\\/g, '/'),
name: serializeImportName(id), name: serializeImportName(id),
meta: getWebpackChunkMeta(resolve(dir, id)) meta: await getWebpackChunkMeta(resolve(dir, id))
})).filter(chunk => chunk.meta) })))).filter(chunk => chunk.meta)
return inline ? TMPL_INLINE({ chunks }) : TMPL_LAZY({ chunks }) return inline ? TMPL_INLINE({ chunks }) : TMPL_LAZY({ chunks })
} }
} }
} }
function getWebpackChunkMeta (src: string) { async function getWebpackChunkMeta (src: string) {
const chunk = require(src) || {} const chunk = await import(pathToFileURL(src).href).then(r => r.default || r || {})
const { id, ids, modules } = chunk const { id, ids, modules } = chunk
if (!id && !ids) { if (!id && !ids) {
return null // Not a webpack chunk return null // Not a webpack chunk

View File

@ -1,5 +1,5 @@
import { resolve, dirname } from 'pathe' import { resolve, dirname } from 'pathe'
import { copyFile, mkdirp } from 'fs-extra' import fse from 'fs-extra'
import { nodeFileTrace, NodeFileTraceOptions } from '@vercel/nft' import { nodeFileTrace, NodeFileTraceOptions } from '@vercel/nft'
import type { Plugin } from 'rollup' import type { Plugin } from 'rollup'
@ -84,8 +84,8 @@ export function externals (opts: NodeExternalsOptions): Plugin {
const writeFile = async (file) => { const writeFile = async (file) => {
const src = resolve(opts.traceOptions.base, file) const src = resolve(opts.traceOptions.base, file)
const dst = resolve(opts.outDir, 'node_modules', file.split('node_modules/').pop()) const dst = resolve(opts.outDir, 'node_modules', file.split('node_modules/').pop())
await mkdirp(dirname(dst)) await fse.mkdirp(dirname(dst))
await copyFile(src, dst) await fse.copyFile(src, dst)
} }
if (process.platform === 'win32') { if (process.platform === 'win32') {
// Workaround for EBUSY on windows (#424) // Workaround for EBUSY on windows (#424)

View File

@ -1,5 +1,5 @@
import { readFileSync, statSync } from 'fs'
import createEtag from 'etag' import createEtag from 'etag'
import { readFileSync, statSync } from 'fs-extra'
import mime from 'mime' import mime from 'mime'
import { relative, resolve } from 'pathe' import { relative, resolve } from 'pathe'
import virtual from '@rollup/plugin-virtual' import virtual from '@rollup/plugin-virtual'

View File

@ -1,4 +1,4 @@
import * as path from 'pathe' import { resolve, dirname } from 'pathe'
import type { Plugin } from 'rollup' import type { Plugin } from 'rollup'
// Based on https://github.com/rollup/plugins/blob/master/packages/virtual/src/index.ts // Based on https://github.com/rollup/plugins/blob/master/packages/virtual/src/index.ts
@ -16,7 +16,7 @@ export default function virtual (modules: RollupVirtualOptions): Plugin {
for (const [id, mod] of Object.entries(modules)) { for (const [id, mod] of Object.entries(modules)) {
_modules.set(id, mod) _modules.set(id, mod)
_modules.set(path.resolve(id), mod) _modules.set(resolve(id), mod)
} }
return { return {
@ -29,7 +29,7 @@ export default function virtual (modules: RollupVirtualOptions): Plugin {
const importerNoPrefix = importer.startsWith(PREFIX) const importerNoPrefix = importer.startsWith(PREFIX)
? importer.slice(PREFIX.length) ? importer.slice(PREFIX.length)
: importer : importer
const resolved = path.resolve(path.dirname(importerNoPrefix), id) const resolved = resolve(dirname(importerNoPrefix), id)
if (_modules.has(resolved)) { return PREFIX + resolved } if (_modules.has(resolved)) { return PREFIX + resolved }
} }

View File

@ -1,7 +1,7 @@
import '#polyfill' import '#polyfill'
// @ts-ignore
import functions from 'firebase-functions'
import { handle } from '../server' import { handle } from '../server'
const functions = require('firebase-functions')
export const server = functions.https.onRequest(handle) export const server = functions.https.onRequest(handle)

View File

@ -1,17 +1,17 @@
import { Worker } from 'worker_threads' import { Worker } from 'worker_threads'
import { IncomingMessage, ServerResponse } from 'http' import { IncomingMessage, ServerResponse } from 'http'
import { promises as fsp } from 'fs'
import { loading as loadingTemplate } from '@nuxt/design' import { loading as loadingTemplate } from '@nuxt/design'
import chokidar, { FSWatcher } from 'chokidar' import chokidar, { FSWatcher } from 'chokidar'
import debounce from 'debounce' import debounce from 'debounce'
import { stat } from 'fs-extra'
import { promisifyHandle, createApp, Middleware, useBase } from 'h3' import { promisifyHandle, createApp, Middleware, useBase } from 'h3'
import { createProxy } from 'http-proxy' import httpProxy from 'http-proxy'
import { listen, Listener, ListenOptions } from 'listhen' import { listen, Listener, ListenOptions } from 'listhen'
import servePlaceholder from 'serve-placeholder' import servePlaceholder from 'serve-placeholder'
import serveStatic from 'serve-static' import serveStatic from 'serve-static'
import { resolve } from 'pathe' import { resolve } from 'pathe'
import type { Server } from 'connect' import connect from 'connect'
import type { NitroContext } from '../context' import type { NitroContext } from '../context'
import { handleVfs } from './vfs' import { handleVfs } from './vfs'
@ -27,7 +27,7 @@ export function createDevServer (nitroContext: NitroContext) {
workerAddress = null workerAddress = null
pendingWorker = null pendingWorker = null
} }
if (!(await stat(workerEntry)).isFile) { if (!(await fsp.stat(workerEntry)).isFile) {
throw new Error('Entry not found: ' + workerEntry) throw new Error('Entry not found: ' + workerEntry)
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -72,7 +72,7 @@ export function createDevServer (nitroContext: NitroContext) {
app.use(nitroContext._nuxt.publicPath, servePlaceholder()) app.use(nitroContext._nuxt.publicPath, servePlaceholder())
// SSR Proxy // SSR Proxy
const proxy = createProxy() const proxy = httpProxy.createProxy()
const proxyHandle = promisifyHandle((req: IncomingMessage, res: ServerResponse) => proxy.web(req, res, { target: workerAddress }, (_err: unknown) => { const proxyHandle = promisifyHandle((req: IncomingMessage, res: ServerResponse) => proxy.web(req, res, { target: workerAddress }, (_err: unknown) => {
// console.error('[proxy]', err) // console.error('[proxy]', err)
})) }))
@ -151,7 +151,7 @@ function createDynamicMiddleware (): DynamicMiddleware {
middleware = input middleware = input
return return
} }
const app: Server = require('connect')() const app = connect()
for (const m of input) { for (const m of input) {
app.use(m.path || m.route || '/', m.handler || m.handle!) app.use(m.path || m.route || '/', m.handler || m.handle!)
} }

View File

@ -1,3 +1,4 @@
import { createRequire } from 'module'
import { relative, dirname, resolve } from 'pathe' import { relative, dirname, resolve } from 'pathe'
import fse from 'fs-extra' import fse from 'fs-extra'
import jiti from 'jiti' import jiti from 'jiti'
@ -8,8 +9,6 @@ import chalk from 'chalk'
import { get } from 'dot-prop' import { get } from 'dot-prop'
import type { NitroPreset, NitroInput } from '../context' import type { NitroPreset, NitroInput } from '../context'
export const MODULE_DIR = resolve(__dirname, '..')
export function hl (str: string) { export function hl (str: string) {
return chalk.cyan(str) return chalk.cyan(str)
} }
@ -35,7 +34,7 @@ export function serializeTemplate (contents: string) {
} }
export function jitiImport (dir: string, path: string) { export function jitiImport (dir: string, path: string) {
return jiti(dir)(path) return jiti(dir, { interopDefault: true })(path)
} }
export function tryImport (dir: string, path: string) { export function tryImport (dir: string, path: string) {
@ -107,9 +106,10 @@ const _getDependenciesMode = {
prod: ['dependencies'], prod: ['dependencies'],
all: ['devDependencies', 'dependencies'] all: ['devDependencies', 'dependencies']
} }
const _require = createRequire(import.meta.url)
export function getDependencies (dir: string, mode: keyof typeof _getDependenciesMode = 'all') { export function getDependencies (dir: string, mode: keyof typeof _getDependenciesMode = 'all') {
const fields = _getDependenciesMode[mode] const fields = _getDependenciesMode[mode]
const pkg = require(resolve(dir, 'package.json')) const pkg = _require(resolve(dir, 'package.json'))
const dependencies = [] const dependencies = []
for (const field of fields) { for (const field of fields) {
if (pkg[field]) { if (pkg[field]) {

View File

@ -1,8 +1,8 @@
import { promises as fsp } from 'fs'
import { resolve, dirname, relative } from 'pathe' import { resolve, dirname, relative } from 'pathe'
import globby from 'globby' import globby from 'globby'
import prettyBytes from 'pretty-bytes' import prettyBytes from 'pretty-bytes'
import gzipSize from 'gzip-size' import gzipSize from 'gzip-size'
import { readFile } from 'fs-extra'
import chalk from 'chalk' import chalk from 'chalk'
import stdenv from 'std-env' import stdenv from 'std-env'
@ -15,7 +15,7 @@ export async function printFSTree (dir: string) {
const items = (await Promise.all(files.map(async (file) => { const items = (await Promise.all(files.map(async (file) => {
const path = resolve(dir, file) const path = resolve(dir, file)
const src = await readFile(path) const src = await fsp.readFile(path)
const size = src.byteLength const size = src.byteLength
const gzip = await gzipSize(src) const gzip = await gzipSize(src)
return { file, path, size, gzip } return { file, path, size, gzip }

View File

@ -1,4 +0,0 @@
#!/usr/bin/env node
process._startTime = Date.now()
require('../dist/index.cjs').main()

3
packages/nuxi/bin/nuxi.mjs Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
process._startTime = Date.now()
import('../dist/index.mjs').then(r => (r.default || r).main())

View File

@ -3,6 +3,8 @@ import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig({ export default defineBuildConfig({
declaration: true, declaration: true,
inlineDependencies: true, inlineDependencies: true,
emitCJS: false,
cjsBridge: true,
entries: [ entries: [
'src/index' 'src/index'
], ],

View File

@ -3,10 +3,14 @@
"version": "0.10.0", "version": "0.10.0",
"repository": "nuxt/framework", "repository": "nuxt/framework",
"license": "MIT", "license": "MIT",
"main": "./dist/index.cjs", "type": "module",
"exports": {
".": "./dist/index.mjs",
"./cli": "./bin/nuxi.mjs"
},
"bin": { "bin": {
"nu": "./bin/nuxi.cjs", "nu": "./bin/nuxi.mjs",
"nuxi": "./bin/nuxi.cjs" "nuxi": "./bin/nuxi.mjs"
}, },
"scripts": { "scripts": {
"prepack": "unbuild" "prepack": "unbuild"
@ -34,6 +38,7 @@
"flat": "^5.0.2", "flat": "^5.0.2",
"jiti": "^1.12.6", "jiti": "^1.12.6",
"listhen": "^0.2.4", "listhen": "^0.2.4",
"mlly": "^0.2.2",
"mri": "^1.2.0", "mri": "^1.2.0",
"pathe": "^0.2.0", "pathe": "^0.2.0",
"scule": "^0.2.1", "scule": "^0.2.1",

View File

@ -1,5 +1,5 @@
import { resolve } from 'pathe' import { resolve } from 'pathe'
import { requireModule } from '../utils/cjs' import { importModule } from '../utils/cjs'
import { error } from '../utils/log' import { error } from '../utils/log'
import { defineNuxtCommand } from './index' import { defineNuxtCommand } from './index'
@ -14,7 +14,7 @@ export default defineNuxtCommand({
process.env.NODE_ENV = process.env.NODE_ENV || 'production' process.env.NODE_ENV = process.env.NODE_ENV || 'production'
const rootDir = resolve(args._[0] || '.') const rootDir = resolve(args._[0] || '.')
const { loadNuxt, buildNuxt } = requireModule('@nuxt/kit', rootDir) as typeof import('@nuxt/kit') const { loadNuxt, buildNuxt } = await importModule('@nuxt/kit', rootDir) as typeof import('@nuxt/kit')
const nuxt = await loadNuxt({ rootDir }) const nuxt = await loadNuxt({ rootDir })

View File

@ -4,7 +4,7 @@ import debounce from 'debounce-promise'
import type { Nuxt } from '@nuxt/kit' import type { Nuxt } from '@nuxt/kit'
import { createServer, createLoadingHandler } from '../utils/server' import { createServer, createLoadingHandler } from '../utils/server'
import { showBanner } from '../utils/banner' import { showBanner } from '../utils/banner'
import { requireModule } from '../utils/cjs' import { importModule } from '../utils/cjs'
import { error } from '../utils/log' import { error } from '../utils/log'
import { defineNuxtCommand } from './index' import { defineNuxtCommand } from './index'
@ -24,7 +24,7 @@ export default defineNuxtCommand({
const rootDir = resolve(args._[0] || '.') const rootDir = resolve(args._[0] || '.')
const { loadNuxt, buildNuxt } = requireModule('@nuxt/kit', rootDir) as typeof import('@nuxt/kit') const { loadNuxt, buildNuxt } = await importModule('@nuxt/kit', rootDir) as typeof import('@nuxt/kit')
let currentNuxt: Nuxt let currentNuxt: Nuxt
const load = async (isRestart: boolean, reason?: string) => { const load = async (isRestart: boolean, reason?: string) => {

View File

@ -1,11 +1,13 @@
import type { Argv } from 'mri' import type { Argv } from 'mri'
const _rDefault = r => r.default || r
export const commands = { export const commands = {
dev: () => import('./dev'), dev: () => import('./dev').then(_rDefault),
build: () => import('./build'), build: () => import('./build').then(_rDefault),
prepare: () => import('./prepare'), prepare: () => import('./prepare').then(_rDefault),
usage: () => import('./usage'), usage: () => import('./usage').then(_rDefault),
info: () => import('./info') info: () => import('./info').then(_rDefault)
} }
export type Command = keyof typeof commands export type Command = keyof typeof commands

View File

@ -1,5 +1,6 @@
import os from 'os' import os from 'os'
import { existsSync, readFileSync } from 'fs' import { existsSync, readFileSync } from 'fs'
import { createRequire } from 'module'
import { resolve, dirname } from 'pathe' import { resolve, dirname } from 'pathe'
import jiti from 'jiti' import jiti from 'jiti'
import destr from 'destr' import destr from 'destr'
@ -129,7 +130,8 @@ function getPkg (name, rootDir) {
let pkgPath = resolve(rootDir, 'node_modules', name, 'package.json') let pkgPath = resolve(rootDir, 'node_modules', name, 'package.json')
// Try to resolve for more accuracy // Try to resolve for more accuracy
try { pkgPath = require.resolve(name + '/package.json', { paths: [rootDir] }) } catch (_err) { const _require = createRequire(rootDir)
try { pkgPath = _require.resolve(name + '/package.json') } catch (_err) {
// console.log('not found:', name) // console.log('not found:', name)
} }

View File

@ -2,7 +2,7 @@ import { promises as fsp } from 'fs'
import { relative, resolve } from 'pathe' import { relative, resolve } from 'pathe'
import { cyan } from 'colorette' import { cyan } from 'colorette'
import type { TSReference } from '@nuxt/kit' import type { TSReference } from '@nuxt/kit'
import { requireModule, getModulePaths, getNearestPackage } from '../utils/cjs' import { importModule, getModulePaths, getNearestPackage } from '../utils/cjs'
import { success } from '../utils/log' import { success } from '../utils/log'
import { defineNuxtCommand } from './index' import { defineNuxtCommand } from './index'
@ -16,7 +16,7 @@ export default defineNuxtCommand({
process.env.NODE_ENV = process.env.NODE_ENV || 'production' process.env.NODE_ENV = process.env.NODE_ENV || 'production'
const rootDir = resolve(args._[0] || '.') const rootDir = resolve(args._[0] || '.')
const { loadNuxt } = requireModule('@nuxt/kit', rootDir) as typeof import('@nuxt/kit') const { loadNuxt } = await importModule('@nuxt/kit', rootDir) as typeof import('@nuxt/kit')
const nuxt = await loadNuxt({ rootDir }) const nuxt = await loadNuxt({ rootDir })
const adHocModules = nuxt.options._majorVersion === 3 const adHocModules = nuxt.options._majorVersion === 3

View File

@ -1,4 +1,3 @@
import 'v8-compile-cache'
import mri from 'mri' import mri from 'mri'
import { red, cyan } from 'colorette' import { red, cyan } from 'colorette'
import { commands, Command, NuxtCommand } from './commands' import { commands, Command, NuxtCommand } from './commands'
@ -30,7 +29,7 @@ async function _main () {
try { try {
// @ts-ignore default.default is hotfix for #621 // @ts-ignore default.default is hotfix for #621
const cmd = await commands[command as Command]().then(c => c.default.default) as NuxtCommand const cmd = await commands[command as Command]() as NuxtCommand
if (args.h || args.help) { if (args.h || args.help) {
showHelp(cmd.meta) showHelp(cmd.meta)
} else { } else {

View File

@ -1,3 +1,5 @@
import { createRequire } from 'module'
import { pathToFileURL } from 'url'
import { normalize, dirname } from 'pathe' import { normalize, dirname } from 'pathe'
export function getModulePaths (paths?: string | string[]): string[] { export function getModulePaths (paths?: string | string[]): string[] {
@ -11,8 +13,10 @@ export function getModulePaths (paths?: string | string[]): string[] {
).filter(Boolean) ).filter(Boolean)
} }
const _require = createRequire(process.cwd())
export function resolveModule (id: string, paths?: string | string[]) { export function resolveModule (id: string, paths?: string | string[]) {
return normalize(require.resolve(id, { paths: getModulePaths(paths) })) return normalize(_require.resolve(id, { paths: getModulePaths(paths) }))
} }
export function tryResolveModule (id: string, paths?: string | string[]) { export function tryResolveModule (id: string, paths?: string | string[]) {
@ -22,7 +26,12 @@ export function tryResolveModule (id: string, paths?: string | string[]) {
} }
export function requireModule (id: string, paths?: string | string[]) { export function requireModule (id: string, paths?: string | string[]) {
return require(resolveModule(id, paths)) return _require(resolveModule(id, paths))
}
export function importModule (id: string, paths?: string | string[]) {
const resolvedPath = resolveModule(id, paths)
return import(pathToFileURL(resolvedPath).href)
} }
export function getNearestPackage (id: string, paths?: string | string[]) { export function getNearestPackage (id: string, paths?: string | string[]) {

View File

@ -1,2 +0,0 @@
#!/usr/bin/env node
require('nuxi/bin/nuxi.cjs')

2
packages/nuxt3/bin/nuxt.mjs Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env node
import 'nuxi/cli'

View File

@ -2,6 +2,7 @@ import { defineBuildConfig, BuildEntry } from 'unbuild'
export default defineBuildConfig({ export default defineBuildConfig({
declaration: true, declaration: true,
emitCJS: false,
entries: [ entries: [
// Core // Core
{ input: 'src/index' }, { input: 'src/index' },

View File

@ -3,10 +3,11 @@
"version": "0.10.0", "version": "0.10.0",
"repository": "nuxt/framework", "repository": "nuxt/framework",
"license": "MIT", "license": "MIT",
"main": "./dist/index.cjs", "type": "module",
"exports": "./dist/index.mjs",
"types": "./types.d.ts", "types": "./types.d.ts",
"bin": { "bin": {
"nuxt": "./bin/nuxt.cjs" "nuxt": "./bin/nuxt.mjs"
}, },
"files": [ "files": [
"bin", "bin",
@ -32,6 +33,7 @@
"hash-sum": "^2.0.0", "hash-sum": "^2.0.0",
"hookable": "^5.0.0", "hookable": "^5.0.0",
"ignore": "^5.1.8", "ignore": "^5.1.8",
"mlly": "^0.2.2",
"nuxi": "^0.10.0", "nuxi": "^0.10.0",
"ohmyfetch": "^0.3.1", "ohmyfetch": "^0.3.1",
"pathe": "^0.2.0", "pathe": "^0.2.0",

View File

@ -1,7 +1,7 @@
import { promises as fsp } from 'fs'
import { resolve } from 'pathe' import { resolve } from 'pathe'
import defu from 'defu' import defu from 'defu'
import { tryResolvePath, resolveFiles, Nuxt, NuxtApp, normalizePlugin, normalizeTemplate, compileTemplate, templateUtils } from '@nuxt/kit' import { tryResolvePath, resolveFiles, Nuxt, NuxtApp, normalizePlugin, normalizeTemplate, compileTemplate, templateUtils } from '@nuxt/kit'
import { writeFile } from 'fs-extra'
import * as defaultTemplates from '../app/templates' import * as defaultTemplates from '../app/templates'
@ -44,7 +44,7 @@ export async function generateApp (nuxt: Nuxt, app: NuxtApp) {
} }
if (template.write) { if (template.write) {
await writeFile(fullPath, contents, 'utf8') await fsp.writeFile(fullPath, contents, 'utf8')
} }
})) }))

View File

@ -1,11 +1,11 @@
import chokidar from 'chokidar' import chokidar from 'chokidar'
import { Nuxt } from '@nuxt/kit' import { Nuxt } from '@nuxt/kit'
import { emptyDir } from 'fs-extra' import fse from 'fs-extra'
import { createApp, generateApp } from './app' import { createApp, generateApp } from './app'
export async function build (nuxt: Nuxt) { export async function build (nuxt: Nuxt) {
// Clear buildDir once // Clear buildDir once
await emptyDir(nuxt.options.buildDir) await fse.emptyDir(nuxt.options.buildDir)
const app = createApp(nuxt) const app = createApp(nuxt)
await generateApp(nuxt, app) await generateApp(nuxt, app)

View File

@ -1,4 +1,4 @@
import { normalize } from 'pathe' import { resolve } from 'pathe'
import { wpfs, getNitroContext, createDevServer, resolveMiddleware, build, prepare, generate } from '@nuxt/nitro' import { wpfs, getNitroContext, createDevServer, resolveMiddleware, build, prepare, generate } from '@nuxt/nitro'
import type { Nuxt } from '@nuxt/kit' import type { Nuxt } from '@nuxt/kit'
@ -28,7 +28,7 @@ export function initNitro (nuxt: Nuxt) {
// Add nitro client plugin (to inject $fetch helper) // Add nitro client plugin (to inject $fetch helper)
nuxt.hook('app:resolve', (app) => { nuxt.hook('app:resolve', (app) => {
app.plugins.push({ src: normalize(require.resolve('@nuxt/nitro/dist/runtime/app/nitro.client.mjs')) }) app.plugins.push({ src: resolve(nitroContext._internal.runtimeDir, 'app/nitro.client.mjs') })
}) })
// Expose process.env.NITRO_PRESET // Expose process.env.NITRO_PRESET

View File

@ -1,4 +1,5 @@
import { resolve } from 'pathe' import { fileURLToPath } from 'url'
import { dirname, resolve } from 'pathe'
export const distDir = __dirname export const distDir = dirname(fileURLToPath(import.meta.url))
export const pkgDir = resolve(distDir, '..') export const pkgDir = resolve(distDir, '..')

View File

@ -2,6 +2,7 @@ import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig({ export default defineBuildConfig({
declaration: true, declaration: true,
emitCJS: false,
entries: [ entries: [
'src/index' 'src/index'
], ],

View File

@ -3,8 +3,9 @@
"version": "0.10.0", "version": "0.10.0",
"repository": "nuxt/framework", "repository": "nuxt/framework",
"license": "MIT", "license": "MIT",
"main": "./dist/index.cjs", "type": "module",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"exports": "./dist/index.mjs",
"files": [ "files": [
"dist" "dist"
], ],

View File

@ -1,6 +1,6 @@
import * as vite from 'vite'
import { resolve } from 'pathe' import { resolve } from 'pathe'
import { mkdirp, readJSON, writeFile } from 'fs-extra' import * as vite from 'vite'
import fse from 'fs-extra'
import consola from 'consola' import consola from 'consola'
import vitePlugin from '@vitejs/plugin-vue' import vitePlugin from '@vitejs/plugin-vue'
@ -84,9 +84,9 @@ export async function buildClient (ctx: ViteBuildContext) {
const clientManifest = ctx.nuxt.options.dev const clientManifest = ctx.nuxt.options.dev
? devClientManifest ? devClientManifest
: await readJSON(resolve(clientDist, 'manifest.json')) : await fse.readJSON(resolve(clientDist, 'manifest.json'))
await mkdirp(serverDist) await fse.mkdirp(serverDist)
await writeFile(resolve(serverDist, 'client.manifest.json'), JSON.stringify(clientManifest, null, 2), 'utf8') await fse.writeFile(resolve(serverDist, 'client.manifest.json'), JSON.stringify(clientManifest, null, 2), 'utf8')
await writeFile(resolve(serverDist, 'client.manifest.mjs'), 'export default ' + JSON.stringify(clientManifest, null, 2), 'utf8') await fse.writeFile(resolve(serverDist, 'client.manifest.mjs'), 'export default ' + JSON.stringify(clientManifest, null, 2), 'utf8')
} }

View File

@ -1,7 +1,7 @@
import { join } from 'pathe' import { join } from 'pathe'
import fsExtra from 'fs-extra' import fse from 'fs-extra'
export const wpfs = { export const wpfs = {
...fsExtra, ...fse,
join join
} }

View File

@ -2,6 +2,7 @@ import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig({ export default defineBuildConfig({
declaration: true, declaration: true,
emitCJS: false,
entries: [ entries: [
'src/index' 'src/index'
], ],

View File

@ -3,8 +3,12 @@
"version": "0.10.0", "version": "0.10.0",
"repository": "nuxt/framework", "repository": "nuxt/framework",
"license": "MIT", "license": "MIT",
"main": "./dist/index.cjs", "type": "module",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"exports": {
".": "./dist/index.mjs",
"./dist/*": "./dist/*"
},
"files": [ "files": [
"dist" "dist"
], ],
@ -27,9 +31,10 @@
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"glob": "^7.2.0", "glob": "^7.2.0",
"hash-sum": "^2.0.0", "hash-sum": "^2.0.0",
"lodash": "^4.17.21", "lodash-es": "^4.17.21",
"memfs": "^3.3.0", "memfs": "^3.3.0",
"mini-css-extract-plugin": "^2.3.0", "mini-css-extract-plugin": "^2.3.0",
"mlly": "^0.2.2",
"pathe": "^0.2.0", "pathe": "^0.2.0",
"pify": "^5.0.0", "pify": "^5.0.0",
"postcss": "^8.3.8", "postcss": "^8.3.8",

View File

@ -1,5 +1,5 @@
import querystring from 'querystring' import querystring from 'querystring'
import path from 'pathe' import { resolve } from 'pathe'
import webpack from 'webpack' import webpack from 'webpack'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
@ -81,7 +81,7 @@ function clientPlugins (ctx: WebpackConfigContext) {
// Webpack Bundle Analyzer // Webpack Bundle Analyzer
// https://github.com/webpack-contrib/webpack-bundle-analyzer // https://github.com/webpack-contrib/webpack-bundle-analyzer
if (!ctx.isDev && options.build.analyze) { if (!ctx.isDev && options.build.analyze) {
const statsDir = path.resolve(options.buildDir, 'stats') const statsDir = resolve(options.buildDir, 'stats')
// @ts-ignore // @ts-ignore
config.plugins.push(new BundleAnalyzerPlugin({ config.plugins.push(new BundleAnalyzerPlugin({
@ -89,8 +89,8 @@ function clientPlugins (ctx: WebpackConfigContext) {
defaultSizes: 'gzip', defaultSizes: 'gzip',
generateStatsFile: true, generateStatsFile: true,
openAnalyzer: !options.build.quiet, openAnalyzer: !options.build.quiet,
reportFilename: path.resolve(statsDir, `${ctx.name}.html`), reportFilename: resolve(statsDir, `${ctx.name}.html`),
statsFilename: path.resolve(statsDir, `${ctx.name}.json`), statsFilename: resolve(statsDir, `${ctx.name}.json`),
...options.build.analyze as any ...options.build.analyze as any
})) }))
} }

View File

@ -1,5 +1,5 @@
import { isAbsolute } from 'pathe' import { isAbsolute } from 'pathe'
import { ProvidePlugin } from 'webpack' import webpack from 'webpack'
import { WebpackConfigContext, applyPresets, getWebpackConfig } from '../utils/config' import { WebpackConfigContext, applyPresets, getWebpackConfig } from '../utils/config'
import { nuxt } from '../presets/nuxt' import { nuxt } from '../presets/nuxt'
import { node } from '../presets/node' import { node } from '../presets/node'
@ -68,7 +68,7 @@ function serverPlugins (ctx: WebpackConfigContext) {
// Server polyfills // Server polyfills
if (options.build.serverURLPolyfill) { if (options.build.serverURLPolyfill) {
config.plugins.push(new ProvidePlugin({ config.plugins.push(new webpack.ProvidePlugin({
URL: [options.build.serverURLPolyfill, 'URL'], URL: [options.build.serverURLPolyfill, 'URL'],
URLSearchParams: [options.build.serverURLPolyfill, 'URLSearchParams'] URLSearchParams: [options.build.serverURLPolyfill, 'URLSearchParams']
})) }))

View File

@ -5,8 +5,8 @@
import { dirname } from 'pathe' import { dirname } from 'pathe'
import hash from 'hash-sum' import hash from 'hash-sum'
import { uniq } from 'lodash' import { uniq } from 'lodash-es'
import { writeFile, mkdirp } from 'fs-extra' import fse from 'fs-extra'
import { isJS, isCSS, isHotUpdate } from './util' import { isJS, isCSS, isHotUpdate } from './util'
@ -111,11 +111,11 @@ export default class VueSSRClientPlugin {
const src = JSON.stringify(manifest, null, 2) const src = JSON.stringify(manifest, null, 2)
await mkdirp(dirname(this.options.filename)) await fse.mkdirp(dirname(this.options.filename))
await writeFile(this.options.filename, src) await fse.writeFile(this.options.filename, src)
const mjsSrc = 'export default ' + src const mjsSrc = 'export default ' + src
await writeFile(this.options.filename.replace('.json', '.mjs'), mjsSrc) await fse.writeFile(this.options.filename.replace('.json', '.mjs'), mjsSrc)
// assets[this.options.filename] = { // assets[this.options.filename] = {
// source: () => src, // source: () => src,

View File

@ -1,5 +1,5 @@
import { Compilation } from 'webpack' import webpack from 'webpack'
import { validate, isJS, extractQueryPartJS } from './util' import { validate, isJS, extractQueryPartJS } from './util'
export default class VueSSRServerPlugin { export default class VueSSRServerPlugin {
@ -18,7 +18,7 @@ export default class VueSSRServerPlugin {
compiler.hooks.make.tap('VueSSRServerPlugin', (compilation: any) => { compiler.hooks.make.tap('VueSSRServerPlugin', (compilation: any) => {
compilation.hooks.processAssets.tapAsync({ compilation.hooks.processAssets.tapAsync({
name: 'VueSSRServerPlugin', name: 'VueSSRServerPlugin',
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
}, (assets, cb) => { }, (assets, cb) => {
const stats = compilation.getStats().toJson() const stats = compilation.getStats().toJson()
const [entryName] = Object.keys(stats.entrypoints) const [entryName] = Object.keys(stats.entrypoints)

View File

@ -1,4 +1,4 @@
import { WebpackError } from 'webpack' import type { WebpackError } from 'webpack'
export default class WarningIgnorePlugin { export default class WarningIgnorePlugin {
filter: (warn: WebpackError) => boolean filter: (warn: WebpackError) => boolean

View File

@ -1,13 +1,16 @@
import { createRequire } from 'module'
import { normalize } from 'pathe' import { normalize } from 'pathe'
import TerserWebpackPlugin from 'terser-webpack-plugin' import TerserWebpackPlugin from 'terser-webpack-plugin'
import { reservedVueTags } from '../utils/reserved-tags' import { reservedVueTags } from '../utils/reserved-tags'
import { WebpackConfigContext } from '../utils/config' import { WebpackConfigContext } from '../utils/config'
const _require = createRequire(import.meta.url)
export function babel (ctx: WebpackConfigContext) { export function babel (ctx: WebpackConfigContext) {
const { config, options } = ctx const { config, options } = ctx
const babelLoader = { const babelLoader = {
loader: normalize(require.resolve('babel-loader')), loader: normalize(_require.resolve('babel-loader')),
options: getBabelOptions(ctx) options: getBabelOptions(ctx)
} }
@ -67,7 +70,7 @@ function getBabelOptions (ctx: WebpackConfigContext) {
babelOptions.plugins = babelOptions.plugins(ctx) babelOptions.plugins = babelOptions.plugins(ctx)
} }
const defaultPreset = [normalize(require.resolve('../../babel-preset-app')), {}] const defaultPreset = [normalize(_require.resolve('../../babel-preset-app')), {}]
if (typeof babelOptions.presets === 'function') { if (typeof babelOptions.presets === 'function') {
babelOptions.presets = babelOptions.presets(ctx, defaultPreset) babelOptions.presets = babelOptions.presets(ctx, defaultPreset)

View File

@ -2,9 +2,9 @@ import { resolve, normalize } from 'pathe'
import TimeFixPlugin from 'time-fix-plugin' import TimeFixPlugin from 'time-fix-plugin'
import WebpackBar from 'webpackbar' import WebpackBar from 'webpackbar'
import consola from 'consola' import consola from 'consola'
import { DefinePlugin, Configuration } from 'webpack' import webpack from 'webpack'
import FriendlyErrorsWebpackPlugin from '@nuxt/friendly-errors-webpack-plugin' import FriendlyErrorsWebpackPlugin from '@nuxt/friendly-errors-webpack-plugin'
import { escapeRegExp } from 'lodash' import { escapeRegExp } from 'lodash-es'
import { hasProtocol, joinURL } from 'ufo' import { hasProtocol, joinURL } from 'ufo'
import WarningIgnorePlugin from '../plugins/warning-ignore' import WarningIgnorePlugin from '../plugins/warning-ignore'
import { WebpackConfigContext, applyPresets, fileName } from '../utils/config' import { WebpackConfigContext, applyPresets, fileName } from '../utils/config'
@ -55,7 +55,7 @@ function basePlugins (ctx: WebpackConfigContext) {
config.plugins.push(new WarningIgnorePlugin(getWarningIgnoreFilter(ctx))) config.plugins.push(new WarningIgnorePlugin(getWarningIgnoreFilter(ctx)))
// Provide env via DefinePlugin // Provide env via DefinePlugin
config.plugins.push(new DefinePlugin(getEnv(ctx))) config.plugins.push(new webpack.DefinePlugin(getEnv(ctx)))
// Friendly errors // Friendly errors
if ( if (
@ -164,7 +164,7 @@ export function baseTranspile (ctx: WebpackConfigContext) {
ctx.transpile = [...transpile, ...ctx.transpile] ctx.transpile = [...transpile, ...ctx.transpile]
} }
function getCache (ctx: WebpackConfigContext): Configuration['cache'] { function getCache (ctx: WebpackConfigContext): webpack.Configuration['cache'] {
const { options } = ctx const { options } = ctx
if (!options.dev) { if (!options.dev) {
@ -187,7 +187,7 @@ function getCache (ctx: WebpackConfigContext): Configuration['cache'] {
// } // }
} }
function getOutput (ctx: WebpackConfigContext): Configuration['output'] { function getOutput (ctx: WebpackConfigContext): webpack.Configuration['output'] {
const { options } = ctx const { options } = ctx
return { return {

View File

@ -1,4 +1,4 @@
import path from 'pathe' import { resolve } from 'pathe'
import MiniCssExtractPlugin from 'mini-css-extract-plugin' import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin' import CssMinimizerPlugin from 'css-minimizer-webpack-plugin'
import { fileName, WebpackConfigContext, applyPresets } from '../utils/config' import { fileName, WebpackConfigContext, applyPresets } from '../utils/config'
@ -130,7 +130,7 @@ function createStyleResourcesLoaderRule (styleLang, styleResources, rootDir) {
return { return {
loader: 'style-resources-loader', loader: 'style-resources-loader',
options: { options: {
patterns: Array.from(styleResources[styleLang]).map(p => path.resolve(rootDir, p as string)), patterns: Array.from(styleResources[styleLang]).map(p => resolve(rootDir, p as string)),
...styleResources.options ...styleResources.options
} }
} }

View File

@ -1,6 +1,6 @@
import { resolve } from 'pathe' import { resolve } from 'pathe'
import VueLoaderPlugin from 'vue-loader/dist/pluginWebpack5' import VueLoaderPlugin from 'vue-loader/dist/pluginWebpack5.js'
import { DefinePlugin } from 'webpack' import webpack from 'webpack'
import VueSSRClientPlugin from '../plugins/vue/client' import VueSSRClientPlugin from '../plugins/vue/client'
import VueSSRServerPlugin from '../plugins/vue/server' import VueSSRServerPlugin from '../plugins/vue/server'
import { WebpackConfigContext } from '../utils/config' import { WebpackConfigContext } from '../utils/config'
@ -8,7 +8,8 @@ import { WebpackConfigContext } from '../utils/config'
export function vue (ctx: WebpackConfigContext) { export function vue (ctx: WebpackConfigContext) {
const { options, config } = ctx const { options, config } = ctx
config.plugins.push(new VueLoaderPlugin()) // @ts-ignore
config.plugins.push(new (VueLoaderPlugin.default || VueLoaderPlugin)())
config.module.rules.push({ config.module.rules.push({
test: /\.vue$/i, test: /\.vue$/i,
@ -29,7 +30,7 @@ export function vue (ctx: WebpackConfigContext) {
// Feature flags // Feature flags
// https://github.com/vuejs/vue-next/tree/master/packages/vue#bundler-build-feature-flags // https://github.com/vuejs/vue-next/tree/master/packages/vue#bundler-build-feature-flags
// TODO: Provide options to toggle // TODO: Provide options to toggle
config.plugins.push(new DefinePlugin({ config.plugins.push(new webpack.DefinePlugin({
__VUE_OPTIONS_API__: 'true', __VUE_OPTIONS_API__: 'true',
__VUE_PROD_DEVTOOLS__: 'false' __VUE_PROD_DEVTOOLS__: 'false'
})) }))

View File

@ -1,6 +1,6 @@
import consola from 'consola' import consola from 'consola'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash-es'
import { Configuration } from 'webpack' import type { Configuration } from 'webpack'
import type { Nuxt } from '@nuxt/kit' import type { Nuxt } from '@nuxt/kit'
export interface WebpackConfigContext extends ReturnType<typeof createWebpackConfigContext>{ } export interface WebpackConfigContext extends ReturnType<typeof createWebpackConfigContext>{ }

View File

@ -1,4 +1,4 @@
import path from 'pathe' import { join } from 'pathe'
import pify from 'pify' import pify from 'pify'
import { Volume, createFsFromVolume } from 'memfs' import { Volume, createFsFromVolume } from 'memfs'
@ -13,7 +13,7 @@ export function createMFS () {
// fs.join method is (still) expected by webpack-dev-middleware // fs.join method is (still) expected by webpack-dev-middleware
// There might be differences with https://github.com/webpack/memory-fs/blob/master/lib/join.js // There might be differences with https://github.com/webpack/memory-fs/blob/master/lib/join.js
_fs.join = path.join _fs.join = join
// Used by vue-renderer // Used by vue-renderer
_fs.exists = p => Promise.resolve(_fs.existsSync(p)) _fs.exists = p => Promise.resolve(_fs.existsSync(p))

View File

@ -1,7 +1,8 @@
import fs from 'fs' import fs from 'fs'
import path from 'pathe' import { resolve } from 'pathe'
import consola from 'consola' import consola from 'consola'
import { defaults, merge, cloneDeep } from 'lodash' import { createCommonJS } from 'mlly'
import { defaults, merge, cloneDeep } from 'lodash-es'
import createResolver from 'postcss-import-resolver' import createResolver from 'postcss-import-resolver'
import { Nuxt, requireModule } from '@nuxt/kit' import { Nuxt, requireModule } from '@nuxt/kit'
@ -111,7 +112,7 @@ export class PostcssConfig {
'.postcssrc.json', '.postcssrc.json',
'.postcssrc.yaml' '.postcssrc.yaml'
]) { ]) {
const configFile = path.resolve(dir, file) const configFile = resolve(dir, file)
if (fs.existsSync(configFile)) { if (fs.existsSync(configFile)) {
postcssConfigFileWarning() postcssConfigFileWarning()
return configFile return configFile
@ -140,8 +141,9 @@ export class PostcssConfig {
loadPlugins (config) { loadPlugins (config) {
if (!isPureObject(config.plugins)) { return } if (!isPureObject(config.plugins)) { return }
// Map postcss plugins into instances on object mode once // Map postcss plugins into instances on object mode once
const cjs = createCommonJS(import.meta.url)
config.plugins = this.sortPlugins(config).map((pluginName) => { config.plugins = this.sortPlugins(config).map((pluginName) => {
const pluginFn = requireModule(pluginName, { paths: [__dirname] }) const pluginFn = requireModule(pluginName, { paths: [cjs.__dirname] })
const pluginOptions = config.plugins[pluginName] const pluginOptions = config.plugins[pluginName]
if (!pluginOptions || typeof pluginFn !== 'function') { return null } if (!pluginOptions || typeof pluginFn !== 'function') { return null }
return pluginFn(pluginOptions) return pluginFn(pluginOptions)

View File

@ -1,5 +1,5 @@
import type { IncomingMessage, ServerResponse } from 'http' import type { IncomingMessage, ServerResponse } from 'http'
import path from 'pathe' import { resolve } from 'pathe'
import pify from 'pify' import pify from 'pify'
import webpack from 'webpack' import webpack from 'webpack'
import Glob from 'glob' import Glob from 'glob'
@ -100,7 +100,7 @@ class WebpackBundler {
) )
for (const ext of Object.keys(styleResources)) { for (const ext of Object.keys(styleResources)) {
await Promise.all(Array.from(styleResources[ext]).map(async (p) => { await Promise.all(Array.from(styleResources[ext]).map(async (p) => {
const styleResourceFiles = await glob(path.resolve(this.nuxt.options.rootDir, p as string)) const styleResourceFiles = await glob(resolve(this.nuxt.options.rootDir, p as string))
if (!styleResourceFiles || styleResourceFiles.length === 0) { if (!styleResourceFiles || styleResourceFiles.length === 0) {
throw new Error(`Style Resource not found: ${p}`) throw new Error(`Style Resource not found: ${p}`)

View File

@ -1,9 +1,7 @@
import { defineNuxtConfig } from '@nuxt/kit'
// @ts-ignore // @ts-ignore
global.__NUXT_PREPATHS__ = (global.__NUXT_PREPATHS__ || []).concat(__dirname) global.__NUXT_PREPATHS__ = (global.__NUXT_PREPATHS__ || []).concat(__dirname)
export default defineNuxtConfig({ export default {
components: true, components: true,
buildModules: [ buildModules: [
'@nuxt/bridge' '@nuxt/bridge'
@ -21,4 +19,4 @@ export default defineNuxtConfig({
nitro: { nitro: {
output: { dir: process.env.NITRO_OUTPUT_DIR } output: { dir: process.env.NITRO_OUTPUT_DIR }
} }
}) }

View File

@ -1690,9 +1690,9 @@ __metadata:
linkType: hard linkType: hard
"@polka/url@npm:^1.0.0-next.20": "@polka/url@npm:^1.0.0-next.20":
version: 1.0.0-next.20 version: 1.0.0-next.21
resolution: "@polka/url@npm:1.0.0-next.20" resolution: "@polka/url@npm:1.0.0-next.21"
checksum: a37138ed3314606c7a8984368e29413e29b24f0b877588c161ccc5464daaa235a03bc62ebffe51063a9917f5542afb29c8181b877579b33570ec6d9304c42d2e checksum: c7654046d38984257dd639eab3dc770d1b0340916097b2fac03ce5d23506ada684e05574a69b255c32ea6a144a957c8cd84264159b545fca031c772289d88788
languageName: node languageName: node
linkType: hard linkType: hard
@ -1718,9 +1718,9 @@ __metadata:
linkType: hard linkType: hard
"@types/node@npm:*": "@types/node@npm:*":
version: 16.9.4 version: 16.10.2
resolution: "@types/node@npm:16.9.4" resolution: "@types/node@npm:16.10.2"
checksum: ae281eec8e0ead86fd5fd76f56312db85dce27d0ac086d07bc917df98e16af792adc4f26dab099698509e2c3704cbd17224ec8138e822d569e3cadfc15569a71 checksum: 83c1c3c68e7500103908c3f16094e458879c840a719c15b6ea577f81fe1f24a1b3473bb6c8e8091fe79a82543ca7639c6b1088fcf80292ec091d1d1c9504a87e
languageName: node languageName: node
linkType: hard linkType: hard
@ -2218,11 +2218,11 @@ __metadata:
linkType: hard linkType: hard
"ansi-align@npm:^3.0.0": "ansi-align@npm:^3.0.0":
version: 3.0.0 version: 3.0.1
resolution: "ansi-align@npm:3.0.0" resolution: "ansi-align@npm:3.0.1"
dependencies: dependencies:
string-width: ^3.0.0 string-width: ^4.1.0
checksum: 6bc5f3712d28a899063845a15c5da75b2f350dda8ffac6098581619b80a85d249cdd23c3dc7b596cd31e44477382bcdedff47e31201eaa10bb9708c9fce45330 checksum: 6abfa08f2141d231c257162b15292467081fa49a208593e055c866aa0455b57f3a86b5a678c190c618faa79b4c59e254493099cb700dd9cf2293c6be2c8f5d8d
languageName: node languageName: node
linkType: hard linkType: hard
@ -2258,14 +2258,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"ansi-regex@npm:^4.1.0": "ansi-regex@npm:^5.0.1":
version: 4.1.0
resolution: "ansi-regex@npm:4.1.0"
checksum: 97aa4659538d53e5e441f5ef2949a3cffcb838e57aeaad42c4194e9d7ddb37246a6526c4ca85d3940a9d1e19b11cc2e114530b54c9d700c8baf163c31779baf8
languageName: node
linkType: hard
"ansi-regex@npm:^5.0.0":
version: 5.0.1 version: 5.0.1
resolution: "ansi-regex@npm:5.0.1" resolution: "ansi-regex@npm:5.0.1"
checksum: 2aa4bb54caf2d622f1afdad09441695af2a83aa3fe8b8afa581d205e57ed4261c183c4d3877cee25794443fde5876417d859c108078ab788d6af7e4fe52eb66b checksum: 2aa4bb54caf2d622f1afdad09441695af2a83aa3fe8b8afa581d205e57ed4261c183c4d3877cee25794443fde5876417d859c108078ab788d6af7e4fe52eb66b
@ -2438,19 +2431,19 @@ __metadata:
linkType: hard linkType: hard
"autoprefixer@npm:^9.6.1": "autoprefixer@npm:^9.6.1":
version: 9.8.6 version: 9.8.7
resolution: "autoprefixer@npm:9.8.6" resolution: "autoprefixer@npm:9.8.7"
dependencies: dependencies:
browserslist: ^4.12.0 browserslist: ^4.12.0
caniuse-lite: ^1.0.30001109 caniuse-lite: ^1.0.30001109
colorette: ^1.2.1 nanocolors: ^0.2.8
normalize-range: ^0.1.2 normalize-range: ^0.1.2
num2fraction: ^1.2.2 num2fraction: ^1.2.2
postcss: ^7.0.32 postcss: ^7.0.32
postcss-value-parser: ^4.1.0 postcss-value-parser: ^4.1.0
bin: bin:
autoprefixer: bin/autoprefixer autoprefixer: bin/autoprefixer
checksum: 46987bc3de6612f0276c3643061901e33cc5721d07aaeb6f0daf237554448884a59c0b17087bf0f00a07d940abcb5a6eaf2203b962c24fe33d52f76aa845cb70 checksum: d9c6cb1ee3497f6f9346e0ea8619a8bc85844cd7ec6a86dcd6e9f8d29eed2b1a7c80135852af53b2380fb8347cc5b080ea77c294faae707e799e7b9025a40e70
languageName: node languageName: node
linkType: hard linkType: hard
@ -2492,14 +2485,14 @@ __metadata:
linkType: hard linkType: hard
"babel-plugin-polyfill-corejs3@npm:^0.2.2": "babel-plugin-polyfill-corejs3@npm:^0.2.2":
version: 0.2.4 version: 0.2.5
resolution: "babel-plugin-polyfill-corejs3@npm:0.2.4" resolution: "babel-plugin-polyfill-corejs3@npm:0.2.5"
dependencies: dependencies:
"@babel/helper-define-polyfill-provider": ^0.2.2 "@babel/helper-define-polyfill-provider": ^0.2.2
core-js-compat: ^3.14.0 core-js-compat: ^3.16.2
peerDependencies: peerDependencies:
"@babel/core": ^7.0.0-0 "@babel/core": ^7.0.0-0
checksum: 49e9b1709fd76bff8b577da38548d05ec0317acaa9cba893bf447af7b0f26494d635b70814452782d079b2b6f25c09dd8fa76e151c0e4ae1397e8295af14e685 checksum: 7d464001f6cecc6b85aef71307e3ef17980b15aae4b2ae75d38a3fc3166005f6354932f9c694566970a3fb428f8fbc44f94c46e055a5a85b7fe8820ca16f85b6
languageName: node languageName: node
linkType: hard linkType: hard
@ -2734,18 +2727,18 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"browserslist@npm:^4.0.0, browserslist@npm:^4.12.0, browserslist@npm:^4.16.6, browserslist@npm:^4.17.0, browserslist@npm:^4.6.4": "browserslist@npm:^4.0.0, browserslist@npm:^4.12.0, browserslist@npm:^4.16.6, browserslist@npm:^4.17.1, browserslist@npm:^4.6.4":
version: 4.17.0 version: 4.17.2
resolution: "browserslist@npm:4.17.0" resolution: "browserslist@npm:4.17.2"
dependencies: dependencies:
caniuse-lite: ^1.0.30001254 caniuse-lite: ^1.0.30001261
colorette: ^1.3.0 electron-to-chromium: ^1.3.854
electron-to-chromium: ^1.3.830
escalade: ^3.1.1 escalade: ^3.1.1
node-releases: ^1.1.75 nanocolors: ^0.2.12
node-releases: ^1.1.76
bin: bin:
browserslist: cli.js browserslist: cli.js
checksum: 9b45ec283d7ba1513bd8be6143dadb34a65e8be7f7210b3a2bce947e019184408df6126238e54f8061e9be74362b19d04eaba739b3ee0d5d41d57ac0ae5fe4cd checksum: 9102023e8a8f541110c2905854d8398245811dfa6a02c3c94a0862c402f11fd42900cd595cb8494e5ee1104120b40e4721108219931bdbb4c59855f138e684da
languageName: node languageName: node
linkType: hard linkType: hard
@ -2968,10 +2961,10 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30000981, caniuse-lite@npm:^1.0.30001109, caniuse-lite@npm:^1.0.30001228, caniuse-lite@npm:^1.0.30001254": "caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30000981, caniuse-lite@npm:^1.0.30001109, caniuse-lite@npm:^1.0.30001228, caniuse-lite@npm:^1.0.30001261":
version: 1.0.30001258 version: 1.0.30001263
resolution: "caniuse-lite@npm:1.0.30001258" resolution: "caniuse-lite@npm:1.0.30001263"
checksum: 2e87875a7792444f18060f836dbe1a3fcf58dcdd4608c63725dac503aadd617c2bb771c766963fb31528c10fd55201a7cf3ece555a3e754f94ee4a991626c302 checksum: 0657b995276a35aaa9ff6900b6e9d3876ef049c8d6065fe9f162cc0b9ac00d8b9c6e6740e87def73876a522dce8e9124170334c157cfbf5c383b7c6db79e520e
languageName: node languageName: node
linkType: hard linkType: hard
@ -3079,7 +3072,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"ci-info@npm:^3.0.0, ci-info@npm:^3.1.1": "ci-info@npm:^3.1.1":
version: 3.2.0 version: 3.2.0
resolution: "ci-info@npm:3.2.0" resolution: "ci-info@npm:3.2.0"
checksum: c68995a94e95ce3f233ff845e62dfc56f2e8ff1e3f5c1361bcdd520cbbc9726d8a54cbc1a685cb9ee19c3c5e71a1dade6dda23eb364b59b8e6c32508a9b761bc checksum: c68995a94e95ce3f233ff845e62dfc56f2e8ff1e3f5c1361bcdd520cbbc9726d8a54cbc1a685cb9ee19c3c5e71a1dade6dda23eb364b59b8e6c32508a9b761bc
@ -3227,7 +3220,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"colorette@npm:^1.2.1, colorette@npm:^1.2.2, colorette@npm:^1.3.0": "colorette@npm:^1.2.2":
version: 1.4.0 version: 1.4.0
resolution: "colorette@npm:1.4.0" resolution: "colorette@npm:1.4.0"
checksum: 01c3c16058b182a4ab4c126a65a75faa4d38a20fa7c845090b25453acec6c371bb2c5dceb0a2338511f17902b9d1a9af0cadd8509c9403894b79311032c256c3 checksum: 01c3c16058b182a4ab4c126a65a75faa4d38a20fa7c845090b25453acec6c371bb2c5dceb0a2338511f17902b9d1a9af0cadd8509c9403894b79311032c256c3
@ -3398,13 +3391,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"core-js-compat@npm:^3.12.1, core-js-compat@npm:^3.14.0, core-js-compat@npm:^3.16.0": "core-js-compat@npm:^3.12.1, core-js-compat@npm:^3.16.0, core-js-compat@npm:^3.16.2":
version: 3.18.0 version: 3.18.1
resolution: "core-js-compat@npm:3.18.0" resolution: "core-js-compat@npm:3.18.1"
dependencies: dependencies:
browserslist: ^4.17.0 browserslist: ^4.17.1
semver: 7.0.0 semver: 7.0.0
checksum: 2bf11676215d912c099078564bbbd837ff6b4a18635661414f3d72b4b78bee883117d583645629999407f910be311624d0380aefec69b3b77ef91001bcb30b19 checksum: d7afbd879fa1fd6bd20778308bfafc8b4993b13a4c24cb0793baad4b027d13f59fef78b867137b0a570df708ea2d0766a067d8c5b3dc4e5e4747d70dc91e1c98
languageName: node languageName: node
linkType: hard linkType: hard
@ -3416,9 +3409,9 @@ __metadata:
linkType: hard linkType: hard
"core-js@npm:^3": "core-js@npm:^3":
version: 3.18.0 version: 3.18.1
resolution: "core-js@npm:3.18.0" resolution: "core-js@npm:3.18.1"
checksum: 192c345eb0c8b9d582ebed798cf124e00cd8241303c3c801987563f8ebb8cb991e2ff91494c258752014c29d5515070d2c0a862687401c7d7e1e2f96f8980d42 checksum: 89cac0fe657df722d10b0e658ee76af12a614c0a75fe3fb11e87c2e3f27f6d7e609e3bf40748da5d8feb055b0535766a583ff1d1ac89dba57105f6f1ad64dc21
languageName: node languageName: node
linkType: hard linkType: hard
@ -4096,10 +4089,10 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"electron-to-chromium@npm:^1.3.830": "electron-to-chromium@npm:^1.3.854":
version: 1.3.843 version: 1.3.857
resolution: "electron-to-chromium@npm:1.3.843" resolution: "electron-to-chromium@npm:1.3.857"
checksum: 4adb18cf1c0f3ee8014fe6976c3e9a2c5f05353a9fd9712cf95a578ede66cd3d85106a764b6d0291c81ca31edcd8f5da4a2f7606858a11e31e410c1e6ea3f303 checksum: 59d3dcf7ec7d3c8209647cadb6cc9d2a14b9ef9cb2ae7c9837c9dbe38301838e6629bfa002121d3dc4c00e982327d6337d6d5460902f02f8a80d0d81c63f1728
languageName: node languageName: node
linkType: hard linkType: hard
@ -4118,13 +4111,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"emoji-regex@npm:^7.0.1":
version: 7.0.3
resolution: "emoji-regex@npm:7.0.3"
checksum: 9159b2228b1511f2870ac5920f394c7e041715429a68459ebe531601555f11ea782a8e1718f969df2711d38c66268174407cbca57ce36485544f695c2dfdc96e
languageName: node
linkType: hard
"emoji-regex@npm:^8.0.0": "emoji-regex@npm:^8.0.0":
version: 8.0.0 version: 8.0.0
resolution: "emoji-regex@npm:8.0.0" resolution: "emoji-regex@npm:8.0.0"
@ -4226,8 +4212,8 @@ __metadata:
linkType: hard linkType: hard
"es-abstract@npm:^1.17.2, es-abstract@npm:^1.18.0-next.2, es-abstract@npm:^1.18.2": "es-abstract@npm:^1.17.2, es-abstract@npm:^1.18.0-next.2, es-abstract@npm:^1.18.2":
version: 1.18.6 version: 1.19.0
resolution: "es-abstract@npm:1.18.6" resolution: "es-abstract@npm:1.19.0"
dependencies: dependencies:
call-bind: ^1.0.2 call-bind: ^1.0.2
es-to-primitive: ^1.2.1 es-to-primitive: ^1.2.1
@ -4240,14 +4226,16 @@ __metadata:
is-callable: ^1.2.4 is-callable: ^1.2.4
is-negative-zero: ^2.0.1 is-negative-zero: ^2.0.1
is-regex: ^1.1.4 is-regex: ^1.1.4
is-shared-array-buffer: ^1.0.1
is-string: ^1.0.7 is-string: ^1.0.7
is-weakref: ^1.0.1
object-inspect: ^1.11.0 object-inspect: ^1.11.0
object-keys: ^1.1.1 object-keys: ^1.1.1
object.assign: ^4.1.2 object.assign: ^4.1.2
string.prototype.trimend: ^1.0.4 string.prototype.trimend: ^1.0.4
string.prototype.trimstart: ^1.0.4 string.prototype.trimstart: ^1.0.4
unbox-primitive: ^1.0.1 unbox-primitive: ^1.0.1
checksum: 8903ed187a9f66a8b21385401770124b37ded75a9cd99c7ea22e709ca667e7b549f37dc8bf9bf458a6cdb908c95a16fed389e2871bb3a28bfaab46db555cb1f3 checksum: 107eaf54c72405c4956211aae5ee13fab95582ad40efa3890355a4f6a65fe48b6968fe9e36e9a4f408d330d56655703cf214fa750776c07990dc189ffe67cd26
languageName: node languageName: node
linkType: hard linkType: hard
@ -4911,8 +4899,8 @@ fsevents@~2.3.2:
linkType: hard linkType: hard
"glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6, glob@npm:^7.1.7": "glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6, glob@npm:^7.1.7":
version: 7.1.7 version: 7.2.0
resolution: "glob@npm:7.1.7" resolution: "glob@npm:7.2.0"
dependencies: dependencies:
fs.realpath: ^1.0.0 fs.realpath: ^1.0.0
inflight: ^1.0.4 inflight: ^1.0.4
@ -4920,7 +4908,7 @@ fsevents@~2.3.2:
minimatch: ^3.0.4 minimatch: ^3.0.4
once: ^1.3.0 once: ^1.3.0
path-is-absolute: ^1.0.0 path-is-absolute: ^1.0.0
checksum: b61f48973bbdcf5159997b0874a2165db572b368b931135832599875919c237fc05c12984e38fe828e69aa8a921eb0e8a4997266211c517c9cfaae8a93988bb8 checksum: 78a8ea942331f08ed2e055cb5b9e40fe6f46f579d7fd3d694f3412fe5db23223d29b7fee1575440202e9a7ff9a72ab106a39fee39934c7bedafe5e5f8ae20134
languageName: node languageName: node
linkType: hard linkType: hard
@ -5597,11 +5585,11 @@ fsevents@~2.3.2:
linkType: hard linkType: hard
"is-core-module@npm:^2.2.0": "is-core-module@npm:^2.2.0":
version: 2.6.0 version: 2.7.0
resolution: "is-core-module@npm:2.6.0" resolution: "is-core-module@npm:2.7.0"
dependencies: dependencies:
has: ^1.0.3 has: ^1.0.3
checksum: 183b3b96fed19822b13959876b0317e61fc2cb5ebcbc21639904c81f7ae328af57f8e18cc4750a9c4abebd686130c70d34a89521e57dbe002edfa4614507ce18 checksum: 8ec6dc714438ef9dc4dae10c94d21bd5aa67244da7e85bd9e42f0fd298514181214f6bebe358a486477c1242458b170ad7a8c936be0be15d465862fa61d3d1c7
languageName: node languageName: node
linkType: hard linkType: hard
@ -5726,11 +5714,11 @@ fsevents@~2.3.2:
linkType: hard linkType: hard
"is-glob@npm:^4.0.0, is-glob@npm:^4.0.1, is-glob@npm:~4.0.1": "is-glob@npm:^4.0.0, is-glob@npm:^4.0.1, is-glob@npm:~4.0.1":
version: 4.0.1 version: 4.0.3
resolution: "is-glob@npm:4.0.1" resolution: "is-glob@npm:4.0.3"
dependencies: dependencies:
is-extglob: ^2.1.1 is-extglob: ^2.1.1
checksum: 84627cad11b4e745f5db5a163f32c47b711585a5ff6e14f8f8d026db87f4cdd3e2c95f6fa1f94ad22e469f36d819ae2814f03f9c668b164422ac3354a94672d3 checksum: d381c1319fcb69d341cc6e6c7cd588e17cd94722d9a32dbd60660b993c4fb7d0f19438674e68dfec686d09b7c73139c9166b47597f846af387450224a8101ab4
languageName: node languageName: node
linkType: hard linkType: hard
@ -5813,6 +5801,13 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"is-shared-array-buffer@npm:^1.0.1":
version: 1.0.1
resolution: "is-shared-array-buffer@npm:1.0.1"
checksum: 2ffb92533e64e2876e6cfe6906871d28400b6f1a53130fe652ec8007bc0e5044d05e7af8e31bdc992fbba520bd92938cfbeedd0f286be92f250c7c76191c4d90
languageName: node
linkType: hard
"is-ssh@npm:^1.3.0": "is-ssh@npm:^1.3.0":
version: 1.3.3 version: 1.3.3
resolution: "is-ssh@npm:1.3.3" resolution: "is-ssh@npm:1.3.3"
@ -5847,6 +5842,15 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"is-weakref@npm:^1.0.1":
version: 1.0.1
resolution: "is-weakref@npm:1.0.1"
dependencies:
call-bind: ^1.0.0
checksum: fdafb7b955671dd2f9658ff47c86e4025c0650fc68a3542a40e5a75898a763b1abd6b1e1f9f13207eed49541cdd76af67d73c44989ea358b201b70274cf8f6c1
languageName: node
linkType: hard
"is-windows@npm:^1.0.2": "is-windows@npm:^1.0.2":
version: 1.0.2 version: 1.0.2
resolution: "is-windows@npm:1.0.2" resolution: "is-windows@npm:1.0.2"
@ -5903,11 +5907,11 @@ fsevents@~2.3.2:
linkType: hard linkType: hard
"jiti@npm:^1.9.2": "jiti@npm:^1.9.2":
version: 1.12.0 version: 1.12.5
resolution: "jiti@npm:1.12.0" resolution: "jiti@npm:1.12.5"
bin: bin:
jiti: bin/jiti.js jiti: bin/jiti.js
checksum: 7490f80be8504f107c0983f9e6dd38ff55764f295a334075580468d01d63a2c7057be1847e389ae3c86e09cfcd60e653b51a2c00ca4d175a26e392eb3471f96a checksum: 00a1674f38b77c725597c175389da67894d08b386d1d3dac9ecafec3abaf75793b2ea369ed2e688f2e03f495488c843da790c111cc5e24aa533c09051a6fe704
languageName: node languageName: node
linkType: hard linkType: hard
@ -6436,14 +6440,7 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"mime-db@npm:1.49.0": "mime-db@npm:1.50.0, mime-db@npm:>= 1.43.0 < 2":
version: 1.49.0
resolution: "mime-db@npm:1.49.0"
checksum: 3744efc45b17896ff8a5934a761c434d5ffe3c7816662002d799ca9934347e00f99ae4d9b4ddf1c48d391cc9e522cc4523a6e77e7701f8e27c426e3e1d6e215a
languageName: node
linkType: hard
"mime-db@npm:>= 1.43.0 < 2":
version: 1.50.0 version: 1.50.0
resolution: "mime-db@npm:1.50.0" resolution: "mime-db@npm:1.50.0"
checksum: 95fcc19c3664ae72391c8a7e4015dde7fb6817c98c951493ca3a1d48050feb8ee08810a372ce7d9e16310042d26e5bda168916f600583a9a583655eeea8ff5f5 checksum: 95fcc19c3664ae72391c8a7e4015dde7fb6817c98c951493ca3a1d48050feb8ee08810a372ce7d9e16310042d26e5bda168916f600583a9a583655eeea8ff5f5
@ -6451,11 +6448,11 @@ fsevents@~2.3.2:
linkType: hard linkType: hard
"mime-types@npm:^2.1.19, mime-types@npm:^2.1.27, mime-types@npm:^2.1.30, mime-types@npm:~2.1.24": "mime-types@npm:^2.1.19, mime-types@npm:^2.1.27, mime-types@npm:^2.1.30, mime-types@npm:~2.1.24":
version: 2.1.32 version: 2.1.33
resolution: "mime-types@npm:2.1.32" resolution: "mime-types@npm:2.1.33"
dependencies: dependencies:
mime-db: 1.49.0 mime-db: 1.50.0
checksum: 4487dfd2f872126d2c219ec731ad47a6169a438d5a4cce6ecef7594ce08eaefaf0d85429485a76ec005f095016c7ec488a24cf8bfcc0ea06de0355e23395746f checksum: 05f2a0b3f169fbc51d79bdc7674ceb379dd07dbeadb0143059a7def865224686ee9f9051aeb340e98b6c11dbc06794ce0122181db4312cb1ad054fd90b0d510e
languageName: node languageName: node
linkType: hard linkType: hard
@ -6706,12 +6703,19 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"nanocolors@npm:^0.2.12, nanocolors@npm:^0.2.2, nanocolors@npm:^0.2.8":
version: 0.2.12
resolution: "nanocolors@npm:0.2.12"
checksum: a34a63dcca29eede3db41afd1421f130423fc99e73f6c89166f57815bbf0441f02a6112651b068acfd309707215f48eec15dd38e790a8225d6762503a7c175c6
languageName: node
linkType: hard
"nanoid@npm:^3.1.23": "nanoid@npm:^3.1.23":
version: 3.1.25 version: 3.1.28
resolution: "nanoid@npm:3.1.25" resolution: "nanoid@npm:3.1.28"
bin: bin:
nanoid: bin/nanoid.cjs nanoid: bin/nanoid.cjs
checksum: e2353828c7d8fde65265e9c981380102e2021f292038a93fd27288bad390339833286e8cbc7531abe1cb2c6b317e55f38b895dcb775151637bb487388558e0ff checksum: ae2fa9f3ce7a690ec62fc2fdf92345f023b20db760024f767c25ad392bde6414dc0b44a8e66dc1209426f36e4771e63b09ad2b49d8f1b04063b37e21b46af8d0
languageName: node languageName: node
linkType: hard linkType: hard
@ -6768,9 +6772,11 @@ fsevents@~2.3.2:
linkType: hard linkType: hard
"node-fetch@npm:^2.6.1": "node-fetch@npm:^2.6.1":
version: 2.6.2 version: 2.6.5
resolution: "node-fetch@npm:2.6.2" resolution: "node-fetch@npm:2.6.5"
checksum: de367eae1dfbc0e12283c1cf92256ea7fba7eac8655e2e51ebb217727162396fc6cf24689ef9fc6accf075e3991e2ffaa061f7cfaa958215329649b2297ff06d dependencies:
whatwg-url: ^5.0.0
checksum: 4e83db450718e70762882f00d96f647a7f2f3170035225934ddd5450cb1d91ef339ceb180d3687bcb0a6ed78c3fa5636ce8d3e44ec81ab59e0224ebf8965f65f
languageName: node languageName: node
linkType: hard linkType: hard
@ -6842,10 +6848,10 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"node-releases@npm:^1.1.75": "node-releases@npm:^1.1.76":
version: 1.1.76 version: 1.1.77
resolution: "node-releases@npm:1.1.76" resolution: "node-releases@npm:1.1.77"
checksum: 10174cb880fffbb2896954599a2551da66127dd3c65703c827536fe9a4b4431545a9e3378c2006fb5ba59d0f0764ceff87c9f7eb0e84fabf7958411fccd0edd1 checksum: eb2fcb45310e7d77f82bfdadeca546a698d258e011f15d88ad9a452a5e838a672ec532906581096ca19c66284a788330c3b09227ffc540e67228730f41b9c2e2
languageName: node languageName: node
linkType: hard linkType: hard
@ -8249,13 +8255,12 @@ fsevents@~2.3.2:
linkType: hard linkType: hard
"postcss@npm:^7.0.0, postcss@npm:^7.0.1, postcss@npm:^7.0.14, postcss@npm:^7.0.17, postcss@npm:^7.0.2, postcss@npm:^7.0.27, postcss@npm:^7.0.32, postcss@npm:^7.0.36, postcss@npm:^7.0.5, postcss@npm:^7.0.6": "postcss@npm:^7.0.0, postcss@npm:^7.0.1, postcss@npm:^7.0.14, postcss@npm:^7.0.17, postcss@npm:^7.0.2, postcss@npm:^7.0.27, postcss@npm:^7.0.32, postcss@npm:^7.0.36, postcss@npm:^7.0.5, postcss@npm:^7.0.6":
version: 7.0.36 version: 7.0.38
resolution: "postcss@npm:7.0.36" resolution: "postcss@npm:7.0.38"
dependencies: dependencies:
chalk: ^2.4.2 nanocolors: ^0.2.2
source-map: ^0.6.1 source-map: ^0.6.1
supports-color: ^6.1.0 checksum: 737ba0355721880532167d3fbdc580a5ba95a5398b86f3ace610eff99aa11f3c32eb8eac0cfd8ea201a5372f43af3ed7bb6e7643263956fe1d36e927aaf3c4d4
checksum: 4cfc0989b9ad5d0e8971af80d87f9c5beac5c84cb89ff22ad69852edf73c0a2fa348e7e0a135b5897bf893edad0fe86c428769050431ad9b532f072ff530828d
languageName: node languageName: node
linkType: hard linkType: hard
@ -9117,9 +9122,9 @@ fsevents@~2.3.2:
linkType: hard linkType: hard
"signal-exit@npm:^3.0.0, signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.3": "signal-exit@npm:^3.0.0, signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.3":
version: 3.0.4 version: 3.0.5
resolution: "signal-exit@npm:3.0.4" resolution: "signal-exit@npm:3.0.5"
checksum: e72633b05df8d65035a0b31718b1a587f55b25953a8e7b959f6c3a963cc0abcb70a0d78a7e0792bc104c874525efdc619e823095d382a775641e3867b1b68c54 checksum: a1d3d0d63f581bd298b30ed8f6de21b73a0fe5a0c0f123b2e8ed7168bbff8f4c1a45e681de12a1966a89bb725d8eb727816be1c436e136951f31953e4a201587
languageName: node languageName: node
linkType: hard linkType: hard
@ -9377,11 +9382,11 @@ fsevents@~2.3.2:
linkType: hard linkType: hard
"std-env@npm:^2.2.1, std-env@npm:^2.3.0": "std-env@npm:^2.2.1, std-env@npm:^2.3.0":
version: 2.3.0 version: 2.3.1
resolution: "std-env@npm:2.3.0" resolution: "std-env@npm:2.3.1"
dependencies: dependencies:
ci-info: ^3.0.0 ci-info: ^3.1.1
checksum: da0b81e217d920770448e53d660b6b0800d3f6fde201812cb7f5505a6fffe578b21188301214fecc227cc2db6849eb736f6d1975e5fa7ee179e9240da81fc88b checksum: 049be0d6fb7ff544b3061a53ccaddd3ab2f6930f50b432f54dc82b22cb813c6e408ed69807c7c6bc592fccfc92d5c431dcc1aacd7c9ca99d304948f3149a08da
languageName: node languageName: node
linkType: hard linkType: hard
@ -9460,25 +9465,14 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"string-width@npm:^3.0.0":
version: 3.1.0
resolution: "string-width@npm:3.1.0"
dependencies:
emoji-regex: ^7.0.1
is-fullwidth-code-point: ^2.0.0
strip-ansi: ^5.1.0
checksum: 57f7ca73d201682816d573dc68bd4bb8e1dff8dc9fcf10470fdfc3474135c97175fec12ea6a159e67339b41e86963112355b64529489af6e7e70f94a7caf08b2
languageName: node
linkType: hard
"string-width@npm:^4.0.0, string-width@npm:^4.1.0, string-width@npm:^4.2.2": "string-width@npm:^4.0.0, string-width@npm:^4.1.0, string-width@npm:^4.2.2":
version: 4.2.2 version: 4.2.3
resolution: "string-width@npm:4.2.2" resolution: "string-width@npm:4.2.3"
dependencies: dependencies:
emoji-regex: ^8.0.0 emoji-regex: ^8.0.0
is-fullwidth-code-point: ^3.0.0 is-fullwidth-code-point: ^3.0.0
strip-ansi: ^6.0.0 strip-ansi: ^6.0.1
checksum: 343e089b0e66e0f72aab4ad1d9b6f2c9cc5255844b0c83fd9b53f2a3b3fd0421bdd6cb05be96a73117eb012db0887a6c1d64ca95aaa50c518e48980483fea0ab checksum: e52c10dc3fbfcd6c3a15f159f54a90024241d0f149cf8aed2982a2d801d2e64df0bf1dc351cf8e95c3319323f9f220c16e740b06faecd53e2462df1d2b5443fb
languageName: node languageName: node
linkType: hard linkType: hard
@ -9538,21 +9532,12 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"strip-ansi@npm:^5.1.0": "strip-ansi@npm:^6.0.0, strip-ansi@npm:^6.0.1":
version: 5.2.0 version: 6.0.1
resolution: "strip-ansi@npm:5.2.0" resolution: "strip-ansi@npm:6.0.1"
dependencies: dependencies:
ansi-regex: ^4.1.0 ansi-regex: ^5.0.1
checksum: bdb5f76ade97062bd88e7723aa019adbfacdcba42223b19ccb528ffb9fb0b89a5be442c663c4a3fb25268eaa3f6ea19c7c3fbae830bd1562d55adccae1fcec46 checksum: f3cd25890aef3ba6e1a74e20896c21a46f482e93df4a06567cebf2b57edabb15133f1f94e57434e0a958d61186087b1008e89c94875d019910a213181a14fc8c
languageName: node
linkType: hard
"strip-ansi@npm:^6.0.0":
version: 6.0.0
resolution: "strip-ansi@npm:6.0.0"
dependencies:
ansi-regex: ^5.0.0
checksum: 04c3239ede44c4d195b0e66c0ad58b932f08bec7d05290416d361ff908ad282ecdaf5d9731e322c84f151d427436bde01f05b7422c3ec26dd927586736b0e5d0
languageName: node languageName: node
linkType: hard linkType: hard
@ -9603,15 +9588,6 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"supports-color@npm:^6.1.0":
version: 6.1.0
resolution: "supports-color@npm:6.1.0"
dependencies:
has-flag: ^3.0.0
checksum: 74358f9535c83ee113fbaac354b11e808060f6e7d8722082ee43af3578469134e89d00026dce2a6b93ce4e5b89d0e9a10f638b2b9f64c7838c2fb2883a47b3d5
languageName: node
linkType: hard
"supports-color@npm:^7.0.0, supports-color@npm:^7.1.0": "supports-color@npm:^7.0.0, supports-color@npm:^7.1.0":
version: 7.2.0 version: 7.2.0
resolution: "supports-color@npm:7.2.0" resolution: "supports-color@npm:7.2.0"
@ -9724,15 +9700,15 @@ fsevents@~2.3.2:
linkType: hard linkType: hard
"terser@npm:^5.3.4": "terser@npm:^5.3.4":
version: 5.8.0 version: 5.9.0
resolution: "terser@npm:5.8.0" resolution: "terser@npm:5.9.0"
dependencies: dependencies:
commander: ^2.20.0 commander: ^2.20.0
source-map: ~0.7.2 source-map: ~0.7.2
source-map-support: ~0.5.20 source-map-support: ~0.5.20
bin: bin:
terser: bin/terser terser: bin/terser
checksum: 770b7d3fad7eece4a423464a9774e4456b7aca70b869d0c783bde42d7453fac2670ef7532dbce0a5a6f79038c367f2cb6353995190b730e2c52cb4914f3d671e checksum: 11c1246b1991015a8881742878af779e3863fad42f626ffda957dbf28c94bf51e7994cffb9ffbec86ff3c23ab45ffa6d79d453c15e664306e35fc7b2c4eee5f4
languageName: node languageName: node
linkType: hard linkType: hard
@ -9877,6 +9853,13 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"tr46@npm:~0.0.3":
version: 0.0.3
resolution: "tr46@npm:0.0.3"
checksum: 726321c5eaf41b5002e17ffbd1fb7245999a073e8979085dacd47c4b4e8068ff5777142fc6726d6ca1fd2ff16921b48788b87225cbc57c72636f6efa8efbffe3
languageName: node
linkType: hard
"ts-pnp@npm:^1.1.6": "ts-pnp@npm:^1.1.6":
version: 1.2.0 version: 1.2.0
resolution: "ts-pnp@npm:1.2.0" resolution: "ts-pnp@npm:1.2.0"
@ -10380,6 +10363,13 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"webidl-conversions@npm:^3.0.0":
version: 3.0.1
resolution: "webidl-conversions@npm:3.0.1"
checksum: c92a0a6ab95314bde9c32e1d0a6dfac83b578f8fa5f21e675bc2706ed6981bc26b7eb7e6a1fab158e5ce4adf9caa4a0aee49a52505d4d13c7be545f15021b17c
languageName: node
linkType: hard
"webpack-bundle-analyzer@npm:^4.4.1": "webpack-bundle-analyzer@npm:^4.4.1":
version: 4.4.2 version: 4.4.2
resolution: "webpack-bundle-analyzer@npm:4.4.2" resolution: "webpack-bundle-analyzer@npm:4.4.2"
@ -10500,6 +10490,16 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"whatwg-url@npm:^5.0.0":
version: 5.0.0
resolution: "whatwg-url@npm:5.0.0"
dependencies:
tr46: ~0.0.3
webidl-conversions: ^3.0.0
checksum: b8daed4ad3356cc4899048a15b2c143a9aed0dfae1f611ebd55073310c7b910f522ad75d727346ad64203d7e6c79ef25eafd465f4d12775ca44b90fa82ed9e2c
languageName: node
linkType: hard
"which-boxed-primitive@npm:^1.0.2": "which-boxed-primitive@npm:^1.0.2":
version: 1.0.2 version: 1.0.2
resolution: "which-boxed-primitive@npm:1.0.2" resolution: "which-boxed-primitive@npm:1.0.2"

View File

@ -28,7 +28,7 @@ export function setupTest (preset) {
this.timeout(60000) this.timeout(60000)
const nuxtCLI = isBridge const nuxtCLI = isBridge
? resolve(ctx.rootDir, 'node_modules/nuxt/bin/nuxt.js') ? resolve(ctx.rootDir, 'node_modules/nuxt/bin/nuxt.js')
: resolveWorkspace('packages/nuxi/bin/nuxi.cjs') : resolveWorkspace('packages/nuxi/bin/nuxi.mjs')
await execa('node', [nuxtCLI, 'build', ctx.rootDir], { await execa('node', [nuxtCLI, 'build', ctx.rootDir], {
env: { env: {

View File

@ -1,23 +1,23 @@
import { existsSync, readFileSync, writeFileSync, rmSync, mkdirSync } from 'fs' import { existsSync, readFileSync, writeFileSync, rmSync, mkdirSync } from 'fs'
import { execSync } from 'child_process' import { execSync } from 'child_process'
import { resolve, dirname } from 'pathe' import { resolve, dirname } from 'pathe'
import { fileURLToPath } from 'url'
import defu from 'defu' import defu from 'defu'
import hash from 'object-hash' import hash from 'object-hash'
import execa from 'execa' import execa from 'execa'
import { createCommonJS } from 'mlly'
const __dirname = dirname(fileURLToPath(import.meta.url)) const cjs = createCommonJS(import.meta.url)
export function resolveWorkspace (name) { export function resolveWorkspace (name) {
return resolve(__dirname, '../', name) return resolve(cjs.__dirname, '../', name)
} }
export function fixtureDir (name) { export function fixtureDir (name) {
return resolve(__dirname, 'fixtures', name) return resolve(cjs.__dirname, 'fixtures', name)
} }
export async function execNuxtCLI (args, opts) { export async function execNuxtCLI (args, opts) {
const nuxtCLI = resolveWorkspace('packages/nuxi/bin/nuxi.cjs') const nuxtCLI = resolveWorkspace('packages/nuxi/bin/nuxi.mjs')
await execa('node', [nuxtCLI, ...args], opts) await execa('node', [nuxtCLI, ...args], opts)
} }

View File

@ -1,6 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"esModuleInterop": true, "esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true, "skipLibCheck": true,
"target": "ESNext", "target": "ESNext",
"module": "ESNext", "module": "ESNext",
@ -15,8 +16,12 @@
"chai" "chai"
], ],
"paths": { "paths": {
"#app": ["./packages/nuxt3/src/app/index"], "#app": [
"#app/*": ["./packages/nuxt3/src/app/*"] "./packages/nuxt3/src/app/index"
],
"#app/*": [
"./packages/nuxt3/src/app/*"
]
} }
}, },
"exclude": [ "exclude": [

View File

@ -1448,6 +1448,7 @@ __metadata:
estree-walker: ^2.0.2 estree-walker: ^2.0.2
fs-extra: ^10.0.0 fs-extra: ^10.0.0
magic-string: ^0.25.7 magic-string: ^0.25.7
mlly: ^0.2.2
node-fetch: ^3.0.0 node-fetch: ^3.0.0
nuxi: ^0.10.0 nuxi: ^0.10.0
nuxt-swc: ^0.1.0 nuxt-swc: ^0.1.0
@ -1492,7 +1493,7 @@ __metadata:
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@nuxt/kit@workspace:packages/kit" resolution: "@nuxt/kit@workspace:packages/kit"
dependencies: dependencies:
"@types/lodash": ^4.14.175 "@types/lodash.template": ^4
consola: ^2.15.3 consola: ^2.15.3
create-require: ^1.1.1 create-require: ^1.1.1
defu: ^5.0.0 defu: ^5.0.0
@ -1501,7 +1502,7 @@ __metadata:
hash-sum: ^2.0.0 hash-sum: ^2.0.0
hookable: ^5.0.0 hookable: ^5.0.0
jiti: ^1.12.6 jiti: ^1.12.6
lodash: ^4.17.21 lodash.template: ^4.5.0
pathe: ^0.2.0 pathe: ^0.2.0
rc9: ^1.2.0 rc9: ^1.2.0
scule: ^0.2.1 scule: ^0.2.1
@ -1559,6 +1560,7 @@ __metadata:
jiti: ^1.12.6 jiti: ^1.12.6
listhen: ^0.2.4 listhen: ^0.2.4
mime: ^2.5.2 mime: ^2.5.2
mlly: ^0.2.2
node-fetch: ^3.0.0 node-fetch: ^3.0.0
ohmyfetch: ^0.3.1 ohmyfetch: ^0.3.1
ora: ^6.0.1 ora: ^6.0.1
@ -1575,7 +1577,6 @@ __metadata:
unbuild: latest unbuild: latest
unenv: ^0.3.10 unenv: ^0.3.10
unstorage: ^0.2.8 unstorage: ^0.2.8
upath: ^2.0.1
vue: 3.2.19 vue: 3.2.19
vue-bundle-renderer: ^0.3.1 vue-bundle-renderer: ^0.3.1
vue-server-renderer: ^2.6.14 vue-server-renderer: ^2.6.14
@ -1643,9 +1644,10 @@ __metadata:
fs-extra: ^10.0.0 fs-extra: ^10.0.0
glob: ^7.2.0 glob: ^7.2.0
hash-sum: ^2.0.0 hash-sum: ^2.0.0
lodash: ^4.17.21 lodash-es: ^4.17.21
memfs: ^3.3.0 memfs: ^3.3.0
mini-css-extract-plugin: ^2.3.0 mini-css-extract-plugin: ^2.3.0
mlly: ^0.2.2
pathe: ^0.2.0 pathe: ^0.2.0
pify: ^5.0.0 pify: ^5.0.0
postcss: ^8.3.8 postcss: ^8.3.8
@ -2281,7 +2283,16 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/lodash@npm:^4.14.175": "@types/lodash.template@npm:^4":
version: 4.5.0
resolution: "@types/lodash.template@npm:4.5.0"
dependencies:
"@types/lodash": "*"
checksum: 7650ecfad4ee1d51404913891f74f48c7837ba9b66fd4681624c943fa8df85231e5efb5339927f6542e9ef4bedb6aaac99f6e878118f2bdb04198bc86013209a
languageName: node
linkType: hard
"@types/lodash@npm:*":
version: 4.14.175 version: 4.14.175
resolution: "@types/lodash@npm:4.14.175" resolution: "@types/lodash@npm:4.14.175"
checksum: 50721f33faa542f1b9f62f2ba769ed353c6036711e92bd89ce569f2ed247e38fb2a2899f6fd46466b1690fea7ae0239471e6a6093c54e8f2b0613e43e8eac19c checksum: 50721f33faa542f1b9f62f2ba769ed353c6036711e92bd89ce569f2ed247e38fb2a2899f6fd46466b1690fea7ae0239471e6a6093c54e8f2b0613e43e8eac19c
@ -8827,6 +8838,13 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"lodash-es@npm:^4.17.21":
version: 4.17.21
resolution: "lodash-es@npm:4.17.21"
checksum: 05cbffad6e2adbb331a4e16fbd826e7faee403a1a04873b82b42c0f22090f280839f85b95393f487c1303c8a3d2a010048bf06151a6cbe03eee4d388fb0a12d2
languageName: node
linkType: hard
"lodash._reinterpolate@npm:^3.0.0": "lodash._reinterpolate@npm:^3.0.0":
version: 3.0.0 version: 3.0.0
resolution: "lodash._reinterpolate@npm:3.0.0" resolution: "lodash._reinterpolate@npm:3.0.0"
@ -9460,7 +9478,7 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"mlly@npm:^0.2.4": "mlly@npm:^0.2.2, mlly@npm:^0.2.4":
version: 0.2.4 version: 0.2.4
resolution: "mlly@npm:0.2.4" resolution: "mlly@npm:0.2.4"
dependencies: dependencies:
@ -10050,6 +10068,7 @@ fsevents@~2.3.2:
fsevents: ~2.3.2 fsevents: ~2.3.2
jiti: ^1.12.6 jiti: ^1.12.6
listhen: ^0.2.4 listhen: ^0.2.4
mlly: ^0.2.2
mri: ^1.2.0 mri: ^1.2.0
pathe: ^0.2.0 pathe: ^0.2.0
scule: ^0.2.1 scule: ^0.2.1
@ -10059,8 +10078,8 @@ fsevents@~2.3.2:
fsevents: fsevents:
optional: true optional: true
bin: bin:
nu: ./bin/nuxi.cjs nu: ./bin/nuxi.mjs
nuxi: ./bin/nuxi.cjs nuxi: ./bin/nuxi.mjs
languageName: unknown languageName: unknown
linkType: soft linkType: soft
@ -10153,6 +10172,7 @@ fsevents@~2.3.2:
hash-sum: ^2.0.0 hash-sum: ^2.0.0
hookable: ^5.0.0 hookable: ^5.0.0
ignore: ^5.1.8 ignore: ^5.1.8
mlly: ^0.2.2
nuxi: ^0.10.0 nuxi: ^0.10.0
ohmyfetch: ^0.3.1 ohmyfetch: ^0.3.1
pathe: ^0.2.0 pathe: ^0.2.0
@ -10169,7 +10189,7 @@ fsevents@~2.3.2:
"@vue/shared": 3.2.19 "@vue/shared": 3.2.19
vue: 3.2.19 vue: 3.2.19
bin: bin:
nuxt: ./bin/nuxt.cjs nuxt: ./bin/nuxt.mjs
languageName: unknown languageName: unknown
linkType: soft linkType: soft