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

Implement import defer proposal transform support #15878

Merged

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Aug 21, 2023

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This PR implements transform support for the Stage 2 Deferred Import Evaluation (import defer), for which parsing support has been implemented in #15845. It is only supported when compiling modules to CommonJS.

This PR can be reviewed commit-by-commit, and after each commit tests&linting were green:

  • [helper-module-transforms] Support customizing require&reference allows passing two functions to @babel/helper-module-transforms to customize how references to imported modules are transformed:

    • getWrapperPayload allow computing some opaque payload given some metadata representing the imported module. This payload is then both used to decide how to transform references to imported bindings, and exposed to callers of this helper package.
    • wrapReference allows wrapping the AST node referencing the imported bindings, given the payload computed by the function above.

    The implementation of lazy imports, supported when compiling ESM to CJS, has been rewritten on top of these two new customization functions and extracted to packages/babel-helper-module-transforms/src/lazy-modules.ts, rather than being mixed with the main transform logic.

  • Support hooks in commonjs plugin, and implement lazy as a hook allows other plugins to hook into the ESM->CJS transform process. "Hooks" (or "plugins for the plugin" 😅) can provide their own implementation of getWrapperPayload and wrappReference, as well as a third function:

    • buildRequireWrapper allows wrapping the require() AST node, given the payload computed by getWrapperPayload.

    The lazy option has been re-implemented on top of use this new "hooks" system, so that it's now entirely contained in @babel/plugin-transform-modules-commonjs (which is the only modules transform that supports it) rather than half there and half in @babel/helper-module-transforms. @babel/helper-module-transforms still needs its own implementation for compatibility with older @babel/plugin-transform-modules-commonjs versions, but that code is not used when using newer @babel/plugin-transform-modules-commonjs and it can be easily removed in Babel 8.

    Maybe this hooks system could also be used for transforming import source when compiling to CJS.

  • Add @babel/plugin-syntax-import-defer

  • Implement import defer proposal transform support implements import defer as a hook for @babel/plugin-transform-modules-commonjs. This uses an optimized version when possible, by mirroring the lazy implementation (i.e. put require() in a function and call it when needed to read a property from the module), falling back to a proxy-based version when the module namespace is referenced in other ways. Note that evaluation should only happen when reading the namespace's properties, and not when simply referencing it.

@nicolo-ribaudo nicolo-ribaudo added PR: New Feature 🚀 A type of pull request used for our changelog categories PR: Needs Docs labels Aug 21, 2023
@babel-bot
Copy link
Collaborator

babel-bot commented Aug 21, 2023

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/55495/

// We need the explicit type annotation otherwise when using t.assert* ts
// reports that 'Assertions require every name in the call target to be
// declared with an explicit type annotation'
const t: typeof api.types = api.types;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this plugin to the babel standalone? So that we can come up with a REPL for this PR.

metadata: SourceModuleMetadata,
importNodes: t.Node[],
) => unknown;
wrapReference?: (ref: t.Expression, payload: unknown) => t.Expression | null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can we make this interface generic? So that TS knows that the payload passed into wrapReference must conforms to type of the return of getWrapperPayload.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, payload might be unknown because it might be generated by the hook of another plugin. The best we can do is

interface T {
  wrapReference?: (ref: t.Expression, payload: T | unknown) => t.Expression | null;
}

which does not improve types (T | unknown is unknown) but it might improve autocompletion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be generated by the hook of another plugin

Good point. That seems to be similar to the PluginPass's behaviour: Any plugin can augment the PluginPass but there is no guarantee that the PluginPass must not be changed by other plugins within the same pass.

Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work.

// import "a"
// we have the correct evaluation order

const eagerImports = new Map();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be simplified to a set?

