octane 0.9.1 → 0.10.2
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 +9 -0
- package/dist/cjs/component-flags.cjs +6 -0
- package/dist/cjs/dom-bindings.cjs +8 -3
- package/dist/cjs/error-codes.client.generated.cjs +30 -40
- package/dist/cjs/hydration-flag.cjs +42 -0
- package/dist/cjs/hydration-markers.cjs +3 -0
- package/dist/cjs/method-dep.cjs +18 -3
- package/dist/cjs/runtime.cjs +2389 -2023
- package/dist/cjs/runtime.server.cjs +56 -32
- package/dist/cjs/server/early-signals.cjs +1 -1
- package/dist/cjs/signals/document-owner.cjs +1 -1
- package/dist/cjs/signals/early-values.cjs +13 -2
- package/dist/cjs/signals/engine.cjs +3 -3
- package/dist/cjs/signals/facade.cjs +30 -4
- package/dist/cjs/signals/graph.cjs +92 -14
- package/dist/cjs/signals/native-read-events.cjs +1 -3
- package/dist/cjs/signals/query-attempt-observer.cjs +6 -0
- package/dist/cjs/signals/read-protocol.cjs +26 -2
- package/dist/cjs/signals/redeclaration.cjs +7 -4
- package/dist/cjs/signals/transition-action.cjs +3 -1
- package/dist/cjs/version.cjs +1 -1
- package/dist/compiler/bundler.js +230 -5
- package/dist/compiler/compile-universal.js +47 -4
- package/dist/compiler/compile.js +450 -89
- package/dist/compiler/dom-binding-program.js +7 -1
- package/dist/compiler/hook-deps.js +45 -10
- package/dist/compiler/index.d.ts +10 -0
- package/dist/compiler/native-read-diagnostics.js +14 -1
- package/dist/compiler/plain-hook-memo.js +2 -2
- package/dist/compiler/signal-declarations.js +277 -48
- package/dist/compiler/slot-hooks.js +123 -289
- package/dist/compiler/strong-diagnostics.js +2 -2
- package/dist/compiler/strong-effects.js +13 -90
- package/dist/compiler/strong-mode.js +15 -46
- package/dist/compiler/vite.d.ts +9 -0
- package/dist/compiler/vite.js +136 -9
- package/dist/compiler/void-roots.js +12 -5
- package/dist/compiler/volar.js +25 -0
- package/dist/component-flags.d.ts +10 -0
- package/dist/component-flags.js +4 -0
- package/dist/dom-binding-handoff.d.ts +2 -0
- package/dist/dom-bindings.js +8 -3
- package/dist/error-codes.client.generated.d.ts +6 -8
- package/dist/error-codes.client.generated.js +30 -40
- package/dist/hydration/independent-island.js +9 -8
- package/dist/hydration-flag.d.ts +18 -0
- package/dist/hydration-flag.js +15 -0
- package/dist/hydration-markers.d.ts +9 -0
- package/dist/hydration-markers.js +2 -0
- package/dist/method-dep.d.ts +1 -1
- package/dist/method-dep.js +18 -3
- package/dist/node/component-flags.js +4 -0
- package/dist/node/dom-bindings.js +8 -3
- package/dist/node/error-codes.client.generated.js +30 -40
- package/dist/node/hydration/independent-island.js +9 -8
- package/dist/node/hydration-flag.js +15 -0
- package/dist/node/hydration-markers.js +2 -0
- package/dist/node/method-dep.js +18 -3
- package/dist/node/runtime.js +2393 -2026
- package/dist/node/runtime.server.js +59 -32
- package/dist/node/server/early-signals.js +1 -1
- package/dist/node/signals/document-owner.js +2 -2
- package/dist/node/signals/early-values.js +11 -2
- package/dist/node/signals/engine.js +5 -4
- package/dist/node/signals/facade.js +31 -5
- package/dist/node/signals/graph.js +93 -15
- package/dist/node/signals/native-read-events.js +1 -3
- package/dist/node/signals/query-attempt-observer.js +5 -0
- package/dist/node/signals/read-protocol.js +20 -1
- package/dist/node/signals/redeclaration.js +8 -4
- package/dist/node/signals/transition-action.js +4 -2
- package/dist/node/universal-core.js +2 -2
- package/dist/node/version.js +1 -1
- package/dist/runtime.d.ts +642 -582
- package/dist/runtime.js +2393 -2026
- package/dist/runtime.server.d.ts +13 -2
- package/dist/runtime.server.js +59 -32
- package/dist/server/early-signals.js +1 -1
- package/dist/signals/document-owner.js +2 -2
- package/dist/signals/early-values.d.ts +23 -1
- package/dist/signals/early-values.js +11 -2
- package/dist/signals/engine.js +5 -4
- package/dist/signals/facade.d.ts +11 -1
- package/dist/signals/facade.js +31 -5
- package/dist/signals/graph.d.ts +5 -0
- package/dist/signals/graph.js +93 -15
- package/dist/signals/native-read-events.js +1 -3
- package/dist/signals/query-attempt-observer.d.ts +9 -0
- package/dist/signals/query-attempt-observer.js +5 -0
- package/dist/signals/read-protocol.d.ts +34 -0
- package/dist/signals/read-protocol.js +20 -1
- package/dist/signals/redeclaration.js +8 -4
- package/dist/signals/transition-action.js +4 -2
- package/dist/universal-core.d.ts +8 -2
- package/dist/universal-core.js +2 -2
- package/dist/version.js +1 -1
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -17,6 +17,15 @@ wrapper is narrower: the wrapper must be locally declared in a fully compiled
|
|
|
17
17
|
parameter to a supported hook. This package ships both the runtime and compiler,
|
|
18
18
|
with the compiler exposed at `octane/compiler`.
|
|
19
19
|
|
|
20
|
+
To use the compiler in Node, including through the Vite, Rspack, or Rsbuild
|
|
21
|
+
integrations, install its optional parser peer in your project:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add @tsrx/oxc@0.16.0
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Applications that use only the Octane runtime do not need this peer.
|
|
28
|
+
|
|
20
29
|
[Signals](https://octanejs.dev/docs/signals) are stable. Import `createScope` and
|
|
21
30
|
`query` from `octane/signals`, or `useSignal$` from `octane/signals/client`, for
|
|
22
31
|
scoped state, derived values, async resources, and native component reads.
|
|
@@ -18,6 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var component_flags_exports = {};
|
|
20
20
|
__export(component_flags_exports, {
|
|
21
|
+
COMPONENT_FLAGS_AUTHOR_BOUNDARY: () => COMPONENT_FLAGS_AUTHOR_BOUNDARY,
|
|
22
|
+
COMPONENT_FLAG_AUTHOR_CHILDREN: () => COMPONENT_FLAG_AUTHOR_CHILDREN,
|
|
21
23
|
COMPONENT_FLAG_BOUNDARY: () => COMPONENT_FLAG_BOUNDARY,
|
|
22
24
|
hasComponentFlags: () => hasComponentFlags,
|
|
23
25
|
markComponentFlags: () => markComponentFlags
|
|
@@ -26,6 +28,8 @@ module.exports = __toCommonJS(component_flags_exports);
|
|
|
26
28
|
var import_has_own = require("./has-own.cjs");
|
|
27
29
|
const OCTANE_COMPONENT_FLAGS = /* @__PURE__ */ Symbol.for("octane.flags.component");
|
|
28
30
|
const COMPONENT_FLAG_BOUNDARY = 1 << 0;
|
|
31
|
+
const COMPONENT_FLAG_AUTHOR_CHILDREN = 1 << 1;
|
|
32
|
+
const COMPONENT_FLAGS_AUTHOR_BOUNDARY = 1 << 0 | 1 << 1;
|
|
29
33
|
function markComponentFlags(component, flags, name, kind) {
|
|
30
34
|
Object.defineProperty(component, OCTANE_COMPONENT_FLAGS, { value: flags });
|
|
31
35
|
Object.defineProperty(component, "name", { value: name, configurable: true });
|
|
@@ -43,6 +47,8 @@ function hasComponentFlags(component, flags) {
|
|
|
43
47
|
}
|
|
44
48
|
// Annotate the CommonJS export names for ESM import in node:
|
|
45
49
|
0 && (module.exports = {
|
|
50
|
+
COMPONENT_FLAGS_AUTHOR_BOUNDARY,
|
|
51
|
+
COMPONENT_FLAG_AUTHOR_CHILDREN,
|
|
46
52
|
COMPONENT_FLAG_BOUNDARY,
|
|
47
53
|
hasComponentFlags,
|
|
48
54
|
markComponentFlags
|
|
@@ -798,18 +798,20 @@ function __adoptBindings(root, descriptor, source, options) {
|
|
|
798
798
|
const ancestry = [];
|
|
799
799
|
for (let node = host; node !== null; node = node.parentNode)
|
|
800
800
|
ancestry.push([node, node.parentNode]);
|
|
801
|
-
const
|
|
802
|
-
let next = previous2 ? node.previousSibling : node.nextSibling;
|
|
801
|
+
const skip = (next, previous2) => {
|
|
803
802
|
while (next?.nodeType === 1 && next.localName === "script" && (next.hasAttribute(import_native_read_seeds.NATIVE_SIGNAL_SEED_ATTR) || next.hasAttribute(import_stream_protocol.SUSPENSE_SCRIPT_ATTR) || next.hasAttribute(import_stream_protocol.STREAM_SCRIPT_ATTR)))
|
|
804
803
|
next = previous2 ? next.previousSibling : next.nextSibling;
|
|
805
804
|
return next;
|
|
806
805
|
};
|
|
806
|
+
const sibling = (node, previous2) => skip(previous2 ? node.previousSibling : node.nextSibling, previous2);
|
|
807
|
+
const site = host.parentNode;
|
|
807
808
|
const previousSibling = sibling(host, true);
|
|
808
809
|
const nextSibling = sibling(host, false);
|
|
809
810
|
let handoff;
|
|
810
811
|
handle[import_control_handoff.BINDING_HANDOFF] = () => {
|
|
811
812
|
if (handoff !== void 0)
|
|
812
813
|
return handoff;
|
|
814
|
+
const adjacent = (recorded, previous2) => sibling(host, previous2) === recorded;
|
|
813
815
|
return handoff = {
|
|
814
816
|
id: descriptor.id,
|
|
815
817
|
root: host,
|
|
@@ -820,7 +822,10 @@ function __adoptBindings(root, descriptor, source, options) {
|
|
|
820
822
|
(publicationRetries ??= /* @__PURE__ */ new Set()).add(callback);
|
|
821
823
|
return () => publicationRetries.delete(callback);
|
|
822
824
|
},
|
|
823
|
-
valid: () => host.parentNode !== null && host.ownerDocument === document && ancestry.every(([node, parent]) => node.parentNode === parent) &&
|
|
825
|
+
valid: () => host.parentNode !== null && host.ownerDocument === document && ancestry.every(([node, parent]) => node.parentNode === parent) && adjacent(previousSibling, true) && adjacent(nextSibling, false) && host.getAttribute("data-octane-bindings") === descriptor.id,
|
|
826
|
+
// The authored node before the host still marks its site after the
|
|
827
|
+
// host leaves, including when an external clone now stands there.
|
|
828
|
+
displaced: (parent, node) => parent === site && node !== host && (node === null || node.parentNode === parent) && (node === null ? skip(parent.lastChild, true) : sibling(node, true)) === previousSibling,
|
|
824
829
|
active: () => !disposed,
|
|
825
830
|
retire: (publish) => dispose(void 0, publish, true)
|
|
826
831
|
};
|
|
@@ -163,48 +163,8 @@ function formatClientError(code, ...args) {
|
|
|
163
163
|
);
|
|
164
164
|
case 50:
|
|
165
165
|
return (0, import_error_message.formatDevErrorMessage)("Unclosed server-rendered Fragment descriptor.", args);
|
|
166
|
-
case 51:
|
|
167
|
-
return (0, import_error_message.formatDevErrorMessage)(
|
|
168
|
-
"Hydration mismatch: the server-rendered node did not match the client render; the mismatched subtree was rebuilt on the client.",
|
|
169
|
-
args
|
|
170
|
-
);
|
|
171
|
-
case 52:
|
|
172
|
-
return (0, import_error_message.formatDevErrorMessage)(
|
|
173
|
-
"Hydration mismatch: root adoption was abandoned after a server/client shape divergence; the root was rebuilt on the client.",
|
|
174
|
-
args
|
|
175
|
-
);
|
|
176
|
-
case 53:
|
|
177
|
-
return (0, import_error_message.formatDevErrorMessage)(
|
|
178
|
-
"Hydration mismatch: the server rendered more root content than the client; the stale remainder was discarded.",
|
|
179
|
-
args
|
|
180
|
-
);
|
|
181
|
-
case 54:
|
|
182
|
-
return (0, import_error_message.formatDevErrorMessage)(
|
|
183
|
-
"Hydration mismatch: the client rendered text where the server rendered none; the client text was built fresh.",
|
|
184
|
-
args
|
|
185
|
-
);
|
|
186
|
-
case 55:
|
|
187
|
-
return (0, import_error_message.formatDevErrorMessage)(
|
|
188
|
-
"Hydration mismatch: the server rendered a different child shape where the client renders a component; the stale range was discarded and the component was built on the client.",
|
|
189
|
-
args
|
|
190
|
-
);
|
|
191
|
-
case 56:
|
|
192
|
-
return (0, import_error_message.formatDevErrorMessage)(
|
|
193
|
-
"Hydration mismatch: the server rendered more list items than the client; the extra server items were discarded.",
|
|
194
|
-
args
|
|
195
|
-
);
|
|
196
166
|
case 58:
|
|
197
167
|
return (0, import_error_message.formatDevErrorMessage)("Unsupported native-read compiler/runtime version.", args);
|
|
198
|
-
case 61:
|
|
199
|
-
return (0, import_error_message.formatDevErrorMessage)(
|
|
200
|
-
"Hydration mismatch: the server-rendered text differed from the client; the text was updated to the client value.",
|
|
201
|
-
args
|
|
202
|
-
);
|
|
203
|
-
case 62:
|
|
204
|
-
return (0, import_error_message.formatDevErrorMessage)(
|
|
205
|
-
"Hydration mismatch: the server rendered extra children in a text element; the stale children were discarded.",
|
|
206
|
-
args
|
|
207
|
-
);
|
|
208
168
|
case 63:
|
|
209
169
|
return (0, import_error_message.formatDevErrorMessage)(
|
|
210
170
|
"Target container is not a DOM element. Pass an Element, Document, or DocumentFragment. If document.body is null after document hydration, update the existing document root or render a document shell containing <body>.",
|
|
@@ -1084,6 +1044,36 @@ function formatClientError(code, ...args) {
|
|
|
1084
1044
|
"Structural hydration leases do not support @try regions.",
|
|
1085
1045
|
args
|
|
1086
1046
|
);
|
|
1047
|
+
case 338:
|
|
1048
|
+
return (0, import_error_message.formatDevErrorMessage)(
|
|
1049
|
+
"Hydration mismatch: a server-rendered range had no closing marker, so the client rendered the boundary or root that contains it instead. Something changed the server HTML after rendering, for example an HTML minifier or proxy that strips comments.",
|
|
1050
|
+
args
|
|
1051
|
+
);
|
|
1052
|
+
case 339:
|
|
1053
|
+
return (0, import_error_message.formatDevErrorMessage)(
|
|
1054
|
+
"Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client.",
|
|
1055
|
+
args
|
|
1056
|
+
);
|
|
1057
|
+
case 340:
|
|
1058
|
+
return (0, import_error_message.formatDevErrorMessage)(
|
|
1059
|
+
"There was an error while hydrating, so the nearest Suspense boundary, Hydrate island, or the root rendered on the client instead.",
|
|
1060
|
+
args
|
|
1061
|
+
);
|
|
1062
|
+
case 341:
|
|
1063
|
+
return (0, import_error_message.formatDevErrorMessage)(
|
|
1064
|
+
"The server could not finish this Suspense boundary, because it suspended during a synchronous render such as renderToString, which cannot wait for data. Switched to client rendering.",
|
|
1065
|
+
args
|
|
1066
|
+
);
|
|
1067
|
+
case 342:
|
|
1068
|
+
return (0, import_error_message.formatDevErrorMessage)(
|
|
1069
|
+
"A descriptor carried a function form action, but no element factory installed form actions. This is a bug in the Octane compiler.",
|
|
1070
|
+
args
|
|
1071
|
+
);
|
|
1072
|
+
case 343:
|
|
1073
|
+
return (0, import_error_message.formatDevErrorMessage)(
|
|
1074
|
+
"A keyed list rollback record restored a different shape than it recorded. This is a bug in Octane.",
|
|
1075
|
+
args
|
|
1076
|
+
);
|
|
1087
1077
|
default:
|
|
1088
1078
|
return (0, import_error_message.formatUnknownDevErrorMessage)(code);
|
|
1089
1079
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 hydration_flag_exports = {};
|
|
20
|
+
__export(hydration_flag_exports, {
|
|
21
|
+
hydrating: () => hydrating,
|
|
22
|
+
hydrationStarted: () => hydrationStarted,
|
|
23
|
+
setHydrating: () => setHydrating,
|
|
24
|
+
startHydration: () => startHydration
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(hydration_flag_exports);
|
|
27
|
+
let hydrating = false;
|
|
28
|
+
let hydrationStarted = false;
|
|
29
|
+
function setHydrating(value) {
|
|
30
|
+
hydrating = value;
|
|
31
|
+
if (value) hydrationStarted = true;
|
|
32
|
+
}
|
|
33
|
+
function startHydration() {
|
|
34
|
+
hydrationStarted = true;
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
hydrating,
|
|
39
|
+
hydrationStarted,
|
|
40
|
+
setHydrating,
|
|
41
|
+
startHydration
|
|
42
|
+
});
|
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var hydration_markers_exports = {};
|
|
20
20
|
__export(hydration_markers_exports, {
|
|
21
|
+
CLIENT_RENDER_ARM_COMMENT: () => CLIENT_RENDER_ARM_COMMENT,
|
|
21
22
|
HYDRATE_ID_ATTR: () => HYDRATE_ID_ATTR,
|
|
22
23
|
HYDRATE_ID_COUNT_ATTR: () => HYDRATE_ID_COUNT_ATTR,
|
|
23
24
|
HYDRATE_INDEPENDENT_ATTR: () => HYDRATE_INDEPENDENT_ATTR,
|
|
@@ -59,11 +60,13 @@ const TRY_CATCH_COMMENT = "oct-catch:";
|
|
|
59
60
|
const SUSPENSE_RESOLVED_COMMENT = "oct-suspense:";
|
|
60
61
|
const STREAM_SEED_COMMENT = "oct-seed:";
|
|
61
62
|
const NATIVE_SIGNAL_FRESH_COMMENT = "oct-native-fresh:";
|
|
63
|
+
const CLIENT_RENDER_ARM_COMMENT = "oct-client:";
|
|
62
64
|
function formatUseId(prefix, ordinal) {
|
|
63
65
|
return ":" + prefix + "in-" + ordinal.toString(36) + ":";
|
|
64
66
|
}
|
|
65
67
|
// Annotate the CommonJS export names for ESM import in node:
|
|
66
68
|
0 && (module.exports = {
|
|
69
|
+
CLIENT_RENDER_ARM_COMMENT,
|
|
67
70
|
HYDRATE_ID_ATTR,
|
|
68
71
|
HYDRATE_ID_COUNT_ATTR,
|
|
69
72
|
HYDRATE_INDEPENDENT_ATTR,
|
package/dist/cjs/method-dep.cjs
CHANGED
|
@@ -24,7 +24,7 @@ module.exports = __toCommonJS(method_dep_exports);
|
|
|
24
24
|
var import_has_own = require("./has-own.cjs");
|
|
25
25
|
const guardedNullReceiver = /* @__PURE__ */ Symbol();
|
|
26
26
|
const guardedUndefinedReceiver = /* @__PURE__ */ Symbol();
|
|
27
|
-
function __methodDep(receiver, name, guarded = false) {
|
|
27
|
+
function __methodDep(receiver, name, guarded = false, read = false) {
|
|
28
28
|
if (guarded && receiver == null) {
|
|
29
29
|
return receiver === null ? guardedNullReceiver : guardedUndefinedReceiver;
|
|
30
30
|
}
|
|
@@ -34,15 +34,30 @@ function __methodDep(receiver, name, guarded = false) {
|
|
|
34
34
|
if (guarded) {
|
|
35
35
|
try {
|
|
36
36
|
const descriptor = Object.getOwnPropertyDescriptor(receiver, name);
|
|
37
|
-
if (descriptor)
|
|
37
|
+
if (descriptor) {
|
|
38
|
+
if (!("value" in descriptor)) return receiver;
|
|
39
|
+
return read ? descriptor.value : ownMethodDep(receiver, descriptor.value);
|
|
40
|
+
}
|
|
38
41
|
return name in receiver ? receiver : void 0;
|
|
39
42
|
} catch {
|
|
40
43
|
return receiver;
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
|
-
if (import_has_own.hasOwnProp.call(receiver, name))
|
|
46
|
+
if (import_has_own.hasOwnProp.call(receiver, name)) {
|
|
47
|
+
return ownMethodDep(receiver, receiver[name]);
|
|
48
|
+
}
|
|
44
49
|
return name in receiver ? receiver : void 0;
|
|
45
50
|
}
|
|
51
|
+
const ARROW_HEAD = /^(?:async\s*)?(?:\(|[\w$]+\s*=>)/;
|
|
52
|
+
function ownMethodDep(receiver, method) {
|
|
53
|
+
if (typeof method !== "function") return method;
|
|
54
|
+
try {
|
|
55
|
+
const source = Function.prototype.toString.call(method);
|
|
56
|
+
return ARROW_HEAD.test(source) && (source[0] === "(" || method.name !== "async") ? method : receiver;
|
|
57
|
+
} catch {
|
|
58
|
+
return receiver;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
46
61
|
// Annotate the CommonJS export names for ESM import in node:
|
|
47
62
|
0 && (module.exports = {
|
|
48
63
|
__methodDep
|