@nuxt/kit 0.8.1-edge → 3.0.0-rc.0

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.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
- # `@nuxt/kit`
1
+ # Nuxt Kit
2
2
 
3
- <a href="https://www.npmjs.com/package/@nuxt/kit-edge"><img src="https://flat.badgen.net/npm/v/@nuxt/kit-edge"></a>
3
+ > Toolkit for authoring Nuxt Modules
4
4
 
5
- This is stub package for `@nuxt/kit-edge`. See https://github.com/nuxt/nuxt3-stubs for more information.
5
+ Learn more about this package: <https://v3.nuxtjs.org>
@@ -0,0 +1,291 @@
1
+ import { Nuxt, ModuleContainer, ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, NuxtOptions, NuxtCompatibility, NuxtCompatibilityIssues, ComponentsDir, Component, NuxtHooks, NuxtPlugin, NuxtPluginTemplate, NuxtTemplate } from '@nuxt/schema';
2
+ import { LoadConfigOptions } from 'c12';
3
+ import { Import } from 'unimport';
4
+ import { Configuration, WebpackPluginInstance } from 'webpack';
5
+ import { UserConfig, Plugin } from 'vite';
6
+ import * as unctx from 'unctx';
7
+ import { Middleware } from 'h3';
8
+ import * as consola from 'consola';
9
+
10
+ declare function useModuleContainer(nuxt?: Nuxt): ModuleContainer;
11
+
12
+ /**
13
+ * Define a Nuxt module, automatically merging defaults with user provided options, installing
14
+ * any hooks that are provided, and calling an optional setup function for full control.
15
+ */
16
+ declare function defineNuxtModule<OptionsT extends ModuleOptions>(definition: ModuleDefinition<OptionsT>): NuxtModule<OptionsT>;
17
+
18
+ /** Installs a module on a Nuxt instance. */
19
+ declare function installModule(moduleToInstall: string | NuxtModule, _inlineOptions?: any, _nuxt?: Nuxt): Promise<void>;
20
+
21
+ interface LoadNuxtConfigOptions extends LoadConfigOptions<NuxtConfig> {
22
+ }
23
+ declare function loadNuxtConfig(opts: LoadNuxtConfigOptions): Promise<NuxtOptions>;
24
+
25
+ interface LoadNuxtOptions extends LoadNuxtConfigOptions {
26
+ /** Load nuxt with development mode */
27
+ dev?: boolean;
28
+ /** Use lazy initialization of nuxt if set to false */
29
+ ready?: boolean;
30
+ /** @deprecated Use cwd option */
31
+ rootDir?: LoadNuxtConfigOptions['cwd'];
32
+ /** @deprecated use overrides option */
33
+ config?: LoadNuxtConfigOptions['overrides'];
34
+ }
35
+ declare function loadNuxt(opts: LoadNuxtOptions): Promise<Nuxt>;
36
+ declare function buildNuxt(nuxt: Nuxt): Promise<any>;
37
+
38
+ declare function addAutoImport(imports: Import | Import[]): void;
39
+ declare function addAutoImportDir(_autoImportDirs: string | string[]): void;
40
+
41
+ interface ExtendConfigOptions {
42
+ /**
43
+ * Install plugin on dev
44
+ *
45
+ * @default true
46
+ */
47
+ dev?: boolean;
48
+ /**
49
+ * Install plugin on build
50
+ *
51
+ * @default true
52
+ */
53
+ build?: boolean;
54
+ }
55
+ interface ExtendWebpackConfigOptions extends ExtendConfigOptions {
56
+ /**
57
+ * Install plugin on server side
58
+ *
59
+ * @default true
60
+ */
61
+ server?: boolean;
62
+ /**
63
+ * Install plugin on client side
64
+ *
65
+ * @default true
66
+ */
67
+ client?: boolean;
68
+ /**
69
+ * Install plugin on modern build
70
+ *
71
+ * @default true
72
+ * @deprecated Nuxt 2 only
73
+ */
74
+ modern?: boolean;
75
+ }
76
+ interface ExtendViteConfigOptions extends ExtendConfigOptions {
77
+ }
78
+ /**
79
+ * Extend Webpack config
80
+ *
81
+ * The fallback function might be called multiple times
82
+ * when applying to both client and server builds.
83
+ */
84
+ declare function extendWebpackConfig(fn: ((config: Configuration) => void), options?: ExtendWebpackConfigOptions): void;
85
+ /**
86
+ * Extend Vite config
87
+ */
88
+ declare function extendViteConfig(fn: ((config: UserConfig) => void), options?: ExtendViteConfigOptions): void;
89
+ /**
90
+ * Append Webpack plugin to the config.
91
+ */
92
+ declare function addWebpackPlugin(plugin: WebpackPluginInstance, options?: ExtendWebpackConfigOptions): void;
93
+ /**
94
+ * Append Vite plugin to the config.
95
+ */
96
+ declare function addVitePlugin(plugin: Plugin, options?: ExtendViteConfigOptions): void;
97
+
98
+ /**
99
+ * Check version constraints and return incompatibility issues as an array
100
+ */
101
+ declare function checkNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<NuxtCompatibilityIssues>;
102
+ /**
103
+ * Check version constraints and throw a detailed error if has any, otherwise returns true
104
+ */
105
+ declare function assertNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<true>;
106
+ /**
107
+ * Check version constraints and return true if passed, otherwise returns false
108
+ */
109
+ declare function hasNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<boolean>;
110
+ /**
111
+ * Check if current nuxt instance is version 2 legacy
112
+ */
113
+ declare function isNuxt2(nuxt?: Nuxt): any;
114
+ /**
115
+ * Check if current nuxt instance is version 3
116
+ */
117
+ declare function isNuxt3(nuxt?: Nuxt): any;
118
+ /**
119
+ * Get nuxt version
120
+ */
121
+ declare function getNuxtVersion(nuxt?: Nuxt | any): any;
122
+
123
+ /**
124
+ * Register a directory to be scanned for components and imported only when used.
125
+ *
126
+ * Requires Nuxt 2.13+
127
+ */
128
+ declare function addComponentsDir(dir: ComponentsDir): Promise<void>;
129
+ declare type AddComponentOptions = {
130
+ name: string;
131
+ filePath: string;
132
+ } & Partial<Exclude<Component, 'shortPath' | 'async' | 'level' | 'import' | 'asyncImport'>>;
133
+ /**
134
+ * Register a directory to be scanned for components and imported only when used.
135
+ *
136
+ * Requires Nuxt 2.13+
137
+ */
138
+ declare function addComponent(opts: AddComponentOptions): Promise<void>;
139
+
140
+ /** Direct access to the Nuxt context - see https://github.com/unjs/unctx. */
141
+ declare const nuxtCtx: unctx.UseContext<Nuxt>;
142
+ /**
143
+ * Get access to Nuxt instance.
144
+ *
145
+ * Throws an error if Nuxt instance is unavailable.
146
+ *
147
+ * @example
148
+ * ```js
149
+ * const nuxt = useNuxt()
150
+ * ```
151
+ */
152
+ declare function useNuxt(): Nuxt;
153
+ /**
154
+ * Get access to Nuxt instance.
155
+ *
156
+ * Returns null if Nuxt instance is unavailable.
157
+ *
158
+ * @example
159
+ * ```js
160
+ * const nuxt = tryUseNuxt()
161
+ * if (nuxt) {
162
+ * // Do something
163
+ * }
164
+ * ```
165
+ */
166
+ declare function tryUseNuxt(): Nuxt | null;
167
+
168
+ /**
169
+ * Return a filter function to filter an array of paths
170
+ */
171
+ declare function isIgnored(pathname: string): boolean;
172
+
173
+ declare function extendPages(cb: NuxtHooks['pages:extend']): void;
174
+
175
+ /**
176
+ * Normalize a nuxt plugin object
177
+ */
178
+ declare function normalizePlugin(plugin: NuxtPlugin | string): NuxtPlugin;
179
+ /**
180
+ * Registers a nuxt plugin and to the plugins array.
181
+ *
182
+ * Note: You can use mode or .client and .server modifiers with fileName option
183
+ * to use plugin only in client or server side.
184
+ *
185
+ * Note: By default plugin is prepended to the plugins array. You can use second argument to append (push) instead.
186
+ *
187
+ * @example
188
+ * ```js
189
+ * addPlugin({
190
+ * src: path.resolve(__dirname, 'templates/foo.js'),
191
+ * filename: 'foo.server.js' // [optional] only include in server bundle
192
+ * })
193
+ * ```
194
+ */
195
+ interface AddPluginOptions {
196
+ append?: boolean;
197
+ }
198
+ declare function addPlugin(_plugin: NuxtPlugin | string, opts?: AddPluginOptions): NuxtPlugin;
199
+ /**
200
+ * Adds a template and registers as a nuxt plugin.
201
+ */
202
+ declare function addPluginTemplate(plugin: NuxtPluginTemplate | string, opts?: AddPluginOptions): NuxtPlugin;
203
+
204
+ interface ResolvePathOptions {
205
+ /** Base for resolving paths from. Default is Nuxt rootDir. */
206
+ cwd?: string;
207
+ /** An object of aliases. Default is Nuxt configured aliases. */
208
+ alias?: Record<string, string>;
209
+ /** The file extensions to try. Default is Nuxt configured extensions. */
210
+ extensions?: string[];
211
+ }
212
+ /**
213
+ * Resolve full path to a file or directory respecting Nuxt alias and extensions options
214
+ *
215
+ * If path could not be resolved, normalized input path will be returned
216
+ */
217
+ declare function resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>;
218
+ /**
219
+ * Try to resolve first existing file in paths
220
+ */
221
+ declare function findPath(paths: string | string[], opts?: ResolvePathOptions, pathType?: 'file' | 'dir'): Promise<string | null>;
222
+ /**
223
+ * Resolve path aliases respecting Nuxt alias options
224
+ */
225
+ declare function resolveAlias(path: string, alias?: Record<string, string>): string;
226
+ interface Resolver {
227
+ resolve(...path: any[]): string;
228
+ resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>;
229
+ }
230
+ /**
231
+ * Create a relative resolver
232
+ */
233
+ declare function createResolver(base: string | URL): Resolver;
234
+ declare function resolveFiles(path: string, pattern: string | string[]): Promise<string[]>;
235
+
236
+ interface ServerMiddleware {
237
+ route?: string;
238
+ handler: Middleware | string;
239
+ }
240
+ /** Adds a new server middleware to the end of the server middleware array. */
241
+ declare function addServerMiddleware(middleware: ServerMiddleware): void;
242
+
243
+ /**
244
+ * Renders given template using lodash template during build into the project buildDir
245
+ */
246
+ declare function addTemplate(_template: NuxtTemplate | string): NuxtTemplate;
247
+ /**
248
+ * Normalize a nuxt template object
249
+ */
250
+ declare function normalizeTemplate(template: NuxtTemplate | string): NuxtTemplate;
251
+
252
+ declare const logger: consola.Consola;
253
+ declare function useLogger(scope?: string): consola.Consola;
254
+
255
+ interface ResolveModuleOptions {
256
+ paths?: string | string[];
257
+ }
258
+ interface RequireModuleOptions extends ResolveModuleOptions {
259
+ /** Clear the require cache (force fresh require) but only if not within `node_modules` */
260
+ clearCache?: boolean;
261
+ /** Automatically de-default the result of requiring the module. */
262
+ interopDefault?: boolean;
263
+ }
264
+ declare function isNodeModules(id: string): boolean;
265
+ declare function clearRequireCache(id: string): void;
266
+ declare function scanRequireTree(id: string, files?: Set<string>): Set<string>;
267
+ /** Access the require cache by module id. */
268
+ declare function getRequireCacheItem(id: string): NodeModule;
269
+ /** Resolve the `package.json` file for a given module. */
270
+ declare function requireModulePkg(id: string, opts?: RequireModuleOptions): any;
271
+ /** Resolve the path of a module. */
272
+ declare function resolveModule(id: string, opts?: ResolveModuleOptions): string;
273
+ /** Try to resolve the path of a module, but don't emit an error if it can't be found. */
274
+ declare function tryResolveModule(path: string, opts?: ResolveModuleOptions): string | null;
275
+ /** Require a module and return it. */
276
+ declare function requireModule(id: string, opts?: RequireModuleOptions): any;
277
+ declare function importModule(id: string, opts?: RequireModuleOptions): Promise<any>;
278
+ declare function tryImportModule(id: string, opts?: RequireModuleOptions): Promise<any>;
279
+ /** Try to require a module, but don't emit an error if the module can't be required. */
280
+ declare function tryRequireModule(id: string, opts?: RequireModuleOptions): any;
281
+
282
+ declare function compileTemplate(template: NuxtTemplate, ctx: any): Promise<string>;
283
+ declare const templateUtils: {
284
+ serialize: (data: any) => string;
285
+ importName: (src: string) => string;
286
+ importSources: (sources: string | string[], { lazy }?: {
287
+ lazy?: boolean;
288
+ }) => string;
289
+ };
290
+
291
+ export { AddComponentOptions, AddPluginOptions, ExtendConfigOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, LoadNuxtConfigOptions, LoadNuxtOptions, RequireModuleOptions, ResolveModuleOptions, ResolvePathOptions, Resolver, ServerMiddleware, addAutoImport, addAutoImportDir, addComponent, addComponentsDir, addPlugin, addPluginTemplate, 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, useNuxt };
package/dist/index.mjs ADDED
@@ -0,0 +1,796 @@
1
+ import { parse, basename, resolve, normalize, join, relative, isAbsolute, dirname, extname } from 'pathe';
2
+ import consola from 'consola';
3
+ import { existsSync, readFileSync, promises } from 'node:fs';
4
+ import hash from 'hash-sum';
5
+ import { getContext } from 'unctx';
6
+ import satisfies from 'semver/functions/satisfies.js';
7
+ import { pathToFileURL, fileURLToPath } from 'node:url';
8
+ import { interopDefault } from 'mlly';
9
+ import jiti from 'jiti';
10
+ import { globby } from 'globby';
11
+ import ignore from 'ignore';
12
+ import defu from 'defu';
13
+ import { applyDefaults } from 'untyped';
14
+ import lodashTemplate from 'lodash.template';
15
+ import { camelCase, kebabCase, pascalCase } from 'scule';
16
+ import { genDynamicImport, genImport } from 'knitwork';
17
+ import { loadConfig } from 'c12';
18
+ import { NuxtConfigSchema } from '@nuxt/schema';
19
+ import { resolvePackageJSON, readPackageJSON } from 'pkg-types';
20
+
21
+ const logger = consola;
22
+ function useLogger(scope) {
23
+ return scope ? logger.withScope(scope) : logger;
24
+ }
25
+
26
+ function chainFn(base, fn) {
27
+ if (typeof fn !== "function") {
28
+ return base;
29
+ }
30
+ return function(...args) {
31
+ if (typeof base !== "function") {
32
+ return fn.apply(this, args);
33
+ }
34
+ let baseResult = base.apply(this, args);
35
+ if (baseResult === void 0) {
36
+ [baseResult] = args;
37
+ }
38
+ const fnResult = fn.call(this, baseResult, ...Array.prototype.slice.call(args, 1));
39
+ if (fnResult === void 0) {
40
+ return baseResult;
41
+ }
42
+ return fnResult;
43
+ };
44
+ }
45
+
46
+ const nuxtCtx = getContext("nuxt");
47
+ function useNuxt() {
48
+ const instance = nuxtCtx.use();
49
+ if (!instance) {
50
+ throw new Error("Nuxt instance is unavailable!");
51
+ }
52
+ return instance;
53
+ }
54
+ function tryUseNuxt() {
55
+ return nuxtCtx.use();
56
+ }
57
+
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
+ function addServerMiddleware(middleware) {
100
+ useNuxt().options.serverMiddleware.push(middleware);
101
+ }
102
+
103
+ async function checkNuxtCompatibility(constraints, nuxt = useNuxt()) {
104
+ const issues = [];
105
+ if (constraints.nuxt) {
106
+ const nuxtVersion = getNuxtVersion(nuxt);
107
+ const nuxtSemanticVersion = nuxtVersion.split("-").shift();
108
+ if (!satisfies(nuxtSemanticVersion, constraints.nuxt)) {
109
+ issues.push({
110
+ name: "nuxt",
111
+ message: `Nuxt version \`${constraints.nuxt}\` is required but currently using \`${nuxtVersion}\``
112
+ });
113
+ }
114
+ }
115
+ if (isNuxt2(nuxt)) {
116
+ const bridgeRequirement = constraints?.bridge;
117
+ const hasBridge = !!nuxt.options.bridge;
118
+ if (bridgeRequirement === true && !hasBridge) {
119
+ issues.push({
120
+ name: "bridge",
121
+ message: "Nuxt bridge is required"
122
+ });
123
+ } else if (bridgeRequirement === false && hasBridge) {
124
+ issues.push({
125
+ name: "bridge",
126
+ message: "Nuxt bridge is not supported"
127
+ });
128
+ }
129
+ }
130
+ await nuxt.callHook("kit:compatibility", constraints, issues);
131
+ issues.toString = () => issues.map((issue) => ` - [${issue.name}] ${issue.message}`).join("\n");
132
+ return issues;
133
+ }
134
+ async function assertNuxtCompatibility(constraints, nuxt = useNuxt()) {
135
+ const issues = await checkNuxtCompatibility(constraints, nuxt);
136
+ if (issues.length) {
137
+ throw new Error("Nuxt compatibility issues found:\n" + issues.toString());
138
+ }
139
+ return true;
140
+ }
141
+ async function hasNuxtCompatibility(constraints, nuxt = useNuxt()) {
142
+ const issues = await checkNuxtCompatibility(constraints, nuxt);
143
+ return !issues.length;
144
+ }
145
+ function isNuxt2(nuxt = useNuxt()) {
146
+ return getNuxtVersion(nuxt).startsWith("2.");
147
+ }
148
+ function isNuxt3(nuxt = useNuxt()) {
149
+ return getNuxtVersion(nuxt).startsWith("3.");
150
+ }
151
+ function getNuxtVersion(nuxt = useNuxt()) {
152
+ const version = (nuxt?._version || nuxt?.version || nuxt?.constructor?.version || "").replace(/^v/g, "");
153
+ if (!version) {
154
+ throw new Error("Cannot determine nuxt version! Is currect instance passed?");
155
+ }
156
+ return version;
157
+ }
158
+
159
+ function normalizePlugin(plugin) {
160
+ if (typeof plugin === "string") {
161
+ plugin = { src: plugin };
162
+ } else {
163
+ plugin = { ...plugin };
164
+ }
165
+ if (!plugin.src) {
166
+ throw new Error("Invalid plugin. src option is required: " + JSON.stringify(plugin));
167
+ }
168
+ plugin.src = normalize(plugin.src);
169
+ if (plugin.ssr) {
170
+ plugin.mode = "server";
171
+ }
172
+ if (!plugin.mode) {
173
+ const [, mode = "all"] = plugin.src.match(/\.(server|client)(\.\w+)*$/) || [];
174
+ plugin.mode = mode;
175
+ }
176
+ return plugin;
177
+ }
178
+ function addPlugin(_plugin, opts = {}) {
179
+ const nuxt = useNuxt();
180
+ const plugin = normalizePlugin(_plugin);
181
+ nuxt.options.plugins = nuxt.options.plugins.filter((p) => normalizePlugin(p).src !== plugin.src);
182
+ nuxt.options.plugins[opts.append ? "push" : "unshift"](plugin);
183
+ return plugin;
184
+ }
185
+ function addPluginTemplate(plugin, opts = {}) {
186
+ const normalizedPlugin = typeof plugin === "string" ? { src: plugin } : { ...plugin, src: addTemplate(plugin).dst };
187
+ return addPlugin(normalizedPlugin, opts);
188
+ }
189
+
190
+ const _require = jiti(process.cwd(), { interopDefault: true });
191
+ function isNodeModules(id) {
192
+ return /[/\\]node_modules[/\\]/.test(id);
193
+ }
194
+ function clearRequireCache(id) {
195
+ if (isNodeModules(id)) {
196
+ return;
197
+ }
198
+ const entry = getRequireCacheItem(id);
199
+ if (!entry) {
200
+ delete _require.cache[id];
201
+ return;
202
+ }
203
+ if (entry.parent) {
204
+ entry.parent.children = entry.parent.children.filter((e) => e.id !== id);
205
+ }
206
+ for (const child of entry.children) {
207
+ clearRequireCache(child.id);
208
+ }
209
+ delete _require.cache[id];
210
+ }
211
+ function scanRequireTree(id, files = /* @__PURE__ */ new Set()) {
212
+ if (isNodeModules(id) || files.has(id)) {
213
+ return files;
214
+ }
215
+ const entry = getRequireCacheItem(id);
216
+ if (!entry) {
217
+ files.add(id);
218
+ return files;
219
+ }
220
+ files.add(entry.id);
221
+ for (const child of entry.children) {
222
+ scanRequireTree(child.id, files);
223
+ }
224
+ return files;
225
+ }
226
+ function getRequireCacheItem(id) {
227
+ try {
228
+ return _require.cache[id];
229
+ } catch (e) {
230
+ }
231
+ }
232
+ function requireModulePkg(id, opts = {}) {
233
+ return requireModule(join(id, "package.json"), opts);
234
+ }
235
+ function resolveModule(id, opts = {}) {
236
+ return normalize(_require.resolve(id, {
237
+ paths: [].concat(global.__NUXT_PREPATHS__, opts.paths, process.cwd(), global.__NUXT_PATHS__).filter(Boolean)
238
+ }));
239
+ }
240
+ function tryResolveModule(path, opts = {}) {
241
+ try {
242
+ return resolveModule(path, opts);
243
+ } catch (error) {
244
+ if (error.code !== "MODULE_NOT_FOUND") {
245
+ throw error;
246
+ }
247
+ }
248
+ return null;
249
+ }
250
+ function requireModule(id, opts = {}) {
251
+ const resolvedPath = resolveModule(id, opts);
252
+ if (opts.clearCache && !isNodeModules(id)) {
253
+ clearRequireCache(resolvedPath);
254
+ }
255
+ const requiredModule = _require(resolvedPath);
256
+ return requiredModule;
257
+ }
258
+ function importModule(id, opts = {}) {
259
+ const resolvedPath = resolveModule(id, opts);
260
+ if (opts.interopDefault !== false) {
261
+ return import(pathToFileURL(resolvedPath).href).then(interopDefault);
262
+ }
263
+ return import(pathToFileURL(resolvedPath).href);
264
+ }
265
+ function tryImportModule(id, opts = {}) {
266
+ try {
267
+ return importModule(id, opts).catch(() => void 0);
268
+ } catch {
269
+ }
270
+ }
271
+ function tryRequireModule(id, opts = {}) {
272
+ try {
273
+ return requireModule(id, opts);
274
+ } catch (e) {
275
+ }
276
+ }
277
+
278
+ function isIgnored(pathname) {
279
+ const nuxt = tryUseNuxt();
280
+ if (!nuxt) {
281
+ return null;
282
+ }
283
+ if (!nuxt._ignore) {
284
+ nuxt._ignore = ignore(nuxt.options.ignoreOptions);
285
+ nuxt._ignore.add(nuxt.options.ignore);
286
+ const nuxtignoreFile = join(nuxt.options.rootDir, ".nuxtignore");
287
+ if (existsSync(nuxtignoreFile)) {
288
+ nuxt._ignore.add(readFileSync(nuxtignoreFile, "utf-8"));
289
+ }
290
+ }
291
+ const relativePath = relative(nuxt.options.rootDir, pathname);
292
+ if (relativePath.startsWith("..")) {
293
+ return false;
294
+ }
295
+ return relativePath && nuxt._ignore.ignores(relativePath);
296
+ }
297
+
298
+ async function resolvePath(path, opts = {}) {
299
+ const _path = path;
300
+ path = normalize(path);
301
+ if (isAbsolute(path) && existsSync(path)) {
302
+ return path;
303
+ }
304
+ const nuxt = useNuxt();
305
+ const cwd = opts.cwd || (nuxt ? nuxt.options.rootDir : process.cwd());
306
+ const extensions = opts.extensions || (nuxt ? nuxt.options.extensions : [".ts", ".mjs", ".cjs", ".json"]);
307
+ const modulesDir = nuxt ? nuxt.options.modulesDir : [];
308
+ path = resolveAlias(path);
309
+ if (!isAbsolute(path)) {
310
+ path = resolve(cwd, path);
311
+ }
312
+ let isDirectory = false;
313
+ if (existsSync(path)) {
314
+ isDirectory = (await promises.lstat(path)).isDirectory();
315
+ if (!isDirectory) {
316
+ return path;
317
+ }
318
+ }
319
+ for (const ext of extensions) {
320
+ const pathWithExt = path + ext;
321
+ if (existsSync(pathWithExt)) {
322
+ return pathWithExt;
323
+ }
324
+ const pathWithIndex = join(path, "index" + ext);
325
+ if (isDirectory && existsSync(pathWithIndex)) {
326
+ return pathWithIndex;
327
+ }
328
+ }
329
+ const resolveModulePath = tryResolveModule(_path, { paths: [cwd, ...modulesDir] });
330
+ if (resolveModulePath) {
331
+ return resolveModulePath;
332
+ }
333
+ return path;
334
+ }
335
+ async function findPath(paths, opts, pathType = "file") {
336
+ if (!Array.isArray(paths)) {
337
+ paths = [paths];
338
+ }
339
+ for (const path of paths) {
340
+ const rPath = await resolvePath(path, opts);
341
+ if (await existsSensitive(rPath)) {
342
+ const isDirectory = (await promises.lstat(rPath)).isDirectory();
343
+ if (!pathType || pathType === "file" && !isDirectory || pathType === "dir" && isDirectory) {
344
+ return rPath;
345
+ }
346
+ }
347
+ }
348
+ return null;
349
+ }
350
+ function resolveAlias(path, alias) {
351
+ if (!alias) {
352
+ alias = tryUseNuxt()?.options.alias || {};
353
+ }
354
+ for (const key in alias) {
355
+ if (key === "@" && !path.startsWith("@/")) {
356
+ continue;
357
+ }
358
+ if (path.startsWith(key)) {
359
+ path = alias[key] + path.slice(key.length);
360
+ }
361
+ }
362
+ return path;
363
+ }
364
+ function createResolver(base) {
365
+ if (!base) {
366
+ throw new Error("`base` argument is missing for createResolver(base)!");
367
+ }
368
+ base = base.toString();
369
+ if (base.startsWith("file://")) {
370
+ base = dirname(fileURLToPath(base));
371
+ }
372
+ return {
373
+ resolve: (...path) => resolve(base, ...path),
374
+ resolvePath: (path, opts) => resolvePath(path, { cwd: base, ...opts })
375
+ };
376
+ }
377
+ async function existsSensitive(path) {
378
+ if (!existsSync(path)) {
379
+ return false;
380
+ }
381
+ const dirFiles = await promises.readdir(dirname(path));
382
+ return dirFiles.includes(basename(path));
383
+ }
384
+ async function resolveFiles(path, pattern) {
385
+ const files = await globby(pattern, { cwd: path, followSymbolicLinks: true });
386
+ return files.filter((p) => !isIgnored(p)).map((p) => resolve(path, p));
387
+ }
388
+
389
+ async function installModule(moduleToInstall, _inlineOptions, _nuxt) {
390
+ const nuxt = useNuxt();
391
+ const { nuxtModule, inlineOptions } = await normalizeModule(moduleToInstall, _inlineOptions);
392
+ await nuxtModule.call(useModuleContainer(), inlineOptions, nuxt);
393
+ nuxt.options._installedModules = nuxt.options._installedModules || [];
394
+ nuxt.options._installedModules.push({
395
+ meta: await nuxtModule.getMeta?.(),
396
+ entryPath: typeof moduleToInstall === "string" ? resolveAlias(moduleToInstall) : void 0
397
+ });
398
+ }
399
+ async function normalizeModule(nuxtModule, inlineOptions) {
400
+ const nuxt = useNuxt();
401
+ if (nuxtModule?._version || nuxtModule?.version || nuxtModule?.constructor?.version || "") {
402
+ [nuxtModule, inlineOptions] = [inlineOptions, {}];
403
+ console.warn(new Error("`installModule` is being called with old signature!"));
404
+ }
405
+ if (typeof nuxtModule === "string") {
406
+ const _src = resolveModule(resolveAlias(nuxtModule), { paths: nuxt.options.modulesDir });
407
+ const isESM = _src.endsWith(".mjs");
408
+ nuxtModule = isESM ? await importModule(_src) : requireModule(_src);
409
+ }
410
+ if (typeof nuxtModule !== "function") {
411
+ throw new TypeError("Nuxt module should be a function: " + nuxtModule);
412
+ }
413
+ return { nuxtModule, inlineOptions };
414
+ }
415
+
416
+ const MODULE_CONTAINER_KEY = "__module_container__";
417
+ function useModuleContainer(nuxt = useNuxt()) {
418
+ if (nuxt[MODULE_CONTAINER_KEY]) {
419
+ return nuxt[MODULE_CONTAINER_KEY];
420
+ }
421
+ async function requireModule(moduleOpts) {
422
+ let src, inlineOptions;
423
+ if (typeof moduleOpts === "string") {
424
+ src = moduleOpts;
425
+ } else if (Array.isArray(moduleOpts)) {
426
+ [src, inlineOptions] = moduleOpts;
427
+ } else if (typeof moduleOpts === "object") {
428
+ if (moduleOpts.src || moduleOpts.handler) {
429
+ src = moduleOpts.src || moduleOpts.handler;
430
+ inlineOptions = moduleOpts.options;
431
+ } else {
432
+ src = moduleOpts;
433
+ }
434
+ } else {
435
+ src = moduleOpts;
436
+ }
437
+ await installModule(src, inlineOptions);
438
+ }
439
+ nuxt[MODULE_CONTAINER_KEY] = {
440
+ nuxt,
441
+ options: nuxt.options,
442
+ ready() {
443
+ return Promise.resolve();
444
+ },
445
+ addVendor() {
446
+ },
447
+ requireModule,
448
+ addModule: requireModule,
449
+ addServerMiddleware,
450
+ addTemplate(template) {
451
+ if (typeof template === "string") {
452
+ template = { src: template };
453
+ }
454
+ if (template.write === void 0) {
455
+ template.write = true;
456
+ }
457
+ return addTemplate(template);
458
+ },
459
+ addPlugin(pluginTemplate) {
460
+ return addPluginTemplate(pluginTemplate);
461
+ },
462
+ addLayout(tmpl, name) {
463
+ const { filename, src } = addTemplate(tmpl);
464
+ const layoutName = name || parse(src).name;
465
+ const layout = nuxt.options.layouts[layoutName];
466
+ if (layout) {
467
+ logger.warn(`Duplicate layout registration, "${layoutName}" has been registered as "${layout}"`);
468
+ }
469
+ nuxt.options.layouts[layoutName] = `./${filename}`;
470
+ if (name === "error") {
471
+ this.addErrorLayout(filename);
472
+ }
473
+ },
474
+ addErrorLayout(dst) {
475
+ const relativeBuildDir = relative(nuxt.options.rootDir, nuxt.options.buildDir);
476
+ nuxt.options.ErrorPage = `~/${relativeBuildDir}/${dst}`;
477
+ },
478
+ extendBuild(fn) {
479
+ nuxt.options.build.extend = chainFn(nuxt.options.build.extend, fn);
480
+ if (!isNuxt2(nuxt)) {
481
+ console.warn("[kit] [compat] Using `extendBuild` in Nuxt 3 has no effect. Instead call extendWebpackConfig and extendViteConfig.");
482
+ }
483
+ },
484
+ extendRoutes(fn) {
485
+ if (isNuxt2(nuxt)) {
486
+ nuxt.options.router.extendRoutes = chainFn(nuxt.options.router.extendRoutes, fn);
487
+ } else {
488
+ nuxt.hook("pages:extend", async (pages, ...args) => {
489
+ const maybeRoutes = await fn(pages, ...args);
490
+ if (maybeRoutes) {
491
+ console.warn("[kit] [compat] Using `extendRoutes` in Nuxt 3 needs to directly modify first argument instead of returning updated routes. Skipping extended routes.");
492
+ }
493
+ });
494
+ }
495
+ }
496
+ };
497
+ return nuxt[MODULE_CONTAINER_KEY];
498
+ }
499
+
500
+ async function compileTemplate(template, ctx) {
501
+ const data = { ...ctx, options: template.options };
502
+ if (template.src) {
503
+ try {
504
+ const srcContents = await promises.readFile(template.src, "utf-8");
505
+ return lodashTemplate(srcContents, {})(data);
506
+ } catch (err) {
507
+ console.error("Error compiling template: ", template);
508
+ throw err;
509
+ }
510
+ }
511
+ if (template.getContents) {
512
+ return template.getContents(data);
513
+ }
514
+ throw new Error("Invalid template: " + JSON.stringify(template));
515
+ }
516
+ const serialize = (data) => JSON.stringify(data, null, 2).replace(/"{(.+)}"(?=,?$)/gm, (r) => JSON.parse(r).replace(/^{(.*)}$/, "$1"));
517
+ const importName = (src) => `${camelCase(basename(src, extname(src))).replace(/[^a-zA-Z?\d\s:]/g, "")}_${hash(src)}`;
518
+ const importSources = (sources, { lazy = false } = {}) => {
519
+ if (!Array.isArray(sources)) {
520
+ sources = [sources];
521
+ }
522
+ return sources.map((src) => {
523
+ if (lazy) {
524
+ return `const ${importName(src)} = ${genDynamicImport(src, { comment: `webpackChunkName: ${JSON.stringify(src)}` })}`;
525
+ }
526
+ return genImport(src, importName(src));
527
+ }).join("\n");
528
+ };
529
+ const templateUtils = { serialize, importName, importSources };
530
+
531
+ function defineNuxtModule(definition) {
532
+ if (typeof definition === "function") {
533
+ definition = definition(useNuxt());
534
+ logger.warn("Module definition as function is deprecated and will be removed in the future versions", definition);
535
+ }
536
+ if (!definition.meta) {
537
+ definition.meta = {};
538
+ }
539
+ if (!definition.meta.configKey) {
540
+ definition.meta.name = definition.meta.name || definition.name;
541
+ definition.meta.configKey = definition.meta.configKey || definition.configKey || definition.meta.name;
542
+ }
543
+ function getOptions(inlineOptions, nuxt = useNuxt()) {
544
+ const configKey = definition.meta.configKey || definition.meta.name;
545
+ const _defaults = definition.defaults instanceof Function ? definition.defaults(nuxt) : definition.defaults;
546
+ let _options = defu(inlineOptions, nuxt.options[configKey], _defaults);
547
+ if (definition.schema) {
548
+ _options = applyDefaults(definition.schema, _options);
549
+ }
550
+ return Promise.resolve(_options);
551
+ }
552
+ async function normalizedModule(inlineOptions, nuxt) {
553
+ if (!nuxt) {
554
+ nuxt = tryUseNuxt() || this.nuxt;
555
+ }
556
+ const uniqueKey = definition.meta.name || definition.meta.configKey;
557
+ if (uniqueKey) {
558
+ nuxt.options._requiredModules = nuxt.options._requiredModules || {};
559
+ if (nuxt.options._requiredModules[uniqueKey]) {
560
+ return;
561
+ }
562
+ nuxt.options._requiredModules[uniqueKey] = true;
563
+ }
564
+ if (definition.meta.compatibility) {
565
+ const issues = await checkNuxtCompatibility(definition.meta.compatibility, nuxt);
566
+ if (issues.length) {
567
+ logger.warn(`Module \`${definition.meta.name}\` is disabled due to incompatibility issues:
568
+ ${issues.toString()}`);
569
+ return;
570
+ }
571
+ }
572
+ nuxt2Shims(nuxt);
573
+ const _options = await getOptions(inlineOptions, nuxt);
574
+ if (definition.hooks) {
575
+ nuxt.hooks.addHooks(definition.hooks);
576
+ }
577
+ await definition.setup?.call(null, _options, nuxt);
578
+ }
579
+ normalizedModule.getMeta = () => Promise.resolve(definition.meta);
580
+ normalizedModule.getOptions = getOptions;
581
+ return normalizedModule;
582
+ }
583
+ const NUXT2_SHIMS_KEY = "__nuxt2_shims_key__";
584
+ function nuxt2Shims(nuxt) {
585
+ if (!isNuxt2(nuxt) || nuxt[NUXT2_SHIMS_KEY]) {
586
+ return;
587
+ }
588
+ nuxt[NUXT2_SHIMS_KEY] = true;
589
+ nuxt.hooks = nuxt;
590
+ if (!nuxtCtx.use()) {
591
+ nuxtCtx.set(nuxt);
592
+ nuxt.hook("close", () => nuxtCtx.unset());
593
+ }
594
+ let virtualTemplates;
595
+ nuxt.hook("builder:prepared", (_builder, buildOptions) => {
596
+ virtualTemplates = buildOptions.templates.filter((t) => t.getContents);
597
+ for (const template of virtualTemplates) {
598
+ buildOptions.templates.splice(buildOptions.templates.indexOf(template), 1);
599
+ }
600
+ });
601
+ nuxt.hook("build:templates", async (templates) => {
602
+ const context = {
603
+ nuxt,
604
+ utils: templateUtils,
605
+ app: {
606
+ dir: nuxt.options.srcDir,
607
+ extensions: nuxt.options.extensions,
608
+ plugins: nuxt.options.plugins,
609
+ templates: [
610
+ ...templates.templatesFiles,
611
+ ...virtualTemplates
612
+ ],
613
+ templateVars: templates.templateVars
614
+ }
615
+ };
616
+ for await (const template of virtualTemplates) {
617
+ const contents = await compileTemplate({ ...template, src: "" }, context);
618
+ await promises.mkdir(dirname(template.dst), { recursive: true });
619
+ await promises.writeFile(template.dst, contents);
620
+ }
621
+ });
622
+ }
623
+
624
+ async function loadNuxtConfig(opts) {
625
+ const { config: nuxtConfig, configFile, layers, cwd } = await loadConfig({
626
+ name: "nuxt",
627
+ configFile: "nuxt.config",
628
+ rcFile: ".nuxtrc",
629
+ dotenv: true,
630
+ globalRc: true,
631
+ ...opts
632
+ });
633
+ nuxtConfig.rootDir = nuxtConfig.rootDir || cwd;
634
+ nuxtConfig._nuxtConfigFile = configFile;
635
+ nuxtConfig._nuxtConfigFiles = [configFile];
636
+ for (const layer of layers) {
637
+ layer.config.rootDir = layer.config.rootDir ?? layer.cwd;
638
+ layer.config.srcDir = resolve(layer.config.rootDir, layer.config.srcDir);
639
+ }
640
+ nuxtConfig._layers = layers.filter((layer) => layer.configFile && !layer.configFile.endsWith(".nuxtrc"));
641
+ return applyDefaults(NuxtConfigSchema, nuxtConfig);
642
+ }
643
+
644
+ async function loadNuxt(opts) {
645
+ opts.cwd = opts.cwd || opts.rootDir;
646
+ opts.overrides = opts.overrides || opts.config || {};
647
+ const resolveOpts = { paths: opts.cwd };
648
+ opts.overrides.dev = !!opts.dev;
649
+ const nearestNuxtPkg = await Promise.all(["nuxt3", "nuxt", "nuxt-edge"].map((pkg2) => resolvePackageJSON(pkg2, { url: opts.cwd }).catch(() => null))).then((r) => r.filter(Boolean).sort((a, b) => b.length - a.length)[0]);
650
+ if (!nearestNuxtPkg) {
651
+ throw new Error(`Cannot find any nuxt version from ${opts.cwd}`);
652
+ }
653
+ const pkg = await readPackageJSON(nearestNuxtPkg);
654
+ const majorVersion = parseInt((pkg.version || "").split(".")[0]);
655
+ if (majorVersion === 3) {
656
+ const { loadNuxt: loadNuxt3 } = await importModule(pkg._name || pkg.name, resolveOpts);
657
+ const nuxt2 = await loadNuxt3(opts);
658
+ return nuxt2;
659
+ }
660
+ const { loadNuxt: loadNuxt2 } = await tryImportModule("nuxt-edge", resolveOpts) || await importModule("nuxt", resolveOpts);
661
+ const nuxt = await loadNuxt2({
662
+ rootDir: opts.cwd,
663
+ for: opts.dev ? "dev" : "build",
664
+ configOverrides: opts.overrides,
665
+ ready: opts.ready,
666
+ envConfig: opts.dotenv
667
+ });
668
+ return nuxt;
669
+ }
670
+ async function buildNuxt(nuxt) {
671
+ const resolveOpts = { paths: nuxt.options.rootDir };
672
+ if (nuxt.options._majorVersion === 3) {
673
+ const { build: build2 } = await tryImportModule("nuxt3", resolveOpts) || await importModule("nuxt", resolveOpts);
674
+ return build2(nuxt);
675
+ }
676
+ const { build } = await tryImportModule("nuxt-edge", resolveOpts) || await importModule("nuxt", resolveOpts);
677
+ return build(nuxt);
678
+ }
679
+
680
+ function addAutoImport(imports) {
681
+ assertNuxtCompatibility({ bridge: true });
682
+ useNuxt().hook("autoImports:extend", (autoImports) => {
683
+ autoImports.push(...Array.isArray(imports) ? imports : [imports]);
684
+ });
685
+ }
686
+ function addAutoImportDir(_autoImportDirs) {
687
+ assertNuxtCompatibility({ bridge: true });
688
+ useNuxt().hook("autoImports:dirs", (autoImportDirs) => {
689
+ for (const dir of Array.isArray(_autoImportDirs) ? _autoImportDirs : [_autoImportDirs]) {
690
+ autoImportDirs.push(dir);
691
+ }
692
+ });
693
+ }
694
+
695
+ function extendWebpackConfig(fn, options = {}) {
696
+ const nuxt = useNuxt();
697
+ if (options.dev === false && nuxt.options.dev) {
698
+ return;
699
+ }
700
+ if (options.build === false && nuxt.options.build) {
701
+ return;
702
+ }
703
+ nuxt.hook("webpack:config", (configs) => {
704
+ if (options.server !== false) {
705
+ const config = configs.find((i) => i.name === "server");
706
+ if (config) {
707
+ fn(config);
708
+ }
709
+ }
710
+ if (options.client !== false) {
711
+ const config = configs.find((i) => i.name === "client");
712
+ if (config) {
713
+ fn(config);
714
+ }
715
+ }
716
+ if (options.modern !== false) {
717
+ const config = configs.find((i) => i.name === "modern");
718
+ if (config) {
719
+ fn(config);
720
+ }
721
+ }
722
+ });
723
+ }
724
+ function extendViteConfig(fn, options = {}) {
725
+ const nuxt = useNuxt();
726
+ if (options.dev === false && nuxt.options.dev) {
727
+ return;
728
+ }
729
+ if (options.build === false && nuxt.options.build) {
730
+ return;
731
+ }
732
+ nuxt.hook("vite:extend", ({ config }) => fn(config));
733
+ }
734
+ function addWebpackPlugin(plugin, options) {
735
+ extendWebpackConfig((config) => {
736
+ config.plugins = config.plugins || [];
737
+ config.plugins.push(plugin);
738
+ }, options);
739
+ }
740
+ function addVitePlugin(plugin, options) {
741
+ extendViteConfig((config) => {
742
+ config.plugins = config.plugins || [];
743
+ config.plugins.push(plugin);
744
+ }, options);
745
+ }
746
+
747
+ async function addComponentsDir(dir) {
748
+ const nuxt = useNuxt();
749
+ await assertNuxtCompatibility({ nuxt: ">=2.13" }, nuxt);
750
+ nuxt.options.components = nuxt.options.components || [];
751
+ nuxt.hook("components:dirs", (dirs) => {
752
+ dirs.push(dir);
753
+ });
754
+ }
755
+ async function addComponent(opts) {
756
+ const nuxt = useNuxt();
757
+ await assertNuxtCompatibility({ nuxt: ">=2.13" }, nuxt);
758
+ nuxt.options.components = nuxt.options.components || [];
759
+ const component = {
760
+ export: opts.export || "default",
761
+ chunkName: "components/" + kebabCase(opts.name),
762
+ global: opts.global ?? false,
763
+ kebabName: kebabCase(opts.name || ""),
764
+ pascalName: pascalCase(opts.name || ""),
765
+ prefetch: false,
766
+ preload: false,
767
+ mode: "all",
768
+ shortPath: opts.filePath,
769
+ async: false,
770
+ level: 0,
771
+ asyncImport: `${genDynamicImport(opts.filePath)}.then(r => r['${opts.export || "default"}'])`,
772
+ import: `require(${JSON.stringify(opts.filePath)})['${opts.export || "default"}']`,
773
+ ...opts
774
+ };
775
+ nuxt.hook("components:extend", (components) => {
776
+ const existingComponent = components.find((c) => c.pascalName === component.pascalName || c.kebabName === component.kebabName);
777
+ if (existingComponent) {
778
+ const name = existingComponent.pascalName || existingComponent.kebabName;
779
+ console.warn(`Overriding ${name} component.`);
780
+ Object.assign(existingComponent, component);
781
+ } else {
782
+ components.push(component);
783
+ }
784
+ });
785
+ }
786
+
787
+ function extendPages(cb) {
788
+ const nuxt = useNuxt();
789
+ if (isNuxt2(nuxt)) {
790
+ nuxt.hook("build:extendRoutes", cb);
791
+ } else {
792
+ nuxt.hook("pages:extend", cb);
793
+ }
794
+ }
795
+
796
+ export { addAutoImport, addAutoImportDir, addComponent, addComponentsDir, addPlugin, addPluginTemplate, 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, useNuxt };
package/package.json CHANGED
@@ -1,19 +1,43 @@
1
1
  {
2
2
  "name": "@nuxt/kit",
3
- "version": "0.8.1-edge",
3
+ "version": "3.0.0-rc.0",
4
+ "repository": "nuxt/framework",
4
5
  "license": "MIT",
5
- "main": "./lib/index.mjs",
6
- "types": "./lib/index.d.ts",
7
6
  "type": "module",
8
- "exports": {
9
- ".": {
10
- "import": "./lib/index.mjs"
11
- }
12
- },
7
+ "main": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
13
9
  "files": [
14
- "lib"
10
+ "dist"
15
11
  ],
12
+ "scripts": {
13
+ "prepack": "unbuild"
14
+ },
16
15
  "dependencies": {
17
- "@nuxt/kit-edge": "latest"
16
+ "@nuxt/schema": "3.0.0-rc.0",
17
+ "c12": "^0.2.5",
18
+ "consola": "^2.15.3",
19
+ "defu": "^6.0.0",
20
+ "globby": "^13.1.1",
21
+ "hash-sum": "^2.0.0",
22
+ "ignore": "^5.2.0",
23
+ "jiti": "^1.13.0",
24
+ "knitwork": "^0.1.1",
25
+ "lodash.template": "^4.5.0",
26
+ "mlly": "^0.5.2",
27
+ "pathe": "^0.2.0",
28
+ "pkg-types": "^0.3.2",
29
+ "scule": "^0.2.1",
30
+ "semver": "^7.3.7",
31
+ "unctx": "^1.1.4",
32
+ "unimport": "^0.1.6",
33
+ "untyped": "^0.4.4"
34
+ },
35
+ "devDependencies": {
36
+ "@types/lodash.template": "^4",
37
+ "@types/semver": "^7",
38
+ "unbuild": "latest"
39
+ },
40
+ "engines": {
41
+ "node": "^14.16.0 || ^16.11.0 || ^17.0.0 || ^18.0.0"
18
42
  }
19
43
  }
package/lib/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from '@nuxt/kit-edge'
package/lib/index.mjs DELETED
@@ -1 +0,0 @@
1
- export * from '@nuxt/kit-edge'