@nuxt/kit 3.0.0-rc.12 → 3.0.0-rc.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +32 -38
  2. package/dist/index.mjs +287 -395
  3. package/package.json +13 -13
package/dist/index.d.ts CHANGED
@@ -1,16 +1,13 @@
1
- import { Nuxt, ModuleContainer, ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, NuxtOptions, ImportPresetWithDeprecation, NuxtCompatibility, NuxtCompatibilityIssues, ComponentsDir, Component, NuxtTemplate, NuxtHooks, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate } from '@nuxt/schema';
1
+ import { ModuleOptions, ModuleDefinition, NuxtModule, Nuxt, NuxtConfig, NuxtOptions, ImportPresetWithDeprecation, NuxtCompatibility, NuxtCompatibilityIssues, ComponentsDir, Component, NuxtTemplate, NuxtHooks, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate } from '@nuxt/schema';
2
2
  import { LoadConfigOptions } from 'c12';
3
3
  import { Import } from 'unimport';
4
4
  import { Configuration, WebpackPluginInstance } from 'webpack';
5
5
  import { UserConfig, Plugin } from 'vite';
6
6
  import * as unctx_index from 'unctx/index';
7
- import { NodeMiddleware } from 'h3';
8
7
  import { NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack';
9
8
  import * as consola from 'consola';
10
9
  import { genSafeVariableName } from 'knitwork';
11
10
 
12
- declare function useModuleContainer(nuxt?: Nuxt): ModuleContainer;
13
-
14
11
  /**
15
12
  * Define a Nuxt module, automatically merging defaults with user provided options, installing
16
13
  * any hooks that are provided, and calling an optional setup function for full control.
@@ -38,15 +35,7 @@ declare function loadNuxt(opts: LoadNuxtOptions): Promise<Nuxt>;
38
35
  declare function buildNuxt(nuxt: Nuxt): Promise<any>;
39
36
 
40
37
  declare function addImports(imports: Import | Import[]): void;
41
- /**
42
- * @deprecated Please use `addImports` instead with nuxt>=3.0.0-rc.9
43
- */
44
- declare const addAutoImport: typeof addImports;
45
38
  declare function addImportsDir(dirs: string | string[]): void;
46
- /**
47
- * @deprecated Please use `addImportsDir` instead with nuxt>=3.0.0-rc.9
48
- */
49
- declare const addAutoImportDir: typeof addImportsDir;
50
39
  declare function addImportsSources(presets: ImportPresetWithDeprecation | ImportPresetWithDeprecation[]): void;
51
40
 
52
41
  interface ExtendConfigOptions {
@@ -76,13 +65,6 @@ interface ExtendConfigOptions {
76
65
  client?: boolean;
77
66
  }
78
67
  interface ExtendWebpackConfigOptions extends ExtendConfigOptions {
79
- /**
80
- * Install plugin on modern build
81
- *
82
- * @default true
83
- * @deprecated Nuxt 2 only
84
- */
85
- modern?: boolean;
86
68
  }
87
69
  interface ExtendViteConfigOptions extends ExtendConfigOptions {
88
70
  }
@@ -137,7 +119,7 @@ declare function getNuxtVersion(nuxt?: Nuxt | any): any;
137
119
  * Requires Nuxt 2.13+
138
120
  */
139
121
  declare function addComponentsDir(dir: ComponentsDir): Promise<void>;
140
- declare type AddComponentOptions = {
122
+ type AddComponentOptions = {
141
123
  name: string;
142
124
  filePath: string;
143
125
  } & Partial<Exclude<Component, 'shortPath' | 'async' | 'level' | 'import' | 'asyncImport'>>;
@@ -248,18 +230,6 @@ declare function resolveFiles(path: string, pattern: string | string[], opts?: {
248
230
  followSymbolicLinks?: boolean;
249
231
  }): Promise<string[]>;
250
232
 
251
- interface LegacyServerMiddleware {
252
- route?: string;
253
- path?: string;
254
- handle?: NodeMiddleware | string;
255
- handler: NodeMiddleware | string;
256
- }
257
- /**
258
- * Adds a new server middleware to the end of the server middleware array.
259
- *
260
- * @deprecated Use addServerHandler instead
261
- */
262
- declare function addServerMiddleware(middleware: LegacyServerMiddleware): void;
263
233
  /**
264
234
  * Adds a nitro server handler
265
235
  *
@@ -270,6 +240,14 @@ declare function addServerHandler(handler: NitroEventHandler): void;
270
240
  *
271
241
  */
272
242
  declare function addDevServerHandler(handler: NitroDevEventHandler): void;
243
+ /**
244
+ * Adds a Nitro plugin
245
+ */
246
+ declare function addServerPlugin(plugin: string): void;
247
+ /**
248
+ * Adds routes to be prerendered
249
+ */
250
+ declare function addPrerenderRoutes(routes: string | string[]): void;
273
251
  /**
274
252
  * Access to the Nitro instance
275
253
  *
@@ -295,37 +273,53 @@ declare function addTemplate(_template: NuxtTemplate<any> | string): ResolvedNux
295
273
  * Normalize a nuxt template object
296
274
  */
297
275
  declare function normalizeTemplate(template: NuxtTemplate<any> | string): ResolvedNuxtTemplate<any>;
276
+ /**
277
+ * Trigger rebuilding Nuxt templates
278
+ *
279
+ * You can pass a filter within the options to selectively regenerate a subset of templates.
280
+ */
281
+ declare function updateTemplates(options?: {
282
+ filter?: (template: ResolvedNuxtTemplate<any>) => boolean;
283
+ }): Promise<any>;
298
284
 
299
285
  declare const logger: consola.Consola;
300
286
  declare function useLogger(scope?: string): consola.Consola;
301
287
 
288
+ /** @deprecated Do not use CJS utils */
302
289
  interface ResolveModuleOptions {
303
290
  paths?: string | string[];
304
291
  }
292
+ /** @deprecated Do not use CJS utils */
305
293
  interface RequireModuleOptions extends ResolveModuleOptions {
306
294
  /** Clear the require cache (force fresh require) but only if not within `node_modules` */
307
295
  clearCache?: boolean;
308
296
  /** Automatically de-default the result of requiring the module. */
309
297
  interopDefault?: boolean;
310
298
  }
299
+ /** @deprecated Do not use CJS utils */
311
300
  declare function isNodeModules(id: string): boolean;
301
+ /** @deprecated Do not use CJS utils */
312
302
  declare function clearRequireCache(id: string): void;
303
+ /** @deprecated Do not use CJS utils */
313
304
  declare function scanRequireTree(id: string, files?: Set<string>): Set<string>;
314
- /** Access the require cache by module id. */
305
+ /** @deprecated Do not use CJS utils */
315
306
  declare function getRequireCacheItem(id: string): NodeModule | undefined;
316
307
  /** Resolve the `package.json` file for a given module. */
317
308
  declare function requireModulePkg(id: string, opts?: RequireModuleOptions): any;
318
- /** Resolve the path of a module. */
309
+ /** @deprecated Do not use CJS utils */
319
310
  declare function resolveModule(id: string, opts?: ResolveModuleOptions): string;
320
- /** Try to resolve the path of a module, but don't emit an error if it can't be found. */
311
+ /** @deprecated Do not use CJS utils */
321
312
  declare function tryResolveModule(path: string, opts?: ResolveModuleOptions): string | null;
322
- /** Require a module and return it. */
313
+ /** @deprecated Do not use CJS utils */
323
314
  declare function requireModule(id: string, opts?: RequireModuleOptions): any;
315
+ /** @deprecated Do not use CJS utils */
324
316
  declare function importModule(id: string, opts?: RequireModuleOptions): Promise<any>;
317
+ /** @deprecated Do not use CJS utils */
325
318
  declare function tryImportModule(id: string, opts?: RequireModuleOptions): Promise<any> | undefined;
326
- /** Try to require a module, but don't emit an error if the module can't be required. */
319
+ /** @deprecated Do not use CJS utils */
327
320
  declare function tryRequireModule(id: string, opts?: RequireModuleOptions): any;
328
321
 
322
+ /** @deprecated */
329
323
  declare function compileTemplate(template: NuxtTemplate, ctx: any): Promise<string>;
330
324
  /** @deprecated */
331
325
  declare const templateUtils: {
@@ -336,4 +330,4 @@ declare const templateUtils: {
336
330
  }) => string;
337
331
  };
338
332
 
339
- export { AddComponentOptions, AddPluginOptions, ExtendConfigOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, LegacyServerMiddleware, LoadNuxtConfigOptions, LoadNuxtOptions, RequireModuleOptions, ResolveModuleOptions, ResolvePathOptions, Resolver, addAutoImport, addAutoImportDir, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addServerHandler, addServerMiddleware, addTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, clearRequireCache, compileTemplate, createResolver, defineNuxtModule, extendPages, extendViteConfig, extendWebpackConfig, findPath, getNuxtVersion, getRequireCacheItem, hasNuxtCompatibility, importModule, installModule, isIgnored, isNodeModules, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, logger, normalizePlugin, normalizeTemplate, nuxtCtx, requireModule, requireModulePkg, resolveAlias, resolveFiles, resolveModule, resolvePath, scanRequireTree, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, useLogger, useModuleContainer, useNitro, useNuxt };
333
+ export { AddComponentOptions, AddPluginOptions, ExtendConfigOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, LoadNuxtConfigOptions, LoadNuxtOptions, RequireModuleOptions, ResolveModuleOptions, ResolvePathOptions, Resolver, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addServerHandler, addServerPlugin, addTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, clearRequireCache, compileTemplate, createResolver, defineNuxtModule, extendPages, extendViteConfig, extendWebpackConfig, findPath, getNuxtVersion, getRequireCacheItem, hasNuxtCompatibility, importModule, installModule, isIgnored, isNodeModules, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, logger, normalizePlugin, normalizeTemplate, nuxtCtx, requireModule, requireModulePkg, resolveAlias, resolveFiles, resolveModule, resolvePath, scanRequireTree, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateTemplates, useLogger, useNitro, useNuxt };
package/dist/index.mjs CHANGED
@@ -1,46 +1,27 @@
1
- import { parse, basename, resolve, relative, join, normalize, isAbsolute, dirname } from 'pathe';
2
- import { existsSync, readFileSync, promises } from 'node:fs';
3
- import hash from 'hash-sum';
1
+ import { promises, existsSync, readFileSync } from 'node:fs';
2
+ import defu from 'defu';
3
+ import { applyDefaults } from 'untyped';
4
+ import { dirname, join, normalize, relative, isAbsolute, resolve, basename, parse } from 'pathe';
5
+ import consola from 'consola';
4
6
  import { getContext } from 'unctx';
5
- import { kebabCase, pascalCase } from 'scule';
6
7
  import satisfies from 'semver/functions/satisfies.js';
7
- import consola from 'consola';
8
+ import lodashTemplate from 'lodash.template';
9
+ import { genSafeVariableName, genDynamicImport, genImport } from 'knitwork';
8
10
  import { pathToFileURL, fileURLToPath } from 'node:url';
9
- import { globby } from 'globby';
10
- import { normalizeAliases } from 'pathe/utils';
11
11
  import { interopDefault } from 'mlly';
12
12
  import jiti from 'jiti';
13
+ import { globby } from 'globby';
14
+ import { resolveAlias as resolveAlias$1 } from 'pathe/utils';
13
15
  import ignore from 'ignore';
14
- import defu from 'defu';
15
- import { applyDefaults } from 'untyped';
16
- import lodashTemplate from 'lodash.template';
17
- import { genSafeVariableName, genDynamicImport, genImport } from 'knitwork';
18
16
  import { loadConfig } from 'c12';
19
17
  import { NuxtConfigSchema } from '@nuxt/schema';
20
18
  import { resolvePackageJSON, readPackageJSON } from 'pkg-types';
19
+ import { kebabCase, pascalCase } from 'scule';
20
+ import hash from 'hash-sum';
21
21
 
22
- function chainFn(base, fn) {
23
- if (typeof fn !== "function") {
24
- return base;
25
- }
26
- return function(...args) {
27
- if (typeof base !== "function") {
28
- return fn.apply(this, args);
29
- }
30
- let baseResult = base.apply(this, args);
31
- if (baseResult === void 0) {
32
- [baseResult] = args;
33
- }
34
- const fnResult = fn.call(
35
- this,
36
- baseResult,
37
- ...Array.prototype.slice.call(args, 1)
38
- );
39
- if (fnResult === void 0) {
40
- return baseResult;
41
- }
42
- return fnResult;
43
- };
22
+ const logger = consola;
23
+ function useLogger(scope) {
24
+ return scope ? logger.withScope(scope) : logger;
44
25
  }
45
26
 
46
27
  const nuxtCtx = getContext("nuxt");
@@ -55,47 +36,6 @@ function tryUseNuxt() {
55
36
  return nuxtCtx.tryUse();
56
37
  }
57
38
 
58
- function addTemplate(_template) {
59
- const nuxt = useNuxt();
60
- const template = normalizeTemplate(_template);
61
- nuxt.options.build.templates = nuxt.options.build.templates.filter((p) => normalizeTemplate(p).filename !== template.filename);
62
- nuxt.options.build.templates.push(template);
63
- return template;
64
- }
65
- function normalizeTemplate(template) {
66
- if (!template) {
67
- throw new Error("Invalid template: " + JSON.stringify(template));
68
- }
69
- if (typeof template === "string") {
70
- template = { src: template };
71
- } else {
72
- template = { ...template };
73
- }
74
- if (template.src) {
75
- if (!existsSync(template.src)) {
76
- throw new Error("Template not found: " + template.src);
77
- }
78
- if (!template.filename) {
79
- const srcPath = parse(template.src);
80
- template.filename = template.fileName || `${basename(srcPath.dir)}.${srcPath.name}.${hash(template.src)}${srcPath.ext}`;
81
- }
82
- }
83
- if (!template.src && !template.getContents) {
84
- throw new Error("Invalid template. Either getContents or src options should be provided: " + JSON.stringify(template));
85
- }
86
- if (!template.filename) {
87
- throw new Error("Invalid template. Either filename should be provided: " + JSON.stringify(template));
88
- }
89
- if (template.filename.endsWith(".d.ts")) {
90
- template.write = true;
91
- }
92
- if (!template.dst) {
93
- const nuxt = useNuxt();
94
- template.dst = resolve(nuxt.options.buildDir, template.filename);
95
- }
96
- return template;
97
- }
98
-
99
39
  async function checkNuxtCompatibility(constraints, nuxt = useNuxt()) {
100
40
  const issues = [];
101
41
  if (constraints.nuxt) {
@@ -152,66 +92,125 @@ function getNuxtVersion(nuxt = useNuxt()) {
152
92
  return version;
153
93
  }
154
94
 
155
- const logger = consola;
156
- function useLogger(scope) {
157
- return scope ? logger.withScope(scope) : logger;
95
+ async function compileTemplate(template, ctx) {
96
+ const data = { ...ctx, options: template.options };
97
+ if (template.src) {
98
+ try {
99
+ const srcContents = await promises.readFile(template.src, "utf-8");
100
+ return lodashTemplate(srcContents, {})(data);
101
+ } catch (err) {
102
+ console.error("Error compiling template: ", template);
103
+ throw err;
104
+ }
105
+ }
106
+ if (template.getContents) {
107
+ return template.getContents(data);
108
+ }
109
+ throw new Error("Invalid template: " + JSON.stringify(template));
158
110
  }
111
+ const serialize = (data) => JSON.stringify(data, null, 2).replace(/"{(.+)}"(?=,?$)/gm, (r) => JSON.parse(r).replace(/^{(.*)}$/, "$1"));
112
+ const importSources = (sources, { lazy = false } = {}) => {
113
+ if (!Array.isArray(sources)) {
114
+ sources = [sources];
115
+ }
116
+ return sources.map((src) => {
117
+ if (lazy) {
118
+ return `const ${genSafeVariableName(src)} = ${genDynamicImport(src, { comment: `webpackChunkName: ${JSON.stringify(src)}` })}`;
119
+ }
120
+ return genImport(src, genSafeVariableName(src));
121
+ }).join("\n");
122
+ };
123
+ const importName = genSafeVariableName;
124
+ const templateUtils = { serialize, importName, importSources };
159
125
 
160
- function addLayout(template, name) {
161
- const nuxt = useNuxt();
162
- const { filename, src } = addTemplate(template);
163
- const layoutName = kebabCase(name || parse(filename).name).replace(/["']/g, "");
164
- if (isNuxt2(nuxt)) {
165
- const layout = nuxt.options.layouts[layoutName];
166
- if (layout) {
167
- return logger.warn(
168
- `Not overriding \`${layoutName}\` (provided by \`${layout}\`) with \`${src || filename}\`.`
169
- );
126
+ function defineNuxtModule(definition) {
127
+ if (!definition.meta) {
128
+ definition.meta = {};
129
+ }
130
+ if (definition.meta.configKey === void 0) {
131
+ definition.meta.configKey = definition.meta.name;
132
+ }
133
+ async function getOptions(inlineOptions, nuxt = useNuxt()) {
134
+ const configKey = definition.meta.configKey || definition.meta.name;
135
+ const _defaults = definition.defaults instanceof Function ? definition.defaults(nuxt) : definition.defaults;
136
+ let _options = defu(inlineOptions, nuxt.options[configKey], _defaults);
137
+ if (definition.schema) {
138
+ _options = await applyDefaults(definition.schema, _options);
170
139
  }
171
- nuxt.options.layouts[layoutName] = `./${filename}`;
172
- if (name === "error") {
173
- this.addErrorLayout(filename);
140
+ return Promise.resolve(_options);
141
+ }
142
+ async function normalizedModule(inlineOptions, nuxt) {
143
+ if (!nuxt) {
144
+ nuxt = tryUseNuxt() || this.nuxt;
145
+ }
146
+ const uniqueKey = definition.meta.name || definition.meta.configKey;
147
+ if (uniqueKey) {
148
+ nuxt.options._requiredModules = nuxt.options._requiredModules || {};
149
+ if (nuxt.options._requiredModules[uniqueKey]) {
150
+ return;
151
+ }
152
+ nuxt.options._requiredModules[uniqueKey] = true;
153
+ }
154
+ if (definition.meta.compatibility) {
155
+ const issues = await checkNuxtCompatibility(definition.meta.compatibility, nuxt);
156
+ if (issues.length) {
157
+ logger.warn(`Module \`${definition.meta.name}\` is disabled due to incompatibility issues:
158
+ ${issues.toString()}`);
159
+ return;
160
+ }
161
+ }
162
+ nuxt2Shims(nuxt);
163
+ const _options = await getOptions(inlineOptions, nuxt);
164
+ if (definition.hooks) {
165
+ nuxt.hooks.addHooks(definition.hooks);
174
166
  }
167
+ await definition.setup?.call(null, _options, nuxt);
168
+ }
169
+ normalizedModule.getMeta = () => Promise.resolve(definition.meta);
170
+ normalizedModule.getOptions = getOptions;
171
+ return normalizedModule;
172
+ }
173
+ const NUXT2_SHIMS_KEY = "__nuxt2_shims_key__";
174
+ function nuxt2Shims(nuxt) {
175
+ if (!isNuxt2(nuxt) || nuxt[NUXT2_SHIMS_KEY]) {
175
176
  return;
176
177
  }
177
- nuxt.hook("app:templates", (app) => {
178
- if (layoutName in app.layouts) {
179
- const relativePath = relative(nuxt.options.srcDir, app.layouts[layoutName].file);
180
- return logger.warn(
181
- `Not overriding \`${layoutName}\` (provided by \`~/${relativePath}\`) with \`${src || filename}\`.`
182
- );
178
+ nuxt[NUXT2_SHIMS_KEY] = true;
179
+ nuxt.hooks = nuxt;
180
+ if (!nuxtCtx.tryUse()) {
181
+ nuxtCtx.set(nuxt);
182
+ nuxt.hook("close", () => nuxtCtx.unset());
183
+ }
184
+ let virtualTemplates;
185
+ nuxt.hook("builder:prepared", (_builder, buildOptions) => {
186
+ virtualTemplates = buildOptions.templates.filter((t) => t.getContents);
187
+ for (const template of virtualTemplates) {
188
+ buildOptions.templates.splice(buildOptions.templates.indexOf(template), 1);
183
189
  }
184
- app.layouts[layoutName] = {
185
- file: join("#build", filename),
186
- name: layoutName
190
+ });
191
+ nuxt.hook("build:templates", async (templates) => {
192
+ const context = {
193
+ nuxt,
194
+ utils: templateUtils,
195
+ app: {
196
+ dir: nuxt.options.srcDir,
197
+ extensions: nuxt.options.extensions,
198
+ plugins: nuxt.options.plugins,
199
+ templates: [
200
+ ...templates.templatesFiles,
201
+ ...virtualTemplates
202
+ ],
203
+ templateVars: templates.templateVars
204
+ }
187
205
  };
206
+ for await (const template of virtualTemplates) {
207
+ const contents = await compileTemplate({ ...template, src: "" }, context);
208
+ await promises.mkdir(dirname(template.dst), { recursive: true });
209
+ await promises.writeFile(template.dst, contents);
210
+ }
188
211
  });
189
212
  }
190
213
 
191
- function normalizeHandlerMethod(handler) {
192
- const [, method = void 0] = handler.handler.match(/\.(get|head|patch|post|put|delete|connect|options|trace)(\.\w+)*$/) || [];
193
- return {
194
- method,
195
- ...handler
196
- };
197
- }
198
- function addServerMiddleware(middleware) {
199
- useNuxt().options.serverMiddleware.push(middleware);
200
- }
201
- function addServerHandler(handler) {
202
- useNuxt().options.serverHandlers.push(normalizeHandlerMethod(handler));
203
- }
204
- function addDevServerHandler(handler) {
205
- useNuxt().options.devServerHandlers.push(handler);
206
- }
207
- function useNitro() {
208
- const nuxt = useNuxt();
209
- if (!nuxt._nitro) {
210
- throw new Error("Nitro is not initialized yet. You can call `useNitro()` only after `ready` hook.");
211
- }
212
- return nuxt._nitro;
213
- }
214
-
215
214
  const _require = jiti(process.cwd(), { interopDefault: true, esmResolve: true });
216
215
  function isNodeModules(id) {
217
216
  return /[/\\]node_modules[/\\]/.test(id);
@@ -331,7 +330,7 @@ async function resolvePath(path, opts = {}) {
331
330
  if (isAbsolute(path) && existsSync(path) && !await isDirectory(path)) {
332
331
  return path;
333
332
  }
334
- const nuxt = useNuxt();
333
+ const nuxt = tryUseNuxt();
335
334
  const cwd = opts.cwd || (nuxt ? nuxt.options.rootDir : process.cwd());
336
335
  const extensions = opts.extensions || (nuxt ? nuxt.options.extensions : [".ts", ".mjs", ".cjs", ".json"]);
337
336
  const modulesDir = nuxt ? nuxt.options.modulesDir : [];
@@ -381,15 +380,7 @@ function resolveAlias(path, alias) {
381
380
  if (!alias) {
382
381
  alias = tryUseNuxt()?.options.alias || {};
383
382
  }
384
- for (const key in normalizeAliases(alias)) {
385
- if (key === "@" && !path.startsWith("@/")) {
386
- continue;
387
- }
388
- if (path.startsWith(key)) {
389
- path = alias[key] + path.slice(key.length);
390
- }
391
- }
392
- return path;
383
+ return resolveAlias$1(path, alias);
393
384
  }
394
385
  function createResolver(base) {
395
386
  if (!base) {
@@ -419,45 +410,13 @@ async function resolveFiles(path, pattern, opts = {}) {
419
410
  return files.map((p) => resolve(path, p)).filter((p) => !isIgnored(p)).sort();
420
411
  }
421
412
 
422
- function normalizePlugin(plugin) {
423
- if (typeof plugin === "string") {
424
- plugin = { src: plugin };
425
- } else {
426
- plugin = { ...plugin };
427
- }
428
- if (!plugin.src) {
429
- throw new Error("Invalid plugin. src option is required: " + JSON.stringify(plugin));
430
- }
431
- plugin.src = normalize(resolveAlias(plugin.src));
432
- if (plugin.ssr) {
433
- plugin.mode = "server";
434
- }
435
- if (!plugin.mode) {
436
- const [, mode = "all"] = plugin.src.match(/\.(server|client)(\.\w+)*$/) || [];
437
- plugin.mode = mode;
438
- }
439
- return plugin;
440
- }
441
- function addPlugin(_plugin, opts = {}) {
442
- const nuxt = useNuxt();
443
- const plugin = normalizePlugin(_plugin);
444
- nuxt.options.plugins = nuxt.options.plugins.filter((p) => normalizePlugin(p).src !== plugin.src);
445
- nuxt.options.plugins[opts.append ? "push" : "unshift"](plugin);
446
- return plugin;
447
- }
448
- function addPluginTemplate(plugin, opts = {}) {
449
- const normalizedPlugin = typeof plugin === "string" ? { src: plugin } : { ...plugin, src: addTemplate(plugin).dst };
450
- return addPlugin(normalizedPlugin, opts);
451
- }
452
-
453
413
  async function installModule(moduleToInstall, _inlineOptions, _nuxt) {
454
414
  const nuxt = useNuxt();
455
415
  const { nuxtModule, inlineOptions } = await normalizeModule(moduleToInstall, _inlineOptions);
456
- await nuxtModule.call(
457
- useModuleContainer(),
458
- inlineOptions,
459
- nuxt
460
- );
416
+ await nuxtModule(inlineOptions, nuxt);
417
+ if (typeof moduleToInstall === "string") {
418
+ nuxt.options.build.transpile.push(moduleToInstall);
419
+ }
461
420
  nuxt.options._installedModules = nuxt.options._installedModules || [];
462
421
  nuxt.options._installedModules.push({
463
422
  meta: await nuxtModule.getMeta?.(),
@@ -466,10 +425,6 @@ async function installModule(moduleToInstall, _inlineOptions, _nuxt) {
466
425
  }
467
426
  async function normalizeModule(nuxtModule, inlineOptions) {
468
427
  const nuxt = useNuxt();
469
- if (nuxtModule?._version || nuxtModule?.version || nuxtModule?.constructor?.version || "") {
470
- [nuxtModule, inlineOptions] = [inlineOptions, {}];
471
- console.warn(new Error("`installModule` is being called with old signature!"));
472
- }
473
428
  if (typeof nuxtModule === "string") {
474
429
  const _src = resolveModule(resolveAlias(nuxtModule), { paths: nuxt.options.modulesDir });
475
430
  const isESM = _src.endsWith(".mjs");
@@ -486,206 +441,6 @@ async function normalizeModule(nuxtModule, inlineOptions) {
486
441
  return { nuxtModule, inlineOptions };
487
442
  }
488
443
 
489
- const MODULE_CONTAINER_KEY = "__module_container__";
490
- function useModuleContainer(nuxt = useNuxt()) {
491
- if (nuxt[MODULE_CONTAINER_KEY]) {
492
- return nuxt[MODULE_CONTAINER_KEY];
493
- }
494
- async function requireModule(moduleOpts) {
495
- let src, inlineOptions;
496
- if (typeof moduleOpts === "string") {
497
- src = moduleOpts;
498
- } else if (Array.isArray(moduleOpts)) {
499
- [src, inlineOptions] = moduleOpts;
500
- } else if (typeof moduleOpts === "object") {
501
- if (moduleOpts.src || moduleOpts.handler) {
502
- src = moduleOpts.src || moduleOpts.handler;
503
- inlineOptions = moduleOpts.options;
504
- } else {
505
- src = moduleOpts;
506
- }
507
- } else {
508
- src = moduleOpts;
509
- }
510
- await installModule(src, inlineOptions);
511
- }
512
- const container = {
513
- nuxt,
514
- options: nuxt.options,
515
- ready() {
516
- return Promise.resolve();
517
- },
518
- addVendor() {
519
- },
520
- requireModule,
521
- addModule: requireModule,
522
- addServerMiddleware,
523
- addTemplate(template) {
524
- if (typeof template === "string") {
525
- template = { src: template };
526
- }
527
- if (template.write === void 0) {
528
- template.write = true;
529
- }
530
- return addTemplate(template);
531
- },
532
- addPlugin(pluginTemplate) {
533
- return addPluginTemplate(pluginTemplate);
534
- },
535
- addLayout(tmpl, name) {
536
- return addLayout(tmpl, name);
537
- },
538
- addErrorLayout(dst) {
539
- const relativeBuildDir = relative(nuxt.options.rootDir, nuxt.options.buildDir);
540
- nuxt.options.ErrorPage = `~/${relativeBuildDir}/${dst}`;
541
- },
542
- extendBuild(fn) {
543
- nuxt.options.build.extend = chainFn(nuxt.options.build.extend, fn);
544
- if (!isNuxt2(nuxt)) {
545
- console.warn("[kit] [compat] Using `extendBuild` in Nuxt 3 has no effect. Instead call extendWebpackConfig and extendViteConfig.");
546
- }
547
- },
548
- extendRoutes(fn) {
549
- if (isNuxt2(nuxt)) {
550
- nuxt.options.router.extendRoutes = chainFn(nuxt.options.router.extendRoutes, fn);
551
- } else {
552
- nuxt.hook("pages:extend", async (pages, ...args) => {
553
- const maybeRoutes = await fn(pages, ...args);
554
- if (maybeRoutes) {
555
- console.warn("[kit] [compat] Using `extendRoutes` in Nuxt 3 needs to directly modify first argument instead of returning updated routes. Skipping extended routes.");
556
- }
557
- });
558
- }
559
- }
560
- };
561
- nuxt[MODULE_CONTAINER_KEY] = container;
562
- return nuxt[MODULE_CONTAINER_KEY];
563
- }
564
-
565
- async function compileTemplate(template, ctx) {
566
- const data = { ...ctx, options: template.options };
567
- if (template.src) {
568
- try {
569
- const srcContents = await promises.readFile(template.src, "utf-8");
570
- return lodashTemplate(srcContents, {})(data);
571
- } catch (err) {
572
- console.error("Error compiling template: ", template);
573
- throw err;
574
- }
575
- }
576
- if (template.getContents) {
577
- return template.getContents(data);
578
- }
579
- throw new Error("Invalid template: " + JSON.stringify(template));
580
- }
581
- const serialize = (data) => JSON.stringify(data, null, 2).replace(/"{(.+)}"(?=,?$)/gm, (r) => JSON.parse(r).replace(/^{(.*)}$/, "$1"));
582
- const importSources = (sources, { lazy = false } = {}) => {
583
- if (!Array.isArray(sources)) {
584
- sources = [sources];
585
- }
586
- return sources.map((src) => {
587
- if (lazy) {
588
- return `const ${genSafeVariableName(src)} = ${genDynamicImport(src, { comment: `webpackChunkName: ${JSON.stringify(src)}` })}`;
589
- }
590
- return genImport(src, genSafeVariableName(src));
591
- }).join("\n");
592
- };
593
- const importName = genSafeVariableName;
594
- const templateUtils = { serialize, importName, importSources };
595
-
596
- function defineNuxtModule(definition) {
597
- if (typeof definition === "function") {
598
- definition = definition(useNuxt());
599
- logger.warn("Module definition as function is deprecated and will be removed in the future versions", definition);
600
- }
601
- if (!definition.meta) {
602
- definition.meta = {};
603
- }
604
- if (!definition.meta.configKey) {
605
- definition.meta.name = definition.meta.name || definition.name;
606
- definition.meta.configKey = definition.configKey || definition.meta.name;
607
- }
608
- async function getOptions(inlineOptions, nuxt = useNuxt()) {
609
- const configKey = definition.meta.configKey || definition.meta.name;
610
- const _defaults = definition.defaults instanceof Function ? definition.defaults(nuxt) : definition.defaults;
611
- let _options = defu(inlineOptions, nuxt.options[configKey], _defaults);
612
- if (definition.schema) {
613
- _options = await applyDefaults(definition.schema, _options);
614
- }
615
- return Promise.resolve(_options);
616
- }
617
- async function normalizedModule(inlineOptions, nuxt) {
618
- if (!nuxt) {
619
- nuxt = tryUseNuxt() || this.nuxt;
620
- }
621
- const uniqueKey = definition.meta.name || definition.meta.configKey;
622
- if (uniqueKey) {
623
- nuxt.options._requiredModules = nuxt.options._requiredModules || {};
624
- if (nuxt.options._requiredModules[uniqueKey]) {
625
- return;
626
- }
627
- nuxt.options._requiredModules[uniqueKey] = true;
628
- }
629
- if (definition.meta.compatibility) {
630
- const issues = await checkNuxtCompatibility(definition.meta.compatibility, nuxt);
631
- if (issues.length) {
632
- logger.warn(`Module \`${definition.meta.name}\` is disabled due to incompatibility issues:
633
- ${issues.toString()}`);
634
- return;
635
- }
636
- }
637
- nuxt2Shims(nuxt);
638
- const _options = await getOptions(inlineOptions, nuxt);
639
- if (definition.hooks) {
640
- nuxt.hooks.addHooks(definition.hooks);
641
- }
642
- await definition.setup?.call(null, _options, nuxt);
643
- }
644
- normalizedModule.getMeta = () => Promise.resolve(definition.meta);
645
- normalizedModule.getOptions = getOptions;
646
- return normalizedModule;
647
- }
648
- const NUXT2_SHIMS_KEY = "__nuxt2_shims_key__";
649
- function nuxt2Shims(nuxt) {
650
- if (!isNuxt2(nuxt) || nuxt[NUXT2_SHIMS_KEY]) {
651
- return;
652
- }
653
- nuxt[NUXT2_SHIMS_KEY] = true;
654
- nuxt.hooks = nuxt;
655
- if (!nuxtCtx.tryUse()) {
656
- nuxtCtx.set(nuxt);
657
- nuxt.hook("close", () => nuxtCtx.unset());
658
- }
659
- let virtualTemplates;
660
- nuxt.hook("builder:prepared", (_builder, buildOptions) => {
661
- virtualTemplates = buildOptions.templates.filter((t) => t.getContents);
662
- for (const template of virtualTemplates) {
663
- buildOptions.templates.splice(buildOptions.templates.indexOf(template), 1);
664
- }
665
- });
666
- nuxt.hook("build:templates", async (templates) => {
667
- const context = {
668
- nuxt,
669
- utils: templateUtils,
670
- app: {
671
- dir: nuxt.options.srcDir,
672
- extensions: nuxt.options.extensions,
673
- plugins: nuxt.options.plugins,
674
- templates: [
675
- ...templates.templatesFiles,
676
- ...virtualTemplates
677
- ],
678
- templateVars: templates.templateVars
679
- }
680
- };
681
- for await (const template of virtualTemplates) {
682
- const contents = await compileTemplate({ ...template, src: "" }, context);
683
- await promises.mkdir(dirname(template.dst), { recursive: true });
684
- await promises.writeFile(template.dst, contents);
685
- }
686
- });
687
- }
688
-
689
444
  async function loadNuxtConfig(opts) {
690
445
  globalThis.defineNuxtConfig = (c) => c;
691
446
  const result = await loadConfig({
@@ -708,9 +463,10 @@ async function loadNuxtConfig(opts) {
708
463
  layer.config.rootDir = layer.config.rootDir ?? layer.cwd;
709
464
  layer.config.srcDir = resolve(layer.config.rootDir, layer.config.srcDir);
710
465
  }
711
- nuxtConfig._layers = layers.filter((layer) => layer.configFile && !layer.configFile.endsWith(".nuxtrc"));
712
- if (!nuxtConfig._layers.length) {
713
- nuxtConfig._layers.push({
466
+ const _layers = layers.filter((layer) => layer.configFile && !layer.configFile.endsWith(".nuxtrc"));
467
+ nuxtConfig._layers = _layers;
468
+ if (!_layers.length) {
469
+ _layers.push({
714
470
  cwd,
715
471
  config: {
716
472
  rootDir: cwd,
@@ -759,27 +515,25 @@ async function buildNuxt(nuxt) {
759
515
 
760
516
  function addImports(imports) {
761
517
  assertNuxtCompatibility({ bridge: true });
762
- useNuxt().hook("autoImports:extend", (_imports) => {
518
+ useNuxt().hook("imports:extend", (_imports) => {
763
519
  _imports.push(...Array.isArray(imports) ? imports : [imports]);
764
- }, { allowDeprecated: true });
520
+ });
765
521
  }
766
- const addAutoImport = addImports;
767
522
  function addImportsDir(dirs) {
768
523
  assertNuxtCompatibility({ bridge: true });
769
- useNuxt().hook("autoImports:dirs", (_dirs) => {
524
+ useNuxt().hook("imports:dirs", (_dirs) => {
770
525
  for (const dir of Array.isArray(dirs) ? dirs : [dirs]) {
771
526
  _dirs.push(dir);
772
527
  }
773
- }, { allowDeprecated: true });
528
+ });
774
529
  }
775
- const addAutoImportDir = addImportsDir;
776
530
  function addImportsSources(presets) {
777
531
  assertNuxtCompatibility({ bridge: true });
778
- useNuxt().hook("autoImports:sources", (_presets) => {
532
+ useNuxt().hook("imports:sources", (_presets) => {
779
533
  for (const preset of Array.isArray(presets) ? presets : [presets]) {
780
534
  _presets.push(preset);
781
535
  }
782
- }, { allowDeprecated: true });
536
+ });
783
537
  }
784
538
 
785
539
  function extendWebpackConfig(fn, options = {}) {
@@ -803,12 +557,6 @@ function extendWebpackConfig(fn, options = {}) {
803
557
  fn(config);
804
558
  }
805
559
  }
806
- if (options.modern !== false) {
807
- const config = configs.find((i) => i.name === "modern");
808
- if (config) {
809
- fn(config);
810
- }
811
- }
812
560
  });
813
561
  }
814
562
  function extendViteConfig(fn, options = {}) {
@@ -874,10 +622,6 @@ async function addComponent(opts) {
874
622
  preload: false,
875
623
  mode: "all",
876
624
  shortPath: opts.filePath,
877
- async: false,
878
- level: 0,
879
- asyncImport: `${genDynamicImport(opts.filePath)}.then(r => r['${opts.export || "default"}'])`,
880
- import: `require(${JSON.stringify(opts.filePath)})['${opts.export || "default"}']`,
881
625
  ...opts
882
626
  };
883
627
  nuxt.hook("components:extend", (components) => {
@@ -892,6 +636,81 @@ async function addComponent(opts) {
892
636
  });
893
637
  }
894
638
 
639
+ function addTemplate(_template) {
640
+ const nuxt = useNuxt();
641
+ const template = normalizeTemplate(_template);
642
+ nuxt.options.build.templates = nuxt.options.build.templates.filter((p) => normalizeTemplate(p).filename !== template.filename);
643
+ nuxt.options.build.templates.push(template);
644
+ return template;
645
+ }
646
+ function normalizeTemplate(template) {
647
+ if (!template) {
648
+ throw new Error("Invalid template: " + JSON.stringify(template));
649
+ }
650
+ if (typeof template === "string") {
651
+ template = { src: template };
652
+ } else {
653
+ template = { ...template };
654
+ }
655
+ if (template.src) {
656
+ if (!existsSync(template.src)) {
657
+ throw new Error("Template not found: " + template.src);
658
+ }
659
+ if (!template.filename) {
660
+ const srcPath = parse(template.src);
661
+ template.filename = template.fileName || `${basename(srcPath.dir)}.${srcPath.name}.${hash(template.src)}${srcPath.ext}`;
662
+ }
663
+ }
664
+ if (!template.src && !template.getContents) {
665
+ throw new Error("Invalid template. Either getContents or src options should be provided: " + JSON.stringify(template));
666
+ }
667
+ if (!template.filename) {
668
+ throw new Error("Invalid template. Either filename should be provided: " + JSON.stringify(template));
669
+ }
670
+ if (template.filename.endsWith(".d.ts")) {
671
+ template.write = true;
672
+ }
673
+ if (!template.dst) {
674
+ const nuxt = useNuxt();
675
+ template.dst = resolve(nuxt.options.buildDir, template.filename);
676
+ }
677
+ return template;
678
+ }
679
+ function updateTemplates(options) {
680
+ return useNuxt().hooks.callHook("builder:generateApp", options);
681
+ }
682
+
683
+ function addLayout(template, name) {
684
+ const nuxt = useNuxt();
685
+ const { filename, src } = addTemplate(template);
686
+ const layoutName = kebabCase(name || parse(filename).name).replace(/["']/g, "");
687
+ if (isNuxt2(nuxt)) {
688
+ const layout = nuxt.options.layouts[layoutName];
689
+ if (layout) {
690
+ return logger.warn(
691
+ `Not overriding \`${layoutName}\` (provided by \`${layout}\`) with \`${src || filename}\`.`
692
+ );
693
+ }
694
+ nuxt.options.layouts[layoutName] = `./${filename}`;
695
+ if (name === "error") {
696
+ this.addErrorLayout(filename);
697
+ }
698
+ return;
699
+ }
700
+ nuxt.hook("app:templates", (app) => {
701
+ if (layoutName in app.layouts) {
702
+ const relativePath = relative(nuxt.options.srcDir, app.layouts[layoutName].file);
703
+ return logger.warn(
704
+ `Not overriding \`${layoutName}\` (provided by \`~/${relativePath}\`) with \`${src || filename}\`.`
705
+ );
706
+ }
707
+ app.layouts[layoutName] = {
708
+ file: join("#build", filename),
709
+ name: layoutName
710
+ };
711
+ });
712
+ }
713
+
895
714
  function extendPages(cb) {
896
715
  const nuxt = useNuxt();
897
716
  if (isNuxt2(nuxt)) {
@@ -901,4 +720,77 @@ function extendPages(cb) {
901
720
  }
902
721
  }
903
722
 
904
- export { addAutoImport, addAutoImportDir, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addServerHandler, addServerMiddleware, addTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, clearRequireCache, compileTemplate, createResolver, defineNuxtModule, extendPages, extendViteConfig, extendWebpackConfig, findPath, getNuxtVersion, getRequireCacheItem, hasNuxtCompatibility, importModule, installModule, isIgnored, isNodeModules, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, logger, normalizePlugin, normalizeTemplate, nuxtCtx, requireModule, requireModulePkg, resolveAlias, resolveFiles, resolveModule, resolvePath, scanRequireTree, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, useLogger, useModuleContainer, useNitro, useNuxt };
723
+ function normalizePlugin(plugin) {
724
+ if (typeof plugin === "string") {
725
+ plugin = { src: plugin };
726
+ } else {
727
+ plugin = { ...plugin };
728
+ }
729
+ if (!plugin.src) {
730
+ throw new Error("Invalid plugin. src option is required: " + JSON.stringify(plugin));
731
+ }
732
+ plugin.src = normalize(resolveAlias(plugin.src));
733
+ if (plugin.ssr) {
734
+ plugin.mode = "server";
735
+ }
736
+ if (!plugin.mode) {
737
+ const [, mode = "all"] = plugin.src.match(/\.(server|client)(\.\w+)*$/) || [];
738
+ plugin.mode = mode;
739
+ }
740
+ return plugin;
741
+ }
742
+ function addPlugin(_plugin, opts = {}) {
743
+ const nuxt = useNuxt();
744
+ const plugin = normalizePlugin(_plugin);
745
+ nuxt.options.plugins = nuxt.options.plugins.filter((p) => normalizePlugin(p).src !== plugin.src);
746
+ nuxt.options.plugins[opts.append ? "push" : "unshift"](plugin);
747
+ return plugin;
748
+ }
749
+ function addPluginTemplate(plugin, opts = {}) {
750
+ const normalizedPlugin = typeof plugin === "string" ? { src: plugin } : { ...plugin, src: addTemplate(plugin).dst };
751
+ return addPlugin(normalizedPlugin, opts);
752
+ }
753
+
754
+ function normalizeHandlerMethod(handler) {
755
+ const [, method = void 0] = handler.handler.match(/\.(get|head|patch|post|put|delete|connect|options|trace)(\.\w+)*$/) || [];
756
+ return {
757
+ method,
758
+ ...handler,
759
+ handler: normalize(handler.handler)
760
+ };
761
+ }
762
+ function addServerHandler(handler) {
763
+ useNuxt().options.serverHandlers.push(normalizeHandlerMethod(handler));
764
+ }
765
+ function addDevServerHandler(handler) {
766
+ useNuxt().options.devServerHandlers.push(handler);
767
+ }
768
+ function addServerPlugin(plugin) {
769
+ const nuxt = useNuxt();
770
+ nuxt.options.nitro.plugins = nuxt.options.nitro.plugins || [];
771
+ nuxt.options.nitro.plugins.push(normalize(plugin));
772
+ }
773
+ function addPrerenderRoutes(routes) {
774
+ const nuxt = useNuxt();
775
+ if (!Array.isArray(routes)) {
776
+ routes = [routes];
777
+ }
778
+ routes = routes.filter(Boolean);
779
+ if (!routes.length) {
780
+ return;
781
+ }
782
+ nuxt.hook("prerender:routes", (ctx) => {
783
+ for (const route of routes) {
784
+ ctx.routes.add(route);
785
+ }
786
+ });
787
+ }
788
+ function useNitro() {
789
+ const nuxt = useNuxt();
790
+ if (!nuxt._nitro) {
791
+ throw new Error("Nitro is not initialized yet. You can call `useNitro()` only after `ready` hook.");
792
+ }
793
+ return nuxt._nitro;
794
+ }
795
+
796
+ export { addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addServerHandler, addServerPlugin, addTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, clearRequireCache, compileTemplate, createResolver, defineNuxtModule, extendPages, extendViteConfig, extendWebpackConfig, findPath, getNuxtVersion, getRequireCacheItem, hasNuxtCompatibility, importModule, installModule, isIgnored, isNodeModules, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, logger, normalizePlugin, normalizeTemplate, nuxtCtx, requireModule, requireModulePkg, resolveAlias, resolveFiles, resolveModule, resolvePath, scanRequireTree, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateTemplates, useLogger, useNitro, useNuxt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/kit",
3
- "version": "3.0.0-rc.12",
3
+ "version": "3.0.0-rc.14",
4
4
  "repository": "nuxt/framework",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -10,24 +10,24 @@
10
10
  "dist"
11
11
  ],
12
12
  "dependencies": {
13
- "@nuxt/schema": "3.0.0-rc.12",
14
- "c12": "^0.2.13",
13
+ "@nuxt/schema": "3.0.0-rc.14",
14
+ "c12": "^1.0.1",
15
15
  "consola": "^2.15.3",
16
- "defu": "^6.1.0",
16
+ "defu": "^6.1.1",
17
17
  "globby": "^13.1.2",
18
18
  "hash-sum": "^2.0.0",
19
19
  "ignore": "^5.2.0",
20
20
  "jiti": "^1.16.0",
21
- "knitwork": "^0.1.2",
21
+ "knitwork": "^1.0.0",
22
22
  "lodash.template": "^4.5.0",
23
- "mlly": "^0.5.16",
24
- "pathe": "^0.3.9",
25
- "pkg-types": "^0.3.5",
26
- "scule": "^0.3.2",
23
+ "mlly": "^1.0.0",
24
+ "pathe": "^1.0.0",
25
+ "pkg-types": "^1.0.1",
26
+ "scule": "^1.0.0",
27
27
  "semver": "^7.3.8",
28
- "unctx": "^2.0.2",
29
- "unimport": "^0.6.8",
30
- "untyped": "^0.5.0"
28
+ "unctx": "^2.1.0",
29
+ "unimport": "^1.0.0",
30
+ "untyped": "^1.0.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/lodash.template": "^4",
@@ -35,7 +35,7 @@
35
35
  "unbuild": "latest"
36
36
  },
37
37
  "engines": {
38
- "node": "^14.16.0 || ^16.10.0 || ^17.0.0 || ^18.0.0"
38
+ "node": "^14.16.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
39
39
  },
40
40
  "scripts": {}
41
41
  }