Skip to content
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

Feat module umd globals #6717

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Commits on Dec 25, 2022

  1. feat: implementing globals and porting some modifications

    - Implementing by reducing globals (no exact mode)
    - Implementing exact mode by using regex and fallback resolution
    - Fixing and adding handling of dot only imports to be `_` rather then empty string "" (a change too was made to have it as member and not computed member )
    - fixing or updating imports reducing to include Js extension to not do. Just like babel and because it allow importance and exports to work with the same format. Too necessary.
    
    - more details on the pr -
    MohamedLamineAllal committed Dec 25, 2022
    Configuration menu
    Copy the full SHA
    eb3f0b4 View commit details
    Browse the repository at this point in the history
  2. chore: adding output.*.ts to prettierignore (for output.umd.ts files)

    - needed for crates/swc_ecma_transforms_module/tests/fixture/common/issue-4456/1/output.umd.ts
    - there is output.*.js so .ts version make sense
    MohamedLamineAllal committed Dec 25, 2022
    Configuration menu
    Copy the full SHA
    edeeb3c View commit details
    Browse the repository at this point in the history
  3. update: old tests that had to be changed with the new update

    This commit include the changes proted for already existing tests before this PR update. (only 3)
    
    - crates/swc_ecma_transforms_module/tests/fixture/common/issue-4456/1/output.umd.ts
    is due to the handling of dot imports to `_` that was added.
    
    - crates/swc_ecma_transforms_module/tests/fixture/common/issue-578/2/output.umd.js
       crates/swc_ecma_transforms_module/tests/fixture/common/issue-962/output.umd.js
       Due to the no Js type extension inclusion in reducing for imports (like babel - check PR for details)
    MohamedLamineAllal committed Dec 25, 2022
    Configuration menu
    Copy the full SHA
    768dec8 View commit details
    Browse the repository at this point in the history
  4. test: test for dot imports reducing implementation

    - The readme included in that test explain what that is
    
    - the behavior follow how babel do it.
    
    - See PR for more details (Like what part of the code is responsible for this) -
    MohamedLamineAllal committed Dec 25, 2022
    Configuration menu
    Copy the full SHA
    8b6717a View commit details
    Browse the repository at this point in the history
  5. tests: tests for globals feature

    ## testing no exact globals
    - testing when globals are in reduced format
    - when globals are not in reduced format
    - testing when no globals are provided
    - testing also with the dot imports _  change and no Js type extension inclusion in reducing change.
    
    ## exact mode
    - testing regex matching
    - testing order precedency and regex resolution fallback
    - testing no regex matching
    
    ##
    in all the output and mapping is tested to work correctly
    MohamedLamineAllal committed Dec 25, 2022
    Configuration menu
    Copy the full SHA
    d5a98db View commit details
    Browse the repository at this point in the history