extension-develop 3.5.0-next.21 → 3.5.0-next.22

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.
Files changed (24) hide show
  1. package/dist/323.cjs +16 -8
  2. package/dist/547.cjs +48 -0
  3. package/dist/extension-js-devtools/chrome/background/service_worker.js +1 -1
  4. package/dist/extension-js-devtools/chrome/devtools/index.js +1 -1
  5. package/dist/extension-js-devtools/chrome/pages/centralized-logger.js +1 -1
  6. package/dist/extension-js-devtools/chrome/pages/welcome.js +1 -1
  7. package/dist/extension-js-devtools/chrome/scripts/logger-client.js +1 -1
  8. package/dist/extension-js-devtools/chromium/background/service_worker.js +1 -1
  9. package/dist/extension-js-devtools/chromium/devtools/index.js +1 -1
  10. package/dist/extension-js-devtools/chromium/pages/centralized-logger.js +1 -1
  11. package/dist/extension-js-devtools/chromium/pages/welcome.js +1 -1
  12. package/dist/extension-js-devtools/chromium/scripts/logger-client.js +1 -1
  13. package/dist/extension-js-devtools/edge/background/service_worker.js +1 -1
  14. package/dist/extension-js-devtools/edge/devtools/index.js +1 -1
  15. package/dist/extension-js-devtools/edge/pages/centralized-logger.js +1 -1
  16. package/dist/extension-js-devtools/edge/pages/welcome.js +1 -1
  17. package/dist/extension-js-devtools/edge/scripts/logger-client.js +1 -1
  18. package/dist/extension-js-devtools/firefox/background/scripts.js +1 -1
  19. package/dist/extension-js-devtools/firefox/devtools/index.js +1 -1
  20. package/dist/extension-js-devtools/firefox/pages/centralized-logger.js +1 -1
  21. package/dist/extension-js-devtools/firefox/pages/welcome.js +1 -1
  22. package/dist/extension-js-devtools/firefox/scripts/logger-client.js +1 -1
  23. package/dist/module.cjs +119 -59
  24. package/package.json +2 -2
