octane 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/cjs/compatibility.cjs +35 -0
  2. package/dist/cjs/component-flags.cjs +8 -1
  3. package/dist/cjs/css.cjs +9 -0
  4. package/dist/cjs/dom-tables.cjs +8 -1
  5. package/dist/cjs/error-codes.client.generated.cjs +15 -2
  6. package/dist/cjs/error-codes.server.generated.cjs +5 -0
  7. package/dist/cjs/event-names.cjs +39 -0
  8. package/dist/cjs/index.cjs +13 -0
  9. package/dist/cjs/runtime.cjs +1345 -359
  10. package/dist/cjs/runtime.server.cjs +620 -183
  11. package/dist/cjs/server/index.cjs +26 -0
  12. package/dist/cjs/version.cjs +1 -1
  13. package/dist/compatibility.d.ts +7 -0
  14. package/dist/compatibility.js +10 -0
  15. package/dist/compiler/bundler.js +20 -30
  16. package/dist/compiler/compile-renderer-boundaries.js +1 -0
  17. package/dist/compiler/compile-universal.js +3 -0
  18. package/dist/compiler/compile.js +877 -627
  19. package/dist/compiler/hook-deps.js +100 -3
  20. package/dist/compiler/hook-names.js +1 -0
  21. package/dist/compiler/hydrate-boundaries.js +165 -15
  22. package/dist/compiler/manual-hooks.js +171 -0
  23. package/dist/compiler/parser.node.js +34 -8
  24. package/dist/compiler/plain-hook-memo.js +54 -5
  25. package/dist/compiler/slot-hooks.d.ts +43 -0
  26. package/dist/compiler/slot-hooks.js +154 -35
  27. package/dist/compiler/strong-mode.js +836 -3
  28. package/dist/compiler/style-scopes.js +1134 -0
  29. package/dist/compiler/volar.LICENSES.txt +1 -1
  30. package/dist/compiler/volar.js +4543 -2839
  31. package/dist/component-flags.d.ts +1 -1
  32. package/dist/component-flags.js +8 -1
  33. package/dist/css.d.ts +7 -0
  34. package/dist/css.js +8 -0
  35. package/dist/dom-tables.js +8 -1
  36. package/dist/error-codes.client.generated.d.ts +3 -1
  37. package/dist/error-codes.client.generated.js +15 -2
  38. package/dist/error-codes.server.generated.d.ts +1 -0
  39. package/dist/error-codes.server.generated.js +5 -0
  40. package/dist/event-names.d.ts +1 -0
  41. package/dist/event-names.js +15 -0
  42. package/dist/html-tree-validation.d.ts +17 -34
  43. package/dist/index.d.ts +3 -1
  44. package/dist/index.js +12 -1
  45. package/dist/jsx-runtime.d.ts +6 -1
  46. package/dist/public-types.d.ts +188 -0
  47. package/dist/public-types.js +0 -0
  48. package/dist/runtime.d.ts +128 -69
  49. package/dist/runtime.js +1349 -360
  50. package/dist/runtime.server.d.ts +67 -15
  51. package/dist/runtime.server.js +619 -184
  52. package/dist/server/index.d.ts +4 -2
  53. package/dist/server/index.js +23 -0
  54. package/dist/static/index.d.ts +2 -1
  55. package/dist/static/index.js +3 -1
  56. package/dist/universal-core.d.ts +8 -1
  57. package/dist/universal-core.js +95 -9
  58. package/dist/version.js +1 -1
  59. package/package.json +4 -3
