Skip to content

fix(prolink): export createProlinkUrl from Node builds#369

Open
memosr wants to merge 1 commit into
base:masterfrom
memosr:fix/prolink-node-export
Open

fix(prolink): export createProlinkUrl from Node builds#369
memosr wants to merge 1 commit into
base:masterfrom
memosr:fix/prolink-node-export

Conversation

@memosr

@memosr memosr commented Jul 25, 2026

Copy link
Copy Markdown

Summary

createProlinkUrl is unreachable from Node. It is re-exported from the browser prolink build but not from the Node one, and the root Node entrypoint does not re-export the prolink utilities at all. This makes the import shown in the docs fail on Node.

Addresses item 1 of #368.

SyntaxError: The requested module '@base-org/account/prolink' does not provide an export named 'createProlinkUrl'

Root cause

exports["./prolink"].node resolves to dist/interface/public-utilities/prolink/index.node.js, and that file never re-exported createProlinkUrl:

  • src/interface/public-utilities/prolink/index.ts:207-208 has export { createProlinkUrl } from './createProlinkUrl.js';
  • src/interface/public-utilities/prolink/index.node.ts does not

The same asymmetry exists one level up:

  • src/index.ts:50-58 exports createProlinkUrl, encodeProlink, decodeProlink
  • src/index.node.ts exports none of them

Confirmed against the published artifact, not just the source. @base-org/account@2.5.7/dist/interface/public-utilities/prolink/index.node.js contains only encodeProlink and decodeProlink.

Changes

  1. src/interface/public-utilities/prolink/index.node.ts re-exports createProlinkUrl, matching index.ts.
  2. src/index.node.ts re-exports the prolink utilities from ./interface/public-utilities/prolink/index.node.js, so the root Node entrypoint matches the browser root.
  3. Added a regression test to the existing createProlinkUrl.test.ts, which already imported from ./index.node.js. No new test file.

createProlinkUrl.ts has zero imports. It builds a URL with URL / URLSearchParams, both global in Node, and the package already requires engines.node: ">=20". It has no compression dependency, so the re-export cannot pull the brotli-wasm path into the Node bundle. Importing from index.node.js in the root keeps Node on utils/compression.node.js.

Test plan

Command Result
typecheck pass
lint pass (one pre-existing noExplicitAny warning in subscribe.ts:98, untouched)
test 1001 tests across 73 files pass
build pass

The new test is a real guard: removing the re-export makes it fail, restoring it makes it pass.

Verified in the built output:

dist/interface/public-utilities/prolink/index.node.js:170
  export { createProlinkUrl } from './createProlinkUrl.js';

dist/index.node.js:8
  export { createProlinkUrl, decodeProlink, encodeProlink } from './interface/public-utilities/prolink/index.node.js';

Smoke-tested the built dist in Node:

prolink/index.node.js exports: createProlinkUrl, decodeProlink, encodeProlink
root index.node.js has createProlinkUrl: function

Notes

Two things from #368 deliberately left out of this PR:

  • Item 2 (sub-account personal_sign / Storybook). The referenced storybook/stories/components/smart-wallet/SubAccount.tsx does not exist in this repo, and there is no storybook/ directory. Every sub-account personal_sign example in the repo already hex-encodes correctly (examples/testapp/src/pages/add-sub-account/components/PersonalSign.tsx:22-25, import-sub-account/components/PersonalSign.tsx:21-24, e2e-test/tests/sub-account-features.ts:170-173, auto-sub-account/index.page.tsx:218-223). The hex requirement itself is intentional and locked by tests in createSubAccountSigner.test.ts:334-341 and :361-382, so changing it would be breaking. Left for separate discussion on the issue.
  • The reporter's "not exported from the root at all" claim is broader than the actual bug. The browser root does export all three. Only the Node root did not, which this PR fixes.

createProlinkUrl was re-exported from the browser prolink build but not
from index.node.ts, so importing it from @base-org/account/prolink in
Node threw a SyntaxError. The root index.node.ts also did not re-export
the prolink utilities, unlike src/index.ts.

createProlinkUrl.ts has no imports and no compression dependency, so
this cannot pull the brotli-wasm path into the Node bundle.

Adds a regression test to the existing createProlinkUrl.test.ts.

Addresses base#368
@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants