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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { navigate };
|
|
2
2
|
export { reload };
|
|
3
3
|
import { renderPageClientSide } from './renderPageClientSide.js';
|
|
4
|
-
import {
|
|
4
|
+
import { assertClientRouting, getCurrentUrl } from './utils.js';
|
|
5
5
|
assertClientRouting();
|
|
6
6
|
/** Programmatically navigate to a new page.
|
|
7
7
|
*
|
|
@@ -12,17 +12,7 @@ assertClientRouting();
|
|
|
12
12
|
* @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).
|
|
13
13
|
*/
|
|
14
14
|
async function navigate(url, { keepScrollPosition = false, overwriteLastHistoryEntry = false } = {}) {
|
|
15
|
-
|
|
16
|
-
const errMsg = 'navigate() works only with Client Routing, see https://vike.dev/navigate';
|
|
17
|
-
assertUsage(checkIfClientRouting(), errMsg, { showStackTrace: true });
|
|
18
|
-
assertUsage(url, '[navigate(url)] Missing argument url', { showStackTrace: true });
|
|
19
|
-
assertUsage(typeof url === 'string', '[navigate(url)] Argument url should be a string', { showStackTrace: true });
|
|
20
|
-
assertUsage(typeof keepScrollPosition === 'boolean', '[navigate(url, { keepScrollPosition })] Argument keepScrollPosition should be a boolean', { showStackTrace: true });
|
|
21
|
-
assertUsage(typeof overwriteLastHistoryEntry === 'boolean', '[navigate(url, { overwriteLastHistoryEntry })] Argument overwriteLastHistoryEntry should be a boolean', { showStackTrace: true });
|
|
22
|
-
assertUsage(url.startsWith('/'), '[navigate(url)] Argument url should start with a leading /', {
|
|
23
|
-
showStackTrace: true
|
|
24
|
-
});
|
|
25
|
-
const scrollTarget = keepScrollPosition ? 'preserve-scroll' : 'scroll-to-top-or-hash';
|
|
15
|
+
const scrollTarget = { preserveScroll: keepScrollPosition };
|
|
26
16
|
await renderPageClientSide({
|
|
27
17
|
scrollTarget,
|
|
28
18
|
urlOriginal: url,
|
|
@@ -17,7 +17,7 @@ function onBrowserHistoryNavigation() {
|
|
|
17
17
|
// - The `event` argument of `window.addEventListener('popstate', (event) => /*...*/)` is useless: the History API doesn't provide the previous state (the popped state), see https://stackoverflow.com/questions/48055323/is-history-state-always-the-same-as-popstate-event-state
|
|
18
18
|
window.addEventListener('popstate', async () => {
|
|
19
19
|
const currentState = getState();
|
|
20
|
-
const scrollTarget = currentState.historyState.scrollPosition ||
|
|
20
|
+
const scrollTarget = currentState.historyState.scrollPosition || undefined;
|
|
21
21
|
const isUserLandPushStateNavigation = currentState.historyState.triggeredBy === 'user';
|
|
22
22
|
const isHashNavigation = currentState.urlWithoutHash === globalObject.previousState.urlWithoutHash;
|
|
23
23
|
const isBackwardNavigation = !currentState.historyState.timestamp || !globalObject.previousState.historyState.timestamp
|
|
@@ -17,8 +17,12 @@ async function handler(ev) {
|
|
|
17
17
|
return;
|
|
18
18
|
assert(url);
|
|
19
19
|
ev.preventDefault();
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
let scrollTarget;
|
|
21
|
+
{
|
|
22
|
+
const v = linkTag.getAttribute('keep-scroll-position');
|
|
23
|
+
if (v !== null)
|
|
24
|
+
scrollTarget = { preserveScroll: v === 'false' ? false : true };
|
|
25
|
+
}
|
|
22
26
|
await renderPageClientSide({
|
|
23
27
|
scrollTarget,
|
|
24
28
|
urlOriginal: url,
|
|
@@ -223,7 +223,7 @@ async function renderPageClientSide(renderArgs) {
|
|
|
223
223
|
if (pageContextAbort._urlRewrite) {
|
|
224
224
|
await renderPageClientSide({
|
|
225
225
|
...renderArgs,
|
|
226
|
-
scrollTarget:
|
|
226
|
+
scrollTarget: undefined,
|
|
227
227
|
pageContextsFromRewrite: [...pageContextsFromRewrite, pageContextAbort]
|
|
228
228
|
});
|
|
229
229
|
return;
|
|
@@ -239,7 +239,7 @@ async function renderPageClientSide(renderArgs) {
|
|
|
239
239
|
else {
|
|
240
240
|
await renderPageClientSide({
|
|
241
241
|
...renderArgs,
|
|
242
|
-
scrollTarget:
|
|
242
|
+
scrollTarget: undefined,
|
|
243
243
|
urlOriginal: urlRedirect,
|
|
244
244
|
overwriteLastHistoryEntry: false,
|
|
245
245
|
isBackwardNavigation: false,
|
|
@@ -2,6 +2,8 @@ export { setScrollPosition };
|
|
|
2
2
|
export { autoSaveScrollPosition };
|
|
3
3
|
export type { ScrollTarget };
|
|
4
4
|
import { type ScrollPosition } from './history.js';
|
|
5
|
-
type ScrollTarget =
|
|
5
|
+
type ScrollTarget = undefined | {
|
|
6
|
+
preserveScroll: boolean;
|
|
7
|
+
} | ScrollPosition;
|
|
6
8
|
declare function setScrollPosition(scrollTarget: ScrollTarget): void;
|
|
7
9
|
declare function autoSaveScrollPosition(): void;
|
|
@@ -3,27 +3,27 @@ export { autoSaveScrollPosition };
|
|
|
3
3
|
import { assert, onPageHide, sleep, throttle } from './utils.js';
|
|
4
4
|
import { saveScrollPosition } from './history.js';
|
|
5
5
|
function setScrollPosition(scrollTarget) {
|
|
6
|
-
if (scrollTarget
|
|
6
|
+
if (scrollTarget && 'x' in scrollTarget) {
|
|
7
|
+
setScroll(scrollTarget);
|
|
7
8
|
return;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
scrollPosition = { x: 0, y: 0 };
|
|
10
|
+
if (scrollTarget?.preserveScroll) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
scrollToTopOrHash();
|
|
14
|
+
}
|
|
15
|
+
// Replicates the browser's native behavior
|
|
16
|
+
function scrollToTopOrHash() {
|
|
17
|
+
const hash = getUrlHash();
|
|
18
|
+
if (!hash || hash === 'top') {
|
|
19
|
+
setScroll({ x: 0, y: 0 });
|
|
21
20
|
}
|
|
22
21
|
else {
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const hashTarget = document.getElementById(hash) || document.getElementsByName(hash)[0];
|
|
23
|
+
if (hashTarget) {
|
|
24
|
+
hashTarget.scrollIntoView();
|
|
25
|
+
}
|
|
25
26
|
}
|
|
26
|
-
setScroll(scrollPosition);
|
|
27
27
|
}
|
|
28
28
|
/** Change the browser's scoll position, in a way that works during a repaint. */
|
|
29
29
|
function setScroll(scrollPosition) {
|
|
@@ -39,7 +39,7 @@ function extractAssetsPlugin() {
|
|
|
39
39
|
}
|
|
40
40
|
if (isServerAssetsFixEnabled) {
|
|
41
41
|
// I'm guessing isServerAssetsFixEnabled can only be true when mixing both designs: https://github.com/vikejs/vike/issues/1480
|
|
42
|
-
assertV1Design(
|
|
42
|
+
assertV1Design(vikeConfig.pageConfigs, true);
|
|
43
43
|
assert(false);
|
|
44
44
|
}
|
|
45
45
|
assert(configVike.includeAssetsImportedByServer);
|
|
@@ -113,7 +113,7 @@ const configDefinitionsBuiltIn = {
|
|
|
113
113
|
};
|
|
114
114
|
const configDefinitionsBuiltInGlobal = {
|
|
115
115
|
onPrerenderStart: {
|
|
116
|
-
env: { server: true, production: true }
|
|
116
|
+
env: { server: true, production: true, eager: true }
|
|
117
117
|
},
|
|
118
118
|
onBeforeRoute: {
|
|
119
119
|
env: { server: true, client: 'if-client-routing', eager: true }
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export { crawlPlusFiles };
|
|
2
|
-
import { assertPosixPath, assert, assertWarning,
|
|
2
|
+
import { assertPosixPath, assert, assertWarning, scriptFileExtensions, humanizeTime, assertIsSingleModuleInstance, assertIsNotProductionRuntime, isVersionOrAbove, isScriptFile } from '../../../../utils.js';
|
|
3
3
|
import path from 'path';
|
|
4
|
+
import fs from 'fs/promises';
|
|
4
5
|
import glob from 'fast-glob';
|
|
5
6
|
import { exec } from 'child_process';
|
|
6
7
|
import { promisify } from 'util';
|
|
7
8
|
import pc from '@brillout/picocolors';
|
|
8
9
|
import { isTemporaryBuildFile } from './transpileAndExecuteFile.js';
|
|
9
10
|
const execA = promisify(exec);
|
|
11
|
+
const TOO_MANY_UNTRACKED_FILES = 5;
|
|
10
12
|
assertIsNotProductionRuntime();
|
|
11
13
|
assertIsSingleModuleInstance('crawlPlusFiles.ts');
|
|
12
14
|
let gitIsNotUsable = false;
|
|
@@ -30,15 +32,17 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev, craw
|
|
|
30
32
|
let files = [];
|
|
31
33
|
const res = crawlWithGit !== false && (await gitLsFiles(userRootDir, outDirRelativeFromUserRootDir));
|
|
32
34
|
if (res &&
|
|
33
|
-
// Fallback to fast-glob for users that dynamically generate plus files. (Assuming
|
|
34
|
-
res.length > 0) {
|
|
35
|
-
files = res;
|
|
35
|
+
// 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.)
|
|
36
|
+
res.files.length > 0) {
|
|
37
|
+
files = res.files;
|
|
38
|
+
// We cannot find files inside symlink directories with `$ git ls-files` => we use fast-glob
|
|
39
|
+
files.push(...(await crawlSymlinkDirs(res.symlinkDirs, userRootDir, outDirRelativeFromUserRootDir)));
|
|
36
40
|
}
|
|
37
41
|
else {
|
|
38
42
|
files = await fastGlob(userRootDir, outDirRelativeFromUserRootDir);
|
|
39
43
|
}
|
|
40
44
|
// Filter build files
|
|
41
|
-
files = files.filter((
|
|
45
|
+
files = files.filter((filePath) => !isTemporaryBuildFile(filePath));
|
|
42
46
|
// Check performance
|
|
43
47
|
{
|
|
44
48
|
const timeAfter = new Date().getTime();
|
|
@@ -76,20 +80,27 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
|
|
|
76
80
|
'git',
|
|
77
81
|
preserveUTF8,
|
|
78
82
|
'ls-files',
|
|
79
|
-
|
|
83
|
+
// We don't filter because:
|
|
84
|
+
// - It would skip symlink directories
|
|
85
|
+
// - Performance gain seems negligible: https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
|
|
86
|
+
// ...scriptFileExtensionList.map((ext) => `"**/+*.${ext}"`),
|
|
87
|
+
// Performance gain is non-negligible.
|
|
88
|
+
// - https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
|
|
89
|
+
// - When node_modules/ is untracked the performance gain could be significant?
|
|
80
90
|
...ignoreAsPatterns.map((pattern) => `--exclude="${pattern}"`),
|
|
81
|
-
// --others
|
|
82
|
-
// --cached
|
|
83
|
-
|
|
91
|
+
// --others --exclude-standard => list untracked files (--others) while using .gitignore (--exclude-standard)
|
|
92
|
+
// --cached => list tracked files
|
|
93
|
+
// --stage => get file modes which we use to find symlink directories
|
|
94
|
+
'--others --exclude-standard --cached --stage'
|
|
84
95
|
].join(' ');
|
|
85
|
-
let
|
|
96
|
+
let resultLines;
|
|
86
97
|
let filesDeleted;
|
|
87
98
|
try {
|
|
88
99
|
;
|
|
89
|
-
[
|
|
100
|
+
[resultLines, filesDeleted] = await Promise.all([
|
|
90
101
|
// Main command
|
|
91
102
|
runCmd1(cmd, userRootDir),
|
|
92
|
-
// Get tracked
|
|
103
|
+
// Get tracked but deleted files
|
|
93
104
|
runCmd1('git ls-files --deleted', userRootDir)
|
|
94
105
|
]);
|
|
95
106
|
}
|
|
@@ -100,11 +111,40 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
|
|
|
100
111
|
}
|
|
101
112
|
throw err;
|
|
102
113
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
114
|
+
const filePaths = resultLines.map(parseGitLsResultLine);
|
|
115
|
+
// If there are too many files without mode we fallback to fast-glob
|
|
116
|
+
if (filePaths.filter((f) => !f.mode).length > TOO_MANY_UNTRACKED_FILES)
|
|
117
|
+
return null;
|
|
118
|
+
const symlinkDirs = [];
|
|
119
|
+
const files = [];
|
|
120
|
+
for (const { filePath, mode } of filePaths) {
|
|
121
|
+
// Deleted?
|
|
122
|
+
if (filesDeleted.includes(filePath))
|
|
123
|
+
continue;
|
|
124
|
+
// 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.)
|
|
125
|
+
if (!ignoreAsFilterFn(filePath))
|
|
126
|
+
continue;
|
|
127
|
+
// Symlink directory?
|
|
128
|
+
{
|
|
129
|
+
const isSymlinkDir = await isSymlinkDirectory(mode, filePath, userRootDir);
|
|
130
|
+
if (isSymlinkDir) {
|
|
131
|
+
symlinkDirs.push(filePath);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
// Skip deleted files and non-symlink directories
|
|
135
|
+
if (isSymlinkDir === null) {
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// + file?
|
|
140
|
+
if (!path.posix.basename(filePath).startsWith('+'))
|
|
141
|
+
continue;
|
|
142
|
+
// JavaScript file?
|
|
143
|
+
if (!isScriptFile(filePath))
|
|
144
|
+
continue;
|
|
145
|
+
files.push(filePath);
|
|
146
|
+
}
|
|
147
|
+
return { files, symlinkDirs };
|
|
108
148
|
}
|
|
109
149
|
// Same as gitLsFiles() but using fast-glob
|
|
110
150
|
async function fastGlob(userRootDir, outDirRelativeFromUserRootDir) {
|
|
@@ -115,7 +155,7 @@ async function fastGlob(userRootDir, outDirRelativeFromUserRootDir) {
|
|
|
115
155
|
});
|
|
116
156
|
return files;
|
|
117
157
|
}
|
|
118
|
-
// Same as
|
|
158
|
+
// Same as getIgnoreAsFilterFn() but as glob pattern
|
|
119
159
|
function getIgnoreAsPatterns(outDirRelativeFromUserRootDir) {
|
|
120
160
|
const ignoreAsPatterns = [
|
|
121
161
|
'**/node_modules/**',
|
|
@@ -132,7 +172,7 @@ function getIgnoreAsPatterns(outDirRelativeFromUserRootDir) {
|
|
|
132
172
|
}
|
|
133
173
|
return ignoreAsPatterns;
|
|
134
174
|
}
|
|
135
|
-
// Same as
|
|
175
|
+
// Same as getIgnoreAsPatterns() but for Array.filter()
|
|
136
176
|
function getIgnoreAsFilterFn(outDirRelativeFromUserRootDir) {
|
|
137
177
|
assert(outDirRelativeFromUserRootDir === null || !outDirRelativeFromUserRootDir.startsWith('/'));
|
|
138
178
|
return (file) => !file.includes('node_modules/') &&
|
|
@@ -169,6 +209,77 @@ async function isGitNotUsable(userRootDir) {
|
|
|
169
209
|
return false;
|
|
170
210
|
}
|
|
171
211
|
}
|
|
212
|
+
async function crawlSymlinkDirs(symlinkDirs, userRootDir, outDirRelativeFromUserRootDir) {
|
|
213
|
+
const filesInSymlinkDirs = (await Promise.all(symlinkDirs.map(async (symlinkDir) => (await fastGlob(path.posix.join(userRootDir, symlinkDir), outDirRelativeFromUserRootDir)).map((filePath) => path.posix.join(symlinkDir, filePath))))).flat();
|
|
214
|
+
return filesInSymlinkDirs;
|
|
215
|
+
}
|
|
216
|
+
// Parse:
|
|
217
|
+
// ```
|
|
218
|
+
// some/not/tracked/path
|
|
219
|
+
// 100644 f6928073402b241b468b199893ff6f4aed0b7195 0\tpages/index/+Page.tsx
|
|
220
|
+
// ```
|
|
221
|
+
function parseGitLsResultLine(resultLine) {
|
|
222
|
+
const [part1, part2, ...rest] = resultLine.split('\t');
|
|
223
|
+
assert(part1);
|
|
224
|
+
assert(rest.length === 0);
|
|
225
|
+
// Git doesn't provide the mode for untracked paths.
|
|
226
|
+
// `resultLine` is:
|
|
227
|
+
// ```
|
|
228
|
+
// some/not/tracked/path
|
|
229
|
+
// ```
|
|
230
|
+
if (part2 === undefined) {
|
|
231
|
+
return { filePath: part1, mode: null };
|
|
232
|
+
}
|
|
233
|
+
assert(part2);
|
|
234
|
+
// `resultLine` is:
|
|
235
|
+
// ```
|
|
236
|
+
// 100644 f6928073402b241b468b199893ff6f4aed0b7195 0\tpages/index/+Page.tsx
|
|
237
|
+
// ```
|
|
238
|
+
const [mode, _, __, ...rest2] = part1.split(' ');
|
|
239
|
+
assert(mode && _ && __ && rest2.length === 0);
|
|
240
|
+
return { filePath: part2, mode };
|
|
241
|
+
}
|
|
242
|
+
async function isSymlinkDirectory(mode, filePath, userRootDir) {
|
|
243
|
+
const filePathAbsolute = path.posix.join(userRootDir, filePath);
|
|
244
|
+
let stats = null;
|
|
245
|
+
let isSymlink = false;
|
|
246
|
+
if (mode === '120000') {
|
|
247
|
+
isSymlink = true;
|
|
248
|
+
}
|
|
249
|
+
else if (mode === null) {
|
|
250
|
+
// `$ git ls-files` doesn't provide the mode when Git doesn't track the path
|
|
251
|
+
stats = await getFileStats(filePathAbsolute);
|
|
252
|
+
if (stats === null)
|
|
253
|
+
return null;
|
|
254
|
+
isSymlink = stats.isSymbolicLink();
|
|
255
|
+
if (!isSymlink && stats.isDirectory())
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
assert(mode);
|
|
260
|
+
}
|
|
261
|
+
if (!isSymlink)
|
|
262
|
+
return false;
|
|
263
|
+
if (!stats)
|
|
264
|
+
stats = await getFileStats(filePathAbsolute);
|
|
265
|
+
if (stats === null)
|
|
266
|
+
return null;
|
|
267
|
+
const isDirectory = stats.isDirectory();
|
|
268
|
+
return isDirectory;
|
|
269
|
+
}
|
|
270
|
+
async function getFileStats(filePathAbsolute) {
|
|
271
|
+
let stats;
|
|
272
|
+
try {
|
|
273
|
+
stats = await fs.lstat(filePathAbsolute);
|
|
274
|
+
}
|
|
275
|
+
catch (err) {
|
|
276
|
+
// File was deleted, usually a temporary file such as +config.js.build-j95xb988fpln.mjs
|
|
277
|
+
// ENOENT: no such file or directory
|
|
278
|
+
assert(err.code === 'ENOENT');
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
return stats;
|
|
282
|
+
}
|
|
172
283
|
async function runCmd1(cmd, cwd) {
|
|
173
284
|
const { stdout } = await execA(cmd, { cwd });
|
|
174
285
|
/* Not always true: https://github.com/vikejs/vike/issues/1440#issuecomment-1892831303
|
|
@@ -610,7 +610,7 @@ function getConfigDefinitions(interfaceFilesRelevant) {
|
|
|
610
610
|
if (!configMeta)
|
|
611
611
|
return;
|
|
612
612
|
const meta = configMeta.configValue;
|
|
613
|
-
|
|
613
|
+
assertMetaUsage(meta, `Config ${pc.cyan('meta')} defined at ${interfaceFile.filePath.filePathToShowToUser}`);
|
|
614
614
|
// Set configDef._userEffectDefinedAtFilePath
|
|
615
615
|
Object.entries(meta).forEach(([configName, configDef]) => {
|
|
616
616
|
if (!configDef.effect)
|
|
@@ -633,7 +633,7 @@ function getConfigDefinitions(interfaceFilesRelevant) {
|
|
|
633
633
|
const configDefinitions = configDefinitionsMerged;
|
|
634
634
|
return configDefinitions;
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function assertMetaUsage(metaVal, metaConfigDefinedAt) {
|
|
637
637
|
if (!isObject(metaVal)) {
|
|
638
638
|
assert(metaConfigDefinedAt); // We expect internal effects to return a valid meta value
|
|
639
639
|
assertUsage(false, `${metaConfigDefinedAt} has an invalid type ${pc.cyan(typeof metaVal)}: it should be an object instead.`);
|
|
@@ -705,7 +705,7 @@ function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
|
705
705
|
else {
|
|
706
706
|
configDefinedAt = null;
|
|
707
707
|
}
|
|
708
|
-
|
|
708
|
+
assertMetaUsage(configValue, configDefinedAt);
|
|
709
709
|
objectEntries(configValue).forEach(([configTargetName, configTargetDef]) => {
|
|
710
710
|
{
|
|
711
711
|
const keys = Object.keys(configTargetDef);
|
|
@@ -722,8 +722,13 @@ function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
|
722
722
|
}
|
|
723
723
|
else {
|
|
724
724
|
assertUsage(false, notSupported);
|
|
725
|
-
|
|
726
|
-
|
|
725
|
+
/* To implement being able to set a config value in an effect:
|
|
726
|
+
* - Copy and append definedAtFile.fileExportPathToShowToUser with ['meta', configName, 'effect']
|
|
727
|
+
* - Copying the definedAtFile of the config that defines the effect
|
|
728
|
+
* - Same precedence as the config that sets the value triggering the effect (not the config defining the effect)
|
|
729
|
+
* - Apply sortConfigValueSources() again?
|
|
730
|
+
configValueSources.push()
|
|
731
|
+
*/
|
|
727
732
|
}
|
|
728
733
|
});
|
|
729
734
|
}
|
|
@@ -895,7 +900,10 @@ function getConfigEnvValue(val, errMsgIntro) {
|
|
|
895
900
|
assertUsage(hasProp(val, 'config', 'undefined') || hasProp(val, 'config', 'boolean'), errInvalidValue);
|
|
896
901
|
assertUsage(hasProp(val, 'server', 'undefined') || hasProp(val, 'server', 'boolean'), errInvalidValue);
|
|
897
902
|
assertUsage(hasProp(val, 'client', 'undefined') || hasProp(val, 'client', 'boolean'), errInvalidValue);
|
|
898
|
-
/*
|
|
903
|
+
/* To allow users to set an eager config:
|
|
904
|
+
* - Uncomment line below.
|
|
905
|
+
* - Add 'eager' to assertKeys() call above.
|
|
906
|
+
* - Add `eager: boolean` to ConfigEnv type.
|
|
899
907
|
assertUsage(hasProp(val, 'eager', 'undefined') || hasProp(val, 'eager', 'boolean'), errInvalidValue)
|
|
900
908
|
*/
|
|
901
909
|
return val;
|
|
@@ -4,9 +4,9 @@ export const errBabelReact = {
|
|
|
4
4
|
loc: { line: 7, column: 20, index: 208 },
|
|
5
5
|
pos: 208,
|
|
6
6
|
plugin: 'vite:react-babel',
|
|
7
|
-
id: '/home/rom/code/vike/examples/react-full/renderer/
|
|
8
|
-
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 {
|
|
9
|
-
frame: "5 | import type { PageContext } from './types.js'\n6 | \n7 | export {
|
|
10
|
-
message: "/home/rom/code/vike/examples/react-full/renderer/
|
|
11
|
-
stack: "SyntaxError: /home/rom/code/vike/examples/react-full/renderer/
|
|
7
|
+
id: '/home/rom/code/vike/examples/react-full/renderer/Layout.tsx',
|
|
8
|
+
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",
|
|
9
|
+
frame: "5 | import type { PageContext } from './types.js'\n6 | \n7 | export { Layout }}\n | ^\n8 | \n9 | function Layout({ pageContext, children }: { pageContext: PageContext; children: React.ReactNode }) {",
|
|
10
|
+
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",
|
|
11
|
+
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)"
|
|
12
12
|
};
|
package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js
CHANGED
|
@@ -4,10 +4,10 @@ export const errEsbuild = {
|
|
|
4
4
|
id: '',
|
|
5
5
|
location: {
|
|
6
6
|
column: 20,
|
|
7
|
-
file: '/home/rom/code/vike/examples/react-full/renderer/
|
|
7
|
+
file: '/home/rom/code/vike/examples/react-full/renderer/Layout.tsx',
|
|
8
8
|
length: 1,
|
|
9
9
|
line: 7,
|
|
10
|
-
lineText: 'export {
|
|
10
|
+
lineText: 'export { Layout }}',
|
|
11
11
|
namespace: '',
|
|
12
12
|
suggestion: ''
|
|
13
13
|
},
|
|
@@ -17,19 +17,19 @@ export const errEsbuild = {
|
|
|
17
17
|
}
|
|
18
18
|
],
|
|
19
19
|
warnings: [],
|
|
20
|
-
frame: '\n\u001b[33mUnexpected "}"\u001b[39m\n5 | import type { PageContext } from \'./types\'\n6 | \n7 | export {
|
|
20
|
+
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',
|
|
21
21
|
loc: {
|
|
22
22
|
column: 20,
|
|
23
|
-
file: '/home/rom/code/vike/examples/react-full/renderer/
|
|
23
|
+
file: '/home/rom/code/vike/examples/react-full/renderer/Layout.tsx',
|
|
24
24
|
length: 1,
|
|
25
25
|
line: 7,
|
|
26
|
-
lineText: 'export {
|
|
26
|
+
lineText: 'export { Layout }}',
|
|
27
27
|
namespace: '',
|
|
28
28
|
suggestion: ''
|
|
29
29
|
},
|
|
30
30
|
plugin: 'vite:esbuild',
|
|
31
|
-
id: '/home/rom/code/vike/examples/react-full/renderer/
|
|
32
|
-
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 {
|
|
33
|
-
message: 'Transform failed with 1 error:\n/home/rom/code/vike/examples/react-full/renderer/
|
|
34
|
-
stack: 'Error: Transform failed with 1 error:\n/home/rom/code/vike/examples/react-full/renderer/
|
|
31
|
+
id: '/home/rom/code/vike/examples/react-full/renderer/Layout.tsx',
|
|
32
|
+
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",
|
|
33
|
+
message: 'Transform failed with 1 error:\n/home/rom/code/vike/examples/react-full/renderer/Layout.tsx:7:20: ERROR: Unexpected "}"',
|
|
34
|
+
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)'
|
|
35
35
|
};
|
package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const errVueCss = {
|
|
2
2
|
name: 'CssSyntaxError',
|
|
3
3
|
reason: 'Unexpected }',
|
|
4
|
-
file: '/home/rom/code/vike/examples/vue-full/renderer/
|
|
4
|
+
file: '/home/rom/code/vike/examples/vue-full/renderer/Layout.vue',
|
|
5
5
|
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',
|
|
6
6
|
line: 6,
|
|
7
7
|
column: 2,
|
|
@@ -13,14 +13,14 @@ export const errVueCss = {
|
|
|
13
13
|
endLine: 6,
|
|
14
14
|
endColumn: 3,
|
|
15
15
|
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',
|
|
16
|
-
url: 'file:///home/rom/code/vike/examples/vue-full/renderer/
|
|
17
|
-
file: '/home/rom/code/vike/examples/vue-full/renderer/
|
|
16
|
+
url: 'file:///home/rom/code/vike/examples/vue-full/renderer/Layout.vue',
|
|
17
|
+
file: '/home/rom/code/vike/examples/vue-full/renderer/Layout.vue'
|
|
18
18
|
},
|
|
19
|
-
loc: { file: '/home/rom/code/vike/examples/vue-full/renderer/
|
|
20
|
-
id: '/home/rom/code/vike/examples/vue-full/renderer/
|
|
19
|
+
loc: { file: '/home/rom/code/vike/examples/vue-full/renderer/Layout.vue', line: 45, column: 2 },
|
|
20
|
+
id: '/home/rom/code/vike/examples/vue-full/renderer/Layout.vue',
|
|
21
21
|
plugin: 'vite:vue',
|
|
22
22
|
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',
|
|
23
23
|
frame: '43 | margin: auto;\n44 | }}\n45 | .content {\n | ^\n46 | padding: 20px;\n47 | padding-bottom: 50px;',
|
|
24
|
-
message: '/home/rom/code/vike/examples/vue-full/renderer/
|
|
25
|
-
stack: 'CssSyntaxError: /home/rom/code/vike/examples/vue-full/renderer/
|
|
24
|
+
message: '/home/rom/code/vike/examples/vue-full/renderer/Layout.vue:6:2: Unexpected }',
|
|
25
|
+
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)'
|
|
26
26
|
};
|
|
@@ -29,8 +29,8 @@ function warnMissingErrorPage(isV1) {
|
|
|
29
29
|
if (!globalContext.isProduction) {
|
|
30
30
|
const msg = [
|
|
31
31
|
`No ${isV1 ? 'error page' : pc.cyan('_error.page.js')} found,`,
|
|
32
|
-
'we recommend defining
|
|
33
|
-
'
|
|
32
|
+
'we recommend defining one',
|
|
33
|
+
'https://vike.dev/error-page'
|
|
34
34
|
].join(' ');
|
|
35
35
|
assertWarning(false, msg, { onlyOnce: true });
|
|
36
36
|
}
|