vike-solid 0.7.9 → 0.7.11

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/+config.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ConfigEffect } from 'vike/types';
2
- import './Config-BdeNP4pN.js';
2
+ import './Config-Qtn-iVoW.js';
3
3
  import { JSX } from 'solid-js';
4
4
 
5
5
  declare function ssrEffect({ configDefinedAt, configValue }: Parameters<ConfigEffect>[0]): ReturnType<ConfigEffect>;
@@ -87,6 +87,7 @@ declare const _default: {
87
87
  env: {
88
88
  server: true;
89
89
  };
90
+ cumulative: true;
90
91
  };
91
92
  htmlAttributes: {
92
93
  env: {
package/dist/+config.js CHANGED
@@ -96,7 +96,8 @@ var _config = {
96
96
  stream: {
97
97
  env: {
98
98
  server: true
99
- }
99
+ },
100
+ cumulative: true
100
101
  },
101
102
  htmlAttributes: {
102
103
  env: {
@@ -1,4 +1,4 @@
1
- import { ImportString, PageContext, PageContextServer, PageContextClient } from 'vike/types';
1
+ import { ImportString, PageContext } from 'vike/types';
2
2
  import { JSX, Component } from 'solid-js';
3
3
 
4
4
  type TagAttributes = Record<string, string | number | boolean | undefined | null>;
@@ -128,11 +128,26 @@ declare global {
128
128
  */
129
129
  ssr?: boolean;
130
130
  /**
131
- * Enable or disable HTML Streaming.
131
+ * Settings for HTML Streaming.
132
132
  *
133
133
  * https://vike.dev/stream
134
134
  */
135
- stream?: boolean | "node" | "web";
135
+ stream?: boolean | "node" | "web" | {
136
+ /**
137
+ * Whether the HTML stream should be a Web Stream or a Node.js Stream.
138
+ *
139
+ * https://vike.dev/stream
140
+ */
141
+ type?: "node" | "web";
142
+ /**
143
+ * Setting +stream to `{ enable: null }` is the same as not setting +stream at all.
144
+ *
145
+ * Useful for changing stream settings without enabling streaming. For example, Vike extensions can set +stream to `{ enable: null, type: 'web' }` to change the default stream type without enabling streaming.
146
+ *
147
+ * https://vike.dev/stream
148
+ */
149
+ enable?: boolean | null;
150
+ };
136
151
  /**
137
152
  * Client-side hook called after the page is rendered.
138
153
  *
@@ -147,6 +162,7 @@ declare global {
147
162
  bodyAttributes?: TagAttributes[];
148
163
  htmlAttributes?: TagAttributes[];
149
164
  onAfterRenderClient?: Function[];
165
+ stream?: Exclude<Config["stream"], ImportString>[];
150
166
  }
151
167
  }
152
168
  }
@@ -1,4 +1,4 @@
1
- import { C as ConfigFromHook } from '../../Config-BdeNP4pN.js';
1
+ import { C as ConfigFromHook } from '../../Config-Qtn-iVoW.js';
2
2
  import 'vike/types';
3
3
  import 'solid-js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { C as ConfigFromHook } from '../../Config-BdeNP4pN.js';
1
+ import { C as ConfigFromHook } from '../../Config-Qtn-iVoW.js';
2
2
  import 'vike/types';
3
3
  import 'solid-js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { C as ConfigFromHook } from '../../Config-BdeNP4pN.js';
1
+ import { C as ConfigFromHook } from '../../Config-Qtn-iVoW.js';
2
2
  import 'vike/types';
3
3
  import 'solid-js';
4
4
 
@@ -14,7 +14,7 @@ function useConfig() {
14
14
  if (!("_headAlreadySet" in pageContext)) {
15
15
  setPageContextConfigFromHook(config, pageContext);
16
16
  } else {
17
- if (typeof window !== 'undefined') applyHead(config);
17
+ if (typeof window !== "undefined") applyHead(config);
18
18
  }
19
19
  };
20
20
  }
@@ -1,4 +1,4 @@
1
- import { C as ConfigFromHook } from '../../Config-BdeNP4pN.js';
1
+ import { C as ConfigFromHook } from '../../Config-Qtn-iVoW.js';
2
2
  import 'vike/types';
3
3
  import 'solid-js';
4
4
 
@@ -86,6 +86,18 @@ function ensureIsValidAttributeName(str) {
86
86
  throw new Error(`Invalid HTML tag attribute name ${JSON.stringify(str)}`);
87
87
  }
88
88
 
89
+ function isNullish(val) {
90
+ return val === null || val === undefined;
91
+ }
92
+ // someArray.filter(isNotNullish)
93
+ function isNotNullish(p) {
94
+ return !isNullish(p);
95
+ }
96
+
97
+ function isObject(value) {
98
+ return typeof value === "object" && value !== null;
99
+ }
100
+
89
101
  const onRenderHtml = async pageContext => {
90
102
  const pageHtml = await getPageHtml(pageContext);
91
103
  const headHtml = getHeadHtml(pageContext);
@@ -115,11 +127,12 @@ async function getPageHtml(pageContext) {
115
127
  // @ts-expect-error Property 'userAgent' does not exist on type
116
128
  pageContext.userAgent;
117
129
  if (pageContext.Page) {
130
+ const streamSetting = resolveStreamSetting(pageContext);
118
131
  if (userAgent && isBot(userAgent)) {
119
132
  pageHtml = dangerouslySkipEscape(await renderToStringAsync(() => getPageElement(pageContext)));
120
- } else if (!pageContext.config.stream) {
133
+ } else if (!streamSetting.enable) {
121
134
  pageHtml = dangerouslySkipEscape(renderToString(() => getPageElement(pageContext)));
122
- } else if (pageContext.config.stream === "web") {
135
+ } else if (streamSetting.type === "web") {
123
136
  pageHtml = renderToStream(() => getPageElement(pageContext), {
124
137
  onCompleteShell(info) {
125
138
  pageContext._stream ??= info;
@@ -213,5 +226,32 @@ function getViewportTag(viewport) {
213
226
  }
214
227
  return "";
215
228
  }
229
+ function resolveStreamSetting(pageContext) {
230
+ const {
231
+ stream
232
+ } = pageContext.config;
233
+ const streamSetting = {
234
+ type: null,
235
+ enable: null
236
+ };
237
+ stream?.reverse().filter(isNotNullish).forEach(setting => {
238
+ if (typeof setting === "boolean") {
239
+ streamSetting.enable = setting;
240
+ return;
241
+ }
242
+ if (typeof setting === "string") {
243
+ streamSetting.type = setting;
244
+ streamSetting.enable = true;
245
+ return;
246
+ }
247
+ if (isObject(setting)) {
248
+ if (setting.enable !== null) streamSetting.enable = setting.enable ?? true;
249
+ if (setting.type !== undefined) streamSetting.type = setting.type;
250
+ return;
251
+ }
252
+ throw new Error(`Unexpected +stream value ${setting}`);
253
+ });
254
+ return streamSetting;
255
+ }
216
256
 
217
257
  export { onRenderHtml };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike-solid",
3
- "version": "0.7.9",
3
+ "version": "0.7.11",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "isbot-fast": "^1.2.0",
@@ -12,22 +12,22 @@
12
12
  "vite": ">=5.0.0"
13
13
  },
14
14
  "devDependencies": {
15
- "@babel/core": "^7.26.9",
16
- "@babel/preset-env": "^7.26.9",
17
- "@babel/preset-typescript": "^7.26.0",
15
+ "@babel/core": "^7.27.1",
16
+ "@babel/preset-env": "^7.27.2",
17
+ "@babel/preset-typescript": "^7.27.1",
18
18
  "@brillout/release-me": "^0.4.3",
19
19
  "@rollup/plugin-babel": "^6.0.4",
20
- "@rollup/plugin-node-resolve": "^16.0.0",
20
+ "@rollup/plugin-node-resolve": "^16.0.1",
21
21
  "@types/node": "^22.10.10",
22
- "babel-preset-solid": "^1.9.5",
23
- "bumpp": "^10.0.3",
24
- "rollup": "^4.35.0",
25
- "rollup-plugin-dts": "^6.1.1",
26
- "solid-js": "^1.9.5",
22
+ "babel-preset-solid": "^1.9.6",
23
+ "bumpp": "^10.1.1",
24
+ "rollup": "^4.41.0",
25
+ "rollup-plugin-dts": "^6.2.1",
26
+ "solid-js": "^1.9.7",
27
27
  "tslib": "^2.8.1",
28
- "typescript": "^5.8.2",
29
- "vike": "^0.4.224",
30
- "vite": "^6.2.1"
28
+ "typescript": "^5.8.3",
29
+ "vike": "^0.4.229",
30
+ "vite": "^6.3.5"
31
31
  },
32
32
  "exports": {
33
33
  "./config": "./dist/+config.js",