Repository navigation
feat: support named import from json - #20
Merged
Merged
Conversation
Member
Author
|
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @Brooooooklyn and the rest of your teammates on |
Brooooooklyn
force-pushed
the
07-17-chore_add_wasm_pacakge_test_case
branch
from
July 17, 2024 15:46
c79d1de to
2efeb26
Compare
Brooooooklyn
force-pushed
the
07-17-chore_add_wasm_pacakge_test_case_split
branch
3 times, most recently
from
July 18, 2024 02:24
e56f3b8 to
b0bb629
Compare
Member
Author
Merge activity
|
Brooooooklyn
changed the base branch from
07-17-chore_add_wasm_pacakge_test_case
to
graphite-base/20
July 18, 2024 02:45
Brooooooklyn
force-pushed
the
07-17-chore_add_wasm_pacakge_test_case_split
branch
from
July 18, 2024 02:46
b0bb629 to
ab11168
Compare
Brooooooklyn
added a commit
that referenced
this pull request
Oct 26, 2026
<!-- claude-projects-attribution: {"github_login":"Brooooooklyn"} -->
_Requested by **Brooklyn** · [project
thread](https://claude.ai/code/project/chan_018s9RxRdtH424j2EhXdzV3N?thread=cmsg_018s9RxRdtH424j2EhXdzV3NQxbeR8Pt7qaqSQwoq9rEFo)_
<!-- routine:prune-tests:duplicate-smoke-tests -->
Before: two smoke tests could not fail for a reason no other test
catches. `integrate-vitest`'s `index.spec.ts > transform` repeats
integrate-module's `should resolve native addon`, and integrate-module's
`named import from json` asserts on a JSON import that Node loads
natively, so it passes even when oxc-node's JSON loader is broken.
After: both are gone. The two stdin TTY tests that alone catch a TTY
regression now say so in a comment, and a comment that pointed at the
deleted spec points at the surviving test. Only test files change.
How: each removal was defended by mutating `src/lib.rs` with the most
realistic regression it could catch, rebuilding the addon, running all
three JS suites, and reverting.
### Totals
- Files touched: 4, all tests (1 deleted, 1 case removed, 2
comment-only).
- Cases deleted: **2 of 643** JS cases (Vitest 600, integrate-module 21,
integrate-module-bundler 22); after: 641. The Rust `#[test]`s are
untouched.
- Cases merged: 0.
- Net lines: **−7** (+6 / −13).
- Runtime saved: 9.8 ms, the summed duration of the removed cases
(`transform` 9.72 ms, `named import from json` 0.09 ms).
### Removals
1. **`packages/integrate-vitest/__tests__/index.spec.ts > transform`**
(whole file)
- Class: duplicate. It calls `new
OxcTransformer(process.cwd()).transformAsync("foo.ts", …)` and checks
the CommonJS output; `packages/integrate-module/src/index.ts > should
resolve native addon` does the same with `"index.ts"`.
- Mutation M4: `src/lib.rs` `TransformTask::compute` emits `Module::Esm`
instead of `Module::CommonJS`. Fails both this test and `should resolve
native addon`.
- Still covered by `should resolve native addon`.
2. **`packages/integrate-module/src/index.ts > named import from json`**
- Class: cannot fail when the product breaks. `import pkgJson from
"../package.json" with { type: "json" }` is loaded by Node itself, not
by oxc-node's JSON loader, and the test only reads `pkgJson.version`, a
default-export property.
- Mutation M5: `src/lib.rs` JSON loader emits `export default {}`. 9
`json-modules` / percent-encoded Vitest cases fail; all of
integrate-module, including this test, passes.
- Mutation M3: the JSON loader drops the synthesised named exports.
`json-modules.spec.ts > a named import` and `> a paths alias keeps the
synthesised named exports` fail; this test passes.
- The original feature (#20, named JSON imports) stays covered by those
two `json-modules.spec.ts` cases; `resolve package.json` keeps the
import itself exercised.
### Kept after defense
- `stdin-tty.spec.ts > CLI preserves TTY properties when stdin is a TTY`
and `> CLI with node directly preserves TTY (baseline comparison)`.
Mutation M6, `process.stdin.isTTY = false;` at the top of
`packages/core/register.mjs`, fails only these two across all three
suites (re-run on this branch). Each now carries a comment saying so.
### Case counts
| suite | before | after | delta |
|---|---|---|---|
| integrate-vitest (Vitest) | 600 (581 passed, 19 skipped) | 599 (580
passed, 19 skipped) | −1 |
| integrate-module | 21 | 20 | −1 |
| integrate-module-bundler | 22 | 22 | 0 |
0 failures before and after.
### What ran and what did not
- Ran: all three JS suites at `6d5376d` and on this branch; mutations
M3, M4, M5 (with an addon rebuild each) and M6, each reverted
afterwards; `vp check --no-fmt` (lint and type-check, clean on 99
files); `vp fmt --check` on the touched files (clean).
- `vp check` reports a formatting issue in `lerna.json`; it reports the
same at `6d5376d`, and this PR does not touch that file.
- Not run: the Rust tests, the bench, the WASI build, and other
platforms.
Ages: `transform` dates from before #663 (2026-07-04); `named import
from json` from #20 (2024-07-18). Neither is in a permission or security
suite.
To revert: `git revert 80ceedd`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01PxVsmvB9xfZKfVnUonY8kf)_
---------
Co-authored-by: Claude <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.