vike 0.4.255 → 0.4.256
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/node/prerender/runPrerender.js +17 -11
- package/dist/node/vite/plugins/pluginExtractAssets.js +2 -0
- package/dist/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +4 -0
- package/dist/server/assertEnvServer.js +1 -1
- package/dist/types/Config.d.ts +7 -0
- package/dist/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/utils/PROJECT_VERSION.js +1 -1
- package/dist/utils/assertKeys.js +2 -2
- package/dist/utils/assertNodeVersion.js +1 -1
- package/dist/utils/assertVersion.js +1 -1
- package/dist/utils/joinEnglish.d.ts +4 -1
- package/dist/utils/joinEnglish.js +4 -4
- package/dist/utils/path.js +1 -1
- package/package.json +9 -9
|
@@ -239,17 +239,6 @@ async function callOnBeforePrerenderStartHooks(prerenderContext, globalContext,
|
|
|
239
239
|
const result = normalizeOnPrerenderHookResult(prerenderResult, hookFilePath, hookName);
|
|
240
240
|
// Handle result
|
|
241
241
|
await Promise.all(result.map(async ({ url, pageContext }) => {
|
|
242
|
-
// Assert no duplication
|
|
243
|
-
{
|
|
244
|
-
const pageContextFound = prerenderContext.pageContexts.find((pageContext) => isSameUrl(pageContext.urlOriginal, url));
|
|
245
|
-
if (pageContextFound) {
|
|
246
|
-
assert(pageContextFound._providedByHook);
|
|
247
|
-
const providedTwice = hookFilePath === pageContextFound._providedByHook.hookFilePath
|
|
248
|
-
? `twice by the ${hookName}() hook (${hookFilePath})`
|
|
249
|
-
: `twice: by the ${hookName}() hook (${hookFilePath}) as well as by the hook ${pageContextFound._providedByHook.hookFilePath}() (${pageContextFound._providedByHook.hookName})`;
|
|
250
|
-
assertUsage(false, `URL ${pc.cyan(url)} provided ${providedTwice}. Make sure to provide the URL only once instead.`);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
242
|
// Add result
|
|
254
243
|
const providedByHook = { hookFilePath, hookName };
|
|
255
244
|
const pageContextNew = await createPageContextPrerendering(url, prerenderContext, globalContext, false, undefined, providedByHook);
|
|
@@ -260,6 +249,23 @@ async function callOnBeforePrerenderStartHooks(prerenderContext, globalContext,
|
|
|
260
249
|
}
|
|
261
250
|
}));
|
|
262
251
|
})));
|
|
252
|
+
// Assert no duplicate URLs
|
|
253
|
+
// If duplicate URL is found an error will be issued
|
|
254
|
+
const pageContextsByUrl = {};
|
|
255
|
+
for (const pageContext of prerenderContext.pageContexts) {
|
|
256
|
+
assert(pageContext._providedByHook);
|
|
257
|
+
const urlNormalized = normalizeUrl(pageContext.urlOriginal);
|
|
258
|
+
const pageContextSameUrl = pageContextsByUrl[urlNormalized];
|
|
259
|
+
if (pageContextSameUrl) {
|
|
260
|
+
assert(pageContextSameUrl._providedByHook);
|
|
261
|
+
const { hookName, hookFilePath } = pageContext._providedByHook;
|
|
262
|
+
const providedTwice = hookFilePath === pageContextSameUrl._providedByHook.hookFilePath
|
|
263
|
+
? `twice by the ${hookName}() hook (${hookFilePath})`
|
|
264
|
+
: `twice: by the ${hookName}() hook (${hookFilePath}) as well as by the hook ${pageContextSameUrl._providedByHook.hookFilePath}() (${pageContextSameUrl._providedByHook.hookName})`;
|
|
265
|
+
assertUsage(false, `URL ${pc.cyan(urlNormalized)} provided ${providedTwice}. Make sure to provide the URL only once instead.`);
|
|
266
|
+
}
|
|
267
|
+
pageContextsByUrl[urlNormalized] = pageContext;
|
|
268
|
+
}
|
|
263
269
|
}
|
|
264
270
|
function getUrlListFromPagesWithStaticRoute(globalContext, doNotPrerenderList) {
|
|
265
271
|
const urlList = [];
|
|
@@ -41,6 +41,8 @@ const filterFunction = (id) => extractAssetsRE.test(id);
|
|
|
41
41
|
function pluginExtractAssets() {
|
|
42
42
|
let config;
|
|
43
43
|
let vikeConfig;
|
|
44
|
+
if (handleAssetsManifest_isFixEnabled())
|
|
45
|
+
return [];
|
|
44
46
|
let isFixEnabled;
|
|
45
47
|
return [
|
|
46
48
|
// This plugin removes all JavaScript from server-side only code, so that only CSS imports remains. (And also static files imports e.g. `import logoURL from './logo.svg.js'`).
|
|
@@ -301,6 +301,10 @@ const configDefinitionsBuiltIn = {
|
|
|
301
301
|
global: true,
|
|
302
302
|
vite: true,
|
|
303
303
|
},
|
|
304
|
+
license: {
|
|
305
|
+
env: { config: true },
|
|
306
|
+
global: true,
|
|
307
|
+
},
|
|
304
308
|
};
|
|
305
309
|
function getConfigEnv(pageConfig, configName) {
|
|
306
310
|
const source = getConfigValueSourceRelevantAnyEnv(configName, pageConfig);
|
|
@@ -20,7 +20,7 @@ function onLoad() {
|
|
|
20
20
|
addEcosystemStamp();
|
|
21
21
|
}
|
|
22
22
|
// Used by:
|
|
23
|
-
// - Telefunc (to detect the user's stack https://github.com/
|
|
23
|
+
// - Telefunc (to detect the user's stack https://github.com/telefunc/telefunc/blob/8288310e88e06a42b710d39c39fb502364ca6d30/telefunc/utils/isVikeApp.ts#L4)
|
|
24
24
|
function addEcosystemStamp() {
|
|
25
25
|
const g = globalThis;
|
|
26
26
|
g._isVikeApp =
|
package/dist/types/Config.d.ts
CHANGED
|
@@ -540,6 +540,13 @@ type ConfigBuiltIn = {
|
|
|
540
540
|
* @experimental
|
|
541
541
|
*/
|
|
542
542
|
staticReplace?: StaticReplace[];
|
|
543
|
+
/**
|
|
544
|
+
* The license key for larger teams.
|
|
545
|
+
*
|
|
546
|
+
* https://vike.dev/license
|
|
547
|
+
* https://vike.dev/pricing
|
|
548
|
+
*/
|
|
549
|
+
license?: string;
|
|
543
550
|
};
|
|
544
551
|
type PrerenderSetting = boolean | {
|
|
545
552
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.256";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.
|
|
2
|
+
export const PROJECT_VERSION = '0.4.256';
|
package/dist/utils/assertKeys.js
CHANGED
|
@@ -14,9 +14,9 @@ function assertKeys(obj, keysExpected, errPrefix) {
|
|
|
14
14
|
assertUsage(false, [
|
|
15
15
|
errPrefix,
|
|
16
16
|
`unknown key${keysUnknown.length === 1 ? '' : 's'}`,
|
|
17
|
-
joinEnglish(keysUnknown, 'and', pc.cyan) + '.',
|
|
17
|
+
joinEnglish(keysUnknown, 'and', { color: pc.cyan }) + '.',
|
|
18
18
|
'Only following keys are allowed:',
|
|
19
|
-
joinEnglish(keysExpected, 'and', pc.cyan) + '.',
|
|
19
|
+
joinEnglish(keysExpected, 'and', { color: pc.cyan }) + '.',
|
|
20
20
|
].join(' '));
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -6,7 +6,7 @@ import { assertIsNotBrowser } from './assertIsNotBrowser.js';
|
|
|
6
6
|
import { joinEnglish } from './joinEnglish.js';
|
|
7
7
|
assertIsNotBrowser();
|
|
8
8
|
function assertVersion(dependencyName, versionActual, versionExpectedList) {
|
|
9
|
-
assertUsage(isVersionMatch(versionActual, versionExpectedList), `${pc.bold(dependencyName)} ${pc.red(pc.bold(versionActual))} isn't supported, use ${pc.bold(dependencyName)} ${joinEnglish([...versionExpectedList, 'above'].map((v) => pc.green(pc.bold(v))), 'or')}.`);
|
|
9
|
+
assertUsage(isVersionMatch(versionActual, versionExpectedList), `${pc.bold(dependencyName)} ${pc.red(pc.bold(versionActual))} isn't supported, use ${pc.bold(dependencyName)} ${joinEnglish([...versionExpectedList, 'above'].map((v) => pc.green(pc.bold(v))), 'or', { trailingComma: false })}.`);
|
|
10
10
|
}
|
|
11
11
|
function isVersionMatch(versionActual, versionExpectedList) {
|
|
12
12
|
assert(versionActual);
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { joinEnglish };
|
|
2
|
-
declare function joinEnglish(arr: string[] | readonly string[], conjunction: 'or' | 'and',
|
|
2
|
+
declare function joinEnglish(arr: string[] | readonly string[], conjunction: 'or' | 'and', { color, trailingComma }?: {
|
|
3
|
+
color?: (s: string) => string;
|
|
4
|
+
trailingComma?: boolean;
|
|
5
|
+
}): string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { joinEnglish };
|
|
2
2
|
import { assert } from './assert.js';
|
|
3
3
|
// https://stackoverflow.com/questions/53879088/join-an-array-by-commas-and-and/53879103#53879103
|
|
4
|
-
function joinEnglish(arr, conjunction,
|
|
4
|
+
function joinEnglish(arr, conjunction, { color = (s) => s, trailingComma = true } = {}) {
|
|
5
5
|
assert(arr.length > 0);
|
|
6
6
|
if (arr.length === 1)
|
|
7
|
-
return
|
|
7
|
+
return color(arr[0]);
|
|
8
8
|
const firsts = arr.slice(0, arr.length - 1);
|
|
9
9
|
const last = arr[arr.length - 1];
|
|
10
|
-
const lastComma = arr.length > 2 ? ',' : '';
|
|
11
|
-
return firsts.map(
|
|
10
|
+
const lastComma = trailingComma && arr.length > 2 ? ',' : '';
|
|
11
|
+
return firsts.map(color).join(', ') + `${lastComma} ${conjunction} ` + color(last);
|
|
12
12
|
}
|
package/dist/utils/path.js
CHANGED
|
@@ -21,7 +21,7 @@ function pathJoin(path1, path2) {
|
|
|
21
21
|
joined = '/' + joined;
|
|
22
22
|
return joined;
|
|
23
23
|
}
|
|
24
|
-
// https://github.com/
|
|
24
|
+
// https://github.com/telefunc/telefunc/blob/0fd44322acbd07857ae29361ba7c998607f17dd5/telefunc/utils/path-shim.ts#L17-L21
|
|
25
25
|
const IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
26
26
|
function pathIsAbsolute(filePath) {
|
|
27
27
|
return IS_ABSOLUTE_RE.test(filePath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.256",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
@@ -129,9 +129,9 @@
|
|
|
129
129
|
"esbuild": ">=0.19.0",
|
|
130
130
|
"json5": "^2.0.0",
|
|
131
131
|
"magic-string": "^0.30.17",
|
|
132
|
-
"picomatch": "^4.0.
|
|
133
|
-
"semver": "^7.
|
|
134
|
-
"sirv": "^3.0.
|
|
132
|
+
"picomatch": "^4.0.4",
|
|
133
|
+
"semver": "^7.7.4",
|
|
134
|
+
"sirv": "^3.0.2",
|
|
135
135
|
"source-map-support": "^0.5.0",
|
|
136
136
|
"tinyglobby": "^0.2.10",
|
|
137
137
|
"vite": ">=6.3.0"
|
|
@@ -244,15 +244,15 @@
|
|
|
244
244
|
"./universal-middleware.js"
|
|
245
245
|
],
|
|
246
246
|
"devDependencies": {
|
|
247
|
-
"@brillout/release-me": "^0.4.
|
|
247
|
+
"@brillout/release-me": "^0.4.13",
|
|
248
248
|
"@types/babel__core": "^7.20.5",
|
|
249
249
|
"@types/estree": "^1.0.5",
|
|
250
250
|
"@types/node": "^20.10.5",
|
|
251
|
-
"@types/picomatch": "^
|
|
252
|
-
"@types/semver": "^7.
|
|
251
|
+
"@types/picomatch": "^4.0.2",
|
|
252
|
+
"@types/semver": "^7.7.1",
|
|
253
253
|
"@types/source-map-support": "^0.5.10",
|
|
254
|
-
"react-streaming": "^0.4.
|
|
255
|
-
"rimraf": "^
|
|
254
|
+
"react-streaming": "^0.4.17",
|
|
255
|
+
"rimraf": "^6.1.3",
|
|
256
256
|
"typescript": "^5.9.3",
|
|
257
257
|
"vite": "^7.2.6"
|
|
258
258
|
},
|