octane 0.1.47 → 0.1.48

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.
@@ -1847,11 +1847,6 @@ function scheduleRender(block) {
1847
1847
  }
1848
1848
  let DRAIN_ID = 0;
1849
1849
  const RENDER_PHASE_UPDATE_LIMIT = 25;
1850
- function blockDepth(b) {
1851
- let d = 0;
1852
- for (let p = b.parentBlock; p !== null; p = p.parentBlock) d++;
1853
- return d;
1854
- }
1855
1850
  function belongsToBlockTree(block, root) {
1856
1851
  for (let current = block; current !== null; current = current.parentBlock) {
1857
1852
  if (current === root) return true;
@@ -1885,8 +1880,25 @@ function drainHydrationRenderPhaseUpdates(root) {
1885
1880
  }
1886
1881
  }
1887
1882
  function sortWaveByDepth(wave) {
1883
+ const queued = new Set(wave);
1888
1884
  const depth = /* @__PURE__ */ new Map();
1889
- for (let i = 0; i < wave.length; i++) depth.set(wave[i], blockDepth(wave[i]));
1885
+ const path = [];
1886
+ for (let i = 0; i < wave.length; i++) {
1887
+ let current = wave[i];
1888
+ let knownDepth;
1889
+ while (current !== null) {
1890
+ knownDepth = depth.get(current);
1891
+ if (knownDepth !== void 0) break;
1892
+ path.push(current);
1893
+ current = current.parentBlock;
1894
+ }
1895
+ let currentDepth = knownDepth ?? -1;
1896
+ while (path.length > 0) {
1897
+ const block = path.pop();
1898
+ currentDepth++;
1899
+ if (queued.has(block)) depth.set(block, currentDepth);
1900
+ }
1901
+ }
1890
1902
  wave.sort((a, b) => depth.get(a) - depth.get(b));
1891
1903
  return wave;
1892
1904
  }
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  version: () => version
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const version = "0.1.47";
24
+ const version = "0.1.48";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  version
@@ -17,7 +17,7 @@ import { parseModule } from '@tsrx/core';
17
17
  import {
18
18
  compile,
19
19
  compileForBundler,
20
- hasLowerableJsxReturnBranches,
20
+ createJsxReturnBranchClassifier,
21
21
  hasOnlyLowerableNullishExits,
22
22
  isVoidJsxCodeBlockFunction,
23
23
  } from './compile.js';
@@ -254,13 +254,14 @@ export function findVoidComponentExports(source, id) {
254
254
  }
255
255
 
256
256
  const voidBindings = new Set();
257
+ const hasLowerableJsxReturnBranches = createJsxReturnBranchClassifier(ast.body || []);
257
258
  // Mirrors the compile-time lowering decisions exactly (nullish-guard @{}
258
259
  // bodies AND React-style conditional JSX returns), so cross-module call-site
259
260
  // classification agrees with what each module actually compiled to.
260
261
  const isVoidFunction = (node) =>
261
262
  isVoidJsxCodeBlockFunction(node) ||
262
263
  hasOnlyLowerableNullishExits(node) ||
263
- hasLowerableJsxReturnBranches(node, ast.body || []);
264
+ hasLowerableJsxReturnBranches(node);
264
265
  for (const declaration of declarations) {
265
266
  if (declaration.type === 'FunctionDeclaration' && declaration.id?.name) {
266
267
  if (isVoidFunction(declaration)) voidBindings.add(declaration.id.name);
@@ -530,6 +531,10 @@ class OctaneBundlerCompiler {
530
531
  return;
531
532
  }
532
533
  const changed = nodePath.resolve(cleanModuleId(path));
534
+ // Both cache families retain only present or missing package manifests.
535
+ // Ordinary source edits still start a diagnostic generation above, but
536
+ // cannot invalidate either cache.
537
+ if (nodePath.basename(changed) !== 'package.json') return;
533
538
  for (const [directory, entry] of this.manifestRuleCache) {
534
539
  if (entry.dependencies.includes(changed) || entry.missingDependencies.includes(changed)) {
535
540
  this.manifestRuleCache.delete(directory);
@@ -422,31 +422,6 @@ function inheritGeneratedOrigin(root, origin) {
422
422
  return root;
423
423
  }
424
424
 
425
- function mapAstCow(value, replace) {
426
- if (!value || typeof value !== 'object') return value;
427
- if (Array.isArray(value)) {
428
- let output = null;
429
- for (let index = 0; index < value.length; index++) {
430
- const mapped = mapAstCow(value[index], replace);
431
- if (output === null && mapped !== value[index]) output = value.slice(0, index);
432
- if (output !== null && mapped !== null) output.push(mapped);
433
- }
434
- return output ?? value;
435
- }
436
- const replacement = replace(value);
437
- if (replacement !== undefined) return replacement;
438
- let output = null;
439
- for (const [key, child] of Object.entries(value)) {
440
- if (AST_SKIP_KEYS.has(key)) continue;
441
- const mapped = mapAstCow(child, replace);
442
- if (mapped !== child) {
443
- if (output === null) output = { ...value };
444
- output[key] = mapped;
445
- }
446
- }
447
- return output ?? value;
448
- }
449
-
450
425
  function jsonValueToAst(value, origin) {
451
426
  const valueOrigin =
452
427
  value && typeof value === 'object' && value[PLAN_ORIGIN] ? value[PLAN_ORIGIN] : origin;