octane 0.2.3 → 0.2.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.
- package/dist/cjs/css.cjs +9 -0
- package/dist/cjs/dom-tables.cjs +6 -1
- package/dist/cjs/runtime.cjs +122 -27
- package/dist/cjs/runtime.server.cjs +258 -63
- package/dist/cjs/server/index.cjs +4 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/compiler/bundler.js +7 -0
- package/dist/compiler/compile.js +258 -528
- package/dist/compiler/hydrate-boundaries.js +165 -15
- package/dist/compiler/parser.node.js +34 -8
- package/dist/compiler/strong-mode.js +836 -3
- package/dist/compiler/style-scopes.js +1134 -0
- package/dist/compiler/volar.LICENSES.txt +1 -1
- package/dist/compiler/volar.js +4543 -2839
- package/dist/css.d.ts +7 -0
- package/dist/css.js +8 -0
- package/dist/dom-tables.js +6 -1
- package/dist/runtime.d.ts +19 -3
- package/dist/runtime.js +129 -28
- package/dist/runtime.server.d.ts +28 -1
- package/dist/runtime.server.js +263 -64
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +4 -0
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/dist/runtime.server.js
CHANGED
|
@@ -55,7 +55,13 @@ import {
|
|
|
55
55
|
escapeMappedElementKey,
|
|
56
56
|
resolveLazyDefaultProps as lazyResolvedProps
|
|
57
57
|
} from "./shared-value-helpers.js";
|
|
58
|
-
import {
|
|
58
|
+
import {
|
|
59
|
+
devWarnStyleCoercion,
|
|
60
|
+
devWarnStyleProperty,
|
|
61
|
+
mergeClass,
|
|
62
|
+
normalizeClass,
|
|
63
|
+
styleName
|
|
64
|
+
} from "./css.js";
|
|
59
65
|
import {
|
|
60
66
|
invalidHtmlNestingWithAncestor,
|
|
61
67
|
invalidHtmlNestingWithParent,
|
|
@@ -1464,8 +1470,9 @@ function isAggregatedFormAttribute(tag, name) {
|
|
|
1464
1470
|
function ssrAttrs(sources, tag, namespace = "html", skipFormControls = false) {
|
|
1465
1471
|
namespace = resolveAttributeNamespace(namespace);
|
|
1466
1472
|
const props = /* @__PURE__ */ new Map();
|
|
1473
|
+
let classMerges = null;
|
|
1467
1474
|
let sourceOrder = 0;
|
|
1468
|
-
|
|
1475
|
+
function record(rawName, value) {
|
|
1469
1476
|
if (typeof rawName !== "string") return;
|
|
1470
1477
|
const order = sourceOrder++;
|
|
1471
1478
|
const previous = props.get(rawName);
|
|
@@ -1475,9 +1482,17 @@ function ssrAttrs(sources, tag, namespace = "html", skipFormControls = false) {
|
|
|
1475
1482
|
firstOrder: previous?.firstOrder ?? order,
|
|
1476
1483
|
lastOrder: order
|
|
1477
1484
|
});
|
|
1478
|
-
}
|
|
1479
|
-
for (const [isSpread, sourceOrName, directValue] of sources) {
|
|
1485
|
+
}
|
|
1486
|
+
for (const [isSpread, sourceOrName, directValue, merge] of sources) {
|
|
1480
1487
|
if (!isSpread) {
|
|
1488
|
+
if (merge === true && typeof sourceOrName === "string" && (sourceOrName === "class" || sourceOrName === "className")) {
|
|
1489
|
+
(classMerges ??= []).push({
|
|
1490
|
+
rawName: sourceOrName,
|
|
1491
|
+
value: directValue,
|
|
1492
|
+
order: sourceOrder++
|
|
1493
|
+
});
|
|
1494
|
+
continue;
|
|
1495
|
+
}
|
|
1481
1496
|
record(sourceOrName, directValue);
|
|
1482
1497
|
continue;
|
|
1483
1498
|
}
|
|
@@ -1489,6 +1504,24 @@ function ssrAttrs(sources, tag, namespace = "html", skipFormControls = false) {
|
|
|
1489
1504
|
record(name, source[name]);
|
|
1490
1505
|
}
|
|
1491
1506
|
}
|
|
1507
|
+
if (process.env.NODE_ENV === "production") {
|
|
1508
|
+
let canonical = true;
|
|
1509
|
+
for (const name of props.keys()) {
|
|
1510
|
+
if (normalizeSsrAttributeName(name, tag, namespace) !== name || namespace === "html" && name.toLowerCase() !== name) {
|
|
1511
|
+
canonical = false;
|
|
1512
|
+
break;
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
if (canonical) {
|
|
1516
|
+
let out2 = "";
|
|
1517
|
+
for (const { rawName, value } of props.values()) {
|
|
1518
|
+
if (rawName === "dangerouslySetInnerHTML" || skipFormControls && isAggregatedFormAttribute(tag, rawName))
|
|
1519
|
+
continue;
|
|
1520
|
+
out2 += ssrAttrEntry(rawName, value, tag, namespace);
|
|
1521
|
+
}
|
|
1522
|
+
return out2;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1492
1525
|
const resolved = /* @__PURE__ */ new Map();
|
|
1493
1526
|
let needsWinningOrderSort = false;
|
|
1494
1527
|
for (const writer of props.values()) {
|
|
@@ -1515,6 +1548,24 @@ function ssrAttrs(sources, tag, namespace = "html", skipFormControls = false) {
|
|
|
1515
1548
|
lastOrder
|
|
1516
1549
|
]);
|
|
1517
1550
|
}
|
|
1551
|
+
if (classMerges !== null) {
|
|
1552
|
+
for (const extra of classMerges) {
|
|
1553
|
+
const name = normalizeSsrAttributeName(extra.rawName, tag, namespace);
|
|
1554
|
+
if (!VALID_ATTR_NAME.test(name)) continue;
|
|
1555
|
+
const identity = namespace === "html" ? name.toLowerCase() : name;
|
|
1556
|
+
const previous = resolved.get(identity);
|
|
1557
|
+
if (previous !== void 0) {
|
|
1558
|
+
resolved.set(identity, [
|
|
1559
|
+
previous[0],
|
|
1560
|
+
mergeClass(previous[1], extra.value),
|
|
1561
|
+
previous[2],
|
|
1562
|
+
extra.order
|
|
1563
|
+
]);
|
|
1564
|
+
continue;
|
|
1565
|
+
}
|
|
1566
|
+
resolved.set(identity, [name, extra.value, extra.order, extra.order]);
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1518
1569
|
let out = "";
|
|
1519
1570
|
const ordered = [...resolved.values()];
|
|
1520
1571
|
if (needsWinningOrderSort) ordered.sort((a, b) => a[2] - b[2]);
|
|
@@ -3553,6 +3604,28 @@ function isChildrenBlock(value) {
|
|
|
3553
3604
|
function injectStyle(id, css, nonce) {
|
|
3554
3605
|
if (CSS !== null) CSS.set(id, nonce === void 0 ? { css } : { css, nonce });
|
|
3555
3606
|
}
|
|
3607
|
+
function styleMap(id, css, map, applied = []) {
|
|
3608
|
+
let touching = false;
|
|
3609
|
+
const touch = () => {
|
|
3610
|
+
if (CSS === null || touching) return;
|
|
3611
|
+
touching = true;
|
|
3612
|
+
try {
|
|
3613
|
+
for (const dependency of applied) touchStyleMap(dependency);
|
|
3614
|
+
if (id !== null && css !== null) injectStyle(id, css);
|
|
3615
|
+
} finally {
|
|
3616
|
+
touching = false;
|
|
3617
|
+
}
|
|
3618
|
+
};
|
|
3619
|
+
return new Proxy(map, {
|
|
3620
|
+
get(target, key, receiver) {
|
|
3621
|
+
touch();
|
|
3622
|
+
return Reflect.get(target, key, receiver);
|
|
3623
|
+
}
|
|
3624
|
+
});
|
|
3625
|
+
}
|
|
3626
|
+
function touchStyleMap(map) {
|
|
3627
|
+
if (map !== null && typeof map === "object") void map.$class;
|
|
3628
|
+
}
|
|
3556
3629
|
const HEAD_VOID_ELEMENTS = /* @__PURE__ */ new Set(["meta", "link", "base"]);
|
|
3557
3630
|
function ssrHeadEl(key, tag, attrs, text) {
|
|
3558
3631
|
if (HEAD === null || FALLBACK_HOIST_DEPTH !== 0) return "";
|
|
@@ -4906,19 +4979,30 @@ async function runStream(component, props, options, sink, resolved) {
|
|
|
4906
4979
|
};
|
|
4907
4980
|
const injection = options?.injection;
|
|
4908
4981
|
if (injection !== void 0) injection.done.then(NOOP, NOOP);
|
|
4982
|
+
let injectionCompleted = false;
|
|
4983
|
+
const completeInjection = injection === void 0 ? NOOP : () => {
|
|
4984
|
+
if (injectionCompleted) return;
|
|
4985
|
+
injectionCompleted = true;
|
|
4986
|
+
injection.renderComplete?.();
|
|
4987
|
+
};
|
|
4909
4988
|
let injectionUnsubscribe;
|
|
4910
4989
|
let injectionFailure;
|
|
4911
4990
|
let injectionFailed = false;
|
|
4991
|
+
const unacceptedInjection = injection === void 0 ? void 0 : [];
|
|
4992
|
+
const rememberUnaccepted = injection === void 0 ? NOOP : (chunk) => {
|
|
4993
|
+
unacceptedInjection.push(chunk);
|
|
4994
|
+
};
|
|
4912
4995
|
let signalInjectionFailure;
|
|
4913
4996
|
const failInjection = (err) => {
|
|
4997
|
+
if (signal?.aborted && err === signal.reason) return;
|
|
4914
4998
|
if (injectionFailed) return;
|
|
4915
4999
|
injectionFailed = true;
|
|
4916
5000
|
injectionFailure = err;
|
|
4917
5001
|
signalInjectionFailure?.();
|
|
4918
5002
|
};
|
|
4919
5003
|
let writeChain = injection === void 0 ? null : Promise.resolve();
|
|
4920
|
-
const write = injection === void 0 ? (chunk, terminal) => sink.write(chunk, terminal) : (chunk, terminal) => {
|
|
4921
|
-
const operation = writeChain.then(() => sink.write(chunk, terminal));
|
|
5004
|
+
const write = injection === void 0 ? (chunk, terminal) => sink.write(chunk, terminal) : (chunk, terminal, onUnaccepted) => {
|
|
5005
|
+
const operation = writeChain.then(() => sink.write(chunk, terminal, onUnaccepted));
|
|
4922
5006
|
writeChain = operation.then(NOOP, NOOP);
|
|
4923
5007
|
return operation;
|
|
4924
5008
|
};
|
|
@@ -4932,11 +5016,34 @@ async function runStream(component, props, options, sink, resolved) {
|
|
|
4932
5016
|
return;
|
|
4933
5017
|
}
|
|
4934
5018
|
if (!html) return;
|
|
4935
|
-
return write(html);
|
|
5019
|
+
return write(html, false, rememberUnaccepted);
|
|
5020
|
+
};
|
|
5021
|
+
const recoveryInjection = injection === void 0 ? void 0 : async () => {
|
|
5022
|
+
if (signal?.aborted) {
|
|
5023
|
+
await writeChain;
|
|
5024
|
+
for (const html of unacceptedInjection) {
|
|
5025
|
+
const replay = write(html, "recovery");
|
|
5026
|
+
if (replay !== void 0) await replay;
|
|
5027
|
+
}
|
|
5028
|
+
unacceptedInjection.length = 0;
|
|
5029
|
+
}
|
|
5030
|
+
if (injectionFailed) return "";
|
|
5031
|
+
let queued;
|
|
5032
|
+
try {
|
|
5033
|
+
queued = injection.take();
|
|
5034
|
+
} catch {
|
|
5035
|
+
return "";
|
|
5036
|
+
}
|
|
5037
|
+
if (queued !== "" && signal?.aborted) {
|
|
5038
|
+
const replay = write(queued, "recovery");
|
|
5039
|
+
if (replay !== void 0) await replay;
|
|
5040
|
+
return "";
|
|
5041
|
+
}
|
|
5042
|
+
return queued;
|
|
4936
5043
|
};
|
|
4937
5044
|
const notifyInjection = () => {
|
|
4938
5045
|
const drained = drainInjection();
|
|
4939
|
-
if (drained !== void 0) drained.catch(
|
|
5046
|
+
if (drained !== void 0) drained.catch(failInjection);
|
|
4940
5047
|
};
|
|
4941
5048
|
const waitForInjectionDone = () => new Promise((resolve, reject) => {
|
|
4942
5049
|
let settled = false;
|
|
@@ -5039,12 +5146,24 @@ async function runStream(component, props, options, sink, resolved) {
|
|
|
5039
5146
|
}
|
|
5040
5147
|
pruneStreamBoundariesAbsentFromShell(stream, shellBoundaryKeys);
|
|
5041
5148
|
} catch (err) {
|
|
5149
|
+
try {
|
|
5150
|
+
completeInjection();
|
|
5151
|
+
} catch {
|
|
5152
|
+
}
|
|
5042
5153
|
const reports = signal?.aborted ? Math.max(1, preShellSuspended.length) : 1;
|
|
5043
5154
|
for (let i = 0; i < reports; i++) options?.onError?.(err);
|
|
5044
5155
|
sink.shellError(err);
|
|
5045
5156
|
return;
|
|
5046
5157
|
}
|
|
5047
|
-
|
|
5158
|
+
try {
|
|
5159
|
+
reportRecoverableBoundaryErrors();
|
|
5160
|
+
} catch (err) {
|
|
5161
|
+
try {
|
|
5162
|
+
completeInjection();
|
|
5163
|
+
} catch {
|
|
5164
|
+
}
|
|
5165
|
+
throw err;
|
|
5166
|
+
}
|
|
5048
5167
|
if (pass.sheets !== null) for (const key of pass.sheets.keys()) flushedSheets.add(key);
|
|
5049
5168
|
let leadingStyles = "";
|
|
5050
5169
|
for (const [hash, sheet] of pass.cssEntries) {
|
|
@@ -5052,7 +5171,17 @@ async function runStream(component, props, options, sink, resolved) {
|
|
|
5052
5171
|
leadingStyles += '<style data-octane="' + hash + '"' + (sheet.nonce === void 0 ? nonceAttr : ' nonce="' + escapeAttr(sheet.nonce) + '"') + ">" + escapeEntireInlineStyleContent(sheet.css) + "</style>";
|
|
5053
5172
|
}
|
|
5054
5173
|
const separateHead = options?.headChannel === "separate";
|
|
5055
|
-
if (separateHead)
|
|
5174
|
+
if (separateHead) {
|
|
5175
|
+
try {
|
|
5176
|
+
options?.onHeadReady?.(pass.vtCandidates ? vtSsrStrip(pass.head) : pass.head);
|
|
5177
|
+
} catch (err) {
|
|
5178
|
+
try {
|
|
5179
|
+
completeInjection();
|
|
5180
|
+
} catch {
|
|
5181
|
+
}
|
|
5182
|
+
throw err;
|
|
5183
|
+
}
|
|
5184
|
+
}
|
|
5056
5185
|
const shellHead = separateHead ? "" : pass.head;
|
|
5057
5186
|
const documentRoot = isDocumentRoot(pass.body);
|
|
5058
5187
|
let shell = documentRoot ? "<!DOCTYPE html>" : "";
|
|
@@ -5079,11 +5208,23 @@ async function runStream(component, props, options, sink, resolved) {
|
|
|
5079
5208
|
const shellWrite = write(pass.vtCandidates ? vtSsrStrip(shell) : shell);
|
|
5080
5209
|
if (shellWrite !== void 0) await shellWrite;
|
|
5081
5210
|
} catch (err) {
|
|
5211
|
+
try {
|
|
5212
|
+
completeInjection();
|
|
5213
|
+
} catch {
|
|
5214
|
+
}
|
|
5082
5215
|
options?.onError?.(err);
|
|
5083
5216
|
sink.shellError(err);
|
|
5084
5217
|
return;
|
|
5085
5218
|
}
|
|
5086
|
-
|
|
5219
|
+
try {
|
|
5220
|
+
sink.shellReady();
|
|
5221
|
+
} catch (err) {
|
|
5222
|
+
try {
|
|
5223
|
+
completeInjection();
|
|
5224
|
+
} catch {
|
|
5225
|
+
}
|
|
5226
|
+
throw err;
|
|
5227
|
+
}
|
|
5087
5228
|
if (injection !== void 0) {
|
|
5088
5229
|
try {
|
|
5089
5230
|
injectionUnsubscribe = injection.subscribe(notifyInjection);
|
|
@@ -5173,14 +5314,14 @@ async function runStream(component, props, options, sink, resolved) {
|
|
|
5173
5314
|
injectionUnsubscribe?.();
|
|
5174
5315
|
injectionUnsubscribe = void 0;
|
|
5175
5316
|
try {
|
|
5176
|
-
|
|
5317
|
+
completeInjection();
|
|
5177
5318
|
} catch {
|
|
5178
5319
|
}
|
|
5179
5320
|
}
|
|
5180
5321
|
let tail = "";
|
|
5181
|
-
if (
|
|
5322
|
+
if (recoveryInjection !== void 0) {
|
|
5182
5323
|
try {
|
|
5183
|
-
tail
|
|
5324
|
+
tail = await recoveryInjection();
|
|
5184
5325
|
} catch {
|
|
5185
5326
|
}
|
|
5186
5327
|
}
|
|
@@ -5200,7 +5341,7 @@ async function runStream(component, props, options, sink, resolved) {
|
|
|
5200
5341
|
}
|
|
5201
5342
|
if (injection !== void 0) {
|
|
5202
5343
|
try {
|
|
5203
|
-
|
|
5344
|
+
completeInjection();
|
|
5204
5345
|
} catch (err) {
|
|
5205
5346
|
failInjection(err);
|
|
5206
5347
|
}
|
|
@@ -5208,11 +5349,14 @@ async function runStream(component, props, options, sink, resolved) {
|
|
|
5208
5349
|
await waitForInjectionDone();
|
|
5209
5350
|
const finalDrain = drainInjection();
|
|
5210
5351
|
if (finalDrain !== void 0) await finalDrain;
|
|
5352
|
+
await writeChain;
|
|
5211
5353
|
if (injectionFailed) throw injectionFailure;
|
|
5212
5354
|
if (heldDocumentTail !== "") {
|
|
5213
5355
|
const tailChunk = heldDocumentTail;
|
|
5214
5356
|
heldDocumentTail = "";
|
|
5215
|
-
const tailWrite = write(tailChunk)
|
|
5357
|
+
const tailWrite = write(tailChunk, false, (unaccepted) => {
|
|
5358
|
+
heldDocumentTail = unaccepted;
|
|
5359
|
+
});
|
|
5216
5360
|
if (tailWrite !== void 0) await tailWrite;
|
|
5217
5361
|
}
|
|
5218
5362
|
} catch (err) {
|
|
@@ -5220,11 +5364,9 @@ async function runStream(component, props, options, sink, resolved) {
|
|
|
5220
5364
|
injectionUnsubscribe?.();
|
|
5221
5365
|
injectionUnsubscribe = void 0;
|
|
5222
5366
|
let terminal = "";
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
} catch {
|
|
5227
|
-
}
|
|
5367
|
+
try {
|
|
5368
|
+
terminal = await recoveryInjection();
|
|
5369
|
+
} catch {
|
|
5228
5370
|
}
|
|
5229
5371
|
terminal += heldDocumentTail;
|
|
5230
5372
|
if (terminal !== "") {
|
|
@@ -5289,7 +5431,8 @@ function renderToPipeableStream(entryComponent, props, options) {
|
|
|
5289
5431
|
destinationFailure(err);
|
|
5290
5432
|
}
|
|
5291
5433
|
};
|
|
5292
|
-
const waitForDrain = (dest) => {
|
|
5434
|
+
const waitForDrain = (dest, allowAborted = false) => {
|
|
5435
|
+
if (allowAborted && closed) return Promise.reject(new Error(formatServerError(38)));
|
|
5293
5436
|
if (dest.once === void 0) {
|
|
5294
5437
|
return Promise.reject(new TypeError(formatServerError(39)));
|
|
5295
5438
|
}
|
|
@@ -5325,14 +5468,17 @@ function renderToPipeableStream(entryComponent, props, options) {
|
|
|
5325
5468
|
dest.once("drain", onDrain);
|
|
5326
5469
|
dest.once("error", onError);
|
|
5327
5470
|
dest.once("close", onClose);
|
|
5328
|
-
if (
|
|
5329
|
-
|
|
5471
|
+
if (!allowAborted) {
|
|
5472
|
+
if (controller.signal.aborted) onAbort();
|
|
5473
|
+
else controller.signal.addEventListener("abort", onAbort, { once: true });
|
|
5474
|
+
}
|
|
5330
5475
|
});
|
|
5331
5476
|
};
|
|
5332
|
-
const writeNow = (chunk, terminal) => {
|
|
5477
|
+
const writeNow = (chunk, terminal, onUnaccepted) => {
|
|
5333
5478
|
const dest = destination;
|
|
5334
5479
|
if (closed) return Promise.reject(new Error(formatServerError(40)));
|
|
5335
|
-
if (
|
|
5480
|
+
if (terminal === false && controller.signal.aborted) {
|
|
5481
|
+
onUnaccepted?.(chunk);
|
|
5336
5482
|
return Promise.reject(controller.signal.reason);
|
|
5337
5483
|
}
|
|
5338
5484
|
let accepted;
|
|
@@ -5342,7 +5488,7 @@ function renderToPipeableStream(entryComponent, props, options) {
|
|
|
5342
5488
|
destinationFailure(err);
|
|
5343
5489
|
return Promise.reject(err);
|
|
5344
5490
|
}
|
|
5345
|
-
return accepted === false &&
|
|
5491
|
+
return accepted === false && terminal !== true ? waitForDrain(dest, terminal === "recovery") : void 0;
|
|
5346
5492
|
};
|
|
5347
5493
|
const trackWrite = (operation) => {
|
|
5348
5494
|
const gate = operation.then(
|
|
@@ -5363,16 +5509,18 @@ function renderToPipeableStream(entryComponent, props, options) {
|
|
|
5363
5509
|
});
|
|
5364
5510
|
return operation;
|
|
5365
5511
|
};
|
|
5366
|
-
const queueWrite = (chunk, terminal = false) => {
|
|
5512
|
+
const queueWrite = (chunk, terminal = false, onUnaccepted) => {
|
|
5367
5513
|
if (destination === null) {
|
|
5368
|
-
buffered.push(
|
|
5514
|
+
buffered.push(
|
|
5515
|
+
onUnaccepted === void 0 ? { chunk, terminal } : { chunk, terminal, onUnaccepted }
|
|
5516
|
+
);
|
|
5369
5517
|
return;
|
|
5370
5518
|
}
|
|
5371
5519
|
if (writeGate !== null) {
|
|
5372
|
-
const operation2 = writeGate.then(() => writeNow(chunk, terminal));
|
|
5520
|
+
const operation2 = writeGate.then(() => writeNow(chunk, terminal, onUnaccepted));
|
|
5373
5521
|
return trackWrite(operation2);
|
|
5374
5522
|
}
|
|
5375
|
-
const operation = writeNow(chunk, terminal);
|
|
5523
|
+
const operation = writeNow(chunk, terminal, onUnaccepted);
|
|
5376
5524
|
return operation === void 0 ? void 0 : trackWrite(operation);
|
|
5377
5525
|
};
|
|
5378
5526
|
const flushEnd = () => {
|
|
@@ -5392,8 +5540,8 @@ function renderToPipeableStream(entryComponent, props, options) {
|
|
|
5392
5540
|
props,
|
|
5393
5541
|
renderOptions,
|
|
5394
5542
|
{
|
|
5395
|
-
write(chunk, terminal) {
|
|
5396
|
-
return queueWrite(chunk, terminal);
|
|
5543
|
+
write(chunk, terminal, onUnaccepted) {
|
|
5544
|
+
return queueWrite(chunk, terminal, onUnaccepted);
|
|
5397
5545
|
},
|
|
5398
5546
|
shellReady() {
|
|
5399
5547
|
options?.onShellReady?.();
|
|
@@ -5437,7 +5585,11 @@ function renderToPipeableStream(entryComponent, props, options) {
|
|
|
5437
5585
|
});
|
|
5438
5586
|
}
|
|
5439
5587
|
for (const item of buffered) {
|
|
5440
|
-
queueWrite(
|
|
5588
|
+
queueWrite(
|
|
5589
|
+
item.chunk,
|
|
5590
|
+
item.terminal === "recovery" ? "recovery" : item.terminal || controller.signal.aborted,
|
|
5591
|
+
item.onUnaccepted
|
|
5592
|
+
);
|
|
5441
5593
|
}
|
|
5442
5594
|
buffered.length = 0;
|
|
5443
5595
|
finishEnd();
|
|
@@ -5503,7 +5655,10 @@ function renderToReadableStream(entryComponent, props, options) {
|
|
|
5503
5655
|
});
|
|
5504
5656
|
stream.allReady = allReady;
|
|
5505
5657
|
let shellDone = false;
|
|
5506
|
-
|
|
5658
|
+
let terminal = false;
|
|
5659
|
+
let released = false;
|
|
5660
|
+
let callbackFailure;
|
|
5661
|
+
const waitForDemand = (allowAborted = false) => new Promise((resolve, reject) => {
|
|
5507
5662
|
let settled = false;
|
|
5508
5663
|
const cleanup = () => {
|
|
5509
5664
|
renderController.signal.removeEventListener("abort", onAbort);
|
|
@@ -5518,18 +5673,21 @@ function renderToReadableStream(entryComponent, props, options) {
|
|
|
5518
5673
|
const onDemand = () => finish(resolve);
|
|
5519
5674
|
const onAbort = () => finish(() => reject(renderController.signal.reason));
|
|
5520
5675
|
wakeDemand = onDemand;
|
|
5521
|
-
if (
|
|
5522
|
-
|
|
5676
|
+
if (!allowAborted) {
|
|
5677
|
+
if (renderController.signal.aborted) onAbort();
|
|
5678
|
+
else renderController.signal.addEventListener("abort", onAbort, { once: true });
|
|
5679
|
+
}
|
|
5523
5680
|
});
|
|
5524
|
-
const writeReadable = (chunk,
|
|
5681
|
+
const writeReadable = (chunk, terminal2 = false, onUnaccepted) => {
|
|
5525
5682
|
if (closed || consumerCancelled) {
|
|
5526
5683
|
return Promise.reject(cancelReason ?? new Error(formatServerError(44)));
|
|
5527
5684
|
}
|
|
5528
|
-
if (
|
|
5685
|
+
if (terminal2 === false && renderController.signal.aborted) {
|
|
5686
|
+
onUnaccepted?.(chunk);
|
|
5529
5687
|
return Promise.reject(renderController.signal.reason);
|
|
5530
5688
|
}
|
|
5531
5689
|
const bytes = encoder.encode(chunk);
|
|
5532
|
-
if (
|
|
5690
|
+
if (terminal2 === true) {
|
|
5533
5691
|
readableController.enqueue(bytes);
|
|
5534
5692
|
return;
|
|
5535
5693
|
}
|
|
@@ -5538,13 +5696,18 @@ function renderToReadableStream(entryComponent, props, options) {
|
|
|
5538
5696
|
return;
|
|
5539
5697
|
}
|
|
5540
5698
|
return (async () => {
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5699
|
+
try {
|
|
5700
|
+
while ((readableController.desiredSize ?? 0) <= 0) {
|
|
5701
|
+
await waitForDemand(terminal2 === "recovery");
|
|
5702
|
+
if (closed || consumerCancelled) {
|
|
5703
|
+
throw cancelReason ?? new Error(formatServerError(44));
|
|
5704
|
+
}
|
|
5545
5705
|
}
|
|
5706
|
+
readableController.enqueue(bytes);
|
|
5707
|
+
} catch (err) {
|
|
5708
|
+
if (!consumerCancelled && renderController.signal.aborted) onUnaccepted?.(chunk);
|
|
5709
|
+
throw err;
|
|
5546
5710
|
}
|
|
5547
|
-
readableController.enqueue(bytes);
|
|
5548
5711
|
})();
|
|
5549
5712
|
};
|
|
5550
5713
|
const closeReadable = () => {
|
|
@@ -5558,46 +5721,80 @@ function renderToReadableStream(entryComponent, props, options) {
|
|
|
5558
5721
|
}
|
|
5559
5722
|
};
|
|
5560
5723
|
const renderOptions = { ...options, signal: renderController.signal };
|
|
5724
|
+
if (options?.onError !== void 0) {
|
|
5725
|
+
renderOptions.onError = (error) => {
|
|
5726
|
+
try {
|
|
5727
|
+
options.onError(error);
|
|
5728
|
+
} catch (err) {
|
|
5729
|
+
callbackFailure ??= { error: err };
|
|
5730
|
+
}
|
|
5731
|
+
};
|
|
5732
|
+
}
|
|
5561
5733
|
const resolved = newResolvedMap(renderOptions);
|
|
5734
|
+
const release = () => {
|
|
5735
|
+
if (released) return;
|
|
5736
|
+
released = true;
|
|
5737
|
+
releaseServerRenderResources(resolved);
|
|
5738
|
+
};
|
|
5739
|
+
const settleFailure = (error) => {
|
|
5740
|
+
if (terminal) return;
|
|
5741
|
+
terminal = true;
|
|
5742
|
+
try {
|
|
5743
|
+
release();
|
|
5744
|
+
} catch (err) {
|
|
5745
|
+
error = err;
|
|
5746
|
+
}
|
|
5747
|
+
const reason = callbackFailure === void 0 ? error : callbackFailure.error;
|
|
5748
|
+
if (!shellDone) rejectShell(reason);
|
|
5749
|
+
allReadyReject(reason);
|
|
5750
|
+
closeReadable();
|
|
5751
|
+
};
|
|
5562
5752
|
runStream(
|
|
5563
5753
|
component,
|
|
5564
5754
|
props,
|
|
5565
5755
|
renderOptions,
|
|
5566
5756
|
{
|
|
5567
|
-
write(chunk,
|
|
5568
|
-
return writeReadable(chunk,
|
|
5757
|
+
write(chunk, terminal2, onUnaccepted) {
|
|
5758
|
+
return writeReadable(chunk, terminal2, onUnaccepted);
|
|
5569
5759
|
},
|
|
5570
5760
|
shellReady() {
|
|
5571
|
-
shellDone = true;
|
|
5572
5761
|
options?.onShellReady?.();
|
|
5762
|
+
shellDone = true;
|
|
5573
5763
|
resolveShell(stream);
|
|
5574
5764
|
},
|
|
5575
5765
|
shellError(err) {
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5766
|
+
try {
|
|
5767
|
+
release();
|
|
5768
|
+
options?.onShellError?.(err);
|
|
5769
|
+
} catch (callbackError) {
|
|
5770
|
+
settleFailure(callbackError);
|
|
5771
|
+
return;
|
|
5772
|
+
}
|
|
5773
|
+
settleFailure(err);
|
|
5581
5774
|
},
|
|
5582
5775
|
allReady() {
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5776
|
+
if (terminal) return;
|
|
5777
|
+
try {
|
|
5778
|
+
release();
|
|
5779
|
+
options?.onAllReady?.();
|
|
5780
|
+
} catch (err) {
|
|
5781
|
+
renderOptions.onError?.(err);
|
|
5782
|
+
settleFailure(err);
|
|
5783
|
+
return;
|
|
5784
|
+
}
|
|
5785
|
+
terminal = true;
|
|
5786
|
+
if (callbackFailure === void 0) allReadyResolve();
|
|
5787
|
+
else allReadyReject(callbackFailure.error);
|
|
5586
5788
|
closeReadable();
|
|
5587
5789
|
},
|
|
5588
5790
|
fatal(err) {
|
|
5589
|
-
|
|
5590
|
-
allReadyReject(err);
|
|
5591
|
-
closeReadable();
|
|
5791
|
+
settleFailure(err);
|
|
5592
5792
|
}
|
|
5593
5793
|
},
|
|
5594
5794
|
resolved
|
|
5595
5795
|
).catch((err) => {
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
if (!shellDone) rejectShell(err);
|
|
5599
|
-
allReadyReject(err);
|
|
5600
|
-
closeReadable();
|
|
5796
|
+
renderOptions.onError?.(err);
|
|
5797
|
+
settleFailure(err);
|
|
5601
5798
|
});
|
|
5602
5799
|
});
|
|
5603
5800
|
}
|
|
@@ -5986,6 +6183,8 @@ export {
|
|
|
5986
6183
|
ssrValueAttr,
|
|
5987
6184
|
ssrVoidContent,
|
|
5988
6185
|
startTransition,
|
|
6186
|
+
styleMap,
|
|
6187
|
+
touchStyleMap,
|
|
5989
6188
|
use,
|
|
5990
6189
|
useActionState,
|
|
5991
6190
|
useCallback,
|
package/dist/server/index.d.ts
CHANGED
|
@@ -25,4 +25,4 @@ export { version } from '../version.js';
|
|
|
25
25
|
export { StrictMode, unstable_batchedUpdates } from '../compatibility.js';
|
|
26
26
|
export { createSubSlot, subSlot, type SubSlot, type SlotlessSubSlot, type SubSlotOptions, } from '../sub-slot.js';
|
|
27
27
|
export { __methodDep } from '../method-dep.js';
|
|
28
|
-
export { renderToString, renderToStaticMarkup, renderToPipeableStream, renderToReadableStream, type RenderResult, type RenderOptions, type ServerRenderNode, type StreamOptions, type StreamInjectionSource, setSsrSuspenseTimeout, getSsrSuspenseTimeout, EXTERNAL_HYDRATION_PROMISE, HYDRATION_RANGE_BOUNDARY, useState, useLinkedState, useReducer, __useStateWithGetter, __useLinkedStateWithGetter, __useReducerWithGetter, type LinkedStatePrevious, type LinkedStateOptions, useEffect, useLayoutEffect, useInsertionEffect, useImperativeHandle, useMemo, useCallback, useRef, useId, useEffectEvent, useTransition, useDeferredValue, useSyncExternalStore, useActionState, useActionState as useFormState, useFormStatus, useOptimistic, useDebugValue, memo, lazy, hookSlots, withSlot, manualHook, invokeManualHook, startTransition, flushSync, isChildrenBlock, isValidElement, cloneElement, Children, createPortal, requestFormReset, preload, preinit, preloadModule, preinitModule, preconnect, prefetchDNS, Suspense, ErrorBoundary, Hydrate, Fragment, Activity, Activity as unstable_Activity, ViewTransition, ViewTransition as unstable_ViewTransition, addTransitionType, addTransitionType as unstable_addTransitionType, createContext, use, useContext, ssrIsSuspense, type Context, type FormStatus, markChildrenBlock, markWarm, ssrHtml, ssrChildTextPre, ssrChildPre, descriptorChildren, createElement, createScopedValue, createScopedElement, positionalChildren, escapeHtml, escapeAttr, ssrText, ssrTextPre, ssrNestingText, ssrChild, ssrChildText, ssrAttr, normalizeClass, ssrStyle, ssrClass, ssrAttrs, ssrSnapshotSpread, ssrSpread, ssrInnerHtml, ssrScriptInnerHtml, ssrChildrenSources, ssrSpreadContent, ssrVoidContent, ssrValueAttr, ssrCheckedAttr, ssrInputAttrs, ssrFormAuthoringDiagnostics, ssrTextareaValue, ssrTextareaValueSources, ssrSelectAttrs, ssrSelectScope, ssrSelectScopeSources, ssrOptionValueSources, ssrOption, ssrElement, ssrComponent, ssrComponentNS, ssrInNamespace, ssrBlock, ssrFragmentMarker, ssrActivity, ssrForBlock, mapSlot, ssrControl, ssrArm, ssrTry, ssrPortal, injectStyle, ssrHeadEl, ssrStylesheetResource, ssrStyleResource, ssrScriptResource, namespaceHead, namespaceHeadElement, puMemo, puBatch, warmMemo, warmChild, } from '../runtime.server.js';
|
|
28
|
+
export { renderToString, renderToStaticMarkup, renderToPipeableStream, renderToReadableStream, type RenderResult, type RenderOptions, type ServerRenderNode, type StreamOptions, type StreamInjectionSource, setSsrSuspenseTimeout, getSsrSuspenseTimeout, EXTERNAL_HYDRATION_PROMISE, HYDRATION_RANGE_BOUNDARY, useState, useLinkedState, useReducer, __useStateWithGetter, __useLinkedStateWithGetter, __useReducerWithGetter, type LinkedStatePrevious, type LinkedStateOptions, useEffect, useLayoutEffect, useInsertionEffect, useImperativeHandle, useMemo, useCallback, useRef, useId, useEffectEvent, useTransition, useDeferredValue, useSyncExternalStore, useActionState, useActionState as useFormState, useFormStatus, useOptimistic, useDebugValue, memo, lazy, hookSlots, withSlot, manualHook, invokeManualHook, startTransition, flushSync, isChildrenBlock, isValidElement, cloneElement, Children, createPortal, requestFormReset, preload, preinit, preloadModule, preinitModule, preconnect, prefetchDNS, Suspense, ErrorBoundary, Hydrate, Fragment, Activity, Activity as unstable_Activity, ViewTransition, ViewTransition as unstable_ViewTransition, addTransitionType, addTransitionType as unstable_addTransitionType, createContext, use, useContext, ssrIsSuspense, type Context, type FormStatus, markChildrenBlock, markWarm, ssrHtml, ssrChildTextPre, ssrChildPre, descriptorChildren, createElement, createScopedValue, createScopedElement, positionalChildren, escapeHtml, escapeAttr, ssrText, ssrTextPre, ssrNestingText, ssrChild, ssrChildText, ssrAttr, normalizeClass, ssrStyle, ssrClass, ssrAttrs, ssrSnapshotSpread, ssrSpread, ssrInnerHtml, ssrScriptInnerHtml, ssrChildrenSources, ssrSpreadContent, ssrVoidContent, ssrValueAttr, ssrCheckedAttr, ssrInputAttrs, ssrFormAuthoringDiagnostics, ssrTextareaValue, ssrTextareaValueSources, ssrSelectAttrs, ssrSelectScope, ssrSelectScopeSources, ssrOptionValueSources, ssrOption, ssrElement, ssrComponent, ssrComponentNS, ssrInNamespace, ssrBlock, ssrFragmentMarker, ssrActivity, ssrForBlock, mapSlot, ssrControl, ssrArm, ssrTry, ssrPortal, injectStyle, ssrHeadEl, styleMap, touchStyleMap, ssrStylesheetResource, ssrStyleResource, ssrScriptResource, namespaceHead, namespaceHeadElement, puMemo, puBatch, warmMemo, warmChild, } from '../runtime.server.js';
|
package/dist/server/index.js
CHANGED
|
@@ -127,6 +127,8 @@ import {
|
|
|
127
127
|
ssrPortal,
|
|
128
128
|
injectStyle,
|
|
129
129
|
ssrHeadEl,
|
|
130
|
+
styleMap,
|
|
131
|
+
touchStyleMap,
|
|
130
132
|
ssrStylesheetResource,
|
|
131
133
|
ssrStyleResource,
|
|
132
134
|
ssrScriptResource,
|
|
@@ -243,7 +245,9 @@ export {
|
|
|
243
245
|
ssrValueAttr,
|
|
244
246
|
ssrVoidContent,
|
|
245
247
|
startTransition,
|
|
248
|
+
styleMap,
|
|
246
249
|
subSlot,
|
|
250
|
+
touchStyleMap,
|
|
247
251
|
Activity2 as unstable_Activity,
|
|
248
252
|
ViewTransition2 as unstable_ViewTransition,
|
|
249
253
|
addTransitionType2 as unstable_addTransitionType,
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "octane",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"access": "public"
|
|
152
152
|
},
|
|
153
153
|
"dependencies": {
|
|
154
|
-
"@tsrx/core": "^0.1.
|
|
154
|
+
"@tsrx/core": "^0.1.67",
|
|
155
155
|
"@types/react": "^19.2.17",
|
|
156
156
|
"@volar/language-core": "2.4.28",
|
|
157
157
|
"@volar/typescript": "2.4.28",
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
}
|
|
184
184
|
},
|
|
185
185
|
"devDependencies": {
|
|
186
|
-
"@tsrx/react": "^0.2.
|
|
186
|
+
"@tsrx/react": "^0.2.67",
|
|
187
187
|
"@types/react-dom": "^19.2.3",
|
|
188
188
|
"@wagmi/connectors": "8.0.25",
|
|
189
189
|
"@wagmi/core": "3.6.4",
|