solid-js 1.6.7 → 1.6.8
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/server.cjs +5 -15
- package/dist/server.js +5 -15
- package/package.json +1 -1
- package/types/server/rendering.d.ts +1 -0
- package/web/dist/server.cjs +2 -0
- package/web/dist/server.js +2 -0
package/dist/server.cjs
CHANGED
|
@@ -494,31 +494,21 @@ function createResource(source, fetcher, options = {}) {
|
|
|
494
494
|
}];
|
|
495
495
|
}
|
|
496
496
|
function lazy(fn) {
|
|
497
|
-
let resolved;
|
|
498
497
|
let p;
|
|
499
498
|
let load = id => {
|
|
500
499
|
if (!p) {
|
|
501
|
-
if (id) {
|
|
502
|
-
let ref = sharedConfig.context.resources[id] = {
|
|
503
|
-
ref: p = fn()
|
|
504
|
-
};
|
|
505
|
-
p.then(mod => ref.data = resolved = mod.default);
|
|
506
|
-
return p;
|
|
507
|
-
}
|
|
508
500
|
p = fn();
|
|
509
|
-
p.then(mod => resolved = mod.default);
|
|
501
|
+
p.then(mod => p.resolved = mod.default);
|
|
502
|
+
if (id) sharedConfig.context.lazy[id] = p;
|
|
510
503
|
}
|
|
511
504
|
return p;
|
|
512
505
|
};
|
|
513
506
|
const contexts = new Set();
|
|
514
507
|
const wrap = props => {
|
|
515
508
|
const id = sharedConfig.context.id.slice(0, -1);
|
|
516
|
-
let ref = sharedConfig.context.
|
|
517
|
-
if (ref)
|
|
518
|
-
|
|
519
|
-
resolved = ref.data;
|
|
520
|
-
} else load(id);
|
|
521
|
-
if (resolved) return resolved(props);
|
|
509
|
+
let ref = sharedConfig.context.lazy[id];
|
|
510
|
+
if (ref) p = ref;else load(id);
|
|
511
|
+
if (p.resolved) return p.resolved(props);
|
|
522
512
|
const ctx = useContext(SuspenseContext);
|
|
523
513
|
const track = {
|
|
524
514
|
loading: true,
|
package/dist/server.js
CHANGED
|
@@ -492,31 +492,21 @@ function createResource(source, fetcher, options = {}) {
|
|
|
492
492
|
}];
|
|
493
493
|
}
|
|
494
494
|
function lazy(fn) {
|
|
495
|
-
let resolved;
|
|
496
495
|
let p;
|
|
497
496
|
let load = id => {
|
|
498
497
|
if (!p) {
|
|
499
|
-
if (id) {
|
|
500
|
-
let ref = sharedConfig.context.resources[id] = {
|
|
501
|
-
ref: p = fn()
|
|
502
|
-
};
|
|
503
|
-
p.then(mod => ref.data = resolved = mod.default);
|
|
504
|
-
return p;
|
|
505
|
-
}
|
|
506
498
|
p = fn();
|
|
507
|
-
p.then(mod => resolved = mod.default);
|
|
499
|
+
p.then(mod => p.resolved = mod.default);
|
|
500
|
+
if (id) sharedConfig.context.lazy[id] = p;
|
|
508
501
|
}
|
|
509
502
|
return p;
|
|
510
503
|
};
|
|
511
504
|
const contexts = new Set();
|
|
512
505
|
const wrap = props => {
|
|
513
506
|
const id = sharedConfig.context.id.slice(0, -1);
|
|
514
|
-
let ref = sharedConfig.context.
|
|
515
|
-
if (ref)
|
|
516
|
-
|
|
517
|
-
resolved = ref.data;
|
|
518
|
-
} else load(id);
|
|
519
|
-
if (resolved) return resolved(props);
|
|
507
|
+
let ref = sharedConfig.context.lazy[id];
|
|
508
|
+
if (ref) p = ref;else load(id);
|
|
509
|
+
if (p.resolved) return p.resolved(props);
|
|
520
510
|
const ctx = useContext(SuspenseContext);
|
|
521
511
|
const track = {
|
|
522
512
|
loading: true,
|
package/package.json
CHANGED
|
@@ -134,6 +134,7 @@ declare type HydrationContext = {
|
|
|
134
134
|
resources: Record<string, any>;
|
|
135
135
|
suspense: Record<string, SuspenseContextType>;
|
|
136
136
|
registerFragment: (v: string) => (v?: string, err?: any) => boolean;
|
|
137
|
+
lazy: Record<string, Promise<any>>;
|
|
137
138
|
async?: boolean;
|
|
138
139
|
noHydrate: boolean;
|
|
139
140
|
};
|
package/web/dist/server.cjs
CHANGED
|
@@ -268,6 +268,7 @@ function renderToString(code, options = {}) {
|
|
|
268
268
|
id: options.renderId || "",
|
|
269
269
|
count: 0,
|
|
270
270
|
suspense: {},
|
|
271
|
+
lazy: {},
|
|
271
272
|
assets: [],
|
|
272
273
|
nonce: options.nonce,
|
|
273
274
|
writeResource(id, p, error) {
|
|
@@ -349,6 +350,7 @@ function renderToStream(code, options = {}) {
|
|
|
349
350
|
count: 0,
|
|
350
351
|
async: true,
|
|
351
352
|
resources: {},
|
|
353
|
+
lazy: {},
|
|
352
354
|
suspense: {},
|
|
353
355
|
assets: [],
|
|
354
356
|
nonce,
|
package/web/dist/server.js
CHANGED
|
@@ -267,6 +267,7 @@ function renderToString(code, options = {}) {
|
|
|
267
267
|
id: options.renderId || "",
|
|
268
268
|
count: 0,
|
|
269
269
|
suspense: {},
|
|
270
|
+
lazy: {},
|
|
270
271
|
assets: [],
|
|
271
272
|
nonce: options.nonce,
|
|
272
273
|
writeResource(id, p, error) {
|
|
@@ -348,6 +349,7 @@ function renderToStream(code, options = {}) {
|
|
|
348
349
|
count: 0,
|
|
349
350
|
async: true,
|
|
350
351
|
resources: {},
|
|
352
|
+
lazy: {},
|
|
351
353
|
suspense: {},
|
|
352
354
|
assets: [],
|
|
353
355
|
nonce,
|