extension-develop 3.5.1 → 3.6.0

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.cjs CHANGED
@@ -127122,6 +127122,280 @@ var __webpack_modules__ = {
127122
127122
  });
127123
127123
  module.exports = library;
127124
127124
  },
127125
+ "./webpack/feature-special-folders/folder-extensions/resolve-config.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
127126
+ "use strict";
127127
+ __webpack_require__.d(__webpack_exports__, {
127128
+ R: ()=>resolveCompanionExtensionsConfig
127129
+ });
127130
+ var external_fs_ = __webpack_require__("fs");
127131
+ var external_path_ = __webpack_require__("path");
127132
+ const external_extension_from_store_namespaceObject = require("extension-from-store");
127133
+ var utils = __webpack_require__("./webpack/feature-special-folders/folder-extensions/utils.ts");
127134
+ function isPathLike(value) {
127135
+ if (external_path_.isAbsolute(value)) return true;
127136
+ if (value.startsWith('./') || value.startsWith('../')) return true;
127137
+ return value.includes('/') || value.includes('\\');
127138
+ }
127139
+ function isSubpathOf(parent, child) {
127140
+ const rel = external_path_.relative(parent, child);
127141
+ return '' !== rel && !rel.startsWith('..') && !external_path_.isAbsolute(rel);
127142
+ }
127143
+ function getBrowserFolder(browser) {
127144
+ if ('firefox' === browser || 'gecko-based' === browser || 'firefox-based' === browser) return 'firefox';
127145
+ if ('edge' === browser) return 'edge';
127146
+ return 'chrome';
127147
+ }
127148
+ function parseChromeWebStoreId(url) {
127149
+ if ('chromewebstore.google.com' !== url.hostname) return null;
127150
+ const match = url.pathname.match(/\/([a-z]{32})(?:\/|$)/i);
127151
+ return match ? match[1] : null;
127152
+ }
127153
+ function parseEdgeAddonsId(url) {
127154
+ if ('microsoftedge.microsoft.com' !== url.hostname) return null;
127155
+ const match = url.pathname.match(/\/([a-z]{32})(?:\/|$)/i);
127156
+ return match ? match[1] : null;
127157
+ }
127158
+ function parseAmoSlug(url) {
127159
+ if ('addons.mozilla.org' !== url.hostname) return null;
127160
+ const match = url.pathname.match(/\/addon\/([^/]+)(?:\/|$)/i);
127161
+ return match ? match[1] : null;
127162
+ }
127163
+ function parseStoreUrl(raw) {
127164
+ let url;
127165
+ try {
127166
+ url = new URL(raw);
127167
+ } catch {
127168
+ return null;
127169
+ }
127170
+ const chromeId = parseChromeWebStoreId(url);
127171
+ if (chromeId) return {
127172
+ browser: 'chrome',
127173
+ id: chromeId
127174
+ };
127175
+ const edgeId = parseEdgeAddonsId(url);
127176
+ if (edgeId) return {
127177
+ browser: 'edge',
127178
+ id: edgeId
127179
+ };
127180
+ const amoSlug = parseAmoSlug(url);
127181
+ if (amoSlug) return {
127182
+ browser: 'firefox',
127183
+ id: amoSlug
127184
+ };
127185
+ return null;
127186
+ }
127187
+ function ensurePathsUnderExtensions(projectRoot, paths) {
127188
+ const extensionsRoot = external_path_.resolve(projectRoot, 'extensions');
127189
+ return paths.map((p)=>{
127190
+ const abs = (0, utils.A$)(projectRoot, p);
127191
+ if (abs !== extensionsRoot && !isSubpathOf(extensionsRoot, abs) && external_path_.resolve(abs) !== extensionsRoot) throw new Error(`Companion extensions must be inside ${extensionsRoot}.\nInvalid path: ${abs}`);
127192
+ return abs;
127193
+ });
127194
+ }
127195
+ function findExtensionRoots(dir, maxDepth = 3) {
127196
+ const found = [];
127197
+ function walk(current, depth) {
127198
+ if (depth > maxDepth) return;
127199
+ if (!(0, utils.Q7)(current)) return;
127200
+ if ((0, utils.Uy)(current)) return void found.push(current);
127201
+ let entries = [];
127202
+ try {
127203
+ entries = external_fs_.readdirSync(current, {
127204
+ withFileTypes: true
127205
+ });
127206
+ } catch {
127207
+ return;
127208
+ }
127209
+ for (const ent of entries)if (ent.isDirectory()) {
127210
+ if (!ent.name.startsWith('.')) walk(external_path_.join(current, ent.name), depth + 1);
127211
+ }
127212
+ }
127213
+ walk(dir, 0);
127214
+ return found;
127215
+ }
127216
+ async function runExtensionFromStore(url, outDir) {
127217
+ const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
127218
+ await (0, external_extension_from_store_namespaceObject.fetchExtensionFromStore)(url, {
127219
+ outDir,
127220
+ extract: true,
127221
+ logger: isAuthor ? {
127222
+ onInfo: (message)=>console.log(message),
127223
+ onWarn: (message)=>console.warn(message),
127224
+ onError: (message, error)=>console.error(message, error)
127225
+ } : void 0
127226
+ });
127227
+ }
127228
+ async function resolveStoreExtensionToPath(opts) {
127229
+ const { projectRoot, storeUrl, browser, id } = opts;
127230
+ const extensionsRoot = external_path_.resolve(projectRoot, 'extensions');
127231
+ const targetRoot = external_path_.join(extensionsRoot, browser, id);
127232
+ const manifestPath = external_path_.join(targetRoot, 'manifest.json');
127233
+ if ((0, utils.fo)(manifestPath)) return targetRoot;
127234
+ await runExtensionFromStore(storeUrl, external_path_.join(extensionsRoot, browser));
127235
+ const candidates = findExtensionRoots(external_path_.join(extensionsRoot, browser));
127236
+ let selected;
127237
+ if (1 === candidates.length) selected = candidates[0];
127238
+ else if (candidates.length > 1) {
127239
+ const directMatch = candidates.find((c)=>external_path_.basename(c) === id);
127240
+ const versionedMatch = candidates.find((c)=>external_path_.basename(c).startsWith(`${id}@`));
127241
+ if (directMatch) selected = directMatch;
127242
+ else if (versionedMatch) selected = versionedMatch;
127243
+ }
127244
+ if (!selected) throw new Error(`Could not locate an unpacked extension from ${storeUrl}.`);
127245
+ external_fs_.mkdirSync(external_path_.dirname(targetRoot), {
127246
+ recursive: true
127247
+ });
127248
+ if (external_path_.basename(selected).startsWith(`${id}@`)) external_fs_.renameSync(selected, targetRoot);
127249
+ return targetRoot;
127250
+ }
127251
+ async function resolveCompanionExtensionsConfig(opts) {
127252
+ const { projectRoot, browser, config } = opts;
127253
+ if (!config) return;
127254
+ const normalized = (0, utils.cz)(config);
127255
+ const runtimeBrowser = getBrowserFolder(browser);
127256
+ const resolvedPaths = [];
127257
+ const localPaths = [];
127258
+ for (const entry of normalized.paths){
127259
+ const parsedStore = parseStoreUrl(entry);
127260
+ if (parsedStore) {
127261
+ if (parsedStore.browser !== runtimeBrowser) continue;
127262
+ const resolvedPath = await resolveStoreExtensionToPath({
127263
+ projectRoot,
127264
+ storeUrl: entry,
127265
+ browser: parsedStore.browser,
127266
+ id: parsedStore.id
127267
+ });
127268
+ resolvedPaths.push(resolvedPath);
127269
+ continue;
127270
+ }
127271
+ if (isPathLike(entry)) localPaths.push(entry);
127272
+ }
127273
+ if (localPaths.length > 0) {
127274
+ const absLocalPaths = ensurePathsUnderExtensions(projectRoot, localPaths);
127275
+ resolvedPaths.push(...absLocalPaths);
127276
+ }
127277
+ const output = {};
127278
+ if ('string' == typeof normalized.dir) {
127279
+ const absDir = (0, utils.A$)(projectRoot, normalized.dir);
127280
+ const extensionsRoot = external_path_.resolve(projectRoot, 'extensions');
127281
+ if (absDir !== extensionsRoot && !isSubpathOf(extensionsRoot, absDir)) throw new Error(`extensions.dir must be inside ${extensionsRoot}.\nInvalid dir: ${absDir}`);
127282
+ output.dir = normalized.dir;
127283
+ }
127284
+ if (resolvedPaths.length > 0) output.paths = resolvedPaths;
127285
+ return output;
127286
+ }
127287
+ },
127288
+ "./webpack/feature-special-folders/folder-extensions/utils.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
127289
+ "use strict";
127290
+ __webpack_require__.d(__webpack_exports__, {
127291
+ A$: ()=>toAbs,
127292
+ Q7: ()=>isDir,
127293
+ Uy: ()=>isValidExtensionRoot,
127294
+ cz: ()=>normalizeCompanionConfig,
127295
+ fo: ()=>isFile
127296
+ });
127297
+ var fs__rspack_import_0 = __webpack_require__("fs");
127298
+ var path__rspack_import_1 = __webpack_require__("path");
127299
+ function isDir(p) {
127300
+ try {
127301
+ return fs__rspack_import_0.existsSync(p) && fs__rspack_import_0.statSync(p).isDirectory();
127302
+ } catch {
127303
+ return false;
127304
+ }
127305
+ }
127306
+ function isFile(p) {
127307
+ try {
127308
+ return fs__rspack_import_0.existsSync(p) && fs__rspack_import_0.statSync(p).isFile();
127309
+ } catch {
127310
+ return false;
127311
+ }
127312
+ }
127313
+ function toAbs(projectRoot, p) {
127314
+ return path__rspack_import_1.isAbsolute(p) ? p : path__rspack_import_1.resolve(projectRoot, p);
127315
+ }
127316
+ function isValidExtensionRoot(dir) {
127317
+ if (!isDir(dir)) return false;
127318
+ return isFile(path__rspack_import_1.join(dir, 'manifest.json'));
127319
+ }
127320
+ function normalizeCompanionConfig(config) {
127321
+ const explicitPaths = [];
127322
+ let scanDir;
127323
+ if (Array.isArray(config)) explicitPaths.push(...config.filter((p)=>'string' == typeof p));
127324
+ else if (config && 'object' == typeof config) {
127325
+ if (Array.isArray(config.paths)) explicitPaths.push(...config.paths.filter((p)=>'string' == typeof p));
127326
+ if ('string' == typeof config.dir && config.dir.trim().length > 0) scanDir = config.dir.trim();
127327
+ }
127328
+ return {
127329
+ dir: scanDir,
127330
+ paths: explicitPaths
127331
+ };
127332
+ }
127333
+ },
127334
+ "./webpack/feature-special-folders/get-data.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
127335
+ "use strict";
127336
+ __webpack_require__.d(__webpack_exports__, {
127337
+ B: ()=>getSpecialFoldersDataForCompiler,
127338
+ H: ()=>getSpecialFoldersDataForProjectRoot
127339
+ });
127340
+ var path__rspack_import_0 = __webpack_require__("path");
127341
+ var path__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(path__rspack_import_0);
127342
+ var fs__rspack_import_1 = __webpack_require__("fs");
127343
+ var browser_extension_manifest_fields__rspack_import_2 = __webpack_require__("browser-extension-manifest-fields");
127344
+ function isUnderPublicDir(entry, projectRoot, publicDir) {
127345
+ if (!entry) return false;
127346
+ const normalizedEntry = String(entry);
127347
+ const candidate = path__rspack_import_0_default().isAbsolute(normalizedEntry) ? normalizedEntry : path__rspack_import_0_default().join(projectRoot, normalizedEntry);
127348
+ const rel = path__rspack_import_0_default().relative(publicDir, candidate);
127349
+ return Boolean(rel && !rel.startsWith('..') && !path__rspack_import_0_default().isAbsolute(rel));
127350
+ }
127351
+ function filterPublicEntrypoints(list, projectRoot, publicDir) {
127352
+ const next = {};
127353
+ for (const [key, value] of Object.entries(list || {})){
127354
+ if (Array.isArray(value)) {
127355
+ const filtered = value.filter((entry)=>!isUnderPublicDir(String(entry), projectRoot, publicDir));
127356
+ if (filtered.length > 0) next[key] = filtered;
127357
+ continue;
127358
+ }
127359
+ if ('string' == typeof value) {
127360
+ if (!isUnderPublicDir(value, projectRoot, publicDir)) next[key] = value;
127361
+ continue;
127362
+ }
127363
+ }
127364
+ return next;
127365
+ }
127366
+ function getSpecialFoldersDataForCompiler(compiler) {
127367
+ const projectRoot = compiler.options.context || '';
127368
+ const publicDir = path__rspack_import_0_default().join(projectRoot, 'public');
127369
+ const data = (0, browser_extension_manifest_fields__rspack_import_2.getSpecialFoldersData)({
127370
+ manifestPath: path__rspack_import_0_default().join(projectRoot, 'package.json')
127371
+ });
127372
+ return finalizeSpecialFoldersData(data, projectRoot, publicDir);
127373
+ }
127374
+ function getSpecialFoldersDataForProjectRoot(projectRoot) {
127375
+ const publicDir = path__rspack_import_0_default().join(projectRoot, 'public');
127376
+ const data = (0, browser_extension_manifest_fields__rspack_import_2.getSpecialFoldersData)({
127377
+ manifestPath: path__rspack_import_0_default().join(projectRoot, 'package.json')
127378
+ });
127379
+ return finalizeSpecialFoldersData(data, projectRoot, publicDir);
127380
+ }
127381
+ function finalizeSpecialFoldersData(data, projectRoot, publicDir) {
127382
+ return {
127383
+ ...data,
127384
+ pages: filterPublicEntrypoints(data.pages, projectRoot, publicDir),
127385
+ scripts: filterPublicEntrypoints(data.scripts, projectRoot, publicDir),
127386
+ extensions: getLocalExtensionsConfig(projectRoot)
127387
+ };
127388
+ }
127389
+ function getLocalExtensionsConfig(projectRoot) {
127390
+ if (!projectRoot) return;
127391
+ const extensionsDir = path__rspack_import_0_default().join(projectRoot, 'extensions');
127392
+ try {
127393
+ if (fs__rspack_import_1.existsSync(extensionsDir) && fs__rspack_import_1.statSync(extensionsDir).isDirectory()) return {
127394
+ dir: './extensions'
127395
+ };
127396
+ } catch {}
127397
+ }
127398
+ },
127125
127399
  "./webpack/plugin-browsers/browsers-lib/banner.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
