Skip to content

Comments

chore(rolldown): oxc v0.64.0#4144

Merged
IWANABETHATGUY merged 6 commits intomainfrom
next-oxc
Apr 17, 2025
Merged

chore(rolldown): oxc v0.64.0#4144
IWANABETHATGUY merged 6 commits intomainfrom
next-oxc

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Apr 17, 2025

No description provided.

@Boshen Boshen requested a review from Dunqing April 17, 2025 02:45
@socket-security
Copy link

socket-security bot commented Apr 17, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​oxc-project/​types@​0.63.0 ⏵ 0.64.010010070 +196100
Addedmicromatch@​4.0.810010010083100

View full report

@Boshen
Copy link
Member Author

Boshen commented Apr 17, 2025

@Dunqing One failing test

---- test_tests__esbuild__ts__ts_export_default_type_issue316__config_json stdout ----
Input: /Users/boshen/github/rolldown/crates/rolldown/tests/esbuild/ts/ts_export_default_type_issue316/_config.json

thread 'test_tests__esbuild__ts__ts_export_default_type_issue316__config_json' panicked at crates/rolldown_testing/src/integration_test.rs:168:11:
Expected the bundling to be success, but got diagnosable errors: BatchedBuildDiagnostic(
    [
        BuildDiagnostic {
            inner: MissingExport {
                stable_importer: "entry.ts",
                stable_importee: "keep/declare-class.ts",
                importer_source: "import dc_def, { bar as dc } from './keep/declare-class'\nimport dl_def, { bar as dl } from './keep/declare-let'\nimport im_def, { bar as im } from './keep/interface-merged'\nimport in_def, { bar as _in } from './keep/interface-nested'\nimport tn_def, { bar as tn } from './keep/type-nested'\nimport vn_def, { bar as vn } from './keep/value-namespace'\nimport vnm_def, { bar as vnm } from './keep/value-namespace-merged'\n\nimport i_def, { bar as i } from './remove/interface'\nimport ie_def, { bar as ie } from './remove/interface-exported'\nimport t_def, { bar as t } from './remove/type'\nimport te_def, { bar as te } from './remove/type-exported'\nimport ton_def, { bar as ton } from './remove/type-only-namespace'\nimport tone_def, { bar as tone } from './remove/type-only-namespace-exported'\n\nexport default [\n\tdc_def, dc,\n\tdl_def, dl,\n\tim_def, im,\n\tin_def, _in,\n\ttn_def, tn,\n\tvn_def, vn,\n\tvnm_def, vnm,\n\n\ti,\n\tie,\n\tt,\n\tte,\n\tton,\n\ttone,\n]",
                imported_specifier: "default",
                imported_specifier_span: Span {
                    start: 7,
                    end: 13,
                },
            },
            source: None,
            severity: Error,
        },
        BuildDiagnostic {
            inner: MissingExport {
                stable_importer: "entry.ts",
                stable_importee: "keep/declare-let.ts",
                importer_source: "import dc_def, { bar as dc } from './keep/declare-class'\nimport dl_def, { bar as dl } from './keep/declare-let'\nimport im_def, { bar as im } from './keep/interface-merged'\nimport in_def, { bar as _in } from './keep/interface-nested'\nimport tn_def, { bar as tn } from './keep/type-nested'\nimport vn_def, { bar as vn } from './keep/value-namespace'\nimport vnm_def, { bar as vnm } from './keep/value-namespace-merged'\n\nimport i_def, { bar as i } from './remove/interface'\nimport ie_def, { bar as ie } from './remove/interface-exported'\nimport t_def, { bar as t } from './remove/type'\nimport te_def, { bar as te } from './remove/type-exported'\nimport ton_def, { bar as ton } from './remove/type-only-namespace'\nimport tone_def, { bar as tone } from './remove/type-only-namespace-exported'\n\nexport default [\n\tdc_def, dc,\n\tdl_def, dl,\n\tim_def, im,\n\tin_def, _in,\n\ttn_def, tn,\n\tvn_def, vn,\n\tvnm_def, vnm,\n\n\ti,\n\tie,\n\tt,\n\tte,\n\tton,\n\ttone,\n]",
                imported_specifier: "default",
                imported_specifier_span: Span {
                    start: 64,
                    end: 70,
                },
            },
            source: None,
            severity: Error,
        },
    ],
)```

@netlify
Copy link

netlify bot commented Apr 17, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit add3aba
🔍 Latest deploy log https://app.netlify.com/sites/rolldown-rs/deploys/6800e3c949f101000844a4d8

@github-actions
Copy link
Contributor

github-actions bot commented Apr 17, 2025

Benchmarks Rust

group                                                               pr                                     target
-----                                                               --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol                     1.00     74.0±3.02ms        ? ?/sec    1.02     75.3±3.52ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-minify              1.03     98.7±2.79ms        ? ?/sec    1.00     95.6±1.74ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-minify-sourcemap    1.03    111.6±2.85ms        ? ?/sec    1.00    108.0±1.44ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap           1.08     88.4±2.81ms        ? ?/sec    1.00     81.7±2.34ms        ? ?/sec
bundle/bundle@rome-ts                                               1.01    123.4±2.10ms        ? ?/sec    1.00    121.6±2.34ms        ? ?/sec
bundle/bundle@rome-ts-minify                                        1.00    196.1±1.10ms        ? ?/sec    1.00    195.9±4.60ms        ? ?/sec
bundle/bundle@rome-ts-minify-sourcemap                              1.03    246.5±6.04ms        ? ?/sec    1.00    240.3±2.27ms        ? ?/sec
bundle/bundle@rome-ts-sourcemap                                     1.03    136.3±1.87ms        ? ?/sec    1.00    132.7±1.23ms        ? ?/sec
bundle/bundle@threejs                                               1.01     41.7±1.06ms        ? ?/sec    1.00     41.3±0.55ms        ? ?/sec
bundle/bundle@threejs-minify                                        1.00     85.0±0.41ms        ? ?/sec    1.00     85.0±0.47ms        ? ?/sec
bundle/bundle@threejs-minify-sourcemap                              1.07    106.7±1.06ms        ? ?/sec    1.00     99.4±0.47ms        ? ?/sec
bundle/bundle@threejs-sourcemap                                     1.03     49.1±1.19ms        ? ?/sec    1.00     47.9±0.61ms        ? ?/sec
bundle/bundle@threejs10x                                            1.02    437.5±5.35ms        ? ?/sec    1.00    430.1±5.74ms        ? ?/sec
bundle/bundle@threejs10x-minify                                     1.01  1084.9±10.33ms        ? ?/sec    1.00  1078.3±12.77ms        ? ?/sec
bundle/bundle@threejs10x-minify-sourcemap                           1.01  1265.2±11.01ms        ? ?/sec    1.00  1251.3±11.87ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                                  1.02    513.6±8.24ms        ? ?/sec    1.00    505.3±6.01ms        ? ?/sec
remapping/remapping                                                 1.00     26.5±0.21ms        ? ?/sec    1.02     27.2±0.35ms        ? ?/sec
remapping/render-chunk-remapping                                    1.00     62.4±0.34ms        ? ?/sec    1.12     69.6±6.02ms        ? ?/sec
scan/scan@rome-ts                                                   1.00     95.6±1.55ms        ? ?/sec    1.00     95.4±1.42ms        ? ?/sec
scan/scan@threejs                                                   1.00     31.4±0.30ms        ? ?/sec    1.03     32.2±1.48ms        ? ?/sec
scan/scan@threejs10x                                                1.00    317.9±2.92ms        ? ?/sec    1.01    321.2±5.26ms        ? ?/sec

@Dunqing
Copy link
Collaborator

Dunqing commented Apr 17, 2025

@Dunqing One failing test

---- test_tests__esbuild__ts__ts_export_default_type_issue316__config_json stdout ----
Input: /Users/boshen/github/rolldown/crates/rolldown/tests/esbuild/ts/ts_export_default_type_issue316/_config.json

thread 'test_tests__esbuild__ts__ts_export_default_type_issue316__config_json' panicked at crates/rolldown_testing/src/integration_test.rs:168:11:
Expected the bundling to be success, but got diagnosable errors: BatchedBuildDiagnostic(
    [
        BuildDiagnostic {
            inner: MissingExport {
                stable_importer: "entry.ts",
                stable_importee: "keep/declare-class.ts",
                importer_source: "import dc_def, { bar as dc } from './keep/declare-class'\nimport dl_def, { bar as dl } from './keep/declare-let'\nimport im_def, { bar as im } from './keep/interface-merged'\nimport in_def, { bar as _in } from './keep/interface-nested'\nimport tn_def, { bar as tn } from './keep/type-nested'\nimport vn_def, { bar as vn } from './keep/value-namespace'\nimport vnm_def, { bar as vnm } from './keep/value-namespace-merged'\n\nimport i_def, { bar as i } from './remove/interface'\nimport ie_def, { bar as ie } from './remove/interface-exported'\nimport t_def, { bar as t } from './remove/type'\nimport te_def, { bar as te } from './remove/type-exported'\nimport ton_def, { bar as ton } from './remove/type-only-namespace'\nimport tone_def, { bar as tone } from './remove/type-only-namespace-exported'\n\nexport default [\n\tdc_def, dc,\n\tdl_def, dl,\n\tim_def, im,\n\tin_def, _in,\n\ttn_def, tn,\n\tvn_def, vn,\n\tvnm_def, vnm,\n\n\ti,\n\tie,\n\tt,\n\tte,\n\tton,\n\ttone,\n]",
                imported_specifier: "default",
                imported_specifier_span: Span {
                    start: 7,
                    end: 13,
                },
            },
            source: None,
            severity: Error,
        },
        BuildDiagnostic {
            inner: MissingExport {
                stable_importer: "entry.ts",
                stable_importee: "keep/declare-let.ts",
                importer_source: "import dc_def, { bar as dc } from './keep/declare-class'\nimport dl_def, { bar as dl } from './keep/declare-let'\nimport im_def, { bar as im } from './keep/interface-merged'\nimport in_def, { bar as _in } from './keep/interface-nested'\nimport tn_def, { bar as tn } from './keep/type-nested'\nimport vn_def, { bar as vn } from './keep/value-namespace'\nimport vnm_def, { bar as vnm } from './keep/value-namespace-merged'\n\nimport i_def, { bar as i } from './remove/interface'\nimport ie_def, { bar as ie } from './remove/interface-exported'\nimport t_def, { bar as t } from './remove/type'\nimport te_def, { bar as te } from './remove/type-exported'\nimport ton_def, { bar as ton } from './remove/type-only-namespace'\nimport tone_def, { bar as tone } from './remove/type-only-namespace-exported'\n\nexport default [\n\tdc_def, dc,\n\tdl_def, dl,\n\tim_def, im,\n\tin_def, _in,\n\ttn_def, tn,\n\tvn_def, vn,\n\tvnm_def, vnm,\n\n\ti,\n\tie,\n\tt,\n\tte,\n\tton,\n\ttone,\n]",
                imported_specifier: "default",
                imported_specifier_span: Span {
                    start: 64,
                    end: 70,
                },
            },
            source: None,
            severity: Error,
        },
    ],
)```
// declare-class.ts

declare class foo {}
export default foo
export let bar = 123

The above code will transform into:

export let bar = 123;

See OXC Playground. Our implementation exactly match with Babel now.

But in ESBuild, the export default foo will be kept as-is. This panic is caused by export_default_foo being removed by oxc-transformer, whereas Rolldown assumed all exports exist.

I am not sure which way we should follow, and okay to follow your guy's suggestion to change? What do you think?

Also, take into account that Babel is still used widely, so this assumption is incorrect. Whether which way we adopt, the Rolldown side should avoid this potential panic.

@rolldown/rolldown cc

@IWANABETHATGUY
Copy link
Member

IWANABETHATGUY commented Apr 17, 2025

Then the only way to workaround this issue is omit MissingExport diagnostic when importee is a ts module

@hyf0

This comment was marked as outdated.

IWANABETHATGUY added a commit that referenced this pull request Apr 17, 2025
…portee module is ts/tsx (#4147)

<!-- Thank you for contributing! -->

### Description
1. related to
#4144 (comment)
<!-- Please insert your description here and provide especially info
about the "what" this PR is solving -->
@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review April 17, 2025 07:34
@IWANABETHATGUY
Copy link
Member

After discussing with @hyf0, we have fixed the test panic in #4147

@Dunqing
Copy link
Collaborator

Dunqing commented Apr 17, 2025

I found that the changes at 3c473d0 were unexpected due to oxc-project/oxc#10465. But this only affects DTS, and has no type resolution change, whether it has type or not, so we can leave it now.

@IWANABETHATGUY IWANABETHATGUY added this pull request to the merge queue Apr 17, 2025
auto-merge was automatically disabled April 17, 2025 11:38

Pull Request is not mergeable

Merged via the queue into main with commit b20f441 Apr 17, 2025
28 checks passed
@IWANABETHATGUY IWANABETHATGUY deleted the next-oxc branch April 17, 2025 11:48
graphite-app bot pushed a commit that referenced this pull request Sep 9, 2025
)

There are multiple cases that `MISSING_EXPORT` happens even when TypeScript does not output an error.

1. #4144 (comment)
    - This case only happens when the importer and the importee is both TS. This is because we treat `foo` as a "type" rather than a "value" (since we remove `export default foo` completely. If we treat it as a "value", we should keep that).
2. The case written in https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax (`export { A } from './a'`)
    - This case only happens when the importer and the importee is both TS. This is because if `A` is a "value", `A` would exist after transpilation.

Both of these cases can be fixed by adding the `type` modifier. While setting `verbatimModuleSyntax: true` would make TypeScript to error on these cases, it changes some other behaviors, and is not straightforward to turn that on. This PR improves the error message, so that users can know what to do even if they don't enable `verbatimModuleSyntax`.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants