fix(tsx loader): esbuild config lookup throws#70
Merged
JakobJingleheimer merged 13 commits intomainfrom Jan 7, 2025
Merged
Conversation
`LoadContext.parentURL` doesn't exist
Member
Author
|
TSX loader is working when run via a locally compiled nightly build of node (that contains the nodejs/node#56382 fix to test result output$ ~/Workspace/github/nodejs/node/node \
--no-warnings \
--import='./test/snapshots.mjs' \
--experimental-test-snapshots \
--experimental-test-coverage \
--test-reporter=lcov \
--test-reporter-destination=./coverage.lcov \
--test-reporter=spec \
--test-reporter-destination=stdout \
--experimental-test-module-mocks \
--test \
--test-coverage-include='packages/**/*' \
--test-coverage-exclude='**/*.spec.mjs' \
--test-coverage-exclude='**/*.test.mjs' \
'./packages/*/*.spec.mjs' \
'./packages/*/*.test.mjs'
▶ alias
▶ that are in tsconfig.json
✔ should de-alias a prefixed specifier (0.487125ms)
✔ should de-alias a pointer (fully-qualified url) specifier (0.094875ms)
✔ should de-alias a pointer (absolute path) specifier (0.132125ms)
✔ should maintain any suffixes on the prefixed specifier (0.118542ms)
✔ should maintain any suffixes on the pointer (fully-qualified url) specifier (0.117ms)
✔ should maintain any suffixes on the pointer (absolute path) specifier (0.056084ms)
✔ that are in tsconfig.json (26.225041ms)
✔ alias (84.180458ms)
▶ alias (e2e)
✔ should work with `--loader` (197.638125ms)
✔ should work with `module.register` (174.760208ms)
✔ alias (e2e) (373.421708ms)
▶ css-module loader
▶ resolve
✔ should recognise css module files (3.826209ms)
✔ should ignore css files that aren’t css-modules (4.319708ms)
✔ should ignore files that aren’t css at all (4.284292ms)
✔ should handle specifiers with appending data (4.336459ms)
✔ resolve (4.969709ms)
▶ load
✔ should ignore files that aren’t css-modules (15.670625ms)
✔ should handle files with nested and non-nested comments (16.707875ms)
✔ load (19.020417ms)
✔ css-module loader (19.977042ms)
▶ css-module (e2e)
✔ should work with `--loader` (220.796042ms)
✔ should work with `module.register` (194.176708ms)
✔ css-module (e2e) (416.92975ms)
▶ JSONC loader
▶ resolve
✔ should recognise jsonc files (7.827292ms)
✔ should ignore json files that aren’t jsonc (7.689834ms)
✔ should ignore files that aren’t json at all (7.594292ms)
✔ should handle specifiers with appending data (7.714458ms)
✔ should ignore json files that aren’t jsonc (7.393625ms)
✔ should ignore json if the import attribute is set (6.596792ms)
✔ resolve (9.203791ms)
▶ load
✔ should handle files with comments (15.521875ms)
✔ load (18.796416ms)
✔ JSONC loader (20.581833ms)
▶ jsonc (e2e)
▶ json
✔ should work with `--loader` (188.454959ms)
✔ should work with `module.register` (181.054541ms)
✔ json (370.045791ms)
▶ jsonc
✔ should work with `--loader` (142.439333ms)
✔ should work with `module.register` (102.476208ms)
✔ jsonc (245.008542ms)
✔ jsonc (e2e) (615.654459ms)
▶ media loader
▶ resolve
✔ should ignore unrecognised files (5.380209ms)
✔ should recognise media files (9.064625ms)
✔ should handle specifiers with appending data (9.669625ms)
✔ resolve (10.265125ms)
▶ load
✔ should ignore unrecognised files (17.223125ms)
✔ should return the resolved URL for the media file (8.019334ms)
✔ load (18.09375ms)
✔ media loader (18.58775ms)
▶ Contains CJS()
▶ exports
✔ should find assignments to `exports` (0.853708ms)
✔ should NOT find `exports` in comments (0.123583ms)
✔ exports (1.486583ms)
▶ require
✔ should find calls to `require()` (0.078834ms)
✔ should NOT find calls to methods named `require` (0.13025ms)
✔ should NOT find `require` in comments (0.063625ms)
✔ require (0.345542ms)
✔ Contains CJS() (2.341958ms)
▶ Mismatched format loader (unit)
▶ when "esm" is actually cjs
✔ should detect and report the corrected format (7.60675ms)
✔ should detect and report the corrected format (1.681542ms)
✔ should detect and report the corrected format (2.5245ms)
✔ when "esm" is actually cjs (13.239167ms)
✔ Mismatched format loader (unit) (76.607292ms)
▶ Mismatched format loader (e2e)
▶ correctly identify the containing CJS as CJS, despite "type": "module"
✔ should handle `require()` (4.384458ms)
✔ should handle `module.exports` (1.235875ms)
✔ correctly identify the containing CJS as CJS, despite "type": "module" (6.670458ms)
▶ correctly identify the containing ESM as ESM, despite "type": "commonjs"
✔ should handle createRequire (1.1815ms)
✔ should handle `require()` within a comment (1.896667ms)
✔ correctly identify the containing ESM as ESM, despite "type": "commonjs" (3.251125ms)
✔ Mismatched format loader (e2e) (10.516ms)
▶ SVGX loader
▶ load
✔ should ignore files that aren’t SVG (10.63ms)
✔ should transpile the SVG to a JSX module (13.707125ms)
✔ should throw a helpful error when a valid component name cannot be derived (1.489375ms)
✔ load (14.966292ms)
✔ SVGX loader (15.520083ms)
▶ text loader
▶ resolve
✔ should ignore files that aren’t text (2.748583ms)
✔ should recognise text files (3.014875ms)
✔ should handle specifiers with appending data (3.005541ms)
✔ resolve (3.4705ms)
▶ load
✔ should ignore files that aren’t text (8.989166ms)
✔ should generate a module from the text file (13.697084ms)
✔ load (15.015375ms)
✔ text loader (15.500833ms)
▶ finding an ESbuild config
✔ should warn when no config is found (no package.json) (1.492542ms)
✔ should warn when no config is found (package.json found but no config) (0.204042ms)
✔ should not swallow unexpected errors (0.383292ms)
✔ should return a cached result when it has it (defaults) (1.06ms)
✔ should return a cached result when it has it (non-defaults) (0.335917ms)
✔ finding an ESbuild config (58.386625ms)
▶ JSX & TypeScript loader
▶ resolve
✔ should ignore files that aren’t text (12.568625ms)
✔ should recognise JSX files (12.697167ms)
✔ should recognise TypeScript files (10.394792ms)
✔ should handle specifiers with appending data (9.97775ms)
✔ resolve (13.344334ms)
▶ load
✔ should ignore files that aren’t J|TSX (14.530167ms)
✔ should transpile JSX (34.349583ms)
✔ should transpile TSX (33.835458ms)
✔ should log transpile errors (32.472792ms)
✔ load (39.715ms)
✔ JSX & TypeScript loader (115.415625ms)
▶ JSX & TypeScript loader (e2e)
✔ should load a TSX file but fail because of missing react package (160.347792ms)
✔ JSX & TypeScript loader (e2e) (161.346916ms)
▶ YAML loader
✔ should resolve a ".yaml" (7.102083ms)
✔ should resolve a ".yml" file (7.293208ms)
✔ should ignore a non-yaml file (7.262292ms)
✔ should load and parse YAML content (7.192917ms)
✔ should not load non-yaml content (7.161209ms)
✔ should correctly parse complex YAML content (7.103708ms)
✔ YAML loader (8.192958ms)
ℹ tests 72
ℹ suites 35
ℹ pass 72
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 757.953459
ℹ start of coverage report
ℹ ------------------------------------------------------------------------------------------
ℹ file | line % | branch % | funcs % | uncovered lines
ℹ ------------------------------------------------------------------------------------------
ℹ packages | | | |
ℹ alias | | | |
ℹ alias.mjs | 95.18 | 87.50 | 87.50 | 13-15 53
ℹ fixtures | | | |
ℹ e2e.mjs | 100.00 | 100.00 | 100.00 |
ℹ message.mjs | 100.00 | 100.00 | 100.00 |
ℹ register.mjs | 100.00 | 100.00 | 100.00 |
ℹ css-module | | | |
ℹ css-module.mjs | 100.00 | 100.00 | 100.00 |
ℹ fixtures | | | |
ℹ e2e.mjs | 100.00 | 100.00 | 100.00 |
ℹ register.mjs | 100.00 | 100.00 | 100.00 |
ℹ jsonc | | | |
ℹ fixtures | | | |
ℹ e2e-json.mjs | 100.00 | 100.00 | 100.00 |
ℹ e2e-jsonc.mjs | 100.00 | 100.00 | 100.00 |
ℹ register.mjs | 100.00 | 100.00 | 100.00 |
ℹ jsonc.mjs | 100.00 | 100.00 | 100.00 |
ℹ media | | | |
ℹ media.mjs | 100.00 | 100.00 | 100.00 |
ℹ mismatched-format | | | |
ℹ contains-cjs.mjs | 100.00 | 100.00 | 100.00 |
ℹ mismatched-format.mjs | 95.12 | 77.78 | 100.00 | 34-35
ℹ parse-filename | | | |
ℹ parse-filename.mjs | 100.00 | 80.00 | 100.00 |
ℹ svgx | | | |
ℹ svgx.mjs | 100.00 | 100.00 | 100.00 |
ℹ text | | | |
ℹ text.mjs | 100.00 | 100.00 | 100.00 |
ℹ tsx | | | |
ℹ find-esbuild-config.mjs | 38.33 | 50.00 | 100.00 | 6-8 20 22-26 28-37 39-43 45…
ℹ fixtures | | | |
ℹ register.mjs | 100.00 | 100.00 | 100.00 |
ℹ tsx.mjs | 98.10 | 87.50 | 100.00 | 70-71
ℹ yaml | | | |
ℹ yaml.mjs | 100.00 | 100.00 | 100.00 |
ℹ ------------------------------------------------------------------------------------------
ℹ all files | 92.50 | 92.59 | 96.97 |
ℹ ------------------------------------------------------------------------------------------
ℹ end of coverage reportLet's wait to land this PR until node 23.6.0 and 22.13.0 are released next week (~07 Jan). |
Member
|
WOOOOWWW happy to see that happen |
AugustinMauroy
approved these changes
Jan 5, 2025
Member
|
We won't merge until the node release is present, to keep things green. Even if we know that our ci green is a lie |
Member
|
https://nodejs.org/en/blog/release/v23.6.0 WOW we can merge this pr I |
Member
Author
|
Ah, let me undo removing the 23+ gate on the tsx e2e test. |
bd7c9d2 to
4907bc9
Compare
Pull Request Test Coverage Report for Build 12657289693Details
💛 - Coveralls |
4907bc9 to
1007b21
Compare
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.
LoadContext.parentURLdoesn't existCloses #54
Resolves #53