-
Notifications
You must be signed in to change notification settings - Fork 139
feat(runner): support Node 20 via oxc-node TypeScript loader #1388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Simon Ingeson (smonn)
wants to merge
1
commit into
main
Choose a base branch
from
wiz-10992-support-node-20
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| --- | ||
| "@qawolf/cli": minor | ||
| --- | ||
|
|
||
| Support Node 20. The `engines.node` floor is lowered to `>=20.19.0`, and on Node | ||
| versions without native TypeScript support (Node 20, and Node 22.15–22.17) flows | ||
| are now loaded through the `@oxc-node/core` ESM loader, which transpiles and | ||
| resolves TypeScript at runtime. Bun and Node 22.18+ are unaffected. A CI matrix | ||
| smoke-tests the published bundle on Node 20, 22, 24, and Bun. | ||
|
|
||
| Note: the `@qawolf/*` platform packages currently declare `engines.node >=22.22.0`, | ||
| so installing on Node 20 prints `EBADENGINE` warnings. They are verified to run on | ||
| Node 20.19, and the warnings are non-fatal unless `engine-strict` is enabled. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // @oxc-node/core ships no types for its side-effect entry points. The /register | ||
| // import self-registers the ESM/CJS TypeScript loader for its side effect only. | ||
| declare module "@oxc-node/core/register"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { describe, expect, it } from "bun:test"; | ||
|
|
||
| import { detectRuntimeCapabilities } from "./detectRuntimeCapabilities.js"; | ||
|
|
||
| describe("detectRuntimeCapabilities", () => { | ||
| it("reports Bun when running under Bun", () => { | ||
| // The test runner is Bun, so this exercises the real detection path. | ||
| const caps = detectRuntimeCapabilities(); | ||
| expect(caps.isBun).toBe(true); | ||
| }); | ||
|
|
||
| it("returns a boolean for every capability", () => { | ||
| const caps = detectRuntimeCapabilities(); | ||
| expect(typeof caps.hasSyncHooks).toBe("boolean"); | ||
| expect(typeof caps.hasNativeTypeScript).toBe("boolean"); | ||
| expect(typeof caps.hasAsyncRegister).toBe("boolean"); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import nodeModule from "node:module"; | ||
|
|
||
| import { resolveRegisterHooks } from "./registerFlowModuleResolver.js"; | ||
| import type { RuntimeCapabilities } from "./selectFlowLoaderStrategy.js"; | ||
|
|
||
| /** | ||
| * Feature-detects the current runtime's TypeScript + module-hook capabilities. | ||
| * Kept thin: all decision logic lives in selectFlowLoaderStrategy so it stays | ||
| * testable without spawning real runtimes. | ||
| */ | ||
| export function detectRuntimeCapabilities(): RuntimeCapabilities { | ||
| return { | ||
| isBun: (globalThis as { Bun?: unknown }).Bun !== undefined, | ||
| hasSyncHooks: resolveRegisterHooks(nodeModule) !== undefined, | ||
| // process.features.typescript is false, "strip", or "transform" (Node 22.18+). | ||
| hasNativeTypeScript: Boolean( | ||
| (process.features as { typescript?: unknown }).typescript, | ||
| ), | ||
| hasAsyncRegister: | ||
| typeof (nodeModule as { register?: unknown }).register === "function", | ||
| }; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.