vike 0.4.161-commit-b829fee → 0.4.162-commit-49fe40c
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 +2 -2
- package/dist/cjs/node/plugin/index.js +0 -2
- package/dist/cjs/node/plugin/plugins/buildConfig.js +1 -0
- package/dist/cjs/node/plugin/plugins/config/index.js +2 -7
- package/dist/cjs/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -8
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +1 -18
- package/dist/cjs/node/plugin/plugins/devConfig/index.js +2 -4
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +0 -19
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +8 -8
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getConfigValuesSerialized.js +1 -9
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +3 -0
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +4 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.js +35 -36
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +109 -104
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +36 -32
- package/dist/cjs/node/plugin/utils.js +0 -1
- package/dist/cjs/node/prerender/runPrerender.js +2 -2
- package/dist/cjs/node/prerender/utils.js +1 -1
- package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +1 -0
- package/dist/cjs/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +2 -3
- package/dist/cjs/node/runtime/utils.js +1 -2
- package/dist/cjs/node/shared/virtual-files/virtualFileImportUserCode.js +1 -0
- package/dist/cjs/shared/hooks/getHook.js +1 -1
- package/dist/cjs/shared/page-configs/helpers/getConfigValue.js +1 -0
- package/dist/cjs/shared/page-configs/serialize/parseConfigValuesImported.js +1 -1
- package/dist/cjs/shared/route/abort.js +1 -0
- package/dist/cjs/shared/route/resolvePrecedence.js +1 -0
- package/dist/cjs/utils/{nodeEnv.js → assertNodeEnv.js} +3 -0
- package/dist/cjs/utils/formatHintLog.js +1 -0
- package/dist/cjs/utils/hasProp.js +1 -0
- package/dist/cjs/utils/isScriptFile.js +15 -4
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/__internal/index.js +1 -1
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +20 -14
- package/dist/esm/client/shared/getPageContextProxyForUser.js +19 -2
- package/dist/esm/client/shared/loadUserFilesClientSide.js +1 -0
- package/dist/esm/node/plugin/index.js +0 -2
- package/dist/esm/node/plugin/plugins/buildConfig.js +1 -0
- package/dist/esm/node/plugin/plugins/config/index.js +2 -7
- package/dist/esm/node/plugin/plugins/devConfig/determineFsAllowList.d.ts +1 -2
- package/dist/esm/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -8
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.d.ts +1 -2
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +2 -19
- package/dist/esm/node/plugin/plugins/devConfig/index.js +2 -4
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +0 -19
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +8 -8
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getConfigValuesSerialized.js +1 -9
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +3 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +4 -4
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.d.ts +1 -13
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.js +35 -36
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +111 -106
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +2 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +36 -32
- package/dist/esm/node/plugin/utils.d.ts +0 -1
- package/dist/esm/node/plugin/utils.js +0 -1
- package/dist/esm/node/prerender/runPrerender.d.ts +3 -3
- package/dist/esm/node/prerender/runPrerender.js +2 -2
- package/dist/esm/node/prerender/utils.d.ts +1 -1
- package/dist/esm/node/prerender/utils.js +1 -1
- package/dist/esm/node/runtime/html/serializePageContextClientSide.js +1 -0
- package/dist/esm/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +2 -3
- package/dist/esm/node/runtime/utils.d.ts +1 -2
- package/dist/esm/node/runtime/utils.js +1 -2
- package/dist/esm/node/shared/virtual-files/virtualFileImportUserCode.js +1 -0
- package/dist/esm/shared/ConfigVike.d.ts +0 -27
- package/dist/esm/shared/hooks/getHook.js +2 -2
- package/dist/esm/shared/page-configs/Config.d.ts +5 -0
- package/dist/esm/shared/page-configs/PageConfig.d.ts +1 -1
- package/dist/esm/shared/page-configs/helpers/getConfigValue.js +1 -0
- package/dist/esm/shared/page-configs/serialize/parseConfigValuesImported.js +1 -1
- package/dist/esm/shared/route/abort.js +1 -0
- package/dist/esm/shared/route/resolvePrecedence.js +1 -0
- package/dist/esm/utils/{nodeEnv.js → assertNodeEnv.js} +3 -0
- package/dist/esm/utils/debug.d.ts +1 -1
- package/dist/esm/utils/formatHintLog.js +1 -0
- package/dist/esm/utils/hasProp.js +1 -0
- package/dist/esm/utils/isScriptFile.d.ts +3 -1
- package/dist/esm/utils/isScriptFile.js +14 -3
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +3 -2
- package/dist/cjs/node/plugin/plugins/config/findConfigVikeFromStemPackages.js +0 -27
- package/dist/cjs/node/plugin/plugins/config/resolveExtensions.js +0 -107
- package/dist/cjs/node/plugin/plugins/config/stemUtils.js +0 -85
- package/dist/cjs/node/plugin/plugins/extensionsAssets.js +0 -101
- package/dist/cjs/utils/getDependencyPackageJson.js +0 -91
- package/dist/cjs/utils/isStemPackageName.js +0 -14
- package/dist/esm/node/plugin/plugins/config/findConfigVikeFromStemPackages.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/config/findConfigVikeFromStemPackages.js +0 -24
- package/dist/esm/node/plugin/plugins/config/resolveExtensions.d.ts +0 -4
- package/dist/esm/node/plugin/plugins/config/resolveExtensions.js +0 -101
- package/dist/esm/node/plugin/plugins/config/stemUtils.d.ts +0 -8
- package/dist/esm/node/plugin/plugins/config/stemUtils.js +0 -79
- package/dist/esm/node/plugin/plugins/extensionsAssets.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/extensionsAssets.js +0 -95
- package/dist/esm/utils/getDependencyPackageJson.d.ts +0 -6
- package/dist/esm/utils/getDependencyPackageJson.js +0 -85
- package/dist/esm/utils/isStemPackageName.d.ts +0 -1
- package/dist/esm/utils/isStemPackageName.js +0 -10
- /package/dist/esm/utils/{nodeEnv.d.ts → assertNodeEnv.d.ts} +0 -0
|
@@ -13,62 +13,55 @@ const utils_js_1 = require("../../../../utils.js");
|
|
|
13
13
|
const transformFileImports_js_1 = require("./transformFileImports.js");
|
|
14
14
|
const getVikeConfig_js_1 = require("../getVikeConfig.js");
|
|
15
15
|
require("source-map-support/register.js");
|
|
16
|
-
const getConfigFileExport_js_1 = require("../getConfigFileExport.js");
|
|
17
16
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
const debug = (0, utils_js_1.createDebugger)('vike:pointer-imports');
|
|
18
|
+
async function transpileAndExecuteFile(filePath, userRootDir, isConfigFile) {
|
|
19
|
+
const { filePathAbsoluteFilesystem } = filePath;
|
|
20
|
+
const fileExtension = getFileExtension(filePathAbsoluteFilesystem);
|
|
21
|
+
const filePathToShowToUser2 = getFilePathToShowToUser2(filePath);
|
|
22
|
+
(0, utils_js_1.assertUsage)((0, utils_js_1.isJavaScriptFile)(filePathAbsoluteFilesystem), `${filePathToShowToUser2} has file extension .${fileExtension} but a config file can only be a JavaScript/TypeScript file`);
|
|
23
|
+
const isHeader = isHeaderFile(filePathAbsoluteFilesystem);
|
|
24
|
+
if (isHeader) {
|
|
25
|
+
(0, utils_js_1.assertWarning)(false, `${picocolors_1.default.cyan('.h.js')} files are deprecated: simply renaming ${filePathToShowToUser2} to ${removeHeaderFileExtension(filePathToShowToUser2)} is usually enough, although you may occasionally need to use ${picocolors_1.default.cyan("with { type: 'pointer' }")} as explained at https://vike.dev/config#pointer-imports`, { onlyOnce: true });
|
|
26
|
+
}
|
|
27
|
+
if (isConfigFile === 'is-extension-config' && !isHeader && fileExtension.endsWith('js')) {
|
|
28
|
+
// This doesn't track dependencies => we should never use this for user land configs
|
|
29
|
+
const fileExports = await executeFile(filePathAbsoluteFilesystem, filePath);
|
|
26
30
|
return { fileExports };
|
|
27
31
|
}
|
|
28
32
|
else {
|
|
29
|
-
const
|
|
30
|
-
const
|
|
33
|
+
const transformImports = isConfigFile && (isHeader ? 'all' : true);
|
|
34
|
+
const code = await transpileFile(filePath, transformImports, userRootDir);
|
|
35
|
+
const fileExports = await executeTranspiledFile(filePath, code);
|
|
31
36
|
return { fileExports };
|
|
32
37
|
}
|
|
33
38
|
}
|
|
34
39
|
exports.transpileAndExecuteFile = transpileAndExecuteFile;
|
|
35
40
|
async function transpileFile(filePath, transformImports, userRootDir) {
|
|
36
|
-
const { filePathAbsoluteFilesystem } = filePath;
|
|
37
41
|
const filePathToShowToUser2 = getFilePathToShowToUser2(filePath);
|
|
42
|
+
const { filePathAbsoluteFilesystem } = filePath;
|
|
38
43
|
(0, utils_js_1.assertPosixPath)(filePathAbsoluteFilesystem);
|
|
39
44
|
getVikeConfig_js_1.vikeConfigDependencies.add(filePathAbsoluteFilesystem);
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
if (debug.isEnabled)
|
|
46
|
+
debug('transpile', filePathToShowToUser2);
|
|
47
|
+
let { code, pointerImports } = await transpileWithEsbuild(filePath, userRootDir, transformImports);
|
|
48
|
+
if (debug.isEnabled)
|
|
49
|
+
debug(`code, post esbuild (${filePathToShowToUser2})`, code);
|
|
50
|
+
let isImportTransformed = false;
|
|
42
51
|
if (transformImports) {
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
code =
|
|
46
|
-
|
|
52
|
+
const codeMod = (0, transformFileImports_js_1.transformFileImports)(code, filePathToShowToUser2, pointerImports);
|
|
53
|
+
if (codeMod) {
|
|
54
|
+
code = codeMod;
|
|
55
|
+
isImportTransformed = true;
|
|
56
|
+
if (debug.isEnabled)
|
|
57
|
+
debug(`code, post transformImports() (${filePathToShowToUser2})`, code);
|
|
47
58
|
}
|
|
48
59
|
}
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
(
|
|
52
|
-
}
|
|
60
|
+
if (!isImportTransformed) {
|
|
61
|
+
if (debug.isEnabled)
|
|
62
|
+
debug(`code, no transformImports() (${filePathToShowToUser2})`);
|
|
53
63
|
}
|
|
54
|
-
return
|
|
55
|
-
}
|
|
56
|
-
function transformFileImports_(codeOriginal, filePath) {
|
|
57
|
-
const { filePathAbsoluteFilesystem } = filePath;
|
|
58
|
-
const filePathToShowToUser2 = getFilePathToShowToUser2(filePath);
|
|
59
|
-
// Replace import statements with import strings
|
|
60
|
-
const res = (0, transformFileImports_js_1.transformFileImports)(codeOriginal, filePathToShowToUser2);
|
|
61
|
-
if (res.noTransformation) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
const { code, fileImportsTransformed } = res;
|
|
65
|
-
if (!isHeaderFile(filePathAbsoluteFilesystem)) {
|
|
66
|
-
const filePathCorrect = appendHeaderFileExtension(filePathToShowToUser2);
|
|
67
|
-
(0, utils_js_1.assertWarning)(false, `Rename ${filePathToShowToUser2} to ${filePathCorrect}, see https://vike.dev/header-file`, {
|
|
68
|
-
onlyOnce: true
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return { code, fileImportsTransformed };
|
|
64
|
+
return code;
|
|
72
65
|
}
|
|
73
66
|
async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
74
67
|
const entryFilePath = filePath.filePathAbsoluteFilesystem;
|
|
@@ -91,14 +84,63 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
91
84
|
// Esbuild still sometimes removes unused imports because of TypeScript: https://github.com/evanw/esbuild/issues/3034
|
|
92
85
|
treeShaking: false,
|
|
93
86
|
minify: false,
|
|
94
|
-
metafile:
|
|
95
|
-
|
|
96
|
-
bundle: !transformImports
|
|
87
|
+
metafile: transformImports !== 'all',
|
|
88
|
+
bundle: transformImports !== 'all'
|
|
97
89
|
};
|
|
98
|
-
|
|
99
|
-
if (
|
|
90
|
+
let pointerImports;
|
|
91
|
+
if (transformImports === 'all') {
|
|
92
|
+
pointerImports = 'all';
|
|
100
93
|
options.packages = 'external';
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const pointerImports_ = (pointerImports = {});
|
|
101
97
|
options.plugins = [
|
|
98
|
+
// Determine what import should be externalized (and then transformed to a pointer/fake import)
|
|
99
|
+
{
|
|
100
|
+
name: 'vike:externalize-heuristic',
|
|
101
|
+
setup(build) {
|
|
102
|
+
// https://github.com/evanw/esbuild/issues/3095#issuecomment-1546916366
|
|
103
|
+
const useEsbuildResolver = 'useEsbuildResolver';
|
|
104
|
+
// https://github.com/brillout/esbuild-playground
|
|
105
|
+
build.onResolve({ filter: /.*/ }, async (args) => {
|
|
106
|
+
if (args.kind !== 'import-statement')
|
|
107
|
+
return;
|
|
108
|
+
if (args.pluginData?.[useEsbuildResolver])
|
|
109
|
+
return;
|
|
110
|
+
const isImportAbsolute = !args.path.startsWith('.');
|
|
111
|
+
const { path, ...opts } = args;
|
|
112
|
+
opts.pluginData = { [useEsbuildResolver]: true };
|
|
113
|
+
const resolved = await build.resolve(path, opts);
|
|
114
|
+
// vike-{react,vue,solid} follow the convention that their config export resolves to a file named +config.js
|
|
115
|
+
// - This is temporary, see comment below.
|
|
116
|
+
const isVikeExtensionConfigImport = resolved.path.endsWith('+config.js');
|
|
117
|
+
const isPointerImport =
|
|
118
|
+
// .jsx, .vue, .svg, ... => obviously not config code
|
|
119
|
+
!(0, utils_js_1.isJavaScriptFile)(resolved.path) ||
|
|
120
|
+
// Import of a Vike extension config => make it a pointer import because we want to show nice error messages (that can display whether a configas been set by the user or by a Vike extension).
|
|
121
|
+
// - We should have Node.js directly load vike-{react,vue,solid} while enforcing Vike extensions to set 'name' in their +config.js file.
|
|
122
|
+
// - vike@0.4.162 already started soft-requiring Vike extensions to set the name config
|
|
123
|
+
isVikeExtensionConfigImport ||
|
|
124
|
+
// Cannot be resolved by esbuild => take a leap of faith and make it a pointer import.
|
|
125
|
+
// - For example if esbuild cannot resolve a path alias while Vite can.
|
|
126
|
+
// - When tsconfig.js#compilerOptions.paths is set, then esbuild is able to resolve the path alias.
|
|
127
|
+
resolved.errors.length > 0;
|
|
128
|
+
pointerImports_[args.path] = isPointerImport;
|
|
129
|
+
const isExternal = isPointerImport ||
|
|
130
|
+
// npm package imports that aren't pointer imports (e.g. Vite plugin import)
|
|
131
|
+
isImportAbsolute;
|
|
132
|
+
if (debug.isEnabled)
|
|
133
|
+
debug('onResolved()', { args, resolved, isPointerImport, isExternal });
|
|
134
|
+
if (isExternal) {
|
|
135
|
+
return { external: true, path: args.path };
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return resolved;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
// Track dependencies
|
|
102
144
|
{
|
|
103
145
|
name: 'vike:dependency-tracker',
|
|
104
146
|
setup(b) {
|
|
@@ -131,7 +173,7 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
131
173
|
throw err;
|
|
132
174
|
}
|
|
133
175
|
// Track dependencies
|
|
134
|
-
if (
|
|
176
|
+
if (transformImports !== 'all') {
|
|
135
177
|
(0, utils_js_1.assert)(result.metafile);
|
|
136
178
|
Object.keys(result.metafile.inputs).forEach((filePathRelative) => {
|
|
137
179
|
filePathRelative = (0, utils_js_1.toPosixPath)(filePathRelative);
|
|
@@ -142,10 +184,10 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
142
184
|
}
|
|
143
185
|
const code = result.outputFiles[0].text;
|
|
144
186
|
(0, utils_js_1.assert)(typeof code === 'string');
|
|
145
|
-
return code;
|
|
187
|
+
return { code, pointerImports };
|
|
146
188
|
}
|
|
147
|
-
async function executeTranspiledFile(filePath, code
|
|
148
|
-
const { filePathAbsoluteFilesystem
|
|
189
|
+
async function executeTranspiledFile(filePath, code) {
|
|
190
|
+
const { filePathAbsoluteFilesystem } = filePath;
|
|
149
191
|
// Alternative to using a temporary file: https://github.com/vitejs/vite/pull/13269
|
|
150
192
|
// - But seems to break source maps, so I don't think it's worth it
|
|
151
193
|
const filePathTmp = getFilePathTmp(filePathAbsoluteFilesystem);
|
|
@@ -158,11 +200,6 @@ async function executeTranspiledFile(filePath, code, fileImportsTransformed) {
|
|
|
158
200
|
finally {
|
|
159
201
|
clean();
|
|
160
202
|
}
|
|
161
|
-
if (fileImportsTransformed) {
|
|
162
|
-
(0, utils_js_1.assert)(filePathRelativeToUserRootDir !== undefined);
|
|
163
|
-
const filePathToShowToUser2 = getFilePathToShowToUser2(filePath);
|
|
164
|
-
assertImportsAreReExported(fileImportsTransformed, fileExports, filePathToShowToUser2);
|
|
165
|
-
}
|
|
166
203
|
return fileExports;
|
|
167
204
|
}
|
|
168
205
|
async function executeFile(filePathToExecuteAbsoluteFilesystem, filePathSourceFile) {
|
|
@@ -228,59 +265,27 @@ function isTmpFile(filePath) {
|
|
|
228
265
|
return fileName.startsWith(tmpPrefix);
|
|
229
266
|
}
|
|
230
267
|
exports.isTmpFile = isTmpFile;
|
|
231
|
-
function assertImportsAreReExported(fileImportsTransformed, fileExports, filePathToShowToUser2) {
|
|
232
|
-
const fileExport = (0, getConfigFileExport_js_1.getConfigFileExport)(fileExports, filePathToShowToUser2);
|
|
233
|
-
const exportedStrings = getExportedStrings(fileExport);
|
|
234
|
-
Object.values(exportedStrings).forEach((exportVal) => {
|
|
235
|
-
if (typeof exportVal !== 'string')
|
|
236
|
-
return;
|
|
237
|
-
if (!(0, transformFileImports_js_1.isImportData)(exportVal))
|
|
238
|
-
return;
|
|
239
|
-
const importString = exportVal;
|
|
240
|
-
fileImportsTransformed.forEach((fileImport) => {
|
|
241
|
-
if (fileImport.importString === importString) {
|
|
242
|
-
fileImport.isReExported = true;
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
const fileImportsTransformedUnused = fileImportsTransformed.filter((fi) => !fi.isReExported);
|
|
247
|
-
if (fileImportsTransformedUnused.length === 0)
|
|
248
|
-
return;
|
|
249
|
-
const importStatements = (0, utils_js_1.unique)(fileImportsTransformedUnused.map((fi) => fi.importStatementCode));
|
|
250
|
-
const importNamesUnused = fileImportsTransformedUnused.map((fi) => picocolors_1.default.cyan(fi.importLocalName)).join(', ');
|
|
251
|
-
const singular = fileImportsTransformedUnused.length === 1;
|
|
252
|
-
(0, utils_js_1.assertWarning)(fileImportsTransformedUnused.length === 0, [
|
|
253
|
-
`${filePathToShowToUser2} imports the following:`,
|
|
254
|
-
...importStatements.map((s) => picocolors_1.default.cyan(` ${s}`)),
|
|
255
|
-
`But the import${singular ? '' : 's'} ${importNamesUnused} ${singular ? "isn't" : "aren't"} re-exported at ${picocolors_1.default.cyan('export default { ... }')} and therefore ${singular ? 'has' : 'have'} no effect, see explanation at https://vike.dev/header-file`
|
|
256
|
-
].join('\n'), { onlyOnce: true });
|
|
257
|
-
}
|
|
258
|
-
function getExportedStrings(obj) {
|
|
259
|
-
const exportedStrings = [];
|
|
260
|
-
Object.values(obj).forEach((val) => {
|
|
261
|
-
if (typeof val === 'string') {
|
|
262
|
-
exportedStrings.push(val);
|
|
263
|
-
}
|
|
264
|
-
else if (Array.isArray(val)) {
|
|
265
|
-
val.forEach((v) => {
|
|
266
|
-
if (typeof v === 'string') {
|
|
267
|
-
exportedStrings.push(v);
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
return exportedStrings;
|
|
273
|
-
}
|
|
274
268
|
function isHeaderFile(filePath) {
|
|
275
269
|
(0, utils_js_1.assertPosixPath)(filePath);
|
|
276
|
-
const
|
|
277
|
-
return
|
|
270
|
+
const fileExtensions = getFileExtensions(filePath);
|
|
271
|
+
return fileExtensions.includes('h');
|
|
278
272
|
}
|
|
279
|
-
function
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
273
|
+
function getFileExtensions(filePath) {
|
|
274
|
+
const fileExtensions = path_1.default.posix.basename(filePath).split('.').slice(1);
|
|
275
|
+
return fileExtensions;
|
|
276
|
+
}
|
|
277
|
+
function getFileExtension(filePath) {
|
|
278
|
+
const fileExtensions = path_1.default.posix.basename(filePath).split('.').slice(1);
|
|
279
|
+
return fileExtensions.pop();
|
|
280
|
+
}
|
|
281
|
+
function removeHeaderFileExtension(filePath) {
|
|
282
|
+
(0, utils_js_1.assertPosixPath)(filePath);
|
|
283
|
+
const fileName = path_1.default.posix.basename(filePath);
|
|
284
|
+
const fileNameParts = fileName.split('.');
|
|
285
|
+
const fileNamePartsMod = fileNameParts.filter((p) => p !== 'h');
|
|
286
|
+
(0, utils_js_1.assert)(fileNamePartsMod.length < fileNameParts.length);
|
|
287
|
+
const fileNameMod = fileNamePartsMod.join('.');
|
|
288
|
+
return path_1.default.posix.join(path_1.default.posix.dirname(filePath), fileNameMod);
|
|
284
289
|
}
|
|
285
290
|
// Needed for the npm package 'source-map-support'. The Error.prepareStackTrace() hook of 'source-map-support' needs to be called before the file containing the source map is removed. The clean() call above removes the transpiled file from disk but it contains the inline source map.
|
|
286
291
|
function triggerPrepareStackTrace(err) {
|
|
@@ -15,7 +15,6 @@ const loggerNotProd_js_1 = require("../../../shared/loggerNotProd.js");
|
|
|
15
15
|
const removeSuperfluousViteLog_js_1 = require("../../../shared/loggerVite/removeSuperfluousViteLog.js");
|
|
16
16
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
17
17
|
const helpers_js_1 = require("../../../../../shared/page-configs/helpers.js");
|
|
18
|
-
const getConfigVike_js_1 = require("../../../../shared/getConfigVike.js");
|
|
19
18
|
const getConfigValuesSerialized_js_1 = require("./getConfigValuesSerialized.js");
|
|
20
19
|
const crawlPlusFiles_js_1 = require("./getVikeConfig/crawlPlusFiles.js");
|
|
21
20
|
const getConfigFileExport_js_1 = require("./getConfigFileExport.js");
|
|
@@ -28,10 +27,10 @@ let wasConfigInvalid = null;
|
|
|
28
27
|
let vikeConfigPromise = null;
|
|
29
28
|
const vikeConfigDependencies = new Set();
|
|
30
29
|
exports.vikeConfigDependencies = vikeConfigDependencies;
|
|
31
|
-
function reloadVikeConfig(userRootDir, outDirRoot
|
|
30
|
+
function reloadVikeConfig(userRootDir, outDirRoot) {
|
|
32
31
|
vikeConfigDependencies.clear();
|
|
33
32
|
(0, resolveImportPath_js_1.clearFilesEnvMap)();
|
|
34
|
-
vikeConfigPromise = loadVikeConfig_withErrorHandling(userRootDir, outDirRoot, true,
|
|
33
|
+
vikeConfigPromise = loadVikeConfig_withErrorHandling(userRootDir, outDirRoot, true, true);
|
|
35
34
|
handleReloadSideEffects();
|
|
36
35
|
}
|
|
37
36
|
exports.reloadVikeConfig = reloadVikeConfig;
|
|
@@ -66,11 +65,11 @@ async function handleReloadSideEffects() {
|
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
|
-
async function getVikeConfig(config, isDev, tolerateInvalidConfig = false
|
|
68
|
+
async function getVikeConfig(config, isDev, tolerateInvalidConfig = false) {
|
|
70
69
|
const { outDirRoot } = (0, utils_js_1.getOutDirs)(config);
|
|
71
70
|
const userRootDir = config.root;
|
|
72
71
|
if (!vikeConfigPromise) {
|
|
73
|
-
vikeConfigPromise = loadVikeConfig_withErrorHandling(userRootDir, outDirRoot, isDev,
|
|
72
|
+
vikeConfigPromise = loadVikeConfig_withErrorHandling(userRootDir, outDirRoot, isDev, tolerateInvalidConfig);
|
|
74
73
|
}
|
|
75
74
|
return await vikeConfigPromise;
|
|
76
75
|
}
|
|
@@ -82,8 +81,8 @@ async function isV1Design(config, isDev) {
|
|
|
82
81
|
return isV1Design;
|
|
83
82
|
}
|
|
84
83
|
exports.isV1Design = isV1Design;
|
|
85
|
-
async function loadInterfaceFiles(userRootDir, outDirRoot, isDev
|
|
86
|
-
const plusFiles = await findPlusFiles(userRootDir, outDirRoot, isDev
|
|
84
|
+
async function loadInterfaceFiles(userRootDir, outDirRoot, isDev) {
|
|
85
|
+
const plusFiles = await findPlusFiles(userRootDir, outDirRoot, isDev);
|
|
87
86
|
const configFiles = [];
|
|
88
87
|
const valueFiles = [];
|
|
89
88
|
plusFiles.forEach((f) => {
|
|
@@ -109,14 +108,14 @@ async function loadInterfaceFiles(userRootDir, outDirRoot, isDev, extensions) {
|
|
|
109
108
|
extendsConfigs.forEach((extendsConfig) => {
|
|
110
109
|
/* We purposely use the same locationId because the Vike extension's config should only apply to where it's being extended from, for example:
|
|
111
110
|
```js
|
|
112
|
-
// /pages/admin/+config.
|
|
111
|
+
// /pages/admin/+config.js
|
|
113
112
|
|
|
114
113
|
import vikeVue from 'vike-vue/config'
|
|
115
114
|
// Should only apply to /pages/admin/**
|
|
116
115
|
export default { extends: [vikeVue] }
|
|
117
116
|
```
|
|
118
117
|
```js
|
|
119
|
-
// /pages/marketing/+config.
|
|
118
|
+
// /pages/marketing/+config.js
|
|
120
119
|
|
|
121
120
|
import vikeReact from 'vike-react/config'
|
|
122
121
|
// Should only apply to /pages/marketing/**
|
|
@@ -124,6 +123,28 @@ async function loadInterfaceFiles(userRootDir, outDirRoot, isDev, extensions) {
|
|
|
124
123
|
```
|
|
125
124
|
*/
|
|
126
125
|
const interfaceFile = getInterfaceFileFromConfigFile(extendsConfig, true, locationId);
|
|
126
|
+
{
|
|
127
|
+
const alreadyMigrated = [
|
|
128
|
+
'vike-react',
|
|
129
|
+
'vike-react-query',
|
|
130
|
+
'vike-react-zustand',
|
|
131
|
+
'vike-vue',
|
|
132
|
+
'vike-pinia',
|
|
133
|
+
'vike-solid'
|
|
134
|
+
];
|
|
135
|
+
const extensionName = extendsConfig.filePath.importPathAbsolute.split('/')[0];
|
|
136
|
+
const warnMsg = alreadyMigrated.includes(extensionName)
|
|
137
|
+
? `You're using a deprecated version of the Vike extension ${extensionName}, update ${extensionName} to its latest version.`
|
|
138
|
+
: `The config of the Vike extension ${extensionName} should set a ${picocolors_1.default.cyan('name')} value`;
|
|
139
|
+
const isNameDefined = interfaceFile.fileExportsByConfigName.name?.configValue;
|
|
140
|
+
if (alreadyMigrated) {
|
|
141
|
+
// Eventually always make it a assertUsage()
|
|
142
|
+
(0, utils_js_1.assertWarning)(isNameDefined, warnMsg, { onlyOnce: true });
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
(0, utils_js_1.assertUsage)(isNameDefined, warnMsg);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
127
148
|
interfaceFilesByLocationId[locationId].push(interfaceFile);
|
|
128
149
|
});
|
|
129
150
|
}),
|
|
@@ -191,12 +212,12 @@ function assertAllConfigsAreKnown(interfaceFilesByLocationId) {
|
|
|
191
212
|
});
|
|
192
213
|
});
|
|
193
214
|
}
|
|
194
|
-
async function loadVikeConfig_withErrorHandling(userRootDir, outDirRoot, isDev,
|
|
215
|
+
async function loadVikeConfig_withErrorHandling(userRootDir, outDirRoot, isDev, tolerateInvalidConfig) {
|
|
195
216
|
let hasError = false;
|
|
196
217
|
let ret;
|
|
197
218
|
let err;
|
|
198
219
|
try {
|
|
199
|
-
ret = await loadVikeConfig(userRootDir, outDirRoot, isDev
|
|
220
|
+
ret = await loadVikeConfig(userRootDir, outDirRoot, isDev);
|
|
200
221
|
}
|
|
201
222
|
catch (err_) {
|
|
202
223
|
hasError = true;
|
|
@@ -232,8 +253,8 @@ async function loadVikeConfig_withErrorHandling(userRootDir, outDirRoot, isDev,
|
|
|
232
253
|
}
|
|
233
254
|
}
|
|
234
255
|
}
|
|
235
|
-
async function loadVikeConfig(userRootDir, outDirRoot, isDev
|
|
236
|
-
const interfaceFilesByLocationId = await loadInterfaceFiles(userRootDir, outDirRoot, isDev
|
|
256
|
+
async function loadVikeConfig(userRootDir, outDirRoot, isDev) {
|
|
257
|
+
const interfaceFilesByLocationId = await loadInterfaceFiles(userRootDir, outDirRoot, isDev);
|
|
237
258
|
const importedFilesLoaded = {};
|
|
238
259
|
const { globalVikeConfig, pageConfigGlobal } = await getGlobalConfigs(interfaceFilesByLocationId, userRootDir, importedFilesLoaded);
|
|
239
260
|
const pageConfigs = await Promise.all((0, utils_js_1.objectEntries)(interfaceFilesByLocationId)
|
|
@@ -408,7 +429,7 @@ async function resolveConfigValueSources(configName, configDef, interfaceFilesRe
|
|
|
408
429
|
// Make this value:
|
|
409
430
|
// /pages/some-page/+{configName}.js > `export default`
|
|
410
431
|
// override that value:
|
|
411
|
-
// /pages/some-page/+config.
|
|
432
|
+
// /pages/some-page/+config.js > `export default { someConfig }`
|
|
412
433
|
const interfaceFileWinner = interfaceValueFile ?? interfaceConfigFile;
|
|
413
434
|
if (interfaceFileWinner) {
|
|
414
435
|
const interfaceFilesOverriden = [...interfaceValueFiles, ...interfaceConfigFiles].filter((f) => f !== interfaceFileWinner);
|
|
@@ -716,26 +737,9 @@ function getComputed(configValueSources, configDefinitions) {
|
|
|
716
737
|
});
|
|
717
738
|
return configValuesComputed;
|
|
718
739
|
}
|
|
719
|
-
async function findPlusFiles(userRootDir, outDirRoot, isDev
|
|
740
|
+
async function findPlusFiles(userRootDir, outDirRoot, isDev) {
|
|
720
741
|
const files = await (0, crawlPlusFiles_js_1.crawlPlusFiles)(userRootDir, outDirRoot, isDev);
|
|
721
742
|
const plusFiles = files.map(({ filePathRelativeToUserRootDir }) => (0, resolveFilePath_js_1.resolveFilePathRelativeToUserRootDir)(filePathRelativeToUserRootDir, userRootDir));
|
|
722
|
-
// TODO/v1-release: remove
|
|
723
|
-
extensions.forEach((extension) => {
|
|
724
|
-
extension.pageConfigsDistFiles?.forEach((pageConfigDistFile) => {
|
|
725
|
-
if (!pageConfigDistFile.importPath.includes('+'))
|
|
726
|
-
return;
|
|
727
|
-
(0, utils_js_1.assert)(pageConfigDistFile.importPath.includes('+'));
|
|
728
|
-
(0, utils_js_1.assert)(path_1.default.posix.basename(pageConfigDistFile.importPath).startsWith('+'));
|
|
729
|
-
const { importPath, filePath } = pageConfigDistFile;
|
|
730
|
-
plusFiles.push({
|
|
731
|
-
filePathRelativeToUserRootDir: null,
|
|
732
|
-
filePathAbsoluteVite: importPath,
|
|
733
|
-
filePathAbsoluteFilesystem: filePath,
|
|
734
|
-
filePathToShowToUser: importPath,
|
|
735
|
-
importPathAbsolute: importPath
|
|
736
|
-
});
|
|
737
|
-
});
|
|
738
|
-
});
|
|
739
743
|
return plusFiles;
|
|
740
744
|
}
|
|
741
745
|
function getConfigName(filePath) {
|
|
@@ -23,7 +23,6 @@ __exportStar(require("../runtime/utils.js"), exports);
|
|
|
23
23
|
// Utils only needed by `plugin/*`
|
|
24
24
|
__exportStar(require("../../utils/viteIsSSR.js"), exports);
|
|
25
25
|
__exportStar(require("../../utils/getFilePathAbsolute.js"), exports);
|
|
26
|
-
__exportStar(require("../../utils/getDependencyPackageJson.js"), exports);
|
|
27
26
|
__exportStar(require("../../utils/requireResolve.js"), exports);
|
|
28
27
|
__exportStar(require("../../utils/arrayIncludes.js"), exports);
|
|
29
28
|
__exportStar(require("../../utils/isDev.js"), exports);
|
|
@@ -558,7 +558,7 @@ function warnMissingPages(prerenderedPageContexts, doNotPrerenderList, renderCon
|
|
|
558
558
|
.filter((pageId) => !(0, error_page_js_1.isErrorPage)(pageId, renderContext.pageConfigs))
|
|
559
559
|
.forEach((pageId) => {
|
|
560
560
|
const pageAt = isV1 ? pageId : `\`${pageId}.page.*\``;
|
|
561
|
-
(0, utils_js_1.assertWarning)(partial, `Cannot pre-render page ${pageAt} because it has a non-static route, while no ${hookName}() hook returned any URL matching the page's route. You need to use a ${hookName}() hook (https://vike.dev/${hookName}) providing a list of URLs for ${pageAt} that should be pre-rendered. If you don't want to pre-render ${pageAt} then use the option prerender.partial (https://vike.dev/prerender
|
|
561
|
+
(0, utils_js_1.assertWarning)(partial, `Cannot pre-render page ${pageAt} because it has a non-static route, while no ${hookName}() hook returned any URL matching the page's route. You need to use a ${hookName}() hook (https://vike.dev/${hookName}) providing a list of URLs for ${pageAt} that should be pre-rendered. If you don't want to pre-render ${pageAt} then use the option prerender.partial (https://vike.dev/prerender#partial) to suppress this warning.`, { onlyOnce: true });
|
|
562
562
|
});
|
|
563
563
|
}
|
|
564
564
|
async function prerender404(prerenderedPageContexts, renderContext, prerenderContext, onComplete) {
|
|
@@ -674,7 +674,7 @@ function checkOutdatedOptions(options) {
|
|
|
674
674
|
(0, utils_js_1.assertUsage)(options.root === undefined, 'Option `prerender({ root })` deprecated: set `prerender({ viteConfig: { root }})` instead.', { showStackTrace: true });
|
|
675
675
|
(0, utils_js_1.assertUsage)(options.configFile === undefined, 'Option `prerender({ configFile })` deprecated: set `prerender({ viteConfig: { configFile }})` instead.', { showStackTrace: true });
|
|
676
676
|
['noExtraDir', 'partial', 'parallel'].forEach((prop) => {
|
|
677
|
-
(0, utils_js_1.assertUsage)(options[prop] === undefined, `[prerender()] Option ${picocolors_1.default.cyan(prop)} is deprecated. Define ${picocolors_1.default.cyan(prop)} in vite.config.js instead. See https://vike.dev/prerender
|
|
677
|
+
(0, utils_js_1.assertUsage)(options[prop] === undefined, `[prerender()] Option ${picocolors_1.default.cyan(prop)} is deprecated. Define ${picocolors_1.default.cyan(prop)} in vite.config.js instead. See https://vike.dev/prerender`, { showStackTrace: true });
|
|
678
678
|
});
|
|
679
679
|
['base', 'outDir'].forEach((prop) => {
|
|
680
680
|
(0, utils_js_1.assertWarning)(options[prop] === undefined, `[prerender()] Option ${picocolors_1.default.cyan(prop)} is outdated and has no effect (vike now automatically determines ${picocolors_1.default.cyan(prop)})`, {
|
|
@@ -28,4 +28,4 @@ __exportStar(require("../../utils/filesystemPathHandling.js"), exports);
|
|
|
28
28
|
__exportStar(require("../../utils/urlToFile.js"), exports);
|
|
29
29
|
__exportStar(require("../../shared/hooks/executeHook.js"), exports);
|
|
30
30
|
__exportStar(require("../../utils/isPlainObject.js"), exports);
|
|
31
|
-
__exportStar(require("../../utils/
|
|
31
|
+
__exportStar(require("../../utils/assertNodeEnv.js"), exports);
|
|
@@ -105,6 +105,7 @@ function serializePageContextAbort(pageContext) {
|
|
|
105
105
|
delete pageContext._abortCaller;
|
|
106
106
|
const unknownProps = Object.keys(pageContext).filter((prop) => ![
|
|
107
107
|
// prettier-ignore
|
|
108
|
+
// biome-ignore format:
|
|
108
109
|
'_abortCall',
|
|
109
110
|
/* Not needed on the client-side
|
|
110
111
|
'_abortCaller',
|
|
@@ -6,7 +6,6 @@ const virtualFilePageConfigValuesAll_js_1 = require("../../../shared/virtual-fil
|
|
|
6
6
|
function assertClientEntryId(id) {
|
|
7
7
|
(0, utils_js_1.assertPosixPath)(id);
|
|
8
8
|
(0, utils_js_1.assert)(!id.startsWith('/@fs'), id);
|
|
9
|
-
const isPkg = (0, utils_js_1.isNpmPackageImport)(id);
|
|
10
9
|
(0, utils_js_1.assert)(
|
|
11
10
|
// Client entry
|
|
12
11
|
id.startsWith('@@vike/') ||
|
|
@@ -14,7 +13,7 @@ function assertClientEntryId(id) {
|
|
|
14
13
|
id.startsWith('/') ||
|
|
15
14
|
// Page code importer
|
|
16
15
|
(0, virtualFilePageConfigValuesAll_js_1.isVirtualFileIdPageConfigValuesAll)(id) ||
|
|
17
|
-
//
|
|
18
|
-
|
|
16
|
+
// Import
|
|
17
|
+
(0, utils_js_1.isNpmPackageImport)(id), id);
|
|
19
18
|
}
|
|
20
19
|
exports.assertClientEntryId = assertClientEntryId;
|
|
@@ -49,7 +49,6 @@ __exportStar(require("../../utils/debug.js"), exports);
|
|
|
49
49
|
__exportStar(require("../../utils/urlToFile.js"), exports);
|
|
50
50
|
__exportStar(require("../../utils/getGlobalObject.js"), exports);
|
|
51
51
|
__exportStar(require("../../shared/hooks/executeHook.js"), exports);
|
|
52
|
-
__exportStar(require("../../utils/isStemPackageName.js"), exports);
|
|
53
52
|
__exportStar(require("../../utils/freezePartial.js"), exports);
|
|
54
53
|
__exportStar(require("../../utils/isNpmPackage.js"), exports);
|
|
55
54
|
__exportStar(require("../../utils/isNotNullish.js"), exports);
|
|
@@ -61,7 +60,7 @@ __exportStar(require("../../utils/getFileExtension.js"), exports);
|
|
|
61
60
|
__exportStar(require("../../utils/assertIsNotProductionRuntime.js"), exports);
|
|
62
61
|
__exportStar(require("../../utils/virtual-files.js"), exports);
|
|
63
62
|
__exportStar(require("../../utils/path-shim.js"), exports);
|
|
64
|
-
__exportStar(require("../../utils/
|
|
63
|
+
__exportStar(require("../../utils/assertNodeEnv.js"), exports);
|
|
65
64
|
__exportStar(require("../../utils/isHtml.js"), exports);
|
|
66
65
|
__exportStar(require("../../utils/warnIfErrorIsNotObject.js"), exports);
|
|
67
66
|
__exportStar(require("../../utils/stripAnsi.js"), exports);
|
|
@@ -56,7 +56,7 @@ function getHookFromPageConfigGlobal(pageConfigGlobal, hookName) {
|
|
|
56
56
|
// hook isn't a computed nor a cumulative config => definedAt should always be defined
|
|
57
57
|
(0, utils_js_1.assert)(hookFilePath);
|
|
58
58
|
assertHookFn(hookFn, { hookName, hookFilePath });
|
|
59
|
-
// We could use the global value of
|
|
59
|
+
// We could use the global value of configooksTimeout but it requires some non-trivial refactoring
|
|
60
60
|
const hookTimeout = getHookTimeoutDefault(hookName);
|
|
61
61
|
return { hookFn, hookName, hookFilePath, hookTimeout };
|
|
62
62
|
}
|
|
@@ -8,6 +8,7 @@ const utils_js_1 = require("../../utils.js");
|
|
|
8
8
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
9
9
|
const getConfigDefinedAtString_js_1 = require("./getConfigDefinedAtString.js");
|
|
10
10
|
// prettier-ignore
|
|
11
|
+
// biome-ignore format:
|
|
11
12
|
function getConfigValue(pageConfig, configName, type) {
|
|
12
13
|
const configValue = getConfigValueEntry(pageConfig, configName);
|
|
13
14
|
if (configValue === null)
|
|
@@ -78,7 +78,7 @@ function assertIsNotNull(configValue, configName, importPath) {
|
|
|
78
78
|
* - for cumulative values in the future: we don't need this for now because, currently, cumulative values are never imported.
|
|
79
79
|
assertUsage(
|
|
80
80
|
configValue !== null,
|
|
81
|
-
`Set ${pc.cyan(configName)} to ${pc.cyan('null')} in a +config.
|
|
81
|
+
`Set ${pc.cyan(configName)} to ${pc.cyan('null')} in a +config.js file instead of ${importPath}`
|
|
82
82
|
)
|
|
83
83
|
*/
|
|
84
84
|
}
|
|
@@ -164,6 +164,7 @@ function assertNoInfiniteLoop(pageContextsFromRewrite) {
|
|
|
164
164
|
function assertNoInfiniteAbortLoop(rewriteCount, redirectCount) {
|
|
165
165
|
const abortCalls = [
|
|
166
166
|
// prettier-ignore
|
|
167
|
+
// biome-ignore format:
|
|
167
168
|
rewriteCount > 0 && picocolors_1.default.cyan("throw render('/some-url')"),
|
|
168
169
|
redirectCount > 0 && picocolors_1.default.cyan("throw redirect('/some-url')")
|
|
169
170
|
]
|
|
@@ -9,6 +9,7 @@ const resolveRouteString_js_2 = require("./resolveRouteString.js");
|
|
|
9
9
|
// See https://vike.dev/route-function#precedence
|
|
10
10
|
function resolvePrecendence(routeMatches) {
|
|
11
11
|
// prettier-ignore
|
|
12
|
+
// biome-ignore format:
|
|
12
13
|
routeMatches
|
|
13
14
|
.sort(sortMatches)
|
|
14
15
|
.sort((0, utils_js_2.makeFirst)((routeMatch) => routeMatch.routeType === 'FUNCTION' && !!routeMatch.precedence && routeMatch.precedence < 0))
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Utils to manage process.env.NODE_ENV and, most notably, to assert correct usage, which is crucial:
|
|
3
|
+
// - https://github.com/vikejs/vike/issues/1469#issuecomment-1919518096
|
|
4
|
+
// - https://github.com/vitejs/vite/blob/76f30ae23b92f9af910ec02d98e2baaefa12141f/packages/vite/src/node/config.ts#L567
|
|
2
5
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
6
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
7
|
};
|
|
@@ -6,6 +6,7 @@ exports.hasProp = void 0;
|
|
|
6
6
|
const isCallable_js_1 = require("./isCallable.js");
|
|
7
7
|
const isObject_js_1 = require("./isObject.js");
|
|
8
8
|
// prettier-ignore
|
|
9
|
+
// biome-ignore format:
|
|
9
10
|
function hasProp(obj, prop, type = 'unknown') {
|
|
10
11
|
if (!(0, isObject_js_1.isObject)(obj))
|
|
11
12
|
return false;
|