Skip to content

Fix Bend source imports on Node with default type stripping - #2204

Open
sebastian-griego wants to merge 1 commit into
bendlang:mainfrom
sebastian-griego:fix/node-loader-type-stripping
Open

sebastian-griego wants to merge 1 commit into
bendlang:mainfrom
sebastian-griego:fix/node-loader-type-stripping

Conversation

@sebastian-griego

Copy link
Copy Markdown
Contributor

Node 24.15.0 stops with ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX when an application preloads bend2/main.ts to import a Bend module. Node strips TypeScript types by default. The two constructor parameter properties in the loader's imports require a transform.

Store the original check error in an explicit field. For recursive groups, use the key that the existing error already stores in its message. The module export test now imports its Bend source under Node when Node supports type stripping.

Verification

Run this command from the repository root with Node 24.15.0.

node --import ./bend2/main.ts --input-type=module -e 'import Game from "./demos/app_win_is_bug_2d/main.bend"; console.log(Game.map_h())'

On main, Node stops before it loads the game. With this change, it prints 8.

  • The regression test failed on 21968444 and passed with this change. I ran it through the Bend CLI and as emitted JavaScript.
  • An invalid Bend import still reported the source error under Node and Bun.
  • All six tests/proof/group_*.bend fixtures emitted the same BendTT output as main.
  • The local repository gate passed all 56 checks.

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.

1 participant