Skip to content

Commit cbbf040

Browse files
committed
Bug 1878783 - Retire babel-jsm-to-commonjs since browser JSMs are gone now. r=Standard8,omc-reviewers,emcminn
Differential Revision: https://phabricator.services.mozilla.com/D201828
1 parent de02dc5 commit cbbf040

File tree

5 files changed

+5
-444
lines changed

5 files changed

+5
-444
lines changed

browser/components/aboutwelcome/karma.mc.config.js

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ module.exports = function (config) {
186186
},
187187
plugins: [
188188
// The ResourceUriPlugin handles translating resource URIs in import
189-
// statements in .mjs files, in a similar way to what
190-
// babel-jsm-to-commonjs does for jsm files.
189+
// statements in .mjs files to paths on the filesystem.
191190
new ResourceUriPlugin({
192191
resourcePathRegExes: [
193192
[
@@ -213,35 +212,6 @@ module.exports = function (config) {
213212
},
214213
module: {
215214
rules: [
216-
// This rule rewrites importing/exporting in .jsm files to be compatible with esmodules
217-
{
218-
test: /\.jsm$/,
219-
exclude: [/node_modules/],
220-
use: [
221-
{
222-
loader: "babel-loader", // require("babel-core")
223-
options: {
224-
plugins: [
225-
// Converts .jsm files into common-js modules
226-
[
227-
"../newtab/tools/babel-jsm-to-commonjs.js",
228-
{
229-
basePaths: [
230-
[PATHS.resourcePathRegEx, ""],
231-
[
232-
/^resource:\/\/\/modules\/asrouter\//,
233-
"asrouter/modules/",
234-
],
235-
],
236-
removeOtherImports: true,
237-
replace: true,
238-
},
239-
],
240-
],
241-
},
242-
},
243-
],
244-
},
245215
{
246216
test: /\.js$/,
247217
exclude: [/node_modules\/(?!@fluent\/).*/, /tests/],

browser/components/asrouter/karma.mc.config.js

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ module.exports = function (config) {
146146
},
147147
plugins: [
148148
// The ResourceUriPlugin handles translating resource URIs in import
149-
// statements in .mjs files, in a similar way to what
150-
// babel-jsm-to-commonjs does for jsm files.
149+
// statements in .mjs files to paths on the filesystem.
151150
new ResourceUriPlugin({
152151
resourcePathRegExes: [
153152
[
@@ -173,35 +172,6 @@ module.exports = function (config) {
173172
},
174173
module: {
175174
rules: [
176-
// This rule rewrites importing/exporting in .jsm files to be compatible with esmodules
177-
{
178-
test: /\.jsm$/,
179-
exclude: [/node_modules/],
180-
use: [
181-
{
182-
loader: "babel-loader", // require("babel-core")
183-
options: {
184-
plugins: [
185-
// Converts .jsm files into common-js modules
186-
[
187-
"../newtab/tools/babel-jsm-to-commonjs.js",
188-
{
189-
basePaths: [
190-
// We still need to do this rewriting, as there are
191-
// still modules being loaded from
192-
// resource://activity-stream. See bug 1877199.
193-
[PATHS.resourcePathRegEx, ""],
194-
[new RegExp("^resource:///modules/asrouter/"), "./"],
195-
],
196-
removeOtherImports: true,
197-
replace: true,
198-
},
199-
],
200-
],
201-
},
202-
},
203-
],
204-
},
205175
{
206176
test: /\.js$/,
207177
exclude: [/node_modules\/(?!@fluent\/).*/, /tests/],

browser/components/newtab/karma.mc.config.js

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,6 @@ module.exports = function (config) {
158158
functions: 0,
159159
branches: 0,
160160
},
161-
"lib/*.jsm": {
162-
statements: 100,
163-
lines: 100,
164-
functions: 99,
165-
branches: 84,
166-
},
167161
"content-src/components/DiscoveryStreamComponents/**/*.jsx": {
168162
statements: 90.48,
169163
lines: 90.48,
@@ -221,7 +215,7 @@ module.exports = function (config) {
221215
},
222216
// This resolve config allows us to import with paths relative to the root directory, e.g. "lib/ActivityStream.sys.mjs"
223217
resolve: {
224-
extensions: [".js", ".jsx", ".jsm"],
218+
extensions: [".js", ".jsx"],
225219
modules: [PATHS.moduleResolveDirectory, "node_modules"],
226220
fallback: {
227221
stream: require.resolve("stream-browserify"),
@@ -233,8 +227,7 @@ module.exports = function (config) {
233227
},
234228
plugins: [
235229
// The ResourceUriPlugin handles translating resource URIs in import
236-
// statements in .mjs files, in a similar way to what
237-
// babel-jsm-to-commonjs does for jsm files.
230+
// statements in .mjs files to paths on the filesystem.
238231
new ResourceUriPlugin({
239232
resourcePathRegExes: [
240233
[
@@ -256,29 +249,6 @@ module.exports = function (config) {
256249
},
257250
module: {
258251
rules: [
259-
// This rule rewrites importing/exporting in .jsm files to be compatible with esmodules
260-
{
261-
test: /\.jsm$/,
262-
exclude: [/node_modules/],
263-
use: [
264-
{
265-
loader: "babel-loader", // require("babel-core")
266-
options: {
267-
plugins: [
268-
// Converts .jsm files into common-js modules
269-
[
270-
"./tools/babel-jsm-to-commonjs.js",
271-
{
272-
basePaths: [[PATHS.resourcePathRegEx, ""]],
273-
removeOtherImports: true,
274-
replace: true,
275-
},
276-
],
277-
],
278-
},
279-
},
280-
],
281-
},
282252
{
283253
test: /\.js$/,
284254
exclude: [/node_modules\/(?!@fluent\/).*/, /test/],

0 commit comments

Comments
 (0)