vike 0.4.195-commit-3f77496 → 0.4.195-commit-f7e91ba
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/__internal/index.js +3 -4
- package/dist/cjs/node/cli/onLoad.js +1 -2
- package/dist/cjs/node/createPageRenderer.js +1 -2
- package/dist/cjs/node/plugin/index.js +3 -3
- package/dist/cjs/node/plugin/onLoad.js +1 -2
- package/dist/cjs/node/plugin/plugins/autoFullBuild.js +1 -2
- package/dist/cjs/node/plugin/plugins/baseUrls.js +1 -2
- package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +2 -3
- package/dist/cjs/node/plugin/plugins/buildConfig.js +4 -4
- package/dist/cjs/node/plugin/plugins/commonConfig/assertResolveAlias.js +1 -2
- package/dist/cjs/node/plugin/plugins/commonConfig.js +1 -2
- package/dist/cjs/node/plugin/plugins/config/assertVikeConfig.js +1 -2
- package/dist/cjs/node/plugin/plugins/config/index.js +1 -2
- package/dist/cjs/node/plugin/plugins/config/pickFirst.js +1 -2
- package/dist/cjs/node/plugin/plugins/config/resolveBase.js +2 -3
- package/dist/cjs/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -2
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +1 -2
- package/dist/cjs/node/plugin/plugins/devConfig/index.js +1 -2
- package/dist/cjs/node/plugin/plugins/distFileNames.js +1 -2
- package/dist/cjs/node/plugin/plugins/envVars.js +1 -2
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +2 -2
- package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +3 -3
- package/dist/cjs/node/plugin/plugins/fileEnv.js +109 -88
- package/dist/cjs/node/plugin/plugins/importBuild/getVikeManifest.js +1 -2
- package/dist/cjs/node/plugin/plugins/importBuild/index.js +2 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/addImportStatement.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +1 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/assertExtensions.js +2 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getConfigFileExport.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +8 -9
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +3 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.js +3 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.js +3 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +4 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -6
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.js +1 -2
- package/dist/cjs/node/plugin/plugins/packageJsonFile.js +1 -2
- package/dist/cjs/node/plugin/plugins/previewConfig.js +1 -2
- package/dist/cjs/node/plugin/plugins/removeRequireHookPlugin.js +1 -2
- package/dist/cjs/node/plugin/plugins/setGlobalContext.js +1 -2
- package/dist/cjs/node/plugin/plugins/suppressRollupWarning.js +1 -2
- package/dist/cjs/node/plugin/plugins/workaroundCssModuleHmr.js +1 -2
- package/dist/cjs/node/plugin/resolveClientEntriesDev.js +1 -2
- package/dist/cjs/node/plugin/shared/addSsrMiddleware.js +1 -2
- package/dist/cjs/node/plugin/shared/findPageFiles.js +1 -2
- package/dist/cjs/node/plugin/shared/getAssetsDir.js +1 -2
- package/dist/cjs/node/plugin/shared/getFilePath.js +8 -9
- package/dist/cjs/node/plugin/shared/getHttpRequestAsyncStore.js +2 -3
- package/dist/cjs/node/plugin/shared/isAsset.js +1 -2
- package/dist/cjs/node/plugin/shared/isViteCliCall.js +2 -3
- package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.js +4 -5
- package/dist/cjs/node/plugin/shared/loggerNotProd/log.js +4 -5
- package/dist/cjs/node/plugin/shared/loggerNotProd.js +6 -7
- package/dist/cjs/node/plugin/shared/loggerVite/removeSuperfluousViteLog.js +3 -4
- package/dist/cjs/node/plugin/shared/loggerVite.js +1 -2
- package/dist/cjs/node/plugin/shared/parseEsModule.js +2 -3
- package/dist/cjs/node/plugin/shared/rollupIsEsm.js +1 -2
- package/dist/cjs/node/plugin/shared/rollupSourceMap.js +2 -3
- package/dist/cjs/node/prerender/runPrerender.js +4 -5
- package/dist/cjs/node/runtime/globalContext/loadImportBuild.js +2 -3
- package/dist/cjs/node/runtime/globalContext.js +13 -14
- package/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets/getViteDevScript.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets/inferHtmlTags.js +4 -4
- package/dist/cjs/node/runtime/html/injectAssets/injectAssets__public.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets/injectHtmlTags.js +6 -7
- package/dist/cjs/node/runtime/html/injectAssets/mergeScriptTags.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets/sanitizeJson.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets.js +2 -3
- package/dist/cjs/node/runtime/html/renderHtml.js +5 -6
- package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +2 -3
- package/dist/cjs/node/runtime/html/stream/react-streaming.js +3 -4
- package/dist/cjs/node/runtime/html/stream.js +21 -22
- package/dist/cjs/node/runtime/onLoad.js +1 -2
- package/dist/cjs/node/runtime/page-files/getPageFilesExports.js +1 -2
- package/dist/cjs/node/runtime/renderPage/analyzePage.js +1 -2
- package/dist/cjs/node/runtime/renderPage/assertArguments.js +1 -2
- package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +1 -2
- package/dist/cjs/node/runtime/renderPage/createHttpResponse/getCacheControl.js +1 -2
- package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +5 -6
- package/dist/cjs/node/runtime/renderPage/debugPageFiles.js +1 -2
- package/dist/cjs/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +1 -2
- package/dist/cjs/node/runtime/renderPage/executeOnRenderHtmlHook.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +2 -3
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsDev.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +2 -3
- package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +1 -2
- package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +1 -2
- package/dist/cjs/node/runtime/renderPage/inferMediaType.js +1 -2
- package/dist/cjs/node/runtime/renderPage/isNewError.js +2 -3
- package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +1 -2
- package/dist/cjs/node/runtime/renderPage/log404/index.js +2 -3
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +2 -3
- package/dist/cjs/node/runtime/renderPage/loggerProd.js +2 -3
- package/dist/cjs/node/runtime/renderPage/loggerRuntime.js +2 -2
- package/dist/cjs/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.js +1 -2
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +5 -6
- package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +2 -3
- package/dist/cjs/node/runtime/renderPage.js +2 -2
- package/dist/cjs/node/shared/assertPluginManifest.js +1 -2
- package/dist/cjs/node/shared/assertRuntimeManifest.js +1 -2
- package/dist/cjs/node/shared/assertV1Design.js +1 -2
- package/dist/cjs/node/shared/extractAssetsQuery.js +2 -3
- package/dist/cjs/node/shared/getConfigVike.js +1 -2
- package/dist/cjs/node/shared/isErrorDebug.js +1 -2
- package/dist/cjs/node/shared/prependEntriesDir.js +1 -2
- package/dist/cjs/node/shared/virtual-files/virtualFileImportUserCode.js +2 -2
- package/dist/cjs/node/shared/virtual-files/virtualFilePageConfigValuesAll.js +2 -3
- package/dist/cjs/shared/addIs404ToPageProps.js +1 -2
- package/dist/cjs/shared/assertHookReturnedObject.js +1 -2
- package/dist/cjs/shared/assertOnBeforeRenderHookReturn.js +1 -2
- package/dist/cjs/shared/assertPageContextProvidedByUser.js +1 -2
- package/dist/cjs/shared/assertPageFilePath.js +1 -2
- package/dist/cjs/shared/determinePageIdOld.js +1 -2
- package/dist/cjs/shared/error-page.js +3 -4
- package/dist/cjs/shared/getPageContextRequestUrl.js +2 -2
- package/dist/cjs/shared/getPageContextUrlComputed.js +2 -3
- package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +1 -2
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +1 -2
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +2 -3
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/getExportNames.js +1 -2
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide.js +2 -3
- package/dist/cjs/shared/getPageFiles/analyzePageServerSide.js +1 -2
- package/dist/cjs/shared/getPageFiles/assert_exports_old_design.js +3 -3
- package/dist/cjs/shared/getPageFiles/fileTypes.js +3 -3
- package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +2 -3
- package/dist/cjs/shared/getPageFiles/getExports.js +1 -2
- package/dist/cjs/shared/getPageFiles/getPageFileObject.js +1 -2
- package/dist/cjs/shared/getPageFiles/parseGlobResults.js +1 -2
- package/dist/cjs/shared/getPageFiles/setPageFiles.js +3 -4
- package/dist/cjs/shared/hooks/executeHook.js +4 -5
- package/dist/cjs/shared/hooks/getHook.js +6 -7
- package/dist/cjs/shared/modifyUrl.js +1 -2
- package/dist/cjs/shared/page-configs/assertPlusFileExport.js +1 -2
- package/dist/cjs/shared/page-configs/findPageConfig.js +1 -2
- package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +3 -4
- package/dist/cjs/shared/page-configs/getConfigValue.js +2 -3
- package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +1 -2
- package/dist/cjs/shared/page-configs/getExportPath.js +1 -2
- package/dist/cjs/shared/page-configs/helpers.js +3 -4
- package/dist/cjs/shared/page-configs/loadConfigValues.js +1 -2
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +2 -3
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +1 -2
- package/dist/cjs/shared/route/abort.js +9 -10
- package/dist/cjs/shared/route/debug.js +1 -2
- package/dist/cjs/shared/route/deduceRouteStringFromFilesystemPath.js +1 -2
- package/dist/cjs/shared/route/executeGuardHook.js +1 -2
- package/dist/cjs/shared/route/executeOnBeforeRouteHook.js +1 -2
- package/dist/cjs/shared/route/index.js +1 -2
- package/dist/cjs/shared/route/loadPageRoutes.js +1 -2
- package/dist/cjs/shared/route/resolvePrecedence.js +1 -2
- package/dist/cjs/shared/route/resolveRoute.js +1 -2
- package/dist/cjs/shared/route/resolveRouteFunction.js +4 -5
- package/dist/cjs/shared/route/resolveRouteString.js +6 -7
- package/dist/cjs/shared/route/resolveUrlPathname.js +1 -2
- package/dist/cjs/shared/sortPageContext.js +1 -2
- package/dist/cjs/types/defineConfig.js +1 -2
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assert.js +10 -11
- package/dist/cjs/utils/assertIsBrowser.js +1 -2
- package/dist/cjs/utils/assertIsNotBrowser.js +1 -2
- package/dist/cjs/utils/assertIsNotProductionRuntime.js +6 -6
- package/dist/cjs/utils/assertKeys.js +1 -2
- package/dist/cjs/utils/assertNodeEnv.js +5 -6
- package/dist/cjs/utils/assertNodeVersion.js +1 -2
- package/dist/cjs/utils/assertRoutingType.js +3 -4
- package/dist/cjs/utils/assertSingleInstance.js +3 -4
- package/dist/cjs/utils/assertVersion.js +2 -3
- package/dist/cjs/utils/augmentType.js +1 -2
- package/dist/cjs/utils/capitalizeFirstLetter.js +1 -2
- package/dist/cjs/utils/cast.js +2 -3
- package/dist/cjs/utils/changeEnumerable.js +1 -2
- package/dist/cjs/utils/checkType.js +2 -3
- package/dist/cjs/utils/compareString.js +1 -2
- package/dist/cjs/utils/createErrorWithCleanStackTrace.js +1 -2
- package/dist/cjs/utils/debug.js +2 -3
- package/dist/cjs/utils/deepEqual.js +1 -2
- package/dist/cjs/utils/escapeHtml.js +1 -2
- package/dist/cjs/utils/escapeRegex.js +1 -2
- package/dist/cjs/utils/filesystemPathHandling.js +2 -3
- package/dist/cjs/utils/findFile.js +1 -2
- package/dist/cjs/utils/findPackageJson.js +1 -2
- package/dist/cjs/utils/formatHintLog.js +1 -2
- package/dist/cjs/utils/freezePartial.js +1 -2
- package/dist/cjs/utils/genPromise.js +1 -2
- package/dist/cjs/utils/getCurrentUrl.js +1 -2
- package/dist/cjs/utils/getFileExtension.js +1 -2
- package/dist/cjs/utils/getGlobalObject.js +2 -3
- package/dist/cjs/utils/getMostSimilar.js +1 -2
- package/dist/cjs/utils/getOutDirs.js +2 -3
- package/dist/cjs/utils/getPropAccessNotation.js +1 -2
- package/dist/cjs/utils/getRandomId.js +1 -2
- package/dist/cjs/utils/getTerminWidth.js +1 -2
- package/dist/cjs/utils/getValuePrintable.js +1 -2
- package/dist/cjs/utils/hasProp.js +1 -2
- package/dist/cjs/utils/humanizeTime.js +1 -2
- package/dist/cjs/utils/includes.js +1 -2
- package/dist/cjs/utils/injectRollupInputs.js +2 -3
- package/dist/cjs/utils/isArray.js +1 -2
- package/dist/cjs/utils/isArrayOfStrings.js +1 -2
- package/dist/cjs/utils/isBrowser.js +1 -2
- package/dist/cjs/utils/isCallable.js +1 -2
- package/dist/cjs/utils/isDev.js +2 -3
- package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +2 -3
- package/dist/cjs/utils/isHtml.js +1 -2
- package/dist/cjs/utils/isNodeJS.js +1 -2
- package/dist/cjs/utils/isNpmPackage.js +5 -6
- package/dist/cjs/utils/isObject.js +1 -2
- package/dist/cjs/utils/isObjectOfStrings.js +1 -2
- package/dist/cjs/utils/isObjectWithKeys.js +1 -2
- package/dist/cjs/utils/isPlainObject.js +1 -2
- package/dist/cjs/utils/isPromise.js +1 -2
- package/dist/cjs/utils/isPropertyGetter.js +1 -2
- package/dist/cjs/utils/isReact.js +1 -2
- package/dist/cjs/utils/isSameErrorMessage.js +1 -2
- package/dist/cjs/utils/isScriptFile.js +4 -4
- package/dist/cjs/utils/isVikeReactApp.js +1 -2
- package/dist/cjs/utils/isVitest.js +1 -2
- package/dist/cjs/utils/joinEnglish.js +1 -2
- package/dist/cjs/utils/normalizeHeaders.js +1 -2
- package/dist/cjs/utils/objectAssign.js +1 -2
- package/dist/cjs/utils/objectDefineProperty.js +1 -2
- package/dist/cjs/utils/objectEntries.js +1 -2
- package/dist/cjs/utils/objectEntriesForEach.js +1 -2
- package/dist/cjs/utils/objectFromEntries.js +1 -2
- package/dist/cjs/utils/objectKeys.js +1 -2
- package/dist/cjs/utils/onPageVisibilityChange.js +2 -3
- package/dist/cjs/utils/pLimit.js +1 -2
- package/dist/cjs/utils/parseUrl-extras.js +8 -9
- package/dist/cjs/utils/parseUrl.js +11 -12
- package/dist/cjs/utils/path-shim.js +1 -2
- package/dist/cjs/utils/redirectHard.js +1 -2
- package/dist/cjs/utils/removeEmptyLines.js +1 -2
- package/dist/cjs/utils/removeFileExtention.js +1 -2
- package/dist/cjs/utils/requireResolve.js +1 -2
- package/dist/cjs/utils/sleep.js +1 -2
- package/dist/cjs/utils/slice.js +1 -2
- package/dist/cjs/utils/sorter.js +5 -6
- package/dist/cjs/utils/stringifyStringArray.js +1 -2
- package/dist/cjs/utils/stripAnsi.js +1 -2
- package/dist/cjs/utils/throttle.js +1 -2
- package/dist/cjs/utils/trimWithAnsi.js +2 -3
- package/dist/cjs/utils/truncateString.js +1 -2
- package/dist/cjs/utils/unique.js +1 -2
- package/dist/cjs/utils/urlToFile.js +2 -2
- package/dist/cjs/utils/virtual-files.js +3 -4
- package/dist/cjs/utils/viteIsSSR.js +2 -3
- package/dist/cjs/utils/warnIfErrorIsNotObject.js +1 -2
- package/dist/esm/node/plugin/plugins/fileEnv.js +109 -87
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +0 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/debug.d.ts +2 -2
- package/dist/esm/node/runtime/html/stream.d.ts +0 -1
- package/dist/esm/node/runtime/index-deprecated.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/getHttpResponseBody.d.ts +0 -1
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +6 -6
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/debugGlob.d.ts +2 -2
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.debug =
|
|
3
|
+
exports.debug = debug;
|
|
4
4
|
var _debug;
|
|
5
5
|
function debug(...args) {
|
|
6
6
|
if (!_debug) {
|
|
@@ -11,4 +11,3 @@ function debug(...args) {
|
|
|
11
11
|
_debug(...args);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
exports.debug = debug;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Unit tests at ./deduceRouteStringFromFilesystemPath.spec.ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.deduceRouteStringFromFilesystemPath =
|
|
4
|
+
exports.deduceRouteStringFromFilesystemPath = deduceRouteStringFromFilesystemPath;
|
|
5
5
|
const utils_js_1 = require("./utils.js");
|
|
6
6
|
// TODO/next-major-update: remove this and whole filesystemRoot mechanism
|
|
7
7
|
function deduceRouteStringFromFilesystemPath(pageId, filesystemRoots) {
|
|
@@ -50,4 +50,3 @@ function deduceRouteStringFromFilesystemPath(pageId, filesystemRoots) {
|
|
|
50
50
|
(0, utils_js_1.assert)(!filesystemRoute.endsWith('/') || filesystemRoute === '/');
|
|
51
51
|
return filesystemRoute;
|
|
52
52
|
}
|
|
53
|
-
exports.deduceRouteStringFromFilesystemPath = deduceRouteStringFromFilesystemPath;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.executeGuardHook =
|
|
3
|
+
exports.executeGuardHook = executeGuardHook;
|
|
4
4
|
const getHook_js_1 = require("../hooks/getHook.js");
|
|
5
5
|
const utils_js_1 = require("./utils.js");
|
|
6
6
|
const executeHook_js_1 = require("../hooks/executeHook.js");
|
|
@@ -26,7 +26,6 @@ async function executeGuardHook(pageContext, prepareForUserConsumption) {
|
|
|
26
26
|
const hookResult = await (0, executeHook_js_1.executeHook)(() => guard(pageContextForUserConsumption), hook, pageContext);
|
|
27
27
|
(0, utils_js_1.assertUsage)(hookResult === undefined, `${errIntro} ${hook.hookFilePath} returns a value, but guard() shouldn't return any value`);
|
|
28
28
|
}
|
|
29
|
-
exports.executeGuardHook = executeGuardHook;
|
|
30
29
|
function findPageGuard(pageId, pageFilesAll) {
|
|
31
30
|
const pageRouteFile = pageFilesAll.find((p) => p.pageId === pageId && p.fileType === '.page.route');
|
|
32
31
|
if (!pageRouteFile)
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.executeOnBeforeRouteHook =
|
|
6
|
+
exports.executeOnBeforeRouteHook = executeOnBeforeRouteHook;
|
|
7
7
|
const assertPageContextProvidedByUser_js_1 = require("../assertPageContextProvidedByUser.js");
|
|
8
8
|
const utils_js_1 = require("./utils.js");
|
|
9
9
|
const resolveRouteFunction_js_1 = require("./resolveRouteFunction.js");
|
|
@@ -37,7 +37,6 @@ async function executeOnBeforeRouteHook(pageContext) {
|
|
|
37
37
|
});
|
|
38
38
|
return pageContextFromOnBeforeRouteHook;
|
|
39
39
|
}
|
|
40
|
-
exports.executeOnBeforeRouteHook = executeOnBeforeRouteHook;
|
|
41
40
|
async function getPageContextFromHook(onBeforeRouteHook, pageContext) {
|
|
42
41
|
let hookReturn = onBeforeRouteHook.hookFn(pageContext);
|
|
43
42
|
(0, resolveRouteFunction_js_1.assertSyncRouting)(hookReturn, `The onBeforeRoute() hook ${onBeforeRouteHook.hookFilePath}`);
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.route =
|
|
6
|
+
exports.route = route;
|
|
7
7
|
// Ensure we don't bloat runtime of Server Routing
|
|
8
8
|
const assertRoutingType_js_1 = require("../../utils/assertRoutingType.js");
|
|
9
9
|
const isBrowser_js_1 = require("../../utils/isBrowser.js");
|
|
@@ -105,4 +105,3 @@ async function route(pageContext) {
|
|
|
105
105
|
}
|
|
106
106
|
return pageContextFromRoute;
|
|
107
107
|
}
|
|
108
|
-
exports.route = route;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadPageRoutes =
|
|
3
|
+
exports.loadPageRoutes = loadPageRoutes;
|
|
4
4
|
const error_page_js_1 = require("../error-page.js");
|
|
5
5
|
const utils_js_1 = require("./utils.js");
|
|
6
6
|
const deduceRouteStringFromFilesystemPath_js_1 = require("./deduceRouteStringFromFilesystemPath.js");
|
|
@@ -17,7 +17,6 @@ pageFilesAll, pageConfigs, pageConfigGlobal, allPageIds) {
|
|
|
17
17
|
const pageRoutes = getPageRoutes(filesystemRoots, pageFilesAll, pageConfigs, allPageIds);
|
|
18
18
|
return { pageRoutes, onBeforeRouteHook };
|
|
19
19
|
}
|
|
20
|
-
exports.loadPageRoutes = loadPageRoutes;
|
|
21
20
|
function getPageRoutes(filesystemRoots, pageFilesAll, pageConfigs, allPageIds) {
|
|
22
21
|
const pageRoutes = [];
|
|
23
22
|
// V1 Design
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolvePrecendence =
|
|
3
|
+
exports.resolvePrecendence = resolvePrecendence;
|
|
4
4
|
// export type { RouteMatch }
|
|
5
5
|
const resolveRouteString_js_1 = require("./resolveRouteString.js");
|
|
6
6
|
const utils_js_1 = require("./utils.js");
|
|
@@ -19,7 +19,6 @@ function resolvePrecendence(routeMatches) {
|
|
|
19
19
|
.sort((0, utils_js_2.makeFirst)((routeMatch) => routeMatch.routeType === 'FILESYSTEM'))
|
|
20
20
|
.sort((0, utils_js_2.makeFirst)((routeMatch) => routeMatch.routeType === 'FUNCTION' && !!routeMatch.precedence && routeMatch.precedence > 0));
|
|
21
21
|
}
|
|
22
|
-
exports.resolvePrecendence = resolvePrecendence;
|
|
23
22
|
// -1 => routeMatch1 higher precedence
|
|
24
23
|
// +1 => routeMatch2 higher precedence
|
|
25
24
|
function sortMatches(routeMatch1, routeMatch2) {
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.resolveRoute =
|
|
6
|
+
exports.resolveRoute = resolveRoute;
|
|
7
7
|
const utils_js_1 = require("./utils.js");
|
|
8
8
|
const resolveRouteString_js_1 = require("./resolveRouteString.js");
|
|
9
9
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
@@ -18,4 +18,3 @@ function resolveRoute(routeString, urlPathname) {
|
|
|
18
18
|
routeParams: result?.routeParams ?? {}
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
exports.resolveRoute = resolveRoute;
|
|
@@ -3,7 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.resolveRouteFunction = resolveRouteFunction;
|
|
7
|
+
exports.assertRouteParams = assertRouteParams;
|
|
8
|
+
exports.assertSyncRouting = assertSyncRouting;
|
|
9
|
+
exports.warnDeprecatedAllowKey = warnDeprecatedAllowKey;
|
|
7
10
|
const getPageContextUrlComputed_js_1 = require("../getPageContextUrlComputed.js");
|
|
8
11
|
const utils_js_1 = require("./utils.js");
|
|
9
12
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
@@ -47,18 +50,15 @@ async function resolveRouteFunction(routeFunction, pageContext, routeDefinedAtSt
|
|
|
47
50
|
routeParams
|
|
48
51
|
};
|
|
49
52
|
}
|
|
50
|
-
exports.resolveRouteFunction = resolveRouteFunction;
|
|
51
53
|
// TODO/v1-release: remove, and make routing synchronous (enabling Vike to synchronously check whether a link is a Vike link before even calling ev.preventDefault())
|
|
52
54
|
function assertSyncRouting(res, errPrefix) {
|
|
53
55
|
(0, utils_js_1.assertWarning)(!(0, utils_js_1.isPromise)(res), `${errPrefix} returned a promise, but asynchronous routing is deprecated and will be removed in the next major release, see https://vike.dev/route-function#async`, { onlyOnce: true });
|
|
54
56
|
}
|
|
55
|
-
exports.assertSyncRouting = assertSyncRouting;
|
|
56
57
|
// TODO/v1-release: remove
|
|
57
58
|
function warnDeprecatedAllowKey() {
|
|
58
59
|
const allowKey = picocolors_1.default.cyan('iKnowThePerformanceRisksOfAsyncRouteFunctions');
|
|
59
60
|
(0, utils_js_1.assertWarning)(false, `${allowKey} is deprecated and will be removed in the next major release`, { onlyOnce: true });
|
|
60
61
|
}
|
|
61
|
-
exports.warnDeprecatedAllowKey = warnDeprecatedAllowKey;
|
|
62
62
|
function assertRouteParams(result, errPrefix) {
|
|
63
63
|
(0, utils_js_1.assert)(errPrefix.endsWith(' should'));
|
|
64
64
|
if (!(0, utils_js_1.hasProp)(result, 'routeParams')) {
|
|
@@ -67,4 +67,3 @@ function assertRouteParams(result, errPrefix) {
|
|
|
67
67
|
(0, utils_js_1.assert)(errPrefix.endsWith(' should'));
|
|
68
68
|
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(result, 'routeParams', 'string{}'), `${errPrefix} be an object holding string values.`);
|
|
69
69
|
}
|
|
70
|
-
exports.assertRouteParams = assertRouteParams;
|
|
@@ -3,7 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.resolveRouteString = resolveRouteString;
|
|
7
|
+
exports.getUrlFromRouteString = getUrlFromRouteString;
|
|
8
|
+
exports.isStaticRouteString = isStaticRouteString;
|
|
9
|
+
exports.analyzeRouteString = analyzeRouteString;
|
|
10
|
+
exports.assertRouteString = assertRouteString;
|
|
11
|
+
exports.parseRouteString = parseRouteString;
|
|
7
12
|
const utils_js_1 = require("../utils.js");
|
|
8
13
|
const utils_js_2 = require("./utils.js");
|
|
9
14
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
@@ -16,7 +21,6 @@ function assertRouteString(routeString, errPrefix = 'Invalid') {
|
|
|
16
21
|
(0, utils_js_2.assertUsage)(['/', '*'].includes(routeString[0]), `${errPrefix2}: it should start with ${highlight('/')} or ${highlight('*')}`);
|
|
17
22
|
(0, utils_js_2.assertUsage)(!routeString.includes('**'), `${errPrefix2}: set it to ${highlight(routeString.split('**').join('*'))} instead`);
|
|
18
23
|
}
|
|
19
|
-
exports.assertRouteString = assertRouteString;
|
|
20
24
|
function resolveRouteString(routeString, urlPathname) {
|
|
21
25
|
assertRouteString(routeString);
|
|
22
26
|
const segments = parseRouteString(routeString);
|
|
@@ -61,7 +65,6 @@ function resolveRouteString(routeString, urlPathname) {
|
|
|
61
65
|
});
|
|
62
66
|
return { routeParams };
|
|
63
67
|
}
|
|
64
|
-
exports.resolveRouteString = resolveRouteString;
|
|
65
68
|
function parseRouteString(routeString) {
|
|
66
69
|
const segments = [];
|
|
67
70
|
const pushStatic = (s) => {
|
|
@@ -98,7 +101,6 @@ function parseRouteString(routeString) {
|
|
|
98
101
|
});
|
|
99
102
|
return segments;
|
|
100
103
|
}
|
|
101
|
-
exports.parseRouteString = parseRouteString;
|
|
102
104
|
function getUrlFromRouteString(routeString) {
|
|
103
105
|
if (isStaticRouteString(routeString)) {
|
|
104
106
|
const url = routeString;
|
|
@@ -106,7 +108,6 @@ function getUrlFromRouteString(routeString) {
|
|
|
106
108
|
}
|
|
107
109
|
return null;
|
|
108
110
|
}
|
|
109
|
-
exports.getUrlFromRouteString = getUrlFromRouteString;
|
|
110
111
|
function analyzeRouteString(routeString) {
|
|
111
112
|
const segments = parseRouteString(routeString);
|
|
112
113
|
const countStaticParts = (s) => s?.split('/').filter(Boolean).length || 0;
|
|
@@ -121,7 +122,6 @@ function analyzeRouteString(routeString) {
|
|
|
121
122
|
const numberOfGlobs = segments.filter((s) => s.glob).length;
|
|
122
123
|
return { numberOfStaticPartsBeginning, numberOfStaticParts, numberOfParams, numberOfGlobs };
|
|
123
124
|
}
|
|
124
|
-
exports.analyzeRouteString = analyzeRouteString;
|
|
125
125
|
function isParam(routeSegment) {
|
|
126
126
|
return routeSegment.startsWith(PARAM_TOKEN_NEW) || routeSegment.startsWith(PARAM_TOKEN_OLD);
|
|
127
127
|
}
|
|
@@ -131,7 +131,6 @@ function isStaticRouteString(routeString) {
|
|
|
131
131
|
(0, utils_js_2.assert)(match);
|
|
132
132
|
return Object.keys(match.routeParams).length === 0;
|
|
133
133
|
}
|
|
134
|
-
exports.isStaticRouteString = isStaticRouteString;
|
|
135
134
|
function highlight(routeString) {
|
|
136
135
|
if ((0, utils_js_1.isBrowser)()) {
|
|
137
136
|
return `'${routeString}'`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveUrlPathname =
|
|
3
|
+
exports.resolveUrlPathname = resolveUrlPathname;
|
|
4
4
|
const assertIsNotBrowser_js_1 = require("../../utils/assertIsNotBrowser.js");
|
|
5
5
|
const utils_js_1 = require("../utils.js");
|
|
6
6
|
(0, assertIsNotBrowser_js_1.assertIsNotBrowser)(); // Don't bloat the client
|
|
@@ -45,4 +45,3 @@ function resolveUrlPathname(routeString, routeParams) {
|
|
|
45
45
|
const urlPathname = parts.map((p) => p.val).join('');
|
|
46
46
|
return urlPathname;
|
|
47
47
|
}
|
|
48
|
-
exports.resolveUrlPathname = resolveUrlPathname;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sortPageContext =
|
|
3
|
+
exports.sortPageContext = sortPageContext;
|
|
4
4
|
const utils_js_1 = require("./utils.js");
|
|
5
5
|
// Sort `pageContext` keys alphabetically, in order to make reading `console.log(pageContext)` easier
|
|
6
6
|
function sortPageContext(pageContext) {
|
|
@@ -10,4 +10,3 @@ function sortPageContext(pageContext) {
|
|
|
10
10
|
descriptors = Object.fromEntries(Object.entries(descriptors).sort(([key1], [key2]) => (0, utils_js_1.compareString)(key1, key2)));
|
|
11
11
|
Object.defineProperties(pageContext, descriptors);
|
|
12
12
|
}
|
|
13
|
-
exports.sortPageContext = sortPageContext;
|
package/dist/cjs/utils/assert.js
CHANGED
|
@@ -3,7 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.assert = assert;
|
|
7
|
+
exports.assertUsage = assertUsage;
|
|
8
|
+
exports.assertWarning = assertWarning;
|
|
9
|
+
exports.assertInfo = assertInfo;
|
|
10
|
+
exports.getProjectError = getProjectError;
|
|
11
|
+
exports.addOnBeforeLogHook = addOnBeforeLogHook;
|
|
12
|
+
exports.getAssertErrMsg = getAssertErrMsg;
|
|
13
|
+
exports.overwriteAssertProductionLogger = overwriteAssertProductionLogger;
|
|
14
|
+
exports.isBug = isBug;
|
|
15
|
+
exports.setAlwaysShowStackTrace = setAlwaysShowStackTrace;
|
|
7
16
|
const assertSingleInstance_js_1 = require("./assertSingleInstance.js");
|
|
8
17
|
const createErrorWithCleanStackTrace_js_1 = require("./createErrorWithCleanStackTrace.js");
|
|
9
18
|
const getGlobalObject_js_1 = require("./getGlobalObject.js");
|
|
@@ -51,7 +60,6 @@ function assert(condition, debugInfo) {
|
|
|
51
60
|
globalObject.onBeforeLog?.();
|
|
52
61
|
throw internalError;
|
|
53
62
|
}
|
|
54
|
-
exports.assert = assert;
|
|
55
63
|
function assertUsage(condition, errMsg, { showStackTrace } = {}) {
|
|
56
64
|
if (condition)
|
|
57
65
|
return;
|
|
@@ -66,7 +74,6 @@ function assertUsage(condition, errMsg, { showStackTrace } = {}) {
|
|
|
66
74
|
globalObject.onBeforeLog?.();
|
|
67
75
|
throw usageError;
|
|
68
76
|
}
|
|
69
|
-
exports.assertUsage = assertUsage;
|
|
70
77
|
function getProjectError(errMsg) {
|
|
71
78
|
errMsg = addWhitespace(errMsg);
|
|
72
79
|
errMsg = addPrefixAssertType(errMsg, 'Error');
|
|
@@ -74,7 +81,6 @@ function getProjectError(errMsg) {
|
|
|
74
81
|
const projectError = (0, createErrorWithCleanStackTrace_js_1.createErrorWithCleanStackTrace)(errMsg, numberOfStackTraceLinesToRemove);
|
|
75
82
|
return projectError;
|
|
76
83
|
}
|
|
77
|
-
exports.getProjectError = getProjectError;
|
|
78
84
|
function assertWarning(condition, msg, { onlyOnce, showStackTrace }) {
|
|
79
85
|
if (condition)
|
|
80
86
|
return;
|
|
@@ -102,7 +108,6 @@ function assertWarning(condition, msg, { onlyOnce, showStackTrace }) {
|
|
|
102
108
|
globalObject.logger(msg, 'warn');
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
|
-
exports.assertWarning = assertWarning;
|
|
106
111
|
function assertInfo(condition, msg, { onlyOnce }) {
|
|
107
112
|
if (condition) {
|
|
108
113
|
return;
|
|
@@ -122,11 +127,9 @@ function assertInfo(condition, msg, { onlyOnce }) {
|
|
|
122
127
|
globalObject.onBeforeLog?.();
|
|
123
128
|
globalObject.logger(msg, 'info');
|
|
124
129
|
}
|
|
125
|
-
exports.assertInfo = assertInfo;
|
|
126
130
|
function addOnBeforeLogHook(onBeforeLog) {
|
|
127
131
|
globalObject.onBeforeLog = onBeforeLog;
|
|
128
132
|
}
|
|
129
|
-
exports.addOnBeforeLogHook = addOnBeforeLogHook;
|
|
130
133
|
function addPrefixAssertType(msg, tag) {
|
|
131
134
|
let prefix = `[${tag}]`;
|
|
132
135
|
const color = tag === 'Warning' ? 'yellow' : 'red';
|
|
@@ -178,7 +181,6 @@ function getAssertErrMsg(thing) {
|
|
|
178
181
|
const showVikeVersion = isBug;
|
|
179
182
|
return { assertMsg, showVikeVersion };
|
|
180
183
|
}
|
|
181
|
-
exports.getAssertErrMsg = getAssertErrMsg;
|
|
182
184
|
function removeErrMsg(stack) {
|
|
183
185
|
if (typeof stack !== 'string')
|
|
184
186
|
return String(stack);
|
|
@@ -190,12 +192,9 @@ function removeErrMsg(stack) {
|
|
|
190
192
|
function overwriteAssertProductionLogger(logger) {
|
|
191
193
|
globalObject.logger = logger;
|
|
192
194
|
}
|
|
193
|
-
exports.overwriteAssertProductionLogger = overwriteAssertProductionLogger;
|
|
194
195
|
function isBug(err) {
|
|
195
196
|
return !String(err).includes('[Bug]');
|
|
196
197
|
}
|
|
197
|
-
exports.isBug = isBug;
|
|
198
198
|
function setAlwaysShowStackTrace() {
|
|
199
199
|
globalObject.alwaysShowStackTrace = true;
|
|
200
200
|
}
|
|
201
|
-
exports.setAlwaysShowStackTrace = setAlwaysShowStackTrace;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertIsBrowser =
|
|
3
|
+
exports.assertIsBrowser = assertIsBrowser;
|
|
4
4
|
const isBrowser_js_1 = require("./isBrowser.js");
|
|
5
5
|
const assert_js_1 = require("./assert.js");
|
|
6
6
|
function assertIsBrowser() {
|
|
7
7
|
(0, assert_js_1.assert)((0, isBrowser_js_1.isBrowser)());
|
|
8
8
|
}
|
|
9
|
-
exports.assertIsBrowser = assertIsBrowser;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertIsNotBrowser =
|
|
3
|
+
exports.assertIsNotBrowser = assertIsNotBrowser;
|
|
4
4
|
const isBrowser_js_1 = require("./isBrowser.js");
|
|
5
5
|
const assert_js_1 = require("./assert.js");
|
|
6
6
|
/** Ensure we don't bloat the client-side */
|
|
7
7
|
function assertIsNotBrowser() {
|
|
8
8
|
(0, assert_js_1.assert)(!(0, isBrowser_js_1.isBrowser)());
|
|
9
9
|
}
|
|
10
|
-
exports.assertIsNotBrowser = assertIsNotBrowser;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Mechanism to ensure code isn't loaded by production runtime
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.vikeVitePluginLoadedInProductionError =
|
|
4
|
+
exports.vikeVitePluginLoadedInProductionError = void 0;
|
|
5
|
+
exports.assertIsNotProductionRuntime = assertIsNotProductionRuntime;
|
|
6
|
+
exports.markEnvAsViteDev = markEnvAsViteDev;
|
|
7
|
+
exports.markEnvAsVitePreview = markEnvAsVitePreview;
|
|
8
|
+
exports.markEnvAsVikePluginLoaded = markEnvAsVikePluginLoaded;
|
|
9
|
+
exports.assertEnv = assertEnv;
|
|
5
10
|
const assert_js_1 = require("./assert.js");
|
|
6
11
|
const assertIsNotBrowser_js_1 = require("./assertIsNotBrowser.js");
|
|
7
12
|
const debug_js_1 = require("./debug.js");
|
|
@@ -18,28 +23,24 @@ function assertIsNotProductionRuntime() {
|
|
|
18
23
|
debug('assertIsNotProductionRuntime()', new Error().stack);
|
|
19
24
|
env.shouldNotBeProduction = true;
|
|
20
25
|
}
|
|
21
|
-
exports.assertIsNotProductionRuntime = assertIsNotProductionRuntime;
|
|
22
26
|
// Called by Vite hook configureServer()
|
|
23
27
|
function markEnvAsViteDev() {
|
|
24
28
|
if (debug.isActivated)
|
|
25
29
|
debug('markEnvAsViteDev()', new Error().stack);
|
|
26
30
|
env.isViteDev = true;
|
|
27
31
|
}
|
|
28
|
-
exports.markEnvAsViteDev = markEnvAsViteDev;
|
|
29
32
|
// Called by Vite hook configurePreviewServer()
|
|
30
33
|
function markEnvAsVitePreview() {
|
|
31
34
|
if (debug.isActivated)
|
|
32
35
|
debug('markEnvAsVitePreview()', new Error().stack);
|
|
33
36
|
env.isVitePreview = true;
|
|
34
37
|
}
|
|
35
|
-
exports.markEnvAsVitePreview = markEnvAsVitePreview;
|
|
36
38
|
// Called by ../node/plugin/index.ts
|
|
37
39
|
function markEnvAsVikePluginLoaded() {
|
|
38
40
|
if (debug.isActivated)
|
|
39
41
|
debug('markEnvAsVikePluginLoaded()', new Error().stack);
|
|
40
42
|
env.isVikePluginLoaded = true;
|
|
41
43
|
}
|
|
42
|
-
exports.markEnvAsVikePluginLoaded = markEnvAsVikePluginLoaded;
|
|
43
44
|
// Called by ../node/runtime/index.ts
|
|
44
45
|
function assertEnv() {
|
|
45
46
|
if (debug.isActivated)
|
|
@@ -59,4 +60,3 @@ function assertEnv() {
|
|
|
59
60
|
(0, assert_js_1.assert)(env.isVikePluginLoaded);
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
|
-
exports.assertEnv = assertEnv;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.assertKeys =
|
|
6
|
+
exports.assertKeys = assertKeys;
|
|
7
7
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
8
8
|
const assert_js_1 = require("./assert.js");
|
|
9
9
|
const joinEnglish_js_1 = require("./joinEnglish.js");
|
|
@@ -25,4 +25,3 @@ function assertKeys(obj, keysExpected, errPrefix) {
|
|
|
25
25
|
].join(' '));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
exports.assertKeys = assertKeys;
|
|
@@ -14,7 +14,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.assertNodeEnv_build = assertNodeEnv_build;
|
|
18
|
+
exports.assertNodeEnv_runtime = assertNodeEnv_runtime;
|
|
19
|
+
exports.assertNodeEnv_onVikePluginLoad = assertNodeEnv_onVikePluginLoad;
|
|
20
|
+
exports.handleNodeEnv_prerender = handleNodeEnv_prerender;
|
|
21
|
+
exports.handleNodeEnv_vitePluginVercel = handleNodeEnv_vitePluginVercel;
|
|
18
22
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
19
23
|
const assertIsNotBrowser_js_1 = require("./assertIsNotBrowser.js");
|
|
20
24
|
const assert_js_1 = require("./assert.js");
|
|
@@ -23,7 +27,6 @@ const assertIsNotProductionRuntime_js_1 = require("./assertIsNotProductionRuntim
|
|
|
23
27
|
function assertNodeEnv_build() {
|
|
24
28
|
assertNodeEnvIsNotDev('building');
|
|
25
29
|
}
|
|
26
|
-
exports.assertNodeEnv_build = assertNodeEnv_build;
|
|
27
30
|
function assertNodeEnv_runtime(isViteDev) {
|
|
28
31
|
const nodeEnv = getNodeEnv();
|
|
29
32
|
if (nodeEnv === null || nodeEnv === 'test')
|
|
@@ -37,7 +40,6 @@ function assertNodeEnv_runtime(isViteDev) {
|
|
|
37
40
|
const errMsg = `Running ${isViteDev ? picocolors_1.default.cyan('$ vite dev') : 'app in production'} while the ${nodeEnvDesc} which is contradictory, see https://vike.dev/NODE_ENV`;
|
|
38
41
|
(0, assert_js_1.assertWarning)(false, errMsg, { onlyOnce: true });
|
|
39
42
|
}
|
|
40
|
-
exports.assertNodeEnv_runtime = assertNodeEnv_runtime;
|
|
41
43
|
function assertNodeEnv_onVikePluginLoad() {
|
|
42
44
|
const nodeEnv = getNodeEnv();
|
|
43
45
|
if (nodeEnv === 'test')
|
|
@@ -56,7 +58,6 @@ function assertNodeEnv_onVikePluginLoad() {
|
|
|
56
58
|
assertIsNotProductionRuntime_js_1.vikeVitePluginLoadedInProductionError
|
|
57
59
|
].join(' '), { onlyOnce: true });
|
|
58
60
|
}
|
|
59
|
-
exports.assertNodeEnv_onVikePluginLoad = assertNodeEnv_onVikePluginLoad;
|
|
60
61
|
function handleNodeEnv_prerender() {
|
|
61
62
|
const assertNodeEnv = () => assertNodeEnvIsNotDev('pre-rendering');
|
|
62
63
|
if (getNodeEnv())
|
|
@@ -64,11 +65,9 @@ function handleNodeEnv_prerender() {
|
|
|
64
65
|
setNodeEnvToProduction();
|
|
65
66
|
assertNodeEnv();
|
|
66
67
|
}
|
|
67
|
-
exports.handleNodeEnv_prerender = handleNodeEnv_prerender;
|
|
68
68
|
function handleNodeEnv_vitePluginVercel() {
|
|
69
69
|
setNodeEnvToProduction();
|
|
70
70
|
}
|
|
71
|
-
exports.handleNodeEnv_vitePluginVercel = handleNodeEnv_vitePluginVercel;
|
|
72
71
|
function getNodeEnv() {
|
|
73
72
|
if (typeof process === 'undefined')
|
|
74
73
|
return null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertNodeVersion =
|
|
3
|
+
exports.assertNodeVersion = assertNodeVersion;
|
|
4
4
|
const isNodeJS_js_1 = require("./isNodeJS.js");
|
|
5
5
|
const assertVersion_js_1 = require("./assertVersion.js");
|
|
6
6
|
// node_modules/vike/package.json#engines.node isn't enough as users can ignore it
|
|
@@ -10,4 +10,3 @@ function assertNodeVersion() {
|
|
|
10
10
|
const version = process.versions.node;
|
|
11
11
|
(0, assertVersion_js_1.assertVersion)('Node.js', version, '18.0.0');
|
|
12
12
|
}
|
|
13
|
-
exports.assertNodeVersion = assertNodeVersion;
|
|
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.assertClientRouting = assertClientRouting;
|
|
7
|
+
exports.assertServerRouting = assertServerRouting;
|
|
8
|
+
exports.checkIfClientRouting = checkIfClientRouting;
|
|
7
9
|
const assert_js_1 = require("./assert.js");
|
|
8
10
|
const getGlobalObject_js_1 = require("./getGlobalObject.js");
|
|
9
11
|
const isBrowser_js_1 = require("./isBrowser.js");
|
|
@@ -13,16 +15,13 @@ function assertClientRouting() {
|
|
|
13
15
|
assertNoContradiction(checkIfClientRouting());
|
|
14
16
|
state.isClientRouting = true;
|
|
15
17
|
}
|
|
16
|
-
exports.assertClientRouting = assertClientRouting;
|
|
17
18
|
function checkIfClientRouting() {
|
|
18
19
|
return state.isClientRouting !== false;
|
|
19
20
|
}
|
|
20
|
-
exports.checkIfClientRouting = checkIfClientRouting;
|
|
21
21
|
function assertServerRouting() {
|
|
22
22
|
assertNoContradiction(state.isClientRouting !== true);
|
|
23
23
|
state.isClientRouting = false;
|
|
24
24
|
}
|
|
25
|
-
exports.assertServerRouting = assertServerRouting;
|
|
26
25
|
function assertNoContradiction(noContradiction) {
|
|
27
26
|
// If an assertion fails because of a wrong usage, then we assume that the user is trying to import from 'vike/client/router' while not setting `clientRouting` to `true`. Note that 'vike/client' only exports the type `PageContextBuiltInClient` and that the package.json#exports entry 'vike/client' will eventually be removed.
|
|
28
27
|
(0, assert_js_1.assertUsage)((0, isBrowser_js_1.isBrowser)(), `${picocolors_1.default.cyan("import { something } from 'vike/client/router'")} is forbidden on the server-side`, { showStackTrace: true });
|
|
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.assertSingleInstance_onClientEntryServerRouting = assertSingleInstance_onClientEntryServerRouting;
|
|
7
|
+
exports.assertSingleInstance_onClientEntryClientRouting = assertSingleInstance_onClientEntryClientRouting;
|
|
8
|
+
exports.assertSingleInstance_onAssertModuleLoad = assertSingleInstance_onAssertModuleLoad;
|
|
7
9
|
// - Throw error if there are two different versions of vike loaded
|
|
8
10
|
// - Show warning if entry of Client Routing and entry of Server Routing are both loaded
|
|
9
11
|
// - Show warning if vike is loaded twice
|
|
@@ -49,7 +51,6 @@ function assertSingleInstance_onClientEntryServerRouting(isProduction) {
|
|
|
49
51
|
globalObject.checkSingleInstance = true;
|
|
50
52
|
assertSingleInstance();
|
|
51
53
|
}
|
|
52
|
-
exports.assertSingleInstance_onClientEntryServerRouting = assertSingleInstance_onClientEntryServerRouting;
|
|
53
54
|
function assertSingleInstance_onClientEntryClientRouting(isProduction) {
|
|
54
55
|
assertWarning(globalObject.isClientRouting !== false, clientRuntimesClonflict, {
|
|
55
56
|
onlyOnce: true,
|
|
@@ -64,13 +65,11 @@ function assertSingleInstance_onClientEntryClientRouting(isProduction) {
|
|
|
64
65
|
globalObject.checkSingleInstance = true;
|
|
65
66
|
assertSingleInstance();
|
|
66
67
|
}
|
|
67
|
-
exports.assertSingleInstance_onClientEntryClientRouting = assertSingleInstance_onClientEntryClientRouting;
|
|
68
68
|
// Called by utils/assert.ts which is (most certainly) loaded by all entries. That way we don't have to call a callback for every entry. (There are a lot of entries: `client/router/`, `client/`, `node/runtime/`, `node/plugin/`, `node/cli`.)
|
|
69
69
|
function assertSingleInstance_onAssertModuleLoad() {
|
|
70
70
|
globalObject.instances.push(projectInfo_js_1.projectInfo.projectVersion);
|
|
71
71
|
assertSingleInstance();
|
|
72
72
|
}
|
|
73
|
-
exports.assertSingleInstance_onAssertModuleLoad = assertSingleInstance_onAssertModuleLoad;
|
|
74
73
|
function assertUsage(condition, errorMessage) {
|
|
75
74
|
if (condition) {
|
|
76
75
|
return;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.assertVersion = assertVersion;
|
|
4
|
+
exports.isVersionOrAbove = isVersionOrAbove;
|
|
4
5
|
const assert_js_1 = require("./assert.js");
|
|
5
6
|
function assertVersion(dependencyName, versionActual, versionExpected) {
|
|
6
7
|
(0, assert_js_1.assertUsage)(isVersionOrAbove(versionActual, versionExpected), `${dependencyName} ${versionActual} isn't supported, use ${dependencyName} >= ${versionExpected} instead.`);
|
|
7
8
|
}
|
|
8
|
-
exports.assertVersion = assertVersion;
|
|
9
9
|
function isVersionOrAbove(versionActual, versionExpected) {
|
|
10
10
|
const p1 = parseVersion(versionActual);
|
|
11
11
|
const p2 = parseVersion(versionExpected);
|
|
@@ -21,7 +21,6 @@ function isVersionOrAbove(versionActual, versionExpected) {
|
|
|
21
21
|
// Same version
|
|
22
22
|
return true;
|
|
23
23
|
}
|
|
24
|
-
exports.isVersionOrAbove = isVersionOrAbove;
|
|
25
24
|
function parseVersion(version) {
|
|
26
25
|
// Remove pre-release tag
|
|
27
26
|
version = version.split('-')[0];
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.augmentType =
|
|
3
|
+
exports.augmentType = augmentType;
|
|
4
4
|
const assert_js_1 = require("./assert.js");
|
|
5
5
|
/** Help TypeScript augment the type of objects. */
|
|
6
6
|
function augmentType(thing, clone) {
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
(0, assert_js_1.assert)(thing === clone);
|
|
9
9
|
}
|
|
10
|
-
exports.augmentType = augmentType;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.capitalizeFirstLetter =
|
|
3
|
+
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
4
4
|
function capitalizeFirstLetter(word) {
|
|
5
5
|
if (!word[0]) {
|
|
6
6
|
return word;
|
|
7
7
|
}
|
|
8
8
|
return word[0].toUpperCase() + word.slice(1);
|
|
9
9
|
}
|
|
10
|
-
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
package/dist/cjs/utils/cast.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.castProp = exports.cast = void 0;
|
|
4
|
-
function cast(_thing) { }
|
|
5
3
|
exports.cast = cast;
|
|
6
|
-
function castProp(_obj, _prop) { }
|
|
7
4
|
exports.castProp = castProp;
|
|
5
|
+
function cast(_thing) { }
|
|
6
|
+
function castProp(_obj, _prop) { }
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.changeEnumerable =
|
|
3
|
+
exports.changeEnumerable = changeEnumerable;
|
|
4
4
|
/** Change enumerability of an object property. */
|
|
5
5
|
function changeEnumerable(obj, prop, enumerable) {
|
|
6
6
|
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
7
7
|
Object.defineProperty(obj, prop, { ...descriptor, enumerable });
|
|
8
8
|
}
|
|
9
|
-
exports.changeEnumerable = changeEnumerable;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.castType = exports.checkType = void 0;
|
|
4
|
-
function checkType(_) { }
|
|
5
3
|
exports.checkType = checkType;
|
|
6
|
-
function castType(_) { }
|
|
7
4
|
exports.castType = castType;
|
|
5
|
+
function checkType(_) { }
|
|
6
|
+
function castType(_) { }
|