Skip to content

Commit

Permalink
Use moduleName to overwrite polyfill provider preference
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Jan 26, 2024
1 parent efc4834 commit 812a856
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 25 deletions.
11 changes: 4 additions & 7 deletions packages/babel-plugin-transform-runtime/src/index.ts
Expand Up @@ -14,12 +14,7 @@ export interface Options {
corejs?: string | number | { version: string | number; proposals?: boolean };
helpers?: boolean;
version?: string;
moduleName?:
| null
| "@babel/runtime"
| "@babel/runtime-corejs2"
| "@babel/runtime-corejs3"
| string;
moduleName?: null | string;
}

export default declare((api, options: Options, dirname) => {
Expand Down Expand Up @@ -163,7 +158,9 @@ export default declare((api, options: Options, dirname) => {

file.set("helperGenerator", (name: string) => {
modulePath ??= getRuntimePath(
file.get("runtimeHelpersModuleName") ?? "@babel/runtime",
moduleName ??
file.get("runtimeHelpersModuleName") ??
"@babel/runtime",
dirname,
absoluteRuntime,
);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Expand Up @@ -2,7 +2,7 @@
"sourceType": "module",
"plugins": [
"transform-classes",
["transform-runtime", { "moduleName": "@babel/runtime-corejs3" }],
["transform-runtime", { "moduleName": null }],
["babel-plugin-polyfill-corejs3", { "method": "usage-pure" }]
]
}
@@ -0,0 +1 @@
class A {}
@@ -0,0 +1,8 @@
{
"sourceType": "module",
"plugins": [
"transform-classes",
["transform-runtime", { "moduleName": "lol" }],
["babel-plugin-polyfill-corejs3", { "method": "usage-pure" }]
]
}
@@ -0,0 +1,5 @@
import _createClass from "lol/helpers/createClass";
import _classCallCheck from "lol/helpers/classCallCheck";
let A = /*#__PURE__*/_createClass(function A() {
_classCallCheck(this, A);
});

0 comments on commit 812a856

Please sign in to comment.