summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/examples/sourcemapped/builds/webpack4-babel7/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/debugger/test/mochitest/examples/sourcemapped/builds/webpack4-babel7/index.js')
-rw-r--r--devtools/client/debugger/test/mochitest/examples/sourcemapped/builds/webpack4-babel7/index.js82
1 files changed, 82 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/examples/sourcemapped/builds/webpack4-babel7/index.js b/devtools/client/debugger/test/mochitest/examples/sourcemapped/builds/webpack4-babel7/index.js
new file mode 100644
index 0000000000..dd5eade1eb
--- /dev/null
+++ b/devtools/client/debugger/test/mochitest/examples/sourcemapped/builds/webpack4-babel7/index.js
@@ -0,0 +1,82 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
+
+const path = require("path");
+const util = require("util");
+const _ = require("lodash");
+const webpack = require("webpack");
+
+const TARGET_NAME = "webpack4-babel7";
+
+module.exports = exports = async function(tests, dirname) {
+ const fixtures = [];
+ for (const [name, input] of tests) {
+ if (/typescript-/.test(name)) {
+ continue;
+ }
+
+ const testFnName = _.camelCase(`${TARGET_NAME}-${name}`);
+ const evalMaps = name.match(/-eval/);
+ const babelEnv = !name.match(/-es6/);
+ const babelModules = name.match(/-cjs/);
+
+ console.log(`Building ${TARGET_NAME} test ${name}`);
+
+ const scriptPath = path.join(dirname, "output", TARGET_NAME, `${name}.js`);
+ const result = await util.promisify(webpack)({
+ mode: "development",
+ context: path.dirname(input),
+ entry: `./${path.basename(input)}`,
+ output: {
+ path: path.dirname(scriptPath),
+ filename: path.basename(scriptPath),
+
+ devtoolModuleFilenameTemplate: `${TARGET_NAME}://./${name}/[resource-path]`,
+
+ libraryTarget: "var",
+ library: testFnName,
+ libraryExport: "default"
+ },
+ devtool: evalMaps ? "eval-source-map" : "source-map",
+ module: {
+ rules: [
+ {
+ test: /\.js$/,
+ exclude: /node_modules/,
+ loader: require.resolve("babel-loader"),
+ options: {
+ babelrc: false,
+ plugins: [
+ require.resolve("@babel/plugin-proposal-class-properties")
+ ],
+ presets: [
+ require.resolve("@babel/preset-flow"),
+ babelEnv
+ ? [
+ require.resolve("@babel/preset-env"),
+ { modules: babelModules ? "commonjs" : false }
+ ]
+ : null
+ ].filter(Boolean)
+ }
+ }
+ ].filter(Boolean)
+ }
+ });
+
+ fixtures.push({
+ name,
+ testFnName: testFnName,
+ scriptPath,
+ assets: [scriptPath, evalMaps ? null : `${scriptPath}.map`].filter(
+ Boolean
+ )
+ });
+ }
+
+ return {
+ target: TARGET_NAME,
+ fixtures
+ };
+};