extension-develop 3.0.0-next.7 → 3.0.0-next.8
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/module.js +833 -253
- package/package.json +1 -1
package/dist/module.js
CHANGED
|
@@ -87,6 +87,7 @@ var __webpack_modules__ = {
|
|
|
87
87
|
QC: ()=>failedToDownloadOrExtractZIPFileError,
|
|
88
88
|
QR: ()=>fetchingProjectPath,
|
|
89
89
|
Ry: ()=>debugBrowser,
|
|
90
|
+
U6: ()=>treeWithSourceFiles,
|
|
90
91
|
WF: ()=>unpackagingExtension,
|
|
91
92
|
WW: ()=>previewing,
|
|
92
93
|
ZE: ()=>debugContextPath,
|
|
@@ -94,12 +95,16 @@ var __webpack_modules__ = {
|
|
|
94
95
|
aP: ()=>unpackagedSuccessfully,
|
|
95
96
|
cq: ()=>downloadingText,
|
|
96
97
|
hf: ()=>cantInstallDependencies,
|
|
98
|
+
hv: ()=>treeWithDistFilesbrowser,
|
|
97
99
|
iE: ()=>downloadingProjectPath,
|
|
98
100
|
km: ()=>runningInProduction,
|
|
99
101
|
mY: ()=>creatingProjectPath,
|
|
100
102
|
nJ: ()=>isUsingExperimentalConfig,
|
|
101
103
|
oM: ()=>managedDependencyConflict,
|
|
104
|
+
qZ: ()=>packagingSourceFiles,
|
|
102
105
|
rF: ()=>configLoadingError,
|
|
106
|
+
rR: ()=>treeWithSourceAndDistFiles,
|
|
107
|
+
sn: ()=>packagingDistributionFiles,
|
|
103
108
|
vC: ()=>installingDependenciesFailed,
|
|
104
109
|
vQ: ()=>debugPreviewOutput,
|
|
105
110
|
vX: ()=>downloadedProjectFolderNotFound,
|
|
@@ -112,7 +117,30 @@ var __webpack_modules__ = {
|
|
|
112
117
|
var pintor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("pintor");
|
|
113
118
|
var pintor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/ __webpack_require__.n(pintor__WEBPACK_IMPORTED_MODULE_2__);
|
|
114
119
|
var _package_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./package.json");
|
|
120
|
+
const fmt = {
|
|
121
|
+
heading: (title)=>pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(pintor__WEBPACK_IMPORTED_MODULE_2___default().blue(title)),
|
|
122
|
+
label: (key)=>pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(key.toUpperCase()),
|
|
123
|
+
val: (value)=>pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(value),
|
|
124
|
+
code: (value)=>pintor__WEBPACK_IMPORTED_MODULE_2___default().blue(value),
|
|
125
|
+
bullet: (value)=>`- ${value}`,
|
|
126
|
+
block (title, rows) {
|
|
127
|
+
const head = fmt.heading(title);
|
|
128
|
+
const body = rows.map(([key, value])=>`${fmt.label(key)} ${value}`).join('\n');
|
|
129
|
+
return `${head}\n${body}`;
|
|
130
|
+
},
|
|
131
|
+
truncate (input, max = 800) {
|
|
132
|
+
const s = (()=>{
|
|
133
|
+
try {
|
|
134
|
+
return 'string' == typeof input ? input : JSON.stringify(input);
|
|
135
|
+
} catch {
|
|
136
|
+
return String(input);
|
|
137
|
+
}
|
|
138
|
+
})();
|
|
139
|
+
return s.length > max ? s.slice(0, max) + "\u2026" : s;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
115
142
|
function getLoggingPrefix(type) {
|
|
143
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) return pintor__WEBPACK_IMPORTED_MODULE_2___default().brightMagenta('error' === type ? 'ERROR' : "\u25BA\u25BA\u25BA");
|
|
116
144
|
if ('error' === type) return pintor__WEBPACK_IMPORTED_MODULE_2___default().red('ERROR');
|
|
117
145
|
if ('warn' === type) return pintor__WEBPACK_IMPORTED_MODULE_2___default().brightYellow("\u25BA\u25BA\u25BA");
|
|
118
146
|
if ('info' === type) return pintor__WEBPACK_IMPORTED_MODULE_2___default().gray("\u25BA\u25BA\u25BA");
|
|
@@ -165,7 +193,12 @@ var __webpack_modules__ = {
|
|
|
165
193
|
return `${getLoggingPrefix('success')} No errors or warnings found. Your extension is ${pintor__WEBPACK_IMPORTED_MODULE_2___default().green('ready for deployment')}.`;
|
|
166
194
|
}
|
|
167
195
|
function fetchingProjectPath(owner, project) {
|
|
168
|
-
return
|
|
196
|
+
return fmt.block('Fetching project', [
|
|
197
|
+
[
|
|
198
|
+
'URL',
|
|
199
|
+
fmt.val(`https://github.com/${owner}/${project}`)
|
|
200
|
+
]
|
|
201
|
+
]);
|
|
169
202
|
}
|
|
170
203
|
function downloadingProjectPath(projectName) {
|
|
171
204
|
const formatted = isPathLike(projectName) ? pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(projectName) : pintor__WEBPACK_IMPORTED_MODULE_2___default().yellow(projectName);
|
|
@@ -177,6 +210,21 @@ var __webpack_modules__ = {
|
|
|
177
210
|
function downloadedProjectFolderNotFound(cwd, candidates) {
|
|
178
211
|
return `${getLoggingPrefix('error')} Downloaded project folder not found.\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('PATH')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(cwd)}\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('Tried')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(candidates.join(', '))}`;
|
|
179
212
|
}
|
|
213
|
+
function packagingSourceFiles(zipPath) {
|
|
214
|
+
return `${getLoggingPrefix('info')} Packaging source files. Files in ${pintor__WEBPACK_IMPORTED_MODULE_2___default().yellow('.gitignore')} will be excluded...\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('PATH')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(zipPath)}.`;
|
|
215
|
+
}
|
|
216
|
+
function packagingDistributionFiles(zipPath) {
|
|
217
|
+
return `${getLoggingPrefix('info')} Packaging extension distribution files...\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('PATH')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(zipPath)}`;
|
|
218
|
+
}
|
|
219
|
+
function treeWithSourceAndDistFiles(browser, name, sourceZip, destZip) {
|
|
220
|
+
return `\uD83D\uDCE6 Package name: ${pintor__WEBPACK_IMPORTED_MODULE_2___default().blue(`${name}`)}, Target Browser: ${capitalizedBrowserName(browser)}\n ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray("\u2514\u2500")} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(`${sourceZip}`)} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('(source)')}\n ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray("\u2514\u2500")} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(`${destZip}`)} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('(distribution)')}`;
|
|
221
|
+
}
|
|
222
|
+
function treeWithDistFilesbrowser(name, ext, browser, zipPath) {
|
|
223
|
+
return `\uD83D\uDCE6 Package name: ${pintor__WEBPACK_IMPORTED_MODULE_2___default().blue(`${name}.${ext}`)}, Target Browser: ${capitalizedBrowserName(browser)}\n ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray("\u2514\u2500")} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(`${zipPath}`)} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('(distribution)')}`;
|
|
224
|
+
}
|
|
225
|
+
function treeWithSourceFiles(name, ext, browser, zipPath) {
|
|
226
|
+
return `\uD83D\uDCE6 Package name: ${pintor__WEBPACK_IMPORTED_MODULE_2___default().blue(`${name}-source.${ext}`)}, Target Browser: ${capitalizedBrowserName(browser)}\n ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray("\u2514\u2500")} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(`${zipPath}`)} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('(source)')}`;
|
|
227
|
+
}
|
|
180
228
|
function writingTypeDefinitions(manifest) {
|
|
181
229
|
return `${getLoggingPrefix('info')} Writing type definitions for ${pintor__WEBPACK_IMPORTED_MODULE_2___default().blue(manifest.name || '')}...`;
|
|
182
230
|
}
|
|
@@ -184,7 +232,12 @@ var __webpack_modules__ = {
|
|
|
184
232
|
return `${getLoggingPrefix('error')} Failed to write the extension type definition.\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().red(error)}`;
|
|
185
233
|
}
|
|
186
234
|
function downloadingText(url) {
|
|
187
|
-
return
|
|
235
|
+
return fmt.block('Downloading extension', [
|
|
236
|
+
[
|
|
237
|
+
'URL',
|
|
238
|
+
fmt.val(url)
|
|
239
|
+
]
|
|
240
|
+
]);
|
|
188
241
|
}
|
|
189
242
|
function unpackagingExtension(zipFilePath) {
|
|
190
243
|
return `${getLoggingPrefix('info')} Unpackaging browser extension...\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('PATH')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(zipFilePath)}`;
|
|
@@ -272,7 +325,7 @@ var __webpack_modules__ = {
|
|
|
272
325
|
return `${getLoggingPrefix('error')} Can't install project dependencies.\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().red(String((null == error ? void 0 : error.message) || error))}`;
|
|
273
326
|
}
|
|
274
327
|
function configLoadingError(configPath, error) {
|
|
275
|
-
return `${
|
|
328
|
+
return `${pintor__WEBPACK_IMPORTED_MODULE_2___default().red('ERROR')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().brightBlue('config load failed')}\n${fmt.label('PATH')} ${fmt.val(configPath)}\n` + pintor__WEBPACK_IMPORTED_MODULE_2___default().red(fmt.truncate(error, 1200));
|
|
276
329
|
}
|
|
277
330
|
function managedDependencyConflict(duplicates, userPackageJsonPath) {
|
|
278
331
|
const list = duplicates.map((d)=>`- ${pintor__WEBPACK_IMPORTED_MODULE_2___default().yellow(d)}`).join('\n');
|
|
@@ -318,7 +371,7 @@ var __webpack_modules__ = {
|
|
|
318
371
|
});
|
|
319
372
|
},
|
|
320
373
|
"./package.json": function(module) {
|
|
321
|
-
module.exports = JSON.parse('{"i8":"3.0.0-next.
|
|
374
|
+
module.exports = JSON.parse('{"i8":"3.0.0-next.7","HO":{"@rspack/core":"^1.6.3","@rspack/dev-server":"^1.1.4","@swc/core":"^1.13.2","@swc/helpers":"^0.5.15","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chokidar":"^4.0.1","chrome-location2":"3.2.1","chromium-location":"1.2.3","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^16.4.7","edge-location":"^2.1.1","firefox-location2":"2.1.1","go-git-it":"^5.0.0","ignore":"^6.0.2","loader-utils":"^3.3.1","magic-string":"^0.30.10","package-manager-detector":"^0.2.7","parse5":"^7.2.1","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.2.0","tiny-glob":"^0.2.9","unique-names-generator":"^4.7.1","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.18.0"},"Lq":{"@prefresh/core":"^1.5.2","@prefresh/utils":"^1.2.0","@prefresh/webpack":"^4.0.1","@rspack/plugin-preact-refresh":"^1.1.2","@rspack/plugin-react-refresh":"^1.0.1","@vue/compiler-sfc":"^3.5.13","babel-loader":"^9.2.1","less-loader":"^12.2.0","postcss-loader":"^8.1.1","postcss-preset-env":"^10.1.1","react-refresh":"^0.14.2","sass-loader":"^16.0.4","svelte-loader":"^3.2.4","vue-loader":"^17.4.2","vue-style-loader":"^4.1.3"}}');
|
|
322
375
|
}
|
|
323
376
|
};
|
|
324
377
|
var __webpack_module_cache__ = {};
|
|
@@ -756,7 +809,7 @@ var __webpack_exports__ = {};
|
|
|
756
809
|
const configPath = candidates.find((p)=>external_fs_.existsSync(p));
|
|
757
810
|
if (configPath) {
|
|
758
811
|
if (!userMessageDelivered) {
|
|
759
|
-
if ('
|
|
812
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(webpack_lib_messages.nJ('extension.config.js'));
|
|
760
813
|
userMessageDelivered = true;
|
|
761
814
|
}
|
|
762
815
|
return true;
|
|
@@ -799,7 +852,7 @@ var __webpack_exports__ = {};
|
|
|
799
852
|
await external_fs_.promises.mkdir(nodeModulesPath, {
|
|
800
853
|
recursive: true
|
|
801
854
|
});
|
|
802
|
-
const stdio = '
|
|
855
|
+
const stdio = 'true' === process.env.EXTENSION_AUTHOR_MODE ? 'inherit' : 'ignore';
|
|
803
856
|
const child = (0, external_cross_spawn_namespaceObject.spawn)(command, dependenciesArgs, {
|
|
804
857
|
stdio
|
|
805
858
|
});
|
|
@@ -846,7 +899,7 @@ var __webpack_exports__ = {};
|
|
|
846
899
|
process.exit(1);
|
|
847
900
|
}
|
|
848
901
|
} catch (error) {
|
|
849
|
-
if ('
|
|
902
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(error);
|
|
850
903
|
}
|
|
851
904
|
}
|
|
852
905
|
function scrubBrand(txt, brand = 'Extension.js') {
|
|
@@ -1023,6 +1076,51 @@ var __webpack_exports__ = {};
|
|
|
1023
1076
|
}
|
|
1024
1077
|
const external_case_sensitive_paths_webpack_plugin_namespaceObject = require("case-sensitive-paths-webpack-plugin");
|
|
1025
1078
|
var external_case_sensitive_paths_webpack_plugin_default = /*#__PURE__*/ __webpack_require__.n(external_case_sensitive_paths_webpack_plugin_namespaceObject);
|
|
1079
|
+
var external_pintor_ = __webpack_require__("pintor");
|
|
1080
|
+
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_);
|
|
1081
|
+
function boring(manifestName, durationMs, stats) {
|
|
1082
|
+
const now = new Date();
|
|
1083
|
+
const hh = String(now.getHours()).padStart(2, '0');
|
|
1084
|
+
const mm = String(now.getMinutes()).padStart(2, '0');
|
|
1085
|
+
const ss = String(now.getSeconds()).padStart(2, '0');
|
|
1086
|
+
const timestamp = external_pintor_default().gray(`[${hh}:${mm}:${ss}]`);
|
|
1087
|
+
const hasErrors = stats.hasErrors();
|
|
1088
|
+
const hasWarnings = stats.hasWarnings();
|
|
1089
|
+
const arrow = hasErrors ? external_pintor_default().red("\u2716\u2716\u2716") : hasWarnings ? external_pintor_default().brightYellow("\u25BA\u25BA\u25BA") : external_pintor_default().gray("\u25BA\u25BA\u25BA");
|
|
1090
|
+
const label = hasErrors ? external_pintor_default().red('with errors') : hasWarnings ? external_pintor_default().yellow('with warnings') : external_pintor_default().green('successfully');
|
|
1091
|
+
const app = manifestName;
|
|
1092
|
+
const time = `${durationMs} ms`;
|
|
1093
|
+
return `${arrow} ${timestamp} ${app} compiled ${label} in ${time}.`;
|
|
1094
|
+
}
|
|
1095
|
+
function cleanDistStarting(distPath) {
|
|
1096
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Clean dist: ${external_pintor_default().gray('starting')}\n${external_pintor_default().gray('PATH')} ${external_pintor_default().underline(distPath)}`;
|
|
1097
|
+
}
|
|
1098
|
+
function cleanDistRemovedSummary(removedCount, distPath) {
|
|
1099
|
+
return [
|
|
1100
|
+
`${external_pintor_default().underline('Clean dist (completed)')}`,
|
|
1101
|
+
`${external_pintor_default().gray('REMOVED')} ${external_pintor_default().gray(String(removedCount))}`,
|
|
1102
|
+
`${external_pintor_default().gray('PATH')} ${external_pintor_default().underline(distPath)}`
|
|
1103
|
+
].join('\n');
|
|
1104
|
+
}
|
|
1105
|
+
function cleanDistSkippedNotFound(distPath) {
|
|
1106
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Clean dist: ${external_pintor_default().gray('skipped')} (path not found)\n${external_pintor_default().gray('PATH')} ${external_pintor_default().underline(distPath)}`;
|
|
1107
|
+
}
|
|
1108
|
+
function zipPackagingSkipped(reason) {
|
|
1109
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Packaging: ${external_pintor_default().gray('skipped')} (${external_pintor_default().gray(reason)})`;
|
|
1110
|
+
}
|
|
1111
|
+
function envSelectedFile(envPath) {
|
|
1112
|
+
const label = envPath ? external_pintor_default().underline(envPath) : external_pintor_default().gray('none');
|
|
1113
|
+
return [
|
|
1114
|
+
`${external_pintor_default().underline('Environment')}`,
|
|
1115
|
+
`${external_pintor_default().gray('PATH')} ${label}`
|
|
1116
|
+
].join('\n');
|
|
1117
|
+
}
|
|
1118
|
+
function envInjectedPublicVars(count) {
|
|
1119
|
+
return [
|
|
1120
|
+
`${external_pintor_default().underline('Environment')}`,
|
|
1121
|
+
`${external_pintor_default().gray('INJECTED')} ${external_pintor_default().gray(String(count))} EXTENSION_PUBLIC_*`
|
|
1122
|
+
].join('\n');
|
|
1123
|
+
}
|
|
1026
1124
|
function _define_property(obj, key, value) {
|
|
1027
1125
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
1028
1126
|
value: value,
|
|
@@ -1053,6 +1151,7 @@ var __webpack_exports__ = {};
|
|
|
1053
1151
|
break;
|
|
1054
1152
|
}
|
|
1055
1153
|
}
|
|
1154
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(envSelectedFile(envPath));
|
|
1056
1155
|
const envVars = envPath ? external_dotenv_namespaceObject.config({
|
|
1057
1156
|
path: envPath
|
|
1058
1157
|
}).parsed || {} : {};
|
|
@@ -1082,6 +1181,8 @@ var __webpack_exports__ = {};
|
|
|
1082
1181
|
filteredEnvVars['import.meta.env.BROWSER'] = JSON.stringify(this.browser);
|
|
1083
1182
|
filteredEnvVars['process.env.MODE'] = JSON.stringify(mode);
|
|
1084
1183
|
filteredEnvVars['import.meta.env.MODE'] = JSON.stringify(mode);
|
|
1184
|
+
const injectedCount = Object.keys(filteredEnvVars).filter((k)=>k.startsWith('process.env.EXTENSION_PUBLIC_')).length;
|
|
1185
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(envInjectedPublicVars(injectedCount));
|
|
1085
1186
|
new core_namespaceObject.DefinePlugin(filteredEnvVars).apply(compiler);
|
|
1086
1187
|
compiler.hooks.thisCompilation.tap('manifest:update-manifest', (compilation)=>{
|
|
1087
1188
|
compilation.hooks.processAssets.tap({
|
|
@@ -1143,35 +1244,56 @@ var __webpack_exports__ = {};
|
|
|
1143
1244
|
apply(compiler) {
|
|
1144
1245
|
const logger = compiler.getInfrastructureLogger('plugin-compilation:clean');
|
|
1145
1246
|
const distPath = external_path_.join(compiler.options.context, 'dist', this.options.browser);
|
|
1146
|
-
if (external_fs_.existsSync(distPath))
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1247
|
+
if (external_fs_.existsSync(distPath)) {
|
|
1248
|
+
const removedCount = countFilesRecursively(distPath);
|
|
1249
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(cleanDistStarting(distPath));
|
|
1250
|
+
try {
|
|
1251
|
+
if (external_fs_.rmSync) external_fs_.rmSync(distPath, {
|
|
1252
|
+
recursive: true,
|
|
1253
|
+
force: true
|
|
1254
|
+
});
|
|
1255
|
+
else external_fs_.rmdirSync(distPath, {
|
|
1256
|
+
recursive: true
|
|
1257
|
+
});
|
|
1258
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(cleanDistRemovedSummary(removedCount, distPath));
|
|
1259
|
+
if ('development' === process.env.EXTENSION_ENV) logger.info('[CleanDistFolderPlugin] Removed old hot-update files before compilation.');
|
|
1260
|
+
} catch (error) {
|
|
1261
|
+
if ('win32' === process.platform && /EBUSY|EPERM/i.test(String((null == error ? void 0 : error.code) || (null == error ? void 0 : error.message)))) setTimeout(()=>{
|
|
1262
|
+
try {
|
|
1263
|
+
if (external_fs_.rmSync) external_fs_.rmSync(distPath, {
|
|
1264
|
+
recursive: true,
|
|
1265
|
+
force: true
|
|
1266
|
+
});
|
|
1267
|
+
else external_fs_.rmdirSync(distPath, {
|
|
1268
|
+
recursive: true
|
|
1269
|
+
});
|
|
1270
|
+
} catch {}
|
|
1271
|
+
}, 100);
|
|
1272
|
+
logger.error(`[CleanDistFolderPlugin] Failed to remove hot-update files: ${error.message}`);
|
|
1273
|
+
}
|
|
1274
|
+
} else if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(cleanDistSkippedNotFound(distPath));
|
|
1169
1275
|
}
|
|
1170
1276
|
constructor(options){
|
|
1171
1277
|
clean_dist_define_property(this, "options", void 0);
|
|
1172
1278
|
this.options = options;
|
|
1173
1279
|
}
|
|
1174
1280
|
}
|
|
1281
|
+
function countFilesRecursively(dir) {
|
|
1282
|
+
try {
|
|
1283
|
+
const entries = external_fs_.readdirSync(dir, {
|
|
1284
|
+
withFileTypes: true
|
|
1285
|
+
});
|
|
1286
|
+
let total = 0;
|
|
1287
|
+
for (const entry of entries){
|
|
1288
|
+
const full = external_path_.join(dir, entry.name);
|
|
1289
|
+
if (entry.isDirectory()) total += countFilesRecursively(full);
|
|
1290
|
+
else total += 1;
|
|
1291
|
+
}
|
|
1292
|
+
return total;
|
|
1293
|
+
} catch {
|
|
1294
|
+
return 0;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1175
1297
|
var external_adm_zip_ = __webpack_require__("adm-zip");
|
|
1176
1298
|
var external_adm_zip_default = /*#__PURE__*/ __webpack_require__.n(external_adm_zip_);
|
|
1177
1299
|
const external_tiny_glob_namespaceObject = require("tiny-glob");
|
|
@@ -1216,6 +1338,7 @@ var __webpack_exports__ = {};
|
|
|
1216
1338
|
if (!(this.zipData.zip || this.zipData.zipSource)) return;
|
|
1217
1339
|
try {
|
|
1218
1340
|
var _compiler_options_output;
|
|
1341
|
+
const created = [];
|
|
1219
1342
|
const outPath = null == (_compiler_options_output = compiler.options.output) ? void 0 : _compiler_options_output.path;
|
|
1220
1343
|
const packageJsonDir = compiler.options.context;
|
|
1221
1344
|
const manifestPath = this.options.manifestPath ? this.options.manifestPath : external_path_.join(this.zipData.zipSource ? packageJsonDir : outPath, 'manifest.json');
|
|
@@ -1230,14 +1353,31 @@ var __webpack_exports__ = {};
|
|
|
1230
1353
|
sourceZip.addLocalFile(external_path_.join(packageJsonDir, file), '.' === root ? '' : toPosix(root));
|
|
1231
1354
|
});
|
|
1232
1355
|
const sourcePath = external_path_.join(external_path_.dirname(outPath), `${name}-source.zip`);
|
|
1356
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(webpack_lib_messages.qZ(sourcePath));
|
|
1233
1357
|
sourceZip.writeZip(sourcePath);
|
|
1358
|
+
created.push({
|
|
1359
|
+
kind: 'source',
|
|
1360
|
+
path: sourcePath
|
|
1361
|
+
});
|
|
1234
1362
|
}
|
|
1235
1363
|
if (this.zipData.zip) {
|
|
1236
1364
|
const distZip = new (external_adm_zip_default())();
|
|
1237
1365
|
distZip.addLocalFolder(outPath);
|
|
1238
1366
|
const filename = this.zipData.zipFilename ? zip_sanitize(this.zipData.zipFilename) : name;
|
|
1239
1367
|
const distPath = external_path_.join(outPath, `${filename}.zip`);
|
|
1368
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(webpack_lib_messages.sn(distPath));
|
|
1240
1369
|
distZip.writeZip(distPath);
|
|
1370
|
+
created.push({
|
|
1371
|
+
kind: 'dist',
|
|
1372
|
+
path: distPath
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
1376
|
+
const sourceItem = created.find((c)=>'source' === c.kind);
|
|
1377
|
+
const distItem = created.find((c)=>'dist' === c.kind);
|
|
1378
|
+
if (sourceItem && distItem) console.log(webpack_lib_messages.rR(this.browser, name, sourceItem.path, distItem.path));
|
|
1379
|
+
else if (sourceItem) console.log(webpack_lib_messages.U6(name, 'zip', this.browser, sourceItem.path));
|
|
1380
|
+
else if (distItem) console.log(webpack_lib_messages.hv(name, 'zip', this.browser, distItem.path));
|
|
1241
1381
|
}
|
|
1242
1382
|
} catch (error) {
|
|
1243
1383
|
var _stats_compilation;
|
|
@@ -1254,22 +1394,6 @@ var __webpack_exports__ = {};
|
|
|
1254
1394
|
this.zipData = this.options.zipData ?? {};
|
|
1255
1395
|
}
|
|
1256
1396
|
}
|
|
1257
|
-
var external_pintor_ = __webpack_require__("pintor");
|
|
1258
|
-
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_);
|
|
1259
|
-
function boring(manifestName, durationMs, stats) {
|
|
1260
|
-
const now = new Date();
|
|
1261
|
-
const hh = String(now.getHours()).padStart(2, '0');
|
|
1262
|
-
const mm = String(now.getMinutes()).padStart(2, '0');
|
|
1263
|
-
const ss = String(now.getSeconds()).padStart(2, '0');
|
|
1264
|
-
const timestamp = external_pintor_default().gray(`[${hh}:${mm}:${ss}]`);
|
|
1265
|
-
const hasErrors = stats.hasErrors();
|
|
1266
|
-
const hasWarnings = stats.hasWarnings();
|
|
1267
|
-
const arrow = hasErrors ? external_pintor_default().red("\u2716\u2716\u2716") : hasWarnings ? external_pintor_default().brightYellow("\u25BA\u25BA\u25BA") : external_pintor_default().gray("\u25BA\u25BA\u25BA");
|
|
1268
|
-
const label = hasErrors ? external_pintor_default().red('with errors') : hasWarnings ? external_pintor_default().yellow('with warnings') : external_pintor_default().green('successfully');
|
|
1269
|
-
const app = manifestName;
|
|
1270
|
-
const time = `${durationMs} ms`;
|
|
1271
|
-
return `${arrow} ${timestamp} ${app} compiled ${label} in ${time}.`;
|
|
1272
|
-
}
|
|
1273
1397
|
function boring_define_property(obj, key, value) {
|
|
1274
1398
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
1275
1399
|
value: value,
|
|
@@ -1340,6 +1464,10 @@ var __webpack_exports__ = {};
|
|
|
1340
1464
|
zipFilename: this.zipFilename
|
|
1341
1465
|
}
|
|
1342
1466
|
}).apply(compiler);
|
|
1467
|
+
else if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
1468
|
+
const reason = 'production' !== compiler.options.mode ? 'not production mode' : 'zip disabled';
|
|
1469
|
+
console.log(zipPackagingSkipped(reason));
|
|
1470
|
+
}
|
|
1343
1471
|
new BoringPlugin({
|
|
1344
1472
|
manifestPath: this.manifestPath,
|
|
1345
1473
|
browser: this.browser || 'chrome'
|
|
@@ -1361,16 +1489,24 @@ var __webpack_exports__ = {};
|
|
|
1361
1489
|
}
|
|
1362
1490
|
}
|
|
1363
1491
|
plugin_compilation_define_property(CompilationPlugin, "name", 'plugin-compilation');
|
|
1492
|
+
function cssIntegrationsEnabled(integrations) {
|
|
1493
|
+
const list = integrations.length > 0 ? integrations.map((n)=>external_pintor_default().yellow(n)).join(', ') : external_pintor_default().gray('none');
|
|
1494
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} CSS: Integrations enabled (${external_pintor_default().gray(String(integrations.length))}) ${list}`;
|
|
1495
|
+
}
|
|
1496
|
+
function cssConfigsDetected(postcssConfig, stylelintConfig, tailwindConfig, browserslistSource) {
|
|
1497
|
+
const fmt = (v)=>v ? external_pintor_default().underline(v) : external_pintor_default().gray('none');
|
|
1498
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} CSS: Configs\n${external_pintor_default().gray('POSTCSS')} ${fmt(postcssConfig)}\n${external_pintor_default().gray('STYLELINT')} ${fmt(stylelintConfig)}\n${external_pintor_default().gray('TAILWIND')} ${fmt(tailwindConfig)}\n${external_pintor_default().gray('BROWSERSLIST')} ${fmt(browserslistSource)}`;
|
|
1499
|
+
}
|
|
1364
1500
|
function isUsingIntegration(name) {
|
|
1365
1501
|
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Using ${external_pintor_default().brightBlue(name)}...`;
|
|
1366
1502
|
}
|
|
1367
1503
|
function youAreAllSet(name) {
|
|
1368
1504
|
return `${external_pintor_default().green("\u25BA\u25BA\u25BA")} ${name} installation completed. Run again to proceed.`;
|
|
1369
1505
|
}
|
|
1370
|
-
var
|
|
1506
|
+
var css_lib_integrations = __webpack_require__("./webpack/plugin-css/css-lib/integrations.ts");
|
|
1371
1507
|
let sass_userMessageDelivered = false;
|
|
1372
1508
|
function isUsingSass(projectPath) {
|
|
1373
|
-
if ((0,
|
|
1509
|
+
if ((0, css_lib_integrations.S)(projectPath, 'sass')) {
|
|
1374
1510
|
if (!sass_userMessageDelivered) {
|
|
1375
1511
|
if ('development' === process.env.EXTENSION_ENV) console.log(isUsingIntegration('SASS'));
|
|
1376
1512
|
sass_userMessageDelivered = true;
|
|
@@ -1389,12 +1525,12 @@ var __webpack_exports__ = {};
|
|
|
1389
1525
|
'postcss-scss',
|
|
1390
1526
|
'postcss-preset-env'
|
|
1391
1527
|
];
|
|
1392
|
-
await (0,
|
|
1528
|
+
await (0, css_lib_integrations.b)('PostCSS', postCssDependencies);
|
|
1393
1529
|
const sassDependencies = [
|
|
1394
1530
|
'sass',
|
|
1395
1531
|
'sass-loader'
|
|
1396
1532
|
];
|
|
1397
|
-
await (0,
|
|
1533
|
+
await (0, css_lib_integrations.b)('SASS', sassDependencies);
|
|
1398
1534
|
console.log(youAreAllSet('SASS'));
|
|
1399
1535
|
process.exit(0);
|
|
1400
1536
|
}
|
|
@@ -1449,7 +1585,7 @@ var __webpack_exports__ = {};
|
|
|
1449
1585
|
}
|
|
1450
1586
|
let less_userMessageDelivered = false;
|
|
1451
1587
|
function isUsingLess(projectPath) {
|
|
1452
|
-
if ((0,
|
|
1588
|
+
if ((0, css_lib_integrations.S)(projectPath, 'less')) {
|
|
1453
1589
|
if (!less_userMessageDelivered) {
|
|
1454
1590
|
if ('development' === process.env.EXTENSION_ENV) console.log(isUsingIntegration('LESS'));
|
|
1455
1591
|
less_userMessageDelivered = true;
|
|
@@ -1468,7 +1604,7 @@ var __webpack_exports__ = {};
|
|
|
1468
1604
|
'less',
|
|
1469
1605
|
'less-loader'
|
|
1470
1606
|
];
|
|
1471
|
-
await (0,
|
|
1607
|
+
await (0, css_lib_integrations.b)('LESS', lessDependencies);
|
|
1472
1608
|
console.log(youAreAllSet('LESS'));
|
|
1473
1609
|
process.exit(0);
|
|
1474
1610
|
}
|
|
@@ -1549,7 +1685,7 @@ var __webpack_exports__ = {};
|
|
|
1549
1685
|
}
|
|
1550
1686
|
let tailwind_userMessageDelivered = false;
|
|
1551
1687
|
function tailwind_isUsingTailwind(projectPath) {
|
|
1552
|
-
const isUsingTailwind = (0,
|
|
1688
|
+
const isUsingTailwind = (0, css_lib_integrations.S)(projectPath, 'tailwindcss');
|
|
1553
1689
|
if (isUsingTailwind) {
|
|
1554
1690
|
if (!tailwind_userMessageDelivered) {
|
|
1555
1691
|
if ('development' === process.env.EXTENSION_ENV) console.log(isUsingIntegration('Tailwind'));
|
|
@@ -1558,6 +1694,14 @@ var __webpack_exports__ = {};
|
|
|
1558
1694
|
}
|
|
1559
1695
|
return isUsingTailwind;
|
|
1560
1696
|
}
|
|
1697
|
+
function getTailwindConfigFile(projectPath) {
|
|
1698
|
+
const configFileMjs = external_path_.join(projectPath, 'tailwind.config.mjs');
|
|
1699
|
+
const configFileCjs = external_path_.join(projectPath, 'tailwind.config.cjs');
|
|
1700
|
+
const configFileJs = external_path_.join(projectPath, 'tailwind.config.js');
|
|
1701
|
+
if (external_fs_.existsSync(configFileMjs)) return configFileMjs;
|
|
1702
|
+
if (external_fs_.existsSync(configFileCjs)) return configFileCjs;
|
|
1703
|
+
if (external_fs_.existsSync(configFileJs)) return configFileJs;
|
|
1704
|
+
}
|
|
1561
1705
|
let postcss_userMessageDelivered = false;
|
|
1562
1706
|
const postCssConfigFiles = [
|
|
1563
1707
|
'.postcssrc',
|
|
@@ -1576,7 +1720,7 @@ var __webpack_exports__ = {};
|
|
|
1576
1720
|
}
|
|
1577
1721
|
}
|
|
1578
1722
|
function isUsingPostCss(projectPath) {
|
|
1579
|
-
if ((0,
|
|
1723
|
+
if ((0, css_lib_integrations.S)(projectPath, 'postcss')) {
|
|
1580
1724
|
if (!postcss_userMessageDelivered) {
|
|
1581
1725
|
if ('development' === process.env.EXTENSION_ENV) console.log(isUsingIntegration('PostCSS'));
|
|
1582
1726
|
postcss_userMessageDelivered = true;
|
|
@@ -1614,7 +1758,7 @@ var __webpack_exports__ = {};
|
|
|
1614
1758
|
'postcss-loader',
|
|
1615
1759
|
'postcss-preset-env'
|
|
1616
1760
|
];
|
|
1617
|
-
await (0,
|
|
1761
|
+
await (0, css_lib_integrations.b)('PostCSS', postCssDependencies);
|
|
1618
1762
|
}
|
|
1619
1763
|
console.log(youAreAllSet('PostCSS'));
|
|
1620
1764
|
process.exit(0);
|
|
@@ -1832,6 +1976,23 @@ var __webpack_exports__ = {};
|
|
|
1832
1976
|
...compiler.options.module.rules,
|
|
1833
1977
|
...loaders
|
|
1834
1978
|
].filter(Boolean);
|
|
1979
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
1980
|
+
const integrations = [];
|
|
1981
|
+
const usingSass = (0, css_lib_integrations.S)(projectPath, 'sass');
|
|
1982
|
+
const usingLess = (0, css_lib_integrations.S)(projectPath, 'less');
|
|
1983
|
+
const usingTailwind = (0, css_lib_integrations.S)(projectPath, 'tailwindcss');
|
|
1984
|
+
const usingPostcss = (0, css_lib_integrations.S)(projectPath, 'postcss') || void 0 !== plugin_css_findPostCssConfig(projectPath) || usingSass || usingLess || usingTailwind;
|
|
1985
|
+
if (usingPostcss) integrations.push('PostCSS');
|
|
1986
|
+
if (usingSass) integrations.push('Sass');
|
|
1987
|
+
if (usingLess) integrations.push('Less');
|
|
1988
|
+
if (usingTailwind) integrations.push('Tailwind');
|
|
1989
|
+
console.log(cssIntegrationsEnabled(integrations));
|
|
1990
|
+
const postcssConfig = plugin_css_findPostCssConfig(projectPath);
|
|
1991
|
+
const stylelintConfig = getStylelintConfigFile(projectPath);
|
|
1992
|
+
const tailwindConfig = getTailwindConfigFile(projectPath);
|
|
1993
|
+
const browserslistSource = findBrowserslistSource(projectPath);
|
|
1994
|
+
console.log(cssConfigsDetected(postcssConfig, stylelintConfig, tailwindConfig, browserslistSource));
|
|
1995
|
+
}
|
|
1835
1996
|
}
|
|
1836
1997
|
async apply(compiler) {
|
|
1837
1998
|
const mode = compiler.options.mode || 'development';
|
|
@@ -1844,6 +2005,54 @@ var __webpack_exports__ = {};
|
|
|
1844
2005
|
}
|
|
1845
2006
|
}
|
|
1846
2007
|
plugin_css_define_property(CssPlugin, "name", 'plugin-css');
|
|
2008
|
+
const plugin_css_postCssConfigFiles = [
|
|
2009
|
+
'.postcssrc',
|
|
2010
|
+
'.postcssrc.json',
|
|
2011
|
+
'.postcssrc.yaml',
|
|
2012
|
+
'.postcssrc.yml',
|
|
2013
|
+
'.postcssrc.js',
|
|
2014
|
+
'.postcssrc.cjs',
|
|
2015
|
+
'postcss.config.js',
|
|
2016
|
+
'postcss.config.cjs'
|
|
2017
|
+
];
|
|
2018
|
+
function plugin_css_findPostCssConfig(projectPath) {
|
|
2019
|
+
for (const configFile of plugin_css_postCssConfigFiles){
|
|
2020
|
+
const configPath = external_path_.join(projectPath, configFile);
|
|
2021
|
+
if (external_fs_.existsSync(configPath)) return configPath;
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
function findBrowserslistSource(projectPath) {
|
|
2025
|
+
const packageJsonPath = external_path_.join(projectPath, 'package.json');
|
|
2026
|
+
try {
|
|
2027
|
+
if (external_fs_.existsSync(packageJsonPath)) {
|
|
2028
|
+
const raw = external_fs_.readFileSync(packageJsonPath, 'utf8');
|
|
2029
|
+
const pkg = JSON.parse(raw || '{}');
|
|
2030
|
+
if (pkg && pkg.browserslist) return `${packageJsonPath}#browserslist`;
|
|
2031
|
+
}
|
|
2032
|
+
} catch {}
|
|
2033
|
+
const candidates = [
|
|
2034
|
+
'.browserslistrc',
|
|
2035
|
+
'browserslist',
|
|
2036
|
+
'.browserslistrc.json',
|
|
2037
|
+
'.browserslistrc.yaml',
|
|
2038
|
+
'.browserslistrc.yml'
|
|
2039
|
+
];
|
|
2040
|
+
for (const file of candidates){
|
|
2041
|
+
const p = external_path_.join(projectPath, file);
|
|
2042
|
+
if (external_fs_.existsSync(p)) return p;
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
function assetsRulesEnabled(rules) {
|
|
2046
|
+
const list = rules.length > 0 ? rules.map((n)=>external_pintor_default().yellow(n)).join(', ') : external_pintor_default().gray('none');
|
|
2047
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Assets: Rules enabled (${external_pintor_default().gray(String(rules.length))}) ${list}`;
|
|
2048
|
+
}
|
|
2049
|
+
function assetsConfigsDetected(filenamePattern, svgRuleMode, svgInlineLimitKB, imageInlineLimitKB, fileInlineLimitKB) {
|
|
2050
|
+
const fmt = (v)=>v || 0 === v ? external_pintor_default().underline(String(v)) : external_pintor_default().gray('n/a');
|
|
2051
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Assets: Configs\n${external_pintor_default().gray('FILENAME_PATTERN')} ${external_pintor_default().underline(filenamePattern)}\n${external_pintor_default().gray('SVG_RULE')} ${external_pintor_default().yellow(svgRuleMode)}\n${external_pintor_default().gray('SVG_INLINE_LIMIT')} ${fmt(svgInlineLimitKB)}${svgInlineLimitKB ? external_pintor_default().gray('KB') : ''}\n${external_pintor_default().gray('IMAGE_INLINE_LIMIT')} ${fmt(imageInlineLimitKB)}${imageInlineLimitKB ? external_pintor_default().gray('KB') : ''}\n${external_pintor_default().gray('FILE_INLINE_LIMIT')} ${fmt(fileInlineLimitKB)}${fileInlineLimitKB ? external_pintor_default().gray('KB') : ''}`;
|
|
2052
|
+
}
|
|
2053
|
+
function assetsEmittedSummary(total, byCategory) {
|
|
2054
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Assets: Emitted ${external_pintor_default().gray(String(total))} file(s)\n${external_pintor_default().gray('SVG')} ${external_pintor_default().underline(String(byCategory.svg))}\n${external_pintor_default().gray('IMAGES')} ${external_pintor_default().underline(String(byCategory.images))}\n${external_pintor_default().gray('FONTS')} ${external_pintor_default().underline(String(byCategory.fonts))}\n${external_pintor_default().gray('FILES')} ${external_pintor_default().underline(String(byCategory.files))}`;
|
|
2055
|
+
}
|
|
1847
2056
|
function plugin_static_assets_define_property(obj, key, value) {
|
|
1848
2057
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
1849
2058
|
value: value,
|
|
@@ -1914,6 +2123,37 @@ var __webpack_exports__ = {};
|
|
|
1914
2123
|
...compiler.options.module.rules,
|
|
1915
2124
|
...loaders
|
|
1916
2125
|
].filter((rule)=>Boolean(rule));
|
|
2126
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
2127
|
+
const rulesEnabled = [];
|
|
2128
|
+
rulesEnabled.push(hasCustomSvgRule ? 'SVG(custom)' : 'SVG(default)');
|
|
2129
|
+
rulesEnabled.push('Images');
|
|
2130
|
+
rulesEnabled.push('Fonts');
|
|
2131
|
+
rulesEnabled.push('Files');
|
|
2132
|
+
console.log(assetsRulesEnabled(rulesEnabled));
|
|
2133
|
+
const inlineKB = 2;
|
|
2134
|
+
console.log(assetsConfigsDetected(filenamePattern, hasCustomSvgRule ? 'custom' : 'default', hasCustomSvgRule ? void 0 : inlineKB, inlineKB, inlineKB));
|
|
2135
|
+
compiler.hooks.afterEmit.tap(StaticAssetsPlugin.name, (compilation)=>{
|
|
2136
|
+
try {
|
|
2137
|
+
var _compilation_getAssets;
|
|
2138
|
+
const assets = (null == compilation ? void 0 : null == (_compilation_getAssets = compilation.getAssets) ? void 0 : _compilation_getAssets.call(compilation)) || [];
|
|
2139
|
+
const emitted = assets.filter((a)=>a.name && a.name.startsWith('assets/'));
|
|
2140
|
+
const counts = {
|
|
2141
|
+
svg: 0,
|
|
2142
|
+
images: 0,
|
|
2143
|
+
fonts: 0,
|
|
2144
|
+
files: 0
|
|
2145
|
+
};
|
|
2146
|
+
for (const a of emitted){
|
|
2147
|
+
const n = a.name.toLowerCase();
|
|
2148
|
+
if (n.endsWith('.svg')) counts.svg++;
|
|
2149
|
+
else if (/\.(png|jpg|jpeg|gif|webp|avif|ico|bmp)$/i.test(n)) counts.images++;
|
|
2150
|
+
else if (/\.(woff|woff2|eot|ttf|otf)$/i.test(n)) counts.fonts++;
|
|
2151
|
+
else counts.files++;
|
|
2152
|
+
}
|
|
2153
|
+
console.log(assetsEmittedSummary(emitted.length, counts));
|
|
2154
|
+
} catch {}
|
|
2155
|
+
});
|
|
2156
|
+
}
|
|
1917
2157
|
}
|
|
1918
2158
|
constructor(options){
|
|
1919
2159
|
plugin_static_assets_define_property(this, "mode", void 0);
|
|
@@ -1935,6 +2175,19 @@ var __webpack_exports__ = {};
|
|
|
1935
2175
|
function isUsingCustomLoader(loaderPath) {
|
|
1936
2176
|
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Using custom loader: ${external_pintor_default().yellow(loaderPath)}.`;
|
|
1937
2177
|
}
|
|
2178
|
+
function jsFrameworksIntegrationsEnabled(integrations) {
|
|
2179
|
+
const list = integrations.length > 0 ? integrations.map((n)=>external_pintor_default().yellow(n)).join(', ') : external_pintor_default().gray('none');
|
|
2180
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} JS: Integrations enabled (${external_pintor_default().gray(String(integrations.length))}) ${list}`;
|
|
2181
|
+
}
|
|
2182
|
+
function jsFrameworksConfigsDetected(tsConfigPath, tsRoot, targets) {
|
|
2183
|
+
const fmt = (v)=>v ? external_pintor_default().underline(v) : external_pintor_default().gray('none');
|
|
2184
|
+
const tgt = targets && targets.length ? targets.map((t)=>external_pintor_default().gray(t)).join(', ') : external_pintor_default().gray('default');
|
|
2185
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} JS: Configs\n${external_pintor_default().gray('TSCONFIG')} ${fmt(tsConfigPath)}\n${external_pintor_default().gray('TSROOT')} ${fmt(tsRoot)}\n${external_pintor_default().gray('SWC_TARGETS')} ${tgt}`;
|
|
2186
|
+
}
|
|
2187
|
+
function jsFrameworksHmrSummary(enabled, frameworks) {
|
|
2188
|
+
const list = frameworks.length > 0 ? frameworks.map((n)=>external_pintor_default().yellow(n)).join(', ') : external_pintor_default().gray('none');
|
|
2189
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} JS: HMR ${enabled ? external_pintor_default().green('enabled') : external_pintor_default().gray('disabled')} for ${list}`;
|
|
2190
|
+
}
|
|
1938
2191
|
function isUsingJSFramework(projectPath) {
|
|
1939
2192
|
const frameworks = [
|
|
1940
2193
|
'react',
|
|
@@ -1948,7 +2201,7 @@ var __webpack_exports__ = {};
|
|
|
1948
2201
|
}
|
|
1949
2202
|
let preact_userMessageDelivered = false;
|
|
1950
2203
|
function isUsingPreact(projectPath) {
|
|
1951
|
-
if ((0,
|
|
2204
|
+
if ((0, css_lib_integrations.S)(projectPath, 'preact')) {
|
|
1952
2205
|
if (!preact_userMessageDelivered) {
|
|
1953
2206
|
if ('development' === process.env.EXTENSION_ENV) console.log(messages_isUsingIntegration('Preact'));
|
|
1954
2207
|
preact_userMessageDelivered = true;
|
|
@@ -1968,7 +2221,7 @@ var __webpack_exports__ = {};
|
|
|
1968
2221
|
'@rspack/plugin-preact-refresh',
|
|
1969
2222
|
'preact'
|
|
1970
2223
|
];
|
|
1971
|
-
await (0,
|
|
2224
|
+
await (0, css_lib_integrations.b)('Preact', preactDependencies);
|
|
1972
2225
|
console.log(messages_youAreAllSet('Preact'));
|
|
1973
2226
|
process.exit(0);
|
|
1974
2227
|
}
|
|
@@ -1990,7 +2243,7 @@ var __webpack_exports__ = {};
|
|
|
1990
2243
|
var plugin_react_refresh_default = /*#__PURE__*/ __webpack_require__.n(plugin_react_refresh_namespaceObject);
|
|
1991
2244
|
let react_userMessageDelivered = false;
|
|
1992
2245
|
function isUsingReact(projectPath) {
|
|
1993
|
-
if ((0,
|
|
2246
|
+
if ((0, css_lib_integrations.S)(projectPath, 'react')) {
|
|
1994
2247
|
if (!react_userMessageDelivered) {
|
|
1995
2248
|
if ('development' === process.env.EXTENSION_ENV) console.log(messages_isUsingIntegration('React'));
|
|
1996
2249
|
react_userMessageDelivered = true;
|
|
@@ -2008,7 +2261,7 @@ var __webpack_exports__ = {};
|
|
|
2008
2261
|
'react-refresh',
|
|
2009
2262
|
'@rspack/plugin-react-refresh'
|
|
2010
2263
|
];
|
|
2011
|
-
await (0,
|
|
2264
|
+
await (0, css_lib_integrations.b)('React', reactDependencies);
|
|
2012
2265
|
console.log(messages_youAreAllSet('React'));
|
|
2013
2266
|
process.exit(0);
|
|
2014
2267
|
}
|
|
@@ -2077,7 +2330,7 @@ var __webpack_exports__ = {};
|
|
|
2077
2330
|
}
|
|
2078
2331
|
let vue_userMessageDelivered = false;
|
|
2079
2332
|
function isUsingVue(projectPath) {
|
|
2080
|
-
const using = (0,
|
|
2333
|
+
const using = (0, css_lib_integrations.S)(projectPath, 'vue');
|
|
2081
2334
|
if (using && !vue_userMessageDelivered) {
|
|
2082
2335
|
if ('development' === process.env.EXTENSION_ENV) console.log(messages_isUsingIntegration('Vue'));
|
|
2083
2336
|
vue_userMessageDelivered = true;
|
|
@@ -2093,7 +2346,7 @@ var __webpack_exports__ = {};
|
|
|
2093
2346
|
'vue-loader',
|
|
2094
2347
|
'@vue/compiler-sfc'
|
|
2095
2348
|
];
|
|
2096
|
-
await (0,
|
|
2349
|
+
await (0, css_lib_integrations.b)('Vue', vueDependencies);
|
|
2097
2350
|
console.log(messages_youAreAllSet('Vue'));
|
|
2098
2351
|
process.exit(0);
|
|
2099
2352
|
}
|
|
@@ -2233,7 +2486,7 @@ var __webpack_exports__ = {};
|
|
|
2233
2486
|
}
|
|
2234
2487
|
}
|
|
2235
2488
|
function isUsingSvelte(projectPath) {
|
|
2236
|
-
const using = (0,
|
|
2489
|
+
const using = (0, css_lib_integrations.S)(projectPath, 'svelte');
|
|
2237
2490
|
if (using && !svelte_userMessageDelivered) {
|
|
2238
2491
|
if ('development' === process.env.EXTENSION_ENV) console.log(messages_isUsingIntegration('Svelte'));
|
|
2239
2492
|
svelte_userMessageDelivered = true;
|
|
@@ -2248,11 +2501,11 @@ var __webpack_exports__ = {};
|
|
|
2248
2501
|
const typeScriptDependencies = [
|
|
2249
2502
|
"typescript"
|
|
2250
2503
|
];
|
|
2251
|
-
await (0,
|
|
2504
|
+
await (0, css_lib_integrations.b)('TypeScript', typeScriptDependencies);
|
|
2252
2505
|
const svelteDependencies = [
|
|
2253
2506
|
'svelte-loader'
|
|
2254
2507
|
];
|
|
2255
|
-
await (0,
|
|
2508
|
+
await (0, css_lib_integrations.b)('Svelte', svelteDependencies);
|
|
2256
2509
|
console.log(messages_youAreAllSet('Svelte'));
|
|
2257
2510
|
process.exit(0);
|
|
2258
2511
|
}
|
|
@@ -2267,7 +2520,7 @@ var __webpack_exports__ = {};
|
|
|
2267
2520
|
const typeScriptDependencies = [
|
|
2268
2521
|
"typescript"
|
|
2269
2522
|
];
|
|
2270
|
-
await (0,
|
|
2523
|
+
await (0, css_lib_integrations.b)('TypeScript', typeScriptDependencies);
|
|
2271
2524
|
console.log(messages_youAreAllSet('TypeScript'));
|
|
2272
2525
|
process.exit(0);
|
|
2273
2526
|
}
|
|
@@ -2458,6 +2711,21 @@ var __webpack_exports__ = {};
|
|
|
2458
2711
|
if (isUsingTypeScript(projectPath) || !!tsConfigPath) compiler.options.resolve.tsConfig = {
|
|
2459
2712
|
configFile: tsConfigPath
|
|
2460
2713
|
};
|
|
2714
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
2715
|
+
const integrations = [];
|
|
2716
|
+
if (maybeInstallReact) integrations.push('React');
|
|
2717
|
+
if (maybeInstallPreact) integrations.push('Preact');
|
|
2718
|
+
if (maybeInstallVue) integrations.push('Vue');
|
|
2719
|
+
if (maybeInstallSvelte) integrations.push('Svelte');
|
|
2720
|
+
if (preferTypeScript) integrations.push('TypeScript');
|
|
2721
|
+
console.log(jsFrameworksIntegrationsEnabled(integrations));
|
|
2722
|
+
console.log(jsFrameworksConfigsDetected(tsConfigPath, tsRoot, targets));
|
|
2723
|
+
const hmrFrameworks = [];
|
|
2724
|
+
if (maybeInstallReact) hmrFrameworks.push('React');
|
|
2725
|
+
if (maybeInstallPreact) hmrFrameworks.push('Preact');
|
|
2726
|
+
if (maybeInstallSvelte) hmrFrameworks.push('Svelte');
|
|
2727
|
+
console.log(jsFrameworksHmrSummary('development' === mode, hmrFrameworks));
|
|
2728
|
+
}
|
|
2461
2729
|
}
|
|
2462
2730
|
async apply(compiler) {
|
|
2463
2731
|
const mode = compiler.options.mode || 'development';
|
|
@@ -2495,6 +2763,29 @@ var __webpack_exports__ = {};
|
|
|
2495
2763
|
lines.push(`${external_pintor_default().red('ERROR')} ${external_pintor_default().red(String(error))}`);
|
|
2496
2764
|
return lines.join('\n');
|
|
2497
2765
|
}
|
|
2766
|
+
function manifestIncludeSummary(browser, manifestPath) {
|
|
2767
|
+
return `Manifest include summary \u{2014} browser=${external_pintor_default().yellow(browser)}, path=${external_pintor_default().underline(manifestPath)}`;
|
|
2768
|
+
}
|
|
2769
|
+
function manifestEmitSuccess() {
|
|
2770
|
+
return "Manifest emitted to assets (schema stripped).";
|
|
2771
|
+
}
|
|
2772
|
+
function manifestOverridesSummary(overrideKeys, devCssStubsAdded) {
|
|
2773
|
+
return `Manifest overrides \u{2014} keys=${external_pintor_default().gray(String(overrideKeys))}, devCssStubsAdded=${external_pintor_default().gray(String(devCssStubsAdded))}`;
|
|
2774
|
+
}
|
|
2775
|
+
function manifestDepsTracked(addedCount) {
|
|
2776
|
+
return `Manifest file dependencies tracked: ${external_pintor_default().gray(String(addedCount))}`;
|
|
2777
|
+
}
|
|
2778
|
+
function manifestLegacyWarningsSummary(count) {
|
|
2779
|
+
return `Manifest legacy warnings \u{2014} count=${external_pintor_default().gray(String(count))}`;
|
|
2780
|
+
}
|
|
2781
|
+
function manifestRecompileDetected(fileAdded, fileRemoved) {
|
|
2782
|
+
const parts = [
|
|
2783
|
+
"Manifest entrypoints changed",
|
|
2784
|
+
fileRemoved ? `${external_pintor_default().gray('before')} ${external_pintor_default().underline(fileRemoved)}` : '',
|
|
2785
|
+
fileAdded ? `${external_pintor_default().gray('after')} ${external_pintor_default().underline(fileAdded)}` : ''
|
|
2786
|
+
].filter(Boolean);
|
|
2787
|
+
return parts.join(" \u2014 ");
|
|
2788
|
+
}
|
|
2498
2789
|
function emit_manifest_define_property(obj, key, value) {
|
|
2499
2790
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
2500
2791
|
value: value,
|
|
@@ -2526,6 +2817,7 @@ var __webpack_exports__ = {};
|
|
|
2526
2817
|
const jsonString = JSON.stringify(jsonContent, null, 2);
|
|
2527
2818
|
const outputFilename = 'manifest.json';
|
|
2528
2819
|
compilation.emitAsset(outputFilename, new core_namespaceObject.sources.RawSource(jsonString));
|
|
2820
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(manifestEmitSuccess());
|
|
2529
2821
|
});
|
|
2530
2822
|
});
|
|
2531
2823
|
}
|
|
@@ -2732,7 +3024,7 @@ var __webpack_exports__ = {};
|
|
|
2732
3024
|
...themeExperiment(manifest)
|
|
2733
3025
|
};
|
|
2734
3026
|
}
|
|
2735
|
-
function
|
|
3027
|
+
function action_action(manifest) {
|
|
2736
3028
|
return manifest.action && {
|
|
2737
3029
|
action: {
|
|
2738
3030
|
...manifest.action,
|
|
@@ -2806,7 +3098,7 @@ var __webpack_exports__ = {};
|
|
|
2806
3098
|
}
|
|
2807
3099
|
function manifestV3(manifest) {
|
|
2808
3100
|
return {
|
|
2809
|
-
...
|
|
3101
|
+
...action_action(manifest),
|
|
2810
3102
|
...backgroundServiceWorker(manifest),
|
|
2811
3103
|
...declarativeNetRequest(manifest),
|
|
2812
3104
|
...hostPermissions(manifest),
|
|
@@ -3111,6 +3403,17 @@ var __webpack_exports__ = {};
|
|
|
3111
3403
|
if ('development' === compiler.options.mode) {
|
|
3112
3404
|
if (patchedManifest.content_scripts) patchedManifest.content_scripts = this.applyDevOverrides(patchedManifest);
|
|
3113
3405
|
}
|
|
3406
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
|
|
3407
|
+
const overrideObj = JSON.parse(overrides || '{}');
|
|
3408
|
+
const overrideKeys = Object.keys(overrideObj || {}).length;
|
|
3409
|
+
let devCssStubsAdded = 0;
|
|
3410
|
+
if ('development' === compiler.options.mode && Array.isArray(patchedManifest.content_scripts)) for (const cs of patchedManifest.content_scripts)try {
|
|
3411
|
+
const hasCss = Array.isArray(cs.css) && cs.css.length > 0;
|
|
3412
|
+
const hasJs = Array.isArray(cs.js) && cs.js.length > 0;
|
|
3413
|
+
if (hasCss && hasJs && 1 === cs.js.length) devCssStubsAdded++;
|
|
3414
|
+
} catch {}
|
|
3415
|
+
console.log(manifestOverridesSummary(overrideKeys, devCssStubsAdded));
|
|
3416
|
+
} catch {}
|
|
3114
3417
|
const source = JSON.stringify(patchedManifest, null, 2);
|
|
3115
3418
|
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
3116
3419
|
compilation.updateAsset('manifest.json', rawSource);
|
|
@@ -3123,6 +3426,11 @@ var __webpack_exports__ = {};
|
|
|
3123
3426
|
...manifest,
|
|
3124
3427
|
...JSON.parse(overrides)
|
|
3125
3428
|
};
|
|
3429
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
|
|
3430
|
+
const overrideObj = JSON.parse(overrides || '{}');
|
|
3431
|
+
const overrideKeys = Object.keys(overrideObj || {}).length;
|
|
3432
|
+
console.log(manifestOverridesSummary(overrideKeys, 0));
|
|
3433
|
+
} catch {}
|
|
3126
3434
|
const source = JSON.stringify(patchedManifest, null, 2);
|
|
3127
3435
|
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
3128
3436
|
compilation.updateAsset('manifest.json', rawSource);
|
|
@@ -3158,6 +3466,10 @@ var __webpack_exports__ = {};
|
|
|
3158
3466
|
if (deps !== compilation.fileDependencies && 'function' == typeof (null == (_compilation_fileDependencies = compilation.fileDependencies) ? void 0 : _compilation_fileDependencies.add)) compilation.fileDependencies.add(dependency);
|
|
3159
3467
|
}
|
|
3160
3468
|
});
|
|
3469
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
3470
|
+
const added = Array.isArray(this.dependencyList) ? this.dependencyList.length : 0;
|
|
3471
|
+
console.log(manifestDepsTracked(added));
|
|
3472
|
+
}
|
|
3161
3473
|
});
|
|
3162
3474
|
}
|
|
3163
3475
|
constructor(dependencyList){
|
|
@@ -3232,6 +3544,7 @@ var __webpack_exports__ = {};
|
|
|
3232
3544
|
if (!(null == (_this_pendingChange = this.pendingChange) ? void 0 : _this_pendingChange.hasChange)) return;
|
|
3233
3545
|
const fileAdded = this.pendingChange.fileAdded;
|
|
3234
3546
|
const fileRemoved = this.pendingChange.fileRemoved;
|
|
3547
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(manifestRecompileDetected(fileAdded, fileRemoved));
|
|
3235
3548
|
const manifestEntrypointChangeWarning = new core_namespaceObject.WebpackError(serverRestartRequiredFromManifestError(fileAdded || '', fileRemoved || ''));
|
|
3236
3549
|
manifestEntrypointChangeWarning.file = 'manifest.json';
|
|
3237
3550
|
compilation.errors.push(manifestEntrypointChangeWarning);
|
|
@@ -3276,17 +3589,18 @@ var __webpack_exports__ = {};
|
|
|
3276
3589
|
compiler.hooks.thisCompilation.tap(ManifestLegacyWarnings.name, (compilation)=>{
|
|
3277
3590
|
const asset = compilation.getAsset('manifest.json');
|
|
3278
3591
|
if (!asset) return;
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
}
|
|
3289
|
-
}
|
|
3592
|
+
const text = asset.source.source().toString();
|
|
3593
|
+
let count = 0;
|
|
3594
|
+
legacy.forEach((needle)=>{
|
|
3595
|
+
if (text.includes(needle)) {
|
|
3596
|
+
const warn = new core_namespaceObject.WebpackError(legacyManifestPathWarning(needle));
|
|
3597
|
+
warn.name = 'ManifestLegacyWarning';
|
|
3598
|
+
warn.file = 'manifest.json';
|
|
3599
|
+
compilation.warnings.push(warn);
|
|
3600
|
+
count++;
|
|
3601
|
+
}
|
|
3602
|
+
});
|
|
3603
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(manifestLegacyWarningsSummary(count));
|
|
3290
3604
|
});
|
|
3291
3605
|
}
|
|
3292
3606
|
}
|
|
@@ -3303,6 +3617,7 @@ var __webpack_exports__ = {};
|
|
|
3303
3617
|
}
|
|
3304
3618
|
class ManifestPlugin {
|
|
3305
3619
|
apply(compiler) {
|
|
3620
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(manifestIncludeSummary(String(this.browser || 'chrome'), this.manifestPath));
|
|
3306
3621
|
new EmitManifest({
|
|
3307
3622
|
manifestPath: this.manifestPath
|
|
3308
3623
|
}).apply(compiler);
|
|
@@ -4203,7 +4518,8 @@ var __webpack_exports__ = {};
|
|
|
4203
4518
|
const existing = 'function' == typeof getAssetFn ? getAssetFn.call(compilation, assetFilename) : null == (_compilation_assets = compilation.assets) ? void 0 : _compilation_assets[assetFilename];
|
|
4204
4519
|
if (!existing) continue;
|
|
4205
4520
|
const updated = patchHtml(compilation, feature, resolved, this.includeList || {});
|
|
4206
|
-
|
|
4521
|
+
const updatedHtml = 'string' == typeof updated ? updated : updated && 'string' == typeof updated.html ? updated.html : null;
|
|
4522
|
+
if ('string' == typeof updatedHtml) compilation.updateAsset(assetFilename, new core_namespaceObject.sources.RawSource(updatedHtml));
|
|
4207
4523
|
}
|
|
4208
4524
|
};
|
|
4209
4525
|
const hasProcessAssets = Boolean(null == compilation ? void 0 : null == (_compilation_hooks = compilation.hooks) ? void 0 : null == (_compilation_hooks_processAssets = _compilation_hooks.processAssets) ? void 0 : _compilation_hooks_processAssets.tap);
|
|
@@ -4658,6 +4974,20 @@ var __webpack_exports__ = {};
|
|
|
4658
4974
|
});
|
|
4659
4975
|
return fileAssets;
|
|
4660
4976
|
}
|
|
4977
|
+
function scriptsIncludeSummary(featureCount, devMode, browser) {
|
|
4978
|
+
return `Scripts include summary \u{2014} features=${external_pintor_default().gray(String(featureCount))}, dev=${external_pintor_default().gray(String(devMode))}, browser=${external_pintor_default().yellow(browser)}`;
|
|
4979
|
+
}
|
|
4980
|
+
function scriptsEntriesSummary(entriesAdded, publicTracked) {
|
|
4981
|
+
return `Scripts entries \u{2014} added=${external_pintor_default().gray(String(entriesAdded))}, publicTracked=${external_pintor_default().gray(String(publicTracked))}`;
|
|
4982
|
+
}
|
|
4983
|
+
function scriptsManifestChangeDetected(before, after) {
|
|
4984
|
+
const parts = [
|
|
4985
|
+
"Manifest scripts change detected",
|
|
4986
|
+
before ? `${external_pintor_default().gray('before')} ${external_pintor_default().underline(before)}` : '',
|
|
4987
|
+
after ? `${external_pintor_default().gray('after')} ${external_pintor_default().underline(after)}` : ''
|
|
4988
|
+
].filter(Boolean);
|
|
4989
|
+
return parts.join(" \u2014 ");
|
|
4990
|
+
}
|
|
4661
4991
|
function add_scripts_define_property(obj, key, value) {
|
|
4662
4992
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
4663
4993
|
value: value,
|
|
@@ -4707,6 +5037,8 @@ var __webpack_exports__ = {};
|
|
|
4707
5037
|
const fallbackContext = external_path_.dirname(this.manifestPath);
|
|
4708
5038
|
const projectPath = compiler.options.context || fallbackContext;
|
|
4709
5039
|
const publicDir = external_path_.join(projectPath, 'public');
|
|
5040
|
+
let entriesAdded = 0;
|
|
5041
|
+
let publicTracked = 0;
|
|
4710
5042
|
for (const [feature, scriptPath] of Object.entries(scriptFields)){
|
|
4711
5043
|
const scriptImports = getScriptEntries(scriptPath);
|
|
4712
5044
|
const cssImports = getCssEntries(scriptPath);
|
|
@@ -4719,24 +5051,28 @@ var __webpack_exports__ = {};
|
|
|
4719
5051
|
const isUnderPublic = rel && !rel.startsWith('..') && !external_path_.isAbsolute(rel);
|
|
4720
5052
|
return !isUnderPublic;
|
|
4721
5053
|
});
|
|
4722
|
-
if (cssImports.length || scriptImports.length)
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
5054
|
+
if (cssImports.length || scriptImports.length) {
|
|
5055
|
+
if ('background/service_worker' === feature) {
|
|
5056
|
+
var _manifest_background;
|
|
5057
|
+
const manifest = JSON.parse(external_fs_.readFileSync(this.manifestPath, 'utf8'));
|
|
5058
|
+
const isModuleServiceWorker = (null == (_manifest_background = manifest.background) ? void 0 : _manifest_background.type) === 'module';
|
|
5059
|
+
newEntries[feature] = {
|
|
5060
|
+
import: entryImports,
|
|
5061
|
+
...isModuleServiceWorker ? {} : {
|
|
5062
|
+
chunkLoading: "import-scripts"
|
|
5063
|
+
}
|
|
5064
|
+
};
|
|
5065
|
+
} else newEntries[feature] = {
|
|
5066
|
+
import: entryImports
|
|
4731
5067
|
};
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
};
|
|
5068
|
+
entriesAdded++;
|
|
5069
|
+
}
|
|
4735
5070
|
}
|
|
4736
5071
|
compiler.options.entry = {
|
|
4737
5072
|
...compiler.options.entry,
|
|
4738
5073
|
...newEntries
|
|
4739
5074
|
};
|
|
5075
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(scriptsEntriesSummary(entriesAdded, publicTracked));
|
|
4740
5076
|
if (null == compiler ? void 0 : null == (_compiler_hooks1 = compiler.hooks) ? void 0 : null == (_compiler_hooks_thisCompilation1 = _compiler_hooks1.thisCompilation) ? void 0 : _compiler_hooks_thisCompilation1.tap) compiler.hooks.thisCompilation.tap("scripts:add-public-deps", (compilation)=>{
|
|
4741
5077
|
try {
|
|
4742
5078
|
const allScriptFieldImports = Object.values(scriptFields).flatMap((scriptFieldEntry)=>[].concat(...Array.isArray(scriptFieldEntry) ? scriptFieldEntry : scriptFieldEntry ? [
|
|
@@ -4746,7 +5082,10 @@ var __webpack_exports__ = {};
|
|
|
4746
5082
|
const rel = external_path_.relative(publicDir, String(importPath));
|
|
4747
5083
|
return rel && !rel.startsWith('..') && !external_path_.isAbsolute(rel);
|
|
4748
5084
|
});
|
|
4749
|
-
for (const publicFilePath of publicFilesOnly)if (external_fs_.existsSync(publicFilePath))
|
|
5085
|
+
for (const publicFilePath of publicFilesOnly)if (external_fs_.existsSync(publicFilePath)) {
|
|
5086
|
+
compilation.fileDependencies.add(publicFilePath);
|
|
5087
|
+
publicTracked++;
|
|
5088
|
+
}
|
|
4750
5089
|
} catch {}
|
|
4751
5090
|
});
|
|
4752
5091
|
}
|
|
@@ -5358,6 +5697,7 @@ var __webpack_exports__ = {};
|
|
|
5358
5697
|
}, ()=>{
|
|
5359
5698
|
var _this_pending;
|
|
5360
5699
|
if (!(null == (_this_pending = this.pending) ? void 0 : _this_pending.hasChange)) return;
|
|
5700
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(scriptsManifestChangeDetected(this.pending.pathBefore, this.pending.pathAfter));
|
|
5361
5701
|
const lines = [];
|
|
5362
5702
|
lines.push("Entrypoint references changed in scripts. Restart the dev server to pick up changes to manifest script entrypoints.");
|
|
5363
5703
|
lines.push('');
|
|
@@ -5393,6 +5733,10 @@ var __webpack_exports__ = {};
|
|
|
5393
5733
|
apply(compiler) {
|
|
5394
5734
|
const hasValidManifest = !!this.manifestPath && external_fs_.existsSync(this.manifestPath) && external_fs_.lstatSync(this.manifestPath).isFile();
|
|
5395
5735
|
if (!hasValidManifest) return;
|
|
5736
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
5737
|
+
const featuresCount = Object.keys(this.includeList || {}).length;
|
|
5738
|
+
console.log(scriptsIncludeSummary(featuresCount, 'production' !== compiler.options.mode, String(this.browser || 'chrome')));
|
|
5739
|
+
}
|
|
5396
5740
|
new AddScripts({
|
|
5397
5741
|
manifestPath: this.manifestPath,
|
|
5398
5742
|
includeList: this.includeList || {}
|
|
@@ -5453,6 +5797,19 @@ var __webpack_exports__ = {};
|
|
|
5453
5797
|
const final = `MISSING KEY ${key} in ${localePath}`;
|
|
5454
5798
|
return `${header}\n${guidance}\n\n${final}`;
|
|
5455
5799
|
}
|
|
5800
|
+
function localesIncludeSummary(hasManifest, hasLocalesRoot, defaultLocale) {
|
|
5801
|
+
const dl = defaultLocale ? `default_locale=${defaultLocale}` : 'default_locale=<none>';
|
|
5802
|
+
return `Locales include summary \u{2014} manifest=${String(hasManifest)}, localesRoot=${String(hasLocalesRoot)}, ${dl}`;
|
|
5803
|
+
}
|
|
5804
|
+
function localesEmitSummary(emitted, missing, discovered) {
|
|
5805
|
+
return `Locales emitted=${String(emitted)}, missing=${String(missing)}, discovered=${String(discovered)}`;
|
|
5806
|
+
}
|
|
5807
|
+
function localesDepsTracked(addedCount) {
|
|
5808
|
+
return `Locales file dependencies tracked: ${String(addedCount)}`;
|
|
5809
|
+
}
|
|
5810
|
+
function localesValidationDetected(issue) {
|
|
5811
|
+
return `Locales validation detected: ${issue}`;
|
|
5812
|
+
}
|
|
5456
5813
|
function getLocales(manifestPath) {
|
|
5457
5814
|
const localesFolder = external_path_.join(external_path_.dirname(manifestPath), '_locales');
|
|
5458
5815
|
const localeFiles = [];
|
|
@@ -5505,16 +5862,30 @@ var __webpack_exports__ = {};
|
|
|
5505
5862
|
const defaultLocale = null == manifest ? void 0 : manifest.default_locale;
|
|
5506
5863
|
const localesRoot = external_path_.join(manifestDir, '_locales');
|
|
5507
5864
|
const hasLocalesRoot = external_fs_.existsSync(localesRoot);
|
|
5865
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesIncludeSummary(true, hasLocalesRoot, 'string' == typeof defaultLocale ? defaultLocale : void 0));
|
|
5508
5866
|
if ('string' == typeof defaultLocale && defaultLocale.trim()) {
|
|
5509
|
-
if (!hasLocalesRoot)
|
|
5867
|
+
if (!hasLocalesRoot) {
|
|
5868
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected('default_locale set but _locales missing'));
|
|
5869
|
+
pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleSpecifiedButLocalesMissing(), 'manifest.json');
|
|
5870
|
+
return;
|
|
5871
|
+
}
|
|
5510
5872
|
const defaultLocaleDir = external_path_.join(localesRoot, defaultLocale);
|
|
5511
|
-
if (!external_fs_.existsSync(defaultLocaleDir))
|
|
5873
|
+
if (!external_fs_.existsSync(defaultLocaleDir)) {
|
|
5874
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing _locales/${defaultLocale}`));
|
|
5875
|
+
pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleFolderMissing(defaultLocale), 'manifest.json');
|
|
5876
|
+
return;
|
|
5877
|
+
}
|
|
5512
5878
|
const messagesJsonPath = external_path_.join(defaultLocaleDir, 'messages.json');
|
|
5513
|
-
if (!external_fs_.existsSync(messagesJsonPath))
|
|
5879
|
+
if (!external_fs_.existsSync(messagesJsonPath)) {
|
|
5880
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing _locales/${defaultLocale}/messages.json`));
|
|
5881
|
+
pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleMessagesMissing(defaultLocale), 'manifest.json');
|
|
5882
|
+
return;
|
|
5883
|
+
}
|
|
5514
5884
|
try {
|
|
5515
5885
|
const content = external_fs_.readFileSync(messagesJsonPath, 'utf8');
|
|
5516
5886
|
JSON.parse(content);
|
|
5517
5887
|
} catch (e) {
|
|
5888
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`invalid JSON in _locales/${defaultLocale}/messages.json`));
|
|
5518
5889
|
pushCompilationError(compiler, compilation, 'LocalesValidationError', invalidMessagesJson(messagesJsonPath), 'manifest.json');
|
|
5519
5890
|
return;
|
|
5520
5891
|
}
|
|
@@ -5536,10 +5907,18 @@ var __webpack_exports__ = {};
|
|
|
5536
5907
|
collectMsgKeys(manifest, referenced);
|
|
5537
5908
|
for (const key of referenced){
|
|
5538
5909
|
const entry = null == dict ? void 0 : dict[key];
|
|
5539
|
-
if (!entry || 'string' != typeof entry.message)
|
|
5910
|
+
if (!entry || 'string' != typeof entry.message) {
|
|
5911
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing key "${key}" in default locale`));
|
|
5912
|
+
pushCompilationError(compiler, compilation, 'LocalesValidationError', missingManifestMessageKey(key, defaultLocale), 'manifest.json');
|
|
5913
|
+
return;
|
|
5914
|
+
}
|
|
5540
5915
|
}
|
|
5541
5916
|
} catch {}
|
|
5542
|
-
} else if (hasLocalesRoot)
|
|
5917
|
+
} else if (hasLocalesRoot) {
|
|
5918
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected('_locales present but no default_locale'));
|
|
5919
|
+
pushCompilationError(compiler, compilation, 'LocalesValidationError', localesPresentButNoDefaultLocale(), 'manifest.json');
|
|
5920
|
+
return;
|
|
5921
|
+
}
|
|
5543
5922
|
} catch {}
|
|
5544
5923
|
if (compilation.errors.length > 0) return;
|
|
5545
5924
|
try {
|
|
@@ -5553,6 +5932,7 @@ var __webpack_exports__ = {};
|
|
|
5553
5932
|
const s = external_fs_.readFileSync(msgPath, 'utf8');
|
|
5554
5933
|
JSON.parse(s);
|
|
5555
5934
|
} catch {
|
|
5935
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`invalid JSON in ${msgPath}`));
|
|
5556
5936
|
pushCompilationError(compiler, compilation, 'LocalesValidationError', invalidMessagesJson(msgPath), 'manifest.json');
|
|
5557
5937
|
return;
|
|
5558
5938
|
}
|
|
@@ -5560,6 +5940,9 @@ var __webpack_exports__ = {};
|
|
|
5560
5940
|
}
|
|
5561
5941
|
} catch {}
|
|
5562
5942
|
const localesFields = getLocales(this.manifestPath);
|
|
5943
|
+
const discoveredList = getLocales(this.manifestPath) || [];
|
|
5944
|
+
let emittedCount = 0;
|
|
5945
|
+
let missingCount = 0;
|
|
5563
5946
|
for (const field of Object.entries(localesFields || [])){
|
|
5564
5947
|
const [feature, resource] = field;
|
|
5565
5948
|
const thisResource = resource;
|
|
@@ -5573,6 +5956,7 @@ var __webpack_exports__ = {};
|
|
|
5573
5956
|
warning.name = 'LocalesPluginMissingFile';
|
|
5574
5957
|
if (!compilation.warnings) compilation.warnings = [];
|
|
5575
5958
|
compilation.warnings.push(warning);
|
|
5959
|
+
missingCount++;
|
|
5576
5960
|
continue;
|
|
5577
5961
|
}
|
|
5578
5962
|
const source = external_fs_.readFileSync(thisResource);
|
|
@@ -5583,8 +5967,10 @@ var __webpack_exports__ = {};
|
|
|
5583
5967
|
const normalizedRel = relativeToLocales.split(external_path_.sep).join('/');
|
|
5584
5968
|
const filename = `_locales/${normalizedRel}`;
|
|
5585
5969
|
compilation.emitAsset(filename, rawSource);
|
|
5970
|
+
emittedCount++;
|
|
5586
5971
|
}
|
|
5587
5972
|
}
|
|
5973
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesEmitSummary(emittedCount, missingCount, discoveredList.length));
|
|
5588
5974
|
});
|
|
5589
5975
|
});
|
|
5590
5976
|
compiler.hooks.thisCompilation.tap('locales:module', (compilation)=>{
|
|
@@ -5595,6 +5981,7 @@ var __webpack_exports__ = {};
|
|
|
5595
5981
|
var _compilation_errors;
|
|
5596
5982
|
if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
|
|
5597
5983
|
const localesFields = getLocales(this.manifestPath);
|
|
5984
|
+
let added = 0;
|
|
5598
5985
|
for (const field of Object.entries(localesFields || [])){
|
|
5599
5986
|
const [, resource] = field;
|
|
5600
5987
|
if (resource) {
|
|
@@ -5604,10 +5991,12 @@ var __webpack_exports__ = {};
|
|
|
5604
5991
|
if (!fileDependencies.has(thisResource)) {
|
|
5605
5992
|
fileDependencies.add(thisResource);
|
|
5606
5993
|
compilation.fileDependencies.add(thisResource);
|
|
5994
|
+
added++;
|
|
5607
5995
|
}
|
|
5608
5996
|
}
|
|
5609
5997
|
}
|
|
5610
5998
|
}
|
|
5999
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesDepsTracked(added));
|
|
5611
6000
|
});
|
|
5612
6001
|
});
|
|
5613
6002
|
}
|
|
@@ -5655,6 +6044,23 @@ var __webpack_exports__ = {};
|
|
|
5655
6044
|
`${external_pintor_default().red('INVALID SHAPE')} ${external_pintor_default().underline(file)}`
|
|
5656
6045
|
].join('\n');
|
|
5657
6046
|
}
|
|
6047
|
+
function jsonEmitSummary(feature, stats) {
|
|
6048
|
+
return `JSON ${external_pintor_default().yellow(feature)} \u{2014} entries ${external_pintor_default().gray(String(stats.entries))}, public ${external_pintor_default().gray(String(stats.underPublic))}, emitted ${external_pintor_default().gray(String(stats.emitted))}, missing ${external_pintor_default().gray(String(stats.missing))}, valid ${external_pintor_default().gray(String(stats.validatedOk))}, invalid ${external_pintor_default().gray(String(stats.invalid))}`;
|
|
6049
|
+
}
|
|
6050
|
+
function jsonDepsTracked(addedCount) {
|
|
6051
|
+
return `JSON file dependencies tracked: ${external_pintor_default().gray(String(addedCount))}`;
|
|
6052
|
+
}
|
|
6053
|
+
function jsonIncludeSummary(totalFeatures, criticalCount) {
|
|
6054
|
+
return `JSON include summary \u{2014} features ${external_pintor_default().gray(String(totalFeatures))}, critical ${external_pintor_default().gray(String(criticalCount))}`;
|
|
6055
|
+
}
|
|
6056
|
+
function jsonManifestChangeDetected(field, before, after) {
|
|
6057
|
+
const parts = [
|
|
6058
|
+
`Manifest JSON change detected in ${external_pintor_default().yellow(field)}`,
|
|
6059
|
+
before ? `${external_pintor_default().gray('before')} ${external_pintor_default().underline(before)}` : '',
|
|
6060
|
+
after ? `${external_pintor_default().gray('after')} ${external_pintor_default().underline(after)}` : ''
|
|
6061
|
+
].filter(Boolean);
|
|
6062
|
+
return parts.join(" \u2014 ");
|
|
6063
|
+
}
|
|
5658
6064
|
const external_node_module_namespaceObject = require("node:module");
|
|
5659
6065
|
function throw_if_manifest_json_change_define_property(obj, key, value) {
|
|
5660
6066
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -5750,6 +6156,7 @@ var __webpack_exports__ = {};
|
|
|
5750
6156
|
}, ()=>{
|
|
5751
6157
|
var _this_pending;
|
|
5752
6158
|
if (!(null == (_this_pending = this.pending) ? void 0 : _this_pending.hasChange)) return;
|
|
6159
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(jsonManifestChangeDetected(String(this.pending.manifestField || 'json'), this.pending.pathBefore, this.pending.pathAfter));
|
|
5753
6160
|
const issue = new core_namespaceObject.WebpackError(buildRestartMessage(this.pending.manifestField, this.pending.pathAfter, this.pending.pathBefore));
|
|
5754
6161
|
issue.file = 'manifest.json';
|
|
5755
6162
|
compilation.errors.push(issue);
|
|
@@ -5827,8 +6234,18 @@ var __webpack_exports__ = {};
|
|
|
5827
6234
|
const manifestDir = external_path_.dirname(this.manifestPath);
|
|
5828
6235
|
const projectPath = (null == (_compiler_options = compiler.options) ? void 0 : _compiler_options.context) || external_path_.dirname(this.manifestPath);
|
|
5829
6236
|
const publicDir = external_path_.join(projectPath, 'public');
|
|
6237
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
6238
|
+
const featureKeys = Object.keys(jsonFields || {});
|
|
6239
|
+
const criticalCount = featureKeys.filter((k)=>this.isCriticalJsonFeature(k)).length;
|
|
6240
|
+
console.log(jsonIncludeSummary(featureKeys.length, criticalCount));
|
|
6241
|
+
}
|
|
5830
6242
|
for (const field of Object.entries(jsonFields)){
|
|
5831
6243
|
const [feature, resource] = field;
|
|
6244
|
+
let emittedCount = 0;
|
|
6245
|
+
let underPublicCount = 0;
|
|
6246
|
+
let missingCount = 0;
|
|
6247
|
+
let validatedOk = 0;
|
|
6248
|
+
let invalid = 0;
|
|
5832
6249
|
const resourceArr = Array.isArray(resource) ? resource : [
|
|
5833
6250
|
resource
|
|
5834
6251
|
];
|
|
@@ -5849,24 +6266,45 @@ var __webpack_exports__ = {};
|
|
|
5849
6266
|
notFound.file = 'manifest.json';
|
|
5850
6267
|
if (this.isCriticalJsonFeature(feature)) compilation.errors.push(notFound);
|
|
5851
6268
|
else compilation.warnings.push(notFound);
|
|
6269
|
+
missingCount++;
|
|
5852
6270
|
continue;
|
|
5853
6271
|
}
|
|
5854
6272
|
if (isUnderPublic) {
|
|
5855
6273
|
try {
|
|
5856
6274
|
compilation.fileDependencies.add(abs);
|
|
5857
6275
|
} catch {}
|
|
5858
|
-
if (this.isCriticalJsonFeature(feature))
|
|
6276
|
+
if (this.isCriticalJsonFeature(feature)) {
|
|
6277
|
+
const ok = this.validateJsonAsset(compilation, feature, abs, external_fs_.readFileSync(abs));
|
|
6278
|
+
if (ok) validatedOk++;
|
|
6279
|
+
else invalid++;
|
|
6280
|
+
if (!ok) continue;
|
|
6281
|
+
}
|
|
6282
|
+
underPublicCount++;
|
|
5859
6283
|
continue;
|
|
5860
6284
|
}
|
|
5861
6285
|
const source = external_fs_.readFileSync(abs);
|
|
5862
6286
|
if (this.isCriticalJsonFeature(feature)) {
|
|
5863
6287
|
const ok = this.validateJsonAsset(compilation, feature, abs, source);
|
|
6288
|
+
if (ok) validatedOk++;
|
|
6289
|
+
else invalid++;
|
|
5864
6290
|
if (!ok) continue;
|
|
5865
6291
|
}
|
|
5866
6292
|
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
5867
6293
|
const assetName = feature + '.json';
|
|
5868
6294
|
if ('function' == typeof compilation.getAsset && compilation.getAsset(assetName)) compilation.updateAsset(assetName, rawSource);
|
|
5869
6295
|
else compilation.emitAsset(assetName, rawSource);
|
|
6296
|
+
emittedCount++;
|
|
6297
|
+
}
|
|
6298
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
6299
|
+
const entries = Array.isArray(resource) ? resource.length : resource ? 1 : 0;
|
|
6300
|
+
console.log(jsonEmitSummary(feature, {
|
|
6301
|
+
entries,
|
|
6302
|
+
underPublic: underPublicCount,
|
|
6303
|
+
emitted: emittedCount,
|
|
6304
|
+
missing: missingCount,
|
|
6305
|
+
validatedOk,
|
|
6306
|
+
invalid
|
|
6307
|
+
}));
|
|
5870
6308
|
}
|
|
5871
6309
|
}
|
|
5872
6310
|
});
|
|
@@ -5880,6 +6318,7 @@ var __webpack_exports__ = {};
|
|
|
5880
6318
|
if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
|
|
5881
6319
|
const jsonFields = this.includeList || {};
|
|
5882
6320
|
const manifestDir = external_path_.dirname(this.manifestPath);
|
|
6321
|
+
let added = 0;
|
|
5883
6322
|
for (const field of Object.entries(jsonFields)){
|
|
5884
6323
|
const [, resource] = field;
|
|
5885
6324
|
const resourceArr = Array.isArray(resource) ? resource : [
|
|
@@ -5892,10 +6331,12 @@ var __webpack_exports__ = {};
|
|
|
5892
6331
|
if (!fileDependencies.has(abs)) {
|
|
5893
6332
|
fileDependencies.add(abs);
|
|
5894
6333
|
compilation.fileDependencies.add(abs);
|
|
6334
|
+
added++;
|
|
5895
6335
|
}
|
|
5896
6336
|
}
|
|
5897
6337
|
}
|
|
5898
6338
|
}
|
|
6339
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(jsonDepsTracked(added));
|
|
5899
6340
|
});
|
|
5900
6341
|
});
|
|
5901
6342
|
}
|
|
@@ -5927,6 +6368,23 @@ var __webpack_exports__ = {};
|
|
|
5927
6368
|
if (pathAfter) lines.push(`${external_pintor_default().green('PATH AFTER')} ${external_pintor_default().underline(pathAfter)}`);
|
|
5928
6369
|
return lines.join('\n');
|
|
5929
6370
|
}
|
|
6371
|
+
function iconsEmitSummary(feature, stats) {
|
|
6372
|
+
return `Icons ${external_pintor_default().yellow(feature)} \u{2014} entries ${external_pintor_default().gray(String(stats.entries))}, public ${external_pintor_default().gray(String(stats.underPublic))}, emitted ${external_pintor_default().gray(String(stats.emitted))}, missing ${external_pintor_default().gray(String(stats.missing))}`;
|
|
6373
|
+
}
|
|
6374
|
+
function iconsDepsTracked(addedCount) {
|
|
6375
|
+
return `Icons file dependencies tracked: ${external_pintor_default().gray(String(addedCount))}`;
|
|
6376
|
+
}
|
|
6377
|
+
function iconsNormalizationSummary(beforeKeys, afterKeys, changedCount) {
|
|
6378
|
+
return `Icons include normalization \u{2014} keys ${external_pintor_default().gray(String(beforeKeys.length))} \u{2192} ${external_pintor_default().gray(String(afterKeys.length))}, normalized ${external_pintor_default().gray(String(changedCount))}`;
|
|
6379
|
+
}
|
|
6380
|
+
function iconsManifestChangeDetected(field, before, after) {
|
|
6381
|
+
const parts = [
|
|
6382
|
+
`Manifest icons change detected in ${external_pintor_default().yellow(field)}`,
|
|
6383
|
+
before ? `${external_pintor_default().gray('before')} ${external_pintor_default().underline(before)}` : '',
|
|
6384
|
+
after ? `${external_pintor_default().gray('after')} ${external_pintor_default().underline(after)}` : ''
|
|
6385
|
+
].filter(Boolean);
|
|
6386
|
+
return parts.join(" \u2014 ");
|
|
6387
|
+
}
|
|
5930
6388
|
function emit_file_define_property(obj, key, value) {
|
|
5931
6389
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
5932
6390
|
value: value,
|
|
@@ -5980,6 +6438,10 @@ var __webpack_exports__ = {};
|
|
|
5980
6438
|
return [];
|
|
5981
6439
|
};
|
|
5982
6440
|
const stringEntries = normalizeToStrings(resource);
|
|
6441
|
+
let emittedCount = 0;
|
|
6442
|
+
let underPublicCount = 0;
|
|
6443
|
+
let missingCount = 0;
|
|
6444
|
+
const entriesTotal = stringEntries.length;
|
|
5983
6445
|
for (const entry of stringEntries)if (entry) {
|
|
5984
6446
|
const manifestDir = external_path_.dirname(this.manifestPath);
|
|
5985
6447
|
let resolved = entry;
|
|
@@ -6002,12 +6464,14 @@ var __webpack_exports__ = {};
|
|
|
6002
6464
|
type: severity,
|
|
6003
6465
|
file: 'manifest.json'
|
|
6004
6466
|
});
|
|
6467
|
+
missingCount++;
|
|
6005
6468
|
continue;
|
|
6006
6469
|
}
|
|
6007
6470
|
if (isUnderPublic) {
|
|
6008
6471
|
try {
|
|
6009
6472
|
compilation.fileDependencies.add(resolved);
|
|
6010
6473
|
} catch {}
|
|
6474
|
+
underPublicCount++;
|
|
6011
6475
|
continue;
|
|
6012
6476
|
}
|
|
6013
6477
|
const source = external_fs_.readFileSync(resolved);
|
|
@@ -6021,7 +6485,14 @@ var __webpack_exports__ = {};
|
|
|
6021
6485
|
else if ('browser_action' === group && 'theme_icons' === sub) outputDir = 'browser_action';
|
|
6022
6486
|
const filename = `${outputDir}/${basename}`;
|
|
6023
6487
|
compilation.emitAsset(filename, rawSource);
|
|
6488
|
+
emittedCount++;
|
|
6024
6489
|
}
|
|
6490
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(iconsEmitSummary(feature, {
|
|
6491
|
+
entries: entriesTotal,
|
|
6492
|
+
underPublic: underPublicCount,
|
|
6493
|
+
emitted: emittedCount,
|
|
6494
|
+
missing: missingCount
|
|
6495
|
+
}));
|
|
6025
6496
|
}
|
|
6026
6497
|
});
|
|
6027
6498
|
});
|
|
@@ -6053,6 +6524,7 @@ var __webpack_exports__ = {};
|
|
|
6053
6524
|
var _compilation_errors;
|
|
6054
6525
|
if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
|
|
6055
6526
|
const iconFields = this.includeList || {};
|
|
6527
|
+
let added = 0;
|
|
6056
6528
|
for (const field of Object.entries(iconFields)){
|
|
6057
6529
|
const [, resource] = field;
|
|
6058
6530
|
const normalizeToStrings = (response)=>{
|
|
@@ -6080,10 +6552,12 @@ var __webpack_exports__ = {};
|
|
|
6080
6552
|
if (!fileDependencies.has(entry)) {
|
|
6081
6553
|
fileDependencies.add(entry);
|
|
6082
6554
|
compilation.fileDependencies.add(entry);
|
|
6555
|
+
added++;
|
|
6083
6556
|
}
|
|
6084
6557
|
}
|
|
6085
6558
|
}
|
|
6086
6559
|
}
|
|
6560
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(iconsDepsTracked(added));
|
|
6087
6561
|
});
|
|
6088
6562
|
});
|
|
6089
6563
|
}
|
|
@@ -6171,6 +6645,7 @@ var __webpack_exports__ = {};
|
|
|
6171
6645
|
}, ()=>{
|
|
6172
6646
|
var _this_pending;
|
|
6173
6647
|
if (!(null == (_this_pending = this.pending) ? void 0 : _this_pending.hasChange)) return;
|
|
6648
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(iconsManifestChangeDetected(String(this.pending.manifestField || 'icons'), this.pending.pathBefore, this.pending.pathAfter));
|
|
6174
6649
|
const body = manifestIconsEntrypointChange(this.pending.manifestField, this.pending.pathAfter, this.pending.pathBefore);
|
|
6175
6650
|
const issue = new core_namespaceObject.WebpackError(body);
|
|
6176
6651
|
issue.file = 'manifest.json';
|
|
@@ -6210,6 +6685,12 @@ var __webpack_exports__ = {};
|
|
|
6210
6685
|
return out;
|
|
6211
6686
|
};
|
|
6212
6687
|
const normalizedIncludeList = normalizeIconIncludeKeys(this.includeList);
|
|
6688
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
6689
|
+
const beforeKeys = Object.keys(this.includeList || {});
|
|
6690
|
+
const afterKeys = Object.keys(normalizedIncludeList || {});
|
|
6691
|
+
const changedCount = afterKeys.filter((k)=>k.includes('/default_icon') || k.includes('/theme_icons')).length;
|
|
6692
|
+
console.log(iconsNormalizationSummary(beforeKeys, afterKeys, changedCount));
|
|
6693
|
+
}
|
|
6213
6694
|
new EmitFile({
|
|
6214
6695
|
manifestPath: this.manifestPath,
|
|
6215
6696
|
includeList: normalizedIncludeList
|
|
@@ -6357,34 +6838,6 @@ var __webpack_exports__ = {};
|
|
|
6357
6838
|
}
|
|
6358
6839
|
return shared;
|
|
6359
6840
|
}
|
|
6360
|
-
function collect_content_entry_imports_define_property(obj, key, value) {
|
|
6361
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
6362
|
-
value: value,
|
|
6363
|
-
enumerable: true,
|
|
6364
|
-
configurable: true,
|
|
6365
|
-
writable: true
|
|
6366
|
-
});
|
|
6367
|
-
else obj[key] = value;
|
|
6368
|
-
return obj;
|
|
6369
|
-
}
|
|
6370
|
-
class CollectContentEntryImports {
|
|
6371
|
-
apply(compiler) {
|
|
6372
|
-
compiler.hooks.thisCompilation.tap('plugin-extension:feature-web-resources:collect-entry-imports', (compilation)=>{
|
|
6373
|
-
compilation.hooks.processAssets.tap({
|
|
6374
|
-
name: 'plugin-extension:feature-web-resources:collect-entry-imports',
|
|
6375
|
-
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
6376
|
-
}, ()=>{
|
|
6377
|
-
const entryImports = collectContentScriptEntryImports(compilation, this.includeList);
|
|
6378
|
-
const shared = getSharedFor(compilation);
|
|
6379
|
-
shared.entryImports = entryImports;
|
|
6380
|
-
});
|
|
6381
|
-
});
|
|
6382
|
-
}
|
|
6383
|
-
constructor(options){
|
|
6384
|
-
collect_content_entry_imports_define_property(this, "includeList", void 0);
|
|
6385
|
-
this.includeList = options.includeList;
|
|
6386
|
-
}
|
|
6387
|
-
}
|
|
6388
6841
|
function warFieldError(filePath, opts) {
|
|
6389
6842
|
const displayPath = (null == opts ? void 0 : opts.overrideNotFoundPath) || filePath;
|
|
6390
6843
|
const lines = [];
|
|
@@ -6413,6 +6866,48 @@ var __webpack_exports__ = {};
|
|
|
6413
6866
|
lines.push(`${external_pintor_default().red('INVALID MATCH PATTERN')} ${external_pintor_default().underline(pattern)}`);
|
|
6414
6867
|
return lines.join('\n');
|
|
6415
6868
|
}
|
|
6869
|
+
function entryImportsSummary(entryCount, totalResources) {
|
|
6870
|
+
return `Web resources: content entry imports \u{2014} entries=${String(entryCount)}, resources=${String(totalResources)}`;
|
|
6871
|
+
}
|
|
6872
|
+
function warPatchedSummary(v3Groups, v3ResourcesTotal, v2Resources) {
|
|
6873
|
+
return `Web resources: WAR patched \u{2014} v3Groups=${String(v3Groups)}, v3Resources=${String(v3ResourcesTotal)}, v2Resources=${String(v2Resources)}`;
|
|
6874
|
+
}
|
|
6875
|
+
function collect_content_entry_imports_define_property(obj, key, value) {
|
|
6876
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
6877
|
+
value: value,
|
|
6878
|
+
enumerable: true,
|
|
6879
|
+
configurable: true,
|
|
6880
|
+
writable: true
|
|
6881
|
+
});
|
|
6882
|
+
else obj[key] = value;
|
|
6883
|
+
return obj;
|
|
6884
|
+
}
|
|
6885
|
+
class CollectContentEntryImports {
|
|
6886
|
+
apply(compiler) {
|
|
6887
|
+
compiler.hooks.thisCompilation.tap('plugin-extension:feature-web-resources:collect-entry-imports', (compilation)=>{
|
|
6888
|
+
compilation.hooks.processAssets.tap({
|
|
6889
|
+
name: 'plugin-extension:feature-web-resources:collect-entry-imports',
|
|
6890
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
6891
|
+
}, ()=>{
|
|
6892
|
+
const entryImports = collectContentScriptEntryImports(compilation, this.includeList);
|
|
6893
|
+
const shared = getSharedFor(compilation);
|
|
6894
|
+
shared.entryImports = entryImports;
|
|
6895
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
6896
|
+
const keys = Object.keys(entryImports || {});
|
|
6897
|
+
const total = keys.reduce((acc, k)=>{
|
|
6898
|
+
var _entryImports_k;
|
|
6899
|
+
return acc + ((null == (_entryImports_k = entryImports[k]) ? void 0 : _entryImports_k.length) || 0);
|
|
6900
|
+
}, 0);
|
|
6901
|
+
console.log(entryImportsSummary(keys.length, total));
|
|
6902
|
+
}
|
|
6903
|
+
});
|
|
6904
|
+
});
|
|
6905
|
+
}
|
|
6906
|
+
constructor(options){
|
|
6907
|
+
collect_content_entry_imports_define_property(this, "includeList", void 0);
|
|
6908
|
+
this.includeList = options.includeList;
|
|
6909
|
+
}
|
|
6910
|
+
}
|
|
6416
6911
|
function isPublicRootLike(possiblePath) {
|
|
6417
6912
|
const normalizedPath = paths_unixify(possiblePath || '');
|
|
6418
6913
|
return normalizedPath.startsWith('/') || /^(?:\.\/)?public\//i.test(normalizedPath) || /^\/public\//i.test(normalizedPath);
|
|
@@ -6766,6 +7261,15 @@ var __webpack_exports__ = {};
|
|
|
6766
7261
|
} else if (webAccessibleResourcesV2.length > 0) manifest.web_accessible_resources = Array.from(new Set(webAccessibleResourcesV2)).sort();
|
|
6767
7262
|
const source = JSON.stringify(manifest, null, 2);
|
|
6768
7263
|
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
7264
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
|
|
7265
|
+
const v3Groups = 3 === manifest.manifest_version ? webAccessibleResourcesV3.length : 0;
|
|
7266
|
+
const v3ResourcesTotal = 3 === manifest.manifest_version ? webAccessibleResourcesV3.reduce((sum, g)=>{
|
|
7267
|
+
var _g_resources;
|
|
7268
|
+
return sum + ((null == (_g_resources = g.resources) ? void 0 : _g_resources.length) || 0);
|
|
7269
|
+
}, 0) : 0;
|
|
7270
|
+
const v2Resources = 2 === manifest.manifest_version ? webAccessibleResourcesV2.length : 0;
|
|
7271
|
+
console.log(warPatchedSummary(v3Groups, v3ResourcesTotal, v2Resources));
|
|
7272
|
+
} catch {}
|
|
6769
7273
|
if (compilation.getAsset('manifest.json')) compilation.updateAsset('manifest.json', rawSource);
|
|
6770
7274
|
}
|
|
6771
7275
|
function patch_manifest_war_define_property(obj, key, value) {
|
|
@@ -6834,6 +7338,12 @@ var __webpack_exports__ = {};
|
|
|
6834
7338
|
function serverRestartRequiredFromSpecialFolderMessageOnly(addingOrRemoving, folder, typeOfAsset) {
|
|
6835
7339
|
return `${external_pintor_default().red('ERROR')} in ${external_pintor_default().yellow('manifest.json')} entrypoint: ${addingOrRemoving} ${external_pintor_default().yellow(typeOfAsset)} in ${external_pintor_default().underline(folder + '/')} requires a server restart.`;
|
|
6836
7340
|
}
|
|
7341
|
+
function specialFoldersSetupSummary(hasPublic, copyEnabled, ignoredCount) {
|
|
7342
|
+
return `Special folders setup \u{2014} public=${String(hasPublic)}, copy=${String(copyEnabled)}, ignored=${String(ignoredCount)}`;
|
|
7343
|
+
}
|
|
7344
|
+
function specialFolderChangeDetected(action, folder, relativePath) {
|
|
7345
|
+
return `Special folders change \u{2014} ${action} in ${folder}/: ${relativePath}`;
|
|
7346
|
+
}
|
|
6837
7347
|
class WarnUponFolderChanges {
|
|
6838
7348
|
throwCompilationError(compilation, folder, filePath, isAddition) {
|
|
6839
7349
|
var _compilation_errors;
|
|
@@ -6871,24 +7381,36 @@ var __webpack_exports__ = {};
|
|
|
6871
7381
|
pagesWatcher.on('add', (filePath)=>{
|
|
6872
7382
|
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6873
7383
|
const isHtml = '.html' === ext;
|
|
6874
|
-
if (isHtml)
|
|
7384
|
+
if (isHtml) {
|
|
7385
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('add', 'pages', external_path_.relative(projectPath, filePath)));
|
|
7386
|
+
this.throwCompilationError(compilation, 'pages', filePath, true);
|
|
7387
|
+
}
|
|
6875
7388
|
});
|
|
6876
7389
|
pagesWatcher.on('unlink', (filePath)=>{
|
|
6877
7390
|
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6878
7391
|
const isHtml = '.html' === ext;
|
|
6879
|
-
if (isHtml)
|
|
7392
|
+
if (isHtml) {
|
|
7393
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('remove', 'pages', external_path_.relative(projectPath, filePath)));
|
|
7394
|
+
this.throwCompilationError(compilation, 'pages', filePath);
|
|
7395
|
+
}
|
|
6880
7396
|
});
|
|
6881
7397
|
scriptsWatcher.on('add', (filePath)=>{
|
|
6882
7398
|
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6883
7399
|
const supported = new Set((extensionsSupported || []).map((e)=>e.toLowerCase()));
|
|
6884
7400
|
const isScript = supported.has(ext);
|
|
6885
|
-
if (isScript)
|
|
7401
|
+
if (isScript) {
|
|
7402
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('add', "scripts", external_path_.relative(projectPath, filePath)));
|
|
7403
|
+
this.throwCompilationError(compilation, "scripts", filePath, true);
|
|
7404
|
+
}
|
|
6886
7405
|
});
|
|
6887
7406
|
scriptsWatcher.on('unlink', (filePath)=>{
|
|
6888
7407
|
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6889
7408
|
const supported = new Set((extensionsSupported || []).map((e)=>e.toLowerCase()));
|
|
6890
7409
|
const isScript = supported.has(ext);
|
|
6891
|
-
if (isScript)
|
|
7410
|
+
if (isScript) {
|
|
7411
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('remove', "scripts", external_path_.relative(projectPath, filePath)));
|
|
7412
|
+
this.throwCompilationError(compilation, "scripts", filePath);
|
|
7413
|
+
}
|
|
6892
7414
|
});
|
|
6893
7415
|
compiler.hooks.watchClose.tap('WarnUponFolderChanges', ()=>{
|
|
6894
7416
|
pagesWatcher.close().catch(()=>{});
|
|
@@ -6944,6 +7466,7 @@ var __webpack_exports__ = {};
|
|
|
6944
7466
|
}
|
|
6945
7467
|
]
|
|
6946
7468
|
}).apply(compiler);
|
|
7469
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFoldersSetupSummary(true, true, 1));
|
|
6947
7470
|
}
|
|
6948
7471
|
if ('development' === compiler.options.mode) {
|
|
6949
7472
|
if (compiler.options.watchOptions) new WarnUponFolderChanges().apply(compiler);
|
|
@@ -7036,6 +7559,23 @@ var __webpack_exports__ = {};
|
|
|
7036
7559
|
function webextensionPolyfillNotFound() {
|
|
7037
7560
|
return `Warning: webextension-polyfill not found. Browser API polyfill will not be available.\nTo fix this, install webextension-polyfill: npm install webextension-polyfill`;
|
|
7038
7561
|
}
|
|
7562
|
+
function capitalizedBrowserName(browser) {
|
|
7563
|
+
const b = String(browser || '');
|
|
7564
|
+
const cap = b.charAt(0).toUpperCase() + b.slice(1);
|
|
7565
|
+
return external_pintor_default().yellow(`${cap}`);
|
|
7566
|
+
}
|
|
7567
|
+
function compatibilityPolyfillEnabled(browser, polyfillPath) {
|
|
7568
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Compatibility: Polyfill enabled for ${capitalizedBrowserName(browser)}\n${external_pintor_default().gray('ALIAS')} ${external_pintor_default().underline(polyfillPath)}`;
|
|
7569
|
+
}
|
|
7570
|
+
function compatibilityPolyfillSkipped(reason, browser) {
|
|
7571
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Compatibility: Polyfill ${external_pintor_default().gray('skipped')} for ${capitalizedBrowserName(browser)} (${external_pintor_default().gray(reason)})`;
|
|
7572
|
+
}
|
|
7573
|
+
function compatibilityPolyfillDisabled(browser) {
|
|
7574
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Compatibility: Polyfill ${external_pintor_default().gray('disabled')} for ${capitalizedBrowserName(browser)}`;
|
|
7575
|
+
}
|
|
7576
|
+
function compatibilityManifestFilteredKeys(browser, filteredCount) {
|
|
7577
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Compatibility: Filtered ${external_pintor_default().gray(String(filteredCount))} manifest key(s) for ${capitalizedBrowserName(browser)}`;
|
|
7578
|
+
}
|
|
7039
7579
|
function feature_polyfill_define_property(obj, key, value) {
|
|
7040
7580
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
7041
7581
|
value: value,
|
|
@@ -7066,6 +7606,7 @@ var __webpack_exports__ = {};
|
|
|
7066
7606
|
new (core_default()).ProvidePlugin({
|
|
7067
7607
|
browser: 'webextension-polyfill'
|
|
7068
7608
|
}).apply(compiler);
|
|
7609
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityPolyfillEnabled(this.browser, polyfillPath));
|
|
7069
7610
|
} catch (error) {
|
|
7070
7611
|
console.warn(webextensionPolyfillNotFound());
|
|
7071
7612
|
}
|
|
@@ -7131,6 +7672,16 @@ var __webpack_exports__ = {};
|
|
|
7131
7672
|
else obj[key] = value;
|
|
7132
7673
|
return obj;
|
|
7133
7674
|
}
|
|
7675
|
+
function countBrowserPrefixedKeys(obj) {
|
|
7676
|
+
if (!obj || 'object' != typeof obj) return 0;
|
|
7677
|
+
if (Array.isArray(obj)) return obj.reduce((sum, v)=>sum + countBrowserPrefixedKeys(v), 0);
|
|
7678
|
+
let total = 0;
|
|
7679
|
+
for (const key of Object.keys(obj)){
|
|
7680
|
+
if (key.includes(':')) total++;
|
|
7681
|
+
total += countBrowserPrefixedKeys(obj[key]);
|
|
7682
|
+
}
|
|
7683
|
+
return total;
|
|
7684
|
+
}
|
|
7134
7685
|
class BrowserSpecificFieldsPlugin {
|
|
7135
7686
|
patchManifest(manifest) {
|
|
7136
7687
|
const patchedManifest = compatibility_lib_manifest_filterKeysForThisBrowser(manifest, this.browser);
|
|
@@ -7143,9 +7694,11 @@ var __webpack_exports__ = {};
|
|
|
7143
7694
|
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
|
|
7144
7695
|
}, ()=>{
|
|
7145
7696
|
const manifest = compatibility_lib_manifest_getManifestContent(compilation, this.manifestPath);
|
|
7697
|
+
const filteredCount = countBrowserPrefixedKeys(manifest);
|
|
7146
7698
|
const patchedSource = this.patchManifest(manifest);
|
|
7147
7699
|
const rawSource = new core_namespaceObject.sources.RawSource(patchedSource);
|
|
7148
7700
|
compilation.updateAsset('manifest.json', rawSource);
|
|
7701
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityManifestFilteredKeys(this.browser, filteredCount));
|
|
7149
7702
|
});
|
|
7150
7703
|
});
|
|
7151
7704
|
}
|
|
@@ -7169,11 +7722,14 @@ var __webpack_exports__ = {};
|
|
|
7169
7722
|
class CompatibilityPlugin {
|
|
7170
7723
|
async apply(compiler) {
|
|
7171
7724
|
if (this.polyfill) {
|
|
7172
|
-
if ('firefox' !== this.browser)
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7725
|
+
if ('firefox' !== this.browser) {
|
|
7726
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityPolyfillEnabled(this.browser, 'webextension-polyfill'));
|
|
7727
|
+
new PolyfillPlugin({
|
|
7728
|
+
manifestPath: this.manifestPath,
|
|
7729
|
+
browser: this.browser || 'chrome'
|
|
7730
|
+
}).apply(compiler);
|
|
7731
|
+
} else if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityPolyfillSkipped('Firefox bundles browser.* APIs', this.browser));
|
|
7732
|
+
} else if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityPolyfillDisabled(this.browser));
|
|
7177
7733
|
new BrowserSpecificFieldsPlugin({
|
|
7178
7734
|
manifestPath: this.manifestPath,
|
|
7179
7735
|
browser: this.browser || 'chrome'
|
|
@@ -7228,6 +7784,7 @@ var __webpack_exports__ = {};
|
|
|
7228
7784
|
};
|
|
7229
7785
|
}
|
|
7230
7786
|
function messages_getLoggingPrefix(type) {
|
|
7787
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) return external_pintor_default().brightMagenta('error' === type ? 'ERROR' : "\u25BA\u25BA\u25BA");
|
|
7231
7788
|
if ('error' === type) return external_pintor_default().red('ERROR');
|
|
7232
7789
|
if ('warn' === type) return external_pintor_default().brightYellow("\u25BA\u25BA\u25BA");
|
|
7233
7790
|
if ('info' === type) return external_pintor_default().gray("\u25BA\u25BA\u25BA");
|
|
@@ -7238,18 +7795,18 @@ var __webpack_exports__ = {};
|
|
|
7238
7795
|
const maybe = null == error ? void 0 : error.message;
|
|
7239
7796
|
return String(maybe || error);
|
|
7240
7797
|
}
|
|
7241
|
-
function
|
|
7798
|
+
function messages_capitalizedBrowserName(browser) {
|
|
7242
7799
|
return external_pintor_default().yellow(`${browser.charAt(0).toUpperCase() + browser.slice(1)}`);
|
|
7243
7800
|
}
|
|
7244
7801
|
function creatingUserProfile(profilePath) {
|
|
7245
7802
|
return `${messages_getLoggingPrefix('info')} Creating a fresh user profile at ${external_pintor_default().underline(profilePath)}...`;
|
|
7246
7803
|
}
|
|
7247
7804
|
function browserInstanceExited(browser) {
|
|
7248
|
-
return `${messages_getLoggingPrefix('info')} ${
|
|
7805
|
+
return `${messages_getLoggingPrefix('info')} ${messages_capitalizedBrowserName(browser)} instance exited.`;
|
|
7249
7806
|
}
|
|
7250
7807
|
function stdoutData(browser, mode) {
|
|
7251
7808
|
const extensionOutput = 'firefox' === browser || 'gecko-based' === browser ? 'Add-on' : 'Extension';
|
|
7252
|
-
return `${messages_getLoggingPrefix('info')} ${
|
|
7809
|
+
return `${messages_getLoggingPrefix('info')} ${messages_capitalizedBrowserName(browser)} ${extensionOutput} running in ${external_pintor_default().green(mode || 'unknown')} mode.`;
|
|
7253
7810
|
}
|
|
7254
7811
|
function cdpClientAttachedToTarget(sessionId, targetType) {
|
|
7255
7812
|
return `${messages_getLoggingPrefix('info')} Attached to target: ${targetType} (session ${sessionId})`;
|
|
@@ -7283,56 +7840,56 @@ var __webpack_exports__ = {};
|
|
|
7283
7840
|
return `${messages_getLoggingPrefix('warn')} Skipping browser launch due to compile errors`;
|
|
7284
7841
|
}
|
|
7285
7842
|
function browserNotInstalledError(browser, browserBinaryLocation) {
|
|
7286
|
-
const isUnreachable = 'null' == browserBinaryLocation ? `Browser ${
|
|
7287
|
-
return `${messages_getLoggingPrefix('error')} ${isUnreachable}Either install the missing browser or choose a different one via ${external_pintor_default().blue('--browser')} ${external_pintor_default().gray('<chrome|edge|firefox>')}.\n\n${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(browserBinaryLocation ||
|
|
7843
|
+
const isUnreachable = 'null' == browserBinaryLocation ? `Browser ${messages_capitalizedBrowserName(browser)} is not installed\n` : `Can't find the path for browser ${messages_capitalizedBrowserName(browser)}\n`;
|
|
7844
|
+
return `${messages_getLoggingPrefix('error')} ${isUnreachable}Either install the missing browser or choose a different one via ${external_pintor_default().blue('--browser')} ${external_pintor_default().gray('<chrome|edge|firefox>')}.\n\n${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(browserBinaryLocation || messages_capitalizedBrowserName(browser) + 'BROWSER')}`;
|
|
7288
7845
|
}
|
|
7289
7846
|
function browserLaunchError(browser, error) {
|
|
7290
|
-
return `${messages_getLoggingPrefix('error')} Error launching ${
|
|
7847
|
+
return `${messages_getLoggingPrefix('error')} Error launching ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
|
|
7291
7848
|
}
|
|
7292
7849
|
function enhancedProcessManagementCleanup(browser) {
|
|
7293
|
-
return `${messages_getLoggingPrefix('info')} Process Management cleanup for ${
|
|
7850
|
+
return `${messages_getLoggingPrefix('info')} Process Management cleanup for ${messages_capitalizedBrowserName(browser)}`;
|
|
7294
7851
|
}
|
|
7295
7852
|
function enhancedProcessManagementTerminating(browser) {
|
|
7296
|
-
return `${messages_getLoggingPrefix('info')} Terminating ${
|
|
7853
|
+
return `${messages_getLoggingPrefix('info')} Terminating ${messages_capitalizedBrowserName(browser)} process gracefully`;
|
|
7297
7854
|
}
|
|
7298
7855
|
function enhancedProcessManagementForceKill(browser) {
|
|
7299
|
-
return `${messages_getLoggingPrefix('error')} Force killing ${
|
|
7856
|
+
return `${messages_getLoggingPrefix('error')} Force killing ${messages_capitalizedBrowserName(browser)} process after timeout`;
|
|
7300
7857
|
}
|
|
7301
7858
|
function enhancedProcessManagementCleanupError(browser, error) {
|
|
7302
|
-
return `${messages_getLoggingPrefix('error')} Error during ${
|
|
7859
|
+
return `${messages_getLoggingPrefix('error')} Error during ${messages_capitalizedBrowserName(browser)} cleanup:\n${external_pintor_default().red(errorDetail(error))}`;
|
|
7303
7860
|
}
|
|
7304
7861
|
function enhancedProcessManagementUncaughtException(browser, error) {
|
|
7305
|
-
return `${messages_getLoggingPrefix('error')} Uncaught exception in ${
|
|
7862
|
+
return `${messages_getLoggingPrefix('error')} Uncaught exception in ${messages_capitalizedBrowserName(browser)} process:\n${external_pintor_default().red(errorDetail(error))}`;
|
|
7306
7863
|
}
|
|
7307
7864
|
function enhancedProcessManagementUnhandledRejection(browser, reason) {
|
|
7308
|
-
return `${messages_getLoggingPrefix('error')} Unhandled rejection in ${
|
|
7865
|
+
return `${messages_getLoggingPrefix('error')} Unhandled rejection in ${messages_capitalizedBrowserName(browser)} process:\n${external_pintor_default().red(errorDetail(reason))}`;
|
|
7309
7866
|
}
|
|
7310
7867
|
function generalBrowserError(browser, error) {
|
|
7311
|
-
return `${messages_getLoggingPrefix('error')} General error in ${
|
|
7868
|
+
return `${messages_getLoggingPrefix('error')} General error in ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
|
|
7312
7869
|
}
|
|
7313
7870
|
function errorConnectingToBrowser(browser) {
|
|
7314
|
-
return `${messages_getLoggingPrefix('error')} Unable to connect to ${
|
|
7871
|
+
return `${messages_getLoggingPrefix('error')} Unable to connect to ${messages_capitalizedBrowserName(browser)}. Too many retries.`;
|
|
7315
7872
|
}
|
|
7316
7873
|
function addonInstallError(browser, message) {
|
|
7317
|
-
return `${messages_getLoggingPrefix('error')} Can't install add-on into ${
|
|
7874
|
+
return `${messages_getLoggingPrefix('error')} Can't install add-on into ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(message)}`;
|
|
7318
7875
|
}
|
|
7319
7876
|
function messagingClientClosedError(browser) {
|
|
7320
|
-
return `${messages_getLoggingPrefix('error')} Messaging client closed unexpectedly for ${
|
|
7877
|
+
return `${messages_getLoggingPrefix('error')} Messaging client closed unexpectedly for ${messages_capitalizedBrowserName(browser)}`;
|
|
7321
7878
|
}
|
|
7322
7879
|
function connectionClosedError(browser) {
|
|
7323
|
-
return `${messages_getLoggingPrefix('error')} Connection closed unexpectedly for ${
|
|
7880
|
+
return `${messages_getLoggingPrefix('error')} Connection closed unexpectedly for ${messages_capitalizedBrowserName(browser)}`;
|
|
7324
7881
|
}
|
|
7325
7882
|
function targetActorHasActiveRequestError(browser, targetActor) {
|
|
7326
|
-
return `${messages_getLoggingPrefix('error')} Target actor ${external_pintor_default().gray(targetActor)} has active request for ${
|
|
7883
|
+
return `${messages_getLoggingPrefix('error')} Target actor ${external_pintor_default().gray(targetActor)} has active request for ${messages_capitalizedBrowserName(browser)}`;
|
|
7327
7884
|
}
|
|
7328
7885
|
function parsingPacketError(browser, error) {
|
|
7329
|
-
return `${messages_getLoggingPrefix('error')} Failed to parse packet from ${
|
|
7886
|
+
return `${messages_getLoggingPrefix('error')} Failed to parse packet from ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
|
|
7330
7887
|
}
|
|
7331
7888
|
function messageWithoutSenderError(browser, message) {
|
|
7332
|
-
return `${messages_getLoggingPrefix('error')} Message without sender from ${
|
|
7889
|
+
return `${messages_getLoggingPrefix('error')} Message without sender from ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(JSON.stringify(message))}`;
|
|
7333
7890
|
}
|
|
7334
7891
|
function profileFallbackWarning(browser, reason) {
|
|
7335
|
-
return `${external_pintor_default().brightYellow("\u25BA\u25BA\u25BA")} ${external_pintor_default().brightYellow('Dev')} ${
|
|
7892
|
+
return `${external_pintor_default().brightYellow("\u25BA\u25BA\u25BA")} ${external_pintor_default().brightYellow('Dev')} ${messages_capitalizedBrowserName(browser)} falling back to per-instance profile` + (reason ? `: ${external_pintor_default().gray(reason)}` : '');
|
|
7336
7893
|
}
|
|
7337
7894
|
function chromeProcessExited(code) {
|
|
7338
7895
|
return `${messages_getLoggingPrefix('info')} Chrome process exited with code: ${external_pintor_default().gray(code.toString())}`;
|
|
@@ -7347,11 +7904,17 @@ var __webpack_exports__ = {};
|
|
|
7347
7904
|
return `${messages_getLoggingPrefix('info')} Initializing enhanced reload service with direct spawn for Chrome`;
|
|
7348
7905
|
}
|
|
7349
7906
|
function locatingBrowser(browser) {
|
|
7350
|
-
return `${messages_getLoggingPrefix('info')} Locating ${
|
|
7907
|
+
return `${messages_getLoggingPrefix('info')} Locating ${messages_capitalizedBrowserName(browser)} browser binary...`;
|
|
7351
7908
|
}
|
|
7352
7909
|
function devChromeProfilePath(path) {
|
|
7353
7910
|
return `${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA")} ${external_pintor_default().brightMagenta('Dev')} Chrome profile: ${external_pintor_default().underline(path)}`;
|
|
7354
7911
|
}
|
|
7912
|
+
function usingChromiumRunner(browser) {
|
|
7913
|
+
return `${messages_getLoggingPrefix('info')} Using Chromium runner for ${messages_capitalizedBrowserName(browser)}`;
|
|
7914
|
+
}
|
|
7915
|
+
function usingFirefoxRunner(browser) {
|
|
7916
|
+
return `${messages_getLoggingPrefix('info')} Using Firefox runner for ${messages_capitalizedBrowserName(browser)}`;
|
|
7917
|
+
}
|
|
7355
7918
|
function chromiumDryRunNotLaunching() {
|
|
7356
7919
|
return `${messages_getLoggingPrefix('info')} [plugin-browsers] Dry run: not launching browser`;
|
|
7357
7920
|
}
|
|
@@ -8154,7 +8717,7 @@ var __webpack_exports__ = {};
|
|
|
8154
8717
|
function setupProcessSignalHandlers(browser, child, cleanupInstance) {
|
|
8155
8718
|
const cleanup = ()=>{
|
|
8156
8719
|
try {
|
|
8157
|
-
if ('
|
|
8720
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementCleanup(browser));
|
|
8158
8721
|
if (child && !child.killed) {
|
|
8159
8722
|
if ('win32' === process.platform) try {
|
|
8160
8723
|
(0, external_child_process_.spawn)('taskkill', [
|
|
@@ -8167,11 +8730,11 @@ var __webpack_exports__ = {};
|
|
|
8167
8730
|
windowsHide: true
|
|
8168
8731
|
}).on('error', ()=>{});
|
|
8169
8732
|
} catch {}
|
|
8170
|
-
if ('
|
|
8733
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementTerminating(browser));
|
|
8171
8734
|
child.kill('SIGTERM');
|
|
8172
8735
|
setTimeout(()=>{
|
|
8173
8736
|
if (child && !child.killed) {
|
|
8174
|
-
if ('
|
|
8737
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementForceKill(browser));
|
|
8175
8738
|
child.kill('SIGKILL');
|
|
8176
8739
|
}
|
|
8177
8740
|
}, 5000);
|
|
@@ -8585,7 +9148,7 @@ var __webpack_exports__ = {};
|
|
|
8585
9148
|
}
|
|
8586
9149
|
class CDPClient {
|
|
8587
9150
|
isDev() {
|
|
8588
|
-
return '
|
|
9151
|
+
return 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
8589
9152
|
}
|
|
8590
9153
|
async connect() {
|
|
8591
9154
|
return new Promise(async (resolve, reject)=>{
|
|
@@ -8842,7 +9405,7 @@ var __webpack_exports__ = {};
|
|
|
8842
9405
|
flatten: true
|
|
8843
9406
|
});
|
|
8844
9407
|
} catch (error) {
|
|
8845
|
-
if ('
|
|
9408
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(cdpAutoAttachSetupFailed(String((null == error ? void 0 : error.message) || error)));
|
|
8846
9409
|
}
|
|
8847
9410
|
return cdp;
|
|
8848
9411
|
}
|
|
@@ -8895,7 +9458,7 @@ var __webpack_exports__ = {};
|
|
|
8895
9458
|
}
|
|
8896
9459
|
}
|
|
8897
9460
|
} catch (error) {
|
|
8898
|
-
if ('
|
|
9461
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(cdpProtocolEventHandlerError(String((null == error ? void 0 : error.message) || error)));
|
|
8899
9462
|
}
|
|
8900
9463
|
});
|
|
8901
9464
|
}
|
|
@@ -8923,7 +9486,7 @@ var __webpack_exports__ = {};
|
|
|
8923
9486
|
flatten: true
|
|
8924
9487
|
});
|
|
8925
9488
|
} catch (error) {
|
|
8926
|
-
if ('
|
|
9489
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(cdpAutoAttachSetupFailed(String((null == error ? void 0 : error.message) || error)));
|
|
8927
9490
|
}
|
|
8928
9491
|
registerAutoEnableLogging(this.cdp, ()=>this.extensionId);
|
|
8929
9492
|
}
|
|
@@ -8976,7 +9539,7 @@ var __webpack_exports__ = {};
|
|
|
8976
9539
|
name = String((null == manifest ? void 0 : manifest.name) || '') || void 0;
|
|
8977
9540
|
version = String((null == manifest ? void 0 : manifest.version) || '') || void 0;
|
|
8978
9541
|
} catch (e2) {
|
|
8979
|
-
if ('
|
|
9542
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn('[CDP] Fallback manifest read failed:', String((null == e2 ? void 0 : e2.message) || e2));
|
|
8980
9543
|
}
|
|
8981
9544
|
}
|
|
8982
9545
|
return {
|
|
@@ -9064,7 +9627,7 @@ var __webpack_exports__ = {};
|
|
|
9064
9627
|
} catch {}
|
|
9065
9628
|
});
|
|
9066
9629
|
} catch (e) {
|
|
9067
|
-
if ('
|
|
9630
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn('[CDP] enableLogging failed:', String(e));
|
|
9068
9631
|
}
|
|
9069
9632
|
}
|
|
9070
9633
|
async getInfoBestEffort() {
|
|
@@ -9121,7 +9684,7 @@ var __webpack_exports__ = {};
|
|
|
9121
9684
|
const extensionOutputPath = getExtensionOutputPath(compilation, loadExtensionFlag);
|
|
9122
9685
|
const remoteDebugPortFlag = chromiumArgs.find((flag)=>flag.startsWith('--remote-debugging-port='));
|
|
9123
9686
|
const chromeRemoteDebugPort = remoteDebugPortFlag ? parseInt(remoteDebugPortFlag.split('=')[1], 10) : deriveDebugPortWithInstance(plugin.port, plugin.instanceId);
|
|
9124
|
-
if ('
|
|
9687
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
9125
9688
|
const userDataDirFlag = chromiumArgs.find((flag)=>flag.startsWith('--user-data-dir='));
|
|
9126
9689
|
if (userDataDirFlag) {
|
|
9127
9690
|
const userDataDir = userDataDirFlag.replace('--user-data-dir=', '').replace(/^"|"$/g, '');
|
|
@@ -9146,7 +9709,7 @@ var __webpack_exports__ = {};
|
|
|
9146
9709
|
throw lastError;
|
|
9147
9710
|
};
|
|
9148
9711
|
await retryAsync(()=>cdpExtensionController.connect());
|
|
9149
|
-
if ('
|
|
9712
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(cdpClientConnected('127.0.0.1', chromeRemoteDebugPort));
|
|
9150
9713
|
const extensionControllerInfo = await cdpExtensionController.ensureLoaded();
|
|
9151
9714
|
if ((null == compilation ? void 0 : null == (_compilation_options = compilation.options) ? void 0 : _compilation_options.mode) !== 'production') try {
|
|
9152
9715
|
const bannerPrinted = await printDevBannerOnce({
|
|
@@ -9168,7 +9731,7 @@ var __webpack_exports__ = {};
|
|
|
9168
9731
|
getInfo: async ()=>cdpExtensionController.getInfoBestEffort()
|
|
9169
9732
|
});
|
|
9170
9733
|
} catch (bannerErr) {
|
|
9171
|
-
if ('
|
|
9734
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(bestEffortBannerPrintFailed(String(bannerErr)));
|
|
9172
9735
|
}
|
|
9173
9736
|
plugin.cdpController = cdpExtensionController;
|
|
9174
9737
|
}
|
|
@@ -9484,7 +10047,7 @@ var __webpack_exports__ = {};
|
|
|
9484
10047
|
const freePort = await findAvailablePortNear(desiredPort);
|
|
9485
10048
|
const selectedPort = freePort;
|
|
9486
10049
|
if (freePort !== desiredPort) chromiumConfig = chromiumConfig.map((flag)=>flag.startsWith('--remote-debugging-port=') ? `--remote-debugging-port=${selectedPort}` : flag);
|
|
9487
|
-
if ('
|
|
10050
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.logger.info(devChromiumDebugPort(selectedPort, desiredPort));
|
|
9488
10051
|
setInstancePorts(this.options.instanceId, {
|
|
9489
10052
|
cdpPort: selectedPort
|
|
9490
10053
|
});
|
|
@@ -9521,7 +10084,7 @@ var __webpack_exports__ = {};
|
|
|
9521
10084
|
await setupCdpAfterLaunch(compilation, cdpConfig, chromiumConfig);
|
|
9522
10085
|
if (cdpConfig.cdpController) this.ctx.setController(cdpConfig.cdpController, selectedPort);
|
|
9523
10086
|
} catch (error) {
|
|
9524
|
-
if ('
|
|
10087
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn('[plugin-browsers] CDP post-launch setup failed:', String(error));
|
|
9525
10088
|
}
|
|
9526
10089
|
}
|
|
9527
10090
|
async launchWithDirectSpawn(binary, chromeFlags) {
|
|
@@ -9545,7 +10108,7 @@ var __webpack_exports__ = {};
|
|
|
9545
10108
|
});
|
|
9546
10109
|
null == (_this_logger_debug = (_this_logger = this.logger).debug) || _this_logger_debug.call(_this_logger, '[plugin-browsers] Final Chrome flags:', launchArgs.join(' '));
|
|
9547
10110
|
child.on('close', (code)=>{
|
|
9548
|
-
if ('
|
|
10111
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.logger.info(chromeProcessExited(code || 0));
|
|
9549
10112
|
});
|
|
9550
10113
|
child.on('error', (error)=>{
|
|
9551
10114
|
this.logger.error(chromeProcessError(error));
|
|
@@ -9585,6 +10148,15 @@ var __webpack_exports__ = {};
|
|
|
9585
10148
|
async function setupUnifiedLogging(controller, opts) {
|
|
9586
10149
|
const level = String(opts.level || '').toLowerCase();
|
|
9587
10150
|
if (!level || 'off' === level) return;
|
|
10151
|
+
const colorOn = (null == opts ? void 0 : opts.color) !== false;
|
|
10152
|
+
const c = {
|
|
10153
|
+
gray: (s)=>colorOn && external_pintor_default().gray ? external_pintor_default().gray(s) : s,
|
|
10154
|
+
red: (s)=>colorOn && external_pintor_default().red ? external_pintor_default().red(s) : s,
|
|
10155
|
+
yellow: (s)=>colorOn && external_pintor_default().brightYellow ? external_pintor_default().brightYellow(s) : s,
|
|
10156
|
+
cyan: (s)=>colorOn && external_pintor_default().cyan ? external_pintor_default().cyan(s) : s,
|
|
10157
|
+
magenta: (s)=>colorOn && external_pintor_default().magenta ? external_pintor_default().magenta(s) : s,
|
|
10158
|
+
white: (s)=>colorOn && external_pintor_default().white ? external_pintor_default().white(s) : s
|
|
10159
|
+
};
|
|
9588
10160
|
await controller.enableUnifiedLogging({
|
|
9589
10161
|
level: level,
|
|
9590
10162
|
contexts: opts.contexts,
|
|
@@ -9593,8 +10165,11 @@ var __webpack_exports__ = {};
|
|
|
9593
10165
|
});
|
|
9594
10166
|
const recentKeys = new Map();
|
|
9595
10167
|
const DEDUPE_MS = 1000;
|
|
9596
|
-
controller.onProtocolEvent
|
|
10168
|
+
const subscribe = controller.onProtocolEvent;
|
|
10169
|
+
if (!subscribe) return;
|
|
10170
|
+
subscribe((rawEvt)=>{
|
|
9597
10171
|
try {
|
|
10172
|
+
const evt = rawEvt;
|
|
9598
10173
|
const showTs = false !== opts.timestamps;
|
|
9599
10174
|
const method = null == evt ? void 0 : evt.method;
|
|
9600
10175
|
let level = 'info';
|
|
@@ -9645,18 +10220,18 @@ var __webpack_exports__ = {};
|
|
|
9645
10220
|
const up = String(lvl || 'log').toUpperCase();
|
|
9646
10221
|
switch(String(lvl || '').toLowerCase()){
|
|
9647
10222
|
case 'error':
|
|
9648
|
-
return
|
|
10223
|
+
return c.red(up);
|
|
9649
10224
|
case 'warn':
|
|
9650
|
-
return
|
|
10225
|
+
return c.yellow(up);
|
|
9651
10226
|
case 'info':
|
|
9652
|
-
return
|
|
10227
|
+
return c.cyan(up);
|
|
9653
10228
|
case 'debug':
|
|
9654
|
-
return
|
|
10229
|
+
return c.magenta(up);
|
|
9655
10230
|
case 'trace':
|
|
9656
|
-
return
|
|
10231
|
+
return c.white(up);
|
|
9657
10232
|
case 'log':
|
|
9658
10233
|
default:
|
|
9659
|
-
return
|
|
10234
|
+
return c.gray(up);
|
|
9660
10235
|
}
|
|
9661
10236
|
}
|
|
9662
10237
|
const where = url ? `${url}:${line}:${col}` : '';
|
|
@@ -9671,13 +10246,7 @@ var __webpack_exports__ = {};
|
|
|
9671
10246
|
for (const [k, t] of recentKeys)if (t < cutoff) recentKeys.delete(k);
|
|
9672
10247
|
}
|
|
9673
10248
|
const nowDate = new Date();
|
|
9674
|
-
const
|
|
9675
|
-
const hh = String(nowDate.getHours()).padStart(2, '0');
|
|
9676
|
-
const mm = String(nowDate.getMinutes()).padStart(2, '0');
|
|
9677
|
-
const ss = String(nowDate.getSeconds()).padStart(2, '0');
|
|
9678
|
-
const ms = String(nowDate.getMilliseconds()).padStart(3, '0');
|
|
9679
|
-
return `${hh}:${mm}:${ss}.${ms}`;
|
|
9680
|
-
})() : '';
|
|
10249
|
+
const tsIso = showTs ? `${nowDate.toISOString()} ` : '';
|
|
9681
10250
|
if ('pretty' !== String(opts.format || '').toLowerCase()) {
|
|
9682
10251
|
const event = {
|
|
9683
10252
|
timestamp: nowDate.toISOString(),
|
|
@@ -9696,10 +10265,11 @@ var __webpack_exports__ = {};
|
|
|
9696
10265
|
}
|
|
9697
10266
|
return;
|
|
9698
10267
|
}
|
|
9699
|
-
const
|
|
9700
|
-
const
|
|
9701
|
-
const
|
|
9702
|
-
|
|
10268
|
+
const ctx = c.gray(`[${context}]`);
|
|
10269
|
+
const lvl = fmtLevel(level);
|
|
10270
|
+
const whereStr = where ? ` ${c.gray(where)}` : '';
|
|
10271
|
+
const message = msg && msg.trim().length ? msg.trim() : '(none)';
|
|
10272
|
+
console.log(`${tsIso}${prefix} ${ctx} ${lvl}${whereStr} - ${message}`);
|
|
9703
10273
|
} catch {}
|
|
9704
10274
|
});
|
|
9705
10275
|
}
|
|
@@ -9836,7 +10406,7 @@ var __webpack_exports__ = {};
|
|
|
9836
10406
|
const fromRegistry = instanceId && (null == (_getInstancePorts = getInstancePorts(instanceId)) ? void 0 : _getInstancePorts.cdpPort) || getLastCDPPort();
|
|
9837
10407
|
if ('number' == typeof fromRegistry && fromRegistry > 0) port = fromRegistry;
|
|
9838
10408
|
} catch {}
|
|
9839
|
-
if ('
|
|
10409
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorWaitingForChrome());
|
|
9840
10410
|
let retries = 0;
|
|
9841
10411
|
const maxRetries = 60;
|
|
9842
10412
|
const backoffMs = 500;
|
|
@@ -9848,11 +10418,11 @@ var __webpack_exports__ = {};
|
|
|
9848
10418
|
} catch {}
|
|
9849
10419
|
const isDebuggingEnabled = await checkChromeRemoteDebugging(port);
|
|
9850
10420
|
if (isDebuggingEnabled) {
|
|
9851
|
-
if ('
|
|
10421
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(chromeRemoteDebuggingReady());
|
|
9852
10422
|
return;
|
|
9853
10423
|
}
|
|
9854
10424
|
retries++;
|
|
9855
|
-
if (retries % 10 === 0 && '
|
|
10425
|
+
if (retries % 10 === 0 && 'true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorChromeNotReadyYet(retries, maxRetries));
|
|
9856
10426
|
await new Promise((resolve)=>setTimeout(resolve, backoffMs));
|
|
9857
10427
|
}
|
|
9858
10428
|
throw new Error(sourceInspectorChromeDebuggingRequired(port));
|
|
@@ -9860,15 +10430,15 @@ var __webpack_exports__ = {};
|
|
|
9860
10430
|
async function ensureTargetAndSession(cdpClient, url) {
|
|
9861
10431
|
const targets = await cdpClient.getTargets();
|
|
9862
10432
|
const existingTarget = (targets || []).find((t)=>String((null == t ? void 0 : t.url) || '') === url && 'page' === String((null == t ? void 0 : t.type) || ''));
|
|
9863
|
-
let targetId;
|
|
10433
|
+
let targetId = '';
|
|
9864
10434
|
if (existingTarget && existingTarget.targetId) {
|
|
9865
|
-
if ('development' === process.env.EXTENSION_ENV) console.log(sourceInspectorUsingExistingTarget(existingTarget.targetId));
|
|
9866
10435
|
targetId = String(existingTarget.targetId);
|
|
10436
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorUsingExistingTarget(existingTarget.targetId));
|
|
9867
10437
|
} else {
|
|
9868
|
-
if ('
|
|
10438
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorCreatingTarget());
|
|
9869
10439
|
const created = await cdpClient.createTarget(url);
|
|
9870
10440
|
targetId = String(created);
|
|
9871
|
-
if ('
|
|
10441
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
9872
10442
|
console.log(sourceInspectorTargetCreated(targetId));
|
|
9873
10443
|
console.log(sourceInspectorEnsuringNavigation());
|
|
9874
10444
|
}
|
|
@@ -9880,9 +10450,9 @@ var __webpack_exports__ = {};
|
|
|
9880
10450
|
await cdpClient.navigate(String(tempSession), url);
|
|
9881
10451
|
}
|
|
9882
10452
|
}
|
|
9883
|
-
if ('
|
|
10453
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorAttachingToTarget());
|
|
9884
10454
|
const sessionId = String(await cdpClient.attachToTarget(targetId) || '');
|
|
9885
|
-
if ('
|
|
10455
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
9886
10456
|
console.log(sourceInspectorAttachedToTarget(sessionId));
|
|
9887
10457
|
console.log(sourceInspectorEnablingPageDomain());
|
|
9888
10458
|
}
|
|
@@ -9895,7 +10465,7 @@ var __webpack_exports__ = {};
|
|
|
9895
10465
|
sessionId: String(sessionId)
|
|
9896
10466
|
};
|
|
9897
10467
|
}
|
|
9898
|
-
async function extractPageHtml(cdpClient, sessionId, logSamples = '
|
|
10468
|
+
async function extractPageHtml(cdpClient, sessionId, logSamples = 'true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
9899
10469
|
let html = await cdpClient.getPageHTML(sessionId);
|
|
9900
10470
|
if (!html) try {
|
|
9901
10471
|
const targets = await cdpClient.getTargets();
|
|
@@ -9953,6 +10523,11 @@ var __webpack_exports__ = {};
|
|
|
9953
10523
|
return obj;
|
|
9954
10524
|
}
|
|
9955
10525
|
class ChromiumSourceInspectionPlugin {
|
|
10526
|
+
isAuthorMode() {
|
|
10527
|
+
const authorMode = 'true' === String(process.env.EXTENSION_AUTHOR_MODE || '').trim().toLowerCase();
|
|
10528
|
+
const isDevEnv = 'development' === String(process.env.EXTENSION_ENV || '').trim().toLowerCase();
|
|
10529
|
+
return authorMode || isDevEnv;
|
|
10530
|
+
}
|
|
9956
10531
|
async getCdpPort() {
|
|
9957
10532
|
const instanceId = this.devOptions.instanceId;
|
|
9958
10533
|
return deriveDebugPortWithInstance(this.devOptions.port, instanceId);
|
|
@@ -9964,30 +10539,30 @@ var __webpack_exports__ = {};
|
|
|
9964
10539
|
await waitForChromeRemoteDebugging(port, instanceId);
|
|
9965
10540
|
this.cdpClient = new CDPClient(port);
|
|
9966
10541
|
await this.cdpClient.connect();
|
|
9967
|
-
if (
|
|
10542
|
+
if (this.isAuthorMode()) console.log(sourceInspectorInitialized());
|
|
9968
10543
|
this.isInitialized = true;
|
|
9969
10544
|
} catch (error) {
|
|
9970
|
-
if (
|
|
10545
|
+
if (this.isAuthorMode()) console.error(sourceInspectorInitializationFailed(error.message));
|
|
9971
10546
|
throw error;
|
|
9972
10547
|
}
|
|
9973
10548
|
}
|
|
9974
10549
|
async inspectSource(url) {
|
|
9975
10550
|
if (!this.cdpClient) throw new Error(sourceInspectorNotInitialized());
|
|
9976
10551
|
try {
|
|
9977
|
-
if (
|
|
10552
|
+
if (this.isAuthorMode()) {
|
|
9978
10553
|
console.log(sourceInspectorOpeningUrl(url));
|
|
9979
10554
|
console.log(sourceInspectorFindingExistingTarget());
|
|
9980
10555
|
}
|
|
9981
10556
|
const { targetId, sessionId } = await ensureTargetAndSession(this.cdpClient, url);
|
|
9982
10557
|
this.currentTargetId = targetId;
|
|
9983
10558
|
this.currentSessionId = sessionId;
|
|
9984
|
-
if (
|
|
10559
|
+
if (this.isAuthorMode()) console.log(sourceInspectorWaitingForPageLoad());
|
|
9985
10560
|
await this.cdpClient.waitForLoadEvent(this.currentSessionId);
|
|
9986
10561
|
try {
|
|
9987
10562
|
const initialHtml = await extractPageHtml(this.cdpClient, this.currentSessionId);
|
|
9988
10563
|
this.printHTML(String(initialHtml || ''));
|
|
9989
10564
|
} catch {}
|
|
9990
|
-
if (
|
|
10565
|
+
if (this.isAuthorMode()) console.log(sourceInspectorWaitingForContentScripts());
|
|
9991
10566
|
await this.cdpClient.waitForContentScriptInjection(this.currentSessionId);
|
|
9992
10567
|
try {
|
|
9993
10568
|
const deadline = Date.now() + 20000;
|
|
@@ -10013,12 +10588,12 @@ var __webpack_exports__ = {};
|
|
|
10013
10588
|
const html = await extractPageHtml(this.cdpClient, this.currentSessionId);
|
|
10014
10589
|
return html;
|
|
10015
10590
|
} catch (error) {
|
|
10016
|
-
if (
|
|
10591
|
+
if (this.isAuthorMode()) console.error(sourceInspectorInspectionFailed(error.message));
|
|
10017
10592
|
throw error;
|
|
10018
10593
|
}
|
|
10019
10594
|
}
|
|
10020
10595
|
async startWatching(websocketServer) {
|
|
10021
|
-
if (
|
|
10596
|
+
if (!this.isAuthorMode()) return;
|
|
10022
10597
|
if (this.isWatching) return void console.log(sourceInspectorWatchModeActive());
|
|
10023
10598
|
this.isWatching = true;
|
|
10024
10599
|
console.log(sourceInspectorStartingWatchMode());
|
|
@@ -10026,7 +10601,7 @@ var __webpack_exports__ = {};
|
|
|
10026
10601
|
console.log(sourceInspectorCDPConnectionMaintained());
|
|
10027
10602
|
}
|
|
10028
10603
|
setupWebSocketHandler(websocketServer) {
|
|
10029
|
-
if (
|
|
10604
|
+
if (!this.isAuthorMode()) return;
|
|
10030
10605
|
if (!websocketServer || !websocketServer.clients) return void console.warn(sourceInspectorInvalidWebSocketServer());
|
|
10031
10606
|
websocketServer.clients.forEach((ws)=>{
|
|
10032
10607
|
this.setupConnectionHandler(ws);
|
|
@@ -10036,7 +10611,7 @@ var __webpack_exports__ = {};
|
|
|
10036
10611
|
});
|
|
10037
10612
|
}
|
|
10038
10613
|
setupConnectionHandler(ws) {
|
|
10039
|
-
if (
|
|
10614
|
+
if (!this.isAuthorMode()) return;
|
|
10040
10615
|
ws.on('message', async (data)=>{
|
|
10041
10616
|
try {
|
|
10042
10617
|
const message = JSON.parse(data);
|
|
@@ -10045,12 +10620,12 @@ var __webpack_exports__ = {};
|
|
|
10045
10620
|
});
|
|
10046
10621
|
}
|
|
10047
10622
|
stopWatching() {
|
|
10048
|
-
if (
|
|
10623
|
+
if (!this.isAuthorMode()) return;
|
|
10049
10624
|
this.isWatching = false;
|
|
10050
10625
|
console.log(sourceInspectorWatchModeStopped());
|
|
10051
10626
|
}
|
|
10052
10627
|
async handleFileChange() {
|
|
10053
|
-
if (
|
|
10628
|
+
if (!this.isAuthorMode()) return;
|
|
10054
10629
|
if (!this.cdpClient || !this.currentSessionId) return void console.warn(sourceInspectorNoActiveSession());
|
|
10055
10630
|
if (this.debounceTimer) clearTimeout(this.debounceTimer);
|
|
10056
10631
|
this.debounceTimer = setTimeout(async ()=>{
|
|
@@ -10085,7 +10660,7 @@ var __webpack_exports__ = {};
|
|
|
10085
10660
|
}, 300);
|
|
10086
10661
|
}
|
|
10087
10662
|
async reconnectToTarget() {
|
|
10088
|
-
if (
|
|
10663
|
+
if (!this.isAuthorMode()) return;
|
|
10089
10664
|
try {
|
|
10090
10665
|
if (!this.cdpClient || !this.currentTargetId) return void console.warn(sourceInspectorCannotReconnect());
|
|
10091
10666
|
console.log(sourceInspectorReconnectingToTarget());
|
|
@@ -10124,7 +10699,7 @@ var __webpack_exports__ = {};
|
|
|
10124
10699
|
console.log(sourceInspectorHTMLOutputFooter());
|
|
10125
10700
|
}
|
|
10126
10701
|
printUpdatedHTML(html) {
|
|
10127
|
-
if (
|
|
10702
|
+
if (!this.isAuthorMode()) return;
|
|
10128
10703
|
const raw = String(process.env.EXTENSION_SOURCE_RAW || '').trim();
|
|
10129
10704
|
const maxBytesStr = String(process.env.EXTENSION_SOURCE_MAX_BYTES || '').trim();
|
|
10130
10705
|
const maxBytes = /^\d+$/.test(maxBytesStr) ? Math.max(0, parseInt(maxBytesStr, 10)) : 262144;
|
|
@@ -10156,12 +10731,12 @@ var __webpack_exports__ = {};
|
|
|
10156
10731
|
}
|
|
10157
10732
|
async cleanup() {
|
|
10158
10733
|
try {
|
|
10159
|
-
if (
|
|
10734
|
+
if (this.isAuthorMode()) this.stopWatching();
|
|
10160
10735
|
if (this.cdpClient && this.currentTargetId) await this.cdpClient.closeTarget(this.currentTargetId);
|
|
10161
10736
|
if (this.cdpClient) this.cdpClient.disconnect();
|
|
10162
|
-
if (
|
|
10737
|
+
if (this.isAuthorMode()) console.log(sourceInspectorCleanupComplete());
|
|
10163
10738
|
} catch (error) {
|
|
10164
|
-
if (
|
|
10739
|
+
if (this.isAuthorMode()) console.error(sourceInspectorCleanupError(error.message));
|
|
10165
10740
|
}
|
|
10166
10741
|
}
|
|
10167
10742
|
apply(compiler) {
|
|
@@ -10176,13 +10751,13 @@ var __webpack_exports__ = {};
|
|
|
10176
10751
|
const html = await this.inspectSource(urlToInspect);
|
|
10177
10752
|
this.printHTML(html);
|
|
10178
10753
|
const webSocketServer = compiler.options.webSocketServer;
|
|
10179
|
-
if (this.devOptions.watchSource &&
|
|
10754
|
+
if (this.devOptions.watchSource && this.isAuthorMode()) if (webSocketServer) await this.startWatching(webSocketServer);
|
|
10180
10755
|
else try {
|
|
10181
10756
|
const updated = await this.cdpClient.getPageHTML(this.currentSessionId);
|
|
10182
10757
|
this.printUpdatedHTML(updated || '');
|
|
10183
10758
|
} catch {}
|
|
10184
10759
|
} catch (error) {
|
|
10185
|
-
if ('
|
|
10760
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.error(sourceInspectorSetupFailed(error.message));
|
|
10186
10761
|
}
|
|
10187
10762
|
});
|
|
10188
10763
|
}
|
|
@@ -10319,7 +10894,7 @@ var __webpack_exports__ = {};
|
|
|
10319
10894
|
if (isCleaningUp) return;
|
|
10320
10895
|
isCleaningUp = true;
|
|
10321
10896
|
try {
|
|
10322
|
-
if ('
|
|
10897
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementCleanup(browser));
|
|
10323
10898
|
const child = childRef();
|
|
10324
10899
|
if (child && !child.killed) {
|
|
10325
10900
|
if ('win32' === process.platform) try {
|
|
@@ -10333,11 +10908,11 @@ var __webpack_exports__ = {};
|
|
|
10333
10908
|
windowsHide: true
|
|
10334
10909
|
}).on('error', ()=>{});
|
|
10335
10910
|
} catch {}
|
|
10336
|
-
if ('
|
|
10911
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementTerminating(browser));
|
|
10337
10912
|
child.kill('SIGTERM');
|
|
10338
10913
|
setTimeout(()=>{
|
|
10339
10914
|
if (child && !child.killed) {
|
|
10340
|
-
if ('
|
|
10915
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementForceKill(browser));
|
|
10341
10916
|
child.kill('SIGKILL');
|
|
10342
10917
|
}
|
|
10343
10918
|
}, 5000);
|
|
@@ -10427,7 +11002,7 @@ var __webpack_exports__ = {};
|
|
|
10427
11002
|
host: '127.0.0.1',
|
|
10428
11003
|
port
|
|
10429
11004
|
}, ()=>{
|
|
10430
|
-
if ('
|
|
11005
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(firefoxRdpClientConnected('127.0.0.1', port));
|
|
10431
11006
|
resolve();
|
|
10432
11007
|
});
|
|
10433
11008
|
this.conn = c;
|
|
@@ -11764,7 +12339,7 @@ var __webpack_exports__ = {};
|
|
|
11764
12339
|
null == (_this_ctx_logger = this.ctx.logger) || null == (_this_ctx_logger_info = _this_ctx_logger.info) || _this_ctx_logger_info.call(_this_ctx_logger, skippingBrowserLaunchDueToCompileErrors());
|
|
11765
12340
|
return;
|
|
11766
12341
|
}
|
|
11767
|
-
if ('
|
|
12342
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
11768
12343
|
var _this_ctx_logger_info1, _this_ctx_logger1;
|
|
11769
12344
|
null == (_this_ctx_logger1 = this.ctx.logger) || null == (_this_ctx_logger_info1 = _this_ctx_logger1.info) || _this_ctx_logger_info1.call(_this_ctx_logger1, firefoxLaunchCalled());
|
|
11770
12345
|
}
|
|
@@ -11848,11 +12423,11 @@ var __webpack_exports__ = {};
|
|
|
11848
12423
|
const binaryArgsMatch = firefoxCfg.match(/--binary-args="([^"]*)"/);
|
|
11849
12424
|
if (binaryArgsMatch) {
|
|
11850
12425
|
firefoxArgs.push(...binaryArgsMatch[1].split(' '));
|
|
11851
|
-
if ('
|
|
12426
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
11852
12427
|
var _this_ctx_logger_info2, _this_ctx_logger2;
|
|
11853
12428
|
null == (_this_ctx_logger2 = this.ctx.logger) || null == (_this_ctx_logger_info2 = _this_ctx_logger2.info) || _this_ctx_logger_info2.call(_this_ctx_logger2, firefoxBinaryArgsExtracted(binaryArgsMatch[1]));
|
|
11854
12429
|
}
|
|
11855
|
-
} else if ('
|
|
12430
|
+
} else if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
11856
12431
|
var _this_ctx_logger_info3, _this_ctx_logger3;
|
|
11857
12432
|
null == (_this_ctx_logger3 = this.ctx.logger) || null == (_this_ctx_logger_info3 = _this_ctx_logger3.info) || _this_ctx_logger_info3.call(_this_ctx_logger3, firefoxNoBinaryArgsFound());
|
|
11858
12433
|
}
|
|
@@ -11881,7 +12456,7 @@ var __webpack_exports__ = {};
|
|
|
11881
12456
|
this.host.rdpController = ctrl;
|
|
11882
12457
|
this.ctx.setController(ctrl, debugPort);
|
|
11883
12458
|
try {
|
|
11884
|
-
if ('
|
|
12459
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE && this.host.instanceId && profileMatch) {
|
|
11885
12460
|
var _this_ctx_logger_info4, _this_ctx_logger4, _this_ctx_logger_info5, _this_ctx_logger5;
|
|
11886
12461
|
null == (_this_ctx_logger4 = this.ctx.logger) || null == (_this_ctx_logger_info4 = _this_ctx_logger4.info) || _this_ctx_logger_info4.call(_this_ctx_logger4, devFirefoxDebugPort(debugPort, desiredDebugPort));
|
|
11887
12462
|
null == (_this_ctx_logger5 = this.ctx.logger) || null == (_this_ctx_logger_info5 = _this_ctx_logger5.info) || _this_ctx_logger_info5.call(_this_ctx_logger5, devFirefoxProfilePath(profileMatch[1]));
|
|
@@ -11925,7 +12500,7 @@ var __webpack_exports__ = {};
|
|
|
11925
12500
|
process.exit(1);
|
|
11926
12501
|
});
|
|
11927
12502
|
child.on('close', (_code)=>{
|
|
11928
|
-
if ('
|
|
12503
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
11929
12504
|
var _this_ctx_logger_info, _this_ctx_logger;
|
|
11930
12505
|
null == (_this_ctx_logger = this.ctx.logger) || null == (_this_ctx_logger_info = _this_ctx_logger.info) || _this_ctx_logger_info.call(_this_ctx_logger, browserInstanceExited(this.host.browser));
|
|
11931
12506
|
}
|
|
@@ -11933,7 +12508,7 @@ var __webpack_exports__ = {};
|
|
|
11933
12508
|
process.exit();
|
|
11934
12509
|
});
|
|
11935
12510
|
});
|
|
11936
|
-
if ('
|
|
12511
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE && child) {
|
|
11937
12512
|
var _child_stdout, _child_stderr;
|
|
11938
12513
|
null == (_child_stdout = child.stdout) || _child_stdout.pipe(process.stdout);
|
|
11939
12514
|
null == (_child_stderr = child.stderr) || _child_stderr.pipe(process.stderr);
|
|
@@ -11999,7 +12574,7 @@ var __webpack_exports__ = {};
|
|
|
11999
12574
|
color: (null == (_this_options6 = this.options) ? void 0 : _this_options6.logColor) !== false
|
|
12000
12575
|
});
|
|
12001
12576
|
} catch (error) {
|
|
12002
|
-
if ('
|
|
12577
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12003
12578
|
var _this_ctx_logger_warn, _this_ctx_logger;
|
|
12004
12579
|
null == (_this_ctx_logger = this.ctx.logger) || null == (_this_ctx_logger_warn = _this_ctx_logger.warn) || _this_ctx_logger_warn.call(_this_ctx_logger, firefoxUnifiedLoggingFailed(String(error)));
|
|
12005
12580
|
}
|
|
@@ -12082,7 +12657,7 @@ var __webpack_exports__ = {};
|
|
|
12082
12657
|
await new Promise((resolve)=>setTimeout(resolve, 300));
|
|
12083
12658
|
continue;
|
|
12084
12659
|
} catch (error) {
|
|
12085
|
-
if ('
|
|
12660
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12086
12661
|
const msg = (null == error ? void 0 : error.message) || String(error);
|
|
12087
12662
|
console.warn(rdpAddTabFailed(msg));
|
|
12088
12663
|
}
|
|
@@ -12106,7 +12681,7 @@ var __webpack_exports__ = {};
|
|
|
12106
12681
|
if (detail.consoleActor) consoleActor = detail.consoleActor;
|
|
12107
12682
|
if (detail.targetActor) frameActor = detail.targetActor;
|
|
12108
12683
|
} catch (error) {
|
|
12109
|
-
if ('
|
|
12684
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12110
12685
|
const err = error;
|
|
12111
12686
|
console.warn("[RDP] getTargetFromDescriptor failed:", String(err.message || err));
|
|
12112
12687
|
}
|
|
@@ -12114,7 +12689,7 @@ var __webpack_exports__ = {};
|
|
|
12114
12689
|
try {
|
|
12115
12690
|
await client.attach(frameActor);
|
|
12116
12691
|
} catch (error) {
|
|
12117
|
-
if ('
|
|
12692
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12118
12693
|
const err = error;
|
|
12119
12694
|
console.warn('[RDP] attach(frameActor) failed:', String(err.message || err));
|
|
12120
12695
|
}
|
|
@@ -12124,7 +12699,7 @@ var __webpack_exports__ = {};
|
|
|
12124
12699
|
await client.waitForPageReady(consoleActor, urlToInspect, PAGE_READY_TIMEOUT_MS);
|
|
12125
12700
|
return;
|
|
12126
12701
|
} catch (error) {
|
|
12127
|
-
if ('
|
|
12702
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12128
12703
|
const err = error;
|
|
12129
12704
|
console.warn('[RDP] navigateViaScript/waitForPageReady failed:', String(err.message || err));
|
|
12130
12705
|
}
|
|
@@ -12135,7 +12710,7 @@ var __webpack_exports__ = {};
|
|
|
12135
12710
|
try {
|
|
12136
12711
|
await client.attach(targetActor);
|
|
12137
12712
|
} catch (error) {
|
|
12138
|
-
if ('
|
|
12713
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12139
12714
|
const err = error;
|
|
12140
12715
|
console.warn('[RDP] attach(targetActor) failed:', String(err.message || err));
|
|
12141
12716
|
}
|
|
@@ -12143,7 +12718,7 @@ var __webpack_exports__ = {};
|
|
|
12143
12718
|
await client.navigate(targetActor, urlToInspect);
|
|
12144
12719
|
await client.waitForLoadEvent(targetActor);
|
|
12145
12720
|
} catch (error) {
|
|
12146
|
-
if ('
|
|
12721
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12147
12722
|
const err = error;
|
|
12148
12723
|
console.warn('[RDP] fallback navigate/waitForLoadEvent failed:', String(err.message || err));
|
|
12149
12724
|
}
|
|
@@ -12187,13 +12762,13 @@ var __webpack_exports__ = {};
|
|
|
12187
12762
|
if (this.initialized) return;
|
|
12188
12763
|
const client = new MessagingClient();
|
|
12189
12764
|
const port = await this.getRdpPort();
|
|
12190
|
-
if ('
|
|
12765
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorWaitingForFirefox());
|
|
12191
12766
|
let retries = 0;
|
|
12192
12767
|
while(retries < MAX_CONNECT_RETRIES)try {
|
|
12193
12768
|
await client.connect(port);
|
|
12194
12769
|
this.client = client;
|
|
12195
12770
|
this.initialized = true;
|
|
12196
|
-
if ('
|
|
12771
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12197
12772
|
console.log(firefoxRemoteDebuggingReady());
|
|
12198
12773
|
console.log(sourceInspectorInitialized());
|
|
12199
12774
|
}
|
|
@@ -12201,7 +12776,7 @@ var __webpack_exports__ = {};
|
|
|
12201
12776
|
} catch (err) {
|
|
12202
12777
|
retries++;
|
|
12203
12778
|
if (retries % 10 === 0) {
|
|
12204
|
-
if ('
|
|
12779
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorFirefoxNotReadyYet(retries, MAX_CONNECT_RETRIES));
|
|
12205
12780
|
}
|
|
12206
12781
|
await wait(CONNECT_RETRY_INTERVAL_MS);
|
|
12207
12782
|
}
|
|
@@ -12227,7 +12802,7 @@ var __webpack_exports__ = {};
|
|
|
12227
12802
|
const href = await this.client.evaluate(consoleActor, 'String(location.href)');
|
|
12228
12803
|
if ('string' != typeof href || !href.startsWith(urlToInspect)) await this.client.navigateViaScript(consoleActor, urlToInspect);
|
|
12229
12804
|
} catch (error) {
|
|
12230
|
-
if ('
|
|
12805
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12231
12806
|
const err = error;
|
|
12232
12807
|
console.warn('[RDP] ensureUrlAndReady evaluate/navigateViaScript failed:', String(err.message || err));
|
|
12233
12808
|
}
|
|
@@ -12317,7 +12892,7 @@ var __webpack_exports__ = {};
|
|
|
12317
12892
|
if (!this.initialized) await this.initialize();
|
|
12318
12893
|
const urlToInspect = this.resolveUrlToInspect();
|
|
12319
12894
|
this.lastUrlToInspect = urlToInspect;
|
|
12320
|
-
if ('
|
|
12895
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorWillInspect(urlToInspect));
|
|
12321
12896
|
const { tabActor, consoleActor } = await this.selectActors(urlToInspect);
|
|
12322
12897
|
this.currentTabActor = tabActor;
|
|
12323
12898
|
await this.ensureNavigatedAndLoaded(urlToInspect, tabActor);
|
|
@@ -12332,7 +12907,7 @@ var __webpack_exports__ = {};
|
|
|
12332
12907
|
await this.handleFileChange();
|
|
12333
12908
|
}
|
|
12334
12909
|
} catch (error) {
|
|
12335
|
-
if ('
|
|
12910
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.error(sourceInspectorSetupFailed(error.message));
|
|
12336
12911
|
}
|
|
12337
12912
|
done();
|
|
12338
12913
|
});
|
|
@@ -12399,6 +12974,7 @@ var __webpack_exports__ = {};
|
|
|
12399
12974
|
run_firefox_define_property(this, "logTab", void 0);
|
|
12400
12975
|
run_firefox_define_property(this, "logger", void 0);
|
|
12401
12976
|
run_firefox_define_property(this, "firefoxCtx", void 0);
|
|
12977
|
+
run_firefox_define_property(this, "rdpController", void 0);
|
|
12402
12978
|
this.extension = options.extension;
|
|
12403
12979
|
this.browser = options.browser;
|
|
12404
12980
|
this.startingUrl = options.startingUrl;
|
|
@@ -12434,9 +13010,13 @@ var __webpack_exports__ = {};
|
|
|
12434
13010
|
}
|
|
12435
13011
|
class BrowsersPlugin {
|
|
12436
13012
|
apply(compiler) {
|
|
12437
|
-
if ('chrome' === this.browser || 'edge' === this.browser || 'chromium' === this.browser || 'chromium-based' === this.browser)
|
|
12438
|
-
|
|
12439
|
-
|
|
13013
|
+
if ('chrome' === this.browser || 'edge' === this.browser || 'chromium' === this.browser || 'chromium-based' === this.browser) {
|
|
13014
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(usingChromiumRunner(this.browser));
|
|
13015
|
+
new RunChromiumPlugin(this).apply(compiler);
|
|
13016
|
+
} else if ('firefox' === this.browser || 'gecko-based' === this.browser || 'firefox-based' === this.browser) {
|
|
13017
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(usingFirefoxRunner(this.browser));
|
|
13018
|
+
new RunFirefoxPlugin(this).apply(compiler);
|
|
13019
|
+
} else {
|
|
12440
13020
|
try {
|
|
12441
13021
|
console.error(unsupportedBrowser(String(this.browser)));
|
|
12442
13022
|
} catch {}
|
|
@@ -12497,7 +13077,7 @@ var __webpack_exports__ = {};
|
|
|
12497
13077
|
console.error(requireGeckoBinaryForGeckoBased());
|
|
12498
13078
|
process.exit(1);
|
|
12499
13079
|
}
|
|
12500
|
-
if (false === this.profile && '
|
|
13080
|
+
if (false === this.profile && 'true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(profileFallbackWarning(this.browser, 'system profile in use (profile: false)'));
|
|
12501
13081
|
}
|
|
12502
13082
|
}
|
|
12503
13083
|
plugin_browsers_define_property(BrowsersPlugin, "name", 'plugin-browsers');
|
|
@@ -12507,7 +13087,7 @@ var __webpack_exports__ = {};
|
|
|
12507
13087
|
const manifest = filterKeysForThisBrowser(JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8')), devOptions.browser);
|
|
12508
13088
|
const userExtensionOutputPath = asAbsolute(external_path_.isAbsolute(devOptions.output.path) ? devOptions.output.path : external_path_.resolve(packageJsonDir, devOptions.output.path));
|
|
12509
13089
|
const extensionsToLoad = computeExtensionsToLoad(__dirname, devOptions.mode, devOptions.browser, userExtensionOutputPath);
|
|
12510
|
-
const debug = '
|
|
13090
|
+
const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
12511
13091
|
if (debug) {
|
|
12512
13092
|
console.log(webpack_lib_messages.Ry(devOptions.browser, devOptions.chromiumBinary, devOptions.geckoBinary));
|
|
12513
13093
|
console.log(webpack_lib_messages.ZE(packageJsonDir));
|
|
@@ -12700,7 +13280,7 @@ var __webpack_exports__ = {};
|
|
|
12700
13280
|
const browser = normalizeBrowser((null == buildOptions ? void 0 : buildOptions.browser) || 'chrome', null == buildOptions ? void 0 : buildOptions.chromiumBinary, (null == buildOptions ? void 0 : buildOptions.geckoBinary) || (null == buildOptions ? void 0 : buildOptions.firefoxBinary));
|
|
12701
13281
|
try {
|
|
12702
13282
|
var _baseConfig_plugins;
|
|
12703
|
-
const debug = '
|
|
13283
|
+
const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
12704
13284
|
const { manifestDir, packageJsonDir } = getDirs(projectStructure);
|
|
12705
13285
|
if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, manifestDir);
|
|
12706
13286
|
const commandConfig = await loadCommandConfig(manifestDir, 'build');
|
|
@@ -12806,7 +13386,7 @@ var __webpack_exports__ = {};
|
|
|
12806
13386
|
return `Extension.js Runner Error:\n${external_pintor_default().red(String(error))}`;
|
|
12807
13387
|
}
|
|
12808
13388
|
function autoExitModeEnabled(ms) {
|
|
12809
|
-
return `Auto-exit
|
|
13389
|
+
return `Auto-exit enabled. Will exit after ${external_pintor_default().brightBlue(ms.toString())} ms if idle.`;
|
|
12810
13390
|
}
|
|
12811
13391
|
function autoExitTriggered(ms) {
|
|
12812
13392
|
return `Auto-exit triggered after ${external_pintor_default().brightBlue(ms.toString())} ms. Cleaning up...`;
|
|
@@ -13207,7 +13787,7 @@ var __webpack_exports__ = {};
|
|
|
13207
13787
|
async function extensionDev(pathOrRemoteUrl, devOptions) {
|
|
13208
13788
|
const projectStructure = await getProjectStructure(pathOrRemoteUrl);
|
|
13209
13789
|
try {
|
|
13210
|
-
const debug = '
|
|
13790
|
+
const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
13211
13791
|
const { manifestDir, packageJsonDir } = getDirs(projectStructure);
|
|
13212
13792
|
if (isUsingTypeScript(manifestDir)) await generateExtensionTypes(manifestDir, packageJsonDir);
|
|
13213
13793
|
if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, manifestDir);
|
|
@@ -13236,7 +13816,7 @@ var __webpack_exports__ = {};
|
|
|
13236
13816
|
}
|
|
13237
13817
|
async function extensionPreview(pathOrRemoteUrl, previewOptions) {
|
|
13238
13818
|
const projectStructure = await getProjectStructure(pathOrRemoteUrl);
|
|
13239
|
-
const debug = '
|
|
13819
|
+
const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
13240
13820
|
if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, external_path_.dirname(projectStructure.manifestPath));
|
|
13241
13821
|
const { manifestDir, packageJsonDir } = getDirs(projectStructure);
|
|
13242
13822
|
const browser = normalizeBrowser(previewOptions.browser || 'chrome', previewOptions.chromiumBinary, previewOptions.geckoBinary || previewOptions.firefoxBinary);
|
|
@@ -13338,14 +13918,14 @@ var __webpack_exports__ = {};
|
|
|
13338
13918
|
}
|
|
13339
13919
|
});
|
|
13340
13920
|
} catch (error) {
|
|
13341
|
-
if ('
|
|
13921
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.error(error);
|
|
13342
13922
|
process.exit(1);
|
|
13343
13923
|
}
|
|
13344
13924
|
}
|
|
13345
13925
|
async function extensionStart(pathOrRemoteUrl, startOptions) {
|
|
13346
13926
|
const projectStructure = await getProjectStructure(pathOrRemoteUrl);
|
|
13347
13927
|
try {
|
|
13348
|
-
const debug = '
|
|
13928
|
+
const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
13349
13929
|
const browser = normalizeBrowser(startOptions.browser || 'chrome', startOptions.chromiumBinary, startOptions.geckoBinary || startOptions.firefoxBinary);
|
|
13350
13930
|
const { manifestDir, packageJsonDir } = getDirs(projectStructure);
|
|
13351
13931
|
const commandConfig = await loadCommandConfig(manifestDir, 'start');
|
|
@@ -13372,7 +13952,7 @@ var __webpack_exports__ = {};
|
|
|
13372
13952
|
outputPath: distPath
|
|
13373
13953
|
});
|
|
13374
13954
|
} catch (error) {
|
|
13375
|
-
if ('
|
|
13955
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.error(error);
|
|
13376
13956
|
process.exit(1);
|
|
13377
13957
|
}
|
|
13378
13958
|
}
|