@nuxt/kit-nightly 5.0.0-29778218.1397500a → 5.0.0-29778506.75ed8ed2
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.mts +24 -7
- package/dist/index.mjs +47 -9
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -145,14 +145,31 @@ interface LoadNuxtConfigOptions {
|
|
|
145
145
|
*/
|
|
146
146
|
onConfigResolved?: (context: ResolvedNuxtConfigContext) => void | Promise<void>;
|
|
147
147
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
148
|
+
interface NuxtConfigDiffLocation {
|
|
149
|
+
/**
|
|
150
|
+
* Property path of the changed value, with array indices as numbers: `['modules']`,
|
|
151
|
+
* `['runtimeConfig', 'public', 'foo']`, `['modules', 0]`. Prefer this over {@link label} when
|
|
152
|
+
* reading the value back out of a config object.
|
|
153
|
+
*/
|
|
154
|
+
path: Array<string | number>;
|
|
155
|
+
/**
|
|
156
|
+
* {@link path} written as a property accessor, for display and for matching against a known
|
|
157
|
+
* key: `ssr`, `runtimeConfig.public.foo`, `modules[0]`, `nitro.routeRules["/index.html"].ssr`.
|
|
158
|
+
*/
|
|
159
|
+
label: string;
|
|
155
160
|
}
|
|
161
|
+
/** A single difference between two resolved Nuxt configurations. */
|
|
162
|
+
type NuxtConfigDiffEntry = (NuxtConfigDiffLocation & {
|
|
163
|
+
type: 'added';
|
|
164
|
+
newValue: unknown;
|
|
165
|
+
}) | (NuxtConfigDiffLocation & {
|
|
166
|
+
type: 'removed';
|
|
167
|
+
oldValue: unknown;
|
|
168
|
+
}) | (NuxtConfigDiffLocation & {
|
|
169
|
+
type: 'changed';
|
|
170
|
+
newValue: unknown;
|
|
171
|
+
oldValue: unknown;
|
|
172
|
+
});
|
|
156
173
|
/**
|
|
157
174
|
* Compare two `rawConfig` snapshots (as provided to `onConfigResolved`) and return the
|
|
158
175
|
* differences between them.
|
package/dist/index.mjs
CHANGED
|
@@ -28,9 +28,9 @@ import * as nodeUtil from "node:util";
|
|
|
28
28
|
import { readFile, rm, stat } from "node:fs/promises";
|
|
29
29
|
import { homedir } from "node:os";
|
|
30
30
|
import { klona } from "klona";
|
|
31
|
-
import
|
|
31
|
+
import microdiff from "microdiff";
|
|
32
32
|
import destr from "destr";
|
|
33
|
-
import {
|
|
33
|
+
import { createHash } from "node:crypto";
|
|
34
34
|
import { isAbsolute as isAbsolute$1, join as join$1, resolve as resolve$1 } from "node:path";
|
|
35
35
|
//#region ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.mjs
|
|
36
36
|
function getType(val) {
|
|
@@ -2069,17 +2069,52 @@ function _isDirectory(path) {
|
|
|
2069
2069
|
}
|
|
2070
2070
|
//#endregion
|
|
2071
2071
|
//#region src/loader/config.ts
|
|
2072
|
+
const IDENTIFIER_RE = /^[a-z_$][\w$]*$/i;
|
|
2073
|
+
function formatLabel(path) {
|
|
2074
|
+
let label = "";
|
|
2075
|
+
for (const segment of path) if (typeof segment === "number") label += `[${segment}]`;
|
|
2076
|
+
else if (IDENTIFIER_RE.test(segment)) label += label ? `.${segment}` : segment;
|
|
2077
|
+
else label += `[${JSON.stringify(segment)}]`;
|
|
2078
|
+
return label;
|
|
2079
|
+
}
|
|
2072
2080
|
/**
|
|
2073
2081
|
* Compare two `rawConfig` snapshots (as provided to `onConfigResolved`) and return the
|
|
2074
2082
|
* differences between them.
|
|
2075
2083
|
*/
|
|
2076
2084
|
function diffNuxtConfig(oldConfig, newConfig) {
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2085
|
+
const entries = [];
|
|
2086
|
+
for (const entry of microdiff(oldConfig, newConfig)) {
|
|
2087
|
+
const location = {
|
|
2088
|
+
path: entry.path,
|
|
2089
|
+
label: formatLabel(entry.path)
|
|
2090
|
+
};
|
|
2091
|
+
switch (entry.type) {
|
|
2092
|
+
case "CREATE":
|
|
2093
|
+
entries.push({
|
|
2094
|
+
...location,
|
|
2095
|
+
type: "added",
|
|
2096
|
+
newValue: entry.value
|
|
2097
|
+
});
|
|
2098
|
+
break;
|
|
2099
|
+
case "REMOVE":
|
|
2100
|
+
entries.push({
|
|
2101
|
+
...location,
|
|
2102
|
+
type: "removed",
|
|
2103
|
+
oldValue: entry.oldValue
|
|
2104
|
+
});
|
|
2105
|
+
break;
|
|
2106
|
+
case "CHANGE": if (!isSameFunction(entry.oldValue, entry.value)) entries.push({
|
|
2107
|
+
...location,
|
|
2108
|
+
type: "changed",
|
|
2109
|
+
newValue: entry.value,
|
|
2110
|
+
oldValue: entry.oldValue
|
|
2111
|
+
});
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
return entries;
|
|
2115
|
+
}
|
|
2116
|
+
function isSameFunction(a, b) {
|
|
2117
|
+
return typeof a === "function" && typeof b === "function" && a.toString() === b.toString();
|
|
2083
2118
|
}
|
|
2084
2119
|
const CONFIG_EXTENSIONS = [
|
|
2085
2120
|
".js",
|
|
@@ -3201,6 +3236,9 @@ function addTypeTemplate(_template, context) {
|
|
|
3201
3236
|
});
|
|
3202
3237
|
return template;
|
|
3203
3238
|
}
|
|
3239
|
+
function hashPath(path) {
|
|
3240
|
+
return createHash("sha256").update(path).digest("base64url").slice(0, 10).replace(/-/g, "_");
|
|
3241
|
+
}
|
|
3204
3242
|
/**
|
|
3205
3243
|
* Normalize a nuxt template object
|
|
3206
3244
|
*/
|
|
@@ -3212,7 +3250,7 @@ function normalizeTemplate(template, buildDir) {
|
|
|
3212
3250
|
if (!existsSync(template.src)) throw kitDiagnostics.NUXT_B8009({ template: template.src });
|
|
3213
3251
|
if (!template.filename) {
|
|
3214
3252
|
const srcPath = parse(template.src);
|
|
3215
|
-
template.filename = template.fileName || `${basename(srcPath.dir)}.${srcPath.name}.${
|
|
3253
|
+
template.filename = template.fileName || `${basename(srcPath.dir)}.${srcPath.name}.${hashPath(template.src)}${srcPath.ext}`;
|
|
3216
3254
|
}
|
|
3217
3255
|
}
|
|
3218
3256
|
if (!template.src && !template.getContents) throw kitDiagnostics.NUXT_B8010({ template: template.filename || template.src || JSON.stringify(template) });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/kit-nightly",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-29778506.75ed8ed2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"exsolve": "^1.1.1",
|
|
28
28
|
"ignore": "^7.0.6",
|
|
29
29
|
"klona": "^2.0.6",
|
|
30
|
+
"microdiff": "^1.6.0",
|
|
30
31
|
"nostics": "^1.2.0",
|
|
31
32
|
"nypm": "^0.6.9",
|
|
32
|
-
"ohash": "^2.0.11",
|
|
33
33
|
"pathe": "^2.0.3",
|
|
34
34
|
"pkg-types": "^2.3.1",
|
|
35
35
|
"rc9": "^3.0.1",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-
|
|
72
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29778506.75ed8ed2",
|
|
73
73
|
"c12": "4.0.0-beta.5",
|
|
74
74
|
"chokidar": "^5.0.0",
|
|
75
75
|
"dotenv": "^17.4.2",
|