octane 0.2.11 → 0.2.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/README.md +5 -0
- package/dist/behavior-root.d.ts +13 -3
- package/dist/behavior-root.js +28 -5
- package/dist/cjs/behavior-root.cjs +32 -6
- package/dist/cjs/class-names.cjs +49 -0
- package/dist/cjs/constants.cjs +9 -0
- package/dist/cjs/context-epoch.cjs +38 -0
- package/dist/cjs/css.cjs +6 -27
- package/dist/cjs/data-encoding.cjs +160 -0
- package/dist/cjs/dom-binding-handoff.cjs +93 -0
- package/dist/cjs/dom-binding-protocol.cjs +115 -0
- package/dist/cjs/dom-binding-styles.cjs +292 -0
- package/dist/cjs/dom-bindings.cjs +700 -0
- package/dist/cjs/dom-focused-move.cjs +66 -0
- package/dist/cjs/dom-stage.cjs +896 -0
- package/dist/cjs/dom-tables.cjs +4 -94
- package/dist/cjs/error-codes.client.generated.cjs +33 -0
- package/dist/cjs/error-codes.server.generated.cjs +24 -0
- package/dist/cjs/hydration/control-capture.cjs +244 -0
- package/dist/cjs/hydration/event-capture.cjs +125 -43
- package/dist/cjs/hydration/interaction-config.cjs +50 -2
- package/dist/cjs/hydration-markers.cjs +37 -0
- package/dist/cjs/independent-hydration-protocol.cjs +106 -0
- package/dist/cjs/index.cjs +9 -0
- package/dist/cjs/runtime.cjs +6397 -1683
- package/dist/cjs/runtime.server.cjs +1465 -213
- package/dist/cjs/server/early-signals.cjs +45 -0
- package/dist/cjs/server/index.cjs +47 -0
- package/dist/cjs/server/rpc-batch.cjs +149 -0
- package/dist/cjs/server/rpc-stream.cjs +146 -0
- package/dist/cjs/server/rpc.cjs +34 -15
- package/dist/cjs/server/signal-query-observation.cjs +158 -0
- package/dist/cjs/server/streamed-region.cjs +52 -0
- package/dist/cjs/server/streamed-signals.cjs +512 -0
- package/dist/cjs/server-call.cjs +103 -0
- package/dist/cjs/server-rpc-batch-client.cjs +141 -0
- package/dist/cjs/server-rpc-client.cjs +94 -27
- package/dist/cjs/server-rpc-protocol.cjs +141 -0
- package/dist/cjs/server-rpc-stream-client.cjs +118 -0
- package/dist/cjs/signals/actions.cjs +474 -0
- package/dist/cjs/signals/client.cjs +4 -1
- package/dist/cjs/signals/computations.cjs +460 -0
- package/dist/cjs/signals/control-binding.cjs +368 -0
- package/dist/cjs/signals/derived-facade.cjs +50 -0
- package/dist/cjs/signals/document-owner.cjs +71 -0
- package/dist/cjs/signals/early-values.cjs +155 -0
- package/dist/cjs/signals/encoding.cjs +6 -95
- package/dist/cjs/signals/engine.cjs +276 -12
- package/dist/cjs/signals/errors.cjs +18 -0
- package/dist/cjs/signals/facade.cjs +477 -0
- package/dist/cjs/signals/graph.cjs +166 -20
- package/dist/cjs/signals/handle-protocol.cjs +36 -0
- package/dist/cjs/signals/index.cjs +81 -2
- package/dist/cjs/signals/native-read-client.cjs +10 -0
- package/dist/cjs/signals/owner-context.cjs +112 -0
- package/dist/cjs/signals/query-attempt-observer.cjs +68 -0
- package/dist/cjs/signals/query-facade.cjs +72 -0
- package/dist/cjs/signals/read-protocol.cjs +54 -0
- package/dist/cjs/signals/requests.cjs +287 -14
- package/dist/cjs/signals/scalar-computations.cjs +76 -0
- package/dist/cjs/signals/server.cjs +4 -1
- package/dist/cjs/signals/transition-candidate.cjs +567 -0
- package/dist/cjs/signals/transition-state.cjs +106 -0
- package/dist/cjs/signals/types.cjs +50 -0
- package/dist/cjs/stream-protocol.cjs +3 -0
- package/dist/cjs/streamed-signals-protocol.cjs +159 -0
- package/dist/cjs/style-values.cjs +122 -0
- package/dist/cjs/trusted-html.cjs +30 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/class-names.d.ts +5 -0
- package/dist/class-names.js +25 -0
- package/dist/compiler/bundler.js +51 -22
- package/dist/compiler/compile.js +2534 -581
- package/dist/compiler/dom-binding-program.js +935 -0
- package/dist/compiler/dom-binding-request.js +57 -0
- package/dist/compiler/dom-bindings.js +2245 -0
- package/dist/compiler/hook-deps.js +759 -10
- package/dist/compiler/hydrate-boundaries.js +358 -15
- package/dist/compiler/index.d.ts +39 -2
- package/dist/compiler/index.js +1 -0
- package/dist/compiler/native-attribute-reads.js +127 -0
- package/dist/compiler/native-change-diagnostics.js +32 -38
- package/dist/compiler/native-read-diagnostics.js +69 -8
- package/dist/compiler/native-read-types.js +80 -34
- package/dist/compiler/parser.node.js +1 -1
- package/dist/compiler/renderer-boundaries.js +40 -0
- package/dist/compiler/server-context.js +118 -0
- package/dist/compiler/signal-attempt-reads.js +479 -0
- package/dist/compiler/signal-declarations.js +557 -0
- package/dist/compiler/signal-start-reads.js +413 -0
- package/dist/compiler/slot-hooks.d.ts +3 -1
- package/dist/compiler/slot-hooks.js +168 -34
- package/dist/compiler/strong-auto-memo.js +90 -0
- package/dist/compiler/strong-html.js +143 -0
- package/dist/compiler/strong-mode.js +764 -66
- package/dist/compiler/strong-template-policy.js +307 -0
- package/dist/compiler/template-ir.js +200 -0
- package/dist/compiler/typescript.d.ts +2 -0
- package/dist/compiler/typescript.js +2 -0
- package/dist/compiler/vite.d.ts +3 -1
- package/dist/compiler/vite.js +122 -4
- package/dist/compiler/volar.LICENSES.txt +1 -1
- package/dist/compiler/volar.d.ts +6 -1
- package/dist/compiler/volar.js +750 -1433
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +10 -0
- package/dist/context-epoch.d.ts +2 -0
- package/dist/context-epoch.js +13 -0
- package/dist/css.d.ts +2 -5
- package/dist/css.js +2 -23
- package/dist/data-encoding.d.ts +9 -0
- package/dist/data-encoding.js +134 -0
- package/dist/dom-binding-classes.d.ts +15 -0
- package/dist/dom-binding-classes.js +129 -0
- package/dist/dom-binding-controls.d.ts +2 -0
- package/dist/dom-binding-controls.js +6 -0
- package/dist/dom-binding-handoff.d.ts +55 -0
- package/dist/dom-binding-handoff.js +62 -0
- package/dist/dom-binding-program.d.ts +300 -0
- package/dist/dom-binding-program.js +1625 -0
- package/dist/dom-binding-projections.d.ts +15 -0
- package/dist/dom-binding-projections.js +187 -0
- package/dist/dom-binding-protocol.d.ts +13 -0
- package/dist/dom-binding-protocol.js +88 -0
- package/dist/dom-binding-signals.d.ts +21 -0
- package/dist/dom-binding-signals.js +109 -0
- package/dist/dom-binding-styles.d.ts +17 -0
- package/dist/dom-binding-styles.js +272 -0
- package/dist/dom-bindings.d.ts +89 -0
- package/dist/dom-bindings.js +670 -0
- package/dist/dom-focused-move.d.ts +6 -0
- package/dist/dom-focused-move.js +42 -0
- package/dist/dom-stage.d.ts +52 -0
- package/dist/dom-stage.js +872 -0
- package/dist/dom-tables.d.ts +1 -3
- package/dist/dom-tables.js +1 -91
- package/dist/error-codes.client.generated.d.ts +9 -0
- package/dist/error-codes.client.generated.js +33 -0
- package/dist/error-codes.server.generated.d.ts +6 -0
- package/dist/error-codes.server.generated.js +24 -0
- package/dist/hydration/control-capture.d.ts +62 -0
- package/dist/hydration/control-capture.js +223 -0
- package/dist/hydration/document-lifecycle.d.ts +23 -0
- package/dist/hydration/document-lifecycle.js +80 -0
- package/dist/hydration/event-capture.d.ts +20 -1
- package/dist/hydration/event-capture.js +128 -42
- package/dist/hydration/independent-island.d.ts +45 -0
- package/dist/hydration/independent-island.js +233 -0
- package/dist/hydration/index.d.ts +8 -1
- package/dist/hydration/index.js +55 -1
- package/dist/hydration/interaction-config.d.ts +5 -0
- package/dist/hydration/interaction-config.js +44 -1
- package/dist/hydration/stream-delivery.d.ts +32 -0
- package/dist/hydration/stream-delivery.js +333 -0
- package/dist/hydration/stream-receiver.d.ts +26 -0
- package/dist/hydration/stream-receiver.js +204 -0
- package/dist/hydration/stream-result-receiver.d.ts +70 -0
- package/dist/hydration/stream-result-receiver.js +246 -0
- package/dist/hydration/streamed-signals.d.ts +44 -0
- package/dist/hydration/streamed-signals.js +186 -0
- package/dist/hydration/types.d.ts +6 -0
- package/dist/hydration-markers.d.ts +7 -0
- package/dist/hydration-markers.js +10 -0
- package/dist/independent-hydration-protocol.d.ts +31 -0
- package/dist/independent-hydration-protocol.js +80 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/dist/internal/signal-read.d.ts +1 -0
- package/dist/internal/signal-read.js +4 -0
- package/dist/jsx-runtime-strong.d.ts +33 -0
- package/dist/jsx-runtime.d.ts +58 -2
- package/dist/public-types.d.ts +15 -1
- package/dist/runtime.d.ts +297 -23
- package/dist/runtime.js +6405 -1679
- package/dist/runtime.server.d.ts +110 -27
- package/dist/runtime.server.js +1458 -213
- package/dist/server/early-signals.d.ts +14 -0
- package/dist/server/early-signals.js +34 -0
- package/dist/server/index.d.ts +11 -2
- package/dist/server/index.js +50 -1
- package/dist/server/rpc-batch.d.ts +17 -0
- package/dist/server/rpc-batch.js +129 -0
- package/dist/server/rpc-stream.d.ts +9 -0
- package/dist/server/rpc-stream.js +125 -0
- package/dist/server/rpc.d.ts +5 -1
- package/dist/server/rpc.js +37 -13
- package/dist/server/signal-query-observation.d.ts +3 -0
- package/dist/server/signal-query-observation.js +134 -0
- package/dist/server/streamed-region.d.ts +15 -0
- package/dist/server/streamed-region.js +30 -0
- package/dist/server/streamed-signals.d.ts +45 -0
- package/dist/server/streamed-signals.js +488 -0
- package/dist/server-call.d.ts +41 -0
- package/dist/server-call.js +75 -0
- package/dist/server-rpc-batch-client.d.ts +7 -0
- package/dist/server-rpc-batch-client.js +119 -0
- package/dist/server-rpc-client.d.ts +3 -1
- package/dist/server-rpc-client.js +99 -27
- package/dist/server-rpc-protocol.d.ts +47 -0
- package/dist/server-rpc-protocol.js +109 -0
- package/dist/server-rpc-stream-client.d.ts +5 -0
- package/dist/server-rpc-stream-client.js +98 -0
- package/dist/signals/actions.d.ts +12 -0
- package/dist/signals/actions.js +466 -0
- package/dist/signals/client.d.ts +2 -0
- package/dist/signals/client.js +1 -0
- package/dist/signals/computations.d.ts +37 -0
- package/dist/signals/computations.js +455 -0
- package/dist/signals/control-binding.d.ts +31 -0
- package/dist/signals/control-binding.js +353 -0
- package/dist/signals/derived-facade.d.ts +3 -0
- package/dist/signals/derived-facade.js +25 -0
- package/dist/signals/document-owner.d.ts +10 -0
- package/dist/signals/document-owner.js +43 -0
- package/dist/signals/early-values.d.ts +24 -0
- package/dist/signals/early-values.js +124 -0
- package/dist/signals/encoding.d.ts +1 -3
- package/dist/signals/encoding.js +3 -93
- package/dist/signals/engine.d.ts +53 -4
- package/dist/signals/engine.js +275 -16
- package/dist/signals/errors.d.ts +7 -0
- package/dist/signals/errors.js +16 -0
- package/dist/signals/facade.d.ts +74 -0
- package/dist/signals/facade.js +452 -0
- package/dist/signals/graph.d.ts +52 -6
- package/dist/signals/graph.js +174 -19
- package/dist/signals/handle-protocol.d.ts +4 -0
- package/dist/signals/handle-protocol.js +11 -0
- package/dist/signals/index.d.ts +12 -3
- package/dist/signals/index.js +71 -2
- package/dist/signals/native-read-client.d.ts +3 -0
- package/dist/signals/native-read-client.js +10 -0
- package/dist/signals/owner-context.d.ts +22 -0
- package/dist/signals/owner-context.js +77 -0
- package/dist/signals/query-attempt-observer.d.ts +49 -0
- package/dist/signals/query-attempt-observer.js +41 -0
- package/dist/signals/query-facade.d.ts +3 -0
- package/dist/signals/query-facade.js +49 -0
- package/dist/signals/read-protocol.d.ts +37 -2
- package/dist/signals/read-protocol.js +44 -0
- package/dist/signals/requests.d.ts +38 -5
- package/dist/signals/requests.js +298 -15
- package/dist/signals/scalar-computations.d.ts +2 -0
- package/dist/signals/scalar-computations.js +60 -0
- package/dist/signals/server.d.ts +2 -0
- package/dist/signals/server.js +1 -0
- package/dist/signals/transition-candidate.d.ts +71 -0
- package/dist/signals/transition-candidate.js +557 -0
- package/dist/signals/transition-state.d.ts +51 -0
- package/dist/signals/transition-state.js +70 -0
- package/dist/signals/types.d.ts +95 -5
- package/dist/signals/types.js +20 -0
- package/dist/stream-protocol.d.ts +0 -5
- package/dist/stream-protocol.js +3 -0
- package/dist/streamed-signals-protocol.d.ts +60 -0
- package/dist/streamed-signals-protocol.js +130 -0
- package/dist/style-values.d.ts +3 -0
- package/dist/style-values.js +96 -0
- package/dist/trusted-html.d.ts +17 -0
- package/dist/trusted-html.js +6 -0
- package/dist/universal-core.d.ts +6 -0
- package/dist/universal-core.js +214 -202
- package/dist/version.js +1 -1
- package/package.json +48 -5
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var types_exports = {};
|
|
20
|
+
__export(types_exports, {
|
|
21
|
+
QUERY_REQUEST: () => QUERY_REQUEST,
|
|
22
|
+
SIGNAL_BINDING_IDENTITY: () => SIGNAL_BINDING_IDENTITY,
|
|
23
|
+
SIGNAL_BINDING_READ: () => SIGNAL_BINDING_READ,
|
|
24
|
+
SIGNAL_BINDING_SUBSCRIBE: () => SIGNAL_BINDING_SUBSCRIBE,
|
|
25
|
+
SIGNAL_HANDLE: () => SIGNAL_HANDLE,
|
|
26
|
+
SIGNAL_OWNER_RESOLVE: () => SIGNAL_OWNER_RESOLVE,
|
|
27
|
+
skip: () => skip
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(types_exports);
|
|
30
|
+
const SIGNAL_HANDLE = /* @__PURE__ */ Symbol.for("octane.signal-handle");
|
|
31
|
+
const SIGNAL_BINDING_READ = /* @__PURE__ */ Symbol.for("octane.signal-binding-read");
|
|
32
|
+
const SIGNAL_BINDING_SUBSCRIBE = /* @__PURE__ */ Symbol.for(
|
|
33
|
+
"octane.signal-binding-subscribe"
|
|
34
|
+
);
|
|
35
|
+
const SIGNAL_BINDING_IDENTITY = /* @__PURE__ */ Symbol.for(
|
|
36
|
+
"octane.signal-binding-identity"
|
|
37
|
+
);
|
|
38
|
+
const QUERY_REQUEST = /* @__PURE__ */ Symbol.for("octane.query-request");
|
|
39
|
+
const SIGNAL_OWNER_RESOLVE = /* @__PURE__ */ Symbol.for("octane.signal-owner-resolve");
|
|
40
|
+
const skip = /* @__PURE__ */ Symbol.for("octane.query-skip");
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
QUERY_REQUEST,
|
|
44
|
+
SIGNAL_BINDING_IDENTITY,
|
|
45
|
+
SIGNAL_BINDING_READ,
|
|
46
|
+
SIGNAL_BINDING_SUBSCRIBE,
|
|
47
|
+
SIGNAL_HANDLE,
|
|
48
|
+
SIGNAL_OWNER_RESOLVE,
|
|
49
|
+
skip
|
|
50
|
+
});
|
|
@@ -26,12 +26,15 @@ __export(stream_protocol_exports, {
|
|
|
26
26
|
streamTokenFromBoundaryId: () => streamTokenFromBoundaryId
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(stream_protocol_exports);
|
|
29
|
+
var import_dom_binding_protocol = require("./dom-binding-protocol.cjs");
|
|
29
30
|
const STREAM_BOUNDARY_ATTR = "data-oct-b";
|
|
30
31
|
const HYDRATE_STREAM_TOKEN_ATTR = "data-octane-stream-token";
|
|
31
32
|
function hydrationMarkerMultiplicity(data, open) {
|
|
32
33
|
const marker = open ? "[" : "]";
|
|
33
34
|
if (data === marker) return 1;
|
|
34
35
|
if (open && (data === "[f0" || data === "[f1")) return 1;
|
|
36
|
+
if (open && (data.startsWith("[b;") || data.startsWith("[f")) && (0, import_dom_binding_protocol.isBindingOpenComment)(data))
|
|
37
|
+
return 1;
|
|
35
38
|
if (data.length < 2 || data.charCodeAt(0) !== marker.charCodeAt(0)) return 0;
|
|
36
39
|
const first = data.charCodeAt(1);
|
|
37
40
|
if (first < 49 || first > 57) return 0;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var streamed_signals_protocol_exports = {};
|
|
20
|
+
__export(streamed_signals_protocol_exports, {
|
|
21
|
+
decodeStreamedRendererFrame: () => decodeStreamedRendererFrame,
|
|
22
|
+
encodeStreamedRendererFrameForScript: () => encodeStreamedRendererFrameForScript,
|
|
23
|
+
isStreamFrameIdentity: () => isStreamFrameIdentity,
|
|
24
|
+
isStreamedRendererFrame: () => isStreamedRendererFrame,
|
|
25
|
+
sameStreamFrameIdentity: () => sameStreamFrameIdentity,
|
|
26
|
+
streamFrameIdentityKey: () => streamFrameIdentityKey
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(streamed_signals_protocol_exports);
|
|
29
|
+
function isRecord(value) {
|
|
30
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
31
|
+
const prototype = Object.getPrototypeOf(value);
|
|
32
|
+
if (prototype !== Object.prototype && prototype !== null) return false;
|
|
33
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
34
|
+
if (typeof key !== "string") return false;
|
|
35
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
36
|
+
if (!descriptor.enumerable || !("value" in descriptor)) return false;
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
function isKey(value) {
|
|
41
|
+
return typeof value === "string" && value.length > 0 && value.length <= 1024;
|
|
42
|
+
}
|
|
43
|
+
function isCounter(value) {
|
|
44
|
+
return Number.isSafeInteger(value) && value >= 0;
|
|
45
|
+
}
|
|
46
|
+
function hasOnly(record, allowed) {
|
|
47
|
+
return Object.keys(record).every((key) => allowed.has(key));
|
|
48
|
+
}
|
|
49
|
+
const IDENTITY_KEYS = /* @__PURE__ */ new Set([
|
|
50
|
+
"protocol",
|
|
51
|
+
"buildId",
|
|
52
|
+
"documentId",
|
|
53
|
+
"ownerKey",
|
|
54
|
+
"instanceKey",
|
|
55
|
+
"nodeKey",
|
|
56
|
+
"selectionKey",
|
|
57
|
+
"selectionGeneration",
|
|
58
|
+
"attempt"
|
|
59
|
+
]);
|
|
60
|
+
function isStreamFrameIdentity(value) {
|
|
61
|
+
if (!isRecord(value) || !hasOnly(value, IDENTITY_KEYS)) return false;
|
|
62
|
+
return value.protocol === 1 && isKey(value.buildId) && isKey(value.documentId) && isKey(value.ownerKey) && isKey(value.instanceKey) && isKey(value.nodeKey) && isKey(value.selectionKey) && isCounter(value.selectionGeneration) && isCounter(value.attempt);
|
|
63
|
+
}
|
|
64
|
+
function isEncodedSignalValue(value, depth = 0) {
|
|
65
|
+
if (depth > 100 || !Array.isArray(value) || typeof value[0] !== "string") return false;
|
|
66
|
+
const tag = value[0];
|
|
67
|
+
if (tag === "undefined" || tag === "null") return value.length === 1;
|
|
68
|
+
if (value.length !== 2) return false;
|
|
69
|
+
if (tag === "boolean") return typeof value[1] === "boolean";
|
|
70
|
+
if (tag === "string") return typeof value[1] === "string";
|
|
71
|
+
if (tag === "number") {
|
|
72
|
+
return value[1] === "-0" || typeof value[1] === "number" && Number.isFinite(value[1]) && !Object.is(value[1], -0);
|
|
73
|
+
}
|
|
74
|
+
if (tag === "array") {
|
|
75
|
+
return Array.isArray(value[1]) && value[1].every((item) => isEncodedSignalValue(item, depth + 1));
|
|
76
|
+
}
|
|
77
|
+
if (tag !== "object" || !Array.isArray(value[1])) return false;
|
|
78
|
+
let previous;
|
|
79
|
+
for (const entry of value[1]) {
|
|
80
|
+
if (!Array.isArray(entry) || entry.length !== 2 || typeof entry[0] !== "string" || previous !== void 0 && entry[0] <= previous || !isEncodedSignalValue(entry[1], depth + 1)) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
previous = entry[0];
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
function isHistoricalFrame(value) {
|
|
88
|
+
return isRecord(value) && value.version === 1 && isKey(value.scopeKey) && Array.isArray(value.entries);
|
|
89
|
+
}
|
|
90
|
+
const RESULT_BASE_KEYS = /* @__PURE__ */ new Set(["identity", "sequence", "channel", "kind"]);
|
|
91
|
+
function isStreamedRendererFrame(value) {
|
|
92
|
+
if (!isRecord(value) || !isStreamFrameIdentity(value.identity) || !isCounter(value.sequence)) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
if (value.channel === "result") {
|
|
96
|
+
if (value.kind === "open") {
|
|
97
|
+
return hasOnly(value, /* @__PURE__ */ new Set([...RESULT_BASE_KEYS, "resource"])) && (value.resource === "promise" || value.resource === "stream");
|
|
98
|
+
}
|
|
99
|
+
if (value.kind === "value") {
|
|
100
|
+
return hasOnly(value, /* @__PURE__ */ new Set([...RESULT_BASE_KEYS, "value"])) && isEncodedSignalValue(value.value);
|
|
101
|
+
}
|
|
102
|
+
if (value.kind === "error") {
|
|
103
|
+
return hasOnly(value, /* @__PURE__ */ new Set([...RESULT_BASE_KEYS, "code"])) && isKey(value.code);
|
|
104
|
+
}
|
|
105
|
+
return value.kind === "complete" && hasOnly(value, RESULT_BASE_KEYS);
|
|
106
|
+
}
|
|
107
|
+
if (value.channel !== "placement" || value.kind !== "html") return false;
|
|
108
|
+
const allowed = /* @__PURE__ */ new Set([
|
|
109
|
+
"identity",
|
|
110
|
+
"sequence",
|
|
111
|
+
"channel",
|
|
112
|
+
"kind",
|
|
113
|
+
"contentRevision",
|
|
114
|
+
"baseRevision",
|
|
115
|
+
"mode",
|
|
116
|
+
"html",
|
|
117
|
+
"historicalFrame",
|
|
118
|
+
"styles"
|
|
119
|
+
]);
|
|
120
|
+
if (!hasOnly(value, allowed) || !isCounter(value.contentRevision) || value.mode !== "full" && value.mode !== "delta" || typeof value.html !== "string" || !isHistoricalFrame(value.historicalFrame) || !Array.isArray(value.styles) || !value.styles.every(isKey) || new Set(value.styles).size !== value.styles.length) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
if (value.mode === "delta") return isCounter(value.baseRevision);
|
|
124
|
+
return value.baseRevision === void 0 || isCounter(value.baseRevision);
|
|
125
|
+
}
|
|
126
|
+
function decodeStreamedRendererFrame(json) {
|
|
127
|
+
const value = JSON.parse(json);
|
|
128
|
+
if (!isStreamedRendererFrame(value)) throw new Error("Invalid Octane streamed renderer frame.");
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
function encodeStreamedRendererFrameForScript(frame) {
|
|
132
|
+
if (!isStreamedRendererFrame(frame)) throw new Error("Invalid Octane streamed renderer frame.");
|
|
133
|
+
return JSON.stringify(frame).replace(/&/g, "\\u0026").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
134
|
+
}
|
|
135
|
+
function sameStreamFrameIdentity(a, b) {
|
|
136
|
+
return a.protocol === b.protocol && a.buildId === b.buildId && a.documentId === b.documentId && a.ownerKey === b.ownerKey && a.instanceKey === b.instanceKey && a.nodeKey === b.nodeKey && a.selectionKey === b.selectionKey && a.selectionGeneration === b.selectionGeneration && a.attempt === b.attempt;
|
|
137
|
+
}
|
|
138
|
+
function streamFrameIdentityKey(identity) {
|
|
139
|
+
return JSON.stringify([
|
|
140
|
+
identity.protocol,
|
|
141
|
+
identity.buildId,
|
|
142
|
+
identity.documentId,
|
|
143
|
+
identity.ownerKey,
|
|
144
|
+
identity.instanceKey,
|
|
145
|
+
identity.nodeKey,
|
|
146
|
+
identity.selectionKey,
|
|
147
|
+
identity.selectionGeneration,
|
|
148
|
+
identity.attempt
|
|
149
|
+
]);
|
|
150
|
+
}
|
|
151
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
152
|
+
0 && (module.exports = {
|
|
153
|
+
decodeStreamedRendererFrame,
|
|
154
|
+
encodeStreamedRendererFrameForScript,
|
|
155
|
+
isStreamFrameIdentity,
|
|
156
|
+
isStreamedRendererFrame,
|
|
157
|
+
sameStreamFrameIdentity,
|
|
158
|
+
streamFrameIdentityKey
|
|
159
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var style_values_exports = {};
|
|
20
|
+
__export(style_values_exports, {
|
|
21
|
+
cssStyleValue: () => cssStyleValue,
|
|
22
|
+
hyphenateStyleName: () => hyphenateStyleName,
|
|
23
|
+
isUnitlessStyleProp: () => isUnitlessStyleProp
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(style_values_exports);
|
|
26
|
+
const UNITLESS_STYLE_PROPS = /* @__PURE__ */ new Set();
|
|
27
|
+
for (const base of [
|
|
28
|
+
"animationIterationCount",
|
|
29
|
+
"aspectRatio",
|
|
30
|
+
"borderImageOutset",
|
|
31
|
+
"borderImageSlice",
|
|
32
|
+
"borderImageWidth",
|
|
33
|
+
"boxFlex",
|
|
34
|
+
"boxFlexGroup",
|
|
35
|
+
"boxOrdinalGroup",
|
|
36
|
+
"columnCount",
|
|
37
|
+
"columns",
|
|
38
|
+
"flex",
|
|
39
|
+
"flexGrow",
|
|
40
|
+
"flexPositive",
|
|
41
|
+
"flexShrink",
|
|
42
|
+
"flexNegative",
|
|
43
|
+
"flexOrder",
|
|
44
|
+
"gridArea",
|
|
45
|
+
"gridRow",
|
|
46
|
+
"gridRowEnd",
|
|
47
|
+
"gridRowSpan",
|
|
48
|
+
"gridRowStart",
|
|
49
|
+
"gridColumn",
|
|
50
|
+
"gridColumnEnd",
|
|
51
|
+
"gridColumnSpan",
|
|
52
|
+
"gridColumnStart",
|
|
53
|
+
"fontWeight",
|
|
54
|
+
"lineClamp",
|
|
55
|
+
"lineHeight",
|
|
56
|
+
"opacity",
|
|
57
|
+
"order",
|
|
58
|
+
"orphans",
|
|
59
|
+
"scale",
|
|
60
|
+
"tabSize",
|
|
61
|
+
"widows",
|
|
62
|
+
"zIndex",
|
|
63
|
+
"zoom",
|
|
64
|
+
"fillOpacity",
|
|
65
|
+
"floodOpacity",
|
|
66
|
+
"stopOpacity",
|
|
67
|
+
"strokeDasharray",
|
|
68
|
+
"strokeDashoffset",
|
|
69
|
+
"strokeMiterlimit",
|
|
70
|
+
"strokeOpacity",
|
|
71
|
+
"strokeWidth"
|
|
72
|
+
]) {
|
|
73
|
+
const c = base.toLowerCase();
|
|
74
|
+
UNITLESS_STYLE_PROPS.add(c);
|
|
75
|
+
UNITLESS_STYLE_PROPS.add("webkit" + c);
|
|
76
|
+
UNITLESS_STYLE_PROPS.add("ms" + c);
|
|
77
|
+
UNITLESS_STYLE_PROPS.add("moz" + c);
|
|
78
|
+
UNITLESS_STYLE_PROPS.add("o" + c);
|
|
79
|
+
}
|
|
80
|
+
const unitlessStylePropCache = /* @__PURE__ */ new Map();
|
|
81
|
+
function isUnitlessStyleProp(name) {
|
|
82
|
+
const cached = unitlessStylePropCache.get(name);
|
|
83
|
+
if (cached !== void 0) return cached;
|
|
84
|
+
const result = UNITLESS_STYLE_PROPS.has(name.replaceAll("-", "").toLowerCase());
|
|
85
|
+
unitlessStylePropCache.set(name, result);
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
function cssStyleValue(name, value) {
|
|
89
|
+
if (typeof value === "number" && value !== 0 && name.charCodeAt(0) !== 45 && !isUnitlessStyleProp(name)) {
|
|
90
|
+
return value + "px";
|
|
91
|
+
}
|
|
92
|
+
return typeof value === "string" ? value.trim() : "" + value;
|
|
93
|
+
}
|
|
94
|
+
function hyphenateStyleName(name) {
|
|
95
|
+
if (name === "cssFloat") return "float";
|
|
96
|
+
if (name.charCodeAt(0) === 45) return name;
|
|
97
|
+
let hasUpper = false;
|
|
98
|
+
for (let i = 0; i < name.length; i++) {
|
|
99
|
+
const c = name.charCodeAt(i);
|
|
100
|
+
if (c >= 65 && c <= 90) {
|
|
101
|
+
hasUpper = true;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (!hasUpper) return name;
|
|
106
|
+
let out = "";
|
|
107
|
+
for (let i = 0; i < name.length; i++) {
|
|
108
|
+
const c = name.charCodeAt(i);
|
|
109
|
+
if (c >= 65 && c <= 90) out += "-" + String.fromCharCode(c + 32);
|
|
110
|
+
else out += name[i];
|
|
111
|
+
}
|
|
112
|
+
if (out.charCodeAt(0) === 109 && out.charCodeAt(1) === 115 && out.charCodeAt(2) === 45) {
|
|
113
|
+
out = "-" + out;
|
|
114
|
+
}
|
|
115
|
+
return out;
|
|
116
|
+
}
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
cssStyleValue,
|
|
120
|
+
hyphenateStyleName,
|
|
121
|
+
isUnitlessStyleProp
|
|
122
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var trusted_html_exports = {};
|
|
20
|
+
__export(trusted_html_exports, {
|
|
21
|
+
trustHTML: () => trustHTML
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(trusted_html_exports);
|
|
24
|
+
function trustHTML(html) {
|
|
25
|
+
return { __html: html };
|
|
26
|
+
}
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
trustHTML
|
|
30
|
+
});
|
package/dist/cjs/version.cjs
CHANGED
|
@@ -21,7 +21,7 @@ __export(version_exports, {
|
|
|
21
21
|
version: () => version
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(version_exports);
|
|
24
|
-
const version = "0.2.
|
|
24
|
+
const version = "0.2.13";
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
27
|
version
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function normalizeClass(value) {
|
|
2
|
+
if (typeof value === "string") return value;
|
|
3
|
+
if (typeof value !== "object") {
|
|
4
|
+
return typeof value === "number" && value ? "" + value : "";
|
|
5
|
+
}
|
|
6
|
+
if (value === null) return "";
|
|
7
|
+
let str = "";
|
|
8
|
+
if (Array.isArray(value)) {
|
|
9
|
+
for (let i = 0; i < value.length; i++) {
|
|
10
|
+
const item = value[i];
|
|
11
|
+
if (item) {
|
|
12
|
+
const inner = normalizeClass(item);
|
|
13
|
+
if (inner) str = str ? str + " " + inner : inner;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
for (const k in value) {
|
|
18
|
+
if (value[k]) str = str ? str + " " + k : k;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return str;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
normalizeClass
|
|
25
|
+
};
|
package/dist/compiler/bundler.js
CHANGED
|
@@ -14,6 +14,7 @@ import * as nodeFs from 'node:fs';
|
|
|
14
14
|
import * as nodeModule from 'node:module';
|
|
15
15
|
import * as nodePath from 'node:path';
|
|
16
16
|
import { parseModule } from '@tsrx/core';
|
|
17
|
+
export { DOM_BINDING_COMPILER_ABI_VERSION } from './dom-bindings.js';
|
|
17
18
|
import {
|
|
18
19
|
compile,
|
|
19
20
|
compileForBundler,
|
|
@@ -23,6 +24,7 @@ import {
|
|
|
23
24
|
} from './compile.js';
|
|
24
25
|
import { validateRendererModuleSource } from './compile-universal.js';
|
|
25
26
|
import { HYDRATE_QUERY_PARAM, hydrateBoundaryPathFromId } from './hydrate-boundaries.js';
|
|
27
|
+
import { parseDomBindingRequest, formatDomBindingRequest } from './dom-binding-request.js';
|
|
26
28
|
import {
|
|
27
29
|
DOM_RENDERER_MODULE,
|
|
28
30
|
normalizeRendererConfig,
|
|
@@ -54,6 +56,7 @@ export {
|
|
|
54
56
|
CLIENT_REFERENCE_MANIFEST_VERSION,
|
|
55
57
|
createClientReferenceManifest,
|
|
56
58
|
} from './client-only-server.js';
|
|
59
|
+
export const INDEPENDENT_HYDRATION_MANIFEST_FILENAME = 'octane-independent-hydration.json';
|
|
57
60
|
export {
|
|
58
61
|
DOM_RENDERER_ID,
|
|
59
62
|
DOM_RENDERER_MODULE,
|
|
@@ -516,6 +519,7 @@ class OctaneBundlerCompiler {
|
|
|
516
519
|
profile: options.profile === true,
|
|
517
520
|
inlineHookMemo: options.inlineHookMemo !== false,
|
|
518
521
|
strong: options.strong === true,
|
|
522
|
+
knownAttributeSpreads: options.knownAttributeSpreads,
|
|
519
523
|
universalRuntime: normalizeUniversalRuntime(options.universalRuntime),
|
|
520
524
|
};
|
|
521
525
|
this.renderers = normalizeRendererConfig(options.renderers);
|
|
@@ -523,17 +527,17 @@ class OctaneBundlerCompiler {
|
|
|
523
527
|
// Octane islands): when enabled, a project `.tsrx` is Octane's by
|
|
524
528
|
// extension (nothing else compiles the syntax), and a project
|
|
525
529
|
// `.tsx`/`.ts`/`.js` is Octane's only if it opens with a leading
|
|
526
|
-
// `/** @jsxImportSource octane */` pragma (
|
|
527
|
-
// intrinsics
|
|
528
|
-
// slotting for plain `.ts`/`.js`. A leading
|
|
529
|
-
// source (`react`, …) does NOT claim the file. Unmarked project
|
|
530
|
+
// `/** @jsxImportSource octane */` pragma (the `octane/strong` type
|
|
531
|
+
// surface and registered renderer intrinsics also count) — full
|
|
532
|
+
// compilation for `.tsx`, hook slotting for plain `.ts`/`.js`. A leading
|
|
533
|
+
// pragma naming a foreign source (`react`, …) does NOT claim the file. Unmarked project
|
|
530
534
|
// modules pass through to the host toolchain. Installed/linked
|
|
531
535
|
// packages keep their manifest `usesOctane` decision. The pragma
|
|
532
536
|
// always ships unchanged — it is meaningful to TypeScript and
|
|
533
537
|
// downstream tools (in a JSX-less `.ts`/`.js` module TypeScript
|
|
534
538
|
// ignores it, so there it acts purely as the ownership marker).
|
|
535
539
|
this.requireDirective = options.requireDirective === true;
|
|
536
|
-
this.pragmaOwnedModules = new Set([DOM_RENDERER_MODULE]);
|
|
540
|
+
this.pragmaOwnedModules = new Set([DOM_RENDERER_MODULE, 'octane/strong']);
|
|
537
541
|
for (const renderer of Object.values(this.renderers.registry)) {
|
|
538
542
|
if (renderer.intrinsics !== undefined) this.pragmaOwnedModules.add(renderer.intrinsics);
|
|
539
543
|
}
|
|
@@ -691,7 +695,7 @@ class OctaneBundlerCompiler {
|
|
|
691
695
|
|
|
692
696
|
/**
|
|
693
697
|
* Does a leading `@jsxImportSource` pragma claim this module for Octane?
|
|
694
|
-
* `octane
|
|
698
|
+
* `octane`, its Strong type surface, and registered renderer intrinsics count;
|
|
695
699
|
* a pragma naming a FOREIGN source (`react`, `@emotion/react`, …) does not
|
|
696
700
|
* claim the file — under the requireDirective gate the module behaves
|
|
697
701
|
* exactly like an unmarked one.
|
|
@@ -706,9 +710,9 @@ class OctaneBundlerCompiler {
|
|
|
706
710
|
* A project `.tsrx` is Octane's by extension — in an Octane pipeline
|
|
707
711
|
* nothing else compiles the syntax, so there is nothing to opt into;
|
|
708
712
|
* every other project module is Octane's only when `pragmaOwned` (its
|
|
709
|
-
* leading `@jsxImportSource` pragma names octane or a
|
|
710
|
-
* renderer's intrinsics module). This gate covers full compilation;
|
|
711
|
-
* plain `.ts`/`.js` hook-slotting branch of `transform` applies the same
|
|
713
|
+
* leading `@jsxImportSource` pragma names octane, octane/strong, or a
|
|
714
|
+
* registered renderer's intrinsics module). This gate covers full compilation;
|
|
715
|
+
* the plain `.ts`/`.js` hook-slotting branch of `transform` applies the same
|
|
712
716
|
* pragma rule inline.
|
|
713
717
|
* Two carve-outs: installed and linked packages are exempt (their
|
|
714
718
|
* manifest `usesOctane` rule is already the explicit per-package
|
|
@@ -1064,6 +1068,10 @@ class OctaneBundlerCompiler {
|
|
|
1064
1068
|
);
|
|
1065
1069
|
const file = cleanModuleId(id);
|
|
1066
1070
|
const hydrateBoundaryPath = hydrateBoundaryPathFromId(id);
|
|
1071
|
+
const bindingRequest = parseDomBindingRequest(id);
|
|
1072
|
+
if (bindingRequest !== null && hydrateBoundaryPath !== null) {
|
|
1073
|
+
throw new Error('Octane DOM binding and Hydrate queries cannot be combined.');
|
|
1074
|
+
}
|
|
1067
1075
|
const collected = {
|
|
1068
1076
|
dependencies: new Set(),
|
|
1069
1077
|
missingDependencies: new Set(),
|
|
@@ -1096,7 +1104,7 @@ class OctaneBundlerCompiler {
|
|
|
1096
1104
|
options.universalRuntime ?? this.defaults.universalRuntime,
|
|
1097
1105
|
);
|
|
1098
1106
|
const filename = this._canonicalModuleId(file);
|
|
1099
|
-
const targetRuntimeRequests = (source, kind) => {
|
|
1107
|
+
const targetRuntimeRequests = (source, kind, streamedSignals = false) => {
|
|
1100
1108
|
if (environment !== 'server' || options.explicitRuntimeRequests !== true) return null;
|
|
1101
1109
|
const runtimeResult = rewriteServerRuntimeRequests(source, filename);
|
|
1102
1110
|
if (runtimeResult === null) return null;
|
|
@@ -1104,6 +1112,7 @@ class OctaneBundlerCompiler {
|
|
|
1104
1112
|
code: runtimeResult.code,
|
|
1105
1113
|
map: runtimeResult.map,
|
|
1106
1114
|
kind,
|
|
1115
|
+
...(streamedSignals ? { streamedSignals: true } : null),
|
|
1107
1116
|
...finishMetadata(collected),
|
|
1108
1117
|
};
|
|
1109
1118
|
};
|
|
@@ -1131,6 +1140,9 @@ class OctaneBundlerCompiler {
|
|
|
1131
1140
|
const fullCompile =
|
|
1132
1141
|
this._isFullCompileSource(file, collected) &&
|
|
1133
1142
|
this._passesOwnershipGate(file, filename, pragmaOwned);
|
|
1143
|
+
if (bindingRequest !== null && !fullCompile) {
|
|
1144
|
+
throw new Error('Octane DOM binding queries require a compiler-owned .tsrx/.tsx view.');
|
|
1145
|
+
}
|
|
1134
1146
|
// The narrow-the-rule config error concerns modules Octane owns. Under
|
|
1135
1147
|
// the ownership gate a host-owned project module (unmarked, or in an
|
|
1136
1148
|
// excluded path) may legitimately sit inside a client-only include in a
|
|
@@ -1177,13 +1189,22 @@ class OctaneBundlerCompiler {
|
|
|
1177
1189
|
!hasRendererBoundaries &&
|
|
1178
1190
|
typeof options.resolveCssModuleConstant === 'function';
|
|
1179
1191
|
const compileFilename =
|
|
1180
|
-
|
|
1181
|
-
? filename
|
|
1182
|
-
:
|
|
1192
|
+
bindingRequest !== null
|
|
1193
|
+
? formatDomBindingRequest(filename, bindingRequest)
|
|
1194
|
+
: hydrateBoundaryPath === null
|
|
1195
|
+
? filename
|
|
1196
|
+
: `${filename}?${HYDRATE_QUERY_PARAM}=${encodeURIComponent(hydrateBoundaryPath)}`;
|
|
1183
1197
|
const compileOptions = {
|
|
1184
1198
|
hmr,
|
|
1185
1199
|
mode: environment,
|
|
1186
1200
|
dev,
|
|
1201
|
+
...(renderer.target === 'dom' &&
|
|
1202
|
+
(options.knownAttributeSpreads ?? this.defaults.knownAttributeSpreads) !== undefined
|
|
1203
|
+
? {
|
|
1204
|
+
knownAttributeSpreads:
|
|
1205
|
+
options.knownAttributeSpreads ?? this.defaults.knownAttributeSpreads,
|
|
1206
|
+
}
|
|
1207
|
+
: null),
|
|
1187
1208
|
...(renderer.target === 'dom' && options.textTypeFacts !== undefined
|
|
1188
1209
|
? { textTypeFacts: options.textTypeFacts }
|
|
1189
1210
|
: null),
|
|
@@ -1223,9 +1244,12 @@ class OctaneBundlerCompiler {
|
|
|
1223
1244
|
let out;
|
|
1224
1245
|
let voidComponentAst = null;
|
|
1225
1246
|
let cssModuleConstantImports;
|
|
1226
|
-
|
|
1247
|
+
let independentWidgets;
|
|
1248
|
+
const collectIndependentWidgets = code.includes('Hydrate') && code.includes('independent');
|
|
1249
|
+
if (collectVoidComponentExports || collectCssModuleConstants || collectIndependentWidgets) {
|
|
1227
1250
|
const compilation = compileForBundler(code, compileFilename, compileOptions);
|
|
1228
1251
|
out = compilation.result;
|
|
1252
|
+
if (collectIndependentWidgets) independentWidgets = compilation.independentWidgets;
|
|
1229
1253
|
if (collectVoidComponentExports) voidComponentAst = compilation.hydrateAst;
|
|
1230
1254
|
if (collectCssModuleConstants) {
|
|
1231
1255
|
cssModuleConstantImports = compilation.cssModuleConstantImports;
|
|
@@ -1239,6 +1263,8 @@ class OctaneBundlerCompiler {
|
|
|
1239
1263
|
map: out.map,
|
|
1240
1264
|
diagnostics: out.diagnostics,
|
|
1241
1265
|
kind: 'compile',
|
|
1266
|
+
...(out.streamedSignals === true ? { streamedSignals: true } : null),
|
|
1267
|
+
...(out.bindingConstants === undefined ? null : { bindingConstants: out.bindingConstants }),
|
|
1242
1268
|
renderer,
|
|
1243
1269
|
...(out.universalRuntime === undefined ? null : { universalRuntime: out.universalRuntime }),
|
|
1244
1270
|
...(clientReference === null ? null : { clientReference }),
|
|
@@ -1248,6 +1274,7 @@ class OctaneBundlerCompiler {
|
|
|
1248
1274
|
voidComponentExports: findVoidComponentExports(voidComponentAst, filename),
|
|
1249
1275
|
}),
|
|
1250
1276
|
...(cssModuleConstantImports === undefined ? null : { cssModuleConstantImports }),
|
|
1277
|
+
...(independentWidgets === undefined ? null : { independentWidgets }),
|
|
1251
1278
|
descriptorChildrenExports:
|
|
1252
1279
|
preparedDescriptorChildrenExports === null
|
|
1253
1280
|
? findDescriptorChildrenExports(code, filename)
|
|
@@ -1340,14 +1367,16 @@ class OctaneBundlerCompiler {
|
|
|
1340
1367
|
: {}),
|
|
1341
1368
|
});
|
|
1342
1369
|
if (out === null) return passThrough();
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1370
|
+
// Strong plain modules report nonfatal hints like compiled modules do.
|
|
1371
|
+
this._forwardCompileDiagnostics(out.diagnostics);
|
|
1372
|
+
const slotted = targetRuntimeRequests(out.code, 'slots', out.streamedSignals) ?? {
|
|
1373
|
+
code: out.code,
|
|
1374
|
+
map: out.map,
|
|
1375
|
+
kind: 'slots',
|
|
1376
|
+
...(out.streamedSignals === true ? { streamedSignals: true } : null),
|
|
1377
|
+
...finishMetadata(collected),
|
|
1378
|
+
};
|
|
1379
|
+
return out.diagnostics === undefined ? slotted : { ...slotted, diagnostics: out.diagnostics };
|
|
1351
1380
|
}
|
|
1352
1381
|
|
|
1353
1382
|
return passThrough();
|