extension-develop 4.1.34 → 4.1.35

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 (78) hide show
  1. package/dist/206~0.mjs +33 -0
  2. package/dist/363~0.mjs +1 -1
  3. package/dist/469~0.mjs +98 -16
  4. package/dist/519~0.mjs +12 -1
  5. package/dist/771~0.mjs +49 -8
  6. package/dist/832~0.mjs +127 -25
  7. package/dist/840~0.mjs +215 -54
  8. package/dist/846~0.mjs +16 -14
  9. package/dist/852~0.mjs +2 -0
  10. package/dist/88~0.mjs +10 -1
  11. package/dist/command-preview.d.ts +2 -0
  12. package/dist/contract/codes.json +9 -0
  13. package/dist/contracts-entry.d.ts +1 -1
  14. package/dist/contracts.mjs +109 -1
  15. package/dist/css-parse-guard-loader.mjs +7 -2
  16. package/dist/dev-server/control-bridge/log-rule.d.ts +38 -0
  17. package/dist/dev-server/control-bridge/logs-query.d.ts +2 -55
  18. package/dist/dev-server/control-bridge/producer-runtime.d.ts +1 -1
  19. package/dist/dev-server/html-refresh.d.ts +10 -0
  20. package/dist/dev-server/port-manager.d.ts +14 -0
  21. package/dist/dev-server/reserved-listen.d.ts +9 -0
  22. package/dist/dev-server/session-restart.d.ts +1 -1
  23. package/dist/dev-server~0.mjs +155 -30
  24. package/dist/extension-js-devtools/build-stamp.json +2 -2
  25. package/dist/extension-js-devtools/chrome/background/service_worker.js +2 -2
  26. package/dist/extension-js-devtools/chrome/pages/welcome.css +1 -1
  27. package/dist/extension-js-devtools/chromium/background/service_worker.js +2 -2
  28. package/dist/extension-js-devtools/chromium/pages/welcome.css +1 -1
  29. package/dist/extension-js-devtools/edge/background/service_worker.js +2 -2
  30. package/dist/extension-js-devtools/edge/pages/welcome.css +1 -1
  31. package/dist/extension-js-devtools/firefox/background/scripts.js +2 -2
  32. package/dist/extension-js-devtools/firefox/pages/welcome.css +1 -1
  33. package/dist/extension-js-theme/build-stamp.json +2 -2
  34. package/dist/feature-scripts-classic-concat-loader.js +45 -2
  35. package/dist/feature-scripts-classic-concat-loader.mjs +45 -2
  36. package/dist/feature-scripts-classic-traced-globals-loader.mjs +111 -0
  37. package/dist/feature-scripts-content-script-wrapper.js +10 -6
  38. package/dist/feature-scripts-content-script-wrapper.mjs +10 -6
  39. package/dist/lib/config-loader.d.ts +1 -0
  40. package/dist/lib/css-minimizer-options.d.ts +8 -0
  41. package/dist/lib/develop-context.d.ts +1 -1
  42. package/dist/lib/live-dev-session.d.ts +5 -0
  43. package/dist/lib/messages.d.ts +9 -1
  44. package/dist/lib/messaging.d.ts +2 -0
  45. package/dist/lib/package-manager.d.ts +7 -1
  46. package/dist/lib/paths.d.ts +1 -0
  47. package/dist/lib/project.d.ts +10 -2
  48. package/dist/lib/remote-archive.d.ts +11 -0
  49. package/dist/lib/rename-with-retry.d.ts +6 -0
  50. package/dist/lib/session-paths.d.ts +1 -0
  51. package/dist/lib/zip.d.ts +5 -1
  52. package/dist/plugin-browsers/index.d.ts +2 -0
  53. package/dist/plugin-css/css-in-content-script-loader.d.ts +1 -1
  54. package/dist/plugin-css/css-in-html-loader.d.ts +1 -1
  55. package/dist/plugin-css/css-lib/build-css-rules.d.ts +2 -1
  56. package/dist/plugin-css/css-lib/verbatim-css.d.ts +1 -0
  57. package/dist/plugin-js-frameworks/js-tools/typescript.d.ts +1 -0
  58. package/dist/plugin-playwright/index.d.ts +3 -0
  59. package/dist/plugin-special-folders/messages.d.ts +1 -0
  60. package/dist/plugin-special-folders/warn-upon-folder-changes.d.ts +1 -1
  61. package/dist/plugin-web-extension/feature-html/html-lib/options-dialog-floor.d.ts +7 -0
  62. package/dist/plugin-web-extension/feature-html/html-lib/patch-html.d.ts +3 -1
  63. package/dist/plugin-web-extension/feature-html/steps/update-html-file.d.ts +1 -0
  64. package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/dev-injected-hosts.d.ts +4 -1
  65. package/dist/plugin-web-extension/feature-scripts/messages.d.ts +1 -0
  66. package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/classic-concat-loader.d.ts +1 -0
  67. package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/content-script-wrapper.d.ts +1 -0
  68. package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/index.d.ts +1 -0
  69. package/dist/plugin-web-extension/feature-scripts/steps/classic-traced-globals-loader.d.ts +7 -0
  70. package/dist/plugin-web-extension/feature-scripts/steps/warn-unshipped-runtime-assets.d.ts +32 -0
  71. package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/messages.d.ts +1 -0
  72. package/dist/plugin-web-extension/shared/discover-runtime-surfaces.d.ts +2 -0
  73. package/dist/plugin-web-extension/shared/script-graph.d.ts +4 -0
  74. package/dist/rspack-config~0.mjs +799 -196
  75. package/dist/types.d.ts +7 -1
  76. package/dist/zip~0.mjs +14 -7
  77. package/package.json +3 -3
  78. package/dist/plugin-css/css-lib/is-content-script.d.ts +0 -2
package/dist/types.d.ts CHANGED
@@ -215,6 +215,12 @@ export interface DevOptions extends BrowserOptionsBase {
215
215
  }
216
216
  export interface BuildOptions {
217
217
  browser: BrowserOptionsBase['browser'];
218
+ /**
219
+ * Base folder for the build output, relative to the project root. The
220
+ * build writes `<outDir>/<browser>` instead of `dist/<browser>`, zip
221
+ * included, so it can run beside a dev session that serves `dist`.
222
+ */
223
+ outDir?: string;
218
224
  chromiumBinary?: ChromiumOptions['chromiumBinary'];
219
225
  geckoBinary?: GeckoOptions['geckoBinary'];
220
226
  firefoxBinary?: GeckoOptions['geckoBinary'];
@@ -505,7 +511,7 @@ export interface FileConfig {
505
511
  define?: Record<string, unknown>;
506
512
  folders?: SpecialFoldersConfig;
507
513
  };
508
- build?: Pick<BuildOptions, 'zipFilename' | 'zip' | 'zipSource' | 'polyfill' | 'silent' | 'addonLint' | 'minify' | 'safariBinary' | 'appName' | 'bundleId' | 'developmentTeam' | 'macOsOnly' | 'forceRegenerate'> & {
514
+ build?: Pick<BuildOptions, 'outDir' | 'zipFilename' | 'zip' | 'zipSource' | 'polyfill' | 'silent' | 'addonLint' | 'minify' | 'safariBinary' | 'appName' | 'bundleId' | 'developmentTeam' | 'macOsOnly' | 'forceRegenerate'> & {
509
515
  browser?: BrowserType;
510
516
  extensions?: CompanionExtensionsConfig;
511
517
  transpilePackages?: string[];
package/dist/zip~0.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
2
  import { unzipSync } from "fflate";
3
3
  import { sessionArtifactsRootDir } from "./771~0.mjs";
4
+ import { renameSyncWithRetry } from "./206~0.mjs";
4
5
  import { humanLine, CODES } from "./852~0.mjs";
5
- import { unpackagingExtension, notAZipArchive, remoteZipDamaged, failedToDownloadOrWriteZIPFileError, unpackagedSuccessfully, localZipNotFound, zipEntryOutsideFolder, downloadingText, localZipUnreadable, codedError, invalidRemoteZip, failedToWriteZIPFileError, remoteSourceDestinationTaken } from "./469~0.mjs";
6
+ import { unpackagingExtension, failedToDownloadOrWriteZIPFileError, remoteZipDamaged, localZipNotFound, unpackagedSuccessfully, codedError, downloadingText, failedToWriteZIPFileError, reusingDownloadedProject, remoteSourceDestinationTaken, notAZipArchive, remoteZipAccessRefused, localZipUnreadable, zipEntryOutsideFolder, tokenExpiry, invalidRemoteZip } from "./469~0.mjs";
6
7
  import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
7
8
  import * as __rspack_external_node_path_806ed179 from "node:path";
8
9
  function isZipBuffer(buffer) {
@@ -62,7 +63,7 @@ function moveSessionArtifacts(from, to) {
62
63
  __rspack_external_node_fs_1b05aee1.mkdirSync(__rspack_external_node_path_806ed179.dirname(target), {
63
64
  recursive: true
64
65
  });
65
- __rspack_external_node_fs_1b05aee1.renameSync(kept, target);
66
+ renameSyncWithRetry(kept, target);
66
67
  }
67
68
  function extractBuffer(entries, destinationPath) {
68
69
  humanLine(unpackagingExtension(destinationPath));
@@ -87,7 +88,7 @@ function extractBuffer(entries, destinationPath) {
87
88
  recursive: true
88
89
  });
89
90
  try {
90
- __rspack_external_node_fs_1b05aee1.renameSync(staging, root);
91
+ renameSyncWithRetry(staging, root);
91
92
  } catch {
92
93
  __rspack_external_node_fs_1b05aee1.cpSync(staging, root, {
93
94
  recursive: true
@@ -156,20 +157,26 @@ function assertDestinationIsOurs(destinationPath, source) {
156
157
  if (readRemoteSource(destinationPath) === sourceKey(source)) return;
157
158
  throw codedError(CODES.E_DESTINATION_NOT_EMPTY, remoteSourceDestinationTaken(destinationPath, source));
158
159
  }
159
- async function downloadAndExtractZip(url, targetPath) {
160
+ async function downloadAndExtractZip(url, targetPath, options = {}) {
160
161
  const urlNoSearchParams = url.split('?')[0];
162
+ const destinationPath = options.destination ?? remoteZipDestination(url, targetPath);
163
+ const source = options.reuse ? urlNoSearchParams : url;
161
164
  try {
162
- assertDestinationIsOurs(remoteZipDestination(url, targetPath), url);
165
+ assertDestinationIsOurs(destinationPath, source);
166
+ if (options.reuse && readRemoteSource(destinationPath) === sourceKey(source)) {
167
+ humanLine(reusingDownloadedProject(destinationPath, urlNoSearchParams));
168
+ return destinationPath;
169
+ }
163
170
  humanLine(downloadingText(urlNoSearchParams));
164
171
  const res = await fetch(url, {
165
172
  redirect: 'follow'
166
173
  });
174
+ if (401 === res.status || 403 === res.status) throw codedError(CODES.E_REMOTE_ACCESS_DENIED, remoteZipAccessRefused(urlNoSearchParams, res.status, tokenExpiry(url)));
167
175
  if (!res.ok || !res.body) throw new Error(`HTTP ${res.status} ${res.statusText}`);
168
176
  const contentType = String(res.headers.get('content-type') || '');
169
177
  const isZipExt = '.zip' === __rspack_external_node_path_806ed179.extname(urlNoSearchParams).toLowerCase();
170
178
  const isZipType = /zip|octet-stream/i.test(contentType);
171
179
  if (!isZipExt && !isZipType) throw codedError(CODES.E_REMOTE_ZIP_INVALID, invalidRemoteZip(urlNoSearchParams, contentType));
172
- const destinationPath = remoteZipDestination(url, targetPath);
173
180
  const arrayBuffer = await res.arrayBuffer();
174
181
  const zipBuffer = Buffer.from(arrayBuffer);
175
182
  if (!isZipBuffer(zipBuffer)) throw codedError(CODES.E_REMOTE_ZIP_INVALID, notAZipArchive(urlNoSearchParams, contentType));
@@ -177,7 +184,7 @@ async function downloadAndExtractZip(url, targetPath) {
177
184
  url: urlNoSearchParams
178
185
  }, entry)));
179
186
  extractBuffer(entries, destinationPath);
180
- writeRemoteSource(destinationPath, url);
187
+ writeRemoteSource(destinationPath, source);
181
188
  return destinationPath;
182
189
  } catch (error) {
183
190
  throw asZipError(error, CODES.E_REMOTE_DOWNLOAD, failedToDownloadOrWriteZIPFileError);
package/package.json CHANGED
@@ -48,7 +48,7 @@
48
48
  "runtime"
49
49
  ],
50
50
  "name": "extension-develop",
51
- "version": "4.1.34",
51
+ "version": "4.1.35",
52
52
  "description": "Develop, build, preview, and package Extension.js projects.",
53
53
  "author": {
54
54
  "name": "Cezar Augusto",
@@ -155,9 +155,9 @@
155
155
  "addons-linter": "10.12.0",
156
156
  "fast-check": "^4.10.0",
157
157
  "svelte": "5.55.9",
158
- "tsup": "^8.5.1",
158
+ "tsup": "^9.0.0",
159
159
  "typescript": "7.0.2",
160
- "vitest": "^5.0.0",
160
+ "vitest": "^5.0.5",
161
161
  "vue-style-loader": "4.1.3",
162
162
  "webpack": "^5.104.1"
163
163
  }
@@ -1,2 +0,0 @@
1
- import type { DevOptions } from '../../types.js';
2
- export declare function isContentScriptEntry(absolutePath: string, manifestPath: string, projectPath: string, browser?: DevOptions['browser']): boolean;