extension-develop 3.0.0-next.7 → 3.0.0-next.9
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 +853 -254
- 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.8","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
|
}
|
|
@@ -4799,6 +5138,7 @@ var __webpack_exports__ = {};
|
|
|
4799
5138
|
}
|
|
4800
5139
|
const external_webpack_target_webextension_namespaceObject = require("webpack-target-webextension");
|
|
4801
5140
|
var external_webpack_target_webextension_default = /*#__PURE__*/ __webpack_require__.n(external_webpack_target_webextension_namespaceObject);
|
|
5141
|
+
const external_node_module_namespaceObject = require("node:module");
|
|
4802
5142
|
function manifest_getManifestContent(compilation, manifestPath) {
|
|
4803
5143
|
var _compilation_getAsset, _compilation_assets;
|
|
4804
5144
|
if ((null == (_compilation_getAsset = compilation.getAsset) ? void 0 : _compilation_getAsset.call(compilation, 'manifest.json')) || (null == (_compilation_assets = compilation.assets) ? void 0 : _compilation_assets['manifest.json'])) {
|
|
@@ -5159,6 +5499,15 @@ var __webpack_exports__ = {};
|
|
|
5159
5499
|
else obj[key] = value;
|
|
5160
5500
|
return obj;
|
|
5161
5501
|
}
|
|
5502
|
+
const requireForEsm = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
5503
|
+
function tryLoadWebExtensionFork() {
|
|
5504
|
+
try {
|
|
5505
|
+
const mod = requireForEsm('./webpack-target-webextension-fork');
|
|
5506
|
+
return mod && (mod.default || mod);
|
|
5507
|
+
} catch {
|
|
5508
|
+
return null;
|
|
5509
|
+
}
|
|
5510
|
+
}
|
|
5162
5511
|
class SetupReloadStrategy {
|
|
5163
5512
|
getEntryName(manifest) {
|
|
5164
5513
|
if (manifest.background) {
|
|
@@ -5195,6 +5544,16 @@ var __webpack_exports__ = {};
|
|
|
5195
5544
|
manifestPath: this.manifestPath,
|
|
5196
5545
|
browser: this.browser
|
|
5197
5546
|
}).apply(compiler);
|
|
5547
|
+
const wantFork = 'true' === process.env.EXTENSION_EXPERIMENTAL_HMR;
|
|
5548
|
+
if (wantFork) {
|
|
5549
|
+
const Fork = tryLoadWebExtensionFork();
|
|
5550
|
+
const PluginCtor = Fork || external_webpack_target_webextension_default();
|
|
5551
|
+
new PluginCtor({
|
|
5552
|
+
background: this.getEntryName(patchedManifest),
|
|
5553
|
+
weakRuntimeCheck: true
|
|
5554
|
+
}).apply(compiler);
|
|
5555
|
+
return;
|
|
5556
|
+
}
|
|
5198
5557
|
new (external_webpack_target_webextension_default())({
|
|
5199
5558
|
background: this.getEntryName(patchedManifest),
|
|
5200
5559
|
weakRuntimeCheck: true
|
|
@@ -5358,6 +5717,7 @@ var __webpack_exports__ = {};
|
|
|
5358
5717
|
}, ()=>{
|
|
5359
5718
|
var _this_pending;
|
|
5360
5719
|
if (!(null == (_this_pending = this.pending) ? void 0 : _this_pending.hasChange)) return;
|
|
5720
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(scriptsManifestChangeDetected(this.pending.pathBefore, this.pending.pathAfter));
|
|
5361
5721
|
const lines = [];
|
|
5362
5722
|
lines.push("Entrypoint references changed in scripts. Restart the dev server to pick up changes to manifest script entrypoints.");
|
|
5363
5723
|
lines.push('');
|
|
@@ -5393,6 +5753,10 @@ var __webpack_exports__ = {};
|
|
|
5393
5753
|
apply(compiler) {
|
|
5394
5754
|
const hasValidManifest = !!this.manifestPath && external_fs_.existsSync(this.manifestPath) && external_fs_.lstatSync(this.manifestPath).isFile();
|
|
5395
5755
|
if (!hasValidManifest) return;
|
|
5756
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
5757
|
+
const featuresCount = Object.keys(this.includeList || {}).length;
|
|
5758
|
+
console.log(scriptsIncludeSummary(featuresCount, 'production' !== compiler.options.mode, String(this.browser || 'chrome')));
|
|
5759
|
+
}
|
|
5396
5760
|
new AddScripts({
|
|
5397
5761
|
manifestPath: this.manifestPath,
|
|
5398
5762
|
includeList: this.includeList || {}
|
|
@@ -5453,6 +5817,19 @@ var __webpack_exports__ = {};
|
|
|
5453
5817
|
const final = `MISSING KEY ${key} in ${localePath}`;
|
|
5454
5818
|
return `${header}\n${guidance}\n\n${final}`;
|
|
5455
5819
|
}
|
|
5820
|
+
function localesIncludeSummary(hasManifest, hasLocalesRoot, defaultLocale) {
|
|
5821
|
+
const dl = defaultLocale ? `default_locale=${defaultLocale}` : 'default_locale=<none>';
|
|
5822
|
+
return `Locales include summary \u{2014} manifest=${String(hasManifest)}, localesRoot=${String(hasLocalesRoot)}, ${dl}`;
|
|
5823
|
+
}
|
|
5824
|
+
function localesEmitSummary(emitted, missing, discovered) {
|
|
5825
|
+
return `Locales emitted=${String(emitted)}, missing=${String(missing)}, discovered=${String(discovered)}`;
|
|
5826
|
+
}
|
|
5827
|
+
function localesDepsTracked(addedCount) {
|
|
5828
|
+
return `Locales file dependencies tracked: ${String(addedCount)}`;
|
|
5829
|
+
}
|
|
5830
|
+
function localesValidationDetected(issue) {
|
|
5831
|
+
return `Locales validation detected: ${issue}`;
|
|
5832
|
+
}
|
|
5456
5833
|
function getLocales(manifestPath) {
|
|
5457
5834
|
const localesFolder = external_path_.join(external_path_.dirname(manifestPath), '_locales');
|
|
5458
5835
|
const localeFiles = [];
|
|
@@ -5505,16 +5882,30 @@ var __webpack_exports__ = {};
|
|
|
5505
5882
|
const defaultLocale = null == manifest ? void 0 : manifest.default_locale;
|
|
5506
5883
|
const localesRoot = external_path_.join(manifestDir, '_locales');
|
|
5507
5884
|
const hasLocalesRoot = external_fs_.existsSync(localesRoot);
|
|
5885
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesIncludeSummary(true, hasLocalesRoot, 'string' == typeof defaultLocale ? defaultLocale : void 0));
|
|
5508
5886
|
if ('string' == typeof defaultLocale && defaultLocale.trim()) {
|
|
5509
|
-
if (!hasLocalesRoot)
|
|
5887
|
+
if (!hasLocalesRoot) {
|
|
5888
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected('default_locale set but _locales missing'));
|
|
5889
|
+
pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleSpecifiedButLocalesMissing(), 'manifest.json');
|
|
5890
|
+
return;
|
|
5891
|
+
}
|
|
5510
5892
|
const defaultLocaleDir = external_path_.join(localesRoot, defaultLocale);
|
|
5511
|
-
if (!external_fs_.existsSync(defaultLocaleDir))
|
|
5893
|
+
if (!external_fs_.existsSync(defaultLocaleDir)) {
|
|
5894
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing _locales/${defaultLocale}`));
|
|
5895
|
+
pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleFolderMissing(defaultLocale), 'manifest.json');
|
|
5896
|
+
return;
|
|
5897
|
+
}
|
|
5512
5898
|
const messagesJsonPath = external_path_.join(defaultLocaleDir, 'messages.json');
|
|
5513
|
-
if (!external_fs_.existsSync(messagesJsonPath))
|
|
5899
|
+
if (!external_fs_.existsSync(messagesJsonPath)) {
|
|
5900
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing _locales/${defaultLocale}/messages.json`));
|
|
5901
|
+
pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleMessagesMissing(defaultLocale), 'manifest.json');
|
|
5902
|
+
return;
|
|
5903
|
+
}
|
|
5514
5904
|
try {
|
|
5515
5905
|
const content = external_fs_.readFileSync(messagesJsonPath, 'utf8');
|
|
5516
5906
|
JSON.parse(content);
|
|
5517
5907
|
} catch (e) {
|
|
5908
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`invalid JSON in _locales/${defaultLocale}/messages.json`));
|
|
5518
5909
|
pushCompilationError(compiler, compilation, 'LocalesValidationError', invalidMessagesJson(messagesJsonPath), 'manifest.json');
|
|
5519
5910
|
return;
|
|
5520
5911
|
}
|
|
@@ -5536,10 +5927,18 @@ var __webpack_exports__ = {};
|
|
|
5536
5927
|
collectMsgKeys(manifest, referenced);
|
|
5537
5928
|
for (const key of referenced){
|
|
5538
5929
|
const entry = null == dict ? void 0 : dict[key];
|
|
5539
|
-
if (!entry || 'string' != typeof entry.message)
|
|
5930
|
+
if (!entry || 'string' != typeof entry.message) {
|
|
5931
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing key "${key}" in default locale`));
|
|
5932
|
+
pushCompilationError(compiler, compilation, 'LocalesValidationError', missingManifestMessageKey(key, defaultLocale), 'manifest.json');
|
|
5933
|
+
return;
|
|
5934
|
+
}
|
|
5540
5935
|
}
|
|
5541
5936
|
} catch {}
|
|
5542
|
-
} else if (hasLocalesRoot)
|
|
5937
|
+
} else if (hasLocalesRoot) {
|
|
5938
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected('_locales present but no default_locale'));
|
|
5939
|
+
pushCompilationError(compiler, compilation, 'LocalesValidationError', localesPresentButNoDefaultLocale(), 'manifest.json');
|
|
5940
|
+
return;
|
|
5941
|
+
}
|
|
5543
5942
|
} catch {}
|
|
5544
5943
|
if (compilation.errors.length > 0) return;
|
|
5545
5944
|
try {
|
|
@@ -5553,6 +5952,7 @@ var __webpack_exports__ = {};
|
|
|
5553
5952
|
const s = external_fs_.readFileSync(msgPath, 'utf8');
|
|
5554
5953
|
JSON.parse(s);
|
|
5555
5954
|
} catch {
|
|
5955
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`invalid JSON in ${msgPath}`));
|
|
5556
5956
|
pushCompilationError(compiler, compilation, 'LocalesValidationError', invalidMessagesJson(msgPath), 'manifest.json');
|
|
5557
5957
|
return;
|
|
5558
5958
|
}
|
|
@@ -5560,6 +5960,9 @@ var __webpack_exports__ = {};
|
|
|
5560
5960
|
}
|
|
5561
5961
|
} catch {}
|
|
5562
5962
|
const localesFields = getLocales(this.manifestPath);
|
|
5963
|
+
const discoveredList = getLocales(this.manifestPath) || [];
|
|
5964
|
+
let emittedCount = 0;
|
|
5965
|
+
let missingCount = 0;
|
|
5563
5966
|
for (const field of Object.entries(localesFields || [])){
|
|
5564
5967
|
const [feature, resource] = field;
|
|
5565
5968
|
const thisResource = resource;
|
|
@@ -5573,6 +5976,7 @@ var __webpack_exports__ = {};
|
|
|
5573
5976
|
warning.name = 'LocalesPluginMissingFile';
|
|
5574
5977
|
if (!compilation.warnings) compilation.warnings = [];
|
|
5575
5978
|
compilation.warnings.push(warning);
|
|
5979
|
+
missingCount++;
|
|
5576
5980
|
continue;
|
|
5577
5981
|
}
|
|
5578
5982
|
const source = external_fs_.readFileSync(thisResource);
|
|
@@ -5583,8 +5987,10 @@ var __webpack_exports__ = {};
|
|
|
5583
5987
|
const normalizedRel = relativeToLocales.split(external_path_.sep).join('/');
|
|
5584
5988
|
const filename = `_locales/${normalizedRel}`;
|
|
5585
5989
|
compilation.emitAsset(filename, rawSource);
|
|
5990
|
+
emittedCount++;
|
|
5586
5991
|
}
|
|
5587
5992
|
}
|
|
5993
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesEmitSummary(emittedCount, missingCount, discoveredList.length));
|
|
5588
5994
|
});
|
|
5589
5995
|
});
|
|
5590
5996
|
compiler.hooks.thisCompilation.tap('locales:module', (compilation)=>{
|
|
@@ -5595,6 +6001,7 @@ var __webpack_exports__ = {};
|
|
|
5595
6001
|
var _compilation_errors;
|
|
5596
6002
|
if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
|
|
5597
6003
|
const localesFields = getLocales(this.manifestPath);
|
|
6004
|
+
let added = 0;
|
|
5598
6005
|
for (const field of Object.entries(localesFields || [])){
|
|
5599
6006
|
const [, resource] = field;
|
|
5600
6007
|
if (resource) {
|
|
@@ -5604,10 +6011,12 @@ var __webpack_exports__ = {};
|
|
|
5604
6011
|
if (!fileDependencies.has(thisResource)) {
|
|
5605
6012
|
fileDependencies.add(thisResource);
|
|
5606
6013
|
compilation.fileDependencies.add(thisResource);
|
|
6014
|
+
added++;
|
|
5607
6015
|
}
|
|
5608
6016
|
}
|
|
5609
6017
|
}
|
|
5610
6018
|
}
|
|
6019
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesDepsTracked(added));
|
|
5611
6020
|
});
|
|
5612
6021
|
});
|
|
5613
6022
|
}
|
|
@@ -5655,7 +6064,23 @@ var __webpack_exports__ = {};
|
|
|
5655
6064
|
`${external_pintor_default().red('INVALID SHAPE')} ${external_pintor_default().underline(file)}`
|
|
5656
6065
|
].join('\n');
|
|
5657
6066
|
}
|
|
5658
|
-
|
|
6067
|
+
function jsonEmitSummary(feature, stats) {
|
|
6068
|
+
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))}`;
|
|
6069
|
+
}
|
|
6070
|
+
function jsonDepsTracked(addedCount) {
|
|
6071
|
+
return `JSON file dependencies tracked: ${external_pintor_default().gray(String(addedCount))}`;
|
|
6072
|
+
}
|
|
6073
|
+
function jsonIncludeSummary(totalFeatures, criticalCount) {
|
|
6074
|
+
return `JSON include summary \u{2014} features ${external_pintor_default().gray(String(totalFeatures))}, critical ${external_pintor_default().gray(String(criticalCount))}`;
|
|
6075
|
+
}
|
|
6076
|
+
function jsonManifestChangeDetected(field, before, after) {
|
|
6077
|
+
const parts = [
|
|
6078
|
+
`Manifest JSON change detected in ${external_pintor_default().yellow(field)}`,
|
|
6079
|
+
before ? `${external_pintor_default().gray('before')} ${external_pintor_default().underline(before)}` : '',
|
|
6080
|
+
after ? `${external_pintor_default().gray('after')} ${external_pintor_default().underline(after)}` : ''
|
|
6081
|
+
].filter(Boolean);
|
|
6082
|
+
return parts.join(" \u2014 ");
|
|
6083
|
+
}
|
|
5659
6084
|
function throw_if_manifest_json_change_define_property(obj, key, value) {
|
|
5660
6085
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
5661
6086
|
value: value,
|
|
@@ -5750,6 +6175,7 @@ var __webpack_exports__ = {};
|
|
|
5750
6175
|
}, ()=>{
|
|
5751
6176
|
var _this_pending;
|
|
5752
6177
|
if (!(null == (_this_pending = this.pending) ? void 0 : _this_pending.hasChange)) return;
|
|
6178
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(jsonManifestChangeDetected(String(this.pending.manifestField || 'json'), this.pending.pathBefore, this.pending.pathAfter));
|
|
5753
6179
|
const issue = new core_namespaceObject.WebpackError(buildRestartMessage(this.pending.manifestField, this.pending.pathAfter, this.pending.pathBefore));
|
|
5754
6180
|
issue.file = 'manifest.json';
|
|
5755
6181
|
compilation.errors.push(issue);
|
|
@@ -5827,8 +6253,18 @@ var __webpack_exports__ = {};
|
|
|
5827
6253
|
const manifestDir = external_path_.dirname(this.manifestPath);
|
|
5828
6254
|
const projectPath = (null == (_compiler_options = compiler.options) ? void 0 : _compiler_options.context) || external_path_.dirname(this.manifestPath);
|
|
5829
6255
|
const publicDir = external_path_.join(projectPath, 'public');
|
|
6256
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
6257
|
+
const featureKeys = Object.keys(jsonFields || {});
|
|
6258
|
+
const criticalCount = featureKeys.filter((k)=>this.isCriticalJsonFeature(k)).length;
|
|
6259
|
+
console.log(jsonIncludeSummary(featureKeys.length, criticalCount));
|
|
6260
|
+
}
|
|
5830
6261
|
for (const field of Object.entries(jsonFields)){
|
|
5831
6262
|
const [feature, resource] = field;
|
|
6263
|
+
let emittedCount = 0;
|
|
6264
|
+
let underPublicCount = 0;
|
|
6265
|
+
let missingCount = 0;
|
|
6266
|
+
let validatedOk = 0;
|
|
6267
|
+
let invalid = 0;
|
|
5832
6268
|
const resourceArr = Array.isArray(resource) ? resource : [
|
|
5833
6269
|
resource
|
|
5834
6270
|
];
|
|
@@ -5849,24 +6285,45 @@ var __webpack_exports__ = {};
|
|
|
5849
6285
|
notFound.file = 'manifest.json';
|
|
5850
6286
|
if (this.isCriticalJsonFeature(feature)) compilation.errors.push(notFound);
|
|
5851
6287
|
else compilation.warnings.push(notFound);
|
|
6288
|
+
missingCount++;
|
|
5852
6289
|
continue;
|
|
5853
6290
|
}
|
|
5854
6291
|
if (isUnderPublic) {
|
|
5855
6292
|
try {
|
|
5856
6293
|
compilation.fileDependencies.add(abs);
|
|
5857
6294
|
} catch {}
|
|
5858
|
-
if (this.isCriticalJsonFeature(feature))
|
|
6295
|
+
if (this.isCriticalJsonFeature(feature)) {
|
|
6296
|
+
const ok = this.validateJsonAsset(compilation, feature, abs, external_fs_.readFileSync(abs));
|
|
6297
|
+
if (ok) validatedOk++;
|
|
6298
|
+
else invalid++;
|
|
6299
|
+
if (!ok) continue;
|
|
6300
|
+
}
|
|
6301
|
+
underPublicCount++;
|
|
5859
6302
|
continue;
|
|
5860
6303
|
}
|
|
5861
6304
|
const source = external_fs_.readFileSync(abs);
|
|
5862
6305
|
if (this.isCriticalJsonFeature(feature)) {
|
|
5863
6306
|
const ok = this.validateJsonAsset(compilation, feature, abs, source);
|
|
6307
|
+
if (ok) validatedOk++;
|
|
6308
|
+
else invalid++;
|
|
5864
6309
|
if (!ok) continue;
|
|
5865
6310
|
}
|
|
5866
6311
|
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
5867
6312
|
const assetName = feature + '.json';
|
|
5868
6313
|
if ('function' == typeof compilation.getAsset && compilation.getAsset(assetName)) compilation.updateAsset(assetName, rawSource);
|
|
5869
6314
|
else compilation.emitAsset(assetName, rawSource);
|
|
6315
|
+
emittedCount++;
|
|
6316
|
+
}
|
|
6317
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
6318
|
+
const entries = Array.isArray(resource) ? resource.length : resource ? 1 : 0;
|
|
6319
|
+
console.log(jsonEmitSummary(feature, {
|
|
6320
|
+
entries,
|
|
6321
|
+
underPublic: underPublicCount,
|
|
6322
|
+
emitted: emittedCount,
|
|
6323
|
+
missing: missingCount,
|
|
6324
|
+
validatedOk,
|
|
6325
|
+
invalid
|
|
6326
|
+
}));
|
|
5870
6327
|
}
|
|
5871
6328
|
}
|
|
5872
6329
|
});
|
|
@@ -5880,6 +6337,7 @@ var __webpack_exports__ = {};
|
|
|
5880
6337
|
if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
|
|
5881
6338
|
const jsonFields = this.includeList || {};
|
|
5882
6339
|
const manifestDir = external_path_.dirname(this.manifestPath);
|
|
6340
|
+
let added = 0;
|
|
5883
6341
|
for (const field of Object.entries(jsonFields)){
|
|
5884
6342
|
const [, resource] = field;
|
|
5885
6343
|
const resourceArr = Array.isArray(resource) ? resource : [
|
|
@@ -5892,10 +6350,12 @@ var __webpack_exports__ = {};
|
|
|
5892
6350
|
if (!fileDependencies.has(abs)) {
|
|
5893
6351
|
fileDependencies.add(abs);
|
|
5894
6352
|
compilation.fileDependencies.add(abs);
|
|
6353
|
+
added++;
|
|
5895
6354
|
}
|
|
5896
6355
|
}
|
|
5897
6356
|
}
|
|
5898
6357
|
}
|
|
6358
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(jsonDepsTracked(added));
|
|
5899
6359
|
});
|
|
5900
6360
|
});
|
|
5901
6361
|
}
|
|
@@ -5927,6 +6387,23 @@ var __webpack_exports__ = {};
|
|
|
5927
6387
|
if (pathAfter) lines.push(`${external_pintor_default().green('PATH AFTER')} ${external_pintor_default().underline(pathAfter)}`);
|
|
5928
6388
|
return lines.join('\n');
|
|
5929
6389
|
}
|
|
6390
|
+
function iconsEmitSummary(feature, stats) {
|
|
6391
|
+
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))}`;
|
|
6392
|
+
}
|
|
6393
|
+
function iconsDepsTracked(addedCount) {
|
|
6394
|
+
return `Icons file dependencies tracked: ${external_pintor_default().gray(String(addedCount))}`;
|
|
6395
|
+
}
|
|
6396
|
+
function iconsNormalizationSummary(beforeKeys, afterKeys, changedCount) {
|
|
6397
|
+
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))}`;
|
|
6398
|
+
}
|
|
6399
|
+
function iconsManifestChangeDetected(field, before, after) {
|
|
6400
|
+
const parts = [
|
|
6401
|
+
`Manifest icons change detected in ${external_pintor_default().yellow(field)}`,
|
|
6402
|
+
before ? `${external_pintor_default().gray('before')} ${external_pintor_default().underline(before)}` : '',
|
|
6403
|
+
after ? `${external_pintor_default().gray('after')} ${external_pintor_default().underline(after)}` : ''
|
|
6404
|
+
].filter(Boolean);
|
|
6405
|
+
return parts.join(" \u2014 ");
|
|
6406
|
+
}
|
|
5930
6407
|
function emit_file_define_property(obj, key, value) {
|
|
5931
6408
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
5932
6409
|
value: value,
|
|
@@ -5980,6 +6457,10 @@ var __webpack_exports__ = {};
|
|
|
5980
6457
|
return [];
|
|
5981
6458
|
};
|
|
5982
6459
|
const stringEntries = normalizeToStrings(resource);
|
|
6460
|
+
let emittedCount = 0;
|
|
6461
|
+
let underPublicCount = 0;
|
|
6462
|
+
let missingCount = 0;
|
|
6463
|
+
const entriesTotal = stringEntries.length;
|
|
5983
6464
|
for (const entry of stringEntries)if (entry) {
|
|
5984
6465
|
const manifestDir = external_path_.dirname(this.manifestPath);
|
|
5985
6466
|
let resolved = entry;
|
|
@@ -6002,12 +6483,14 @@ var __webpack_exports__ = {};
|
|
|
6002
6483
|
type: severity,
|
|
6003
6484
|
file: 'manifest.json'
|
|
6004
6485
|
});
|
|
6486
|
+
missingCount++;
|
|
6005
6487
|
continue;
|
|
6006
6488
|
}
|
|
6007
6489
|
if (isUnderPublic) {
|
|
6008
6490
|
try {
|
|
6009
6491
|
compilation.fileDependencies.add(resolved);
|
|
6010
6492
|
} catch {}
|
|
6493
|
+
underPublicCount++;
|
|
6011
6494
|
continue;
|
|
6012
6495
|
}
|
|
6013
6496
|
const source = external_fs_.readFileSync(resolved);
|
|
@@ -6021,7 +6504,14 @@ var __webpack_exports__ = {};
|
|
|
6021
6504
|
else if ('browser_action' === group && 'theme_icons' === sub) outputDir = 'browser_action';
|
|
6022
6505
|
const filename = `${outputDir}/${basename}`;
|
|
6023
6506
|
compilation.emitAsset(filename, rawSource);
|
|
6507
|
+
emittedCount++;
|
|
6024
6508
|
}
|
|
6509
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(iconsEmitSummary(feature, {
|
|
6510
|
+
entries: entriesTotal,
|
|
6511
|
+
underPublic: underPublicCount,
|
|
6512
|
+
emitted: emittedCount,
|
|
6513
|
+
missing: missingCount
|
|
6514
|
+
}));
|
|
6025
6515
|
}
|
|
6026
6516
|
});
|
|
6027
6517
|
});
|
|
@@ -6053,6 +6543,7 @@ var __webpack_exports__ = {};
|
|
|
6053
6543
|
var _compilation_errors;
|
|
6054
6544
|
if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
|
|
6055
6545
|
const iconFields = this.includeList || {};
|
|
6546
|
+
let added = 0;
|
|
6056
6547
|
for (const field of Object.entries(iconFields)){
|
|
6057
6548
|
const [, resource] = field;
|
|
6058
6549
|
const normalizeToStrings = (response)=>{
|
|
@@ -6080,10 +6571,12 @@ var __webpack_exports__ = {};
|
|
|
6080
6571
|
if (!fileDependencies.has(entry)) {
|
|
6081
6572
|
fileDependencies.add(entry);
|
|
6082
6573
|
compilation.fileDependencies.add(entry);
|
|
6574
|
+
added++;
|
|
6083
6575
|
}
|
|
6084
6576
|
}
|
|
6085
6577
|
}
|
|
6086
6578
|
}
|
|
6579
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(iconsDepsTracked(added));
|
|
6087
6580
|
});
|
|
6088
6581
|
});
|
|
6089
6582
|
}
|
|
@@ -6171,6 +6664,7 @@ var __webpack_exports__ = {};
|
|
|
6171
6664
|
}, ()=>{
|
|
6172
6665
|
var _this_pending;
|
|
6173
6666
|
if (!(null == (_this_pending = this.pending) ? void 0 : _this_pending.hasChange)) return;
|
|
6667
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(iconsManifestChangeDetected(String(this.pending.manifestField || 'icons'), this.pending.pathBefore, this.pending.pathAfter));
|
|
6174
6668
|
const body = manifestIconsEntrypointChange(this.pending.manifestField, this.pending.pathAfter, this.pending.pathBefore);
|
|
6175
6669
|
const issue = new core_namespaceObject.WebpackError(body);
|
|
6176
6670
|
issue.file = 'manifest.json';
|
|
@@ -6210,6 +6704,12 @@ var __webpack_exports__ = {};
|
|
|
6210
6704
|
return out;
|
|
6211
6705
|
};
|
|
6212
6706
|
const normalizedIncludeList = normalizeIconIncludeKeys(this.includeList);
|
|
6707
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
6708
|
+
const beforeKeys = Object.keys(this.includeList || {});
|
|
6709
|
+
const afterKeys = Object.keys(normalizedIncludeList || {});
|
|
6710
|
+
const changedCount = afterKeys.filter((k)=>k.includes('/default_icon') || k.includes('/theme_icons')).length;
|
|
6711
|
+
console.log(iconsNormalizationSummary(beforeKeys, afterKeys, changedCount));
|
|
6712
|
+
}
|
|
6213
6713
|
new EmitFile({
|
|
6214
6714
|
manifestPath: this.manifestPath,
|
|
6215
6715
|
includeList: normalizedIncludeList
|
|
@@ -6357,34 +6857,6 @@ var __webpack_exports__ = {};
|
|
|
6357
6857
|
}
|
|
6358
6858
|
return shared;
|
|
6359
6859
|
}
|
|
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
6860
|
function warFieldError(filePath, opts) {
|
|
6389
6861
|
const displayPath = (null == opts ? void 0 : opts.overrideNotFoundPath) || filePath;
|
|
6390
6862
|
const lines = [];
|
|
@@ -6413,6 +6885,48 @@ var __webpack_exports__ = {};
|
|
|
6413
6885
|
lines.push(`${external_pintor_default().red('INVALID MATCH PATTERN')} ${external_pintor_default().underline(pattern)}`);
|
|
6414
6886
|
return lines.join('\n');
|
|
6415
6887
|
}
|
|
6888
|
+
function entryImportsSummary(entryCount, totalResources) {
|
|
6889
|
+
return `Web resources: content entry imports \u{2014} entries=${String(entryCount)}, resources=${String(totalResources)}`;
|
|
6890
|
+
}
|
|
6891
|
+
function warPatchedSummary(v3Groups, v3ResourcesTotal, v2Resources) {
|
|
6892
|
+
return `Web resources: WAR patched \u{2014} v3Groups=${String(v3Groups)}, v3Resources=${String(v3ResourcesTotal)}, v2Resources=${String(v2Resources)}`;
|
|
6893
|
+
}
|
|
6894
|
+
function collect_content_entry_imports_define_property(obj, key, value) {
|
|
6895
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
6896
|
+
value: value,
|
|
6897
|
+
enumerable: true,
|
|
6898
|
+
configurable: true,
|
|
6899
|
+
writable: true
|
|
6900
|
+
});
|
|
6901
|
+
else obj[key] = value;
|
|
6902
|
+
return obj;
|
|
6903
|
+
}
|
|
6904
|
+
class CollectContentEntryImports {
|
|
6905
|
+
apply(compiler) {
|
|
6906
|
+
compiler.hooks.thisCompilation.tap('plugin-extension:feature-web-resources:collect-entry-imports', (compilation)=>{
|
|
6907
|
+
compilation.hooks.processAssets.tap({
|
|
6908
|
+
name: 'plugin-extension:feature-web-resources:collect-entry-imports',
|
|
6909
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
6910
|
+
}, ()=>{
|
|
6911
|
+
const entryImports = collectContentScriptEntryImports(compilation, this.includeList);
|
|
6912
|
+
const shared = getSharedFor(compilation);
|
|
6913
|
+
shared.entryImports = entryImports;
|
|
6914
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
6915
|
+
const keys = Object.keys(entryImports || {});
|
|
6916
|
+
const total = keys.reduce((acc, k)=>{
|
|
6917
|
+
var _entryImports_k;
|
|
6918
|
+
return acc + ((null == (_entryImports_k = entryImports[k]) ? void 0 : _entryImports_k.length) || 0);
|
|
6919
|
+
}, 0);
|
|
6920
|
+
console.log(entryImportsSummary(keys.length, total));
|
|
6921
|
+
}
|
|
6922
|
+
});
|
|
6923
|
+
});
|
|
6924
|
+
}
|
|
6925
|
+
constructor(options){
|
|
6926
|
+
collect_content_entry_imports_define_property(this, "includeList", void 0);
|
|
6927
|
+
this.includeList = options.includeList;
|
|
6928
|
+
}
|
|
6929
|
+
}
|
|
6416
6930
|
function isPublicRootLike(possiblePath) {
|
|
6417
6931
|
const normalizedPath = paths_unixify(possiblePath || '');
|
|
6418
6932
|
return normalizedPath.startsWith('/') || /^(?:\.\/)?public\//i.test(normalizedPath) || /^\/public\//i.test(normalizedPath);
|
|
@@ -6766,6 +7280,15 @@ var __webpack_exports__ = {};
|
|
|
6766
7280
|
} else if (webAccessibleResourcesV2.length > 0) manifest.web_accessible_resources = Array.from(new Set(webAccessibleResourcesV2)).sort();
|
|
6767
7281
|
const source = JSON.stringify(manifest, null, 2);
|
|
6768
7282
|
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
7283
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
|
|
7284
|
+
const v3Groups = 3 === manifest.manifest_version ? webAccessibleResourcesV3.length : 0;
|
|
7285
|
+
const v3ResourcesTotal = 3 === manifest.manifest_version ? webAccessibleResourcesV3.reduce((sum, g)=>{
|
|
7286
|
+
var _g_resources;
|
|
7287
|
+
return sum + ((null == (_g_resources = g.resources) ? void 0 : _g_resources.length) || 0);
|
|
7288
|
+
}, 0) : 0;
|
|
7289
|
+
const v2Resources = 2 === manifest.manifest_version ? webAccessibleResourcesV2.length : 0;
|
|
7290
|
+
console.log(warPatchedSummary(v3Groups, v3ResourcesTotal, v2Resources));
|
|
7291
|
+
} catch {}
|
|
6769
7292
|
if (compilation.getAsset('manifest.json')) compilation.updateAsset('manifest.json', rawSource);
|
|
6770
7293
|
}
|
|
6771
7294
|
function patch_manifest_war_define_property(obj, key, value) {
|
|
@@ -6834,6 +7357,12 @@ var __webpack_exports__ = {};
|
|
|
6834
7357
|
function serverRestartRequiredFromSpecialFolderMessageOnly(addingOrRemoving, folder, typeOfAsset) {
|
|
6835
7358
|
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
7359
|
}
|
|
7360
|
+
function specialFoldersSetupSummary(hasPublic, copyEnabled, ignoredCount) {
|
|
7361
|
+
return `Special folders setup \u{2014} public=${String(hasPublic)}, copy=${String(copyEnabled)}, ignored=${String(ignoredCount)}`;
|
|
7362
|
+
}
|
|
7363
|
+
function specialFolderChangeDetected(action, folder, relativePath) {
|
|
7364
|
+
return `Special folders change \u{2014} ${action} in ${folder}/: ${relativePath}`;
|
|
7365
|
+
}
|
|
6837
7366
|
class WarnUponFolderChanges {
|
|
6838
7367
|
throwCompilationError(compilation, folder, filePath, isAddition) {
|
|
6839
7368
|
var _compilation_errors;
|
|
@@ -6871,24 +7400,36 @@ var __webpack_exports__ = {};
|
|
|
6871
7400
|
pagesWatcher.on('add', (filePath)=>{
|
|
6872
7401
|
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6873
7402
|
const isHtml = '.html' === ext;
|
|
6874
|
-
if (isHtml)
|
|
7403
|
+
if (isHtml) {
|
|
7404
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('add', 'pages', external_path_.relative(projectPath, filePath)));
|
|
7405
|
+
this.throwCompilationError(compilation, 'pages', filePath, true);
|
|
7406
|
+
}
|
|
6875
7407
|
});
|
|
6876
7408
|
pagesWatcher.on('unlink', (filePath)=>{
|
|
6877
7409
|
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6878
7410
|
const isHtml = '.html' === ext;
|
|
6879
|
-
if (isHtml)
|
|
7411
|
+
if (isHtml) {
|
|
7412
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('remove', 'pages', external_path_.relative(projectPath, filePath)));
|
|
7413
|
+
this.throwCompilationError(compilation, 'pages', filePath);
|
|
7414
|
+
}
|
|
6880
7415
|
});
|
|
6881
7416
|
scriptsWatcher.on('add', (filePath)=>{
|
|
6882
7417
|
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6883
7418
|
const supported = new Set((extensionsSupported || []).map((e)=>e.toLowerCase()));
|
|
6884
7419
|
const isScript = supported.has(ext);
|
|
6885
|
-
if (isScript)
|
|
7420
|
+
if (isScript) {
|
|
7421
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('add', "scripts", external_path_.relative(projectPath, filePath)));
|
|
7422
|
+
this.throwCompilationError(compilation, "scripts", filePath, true);
|
|
7423
|
+
}
|
|
6886
7424
|
});
|
|
6887
7425
|
scriptsWatcher.on('unlink', (filePath)=>{
|
|
6888
7426
|
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6889
7427
|
const supported = new Set((extensionsSupported || []).map((e)=>e.toLowerCase()));
|
|
6890
7428
|
const isScript = supported.has(ext);
|
|
6891
|
-
if (isScript)
|
|
7429
|
+
if (isScript) {
|
|
7430
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('remove', "scripts", external_path_.relative(projectPath, filePath)));
|
|
7431
|
+
this.throwCompilationError(compilation, "scripts", filePath);
|
|
7432
|
+
}
|
|
6892
7433
|
});
|
|
6893
7434
|
compiler.hooks.watchClose.tap('WarnUponFolderChanges', ()=>{
|
|
6894
7435
|
pagesWatcher.close().catch(()=>{});
|
|
@@ -6944,6 +7485,7 @@ var __webpack_exports__ = {};
|
|
|
6944
7485
|
}
|
|
6945
7486
|
]
|
|
6946
7487
|
}).apply(compiler);
|
|
7488
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFoldersSetupSummary(true, true, 1));
|
|
6947
7489
|
}
|
|
6948
7490
|
if ('development' === compiler.options.mode) {
|
|
6949
7491
|
if (compiler.options.watchOptions) new WarnUponFolderChanges().apply(compiler);
|
|
@@ -7036,6 +7578,23 @@ var __webpack_exports__ = {};
|
|
|
7036
7578
|
function webextensionPolyfillNotFound() {
|
|
7037
7579
|
return `Warning: webextension-polyfill not found. Browser API polyfill will not be available.\nTo fix this, install webextension-polyfill: npm install webextension-polyfill`;
|
|
7038
7580
|
}
|
|
7581
|
+
function capitalizedBrowserName(browser) {
|
|
7582
|
+
const b = String(browser || '');
|
|
7583
|
+
const cap = b.charAt(0).toUpperCase() + b.slice(1);
|
|
7584
|
+
return external_pintor_default().yellow(`${cap}`);
|
|
7585
|
+
}
|
|
7586
|
+
function compatibilityPolyfillEnabled(browser, polyfillPath) {
|
|
7587
|
+
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)}`;
|
|
7588
|
+
}
|
|
7589
|
+
function compatibilityPolyfillSkipped(reason, browser) {
|
|
7590
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Compatibility: Polyfill ${external_pintor_default().gray('skipped')} for ${capitalizedBrowserName(browser)} (${external_pintor_default().gray(reason)})`;
|
|
7591
|
+
}
|
|
7592
|
+
function compatibilityPolyfillDisabled(browser) {
|
|
7593
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Compatibility: Polyfill ${external_pintor_default().gray('disabled')} for ${capitalizedBrowserName(browser)}`;
|
|
7594
|
+
}
|
|
7595
|
+
function compatibilityManifestFilteredKeys(browser, filteredCount) {
|
|
7596
|
+
return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Compatibility: Filtered ${external_pintor_default().gray(String(filteredCount))} manifest key(s) for ${capitalizedBrowserName(browser)}`;
|
|
7597
|
+
}
|
|
7039
7598
|
function feature_polyfill_define_property(obj, key, value) {
|
|
7040
7599
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
7041
7600
|
value: value,
|
|
@@ -7066,6 +7625,7 @@ var __webpack_exports__ = {};
|
|
|
7066
7625
|
new (core_default()).ProvidePlugin({
|
|
7067
7626
|
browser: 'webextension-polyfill'
|
|
7068
7627
|
}).apply(compiler);
|
|
7628
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityPolyfillEnabled(this.browser, polyfillPath));
|
|
7069
7629
|
} catch (error) {
|
|
7070
7630
|
console.warn(webextensionPolyfillNotFound());
|
|
7071
7631
|
}
|
|
@@ -7131,6 +7691,16 @@ var __webpack_exports__ = {};
|
|
|
7131
7691
|
else obj[key] = value;
|
|
7132
7692
|
return obj;
|
|
7133
7693
|
}
|
|
7694
|
+
function countBrowserPrefixedKeys(obj) {
|
|
7695
|
+
if (!obj || 'object' != typeof obj) return 0;
|
|
7696
|
+
if (Array.isArray(obj)) return obj.reduce((sum, v)=>sum + countBrowserPrefixedKeys(v), 0);
|
|
7697
|
+
let total = 0;
|
|
7698
|
+
for (const key of Object.keys(obj)){
|
|
7699
|
+
if (key.includes(':')) total++;
|
|
7700
|
+
total += countBrowserPrefixedKeys(obj[key]);
|
|
7701
|
+
}
|
|
7702
|
+
return total;
|
|
7703
|
+
}
|
|
7134
7704
|
class BrowserSpecificFieldsPlugin {
|
|
7135
7705
|
patchManifest(manifest) {
|
|
7136
7706
|
const patchedManifest = compatibility_lib_manifest_filterKeysForThisBrowser(manifest, this.browser);
|
|
@@ -7143,9 +7713,11 @@ var __webpack_exports__ = {};
|
|
|
7143
7713
|
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
|
|
7144
7714
|
}, ()=>{
|
|
7145
7715
|
const manifest = compatibility_lib_manifest_getManifestContent(compilation, this.manifestPath);
|
|
7716
|
+
const filteredCount = countBrowserPrefixedKeys(manifest);
|
|
7146
7717
|
const patchedSource = this.patchManifest(manifest);
|
|
7147
7718
|
const rawSource = new core_namespaceObject.sources.RawSource(patchedSource);
|
|
7148
7719
|
compilation.updateAsset('manifest.json', rawSource);
|
|
7720
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityManifestFilteredKeys(this.browser, filteredCount));
|
|
7149
7721
|
});
|
|
7150
7722
|
});
|
|
7151
7723
|
}
|
|
@@ -7169,11 +7741,14 @@ var __webpack_exports__ = {};
|
|
|
7169
7741
|
class CompatibilityPlugin {
|
|
7170
7742
|
async apply(compiler) {
|
|
7171
7743
|
if (this.polyfill) {
|
|
7172
|
-
if ('firefox' !== this.browser)
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7744
|
+
if ('firefox' !== this.browser) {
|
|
7745
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityPolyfillEnabled(this.browser, 'webextension-polyfill'));
|
|
7746
|
+
new PolyfillPlugin({
|
|
7747
|
+
manifestPath: this.manifestPath,
|
|
7748
|
+
browser: this.browser || 'chrome'
|
|
7749
|
+
}).apply(compiler);
|
|
7750
|
+
} else if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityPolyfillSkipped('Firefox bundles browser.* APIs', this.browser));
|
|
7751
|
+
} else if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityPolyfillDisabled(this.browser));
|
|
7177
7752
|
new BrowserSpecificFieldsPlugin({
|
|
7178
7753
|
manifestPath: this.manifestPath,
|
|
7179
7754
|
browser: this.browser || 'chrome'
|
|
@@ -7228,6 +7803,7 @@ var __webpack_exports__ = {};
|
|
|
7228
7803
|
};
|
|
7229
7804
|
}
|
|
7230
7805
|
function messages_getLoggingPrefix(type) {
|
|
7806
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) return external_pintor_default().brightMagenta('error' === type ? 'ERROR' : "\u25BA\u25BA\u25BA");
|
|
7231
7807
|
if ('error' === type) return external_pintor_default().red('ERROR');
|
|
7232
7808
|
if ('warn' === type) return external_pintor_default().brightYellow("\u25BA\u25BA\u25BA");
|
|
7233
7809
|
if ('info' === type) return external_pintor_default().gray("\u25BA\u25BA\u25BA");
|
|
@@ -7238,18 +7814,18 @@ var __webpack_exports__ = {};
|
|
|
7238
7814
|
const maybe = null == error ? void 0 : error.message;
|
|
7239
7815
|
return String(maybe || error);
|
|
7240
7816
|
}
|
|
7241
|
-
function
|
|
7817
|
+
function messages_capitalizedBrowserName(browser) {
|
|
7242
7818
|
return external_pintor_default().yellow(`${browser.charAt(0).toUpperCase() + browser.slice(1)}`);
|
|
7243
7819
|
}
|
|
7244
7820
|
function creatingUserProfile(profilePath) {
|
|
7245
7821
|
return `${messages_getLoggingPrefix('info')} Creating a fresh user profile at ${external_pintor_default().underline(profilePath)}...`;
|
|
7246
7822
|
}
|
|
7247
7823
|
function browserInstanceExited(browser) {
|
|
7248
|
-
return `${messages_getLoggingPrefix('info')} ${
|
|
7824
|
+
return `${messages_getLoggingPrefix('info')} ${messages_capitalizedBrowserName(browser)} instance exited.`;
|
|
7249
7825
|
}
|
|
7250
7826
|
function stdoutData(browser, mode) {
|
|
7251
7827
|
const extensionOutput = 'firefox' === browser || 'gecko-based' === browser ? 'Add-on' : 'Extension';
|
|
7252
|
-
return `${messages_getLoggingPrefix('info')} ${
|
|
7828
|
+
return `${messages_getLoggingPrefix('info')} ${messages_capitalizedBrowserName(browser)} ${extensionOutput} running in ${external_pintor_default().green(mode || 'unknown')} mode.`;
|
|
7253
7829
|
}
|
|
7254
7830
|
function cdpClientAttachedToTarget(sessionId, targetType) {
|
|
7255
7831
|
return `${messages_getLoggingPrefix('info')} Attached to target: ${targetType} (session ${sessionId})`;
|
|
@@ -7283,56 +7859,56 @@ var __webpack_exports__ = {};
|
|
|
7283
7859
|
return `${messages_getLoggingPrefix('warn')} Skipping browser launch due to compile errors`;
|
|
7284
7860
|
}
|
|
7285
7861
|
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 ||
|
|
7862
|
+
const isUnreachable = 'null' == browserBinaryLocation ? `Browser ${messages_capitalizedBrowserName(browser)} is not installed\n` : `Can't find the path for browser ${messages_capitalizedBrowserName(browser)}\n`;
|
|
7863
|
+
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
7864
|
}
|
|
7289
7865
|
function browserLaunchError(browser, error) {
|
|
7290
|
-
return `${messages_getLoggingPrefix('error')} Error launching ${
|
|
7866
|
+
return `${messages_getLoggingPrefix('error')} Error launching ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
|
|
7291
7867
|
}
|
|
7292
7868
|
function enhancedProcessManagementCleanup(browser) {
|
|
7293
|
-
return `${messages_getLoggingPrefix('info')} Process Management cleanup for ${
|
|
7869
|
+
return `${messages_getLoggingPrefix('info')} Process Management cleanup for ${messages_capitalizedBrowserName(browser)}`;
|
|
7294
7870
|
}
|
|
7295
7871
|
function enhancedProcessManagementTerminating(browser) {
|
|
7296
|
-
return `${messages_getLoggingPrefix('info')} Terminating ${
|
|
7872
|
+
return `${messages_getLoggingPrefix('info')} Terminating ${messages_capitalizedBrowserName(browser)} process gracefully`;
|
|
7297
7873
|
}
|
|
7298
7874
|
function enhancedProcessManagementForceKill(browser) {
|
|
7299
|
-
return `${messages_getLoggingPrefix('error')} Force killing ${
|
|
7875
|
+
return `${messages_getLoggingPrefix('error')} Force killing ${messages_capitalizedBrowserName(browser)} process after timeout`;
|
|
7300
7876
|
}
|
|
7301
7877
|
function enhancedProcessManagementCleanupError(browser, error) {
|
|
7302
|
-
return `${messages_getLoggingPrefix('error')} Error during ${
|
|
7878
|
+
return `${messages_getLoggingPrefix('error')} Error during ${messages_capitalizedBrowserName(browser)} cleanup:\n${external_pintor_default().red(errorDetail(error))}`;
|
|
7303
7879
|
}
|
|
7304
7880
|
function enhancedProcessManagementUncaughtException(browser, error) {
|
|
7305
|
-
return `${messages_getLoggingPrefix('error')} Uncaught exception in ${
|
|
7881
|
+
return `${messages_getLoggingPrefix('error')} Uncaught exception in ${messages_capitalizedBrowserName(browser)} process:\n${external_pintor_default().red(errorDetail(error))}`;
|
|
7306
7882
|
}
|
|
7307
7883
|
function enhancedProcessManagementUnhandledRejection(browser, reason) {
|
|
7308
|
-
return `${messages_getLoggingPrefix('error')} Unhandled rejection in ${
|
|
7884
|
+
return `${messages_getLoggingPrefix('error')} Unhandled rejection in ${messages_capitalizedBrowserName(browser)} process:\n${external_pintor_default().red(errorDetail(reason))}`;
|
|
7309
7885
|
}
|
|
7310
7886
|
function generalBrowserError(browser, error) {
|
|
7311
|
-
return `${messages_getLoggingPrefix('error')} General error in ${
|
|
7887
|
+
return `${messages_getLoggingPrefix('error')} General error in ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
|
|
7312
7888
|
}
|
|
7313
7889
|
function errorConnectingToBrowser(browser) {
|
|
7314
|
-
return `${messages_getLoggingPrefix('error')} Unable to connect to ${
|
|
7890
|
+
return `${messages_getLoggingPrefix('error')} Unable to connect to ${messages_capitalizedBrowserName(browser)}. Too many retries.`;
|
|
7315
7891
|
}
|
|
7316
7892
|
function addonInstallError(browser, message) {
|
|
7317
|
-
return `${messages_getLoggingPrefix('error')} Can't install add-on into ${
|
|
7893
|
+
return `${messages_getLoggingPrefix('error')} Can't install add-on into ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(message)}`;
|
|
7318
7894
|
}
|
|
7319
7895
|
function messagingClientClosedError(browser) {
|
|
7320
|
-
return `${messages_getLoggingPrefix('error')} Messaging client closed unexpectedly for ${
|
|
7896
|
+
return `${messages_getLoggingPrefix('error')} Messaging client closed unexpectedly for ${messages_capitalizedBrowserName(browser)}`;
|
|
7321
7897
|
}
|
|
7322
7898
|
function connectionClosedError(browser) {
|
|
7323
|
-
return `${messages_getLoggingPrefix('error')} Connection closed unexpectedly for ${
|
|
7899
|
+
return `${messages_getLoggingPrefix('error')} Connection closed unexpectedly for ${messages_capitalizedBrowserName(browser)}`;
|
|
7324
7900
|
}
|
|
7325
7901
|
function targetActorHasActiveRequestError(browser, targetActor) {
|
|
7326
|
-
return `${messages_getLoggingPrefix('error')} Target actor ${external_pintor_default().gray(targetActor)} has active request for ${
|
|
7902
|
+
return `${messages_getLoggingPrefix('error')} Target actor ${external_pintor_default().gray(targetActor)} has active request for ${messages_capitalizedBrowserName(browser)}`;
|
|
7327
7903
|
}
|
|
7328
7904
|
function parsingPacketError(browser, error) {
|
|
7329
|
-
return `${messages_getLoggingPrefix('error')} Failed to parse packet from ${
|
|
7905
|
+
return `${messages_getLoggingPrefix('error')} Failed to parse packet from ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
|
|
7330
7906
|
}
|
|
7331
7907
|
function messageWithoutSenderError(browser, message) {
|
|
7332
|
-
return `${messages_getLoggingPrefix('error')} Message without sender from ${
|
|
7908
|
+
return `${messages_getLoggingPrefix('error')} Message without sender from ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(JSON.stringify(message))}`;
|
|
7333
7909
|
}
|
|
7334
7910
|
function profileFallbackWarning(browser, reason) {
|
|
7335
|
-
return `${external_pintor_default().brightYellow("\u25BA\u25BA\u25BA")} ${external_pintor_default().brightYellow('Dev')} ${
|
|
7911
|
+
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
7912
|
}
|
|
7337
7913
|
function chromeProcessExited(code) {
|
|
7338
7914
|
return `${messages_getLoggingPrefix('info')} Chrome process exited with code: ${external_pintor_default().gray(code.toString())}`;
|
|
@@ -7347,11 +7923,17 @@ var __webpack_exports__ = {};
|
|
|
7347
7923
|
return `${messages_getLoggingPrefix('info')} Initializing enhanced reload service with direct spawn for Chrome`;
|
|
7348
7924
|
}
|
|
7349
7925
|
function locatingBrowser(browser) {
|
|
7350
|
-
return `${messages_getLoggingPrefix('info')} Locating ${
|
|
7926
|
+
return `${messages_getLoggingPrefix('info')} Locating ${messages_capitalizedBrowserName(browser)} browser binary...`;
|
|
7351
7927
|
}
|
|
7352
7928
|
function devChromeProfilePath(path) {
|
|
7353
7929
|
return `${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA")} ${external_pintor_default().brightMagenta('Dev')} Chrome profile: ${external_pintor_default().underline(path)}`;
|
|
7354
7930
|
}
|
|
7931
|
+
function usingChromiumRunner(browser) {
|
|
7932
|
+
return `${messages_getLoggingPrefix('info')} Using Chromium runner for ${messages_capitalizedBrowserName(browser)}`;
|
|
7933
|
+
}
|
|
7934
|
+
function usingFirefoxRunner(browser) {
|
|
7935
|
+
return `${messages_getLoggingPrefix('info')} Using Firefox runner for ${messages_capitalizedBrowserName(browser)}`;
|
|
7936
|
+
}
|
|
7355
7937
|
function chromiumDryRunNotLaunching() {
|
|
7356
7938
|
return `${messages_getLoggingPrefix('info')} [plugin-browsers] Dry run: not launching browser`;
|
|
7357
7939
|
}
|
|
@@ -8154,7 +8736,7 @@ var __webpack_exports__ = {};
|
|
|
8154
8736
|
function setupProcessSignalHandlers(browser, child, cleanupInstance) {
|
|
8155
8737
|
const cleanup = ()=>{
|
|
8156
8738
|
try {
|
|
8157
|
-
if ('
|
|
8739
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementCleanup(browser));
|
|
8158
8740
|
if (child && !child.killed) {
|
|
8159
8741
|
if ('win32' === process.platform) try {
|
|
8160
8742
|
(0, external_child_process_.spawn)('taskkill', [
|
|
@@ -8167,11 +8749,11 @@ var __webpack_exports__ = {};
|
|
|
8167
8749
|
windowsHide: true
|
|
8168
8750
|
}).on('error', ()=>{});
|
|
8169
8751
|
} catch {}
|
|
8170
|
-
if ('
|
|
8752
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementTerminating(browser));
|
|
8171
8753
|
child.kill('SIGTERM');
|
|
8172
8754
|
setTimeout(()=>{
|
|
8173
8755
|
if (child && !child.killed) {
|
|
8174
|
-
if ('
|
|
8756
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementForceKill(browser));
|
|
8175
8757
|
child.kill('SIGKILL');
|
|
8176
8758
|
}
|
|
8177
8759
|
}, 5000);
|
|
@@ -8585,7 +9167,7 @@ var __webpack_exports__ = {};
|
|
|
8585
9167
|
}
|
|
8586
9168
|
class CDPClient {
|
|
8587
9169
|
isDev() {
|
|
8588
|
-
return '
|
|
9170
|
+
return 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
8589
9171
|
}
|
|
8590
9172
|
async connect() {
|
|
8591
9173
|
return new Promise(async (resolve, reject)=>{
|
|
@@ -8842,7 +9424,7 @@ var __webpack_exports__ = {};
|
|
|
8842
9424
|
flatten: true
|
|
8843
9425
|
});
|
|
8844
9426
|
} catch (error) {
|
|
8845
|
-
if ('
|
|
9427
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(cdpAutoAttachSetupFailed(String((null == error ? void 0 : error.message) || error)));
|
|
8846
9428
|
}
|
|
8847
9429
|
return cdp;
|
|
8848
9430
|
}
|
|
@@ -8895,7 +9477,7 @@ var __webpack_exports__ = {};
|
|
|
8895
9477
|
}
|
|
8896
9478
|
}
|
|
8897
9479
|
} catch (error) {
|
|
8898
|
-
if ('
|
|
9480
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(cdpProtocolEventHandlerError(String((null == error ? void 0 : error.message) || error)));
|
|
8899
9481
|
}
|
|
8900
9482
|
});
|
|
8901
9483
|
}
|
|
@@ -8923,7 +9505,7 @@ var __webpack_exports__ = {};
|
|
|
8923
9505
|
flatten: true
|
|
8924
9506
|
});
|
|
8925
9507
|
} catch (error) {
|
|
8926
|
-
if ('
|
|
9508
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(cdpAutoAttachSetupFailed(String((null == error ? void 0 : error.message) || error)));
|
|
8927
9509
|
}
|
|
8928
9510
|
registerAutoEnableLogging(this.cdp, ()=>this.extensionId);
|
|
8929
9511
|
}
|
|
@@ -8976,7 +9558,7 @@ var __webpack_exports__ = {};
|
|
|
8976
9558
|
name = String((null == manifest ? void 0 : manifest.name) || '') || void 0;
|
|
8977
9559
|
version = String((null == manifest ? void 0 : manifest.version) || '') || void 0;
|
|
8978
9560
|
} catch (e2) {
|
|
8979
|
-
if ('
|
|
9561
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn('[CDP] Fallback manifest read failed:', String((null == e2 ? void 0 : e2.message) || e2));
|
|
8980
9562
|
}
|
|
8981
9563
|
}
|
|
8982
9564
|
return {
|
|
@@ -9064,7 +9646,7 @@ var __webpack_exports__ = {};
|
|
|
9064
9646
|
} catch {}
|
|
9065
9647
|
});
|
|
9066
9648
|
} catch (e) {
|
|
9067
|
-
if ('
|
|
9649
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn('[CDP] enableLogging failed:', String(e));
|
|
9068
9650
|
}
|
|
9069
9651
|
}
|
|
9070
9652
|
async getInfoBestEffort() {
|
|
@@ -9121,7 +9703,7 @@ var __webpack_exports__ = {};
|
|
|
9121
9703
|
const extensionOutputPath = getExtensionOutputPath(compilation, loadExtensionFlag);
|
|
9122
9704
|
const remoteDebugPortFlag = chromiumArgs.find((flag)=>flag.startsWith('--remote-debugging-port='));
|
|
9123
9705
|
const chromeRemoteDebugPort = remoteDebugPortFlag ? parseInt(remoteDebugPortFlag.split('=')[1], 10) : deriveDebugPortWithInstance(plugin.port, plugin.instanceId);
|
|
9124
|
-
if ('
|
|
9706
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
9125
9707
|
const userDataDirFlag = chromiumArgs.find((flag)=>flag.startsWith('--user-data-dir='));
|
|
9126
9708
|
if (userDataDirFlag) {
|
|
9127
9709
|
const userDataDir = userDataDirFlag.replace('--user-data-dir=', '').replace(/^"|"$/g, '');
|
|
@@ -9146,7 +9728,7 @@ var __webpack_exports__ = {};
|
|
|
9146
9728
|
throw lastError;
|
|
9147
9729
|
};
|
|
9148
9730
|
await retryAsync(()=>cdpExtensionController.connect());
|
|
9149
|
-
if ('
|
|
9731
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(cdpClientConnected('127.0.0.1', chromeRemoteDebugPort));
|
|
9150
9732
|
const extensionControllerInfo = await cdpExtensionController.ensureLoaded();
|
|
9151
9733
|
if ((null == compilation ? void 0 : null == (_compilation_options = compilation.options) ? void 0 : _compilation_options.mode) !== 'production') try {
|
|
9152
9734
|
const bannerPrinted = await printDevBannerOnce({
|
|
@@ -9168,7 +9750,7 @@ var __webpack_exports__ = {};
|
|
|
9168
9750
|
getInfo: async ()=>cdpExtensionController.getInfoBestEffort()
|
|
9169
9751
|
});
|
|
9170
9752
|
} catch (bannerErr) {
|
|
9171
|
-
if ('
|
|
9753
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(bestEffortBannerPrintFailed(String(bannerErr)));
|
|
9172
9754
|
}
|
|
9173
9755
|
plugin.cdpController = cdpExtensionController;
|
|
9174
9756
|
}
|
|
@@ -9484,7 +10066,7 @@ var __webpack_exports__ = {};
|
|
|
9484
10066
|
const freePort = await findAvailablePortNear(desiredPort);
|
|
9485
10067
|
const selectedPort = freePort;
|
|
9486
10068
|
if (freePort !== desiredPort) chromiumConfig = chromiumConfig.map((flag)=>flag.startsWith('--remote-debugging-port=') ? `--remote-debugging-port=${selectedPort}` : flag);
|
|
9487
|
-
if ('
|
|
10069
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.logger.info(devChromiumDebugPort(selectedPort, desiredPort));
|
|
9488
10070
|
setInstancePorts(this.options.instanceId, {
|
|
9489
10071
|
cdpPort: selectedPort
|
|
9490
10072
|
});
|
|
@@ -9521,7 +10103,7 @@ var __webpack_exports__ = {};
|
|
|
9521
10103
|
await setupCdpAfterLaunch(compilation, cdpConfig, chromiumConfig);
|
|
9522
10104
|
if (cdpConfig.cdpController) this.ctx.setController(cdpConfig.cdpController, selectedPort);
|
|
9523
10105
|
} catch (error) {
|
|
9524
|
-
if ('
|
|
10106
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn('[plugin-browsers] CDP post-launch setup failed:', String(error));
|
|
9525
10107
|
}
|
|
9526
10108
|
}
|
|
9527
10109
|
async launchWithDirectSpawn(binary, chromeFlags) {
|
|
@@ -9545,7 +10127,7 @@ var __webpack_exports__ = {};
|
|
|
9545
10127
|
});
|
|
9546
10128
|
null == (_this_logger_debug = (_this_logger = this.logger).debug) || _this_logger_debug.call(_this_logger, '[plugin-browsers] Final Chrome flags:', launchArgs.join(' '));
|
|
9547
10129
|
child.on('close', (code)=>{
|
|
9548
|
-
if ('
|
|
10130
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.logger.info(chromeProcessExited(code || 0));
|
|
9549
10131
|
});
|
|
9550
10132
|
child.on('error', (error)=>{
|
|
9551
10133
|
this.logger.error(chromeProcessError(error));
|
|
@@ -9585,6 +10167,15 @@ var __webpack_exports__ = {};
|
|
|
9585
10167
|
async function setupUnifiedLogging(controller, opts) {
|
|
9586
10168
|
const level = String(opts.level || '').toLowerCase();
|
|
9587
10169
|
if (!level || 'off' === level) return;
|
|
10170
|
+
const colorOn = (null == opts ? void 0 : opts.color) !== false;
|
|
10171
|
+
const c = {
|
|
10172
|
+
gray: (s)=>colorOn && external_pintor_default().gray ? external_pintor_default().gray(s) : s,
|
|
10173
|
+
red: (s)=>colorOn && external_pintor_default().red ? external_pintor_default().red(s) : s,
|
|
10174
|
+
yellow: (s)=>colorOn && external_pintor_default().brightYellow ? external_pintor_default().brightYellow(s) : s,
|
|
10175
|
+
cyan: (s)=>colorOn && external_pintor_default().cyan ? external_pintor_default().cyan(s) : s,
|
|
10176
|
+
magenta: (s)=>colorOn && external_pintor_default().magenta ? external_pintor_default().magenta(s) : s,
|
|
10177
|
+
white: (s)=>colorOn && external_pintor_default().white ? external_pintor_default().white(s) : s
|
|
10178
|
+
};
|
|
9588
10179
|
await controller.enableUnifiedLogging({
|
|
9589
10180
|
level: level,
|
|
9590
10181
|
contexts: opts.contexts,
|
|
@@ -9593,8 +10184,11 @@ var __webpack_exports__ = {};
|
|
|
9593
10184
|
});
|
|
9594
10185
|
const recentKeys = new Map();
|
|
9595
10186
|
const DEDUPE_MS = 1000;
|
|
9596
|
-
controller.onProtocolEvent
|
|
10187
|
+
const subscribe = controller.onProtocolEvent;
|
|
10188
|
+
if (!subscribe) return;
|
|
10189
|
+
subscribe((rawEvt)=>{
|
|
9597
10190
|
try {
|
|
10191
|
+
const evt = rawEvt;
|
|
9598
10192
|
const showTs = false !== opts.timestamps;
|
|
9599
10193
|
const method = null == evt ? void 0 : evt.method;
|
|
9600
10194
|
let level = 'info';
|
|
@@ -9645,18 +10239,18 @@ var __webpack_exports__ = {};
|
|
|
9645
10239
|
const up = String(lvl || 'log').toUpperCase();
|
|
9646
10240
|
switch(String(lvl || '').toLowerCase()){
|
|
9647
10241
|
case 'error':
|
|
9648
|
-
return
|
|
10242
|
+
return c.red(up);
|
|
9649
10243
|
case 'warn':
|
|
9650
|
-
return
|
|
10244
|
+
return c.yellow(up);
|
|
9651
10245
|
case 'info':
|
|
9652
|
-
return
|
|
10246
|
+
return c.cyan(up);
|
|
9653
10247
|
case 'debug':
|
|
9654
|
-
return
|
|
10248
|
+
return c.magenta(up);
|
|
9655
10249
|
case 'trace':
|
|
9656
|
-
return
|
|
10250
|
+
return c.white(up);
|
|
9657
10251
|
case 'log':
|
|
9658
10252
|
default:
|
|
9659
|
-
return
|
|
10253
|
+
return c.gray(up);
|
|
9660
10254
|
}
|
|
9661
10255
|
}
|
|
9662
10256
|
const where = url ? `${url}:${line}:${col}` : '';
|
|
@@ -9671,13 +10265,7 @@ var __webpack_exports__ = {};
|
|
|
9671
10265
|
for (const [k, t] of recentKeys)if (t < cutoff) recentKeys.delete(k);
|
|
9672
10266
|
}
|
|
9673
10267
|
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
|
-
})() : '';
|
|
10268
|
+
const tsIso = showTs ? `${nowDate.toISOString()} ` : '';
|
|
9681
10269
|
if ('pretty' !== String(opts.format || '').toLowerCase()) {
|
|
9682
10270
|
const event = {
|
|
9683
10271
|
timestamp: nowDate.toISOString(),
|
|
@@ -9696,10 +10284,11 @@ var __webpack_exports__ = {};
|
|
|
9696
10284
|
}
|
|
9697
10285
|
return;
|
|
9698
10286
|
}
|
|
9699
|
-
const
|
|
9700
|
-
const
|
|
9701
|
-
const
|
|
9702
|
-
|
|
10287
|
+
const ctx = c.gray(`[${context}]`);
|
|
10288
|
+
const lvl = fmtLevel(level);
|
|
10289
|
+
const whereStr = where ? ` ${c.gray(where)}` : '';
|
|
10290
|
+
const message = msg && msg.trim().length ? msg.trim() : '(none)';
|
|
10291
|
+
console.log(`${tsIso}${prefix} ${ctx} ${lvl}${whereStr} - ${message}`);
|
|
9703
10292
|
} catch {}
|
|
9704
10293
|
});
|
|
9705
10294
|
}
|
|
@@ -9836,7 +10425,7 @@ var __webpack_exports__ = {};
|
|
|
9836
10425
|
const fromRegistry = instanceId && (null == (_getInstancePorts = getInstancePorts(instanceId)) ? void 0 : _getInstancePorts.cdpPort) || getLastCDPPort();
|
|
9837
10426
|
if ('number' == typeof fromRegistry && fromRegistry > 0) port = fromRegistry;
|
|
9838
10427
|
} catch {}
|
|
9839
|
-
if ('
|
|
10428
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorWaitingForChrome());
|
|
9840
10429
|
let retries = 0;
|
|
9841
10430
|
const maxRetries = 60;
|
|
9842
10431
|
const backoffMs = 500;
|
|
@@ -9848,11 +10437,11 @@ var __webpack_exports__ = {};
|
|
|
9848
10437
|
} catch {}
|
|
9849
10438
|
const isDebuggingEnabled = await checkChromeRemoteDebugging(port);
|
|
9850
10439
|
if (isDebuggingEnabled) {
|
|
9851
|
-
if ('
|
|
10440
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(chromeRemoteDebuggingReady());
|
|
9852
10441
|
return;
|
|
9853
10442
|
}
|
|
9854
10443
|
retries++;
|
|
9855
|
-
if (retries % 10 === 0 && '
|
|
10444
|
+
if (retries % 10 === 0 && 'true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorChromeNotReadyYet(retries, maxRetries));
|
|
9856
10445
|
await new Promise((resolve)=>setTimeout(resolve, backoffMs));
|
|
9857
10446
|
}
|
|
9858
10447
|
throw new Error(sourceInspectorChromeDebuggingRequired(port));
|
|
@@ -9860,15 +10449,15 @@ var __webpack_exports__ = {};
|
|
|
9860
10449
|
async function ensureTargetAndSession(cdpClient, url) {
|
|
9861
10450
|
const targets = await cdpClient.getTargets();
|
|
9862
10451
|
const existingTarget = (targets || []).find((t)=>String((null == t ? void 0 : t.url) || '') === url && 'page' === String((null == t ? void 0 : t.type) || ''));
|
|
9863
|
-
let targetId;
|
|
10452
|
+
let targetId = '';
|
|
9864
10453
|
if (existingTarget && existingTarget.targetId) {
|
|
9865
|
-
if ('development' === process.env.EXTENSION_ENV) console.log(sourceInspectorUsingExistingTarget(existingTarget.targetId));
|
|
9866
10454
|
targetId = String(existingTarget.targetId);
|
|
10455
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorUsingExistingTarget(existingTarget.targetId));
|
|
9867
10456
|
} else {
|
|
9868
|
-
if ('
|
|
10457
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorCreatingTarget());
|
|
9869
10458
|
const created = await cdpClient.createTarget(url);
|
|
9870
10459
|
targetId = String(created);
|
|
9871
|
-
if ('
|
|
10460
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
9872
10461
|
console.log(sourceInspectorTargetCreated(targetId));
|
|
9873
10462
|
console.log(sourceInspectorEnsuringNavigation());
|
|
9874
10463
|
}
|
|
@@ -9880,9 +10469,9 @@ var __webpack_exports__ = {};
|
|
|
9880
10469
|
await cdpClient.navigate(String(tempSession), url);
|
|
9881
10470
|
}
|
|
9882
10471
|
}
|
|
9883
|
-
if ('
|
|
10472
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorAttachingToTarget());
|
|
9884
10473
|
const sessionId = String(await cdpClient.attachToTarget(targetId) || '');
|
|
9885
|
-
if ('
|
|
10474
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
9886
10475
|
console.log(sourceInspectorAttachedToTarget(sessionId));
|
|
9887
10476
|
console.log(sourceInspectorEnablingPageDomain());
|
|
9888
10477
|
}
|
|
@@ -9895,7 +10484,7 @@ var __webpack_exports__ = {};
|
|
|
9895
10484
|
sessionId: String(sessionId)
|
|
9896
10485
|
};
|
|
9897
10486
|
}
|
|
9898
|
-
async function extractPageHtml(cdpClient, sessionId, logSamples = '
|
|
10487
|
+
async function extractPageHtml(cdpClient, sessionId, logSamples = 'true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
9899
10488
|
let html = await cdpClient.getPageHTML(sessionId);
|
|
9900
10489
|
if (!html) try {
|
|
9901
10490
|
const targets = await cdpClient.getTargets();
|
|
@@ -9953,6 +10542,11 @@ var __webpack_exports__ = {};
|
|
|
9953
10542
|
return obj;
|
|
9954
10543
|
}
|
|
9955
10544
|
class ChromiumSourceInspectionPlugin {
|
|
10545
|
+
isAuthorMode() {
|
|
10546
|
+
const authorMode = 'true' === String(process.env.EXTENSION_AUTHOR_MODE || '').trim().toLowerCase();
|
|
10547
|
+
const isDevEnv = 'development' === String(process.env.EXTENSION_ENV || '').trim().toLowerCase();
|
|
10548
|
+
return authorMode || isDevEnv;
|
|
10549
|
+
}
|
|
9956
10550
|
async getCdpPort() {
|
|
9957
10551
|
const instanceId = this.devOptions.instanceId;
|
|
9958
10552
|
return deriveDebugPortWithInstance(this.devOptions.port, instanceId);
|
|
@@ -9964,30 +10558,30 @@ var __webpack_exports__ = {};
|
|
|
9964
10558
|
await waitForChromeRemoteDebugging(port, instanceId);
|
|
9965
10559
|
this.cdpClient = new CDPClient(port);
|
|
9966
10560
|
await this.cdpClient.connect();
|
|
9967
|
-
if (
|
|
10561
|
+
if (this.isAuthorMode()) console.log(sourceInspectorInitialized());
|
|
9968
10562
|
this.isInitialized = true;
|
|
9969
10563
|
} catch (error) {
|
|
9970
|
-
if (
|
|
10564
|
+
if (this.isAuthorMode()) console.error(sourceInspectorInitializationFailed(error.message));
|
|
9971
10565
|
throw error;
|
|
9972
10566
|
}
|
|
9973
10567
|
}
|
|
9974
10568
|
async inspectSource(url) {
|
|
9975
10569
|
if (!this.cdpClient) throw new Error(sourceInspectorNotInitialized());
|
|
9976
10570
|
try {
|
|
9977
|
-
if (
|
|
10571
|
+
if (this.isAuthorMode()) {
|
|
9978
10572
|
console.log(sourceInspectorOpeningUrl(url));
|
|
9979
10573
|
console.log(sourceInspectorFindingExistingTarget());
|
|
9980
10574
|
}
|
|
9981
10575
|
const { targetId, sessionId } = await ensureTargetAndSession(this.cdpClient, url);
|
|
9982
10576
|
this.currentTargetId = targetId;
|
|
9983
10577
|
this.currentSessionId = sessionId;
|
|
9984
|
-
if (
|
|
10578
|
+
if (this.isAuthorMode()) console.log(sourceInspectorWaitingForPageLoad());
|
|
9985
10579
|
await this.cdpClient.waitForLoadEvent(this.currentSessionId);
|
|
9986
10580
|
try {
|
|
9987
10581
|
const initialHtml = await extractPageHtml(this.cdpClient, this.currentSessionId);
|
|
9988
10582
|
this.printHTML(String(initialHtml || ''));
|
|
9989
10583
|
} catch {}
|
|
9990
|
-
if (
|
|
10584
|
+
if (this.isAuthorMode()) console.log(sourceInspectorWaitingForContentScripts());
|
|
9991
10585
|
await this.cdpClient.waitForContentScriptInjection(this.currentSessionId);
|
|
9992
10586
|
try {
|
|
9993
10587
|
const deadline = Date.now() + 20000;
|
|
@@ -10013,12 +10607,12 @@ var __webpack_exports__ = {};
|
|
|
10013
10607
|
const html = await extractPageHtml(this.cdpClient, this.currentSessionId);
|
|
10014
10608
|
return html;
|
|
10015
10609
|
} catch (error) {
|
|
10016
|
-
if (
|
|
10610
|
+
if (this.isAuthorMode()) console.error(sourceInspectorInspectionFailed(error.message));
|
|
10017
10611
|
throw error;
|
|
10018
10612
|
}
|
|
10019
10613
|
}
|
|
10020
10614
|
async startWatching(websocketServer) {
|
|
10021
|
-
if (
|
|
10615
|
+
if (!this.isAuthorMode()) return;
|
|
10022
10616
|
if (this.isWatching) return void console.log(sourceInspectorWatchModeActive());
|
|
10023
10617
|
this.isWatching = true;
|
|
10024
10618
|
console.log(sourceInspectorStartingWatchMode());
|
|
@@ -10026,7 +10620,7 @@ var __webpack_exports__ = {};
|
|
|
10026
10620
|
console.log(sourceInspectorCDPConnectionMaintained());
|
|
10027
10621
|
}
|
|
10028
10622
|
setupWebSocketHandler(websocketServer) {
|
|
10029
|
-
if (
|
|
10623
|
+
if (!this.isAuthorMode()) return;
|
|
10030
10624
|
if (!websocketServer || !websocketServer.clients) return void console.warn(sourceInspectorInvalidWebSocketServer());
|
|
10031
10625
|
websocketServer.clients.forEach((ws)=>{
|
|
10032
10626
|
this.setupConnectionHandler(ws);
|
|
@@ -10036,7 +10630,7 @@ var __webpack_exports__ = {};
|
|
|
10036
10630
|
});
|
|
10037
10631
|
}
|
|
10038
10632
|
setupConnectionHandler(ws) {
|
|
10039
|
-
if (
|
|
10633
|
+
if (!this.isAuthorMode()) return;
|
|
10040
10634
|
ws.on('message', async (data)=>{
|
|
10041
10635
|
try {
|
|
10042
10636
|
const message = JSON.parse(data);
|
|
@@ -10045,12 +10639,12 @@ var __webpack_exports__ = {};
|
|
|
10045
10639
|
});
|
|
10046
10640
|
}
|
|
10047
10641
|
stopWatching() {
|
|
10048
|
-
if (
|
|
10642
|
+
if (!this.isAuthorMode()) return;
|
|
10049
10643
|
this.isWatching = false;
|
|
10050
10644
|
console.log(sourceInspectorWatchModeStopped());
|
|
10051
10645
|
}
|
|
10052
10646
|
async handleFileChange() {
|
|
10053
|
-
if (
|
|
10647
|
+
if (!this.isAuthorMode()) return;
|
|
10054
10648
|
if (!this.cdpClient || !this.currentSessionId) return void console.warn(sourceInspectorNoActiveSession());
|
|
10055
10649
|
if (this.debounceTimer) clearTimeout(this.debounceTimer);
|
|
10056
10650
|
this.debounceTimer = setTimeout(async ()=>{
|
|
@@ -10085,7 +10679,7 @@ var __webpack_exports__ = {};
|
|
|
10085
10679
|
}, 300);
|
|
10086
10680
|
}
|
|
10087
10681
|
async reconnectToTarget() {
|
|
10088
|
-
if (
|
|
10682
|
+
if (!this.isAuthorMode()) return;
|
|
10089
10683
|
try {
|
|
10090
10684
|
if (!this.cdpClient || !this.currentTargetId) return void console.warn(sourceInspectorCannotReconnect());
|
|
10091
10685
|
console.log(sourceInspectorReconnectingToTarget());
|
|
@@ -10124,7 +10718,7 @@ var __webpack_exports__ = {};
|
|
|
10124
10718
|
console.log(sourceInspectorHTMLOutputFooter());
|
|
10125
10719
|
}
|
|
10126
10720
|
printUpdatedHTML(html) {
|
|
10127
|
-
if (
|
|
10721
|
+
if (!this.isAuthorMode()) return;
|
|
10128
10722
|
const raw = String(process.env.EXTENSION_SOURCE_RAW || '').trim();
|
|
10129
10723
|
const maxBytesStr = String(process.env.EXTENSION_SOURCE_MAX_BYTES || '').trim();
|
|
10130
10724
|
const maxBytes = /^\d+$/.test(maxBytesStr) ? Math.max(0, parseInt(maxBytesStr, 10)) : 262144;
|
|
@@ -10156,12 +10750,12 @@ var __webpack_exports__ = {};
|
|
|
10156
10750
|
}
|
|
10157
10751
|
async cleanup() {
|
|
10158
10752
|
try {
|
|
10159
|
-
if (
|
|
10753
|
+
if (this.isAuthorMode()) this.stopWatching();
|
|
10160
10754
|
if (this.cdpClient && this.currentTargetId) await this.cdpClient.closeTarget(this.currentTargetId);
|
|
10161
10755
|
if (this.cdpClient) this.cdpClient.disconnect();
|
|
10162
|
-
if (
|
|
10756
|
+
if (this.isAuthorMode()) console.log(sourceInspectorCleanupComplete());
|
|
10163
10757
|
} catch (error) {
|
|
10164
|
-
if (
|
|
10758
|
+
if (this.isAuthorMode()) console.error(sourceInspectorCleanupError(error.message));
|
|
10165
10759
|
}
|
|
10166
10760
|
}
|
|
10167
10761
|
apply(compiler) {
|
|
@@ -10176,13 +10770,13 @@ var __webpack_exports__ = {};
|
|
|
10176
10770
|
const html = await this.inspectSource(urlToInspect);
|
|
10177
10771
|
this.printHTML(html);
|
|
10178
10772
|
const webSocketServer = compiler.options.webSocketServer;
|
|
10179
|
-
if (this.devOptions.watchSource &&
|
|
10773
|
+
if (this.devOptions.watchSource && this.isAuthorMode()) if (webSocketServer) await this.startWatching(webSocketServer);
|
|
10180
10774
|
else try {
|
|
10181
10775
|
const updated = await this.cdpClient.getPageHTML(this.currentSessionId);
|
|
10182
10776
|
this.printUpdatedHTML(updated || '');
|
|
10183
10777
|
} catch {}
|
|
10184
10778
|
} catch (error) {
|
|
10185
|
-
if ('
|
|
10779
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.error(sourceInspectorSetupFailed(error.message));
|
|
10186
10780
|
}
|
|
10187
10781
|
});
|
|
10188
10782
|
}
|
|
@@ -10319,7 +10913,7 @@ var __webpack_exports__ = {};
|
|
|
10319
10913
|
if (isCleaningUp) return;
|
|
10320
10914
|
isCleaningUp = true;
|
|
10321
10915
|
try {
|
|
10322
|
-
if ('
|
|
10916
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementCleanup(browser));
|
|
10323
10917
|
const child = childRef();
|
|
10324
10918
|
if (child && !child.killed) {
|
|
10325
10919
|
if ('win32' === process.platform) try {
|
|
@@ -10333,11 +10927,11 @@ var __webpack_exports__ = {};
|
|
|
10333
10927
|
windowsHide: true
|
|
10334
10928
|
}).on('error', ()=>{});
|
|
10335
10929
|
} catch {}
|
|
10336
|
-
if ('
|
|
10930
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementTerminating(browser));
|
|
10337
10931
|
child.kill('SIGTERM');
|
|
10338
10932
|
setTimeout(()=>{
|
|
10339
10933
|
if (child && !child.killed) {
|
|
10340
|
-
if ('
|
|
10934
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementForceKill(browser));
|
|
10341
10935
|
child.kill('SIGKILL');
|
|
10342
10936
|
}
|
|
10343
10937
|
}, 5000);
|
|
@@ -10427,7 +11021,7 @@ var __webpack_exports__ = {};
|
|
|
10427
11021
|
host: '127.0.0.1',
|
|
10428
11022
|
port
|
|
10429
11023
|
}, ()=>{
|
|
10430
|
-
if ('
|
|
11024
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(firefoxRdpClientConnected('127.0.0.1', port));
|
|
10431
11025
|
resolve();
|
|
10432
11026
|
});
|
|
10433
11027
|
this.conn = c;
|
|
@@ -11764,7 +12358,7 @@ var __webpack_exports__ = {};
|
|
|
11764
12358
|
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
12359
|
return;
|
|
11766
12360
|
}
|
|
11767
|
-
if ('
|
|
12361
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
11768
12362
|
var _this_ctx_logger_info1, _this_ctx_logger1;
|
|
11769
12363
|
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
12364
|
}
|
|
@@ -11848,11 +12442,11 @@ var __webpack_exports__ = {};
|
|
|
11848
12442
|
const binaryArgsMatch = firefoxCfg.match(/--binary-args="([^"]*)"/);
|
|
11849
12443
|
if (binaryArgsMatch) {
|
|
11850
12444
|
firefoxArgs.push(...binaryArgsMatch[1].split(' '));
|
|
11851
|
-
if ('
|
|
12445
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
11852
12446
|
var _this_ctx_logger_info2, _this_ctx_logger2;
|
|
11853
12447
|
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
12448
|
}
|
|
11855
|
-
} else if ('
|
|
12449
|
+
} else if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
11856
12450
|
var _this_ctx_logger_info3, _this_ctx_logger3;
|
|
11857
12451
|
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
12452
|
}
|
|
@@ -11881,7 +12475,7 @@ var __webpack_exports__ = {};
|
|
|
11881
12475
|
this.host.rdpController = ctrl;
|
|
11882
12476
|
this.ctx.setController(ctrl, debugPort);
|
|
11883
12477
|
try {
|
|
11884
|
-
if ('
|
|
12478
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE && this.host.instanceId && profileMatch) {
|
|
11885
12479
|
var _this_ctx_logger_info4, _this_ctx_logger4, _this_ctx_logger_info5, _this_ctx_logger5;
|
|
11886
12480
|
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
12481
|
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 +12519,7 @@ var __webpack_exports__ = {};
|
|
|
11925
12519
|
process.exit(1);
|
|
11926
12520
|
});
|
|
11927
12521
|
child.on('close', (_code)=>{
|
|
11928
|
-
if ('
|
|
12522
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
11929
12523
|
var _this_ctx_logger_info, _this_ctx_logger;
|
|
11930
12524
|
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
12525
|
}
|
|
@@ -11933,7 +12527,7 @@ var __webpack_exports__ = {};
|
|
|
11933
12527
|
process.exit();
|
|
11934
12528
|
});
|
|
11935
12529
|
});
|
|
11936
|
-
if ('
|
|
12530
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE && child) {
|
|
11937
12531
|
var _child_stdout, _child_stderr;
|
|
11938
12532
|
null == (_child_stdout = child.stdout) || _child_stdout.pipe(process.stdout);
|
|
11939
12533
|
null == (_child_stderr = child.stderr) || _child_stderr.pipe(process.stderr);
|
|
@@ -11999,7 +12593,7 @@ var __webpack_exports__ = {};
|
|
|
11999
12593
|
color: (null == (_this_options6 = this.options) ? void 0 : _this_options6.logColor) !== false
|
|
12000
12594
|
});
|
|
12001
12595
|
} catch (error) {
|
|
12002
|
-
if ('
|
|
12596
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12003
12597
|
var _this_ctx_logger_warn, _this_ctx_logger;
|
|
12004
12598
|
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
12599
|
}
|
|
@@ -12082,7 +12676,7 @@ var __webpack_exports__ = {};
|
|
|
12082
12676
|
await new Promise((resolve)=>setTimeout(resolve, 300));
|
|
12083
12677
|
continue;
|
|
12084
12678
|
} catch (error) {
|
|
12085
|
-
if ('
|
|
12679
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12086
12680
|
const msg = (null == error ? void 0 : error.message) || String(error);
|
|
12087
12681
|
console.warn(rdpAddTabFailed(msg));
|
|
12088
12682
|
}
|
|
@@ -12106,7 +12700,7 @@ var __webpack_exports__ = {};
|
|
|
12106
12700
|
if (detail.consoleActor) consoleActor = detail.consoleActor;
|
|
12107
12701
|
if (detail.targetActor) frameActor = detail.targetActor;
|
|
12108
12702
|
} catch (error) {
|
|
12109
|
-
if ('
|
|
12703
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12110
12704
|
const err = error;
|
|
12111
12705
|
console.warn("[RDP] getTargetFromDescriptor failed:", String(err.message || err));
|
|
12112
12706
|
}
|
|
@@ -12114,7 +12708,7 @@ var __webpack_exports__ = {};
|
|
|
12114
12708
|
try {
|
|
12115
12709
|
await client.attach(frameActor);
|
|
12116
12710
|
} catch (error) {
|
|
12117
|
-
if ('
|
|
12711
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12118
12712
|
const err = error;
|
|
12119
12713
|
console.warn('[RDP] attach(frameActor) failed:', String(err.message || err));
|
|
12120
12714
|
}
|
|
@@ -12124,7 +12718,7 @@ var __webpack_exports__ = {};
|
|
|
12124
12718
|
await client.waitForPageReady(consoleActor, urlToInspect, PAGE_READY_TIMEOUT_MS);
|
|
12125
12719
|
return;
|
|
12126
12720
|
} catch (error) {
|
|
12127
|
-
if ('
|
|
12721
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12128
12722
|
const err = error;
|
|
12129
12723
|
console.warn('[RDP] navigateViaScript/waitForPageReady failed:', String(err.message || err));
|
|
12130
12724
|
}
|
|
@@ -12135,7 +12729,7 @@ var __webpack_exports__ = {};
|
|
|
12135
12729
|
try {
|
|
12136
12730
|
await client.attach(targetActor);
|
|
12137
12731
|
} catch (error) {
|
|
12138
|
-
if ('
|
|
12732
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12139
12733
|
const err = error;
|
|
12140
12734
|
console.warn('[RDP] attach(targetActor) failed:', String(err.message || err));
|
|
12141
12735
|
}
|
|
@@ -12143,7 +12737,7 @@ var __webpack_exports__ = {};
|
|
|
12143
12737
|
await client.navigate(targetActor, urlToInspect);
|
|
12144
12738
|
await client.waitForLoadEvent(targetActor);
|
|
12145
12739
|
} catch (error) {
|
|
12146
|
-
if ('
|
|
12740
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12147
12741
|
const err = error;
|
|
12148
12742
|
console.warn('[RDP] fallback navigate/waitForLoadEvent failed:', String(err.message || err));
|
|
12149
12743
|
}
|
|
@@ -12187,13 +12781,13 @@ var __webpack_exports__ = {};
|
|
|
12187
12781
|
if (this.initialized) return;
|
|
12188
12782
|
const client = new MessagingClient();
|
|
12189
12783
|
const port = await this.getRdpPort();
|
|
12190
|
-
if ('
|
|
12784
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorWaitingForFirefox());
|
|
12191
12785
|
let retries = 0;
|
|
12192
12786
|
while(retries < MAX_CONNECT_RETRIES)try {
|
|
12193
12787
|
await client.connect(port);
|
|
12194
12788
|
this.client = client;
|
|
12195
12789
|
this.initialized = true;
|
|
12196
|
-
if ('
|
|
12790
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12197
12791
|
console.log(firefoxRemoteDebuggingReady());
|
|
12198
12792
|
console.log(sourceInspectorInitialized());
|
|
12199
12793
|
}
|
|
@@ -12201,7 +12795,7 @@ var __webpack_exports__ = {};
|
|
|
12201
12795
|
} catch (err) {
|
|
12202
12796
|
retries++;
|
|
12203
12797
|
if (retries % 10 === 0) {
|
|
12204
|
-
if ('
|
|
12798
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorFirefoxNotReadyYet(retries, MAX_CONNECT_RETRIES));
|
|
12205
12799
|
}
|
|
12206
12800
|
await wait(CONNECT_RETRY_INTERVAL_MS);
|
|
12207
12801
|
}
|
|
@@ -12227,7 +12821,7 @@ var __webpack_exports__ = {};
|
|
|
12227
12821
|
const href = await this.client.evaluate(consoleActor, 'String(location.href)');
|
|
12228
12822
|
if ('string' != typeof href || !href.startsWith(urlToInspect)) await this.client.navigateViaScript(consoleActor, urlToInspect);
|
|
12229
12823
|
} catch (error) {
|
|
12230
|
-
if ('
|
|
12824
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
12231
12825
|
const err = error;
|
|
12232
12826
|
console.warn('[RDP] ensureUrlAndReady evaluate/navigateViaScript failed:', String(err.message || err));
|
|
12233
12827
|
}
|
|
@@ -12317,7 +12911,7 @@ var __webpack_exports__ = {};
|
|
|
12317
12911
|
if (!this.initialized) await this.initialize();
|
|
12318
12912
|
const urlToInspect = this.resolveUrlToInspect();
|
|
12319
12913
|
this.lastUrlToInspect = urlToInspect;
|
|
12320
|
-
if ('
|
|
12914
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorWillInspect(urlToInspect));
|
|
12321
12915
|
const { tabActor, consoleActor } = await this.selectActors(urlToInspect);
|
|
12322
12916
|
this.currentTabActor = tabActor;
|
|
12323
12917
|
await this.ensureNavigatedAndLoaded(urlToInspect, tabActor);
|
|
@@ -12332,7 +12926,7 @@ var __webpack_exports__ = {};
|
|
|
12332
12926
|
await this.handleFileChange();
|
|
12333
12927
|
}
|
|
12334
12928
|
} catch (error) {
|
|
12335
|
-
if ('
|
|
12929
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.error(sourceInspectorSetupFailed(error.message));
|
|
12336
12930
|
}
|
|
12337
12931
|
done();
|
|
12338
12932
|
});
|
|
@@ -12399,6 +12993,7 @@ var __webpack_exports__ = {};
|
|
|
12399
12993
|
run_firefox_define_property(this, "logTab", void 0);
|
|
12400
12994
|
run_firefox_define_property(this, "logger", void 0);
|
|
12401
12995
|
run_firefox_define_property(this, "firefoxCtx", void 0);
|
|
12996
|
+
run_firefox_define_property(this, "rdpController", void 0);
|
|
12402
12997
|
this.extension = options.extension;
|
|
12403
12998
|
this.browser = options.browser;
|
|
12404
12999
|
this.startingUrl = options.startingUrl;
|
|
@@ -12434,9 +13029,13 @@ var __webpack_exports__ = {};
|
|
|
12434
13029
|
}
|
|
12435
13030
|
class BrowsersPlugin {
|
|
12436
13031
|
apply(compiler) {
|
|
12437
|
-
if ('chrome' === this.browser || 'edge' === this.browser || 'chromium' === this.browser || 'chromium-based' === this.browser)
|
|
12438
|
-
|
|
12439
|
-
|
|
13032
|
+
if ('chrome' === this.browser || 'edge' === this.browser || 'chromium' === this.browser || 'chromium-based' === this.browser) {
|
|
13033
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(usingChromiumRunner(this.browser));
|
|
13034
|
+
new RunChromiumPlugin(this).apply(compiler);
|
|
13035
|
+
} else if ('firefox' === this.browser || 'gecko-based' === this.browser || 'firefox-based' === this.browser) {
|
|
13036
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(usingFirefoxRunner(this.browser));
|
|
13037
|
+
new RunFirefoxPlugin(this).apply(compiler);
|
|
13038
|
+
} else {
|
|
12440
13039
|
try {
|
|
12441
13040
|
console.error(unsupportedBrowser(String(this.browser)));
|
|
12442
13041
|
} catch {}
|
|
@@ -12497,7 +13096,7 @@ var __webpack_exports__ = {};
|
|
|
12497
13096
|
console.error(requireGeckoBinaryForGeckoBased());
|
|
12498
13097
|
process.exit(1);
|
|
12499
13098
|
}
|
|
12500
|
-
if (false === this.profile && '
|
|
13099
|
+
if (false === this.profile && 'true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(profileFallbackWarning(this.browser, 'system profile in use (profile: false)'));
|
|
12501
13100
|
}
|
|
12502
13101
|
}
|
|
12503
13102
|
plugin_browsers_define_property(BrowsersPlugin, "name", 'plugin-browsers');
|
|
@@ -12507,7 +13106,7 @@ var __webpack_exports__ = {};
|
|
|
12507
13106
|
const manifest = filterKeysForThisBrowser(JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8')), devOptions.browser);
|
|
12508
13107
|
const userExtensionOutputPath = asAbsolute(external_path_.isAbsolute(devOptions.output.path) ? devOptions.output.path : external_path_.resolve(packageJsonDir, devOptions.output.path));
|
|
12509
13108
|
const extensionsToLoad = computeExtensionsToLoad(__dirname, devOptions.mode, devOptions.browser, userExtensionOutputPath);
|
|
12510
|
-
const debug = '
|
|
13109
|
+
const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
12511
13110
|
if (debug) {
|
|
12512
13111
|
console.log(webpack_lib_messages.Ry(devOptions.browser, devOptions.chromiumBinary, devOptions.geckoBinary));
|
|
12513
13112
|
console.log(webpack_lib_messages.ZE(packageJsonDir));
|
|
@@ -12700,7 +13299,7 @@ var __webpack_exports__ = {};
|
|
|
12700
13299
|
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
13300
|
try {
|
|
12702
13301
|
var _baseConfig_plugins;
|
|
12703
|
-
const debug = '
|
|
13302
|
+
const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
12704
13303
|
const { manifestDir, packageJsonDir } = getDirs(projectStructure);
|
|
12705
13304
|
if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, manifestDir);
|
|
12706
13305
|
const commandConfig = await loadCommandConfig(manifestDir, 'build');
|
|
@@ -12806,7 +13405,7 @@ var __webpack_exports__ = {};
|
|
|
12806
13405
|
return `Extension.js Runner Error:\n${external_pintor_default().red(String(error))}`;
|
|
12807
13406
|
}
|
|
12808
13407
|
function autoExitModeEnabled(ms) {
|
|
12809
|
-
return `Auto-exit
|
|
13408
|
+
return `Auto-exit enabled. Will exit after ${external_pintor_default().brightBlue(ms.toString())} ms if idle.`;
|
|
12810
13409
|
}
|
|
12811
13410
|
function autoExitTriggered(ms) {
|
|
12812
13411
|
return `Auto-exit triggered after ${external_pintor_default().brightBlue(ms.toString())} ms. Cleaning up...`;
|
|
@@ -13207,7 +13806,7 @@ var __webpack_exports__ = {};
|
|
|
13207
13806
|
async function extensionDev(pathOrRemoteUrl, devOptions) {
|
|
13208
13807
|
const projectStructure = await getProjectStructure(pathOrRemoteUrl);
|
|
13209
13808
|
try {
|
|
13210
|
-
const debug = '
|
|
13809
|
+
const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
13211
13810
|
const { manifestDir, packageJsonDir } = getDirs(projectStructure);
|
|
13212
13811
|
if (isUsingTypeScript(manifestDir)) await generateExtensionTypes(manifestDir, packageJsonDir);
|
|
13213
13812
|
if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, manifestDir);
|
|
@@ -13236,7 +13835,7 @@ var __webpack_exports__ = {};
|
|
|
13236
13835
|
}
|
|
13237
13836
|
async function extensionPreview(pathOrRemoteUrl, previewOptions) {
|
|
13238
13837
|
const projectStructure = await getProjectStructure(pathOrRemoteUrl);
|
|
13239
|
-
const debug = '
|
|
13838
|
+
const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
13240
13839
|
if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, external_path_.dirname(projectStructure.manifestPath));
|
|
13241
13840
|
const { manifestDir, packageJsonDir } = getDirs(projectStructure);
|
|
13242
13841
|
const browser = normalizeBrowser(previewOptions.browser || 'chrome', previewOptions.chromiumBinary, previewOptions.geckoBinary || previewOptions.firefoxBinary);
|
|
@@ -13338,14 +13937,14 @@ var __webpack_exports__ = {};
|
|
|
13338
13937
|
}
|
|
13339
13938
|
});
|
|
13340
13939
|
} catch (error) {
|
|
13341
|
-
if ('
|
|
13940
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.error(error);
|
|
13342
13941
|
process.exit(1);
|
|
13343
13942
|
}
|
|
13344
13943
|
}
|
|
13345
13944
|
async function extensionStart(pathOrRemoteUrl, startOptions) {
|
|
13346
13945
|
const projectStructure = await getProjectStructure(pathOrRemoteUrl);
|
|
13347
13946
|
try {
|
|
13348
|
-
const debug = '
|
|
13947
|
+
const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
13349
13948
|
const browser = normalizeBrowser(startOptions.browser || 'chrome', startOptions.chromiumBinary, startOptions.geckoBinary || startOptions.firefoxBinary);
|
|
13350
13949
|
const { manifestDir, packageJsonDir } = getDirs(projectStructure);
|
|
13351
13950
|
const commandConfig = await loadCommandConfig(manifestDir, 'start');
|
|
@@ -13372,7 +13971,7 @@ var __webpack_exports__ = {};
|
|
|
13372
13971
|
outputPath: distPath
|
|
13373
13972
|
});
|
|
13374
13973
|
} catch (error) {
|
|
13375
|
-
if ('
|
|
13974
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.error(error);
|
|
13376
13975
|
process.exit(1);
|
|
13377
13976
|
}
|
|
13378
13977
|
}
|