octane 0.2.2 → 0.2.3

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 (50) hide show
  1. package/dist/cjs/compatibility.cjs +35 -0
  2. package/dist/cjs/component-flags.cjs +8 -1
  3. package/dist/cjs/dom-tables.cjs +2 -0
  4. package/dist/cjs/error-codes.client.generated.cjs +15 -2
  5. package/dist/cjs/error-codes.server.generated.cjs +5 -0
  6. package/dist/cjs/event-names.cjs +39 -0
  7. package/dist/cjs/index.cjs +13 -0
  8. package/dist/cjs/runtime.cjs +1223 -332
  9. package/dist/cjs/runtime.server.cjs +362 -120
  10. package/dist/cjs/server/index.cjs +22 -0
  11. package/dist/cjs/version.cjs +1 -1
  12. package/dist/compatibility.d.ts +7 -0
  13. package/dist/compatibility.js +10 -0
  14. package/dist/compiler/bundler.js +13 -30
  15. package/dist/compiler/compile-renderer-boundaries.js +1 -0
  16. package/dist/compiler/compile-universal.js +3 -0
  17. package/dist/compiler/compile.js +619 -99
  18. package/dist/compiler/hook-deps.js +100 -3
  19. package/dist/compiler/hook-names.js +1 -0
  20. package/dist/compiler/manual-hooks.js +171 -0
  21. package/dist/compiler/plain-hook-memo.js +54 -5
  22. package/dist/compiler/slot-hooks.d.ts +43 -0
  23. package/dist/compiler/slot-hooks.js +154 -35
  24. package/dist/component-flags.d.ts +1 -1
  25. package/dist/component-flags.js +8 -1
  26. package/dist/dom-tables.js +2 -0
  27. package/dist/error-codes.client.generated.d.ts +3 -1
  28. package/dist/error-codes.client.generated.js +15 -2
  29. package/dist/error-codes.server.generated.d.ts +1 -0
  30. package/dist/error-codes.server.generated.js +5 -0
  31. package/dist/event-names.d.ts +1 -0
  32. package/dist/event-names.js +15 -0
  33. package/dist/html-tree-validation.d.ts +17 -34
  34. package/dist/index.d.ts +3 -1
  35. package/dist/index.js +12 -1
  36. package/dist/jsx-runtime.d.ts +6 -1
  37. package/dist/public-types.d.ts +188 -0
  38. package/dist/public-types.js +0 -0
  39. package/dist/runtime.d.ts +109 -66
  40. package/dist/runtime.js +1220 -332
  41. package/dist/runtime.server.d.ts +39 -14
  42. package/dist/runtime.server.js +356 -120
  43. package/dist/server/index.d.ts +4 -2
  44. package/dist/server/index.js +19 -0
  45. package/dist/static/index.d.ts +2 -1
  46. package/dist/static/index.js +3 -1
  47. package/dist/universal-core.d.ts +8 -1
  48. package/dist/universal-core.js +95 -9
  49. package/dist/version.js +1 -1
  50. package/package.json +2 -1
