vike 0.4.183-commit-38f60f1 → 0.4.184

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.
Files changed (33) hide show
  1. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +1 -1
  2. package/dist/cjs/node/plugin/utils.js +1 -1
  3. package/dist/cjs/node/runtime/html/stream.js +6 -4
  4. package/dist/cjs/node/runtime/utils.js +2 -0
  5. package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
  6. package/dist/cjs/utils/includes.js +14 -0
  7. package/dist/cjs/utils/objectEntries.js +9 -0
  8. package/dist/cjs/utils/objectEntriesForEach.js +8 -0
  9. package/dist/cjs/utils/objectFromEntries.js +8 -0
  10. package/dist/cjs/utils/objectKeys.js +1 -21
  11. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +2 -2
  12. package/dist/esm/node/plugin/utils.d.ts +1 -1
  13. package/dist/esm/node/plugin/utils.js +1 -1
  14. package/dist/esm/node/runtime/html/stream.js +6 -4
  15. package/dist/esm/node/runtime/utils.d.ts +2 -0
  16. package/dist/esm/node/runtime/utils.js +2 -0
  17. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  18. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  19. package/dist/esm/utils/includes.d.ts +2 -0
  20. package/dist/esm/utils/includes.js +10 -0
  21. package/dist/esm/utils/objectEntries.d.ts +2 -0
  22. package/dist/esm/utils/objectEntries.js +5 -0
  23. package/dist/esm/utils/objectEntriesForEach.d.ts +2 -0
  24. package/dist/esm/utils/objectEntriesForEach.js +4 -0
  25. package/dist/esm/utils/objectFromEntries.d.ts +2 -0
  26. package/dist/esm/utils/objectFromEntries.js +4 -0
  27. package/dist/esm/utils/objectKeys.d.ts +1 -8
  28. package/dist/esm/utils/objectKeys.js +1 -22
  29. package/dist/esm/utils/projectInfo.d.ts +1 -1
  30. package/package.json +1 -1
  31. package/dist/cjs/utils/arrayIncludes.js +0 -7
  32. package/dist/esm/utils/arrayIncludes.d.ts +0 -1
  33. package/dist/esm/utils/arrayIncludes.js +0 -3
@@ -976,7 +976,7 @@ function isGlobalConfig(configName) {
976
976
  if (configName === 'prerender')
977
977
  return false;
978
978
  const configNamesGlobal = getConfigNamesGlobal();
979
- return (0, utils_js_1.arrayIncludes)(configNamesGlobal, configName);
979
+ return (0, utils_js_1.includes)(configNamesGlobal, configName);
980
980
  }
981
981
  function getConfigNamesGlobal() {
982
982
  return Object.keys(configDefinitionsBuiltIn_js_1.configDefinitionsBuiltInGlobal);
@@ -23,7 +23,7 @@ __exportStar(require("../runtime/utils.js"), exports);
23
23
  // Utils only needed by `plugin/*`
24
24
  __exportStar(require("../../utils/viteIsSSR.js"), exports);
25
25
  __exportStar(require("../../utils/requireResolve.js"), exports);
26
- __exportStar(require("../../utils/arrayIncludes.js"), exports);
26
+ __exportStar(require("../../utils/includes.js"), exports);
27
27
  __exportStar(require("../../utils/isDev.js"), exports);
28
28
  __exportStar(require("../../utils/getMostSimilar.js"), exports);
29
29
  __exportStar(require("../../utils/getRandomId.js"), exports);
@@ -43,15 +43,17 @@ async function streamReadableNodeToString(readableNode) {
43
43
  });
44
44
  }
45
45
  async function streamReadableWebToString(readableWeb) {
46
- let str = '';
47
46
  const reader = readableWeb.getReader();
47
+ const decoder = new TextDecoder();
48
+ let str = '';
48
49
  while (true) {
49
50
  const { done, value } = await reader.read();
50
- if (done) {
51
+ if (done)
51
52
  break;
52
- }
53
- str += value;
53
+ str += decoder.decode(value, { stream: true });
54
54
  }
55
+ // https://github.com/vikejs/vike/pull/1799#discussion_r1713554096
56
+ str += decoder.decode();
55
57
  return str;
56
58
  }
57
59
  exports.streamReadableWebToString = streamReadableWebToString;
@@ -55,6 +55,8 @@ __exportStar(require("../../utils/isNotNullish.js"), exports);
55
55
  __exportStar(require("../../utils/isScriptFile.js"), exports);
56
56
  __exportStar(require("../../utils/removeFileExtention.js"), exports);
57
57
  __exportStar(require("../../utils/objectKeys.js"), exports);
58
+ __exportStar(require("../../utils/objectEntries.js"), exports);
59
+ __exportStar(require("../../utils/objectFromEntries.js"), exports);
58
60
  __exportStar(require("../../utils/getFileExtension.js"), exports);
59
61
  __exportStar(require("../../utils/assertIsNotProductionRuntime.js"), exports);
60
62
  __exportStar(require("../../utils/virtual-files.js"), exports);
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROJECT_VERSION = void 0;
4
4
  // Automatically updated by @brillout/release-me
5
- exports.PROJECT_VERSION = '0.4.183-commit-38f60f1';
5
+ exports.PROJECT_VERSION = '0.4.184';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.includes = void 0;
4
+ // https://stackoverflow.com/questions/56565528/typescript-const-assertions-how-to-use-array-prototype-includes/74213179#74213179
5
+ /** Same as Array.prototype.includes() but with type inference */
6
+ function includes(values, x) {
7
+ return values.includes(x);
8
+ }
9
+ exports.includes = includes;
10
+ /*
11
+ export function includes<Arr extends any[] | readonly any[]>(arr: Arr, el: unknown): el is Arr[number] {
12
+ return arr.includes(el as any)
13
+ }
14
+ */
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.objectEntries = void 0;
4
+ // https://stackoverflow.com/questions/60141960/typescript-key-value-relation-preserving-object-entries-type/75337277#75337277
5
+ /** Same as Object.entries() but with type inference */
6
+ function objectEntries(obj) {
7
+ return Object.entries(obj);
8
+ }
9
+ exports.objectEntries = objectEntries;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.objectEntriesForEach = void 0;
4
+ /** Same as Object.entries().forEach() but with type inference */
5
+ function objectEntriesForEach(obj, iterator) {
6
+ Object.entries(obj).forEach(([key, val]) => iterator(key, val));
7
+ }
8
+ exports.objectEntriesForEach = objectEntriesForEach;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.objectFromEntries = void 0;
4
+ /** Same as Object.fromEntries() but with type inference */
5
+ function objectFromEntries(arr) {
6
+ return Object.fromEntries(arr);
7
+ }
8
+ exports.objectFromEntries = objectFromEntries;
@@ -1,18 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.objectKeys = exports.objectFromEntries = exports.objectEntries = void 0;
4
- // export { forEach }
5
- // https://stackoverflow.com/questions/60141960/typescript-key-value-relation-preserving-object-entries-type/75337277#75337277
6
- /** Same as Object.entries() but with type inference */
7
- function objectEntries(obj) {
8
- return Object.entries(obj);
9
- }
10
- exports.objectEntries = objectEntries;
11
- /** Same as Object.fromEntries() but with type inference */
12
- function objectFromEntries(arr) {
13
- return Object.fromEntries(arr);
14
- }
15
- exports.objectFromEntries = objectFromEntries;
3
+ exports.objectKeys = void 0;
16
4
  // https://stackoverflow.com/questions/52856496/typescript-object-keys-return-string
17
5
  // https://github.com/sindresorhus/ts-extras/blob/main/source/object-keys.ts
18
6
  /** Same as Object.keys() but with type inference */
@@ -20,11 +8,3 @@ function objectKeys(obj) {
20
8
  return Object.keys(obj);
21
9
  }
22
10
  exports.objectKeys = objectKeys;
23
- /* Not used yet, but can be quite useful.
24
- function forEach<Obj extends object>(
25
- obj: Obj,
26
- iterator: <Key extends keyof Obj>(key: Key, val: Obj[Key]) => void
27
- ): void {
28
- Object.entries(obj).forEach(([key, val]) => iterator(key as keyof Obj, val))
29
- }
30
- //*/
@@ -4,7 +4,7 @@ export { vikeConfigDependencies };
4
4
  export { isVikeConfigFile };
5
5
  export { isV1Design };
6
6
  export { getConfigValueInterfaceFile };
7
- import { assertPosixPath, assert, isObject, assertUsage, assertWarning, objectEntries, hasProp, arrayIncludes, assertIsNotProductionRuntime, getMostSimilar, joinEnglish, lowerFirst, getOutDirs, assertKeys, objectKeys, objectFromEntries, makeFirst, isNpmPackageImport, reverse } from '../../../utils.js';
7
+ import { assertPosixPath, assert, isObject, assertUsage, assertWarning, objectEntries, hasProp, includes, assertIsNotProductionRuntime, getMostSimilar, joinEnglish, lowerFirst, getOutDirs, assertKeys, objectKeys, objectFromEntries, makeFirst, isNpmPackageImport, reverse } from '../../../utils.js';
8
8
  import path from 'path';
