vike 0.4.176 → 0.4.177-commit-f4a92e0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +129 -18
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +14 -6
- package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +5 -5
- package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +9 -9
- package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +7 -7
- package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +2 -2
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +4 -2
- package/dist/cjs/node/shared/assertV1Design.js +11 -6
- package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +0 -1
- package/dist/cjs/utils/assertSingleInstance.js +5 -1
- package/dist/cjs/utils/parseUrl.js +3 -1
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/client/client-routing-runtime/installClientRouter.js +1 -1
- package/dist/esm/client/client-routing-runtime/navigate.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/navigate.js +2 -12
- package/dist/esm/client/client-routing-runtime/onBrowserHistoryNavigation.js +1 -1
- package/dist/esm/client/client-routing-runtime/onLinkClick.js +6 -2
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +2 -2
- package/dist/esm/client/client-routing-runtime/setScrollPosition.d.ts +3 -1
- package/dist/esm/client/client-routing-runtime/setScrollPosition.js +16 -16
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +130 -19
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +14 -6
- package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +5 -5
- package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +9 -9
- package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +7 -7
- package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.js +2 -2
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +4 -2
- package/dist/esm/node/shared/assertV1Design.d.ts +1 -1
- package/dist/esm/node/shared/assertV1Design.js +11 -6
- package/dist/esm/shared/page-configs/PageConfig.d.ts +3 -3
- package/dist/esm/shared/page-configs/getConfigValueBuildTime.js +0 -1
- package/dist/esm/utils/assertSingleInstance.js +2 -1
- package/dist/esm/utils/parseUrl.js +3 -1
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +1 -1
|
@@ -40,7 +40,7 @@ function extractAssetsPlugin() {
|
|
|
40
40
|
}
|
|
41
41
|
if (isServerAssetsFixEnabled) {
|
|
42
42
|
// I'm guessing isServerAssetsFixEnabled can only be true when mixing both designs: https://github.com/vikejs/vike/issues/1480
|
|
43
|
-
(0, assertV1Design_js_1.assertV1Design)(
|
|
43
|
+
(0, assertV1Design_js_1.assertV1Design)(vikeConfig.pageConfigs, true);
|
|
44
44
|
(0, utils_js_1.assert)(false);
|
|
45
45
|
}
|
|
46
46
|
(0, utils_js_1.assert)(configVike.includeAssetsImportedByServer);
|
|
@@ -115,7 +115,7 @@ const configDefinitionsBuiltIn = {
|
|
|
115
115
|
exports.configDefinitionsBuiltIn = configDefinitionsBuiltIn;
|
|
116
116
|
const configDefinitionsBuiltInGlobal = {
|
|
117
117
|
onPrerenderStart: {
|
|
118
|
-
env: { server: true, production: true }
|
|
118
|
+
env: { server: true, production: true, eager: true }
|
|
119
119
|
},
|
|
120
120
|
onBeforeRoute: {
|
|
121
121
|
env: { server: true, client: 'if-client-routing', eager: true }
|
package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js
CHANGED
|
@@ -6,12 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.crawlPlusFiles = void 0;
|
|
7
7
|
const utils_js_1 = require("../../../../utils.js");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
10
|
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
10
11
|
const child_process_1 = require("child_process");
|
|
11
12
|
const util_1 = require("util");
|
|
12
13
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
13
14
|
const transpileAndExecuteFile_js_1 = require("./transpileAndExecuteFile.js");
|
|
14
15
|
const execA = (0, util_1.promisify)(child_process_1.exec);
|
|
16
|
+
const TOO_MANY_UNTRACKED_FILES = 5;
|
|
15
17
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
16
18
|
(0, utils_js_1.assertIsSingleModuleInstance)('crawlPlusFiles.ts');
|
|
17
19
|
let gitIsNotUsable = false;
|
|
@@ -35,15 +37,17 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev, craw
|
|
|
35
37
|
let files = [];
|
|
36
38
|
const res = crawlWithGit !== false && (await gitLsFiles(userRootDir, outDirRelativeFromUserRootDir));
|
|
37
39
|
if (res &&
|
|
38
|
-
// Fallback to fast-glob for users that dynamically generate plus files. (Assuming
|
|
39
|
-
res.length > 0) {
|
|
40
|
-
files = res;
|
|
40
|
+
// Fallback to fast-glob for users that dynamically generate plus files. (Assuming that no plus file is found because of the user's .gitignore list.)
|
|
41
|
+
res.files.length > 0) {
|
|
42
|
+
files = res.files;
|
|
43
|
+
// We cannot find files inside symlink directories with `$ git ls-files` => we use fast-glob
|
|
44
|
+
files.push(...(await crawlSymlinkDirs(res.symlinkDirs, userRootDir, outDirRelativeFromUserRootDir)));
|
|
41
45
|
}
|
|
42
46
|
else {
|
|
43
47
|
files = await fastGlob(userRootDir, outDirRelativeFromUserRootDir);
|
|
44
48
|
}
|
|
45
49
|
// Filter build files
|
|
46
|
-
files = files.filter((
|
|
50
|
+
files = files.filter((filePath) => !(0, transpileAndExecuteFile_js_1.isTemporaryBuildFile)(filePath));
|
|
47
51
|
// Check performance
|
|
48
52
|
{
|
|
49
53
|
const timeAfter = new Date().getTime();
|
|
@@ -82,20 +86,27 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
|
|
|
82
86
|
'git',
|
|
83
87
|
preserveUTF8,
|
|
84
88
|
'ls-files',
|
|
85
|
-
|
|
89
|
+
// We don't filter because:
|
|
90
|
+
// - It would skip symlink directories
|
|
91
|
+
// - Performance gain seems negligible: https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
|
|
92
|
+
// ...scriptFileExtensionList.map((ext) => `"**/+*.${ext}"`),
|
|
93
|
+
// Performance gain is non-negligible.
|
|
94
|
+
// - https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
|
|
95
|
+
// - When node_modules/ is untracked the performance gain could be significant?
|
|
86
96
|
...ignoreAsPatterns.map((pattern) => `--exclude="${pattern}"`),
|
|
87
|
-
// --others
|
|
88
|
-
// --cached
|
|
89
|
-
|
|
97
|
+
// --others --exclude-standard => list untracked files (--others) while using .gitignore (--exclude-standard)
|
|
98
|
+
// --cached => list tracked files
|
|
99
|
+
// --stage => get file modes which we use to find symlink directories
|
|
100
|
+
'--others --exclude-standard --cached --stage'
|
|
90
101
|
].join(' ');
|
|
91
|
-
let
|
|
102
|
+
let resultLines;
|
|
92
103
|
let filesDeleted;
|
|
93
104
|
try {
|
|
94
105
|
;
|
|
95
|
-
[
|
|
106
|
+
[resultLines, filesDeleted] = await Promise.all([
|
|
96
107
|
// Main command
|
|
97
108
|
runCmd1(cmd, userRootDir),
|
|
98
|
-
// Get tracked
|
|
109
|
+
// Get tracked but deleted files
|
|
99
110
|
runCmd1('git ls-files --deleted', userRootDir)
|
|
100
111
|
]);
|
|
101
112
|
}
|
|
@@ -106,11 +117,40 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
|
|
|
106
117
|
}
|
|
107
118
|
throw err;
|
|
108
119
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
120
|
+
const filePaths = resultLines.map(parseGitLsResultLine);
|
|
121
|
+
// If there are too many files without mode we fallback to fast-glob
|
|
122
|
+
if (filePaths.filter((f) => !f.mode).length > TOO_MANY_UNTRACKED_FILES)
|
|
123
|
+
return null;
|
|
124
|
+
const symlinkDirs = [];
|
|
125
|
+
const files = [];
|
|
126
|
+
for (const { filePath, mode } of filePaths) {
|
|
127
|
+
// Deleted?
|
|
128
|
+
if (filesDeleted.includes(filePath))
|
|
129
|
+
continue;
|
|
130
|
+
// We have to repeat the same exclusion logic here because the option --exclude of `$ git ls-files` only applies to untracked files. (We use --exclude only to speed up the `$ git ls-files` command.)
|
|
131
|
+
if (!ignoreAsFilterFn(filePath))
|
|
132
|
+
continue;
|
|
133
|
+
// Symlink directory?
|
|
134
|
+
{
|
|
135
|
+
const isSymlinkDir = await isSymlinkDirectory(mode, filePath, userRootDir);
|
|
136
|
+
if (isSymlinkDir) {
|
|
137
|
+
symlinkDirs.push(filePath);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
// Skip deleted files and non-symlink directories
|
|
141
|
+
if (isSymlinkDir === null) {
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// + file?
|
|
146
|
+
if (!path_1.default.posix.basename(filePath).startsWith('+'))
|
|
147
|
+
continue;
|
|
148
|
+
// JavaScript file?
|
|
149
|
+
if (!(0, utils_js_1.isScriptFile)(filePath))
|
|
150
|
+
continue;
|
|
151
|
+
files.push(filePath);
|
|
152
|
+
}
|
|
153
|
+
return { files, symlinkDirs };
|
|
114
154
|
}
|
|
115
155
|
// Same as gitLsFiles() but using fast-glob
|
|
116
156
|
async function fastGlob(userRootDir, outDirRelativeFromUserRootDir) {
|
|
@@ -121,7 +161,7 @@ async function fastGlob(userRootDir, outDirRelativeFromUserRootDir) {
|
|
|
121
161
|
});
|
|
122
162
|
return files;
|
|
123
163
|
}
|
|
124
|
-
// Same as
|
|
164
|
+
// Same as getIgnoreAsFilterFn() but as glob pattern
|
|
125
165
|
function getIgnoreAsPatterns(outDirRelativeFromUserRootDir) {
|
|
126
166
|
const ignoreAsPatterns = [
|
|
127
167
|
'**/node_modules/**',
|
|
@@ -138,7 +178,7 @@ function getIgnoreAsPatterns(outDirRelativeFromUserRootDir) {
|
|
|
138
178
|
}
|
|
139
179
|
return ignoreAsPatterns;
|
|
140
180
|
}
|
|
141
|
-
// Same as
|
|
181
|
+
// Same as getIgnoreAsPatterns() but for Array.filter()
|
|
142
182
|
function getIgnoreAsFilterFn(outDirRelativeFromUserRootDir) {
|
|
143
183
|
(0, utils_js_1.assert)(outDirRelativeFromUserRootDir === null || !outDirRelativeFromUserRootDir.startsWith('/'));
|
|
144
184
|
return (file) => !file.includes('node_modules/') &&
|
|
@@ -175,6 +215,77 @@ async function isGitNotUsable(userRootDir) {
|
|
|
175
215
|
return false;
|
|
176
216
|
}
|
|
177
217
|
}
|
|
218
|
+
async function crawlSymlinkDirs(symlinkDirs, userRootDir, outDirRelativeFromUserRootDir) {
|
|
219
|
+
const filesInSymlinkDirs = (await Promise.all(symlinkDirs.map(async (symlinkDir) => (await fastGlob(path_1.default.posix.join(userRootDir, symlinkDir), outDirRelativeFromUserRootDir)).map((filePath) => path_1.default.posix.join(symlinkDir, filePath))))).flat();
|
|
220
|
+
return filesInSymlinkDirs;
|
|
221
|
+
}
|
|
222
|
+
// Parse:
|
|
223
|
+
// ```
|
|
224
|
+
// some/not/tracked/path
|
|
225
|
+
// 100644 f6928073402b241b468b199893ff6f4aed0b7195 0\tpages/index/+Page.tsx
|
|
226
|
+
// ```
|
|
227
|
+
function parseGitLsResultLine(resultLine) {
|
|
228
|
+
const [part1, part2, ...rest] = resultLine.split('\t');
|
|
229
|
+
(0, utils_js_1.assert)(part1);
|
|
230
|
+
(0, utils_js_1.assert)(rest.length === 0);
|
|
231
|
+
// Git doesn't provide the mode for untracked paths.
|
|
232
|
+
// `resultLine` is:
|
|
233
|
+
// ```
|
|
234
|
+
// some/not/tracked/path
|
|
235
|
+
// ```
|
|
236
|
+
if (part2 === undefined) {
|
|
237
|
+
return { filePath: part1, mode: null };
|
|
238
|
+
}
|
|
239
|
+
(0, utils_js_1.assert)(part2);
|
|
240
|
+
// `resultLine` is:
|
|
241
|
+
// ```
|
|
242
|
+
// 100644 f6928073402b241b468b199893ff6f4aed0b7195 0\tpages/index/+Page.tsx
|
|
243
|
+
// ```
|
|
244
|
+
const [mode, _, __, ...rest2] = part1.split(' ');
|
|
245
|
+
(0, utils_js_1.assert)(mode && _ && __ && rest2.length === 0);
|
|
246
|
+
return { filePath: part2, mode };
|
|
247
|
+
}
|
|
248
|
+
async function isSymlinkDirectory(mode, filePath, userRootDir) {
|
|
249
|
+
const filePathAbsolute = path_1.default.posix.join(userRootDir, filePath);
|
|
250
|
+
let stats = null;
|
|
251
|
+
let isSymlink = false;
|
|
252
|
+
if (mode === '120000') {
|
|
253
|
+
isSymlink = true;
|
|
254
|
+
}
|
|
255
|
+
else if (mode === null) {
|
|
256
|
+
// `$ git ls-files` doesn't provide the mode when Git doesn't track the path
|
|
257
|
+
stats = await getFileStats(filePathAbsolute);
|
|
258
|
+
if (stats === null)
|
|
259
|
+
return null;
|
|
260
|
+
isSymlink = stats.isSymbolicLink();
|
|
261
|
+
if (!isSymlink && stats.isDirectory())
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
(0, utils_js_1.assert)(mode);
|
|
266
|
+
}
|
|
267
|
+
if (!isSymlink)
|
|
268
|
+
return false;
|
|
269
|
+
if (!stats)
|
|
270
|
+
stats = await getFileStats(filePathAbsolute);
|
|
271
|
+
if (stats === null)
|
|
272
|
+
return null;
|
|
273
|
+
const isDirectory = stats.isDirectory();
|
|
274
|
+
return isDirectory;
|
|
275
|
+
}
|
|
276
|
+
async function getFileStats(filePathAbsolute) {
|
|
277
|
+
let stats;
|
|
278
|
+
try {
|
|
279
|
+
stats = await promises_1.default.lstat(filePathAbsolute);
|
|
280
|
+
}
|
|
281
|
+
catch (err) {
|
|
282
|
+
// File was deleted, usually a temporary file such as +config.js.build-j95xb988fpln.mjs
|
|
283
|
+
// ENOENT: no such file or directory
|
|
284
|
+
(0, utils_js_1.assert)(err.code === 'ENOENT');
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
return stats;
|
|
288
|
+
}
|
|
178
289
|
async function runCmd1(cmd, cwd) {
|
|
179
290
|
const { stdout } = await execA(cmd, { cwd });
|
|
180
291
|
/* Not always true: https://github.com/vikejs/vike/issues/1440#issuecomment-1892831303
|
|
@@ -614,7 +614,7 @@ function getConfigDefinitions(interfaceFilesRelevant) {
|
|
|
614
614
|
if (!configMeta)
|
|
615
615
|
return;
|
|
616
616
|
const meta = configMeta.configValue;
|
|
617
|
-
|
|
617
|
+
assertMetaUsage(meta, `Config ${picocolors_1.default.cyan('meta')} defined at ${interfaceFile.filePath.filePathToShowToUser}`);
|
|
618
618
|
// Set configDef._userEffectDefinedAtFilePath
|
|
619
619
|
Object.entries(meta).forEach(([configName, configDef]) => {
|
|
620
620
|
if (!configDef.effect)
|
|
@@ -637,7 +637,7 @@ function getConfigDefinitions(interfaceFilesRelevant) {
|
|
|
637
637
|
const configDefinitions = configDefinitionsMerged;
|
|
638
638
|
return configDefinitions;
|
|
639
639
|
}
|
|
640
|
-
function
|
|
640
|
+
function assertMetaUsage(metaVal, metaConfigDefinedAt) {
|
|
641
641
|
if (!(0, utils_js_1.isObject)(metaVal)) {
|
|
642
642
|
(0, utils_js_1.assert)(metaConfigDefinedAt); // We expect internal effects to return a valid meta value
|
|
643
643
|
(0, utils_js_1.assertUsage)(false, `${metaConfigDefinedAt} has an invalid type ${picocolors_1.default.cyan(typeof metaVal)}: it should be an object instead.`);
|
|
@@ -709,7 +709,7 @@ function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
|
709
709
|
else {
|
|
710
710
|
configDefinedAt = null;
|
|
711
711
|
}
|
|
712
|
-
|
|
712
|
+
assertMetaUsage(configValue, configDefinedAt);
|
|
713
713
|
(0, utils_js_1.objectEntries)(configValue).forEach(([configTargetName, configTargetDef]) => {
|
|
714
714
|
{
|
|
715
715
|
const keys = Object.keys(configTargetDef);
|
|
@@ -726,8 +726,13 @@ function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
|
726
726
|
}
|
|
727
727
|
else {
|
|
728
728
|
(0, utils_js_1.assertUsage)(false, notSupported);
|
|
729
|
-
|
|
730
|
-
|
|
729
|
+
/* To implement being able to set a config value in an effect:
|
|
730
|
+
* - Copy and append definedAtFile.fileExportPathToShowToUser with ['meta', configName, 'effect']
|
|
731
|
+
* - Copying the definedAtFile of the config that defines the effect
|
|
732
|
+
* - Same precedence as the config that sets the value triggering the effect (not the config defining the effect)
|
|
733
|
+
* - Apply sortConfigValueSources() again?
|
|
734
|
+
configValueSources.push()
|
|
735
|
+
*/
|
|
731
736
|
}
|
|
732
737
|
});
|
|
733
738
|
}
|
|
@@ -900,7 +905,10 @@ function getConfigEnvValue(val, errMsgIntro) {
|
|
|
900
905
|
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(val, 'config', 'undefined') || (0, utils_js_1.hasProp)(val, 'config', 'boolean'), errInvalidValue);
|
|
901
906
|
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(val, 'server', 'undefined') || (0, utils_js_1.hasProp)(val, 'server', 'boolean'), errInvalidValue);
|
|
902
907
|
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(val, 'client', 'undefined') || (0, utils_js_1.hasProp)(val, 'client', 'boolean'), errInvalidValue);
|
|
903
|
-
/*
|
|
908
|
+
/* To allow users to set an eager config:
|
|
909
|
+
* - Uncomment line below.
|
|
910
|
+
* - Add 'eager' to assertKeys() call above.
|
|
911
|
+
* - Add `eager: boolean` to ConfigEnv type.
|
|
904
912
|
assertUsage(hasProp(val, 'eager', 'undefined') || hasProp(val, 'eager', 'boolean'), errInvalidValue)
|
|
905
913
|
*/
|
|
906
914
|
return val;
|
|
@@ -7,9 +7,9 @@ exports.errBabelReact = {
|
|
|
7
7
|
loc: { line: 7, column: 20, index: 208 },
|
|
8
8
|
pos: 208,
|
|
9
9
|
plugin: 'vite:react-babel',
|
|
10
|
-
id: '/home/rom/code/vike/examples/react-full/renderer/
|
|
11
|
-
pluginCode: "import React from 'react'\nimport logoUrl from './logo.svg'\nimport { PageContextProvider } from './usePageContext'\nimport { Link } from './Link'\nimport type { PageContext } from './types'\n\nexport {
|
|
12
|
-
frame: "5 | import type { PageContext } from './types.js'\n6 | \n7 | export {
|
|
13
|
-
message: "/home/rom/code/vike/examples/react-full/renderer/
|
|
14
|
-
stack: "SyntaxError: /home/rom/code/vike/examples/react-full/renderer/
|
|
10
|
+
id: '/home/rom/code/vike/examples/react-full/renderer/Layout.tsx',
|
|
11
|
+
pluginCode: "import React from 'react'\nimport logoUrl from './logo.svg'\nimport { PageContextProvider } from './usePageContext'\nimport { Link } from './Link'\nimport type { PageContext } from './types'\n\nexport { Layout }}\n\nfunction Layout({ pageContext, children }: { pageContext: PageContext; children: React.ReactNode }) {\n return (\n <React.StrictMode>\n <PageContextProvider pageContext={pageContext}>\n <Layout>\n <Sidebar>\n <Logo />\n <Link href=\"/\">Welcome</Link>\n <Link href=\"/markdown\">Markdown</Link>\n <Link href=\"/star-wars\">Data Fetching</Link>\n <Link href=\"/hello\">Routing</Link>\n </Sidebar>\n <Content>{children}</Content>\n </Layout>\n </PageContextProvider>\n </React.StrictMode>\n )\n}\n\nfunction Layout({ children }: { children: React.ReactNode }) {\n return (\n <div\n style={{\n display: 'flex',\n maxWidth: 900,\n margin: 'auto'\n }}\n >\n {children}\n </div>\n )\n}\n\nfunction Sidebar({ children }: { children: React.ReactNode }) {\n return (\n <div\n id=\"sidebar\"\n style={{\n padding: 20,\n flexShrink: 0,\n display: 'flex',\n flexDirection: 'column',\n lineHeight: '1.8em',\n borderRight: '2px solid #eee'\n }}\n >\n {children}\n </div>\n )\n}\n\nfunction Content({ children }: { children: React.ReactNode }) {\n return (\n <div id=\"page-container\">\n <div\n id=\"page-content\"\n style={{\n padding: 20,\n paddingBottom: 50,\n minHeight: '100vh.js'\n }}\n >\n {children}\n </div>\n </div>\n )\n}\n\nfunction Logo() {\n return (\n <div\n style={{\n marginTop: 20,\n marginBottom: 10\n }}\n >\n <a href=\"/\">\n <img src={logoUrl} height={64} width={64} />\n </a>\n </div>\n )\n}\n",
|
|
12
|
+
frame: "5 | import type { PageContext } from './types.js'\n6 | \n7 | export { Layout }}\n | ^\n8 | \n9 | function Layout({ pageContext, children }: { pageContext: PageContext; children: React.ReactNode }) {",
|
|
13
|
+
message: "/home/rom/code/vike/examples/react-full/renderer/Layout.tsx: Unexpected token (7:20)\n\n\u001b[0m \u001b[90m 5 |\u001b[39m \u001b[36mimport\u001b[39m type { \u001b[33mPageContext\u001b[39m } \u001b[36mfrom\u001b[39m \u001b[32m'./types'\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 6 |\u001b[39m\u001b[0m\n\u001b[0m\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 7 |\u001b[39m \u001b[36mexport\u001b[39m { \u001b[33mLayout\u001b[39m }}\u001b[0m\n\u001b[0m \u001b[90m |\u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 8 |\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 9 |\u001b[39m \u001b[36mfunction\u001b[39m \u001b[33mLayout\u001b[39m({ pageContext\u001b[33m,\u001b[39m children }\u001b[33m:\u001b[39m { pageContext\u001b[33m:\u001b[39m \u001b[33mPageContext\u001b[39m\u001b[33m;\u001b[39m children\u001b[33m:\u001b[39m \u001b[33mReact\u001b[39m\u001b[33m.\u001b[39m\u001b[33mReactNode\u001b[39m }) {\u001b[0m\n\u001b[0m \u001b[90m 10 |\u001b[39m \u001b[36mreturn\u001b[39m (\u001b[0m",
|
|
14
|
+
stack: "SyntaxError: /home/rom/code/vike/examples/react-full/renderer/Layout.tsx: Unexpected token (7:20)\n\n\u001b[0m \u001b[90m 5 |\u001b[39m \u001b[36mimport\u001b[39m type { \u001b[33mPageContext\u001b[39m } \u001b[36mfrom\u001b[39m \u001b[32m'./types'\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 6 |\u001b[39m\u001b[0m\n\u001b[0m\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 7 |\u001b[39m \u001b[36mexport\u001b[39m { \u001b[33mLayout\u001b[39m }}\u001b[0m\n\u001b[0m \u001b[90m |\u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 8 |\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 9 |\u001b[39m \u001b[36mfunction\u001b[39m \u001b[33mLayout\u001b[39m({ pageContext\u001b[33m,\u001b[39m children }\u001b[33m:\u001b[39m { pageContext\u001b[33m:\u001b[39m \u001b[33mPageContext\u001b[39m\u001b[33m;\u001b[39m children\u001b[33m:\u001b[39m \u001b[33mReact\u001b[39m\u001b[33m.\u001b[39m\u001b[33mReactNode\u001b[39m }) {\u001b[0m\n\u001b[0m \u001b[90m 10 |\u001b[39m \u001b[36mreturn\u001b[39m (\u001b[0m\n at instantiate (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parse-error/credentials.ts:62:21)\n at toParseError (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parse-error.ts:60:12)\n at TypeScriptParserMixin.raise (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/tokenizer/index.ts:1490:19)\n at TypeScriptParserMixin.unexpected (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/tokenizer/index.ts:1531:16)\n at TypeScriptParserMixin.parseExprAtom (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/expression.ts:1347:16)\n at TypeScriptParserMixin.parseExprAtom (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/plugins/jsx/index.ts:574:22)\n at TypeScriptParserMixin.parseExprSubscripts (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/expression.ts:718:23)\n at TypeScriptParserMixin.parseUpdate (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/expression.ts:695:21)\n at TypeScriptParserMixin.parseMaybeUnary (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/expression.ts:657:23)\n at TypeScriptParserMixin.parseMaybeUnary (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/plugins/typescript/index.ts:3552:20)\n at TypeScriptParserMixin.parseMaybeUnaryOrPrivate (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/expression.ts:395:14)\n at TypeScriptParserMixin.parseExprOps (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/expression.ts:407:23)\n at TypeScriptParserMixin.parseMaybeConditional (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/expression.ts:362:23)\n at TypeScriptParserMixin.parseMaybeAssign (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/expression.ts:302:21)\n at TypeScriptParserMixin.parseMaybeAssign (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/plugins/typescript/index.ts:3429:22)\n at TypeScriptParserMixin.parseExpressionBase (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/expression.ts:225:23)\n at callback (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/expression.ts:216:39)\n at TypeScriptParserMixin.allowInAnd (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/expression.ts:3072:16)\n at TypeScriptParserMixin.parseExpression (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/expression.ts:216:17)\n at TypeScriptParserMixin.parseStatementContent (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/statement.ts:628:23)\n at TypeScriptParserMixin.parseStatementContent (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/plugins/typescript/index.ts:2887:20)\n at TypeScriptParserMixin.parseStatementLike (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/statement.ts:417:17)\n at TypeScriptParserMixin.parseModuleItem (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/statement.ts:354:17)\n at TypeScriptParserMixin.parseBlockOrModuleBlockBody (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/statement.ts:1359:16)\n at TypeScriptParserMixin.parseBlockBody (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/statement.ts:1333:10)\n at TypeScriptParserMixin.parseProgram (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/statement.ts:226:10)\n at TypeScriptParserMixin.parseTopLevel (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/statement.ts:208:25)\n at TypeScriptParserMixin.parse (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/index.ts:45:10)\n at TypeScriptParserMixin.parse (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/plugins/typescript/index.ts:3997:20)\n at parse (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/index.ts:67:38)\n at parser (/home/rom/code/vike/node_modules/.pnpm/@babel+core@7.21.8/node_modules/@babel/core/src/parser/index.ts:28:19)\n at parser.next (<anonymous>)\n at normalizeFile (/home/rom/code/vike/node_modules/.pnpm/@babel+core@7.21.8/node_modules/@babel/core/src/transformation/normalize-file.ts:51:24)\n at normalizeFile.next (<anonymous>)\n at run (/home/rom/code/vike/node_modules/.pnpm/@babel+core@7.21.8/node_modules/@babel/core/src/transformation/index.ts:38:36)\n at run.next (<anonymous>)\n at transform (/home/rom/code/vike/node_modules/.pnpm/@babel+core@7.21.8/node_modules/@babel/core/src/transform.ts:29:20)\n at transform.next (<anonymous>)\n at step (/home/rom/code/vike/node_modules/.pnpm/gensync@1.0.0-beta.2/node_modules/gensync/index.js:261:32)\n at /home/rom/code/vike/node_modules/.pnpm/gensync@1.0.0-beta.2/node_modules/gensync/index.js:273:13\n at async.call.result.err.err (/home/rom/code/vike/node_modules/.pnpm/gensync@1.0.0-beta.2/node_modules/gensync/index.js:223:11)\n at cb (/home/rom/code/vike/node_modules/.pnpm/gensync@1.0.0-beta.2/node_modules/gensync/index.js:189:28)\n at /home/rom/code/vike/node_modules/.pnpm/@babel+core@7.21.8/node_modules/@babel/core/src/gensync-utils/async.ts:90:7\n at /home/rom/code/vike/node_modules/.pnpm/gensync@1.0.0-beta.2/node_modules/gensync/index.js:113:33\n at step (/home/rom/code/vike/node_modules/.pnpm/gensync@1.0.0-beta.2/node_modules/gensync/index.js:287:14)\n at /home/rom/code/vike/node_modules/.pnpm/gensync@1.0.0-beta.2/node_modules/gensync/index.js:273:13\n at async.call.result.err.err (/home/rom/code/vike/node_modules/.pnpm/gensync@1.0.0-beta.2/node_modules/gensync/index.js:223:11)"
|
|
15
15
|
};
|
package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js
CHANGED
|
@@ -7,10 +7,10 @@ exports.errEsbuild = {
|
|
|
7
7
|
id: '',
|
|
8
8
|
location: {
|
|
9
9
|
column: 20,
|
|
10
|
-
file: '/home/rom/code/vike/examples/react-full/renderer/
|
|
10
|
+
file: '/home/rom/code/vike/examples/react-full/renderer/Layout.tsx',
|
|
11
11
|
length: 1,
|
|
12
12
|
line: 7,
|
|
13
|
-
lineText: 'export {
|
|
13
|
+
lineText: 'export { Layout }}',
|
|
14
14
|
namespace: '',
|
|
15
15
|
suggestion: ''
|
|
16
16
|
},
|
|
@@ -20,19 +20,19 @@ exports.errEsbuild = {
|
|
|
20
20
|
}
|
|
21
21
|
],
|
|
22
22
|
warnings: [],
|
|
23
|
-
frame: '\n\u001b[33mUnexpected "}"\u001b[39m\n5 | import type { PageContext } from \'./types\'\n6 | \n7 | export {
|
|
23
|
+
frame: '\n\u001b[33mUnexpected "}"\u001b[39m\n5 | import type { PageContext } from \'./types\'\n6 | \n7 | export { Layout }}\n | ^\n8 | \n9 | function Layout({ pageContext, children }: { pageContext: PageContext; children: React.ReactNode }) {\n',
|
|
24
24
|
loc: {
|
|
25
25
|
column: 20,
|
|
26
|
-
file: '/home/rom/code/vike/examples/react-full/renderer/
|
|
26
|
+
file: '/home/rom/code/vike/examples/react-full/renderer/Layout.tsx',
|
|
27
27
|
length: 1,
|
|
28
28
|
line: 7,
|
|
29
|
-
lineText: 'export {
|
|
29
|
+
lineText: 'export { Layout }}',
|
|
30
30
|
namespace: '',
|
|
31
31
|
suggestion: ''
|
|
32
32
|
},
|
|
33
33
|
plugin: 'vite:esbuild',
|
|
34
|
-
id: '/home/rom/code/vike/examples/react-full/renderer/
|
|
35
|
-
pluginCode: "import React from 'react'\nimport logoUrl from './logo.svg'\nimport { PageContextProvider } from './usePageContext'\nimport { Link } from './Link'\nimport type { PageContext } from './types'\n\nexport {
|
|
36
|
-
message: 'Transform failed with 1 error:\n/home/rom/code/vike/examples/react-full/renderer/
|
|
37
|
-
stack: 'Error: Transform failed with 1 error:\n/home/rom/code/vike/examples/react-full/renderer/
|
|
34
|
+
id: '/home/rom/code/vike/examples/react-full/renderer/Layout.tsx',
|
|
35
|
+
pluginCode: "import React from 'react'\nimport logoUrl from './logo.svg'\nimport { PageContextProvider } from './usePageContext'\nimport { Link } from './Link'\nimport type { PageContext } from './types'\n\nexport { Layout }}\n\nfunction Layout({ pageContext, children }: { pageContext: PageContext; children: React.ReactNode }) {\n return (\n <React.StrictMode>\n <PageContextProvider pageContext={pageContext}>\n <Layout>\n <Sidebar>\n <Logo />\n <Link href=\"/\">Welcome</Link>\n <Link href=\"/markdown\">Markdown</Link>\n <Link href=\"/star-wars\">Data Fetching</Link>\n <Link href=\"/hello\">Routing</Link>\n </Sidebar>\n <Content>{children}</Content>\n </Layout>\n </PageContextProvider>\n </React.StrictMode>\n )\n}\n\nfunction Layout({ children }: { children: React.ReactNode }) {\n return (\n <div\n style={{\n display: 'flex',\n maxWidth: 900,\n margin: 'auto'\n }}\n >\n {children}\n </div>\n )\n}\n\nfunction Sidebar({ children }: { children: React.ReactNode }) {\n return (\n <div\n id=\"sidebar\"\n style={{\n padding: 20,\n flexShrink: 0,\n display: 'flex',\n flexDirection: 'column',\n lineHeight: '1.8em',\n borderRight: '2px solid #eee'\n }}\n >\n {children}\n </div>\n )\n}\n\nfunction Content({ children }: { children: React.ReactNode }) {\n return (\n <div id=\"page-container\">\n <div\n id=\"page-content\"\n style={{\n padding: 20,\n paddingBottom: 50,\n minHeight: '100vh.js'\n }}\n >\n {children}\n </div>\n </div>\n )\n}\n\nfunction Logo() {\n return (\n <div\n style={{\n marginTop: 20,\n marginBottom: 10\n }}\n >\n <a href=\"/\">\n <img src={logoUrl} height={64} width={64} />\n </a>\n </div>\n )\n}\n",
|
|
36
|
+
message: 'Transform failed with 1 error:\n/home/rom/code/vike/examples/react-full/renderer/Layout.tsx:7:20: ERROR: Unexpected "}"',
|
|
37
|
+
stack: 'Error: Transform failed with 1 error:\n/home/rom/code/vike/examples/react-full/renderer/Layout.tsx:7:20: ERROR: Unexpected "}"\n at failureErrorWithLog (/home/rom/code/vike/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:1636:15)\n at /home/rom/code/vike/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:837:29\n at responseCallbacks.<computed> (/home/rom/code/vike/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:697:9)\n at handleIncomingPacket (/home/rom/code/vike/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:752:9)\n at Socket.readFromStdout (/home/rom/code/vike/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:673:7)\n at Socket.emit (node:events:513:28)\n at addChunk (node:internal/streams/readable:324:12)\n at readableAddChunk (node:internal/streams/readable:297:9)\n at Socket.Readable.push (node:internal/streams/readable:234:10)\n at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)'
|
|
38
38
|
};
|
package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.errVueCss = void 0;
|
|
|
4
4
|
exports.errVueCss = {
|
|
5
5
|
name: 'CssSyntaxError',
|
|
6
6
|
reason: 'Unexpected }',
|
|
7
|
-
file: '/home/rom/code/vike/examples/vue-full/renderer/
|
|
7
|
+
file: '/home/rom/code/vike/examples/vue-full/renderer/Layout.vue',
|
|
8
8
|
source: '\n.layout {\n display: flex;\n max-width: 900px;\n margin: auto;\n}}\n.content {\n padding: 20px;\n padding-bottom: 50px;\n min-height: 100vh;\n}\n.navigation {\n padding: 20px;\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n line-height: 1.8em;\n border-right: 2px solid #eee;\n}\n.logo {\n margin-top: 20px;\n margin-bottom: 10px;\n}\n.content {\n transition: opacity 0.1s ease-in;\n}\n.content.page-transition {\n opacity: 0;\n}\n',
|
|
9
9
|
line: 6,
|
|
10
10
|
column: 2,
|
|
@@ -16,14 +16,14 @@ exports.errVueCss = {
|
|
|
16
16
|
endLine: 6,
|
|
17
17
|
endColumn: 3,
|
|
18
18
|
source: '\n.layout {\n display: flex;\n max-width: 900px;\n margin: auto;\n}}\n.content {\n padding: 20px;\n padding-bottom: 50px;\n min-height: 100vh;\n}\n.navigation {\n padding: 20px;\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n line-height: 1.8em;\n border-right: 2px solid #eee;\n}\n.logo {\n margin-top: 20px;\n margin-bottom: 10px;\n}\n.content {\n transition: opacity 0.1s ease-in;\n}\n.content.page-transition {\n opacity: 0;\n}\n',
|
|
19
|
-
url: 'file:///home/rom/code/vike/examples/vue-full/renderer/
|
|
20
|
-
file: '/home/rom/code/vike/examples/vue-full/renderer/
|
|
19
|
+
url: 'file:///home/rom/code/vike/examples/vue-full/renderer/Layout.vue',
|
|
20
|
+
file: '/home/rom/code/vike/examples/vue-full/renderer/Layout.vue'
|
|
21
21
|
},
|
|
22
|
-
loc: { file: '/home/rom/code/vike/examples/vue-full/renderer/
|
|
23
|
-
id: '/home/rom/code/vike/examples/vue-full/renderer/
|
|
22
|
+
loc: { file: '/home/rom/code/vike/examples/vue-full/renderer/Layout.vue', line: 45, column: 2 },
|
|
23
|
+
id: '/home/rom/code/vike/examples/vue-full/renderer/Layout.vue',
|
|
24
24
|
plugin: 'vite:vue',
|
|
25
25
|
pluginCode: '\n.layout {\n display: flex;\n max-width: 900px;\n margin: auto;\n}}\n.content {\n padding: 20px;\n padding-bottom: 50px;\n min-height: 100vh;\n}\n.navigation {\n padding: 20px;\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n line-height: 1.8em;\n border-right: 2px solid #eee;\n}\n.logo {\n margin-top: 20px;\n margin-bottom: 10px;\n}\n.content {\n transition: opacity 0.1s ease-in;\n}\n.content.page-transition {\n opacity: 0;\n}\n',
|
|
26
26
|
frame: '43 | margin: auto;\n44 | }}\n45 | .content {\n | ^\n46 | padding: 20px;\n47 | padding-bottom: 50px;',
|
|
27
|
-
message: '/home/rom/code/vike/examples/vue-full/renderer/
|
|
28
|
-
stack: 'CssSyntaxError: /home/rom/code/vike/examples/vue-full/renderer/
|
|
27
|
+
message: '/home/rom/code/vike/examples/vue-full/renderer/Layout.vue:6:2: Unexpected }',
|
|
28
|
+
stack: 'CssSyntaxError: /home/rom/code/vike/examples/vue-full/renderer/Layout.vue:6:2: Unexpected }\n at Input.error (/home/rom/code/vike/node_modules/.pnpm/postcss@8.4.23/node_modules/postcss/lib/input.js:148:16)\n at Parser.unexpectedClose (/home/rom/code/vike/node_modules/.pnpm/postcss@8.4.23/node_modules/postcss/lib/parser.js:548:22)\n at Parser.end (/home/rom/code/vike/node_modules/.pnpm/postcss@8.4.23/node_modules/postcss/lib/parser.js:379:12)\n at Parser.parse (/home/rom/code/vike/node_modules/.pnpm/postcss@8.4.23/node_modules/postcss/lib/parser.js:56:16)\n at parse (/home/rom/code/vike/node_modules/.pnpm/postcss@8.4.23/node_modules/postcss/lib/parse.js:11:12)\n at new LazyResult (/home/rom/code/vike/node_modules/.pnpm/postcss@8.4.23/node_modules/postcss/lib/lazy-result.js:133:16)\n at Processor.process (/home/rom/code/vike/node_modules/.pnpm/postcss@8.4.23/node_modules/postcss/lib/processor.js:28:14)\n at doCompileStyle (/home/rom/code/vike/node_modules/.pnpm/@vue+compiler-sfc@3.2.33/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17246:45)\n at Object.compileStyleAsync (/home/rom/code/vike/node_modules/.pnpm/@vue+compiler-sfc@3.2.33/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17188:12)\n at transformStyle (/home/rom/code/vike/node_modules/.pnpm/@vitejs+plugin-vue@4.2.1_vite@4.3.5_vue@3.2.33/node_modules/@vitejs/plugin-vue/dist/index.cjs:2622:41)'
|
|
29
29
|
};
|
|
@@ -35,8 +35,8 @@ function warnMissingErrorPage(isV1) {
|
|
|
35
35
|
if (!globalContext.isProduction) {
|
|
36
36
|
const msg = [
|
|
37
37
|
`No ${isV1 ? 'error page' : picocolors_1.default.cyan('_error.page.js')} found,`,
|
|
38
|
-
'we recommend defining
|
|
39
|
-
'
|
|
38
|
+
'we recommend defining one',
|
|
39
|
+
'https://vike.dev/error-page'
|
|
40
40
|
].join(' ');
|
|
41
41
|
(0, utils_js_1.assertWarning)(false, msg, { onlyOnce: true });
|
|
42
42
|
}
|
|
@@ -22,6 +22,7 @@ const executeGuardHook_js_1 = require("../../../shared/route/executeGuardHook.js
|
|
|
22
22
|
const loadPageRoutes_js_1 = require("../../../shared/route/loadPageRoutes.js");
|
|
23
23
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
24
24
|
const isServerSideError_js_1 = require("../../../shared/misc/isServerSideError.js");
|
|
25
|
+
const assertV1Design_js_1 = require("../../shared/assertV1Design.js");
|
|
25
26
|
async function renderPageAlreadyRouted(pageContext) {
|
|
26
27
|
// pageContext._pageId can either be the:
|
|
27
28
|
// - ID of the page matching the routing, or the
|
|
@@ -175,8 +176,9 @@ async function getRenderContext() {
|
|
|
175
176
|
const globalContext = (0, globalContext_js_1.getGlobalContext)();
|
|
176
177
|
const { pageFilesAll, allPageIds, pageConfigs, pageConfigGlobal } = await (0, getPageFiles_js_1.getPageFilesAll)(false, globalContext.isProduction);
|
|
177
178
|
const { pageRoutes, onBeforeRouteHook } = await (0, loadPageRoutes_js_1.loadPageRoutes)(pageFilesAll, pageConfigs, pageConfigGlobal, allPageIds);
|
|
178
|
-
|
|
179
|
-
|
|
179
|
+
(0, assertV1Design_js_1.assertV1Design)(
|
|
180
|
+
// pageConfigs is PageConfigRuntime[] but assertV1Design() requires PageConfigBuildTime[]
|
|
181
|
+
pageConfigs.length > 0, pageFilesAll);
|
|
180
182
|
const renderContext = {
|
|
181
183
|
pageFilesAll: pageFilesAll,
|
|
182
184
|
pageConfigs,
|
|
@@ -2,21 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assertV1Design = void 0;
|
|
4
4
|
const utils_js_1 = require("./utils.js");
|
|
5
|
-
function assertV1Design(
|
|
6
|
-
const
|
|
5
|
+
function assertV1Design(pageConfigs, pageFilesAll) {
|
|
6
|
+
const isOldDesign = pageFilesAll === true || (pageFilesAll !== false && pageFilesAll.length > 0);
|
|
7
|
+
const isV1Design = pageConfigs === true || (pageConfigs !== false && pageConfigs.length > 0);
|
|
7
8
|
if (isV1Design && isOldDesign) {
|
|
8
9
|
const lines = ['Mixing the new V1 design with the old V0.4 design is forbidden.'];
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const indent = '- ';
|
|
11
|
+
if (typeof pageConfigs !== 'boolean') {
|
|
12
|
+
(0, utils_js_1.assert)(pageConfigs.length > 0);
|
|
12
13
|
const filesV1 = (0, utils_js_1.unique)(pageConfigs
|
|
13
14
|
.map((p) => Object.values(p.configValueSources).map((sources) => sources
|
|
14
15
|
.map((c) => c.definedAtFilePath.filePathAbsoluteUserRootDir)
|
|
15
16
|
.filter(utils_js_1.isNotNullish)
|
|
16
17
|
.map((filePathToShowToUser) => indent + filePathToShowToUser)))
|
|
17
18
|
.flat(2));
|
|
19
|
+
lines.push(...['V1 design files:', ...filesV1]);
|
|
20
|
+
}
|
|
21
|
+
if (typeof pageFilesAll !== 'boolean') {
|
|
22
|
+
(0, utils_js_1.assert)(pageFilesAll.length > 0);
|
|
18
23
|
const filesOld = pageFilesAll.map((p) => indent + p.filePath);
|
|
19
|
-
lines.push(...['
|
|
24
|
+
lines.push(...['Old design files:', ...filesOld]);
|
|
20
25
|
}
|
|
21
26
|
(0, utils_js_1.assertUsage)(false, lines.join('\n'));
|
|
22
27
|
}
|
|
@@ -25,7 +25,6 @@ function getConfigValue(pageConfig, configName) {
|
|
|
25
25
|
const sources = configValueSources[configName];
|
|
26
26
|
if (!sources)
|
|
27
27
|
return null;
|
|
28
|
-
(0, utils_js_1.assert)(sources.every((s) => s.configEnv.config === true));
|
|
29
28
|
const configDef = configDefinitions[configName];
|
|
30
29
|
(0, utils_js_1.assert)(configDef);
|
|
31
30
|
if (!configDef.cumulative) {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.onAssertModuleLoad = exports.onClientEntry_ClientRouting = exports.onClientEntry_ServerRouting = void 0;
|
|
4
7
|
// - Throw error if there are two different versions of vike loaded
|
|
@@ -7,6 +10,7 @@ exports.onAssertModuleLoad = exports.onClientEntry_ClientRouting = exports.onCli
|
|
|
7
10
|
const unique_js_1 = require("./unique.js");
|
|
8
11
|
const getGlobalObject_js_1 = require("./getGlobalObject.js");
|
|
9
12
|
const projectInfo_js_1 = require("./projectInfo.js");
|
|
13
|
+
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
10
14
|
/* Use original assertUsage() & assertWarning() after all CJS is removed from node_modules/vike/dist/
|
|
11
15
|
import { assertUsage, assertWarning } from './assert.js'
|
|
12
16
|
*/
|
|
@@ -21,7 +25,7 @@ function assertSingleInstance() {
|
|
|
21
25
|
const versions = (0, unique_js_1.unique)(globalObject.instances);
|
|
22
26
|
assertUsage(versions.length <= 1,
|
|
23
27
|
// DO *NOT* patch vike to remove this error: because of multiple conflicting versions, you *will* eventually encounter insidious issues that hard to debug and potentially a security hazard, see for example https://github.com/vikejs/vike/issues/1108
|
|
24
|
-
`
|
|
28
|
+
`vike@${picocolors_1.default.bold(versions[0])} and vike@${picocolors_1.default.bold(versions[1])} loaded but only one version should be loaded`);
|
|
25
29
|
}
|
|
26
30
|
if (globalObject.checkSingleInstance && globalObject.instances.length > 1) {
|
|
27
31
|
/*/ Not sure whether circular dependency can cause problems? In principle not since client-side code is ESM.
|
|
@@ -16,7 +16,9 @@ const PROTOCOLS = [
|
|
|
16
16
|
// For [Tauri](https://tauri.app/)
|
|
17
17
|
'tauri://',
|
|
18
18
|
// For Electron: https://github.com/vikejs/vike/issues/1557
|
|
19
|
-
'file://'
|
|
19
|
+
'file://',
|
|
20
|
+
// For Capacitor: https://github.com/vikejs/vike/issues/1706
|
|
21
|
+
'capacitor://'
|
|
20
22
|
];
|
|
21
23
|
function isParsable(url) {
|
|
22
24
|
// `parseUrl()` works with these URLs
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PROJECT_VERSION = exports.projectInfo = void 0;
|
|
4
|
-
const PROJECT_VERSION = '0.4.
|
|
4
|
+
const PROJECT_VERSION = '0.4.177-commit-f4a92e0';
|
|
5
5
|
exports.PROJECT_VERSION = PROJECT_VERSION;
|
|
6
6
|
const projectInfo = {
|
|
7
7
|
projectName: 'Vike',
|
|
@@ -19,7 +19,7 @@ async function installClientRouter() {
|
|
|
19
19
|
function render() {
|
|
20
20
|
assert(getRenderCount() === 0);
|
|
21
21
|
const renderPromise = renderPageClientSide({
|
|
22
|
-
scrollTarget:
|
|
22
|
+
scrollTarget: { preserveScroll: true },
|
|
23
23
|
isBackwardNavigation: null,
|
|
24
24
|
isClientSideNavigation: false
|
|
25
25
|
});
|
|
@@ -9,7 +9,7 @@ export { reload };
|
|
|
9
9
|
* @param overwriteLastHistoryEntry - Don't create a new entry in the browser's history, instead let the new URL replace the current URL. (This effectively removes the current URL from the browser history).
|
|
10
10
|
*/
|
|
11
11
|
declare function navigate(url: string, { keepScrollPosition, overwriteLastHistoryEntry }?: {
|
|
12
|
-
keepScrollPosition?: boolean
|
|
13
|
-
overwriteLastHistoryEntry?: boolean
|
|
12
|
+
keepScrollPosition?: boolean;
|
|
13
|
+
overwriteLastHistoryEntry?: boolean;
|
|
14
14
|
}): Promise<void>;
|
|
15
15
|
declare function reload(): Promise<void>;
|