@@ -25,6 +25,7 @@ __export(server_exports, {
25
25
  Fragment: () => import_runtime_server.Fragment,
26
26
  HYDRATION_RANGE_BOUNDARY: () => import_runtime_server.HYDRATION_RANGE_BOUNDARY,
27
27
  Hydrate: () => import_runtime_server.Hydrate,
28
+ StrictMode: () => import_compatibility.StrictMode,
28
29
  Suspense: () => import_runtime_server.Suspense,
29
30
  ViewTransition: () => import_runtime_server.ViewTransition,
30
31
  __methodDep: () => import_method_dep.__methodDep,
@@ -47,11 +48,14 @@ __export(server_exports, {
47
48
  getSsrSuspenseTimeout: () => import_runtime_server.getSsrSuspenseTimeout,
48
49
  hookSlots: () => import_runtime_server.hookSlots,
49
50
  injectStyle: () => import_runtime_server.injectStyle,
51
+ invokeManualHook: () => import_runtime_server.invokeManualHook,
50
52
  isChildrenBlock: () => import_runtime_server.isChildrenBlock,
51
53
  isValidElement: () => import_runtime_server.isValidElement,
52
54
  lazy: () => import_runtime_server.lazy,
55
+ manualHook: () => import_runtime_server.manualHook,
53
56
  mapSlot: () => import_runtime_server.mapSlot,
54
57
  markChildrenBlock: () => import_runtime_server.markChildrenBlock,
58
+ markWarm: () => import_runtime_server.markWarm,
55
59
  memo: () => import_runtime_server.memo,
56
60
  namespaceHead: () => import_runtime_server.namespaceHead,
57
61
  namespaceHeadElement: () => import_runtime_server.namespaceHeadElement,
@@ -78,7 +82,9 @@ __export(server_exports, {
78
82
  ssrBlock: () => import_runtime_server.ssrBlock,
79
83
  ssrCheckedAttr: () => import_runtime_server.ssrCheckedAttr,
80
84
  ssrChild: () => import_runtime_server.ssrChild,
85
+ ssrChildPre: () => import_runtime_server.ssrChildPre,
81
86
  ssrChildText: () => import_runtime_server.ssrChildText,
87
+ ssrChildTextPre: () => import_runtime_server.ssrChildTextPre,
82
88
  ssrChildrenSources: () => import_runtime_server.ssrChildrenSources,
83
89
  ssrClass: () => import_runtime_server.ssrClass,
84
90
  ssrComponent: () => import_runtime_server.ssrComponent,
@@ -89,6 +95,7 @@ __export(server_exports, {
89
95
  ssrFormAuthoringDiagnostics: () => import_runtime_server.ssrFormAuthoringDiagnostics,
90
96
  ssrFragmentMarker: () => import_runtime_server.ssrFragmentMarker,
91
97
  ssrHeadEl: () => import_runtime_server.ssrHeadEl,
98
+ ssrHtml: () => import_runtime_server.ssrHtml,
92
99
  ssrInNamespace: () => import_runtime_server.ssrInNamespace,
93
100
  ssrInnerHtml: () => import_runtime_server.ssrInnerHtml,
94
101
  ssrInputAttrs: () => import_runtime_server.ssrInputAttrs,
@@ -120,6 +127,7 @@ __export(server_exports, {
120
127
  unstable_Activity: () => import_runtime_server.Activity,
121
128
  unstable_ViewTransition: () => import_runtime_server.ViewTransition,
122
129
  unstable_addTransitionType: () => import_runtime_server.addTransitionType,
130
+ unstable_batchedUpdates: () => import_compatibility.unstable_batchedUpdates,
123
131
  use: () => import_runtime_server.use,
124
132
  useActionState: () => import_runtime_server.useActionState,
125
133
  useCallback: () => import_runtime_server.useCallback,
@@ -128,6 +136,7 @@ __export(server_exports, {
128
136
  useDeferredValue: () => import_runtime_server.useDeferredValue,
129
137
  useEffect: () => import_runtime_server.useEffect,
130
138
  useEffectEvent: () => import_runtime_server.useEffectEvent,
139
+ useFormState: () => import_runtime_server.useActionState,
131
140
  useFormStatus: () => import_runtime_server.useFormStatus,
132
141
  useId: () => import_runtime_server.useId,
133
142
  useImperativeHandle: () => import_runtime_server.useImperativeHandle,
@@ -141,12 +150,15 @@ __export(server_exports, {
141
150
  useState: () => import_runtime_server.useState,
142
151
  useSyncExternalStore: () => import_runtime_server.useSyncExternalStore,
143
152
  useTransition: () => import_runtime_server.useTransition,
153
+ version: () => import_version.version,
144
154
  warmChild: () => import_runtime_server.warmChild,
145
155
  warmMemo: () => import_runtime_server.warmMemo,
146
156
  withSlot: () => import_runtime_server.withSlot
147
157
  });
148
158
  module.exports = __toCommonJS(server_exports);
149
159
  var import_rpc = require("./rpc.cjs");
160
+ var import_version = require("../version.cjs");
161
+ var import_compatibility = require("../compatibility.cjs");
150
162
  var import_sub_slot = require("../sub-slot.cjs");
151
163
  var import_method_dep = require("../method-dep.cjs");
152
164
  var import_runtime_server = require("../runtime.server.cjs");
@@ -159,6 +171,7 @@ var import_runtime_server = require("../runtime.server.cjs");
159
171
  Fragment,
160
172
  HYDRATION_RANGE_BOUNDARY,
161
173
  Hydrate,
174
+ StrictMode,
162
175
  Suspense,
163
176
  ViewTransition,
164
177
  __methodDep,
@@ -181,11 +194,14 @@ var import_runtime_server = require("../runtime.server.cjs");
181
194
  getSsrSuspenseTimeout,
182
195
  hookSlots,
183
196
  injectStyle,
197
+ invokeManualHook,
184
198
  isChildrenBlock,
185
199
  isValidElement,
186
200
  lazy,
201
+ manualHook,
187
202
  mapSlot,
188
203
  markChildrenBlock,
204
+ markWarm,
189
205
  memo,
190
206
  namespaceHead,
191
207
  namespaceHeadElement,
@@ -212,7 +228,9 @@ var import_runtime_server = require("../runtime.server.cjs");
212
228
  ssrBlock,
213
229
  ssrCheckedAttr,
214
230
  ssrChild,
231
+ ssrChildPre,
215
232
  ssrChildText,
233
+ ssrChildTextPre,
216
234
  ssrChildrenSources,
217
235
  ssrClass,
218
236
  ssrComponent,
@@ -223,6 +241,7 @@ var import_runtime_server = require("../runtime.server.cjs");
223
241
  ssrFormAuthoringDiagnostics,
224
242
  ssrFragmentMarker,
225
243
  ssrHeadEl,
244
+ ssrHtml,
226
245
  ssrInNamespace,
227
246
  ssrInnerHtml,
228
247
  ssrInputAttrs,
@@ -254,6 +273,7 @@ var import_runtime_server = require("../runtime.server.cjs");
254
273
  unstable_Activity,
255
274
  unstable_ViewTransition,
256
275
  unstable_addTransitionType,
276
+ unstable_batchedUpdates,
257
277
  use,
258
278
  useActionState,
259
279
  useCallback,
@@ -262,6 +282,7 @@ var import_runtime_server = require("../runtime.server.cjs");
262
282
  useDeferredValue,
263
283
  useEffect,
264
284
  useEffectEvent,
285
+ useFormState,
265
286
  useFormStatus,
266
287
  useId,
267
288
  useImperativeHandle,
@@ -275,6 +296,7 @@ var import_runtime_server = require("../runtime.server.cjs");
275
296
  useState,
276
297
  useSyncExternalStore,
277
298
  useTransition,
299
+ version,
278
300
  warmChild,
279
301
  warmMemo,
280
302
  withSlot
@@ -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.2";
24
+ const version = "0.2.3";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  version
@@ -0,0 +1,7 @@
1
+ import type { OctaneNode } from './runtime.js';
2
+ /** Migration wrapper. Octane deliberately does not replay renders or effects. */
3
+ export declare function StrictMode(props: {
4
+ children?: OctaneNode;
5
+ }): OctaneNode;
6
+ /** Updates already share Octane's microtask batch. */
7
+ export declare function unstable_batchedUpdates<A extends unknown[], R>(callback: (...args: A) => R, ...args: A): R;
@@ -0,0 +1,10 @@
1
+ function StrictMode(props) {
2
+ return props.children;
3
+ }
4
+ function unstable_batchedUpdates(callback, ...args) {
5
+ return callback(...args);
6
+ }
7
+ export {
8
+ StrictMode,
9
+ unstable_batchedUpdates
10
+ };
@@ -33,8 +33,7 @@ import { normalizeUniversalRuntime } from './universal-runtime.js';
33
33
  import { formatCompileDiagnostic } from './native-change-diagnostics.js';
34
34
  import { findVoidComponentImports, findVoidRootImports, slotHooks } from './slot-hooks.js';
35
35
  import { rewriteServerRuntimeRequests } from './runtime-requests.js';
36
- import { assertStrongMode } from './strong-mode.js';
37
- import { assertNativeReadDiagnostics, assertNativeReadOptions } from './native-read-diagnostics.js';
36
+ import { assertNativeReadOptions } from './native-read-diagnostics.js';
38
37
  import { findCssModuleImportRequests } from './css-module-imports.js';
39
38
  import {
40
39
  assertNoLiveClientOnlyImports,
@@ -1272,13 +1271,15 @@ class OctaneBundlerCompiler {
1272
1271
  return passThrough();
1273
1272
  }
1274
1273
  const nativeHookImport = /from\s*['"]octane\/signals\/(?:client|server)['"]/.test(code);
1275
- if (
1276
- !/from\s*['"]octane['"]/.test(code) &&
1277
- !(nativeReads && /from\s*['"]octane\/server['"]/.test(code)) &&
1278
- !nativeHookImport &&
1279
- !(nativeReads && /from\s*['"]octane\/signals['"]/.test(code))
1280
- )
1281
- return passThrough();
1274
+ const hasHookRuntimeImport =
1275
+ /from\s*['"]octane['"]/.test(code) ||
1276
+ (nativeReads && /from\s*['"]octane\/server['"]/.test(code)) ||
1277
+ nativeHookImport ||
1278
+ (nativeReads && /from\s*['"]octane\/signals['"]/.test(code));
1279
+ // Manual factories can import only other binding helpers, so their
1280
+ // escaping hooks still need a provider boundary. Unrelated helpers keep
1281
+ // their cheap pass-through without collecting unused manifest watches.
1282
+ if (!hasHookRuntimeImport && !/(?:\b|_)use[A-Z]/.test(code)) return passThrough();
1282
1283
  if (!this._isInstalledOctaneSource(file, collected)) {
1283
1284
  return passThrough();
1284
1285
  }
@@ -1291,6 +1292,7 @@ class OctaneBundlerCompiler {
1291
1292
  return passThrough();
1292
1293
  }
1293
1294
  const manualSlots = this._hasManualHookSlots(file, collected);
1295
+ if (!hasHookRuntimeImport && !manualSlots) return passThrough();
1294
1296
  const inlinePlainMemo =
1295
1297
  inlineHookMemo &&
1296
1298
  environment === 'client' &&
@@ -1299,27 +1301,8 @@ class OctaneBundlerCompiler {
1299
1301
  profile === false &&
1300
1302
  renderer.target === 'dom' &&
1301
1303
  universalRuntime === undefined;
1302
- if (manualSlots && !inlinePlainMemo) {
1303
- const authoredSource = code;
1304
- if (nativeReads || nativeHookImport)
1305
- assertNativeReadDiagnostics(
1306
- parseModule(authoredSource, filename),
1307
- authoredSource,
1308
- filename,
1309
- {
1310
- nativeReads,
1311
- renderer,
1312
- },
1313
- );
1314
- // Hand-slotted bindings still own their authored policy. Opting one
1315
- // module in must not require changing its established slot ABI.
1316
- if (strong || code.includes('use strong')) {
1317
- assertStrongMode(parseModule(authoredSource, filename), authoredSource, filename, {
1318
- strong,
1319
- });
1320
- }
1321
- if (!nativeReads) return passThrough();
1322
- }
1304
+ // Manual modules still need observed tuple capabilities. slotHooks keeps
1305
+ // their authored slots and dependencies while selecting getter helpers.
1323
1306
  const profileFilename = profile ? this._profileModuleId(file, collected) : undefined;
1324
1307
  const specializeVoidRoot =
1325
1308
  !manualSlots &&
@@ -25,6 +25,7 @@ const AUTO_RUNTIME_HOOKS = new Set([
25
25
  'useTransition',
26
26
  'useSyncExternalStore',
27
27
  'useActionState',
28
+ 'useFormState',
28
29
  'useFormStatus',
29
30
  'useOptimistic',
30
31
  'useContext',
@@ -246,6 +246,7 @@ const UNIVERSAL_RUNTIME_IMPORTS = new Set([
246
246
  'startTransition',
247
247
  'use',
248
248
  'useActionState',
249
+ 'useFormState',
249
250
  'useCallback',
250
251
  'useContext',
251
252
  'useDebugValue',
@@ -3818,6 +3819,7 @@ export const UNIVERSAL_COMPILER_RUNTIME_IMPORTS = new Set([
3818
3819
  'useBatch',
3819
3820
  'warmChild',
3820
3821
  'warmMemo',
3822
+ 'markWarm',
3821
3823
  'withSlot',
3822
3824
  ]);
3823
3825
 
@@ -4237,6 +4239,7 @@ export function lowerUniversalRendererRegionAst(
4237
4239
  'useBatch',
4238
4240
  'warmMemo',
4239
4241
  'warmChild',
4242
+ 'markWarm',
4240
4243
  'withSlot',
4241
4244
  'hookSlots',
4242
4245
  ].map((imported) => [