extension-develop 2.0.0-rc.24 → 2.0.0-rc.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/add-hmr-accept-code.js +60 -15
- package/dist/deprecated-shadow-root.js +62 -18
- package/dist/ensure-hmr-for-scripts.js +71 -28
- package/dist/inject-chromium-client-loader.js +50 -17
- package/dist/inject-firefox-client-loader.js +64 -21
- package/dist/minimum-chromium-file.js +5 -0
- package/dist/minimum-content-file.js +5 -0
- package/dist/minimum-firefox-file.js +5 -0
- package/dist/minimum-script-file.js +5 -0
- package/dist/module.js +660 -750
- package/package.json +3 -3
- package/dist/958.js +0 -157742
- package/dist/958.js.LICENSE.txt +0 -14
- package/dist/dirname.d.ts +0 -1
package/dist/module.js
CHANGED
|
@@ -1,182 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import * as __WEBPACK_EXTERNAL_MODULE_inspector__ from "inspector";
|
|
4
|
-
import * as __WEBPACK_EXTERNAL_MODULE_module__ from "module";
|
|
5
|
-
import * as __WEBPACK_EXTERNAL_MODULE_os__ from "os";
|
|
6
|
-
import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
|
|
7
|
-
import * as __WEBPACK_EXTERNAL_MODULE_perf_hooks__ from "perf_hooks";
|
|
8
|
-
import * as __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__ from "@rspack/core";
|
|
9
|
-
import * as __WEBPACK_EXTERNAL_MODULE_webpack_merge_5ac3d232__ from "webpack-merge";
|
|
10
|
-
import * as __WEBPACK_EXTERNAL_MODULE_url__ from "url";
|
|
11
|
-
import * as __WEBPACK_EXTERNAL_MODULE_case_sensitive_paths_webpack_plugin_818c3218__ from "case-sensitive-paths-webpack-plugin";
|
|
12
|
-
import * as __WEBPACK_EXTERNAL_MODULE_dotenv__ from "dotenv";
|
|
13
|
-
import * as __WEBPACK_EXTERNAL_MODULE_chalk__ from "chalk";
|
|
14
|
-
import * as __WEBPACK_EXTERNAL_MODULE_console__ from "console";
|
|
15
|
-
import * as __WEBPACK_EXTERNAL_MODULE_child_process__ from "child_process";
|
|
16
|
-
import * as __WEBPACK_EXTERNAL_MODULE_package_manager_detector_0998337c__ from "package-manager-detector";
|
|
17
|
-
import * as __WEBPACK_EXTERNAL_MODULE__rspack_plugin_preact_refresh_705605a1__ from "@rspack/plugin-preact-refresh";
|
|
18
|
-
import * as __WEBPACK_EXTERNAL_MODULE__rspack_plugin_react_refresh_db0cf031__ from "@rspack/plugin-react-refresh";
|
|
19
|
-
import * as __WEBPACK_EXTERNAL_MODULE_vue_loader_a33e643c__ from "vue-loader";
|
|
20
|
-
import * as __WEBPACK_EXTERNAL_MODULE_parse5_utils_87ce236c__ from "parse5-utils";
|
|
21
|
-
import * as __WEBPACK_EXTERNAL_MODULE_chokidar__ from "chokidar";
|
|
22
|
-
import * as __WEBPACK_EXTERNAL_MODULE_ws__ from "ws";
|
|
23
|
-
import "http";
|
|
24
|
-
import * as __WEBPACK_EXTERNAL_MODULE_https__ from "https";
|
|
25
|
-
import * as __WEBPACK_EXTERNAL_MODULE_content_security_policy_parser_0ddc8c69__ from "content-security-policy-parser";
|
|
26
|
-
import * as __WEBPACK_EXTERNAL_MODULE_webpack_target_webextension_fbb2e522__ from "webpack-target-webextension";
|
|
27
|
-
import * as __WEBPACK_EXTERNAL_MODULE_chrome_location2_921ca1b0__ from "chrome-location2";
|
|
28
|
-
import * as __WEBPACK_EXTERNAL_MODULE_edge_location_84404042__ from "edge-location";
|
|
29
|
-
import * as __WEBPACK_EXTERNAL_MODULE_progress__ from "progress";
|
|
30
|
-
import * as __WEBPACK_EXTERNAL_MODULE_firefox_location2_9c16104e__ from "firefox-location2";
|
|
31
|
-
import * as __WEBPACK_EXTERNAL_MODULE_firefox_profile_8008e64c__ from "firefox-profile";
|
|
32
|
-
import * as __WEBPACK_EXTERNAL_MODULE_net__ from "net";
|
|
33
|
-
import * as __WEBPACK_EXTERNAL_MODULE_events__ from "events";
|
|
34
|
-
import * as __WEBPACK_EXTERNAL_MODULE_go_git_it_78aeb103__ from "go-git-it";
|
|
35
|
-
import * as __WEBPACK_EXTERNAL_MODULE_axios__ from "axios";
|
|
36
|
-
import * as __WEBPACK_EXTERNAL_MODULE_stream__ from "stream";
|
|
37
|
-
import * as __WEBPACK_EXTERNAL_MODULE_adm_zip_c10c59bb__ from "adm-zip";
|
|
38
|
-
import * as __WEBPACK_EXTERNAL_MODULE_util__ from "util";
|
|
39
|
-
import * as __WEBPACK_EXTERNAL_MODULE_ignore__ from "ignore";
|
|
40
|
-
import * as __WEBPACK_EXTERNAL_MODULE_tiny_glob_bbee67ed__ from "tiny-glob";
|
|
41
|
-
import * as __WEBPACK_EXTERNAL_MODULE_slugify__ from "slugify";
|
|
42
|
-
import * as __WEBPACK_EXTERNAL_MODULE_cross_spawn_96b24ecb__ from "cross-spawn";
|
|
43
|
-
import * as __WEBPACK_EXTERNAL_MODULE__rspack_dev_server_b8cae7f2__ from "@rspack/dev-server";
|
|
44
|
-
import * as __WEBPACK_EXTERNAL_MODULE_fs_promises_400951f8__ from "fs/promises";
|
|
45
|
-
var __webpack_modules__ = {
|
|
46
|
-
crypto: function(module) {
|
|
47
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_crypto__;
|
|
48
|
-
},
|
|
49
|
-
fs: function(module) {
|
|
50
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_fs__;
|
|
51
|
-
},
|
|
52
|
-
inspector: function(module) {
|
|
53
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_inspector__;
|
|
54
|
-
},
|
|
55
|
-
module: function(module) {
|
|
56
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_module__;
|
|
57
|
-
},
|
|
58
|
-
os: function(module) {
|
|
59
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_os__;
|
|
60
|
-
},
|
|
61
|
-
path: function(module) {
|
|
62
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_path__;
|
|
63
|
-
},
|
|
64
|
-
perf_hooks: function(module) {
|
|
65
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_perf_hooks__;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
var __webpack_module_cache__ = {};
|
|
69
|
-
function __webpack_require__(moduleId) {
|
|
70
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
71
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
72
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
73
|
-
exports: {}
|
|
74
|
-
};
|
|
75
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
76
|
-
return module.exports;
|
|
77
|
-
}
|
|
78
|
-
__webpack_require__.m = __webpack_modules__;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
79
3
|
(()=>{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (8 & mode) return value;
|
|
85
|
-
if ('object' == typeof value && value) {
|
|
86
|
-
if (4 & mode && value.__esModule) return value;
|
|
87
|
-
if (16 & mode && 'function' == typeof value.then) return value;
|
|
88
|
-
}
|
|
89
|
-
var ns = Object.create(null);
|
|
90
|
-
__webpack_require__.r(ns);
|
|
91
|
-
var def = {};
|
|
92
|
-
leafPrototypes = leafPrototypes || [
|
|
93
|
-
null,
|
|
94
|
-
getProto({}),
|
|
95
|
-
getProto([]),
|
|
96
|
-
getProto(getProto)
|
|
97
|
-
];
|
|
98
|
-
for(var current = 2 & mode && value; 'object' == typeof current && !~leafPrototypes.indexOf(current); current = getProto(current))Object.getOwnPropertyNames(current).forEach((key)=>{
|
|
99
|
-
def[key] = ()=>value[key];
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
100
8
|
});
|
|
101
|
-
|
|
102
|
-
__webpack_require__.d(ns, def);
|
|
103
|
-
return ns;
|
|
9
|
+
return getter;
|
|
104
10
|
};
|
|
105
11
|
})();
|
|
106
12
|
(()=>{
|
|
107
|
-
__webpack_require__.d = (
|
|
108
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
109
15
|
enumerable: true,
|
|
110
16
|
get: definition[key]
|
|
111
17
|
});
|
|
112
18
|
};
|
|
113
19
|
})();
|
|
114
|
-
(()=>{
|
|
115
|
-
__webpack_require__.f = {};
|
|
116
|
-
__webpack_require__.e = (chunkId)=>Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key)=>{
|
|
117
|
-
__webpack_require__.f[key](chunkId, promises);
|
|
118
|
-
return promises;
|
|
119
|
-
}, []));
|
|
120
|
-
})();
|
|
121
|
-
(()=>{
|
|
122
|
-
__webpack_require__.u = (chunkId)=>"" + chunkId + ".js";
|
|
123
|
-
})();
|
|
124
20
|
(()=>{
|
|
125
21
|
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
126
22
|
})();
|
|
127
23
|
(()=>{
|
|
128
|
-
__webpack_require__.r = (
|
|
129
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
130
26
|
value: 'Module'
|
|
131
27
|
});
|
|
132
|
-
Object.defineProperty(
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
133
29
|
value: true
|
|
134
30
|
});
|
|
135
31
|
};
|
|
136
32
|
})();
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
};
|
|
154
|
-
__webpack_require__.f.j = function(chunkId, promises) {
|
|
155
|
-
var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : void 0;
|
|
156
|
-
if (0 !== installedChunkData) if (installedChunkData) promises.push(installedChunkData[1]);
|
|
157
|
-
else {
|
|
158
|
-
var promise = import("./" + __webpack_require__.u(chunkId)).then(installChunk, (e)=>{
|
|
159
|
-
if (0 !== installedChunks[chunkId]) installedChunks[chunkId] = void 0;
|
|
160
|
-
throw e;
|
|
161
|
-
});
|
|
162
|
-
var promise = Promise.race([
|
|
163
|
-
promise,
|
|
164
|
-
new Promise((resolve)=>{
|
|
165
|
-
installedChunkData = installedChunks[chunkId] = [
|
|
166
|
-
resolve
|
|
167
|
-
];
|
|
168
|
-
})
|
|
169
|
-
]);
|
|
170
|
-
promises.push(installedChunkData[1] = promise);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
})();
|
|
174
|
-
var external_fs_ = __webpack_require__("fs");
|
|
175
|
-
var external_path_ = __webpack_require__("path");
|
|
176
|
-
function getDirname(importMetaUrl) {
|
|
177
|
-
const __filename = (0, __WEBPACK_EXTERNAL_MODULE_url__.fileURLToPath)(importMetaUrl);
|
|
178
|
-
return external_path_.dirname(__filename);
|
|
179
|
-
}
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
extensionBuild: ()=>extensionBuild,
|
|
37
|
+
extensionDev: ()=>extensionDev,
|
|
38
|
+
extensionPreview: ()=>extensionPreview,
|
|
39
|
+
extensionStart: ()=>extensionStart
|
|
40
|
+
});
|
|
41
|
+
const external_fs_namespaceObject = require("fs");
|
|
42
|
+
const external_path_namespaceObject = require("path");
|
|
43
|
+
const core_namespaceObject = require("@rspack/core");
|
|
44
|
+
var core_default = /*#__PURE__*/ __webpack_require__.n(core_namespaceObject);
|
|
45
|
+
const external_webpack_merge_namespaceObject = require("webpack-merge");
|
|
46
|
+
const external_case_sensitive_paths_webpack_plugin_namespaceObject = require("case-sensitive-paths-webpack-plugin");
|
|
47
|
+
var external_case_sensitive_paths_webpack_plugin_default = /*#__PURE__*/ __webpack_require__.n(external_case_sensitive_paths_webpack_plugin_namespaceObject);
|
|
48
|
+
const external_dotenv_namespaceObject = require("dotenv");
|
|
180
49
|
function _define_property(obj, key, value) {
|
|
181
50
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
182
51
|
value: value,
|
|
@@ -189,7 +58,7 @@ function _define_property(obj, key, value) {
|
|
|
189
58
|
}
|
|
190
59
|
class EnvPlugin {
|
|
191
60
|
apply(compiler) {
|
|
192
|
-
const projectPath =
|
|
61
|
+
const projectPath = external_path_namespaceObject.dirname(this.manifestPath);
|
|
193
62
|
const mode = compiler.options.mode || 'development';
|
|
194
63
|
const envFiles = [
|
|
195
64
|
`.env.${this.browser}.${mode}`,
|
|
@@ -201,17 +70,17 @@ class EnvPlugin {
|
|
|
201
70
|
];
|
|
202
71
|
let envPath = '';
|
|
203
72
|
for (const file of envFiles){
|
|
204
|
-
const filePath =
|
|
205
|
-
if (
|
|
73
|
+
const filePath = external_path_namespaceObject.join(projectPath, file);
|
|
74
|
+
if (external_fs_namespaceObject.existsSync(filePath)) {
|
|
206
75
|
envPath = filePath;
|
|
207
76
|
break;
|
|
208
77
|
}
|
|
209
78
|
}
|
|
210
|
-
const envVars = envPath ?
|
|
79
|
+
const envVars = envPath ? external_dotenv_namespaceObject.config({
|
|
211
80
|
path: envPath
|
|
212
81
|
}).parsed || {} : {};
|
|
213
|
-
const defaultsPath =
|
|
214
|
-
const defaultsVars =
|
|
82
|
+
const defaultsPath = external_path_namespaceObject.join(projectPath, '.env.defaults');
|
|
83
|
+
const defaultsVars = external_fs_namespaceObject.existsSync(defaultsPath) ? external_dotenv_namespaceObject.config({
|
|
215
84
|
path: defaultsPath
|
|
216
85
|
}).parsed || {} : {};
|
|
217
86
|
const combinedVars = {
|
|
@@ -232,11 +101,11 @@ class EnvPlugin {
|
|
|
232
101
|
filteredEnvVars['import.meta.env.EXTENSION_BROWSER'] = JSON.stringify(this.browser);
|
|
233
102
|
filteredEnvVars['process.env.EXTENSION_MODE'] = JSON.stringify(mode);
|
|
234
103
|
filteredEnvVars['import.meta.env.EXTENSION_MODE'] = JSON.stringify(mode);
|
|
235
|
-
new
|
|
104
|
+
new core_namespaceObject.DefinePlugin(filteredEnvVars).apply(compiler);
|
|
236
105
|
compiler.hooks.thisCompilation.tap('manifest:update-manifest', (compilation)=>{
|
|
237
106
|
compilation.hooks.processAssets.tap({
|
|
238
107
|
name: 'env:module',
|
|
239
|
-
stage:
|
|
108
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
240
109
|
}, (assets)=>{
|
|
241
110
|
const files = Object.keys(assets);
|
|
242
111
|
files.forEach((filename)=>{
|
|
@@ -252,7 +121,7 @@ class EnvPlugin {
|
|
|
252
121
|
const value = combinedVars[envVarName] || match;
|
|
253
122
|
return value;
|
|
254
123
|
});
|
|
255
|
-
compilation.updateAsset(filename, new
|
|
124
|
+
compilation.updateAsset(filename, new core_namespaceObject.sources.RawSource(fileContent));
|
|
256
125
|
}
|
|
257
126
|
});
|
|
258
127
|
});
|
|
@@ -267,9 +136,9 @@ class EnvPlugin {
|
|
|
267
136
|
}
|
|
268
137
|
class CleanDistFolderPlugin {
|
|
269
138
|
apply(compiler) {
|
|
270
|
-
const outputPath =
|
|
271
|
-
if (
|
|
272
|
-
|
|
139
|
+
const outputPath = external_path_namespaceObject.join(compiler.options.output.path || '');
|
|
140
|
+
if (external_fs_namespaceObject.existsSync(outputPath)) try {
|
|
141
|
+
external_fs_namespaceObject.rmSync(outputPath, {
|
|
273
142
|
recursive: true,
|
|
274
143
|
force: true
|
|
275
144
|
});
|
|
@@ -279,7 +148,9 @@ class CleanDistFolderPlugin {
|
|
|
279
148
|
}
|
|
280
149
|
}
|
|
281
150
|
}
|
|
282
|
-
const
|
|
151
|
+
const external_chalk_namespaceObject = require("chalk");
|
|
152
|
+
var external_chalk_default = /*#__PURE__*/ __webpack_require__.n(external_chalk_namespaceObject);
|
|
153
|
+
const CERTIFICATE_DESTINATION_PATH = external_path_namespaceObject.join(process.cwd(), 'node_modules/extension-develop/dist/certs');
|
|
283
154
|
const CHROMIUM_BASED_BROWSERS = [
|
|
284
155
|
'chrome',
|
|
285
156
|
'edge'
|
|
@@ -291,14 +162,15 @@ const GECKO_BASED_BROWSERS = [
|
|
|
291
162
|
...CHROMIUM_BASED_BROWSERS,
|
|
292
163
|
...GECKO_BASED_BROWSERS
|
|
293
164
|
];
|
|
165
|
+
const external_console_namespaceObject = require("console");
|
|
294
166
|
var package_namespaceObject = {
|
|
295
|
-
i8: "2.0.0-rc.
|
|
167
|
+
i8: "2.0.0-rc.26"
|
|
296
168
|
};
|
|
297
169
|
function getLoggingPrefix(feature, type) {
|
|
298
|
-
if ('error' === type) return `${
|
|
299
|
-
if ('warn' === type) return `${feature} ${
|
|
300
|
-
const arrow = 'info' === type ?
|
|
301
|
-
return `${arrow} ${
|
|
170
|
+
if ('error' === type) return `${external_chalk_default().bold(external_chalk_default().red('ERROR'))} in ${feature} ${external_chalk_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
171
|
+
if ('warn' === type) return `${feature} ${external_chalk_default().yellow("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
172
|
+
const arrow = 'info' === type ? external_chalk_default().cyan("\u25BA\u25BA\u25BA") : external_chalk_default().green("\u25BA\u25BA\u25BA");
|
|
173
|
+
return `${arrow} ${external_chalk_default().cyan(feature)}`;
|
|
302
174
|
}
|
|
303
175
|
function capitalize(browser) {
|
|
304
176
|
return browser.charAt(0).toUpperCase() + browser.slice(1);
|
|
@@ -306,15 +178,15 @@ function capitalize(browser) {
|
|
|
306
178
|
function boring(manifestName, duration, stats) {
|
|
307
179
|
let didShow = false;
|
|
308
180
|
if (!didShow) {
|
|
309
|
-
const arrow = stats.hasErrors() ?
|
|
310
|
-
return `${arrow} ${
|
|
181
|
+
const arrow = stats.hasErrors() ? external_chalk_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E") : external_chalk_default().green("\u25BA\u25BA\u25BA");
|
|
182
|
+
return `${arrow} ${external_chalk_default().cyan(manifestName)} compiled ${stats.hasErrors() ? external_chalk_default().red('with errors') : external_chalk_default().green('successfully')} in ${duration} ms.`;
|
|
311
183
|
}
|
|
312
184
|
}
|
|
313
185
|
function integrationNotInstalled(integration, packageManager) {
|
|
314
|
-
return `${(0,
|
|
186
|
+
return `${(0, external_console_namespaceObject.info)("\u25BA\u25BA\u25BA")} Using ${external_chalk_default().magenta(integration)}. Installing required dependencies via ${external_chalk_default().yellow(packageManager)}...`;
|
|
315
187
|
}
|
|
316
188
|
function isUsingIntegration(integration) {
|
|
317
|
-
return `${
|
|
189
|
+
return `${external_chalk_default().cyan("\u25BA\u25BA\u25BA")} Using ${external_chalk_default().magenta(integration)}...`;
|
|
318
190
|
}
|
|
319
191
|
function youAreAllSet(integration) {
|
|
320
192
|
return `${getLoggingPrefix(integration, 'success')} installation completed. Run the program again and happy hacking.`;
|
|
@@ -323,14 +195,14 @@ function installingRootDependencies(integration) {
|
|
|
323
195
|
return `${getLoggingPrefix(integration, 'info')} dependencies are being installed. This only happens for core contributors...`;
|
|
324
196
|
}
|
|
325
197
|
function integrationInstalledSuccessfully(integration) {
|
|
326
|
-
return `${getLoggingPrefix(integration, 'success')} dependencies installed ${
|
|
198
|
+
return `${getLoggingPrefix(integration, 'success')} dependencies installed ${external_chalk_default().green('successfully')}.`;
|
|
327
199
|
}
|
|
328
200
|
function failedToInstallIntegration(integration, error) {
|
|
329
|
-
return `${getLoggingPrefix('Integration', 'error')} ${integration} Installation Error\n\nFailed to detect package manager or install ${integration} dependencies:\n${
|
|
201
|
+
return `${getLoggingPrefix('Integration', 'error')} ${integration} Installation Error\n\nFailed to detect package manager or install ${integration} dependencies:\n${external_chalk_default().red((null == error ? void 0 : error.toString()) || '')}`;
|
|
330
202
|
}
|
|
331
203
|
function fileNotFound(errorSourcePath, missingFilePath) {
|
|
332
204
|
if (!errorSourcePath) throw new Error('This operation is impossible. Please report a bug.');
|
|
333
|
-
switch(
|
|
205
|
+
switch(external_path_namespaceObject.extname(missingFilePath)){
|
|
334
206
|
case '.js':
|
|
335
207
|
case '.ts':
|
|
336
208
|
case '.jsx':
|
|
@@ -350,28 +222,28 @@ function manifestFieldError(manifestName, manifestField, filePath) {
|
|
|
350
222
|
const contentIndex = manifestField.split('-')[1];
|
|
351
223
|
const isPage = manifestField.startsWith('pages');
|
|
352
224
|
const field = manifestName.includes("content_scripts") ? `(index ${contentIndex})\n\n` : manifestFieldName;
|
|
353
|
-
return `${getLoggingPrefix('manifest.json', 'error')} File Not Found\n\n${isPage ? `Check the ${
|
|
225
|
+
return `${getLoggingPrefix('manifest.json', 'error')} File Not Found\n\n${isPage ? `Check the ${external_chalk_default().yellow('pages')} folder in your project root directory.\n` : `Check the ${external_chalk_default().yellow(field)} field in your manifest.json file.\n`}${external_chalk_default().red('NOT FOUND')} ${external_chalk_default().underline(filePath)}`;
|
|
354
226
|
}
|
|
355
227
|
function entryNotFoundWarn(manifestField, filePath) {
|
|
356
|
-
return `File Not Found\n\nCheck the ${
|
|
228
|
+
return `File Not Found\n\nCheck the ${external_chalk_default().yellow(manifestField)} field in your manifest.json file.\n${external_chalk_default().red('NOT FOUND')} ${external_chalk_default().underline(filePath)}`;
|
|
357
229
|
}
|
|
358
230
|
function manifestNotFoundError(manifestName, manifestPath) {
|
|
359
|
-
return `${getLoggingPrefix(manifestName, 'error')} Manifest Not Found\n\nEnsure you have a manifest.json file at the root directory of your project.\n${
|
|
231
|
+
return `${getLoggingPrefix(manifestName, 'error')} Manifest Not Found\n\nEnsure you have a manifest.json file at the root directory of your project.\n${external_chalk_default().red('NOT FOUND')} ${external_chalk_default().underline(manifestPath)}`;
|
|
360
232
|
}
|
|
361
233
|
function manifestInvalidError(error) {
|
|
362
|
-
return `${getLoggingPrefix('manifest.json', 'error')} Invalid Manifest\n\nUpdate your manifest.json file and try again. ` +
|
|
234
|
+
return `${getLoggingPrefix('manifest.json', 'error')} Invalid Manifest\n\nUpdate your manifest.json file and try again. ` + external_chalk_default().red(error.toString());
|
|
363
235
|
}
|
|
364
236
|
function serverRestartRequiredFromManifestError(fileAdded, fileRemoved) {
|
|
365
|
-
const fileRemovedText = fileRemoved && `${
|
|
366
|
-
const fileAddedText = fileAdded && `${
|
|
367
|
-
return `$manifest.json ${
|
|
237
|
+
const fileRemovedText = fileRemoved && `${external_chalk_default().gray('PATH')} ${external_chalk_default().red('REMOVED')} ${external_chalk_default().underline(fileRemoved)}\n`;
|
|
238
|
+
const fileAddedText = fileAdded && `${external_chalk_default().gray('PATH')} ${external_chalk_default().green('ADDED')} ${external_chalk_default().underline(fileAdded)}`;
|
|
239
|
+
return `$manifest.json ${external_chalk_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Manifest Entry Point Modification\n\nChanging the path of ${external_chalk_default().yellow('HTML')} or ${external_chalk_default().yellow("script")} files in manifest.json after compilation requires a server restart.\n` + fileRemovedText + fileAddedText;
|
|
368
240
|
}
|
|
369
241
|
function serverRestartRequiredFromSpecialFolderError(addingOrRemoving, folder, typeOfAsset, pathRelative) {
|
|
370
242
|
const addOrRemove = addingOrRemoving.charAt(0).toUpperCase() + addingOrRemoving.slice(1);
|
|
371
|
-
return `${getLoggingPrefix('manifest.json', 'error')} Manifest Entry Point Modification\n\n${addOrRemove} ${
|
|
243
|
+
return `${getLoggingPrefix('manifest.json', 'error')} Manifest Entry Point Modification\n\n${addOrRemove} ${external_chalk_default().yellow(typeOfAsset)} in the ${external_chalk_default().underline(folder + '/')} folder after compilation requires a server restart.\n${external_chalk_default().gray('PATH')} ${external_chalk_default().underline(pathRelative)}`;
|
|
372
244
|
}
|
|
373
245
|
function creatingTSConfig() {
|
|
374
|
-
return `${getLoggingPrefix('TypeScript', 'info')} is being used but no config file was found. Creating ${
|
|
246
|
+
return `${getLoggingPrefix('TypeScript', 'info')} is being used but no config file was found. Creating ${external_chalk_default().yellow('tsconfig.json')}...`;
|
|
375
247
|
}
|
|
376
248
|
function runningInDevelopment(manifest, browser, message) {
|
|
377
249
|
const manifestName = manifest.name || 'Extension.js';
|
|
@@ -389,51 +261,51 @@ function runningInDevelopment(manifest, browser, message) {
|
|
|
389
261
|
default:
|
|
390
262
|
browserDevToolsUrl = '';
|
|
391
263
|
}
|
|
392
|
-
if (!message.data) return `${getLoggingPrefix(manifestName, 'error')} No Client Data Received\n\nThis error happens when the program can\'t get the data from your extension.\nThere are many reasons this might happen. To fix, ensure that:\n\n- Your extension is set as enabled in ${
|
|
264
|
+
if (!message.data) return `${getLoggingPrefix(manifestName, 'error')} No Client Data Received\n\nThis error happens when the program can\'t get the data from your extension.\nThere are many reasons this might happen. To fix, ensure that:\n\n- Your extension is set as enabled in ${external_chalk_default().underline(browserDevToolsUrl)}\n- No previous ${capitalize(browser)} browser instance is open\n\nIf that is not the case, restart both the ${external_chalk_default().cyan(manifest.name || '')} and the\n${external_chalk_default().yellow('Manager Extension')} in ${external_chalk_default().underline(browserDevToolsUrl)} and try again.\n\nIf the issue still persists, please report a bug:\n\n` + external_chalk_default().underline("https://github.com/extension-js/extension.js/issues");
|
|
393
265
|
const { id, management } = message.data;
|
|
394
266
|
if (!management) {
|
|
395
267
|
if ('development' === process.env.EXTENSION_ENV) return `${getLoggingPrefix(manifestName, 'error')} No management API info received from client. Investigate.`;
|
|
396
268
|
}
|
|
397
269
|
const { name, version } = management;
|
|
398
270
|
return `
|
|
399
|
-
\u{1F9E9} ${
|
|
400
|
-
Extension Name ${
|
|
401
|
-
Extension Version ${
|
|
402
|
-
Extension ID ${
|
|
271
|
+
\u{1F9E9} ${external_chalk_default().green('Extension.js')} ${external_chalk_default().gray(`${package_namespaceObject.i8}`)}
|
|
272
|
+
Extension Name ${external_chalk_default().gray(name)}
|
|
273
|
+
Extension Version ${external_chalk_default().gray(version)}
|
|
274
|
+
Extension ID ${external_chalk_default().gray(id)}`;
|
|
403
275
|
}
|
|
404
276
|
function isFirstRun(browser) {
|
|
405
277
|
return `This is your first run using Extension.js via ${capitalize(browser)}. Welcome! \u{1F389}
|
|
406
278
|
|
|
407
|
-
\u{1F9E9} Learn more at ${
|
|
279
|
+
\u{1F9E9} Learn more at ${external_chalk_default().underline("https://extension.js.org")}`;
|
|
408
280
|
}
|
|
409
281
|
function webSocketError(error) {
|
|
410
|
-
return `${getLoggingPrefix('WebSocket', 'error')} General WebSocket Error:\n${
|
|
282
|
+
return `${getLoggingPrefix('WebSocket', 'error')} General WebSocket Error:\n${external_chalk_default().red(error)}`;
|
|
411
283
|
}
|
|
412
284
|
function backgroundIsRequired(backgroundChunkName, filePath) {
|
|
413
|
-
return `${getLoggingPrefix('manifest.json', 'error')} File Not Found\n\nCheck the ${
|
|
285
|
+
return `${getLoggingPrefix('manifest.json', 'error')} File Not Found\n\nCheck the ${external_chalk_default().yellow(backgroundChunkName.replace('/', '.'))} field in your manifest.json file.\n${external_chalk_default().red('NOT FOUND')} ${external_chalk_default().underline(filePath)}`;
|
|
414
286
|
}
|
|
415
287
|
function serverRestartRequiredFromHtml(filePath) {
|
|
416
|
-
const errorMessage = `${getLoggingPrefix('HTML', 'error')} Entry Point Modification\n\nChanging the path of ${
|
|
288
|
+
const errorMessage = `${getLoggingPrefix('HTML', 'error')} Entry Point Modification\n\nChanging the path of ${external_chalk_default().yellow("<script>")} or ${external_chalk_default().yellow('<link rel="stylesheet">')} files after compilation requires a server restart.\n${external_chalk_default().gray('PATH')} ${external_chalk_default().underline(filePath)}`;
|
|
417
289
|
return errorMessage;
|
|
418
290
|
}
|
|
419
291
|
function javaScriptError(errorSourcePath, missingFilePath) {
|
|
420
|
-
return `${getLoggingPrefix('HTML', 'error')} File Not Found\n\nCheck your ${
|
|
292
|
+
return `${getLoggingPrefix('HTML', 'error')} File Not Found\n\nCheck your ${external_chalk_default().yellow("<script>")} tags in ${external_chalk_default().underline(errorSourcePath)}.\n${external_chalk_default().red('NOT FOUND')} ${external_chalk_default().underline(missingFilePath)}`;
|
|
421
293
|
}
|
|
422
294
|
function cssError(errorSourcePath, missingFilePath) {
|
|
423
|
-
return `${getLoggingPrefix('HTML', 'error')} File Not Found\n\nCheck your ${
|
|
295
|
+
return `${getLoggingPrefix('HTML', 'error')} File Not Found\n\nCheck your ${external_chalk_default().yellow('<link>')} tags in ${external_chalk_default().underline(errorSourcePath)}.\n${external_chalk_default().red('NOT FOUND')} ${external_chalk_default().underline(missingFilePath)}`;
|
|
424
296
|
}
|
|
425
297
|
function staticAssetError(errorSourcePath, missingFilePath) {
|
|
426
|
-
const extname =
|
|
427
|
-
return `${getLoggingPrefix('HTML', 'warn')} File Not Found\n\nCheck your ${
|
|
298
|
+
const extname = external_path_namespaceObject.extname(missingFilePath);
|
|
299
|
+
return `${getLoggingPrefix('HTML', 'warn')} File Not Found\n\nCheck your ${external_chalk_default().yellow('*' + extname)} assets in ${external_chalk_default().underline(errorSourcePath)}.\n${external_chalk_default().red('NOT FOUND')} ${external_chalk_default().underline(missingFilePath)}`;
|
|
428
300
|
}
|
|
429
301
|
function certRequired() {
|
|
430
|
-
return `${
|
|
302
|
+
return `${external_chalk_default().yellow('Note')}: Firefox requires a secure certificate for localhost connections, needed for the reloader to work.\nBy default, your manifest.json file is not being watched. To enable this feature, run:\n\n npx -y mkcert-cli \\\n ${external_chalk_default().green('--outDir')} ${external_chalk_default().underline(CERTIFICATE_DESTINATION_PATH)} \\\n ${external_chalk_default().green('--cert')} ${external_chalk_default().yellow('localhost.cert')} \\\n ${external_chalk_default().green('--key')} ${external_chalk_default().yellow('localhost.key')}\n\nThis will enable the secure certificate needed for Firefox via ${external_chalk_default().bold('mkcert')}.\n\nLearn more about ${external_chalk_default().bold('mkcert')}: ${external_chalk_default().underline("https://github.com/FiloSottile/mkcert")}`;
|
|
431
303
|
}
|
|
432
304
|
function defaultPortInUse(port) {
|
|
433
|
-
return `${getLoggingPrefix('Port', 'error')} Selected port ${
|
|
305
|
+
return `${getLoggingPrefix('Port', 'error')} Selected port ${external_chalk_default().yellow(port.toString())} in use. Choose a new port. `;
|
|
434
306
|
}
|
|
435
307
|
function noExtensionIdError() {
|
|
436
|
-
return `${getLoggingPrefix('manifest.json', 'error')} Extension ID Not Defined\n\nFor MAIN world content_scripts, the extension ID must be specified.\nEnsure your extension have a fixed ID and that the ${
|
|
308
|
+
return `${getLoggingPrefix('manifest.json', 'error')} Extension ID Not Defined\n\nFor MAIN world content_scripts, the extension ID must be specified.\nEnsure your extension have a fixed ID and that the ${external_chalk_default().yellow('publicPath')}\nof your ${external_chalk_default().yellow('extension.config.js')} is defined as your extension URL.`;
|
|
437
309
|
}
|
|
438
310
|
function plugin_compilation_define_property(obj, key, value) {
|
|
439
311
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -447,7 +319,7 @@ function plugin_compilation_define_property(obj, key, value) {
|
|
|
447
319
|
}
|
|
448
320
|
class CompilationPlugin {
|
|
449
321
|
apply(compiler) {
|
|
450
|
-
new
|
|
322
|
+
new (external_case_sensitive_paths_webpack_plugin_default())().apply(compiler);
|
|
451
323
|
new EnvPlugin({
|
|
452
324
|
manifestPath: this.manifestPath,
|
|
453
325
|
browser: this.browser
|
|
@@ -456,7 +328,7 @@ class CompilationPlugin {
|
|
|
456
328
|
compiler.hooks.done.tapAsync('develop:brand', (stats, done)=>{
|
|
457
329
|
stats.compilation.name = void 0;
|
|
458
330
|
const duration = stats.compilation.endTime - stats.compilation.startTime;
|
|
459
|
-
const manifestName = JSON.parse(
|
|
331
|
+
const manifestName = JSON.parse(external_fs_namespaceObject.readFileSync(this.manifestPath, 'utf-8')).name;
|
|
460
332
|
console.log(boring(manifestName, duration, stats));
|
|
461
333
|
done();
|
|
462
334
|
});
|
|
@@ -469,13 +341,15 @@ class CompilationPlugin {
|
|
|
469
341
|
}
|
|
470
342
|
}
|
|
471
343
|
plugin_compilation_define_property(CompilationPlugin, "name", 'plugin-compilation');
|
|
344
|
+
const external_child_process_namespaceObject = require("child_process");
|
|
345
|
+
const external_package_manager_detector_namespaceObject = require("package-manager-detector");
|
|
472
346
|
function isFromFilepathList(filePath, filepathList) {
|
|
473
347
|
return Object.values(filepathList || {}).some((value)=>value === filePath);
|
|
474
348
|
}
|
|
475
349
|
function getFilename(feature, filePath, excludeList) {
|
|
476
|
-
const entryExt =
|
|
350
|
+
const entryExt = external_path_namespaceObject.extname(filePath);
|
|
477
351
|
const skipPathResolve = shouldExclude(filePath, excludeList);
|
|
478
|
-
let fileOutputpath = skipPathResolve ?
|
|
352
|
+
let fileOutputpath = skipPathResolve ? external_path_namespaceObject.normalize(filePath) : feature;
|
|
479
353
|
if ([
|
|
480
354
|
'.js',
|
|
481
355
|
'.jsx',
|
|
@@ -500,7 +374,7 @@ function unixify(filePath) {
|
|
|
500
374
|
}
|
|
501
375
|
function shouldExclude(filePath, ignorePatterns = {}) {
|
|
502
376
|
if (!ignorePatterns) return false;
|
|
503
|
-
const unixifiedFilePath =
|
|
377
|
+
const unixifiedFilePath = external_path_namespaceObject.normalize(unixify(filePath));
|
|
504
378
|
const isFilePathInExcludedList = Object.values(ignorePatterns).some((pattern)=>{
|
|
505
379
|
if ('string' != typeof pattern) return false;
|
|
506
380
|
const _pattern = unixify(pattern);
|
|
@@ -527,19 +401,18 @@ function isFromNpx() {
|
|
|
527
401
|
}
|
|
528
402
|
async function utils_installOptionalDependencies(integration, dependencies) {
|
|
529
403
|
try {
|
|
530
|
-
const pm = await (0,
|
|
404
|
+
const pm = await (0, external_package_manager_detector_namespaceObject.detect)();
|
|
531
405
|
console.log(integrationNotInstalled(integration, (null == pm ? void 0 : pm.name) || 'unknown'));
|
|
532
|
-
const __dirname = getDirname(import.meta.url);
|
|
533
406
|
let installCommand = '';
|
|
534
407
|
installCommand = (null == pm ? void 0 : pm.name) === 'yarn' ? `yarn --silent add ${dependencies.join(' ')} --cwd ${__dirname} --optional` : (null == pm ? void 0 : pm.name) === 'npm' || isFromNpx() ? `npm --silent install ${dependencies.join(' ')} --prefix ${__dirname} --save-optional` : isFromPnpx() ? `pnpm --silent add ${dependencies.join(' ')} --prefix ${__dirname} --save-optional` : `${pm} --silent install ${dependencies.join(' ')} --cwd ${__dirname} --optional`;
|
|
535
|
-
(0,
|
|
408
|
+
(0, external_child_process_namespaceObject.execSync)(installCommand, {
|
|
536
409
|
stdio: 'inherit'
|
|
537
410
|
});
|
|
538
411
|
await new Promise((resolve)=>setTimeout(resolve, 2000));
|
|
539
412
|
if ('development' === process.env.EXTENSION_ENV) {
|
|
540
413
|
console.log(installingRootDependencies(integration));
|
|
541
414
|
installCommand = (null == pm ? void 0 : pm.name) === 'yarn' ? "yarn install --silent > /dev/null 2>&1" : (null == pm ? void 0 : pm.name) === 'npm' || isFromNpx() ? "npm install --silent > /dev/null 2>&1" : isFromPnpx() ? "pnpm install --silent > /dev/null 2>&1" : `${pm} install --silent > /dev/null 2>&1`;
|
|
542
|
-
(0,
|
|
415
|
+
(0, external_child_process_namespaceObject.execSync)(installCommand, {
|
|
543
416
|
stdio: 'inherit'
|
|
544
417
|
});
|
|
545
418
|
}
|
|
@@ -549,9 +422,9 @@ async function utils_installOptionalDependencies(integration, dependencies) {
|
|
|
549
422
|
}
|
|
550
423
|
}
|
|
551
424
|
function isUsingJSFramework(projectPath) {
|
|
552
|
-
const packageJsonPath =
|
|
553
|
-
if (!
|
|
554
|
-
const packageJson = JSON.parse(
|
|
425
|
+
const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
|
|
426
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
|
|
427
|
+
const packageJson = JSON.parse(external_fs_namespaceObject.readFileSync(packageJsonPath, 'utf-8'));
|
|
555
428
|
const frameworks = [
|
|
556
429
|
'react',
|
|
557
430
|
'vue',
|
|
@@ -566,8 +439,7 @@ function isUsingJSFramework(projectPath) {
|
|
|
566
439
|
return false;
|
|
567
440
|
}
|
|
568
441
|
function utils_isFirstRun(browser) {
|
|
569
|
-
|
|
570
|
-
return !external_fs_.existsSync(external_path_.resolve(__dirname, `run-${browser}-profile`));
|
|
442
|
+
return !external_fs_namespaceObject.existsSync(external_path_namespaceObject.resolve(__dirname, `run-${browser}-profile`));
|
|
571
443
|
}
|
|
572
444
|
function getHardcodedMessage(manifest) {
|
|
573
445
|
var _manifest_name;
|
|
@@ -606,22 +478,21 @@ function filterKeysForThisBrowser(manifest, browser) {
|
|
|
606
478
|
}
|
|
607
479
|
function isContentScriptEntry(absolutePath, manifestPath) {
|
|
608
480
|
if (!absolutePath || !manifestPath) return false;
|
|
609
|
-
const manifest = JSON.parse(
|
|
481
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf8'));
|
|
610
482
|
for (const content of manifest.content_scripts || []){
|
|
611
483
|
var _content_js;
|
|
612
484
|
if (null == (_content_js = content.js) ? void 0 : _content_js.length) for (const js of content.js){
|
|
613
|
-
const contentPath =
|
|
485
|
+
const contentPath = external_path_namespaceObject.resolve(external_path_namespaceObject.dirname(manifestPath), js);
|
|
614
486
|
if (contentPath === absolutePath) return true;
|
|
615
487
|
}
|
|
616
488
|
}
|
|
617
489
|
return false;
|
|
618
490
|
}
|
|
619
|
-
const sass_dirname = getDirname(import.meta.url);
|
|
620
491
|
let userMessageDelivered = false;
|
|
621
492
|
function isUsingSass(projectPath) {
|
|
622
|
-
const packageJsonPath =
|
|
623
|
-
if (!
|
|
624
|
-
const packageJson = JSON.parse(
|
|
493
|
+
const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
|
|
494
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
|
|
495
|
+
const packageJson = JSON.parse(external_fs_namespaceObject.readFileSync(packageJsonPath, 'utf8'));
|
|
625
496
|
const sassAsDevDep = packageJson.devDependencies && packageJson.devDependencies.sass;
|
|
626
497
|
const sassAsDep = packageJson.dependencies && packageJson.dependencies.sass;
|
|
627
498
|
if (sassAsDevDep || sassAsDep) {
|
|
@@ -634,10 +505,10 @@ function isUsingSass(projectPath) {
|
|
|
634
505
|
return false;
|
|
635
506
|
}
|
|
636
507
|
async function maybeUseSass(projectPath) {
|
|
637
|
-
const manifestPath =
|
|
508
|
+
const manifestPath = external_path_namespaceObject.join(projectPath, 'manifest.json');
|
|
638
509
|
if (!isUsingSass(projectPath)) return [];
|
|
639
510
|
try {
|
|
640
|
-
|
|
511
|
+
require.resolve('sass-loader');
|
|
641
512
|
} catch (e) {
|
|
642
513
|
const postCssDependencies = [
|
|
643
514
|
'postcss-loader',
|
|
@@ -653,7 +524,6 @@ async function maybeUseSass(projectPath) {
|
|
|
653
524
|
console.log(youAreAllSet('SASS'));
|
|
654
525
|
process.exit(0);
|
|
655
526
|
}
|
|
656
|
-
const sassLoaderPath = external_path_.resolve(sass_dirname, '..', 'node_modules', 'sass-loader');
|
|
657
527
|
return [
|
|
658
528
|
{
|
|
659
529
|
test: /\.(sass|scss)$/,
|
|
@@ -661,7 +531,7 @@ async function maybeUseSass(projectPath) {
|
|
|
661
531
|
type: 'css',
|
|
662
532
|
use: [
|
|
663
533
|
{
|
|
664
|
-
loader:
|
|
534
|
+
loader: require.resolve('sass-loader'),
|
|
665
535
|
options: {
|
|
666
536
|
sourceMap: true,
|
|
667
537
|
sassOptions: {
|
|
@@ -676,7 +546,7 @@ async function maybeUseSass(projectPath) {
|
|
|
676
546
|
type: 'css/module',
|
|
677
547
|
use: [
|
|
678
548
|
{
|
|
679
|
-
loader:
|
|
549
|
+
loader: require.resolve('sass-loader'),
|
|
680
550
|
options: {
|
|
681
551
|
sourceMap: true,
|
|
682
552
|
sassOptions: {
|
|
@@ -694,12 +564,11 @@ async function maybeUseSass(projectPath) {
|
|
|
694
564
|
}
|
|
695
565
|
];
|
|
696
566
|
}
|
|
697
|
-
const less_dirname = getDirname(import.meta.url);
|
|
698
567
|
let less_userMessageDelivered = false;
|
|
699
568
|
function isUsingLess(projectPath) {
|
|
700
|
-
const packageJsonPath =
|
|
701
|
-
if (!
|
|
702
|
-
const packageJson = JSON.parse(
|
|
569
|
+
const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
|
|
570
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
|
|
571
|
+
const packageJson = JSON.parse(external_fs_namespaceObject.readFileSync(packageJsonPath, 'utf8'));
|
|
703
572
|
const lessAsDevDep = packageJson.devDependencies && packageJson.devDependencies.less;
|
|
704
573
|
const lessAsDep = packageJson.dependencies && packageJson.dependencies.less;
|
|
705
574
|
if (lessAsDevDep || lessAsDep) {
|
|
@@ -712,10 +581,10 @@ function isUsingLess(projectPath) {
|
|
|
712
581
|
return false;
|
|
713
582
|
}
|
|
714
583
|
async function maybeUseLess(projectPath) {
|
|
715
|
-
const manifestPath =
|
|
584
|
+
const manifestPath = external_path_namespaceObject.join(projectPath, 'manifest.json');
|
|
716
585
|
if (!isUsingLess(projectPath)) return [];
|
|
717
586
|
try {
|
|
718
|
-
|
|
587
|
+
require.resolve('less-loader');
|
|
719
588
|
} catch (e) {
|
|
720
589
|
const lessDependencies = [
|
|
721
590
|
'less',
|
|
@@ -725,7 +594,6 @@ async function maybeUseLess(projectPath) {
|
|
|
725
594
|
console.log(youAreAllSet('LESS'));
|
|
726
595
|
process.exit(0);
|
|
727
596
|
}
|
|
728
|
-
const lessLoaderPath = external_path_.resolve(less_dirname, '..', 'node_modules', 'less-loader');
|
|
729
597
|
return [
|
|
730
598
|
{
|
|
731
599
|
test: /\.less$/,
|
|
@@ -733,7 +601,7 @@ async function maybeUseLess(projectPath) {
|
|
|
733
601
|
type: 'css',
|
|
734
602
|
use: [
|
|
735
603
|
{
|
|
736
|
-
loader:
|
|
604
|
+
loader: require.resolve('less-loader'),
|
|
737
605
|
options: {
|
|
738
606
|
sourceMap: true
|
|
739
607
|
}
|
|
@@ -745,7 +613,7 @@ async function maybeUseLess(projectPath) {
|
|
|
745
613
|
type: 'css/module',
|
|
746
614
|
use: [
|
|
747
615
|
{
|
|
748
|
-
loader:
|
|
616
|
+
loader: require.resolve('less-loader'),
|
|
749
617
|
options: {
|
|
750
618
|
sourceMap: true
|
|
751
619
|
}
|
|
@@ -761,31 +629,31 @@ async function maybeUseLess(projectPath) {
|
|
|
761
629
|
];
|
|
762
630
|
}
|
|
763
631
|
function getStylelintConfigFile(projectPath) {
|
|
764
|
-
const stylelintConfigJs =
|
|
765
|
-
const stylelintConfigDotJs =
|
|
766
|
-
const stylelintConfigMjs =
|
|
767
|
-
const stylelintConfigDotMjs =
|
|
768
|
-
const stylelintConfigCjs =
|
|
769
|
-
const stylelintConfigDotCjs =
|
|
770
|
-
const stylelintConfigJson =
|
|
771
|
-
const stylelintConfigDotJson =
|
|
772
|
-
const stylelintConfigYml =
|
|
773
|
-
const stylelintConfigDotYml =
|
|
774
|
-
if (
|
|
775
|
-
if (
|
|
776
|
-
if (
|
|
777
|
-
if (
|
|
778
|
-
if (
|
|
779
|
-
if (
|
|
780
|
-
if (
|
|
781
|
-
if (
|
|
782
|
-
if (
|
|
783
|
-
if (
|
|
632
|
+
const stylelintConfigJs = external_path_namespaceObject.join(projectPath, 'stylelint.config.json');
|
|
633
|
+
const stylelintConfigDotJs = external_path_namespaceObject.join(projectPath, '.stylelintrc.js file');
|
|
634
|
+
const stylelintConfigMjs = external_path_namespaceObject.join(projectPath, 'stylelint.config.mjs');
|
|
635
|
+
const stylelintConfigDotMjs = external_path_namespaceObject.join(projectPath, '.stylelintrc.mjs');
|
|
636
|
+
const stylelintConfigCjs = external_path_namespaceObject.join(projectPath, 'stylelint.config.cjs');
|
|
637
|
+
const stylelintConfigDotCjs = external_path_namespaceObject.join(projectPath, '.stylelintrc.cjs');
|
|
638
|
+
const stylelintConfigJson = external_path_namespaceObject.join(projectPath, '.stylelintrc.json');
|
|
639
|
+
const stylelintConfigDotJson = external_path_namespaceObject.join(projectPath, '.stylelintrc');
|
|
640
|
+
const stylelintConfigYml = external_path_namespaceObject.join(projectPath, '.stylelintrc.yml');
|
|
641
|
+
const stylelintConfigDotYml = external_path_namespaceObject.join(projectPath, '.stylelintrc.yaml');
|
|
642
|
+
if (external_fs_namespaceObject.existsSync(stylelintConfigJs)) return stylelintConfigJs;
|
|
643
|
+
if (external_fs_namespaceObject.existsSync(stylelintConfigDotJs)) return stylelintConfigDotJs;
|
|
644
|
+
if (external_fs_namespaceObject.existsSync(stylelintConfigMjs)) return stylelintConfigMjs;
|
|
645
|
+
if (external_fs_namespaceObject.existsSync(stylelintConfigDotMjs)) return stylelintConfigDotMjs;
|
|
646
|
+
if (external_fs_namespaceObject.existsSync(stylelintConfigCjs)) return stylelintConfigCjs;
|
|
647
|
+
if (external_fs_namespaceObject.existsSync(stylelintConfigDotCjs)) return stylelintConfigDotCjs;
|
|
648
|
+
if (external_fs_namespaceObject.existsSync(stylelintConfigJson)) return stylelintConfigJson;
|
|
649
|
+
if (external_fs_namespaceObject.existsSync(stylelintConfigDotJson)) return stylelintConfigDotJson;
|
|
650
|
+
if (external_fs_namespaceObject.existsSync(stylelintConfigYml)) return stylelintConfigYml;
|
|
651
|
+
if (external_fs_namespaceObject.existsSync(stylelintConfigDotYml)) return stylelintConfigDotYml;
|
|
784
652
|
}
|
|
785
653
|
let stylelint_userMessageDelivered = false;
|
|
786
654
|
function stylelint_isUsingStylelint(projectPath) {
|
|
787
|
-
const packageJsonPath =
|
|
788
|
-
if (!
|
|
655
|
+
const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
|
|
656
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
|
|
789
657
|
const configFile = getStylelintConfigFile(projectPath);
|
|
790
658
|
const isUsingStylelint = !!configFile;
|
|
791
659
|
if (isUsingStylelint) {
|
|
@@ -802,9 +670,9 @@ async function maybeUseStylelint(projectPath) {
|
|
|
802
670
|
}
|
|
803
671
|
let tailwind_userMessageDelivered = false;
|
|
804
672
|
function tailwind_isUsingTailwind(projectPath) {
|
|
805
|
-
const packageJsonPath =
|
|
806
|
-
if (!
|
|
807
|
-
const packageJson = JSON.parse(
|
|
673
|
+
const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
|
|
674
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
|
|
675
|
+
const packageJson = JSON.parse(external_fs_namespaceObject.readFileSync(packageJsonPath, 'utf8'));
|
|
808
676
|
const tailwindAsDevDep = packageJson.devDependencies && packageJson.devDependencies.tailwindcss;
|
|
809
677
|
const tailwindAsDep = packageJson.dependencies && packageJson.dependencies.tailwindcss;
|
|
810
678
|
const isUsingTailwind = !!(tailwindAsDevDep || tailwindAsDep);
|
|
@@ -816,7 +684,6 @@ function tailwind_isUsingTailwind(projectPath) {
|
|
|
816
684
|
}
|
|
817
685
|
return isUsingTailwind;
|
|
818
686
|
}
|
|
819
|
-
const postcss_dirname = getDirname(import.meta.url);
|
|
820
687
|
let postcss_userMessageDelivered = false;
|
|
821
688
|
const postCssConfigFiles = [
|
|
822
689
|
'.postcssrc',
|
|
@@ -830,15 +697,15 @@ const postCssConfigFiles = [
|
|
|
830
697
|
];
|
|
831
698
|
function findPostCssConfig(projectPath) {
|
|
832
699
|
for (const configFile of postCssConfigFiles){
|
|
833
|
-
const configPath =
|
|
834
|
-
if (
|
|
700
|
+
const configPath = external_path_namespaceObject.join(projectPath, configFile);
|
|
701
|
+
if (external_fs_namespaceObject.existsSync(configPath)) return configPath;
|
|
835
702
|
}
|
|
836
703
|
}
|
|
837
704
|
function isUsingPostCss(projectPath) {
|
|
838
|
-
const packageJsonPath =
|
|
839
|
-
if (!
|
|
840
|
-
if (
|
|
841
|
-
const packageJson = JSON.parse(
|
|
705
|
+
const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
|
|
706
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
|
|
707
|
+
if (external_fs_namespaceObject.existsSync(packageJsonPath)) {
|
|
708
|
+
const packageJson = JSON.parse(external_fs_namespaceObject.readFileSync(packageJsonPath, 'utf8'));
|
|
842
709
|
if (packageJson.dependencies && packageJson.dependencies['postcss'] || packageJson.devDependencies && packageJson.devDependencies['postcss']) {
|
|
843
710
|
if (!postcss_userMessageDelivered) {
|
|
844
711
|
if ('development' === process.env.EXTENSION_ENV) console.log(isUsingIntegration('PostCSS'));
|
|
@@ -866,7 +733,7 @@ function isUsingPostCss(projectPath) {
|
|
|
866
733
|
async function maybeUsePostCss(projectPath, opts) {
|
|
867
734
|
if (!isUsingPostCss(projectPath)) return {};
|
|
868
735
|
try {
|
|
869
|
-
|
|
736
|
+
require.resolve('postcss-loader');
|
|
870
737
|
} catch (e) {
|
|
871
738
|
if (!isUsingSass(projectPath) && !isUsingLess(projectPath)) {
|
|
872
739
|
const postCssDependencies = [
|
|
@@ -879,11 +746,10 @@ async function maybeUsePostCss(projectPath, opts) {
|
|
|
879
746
|
console.log(youAreAllSet('PostCSS'));
|
|
880
747
|
process.exit(0);
|
|
881
748
|
}
|
|
882
|
-
const postCssLoaderPath = external_path_.resolve(postcss_dirname, '..', 'node_modules', 'postcss-loader');
|
|
883
749
|
return {
|
|
884
750
|
test: /\.css$/,
|
|
885
751
|
type: 'css',
|
|
886
|
-
loader:
|
|
752
|
+
loader: require.resolve('postcss-loader'),
|
|
887
753
|
options: {
|
|
888
754
|
postcssOptions: {
|
|
889
755
|
ident: 'postcss',
|
|
@@ -920,7 +786,7 @@ async function commonStyleLoaders(projectPath, opts) {
|
|
|
920
786
|
return styleLoaders.filter(Boolean);
|
|
921
787
|
}
|
|
922
788
|
async function cssInContentScriptLoader(projectPath, mode) {
|
|
923
|
-
const manifestPath =
|
|
789
|
+
const manifestPath = external_path_namespaceObject.join(projectPath, 'manifest.json');
|
|
924
790
|
return [
|
|
925
791
|
{
|
|
926
792
|
test: /\.css$/,
|
|
@@ -936,7 +802,7 @@ async function cssInContentScriptLoader(projectPath, mode) {
|
|
|
936
802
|
];
|
|
937
803
|
}
|
|
938
804
|
async function cssInHtmlLoader(projectPath, mode) {
|
|
939
|
-
const manifestPath =
|
|
805
|
+
const manifestPath = external_path_namespaceObject.join(projectPath, 'manifest.json');
|
|
940
806
|
return [
|
|
941
807
|
{
|
|
942
808
|
test: /\.css$/,
|
|
@@ -961,7 +827,7 @@ function plugin_css_define_property(obj, key, value) {
|
|
|
961
827
|
class CssPlugin {
|
|
962
828
|
async configureOptions(compiler) {
|
|
963
829
|
const mode = compiler.options.mode || 'development';
|
|
964
|
-
const projectPath =
|
|
830
|
+
const projectPath = external_path_namespaceObject.dirname(this.manifestPath);
|
|
965
831
|
const plugins = [];
|
|
966
832
|
const maybeInstallStylelint = await maybeUseStylelint(projectPath);
|
|
967
833
|
plugins.push(...maybeInstallStylelint);
|
|
@@ -1087,12 +953,12 @@ const babelConfigFiles = [
|
|
|
1087
953
|
'babel.config.cjs'
|
|
1088
954
|
];
|
|
1089
955
|
function babel_isUsingBabel(projectPath) {
|
|
1090
|
-
const packageJsonPath =
|
|
1091
|
-
if (!
|
|
1092
|
-
const packageJson = JSON.parse(
|
|
956
|
+
const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
|
|
957
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
|
|
958
|
+
const packageJson = JSON.parse(external_fs_namespaceObject.readFileSync(packageJsonPath, 'utf-8'));
|
|
1093
959
|
const babelAsDevDep = packageJson.devDependencies && packageJson.devDependencies['babel-core'];
|
|
1094
960
|
const babelAsDep = packageJson.dependencies && packageJson.dependencies['babel-core'];
|
|
1095
|
-
const isUsingBabel = babelConfigFiles.some((file)=>
|
|
961
|
+
const isUsingBabel = babelConfigFiles.some((file)=>external_fs_namespaceObject.existsSync(external_path_namespaceObject.join(projectPath, file))) || !!babelAsDevDep || !!babelAsDep;
|
|
1096
962
|
if (isUsingBabel) {
|
|
1097
963
|
if (!babel_userMessageDelivered) {
|
|
1098
964
|
if ('development' === process.env.EXTENSION_ENV) {
|
|
@@ -1106,11 +972,13 @@ function babel_isUsingBabel(projectPath) {
|
|
|
1106
972
|
async function maybeUseBabel(_compiler, projectPath) {
|
|
1107
973
|
babel_isUsingBabel(projectPath);
|
|
1108
974
|
}
|
|
975
|
+
const plugin_preact_refresh_namespaceObject = require("@rspack/plugin-preact-refresh");
|
|
976
|
+
var plugin_preact_refresh_default = /*#__PURE__*/ __webpack_require__.n(plugin_preact_refresh_namespaceObject);
|
|
1109
977
|
let preact_userMessageDelivered = false;
|
|
1110
978
|
function isUsingPreact(projectPath) {
|
|
1111
|
-
const packageJsonPath =
|
|
1112
|
-
if (!
|
|
1113
|
-
const packageJson = JSON.parse(
|
|
979
|
+
const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
|
|
980
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
|
|
981
|
+
const packageJson = JSON.parse(external_fs_namespaceObject.readFileSync(packageJsonPath, 'utf-8'));
|
|
1114
982
|
const preactAsDevDep = packageJson.devDependencies && packageJson.devDependencies.preact;
|
|
1115
983
|
const preactAsDep = packageJson.dependencies && packageJson.dependencies.preact;
|
|
1116
984
|
if (preactAsDevDep || preactAsDep) {
|
|
@@ -1124,7 +992,7 @@ function isUsingPreact(projectPath) {
|
|
|
1124
992
|
async function maybeUsePreact(projectPath) {
|
|
1125
993
|
if (!isUsingPreact(projectPath)) return;
|
|
1126
994
|
try {
|
|
1127
|
-
|
|
995
|
+
require.resolve('@rspack/plugin-preact-refresh');
|
|
1128
996
|
} catch (e) {
|
|
1129
997
|
const preactDependencies = [
|
|
1130
998
|
'@prefresh/core',
|
|
@@ -1137,7 +1005,7 @@ async function maybeUsePreact(projectPath) {
|
|
|
1137
1005
|
process.exit(0);
|
|
1138
1006
|
}
|
|
1139
1007
|
const preactPlugins = [
|
|
1140
|
-
new
|
|
1008
|
+
new (plugin_preact_refresh_default())({})
|
|
1141
1009
|
];
|
|
1142
1010
|
return {
|
|
1143
1011
|
plugins: preactPlugins,
|
|
@@ -1150,11 +1018,13 @@ async function maybeUsePreact(projectPath) {
|
|
|
1150
1018
|
}
|
|
1151
1019
|
};
|
|
1152
1020
|
}
|
|
1021
|
+
const plugin_react_refresh_namespaceObject = require("@rspack/plugin-react-refresh");
|
|
1022
|
+
var plugin_react_refresh_default = /*#__PURE__*/ __webpack_require__.n(plugin_react_refresh_namespaceObject);
|
|
1153
1023
|
let react_userMessageDelivered = false;
|
|
1154
1024
|
function isUsingReact(projectPath) {
|
|
1155
|
-
const packageJsonPath =
|
|
1156
|
-
if (!
|
|
1157
|
-
const packageJson = JSON.parse(
|
|
1025
|
+
const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
|
|
1026
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
|
|
1027
|
+
const packageJson = JSON.parse(external_fs_namespaceObject.readFileSync(packageJsonPath, 'utf-8'));
|
|
1158
1028
|
const reactAsDevDep = packageJson.devDependencies && packageJson.devDependencies.react;
|
|
1159
1029
|
const reactAsDep = packageJson.dependencies && packageJson.dependencies.react;
|
|
1160
1030
|
if (reactAsDevDep || reactAsDep) {
|
|
@@ -1168,7 +1038,7 @@ function isUsingReact(projectPath) {
|
|
|
1168
1038
|
async function maybeUseReact(projectPath) {
|
|
1169
1039
|
if (!isUsingReact(projectPath)) return;
|
|
1170
1040
|
try {
|
|
1171
|
-
|
|
1041
|
+
require.resolve('react-refresh');
|
|
1172
1042
|
} catch (e) {
|
|
1173
1043
|
const reactDependencies = [
|
|
1174
1044
|
'react-refresh',
|
|
@@ -1179,7 +1049,7 @@ async function maybeUseReact(projectPath) {
|
|
|
1179
1049
|
process.exit(0);
|
|
1180
1050
|
}
|
|
1181
1051
|
const reactPlugins = [
|
|
1182
|
-
new
|
|
1052
|
+
new (plugin_react_refresh_default())({
|
|
1183
1053
|
overlay: false
|
|
1184
1054
|
})
|
|
1185
1055
|
];
|
|
@@ -1189,12 +1059,12 @@ async function maybeUseReact(projectPath) {
|
|
|
1189
1059
|
alias: void 0
|
|
1190
1060
|
};
|
|
1191
1061
|
}
|
|
1192
|
-
const
|
|
1062
|
+
const external_vue_loader_namespaceObject = require("vue-loader");
|
|
1193
1063
|
let vue_userMessageDelivered = false;
|
|
1194
1064
|
function isUsingVue(projectPath) {
|
|
1195
|
-
const packageJsonPath =
|
|
1196
|
-
if (!
|
|
1197
|
-
const packageJson = JSON.parse(
|
|
1065
|
+
const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
|
|
1066
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
|
|
1067
|
+
const packageJson = JSON.parse(external_fs_namespaceObject.readFileSync(packageJsonPath, 'utf-8'));
|
|
1198
1068
|
const vueAsDevDep = packageJson.devDependencies && packageJson.devDependencies.vue;
|
|
1199
1069
|
const vueAsDep = packageJson.dependencies && packageJson.dependencies.vue;
|
|
1200
1070
|
if (vueAsDevDep || vueAsDep) {
|
|
@@ -1208,7 +1078,7 @@ function isUsingVue(projectPath) {
|
|
|
1208
1078
|
async function maybeUseVue(projectPath) {
|
|
1209
1079
|
if (!isUsingVue(projectPath)) return;
|
|
1210
1080
|
try {
|
|
1211
|
-
|
|
1081
|
+
require.resolve('vue-loader');
|
|
1212
1082
|
} catch (e) {
|
|
1213
1083
|
const vueDependencies = [
|
|
1214
1084
|
'vue-loader',
|
|
@@ -1219,11 +1089,10 @@ async function maybeUseVue(projectPath) {
|
|
|
1219
1089
|
console.log(youAreAllSet('Vue'));
|
|
1220
1090
|
process.exit(0);
|
|
1221
1091
|
}
|
|
1222
|
-
const vueLoaderPath = external_path_.resolve(vue_dirname, '..', 'node_modules', 'vue-loader');
|
|
1223
1092
|
const vueLoaders = [
|
|
1224
1093
|
{
|
|
1225
1094
|
test: /\.vue$/,
|
|
1226
|
-
loader:
|
|
1095
|
+
loader: require.resolve('vue-loader'),
|
|
1227
1096
|
options: {
|
|
1228
1097
|
experimentalInlineMatchResource: true
|
|
1229
1098
|
},
|
|
@@ -1232,7 +1101,7 @@ async function maybeUseVue(projectPath) {
|
|
|
1232
1101
|
}
|
|
1233
1102
|
];
|
|
1234
1103
|
const vuePlugins = [
|
|
1235
|
-
new
|
|
1104
|
+
new external_vue_loader_namespaceObject.VueLoaderPlugin()
|
|
1236
1105
|
];
|
|
1237
1106
|
return {
|
|
1238
1107
|
plugins: vuePlugins,
|
|
@@ -1243,10 +1112,10 @@ async function maybeUseVue(projectPath) {
|
|
|
1243
1112
|
let typescript_userMessageDelivered = false;
|
|
1244
1113
|
function isUsingTypeScript(projectPath) {
|
|
1245
1114
|
var _packageJson_devDependencies, _packageJson_dependencies;
|
|
1246
|
-
const packageJsonPath =
|
|
1247
|
-
if (!
|
|
1115
|
+
const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
|
|
1116
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
|
|
1248
1117
|
const configFile = getUserTypeScriptConfigFile(projectPath);
|
|
1249
|
-
const packageJson = JSON.parse(
|
|
1118
|
+
const packageJson = JSON.parse(external_fs_namespaceObject.readFileSync(packageJsonPath, 'utf8'));
|
|
1250
1119
|
const TypeScriptAsDevDep = null == (_packageJson_devDependencies = packageJson.devDependencies) ? void 0 : _packageJson_devDependencies.typescript;
|
|
1251
1120
|
const TypeScriptAsDep = null == (_packageJson_dependencies = packageJson.dependencies) ? void 0 : _packageJson_dependencies.typescript;
|
|
1252
1121
|
if (!typescript_userMessageDelivered) {
|
|
@@ -1288,21 +1157,20 @@ function defaultTypeScriptConfig(projectPath, _opts) {
|
|
|
1288
1157
|
};
|
|
1289
1158
|
}
|
|
1290
1159
|
function getUserTypeScriptConfigFile(projectPath) {
|
|
1291
|
-
const configFile =
|
|
1292
|
-
if (
|
|
1160
|
+
const configFile = external_path_namespaceObject.join(projectPath, 'tsconfig.json');
|
|
1161
|
+
if (external_fs_namespaceObject.existsSync(configFile)) return configFile;
|
|
1293
1162
|
}
|
|
1294
1163
|
function writeTsConfig(projectPath) {
|
|
1295
|
-
|
|
1164
|
+
external_fs_namespaceObject.writeFileSync(external_path_namespaceObject.join(projectPath, 'tsconfig.json'), JSON.stringify(defaultTypeScriptConfig(projectPath, {
|
|
1296
1165
|
mode: 'development'
|
|
1297
1166
|
}), null, 2));
|
|
1298
1167
|
}
|
|
1299
|
-
const svelte_dirname = getDirname(import.meta.url);
|
|
1300
1168
|
let svelte_userMessageDelivered = false;
|
|
1301
1169
|
function isUsingSvelte(projectPath) {
|
|
1302
1170
|
var _packageJson_devDependencies;
|
|
1303
|
-
const packageJsonPath =
|
|
1304
|
-
if (!
|
|
1305
|
-
const packageJson = JSON.parse(
|
|
1171
|
+
const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
|
|
1172
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
|
|
1173
|
+
const packageJson = JSON.parse(external_fs_namespaceObject.readFileSync(packageJsonPath, 'utf-8'));
|
|
1306
1174
|
const svelteAsDevDep = packageJson.devDependencies && (null == (_packageJson_devDependencies = packageJson.devDependencies) ? void 0 : _packageJson_devDependencies.svelte);
|
|
1307
1175
|
const svelteAsDep = packageJson.dependencies && packageJson.dependencies.svelte;
|
|
1308
1176
|
if (svelteAsDevDep || svelteAsDep) {
|
|
@@ -1316,7 +1184,7 @@ function isUsingSvelte(projectPath) {
|
|
|
1316
1184
|
async function maybeUseSvelte(projectPath, mode) {
|
|
1317
1185
|
if (!isUsingSvelte(projectPath)) return;
|
|
1318
1186
|
try {
|
|
1319
|
-
|
|
1187
|
+
require.resolve('svelte-loader');
|
|
1320
1188
|
} catch (e) {
|
|
1321
1189
|
const typeScriptDependencies = [
|
|
1322
1190
|
"typescript"
|
|
@@ -1329,12 +1197,11 @@ async function maybeUseSvelte(projectPath, mode) {
|
|
|
1329
1197
|
console.log(youAreAllSet('Svelte'));
|
|
1330
1198
|
process.exit(0);
|
|
1331
1199
|
}
|
|
1332
|
-
const svelteLoaderPath = external_path_.resolve(svelte_dirname, '..', 'node_modules', 'svelte-loader');
|
|
1333
1200
|
const svelteLoaders = [
|
|
1334
1201
|
{
|
|
1335
1202
|
test: /\.svelte\.ts$/,
|
|
1336
1203
|
use: [
|
|
1337
|
-
|
|
1204
|
+
require.resolve('svelte-loader')
|
|
1338
1205
|
],
|
|
1339
1206
|
include: projectPath,
|
|
1340
1207
|
exclude: /node_modules/
|
|
@@ -1342,7 +1209,7 @@ async function maybeUseSvelte(projectPath, mode) {
|
|
|
1342
1209
|
{
|
|
1343
1210
|
test: /\.(svelte|svelte\.js)$/,
|
|
1344
1211
|
use: {
|
|
1345
|
-
loader:
|
|
1212
|
+
loader: require.resolve('svelte-loader'),
|
|
1346
1213
|
options: {
|
|
1347
1214
|
emitCss: true,
|
|
1348
1215
|
compilerOptions: {
|
|
@@ -1382,7 +1249,7 @@ class JsFrameworksPlugin {
|
|
|
1382
1249
|
async configureOptions(compiler) {
|
|
1383
1250
|
var _maybeInstallReact_plugins, _maybeInstallPreact_plugins, _maybeInstallVue_plugins, _maybeInstallSvelte_plugins;
|
|
1384
1251
|
const mode = compiler.options.mode || 'development';
|
|
1385
|
-
const projectPath =
|
|
1252
|
+
const projectPath = external_path_namespaceObject.dirname(this.manifestPath);
|
|
1386
1253
|
const maybeInstallBabel = await maybeUseBabel(compiler, projectPath);
|
|
1387
1254
|
const maybeInstallReact = await maybeUseReact(projectPath);
|
|
1388
1255
|
const maybeInstallPreact = await maybeUsePreact(projectPath);
|
|
@@ -1400,7 +1267,7 @@ class JsFrameworksPlugin {
|
|
|
1400
1267
|
{
|
|
1401
1268
|
test: /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,
|
|
1402
1269
|
include: [
|
|
1403
|
-
|
|
1270
|
+
external_path_namespaceObject.dirname(this.manifestPath)
|
|
1404
1271
|
],
|
|
1405
1272
|
exclude: [
|
|
1406
1273
|
/[\\/]node_modules[\\/]/
|
|
@@ -1457,7 +1324,7 @@ class JsFrameworksPlugin {
|
|
|
1457
1324
|
null == maybeInstallVue || null == (_maybeInstallVue_plugins = maybeInstallVue.plugins) || _maybeInstallVue_plugins.forEach((plugin)=>plugin.apply(compiler));
|
|
1458
1325
|
null == maybeInstallSvelte || null == (_maybeInstallSvelte_plugins = maybeInstallSvelte.plugins) || _maybeInstallSvelte_plugins.forEach((plugin)=>plugin.apply(compiler));
|
|
1459
1326
|
if (isUsingTypeScript(projectPath)) compiler.options.resolve.tsConfig = {
|
|
1460
|
-
configFile:
|
|
1327
|
+
configFile: external_path_namespaceObject.resolve(external_path_namespaceObject.dirname(this.manifestPath), 'tsconfig.json')
|
|
1461
1328
|
};
|
|
1462
1329
|
}
|
|
1463
1330
|
async apply(compiler) {
|
|
@@ -1476,12 +1343,12 @@ plugin_js_frameworks_define_property(JsFrameworksPlugin, "name", 'plugin-js-fram
|
|
|
1476
1343
|
function action(context, manifest) {
|
|
1477
1344
|
if (!manifest || !manifest.action || !manifest.action.default_popup) return;
|
|
1478
1345
|
const actionPage = manifest.action.default_popup;
|
|
1479
|
-
return
|
|
1346
|
+
return external_path_namespaceObject.join(context, actionPage);
|
|
1480
1347
|
}
|
|
1481
1348
|
function browserAction(context, manifest) {
|
|
1482
1349
|
if (!manifest || !manifest.browser_action || !manifest.browser_action.default_popup) return;
|
|
1483
1350
|
const browserActionPage = manifest.browser_action.default_popup;
|
|
1484
|
-
return
|
|
1351
|
+
return external_path_namespaceObject.join(context, browserActionPage);
|
|
1485
1352
|
}
|
|
1486
1353
|
function chromeUrlOverrides(context, manifest) {
|
|
1487
1354
|
let chromeUrlOverride = {
|
|
@@ -1493,19 +1360,19 @@ function chromeUrlOverrides(context, manifest) {
|
|
|
1493
1360
|
if (manifest.chrome_url_overrides.history) {
|
|
1494
1361
|
const historyPage = manifest.chrome_url_overrides.history;
|
|
1495
1362
|
chromeUrlOverride = {
|
|
1496
|
-
'chrome_url_overrides/history':
|
|
1363
|
+
'chrome_url_overrides/history': external_path_namespaceObject.join(context, historyPage)
|
|
1497
1364
|
};
|
|
1498
1365
|
}
|
|
1499
1366
|
if (manifest.chrome_url_overrides.newtab) {
|
|
1500
1367
|
const newtabPage = manifest.chrome_url_overrides.newtab;
|
|
1501
1368
|
chromeUrlOverride = {
|
|
1502
|
-
'chrome_url_overrides/newtab':
|
|
1369
|
+
'chrome_url_overrides/newtab': external_path_namespaceObject.join(context, newtabPage)
|
|
1503
1370
|
};
|
|
1504
1371
|
}
|
|
1505
1372
|
if (manifest.chrome_url_overrides.bookmarks) {
|
|
1506
1373
|
const bookmarksPage = manifest.chrome_url_overrides.bookmarks;
|
|
1507
1374
|
chromeUrlOverride = {
|
|
1508
|
-
'chrome_url_overrides/bookmarks':
|
|
1375
|
+
'chrome_url_overrides/bookmarks': external_path_namespaceObject.join(context, bookmarksPage)
|
|
1509
1376
|
};
|
|
1510
1377
|
}
|
|
1511
1378
|
return chromeUrlOverride;
|
|
@@ -1513,21 +1380,21 @@ function chromeUrlOverrides(context, manifest) {
|
|
|
1513
1380
|
function devtools_page_devtoolsPage(context, manifest) {
|
|
1514
1381
|
if (!manifest || !manifest.devtools_page) return;
|
|
1515
1382
|
const devtoolsPage = manifest.devtools_page;
|
|
1516
|
-
return
|
|
1383
|
+
return external_path_namespaceObject.join(context, devtoolsPage);
|
|
1517
1384
|
}
|
|
1518
1385
|
function optionsUi(context, manifest) {
|
|
1519
1386
|
if (manifest.options_page) {
|
|
1520
1387
|
const optionsPage = manifest.options_page;
|
|
1521
|
-
return
|
|
1388
|
+
return external_path_namespaceObject.join(context, optionsPage);
|
|
1522
1389
|
}
|
|
1523
1390
|
if (!manifest || !manifest.options_ui || !manifest.options_ui.page) return;
|
|
1524
1391
|
const optionsPage = manifest.options_ui.page;
|
|
1525
|
-
return
|
|
1392
|
+
return external_path_namespaceObject.join(context, optionsPage);
|
|
1526
1393
|
}
|
|
1527
1394
|
function pageAction(context, manifest) {
|
|
1528
1395
|
if (!manifest || !manifest.page_action || !manifest.page_action.default_popup) return;
|
|
1529
1396
|
const pageActionPage = manifest.page_action.default_popup;
|
|
1530
|
-
return
|
|
1397
|
+
return external_path_namespaceObject.join(context, pageActionPage);
|
|
1531
1398
|
}
|
|
1532
1399
|
function sandbox(context, manifest) {
|
|
1533
1400
|
if (!manifest || !manifest.sandbox || !manifest.sandbox.pages) return {
|
|
@@ -1535,18 +1402,18 @@ function sandbox(context, manifest) {
|
|
|
1535
1402
|
};
|
|
1536
1403
|
const sandboxPages = manifest.sandbox.pages;
|
|
1537
1404
|
const sandboxedData = {};
|
|
1538
|
-
for (const [index, page] of sandboxPages.entries())sandboxedData[`sandbox/page-${index}`] =
|
|
1405
|
+
for (const [index, page] of sandboxPages.entries())sandboxedData[`sandbox/page-${index}`] = external_path_namespaceObject.join(context, page);
|
|
1539
1406
|
return sandboxedData;
|
|
1540
1407
|
}
|
|
1541
1408
|
function sidePanel(context, manifest) {
|
|
1542
1409
|
if (!manifest || !manifest.side_panel || !manifest.side_panel.default_path) return;
|
|
1543
1410
|
const sidePanelPage = manifest.side_panel.default_path;
|
|
1544
|
-
return
|
|
1411
|
+
return external_path_namespaceObject.join(context, sidePanelPage);
|
|
1545
1412
|
}
|
|
1546
1413
|
function sidebarAction(context, manifest) {
|
|
1547
1414
|
if (!manifest || !manifest.sidebar_action || !manifest.sidebar_action.default_panel) return;
|
|
1548
1415
|
const sidebarPage = manifest.sidebar_action.default_panel;
|
|
1549
|
-
return
|
|
1416
|
+
return external_path_namespaceObject.join(context, sidebarPage);
|
|
1550
1417
|
}
|
|
1551
1418
|
function html_fields_htmlFields(context, manifest) {
|
|
1552
1419
|
return {
|
|
@@ -1563,17 +1430,17 @@ function html_fields_htmlFields(context, manifest) {
|
|
|
1563
1430
|
}
|
|
1564
1431
|
function action_action(context, manifest) {
|
|
1565
1432
|
if (!manifest || !manifest.action || !manifest.action.default_icon) return;
|
|
1566
|
-
if ('string' == typeof manifest.action.default_icon) return
|
|
1433
|
+
if ('string' == typeof manifest.action.default_icon) return external_path_namespaceObject.join(context, manifest.action.default_icon);
|
|
1567
1434
|
const actionDefaultIcons = [];
|
|
1568
|
-
for(const icon in manifest.action.default_icon)actionDefaultIcons.push(
|
|
1435
|
+
for(const icon in manifest.action.default_icon)actionDefaultIcons.push(external_path_namespaceObject.join(context, manifest.action.default_icon[icon]));
|
|
1569
1436
|
return actionDefaultIcons;
|
|
1570
1437
|
}
|
|
1571
1438
|
function browser_action_browserAction(context, manifest) {
|
|
1572
1439
|
if (!manifest || !manifest.browser_action || !manifest.browser_action.default_icon) return;
|
|
1573
1440
|
const browserActionDefaultIcons = [];
|
|
1574
|
-
if ('string' == typeof manifest.browser_action.default_icon) return
|
|
1441
|
+
if ('string' == typeof manifest.browser_action.default_icon) return external_path_namespaceObject.join(context, manifest.browser_action.default_icon);
|
|
1575
1442
|
for(const icon in manifest.browser_action.default_icon){
|
|
1576
|
-
const browserActionDefaultIconAbsolutePath = manifest.browser_action.default_icon[icon] =
|
|
1443
|
+
const browserActionDefaultIconAbsolutePath = manifest.browser_action.default_icon[icon] = external_path_namespaceObject.join(context, manifest.browser_action.default_icon[icon]);
|
|
1577
1444
|
browserActionDefaultIcons.push(browserActionDefaultIconAbsolutePath);
|
|
1578
1445
|
}
|
|
1579
1446
|
return browserActionDefaultIcons;
|
|
@@ -1581,8 +1448,8 @@ function browser_action_browserAction(context, manifest) {
|
|
|
1581
1448
|
function browserActionThemeIcons(context, manifest) {
|
|
1582
1449
|
if (!manifest || !manifest.browser_action || !manifest.browser_action.theme_icons) return;
|
|
1583
1450
|
for (const themeIcon of manifest.browser_action.theme_icons){
|
|
1584
|
-
if (themeIcon.light) themeIcon.light =
|
|
1585
|
-
if (themeIcon.dark) themeIcon.dark =
|
|
1451
|
+
if (themeIcon.light) themeIcon.light = external_path_namespaceObject.join(context, themeIcon.light);
|
|
1452
|
+
if (themeIcon.dark) themeIcon.dark = external_path_namespaceObject.join(context, themeIcon.dark);
|
|
1586
1453
|
if (themeIcon.size) delete themeIcon.size;
|
|
1587
1454
|
}
|
|
1588
1455
|
return manifest.browser_action.theme_icons;
|
|
@@ -1591,24 +1458,24 @@ function icons(context, manifest) {
|
|
|
1591
1458
|
if (!manifest || !manifest.icons) return;
|
|
1592
1459
|
const defaultIcons = [];
|
|
1593
1460
|
for(const icon in manifest.icons){
|
|
1594
|
-
const iconAbsolutePath =
|
|
1461
|
+
const iconAbsolutePath = external_path_namespaceObject.join(context, manifest.icons[icon]);
|
|
1595
1462
|
defaultIcons.push(iconAbsolutePath);
|
|
1596
1463
|
}
|
|
1597
1464
|
return defaultIcons;
|
|
1598
1465
|
}
|
|
1599
1466
|
function page_action_pageAction(context, manifest) {
|
|
1600
1467
|
if (!manifest || !manifest.page_action || !manifest.page_action.default_icon) return;
|
|
1601
|
-
if ('string' == typeof manifest.page_action.default_icon) return
|
|
1468
|
+
if ('string' == typeof manifest.page_action.default_icon) return external_path_namespaceObject.join(context, manifest.page_action.default_icon);
|
|
1602
1469
|
const pageActionDefaultIcons = [];
|
|
1603
1470
|
for(const icon in manifest.page_action.default_icon){
|
|
1604
|
-
const pageactionDefaultIconAbsolutePath =
|
|
1471
|
+
const pageactionDefaultIconAbsolutePath = external_path_namespaceObject.join(context, manifest.page_action.default_icon[icon]);
|
|
1605
1472
|
pageActionDefaultIcons.push(pageactionDefaultIconAbsolutePath);
|
|
1606
1473
|
}
|
|
1607
1474
|
return pageActionDefaultIcons;
|
|
1608
1475
|
}
|
|
1609
1476
|
function sidebar_action_sidebarAction(context, manifest) {
|
|
1610
1477
|
if (!manifest || !manifest.sidebar_action || !manifest.sidebar_action.default_icon) return;
|
|
1611
|
-
const sidebarActionDefaultIcon =
|
|
1478
|
+
const sidebarActionDefaultIcon = external_path_namespaceObject.join(context, manifest.sidebar_action.default_icon);
|
|
1612
1479
|
return sidebarActionDefaultIcon;
|
|
1613
1480
|
}
|
|
1614
1481
|
function icons_fields_iconFields(context, manifest) {
|
|
@@ -1628,14 +1495,14 @@ function declarative_net_request_declarativeNetRequest(context, manifest) {
|
|
|
1628
1495
|
};
|
|
1629
1496
|
const declarativeNetRequest = manifest.declarative_net_request.rule_resources;
|
|
1630
1497
|
declarativeNetRequest.forEach((resource)=>{
|
|
1631
|
-
ruleResources[`declarative_net_request/${resource.id}`] =
|
|
1498
|
+
ruleResources[`declarative_net_request/${resource.id}`] = external_path_namespaceObject.join(context, resource.path);
|
|
1632
1499
|
});
|
|
1633
1500
|
return ruleResources;
|
|
1634
1501
|
}
|
|
1635
1502
|
function storage(context, manifest) {
|
|
1636
1503
|
if (!manifest || !manifest.storage || !manifest.storage.managed_schema) return;
|
|
1637
1504
|
const storageManagedSchema = manifest.storage.managed_schema;
|
|
1638
|
-
return
|
|
1505
|
+
return external_path_namespaceObject.join(context, storageManagedSchema);
|
|
1639
1506
|
}
|
|
1640
1507
|
function json_fields_jsonFields(context, manifest) {
|
|
1641
1508
|
return {
|
|
@@ -1644,23 +1511,23 @@ function json_fields_jsonFields(context, manifest) {
|
|
|
1644
1511
|
};
|
|
1645
1512
|
}
|
|
1646
1513
|
function locales_fields_localesFields(context, manifestPath) {
|
|
1647
|
-
const localesFolder =
|
|
1514
|
+
const localesFolder = external_path_namespaceObject.join(external_path_namespaceObject.dirname(manifestPath), '_locales');
|
|
1648
1515
|
const localeFiles = [];
|
|
1649
|
-
if (
|
|
1650
|
-
const localeDir =
|
|
1651
|
-
if (localeDir &&
|
|
1516
|
+
if (external_fs_namespaceObject.existsSync(localesFolder)) for (const locale of external_fs_namespaceObject.readdirSync(localesFolder)){
|
|
1517
|
+
const localeDir = external_path_namespaceObject.join(localesFolder, locale);
|
|
1518
|
+
if (localeDir && external_fs_namespaceObject.statSync(localeDir).isDirectory()) for (const localeEntity of external_fs_namespaceObject.readdirSync(localeDir))localeFiles.push(external_path_namespaceObject.join(context, '_locales', locale, localeEntity));
|
|
1652
1519
|
}
|
|
1653
1520
|
return localeFiles;
|
|
1654
1521
|
}
|
|
1655
1522
|
function background_backgroundScripts(context, manifest) {
|
|
1656
1523
|
if (!manifest || !manifest.background) return;
|
|
1657
1524
|
const scripts = manifest.background.scripts;
|
|
1658
|
-
if (scripts) return scripts.map((script)=>
|
|
1525
|
+
if (scripts) return scripts.map((script)=>external_path_namespaceObject.join(context, script));
|
|
1659
1526
|
}
|
|
1660
1527
|
function service_worker_serviceWorker(context, manifest) {
|
|
1661
1528
|
if (!manifest || !manifest.background) return;
|
|
1662
1529
|
const serviceWorker = manifest.background.service_worker;
|
|
1663
|
-
if (serviceWorker) return
|
|
1530
|
+
if (serviceWorker) return external_path_namespaceObject.join(context, serviceWorker);
|
|
1664
1531
|
}
|
|
1665
1532
|
function contentScripts(context, manifest) {
|
|
1666
1533
|
if (!manifest || !manifest.content_scripts) return {
|
|
@@ -1670,7 +1537,7 @@ function contentScripts(context, manifest) {
|
|
|
1670
1537
|
var _content_js, _content_js1;
|
|
1671
1538
|
if ((null == (_content_js = content.js) ? void 0 : _content_js.length) === 0) return;
|
|
1672
1539
|
return null == (_content_js1 = content.js) ? void 0 : _content_js1.map((js)=>{
|
|
1673
|
-
const contentPath =
|
|
1540
|
+
const contentPath = external_path_namespaceObject.join(context, js);
|
|
1674
1541
|
return contentPath;
|
|
1675
1542
|
});
|
|
1676
1543
|
};
|
|
@@ -1678,7 +1545,7 @@ function contentScripts(context, manifest) {
|
|
|
1678
1545
|
var _content_css, _content_css1;
|
|
1679
1546
|
if ((null == (_content_css = content.css) ? void 0 : _content_css.length) === 0) return;
|
|
1680
1547
|
return null == (_content_css1 = content.css) ? void 0 : _content_css1.map((css)=>{
|
|
1681
|
-
const contentPath =
|
|
1548
|
+
const contentPath = external_path_namespaceObject.join(context, css);
|
|
1682
1549
|
return contentPath;
|
|
1683
1550
|
});
|
|
1684
1551
|
};
|
|
@@ -1696,7 +1563,7 @@ function contentScripts(context, manifest) {
|
|
|
1696
1563
|
function userScripts(context, manifest) {
|
|
1697
1564
|
if (!manifest || !manifest.user_scripts || !manifest.user_scripts.api_script) return;
|
|
1698
1565
|
const userScript = manifest.user_scripts.api_script;
|
|
1699
|
-
return
|
|
1566
|
+
return external_path_namespaceObject.join(context, userScript);
|
|
1700
1567
|
}
|
|
1701
1568
|
function scriptsFields(context, manifest) {
|
|
1702
1569
|
return {
|
|
@@ -1711,8 +1578,8 @@ function webResourcesFields(manifest) {
|
|
|
1711
1578
|
return manifest.web_accessible_resources;
|
|
1712
1579
|
}
|
|
1713
1580
|
function getManifestFieldsData({ manifestPath, browser }) {
|
|
1714
|
-
const context =
|
|
1715
|
-
const manifest = JSON.parse(
|
|
1581
|
+
const context = external_path_namespaceObject.dirname(manifestPath);
|
|
1582
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf8'));
|
|
1716
1583
|
const manifestNoPrefixes = filterKeysForThisBrowser(manifest, browser || 'chrome');
|
|
1717
1584
|
const fieldData = {
|
|
1718
1585
|
html: html_fields_htmlFields(context, manifestNoPrefixes),
|
|
@@ -1725,14 +1592,14 @@ function getManifestFieldsData({ manifestPath, browser }) {
|
|
|
1725
1592
|
return fieldData;
|
|
1726
1593
|
}
|
|
1727
1594
|
function scanFilesInFolder(dirPath, filter) {
|
|
1728
|
-
if (!
|
|
1595
|
+
if (!external_fs_namespaceObject.existsSync(dirPath) || !external_fs_namespaceObject.statSync(dirPath).isDirectory()) return [];
|
|
1729
1596
|
const files = [];
|
|
1730
1597
|
function recurse(currentPath) {
|
|
1731
|
-
const entries =
|
|
1598
|
+
const entries = external_fs_namespaceObject.readdirSync(currentPath, {
|
|
1732
1599
|
withFileTypes: true
|
|
1733
1600
|
});
|
|
1734
1601
|
for (const entry of entries){
|
|
1735
|
-
const entryPath =
|
|
1602
|
+
const entryPath = external_path_namespaceObject.join(currentPath, entry.name);
|
|
1736
1603
|
if (entry.isDirectory()) recurse(entryPath);
|
|
1737
1604
|
else if (entry.isFile() && filter(entry.name)) files.push(entryPath);
|
|
1738
1605
|
}
|
|
@@ -1743,9 +1610,9 @@ function scanFilesInFolder(dirPath, filter) {
|
|
|
1743
1610
|
function generateEntries(projectPath, includes, folderName = '') {
|
|
1744
1611
|
if (!includes || !includes.length) return {};
|
|
1745
1612
|
return includes.reduce((acc, include)=>{
|
|
1746
|
-
const extname =
|
|
1747
|
-
const filename =
|
|
1748
|
-
const key = folderName ? `${folderName}/${filename}` :
|
|
1613
|
+
const extname = external_path_namespaceObject.extname(include);
|
|
1614
|
+
const filename = external_path_namespaceObject.basename(include, extname);
|
|
1615
|
+
const key = folderName ? `${folderName}/${filename}` : external_path_namespaceObject.relative(projectPath, include);
|
|
1749
1616
|
return {
|
|
1750
1617
|
...acc,
|
|
1751
1618
|
[key]: include
|
|
@@ -1753,11 +1620,11 @@ function generateEntries(projectPath, includes, folderName = '') {
|
|
|
1753
1620
|
}, {});
|
|
1754
1621
|
}
|
|
1755
1622
|
function getSpecialFoldersData({ manifestPath }) {
|
|
1756
|
-
const projectPath =
|
|
1623
|
+
const projectPath = external_path_namespaceObject.dirname(manifestPath);
|
|
1757
1624
|
const folders = {
|
|
1758
|
-
public:
|
|
1759
|
-
pages:
|
|
1760
|
-
scripts:
|
|
1625
|
+
public: external_path_namespaceObject.join(projectPath, 'public'),
|
|
1626
|
+
pages: external_path_namespaceObject.join(projectPath, 'pages'),
|
|
1627
|
+
scripts: external_path_namespaceObject.join(projectPath, "scripts")
|
|
1761
1628
|
};
|
|
1762
1629
|
const allFiles = {
|
|
1763
1630
|
public: scanFilesInFolder(folders.public, ()=>true),
|
|
@@ -1771,7 +1638,7 @@ function getSpecialFoldersData({ manifestPath }) {
|
|
|
1771
1638
|
'.mts',
|
|
1772
1639
|
'.tsx',
|
|
1773
1640
|
'.mtsx'
|
|
1774
|
-
].includes(
|
|
1641
|
+
].includes(external_path_namespaceObject.extname(name)))
|
|
1775
1642
|
};
|
|
1776
1643
|
const entries = {
|
|
1777
1644
|
public: generateEntries(projectPath, allFiles.public),
|
|
@@ -1795,21 +1662,21 @@ class EmitManifest {
|
|
|
1795
1662
|
compiler.hooks.thisCompilation.tap('manifest:emit-manifest', (compilation)=>{
|
|
1796
1663
|
compilation.hooks.processAssets.tap({
|
|
1797
1664
|
name: 'manifest:emit-manifest',
|
|
1798
|
-
stage:
|
|
1665
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_PRE_PROCESS
|
|
1799
1666
|
}, ()=>{
|
|
1800
1667
|
const manifestPath = this.manifestPath;
|
|
1801
1668
|
let jsonContent;
|
|
1802
1669
|
try {
|
|
1803
|
-
const content =
|
|
1670
|
+
const content = external_fs_namespaceObject.readFileSync(manifestPath, 'utf-8');
|
|
1804
1671
|
jsonContent = JSON.parse(content);
|
|
1805
1672
|
if ('$schema' in jsonContent) delete jsonContent['$schema'];
|
|
1806
1673
|
} catch (error) {
|
|
1807
|
-
compilation.errors.push(new
|
|
1674
|
+
compilation.errors.push(new (core_default()).WebpackError(manifestInvalidError(error)));
|
|
1808
1675
|
return;
|
|
1809
1676
|
}
|
|
1810
1677
|
const jsonString = JSON.stringify(jsonContent, null, 2);
|
|
1811
1678
|
const outputFilename = 'manifest.json';
|
|
1812
|
-
compilation.emitAsset(outputFilename, new
|
|
1679
|
+
compilation.emitAsset(outputFilename, new core_namespaceObject.sources.RawSource(jsonString));
|
|
1813
1680
|
});
|
|
1814
1681
|
});
|
|
1815
1682
|
}
|
|
@@ -1830,7 +1697,7 @@ function background(manifest, excludeList) {
|
|
|
1830
1697
|
}
|
|
1831
1698
|
};
|
|
1832
1699
|
}
|
|
1833
|
-
const getBasename = (filepath)=>
|
|
1700
|
+
const getBasename = (filepath)=>external_path_namespaceObject.basename(filepath);
|
|
1834
1701
|
function mv2_browser_action_browserAction(manifest, excludeList) {
|
|
1835
1702
|
return manifest.browser_action && {
|
|
1836
1703
|
browser_action: {
|
|
@@ -1876,7 +1743,7 @@ function manifestV2(manifest, excludeList) {
|
|
|
1876
1743
|
...mv2_declarative_net_request_declarativeNetRequest(manifest, excludeList)
|
|
1877
1744
|
};
|
|
1878
1745
|
}
|
|
1879
|
-
const action_getBasename = (filepath)=>
|
|
1746
|
+
const action_getBasename = (filepath)=>external_path_namespaceObject.basename(filepath);
|
|
1880
1747
|
function mv3_action_action(manifest, excludeList) {
|
|
1881
1748
|
return manifest.action && {
|
|
1882
1749
|
action: {
|
|
@@ -1970,7 +1837,7 @@ function common_devtools_page_devtoolsPage(manifest, excludeList) {
|
|
|
1970
1837
|
devtools_page: getFilename('devtools_page.html', manifest.devtools_page, excludeList)
|
|
1971
1838
|
};
|
|
1972
1839
|
}
|
|
1973
|
-
const icons_getBasename = (filepath)=>
|
|
1840
|
+
const icons_getBasename = (filepath)=>external_path_namespaceObject.basename(filepath);
|
|
1974
1841
|
function icons_icons(manifest, excludeList) {
|
|
1975
1842
|
return manifest.icons && {
|
|
1976
1843
|
icons: Object.fromEntries(Object.entries(manifest.icons).map(([size, icon])=>[
|
|
@@ -1994,7 +1861,7 @@ function options_ui_optionsUi(manifest, excludeList) {
|
|
|
1994
1861
|
}
|
|
1995
1862
|
};
|
|
1996
1863
|
}
|
|
1997
|
-
const page_action_getBasename = (filepath)=>
|
|
1864
|
+
const page_action_getBasename = (filepath)=>external_path_namespaceObject.basename(filepath);
|
|
1998
1865
|
function common_page_action_pageAction(manifest, excludeList) {
|
|
1999
1866
|
return manifest.page_action && {
|
|
2000
1867
|
page_action: {
|
|
@@ -2021,7 +1888,7 @@ function sandbox_sandbox(manifest, excludeList) {
|
|
|
2021
1888
|
}
|
|
2022
1889
|
};
|
|
2023
1890
|
}
|
|
2024
|
-
const sidebar_action_getBasename = (filepath)=>
|
|
1891
|
+
const sidebar_action_getBasename = (filepath)=>external_path_namespaceObject.basename(filepath);
|
|
2025
1892
|
function common_sidebar_action_sidebarAction(manifest, excludeList) {
|
|
2026
1893
|
return manifest.sidebar_action && {
|
|
2027
1894
|
sidebar_action: {
|
|
@@ -2044,7 +1911,7 @@ function storage_storage(manifest, excludeList) {
|
|
|
2044
1911
|
}
|
|
2045
1912
|
};
|
|
2046
1913
|
}
|
|
2047
|
-
const theme_getBasename = (filepath)=>
|
|
1914
|
+
const theme_getBasename = (filepath)=>external_path_namespaceObject.basename(filepath);
|
|
2048
1915
|
function theme(manifest, excludeList) {
|
|
2049
1916
|
return manifest.theme && {
|
|
2050
1917
|
theme: {
|
|
@@ -2093,7 +1960,7 @@ function manifestCommon(manifest, excludeList) {
|
|
|
2093
1960
|
};
|
|
2094
1961
|
}
|
|
2095
1962
|
function getManifestOverrides(manifestPath, manifest, excludeList) {
|
|
2096
|
-
const manifestContent = manifest || JSON.parse(
|
|
1963
|
+
const manifestContent = manifest || JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf8'));
|
|
2097
1964
|
return JSON.stringify({
|
|
2098
1965
|
...manifestContent,
|
|
2099
1966
|
...manifestCommon(manifestContent, excludeList),
|
|
@@ -2125,7 +1992,7 @@ class UpdateManifest {
|
|
|
2125
1992
|
compiler.hooks.thisCompilation.tap('manifest:update-manifest', (compilation)=>{
|
|
2126
1993
|
compilation.hooks.processAssets.tap({
|
|
2127
1994
|
name: 'manifest:update-manifest',
|
|
2128
|
-
stage:
|
|
1995
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
2129
1996
|
}, ()=>{
|
|
2130
1997
|
if (compilation.errors.length > 0) return;
|
|
2131
1998
|
const manifest = getManifestContent(compilation, this.manifestPath);
|
|
@@ -2138,7 +2005,7 @@ class UpdateManifest {
|
|
|
2138
2005
|
if (patchedManifest.content_scripts) patchedManifest.content_scripts = this.applyDevOverrides(patchedManifest);
|
|
2139
2006
|
}
|
|
2140
2007
|
const source = JSON.stringify(patchedManifest, null, 2);
|
|
2141
|
-
const rawSource = new
|
|
2008
|
+
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
2142
2009
|
compilation.updateAsset('manifest.json', rawSource);
|
|
2143
2010
|
});
|
|
2144
2011
|
if ('production' === compiler.options.mode) compilation.hooks.processAssets.tap('manifest:update-manifest', ()=>{
|
|
@@ -2150,7 +2017,7 @@ class UpdateManifest {
|
|
|
2150
2017
|
...JSON.parse(overrides)
|
|
2151
2018
|
};
|
|
2152
2019
|
const source = JSON.stringify(patchedManifest, null, 2);
|
|
2153
|
-
const rawSource = new
|
|
2020
|
+
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
2154
2021
|
compilation.updateAsset('manifest.json', rawSource);
|
|
2155
2022
|
});
|
|
2156
2023
|
});
|
|
@@ -2179,7 +2046,7 @@ class AddDependencies {
|
|
|
2179
2046
|
if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
|
|
2180
2047
|
const fileDependencies = new Set(compilation.fileDependencies);
|
|
2181
2048
|
if (this.dependencyList) this.dependencyList.forEach((dependency)=>{
|
|
2182
|
-
if (!
|
|
2049
|
+
if (!external_fs_namespaceObject.existsSync(dependency)) return;
|
|
2183
2050
|
if (!fileDependencies.has(dependency)) {
|
|
2184
2051
|
fileDependencies.add(dependency);
|
|
2185
2052
|
compilation.fileDependencies.add(dependency);
|
|
@@ -2240,11 +2107,11 @@ class CheckManifestFiles {
|
|
|
2240
2107
|
for (const [field, value] of entries)if (value) {
|
|
2241
2108
|
const valueArr = this.extractPaths(value);
|
|
2242
2109
|
for (const item of valueArr){
|
|
2243
|
-
const ext =
|
|
2244
|
-
const manifest = JSON.parse(
|
|
2110
|
+
const ext = external_path_namespaceObject.extname(item);
|
|
2111
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(this.manifestPath, 'utf8'));
|
|
2245
2112
|
const patchedManifest = filterKeysForThisBrowser(manifest, 'chrome');
|
|
2246
2113
|
const manifestName = patchedManifest.name || 'Extension.js';
|
|
2247
|
-
if (!
|
|
2114
|
+
if (!external_fs_namespaceObject.existsSync(item)) {
|
|
2248
2115
|
if (item.startsWith('/')) return;
|
|
2249
2116
|
const fieldError = manifestFieldError(manifestName, field, item);
|
|
2250
2117
|
iconExts.includes(ext) || jsonExts.includes(ext) || scriptExts.includes(ext), compilation.errors.push(new WebpackError(fieldError));
|
|
@@ -2256,9 +2123,9 @@ class CheckManifestFiles {
|
|
|
2256
2123
|
compiler.hooks.compilation.tap('manifest:check-manifest-files', (compilation)=>{
|
|
2257
2124
|
compilation.hooks.processAssets.tap({
|
|
2258
2125
|
name: 'compatibility:check-manifest-files',
|
|
2259
|
-
stage:
|
|
2126
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT
|
|
2260
2127
|
}, ()=>{
|
|
2261
|
-
const WebpackError =
|
|
2128
|
+
const WebpackError = core_default().WebpackError;
|
|
2262
2129
|
this.handleErrors(compilation, WebpackError);
|
|
2263
2130
|
});
|
|
2264
2131
|
});
|
|
@@ -2292,15 +2159,15 @@ class ThrowIfRecompileIsNeeded {
|
|
|
2292
2159
|
if (files.has(this.manifestPath)) {
|
|
2293
2160
|
const context = compiler.options.context || '';
|
|
2294
2161
|
const packageJsonPath = `${context}/package.json`;
|
|
2295
|
-
if (!
|
|
2296
|
-
const initialManifest = JSON.parse(
|
|
2162
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return void done();
|
|
2163
|
+
const initialManifest = JSON.parse(external_fs_namespaceObject.readFileSync(this.manifestPath, 'utf-8'));
|
|
2297
2164
|
const manifest = filterKeysForThisBrowser(initialManifest, this.browser);
|
|
2298
2165
|
const initialHtml = this.flattenAndSort(Object.values(html_fields_htmlFields(context, manifest)));
|
|
2299
2166
|
const initialScripts = this.flattenAndSort(Object.values(scriptsFields(context, manifest)));
|
|
2300
2167
|
compiler.hooks.thisCompilation.tap('manifest:throw-if-recompile-is-needed', (compilation)=>{
|
|
2301
2168
|
compilation.hooks.processAssets.tap({
|
|
2302
2169
|
name: 'manifest:check-manifest-files',
|
|
2303
|
-
stage:
|
|
2170
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY
|
|
2304
2171
|
}, ()=>{
|
|
2305
2172
|
const manifestAsset = compilation.getAsset('manifest.json');
|
|
2306
2173
|
const manifestStr = null == manifestAsset ? void 0 : manifestAsset.source.source().toString();
|
|
@@ -2311,7 +2178,7 @@ class ThrowIfRecompileIsNeeded {
|
|
|
2311
2178
|
const fileRemoved = initialHtml.filter((file)=>!updatedHtml.includes(file))[0];
|
|
2312
2179
|
const fileAdded = updatedHtml.filter((file)=>!initialHtml.includes(file))[0];
|
|
2313
2180
|
const errorMessage = serverRestartRequiredFromManifestError(fileAdded, fileRemoved);
|
|
2314
|
-
compilation.errors.push(new
|
|
2181
|
+
compilation.errors.push(new (core_default()).WebpackError(errorMessage));
|
|
2315
2182
|
}
|
|
2316
2183
|
});
|
|
2317
2184
|
});
|
|
@@ -2372,6 +2239,8 @@ class ManifestPlugin {
|
|
|
2372
2239
|
this.excludeList = options.excludeList;
|
|
2373
2240
|
}
|
|
2374
2241
|
}
|
|
2242
|
+
const external_parse5_utils_namespaceObject = require("parse5-utils");
|
|
2243
|
+
var external_parse5_utils_default = /*#__PURE__*/ __webpack_require__.n(external_parse5_utils_namespaceObject);
|
|
2375
2244
|
function isUrl(src) {
|
|
2376
2245
|
try {
|
|
2377
2246
|
new URL(src);
|
|
@@ -2383,7 +2252,7 @@ function isUrl(src) {
|
|
|
2383
2252
|
function parseHtml(node, onResourceFound) {
|
|
2384
2253
|
const { childNodes = [] } = node;
|
|
2385
2254
|
for (const childNode of childNodes)if ("script" === childNode.nodeName) {
|
|
2386
|
-
const src =
|
|
2255
|
+
const src = external_parse5_utils_default().getAttribute(childNode, 'src');
|
|
2387
2256
|
if (!src) continue;
|
|
2388
2257
|
if (isUrl(src)) continue;
|
|
2389
2258
|
onResourceFound({
|
|
@@ -2392,8 +2261,8 @@ function parseHtml(node, onResourceFound) {
|
|
|
2392
2261
|
assetType: "script"
|
|
2393
2262
|
});
|
|
2394
2263
|
} else if ('link' === childNode.nodeName) {
|
|
2395
|
-
const href =
|
|
2396
|
-
const rel =
|
|
2264
|
+
const href = external_parse5_utils_default().getAttribute(childNode, 'href');
|
|
2265
|
+
const rel = external_parse5_utils_default().getAttribute(childNode, 'rel');
|
|
2397
2266
|
if (!href) continue;
|
|
2398
2267
|
if (isUrl(href)) continue;
|
|
2399
2268
|
onResourceFound('dns-prefetch' === rel || 'icon' === rel || 'manifest' === rel || 'modulepreload' === rel || 'preconnect' === rel || 'prefetch' === rel || 'preload' === rel || 'prerender' === rel ? {
|
|
@@ -2406,7 +2275,7 @@ function parseHtml(node, onResourceFound) {
|
|
|
2406
2275
|
assetType: 'css'
|
|
2407
2276
|
});
|
|
2408
2277
|
} else if ('a' === childNode.nodeName || 'area' === childNode.nodeName) {
|
|
2409
|
-
const href =
|
|
2278
|
+
const href = external_parse5_utils_default().getAttribute(childNode, 'href');
|
|
2410
2279
|
if (!href) continue;
|
|
2411
2280
|
if (isUrl(href)) continue;
|
|
2412
2281
|
onResourceFound({
|
|
@@ -2415,7 +2284,7 @@ function parseHtml(node, onResourceFound) {
|
|
|
2415
2284
|
assetType: 'staticHref'
|
|
2416
2285
|
});
|
|
2417
2286
|
} else if ('audio' === childNode.nodeName || 'embed' === childNode.nodeName || 'iframe' === childNode.nodeName || 'img' === childNode.nodeName || 'input' === childNode.nodeName || 'source' === childNode.nodeName || 'track' === childNode.nodeName || 'video' === childNode.nodeName) {
|
|
2418
|
-
const src =
|
|
2287
|
+
const src = external_parse5_utils_default().getAttribute(childNode, 'src');
|
|
2419
2288
|
if (!src) continue;
|
|
2420
2289
|
if (isUrl(src)) continue;
|
|
2421
2290
|
onResourceFound({
|
|
@@ -2432,11 +2301,11 @@ function getAssetsFromHtml(htmlFilePath, htmlContent) {
|
|
|
2432
2301
|
static: []
|
|
2433
2302
|
};
|
|
2434
2303
|
if (!htmlFilePath) return assets;
|
|
2435
|
-
const htmlString = htmlContent ||
|
|
2304
|
+
const htmlString = htmlContent || external_fs_namespaceObject.readFileSync(htmlFilePath, {
|
|
2436
2305
|
encoding: 'utf8'
|
|
2437
2306
|
});
|
|
2438
|
-
const htmlDocument =
|
|
2439
|
-
const getAbsolutePath = (htmlFilePath, filePath)=>
|
|
2307
|
+
const htmlDocument = external_parse5_utils_default().parse(htmlString);
|
|
2308
|
+
const getAbsolutePath = (htmlFilePath, filePath)=>external_path_namespaceObject.join(external_path_namespaceObject.dirname(htmlFilePath), filePath.startsWith('/') ? external_path_namespaceObject.relative(external_path_namespaceObject.dirname(htmlFilePath), filePath) : filePath);
|
|
2440
2309
|
for (const node of htmlDocument.childNodes)if ('html' === node.nodeName) {
|
|
2441
2310
|
for (const childNode of node.childNodes)if ('head' === childNode.nodeName || 'body' === childNode.nodeName) parseHtml(childNode, ({ filePath, assetType })=>{
|
|
2442
2311
|
const fileAbsolutePath = getAbsolutePath(htmlFilePath, filePath);
|
|
@@ -2477,7 +2346,7 @@ function getHtmlPageDeclaredAssetPath(filepathList, filePath, extension) {
|
|
|
2477
2346
|
return `/${entryname.replace(extname, '')}${extension}`;
|
|
2478
2347
|
}
|
|
2479
2348
|
function getExtname(filePath) {
|
|
2480
|
-
const extname =
|
|
2349
|
+
const extname = external_path_namespaceObject.extname(filePath);
|
|
2481
2350
|
switch(extname){
|
|
2482
2351
|
case '.js':
|
|
2483
2352
|
case '.mjs':
|
|
@@ -2513,26 +2382,26 @@ function emit_html_file_define_property(obj, key, value) {
|
|
|
2513
2382
|
}
|
|
2514
2383
|
class EmitHtmlFile {
|
|
2515
2384
|
apply(compiler) {
|
|
2516
|
-
const manifest = JSON.parse(
|
|
2385
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(this.manifestPath, 'utf-8'));
|
|
2517
2386
|
const patchedManifest = filterKeysForThisBrowser(manifest, 'chrome');
|
|
2518
2387
|
const manifestName = patchedManifest.name || 'Extension.js';
|
|
2519
2388
|
compiler.hooks.thisCompilation.tap('html:emit-html-file', (compilation)=>{
|
|
2520
2389
|
compilation.hooks.processAssets.tap({
|
|
2521
2390
|
name: 'AddAssetsToCompilationPlugin',
|
|
2522
|
-
stage:
|
|
2391
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
|
|
2523
2392
|
}, ()=>{
|
|
2524
2393
|
const htmlFields = Object.entries(this.includeList || {});
|
|
2525
2394
|
for (const field of htmlFields){
|
|
2526
2395
|
const [featureName, resource] = field;
|
|
2527
2396
|
if (resource) {
|
|
2528
|
-
if (!
|
|
2397
|
+
if (!external_fs_namespaceObject.existsSync(resource)) {
|
|
2529
2398
|
const errorMessage = manifestFieldError(manifestName, featureName, resource);
|
|
2530
|
-
compilation.warnings.push(new
|
|
2399
|
+
compilation.warnings.push(new (core_default()).WebpackError(errorMessage));
|
|
2531
2400
|
return;
|
|
2532
2401
|
}
|
|
2533
|
-
const rawHtml =
|
|
2402
|
+
const rawHtml = external_fs_namespaceObject.readFileSync(resource, 'utf8');
|
|
2534
2403
|
if (!shouldExclude(resource, this.excludeList)) {
|
|
2535
|
-
const rawSource = new
|
|
2404
|
+
const rawSource = new core_namespaceObject.sources.RawSource(rawHtml);
|
|
2536
2405
|
const filepath = getFilePath(featureName, '.html');
|
|
2537
2406
|
compilation.emitAsset(filepath, rawSource);
|
|
2538
2407
|
}
|
|
@@ -2565,7 +2434,7 @@ class AddAssetsToCompilation {
|
|
|
2565
2434
|
compiler.hooks.thisCompilation.tap('html:add-assets-to-compilation', (compilation)=>{
|
|
2566
2435
|
compilation.hooks.processAssets.tap({
|
|
2567
2436
|
name: 'html:add-assets-to-compilation',
|
|
2568
|
-
stage:
|
|
2437
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
|
|
2569
2438
|
}, ()=>{
|
|
2570
2439
|
if (compilation.errors.length > 0) return;
|
|
2571
2440
|
const htmlFields = Object.entries(this.includeList || {});
|
|
@@ -2582,19 +2451,19 @@ class AddAssetsToCompilation {
|
|
|
2582
2451
|
...new Set(staticAssets)
|
|
2583
2452
|
];
|
|
2584
2453
|
for (const asset of fileAssets)if (!asset.startsWith('/')) {
|
|
2585
|
-
if (!
|
|
2454
|
+
if (!external_fs_namespaceObject.existsSync(asset)) {
|
|
2586
2455
|
const FilepathListEntry = isFromIncludeList(asset, this.includeList);
|
|
2587
2456
|
if (!FilepathListEntry) {
|
|
2588
|
-
if (!
|
|
2457
|
+
if (!external_path_namespaceObject.basename(asset).startsWith('#')) {
|
|
2589
2458
|
const errorMessage = fileNotFound(resource, asset);
|
|
2590
|
-
if (!asset.startsWith('/')) compilation.warnings.push(new
|
|
2459
|
+
if (!asset.startsWith('/')) compilation.warnings.push(new (core_default()).WebpackError(errorMessage));
|
|
2591
2460
|
return;
|
|
2592
2461
|
}
|
|
2593
2462
|
}
|
|
2594
2463
|
}
|
|
2595
|
-
const source =
|
|
2596
|
-
const rawSource = new
|
|
2597
|
-
const filepath =
|
|
2464
|
+
const source = external_fs_namespaceObject.readFileSync(asset);
|
|
2465
|
+
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
2466
|
+
const filepath = external_path_namespaceObject.join('assets', external_path_namespaceObject.basename(asset));
|
|
2598
2467
|
if (!compilation.getAsset(filepath)) if (asset.endsWith('.html')) {
|
|
2599
2468
|
const htmlAssets = getAssetsFromHtml(asset);
|
|
2600
2469
|
const assetsFromHtml = [
|
|
@@ -2604,9 +2473,9 @@ class AddAssetsToCompilation {
|
|
|
2604
2473
|
];
|
|
2605
2474
|
compilation.emitAsset(filepath, rawSource);
|
|
2606
2475
|
assetsFromHtml.forEach((assetFromHtml)=>{
|
|
2607
|
-
const source =
|
|
2608
|
-
const rawSource = new
|
|
2609
|
-
const filepath =
|
|
2476
|
+
const source = external_fs_namespaceObject.readFileSync(assetFromHtml);
|
|
2477
|
+
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
2478
|
+
const filepath = external_path_namespaceObject.join('assets', external_path_namespaceObject.basename(assetFromHtml));
|
|
2610
2479
|
if (!compilation.getAsset(filepath)) compilation.emitAsset(filepath, rawSource);
|
|
2611
2480
|
});
|
|
2612
2481
|
} else compilation.emitAsset(filepath, rawSource);
|
|
@@ -2640,7 +2509,7 @@ class AddScriptsAndStylesToCompilation {
|
|
|
2640
2509
|
for (const field of Object.entries(htmlEntries)){
|
|
2641
2510
|
const [feature, resource] = field;
|
|
2642
2511
|
if (resource) {
|
|
2643
|
-
if (!
|
|
2512
|
+
if (!external_fs_namespaceObject.existsSync(resource)) return;
|
|
2644
2513
|
const htmlAssets = getAssetsFromHtml(resource);
|
|
2645
2514
|
const jsAssets = (null == htmlAssets ? void 0 : htmlAssets.js) || [];
|
|
2646
2515
|
const cssAssets = (null == htmlAssets ? void 0 : htmlAssets.css) || [];
|
|
@@ -2649,11 +2518,10 @@ class AddScriptsAndStylesToCompilation {
|
|
|
2649
2518
|
...cssAssets
|
|
2650
2519
|
].filter((asset)=>!shouldExclude(asset, this.excludeList));
|
|
2651
2520
|
if ('development' === compiler.options.mode) {
|
|
2652
|
-
const
|
|
2653
|
-
const hmrScript = external_path_.resolve(__dirname, "minimum-script-file");
|
|
2521
|
+
const hmrScript = external_path_namespaceObject.resolve(__dirname, "minimum-script-file");
|
|
2654
2522
|
fileAssets.push(hmrScript);
|
|
2655
2523
|
}
|
|
2656
|
-
if (
|
|
2524
|
+
if (external_fs_namespaceObject.existsSync(resource)) {
|
|
2657
2525
|
if (!shouldExclude(resource, this.excludeList)) compiler.options.entry = {
|
|
2658
2526
|
...compiler.options.entry,
|
|
2659
2527
|
[feature]: {
|
|
@@ -2674,45 +2542,45 @@ class AddScriptsAndStylesToCompilation {
|
|
|
2674
2542
|
}
|
|
2675
2543
|
}
|
|
2676
2544
|
function patchHtml(compilation, feature, htmlEntry, includeList, excludeList) {
|
|
2677
|
-
const htmlFile =
|
|
2545
|
+
const htmlFile = external_fs_namespaceObject.readFileSync(htmlEntry, {
|
|
2678
2546
|
encoding: 'utf8'
|
|
2679
2547
|
});
|
|
2680
|
-
const htmlDocument =
|
|
2548
|
+
const htmlDocument = external_parse5_utils_default().parse(htmlFile);
|
|
2681
2549
|
let hasCssEntry = !!compilation.getAsset(feature + '.css');
|
|
2682
2550
|
let hasJsEntry = false;
|
|
2683
2551
|
for (let node of htmlDocument.childNodes)if ('html' === node.nodeName) {
|
|
2684
2552
|
for (const htmlChildNode of node.childNodes){
|
|
2685
2553
|
if ('head' === htmlChildNode.nodeName || 'body' === htmlChildNode.nodeName) parseHtml(htmlChildNode, ({ filePath, childNode, assetType })=>{
|
|
2686
|
-
const htmlDir =
|
|
2687
|
-
const absolutePath =
|
|
2554
|
+
const htmlDir = external_path_namespaceObject.dirname(htmlEntry);
|
|
2555
|
+
const absolutePath = external_path_namespaceObject.resolve(htmlDir, filePath);
|
|
2688
2556
|
const extname = getExtname(absolutePath);
|
|
2689
|
-
const isExcludedPath = shouldExclude(
|
|
2690
|
-
const excludedFilePath =
|
|
2557
|
+
const isExcludedPath = shouldExclude(external_path_namespaceObject.resolve(htmlDir, filePath), excludeList);
|
|
2558
|
+
const excludedFilePath = external_path_namespaceObject.join('/', external_path_namespaceObject.normalize(filePath));
|
|
2691
2559
|
const isFilepathListEntry = isFromFilepathList(absolutePath, includeList);
|
|
2692
2560
|
switch(assetType){
|
|
2693
2561
|
case "script":
|
|
2694
|
-
if (isExcludedPath) node =
|
|
2562
|
+
if (isExcludedPath) node = external_parse5_utils_default().setAttribute(childNode, 'src', excludedFilePath);
|
|
2695
2563
|
else {
|
|
2696
|
-
node =
|
|
2564
|
+
node = external_parse5_utils_default().remove(childNode);
|
|
2697
2565
|
hasJsEntry = true;
|
|
2698
2566
|
}
|
|
2699
2567
|
break;
|
|
2700
2568
|
case 'css':
|
|
2701
|
-
if (isExcludedPath) node =
|
|
2569
|
+
if (isExcludedPath) node = external_parse5_utils_default().setAttribute(childNode, 'href', excludedFilePath);
|
|
2702
2570
|
else {
|
|
2703
|
-
node =
|
|
2571
|
+
node = external_parse5_utils_default().remove(childNode);
|
|
2704
2572
|
hasCssEntry = true;
|
|
2705
2573
|
}
|
|
2706
2574
|
break;
|
|
2707
2575
|
case 'staticHref':
|
|
2708
2576
|
case 'staticSrc':
|
|
2709
|
-
if (isExcludedPath) node =
|
|
2577
|
+
if (isExcludedPath) node = external_parse5_utils_default().setAttribute(childNode, 'staticSrc' === assetType ? 'src' : 'href', excludedFilePath);
|
|
2710
2578
|
else if (isFilepathListEntry) {
|
|
2711
2579
|
const filepath = getHtmlPageDeclaredAssetPath(includeList, absolutePath, extname);
|
|
2712
|
-
node =
|
|
2580
|
+
node = external_parse5_utils_default().setAttribute(childNode, 'staticSrc' === assetType ? 'src' : 'href', filepath);
|
|
2713
2581
|
} else {
|
|
2714
|
-
const filepath =
|
|
2715
|
-
if (
|
|
2582
|
+
const filepath = external_path_namespaceObject.join('assets', external_path_namespaceObject.basename(absolutePath, extname));
|
|
2583
|
+
if (external_fs_namespaceObject.existsSync(absolutePath)) node = external_parse5_utils_default().setAttribute(childNode, 'staticSrc' === assetType ? 'src' : 'href', getFilePath(filepath, '', true));
|
|
2716
2584
|
}
|
|
2717
2585
|
break;
|
|
2718
2586
|
default:
|
|
@@ -2721,7 +2589,7 @@ function patchHtml(compilation, feature, htmlEntry, includeList, excludeList) {
|
|
|
2721
2589
|
});
|
|
2722
2590
|
if ('head' === htmlChildNode.nodeName) {
|
|
2723
2591
|
if (hasCssEntry) {
|
|
2724
|
-
const linkTag =
|
|
2592
|
+
const linkTag = external_parse5_utils_default().createNode('link');
|
|
2725
2593
|
linkTag.attrs = [
|
|
2726
2594
|
{
|
|
2727
2595
|
name: 'rel',
|
|
@@ -2732,23 +2600,23 @@ function patchHtml(compilation, feature, htmlEntry, includeList, excludeList) {
|
|
|
2732
2600
|
value: getFilePath(feature, '.css', true)
|
|
2733
2601
|
}
|
|
2734
2602
|
];
|
|
2735
|
-
|
|
2603
|
+
external_parse5_utils_default().append(htmlChildNode, linkTag);
|
|
2736
2604
|
}
|
|
2737
2605
|
}
|
|
2738
2606
|
if ('body' === htmlChildNode.nodeName) {
|
|
2739
2607
|
if (hasJsEntry || 'production' !== compilation.options.mode) {
|
|
2740
|
-
const scriptTag =
|
|
2608
|
+
const scriptTag = external_parse5_utils_default().createNode("script");
|
|
2741
2609
|
scriptTag.attrs = [
|
|
2742
2610
|
{
|
|
2743
2611
|
name: 'src',
|
|
2744
2612
|
value: getFilePath(feature, '.js', true)
|
|
2745
2613
|
}
|
|
2746
2614
|
];
|
|
2747
|
-
|
|
2615
|
+
external_parse5_utils_default().append(htmlChildNode, scriptTag);
|
|
2748
2616
|
}
|
|
2749
2617
|
}
|
|
2750
2618
|
}
|
|
2751
|
-
return
|
|
2619
|
+
return external_parse5_utils_default().serialize(htmlDocument);
|
|
2752
2620
|
}
|
|
2753
2621
|
}
|
|
2754
2622
|
function update_html_file_define_property(obj, key, value) {
|
|
@@ -2766,7 +2634,7 @@ class UpdateHtmlFile {
|
|
|
2766
2634
|
compiler.hooks.thisCompilation.tap('html:update-html-file', (compilation)=>{
|
|
2767
2635
|
compilation.hooks.processAssets.tap({
|
|
2768
2636
|
name: 'html:update-html-file',
|
|
2769
|
-
stage:
|
|
2637
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_DERIVED
|
|
2770
2638
|
}, ()=>{
|
|
2771
2639
|
if (compilation.errors.length > 0) return;
|
|
2772
2640
|
const htmlEntries = this.includeList || {};
|
|
@@ -2776,7 +2644,7 @@ class UpdateHtmlFile {
|
|
|
2776
2644
|
const updatedHtml = patchHtml(compilation, feature, resource, htmlEntries, this.excludeList || {});
|
|
2777
2645
|
if (!shouldExclude(resource, this.excludeList)) {
|
|
2778
2646
|
if (updatedHtml) {
|
|
2779
|
-
const rawSource = new
|
|
2647
|
+
const rawSource = new core_namespaceObject.sources.RawSource(updatedHtml);
|
|
2780
2648
|
const filepath = getFilePath(feature, '.html');
|
|
2781
2649
|
compilation.updateAsset(filepath, rawSource);
|
|
2782
2650
|
}
|
|
@@ -2810,7 +2678,7 @@ class AddToFileDependencies {
|
|
|
2810
2678
|
compiler.hooks.thisCompilation.tap('html:add-to-file-dependencies', (compilation)=>{
|
|
2811
2679
|
compilation.hooks.processAssets.tap({
|
|
2812
2680
|
name: 'html:add-to-file-dependencies',
|
|
2813
|
-
stage:
|
|
2681
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
|
|
2814
2682
|
}, ()=>{
|
|
2815
2683
|
var _compilation_errors;
|
|
2816
2684
|
if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
|
|
@@ -2820,7 +2688,7 @@ class AddToFileDependencies {
|
|
|
2820
2688
|
if (resource) {
|
|
2821
2689
|
const resourceData = getAssetsFromHtml(resource);
|
|
2822
2690
|
const fileDependencies = new Set(compilation.fileDependencies);
|
|
2823
|
-
if (
|
|
2691
|
+
if (external_fs_namespaceObject.existsSync(resource)) {
|
|
2824
2692
|
const fileResources = [
|
|
2825
2693
|
resource,
|
|
2826
2694
|
...(null == resourceData ? void 0 : resourceData.static) || []
|
|
@@ -2864,8 +2732,8 @@ class throw_if_recompile_is_needed_ThrowIfRecompileIsNeeded {
|
|
|
2864
2732
|
const htmlFile = resource;
|
|
2865
2733
|
if (htmlFile) {
|
|
2866
2734
|
var _getAssetsFromHtml, _getAssetsFromHtml1;
|
|
2867
|
-
if (!
|
|
2868
|
-
const manifest = JSON.parse(
|
|
2735
|
+
if (!external_fs_namespaceObject.existsSync(htmlFile)) {
|
|
2736
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(this.manifestPath, 'utf-8'));
|
|
2869
2737
|
const patchedManifest = filterKeysForThisBrowser(manifest, 'chrome');
|
|
2870
2738
|
const manifestName = patchedManifest.name || 'Extension.js';
|
|
2871
2739
|
console.error(manifestFieldError(manifestName, key, htmlFile));
|
|
@@ -2920,13 +2788,13 @@ function handle_common_errors_handleCantResolveError(includesList, error) {
|
|
|
2920
2788
|
const [, resource] = field;
|
|
2921
2789
|
if (resource) {
|
|
2922
2790
|
var _htmlAssets_js, _htmlAssets_css;
|
|
2923
|
-
if (!
|
|
2791
|
+
if (!external_fs_namespaceObject.existsSync(resource)) return null;
|
|
2924
2792
|
const htmlAssets = getAssetsFromHtml(resource);
|
|
2925
2793
|
const jsAssets = (null == htmlAssets ? void 0 : null == (_htmlAssets_js = htmlAssets.js) ? void 0 : _htmlAssets_js.filter((asset)=>!asset.startsWith('/'))) || [];
|
|
2926
2794
|
const cssAssets = (null == htmlAssets ? void 0 : null == (_htmlAssets_css = htmlAssets.css) ? void 0 : _htmlAssets_css.filter((asset)=>!asset.startsWith('/'))) || [];
|
|
2927
2795
|
if (jsAssets.includes(wrongFilename) || cssAssets.includes(wrongFilename)) {
|
|
2928
2796
|
const errorMsg = fileNotFound(resource, wrongFilename);
|
|
2929
|
-
return new
|
|
2797
|
+
return new core_namespaceObject.WebpackError(errorMsg);
|
|
2930
2798
|
}
|
|
2931
2799
|
}
|
|
2932
2800
|
}
|
|
@@ -2960,7 +2828,6 @@ function feature_html_define_property(obj, key, value) {
|
|
|
2960
2828
|
else obj[key] = value;
|
|
2961
2829
|
return obj;
|
|
2962
2830
|
}
|
|
2963
|
-
const feature_html_dirname = getDirname(import.meta.url);
|
|
2964
2831
|
class HtmlPlugin {
|
|
2965
2832
|
apply(compiler) {
|
|
2966
2833
|
new EmitHtmlFile({
|
|
@@ -2986,14 +2853,14 @@ class HtmlPlugin {
|
|
|
2986
2853
|
compiler.options.module.rules.push({
|
|
2987
2854
|
test: /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,
|
|
2988
2855
|
include: [
|
|
2989
|
-
|
|
2856
|
+
external_path_namespaceObject.dirname(this.manifestPath)
|
|
2990
2857
|
],
|
|
2991
2858
|
exclude: [
|
|
2992
2859
|
/[\\/]node_modules[\\/]/
|
|
2993
2860
|
],
|
|
2994
2861
|
use: [
|
|
2995
2862
|
{
|
|
2996
|
-
loader:
|
|
2863
|
+
loader: external_path_namespaceObject.resolve(__dirname, "ensure-hmr-for-scripts"),
|
|
2997
2864
|
options: {
|
|
2998
2865
|
manifestPath: this.manifestPath,
|
|
2999
2866
|
includeList: this.includeList,
|
|
@@ -3034,8 +2901,8 @@ function getScriptEntries(scriptPath, excludeList) {
|
|
|
3034
2901
|
scriptPath
|
|
3035
2902
|
] : [];
|
|
3036
2903
|
const fileAssets = scriptEntries.filter((scriptAsset)=>{
|
|
3037
|
-
const validFile =
|
|
3038
|
-
const assetExtension =
|
|
2904
|
+
const validFile = external_fs_namespaceObject.existsSync(scriptAsset) && !shouldExclude(scriptAsset, excludeList);
|
|
2905
|
+
const assetExtension = external_path_namespaceObject.extname(scriptAsset);
|
|
3039
2906
|
return validFile && ('.js' === assetExtension || '.mjs' === assetExtension || '.jsx' === assetExtension || '.ts' === assetExtension || '.tsx' === assetExtension);
|
|
3040
2907
|
});
|
|
3041
2908
|
return fileAssets;
|
|
@@ -3045,7 +2912,7 @@ function getCssEntries(scriptPath, excludeList) {
|
|
|
3045
2912
|
scriptPath
|
|
3046
2913
|
] : [];
|
|
3047
2914
|
const fileAssets = scriptEntries.filter((scriptAsset)=>{
|
|
3048
|
-
const validFile =
|
|
2915
|
+
const validFile = external_fs_namespaceObject.existsSync(scriptAsset) && !shouldExclude(scriptAsset, excludeList);
|
|
3049
2916
|
return validFile && (scriptAsset.endsWith('.css') || scriptAsset.endsWith('.scss') || scriptAsset.endsWith('.sass') || scriptAsset.endsWith('.less'));
|
|
3050
2917
|
});
|
|
3051
2918
|
return fileAssets;
|
|
@@ -3110,20 +2977,20 @@ class AddPublicPathRuntimeModule {
|
|
|
3110
2977
|
}
|
|
3111
2978
|
}
|
|
3112
2979
|
function add_public_path_runtime_module_PublicPathRuntimeModule() {
|
|
3113
|
-
class PublicPathRuntimeModule extends
|
|
2980
|
+
class PublicPathRuntimeModule extends core_namespaceObject.RuntimeModule {
|
|
3114
2981
|
generate() {
|
|
3115
2982
|
var _this_compilation, _this_compilation1;
|
|
3116
2983
|
const publicPath = null == (_this_compilation = this.compilation) ? void 0 : _this_compilation.outputOptions.publicPath;
|
|
3117
|
-
return
|
|
2984
|
+
return core_namespaceObject.Template.asString([
|
|
3118
2985
|
...weakRuntimeCheck,
|
|
3119
2986
|
`var path = ${JSON.stringify(null == (_this_compilation1 = this.compilation) ? void 0 : _this_compilation1.getPath(publicPath || '', {
|
|
3120
2987
|
hash: this.compilation.hash || 'XXXX'
|
|
3121
2988
|
}))}`,
|
|
3122
|
-
`${
|
|
2989
|
+
`${core_namespaceObject.RuntimeGlobals.publicPath} = typeof importScripts === 'function' || !(isBrowser || isChrome) ? path : runtime.runtime.getURL(path);`
|
|
3123
2990
|
]);
|
|
3124
2991
|
}
|
|
3125
2992
|
constructor(){
|
|
3126
|
-
super('publicPath',
|
|
2993
|
+
super('publicPath', core_namespaceObject.RuntimeModule.STAGE_BASIC);
|
|
3127
2994
|
}
|
|
3128
2995
|
}
|
|
3129
2996
|
return new PublicPathRuntimeModule();
|
|
@@ -3141,7 +3008,7 @@ function add_public_path_for_main_world_define_property(obj, key, value) {
|
|
|
3141
3008
|
class AddPublicPathForMainWorld {
|
|
3142
3009
|
apply(_compiler) {
|
|
3143
3010
|
var _manifest_content_scripts;
|
|
3144
|
-
const initialManifest = JSON.parse(
|
|
3011
|
+
const initialManifest = JSON.parse(external_fs_namespaceObject.readFileSync(this.manifestPath, 'utf-8'));
|
|
3145
3012
|
const manifest = filterKeysForThisBrowser(initialManifest, this.browser);
|
|
3146
3013
|
if (null == (_manifest_content_scripts = manifest.content_scripts) ? void 0 : _manifest_content_scripts.some((cs)=>cs.world && 'main' === cs.world.toLowerCase())) {
|
|
3147
3014
|
if (CHROMIUM_BASED_BROWSERS.includes(this.browser) && !manifest.key) {
|
|
@@ -3171,7 +3038,6 @@ function feature_scripts_define_property(obj, key, value) {
|
|
|
3171
3038
|
else obj[key] = value;
|
|
3172
3039
|
return obj;
|
|
3173
3040
|
}
|
|
3174
|
-
const feature_scripts_dirname = getDirname(import.meta.url);
|
|
3175
3041
|
class ScriptsPlugin {
|
|
3176
3042
|
apply(compiler) {
|
|
3177
3043
|
new AddScripts({
|
|
@@ -3182,14 +3048,14 @@ class ScriptsPlugin {
|
|
|
3182
3048
|
compiler.options.module.rules.push({
|
|
3183
3049
|
test: /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,
|
|
3184
3050
|
include: [
|
|
3185
|
-
|
|
3051
|
+
external_path_namespaceObject.dirname(this.manifestPath)
|
|
3186
3052
|
],
|
|
3187
3053
|
exclude: [
|
|
3188
3054
|
/[\\/]node_modules[\\/]/
|
|
3189
3055
|
],
|
|
3190
3056
|
use: [
|
|
3191
3057
|
{
|
|
3192
|
-
loader:
|
|
3058
|
+
loader: external_path_namespaceObject.resolve(__dirname, 'add-hmr-accept-code'),
|
|
3193
3059
|
options: {
|
|
3194
3060
|
manifestPath: this.manifestPath,
|
|
3195
3061
|
mode: compiler.options.mode,
|
|
@@ -3209,14 +3075,14 @@ class ScriptsPlugin {
|
|
|
3209
3075
|
compiler.options.module.rules.push({
|
|
3210
3076
|
test: /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,
|
|
3211
3077
|
include: [
|
|
3212
|
-
|
|
3078
|
+
external_path_namespaceObject.dirname(this.manifestPath)
|
|
3213
3079
|
],
|
|
3214
3080
|
exclude: [
|
|
3215
3081
|
/[\\/]node_modules[\\/]/
|
|
3216
3082
|
],
|
|
3217
3083
|
use: [
|
|
3218
3084
|
{
|
|
3219
|
-
loader:
|
|
3085
|
+
loader: external_path_namespaceObject.resolve(__dirname, 'deprecated-shadow-root'),
|
|
3220
3086
|
options: {
|
|
3221
3087
|
manifestPath: this.manifestPath,
|
|
3222
3088
|
includeList: this.includeList || {},
|
|
@@ -3238,11 +3104,11 @@ class ScriptsPlugin {
|
|
|
3238
3104
|
}
|
|
3239
3105
|
}
|
|
3240
3106
|
function getLocales(manifestPath) {
|
|
3241
|
-
const localesFolder =
|
|
3107
|
+
const localesFolder = external_path_namespaceObject.join(external_path_namespaceObject.dirname(manifestPath), '_locales');
|
|
3242
3108
|
const localeFiles = [];
|
|
3243
|
-
if (
|
|
3244
|
-
const localeDir =
|
|
3245
|
-
if (localeDir &&
|
|
3109
|
+
if (external_fs_namespaceObject.existsSync(localesFolder)) for (const locale of external_fs_namespaceObject.readdirSync(localesFolder)){
|
|
3110
|
+
const localeDir = external_path_namespaceObject.join(localesFolder, locale);
|
|
3111
|
+
if (localeDir && external_fs_namespaceObject.statSync(localeDir).isDirectory()) for (const localeEntity of external_fs_namespaceObject.readdirSync(localeDir))localeFiles.push(external_path_namespaceObject.join(external_path_namespaceObject.dirname(manifestPath), '_locales', locale, localeEntity));
|
|
3246
3112
|
}
|
|
3247
3113
|
return localeFiles;
|
|
3248
3114
|
}
|
|
@@ -3261,13 +3127,13 @@ class LocalesPlugin {
|
|
|
3261
3127
|
compiler.hooks.thisCompilation.tap('locales:module', (compilation)=>{
|
|
3262
3128
|
compilation.hooks.processAssets.tap({
|
|
3263
3129
|
name: 'locales:module',
|
|
3264
|
-
stage:
|
|
3130
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
|
|
3265
3131
|
}, ()=>{
|
|
3266
|
-
if (!
|
|
3267
|
-
const manifest = JSON.parse(
|
|
3132
|
+
if (!external_fs_namespaceObject.existsSync(this.manifestPath)) {
|
|
3133
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(this.manifestPath, 'utf8'));
|
|
3268
3134
|
const patchedManifest = filterKeysForThisBrowser(manifest, 'chrome');
|
|
3269
3135
|
const manifestName = patchedManifest.name || 'Extension.js';
|
|
3270
|
-
compilation.errors.push(new
|
|
3136
|
+
compilation.errors.push(new (core_default()).WebpackError(manifestNotFoundError(manifestName, this.manifestPath)));
|
|
3271
3137
|
return;
|
|
3272
3138
|
}
|
|
3273
3139
|
if (compilation.errors.length > 0) return;
|
|
@@ -3276,13 +3142,13 @@ class LocalesPlugin {
|
|
|
3276
3142
|
const [feature, resource] = field;
|
|
3277
3143
|
const thisResource = resource;
|
|
3278
3144
|
if (thisResource) {
|
|
3279
|
-
if ('.json' !==
|
|
3280
|
-
if (!
|
|
3281
|
-
const source =
|
|
3282
|
-
const rawSource = new
|
|
3283
|
-
const context = compiler.options.context ||
|
|
3145
|
+
if ('.json' !== external_path_namespaceObject.extname(thisResource)) continue;
|
|
3146
|
+
if (!external_fs_namespaceObject.existsSync(thisResource)) return void compilation.warnings.push(new (core_default()).WebpackError(entryNotFoundWarn(feature, thisResource)));
|
|
3147
|
+
const source = external_fs_namespaceObject.readFileSync(thisResource);
|
|
3148
|
+
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
3149
|
+
const context = compiler.options.context || external_path_namespaceObject.dirname(this.manifestPath);
|
|
3284
3150
|
if (!shouldExclude(thisResource, this.excludeList)) {
|
|
3285
|
-
const filename =
|
|
3151
|
+
const filename = external_path_namespaceObject.relative(context, thisResource);
|
|
3286
3152
|
compilation.emitAsset(filename, rawSource);
|
|
3287
3153
|
}
|
|
3288
3154
|
}
|
|
@@ -3292,7 +3158,7 @@ class LocalesPlugin {
|
|
|
3292
3158
|
compiler.hooks.thisCompilation.tap('locales:module', (compilation)=>{
|
|
3293
3159
|
compilation.hooks.processAssets.tap({
|
|
3294
3160
|
name: 'locales:module',
|
|
3295
|
-
stage:
|
|
3161
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
|
|
3296
3162
|
}, ()=>{
|
|
3297
3163
|
var _compilation_errors;
|
|
3298
3164
|
if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
|
|
@@ -3302,7 +3168,7 @@ class LocalesPlugin {
|
|
|
3302
3168
|
if (resource) {
|
|
3303
3169
|
const fileDependencies = new Set(compilation.fileDependencies);
|
|
3304
3170
|
const fileResources = localesFields || [];
|
|
3305
|
-
for (const thisResource of fileResources)if (
|
|
3171
|
+
for (const thisResource of fileResources)if (external_fs_namespaceObject.existsSync(thisResource) && '.json' === external_path_namespaceObject.extname(thisResource)) {
|
|
3306
3172
|
if (!fileDependencies.has(thisResource)) {
|
|
3307
3173
|
fileDependencies.add(thisResource);
|
|
3308
3174
|
compilation.fileDependencies.add(thisResource);
|
|
@@ -3337,7 +3203,7 @@ class JsonPlugin {
|
|
|
3337
3203
|
compiler.hooks.thisCompilation.tap('json:module', (compilation)=>{
|
|
3338
3204
|
compilation.hooks.processAssets.tap({
|
|
3339
3205
|
name: 'json:module',
|
|
3340
|
-
stage:
|
|
3206
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
|
|
3341
3207
|
}, ()=>{
|
|
3342
3208
|
if (compilation.errors.length > 0) return;
|
|
3343
3209
|
const jsonFields = this.includeList || {};
|
|
@@ -3348,9 +3214,9 @@ class JsonPlugin {
|
|
|
3348
3214
|
];
|
|
3349
3215
|
for (const thisResource of resourceArr)if (thisResource) {
|
|
3350
3216
|
if (!shouldExclude(thisResource, this.excludeList)) {
|
|
3351
|
-
if (!
|
|
3352
|
-
const source =
|
|
3353
|
-
const rawSource = new
|
|
3217
|
+
if (!external_fs_namespaceObject.existsSync(thisResource)) return void compilation.warnings.push(new (core_default()).WebpackError(entryNotFoundWarn(feature, thisResource)));
|
|
3218
|
+
const source = external_fs_namespaceObject.readFileSync(thisResource);
|
|
3219
|
+
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
3354
3220
|
compilation.emitAsset(feature + '.json', rawSource);
|
|
3355
3221
|
}
|
|
3356
3222
|
}
|
|
@@ -3360,7 +3226,7 @@ class JsonPlugin {
|
|
|
3360
3226
|
compiler.hooks.thisCompilation.tap('json:module', (compilation)=>{
|
|
3361
3227
|
compilation.hooks.processAssets.tap({
|
|
3362
3228
|
name: 'json:module',
|
|
3363
|
-
stage:
|
|
3229
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
|
|
3364
3230
|
}, ()=>{
|
|
3365
3231
|
var _compilation_errors;
|
|
3366
3232
|
if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
|
|
@@ -3373,7 +3239,7 @@ class JsonPlugin {
|
|
|
3373
3239
|
for (const thisResource of resourceArr)if (thisResource) {
|
|
3374
3240
|
const fileDependencies = new Set(compilation.fileDependencies);
|
|
3375
3241
|
if (!shouldExclude(thisResource, this.excludeList)) {
|
|
3376
|
-
if (
|
|
3242
|
+
if (external_fs_namespaceObject.existsSync(thisResource)) {
|
|
3377
3243
|
if (!fileDependencies.has(thisResource)) {
|
|
3378
3244
|
fileDependencies.add(thisResource);
|
|
3379
3245
|
compilation.fileDependencies.add(thisResource);
|
|
@@ -3409,7 +3275,7 @@ class EmitFile {
|
|
|
3409
3275
|
compiler.hooks.thisCompilation.tap('icons:emit-file', (compilation)=>{
|
|
3410
3276
|
compilation.hooks.processAssets.tap({
|
|
3411
3277
|
name: 'icons:emit-file',
|
|
3412
|
-
stage:
|
|
3278
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
|
|
3413
3279
|
}, ()=>{
|
|
3414
3280
|
if (compilation.errors.length > 0) return;
|
|
3415
3281
|
const iconFields = this.includeList || {};
|
|
@@ -3420,11 +3286,11 @@ class EmitFile {
|
|
|
3420
3286
|
resource
|
|
3421
3287
|
];
|
|
3422
3288
|
for (const entry of iconEntries)if (entry) {
|
|
3423
|
-
if (!
|
|
3289
|
+
if (!external_fs_namespaceObject.existsSync(entry)) continue;
|
|
3424
3290
|
if (!shouldExclude(entry, this.excludeList)) {
|
|
3425
|
-
const source =
|
|
3426
|
-
const rawSource = new
|
|
3427
|
-
const basename =
|
|
3291
|
+
const source = external_fs_namespaceObject.readFileSync(entry);
|
|
3292
|
+
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
3293
|
+
const basename = external_path_namespaceObject.basename(entry);
|
|
3428
3294
|
const featureName = feature.endsWith('theme_icons') ? feature.replace('theme_icons', '') : feature;
|
|
3429
3295
|
const filename = `${featureName}/${basename}`;
|
|
3430
3296
|
compilation.emitAsset(filename, rawSource);
|
|
@@ -3458,7 +3324,7 @@ class add_to_file_dependencies_AddToFileDependencies {
|
|
|
3458
3324
|
compiler.hooks.thisCompilation.tap('icons:add-to-file-dependencies', (compilation)=>{
|
|
3459
3325
|
compilation.hooks.processAssets.tap({
|
|
3460
3326
|
name: 'icons:add-to-file-dependencies',
|
|
3461
|
-
stage:
|
|
3327
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
|
|
3462
3328
|
}, ()=>{
|
|
3463
3329
|
var _compilation_errors;
|
|
3464
3330
|
if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
|
|
@@ -3470,7 +3336,7 @@ class add_to_file_dependencies_AddToFileDependencies {
|
|
|
3470
3336
|
];
|
|
3471
3337
|
for (const entry of iconEntries)if (entry) {
|
|
3472
3338
|
const fileDependencies = new Set(compilation.fileDependencies);
|
|
3473
|
-
if (
|
|
3339
|
+
if (external_fs_namespaceObject.existsSync(entry)) {
|
|
3474
3340
|
if (!fileDependencies.has(entry)) {
|
|
3475
3341
|
fileDependencies.add(entry);
|
|
3476
3342
|
compilation.fileDependencies.add(entry);
|
|
@@ -3577,14 +3443,14 @@ class WebResourcesPlugin {
|
|
|
3577
3443
|
if (webAccessibleResourcesV3.length > 0) manifest.web_accessible_resources = webAccessibleResourcesV3;
|
|
3578
3444
|
} else if (webAccessibleResourcesV2.length > 0) manifest.web_accessible_resources = Array.from(new Set(webAccessibleResourcesV2));
|
|
3579
3445
|
const source = JSON.stringify(manifest, null, 2);
|
|
3580
|
-
const rawSource = new
|
|
3446
|
+
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
3581
3447
|
if (compilation.getAsset('manifest.json')) compilation.updateAsset('manifest.json', rawSource);
|
|
3582
3448
|
}
|
|
3583
3449
|
apply(compiler) {
|
|
3584
3450
|
compiler.hooks.thisCompilation.tap('plugin-extension:feature-web-resources', (compilation)=>{
|
|
3585
3451
|
compilation.hooks.processAssets.tap({
|
|
3586
3452
|
name: 'plugin-extension:feature-web-resources',
|
|
3587
|
-
stage:
|
|
3453
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ANALYSE
|
|
3588
3454
|
}, ()=>{
|
|
3589
3455
|
const contentEntries = [];
|
|
3590
3456
|
const entryNames = Object.keys(this.includeList || {});
|
|
@@ -3623,6 +3489,7 @@ class WebResourcesPlugin {
|
|
|
3623
3489
|
this.excludeList = options.excludeList;
|
|
3624
3490
|
}
|
|
3625
3491
|
}
|
|
3492
|
+
const external_chokidar_namespaceObject = require("chokidar");
|
|
3626
3493
|
function copy_public_folder_define_property(obj, key, value) {
|
|
3627
3494
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
3628
3495
|
value: value,
|
|
@@ -3635,58 +3502,58 @@ function copy_public_folder_define_property(obj, key, value) {
|
|
|
3635
3502
|
}
|
|
3636
3503
|
class CopyPublicFolder {
|
|
3637
3504
|
ensureDirectoryExistence(filePath) {
|
|
3638
|
-
const dirname =
|
|
3639
|
-
if (
|
|
3640
|
-
|
|
3505
|
+
const dirname = external_path_namespaceObject.dirname(filePath);
|
|
3506
|
+
if (external_fs_namespaceObject.existsSync(dirname)) return true;
|
|
3507
|
+
external_fs_namespaceObject.mkdirSync(dirname, {
|
|
3641
3508
|
recursive: true
|
|
3642
3509
|
});
|
|
3643
3510
|
}
|
|
3644
3511
|
copyFile(sourcePath, targetPath) {
|
|
3645
3512
|
this.ensureDirectoryExistence(targetPath);
|
|
3646
|
-
|
|
3513
|
+
external_fs_namespaceObject.copyFileSync(sourcePath, targetPath);
|
|
3647
3514
|
}
|
|
3648
3515
|
copyFolder(source, target) {
|
|
3649
|
-
if (!
|
|
3516
|
+
if (!external_fs_namespaceObject.existsSync(target)) external_fs_namespaceObject.mkdirSync(target, {
|
|
3650
3517
|
recursive: true
|
|
3651
3518
|
});
|
|
3652
|
-
const files =
|
|
3519
|
+
const files = external_fs_namespaceObject.readdirSync(source);
|
|
3653
3520
|
files.forEach((file)=>{
|
|
3654
|
-
const sourcePath =
|
|
3655
|
-
const targetPath =
|
|
3656
|
-
if (
|
|
3521
|
+
const sourcePath = external_path_namespaceObject.join(source, file);
|
|
3522
|
+
const targetPath = external_path_namespaceObject.join(target, file);
|
|
3523
|
+
if (external_fs_namespaceObject.statSync(sourcePath).isDirectory()) this.copyFolder(sourcePath, targetPath);
|
|
3657
3524
|
else this.copyFile(sourcePath, targetPath);
|
|
3658
3525
|
});
|
|
3659
3526
|
}
|
|
3660
3527
|
apply(compiler) {
|
|
3661
3528
|
var _compiler_options_output;
|
|
3662
|
-
const projectPath =
|
|
3663
|
-
const staticDir =
|
|
3529
|
+
const projectPath = external_path_namespaceObject.dirname(this.options.manifestPath);
|
|
3530
|
+
const staticDir = external_path_namespaceObject.join(projectPath, 'public');
|
|
3664
3531
|
const output = (null == (_compiler_options_output = compiler.options.output) ? void 0 : _compiler_options_output.path) || '';
|
|
3665
|
-
if (!
|
|
3532
|
+
if (!external_fs_namespaceObject.existsSync(staticDir)) return;
|
|
3666
3533
|
compiler.hooks.afterEmit.tap('special-folders:copy-public-folder', ()=>{
|
|
3667
|
-
const target =
|
|
3668
|
-
if (!
|
|
3534
|
+
const target = external_path_namespaceObject.join(output, '/');
|
|
3535
|
+
if (!external_fs_namespaceObject.existsSync(target)) external_fs_namespaceObject.mkdirSync(target, {
|
|
3669
3536
|
recursive: true
|
|
3670
3537
|
});
|
|
3671
|
-
if (
|
|
3538
|
+
if (external_fs_namespaceObject.existsSync(staticDir)) this.copyFolder(staticDir, target);
|
|
3672
3539
|
});
|
|
3673
3540
|
if ('production' === compiler.options.mode) return;
|
|
3674
3541
|
compiler.hooks.afterPlugins.tap('special-folders:copy-public-folder', ()=>{
|
|
3675
|
-
const staticPath =
|
|
3676
|
-
const watcher =
|
|
3542
|
+
const staticPath = external_path_namespaceObject.join(projectPath, 'public');
|
|
3543
|
+
const watcher = external_chokidar_namespaceObject.watch(staticPath, {
|
|
3677
3544
|
ignoreInitial: true
|
|
3678
3545
|
});
|
|
3679
3546
|
watcher.on('add', (filePath)=>{
|
|
3680
|
-
const target =
|
|
3547
|
+
const target = external_path_namespaceObject.join(output, external_path_namespaceObject.relative(projectPath, filePath));
|
|
3681
3548
|
this.copyFile(filePath, target);
|
|
3682
3549
|
});
|
|
3683
3550
|
watcher.on('change', (filePath)=>{
|
|
3684
|
-
const target =
|
|
3551
|
+
const target = external_path_namespaceObject.join(output, external_path_namespaceObject.relative(projectPath, filePath));
|
|
3685
3552
|
this.copyFile(filePath, target);
|
|
3686
3553
|
});
|
|
3687
3554
|
watcher.on('unlink', (filePath)=>{
|
|
3688
|
-
const target =
|
|
3689
|
-
if (
|
|
3555
|
+
const target = external_path_namespaceObject.join(output, external_path_namespaceObject.relative(projectPath, filePath));
|
|
3556
|
+
if (external_fs_namespaceObject.existsSync(target)) external_fs_namespaceObject.unlinkSync(target);
|
|
3690
3557
|
});
|
|
3691
3558
|
compiler.hooks.watchClose.tap('special-folders:copy-public-folder', ()=>{
|
|
3692
3559
|
watcher.close().catch(console.error);
|
|
@@ -3710,7 +3577,7 @@ function warn_upon_folder_changes_define_property(obj, key, value) {
|
|
|
3710
3577
|
}
|
|
3711
3578
|
class WarnUponFolderChanges {
|
|
3712
3579
|
throwCompilationError(folder, filePath, isAddition) {
|
|
3713
|
-
const pathRelative =
|
|
3580
|
+
const pathRelative = external_path_namespaceObject.relative(process.cwd(), filePath);
|
|
3714
3581
|
const addingOrRemoving = isAddition ? 'Adding' : 'Removing';
|
|
3715
3582
|
const typeOfAsset = 'pages' === folder ? 'HTML pages' : "script files";
|
|
3716
3583
|
const errorMessage = serverRestartRequiredFromSpecialFolderError(addingOrRemoving, folder, typeOfAsset, pathRelative);
|
|
@@ -3721,13 +3588,13 @@ class WarnUponFolderChanges {
|
|
|
3721
3588
|
apply(compiler) {
|
|
3722
3589
|
compiler.hooks.afterPlugins.tap('special-folders:warn-upon-folder-changes', ()=>{
|
|
3723
3590
|
var _compiler_options_resolve;
|
|
3724
|
-
const projectPath =
|
|
3725
|
-
const pagesPath =
|
|
3726
|
-
const scriptsPath =
|
|
3727
|
-
const pagesWatcher =
|
|
3591
|
+
const projectPath = external_path_namespaceObject.dirname(this.manifestPath);
|
|
3592
|
+
const pagesPath = external_path_namespaceObject.join(projectPath, 'pages');
|
|
3593
|
+
const scriptsPath = external_path_namespaceObject.join(projectPath, "scripts");
|
|
3594
|
+
const pagesWatcher = external_chokidar_namespaceObject.watch(pagesPath, {
|
|
3728
3595
|
ignoreInitial: true
|
|
3729
3596
|
});
|
|
3730
|
-
const scriptsWatcher =
|
|
3597
|
+
const scriptsWatcher = external_chokidar_namespaceObject.watch(scriptsPath, {
|
|
3731
3598
|
ignoreInitial: true
|
|
3732
3599
|
});
|
|
3733
3600
|
const extensionsSupported = null == (_compiler_options_resolve = compiler.options.resolve) ? void 0 : _compiler_options_resolve.extensions;
|
|
@@ -3740,11 +3607,11 @@ class WarnUponFolderChanges {
|
|
|
3740
3607
|
if (isHtml) this.throwCompilationError('pages', filePath);
|
|
3741
3608
|
});
|
|
3742
3609
|
scriptsWatcher.on('add', (filePath)=>{
|
|
3743
|
-
const isScript = null == extensionsSupported ? void 0 : extensionsSupported.includes(
|
|
3610
|
+
const isScript = null == extensionsSupported ? void 0 : extensionsSupported.includes(external_path_namespaceObject.extname(filePath));
|
|
3744
3611
|
if (isScript) this.throwCompilationError("scripts", filePath, true);
|
|
3745
3612
|
});
|
|
3746
3613
|
scriptsWatcher.on('unlink', (filePath)=>{
|
|
3747
|
-
const isScript = null == extensionsSupported ? void 0 : extensionsSupported.includes(
|
|
3614
|
+
const isScript = null == extensionsSupported ? void 0 : extensionsSupported.includes(external_path_namespaceObject.extname(filePath));
|
|
3748
3615
|
if (isScript) this.throwCompilationError("scripts", filePath);
|
|
3749
3616
|
});
|
|
3750
3617
|
compiler.hooks.watchClose.tap('WarnUponFolderChanges', ()=>{
|
|
@@ -3873,9 +3740,11 @@ class ExtensionPlugin {
|
|
|
3873
3740
|
}
|
|
3874
3741
|
}
|
|
3875
3742
|
plugin_extension_define_property(ExtensionPlugin, "name", 'plugin-extension');
|
|
3743
|
+
const external_ws_namespaceObject = require("ws");
|
|
3744
|
+
var external_ws_default = /*#__PURE__*/ __webpack_require__.n(external_ws_namespaceObject);
|
|
3876
3745
|
function dispatchMessage(server, message) {
|
|
3877
3746
|
server.clients.forEach((client)=>{
|
|
3878
|
-
if (client.readyState ===
|
|
3747
|
+
if (client.readyState === external_ws_default().OPEN) client.send(JSON.stringify(message));
|
|
3879
3748
|
});
|
|
3880
3749
|
}
|
|
3881
3750
|
function messageDispatcher(server, manifestPath, updatedFile) {
|
|
@@ -3893,7 +3762,7 @@ function messageDispatcher(server, manifestPath, updatedFile) {
|
|
|
3893
3762
|
if ('development' === process.env.EXTENSION_ENV) console.error('WebSocket server is not running.');
|
|
3894
3763
|
return;
|
|
3895
3764
|
}
|
|
3896
|
-
if ('manifest.json' ===
|
|
3765
|
+
if ('manifest.json' === external_path_namespaceObject.basename(updatedFile)) dispatchMessage(server, {
|
|
3897
3766
|
changedFile: 'manifest.json'
|
|
3898
3767
|
});
|
|
3899
3768
|
null == manifestLocales || manifestLocales.forEach((path)=>{
|
|
@@ -3920,18 +3789,20 @@ function messageDispatcher(server, manifestPath, updatedFile) {
|
|
|
3920
3789
|
}
|
|
3921
3790
|
});
|
|
3922
3791
|
}
|
|
3923
|
-
|
|
3792
|
+
require("http");
|
|
3793
|
+
const external_https_namespaceObject = require("https");
|
|
3794
|
+
var external_https_default = /*#__PURE__*/ __webpack_require__.n(external_https_namespaceObject);
|
|
3924
3795
|
const ensureFile = (filePath)=>{
|
|
3925
|
-
if (!
|
|
3926
|
-
const basename =
|
|
3927
|
-
return
|
|
3796
|
+
if (!external_fs_namespaceObject.existsSync(filePath)) return;
|
|
3797
|
+
const basename = external_path_namespaceObject.basename(filePath);
|
|
3798
|
+
return external_fs_namespaceObject.readFileSync(external_path_namespaceObject.join(__dirname, 'certs', basename));
|
|
3928
3799
|
};
|
|
3929
3800
|
function httpsServer(defaultPort) {
|
|
3930
3801
|
const options = {
|
|
3931
|
-
key: ensureFile(
|
|
3932
|
-
cert: ensureFile(
|
|
3802
|
+
key: ensureFile(external_path_namespaceObject.join(__dirname, 'certs', 'localhost.key')),
|
|
3803
|
+
cert: ensureFile(external_path_namespaceObject.join(__dirname, 'certs', 'localhost.cert'))
|
|
3933
3804
|
};
|
|
3934
|
-
const server =
|
|
3805
|
+
const server = external_https_default().createServer(options, (_req, res)=>{
|
|
3935
3806
|
res.writeHead(200);
|
|
3936
3807
|
res.end();
|
|
3937
3808
|
});
|
|
@@ -3947,21 +3818,21 @@ function httpsServer(defaultPort) {
|
|
|
3947
3818
|
function setupServer(port, browser) {
|
|
3948
3819
|
switch(browser){
|
|
3949
3820
|
case 'chrome':
|
|
3950
|
-
return new
|
|
3821
|
+
return new external_ws_namespaceObject.WebSocketServer({
|
|
3951
3822
|
host: 'localhost',
|
|
3952
3823
|
port
|
|
3953
3824
|
});
|
|
3954
3825
|
case 'edge':
|
|
3955
|
-
return new
|
|
3826
|
+
return new external_ws_namespaceObject.WebSocketServer({
|
|
3956
3827
|
host: 'localhost',
|
|
3957
3828
|
port: port + 1
|
|
3958
3829
|
});
|
|
3959
3830
|
case 'firefox':
|
|
3960
|
-
return new
|
|
3831
|
+
return new external_ws_namespaceObject.WebSocketServer({
|
|
3961
3832
|
server: httpsServer(port + 2).server
|
|
3962
3833
|
});
|
|
3963
3834
|
default:
|
|
3964
|
-
return new
|
|
3835
|
+
return new external_ws_namespaceObject.WebSocketServer({
|
|
3965
3836
|
host: 'localhost',
|
|
3966
3837
|
port: 8888
|
|
3967
3838
|
});
|
|
@@ -3969,7 +3840,7 @@ function setupServer(port, browser) {
|
|
|
3969
3840
|
}
|
|
3970
3841
|
async function startServer(compiler, options) {
|
|
3971
3842
|
const projectPath = compiler.options.context || '';
|
|
3972
|
-
const manifest = JSON.parse(
|
|
3843
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(external_path_namespaceObject.join(projectPath, 'manifest.json'), 'utf-8'));
|
|
3973
3844
|
const port = options.port || 8080;
|
|
3974
3845
|
const webSocketServer = setupServer(port, options.browser);
|
|
3975
3846
|
webSocketServer.on('connection', (ws)=>{
|
|
@@ -3982,7 +3853,7 @@ async function startServer(compiler, options) {
|
|
|
3982
3853
|
ws.on('message', (msg)=>{
|
|
3983
3854
|
const message = JSON.parse(msg.toString());
|
|
3984
3855
|
if ('clientReady' === message.status) {
|
|
3985
|
-
const manifest = JSON.parse(
|
|
3856
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(external_path_namespaceObject.join(projectPath, 'manifest.json'), 'utf-8'));
|
|
3986
3857
|
setTimeout(()=>{
|
|
3987
3858
|
console.log(runningInDevelopment(manifest, options.browser, message));
|
|
3988
3859
|
console.log('');
|
|
@@ -3997,7 +3868,7 @@ async function startServer(compiler, options) {
|
|
|
3997
3868
|
const hardcodedMessage = getHardcodedMessage(manifest);
|
|
3998
3869
|
console.log(runningInDevelopment(manifest, options.browser, hardcodedMessage));
|
|
3999
3870
|
console.log('');
|
|
4000
|
-
if (!
|
|
3871
|
+
if (!external_fs_namespaceObject.existsSync(CERTIFICATE_DESTINATION_PATH)) {
|
|
4001
3872
|
console.log(certRequired());
|
|
4002
3873
|
console.log('');
|
|
4003
3874
|
}
|
|
@@ -4005,12 +3876,11 @@ async function startServer(compiler, options) {
|
|
|
4005
3876
|
return webSocketServer;
|
|
4006
3877
|
}
|
|
4007
3878
|
function replaceDataInFile(browser, port) {
|
|
4008
|
-
const
|
|
4009
|
-
const reloadServiceFilePath = external_path_.resolve(__dirname, `./extensions/${browser}-manager-extension/reload-service.js`);
|
|
3879
|
+
const reloadServiceFilePath = external_path_namespaceObject.resolve(__dirname, `./extensions/${browser}-manager-extension/reload-service.js`);
|
|
4010
3880
|
try {
|
|
4011
|
-
const data =
|
|
3881
|
+
const data = external_fs_namespaceObject.readFileSync(reloadServiceFilePath, 'utf8');
|
|
4012
3882
|
const updatedData = data.replace(/__RELOAD_PORT__/g, port.toString());
|
|
4013
|
-
if (updatedData !== data)
|
|
3883
|
+
if (updatedData !== data) external_fs_namespaceObject.writeFileSync(reloadServiceFilePath, updatedData, 'utf8');
|
|
4014
3884
|
} catch (err) {
|
|
4015
3885
|
console.error(`Error processing file: ${err.message}`);
|
|
4016
3886
|
}
|
|
@@ -4046,8 +3916,8 @@ class CreateWebSocketServer {
|
|
|
4046
3916
|
const files = compiler.modifiedFiles || new Set();
|
|
4047
3917
|
const changedFile = files.values().next().value;
|
|
4048
3918
|
if (!changedFile) return void done();
|
|
4049
|
-
const relativePath =
|
|
4050
|
-
const context =
|
|
3919
|
+
const relativePath = external_path_namespaceObject.relative(external_path_namespaceObject.dirname(this.manifestPath), changedFile);
|
|
3920
|
+
const context = external_path_namespaceObject.relative(process.cwd(), external_path_namespaceObject.dirname(changedFile));
|
|
4051
3921
|
if ('development' === process.env.EXTENSION_ENV) console.info(`\u{25BA}\u{25BA} Updated file \`${relativePath}\` (relative to ${context})`);
|
|
4052
3922
|
if (this.manifestPath) messageDispatcher(wss, this.manifestPath, changedFile);
|
|
4053
3923
|
done();
|
|
@@ -4064,19 +3934,18 @@ class CreateWebSocketServer {
|
|
|
4064
3934
|
this.stats = options.stats;
|
|
4065
3935
|
}
|
|
4066
3936
|
}
|
|
4067
|
-
const setup_chromium_reload_client_dirname = getDirname(import.meta.url);
|
|
4068
3937
|
function SetupChromiumReloadClient(compiler, browser, manifestPath) {
|
|
4069
3938
|
compiler.options.module.rules.push({
|
|
4070
3939
|
test: /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,
|
|
4071
3940
|
include: [
|
|
4072
|
-
|
|
3941
|
+
external_path_namespaceObject.dirname(manifestPath)
|
|
4073
3942
|
],
|
|
4074
3943
|
exclude: [
|
|
4075
3944
|
/[\\/]node_modules[\\/]/
|
|
4076
3945
|
],
|
|
4077
3946
|
use: [
|
|
4078
3947
|
{
|
|
4079
|
-
loader:
|
|
3948
|
+
loader: external_path_namespaceObject.resolve(__dirname, './inject-chromium-client-loader'),
|
|
4080
3949
|
options: {
|
|
4081
3950
|
manifestPath,
|
|
4082
3951
|
browser
|
|
@@ -4085,19 +3954,18 @@ function SetupChromiumReloadClient(compiler, browser, manifestPath) {
|
|
|
4085
3954
|
]
|
|
4086
3955
|
});
|
|
4087
3956
|
}
|
|
4088
|
-
const setup_firefox_reload_client_dirname = getDirname(import.meta.url);
|
|
4089
3957
|
function SetupFirefoxReloadClient(compiler, browser, manifestPath) {
|
|
4090
3958
|
compiler.options.module.rules.push({
|
|
4091
3959
|
test: /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,
|
|
4092
3960
|
include: [
|
|
4093
|
-
|
|
3961
|
+
external_path_namespaceObject.dirname(manifestPath)
|
|
4094
3962
|
],
|
|
4095
3963
|
exclude: [
|
|
4096
3964
|
/[\\/]node_modules[\\/]/
|
|
4097
3965
|
],
|
|
4098
3966
|
use: [
|
|
4099
3967
|
{
|
|
4100
|
-
loader:
|
|
3968
|
+
loader: external_path_namespaceObject.resolve(__dirname, './inject-firefox-client-loader'),
|
|
4101
3969
|
options: {
|
|
4102
3970
|
manifestPath,
|
|
4103
3971
|
browser
|
|
@@ -4106,6 +3974,8 @@ function SetupFirefoxReloadClient(compiler, browser, manifestPath) {
|
|
|
4106
3974
|
]
|
|
4107
3975
|
});
|
|
4108
3976
|
}
|
|
3977
|
+
const external_content_security_policy_parser_namespaceObject = require("content-security-policy-parser");
|
|
3978
|
+
var external_content_security_policy_parser_default = /*#__PURE__*/ __webpack_require__.n(external_content_security_policy_parser_namespaceObject);
|
|
4109
3979
|
function buildCSP(cspObject) {
|
|
4110
3980
|
let policy = '';
|
|
4111
3981
|
for(const directive in cspObject)policy += `${directive} ${cspObject[directive].join(' ')}; `;
|
|
@@ -4114,7 +3984,7 @@ function buildCSP(cspObject) {
|
|
|
4114
3984
|
function patchV2CSP(manifest) {
|
|
4115
3985
|
let policy = manifest.content_security_policy;
|
|
4116
3986
|
if (!policy) return "script-src 'self' 'unsafe-eval' blob: filesystem:; object-src 'self' blob: filesystem:; ";
|
|
4117
|
-
const csp = (
|
|
3987
|
+
const csp = external_content_security_policy_parser_default()(policy);
|
|
4118
3988
|
if (csp.get("script-src")) {
|
|
4119
3989
|
const scriptSrc = csp.get("script-src") || [];
|
|
4120
3990
|
if (!scriptSrc.includes("'unsafe-eval'")) scriptSrc.push("'unsafe-eval'");
|
|
@@ -4140,7 +4010,7 @@ function patchV3CSP(manifest) {
|
|
|
4140
4010
|
if (!policy) return {
|
|
4141
4011
|
extension_pages: "script-src 'self'; object-src 'self';"
|
|
4142
4012
|
};
|
|
4143
|
-
const csp = (
|
|
4013
|
+
const csp = external_content_security_policy_parser_default()(policy.extension_pages || '');
|
|
4144
4014
|
const defaultDirectives = {
|
|
4145
4015
|
"script-src": [
|
|
4146
4016
|
"'self'"
|
|
@@ -4276,14 +4146,14 @@ class ApplyManifestDevDefaults {
|
|
|
4276
4146
|
web_accessible_resources: 3 === manifest.manifest_version ? patchWebResourcesV3(manifest) : patchWebResourcesV2(manifest)
|
|
4277
4147
|
};
|
|
4278
4148
|
const source = JSON.stringify(patchedManifest, null, 2);
|
|
4279
|
-
const rawSource = new
|
|
4149
|
+
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
4280
4150
|
if (compilation.getAsset('manifest.json')) compilation.updateAsset('manifest.json', rawSource);
|
|
4281
4151
|
}
|
|
4282
4152
|
apply(compiler) {
|
|
4283
4153
|
compiler.hooks.thisCompilation.tap('run-chromium:apply-manifest-dev-defaults', (compilation)=>{
|
|
4284
4154
|
compilation.hooks.processAssets.tap({
|
|
4285
4155
|
name: 'run-chromium:apply-manifest-dev-defaults',
|
|
4286
|
-
stage:
|
|
4156
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
4287
4157
|
}, (_assets)=>{
|
|
4288
4158
|
if (!this.manifestPath) {
|
|
4289
4159
|
const errorMessage = 'No manifest.json found in your extension bundle. Unable to patch manifest.json.';
|
|
@@ -4301,6 +4171,8 @@ class ApplyManifestDevDefaults {
|
|
|
4301
4171
|
this.browser = options.browser || 'chrome';
|
|
4302
4172
|
}
|
|
4303
4173
|
}
|
|
4174
|
+
const external_webpack_target_webextension_namespaceObject = require("webpack-target-webextension");
|
|
4175
|
+
var external_webpack_target_webextension_default = /*#__PURE__*/ __webpack_require__.n(external_webpack_target_webextension_namespaceObject);
|
|
4304
4176
|
function target_web_extension_plugin_define_property(obj, key, value) {
|
|
4305
4177
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
4306
4178
|
value: value,
|
|
@@ -4311,17 +4183,16 @@ function target_web_extension_plugin_define_property(obj, key, value) {
|
|
|
4311
4183
|
else obj[key] = value;
|
|
4312
4184
|
return obj;
|
|
4313
4185
|
}
|
|
4314
|
-
const target_web_extension_plugin_dirname = getDirname(import.meta.url);
|
|
4315
4186
|
class TargetWebExtensionPlugin {
|
|
4316
4187
|
handleBackground(compiler, browser, manifest) {
|
|
4317
|
-
const minimumBgScript =
|
|
4318
|
-
const dirname =
|
|
4188
|
+
const minimumBgScript = external_path_namespaceObject.resolve(__dirname, 'firefox' === browser || 'gecko-based' === browser ? 'minimum-firefox-file' : 'minimum-chromium-file');
|
|
4189
|
+
const dirname = external_path_namespaceObject.dirname(this.manifestPath);
|
|
4319
4190
|
let manifestBg = filterKeysForThisBrowser(manifest, browser);
|
|
4320
4191
|
if ('firefox' === browser || 'gecko-based' === browser) {
|
|
4321
4192
|
manifestBg = manifest.background;
|
|
4322
4193
|
const backgroundScripts = null == manifestBg ? void 0 : manifestBg.scripts;
|
|
4323
4194
|
if (backgroundScripts && backgroundScripts.length > 0) {
|
|
4324
|
-
const backgroundScriptsPath =
|
|
4195
|
+
const backgroundScriptsPath = external_path_namespaceObject.join(dirname, backgroundScripts[0]);
|
|
4325
4196
|
this.ensureFileExists(backgroundScriptsPath);
|
|
4326
4197
|
} else this.addDefaultEntry(compiler, "background/script", minimumBgScript);
|
|
4327
4198
|
} else {
|
|
@@ -4329,22 +4200,22 @@ class TargetWebExtensionPlugin {
|
|
|
4329
4200
|
if (3 === manifest.manifest_version) {
|
|
4330
4201
|
const serviceWorker = null == manifestBg ? void 0 : manifestBg.service_worker;
|
|
4331
4202
|
if (serviceWorker) {
|
|
4332
|
-
const serviceWorkerPath =
|
|
4203
|
+
const serviceWorkerPath = external_path_namespaceObject.join(dirname, serviceWorker);
|
|
4333
4204
|
this.ensureFileExists(serviceWorkerPath);
|
|
4334
4205
|
} else this.addDefaultEntry(compiler, 'background/service_worker', minimumBgScript);
|
|
4335
4206
|
} else if (2 === manifest.manifest_version) {
|
|
4336
4207
|
const backgroundScripts = null == manifestBg ? void 0 : manifestBg.scripts;
|
|
4337
4208
|
if (backgroundScripts && backgroundScripts.length > 0) {
|
|
4338
|
-
const backgroundScriptPath =
|
|
4209
|
+
const backgroundScriptPath = external_path_namespaceObject.join(dirname, backgroundScripts[0]);
|
|
4339
4210
|
this.ensureFileExists(backgroundScriptPath);
|
|
4340
4211
|
} else this.addDefaultEntry(compiler, "background/script", minimumBgScript);
|
|
4341
4212
|
}
|
|
4342
4213
|
}
|
|
4343
4214
|
}
|
|
4344
4215
|
ensureFileExists(filePath) {
|
|
4345
|
-
if (!
|
|
4216
|
+
if (!external_fs_namespaceObject.existsSync(filePath)) {
|
|
4346
4217
|
if (this.manifestPath) {
|
|
4347
|
-
const manifest = JSON.parse(
|
|
4218
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(this.manifestPath, 'utf8'));
|
|
4348
4219
|
const patchedManifest = filterKeysForThisBrowser(manifest, 'chrome');
|
|
4349
4220
|
const manifestName = patchedManifest.name || 'Extension.js';
|
|
4350
4221
|
const fieldError = backgroundIsRequired(manifestName, filePath);
|
|
@@ -4397,11 +4268,11 @@ class TargetWebExtensionPlugin {
|
|
|
4397
4268
|
};
|
|
4398
4269
|
}
|
|
4399
4270
|
apply(compiler) {
|
|
4400
|
-
if (!this.manifestPath || !
|
|
4401
|
-
const manifest = JSON.parse(
|
|
4271
|
+
if (!this.manifestPath || !external_fs_namespaceObject.lstatSync(this.manifestPath).isFile()) return;
|
|
4272
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(this.manifestPath, 'utf-8'));
|
|
4402
4273
|
const patchedManifest = filterKeysForThisBrowser(manifest, this.browser);
|
|
4403
4274
|
this.handleBackground(compiler, this.browser, patchedManifest);
|
|
4404
|
-
new
|
|
4275
|
+
new (external_webpack_target_webextension_default())({
|
|
4405
4276
|
background: this.getEntryName(patchedManifest),
|
|
4406
4277
|
weakRuntimeCheck: true
|
|
4407
4278
|
}).apply(this.convertToWebpackCompiler(compiler));
|
|
@@ -4493,11 +4364,10 @@ function feature_polyfill_define_property(obj, key, value) {
|
|
|
4493
4364
|
else obj[key] = value;
|
|
4494
4365
|
return obj;
|
|
4495
4366
|
}
|
|
4496
|
-
const feature_polyfill_dirname = getDirname(import.meta.url);
|
|
4497
4367
|
class PolyfillPlugin {
|
|
4498
4368
|
apply(compiler) {
|
|
4499
|
-
new
|
|
4500
|
-
browser:
|
|
4369
|
+
new (core_default()).ProvidePlugin({
|
|
4370
|
+
browser: external_path_namespaceObject.resolve(__dirname, '..', 'node_modules/webextension-polyfill/dist/browser-polyfill.js')
|
|
4501
4371
|
}).apply(compiler);
|
|
4502
4372
|
}
|
|
4503
4373
|
constructor(options){
|
|
@@ -4526,11 +4396,11 @@ class BrowserSpecificFieldsPlugin {
|
|
|
4526
4396
|
compiler.hooks.compilation.tap('compatibility:browser-specific-fields', (compilation)=>{
|
|
4527
4397
|
compilation.hooks.processAssets.tap({
|
|
4528
4398
|
name: 'compatibility:browser-specific-fields',
|
|
4529
|
-
stage:
|
|
4399
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
|
|
4530
4400
|
}, ()=>{
|
|
4531
4401
|
const manifest = getManifestContent(compilation, this.manifestPath);
|
|
4532
4402
|
const patchedSource = this.patchManifest(manifest);
|
|
4533
|
-
const rawSource = new
|
|
4403
|
+
const rawSource = new core_namespaceObject.sources.RawSource(patchedSource);
|
|
4534
4404
|
compilation.updateAsset('manifest.json', rawSource);
|
|
4535
4405
|
});
|
|
4536
4406
|
});
|
|
@@ -4575,7 +4445,12 @@ class CompatibilityPlugin {
|
|
|
4575
4445
|
}
|
|
4576
4446
|
}
|
|
4577
4447
|
plugin_compatibility_define_property(CompatibilityPlugin, "name", 'plugin-compatibility');
|
|
4578
|
-
|
|
4448
|
+
const external_os_namespaceObject = require("os");
|
|
4449
|
+
var external_os_default = /*#__PURE__*/ __webpack_require__.n(external_os_namespaceObject);
|
|
4450
|
+
const external_chrome_location2_namespaceObject = require("chrome-location2");
|
|
4451
|
+
var external_chrome_location2_default = /*#__PURE__*/ __webpack_require__.n(external_chrome_location2_namespaceObject);
|
|
4452
|
+
const external_edge_location_namespaceObject = require("edge-location");
|
|
4453
|
+
var external_edge_location_default = /*#__PURE__*/ __webpack_require__.n(external_edge_location_namespaceObject);
|
|
4579
4454
|
const masterPreferences = {
|
|
4580
4455
|
alternate_error_pages: {
|
|
4581
4456
|
enabled: false
|
|
@@ -4665,8 +4540,8 @@ const edgeMasterPreferences = {
|
|
|
4665
4540
|
...masterPreferences
|
|
4666
4541
|
};
|
|
4667
4542
|
function messages_getLoggingPrefix(browser, type) {
|
|
4668
|
-
const arrow = 'warn' === type ?
|
|
4669
|
-
return `${
|
|
4543
|
+
const arrow = 'warn' === type ? external_chalk_default().yellow("\u25BA\u25BA\u25BA") : 'info' === type ? external_chalk_default().cyan("\u25BA\u25BA\u25BA") : 'error' === type ? `${external_chalk_default().bold(external_chalk_default().red('ERROR'))} in ${capitalizedBrowserName(browser)} ${external_chalk_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}` : external_chalk_default().green("\u25BA\u25BA\u25BA");
|
|
4544
|
+
return `${external_chalk_default().gray('')}${arrow}`;
|
|
4670
4545
|
}
|
|
4671
4546
|
function capitalizedBrowserName(browser) {
|
|
4672
4547
|
return browser.charAt(0).toUpperCase() + browser.slice(1);
|
|
@@ -4683,75 +4558,77 @@ function browserInstanceExited(browser) {
|
|
|
4683
4558
|
}
|
|
4684
4559
|
function stdoutData(browser, mode) {
|
|
4685
4560
|
const extensionOutput = 'firefox' === browser || 'gecko-based' === browser ? 'Add-on' : 'Extension';
|
|
4686
|
-
return `${messages_getLoggingPrefix(browser, 'success')} ${capitalizedBrowserName(browser)} ${extensionOutput} running in ${
|
|
4561
|
+
return `${messages_getLoggingPrefix(browser, 'success')} ${capitalizedBrowserName(browser)} ${extensionOutput} running in ${external_chalk_default().blue(mode || 'unknown')} mode.`;
|
|
4687
4562
|
}
|
|
4688
4563
|
function browserNotInstalledError(browser, browserBinaryLocation) {
|
|
4689
4564
|
const isUnreacheable = 'null' == browserBinaryLocation ? `Browser is not installed\n\n` : `Can\'t find the browser path\n\n`;
|
|
4690
|
-
return `${messages_getLoggingPrefix(browser, 'error')} ${isUnreacheable}Either install the missing browser or choose a different one via ${
|
|
4565
|
+
return `${messages_getLoggingPrefix(browser, 'error')} ${isUnreacheable}Either install the missing browser or choose a different one via ${external_chalk_default().yellow('--browser')} flag.\n${external_chalk_default().red('NOT FOUND')} ${external_chalk_default().underline(browserBinaryLocation || capitalizedBrowserName(browser) + 'BROWSER')}`;
|
|
4691
4566
|
}
|
|
4692
4567
|
function messages_firefoxServiceWorkerError(browser) {
|
|
4693
|
-
return `${messages_getLoggingPrefix(browser, 'error')} No Service Worker Support\n\nFirefox does not support the ${
|
|
4568
|
+
return `${messages_getLoggingPrefix(browser, 'error')} No Service Worker Support\n\nFirefox does not support the ${external_chalk_default().yellow('background.service_worker')} field yet.\nUpdate your manifest.json file to use ${external_chalk_default().yellow("background.scripts")} instead.\n\nRead more: ${external_chalk_default().underline('https://bugzilla.mozilla.org/show_bug.cgi?id=1573659')}.`;
|
|
4694
4569
|
}
|
|
4695
4570
|
function browserLaunchError(browser, error) {
|
|
4696
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Error launching browser:\n${
|
|
4571
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Error launching browser:\n${external_chalk_default().red(error)}`;
|
|
4697
4572
|
}
|
|
4698
4573
|
function generalBrowserError(browser, error) {
|
|
4699
|
-
return `${messages_getLoggingPrefix(browser, 'error')} ${
|
|
4574
|
+
return `${messages_getLoggingPrefix(browser, 'error')} ${external_chalk_default().red(error.stack)}`;
|
|
4700
4575
|
}
|
|
4701
4576
|
function errorConnectingToBrowser(browser) {
|
|
4702
4577
|
return `${messages_getLoggingPrefix(browser, 'error')} Unable to connect to ${capitalizedBrowserName(browser)}. Too many retries.`;
|
|
4703
4578
|
}
|
|
4704
4579
|
function addonInstallError(browser, message) {
|
|
4705
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Error while installing temporary addon:\n${
|
|
4580
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Error while installing temporary addon:\n${external_chalk_default().red(message)}`;
|
|
4706
4581
|
}
|
|
4707
4582
|
function pathIsNotDirectoryError(browser, profilePath) {
|
|
4708
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Path is not directory\n\nPlease provide a valid directory path and try again.\n${
|
|
4583
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Path is not directory\n\nPlease provide a valid directory path and try again.\n${external_chalk_default().red('NOT DIRECTORY')} ${external_chalk_default().underline(profilePath)}`;
|
|
4709
4584
|
}
|
|
4710
4585
|
function parseMessageLengthError(browser) {
|
|
4711
4586
|
return `${messages_getLoggingPrefix(browser, 'error')} Error parsing message length.`;
|
|
4712
4587
|
}
|
|
4713
4588
|
function messagingClientClosedError(browser) {
|
|
4714
|
-
return `${messages_getLoggingPrefix(browser, 'error')} ${
|
|
4589
|
+
return `${messages_getLoggingPrefix(browser, 'error')} ${external_chalk_default().magenta('MessagingClient')} connection closed.`;
|
|
4715
4590
|
}
|
|
4716
4591
|
function requestWithoutTargetActorError(browser, requestType) {
|
|
4717
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Unexpected ${
|
|
4592
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Unexpected ${external_chalk_default().magenta('MessagingClient')} request without target actor: ${external_chalk_default().yellow(requestType)}`;
|
|
4718
4593
|
}
|
|
4719
4594
|
function connectionClosedError(browser) {
|
|
4720
|
-
return `${messages_getLoggingPrefix(browser, 'error')} ${
|
|
4595
|
+
return `${messages_getLoggingPrefix(browser, 'error')} ${external_chalk_default().magenta('MessagingClient')} connection closed.`;
|
|
4721
4596
|
}
|
|
4722
4597
|
function targetActorHasActiveRequestError(browser, targetActor) {
|
|
4723
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Target actor ${
|
|
4598
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Target actor ${external_chalk_default().yellow(targetActor)} already has an active request.`;
|
|
4724
4599
|
}
|
|
4725
4600
|
function parsingPacketError(browser, error) {
|
|
4726
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Error parsing packet: ${
|
|
4601
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Error parsing packet: ${external_chalk_default().red(error)}`;
|
|
4727
4602
|
}
|
|
4728
4603
|
function messageWithoutSenderError(browser, message) {
|
|
4729
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Message received without a sender actor:\n${
|
|
4604
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Message received without a sender actor:\n${external_chalk_default().yellow(JSON.stringify(message))}`;
|
|
4730
4605
|
}
|
|
4731
4606
|
function unexpectedMessageReceivedError(browser, message) {
|
|
4732
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Received unexpected message:\n${
|
|
4607
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Received unexpected message:\n${external_chalk_default().red(message)}`;
|
|
4733
4608
|
}
|
|
4734
4609
|
function isUsingStartingUrl(browser, value) {
|
|
4735
|
-
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${
|
|
4610
|
+
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${external_chalk_default().magenta('starting URL')} ${external_chalk_default().underline(value)}. `;
|
|
4736
4611
|
}
|
|
4737
4612
|
function isUsingBrowserBinary(binary, binaryPath) {
|
|
4738
|
-
return `${messages_getLoggingPrefix(binary, 'info')} Using own ${
|
|
4613
|
+
return `${messages_getLoggingPrefix(binary, 'info')} Using own ${external_chalk_default().magenta(`${capitalizedBrowserName(binary)} browser binary`)} ${external_chalk_default().underline(binaryPath)}. `;
|
|
4739
4614
|
}
|
|
4740
4615
|
function isUsingProfile(browser, profilePath) {
|
|
4741
|
-
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${
|
|
4616
|
+
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${external_chalk_default().magenta('browser profile')} ${external_chalk_default().underline(profilePath)}. `;
|
|
4742
4617
|
}
|
|
4743
4618
|
function isUsingPreferences(browser) {
|
|
4744
|
-
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${
|
|
4619
|
+
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${external_chalk_default().magenta('browser preferences')}. `;
|
|
4745
4620
|
}
|
|
4746
4621
|
function isUsingBrowserFlags(browser) {
|
|
4747
|
-
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${
|
|
4622
|
+
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${external_chalk_default().magenta('browser flags')}. `;
|
|
4748
4623
|
}
|
|
4749
4624
|
function isBrowserLauncherOpen(browser, isOpen) {
|
|
4750
|
-
return `${messages_getLoggingPrefix(browser, 'info')} Browser launcher is ${
|
|
4625
|
+
return `${messages_getLoggingPrefix(browser, 'info')} Browser launcher is ${external_chalk_default().yellow(isOpen ? 'enabled' : 'disabled')}. `;
|
|
4751
4626
|
}
|
|
4627
|
+
const external_progress_namespaceObject = require("progress");
|
|
4628
|
+
var external_progress_default = /*#__PURE__*/ __webpack_require__.n(external_progress_namespaceObject);
|
|
4752
4629
|
function addProgressBar(text, completionCallback) {
|
|
4753
4630
|
const contentLength = 131072;
|
|
4754
|
-
const bar = new
|
|
4631
|
+
const bar = new (external_progress_default())(`${text} [:bar] :percent :etas`, {
|
|
4755
4632
|
complete: '=',
|
|
4756
4633
|
incomplete: ' ',
|
|
4757
4634
|
width: 50,
|
|
@@ -4767,10 +4644,9 @@ function addProgressBar(text, completionCallback) {
|
|
|
4767
4644
|
}, 50);
|
|
4768
4645
|
}
|
|
4769
4646
|
function createProfile(browser, userProfilePath, configPreferences = {}) {
|
|
4770
|
-
if (userProfilePath &&
|
|
4771
|
-
const
|
|
4772
|
-
|
|
4773
|
-
if (!userProfilePath && external_fs_.existsSync(defaultProfilePath)) return external_path_.resolve(__dirname, `run-${browser}-profile`);
|
|
4647
|
+
if (userProfilePath && external_fs_namespaceObject.existsSync(userProfilePath)) return userProfilePath;
|
|
4648
|
+
const defaultProfilePath = external_path_namespaceObject.resolve(__dirname, `run-${browser}-profile`);
|
|
4649
|
+
if (!userProfilePath && external_fs_namespaceObject.existsSync(defaultProfilePath)) return external_path_namespaceObject.resolve(__dirname, `run-${browser}-profile`);
|
|
4774
4650
|
const preferences = 'chrome' === browser ? chromeMasterPreferences : edgeMasterPreferences;
|
|
4775
4651
|
const userProfile = JSON.stringify({
|
|
4776
4652
|
...preferences,
|
|
@@ -4778,14 +4654,14 @@ function createProfile(browser, userProfilePath, configPreferences = {}) {
|
|
|
4778
4654
|
});
|
|
4779
4655
|
addProgressBar(creatingUserProfile(browser), ()=>{
|
|
4780
4656
|
const profilePath = userProfilePath || defaultProfilePath;
|
|
4781
|
-
const preferences =
|
|
4782
|
-
|
|
4657
|
+
const preferences = external_path_namespaceObject.join(profilePath, 'Default');
|
|
4658
|
+
external_fs_namespaceObject.mkdirSync(preferences, {
|
|
4783
4659
|
recursive: true
|
|
4784
4660
|
});
|
|
4785
|
-
const preferencesPath =
|
|
4786
|
-
|
|
4661
|
+
const preferencesPath = external_path_namespaceObject.join(preferences, 'Preferences');
|
|
4662
|
+
external_fs_namespaceObject.writeFileSync(preferencesPath, userProfile, 'utf8');
|
|
4787
4663
|
});
|
|
4788
|
-
return
|
|
4664
|
+
return external_path_namespaceObject.resolve(__dirname, `run-${browser}-profile`);
|
|
4789
4665
|
}
|
|
4790
4666
|
const DEFAULT_BROWSER_FLAGS = [
|
|
4791
4667
|
'--no-first-run',
|
|
@@ -4848,19 +4724,19 @@ class RunChromiumPlugin {
|
|
|
4848
4724
|
let browserBinaryLocation;
|
|
4849
4725
|
switch(browser){
|
|
4850
4726
|
case 'chrome':
|
|
4851
|
-
browserBinaryLocation = (
|
|
4727
|
+
browserBinaryLocation = external_chrome_location2_default()();
|
|
4852
4728
|
break;
|
|
4853
4729
|
case 'edge':
|
|
4854
|
-
browserBinaryLocation = (
|
|
4730
|
+
browserBinaryLocation = external_edge_location_default()();
|
|
4855
4731
|
break;
|
|
4856
4732
|
case 'chromium-based':
|
|
4857
|
-
browserBinaryLocation =
|
|
4733
|
+
browserBinaryLocation = external_path_namespaceObject.normalize(this.chromiumBinary);
|
|
4858
4734
|
break;
|
|
4859
4735
|
default:
|
|
4860
|
-
browserBinaryLocation = (
|
|
4736
|
+
browserBinaryLocation = external_chrome_location2_default()();
|
|
4861
4737
|
break;
|
|
4862
4738
|
}
|
|
4863
|
-
if (!
|
|
4739
|
+
if (!external_fs_namespaceObject.existsSync(browserBinaryLocation)) {
|
|
4864
4740
|
console.error(browserNotInstalledError(browser, browserBinaryLocation));
|
|
4865
4741
|
process.exit();
|
|
4866
4742
|
}
|
|
@@ -4872,7 +4748,7 @@ class RunChromiumPlugin {
|
|
|
4872
4748
|
...chromiumConfig
|
|
4873
4749
|
];
|
|
4874
4750
|
const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'ignore';
|
|
4875
|
-
const child = (0,
|
|
4751
|
+
const child = (0, external_child_process_namespaceObject.spawn)(`${browserBinaryLocation}`, launchArgs, {
|
|
4876
4752
|
stdio
|
|
4877
4753
|
});
|
|
4878
4754
|
if ('development' === process.env.EXTENSION_ENV) {
|
|
@@ -4917,6 +4793,10 @@ class RunChromiumPlugin {
|
|
|
4917
4793
|
this.port = options.port;
|
|
4918
4794
|
}
|
|
4919
4795
|
}
|
|
4796
|
+
const external_firefox_location2_namespaceObject = require("firefox-location2");
|
|
4797
|
+
var external_firefox_location2_default = /*#__PURE__*/ __webpack_require__.n(external_firefox_location2_namespaceObject);
|
|
4798
|
+
const external_firefox_profile_namespaceObject = require("firefox-profile");
|
|
4799
|
+
var external_firefox_profile_default = /*#__PURE__*/ __webpack_require__.n(external_firefox_profile_namespaceObject);
|
|
4920
4800
|
const master_preferences_masterPreferences = {
|
|
4921
4801
|
'app.update.enabled': false,
|
|
4922
4802
|
'browser.dom.window.dump.enabled': true,
|
|
@@ -4971,38 +4851,38 @@ function getPreferences(customPrefs) {
|
|
|
4971
4851
|
};
|
|
4972
4852
|
}
|
|
4973
4853
|
function commands_lib_messages_getLoggingPrefix(type) {
|
|
4974
|
-
const arrow = 'warn' === type ?
|
|
4854
|
+
const arrow = 'warn' === type ? external_chalk_default().yellow("\u25BA\u25BA\u25BA") : 'info' === type ? external_chalk_default().cyan("\u25BA\u25BA\u25BA") : 'error' === type ? external_chalk_default().bold.red('ERROR') + ' in ' + external_chalk_default().red('Extension.js') + external_chalk_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E") : external_chalk_default().green("\u25BA\u25BA\u25BA");
|
|
4975
4855
|
return `${arrow}`;
|
|
4976
4856
|
}
|
|
4977
4857
|
function messages_manifestNotFoundError(manifestPath) {
|
|
4978
|
-
return `${commands_lib_messages_getLoggingPrefix('error')} Manifest file not found.\n\nEnsure the path to your extension exists and try again.\n${
|
|
4858
|
+
return `${commands_lib_messages_getLoggingPrefix('error')} Manifest file not found.\n\nEnsure the path to your extension exists and try again.\n${external_chalk_default().red('NOT FOUND')} ${external_chalk_default().underline(manifestPath)}`;
|
|
4979
4859
|
}
|
|
4980
4860
|
function runningInProduction(projectDir) {
|
|
4981
|
-
const outputPath =
|
|
4982
|
-
const manifestPath =
|
|
4983
|
-
const manifest = JSON.parse(
|
|
4861
|
+
const outputPath = external_path_namespaceObject.join(projectDir, 'dist');
|
|
4862
|
+
const manifestPath = external_path_namespaceObject.join(outputPath, 'manifest.json');
|
|
4863
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf-8'));
|
|
4984
4864
|
const { name, version, hostPermissions, permissions } = manifest;
|
|
4985
4865
|
const hasHost = hostPermissions && hostPermissions.length;
|
|
4986
4866
|
const hasPermissions = permissions && permissions.length;
|
|
4987
4867
|
return `
|
|
4988
|
-
\u{1F9E9} ${
|
|
4989
|
-
Extension Name ${
|
|
4990
|
-
Extension Version ${
|
|
4991
|
-
Host Permissions ${
|
|
4992
|
-
Permissions ${
|
|
4868
|
+
\u{1F9E9} ${external_chalk_default().green('Extension.js')} ${external_chalk_default().gray(`${package_namespaceObject.i8}`)}
|
|
4869
|
+
Extension Name ${external_chalk_default().gray(name)}
|
|
4870
|
+
Extension Version ${external_chalk_default().gray(version)}
|
|
4871
|
+
Host Permissions ${external_chalk_default().gray(hasHost ? hostPermissions.join(', ') : 'Browser defaults')}
|
|
4872
|
+
Permissions ${external_chalk_default().gray(hasPermissions ? permissions.join(', ') : 'Browser defaults')}
|
|
4993
4873
|
`;
|
|
4994
4874
|
}
|
|
4995
4875
|
function buildWebpack(projectDir, stats, browser) {
|
|
4996
4876
|
const statsJson = null == stats ? void 0 : stats.toJson();
|
|
4997
|
-
const manifestPath =
|
|
4998
|
-
const manifest = JSON.parse(
|
|
4877
|
+
const manifestPath = external_path_namespaceObject.join(projectDir, 'manifest.json');
|
|
4878
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf8'));
|
|
4999
4879
|
const assets = null == statsJson ? void 0 : statsJson.assets;
|
|
5000
|
-
const heading = `${commands_lib_messages_getLoggingPrefix('info')} Building ${
|
|
4880
|
+
const heading = `${commands_lib_messages_getLoggingPrefix('info')} Building ${external_chalk_default().cyan(manifest.name)} extension using ${messages_capitalizedBrowserName(browser)} defaults...\n\n`;
|
|
5001
4881
|
const buildTime = `\nBuild completed in ${(((null == statsJson ? void 0 : statsJson.time) || 0) / 1000).toFixed(2)} seconds.`;
|
|
5002
|
-
const buildTarget = `Build Target: ${
|
|
5003
|
-
const buildStatus = `Build Status: ${(null == stats ? void 0 : stats.hasErrors()) ?
|
|
5004
|
-
const version = `\nVersion: ${
|
|
5005
|
-
const size = `Size: ${
|
|
4882
|
+
const buildTarget = `Build Target: ${external_chalk_default().gray(messages_capitalizedBrowserName(browser))}\n`;
|
|
4883
|
+
const buildStatus = `Build Status: ${(null == stats ? void 0 : stats.hasErrors()) ? external_chalk_default().red('Failed') : external_chalk_default().green('Success')}\n`;
|
|
4884
|
+
const version = `\nVersion: ${external_chalk_default().gray(manifest.version)}\n`;
|
|
4885
|
+
const size = `Size: ${external_chalk_default().gray(getAssetsSize(assets))}\n`;
|
|
5006
4886
|
let output = '';
|
|
5007
4887
|
output += heading;
|
|
5008
4888
|
output += getAssetsTree(assets);
|
|
@@ -5014,55 +4894,55 @@ function buildWebpack(projectDir, stats, browser) {
|
|
|
5014
4894
|
return output;
|
|
5015
4895
|
}
|
|
5016
4896
|
function buildSuccess() {
|
|
5017
|
-
return `${commands_lib_messages_getLoggingPrefix('success')} No errors or warnings found. Your extension is ${
|
|
4897
|
+
return `${commands_lib_messages_getLoggingPrefix('success')} No errors or warnings found. Your extension is ${external_chalk_default().green('ready for deployment')}.`;
|
|
5018
4898
|
}
|
|
5019
4899
|
function fetchingProjectPath(owner, project) {
|
|
5020
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Fetching data...\n${
|
|
4900
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Fetching data...\n${external_chalk_default().gray('URL')} ${external_chalk_default().underline(`https://github.com/${owner}/${project}`)}`;
|
|
5021
4901
|
}
|
|
5022
4902
|
function downloadingProjectPath(projectName) {
|
|
5023
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Downloading ${
|
|
4903
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Downloading ${external_chalk_default().cyan(projectName)}...`;
|
|
5024
4904
|
}
|
|
5025
4905
|
function creatingProjectPath(projectPath) {
|
|
5026
|
-
return `\n${commands_lib_messages_getLoggingPrefix('info')} Creating a new browser extension...\n${
|
|
4906
|
+
return `\n${commands_lib_messages_getLoggingPrefix('info')} Creating a new browser extension...\n${external_chalk_default().gray('PATH')} ${external_chalk_default().underline(`${projectPath}`)}`;
|
|
5027
4907
|
}
|
|
5028
4908
|
function noGitIgnoreFound(projectDir) {
|
|
5029
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} No ${
|
|
4909
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} No ${external_chalk_default().yellow('.gitignore')} found, zipping all the content inside path:\n${external_chalk_default().gray('PATH')} ${external_chalk_default().underline(projectDir)}`;
|
|
5030
4910
|
}
|
|
5031
4911
|
function packagingSourceFiles(zipPath) {
|
|
5032
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Packaging source files. Files in ${
|
|
4912
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Packaging source files. Files in ${external_chalk_default().yellow('.gitignore')} will be excluded...\n${external_chalk_default().gray('PATH')} ${external_chalk_default().underline(zipPath)}.`;
|
|
5033
4913
|
}
|
|
5034
4914
|
function packagingDistributionFiles(zipPath) {
|
|
5035
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Packaging extension distribution files...\n${
|
|
4915
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Packaging extension distribution files...\n${external_chalk_default().gray('PATH')} ${external_chalk_default().underline(zipPath)}`;
|
|
5036
4916
|
}
|
|
5037
4917
|
function treeWithSourceAndDistFiles(browser, name, sourceZip, destZip) {
|
|
5038
|
-
return `\uD83D\uDCE6 Package name: ${
|
|
4918
|
+
return `\uD83D\uDCE6 Package name: ${external_chalk_default().yellow(`${name}`)}, Target Browser: ${messages_capitalizedBrowserName(browser)}\n ${external_chalk_default().gray("\u2514\u2500")} ${external_chalk_default().underline(`${sourceZip}`)} (source)\n ${external_chalk_default().gray("\u2514\u2500")} ${external_chalk_default().underline(`${destZip}`)} (distribution)`;
|
|
5039
4919
|
}
|
|
5040
4920
|
function treeWithDistFilesbrowser(name, ext, browser, zipPath) {
|
|
5041
|
-
return `\uD83D\uDCE6 Package name: ${
|
|
4921
|
+
return `\uD83D\uDCE6 Package name: ${external_chalk_default().yellow(`${name}.${ext}`)}, Target Browser: ${messages_capitalizedBrowserName(browser)}\n ${external_chalk_default().gray("\u2514\u2500")} ${external_chalk_default().underline(`${zipPath}`)} ${external_chalk_default().gray('(distribution)')}`;
|
|
5042
4922
|
}
|
|
5043
4923
|
function treeWithSourceFiles(name, ext, browser, zipPath) {
|
|
5044
|
-
return `\uD83D\uDCE6 Package name: ${
|
|
4924
|
+
return `\uD83D\uDCE6 Package name: ${external_chalk_default().yellow(`${name}-source.${ext}`)}, Target Browser: ${messages_capitalizedBrowserName(browser)}\n ${external_chalk_default().gray("\u2514\u2500")} ${external_chalk_default().underline(`${zipPath}`)} (source)`;
|
|
5045
4925
|
}
|
|
5046
4926
|
function failedToCompressError(error) {
|
|
5047
|
-
return `${commands_lib_messages_getLoggingPrefix('error')} Failed to compress extension package.\n${
|
|
4927
|
+
return `${commands_lib_messages_getLoggingPrefix('error')} Failed to compress extension package.\n${external_chalk_default().red(error)}`;
|
|
5048
4928
|
}
|
|
5049
4929
|
function writingTypeDefinitions(manifest) {
|
|
5050
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Writing type definitions for ${
|
|
4930
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Writing type definitions for ${external_chalk_default().cyan(manifest.name || '')}...`;
|
|
5051
4931
|
}
|
|
5052
4932
|
function writingTypeDefinitionsError(error) {
|
|
5053
|
-
return `${commands_lib_messages_getLoggingPrefix('error')} Failed to write the extension type definition.\n${
|
|
4933
|
+
return `${commands_lib_messages_getLoggingPrefix('error')} Failed to write the extension type definition.\n${external_chalk_default().red(error)}`;
|
|
5054
4934
|
}
|
|
5055
4935
|
function downloadingText(url) {
|
|
5056
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Downloading extension...\n${
|
|
4936
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Downloading extension...\n${external_chalk_default().gray('URL')} ${external_chalk_default().underline(url)}`;
|
|
5057
4937
|
}
|
|
5058
4938
|
function unpackagingExtension(zipFilePath) {
|
|
5059
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Unpackaging browser extension...\n${
|
|
4939
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Unpackaging browser extension...\n${external_chalk_default().gray('PATH')} ${external_chalk_default().underline(zipFilePath)}`;
|
|
5060
4940
|
}
|
|
5061
4941
|
function unpackagedSuccessfully() {
|
|
5062
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Browser extension unpackaged ${
|
|
4942
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Browser extension unpackaged ${external_chalk_default().green('successfully')}.`;
|
|
5063
4943
|
}
|
|
5064
4944
|
function failedToDownloadOrExtractZIPFileError(error) {
|
|
5065
|
-
return `${commands_lib_messages_getLoggingPrefix('error')} Failed to download or extract ZIP file. ${
|
|
4945
|
+
return `${commands_lib_messages_getLoggingPrefix('error')} Failed to download or extract ZIP file. ${external_chalk_default().red(error)}`;
|
|
5066
4946
|
}
|
|
5067
4947
|
function messages_capitalizedBrowserName(browser) {
|
|
5068
4948
|
return browser.charAt(0).toUpperCase() + browser.slice(1);
|
|
@@ -5083,8 +4963,8 @@ function printTree(node, prefix = '') {
|
|
|
5083
4963
|
const isLast = index === array.length - 1;
|
|
5084
4964
|
const connector = isLast ? "\u2514\u2500" : "\u251C\u2500";
|
|
5085
4965
|
const sizeInKB = node[key].size ? ` (${getFileSize(node[key].size)})` : '';
|
|
5086
|
-
output += `${
|
|
5087
|
-
if ('object' == typeof node[key] && !node[key].size) output += printTree(node[key], `${prefix}${isLast ? ' ' :
|
|
4966
|
+
output += `${external_chalk_default().gray(prefix)}${external_chalk_default().gray(connector)} ${key}${external_chalk_default().gray(sizeInKB)}\n`;
|
|
4967
|
+
if ('object' == typeof node[key] && !node[key].size) output += printTree(node[key], `${prefix}${isLast ? ' ' : external_chalk_default().gray("\u2502 ")}`);
|
|
5088
4968
|
});
|
|
5089
4969
|
return output;
|
|
5090
4970
|
}
|
|
@@ -5104,7 +4984,7 @@ function getAssetsTree(assets) {
|
|
|
5104
4984
|
return `.\n${printTree(assetTree)}`;
|
|
5105
4985
|
}
|
|
5106
4986
|
function isUsingExperimentalConfig(integration) {
|
|
5107
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Using ${
|
|
4987
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Using ${external_chalk_default().magenta(integration)}. ${external_chalk_default().yellow('This is very experimental')}.`;
|
|
5108
4988
|
}
|
|
5109
4989
|
function installingDependencies() {
|
|
5110
4990
|
return `${commands_lib_messages_getLoggingPrefix('info')} Installing project dependencies...`;
|
|
@@ -5113,17 +4993,17 @@ function installingDependenciesFailed(gitCommand, gitArgs, code) {
|
|
|
5113
4993
|
return `${commands_lib_messages_getLoggingPrefix('error')} Command ${gitCommand} ${gitArgs.join(' ')} failed with exit code ${code}`;
|
|
5114
4994
|
}
|
|
5115
4995
|
function cantInstallDependencies(error) {
|
|
5116
|
-
return `${commands_lib_messages_getLoggingPrefix('error')} Can't install project dependencies. ${
|
|
4996
|
+
return `${commands_lib_messages_getLoggingPrefix('error')} Can't install project dependencies. ${external_chalk_default().red(error.message || error.toString())}`;
|
|
5117
4997
|
}
|
|
5118
4998
|
async function loadConfigFile(configPath) {
|
|
5119
|
-
const absolutePath =
|
|
4999
|
+
const absolutePath = external_path_namespaceObject.resolve(configPath);
|
|
5120
5000
|
try {
|
|
5121
5001
|
const module = await import(absolutePath);
|
|
5122
5002
|
return module.default || module;
|
|
5123
5003
|
} catch (err) {
|
|
5124
5004
|
const error = err;
|
|
5125
5005
|
try {
|
|
5126
|
-
const content =
|
|
5006
|
+
const content = external_fs_namespaceObject.readFileSync(absolutePath, 'utf-8');
|
|
5127
5007
|
return JSON.parse(content);
|
|
5128
5008
|
} catch (jsonErr) {
|
|
5129
5009
|
throw new Error(`Failed to load config file: ${configPath}\nError: ${error.message || error}`);
|
|
@@ -5131,10 +5011,10 @@ async function loadConfigFile(configPath) {
|
|
|
5131
5011
|
}
|
|
5132
5012
|
}
|
|
5133
5013
|
async function loadCustomWebpackConfig(projectPath) {
|
|
5134
|
-
const userConfigPath =
|
|
5135
|
-
const moduleUserConfigPath =
|
|
5136
|
-
if (
|
|
5137
|
-
const configPath =
|
|
5014
|
+
const userConfigPath = external_path_namespaceObject.join(projectPath, 'extension.config.js');
|
|
5015
|
+
const moduleUserConfigPath = external_path_namespaceObject.join(projectPath, 'extension.config.mjs');
|
|
5016
|
+
if (external_fs_namespaceObject.existsSync(userConfigPath) || external_fs_namespaceObject.existsSync(moduleUserConfigPath)) {
|
|
5017
|
+
const configPath = external_fs_namespaceObject.existsSync(userConfigPath) ? userConfigPath : moduleUserConfigPath;
|
|
5138
5018
|
if (await get_extension_config_isUsingExperimentalConfig(projectPath)) try {
|
|
5139
5019
|
const userConfig = await loadConfigFile(configPath);
|
|
5140
5020
|
if (userConfig && 'function' == typeof userConfig.config) return userConfig.config;
|
|
@@ -5147,10 +5027,10 @@ async function loadCustomWebpackConfig(projectPath) {
|
|
|
5147
5027
|
return (config)=>config;
|
|
5148
5028
|
}
|
|
5149
5029
|
async function loadCommandConfig(projectPath, command) {
|
|
5150
|
-
const userConfigPath =
|
|
5151
|
-
const moduleUserConfigPath =
|
|
5152
|
-
const configPath =
|
|
5153
|
-
if (
|
|
5030
|
+
const userConfigPath = external_path_namespaceObject.join(projectPath, 'extension.config.js');
|
|
5031
|
+
const moduleUserConfigPath = external_path_namespaceObject.join(projectPath, 'extension.config.mjs');
|
|
5032
|
+
const configPath = external_fs_namespaceObject.existsSync(userConfigPath) ? userConfigPath : moduleUserConfigPath;
|
|
5033
|
+
if (external_fs_namespaceObject.existsSync(userConfigPath) || external_fs_namespaceObject.existsSync(moduleUserConfigPath)) {
|
|
5154
5034
|
if (await get_extension_config_isUsingExperimentalConfig(projectPath)) try {
|
|
5155
5035
|
const userConfig = await loadConfigFile(configPath);
|
|
5156
5036
|
if (userConfig) return userConfig[command];
|
|
@@ -5163,10 +5043,10 @@ async function loadCommandConfig(projectPath, command) {
|
|
|
5163
5043
|
return {};
|
|
5164
5044
|
}
|
|
5165
5045
|
async function loadBrowserConfig(projectPath, browser = 'chrome') {
|
|
5166
|
-
const userConfigPath =
|
|
5167
|
-
const moduleUserConfigPath =
|
|
5168
|
-
const configPath =
|
|
5169
|
-
if (
|
|
5046
|
+
const userConfigPath = external_path_namespaceObject.join(projectPath, 'extension.config.js');
|
|
5047
|
+
const moduleUserConfigPath = external_path_namespaceObject.join(projectPath, 'extension.config.mjs');
|
|
5048
|
+
const configPath = external_fs_namespaceObject.existsSync(userConfigPath) ? userConfigPath : moduleUserConfigPath;
|
|
5049
|
+
if (external_fs_namespaceObject.existsSync(userConfigPath) || external_fs_namespaceObject.existsSync(moduleUserConfigPath)) {
|
|
5170
5050
|
if (await get_extension_config_isUsingExperimentalConfig(projectPath)) try {
|
|
5171
5051
|
const userConfig = await loadConfigFile(configPath);
|
|
5172
5052
|
if (userConfig && userConfig.browser && userConfig.browser[browser]) return userConfig.browser[browser] || {
|
|
@@ -5184,10 +5064,10 @@ async function loadBrowserConfig(projectPath, browser = 'chrome') {
|
|
|
5184
5064
|
}
|
|
5185
5065
|
let get_extension_config_userMessageDelivered = false;
|
|
5186
5066
|
async function get_extension_config_isUsingExperimentalConfig(projectPath) {
|
|
5187
|
-
const userConfigPath =
|
|
5188
|
-
const moduleUserConfigPath =
|
|
5189
|
-
const configPath =
|
|
5190
|
-
if (
|
|
5067
|
+
const userConfigPath = external_path_namespaceObject.join(projectPath, 'extension.config.js');
|
|
5068
|
+
const moduleUserConfigPath = external_path_namespaceObject.join(projectPath, 'extension.config.mjs');
|
|
5069
|
+
const configPath = external_fs_namespaceObject.existsSync(userConfigPath) ? userConfigPath : moduleUserConfigPath;
|
|
5070
|
+
if (external_fs_namespaceObject.existsSync(configPath) || external_fs_namespaceObject.existsSync(moduleUserConfigPath)) {
|
|
5191
5071
|
if (!get_extension_config_userMessageDelivered) {
|
|
5192
5072
|
console.log(isUsingExperimentalConfig('extension.config.js'));
|
|
5193
5073
|
get_extension_config_userMessageDelivered = true;
|
|
@@ -5197,9 +5077,8 @@ async function get_extension_config_isUsingExperimentalConfig(projectPath) {
|
|
|
5197
5077
|
return false;
|
|
5198
5078
|
}
|
|
5199
5079
|
function configureProfile(profile, customPreferences) {
|
|
5200
|
-
const __dirname = getDirname(import.meta.url);
|
|
5201
5080
|
const firefoxMasterPreferences = {
|
|
5202
|
-
...loadBrowserConfig(
|
|
5081
|
+
...loadBrowserConfig(external_path_namespaceObject.resolve(__dirname, 'run-firefox'), 'firefox'),
|
|
5203
5082
|
...getPreferences(customPreferences)
|
|
5204
5083
|
};
|
|
5205
5084
|
const preferenceKeys = Object.keys(firefoxMasterPreferences);
|
|
@@ -5214,7 +5093,7 @@ function configureProfile(profile, customPreferences) {
|
|
|
5214
5093
|
return profile;
|
|
5215
5094
|
}
|
|
5216
5095
|
function createProfileDir(destinationDirectory, customPreferences) {
|
|
5217
|
-
const profile = new
|
|
5096
|
+
const profile = new (external_firefox_profile_default())({
|
|
5218
5097
|
destinationDirectory
|
|
5219
5098
|
});
|
|
5220
5099
|
const profileConfigured = configureProfile(profile, customPreferences);
|
|
@@ -5222,10 +5101,10 @@ function createProfileDir(destinationDirectory, customPreferences) {
|
|
|
5222
5101
|
}
|
|
5223
5102
|
function getProfile(browser, profilePath, customPreferences) {
|
|
5224
5103
|
let destinationDirectory;
|
|
5225
|
-
const profileIsDirPath =
|
|
5104
|
+
const profileIsDirPath = external_fs_namespaceObject.statSync(profilePath).isDirectory();
|
|
5226
5105
|
if (profileIsDirPath) destinationDirectory = profilePath;
|
|
5227
5106
|
else throw new Error(pathIsNotDirectoryError(browser, profilePath));
|
|
5228
|
-
const profile = new
|
|
5107
|
+
const profile = new (external_firefox_profile_default())({
|
|
5229
5108
|
destinationDirectory
|
|
5230
5109
|
});
|
|
5231
5110
|
const profileConfigured = configureProfile(profile, customPreferences);
|
|
@@ -5233,18 +5112,17 @@ function getProfile(browser, profilePath, customPreferences) {
|
|
|
5233
5112
|
}
|
|
5234
5113
|
function create_profile_createProfile(browser, userProfilePath, configPreferences = {}) {
|
|
5235
5114
|
let profile;
|
|
5236
|
-
const
|
|
5237
|
-
const dataDir = userProfilePath || external_path_.resolve(__dirname, `run-${browser}-profile`);
|
|
5115
|
+
const dataDir = userProfilePath || external_path_namespaceObject.resolve(__dirname, `run-${browser}-profile`);
|
|
5238
5116
|
const firefoxMasterPreferences = getPreferences(configPreferences || {});
|
|
5239
5117
|
const preferences = firefoxMasterPreferences;
|
|
5240
5118
|
const userPreferences = {
|
|
5241
5119
|
...preferences,
|
|
5242
5120
|
...configPreferences
|
|
5243
5121
|
};
|
|
5244
|
-
if (!userProfilePath &&
|
|
5122
|
+
if (!userProfilePath && external_fs_namespaceObject.existsSync(dataDir)) profile = getProfile(browser, dataDir, userPreferences);
|
|
5245
5123
|
else {
|
|
5246
5124
|
addProgressBar(creatingUserProfile(browser), ()=>{});
|
|
5247
|
-
|
|
5125
|
+
external_fs_namespaceObject.mkdirSync(dataDir, {
|
|
5248
5126
|
recursive: true
|
|
5249
5127
|
});
|
|
5250
5128
|
profile = createProfileDir(dataDir, userPreferences);
|
|
@@ -5267,6 +5145,10 @@ async function firefox_browser_config_browserConfig(compiler, configOptions) {
|
|
|
5267
5145
|
'--verbose'
|
|
5268
5146
|
].join(' ');
|
|
5269
5147
|
}
|
|
5148
|
+
const external_net_namespaceObject = require("net");
|
|
5149
|
+
var external_net_default = /*#__PURE__*/ __webpack_require__.n(external_net_namespaceObject);
|
|
5150
|
+
const external_events_namespaceObject = require("events");
|
|
5151
|
+
var external_events_default = /*#__PURE__*/ __webpack_require__.n(external_events_namespaceObject);
|
|
5270
5152
|
function messaging_client_define_property(obj, key, value) {
|
|
5271
5153
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
5272
5154
|
value: value,
|
|
@@ -5308,7 +5190,7 @@ function parseMessage(browser, data) {
|
|
|
5308
5190
|
};
|
|
5309
5191
|
}
|
|
5310
5192
|
}
|
|
5311
|
-
class MessagingClient extends
|
|
5193
|
+
class MessagingClient extends external_events_default() {
|
|
5312
5194
|
async connect(port) {
|
|
5313
5195
|
await new Promise((resolve, reject)=>{
|
|
5314
5196
|
try {
|
|
@@ -5316,7 +5198,7 @@ class MessagingClient extends __WEBPACK_EXTERNAL_MODULE_events__["default"] {
|
|
|
5316
5198
|
port,
|
|
5317
5199
|
host: '127.0.0.1'
|
|
5318
5200
|
};
|
|
5319
|
-
const conn =
|
|
5201
|
+
const conn = external_net_default().createConnection(connectionOptions, ()=>{
|
|
5320
5202
|
resolve();
|
|
5321
5203
|
});
|
|
5322
5204
|
this.connection = conn;
|
|
@@ -5479,7 +5361,7 @@ class RemoteFirefox {
|
|
|
5479
5361
|
const port = devPort ? devPort + 100 : 9222;
|
|
5480
5362
|
const client = await this.connectClient(port);
|
|
5481
5363
|
for (const [index, extension] of extensionsToLoad.entries()){
|
|
5482
|
-
const addonPath =
|
|
5364
|
+
const addonPath = external_path_namespaceObject.join(extension.replace(/"/g, ''));
|
|
5483
5365
|
const isDevtoolsEnabled = 0 === index && devtools;
|
|
5484
5366
|
try {
|
|
5485
5367
|
const addons = await client.request({
|
|
@@ -5527,7 +5409,7 @@ class RunFirefoxPlugin {
|
|
|
5527
5409
|
const globalNpxPath = isFromPnpx() ? 'pnpm dlx fx-runner' : 'npm exec fx-runner';
|
|
5528
5410
|
try {
|
|
5529
5411
|
await new Promise((resolve, reject)=>{
|
|
5530
|
-
(0,
|
|
5412
|
+
(0, external_child_process_namespaceObject.exec)(`${globalNpxPath} --version`, (err)=>{
|
|
5531
5413
|
if (err) reject(err);
|
|
5532
5414
|
else resolve(null);
|
|
5533
5415
|
});
|
|
@@ -5543,20 +5425,20 @@ class RunFirefoxPlugin {
|
|
|
5543
5425
|
let browserBinaryLocation = null;
|
|
5544
5426
|
switch(options.browser){
|
|
5545
5427
|
case 'gecko-based':
|
|
5546
|
-
browserBinaryLocation =
|
|
5428
|
+
browserBinaryLocation = external_path_namespaceObject.normalize(this.geckoBinary);
|
|
5547
5429
|
break;
|
|
5548
5430
|
default:
|
|
5549
|
-
browserBinaryLocation = (
|
|
5431
|
+
browserBinaryLocation = external_firefox_location2_default()();
|
|
5550
5432
|
break;
|
|
5551
5433
|
}
|
|
5552
5434
|
const firefoxLaunchPath = `${fxRunnerCmd} start --binary "${browserBinaryLocation}" --foreground --no-remote`;
|
|
5553
|
-
if (!
|
|
5435
|
+
if (!external_fs_namespaceObject.existsSync(browserBinaryLocation || '')) {
|
|
5554
5436
|
console.error(browserNotInstalledError(this.browser, browserBinaryLocation || ''));
|
|
5555
5437
|
process.exit(1);
|
|
5556
5438
|
}
|
|
5557
5439
|
const firefoxConfig = await firefox_browser_config_browserConfig(compiler, options);
|
|
5558
5440
|
const cmd = `${firefoxLaunchPath} ${firefoxConfig}`;
|
|
5559
|
-
run_firefox_child = (0,
|
|
5441
|
+
run_firefox_child = (0, external_child_process_namespaceObject.exec)(cmd, (error, _stdout, stderr)=>{
|
|
5560
5442
|
if (null != error) throw error;
|
|
5561
5443
|
if (stderr.includes('Unable to move the cache')) console.log(browserInstanceAlreadyRunning(this.browser));
|
|
5562
5444
|
else {
|
|
@@ -5634,9 +5516,8 @@ function plugin_browsers_define_property(obj, key, value) {
|
|
|
5634
5516
|
class BrowsersPlugin {
|
|
5635
5517
|
getProfilePath(compiler, browser, profile) {
|
|
5636
5518
|
if (profile) return profile;
|
|
5637
|
-
if ('production' === compiler.options.mode) return
|
|
5638
|
-
|
|
5639
|
-
return external_path_.resolve(__dirname, `run-${browser}-profile`);
|
|
5519
|
+
if ('production' === compiler.options.mode) return external_path_namespaceObject.join(external_os_default().tmpdir(), 'extension-js', browser, 'profile');
|
|
5520
|
+
return external_path_namespaceObject.resolve(__dirname, `run-${browser}-profile`);
|
|
5640
5521
|
}
|
|
5641
5522
|
async apply(compiler) {
|
|
5642
5523
|
var _compiler_options_devServer;
|
|
@@ -5725,12 +5606,11 @@ class BrowsersPlugin {
|
|
|
5725
5606
|
}
|
|
5726
5607
|
}
|
|
5727
5608
|
plugin_browsers_define_property(BrowsersPlugin, "name", 'plugin-browsers');
|
|
5728
|
-
const webpack_config_dirname = getDirname(import.meta.url);
|
|
5729
5609
|
function webpackConfig(projectPath, devOptions) {
|
|
5730
5610
|
var _devOptions_output;
|
|
5731
|
-
const manifestPath =
|
|
5732
|
-
const manifest = filterKeysForThisBrowser(JSON.parse(
|
|
5733
|
-
const userExtensionOutputPath =
|
|
5611
|
+
const manifestPath = external_path_namespaceObject.join(projectPath, 'manifest.json');
|
|
5612
|
+
const manifest = filterKeysForThisBrowser(JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf-8')), devOptions.browser);
|
|
5613
|
+
const userExtensionOutputPath = external_path_namespaceObject.join(projectPath, `dist/${devOptions.browser}`);
|
|
5734
5614
|
const browser = devOptions.chromiumBinary ? 'chromium-based' : devOptions.geckoBinary ? 'gecko-based' : devOptions.browser;
|
|
5735
5615
|
return {
|
|
5736
5616
|
mode: devOptions.mode || 'development',
|
|
@@ -5752,7 +5632,7 @@ function webpackConfig(projectPath, devOptions) {
|
|
|
5752
5632
|
resolve: {
|
|
5753
5633
|
modules: [
|
|
5754
5634
|
'node_modules',
|
|
5755
|
-
|
|
5635
|
+
external_path_namespaceObject.join(projectPath, 'node_modules')
|
|
5756
5636
|
],
|
|
5757
5637
|
extensions: [
|
|
5758
5638
|
'.js',
|
|
@@ -5812,7 +5692,7 @@ function webpackConfig(projectPath, devOptions) {
|
|
|
5812
5692
|
new BrowsersPlugin({
|
|
5813
5693
|
extension: [
|
|
5814
5694
|
userExtensionOutputPath,
|
|
5815
|
-
|
|
5695
|
+
external_path_namespaceObject.join(__dirname, 'extensions', `${browser}-manager-extension`)
|
|
5816
5696
|
],
|
|
5817
5697
|
browser,
|
|
5818
5698
|
open: devOptions.open,
|
|
@@ -5846,27 +5726,36 @@ function webpackConfig(projectPath, devOptions) {
|
|
|
5846
5726
|
}
|
|
5847
5727
|
};
|
|
5848
5728
|
}
|
|
5849
|
-
const
|
|
5729
|
+
const external_go_git_it_namespaceObject = require("go-git-it");
|
|
5730
|
+
var external_go_git_it_default = /*#__PURE__*/ __webpack_require__.n(external_go_git_it_namespaceObject);
|
|
5731
|
+
const external_axios_namespaceObject = require("axios");
|
|
5732
|
+
var external_axios_default = /*#__PURE__*/ __webpack_require__.n(external_axios_namespaceObject);
|
|
5733
|
+
const external_stream_namespaceObject = require("stream");
|
|
5734
|
+
var external_stream_default = /*#__PURE__*/ __webpack_require__.n(external_stream_namespaceObject);
|
|
5735
|
+
const external_adm_zip_namespaceObject = require("adm-zip");
|
|
5736
|
+
var external_adm_zip_default = /*#__PURE__*/ __webpack_require__.n(external_adm_zip_namespaceObject);
|
|
5737
|
+
const external_util_namespaceObject = require("util");
|
|
5738
|
+
const pipeline = (0, external_util_namespaceObject.promisify)(external_stream_default().pipeline);
|
|
5850
5739
|
async function downloadAndExtractZip(url, targetPath) {
|
|
5851
5740
|
const urlNoSearchParams = url.split('?')[0];
|
|
5852
5741
|
try {
|
|
5853
5742
|
console.log(downloadingText(urlNoSearchParams));
|
|
5854
|
-
const response = await
|
|
5743
|
+
const response = await external_axios_default().get(url, {
|
|
5855
5744
|
responseType: 'stream'
|
|
5856
5745
|
});
|
|
5857
|
-
const extname =
|
|
5858
|
-
const basename =
|
|
5859
|
-
const destinationPath =
|
|
5746
|
+
const extname = external_path_namespaceObject.extname(urlNoSearchParams);
|
|
5747
|
+
const basename = external_path_namespaceObject.basename(urlNoSearchParams, extname);
|
|
5748
|
+
const destinationPath = external_path_namespaceObject.join(targetPath, basename);
|
|
5860
5749
|
console.log(unpackagingExtension(destinationPath));
|
|
5861
5750
|
const zipChunks = [];
|
|
5862
|
-
await pipeline(response.data, new
|
|
5751
|
+
await pipeline(response.data, new (external_stream_default()).Writable({
|
|
5863
5752
|
write (chunk, _encoding, callback) {
|
|
5864
5753
|
zipChunks.push(chunk);
|
|
5865
5754
|
callback();
|
|
5866
5755
|
}
|
|
5867
5756
|
}));
|
|
5868
5757
|
const zipBuffer = Buffer.concat(zipChunks);
|
|
5869
|
-
const zip = new
|
|
5758
|
+
const zip = new (external_adm_zip_default())(zipBuffer);
|
|
5870
5759
|
zip.extractAllTo(destinationPath, true);
|
|
5871
5760
|
console.log(unpackagedSuccessfully());
|
|
5872
5761
|
return destinationPath;
|
|
@@ -5884,8 +5773,8 @@ const get_project_path_isUrl = (url)=>{
|
|
|
5884
5773
|
}
|
|
5885
5774
|
};
|
|
5886
5775
|
async function importUrlSourceFromGithub(pathOrRemoteUrl, text) {
|
|
5887
|
-
await (
|
|
5888
|
-
return
|
|
5776
|
+
await external_go_git_it_default()(pathOrRemoteUrl, process.cwd(), text);
|
|
5777
|
+
return external_path_namespaceObject.resolve(process.cwd(), external_path_namespaceObject.basename(pathOrRemoteUrl));
|
|
5889
5778
|
}
|
|
5890
5779
|
async function importUrlSourceFromZip(pathOrRemoteUrl) {
|
|
5891
5780
|
const zipFilePath = await downloadAndExtractZip(pathOrRemoteUrl, process.cwd());
|
|
@@ -5904,16 +5793,22 @@ async function getProjectPath(pathOrRemoteUrl) {
|
|
|
5904
5793
|
const owner = urlData.slice(1, 3)[0];
|
|
5905
5794
|
const project = urlData.slice(1, 3)[1];
|
|
5906
5795
|
console.log(fetchingProjectPath(owner, project));
|
|
5907
|
-
const projectName =
|
|
5796
|
+
const projectName = external_path_namespaceObject.basename(url.pathname);
|
|
5908
5797
|
const urlSource = await importUrlSourceFromGithub(pathOrRemoteUrl, downloadingProjectPath(projectName));
|
|
5909
5798
|
console.log(creatingProjectPath(projectName));
|
|
5910
5799
|
return urlSource;
|
|
5911
5800
|
}
|
|
5912
5801
|
}
|
|
5913
|
-
return
|
|
5802
|
+
return external_path_namespaceObject.resolve(process.cwd(), pathOrRemoteUrl);
|
|
5914
5803
|
}
|
|
5804
|
+
const external_ignore_namespaceObject = require("ignore");
|
|
5805
|
+
var external_ignore_default = /*#__PURE__*/ __webpack_require__.n(external_ignore_namespaceObject);
|
|
5806
|
+
const external_tiny_glob_namespaceObject = require("tiny-glob");
|
|
5807
|
+
var external_tiny_glob_default = /*#__PURE__*/ __webpack_require__.n(external_tiny_glob_namespaceObject);
|
|
5808
|
+
const external_slugify_namespaceObject = require("slugify");
|
|
5809
|
+
var external_slugify_default = /*#__PURE__*/ __webpack_require__.n(external_slugify_namespaceObject);
|
|
5915
5810
|
function sanitizeString(input) {
|
|
5916
|
-
return (
|
|
5811
|
+
return external_slugify_default()(input, {
|
|
5917
5812
|
replacement: '-',
|
|
5918
5813
|
remove: /[^a-zA-Z0-9 ]/g,
|
|
5919
5814
|
lower: true
|
|
@@ -5936,12 +5831,12 @@ function getPackageName(manifest, options) {
|
|
|
5936
5831
|
return `${sanitizedStr}-${manifest.version}`;
|
|
5937
5832
|
}
|
|
5938
5833
|
async function getFilesToZip(projectDir) {
|
|
5939
|
-
const gitignorePath =
|
|
5940
|
-
const gitignoreContent =
|
|
5941
|
-
const ig = (
|
|
5834
|
+
const gitignorePath = external_path_namespaceObject.join(projectDir, '.gitignore');
|
|
5835
|
+
const gitignoreContent = external_fs_namespaceObject.readFileSync(gitignorePath);
|
|
5836
|
+
const ig = external_ignore_default()();
|
|
5942
5837
|
if (gitignoreContent) ig.add(gitignoreContent.toString());
|
|
5943
5838
|
else console.log(noGitIgnoreFound(projectDir));
|
|
5944
|
-
const files = await (
|
|
5839
|
+
const files = await external_tiny_glob_default()('**/*', {
|
|
5945
5840
|
cwd: projectDir,
|
|
5946
5841
|
dot: true
|
|
5947
5842
|
});
|
|
@@ -5949,32 +5844,32 @@ async function getFilesToZip(projectDir) {
|
|
|
5949
5844
|
}
|
|
5950
5845
|
async function generateZip(projectDir, { browser = 'chrome', ...options }) {
|
|
5951
5846
|
try {
|
|
5952
|
-
const distDir =
|
|
5953
|
-
const outputDir =
|
|
5847
|
+
const distDir = external_path_namespaceObject.join(projectDir, 'dist');
|
|
5848
|
+
const outputDir = external_path_namespaceObject.join(distDir, browser);
|
|
5954
5849
|
const dataDir = options.zipSource ? projectDir : outputDir;
|
|
5955
|
-
const manifestPath =
|
|
5956
|
-
const manifest = JSON.parse(
|
|
5850
|
+
const manifestPath = external_path_namespaceObject.join(dataDir, 'manifest.json');
|
|
5851
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf8'));
|
|
5957
5852
|
const name = getPackageName(manifest, {
|
|
5958
5853
|
browser,
|
|
5959
5854
|
...options
|
|
5960
5855
|
});
|
|
5961
5856
|
const ext = getExtensionExtension(browser, options.zipSource);
|
|
5962
|
-
const distZipPath =
|
|
5963
|
-
const sourceZipPath =
|
|
5857
|
+
const distZipPath = external_path_namespaceObject.join(outputDir, `${name}.${ext}`);
|
|
5858
|
+
const sourceZipPath = external_path_namespaceObject.join(distDir, `${name}-source.${ext}`);
|
|
5964
5859
|
if (options.zipSource) {
|
|
5965
5860
|
console.log('');
|
|
5966
5861
|
console.log(packagingSourceFiles(sourceZipPath));
|
|
5967
|
-
const zip = new
|
|
5862
|
+
const zip = new (external_adm_zip_default())();
|
|
5968
5863
|
const files = await getFilesToZip(projectDir);
|
|
5969
5864
|
files.forEach((file)=>{
|
|
5970
|
-
zip.addLocalFile(
|
|
5865
|
+
zip.addLocalFile(external_path_namespaceObject.join(projectDir, file), external_path_namespaceObject.dirname(file));
|
|
5971
5866
|
});
|
|
5972
5867
|
zip.writeZip(sourceZipPath);
|
|
5973
5868
|
}
|
|
5974
5869
|
if (options.zip) {
|
|
5975
5870
|
console.log('');
|
|
5976
5871
|
console.log(packagingDistributionFiles(distZipPath));
|
|
5977
|
-
const zip = new
|
|
5872
|
+
const zip = new (external_adm_zip_default())();
|
|
5978
5873
|
zip.addLocalFolder(outputDir);
|
|
5979
5874
|
zip.writeZip(distZipPath);
|
|
5980
5875
|
}
|
|
@@ -5993,8 +5888,9 @@ async function generateZip(projectDir, { browser = 'chrome', ...options }) {
|
|
|
5993
5888
|
throw error;
|
|
5994
5889
|
}
|
|
5995
5890
|
}
|
|
5891
|
+
const external_cross_spawn_namespaceObject = require("cross-spawn");
|
|
5996
5892
|
async function getInstallCommand() {
|
|
5997
|
-
const pm = await (0,
|
|
5893
|
+
const pm = await (0, external_package_manager_detector_namespaceObject.detect)();
|
|
5998
5894
|
let command = 'npm';
|
|
5999
5895
|
if (isFromPnpx()) return 'pnpm';
|
|
6000
5896
|
switch(null == pm ? void 0 : pm.name){
|
|
@@ -6015,17 +5911,17 @@ function getInstallArgs() {
|
|
|
6015
5911
|
];
|
|
6016
5912
|
}
|
|
6017
5913
|
async function installDependencies(projectPath) {
|
|
6018
|
-
const nodeModulesPath =
|
|
5914
|
+
const nodeModulesPath = external_path_namespaceObject.join(projectPath, 'node_modules');
|
|
6019
5915
|
const command = await getInstallCommand();
|
|
6020
5916
|
const dependenciesArgs = getInstallArgs();
|
|
6021
5917
|
const originalDirectory = process.cwd();
|
|
6022
5918
|
try {
|
|
6023
5919
|
process.chdir(projectPath);
|
|
6024
|
-
await
|
|
5920
|
+
await external_fs_namespaceObject.promises.mkdir(nodeModulesPath, {
|
|
6025
5921
|
recursive: true
|
|
6026
5922
|
});
|
|
6027
5923
|
const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'ignore';
|
|
6028
|
-
const child = (0,
|
|
5924
|
+
const child = (0, external_cross_spawn_namespaceObject.spawn)(command, dependenciesArgs, {
|
|
6029
5925
|
stdio
|
|
6030
5926
|
});
|
|
6031
5927
|
await new Promise((resolve, reject)=>{
|
|
@@ -6046,8 +5942,8 @@ async function installDependencies(projectPath) {
|
|
|
6046
5942
|
}
|
|
6047
5943
|
async function extensionBuild(pathOrRemoteUrl, buildOptions) {
|
|
6048
5944
|
const projectPath = await getProjectPath(pathOrRemoteUrl);
|
|
6049
|
-
if (!(null == pathOrRemoteUrl ? void 0 : pathOrRemoteUrl.startsWith('http')) && !
|
|
6050
|
-
console.log(messages_manifestNotFoundError(
|
|
5945
|
+
if (!(null == pathOrRemoteUrl ? void 0 : pathOrRemoteUrl.startsWith('http')) && !external_fs_namespaceObject.existsSync(external_path_namespaceObject.join(projectPath, 'manifest.json'))) {
|
|
5946
|
+
console.log(messages_manifestNotFoundError(external_path_namespaceObject.join(projectPath, 'manifest.json')));
|
|
6051
5947
|
process.exit(1);
|
|
6052
5948
|
}
|
|
6053
5949
|
try {
|
|
@@ -6067,10 +5963,10 @@ async function extensionBuild(pathOrRemoteUrl, buildOptions) {
|
|
|
6067
5963
|
...baseConfig,
|
|
6068
5964
|
plugins: allPluginsButBrowserRunners
|
|
6069
5965
|
});
|
|
6070
|
-
const compilerConfig = (0,
|
|
6071
|
-
const compiler = (0,
|
|
6072
|
-
const nodeModulesPath =
|
|
6073
|
-
if (!
|
|
5966
|
+
const compilerConfig = (0, external_webpack_merge_namespaceObject.merge)(userConfig);
|
|
5967
|
+
const compiler = (0, core_namespaceObject.rspack)(compilerConfig);
|
|
5968
|
+
const nodeModulesPath = external_path_namespaceObject.join(projectPath, 'node_modules');
|
|
5969
|
+
if (!external_fs_namespaceObject.existsSync(nodeModulesPath)) {
|
|
6074
5970
|
console.log(installingDependencies());
|
|
6075
5971
|
if ('true' !== process.env.VITEST) await installDependencies(projectPath);
|
|
6076
5972
|
}
|
|
@@ -6101,6 +5997,7 @@ async function extensionBuild(pathOrRemoteUrl, buildOptions) {
|
|
|
6101
5997
|
process.exit(1);
|
|
6102
5998
|
}
|
|
6103
5999
|
}
|
|
6000
|
+
const dev_server_namespaceObject = require("@rspack/dev-server");
|
|
6104
6001
|
function closeAll(devServer) {
|
|
6105
6002
|
devServer.stop().then(()=>{
|
|
6106
6003
|
process.exit();
|
|
@@ -6122,8 +6019,8 @@ async function dev_server_devServer(projectPath, devOptions) {
|
|
|
6122
6019
|
});
|
|
6123
6020
|
const customWebpackConfig = await loadCustomWebpackConfig(projectPath);
|
|
6124
6021
|
const finalConfig = customWebpackConfig(baseConfig);
|
|
6125
|
-
const compilerConfig = (0,
|
|
6126
|
-
const compiler = (0,
|
|
6022
|
+
const compilerConfig = (0, external_webpack_merge_namespaceObject.merge)(finalConfig);
|
|
6023
|
+
const compiler = (0, core_namespaceObject.rspack)(compilerConfig);
|
|
6127
6024
|
const serverConfig = {
|
|
6128
6025
|
host: '127.0.0.1',
|
|
6129
6026
|
allowedHosts: 'all',
|
|
@@ -6138,7 +6035,7 @@ async function dev_server_devServer(projectPath, devOptions) {
|
|
|
6138
6035
|
},
|
|
6139
6036
|
watchFiles: isUsingJSFramework(projectPath) ? void 0 : {
|
|
6140
6037
|
paths: [
|
|
6141
|
-
|
|
6038
|
+
external_path_namespaceObject.join(projectPath, '**/*.html')
|
|
6142
6039
|
],
|
|
6143
6040
|
options: {
|
|
6144
6041
|
usePolling: true,
|
|
@@ -6156,7 +6053,7 @@ async function dev_server_devServer(projectPath, devOptions) {
|
|
|
6156
6053
|
port: devOptions.port || 'auto',
|
|
6157
6054
|
hot: true
|
|
6158
6055
|
};
|
|
6159
|
-
const devServer = new
|
|
6056
|
+
const devServer = new dev_server_namespaceObject.RspackDevServer(serverConfig, compiler);
|
|
6160
6057
|
devServer.startCallback((error)=>{
|
|
6161
6058
|
if (null != error) console.log(`Error in the Extension.js runner: ${error.stack || ''}`);
|
|
6162
6059
|
});
|
|
@@ -6170,9 +6067,10 @@ async function dev_server_devServer(projectPath, devOptions) {
|
|
|
6170
6067
|
closeAll(devServer);
|
|
6171
6068
|
});
|
|
6172
6069
|
}
|
|
6070
|
+
const promises_namespaceObject = require("fs/promises");
|
|
6173
6071
|
async function generateExtensionTypes(projectPath) {
|
|
6174
|
-
const extensionEnvFile =
|
|
6175
|
-
const typePath = 'development' === process.env.EXTENSION_ENV ?
|
|
6072
|
+
const extensionEnvFile = external_path_namespaceObject.join(projectPath, 'extension-env.d.ts');
|
|
6073
|
+
const typePath = 'development' === process.env.EXTENSION_ENV ? external_path_namespaceObject.resolve(process.cwd(), 'programs/cli/types') : 'extension/dist/types';
|
|
6176
6074
|
const fileContent = `\
|
|
6177
6075
|
// Required Extension.js types for TypeScript projects.
|
|
6178
6076
|
// This file is auto-generated and should not be excluded.
|
|
@@ -6185,15 +6083,15 @@ async function generateExtensionTypes(projectPath) {
|
|
|
6185
6083
|
/// <reference types="${typePath}/polyfill.d.ts" />
|
|
6186
6084
|
`;
|
|
6187
6085
|
try {
|
|
6188
|
-
await
|
|
6189
|
-
const existingContent = await
|
|
6190
|
-
if (existingContent.includes('develop/dist/types')) await
|
|
6191
|
-
if ('development' === process.env.EXTENSION_ENV) await
|
|
6086
|
+
await promises_namespaceObject.access(extensionEnvFile);
|
|
6087
|
+
const existingContent = await promises_namespaceObject.readFile(extensionEnvFile, 'utf8');
|
|
6088
|
+
if (existingContent.includes('develop/dist/types')) await promises_namespaceObject.writeFile(extensionEnvFile, fileContent);
|
|
6089
|
+
if ('development' === process.env.EXTENSION_ENV) await promises_namespaceObject.writeFile(extensionEnvFile, fileContent);
|
|
6192
6090
|
} catch (err) {
|
|
6193
|
-
const manifest = require(
|
|
6091
|
+
const manifest = require(external_path_namespaceObject.join(projectPath, 'manifest.json'));
|
|
6194
6092
|
console.log(writingTypeDefinitions(manifest));
|
|
6195
6093
|
try {
|
|
6196
|
-
await
|
|
6094
|
+
await promises_namespaceObject.writeFile(extensionEnvFile, fileContent);
|
|
6197
6095
|
} catch (writeErr) {
|
|
6198
6096
|
console.log(writingTypeDefinitionsError(writeErr));
|
|
6199
6097
|
}
|
|
@@ -6201,15 +6099,15 @@ async function generateExtensionTypes(projectPath) {
|
|
|
6201
6099
|
}
|
|
6202
6100
|
async function extensionDev(pathOrRemoteUrl, devOptions) {
|
|
6203
6101
|
const projectPath = await getProjectPath(pathOrRemoteUrl);
|
|
6204
|
-
const manifestPath =
|
|
6205
|
-
if (!(null == pathOrRemoteUrl ? void 0 : pathOrRemoteUrl.startsWith('http')) && !
|
|
6206
|
-
console.log(messages_manifestNotFoundError(
|
|
6102
|
+
const manifestPath = external_path_namespaceObject.join(projectPath, 'manifest.json');
|
|
6103
|
+
if (!(null == pathOrRemoteUrl ? void 0 : pathOrRemoteUrl.startsWith('http')) && !external_fs_namespaceObject.existsSync(manifestPath)) {
|
|
6104
|
+
console.log(messages_manifestNotFoundError(external_path_namespaceObject.join(projectPath, 'manifest.json')));
|
|
6207
6105
|
process.exit(1);
|
|
6208
6106
|
}
|
|
6209
6107
|
try {
|
|
6210
6108
|
if (isUsingTypeScript(projectPath)) await generateExtensionTypes(projectPath);
|
|
6211
|
-
const nodeModulesPath =
|
|
6212
|
-
if (!
|
|
6109
|
+
const nodeModulesPath = external_path_namespaceObject.join(projectPath, 'node_modules');
|
|
6110
|
+
if (!external_fs_namespaceObject.existsSync(nodeModulesPath)) {
|
|
6213
6111
|
console.log(installingDependencies());
|
|
6214
6112
|
await installDependencies(projectPath);
|
|
6215
6113
|
}
|
|
@@ -6225,8 +6123,8 @@ async function extensionDev(pathOrRemoteUrl, devOptions) {
|
|
|
6225
6123
|
}
|
|
6226
6124
|
async function extensionPreview(pathOrRemoteUrl, previewOptions) {
|
|
6227
6125
|
const projectPath = await getProjectPath(pathOrRemoteUrl);
|
|
6228
|
-
if (!(null == pathOrRemoteUrl ? void 0 : pathOrRemoteUrl.startsWith('http')) && !
|
|
6229
|
-
console.log(messages_manifestNotFoundError(
|
|
6126
|
+
if (!(null == pathOrRemoteUrl ? void 0 : pathOrRemoteUrl.startsWith('http')) && !external_fs_namespaceObject.existsSync(external_path_namespaceObject.join(projectPath, 'manifest.json'))) {
|
|
6127
|
+
console.log(messages_manifestNotFoundError(external_path_namespaceObject.join(projectPath, 'manifest.json')));
|
|
6230
6128
|
process.exit(1);
|
|
6231
6129
|
}
|
|
6232
6130
|
try {
|
|
@@ -6249,8 +6147,8 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions) {
|
|
|
6249
6147
|
...baseConfig,
|
|
6250
6148
|
plugins: onlyBrowserRunners
|
|
6251
6149
|
});
|
|
6252
|
-
const compilerConfig = (0,
|
|
6253
|
-
const compiler = (0,
|
|
6150
|
+
const compilerConfig = (0, external_webpack_merge_namespaceObject.merge)(userConfig);
|
|
6151
|
+
const compiler = (0, core_namespaceObject.rspack)(compilerConfig);
|
|
6254
6152
|
compiler.run((err, stats)=>{
|
|
6255
6153
|
if (err) {
|
|
6256
6154
|
console.error(err.stack || err);
|
|
@@ -6270,8 +6168,8 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions) {
|
|
|
6270
6168
|
}
|
|
6271
6169
|
async function extensionStart(pathOrRemoteUrl, startOptions) {
|
|
6272
6170
|
const projectPath = await getProjectPath(pathOrRemoteUrl);
|
|
6273
|
-
if (!(null == pathOrRemoteUrl ? void 0 : pathOrRemoteUrl.startsWith('http')) && !
|
|
6274
|
-
console.log(messages_manifestNotFoundError(
|
|
6171
|
+
if (!(null == pathOrRemoteUrl ? void 0 : pathOrRemoteUrl.startsWith('http')) && !external_fs_namespaceObject.existsSync(external_path_namespaceObject.join(projectPath, 'manifest.json'))) {
|
|
6172
|
+
console.log(messages_manifestNotFoundError(external_path_namespaceObject.join(projectPath, 'manifest.json')));
|
|
6275
6173
|
process.exit(1);
|
|
6276
6174
|
}
|
|
6277
6175
|
try {
|
|
@@ -6290,4 +6188,16 @@ async function extensionStart(pathOrRemoteUrl, startOptions) {
|
|
|
6290
6188
|
process.exit(1);
|
|
6291
6189
|
}
|
|
6292
6190
|
}
|
|
6293
|
-
|
|
6191
|
+
exports.extensionBuild = __webpack_exports__.extensionBuild;
|
|
6192
|
+
exports.extensionDev = __webpack_exports__.extensionDev;
|
|
6193
|
+
exports.extensionPreview = __webpack_exports__.extensionPreview;
|
|
6194
|
+
exports.extensionStart = __webpack_exports__.extensionStart;
|
|
6195
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
6196
|
+
"extensionBuild",
|
|
6197
|
+
"extensionDev",
|
|
6198
|
+
"extensionPreview",
|
|
6199
|
+
"extensionStart"
|
|
6200
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
6201
|
+
Object.defineProperty(exports, '__esModule', {
|
|
6202
|
+
value: true
|
|
6203
|
+
});
|