vike-solid 0.8.3 → 0.8.4

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.
@@ -6,4 +6,4 @@ function assertWarning(condition, message) {
6
6
  console.warn(new Error(message));
7
7
  }
8
8
 
9
- export { assertWarning as a, assert as b };
9
+ export { assert as a, assertWarning as b };
@@ -3,7 +3,7 @@ import '../../hooks/usePageContext.js';
3
3
  import 'solid-js/web';
4
4
  import 'solid-js';
5
5
  import 'vike/getPageContext';
6
- import '../../includes-B0OUVLz0.js';
6
+ import '../../configsCumulative-VCpzeMWX.js';
7
7
 
8
8
  /**
9
9
  * Set configurations inside Solid components.
@@ -3,7 +3,7 @@ import '../../hooks/usePageContext.js';
3
3
  import 'solid-js/web';
4
4
  import 'solid-js';
5
5
  import 'vike/getPageContext';
6
- import '../../includes-B0OUVLz0.js';
6
+ import '../../configsCumulative-VCpzeMWX.js';
7
7
 
8
8
  /**
9
9
  * Add arbitrary `<head>` tags.
@@ -1,4 +1,9 @@
1
- const configsCumulative = ["Head", "bodyAttributes", "htmlAttributes"];
1
+ // https://stackoverflow.com/questions/52856496/typescript-object-keys-return-string
2
+ // https://github.com/sindresorhus/ts-extras/blob/main/source/object-keys.ts
3
+ /** Same as Object.keys() but with type inference */
4
+ function objectKeys(obj) {
5
+ return Object.keys(obj);
6
+ }
2
7
 
3
8
  // https://stackoverflow.com/questions/56565528/typescript-const-assertions-how-to-use-array-prototype-includes/74213179#74213179
4
9
  /** Same as Array.prototype.includes() but with type inference */
@@ -11,14 +16,9 @@ export function includes<Arr extends any[] | readonly any[]>(arr: Arr, el: unkno
11
16
  }
12
17
  */
13
18
 
19
+ const configsCumulative = ["Head", "bodyAttributes", "htmlAttributes"];
20
+
14
21
  // Settings the client-side applies upon navigation, see applyHeadSettings(). The others are HTML-only.
15
22
  const configsClientSide = ["title", "lang"];
16
23
 
17
- // https://stackoverflow.com/questions/52856496/typescript-object-keys-return-string
18
- // https://github.com/sindresorhus/ts-extras/blob/main/source/object-keys.ts
19
- /** Same as Object.keys() but with type inference */
20
- function objectKeys(obj) {
21
- return Object.keys(obj);
22
- }
23
-
24
- export { configsClientSide as a, configsCumulative as c, includes as i, objectKeys as o };
24
+ export { configsCumulative as a, configsClientSide as c, includes as i, objectKeys as o };
@@ -1,6 +1,6 @@
1
1
  import { createSignal, splitProps, sharedConfig, onMount, createMemo, untrack } from 'solid-js';
2
2
  import { isServer } from 'solid-js/web';
3
- import { a as assertWarning } from '../assert-DxoZsFMo.js';
3
+ import { b as assertWarning } from '../assert-Ti2177O-.js';
4
4
 
5
5
  // TO-DO/breaking-change: remove it
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { usePageContext } from '../usePageContext.js';
2
2
  import { getPageContext } from 'vike/getPageContext';
3
- import { i as includes, c as configsCumulative } from '../../includes-B0OUVLz0.js';
3
+ import { i as includes, c as configsCumulative } from '../../configsCumulative-VCpzeMWX.js';
4
4
  import 'solid-js/web';
5
5
  import 'solid-js';
6
6
 
@@ -11,6 +11,19 @@ function objectKeys(obj) {
11
11
  return Object.keys(obj);
12
12
  }
13
13
 
14
+ /**
15
+ * Escapes a JavaScript expression (e.g. the output of `JSON.stringify()`) so that it can be safely embedded inside an inline `<script>`.
16
+ *
17
+ * https://github.com/vikejs/vike/issues/3463
18
+ */
19
+ function escapeJavaScriptExpression(js) {
20
+ return js
21
+ // `<` is escaped so that the HTML parser never encounters `</script>` nor `<!--` inside the `<script>` — the JavaScript parser decodes `\u003c` back to `<`. (The input must be a JavaScript expression whose `<` only ever occurs inside string literals, such as `JSON.stringify()` output.)
22
+ .replace(/</g, "\\u003c")
23
+ // U+2028/U+2029 are escaped because a raw U+2028/U+2029 inside a JavaScript string literal is a syntax error in pre-ES2019 browsers.
24
+ .replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
25
+ }
26
+
14
27
  // Settings the client-side applies upon navigation, see applyHeadSettings(). The others are HTML-only.