127126
127400
  "use strict";
127127
127401
  __webpack_require__.d(__webpack_exports__, {
@@ -129189,83 +129463,8 @@ var __webpack_modules__ = {
129189
129463
  if (Array.isArray(codeWanted)) return codeWanted.includes(code);
129190
129464
  return code === codeWanted;
129191
129465
  }
129466
+ var firefox_utils = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/firefox-utils.ts");
129192
129467
  var external_path_ = __webpack_require__("path");
129193
- var banner = __webpack_require__("./webpack/plugin-browsers/browsers-lib/banner.ts");
129194
- async function waitForManifest(outPath, timeoutMs = 8000) {
129195
- const manifestPath = external_path_.join(outPath, 'manifest.json');
129196
- const start = Date.now();
129197
- while(Date.now() - start < timeoutMs){
129198
- try {
129199
- if (external_fs_.existsSync(manifestPath)) return true;
129200
- } catch {}
129201
- await new Promise((resolve)=>setTimeout(resolve, 150));
129202
- }
129203
- return false;
129204
- }
129205
- async function printRunningInDevelopmentSummary(candidateAddonPaths, browser, extensionId, browserVersionLine) {
129206
- try {
129207
- let chosenPath = null;
129208
- for (const p of candidateAddonPaths){
129209
- const isManager = /extensions\/[a-z-]+-manager/.test(String(p));
129210
- const isDevtools = /extension-js-devtools/.test(String(p));
129211
- const isThemePath = /extension-js-theme/.test(String(p));
129212
- if (isManager || isDevtools || isThemePath) continue;
129213
- const mp = external_path_.join(p, 'manifest.json');
129214
- if (external_fs_.existsSync(mp)) {
129215
- const mf = JSON.parse(external_fs_.readFileSync(mp, 'utf-8'));
129216
- const name = mf?.name || '';
129217
- const isThemeManifest = mf?.theme != null || 'theme' === String(mf?.type || '');
129218
- if ('string' == typeof name && !/Extension\.js DevTools/i.test(name) && !/theme/i.test(name) && !isThemeManifest) {
129219
- chosenPath = p;
129220
- break;
129221
- }
129222
- }
129223
- }
129224
- if (!chosenPath && candidateAddonPaths.length > 0) chosenPath = candidateAddonPaths[candidateAddonPaths.length - 1];
129225
- if (!chosenPath) return false;
129226
- const manifestPath = external_path_.join(chosenPath, 'manifest.json');
129227
- if (!external_fs_.existsSync(manifestPath)) {
129228
- const ready = await waitForManifest(chosenPath, 10000);
129229
- if (!ready) return false;
129230
- }
129231
- const manifest = JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8'));
129232
- const printed = await (0, banner.a)({
129233
- browser,
129234
- outPath: chosenPath,
129235
- hostPort: {
129236
- host: '127.0.0.1'
129237
- },
129238
- getInfo: async ()=>({
129239
- extensionId: extensionId || '(temporary)',
129240
- name: manifest.name,
129241
- version: manifest.version
129242
- }),
129243
- browserVersionLine
129244
- });
129245
- return printed;
129246
- } catch {
129247
- return false;
129248
- }
129249
- }
129250
- function printSourceInspection(html) {
129251
- console.log(messages.sew());
129252
- console.log(messages.sew());
129253
- console.log(html);
129254
- console.log(messages.sew());
129255
- }
129256
- function printLogEventPretty(event, color, colorFns, showTs) {
129257
- const ts = showTs ? new Date(event.timestamp).toISOString() + ' ' : '';
129258
- const level = event.level;
129259
- const context = event.context;
129260
- const text = event.messageParts[0];
129261
- const url = event.url;
129262
- const arrow = 'error' === level ? color ? colorFns.red('►►►') : '►►►' : 'warn' === level ? color ? colorFns.yellow('►►►') : '►►►' : 'log' === level ? color ? colorFns.gray('►►►') : '►►►' : color ? colorFns.blue('►►►') : '►►►';
129263
- const where = url ? ` ${url}` : '';
129264
- console.log(`${arrow} ${ts}${context}${where} - ${text}`);
129265
- }
129266
- function printLogEventJson(event) {
129267
- console.log(JSON.stringify(event));
129268
- }
129269
129468
  function resolveAddonDirectory(baseDir, inputPath) {
129270
129469
  let candidate = inputPath.replace(/\"/g, '');
129271
129470
  if (!external_path_.isAbsolute(candidate)) candidate = external_path_.resolve(baseDir, candidate);
@@ -129279,9 +129478,6 @@ var __webpack_modules__ = {
129279
129478
  if (external_fs_.existsSync(external_path_.join(distFirefox, 'manifest.json'))) return distFirefox;
129280
129479
  return candidate;
129281
129480
  }
129282
- function normalizeFirefoxAddonPath(addonPath) {
129283
- return String(addonPath).replace(/\\/g, '/');
129284
- }
129285
129481
  async function getAddonsActorWithRetry(client, cached, tries = 40, delayMs = 250) {
129286
129482
  if (cached) return cached;
129287
129483
  let addonsActor;
@@ -129306,7 +129502,7 @@ var __webpack_modules__ = {
129306
129502
  }
129307
129503
  function computeCandidateAddonPaths(compilation, extensionsToLoad, projectContext) {
129308
129504
  const projectPath = compilation.options.context || projectContext || process.cwd();
129309
- return extensionsToLoad.map((ext)=>normalizeFirefoxAddonPath(resolveAddonDirectory(projectPath, ext)));
129505
+ return extensionsToLoad.map((ext)=>resolveAddonDirectory(projectPath, ext));
129310
129506
  }
129311
129507
  async function waitForManagerWelcome(client) {
129312
129508
  for(let i = 0; i < 20; i++){
@@ -129320,12 +129516,22 @@ var __webpack_modules__ = {
129320
129516
  }
129321
129517
  async function installTemporaryAddon(client, addonsActor, addonPath, openDevTools) {
129322
129518
  if (!addonsActor) throw new Error(messages.WVu('firefox', 'No addonsActor available from Firefox RDP.'));
129323
- const clientResponse = await client.request({
129324
- to: addonsActor,
129325
- type: 'installTemporaryAddon',
129326
- addonPath,
129327
- openDevTools
129328
- });
129519
+ const tryInstall = async (pathToUse)=>client.request({
129520
+ to: addonsActor,
129521
+ type: 'installTemporaryAddon',
129522
+ addonPath: pathToUse,
129523
+ openDevTools
129524
+ });
129525
+ let clientResponse;
129526
+ try {
129527
+ clientResponse = await tryInstall(addonPath);
129528
+ } catch (error) {
129529
+ if ('win32' === process.platform) {
129530
+ const winPath = String(addonPath).replace(/\//g, '\\');
129531
+ if (winPath !== addonPath) clientResponse = await tryInstall(winPath);
129532
+ else throw error;
129533
+ } else throw error;
129534
+ }
129329
129535
  return clientResponse;
129330
129536
  }
129331
129537
  async function deriveMozExtensionId(client) {
@@ -129338,99 +129544,7 @@ var __webpack_modules__ = {
129338
129544
  } catch {}
129339
129545
  } catch {}
129340
129546
  }
129341
- var external_pintor_ = __webpack_require__("pintor");
129342
- var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_);
129343
- async function attachConsoleListeners(client) {
129344
- try {
129345
- const targets = await client.getTargets();
129346
- for (const t of targets || [])try {
129347
- const resolved = await client.getTargetFromDescriptor(String(t.actor || ''));
129348
- const consoleActor = resolved?.consoleActor || t.consoleActor || t.webConsoleActor;
129349
- if (consoleActor) try {
129350
- await client.request({
129351
- to: consoleActor,
129352
- type: 'startListeners',
129353
- listeners: [
129354
- 'ConsoleAPI',
129355
- 'PageError',
129356
- 'NetworkActivity'
129357
- ]
129358
- });
129359
- } catch {}
129360
- } catch {}
129361
- } catch {}
129362
- }
129363
- function subscribeUnifiedLogging(client, opts) {
129364
- const levelMap = [
129365
- 'trace',
129366
- 'debug',
129367
- 'log',
129368
- 'info',
129369
- 'warn',
129370
- 'error'
129371
- ];
129372
- const wantLevel = String(opts.level || 'info').toLowerCase();
129373
- const wantIdx = Math.max(0, levelMap.indexOf(wantLevel));
129374
- const wantContexts = Array.isArray(opts.contexts) ? opts.contexts.map((s)=>String(s)) : void 0;
129375
- const urlFilter = String(opts.urlFilter || '');
129376
- const tabFilter = opts.tabFilter || '';
129377
- const fmt = opts.format || 'pretty';
129378
- const showTs = false !== opts.timestamps;
129379
- const color = !!opts.color;
129380
- const colorFns = {
129381
- red: (s)=>external_pintor_default().red ? external_pintor_default().red(s) : s,
129382
- yellow: (s)=>external_pintor_default().brightYellow ? external_pintor_default().brightYellow(s) : s,
129383
- gray: (s)=>external_pintor_default().gray ? external_pintor_default().gray(s) : s,
129384
- blue: (s)=>external_pintor_default().blue ? external_pintor_default().blue(s) : s
129385
- };
129386
- client.on('message', (message)=>{
129387
- try {
129388
- const type = String(message?.type || '');
129389
- if (!type) return;
129390
- let level = 'info';
129391
- let text = '';
129392
- let url = '';
129393
- let context = 'page';
129394
- let tabId;
129395
- if ('consoleAPICall' === type || 'logMessage' === type) {
129396
- const a = message?.message || message;
129397
- level = String(a.level || a.category || 'log').toLowerCase();
129398
- const arg = a.arguments && a.arguments[0] || a.message || a.text;
129399
- text = String(arg && (arg.value || arg.text || arg.message || arg) || '');
129400
- url = String(a.filename || a.sourceName || '');
129401
- } else if ('pageError' === type || 'networkEventUpdate' === type) {
129402
- level = 'pageError' === type ? 'error' : 'info';
129403
- text = String(message?.errorMessage || message?.cause || '');
129404
- url = String(message?.url || message?.sourceURL || '');
129405
- } else {
129406
- if ('tabNavigated' !== type) return;
129407
- level = 'debug';
129408
- text = String(message?.url || '');
129409
- url = String(message?.url || '');
129410
- }
129411
- context = 'string' == typeof url && url.startsWith('moz-extension://') ? 'background' : 'page';
129412
- const idx = Math.max(0, levelMap.indexOf(level));
129413
- if (idx < wantIdx) return;
129414
- if (wantContexts && wantContexts.length && !wantContexts.includes(context)) return;
129415
- if (urlFilter && !String(url || '').includes(urlFilter)) return;
129416
- const msgTab = String(message?.from || '');
129417
- if (tabFilter && msgTab && !msgTab.includes(tabFilter)) return;
129418
- const event = {
129419
- id: `${Date.now()}-${Math.random().toString(16).slice(2)}`,
129420
- timestamp: Date.now(),
129421
- level,
129422
- context,
129423
- messageParts: [
129424
- text
129425
- ],
129426
- url,
129427
- tabId
129428
- };
129429
- if ('json' === fmt || 'ndjson' === fmt) return void printLogEventJson(event);
129430
- printLogEventPretty(event, color, colorFns, showTs);
129431
- } catch {}
129432
- });
129433
- }
129547
+ var logging = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/logging.ts");
129434
129548
  var source_inspect = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/source-inspect.ts");
129435
129549
  function _define_property(obj, key, value) {
129436
129550
  if (key in obj) Object.defineProperty(obj, key, {
@@ -129496,6 +129610,9 @@ var __webpack_modules__ = {
129496
129610
  let addonsActor = await getAddonsActorWithRetry(client, this.cachedAddonsActor);
129497
129611
  if (addonsActor) this.cachedAddonsActor = addonsActor;
129498
129612
  const candidateAddonPaths = computeCandidateAddonPaths(compilation, extensionsToLoad);
129613
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
129614
+ console.log('[plugin-browsers] Firefox add-on paths:', candidateAddonPaths);
129615
+ } catch {}
129499
129616
  for (const [index, addonPath] of candidateAddonPaths.entries()){
129500
129617
  const isManager = /extensions\/[a-z-]+-manager/.test(String(addonPath));
129501
129618
  const isDevtoolsEnabled = 0 === index && Boolean(devtools);
@@ -129527,7 +129644,7 @@ var __webpack_modules__ = {
129527
129644
  if (!this.derivedExtensionId) this.derivedExtensionId = await deriveMozExtensionId(client);
129528
129645
  } catch {}
129529
129646
  this.lastInstalledAddonPath = candidateAddonPaths[0];
129530
- const bannerPrinted = await printRunningInDevelopmentSummary(candidateAddonPaths, 'firefox', this.derivedExtensionId, this.options.browserVersionLine);
129647
+ const bannerPrinted = await (0, firefox_utils.Rv)(candidateAddonPaths, 'firefox', this.derivedExtensionId, this.options.browserVersionLine);
129531
129648
  if (!bannerPrinted) throw new Error(messages.WVu(this.options.browser, 'Failed to print runningInDevelopment banner; add-on may not be installed.'));
129532
129649
  }
129533
129650
  markNeedsReinstall() {
@@ -129585,6 +129702,7 @@ var __webpack_modules__ = {
129585
129702
  const normalized = (changedAssets || []).map((n)=>String(n || '')).map((n)=>n.replace(/\\/g, '/'));
129586
129703
  const isManifestChanged = normalized.includes('manifest.json');
129587
129704
  const isLocalesChanged = normalized.some((n)=>/(^|\/)__?locales\/.+\.json$/i.test(n));
129705
+ const isContentScriptChanged = normalized.some((n)=>/(^|\/)content_scripts\/content-\d+\.(js|css)$/i.test(n));
129588
129706
  let isServiceWorkerChanged = false;
129589
129707
  try {
129590
129708
  const manifestAsset = compilation.getAsset?.('manifest.json');
@@ -129598,7 +129716,7 @@ var __webpack_modules__ = {
129598
129716
  }
129599
129717
  }
129600
129718
  } catch {}
129601
- const critical = isManifestChanged || isLocalesChanged || isServiceWorkerChanged;
129719
+ const critical = isManifestChanged || isLocalesChanged || isServiceWorkerChanged || isContentScriptChanged;
129602
129720
  if (!critical) return;
129603
129721
  await this.reloadAddonOrReinstall(client);
129604
129722
  } catch {}
@@ -129612,7 +129730,7 @@ var __webpack_modules__ = {
129612
129730
  if (!tab) return;
129613
129731
  if (urlToInspect) await (0, source_inspect.VJ)(client, tab.actor, tab.consoleActor, urlToInspect);
129614
129732
  const html = await (0, source_inspect.Lj)(client, tab.actor, tab.consoleActor) || '';
129615
- printSourceInspection(html);
129733
+ (0, firefox_utils.z0)(html);
129616
129734
  } catch (error) {
129617
129735
  const err = error;
129618
129736
  console.warn(messages.eO_(err?.message || String(err)));
@@ -129623,7 +129741,7 @@ var __webpack_modules__ = {
129623
129741
  if (this.loggingAttached) return;
129624
129742
  const rdpPort = this.resolveRdpPort();
129625
129743
  const client = this.client || await this.connectClient(rdpPort);
129626
- await attachConsoleListeners(client);
129744
+ await (0, logging.c)(client);
129627
129745
  const wantLevel = String(opts.level || 'info').toLowerCase();
129628
129746
  const wantContexts = Array.isArray(opts.contexts) ? opts.contexts.map((s)=>String(s)) : void 0;
129629
129747
  const urlFilter = String(opts.urlFilter || '');
@@ -129631,7 +129749,7 @@ var __webpack_modules__ = {
129631
129749
  const fmt = opts.format || 'pretty';
129632
129750
  const showTs = false !== opts.timestamps;
129633
129751
  const color = !!opts.color;
129634
- subscribeUnifiedLogging(client, {
129752
+ (0, logging.g)(client, {
129635
129753
  level: wantLevel,
129636
129754
  contexts: wantContexts,
129637
129755
  urlFilter,
@@ -129711,6 +129829,10 @@ var __webpack_modules__ = {
129711
129829
  return await fn();
129712
129830
  } catch (error) {
129713
129831
  lastError = error;
129832
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
129833
+ const msg = error?.message || String(error);
129834
+ console.warn(`[plugin-browsers] Firefox RDP setup retry ${i + 1}/${attempts}: ${msg}`);
129835
+ } catch {}
129714
129836
  const ms = baseMs * Math.pow(2, i);
129715
129837
  await new Promise((r)=>setTimeout(r, ms));
129716
129838
  }
@@ -129880,9 +130002,9 @@ var __webpack_modules__ = {
129880
130002
  external_fs_.writeFileSync(userJsPath, userJsContent);
129881
130003
  } catch {}
129882
130004
  const parts = [
129883
- `--binary-args="${binaryArgs.join(' ')}"`,
129884
130005
  '--verbose'
129885
130006
  ];
130007
+ if (binaryArgs.length > 0) parts.unshift(`--binary-args="${binaryArgs.join(' ')}"`);
129886
130008
  if (profilePath) parts.splice(1, 0, `--profile="${profilePath}"`);
129887
130009
  return parts.join(' ');
129888
130010
  }
@@ -130146,7 +130268,8 @@ var __webpack_modules__ = {
130146
130268
  const firefoxArgs = [];
130147
130269
  const binaryArgsMatch = firefoxCfg.match(/--binary-args="([^"]*)"/);
130148
130270
  if (binaryArgsMatch) {
130149
- firefoxArgs.push(...binaryArgsMatch[1].split(' '));
130271
+ const rawArgs = String(binaryArgsMatch[1] || '').trim();
130272
+ if (rawArgs) firefoxArgs.push(...rawArgs.split(' ').filter((arg)=>arg.trim().length > 0));
130150
130273
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.ctx.logger?.info?.(messages.ivb(binaryArgsMatch[1]));
130151
130274
  } else if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.ctx.logger?.info?.(messages.dNY());
130152
130275
  const profileMatch = firefoxCfg.match(/--profile="([^"]*)"/);
@@ -130154,7 +130277,15 @@ var __webpack_modules__ = {
130154
130277
  const profilePath = profileMatch[1];
130155
130278
  const { binary, args } = FirefoxBinaryDetector.generateFirefoxArgs(binaryPath, profilePath, debugPort, firefoxArgs);
130156
130279
  const isWin = 'win32' === process.platform;
130157
- const stdio = isWin ? 'ignore' : [
130280
+ const stdio = isWin ? 'true' === process.env.EXTENSION_AUTHOR_MODE ? [
130281
+ 'pipe',
130282
+ 'pipe',
130283
+ 'pipe'
130284
+ ] : [
130285
+ 'ignore',
130286
+ 'ignore',
130287
+ 'ignore'
130288
+ ] : [
130158
130289
  'pipe',
130159
130290
  'pipe',
130160
130291
  'pipe'
@@ -130173,13 +130304,15 @@ var __webpack_modules__ = {
130173
130304
  }, compilation, debugPort);
130174
130305
  this.host.rdpController = ctrl;
130175
130306
  this.ctx.setController(ctrl, debugPort);
130307
+ this.scheduleWatchTimeout();
130176
130308
  try {
130177
- if ('true' === process.env.EXTENSION_AUTHOR_MODE && this.host.instanceId && profileMatch) {
130309
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
130178
130310
  this.ctx.logger?.info?.(messages.pdv(debugPort, desiredDebugPort));
130179
- this.ctx.logger?.info?.(messages.dwQ(profileMatch[1]));
130311
+ this.ctx.logger?.info?.(messages.dwQ(profilePath));
130180
130312
  }
130181
130313
  } catch {}
130182
130314
  } else {
130315
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.ctx.logger?.warn?.('[plugin-browsers] Firefox profile not set; skipping RDP add-on install.');
130183
130316
  const args = [
130184
130317
  ...debugPort > 0 ? [
130185
130318
  '-start-debugger-server',
@@ -130192,7 +130325,15 @@ var __webpack_modules__ = {
130192
130325
  ...firefoxArgs
130193
130326
  ];
130194
130327
  const isWin = 'win32' === process.platform;
130195
- const stdio = isWin ? 'ignore' : [
130328
+ const stdio = isWin ? 'true' === process.env.EXTENSION_AUTHOR_MODE ? [
130329
+ 'pipe',
130330
+ 'pipe',
130331
+ 'pipe'
130332
+ ] : [
130333
+ 'ignore',
130334
+ 'ignore',
130335
+ 'ignore'
130336
+ ] : [
130196
130337
  'pipe',
130197
130338
  'pipe',
130198
130339
  'pipe'
@@ -130205,6 +130346,7 @@ var __webpack_modules__ = {
130205
130346
  logger: this.ctx.logger
130206
130347
  });
130207
130348
  this.wireChildLifecycle(compilation, debugPort, desiredDebugPort);
130349
+ this.scheduleWatchTimeout();
130208
130350
  }
130209
130351
  }
130210
130352
  wireChildLifecycle(compilation, debugPort, desiredDebugPort) {
@@ -130216,6 +130358,10 @@ var __webpack_modules__ = {
130216
130358
  process.exit(1);
130217
130359
  });
130218
130360
  child.on('close', (_code)=>{
130361
+ if (this.watchTimeout) {
130362
+ clearTimeout(this.watchTimeout);
130363
+ this.watchTimeout = void 0;
130364
+ }
130219
130365
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.ctx.logger?.info?.(messages.Tho(this.host.browser));
130220
130366
  this.cleanupInstance().finally(()=>{
130221
130367
  process.exit();
@@ -130241,6 +130387,22 @@ var __webpack_modules__ = {
130241
130387
  }
130242
130388
  } catch {}
130243
130389
  }
130390
+ scheduleWatchTimeout() {
130391
+ if (this.watchTimeout) return;
130392
+ if (process.env.VITEST || process.env.VITEST_WORKER_ID) return;
130393
+ const raw = process.env.EXTENSION_WATCH_TIMEOUT_MS || process.env.EXTENSION_DEV_WATCH_TIMEOUT_MS || process.env.EXTJS_WATCH_TIMEOUT_MS || process.env.EXTJS_DEV_WATCH_TIMEOUT_MS || '';
130394
+ const ms = parseInt(String(raw || ''), 10);
130395
+ if (!Number.isFinite(ms) || ms <= 0) return;
130396
+ this.watchTimeout = setTimeout(()=>{
130397
+ try {
130398
+ this.ctx.logger?.info?.(`[plugin-browsers] Watch timeout reached (${ms}ms). Shutting down.`);
130399
+ } catch {}
130400
+ this.cleanupInstance().catch(()=>{}).finally(()=>{
130401
+ process.exit(0);
130402
+ });
130403
+ }, ms);
130404
+ if ('function' == typeof this.watchTimeout.unref) this.watchTimeout.unref();
130405
+ }
130244
130406
  printInstallHint(compilation, raw) {
130245
130407
  try {
130246
130408
  const displayCacheDir = (0, output_binaries_resolver.LB)(compilation);
@@ -130254,11 +130416,201 @@ var __webpack_modules__ = {
130254
130416
  firefox_launch_define_property(this, "host", void 0);
130255
130417
  firefox_launch_define_property(this, "ctx", void 0);
130256
130418
  firefox_launch_define_property(this, "child", null);
130419
+ firefox_launch_define_property(this, "watchTimeout", void 0);
130257
130420
  this.host = host;
130258
130421
  this.ctx = ctx;
130259
130422
  }
130260
130423
  }
130261
130424
  },
130425
+ "./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/firefox-utils.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
130426
+ "use strict";
130427
+ __webpack_require__.d(__webpack_exports__, {
130428
+ Rv: ()=>printRunningInDevelopmentSummary,
130429
+ ek: ()=>printLogEventJson,
130430
+ mN: ()=>printLogEventPretty,
130431
+ z0: ()=>printSourceInspection
130432
+ });
130433
+ var path__rspack_import_0 = __webpack_require__("path");
130434
+ var fs__rspack_import_1 = __webpack_require__("fs");
130435
+ var _browsers_lib_messages__rspack_import_2 = __webpack_require__("./webpack/plugin-browsers/browsers-lib/messages.ts");
130436
+ var _browsers_lib_banner__rspack_import_3 = __webpack_require__("./webpack/plugin-browsers/browsers-lib/banner.ts");
130437
+ async function waitForManifest(outPath, timeoutMs = 8000) {
130438
+ const manifestPath = path__rspack_import_0.join(outPath, 'manifest.json');
130439
+ const start = Date.now();
130440
+ while(Date.now() - start < timeoutMs){
130441
+ try {
130442
+ if (fs__rspack_import_1.existsSync(manifestPath)) return true;
130443
+ } catch {}
130444
+ await new Promise((resolve)=>setTimeout(resolve, 150));
130445
+ }
130446
+ return false;
130447
+ }
130448
+ async function printRunningInDevelopmentSummary(candidateAddonPaths, browser, extensionId, browserVersionLine) {
130449
+ try {
130450
+ let chosenPath = null;
130451
+ for (const p of candidateAddonPaths){
130452
+ const isManager = /extensions\/[a-z-]+-manager/.test(String(p));
130453
+ const isDevtools = /extension-js-devtools/.test(String(p));
130454
+ const isThemePath = /extension-js-theme/.test(String(p));
130455
+ if (isManager || isDevtools || isThemePath) continue;
130456
+ const mp = path__rspack_import_0.join(p, 'manifest.json');
130457
+ if (fs__rspack_import_1.existsSync(mp)) {
130458
+ const mf = JSON.parse(fs__rspack_import_1.readFileSync(mp, 'utf-8'));
130459
+ const name = mf?.name || '';
130460
+ const isThemeManifest = mf?.theme != null || 'theme' === String(mf?.type || '');
130461
+ if ('string' == typeof name && !/Extension\.js DevTools/i.test(name) && !/theme/i.test(name) && !isThemeManifest) {
130462
+ chosenPath = p;
130463
+ break;
130464
+ }
130465
+ }
130466
+ }
130467
+ if (!chosenPath && candidateAddonPaths.length > 0) chosenPath = candidateAddonPaths[candidateAddonPaths.length - 1];
130468
+ if (!chosenPath) return false;
130469
+ const manifestPath = path__rspack_import_0.join(chosenPath, 'manifest.json');
130470
+ if (!fs__rspack_import_1.existsSync(manifestPath)) {
130471
+ const ready = await waitForManifest(chosenPath, 10000);
130472
+ if (!ready) return false;
130473
+ }
130474
+ const manifest = JSON.parse(fs__rspack_import_1.readFileSync(manifestPath, 'utf-8'));
130475
+ const printed = await (0, _browsers_lib_banner__rspack_import_3.a)({
130476
+ browser,
130477
+ outPath: chosenPath,
130478
+ hostPort: {
130479
+ host: '127.0.0.1'
130480
+ },
130481
+ getInfo: async ()=>({
130482
+ extensionId: extensionId || '(temporary)',
130483
+ name: manifest.name,
130484
+ version: manifest.version
130485
+ }),
130486
+ browserVersionLine
130487
+ });
130488
+ return printed;
130489
+ } catch {
130490
+ return false;
130491
+ }
130492
+ }
130493
+ function printSourceInspection(html) {
130494
+ console.log(_browsers_lib_messages__rspack_import_2.sew());
130495
+ console.log(_browsers_lib_messages__rspack_import_2.sew());
130496
+ console.log(html);
130497
+ console.log(_browsers_lib_messages__rspack_import_2.sew());
130498
+ }
130499
+ function printLogEventPretty(event, color, colorFns, showTs) {
130500
+ const ts = showTs ? new Date(event.timestamp).toISOString() + ' ' : '';
130501
+ const level = event.level;
130502
+ const context = event.context;
130503
+ const text = event.messageParts[0];
130504
+ const url = event.url;
130505
+ const arrow = 'error' === level ? color ? colorFns.red('►►►') : '►►►' : 'warn' === level ? color ? colorFns.yellow('►►►') : '►►►' : 'log' === level ? color ? colorFns.gray('►►►') : '►►►' : color ? colorFns.blue('►►►') : '►►►';
130506
+ const where = url ? ` ${url}` : '';
130507
+ console.log(`${arrow} ${ts}${context}${where} - ${text}`);
130508
+ }
130509
+ function printLogEventJson(event) {
130510
+ console.log(JSON.stringify(event));
130511
+ }
130512
+ },
130513
+ "./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/logging.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
130514
+ "use strict";
130515
+ __webpack_require__.d(__webpack_exports__, {
130516
+ c: ()=>attachConsoleListeners,
130517
+ g: ()=>subscribeUnifiedLogging
130518
+ });
130519
+ var pintor__rspack_import_0 = __webpack_require__("pintor");
130520
+ var pintor__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_0);
130521
+ var _firefox_utils__rspack_import_1 = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/firefox-utils.ts");
130522
+ async function attachConsoleListeners(client) {
130523
+ try {
130524
+ const targets = await client.getTargets();
130525
+ for (const t of targets || [])try {
130526
+ const resolved = await client.getTargetFromDescriptor(String(t.actor || ''));
130527
+ const consoleActor = resolved?.consoleActor || t.consoleActor || t.webConsoleActor;
130528
+ if (consoleActor) try {
130529
+ await client.request({
130530
+ to: consoleActor,
130531
+ type: 'startListeners',
130532
+ listeners: [
130533
+ 'ConsoleAPI',
130534
+ 'PageError',
130535
+ 'NetworkActivity'
130536
+ ]
130537
+ });
130538
+ } catch {}
130539
+ } catch {}
130540
+ } catch {}
130541
+ }
130542
+ function subscribeUnifiedLogging(client, opts) {
130543
+ const levelMap = [
130544
+ 'trace',
130545
+ 'debug',
130546
+ 'log',
130547
+ 'info',
130548
+ 'warn',
130549
+ 'error'
130550
+ ];
130551
+ const wantLevel = String(opts.level || 'info').toLowerCase();
130552
+ const wantIdx = Math.max(0, levelMap.indexOf(wantLevel));
130553
+ const wantContexts = Array.isArray(opts.contexts) ? opts.contexts.map((s)=>String(s)) : void 0;
130554
+ const urlFilter = String(opts.urlFilter || '');
130555
+ const tabFilter = opts.tabFilter || '';
130556
+ const fmt = opts.format || 'pretty';
130557
+ const showTs = false !== opts.timestamps;
130558
+ const color = !!opts.color;
130559
+ const colorFns = {
130560
+ red: (s)=>pintor__rspack_import_0_default().red ? pintor__rspack_import_0_default().red(s) : s,
130561
+ yellow: (s)=>pintor__rspack_import_0_default().brightYellow ? pintor__rspack_import_0_default().brightYellow(s) : s,
130562
+ gray: (s)=>pintor__rspack_import_0_default().gray ? pintor__rspack_import_0_default().gray(s) : s,
130563
+ blue: (s)=>pintor__rspack_import_0_default().blue ? pintor__rspack_import_0_default().blue(s) : s
130564
+ };
130565
+ client.on('message', (message)=>{
130566
+ try {
130567
+ const type = String(message?.type || '');
130568
+ if (!type) return;
130569
+ let level = 'info';
130570
+ let text = '';
130571
+ let url = '';
130572
+ let context = 'page';
130573
+ let tabId;
130574
+ if ('consoleAPICall' === type || 'logMessage' === type) {
130575
+ const a = message?.message || message;
130576
+ level = String(a.level || a.category || 'log').toLowerCase();
130577
+ const arg = a.arguments && a.arguments[0] || a.message || a.text;
130578
+ text = String(arg && (arg.value || arg.text || arg.message || arg) || '');
130579
+ url = String(a.filename || a.sourceName || '');
130580
+ } else if ('pageError' === type || 'networkEventUpdate' === type) {
130581
+ level = 'pageError' === type ? 'error' : 'info';
130582
+ text = String(message?.errorMessage || message?.cause || '');
130583
+ url = String(message?.url || message?.sourceURL || '');
130584
+ } else {
130585
+ if ('tabNavigated' !== type) return;
130586
+ level = 'debug';
130587
+ text = String(message?.url || '');
130588
+ url = String(message?.url || '');
130589
+ }
130590
+ context = 'string' == typeof url && url.startsWith('moz-extension://') ? 'background' : 'page';
130591
+ const idx = Math.max(0, levelMap.indexOf(level));
130592
+ if (idx < wantIdx) return;
130593
+ if (wantContexts && wantContexts.length && !wantContexts.includes(context)) return;
130594
+ if (urlFilter && !String(url || '').includes(urlFilter)) return;
130595
+ const msgTab = String(message?.from || '');
130596
+ if (tabFilter && msgTab && !msgTab.includes(tabFilter)) return;
130597
+ const event = {
130598
+ id: `${Date.now()}-${Math.random().toString(16).slice(2)}`,
130599
+ timestamp: Date.now(),
130600
+ level,
130601
+ context,
130602
+ messageParts: [
130603
+ text
130604
+ ],
130605
+ url,
130606
+ tabId
130607
+ };
130608
+ if ('json' === fmt || 'ndjson' === fmt) return void (0, _firefox_utils__rspack_import_1.ek)(event);
130609
+ (0, _firefox_utils__rspack_import_1.mN)(event, color, colorFns, showTs);
130610
+ } catch {}
130611
+ });
130612
+ }
130613
+ },
130262
130614
  "./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/messaging-client.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
130263
130615
  "use strict";
130264
130616
  __webpack_require__.d(__webpack_exports__, {
@@ -130663,6 +131015,13 @@ var __webpack_modules__ = {
130663
131015
  class MessagingClient extends external_events_default() {
130664
131016
  async connect(port) {
130665
131017
  await this.transport.connect(port);
131018
+ if (!this.forwardingSetup) {
131019
+ this.forwardingSetup = true;
131020
+ this.transport.on('message', (message)=>this.emit('message', message));
131021
+ this.transport.on('error', (error)=>this.emit('error', error));
131022
+ this.transport.on('end', ()=>this.emit('end'));
131023
+ this.transport.on('timeout', ()=>this.emit('timeout'));
131024
+ }
130666
131025
  }
130667
131026
  disconnect() {
130668
131027
  this.transport.disconnect();
@@ -130782,7 +131141,7 @@ var __webpack_modules__ = {
130782
131141
  });
130783
131142
  }
130784
131143
  constructor(...args){
130785
- super(...args), messaging_client_define_property(this, "transport", new RdpTransport());
131144
+ super(...args), messaging_client_define_property(this, "transport", new RdpTransport()), messaging_client_define_property(this, "forwardingSetup", false);
130786
131145
  }
130787
131146
  }
130788
131147
  },
@@ -131254,13 +131613,18 @@ var __webpack_modules__ = {
131254
131613
  const s = text && 0xfeff === text.charCodeAt(0) ? text.slice(1) : text;
131255
131614
  return JSON.parse(s || '{}');
131256
131615
  }
131257
- function isContentScriptEntry(absolutePath, manifestPath) {
131258
- if (!absolutePath || !manifestPath) return false;
131616
+ function isContentScriptEntry(absolutePath, manifestPath, projectPath) {
131617
+ if (!absolutePath || !manifestPath || !projectPath) return false;
131259
131618
  if (!fs__rspack_import_1.existsSync(manifestPath)) return false;
131260
131619
  const manifest = parseJsonSafe(fs__rspack_import_1.readFileSync(manifestPath, 'utf8'));
131620
+ const scriptsDir = path__rspack_import_0.resolve(projectPath, "scripts");
131621
+ const absPathNormalized = path__rspack_import_0.resolve(absolutePath);
131622
+ const relToScripts = path__rspack_import_0.relative(scriptsDir, absPathNormalized);
131623
+ const isScriptsFolderScript = relToScripts && !relToScripts.startsWith('..') && !path__rspack_import_0.isAbsolute(relToScripts);
131624
+ if (isScriptsFolderScript) return true;
131261
131625
  for (const content of manifest.content_scripts || [])if (content.js?.length) for (const js of content.js){
131262
131626
  const contentPath = path__rspack_import_0.resolve(path__rspack_import_0.dirname(manifestPath), js);
131263
- if (contentPath === absolutePath) return true;
131627
+ if (contentPath === absPathNormalized) return true;
131264
131628
  }
131265
131629
  return false;
131266
131630
  }
@@ -131421,43 +131785,170 @@ var __webpack_modules__ = {
131421
131785
  generator: {
131422
131786
  filename: "content_scripts/[name].[contenthash:8].css"
131423
131787
  },
131424
- issuer: (issuer)=>(0, _css_lib_is_content_script__rspack_import_4.z)(issuer, resolvedManifestPath)
131788
+ issuer: (issuer)=>(0, _css_lib_is_content_script__rspack_import_4.z)(issuer, resolvedManifestPath, projectPath)
131789
+ }
131790
+ ];
131791
+ }
131792
+ },
131793
+ "./webpack/plugin-css/css-tools/postcss.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
131794
+ "use strict";
131795
+ __webpack_require__.d(__webpack_exports__, {
131796
+ A: ()=>isUsingPostCss,
131797
+ t: ()=>maybeUsePostCss
131798
+ });
131799
+ var path__rspack_import_0 = __webpack_require__("path");
131800
+ var fs__rspack_import_1 = __webpack_require__("fs");
131801
+ var module__rspack_import_2 = __webpack_require__("module");
131802
+ var pintor__rspack_import_3 = __webpack_require__("pintor");
131803
+ var pintor__rspack_import_3_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_3);
131804
+ var _css_lib_messages__rspack_import_4 = __webpack_require__("./webpack/plugin-css/css-lib/messages.ts");
131805
+ var _css_lib_integrations__rspack_import_5 = __webpack_require__("./webpack/plugin-css/css-lib/integrations.ts");
131806
+ var _tailwind__rspack_import_6 = __webpack_require__("./webpack/plugin-css/css-tools/tailwind.ts");
131807
+ var _sass__rspack_import_7 = __webpack_require__("./webpack/plugin-css/css-tools/sass.ts");
131808
+ var _less__rspack_import_8 = __webpack_require__("./webpack/plugin-css/css-tools/less.ts");
131809
+ let userMessageDelivered = false;
131810
+ const postCssConfigFiles = [
131811
+ '.postcssrc',
131812
+ '.postcssrc.json',
131813
+ '.postcssrc.yaml',
131814
+ '.postcssrc.yml',
131815
+ 'postcss.config.mjs',
131816
+ '.postcssrc.js',
131817
+ '.postcssrc.cjs',
131818
+ 'postcss.config.js',
131819
+ 'postcss.config.cjs'
131820
+ ];
131821
+ function findPostCssConfig(projectPath) {
131822
+ const ordered = isTypeModuleProject(projectPath) ? [
131823
+ '.postcssrc',
131824
+ '.postcssrc.json',
131825
+ '.postcssrc.yaml',
131826
+ '.postcssrc.yml',
131827
+ 'postcss.config.mjs',
131828
+ '.postcssrc.cjs',
131829
+ 'postcss.config.cjs',
131830
+ '.postcssrc.js',
131831
+ 'postcss.config.js'
131832
+ ] : postCssConfigFiles;
131833
+ for (const configFile of ordered){
131834
+ const configPath = path__rspack_import_0.join(projectPath, configFile);
131835
+ if (fs__rspack_import_1.existsSync(configPath)) return configPath;
131836
+ }
131837
+ }
131838
+ function isTypeModuleProject(projectPath) {
131839
+ try {
131840
+ const raw = fs__rspack_import_1.readFileSync(path__rspack_import_0.join(projectPath, 'package.json'), 'utf8');
131841
+ const pkg = JSON.parse(raw || '{}');
131842
+ return pkg?.type === 'module';
131843
+ } catch {
131844
+ return false;
131845
+ }
131846
+ }
131847
+ function isLikelyCjsConfigInEsmProject(projectPath, postCssConfigPath) {
131848
+ if (!postCssConfigPath || !postCssConfigPath.endsWith('postcss.config.js')) return false;
131849
+ if (!isTypeModuleProject(projectPath)) return false;
131850
+ try {
131851
+ const text = fs__rspack_import_1.readFileSync(postCssConfigPath, 'utf8');
131852
+ return /module\.exports|require\(/.test(text);
131853
+ } catch {
131854
+ return false;
131855
+ }
131856
+ }
131857
+ function isLikelyCjsTailwindConfig(tailwindConfigPath) {
131858
+ if (!tailwindConfigPath) return false;
131859
+ if (!tailwindConfigPath.endsWith('.js') && !tailwindConfigPath.endsWith('.cjs')) return false;
131860
+ try {
131861
+ const text = fs__rspack_import_1.readFileSync(tailwindConfigPath, 'utf8');
131862
+ return /module\.exports|require\(/.test(text);
131863
+ } catch {
131864
+ return false;
131865
+ }
131866
+ }
131867
+ function userConfigMentionsTailwindPlugin(postCssConfigPath) {
131868
+ if (!postCssConfigPath) return false;
131869
+ try {
131870
+ const text = fs__rspack_import_1.readFileSync(postCssConfigPath, 'utf8');
131871
+ return /@tailwindcss\/postcss|tailwindcss/.test(text);
131872
+ } catch {
131873
+ return false;
131874
+ }
131875
+ }
131876
+ function userConfigUsesDirectTailwindPluginReference(postCssConfigPath) {
131877
+ if (!postCssConfigPath) return false;
131878
+ try {
131879
+ const text = fs__rspack_import_1.readFileSync(postCssConfigPath, 'utf8');
131880
+ return /require\(\s*['"]tailwindcss['"]\s*\)/.test(text) || /plugins\s*:\s*\[[^\]]*\btailwindcss\b/.test(text);
131881
+ } catch {
131882
+ return false;
131883
+ }
131884
+ }
131885
+ function tailwindStringPluginDisableShims() {
131886
+ return [
131887
+ {
131888
+ '@tailwindcss/postcss': false
131889
+ },
131890
+ {
131891
+ tailwindcss: false
131425
131892
  }
131426
131893
  ];
131427
131894
  }
131428
- },
131429
- "./webpack/plugin-css/css-tools/postcss.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
131430
- "use strict";
131431
- __webpack_require__.d(__webpack_exports__, {
131432
- A: ()=>isUsingPostCss,
131433
- t: ()=>maybeUsePostCss
131434
- });
131435
- var path__rspack_import_0 = __webpack_require__("path");
131436
- var fs__rspack_import_1 = __webpack_require__("fs");
131437
- var module__rspack_import_2 = __webpack_require__("module");
131438
- var pintor__rspack_import_3 = __webpack_require__("pintor");
131439
- var pintor__rspack_import_3_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_3);
131440
- var _css_lib_messages__rspack_import_4 = __webpack_require__("./webpack/plugin-css/css-lib/messages.ts");
131441
- var _css_lib_integrations__rspack_import_5 = __webpack_require__("./webpack/plugin-css/css-lib/integrations.ts");
131442
- var _tailwind__rspack_import_6 = __webpack_require__("./webpack/plugin-css/css-tools/tailwind.ts");
131443
- var _sass__rspack_import_7 = __webpack_require__("./webpack/plugin-css/css-tools/sass.ts");
131444
- var _less__rspack_import_8 = __webpack_require__("./webpack/plugin-css/css-tools/less.ts");
131445
- let userMessageDelivered = false;
131446
- const postCssConfigFiles = [
131447
- '.postcssrc',
131448
- '.postcssrc.json',
131449
- '.postcssrc.yaml',
131450
- '.postcssrc.yml',
131451
- 'postcss.config.mjs',
131452
- '.postcssrc.js',
131453
- '.postcssrc.cjs',
131454
- 'postcss.config.js',
131455
- 'postcss.config.cjs'
131456
- ];
131457
- function findPostCssConfig(projectPath) {
131458
- for (const configFile of postCssConfigFiles){
131459
- const configPath = path__rspack_import_0.join(projectPath, configFile);
131460
- if (fs__rspack_import_1.existsSync(configPath)) return configPath;
131895
+ function tryLoadCjsConfig(configPath) {
131896
+ try {
131897
+ const source = fs__rspack_import_1.readFileSync(configPath, 'utf8');
131898
+ const moduleObj = {
131899
+ exports: {}
131900
+ };
131901
+ const exportsObj = moduleObj.exports;
131902
+ const req = (0, module__rspack_import_2.createRequire)(configPath);
131903
+ const fn = new Function('require', 'module', 'exports', '__filename', '__dirname', source);
131904
+ fn(req, moduleObj, exportsObj, configPath, path__rspack_import_0.dirname(configPath));
131905
+ return moduleObj.exports;
131906
+ } catch {
131907
+ return;
131908
+ }
131909
+ }
131910
+ function normalizeTailwindContentGlobs(config, projectPath) {
131911
+ if (!config || 'object' != typeof config) return config;
131912
+ const normalizeEntry = (entry)=>{
131913
+ if ('string' != typeof entry) return entry;
131914
+ if (entry.startsWith('!')) {
131915
+ const raw = entry.slice(1);
131916
+ if (path__rspack_import_0.isAbsolute(raw)) return entry;
131917
+ return `!${path__rspack_import_0.join(projectPath, raw)}`;
131918
+ }
131919
+ return path__rspack_import_0.isAbsolute(entry) ? entry : path__rspack_import_0.join(projectPath, entry);
131920
+ };
131921
+ const out = {
131922
+ ...config
131923
+ };
131924
+ const content = out.content;
131925
+ if ('string' == typeof content) {
131926
+ out.content = [
131927
+ normalizeEntry(content)
131928
+ ];
131929
+ return out;
131930
+ }
131931
+ if (Array.isArray(content)) {
131932
+ out.content = content.map(normalizeEntry);
131933
+ return out;
131934
+ }
131935
+ if (content && 'object' == typeof content && Array.isArray(content.files)) out.content = {
131936
+ ...content,
131937
+ files: content.files.map(normalizeEntry)
131938
+ };
131939
+ return out;
131940
+ }
131941
+ function getDeclaredTailwindMajor(projectPath) {
131942
+ try {
131943
+ const raw = fs__rspack_import_1.readFileSync(path__rspack_import_0.join(projectPath, 'package.json'), 'utf8');
131944
+ const pkg = JSON.parse(raw || '{}');
131945
+ const version1 = pkg?.dependencies?.tailwindcss || pkg?.devDependencies?.tailwindcss;
131946
+ if ('string' != typeof version1) return;
131947
+ const match = version1.match(/(\d+)/);
131948
+ if (!match) return;
131949
+ return parseInt(match[1], 10);
131950
+ } catch {
131951
+ return;
131461
131952
  }
131462
131953
  }
131463
131954
  function isUsingPostCss(projectPath) {
@@ -131486,6 +131977,9 @@ var __webpack_modules__ = {
131486
131977
  }
131487
131978
  async function maybeUsePostCss(projectPath, opts) {
131488
131979
  const userPostCssConfig = findPostCssConfig(projectPath);
131980
+ const userConfigMentionsTailwind = userConfigMentionsTailwindPlugin(userPostCssConfig);
131981
+ const userConfigUsesDirectTailwindReference = userConfigUsesDirectTailwindPluginReference(userPostCssConfig);
131982
+ const userConfigIsCjsInEsm = isLikelyCjsConfigInEsmProject(projectPath, userPostCssConfig);
131489
131983
  function getPackageJsonConfig(p) {
131490
131984
  try {
131491
131985
  const raw = fs__rspack_import_1.readFileSync(path__rspack_import_0.join(p, 'package.json'), 'utf8');
@@ -131500,12 +131994,13 @@ var __webpack_modules__ = {
131500
131994
  };
131501
131995
  }
131502
131996
  }
131503
- const { hasPostCss: pkgHasPostCss, config: pkgPostCssConfig } = getPackageJsonConfig(projectPath);
131997
+ const { hasPostCss: pkgHasPostCss } = getPackageJsonConfig(projectPath);
131504
131998
  const tailwindPresent = (0, _tailwind__rspack_import_6.F)(projectPath);
131999
+ const tailwindConfigured = tailwindPresent || userConfigMentionsTailwind;
131505
132000
  if (!userPostCssConfig && !pkgHasPostCss && !tailwindPresent) return {};
131506
132001
  try {
131507
132002
  require.resolve('postcss-loader');
131508
- } catch (e) {
132003
+ } catch (_error) {
131509
132004
  if (!(0, _sass__rspack_import_7.fZ)(projectPath) && !(0, _less__rspack_import_8.K)(projectPath)) {
131510
132005
  const postCssDependencies = [
131511
132006
  'postcss',
@@ -131518,39 +132013,102 @@ var __webpack_modules__ = {
131518
132013
  process.exit(0);
131519
132014
  }
131520
132015
  let pluginsFromOptions;
131521
- if (tailwindPresent) try {
131522
- const bases = [
132016
+ const shouldInjectTailwindPlugin = tailwindConfigured && !pkgHasPostCss && (!userPostCssConfig || userConfigIsCjsInEsm || userConfigMentionsTailwind);
132017
+ const declaredTailwindMajor = getDeclaredTailwindMajor(projectPath);
132018
+ if (shouldInjectTailwindPlugin) try {
132019
+ const bases = Array.from(new Set([
131523
132020
  projectPath,
132021
+ userPostCssConfig ? path__rspack_import_0.dirname(userPostCssConfig) : '',
131524
132022
  process.cwd()
132023
+ ].filter(Boolean)));
132024
+ const pluginCandidates = 'number' == typeof declaredTailwindMajor && declaredTailwindMajor < 4 ? [
132025
+ 'tailwindcss',
132026
+ '@tailwindcss/postcss'
132027
+ ] : [
132028
+ '@tailwindcss/postcss',
132029
+ 'tailwindcss'
131525
132030
  ];
131526
132031
  let tailwindMod;
132032
+ let tailwindPluginId;
131527
132033
  for (const base of bases)try {
131528
- const req = (0, module__rspack_import_2.createRequire)(path__rspack_import_0.join(base, 'package.json'));
131529
- tailwindMod = req('@tailwindcss/postcss');
131530
- break;
131531
- } catch (e) {}
132034
+ const req = (0, module__rspack_import_2.createRequire)(path__rspack_import_0.join(base, '__extensionjs__.js'));
132035
+ for (const id of pluginCandidates)try {
132036
+ tailwindMod = req(id);
132037
+ tailwindPluginId = id;
132038
+ break;
132039
+ } catch {}
132040
+ if (tailwindMod) break;
132041
+ } catch {}
131532
132042
  if (tailwindMod) {
131533
132043
  if (tailwindMod && 'object' == typeof tailwindMod && 'default' in tailwindMod) tailwindMod = tailwindMod.default;
131534
132044
  if ('function' == typeof tailwindMod) {
131535
- const instance = tailwindMod();
131536
- pluginsFromOptions = [
131537
- {
131538
- '@tailwindcss/postcss': false
131539
- },
132045
+ let instance;
132046
+ try {
132047
+ if ('tailwindcss' === tailwindPluginId) {
132048
+ const configFile = (0, _tailwind__rspack_import_6.r)(projectPath);
132049
+ if (configFile) if (isLikelyCjsTailwindConfig(configFile)) {
132050
+ const loaded = tryLoadCjsConfig(configFile);
132051
+ if (loaded && 'object' == typeof loaded) {
132052
+ const normalized = normalizeTailwindContentGlobs(loaded, projectPath);
132053
+ instance = tailwindMod(normalized);
132054
+ } else instance = tailwindMod({
132055
+ config: configFile
132056
+ });
132057
+ } else instance = tailwindMod({
132058
+ config: configFile
132059
+ });
132060
+ else instance = tailwindMod();
132061
+ } else instance = tailwindMod({
132062
+ base: projectPath
132063
+ });
132064
+ } catch {
132065
+ try {
132066
+ instance = tailwindMod();
132067
+ } catch {
132068
+ if ('tailwindcss' === tailwindPluginId) for (const base of bases)try {
132069
+ const req = (0, module__rspack_import_2.createRequire)(path__rspack_import_0.join(base, '__extensionjs__.js'));
132070
+ let postcssMod = req('@tailwindcss/postcss');
132071
+ if (postcssMod && 'object' == typeof postcssMod && 'default' in postcssMod) postcssMod = postcssMod.default;
132072
+ if ('function' == typeof postcssMod) {
132073
+ instance = postcssMod({
132074
+ base: projectPath
132075
+ });
132076
+ tailwindPluginId = '@tailwindcss/postcss';
132077
+ break;
132078
+ }
132079
+ } catch {}
132080
+ }
132081
+ }
132082
+ if (instance) pluginsFromOptions = userConfigIsCjsInEsm ? [
132083
+ instance
132084
+ ] : [
132085
+ ...tailwindStringPluginDisableShims(),
131540
132086
  instance
131541
132087
  ];
131542
- } else if (tailwindMod && 'object' == typeof tailwindMod && 'postcssPlugin' in tailwindMod) pluginsFromOptions = [
131543
- {
131544
- '@tailwindcss/postcss': false
131545
- },
132088
+ } else if (tailwindMod && 'object' == typeof tailwindMod && 'postcssPlugin' in tailwindMod) pluginsFromOptions = userConfigIsCjsInEsm ? [
131546
132089
  tailwindMod
132090
+ ] : [
132091
+ ...tailwindStringPluginDisableShims(),
132092
+ tailwindMod
132093
+ ];
132094
+ }
132095
+ } catch {}
132096
+ const bypassUserConfigForTailwindCompat = !!pluginsFromOptions && !!userPostCssConfig && userConfigMentionsTailwind && userConfigUsesDirectTailwindReference;
132097
+ if (userConfigIsCjsInEsm || bypassUserConfigForTailwindCompat) try {
132098
+ if ((0, _css_lib_integrations__rspack_import_5.ws)(projectPath, 'autoprefixer')) {
132099
+ const req = (0, module__rspack_import_2.createRequire)(path__rspack_import_0.join(projectPath, 'package.json'));
132100
+ const autoprefixerMod = req('autoprefixer');
132101
+ const autoprefixerPlugin = 'function' == typeof autoprefixerMod ? autoprefixerMod() : autoprefixerMod?.default && 'function' == typeof autoprefixerMod.default ? autoprefixerMod.default() : void 0;
132102
+ if (autoprefixerPlugin) pluginsFromOptions = [
132103
+ ...pluginsFromOptions || [],
132104
+ autoprefixerPlugin
131547
132105
  ];
131548
132106
  }
131549
132107
  } catch {}
131550
132108
  const postcssOptions = {
131551
132109
  ident: 'postcss',
131552
132110
  cwd: projectPath,
131553
- config: projectPath
132111
+ config: userConfigIsCjsInEsm || bypassUserConfigForTailwindCompat ? false : projectPath
131554
132112
  };
131555
132113
  if (pluginsFromOptions) postcssOptions.plugins = pluginsFromOptions;
131556
132114
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
@@ -131814,10 +132372,12 @@ var __webpack_modules__ = {
131814
132372
  K: ()=>isUsingPreact,
131815
132373
  b: ()=>maybeUsePreact
131816
132374
  });
131817
- var pintor__rspack_import_0 = __webpack_require__("pintor");
131818
- var pintor__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_0);
131819
- var _js_frameworks_lib_messages__rspack_import_1 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
131820
- var _frameworks_lib_integrations__rspack_import_2 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
132375
+ var path__rspack_import_0 = __webpack_require__("path");
132376
+ var module__rspack_import_1 = __webpack_require__("module");
132377
+ var pintor__rspack_import_2 = __webpack_require__("pintor");
132378
+ var pintor__rspack_import_2_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_2);
132379
+ var _js_frameworks_lib_messages__rspack_import_3 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
132380
+ var _frameworks_lib_integrations__rspack_import_4 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
131821
132381
  let userMessageDelivered = false;
131822
132382
  let cachedPreactRefreshPlugin;
131823
132383
  function getPreactRefreshPlugin() {
@@ -131830,9 +132390,9 @@ var __webpack_modules__ = {
131830
132390
  } catch {}
131831
132391
  }
131832
132392
  function isUsingPreact(projectPath) {
131833
- if ((0, _frameworks_lib_integrations__rspack_import_2.ws)(projectPath, 'preact')) {
132393
+ if ((0, _frameworks_lib_integrations__rspack_import_4.ws)(projectPath, 'preact')) {
131834
132394
  if (!userMessageDelivered) {
131835
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_0_default().brightMagenta('►►► Author says')} ${_js_frameworks_lib_messages__rspack_import_1.zA('Preact')}`);
132395
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_2_default().brightMagenta('►►► Author says')} ${_js_frameworks_lib_messages__rspack_import_3.zA('Preact')}`);
131836
132396
  userMessageDelivered = true;
131837
132397
  }
131838
132398
  return true;
@@ -131850,9 +132410,9 @@ var __webpack_modules__ = {
131850
132410
  '@rspack/plugin-preact-refresh',
131851
132411
  'preact'
131852
132412
  ];
131853
- const didInstall = await (0, _frameworks_lib_integrations__rspack_import_2.tm)('Preact', preactDependencies);
132413
+ const didInstall = await (0, _frameworks_lib_integrations__rspack_import_4.tm)('Preact', preactDependencies);
131854
132414
  if (!didInstall) throw new Error('[Preact] Optional dependencies failed to install.');
131855
- console.log(_js_frameworks_lib_messages__rspack_import_1.Jv('Preact'));
132415
+ console.log(_js_frameworks_lib_messages__rspack_import_3.Jv('Preact'));
131856
132416
  process.exit(0);
131857
132417
  }
131858
132418
  const PreactRefreshPlugin = getPreactRefreshPlugin();
@@ -131860,15 +132420,30 @@ var __webpack_modules__ = {
131860
132420
  const preactPlugins = [
131861
132421
  new PreactRefreshPlugin({})
131862
132422
  ];
132423
+ const requireFromProject = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(projectPath, 'package.json'));
132424
+ const resolveFromProject = (id)=>{
132425
+ try {
132426
+ return requireFromProject.resolve(id);
132427
+ } catch {
132428
+ return;
132429
+ }
132430
+ };
132431
+ const preactCompat = resolveFromProject('preact/compat');
132432
+ const preactTestUtils = resolveFromProject('preact/test-utils');
132433
+ const preactJsxRuntime = resolveFromProject('preact/jsx-runtime');
132434
+ const preactJsxDevRuntime = resolveFromProject('preact/jsx-dev-runtime');
132435
+ const alias = {};
132436
+ if (preactCompat) {
132437
+ alias.react = preactCompat;
132438
+ alias['react-dom'] = preactCompat;
132439
+ }
132440
+ if (preactTestUtils) alias['react-dom/test-utils'] = preactTestUtils;
132441
+ if (preactJsxRuntime) alias['react/jsx-runtime'] = preactJsxRuntime;
132442
+ if (preactJsxDevRuntime) alias['react/jsx-dev-runtime'] = preactJsxDevRuntime;
131863
132443
  return {
131864
132444
  plugins: preactPlugins,
131865
132445
  loaders: void 0,
131866
- alias: {
131867
- react: 'preact/compat',
131868
- 'react-dom/test-utils': 'preact/test-utils',
131869
- 'react-dom': 'preact/compat',
131870
- 'react/jsx-runtime': 'preact/jsx-runtime'
131871
- }
132446
+ alias
131872
132447
  };
131873
132448
  }
131874
132449
  },
@@ -131931,6 +132506,7 @@ var __webpack_modules__ = {
131931
132506
  let reactDomPath;
131932
132507
  let reactDomClientPath;
131933
132508
  let jsxRuntimePath;
132509
+ let jsxDevRuntimePath;
131934
132510
  try {
131935
132511
  reactPath = requireFromProject.resolve('react');
131936
132512
  } catch {}
@@ -131943,11 +132519,15 @@ var __webpack_modules__ = {
131943
132519
  try {
131944
132520
  jsxRuntimePath = requireFromProject.resolve('react/jsx-runtime');
131945
132521
  } catch {}
132522
+ try {
132523
+ jsxDevRuntimePath = requireFromProject.resolve('react/jsx-dev-runtime');
132524
+ } catch {}
131946
132525
  const alias = {};
131947
132526
  if (reactPath) alias['react$'] = reactPath;
131948
132527
  if (reactDomPath) alias['react-dom$'] = reactDomPath;
131949
132528
  if (reactDomClientPath) alias['react-dom/client'] = reactDomClientPath;
131950
132529
  if (jsxRuntimePath) alias['react/jsx-runtime'] = jsxRuntimePath;
132530
+ if (jsxDevRuntimePath) alias['react/jsx-dev-runtime'] = jsxDevRuntimePath;
131951
132531
  return {
131952
132532
  plugins: reactPlugins,
131953
132533
  loaders: void 0,
@@ -131962,9 +132542,10 @@ var __webpack_modules__ = {
131962
132542
  a: ()=>isUsingSvelte
131963
132543
  });
131964
132544
  var path__rspack_import_0 = __webpack_require__("path");
131965
- var _js_frameworks_lib_messages__rspack_import_1 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
131966
- var _frameworks_lib_integrations__rspack_import_2 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
131967
- var _js_frameworks_lib_load_loader_options__rspack_import_3 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/load-loader-options.ts");
132545
+ var module__rspack_import_1 = __webpack_require__("module");
132546
+ var _js_frameworks_lib_messages__rspack_import_2 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
132547
+ var _frameworks_lib_integrations__rspack_import_3 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
132548
+ var _js_frameworks_lib_load_loader_options__rspack_import_4 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/load-loader-options.ts");
131968
132549
  let userMessageDelivered = false;
131969
132550
  function resolveFromProject(id, projectPath) {
131970
132551
  try {
@@ -131979,9 +132560,9 @@ var __webpack_modules__ = {
131979
132560
  }
131980
132561
  }
131981
132562
  function isUsingSvelte(projectPath) {
131982
- const using = (0, _frameworks_lib_integrations__rspack_import_2.ws)(projectPath, 'svelte');
132563
+ const using = (0, _frameworks_lib_integrations__rspack_import_3.ws)(projectPath, 'svelte');
131983
132564
  if (using && !userMessageDelivered) {
131984
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(_js_frameworks_lib_messages__rspack_import_1.zA('Svelte'));
132565
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(_js_frameworks_lib_messages__rspack_import_2.zA('Svelte'));
131985
132566
  userMessageDelivered = true;
131986
132567
  }
131987
132568
  return using;
@@ -131994,14 +132575,14 @@ var __webpack_modules__ = {
131994
132575
  const typeScriptDependencies = [
131995
132576
  "typescript"
131996
132577
  ];
131997
- const didInstallTs = await (0, _frameworks_lib_integrations__rspack_import_2.tm)('TypeScript', typeScriptDependencies);
132578
+ const didInstallTs = await (0, _frameworks_lib_integrations__rspack_import_3.tm)('TypeScript', typeScriptDependencies);
131998
132579
  if (!didInstallTs) throw new Error('[TypeScript] Optional dependencies failed to install.');
131999
132580
  const svelteDependencies = [
132000
132581
  'svelte-loader'
132001
132582
  ];
132002
- const didInstallSvelte = await (0, _frameworks_lib_integrations__rspack_import_2.tm)('Svelte', svelteDependencies);
132583
+ const didInstallSvelte = await (0, _frameworks_lib_integrations__rspack_import_3.tm)('Svelte', svelteDependencies);
132003
132584
  if (!didInstallSvelte) throw new Error('[Svelte] Optional dependencies failed to install.');
132004
- console.log(_js_frameworks_lib_messages__rspack_import_1.Jv('Svelte'));
132585
+ console.log(_js_frameworks_lib_messages__rspack_import_2.Jv('Svelte'));
132005
132586
  process.exit(0);
132006
132587
  }
132007
132588
  try {
@@ -132015,12 +132596,12 @@ var __webpack_modules__ = {
132015
132596
  const typeScriptDependencies = [
132016
132597
  "typescript"
132017
132598
  ];
132018
- const didInstallTs = await (0, _frameworks_lib_integrations__rspack_import_2.tm)('TypeScript', typeScriptDependencies);
132599
+ const didInstallTs = await (0, _frameworks_lib_integrations__rspack_import_3.tm)('TypeScript', typeScriptDependencies);
132019
132600
  if (!didInstallTs) throw new Error('[TypeScript] Optional dependencies failed to install.');
132020
- console.log(_js_frameworks_lib_messages__rspack_import_1.Jv('TypeScript'));
132601
+ console.log(_js_frameworks_lib_messages__rspack_import_2.Jv('TypeScript'));
132021
132602
  process.exit(0);
132022
132603
  }
132023
- const customOptions = await (0, _js_frameworks_lib_load_loader_options__rspack_import_3.g)(projectPath, 'svelte');
132604
+ const customOptions = await (0, _js_frameworks_lib_load_loader_options__rspack_import_4.g)(projectPath, 'svelte');
132024
132605
  const svelteLoaderPath = resolveFromProject('svelte-loader', projectPath) || require.resolve('svelte-loader');
132025
132606
  const defaultLoaders = [
132026
132607
  {
@@ -132054,7 +132635,25 @@ var __webpack_modules__ = {
132054
132635
  }
132055
132636
  }
132056
132637
  ];
132057
- const alias = void 0;
132638
+ const requireFromProject = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(projectPath, 'package.json'));
132639
+ const resolveSvelteRuntime = (id)=>{
132640
+ try {
132641
+ return requireFromProject.resolve(id);
132642
+ } catch {
132643
+ return;
132644
+ }
132645
+ };
132646
+ const alias = {};
132647
+ const svelteEntry = resolveSvelteRuntime('svelte');
132648
+ const svelteInternal = resolveSvelteRuntime('svelte/internal');
132649
+ const svelteStore = resolveSvelteRuntime('svelte/store');
132650
+ const svelteMotion = resolveSvelteRuntime('svelte/motion');
132651
+ const svelteTransition = resolveSvelteRuntime('svelte/transition');
132652
+ if (svelteEntry) alias.svelte = svelteEntry;
132653
+ if (svelteInternal) alias['svelte/internal'] = svelteInternal;
132654
+ if (svelteStore) alias['svelte/store'] = svelteStore;
132655
+ if (svelteMotion) alias['svelte/motion'] = svelteMotion;
132656
+ if (svelteTransition) alias['svelte/transition'] = svelteTransition;
132058
132657
  const resolverPlugin = {
132059
132658
  apply (compiler) {
132060
132659
  const existingMainFields = compiler.options.resolve && compiler.options.resolve.mainFields || [];
@@ -132222,12 +132821,14 @@ var __webpack_modules__ = {
132222
132821
  K: ()=>maybeUseVue,
132223
132822
  L: ()=>isUsingVue
132224
132823
  });
132225
- var _rspack_core__rspack_import_0 = __webpack_require__("@rspack/core");
132226
- var pintor__rspack_import_1 = __webpack_require__("pintor");
132227
- var pintor__rspack_import_1_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_1);
132228
- var _js_frameworks_lib_messages__rspack_import_2 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
132229
- var _frameworks_lib_integrations__rspack_import_3 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
132230
- var _js_frameworks_lib_load_loader_options__rspack_import_4 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/load-loader-options.ts");
132824
+ var path__rspack_import_0 = __webpack_require__("path");
132825
+ var module__rspack_import_1 = __webpack_require__("module");
132826
+ var _rspack_core__rspack_import_2 = __webpack_require__("@rspack/core");
132827
+ var pintor__rspack_import_3 = __webpack_require__("pintor");
132828
+ var pintor__rspack_import_3_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_3);
132829
+ var _js_frameworks_lib_messages__rspack_import_4 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
132830
+ var _frameworks_lib_integrations__rspack_import_5 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
132831
+ var _js_frameworks_lib_load_loader_options__rspack_import_6 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/load-loader-options.ts");
132231
132832
  let userMessageDelivered = false;
132232
132833
  let cachedVueLoaderPlugin;
132233
132834
  function getVueLoaderPlugin() {
@@ -132242,9 +132843,9 @@ var __webpack_modules__ = {
132242
132843
  } catch {}
132243
132844
  }
132244
132845
  function isUsingVue(projectPath) {
132245
- const using = (0, _frameworks_lib_integrations__rspack_import_3.ws)(projectPath, 'vue');
132846
+ const using = (0, _frameworks_lib_integrations__rspack_import_5.ws)(projectPath, 'vue');
132246
132847
  if (using && !userMessageDelivered) {
132247
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_1_default().brightMagenta('►►► Author says')} ${_js_frameworks_lib_messages__rspack_import_2.zA('Vue')}`);
132848
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_3_default().brightMagenta('►►► Author says')} ${_js_frameworks_lib_messages__rspack_import_4.zA('Vue')}`);
132248
132849
  userMessageDelivered = true;
132249
132850
  }
132250
132851
  return using;
@@ -132258,14 +132859,14 @@ var __webpack_modules__ = {
132258
132859
  'vue-loader',
132259
132860
  '@vue/compiler-sfc'
132260
132861
  ];
132261
- const didInstall = await (0, _frameworks_lib_integrations__rspack_import_3.tm)('Vue', vueDependencies);
132862
+ const didInstall = await (0, _frameworks_lib_integrations__rspack_import_5.tm)('Vue', vueDependencies);
132262
132863
  if (!didInstall) throw new Error('[Vue] Optional dependencies failed to install.');
132263
- console.log(_js_frameworks_lib_messages__rspack_import_2.Jv('Vue'));
132864
+ console.log(_js_frameworks_lib_messages__rspack_import_4.Jv('Vue'));
132264
132865
  process.exit(0);
132265
132866
  }
132266
132867
  const VueLoaderPlugin = getVueLoaderPlugin();
132267
132868
  if (!VueLoaderPlugin) throw new Error('[Vue] vue-loader is installed but VueLoaderPlugin could not be resolved.');
132268
- const customOptions = await (0, _js_frameworks_lib_load_loader_options__rspack_import_4.g)(projectPath, 'vue');
132869
+ const customOptions = await (0, _js_frameworks_lib_load_loader_options__rspack_import_6.g)(projectPath, 'vue');
132269
132870
  const defaultLoaders = [
132270
132871
  {
132271
132872
  test: /\.vue$/,
@@ -132281,16 +132882,33 @@ var __webpack_modules__ = {
132281
132882
  const isProd = 'production' === mode;
132282
132883
  const defaultPlugins = [
132283
132884
  new VueLoaderPlugin(),
132284
- new _rspack_core__rspack_import_0.DefinePlugin({
132885
+ new _rspack_core__rspack_import_2.DefinePlugin({
132285
132886
  __VUE_OPTIONS_API__: JSON.stringify(true),
132286
132887
  __VUE_PROD_DEVTOOLS__: JSON.stringify(!isProd),
132287
132888
  __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: JSON.stringify(!isProd)
132288
132889
  })
132289
132890
  ];
132891
+ const requireFromProject = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(projectPath, 'package.json'));
132892
+ const resolveFromProject = (id)=>{
132893
+ try {
132894
+ return requireFromProject.resolve(id);
132895
+ } catch {
132896
+ return;
132897
+ }
132898
+ };
132899
+ const alias = {};
132900
+ const vuePath = resolveFromProject('vue');
132901
+ const vueRuntimeDom = resolveFromProject('@vue/runtime-dom');
132902
+ const vueRuntimeCore = resolveFromProject('@vue/runtime-core');
132903
+ const vueShared = resolveFromProject('@vue/shared');
132904
+ if (vuePath) alias['vue$'] = vuePath;
132905
+ if (vueRuntimeDom) alias['@vue/runtime-dom'] = vueRuntimeDom;
132906
+ if (vueRuntimeCore) alias['@vue/runtime-core'] = vueRuntimeCore;
132907
+ if (vueShared) alias['@vue/shared'] = vueShared;
132290
132908
  return {
132291
132909
  plugins: defaultPlugins,
132292
132910
  loaders: defaultLoaders,
132293
- alias: void 0
132911
+ alias
132294
132912
  };
132295
132913
  }
132296
132914
  },
@@ -132350,76 +132968,6 @@ var __webpack_modules__ = {
132350
132968
  return Object.keys(dependencies).filter((dep)=>!isDependencyInstalled(dep, packageRoot));
132351
132969
  }
132352
132970
  },
132353
- "./webpack/webpack-lib/companion-extensions.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
132354
- "use strict";
132355
- __webpack_require__.d(__webpack_exports__, {
132356
- A: ()=>resolveCompanionExtensionDirs
132357
- });
132358
- var fs__rspack_import_0 = __webpack_require__("fs");
132359
- var path__rspack_import_1 = __webpack_require__("path");
132360
- function isDir(p) {
132361
- try {
132362
- return fs__rspack_import_0.existsSync(p) && fs__rspack_import_0.statSync(p).isDirectory();
132363
- } catch {
132364
- return false;
132365
- }
132366
- }
132367
- function isFile(p) {
132368
- try {
132369
- return fs__rspack_import_0.existsSync(p) && fs__rspack_import_0.statSync(p).isFile();
132370
- } catch {
132371
- return false;
132372
- }
132373
- }
132374
- function toAbs(projectRoot, p) {
132375
- return path__rspack_import_1.isAbsolute(p) ? p : path__rspack_import_1.resolve(projectRoot, p);
132376
- }
132377
- function isValidExtensionRoot(dir) {
132378
- if (!isDir(dir)) return false;
132379
- return isFile(path__rspack_import_1.join(dir, 'manifest.json'));
132380
- }
132381
- function resolveCompanionExtensionDirs(opts) {
132382
- const { projectRoot, config } = opts;
132383
- const explicitPaths = [];
132384
- let scanDir;
132385
- if (Array.isArray(config)) explicitPaths.push(...config.filter((p)=>'string' == typeof p));
132386
- else if (config && 'object' == typeof config) {
132387
- if (Array.isArray(config.paths)) explicitPaths.push(...config.paths.filter((p)=>'string' == typeof p));
132388
- if ('string' == typeof config.dir && config.dir.trim().length > 0) scanDir = config.dir.trim();
132389
- }
132390
- const found = [];
132391
- for (const p of explicitPaths){
132392
- const abs = toAbs(projectRoot, p);
132393
- if (isValidExtensionRoot(abs)) found.push(abs);
132394
- }
132395
- if (scanDir) {
132396
- const absScan = toAbs(projectRoot, scanDir);
132397
- if (isDir(absScan)) {
132398
- let entries = [];
132399
- try {
132400
- entries = fs__rspack_import_0.readdirSync(absScan, {
132401
- withFileTypes: true
132402
- });
132403
- } catch {
132404
- entries = [];
132405
- }
132406
- for (const ent of entries){
132407
- if (!ent.isDirectory()) continue;
132408
- if (ent.name.startsWith('.')) continue;
132409
- const candidate = path__rspack_import_1.join(absScan, ent.name);
132410
- if (isValidExtensionRoot(candidate)) found.push(candidate);
132411
- }
132412
- }
132413
- }
132414
- const unique = [];
132415
- const seen = new Set();
132416
- for (const p of found)if (!seen.has(p)) {
132417
- seen.add(p);
132418
- unique.push(p);
132419
- }
132420
- return unique;
132421
- }
132422
- },
132423
132971
  "./webpack/webpack-lib/config-loader.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
132424
132972
  "use strict";
132425
132973
  __webpack_require__.d(__webpack_exports__, {
@@ -132579,9 +133127,13 @@ var __webpack_modules__ = {
132579
133127
  const baseExtensions = userConfig && userConfig.extensions ? {
132580
133128
  extensions: userConfig.extensions
132581
133129
  } : {};
133130
+ const baseTranspilePackages = userConfig && Array.isArray(userConfig.transpilePackages) ? {
133131
+ transpilePackages: userConfig.transpilePackages
133132
+ } : {};
132582
133133
  const perCommand = userConfig && userConfig.commands && userConfig.commands[command] ? userConfig.commands[command] : {};
132583
133134
  return {
132584
133135
  ...baseExtensions,
133136
+ ...baseTranspilePackages,
132585
133137
  ...perCommand
132586
133138
  };
132587
133139
  } catch (err) {
@@ -132703,6 +133255,18 @@ var __webpack_modules__ = {
132703
133255
  var fs__rspack_import_0 = __webpack_require__("fs");
132704
133256
  var path__rspack_import_1 = __webpack_require__("path");
132705
133257
  var _paths__rspack_import_2 = __webpack_require__("./webpack/webpack-lib/paths.ts");
133258
+ function hasNewTabOverride(extensionDir) {
133259
+ const manifestPath = path__rspack_import_1.join(extensionDir, 'manifest.json');
133260
+ if (!fs__rspack_import_0.existsSync(manifestPath)) return false;
133261
+ try {
133262
+ const raw = fs__rspack_import_0.readFileSync(manifestPath, 'utf-8');
133263
+ const manifest = JSON.parse(raw);
133264
+ const newtab = manifest?.chrome_url_overrides?.newtab;
133265
+ return 'string' == typeof newtab && newtab.trim().length > 0;
133266
+ } catch {
133267
+ return false;
133268
+ }
133269
+ }
132706
133270
  function computeExtensionsToLoad(baseDir, mode, browser, userExtensionOutputPath, extraExtensionDirs = []) {
132707
133271
  const list = [];
132708
133272
  try {
@@ -132712,7 +133276,10 @@ var __webpack_modules__ = {
132712
133276
  const themeRoot = path__rspack_import_1.join(distRoot, 'extension-js-theme');
132713
133277
  const devtoolsForBrowser = path__rspack_import_1.join(devtoolsRoot, engine);
132714
133278
  const themeForBrowser = path__rspack_import_1.join(themeRoot, engine);
132715
- if ('production' !== mode && fs__rspack_import_0.existsSync(devtoolsForBrowser)) list.push(devtoolsForBrowser);
133279
+ const userHasNewTabOverride = hasNewTabOverride(userExtensionOutputPath);
133280
+ const devtoolsHasNewTabOverride = hasNewTabOverride(devtoolsForBrowser);
133281
+ const shouldSkipDevtoolsForNtpConflict = userHasNewTabOverride && devtoolsHasNewTabOverride;
133282
+ if ('production' !== mode && fs__rspack_import_0.existsSync(devtoolsForBrowser) && !shouldSkipDevtoolsForNtpConflict) list.push(devtoolsForBrowser);
132716
133283
  if (fs__rspack_import_0.existsSync(themeForBrowser)) list.push(themeForBrowser);
132717
133284
  } catch {}
132718
133285
  for (const p of extraExtensionDirs)list.push(p);
@@ -133136,6 +133703,77 @@ var __webpack_modules__ = {
133136
133703
  return `${getLoggingPrefix('error')} Your project declares dependencies that are managed by ${pintor__rspack_import_2_default().blue('Extension.js')} and referenced in ${pintor__rspack_import_2_default().underline('extension.config.js')}\n${pintor__rspack_import_2_default().red('This can cause version conflicts and break the development/build process.')}\n\n${pintor__rspack_import_2_default().gray('Managed dependencies (remove these from your package.json):')}\n${list}\n\n${pintor__rspack_import_2_default().gray('PATH')} ${pintor__rspack_import_2_default().underline(userPackageJsonPath)}\nIf you need a different version, open an issue so we can consider bundling it safely.\nOperation aborted.`;
133137
133704
  }
133138
133705
  },
133706
+ "./webpack/webpack-lib/package-json.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
133707
+ "use strict";
133708
+ __webpack_require__.d(__webpack_exports__, {
133709
+ Pb: ()=>findNearestPackageJsonSync,
133710
+ cy: ()=>findNearestPackageJson,
133711
+ t7: ()=>validatePackageJson
133712
+ });
133713
+ var path__rspack_import_0 = __webpack_require__("path");
133714
+ var fs__rspack_import_1 = __webpack_require__("fs");
133715
+ async function findUpLocal(filename, options) {
133716
+ const root = path__rspack_import_0.parse(options.cwd).root;
133717
+ let currentDir = options.cwd;
133718
+ while(true){
133719
+ const candidate = path__rspack_import_0.join(currentDir, filename);
133720
+ try {
133721
+ const stat = await fs__rspack_import_1.promises.stat(candidate);
133722
+ if (stat.isFile()) return candidate;
133723
+ } catch {}
133724
+ if (currentDir === root) return;
133725
+ currentDir = path__rspack_import_0.dirname(currentDir);
133726
+ }
133727
+ }
133728
+ function findUpLocalSync(filename, options) {
133729
+ const root = path__rspack_import_0.parse(options.cwd).root;
133730
+ let currentDir = options.cwd;
133731
+ while(true){
133732
+ const candidate = path__rspack_import_0.join(currentDir, filename);
133733
+ try {
133734
+ const stat = fs__rspack_import_1.statSync(candidate);
133735
+ if (stat.isFile()) return candidate;
133736
+ } catch {}
133737
+ if (currentDir === root) return;
133738
+ currentDir = path__rspack_import_0.dirname(currentDir);
133739
+ }
133740
+ }
133741
+ async function findNearestPackageJson(manifestPath) {
133742
+ try {
133743
+ const manifestDir = path__rspack_import_0.dirname(manifestPath);
133744
+ const packageJsonPath = await findUpLocal('package.json', {
133745
+ cwd: manifestDir
133746
+ });
133747
+ return packageJsonPath || null;
133748
+ } catch (error) {
133749
+ console.warn('Failed to find package.json:', error);
133750
+ return null;
133751
+ }
133752
+ }
133753
+ function findNearestPackageJsonSync(manifestPath) {
133754
+ try {
133755
+ const manifestDir = path__rspack_import_0.dirname(manifestPath);
133756
+ const packageJsonPath = findUpLocalSync('package.json', {
133757
+ cwd: manifestDir
133758
+ });
133759
+ return packageJsonPath || null;
133760
+ } catch (error) {
133761
+ console.warn('Failed to find package.json:', error);
133762
+ return null;
133763
+ }
133764
+ }
133765
+ function validatePackageJson(packageJsonPath) {
133766
+ try {
133767
+ if (!fs__rspack_import_1.existsSync(packageJsonPath)) return false;
133768
+ const content = fs__rspack_import_1.readFileSync(packageJsonPath, 'utf-8');
133769
+ JSON.parse(content);
133770
+ return true;
133771
+ } catch (error) {
133772
+ console.warn('Invalid package.json at:', packageJsonPath, error);
133773
+ return false;
133774
+ }
133775
+ }
133776
+ },
133139
133777
  "./webpack/webpack-lib/package-manager.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
133140
133778
  "use strict";
133141
133779
  __webpack_require__.d(__webpack_exports__, {
@@ -133455,12 +134093,15 @@ var __webpack_modules__ = {
133455
134093
  const depsCount = Object.keys(packageJson?.dependencies || {}).length;
133456
134094
  const devDepsCount = Object.keys(packageJson?.devDependencies || {}).length;
133457
134095
  if (depsCount + devDepsCount === 0) return false;
133458
- if ((0, _install_cache__rspack_import_2.Q)(packageJsonDir)) return false;
133459
134096
  if (!fs__rspack_import_0.existsSync(nm)) return true;
133460
134097
  const deps = Object.keys(packageJson?.dependencies || {});
133461
134098
  const devDeps = Object.keys(packageJson?.devDependencies || {});
134099
+ const hasMarker = (0, _install_cache__rspack_import_2.Q)(packageJsonDir);
133462
134100
  if (fs__rspack_import_0.existsSync(path__rspack_import_1.join(nm, '.pnpm'))) return false;
133463
134101
  if (fs__rspack_import_0.existsSync(path__rspack_import_1.join(nm, '.modules.yaml'))) return false;
134102
+ if (hasMarker) try {
134103
+ if (fs__rspack_import_0.readdirSync(nm).length > 0) return false;
134104
+ } catch {}
133464
134105
  const hasInstalledDep = [
133465
134106
  ...deps,
133466
134107
  ...devDeps
@@ -133539,6 +134180,11 @@ var __webpack_modules__ = {
133539
134180
  J: ()=>startProgressBar,
133540
134181
  u: ()=>shouldShowProgress
133541
134182
  });
134183
+ function clearLine() {
134184
+ if (!process.stdout.isTTY) return;
134185
+ process.stdout.write('\r');
134186
+ process.stdout.write('\x1b[2K');
134187
+ }
133542
134188
  function stripAnsi(input) {
133543
134189
  return input.replace(/\x1b\[[0-9;]*m/g, '');
133544
134190
  }
@@ -133560,7 +134206,8 @@ var __webpack_modules__ = {
133560
134206
  const bar = `[${'='.repeat(filled)}${' '.repeat(empty)}]`;
133561
134207
  const line = `${label} ${bar}`;
133562
134208
  lastVisibleLength = stripAnsi(line).length;
133563
- process.stdout.write(`\r${line}`);
134209
+ clearLine();
134210
+ process.stdout.write(line);
133564
134211
  tick = (tick + 1) % (width + 1);
133565
134212
  };
133566
134213
  render();
@@ -133569,7 +134216,11 @@ var __webpack_modules__ = {
133569
134216
  stop: ()=>{
133570
134217
  clearInterval(timer);
133571
134218
  if (process.stdout.isTTY) {
133572
- process.stdout.write(`\r${' '.repeat(lastVisibleLength)}\r`);
134219
+ clearLine();
134220
+ if (lastVisibleLength > 0) {
134221
+ process.stdout.write(' '.repeat(lastVisibleLength));
134222
+ process.stdout.write('\r');
134223
+ }
133573
134224
  if (options?.persistLabel) process.stdout.write(`${label}\n`);
133574
134225
  }
133575
134226
  }
@@ -133719,7 +134370,7 @@ var __webpack_modules__ = {
133719
134370
  },
133720
134371
  "./package.json" (module) {
133721
134372
  "use strict";
133722
- module.exports = JSON.parse('{"rE":"3.5.1","El":{"@rspack/core":"^1.7.5","@rspack/dev-server":"^1.1.5","@swc/core":"^1.15.8","@swc/helpers":"^0.5.18","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chrome-location2":"4.0.0","chromium-location":"2.0.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^17.2.3","edge-location":"2.2.0","firefox-location2":"3.0.0","go-git-it":"^5.1.1","ignore":"^7.0.5","loader-utils":"^3.3.1","magic-string":"^0.30.21","parse5":"^8.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.3.3","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.19.0"}}');
134373
+ module.exports = JSON.parse('{"rE":"3.6.0","El":{"@rspack/core":"^1.7.5","@rspack/dev-server":"^1.1.5","@swc/core":"^1.15.8","@swc/helpers":"^0.5.18","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chrome-location2":"4.0.0","chromium-location":"2.0.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^17.2.3","edge-location":"2.2.0","extension-from-store":"^0.1.1","firefox-location2":"3.0.0","go-git-it":"^5.1.1","ignore":"^7.0.5","loader-utils":"^3.3.1","magic-string":"^0.30.21","parse5":"^8.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.3.3","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.19.0"}}');
133723
134374
  }
133724
134375
  };
133725
134376
  var __webpack_module_cache__ = {};
@@ -133814,42 +134465,7 @@ var __webpack_exports__ = {};
133814
134465
  var external_path_ = __webpack_require__("path");
133815
134466
  var external_fs_ = __webpack_require__("fs");
133816
134467
  var messages = __webpack_require__("./webpack/webpack-lib/messages.ts");
133817
- async function findUpLocal(filename, options) {
133818
- const root = external_path_.parse(options.cwd).root;
133819
- let currentDir = options.cwd;
133820
- while(true){
133821
- const candidate = external_path_.join(currentDir, filename);
133822
- try {
133823
- const stat = await external_fs_.promises.stat(candidate);
133824
- if (stat.isFile()) return candidate;
133825
- } catch {}
133826
- if (currentDir === root) return;
133827
- currentDir = external_path_.dirname(currentDir);
133828
- }
133829
- }
133830
- async function findNearestPackageJson(manifestPath) {
133831
- try {
133832
- const manifestDir = external_path_.dirname(manifestPath);
133833
- const packageJsonPath = await findUpLocal('package.json', {
133834
- cwd: manifestDir
133835
- });
133836
- return packageJsonPath || null;
133837
- } catch (error) {
133838
- console.warn('Failed to find package.json:', error);
133839
- return null;
133840
- }
133841
- }
133842
- function validatePackageJson(packageJsonPath) {
133843
- try {
133844
- if (!external_fs_.existsSync(packageJsonPath)) return false;
133845
- const content = external_fs_.readFileSync(packageJsonPath, 'utf-8');
133846
- JSON.parse(content);
133847
- return true;
133848
- } catch (error) {
133849
- console.warn('Invalid package.json at:', packageJsonPath, error);
133850
- return false;
133851
- }
133852
- }
134468
+ var package_json = __webpack_require__("./webpack/webpack-lib/package-json.ts");
133853
134469
  const isUrl = (url)=>{
133854
134470
  try {
133855
134471
  new URL(url);
@@ -133971,15 +134587,24 @@ var __webpack_exports__ = {};
133971
134587
  }
133972
134588
  async function getProjectStructure(pathOrRemoteUrl) {
133973
134589
  const projectPath = await getProjectPath(pathOrRemoteUrl);
133974
- let manifestPath = external_path_.join(projectPath, 'manifest.json');
134590
+ const isUnderDir = (baseDir, candidatePath)=>{
134591
+ const rel = external_path_.relative(baseDir, candidatePath);
134592
+ return Boolean(rel && !rel.startsWith('..') && !external_path_.isAbsolute(rel));
134593
+ };
134594
+ const packageJsonPathFromProject = await (0, package_json.cy)(external_path_.join(projectPath, 'manifest.json'));
134595
+ const packageJsonDirFromProject = packageJsonPathFromProject ? external_path_.dirname(packageJsonPathFromProject) : void 0;
134596
+ const rootManifestPath = external_path_.join(projectPath, 'manifest.json');
134597
+ const srcManifestPath = external_path_.join(projectPath, 'src', 'manifest.json');
134598
+ let manifestPath = external_fs_.existsSync(srcManifestPath) ? srcManifestPath : rootManifestPath;
133975
134599
  if (!external_fs_.existsSync(manifestPath)) {
134600
+ if (packageJsonDirFromProject) throw new Error(messages.dx(manifestPath));
133976
134601
  const findManifest = (dir)=>{
133977
134602
  const files = external_fs_.readdirSync(dir, {
133978
134603
  withFileTypes: true
133979
134604
  });
133980
134605
  for (const file of files){
133981
134606
  if (file.isFile() && 'manifest.json' === file.name) return external_path_.join(dir, file.name);
133982
- if (file.isDirectory() && !file.name.startsWith('.') && 'node_modules' !== file.name && 'dist' !== file.name) {
134607
+ if (file.isDirectory() && !file.name.startsWith('.') && 'node_modules' !== file.name && 'dist' !== file.name && 'public' !== file.name) {
133983
134608
  const found = findManifest(external_path_.join(dir, file.name));
133984
134609
  if (found) return found;
133985
134610
  }
@@ -133990,8 +134615,19 @@ var __webpack_exports__ = {};
133990
134615
  if (foundManifest) manifestPath = foundManifest;
133991
134616
  else throw new Error(messages.dx(manifestPath));
133992
134617
  }
133993
- const packageJsonPath = await findNearestPackageJson(manifestPath);
133994
- if (!packageJsonPath || !validatePackageJson(packageJsonPath)) return {
134618
+ const packageJsonPath = await (0, package_json.cy)(manifestPath);
134619
+ const packageJsonDir = packageJsonPath ? external_path_.dirname(packageJsonPath) : void 0;
134620
+ if (packageJsonDir) {
134621
+ const publicRoot = external_path_.join(packageJsonDir, 'public');
134622
+ if (isUnderDir(publicRoot, manifestPath)) {
134623
+ const fallbackSrc = external_path_.join(packageJsonDir, 'src', 'manifest.json');
134624
+ const fallbackRoot = external_path_.join(packageJsonDir, 'manifest.json');
134625
+ if (external_fs_.existsSync(fallbackSrc)) manifestPath = fallbackSrc;
134626
+ else if (external_fs_.existsSync(fallbackRoot)) manifestPath = fallbackRoot;
134627
+ else throw new Error(messages.dx(fallbackRoot));
134628
+ }
134629
+ }
134630
+ if (!packageJsonPath || !(0, package_json.t7)(packageJsonPath)) return {
133995
134631
  manifestPath
133996
134632
  };
133997
134633
  return {
@@ -134458,6 +135094,8 @@ var __webpack_exports__ = {};
134458
135094
  stdio
134459
135095
  });
134460
135096
  }
135097
+ var resolve_config = __webpack_require__("./webpack/feature-special-folders/folder-extensions/resolve-config.ts");
135098
+ var get_data = __webpack_require__("./webpack/feature-special-folders/get-data.ts");
134461
135099
  async function extensionBuild(pathOrRemoteUrl, buildOptions) {
134462
135100
  const require1 = (0, external_module_.createRequire)(__rslib_import_meta_url__);
134463
135101
  const projectStructure = await getProjectStructure(pathOrRemoteUrl);
@@ -134486,21 +135124,29 @@ var __webpack_exports__ = {};
134486
135124
  __webpack_require__.e("552").then(__webpack_require__.bind(__webpack_require__, "./webpack/webpack-lib/stats-handler.ts")),
134487
135125
  Promise.all([
134488
135126
  __webpack_require__.e("215"),
134489
- __webpack_require__.e("547")
135127
+ __webpack_require__.e("535")
134490
135128
  ]).then(__webpack_require__.bind(__webpack_require__, "./webpack/webpack-config.ts"))
134491
135129
  ]);
134492
135130
  const debug = isAuthor;
134493
135131
  if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, manifestDir);
134494
135132
  const commandConfig = await (0, config_loader.eY)(manifestDir, 'build');
135133
+ const specialFoldersData = (0, get_data.H)(packageJsonDir);
134495
135134
  const distPath = (0, webpack_lib_paths.q4)(packageJsonDir, browser);
134496
135135
  if (debug) {
134497
135136
  console.log(messages.SG(manifestDir, packageJsonDir));
134498
135137
  console.log(messages._A(browser, buildOptions?.chromiumBinary, buildOptions?.geckoBinary || buildOptions?.firefoxBinary));
134499
135138
  console.log(messages.AC(distPath));
134500
135139
  }
135140
+ const mergedExtensionsConfig = buildOptions?.extensions ?? commandConfig.extensions ?? specialFoldersData.extensions;
135141
+ const resolvedExtensionsConfig = await (0, resolve_config.R)({
135142
+ projectRoot: packageJsonDir,
135143
+ browser,
135144
+ config: mergedExtensionsConfig
135145
+ });
134501
135146
  const baseConfig = webpackConfig(projectStructure, {
134502
135147
  ...commandConfig,
134503
135148
  ...buildOptions,
135149
+ extensions: resolvedExtensionsConfig,
134504
135150
  browser,
134505
135151
  mode: 'production',
134506
135152
  output: {
@@ -134616,7 +135262,7 @@ var __webpack_exports__ = {};
134616
135262
  if ('true' === process.env.EXTENSION_DEV_DRY_RUN) return;
134617
135263
  const { devServer } = await Promise.all([
134618
135264
  __webpack_require__.e("215"),
134619
- __webpack_require__.e("547"),
135265
+ __webpack_require__.e("535"),
134620
135266
  __webpack_require__.e("928")
134621
135267
  ]).then(__webpack_require__.bind(__webpack_require__, "./webpack/dev-server/index.ts"));
134622
135268
  await devServer(projectStructure, {
@@ -134631,7 +135277,61 @@ var __webpack_exports__ = {};
134631
135277
  }
134632
135278
  }
134633
135279
  var sanitize = __webpack_require__("./webpack/webpack-lib/sanitize.ts");
134634
- var companion_extensions = __webpack_require__("./webpack/webpack-lib/companion-extensions.ts");
135280
+ var utils = __webpack_require__("./webpack/feature-special-folders/folder-extensions/utils.ts");
135281
+ function resolveCompanionExtensionDirs(opts) {
135282
+ const { projectRoot, config } = opts;
135283
+ const normalized = (0, utils.cz)(config);
135284
+ const explicitPaths = normalized.paths;
135285
+ const scanDir = normalized.dir;
135286
+ const found = [];
135287
+ for (const p of explicitPaths){
135288
+ const abs = (0, utils.A$)(projectRoot, p);
135289
+ if ((0, utils.Uy)(abs)) found.push(abs);
135290
+ }
135291
+ if (scanDir) {
135292
+ const absScan = (0, utils.A$)(projectRoot, scanDir);
135293
+ if ((0, utils.Q7)(absScan)) {
135294
+ let entries = [];
135295
+ try {
135296
+ entries = external_fs_.readdirSync(absScan, {
135297
+ withFileTypes: true
135298
+ });
135299
+ } catch {
135300
+ entries = [];
135301
+ }
135302
+ const scanOneLevel = (rootDir)=>{
135303
+ let dirEntries = [];
135304
+ try {
135305
+ dirEntries = external_fs_.readdirSync(rootDir, {
135306
+ withFileTypes: true
135307
+ });
135308
+ } catch {
135309
+ dirEntries = [];
135310
+ }
135311
+ for (const ent of dirEntries){
135312
+ if (!ent.isDirectory()) continue;
135313
+ if (ent.name.startsWith('.')) continue;
135314
+ const candidate = external_path_.join(rootDir, ent.name);
135315
+ if ((0, utils.Uy)(candidate)) found.push(candidate);
135316
+ }
135317
+ };
135318
+ scanOneLevel(absScan);
135319
+ if ('extensions' === external_path_.basename(absScan)) for (const ent of entries){
135320
+ if (!ent.isDirectory()) continue;
135321
+ if (ent.name.startsWith('.')) continue;
135322
+ const browserDir = external_path_.join(absScan, ent.name);
135323
+ scanOneLevel(browserDir);
135324
+ }
135325
+ }
135326
+ }
135327
+ const unique = [];
135328
+ const seen = new Set();
135329
+ for (const p of found)if (!seen.has(p)) {
135330
+ seen.add(p);
135331
+ unique.push(p);
135332
+ }
135333
+ return unique;
135334
+ }
134635
135335
  var extensions_to_load = __webpack_require__("./webpack/webpack-lib/extensions-to-load.ts");
134636
135336
  var dark_mode = __webpack_require__("./webpack/webpack-lib/dark-mode.ts");
134637
135337
  var output_binaries_resolver = __webpack_require__("./webpack/plugin-browsers/browsers-lib/output-binaries-resolver.ts");
@@ -134734,12 +135434,20 @@ var __webpack_exports__ = {};
134734
135434
  const safeBrowserConfig = (0, sanitize.a)(browserConfig);
134735
135435
  const safeCommandConfig = (0, sanitize.a)(commandConfig);
134736
135436
  const safePreviewOptions = (0, sanitize.a)(previewOptions);
135437
+ const specialFoldersData = (0, get_data.H)(packageJsonDir);
135438
+ const mergedExtensionsConfig = safePreviewOptions.extensions ?? safeCommandConfig.extensions ?? safeBrowserConfig.extensions ?? specialFoldersData.extensions;
135439
+ const resolvedExtensionsConfig = await (0, resolve_config.R)({
135440
+ projectRoot: packageJsonDir,
135441
+ browser,
135442
+ config: mergedExtensionsConfig
135443
+ });
134737
135444
  const mergedGeckoBinary = safePreviewOptions.geckoBinary || safePreviewOptions.firefoxBinary || safeCommandConfig.geckoBinary || safeCommandConfig.firefoxBinary || safeBrowserConfig.geckoBinary || safeBrowserConfig.firefoxBinary;
134738
135445
  const mergedChromiumBinary = safePreviewOptions.chromiumBinary || safeCommandConfig.chromiumBinary || safeBrowserConfig.chromiumBinary;
134739
135446
  const merged = {
134740
135447
  ...safeBrowserConfig,
134741
135448
  ...safeCommandConfig,
134742
135449
  ...safePreviewOptions,
135450
+ extensions: resolvedExtensionsConfig,
134743
135451
  chromiumBinary: mergedChromiumBinary,
134744
135452
  geckoBinary: mergedGeckoBinary
134745
135453
  };
@@ -134748,7 +135456,7 @@ var __webpack_exports__ = {};
134748
135456
  browserFlags: merged.browserFlags,
134749
135457
  preferences: merged.preferences
134750
135458
  });
134751
- const companionUnpackedExtensionDirs = (0, companion_extensions.A)({
135459
+ const companionUnpackedExtensionDirs = resolveCompanionExtensionDirs({
134752
135460
  projectRoot: packageJsonDir,
134753
135461
  config: merged.extensions
134754
135462
  });