@solidjs/web 2.0.0-rc.4 → 2.0.0-rc.6
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/dev.cjs +163 -36
- package/dist/dev.js +161 -37
- package/dist/server.cjs +178 -37
- package/dist/server.js +177 -38
- package/dist/web.cjs +143 -36
- package/dist/web.js +141 -37
- package/frames/dist/client.cjs +41 -8
- package/frames/dist/client.dev.cjs +41 -8
- package/frames/dist/client.dev.js +41 -8
- package/frames/dist/client.js +41 -8
- package/frames/dist/server.cjs +497 -44
- package/frames/dist/server.js +497 -44
- package/package.json +2 -2
- package/serialization/dist/decode.cjs +4 -2
- package/serialization/dist/decode.js +4 -2
- package/serialization/dist/serialization.cjs +12 -8
- package/serialization/dist/serialization.js +12 -8
- package/serialization/types/index.d.ts +7 -0
- package/serialization/types/serializer-decode.d.ts +14 -1
- package/serialization/types/serializer.d.ts +7 -0
- package/serialization/types-cjs/index.d.cts +7 -0
- package/serialization/types-cjs/serializer-decode.d.cts +14 -1
- package/serialization/types-cjs/serializer.d.cts +7 -0
- package/server-functions/dist/client.cjs +164 -35
- package/server-functions/dist/client.js +161 -36
- package/server-functions/dist/server.cjs +899 -136
- package/server-functions/dist/server.dev.cjs +919 -136
- package/server-functions/dist/server.dev.js +915 -137
- package/server-functions/dist/server.js +895 -137
- package/types/client.d.ts +2 -1
- package/types/constants.d.ts +3 -1
- package/types/cookies.d.ts +6 -14
- package/types/frames/frame-client.d.ts +4 -0
- package/types/frames/serializer-decode.d.ts +14 -1
- package/types/frames/serializer.d.ts +7 -0
- package/types/jsx.d.ts +11 -16
- package/types/response.d.ts +11 -0
- package/types/serializer-decode.d.ts +14 -1
- package/types/serializer.d.ts +7 -0
- package/types/server-functions/client.d.ts +22 -2
- package/types/server-functions/flash.d.ts +9 -0
- package/types/server-functions/server.d.ts +131 -11
- package/types/server-functions/shared.d.ts +77 -14
- package/types/server-mock.d.ts +17 -2
- package/types/server.d.ts +16 -2
- package/types-cjs/client.d.cts +2 -1
- package/types-cjs/constants.d.cts +3 -1
- package/types-cjs/cookies.d.cts +6 -14
- package/types-cjs/frames/frame-client.d.cts +4 -0
- package/types-cjs/frames/serializer-decode.d.cts +14 -1
- package/types-cjs/frames/serializer.d.cts +7 -0
- package/types-cjs/jsx.d.cts +11 -16
- package/types-cjs/response.d.cts +11 -0
- package/types-cjs/serializer-decode.d.cts +14 -1
- package/types-cjs/serializer.d.cts +7 -0
- package/types-cjs/server-functions/client.d.cts +22 -2
- package/types-cjs/server-functions/flash.d.cts +9 -0
- package/types-cjs/server-functions/server.d.cts +131 -11
- package/types-cjs/server-functions/shared.d.cts +77 -14
- package/types-cjs/server-mock.d.cts +17 -2
- package/types-cjs/server.d.cts +16 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/web",
|
|
3
3
|
"description": "Solid's web runtime: client rendering, hydration, SSR, and DOM-specific control flow (Portal, Dynamic).",
|
|
4
|
-
"version": "2.0.0-rc.
|
|
4
|
+
"version": "2.0.0-rc.6",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -398,7 +398,7 @@
|
|
|
398
398
|
"seroval-plugins": "~1.5.4"
|
|
399
399
|
},
|
|
400
400
|
"peerDependencies": {
|
|
401
|
-
"solid-js": "^2.0.0-rc.
|
|
401
|
+
"solid-js": "^2.0.0-rc.6"
|
|
402
402
|
},
|
|
403
403
|
"devDependencies": {
|
|
404
404
|
"@codspeed/vitest-plugin": "^5.4.0",
|
|
@@ -85,12 +85,14 @@ const JSON_CODEC_DEPTH_LIMIT = 64;
|
|
|
85
85
|
function resolveCodecOptions({
|
|
86
86
|
plugins,
|
|
87
87
|
disabledFeatures,
|
|
88
|
-
depthLimit
|
|
88
|
+
depthLimit,
|
|
89
|
+
serializeErrorStacks
|
|
89
90
|
} = {}) {
|
|
90
91
|
return {
|
|
91
92
|
plugins: resolveSerializerPlugins(plugins),
|
|
92
93
|
disabledFeatures: disabledFeatures === undefined ? JSON_CODEC_DISABLED_FEATURES : disabledFeatures,
|
|
93
|
-
depthLimit: depthLimit === undefined ? JSON_CODEC_DEPTH_LIMIT : depthLimit
|
|
94
|
+
depthLimit: depthLimit === undefined ? JSON_CODEC_DEPTH_LIMIT : depthLimit,
|
|
95
|
+
serializeErrorStacks
|
|
94
96
|
};
|
|
95
97
|
}
|
|
96
98
|
function createJSONDeserializer(options) {
|
|
@@ -83,12 +83,14 @@ const JSON_CODEC_DEPTH_LIMIT = 64;
|
|
|
83
83
|
function resolveCodecOptions({
|
|
84
84
|
plugins,
|
|
85
85
|
disabledFeatures,
|
|
86
|
-
depthLimit
|
|
86
|
+
depthLimit,
|
|
87
|
+
serializeErrorStacks
|
|
87
88
|
} = {}) {
|
|
88
89
|
return {
|
|
89
90
|
plugins: resolveSerializerPlugins(plugins),
|
|
90
91
|
disabledFeatures: disabledFeatures === undefined ? JSON_CODEC_DISABLED_FEATURES : disabledFeatures,
|
|
91
|
-
depthLimit: depthLimit === undefined ? JSON_CODEC_DEPTH_LIMIT : depthLimit
|
|
92
|
+
depthLimit: depthLimit === undefined ? JSON_CODEC_DEPTH_LIMIT : depthLimit,
|
|
93
|
+
serializeErrorStacks
|
|
92
94
|
};
|
|
93
95
|
}
|
|
94
96
|
function createJSONDeserializer(options) {
|
|
@@ -85,12 +85,14 @@ const JSON_CODEC_DEPTH_LIMIT = 64;
|
|
|
85
85
|
function resolveCodecOptions({
|
|
86
86
|
plugins,
|
|
87
87
|
disabledFeatures,
|
|
88
|
-
depthLimit
|
|
88
|
+
depthLimit,
|
|
89
|
+
serializeErrorStacks
|
|
89
90
|
} = {}) {
|
|
90
91
|
return {
|
|
91
92
|
plugins: resolveSerializerPlugins(plugins),
|
|
92
93
|
disabledFeatures: disabledFeatures === undefined ? JSON_CODEC_DISABLED_FEATURES : disabledFeatures,
|
|
93
|
-
depthLimit: depthLimit === undefined ? JSON_CODEC_DEPTH_LIMIT : depthLimit
|
|
94
|
+
depthLimit: depthLimit === undefined ? JSON_CODEC_DEPTH_LIMIT : depthLimit,
|
|
95
|
+
serializeErrorStacks
|
|
94
96
|
};
|
|
95
97
|
}
|
|
96
98
|
function createJSONDeserializer(options) {
|
|
@@ -133,7 +135,7 @@ function createJSONDataTable(options) {
|
|
|
133
135
|
}
|
|
134
136
|
|
|
135
137
|
const DEFAULT_DISABLED_FEATURES = seroval.Feature.AggregateError | seroval.Feature.BigIntTypedArray;
|
|
136
|
-
const serializeOnlyDisabledFeatures =
|
|
138
|
+
const serializeOnlyDisabledFeatures = serializeErrorStacks => (serializeErrorStacks === undefined ? process.env.NODE_ENV === "development" : serializeErrorStacks) ? 0 : seroval.Feature.ErrorPrototypeStack;
|
|
137
139
|
const HYDRATION_GLOBAL = "_$HY.r";
|
|
138
140
|
const createPlugin = seroval.createPlugin;
|
|
139
141
|
const OpaqueReference = seroval.OpaqueReference;
|
|
@@ -141,7 +143,7 @@ function createSerializer(options) {
|
|
|
141
143
|
return new seroval.Serializer({
|
|
142
144
|
...options,
|
|
143
145
|
plugins: resolveSerializerPlugins(options.plugins),
|
|
144
|
-
disabledFeatures: (options.disabledFeatures === undefined ? DEFAULT_DISABLED_FEATURES : options.disabledFeatures) | serializeOnlyDisabledFeatures()
|
|
146
|
+
disabledFeatures: (options.disabledFeatures === undefined ? DEFAULT_DISABLED_FEATURES : options.disabledFeatures) | serializeOnlyDisabledFeatures(options.serializeErrorStacks)
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
149
|
function createHydrationSerializer({
|
|
@@ -175,7 +177,7 @@ function serializeJSON(value, {
|
|
|
175
177
|
onDone,
|
|
176
178
|
onError,
|
|
177
179
|
...resolved,
|
|
178
|
-
disabledFeatures: resolved.disabledFeatures | serializeOnlyDisabledFeatures()
|
|
180
|
+
disabledFeatures: resolved.disabledFeatures | serializeOnlyDisabledFeatures(resolved.serializeErrorStacks)
|
|
179
181
|
});
|
|
180
182
|
}
|
|
181
183
|
function createJSONSerializer({
|
|
@@ -184,12 +186,14 @@ function createJSONSerializer({
|
|
|
184
186
|
onError,
|
|
185
187
|
plugins,
|
|
186
188
|
disabledFeatures,
|
|
187
|
-
depthLimit
|
|
189
|
+
depthLimit,
|
|
190
|
+
serializeErrorStacks
|
|
188
191
|
}) {
|
|
189
192
|
const resolved = resolveCodecOptions({
|
|
190
193
|
plugins,
|
|
191
194
|
disabledFeatures,
|
|
192
|
-
depthLimit
|
|
195
|
+
depthLimit,
|
|
196
|
+
serializeErrorStacks
|
|
193
197
|
});
|
|
194
198
|
const refs = new Map();
|
|
195
199
|
const cancels = new Set();
|
|
@@ -211,7 +215,7 @@ function createJSONSerializer({
|
|
|
211
215
|
const stream = seroval.toCrossJSONStream(value, {
|
|
212
216
|
refs,
|
|
213
217
|
plugins: resolved.plugins,
|
|
214
|
-
disabledFeatures: resolved.disabledFeatures | serializeOnlyDisabledFeatures(),
|
|
218
|
+
disabledFeatures: resolved.disabledFeatures | serializeOnlyDisabledFeatures(resolved.serializeErrorStacks),
|
|
215
219
|
onParse(node, initial) {
|
|
216
220
|
onData({
|
|
217
221
|
key,
|
|
@@ -83,12 +83,14 @@ const JSON_CODEC_DEPTH_LIMIT = 64;
|
|
|
83
83
|
function resolveCodecOptions({
|
|
84
84
|
plugins,
|
|
85
85
|
disabledFeatures,
|
|
86
|
-
depthLimit
|
|
86
|
+
depthLimit,
|
|
87
|
+
serializeErrorStacks
|
|
87
88
|
} = {}) {
|
|
88
89
|
return {
|
|
89
90
|
plugins: resolveSerializerPlugins(plugins),
|
|
90
91
|
disabledFeatures: disabledFeatures === undefined ? JSON_CODEC_DISABLED_FEATURES : disabledFeatures,
|
|
91
|
-
depthLimit: depthLimit === undefined ? JSON_CODEC_DEPTH_LIMIT : depthLimit
|
|
92
|
+
depthLimit: depthLimit === undefined ? JSON_CODEC_DEPTH_LIMIT : depthLimit,
|
|
93
|
+
serializeErrorStacks
|
|
92
94
|
};
|
|
93
95
|
}
|
|
94
96
|
function createJSONDeserializer(options) {
|
|
@@ -131,7 +133,7 @@ function createJSONDataTable(options) {
|
|
|
131
133
|
}
|
|
132
134
|
|
|
133
135
|
const DEFAULT_DISABLED_FEATURES = Feature.AggregateError | Feature.BigIntTypedArray;
|
|
134
|
-
const serializeOnlyDisabledFeatures =
|
|
136
|
+
const serializeOnlyDisabledFeatures = serializeErrorStacks => (serializeErrorStacks === undefined ? process.env.NODE_ENV === "development" : serializeErrorStacks) ? 0 : Feature.ErrorPrototypeStack;
|
|
135
137
|
const HYDRATION_GLOBAL = "_$HY.r";
|
|
136
138
|
const createPlugin = createPlugin$1;
|
|
137
139
|
const OpaqueReference = OpaqueReference$1;
|
|
@@ -139,7 +141,7 @@ function createSerializer(options) {
|
|
|
139
141
|
return new Serializer({
|
|
140
142
|
...options,
|
|
141
143
|
plugins: resolveSerializerPlugins(options.plugins),
|
|
142
|
-
disabledFeatures: (options.disabledFeatures === undefined ? DEFAULT_DISABLED_FEATURES : options.disabledFeatures) | serializeOnlyDisabledFeatures()
|
|
144
|
+
disabledFeatures: (options.disabledFeatures === undefined ? DEFAULT_DISABLED_FEATURES : options.disabledFeatures) | serializeOnlyDisabledFeatures(options.serializeErrorStacks)
|
|
143
145
|
});
|
|
144
146
|
}
|
|
145
147
|
function createHydrationSerializer({
|
|
@@ -173,7 +175,7 @@ function serializeJSON(value, {
|
|
|
173
175
|
onDone,
|
|
174
176
|
onError,
|
|
175
177
|
...resolved,
|
|
176
|
-
disabledFeatures: resolved.disabledFeatures | serializeOnlyDisabledFeatures()
|
|
178
|
+
disabledFeatures: resolved.disabledFeatures | serializeOnlyDisabledFeatures(resolved.serializeErrorStacks)
|
|
177
179
|
});
|
|
178
180
|
}
|
|
179
181
|
function createJSONSerializer({
|
|
@@ -182,12 +184,14 @@ function createJSONSerializer({
|
|
|
182
184
|
onError,
|
|
183
185
|
plugins,
|
|
184
186
|
disabledFeatures,
|
|
185
|
-
depthLimit
|
|
187
|
+
depthLimit,
|
|
188
|
+
serializeErrorStacks
|
|
186
189
|
}) {
|
|
187
190
|
const resolved = resolveCodecOptions({
|
|
188
191
|
plugins,
|
|
189
192
|
disabledFeatures,
|
|
190
|
-
depthLimit
|
|
193
|
+
depthLimit,
|
|
194
|
+
serializeErrorStacks
|
|
191
195
|
});
|
|
192
196
|
const refs = new Map();
|
|
193
197
|
const cancels = new Set();
|
|
@@ -209,7 +213,7 @@ function createJSONSerializer({
|
|
|
209
213
|
const stream = toCrossJSONStream(value, {
|
|
210
214
|
refs,
|
|
211
215
|
plugins: resolved.plugins,
|
|
212
|
-
disabledFeatures: resolved.disabledFeatures | serializeOnlyDisabledFeatures(),
|
|
216
|
+
disabledFeatures: resolved.disabledFeatures | serializeOnlyDisabledFeatures(resolved.serializeErrorStacks),
|
|
213
217
|
onParse(node, initial) {
|
|
214
218
|
onData({
|
|
215
219
|
key,
|
|
@@ -19,6 +19,13 @@ export interface WebSerializerOptions {
|
|
|
19
19
|
* any override — serialized stacks leak server paths to the client.
|
|
20
20
|
*/
|
|
21
21
|
disabledFeatures?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Whether serialized `Error`s carry their `.stack`. Defaults to
|
|
24
|
+
* `NODE_ENV === "development"`; set `false` to pin production disclosure
|
|
25
|
+
* to the deployment rather than the ambient variable (#3152 — see
|
|
26
|
+
* `JSONCodecOptions.serializeErrorStacks`).
|
|
27
|
+
*/
|
|
28
|
+
serializeErrorStacks?: boolean;
|
|
22
29
|
/** Extra plugins, composed ahead of `DEFAULT_WEB_PLUGINS`. */
|
|
23
30
|
plugins?: SerializerPlugin[];
|
|
24
31
|
/** Receives each emitted script chunk. */
|
|
@@ -105,6 +105,18 @@ export interface JSONCodecOptions {
|
|
|
105
105
|
disabledFeatures?: number;
|
|
106
106
|
/** Maximum parse/deserialize depth. Defaults to 64. Must match on both peers. */
|
|
107
107
|
depthLimit?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Whether serialized `Error`s carry their `.stack` — server file paths,
|
|
110
|
+
* internal function names, the shape of the deployment — to the peer.
|
|
111
|
+
* Defaults to `NODE_ENV === "development"`, but that signal describes the
|
|
112
|
+
* PROCESS, not the artifact: a production build running with
|
|
113
|
+
* `NODE_ENV=development` (a base image, a stray dotenv) ships stacks to
|
|
114
|
+
* the wire — including for errors marked safe with `markSafeError`, whose
|
|
115
|
+
* stacks traverse application code (#3152). Set `false` to pin production
|
|
116
|
+
* disclosure regardless of the ambient variable. Encode-side only; the
|
|
117
|
+
* decode side is always permissive, so it need not match peers.
|
|
118
|
+
*/
|
|
119
|
+
serializeErrorStacks?: boolean;
|
|
108
120
|
}
|
|
109
121
|
/**
|
|
110
122
|
* A resident, response-scoped decode table over the keyed JSON codec: apply
|
|
@@ -142,10 +154,11 @@ export declare const DEFAULT_WEB_PLUGINS: any; /**
|
|
|
142
154
|
* Integration-facing; may change (see the entry banner).
|
|
143
155
|
*/
|
|
144
156
|
export declare function resolveSerializerPlugins(customPlugins?: SerializerPlugin[]): SerializerPlugin[];
|
|
145
|
-
export declare function resolveCodecOptions({ plugins, disabledFeatures, depthLimit }?: JSONCodecOptions): {
|
|
157
|
+
export declare function resolveCodecOptions({ plugins, disabledFeatures, depthLimit, serializeErrorStacks }?: JSONCodecOptions): {
|
|
146
158
|
plugins: SerializerPlugin<any, any>[];
|
|
147
159
|
disabledFeatures: any;
|
|
148
160
|
depthLimit: number;
|
|
161
|
+
serializeErrorStacks: boolean;
|
|
149
162
|
}; /**
|
|
150
163
|
* Creates the decoding counterpart of `serializeJSON`. Cross-references
|
|
151
164
|
* between chunks resolve through state shared across calls, so all chunks
|
|
@@ -19,6 +19,13 @@ export interface WebSerializerOptions {
|
|
|
19
19
|
* any override — serialized stacks leak server paths to the client.
|
|
20
20
|
*/
|
|
21
21
|
disabledFeatures?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Whether serialized `Error`s carry their `.stack`. Defaults to
|
|
24
|
+
* `NODE_ENV === "development"`; set `false` to pin production disclosure
|
|
25
|
+
* to the deployment rather than the ambient variable (#3152 — see
|
|
26
|
+
* `JSONCodecOptions.serializeErrorStacks`).
|
|
27
|
+
*/
|
|
28
|
+
serializeErrorStacks?: boolean;
|
|
22
29
|
/** Extra plugins, composed ahead of `DEFAULT_WEB_PLUGINS`. */
|
|
23
30
|
plugins?: SerializerPlugin[];
|
|
24
31
|
/** Receives each emitted script chunk. */
|
|
@@ -19,6 +19,13 @@ export interface WebSerializerOptions {
|
|
|
19
19
|
* any override — serialized stacks leak server paths to the client.
|
|
20
20
|
*/
|
|
21
21
|
disabledFeatures?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Whether serialized `Error`s carry their `.stack`. Defaults to
|
|
24
|
+
* `NODE_ENV === "development"`; set `false` to pin production disclosure
|
|
25
|
+
* to the deployment rather than the ambient variable (#3152 — see
|
|
26
|
+
* `JSONCodecOptions.serializeErrorStacks`).
|
|
27
|
+
*/
|
|
28
|
+
serializeErrorStacks?: boolean;
|
|
22
29
|
/** Extra plugins, composed ahead of `DEFAULT_WEB_PLUGINS`. */
|
|
23
30
|
plugins?: SerializerPlugin[];
|
|
24
31
|
/** Receives each emitted script chunk. */
|
|
@@ -105,6 +105,18 @@ export interface JSONCodecOptions {
|
|
|
105
105
|
disabledFeatures?: number;
|
|
106
106
|
/** Maximum parse/deserialize depth. Defaults to 64. Must match on both peers. */
|
|
107
107
|
depthLimit?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Whether serialized `Error`s carry their `.stack` — server file paths,
|
|
110
|
+
* internal function names, the shape of the deployment — to the peer.
|
|
111
|
+
* Defaults to `NODE_ENV === "development"`, but that signal describes the
|
|
112
|
+
* PROCESS, not the artifact: a production build running with
|
|
113
|
+
* `NODE_ENV=development` (a base image, a stray dotenv) ships stacks to
|
|
114
|
+
* the wire — including for errors marked safe with `markSafeError`, whose
|
|
115
|
+
* stacks traverse application code (#3152). Set `false` to pin production
|
|
116
|
+
* disclosure regardless of the ambient variable. Encode-side only; the
|
|
117
|
+
* decode side is always permissive, so it need not match peers.
|
|
118
|
+
*/
|
|
119
|
+
serializeErrorStacks?: boolean;
|
|
108
120
|
}
|
|
109
121
|
/**
|
|
110
122
|
* A resident, response-scoped decode table over the keyed JSON codec: apply
|
|
@@ -142,10 +154,11 @@ export declare const DEFAULT_WEB_PLUGINS: any; /**
|
|
|
142
154
|
* Integration-facing; may change (see the entry banner).
|
|
143
155
|
*/
|
|
144
156
|
export declare function resolveSerializerPlugins(customPlugins?: SerializerPlugin[]): SerializerPlugin[];
|
|
145
|
-
export declare function resolveCodecOptions({ plugins, disabledFeatures, depthLimit }?: JSONCodecOptions): {
|
|
157
|
+
export declare function resolveCodecOptions({ plugins, disabledFeatures, depthLimit, serializeErrorStacks }?: JSONCodecOptions): {
|
|
146
158
|
plugins: SerializerPlugin<any, any>[];
|
|
147
159
|
disabledFeatures: any;
|
|
148
160
|
depthLimit: number;
|
|
161
|
+
serializeErrorStacks: boolean;
|
|
149
162
|
}; /**
|
|
150
163
|
* Creates the decoding counterpart of `serializeJSON`. Cross-references
|
|
151
164
|
* between chunks resolve through state shared across calls, so all chunks
|
|
@@ -19,6 +19,13 @@ export interface WebSerializerOptions {
|
|
|
19
19
|
* any override — serialized stacks leak server paths to the client.
|
|
20
20
|
*/
|
|
21
21
|
disabledFeatures?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Whether serialized `Error`s carry their `.stack`. Defaults to
|
|
24
|
+
* `NODE_ENV === "development"`; set `false` to pin production disclosure
|
|
25
|
+
* to the deployment rather than the ambient variable (#3152 — see
|
|
26
|
+
* `JSONCodecOptions.serializeErrorStacks`).
|
|
27
|
+
*/
|
|
28
|
+
serializeErrorStacks?: boolean;
|
|
22
29
|
/** Extra plugins, composed ahead of `DEFAULT_WEB_PLUGINS`. */
|
|
23
30
|
plugins?: SerializerPlugin[];
|
|
24
31
|
/** Receives each emitted script chunk. */
|