vike 0.4.259 → 0.4.260-commit-2e7fb2a
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/AGENTS.md +3 -0
- package/README.md +2 -0
- package/dist/client/runtime-client-routing/renderPageClient.js +1 -1
- package/dist/client/shared/getJsonSerializedInHtml.js +1 -10
- package/dist/node/api/build.js +6 -6
- package/dist/node/api/dev.d.ts +2 -10
- package/dist/node/api/dev.js +5 -52
- package/dist/node/api/prepareViteApiCall.d.ts +1 -1
- package/dist/node/api/prepareViteApiCall.js +2 -2
- package/dist/node/api/prerender.js +2 -2
- package/dist/node/api/preview.d.ts +2 -2
- package/dist/node/api/preview.js +15 -16
- package/dist/node/api/{resolveViteConfigFromUser.d.ts → resolveViteConfigUser.d.ts} +5 -5
- package/dist/node/api/{resolveViteConfigFromUser.js → resolveViteConfigUser.js} +100 -69
- package/dist/node/api/startupLog.d.ts +4 -0
- package/dist/node/api/{getStartupLogFirstLine.js → startupLog.js} +14 -1
- package/dist/node/api/types.d.ts +9 -0
- package/dist/node/cli/entry.js +1 -5
- package/dist/node/cli/parseCli.js +26 -12
- package/dist/node/createDevMiddleware.js +2 -2
- package/dist/node/prerender/runPrerender.d.ts +8 -2
- package/dist/node/prerender/runPrerender.js +3 -1
- package/dist/node/prerender/runPrerenderEntry.js +2 -2
- package/dist/node/vite/index.js +2 -2
- package/dist/node/vite/plugins/build/handleAssetsManifest.d.ts +2 -6
- package/dist/node/vite/plugins/build/handleAssetsManifest.js +16 -9
- package/dist/node/vite/plugins/build/pluginBuildApp.js +10 -5
- package/dist/node/vite/plugins/build/pluginBuildConfig.d.ts +6 -1
- package/dist/node/vite/plugins/build/pluginBuildConfig.js +13 -11
- package/dist/node/vite/plugins/build/pluginDistFileNames.js +1 -6
- package/dist/node/vite/plugins/build/pluginModuleBanner.js +2 -4
- package/dist/node/vite/plugins/pluginCommon.d.ts +1 -1
- package/dist/node/vite/plugins/pluginCommon.js +15 -7
- package/dist/node/vite/plugins/pluginDev/autoAddVikeSkill.d.ts +3 -0
- package/dist/node/vite/plugins/pluginDev/autoAddVikeSkill.js +174 -0
- package/dist/node/vite/plugins/pluginDev/optimizeDeps.js +67 -31
- package/dist/node/vite/plugins/pluginDev.js +17 -0
- package/dist/node/vite/plugins/pluginStripPointerImportAttribute.js +31 -10
- package/dist/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +5 -7
- package/dist/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.d.ts +2 -2
- package/dist/node/vite/plugins/pluginVirtualFiles.js +1 -1
- package/dist/node/vite/shared/addSsrMiddleware.js +1 -1
- package/dist/node/vite/shared/getMagicString.d.ts +1 -1
- package/dist/node/vite/shared/getMagicString.js +3 -0
- package/dist/node/vite/shared/isVite8OrAbove.d.ts +4 -0
- package/dist/node/vite/shared/isVite8OrAbove.js +9 -0
- package/dist/node/vite/shared/isViteCli.d.ts +9 -4
- package/dist/node/vite/shared/isViteCli.js +24 -4
- package/dist/node/vite/shared/loggerDev.js +6 -5
- package/dist/node/vite/shared/loggerVite.js +3 -2
- package/dist/node/vite/shared/resolveVikeConfigInternal/assertExtensions.d.ts +3 -1
- package/dist/node/vite/shared/resolveVikeConfigInternal/assertExtensions.js +6 -5
- package/dist/node/vite/shared/resolveVikeConfigInternal/{crawlPlusFilePaths.d.ts → crawlPlusFiles.d.ts} +2 -2
- package/dist/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +71 -0
- package/dist/node/vite/shared/resolveVikeConfigInternal/{getPlusFilesByLocationId.d.ts → getPlusFiles.d.ts} +5 -3
- package/dist/node/vite/shared/resolveVikeConfigInternal/{getPlusFilesByLocationId.js → getPlusFiles.js} +18 -17
- package/dist/node/vite/shared/resolveVikeConfigInternal/loadFileAtConfigTime.d.ts +1 -1
- package/dist/node/vite/shared/resolveVikeConfigInternal/metaBuiltIn.d.ts +15 -15
- package/dist/node/vite/shared/resolveVikeConfigInternal/metaBuiltIn.js +19 -0
- package/dist/node/vite/shared/resolveVikeConfigInternal.d.ts +19 -4
- package/dist/node/vite/shared/resolveVikeConfigInternal.js +217 -76
- package/dist/server/runtime/globalContext.js +4 -1
- package/dist/server/runtime/renderPageServer/createPageContextServer.d.ts +12 -3
- package/dist/server/runtime/renderPageServer/html/injectAssets/getHtmlTags.js +2 -3
- package/dist/server/runtime/renderPageServer/html/injectAssets/injectHtmlTags.js +3 -1
- package/dist/server/runtime/renderPageServer/html/serializeContext.js +5 -10
- package/dist/server/runtime/renderPageServer/loadPageConfigsLazyServerSide.d.ts +8 -2
- package/dist/server/runtime/renderPageServer/renderPageServerAfterRoute.d.ts +32 -8
- package/dist/server/runtime/renderPageServer/renderPageServerAfterRoute.js +1 -1
- package/dist/server/runtime/renderPageServer.d.ts +8 -2
- package/dist/server/runtime/renderPageServer.js +6 -4
- package/dist/shared-server-client/page-configs/serialize/serializeConfigValues.d.ts +3 -3
- package/dist/shared-server-client/page-configs/serialize/serializeConfigValues.js +8 -1
- package/dist/types/Config.d.ts +54 -6
- package/dist/types/PageConfig.d.ts +12 -10
- package/dist/types/PageContext.d.ts +8 -3
- package/dist/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/utils/PROJECT_VERSION.js +1 -1
- package/dist/utils/assert.d.ts +2 -0
- package/dist/utils/assert.js +8 -8
- package/dist/utils/assertViteVersion.js +1 -1
- package/dist/utils/crawlFiles/ignorePatternsBuiltIn.d.ts +1 -0
- package/dist/{node/vite/shared/resolveVikeConfigInternal/crawlPlusFilePaths → utils/crawlFiles}/ignorePatternsBuiltIn.js +1 -1
- package/dist/utils/crawlFiles.d.ts +21 -0
- package/dist/utils/crawlFiles.js +195 -0
- package/dist/utils/debug.d.ts +1 -1
- package/dist/utils/debug.js +1 -0
- package/dist/{node/vite/shared → utils}/getEnvVarObject.d.ts +0 -1
- package/dist/{node/vite/shared → utils}/getEnvVarObject.js +4 -3
- package/dist/utils/getViteRPC.js +1 -1
- package/dist/utils/objectMap.d.ts +2 -0
- package/dist/utils/objectMap.js +4 -0
- package/dist/utils/parseNpmPackage.js +4 -1
- package/dist/utils/pick.d.ts +1 -1
- package/dist/utils/setTimeoutUnref.d.ts +2 -0
- package/dist/utils/setTimeoutUnref.js +11 -0
- package/package.json +19 -21
- package/dist/node/api/getStartupLogFirstLine.d.ts +0 -7
- package/dist/node/vite/shared/resolveVikeConfigInternal/crawlPlusFilePaths/ignorePatternsBuiltIn.d.ts +0 -2
- package/dist/node/vite/shared/resolveVikeConfigInternal/crawlPlusFilePaths.js +0 -258
- package/dist/server/__internal/vite.d.ts +0 -2
- package/dist/server/__internal/vite.js +0 -2
- package/dist/server/runtime/renderPageServer/html/injectAssets/sanitizeJson.d.ts +0 -4
- package/dist/server/runtime/renderPageServer/html/injectAssets/sanitizeJson.js +0 -7
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
export { crawlFiles };
|
|
2
|
+
import { assert, assertUsage, assertWarning } from './assert.js';
|
|
3
|
+
import { assertIsNotProductionRuntime } from './assertSetup.js';
|
|
4
|
+
import { isVersionMatch } from './assertVersion.js';
|
|
5
|
+
import { createDebug } from './debug.js';
|
|
6
|
+
import { deepEqual } from './deepEqual.js';
|
|
7
|
+
import { getGlobalObject } from './getGlobalObject.js';
|
|
8
|
+
import { hasProp } from './hasProp.js';
|
|
9
|
+
import { isNotNullish } from './isNullish.js';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import { glob as tinyglobby } from 'tinyglobby';
|
|
12
|
+
import { exec } from 'node:child_process';
|
|
13
|
+
import { promisify } from 'node:util';
|
|
14
|
+
import { getEnvVarObject } from './getEnvVarObject.js';
|
|
15
|
+
import pc from '@brillout/picocolors';
|
|
16
|
+
import picomatch from 'picomatch';
|
|
17
|
+
import { ignorePatternsBuiltIn } from './crawlFiles/ignorePatternsBuiltIn.js';
|
|
18
|
+
assertIsNotProductionRuntime();
|
|
19
|
+
const execA = promisify(exec);
|
|
20
|
+
const debug = createDebug('vike:crawl');
|
|
21
|
+
const globalObject = getGlobalObject('crawlFiles.ts', {
|
|
22
|
+
gitIsNotUsable: false,
|
|
23
|
+
});
|
|
24
|
+
const globstar = '**/';
|
|
25
|
+
/**
|
|
26
|
+
* Crawl the files matching `filePattern`, using `$ git ls-files` and, as a fallback, [tinyglobby](https://github.com/SuperchupuDev/tinyglobby).
|
|
27
|
+
*/
|
|
28
|
+
async function crawlFiles(options) {
|
|
29
|
+
const { filePattern, fileExtension, cwd, dot, globFallback } = options;
|
|
30
|
+
const userSettings = getUserSettings();
|
|
31
|
+
const globOptions = { cwd, dot, nocase: false, ignore: getIgnorePatterns(userSettings) };
|
|
32
|
+
// One pattern per file extension (the `filePattern` skips the file extension)
|
|
33
|
+
assert(!path.posix.basename(filePattern).includes('.'));
|
|
34
|
+
const patterns = fileExtension.map((ext) => `${filePattern}.${ext}`);
|
|
35
|
+
// Crawl
|
|
36
|
+
const filesGit = userSettings.git !== false && (await crawlGit(patterns, cwd, globOptions));
|
|
37
|
+
const useGlob =
|
|
38
|
+
// `!filesGit` => Git isn't usable => we *have* to use tinyglobby
|
|
39
|
+
!filesGit ||
|
|
40
|
+
// `filesGit.length === 0` => fallback to tinyglobby if globFallback is true
|
|
41
|
+
(filesGit.length === 0 && globFallback);
|
|
42
|
+
const filesGlob = (useGlob || debug.isActivated) && (await crawlGlob(patterns, globOptions));
|
|
43
|
+
const files = useGlob ? filesGlob : filesGit;
|
|
44
|
+
assert(files);
|
|
45
|
+
if (debug.isActivated && filesGit && filesGlob) {
|
|
46
|
+
assertWarning(deepEqual(filesGlob.slice().sort(), filesGit.slice().sort()), "Git and glob results aren't matching.", { onlyOnce: false });
|
|
47
|
+
}
|
|
48
|
+
return files;
|
|
49
|
+
}
|
|
50
|
+
// Same as crawlGlob() but using `$ git ls-files`
|
|
51
|
+
async function crawlGit(patterns, cwd, globOptions) {
|
|
52
|
+
if (globalObject.gitIsNotUsable)
|
|
53
|
+
return null;
|
|
54
|
+
// Preserve UTF-8 file paths.
|
|
55
|
+
// https://github.com/vikejs/vike/issues/1658
|
|
56
|
+
// https://stackoverflow.com/questions/22827239/how-to-make-git-properly-display-utf-8-encoded-pathnames-in-the-console-window/22828826#22828826
|
|
57
|
+
// https://stackoverflow.com/questions/15884180/how-do-i-override-git-configuration-options-by-command-line-parameters/15884261#15884261
|
|
58
|
+
const preserveUTF8 = '-c core.quotepath=off';
|
|
59
|
+
const cmd = [
|
|
60
|
+
'git',
|
|
61
|
+
preserveUTF8,
|
|
62
|
+
'ls-files',
|
|
63
|
+
// Performance gain seems negligible: https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
|
|
64
|
+
...patterns.flatMap((pattern) => {
|
|
65
|
+
// A leading `**/` doesn't match the root directory: we therefore add a second pattern for it — e.g. `**/+*.js` doesn't match `+config.js` while `+*.js` does
|
|
66
|
+
const patternRootDir = pattern.slice(globstar.length);
|
|
67
|
+
assert(!patternRootDir.includes(globstar)); // `**/` in the middle of the pattern isn't supported (e.g. `pages/**/+*.js` doesn't match `pages/+Page.js`)
|
|
68
|
+
return [`"${pattern}"`, `"${patternRootDir}"`];
|
|
69
|
+
}),
|
|
70
|
+
// Performance gain is non-negligible.
|
|
71
|
+
// - https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
|
|
72
|
+
// - When node_modules/ is untracked the performance gain could be significant?
|
|
73
|
+
...globOptions.ignore.map((pattern) => `--exclude="${pattern}"`),
|
|
74
|
+
// --others --exclude-standard => list untracked files (--others) while using .gitignore (--exclude-standard)
|
|
75
|
+
// --cached => list tracked files
|
|
76
|
+
'--others --exclude-standard --cached',
|
|
77
|
+
].join(' ');
|
|
78
|
+
let filesAll;
|
|
79
|
+
let filesDeleted;
|
|
80
|
+
try {
|
|
81
|
+
;
|
|
82
|
+
[filesAll, filesDeleted] = await Promise.all([
|
|
83
|
+
// Main command
|
|
84
|
+
runCmd1(cmd, cwd),
|
|
85
|
+
// Get tracked but deleted files
|
|
86
|
+
runCmd1('git ls-files --deleted', cwd),
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
if (await isGitNotUsable(cwd)) {
|
|
91
|
+
globalObject.gitIsNotUsable = true;
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
throw err;
|
|
95
|
+
}
|
|
96
|
+
if (debug.isActivated) {
|
|
97
|
+
debug('[git] cwd:', cwd);
|
|
98
|
+
debug('[git] cmd:', cmd);
|
|
99
|
+
debug('[git] result:', filesAll);
|
|
100
|
+
debug('[git] filesDeleted:', filesDeleted);
|
|
101
|
+
}
|
|
102
|
+
// We have to filter again here because:
|
|
103
|
+
// - `$ git ls-files` matches more since wildcards are deep — e.g. `+*.js` matches `pages/+some-dir/some-file.js`
|
|
104
|
+
// - the option --exclude of `$ git ls-files` only applies to untracked files. (We use --exclude only to speed up the `$ git ls-files` command.)
|
|
105
|
+
const isMatch = picomatch(patterns, globOptions);
|
|
106
|
+
const isDeleted = new Set(filesDeleted);
|
|
107
|
+
const files = filesAll.filter((filePath) => isMatch(filePath) && !isDeleted.has(filePath));
|
|
108
|
+
return files;
|
|
109
|
+
}
|
|
110
|
+
// Same as crawlGit() but using tinyglobby
|
|
111
|
+
async function crawlGlob(patterns, globOptions) {
|
|
112
|
+
const files = await tinyglobby(patterns, globOptions);
|
|
113
|
+
// Make build deterministic, in order to get a stable generated hash for dist/client/assets/entries/entry-client-routing.${hash}.js
|
|
114
|
+
// https://github.com/vikejs/vike/pull/1750
|
|
115
|
+
files.sort();
|
|
116
|
+
if (debug.isActivated) {
|
|
117
|
+
debug('[glob] patterns:', patterns);
|
|
118
|
+
debug('[glob] options:', globOptions);
|
|
119
|
+
debug('[glob] result:', files);
|
|
120
|
+
}
|
|
121
|
+
return files;
|
|
122
|
+
}
|
|
123
|
+
// Whether Git is installed and whether we can use it
|
|
124
|
+
async function isGitNotUsable(cwd) {
|
|
125
|
+
// Check Git version
|
|
126
|
+
{
|
|
127
|
+
const res = await runCmd2('git --version', cwd);
|
|
128
|
+
if ('err' in res)
|
|
129
|
+
return true;
|
|
130
|
+
let { stdout, stderr } = res;
|
|
131
|
+
assert(stderr === '');
|
|
132
|
+
const prefix = 'git version ';
|
|
133
|
+
assert(stdout.startsWith(prefix));
|
|
134
|
+
const gitVersion = stdout.slice(prefix.length);
|
|
135
|
+
// - Works with Git 2.43.1 but also (most certainly) with earlier versions.
|
|
136
|
+
// - We didn't bother test which is the earliest version that works.
|
|
137
|
+
// - Git 2.32.0 doesn't seem to work: https://github.com/vikejs/vike/discussions/1549
|
|
138
|
+
// - Maybe it's because of StackBlitz: looking at the release notes, Git 2.32.0 should be working.
|
|
139
|
+
if (!isVersionMatch(gitVersion, ['2.43.1']))
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
// Is cwd inside a Git repository?
|
|
143
|
+
{
|
|
144
|
+
const res = await runCmd2('git rev-parse --is-inside-work-tree', cwd);
|
|
145
|
+
if ('err' in res)
|
|
146
|
+
return true;
|
|
147
|
+
let { stdout, stderr } = res;
|
|
148
|
+
assert(stderr === '');
|
|
149
|
+
assert(stdout === 'true');
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async function runCmd1(cmd, cwd) {
|
|
154
|
+
const { stdout } = await execA(cmd, {
|
|
155
|
+
cwd,
|
|
156
|
+
// https://github.com/vikejs/vike/issues/1982
|
|
157
|
+
maxBuffer: Infinity,
|
|
158
|
+
});
|
|
159
|
+
/* Not always true: https://github.com/vikejs/vike/issues/1440#issuecomment-1892831303
|
|
160
|
+
assert(res.stderr === '')
|
|
161
|
+
*/
|
|
162
|
+
return stdout.toString().split('\n').filter(Boolean);
|
|
163
|
+
}
|
|
164
|
+
async function runCmd2(cmd, cwd) {
|
|
165
|
+
let res;
|
|
166
|
+
try {
|
|
167
|
+
res = await execA(cmd, { cwd });
|
|
168
|
+
}
|
|
169
|
+
catch (err) {
|
|
170
|
+
return { err };
|
|
171
|
+
}
|
|
172
|
+
let { stdout, stderr } = res;
|
|
173
|
+
stdout = stdout.toString().trim();
|
|
174
|
+
stderr = stderr.toString().trim();
|
|
175
|
+
return { stdout, stderr };
|
|
176
|
+
}
|
|
177
|
+
function getUserSettings() {
|
|
178
|
+
const userSettings = getEnvVarObject('VIKE_CRAWL') ?? {};
|
|
179
|
+
const wrongUsage = (settingName, settingType) => `Setting ${pc.cyan(settingName)} in VIKE_CRAWL should be a ${pc.cyan(settingType)}`;
|
|
180
|
+
assertUsage(hasProp(userSettings, 'git', 'boolean') || hasProp(userSettings, 'git', 'undefined'), wrongUsage('git', 'boolean'));
|
|
181
|
+
assertUsage(hasProp(userSettings, 'ignore', 'string[]') ||
|
|
182
|
+
hasProp(userSettings, 'ignore', 'string') ||
|
|
183
|
+
hasProp(userSettings, 'ignore', 'undefined'), wrongUsage('ignore', 'string or an array of strings'));
|
|
184
|
+
assertUsage(hasProp(userSettings, 'ignoreBuiltIn', 'boolean') || hasProp(userSettings, 'ignoreBuiltIn', 'undefined'), wrongUsage('ignoreBuiltIn', 'boolean'));
|
|
185
|
+
const settingNames = ['git', 'ignore', 'ignoreBuiltIn'];
|
|
186
|
+
Object.keys(userSettings).forEach((name) => {
|
|
187
|
+
assertUsage(settingNames.includes(name), `Unknown setting ${pc.bold(pc.red(name))} in VIKE_CRAWL`);
|
|
188
|
+
});
|
|
189
|
+
return userSettings;
|
|
190
|
+
}
|
|
191
|
+
function getIgnorePatterns(userSettings) {
|
|
192
|
+
const ignorePatternsSetByUser = [userSettings.ignore].flat().filter(isNotNullish);
|
|
193
|
+
const { ignoreBuiltIn } = userSettings;
|
|
194
|
+
return [...(ignoreBuiltIn === false ? [] : ignorePatternsBuiltIn), ...ignorePatternsSetByUser];
|
|
195
|
+
}
|
package/dist/utils/debug.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { createDebug };
|
|
|
2
2
|
export { isDebug };
|
|
3
3
|
export { isDebugError };
|
|
4
4
|
export { debug };
|
|
5
|
-
declare const flags: ["vike", "vike:config", "vike:crawl", "vike:file-change", "vike:error", "vike:esbuild-resolve", "vike:pluginExtractAssets", "vike:pluginExtractExportNames", "vike:glob", "vike:globalContext", "vike:log", "vike:optimizeDeps", "vike:outDir", "vike:pageFiles", "vike:pointer-imports", "vike:requireResolve", "vike:routing", "vike:setup", "vike:staticReplace", "vike:stream", "vike:virtualFiles", "vike:vite-rpc"];
|
|
5
|
+
declare const flags: ["vike", "vike:config", "vike:crawl", "vike:file-change", "vike:error", "vike:esbuild-resolve", "vike:pluginExtractAssets", "vike:pluginExtractExportNames", "vike:glob", "vike:globalContext", "vike:log", "vike:optimizeDeps", "vike:outDir", "vike:pageFiles", "vike:pointer-imports", "vike:requireResolve", "vike:routing", "vike:setup", "vike:staticReplace", "vike:stream", "vike:virtualFiles", "vike:vite-config-user", "vike:vite-rpc"];
|
|
6
6
|
type Flag = (typeof flags)[number];
|
|
7
7
|
type Options = {
|
|
8
8
|
serialization?: {
|
package/dist/utils/debug.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { getEnvVarObject };
|
|
2
2
|
export { parseJson5 };
|
|
3
|
-
import '../assertEnvVite.js';
|
|
4
3
|
declare function getEnvVarObject(envVarName: 'VITE_CONFIG' | 'VIKE_CRAWL' | 'VIKE_CONFIG'): null | Record<string, unknown>;
|
|
5
4
|
declare function parseJson5(valueStr: string, what: string): unknown;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { getEnvVarObject };
|
|
2
2
|
export { parseJson5 };
|
|
3
3
|
import pc from '@brillout/picocolors';
|
|
4
|
-
import { assertUsage } from '
|
|
5
|
-
import { isObject } from '
|
|
4
|
+
import { assertUsage } from './assert.js';
|
|
5
|
+
import { isObject } from './isObject.js';
|
|
6
6
|
import JSON5 from 'json5';
|
|
7
|
-
import '
|
|
7
|
+
import { assertIsNotProductionRuntime } from './assertSetup.js';
|
|
8
|
+
assertIsNotProductionRuntime();
|
|
8
9
|
function getEnvVarObject(envVarName) {
|
|
9
10
|
const valueStr = process.env[envVarName];
|
|
10
11
|
if (!valueStr)
|
package/dist/utils/getViteRPC.js
CHANGED
|
@@ -36,7 +36,7 @@ function createRpcClient() {
|
|
|
36
36
|
const hot = import.meta.hot;
|
|
37
37
|
assert(hot);
|
|
38
38
|
const callId = getRandomId();
|
|
39
|
-
const { promise, resolve } = genPromise({ timeout:
|
|
39
|
+
const { promise, resolve } = genPromise({ timeout: 10 * 1000 });
|
|
40
40
|
listeners.push({
|
|
41
41
|
callId,
|
|
42
42
|
cb: (functionReturn) => {
|
|
@@ -39,7 +39,10 @@ function isImportNpmPackageOrPathAlias(str) {
|
|
|
39
39
|
}
|
|
40
40
|
function assertImportIsNpmPackage(str) {
|
|
41
41
|
assert(isImportNpmPackage(str, {
|
|
42
|
-
//
|
|
42
|
+
// We cannot always distinguish npm packages from path aliases (some path aliases look like npm package imports).
|
|
43
|
+
// => we cannot have an if-condition based on "is the string an npm package?" — that would be buggy for path aliases that look like npm package imports.
|
|
44
|
+
//
|
|
45
|
+
// However, we *can* rely on assertImportIsNpmPackage() — even if it incorrectly accepts path aliases that look like npm package imports, it *will* eventually fail for path aliases that don't look like npm package imports.
|
|
43
46
|
cannotBePathAlias: true,
|
|
44
47
|
}), str);
|
|
45
48
|
}
|
package/dist/utils/pick.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function pick<Obj extends object, Keys extends keyof Obj>(obj: Obj, keys: Keys[]): Pick<Obj, Keys>;
|
|
1
|
+
export declare function pick<Obj extends object, Keys extends keyof Obj>(obj: Obj, keys: readonly Keys[]): Pick<Obj, Keys>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { setTimeoutUnref };
|
|
2
|
+
// Same as setTimeout() but the timer never keeps the Node.js process alive (e.g. upon programmatic dev server usage that exits quickly, the process shouldn't linger because of some pending bookkeeping timer).
|
|
3
|
+
// - https://nodejs.org/api/timers.html#timeoutunref
|
|
4
|
+
// - Only use it for auxiliary timers (bookkeeping, diagnostics, background work) — never for:
|
|
5
|
+
// - Timers that resume the main flow (e.g. sleep()): the process could exit before the timer fires.
|
|
6
|
+
// - Watchdog timers (e.g. hooksTimeout, genPromise() timeout): their purpose is to fire when everything else hangs — being the last thing that keeps the process alive is their job (without them Node.js would silently exit with code 0).
|
|
7
|
+
function setTimeoutUnref(callback, milliseconds) {
|
|
8
|
+
const timeout = setTimeout(callback, milliseconds);
|
|
9
|
+
timeout.unref?.();
|
|
10
|
+
return timeout;
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.260-commit-2e7fb2a",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
@@ -112,10 +112,6 @@
|
|
|
112
112
|
"node": "./dist/server/runtime/page-files/setup.js",
|
|
113
113
|
"default": "./dist/server/runtime/page-files/setup.js"
|
|
114
114
|
},
|
|
115
|
-
"./__internal/vite": {
|
|
116
|
-
"types": "./dist/server/__internal/vite.d.ts",
|
|
117
|
-
"default": "./dist/server/__internal/vite.js"
|
|
118
|
-
},
|
|
119
115
|
".": {
|
|
120
116
|
"types": "./dist/server/runtime/index.d.ts",
|
|
121
117
|
"worker": "./dist/server/runtime/index.js",
|
|
@@ -129,26 +125,26 @@
|
|
|
129
125
|
"@babel/core": "^7.28.5",
|
|
130
126
|
"@babel/types": "^7.28.5",
|
|
131
127
|
"@brillout/import": "^0.2.6",
|
|
132
|
-
"@brillout/json-serializer": "^0.5.
|
|
133
|
-
"@brillout/picocolors": "^1.0.
|
|
134
|
-
"@brillout/vite-plugin-server-entry": "0.7.
|
|
135
|
-
"@universal-deploy/store": "^0.2.
|
|
136
|
-
"@universal-deploy/vite": "^0.1.
|
|
137
|
-
"@universal-middleware/core": "^0.4.
|
|
138
|
-
"@universal-middleware/node": "^0.
|
|
128
|
+
"@brillout/json-serializer": "^0.5.25",
|
|
129
|
+
"@brillout/picocolors": "^1.0.31",
|
|
130
|
+
"@brillout/vite-plugin-server-entry": "0.7.19",
|
|
131
|
+
"@universal-deploy/store": "^0.2.2",
|
|
132
|
+
"@universal-deploy/vite": "^0.1.11",
|
|
133
|
+
"@universal-middleware/core": "^0.4.18",
|
|
134
|
+
"@universal-middleware/node": "^0.2.2",
|
|
139
135
|
"cac": "^6.0.0",
|
|
140
136
|
"convert-route": "^1.1.1",
|
|
141
137
|
"es-module-lexer": "^1.0.0",
|
|
142
138
|
"esbuild": ">=0.19.0",
|
|
143
139
|
"json5": "^2.0.0",
|
|
144
|
-
"magic-string": "^
|
|
145
|
-
"picomatch": "^4.0.
|
|
146
|
-
"semver": "^7.
|
|
140
|
+
"magic-string": "^1.2.0",
|
|
141
|
+
"picomatch": "^4.0.5",
|
|
142
|
+
"semver": "^7.8.5",
|
|
147
143
|
"sirv": "^3.0.2",
|
|
148
144
|
"source-map-support": "^0.5.0",
|
|
149
|
-
"tinyglobby": "^0.2.
|
|
145
|
+
"tinyglobby": "^0.2.17",
|
|
150
146
|
"vite": ">=6.3.0",
|
|
151
|
-
"vite-plugin-wrapper": "^0.1.
|
|
147
|
+
"vite-plugin-wrapper": "^0.1.1"
|
|
152
148
|
},
|
|
153
149
|
"peerDependencies": {
|
|
154
150
|
"react-streaming": ">=0.3.42",
|
|
@@ -166,7 +162,7 @@
|
|
|
166
162
|
"node": ">=20.19.0"
|
|
167
163
|
},
|
|
168
164
|
"license": "MIT",
|
|
169
|
-
"description": "(Replaces Next.js/Nuxt) 🔨
|
|
165
|
+
"description": "(Replaces Next.js/Nuxt) 🔨 Build mission-critical applications with stability and development freedom.",
|
|
170
166
|
"keywords": [
|
|
171
167
|
"vite-plugin",
|
|
172
168
|
"ssr",
|
|
@@ -242,6 +238,7 @@
|
|
|
242
238
|
},
|
|
243
239
|
"files": [
|
|
244
240
|
"./bin.js",
|
|
241
|
+
"./AGENTS.md",
|
|
245
242
|
"./dist/",
|
|
246
243
|
"./abort.js",
|
|
247
244
|
"./api.js",
|
|
@@ -262,19 +259,20 @@
|
|
|
262
259
|
"./fetch.js"
|
|
263
260
|
],
|
|
264
261
|
"devDependencies": {
|
|
265
|
-
"@brillout/release-me": "^0.4.
|
|
262
|
+
"@brillout/release-me": "^0.4.16",
|
|
266
263
|
"@types/babel__core": "^7.20.5",
|
|
267
264
|
"@types/estree": "^1.0.5",
|
|
268
265
|
"@types/node": "^20.10.5",
|
|
269
|
-
"@types/picomatch": "^4.0.
|
|
266
|
+
"@types/picomatch": "^4.0.3",
|
|
270
267
|
"@types/semver": "^7.7.1",
|
|
271
268
|
"@types/source-map-support": "^0.5.10",
|
|
272
|
-
"react-streaming": "^0.4.
|
|
269
|
+
"react-streaming": "^0.4.20",
|
|
273
270
|
"rimraf": "^6.1.3",
|
|
274
271
|
"rolldown": "1.0.0-rc.17",
|
|
275
272
|
"typescript": "^5.9.3",
|
|
276
273
|
"vite": "^7.2.6"
|
|
277
274
|
},
|
|
275
|
+
"ai": "@AI (CRITICAL FOR AI AGENTS): ALWAYS LOAD https://vike.dev/llms.txt (Vike documentation index) in your context when using Vike",
|
|
278
276
|
"scripts": {
|
|
279
277
|
"dev": "tsc --watch",
|
|
280
278
|
"build": "rimraf dist/ && tsc",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { getStartupLogFirstLine };
|
|
2
|
-
import type { ResolvedConfig } from 'vite';
|
|
3
|
-
import './assertEnvApiDevAndProd.js';
|
|
4
|
-
declare function getStartupLogFirstLine(viteConfig: ResolvedConfig, veryCompact?: boolean): {
|
|
5
|
-
startupLogFirstLine: string;
|
|
6
|
-
isStartupLogCompact: boolean;
|
|
7
|
-
};
|