Skip to content

fix(universal): re-export __methodDep through the universal entries - #1339

Merged
trueadm merged 1 commit into
octanejs:mainfrom
aleclarson:fix/universal-method-dep
Sep 27, 2026
Merged

trueadm merged 1 commit into
octanejs:mainfrom
aleclarson:fix/universal-method-dep

Conversation

@aleclarson

@aleclarson aleclarson commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • universal-core.ts (the shared root of octane/universal and octane/universal/native) now re-exports __methodDep.
  • scripts/verify-dist.mjs required-exports contract covers it on both universal subpaths.

Why

The compiler lowers inferred method-call hook dependencies to import { __methodDep } from 'octane'. Under the universal / universal/native export conditions that specifier resolves to universal-core, which lacked the re-export — universal-target builds fail at module resolution while the default entry compiles fine. The helper is pure (no DOM), so it belongs in the host-neutral core.

Found consuming octane/universal/native via @nativescript-community/octane — a leaf component whose compiler-inferred deps included a method call (props.onFoo(...)) crashed the native bundle build with a missing-export error.

Changes

  • packages/octane/src/universal-core.ts: re-export line.
  • packages/octane/scripts/verify-dist.mjs: __methodDep added to the ./universal and ./universal/native required-exports lists (the build's import verification now guards the regression).
  • Patch changeset for octane.

Validation

  • pnpm -F octane build — dist builds and imports verified passes with the new required exports.
  • pnpm typecheck:files packages/octane/src/universal-core.ts
  • npx vitest run tests/public-exports.test.ts (4/4)
  • full pnpm test — not run (repo-wide suite; one-line re-export + contract-list additions).

Risk / follow-ups

  • None expected — additive export; octane's default entry already exported it.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

Low Risk
Additive public export aligned with the default entry; no auth, data, or behavioral logic changes.

Overview
Fixes universal and universal/native builds that break when the compiler emits import { __methodDep } from 'octane' for inferred method-call hook dependencies (e.g. props.onFoo(...)). Those export conditions resolve to universal-core, which previously did not re-export the helper even though the default octane entry did.

universal-core.ts now re-exports __methodDep from method-dep.js (host-neutral, same as the main entry). verify-dist.mjs lists __methodDep among required public exports for ./universal and ./universal/native so the dist smoke test catches a future regression. Patch changeset for octane.

Reviewed by Cursor Bugbot for commit f2b7d03. Bugbot is set up for automated code reviews on this repo. Configure here.

The compiler lowers inferred method-call hook dependencies to
`import { __methodDep } from 'octane'`. Under the `universal`/
`universal/native` export conditions that specifier resolves to
universal-core, which lacked the re-export — universal-target builds
failed at module resolution while the default entry compiled fine.

The helper is pure (no DOM), so it belongs in the host-neutral core.
verify-dist's required-exports contract now covers it on both universal
subpaths.
@github-actions github-actions Bot added the fix PR: bug fix label Sep 27, 2026
@trueadm
trueadm merged commit 1bebd3b into octanejs:main Sep 27, 2026
31 checks passed
aleclarson added a commit to octane-xplat/octane-xplat that referenced this pull request Sep 29, 2026
Published dist/native kept `from "octane"` — the DOM entry — for plain-.ts
sources and the compiler-injected __methodDep helper (#3). The
resolve.alias in these configs never fired: rollup tests externals on the
raw specifier, so `octane` was emitted verbatim and the dev deps-bundle then
packed a second, DOM, runtime beside the universal one — hooks read an empty
CURRENT_SCOPE and apps crashed on first render ("null.hooks" via
useSyncExternalStore).

Rewrite the specifier at emit time instead (rollup output.paths), exact-match
`octane` → `octane/universal/native`, in ui and every leaf package build; the
dead aliases are removed. __methodDep resolves there via octanejs/octane#1339,
so the octane peer floor rises to >=0.6.3 across packages and the workspace's
0.5.0-universal-signals tarball gets an allowedVersions exception. A post-build
check fails the build if bare `octane` ever lands in dist/native again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants