chore(deps): update jiti (#29280)

This commit is contained in:
Pooya Parsa 2024-10-05 20:41:35 +02:00 committed by GitHub
parent 61985f4800
commit fd5a0a1ff8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 397 additions and 218 deletions

View File

@ -43,9 +43,9 @@
"@vue/compiler-core": "3.5.11", "@vue/compiler-core": "3.5.11",
"@vue/compiler-dom": "3.5.11", "@vue/compiler-dom": "3.5.11",
"@vue/shared": "3.5.11", "@vue/shared": "3.5.11",
"c12": "2.0.0", "c12": "2.0.1",
"h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e", "h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e",
"jiti": "2.1.2", "jiti": "2.3.1",
"magic-string": "^0.30.11", "magic-string": "^0.30.11",
"nitro": "npm:nitro-nightly@3.0.0-beta-28665895.e727afda", "nitro": "npm:nitro-nightly@3.0.0-beta-28665895.e727afda",
"nuxt": "workspace:*", "nuxt": "workspace:*",
@ -55,7 +55,7 @@
"send": ">=0.19.0", "send": ">=0.19.0",
"typescript": "5.6.2", "typescript": "5.6.2",
"ufo": "1.5.4", "ufo": "1.5.4",
"unbuild": "3.0.0-rc.8", "unbuild": "3.0.0-rc.11",
"vite": "5.4.8", "vite": "5.4.8",
"vue": "3.5.11" "vue": "3.5.11"
}, },
@ -87,7 +87,7 @@
"eslint-typegen": "0.3.2", "eslint-typegen": "0.3.2",
"h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e", "h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e",
"happy-dom": "15.7.4", "happy-dom": "15.7.4",
"jiti": "2.1.2", "jiti": "2.3.1",
"markdownlint-cli": "0.42.0", "markdownlint-cli": "0.42.0",
"nitro": "npm:nitro-nightly@3.0.0-beta-28665895.e727afda", "nitro": "npm:nitro-nightly@3.0.0-beta-28665895.e727afda",
"nuxi": "3.14.0", "nuxi": "3.14.0",

View File

@ -27,7 +27,7 @@
}, },
"dependencies": { "dependencies": {
"@nuxt/schema": "workspace:*", "@nuxt/schema": "workspace:*",
"c12": "^2.0.0", "c12": "^2.0.1",
"consola": "^3.2.3", "consola": "^3.2.3",
"defu": "^6.1.4", "defu": "^6.1.4",
"destr": "^2.0.3", "destr": "^2.0.3",
@ -35,7 +35,7 @@
"globby": "^14.0.2", "globby": "^14.0.2",
"hash-sum": "^2.0.0", "hash-sum": "^2.0.0",
"ignore": "^6.0.2", "ignore": "^6.0.2",
"jiti": "^2.1.2", "jiti": "^2.3.1",
"klona": "^2.0.6", "klona": "^2.0.6",
"mlly": "^1.7.1", "mlly": "^1.7.1",
"pathe": "^1.1.2", "pathe": "^1.1.2",
@ -45,13 +45,13 @@
"ufo": "^1.5.4", "ufo": "^1.5.4",
"unctx": "^2.3.1", "unctx": "^2.3.1",
"unimport": "^3.13.1", "unimport": "^3.13.1",
"untyped": "^1.5.0" "untyped": "^1.5.1"
}, },
"devDependencies": { "devDependencies": {
"@types/hash-sum": "1.0.2", "@types/hash-sum": "1.0.2",
"@types/semver": "7.5.8", "@types/semver": "7.5.8",
"nitro": "npm:nitro-nightly@3.0.0-beta-28665895.e727afda", "nitro": "npm:nitro-nightly@3.0.0-beta-28665895.e727afda",
"unbuild": "3.0.0-rc.8", "unbuild": "3.0.0-rc.11",
"vite": "5.4.8", "vite": "5.4.8",
"vitest": "2.1.2", "vitest": "2.1.2",
"webpack": "5.95.0" "webpack": "5.95.0"

View File

@ -72,10 +72,7 @@ export const normalizeModuleTranspilePath = (p: string) => {
export async function loadNuxtModuleInstance (nuxtModule: string | NuxtModule, nuxt: Nuxt = useNuxt()) { export async function loadNuxtModuleInstance (nuxtModule: string | NuxtModule, nuxt: Nuxt = useNuxt()) {
let buildTimeModuleMeta: ModuleMeta = {} let buildTimeModuleMeta: ModuleMeta = {}
const jiti = createJiti(nuxt.options.rootDir, { const jiti = createJiti(nuxt.options.rootDir, { alias: nuxt.options.alias })
interopDefault: true,
alias: nuxt.options.alias,
})
// Import if input is string // Import if input is string
if (typeof nuxtModule === 'string') { if (typeof nuxtModule === 'string') {
@ -85,7 +82,7 @@ export async function loadNuxtModuleInstance (nuxtModule: string | NuxtModule, n
for (const path of paths) { for (const path of paths) {
try { try {
const src = jiti.esmResolve(path, { parentURL: parentURL.replace(/\/node_modules\/?$/, '') }) const src = jiti.esmResolve(path, { parentURL: parentURL.replace(/\/node_modules\/?$/, '') })
nuxtModule = await jiti.import(src) as NuxtModule nuxtModule = await jiti.import(src, { default: true }) as NuxtModule
// nuxt-module-builder generates a module.json with metadata including the version // nuxt-module-builder generates a module.json with metadata including the version
const moduleMetadataPath = join(dirname(src), 'module.json') const moduleMetadataPath = join(dirname(src), 'module.json')

View File

@ -71,7 +71,7 @@
"@unhead/vue": "^1.11.7", "@unhead/vue": "^1.11.7",
"@vue/shared": "^3.5.11", "@vue/shared": "^3.5.11",
"acorn": "8.12.1", "acorn": "8.12.1",
"c12": "^2.0.0", "c12": "^2.0.1",
"chokidar": "^3.6.0", "chokidar": "^3.6.0",
"compatx": "^0.1.8", "compatx": "^0.1.8",
"consola": "^3.2.3", "consola": "^3.2.3",
@ -88,7 +88,7 @@
"hookable": "^5.5.3", "hookable": "^5.5.3",
"ignore": "^6.0.2", "ignore": "^6.0.2",
"impound": "^0.1.0", "impound": "^0.1.0",
"jiti": "^2.1.2", "jiti": "^2.3.1",
"klona": "^2.0.6", "klona": "^2.0.6",
"knitwork": "^1.1.0", "knitwork": "^1.1.0",
"magic-string": "^0.30.11", "magic-string": "^0.30.11",
@ -118,7 +118,7 @@
"unplugin": "^1.14.1", "unplugin": "^1.14.1",
"unplugin-vue-router": "^0.10.8", "unplugin-vue-router": "^0.10.8",
"unstorage": "^1.12.0", "unstorage": "^1.12.0",
"untyped": "^1.5.0", "untyped": "^1.5.1",
"vue": "^3.5.11", "vue": "^3.5.11",
"vue-bundle-renderer": "^2.1.1", "vue-bundle-renderer": "^2.1.1",
"vue-devtools-stub": "^0.1.0", "vue-devtools-stub": "^0.1.0",
@ -131,7 +131,7 @@
"@types/estree": "1.0.6", "@types/estree": "1.0.6",
"@vitejs/plugin-vue": "5.1.4", "@vitejs/plugin-vue": "5.1.4",
"@vue/compiler-sfc": "3.5.11", "@vue/compiler-sfc": "3.5.11",
"unbuild": "3.0.0-rc.8", "unbuild": "3.0.0-rc.11",
"vite": "5.4.8", "vite": "5.4.8",
"vitest": "2.1.2" "vitest": "2.1.2"
}, },

View File

@ -23,7 +23,6 @@ export default defineNuxtModule({
// Initialize untyped/jiti loader // Initialize untyped/jiti loader
const _resolveSchema = createJiti(fileURLToPath(import.meta.url), { const _resolveSchema = createJiti(fileURLToPath(import.meta.url), {
interopDefault: true,
cache: false, cache: false,
transformOptions: { transformOptions: {
babel: { babel: {
@ -97,7 +96,7 @@ export default defineNuxtModule({
let loadedConfig: SchemaDefinition let loadedConfig: SchemaDefinition
try { try {
// TODO: fix type for second argument of `import` // TODO: fix type for second argument of `import`
loadedConfig = await _resolveSchema.import(filePath, {}) as SchemaDefinition loadedConfig = await _resolveSchema.import(filePath, { default: true }) as SchemaDefinition
} catch (err) { } catch (err) {
logger.warn( logger.warn(
'Unable to load schema from', 'Unable to load schema from',

View File

@ -45,13 +45,13 @@
"@vue/compiler-core": "3.5.11", "@vue/compiler-core": "3.5.11",
"@vue/compiler-sfc": "3.5.11", "@vue/compiler-sfc": "3.5.11",
"@vue/language-core": "2.1.6", "@vue/language-core": "2.1.6",
"c12": "2.0.0", "c12": "2.0.1",
"esbuild-loader": "4.2.2", "esbuild-loader": "4.2.2",
"h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e", "h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e",
"ignore": "6.0.2", "ignore": "6.0.2",
"nitro": "npm:nitro-nightly@3.0.0-beta-28665895.e727afda", "nitro": "npm:nitro-nightly@3.0.0-beta-28665895.e727afda",
"ofetch": "1.4.0", "ofetch": "1.4.0",
"unbuild": "3.0.0-rc.8", "unbuild": "3.0.0-rc.11",
"unctx": "2.3.1", "unctx": "2.3.1",
"unenv": "1.10.0", "unenv": "1.10.0",
"vite": "5.4.8", "vite": "5.4.8",
@ -74,7 +74,7 @@
"ufo": "^1.5.4", "ufo": "^1.5.4",
"uncrypto": "^0.1.3", "uncrypto": "^0.1.3",
"unimport": "^3.13.1", "unimport": "^3.13.1",
"untyped": "^1.5.0" "untyped": "^1.5.1"
}, },
"engines": { "engines": {
"node": "^14.18.0 || >=16.10.0" "node": "^14.18.0 || >=16.10.0"

View File

@ -28,7 +28,7 @@
"@types/clear": "0.1.4", "@types/clear": "0.1.4",
"@types/estree": "1.0.6", "@types/estree": "1.0.6",
"rollup": "4.24.0", "rollup": "4.24.0",
"unbuild": "3.0.0-rc.8", "unbuild": "3.0.0-rc.11",
"vue": "3.5.11" "vue": "3.5.11"
}, },
"dependencies": { "dependencies": {
@ -47,7 +47,7 @@
"externality": "^1.0.2", "externality": "^1.0.2",
"get-port-please": "^3.1.2", "get-port-please": "^3.1.2",
"h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e", "h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e",
"jiti": "^2.1.2", "jiti": "^2.3.1",
"knitwork": "^1.1.0", "knitwork": "^1.1.0",
"magic-string": "^0.30.11", "magic-string": "^0.30.11",
"mlly": "^1.7.1", "mlly": "^1.7.1",

View File

@ -18,10 +18,7 @@ export async function resolveCSSOptions (nuxt: Nuxt): Promise<ViteConfig['css']>
css.postcss.plugins = [] css.postcss.plugins = []
const postcssOptions = nuxt.options.postcss const postcssOptions = nuxt.options.postcss
const jiti = createJiti(nuxt.options.rootDir, { const jiti = createJiti(nuxt.options.rootDir, { alias: nuxt.options.alias })
interopDefault: true,
alias: nuxt.options.alias,
})
for (const pluginName of sortPlugins(postcssOptions)) { for (const pluginName of sortPlugins(postcssOptions)) {
const pluginOptions = postcssOptions.plugins[pluginName] const pluginOptions = postcssOptions.plugins[pluginName]
@ -29,7 +26,7 @@ export async function resolveCSSOptions (nuxt: Nuxt): Promise<ViteConfig['css']>
let pluginFn: ((opts: Record<string, any>) => Plugin) | undefined let pluginFn: ((opts: Record<string, any>) => Plugin) | undefined
for (const parentURL of nuxt.options.modulesDir) { for (const parentURL of nuxt.options.modulesDir) {
pluginFn = await jiti.import(pluginName, { parentURL: parentURL.replace(/\/node_modules\/?$/, ''), try: true }) as (opts: Record<string, any>) => Plugin pluginFn = await jiti.import(pluginName, { parentURL: parentURL.replace(/\/node_modules\/?$/, ''), try: true, default: true }) as (opts: Record<string, any>) => Plugin
if (typeof pluginFn === 'function') { if (typeof pluginFn === 'function') {
css.postcss.plugins.push(pluginFn(pluginOptions)) css.postcss.plugins.push(pluginFn(pluginOptions))
break break

View File

@ -40,7 +40,7 @@
"globby": "^14.0.2", "globby": "^14.0.2",
"h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e", "h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e",
"hash-sum": "^2.0.0", "hash-sum": "^2.0.0",
"jiti": "^2.1.2", "jiti": "^2.3.1",
"knitwork": "^1.1.0", "knitwork": "^1.1.0",
"lodash-es": "4.17.21", "lodash-es": "4.17.21",
"magic-string": "^0.30.11", "magic-string": "^0.30.11",
@ -79,7 +79,7 @@
"@types/webpack-bundle-analyzer": "4.7.0", "@types/webpack-bundle-analyzer": "4.7.0",
"@types/webpack-hot-middleware": "2.25.9", "@types/webpack-hot-middleware": "2.25.9",
"rollup": "4.24.0", "rollup": "4.24.0",
"unbuild": "3.0.0-rc.8", "unbuild": "3.0.0-rc.11",
"vue": "3.5.11" "vue": "3.5.11"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -36,10 +36,7 @@ export async function getPostcssConfig (nuxt: Nuxt) {
sourceMap: nuxt.options.webpack.cssSourceMap, sourceMap: nuxt.options.webpack.cssSourceMap,
}) })
const jiti = createJiti(nuxt.options.rootDir, { const jiti = createJiti(nuxt.options.rootDir, { alias: nuxt.options.alias })
interopDefault: true,
alias: nuxt.options.alias,
})
// Keep the order of default plugins // Keep the order of default plugins
if (!Array.isArray(postcssOptions.plugins) && isPureObject(postcssOptions.plugins)) { if (!Array.isArray(postcssOptions.plugins) && isPureObject(postcssOptions.plugins)) {
@ -51,7 +48,7 @@ export async function getPostcssConfig (nuxt: Nuxt) {
let pluginFn: ((opts: Record<string, any>) => Plugin) | undefined let pluginFn: ((opts: Record<string, any>) => Plugin) | undefined
for (const parentURL of nuxt.options.modulesDir) { for (const parentURL of nuxt.options.modulesDir) {
pluginFn = await jiti.import(pluginName, { parentURL: parentURL.replace(/\/node_modules\/?$/, ''), try: true }) as (opts: Record<string, any>) => Plugin pluginFn = await jiti.import(pluginName, { parentURL: parentURL.replace(/\/node_modules\/?$/, ''), try: true, default: true }) as (opts: Record<string, any>) => Plugin
if (typeof pluginFn === 'function') { if (typeof pluginFn === 'function') {
plugins.push(pluginFn(pluginOptions)) plugins.push(pluginFn(pluginOptions))
break break

File diff suppressed because it is too large Load Diff