9
9
  import { configDefinitionsBuiltIn, configDefinitionsBuiltInGlobal } from './getVikeConfig/configDefinitionsBuiltIn.js';
10
10
  import { getLocationId, getFilesystemRouteString, getFilesystemRouteDefinedBy, isInherited, sortAfterInheritanceOrder, isGlobalLocation, applyFilesystemRoutingRootEffect } from './getVikeConfig/filesystemRouting.js';
@@ -971,7 +971,7 @@ function isGlobalConfig(configName) {
971
971
  if (configName === 'prerender')
972
972
  return false;
973
973
  const configNamesGlobal = getConfigNamesGlobal();
974
- return arrayIncludes(configNamesGlobal, configName);
974
+ return includes(configNamesGlobal, configName);
975
975
  }
976
976
  function getConfigNamesGlobal() {
977
977
  return Object.keys(configDefinitionsBuiltInGlobal);
@@ -1,7 +1,7 @@
1
1
  export * from '../runtime/utils.js';
2
2
  export * from '../../utils/viteIsSSR.js';
3
3
  export * from '../../utils/requireResolve.js';
4
- export * from '../../utils/arrayIncludes.js';
4
+ export * from '../../utils/includes.js';
5
5
  export * from '../../utils/isDev.js';
6
6
  export * from '../../utils/getMostSimilar.js';
7
7
  export * from '../../utils/getRandomId.js';
@@ -7,7 +7,7 @@ export * from '../runtime/utils.js';
7
7
  // Utils only needed by `plugin/*`
8
8
  export * from '../../utils/viteIsSSR.js';
9
9
  export * from '../../utils/requireResolve.js';
10
- export * from '../../utils/arrayIncludes.js';
10
+ export * from '../../utils/includes.js';
11
11
  export * from '../../utils/isDev.js';
12
12
  export * from '../../utils/getMostSimilar.js';
13
13
  export * from '../../utils/getRandomId.js';
@@ -54,15 +54,17 @@ async function streamReadableNodeToString(readableNode) {
54
54
  });
55
55
  }
56
56
  async function streamReadableWebToString(readableWeb) {
57
- let str = '';
58
57
  const reader = readableWeb.getReader();
58
+ const decoder = new TextDecoder();
59
+ let str = '';
59
60
  while (true) {
60
61
  const { done, value } = await reader.read();
61
- if (done) {
62
+ if (done)
62
63
  break;
63
- }
64
- str += value;
64
+ str += decoder.decode(value, { stream: true });
65
65
  }
66
+ // https://github.com/vikejs/vike/pull/1799#discussion_r1713554096
67
+ str += decoder.decode();
66
68
  return str;
67
69
  }