15
28
  const configsClientSide = ["title", "lang"];
16
29
 
@@ -61,7 +74,8 @@ function apply(config, stream) {
61
74
  title
62
75
  } = config;
63
76
  if (title) {
64
- const htmlSnippet = `<script>document.title = ${JSON.stringify(title)}</script>`;
77
+ const titleJs = escapeJavaScriptExpression(JSON.stringify(title));
78
+ const htmlSnippet = `<script>document.title = ${titleJs}</script>`;
65
79
  stream.write(htmlSnippet);
66
80
  }
67
81
  }
@@ -1,5 +1,5 @@
1
1
  import { createComponent, memo, Dynamic, hydrate, render } from 'solid-js/web';
2
- import { i as includes, c as configsCumulative } from '../includes-B0OUVLz0.js';
2
+ import { i as includes, c as configsCumulative } from '../configsCumulative-VCpzeMWX.js';
3
3
  import { PageContextProvider, usePageContext } from '../hooks/usePageContext.js';
4
4
  import { createComputed, createComponent as createComponent$1 } from 'solid-js';
5
5
  import { createStore, reconcile } from 'solid-js/store';
@@ -2,7 +2,7 @@ import { createComponent, Dynamic, generateHydrationScript, renderToStringAsync,
2
2
  import isBot from 'isbot-fast';
3
3
  import { dangerouslySkipEscape, escapeInject, stampPipe } from 'vike/server';
4
4
  import { PageContextProvider, usePageContext } from '../hooks/usePageContext.js';
5
- import { i as includes, c as configsCumulative, o as objectKeys, a as configsClientSide } from '../objectKeys-DHdL2xFs.js';
5
+ import { i as includes, a as configsCumulative, o as objectKeys, c as configsClientSide } from '../configsClientSide-ByDxapiw.js';
6
6
  import { createComputed, createComponent as createComponent$1 } from 'solid-js';
7
7
  import { createStore, reconcile } from 'solid-js/store';
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike-solid",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "repository": "https://github.com/vikejs/vike-solid",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -12,10 +12,10 @@
12
12
  "vite-plugin-solid": "^2.11.10"
13
13
  },
14
14
  "devDependencies": {
15
- "@babel/core": "^7.29.7",
16
- "@babel/preset-env": "^7.29.7",
17
- "@babel/preset-typescript": "^7.29.7",
18
- "@brillout/release-me": "^0.4.15",
15
+ "@babel/core": "^8.0.1",
16
+ "@babel/preset-env": "^8.0.2",
17
+ "@babel/preset-typescript": "^8.0.1",
18
+ "@brillout/release-me": "^0.4.16",
19
19
  "@rollup/plugin-babel": "^7.1.0",
20
20
  "@rollup/plugin-node-resolve": "^16.0.3",
21
21
  "@types/node": "^22.19.7",
@@ -23,11 +23,11 @@
23
23
  "bumpp": "^11.1.0",
24
24
  "rollup": "^4.62.2",
25
25
  "rollup-plugin-dts": "^6.4.1",
26
- "solid-js": "^1.9.13",
26
+ "solid-js": "^1.9.14",
27
27
  "tslib": "^2.8.1",
28
28
  "typescript": "^6.0.3",
29
- "vike": "^0.4.259",
30
- "vite": "^8.0.16",
29
+ "vike": "^0.4.260",
30
+ "vite": "^8.1.3",
31
31
  "vite-plugin-solid": "^2.11.12"
32
32
  },
33
33
  "exports": {
@@ -1,5 +1,3 @@
1
- const configsCumulative = ["Head", "bodyAttributes", "htmlAttributes"];
2
-
3
1
  // https://stackoverflow.com/questions/56565528/typescript-const-assertions-how-to-use-array-prototype-includes/74213179#74213179
4
2
  /** Same as Array.prototype.includes() but with type inference */
5
3
  function includes(values, x) {
@@ -11,4 +9,6 @@ export function includes<Arr extends any[] | readonly any[]>(arr: Arr, el: unkno
11
9
  }
12
10
  */
13
11
 
12
+ const configsCumulative = ["Head", "bodyAttributes", "htmlAttributes"];
13
+
14
14
  export { configsCumulative as c, includes as i };