@nuxt/kit-nightly 4.6.0-29843345.e2eb0b5e → 4.6.0-29843569.8cf90bcd
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.mjs
CHANGED
|
@@ -233,7 +233,7 @@ async function getNuxtModuleVersion(module, nuxt = useNuxt()) {
|
|
|
233
233
|
return false;
|
|
234
234
|
}
|
|
235
235
|
//#endregion
|
|
236
|
-
//#region ../../node_modules/.pnpm/c12@4.0.0-rc.
|
|
236
|
+
//#region ../../node_modules/.pnpm/c12@4.0.0-rc.2_dotenv@18.0.4_giget@3.3.1_jiti@2.7.0_magicast@0.5.4/node_modules/c12/dist/index.mjs
|
|
237
237
|
async function setupDotenv(options) {
|
|
238
238
|
const targetEnvironment = options.env ?? process.env;
|
|
239
239
|
const environment = await loadDotenv({
|
|
@@ -241,7 +241,8 @@ async function setupDotenv(options) {
|
|
|
241
241
|
fileName: options.fileName ?? ".env",
|
|
242
242
|
env: targetEnvironment,
|
|
243
243
|
interpolate: options.interpolate ?? true,
|
|
244
|
-
expandFileReferences: options.expandFileReferences ?? false
|
|
244
|
+
expandFileReferences: options.expandFileReferences ?? false,
|
|
245
|
+
parse: options.parse
|
|
245
246
|
});
|
|
246
247
|
const dotenvVars = getDotEnvVars(targetEnvironment);
|
|
247
248
|
for (const key in environment) {
|
|
@@ -260,7 +261,7 @@ async function loadDotenv(options) {
|
|
|
260
261
|
for (const file of dotenvFiles) {
|
|
261
262
|
const dotenvFile = resolve(cwd, file);
|
|
262
263
|
if (!statSync(dotenvFile, { throwIfNoEntry: false })?.isFile()) continue;
|
|
263
|
-
const parsed = await readEnvFile(dotenvFile);
|
|
264
|
+
const parsed = await readEnvFile(dotenvFile, options.parse);
|
|
264
265
|
for (const key in parsed) {
|
|
265
266
|
if (key in environment && !dotenvVars.has(key)) continue;
|
|
266
267
|
environment[key] = parsed[key];
|
|
@@ -283,13 +284,14 @@ async function loadDotenv(options) {
|
|
|
283
284
|
return environment;
|
|
284
285
|
}
|
|
285
286
|
let _parseEnv = nodeUtil.parseEnv;
|
|
286
|
-
async function readEnvFile(path) {
|
|
287
|
+
async function readEnvFile(path, parse) {
|
|
287
288
|
const src = readFileSync(path, "utf8");
|
|
289
|
+
if (parse) return parse(src);
|
|
288
290
|
if (!_parseEnv) try {
|
|
289
291
|
const dotenv = await import("dotenv");
|
|
290
292
|
_parseEnv = (src) => dotenv.parse(src);
|
|
291
293
|
} catch {
|
|
292
|
-
throw new Error("Failed to parse .env file: `node:util.parseEnv` is not available and `dotenv` package is not installed. Please upgrade your runtime
|
|
294
|
+
throw new Error("Failed to parse .env file: `node:util.parseEnv` is not available and `dotenv` package is not installed. Please upgrade your runtime, install `dotenv` as a dependency or provide a custom `parse` option.");
|
|
293
295
|
}
|
|
294
296
|
return _parseEnv(src);
|
|
295
297
|
}
|
|
@@ -299,28 +301,107 @@ function interpolate(target, source = {}, parse = (v) => v) {
|
|
|
299
301
|
}
|
|
300
302
|
function interpolate(value, parents = []) {
|
|
301
303
|
if (typeof value !== "string") return value;
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
if (
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
304
|
+
let result = "";
|
|
305
|
+
let index = 0;
|
|
306
|
+
while (index < value.length) {
|
|
307
|
+
const char = value[index];
|
|
308
|
+
if (char === "\\" && value[index + 1] === "$") {
|
|
309
|
+
result += "$";
|
|
310
|
+
index += 2;
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
const ref = char === "$" ? parseRef(value, index) : void 0;
|
|
314
|
+
if (!ref) {
|
|
315
|
+
result += char;
|
|
316
|
+
index++;
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
if (parents.includes(ref.key)) {
|
|
320
|
+
if (ref.defaultValue !== void 0) {
|
|
321
|
+
result += interpolate(ref.defaultValue, parents);
|
|
322
|
+
index = ref.end;
|
|
323
|
+
continue;
|
|
315
324
|
}
|
|
316
|
-
|
|
317
|
-
|
|
325
|
+
console.warn(`Please avoid recursive environment variables ( loop: ${parents.join(" > ")} > ${ref.key} )`);
|
|
326
|
+
return "";
|
|
318
327
|
}
|
|
319
|
-
|
|
320
|
-
|
|
328
|
+
let resolved = interpolate(getValue(ref.key), [...parents, ref.key]);
|
|
329
|
+
if (ref.defaultValue !== void 0 && (resolved === void 0 || ref.operator === ":-" && resolved === "")) resolved = interpolate(ref.defaultValue, parents);
|
|
330
|
+
result += resolved === void 0 ? value.slice(index, ref.end) : resolved;
|
|
331
|
+
index = ref.end;
|
|
332
|
+
}
|
|
333
|
+
return parse(result);
|
|
321
334
|
}
|
|
322
335
|
for (const key in target) target[key] = interpolate(getValue(key));
|
|
323
336
|
}
|
|
337
|
+
const REF_NAME_RE = /\w+/y;
|
|
338
|
+
const BRACED_REF_NAME_RE = /[\w:]+/y;
|
|
339
|
+
function parseRef(input, start) {
|
|
340
|
+
let index = start + 1;
|
|
341
|
+
const braced = input[index] === "{";
|
|
342
|
+
if (braced) index++;
|
|
343
|
+
const nameRe = braced ? BRACED_REF_NAME_RE : REF_NAME_RE;
|
|
344
|
+
nameRe.lastIndex = index;
|
|
345
|
+
const name = nameRe.exec(input);
|
|
346
|
+
if (!name) return;
|
|
347
|
+
let key = name[0];
|
|
348
|
+
index = nameRe.lastIndex;
|
|
349
|
+
if (!braced) return {
|
|
350
|
+
key,
|
|
351
|
+
end: index
|
|
352
|
+
};
|
|
353
|
+
if (input[index] === "}") return {
|
|
354
|
+
key,
|
|
355
|
+
end: index + 1
|
|
356
|
+
};
|
|
357
|
+
if (input[index] === "-") {
|
|
358
|
+
let operator = "-";
|
|
359
|
+
if (key.endsWith(":")) {
|
|
360
|
+
key = key.slice(0, -1);
|
|
361
|
+
operator = ":-";
|
|
362
|
+
}
|
|
363
|
+
const defaultValue = key ? readDefault(input, index + 1) : void 0;
|
|
364
|
+
if (!defaultValue) return;
|
|
365
|
+
return {
|
|
366
|
+
key,
|
|
367
|
+
operator,
|
|
368
|
+
defaultValue: defaultValue.value,
|
|
369
|
+
end: defaultValue.end
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
return {
|
|
373
|
+
key,
|
|
374
|
+
end: index
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
function readDefault(input, start) {
|
|
378
|
+
let value = "";
|
|
379
|
+
let depth = 1;
|
|
380
|
+
for (let index = start; index < input.length; index++) {
|
|
381
|
+
const char = input[index];
|
|
382
|
+
if (char === "\\" && index + 1 < input.length) {
|
|
383
|
+
const next = input[index + 1];
|
|
384
|
+
value += next === "{" || next === "}" ? next : char + next;
|
|
385
|
+
index++;
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
if (char === "$" && input[index + 1] === "{") {
|
|
389
|
+
depth++;
|
|
390
|
+
value += "${";
|
|
391
|
+
index++;
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
if (char === "{") depth++;
|
|
395
|
+
if (char === "}") {
|
|
396
|
+
depth--;
|
|
397
|
+
if (depth === 0) return {
|
|
398
|
+
value,
|
|
399
|
+
end: index + 1
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
value += char;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
324
405
|
function getDotEnvVars(targetEnvironment) {
|
|
325
406
|
const globalRegistry = globalThis.__c12_dotenv_vars__ ||= /* @__PURE__ */ new Map();
|
|
326
407
|
if (!globalRegistry.has(targetEnvironment)) globalRegistry.set(targetEnvironment, /* @__PURE__ */ new Set());
|
|
@@ -456,6 +537,7 @@ async function loadConfig(options) {
|
|
|
456
537
|
for (const key in r.config) if (key.startsWith("$")) delete r.config[key];
|
|
457
538
|
}
|
|
458
539
|
if (options.configFileRequired && !r._configFile) throw new Error(`Required config (${r.configFile}) cannot be resolved.`);
|
|
540
|
+
if (options.schema != null) r.config = await validateConfig(r.config, options.schema);
|
|
459
541
|
return r;
|
|
460
542
|
}
|
|
461
543
|
async function extendConfig(config, options) {
|
|
@@ -520,7 +602,7 @@ async function resolveConfig(source, options, sourceOptions = {}) {
|
|
|
520
602
|
const { downloadTemplate } = await import("giget").catch((error) => {
|
|
521
603
|
throw new Error(`Extending config from \`${source}\` requires \`giget\` peer dependency to be installed.\n\nInstall it with: \`npx nypm i giget\``, { cause: error });
|
|
522
604
|
});
|
|
523
|
-
const { digest } = await import("./ohash-
|
|
605
|
+
const { digest } = await import("./ohash-CoyG-I2s.mjs").then((n) => n.dist_exports);
|
|
524
606
|
const cloneName = source.replace(/\W+/g, "_").split("_").splice(0, 3).join("_") + "_" + digest(source).slice(0, 10).replace(/[-_]/g, "");
|
|
525
607
|
let cloneDir;
|
|
526
608
|
const localNodeModules = resolve(options.cwd, "node_modules");
|
|
@@ -578,13 +660,9 @@ async function resolveConfig(source, options, sourceOptions = {}) {
|
|
|
578
660
|
}
|
|
579
661
|
}
|
|
580
662
|
if (typeof res.config === "function") res.config = await res.config(options.context);
|
|
581
|
-
if (
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
...res.config.$env?.[options.envName]
|
|
585
|
-
};
|
|
586
|
-
if (Object.keys(envConfig).length > 0) res.config = _merger(envConfig, res.config);
|
|
587
|
-
}
|
|
663
|
+
if (res.config && typeof res.config === "object" && !Array.isArray(res.config) && !Object.isExtensible(res.config)) res.config = { ...res.config };
|
|
664
|
+
const envConfigs = (Array.isArray(options.envName) ? options.envName : [options.envName]).filter(Boolean).reverse().flatMap((envName) => [res.config.$env?.[envName], res.config["$" + envName]]).filter((c) => c && Object.keys(c).length > 0);
|
|
665
|
+
if (envConfigs.length > 0) res.config = (options.envMerger || _merger)({}, ...envConfigs, res.config);
|
|
588
666
|
res.meta = defu(res.sourceOptions.meta, res.config.$meta);
|
|
589
667
|
delete res.config.$meta;
|
|
590
668
|
if (res.sourceOptions.overrides) res.config = _merger(res.sourceOptions.overrides, res.config);
|
|
@@ -592,6 +670,18 @@ async function resolveConfig(source, options, sourceOptions = {}) {
|
|
|
592
670
|
res.source = _normalize(res.source);
|
|
593
671
|
return res;
|
|
594
672
|
}
|
|
673
|
+
async function validateConfig(config, schema) {
|
|
674
|
+
if (typeof schema?.["~standard"]?.validate !== "function") throw new TypeError("Invalid `schema` option: expected a Standard Schema (https://standardschema.dev).");
|
|
675
|
+
const result = await schema["~standard"].validate(config);
|
|
676
|
+
if (result.issues) {
|
|
677
|
+
const messages = result.issues.map((issue) => {
|
|
678
|
+
const path = issue.path?.map((p) => String(typeof p === "object" ? p.key : p)).join(".");
|
|
679
|
+
return ` - ${path ? `${path}: ` : ""}${issue.message}`;
|
|
680
|
+
});
|
|
681
|
+
throw new Error(`Config validation failed (${schema["~standard"].vendor}):\n${messages.join("\n")}`, { cause: result.issues });
|
|
682
|
+
}
|
|
683
|
+
return result.value;
|
|
684
|
+
}
|
|
595
685
|
function tryResolve(id, options) {
|
|
596
686
|
const res = resolveModulePath(id, {
|
|
597
687
|
try: true,
|
|
@@ -168,7 +168,7 @@ export declare const buildDiagnostics: import("nostics").Diagnostics<{
|
|
|
168
168
|
};
|
|
169
169
|
}, readonly [import("nostics").DiagnosticReporter<{
|
|
170
170
|
method?: import("nostics").ConsoleMethod;
|
|
171
|
-
}>]>;
|
|
171
|
+
}, any>], never>;
|
|
172
172
|
//#endregion
|
|
173
173
|
//#region src/diagnostics/plugins.d.ts
|
|
174
174
|
/**
|
|
@@ -264,7 +264,7 @@ export declare const pluginDiagnostics: import("nostics").Diagnostics<{
|
|
|
264
264
|
};
|
|
265
265
|
}, readonly [import("nostics").DiagnosticReporter<{
|
|
266
266
|
method?: import("nostics").ConsoleMethod;
|
|
267
|
-
}>]>;
|
|
267
|
+
}, any>], never>;
|
|
268
268
|
//#endregion
|
|
269
269
|
//#region src/diagnostics/components.d.ts
|
|
270
270
|
/**
|
|
@@ -381,7 +381,7 @@ export declare const componentDiagnostics: import("nostics").Diagnostics<{
|
|
|
381
381
|
};
|
|
382
382
|
}, readonly [import("nostics").DiagnosticReporter<{
|
|
383
383
|
method?: import("nostics").ConsoleMethod;
|
|
384
|
-
}>]>;
|
|
384
|
+
}, any>], never>;
|
|
385
385
|
//#endregion
|
|
386
386
|
//#region src/diagnostics/pages.d.ts
|
|
387
387
|
/**
|
|
@@ -555,7 +555,7 @@ export declare const pageDiagnostics: import("nostics").Diagnostics<{
|
|
|
555
555
|
};
|
|
556
556
|
}, readonly [import("nostics").DiagnosticReporter<{
|
|
557
557
|
method?: import("nostics").ConsoleMethod;
|
|
558
|
-
}>]>;
|
|
558
|
+
}, any>], never>;
|
|
559
559
|
//#endregion
|
|
560
560
|
//#region src/diagnostics/config.d.ts
|
|
561
561
|
/**
|
|
@@ -721,7 +721,7 @@ export declare const configDiagnostics: import("nostics").Diagnostics<{
|
|
|
721
721
|
};
|
|
722
722
|
}, readonly [import("nostics").DiagnosticReporter<{
|
|
723
723
|
method?: import("nostics").ConsoleMethod;
|
|
724
|
-
}>]>;
|
|
724
|
+
}, any>], never>;
|
|
725
725
|
//#endregion
|
|
726
726
|
//#region src/diagnostics/head.d.ts
|
|
727
727
|
/**
|
|
@@ -769,7 +769,7 @@ export declare const headDiagnostics: import("nostics").Diagnostics<{
|
|
|
769
769
|
};
|
|
770
770
|
}, readonly [import("nostics").DiagnosticReporter<{
|
|
771
771
|
method?: import("nostics").ConsoleMethod;
|
|
772
|
-
}>]>;
|
|
772
|
+
}, any>], never>;
|
|
773
773
|
//#endregion
|
|
774
774
|
//#region src/diagnostics/bundler.d.ts
|
|
775
775
|
/**
|
|
@@ -958,7 +958,7 @@ export declare const bundlerDiagnostics: import("nostics").Diagnostics<{
|
|
|
958
958
|
};
|
|
959
959
|
}, readonly [import("nostics").DiagnosticReporter<{
|
|
960
960
|
method?: import("nostics").ConsoleMethod;
|
|
961
|
-
}>]>;
|
|
961
|
+
}, any>], never>;
|
|
962
962
|
//#endregion
|
|
963
963
|
//#region src/internal/pending-templates.d.ts
|
|
964
964
|
/** @internal */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
//#region ../../node_modules/.pnpm/c12@4.0.0-rc.
|
|
2
|
+
//#region ../../node_modules/.pnpm/c12@4.0.0-rc.2_dotenv@18.0.4_giget@3.3.1_jiti@2.7.0_magicast@0.5.4/node_modules/c12/dist/_chunks/libs/ohash.mjs
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __exportAll = (all, no_symbols) => {
|
|
5
5
|
let target = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/kit-nightly",
|
|
3
|
-
"version": "4.6.0-
|
|
3
|
+
"version": "4.6.0-29843569.8cf90bcd",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"destr": "^2.0.5",
|
|
33
33
|
"errx": "^0.2.2",
|
|
34
34
|
"exsolve": "^1.1.1",
|
|
35
|
-
"ignore": "^7.0.
|
|
35
|
+
"ignore": "^7.0.10",
|
|
36
36
|
"klona": "^2.0.6",
|
|
37
37
|
"microdiff": "^1.6.0",
|
|
38
|
-
"nostics": "^1.
|
|
38
|
+
"nostics": "^1.3.0",
|
|
39
39
|
"nypm": "^0.6.10",
|
|
40
40
|
"pathe": "^2.0.3",
|
|
41
41
|
"rc9": "^3.1.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"verkit": "^0.5.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.6.0-
|
|
49
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.6.0-29843569.8cf90bcd",
|
|
50
50
|
"confbox": ">=0.1.0",
|
|
51
51
|
"dotenv": "*",
|
|
52
52
|
"giget": ">=3.1.0",
|
|
@@ -82,11 +82,11 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.6.0-
|
|
86
|
-
"c12": "4.0.0-rc.
|
|
85
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.6.0-29843569.8cf90bcd",
|
|
86
|
+
"c12": "4.0.0-rc.2",
|
|
87
87
|
"chokidar": "^5.0.0",
|
|
88
88
|
"confbox": "^0.3.1",
|
|
89
|
-
"dotenv": "^18.0.
|
|
89
|
+
"dotenv": "^18.0.4",
|
|
90
90
|
"giget": "^3.3.1",
|
|
91
91
|
"hookable": "^6.1.2",
|
|
92
92
|
"jiti": "^2.7.0",
|
|
@@ -97,13 +97,13 @@
|
|
|
97
97
|
"tsdown": "0.23.0",
|
|
98
98
|
"untyped": "^2.0.0",
|
|
99
99
|
"vite": "^8.3.1",
|
|
100
|
-
"vitest": "5.0.
|
|
100
|
+
"vitest": "5.0.2"
|
|
101
101
|
},
|
|
102
102
|
"engines": {
|
|
103
103
|
"node": "^20.19.0 || >=22.12.0"
|
|
104
104
|
},
|
|
105
105
|
"inlinedDependencies": {
|
|
106
|
-
"c12": "4.0.0-rc.
|
|
106
|
+
"c12": "4.0.0-rc.2",
|
|
107
107
|
"pkg-types": "2.3.3",
|
|
108
108
|
"untyped": "2.0.0"
|
|
109
109
|
},
|