extension-develop 3.0.0-next.6 → 3.0.0-next.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.js CHANGED
@@ -78,24 +78,35 @@ var __webpack_modules__ = {
78
78
  },
79
79
  "./webpack/webpack-lib/messages.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
80
80
  __webpack_require__.d(__webpack_exports__, {
81
+ $T: ()=>debugOutputPath,
82
+ KH: ()=>debugExtensionsToLoad,
81
83
  LO: ()=>buildWebpack,
82
84
  N$: ()=>manifestNotFoundError,
83
85
  Nv: ()=>installingDependencies,
86
+ OF: ()=>debugDirs,
84
87
  QC: ()=>failedToDownloadOrExtractZIPFileError,
85
88
  QR: ()=>fetchingProjectPath,
89
+ Ry: ()=>debugBrowser,
90
+ U6: ()=>treeWithSourceFiles,
86
91
  WF: ()=>unpackagingExtension,
87
92
  WW: ()=>previewing,
93
+ ZE: ()=>debugContextPath,
88
94
  _n: ()=>writingTypeDefinitions,
89
95
  aP: ()=>unpackagedSuccessfully,
90
96
  cq: ()=>downloadingText,
91
97
  hf: ()=>cantInstallDependencies,
98
+ hv: ()=>treeWithDistFilesbrowser,
92
99
  iE: ()=>downloadingProjectPath,
93
100
  km: ()=>runningInProduction,
94
101
  mY: ()=>creatingProjectPath,
95
102
  nJ: ()=>isUsingExperimentalConfig,
96
103
  oM: ()=>managedDependencyConflict,
104
+ qZ: ()=>packagingSourceFiles,
97
105
  rF: ()=>configLoadingError,
106
+ rR: ()=>treeWithSourceAndDistFiles,
107
+ sn: ()=>packagingDistributionFiles,
98
108
  vC: ()=>installingDependenciesFailed,
109
+ vQ: ()=>debugPreviewOutput,
99
110
  vX: ()=>downloadedProjectFolderNotFound,
100
111
  wX: ()=>invalidRemoteZip,
101
112
  z$: ()=>buildSuccess,
@@ -106,7 +117,30 @@ var __webpack_modules__ = {
106
117
  var pintor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("pintor");
107
118
  var pintor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/ __webpack_require__.n(pintor__WEBPACK_IMPORTED_MODULE_2__);
108
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
+ };
109
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");
110
144
  if ('error' === type) return pintor__WEBPACK_IMPORTED_MODULE_2___default().red('ERROR');
111
145
  if ('warn' === type) return pintor__WEBPACK_IMPORTED_MODULE_2___default().brightYellow("\u25BA\u25BA\u25BA");
112
146
  if ('info' === type) return pintor__WEBPACK_IMPORTED_MODULE_2___default().gray("\u25BA\u25BA\u25BA");
@@ -159,7 +193,12 @@ var __webpack_modules__ = {
159
193
  return `${getLoggingPrefix('success')} No errors or warnings found. Your extension is ${pintor__WEBPACK_IMPORTED_MODULE_2___default().green('ready for deployment')}.`;
160
194
  }
161
195
  function fetchingProjectPath(owner, project) {
162
- return `${getLoggingPrefix('info')} Fetching data...\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('URL')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(`https://github.com/${owner}/${project}`)}`;
196
+ return fmt.block('Fetching project', [
197
+ [
198
+ 'URL',
199
+ fmt.val(`https://github.com/${owner}/${project}`)
200
+ ]
201
+ ]);
163
202
  }
164
203
  function downloadingProjectPath(projectName) {
165
204
  const formatted = isPathLike(projectName) ? pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(projectName) : pintor__WEBPACK_IMPORTED_MODULE_2___default().yellow(projectName);
@@ -171,6 +210,21 @@ var __webpack_modules__ = {
171
210
  function downloadedProjectFolderNotFound(cwd, candidates) {
172
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(', '))}`;
173
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
+ }
174
228
  function writingTypeDefinitions(manifest) {
175
229
  return `${getLoggingPrefix('info')} Writing type definitions for ${pintor__WEBPACK_IMPORTED_MODULE_2___default().blue(manifest.name || '')}...`;
176
230
  }
@@ -178,7 +232,12 @@ var __webpack_modules__ = {
178
232
  return `${getLoggingPrefix('error')} Failed to write the extension type definition.\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().red(error)}`;
179
233
  }
180
234
  function downloadingText(url) {
181
- return `${getLoggingPrefix('info')} Downloading browser extension...\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('URL')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(url)}`;
235
+ return fmt.block('Downloading extension', [
236
+ [
237
+ 'URL',
238
+ fmt.val(url)
239
+ ]
240
+ ]);
182
241
  }
183
242
  function unpackagingExtension(zipFilePath) {
184
243
  return `${getLoggingPrefix('info')} Unpackaging browser extension...\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('PATH')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(zipFilePath)}`;
@@ -239,6 +298,26 @@ var __webpack_modules__ = {
239
298
  function installingDependencies() {
240
299
  return `${getLoggingPrefix('info')} Installing project dependencies...`;
241
300
  }
301
+ function debugDirs(manifestDir, packageJsonDir) {
302
+ return `${getLoggingPrefix('info')} Directories\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('MANIFEST_DIR')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(manifestDir)}\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('PACKAGE_JSON_DIR')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(packageJsonDir)}`;
303
+ }
304
+ function debugBrowser(browser, chromiumBinary, geckoBinary) {
305
+ return `${getLoggingPrefix('info')} Browser Target\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('BROWSER')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().yellow(String(browser))}\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('CHROMIUM_BINARY')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(String(chromiumBinary || 'auto'))}\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('GECKO_BINARY')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(String(geckoBinary || 'auto'))}`;
306
+ }
307
+ function debugOutputPath(pathValue) {
308
+ return `${getLoggingPrefix('info')} Output Path\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('PATH')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(pathValue)}`;
309
+ }
310
+ function debugPreviewOutput(outputPath, distPath) {
311
+ return `${getLoggingPrefix('info')} Preview Output\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('OUTPUT')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(outputPath)}\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('DIST')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(distPath)}`;
312
+ }
313
+ function debugContextPath(packageJsonDir) {
314
+ return `${getLoggingPrefix('info')} Context\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('CONTEXT')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(packageJsonDir)}`;
315
+ }
316
+ function debugExtensionsToLoad(extensions) {
317
+ const header = `${getLoggingPrefix('info')} Extensions To Load (${extensions.length})`;
318
+ const list = extensions.map((e)=>`- ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(e)}`).join('\n');
319
+ return `${header}\n${list}`;
320
+ }
242
321
  function installingDependenciesFailed(gitCommand, gitArgs, code) {
243
322
  return `${getLoggingPrefix('error')} Command ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(gitCommand)} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(gitArgs.join(' '))} failed.\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().red(`exit code ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(String(code))}`)}`;
244
323
  }
@@ -246,7 +325,7 @@ var __webpack_modules__ = {
246
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))}`;
247
326
  }
248
327
  function configLoadingError(configPath, error) {
249
- return `${getLoggingPrefix('error')} Failed to load ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(configPath)} config.\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().red(String(error))}`;
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));
250
329
  }
251
330
  function managedDependencyConflict(duplicates, userPackageJsonPath) {
252
331
  const list = duplicates.map((d)=>`- ${pintor__WEBPACK_IMPORTED_MODULE_2___default().yellow(d)}`).join('\n');
@@ -292,7 +371,7 @@ var __webpack_modules__ = {
292
371
  });
293
372
  },
294
373
  "./package.json": function(module) {
295
- module.exports = JSON.parse('{"i8":"3.0.0-next.5","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"}}');
374
+ module.exports = JSON.parse('{"i8":"3.0.0-next.7","HO":{"@rspack/core":"^1.6.3","@rspack/dev-server":"^1.1.4","@swc/core":"^1.13.2","@swc/helpers":"^0.5.15","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chokidar":"^4.0.1","chrome-location2":"3.2.1","chromium-location":"1.2.3","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^16.4.7","edge-location":"^2.1.1","firefox-location2":"2.1.1","go-git-it":"^5.0.0","ignore":"^6.0.2","loader-utils":"^3.3.1","magic-string":"^0.30.10","package-manager-detector":"^0.2.7","parse5":"^7.2.1","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.2.0","tiny-glob":"^0.2.9","unique-names-generator":"^4.7.1","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.18.0"},"Lq":{"@prefresh/core":"^1.5.2","@prefresh/utils":"^1.2.0","@prefresh/webpack":"^4.0.1","@rspack/plugin-preact-refresh":"^1.1.2","@rspack/plugin-react-refresh":"^1.0.1","@vue/compiler-sfc":"^3.5.13","babel-loader":"^9.2.1","less-loader":"^12.2.0","postcss-loader":"^8.1.1","postcss-preset-env":"^10.1.1","react-refresh":"^0.14.2","sass-loader":"^16.0.4","svelte-loader":"^3.2.4","vue-loader":"^17.4.2","vue-style-loader":"^4.1.3"}}');
296
375
  }
297
376
  };
298
377
  var __webpack_module_cache__ = {};
@@ -369,12 +448,12 @@ var __webpack_exports__ = {};
369
448
  extensionPreview: ()=>extensionPreview,
370
449
  extensionStart: ()=>extensionStart
371
450
  });
372
- var external_fs_ = __webpack_require__("fs");
373
- var external_path_ = __webpack_require__("path");
374
- var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_);
375
451
  const core_namespaceObject = require("@rspack/core");
376
452
  var core_default = /*#__PURE__*/ __webpack_require__.n(core_namespaceObject);
377
453
  const external_webpack_merge_namespaceObject = require("webpack-merge");
454
+ var external_path_ = __webpack_require__("path");
455
+ var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_);
456
+ var external_fs_ = __webpack_require__("fs");
378
457
  var webpack_lib_messages = __webpack_require__("./webpack/webpack-lib/messages.ts");
379
458
  async function findUpLocal(filename, options) {
380
459
  const root = external_path_.parse(options.cwd).root;
@@ -730,7 +809,7 @@ var __webpack_exports__ = {};
730
809
  const configPath = candidates.find((p)=>external_fs_.existsSync(p));
731
810
  if (configPath) {
732
811
  if (!userMessageDelivered) {
733
- if ('development' === process.env.EXTENSION_ENV) console.log(webpack_lib_messages.nJ('extension.config.js'));
812
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(webpack_lib_messages.nJ('extension.config.js'));
734
813
  userMessageDelivered = true;
735
814
  }
736
815
  return true;
@@ -773,7 +852,7 @@ var __webpack_exports__ = {};
773
852
  await external_fs_.promises.mkdir(nodeModulesPath, {
774
853
  recursive: true
775
854
  });
776
- const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'ignore';
855
+ const stdio = 'true' === process.env.EXTENSION_AUTHOR_MODE ? 'inherit' : 'ignore';
777
856
  const child = (0, external_cross_spawn_namespaceObject.spawn)(command, dependenciesArgs, {
778
857
  stdio
779
858
  });
@@ -820,7 +899,7 @@ var __webpack_exports__ = {};
820
899
  process.exit(1);
821
900
  }
822
901
  } catch (error) {
823
- if ('development' === process.env.EXTENSION_ENV) console.warn(error);
902
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(error);
824
903
  }
825
904
  }
826
905
  function scrubBrand(txt, brand = 'Extension.js') {
@@ -836,6 +915,84 @@ var __webpack_exports__ = {};
836
915
  error: (...args)=>console.error(...args.map(sanitize))
837
916
  };
838
917
  }
918
+ function asAbsolute(p) {
919
+ return external_path_.isAbsolute(p) ? p : external_path_.resolve(p);
920
+ }
921
+ function getDirs(struct) {
922
+ const manifestDir = asAbsolute(external_path_.dirname(struct.manifestPath));
923
+ const packageJsonDir = asAbsolute(struct.packageJsonPath ? external_path_.dirname(struct.packageJsonPath) : manifestDir);
924
+ return {
925
+ manifestDir,
926
+ packageJsonDir
927
+ };
928
+ }
929
+ function getNodeModulesDir(packageJsonDir) {
930
+ return asAbsolute(external_path_.join(packageJsonDir, 'node_modules'));
931
+ }
932
+ function needsInstall(packageJsonDir) {
933
+ const nm = getNodeModulesDir(packageJsonDir);
934
+ try {
935
+ return !external_fs_.existsSync(nm) || 0 === external_fs_.readdirSync(nm).length;
936
+ } catch {
937
+ return true;
938
+ }
939
+ }
940
+ function normalizeBrowser(browser, chromiumBinary, geckoBinary) {
941
+ if (chromiumBinary) return 'chromium-based';
942
+ if (geckoBinary) return 'gecko-based';
943
+ switch(String(browser || '')){
944
+ case 'chrome':
945
+ return 'chrome';
946
+ case 'edge':
947
+ return 'edge';
948
+ case 'chromium':
949
+ case 'chromium-based':
950
+ return 'chromium';
951
+ case 'firefox':
952
+ case 'firefox-based':
953
+ case 'gecko-based':
954
+ return 'firefox';
955
+ default:
956
+ return browser || 'chrome';
957
+ }
958
+ }
959
+ function getDistPath(packageJsonDir, browser) {
960
+ return asAbsolute(external_path_.join(packageJsonDir, 'dist', browser));
961
+ }
962
+ function computePreviewOutputPath(struct, browser, explicitOutputPath) {
963
+ const { manifestDir, packageJsonDir } = getDirs(struct);
964
+ if (explicitOutputPath) return asAbsolute(explicitOutputPath);
965
+ if (struct.packageJsonPath) {
966
+ const distDir = getDistPath(packageJsonDir, browser);
967
+ try {
968
+ if (external_fs_.existsSync(external_path_.join(distDir, 'manifest.json'))) return distDir;
969
+ } catch {}
970
+ }
971
+ return manifestDir;
972
+ }
973
+ function ensureDirSync(dir) {
974
+ try {
975
+ if (!external_fs_.existsSync(dir)) external_fs_.mkdirSync(dir, {
976
+ recursive: true
977
+ });
978
+ } catch {}
979
+ }
980
+ function devtoolsEngineFor(browser) {
981
+ switch(browser){
982
+ case 'chrome':
983
+ return 'chrome';
984
+ case 'edge':
985
+ return 'edge';
986
+ case 'chromium':
987
+ case 'chromium-based':
988
+ return 'chromium';
989
+ case 'firefox':
990
+ case 'gecko-based':
991
+ return 'firefox';
992
+ default:
993
+ return 'chrome';
994
+ }
995
+ }
839
996
  function filterKeysForThisBrowser(manifest, browser) {
840
997
  const CHROMIUM_BASED_BROWSERS = [
841
998
  'chrome',
@@ -863,8 +1020,107 @@ var __webpack_exports__ = {};
863
1020
  });
864
1021
  return patchedManifest;
865
1022
  }
1023
+ function getDarkModeDefaults(browser) {
1024
+ if ('chrome' === browser || 'edge' === browser || 'chromium' === browser || 'chromium-based' === browser) return {
1025
+ browserFlags: [
1026
+ '--force-dark-mode',
1027
+ '--enable-features=WebUIDarkMode'
1028
+ ],
1029
+ preferences: {}
1030
+ };
1031
+ if ('firefox' === browser || 'gecko-based' === browser || 'firefox-based' === browser) return {
1032
+ browserFlags: [],
1033
+ preferences: {
1034
+ 'ui.systemUsesDarkTheme': 1,
1035
+ 'layout.css.prefers-color-scheme.content-override': 2,
1036
+ 'devtools.theme': 'dark'
1037
+ }
1038
+ };
1039
+ return {
1040
+ browserFlags: [],
1041
+ preferences: {}
1042
+ };
1043
+ }
1044
+ function withDarkMode(config) {
1045
+ const defaults = getDarkModeDefaults(config.browser);
1046
+ const existingFlags = Array.isArray(config.browserFlags) ? [
1047
+ ...config.browserFlags
1048
+ ] : [];
1049
+ const nextFlags = [
1050
+ ...existingFlags
1051
+ ];
1052
+ for (const flag of defaults.browserFlags || [])if (!nextFlags.some((f)=>String(f).trim() === flag)) nextFlags.push(flag);
1053
+ const nextPreferences = {
1054
+ ...config.preferences || {},
1055
+ ...Object.fromEntries(Object.entries(defaults.preferences || {}).filter(([k])=>!(k in (config.preferences || {}))))
1056
+ };
1057
+ return {
1058
+ ...config,
1059
+ browserFlags: nextFlags,
1060
+ preferences: nextPreferences
1061
+ };
1062
+ }
1063
+ function computeExtensionsToLoad(baseDir, mode, browser, userExtensionOutputPath) {
1064
+ const list = [];
1065
+ try {
1066
+ const engine = devtoolsEngineFor(browser);
1067
+ const devtoolsRoot = external_path_.resolve(baseDir, '../dist/extension-js-devtools');
1068
+ const themeRoot = external_path_.resolve(baseDir, '../dist/extension-js-theme');
1069
+ const devtoolsForBrowser = external_path_.join(devtoolsRoot, engine);
1070
+ const themeForBrowser = external_path_.join(themeRoot, engine);
1071
+ if ('production' !== mode && external_fs_.existsSync(devtoolsForBrowser)) list.push(devtoolsForBrowser);
1072
+ if (external_fs_.existsSync(themeForBrowser)) list.push(themeForBrowser);
1073
+ } catch {}
1074
+ list.push(userExtensionOutputPath);
1075
+ return list;
1076
+ }
866
1077
  const external_case_sensitive_paths_webpack_plugin_namespaceObject = require("case-sensitive-paths-webpack-plugin");
867
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
+ }
868
1124
  function _define_property(obj, key, value) {
869
1125
  if (key in obj) Object.defineProperty(obj, key, {
870
1126
  value: value,
@@ -895,6 +1151,7 @@ var __webpack_exports__ = {};
895
1151
  break;
896
1152
  }
897
1153
  }
1154
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(envSelectedFile(envPath));
898
1155
  const envVars = envPath ? external_dotenv_namespaceObject.config({
899
1156
  path: envPath
900
1157
  }).parsed || {} : {};
@@ -924,6 +1181,8 @@ var __webpack_exports__ = {};
924
1181
  filteredEnvVars['import.meta.env.BROWSER'] = JSON.stringify(this.browser);
925
1182
  filteredEnvVars['process.env.MODE'] = JSON.stringify(mode);
926
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));
927
1186
  new core_namespaceObject.DefinePlugin(filteredEnvVars).apply(compiler);
928
1187
  compiler.hooks.thisCompilation.tap('manifest:update-manifest', (compilation)=>{
929
1188
  compilation.hooks.processAssets.tap({
@@ -985,35 +1244,56 @@ var __webpack_exports__ = {};
985
1244
  apply(compiler) {
986
1245
  const logger = compiler.getInfrastructureLogger('plugin-compilation:clean');
987
1246
  const distPath = external_path_.join(compiler.options.context, 'dist', this.options.browser);
988
- if (external_fs_.existsSync(distPath)) try {
989
- if (external_fs_.rmSync) external_fs_.rmSync(distPath, {
990
- recursive: true,
991
- force: true
992
- });
993
- else external_fs_.rmdirSync(distPath, {
994
- recursive: true
995
- });
996
- if ('development' === process.env.EXTENSION_ENV) logger.info('[CleanDistFolderPlugin] Removed old hot-update files before compilation.');
997
- } catch (error) {
998
- if ('win32' === process.platform && /EBUSY|EPERM/i.test(String((null == error ? void 0 : error.code) || (null == error ? void 0 : error.message)))) setTimeout(()=>{
999
- try {
1000
- if (external_fs_.rmSync) external_fs_.rmSync(distPath, {
1001
- recursive: true,
1002
- force: true
1003
- });
1004
- else external_fs_.rmdirSync(distPath, {
1005
- recursive: true
1006
- });
1007
- } catch {}
1008
- }, 100);
1009
- logger.error(`[CleanDistFolderPlugin] Failed to remove hot-update files: ${error.message}`);
1010
- }
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));
1011
1275
  }
1012
1276
  constructor(options){
1013
1277
  clean_dist_define_property(this, "options", void 0);
1014
1278
  this.options = options;
1015
1279
  }
1016
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
+ }
1017
1297
  var external_adm_zip_ = __webpack_require__("adm-zip");
1018
1298
  var external_adm_zip_default = /*#__PURE__*/ __webpack_require__.n(external_adm_zip_);
1019
1299
  const external_tiny_glob_namespaceObject = require("tiny-glob");
@@ -1058,6 +1338,7 @@ var __webpack_exports__ = {};
1058
1338
  if (!(this.zipData.zip || this.zipData.zipSource)) return;
1059
1339
  try {
1060
1340
  var _compiler_options_output;
1341
+ const created = [];
1061
1342
  const outPath = null == (_compiler_options_output = compiler.options.output) ? void 0 : _compiler_options_output.path;
1062
1343
  const packageJsonDir = compiler.options.context;
1063
1344
  const manifestPath = this.options.manifestPath ? this.options.manifestPath : external_path_.join(this.zipData.zipSource ? packageJsonDir : outPath, 'manifest.json');
@@ -1072,14 +1353,31 @@ var __webpack_exports__ = {};
1072
1353
  sourceZip.addLocalFile(external_path_.join(packageJsonDir, file), '.' === root ? '' : toPosix(root));
1073
1354
  });
1074
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));
1075
1357
  sourceZip.writeZip(sourcePath);
1358
+ created.push({
1359
+ kind: 'source',
1360
+ path: sourcePath
1361
+ });
1076
1362
  }
1077
1363
  if (this.zipData.zip) {
1078
1364
  const distZip = new (external_adm_zip_default())();
1079
1365
  distZip.addLocalFolder(outPath);
1080
1366
  const filename = this.zipData.zipFilename ? zip_sanitize(this.zipData.zipFilename) : name;
1081
1367
  const distPath = external_path_.join(outPath, `${filename}.zip`);
1368
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(webpack_lib_messages.sn(distPath));
1082
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));
1083
1381
  }
1084
1382
  } catch (error) {
1085
1383
  var _stats_compilation;
@@ -1096,22 +1394,6 @@ var __webpack_exports__ = {};
1096
1394
  this.zipData = this.options.zipData ?? {};
1097
1395
  }
1098
1396
  }
1099
- var external_pintor_ = __webpack_require__("pintor");
1100
- var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_);
1101
- function boring(manifestName, durationMs, stats) {
1102
- const now = new Date();
1103
- const hh = String(now.getHours()).padStart(2, '0');
1104
- const mm = String(now.getMinutes()).padStart(2, '0');
1105
- const ss = String(now.getSeconds()).padStart(2, '0');
1106
- const timestamp = external_pintor_default().gray(`[${hh}:${mm}:${ss}]`);
1107
- const hasErrors = stats.hasErrors();
1108
- const hasWarnings = stats.hasWarnings();
1109
- 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");
1110
- const label = hasErrors ? external_pintor_default().red('with errors') : hasWarnings ? external_pintor_default().yellow('with warnings') : external_pintor_default().green('successfully');
1111
- const app = manifestName;
1112
- const time = `${durationMs} ms`;
1113
- return `${arrow} ${timestamp} ${app} compiled ${label} in ${time}.`;
1114
- }
1115
1397
  function boring_define_property(obj, key, value) {
1116
1398
  if (key in obj) Object.defineProperty(obj, key, {
1117
1399
  value: value,
@@ -1182,6 +1464,10 @@ var __webpack_exports__ = {};
1182
1464
  zipFilename: this.zipFilename
1183
1465
  }
1184
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
+ }
1185
1471
  new BoringPlugin({
1186
1472
  manifestPath: this.manifestPath,
1187
1473
  browser: this.browser || 'chrome'
@@ -1203,16 +1489,24 @@ var __webpack_exports__ = {};
1203
1489
  }
1204
1490
  }
1205
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
+ }
1206
1500
  function isUsingIntegration(name) {
1207
1501
  return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Using ${external_pintor_default().brightBlue(name)}...`;
1208
1502
  }
1209
1503
  function youAreAllSet(name) {
1210
1504
  return `${external_pintor_default().green("\u25BA\u25BA\u25BA")} ${name} installation completed. Run again to proceed.`;
1211
1505
  }
1212
- var integrations = __webpack_require__("./webpack/plugin-css/css-lib/integrations.ts");
1506
+ var css_lib_integrations = __webpack_require__("./webpack/plugin-css/css-lib/integrations.ts");
1213
1507
  let sass_userMessageDelivered = false;
1214
1508
  function isUsingSass(projectPath) {
1215
- if ((0, integrations.S)(projectPath, 'sass')) {
1509
+ if ((0, css_lib_integrations.S)(projectPath, 'sass')) {
1216
1510
  if (!sass_userMessageDelivered) {
1217
1511
  if ('development' === process.env.EXTENSION_ENV) console.log(isUsingIntegration('SASS'));
1218
1512
  sass_userMessageDelivered = true;
@@ -1231,12 +1525,12 @@ var __webpack_exports__ = {};
1231
1525
  'postcss-scss',
1232
1526
  'postcss-preset-env'
1233
1527
  ];
1234
- await (0, integrations.b)('PostCSS', postCssDependencies);
1528
+ await (0, css_lib_integrations.b)('PostCSS', postCssDependencies);
1235
1529
  const sassDependencies = [
1236
1530
  'sass',
1237
1531
  'sass-loader'
1238
1532
  ];
1239
- await (0, integrations.b)('SASS', sassDependencies);
1533
+ await (0, css_lib_integrations.b)('SASS', sassDependencies);
1240
1534
  console.log(youAreAllSet('SASS'));
1241
1535
  process.exit(0);
1242
1536
  }
@@ -1291,7 +1585,7 @@ var __webpack_exports__ = {};
1291
1585
  }
1292
1586
  let less_userMessageDelivered = false;
1293
1587
  function isUsingLess(projectPath) {
1294
- if ((0, integrations.S)(projectPath, 'less')) {
1588
+ if ((0, css_lib_integrations.S)(projectPath, 'less')) {
1295
1589
  if (!less_userMessageDelivered) {
1296
1590
  if ('development' === process.env.EXTENSION_ENV) console.log(isUsingIntegration('LESS'));
1297
1591
  less_userMessageDelivered = true;
@@ -1310,7 +1604,7 @@ var __webpack_exports__ = {};
1310
1604
  'less',
1311
1605
  'less-loader'
1312
1606
  ];
1313
- await (0, integrations.b)('LESS', lessDependencies);
1607
+ await (0, css_lib_integrations.b)('LESS', lessDependencies);
1314
1608
  console.log(youAreAllSet('LESS'));
1315
1609
  process.exit(0);
1316
1610
  }
@@ -1391,7 +1685,7 @@ var __webpack_exports__ = {};
1391
1685
  }
1392
1686
  let tailwind_userMessageDelivered = false;
1393
1687
  function tailwind_isUsingTailwind(projectPath) {
1394
- const isUsingTailwind = (0, integrations.S)(projectPath, 'tailwindcss');
1688
+ const isUsingTailwind = (0, css_lib_integrations.S)(projectPath, 'tailwindcss');
1395
1689
  if (isUsingTailwind) {
1396
1690
  if (!tailwind_userMessageDelivered) {
1397
1691
  if ('development' === process.env.EXTENSION_ENV) console.log(isUsingIntegration('Tailwind'));
@@ -1400,6 +1694,14 @@ var __webpack_exports__ = {};
1400
1694
  }
1401
1695
  return isUsingTailwind;
1402
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
+ }
1403
1705
  let postcss_userMessageDelivered = false;
1404
1706
  const postCssConfigFiles = [
1405
1707
  '.postcssrc',
@@ -1418,7 +1720,7 @@ var __webpack_exports__ = {};
1418
1720
  }
1419
1721
  }
1420
1722
  function isUsingPostCss(projectPath) {
1421
- if ((0, integrations.S)(projectPath, 'postcss')) {
1723
+ if ((0, css_lib_integrations.S)(projectPath, 'postcss')) {
1422
1724
  if (!postcss_userMessageDelivered) {
1423
1725
  if ('development' === process.env.EXTENSION_ENV) console.log(isUsingIntegration('PostCSS'));
1424
1726
  postcss_userMessageDelivered = true;
@@ -1443,16 +1745,20 @@ var __webpack_exports__ = {};
1443
1745
  }
1444
1746
  async function maybeUsePostCss(projectPath, opts) {
1445
1747
  if (!isUsingPostCss(projectPath)) return {};
1748
+ const userPostCssConfig = findPostCssConfig(projectPath);
1446
1749
  try {
1447
1750
  require.resolve('postcss-loader');
1448
1751
  } catch (e) {
1449
1752
  if (!isUsingSass(projectPath) && !isUsingLess(projectPath)) {
1450
- const postCssDependencies = [
1753
+ const postCssDependencies = userPostCssConfig ? [
1754
+ 'postcss',
1755
+ 'postcss-loader'
1756
+ ] : [
1451
1757
  'postcss',
1452
1758
  'postcss-loader',
1453
1759
  'postcss-preset-env'
1454
1760
  ];
1455
- await (0, integrations.b)('PostCSS', postCssDependencies);
1761
+ await (0, css_lib_integrations.b)('PostCSS', postCssDependencies);
1456
1762
  }
1457
1763
  console.log(youAreAllSet('PostCSS'));
1458
1764
  process.exit(0);
@@ -1464,8 +1770,8 @@ var __webpack_exports__ = {};
1464
1770
  options: {
1465
1771
  postcssOptions: {
1466
1772
  ident: 'postcss',
1467
- config: findPostCssConfig(projectPath),
1468
- plugins: [
1773
+ config: userPostCssConfig,
1774
+ plugins: userPostCssConfig ? [] : [
1469
1775
  [
1470
1776
  'postcss-preset-env',
1471
1777
  {
@@ -1670,6 +1976,23 @@ var __webpack_exports__ = {};
1670
1976
  ...compiler.options.module.rules,
1671
1977
  ...loaders
1672
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
+ }
1673
1996
  }
1674
1997
  async apply(compiler) {
1675
1998
  const mode = compiler.options.mode || 'development';
@@ -1682,6 +2005,54 @@ var __webpack_exports__ = {};
1682
2005
  }
1683
2006
  }
1684
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
+ }
1685
2056
  function plugin_static_assets_define_property(obj, key, value) {
1686
2057
  if (key in obj) Object.defineProperty(obj, key, {
1687
2058
  value: value,
@@ -1752,6 +2123,37 @@ var __webpack_exports__ = {};
1752
2123
  ...compiler.options.module.rules,
1753
2124
  ...loaders
1754
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
+ }
1755
2157
  }
1756
2158
  constructor(options){
1757
2159
  plugin_static_assets_define_property(this, "mode", void 0);
@@ -1773,6 +2175,19 @@ var __webpack_exports__ = {};
1773
2175
  function isUsingCustomLoader(loaderPath) {
1774
2176
  return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Using custom loader: ${external_pintor_default().yellow(loaderPath)}.`;
1775
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
+ }
1776
2191
  function isUsingJSFramework(projectPath) {
1777
2192
  const frameworks = [
1778
2193
  'react',
@@ -1786,7 +2201,7 @@ var __webpack_exports__ = {};
1786
2201
  }
1787
2202
  let preact_userMessageDelivered = false;
1788
2203
  function isUsingPreact(projectPath) {
1789
- if ((0, integrations.S)(projectPath, 'preact')) {
2204
+ if ((0, css_lib_integrations.S)(projectPath, 'preact')) {
1790
2205
  if (!preact_userMessageDelivered) {
1791
2206
  if ('development' === process.env.EXTENSION_ENV) console.log(messages_isUsingIntegration('Preact'));
1792
2207
  preact_userMessageDelivered = true;
@@ -1806,7 +2221,7 @@ var __webpack_exports__ = {};
1806
2221
  '@rspack/plugin-preact-refresh',
1807
2222
  'preact'
1808
2223
  ];
1809
- await (0, integrations.b)('Preact', preactDependencies);
2224
+ await (0, css_lib_integrations.b)('Preact', preactDependencies);
1810
2225
  console.log(messages_youAreAllSet('Preact'));
1811
2226
  process.exit(0);
1812
2227
  }
@@ -1828,7 +2243,7 @@ var __webpack_exports__ = {};
1828
2243
  var plugin_react_refresh_default = /*#__PURE__*/ __webpack_require__.n(plugin_react_refresh_namespaceObject);
1829
2244
  let react_userMessageDelivered = false;
1830
2245
  function isUsingReact(projectPath) {
1831
- if ((0, integrations.S)(projectPath, 'react')) {
2246
+ if ((0, css_lib_integrations.S)(projectPath, 'react')) {
1832
2247
  if (!react_userMessageDelivered) {
1833
2248
  if ('development' === process.env.EXTENSION_ENV) console.log(messages_isUsingIntegration('React'));
1834
2249
  react_userMessageDelivered = true;
@@ -1846,7 +2261,7 @@ var __webpack_exports__ = {};
1846
2261
  'react-refresh',
1847
2262
  '@rspack/plugin-react-refresh'
1848
2263
  ];
1849
- await (0, integrations.b)('React', reactDependencies);
2264
+ await (0, css_lib_integrations.b)('React', reactDependencies);
1850
2265
  console.log(messages_youAreAllSet('React'));
1851
2266
  process.exit(0);
1852
2267
  }
@@ -1915,7 +2330,7 @@ var __webpack_exports__ = {};
1915
2330
  }
1916
2331
  let vue_userMessageDelivered = false;
1917
2332
  function isUsingVue(projectPath) {
1918
- const using = (0, integrations.S)(projectPath, 'vue');
2333
+ const using = (0, css_lib_integrations.S)(projectPath, 'vue');
1919
2334
  if (using && !vue_userMessageDelivered) {
1920
2335
  if ('development' === process.env.EXTENSION_ENV) console.log(messages_isUsingIntegration('Vue'));
1921
2336
  vue_userMessageDelivered = true;
@@ -1931,7 +2346,7 @@ var __webpack_exports__ = {};
1931
2346
  'vue-loader',
1932
2347
  '@vue/compiler-sfc'
1933
2348
  ];
1934
- await (0, integrations.b)('Vue', vueDependencies);
2349
+ await (0, css_lib_integrations.b)('Vue', vueDependencies);
1935
2350
  console.log(messages_youAreAllSet('Vue'));
1936
2351
  process.exit(0);
1937
2352
  }
@@ -2071,7 +2486,7 @@ var __webpack_exports__ = {};
2071
2486
  }
2072
2487
  }
2073
2488
  function isUsingSvelte(projectPath) {
2074
- const using = (0, integrations.S)(projectPath, 'svelte');
2489
+ const using = (0, css_lib_integrations.S)(projectPath, 'svelte');
2075
2490
  if (using && !svelte_userMessageDelivered) {
2076
2491
  if ('development' === process.env.EXTENSION_ENV) console.log(messages_isUsingIntegration('Svelte'));
2077
2492
  svelte_userMessageDelivered = true;
@@ -2086,11 +2501,11 @@ var __webpack_exports__ = {};
2086
2501
  const typeScriptDependencies = [
2087
2502
  "typescript"
2088
2503
  ];
2089
- await (0, integrations.b)('TypeScript', typeScriptDependencies);
2504
+ await (0, css_lib_integrations.b)('TypeScript', typeScriptDependencies);
2090
2505
  const svelteDependencies = [
2091
2506
  'svelte-loader'
2092
2507
  ];
2093
- await (0, integrations.b)('Svelte', svelteDependencies);
2508
+ await (0, css_lib_integrations.b)('Svelte', svelteDependencies);
2094
2509
  console.log(messages_youAreAllSet('Svelte'));
2095
2510
  process.exit(0);
2096
2511
  }
@@ -2105,7 +2520,7 @@ var __webpack_exports__ = {};
2105
2520
  const typeScriptDependencies = [
2106
2521
  "typescript"
2107
2522
  ];
2108
- await (0, integrations.b)('TypeScript', typeScriptDependencies);
2523
+ await (0, css_lib_integrations.b)('TypeScript', typeScriptDependencies);
2109
2524
  console.log(messages_youAreAllSet('TypeScript'));
2110
2525
  process.exit(0);
2111
2526
  }
@@ -2296,6 +2711,21 @@ var __webpack_exports__ = {};
2296
2711
  if (isUsingTypeScript(projectPath) || !!tsConfigPath) compiler.options.resolve.tsConfig = {
2297
2712
  configFile: tsConfigPath
2298
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
+ }
2299
2729
  }
2300
2730
  async apply(compiler) {
2301
2731
  const mode = compiler.options.mode || 'development';
@@ -2333,6 +2763,29 @@ var __webpack_exports__ = {};
2333
2763
  lines.push(`${external_pintor_default().red('ERROR')} ${external_pintor_default().red(String(error))}`);
2334
2764
  return lines.join('\n');
2335
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
+ }
2336
2789
  function emit_manifest_define_property(obj, key, value) {
2337
2790
  if (key in obj) Object.defineProperty(obj, key, {
2338
2791
  value: value,
@@ -2364,6 +2817,7 @@ var __webpack_exports__ = {};
2364
2817
  const jsonString = JSON.stringify(jsonContent, null, 2);
2365
2818
  const outputFilename = 'manifest.json';
2366
2819
  compilation.emitAsset(outputFilename, new core_namespaceObject.sources.RawSource(jsonString));
2820
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(manifestEmitSuccess());
2367
2821
  });
2368
2822
  });
2369
2823
  }
@@ -2570,7 +3024,7 @@ var __webpack_exports__ = {};
2570
3024
  ...themeExperiment(manifest)
2571
3025
  };
2572
3026
  }
2573
- function action(manifest) {
3027
+ function action_action(manifest) {
2574
3028
  return manifest.action && {
2575
3029
  action: {
2576
3030
  ...manifest.action,
@@ -2644,7 +3098,7 @@ var __webpack_exports__ = {};
2644
3098
  }
2645
3099
  function manifestV3(manifest) {
2646
3100
  return {
2647
- ...action(manifest),
3101
+ ...action_action(manifest),
2648
3102
  ...backgroundServiceWorker(manifest),
2649
3103
  ...declarativeNetRequest(manifest),
2650
3104
  ...hostPermissions(manifest),
@@ -2949,6 +3403,17 @@ var __webpack_exports__ = {};
2949
3403
  if ('development' === compiler.options.mode) {
2950
3404
  if (patchedManifest.content_scripts) patchedManifest.content_scripts = this.applyDevOverrides(patchedManifest);
2951
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 {}
2952
3417
  const source = JSON.stringify(patchedManifest, null, 2);
2953
3418
  const rawSource = new core_namespaceObject.sources.RawSource(source);
2954
3419
  compilation.updateAsset('manifest.json', rawSource);
@@ -2961,6 +3426,11 @@ var __webpack_exports__ = {};
2961
3426
  ...manifest,
2962
3427
  ...JSON.parse(overrides)
2963
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 {}
2964
3434
  const source = JSON.stringify(patchedManifest, null, 2);
2965
3435
  const rawSource = new core_namespaceObject.sources.RawSource(source);
2966
3436
  compilation.updateAsset('manifest.json', rawSource);
@@ -2996,6 +3466,10 @@ var __webpack_exports__ = {};
2996
3466
  if (deps !== compilation.fileDependencies && 'function' == typeof (null == (_compilation_fileDependencies = compilation.fileDependencies) ? void 0 : _compilation_fileDependencies.add)) compilation.fileDependencies.add(dependency);
2997
3467
  }
2998
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
+ }
2999
3473
  });
3000
3474
  }
3001
3475
  constructor(dependencyList){
@@ -3070,6 +3544,7 @@ var __webpack_exports__ = {};
3070
3544
  if (!(null == (_this_pendingChange = this.pendingChange) ? void 0 : _this_pendingChange.hasChange)) return;
3071
3545
  const fileAdded = this.pendingChange.fileAdded;
3072
3546
  const fileRemoved = this.pendingChange.fileRemoved;
3547
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(manifestRecompileDetected(fileAdded, fileRemoved));
3073
3548
  const manifestEntrypointChangeWarning = new core_namespaceObject.WebpackError(serverRestartRequiredFromManifestError(fileAdded || '', fileRemoved || ''));
3074
3549
  manifestEntrypointChangeWarning.file = 'manifest.json';
3075
3550
  compilation.errors.push(manifestEntrypointChangeWarning);
@@ -3114,17 +3589,18 @@ var __webpack_exports__ = {};
3114
3589
  compiler.hooks.thisCompilation.tap(ManifestLegacyWarnings.name, (compilation)=>{
3115
3590
  const asset = compilation.getAsset('manifest.json');
3116
3591
  if (!asset) return;
3117
- try {
3118
- const text = asset.source.source().toString();
3119
- legacy.forEach((needle)=>{
3120
- if (text.includes(needle)) {
3121
- const warn = new core_namespaceObject.WebpackError(legacyManifestPathWarning(needle));
3122
- warn.name = 'ManifestLegacyWarning';
3123
- warn.file = 'manifest.json';
3124
- compilation.warnings.push(warn);
3125
- }
3126
- });
3127
- } catch {}
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));
3128
3604
  });
3129
3605
  }
3130
3606
  }
@@ -3141,6 +3617,7 @@ var __webpack_exports__ = {};
3141
3617
  }
3142
3618
  class ManifestPlugin {
3143
3619
  apply(compiler) {
3620
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(manifestIncludeSummary(String(this.browser || 'chrome'), this.manifestPath));
3144
3621
  new EmitManifest({
3145
3622
  manifestPath: this.manifestPath
3146
3623
  }).apply(compiler);
@@ -4041,7 +4518,8 @@ var __webpack_exports__ = {};
4041
4518
  const existing = 'function' == typeof getAssetFn ? getAssetFn.call(compilation, assetFilename) : null == (_compilation_assets = compilation.assets) ? void 0 : _compilation_assets[assetFilename];
4042
4519
  if (!existing) continue;
4043
4520
  const updated = patchHtml(compilation, feature, resolved, this.includeList || {});
4044
- if (updated && 'string' == typeof updated) compilation.updateAsset(assetFilename, new core_namespaceObject.sources.RawSource(updated));
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));
4045
4523
  }
4046
4524
  };
