@nuxt/kit 3.0.0-rc.3 → 3.0.0-rc.4
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/dist/index.d.ts +2 -1
- package/dist/index.mjs +10 -11
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import * as unctx from 'unctx';
|
|
|
7
7
|
import { Middleware } from 'h3';
|
|
8
8
|
import { NitroEventHandler, NitroDevEventHandler } from 'nitropack';
|
|
9
9
|
import * as consola from 'consola';
|
|
10
|
+
import { genSafeVariableName } from 'knitwork';
|
|
10
11
|
|
|
11
12
|
declare function useModuleContainer(nuxt?: Nuxt): ModuleContainer;
|
|
12
13
|
|
|
@@ -299,7 +300,7 @@ declare function tryRequireModule(id: string, opts?: RequireModuleOptions): any;
|
|
|
299
300
|
declare function compileTemplate(template: NuxtTemplate, ctx: any): Promise<string>;
|
|
300
301
|
declare const templateUtils: {
|
|
301
302
|
serialize: (data: any) => string;
|
|
302
|
-
importName:
|
|
303
|
+
importName: typeof genSafeVariableName;
|
|
303
304
|
importSources: (sources: string | string[], { lazy }?: {
|
|
304
305
|
lazy?: boolean;
|
|
305
306
|
}) => string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parse, basename, resolve, normalize, join, relative, isAbsolute, dirname
|
|
1
|
+
import { parse, basename, resolve, normalize, join, relative, isAbsolute, dirname } from 'pathe';
|
|
2
2
|
import consola from 'consola';
|
|
3
3
|
import { existsSync, readFileSync, promises } from 'node:fs';
|
|
4
4
|
import hash from 'hash-sum';
|
|
@@ -12,11 +12,11 @@ import ignore from 'ignore';
|
|
|
12
12
|
import defu from 'defu';
|
|
13
13
|
import { applyDefaults } from 'untyped';
|
|
14
14
|
import lodashTemplate from 'lodash.template';
|
|
15
|
-
import {
|
|
16
|
-
import { genDynamicImport, genImport } from 'knitwork';
|
|
15
|
+
import { genSafeVariableName, genDynamicImport, genImport } from 'knitwork';
|
|
17
16
|
import { loadConfig } from 'c12';
|
|
18
17
|
import { NuxtConfigSchema } from '@nuxt/schema';
|
|
19
18
|
import { resolvePackageJSON, readPackageJSON } from 'pkg-types';
|
|
19
|
+
import { kebabCase, pascalCase } from 'scule';
|
|
20
20
|
|
|
21
21
|
const logger = consola;
|
|
22
22
|
function useLogger(scope) {
|
|
@@ -119,7 +119,7 @@ async function checkNuxtCompatibility(constraints, nuxt = useNuxt()) {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
if (isNuxt2(nuxt)) {
|
|
122
|
-
const bridgeRequirement = constraints
|
|
122
|
+
const bridgeRequirement = constraints.bridge;
|
|
123
123
|
const hasBridge = !!nuxt.options.bridge;
|
|
124
124
|
if (bridgeRequirement === true && !hasBridge) {
|
|
125
125
|
issues.push({
|
|
@@ -157,7 +157,7 @@ function isNuxt3(nuxt = useNuxt()) {
|
|
|
157
157
|
function getNuxtVersion(nuxt = useNuxt()) {
|
|
158
158
|
const version = (nuxt?._version || nuxt?.version || nuxt?.constructor?.version || "").replace(/^v/g, "");
|
|
159
159
|
if (!version) {
|
|
160
|
-
throw new Error("Cannot determine nuxt version! Is
|
|
160
|
+
throw new Error("Cannot determine nuxt version! Is current instance passed?");
|
|
161
161
|
}
|
|
162
162
|
return version;
|
|
163
163
|
}
|
|
@@ -389,7 +389,7 @@ async function existsSensitive(path) {
|
|
|
389
389
|
}
|
|
390
390
|
async function resolveFiles(path, pattern) {
|
|
391
391
|
const files = await globby(pattern, { cwd: path, followSymbolicLinks: true });
|
|
392
|
-
return files.
|
|
392
|
+
return files.map((p) => resolve(path, p)).filter((p) => !isIgnored(p));
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
async function installModule(moduleToInstall, _inlineOptions, _nuxt) {
|
|
@@ -520,19 +520,18 @@ async function compileTemplate(template, ctx) {
|
|
|
520
520
|
throw new Error("Invalid template: " + JSON.stringify(template));
|
|
521
521
|
}
|
|
522
522
|
const serialize = (data) => JSON.stringify(data, null, 2).replace(/"{(.+)}"(?=,?$)/gm, (r) => JSON.parse(r).replace(/^{(.*)}$/, "$1"));
|
|
523
|
-
const importName = (src) => `${camelCase(basename(src, extname(src))).replace(/[^a-zA-Z?\d\s:]/g, "")}_${hash(src)}`;
|
|
524
523
|
const importSources = (sources, { lazy = false } = {}) => {
|
|
525
524
|
if (!Array.isArray(sources)) {
|
|
526
525
|
sources = [sources];
|
|
527
526
|
}
|
|
528
527
|
return sources.map((src) => {
|
|
529
528
|
if (lazy) {
|
|
530
|
-
return `const ${
|
|
529
|
+
return `const ${genSafeVariableName(src)} = ${genDynamicImport(src, { comment: `webpackChunkName: ${JSON.stringify(src)}` })}`;
|
|
531
530
|
}
|
|
532
|
-
return genImport(src,
|
|
531
|
+
return genImport(src, genSafeVariableName(src));
|
|
533
532
|
}).join("\n");
|
|
534
533
|
};
|
|
535
|
-
const templateUtils = { serialize, importName, importSources };
|
|
534
|
+
const templateUtils = { serialize, importName: genSafeVariableName, importSources };
|
|
536
535
|
|
|
537
536
|
function defineNuxtModule(definition) {
|
|
538
537
|
if (typeof definition === "function") {
|
|
@@ -544,7 +543,7 @@ function defineNuxtModule(definition) {
|
|
|
544
543
|
}
|
|
545
544
|
if (!definition.meta.configKey) {
|
|
546
545
|
definition.meta.name = definition.meta.name || definition.name;
|
|
547
|
-
definition.meta.configKey = definition.
|
|
546
|
+
definition.meta.configKey = definition.configKey || definition.meta.name;
|
|
548
547
|
}
|
|
549
548
|
function getOptions(inlineOptions, nuxt = useNuxt()) {
|
|
550
549
|
const configKey = definition.meta.configKey || definition.meta.name;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/kit",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.4",
|
|
4
4
|
"repository": "nuxt/framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
"prepack": "unbuild"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@nuxt/schema": "^3.0.0-rc.
|
|
16
|
+
"@nuxt/schema": "^3.0.0-rc.4",
|
|
17
17
|
"c12": "^0.2.7",
|
|
18
18
|
"consola": "^2.15.3",
|
|
19
19
|
"defu": "^6.0.0",
|
|
20
|
-
"globby": "^13.1.
|
|
20
|
+
"globby": "^13.1.2",
|
|
21
21
|
"hash-sum": "^2.0.0",
|
|
22
22
|
"ignore": "^5.2.0",
|
|
23
23
|
"jiti": "^1.13.0",
|
|
24
|
-
"knitwork": "^0.1.
|
|
24
|
+
"knitwork": "^0.1.2",
|
|
25
25
|
"lodash.template": "^4.5.0",
|
|
26
26
|
"mlly": "^0.5.2",
|
|
27
27
|
"pathe": "^0.3.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"scule": "^0.2.1",
|
|
30
30
|
"semver": "^7.3.7",
|
|
31
31
|
"unctx": "^1.1.4",
|
|
32
|
-
"unimport": "^0.
|
|
32
|
+
"unimport": "^0.2.7",
|
|
33
33
|
"untyped": "^0.4.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|