solid-js 1.9.11 → 1.9.13
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 +42 -25
- package/dist/dev.js +42 -25
- package/dist/server.cjs +5 -1
- package/dist/server.js +5 -1
- package/dist/solid.cjs +41 -20
- package/dist/solid.js +41 -20
- package/h/dist/h.js +1 -1
- package/h/jsx-runtime/types/jsx.d.ts +4 -5
- package/html/dist/html.cjs +3 -3
- package/html/dist/html.js +4 -4
- package/html/types/lit.d.ts +4 -7
- package/package.json +1 -1
- package/store/dist/dev.cjs +28 -1
- package/store/dist/dev.js +29 -2
- package/store/dist/server.cjs +7 -0
- package/store/dist/server.js +7 -0
- package/store/dist/store.cjs +26 -1
- package/store/dist/store.js +27 -2
- package/store/types/index.d.ts +1 -1
- package/store/types/server.d.ts +3 -3
- package/store/types/store.d.ts +2 -1
- package/types/jsx.d.ts +4 -5
- package/types/reactive/signal.d.ts +6 -2
- package/universal/dist/dev.js +1 -1
- package/universal/dist/universal.js +1 -1
- package/web/dist/dev.js +1 -1
- package/web/dist/server.cjs +6 -2
- package/web/dist/server.js +4 -4
- package/web/dist/web.js +1 -1
- package/web/types/client.d.ts +20 -6
- package/web/types/server.d.ts +14 -4
package/store/dist/dev.cjs
CHANGED
|
@@ -17,11 +17,20 @@ function wrap$1(value) {
|
|
|
17
17
|
});
|
|
18
18
|
if (!Array.isArray(value)) {
|
|
19
19
|
const keys = Object.keys(value),
|
|
20
|
-
desc = Object.getOwnPropertyDescriptors(value)
|
|
20
|
+
desc = Object.getOwnPropertyDescriptors(value),
|
|
21
|
+
proto = Object.getPrototypeOf(value);
|
|
22
|
+
const isClass = proto !== null && value !== null && typeof value === "object" && !Array.isArray(value) && proto !== Object.prototype;
|
|
23
|
+
if (isClass) {
|
|
24
|
+
const descriptors = Object.getOwnPropertyDescriptors(proto);
|
|
25
|
+
keys.push(...Object.keys(descriptors));
|
|
26
|
+
Object.assign(desc, descriptors);
|
|
27
|
+
}
|
|
21
28
|
for (let i = 0, l = keys.length; i < l; i++) {
|
|
22
29
|
const prop = keys[i];
|
|
30
|
+
if (isClass && prop === "constructor") continue;
|
|
23
31
|
if (desc[prop].get) {
|
|
24
32
|
Object.defineProperty(value, prop, {
|
|
33
|
+
configurable: true,
|
|
25
34
|
enumerable: desc[prop].enumerable,
|
|
26
35
|
get: desc[prop].get.bind(p)
|
|
27
36
|
});
|
|
@@ -124,6 +133,10 @@ const proxyTraps$1 = {
|
|
|
124
133
|
getOwnPropertyDescriptor: proxyDescriptor$1
|
|
125
134
|
};
|
|
126
135
|
function setProperty(state, property, value, deleting = false) {
|
|
136
|
+
if (property === "__proto__") {
|
|
137
|
+
console.warn(`Refusing to set "__proto__" on a store.`);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
127
140
|
if (!deleting && state[property] === value) return;
|
|
128
141
|
const prev = state[property],
|
|
129
142
|
len = state.length;
|
|
@@ -148,9 +161,13 @@ function mergeStoreNode(state, value) {
|
|
|
148
161
|
const keys = Object.keys(value);
|
|
149
162
|
for (let i = 0; i < keys.length; i += 1) {
|
|
150
163
|
const key = keys[i];
|
|
164
|
+
if (isUnsafeKey$1(key)) continue;
|
|
151
165
|
setProperty(state, key, value[key]);
|
|
152
166
|
}
|
|
153
167
|
}
|
|
168
|
+
function isUnsafeKey$1(property) {
|
|
169
|
+
return property === "__proto__" || property === "constructor" || property === "prototype";
|
|
170
|
+
}
|
|
154
171
|
function updateArray(current, next) {
|
|
155
172
|
if (typeof next === "function") next = next(current);
|
|
156
173
|
next = unwrap(next);
|
|
@@ -172,6 +189,10 @@ function updatePath(current, path, traversed = []) {
|
|
|
172
189
|
part = path.shift();
|
|
173
190
|
const partType = typeof part,
|
|
174
191
|
isArray = Array.isArray(current);
|
|
192
|
+
if (partType === "string" && (part === "__proto__" || path.length > 1 && isUnsafeKey$1(part))) {
|
|
193
|
+
console.warn(`Refusing to traverse unsafe key "${part}" on a store.`);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
175
196
|
if (Array.isArray(part)) {
|
|
176
197
|
for (let i = 0; i < part.length; i++) {
|
|
177
198
|
updatePath(current, [part[i]].concat(path), traversed);
|
|
@@ -329,7 +350,11 @@ function modifyMutable(state, modifier) {
|
|
|
329
350
|
}
|
|
330
351
|
|
|
331
352
|
const $ROOT = Symbol("store-root");
|
|
353
|
+
function isUnsafeKey(property) {
|
|
354
|
+
return property === "__proto__" || property === "constructor" || property === "prototype";
|
|
355
|
+
}
|
|
332
356
|
function applyState(target, parent, property, merge, key) {
|
|
357
|
+
if (isUnsafeKey(property)) return;
|
|
333
358
|
const previous = parent[property];
|
|
334
359
|
if (target === previous) return;
|
|
335
360
|
const isArray = Array.isArray(target);
|
|
@@ -391,6 +416,7 @@ function applyState(target, parent, property, merge, key) {
|
|
|
391
416
|
}
|
|
392
417
|
const targetKeys = Object.keys(target);
|
|
393
418
|
for (let i = 0, len = targetKeys.length; i < len; i++) {
|
|
419
|
+
if (isUnsafeKey(targetKeys[i])) continue;
|
|
394
420
|
applyState(target[targetKeys[i]], previous, targetKeys[i], merge, key);
|
|
395
421
|
}
|
|
396
422
|
const previousKeys = Object.keys(previous);
|
|
@@ -417,6 +443,7 @@ const setterTraps = {
|
|
|
417
443
|
get(target, property) {
|
|
418
444
|
if (property === $RAW) return target;
|
|
419
445
|
const value = target[property];
|
|
446
|
+
if (property === solidJs.$PROXY || property === solidJs.$TRACK || property === $NODE || property === $HAS || property === "__proto__") return value;
|
|
420
447
|
let proxy;
|
|
421
448
|
return isWrappable(value) ? producers.get(value) || (producers.set(value, proxy = new Proxy(value, setterTraps)), proxy) : value;
|
|
422
449
|
},
|
package/store/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEV as DEV$1,
|
|
1
|
+
import { $PROXY, DEV as DEV$1, batch, $TRACK, getListener, createSignal } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
const $RAW = Symbol("store-raw"),
|
|
4
4
|
$NODE = Symbol("store-node"),
|
|
@@ -15,11 +15,20 @@ function wrap$1(value) {
|
|
|
15
15
|
});
|
|
16
16
|
if (!Array.isArray(value)) {
|
|
17
17
|
const keys = Object.keys(value),
|
|
18
|
-
desc = Object.getOwnPropertyDescriptors(value)
|
|
18
|
+
desc = Object.getOwnPropertyDescriptors(value),
|
|
19
|
+
proto = Object.getPrototypeOf(value);
|
|
20
|
+
const isClass = proto !== null && value !== null && typeof value === "object" && !Array.isArray(value) && proto !== Object.prototype;
|
|
21
|
+
if (isClass) {
|
|
22
|
+
const descriptors = Object.getOwnPropertyDescriptors(proto);
|
|
23
|
+
keys.push(...Object.keys(descriptors));
|
|
24
|
+
Object.assign(desc, descriptors);
|
|
25
|
+
}
|
|
19
26
|
for (let i = 0, l = keys.length; i < l; i++) {
|
|
20
27
|
const prop = keys[i];
|
|
28
|
+
if (isClass && prop === "constructor") continue;
|
|
21
29
|
if (desc[prop].get) {
|
|
22
30
|
Object.defineProperty(value, prop, {
|
|
31
|
+
configurable: true,
|
|
23
32
|
enumerable: desc[prop].enumerable,
|
|
24
33
|
get: desc[prop].get.bind(p)
|
|
25
34
|
});
|
|
@@ -122,6 +131,10 @@ const proxyTraps$1 = {
|
|
|
122
131
|
getOwnPropertyDescriptor: proxyDescriptor$1
|
|
123
132
|
};
|
|
124
133
|
function setProperty(state, property, value, deleting = false) {
|
|
134
|
+
if (property === "__proto__") {
|
|
135
|
+
console.warn(`Refusing to set "__proto__" on a store.`);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
125
138
|
if (!deleting && state[property] === value) return;
|
|
126
139
|
const prev = state[property],
|
|
127
140
|
len = state.length;
|
|
@@ -146,9 +159,13 @@ function mergeStoreNode(state, value) {
|
|
|
146
159
|
const keys = Object.keys(value);
|
|
147
160
|
for (let i = 0; i < keys.length; i += 1) {
|
|
148
161
|
const key = keys[i];
|
|
162
|
+
if (isUnsafeKey$1(key)) continue;
|
|
149
163
|
setProperty(state, key, value[key]);
|
|
150
164
|
}
|
|
151
165
|
}
|
|
166
|
+
function isUnsafeKey$1(property) {
|
|
167
|
+
return property === "__proto__" || property === "constructor" || property === "prototype";
|
|
168
|
+
}
|
|
152
169
|
function updateArray(current, next) {
|
|
153
170
|
if (typeof next === "function") next = next(current);
|
|
154
171
|
next = unwrap(next);
|
|
@@ -170,6 +187,10 @@ function updatePath(current, path, traversed = []) {
|
|
|
170
187
|
part = path.shift();
|
|
171
188
|
const partType = typeof part,
|
|
172
189
|
isArray = Array.isArray(current);
|
|
190
|
+
if (partType === "string" && (part === "__proto__" || path.length > 1 && isUnsafeKey$1(part))) {
|
|
191
|
+
console.warn(`Refusing to traverse unsafe key "${part}" on a store.`);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
173
194
|
if (Array.isArray(part)) {
|
|
174
195
|
for (let i = 0; i < part.length; i++) {
|
|
175
196
|
updatePath(current, [part[i]].concat(path), traversed);
|
|
@@ -327,7 +348,11 @@ function modifyMutable(state, modifier) {
|
|
|
327
348
|
}
|
|
328
349
|
|
|
329
350
|
const $ROOT = Symbol("store-root");
|
|
351
|
+
function isUnsafeKey(property) {
|
|
352
|
+
return property === "__proto__" || property === "constructor" || property === "prototype";
|
|
353
|
+
}
|
|
330
354
|
function applyState(target, parent, property, merge, key) {
|
|
355
|
+
if (isUnsafeKey(property)) return;
|
|
331
356
|
const previous = parent[property];
|
|
332
357
|
if (target === previous) return;
|
|
333
358
|
const isArray = Array.isArray(target);
|
|
@@ -389,6 +414,7 @@ function applyState(target, parent, property, merge, key) {
|
|
|
389
414
|
}
|
|
390
415
|
const targetKeys = Object.keys(target);
|
|
391
416
|
for (let i = 0, len = targetKeys.length; i < len; i++) {
|
|
417
|
+
if (isUnsafeKey(targetKeys[i])) continue;
|
|
392
418
|
applyState(target[targetKeys[i]], previous, targetKeys[i], merge, key);
|
|
393
419
|
}
|
|
394
420
|
const previousKeys = Object.keys(previous);
|
|
@@ -415,6 +441,7 @@ const setterTraps = {
|
|
|
415
441
|
get(target, property) {
|
|
416
442
|
if (property === $RAW) return target;
|
|
417
443
|
const value = target[property];
|
|
444
|
+
if (property === $PROXY || property === $TRACK || property === $NODE || property === $HAS || property === "__proto__") return value;
|
|
418
445
|
let proxy;
|
|
419
446
|
return isWrappable(value) ? producers.get(value) || (producers.set(value, proxy = new Proxy(value, setterTraps)), proxy) : value;
|
|
420
447
|
},
|
package/store/dist/server.cjs
CHANGED
|
@@ -8,6 +8,7 @@ function unwrap(item) {
|
|
|
8
8
|
return item;
|
|
9
9
|
}
|
|
10
10
|
function setProperty(state, property, value, force) {
|
|
11
|
+
if (property === "__proto__") return;
|
|
11
12
|
if (!force && state[property] === value) return;
|
|
12
13
|
if (value === undefined) {
|
|
13
14
|
delete state[property];
|
|
@@ -17,9 +18,13 @@ function mergeStoreNode(state, value, force) {
|
|
|
17
18
|
const keys = Object.keys(value);
|
|
18
19
|
for (let i = 0; i < keys.length; i += 1) {
|
|
19
20
|
const key = keys[i];
|
|
21
|
+
if (isUnsafeKey(key)) continue;
|
|
20
22
|
setProperty(state, key, value[key], force);
|
|
21
23
|
}
|
|
22
24
|
}
|
|
25
|
+
function isUnsafeKey(property) {
|
|
26
|
+
return property === "__proto__" || property === "constructor" || property === "prototype";
|
|
27
|
+
}
|
|
23
28
|
function updateArray(current, next) {
|
|
24
29
|
if (typeof next === "function") next = next(current);
|
|
25
30
|
if (Array.isArray(next)) {
|
|
@@ -40,6 +45,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
40
45
|
part = path.shift();
|
|
41
46
|
const partType = typeof part,
|
|
42
47
|
isArray = Array.isArray(current);
|
|
48
|
+
if (partType === "string" && (part === "__proto__" || path.length > 1 && isUnsafeKey(part))) return;
|
|
43
49
|
if (Array.isArray(part)) {
|
|
44
50
|
for (let i = 0; i < part.length; i++) {
|
|
45
51
|
updatePath(current, [part[i]].concat(path), traversed);
|
|
@@ -96,6 +102,7 @@ function reconcile(value, options = {}) {
|
|
|
96
102
|
const targetKeys = Object.keys(value);
|
|
97
103
|
for (let i = 0, len = targetKeys.length; i < len; i++) {
|
|
98
104
|
const key = targetKeys[i];
|
|
105
|
+
if (isUnsafeKey(key)) continue;
|
|
99
106
|
setProperty(state, key, value[key]);
|
|
100
107
|
}
|
|
101
108
|
const previousKeys = Object.keys(state);
|
package/store/dist/server.js
CHANGED
|
@@ -6,6 +6,7 @@ function unwrap(item) {
|
|
|
6
6
|
return item;
|
|
7
7
|
}
|
|
8
8
|
function setProperty(state, property, value, force) {
|
|
9
|
+
if (property === "__proto__") return;
|
|
9
10
|
if (!force && state[property] === value) return;
|
|
10
11
|
if (value === undefined) {
|
|
11
12
|
delete state[property];
|
|
@@ -15,9 +16,13 @@ function mergeStoreNode(state, value, force) {
|
|
|
15
16
|
const keys = Object.keys(value);
|
|
16
17
|
for (let i = 0; i < keys.length; i += 1) {
|
|
17
18
|
const key = keys[i];
|
|
19
|
+
if (isUnsafeKey(key)) continue;
|
|
18
20
|
setProperty(state, key, value[key], force);
|
|
19
21
|
}
|
|
20
22
|
}
|
|
23
|
+
function isUnsafeKey(property) {
|
|
24
|
+
return property === "__proto__" || property === "constructor" || property === "prototype";
|
|
25
|
+
}
|
|
21
26
|
function updateArray(current, next) {
|
|
22
27
|
if (typeof next === "function") next = next(current);
|
|
23
28
|
if (Array.isArray(next)) {
|
|
@@ -38,6 +43,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
38
43
|
part = path.shift();
|
|
39
44
|
const partType = typeof part,
|
|
40
45
|
isArray = Array.isArray(current);
|
|
46
|
+
if (partType === "string" && (part === "__proto__" || path.length > 1 && isUnsafeKey(part))) return;
|
|
41
47
|
if (Array.isArray(part)) {
|
|
42
48
|
for (let i = 0; i < part.length; i++) {
|
|
43
49
|
updatePath(current, [part[i]].concat(path), traversed);
|
|
@@ -94,6 +100,7 @@ function reconcile(value, options = {}) {
|
|
|
94
100
|
const targetKeys = Object.keys(value);
|
|
95
101
|
for (let i = 0, len = targetKeys.length; i < len; i++) {
|
|
96
102
|
const key = targetKeys[i];
|
|
103
|
+
if (isUnsafeKey(key)) continue;
|
|
97
104
|
setProperty(state, key, value[key]);
|
|
98
105
|
}
|
|
99
106
|
const previousKeys = Object.keys(state);
|
package/store/dist/store.cjs
CHANGED
|
@@ -14,11 +14,20 @@ function wrap$1(value) {
|
|
|
14
14
|
});
|
|
15
15
|
if (!Array.isArray(value)) {
|
|
16
16
|
const keys = Object.keys(value),
|
|
17
|
-
desc = Object.getOwnPropertyDescriptors(value)
|
|
17
|
+
desc = Object.getOwnPropertyDescriptors(value),
|
|
18
|
+
proto = Object.getPrototypeOf(value);
|
|
19
|
+
const isClass = proto !== null && value !== null && typeof value === "object" && !Array.isArray(value) && proto !== Object.prototype;
|
|
20
|
+
if (isClass) {
|
|
21
|
+
const descriptors = Object.getOwnPropertyDescriptors(proto);
|
|
22
|
+
keys.push(...Object.keys(descriptors));
|
|
23
|
+
Object.assign(desc, descriptors);
|
|
24
|
+
}
|
|
18
25
|
for (let i = 0, l = keys.length; i < l; i++) {
|
|
19
26
|
const prop = keys[i];
|
|
27
|
+
if (isClass && prop === "constructor") continue;
|
|
20
28
|
if (desc[prop].get) {
|
|
21
29
|
Object.defineProperty(value, prop, {
|
|
30
|
+
configurable: true,
|
|
22
31
|
enumerable: desc[prop].enumerable,
|
|
23
32
|
get: desc[prop].get.bind(p)
|
|
24
33
|
});
|
|
@@ -119,6 +128,9 @@ const proxyTraps$1 = {
|
|
|
119
128
|
getOwnPropertyDescriptor: proxyDescriptor$1
|
|
120
129
|
};
|
|
121
130
|
function setProperty(state, property, value, deleting = false) {
|
|
131
|
+
if (property === "__proto__") {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
122
134
|
if (!deleting && state[property] === value) return;
|
|
123
135
|
const prev = state[property],
|
|
124
136
|
len = state.length;
|
|
@@ -142,9 +154,13 @@ function mergeStoreNode(state, value) {
|
|
|
142
154
|
const keys = Object.keys(value);
|
|
143
155
|
for (let i = 0; i < keys.length; i += 1) {
|
|
144
156
|
const key = keys[i];
|
|
157
|
+
if (isUnsafeKey$1(key)) continue;
|
|
145
158
|
setProperty(state, key, value[key]);
|
|
146
159
|
}
|
|
147
160
|
}
|
|
161
|
+
function isUnsafeKey$1(property) {
|
|
162
|
+
return property === "__proto__" || property === "constructor" || property === "prototype";
|
|
163
|
+
}
|
|
148
164
|
function updateArray(current, next) {
|
|
149
165
|
if (typeof next === "function") next = next(current);
|
|
150
166
|
next = unwrap(next);
|
|
@@ -166,6 +182,9 @@ function updatePath(current, path, traversed = []) {
|
|
|
166
182
|
part = path.shift();
|
|
167
183
|
const partType = typeof part,
|
|
168
184
|
isArray = Array.isArray(current);
|
|
185
|
+
if (partType === "string" && (part === "__proto__" || path.length > 1 && isUnsafeKey$1(part))) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
169
188
|
if (Array.isArray(part)) {
|
|
170
189
|
for (let i = 0; i < part.length; i++) {
|
|
171
190
|
updatePath(current, [part[i]].concat(path), traversed);
|
|
@@ -313,7 +332,11 @@ function modifyMutable(state, modifier) {
|
|
|
313
332
|
}
|
|
314
333
|
|
|
315
334
|
const $ROOT = Symbol("store-root");
|
|
335
|
+
function isUnsafeKey(property) {
|
|
336
|
+
return property === "__proto__" || property === "constructor" || property === "prototype";
|
|
337
|
+
}
|
|
316
338
|
function applyState(target, parent, property, merge, key) {
|
|
339
|
+
if (isUnsafeKey(property)) return;
|
|
317
340
|
const previous = parent[property];
|
|
318
341
|
if (target === previous) return;
|
|
319
342
|
const isArray = Array.isArray(target);
|
|
@@ -375,6 +398,7 @@ function applyState(target, parent, property, merge, key) {
|
|
|
375
398
|
}
|
|
376
399
|
const targetKeys = Object.keys(target);
|
|
377
400
|
for (let i = 0, len = targetKeys.length; i < len; i++) {
|
|
401
|
+
if (isUnsafeKey(targetKeys[i])) continue;
|
|
378
402
|
applyState(target[targetKeys[i]], previous, targetKeys[i], merge, key);
|
|
379
403
|
}
|
|
380
404
|
const previousKeys = Object.keys(previous);
|
|
@@ -401,6 +425,7 @@ const setterTraps = {
|
|
|
401
425
|
get(target, property) {
|
|
402
426
|
if (property === $RAW) return target;
|
|
403
427
|
const value = target[property];
|
|
428
|
+
if (property === solidJs.$PROXY || property === solidJs.$TRACK || property === $NODE || property === $HAS || property === "__proto__") return value;
|
|
404
429
|
let proxy;
|
|
405
430
|
return isWrappable(value) ? producers.get(value) || (producers.set(value, proxy = new Proxy(value, setterTraps)), proxy) : value;
|
|
406
431
|
},
|
package/store/dist/store.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $PROXY, $TRACK, getListener,
|
|
1
|
+
import { batch, $PROXY, $TRACK, getListener, createSignal } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
const $RAW = Symbol("store-raw"),
|
|
4
4
|
$NODE = Symbol("store-node"),
|
|
@@ -12,11 +12,20 @@ function wrap$1(value) {
|
|
|
12
12
|
});
|
|
13
13
|
if (!Array.isArray(value)) {
|
|
14
14
|
const keys = Object.keys(value),
|
|
15
|
-
desc = Object.getOwnPropertyDescriptors(value)
|
|
15
|
+
desc = Object.getOwnPropertyDescriptors(value),
|
|
16
|
+
proto = Object.getPrototypeOf(value);
|
|
17
|
+
const isClass = proto !== null && value !== null && typeof value === "object" && !Array.isArray(value) && proto !== Object.prototype;
|
|
18
|
+
if (isClass) {
|
|
19
|
+
const descriptors = Object.getOwnPropertyDescriptors(proto);
|
|
20
|
+
keys.push(...Object.keys(descriptors));
|
|
21
|
+
Object.assign(desc, descriptors);
|
|
22
|
+
}
|
|
16
23
|
for (let i = 0, l = keys.length; i < l; i++) {
|
|
17
24
|
const prop = keys[i];
|
|
25
|
+
if (isClass && prop === "constructor") continue;
|
|
18
26
|
if (desc[prop].get) {
|
|
19
27
|
Object.defineProperty(value, prop, {
|
|
28
|
+
configurable: true,
|
|
20
29
|
enumerable: desc[prop].enumerable,
|
|
21
30
|
get: desc[prop].get.bind(p)
|
|
22
31
|
});
|
|
@@ -117,6 +126,9 @@ const proxyTraps$1 = {
|
|
|
117
126
|
getOwnPropertyDescriptor: proxyDescriptor$1
|
|
118
127
|
};
|
|
119
128
|
function setProperty(state, property, value, deleting = false) {
|
|
129
|
+
if (property === "__proto__") {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
120
132
|
if (!deleting && state[property] === value) return;
|
|
121
133
|
const prev = state[property],
|
|
122
134
|
len = state.length;
|
|
@@ -140,9 +152,13 @@ function mergeStoreNode(state, value) {
|
|
|
140
152
|
const keys = Object.keys(value);
|
|
141
153
|
for (let i = 0; i < keys.length; i += 1) {
|
|
142
154
|
const key = keys[i];
|
|
155
|
+
if (isUnsafeKey$1(key)) continue;
|
|
143
156
|
setProperty(state, key, value[key]);
|
|
144
157
|
}
|
|
145
158
|
}
|
|
159
|
+
function isUnsafeKey$1(property) {
|
|
160
|
+
return property === "__proto__" || property === "constructor" || property === "prototype";
|
|
161
|
+
}
|
|
146
162
|
function updateArray(current, next) {
|
|
147
163
|
if (typeof next === "function") next = next(current);
|
|
148
164
|
next = unwrap(next);
|
|
@@ -164,6 +180,9 @@ function updatePath(current, path, traversed = []) {
|
|
|
164
180
|
part = path.shift();
|
|
165
181
|
const partType = typeof part,
|
|
166
182
|
isArray = Array.isArray(current);
|
|
183
|
+
if (partType === "string" && (part === "__proto__" || path.length > 1 && isUnsafeKey$1(part))) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
167
186
|
if (Array.isArray(part)) {
|
|
168
187
|
for (let i = 0; i < part.length; i++) {
|
|
169
188
|
updatePath(current, [part[i]].concat(path), traversed);
|
|
@@ -311,7 +330,11 @@ function modifyMutable(state, modifier) {
|
|
|
311
330
|
}
|
|
312
331
|
|
|
313
332
|
const $ROOT = Symbol("store-root");
|
|
333
|
+
function isUnsafeKey(property) {
|
|
334
|
+
return property === "__proto__" || property === "constructor" || property === "prototype";
|
|
335
|
+
}
|
|
314
336
|
function applyState(target, parent, property, merge, key) {
|
|
337
|
+
if (isUnsafeKey(property)) return;
|
|
315
338
|
const previous = parent[property];
|
|
316
339
|
if (target === previous) return;
|
|
317
340
|
const isArray = Array.isArray(target);
|
|
@@ -373,6 +396,7 @@ function applyState(target, parent, property, merge, key) {
|
|
|
373
396
|
}
|
|
374
397
|
const targetKeys = Object.keys(target);
|
|
375
398
|
for (let i = 0, len = targetKeys.length; i < len; i++) {
|
|
399
|
+
if (isUnsafeKey(targetKeys[i])) continue;
|
|
376
400
|
applyState(target[targetKeys[i]], previous, targetKeys[i], merge, key);
|
|
377
401
|
}
|
|
378
402
|
const previousKeys = Object.keys(previous);
|
|
@@ -399,6 +423,7 @@ const setterTraps = {
|
|
|
399
423
|
get(target, property) {
|
|
400
424
|
if (property === $RAW) return target;
|
|
401
425
|
const value = target[property];
|
|
426
|
+
if (property === $PROXY || property === $TRACK || property === $NODE || property === $HAS || property === "__proto__") return value;
|
|
402
427
|
let proxy;
|
|
403
428
|
return isWrappable(value) ? producers.get(value) || (producers.set(value, proxy = new Proxy(value, setterTraps)), proxy) : value;
|
|
404
429
|
},
|
package/store/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { $RAW, createStore, unwrap } from "./store.js";
|
|
2
|
-
export type { ArrayFilterFn, DeepMutable, DeepReadonly, NotWrappable, Part, SetStoreFunction, SolidStore, Store, StoreNode, StorePathRange, StoreSetter } from "./store.js";
|
|
2
|
+
export type { ArrayFilterFn, DeepMutable, DeepReadonly, NotWrappable, Part, SetStoreFunction, SolidStore, Store, StoreNode, StoreReturn, StorePathRange, StoreSetter } from "./store.js";
|
|
3
3
|
export * from "./mutable.js";
|
|
4
4
|
export * from "./modifiers.js";
|
|
5
5
|
import { $NODE, isWrappable } from "./store.js";
|
package/store/types/server.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type { ArrayFilterFn, DeepMutable, DeepReadonly, NotWrappable, Part, SetStoreFunction, SolidStore, Store, StoreNode, StorePathRange, StoreSetter } from "./store.js";
|
|
1
|
+
import type { Store, StoreReturn } from "./store.js";
|
|
2
|
+
export type { ArrayFilterFn, DeepMutable, DeepReadonly, NotWrappable, Part, SetStoreFunction, SolidStore, Store, StoreNode, StoreReturn, StorePathRange, StoreSetter } from "./store.js";
|
|
3
3
|
export declare const $RAW: unique symbol;
|
|
4
4
|
export declare function isWrappable(obj: any): boolean;
|
|
5
5
|
export declare function unwrap<T>(item: T): T;
|
|
6
6
|
export declare function setProperty(state: any, property: PropertyKey, value: any, force?: boolean): void;
|
|
7
7
|
export declare function updatePath(current: any, path: any[], traversed?: PropertyKey[]): void;
|
|
8
|
-
export declare function createStore<T>(state: T | Store<T>):
|
|
8
|
+
export declare function createStore<T>(state: T | Store<T>): StoreReturn<T>;
|
|
9
9
|
export declare function createMutable<T>(state: T | Store<T>): T;
|
|
10
10
|
export declare function modifyMutable<T>(state: T, modifier: (state: T) => T): void;
|
|
11
11
|
type ReconcileOptions = {
|
package/store/types/store.d.ts
CHANGED
|
@@ -94,6 +94,7 @@ export interface SetStoreFunction<T> {
|
|
|
94
94
|
(setter: StoreSetter<T, []>): void;
|
|
95
95
|
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>, K7 extends KeyOf<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, k7: Part<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, K7>, ...rest: Rest<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7], [K7, K6, K5, K4, K3, K2, K1]>): void;
|
|
96
96
|
}
|
|
97
|
+
export type StoreReturn<T> = [get: Store<T>, set: SetStoreFunction<T>];
|
|
97
98
|
/**
|
|
98
99
|
* Creates a reactive store that can be read through a proxy object and written with a setter function
|
|
99
100
|
*
|
|
@@ -103,5 +104,5 @@ export declare function createStore<T extends object = {}>(...[store, options]:
|
|
|
103
104
|
name?: string;
|
|
104
105
|
}] : [store: T | Store<T>, options?: {
|
|
105
106
|
name?: string;
|
|
106
|
-
}]):
|
|
107
|
+
}]): StoreReturn<T>;
|
|
107
108
|
export {};
|
package/types/jsx.d.ts
CHANGED
|
@@ -137,14 +137,13 @@ export namespace JSX {
|
|
|
137
137
|
interface IntrinsicAttributes {
|
|
138
138
|
ref?: unknown | ((e: unknown) => void) | undefined;
|
|
139
139
|
}
|
|
140
|
+
export type ClassList = {
|
|
141
|
+
[k: string]: boolean | undefined;
|
|
142
|
+
};
|
|
140
143
|
interface CustomAttributes<T> {
|
|
141
144
|
ref?: T | ((el: T) => void) | undefined;
|
|
142
145
|
children?: Element | undefined;
|
|
143
|
-
classList?:
|
|
144
|
-
| {
|
|
145
|
-
[k: string]: boolean | undefined;
|
|
146
|
-
}
|
|
147
|
-
| undefined;
|
|
146
|
+
classList?: ClassList | undefined;
|
|
148
147
|
$ServerOnly?: boolean | undefined;
|
|
149
148
|
}
|
|
150
149
|
type Accessor<T> = () => T;
|
|
@@ -328,9 +328,13 @@ export type InitializedResourceReturn<T, R = unknown> = [
|
|
|
328
328
|
*
|
|
329
329
|
* @description https://docs.solidjs.com/reference/basic-reactivity/create-resource
|
|
330
330
|
*/
|
|
331
|
-
export declare function createResource<T, R = unknown>(fetcher:
|
|
331
|
+
export declare function createResource<T, R = unknown, I = T>(fetcher: (k: true, info: ResourceFetcherInfo<T | I, R>) => T | Promise<T>, options: ResourceOptions<T | I, true> & {
|
|
332
|
+
initialValue: I;
|
|
333
|
+
}): InitializedResourceReturn<T | I, R>;
|
|
332
334
|
export declare function createResource<T, R = unknown>(fetcher: ResourceFetcher<true, T, R>, options?: ResourceOptions<NoInfer<T>, true>): ResourceReturn<T, R>;
|
|
333
|
-
export declare function createResource<T, S, R = unknown>(source: ResourceSource<S>, fetcher:
|
|
335
|
+
export declare function createResource<T, S, R = unknown, I = T>(source: ResourceSource<S>, fetcher: (k: S, info: ResourceFetcherInfo<T | I, R>) => T | Promise<T>, options: ResourceOptions<T | I, S> & {
|
|
336
|
+
initialValue: I;
|
|
337
|
+
}): InitializedResourceReturn<T | I, R>;
|
|
334
338
|
export declare function createResource<T, S, R = unknown>(source: ResourceSource<S>, fetcher: ResourceFetcher<S, T, R>, options?: ResourceOptions<NoInfer<T>, S>): ResourceReturn<T, R>;
|
|
335
339
|
export interface DeferredOptions<T> {
|
|
336
340
|
equals?: false | ((prev: T, next: T) => boolean);
|
package/universal/dist/dev.js
CHANGED
package/web/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createMemo,
|
|
1
|
+
import { createMemo, sharedConfig, createRenderEffect, createRoot, untrack, splitProps, getOwner, createEffect, runWithOwner, createSignal, onCleanup, $DEVCOMP, enableHydration } from 'solid-js';
|
|
2
2
|
export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, mergeProps, untrack } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
const booleans = ["allowfullscreen", "async", "alpha",
|
package/web/dist/server.cjs
CHANGED
|
@@ -415,13 +415,13 @@ function renderToStream(code, options = {}) {
|
|
|
415
415
|
writable = {
|
|
416
416
|
end() {
|
|
417
417
|
writer.releaseLock();
|
|
418
|
-
w.close();
|
|
418
|
+
w.close().catch(() => {});
|
|
419
419
|
resolve();
|
|
420
420
|
}
|
|
421
421
|
};
|
|
422
422
|
buffer = {
|
|
423
423
|
write(payload) {
|
|
424
|
-
writer.write(encoder.encode(payload));
|
|
424
|
+
writer.write(encoder.encode(payload)).catch(() => {});
|
|
425
425
|
}
|
|
426
426
|
};
|
|
427
427
|
buffer.write(tmp);
|
|
@@ -850,6 +850,7 @@ exports.addEventListener = notSup;
|
|
|
850
850
|
exports.assign = notSup;
|
|
851
851
|
exports.classList = notSup;
|
|
852
852
|
exports.className = notSup;
|
|
853
|
+
exports.clearDelegatedEvents = notSup;
|
|
853
854
|
exports.createDynamic = createDynamic;
|
|
854
855
|
exports.delegateEvents = notSup;
|
|
855
856
|
exports.dynamicProperty = notSup;
|
|
@@ -877,7 +878,9 @@ exports.resolveSSRNode = resolveSSRNode;
|
|
|
877
878
|
exports.runHydrationEvents = notSup;
|
|
878
879
|
exports.setAttribute = notSup;
|
|
879
880
|
exports.setAttributeNS = notSup;
|
|
881
|
+
exports.setBoolAttribute = notSup;
|
|
880
882
|
exports.setProperty = notSup;
|
|
883
|
+
exports.setStyleProperty = notSup;
|
|
881
884
|
exports.spread = notSup;
|
|
882
885
|
exports.ssr = ssr;
|
|
883
886
|
exports.ssrAttribute = ssrAttribute;
|
|
@@ -889,4 +892,5 @@ exports.ssrStyle = ssrStyle;
|
|
|
889
892
|
exports.ssrStyleProperty = ssrStyleProperty;
|
|
890
893
|
exports.style = notSup;
|
|
891
894
|
exports.template = notSup;
|
|
895
|
+
exports.use = notSup;
|
|
892
896
|
exports.useAssets = useAssets;
|
package/web/dist/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createMemo, sharedConfig, createRoot, splitProps } from 'solid-js';
|
|
2
2
|
export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, mergeProps, untrack } from 'solid-js';
|
|
3
|
-
import {
|
|
3
|
+
import { Serializer, Feature, getCrossReferenceHeader } from 'seroval';
|
|
4
4
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
5
5
|
|
|
6
6
|
const booleans = ["allowfullscreen", "async", "alpha",
|
|
@@ -414,13 +414,13 @@ function renderToStream(code, options = {}) {
|
|
|
414
414
|
writable = {
|
|
415
415
|
end() {
|
|
416
416
|
writer.releaseLock();
|
|
417
|
-
w.close();
|
|
417
|
+
w.close().catch(() => {});
|
|
418
418
|
resolve();
|
|
419
419
|
}
|
|
420
420
|
};
|
|
421
421
|
buffer = {
|
|
422
422
|
write(payload) {
|
|
423
|
-
writer.write(encoder.encode(payload));
|
|
423
|
+
writer.write(encoder.encode(payload)).catch(() => {});
|
|
424
424
|
}
|
|
425
425
|
};
|
|
426
426
|
buffer.write(tmp);
|
|
@@ -779,4 +779,4 @@ function Portal(props) {
|
|
|
779
779
|
return "";
|
|
780
780
|
}
|
|
781
781
|
|
|
782
|
-
export { Aliases, Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, notSup as addEventListener, notSup as assign, notSup as classList, notSup as className, createDynamic, notSup as delegateEvents, notSup as dynamicProperty, escape, generateHydrationScript, getAssets, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getPropAlias, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isServer, memo, pipeToNodeWritable, pipeToWritable, notSup as render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, useAssets };
|
|
782
|
+
export { Aliases, Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, notSup as addEventListener, notSup as assign, notSup as classList, notSup as className, notSup as clearDelegatedEvents, createDynamic, notSup as delegateEvents, notSup as dynamicProperty, escape, generateHydrationScript, getAssets, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getPropAlias, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isServer, memo, pipeToNodeWritable, pipeToWritable, notSup as render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setBoolAttribute, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, notSup as use, useAssets };
|
package/web/dist/web.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createMemo,
|
|
1
|
+
import { createMemo, sharedConfig, createRenderEffect, createRoot, untrack, splitProps, getOwner, createEffect, runWithOwner, createSignal, onCleanup, enableHydration } from 'solid-js';
|
|
2
2
|
export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, mergeProps, untrack } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
const booleans = ["allowfullscreen", "async", "alpha",
|