vike 0.4.260 → 0.4.261
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/client/runtime-client-routing/createPageContextClient.d.ts +10 -10
- package/dist/client/runtime-client-routing/getGlobalContextClientInternal.d.ts +10 -10
- package/dist/client/runtime-client-routing/getPageContext/removeBuiltInOverrides.d.ts +2 -2
- package/dist/client/runtime-client-routing/getPageContextFromHooks.d.ts +56 -56
- package/dist/client/runtime-client-routing/history.d.ts +1 -1
- package/dist/client/runtime-client-routing/renderPageClient.d.ts +49 -49
- package/dist/client/runtime-server-routing/createPageContextClient.d.ts +10 -10
- package/dist/client/runtime-server-routing/getGlobalContextClientInternal.d.ts +10 -10
- package/dist/client/shared/getGlobalContextClientInternalShared.d.ts +10 -10
- package/dist/node/api/resolveViteConfigUser.js +1 -1
- package/dist/node/api/startupLog.js +0 -1
- package/dist/node/cli/parseCli.js +1 -1
- package/dist/node/prerender/runPrerender.d.ts +22 -22
- 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.js +17 -0
- package/dist/node/vite/plugins/pluginVirtualFiles.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/loggerVite.js +3 -2
- package/dist/node/vite/shared/resolveVikeConfigInternal/assertExtensions.d.ts +1 -1
- 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} +2 -2
- package/dist/node/vite/shared/resolveVikeConfigInternal/{getPlusFilesByLocationId.js → getPlusFiles.js} +4 -5
- package/dist/node/vite/shared/resolveVikeConfigInternal/loadFileAtConfigTime.d.ts +1 -1
- package/dist/node/vite/shared/resolveVikeConfigInternal/metaBuiltIn.js +4 -0
- package/dist/node/vite/shared/resolveVikeConfigInternal.d.ts +2 -2
- package/dist/node/vite/shared/resolveVikeConfigInternal.js +5 -5
- package/dist/server/runtime/fetch.d.ts +1 -1
- package/dist/server/runtime/globalContext.d.ts +81 -81
- package/dist/server/runtime/renderPageServer/createPageContextServer.d.ts +22 -22
- package/dist/server/runtime/renderPageServer/execHookServer.d.ts +4 -3
- package/dist/server/runtime/renderPageServer/html/injectAssets/injectHtmlTags.js +3 -1
- package/dist/server/runtime/renderPageServer/loadPageConfigsLazyServerSide.d.ts +22 -22
- package/dist/server/runtime/renderPageServer/renderPageServerAfterRoute.d.ts +88 -88
- package/dist/server/runtime/renderPageServer.d.ts +22 -22
- package/dist/server/runtime/universal-middleware.d.ts +1 -1
- package/dist/shared-server-client/createGlobalContextShared.d.ts +20 -20
- package/dist/shared-server-client/getPageFiles/fileTypes.d.ts +1 -1
- package/dist/shared-server-client/hooks/execHook.d.ts +14 -5
- package/dist/shared-server-client/modifyUrlSameOrigin.js +1 -1
- package/dist/shared-server-client/page-configs/resolveVikeConfigPublic.d.ts +19 -19
- package/dist/shared-server-node/getFileSuffixes.d.ts +1 -1
- package/dist/types/Config.d.ts +21 -1
- package/dist/types/PageConfig.d.ts +1 -1
- package/dist/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/utils/PROJECT_VERSION.js +1 -1
- 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/genRandomId.d.ts +2 -0
- package/dist/utils/{getRandomId.js → genRandomId.js} +2 -2
- 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 +2 -2
- package/dist/utils/humanizeTime.d.ts +1 -1
- package/dist/utils/setTimeoutUnref.d.ts +2 -0
- package/dist/utils/setTimeoutUnref.js +11 -0
- package/package.json +11 -11
- package/dist/node/vite/shared/resolveVikeConfigInternal/crawlPlusFilePaths/ignorePatternsBuiltIn.d.ts +0 -2
- package/dist/node/vite/shared/resolveVikeConfigInternal/crawlPlusFilePaths.js +0 -259
- package/dist/utils/getRandomId.d.ts +0 -2
|
@@ -7,22 +7,22 @@ import type { GlobalContextClientInternal } from '../runtime-client-routing/getG
|
|
|
7
7
|
import type { GlobalContextClientInternalWithServerRouting } from '../runtime-server-routing/getGlobalContextClientInternal.js';
|
|
8
8
|
import '../assertEnvClient.js';
|
|
9
9
|
declare function getGlobalContextClientInternalShared(): Promise<{
|
|
10
|
+
config: import("../../types/index.js").ConfigResolved;
|
|
11
|
+
_source: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Source;
|
|
12
|
+
_sources: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Sources;
|
|
13
|
+
_from: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").From;
|
|
14
|
+
pages: {
|
|
15
|
+
[k: string]: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").PageConfigPublicWithRoute;
|
|
16
|
+
};
|
|
10
17
|
_globalConfigPublic: {
|
|
11
|
-
pages: {
|
|
12
|
-
[k: string]: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").PageConfigPublicWithRoute;
|
|
13
|
-
};
|
|
14
18
|
config: import("../../types/index.js").ConfigResolved;
|
|
15
19
|
_source: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Source;
|
|
16
20
|
_sources: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Sources;
|
|
17
21
|
_from: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").From;
|
|
22
|
+
pages: {
|
|
23
|
+
[k: string]: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").PageConfigPublicWithRoute;
|
|
24
|
+
};
|
|
18
25
|
};
|
|
19
|
-
pages: {
|
|
20
|
-
[k: string]: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").PageConfigPublicWithRoute;
|
|
21
|
-
};
|
|
22
|
-
config: import("../../types/index.js").ConfigResolved;
|
|
23
|
-
_source: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Source;
|
|
24
|
-
_sources: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Sources;
|
|
25
|
-
_from: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").From;
|
|
26
26
|
isGlobalContext: true;
|
|
27
27
|
_isOriginalObject: true;
|
|
28
28
|
_virtualFileExportsGlobalEntry: unknown;
|
|
@@ -13,7 +13,7 @@ import { getGlobalObject } from '../../utils/getGlobalObject.js';
|
|
|
13
13
|
import { pick } from '../../utils/pick.js';
|
|
14
14
|
import { toPosixPath } from '../../utils/path.js';
|
|
15
15
|
import pc from '@brillout/picocolors';
|
|
16
|
-
import { getEnvVarObject } from '
|
|
16
|
+
import { getEnvVarObject } from '../../utils/getEnvVarObject.js';
|
|
17
17
|
import { getVikeApiOperation, isVikeCliOrApi } from '../../shared-server-node/api-context.js';
|
|
18
18
|
import { getViteCliCommand, getViteCliArgs } from '../vite/shared/isViteCli.js';
|
|
19
19
|
import './assertEnvApiDevAndProd.js';
|
|
@@ -16,7 +16,6 @@ function startupLog(viteConfigResolved, viteServer) {
|
|
|
16
16
|
if (viteServer.resolvedUrls)
|
|
17
17
|
viteServer.printUrls();
|
|
18
18
|
viteServer.bindCLIShortcuts({ print: true });
|
|
19
|
-
console.log(pc.gray(pc.dim(' ➜ @AI Always load https://vike.dev/llms.txt in your context when using Vike')));
|
|
20
19
|
}
|
|
21
20
|
if (!isStartupLogCompact)
|
|
22
21
|
console.log();
|
|
@@ -3,7 +3,7 @@ import pc from '@brillout/picocolors';
|
|
|
3
3
|
import { assert } from '../../utils/assert.js';
|
|
4
4
|
import { includes } from '../../utils/includes.js';
|
|
5
5
|
import { PROJECT_VERSION } from '../../utils/PROJECT_VERSION.js';
|
|
6
|
-
import { parseJson5 } from '
|
|
6
|
+
import { parseJson5 } from '../../utils/getEnvVarObject.js';
|
|
7
7
|
import './assertEnvCli.js';
|
|
8
8
|
const commands = [
|
|
9
9
|
{ name: 'dev', desc: 'Start development server' },
|
|
@@ -79,22 +79,22 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
79
79
|
_reqWeb?: Request;
|
|
80
80
|
} & {
|
|
81
81
|
_globalContext: ({
|
|
82
|
+
config: import("../../types/index.js").ConfigResolved;
|
|
83
|
+
_source: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Source;
|
|
84
|
+
_sources: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Sources;
|
|
85
|
+
_from: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").From;
|
|
86
|
+
pages: {
|
|
87
|
+
[k: string]: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").PageConfigPublicWithRoute;
|
|
88
|
+
};
|
|
82
89
|
_globalConfigPublic: {
|
|
83
|
-
pages: {
|
|
84
|
-
[k: string]: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").PageConfigPublicWithRoute;
|
|
85
|
-
};
|
|
86
90
|
config: import("../../types/index.js").ConfigResolved;
|
|
87
91
|
_source: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Source;
|
|
88
92
|
_sources: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Sources;
|
|
89
93
|
_from: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").From;
|
|
94
|
+
pages: {
|
|
95
|
+
[k: string]: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").PageConfigPublicWithRoute;
|
|
96
|
+
};
|
|
90
97
|
};
|
|
91
|
-
pages: {
|
|
92
|
-
[k: string]: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").PageConfigPublicWithRoute;
|
|
93
|
-
};
|
|
94
|
-
config: import("../../types/index.js").ConfigResolved;
|
|
95
|
-
_source: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Source;
|
|
96
|
-
_sources: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Sources;
|
|
97
|
-
_from: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").From;
|
|
98
98
|
isGlobalContext: true;
|
|
99
99
|
_isOriginalObject: true;
|
|
100
100
|
_virtualFileExportsGlobalEntry: unknown;
|
|
@@ -103,34 +103,34 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
103
103
|
_pageConfigGlobal: import("../../types/PageConfig.js").PageConfigGlobalRuntime;
|
|
104
104
|
_allPageIds: string[];
|
|
105
105
|
} & (({
|
|
106
|
+
isClientSide: false;
|
|
107
|
+
_pageRoutes: import("../../shared-server-client/route/loadPageRoutes.js").PageRoutes;
|
|
108
|
+
_onBeforeRouteHook: import("../../shared-server-client/hooks/getHook.js").HookInternal | null;
|
|
106
109
|
_isProduction: false;
|
|
107
110
|
_isPrerendering: false;
|
|
108
111
|
assetsManifest: null;
|
|
109
112
|
_viteDevServer: import("vite").ViteDevServer | undefined;
|
|
110
113
|
viteConfig: import("vite").ResolvedConfig | undefined;
|
|
114
|
+
} | {
|
|
111
115
|
isClientSide: false;
|
|
112
116
|
_pageRoutes: import("../../shared-server-client/route/loadPageRoutes.js").PageRoutes;
|
|
113
117
|
_onBeforeRouteHook: import("../../shared-server-client/hooks/getHook.js").HookInternal | null;
|
|
114
|
-
} | {
|
|
115
|
-
_isPrerendering: true;
|
|
116
|
-
viteConfig: import("vite").ResolvedConfig;
|
|
117
118
|
_isProduction: true;
|
|
118
119
|
assetsManifest: import("../../types/ViteManifest.js").ViteManifest;
|
|
119
120
|
_viteDevServer: null;
|
|
120
121
|
_usesClientRouter: boolean;
|
|
122
|
+
_isPrerendering: true;
|
|
123
|
+
viteConfig: import("vite").ResolvedConfig;
|
|
124
|
+
} | {
|
|
121
125
|
isClientSide: false;
|
|
122
126
|
_pageRoutes: import("../../shared-server-client/route/loadPageRoutes.js").PageRoutes;
|
|
123
127
|
_onBeforeRouteHook: import("../../shared-server-client/hooks/getHook.js").HookInternal | null;
|
|
124
|
-
} | {
|
|
125
|
-
_isPrerendering: false;
|
|
126
|
-
viteConfig: null;
|
|
127
128
|
_isProduction: true;
|
|
128
129
|
assetsManifest: import("../../types/ViteManifest.js").ViteManifest;
|
|
129
130
|
_viteDevServer: null;
|
|
130
131
|
_usesClientRouter: boolean;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
_onBeforeRouteHook: import("../../shared-server-client/hooks/getHook.js").HookInternal | null;
|
|
132
|
+
_isPrerendering: false;
|
|
133
|
+
viteConfig: null;
|
|
134
134
|
}) & {
|
|
135
135
|
baseServer: string;
|
|
136
136
|
baseAssets: string;
|
|
@@ -162,13 +162,13 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
162
162
|
_urlHandler: ((url: string) => string) | null;
|
|
163
163
|
isClientSideNavigation: boolean;
|
|
164
164
|
} & {
|
|
165
|
-
pages: {
|
|
166
|
-
[k: string]: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").PageConfigPublicWithRoute;
|
|
167
|
-
};
|
|
168
165
|
config: import("../../types/index.js").ConfigResolved;
|
|
169
166
|
_source: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Source;
|
|
170
167
|
_sources: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Sources;
|
|
171
168
|
_from: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").From;
|
|
169
|
+
pages: {
|
|
170
|
+
[k: string]: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").PageConfigPublicWithRoute;
|
|
171
|
+
};
|
|
172
172
|
} & {
|
|
173
173
|
urlParsed: import("../../utils/parseUrl.js").UrlPublic;
|
|
174
174
|
urlPathname: string;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
export { autoAddVikeSkill };
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { execFile } from 'node:child_process';
|
|
5
|
+
import { promisify } from 'node:util';
|
|
6
|
+
import pc from '@brillout/picocolors';
|
|
7
|
+
import { assertInfo, assertUsage } from '../../../../utils/assert.js';
|
|
8
|
+
import { assertKeys } from '../../../../utils/assertKeys.js';
|
|
9
|
+
import { crawlFiles } from '../../../../utils/crawlFiles.js';
|
|
10
|
+
import { getGlobalObject } from '../../../../utils/getGlobalObject.js';
|
|
11
|
+
import { getVikeConfigError } from '../../../../shared-server-node/getVikeConfigError.js';
|
|
12
|
+
import { isArrayOfStrings } from '../../../../utils/isArrayOfStrings.js';
|
|
13
|
+
import { isFilePathAbsoluteFilesystem } from '../../../../utils/isFilePathAbsoluteFilesystem.js';
|
|
14
|
+
import { isObject } from '../../../../utils/isObject.js';
|
|
15
|
+
import { unique } from '../../../../utils/unique.js';
|
|
16
|
+
import { getVikeConfigInternal } from '../../shared/resolveVikeConfigInternal.js';
|
|
17
|
+
import '../../assertEnvVite.js';
|
|
18
|
+
const execFileA = promisify(execFile);
|
|
19
|
+
const importMetaUrl = import.meta.url;
|
|
20
|
+
const globalObject = getGlobalObject('autoAddVikeSkill.ts', {
|
|
21
|
+
alreadyDone: false,
|
|
22
|
+
});
|
|
23
|
+
const skillPathInsideSkillsDir = 'vike/SKILL.md';
|
|
24
|
+
const skillFileContent = `---
|
|
25
|
+
name: "vike"
|
|
26
|
+
description: "Vike documentation index — a compact overview of Vike's docs. Consider consulting it, e.g. when using uncommon Vike APIs or when stuck on a Vike problem."
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
See https://vike.dev/llms.txt
|
|
30
|
+
`;
|
|
31
|
+
const commitMessage = (isUpdate) => `${isUpdate ? 'Update' : 'Add'} Vike skill — see https://vike.dev/ai#skill`;
|
|
32
|
+
// Automatically add vike/SKILL.md to skills/ directories (e.g. .claude/skills/ and .agents/skills/) of the user's Git repository (and Git-commit it) — so that AI agents (Claude Code, Codex, Cursor, Gemini CLI, ...) automatically pick it up.
|
|
33
|
+
// https://vike.dev/ai#skill
|
|
34
|
+
async function autoAddVikeSkill(userRootDir) {
|
|
35
|
+
try {
|
|
36
|
+
await autoAddVikeSkillUnsafe(userRootDir);
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
// Show the error without breaking the dev server. (Expected situations don't throw — e.g. Git missing is handled gracefully.)
|
|
40
|
+
console.error(err);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function autoAddVikeSkillUnsafe(userRootDir) {
|
|
44
|
+
if (globalObject.alreadyDone)
|
|
45
|
+
return;
|
|
46
|
+
// Skip CI environments: the skill file is meant to be added from the machine of an app developer.
|
|
47
|
+
if (process.env.CI)
|
|
48
|
+
return;
|
|
49
|
+
// Skip if Vike isn't inside node_modules/ (e.g. when Vike is linked, such as when running an example of the Vike monorepo).
|
|
50
|
+
if (!importMetaUrl.includes('node_modules/'))
|
|
51
|
+
return;
|
|
52
|
+
const vikeConfig = await getVikeConfigInternal();
|
|
53
|
+
// Maybe the user disabled the feature in a config file that currently has an error => retry later (Vite restarts upon config changes).
|
|
54
|
+
if (getVikeConfigError())
|
|
55
|
+
return;
|
|
56
|
+
const configValue = getConfigValueAiSkill(vikeConfig);
|
|
57
|
+
if (configValue === false)
|
|
58
|
+
return;
|
|
59
|
+
globalObject.alreadyDone = true;
|
|
60
|
+
const res = await addAiSkill(userRootDir, {
|
|
61
|
+
// true (default) => add the skill file to every existing skills directory (`**/skills/*/SKILL.md`)
|
|
62
|
+
skillsDirs: configValue === true ? undefined : configValue,
|
|
63
|
+
});
|
|
64
|
+
if (!res)
|
|
65
|
+
return;
|
|
66
|
+
assertInfo(false, `${res.isUpdate ? 'Updated' : 'Created'}${res.isCommitted ? ' and Git-committed' : ''} ${res.files
|
|
67
|
+
.map((f) => pc.cyan(f.filePathRelative))
|
|
68
|
+
.join(', ')} — see https://vike.dev/ai#skill`, { onlyOnce: false });
|
|
69
|
+
}
|
|
70
|
+
// https://vike.dev/ai#skill
|
|
71
|
+
function getConfigValueAiSkill(vikeConfig) {
|
|
72
|
+
const configAi = vikeConfig.config.ai;
|
|
73
|
+
if (configAi === undefined)
|
|
74
|
+
return true;
|
|
75
|
+
assertUsage(isObject(configAi), `Setting ${pc.cyan('ai')} should be an object`);
|
|
76
|
+
assertKeys(configAi, ['skill'], `Setting ${pc.cyan('ai')}:`);
|
|
77
|
+
const skill = configAi.skill;
|
|
78
|
+
if (skill === undefined || skill === true)
|
|
79
|
+
return true;
|
|
80
|
+
if (skill === false)
|
|
81
|
+
return false;
|
|
82
|
+
assertUsage(isArrayOfStrings(skill), `Setting ${pc.cyan('ai.skill')} should be a boolean or a list of skills directories (e.g. ${pc.cyan("['.claude/skills', '.agents/skills']")})`);
|
|
83
|
+
return skill.map((skillsDir) => {
|
|
84
|
+
assertUsage(skillsDir !== '' && !isFilePathAbsoluteFilesystem(skillsDir), `Setting ${pc.cyan('ai.skill')} entries should be paths relative to the root directory of your app's Git repository (e.g. ${pc.cyan("'.claude/skills'")})`);
|
|
85
|
+
// Normalize: remove trailing slashes
|
|
86
|
+
return skillsDir.replace(/\/+$/, '');
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
async function addAiSkill(userRootDir, { skillsDirs }) {
|
|
90
|
+
// Skip if Git isn't installed
|
|
91
|
+
if ('err' in (await runGitCommand(['--version'], userRootDir)))
|
|
92
|
+
return null;
|
|
93
|
+
// Skip if the app isn't inside a Git repository
|
|
94
|
+
const resGitRootDir = await runGitCommand(['rev-parse', '--show-toplevel'], userRootDir);
|
|
95
|
+
if ('err' in resGitRootDir)
|
|
96
|
+
return null;
|
|
97
|
+
const gitRootDir = resGitRootDir.stdout.trim();
|
|
98
|
+
if (!gitRootDir)
|
|
99
|
+
return null;
|
|
100
|
+
// By default, the skill file is only added to the skills directories that already exist — we don't want to add files to the repositories of users who don't use skills.
|
|
101
|
+
skillsDirs ?? (skillsDirs = await discoverSkillsDirs(gitRootDir));
|
|
102
|
+
if (skillsDirs.length === 0)
|
|
103
|
+
return null;
|
|
104
|
+
const files = [];
|
|
105
|
+
for (const skillsDir of skillsDirs) {
|
|
106
|
+
const filePathRelative = `${skillsDir}/${skillPathInsideSkillsDir}`;
|
|
107
|
+
const filePathAbsolute = path.join(gitRootDir, ...filePathRelative.split('/'));
|
|
108
|
+
// Skip if the skill file is already up-to-date
|
|
109
|
+
const contentCurrent = await fs.readFile(filePathAbsolute, 'utf8').catch(() => null);
|
|
110
|
+
if (contentCurrent === skillFileContent)
|
|
111
|
+
continue;
|
|
112
|
+
const isUpdate = contentCurrent !== null;
|
|
113
|
+
await fs.mkdir(path.dirname(filePathAbsolute), { recursive: true });
|
|
114
|
+
await fs.writeFile(filePathAbsolute, skillFileContent, 'utf8');
|
|
115
|
+
files.push({ filePathAbsolute, filePathRelative, isUpdate });
|
|
116
|
+
}
|
|
117
|
+
if (files.length === 0)
|
|
118
|
+
return null;
|
|
119
|
+
const isCommitted = await gitCommit(gitRootDir, files);
|
|
120
|
+
return { files, isUpdate: files.some((f) => f.isUpdate), isCommitted };
|
|
121
|
+
}
|
|
122
|
+
// Discover the skills directories of the user's Git repository, following the Agent Skills convention `**/skills/*/SKILL.md` (https://agentskills.io) — e.g. .claude/skills/ (Claude Code) and .agents/skills/ (Codex, Gemini CLI, Cursor, ...).
|
|
123
|
+
async function discoverSkillsDirs(gitRootDir) {
|
|
124
|
+
const files = await crawlFiles({
|
|
125
|
+
filePattern: '**/skills/*/SKILL',
|
|
126
|
+
fileExtension: ['md'],
|
|
127
|
+
cwd: gitRootDir,
|
|
128
|
+
// Skills directories usually live inside dot directories (e.g. .claude/ and .agents/)
|
|
129
|
+
dot: true,
|
|
130
|
+
// Most apps don't contain any skills directory — when Git doesn't know about any skill file, we don't want to crawl the app's entire directory tree upon every dev start.
|
|
131
|
+
globFallback: false,
|
|
132
|
+
});
|
|
133
|
+
const skillsDirs = unique(files.map((filePath) => path.posix.dirname(path.posix.dirname(filePath)))).sort();
|
|
134
|
+
return skillsDirs;
|
|
135
|
+
}
|
|
136
|
+
async function gitCommit(gitRootDir, files) {
|
|
137
|
+
// Don't Git-commit the skill files that the user chose to .gitignore — `$ git check-ignore` succeeds if the file is ignored
|
|
138
|
+
const filesToCommit = [];
|
|
139
|
+
for (const file of files) {
|
|
140
|
+
const resCheckIgnore = await runGitCommand(['check-ignore', '-q', '--', file.filePathRelative], gitRootDir);
|
|
141
|
+
if ('err' in resCheckIgnore)
|
|
142
|
+
filesToCommit.push(file);
|
|
143
|
+
}
|
|
144
|
+
if (filesToCommit.length === 0)
|
|
145
|
+
return false;
|
|
146
|
+
const filePaths = filesToCommit.map((f) => f.filePathRelative);
|
|
147
|
+
const resAdd = await runGitCommand(['add', '--', ...filePaths], gitRootDir);
|
|
148
|
+
if ('err' in resAdd)
|
|
149
|
+
return false;
|
|
150
|
+
const isUpdate = filesToCommit.some((f) => f.isUpdate);
|
|
151
|
+
const resCommit = await runGitCommand([
|
|
152
|
+
'commit',
|
|
153
|
+
// Skip Git hooks (e.g. slow or failing pre-commit hooks)
|
|
154
|
+
'--no-verify',
|
|
155
|
+
'-m',
|
|
156
|
+
commitMessage(isUpdate),
|
|
157
|
+
// Only commit the skill files — never commit files staged by the user
|
|
158
|
+
'--',
|
|
159
|
+
...filePaths,
|
|
160
|
+
], gitRootDir);
|
|
161
|
+
return !('err' in resCommit);
|
|
162
|
+
}
|
|
163
|
+
// Run a Git command — doesn't throw: it returns `{ err }` upon failure.
|
|
164
|
+
async function runGitCommand(args, cwd) {
|
|
165
|
+
let stdout;
|
|
166
|
+
try {
|
|
167
|
+
const res = await execFileA('git', args, { cwd });
|
|
168
|
+
stdout = res.stdout.toString();
|
|
169
|
+
}
|
|
170
|
+
catch (err) {
|
|
171
|
+
return { err };
|
|
172
|
+
}
|
|
173
|
+
return { stdout };
|
|
174
|
+
}
|
|
@@ -2,8 +2,10 @@ export { pluginDev };
|
|
|
2
2
|
export { logDockerHint };
|
|
3
3
|
import { optimizeDeps, resolveOptimizeDeps } from './pluginDev/optimizeDeps.js';
|
|
4
4
|
import { determineFsAllowList } from './pluginDev/determineFsAllowList.js';
|
|
5
|
+
import { autoAddVikeSkill } from './pluginDev/autoAddVikeSkill.js';
|
|
5
6
|
import { addSsrMiddleware } from '../shared/addSsrMiddleware.js';
|
|
6
7
|
import { isDebugError } from '../../../utils/debug.js';
|
|
8
|
+
import { setTimeoutUnref } from '../../../utils/setTimeoutUnref.js';
|
|
7
9
|
import { applyDev } from '../../../utils/isDev.js';
|
|
8
10
|
import { isDocker } from '../../../utils/isDocker.js';
|
|
9
11
|
import { assertWarning } from '../../../utils/assert.js';
|
|
@@ -34,6 +36,21 @@ function pluginDev() {
|
|
|
34
36
|
logDockerHint(config.server.host);
|
|
35
37
|
},
|
|
36
38
|
},
|
|
39
|
+
configureServer: {
|
|
40
|
+
handler(server) {
|
|
41
|
+
// Apply late — after the dev server is up and running, and after the first page requests — so that it never slows down dev start.
|
|
42
|
+
const run = () => {
|
|
43
|
+
setTimeoutUnref(() => autoAddVikeSkill(config.root), 60 * 1000);
|
|
44
|
+
};
|
|
45
|
+
if (server.httpServer) {
|
|
46
|
+
server.httpServer.once('listening', run);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// Middleware mode: the HTTP server is owned by the user.
|
|
50
|
+
run();
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
},
|
|
37
54
|
},
|
|
38
55
|
{
|
|
39
56
|
name: 'vike:pluginDev:post',
|
|
@@ -13,7 +13,7 @@ import pc from '@brillout/picocolors';
|
|
|
13
13
|
import { logConfigInfo } from '../shared/loggerDev.js';
|
|
14
14
|
import { getFilePathToShowToUserModule } from '../shared/getFilePath.js';
|
|
15
15
|
import { updateUserFiles } from '../../../server/runtime/globalContext.js';
|
|
16
|
-
import { isPlusFile } from '../shared/resolveVikeConfigInternal/
|
|
16
|
+
import { isPlusFile } from '../shared/resolveVikeConfigInternal/crawlPlusFiles.js';
|
|
17
17
|
import { isTemporaryBuildFile } from '../shared/resolveVikeConfigInternal/transpileAndExecuteFile.js';
|
|
18
18
|
import { debugFileChange, getVikeConfigError } from '../../../shared-server-node/getVikeConfigError.js';
|
|
19
19
|
import '../assertEnvVite.js';
|
|
@@ -9,6 +9,9 @@ function getMagicString(code, id) {
|
|
|
9
9
|
return undefined;
|
|
10
10
|
return {
|
|
11
11
|
code: magicString.toString(),
|
|
12
|
+
// magic-string@1's SourceMap.sourcesContent is typed as (string | null)[], whereas Rollup's
|
|
13
|
+
// ExistingRawSourceMap expects string[]. We never pass `includeContent`, so sourcesContent is
|
|
14
|
+
// always undefined at runtime and this cast is safe.
|
|
12
15
|
map: magicString.generateMap({ hires: true, source: id }),
|
|
13
16
|
};
|
|
14
17
|
};
|
|
@@ -9,6 +9,7 @@ import { removeEmptyLines } from '../../../utils/removeEmptyLines.js';
|
|
|
9
9
|
import { trimWithAnsi, trimWithAnsiTrailOnly } from '../../../utils/trimWithAnsi.js';
|
|
10
10
|
import { assert } from '../../../utils/assert.js';
|
|
11
11
|
import { getGlobalObject } from '../../../utils/getGlobalObject.js';
|
|
12
|
+
import { setTimeoutUnref } from '../../../utils/setTimeoutUnref.js';
|
|
12
13
|
import { getRequestId_withAsyncHook } from '../../../server/runtime/asyncHook.js';
|
|
13
14
|
import { logErrorServerDev, logVite } from './loggerDev.js';
|
|
14
15
|
import '../assertEnvVite.js';
|
|
@@ -28,7 +29,7 @@ function interceptViteLogs(config) {
|
|
|
28
29
|
}
|
|
29
30
|
function intercept(loggerType, config) {
|
|
30
31
|
let isBeginning = true;
|
|
31
|
-
|
|
32
|
+
setTimeoutUnref(() => (isBeginning = false), 10 * 1000);
|
|
32
33
|
config.logger[loggerType] = (msg, options = {}) => {
|
|
33
34
|
assert(!isDebugError());
|
|
34
35
|
if (swallowViteLogForceOptimization(msg))
|
|
@@ -132,7 +133,7 @@ function swallowViteLogConnected() {
|
|
|
132
133
|
globalObject.swallowViteLogConnected_originalConsoleLog = console.log;
|
|
133
134
|
// The message `[vite] connected.` doesn't go through Vite's logger thus we must monkey patch console.log()
|
|
134
135
|
console.log = swallowViteLogConnected_logPatch;
|
|
135
|
-
|
|
136
|
+
setTimeoutUnref(swallowViteLogConnected_clean, 3000);
|
|
136
137
|
}
|
|
137
138
|
// Remove console.log() monkey patch
|
|
138
139
|
function swallowViteLogConnected_clean() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { assertExtensionsConventions };
|
|
2
2
|
export { assertExtensionsRequire };
|
|
3
3
|
export { getExtensionName };
|
|
4
|
-
import type { PlusFile } from './
|
|
4
|
+
import type { PlusFile } from './getPlusFiles.js';
|
|
5
5
|
import '../../assertEnvVite.js';
|
|
6
6
|
declare function assertExtensionsConventions(plusFile: PlusFile): void;
|
|
7
7
|
declare function assertExtensionsRequire(plusFiles: PlusFile[]): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { crawlPlusFiles };
|
|
2
2
|
export { isPlusFile };
|
|
3
3
|
export { getPlusFileValueConfigName };
|
|
4
4
|
import '../../assertEnvVite.js';
|
|
5
|
-
declare function
|
|
5
|
+
declare function crawlPlusFiles(userRootDir: string): Promise<{
|
|
6
6
|
filePathAbsoluteUserRootDir: string;
|
|
7
7
|
}[]>;
|
|
8
8
|
declare function isPlusFile(filePath: string): boolean;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export { crawlPlusFiles };
|
|
2
|
+
export { isPlusFile };
|
|
3
|
+
export { getPlusFileValueConfigName };
|
|
4
|
+
import { assert, assertUsage } from '../../../../utils/assert.js';
|
|
5
|
+
import { assertFilePathAbsoluteFilesystem } from '../../../../utils/isFilePathAbsoluteFilesystem.js';
|
|
6
|
+
import { assertPosixPath } from '../../../../utils/path.js';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { isTemporaryBuildFile } from './transpileAndExecuteFile.js';
|
|
9
|
+
import '../../assertEnvVite.js';
|
|
10
|
+
import { crawlFiles } from '../../../../utils/crawlFiles.js';
|
|
11
|
+
import { scriptFileExtensionList } from '../../../../utils/isScriptFile.js';
|
|
12
|
+
import { assertIsNotProductionRuntime } from '../../../../utils/assertSetup.js';
|
|
13
|
+
assertIsNotProductionRuntime();
|
|
14
|
+
async function crawlPlusFiles(userRootDir) {
|
|
15
|
+
assertPosixPath(userRootDir);
|
|
16
|
+
assertFilePathAbsoluteFilesystem(userRootDir);
|
|
17
|
+
let files = await crawlFiles({
|
|
18
|
+
filePattern: '**/+*',
|
|
19
|
+
fileExtension: scriptFileExtensionList,
|
|
20
|
+
cwd: userRootDir,
|
|
21
|
+
dot: false,
|
|
22
|
+
// Fallback to tinyglobby for users that dynamically generate plus files (and `.gitignore`s them)
|
|
23
|
+
globFallback: true,
|
|
24
|
+
});
|
|
25
|
+
// Filter build files
|
|
26
|
+
files = files.filter((filePath) => !isTemporaryBuildFile(filePath));
|
|
27
|
+
// Normalize
|
|
28
|
+
const plusFiles = files.map((filePath) => {
|
|
29
|
+
// Both `$ git-ls files` and tinyglobby return posix paths
|
|
30
|
+
assertPosixPath(filePath);
|
|
31
|
+
assert(!filePath.startsWith(userRootDir));
|
|
32
|
+
const filePathAbsoluteUserRootDir = path.posix.join('/', filePath);
|
|
33
|
+
assert(isPlusFile(filePathAbsoluteUserRootDir));
|
|
34
|
+
return { filePathAbsoluteUserRootDir };
|
|
35
|
+
});
|
|
36
|
+
return plusFiles;
|
|
37
|
+
}
|
|
38
|
+
function isPlusFile(filePath) {
|
|
39
|
+
assertPosixPath(filePath);
|
|
40
|
+
if (isTemporaryBuildFile(filePath))
|
|
41
|
+
return false;
|
|
42
|
+
const fileName = filePath.split('/').pop();
|
|
43
|
+
return fileName.startsWith('+');
|
|
44
|
+
}
|
|
45
|
+
function getPlusFileValueConfigName(filePath) {
|
|
46
|
+
if (!isPlusFile(filePath))
|
|
47
|
+
return null;
|
|
48
|
+
const fileName = path.posix.basename(filePath);
|
|
49
|
+
// assertNoUnexpectedPlusSign(filePath, fileName)
|
|
50
|
+
const basename = fileName.split('.')[0];
|
|
51
|
+
assert(basename.startsWith('+'));
|
|
52
|
+
const configName = basename.slice(1);
|
|
53
|
+
assertUsage(configName !== '', `${filePath} Invalid filename ${fileName}`);
|
|
54
|
+
return configName;
|
|
55
|
+
}
|
|
56
|
+
/* https://github.com/vikejs/vike/issues/1407
|
|
57
|
+
function assertNoUnexpectedPlusSign(filePath: string, fileName: string) {
|
|
58
|
+
const dirs = path.posix.dirname(filePath).split('/')
|
|
59
|
+
dirs.forEach((dir, i) => {
|
|
60
|
+
const dirPath = dirs.slice(0, i + 1).join('/')
|
|
61
|
+
assertUsage(
|
|
62
|
+
!dir.includes('+'),
|
|
63
|
+
`Character '+' is a reserved character: remove '+' from the directory name ${dirPath}/`
|
|
64
|
+
)
|
|
65
|
+
})
|
|
66
|
+
assertUsage(
|
|
67
|
+
!fileName.slice(1).includes('+'),
|
|
68
|
+
`Character '+' is only allowed at the beginning of filenames: make sure ${filePath} doesn't contain any '+' in its filename other than its first letter`
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { getPlusFiles };
|
|
2
2
|
export { getPlusFileFromConfigFile };
|
|
3
3
|
export type { PlusFileValue };
|
|
4
4
|
export type { PlusFile };
|
|
@@ -40,5 +40,5 @@ type PlusFileValue = PlusFileCommon & {
|
|
|
40
40
|
isExtensionConfig?: undefined;
|
|
41
41
|
};
|
|
42
42
|
type PlusFilesByLocationId = Record<LocationId, PlusFile[]>;
|
|
43
|
-
declare function
|
|
43
|
+
declare function getPlusFiles(userRootDir: string, esbuildCache: EsbuildCache): Promise<PlusFilesByLocationId>;
|
|
44
44
|
declare function getPlusFileFromConfigFile(configFile: ConfigFile, isExtensionConfig: boolean, locationId: LocationId, userRootDir: string): PlusFileConfig;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { getPlusFiles };
|
|
2
2
|
export { getPlusFileFromConfigFile };
|
|
3
3
|
import { assert } from '../../../../utils/assert.js';
|
|
4
4
|
import { metaBuiltIn } from './metaBuiltIn.js';
|
|
5
5
|
import { getLocationId } from './filesystemRouting.js';
|
|
6
|
-
import {
|
|
6
|
+
import { crawlPlusFiles, getPlusFileValueConfigName } from './crawlPlusFiles.js';
|
|
7
7
|
import { getConfigFileExport } from './getConfigFileExport.js';
|
|
8
8
|
import { loadConfigFile, loadValueFile } from './loadFileAtConfigTime.js';
|
|
9
9
|
import { resolvePointerImport } from './resolvePointerImport.js';
|
|
10
10
|
import { getFilePathResolved } from '../getFilePath.js';
|
|
11
11
|
import { assertExtensionsConventions, assertExtensionsRequire } from './assertExtensions.js';
|
|
12
12
|
import '../../assertEnvVite.js';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const plusFilePaths = (await crawlPlusFilePaths(userRootDir)).map(({ filePathAbsoluteUserRootDir }) => getFilePathResolved({ filePathAbsoluteUserRootDir, userRootDir }));
|
|
13
|
+
async function getPlusFiles(userRootDir, esbuildCache) {
|
|
14
|
+
const plusFilePaths = (await crawlPlusFiles(userRootDir)).map(({ filePathAbsoluteUserRootDir }) => getFilePathResolved({ filePathAbsoluteUserRootDir, userRootDir }));
|
|
16
15
|
const plusFilesByLocationId = {};
|
|
17
16
|
await Promise.all(plusFilePaths.map(async (filePath) => {
|
|
18
17
|
if (getPlusFileValueConfigName(filePath.filePathAbsoluteFilesystem) === 'config') {
|
|
@@ -5,7 +5,7 @@ export type { ConfigFile };
|
|
|
5
5
|
export type { PointerImportLoaded };
|
|
6
6
|
import type { FilePathResolved } from '../../../../types/FilePath.js';
|
|
7
7
|
import { type EsbuildCache } from './transpileAndExecuteFile.js';
|
|
8
|
-
import type { PlusFileValue } from './
|
|
8
|
+
import type { PlusFileValue } from './getPlusFiles.js';
|
|
9
9
|
import { PointerImport } from './resolvePointerImport.js';
|
|
10
10
|
import type { ConfigDefinitionsInternal } from './metaBuiltIn.js';
|
|
11
11
|
import '../../assertEnvVite.js';
|
|
@@ -327,6 +327,10 @@ const metaBuiltIn = {
|
|
|
327
327
|
vercel: {
|
|
328
328
|
env: { config: true },
|
|
329
329
|
},
|
|
330
|
+
ai: {
|
|
331
|
+
env: { config: true },
|
|
332
|
+
global: true,
|
|
333
|
+
},
|
|
330
334
|
};
|
|
331
335
|
function getConfigEnv(pageConfig, configName) {
|
|
332
336
|
const source = getConfigValueSourceRelevantAnyEnv(configName, pageConfig);
|
|
@@ -15,7 +15,7 @@ export type { PageConfigBuildTimeBeforeComputed };
|
|
|
15
15
|
import type { PageConfigGlobalBuildTime, ConfigEnv, PageConfigBuildTime, DefinedAtFilePath } from '../../../types/PageConfig.js';
|
|
16
16
|
import { type ConfigDefinitionsInternal } from './resolveVikeConfigInternal/metaBuiltIn.js';
|
|
17
17
|
import { type GlobalConfigPublic } from '../../../shared-server-client/page-configs/resolveVikeConfigPublic.js';
|
|
18
|
-
import { type PlusFile } from './resolveVikeConfigInternal/
|
|
18
|
+
import { type PlusFile } from './resolveVikeConfigInternal/getPlusFiles.js';
|
|
19
19
|
import type { PrerenderContextPublic } from '../../prerender/runPrerender.js';
|
|
20
20
|
import type { ResolvedConfig, UserConfig } from 'vite';
|
|
21
21
|
import { type DangerouslyUseInternals } from '../../../shared-server-client/getPublicProxy.js';
|
|
@@ -63,7 +63,7 @@ declare function getVikeConfigFromCliOrEnv(): {
|
|
|
63
63
|
configFromCliOptions: import("../../cli/parseCli.js").CliOptions | null;
|
|
64
64
|
configFromEnvVar: Record<string, unknown> | null;
|
|
65
65
|
};
|
|
66
|
-
declare const EARLY_SETTINGS: readonly [
|
|
66
|
+
declare const EARLY_SETTINGS: readonly ['root', 'mode'];
|
|
67
67
|
type PageConfigBuildTimeBeforeComputed = Omit<PageConfigBuildTime, 'configValuesComputed'>;
|
|
68
68
|
declare function getConfigDefinitionOptional(configDefinitions: ConfigDefinitionsInternal, configName: string): {
|
|
69
69
|
env: ConfigEnv;
|
|
@@ -45,10 +45,10 @@ import { getFilePathResolved } from './getFilePath.js';
|
|
|
45
45
|
import { getConfigValueBuildTime } from '../../../shared-server-client/page-configs/getConfigValueBuildTime.js';
|
|
46
46
|
import { resolveGlobalConfigPublic, } from '../../../shared-server-client/page-configs/resolveVikeConfigPublic.js';
|
|
47
47
|
import { getConfigValuesBase, isJsonValue, } from '../../../shared-server-client/page-configs/serialize/serializeConfigValues.js';
|
|
48
|
-
import {
|
|
48
|
+
import { getPlusFiles, getPlusFileFromConfigFile, } from './resolveVikeConfigInternal/getPlusFiles.js';
|
|
49
49
|
import { assertRouteString } from '../../../shared-server-client/route/resolveRouteString.js';
|
|
50
50
|
import { getExtensionName } from './resolveVikeConfigInternal/assertExtensions.js';
|
|
51
|
-
import { getEnvVarObject } from '
|
|
51
|
+
import { getEnvVarObject } from '../../../utils/getEnvVarObject.js';
|
|
52
52
|
import { getVikeApiOperation } from '../../../shared-server-node/api-context.js';
|
|
53
53
|
import { getCliOptions } from '../../cli/context.js';
|
|
54
54
|
import { resolvePrerenderConfigGlobal } from '../../prerender/resolvePrerenderConfig.js';
|
|
@@ -216,7 +216,7 @@ function hasViteConfigChanged(vikeConfigOld, vikeConfigNew) {
|
|
|
216
216
|
return false;
|
|
217
217
|
}
|
|
218
218
|
async function resolveVikeConfigInternal(userRootDir, vikeVitePluginOptions, esbuildCache) {
|
|
219
|
-
const plusFilesByLocationId = await
|
|
219
|
+
const plusFilesByLocationId = await getPlusFiles(userRootDir, esbuildCache);
|
|
220
220
|
const configDefinitionsResolved = await resolveConfigDefinitions(plusFilesByLocationId, userRootDir, esbuildCache);
|
|
221
221
|
const { pageConfigGlobal, pageConfigs } = getPageConfigsBuildTime(configDefinitionsResolved, plusFilesByLocationId, userRootDir);
|
|
222
222
|
if (!globalObject.isV1Design_)
|
|
@@ -292,7 +292,7 @@ async function resolveConfigDefinitions(plusFilesByLocationId, userRootDir, esbu
|
|
|
292
292
|
return configDefinitionsResolved;
|
|
293
293
|
}
|
|
294
294
|
// Load value files (with `env.config===true`) of *custom* configs.
|
|
295
|
-
// - The value files of *built-in* configs are already loaded at `
|
|
295
|
+
// - The value files of *built-in* configs are already loaded at `getPlusFiles()`.
|
|
296
296
|
async function loadCustomConfigBuildTimeFiles(plusFiles, configDefinitions, userRootDir, esbuildCache) {
|
|
297
297
|
const plusFileList = Object.values(plusFiles).flat(1);
|
|
298
298
|
await Promise.all(plusFileList.map(async (plusFile) => {
|
|
@@ -715,7 +715,7 @@ function sortPlusFilesSameLocationId(plusFile1, plusFile2, configName) {
|
|
|
715
715
|
return ret;
|
|
716
716
|
}
|
|
717
717
|
// Config set by +{configName}.js (highest precedence)
|
|
718
|
-
// No need to make it deterministic: the overall order is already deterministic, see sortMakeDeterministic() at
|
|
718
|
+
// No need to make it deterministic: the overall order is already deterministic, see sortMakeDeterministic() at getPlusFiles()
|
|
719
719
|
return 0;
|
|
720
720
|
}
|
|
721
721
|
function resolveConfigValueSources(configName, configDef, plusFilesRelevant, userRootDir, isGlobal, plusFilesByLocationId) {
|