@@ -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,
@@ -116,10 +123,13 @@ __export(server_exports, {
116
123
  ssrValueAttr: () => import_runtime_server.ssrValueAttr,
117
124
  ssrVoidContent: () => import_runtime_server.ssrVoidContent,
118
125
  startTransition: () => import_runtime_server.startTransition,
126
+ styleMap: () => import_runtime_server.styleMap,
119
127
  subSlot: () => import_sub_slot.subSlot,
128
+ touchStyleMap: () => import_runtime_server.touchStyleMap,
120
129
  unstable_Activity: () => import_runtime_server.Activity,
121
130
  unstable_ViewTransition: () => import_runtime_server.ViewTransition,
122
131
  unstable_addTransitionType: () => import_runtime_server.addTransitionType,
132
+ unstable_batchedUpdates: () => import_compatibility.unstable_batchedUpdates,
123
133
  use: () => import_runtime_server.use,
124
134
  useActionState: () => import_runtime_server.useActionState,
125
135
  useCallback: () => import_runtime_server.useCallback,
@@ -128,6 +138,7 @@ __export(server_exports, {
128
138
  useDeferredValue: () => import_runtime_server.useDeferredValue,
129
139
  useEffect: () => import_runtime_server.useEffect,
130
140
  useEffectEvent: () => import_runtime_server.useEffectEvent,
141
+ useFormState: () => import_runtime_server.useActionState,
131
142
  useFormStatus: () => import_runtime_server.useFormStatus,
132
143
  useId: () => import_runtime_server.useId,
133
144
  useImperativeHandle: () => import_runtime_server.useImperativeHandle,
@@ -141,12 +152,15 @@ __export(server_exports, {
141
152
  useState: () => import_runtime_server.useState,
142
153
  useSyncExternalStore: () => import_runtime_server.useSyncExternalStore,
143
154
  useTransition: () => import_runtime_server.useTransition,
155
+ version: () => import_version.version,
144
156
  warmChild: () => import_runtime_server.warmChild,
145
157
  warmMemo: () => import_runtime_server.warmMemo,
146
158
  withSlot: () => import_runtime_server.withSlot
147
159
  });
148
160
  module.exports = __toCommonJS(server_exports);
149
161
  var import_rpc = require("./rpc.cjs");
162
+ var import_version = require("../version.cjs");
163
+ var import_compatibility = require("../compatibility.cjs");
150
164
  var import_sub_slot = require("../sub-slot.cjs");
151
165
  var import_method_dep = require("../method-dep.cjs");
152
166
  var import_runtime_server = require("../runtime.server.cjs");
@@ -159,6 +173,7 @@ var import_runtime_server = require("../runtime.server.cjs");
159
173
  Fragment,
160
174
  HYDRATION_RANGE_BOUNDARY,
161
175
  Hydrate,
176
+ StrictMode,
162
177
  Suspense,
163
178
  ViewTransition,
164
179
  __methodDep,
@@ -181,11 +196,14 @@ var import_runtime_server = require("../runtime.server.cjs");
181
196
  getSsrSuspenseTimeout,
182
197
  hookSlots,
183
198
  injectStyle,
199
+ invokeManualHook,
184
200
  isChildrenBlock,
185
201
  isValidElement,
186
202
  lazy,
203
+ manualHook,
187
204
  mapSlot,
188
205
  markChildrenBlock,
206
+ markWarm,
189
207
  memo,
190
208
  namespaceHead,
191
209
  namespaceHeadElement,
@@ -212,7 +230,9 @@ var import_runtime_server = require("../runtime.server.cjs");
212
230
  ssrBlock,
213
231
  ssrCheckedAttr,
214
232
  ssrChild,
233
+ ssrChildPre,
215
234
  ssrChildText,
235
+ ssrChildTextPre,
216
236
  ssrChildrenSources,
217
237
  ssrClass,
218
238
  ssrComponent,
@@ -223,6 +243,7 @@ var import_runtime_server = require("../runtime.server.cjs");
223
243
  ssrFormAuthoringDiagnostics,
224
244
  ssrFragmentMarker,
225
245
  ssrHeadEl,
246
+ ssrHtml,
226
247
  ssrInNamespace,
227
248
  ssrInnerHtml,
228
249
  ssrInputAttrs,
@@ -250,10 +271,13 @@ var import_runtime_server = require("../runtime.server.cjs");
250
271
  ssrValueAttr,
251
272
  ssrVoidContent,
252
273
  startTransition,
274
+ styleMap,
253
275
  subSlot,
276
+ touchStyleMap,
254
277
  unstable_Activity,
255
278
  unstable_ViewTransition,
256
279
  unstable_addTransitionType,
280
+ unstable_batchedUpdates,
257
281
  use,
258
282
  useActionState,
259
283
  useCallback,
@@ -262,6 +286,7 @@ var import_runtime_server = require("../runtime.server.cjs");
262
286
  useDeferredValue,
263
287
  useEffect,
264
288
  useEffectEvent,
289
+ useFormState,
265
290
  useFormStatus,
266
291
  useId,
267
292
  useImperativeHandle,
@@ -275,6 +300,7 @@ var import_runtime_server = require("../runtime.server.cjs");
275
300
  useState,
276
301
  useSyncExternalStore,
277
302
  useTransition,
303
+ version,
278
304
  warmChild,
279
305
  warmMemo,
280
306
  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.4";
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,
@@ -472,6 +471,13 @@ export function findDescriptorChildrenImports(source, id) {
472
471
  if (jsxBindings.has(local)) candidates.push({ ...imported, local });
473
472
  }
474
473
  for (const node of ast.body || []) {
474
+ if (node.type === 'ExportDefaultDeclaration') {
475
+ if (node.declaration?.type === 'Identifier') {
476
+ const imported = importedBindings.get(node.declaration.name);
477
+ if (imported !== undefined) candidates.push({ ...imported, exported: 'default' });
478
+ }
479
+ continue;
480
+ }
475
481
  if (node.type !== 'ExportNamedDeclaration') continue;
476
482
  for (const specifier of node.specifiers || []) {
477
483
  const exported = specifier.exported?.name ?? specifier.exported?.value;
@@ -1272,13 +1278,15 @@ class OctaneBundlerCompiler {
1272
1278
  return passThrough();
1273
1279
  }
1274
1280
  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();
1281
+ const hasHookRuntimeImport =
1282
+ /from\s*['"]octane['"]/.test(code) ||
1283
+ (nativeReads && /from\s*['"]octane\/server['"]/.test(code)) ||
1284
+ nativeHookImport ||
1285
+ (nativeReads && /from\s*['"]octane\/signals['"]/.test(code));
1286
+ // Manual factories can import only other binding helpers, so their
1287
+ // escaping hooks still need a provider boundary. Unrelated helpers keep
1288
+ // their cheap pass-through without collecting unused manifest watches.
1289
+ if (!hasHookRuntimeImport && !/(?:\b|_)use[A-Z]/.test(code)) return passThrough();
1282
1290
  if (!this._isInstalledOctaneSource(file, collected)) {
1283
1291
  return passThrough();
1284
1292
  }
@@ -1291,6 +1299,7 @@ class OctaneBundlerCompiler {
1291
1299
  return passThrough();
1292
1300
  }
1293
1301
  const manualSlots = this._hasManualHookSlots(file, collected);
1302
+ if (!hasHookRuntimeImport && !manualSlots) return passThrough();
1294
1303
  const inlinePlainMemo =
1295
1304
  inlineHookMemo &&
1296
1305
  environment === 'client' &&
@@ -1299,27 +1308,8 @@ class OctaneBundlerCompiler {
1299
1308
  profile === false &&
1300
1309
  renderer.target === 'dom' &&
1301
1310
  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
- }
1311
+ // Manual modules still need observed tuple capabilities. slotHooks keeps
1312
+ // their authored slots and dependencies while selecting getter helpers.
1323
1313
  const profileFilename = profile ? this._profileModuleId(file, collected) : undefined;
1324
1314
  const specializeVoidRoot =
1325
1315
  !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) => [