68
70
  async function stringToStreamReadableNode(str) {
@@ -36,6 +36,8 @@ export * from '../../utils/isNotNullish.js';
36
36
  export * from '../../utils/isScriptFile.js';
37
37
  export * from '../../utils/removeFileExtention.js';
38
38
  export * from '../../utils/objectKeys.js';
39
+ export * from '../../utils/objectEntries.js';
40
+ export * from '../../utils/objectFromEntries.js';
39
41
  export * from '../../utils/getFileExtension.js';
40
42
  export * from '../../utils/assertIsNotProductionRuntime.js';
41
43
  export * from '../../utils/virtual-files.js';
@@ -39,6 +39,8 @@ export * from '../../utils/isNotNullish.js';
39
39
  export * from '../../utils/isScriptFile.js';
40
40
  export * from '../../utils/removeFileExtention.js';
41
41
  export * from '../../utils/objectKeys.js';
42
+ export * from '../../utils/objectEntries.js';
43
+ export * from '../../utils/objectFromEntries.js';
42
44
  export * from '../../utils/getFileExtension.js';
43
45
  export * from '../../utils/assertIsNotProductionRuntime.js';
44
46
  export * from '../../utils/virtual-files.js';
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.183-commit-38f60f1";
1
+ export declare const PROJECT_VERSION: "0.4.184";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.183-commit-38f60f1';
2
+ export const PROJECT_VERSION = '0.4.184';
@@ -0,0 +1,2 @@
1
+ /** Same as Array.prototype.includes() but with type inference */
2
+ export declare function includes<T>(values: readonly T[], x: unknown): x is T;
@@ -0,0 +1,10 @@
1
+ // https://stackoverflow.com/questions/56565528/typescript-const-assertions-how-to-use-array-prototype-includes/74213179#74213179
2
+ /** Same as Array.prototype.includes() but with type inference */
3
+ export function includes(values, x) {
4
+ return values.includes(x);
5
+ }
6
+ /*
7
+ export function includes<Arr extends any[] | readonly any[]>(arr: Arr, el: unknown): el is Arr[number] {
8
+ return arr.includes(el as any)
9
+ }
10
+ */
@@ -0,0 +1,2 @@
1
+ /** Same as Object.entries() but with type inference */
2
+ export declare function objectEntries<T extends object>(obj: T): [keyof T, T[keyof T]][];
@@ -0,0 +1,5 @@
1
+ // https://stackoverflow.com/questions/60141960/typescript-key-value-relation-preserving-object-entries-type/75337277#75337277
2
+ /** Same as Object.entries() but with type inference */
3
+ export function objectEntries(obj) {
4
+ return Object.entries(obj);
5
+ }
@@ -0,0 +1,2 @@
1
+ /** Same as Object.entries().forEach() but with type inference */
2
+ export declare function objectEntriesForEach<Obj extends object>(obj: Obj, iterator: <Key extends keyof Obj>(key: Key, val: Obj[Key]) => void): void;
@@ -0,0 +1,4 @@
1
+ /** Same as Object.entries().forEach() but with type inference */
2
+ export function objectEntriesForEach(obj, iterator) {
3
+ Object.entries(obj).forEach(([key, val]) => iterator(key, val));
4
+ }
@@ -0,0 +1,2 @@
1
+ /** Same as Object.fromEntries() but with type inference */
2
+ export declare function objectFromEntries<T extends [PropertyKey, unknown][]>(arr: T): Record<T[number][0], T[number][1]>;
@@ -0,0 +1,4 @@
1
+ /** Same as Object.fromEntries() but with type inference */
2
+ export function objectFromEntries(arr) {
3
+ return Object.fromEntries(arr);
4
+ }
@@ -1,9 +1,2 @@
1
- export { objectEntries };
2
- export { objectFromEntries };
3
- export { objectKeys };
4
- /** Same as Object.entries() but with type inference */
5
- declare function objectEntries<T extends object>(obj: T): [keyof T, T[keyof T]][];
6
- /** Same as Object.fromEntries() but with type inference */
7
- declare function objectFromEntries<T extends [PropertyKey, unknown][]>(arr: T): Record<T[number][0], T[number][1]>;
8
1
  /** Same as Object.keys() but with type inference */
9
- declare function objectKeys<T extends object>(obj: T): (keyof T)[];
2
+ export declare function objectKeys<T extends object>(obj: T): (keyof T)[];
@@ -1,27 +1,6 @@
1
- export { objectEntries };
2
- export { objectFromEntries };
3
- export { objectKeys };
4
- // export { forEach }
5
- // https://stackoverflow.com/questions/60141960/typescript-key-value-relation-preserving-object-entries-type/75337277#75337277
6
- /** Same as Object.entries() but with type inference */
7
- function objectEntries(obj) {
8
- return Object.entries(obj);
9
- }
10
- /** Same as Object.fromEntries() but with type inference */
11
- function objectFromEntries(arr) {
12
- return Object.fromEntries(arr);
13
- }
14
1
  // https://stackoverflow.com/questions/52856496/typescript-object-keys-return-string
15
2
  // https://github.com/sindresorhus/ts-extras/blob/main/source/object-keys.ts
16
3
  /** Same as Object.keys() but with type inference */
17
- function objectKeys(obj) {
4
+ export function objectKeys(obj) {
18
5
  return Object.keys(obj);
19
6
  }
20
- /* Not used yet, but can be quite useful.
21
- function forEach<Obj extends object>(
22
- obj: Obj,
23
- iterator: <Key extends keyof Obj>(key: Key, val: Obj[Key]) => void
24
- ): void {
25
- Object.entries(obj).forEach(([key, val]) => iterator(key as keyof Obj, val))
26
- }
27
- //*/
@@ -1,4 +1,4 @@
1
1
  export declare const projectInfo: {
2
2
  projectName: "Vike";
3
- projectVersion: "0.4.183-commit-38f60f1";
3
+ projectVersion: "0.4.184";
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.183-commit-38f60f1",
3
+ "version": "0.4.184",
4
4
  "scripts": {
5
5
  "dev": "tsc --watch",
6
6
  "build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.arrayIncludes = void 0;
4
- function arrayIncludes(arr, el) {
5
- return arr.includes(el);
6
- }
7
- exports.arrayIncludes = arrayIncludes;
@@ -1 +0,0 @@
1
- export declare function arrayIncludes<Arr extends any[] | readonly any[]>(arr: Arr, el: unknown): el is Arr[number];
@@ -1,3 +0,0 @@
1
- export function arrayIncludes(arr, el) {
2
- return arr.includes(el);
3
- }