@@ -1 +1 @@
1
- (()=>{"use strict";var r={},t={};function e(s){var o=t[s];if(void 0!==o)return o.exports;var u=t[s]={exports:{}};return r[s](u,u.exports,e),u.exports}e.rv=()=>"1.7.2",e.ruid="bundler=rspack@1.7.2"})();
1
+ (()=>{"use strict";var r={},t={};function e(s){var o=t[s];if(void 0!==o)return o.exports;var u=t[s]={exports:{}};return r[s](u,u.exports,e),u.exports}e.rv=()=>"1.7.5",e.ruid="bundler=rspack@1.7.5"})();
package/dist/module.cjs CHANGED
@@ -127238,14 +127238,16 @@ var __webpack_modules__ = {
127238
127238
  __webpack_require__.d(__webpack_exports__, {
127239
127239
  Bf: ()=>getLastCDPPort,
127240
127240
  Ef: ()=>getInstancePorts,
127241
- UF: ()=>setInstancePorts
127241
+ UF: ()=>setInstancePorts,
127242
+ mm: ()=>getLastRDPPort
127242
127243
  });
127243
127244
  const instanceIdToRecord = new Map();
127244
127245
  let lastCDPPort;
127246
+ let lastRDPPort;
127245
127247
  function setInstancePorts(instanceId, ports) {
127246
127248
  try {
127247
127249
  if ('number' == typeof ports.cdpPort) lastCDPPort = ports.cdpPort;
127248
- if ('number' == typeof ports.rdpPort) ports.rdpPort;
127250
+ if ('number' == typeof ports.rdpPort) lastRDPPort = ports.rdpPort;
127249
127251
  if (!instanceId) return;
127250
127252
  const prev = instanceIdToRecord.get(instanceId) || {};
127251
127253
  instanceIdToRecord.set(instanceId, {
@@ -127261,6 +127263,9 @@ var __webpack_modules__ = {
127261
127263
  function getLastCDPPort() {
127262
127264
  return lastCDPPort;
127263
127265
  }
127266
+ function getLastRDPPort() {
127267
+ return lastRDPPort;
127268
+ }
127264
127269
  },
127265
127270
  "./webpack/plugin-browsers/browsers-lib/messages.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
127266
127271
  "use strict";
@@ -128596,6 +128601,33 @@ var __webpack_modules__ = {
128596
128601
  else obj[key] = value;
128597
128602
  return obj;
128598
128603
  }
128604
+ async function waitForManifest(outPath, timeoutMs = 8000) {
128605
+ const manifestPath = `${outPath}/manifest.json`;
128606
+ const start = Date.now();
128607
+ while(Date.now() - start < timeoutMs){
128608
+ try {
128609
+ if (external_fs_.existsSync(manifestPath)) return true;
128610
+ } catch {}
128611
+ await new Promise((resolve)=>setTimeout(resolve, 150));
128612
+ }
128613
+ return false;
128614
+ }
128615
+ async function maybePrintDevBanner(args) {
128616
+ const mode = args.compilation?.options?.mode || 'development';
128617
+ if ('development' !== mode) return;
128618
+ const loadExtensionFlag = args.chromiumConfig.find((flag)=>flag.startsWith('--load-extension='));
128619
+ const extensionOutputPath = (0, extension_output_path.W)(args.compilation, loadExtensionFlag);
128620
+ if (!extensionOutputPath) return;
128621
+ const ready = await waitForManifest(extensionOutputPath, 10000);
128622
+ if (!ready) return;
128623
+ await (0, banner.a)({
128624
+ browser: args.browser,
128625
+ outPath: extensionOutputPath,
128626
+ hostPort: args.hostPort,
128627
+ getInfo: async ()=>null,
128628
+ browserVersionLine: args.browserVersionLine
128629
+ });
128630
+ }
128599
128631
  class ChromiumLaunchPlugin {
128600
128632
  async runOnce(compilation, opts) {
128601
128633
  if (!this.logger) this.logger = {
@@ -128895,6 +128927,15 @@ var __webpack_modules__ = {
128895
128927
  instance_registry.UF(this.options.instanceId, {
128896
128928
  cdpPort: selectedPort
128897
128929
  });
128930
+ await maybePrintDevBanner({
128931
+ compilation,
128932
+ chromiumConfig,
128933
+ browser: this.options.browser,
128934
+ hostPort: {
128935
+ host: '127.0.0.1',
128936
+ port: selectedPort
128937
+ }
128938
+ });
128898
128939
  if (this.options.dryRun) return void logChromiumDryRun(browserBinaryLocation, chromiumConfig);
128899
128940
  await this.launchWithDirectSpawn(browserBinaryLocation, chromiumConfig);
128900
128941
  try {
@@ -128905,8 +128946,8 @@ var __webpack_modules__ = {
128905
128946
  if (vLine && vLine.trim().length > 0) browserVersionLine = vLine.trim();
128906
128947
  }
128907
128948
  } catch {}
128949
+ const mode = compilation?.options?.mode || 'development';
128908
128950
  try {
128909
- const mode = compilation?.options?.mode || 'development';
128910
128951
  if ('production' === mode) {
128911
128952
  const loadExtensionFlag = chromiumConfig.find((flag)=>flag.startsWith('--load-extension='));
128912
128953
  const extensionOutputPath = (0, extension_output_path.W)(compilation, loadExtensionFlag);
@@ -129155,6 +129196,17 @@ var __webpack_modules__ = {
129155
129196
  }
129156
129197
  var external_path_ = __webpack_require__("path");
129157
129198
  var banner = __webpack_require__("./webpack/plugin-browsers/browsers-lib/banner.ts");
129199
+ async function waitForManifest(outPath, timeoutMs = 8000) {
129200
+ const manifestPath = external_path_.join(outPath, 'manifest.json');
129201
+ const start = Date.now();
129202
+ while(Date.now() - start < timeoutMs){
129203
+ try {
129204
+ if (external_fs_.existsSync(manifestPath)) return true;
129205
+ } catch {}
129206
+ await new Promise((resolve)=>setTimeout(resolve, 150));
129207
+ }
129208
+ return false;
129209
+ }
129158
129210
  async function printRunningInDevelopmentSummary(candidateAddonPaths, browser, extensionId, browserVersionLine) {
129159
129211
  try {
129160
129212
  let chosenPath = null;
@@ -129170,26 +129222,30 @@ var __webpack_modules__ = {
129170
129222
  }
129171
129223
  }
129172
129224
  if (!chosenPath && candidateAddonPaths.length > 0) chosenPath = candidateAddonPaths[candidateAddonPaths.length - 1];
129173
- if (chosenPath) {
129174
- const manifestPath = external_path_.join(chosenPath, 'manifest.json');
129175
- if (external_fs_.existsSync(manifestPath)) {
129176
- const manifest = JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8'));
129177
- await (0, banner.a)({
129178
- browser,
129179
- outPath: chosenPath,
129180
- hostPort: {
129181
- host: '127.0.0.1'
129182
- },
129183
- getInfo: async ()=>({
129184
- extensionId: extensionId || '(temporary)',
129185
- name: manifest.name,
129186
- version: manifest.version
129187
- }),
129188
- browserVersionLine
129189
- });
129190
- }
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;
129191
129230
  }
129192
- } catch {}
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
+ }
129193
129249
  }
129194
129250
  function printSourceInspection(html) {
129195
129251
  console.log(messages.sew());
@@ -129386,6 +129442,16 @@ var __webpack_modules__ = {
129386
129442
  const MAX_RETRIES = 150;
129387
129443
  const RETRY_INTERVAL = 1000;
129388
129444
  class RemoteFirefox {
129445
+ resolveRdpPort(compilation) {
129446
+ const instanceId = this.options?.instanceId;
129447
+ const devPort = compilation?.options?.devServer?.port;
129448
+ const optionPort = this.options?.port;
129449
+ const normalizedOptionPort = 'string' == typeof optionPort ? parseInt(optionPort, 10) : optionPort;
129450
+ const basePort = normalizedOptionPort || devPort;
129451
+ const desired = (0, shared_utils.jl)(basePort, instanceId);
129452
+ const fromInstance = instanceId ? (0, instance_registry.Ef)(instanceId)?.rdpPort : void 0;
129453
+ return fromInstance || (0, instance_registry.mm)() || desired;
129454
+ }
129389
129455
  async connectClient(port) {
129390
129456
  let lastError;
129391
129457
  for (const _ of Array.from({
@@ -129422,15 +129488,13 @@ var __webpack_modules__ = {
129422
129488
  return 0;
129423
129489
  });
129424
129490
  const extensionsToLoad = userFirst;
129425
- const devPort = compilation.options?.devServer?.port;
129426
- const optionPort = this.options?.port;
129427
- const normalizedOptionPort = 'string' == typeof optionPort ? parseInt(optionPort, 10) : optionPort;
129428
- const port = normalizedOptionPort || (devPort ? devPort + 100 : 9222);
129491
+ const port = this.resolveRdpPort(compilation);
129429
129492
  const client = await this.connectClient(port);
129430
129493
  let addonsActor = await getAddonsActorWithRetry(client, this.cachedAddonsActor);
129431
129494
  if (addonsActor) this.cachedAddonsActor = addonsActor;
129432
129495
  const candidateAddonPaths = computeCandidateAddonPaths(compilation, extensionsToLoad);
129433
129496
  for (const [index, addonPath] of candidateAddonPaths.entries()){
129497
+ const isManager = /extensions\/[a-z-]+-manager/.test(String(addonPath));
129434
129498
  const isDevtoolsEnabled = 0 === index && Boolean(devtools);
129435
129499
  try {
129436
129500
  const installResponse = await installTemporaryAddon(client, String(addonsActor || ''), addonPath, isDevtoolsEnabled);
@@ -129438,7 +129502,7 @@ var __webpack_modules__ = {
129438
129502
  const maybeId = installResponse?.addon?.id;
129439
129503
  if ('string' == typeof maybeId && maybeId.length > 0) this.derivedExtensionId = maybeId;
129440
129504
  }
129441
- if (1 === index || 0 === index && /extensions\/[a-z-]+-manager/.test(String(addonPath))) await waitForManagerWelcome(client);
129505
+ if (isManager) await waitForManagerWelcome(client);
129442
129506
  } catch (err) {
129443
129507
  const message = requestErrorToMessage(err);
129444
129508
  throw new Error(messages.WVu(this.options.browser, message));
@@ -129460,7 +129524,8 @@ var __webpack_modules__ = {
129460
129524
  if (!this.derivedExtensionId) this.derivedExtensionId = await deriveMozExtensionId(client);
129461
129525
  } catch {}
129462
129526
  this.lastInstalledAddonPath = candidateAddonPaths[0];
129463
- printRunningInDevelopmentSummary(candidateAddonPaths, 'firefox', this.derivedExtensionId, this.options.browserVersionLine);
129527
+ const bannerPrinted = await printRunningInDevelopmentSummary(candidateAddonPaths, 'firefox', this.derivedExtensionId, this.options.browserVersionLine);
129528
+ if (!bannerPrinted) throw new Error(messages.WVu(this.options.browser, 'Failed to print runningInDevelopment banner; add-on may not be installed.'));
129464
129529
  }
129465
129530
  markNeedsReinstall() {
129466
129531
  this.needsReinstall = true;
@@ -129512,10 +129577,7 @@ var __webpack_modules__ = {
129512
129577
  }
129513
129578
  async hardReloadIfNeeded(compilation, changedAssets) {
129514
129579
  try {
129515
- const devPort = compilation.options.devServer?.port;
129516
- const optionPort = this.options?.port;
129517
- const normalizedOptionPort = 'string' == typeof optionPort ? parseInt(optionPort, 10) : optionPort;
129518
- const rdpPort = normalizedOptionPort || (devPort ? devPort + 100 : 9222);
129580
+ const rdpPort = this.resolveRdpPort(compilation);
129519
129581
  const client = this.client || await this.connectClient(rdpPort);
129520
129582
  const normalized = (changedAssets || []).map((n)=>String(n || '')).map((n)=>n.replace(/\\/g, '/'));
129521
129583
  const isManifestChanged = normalized.includes('manifest.json');
@@ -129540,10 +129602,7 @@ var __webpack_modules__ = {
129540
129602
  }
129541
129603
  async inspectSource(compilation, opts) {
129542
129604
  try {
129543
- const devServerPort = compilation.options.devServer?.port;
129544
- const optionPort = this.options?.port;
129545
- const normalizedOptionPort = 'string' == typeof optionPort ? parseInt(optionPort, 10) : optionPort;
129546
- const rdpPort = normalizedOptionPort || (devServerPort ? devServerPort + 100 : 9222);
129605
+ const rdpPort = this.resolveRdpPort(compilation);
129547
129606
  const client = this.client || await this.connectClient(rdpPort);
129548
129607
  const urlToInspect = 'string' == typeof opts.source && 'true' !== opts.source ? opts.source : opts.startingUrl;
129549
129608
  const tab = await (0, source_inspect.oc)(client, urlToInspect);
@@ -129559,9 +129618,7 @@ var __webpack_modules__ = {
129559
129618
  async enableUnifiedLogging(opts) {
129560
129619
  try {
129561
129620
  if (this.loggingAttached) return;
129562
- const devPort = this.options?.port;
129563
- const normalized = 'string' == typeof devPort ? parseInt(devPort, 10) : devPort;
129564
- const rdpPort = normalized || 9222;
129621
+ const rdpPort = this.resolveRdpPort();
129565
129622
  const client = this.client || await this.connectClient(rdpPort);
129566
129623
  await attachConsoleListeners(client);
129567
129624
  const wantLevel = String(opts.level || 'info').toLowerCase();
@@ -129789,29 +129846,31 @@ var __webpack_modules__ = {
129789
129846
  });
129790
129847
  profilePath = tmp;
129791
129848
  }
129792
- external_fs_.mkdirSync(profilePath, {
129793
- recursive: true
129794
- });
129795
- try {
129796
- const prefs = getPreferences(configOptions?.preferences || {});
129797
- function serializeValue(value) {
129798
- if ('string' == typeof value) return JSON.stringify(value);
129799
- if ('boolean' == typeof value) return String(value);
129800
- if ('number' == typeof value && Number.isFinite(value)) return String(value);
129801
- return JSON.stringify(value);
129802
- }
129803
- function prefsToUserJs(prefsObject) {
129804
- return Object.entries(prefsObject).map(([key, val])=>`user_pref(${JSON.stringify(key)}, ${serializeValue(val)});`).join('\n');
129805
- }
129806
- const userJsPath = external_path_.join(profilePath, 'user.js');
129807
- const userJsContent = prefsToUserJs(prefs);
129808
- external_fs_.writeFileSync(userJsPath, userJsContent);
129809
- } catch {}
129810
129849
  try {
129811
129850
  const maxAgeHours = parseInt(String(process.env.EXTENSION_TMP_PROFILE_MAX_AGE_HOURS || ''), 10);
129812
129851
  (0, shared_utils.CW)(base, external_path_.basename(profilePath), Number.isFinite(maxAgeHours) ? maxAgeHours : 12);
129813
129852
  } catch {}
129814
129853
  }
129854
+ if (profilePath) try {
129855
+ external_fs_.mkdirSync(profilePath, {
129856
+ recursive: true
129857
+ });
129858
+ } catch {}
129859
+ if (profilePath) try {
129860
+ const prefs = getPreferences(configOptions?.preferences || {});
129861
+ function serializeValue(value) {
129862
+ if ('string' == typeof value) return JSON.stringify(value);
129863
+ if ('boolean' == typeof value) return String(value);
129864
+ if ('number' == typeof value && Number.isFinite(value)) return String(value);
129865
+ return JSON.stringify(value);
129866
+ }
129867
+ function prefsToUserJs(prefsObject) {
129868
+ return Object.entries(prefsObject).map(([key, val])=>`user_pref(${JSON.stringify(key)}, ${serializeValue(val)});`).join('\n');
129869
+ }
129870
+ const userJsPath = external_path_.join(profilePath, 'user.js');
129871
+ const userJsContent = prefsToUserJs(prefs);
129872
+ external_fs_.writeFileSync(userJsPath, userJsContent);
129873
+ } catch {}
129815
129874
  const parts = [
129816
129875
  `--binary-args="${binaryArgs.join(' ')}"`,
129817
129876
  '--verbose'
@@ -133277,7 +133336,8 @@ var __webpack_modules__ = {
133277
133336
  function normalizeBrowser(browser, chromiumBinary, geckoBinary) {
133278
133337
  const requested = String(browser || '');
133279
133338
  if (chromiumBinary) {
133280
- if (!requested || 'chromium' === requested || 'chromium-based' === requested) return 'chromium-based';
133339
+ if (!requested || 'chromium-based' === requested) return 'chromium-based';
133340
+ if ('chromium' === requested) return 'chromium';
133281
133341
  if ('edge' === requested) return 'edge';
133282
133342
  if ('chrome' === requested) return 'chrome';
133283
133343
  }
@@ -133520,7 +133580,7 @@ var __webpack_modules__ = {
133520
133580
  },
133521
133581
  "./package.json" (module) {
133522
133582
  "use strict";
133523
- module.exports = JSON.parse('{"rE":"3.5.0-next.21","El":{"@rspack/core":"^1.7.2","@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"}}');
133583
+ module.exports = JSON.parse('{"rE":"3.5.0-next.22","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"}}');
133524
133584
  }
133525
133585
  };
133526
133586
  var __webpack_module_cache__ = {};
package/package.json CHANGED
@@ -24,7 +24,7 @@
24
24
  "webpack/webpack-lib/build-dependencies.json"
25
25
  ],
26
26
  "name": "extension-develop",
27
- "version": "3.5.0-next.21",
27
+ "version": "3.5.0-next.22",
28
28
  "description": "Develop, build, preview, and package Extension.js projects.",
29
29
  "author": {
30
30
  "name": "Cezar Augusto",
@@ -72,7 +72,7 @@
72
72
  "edge-extension"
73
73
  ],
74
74
  "dependencies": {
75
- "@rspack/core": "^1.7.2",
75
+ "@rspack/core": "^1.7.5",
76
76
  "@rspack/dev-server": "^1.1.5",
77
77
  "@swc/core": "^1.15.8",
78
78
  "@swc/helpers": "^0.5.18",