octane 0.1.34 → 0.1.36

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.
Files changed (58) hide show
  1. package/README.md +13 -0
  2. package/dist/cjs/component-flags.cjs +2 -1
  3. package/dist/cjs/error-codes.client.generated.cjs +30 -0
  4. package/dist/cjs/error-codes.server.generated.cjs +5 -0
  5. package/dist/cjs/has-own.cjs +28 -0
  6. package/dist/cjs/hydration/event-capture.cjs +27 -2
  7. package/dist/cjs/hydration/interaction-config.cjs +7 -0
  8. package/dist/cjs/index.cjs +24 -0
  9. package/dist/cjs/method-dep.cjs +2 -2
  10. package/dist/cjs/runtime.cjs +979 -249
  11. package/dist/cjs/runtime.server.cjs +397 -157
  12. package/dist/cjs/server/index.cjs +16 -0
  13. package/dist/cjs/shared-value-helpers.cjs +68 -0
  14. package/dist/cjs/version.cjs +1 -1
  15. package/dist/compiler/bundler.js +134 -0
  16. package/dist/compiler/compile-universal.js +229 -6
  17. package/dist/compiler/compile.js +1468 -225
  18. package/dist/compiler/native-change-diagnostics.js +4 -3
  19. package/dist/compiler/renderers.js +22 -1
  20. package/dist/compiler/vite.d.ts +2 -0
  21. package/dist/compiler/vite.js +354 -21
  22. package/dist/component-flags.js +2 -1
  23. package/dist/error-codes.client.generated.d.ts +6 -0
  24. package/dist/error-codes.client.generated.js +30 -0
  25. package/dist/error-codes.server.generated.d.ts +1 -0
  26. package/dist/error-codes.server.generated.js +5 -0
  27. package/dist/has-own.d.ts +1 -0
  28. package/dist/has-own.js +4 -0
  29. package/dist/hydration/event-capture.d.ts +7 -1
  30. package/dist/hydration/event-capture.js +26 -2
  31. package/dist/hydration/interaction-config.d.ts +1 -1
  32. package/dist/hydration/interaction-config.js +7 -0
  33. package/dist/hydration/media.js +13 -3
  34. package/dist/hydration/types.d.ts +1 -1
  35. package/dist/hydration/visible.js +1 -1
  36. package/dist/index.d.ts +1 -1
  37. package/dist/index.js +24 -0
  38. package/dist/internal/client.d.ts +7 -0
  39. package/dist/internal/client.js +5 -0
  40. package/dist/internal/server.d.ts +5 -0
  41. package/dist/internal/server.js +1 -0
  42. package/dist/jsx-runtime.d.ts +59 -4
  43. package/dist/method-dep.js +1 -1
  44. package/dist/react/index.js +2 -1
  45. package/dist/runtime.d.ts +93 -2
  46. package/dist/runtime.js +953 -227
  47. package/dist/runtime.server.d.ts +56 -2
  48. package/dist/runtime.server.js +384 -146
  49. package/dist/server/index.d.ts +1 -1
  50. package/dist/server/index.js +16 -0
  51. package/dist/shared-value-helpers.d.ts +11 -0
  52. package/dist/shared-value-helpers.js +40 -0
  53. package/dist/static/index.d.ts +9 -2
  54. package/dist/static/index.js +6 -2
  55. package/dist/universal-core.d.ts +104 -2
  56. package/dist/universal-core.js +1638 -192
  57. package/dist/version.js +1 -1
  58. package/package.json +11 -1
package/README.md CHANGED
@@ -30,6 +30,19 @@ taking ownership of the existing markup. See the
30
30
  For the full story, see the
31
31
  [main README](https://github.com/octanejs/octane#readme).
32
32
 
33
+ ## Browser compatibility
34
+
35
+ Configure your application's build target for the browser engines you support.
36
+ The Rsbuild integration's `modules` target includes Chromium 87 and Samsung
37
+ Internet 14; Samsung Internet can also be selected directly with targets such as
38
+ `samsung24`. Samsung Internet versions do not match their Chromium engine
39
+ versions, and Android System WebView is updated independently from the browser.
40
+
41
+ Build targets transpile JavaScript syntax; they do not polyfill application Web
42
+ APIs. Features such as native `inert` may require a polyfill on older supported
43
+ browsers. Validate text entry with the keyboards, languages, and browser or
44
+ WebView versions your application supports.
45
+
33
46
  Octane is alpha software. It is ready to try, but not yet ready for production.
34
47
 
35
48
  ## License
@@ -23,6 +23,7 @@ __export(component_flags_exports, {
23
23
  markComponentFlags: () => markComponentFlags
24
24
  });
25
25
  module.exports = __toCommonJS(component_flags_exports);
26
+ var import_has_own = require("./has-own.cjs");
26
27
  const OCTANE_COMPONENT_FLAGS = /* @__PURE__ */ Symbol.for("octane.flags.component");
27
28
  const COMPONENT_FLAG_BOUNDARY = 1 << 0;
28
29
  function markComponentFlags(component, flags, name) {
@@ -31,7 +32,7 @@ function markComponentFlags(component, flags, name) {
31
32
  return component;
32
33
  }
33
34
  function hasComponentFlags(component, flags) {
34
- return typeof component === "function" && Object.hasOwn(component, OCTANE_COMPONENT_FLAGS) && (component[OCTANE_COMPONENT_FLAGS] & flags) === flags;
35
+ return typeof component === "function" && import_has_own.hasOwnProp.call(component, OCTANE_COMPONENT_FLAGS) && (component[OCTANE_COMPONENT_FLAGS] & flags) === flags;
35
36
  }
36
37
  // Annotate the CommonJS export names for ESM import in node:
37
38
  0 && (module.exports = {
@@ -164,6 +164,36 @@ function formatClientError(code, ...args) {
164
164
  );
165
165
  case 50:
166
166
  return (0, import_error_message.formatDevErrorMessage)("Unclosed server-rendered Fragment descriptor.", args);
167
+ case 51:
168
+ return (0, import_error_message.formatDevErrorMessage)(
169
+ "Hydration mismatch: the server-rendered node did not match the client render; the mismatched subtree was rebuilt on the client.",
170
+ args
171
+ );
172
+ case 52:
173
+ return (0, import_error_message.formatDevErrorMessage)(
174
+ "Hydration mismatch: root adoption was abandoned after a server/client shape divergence; the root was rebuilt on the client.",
175
+ args
176
+ );
177
+ case 53:
178
+ return (0, import_error_message.formatDevErrorMessage)(
179
+ "Hydration mismatch: the server rendered more root content than the client; the stale remainder was discarded.",
180
+ args
181
+ );
182
+ case 54:
183
+ return (0, import_error_message.formatDevErrorMessage)(
184
+ "Hydration mismatch: the client rendered text where the server rendered none; the client text was built fresh.",
185
+ args
186
+ );
187
+ case 55:
188
+ return (0, import_error_message.formatDevErrorMessage)(
189
+ "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.",
190
+ args
191
+ );
192
+ case 56:
193
+ return (0, import_error_message.formatDevErrorMessage)(
194
+ "Hydration mismatch: the server rendered more list items than the client; the extra server items were discarded.",
195
+ args
196
+ );
167
197
  default:
168
198
  return (0, import_error_message.formatUnknownDevErrorMessage)(code);
169
199
  }
@@ -135,6 +135,11 @@ function formatServerError(code, ...args) {
135
135
  "octane SSR: %s consecutive streaming passes completed no boundary \u2014 a use(thenable) never resolved. If promises are re-created on every render pass (e.g. created in an ancestor render and passed down through props), create them at their use() site or hoist them out of render.",
136
136
  args
137
137
  );
138
+ case 57:
139
+ return (0, import_error_message.formatDevErrorMessage)(
140
+ "prerenderToNodeStream requires a Node.js runtime with process.getBuiltinModule; use prerender() in non-Node environments.",
141
+ args
142
+ );
138
143
  default:
139
144
  return (0, import_error_message.formatUnknownDevErrorMessage)(code);
140
145
  }
@@ -0,0 +1,28 @@
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 has_own_exports = {};
20
+ __export(has_own_exports, {
21
+ hasOwnProp: () => hasOwnProp
22
+ });
23
+ module.exports = __toCommonJS(has_own_exports);
24
+ const hasOwnProp = Object.prototype.hasOwnProperty;
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ hasOwnProp
28
+ });
@@ -23,6 +23,7 @@ __export(event_capture_exports, {
23
23
  initializeHydrationEventCapture: () => initializeHydrationEventCapture,
24
24
  markDelegatedDynamicHydrationIntent: () => markDelegatedDynamicHydrationIntent,
25
25
  registerHydrationIntentBoundary: () => registerHydrationIntentBoundary,
26
+ shouldPreventHydrationInteractionDefault: () => shouldPreventHydrationInteractionDefault,
26
27
  takeDelegatedDynamicHydrationIntent: () => takeDelegatedDynamicHydrationIntent,
27
28
  takePendingHydrationIntents: () => takePendingHydrationIntents,
28
29
  unregisterHydrationIntentBoundary: () => unregisterHydrationIntentBoundary,
@@ -41,10 +42,15 @@ function isHydrationElement(target) {
41
42
  }
42
43
  const HYDRATE_SUPPORTED_INTERACTION_EVENTS = [
43
44
  "auxclick",
45
+ "beforeinput",
44
46
  "click",
47
+ "compositionend",
48
+ "compositionstart",
49
+ "compositionupdate",
45
50
  "contextmenu",
46
51
  "dblclick",
47
52
  "focusin",
53
+ "input",
48
54
  "keydown",
49
55
  "keyup",
50
56
  "mousedown",
@@ -54,8 +60,26 @@ const HYDRATE_SUPPORTED_INTERACTION_EVENTS = [
54
60
  "pointerdown",
55
61
  "pointerenter",
56
62
  "pointerover",
57
- "pointerup"
63
+ "pointerup",
64
+ "touchend",
65
+ "touchstart"
58
66
  ];
67
+ function shouldPreventHydrationInteractionDefault(event) {
68
+ switch (event.type) {
69
+ case "beforeinput":
70
+ case "compositionend":
71
+ case "compositionstart":
72
+ case "compositionupdate":
73
+ case "input":
74
+ case "mousedown":
75
+ case "pointerdown":
76
+ case "touchend":
77
+ case "touchstart":
78
+ return false;
79
+ default:
80
+ return event.cancelable;
81
+ }
82
+ }
59
83
  const HYDRATE_BOUNDARIES = /* @__PURE__ */ new WeakMap();
60
84
  const HYDRATE_PENDING_INTENTS = /* @__PURE__ */ new WeakMap();
61
85
  const HYDRATE_DELEGATED_DYNAMIC_MARKERS = /* @__PURE__ */ new WeakSet();
@@ -130,7 +154,7 @@ function handleEarlyHydrationIntent(event) {
130
154
  const intent = { event, path };
131
155
  HYDRATE_HANDLED_INTENT_EVENTS.add(event);
132
156
  if (event.bubbles) {
133
- event.preventDefault();
157
+ if (shouldPreventHydrationInteractionDefault(event)) event.preventDefault();
134
158
  event.stopPropagation();
135
159
  event.stopImmediatePropagation();
136
160
  }
@@ -181,6 +205,7 @@ function markDelegatedDynamicHydrationIntent(marker) {
181
205
  initializeHydrationEventCapture,
182
206
  markDelegatedDynamicHydrationIntent,
183
207
  registerHydrationIntentBoundary,
208
+ shouldPreventHydrationInteractionDefault,
184
209
  takeDelegatedDynamicHydrationIntent,
185
210
  takePendingHydrationIntents,
186
211
  unregisterHydrationIntentBoundary,
@@ -27,6 +27,13 @@ const HYDRATE_DEFAULT_INTERACTION_EVENTS = [
27
27
  "pointerenter",
28
28
  "focusin",
29
29
  "pointerdown",
30
+ "touchstart",
31
+ "touchend",
32
+ "beforeinput",
33
+ "input",
34
+ "compositionstart",
35
+ "compositionupdate",
36
+ "compositionend",
30
37
  "click"
31
38
  ];
32
39
  // Annotate the CommonJS export names for ESM import in node:
@@ -70,6 +70,7 @@ __export(index_exports, {
70
70
  cloneElement: () => import_runtime.cloneElement,
71
71
  compilerCacheArray: () => import_runtime.compilerCacheArray,
72
72
  compilerCacheContext: () => import_runtime.compilerCacheContext,
73
+ compilerCacheImmutableArrayFilter: () => import_runtime.compilerCacheImmutableArrayFilter,
73
74
  compilerCacheMappedArray: () => import_runtime.compilerCacheMappedArray,
74
75
  compilerOwnsContextProvider: () => import_runtime.compilerOwnsContextProvider,
75
76
  componentSlot: () => import_runtime.componentSlot,
@@ -84,6 +85,7 @@ __export(index_exports, {
84
85
  createScopedValue: () => import_runtime.createScopedValue,
85
86
  delegateCaptureEvents: () => import_runtime.delegateCaptureEvents,
86
87
  delegateEvents: () => import_runtime.delegateEvents,
88
+ descriptorChildren: () => import_runtime.descriptorChildren,
87
89
  devEventListener: () => import_runtime.devEventListener,
88
90
  drainFrag: () => import_runtime.drainFrag,
89
91
  drainPassiveEffects: () => import_runtime.drainPassiveEffects,
@@ -132,7 +134,9 @@ __export(index_exports, {
132
134
  preconnect: () => import_runtime.preconnect,
133
135
  prefetchDNS: () => import_runtime.prefetchDNS,
134
136
  preinit: () => import_runtime.preinit,
137
+ preinitModule: () => import_runtime.preinitModule,
135
138
  preload: () => import_runtime.preload,
139
+ preloadModule: () => import_runtime.preloadModule,
136
140
  provideContext: () => import_runtime.provideContext,
137
141
  puMiss: () => import_runtime.puMiss,
138
142
  puPub: () => import_runtime.puPub,
@@ -142,10 +146,14 @@ __export(index_exports, {
142
146
  puTake3: () => import_runtime.puTake3,
143
147
  puTake4: () => import_runtime.puTake4,
144
148
  queueNativeChangeDiagnostic: () => import_runtime.queueNativeChangeDiagnostic,
149
+ queueOwnRefDetach: () => import_runtime.queueOwnRefDetach,
145
150
  queueRefAttach: () => import_runtime.queueRefAttach,
146
151
  queueRefDetach: () => import_runtime.queueRefDetach,
147
152
  renderBlock: () => import_runtime.renderBlock,
153
+ replaceRef: () => import_runtime.replaceRef,
148
154
  requestFormReset: () => import_runtime.requestFormReset,
155
+ resetFloatResourceState: () => import_runtime.resetFloatResourceState,
156
+ scriptResource: () => import_runtime.scriptResource,
149
157
  seedOrCreate: () => import_runtime.seedOrCreate,
150
158
  setAriaAttribute: () => import_runtime.setAriaAttribute,
151
159
  setAttribute: () => import_runtime.setAttribute,
@@ -170,17 +178,21 @@ __export(index_exports, {
170
178
  setSpread: () => import_runtime.setSpread,
171
179
  setStringData: () => import_runtime.setStringData,
172
180
  setStyle: () => import_runtime.setStyle,
181
+ setStyleProperty: () => import_runtime.setStyleProperty,
173
182
  setText: () => import_runtime.setText,
174
183
  setTransitionFallbackTimeout: () => import_runtime.setTransitionFallbackTimeout,
175
184
  setValue: () => import_runtime.setValue,
176
185
  sibling: () => import_runtime.sibling,
177
186
  snapshotSpread: () => import_runtime.snapshotSpread,
178
187
  startTransition: () => import_runtime.startTransition,
188
+ styleResource: () => import_runtime.styleResource,
189
+ stylesheetResource: () => import_runtime.stylesheetResource,
179
190
  switchBlock: () => import_runtime.switchBlock,
180
191
  template: () => import_runtime.template,
181
192
  textHole: () => import_runtime.textHole,
182
193
  textSlot: () => import_runtime.textSlot,
183
194
  tryBlock: () => import_runtime.tryBlock,
195
+ unstable_Activity: () => import_runtime.Activity,
184
196
  unstable_ViewTransition: () => import_runtime.ViewTransition,
185
197
  unstable_addTransitionType: () => import_runtime.addTransitionType,
186
198
  use: () => import_runtime.use,
@@ -271,6 +283,7 @@ var import_method_dep = require("./method-dep.cjs");
271
283
  cloneElement,
272
284
  compilerCacheArray,
273
285
  compilerCacheContext,
286
+ compilerCacheImmutableArrayFilter,
274
287
  compilerCacheMappedArray,
275
288
  compilerOwnsContextProvider,
276
289
  componentSlot,
@@ -285,6 +298,7 @@ var import_method_dep = require("./method-dep.cjs");
285
298
  createScopedValue,
286
299
  delegateCaptureEvents,
287
300
  delegateEvents,
301
+ descriptorChildren,
288
302
  devEventListener,
289
303
  drainFrag,
290
304
  drainPassiveEffects,
@@ -333,7 +347,9 @@ var import_method_dep = require("./method-dep.cjs");
333
347
  preconnect,
334
348
  prefetchDNS,
335
349
  preinit,
350
+ preinitModule,
336
351
  preload,
352
+ preloadModule,
337
353
  provideContext,
338
354
  puMiss,
339
355
  puPub,
@@ -343,10 +359,14 @@ var import_method_dep = require("./method-dep.cjs");
343
359
  puTake3,
344
360
  puTake4,
345
361
  queueNativeChangeDiagnostic,
362
+ queueOwnRefDetach,
346
363
  queueRefAttach,
347
364
  queueRefDetach,
348
365
  renderBlock,
366
+ replaceRef,
349
367
  requestFormReset,
368
+ resetFloatResourceState,
369
+ scriptResource,
350
370
  seedOrCreate,
351
371
  setAriaAttribute,
352
372
  setAttribute,
@@ -371,17 +391,21 @@ var import_method_dep = require("./method-dep.cjs");
371
391
  setSpread,
372
392
  setStringData,
373
393
  setStyle,
394
+ setStyleProperty,
374
395
  setText,
375
396
  setTransitionFallbackTimeout,
376
397
  setValue,
377
398
  sibling,
378
399
  snapshotSpread,
379
400
  startTransition,
401
+ styleResource,
402
+ stylesheetResource,
380
403
  switchBlock,
381
404
  template,
382
405
  textHole,
383
406
  textSlot,
384
407
  tryBlock,
408
+ unstable_Activity,
385
409
  unstable_ViewTransition,
386
410
  unstable_addTransitionType,
387
411
  use,
@@ -21,12 +21,12 @@ __export(method_dep_exports, {
21
21
  __methodDep: () => __methodDep
22
22
  });
23
23
  module.exports = __toCommonJS(method_dep_exports);
24
- const hasOwnProp = Object.prototype.hasOwnProperty;
24
+ var import_has_own = require("./has-own.cjs");
25
25
  function __methodDep(receiver, name) {
26
26
  if ((typeof receiver !== "object" || receiver === null) && typeof receiver !== "function") {
27
27
  return receiver;
28
28
  }
29
- if (hasOwnProp.call(receiver, name)) return receiver[name];
29
+ if (import_has_own.hasOwnProp.call(receiver, name)) return receiver[name];
30
30
  return name in receiver ? receiver : void 0;
31
31
  }
32
32
  // Annotate the CommonJS export names for ESM import in node: