vike 0.4.219 → 0.4.220-commit-9a798ce
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/cjs/node/api/build.js +23 -58
- package/dist/cjs/node/api/context.js +6 -8
- package/dist/cjs/node/api/prepareViteApiCall.js +6 -7
- package/dist/cjs/node/api/utils.js +1 -1
- package/dist/cjs/node/cli/context.js +16 -0
- package/dist/cjs/node/cli/entry.js +2 -0
- package/dist/cjs/node/cli/utils.js +1 -0
- package/dist/cjs/{utils → node/plugin}/getOutDirs.js +11 -11
- package/dist/cjs/node/plugin/index.js +1 -7
- package/dist/cjs/node/plugin/onLoad.js +6 -1
- package/dist/cjs/node/plugin/plugins/autoFullBuild.js +43 -31
- package/dist/cjs/node/plugin/plugins/baseUrls.js +2 -2
- package/dist/cjs/node/plugin/plugins/buildConfig.js +6 -3
- package/dist/cjs/node/plugin/plugins/buildEntry/index.js +24 -21
- package/dist/cjs/node/plugin/plugins/commonConfig.js +11 -8
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +4 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +10 -7
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +3 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/assertExtensions.js +10 -9
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +8 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +158 -176
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +3 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +3 -2
- package/dist/cjs/node/plugin/plugins/previewConfig.js +3 -4
- package/dist/cjs/node/plugin/utils.js +1 -1
- package/dist/cjs/node/prerender/context.js +26 -0
- package/dist/cjs/node/prerender/resolvePrerenderConfig.js +25 -0
- package/dist/cjs/node/prerender/runPrerender.js +64 -37
- package/dist/cjs/node/prerender/utils.js +3 -2
- package/dist/cjs/node/runtime/globalContext.js +44 -58
- package/dist/cjs/node/runtime/page-files/setup.js +1 -1
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +6 -3
- package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +6 -5
- package/dist/cjs/node/runtime/renderPage.js +10 -5
- package/dist/cjs/node/runtime/utils.js +3 -2
- package/dist/cjs/node/shared/resolveBase.js +9 -0
- package/dist/cjs/shared/page-configs/getPageConfigUserFriendly.js +2 -2
- package/dist/cjs/shared/page-configs/loadConfigValues.js +5 -1
- package/dist/cjs/shared/utils.js +1 -1
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assertSetup.js +15 -1
- package/dist/cjs/utils/catchInfiniteLoop.js +34 -0
- package/dist/cjs/utils/findFile.js +3 -3
- package/dist/cjs/utils/isDev.js +4 -1
- package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +2 -2
- package/dist/cjs/utils/makePublicCopy.js +32 -0
- package/dist/cjs/utils/requireResolve.js +3 -3
- package/dist/esm/client/client-routing-runtime/history.d.ts +3 -1
- package/dist/esm/client/client-routing-runtime/history.js +23 -18
- package/dist/esm/client/client-routing-runtime/index.d.ts +0 -1
- package/dist/esm/client/client-routing-runtime/index.js +0 -1
- package/dist/esm/client/client-routing-runtime/initClientRouter.js +2 -2
- package/dist/esm/client/client-routing-runtime/initOnLinkClick.js +3 -4
- package/dist/esm/client/client-routing-runtime/initOnPopState.d.ts +0 -10
- package/dist/esm/client/client-routing-runtime/initOnPopState.js +50 -62
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +15 -15
- package/dist/esm/client/client-routing-runtime/scrollRestoration.d.ts +4 -6
- package/dist/esm/client/client-routing-runtime/scrollRestoration.js +17 -12
- package/dist/esm/client/client-routing-runtime/setScrollPosition.d.ts +1 -1
- package/dist/esm/client/client-routing-runtime/setScrollPosition.js +29 -5
- package/dist/esm/client/client-routing-runtime/utils.d.ts +1 -0
- package/dist/esm/client/client-routing-runtime/utils.js +1 -0
- package/dist/esm/client/shared/normalizeClientSideUrl.js +2 -3
- package/dist/esm/node/api/build.d.ts +1 -6
- package/dist/esm/node/api/build.js +20 -25
- package/dist/esm/node/api/context.d.ts +4 -4
- package/dist/esm/node/api/context.js +6 -9
- package/dist/esm/node/api/prepareViteApiCall.d.ts +0 -1
- package/dist/esm/node/api/prepareViteApiCall.js +7 -8
- package/dist/esm/node/api/utils.d.ts +1 -1
- package/dist/esm/node/api/utils.js +1 -1
- package/dist/esm/node/cli/context.d.ts +5 -0
- package/dist/esm/node/cli/context.js +14 -0
- package/dist/esm/node/cli/entry.js +2 -0
- package/dist/esm/node/cli/parseCli.d.ts +3 -1
- package/dist/esm/node/cli/utils.d.ts +1 -0
- package/dist/esm/node/cli/utils.js +1 -0
- package/dist/esm/{utils → node/plugin}/getOutDirs.js +5 -5
- package/dist/esm/node/plugin/index.d.ts +29 -1
- package/dist/esm/node/plugin/index.js +2 -8
- package/dist/esm/node/plugin/onLoad.js +7 -2
- package/dist/esm/node/plugin/plugins/autoFullBuild.js +43 -31
- package/dist/esm/node/plugin/plugins/baseUrls.js +2 -2
- package/dist/esm/node/plugin/plugins/buildConfig.js +7 -4
- package/dist/esm/node/plugin/plugins/buildEntry/index.d.ts +3 -3
- package/dist/esm/node/plugin/plugins/buildEntry/index.js +25 -22
- package/dist/esm/node/plugin/plugins/commonConfig.d.ts +8 -2
- package/dist/esm/node/plugin/plugins/commonConfig.js +9 -6
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +4 -2
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +10 -7
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +3 -4
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/assertExtensions.d.ts +3 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/assertExtensions.js +10 -9
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +8 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +2 -95
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +159 -177
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +3 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +3 -2
- package/dist/esm/node/plugin/plugins/previewConfig.js +3 -4
- package/dist/esm/node/plugin/utils.js +1 -1
- package/dist/esm/node/prerender/context.d.ts +9 -0
- package/dist/esm/node/prerender/context.js +24 -0
- package/dist/esm/node/prerender/resolvePrerenderConfig.d.ts +5 -0
- package/dist/esm/node/prerender/resolvePrerenderConfig.js +23 -0
- package/dist/esm/node/prerender/runPrerender.d.ts +42 -1
- package/dist/esm/node/prerender/runPrerender.js +65 -38
- package/dist/esm/node/prerender/utils.d.ts +3 -2
- package/dist/esm/node/prerender/utils.js +3 -2
- package/dist/esm/node/runtime/globalContext.d.ts +15 -9
- package/dist/esm/node/runtime/globalContext.js +45 -59
- package/dist/esm/node/runtime/page-files/setup.js +1 -1
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +5 -5
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +6 -3
- package/dist/esm/node/runtime/renderPage/resolveRedirects.d.ts +2 -0
- package/dist/esm/node/runtime/renderPage/resolveRedirects.js +5 -5
- package/dist/esm/node/runtime/renderPage.js +10 -5
- package/dist/esm/node/runtime/utils.d.ts +3 -2
- package/dist/esm/node/runtime/utils.js +3 -2
- package/dist/esm/node/shared/resolveBase.d.ts +4 -1
- package/dist/esm/node/shared/resolveBase.js +9 -0
- package/dist/esm/shared/page-configs/Config.d.ts +76 -3
- package/dist/esm/shared/page-configs/PageConfig.d.ts +25 -16
- package/dist/esm/shared/page-configs/getPageConfigUserFriendly.d.ts +1 -1
- package/dist/esm/shared/page-configs/getPageConfigUserFriendly.js +2 -2
- package/dist/esm/shared/page-configs/loadConfigValues.js +6 -2
- package/dist/esm/shared/utils.d.ts +1 -1
- package/dist/esm/shared/utils.js +1 -1
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assertSetup.js +15 -1
- package/dist/esm/utils/catchInfiniteLoop.d.ts +2 -0
- package/dist/esm/utils/catchInfiniteLoop.js +32 -0
- package/dist/esm/utils/findFile.js +1 -1
- package/dist/esm/utils/isDev.js +4 -1
- package/dist/esm/utils/isFilePathAbsoluteFilesystem.js +1 -1
- package/dist/esm/utils/makePublicCopy.d.ts +3 -0
- package/dist/esm/utils/makePublicCopy.js +30 -0
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/dist/esm/utils/requireResolve.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/node/plugin/plugins/buildEntry/getVikeManifest.js +0 -17
- package/dist/cjs/node/prerender/isPrerenderAutoRunEnabled.js +0 -16
- package/dist/cjs/node/shared/assertPluginManifest.js +0 -20
- package/dist/cjs/node/shared/assertRuntimeManifest.js +0 -16
- package/dist/esm/node/plugin/plugins/buildEntry/getVikeManifest.d.ts +0 -5
- package/dist/esm/node/plugin/plugins/buildEntry/getVikeManifest.js +0 -15
- package/dist/esm/node/prerender/isPrerenderAutoRunEnabled.d.ts +0 -5
- package/dist/esm/node/prerender/isPrerenderAutoRunEnabled.js +0 -14
- package/dist/esm/node/shared/assertPluginManifest.d.ts +0 -12
- package/dist/esm/node/shared/assertPluginManifest.js +0 -18
- package/dist/esm/node/shared/assertRuntimeManifest.d.ts +0 -10
- package/dist/esm/node/shared/assertRuntimeManifest.js +0 -14
- /package/dist/cjs/utils/{filesystemPathHandling.js → toPosixPath.js} +0 -0
- /package/dist/esm/{utils → node/plugin}/getOutDirs.d.ts +0 -0
- /package/dist/esm/utils/{filesystemPathHandling.d.ts → toPosixPath.d.ts} +0 -0
- /package/dist/esm/utils/{filesystemPathHandling.js → toPosixPath.js} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export { resolveRedirects };
|
|
2
2
|
// For ./resolveRedirects.spec.ts
|
|
3
3
|
export { resolveRouteStringRedirect };
|
|
4
|
+
export { redirectsErrPrefix };
|
|
4
5
|
import { assertIsNotBrowser } from '../../../utils/assertIsNotBrowser.js';
|
|
5
6
|
import { assert, assertUsage, assertUsageUrlRedirectTarget, isUrlRedirectTarget } from '../../../shared/utils.js';
|
|
6
7
|
import { resolveUrlPathname } from '../../../shared/route/resolveUrlPathname.js';
|
|
7
8
|
import { assertRouteString, resolveRouteString } from '../../../shared/route/resolveRouteString.js';
|
|
8
9
|
import pc from '@brillout/picocolors';
|
|
9
10
|
assertIsNotBrowser(); // Don't bloat the client
|
|
10
|
-
|
|
11
|
-
const configSrc = '[vite.config.js > vike({ redirects })]';
|
|
11
|
+
const redirectsErrPrefix = '[+redirects]';
|
|
12
12
|
function resolveRedirects(redirectsAll, urlPathname) {
|
|
13
13
|
const redirects = merge(redirectsAll);
|
|
14
14
|
for (const [urlSource, urlTarget] of Object.entries(redirects)) {
|
|
@@ -19,9 +19,9 @@ function resolveRedirects(redirectsAll, urlPathname) {
|
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
21
|
function resolveRouteStringRedirect(urlSource, urlTarget, urlPathname) {
|
|
22
|
-
assertRouteString(urlSource, `${
|
|
22
|
+
assertRouteString(urlSource, `${redirectsErrPrefix} Invalid`);
|
|
23
23
|
// Is allowing any protocol a safety issue? https://github.com/vikejs/vike/pull/1292#issuecomment-1828043917
|
|
24
|
-
assertUsageUrlRedirectTarget(urlTarget, `${
|
|
24
|
+
assertUsageUrlRedirectTarget(urlTarget, `${redirectsErrPrefix} The URL redirection target`, true);
|
|
25
25
|
assertParams(urlSource, urlTarget);
|
|
26
26
|
const match = resolveRouteString(urlSource, urlPathname);
|
|
27
27
|
if (!match)
|
|
@@ -37,7 +37,7 @@ function assertParams(urlSource, urlTarget) {
|
|
|
37
37
|
routeSegments.forEach((routeSegment) => {
|
|
38
38
|
if (routeSegment.startsWith('@') || routeSegment.startsWith('*')) {
|
|
39
39
|
const segments = urlSource.split('/');
|
|
40
|
-
assertUsage(segments.includes(routeSegment), `${
|
|
40
|
+
assertUsage(segments.includes(routeSegment), `${redirectsErrPrefix} The redirection source URL ${pc.string(urlSource)} is missing the URL parameter ${pc.string(routeSegment)} used by the redirection target URL ${pc.string(urlTarget)}`);
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
}
|
|
@@ -18,6 +18,7 @@ import { getErrorPageId } from '../../shared/error-page.js';
|
|
|
18
18
|
import { handleErrorWithoutErrorPage } from './renderPage/handleErrorWithoutErrorPage.js';
|
|
19
19
|
import { loadUserFilesServerSide } from './renderPage/loadUserFilesServerSide.js';
|
|
20
20
|
import { resolveRedirects } from './renderPage/resolveRedirects.js';
|
|
21
|
+
import { resolveBaseRuntime } from '../shared/resolveBase.js';
|
|
21
22
|
const globalObject = getGlobalObject('runtime/renderPage.ts', {
|
|
22
23
|
httpRequestsCount: 0
|
|
23
24
|
});
|
|
@@ -336,14 +337,16 @@ function assertIsNotViteRequest(urlPathname, urlOriginal) {
|
|
|
336
337
|
assertUsage(false, `${pc.code('renderPage(pageContextInit)')} called with ${pc.code(`pageContextInit.urlOriginal===${JSON.stringify(urlOriginal)}`)} which is unexpected because the URL ${pc.bold(urlOriginal)} should have already been handled by the development middleware: make sure the ${pc.cyan('createDevMiddleware()')} middleware is executed *before* the ${pc.cyan('renderPage()')} middleware, see ${pc.underline('https://vike.dev/renderPage')}`);
|
|
337
338
|
}
|
|
338
339
|
function normalizeUrl(pageContextInit, httpRequestId) {
|
|
339
|
-
const
|
|
340
|
+
const globalContext = getGlobalContext();
|
|
341
|
+
const { baseServer } = resolveBaseRuntime();
|
|
342
|
+
const { trailingSlash, disableUrlNormalization } = globalContext.vikeConfig.global.config;
|
|
340
343
|
if (disableUrlNormalization)
|
|
341
344
|
return null;
|
|
342
345
|
const { urlOriginal } = pageContextInit;
|
|
343
346
|
const { isPageContextRequest } = handlePageContextRequestUrl(urlOriginal);
|
|
344
347
|
if (isPageContextRequest)
|
|
345
348
|
return null;
|
|
346
|
-
const urlNormalized = normalizeUrlPathname(urlOriginal, trailingSlash, baseServer);
|
|
349
|
+
const urlNormalized = normalizeUrlPathname(urlOriginal, trailingSlash ?? false, baseServer);
|
|
347
350
|
if (!urlNormalized)
|
|
348
351
|
return null;
|
|
349
352
|
logRuntimeInfo?.(`URL normalized from ${pc.cyan(urlOriginal)} to ${pc.cyan(urlNormalized)} (https://vike.dev/url-normalization)`, httpRequestId, 'info');
|
|
@@ -354,7 +357,8 @@ function normalizeUrl(pageContextInit, httpRequestId) {
|
|
|
354
357
|
}
|
|
355
358
|
function getPermanentRedirect(pageContextInit, httpRequestId) {
|
|
356
359
|
const globalContext = getGlobalContext();
|
|
357
|
-
const
|
|
360
|
+
const { baseServer } = resolveBaseRuntime();
|
|
361
|
+
const urlWithoutBase = removeBaseServer(pageContextInit.urlOriginal, baseServer);
|
|
358
362
|
let origin = null;
|
|
359
363
|
let urlTargetExternal = null;
|
|
360
364
|
let urlTarget = modifyUrlPathname(urlWithoutBase, (urlPathname) => {
|
|
@@ -385,8 +389,9 @@ function getPermanentRedirect(pageContextInit, httpRequestId) {
|
|
|
385
389
|
}
|
|
386
390
|
if (normalize(urlTarget) === normalize(urlWithoutBase))
|
|
387
391
|
return null;
|
|
392
|
+
const { baseServer } = resolveBaseRuntime();
|
|
388
393
|
if (!originChanged)
|
|
389
|
-
urlTarget = prependBase(urlTarget,
|
|
394
|
+
urlTarget = prependBase(urlTarget, baseServer);
|
|
390
395
|
assert(urlTarget !== pageContextInit.urlOriginal);
|
|
391
396
|
}
|
|
392
397
|
logRuntimeInfo?.(`Permanent redirection defined by config.redirects (https://vike.dev/redirects)`, httpRequestId, 'info');
|
|
@@ -451,7 +456,7 @@ pageContextNominalPageInit, httpRequestId, pageContextErrorPageInit) {
|
|
|
451
456
|
return { pageContextAbort };
|
|
452
457
|
}
|
|
453
458
|
function assertBaseUrl(pageContextInit) {
|
|
454
|
-
const { baseServer } =
|
|
459
|
+
const { baseServer } = resolveBaseRuntime();
|
|
455
460
|
const { urlOriginal } = pageContextInit;
|
|
456
461
|
const { urlWithoutPageContextRequestSuffix } = handlePageContextRequestUrl(urlOriginal);
|
|
457
462
|
const { hasBaseServer } = parseUrl(urlWithoutPageContextRequestSuffix, baseServer);
|
|
@@ -21,8 +21,8 @@ export * from '../../utils/compareString.js';
|
|
|
21
21
|
export * from '../../utils/isObjectWithKeys.js';
|
|
22
22
|
export * from '../../utils/stringifyStringArray.js';
|
|
23
23
|
export * from '../../utils/unique.js';
|
|
24
|
-
export * from '../../utils/
|
|
25
|
-
export * from '
|
|
24
|
+
export * from '../../utils/toPosixPath.js';
|
|
25
|
+
export * from '../plugin/getOutDirs.js';
|
|
26
26
|
export * from '../../utils/capitalizeFirstLetter.js';
|
|
27
27
|
export * from '../../utils/debugGlob.js';
|
|
28
28
|
export * from '../../utils/isSameErrorMessage.js';
|
|
@@ -56,3 +56,4 @@ export * from '../../utils/isVikeReactApp.js';
|
|
|
56
56
|
export * from '../../utils/getPropAccessNotation.js';
|
|
57
57
|
export * from '../../utils/PROJECT_VERSION.js';
|
|
58
58
|
export * from '../../utils/genPromise.js';
|
|
59
|
+
export * from '../../utils/makePublicCopy.js';
|
|
@@ -25,8 +25,8 @@ export * from '../../utils/compareString.js';
|
|
|
25
25
|
export * from '../../utils/isObjectWithKeys.js';
|
|
26
26
|
export * from '../../utils/stringifyStringArray.js';
|
|
27
27
|
export * from '../../utils/unique.js';
|
|
28
|
-
export * from '../../utils/
|
|
29
|
-
export * from '
|
|
28
|
+
export * from '../../utils/toPosixPath.js';
|
|
29
|
+
export * from '../plugin/getOutDirs.js';
|
|
30
30
|
export * from '../../utils/capitalizeFirstLetter.js';
|
|
31
31
|
export * from '../../utils/debugGlob.js';
|
|
32
32
|
export * from '../../utils/isSameErrorMessage.js';
|
|
@@ -60,3 +60,4 @@ export * from '../../utils/isVikeReactApp.js';
|
|
|
60
60
|
export * from '../../utils/getPropAccessNotation.js';
|
|
61
61
|
export * from '../../utils/PROJECT_VERSION.js';
|
|
62
62
|
export * from '../../utils/genPromise.js';
|
|
63
|
+
export * from '../../utils/makePublicCopy.js';
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { resolveBase };
|
|
2
|
+
export { resolveBaseRuntime };
|
|
2
3
|
export { resolveBaseFromResolvedConfig };
|
|
3
4
|
import type { ResolvedConfig } from 'vite';
|
|
4
5
|
declare function resolveBaseFromResolvedConfig(baseServer: string | null, baseAssets: string | null, config: ResolvedConfig): {
|
|
5
6
|
baseServer: string;
|
|
6
7
|
baseAssets: string;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
+
type BaseUrlsResolved = {
|
|
9
10
|
baseServer: string;
|
|
10
11
|
baseAssets: string;
|
|
11
12
|
};
|
|
13
|
+
declare function resolveBaseRuntime(): BaseUrlsResolved;
|
|
14
|
+
declare function resolveBase(baseViteOriginal: string | null, baseServerUnresolved: string | null, baseAssetsUnresolved: string | null): BaseUrlsResolved;
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
export { resolveBase };
|
|
2
|
+
export { resolveBaseRuntime };
|
|
2
3
|
export { resolveBaseFromResolvedConfig };
|
|
3
4
|
import { assert, assertUsage, isBaseServer, isBaseAssets } from './utils.js';
|
|
4
5
|
import pc from '@brillout/picocolors';
|
|
6
|
+
import { getGlobalContext } from '../runtime/globalContext.js';
|
|
5
7
|
function resolveBaseFromResolvedConfig(baseServer, baseAssets, config) {
|
|
6
8
|
let baseViteOriginal = config._baseViteOriginal;
|
|
7
9
|
assert(baseViteOriginal === null || typeof baseViteOriginal == 'string');
|
|
8
10
|
return resolveBase(baseViteOriginal, baseServer, baseAssets);
|
|
9
11
|
}
|
|
12
|
+
function resolveBaseRuntime() {
|
|
13
|
+
const globalContext = getGlobalContext();
|
|
14
|
+
const baseViteOriginal = globalContext.viteConfigRuntime._baseViteOriginal;
|
|
15
|
+
const baseServerUnresolved = globalContext.vikeConfig.global.config.baseServer ?? null;
|
|
16
|
+
const baseAssetsUnresolved = globalContext.vikeConfig.global.config.baseAssets ?? null;
|
|
17
|
+
return resolveBase(baseViteOriginal, baseServerUnresolved, baseAssetsUnresolved);
|
|
18
|
+
}
|
|
10
19
|
function resolveBase(baseViteOriginal, baseServerUnresolved, baseAssetsUnresolved) {
|
|
11
20
|
if (baseViteOriginal === '/__UNSET__')
|
|
12
21
|
baseViteOriginal = null;
|
|
@@ -37,7 +37,7 @@ import type { PrefetchSetting, PrefetchStaticAssets } from '../../client/client-
|
|
|
37
37
|
import type { ConfigDefinition } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js';
|
|
38
38
|
import type { DocumentHtml } from '../../node/runtime/html/renderHtml.js';
|
|
39
39
|
import type { InjectFilterEntry } from '../../types/index.js';
|
|
40
|
-
import type { VikeVitePluginOptions } from '../../node/plugin/
|
|
40
|
+
import type { VikeVitePluginOptions } from '../../node/plugin/index.js';
|
|
41
41
|
import type { Vike, VikePackages } from '../VikeNamespace.js';
|
|
42
42
|
import type { HooksTimeoutProvidedByUser } from '../hooks/getHook.js';
|
|
43
43
|
import type { PageContextClient, PageContextServer } from '../types.js';
|
|
@@ -246,11 +246,55 @@ type ConfigBuiltIn = {
|
|
|
246
246
|
*/
|
|
247
247
|
guard?: GuardAsync | GuardSync | ImportString;
|
|
248
248
|
/**
|
|
249
|
-
*
|
|
249
|
+
* Pre-render page(s).
|
|
250
250
|
*
|
|
251
251
|
* https://vike.dev/pre-rendering
|
|
252
|
+
* https://vike.dev/prerender
|
|
253
|
+
*
|
|
254
|
+
* @default false
|
|
252
255
|
*/
|
|
253
|
-
prerender?: boolean | ImportString
|
|
256
|
+
prerender?: boolean | ImportString | {
|
|
257
|
+
/**
|
|
258
|
+
* Allow only some of your pages to be pre-rendered.
|
|
259
|
+
*
|
|
260
|
+
* This setting doesn't affect the pre-rendering process: it merely suppresses the warnings when some of your pages cannot be pre-rendered.
|
|
261
|
+
*
|
|
262
|
+
* https://vike.dev/prerender#partial
|
|
263
|
+
*
|
|
264
|
+
* @default false
|
|
265
|
+
*/
|
|
266
|
+
partial?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Don't create a new directory for each HTML file.
|
|
269
|
+
*
|
|
270
|
+
* For example, generate `dist/client/about.html` instead of `dist/client/about/index.html`.
|
|
271
|
+
*
|
|
272
|
+
* https://vike.dev/prerender#noextradir
|
|
273
|
+
*
|
|
274
|
+
* @default false
|
|
275
|
+
*/
|
|
276
|
+
noExtraDir?: boolean;
|
|
277
|
+
/**
|
|
278
|
+
* Number of concurrent pre-render jobs.
|
|
279
|
+
*
|
|
280
|
+
* Set to `false` to disable concurrency.
|
|
281
|
+
*
|
|
282
|
+
* https://vike.dev/prerender#parallel
|
|
283
|
+
*
|
|
284
|
+
* @default os.cpus().length
|
|
285
|
+
*/
|
|
286
|
+
parallel?: boolean | number;
|
|
287
|
+
/**
|
|
288
|
+
* Disable the automatic initiation of the pre-rendering process when running `$ vike build`.
|
|
289
|
+
*
|
|
290
|
+
* Use this if you want to programmatically initiate the pre-rendering process instead.
|
|
291
|
+
*
|
|
292
|
+
* https://vike.dev/prerender#disableautorun
|
|
293
|
+
*
|
|
294
|
+
* @default false
|
|
295
|
+
*/
|
|
296
|
+
disableAutoRun?: boolean;
|
|
297
|
+
};
|
|
254
298
|
/**
|
|
255
299
|
* Install Vike extensions.
|
|
256
300
|
*
|
|
@@ -358,6 +402,34 @@ type ConfigBuiltIn = {
|
|
|
358
402
|
* https://vike.dev/redirects
|
|
359
403
|
*/
|
|
360
404
|
redirects?: Record<string, string>;
|
|
405
|
+
/** Whether URLs should end with a trailing slash.
|
|
406
|
+
*
|
|
407
|
+
* https://vike.dev/url-normalization
|
|
408
|
+
*
|
|
409
|
+
* @default false
|
|
410
|
+
*/
|
|
411
|
+
trailingSlash?: boolean;
|
|
412
|
+
/** Disable automatic URL normalization.
|
|
413
|
+
*
|
|
414
|
+
* https://vike.dev/url-normalization
|
|
415
|
+
*
|
|
416
|
+
* @default false
|
|
417
|
+
*/
|
|
418
|
+
disableUrlNormalization?: boolean;
|
|
419
|
+
/** @deprecated It's now `true` by default. You can remove this option. */
|
|
420
|
+
includeAssetsImportedByServer?: boolean;
|
|
421
|
+
/** @deprecated See https://vike.dev/disableAutoFullBuild */
|
|
422
|
+
disableAutoFullBuild?: boolean | 'prerender';
|
|
423
|
+
/** The Base URL of your server.
|
|
424
|
+
*
|
|
425
|
+
* https://vike.dev/base-url
|
|
426
|
+
*/
|
|
427
|
+
baseServer?: string;
|
|
428
|
+
/** The Base URL of your static assets.
|
|
429
|
+
*
|
|
430
|
+
* https://vike.dev/base-url
|
|
431
|
+
*/
|
|
432
|
+
baseAssets?: string;
|
|
361
433
|
/**
|
|
362
434
|
* @experimental DON'T USE: the API *will* have breaking changes upon any minor version release.
|
|
363
435
|
*
|
|
@@ -407,6 +479,7 @@ type ConfigBuiltIn = {
|
|
|
407
479
|
type ConfigBuiltInResolved = {
|
|
408
480
|
passToClient?: string[][];
|
|
409
481
|
redirects?: Record<string, string>[];
|
|
482
|
+
prerender?: Exclude<Config['prerender'], ImportString | undefined>[];
|
|
410
483
|
};
|
|
411
484
|
type ConfigMeta = Record<string, ConfigDefinition>;
|
|
412
485
|
type ImportString = `import:${string}`;
|
|
@@ -20,7 +20,8 @@ import type { ConfigValueSerialized } from './serialize/PageConfigSerialized.js'
|
|
|
20
20
|
import type { LocationId } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js';
|
|
21
21
|
import type { FilePath } from './FilePath.js';
|
|
22
22
|
import type { ConfigDefinitions } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js';
|
|
23
|
-
type
|
|
23
|
+
import type { InterfaceFile, InterfaceFilesByLocationId } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js';
|
|
24
|
+
type PageConfigCommon = {
|
|
24
25
|
pageId: string;
|
|
25
26
|
isErrorPage?: true;
|
|
26
27
|
routeFilesystem?: {
|
|
@@ -28,34 +29,41 @@ type PageConfigBase = {
|
|
|
28
29
|
definedBy: string;
|
|
29
30
|
};
|
|
30
31
|
};
|
|
31
|
-
/** Page config data structure
|
|
32
|
-
type PageConfigRuntime =
|
|
32
|
+
/** Page config, runtime data structure */
|
|
33
|
+
type PageConfigRuntime = PageConfigCommon & {
|
|
33
34
|
configValues: ConfigValues;
|
|
34
35
|
/** Load config values that are lazily loaded such as config.Page */
|
|
35
|
-
loadConfigValuesAll:
|
|
36
|
-
configValuesSerialized: Record<string, ConfigValueSerialized>;
|
|
37
|
-
}>;
|
|
36
|
+
loadConfigValuesAll: LoadConfigValuesAll;
|
|
38
37
|
};
|
|
39
|
-
/**
|
|
40
|
-
type
|
|
41
|
-
|
|
42
|
-
isAllLoaded: true;
|
|
38
|
+
/** Global config that applies to all pages, runtime data structure */
|
|
39
|
+
type PageConfigGlobalRuntime = {
|
|
40
|
+
configValues: ConfigValues;
|
|
43
41
|
};
|
|
44
|
-
/** Page config data structure
|
|
45
|
-
type PageConfigBuildTime =
|
|
42
|
+
/** Page config, build-time data structure */
|
|
43
|
+
type PageConfigBuildTime = PageConfigCommon & {
|
|
46
44
|
configDefinitions: ConfigDefinitions;
|
|
45
|
+
interfaceFiles: InterfaceFilesByLocationId;
|
|
47
46
|
configValueSources: ConfigValueSources;
|
|
48
47
|
configValuesComputed: ConfigValuesComputed;
|
|
49
48
|
};
|
|
50
|
-
/**
|
|
51
|
-
type PageConfigGlobalRuntime = {
|
|
52
|
-
configValues: ConfigValues;
|
|
53
|
-
};
|
|
49
|
+
/** Global config that applies to all pages, build-time data structure */
|
|
54
50
|
type PageConfigGlobalBuildTime = {
|
|
55
51
|
configValueSources: ConfigValueSources;
|
|
52
|
+
interfaceFiles: InterfaceFilesByLocationId;
|
|
56
53
|
configDefinitions: ConfigDefinitions;
|
|
57
54
|
configValuesComputed?: undefined;
|
|
58
55
|
};
|
|
56
|
+
/** Same as PageConfigRuntime but also contains all lazily loaded config values such as config.Page */
|
|
57
|
+
type PageConfigRuntimeLoaded = PageConfigRuntime & {
|
|
58
|
+
/** Whether loadConfigValuesAll() was called */
|
|
59
|
+
isAllLoaded: true;
|
|
60
|
+
};
|
|
61
|
+
type LoadConfigValuesAll = () => {
|
|
62
|
+
moduleId: string;
|
|
63
|
+
moduleExports: Promise<{
|
|
64
|
+
configValuesSerialized: Record<string, ConfigValueSerialized>;
|
|
65
|
+
}>;
|
|
66
|
+
};
|
|
59
67
|
/** In what environment(s) the config value is loaded.
|
|
60
68
|
*
|
|
61
69
|
* https://vike.dev/meta
|
|
@@ -77,6 +85,7 @@ type ConfigValueSource = {
|
|
|
77
85
|
value?: unknown;
|
|
78
86
|
configEnv: ConfigEnvInternal;
|
|
79
87
|
definedAtFilePath: DefinedAtFilePath;
|
|
88
|
+
interfaceFile: InterfaceFile | null;
|
|
80
89
|
locationId: LocationId;
|
|
81
90
|
isOverriden: boolean;
|
|
82
91
|
/** Wether the config value is loaded at runtime, for example config.Page or config.onBeforeRender */
|
|
@@ -63,11 +63,11 @@ function getPageConfigUserFriendly(pageFiles, pageConfig) {
|
|
|
63
63
|
assert(!('default' in exports));
|
|
64
64
|
assert(!('default' in exportsAll));
|
|
65
65
|
const pageContextExports = {
|
|
66
|
+
config: config,
|
|
66
67
|
from,
|
|
67
68
|
source,
|
|
68
69
|
sources,
|
|
69
70
|
// TODO/eventually: deprecate/remove every prop below
|
|
70
|
-
config,
|
|
71
71
|
configEntries,
|
|
72
72
|
exports,
|
|
73
73
|
exportsAll,
|
|
@@ -151,7 +151,7 @@ function getPageConfigUserFriendlyNew(pageConfig) {
|
|
|
151
151
|
});
|
|
152
152
|
});
|
|
153
153
|
return {
|
|
154
|
-
config,
|
|
154
|
+
config: config,
|
|
155
155
|
configEntries,
|
|
156
156
|
exportsAll,
|
|
157
157
|
source,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { loadConfigValues };
|
|
2
|
-
import { objectAssign } from '../utils.js';
|
|
2
|
+
import { assert, objectAssign } from '../utils.js';
|
|
3
3
|
import { parseConfigValuesSerialized } from './serialize/parsePageConfigs.js';
|
|
4
4
|
async function loadConfigValues(pageConfig, isDev) {
|
|
5
5
|
if ('isAllLoaded' in pageConfig &&
|
|
@@ -7,7 +7,11 @@ async function loadConfigValues(pageConfig, isDev) {
|
|
|
7
7
|
!isDev) {
|
|
8
8
|
return pageConfig;
|
|
9
9
|
}
|
|
10
|
-
const
|
|
10
|
+
const { moduleId, moduleExports } = pageConfig.loadConfigValuesAll();
|
|
11
|
+
const configValuesLoaded = await moduleExports;
|
|
12
|
+
// `configValuesLoaded` is sometimes `undefined` https://github.com/vikejs/vike/discussions/2092
|
|
13
|
+
if (!configValuesLoaded)
|
|
14
|
+
assert(false, { moduleExports, configValuesLoaded, moduleId });
|
|
11
15
|
const configValues = parseConfigValuesSerialized(configValuesLoaded.configValuesSerialized);
|
|
12
16
|
Object.assign(pageConfig.configValues, configValues);
|
|
13
17
|
objectAssign(pageConfig, { isAllLoaded: true });
|
|
@@ -12,7 +12,7 @@ export * from '../utils/isPlainObject.js';
|
|
|
12
12
|
export * from '../utils/compareString.js';
|
|
13
13
|
export * from '../utils/isNotNullish.js';
|
|
14
14
|
export * from '../utils/stringifyStringArray.js';
|
|
15
|
-
export * from '../utils/
|
|
15
|
+
export * from '../utils/toPosixPath.js';
|
|
16
16
|
export * from '../utils/cast.js';
|
|
17
17
|
export * from '../utils/isPropertyGetter.js';
|
|
18
18
|
export * from '../utils/isPromise.js';
|
package/dist/esm/shared/utils.js
CHANGED
|
@@ -16,7 +16,7 @@ export * from '../utils/isPlainObject.js';
|
|
|
16
16
|
export * from '../utils/compareString.js';
|
|
17
17
|
export * from '../utils/isNotNullish.js';
|
|
18
18
|
export * from '../utils/stringifyStringArray.js';
|
|
19
|
-
export * from '../utils/
|
|
19
|
+
export * from '../utils/toPosixPath.js';
|
|
20
20
|
export * from '../utils/cast.js';
|
|
21
21
|
export * from '../utils/isPropertyGetter.js';
|
|
22
22
|
export * from '../utils/isPromise.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.220-commit-9a798ce";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.
|
|
2
|
+
export const PROJECT_VERSION = '0.4.220-commit-9a798ce';
|
|
@@ -116,7 +116,7 @@ function getEnvDescription() {
|
|
|
116
116
|
// https://github.com/cloudflare/workers-sdk/issues/7886
|
|
117
117
|
function assertNodeEnvIsNotUndefinedString() {
|
|
118
118
|
const nodeEnv = getNodeEnv();
|
|
119
|
-
assertWarning(nodeEnv !== 'undefined', `${pc.cyan('process.env.NODE_ENV==="undefined"')} which is unexpected: ${pc.cyan('process.env.NODE_ENV')}
|
|
119
|
+
assertWarning(nodeEnv !== 'undefined', `${pc.cyan('process.env.NODE_ENV==="undefined"')} which is unexpected: ${pc.cyan('process.env.NODE_ENV')} is allowed to be the *value* ${pc.cyan('undefined')} (i.e. ${pc.cyan('process.env.NODE_ENV===undefined')}) but it shouldn't be the *string* ${pc.cyan('"undefined"')} ${pc.underline('https://vike.dev/NODE_ENV')}`, { onlyOnce: true });
|
|
120
120
|
}
|
|
121
121
|
function isNodeEnvDev() {
|
|
122
122
|
const nodeEnv = getNodeEnv();
|
|
@@ -136,6 +136,20 @@ function getNodeEnv() {
|
|
|
136
136
|
catch {
|
|
137
137
|
return undefined;
|
|
138
138
|
}
|
|
139
|
+
/*
|
|
140
|
+
// Should we show the following warning? So far I don't think so because of the following. Maybe we can show it once we enable users to disable warnings.
|
|
141
|
+
// - The warning isn't always actionable, e.g. if it's a tool that dynamically sets `process.env.NODE_ENV`.
|
|
142
|
+
// - We assume that tools use `process.env.NODE_ENV` and not someting like `const { env } = process; env.NODE_ENV`. Thus, in practice, `val` overrides `val2` so having `val!==val2` isn't an issue.
|
|
143
|
+
{
|
|
144
|
+
const val2 = process.env['NODE' + '_ENV']
|
|
145
|
+
if (val2)
|
|
146
|
+
assertWarning(
|
|
147
|
+
val === val2,
|
|
148
|
+
`Dynamically setting process.env.NODE_ENV to ${val2} hasn't any effect because process.env.NODE_ENV is being statically replaced to ${val}.`,
|
|
149
|
+
{ onlyOnce: true }
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
//*/
|
|
139
153
|
return val;
|
|
140
154
|
}
|
|
141
155
|
function setNodeEnvProduction() {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export { catchInfiniteLoop };
|
|
2
|
+
import { assert, assertWarning } from './assert.js';
|
|
3
|
+
const trackers = {};
|
|
4
|
+
function catchInfiniteLoop(functionName, maxNumberOfCalls = 100, withinSeconds = 5) {
|
|
5
|
+
// Init
|
|
6
|
+
const now = new Date();
|
|
7
|
+
let tracker = (trackers[functionName] ?? (trackers[functionName] = createTracker(now)));
|
|
8
|
+
// Reset
|
|
9
|
+
const elapsedTime = now.getTime() - tracker.start.getTime();
|
|
10
|
+
if (elapsedTime > withinSeconds * 1000)
|
|
11
|
+
tracker = trackers[functionName] = createTracker(now);
|
|
12
|
+
// Count
|
|
13
|
+
tracker.count++;
|
|
14
|
+
// Error
|
|
15
|
+
const msg = `[Infinite Loop] ${functionName} called ${tracker.count} times within ${withinSeconds} seconds`;
|
|
16
|
+
if (tracker.count > maxNumberOfCalls) {
|
|
17
|
+
assert(false, msg);
|
|
18
|
+
}
|
|
19
|
+
// Warning, at 50% threshold
|
|
20
|
+
if (!tracker.warned && tracker.count > maxNumberOfCalls * 0.5) {
|
|
21
|
+
// Warning is shown upon 10 calls a second, on average during 5 seconds, given the default parameters
|
|
22
|
+
assertWarning(false, msg, { onlyOnce: false });
|
|
23
|
+
tracker.warned = true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function createTracker(now) {
|
|
27
|
+
const tracker = {
|
|
28
|
+
count: 0,
|
|
29
|
+
start: now
|
|
30
|
+
};
|
|
31
|
+
return tracker;
|
|
32
|
+
}
|
|
@@ -2,7 +2,7 @@ export { findFile };
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import { isArray } from './isArray.js';
|
|
5
|
-
import { assertPosixPath } from './
|
|
5
|
+
import { assertPosixPath } from './toPosixPath.js';
|
|
6
6
|
function findFile(arg, cwd) {
|
|
7
7
|
assertPosixPath(cwd);
|
|
8
8
|
const filenames = isArray(arg) ? arg : [arg];
|
package/dist/esm/utils/isDev.js
CHANGED
|
@@ -2,10 +2,13 @@ export { isDevCheck };
|
|
|
2
2
|
export { applyDev };
|
|
3
3
|
export { applyPreview };
|
|
4
4
|
import { assert } from './assert.js';
|
|
5
|
+
import { version } from 'vite';
|
|
5
6
|
function isDevCheck(configEnv) {
|
|
6
7
|
const { isPreview, command } = configEnv;
|
|
7
8
|
// Released at vite@5.1.0 which is guaranteed with `assertVersion('Vite', version, '5.1.0')`
|
|
8
|
-
|
|
9
|
+
// - Release: https://github.com/vitejs/vite/blob/6f7466e6211027686f40ad7e4ce6ec8477414546/packages/vite/CHANGELOG.md#510-beta4-2024-01-26:~:text=fix(preview)%3A-,set%20isPreview%20true,-(%2315695)%20(93fce55
|
|
10
|
+
// - Surprisingly, this assert() can fail: https://github.com/vikejs/vike/issues/2120
|
|
11
|
+
assert(typeof isPreview === 'boolean', { isPreview, version });
|
|
9
12
|
return command === 'serve' && !isPreview;
|
|
10
13
|
}
|
|
11
14
|
function applyDev(_, env) {
|
|
@@ -2,7 +2,7 @@ export { assertFilePathAbsoluteFilesystem };
|
|
|
2
2
|
export { isFilePathAbsolute };
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { assert } from './assert.js';
|
|
5
|
-
import { assertPosixPath } from './
|
|
5
|
+
import { assertPosixPath } from './toPosixPath.js';
|
|
6
6
|
/**
|
|
7
7
|
* Asserts that `filePath` is an absolute file path starting from the filesystem root.
|
|
8
8
|
*
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { makePublicCopy };
|
|
2
|
+
/** Prefix internal properties with `_` + show warning */
|
|
3
|
+
declare function makePublicCopy<Obj extends Record<string, unknown>, PropsPublic extends readonly (keyof Obj)[]>(obj: Obj, objName: string, propsPublic: PropsPublic, propsInternalNoWarning?: (keyof Obj)[]): Pick<Obj, PropsPublic[number]>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { makePublicCopy };
|
|
2
|
+
import { assertWarning } from './assert.js';
|
|
3
|
+
import { objectKeys } from './objectKeys.js';
|
|
4
|
+
/** Prefix internal properties with `_` + show warning */
|
|
5
|
+
function makePublicCopy(obj, objName, propsPublic, propsInternalNoWarning) {
|
|
6
|
+
const objPublic = {};
|
|
7
|
+
objectKeys(obj).forEach((key) => {
|
|
8
|
+
const val = obj[key];
|
|
9
|
+
if (propsPublic.includes(key)) {
|
|
10
|
+
objPublic[key] = val;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
const keyPublic = key.startsWith('_') ? key : `_${key}`;
|
|
14
|
+
if (propsInternalNoWarning?.includes(key)) {
|
|
15
|
+
// @ts-expect-error
|
|
16
|
+
objPublic[keyPublic] = val;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
Object.defineProperty(objPublic, keyPublic, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get() {
|
|
22
|
+
assertWarning(false, `Using internal ${objName}.${keyPublic} which may break in any minor version update. Reach out on GitHub and elaborate your use case so that the Vike team can add official support for your use case.`, { onlyOnce: true });
|
|
23
|
+
return val;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return objPublic;
|
|
30
|
+
}
|
|
@@ -2,7 +2,7 @@ export { requireResolve };
|
|
|
2
2
|
import { assert } from './assert.js';
|
|
3
3
|
import { assertIsNotBrowser } from './assertIsNotBrowser.js';
|
|
4
4
|
import { assertIsNotProductionRuntime } from './assertSetup.js';
|
|
5
|
-
import { assertPosixPath, toPosixPath } from './
|
|
5
|
+
import { assertPosixPath, toPosixPath } from './toPosixPath.js';
|
|
6
6
|
import { scriptFileExtensionList } from './isScriptFile.js';
|
|
7
7
|
import { createRequire } from 'module';
|
|
8
8
|
// @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getVikeManifest = getVikeManifest;
|
|
4
|
-
const utils_js_1 = require("../../utils.js");
|
|
5
|
-
const assertPluginManifest_js_1 = require("../../../shared/assertPluginManifest.js");
|
|
6
|
-
const extractExportNamesPlugin_js_1 = require("../extractExportNamesPlugin.js");
|
|
7
|
-
const globalContext_js_1 = require("../../../runtime/globalContext.js");
|
|
8
|
-
function getVikeManifest(vikeConfigGlobal, viteConfig) {
|
|
9
|
-
const runtimeManifest = (0, globalContext_js_1.getRuntimeManifest)(vikeConfigGlobal, viteConfig);
|
|
10
|
-
const manifest = {
|
|
11
|
-
version: utils_js_1.projectInfo.projectVersion,
|
|
12
|
-
usesClientRouter: (0, extractExportNamesPlugin_js_1.isUsingClientRouter)(), // TODO/v1-release: remove
|
|
13
|
-
...runtimeManifest
|
|
14
|
-
};
|
|
15
|
-
(0, assertPluginManifest_js_1.assertPluginManifest)(manifest);
|
|
16
|
-
return manifest;
|
|
17
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPrerenderAutoRunEnabled = isPrerenderAutoRunEnabled;
|
|
4
|
-
exports.temp_disablePrerenderAutoRun = temp_disablePrerenderAutoRun;
|
|
5
|
-
const getGlobalObject_js_1 = require("../../utils/getGlobalObject.js");
|
|
6
|
-
const globalObject = (0, getGlobalObject_js_1.getGlobalObject)('isPrerenderAutoRunEnabled.ts', {});
|
|
7
|
-
function isPrerenderAutoRunEnabled(vikeConfigGlobal) {
|
|
8
|
-
return (vikeConfigGlobal.prerender &&
|
|
9
|
-
!vikeConfigGlobal.prerender.disableAutoRun &&
|
|
10
|
-
!globalObject.isDisabled &&
|
|
11
|
-
vikeConfigGlobal.disableAutoFullBuild !== 'prerender');
|
|
12
|
-
}
|
|
13
|
-
// TODO/v1-release: remove
|
|
14
|
-
function temp_disablePrerenderAutoRun() {
|
|
15
|
-
globalObject.isDisabled = true;
|
|
16
|
-
}
|