Bump esbuild from 0.14.54 to 0.15.1
Bumps esbuild from 0.14.54 to 0.15.1.
Release notes
Sourced from esbuild's releases.
v0.15.1
Update esbuild's Yarn Plug'n'Play implementation to match the latest specification changes (#2452, #2453)
This release updates esbuild's implementation of Yarn Plug'n'Play to match some changes to Yarn's specification that just landed. The changes are as follows:
Check for platform-specific absolute paths instead of always for the
/prefixThe specification previously said that Yarn Plug'n'Play path resolution rules should not apply for paths that start with
/. The intent was to avoid accidentally processing absolute paths. However, absolute paths on Windows such asC:\projectstart with drive letters instead of with/. So the specification was changed to instead explicitly avoid processing absolute paths.Make
$$virtualan alias for__virtual__Supporting Yarn-style path resolution requires implementing a custom Yarn-specific path traversal scheme where certain path segments are considered no-ops. Specifically any path containing segments of the form
__virtual__/<whatever>/<n>where<n>is an integer must be treated as if they werentimes the..operator instead (the<whatever>path segment is ignored). So/path/to/project/__virtual__/xyz/2/foo.jsmaps to the underlying file/path/to/project/../../foo.js. This scheme makes it possible for Yarn to get node (and esbuild) to load the same file multiple times (which is sometimes required for correctness) without actually duplicating the file on the file system.However, old versions of Yarn used to use
$$virtualinstead of__virtual__. This was changed because$$virtualwas error-prone due to the use of the$character, which can cause bugs when it's not correctly escaped within regular expressions. Now that esbuild makes$$virtualan alias for__virtual__, esbuild should now work with manifests from these old Yarn versions.Ignore PnP manifests in virtual directories
The specification describes the algorithm for how to find the Plug'n'Play manifest when starting from a certain point in the file system: search through all parent directories in reverse order until the manifest is found. However, this interacts poorly with virtual paths since it can end up finding a virtual copy of the manifest instead of the original. To avoid this, esbuild now ignores manifests in virtual directories so that the search for the manifest will continue and find the original manifest in another parent directory later on.
These fixes mean that esbuild's implementation of Plug'n'Play now matches Yarn's implementation more closely, and esbuild can now correctly build more projects that use Plug'n'Play.
v0.15.0
This release contains backwards-incompatible changes. Since esbuild is before version 1.0.0, these changes have been released as a new minor version to reflect this (as recommended by npm). You should either be pinning the exact version of
esbuildin yourpackage.jsonfile or be using a version range syntax that only accepts patch upgrades such as~0.14.0. See the documentation about semver for more information.
Implement the Yarn Plug'n'Play module resolution algorithm (#154, #237, #1263, #2451)
Node comes with a package manager called npm, which installs packages into a
node_modulesfolder. Node and esbuild both come with built-in rules for resolving import paths to packages withinnode_modules, so packages installed via npm work automatically without any configuration. However, many people use an alternative package manager called Yarn. While Yarn can install packages usingnode_modules, it also offers a different package installation strategy called Plug'n'Play, which is often shortened to "PnP" (not to be confused with pnpm, which is an entirely different unrelated package manager).Plug'n'Play installs packages as
.zipfiles on your file system. The packages are never actually unzipped. Since Node doesn't know anything about Yarn's package installation strategy, this means you can no longer run your code with Node as it won't be able to find your packages. Instead, you need to run your code with Yarn, which applies patches to Node's file system APIs before running your code. These patches attempt to make zip files seem like normal directories. When running under Yarn, using Node's file system API to read./some.zip/lib/file.jsactually automatically extractslib/file.jsfrom./some.zipat run-time as if it was a normal file. Other file system APIs behave similarly. However, these patches don't work with esbuild because esbuild is not written in JavaScript; it's a native binary executable that interacts with the file system directly through the operating system.Previously the workaround for using esbuild with Plug'n'Play was to use the
@yarnpkg/esbuild-plugin-pnpplugin with esbuild's JavaScript API. However, this wasn't great because the plugin needed to potentially intercept every single import path and file load to check whether it was a Plug'n'Play package, which has an unusually high performance cost. It also meant that certain subtleties of path resolution rules within a.zipfile could differ slightly from the way esbuild normally works since path resolution inside.zipfiles was implemented by Yarn, not by esbuild (which is due to a limitation of esbuild's plugin API).With this release, esbuild now contains an independent implementation of Yarn's Plug'n'Play algorithm (which is used when esbuild finds a
.pnp.js,.pnp.cjs, or.pnp.data.jsonfile in the directory tree). Creating additional implementations of this algorithm recently became possible because Yarn's package manifest format was recently documented: https://yarnpkg.com/advanced/pnp-spec/. This should mean that you can now use esbuild to bundle Plug'n'Play projects without any additional configuration (so you shouldn't need@yarnpkg/esbuild-plugin-pnpanymore). Bundling these projects should now happen much faster as Yarn no longer even needs to be run at all. Bundling the Yarn codebase itself with esbuild before and after this change seems to demonstrate over a 10x speedup (3.4s to 0.24s). And path resolution rules within Yarn packages should now be consistent with how esbuild handles regular Node packages. For example, fields such asmoduleandbrowserinpackage.jsonfiles within.zipfiles should now be respected.Keep in mind that this is brand new code and there may be some initial issues to work through before esbuild's implementation is solid. Yarn's Plug'n'Play specification is also brand new and may need some follow-up edits to guide new implementations to match Yarn's exact behavior. If you try this out, make sure to test it before committing to using it, and let me know if anything isn't working as expected. Should you need to debug esbuild's path resolution, you may find
--log-level=verbosehelpful.
Changelog
Sourced from esbuild's changelog.
0.15.1
Update esbuild's Yarn Plug'n'Play implementation to match the latest specification changes (#2452, #2453)
This release updates esbuild's implementation of Yarn Plug'n'Play to match some changes to Yarn's specification that just landed. The changes are as follows:
Check for platform-specific absolute paths instead of always for the
/prefixThe specification previously said that Yarn Plug'n'Play path resolution rules should not apply for paths that start with
/. The intent was to avoid accidentally processing absolute paths. However, absolute paths on Windows such asC:\projectstart with drive letters instead of with/. So the specification was changed to instead explicitly avoid processing absolute paths.Make
$$virtualan alias for__virtual__Supporting Yarn-style path resolution requires implementing a custom Yarn-specific path traversal scheme where certain path segments are considered no-ops. Specifically any path containing segments of the form
__virtual__/<whatever>/<n>where<n>is an integer must be treated as if they werentimes the..operator instead (the<whatever>path segment is ignored). So/path/to/project/__virtual__/xyz/2/foo.jsmaps to the underlying file/path/to/project/../../foo.js. This scheme makes it possible for Yarn to get node (and esbuild) to load the same file multiple times (which is sometimes required for correctness) without actually duplicating the file on the file system.However, old versions of Yarn used to use
$$virtualinstead of__virtual__. This was changed because$$virtualwas error-prone due to the use of the$character, which can cause bugs when it's not correctly escaped within regular expressions. Now that esbuild makes$$virtualan alias for__virtual__, esbuild should now work with manifests from these old Yarn versions.Ignore PnP manifests in virtual directories
The specification describes the algorithm for how to find the Plug'n'Play manifest when starting from a certain point in the file system: search through all parent directories in reverse order until the manifest is found. However, this interacts poorly with virtual paths since it can end up finding a virtual copy of the manifest instead of the original. To avoid this, esbuild now ignores manifests in virtual directories so that the search for the manifest will continue and find the original manifest in another parent directory later on.
These fixes mean that esbuild's implementation of Plug'n'Play now matches Yarn's implementation more closely, and esbuild can now correctly build more projects that use Plug'n'Play.
0.15.0
This release contains backwards-incompatible changes. Since esbuild is before version 1.0.0, these changes have been released as a new minor version to reflect this (as recommended by npm). You should either be pinning the exact version of
esbuildin yourpackage.jsonfile or be using a version range syntax that only accepts patch upgrades such as~0.14.0. See the documentation about semver for more information.
Implement the Yarn Plug'n'Play module resolution algorithm (#154, #237, #1263, #2451)
Node comes with a package manager called npm, which installs packages into a
node_modulesfolder. Node and esbuild both come with built-in rules for resolving import paths to packages withinnode_modules, so packages installed via npm work automatically without any configuration. However, many people use an alternative package manager called Yarn. While Yarn can install packages usingnode_modules, it also offers a different package installation strategy called Plug'n'Play, which is often shortened to "PnP" (not to be confused with pnpm, which is an entirely different unrelated package manager).Plug'n'Play installs packages as
.zipfiles on your file system. The packages are never actually unzipped. Since Node doesn't know anything about Yarn's package installation strategy, this means you can no longer run your code with Node as it won't be able to find your packages. Instead, you need to run your code with Yarn, which applies patches to Node's file system APIs before running your code. These patches attempt to make zip files seem like normal directories. When running under Yarn, using Node's file system API to read./some.zip/lib/file.jsactually automatically extractslib/file.jsfrom./some.zipat run-time as if it was a normal file. Other file system APIs behave similarly. However, these patches don't work with esbuild because esbuild is not written in JavaScript; it's a native binary executable that interacts with the file system directly through the operating system.Previously the workaround for using esbuild with Plug'n'Play was to use the
@yarnpkg/esbuild-plugin-pnpplugin with esbuild's JavaScript API. However, this wasn't great because the plugin needed to potentially intercept every single import path and file load to check whether it was a Plug'n'Play package, which has an unusually high performance cost. It also meant that certain subtleties of path resolution rules within a.zipfile could differ slightly from the way esbuild normally works since path resolution inside.zipfiles was implemented by Yarn, not by esbuild (which is due to a limitation of esbuild's plugin API).With this release, esbuild now contains an independent implementation of Yarn's Plug'n'Play algorithm (which is used when esbuild finds a
.pnp.js,.pnp.cjs, or.pnp.data.jsonfile in the directory tree). Creating additional implementations of this algorithm recently became possible because Yarn's package manifest format was recently documented: https://yarnpkg.com/advanced/pnp-spec/. This should mean that you can now use esbuild to bundle Plug'n'Play projects without any additional configuration (so you shouldn't need@yarnpkg/esbuild-plugin-pnpanymore). Bundling these projects should now happen much faster as Yarn no longer even needs to be run at all. Bundling the Yarn codebase itself with esbuild before and after this change seems to demonstrate over a 10x speedup (3.4s to 0.24s). And path resolution rules within Yarn packages should now be consistent with how esbuild handles regular Node packages. For example, fields such asmoduleandbrowserinpackage.jsonfiles within.zipfiles should now be respected.Keep in mind that this is brand new code and there may be some initial issues to work through before esbuild's implementation is solid. Yarn's Plug'n'Play specification is also brand new and may need some follow-up edits to guide new implementations to match Yarn's exact behavior. If you try this out, make sure to test it before committing to using it, and let me know if anything isn't working as expected. Should you need to debug esbuild's path resolution, you may find
--log-level=verbosehelpful.
Commits
6bc6a9cpublish 0.15.1 to npma77695erelease notes57c8a78Update Yarn PnP to match the latest specification (#2453)c223771publish 0.15.0 to npma0b752eimplement the yarn pnp module resolution algorithm (#2451)c58fe49zip: fix bug with readdir and trailing slashes4f43888add simple test coverage for zip and__virtual__e870ec5implement yarn pnp__virtual__path manglinga481005add zip file support664c8a5jsx: use first element loc for logs and source map- Additional commits viewable in compare view
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 rebasewill rebase this PR -
@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it -
@dependabot mergewill merge this PR after your CI passes on it -
@dependabot squash and mergewill squash and merge this PR after your CI passes on it -
@dependabot cancel mergewill cancel a previously requested merge and block automerging -
@dependabot reopenwill reopen this PR if it is closed -
@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually -
@dependabot ignore this major versionwill 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 versionwill 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 dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)