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
Do not add .js
extension to injected helper imports when module transform presents
#10833
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c490848
chore: rename module-helpers by module-helpers-commonjs
JLHwung cc96e06
chore: add new module-helpers testcase
JLHwung 075af9f
chore: add more modules-helpers testcase
JLHwung 0724a2c
fix: assign module transforms context in umd transform
JLHwung ec0188f
fix: remove .js file extension when module transforms present
JLHwung 0b0c4ba
chore: update testcase
JLHwung File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...-plugin-transform-modules-commonjs/test/fixtures/interop-loose/imports-hoisting/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
.../babel-plugin-transform-modules-commonjs/test/fixtures/interop-loose/multi-load/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
"use strict"; | ||
|
||
var _interopRequireDefault3 = require("@babel/runtime/helpers/interopRequireDefault.js"); | ||
var _interopRequireDefault3 = require("@babel/runtime/helpers/interopRequireDefault"); | ||
|
||
exports.__esModule = true; | ||
|
||
var _interopRequireDefault2 = _interopRequireDefault3(require("@babel/runtime/helpers/interopRequireDefault.js")); | ||
var _interopRequireDefault2 = _interopRequireDefault3(require("@babel/runtime/helpers/interopRequireDefault")); | ||
|
||
console.log(_interopRequireDefault2.default); |
4 changes: 2 additions & 2 deletions
4
.../babel-plugin-transform-modules-commonjs/test/fixtures/interop/imports-hoisting/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/babel-plugin-transform-modules-commonjs/test/fixtures/interop/multi-load/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
"use strict"; | ||
|
||
var _interopRequireDefault3 = require("@babel/runtime/helpers/interopRequireDefault.js"); | ||
var _interopRequireDefault3 = require("@babel/runtime/helpers/interopRequireDefault"); | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _interopRequireDefault2 = _interopRequireDefault3(require("@babel/runtime/helpers/interopRequireDefault.js")); | ||
var _interopRequireDefault2 = _interopRequireDefault3(require("@babel/runtime/helpers/interopRequireDefault")); | ||
|
||
console.log(_interopRequireDefault2.default); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/babel-plugin-transform-regenerator/test/fixtures/regression/T7041/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...es/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/modules-helpers/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/modules/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...es/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-helpers/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...ages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-loose/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers-amd/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import foo from "foo"; | ||
|
||
class Example { | ||
method() {} | ||
} |
7 changes: 7 additions & 0 deletions
7
...ges/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers-amd/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"transform-runtime", | ||
"transform-modules-amd", | ||
"transform-classes" | ||
] | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers-amd/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
define(["@babel/runtime/helpers/classCallCheck", "@babel/runtime/helpers/createClass", "foo"], function (_classCallCheck2, _createClass2, _foo) { | ||
"use strict"; | ||
|
||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
|
||
_classCallCheck2 = _interopRequireDefault(_classCallCheck2); | ||
_createClass2 = _interopRequireDefault(_createClass2); | ||
_foo = _interopRequireDefault(_foo); | ||
|
||
let Example = | ||
/*#__PURE__*/ | ||
function () { | ||
function Example() { | ||
(0, _classCallCheck2.default)(this, Example); | ||
} | ||
|
||
(0, _createClass2.default)(Example, [{ | ||
key: "method", | ||
value: function method() {} | ||
}]); | ||
return Example; | ||
}(); | ||
}); |
5 changes: 5 additions & 0 deletions
5
...s/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers-commonjs/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import foo from "foo"; | ||
|
||
class Example { | ||
method() {} | ||
} |
7 changes: 7 additions & 0 deletions
7
...abel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers-commonjs/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"transform-runtime", | ||
"transform-modules-commonjs", | ||
"transform-classes" | ||
] | ||
} |
6 changes: 3 additions & 3 deletions
6
...ixtures/runtime/modules-helpers/output.js → ...untime/modules-helpers-commonjs/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...s/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers-systemjs/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import foo from "foo"; | ||
|
||
class Example { | ||
method() {} | ||
} |
7 changes: 7 additions & 0 deletions
7
...abel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers-systemjs/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"transform-runtime", | ||
"transform-modules-amd", | ||
"transform-classes" | ||
] | ||
} |
23 changes: 23 additions & 0 deletions
23
...s/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers-systemjs/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
define(["@babel/runtime/helpers/classCallCheck", "@babel/runtime/helpers/createClass", "foo"], function (_classCallCheck2, _createClass2, _foo) { | ||
"use strict"; | ||
|
||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
|
||
_classCallCheck2 = _interopRequireDefault(_classCallCheck2); | ||
_createClass2 = _interopRequireDefault(_createClass2); | ||
_foo = _interopRequireDefault(_foo); | ||
|
||
let Example = | ||
/*#__PURE__*/ | ||
function () { | ||
function Example() { | ||
(0, _classCallCheck2.default)(this, Example); | ||
} | ||
|
||
(0, _createClass2.default)(Example, [{ | ||
key: "method", | ||
value: function method() {} | ||
}]); | ||
return Example; | ||
}(); | ||
}); |
5 changes: 5 additions & 0 deletions
5
packages/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers-umd/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import foo from "foo"; | ||
|
||
class Example { | ||
method() {} | ||
} |
7 changes: 7 additions & 0 deletions
7
...ges/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers-umd/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"transform-runtime", | ||
"transform-modules-umd", | ||
"transform-classes" | ||
] | ||
} |
35 changes: 35 additions & 0 deletions
35
packages/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers-umd/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(["@babel/runtime/helpers/classCallCheck", "@babel/runtime/helpers/createClass", "foo"], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(require("@babel/runtime/helpers/classCallCheck"), require("@babel/runtime/helpers/createClass"), require("foo")); | ||
} else { | ||
var mod = { | ||
exports: {} | ||
}; | ||
factory(global.classCallCheck, global.createClass, global.foo); | ||
global.input = mod.exports; | ||
} | ||
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_classCallCheck2, _createClass2, _foo) { | ||
"use strict"; | ||
|
||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
|
||
_classCallCheck2 = _interopRequireDefault(_classCallCheck2); | ||
_createClass2 = _interopRequireDefault(_createClass2); | ||
_foo = _interopRequireDefault(_foo); | ||
|
||
let Example = | ||
/*#__PURE__*/ | ||
function () { | ||
function Example() { | ||
(0, _classCallCheck2.default)(this, Example); | ||
} | ||
|
||
(0, _createClass2.default)(Example, [{ | ||
key: "method", | ||
value: function method() {} | ||
}]); | ||
return Example; | ||
}(); | ||
}); |
3 changes: 2 additions & 1 deletion
3
packages/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import foo from "foo"; | ||
|
||
class Example { | ||
method() {} | ||
property | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I rewrite this test case since it looks more practical that an ESM supported environment does not support class-properties and so we need to transform. |
||
} | ||
|
3 changes: 1 addition & 2 deletions
3
packages/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"plugins": [ | ||
"transform-runtime", | ||
"transform-modules-commonjs", | ||
"transform-classes" | ||
"proposal-class-properties" | ||
] | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/babel-plugin-transform-runtime/test/fixtures/runtime/modules-helpers/output.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty.js"; | ||
import foo from "foo"; | ||
|
||
class Example { | ||
constructor() { | ||
_defineProperty(this, "property", void 0); | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
packages/babel-plugin-transform-runtime/test/fixtures/runtime/modules/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically only
amd
andumd
are affected by this issue since by default RequireJS does not support resolvingfoo.js => foo.js
as-is out of the box. You may configure to support this but we did cause breaking changes to these users.Both CommonJS and SystemJS support
foo.js => foo.js
, but at the same time they also supportfoo => foo.js
. Hence I remove.js
for the sake of briefness. C.f. #10549 (review)