vike 0.4.171-commit-2876124 → 0.4.172-commit-ea2b76c

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.
@@ -31,6 +31,7 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev) {
31
31
  //
32
32
  !outDirRelativeFromUserRootDir.startsWith('../')));
33
33
  const timeBefore = new Date().getTime();
34
+ // Crawl
34
35
  let files = [];
35
36
  const res = await gitLsFiles(userRootDir, outDirRelativeFromUserRootDir);
36
37
  if (res &&
@@ -41,7 +42,7 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev) {
41
42
  else {
42
43
  files = await fastGlob(userRootDir, outDirRelativeFromUserRootDir);
43
44
  }
44
- files = files.filter((file) => !(0, transpileAndExecuteFile_js_1.isTemporaryBuildFile)(file));
45
+ // Check performance
45
46
  {
46
47
  const timeAfter = new Date().getTime();
47
48
  const timeSpent = timeAfter - timeBefore;
@@ -53,10 +54,13 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev) {
53
54
  });
54
55
  }
55
56
  }
56
- const plusFiles = files.map((p) => {
57
- p = (0, utils_js_1.toPosixPath)(p);
58
- (0, utils_js_1.assert)(!p.startsWith(userRootDir));
59
- const filePathAbsoluteUserRootDir = path_1.default.posix.join('/', p);
57
+ // Normalize
58
+ const plusFiles = files.map((filePath) => {
59
+ // Both `$ git-ls files` and fast-glob return posix paths
60
+ (0, utils_js_1.assertPosixPath)(filePath);
61
+ (0, utils_js_1.assert)(!filePath.startsWith(userRootDir));
62
+ (0, utils_js_1.assert)(!(0, transpileAndExecuteFile_js_1.isTemporaryBuildFile)(filePath));
63
+ const filePathAbsoluteUserRootDir = path_1.default.posix.join('/', filePath);
60
64
  return { filePathAbsoluteUserRootDir };
61
65
  });
62
66
  return plusFiles;
@@ -66,10 +70,17 @@ exports.crawlPlusFiles = crawlPlusFiles;
66
70
  async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
67
71
  if (gitIsNotUsable)
68
72
  return null;
73
+ // Preserve UTF-8 file paths.
74
+ // https://github.com/vikejs/vike/issues/1658
75
+ // https://stackoverflow.com/questions/22827239/how-to-make-git-properly-display-utf-8-encoded-pathnames-in-the-console-window/22828826#22828826
76
+ // https://stackoverflow.com/questions/15884180/how-do-i-override-git-configuration-options-by-command-line-parameters/15884261#15884261
77
+ const preserveUTF8 = '-c core.quotepath=off';
69
78
  const ignoreAsPatterns = getIgnoreAsPatterns(outDirRelativeFromUserRootDir);
70
79
  const ignoreAsFilterFn = getIgnoreAsFilterFn(outDirRelativeFromUserRootDir);
71
80
  const cmd = [
72
- 'git ls-files',
81
+ 'git',
82
+ preserveUTF8,
83
+ 'ls-files',
73
84
  ...utils_js_1.scriptFileExtensionList.map((ext) => `"**/+*.${ext}"`),
74
85
  ...ignoreAsPatterns.map((pattern) => `--exclude="${pattern}"`),
75
86
  // --others lists untracked files only (but using .gitignore because --exclude-standard)
@@ -205,7 +205,7 @@ function logHttpRequest(urlOriginal, httpRequestId) {
205
205
  (0, loggerRuntime_js_1.logRuntimeInfo)?.(getRequestInfoMessage(urlOriginal), httpRequestId, 'info', clearErrors);
206
206
  }
207
207
  function getRequestInfoMessage(urlOriginal) {
208
- return `HTTP request: ${picocolors_1.default.bold(urlOriginal)}`;
208
+ return `HTTP request: ${prettyUrl(urlOriginal)}`;
209
209
  }
210
210
  function logHttpResponse(urlOriginal, httpRequestId, pageContextReturn) {
211
211
  const statusCode = pageContextReturn.httpResponse?.statusCode ?? null;
@@ -221,7 +221,7 @@ function logHttpResponse(urlOriginal, httpRequestId, pageContextReturn) {
221
221
  // - We should show `HTTP response ${urlOriginal} ERR` instead.
222
222
  // - Maybe we can/should make the error available at pageContext.errorWhileRendering
223
223
  (0, utils_js_1.assert)(errorWhileRendering === null || errorWhileRendering === undefined);
224
- msg = `HTTP response ${picocolors_1.default.bold(urlOriginal)} ${picocolors_1.default.dim('null')}`;
224
+ msg = `HTTP response ${prettyUrl(urlOriginal)} ${picocolors_1.default.dim('null')}`;
225
225
  // Erroneous value (it shoud sometimes be `false`) but it's fine as it doesn't seem to have much of an impact.
226
226
  isNominal = true;
227
227
  }
@@ -241,7 +241,7 @@ function logHttpResponse(urlOriginal, httpRequestId, pageContextReturn) {
241
241
  const urlRedirect = headerRedirect[1];
242
242
  urlOriginal = urlRedirect;
243
243
  }
244
- msg = `HTTP ${type} ${picocolors_1.default.bold(urlOriginal)} ${color(statusCode ?? 'ERR')}`;
244
+ msg = `HTTP ${type} ${prettyUrl(urlOriginal)} ${color(statusCode ?? 'ERR')}`;
245
245
  }
246
246
  }
247
247
  (0, loggerRuntime_js_1.logRuntimeInfo)?.(msg, httpRequestId, isNominal ? 'info' : 'error');
@@ -449,9 +449,12 @@ function checkBaseUrl(pageContextInit, httpRequestId) {
449
449
  const { urlWithoutPageContextRequestSuffix } = (0, handlePageContextRequestUrl_js_1.handlePageContextRequestUrl)(urlOriginal);
450
450
  const { hasBaseServer } = (0, utils_js_1.parseUrl)(urlWithoutPageContextRequestSuffix, baseServer);
451
451
  if (!hasBaseServer) {
452
- (0, loggerRuntime_js_1.logRuntimeInfo)?.(`${getRequestInfoMessage(urlOriginal)} skipped because URL ${picocolors_1.default.bold(urlOriginal)} doesn't start with Base URL ${picocolors_1.default.bold(baseServer)} (https://vike.dev/base-url)`, httpRequestId, 'info');
452
+ (0, loggerRuntime_js_1.logRuntimeInfo)?.(`${getRequestInfoMessage(urlOriginal)} skipped because URL ${prettyUrl(urlOriginal)} doesn't start with Base URL ${prettyUrl(baseServer)} (https://vike.dev/base-url)`, httpRequestId, 'info');
453
453
  const pageContextHttpResponseNull = getPageContextHttpResponseNull(pageContextInit);
454
454
  return pageContextHttpResponseNull;
455
455
  }
456
456
  return null;
457
457
  }
458
+ function prettyUrl(url) {
459
+ return picocolors_1.default.bold(decodeURI(url));
460
+ }
@@ -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.171-commit-2876124';
4
+ const PROJECT_VERSION = '0.4.172-commit-ea2b76c';
5
5
  exports.PROJECT_VERSION = PROJECT_VERSION;
6
6
  const projectInfo = {
7
7
  projectName: 'Vike',
@@ -1,5 +1,5 @@
1
1
  export { crawlPlusFiles };
2
- import { assertPosixPath, assert, toPosixPath, assertWarning, scriptFileExtensionList, scriptFileExtensions, humanizeTime, assertIsSingleModuleInstance, assertIsNotProductionRuntime, isVersionOrAbove } from '../../../../utils.js';
2
+ import { assertPosixPath, assert, assertWarning, scriptFileExtensionList, scriptFileExtensions, humanizeTime, assertIsSingleModuleInstance, assertIsNotProductionRuntime, isVersionOrAbove } from '../../../../utils.js';
3
3
  import path from 'path';
4
4
  import glob from 'fast-glob';
5
5
  import { exec } from 'child_process';
@@ -26,6 +26,7 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev) {
26
26
  //
27
27
  !outDirRelativeFromUserRootDir.startsWith('../')));
28
28
  const timeBefore = new Date().getTime();
29
+ // Crawl
29
30
  let files = [];
30
31
  const res = await gitLsFiles(userRootDir, outDirRelativeFromUserRootDir);
31
32
  if (res &&
@@ -36,7 +37,7 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev) {
36
37
  else {
37
38
  files = await fastGlob(userRootDir, outDirRelativeFromUserRootDir);
38
39
  }
39
- files = files.filter((file) => !isTemporaryBuildFile(file));
40
+ // Check performance
40
41
  {
41
42
  const timeAfter = new Date().getTime();
42
43
  const timeSpent = timeAfter - timeBefore;
@@ -48,10 +49,13 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev) {
48
49
  });
49
50
  }
50
51
  }
51
- const plusFiles = files.map((p) => {
52
- p = toPosixPath(p);
53
- assert(!p.startsWith(userRootDir));
54
- const filePathAbsoluteUserRootDir = path.posix.join('/', p);
52
+ // Normalize
53
+ const plusFiles = files.map((filePath) => {
54
+ // Both `$ git-ls files` and fast-glob return posix paths
55
+ assertPosixPath(filePath);
56
+ assert(!filePath.startsWith(userRootDir));
57
+ assert(!isTemporaryBuildFile(filePath));
58
+ const filePathAbsoluteUserRootDir = path.posix.join('/', filePath);
55
59
  return { filePathAbsoluteUserRootDir };
56
60
  });
57
61
  return plusFiles;
@@ -60,10 +64,17 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev) {
60
64
  async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
61
65
  if (gitIsNotUsable)
62
66
  return null;
67
+ // Preserve UTF-8 file paths.
68
+ // https://github.com/vikejs/vike/issues/1658
69
+ // https://stackoverflow.com/questions/22827239/how-to-make-git-properly-display-utf-8-encoded-pathnames-in-the-console-window/22828826#22828826
70
+ // https://stackoverflow.com/questions/15884180/how-do-i-override-git-configuration-options-by-command-line-parameters/15884261#15884261
71
+ const preserveUTF8 = '-c core.quotepath=off';
63
72
  const ignoreAsPatterns = getIgnoreAsPatterns(outDirRelativeFromUserRootDir);
64
73
  const ignoreAsFilterFn = getIgnoreAsFilterFn(outDirRelativeFromUserRootDir);
65
74
  const cmd = [
66
- 'git ls-files',
75
+ 'git',
76
+ preserveUTF8,
77
+ 'ls-files',
67
78
  ...scriptFileExtensionList.map((ext) => `"**/+*.${ext}"`),
68
79
  ...ignoreAsPatterns.map((pattern) => `--exclude="${pattern}"`),
69
80
  // --others lists untracked files only (but using .gitignore because --exclude-standard)
@@ -199,7 +199,7 @@ function logHttpRequest(urlOriginal, httpRequestId) {
199
199
  logRuntimeInfo?.(getRequestInfoMessage(urlOriginal), httpRequestId, 'info', clearErrors);
200
200
  }
201
201
  function getRequestInfoMessage(urlOriginal) {
202
- return `HTTP request: ${pc.bold(urlOriginal)}`;
202
+ return `HTTP request: ${prettyUrl(urlOriginal)}`;
203
203
  }
204
204
  function logHttpResponse(urlOriginal, httpRequestId, pageContextReturn) {
205
205
  const statusCode = pageContextReturn.httpResponse?.statusCode ?? null;
@@ -215,7 +215,7 @@ function logHttpResponse(urlOriginal, httpRequestId, pageContextReturn) {
215
215
  // - We should show `HTTP response ${urlOriginal} ERR` instead.
216
216
  // - Maybe we can/should make the error available at pageContext.errorWhileRendering
217
217
  assert(errorWhileRendering === null || errorWhileRendering === undefined);
218
- msg = `HTTP response ${pc.bold(urlOriginal)} ${pc.dim('null')}`;
218
+ msg = `HTTP response ${prettyUrl(urlOriginal)} ${pc.dim('null')}`;
219
219
  // Erroneous value (it shoud sometimes be `false`) but it's fine as it doesn't seem to have much of an impact.
220
220
  isNominal = true;
221
221
  }
@@ -235,7 +235,7 @@ function logHttpResponse(urlOriginal, httpRequestId, pageContextReturn) {
235
235
  const urlRedirect = headerRedirect[1];
236
236
  urlOriginal = urlRedirect;
237
237
  }
238
- msg = `HTTP ${type} ${pc.bold(urlOriginal)} ${color(statusCode ?? 'ERR')}`;
238
+ msg = `HTTP ${type} ${prettyUrl(urlOriginal)} ${color(statusCode ?? 'ERR')}`;
239
239
  }
240
240
  }
241
241
  logRuntimeInfo?.(msg, httpRequestId, isNominal ? 'info' : 'error');
@@ -443,9 +443,12 @@ function checkBaseUrl(pageContextInit, httpRequestId) {
443
443
  const { urlWithoutPageContextRequestSuffix } = handlePageContextRequestUrl(urlOriginal);
444
444
  const { hasBaseServer } = parseUrl(urlWithoutPageContextRequestSuffix, baseServer);
445
445
  if (!hasBaseServer) {
446
- logRuntimeInfo?.(`${getRequestInfoMessage(urlOriginal)} skipped because URL ${pc.bold(urlOriginal)} doesn't start with Base URL ${pc.bold(baseServer)} (https://vike.dev/base-url)`, httpRequestId, 'info');
446
+ logRuntimeInfo?.(`${getRequestInfoMessage(urlOriginal)} skipped because URL ${prettyUrl(urlOriginal)} doesn't start with Base URL ${prettyUrl(baseServer)} (https://vike.dev/base-url)`, httpRequestId, 'info');
447
447
  const pageContextHttpResponseNull = getPageContextHttpResponseNull(pageContextInit);
448
448
  return pageContextHttpResponseNull;
449
449
  }
450
450
  return null;
451
451
  }
452
+ function prettyUrl(url) {
453
+ return pc.bold(decodeURI(url));
454
+ }
@@ -1,7 +1,7 @@
1
1
  export { projectInfo };
2
2
  export { PROJECT_VERSION };
3
- declare const PROJECT_VERSION: "0.4.171-commit-2876124";
3
+ declare const PROJECT_VERSION: "0.4.172-commit-ea2b76c";
4
4
  declare const projectInfo: {
5
5
  projectName: "Vike";
6
- projectVersion: "0.4.171-commit-2876124";
6
+ projectVersion: "0.4.172-commit-ea2b76c";
7
7
  };
@@ -1,6 +1,6 @@
1
1
  export { projectInfo };
2
2
  export { PROJECT_VERSION };
3
- const PROJECT_VERSION = '0.4.171-commit-2876124';
3
+ const PROJECT_VERSION = '0.4.172-commit-ea2b76c';
4
4
  const projectInfo = {
5
5
  projectName: 'Vike',
6
6
  projectVersion: PROJECT_VERSION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.171-commit-2876124",
3
+ "version": "0.4.172-commit-ea2b76c",
4
4
  "scripts": {
5
5
  "dev": "tsc --watch",
6
6
  "build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",
@@ -195,7 +195,7 @@
195
195
  "@brillout/import": "^0.2.3",
196
196
  "@brillout/json-serializer": "^0.5.8",
197
197
  "@brillout/picocolors": "^1.0.10",
198
- "@brillout/release-me": "^0.3.7",
198
+ "@brillout/release-me": "^0.3.8",
199
199
  "@brillout/require-shim": "^0.1.2",
200
200
  "@brillout/vite-plugin-server-entry": "^0.4.0",
201
201
  "@types/estree": "^1.0.5",