vike 0.4.260 → 0.4.262
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/resolvePrerenderConfig.d.ts +6 -1
- package/dist/node/prerender/resolvePrerenderConfig.js +9 -3
- package/dist/node/prerender/runPrerender.d.ts +22 -22
- package/dist/node/prerender/runPrerender.js +2 -2
- package/dist/node/vite/plugins/pluginCommon.js +14 -0
- 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 +8 -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' },
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { resolvePrerenderConfigGlobal };
|
|
2
2
|
export { resolvePrerenderConfigLocal };
|
|
3
|
+
export { isDistServerRemoved };
|
|
3
4
|
import { VikeConfigInternal } from '../vite/shared/resolveVikeConfigInternal.js';
|
|
4
5
|
import type { PageConfigBuildTime } from '../../types/PageConfig.js';
|
|
5
6
|
declare function resolvePrerenderConfigGlobal(vikeConfig: Pick<VikeConfigInternal, 'config' | '_pageConfigs' | '_from'>): Promise<{
|
|
@@ -7,13 +8,17 @@ declare function resolvePrerenderConfigGlobal(vikeConfig: Pick<VikeConfigInterna
|
|
|
7
8
|
noExtraDir: boolean | null;
|
|
8
9
|
parallel: number | boolean;
|
|
9
10
|
disableAutoRun: boolean;
|
|
11
|
+
keepDistServer: boolean;
|
|
10
12
|
} & {
|
|
11
13
|
defaultLocalValue: boolean;
|
|
12
14
|
isPrerenderingEnabled: boolean;
|
|
13
15
|
isPrerenderingEnabledForAllPages: boolean;
|
|
14
16
|
redirects: boolean;
|
|
15
|
-
keepDistServer: boolean;
|
|
16
17
|
}>;
|
|
17
18
|
declare function resolvePrerenderConfigLocal(pageConfig: PageConfigBuildTime): Promise<{
|
|
18
19
|
value: boolean;
|
|
19
20
|
} | null>;
|
|
21
|
+
declare function isDistServerRemoved(prerenderConfigGlobal: {
|
|
22
|
+
isPrerenderingEnabledForAllPages: boolean;
|
|
23
|
+
keepDistServer: boolean;
|
|
24
|
+
}): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { resolvePrerenderConfigGlobal };
|
|
2
2
|
export { resolvePrerenderConfigLocal };
|
|
3
|
+
export { isDistServerRemoved };
|
|
3
4
|
import { assert, assertUsage } from '../../utils/assert.js';
|
|
4
5
|
import { isArray } from '../../utils/isArray.js';
|
|
5
6
|
import { isObject } from '../../utils/isObject.js';
|
|
@@ -19,6 +20,7 @@ async function resolvePrerenderConfigGlobal(vikeConfig) {
|
|
|
19
20
|
noExtraDir: pickFirst(prerenderSettings.map((c) => c.noExtraDir)) ?? null,
|
|
20
21
|
parallel: pickFirst(prerenderSettings.map((c) => c.parallel)) ?? true,
|
|
21
22
|
disableAutoRun: pickFirst(prerenderSettings.map((c) => c.disableAutoRun)) ?? false,
|
|
23
|
+
keepDistServer: pickFirst(prerenderSettings.map((c) => c.keepDistServer)) ?? false,
|
|
22
24
|
};
|
|
23
25
|
let defaultLocalValue = false;
|
|
24
26
|
{
|
|
@@ -45,9 +47,6 @@ async function resolvePrerenderConfigGlobal(vikeConfig) {
|
|
|
45
47
|
isPrerenderingEnabled,
|
|
46
48
|
isPrerenderingEnabledForAllPages,
|
|
47
49
|
redirects: pickFirst(prerenderSettings.map((c) => c.redirects)) ?? isPrerenderingEnabledForAllPages,
|
|
48
|
-
keepDistServer: !isPrerenderingEnabledForAllPages
|
|
49
|
-
? true
|
|
50
|
-
: (pickFirst(prerenderSettings.map((c) => c.keepDistServer)) ?? false),
|
|
51
50
|
});
|
|
52
51
|
// TO-DO/next-major-release: remove
|
|
53
52
|
if (vikeConfig._pageConfigs.length === 0 && defaultLocalValue)
|
|
@@ -69,6 +68,13 @@ async function resolvePrerenderConfigLocal(pageConfig) {
|
|
|
69
68
|
const prerenderConfigLocal = { value };
|
|
70
69
|
return prerenderConfigLocal;
|
|
71
70
|
}
|
|
71
|
+
// Whether pre-rendering removes dist/server/ once it's done
|
|
72
|
+
// https://vike.dev/prerender#keepDistServer
|
|
73
|
+
function isDistServerRemoved(prerenderConfigGlobal) {
|
|
74
|
+
if (!prerenderConfigGlobal.isPrerenderingEnabledForAllPages)
|
|
75
|
+
return false;
|
|
76
|
+
return !prerenderConfigGlobal.keepDistServer;
|
|
77
|
+
}
|
|
72
78
|
function isObject2(value) {
|
|
73
79
|
return typeof value === 'object' && value !== null;
|
|
74
80
|
}
|
|
@@ -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;
|
|
@@ -39,7 +39,7 @@ import { noRouteMatch } from '../../shared-server-client/route/noRouteMatch.js';
|
|
|
39
39
|
import { getVikeConfigInternal } from '../vite/shared/resolveVikeConfigInternal.js';
|
|
40
40
|
import { execHookSingleWithoutPageContext, isUserHookError } from '../../shared-server-client/hooks/execHook.js';
|
|
41
41
|
import { setWasPrerenderRun } from './context.js';
|
|
42
|
-
import { resolvePrerenderConfigGlobal, resolvePrerenderConfigLocal } from './resolvePrerenderConfig.js';
|
|
42
|
+
import { resolvePrerenderConfigGlobal, resolvePrerenderConfigLocal, isDistServerRemoved, } from './resolvePrerenderConfig.js';
|
|
43
43
|
import { getOutDirsAllFromRootNormalized } from '../vite/shared/getOutDirs.js';
|
|
44
44
|
import fs from 'node:fs';
|
|
45
45
|
import { getPublicProxy } from '../../shared-server-client/getPublicProxy.js';
|
|
@@ -128,7 +128,7 @@ async function runPrerender(options = {}, trigger) {
|
|
|
128
128
|
const prerenderContextPublic = getPrerenderContextPublic(prerenderContext);
|
|
129
129
|
objectAssign(vikeConfig.prerenderContext, prerenderContextPublic, true);
|
|
130
130
|
setGlobalContext_prerenderContext(prerenderContextPublic);
|
|
131
|
-
if (
|
|
131
|
+
if (isDistServerRemoved(prerenderConfigGlobal)) {
|
|
132
132
|
fs.rmSync(outDirServer, { recursive: true });
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -11,6 +11,7 @@ import { assertResolveAlias } from './pluginCommon/assertResolveAlias.js';
|
|
|
11
11
|
import { getVikeConfigInternal, setVikeConfigContext } from '../shared/resolveVikeConfigInternal.js';
|
|
12
12
|
import { assertViteRoot, getViteRoot, normalizeViteRoot } from '../../api/resolveViteConfigUser.js';
|
|
13
13
|
import { temp_disablePrerenderAutoRun } from '../../prerender/context.js';
|
|
14
|
+
import { resolvePrerenderConfigGlobal, isDistServerRemoved } from '../../prerender/resolvePrerenderConfig.js';
|
|
14
15
|
import { version as viteVersionVike } from 'vite';
|
|
15
16
|
import '../assertEnvVite.js';
|
|
16
17
|
const pluginName = 'vike:pluginCommon';
|
|
@@ -43,6 +44,7 @@ function pluginCommon(vikeVitePluginOptions) {
|
|
|
43
44
|
configVikePromise: Promise.resolve({
|
|
44
45
|
prerender: vikeConfig.prerenderContext.isPrerenderingEnabled,
|
|
45
46
|
}),
|
|
47
|
+
...(await disableAutoImportIfPrerendering(isBuild)),
|
|
46
48
|
};
|
|
47
49
|
},
|
|
48
50
|
},
|
|
@@ -165,9 +167,21 @@ function temp_supportOldInterface(config) {
|
|
|
165
167
|
assert(false);
|
|
166
168
|
}
|
|
167
169
|
// Only emit dist/server/entry.mjs if necessary
|
|
170
|
+
// TO-DO/eventually: also do this when using Universal Deploy
|
|
168
171
|
async function emitServerEntryOnlyIfNeeded(config) {
|
|
169
172
|
const vikeConfig = await getVikeConfigInternal();
|
|
170
173
|
if (config.vitePluginServerEntry?.inject && !vikeConfig.prerenderContext.isPrerenderingEnabled) {
|
|
174
|
+
// Might be set too late: https://github.com/vikejs/vike/pull/3485
|
|
171
175
|
config.vitePluginServerEntry.disableServerEntryEmit = true;
|
|
172
176
|
}
|
|
173
177
|
}
|
|
178
|
+
// Don't let @brillout/vite-plugin-server-entry's autoImporter.js import dist/server/entry.js when pre-rendering is going to remove dist/server/ — a dangling import crashes runtimes consulting it
|
|
179
|
+
async function disableAutoImportIfPrerendering(isBuild) {
|
|
180
|
+
if (!isBuild)
|
|
181
|
+
return;
|
|
182
|
+
const vikeConfig = await getVikeConfigInternal();
|
|
183
|
+
const prerenderConfigGlobal = await resolvePrerenderConfigGlobal(vikeConfig);
|
|
184
|
+
if (isDistServerRemoved(prerenderConfigGlobal)) {
|
|
185
|
+
return { vitePluginServerEntry: { disableAutoImport: true } };
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -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 — ${pc.underline('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(', ')} — ${pc.underline('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,12 @@ function pluginDev() {
|
|
|
34
36
|
logDockerHint(config.server.host);
|
|
35
37
|
},
|
|
36
38
|
},
|
|
39
|
+
configureServer: {
|
|
40
|
+
handler() {
|
|
41
|
+
// Apply late — after the dev server is up and running — so that it doesn't slow down dev start
|
|
42
|
+
setTimeoutUnref(() => autoAddVikeSkill(config.root), 15 * 1000);
|
|
43
|
+
},
|
|
44
|
+
},
|
|
37
45
|
},
|
|
38
46
|
{
|
|
39
47
|
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;
|