4047
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);
@@ -4496,6 +4974,20 @@ var __webpack_exports__ = {};
4496
4974
  });
4497
4975
  return fileAssets;
4498
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
+ }
4499
4991
  function add_scripts_define_property(obj, key, value) {
4500
4992
  if (key in obj) Object.defineProperty(obj, key, {
4501
4993
  value: value,
@@ -4545,6 +5037,8 @@ var __webpack_exports__ = {};
4545
5037
  const fallbackContext = external_path_.dirname(this.manifestPath);
4546
5038
  const projectPath = compiler.options.context || fallbackContext;
4547
5039
  const publicDir = external_path_.join(projectPath, 'public');
5040
+ let entriesAdded = 0;
5041
+ let publicTracked = 0;
4548
5042
  for (const [feature, scriptPath] of Object.entries(scriptFields)){
4549
5043
  const scriptImports = getScriptEntries(scriptPath);
4550
5044
  const cssImports = getCssEntries(scriptPath);
@@ -4557,24 +5051,28 @@ var __webpack_exports__ = {};
4557
5051
  const isUnderPublic = rel && !rel.startsWith('..') && !external_path_.isAbsolute(rel);
4558
5052
  return !isUnderPublic;
4559
5053
  });
4560
- if (cssImports.length || scriptImports.length) if ('background/service_worker' === feature) {
4561
- var _manifest_background;
4562
- const manifest = JSON.parse(external_fs_.readFileSync(this.manifestPath, 'utf8'));
4563
- const isModuleServiceWorker = (null == (_manifest_background = manifest.background) ? void 0 : _manifest_background.type) === 'module';
4564
- newEntries[feature] = {
4565
- import: entryImports,
4566
- ...isModuleServiceWorker ? {} : {
4567
- chunkLoading: "import-scripts"
4568
- }
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
4569
5067
  };
4570
- } else newEntries[feature] = {
4571
- import: entryImports
4572
- };
5068
+ entriesAdded++;
5069
+ }
4573
5070
  }
4574
5071
  compiler.options.entry = {
4575
5072
  ...compiler.options.entry,
4576
5073
  ...newEntries
4577
5074
  };
5075
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(scriptsEntriesSummary(entriesAdded, publicTracked));
4578
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)=>{
4579
5077
  try {
4580
5078
  const allScriptFieldImports = Object.values(scriptFields).flatMap((scriptFieldEntry)=>[].concat(...Array.isArray(scriptFieldEntry) ? scriptFieldEntry : scriptFieldEntry ? [
@@ -4584,7 +5082,10 @@ var __webpack_exports__ = {};
4584
5082
  const rel = external_path_.relative(publicDir, String(importPath));
4585
5083
  return rel && !rel.startsWith('..') && !external_path_.isAbsolute(rel);
4586
5084
  });
4587
- for (const publicFilePath of publicFilesOnly)if (external_fs_.existsSync(publicFilePath)) compilation.fileDependencies.add(publicFilePath);
5085
+ for (const publicFilePath of publicFilesOnly)if (external_fs_.existsSync(publicFilePath)) {
5086
+ compilation.fileDependencies.add(publicFilePath);
5087
+ publicTracked++;
5088
+ }
4588
5089
  } catch {}
4589
5090
  });
4590
5091
  }
@@ -5196,6 +5697,7 @@ var __webpack_exports__ = {};
5196
5697
  }, ()=>{
5197
5698
  var _this_pending;
5198
5699
  if (!(null == (_this_pending = this.pending) ? void 0 : _this_pending.hasChange)) return;
5700
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(scriptsManifestChangeDetected(this.pending.pathBefore, this.pending.pathAfter));
5199
5701
  const lines = [];
5200
5702
  lines.push("Entrypoint references changed in scripts. Restart the dev server to pick up changes to manifest script entrypoints.");
5201
5703
  lines.push('');
@@ -5231,6 +5733,10 @@ var __webpack_exports__ = {};
5231
5733
  apply(compiler) {
5232
5734
  const hasValidManifest = !!this.manifestPath && external_fs_.existsSync(this.manifestPath) && external_fs_.lstatSync(this.manifestPath).isFile();
5233
5735
  if (!hasValidManifest) return;
5736
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
5737
+ const featuresCount = Object.keys(this.includeList || {}).length;
5738
+ console.log(scriptsIncludeSummary(featuresCount, 'production' !== compiler.options.mode, String(this.browser || 'chrome')));
5739
+ }
5234
5740
  new AddScripts({
5235
5741
  manifestPath: this.manifestPath,
5236
5742
  includeList: this.includeList || {}
@@ -5291,6 +5797,19 @@ var __webpack_exports__ = {};
5291
5797
  const final = `MISSING KEY ${key} in ${localePath}`;
5292
5798
  return `${header}\n${guidance}\n\n${final}`;
5293
5799
  }
5800
+ function localesIncludeSummary(hasManifest, hasLocalesRoot, defaultLocale) {
5801
+ const dl = defaultLocale ? `default_locale=${defaultLocale}` : 'default_locale=<none>';
5802
+ return `Locales include summary \u{2014} manifest=${String(hasManifest)}, localesRoot=${String(hasLocalesRoot)}, ${dl}`;
5803
+ }
5804
+ function localesEmitSummary(emitted, missing, discovered) {
5805
+ return `Locales emitted=${String(emitted)}, missing=${String(missing)}, discovered=${String(discovered)}`;
5806
+ }
5807
+ function localesDepsTracked(addedCount) {
5808
+ return `Locales file dependencies tracked: ${String(addedCount)}`;
5809
+ }
5810
+ function localesValidationDetected(issue) {
5811
+ return `Locales validation detected: ${issue}`;
5812
+ }
5294
5813
  function getLocales(manifestPath) {
5295
5814
  const localesFolder = external_path_.join(external_path_.dirname(manifestPath), '_locales');
5296
5815
  const localeFiles = [];
@@ -5343,16 +5862,30 @@ var __webpack_exports__ = {};
5343
5862
  const defaultLocale = null == manifest ? void 0 : manifest.default_locale;
5344
5863
  const localesRoot = external_path_.join(manifestDir, '_locales');
5345
5864
  const hasLocalesRoot = external_fs_.existsSync(localesRoot);
5865
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesIncludeSummary(true, hasLocalesRoot, 'string' == typeof defaultLocale ? defaultLocale : void 0));
5346
5866
  if ('string' == typeof defaultLocale && defaultLocale.trim()) {
5347
- if (!hasLocalesRoot) return void pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleSpecifiedButLocalesMissing(), 'manifest.json');
5867
+ if (!hasLocalesRoot) {
5868
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected('default_locale set but _locales missing'));
5869
+ pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleSpecifiedButLocalesMissing(), 'manifest.json');
5870
+ return;
5871
+ }
5348
5872
  const defaultLocaleDir = external_path_.join(localesRoot, defaultLocale);
5349
- if (!external_fs_.existsSync(defaultLocaleDir)) return void pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleFolderMissing(defaultLocale), 'manifest.json');
5873
+ if (!external_fs_.existsSync(defaultLocaleDir)) {
5874
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing _locales/${defaultLocale}`));
5875
+ pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleFolderMissing(defaultLocale), 'manifest.json');
5876
+ return;
5877
+ }
5350
5878
  const messagesJsonPath = external_path_.join(defaultLocaleDir, 'messages.json');
5351
- if (!external_fs_.existsSync(messagesJsonPath)) return void pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleMessagesMissing(defaultLocale), 'manifest.json');
5879
+ if (!external_fs_.existsSync(messagesJsonPath)) {
5880
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing _locales/${defaultLocale}/messages.json`));
5881
+ pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleMessagesMissing(defaultLocale), 'manifest.json');
5882
+ return;
5883
+ }
5352
5884
  try {
5353
5885
  const content = external_fs_.readFileSync(messagesJsonPath, 'utf8');
5354
5886
  JSON.parse(content);
5355
5887
  } catch (e) {
5888
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`invalid JSON in _locales/${defaultLocale}/messages.json`));
5356
5889
  pushCompilationError(compiler, compilation, 'LocalesValidationError', invalidMessagesJson(messagesJsonPath), 'manifest.json');
5357
5890
  return;
5358
5891
  }
@@ -5374,10 +5907,18 @@ var __webpack_exports__ = {};
5374
5907
  collectMsgKeys(manifest, referenced);
5375
5908
  for (const key of referenced){
5376
5909
  const entry = null == dict ? void 0 : dict[key];
5377
- if (!entry || 'string' != typeof entry.message) return void pushCompilationError(compiler, compilation, 'LocalesValidationError', missingManifestMessageKey(key, defaultLocale), 'manifest.json');
5910
+ if (!entry || 'string' != typeof entry.message) {
5911
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing key "${key}" in default locale`));
5912
+ pushCompilationError(compiler, compilation, 'LocalesValidationError', missingManifestMessageKey(key, defaultLocale), 'manifest.json');
5913
+ return;
5914
+ }
5378
5915
  }
5379
5916
  } catch {}
5380
- } else if (hasLocalesRoot) return void pushCompilationError(compiler, compilation, 'LocalesValidationError', localesPresentButNoDefaultLocale(), 'manifest.json');
5917
+ } else if (hasLocalesRoot) {
5918
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected('_locales present but no default_locale'));
5919
+ pushCompilationError(compiler, compilation, 'LocalesValidationError', localesPresentButNoDefaultLocale(), 'manifest.json');
5920
+ return;
5921
+ }
5381
5922
  } catch {}
5382
5923
  if (compilation.errors.length > 0) return;
5383
5924
  try {
@@ -5391,6 +5932,7 @@ var __webpack_exports__ = {};
5391
5932
  const s = external_fs_.readFileSync(msgPath, 'utf8');
5392
5933
  JSON.parse(s);
5393
5934
  } catch {
5935
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`invalid JSON in ${msgPath}`));
5394
5936
  pushCompilationError(compiler, compilation, 'LocalesValidationError', invalidMessagesJson(msgPath), 'manifest.json');
5395
5937
  return;
5396
5938
  }
@@ -5398,6 +5940,9 @@ var __webpack_exports__ = {};
5398
5940
  }
5399
5941
  } catch {}
5400
5942
  const localesFields = getLocales(this.manifestPath);
5943
+ const discoveredList = getLocales(this.manifestPath) || [];
5944
+ let emittedCount = 0;
5945
+ let missingCount = 0;
5401
5946
  for (const field of Object.entries(localesFields || [])){
5402
5947
  const [feature, resource] = field;
5403
5948
  const thisResource = resource;
@@ -5411,6 +5956,7 @@ var __webpack_exports__ = {};
5411
5956
  warning.name = 'LocalesPluginMissingFile';
5412
5957
  if (!compilation.warnings) compilation.warnings = [];
5413
5958
  compilation.warnings.push(warning);
5959
+ missingCount++;
5414
5960
  continue;
5415
5961
  }
5416
5962
  const source = external_fs_.readFileSync(thisResource);
@@ -5421,8 +5967,10 @@ var __webpack_exports__ = {};
5421
5967
  const normalizedRel = relativeToLocales.split(external_path_.sep).join('/');
5422
5968
  const filename = `_locales/${normalizedRel}`;
5423
5969
  compilation.emitAsset(filename, rawSource);
5970
+ emittedCount++;
5424
5971
  }
5425
5972
  }
5973
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesEmitSummary(emittedCount, missingCount, discoveredList.length));
5426
5974
  });
5427
5975
  });
5428
5976
  compiler.hooks.thisCompilation.tap('locales:module', (compilation)=>{
@@ -5433,6 +5981,7 @@ var __webpack_exports__ = {};
5433
5981
  var _compilation_errors;
5434
5982
  if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
5435
5983
  const localesFields = getLocales(this.manifestPath);
5984
+ let added = 0;
5436
5985
  for (const field of Object.entries(localesFields || [])){
5437
5986
  const [, resource] = field;
5438
5987
  if (resource) {
@@ -5442,10 +5991,12 @@ var __webpack_exports__ = {};
5442
5991
  if (!fileDependencies.has(thisResource)) {
5443
5992
  fileDependencies.add(thisResource);
5444
5993
  compilation.fileDependencies.add(thisResource);
5994
+ added++;
5445
5995
  }
5446
5996
  }
5447
5997
  }
5448
5998
  }
5999
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesDepsTracked(added));
5449
6000
  });
5450
6001
  });
5451
6002
  }
@@ -5493,6 +6044,23 @@ var __webpack_exports__ = {};
5493
6044
  `${external_pintor_default().red('INVALID SHAPE')} ${external_pintor_default().underline(file)}`
5494
6045
  ].join('\n');
5495
6046
  }
6047
+ function jsonEmitSummary(feature, stats) {
6048
+ return `JSON ${external_pintor_default().yellow(feature)} \u{2014} entries ${external_pintor_default().gray(String(stats.entries))}, public ${external_pintor_default().gray(String(stats.underPublic))}, emitted ${external_pintor_default().gray(String(stats.emitted))}, missing ${external_pintor_default().gray(String(stats.missing))}, valid ${external_pintor_default().gray(String(stats.validatedOk))}, invalid ${external_pintor_default().gray(String(stats.invalid))}`;
6049
+ }
6050
+ function jsonDepsTracked(addedCount) {
6051
+ return `JSON file dependencies tracked: ${external_pintor_default().gray(String(addedCount))}`;
6052
+ }
6053
+ function jsonIncludeSummary(totalFeatures, criticalCount) {
6054
+ return `JSON include summary \u{2014} features ${external_pintor_default().gray(String(totalFeatures))}, critical ${external_pintor_default().gray(String(criticalCount))}`;
6055
+ }
6056
+ function jsonManifestChangeDetected(field, before, after) {
6057
+ const parts = [
6058
+ `Manifest JSON change detected in ${external_pintor_default().yellow(field)}`,
6059
+ before ? `${external_pintor_default().gray('before')} ${external_pintor_default().underline(before)}` : '',
6060
+ after ? `${external_pintor_default().gray('after')} ${external_pintor_default().underline(after)}` : ''
6061
+ ].filter(Boolean);
6062
+ return parts.join(" \u2014 ");
6063
+ }
5496
6064
  const external_node_module_namespaceObject = require("node:module");
5497
6065
  function throw_if_manifest_json_change_define_property(obj, key, value) {
5498
6066
  if (key in obj) Object.defineProperty(obj, key, {
@@ -5588,6 +6156,7 @@ var __webpack_exports__ = {};
5588
6156
  }, ()=>{
5589
6157
  var _this_pending;
5590
6158
  if (!(null == (_this_pending = this.pending) ? void 0 : _this_pending.hasChange)) return;
6159
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(jsonManifestChangeDetected(String(this.pending.manifestField || 'json'), this.pending.pathBefore, this.pending.pathAfter));
5591
6160
  const issue = new core_namespaceObject.WebpackError(buildRestartMessage(this.pending.manifestField, this.pending.pathAfter, this.pending.pathBefore));
5592
6161
  issue.file = 'manifest.json';
5593
6162
  compilation.errors.push(issue);
@@ -5665,8 +6234,18 @@ var __webpack_exports__ = {};
5665
6234
  const manifestDir = external_path_.dirname(this.manifestPath);
5666
6235
  const projectPath = (null == (_compiler_options = compiler.options) ? void 0 : _compiler_options.context) || external_path_.dirname(this.manifestPath);
5667
6236
  const publicDir = external_path_.join(projectPath, 'public');
6237
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
6238
+ const featureKeys = Object.keys(jsonFields || {});
6239
+ const criticalCount = featureKeys.filter((k)=>this.isCriticalJsonFeature(k)).length;
6240
+ console.log(jsonIncludeSummary(featureKeys.length, criticalCount));
6241
+ }
5668
6242
  for (const field of Object.entries(jsonFields)){
5669
6243
  const [feature, resource] = field;
6244
+ let emittedCount = 0;
6245
+ let underPublicCount = 0;
6246
+ let missingCount = 0;
6247
+ let validatedOk = 0;
6248
+ let invalid = 0;
5670
6249
  const resourceArr = Array.isArray(resource) ? resource : [
5671
6250
  resource
5672
6251
  ];
@@ -5687,24 +6266,45 @@ var __webpack_exports__ = {};
5687
6266
  notFound.file = 'manifest.json';
5688
6267
  if (this.isCriticalJsonFeature(feature)) compilation.errors.push(notFound);
5689
6268
  else compilation.warnings.push(notFound);
6269
+ missingCount++;
5690
6270
  continue;
5691
6271
  }
5692
6272
  if (isUnderPublic) {
5693
6273
  try {
5694
6274
  compilation.fileDependencies.add(abs);
5695
6275
  } catch {}
5696
- if (this.isCriticalJsonFeature(feature)) this.validateJsonAsset(compilation, feature, abs, external_fs_.readFileSync(abs));
6276
+ if (this.isCriticalJsonFeature(feature)) {
6277
+ const ok = this.validateJsonAsset(compilation, feature, abs, external_fs_.readFileSync(abs));
6278
+ if (ok) validatedOk++;
6279
+ else invalid++;
6280
+ if (!ok) continue;
6281
+ }
6282
+ underPublicCount++;
5697
6283
  continue;
5698
6284
  }
5699
6285
  const source = external_fs_.readFileSync(abs);
5700
6286
  if (this.isCriticalJsonFeature(feature)) {
5701
6287
  const ok = this.validateJsonAsset(compilation, feature, abs, source);
6288
+ if (ok) validatedOk++;
6289
+ else invalid++;
5702
6290
  if (!ok) continue;
5703
6291
  }
5704
6292
  const rawSource = new core_namespaceObject.sources.RawSource(source);
5705
6293
  const assetName = feature + '.json';
5706
6294
  if ('function' == typeof compilation.getAsset && compilation.getAsset(assetName)) compilation.updateAsset(assetName, rawSource);
5707
6295
  else compilation.emitAsset(assetName, rawSource);
6296
+ emittedCount++;
6297
+ }
6298
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
6299
+ const entries = Array.isArray(resource) ? resource.length : resource ? 1 : 0;
6300
+ console.log(jsonEmitSummary(feature, {
6301
+ entries,
6302
+ underPublic: underPublicCount,
6303
+ emitted: emittedCount,
6304
+ missing: missingCount,
6305
+ validatedOk,
6306
+ invalid
6307
+ }));
5708
6308
  }
5709
6309
  }
5710
6310
  });
@@ -5718,6 +6318,7 @@ var __webpack_exports__ = {};
5718
6318
  if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
5719
6319
  const jsonFields = this.includeList || {};
5720
6320
  const manifestDir = external_path_.dirname(this.manifestPath);
6321
+ let added = 0;
5721
6322
  for (const field of Object.entries(jsonFields)){
5722
6323
  const [, resource] = field;
5723
6324
  const resourceArr = Array.isArray(resource) ? resource : [
@@ -5730,10 +6331,12 @@ var __webpack_exports__ = {};
5730
6331
  if (!fileDependencies.has(abs)) {
5731
6332
  fileDependencies.add(abs);
5732
6333
  compilation.fileDependencies.add(abs);
6334
+ added++;
5733
6335
  }
5734
6336
  }
5735
6337
  }
5736
6338
  }
6339
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(jsonDepsTracked(added));
5737
6340
  });
5738
6341
  });
5739
6342
  }
@@ -5765,6 +6368,23 @@ var __webpack_exports__ = {};
5765
6368
  if (pathAfter) lines.push(`${external_pintor_default().green('PATH AFTER')} ${external_pintor_default().underline(pathAfter)}`);
5766
6369
  return lines.join('\n');
5767
6370
  }
6371
+ function iconsEmitSummary(feature, stats) {
6372
+ return `Icons ${external_pintor_default().yellow(feature)} \u{2014} entries ${external_pintor_default().gray(String(stats.entries))}, public ${external_pintor_default().gray(String(stats.underPublic))}, emitted ${external_pintor_default().gray(String(stats.emitted))}, missing ${external_pintor_default().gray(String(stats.missing))}`;
6373
+ }
6374
+ function iconsDepsTracked(addedCount) {
6375
+ return `Icons file dependencies tracked: ${external_pintor_default().gray(String(addedCount))}`;
6376
+ }
6377
+ function iconsNormalizationSummary(beforeKeys, afterKeys, changedCount) {
6378
+ return `Icons include normalization \u{2014} keys ${external_pintor_default().gray(String(beforeKeys.length))} \u{2192} ${external_pintor_default().gray(String(afterKeys.length))}, normalized ${external_pintor_default().gray(String(changedCount))}`;
6379
+ }
6380
+ function iconsManifestChangeDetected(field, before, after) {
6381
+ const parts = [
6382
+ `Manifest icons change detected in ${external_pintor_default().yellow(field)}`,
6383
+ before ? `${external_pintor_default().gray('before')} ${external_pintor_default().underline(before)}` : '',
6384
+ after ? `${external_pintor_default().gray('after')} ${external_pintor_default().underline(after)}` : ''
6385
+ ].filter(Boolean);
6386
+ return parts.join(" \u2014 ");
6387
+ }
5768
6388
  function emit_file_define_property(obj, key, value) {
5769
6389
  if (key in obj) Object.defineProperty(obj, key, {
5770
6390
  value: value,
@@ -5818,6 +6438,10 @@ var __webpack_exports__ = {};
5818
6438
  return [];
5819
6439
  };
5820
6440
  const stringEntries = normalizeToStrings(resource);
6441
+ let emittedCount = 0;
6442
+ let underPublicCount = 0;
6443
+ let missingCount = 0;
6444
+ const entriesTotal = stringEntries.length;
5821
6445
  for (const entry of stringEntries)if (entry) {
5822
6446
  const manifestDir = external_path_.dirname(this.manifestPath);
5823
6447
  let resolved = entry;
@@ -5840,12 +6464,14 @@ var __webpack_exports__ = {};
5840
6464
  type: severity,
5841
6465
  file: 'manifest.json'
5842
6466
  });
6467
+ missingCount++;
5843
6468
  continue;
5844
6469
  }
5845
6470
  if (isUnderPublic) {
5846
6471
  try {
5847
6472
  compilation.fileDependencies.add(resolved);
5848
6473
  } catch {}
6474
+ underPublicCount++;
5849
6475
  continue;
5850
6476
  }
5851
6477
  const source = external_fs_.readFileSync(resolved);
@@ -5859,7 +6485,14 @@ var __webpack_exports__ = {};
5859
6485
  else if ('browser_action' === group && 'theme_icons' === sub) outputDir = 'browser_action';
5860
6486
  const filename = `${outputDir}/${basename}`;
5861
6487
  compilation.emitAsset(filename, rawSource);
6488
+ emittedCount++;
5862
6489
  }
6490
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(iconsEmitSummary(feature, {
6491
+ entries: entriesTotal,
6492
+ underPublic: underPublicCount,
6493
+ emitted: emittedCount,
6494
+ missing: missingCount
6495
+ }));
5863
6496
  }
5864
6497
  });
5865
6498
  });
@@ -5891,6 +6524,7 @@ var __webpack_exports__ = {};
5891
6524
  var _compilation_errors;
5892
6525
  if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
5893
6526
  const iconFields = this.includeList || {};
6527
+ let added = 0;
5894
6528
  for (const field of Object.entries(iconFields)){
5895
6529
  const [, resource] = field;
5896
6530
  const normalizeToStrings = (response)=>{
@@ -5918,10 +6552,12 @@ var __webpack_exports__ = {};
5918
6552
  if (!fileDependencies.has(entry)) {
5919
6553
  fileDependencies.add(entry);
5920
6554
  compilation.fileDependencies.add(entry);
6555
+ added++;
5921
6556
  }
5922
6557
  }
5923
6558
  }
5924
6559
  }
6560
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(iconsDepsTracked(added));
5925
6561
  });
5926
6562
  });
5927
6563
  }
@@ -6009,6 +6645,7 @@ var __webpack_exports__ = {};
6009
6645
  }, ()=>{
6010
6646
  var _this_pending;
6011
6647
  if (!(null == (_this_pending = this.pending) ? void 0 : _this_pending.hasChange)) return;
6648
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(iconsManifestChangeDetected(String(this.pending.manifestField || 'icons'), this.pending.pathBefore, this.pending.pathAfter));
6012
6649
  const body = manifestIconsEntrypointChange(this.pending.manifestField, this.pending.pathAfter, this.pending.pathBefore);
6013
6650
  const issue = new core_namespaceObject.WebpackError(body);
6014
6651
  issue.file = 'manifest.json';
@@ -6048,6 +6685,12 @@ var __webpack_exports__ = {};
6048
6685
  return out;
6049
6686
  };
6050
6687
  const normalizedIncludeList = normalizeIconIncludeKeys(this.includeList);
6688
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
6689
+ const beforeKeys = Object.keys(this.includeList || {});
6690
+ const afterKeys = Object.keys(normalizedIncludeList || {});
6691
+ const changedCount = afterKeys.filter((k)=>k.includes('/default_icon') || k.includes('/theme_icons')).length;
6692
+ console.log(iconsNormalizationSummary(beforeKeys, afterKeys, changedCount));
6693
+ }
6051
6694
  new EmitFile({
6052
6695
  manifestPath: this.manifestPath,
6053
6696
  includeList: normalizedIncludeList
@@ -6195,34 +6838,6 @@ var __webpack_exports__ = {};
6195
6838
  }
6196
6839
  return shared;
6197
6840
  }
6198
- function collect_content_entry_imports_define_property(obj, key, value) {
6199
- if (key in obj) Object.defineProperty(obj, key, {
6200
- value: value,
6201
- enumerable: true,
6202
- configurable: true,
6203
- writable: true
6204
- });
6205
- else obj[key] = value;
6206
- return obj;
6207
- }
6208
- class CollectContentEntryImports {
6209
- apply(compiler) {
6210
- compiler.hooks.thisCompilation.tap('plugin-extension:feature-web-resources:collect-entry-imports', (compilation)=>{
6211
- compilation.hooks.processAssets.tap({
6212
- name: 'plugin-extension:feature-web-resources:collect-entry-imports',
6213
- stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
6214
- }, ()=>{
6215
- const entryImports = collectContentScriptEntryImports(compilation, this.includeList);
6216
- const shared = getSharedFor(compilation);
6217
- shared.entryImports = entryImports;
6218
- });
6219
- });
6220
- }
6221
- constructor(options){
6222
- collect_content_entry_imports_define_property(this, "includeList", void 0);
6223
- this.includeList = options.includeList;
6224
- }
6225
- }
6226
6841
  function warFieldError(filePath, opts) {
6227
6842
  const displayPath = (null == opts ? void 0 : opts.overrideNotFoundPath) || filePath;
6228
6843
  const lines = [];
@@ -6251,6 +6866,48 @@ var __webpack_exports__ = {};
6251
6866
  lines.push(`${external_pintor_default().red('INVALID MATCH PATTERN')} ${external_pintor_default().underline(pattern)}`);
6252
6867
  return lines.join('\n');
6253
6868
  }
6869
+ function entryImportsSummary(entryCount, totalResources) {
6870
+ return `Web resources: content entry imports \u{2014} entries=${String(entryCount)}, resources=${String(totalResources)}`;
6871
+ }
6872
+ function warPatchedSummary(v3Groups, v3ResourcesTotal, v2Resources) {
6873
+ return `Web resources: WAR patched \u{2014} v3Groups=${String(v3Groups)}, v3Resources=${String(v3ResourcesTotal)}, v2Resources=${String(v2Resources)}`;
6874
+ }
6875
+ function collect_content_entry_imports_define_property(obj, key, value) {
6876
+ if (key in obj) Object.defineProperty(obj, key, {
6877
+ value: value,
6878
+ enumerable: true,
6879
+ configurable: true,
6880
+ writable: true
6881
+ });
6882
+ else obj[key] = value;
6883
+ return obj;
6884
+ }
6885
+ class CollectContentEntryImports {
6886
+ apply(compiler) {
6887
+ compiler.hooks.thisCompilation.tap('plugin-extension:feature-web-resources:collect-entry-imports', (compilation)=>{
6888
+ compilation.hooks.processAssets.tap({
6889
+ name: 'plugin-extension:feature-web-resources:collect-entry-imports',
6890
+ stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
6891
+ }, ()=>{
6892
+ const entryImports = collectContentScriptEntryImports(compilation, this.includeList);
6893
+ const shared = getSharedFor(compilation);
6894
+ shared.entryImports = entryImports;
6895
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
6896
+ const keys = Object.keys(entryImports || {});
6897
+ const total = keys.reduce((acc, k)=>{
6898
+ var _entryImports_k;
6899
+ return acc + ((null == (_entryImports_k = entryImports[k]) ? void 0 : _entryImports_k.length) || 0);
6900
+ }, 0);
6901
+ console.log(entryImportsSummary(keys.length, total));
6902
+ }
6903
+ });
6904
+ });
6905
+ }
6906
+ constructor(options){
6907
+ collect_content_entry_imports_define_property(this, "includeList", void 0);
6908
+ this.includeList = options.includeList;
6909
+ }
6910
+ }
6254
6911
  function isPublicRootLike(possiblePath) {
6255
6912
  const normalizedPath = paths_unixify(possiblePath || '');
6256
6913
  return normalizedPath.startsWith('/') || /^(?:\.\/)?public\//i.test(normalizedPath) || /^\/public\//i.test(normalizedPath);
@@ -6604,6 +7261,15 @@ var __webpack_exports__ = {};
6604
7261
  } else if (webAccessibleResourcesV2.length > 0) manifest.web_accessible_resources = Array.from(new Set(webAccessibleResourcesV2)).sort();
6605
7262
  const source = JSON.stringify(manifest, null, 2);
6606
7263
  const rawSource = new core_namespaceObject.sources.RawSource(source);
7264
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
7265
+ const v3Groups = 3 === manifest.manifest_version ? webAccessibleResourcesV3.length : 0;
7266
+ const v3ResourcesTotal = 3 === manifest.manifest_version ? webAccessibleResourcesV3.reduce((sum, g)=>{
7267
+ var _g_resources;
7268
+ return sum + ((null == (_g_resources = g.resources) ? void 0 : _g_resources.length) || 0);
7269
+ }, 0) : 0;
7270
+ const v2Resources = 2 === manifest.manifest_version ? webAccessibleResourcesV2.length : 0;
7271
+ console.log(warPatchedSummary(v3Groups, v3ResourcesTotal, v2Resources));
7272
+ } catch {}
6607
7273
  if (compilation.getAsset('manifest.json')) compilation.updateAsset('manifest.json', rawSource);
6608
7274
  }
6609
7275
  function patch_manifest_war_define_property(obj, key, value) {
@@ -6672,6 +7338,12 @@ var __webpack_exports__ = {};
6672
7338
  function serverRestartRequiredFromSpecialFolderMessageOnly(addingOrRemoving, folder, typeOfAsset) {
6673
7339
  return `${external_pintor_default().red('ERROR')} in ${external_pintor_default().yellow('manifest.json')} entrypoint: ${addingOrRemoving} ${external_pintor_default().yellow(typeOfAsset)} in ${external_pintor_default().underline(folder + '/')} requires a server restart.`;
6674
7340
  }
7341
+ function specialFoldersSetupSummary(hasPublic, copyEnabled, ignoredCount) {
7342
+ return `Special folders setup \u{2014} public=${String(hasPublic)}, copy=${String(copyEnabled)}, ignored=${String(ignoredCount)}`;
7343
+ }
7344
+ function specialFolderChangeDetected(action, folder, relativePath) {
7345
+ return `Special folders change \u{2014} ${action} in ${folder}/: ${relativePath}`;
7346
+ }
6675
7347
  class WarnUponFolderChanges {
6676
7348
  throwCompilationError(compilation, folder, filePath, isAddition) {
6677
7349
  var _compilation_errors;
@@ -6709,24 +7381,36 @@ var __webpack_exports__ = {};
6709
7381
  pagesWatcher.on('add', (filePath)=>{
6710
7382
  const ext = external_path_.extname(filePath).toLowerCase();
6711
7383
  const isHtml = '.html' === ext;
6712
- if (isHtml) this.throwCompilationError(compilation, 'pages', filePath, true);
7384
+ if (isHtml) {
7385
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('add', 'pages', external_path_.relative(projectPath, filePath)));
7386
+ this.throwCompilationError(compilation, 'pages', filePath, true);
7387
+ }
6713
7388
  });
6714
7389
  pagesWatcher.on('unlink', (filePath)=>{
6715
7390
  const ext = external_path_.extname(filePath).toLowerCase();
6716
7391
  const isHtml = '.html' === ext;
6717
- if (isHtml) this.throwCompilationError(compilation, 'pages', filePath);
7392
+ if (isHtml) {
7393
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('remove', 'pages', external_path_.relative(projectPath, filePath)));
7394
+ this.throwCompilationError(compilation, 'pages', filePath);
7395
+ }
6718
7396
  });
6719
7397
  scriptsWatcher.on('add', (filePath)=>{
6720
7398
  const ext = external_path_.extname(filePath).toLowerCase();
6721
7399
  const supported = new Set((extensionsSupported || []).map((e)=>e.toLowerCase()));
6722
7400
  const isScript = supported.has(ext);
6723
- if (isScript) this.throwCompilationError(compilation, "scripts", filePath, true);
7401
+ if (isScript) {
7402
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('add', "scripts", external_path_.relative(projectPath, filePath)));
7403
+ this.throwCompilationError(compilation, "scripts", filePath, true);
7404
+ }
6724
7405
  });
6725
7406
  scriptsWatcher.on('unlink', (filePath)=>{
6726
7407
  const ext = external_path_.extname(filePath).toLowerCase();
6727
7408
  const supported = new Set((extensionsSupported || []).map((e)=>e.toLowerCase()));
6728
7409
  const isScript = supported.has(ext);
6729
- if (isScript) this.throwCompilationError(compilation, "scripts", filePath);
7410
+ if (isScript) {
7411
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('remove', "scripts", external_path_.relative(projectPath, filePath)));
7412
+ this.throwCompilationError(compilation, "scripts", filePath);
7413
+ }
6730
7414
  });
6731
7415
  compiler.hooks.watchClose.tap('WarnUponFolderChanges', ()=>{
6732
7416
  pagesWatcher.close().catch(()=>{});
@@ -6782,6 +7466,7 @@ var __webpack_exports__ = {};
6782
7466
  }
6783
7467
  ]
6784
7468
  }).apply(compiler);
7469
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFoldersSetupSummary(true, true, 1));
6785
7470
  }
6786
7471
  if ('development' === compiler.options.mode) {
6787
7472
  if (compiler.options.watchOptions) new WarnUponFolderChanges().apply(compiler);
@@ -6874,6 +7559,23 @@ var __webpack_exports__ = {};
6874
7559
  function webextensionPolyfillNotFound() {
6875
7560
  return `Warning: webextension-polyfill not found. Browser API polyfill will not be available.\nTo fix this, install webextension-polyfill: npm install webextension-polyfill`;
6876
7561
  }
7562
+ function capitalizedBrowserName(browser) {
7563
+ const b = String(browser || '');
7564
+ const cap = b.charAt(0).toUpperCase() + b.slice(1);
7565
+ return external_pintor_default().yellow(`${cap}`);
7566
+ }
7567
+ function compatibilityPolyfillEnabled(browser, polyfillPath) {
7568
+ return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Compatibility: Polyfill enabled for ${capitalizedBrowserName(browser)}\n${external_pintor_default().gray('ALIAS')} ${external_pintor_default().underline(polyfillPath)}`;
7569
+ }
7570
+ function compatibilityPolyfillSkipped(reason, browser) {
7571
+ return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Compatibility: Polyfill ${external_pintor_default().gray('skipped')} for ${capitalizedBrowserName(browser)} (${external_pintor_default().gray(reason)})`;
7572
+ }
7573
+ function compatibilityPolyfillDisabled(browser) {
7574
+ return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Compatibility: Polyfill ${external_pintor_default().gray('disabled')} for ${capitalizedBrowserName(browser)}`;
7575
+ }
7576
+ function compatibilityManifestFilteredKeys(browser, filteredCount) {
7577
+ return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} Compatibility: Filtered ${external_pintor_default().gray(String(filteredCount))} manifest key(s) for ${capitalizedBrowserName(browser)}`;
7578
+ }
6877
7579
  function feature_polyfill_define_property(obj, key, value) {
6878
7580
  if (key in obj) Object.defineProperty(obj, key, {
6879
7581
  value: value,
@@ -6904,6 +7606,7 @@ var __webpack_exports__ = {};
6904
7606
  new (core_default()).ProvidePlugin({
6905
7607
  browser: 'webextension-polyfill'
6906
7608
  }).apply(compiler);
7609
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityPolyfillEnabled(this.browser, polyfillPath));
6907
7610
  } catch (error) {
6908
7611
  console.warn(webextensionPolyfillNotFound());
6909
7612
  }
@@ -6969,6 +7672,16 @@ var __webpack_exports__ = {};
6969
7672
  else obj[key] = value;
6970
7673
  return obj;
6971
7674
  }
7675
+ function countBrowserPrefixedKeys(obj) {
7676
+ if (!obj || 'object' != typeof obj) return 0;
7677
+ if (Array.isArray(obj)) return obj.reduce((sum, v)=>sum + countBrowserPrefixedKeys(v), 0);
7678
+ let total = 0;
7679
+ for (const key of Object.keys(obj)){
7680
+ if (key.includes(':')) total++;
7681
+ total += countBrowserPrefixedKeys(obj[key]);
7682
+ }
7683
+ return total;
7684
+ }
6972
7685
  class BrowserSpecificFieldsPlugin {
6973
7686
  patchManifest(manifest) {
6974
7687
  const patchedManifest = compatibility_lib_manifest_filterKeysForThisBrowser(manifest, this.browser);
@@ -6981,9 +7694,11 @@ var __webpack_exports__ = {};
6981
7694
  stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
6982
7695
  }, ()=>{
6983
7696
  const manifest = compatibility_lib_manifest_getManifestContent(compilation, this.manifestPath);
7697
+ const filteredCount = countBrowserPrefixedKeys(manifest);
6984
7698
  const patchedSource = this.patchManifest(manifest);
6985
7699
  const rawSource = new core_namespaceObject.sources.RawSource(patchedSource);
6986
7700
  compilation.updateAsset('manifest.json', rawSource);
7701
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityManifestFilteredKeys(this.browser, filteredCount));
6987
7702
  });
6988
7703
  });
6989
7704
  }
@@ -7007,11 +7722,14 @@ var __webpack_exports__ = {};
7007
7722
  class CompatibilityPlugin {
7008
7723
  async apply(compiler) {
7009
7724
  if (this.polyfill) {
7010
- if ('firefox' !== this.browser) new PolyfillPlugin({
7011
- manifestPath: this.manifestPath,
7012
- browser: this.browser || 'chrome'
7013
- }).apply(compiler);
7014
- }
7725
+ if ('firefox' !== this.browser) {
7726
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityPolyfillEnabled(this.browser, 'webextension-polyfill'));
7727
+ new PolyfillPlugin({
7728
+ manifestPath: this.manifestPath,
7729
+ browser: this.browser || 'chrome'
7730
+ }).apply(compiler);
7731
+ } else if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityPolyfillSkipped('Firefox bundles browser.* APIs', this.browser));
7732
+ } else if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(compatibilityPolyfillDisabled(this.browser));
7015
7733
  new BrowserSpecificFieldsPlugin({
7016
7734
  manifestPath: this.manifestPath,
7017
7735
  browser: this.browser || 'chrome'
@@ -7066,6 +7784,7 @@ var __webpack_exports__ = {};
7066
7784
  };
7067
7785
  }
7068
7786
  function messages_getLoggingPrefix(type) {
7787
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) return external_pintor_default().brightMagenta('error' === type ? 'ERROR' : "\u25BA\u25BA\u25BA");
7069
7788
  if ('error' === type) return external_pintor_default().red('ERROR');
7070
7789
  if ('warn' === type) return external_pintor_default().brightYellow("\u25BA\u25BA\u25BA");
7071
7790
  if ('info' === type) return external_pintor_default().gray("\u25BA\u25BA\u25BA");
@@ -7076,18 +7795,18 @@ var __webpack_exports__ = {};
7076
7795
  const maybe = null == error ? void 0 : error.message;
7077
7796
  return String(maybe || error);
7078
7797
  }
7079
- function capitalizedBrowserName(browser) {
7798
+ function messages_capitalizedBrowserName(browser) {
7080
7799
  return external_pintor_default().yellow(`${browser.charAt(0).toUpperCase() + browser.slice(1)}`);
7081
7800
  }
7082
7801
  function creatingUserProfile(profilePath) {
7083
7802
  return `${messages_getLoggingPrefix('info')} Creating a fresh user profile at ${external_pintor_default().underline(profilePath)}...`;
7084
7803
  }
7085
7804
  function browserInstanceExited(browser) {
7086
- return `${messages_getLoggingPrefix('info')} ${capitalizedBrowserName(browser)} instance exited.`;
7805
+ return `${messages_getLoggingPrefix('info')} ${messages_capitalizedBrowserName(browser)} instance exited.`;
7087
7806
  }
7088
7807
  function stdoutData(browser, mode) {
7089
7808
  const extensionOutput = 'firefox' === browser || 'gecko-based' === browser ? 'Add-on' : 'Extension';
7090
- return `${messages_getLoggingPrefix('info')} ${capitalizedBrowserName(browser)} ${extensionOutput} running in ${external_pintor_default().green(mode || 'unknown')} mode.`;
7809
+ return `${messages_getLoggingPrefix('info')} ${messages_capitalizedBrowserName(browser)} ${extensionOutput} running in ${external_pintor_default().green(mode || 'unknown')} mode.`;
7091
7810
  }
7092
7811
  function cdpClientAttachedToTarget(sessionId, targetType) {
7093
7812
  return `${messages_getLoggingPrefix('info')} Attached to target: ${targetType} (session ${sessionId})`;
@@ -7121,56 +7840,56 @@ var __webpack_exports__ = {};
7121
7840
  return `${messages_getLoggingPrefix('warn')} Skipping browser launch due to compile errors`;
7122
7841
  }
7123
7842
  function browserNotInstalledError(browser, browserBinaryLocation) {
7124
- const isUnreachable = 'null' == browserBinaryLocation ? `Browser ${capitalizedBrowserName(browser)} is not installed\n` : `Can't find the path for browser ${capitalizedBrowserName(browser)}\n`;
7125
- 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 || capitalizedBrowserName(browser) + 'BROWSER')}`;
7843
+ const isUnreachable = 'null' == browserBinaryLocation ? `Browser ${messages_capitalizedBrowserName(browser)} is not installed\n` : `Can't find the path for browser ${messages_capitalizedBrowserName(browser)}\n`;
7844
+ return `${messages_getLoggingPrefix('error')} ${isUnreachable}Either install the missing browser or choose a different one via ${external_pintor_default().blue('--browser')} ${external_pintor_default().gray('<chrome|edge|firefox>')}.\n\n${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(browserBinaryLocation || messages_capitalizedBrowserName(browser) + 'BROWSER')}`;
7126
7845
  }
7127
7846
  function browserLaunchError(browser, error) {
7128
- return `${messages_getLoggingPrefix('error')} Error launching ${capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
7847
+ return `${messages_getLoggingPrefix('error')} Error launching ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
7129
7848
  }
7130
7849
  function enhancedProcessManagementCleanup(browser) {
7131
- return `${messages_getLoggingPrefix('info')} Process Management cleanup for ${capitalizedBrowserName(browser)}`;
7850
+ return `${messages_getLoggingPrefix('info')} Process Management cleanup for ${messages_capitalizedBrowserName(browser)}`;
7132
7851
  }
7133
7852
  function enhancedProcessManagementTerminating(browser) {
7134
- return `${messages_getLoggingPrefix('info')} Terminating ${capitalizedBrowserName(browser)} process gracefully`;
7853
+ return `${messages_getLoggingPrefix('info')} Terminating ${messages_capitalizedBrowserName(browser)} process gracefully`;
7135
7854
  }
7136
7855
  function enhancedProcessManagementForceKill(browser) {
7137
- return `${messages_getLoggingPrefix('error')} Force killing ${capitalizedBrowserName(browser)} process after timeout`;
7856
+ return `${messages_getLoggingPrefix('error')} Force killing ${messages_capitalizedBrowserName(browser)} process after timeout`;
7138
7857
  }
7139
7858
  function enhancedProcessManagementCleanupError(browser, error) {
7140
- return `${messages_getLoggingPrefix('error')} Error during ${capitalizedBrowserName(browser)} cleanup:\n${external_pintor_default().red(errorDetail(error))}`;
7859
+ return `${messages_getLoggingPrefix('error')} Error during ${messages_capitalizedBrowserName(browser)} cleanup:\n${external_pintor_default().red(errorDetail(error))}`;
7141
7860
  }
7142
7861
  function enhancedProcessManagementUncaughtException(browser, error) {
7143
- return `${messages_getLoggingPrefix('error')} Uncaught exception in ${capitalizedBrowserName(browser)} process:\n${external_pintor_default().red(errorDetail(error))}`;
7862
+ return `${messages_getLoggingPrefix('error')} Uncaught exception in ${messages_capitalizedBrowserName(browser)} process:\n${external_pintor_default().red(errorDetail(error))}`;
7144
7863
  }
7145
7864
  function enhancedProcessManagementUnhandledRejection(browser, reason) {
7146
- return `${messages_getLoggingPrefix('error')} Unhandled rejection in ${capitalizedBrowserName(browser)} process:\n${external_pintor_default().red(errorDetail(reason))}`;
7865
+ return `${messages_getLoggingPrefix('error')} Unhandled rejection in ${messages_capitalizedBrowserName(browser)} process:\n${external_pintor_default().red(errorDetail(reason))}`;
7147
7866
  }
7148
7867
  function generalBrowserError(browser, error) {
7149
- return `${messages_getLoggingPrefix('error')} General error in ${capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
7868
+ return `${messages_getLoggingPrefix('error')} General error in ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
7150
7869
  }
7151
7870
  function errorConnectingToBrowser(browser) {
7152
- return `${messages_getLoggingPrefix('error')} Unable to connect to ${capitalizedBrowserName(browser)}. Too many retries.`;
7871
+ return `${messages_getLoggingPrefix('error')} Unable to connect to ${messages_capitalizedBrowserName(browser)}. Too many retries.`;
7153
7872
  }
7154
7873
  function addonInstallError(browser, message) {
7155
- return `${messages_getLoggingPrefix('error')} Can't install add-on into ${capitalizedBrowserName(browser)}:\n${external_pintor_default().red(message)}`;
7874
+ return `${messages_getLoggingPrefix('error')} Can't install add-on into ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(message)}`;
7156
7875
  }
7157
7876
  function messagingClientClosedError(browser) {
7158
- return `${messages_getLoggingPrefix('error')} Messaging client closed unexpectedly for ${capitalizedBrowserName(browser)}`;
7877
+ return `${messages_getLoggingPrefix('error')} Messaging client closed unexpectedly for ${messages_capitalizedBrowserName(browser)}`;
7159
7878
  }
7160
7879
  function connectionClosedError(browser) {
7161
- return `${messages_getLoggingPrefix('error')} Connection closed unexpectedly for ${capitalizedBrowserName(browser)}`;
7880
+ return `${messages_getLoggingPrefix('error')} Connection closed unexpectedly for ${messages_capitalizedBrowserName(browser)}`;
7162
7881
  }
7163
7882
  function targetActorHasActiveRequestError(browser, targetActor) {
7164
- return `${messages_getLoggingPrefix('error')} Target actor ${external_pintor_default().gray(targetActor)} has active request for ${capitalizedBrowserName(browser)}`;
7883
+ return `${messages_getLoggingPrefix('error')} Target actor ${external_pintor_default().gray(targetActor)} has active request for ${messages_capitalizedBrowserName(browser)}`;
7165
7884
  }
7166
7885
  function parsingPacketError(browser, error) {
7167
- return `${messages_getLoggingPrefix('error')} Failed to parse packet from ${capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
7886
+ return `${messages_getLoggingPrefix('error')} Failed to parse packet from ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
7168
7887
  }
7169
7888
  function messageWithoutSenderError(browser, message) {
7170
- return `${messages_getLoggingPrefix('error')} Message without sender from ${capitalizedBrowserName(browser)}:\n${external_pintor_default().red(JSON.stringify(message))}`;
7889
+ return `${messages_getLoggingPrefix('error')} Message without sender from ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(JSON.stringify(message))}`;
7171
7890
  }
7172
7891
  function profileFallbackWarning(browser, reason) {
7173
- return `${external_pintor_default().brightYellow("\u25BA\u25BA\u25BA")} ${external_pintor_default().brightYellow('Dev')} ${capitalizedBrowserName(browser)} falling back to per-instance profile` + (reason ? `: ${external_pintor_default().gray(reason)}` : '');
7892
+ return `${external_pintor_default().brightYellow("\u25BA\u25BA\u25BA")} ${external_pintor_default().brightYellow('Dev')} ${messages_capitalizedBrowserName(browser)} falling back to per-instance profile` + (reason ? `: ${external_pintor_default().gray(reason)}` : '');
7174
7893
  }
7175
7894
  function chromeProcessExited(code) {
7176
7895
  return `${messages_getLoggingPrefix('info')} Chrome process exited with code: ${external_pintor_default().gray(code.toString())}`;
@@ -7185,11 +7904,17 @@ var __webpack_exports__ = {};
7185
7904
  return `${messages_getLoggingPrefix('info')} Initializing enhanced reload service with direct spawn for Chrome`;
7186
7905
  }
7187
7906
  function locatingBrowser(browser) {
7188
- return `${messages_getLoggingPrefix('info')} Locating ${capitalizedBrowserName(browser)} browser binary...`;
7907
+ return `${messages_getLoggingPrefix('info')} Locating ${messages_capitalizedBrowserName(browser)} browser binary...`;
7189
7908
  }
7190
7909
  function devChromeProfilePath(path) {
7191
7910
  return `${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA")} ${external_pintor_default().brightMagenta('Dev')} Chrome profile: ${external_pintor_default().underline(path)}`;
7192
7911
  }
7912
+ function usingChromiumRunner(browser) {
7913
+ return `${messages_getLoggingPrefix('info')} Using Chromium runner for ${messages_capitalizedBrowserName(browser)}`;
7914
+ }
7915
+ function usingFirefoxRunner(browser) {
7916
+ return `${messages_getLoggingPrefix('info')} Using Firefox runner for ${messages_capitalizedBrowserName(browser)}`;
7917
+ }
7193
7918
  function chromiumDryRunNotLaunching() {
7194
7919
  return `${messages_getLoggingPrefix('info')} [plugin-browsers] Dry run: not launching browser`;
7195
7920
  }
@@ -7229,28 +7954,25 @@ var __webpack_exports__ = {};
7229
7954
  } catch {}
7230
7955
  }
7231
7956
  } catch {}
7957
+ let browserNorm = 'chromium';
7958
+ if ('chromium-based' === browser) browserNorm = 'chromium';
7959
+ else if ('gecko-based' === browser) browserNorm = 'firefox';
7960
+ else if ('chrome' === browser || 'chromium' === browser || 'firefox' === browser || 'edge' === browser) browserNorm = browser;
7961
+ const finalCachePath = browserNorm && cacheDir ? external_path_.join(cacheDir, browserNorm) : cacheDir;
7232
7962
  try {
7233
- if (cacheDir && cacheDir.trim().length > 0) {
7963
+ if (finalCachePath && finalCachePath.trim().length > 0) {
7234
7964
  const lines = cleaned.split(/\r?\n/);
7235
7965
  const idx = lines.findIndex((l)=>/npx\s+@puppeteer\/browsers\s+install\s+/i.test(l));
7236
7966
  if (-1 !== idx && !/--path\s+/i.test(lines[idx])) {
7237
- lines[idx] = `${lines[idx].trim()} --path "${cacheDir}"`;
7967
+ lines[idx] = `${lines[idx].trim()} --path "${finalCachePath}"`;
7238
7968
  cleaned = lines.join('\n');
7239
7969
  }
7240
7970
  try {
7241
7971
  const pwIdx = lines.findIndex((l)=>/npx\s+playwright\s+install(\s+.+)?/i.test(l));
7242
7972
  if (-1 !== pwIdx) {
7243
- const browserNorm = (()=>{
7244
- const b = String(browser || '').toLowerCase();
7245
- if ('chromium-based' === b) return 'chromium';
7246
- if ('gecko-based' === b) return 'firefox';
7247
- if ('chrome' === b || 'chromium' === b || 'firefox' === b || 'edge' === b) return b;
7248
- return 'chrome';
7249
- })();
7250
- const finalPath = browserNorm && cacheDir ? external_path_.join(cacheDir, browserNorm) : cacheDir;
7251
- if (finalPath && finalPath.trim().length > 0) {
7973
+ if (finalCachePath && finalCachePath.trim().length > 0) {
7252
7974
  const cmd = lines[pwIdx].trim();
7253
- const withEnv = 'win32' === process.platform ? `set PLAYWRIGHT_BROWSERS_PATH="${finalPath}" && ${cmd}` : `PLAYWRIGHT_BROWSERS_PATH="${finalPath}" ${cmd}`;
7975
+ const withEnv = 'win32' === process.platform ? `set PLAYWRIGHT_BROWSERS_PATH="${finalCachePath}" && ${cmd}` : `PLAYWRIGHT_BROWSERS_PATH="${finalCachePath}" ${cmd}`;
7254
7976
  lines[pwIdx] = withEnv;
7255
7977
  cleaned = lines.join('\n');
7256
7978
  }
@@ -7259,7 +7981,7 @@ var __webpack_exports__ = {};
7259
7981
  }
7260
7982
  } catch {}
7261
7983
  body.push(cleaned);
7262
- if (cacheDir) body.push(`${dim('INSTALL PATH')} ${external_pintor_default().underline(cacheDir)}`);
7984
+ if (finalCachePath) body.push(`${dim('INSTALL PATH')} ${external_pintor_default().underline(finalCachePath)}`);
7263
7985
  return body.join('\n') + '\n';
7264
7986
  }
7265
7987
  function firefoxLaunchCalled() {
@@ -7649,6 +8371,29 @@ var __webpack_exports__ = {};
7649
8371
  function getLastCDPPort() {
7650
8372
  return lastCDPPort;
7651
8373
  }
8374
+ function computeSharedCacheRoot() {
8375
+ const explicit = String(process.env.EXT_BROWSERS_CACHE_DIR || '').trim();
8376
+ if (explicit) return external_path_.resolve(explicit);
8377
+ const isWin = 'win32' === process.platform;
8378
+ const isMac = 'darwin' === process.platform;
8379
+ if (isWin) {
8380
+ const local = String(process.env.LOCALAPPDATA || '').trim();
8381
+ if (local) return external_path_.join(local, 'extension.js', 'browsers');
8382
+ const userProfile = String(process.env.USERPROFILE || '').trim();
8383
+ if (userProfile) return external_path_.join(userProfile, 'AppData', 'Local', 'extension.js', 'browsers');
8384
+ return external_path_.resolve(process.cwd(), '.cache', 'extension.js', 'browsers');
8385
+ }
8386
+ if (isMac) {
8387
+ const home = String(process.env.HOME || '').trim();
8388
+ if (home) return external_path_.join(home, 'Library', 'Caches', 'extension.js', 'browsers');
8389
+ return external_path_.resolve(process.cwd(), '.cache', 'extension.js', 'browsers');
8390
+ }
8391
+ const xdg = String(process.env.XDG_CACHE_HOME || '').trim();
8392
+ if (xdg) return external_path_.join(xdg, 'extension.js', 'browsers');
8393
+ const home = String(process.env.HOME || '').trim();
8394
+ if (home) return external_path_.join(home, '.cache', 'extension.js', 'browsers');
8395
+ return external_path_.resolve(process.cwd(), '.cache', 'extension.js', 'browsers');
8396
+ }
7652
8397
  function getCompilationOutputPath(compilation) {
7653
8398
  try {
7654
8399
  var _compilation_options_output, _compilation_options, _compilation_outputOptions;
@@ -7658,6 +8403,7 @@ var __webpack_exports__ = {};
7658
8403
  }
7659
8404
  }
7660
8405
  function computeBinariesBaseDir(compilation) {
8406
+ if ('1' !== process.env.EXTENSIONJS_BINARIES_IN_DIST) return computeSharedCacheRoot();
7661
8407
  const outputDir = getCompilationOutputPath(compilation);
7662
8408
  if (outputDir) {
7663
8409
  const last = external_path_.basename(outputDir);
@@ -7971,13 +8717,24 @@ var __webpack_exports__ = {};
7971
8717
  function setupProcessSignalHandlers(browser, child, cleanupInstance) {
7972
8718
  const cleanup = ()=>{
7973
8719
  try {
7974
- if ('development' === process.env.EXTENSION_ENV) console.log(enhancedProcessManagementCleanup(browser));
8720
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementCleanup(browser));
7975
8721
  if (child && !child.killed) {
7976
- if ('development' === process.env.EXTENSION_ENV) console.log(enhancedProcessManagementTerminating(browser));
8722
+ if ('win32' === process.platform) try {
8723
+ (0, external_child_process_.spawn)('taskkill', [
8724
+ '/PID',
8725
+ String(child.pid),
8726
+ '/T',
8727
+ '/F'
8728
+ ], {
8729
+ stdio: 'ignore',
8730
+ windowsHide: true
8731
+ }).on('error', ()=>{});
8732
+ } catch {}
8733
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementTerminating(browser));
7977
8734
  child.kill('SIGTERM');
7978
8735
  setTimeout(()=>{
7979
8736
  if (child && !child.killed) {
7980
- if ('development' === process.env.EXTENSION_ENV) console.log(enhancedProcessManagementForceKill(browser));
8737
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementForceKill(browser));
7981
8738
  child.kill('SIGKILL');
7982
8739
  }
7983
8740
  }, 5000);
@@ -8391,7 +9148,7 @@ var __webpack_exports__ = {};
8391
9148
  }
8392
9149
  class CDPClient {
8393
9150
  isDev() {
8394
- return 'development' === process.env.EXTENSION_ENV;
9151
+ return 'true' === process.env.EXTENSION_AUTHOR_MODE;
8395
9152
  }
8396
9153
  async connect() {
8397
9154
  return new Promise(async (resolve, reject)=>{
@@ -8648,7 +9405,7 @@ var __webpack_exports__ = {};
8648
9405
  flatten: true
8649
9406
  });
8650
9407
  } catch (error) {
8651
- if ('development' === process.env.EXTENSION_ENV) console.warn(cdpAutoAttachSetupFailed(String((null == error ? void 0 : error.message) || error)));
9408
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(cdpAutoAttachSetupFailed(String((null == error ? void 0 : error.message) || error)));
8652
9409
  }
8653
9410
  return cdp;
8654
9411
  }
@@ -8701,7 +9458,7 @@ var __webpack_exports__ = {};
8701
9458
  }
8702
9459
  }
8703
9460
  } catch (error) {
8704
- if ('development' === process.env.EXTENSION_ENV) console.warn(cdpProtocolEventHandlerError(String((null == error ? void 0 : error.message) || error)));
9461
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(cdpProtocolEventHandlerError(String((null == error ? void 0 : error.message) || error)));
8705
9462
  }
8706
9463
  });
8707
9464
  }
@@ -8729,7 +9486,7 @@ var __webpack_exports__ = {};
8729
9486
  flatten: true
8730
9487
  });
8731
9488
  } catch (error) {
8732
- if ('development' === process.env.EXTENSION_ENV) console.warn(cdpAutoAttachSetupFailed(String((null == error ? void 0 : error.message) || error)));
9489
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(cdpAutoAttachSetupFailed(String((null == error ? void 0 : error.message) || error)));
8733
9490
  }
8734
9491
  registerAutoEnableLogging(this.cdp, ()=>this.extensionId);
8735
9492
  }
@@ -8782,7 +9539,7 @@ var __webpack_exports__ = {};
8782
9539
  name = String((null == manifest ? void 0 : manifest.name) || '') || void 0;
8783
9540
  version = String((null == manifest ? void 0 : manifest.version) || '') || void 0;
8784
9541
  } catch (e2) {
8785
- if ('development' === process.env.EXTENSION_ENV) console.warn('[CDP] Fallback manifest read failed:', String((null == e2 ? void 0 : e2.message) || e2));
9542
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn('[CDP] Fallback manifest read failed:', String((null == e2 ? void 0 : e2.message) || e2));
8786
9543
  }
8787
9544
  }
8788
9545
  return {
@@ -8870,7 +9627,7 @@ var __webpack_exports__ = {};
8870
9627
  } catch {}
8871
9628
  });
8872
9629
  } catch (e) {
8873
- if ('development' === process.env.EXTENSION_ENV) console.warn('[CDP] enableLogging failed:', String(e));
9630
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn('[CDP] enableLogging failed:', String(e));
8874
9631
  }
8875
9632
  }
8876
9633
  async getInfoBestEffort() {
@@ -8912,13 +9669,22 @@ var __webpack_exports__ = {};
8912
9669
  this.cdpPort = args.cdpPort;
8913
9670
  }
8914
9671
  }
9672
+ function getExtensionOutputPath(compilation, loadExtensionFlag) {
9673
+ if (!loadExtensionFlag) {
9674
+ var _compilation_options_output, _compilation_options;
9675
+ return (null == compilation ? void 0 : null == (_compilation_options = compilation.options) ? void 0 : null == (_compilation_options_output = _compilation_options.output) ? void 0 : _compilation_options_output.path) || external_path_.join(process.cwd(), 'dist');
9676
+ }
9677
+ const entries = loadExtensionFlag.replace('--load-extension=', '').split(',').map((s)=>s.trim()).filter(Boolean);
9678
+ const userCandidates = entries.filter((p)=>!/[\\\/]extension-js-devtools[\\\/]/.test(p) && !/[\\\/]extension-js-theme[\\\/]/.test(p));
9679
+ return (userCandidates.length ? userCandidates : entries).slice(-1)[0];
9680
+ }
8915
9681
  async function setupCdpAfterLaunch(compilation, plugin, chromiumArgs) {
8916
- var _compilation_options_output, _compilation_options, _compilation_options1;
9682
+ var _compilation_options;
8917
9683
  const loadExtensionFlag = chromiumArgs.find((flag)=>flag.startsWith('--load-extension='));
8918
- const extensionOutputPath = loadExtensionFlag ? loadExtensionFlag.replace('--load-extension=', '').split(',')[0] : (null == compilation ? void 0 : null == (_compilation_options = compilation.options) ? void 0 : null == (_compilation_options_output = _compilation_options.output) ? void 0 : _compilation_options_output.path) || external_path_.join(process.cwd(), 'dist');
9684
+ const extensionOutputPath = getExtensionOutputPath(compilation, loadExtensionFlag);
8919
9685
  const remoteDebugPortFlag = chromiumArgs.find((flag)=>flag.startsWith('--remote-debugging-port='));
8920
9686
  const chromeRemoteDebugPort = remoteDebugPortFlag ? parseInt(remoteDebugPortFlag.split('=')[1], 10) : deriveDebugPortWithInstance(plugin.port, plugin.instanceId);
8921
- if ('development' === process.env.EXTENSION_ENV) {
9687
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
8922
9688
  const userDataDirFlag = chromiumArgs.find((flag)=>flag.startsWith('--user-data-dir='));
8923
9689
  if (userDataDirFlag) {
8924
9690
  const userDataDir = userDataDirFlag.replace('--user-data-dir=', '').replace(/^"|"$/g, '');
@@ -8943,9 +9709,9 @@ var __webpack_exports__ = {};
8943
9709
  throw lastError;
8944
9710
  };
8945
9711
  await retryAsync(()=>cdpExtensionController.connect());
8946
- if ('development' === process.env.EXTENSION_ENV) console.log(cdpClientConnected('127.0.0.1', chromeRemoteDebugPort));
9712
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(cdpClientConnected('127.0.0.1', chromeRemoteDebugPort));
8947
9713
  const extensionControllerInfo = await cdpExtensionController.ensureLoaded();
8948
- if ((null == compilation ? void 0 : null == (_compilation_options1 = compilation.options) ? void 0 : _compilation_options1.mode) !== 'production') try {
9714
+ if ((null == compilation ? void 0 : null == (_compilation_options = compilation.options) ? void 0 : _compilation_options.mode) !== 'production') try {
8949
9715
  const bannerPrinted = await printDevBannerOnce({
8950
9716
  outPath: extensionOutputPath,
8951
9717
  browser: plugin.browser,
@@ -8965,7 +9731,7 @@ var __webpack_exports__ = {};
8965
9731
  getInfo: async ()=>cdpExtensionController.getInfoBestEffort()
8966
9732
  });
8967
9733
  } catch (bannerErr) {
8968
- if ('development' === process.env.EXTENSION_ENV) console.warn(bestEffortBannerPrintFailed(String(bannerErr)));
9734
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(bestEffortBannerPrintFailed(String(bannerErr)));
8969
9735
  }
8970
9736
  plugin.cdpController = cdpExtensionController;
8971
9737
  }
@@ -9281,7 +10047,7 @@ var __webpack_exports__ = {};
9281
10047
  const freePort = await findAvailablePortNear(desiredPort);
9282
10048
  const selectedPort = freePort;
9283
10049
  if (freePort !== desiredPort) chromiumConfig = chromiumConfig.map((flag)=>flag.startsWith('--remote-debugging-port=') ? `--remote-debugging-port=${selectedPort}` : flag);
9284
- if ('development' === process.env.EXTENSION_ENV) this.logger.info(devChromiumDebugPort(selectedPort, desiredPort));
10050
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.logger.info(devChromiumDebugPort(selectedPort, desiredPort));
9285
10051
  setInstancePorts(this.options.instanceId, {
9286
10052
  cdpPort: selectedPort
9287
10053
  });
@@ -9318,7 +10084,7 @@ var __webpack_exports__ = {};
9318
10084
  await setupCdpAfterLaunch(compilation, cdpConfig, chromiumConfig);
9319
10085
  if (cdpConfig.cdpController) this.ctx.setController(cdpConfig.cdpController, selectedPort);
9320
10086
  } catch (error) {
9321
- if ('development' === process.env.EXTENSION_ENV) console.warn('[plugin-browsers] CDP post-launch setup failed:', String(error));
10087
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn('[plugin-browsers] CDP post-launch setup failed:', String(error));
9322
10088
  }
9323
10089
  }
9324
10090
  async launchWithDirectSpawn(binary, chromeFlags) {
@@ -9342,7 +10108,7 @@ var __webpack_exports__ = {};
9342
10108
  });
9343
10109
  null == (_this_logger_debug = (_this_logger = this.logger).debug) || _this_logger_debug.call(_this_logger, '[plugin-browsers] Final Chrome flags:', launchArgs.join(' '));
9344
10110
  child.on('close', (code)=>{
9345
- if ('development' === process.env.EXTENSION_ENV) this.logger.info(chromeProcessExited(code || 0));
10111
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.logger.info(chromeProcessExited(code || 0));
9346
10112
  });
9347
10113
  child.on('error', (error)=>{
9348
10114
  this.logger.error(chromeProcessError(error));
@@ -9382,6 +10148,15 @@ var __webpack_exports__ = {};
9382
10148
  async function setupUnifiedLogging(controller, opts) {
9383
10149
  const level = String(opts.level || '').toLowerCase();
9384
10150
  if (!level || 'off' === level) return;
10151
+ const colorOn = (null == opts ? void 0 : opts.color) !== false;
10152
+ const c = {
10153
+ gray: (s)=>colorOn && external_pintor_default().gray ? external_pintor_default().gray(s) : s,
10154
+ red: (s)=>colorOn && external_pintor_default().red ? external_pintor_default().red(s) : s,
10155
+ yellow: (s)=>colorOn && external_pintor_default().brightYellow ? external_pintor_default().brightYellow(s) : s,
10156
+ cyan: (s)=>colorOn && external_pintor_default().cyan ? external_pintor_default().cyan(s) : s,
10157
+ magenta: (s)=>colorOn && external_pintor_default().magenta ? external_pintor_default().magenta(s) : s,
10158
+ white: (s)=>colorOn && external_pintor_default().white ? external_pintor_default().white(s) : s
10159
+ };
9385
10160
  await controller.enableUnifiedLogging({
9386
10161
  level: level,
9387
10162
  contexts: opts.contexts,
@@ -9390,8 +10165,11 @@ var __webpack_exports__ = {};
9390
10165
  });
9391
10166
  const recentKeys = new Map();
9392
10167
  const DEDUPE_MS = 1000;
9393
- controller.onProtocolEvent((evt)=>{
10168
+ const subscribe = controller.onProtocolEvent;
10169
+ if (!subscribe) return;
10170
+ subscribe((rawEvt)=>{
9394
10171
  try {
10172
+ const evt = rawEvt;
9395
10173
  const showTs = false !== opts.timestamps;
9396
10174
  const method = null == evt ? void 0 : evt.method;
9397
10175
  let level = 'info';
@@ -9442,18 +10220,18 @@ var __webpack_exports__ = {};
9442
10220
  const up = String(lvl || 'log').toUpperCase();
9443
10221
  switch(String(lvl || '').toLowerCase()){
9444
10222
  case 'error':
9445
- return external_pintor_default().red ? external_pintor_default().red(up) : up;
10223
+ return c.red(up);
9446
10224
  case 'warn':
9447
- return external_pintor_default().brightYellow ? external_pintor_default().brightYellow(up) : up;
10225
+ return c.yellow(up);
9448
10226
  case 'info':
9449
- return external_pintor_default().cyan ? external_pintor_default().cyan(up) : up;
10227
+ return c.cyan(up);
9450
10228
  case 'debug':
9451
- return external_pintor_default().magenta ? external_pintor_default().magenta(up) : up;
10229
+ return c.magenta(up);
9452
10230
  case 'trace':
9453
- return external_pintor_default().white ? external_pintor_default().white(up) : up;
10231
+ return c.white(up);
9454
10232
  case 'log':
9455
10233
  default:
9456
- return external_pintor_default().gray ? external_pintor_default().gray(up) : up;
10234
+ return c.gray(up);
9457
10235
  }
9458
10236
  }
9459
10237
  const where = url ? `${url}:${line}:${col}` : '';
@@ -9468,13 +10246,7 @@ var __webpack_exports__ = {};
9468
10246
  for (const [k, t] of recentKeys)if (t < cutoff) recentKeys.delete(k);
9469
10247
  }
9470
10248
  const nowDate = new Date();
9471
- const tsShort = showTs ? (()=>{
9472
- const hh = String(nowDate.getHours()).padStart(2, '0');
9473
- const mm = String(nowDate.getMinutes()).padStart(2, '0');
9474
- const ss = String(nowDate.getSeconds()).padStart(2, '0');
9475
- const ms = String(nowDate.getMilliseconds()).padStart(3, '0');
9476
- return `${hh}:${mm}:${ss}.${ms}`;
9477
- })() : '';
10249
+ const tsIso = showTs ? `${nowDate.toISOString()} ` : '';
9478
10250
  if ('pretty' !== String(opts.format || '').toLowerCase()) {
9479
10251
  const event = {
9480
10252
  timestamp: nowDate.toISOString(),
@@ -9493,10 +10265,11 @@ var __webpack_exports__ = {};
9493
10265
  }
9494
10266
  return;
9495
10267
  }
9496
- const head = `${prefix} ${fmtLevel(level)} ${context}`;
9497
- const tailSrc = where ? ` (${where})` : '';
9498
- const tailTs = tsShort ? ` ${external_pintor_default().gray ? external_pintor_default().gray(tsShort) : tsShort}` : '';
9499
- console.log(`${head} - ${msg}${tailSrc}${tailTs}`);
10268
+ const ctx = c.gray(`[${context}]`);
10269
+ const lvl = fmtLevel(level);
10270
+ const whereStr = where ? ` ${c.gray(where)}` : '';
10271
+ const message = msg && msg.trim().length ? msg.trim() : '(none)';
10272
+ console.log(`${tsIso}${prefix} ${ctx} ${lvl}${whereStr} - ${message}`);
9500
10273
  } catch {}
9501
10274
  });
9502
10275
  }
@@ -9633,7 +10406,7 @@ var __webpack_exports__ = {};
9633
10406
  const fromRegistry = instanceId && (null == (_getInstancePorts = getInstancePorts(instanceId)) ? void 0 : _getInstancePorts.cdpPort) || getLastCDPPort();
9634
10407
  if ('number' == typeof fromRegistry && fromRegistry > 0) port = fromRegistry;
9635
10408
  } catch {}
9636
- if ('development' === process.env.EXTENSION_ENV) console.log(sourceInspectorWaitingForChrome());
10409
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorWaitingForChrome());
9637
10410
  let retries = 0;
9638
10411
  const maxRetries = 60;
9639
10412
  const backoffMs = 500;
@@ -9645,11 +10418,11 @@ var __webpack_exports__ = {};
9645
10418
  } catch {}
9646
10419
  const isDebuggingEnabled = await checkChromeRemoteDebugging(port);
9647
10420
  if (isDebuggingEnabled) {
9648
- if ('development' === process.env.EXTENSION_ENV) console.log(chromeRemoteDebuggingReady());
10421
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(chromeRemoteDebuggingReady());
9649
10422
  return;
9650
10423
  }
9651
10424
  retries++;
9652
- if (retries % 10 === 0 && 'development' === process.env.EXTENSION_ENV) console.log(sourceInspectorChromeNotReadyYet(retries, maxRetries));
10425
+ if (retries % 10 === 0 && 'true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorChromeNotReadyYet(retries, maxRetries));
9653
10426
  await new Promise((resolve)=>setTimeout(resolve, backoffMs));
9654
10427
  }
9655
10428
  throw new Error(sourceInspectorChromeDebuggingRequired(port));
@@ -9657,15 +10430,15 @@ var __webpack_exports__ = {};
9657
10430
  async function ensureTargetAndSession(cdpClient, url) {
9658
10431
  const targets = await cdpClient.getTargets();
9659
10432
  const existingTarget = (targets || []).find((t)=>String((null == t ? void 0 : t.url) || '') === url && 'page' === String((null == t ? void 0 : t.type) || ''));
9660
- let targetId;
10433
+ let targetId = '';
9661
10434
  if (existingTarget && existingTarget.targetId) {
9662
- if ('development' === process.env.EXTENSION_ENV) console.log(sourceInspectorUsingExistingTarget(existingTarget.targetId));
9663
10435
  targetId = String(existingTarget.targetId);
10436
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorUsingExistingTarget(existingTarget.targetId));
9664
10437
  } else {
9665
- if ('development' === process.env.EXTENSION_ENV) console.log(sourceInspectorCreatingTarget());
10438
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorCreatingTarget());
9666
10439
  const created = await cdpClient.createTarget(url);
9667
10440
  targetId = String(created);
9668
- if ('development' === process.env.EXTENSION_ENV) {
10441
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
9669
10442
  console.log(sourceInspectorTargetCreated(targetId));
9670
10443
  console.log(sourceInspectorEnsuringNavigation());
9671
10444
  }
@@ -9677,9 +10450,9 @@ var __webpack_exports__ = {};
9677
10450
  await cdpClient.navigate(String(tempSession), url);
9678
10451
  }
9679
10452
  }
9680
- if ('development' === process.env.EXTENSION_ENV) console.log(sourceInspectorAttachingToTarget());
10453
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorAttachingToTarget());
9681
10454
  const sessionId = String(await cdpClient.attachToTarget(targetId) || '');
9682
- if ('development' === process.env.EXTENSION_ENV) {
10455
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
9683
10456
  console.log(sourceInspectorAttachedToTarget(sessionId));
9684
10457
  console.log(sourceInspectorEnablingPageDomain());
9685
10458
  }
@@ -9692,7 +10465,7 @@ var __webpack_exports__ = {};
9692
10465
  sessionId: String(sessionId)
9693
10466
  };
9694
10467
  }
9695
- async function extractPageHtml(cdpClient, sessionId, logSamples = 'development' === process.env.EXTENSION_ENV) {
10468
+ async function extractPageHtml(cdpClient, sessionId, logSamples = 'true' === process.env.EXTENSION_AUTHOR_MODE) {
9696
10469
  let html = await cdpClient.getPageHTML(sessionId);
9697
10470
  if (!html) try {
9698
10471
  const targets = await cdpClient.getTargets();
@@ -9750,6 +10523,11 @@ var __webpack_exports__ = {};
9750
10523
  return obj;
9751
10524
  }
9752
10525
  class ChromiumSourceInspectionPlugin {
10526
+ isAuthorMode() {
10527
+ const authorMode = 'true' === String(process.env.EXTENSION_AUTHOR_MODE || '').trim().toLowerCase();
10528
+ const isDevEnv = 'development' === String(process.env.EXTENSION_ENV || '').trim().toLowerCase();
10529
+ return authorMode || isDevEnv;
10530
+ }
9753
10531
  async getCdpPort() {
9754
10532
  const instanceId = this.devOptions.instanceId;
9755
10533
  return deriveDebugPortWithInstance(this.devOptions.port, instanceId);
@@ -9761,30 +10539,30 @@ var __webpack_exports__ = {};
9761
10539
  await waitForChromeRemoteDebugging(port, instanceId);
9762
10540
  this.cdpClient = new CDPClient(port);
9763
10541
  await this.cdpClient.connect();
9764
- if ('development' === process.env.EXTENSION_ENV) console.log(sourceInspectorInitialized());
10542
+ if (this.isAuthorMode()) console.log(sourceInspectorInitialized());
9765
10543
  this.isInitialized = true;
9766
10544
  } catch (error) {
9767
- if ('development' === process.env.EXTENSION_ENV) console.error(sourceInspectorInitializationFailed(error.message));
10545
+ if (this.isAuthorMode()) console.error(sourceInspectorInitializationFailed(error.message));
9768
10546
  throw error;
9769
10547
  }
9770
10548
  }
9771
10549
  async inspectSource(url) {
9772
10550
  if (!this.cdpClient) throw new Error(sourceInspectorNotInitialized());
9773
10551
  try {
9774
- if ('development' === process.env.EXTENSION_ENV) {
10552
+ if (this.isAuthorMode()) {
9775
10553
  console.log(sourceInspectorOpeningUrl(url));
9776
10554
  console.log(sourceInspectorFindingExistingTarget());
9777
10555
  }
9778
10556
  const { targetId, sessionId } = await ensureTargetAndSession(this.cdpClient, url);
9779
10557
  this.currentTargetId = targetId;
9780
10558
  this.currentSessionId = sessionId;
9781
- if ('development' === process.env.EXTENSION_ENV) console.log(sourceInspectorWaitingForPageLoad());
10559
+ if (this.isAuthorMode()) console.log(sourceInspectorWaitingForPageLoad());
9782
10560
  await this.cdpClient.waitForLoadEvent(this.currentSessionId);
9783
10561
  try {
9784
10562
  const initialHtml = await extractPageHtml(this.cdpClient, this.currentSessionId);
9785
10563
  this.printHTML(String(initialHtml || ''));
9786
10564
  } catch {}
9787
- if ('development' === process.env.EXTENSION_ENV) console.log(sourceInspectorWaitingForContentScripts());
10565
+ if (this.isAuthorMode()) console.log(sourceInspectorWaitingForContentScripts());
9788
10566
  await this.cdpClient.waitForContentScriptInjection(this.currentSessionId);
9789
10567
  try {
9790
10568
  const deadline = Date.now() + 20000;
@@ -9810,12 +10588,12 @@ var __webpack_exports__ = {};
9810
10588
  const html = await extractPageHtml(this.cdpClient, this.currentSessionId);
9811
10589
  return html;
9812
10590
  } catch (error) {
9813
- if ('development' === process.env.EXTENSION_ENV) console.error(sourceInspectorInspectionFailed(error.message));
10591
+ if (this.isAuthorMode()) console.error(sourceInspectorInspectionFailed(error.message));
9814
10592
  throw error;
9815
10593
  }
9816
10594
  }
9817
10595
  async startWatching(websocketServer) {
9818
- if ('development' !== process.env.EXTENSION_ENV) return;
10596
+ if (!this.isAuthorMode()) return;
9819
10597
  if (this.isWatching) return void console.log(sourceInspectorWatchModeActive());
9820
10598
  this.isWatching = true;
9821
10599
  console.log(sourceInspectorStartingWatchMode());
@@ -9823,7 +10601,7 @@ var __webpack_exports__ = {};
9823
10601
  console.log(sourceInspectorCDPConnectionMaintained());
9824
10602
  }
9825
10603
  setupWebSocketHandler(websocketServer) {
9826
- if ('development' !== process.env.EXTENSION_ENV) return;
10604
+ if (!this.isAuthorMode()) return;
9827
10605
  if (!websocketServer || !websocketServer.clients) return void console.warn(sourceInspectorInvalidWebSocketServer());
9828
10606
  websocketServer.clients.forEach((ws)=>{
9829
10607
  this.setupConnectionHandler(ws);
@@ -9833,7 +10611,7 @@ var __webpack_exports__ = {};
9833
10611
  });
9834
10612
  }
9835
10613
  setupConnectionHandler(ws) {
9836
- if ('development' !== process.env.EXTENSION_ENV) return;
10614
+ if (!this.isAuthorMode()) return;
9837
10615
  ws.on('message', async (data)=>{
9838
10616
  try {
9839
10617
  const message = JSON.parse(data);
@@ -9842,12 +10620,12 @@ var __webpack_exports__ = {};
9842
10620
  });
9843
10621
  }
9844
10622
  stopWatching() {
9845
- if ('development' !== process.env.EXTENSION_ENV) return;
10623
+ if (!this.isAuthorMode()) return;
9846
10624
  this.isWatching = false;
9847
10625
  console.log(sourceInspectorWatchModeStopped());
9848
10626
  }
9849
10627
  async handleFileChange() {
9850
- if ('development' !== process.env.EXTENSION_ENV) return;
10628
+ if (!this.isAuthorMode()) return;
9851
10629
  if (!this.cdpClient || !this.currentSessionId) return void console.warn(sourceInspectorNoActiveSession());
9852
10630
  if (this.debounceTimer) clearTimeout(this.debounceTimer);
9853
10631
  this.debounceTimer = setTimeout(async ()=>{
@@ -9882,7 +10660,7 @@ var __webpack_exports__ = {};
9882
10660
  }, 300);
9883
10661
  }
9884
10662
  async reconnectToTarget() {
9885
- if ('development' !== process.env.EXTENSION_ENV) return;
10663
+ if (!this.isAuthorMode()) return;
9886
10664
  try {
9887
10665
  if (!this.cdpClient || !this.currentTargetId) return void console.warn(sourceInspectorCannotReconnect());
9888
10666
  console.log(sourceInspectorReconnectingToTarget());
@@ -9921,7 +10699,7 @@ var __webpack_exports__ = {};
9921
10699
  console.log(sourceInspectorHTMLOutputFooter());
9922
10700
  }
9923
10701
  printUpdatedHTML(html) {
9924
- if ('development' !== process.env.EXTENSION_ENV) return;
10702
+ if (!this.isAuthorMode()) return;
9925
10703
  const raw = String(process.env.EXTENSION_SOURCE_RAW || '').trim();
9926
10704
  const maxBytesStr = String(process.env.EXTENSION_SOURCE_MAX_BYTES || '').trim();
9927
10705
  const maxBytes = /^\d+$/.test(maxBytesStr) ? Math.max(0, parseInt(maxBytesStr, 10)) : 262144;
@@ -9953,12 +10731,12 @@ var __webpack_exports__ = {};
9953
10731
  }
9954
10732
  async cleanup() {
9955
10733
  try {
9956
- if ('development' === process.env.EXTENSION_ENV) this.stopWatching();
10734
+ if (this.isAuthorMode()) this.stopWatching();
9957
10735
  if (this.cdpClient && this.currentTargetId) await this.cdpClient.closeTarget(this.currentTargetId);
9958
10736
  if (this.cdpClient) this.cdpClient.disconnect();
9959
- if ('development' === process.env.EXTENSION_ENV) console.log(sourceInspectorCleanupComplete());
10737
+ if (this.isAuthorMode()) console.log(sourceInspectorCleanupComplete());
9960
10738
  } catch (error) {
9961
- if ('development' === process.env.EXTENSION_ENV) console.error(sourceInspectorCleanupError(error.message));
10739
+ if (this.isAuthorMode()) console.error(sourceInspectorCleanupError(error.message));
9962
10740
  }
9963
10741
  }
9964
10742
  apply(compiler) {
@@ -9973,13 +10751,13 @@ var __webpack_exports__ = {};
9973
10751
  const html = await this.inspectSource(urlToInspect);
9974
10752
  this.printHTML(html);
9975
10753
  const webSocketServer = compiler.options.webSocketServer;
9976
- if (this.devOptions.watchSource && 'development' === process.env.EXTENSION_ENV) if (webSocketServer) await this.startWatching(webSocketServer);
10754
+ if (this.devOptions.watchSource && this.isAuthorMode()) if (webSocketServer) await this.startWatching(webSocketServer);
9977
10755
  else try {
9978
10756
  const updated = await this.cdpClient.getPageHTML(this.currentSessionId);
9979
10757
  this.printUpdatedHTML(updated || '');
9980
10758
  } catch {}
9981
10759
  } catch (error) {
9982
- if ('development' === process.env.EXTENSION_ENV) console.error(sourceInspectorSetupFailed(error.message));
10760
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.error(sourceInspectorSetupFailed(error.message));
9983
10761
  }
9984
10762
  });
9985
10763
  }
@@ -10116,7 +10894,7 @@ var __webpack_exports__ = {};
10116
10894
  if (isCleaningUp) return;
10117
10895
  isCleaningUp = true;
10118
10896
  try {
10119
- if ('development' === process.env.EXTENSION_ENV) console.log(enhancedProcessManagementCleanup(browser));
10897
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementCleanup(browser));
10120
10898
  const child = childRef();
10121
10899
  if (child && !child.killed) {
10122
10900
  if ('win32' === process.platform) try {
@@ -10130,11 +10908,11 @@ var __webpack_exports__ = {};
10130
10908
  windowsHide: true
10131
10909
  }).on('error', ()=>{});
10132
10910
  } catch {}
10133
- if ('development' === process.env.EXTENSION_ENV) console.log(enhancedProcessManagementTerminating(browser));
10911
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementTerminating(browser));
10134
10912
  child.kill('SIGTERM');
10135
10913
  setTimeout(()=>{
10136
10914
  if (child && !child.killed) {
10137
- if ('development' === process.env.EXTENSION_ENV) console.log(enhancedProcessManagementForceKill(browser));
10915
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(enhancedProcessManagementForceKill(browser));
10138
10916
  child.kill('SIGKILL');
10139
10917
  }
10140
10918
  }, 5000);
@@ -10154,6 +10932,8 @@ var __webpack_exports__ = {};
10154
10932
  process.on('SIGINT', onSignal);
10155
10933
  process.on('SIGTERM', onSignal);
10156
10934
  process.on('SIGHUP', onSignal);
10935
+ process.on('SIGBREAK', onSignal);
10936
+ process.on('beforeExit', onSignal);
10157
10937
  process.on('uncaughtException', async (error)=>{
10158
10938
  console.error(enhancedProcessManagementUncaughtException(browser, error));
10159
10939
  await attemptCleanup();
@@ -10222,7 +11002,7 @@ var __webpack_exports__ = {};
10222
11002
  host: '127.0.0.1',
10223
11003
  port
10224
11004
  }, ()=>{
10225
- if ('development' === process.env.EXTENSION_ENV) console.log(firefoxRdpClientConnected('127.0.0.1', port));
11005
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(firefoxRdpClientConnected('127.0.0.1', port));
10226
11006
  resolve();
10227
11007
  });
10228
11008
  this.conn = c;
@@ -11322,6 +12102,15 @@ var __webpack_exports__ = {};
11322
12102
  console.log(firefoxDryRunConfig(firefoxConfig));
11323
12103
  }
11324
12104
  const masterPreferences = {
12105
+ 'browser.aboutwelcome.enabled': false,
12106
+ 'browser.startup.homepage_override.mstone': 'ignore',
12107
+ 'browser.shell.didSkipDefaultBrowserCheckOnFirstRun': true,
12108
+ 'datareporting.policy.dataSubmissionPolicyBypassNotification': true,
12109
+ 'browser.startup.upgradeDialog.enabled': false,
12110
+ 'browser.messaging-system.whatsNewPanel.enabled': false,
12111
+ 'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons': false,
12112
+ 'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features': false,
12113
+ 'browser.startup.homepage_override_url': '',
11325
12114
  'app.update.enabled': false,
11326
12115
  'browser.dom.window.dump.enabled': true,
11327
12116
  'browser.formfill.enable': false,
@@ -11550,7 +12339,7 @@ var __webpack_exports__ = {};
11550
12339
  null == (_this_ctx_logger = this.ctx.logger) || null == (_this_ctx_logger_info = _this_ctx_logger.info) || _this_ctx_logger_info.call(_this_ctx_logger, skippingBrowserLaunchDueToCompileErrors());
11551
12340
  return;
11552
12341
  }
11553
- if ('development' === process.env.EXTENSION_ENV) {
12342
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
11554
12343
  var _this_ctx_logger_info1, _this_ctx_logger1;
11555
12344
  null == (_this_ctx_logger1 = this.ctx.logger) || null == (_this_ctx_logger_info1 = _this_ctx_logger1.info) || _this_ctx_logger_info1.call(_this_ctx_logger1, firefoxLaunchCalled());
11556
12345
  }
@@ -11634,11 +12423,11 @@ var __webpack_exports__ = {};
11634
12423
  const binaryArgsMatch = firefoxCfg.match(/--binary-args="([^"]*)"/);
11635
12424
  if (binaryArgsMatch) {
11636
12425
  firefoxArgs.push(...binaryArgsMatch[1].split(' '));
11637
- if ('development' === process.env.EXTENSION_ENV) {
12426
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
11638
12427
  var _this_ctx_logger_info2, _this_ctx_logger2;
11639
12428
  null == (_this_ctx_logger2 = this.ctx.logger) || null == (_this_ctx_logger_info2 = _this_ctx_logger2.info) || _this_ctx_logger_info2.call(_this_ctx_logger2, firefoxBinaryArgsExtracted(binaryArgsMatch[1]));
11640
12429
  }
11641
- } else if ('development' === process.env.EXTENSION_ENV) {
12430
+ } else if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
11642
12431
  var _this_ctx_logger_info3, _this_ctx_logger3;
11643
12432
  null == (_this_ctx_logger3 = this.ctx.logger) || null == (_this_ctx_logger_info3 = _this_ctx_logger3.info) || _this_ctx_logger_info3.call(_this_ctx_logger3, firefoxNoBinaryArgsFound());
11644
12433
  }
@@ -11646,13 +12435,18 @@ var __webpack_exports__ = {};
11646
12435
  if (profileMatch) {
11647
12436
  const profilePath = profileMatch[1];
11648
12437
  const { binary, args } = FirefoxBinaryDetector.generateFirefoxArgs(binaryPath, profilePath, debugPort, firefoxArgs);
12438
+ const isWin = 'win32' === process.platform;
12439
+ const stdio = isWin ? 'ignore' : [
12440
+ 'pipe',
12441
+ 'pipe',
12442
+ 'pipe'
12443
+ ];
11649
12444
  this.child = (0, external_child_process_.spawn)(binary, args, {
11650
- stdio: [
11651
- 'pipe',
11652
- 'pipe',
11653
- 'pipe'
11654
- ],
11655
- detached: false
12445
+ stdio,
12446
+ detached: false,
12447
+ ...isWin ? {
12448
+ windowsHide: true
12449
+ } : {}
11656
12450
  });
11657
12451
  this.wireChildLifecycle(compilation, debugPort, desiredDebugPort);
11658
12452
  const ctrl = await setupRdpAfterLaunch({
@@ -11662,7 +12456,7 @@ var __webpack_exports__ = {};
11662
12456
  this.host.rdpController = ctrl;
11663
12457
  this.ctx.setController(ctrl, debugPort);
11664
12458
  try {
11665
- if ('development' === process.env.EXTENSION_ENV && this.host.instanceId && profileMatch) {
12459
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE && this.host.instanceId && profileMatch) {
11666
12460
  var _this_ctx_logger_info4, _this_ctx_logger4, _this_ctx_logger_info5, _this_ctx_logger5;
11667
12461
  null == (_this_ctx_logger4 = this.ctx.logger) || null == (_this_ctx_logger_info4 = _this_ctx_logger4.info) || _this_ctx_logger_info4.call(_this_ctx_logger4, devFirefoxDebugPort(debugPort, desiredDebugPort));
11668
12462
  null == (_this_ctx_logger5 = this.ctx.logger) || null == (_this_ctx_logger_info5 = _this_ctx_logger5.info) || _this_ctx_logger_info5.call(_this_ctx_logger5, devFirefoxProfilePath(profileMatch[1]));
@@ -11680,13 +12474,18 @@ var __webpack_exports__ = {};
11680
12474
  '--disable-renderer-backgrounding',
11681
12475
  ...firefoxArgs
11682
12476
  ];
12477
+ const isWin = 'win32' === process.platform;
12478
+ const stdio = isWin ? 'ignore' : [
12479
+ 'pipe',
12480
+ 'pipe',
12481
+ 'pipe'
12482
+ ];
11683
12483
  this.child = (0, external_child_process_.spawn)(binaryPath, args, {
11684
- stdio: [
11685
- 'pipe',
11686
- 'pipe',
11687
- 'pipe'
11688
- ],
11689
- detached: false
12484
+ stdio,
12485
+ detached: false,
12486
+ ...isWin ? {
12487
+ windowsHide: true
12488
+ } : {}
11690
12489
  });
11691
12490
  this.wireChildLifecycle(compilation, debugPort, desiredDebugPort);
11692
12491
  }
@@ -11701,7 +12500,7 @@ var __webpack_exports__ = {};
11701
12500
  process.exit(1);
11702
12501
  });
11703
12502
  child.on('close', (_code)=>{
11704
- if ('development' === process.env.EXTENSION_ENV) {
12503
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
11705
12504
  var _this_ctx_logger_info, _this_ctx_logger;
11706
12505
  null == (_this_ctx_logger = this.ctx.logger) || null == (_this_ctx_logger_info = _this_ctx_logger.info) || _this_ctx_logger_info.call(_this_ctx_logger, browserInstanceExited(this.host.browser));
11707
12506
  }
@@ -11709,7 +12508,7 @@ var __webpack_exports__ = {};
11709
12508
  process.exit();
11710
12509
  });
11711
12510
  });
11712
- if ('development' === process.env.EXTENSION_ENV && child) {
12511
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE && child) {
11713
12512
  var _child_stdout, _child_stderr;
11714
12513
  null == (_child_stdout = child.stdout) || _child_stdout.pipe(process.stdout);
11715
12514
  null == (_child_stderr = child.stderr) || _child_stderr.pipe(process.stderr);
@@ -11775,7 +12574,7 @@ var __webpack_exports__ = {};
11775
12574
  color: (null == (_this_options6 = this.options) ? void 0 : _this_options6.logColor) !== false
11776
12575
  });
11777
12576
  } catch (error) {
11778
- if ('development' === process.env.EXTENSION_ENV) {
12577
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
11779
12578
  var _this_ctx_logger_warn, _this_ctx_logger;
11780
12579
  null == (_this_ctx_logger = this.ctx.logger) || null == (_this_ctx_logger_warn = _this_ctx_logger.warn) || _this_ctx_logger_warn.call(_this_ctx_logger, firefoxUnifiedLoggingFailed(String(error)));
11781
12580
  }
@@ -11858,7 +12657,7 @@ var __webpack_exports__ = {};
11858
12657
  await new Promise((resolve)=>setTimeout(resolve, 300));
11859
12658
  continue;
11860
12659
  } catch (error) {
11861
- if ('development' === process.env.EXTENSION_ENV) {
12660
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
11862
12661
  const msg = (null == error ? void 0 : error.message) || String(error);
11863
12662
  console.warn(rdpAddTabFailed(msg));
11864
12663
  }
@@ -11882,7 +12681,7 @@ var __webpack_exports__ = {};
11882
12681
  if (detail.consoleActor) consoleActor = detail.consoleActor;
11883
12682
  if (detail.targetActor) frameActor = detail.targetActor;
11884
12683
  } catch (error) {
11885
- if ('development' === process.env.EXTENSION_ENV) {
12684
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
11886
12685
  const err = error;
11887
12686
  console.warn("[RDP] getTargetFromDescriptor failed:", String(err.message || err));
11888
12687
  }
@@ -11890,7 +12689,7 @@ var __webpack_exports__ = {};
11890
12689
  try {
11891
12690
  await client.attach(frameActor);
11892
12691
  } catch (error) {
11893
- if ('development' === process.env.EXTENSION_ENV) {
12692
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
11894
12693
  const err = error;
11895
12694
  console.warn('[RDP] attach(frameActor) failed:', String(err.message || err));
11896
12695
  }
@@ -11900,7 +12699,7 @@ var __webpack_exports__ = {};
11900
12699
  await client.waitForPageReady(consoleActor, urlToInspect, PAGE_READY_TIMEOUT_MS);
11901
12700
  return;
11902
12701
  } catch (error) {
11903
- if ('development' === process.env.EXTENSION_ENV) {
12702
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
11904
12703
  const err = error;
11905
12704
  console.warn('[RDP] navigateViaScript/waitForPageReady failed:', String(err.message || err));
11906
12705
  }
@@ -11911,7 +12710,7 @@ var __webpack_exports__ = {};
11911
12710
  try {
11912
12711
  await client.attach(targetActor);
11913
12712
  } catch (error) {
11914
- if ('development' === process.env.EXTENSION_ENV) {
12713
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
11915
12714
  const err = error;
11916
12715
  console.warn('[RDP] attach(targetActor) failed:', String(err.message || err));
11917
12716
  }
@@ -11919,7 +12718,7 @@ var __webpack_exports__ = {};
11919
12718
  await client.navigate(targetActor, urlToInspect);
11920
12719
  await client.waitForLoadEvent(targetActor);
11921
12720
  } catch (error) {
11922
- if ('development' === process.env.EXTENSION_ENV) {
12721
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
11923
12722
  const err = error;
11924
12723
  console.warn('[RDP] fallback navigate/waitForLoadEvent failed:', String(err.message || err));
11925
12724
  }
@@ -11963,13 +12762,13 @@ var __webpack_exports__ = {};
11963
12762
  if (this.initialized) return;
11964
12763
  const client = new MessagingClient();
11965
12764
  const port = await this.getRdpPort();
11966
- if ('development' === process.env.EXTENSION_ENV) console.log(sourceInspectorWaitingForFirefox());
12765
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorWaitingForFirefox());
11967
12766
  let retries = 0;
11968
12767
  while(retries < MAX_CONNECT_RETRIES)try {
11969
12768
  await client.connect(port);
11970
12769
  this.client = client;
11971
12770
  this.initialized = true;
11972
- if ('development' === process.env.EXTENSION_ENV) {
12771
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
11973
12772
  console.log(firefoxRemoteDebuggingReady());
11974
12773
  console.log(sourceInspectorInitialized());
11975
12774
  }
@@ -11977,7 +12776,7 @@ var __webpack_exports__ = {};
11977
12776
  } catch (err) {
11978
12777
  retries++;
11979
12778
  if (retries % 10 === 0) {
11980
- if ('development' === process.env.EXTENSION_ENV) console.log(sourceInspectorFirefoxNotReadyYet(retries, MAX_CONNECT_RETRIES));
12779
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorFirefoxNotReadyYet(retries, MAX_CONNECT_RETRIES));
11981
12780
  }
11982
12781
  await wait(CONNECT_RETRY_INTERVAL_MS);
11983
12782
  }
@@ -12003,7 +12802,7 @@ var __webpack_exports__ = {};
12003
12802
  const href = await this.client.evaluate(consoleActor, 'String(location.href)');
12004
12803
  if ('string' != typeof href || !href.startsWith(urlToInspect)) await this.client.navigateViaScript(consoleActor, urlToInspect);
12005
12804
  } catch (error) {
12006
- if ('development' === process.env.EXTENSION_ENV) {
12805
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
12007
12806
  const err = error;
12008
12807
  console.warn('[RDP] ensureUrlAndReady evaluate/navigateViaScript failed:', String(err.message || err));
12009
12808
  }
@@ -12093,7 +12892,7 @@ var __webpack_exports__ = {};
12093
12892
  if (!this.initialized) await this.initialize();
12094
12893
  const urlToInspect = this.resolveUrlToInspect();
12095
12894
  this.lastUrlToInspect = urlToInspect;
12096
- if ('development' === process.env.EXTENSION_ENV) console.log(sourceInspectorWillInspect(urlToInspect));
12895
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(sourceInspectorWillInspect(urlToInspect));
12097
12896
  const { tabActor, consoleActor } = await this.selectActors(urlToInspect);
12098
12897
  this.currentTabActor = tabActor;
12099
12898
  await this.ensureNavigatedAndLoaded(urlToInspect, tabActor);
@@ -12108,7 +12907,7 @@ var __webpack_exports__ = {};
12108
12907
  await this.handleFileChange();
12109
12908
  }
12110
12909
  } catch (error) {
12111
- if ('development' === process.env.EXTENSION_ENV) console.error(sourceInspectorSetupFailed(error.message));
12910
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.error(sourceInspectorSetupFailed(error.message));
12112
12911
  }
12113
12912
  done();
12114
12913
  });
@@ -12175,6 +12974,7 @@ var __webpack_exports__ = {};
12175
12974
  run_firefox_define_property(this, "logTab", void 0);
12176
12975
  run_firefox_define_property(this, "logger", void 0);
12177
12976
  run_firefox_define_property(this, "firefoxCtx", void 0);
12977
+ run_firefox_define_property(this, "rdpController", void 0);
12178
12978
  this.extension = options.extension;
12179
12979
  this.browser = options.browser;
12180
12980
  this.startingUrl = options.startingUrl;
@@ -12210,9 +13010,13 @@ var __webpack_exports__ = {};
12210
13010
  }
12211
13011
  class BrowsersPlugin {
12212
13012
  apply(compiler) {
12213
- if ('chrome' === this.browser || 'edge' === this.browser || 'chromium' === this.browser || 'chromium-based' === this.browser) new RunChromiumPlugin(this).apply(compiler);
12214
- else if ('firefox' === this.browser || 'gecko-based' === this.browser || 'firefox-based' === this.browser) new RunFirefoxPlugin(this).apply(compiler);
12215
- else {
13013
+ if ('chrome' === this.browser || 'edge' === this.browser || 'chromium' === this.browser || 'chromium-based' === this.browser) {
13014
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(usingChromiumRunner(this.browser));
13015
+ new RunChromiumPlugin(this).apply(compiler);
13016
+ } else if ('firefox' === this.browser || 'gecko-based' === this.browser || 'firefox-based' === this.browser) {
13017
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(usingFirefoxRunner(this.browser));
13018
+ new RunFirefoxPlugin(this).apply(compiler);
13019
+ } else {
12216
13020
  try {
12217
13021
  console.error(unsupportedBrowser(String(this.browser)));
12218
13022
  } catch {}
@@ -12273,52 +13077,37 @@ var __webpack_exports__ = {};
12273
13077
  console.error(requireGeckoBinaryForGeckoBased());
12274
13078
  process.exit(1);
12275
13079
  }
12276
- if (false === this.profile && 'development' === process.env.EXTENSION_ENV) console.warn(profileFallbackWarning(this.browser, 'system profile in use (profile: false)'));
13080
+ if (false === this.profile && 'true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(profileFallbackWarning(this.browser, 'system profile in use (profile: false)'));
12277
13081
  }
12278
13082
  }
12279
13083
  plugin_browsers_define_property(BrowsersPlugin, "name", 'plugin-browsers');
12280
13084
  function webpackConfig(projectStructure, devOptions) {
12281
- var _devOptions_output, _devOptions_output1;
12282
- const { manifestPath, packageJsonPath } = projectStructure;
12283
- const manifestDir = external_path_.dirname(manifestPath);
12284
- const packageJsonDir = packageJsonPath ? external_path_.dirname(packageJsonPath) : manifestDir;
12285
- const geckoBinaryAlias = devOptions.geckoBinary || devOptions.firefoxBinary;
12286
- const browser = devOptions.chromiumBinary ? 'chromium-based' : geckoBinaryAlias ? 'gecko-based' : devOptions.browser;
12287
- const manifest = filterKeysForThisBrowser(JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8')), browser);
12288
- const userExtensionOutputPath = external_path_.isAbsolute(devOptions.output.path) ? devOptions.output.path : external_path_.resolve(packageJsonDir, devOptions.output.path);
12289
- const extensionsToLoad = [];
12290
- if ('production' !== devOptions.mode) {
12291
- const devtoolsRoot = external_path_.resolve(__dirname, '../dist/extension-js-devtools');
12292
- const devtoolsEngine = (()=>{
12293
- const b = String(browser || '');
12294
- switch(b){
12295
- case 'chrome':
12296
- return 'chrome';
12297
- case 'edge':
12298
- return 'edge';
12299
- case 'chromium':
12300
- case 'chromium-based':
12301
- return 'chromium';
12302
- case 'firefox':
12303
- case 'gecko-based':
12304
- case 'firefox-based':
12305
- return 'firefox';
12306
- default:
12307
- return b;
12308
- }
12309
- })();
12310
- const devtoolsForBrowser = external_path_.join(devtoolsRoot, devtoolsEngine);
12311
- if (external_fs_.existsSync(devtoolsForBrowser)) extensionsToLoad.push(devtoolsForBrowser);
12312
- }
12313
- extensionsToLoad.push(userExtensionOutputPath);
13085
+ const { manifestPath } = projectStructure;
13086
+ const { packageJsonDir } = getDirs(projectStructure);
13087
+ const manifest = filterKeysForThisBrowser(JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8')), devOptions.browser);
13088
+ const userExtensionOutputPath = asAbsolute(external_path_.isAbsolute(devOptions.output.path) ? devOptions.output.path : external_path_.resolve(packageJsonDir, devOptions.output.path));
13089
+ const extensionsToLoad = computeExtensionsToLoad(__dirname, devOptions.mode, devOptions.browser, userExtensionOutputPath);
13090
+ const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
13091
+ if (debug) {
13092
+ console.log(webpack_lib_messages.Ry(devOptions.browser, devOptions.chromiumBinary, devOptions.geckoBinary));
13093
+ console.log(webpack_lib_messages.ZE(packageJsonDir));
13094
+ console.log(webpack_lib_messages.$T(userExtensionOutputPath));
13095
+ console.log(webpack_lib_messages.KH(extensionsToLoad));
13096
+ }
13097
+ const darkDefaults = withDarkMode({
13098
+ browser: devOptions.browser,
13099
+ browserFlags: devOptions.browserFlags,
13100
+ preferences: devOptions.preferences
13101
+ });
12314
13102
  return {
12315
13103
  mode: devOptions.mode || 'development',
12316
13104
  entry: {},
12317
13105
  target: 'web',
12318
13106
  context: packageJsonDir,
13107
+ cache: false,
12319
13108
  devtool: 'production' === (devOptions.mode || 'development') ? false : 3 === manifest.manifest_version ? 'cheap-source-map' : 'eval-cheap-source-map',
12320
13109
  output: {
12321
- clean: null == (_devOptions_output = devOptions.output) ? void 0 : _devOptions_output.clean,
13110
+ clean: devOptions.output.clean,
12322
13111
  path: userExtensionOutputPath,
12323
13112
  publicPath: '/',
12324
13113
  hotUpdateChunkFilename: 'hot/[id].[fullhash].hot-update.js',
@@ -12328,8 +13117,27 @@ var __webpack_exports__ = {};
12328
13117
  dynamicImport: true
12329
13118
  }
12330
13119
  },
13120
+ watchOptions: {
13121
+ ignored: /node_modules|dist|extension-js\/profiles/,
13122
+ poll: 1000,
13123
+ aggregateTimeout: 200
13124
+ },
12331
13125
  resolve: {
12332
- modules: packageJsonPath ? [
13126
+ mainFields: [
13127
+ 'browser',
13128
+ 'module',
13129
+ 'main'
13130
+ ],
13131
+ conditionNames: [
13132
+ 'browser',
13133
+ 'import',
13134
+ 'module',
13135
+ 'default'
13136
+ ],
13137
+ aliasFields: [
13138
+ 'browser'
13139
+ ],
13140
+ modules: projectStructure.packageJsonPath ? [
12333
13141
  'node_modules',
12334
13142
  external_path_.join(packageJsonDir, 'node_modules'),
12335
13143
  external_path_.join(process.cwd(), 'node_modules')
@@ -12347,27 +13155,8 @@ var __webpack_exports__ = {};
12347
13155
  '.json',
12348
13156
  '.wasm',
12349
13157
  '.svelte'
12350
- ],
12351
- mainFields: [
12352
- 'browser',
12353
- 'module',
12354
- 'main'
12355
- ],
12356
- conditionNames: [
12357
- 'browser',
12358
- 'import',
12359
- 'module',
12360
- 'default'
12361
- ],
12362
- aliasFields: [
12363
- 'browser'
12364
13158
  ]
12365
13159
  },
12366
- watchOptions: {
12367
- ignored: /node_modules|dist|extension-js\/profiles/,
12368
- poll: 1000,
12369
- aggregateTimeout: 200
12370
- },
12371
13160
  module: {
12372
13161
  rules: [],
12373
13162
  parser: {
@@ -12376,12 +13165,11 @@ var __webpack_exports__ = {};
12376
13165
  }
12377
13166
  }
12378
13167
  },
12379
- cache: false,
12380
13168
  plugins: [
12381
13169
  new CompilationPlugin({
12382
13170
  manifestPath,
12383
- browser,
12384
- clean: null == (_devOptions_output1 = devOptions.output) ? void 0 : _devOptions_output1.clean,
13171
+ browser: devOptions.browser,
13172
+ clean: devOptions.output.clean,
12385
13173
  zip: true === devOptions.zip,
12386
13174
  zipSource: true === devOptions.zipSource,
12387
13175
  zipFilename: devOptions.zipFilename
@@ -12399,24 +13187,24 @@ var __webpack_exports__ = {};
12399
13187
  }),
12400
13188
  new CompatibilityPlugin({
12401
13189
  manifestPath,
12402
- browser,
13190
+ browser: devOptions.browser,
12403
13191
  polyfill: devOptions.polyfill
12404
13192
  }),
12405
13193
  new ExtensionPlugin({
12406
13194
  manifestPath,
12407
- browser
13195
+ browser: devOptions.browser
12408
13196
  }),
12409
13197
  new BrowsersPlugin({
12410
13198
  extension: extensionsToLoad,
12411
- browser,
13199
+ browser: devOptions.browser,
12412
13200
  noOpen: devOptions.noOpen,
12413
13201
  startingUrl: devOptions.startingUrl,
12414
13202
  profile: devOptions.profile,
12415
13203
  persistProfile: devOptions.persistProfile,
12416
- preferences: devOptions.preferences,
12417
- browserFlags: devOptions.browserFlags,
13204
+ preferences: darkDefaults.preferences,
13205
+ browserFlags: darkDefaults.browserFlags,
12418
13206
  chromiumBinary: devOptions.chromiumBinary,
12419
- geckoBinary: geckoBinaryAlias,
13207
+ geckoBinary: devOptions.geckoBinary,
12420
13208
  instanceId: devOptions.instanceId,
12421
13209
  port: devOptions.port,
12422
13210
  source: devOptions.source,
@@ -12441,7 +13229,7 @@ var __webpack_exports__ = {};
12441
13229
  logging: 'none'
12442
13230
  },
12443
13231
  infrastructureLogging: {
12444
- level: 'development' === devOptions.mode && '1' === String(process.env.EXTENSION_VERBOSE || '').trim() ? 'info' : 'error',
13232
+ level: 'development' === String(devOptions.mode) && '1' === String(process.env.EXTENSION_VERBOSE || '').trim() ? 'info' : 'error',
12445
13233
  console: makeSanitizedConsole('Extension.js')
12446
13234
  },
12447
13235
  ignoreWarnings: [
@@ -12489,13 +13277,19 @@ var __webpack_exports__ = {};
12489
13277
  const projectStructure = await getProjectStructure(pathOrRemoteUrl);
12490
13278
  const isVitest = 'true' === process.env.VITEST;
12491
13279
  const shouldExitOnError = ((null == buildOptions ? void 0 : buildOptions.exitOnError) ?? true) && !isVitest;
12492
- const browser = (null == buildOptions ? void 0 : buildOptions.browser) || 'chrome';
13280
+ const browser = normalizeBrowser((null == buildOptions ? void 0 : buildOptions.browser) || 'chrome', null == buildOptions ? void 0 : buildOptions.chromiumBinary, (null == buildOptions ? void 0 : buildOptions.geckoBinary) || (null == buildOptions ? void 0 : buildOptions.firefoxBinary));
12493
13281
  try {
12494
13282
  var _baseConfig_plugins;
12495
- const manifestDir = external_path_.dirname(projectStructure.manifestPath);
12496
- const packageJsonDir = projectStructure.packageJsonPath ? external_path_.dirname(projectStructure.packageJsonPath) : manifestDir;
12497
- if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, external_path_.dirname(projectStructure.manifestPath));
13283
+ const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
13284
+ const { manifestDir, packageJsonDir } = getDirs(projectStructure);
13285
+ if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, manifestDir);
12498
13286
  const commandConfig = await loadCommandConfig(manifestDir, 'build');
13287
+ const distPath = getDistPath(packageJsonDir, browser);
13288
+ if (debug) {
13289
+ console.log(webpack_lib_messages.OF(manifestDir, packageJsonDir));
13290
+ console.log(webpack_lib_messages.Ry(browser, null == buildOptions ? void 0 : buildOptions.chromiumBinary, (null == buildOptions ? void 0 : buildOptions.geckoBinary) || (null == buildOptions ? void 0 : buildOptions.firefoxBinary)));
13291
+ console.log(webpack_lib_messages.$T(distPath));
13292
+ }
12499
13293
  const baseConfig = webpackConfig(projectStructure, {
12500
13294
  ...commandConfig,
12501
13295
  ...buildOptions,
@@ -12503,7 +13297,7 @@ var __webpack_exports__ = {};
12503
13297
  mode: 'production',
12504
13298
  output: {
12505
13299
  clean: true,
12506
- path: external_path_.join(packageJsonDir, 'dist', browser)
13300
+ path: distPath
12507
13301
  }
12508
13302
  });
12509
13303
  const allPluginsButBrowserRunners = null == (_baseConfig_plugins = baseConfig.plugins) ? void 0 : _baseConfig_plugins.filter((plugin)=>(null == plugin ? void 0 : plugin.constructor.name) !== 'plugin-browsers');
@@ -12515,9 +13309,7 @@ var __webpack_exports__ = {};
12515
13309
  const compilerConfig = (0, external_webpack_merge_namespaceObject.merge)(userConfig);
12516
13310
  const compiler = (0, core_namespaceObject.rspack)(compilerConfig);
12517
13311
  if (projectStructure.packageJsonPath) {
12518
- const nodeModulesPath = external_path_.join(packageJsonDir, 'node_modules');
12519
- const needsInstall = !external_fs_.existsSync(nodeModulesPath) || external_fs_.existsSync(nodeModulesPath) && 0 === external_fs_.readdirSync(nodeModulesPath).length;
12520
- if (needsInstall) {
13312
+ if (needsInstall(packageJsonDir)) {
12521
13313
  console.log(webpack_lib_messages.Nv());
12522
13314
  if ('true' !== process.env.VITEST) await installDependencies(packageJsonDir);
12523
13315
  }
@@ -12594,7 +13386,7 @@ var __webpack_exports__ = {};
12594
13386
  return `Extension.js Runner Error:\n${external_pintor_default().red(String(error))}`;
12595
13387
  }
12596
13388
  function autoExitModeEnabled(ms) {
12597
- return `Auto-exit mode enabled. Will exit after ${external_pintor_default().brightBlue(ms.toString())} ms if idle.`;
13389
+ return `Auto-exit enabled. Will exit after ${external_pintor_default().brightBlue(ms.toString())} ms if idle.`;
12598
13390
  }
12599
13391
  function autoExitTriggered(ms) {
12600
13392
  return `Auto-exit triggered after ${external_pintor_default().brightBlue(ms.toString())} ms. Cleaning up...`;
@@ -12778,15 +13570,14 @@ var __webpack_exports__ = {};
12778
13570
  function closeAll(devServer, portManager) {
12779
13571
  devServer.stop().then(async ()=>{
12780
13572
  await portManager.terminateCurrentInstance();
12781
- process.exit();
13573
+ setTimeout(()=>process.exit(), 500);
12782
13574
  }).catch(async (error)=>{
12783
13575
  console.log(messages_extensionJsRunnerError(error));
12784
13576
  await portManager.terminateCurrentInstance();
12785
- process.exit(1);
13577
+ setTimeout(()=>process.exit(1), 500);
12786
13578
  });
12787
13579
  }
12788
13580
  async function dev_server_devServer(projectStructure, devOptions) {
12789
- var _process_removeAllListeners, _process, _process_removeAllListeners1, _process1, _process_removeAllListeners2, _process2, _process_removeAllListeners3, _process3;
12790
13581
  const { manifestPath, packageJsonPath } = projectStructure;
12791
13582
  const manifestDir = external_path_.dirname(manifestPath);
12792
13583
  const packageJsonDir = external_path_.dirname(packageJsonPath);
@@ -12958,10 +13749,6 @@ var __webpack_exports__ = {};
12958
13749
  } catch {}
12959
13750
  await cleanup();
12960
13751
  };
12961
- null == (_process_removeAllListeners = (_process = process).removeAllListeners) || _process_removeAllListeners.call(_process, 'SIGINT');
12962
- null == (_process_removeAllListeners1 = (_process1 = process).removeAllListeners) || _process_removeAllListeners1.call(_process1, 'SIGTERM');
12963
- null == (_process_removeAllListeners2 = (_process2 = process).removeAllListeners) || _process_removeAllListeners2.call(_process2, 'SIGHUP');
12964
- null == (_process_removeAllListeners3 = (_process3 = process).removeAllListeners) || _process_removeAllListeners3.call(_process3, 'ERROR');
12965
13752
  process.on('ERROR', cancelAndCleanup);
12966
13753
  process.on('SIGINT', cancelAndCleanup);
12967
13754
  process.on('SIGTERM', cancelAndCleanup);
@@ -13000,22 +13787,27 @@ var __webpack_exports__ = {};
13000
13787
  async function extensionDev(pathOrRemoteUrl, devOptions) {
13001
13788
  const projectStructure = await getProjectStructure(pathOrRemoteUrl);
13002
13789
  try {
13003
- const manifestDir = external_path_.dirname(projectStructure.manifestPath);
13004
- const packageJsonDir = external_path_.dirname(projectStructure.packageJsonPath);
13790
+ const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
13791
+ const { manifestDir, packageJsonDir } = getDirs(projectStructure);
13005
13792
  if (isUsingTypeScript(manifestDir)) await generateExtensionTypes(manifestDir, packageJsonDir);
13006
- if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, external_path_.dirname(projectStructure.manifestPath));
13793
+ if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, manifestDir);
13007
13794
  if (projectStructure.packageJsonPath) {
13008
- const nodeModulesPath = external_path_.join(packageJsonDir, 'node_modules');
13009
- const needsInstall = !external_fs_.existsSync(nodeModulesPath) || external_fs_.existsSync(nodeModulesPath) && 0 === external_fs_.readdirSync(nodeModulesPath).length;
13010
- if (needsInstall) {
13795
+ if (needsInstall(packageJsonDir)) {
13011
13796
  console.log(webpack_lib_messages.Nv());
13012
13797
  await installDependencies(packageJsonDir);
13013
13798
  }
13014
13799
  }
13800
+ const browser = normalizeBrowser(devOptions.browser || 'chrome', devOptions.chromiumBinary, devOptions.geckoBinary || devOptions.firefoxBinary);
13801
+ const geckoBinary = devOptions.geckoBinary || devOptions.firefoxBinary;
13802
+ if (debug) {
13803
+ console.log(webpack_lib_messages.OF(manifestDir, packageJsonDir));
13804
+ console.log(webpack_lib_messages.Ry(browser, devOptions.chromiumBinary, geckoBinary));
13805
+ }
13015
13806
  await dev_server_devServer(projectStructure, {
13016
13807
  ...devOptions,
13017
13808
  mode: 'development',
13018
- browser: devOptions.browser || 'chrome'
13809
+ browser,
13810
+ geckoBinary
13019
13811
  });
13020
13812
  } catch (error) {
13021
13813
  console.error(error);
@@ -13024,19 +13816,22 @@ var __webpack_exports__ = {};
13024
13816
  }
13025
13817
  async function extensionPreview(pathOrRemoteUrl, previewOptions) {
13026
13818
  const projectStructure = await getProjectStructure(pathOrRemoteUrl);
13819
+ const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
13027
13820
  if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, external_path_.dirname(projectStructure.manifestPath));
13028
- const manifestDir = external_path_.dirname(projectStructure.manifestPath);
13029
- const packageJsonDir = projectStructure.packageJsonPath ? external_path_.dirname(projectStructure.packageJsonPath) : manifestDir;
13030
- const distPath = external_path_.join(packageJsonDir, 'dist', previewOptions.browser);
13031
- const outputPath = previewOptions.outputPath || distPath;
13821
+ const { manifestDir, packageJsonDir } = getDirs(projectStructure);
13822
+ const browser = normalizeBrowser(previewOptions.browser || 'chrome', previewOptions.chromiumBinary, previewOptions.geckoBinary || previewOptions.firefoxBinary);
13823
+ const outputPath = computePreviewOutputPath(projectStructure, browser, previewOptions.outputPath);
13824
+ const distPath = getDistPath(packageJsonDir, browser);
13825
+ if (debug) {
13826
+ console.log(webpack_lib_messages.OF(manifestDir, packageJsonDir));
13827
+ console.log(webpack_lib_messages.Ry(browser, previewOptions.chromiumBinary, previewOptions.geckoBinary || previewOptions.firefoxBinary));
13828
+ console.log(webpack_lib_messages.vQ(outputPath, distPath));
13829
+ }
13032
13830
  try {
13033
- if (!external_fs_.existsSync(outputPath)) external_fs_.mkdirSync(outputPath, {
13034
- recursive: true
13035
- });
13831
+ if (outputPath === distPath) ensureDirSync(outputPath);
13036
13832
  } catch {}
13037
13833
  try {
13038
13834
  var _baseConfig_plugins;
13039
- const browser = previewOptions.browser || 'chrome';
13040
13835
  const commandConfig = await loadCommandConfig(manifestDir, 'preview');
13041
13836
  const browserConfig = await loadBrowserConfig(manifestDir, browser);
13042
13837
  console.log(webpack_lib_messages.WW(browser));
@@ -13047,7 +13842,7 @@ var __webpack_exports__ = {};
13047
13842
  profile: previewOptions.profile,
13048
13843
  browser,
13049
13844
  chromiumBinary: previewOptions.chromiumBinary,
13050
- geckoBinary: previewOptions.geckoBinary,
13845
+ geckoBinary: previewOptions.geckoBinary || previewOptions.firefoxBinary,
13051
13846
  startingUrl: previewOptions.startingUrl,
13052
13847
  port: previewOptions.port,
13053
13848
  source: previewOptions.source,
@@ -13123,17 +13918,24 @@ var __webpack_exports__ = {};
13123
13918
  }
13124
13919
  });
13125
13920
  } catch (error) {
13126
- if ('development' === process.env.EXTENSION_ENV) console.error(error);
13921
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.error(error);
13127
13922
  process.exit(1);
13128
13923
  }
13129
13924
  }
13130
13925
  async function extensionStart(pathOrRemoteUrl, startOptions) {
13131
13926
  const projectStructure = await getProjectStructure(pathOrRemoteUrl);
13132
13927
  try {
13133
- const browser = startOptions.browser || 'chrome';
13134
- const manifestDir = external_path_.dirname(projectStructure.manifestPath);
13928
+ const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
13929
+ const browser = normalizeBrowser(startOptions.browser || 'chrome', startOptions.chromiumBinary, startOptions.geckoBinary || startOptions.firefoxBinary);
13930
+ const { manifestDir, packageJsonDir } = getDirs(projectStructure);
13135
13931
  const commandConfig = await loadCommandConfig(manifestDir, 'start');
13136
13932
  const browserConfig = await loadBrowserConfig(manifestDir, browser);
13933
+ const distPath = getDistPath(packageJsonDir, browser);
13934
+ if (debug) {
13935
+ console.log(webpack_lib_messages.OF(manifestDir, packageJsonDir));
13936
+ console.log(webpack_lib_messages.Ry(browser, startOptions.chromiumBinary, startOptions.geckoBinary || startOptions.firefoxBinary));
13937
+ console.log(webpack_lib_messages.$T(distPath));
13938
+ }
13137
13939
  await extensionBuild(pathOrRemoteUrl, {
13138
13940
  ...browserConfig,
13139
13941
  ...commandConfig,
@@ -13141,16 +13943,16 @@ var __webpack_exports__ = {};
13141
13943
  browser,
13142
13944
  silent: true
13143
13945
  });
13144
- const packageJsonDir = projectStructure.packageJsonPath ? external_path_.dirname(projectStructure.packageJsonPath) : manifestDir;
13145
13946
  await extensionPreview(pathOrRemoteUrl, {
13146
13947
  ...browserConfig,
13147
13948
  ...commandConfig,
13148
13949
  ...startOptions,
13149
13950
  browser,
13150
- outputPath: external_path_.join(packageJsonDir, 'dist', browser)
13951
+ geckoBinary: startOptions.geckoBinary || startOptions.firefoxBinary,
13952
+ outputPath: distPath
13151
13953
  });
13152
13954
  } catch (error) {
13153
- if ('development' === process.env.EXTENSION_ENV) console.error(error);
13955
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.error(error);
13154
13956
  process.exit(1);
13155
13957
  }
13156
13958
  }