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

Bump esbuild from 0.14.25 to 0.14.27 #995

Merged
merged 1 commit into from
Mar 15, 2022

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Mar 15, 2022

Bumps esbuild from 0.14.25 to 0.14.27.

Release notes

Sourced from esbuild's releases.

v0.14.27

  • Avoid generating an enumerable default import for CommonJS files in Babel mode (#2097)

    Importing a CommonJS module into an ES module can be done in two different ways. In node mode the default import is always set to module.exports, while in Babel mode the default import passes through to module.exports.default instead. Node mode is triggered when the importing file ends in .mjs, has type: "module" in its package.json file, or the imported module does not have a __esModule marker.

    Previously esbuild always created the forwarding default import in Babel mode, even if module.exports had no property called default. This was problematic because the getter named default still showed up as a property on the imported namespace object, and could potentially interfere with code that iterated over the properties of the imported namespace object. With this release the getter named default will now only be added in Babel mode if the default property exists at the time of the import.

  • Fix a circular import edge case regarding ESM-to-CommonJS conversion (#1894, #2059)

    This fixes a regression that was introduced in version 0.14.5 of esbuild. Ever since that version, esbuild now creates two separate export objects when you convert an ES module file into a CommonJS module: one for ES modules and one for CommonJS modules. The one for CommonJS modules is written to module.exports and exported from the file, and the one for ES modules is internal and can be accessed by bundling code that imports the entry point (for example, the entry point might import itself to be able to inspect its own exports).

    The reason for these two separate export objects is that CommonJS modules are supposed to see a special export called __esModule which indicates that the module used to be an ES module, while ES modules are not supposed to see any automatically-added export named __esModule. This matters for real-world code both because people sometimes iterate over the properties of ES module export namespace objects and because some people write ES module code containing their own exports named __esModule that they expect other ES module code to be able to read.

    However, this change to split exports into two separate objects broke ES module re-exports in the edge case where the imported module is involved in an import cycle. This happened because the CommonJS module.exports object was no longer mutated as exports were added. Instead it was being initialized at the end of the generated file after the import statements to other modules (which are converted into require() calls). This release changes module.exports initialization to happen earlier in the file and then double-writes further exports to both the ES module and CommonJS module export objects.

    This fix was contributed by @​indutny.

v0.14.26

  • Fix a tree shaking regression regarding var declarations (#2080, #2085, #2098, #2099)

    Version 0.14.8 of esbuild enabled removal of duplicate function declarations when minification is enabled (see #610):

    // Original code
    function x() { return 1 }
    console.log(x())
    function x() { return 2 }
    // Output (with --minify-syntax)
    console.log(x());
    function x() {
    return 2;
    }

    This transformation is safe because function declarations are "hoisted" in JavaScript, which means they are all done first before any other code is evaluted. This means the last function declaration will overwrite all previous function declarations with the same name.

    However, this introduced an unintentional regression for var declarations in which all but the last declaration was dropped if tree-shaking was enabled. This only happens for top-level var declarations that re-declare the same variable multiple times. This regression has now been fixed:

    // Original code
    var x = 1
    console.log(x)
    var x = 2
    // Old output (with --tree-shaking=true)
    console.log(x);
    var x = 2;
    // New output (with --tree-shaking=true)

... (truncated)

Changelog

Sourced from esbuild's changelog.

0.14.27

  • Avoid generating an enumerable default import for CommonJS files in Babel mode (#2097)

    Importing a CommonJS module into an ES module can be done in two different ways. In node mode the default import is always set to module.exports, while in Babel mode the default import passes through to module.exports.default instead. Node mode is triggered when the importing file ends in .mjs, has type: "module" in its package.json file, or the imported module does not have a __esModule marker.

    Previously esbuild always created the forwarding default import in Babel mode, even if module.exports had no property called default. This was problematic because the getter named default still showed up as a property on the imported namespace object, and could potentially interfere with code that iterated over the properties of the imported namespace object. With this release the getter named default will now only be added in Babel mode if the default property exists at the time of the import.

  • Fix a circular import edge case regarding ESM-to-CommonJS conversion (#1894, #2059)

    This fixes a regression that was introduced in version 0.14.5 of esbuild. Ever since that version, esbuild now creates two separate export objects when you convert an ES module file into a CommonJS module: one for ES modules and one for CommonJS modules. The one for CommonJS modules is written to module.exports and exported from the file, and the one for ES modules is internal and can be accessed by bundling code that imports the entry point (for example, the entry point might import itself to be able to inspect its own exports).

    The reason for these two separate export objects is that CommonJS modules are supposed to see a special export called __esModule which indicates that the module used to be an ES module, while ES modules are not supposed to see any automatically-added export named __esModule. This matters for real-world code both because people sometimes iterate over the properties of ES module export namespace objects and because some people write ES module code containing their own exports named __esModule that they expect other ES module code to be able to read.

    However, this change to split exports into two separate objects broke ES module re-exports in the edge case where the imported module is involved in an import cycle. This happened because the CommonJS module.exports object was no longer mutated as exports were added. Instead it was being initialized at the end of the generated file after the import statements to other modules (which are converted into require() calls). This release changes module.exports initialization to happen earlier in the file and then double-writes further exports to both the ES module and CommonJS module export objects.

    This fix was contributed by @​indutny.

0.14.26

  • Fix a tree shaking regression regarding var declarations (#2080, #2085, #2098, #2099)

    Version 0.14.8 of esbuild enabled removal of duplicate function declarations when minification is enabled (see #610):

    // Original code
    function x() { return 1 }
    console.log(x())
    function x() { return 2 }
    // Output (with --minify-syntax)
    console.log(x());
    function x() {
    return 2;
    }

    This transformation is safe because function declarations are "hoisted" in JavaScript, which means they are all done first before any other code is evaluted. This means the last function declaration will overwrite all previous function declarations with the same name.

    However, this introduced an unintentional regression for var declarations in which all but the last declaration was dropped if tree-shaking was enabled. This only happens for top-level var declarations that re-declare the same variable multiple times. This regression has now been fixed:

    // Original code
    var x = 1
    console.log(x)
    var x = 2
    // Old output (with --tree-shaking=true)
    console.log(x);
    var x = 2;

... (truncated)

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [esbuild](https://github.com/evanw/esbuild) from 0.14.25 to 0.14.27.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](evanw/esbuild@v0.14.25...v0.14.27)

---
updated-dependencies:
- dependency-name: esbuild
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added the dependencies Auto-pinning label Mar 15, 2022
@jpogran jpogran self-assigned this Mar 15, 2022
@jpogran jpogran added this to the 2.21.0 milestone Mar 15, 2022
@jpogran jpogran merged commit 7523ea5 into main Mar 15, 2022
@jpogran jpogran deleted the dependabot/npm_and_yarn/esbuild-0.14.27 branch March 15, 2022 13:41
@radeksimko radeksimko modified the milestones: 2.21.0, v2.20.1 Mar 17, 2022
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dependencies Auto-pinning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants