vike 0.4.240 → 0.4.241-commit-60b0676
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/esm/client/runtime-client-routing/getPageContextFromHooks.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.js +1 -1
- package/dist/esm/client/runtime-client-routing/logErrorClient.d.ts +2 -0
- package/dist/esm/client/runtime-client-routing/logErrorClient.js +11 -0
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.js +95 -84
- package/dist/esm/client/runtime-client-routing/utils.d.ts +0 -1
- package/dist/esm/client/runtime-client-routing/utils.js +0 -1
- package/dist/esm/node/api/build.js +6 -6
- package/dist/esm/node/api/dev.js +2 -2
- package/dist/esm/node/api/prepareViteApiCall.d.ts +2 -9
- package/dist/esm/node/api/prepareViteApiCall.js +4 -156
- package/dist/esm/node/api/prerender.js +2 -2
- package/dist/esm/node/api/preview.js +2 -2
- package/dist/esm/node/api/resolveViteConfigFromUser.d.ts +20 -0
- package/dist/esm/node/api/resolveViteConfigFromUser.js +207 -0
- package/dist/esm/node/cli/parseCli.js +10 -6
- package/dist/esm/node/prerender/runPrerender.js +2 -1
- package/dist/esm/node/prerender/runPrerenderEntry.js +4 -4
- package/dist/esm/node/runtime/globalContext.d.ts +92 -0
- package/dist/esm/node/runtime/globalContext.js +12 -3
- package/dist/esm/node/runtime/logErrorServer.d.ts +2 -0
- package/dist/esm/node/runtime/logErrorServer.js +18 -0
- package/dist/esm/node/runtime/renderPage/execHookOnError.d.ts +2 -0
- package/dist/esm/node/runtime/renderPage/execHookOnError.js +26 -0
- package/dist/esm/node/runtime/renderPage/execHookServer.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/loggerProd.js +3 -5
- package/dist/esm/node/runtime/renderPage.js +8 -7
- package/dist/esm/node/runtime-dev/createDevMiddleware.js +2 -2
- package/dist/esm/node/vite/index.d.ts +1 -1
- package/dist/esm/node/vite/index.js +55 -24
- package/dist/esm/node/vite/onLoad.js +3 -8
- package/dist/esm/node/vite/plugins/build/handleAssetsManifest.js +0 -1
- package/dist/esm/node/vite/plugins/build/pluginBuildApp.js +6 -6
- package/dist/esm/node/vite/plugins/build/pluginDistFileNames.js +2 -2
- package/dist/esm/node/vite/plugins/pluginCommon.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginCommon.js +22 -9
- package/dist/esm/node/vite/plugins/pluginFileEnv.js +9 -6
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsEnvVars.d.ts +3 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsEnvVars.js +129 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsGlobalThis.d.ts +10 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsGlobalThis.js +77 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsPageContext.d.ts +3 -0
- package/dist/esm/node/vite/plugins/{pluginReplaceIsClientSide.js → pluginReplaceConstantsPageContext.js} +5 -3
- package/dist/esm/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntry.js +7 -1
- package/dist/esm/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +3 -0
- package/dist/esm/node/vite/plugins/pluginVirtualFiles.js +2 -2
- package/dist/esm/node/vite/plugins/pluginViteConfigVikeExtensions.d.ts +3 -0
- package/dist/esm/node/vite/plugins/pluginViteConfigVikeExtensions.js +32 -0
- package/dist/esm/node/vite/shared/getFilePath.d.ts +4 -6
- package/dist/esm/node/vite/shared/getFilePath.js +6 -11
- package/dist/esm/node/vite/shared/isViteCli.d.ts +13 -0
- package/dist/esm/node/vite/shared/isViteCli.js +143 -0
- package/dist/esm/node/vite/shared/isViteServerSide.d.ts +6 -3
- package/dist/esm/node/vite/shared/isViteServerSide.js +13 -4
- package/dist/esm/node/vite/shared/loggerNotProd/errorWithCodeSnippet.js +2 -2
- package/dist/esm/node/vite/shared/loggerNotProd/log.js +8 -2
- package/dist/esm/node/vite/shared/loggerNotProd.d.ts +1 -1
- package/dist/esm/node/vite/shared/loggerNotProd.js +11 -11
- package/dist/esm/node/vite/shared/loggerVite.js +4 -2
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +12 -2
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/transpileAndExecuteFile.js +12 -8
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal.d.ts +2 -0
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal.js +4 -0
- package/dist/esm/node/vite/utils.d.ts +1 -0
- package/dist/esm/node/vite/utils.js +1 -0
- package/dist/esm/shared/createGlobalContextShared.d.ts +2 -1
- package/dist/esm/shared/createGlobalContextShared.js +1 -1
- package/dist/esm/shared/hooks/execHook.d.ts +1 -1
- package/dist/esm/shared/hooks/getHook.d.ts +5 -4
- package/dist/esm/shared/route/abort.d.ts +1 -0
- package/dist/esm/shared/route/abort.js +12 -4
- package/dist/esm/shared/route/index.js +13 -4
- package/dist/esm/shared/route/utils.d.ts +1 -0
- package/dist/esm/shared/route/utils.js +1 -0
- package/dist/esm/types/Config.d.ts +14 -3
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assert.js +1 -0
- package/dist/esm/utils/assertNodeVersion.js +1 -1
- package/dist/esm/utils/assertViteVersion.d.ts +2 -0
- package/dist/esm/utils/assertViteVersion.js +11 -0
- package/dist/esm/utils/debug.d.ts +5 -3
- package/dist/esm/utils/debug.js +20 -16
- package/dist/esm/utils/getGlobalObject.d.ts +5 -1
- package/dist/esm/utils/getGlobalObject.js +5 -1
- package/dist/esm/utils/isExactlyOneTruthy.d.ts +1 -0
- package/dist/esm/utils/isExactlyOneTruthy.js +4 -0
- package/dist/esm/utils/isVikeReactApp.js +2 -1
- package/dist/esm/utils/requireResolve.js +1 -1
- package/package.json +3 -3
- package/dist/esm/node/vite/plugins/pluginEnvVars.d.ts +0 -3
- package/dist/esm/node/vite/plugins/pluginEnvVars.js +0 -110
- package/dist/esm/node/vite/plugins/pluginReplaceGlobalThisConstants.d.ts +0 -9
- package/dist/esm/node/vite/plugins/pluginReplaceGlobalThisConstants.js +0 -45
- package/dist/esm/node/vite/plugins/pluginReplaceIsClientSide.d.ts +0 -3
- package/dist/esm/node/vite/shared/isViteCliCall.d.ts +0 -10
- package/dist/esm/node/vite/shared/isViteCliCall.js +0 -81
- package/dist/esm/shared/route/debug.d.ts +0 -6
- package/dist/esm/shared/route/debug.js +0 -21
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { isViteCliCall };
|
|
2
|
-
export { getViteConfigFromCli };
|
|
3
|
-
declare function isViteCliCall(): boolean;
|
|
4
|
-
type ConfigFromCli = {
|
|
5
|
-
root: undefined | string;
|
|
6
|
-
configFile: undefined | string;
|
|
7
|
-
} & Record<string, unknown> & {
|
|
8
|
-
build: Record<string, unknown>;
|
|
9
|
-
};
|
|
10
|
-
declare function getViteConfigFromCli(): null | ConfigFromCli;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
export { isViteCliCall };
|
|
2
|
-
export { getViteConfigFromCli };
|
|
3
|
-
import { assert, isObject, toPosixPath } from '../utils.js';
|
|
4
|
-
import { cac } from 'cac';
|
|
5
|
-
function isViteCliCall() {
|
|
6
|
-
let execPath = process.argv[1];
|
|
7
|
-
assert(execPath);
|
|
8
|
-
execPath = toPosixPath(execPath);
|
|
9
|
-
return (
|
|
10
|
-
// pnpm
|
|
11
|
-
execPath.endsWith('/bin/vite.js') ||
|
|
12
|
-
// npm & yarn
|
|
13
|
-
execPath.endsWith('/.bin/vite') ||
|
|
14
|
-
// Global install
|
|
15
|
-
execPath.endsWith('/bin/vite'));
|
|
16
|
-
}
|
|
17
|
-
function getViteConfigFromCli() {
|
|
18
|
-
if (!isViteCliCall())
|
|
19
|
-
return null;
|
|
20
|
-
// Copied and adapted from https://github.com/vitejs/vite/blob/8d0a9c1ab8ddd26973509ca230b29604e872e2cd/packages/vite/src/node/cli.ts#L137-L197
|
|
21
|
-
const cli = cac('vike:vite-simulation');
|
|
22
|
-
const desc = 'FAKE_CLI';
|
|
23
|
-
cli
|
|
24
|
-
.option('-c, --config <file>', desc)
|
|
25
|
-
.option('--base <path>', desc)
|
|
26
|
-
.option('-l, --logLevel <level>', desc)
|
|
27
|
-
.option('--clearScreen', desc)
|
|
28
|
-
.option('-d, --debug [feat]', desc)
|
|
29
|
-
.option('-f, --filter <filter>', desc)
|
|
30
|
-
.option('-m, --mode <mode>', desc);
|
|
31
|
-
cli
|
|
32
|
-
.command('build [root]', desc)
|
|
33
|
-
.option('--target <target>', desc)
|
|
34
|
-
.option('--outDir <dir>', desc)
|
|
35
|
-
.option('--assetsDir <dir>', desc)
|
|
36
|
-
.option('--assetsInlineLimit <number>', desc)
|
|
37
|
-
.option('--ssr [entry]', desc)
|
|
38
|
-
.option('--sourcemap', desc)
|
|
39
|
-
.option('--minify [minifier]', desc)
|
|
40
|
-
.option('--manifest [name]', desc)
|
|
41
|
-
.option('--ssrManifest [name]', desc)
|
|
42
|
-
.option('--force', desc)
|
|
43
|
-
.option('--emptyOutDir', desc)
|
|
44
|
-
.option('-w, --watch', desc)
|
|
45
|
-
.action((root, options) => {
|
|
46
|
-
assert(isObject(options));
|
|
47
|
-
const buildOptions = cleanOptions(options);
|
|
48
|
-
assert(root === undefined || typeof root === 'string');
|
|
49
|
-
assert(options.config === undefined || typeof options.config === 'string');
|
|
50
|
-
configFromCli = {
|
|
51
|
-
root,
|
|
52
|
-
base: options.base,
|
|
53
|
-
mode: options.mode,
|
|
54
|
-
configFile: options.config,
|
|
55
|
-
logLevel: options.logLevel,
|
|
56
|
-
clearScreen: options.clearScreen,
|
|
57
|
-
optimizeDeps: { force: options.force },
|
|
58
|
-
build: buildOptions,
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
let configFromCli = null;
|
|
62
|
-
cli.parse();
|
|
63
|
-
return configFromCli;
|
|
64
|
-
function cleanOptions(options) {
|
|
65
|
-
const ret = { ...options };
|
|
66
|
-
delete ret['--'];
|
|
67
|
-
delete ret.c;
|
|
68
|
-
delete ret.config;
|
|
69
|
-
delete ret.base;
|
|
70
|
-
delete ret.l;
|
|
71
|
-
delete ret.logLevel;
|
|
72
|
-
delete ret.clearScreen;
|
|
73
|
-
delete ret.d;
|
|
74
|
-
delete ret.debug;
|
|
75
|
-
delete ret.f;
|
|
76
|
-
delete ret.filter;
|
|
77
|
-
delete ret.m;
|
|
78
|
-
delete ret.mode;
|
|
79
|
-
return ret;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { debug };
|
|
2
|
-
export { setCreateDebugger };
|
|
3
|
-
import type { createDebugger, Debug } from '../../utils/debug.js';
|
|
4
|
-
type CreateDebugger = typeof createDebugger;
|
|
5
|
-
declare function debug(...args: Parameters<Debug>): void;
|
|
6
|
-
declare function setCreateDebugger(createDebugger: CreateDebugger): void;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export { debug };
|
|
2
|
-
export { setCreateDebugger };
|
|
3
|
-
// Using createDebugger() for isomorphic code without bloating the client-side.
|
|
4
|
-
// On the server-side, this is just a transparent proxy.
|
|
5
|
-
// On the client-side, this is an empty shell.
|
|
6
|
-
import { getGlobalObject } from '../../utils/getGlobalObject.js';
|
|
7
|
-
const globalObject = getGlobalObject('route/debug.ts', {});
|
|
8
|
-
function debug(...args) {
|
|
9
|
-
// Client-side => does nothing
|
|
10
|
-
if (!globalObject.createDebugger)
|
|
11
|
-
return;
|
|
12
|
-
// Server-side => just a proxy
|
|
13
|
-
if (!globalObject.debug) {
|
|
14
|
-
globalObject.debug = globalObject.createDebugger('vike:routing');
|
|
15
|
-
}
|
|
16
|
-
globalObject.debug(...args);
|
|
17
|
-
}
|
|
18
|
-
// Called only on the server-side
|
|
19
|
-
function setCreateDebugger(createDebugger) {
|
|
20
|
-
globalObject.createDebugger = createDebugger;
|
|
21
|
-
}
|