vike 0.4.153-commit-e631897 → 0.4.154

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.
@@ -9,6 +9,7 @@ const path_1 = __importDefault(require("path"));
9
9
  const fast_glob_1 = __importDefault(require("fast-glob"));
10
10
  const child_process_1 = require("child_process");
11
11
  const util_1 = require("util");
12
+ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
12
13
  const execA = (0, util_1.promisify)(child_process_1.exec);
13
14
  const globalObject = (0, utils_js_1.getGlobalObject)('crawlPlusFiles.ts', {
14
15
  gitIsMissing: false
@@ -38,7 +39,8 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev) {
38
39
  const timeSpent = timeAfter - timeBefore;
39
40
  if (isDev) {
40
41
  // We only warn in dev, because while building it's expected to take a long time as crawling is competing for resources with other tasks.
41
- (0, utils_js_1.assertWarning)(timeSpent < 2 * 1000, `Crawling your user files took an unexpected long time (${timeSpent}ms). Create a new issue on Vike's GitHub.`, {
42
+ // Although, in dev, it's also competing for resources e.g. with Vite's `optimizeDeps`.
43
+ (0, utils_js_1.assertWarning)(timeSpent < 3 * 1000, `Crawling your ${picocolors_1.default.cyan('+')} files took an unexpected long time (${(0, utils_js_1.humanizeTime)(timeSpent)}). If you repeatedly get this warning, then consider creating a new issue on Vike's GitHub.`, {
42
44
  onlyOnce: 'slow-page-files-search'
43
45
  });
44
46
  }
@@ -160,6 +160,7 @@ function handleAssertMsg(err, category) {
160
160
  return true;
161
161
  }
162
162
  function assertLogger(thing, logType) {
163
+ // vite.ssrFixStacktrace() is needed for `assertWarning(..., { showStackTrace: true })`
163
164
  (0, log_js_1.applyViteSourceMapToStackTrace)(thing);
164
165
  const category = getCategory();
165
166
  const res = (0, utils_js_1.getAssertErrMsg)(thing);
@@ -41,3 +41,4 @@ __exportStar(require("../../utils/mergeCumulativeValues.js"), exports);
41
41
  __exportStar(require("../../utils/deepEqual.js"), exports);
42
42
  __exportStar(require("../../utils/assertKeys.js"), exports);
43
43
  __exportStar(require("../../utils/injectRollupInputs.js"), exports);
44
+ __exportStar(require("../../utils/humanizeTime.js"), exports);
@@ -2,10 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getGlobalObject = void 0;
4
4
  function getGlobalObject(
5
- // We use the filename as key; each `getGlobalObject()` call should live in a unique filename.
5
+ // We use the filename as key; each `getGlobalObject()` call should live inside a file with a unique filename.
6
6
  key, defaultValue) {
7
- const allGlobalObjects = (globalThis.__vike = globalThis.__vike || {});
8
- const globalObject = (allGlobalObjects[key] = allGlobalObjects[key] || defaultValue);
7
+ // @ts-ignore
8
+ const globalObjectsAll = (globalThis[projectKey] = globalThis[projectKey] || {});
9
+ const globalObject = (globalObjectsAll[key] = globalObjectsAll[key] || defaultValue);
9
10
  return globalObject;
10
11
  }
11
12
  exports.getGlobalObject = getGlobalObject;
13
+ const projectKey = '_vike';
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROJECT_VERSION = exports.projectInfo = void 0;
4
4
  const assertSingleInstance_js_1 = require("./assertSingleInstance.js");
5
- const PROJECT_VERSION = '0.4.153-commit-e631897';
5
+ const PROJECT_VERSION = '0.4.154';
6
6
  exports.PROJECT_VERSION = PROJECT_VERSION;
7
7
  const projectInfo = {
8
8
  projectName: 'Vike',
@@ -1,9 +1,10 @@
1
1
  export { crawlPlusFiles };
2
- import { assertPosixPath, assert, toPosixPath, assertWarning, scriptFileExtensionList, scriptFileExtensions, getGlobalObject } from '../../../../utils.js';
2
+ import { assertPosixPath, assert, toPosixPath, assertWarning, scriptFileExtensionList, scriptFileExtensions, getGlobalObject, humanizeTime } from '../../../../utils.js';
3
3
  import path from 'path';
4
4
  import glob from 'fast-glob';
5
5
  import { exec } from 'child_process';
6
6
  import { promisify } from 'util';
7
+ import pc from '@brillout/picocolors';
7
8
  const execA = promisify(exec);
8
9
  const globalObject = getGlobalObject('crawlPlusFiles.ts', {
9
10
  gitIsMissing: false
@@ -33,7 +34,8 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev) {
33
34
  const timeSpent = timeAfter - timeBefore;
34
35
  if (isDev) {
35
36
  // We only warn in dev, because while building it's expected to take a long time as crawling is competing for resources with other tasks.
36
- assertWarning(timeSpent < 2 * 1000, `Crawling your user files took an unexpected long time (${timeSpent}ms). Create a new issue on Vike's GitHub.`, {
37
+ // Although, in dev, it's also competing for resources e.g. with Vite's `optimizeDeps`.
38
+ assertWarning(timeSpent < 3 * 1000, `Crawling your ${pc.cyan('+')} files took an unexpected long time (${humanizeTime(timeSpent)}). If you repeatedly get this warning, then consider creating a new issue on Vike's GitHub.`, {
37
39
  onlyOnce: 'slow-page-files-search'
38
40
  });
39
41
  }
@@ -156,6 +156,7 @@ function handleAssertMsg(err, category) {
156
156
  return true;
157
157
  }
158
158
  function assertLogger(thing, logType) {
159
+ // vite.ssrFixStacktrace() is needed for `assertWarning(..., { showStackTrace: true })`
159
160
  applyViteSourceMapToStackTrace(thing);
160
161
  const category = getCategory();
161
162
  const res = getAssertErrMsg(thing);
@@ -19,3 +19,4 @@ export * from '../../utils/mergeCumulativeValues.js';
19
19
  export * from '../../utils/deepEqual.js';
20
20
  export * from '../../utils/assertKeys.js';
21
21
  export * from '../../utils/injectRollupInputs.js';
22
+ export * from '../../utils/humanizeTime.js';
@@ -25,3 +25,4 @@ export * from '../../utils/mergeCumulativeValues.js';
25
25
  export * from '../../utils/deepEqual.js';
26
26
  export * from '../../utils/assertKeys.js';
27
27
  export * from '../../utils/injectRollupInputs.js';
28
+ export * from '../../utils/humanizeTime.js';
@@ -1,4 +1 @@
1
1
  export declare function getGlobalObject<T extends Record<string, unknown> = never>(key: `${string}.ts`, defaultValue: T): T;
2
- declare global {
3
- var __vike: undefined | Record<string, Record<string, unknown>>;
4
- }
@@ -1,7 +1,9 @@
1
1
  export function getGlobalObject(
2
- // We use the filename as key; each `getGlobalObject()` call should live in a unique filename.
2
+ // We use the filename as key; each `getGlobalObject()` call should live inside a file with a unique filename.
3
3
  key, defaultValue) {
4
- const allGlobalObjects = (globalThis.__vike = globalThis.__vike || {});
5
- const globalObject = (allGlobalObjects[key] = allGlobalObjects[key] || defaultValue);
4
+ // @ts-ignore
5
+ const globalObjectsAll = (globalThis[projectKey] = globalThis[projectKey] || {});
6
+ const globalObject = (globalObjectsAll[key] = globalObjectsAll[key] || defaultValue);
6
7
  return globalObject;
7
8
  }
9
+ const projectKey = '_vike';
@@ -1,13 +1,13 @@
1
1
  export { projectInfo };
2
2
  export type { ProjectTag };
3
3
  export { PROJECT_VERSION };
4
- declare const PROJECT_VERSION: "0.4.153-commit-e631897";
4
+ declare const PROJECT_VERSION: "0.4.154";
5
5
  type PackageName = typeof projectInfo.npmPackageName;
6
6
  type ProjectVersion = typeof projectInfo.projectVersion;
7
7
  type ProjectTag = `[${PackageName}]` | `[${PackageName}@${ProjectVersion}]`;
8
8
  declare const projectInfo: {
9
9
  projectName: "Vike";
10
- projectVersion: "0.4.153-commit-e631897";
10
+ projectVersion: "0.4.154";
11
11
  npmPackageName: "vike";
12
12
  githubRepository: "https://github.com/vikejs/vike";
13
13
  };
@@ -1,7 +1,7 @@
1
1
  export { projectInfo };
2
2
  export { PROJECT_VERSION };
3
3
  import { onProjectInfo } from './assertSingleInstance.js';
4
- const PROJECT_VERSION = '0.4.153-commit-e631897';
4
+ const PROJECT_VERSION = '0.4.154';
5
5
  const projectInfo = {
6
6
  projectName: 'Vike',
7
7
  projectVersion: PROJECT_VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.153-commit-e631897",
3
+ "version": "0.4.154",
4
4
  "scripts": {
5
5
  "dev": "tsc --watch",
6
6
  "build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",
@@ -16,7 +16,7 @@
16
16
  "@brillout/json-serializer": "^0.5.8",
17
17
  "@brillout/picocolors": "^1.0.10",
18
18
  "@brillout/require-shim": "^0.1.2",
19
- "@brillout/vite-plugin-import-build": "^0.3.3",
19
+ "@brillout/vite-plugin-import-build": "^0.3.4",
20
20
  "acorn": "^8.0.0",
21
21
  "cac": "^6.0.0",
22
22
  "es-module-lexer": "^1.0.0",