vike 0.4.163 → 0.4.165-commit-74b18b0
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 +1 -1
- package/dist/cjs/node/plugin/index.js +6 -18
- package/dist/cjs/node/plugin/plugins/autoFullBuild.js +7 -4
- package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +8 -4
- package/dist/cjs/node/plugin/plugins/buildConfig.js +7 -8
- package/dist/cjs/node/plugin/plugins/distFileNames.js +4 -9
- package/dist/cjs/node/plugin/shared/getAssetsDir.js +11 -0
- package/dist/cjs/node/plugin/shared/getHttpRequestAsyncStore.js +15 -23
- package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/{errMdx.js → errMdx1.js} +2 -2
- package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.js +85 -0
- package/dist/cjs/node/plugin/shared/loggerNotProd.js +15 -11
- package/dist/cjs/node/plugin/shared/loggerVite.js +12 -18
- package/dist/cjs/node/plugin/utils.js +1 -1
- package/dist/cjs/node/prerender/runPrerender.js +1 -8
- package/dist/cjs/node/runtime/globalContext.js +1 -13
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +2 -13
- package/dist/cjs/node/runtime/renderPage/loggerProd.js +5 -1
- package/dist/cjs/node/runtime/renderPage.js +2 -4
- package/dist/cjs/shared/route/resolveRouteString.js +0 -1
- package/dist/cjs/utils/assertNodeEnv.js +65 -10
- package/dist/cjs/utils/assertNodeVersion.js +3 -4
- package/dist/cjs/utils/{isVersionOrAbove.js → assertVersion.js} +5 -1
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/__internal/index.js +2 -2
- package/dist/esm/node/plugin/index.js +7 -19
- package/dist/esm/node/plugin/plugins/autoFullBuild.js +7 -4
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +9 -5
- package/dist/esm/node/plugin/plugins/buildConfig.js +8 -9
- package/dist/esm/node/plugin/plugins/distFileNames.js +1 -6
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +3 -3
- package/dist/esm/node/plugin/shared/getAssetsDir.d.ts +3 -0
- package/dist/esm/node/plugin/shared/getAssetsDir.js +8 -0
- package/dist/esm/node/plugin/shared/getHttpRequestAsyncStore.d.ts +0 -1
- package/dist/esm/node/plugin/shared/getHttpRequestAsyncStore.js +16 -24
- package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/{errMdx.d.ts → errMdx1.d.ts} +1 -1
- package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/{errMdx.js → errMdx1.js} +1 -1
- package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.d.ts +44 -0
- package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.js +82 -0
- package/dist/esm/node/plugin/shared/loggerNotProd.d.ts +3 -6
- package/dist/esm/node/plugin/shared/loggerNotProd.js +14 -10
- package/dist/esm/node/plugin/shared/loggerVite.js +13 -19
- package/dist/esm/node/plugin/utils.d.ts +1 -1
- package/dist/esm/node/plugin/utils.js +1 -1
- package/dist/esm/node/prerender/runPrerender.js +2 -9
- package/dist/esm/node/runtime/globalContext.js +2 -14
- package/dist/esm/node/runtime/renderPage/logErrorHint.js +3 -11
- package/dist/esm/node/runtime/renderPage/loggerProd.js +5 -1
- package/dist/esm/node/runtime/renderPage.d.ts +0 -1
- package/dist/esm/node/runtime/renderPage.js +2 -4
- package/dist/esm/shared/page-configs/Config/PageContextConfig.d.ts +1 -1
- package/dist/esm/shared/route/resolveRouteString.js +0 -1
- package/dist/esm/utils/assertNodeEnv.d.ts +10 -10
- package/dist/esm/utils/assertNodeEnv.js +67 -10
- package/dist/esm/utils/assertNodeVersion.js +3 -4
- package/dist/esm/utils/assertVersion.d.ts +4 -0
- package/dist/esm/utils/{isVersionOrAbove.js → assertVersion.js} +5 -1
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +3 -2
- package/dist/esm/utils/isVersionOrAbove.d.ts +0 -2
|
@@ -13,7 +13,7 @@ const renderPageAlreadyRouted_js_1 = require("../node/runtime/renderPage/renderP
|
|
|
13
13
|
* @param config
|
|
14
14
|
*/
|
|
15
15
|
async function getPagesAndRoutes() {
|
|
16
|
-
(0, assertNodeEnv_js_1.
|
|
16
|
+
(0, assertNodeEnv_js_1.handleNodeEnv_vitePluginVercel)();
|
|
17
17
|
await (0, globalContext_js_1.initGlobalContext)(true);
|
|
18
18
|
const globalContext = (0, globalContext_js_1.getGlobalContext)();
|
|
19
19
|
(0, assert_js_1.assert)(globalContext.isProduction === true);
|
|
@@ -7,6 +7,7 @@ exports.version = exports.ssr = exports.plugin = void 0;
|
|
|
7
7
|
exports.default = plugin;
|
|
8
8
|
var utils_js_1 = require("./utils.js");
|
|
9
9
|
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return utils_js_1.PROJECT_VERSION; } });
|
|
10
|
+
const vite_1 = require("vite");
|
|
10
11
|
const utils_js_2 = require("./utils.js");
|
|
11
12
|
const buildConfig_js_1 = require("./plugins/buildConfig.js");
|
|
12
13
|
const previewConfig_js_1 = require("./plugins/previewConfig.js");
|
|
@@ -27,8 +28,9 @@ const baseUrls_js_1 = require("./plugins/baseUrls.js");
|
|
|
27
28
|
const envVars_js_1 = require("./plugins/envVars.js");
|
|
28
29
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
29
30
|
const fileEnv_js_1 = require("./plugins/fileEnv.js");
|
|
30
|
-
|
|
31
|
+
(0, utils_js_2.assertNodeEnv_onVikePluginLoad)();
|
|
31
32
|
(0, utils_js_2.markEnvAsVikePluginLoaded)();
|
|
33
|
+
assertViteVersion();
|
|
32
34
|
// Return as `any` to avoid Plugin type mismatches when there are multiple Vite versions installed
|
|
33
35
|
function plugin(vikeConfig) {
|
|
34
36
|
const plugins = [
|
|
@@ -69,21 +71,7 @@ Object.defineProperty(plugin, 'apply', {
|
|
|
69
71
|
(0, utils_js_2.assertUsage)(false, `Add ${picocolors_1.default.cyan('vike()')} instead of ${picocolors_1.default.cyan('vike')} to vite.config.js#plugins (i.e. call the function and add the return value instead of adding the function itself)`, { showStackTrace: true });
|
|
70
72
|
}
|
|
71
73
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return;
|
|
76
|
-
// We should change this to be a warning if it blocks users (e.g. if a bad-citizen tool sets a wrong process.env.NODE_ENV value).
|
|
77
|
-
(0, utils_js_2.assertUsage)(
|
|
78
|
-
/* We can enable this assertion after Vike's CLI is implemented and using Vite's CLI is deprecated (we can then check whether the context is a `$ vike build`).
|
|
79
|
-
isNodeEnvDev() || isVikeCliBuild(),
|
|
80
|
-
/*/
|
|
81
|
-
(0, utils_js_2.isNodeEnvDev)() || true,
|
|
82
|
-
///*/
|
|
83
|
-
[
|
|
84
|
-
picocolors_1.default.cyan(`process.env.NODE_ENV === ${JSON.stringify(nodeEnv)}`),
|
|
85
|
-
'(which Vike interprets as a non-development environment https://vike.dev/NODE_ENV)',
|
|
86
|
-
'while the vike/plugin module is loaded.',
|
|
87
|
-
utils_js_2.vikeVitePluginLoadedInProductionError
|
|
88
|
-
].join(' '));
|
|
74
|
+
// node_modules/vike/package.json#peerDependencies.vite isn't enough as users can ignore it
|
|
75
|
+
function assertViteVersion() {
|
|
76
|
+
(0, utils_js_2.assertVersion)('Vite', vite_1.version, '4.4.0');
|
|
89
77
|
}
|
|
@@ -11,6 +11,7 @@ const getConfigVike_js_1 = require("../../shared/getConfigVike.js");
|
|
|
11
11
|
const isViteCliCall_js_1 = require("../shared/isViteCliCall.js");
|
|
12
12
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
13
13
|
const logErrorHint_js_1 = require("../../runtime/renderPage/logErrorHint.js");
|
|
14
|
+
const buildConfig_js_1 = require("./buildConfig.js");
|
|
14
15
|
let forceExit = false;
|
|
15
16
|
function autoFullBuild() {
|
|
16
17
|
let config;
|
|
@@ -64,10 +65,12 @@ async function triggerFullBuild(config, configVike, bundle) {
|
|
|
64
65
|
return; // already triggered
|
|
65
66
|
if (isDisabled(configVike))
|
|
66
67
|
return;
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
// Workaround for @vitejs/plugin-legacy
|
|
69
|
+
// - The legacy plugin triggers its own Rollup build for the client-side.
|
|
70
|
+
// - The legacy plugin doesn't generate a manifest => we can use that to detect the legacy plugin build.
|
|
71
|
+
// - Issue & reproduction: https://github.com/vikejs/vike/issues/1154#issuecomment-1965954636
|
|
72
|
+
if (!bundle[buildConfig_js_1.manifestTempFile])
|
|
73
|
+
return;
|
|
71
74
|
const configFromCli = !(0, isViteCliCall_js_1.isViteCliCall)() ? null : (0, isViteCliCall_js_1.getViteConfigFromCli)();
|
|
72
75
|
const configInline = {
|
|
73
76
|
...configFromCli,
|
|
@@ -10,6 +10,7 @@ const fs_1 = require("fs");
|
|
|
10
10
|
const utils_js_1 = require("../../utils.js");
|
|
11
11
|
const virtualFilePageConfigValuesAll_js_1 = require("../../../shared/virtual-files/virtualFilePageConfigValuesAll.js");
|
|
12
12
|
const buildConfig_js_1 = require("../buildConfig.js");
|
|
13
|
+
const getAssetsDir_js_1 = require("../../shared/getAssetsDir.js");
|
|
13
14
|
/**
|
|
14
15
|
* true => use workaround config.build.ssrEmitAssets
|
|
15
16
|
* false => use workaround extractAssets plugin
|
|
@@ -23,11 +24,12 @@ function fixServerAssets_isEnabled() {
|
|
|
23
24
|
}
|
|
24
25
|
exports.fixServerAssets_isEnabled = fixServerAssets_isEnabled;
|
|
25
26
|
/** https://github.com/vikejs/vike/issues/1339 */
|
|
26
|
-
async function fixServerAssets(
|
|
27
|
+
async function fixServerAssets(config) {
|
|
28
|
+
const outDirs = (0, utils_js_1.getOutDirs)(config);
|
|
27
29
|
const clientManifest = await loadManifest(outDirs.outDirClient);
|
|
28
30
|
const serverManifest = await loadManifest(outDirs.outDirServer);
|
|
29
31
|
const { clientManifestMod, filesToCopy } = addServerAssets(clientManifest, serverManifest);
|
|
30
|
-
await copyAssets(filesToCopy,
|
|
32
|
+
await copyAssets(filesToCopy, config);
|
|
31
33
|
return clientManifestMod;
|
|
32
34
|
}
|
|
33
35
|
exports.fixServerAssets = fixServerAssets;
|
|
@@ -39,8 +41,10 @@ async function loadManifest(outDir) {
|
|
|
39
41
|
(0, utils_js_1.assert)(manifest);
|
|
40
42
|
return manifest;
|
|
41
43
|
}
|
|
42
|
-
async function copyAssets(filesToCopy,
|
|
43
|
-
const
|
|
44
|
+
async function copyAssets(filesToCopy, config) {
|
|
45
|
+
const { outDirClient, outDirServer } = (0, utils_js_1.getOutDirs)(config);
|
|
46
|
+
const assetsDir = (0, getAssetsDir_js_1.getAssetsDir)(config);
|
|
47
|
+
const assetsDirServer = path_1.default.posix.join(outDirServer, assetsDir);
|
|
44
48
|
if (!filesToCopy.length)
|
|
45
49
|
return;
|
|
46
50
|
(0, utils_js_1.assert)((0, fs_1.existsSync)(assetsDirServer));
|
|
@@ -27,14 +27,16 @@ function buildConfig() {
|
|
|
27
27
|
let isServerAssetsFixEnabled;
|
|
28
28
|
let isSsrBuild;
|
|
29
29
|
let outDirs;
|
|
30
|
+
let config;
|
|
30
31
|
return {
|
|
31
32
|
name: 'vike:buildConfig',
|
|
32
33
|
apply: 'build',
|
|
33
34
|
enforce: 'post',
|
|
34
35
|
configResolved: {
|
|
35
36
|
order: 'post',
|
|
36
|
-
async handler(
|
|
37
|
-
|
|
37
|
+
async handler(config_) {
|
|
38
|
+
config = config_;
|
|
39
|
+
(0, utils_js_1.assertNodeEnv_build)();
|
|
38
40
|
assertRollupInput(config);
|
|
39
41
|
const entries = await getEntries(config);
|
|
40
42
|
(0, utils_js_1.assert)(Object.keys(entries).length > 0);
|
|
@@ -53,7 +55,7 @@ function buildConfig() {
|
|
|
53
55
|
}
|
|
54
56
|
},
|
|
55
57
|
config(config) {
|
|
56
|
-
|
|
58
|
+
(0, utils_js_1.assertNodeEnv_build)();
|
|
57
59
|
isSsrBuild = (0, utils_js_1.viteIsSSR)(config);
|
|
58
60
|
return {
|
|
59
61
|
build: {
|
|
@@ -64,7 +66,7 @@ function buildConfig() {
|
|
|
64
66
|
};
|
|
65
67
|
},
|
|
66
68
|
buildStart() {
|
|
67
|
-
|
|
69
|
+
(0, utils_js_1.assertNodeEnv_build)();
|
|
68
70
|
},
|
|
69
71
|
writeBundle: {
|
|
70
72
|
order: 'post',
|
|
@@ -81,7 +83,7 @@ function buildConfig() {
|
|
|
81
83
|
await promises_1.default.copyFile(clientManifestFilePath, assetsJsonFilePath);
|
|
82
84
|
}
|
|
83
85
|
else {
|
|
84
|
-
const clientManifestMod = await (0, fixServerAssets_js_1.fixServerAssets)(
|
|
86
|
+
const clientManifestMod = await (0, fixServerAssets_js_1.fixServerAssets)(config);
|
|
85
87
|
await promises_1.default.writeFile(assetsJsonFilePath, JSON.stringify(clientManifestMod, null, 2), 'utf-8');
|
|
86
88
|
}
|
|
87
89
|
await promises_1.default.rm(clientManifestFilePath);
|
|
@@ -258,6 +260,3 @@ function assertRollupInput(config) {
|
|
|
258
260
|
(0, utils_js_1.assertUsage)(htmlInput === undefined, `The entry ${htmlInput} of config build.rollupOptions.input is an HTML entry which is forbidden when using Vike, instead follow https://vike.dev/add`);
|
|
259
261
|
}
|
|
260
262
|
exports.assertRollupInput = assertRollupInput;
|
|
261
|
-
function assertNodeEnv() {
|
|
262
|
-
(0, utils_js_1.assertNodeEnvIsNotDev)('building');
|
|
263
|
-
}
|
|
@@ -9,6 +9,7 @@ exports.distFileNames = void 0;
|
|
|
9
9
|
// - Blocker: https://github.com/rollup/rollup/issues/4724
|
|
10
10
|
const utils_js_1 = require("../utils.js");
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const getAssetsDir_js_1 = require("../shared/getAssetsDir.js");
|
|
12
13
|
function distFileNames() {
|
|
13
14
|
return {
|
|
14
15
|
name: 'vike:distFileNames',
|
|
@@ -41,7 +42,7 @@ function distFileNames() {
|
|
|
41
42
|
}
|
|
42
43
|
exports.distFileNames = distFileNames;
|
|
43
44
|
function getAssetFileName(assetInfo, config) {
|
|
44
|
-
const assetsDir = getAssetsDir(config);
|
|
45
|
+
const assetsDir = (0, getAssetsDir_js_1.getAssetsDir)(config);
|
|
45
46
|
const dir = assetsDir + '/static';
|
|
46
47
|
let { name } = assetInfo;
|
|
47
48
|
if (!name) {
|
|
@@ -69,13 +70,13 @@ function getChunkFileName(_chunkInfo, config) {
|
|
|
69
70
|
const isForClientSide = !config.build.ssr;
|
|
70
71
|
let name = 'chunks/chunk-[hash].js';
|
|
71
72
|
if (isForClientSide) {
|
|
72
|
-
const assetsDir = getAssetsDir(config);
|
|
73
|
+
const assetsDir = (0, getAssetsDir_js_1.getAssetsDir)(config);
|
|
73
74
|
name = `${assetsDir}/${name}`;
|
|
74
75
|
}
|
|
75
76
|
return name;
|
|
76
77
|
}
|
|
77
78
|
function getEntryFileName(chunkInfo, config, isEntry) {
|
|
78
|
-
const assetsDir = getAssetsDir(config);
|
|
79
|
+
const assetsDir = (0, getAssetsDir_js_1.getAssetsDir)(config);
|
|
79
80
|
const isForClientSide = !config.build.ssr;
|
|
80
81
|
let { name } = chunkInfo;
|
|
81
82
|
(0, utils_js_1.assertPosixPath)(name);
|
|
@@ -169,9 +170,3 @@ function getRollupOutputs(config) {
|
|
|
169
170
|
}
|
|
170
171
|
return output;
|
|
171
172
|
}
|
|
172
|
-
function getAssetsDir(config) {
|
|
173
|
-
let { assetsDir } = config.build;
|
|
174
|
-
(0, utils_js_1.assertUsage)(assetsDir, `${assetsDir} cannot be an empty string`);
|
|
175
|
-
assetsDir = assetsDir.split(/\/|\\/).filter(Boolean).join('/');
|
|
176
|
-
return assetsDir;
|
|
177
|
-
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAssetsDir = void 0;
|
|
4
|
+
const utils_js_1 = require("../utils.js");
|
|
5
|
+
function getAssetsDir(config) {
|
|
6
|
+
let { assetsDir } = config.build;
|
|
7
|
+
(0, utils_js_1.assertUsage)(assetsDir, `${assetsDir} cannot be an empty string`);
|
|
8
|
+
assetsDir = assetsDir.split(/\/|\\/).filter(Boolean).join('/');
|
|
9
|
+
return assetsDir;
|
|
10
|
+
}
|
|
11
|
+
exports.getAssetsDir = getAssetsDir;
|
|
@@ -32,6 +32,7 @@ const utils_js_1 = require("../utils.js");
|
|
|
32
32
|
const transpileAndExecuteFile_js_1 = require("../plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js");
|
|
33
33
|
const loggerNotProd_js_1 = require("./loggerNotProd.js");
|
|
34
34
|
const errorWithCodeSnippet_js_1 = require("./loggerNotProd/errorWithCodeSnippet.js");
|
|
35
|
+
const node_util_1 = require("node:util");
|
|
35
36
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
36
37
|
let asyncLocalStorage = null;
|
|
37
38
|
async function installHttpRequestAsyncStore() {
|
|
@@ -61,29 +62,14 @@ async function installHttpRequestAsyncStore() {
|
|
|
61
62
|
return false;
|
|
62
63
|
}
|
|
63
64
|
};
|
|
64
|
-
// Remove once https://github.com/vitejs/vite/pull/13495 is released
|
|
65
|
-
const swallowedErrorMessages = new Set();
|
|
66
|
-
const markErrorMessageAsLogged = (errMsg) => {
|
|
67
|
-
swallowedErrorMessages.add(errMsg);
|
|
68
|
-
};
|
|
69
|
-
const onRequestDone = () => {
|
|
70
|
-
swallowedErrorMessages.forEach((errMsg) => {
|
|
71
|
-
if (!Array.from(loggedErrors).some((err) => String(err).includes(errMsg))) {
|
|
72
|
-
console.error('loggedErrors', loggedErrors);
|
|
73
|
-
console.error('swallowedErrorMessages', swallowedErrorMessages);
|
|
74
|
-
(0, utils_js_1.assert)(false);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
65
|
const store = {
|
|
79
66
|
httpRequestId,
|
|
80
67
|
markErrorAsLogged,
|
|
81
|
-
markErrorMessageAsLogged,
|
|
82
68
|
shouldErrorBeSwallowed,
|
|
83
69
|
errorDebugNoteAlreadyShown: false
|
|
84
70
|
};
|
|
85
71
|
const pageContextReturn = await asyncLocalStorage.run(store, renderPage);
|
|
86
|
-
return { pageContextReturn
|
|
72
|
+
return { pageContextReturn };
|
|
87
73
|
});
|
|
88
74
|
return;
|
|
89
75
|
}
|
|
@@ -109,14 +95,20 @@ function isEquivalent(err1, err2) {
|
|
|
109
95
|
}
|
|
110
96
|
if ((0, errorWithCodeSnippet_js_1.isEquivalentErrorWithCodeSnippet)(err1, err2))
|
|
111
97
|
return true;
|
|
112
|
-
if (
|
|
113
|
-
Object.keys(
|
|
114
|
-
|
|
115
|
-
|
|
98
|
+
if ((0, utils_js_1.unique)([
|
|
99
|
+
// error.message and error.stack aren't enumerable and therefore not listed by Object.keys()
|
|
100
|
+
'message',
|
|
101
|
+
'stack',
|
|
102
|
+
...Object.keys(err1),
|
|
103
|
+
...Object.keys(err2)
|
|
104
|
+
]).every((k) => {
|
|
105
|
+
// isDeepStrictEqual() need to compare error.position wich is an object.
|
|
106
|
+
if ((0, node_util_1.isDeepStrictEqual)(err1[k], err2[k]))
|
|
107
|
+
return true;
|
|
108
|
+
// console.log('diff', k)
|
|
109
|
+
return false;
|
|
110
|
+
})) {
|
|
116
111
|
return true;
|
|
117
112
|
}
|
|
118
113
|
return false;
|
|
119
114
|
}
|
|
120
|
-
function isDefinedAndSame(val1, val2) {
|
|
121
|
-
return val1 && val1 === val2;
|
|
122
|
-
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.errMdx1 = void 0;
|
|
4
|
+
exports.errMdx1 = {
|
|
5
5
|
name: '5:5-5:6',
|
|
6
6
|
message: 'Unexpected closing slash `/` in tag, expected an open tag first',
|
|
7
7
|
reason: 'Unexpected closing slash `/` in tag, expected an open tag first',
|
package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.errMdx2 = void 0;
|
|
4
|
+
exports.errMdx2 = {
|
|
5
|
+
reason: 'Unexpected closing slash `/` in tag, expected an open tag first',
|
|
6
|
+
line: 23,
|
|
7
|
+
column: 450,
|
|
8
|
+
position: {
|
|
9
|
+
start: {
|
|
10
|
+
line: 23,
|
|
11
|
+
column: 450,
|
|
12
|
+
offset: 1967,
|
|
13
|
+
_index: 0,
|
|
14
|
+
_bufferIndex: 444
|
|
15
|
+
},
|
|
16
|
+
end: {
|
|
17
|
+
line: 23,
|
|
18
|
+
column: 451,
|
|
19
|
+
offset: 1968,
|
|
20
|
+
_index: 0,
|
|
21
|
+
_bufferIndex: 445
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
source: 'mdast-util-mdx-jsx',
|
|
25
|
+
ruleId: 'unexpected-closing-slash',
|
|
26
|
+
plugin: '@mdx-js/rollup',
|
|
27
|
+
id: '/home/rom/code/vike/docs/pages/abort/+Page.mdx',
|
|
28
|
+
pluginCode: "import { Link } from '@brillout/docpress'\n" +
|
|
29
|
+
'\n' +
|
|
30
|
+
'By using <Link href="/render" text={<code>throw render()</code>}></Link> or <Link href="/redirect" text={<code>throw redirect()</code>}></Link> you abort the rendering of the current page and render something else instead.\n' +
|
|
31
|
+
'\n' +
|
|
32
|
+
`<h2 id="throw-redirect-vs-throw-render"><code>{'throw redirect()'}</code>{' VS '}<code>{'throw render()'}</code></h2>\n` +
|
|
33
|
+
'\n' +
|
|
34
|
+
'While `throw redirect()` changes the URL, `throw render()` preserves it:\n' +
|
|
35
|
+
" - If a user goes to `/admin` and `throw redirect('/login')` is called, then the user will see the new URL `/login` in the browser's address bar.\n" +
|
|
36
|
+
" - If a user goes to `/admin` and `throw render('/login')` is called, then the user keeps seeing the same URL `/admin` in the browser's address bar.\n" +
|
|
37
|
+
'\n' +
|
|
38
|
+
"In general, we recommend using `throw render('/login')` instead of `throw redirect('/login')` as it preserves the URL and, therefore, the user's intention. We further explain this techniue at <Link href=\"/auth#login-flow\" />.\n" +
|
|
39
|
+
'\n' +
|
|
40
|
+
'\n' +
|
|
41
|
+
`<h2 id="debug">{'Debug'}</h2>\n` +
|
|
42
|
+
'\n' +
|
|
43
|
+
"If `throw redirect()` or `throw render()` doesn't work:\n" +
|
|
44
|
+
" - **Make sure `throw redirect()` / `throw render()` isn't intercepted.** \n" +
|
|
45
|
+
" In developement, check your server logs for the following log. If this log is missing then it means that Vike didn't catch the `throw redirect()` / `throw render()` exception: some other code is intercepting it preventing Vike from catching it.\n" +
|
|
46
|
+
' ```\n' +
|
|
47
|
+
" 10:00:00 AM [vike][request(42)] throw redirect('/some-url') intercepted while\n" +
|
|
48
|
+
' rendering /some-other-url\n' +
|
|
49
|
+
' ```\n' +
|
|
50
|
+
' > Most notably, using `throw redirect()` / `throw render()` inside a UI component usually doesn\'t work because most <Link href="/ui-framework">UI framework</Link> will intercept the execption and thus Vike won\'t be able to catch it. Instead, consider using `throw redirect()` / `throw render()` in a Vike hook such as <Link href="/guard">guard()</Link> or <Link href="/data">data()</Link>, or consider using <Link href="/navigate" />`navigate()`</Link>.\n' +
|
|
51
|
+
' - **Make sure to use `throw redirect()` / `throw render()` within a Vike hook.** \n' +
|
|
52
|
+
" If you use `throw redirect()` / `throw render()` outside of Vike hooks, for example in some server middleware code then Vike won't be able to intercept it.\n" +
|
|
53
|
+
'\n' +
|
|
54
|
+
"If `throw redirect()` doesn't work:\n" +
|
|
55
|
+
' - **Make sure to add `pageContext.httpResponse.headers` to the HTTP response.** \n' +
|
|
56
|
+
' If you\'ve embedded Vike into your server using <Link text={<code>renderPage()</code>} href="/renderPage" />, then insepct whether `pageContext.httpResponse.headers` contains the `Location` header and double check that you\'re correctly adding all the headers defined by `pageContext.httpResponse.headers` to the HTTP response.\n' +
|
|
57
|
+
'\n' +
|
|
58
|
+
'\n' +
|
|
59
|
+
`<h2 id="see-also">{'See also'}</h2>\n` +
|
|
60
|
+
'\n' +
|
|
61
|
+
' - <Link href="/redirect" />\n' +
|
|
62
|
+
' - <Link href="/render" />\n' +
|
|
63
|
+
' - <Link href="/navigate" />\n' +
|
|
64
|
+
'\n' +
|
|
65
|
+
'\n' +
|
|
66
|
+
'export const headings = [{"headingId":"throw-redirect-vs-throw-render","headingLevel":2,"title":"`throw redirect()` VS `throw render()`"}, {"headingId":"debug","headingLevel":2,"title":"Debug"}, {"headingId":"see-also","headingLevel":2,"title":"See also"}];\n',
|
|
67
|
+
loc: {
|
|
68
|
+
file: '/home/rom/code/vike/docs/pages/abort/+Page.mdx',
|
|
69
|
+
start: {
|
|
70
|
+
line: 23,
|
|
71
|
+
column: 450,
|
|
72
|
+
offset: 1967,
|
|
73
|
+
_index: 0,
|
|
74
|
+
_bufferIndex: 444
|
|
75
|
+
},
|
|
76
|
+
end: {
|
|
77
|
+
line: 23,
|
|
78
|
+
column: 451,
|
|
79
|
+
offset: 1968,
|
|
80
|
+
_index: 0,
|
|
81
|
+
_bufferIndex: 445
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
frame: ''
|
|
85
|
+
};
|
|
@@ -9,7 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.clearLogs = exports.logErrorDebugNote = exports.logConfigErrorRecover = exports.logConfigError = exports.logConfigInfo = exports.
|
|
12
|
+
exports.clearLogs = exports.logErrorDebugNote = exports.logConfigErrorRecover = exports.logConfigError = exports.logConfigInfo = exports.logViteError = exports.logViteAny = void 0;
|
|
13
13
|
const abort_js_1 = require("../../../shared/route/abort.js");
|
|
14
14
|
const globalContext_js_1 = require("../../runtime/globalContext.js");
|
|
15
15
|
const loggerRuntime_js_1 = require("../../runtime/renderPage/loggerRuntime.js");
|
|
@@ -56,15 +56,17 @@ function logConfigErrorRecover() {
|
|
|
56
56
|
}
|
|
57
57
|
exports.logConfigErrorRecover = logConfigErrorRecover;
|
|
58
58
|
function logRuntimeError(err,
|
|
59
|
-
|
|
59
|
+
// httpRequestId is `null` when pre-rendering
|
|
60
60
|
httpRequestId) {
|
|
61
|
-
logErr(err, httpRequestId);
|
|
61
|
+
logErr(err, httpRequestId, false);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
63
|
+
function logViteError(err,
|
|
64
|
+
// httpRequestId is `undefined` if development environment doesn't support async stores
|
|
65
|
+
httpRequestId) {
|
|
66
|
+
logErr(err, httpRequestId, true);
|
|
65
67
|
}
|
|
66
|
-
exports.
|
|
67
|
-
function logErr(err, httpRequestId = null) {
|
|
68
|
+
exports.logViteError = logViteError;
|
|
69
|
+
function logErr(err, httpRequestId = null, errorComesFromVite) {
|
|
68
70
|
(0, utils_js_1.warnIfErrorIsNotObject)(err);
|
|
69
71
|
if ((0, abort_js_1.isAbortError)(err) && !(0, isErrorDebug_js_1.isErrorDebug)()) {
|
|
70
72
|
return;
|
|
@@ -103,9 +105,10 @@ function logErr(err, httpRequestId = null) {
|
|
|
103
105
|
(0, log_js_1.logWithVikeTag)(picocolors_1.default.red(`Following error was thrown by the ${hookName}() hook defined at ${hookFilePath}`), 'error', category);
|
|
104
106
|
}
|
|
105
107
|
else if (category) {
|
|
106
|
-
logFallbackErrIntro(category);
|
|
108
|
+
logFallbackErrIntro(category, errorComesFromVite);
|
|
107
109
|
}
|
|
108
110
|
(0, log_js_1.logDirectly)(err, 'error');
|
|
111
|
+
// Needs to be called after logging the error.
|
|
109
112
|
(0, loggerProd_js_1.onRuntimeError)(err);
|
|
110
113
|
}
|
|
111
114
|
function logConfigError(err) {
|
|
@@ -140,12 +143,13 @@ function logConfigError(err) {
|
|
|
140
143
|
return;
|
|
141
144
|
}
|
|
142
145
|
if (category)
|
|
143
|
-
logFallbackErrIntro(category);
|
|
146
|
+
logFallbackErrIntro(category, false);
|
|
144
147
|
(0, log_js_1.logDirectly)(err, 'error');
|
|
145
148
|
}
|
|
146
149
|
exports.logConfigError = logConfigError;
|
|
147
|
-
function logFallbackErrIntro(category) {
|
|
148
|
-
|
|
150
|
+
function logFallbackErrIntro(category, errorComesFromVite) {
|
|
151
|
+
const msg = errorComesFromVite ? 'Transpilation error' : 'An error was thrown';
|
|
152
|
+
(0, log_js_1.logWithVikeTag)(picocolors_1.default.bold(picocolors_1.default.red(`[Error] ${msg}:`)), 'error', category);
|
|
149
153
|
}
|
|
150
154
|
function getConfigCategory() {
|
|
151
155
|
const category = getCategory() ?? 'config';
|
|
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.improveViteLogs = void 0;
|
|
4
4
|
const utils_js_1 = require("../utils.js");
|
|
5
5
|
const loggerNotProd_js_1 = require("./loggerNotProd.js");
|
|
6
|
-
const errorWithCodeSnippet_js_1 = require("./loggerNotProd/errorWithCodeSnippet.js");
|
|
7
6
|
const getHttpRequestAsyncStore_js_1 = require("./getHttpRequestAsyncStore.js");
|
|
8
7
|
const removeSuperfluousViteLog_js_1 = require("./loggerVite/removeSuperfluousViteLog.js");
|
|
9
8
|
const isErrorDebug_js_1 = require("./isErrorDebug.js");
|
|
10
|
-
const loggerProd_js_1 = require("../../runtime/renderPage/loggerProd.js");
|
|
11
9
|
function improveViteLogs(config) {
|
|
12
10
|
intercept('info', config);
|
|
13
11
|
intercept('warn', config);
|
|
@@ -28,29 +26,25 @@ function intercept(logType, config) {
|
|
|
28
26
|
}
|
|
29
27
|
msg = cleanFirstViteLog(msg);
|
|
30
28
|
const store = (0, getHttpRequestAsyncStore_js_1.getHttpRequestAsyncStore)();
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
if (options.error) {
|
|
30
|
+
// Vite does a poor job of handling errors.
|
|
31
|
+
// - It doesn't format error code snippets.
|
|
32
|
+
// - It only shows error.message which means that crucial information such as error.id isn't shown to the user.
|
|
33
|
+
(0, loggerNotProd_js_1.logViteError)(options.error, store?.httpRequestId);
|
|
34
|
+
// We swallow Vite's message: we didn't see it add any value so far.
|
|
35
|
+
// - It can even be confusing, such as the following:
|
|
36
|
+
// ```
|
|
37
|
+
// Error when evaluating SSR module virtual:vike:pageConfigValuesAll:server:/pages/abort: failed to import "/pages/abort/+Page.mdx"
|
|
38
|
+
// ```
|
|
39
|
+
(0, utils_js_1.assert)(!(0, isErrorDebug_js_1.isErrorDebug)());
|
|
33
40
|
return;
|
|
34
41
|
}
|
|
35
|
-
//
|
|
36
|
-
if (msg.startsWith('Transform failed with ') && store && logType === 'error') {
|
|
37
|
-
store.markErrorMessageAsLogged(msg);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (options.error && (0, errorWithCodeSnippet_js_1.isErrorWithCodeSnippet)(options.error)) {
|
|
41
|
-
(0, loggerNotProd_js_1.logViteErrorContainingCodeSnippet)(options.error);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
// Only allow Vite to clear its first log. All other clearing is controlled by vike.
|
|
42
|
+
// Only allow Vite to clear for its first log. All other clearing is controlled by vike.
|
|
45
43
|
if (options.clear)
|
|
46
44
|
(0, loggerNotProd_js_1.clearLogs)({ clearIfFirstLog: true });
|
|
47
|
-
if (options.error)
|
|
48
|
-
store?.markErrorAsLogged(options.error);
|
|
49
45
|
// Vite's default logger preprends the "[vite]" tag if and only if options.timestamp is true
|
|
50
46
|
const prependViteTag = options.timestamp || !!store?.httpRequestId;
|
|
51
47
|
(0, loggerNotProd_js_1.logViteAny)(msg, logType, store?.httpRequestId ?? null, prependViteTag);
|
|
52
|
-
if (options.error)
|
|
53
|
-
(0, loggerProd_js_1.onRuntimeError)(options.error);
|
|
54
48
|
};
|
|
55
49
|
}
|
|
56
50
|
function cleanFirstViteLog(msg) {
|
|
@@ -41,4 +41,4 @@ __exportStar(require("../../utils/assertKeys.js"), exports);
|
|
|
41
41
|
__exportStar(require("../../utils/injectRollupInputs.js"), exports);
|
|
42
42
|
__exportStar(require("../../utils/humanizeTime.js"), exports);
|
|
43
43
|
__exportStar(require("../../utils/pLimit.js"), exports);
|
|
44
|
-
__exportStar(require("../../utils/
|
|
44
|
+
__exportStar(require("../../utils/assertVersion.js"), exports);
|
|
@@ -87,7 +87,7 @@ async function runPrerender(options, manuallyTriggered) {
|
|
|
87
87
|
if (logLevel === 'info') {
|
|
88
88
|
console.log(`${picocolors_1.default.cyan(`vike v${utils_js_1.projectInfo.projectVersion}`)} ${picocolors_1.default.green('pre-rendering HTML...')}`);
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
(0, utils_js_1.handleNodeEnv_prerender)();
|
|
91
91
|
await disableReactStreaming();
|
|
92
92
|
const viteConfig = await (0, vite_1.resolveConfig)(options.viteConfig || {}, 'vike pre-rendering', 'production');
|
|
93
93
|
(0, globalContext_js_1.setGlobalContext_prerender)(viteConfig);
|
|
@@ -743,10 +743,3 @@ function assertIsNotAbort(err, urlOr404) {
|
|
|
743
743
|
(0, utils_js_1.assert)(abortCall);
|
|
744
744
|
(0, utils_js_1.assertUsage)(false, `${picocolors_1.default.cyan(abortCall)} thrown${thrownBy} while pre-rendering ${urlOr404} but ${picocolors_1.default.cyan(abortCaller)} isn't supported for pre-rendered pages`);
|
|
745
745
|
}
|
|
746
|
-
function handleNodeEnv() {
|
|
747
|
-
const assertNodeEnv = () => (0, utils_js_1.assertNodeEnvIsNotDev)('pre-rendering');
|
|
748
|
-
if ((0, utils_js_1.getNodeEnv)())
|
|
749
|
-
assertNodeEnv();
|
|
750
|
-
(0, utils_js_1.setNodeEnvToProduction)();
|
|
751
|
-
assertNodeEnv();
|
|
752
|
-
}
|
|
@@ -85,7 +85,7 @@ async function initGlobalContext(isPrerendering = false, outDir) {
|
|
|
85
85
|
if (globalObject.globalContext)
|
|
86
86
|
return;
|
|
87
87
|
const { viteDevServer, viteConfig } = globalObject;
|
|
88
|
-
|
|
88
|
+
(0, utils_js_1.assertNodeEnv_runtime)(!!viteDevServer);
|
|
89
89
|
const isProduction = !viteDevServer;
|
|
90
90
|
if (!isProduction) {
|
|
91
91
|
(0, utils_js_1.assert)(viteConfig);
|
|
@@ -183,15 +183,3 @@ function assertViteManifest(manifest) {
|
|
|
183
183
|
})
|
|
184
184
|
*/
|
|
185
185
|
}
|
|
186
|
-
function assertNodeEnv(hasViteDevServer) {
|
|
187
|
-
const nodeEnv = (0, utils_js_1.getNodeEnv)();
|
|
188
|
-
if (nodeEnv === null || nodeEnv === 'test')
|
|
189
|
-
return;
|
|
190
|
-
const isDev = (0, utils_js_1.isNodeEnvDev)();
|
|
191
|
-
// Calling Vite's createServer() is enough for hasViteDevServer to be true, even without actually adding Vite's development middleware to the server: https://github.com/vikejs/vike/issues/792#issuecomment-1516830759
|
|
192
|
-
if (hasViteDevServer === isDev)
|
|
193
|
-
return;
|
|
194
|
-
const nodeEnvDesc = (0, utils_js_1.getNodeEnvDesc)();
|
|
195
|
-
// We should change this to be a warning if it blocks users (e.g. if a bad-citizen tool sets a wrong process.env.NODE_ENV value)
|
|
196
|
-
(0, utils_js_1.assertUsage)(false, `Vite's development server was${hasViteDevServer ? '' : "n't"} instantiated while the ${nodeEnvDesc} which is contradictory, see https://vike.dev/NODE_ENV`);
|
|
197
|
-
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getHint = exports.isKnownError = exports.isCjsEsmError = exports.logErrorHint = void 0;
|
|
7
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
8
4
|
const utils_js_1 = require("../utils.js");
|
|
9
5
|
const knownErrors = [
|
|
10
6
|
{
|
|
@@ -40,15 +36,7 @@ function getHint(error) {
|
|
|
40
36
|
}
|
|
41
37
|
const res = isCjsEsmError(error);
|
|
42
38
|
if (res) {
|
|
43
|
-
const
|
|
44
|
-
const hint = [
|
|
45
|
-
'Error could be a CJS/ESM issue, consider ',
|
|
46
|
-
!packageNames || packageNames.length === 0
|
|
47
|
-
? 'using'
|
|
48
|
-
: `adding ${(0, utils_js_1.joinEnglish)(packageNames.map((p) => picocolors_1.default.cyan(p)), 'or')} to`,
|
|
49
|
-
` ${picocolors_1.default.cyan('ssr.noExternal')}`,
|
|
50
|
-
', see https://vike.dev/broken-npm-package'
|
|
51
|
-
].join('');
|
|
39
|
+
const hint = 'The error seems to be a CJS/ESM issue, see https://vike.dev/broken-npm-package';
|
|
52
40
|
return hint;
|
|
53
41
|
}
|
|
54
42
|
return null;
|
|
@@ -81,6 +69,7 @@ function isCjsEsmError(error) {
|
|
|
81
69
|
packageNames.forEach((packageName) => {
|
|
82
70
|
(0, utils_js_1.assert)(!['vite', 'vike'].includes(packageName));
|
|
83
71
|
});
|
|
72
|
+
// We don't use this anymore: we could return `true` instead. Shall we remove returning a list of npm packages?
|
|
84
73
|
return packageNames;
|
|
85
74
|
}
|
|
86
75
|
exports.isCjsEsmError = isCjsEsmError;
|
|
@@ -20,10 +20,14 @@ function logErrorProd(err, _httpRquestId) {
|
|
|
20
20
|
// We ensure we print a string; Cloudflare Workers doesn't seem to properly stringify `Error` objects.
|
|
21
21
|
const errStr = (0, utils_js_1.isObject)(err) && 'stack' in err ? String(err.stack) : String(err);
|
|
22
22
|
console.error(picocolors_1.default.red(errStr));
|
|
23
|
+
// Needs to be called after logging the error.
|
|
23
24
|
onRuntimeError(err);
|
|
24
25
|
}
|
|
25
26
|
exports.logErrorProd = logErrorProd;
|
|
26
|
-
// Every server-side runtime error is expected to go through onRuntimeError()
|
|
27
|
+
// Every server-side runtime error is expected to go through `onRuntimeError()`.
|
|
28
|
+
// - onRuntimeError(err) should always be called after `console.error(err)`.
|
|
29
|
+
// - Because the error hint of logErrorHint(err) should be shown *after* the error.
|
|
30
|
+
// - In principle, any runtime error is (or at least should) be catched by Vike, otherwise Vike couldn't render the error page.
|
|
27
31
|
function onRuntimeError(err) {
|
|
28
32
|
// The more runtime errors we pass to logErrorHint() the better.
|
|
29
33
|
(0, logErrorHint_js_1.logErrorHint)(err);
|
|
@@ -27,8 +27,7 @@ const globalObject = (0, utils_js_1.getGlobalObject)('runtime/renderPage.ts', {
|
|
|
27
27
|
pendingRequestsCount: 0
|
|
28
28
|
});
|
|
29
29
|
let renderPage_wrapper = async (_httpRequestId, ret) => ({
|
|
30
|
-
pageContextReturn: await ret()
|
|
31
|
-
onRequestDone: () => { }
|
|
30
|
+
pageContextReturn: await ret()
|
|
32
31
|
});
|
|
33
32
|
const renderPage_addWrapper = (wrapper) => {
|
|
34
33
|
renderPage_wrapper = wrapper;
|
|
@@ -48,10 +47,9 @@ async function renderPage(pageContextInit) {
|
|
|
48
47
|
const { urlOriginal } = pageContextInit;
|
|
49
48
|
logHttpRequest(urlOriginal, httpRequestId);
|
|
50
49
|
globalObject.pendingRequestsCount++;
|
|
51
|
-
const { pageContextReturn
|
|
50
|
+
const { pageContextReturn } = await renderPage_wrapper(httpRequestId, () => renderPageAndPrepare(pageContextInit, httpRequestId));
|
|
52
51
|
logHttpResponse(urlOriginal, httpRequestId, pageContextReturn);
|
|
53
52
|
globalObject.pendingRequestsCount--;
|
|
54
|
-
onRequestDone();
|
|
55
53
|
(0, utils_js_1.checkType)(pageContextReturn);
|
|
56
54
|
return pageContextReturn;
|
|
57
55
|
}
|
|
@@ -111,7 +111,6 @@ function parseRouteString(routeString) {
|
|
|
111
111
|
}
|
|
112
112
|
exports.parseRouteString = parseRouteString;
|
|
113
113
|
function getUrlFromRouteString(routeString) {
|
|
114
|
-
(0, utils_js_2.assert)(routeString.startsWith('/'));
|
|
115
114
|
if (isStaticRouteString(routeString)) {
|
|
116
115
|
const url = routeString;
|
|
117
116
|
return url;
|