name: string;
version: string;
wrapReference?(ref: t.Expression, payload: unknown): t.CallExpression | null;
buildRequireWrapper?(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a brief note about the behaviour difference between the return value false and null?

if (lazy === true) {
// 'true' means that local relative files are eagerly loaded and
// dependency modules are loaded lazily.
return /\./.test(source) ? null : "lazy/function";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few libraries whose names contain .. We should revisit here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this should probably be .startsWith("."). I'm not editing in this PR to keep this as new-features-only.

@@ -22,6 +22,7 @@ export default (_: any, opts: any = {}) => {
babelPlugins.proposalRecordAndTuple,
{ syntaxType: recordAndTupleSyntax },
],
babelPlugins.proposalImportDefer,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should enable this plugin only when opts.modules is commonjs or cjs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These presets do not currently have a modules option, that's in preset-2015. Maybe a enableProposalImportDefer option, that we enable from the repl UI when we compile modules? 🤔

if (!referenced) return false;
return template.statement.ast`
function ${name}() {
const data = ${init};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The memoizer variable can also be injected from the function arguments.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we could do function ${name}(data = ${init}), but then compiling that down will generate bigger code because it has to check if data is undefined.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

function ${name}(data) {
  data = ${init}
  ...
}

? So we can save the uncompressable const string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function ${name}(data) {
  ${name} = () => data;
  return data = ${init};
}

:)

return template.statement.ast`
function ${name}() {
const data = ${init};
${name} = () => data;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They will be handled by the arrow function transform if enabled right? If so we can sync the changes here to other wrappers, maybe in another PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! However I prefer to avoid if possible starting emitting ES6 syntax in code that is currently generated as ES5-only, in case somebody still has a manual list of enabled plugins for the features they use.

@@ -0,0 +1,31 @@
/* @minVersion 7.22.0 */
export default function _importDeferProxy(init) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worthy of an assumption to get rid of this helper, since proxy is difficult to optimize and the helper will kick in when people are merely assigning an alias to the namespace object like const e = ns;. In this case they are not asking for any reflection support.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you expect const e = ns to trigger the evaluation of the module, under that option? Or should we track usages of e and transform them in calls that evaluate the module?

I think this helper will already be used very rarely, because most of the usages of "deferred namesapces" will just be people rewriting import { val } from "./x"; doSomethingWith(val) to import defer * as x from "./x"; doSomethingWith(x.val)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or should we track usages of e and transform them in calls that evaluate the module?

I agree with this, but it could be in a future PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you expect const e = ns to trigger the evaluation of the module, under that option?

Good question. I think it should not trigger the evaluation. If const e = ns is called after ns.something, then e is the evaluated module, otherwise the uninitialized factory.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, which means we will need to track usages of e because we will need to replace e.something with e().something.

Copy link
Member

@liuxingbaoyu liuxingbaoyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getWrapperPayload allow computing some opaque pa
yload given some metadata representing the imported module. This payload is then both used to decide how to transform references to imported bindings, and exposed to callers of this helper package.
wrapReference allows wrapping the AST node referencing the imported bindings, given the payload computed by the function above.

I really, really like this because it replaces the poor approach in my other PR with a really great design.

@nicolo-ribaudo nicolo-ribaudo removed the PR: Needs Review A pull request awaiting more approvals label Sep 18, 2023
@nicolo-ribaudo nicolo-ribaudo merged commit 35c0651 into babel:feat-7.23.0/imports Sep 18, 2023
47 of 48 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the defer-import-transform branch September 18, 2023 15:23
Woodpile37 added a commit to Woodpile37/ethers.js that referenced this pull request Oct 17, 2023
<p>This PR was automatically created by Snyk using the credentials of a
real user.</p><br /><h3>Snyk has created this PR to upgrade multiple
dependencies.</h3>
👯‍♂ The following dependencies are linked and will therefore be updated
together.
</br></br>
:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.
</br></br>

 Name         | Versions     | Released on
:-------------|:-------------|:-------------
**@babel/parser**</br>from 7.22.16 to 7.23.0 | **1 version** ahead of
your current version | **22 days ago**</br>on 2023-09-25
**@babel/types**</br>from 7.22.19 to 7.23.0 | **1 version** ahead of
your current version | **22 days ago**</br>on 2023-09-25



<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>@babel/parser</b></summary>
    <ul>
      <li>
<b>7.23.0</b> - <a
href="https://snyk.io/redirect/github/babel/babel/releases/tag/v7.23.0">2023-09-25</a></br><h2>v7.23.0
(2023-09-25)</h2>
<p>Thanks <a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/lorenzoferre/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://snyk.io/redirect/github/lorenzoferre">@ lorenzoferre</a>
and <a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/RajShukla1/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://snyk.io/redirect/github/RajShukla1">@ RajShukla1</a> for
your first PRs!</p>
<h4>🚀 New Feature</h4>
<ul>
<li><code>babel-plugin-proposal-import-wasm-source</code>,
<code>babel-plugin-syntax-import-source</code>,
<code>babel-plugin-transform-dynamic-import</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15870"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15870/hovercard">#15870</a>
Support transforming <code>import source</code> for wasm (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li><code>babel-helper-module-transforms</code>,
<code>babel-helpers</code>,
<code>babel-plugin-proposal-import-defer</code>,
<code>babel-plugin-syntax-import-defer</code>,
<code>babel-plugin-transform-modules-commonjs</code>,
<code>babel-runtime-corejs2</code>, <code>babel-runtime-corejs3</code>,
<code>babel-runtime</code>, <code>babel-standalone</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15878"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15878/hovercard">#15878</a>
Implement <code>import defer</code> proposal transform support (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li><code>babel-generator</code>, <code>babel-parser</code>,
<code>babel-types</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15845"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15845/hovercard">#15845</a>
Implement <code>import defer</code> parsing support (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15829"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15829/hovercard">#15829</a> Add
parsing support for the "source phase imports" proposal (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li><code>babel-generator</code>,
<code>babel-helper-module-transforms</code>, <code>babel-parser</code>,
<code>babel-plugin-transform-dynamic-import</code>,
<code>babel-plugin-transform-modules-amd</code>,
<code>babel-plugin-transform-modules-commonjs</code>,
<code>babel-plugin-transform-modules-systemjs</code>,
<code>babel-traverse</code>, <code>babel-types</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15682"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15682/hovercard">#15682</a> Add
<code>createImportExpressions</code> parser option (<a
href="https://snyk.io/redirect/github/JLHwung">@ JLHwung</a>)</li>
</ul>
</li>
<li><code>babel-standalone</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15671"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15671/hovercard">#15671</a> Pass
through nonce to the transformed script element (<a
href="https://snyk.io/redirect/github/JLHwung">@ JLHwung</a>)</li>
</ul>
</li>
<li><code>babel-helper-function-name</code>,
<code>babel-helper-member-expression-to-functions</code>,
<code>babel-helpers</code>, <code>babel-parser</code>,
<code>babel-plugin-proposal-destructuring-private</code>,
<code>babel-plugin-proposal-optional-chaining-assign</code>,
<code>babel-plugin-syntax-optional-chaining-assign</code>,
<code>babel-plugin-transform-destructuring</code>,
<code>babel-plugin-transform-optional-chaining</code>,
<code>babel-runtime-corejs2</code>, <code>babel-runtime-corejs3</code>,
<code>babel-runtime</code>, <code>babel-standalone</code>,
<code>babel-types</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15751"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15751/hovercard">#15751</a> Add
support for optional chain in assignments (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li><code>babel-helpers</code>,
<code>babel-plugin-proposal-decorators</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15895"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15895/hovercard">#15895</a>
Implement the "decorator metadata" proposal (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li><code>babel-traverse</code>, <code>babel-types</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15893"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15893/hovercard">#15893</a> Add
<code>t.buildUndefinedNode</code> (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
<li><code>babel-preset-typescript</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15913"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15913/hovercard">#15913</a> Add
<code>rewriteImportExtensions</code> option to TS preset (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li><code>babel-parser</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15896"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15896/hovercard">#15896</a> Allow
TS tuples to have both labeled and unlabeled elements (<a
href="https://snyk.io/redirect/github/yukukotani">@ yukukotani</a>)</li>
</ul>
</li>
</ul>
<h4>🐛 Bug Fix</h4>
<ul>
<li><code>babel-plugin-transform-block-scoping</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15962"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15962/hovercard">#15962</a> fix:
<code>transform-block-scoping</code> captures the variables of the
method in the loop (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
</ul>
<h4>💅 Polish</h4>
<ul>
<li><code>babel-traverse</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15797"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15797/hovercard">#15797</a> Expand
evaluation of global built-ins in <code>@ babel/traverse</code> (<a
href="https://snyk.io/redirect/github/lorenzoferre">@
lorenzoferre</a>)</li>
</ul>
</li>
<li><code>babel-plugin-proposal-explicit-resource-management</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15985"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15985/hovercard">#15985</a>
Improve source maps for blocks with <code>using</code> declarations (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
</ul>
<h4>🔬 Output optimization</h4>
<ul>
<li><code>babel-core</code>,
<code>babel-helper-module-transforms</code>,
<code>babel-plugin-transform-async-to-generator</code>,
<code>babel-plugin-transform-classes</code>,
<code>babel-plugin-transform-dynamic-import</code>,
<code>babel-plugin-transform-function-name</code>,
<code>babel-plugin-transform-modules-amd</code>,
<code>babel-plugin-transform-modules-commonjs</code>,
<code>babel-plugin-transform-modules-umd</code>,
<code>babel-plugin-transform-parameters</code>,
<code>babel-plugin-transform-react-constant-elements</code>,
<code>babel-plugin-transform-react-inline-elements</code>,
<code>babel-plugin-transform-runtime</code>,
<code>babel-plugin-transform-typescript</code>,
<code>babel-preset-env</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15984"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15984/hovercard">#15984</a> Inline
<code>exports.XXX =</code> update in simple variable declarations (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
</ul>
<h4>Committers: 7</h4>
<ul>
<li>Babel Bot (<a href="https://snyk.io/redirect/github/babel-bot">@
babel-bot</a>)</li>
<li>Huáng Jùnliàng (<a href="https://snyk.io/redirect/github/JLHwung">@
JLHwung</a>)</li>
<li>Lorenzo Ferretti (<a
href="https://snyk.io/redirect/github/lorenzoferre">@
lorenzoferre</a>)</li>
<li>Nicolò Ribaudo (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
<li>Raj Pawan Shukla (<a
href="https://snyk.io/redirect/github/RajShukla1">@ RajShukla1</a>)</li>
<li>Yuku Kotani (<a href="https://snyk.io/redirect/github/yukukotani">@
yukukotani</a>)</li>
<li><a href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a></li>
</ul>
      </li>
      <li>
<b>7.22.16</b> - <a
href="https://snyk.io/redirect/github/babel/babel/releases/tag/v7.22.16">2023-09-06</a></br><h2>v7.22.16
(2023-09-06)</h2>
<h4>🐛 Bug Fix</h4>
<ul>
<li><code>babel-parser</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15935"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15935/hovercard">#15935</a> fix:
<code>__esModule</code> is missing from published <code>@
babel/parser</code> (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
</ul>
<h4>🏠 Internal</h4>
<ul>
<li><code>babel-traverse</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15936"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15936/hovercard">#15936</a> Skip
deprecation warning tests when in a folder named <code>@ babel</code>
(<a href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
</ul>
<h4>Committers: 3</h4>
<ul>
<li>Huáng Jùnliàng (<a href="https://snyk.io/redirect/github/JLHwung">@
JLHwung</a>)</li>
<li>Nicolò Ribaudo (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
<li><a href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a></li>
</ul>
      </li>
    </ul>
from <a
href="https://snyk.io/redirect/github/babel/babel/releases">@babel/parser
GitHub release notes</a>
  </details>
  <details>
    <summary>Package name: <b>@babel/types</b></summary>
    <ul>
      <li>
<b>7.23.0</b> - <a
href="https://snyk.io/redirect/github/babel/babel/releases/tag/v7.23.0">2023-09-25</a></br><h2>v7.23.0
(2023-09-25)</h2>
<p>Thanks <a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/lorenzoferre/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://snyk.io/redirect/github/lorenzoferre">@ lorenzoferre</a>
and <a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/RajShukla1/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://snyk.io/redirect/github/RajShukla1">@ RajShukla1</a> for
your first PRs!</p>
<h4>🚀 New Feature</h4>
<ul>
<li><code>babel-plugin-proposal-import-wasm-source</code>,
<code>babel-plugin-syntax-import-source</code>,
<code>babel-plugin-transform-dynamic-import</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15870"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15870/hovercard">#15870</a>
Support transforming <code>import source</code> for wasm (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li><code>babel-helper-module-transforms</code>,
<code>babel-helpers</code>,
<code>babel-plugin-proposal-import-defer</code>,
<code>babel-plugin-syntax-import-defer</code>,
<code>babel-plugin-transform-modules-commonjs</code>,
<code>babel-runtime-corejs2</code>, <code>babel-runtime-corejs3</code>,
<code>babel-runtime</code>, <code>babel-standalone</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15878"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15878/hovercard">#15878</a>
Implement <code>import defer</code> proposal transform support (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li><code>babel-generator</code>, <code>babel-parser</code>,
<code>babel-types</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15845"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15845/hovercard">#15845</a>
Implement <code>import defer</code> parsing support (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15829"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15829/hovercard">#15829</a> Add
parsing support for the "source phase imports" proposal (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li><code>babel-generator</code>,
<code>babel-helper-module-transforms</code>, <code>babel-parser</code>,
<code>babel-plugin-transform-dynamic-import</code>,
<code>babel-plugin-transform-modules-amd</code>,
<code>babel-plugin-transform-modules-commonjs</code>,
<code>babel-plugin-transform-modules-systemjs</code>,
<code>babel-traverse</code>, <code>babel-types</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15682"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15682/hovercard">#15682</a> Add
<code>createImportExpressions</code> parser option (<a
href="https://snyk.io/redirect/github/JLHwung">@ JLHwung</a>)</li>
</ul>
</li>
<li><code>babel-standalone</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15671"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15671/hovercard">#15671</a> Pass
through nonce to the transformed script element (<a
href="https://snyk.io/redirect/github/JLHwung">@ JLHwung</a>)</li>
</ul>
</li>
<li><code>babel-helper-function-name</code>,
<code>babel-helper-member-expression-to-functions</code>,
<code>babel-helpers</code>, <code>babel-parser</code>,
<code>babel-plugin-proposal-destructuring-private</code>,
<code>babel-plugin-proposal-optional-chaining-assign</code>,
<code>babel-plugin-syntax-optional-chaining-assign</code>,
<code>babel-plugin-transform-destructuring</code>,
<code>babel-plugin-transform-optional-chaining</code>,
<code>babel-runtime-corejs2</code>, <code>babel-runtime-corejs3</code>,
<code>babel-runtime</code>, <code>babel-standalone</code>,
<code>babel-types</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15751"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15751/hovercard">#15751</a> Add
support for optional chain in assignments (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li><code>babel-helpers</code>,
<code>babel-plugin-proposal-decorators</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15895"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15895/hovercard">#15895</a>
Implement the "decorator metadata" proposal (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li><code>babel-traverse</code>, <code>babel-types</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15893"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15893/hovercard">#15893</a> Add
<code>t.buildUndefinedNode</code> (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
<li><code>babel-preset-typescript</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15913"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15913/hovercard">#15913</a> Add
<code>rewriteImportExtensions</code> option to TS preset (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li><code>babel-parser</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15896"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15896/hovercard">#15896</a> Allow
TS tuples to have both labeled and unlabeled elements (<a
href="https://snyk.io/redirect/github/yukukotani">@ yukukotani</a>)</li>
</ul>
</li>
</ul>
<h4>🐛 Bug Fix</h4>
<ul>
<li><code>babel-plugin-transform-block-scoping</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15962"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15962/hovercard">#15962</a> fix:
<code>transform-block-scoping</code> captures the variables of the
method in the loop (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
</ul>
<h4>💅 Polish</h4>
<ul>
<li><code>babel-traverse</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15797"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15797/hovercard">#15797</a> Expand
evaluation of global built-ins in <code>@ babel/traverse</code> (<a
href="https://snyk.io/redirect/github/lorenzoferre">@
lorenzoferre</a>)</li>
</ul>
</li>
<li><code>babel-plugin-proposal-explicit-resource-management</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15985"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15985/hovercard">#15985</a>
Improve source maps for blocks with <code>using</code> declarations (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
</ul>
<h4>🔬 Output optimization</h4>
<ul>
<li><code>babel-core</code>,
<code>babel-helper-module-transforms</code>,
<code>babel-plugin-transform-async-to-generator</code>,
<code>babel-plugin-transform-classes</code>,
<code>babel-plugin-transform-dynamic-import</code>,
<code>babel-plugin-transform-function-name</code>,
<code>babel-plugin-transform-modules-amd</code>,
<code>babel-plugin-transform-modules-commonjs</code>,
<code>babel-plugin-transform-modules-umd</code>,
<code>babel-plugin-transform-parameters</code>,
<code>babel-plugin-transform-react-constant-elements</code>,
<code>babel-plugin-transform-react-inline-elements</code>,
<code>babel-plugin-transform-runtime</code>,
<code>babel-plugin-transform-typescript</code>,
<code>babel-preset-env</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15984"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15984/hovercard">#15984</a> Inline
<code>exports.XXX =</code> update in simple variable declarations (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
</ul>
<h4>Committers: 7</h4>
<ul>
<li>Babel Bot (<a href="https://snyk.io/redirect/github/babel-bot">@
babel-bot</a>)</li>
<li>Huáng Jùnliàng (<a href="https://snyk.io/redirect/github/JLHwung">@
JLHwung</a>)</li>
<li>Lorenzo Ferretti (<a
href="https://snyk.io/redirect/github/lorenzoferre">@
lorenzoferre</a>)</li>
<li>Nicolò Ribaudo (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
<li>Raj Pawan Shukla (<a
href="https://snyk.io/redirect/github/RajShukla1">@ RajShukla1</a>)</li>
<li>Yuku Kotani (<a href="https://snyk.io/redirect/github/yukukotani">@
yukukotani</a>)</li>
<li><a href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a></li>
</ul>
      </li>
      <li>
<b>7.22.19</b> - <a
href="https://snyk.io/redirect/github/babel/babel/releases/tag/v7.22.19">2023-09-14</a></br><h2>v7.22.19
(2023-09-14)</h2>
<p>Re-published 7.22.18, due to a releasing error.</p>
      </li>
    </ul>
from <a
href="https://snyk.io/redirect/github/babel/babel/releases">@babel/types
GitHub release notes</a>
  </details>
</details>
<hr/>

**Note:** *You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs.*

For more information: <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiJkYTdkYzgwNS0xMDczLTQxMWEtYWM1OC1mYTZjMTcyNTJjNzgiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6ImRhN2RjODA1LTEwNzMtNDExYS1hYzU4LWZhNmMxNzI1MmM3OCJ9fQ=="
width="0" height="0"/>

🧐 [View latest project
report](https://app.snyk.io/org/woodpile37/project/e5e31077-489f-44c1-b24d-4af9a1a8d603?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)

🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/woodpile37/project/e5e31077-489f-44c1-b24d-4af9a1a8d603/settings/integration?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)

🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/woodpile37/project/e5e31077-489f-44c1-b24d-4af9a1a8d603/settings/integration?pkg&#x3D;@babel/parser&amp;pkg&#x3D;@babel/types&amp;utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

<!---
(snyk:metadata:{"prId":"da7dc805-1073-411a-ac58-fa6c17252c78","prPublicId":"da7dc805-1073-411a-ac58-fa6c17252c78","dependencies":[{"name":"@babel/parser","from":"7.22.16","to":"7.23.0"},{"name":"@babel/types","from":"7.22.19","to":"7.23.0"}],"packageManager":"npm","type":"auto","projectUrl":"https://app.snyk.io/org/woodpile37/project/e5e31077-489f-44c1-b24d-4af9a1a8d603?utm_source=github&utm_medium=referral&page=upgrade-pr","projectPublicId":"e5e31077-489f-44c1-b24d-4af9a1a8d603","env":"prod","prType":"upgrade","vulns":[],"issuesToFix":[],"upgrade":[],"upgradeInfo":{"versionsDiff":1,"publishedDate":"2023-09-25T08:10:31.822Z"},"templateVariants":[],"hasFixes":false,"isMajorUpgrade":false,"isBreakingChange":false,"priorityScoreList":[]})
--->
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 19, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Needs Docs PR: New Feature 🚀 A type of pull request used for our changelog categories Spec: Deferred Module Evaluation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants