extension-develop 4.1.39 → 4.1.40-canary.458.001a6a0

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 (188) hide show
  1. package/README.md +7 -4
  2. package/dist/{771~0.mjs → 5h~0.mjs} +13 -3
  3. package/dist/{273~0.mjs → 6l~0.mjs} +1 -1
  4. package/dist/{524~0.mjs → 9~0.mjs} +18 -2
  5. package/dist/{640~0.mjs → bh~0.mjs} +6 -1
  6. package/dist/bridge.mjs +14 -8
  7. package/dist/b~0.mjs +8568 -0
  8. package/dist/command-dev.d.ts +2 -0
  9. package/dist/command-preview.d.ts +2 -0
  10. package/dist/contracts.mjs +2 -1
  11. package/dist/{469~0.mjs → cp~0.mjs} +30 -18
  12. package/dist/css-parse-guard-loader.mjs +2 -2
  13. package/dist/c~0.mjs +56 -0
  14. package/dist/dead-css-url-loader.mjs +20 -119
  15. package/dist/dev-server/control-bridge/actions-file.d.ts +7 -0
  16. package/dist/dev-server/control-bridge/broker.d.ts +42 -2
  17. package/dist/dev-server/control-bridge/consumer-client.d.ts +7 -0
  18. package/dist/dev-server/control-bridge/contracts.d.ts +29 -1
  19. package/dist/dev-server/control-bridge/logs-file.d.ts +6 -0
  20. package/dist/dev-server/control-bridge/loopback.d.ts +1 -0
  21. package/dist/dev-server/control-bridge/producer-runtime.d.ts +5 -2
  22. package/dist/dev-server/control-bridge/production-control.d.ts +1 -0
  23. package/dist/dev-server/control-bridge/session-token.d.ts +5 -2
  24. package/dist/dev-server/cors.d.ts +4 -2
  25. package/dist/dev-server/messages.d.ts +6 -0
  26. package/dist/dev-server/session-restart.d.ts +3 -1
  27. package/dist/dev-server~0.mjs +71 -129
  28. package/dist/df~0.mjs +197 -0
  29. package/dist/{846~0.mjs → d~0.mjs} +4 -3
  30. package/dist/ensure-hmr-for-scripts.js +3 -3
  31. package/dist/ensure-hmr-for-scripts.mjs +3 -3
  32. package/dist/extension-js-devtools/build-stamp.json +2 -2
  33. package/dist/extension-js-devtools/chrome/background/service_worker.js +2 -2
  34. package/dist/extension-js-devtools/chrome/pages/welcome.js +2 -2
  35. package/dist/extension-js-devtools/chromium/background/service_worker.js +2 -2
  36. package/dist/extension-js-devtools/chromium/pages/welcome.js +2 -2
  37. package/dist/extension-js-devtools/edge/background/service_worker.js +2 -2
  38. package/dist/extension-js-devtools/edge/pages/welcome.js +2 -2
  39. package/dist/extension-js-devtools/firefox/background/scripts.js +2 -2
  40. package/dist/extension-js-devtools/firefox/pages/welcome.js +2 -2
  41. package/dist/extension-js-theme/build-stamp.json +2 -2
  42. package/dist/{143~0.mjs → ey~0.mjs} +2 -2
  43. package/dist/e~0.mjs +33 -0
  44. package/dist/feature-scripts-classic-traced-globals-loader.mjs +7 -2
  45. package/dist/feature-scripts-content-script-wrapper.js +55 -17
  46. package/dist/feature-scripts-content-script-wrapper.mjs +55 -17
  47. package/dist/feature-scripts-native-geturl-import-loader.mjs +1 -1
  48. package/dist/{105~0.mjs → g0~0.mjs} +1 -1
  49. package/dist/{88~0.mjs → j6~0.mjs} +9 -1
  50. package/dist/{731~0.mjs → j~0.mjs} +2 -2
  51. package/dist/{712~0.mjs → ka~0.mjs} +18 -2
  52. package/dist/{852~0.mjs → k~0.mjs} +4 -2
  53. package/dist/late-css-import-loader.mjs +1 -1
  54. package/dist/lib/addon-lint.d.ts +6 -0
  55. package/dist/lib/build-summary.d.ts +6 -0
  56. package/dist/lib/dev-additions.d.ts +12 -0
  57. package/dist/lib/extension-base-from-stack.d.ts +16 -0
  58. package/dist/lib/localized-manifest-name.d.ts +9 -0
  59. package/dist/lib/messages.d.ts +5 -2
  60. package/dist/lib/process-started-at.d.ts +1 -0
  61. package/dist/lib/real-path.d.ts +8 -0
  62. package/dist/lib/resource-path.d.ts +1 -0
  63. package/dist/lib/session-paths.d.ts +2 -0
  64. package/dist/lib/split-chunks.d.ts +2 -1
  65. package/dist/lib/stats-handler.d.ts +1 -0
  66. package/dist/lib/tsconfig-includes-file.d.ts +1 -0
  67. package/dist/l~0.mjs +2290 -0
  68. package/dist/main-world-bridge.js +92 -23
  69. package/dist/main-world-bridge.mjs +92 -23
  70. package/dist/manifest-entry.d.ts +2 -0
  71. package/dist/manifest.mjs +3 -1
  72. package/dist/module.mjs +3 -3
  73. package/dist/{832~0.mjs → m~0.mjs} +2242 -286
  74. package/dist/o~0.mjs +47 -0
  75. package/dist/plugin-browsers/index.d.ts +7 -0
  76. package/dist/plugin-browsers/safari-dev-plugin.d.ts +2 -0
  77. package/dist/plugin-compatibility/compatibility-lib/messages.d.ts +1 -1
  78. package/dist/plugin-compatibility/compatibility-lib/native-browser-namespace.d.ts +5 -0
  79. package/dist/plugin-compatibility/feature-browser-global.d.ts +4 -0
  80. package/dist/plugin-compilation/compilation-lib/messages.d.ts +4 -1
  81. package/dist/plugin-compilation/env.d.ts +1 -0
  82. package/dist/plugin-compilation/index.d.ts +2 -0
  83. package/dist/plugin-compilation/node-builtins.d.ts +5 -0
  84. package/dist/plugin-compilation/one-diagnostic-per-location.d.ts +13 -0
  85. package/dist/plugin-compilation/resolve-file-requests.d.ts +16 -0
  86. package/dist/plugin-compilation/warm-ancestor-watchers.d.ts +19 -0
  87. package/dist/plugin-compilation/watch-real-project-path.d.ts +27 -0
  88. package/dist/plugin-compilation/zip.d.ts +2 -0
  89. package/dist/plugin-css/css-in-content-script-loader.d.ts +1 -1
  90. package/dist/plugin-css/css-lib/build-css-rules.d.ts +3 -0
  91. package/dist/plugin-css/css-lib/inline-content-script-css.d.ts +3 -1
  92. package/dist/plugin-css/css-lib/messages.d.ts +4 -0
  93. package/dist/plugin-css/css-lib/sfc-style-block.d.ts +26 -0
  94. package/dist/plugin-css/css-lib/unplaced-style-imports.d.ts +7 -0
  95. package/dist/plugin-css/css-lib/verbatim-css.d.ts +1 -0
  96. package/dist/plugin-css/dead-css-url-loader.d.ts +9 -1
  97. package/dist/plugin-css/index.d.ts +1 -0
  98. package/dist/plugin-css/sfc-style-block-loader.d.ts +18 -0
  99. package/dist/plugin-css/unplaced-style-import-loader.d.ts +16 -0
  100. package/dist/plugin-playwright/index.d.ts +22 -0
  101. package/dist/plugin-reload/classify-reload.d.ts +20 -0
  102. package/dist/plugin-reload/index.d.ts +4 -2
  103. package/dist/plugin-reload/messages.d.ts +1 -0
  104. package/dist/plugin-reload/reload-dispatch.d.ts +21 -2
  105. package/dist/plugin-reload/reload-lib/dev-content-scripts.d.ts +6 -0
  106. package/dist/plugin-reload/reload-lib/scripts-replay-shim.d.ts +1 -1
  107. package/dist/plugin-reload/steps/inject-bridge-producer.d.ts +6 -0
  108. package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/ChunkLoader.d.ts +3 -0
  109. package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/RuntimeModules/AutoPublicPath.d.ts +1 -1
  110. package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/RuntimeModules/BaseUri.d.ts +1 -1
  111. package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/RuntimeModules/LoadScript.d.ts +1 -1
  112. package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/RuntimeModules/PublicPath.d.ts +1 -1
  113. package/dist/plugin-special-folders/get-data.d.ts +2 -0
  114. package/dist/plugin-special-folders/hint-import-only-scripts.d.ts +4 -0
  115. package/dist/plugin-special-folders/include-files.d.ts +2 -0
  116. package/dist/plugin-special-folders/messages.d.ts +1 -0
  117. package/dist/plugin-web-extension/feature-html/html-lib/inject.d.ts +1 -1
  118. package/dist/plugin-web-extension/feature-html/html-lib/patch-html.d.ts +1 -0
  119. package/dist/plugin-web-extension/feature-html/steps/update-html-file.d.ts +1 -0
  120. package/dist/plugin-web-extension/feature-manifest/manifest-lib/filter-keys-gecko.d.ts +21 -0
  121. package/dist/plugin-web-extension/feature-manifest/manifest-lib/filter-keys-safari.d.ts +1 -1
  122. package/dist/plugin-web-extension/feature-manifest/manifest-lib/webkit-unsupported-keys.d.ts +15 -0
  123. package/dist/plugin-web-extension/feature-manifest/messages.d.ts +7 -0
  124. package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/dev-additions.d.ts +8 -0
  125. package/dist/plugin-web-extension/feature-manifest/steps/warn-description-length.d.ts +25 -0
  126. package/dist/plugin-web-extension/feature-manifest/steps/warn-gecko-unsupported-apis.d.ts +2 -2
  127. package/dist/plugin-web-extension/feature-scripts/contracts.d.ts +3 -0
  128. package/dist/plugin-web-extension/feature-scripts/index.d.ts +1 -0
  129. package/dist/plugin-web-extension/feature-scripts/messages.d.ts +9 -0
  130. package/dist/plugin-web-extension/feature-scripts/scripts-lib/completion-value.d.ts +13 -0
  131. package/dist/plugin-web-extension/feature-scripts/scripts-lib/injected-sheet-urls.d.ts +5 -0
  132. package/dist/plugin-web-extension/feature-scripts/scripts-lib/main-world-bridge-pairing.d.ts +5 -0
  133. package/dist/plugin-web-extension/feature-scripts/scripts-lib/main-world-copy-routing.d.ts +2 -0
  134. package/dist/plugin-web-extension/feature-scripts/scripts-lib/registration-worlds.d.ts +10 -0
  135. package/dist/plugin-web-extension/feature-scripts/scripts-lib/runtime-main-world-scripts.d.ts +25 -2
  136. package/dist/plugin-web-extension/feature-scripts/scripts-lib/runtime-script-sheet.d.ts +14 -0
  137. package/dist/plugin-web-extension/feature-scripts/scripts-lib/taken-extension-base.d.ts +10 -0
  138. package/dist/plugin-web-extension/feature-scripts/steps/add-base-uri-runtime-module.d.ts +7 -1
  139. package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/content-script-wrapper.d.ts +2 -0
  140. package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/index.d.ts +2 -0
  141. package/dist/plugin-web-extension/feature-scripts/steps/add-public-path-runtime-module.d.ts +6 -0
  142. package/dist/plugin-web-extension/feature-scripts/steps/classic-traced-globals-loader.d.ts +1 -0
  143. package/dist/plugin-web-extension/feature-scripts/steps/compile-main-world-scripts.d.ts +4 -0
  144. package/dist/plugin-web-extension/feature-scripts/steps/keep-completion-value.d.ts +6 -0
  145. package/dist/plugin-web-extension/feature-scripts/steps/pair-runtime-main-world-bridges.d.ts +12 -0
  146. package/dist/plugin-web-extension/feature-scripts/steps/place-runtime-script-sheets.d.ts +12 -0
  147. package/dist/plugin-web-extension/feature-scripts/steps/prune-main-world-bridges.d.ts +1 -0
  148. package/dist/plugin-web-extension/feature-scripts/steps/root-injected-sheet-urls.d.ts +9 -0
  149. package/dist/plugin-web-extension/feature-scripts/steps/route-main-world-copies.d.ts +10 -0
  150. package/dist/plugin-web-extension/feature-scripts/steps/source-literals.d.ts +24 -0
  151. package/dist/plugin-web-extension/feature-scripts/steps/take-extension-base.d.ts +11 -0
  152. package/dist/plugin-web-extension/feature-scripts/steps/trace-runtime-loaded-files.d.ts +18 -3
  153. package/dist/plugin-web-extension/feature-scripts/steps/warn-main-world-registration-changed.d.ts +12 -0
  154. package/dist/plugin-web-extension/feature-scripts/steps/warn-moved-page-relative-urls.d.ts +30 -0
  155. package/dist/plugin-web-extension/feature-scripts/steps/warn-page-relative-script-path.d.ts +10 -0
  156. package/dist/plugin-web-extension/feature-scripts/steps/warn-unknown-registration-world.d.ts +10 -0
  157. package/dist/plugin-web-extension/feature-web-resources/collect-entry-imports.d.ts +1 -0
  158. package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/messages.d.ts +1 -0
  159. package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/page-requests.d.ts +5 -0
  160. package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/resolve-war.d.ts +1 -0
  161. package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/unreachable-resources.d.ts +1 -0
  162. package/dist/plugin-web-extension/shared/script-graph.d.ts +12 -0
  163. package/dist/preprocessor-passthrough-loader.mjs +1 -1
  164. package/dist/preview.mjs +1 -1
  165. package/dist/public-css-url-loader.mjs +1 -1
  166. package/dist/{331~0.mjs → q~0.mjs} +2 -2
  167. package/dist/rj~0.mjs +125 -0
  168. package/dist/{519~0.mjs → rl~0.mjs} +53 -3
  169. package/dist/rspack-config~0.mjs +2768 -3256
  170. package/dist/{177~0.mjs → r~0.mjs} +2 -2
  171. package/dist/sfc-style-block-loader.mjs +49 -0
  172. package/dist/stats-handler~0.mjs +15 -7
  173. package/dist/tm~0.mjs +71 -0
  174. package/dist/types.d.ts +43 -3
  175. package/dist/{285~0.mjs → t~0.mjs} +41 -26
  176. package/dist/unplaced-style-import-loader.mjs +131 -0
  177. package/dist/x~0.mjs +3 -0
  178. package/dist/y~0.mjs +234 -0
  179. package/dist/zip~0.mjs +5 -4
  180. package/dist/{363~0.mjs → z~0.mjs} +360 -267
  181. package/package.json +5 -5
  182. package/dist/527~0.mjs +0 -3
  183. package/dist/840~0.mjs +0 -5635
  184. /package/dist/{895~0.mjs → 3~0.mjs} +0 -0
  185. /package/dist/{374~0.mjs → 5~0.mjs} +0 -0
  186. /package/dist/{206~0.mjs → 6~0.mjs} +0 -0
  187. /package/dist/{471~0.mjs → g~0.mjs} +0 -0
  188. /package/dist/{117~0.mjs → w~0.mjs} +0 -0
@@ -1,6 +1,8 @@
1
1
  import { type BrowserLauncherFn, BuildEmitter } from './plugin-browsers/index.js';
2
2
  import type { DevOptions } from './types.js';
3
3
  export declare function extensionDev(pathOrRemoteUrl: string | undefined, devOptions: DevOptions & {
4
+ onReady?: () => void;
4
5
  launcher?: BrowserLauncherFn;
5
6
  onSessionStart?: () => void;
7
+ onExitError?: (error: unknown, code?: string) => void;
6
8
  }): Promise<BuildEmitter>;
@@ -7,6 +7,7 @@ import type { PreviewOptions } from './types.js';
7
7
  export interface ResolvedPreviewOptions {
8
8
  browser: string;
9
9
  outPath: string;
10
+ shippedPath?: string;
10
11
  contextDir: string;
11
12
  readyPath: string;
12
13
  extensionsToLoad: string[];
@@ -45,6 +46,7 @@ export interface PreviewBrowserSession {
45
46
  export type PreviewLauncherFn = (opts: ResolvedPreviewOptions) => Promise<PreviewBrowserSession> | Promise<void>;
46
47
  export declare function explicitUnpackedDir(pathOrRemoteUrl: string | undefined, packageJsonDir: string, manifestDir?: string): string | undefined;
47
48
  export declare function previewArchiveTarget(metadataCommand: 'start' | 'preview', outputPath?: string): RemoteArchiveTarget | undefined;
49
+ export declare const EXECUTOR_ATTACH_WAIT_MS = 10000;
48
50
  export declare function extensionPreview(pathOrRemoteUrl: string | undefined, previewOptions: PreviewOptions, browserLauncher?: PreviewLauncherFn): Promise<{
49
51
  warnings: string[];
50
52
  }>;
@@ -24,6 +24,7 @@ const CONTROL_WS_PATH = '/extjs-control';
24
24
  const CLOSE_BAD_INSTANCE = 4001;
25
25
  const CLOSE_BAD_HELLO = 4002;
26
26
  const CLOSE_CONTROL_UNAVAILABLE = 4003;
27
+ const CLOSE_TOKEN_REQUIRED = 4004;
27
28
  const CLOSE_SLOW_CONSUMER = 4008;
28
29
  const LOG_LEVEL_ORDER = [
29
30
  'error',
@@ -133,4 +134,4 @@ function matchesLogQuery(event, query) {
133
134
  if (null != tabId && event.tabId !== tabId) return false;
134
135
  return true;
135
136
  }
136
- export { CLOSE_BAD_HELLO, CLOSE_BAD_INSTANCE, CLOSE_CONTROL_UNAVAILABLE, CLOSE_SLOW_CONSUMER, CONTROL_ENVELOPE_VERSION, CONTROL_WS_PATH, LOG_CONTEXTS, LOG_EVENT_VERSION, LOG_LEVEL_FILTERS, LOG_LEVEL_ORDER, REFUSAL_API_UNAVAILABLE, REFUSAL_NEEDS_HEADED_WINDOW, REFUSAL_NEEDS_USER_GESTURE, REFUSAL_SURFACE_NOT_DECLARED, REFUSAL_SURFACE_NOT_OPEN, REFUSAL_SURFACE_REPLY_FAILED, REFUSAL_TAB_NOT_FOUND, REFUSAL_URL_REFUSED, isAfterSince, logLevelRank, logQueryProblem, matchesLogQuery, parseLogLevelFilter, parseLogSince, unknownLogContexts };
137
+ export { CLOSE_BAD_HELLO, CLOSE_BAD_INSTANCE, CLOSE_CONTROL_UNAVAILABLE, CLOSE_SLOW_CONSUMER, CLOSE_TOKEN_REQUIRED, CONTROL_ENVELOPE_VERSION, CONTROL_WS_PATH, LOG_CONTEXTS, LOG_EVENT_VERSION, LOG_LEVEL_FILTERS, LOG_LEVEL_ORDER, REFUSAL_API_UNAVAILABLE, REFUSAL_NEEDS_HEADED_WINDOW, REFUSAL_NEEDS_USER_GESTURE, REFUSAL_SURFACE_NOT_DECLARED, REFUSAL_SURFACE_NOT_OPEN, REFUSAL_SURFACE_REPLY_FAILED, REFUSAL_TAB_NOT_FOUND, REFUSAL_URL_REFUSED, isAfterSince, logLevelRank, logQueryProblem, matchesLogQuery, parseLogLevelFilter, parseLogSince, unknownLogContexts };
@@ -1,9 +1,10 @@
1
1
  import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
- import pintor from "pintor";
2
+ import pintor, { supportsColor } from "pintor";
3
3
  import { createHash } from "node:crypto";
4
- import { findNearestDenoConfigSync, validateDenoConfig, PROJECT_MANIFEST_FILENAMES, readProjectDependencies } from "./731~0.mjs";
5
- import { stripChannelPrefix, artifactNoun, prefix as messaging_prefix, CODES, humanLine, fmt, isDebug, hasChannelPrefix } from "./852~0.mjs";
6
- import { parseJsonSafe } from "./374~0.mjs";
4
+ import { findNearestDenoConfigSync, validateDenoConfig, PROJECT_MANIFEST_FILENAMES, readProjectDependencies } from "./j~0.mjs";
5
+ import { stripChannelPrefix, artifactNoun, prefix as messaging_prefix, CODES, humanLine, fmt, isDebug, hasChannelPrefix } from "./k~0.mjs";
6
+ import { parseJsonSafe } from "./5~0.mjs";
7
+ import { codedError, real_path_isInsidePath } from "./tm~0.mjs";
7
8
  import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
8
9
  import * as __rspack_external_node_os_4f3c9d58 from "node:os";
9
10
  import * as __rspack_external_node_path_806ed179 from "node:path";
@@ -319,6 +320,11 @@ function anotherDevSessionActive(browser, pid, runId) {
319
320
  function buildOutDirInvalid(value) {
320
321
  return `${getLoggingPrefix('error')} ${fmt.code('--out-dir')} needs a folder path other than the project root, got ${fmt.code(value || '(empty)')}.\nPass a folder such as ${fmt.code('--out-dir build')}, and the build writes ${fmt.code('build/<browser>')}.`;
321
322
  }
323
+ function buildZipDirInvalid(value, reason, resolved) {
324
+ const why = 'empty' === reason ? `needs a folder path, got ${fmt.code(value || '(empty)')}` : 'outside' === reason ? `got ${fmt.code(value)}, a relative path that leaves the project` : `got ${fmt.code(value)}, a folder inside the build output, which ships whole`;
325
+ const fix = 'outside' === reason ? `Pass a folder inside the project such as ${fmt.code('--zip-dir release')}, or the absolute path ${fmt.code(String(resolved))} to write there on purpose.` : `Pass a folder such as ${fmt.code('--zip-dir release')}, and the archive is written as ${fmt.code('release/<name>-<browser>.zip')}.`;
326
+ return `${getLoggingPrefix('error')} ${fmt.code('--zip-dir')} ${why}.\n${fix}`;
327
+ }
322
328
  function productionLoopbackOrigins(origins) {
323
329
  const list = origins.map((origin)=>` ${fmt.code(origin.pattern)} in ${origin.where}`).join('\n');
324
330
  return `${getLoggingPrefix('warn')} The production manifest reaches the local machine:\n${list}\nStore reviewers read a loopback origin as host access with no purpose in a published extension. Keep it to development with an ${fmt.code('$EXTENSION_PUBLIC_*')} placeholder in the manifest and its value in ${fmt.code('.env.development')}.`;
@@ -347,10 +353,11 @@ function buildAssetsTree(stats, outputFiles) {
347
353
  const noun = folded.sourceMapsOnly ? 'source map' : 'file';
348
354
  return tree + pintor.gray(`+ ${pluralize(folded.count, noun)} not shown (${getFileSize(folded.bytes)})`) + '\n';
349
355
  }
350
- function buildComplete(browser, distDisplayPath, totalBytes, mode) {
356
+ function buildComplete(browser, distDisplayPath, totalBytes, mode, sourceMapBytes) {
351
357
  const noun = artifactNoun(String(browser));
352
358
  const builtFor = 'development' === mode ? 'built for development in' : 'none' === mode ? 'built in' : 'built for production in';
353
- const size = 'number' == typeof totalBytes && totalBytes > 0 ? ` (${getHumanSize(totalBytes)})` : '';
359
+ const maps = 'number' == typeof sourceMapBytes && sourceMapBytes > 0 ? `, plus ${getHumanSize(sourceMapBytes)} of source maps left out of the zip` : '';
360
+ const size = 'number' == typeof totalBytes && totalBytes > 0 ? ` (${getHumanSize(totalBytes)}${maps})` : '';
354
361
  return `${getLoggingPrefix('success')} ${noun} ${builtFor} ${pintor.underline(distDisplayPath)}${size}.`;
355
362
  }
356
363
  function buildToolchain(toolchain) {
@@ -384,6 +391,15 @@ function addonLintDependencyAttribution(packages, onlyDependencies) {
384
391
  function addonLintUnsupportedApiFix(browser) {
385
392
  return `- this names a browser API, so it is your code, not a library's: guard it with a build-time check of process.env.EXTENSION_PUBLIC_BROWSER (return early when it reads "${browser}") and the production build drops the branch from the ${browser} bundle`;
386
393
  }
394
+ function addonLintFileTooLargeFix(limitMb, singleFileSurface) {
395
+ const limit = `addons.mozilla.org does not parse a file of ${limitMb} MB or more`;
396
+ const article = /^[aeiou]/i.test(singleFileSurface || '') ? 'an' : 'a';
397
+ return singleFileSurface ? `- ${limit}, and Firefox loads ${article} ${singleFileSurface} as one file, so the build cannot split it: load a large dependency with a dynamic import() so it ships as its own file under the limit, or remove it` : `- ${limit}: split the largest module or data in this file into parts under the limit`;
398
+ }
399
+ function fileTooLargeForStore(file, bytes, fix) {
400
+ const size = `${(bytes / 1048576).toFixed(1)} MB`;
401
+ return `${getLoggingPrefix('warn')} Firefox build: ${pintor.underline(file)} is ${size} ${pintor.gray(fix)}`;
402
+ }
387
403
  function addonLintReviewerNote(noteDisplay) {
388
404
  return `${getLoggingPrefix('info')} Notes to reviewer for addons.mozilla.org are at ${pintor.underline(noteDisplay)} (paste its bundled libraries section into the submission, the author findings are yours to fix)`;
389
405
  }
@@ -408,8 +424,11 @@ function buildFailed(errorCount) {
408
424
  function stripModuleWarningWrapper(message) {
409
425
  return message.replace(/^Module (?:Warning|Error) \(from [^)]*\):\s*/, '');
410
426
  }
427
+ const ANSI_CODES = /\u001b\[[0-9;]*m/g;
428
+ const WARNING_HEAD_MARKER = /^\s*(?:\u001b\[[0-9;]*m)*⚠\s*(?:\u001b\[[0-9;]*m)*\s?/;
411
429
  function stripBundlerDecoration(message) {
412
- return message.replace(/\r/g, '').split('\n').map((line, index)=>0 === index ? line.replace(/^\s*⚠ ?/, '') : line.replace(/^\s*│ ?/, '')).join('\n').trim();
430
+ const text = supportsColor(process.stdout) ? message : message.replace(ANSI_CODES, '');
431
+ return text.replace(/\r/g, '').split('\n').map((line, index)=>0 === index ? line.replace(WARNING_HEAD_MARKER, '') : line.replace(/^\s*│ ?/, '')).join('\n').trim();
413
432
  }
414
433
  function cleanWarningText(message) {
415
434
  return stripModuleWarningWrapper(stripBundlerDecoration(message));
@@ -710,7 +729,8 @@ function debugOutputPath(pathValue) {
710
729
  function previewingCustomOutput(browser, outputPath, distPath) {
711
730
  return `${getLoggingPrefix('info')} Previewing ${String(browser)} from ${outputPath}.\nThis is not the build folder ${distPath}. The run record describes the folder loaded.`;
712
731
  }
713
- function productionControlOpen(browser, controlledPath, distPath, allowEval) {
732
+ function productionControlOpen(browser, controlledPath, distPath, allowEval, hasBackground = true) {
733
+ if (!hasBackground) return `${getLoggingPrefix('warn')} Control channel open for the ${String(browser)} production build, but this build has no background, so nothing in it can connect and every act verb will be refused.\nAdd a background script or service worker to the manifest and build again. The browser loads ${controlledPath}, a copy of ${distPath}. ${distPath} is unchanged.`;
714
734
  return `${getLoggingPrefix('info')} Control channel open for the ${String(browser)} production build (${allowEval ? 'eval, ' : ''}storage, reload, open).\nThe browser loads ${controlledPath}, a copy of ${distPath} with the control producer prepended to the background. ${distPath} is unchanged.`;
715
735
  }
716
736
  function debugPreviewOutput(outputPath, distPath) {
@@ -777,11 +797,6 @@ function managedDependencyCopyWarning(duplicates, configPath) {
777
797
  const list = duplicates.map((d)=>`- ${pintor.yellow(d.name)} (Extension.js ships ${d.shipped})`).join('\n');
778
798
  return `${getLoggingPrefix('warn')} ${pintor.blue(__rspack_external_node_path_806ed179.basename(configPath))} loads its own copy of ${1 === duplicates.length ? 'a package' : 'packages'} Extension.js already ships.\n${list}\n${fmt.label('PATH')} ${fmt.val(configPath)}\nBoth copies take part in one build, and when their versions differ the build can break or behave differently.\nThe build goes on. If it misbehaves, install the version shown or drop the import.`;
779
799
  }
780
- function codedError(code, message) {
781
- const error = new Error(message);
782
- error.code = code;
783
- return error;
784
- }
785
800
  function isUrlShaped(target) {
786
801
  return /^(?:\.[\\/])?[a-z][a-z0-9+.-]+:[\\/]+/i.test(target);
787
802
  }
@@ -1197,10 +1212,7 @@ function resolveProjectStructureSync(projectPath, options = {}) {
1197
1212
  const log = (line)=>{
1198
1213
  if (!options.quiet) humanLine(line);
1199
1214
  };
1200
- const isUnderDir = (baseDir, candidatePath)=>{
1201
- const rel = __rspack_external_node_path_806ed179.relative(baseDir, candidatePath);
1202
- return Boolean(rel && !rel.startsWith('..') && !__rspack_external_node_path_806ed179.isAbsolute(rel));
1203
- };
1215
+ const isUnderDir = (baseDir, candidatePath)=>real_path_isInsidePath(baseDir, candidatePath);
1204
1216
  const packageJsonPathFromProject = findNearestPackageJsonSync(__rspack_external_node_path_806ed179.join(projectPath, 'manifest.json'));
1205
1217
  const denoJsonPathFromProject = findNearestDenoConfigSync(__rspack_external_node_path_806ed179.join(projectPath, 'manifest.json'));
1206
1218
  const packageJsonDirFromProject = packageJsonPathFromProject ? __rspack_external_node_path_806ed179.dirname(packageJsonPathFromProject) : denoJsonPathFromProject ? __rspack_external_node_path_806ed179.dirname(denoJsonPathFromProject) : void 0;
@@ -1311,4 +1323,4 @@ function resolveProjectStructureSync(projectPath, options = {}) {
1311
1323
  } : {}
1312
1324
  };
1313
1325
  }
1314
- export { addonLintDependencyAttribution, addonLintFailed, addonLintFailedDebug, addonLintFinding, addonLintMore, addonLintNotInstalled, addonLintReviewerNote, addonLintSummary, addonLintUnsupportedApiFix, anotherDevSessionActive, anotherDevSessionRefused, asAbsolute, authorInstallNotice, browserLaunchFailed, buildAssetsTree, buildCommandFailed, buildComplete, buildFailed, buildOutDirInvalid, buildSharesDevDist, buildToolchain, buildWarningsDetails, codedError, collapseHomeDir, computePreviewOutputPath, configBrowserOrThrow, configLoadingError, configResolvedChangeIgnored, configUnknownKeys, configWrongShape, debugBrowser, debugContextPath, debugDirs, debugExtensionsToLoad, debugOutputPath, debugPreviewOutput, debugSplitChunksNarrowed, devCommandFailed, developmentArtifactsKept, devtoolsEngineFor, displayPath, downloadingText, duplicateOutputFiles, extensionLoadRecovered, extensionLoadStillRefused, failedToDownloadOrWriteZIPFileError, failedToWriteZIPFileError, getBuildDistPath, getDirs, getDistPath, getProjectStructure, invalidRemoteZip, isUsingExperimentalConfig, listOutputFiles, localZipNotFound, localZipUnreadable, managedDependencyCopyWarning, manifestInvalidJson, needsInstall, noCompanionExtensionsResolved, normalizeBrowser, notAZipArchive, operaBuildUnminified, packagingDistributionFiles, packagingSourceFiles, previewHasNothingToRun, previewing, previewingCustomOutput, previewingSourceFallback, productionControlOpen, productionLoopbackOrigins, productionLoopbackOriginsText, projectInstallFallbackToNpm, projectInstallInWorkspaceRoot, projectInstallScriptsDisabled, relativeToDir, remoteArchiveCacheRoot, remoteSourceDestinationTaken, remoteZipAccessRefused, remoteZipDamaged, resolveProjectStructureSync, reusingDownloadedProject, runtimeChunkKeptInline, safariAppIconNotFound, safariBuildOutputNotFound, safariInvalidBundleId, sessionStateIgnoreAdded, starting, toPosixPath, tokenExpiry, treeWithDistFilesBrowser, treeWithSourceAndDistFiles, treeWithSourceFiles, unpackagedSuccessfully, unpackagingExtension, updatingTypeDefinitions, writingTypeDefinitions, writingTypeDefinitionsError, zipArtifactNotCreated, zipArtifactReady, zipEdgeKeyDropped, zipEntryOutsideFolder, zipSkippedSymlinks };
1326
+ export { addonLintDependencyAttribution, addonLintFailed, addonLintFailedDebug, addonLintFileTooLargeFix, addonLintFinding, addonLintMore, addonLintNotInstalled, addonLintReviewerNote, addonLintSummary, addonLintUnsupportedApiFix, anotherDevSessionActive, anotherDevSessionRefused, asAbsolute, authorInstallNotice, browserLaunchFailed, buildAssetsTree, buildCommandFailed, buildComplete, buildFailed, buildOutDirInvalid, buildSharesDevDist, buildToolchain, buildWarningsDetails, buildZipDirInvalid, collapseHomeDir, computePreviewOutputPath, configBrowserOrThrow, configLoadingError, configResolvedChangeIgnored, configUnknownKeys, configWrongShape, debugBrowser, debugContextPath, debugDirs, debugExtensionsToLoad, debugOutputPath, debugPreviewOutput, debugSplitChunksNarrowed, devCommandFailed, developmentArtifactsKept, devtoolsEngineFor, displayPath, downloadingText, duplicateOutputFiles, extensionLoadRecovered, extensionLoadStillRefused, failedToDownloadOrWriteZIPFileError, failedToWriteZIPFileError, fileTooLargeForStore, getBuildDistPath, getDirs, getDistPath, getProjectStructure, invalidRemoteZip, isUsingExperimentalConfig, listOutputFiles, localZipNotFound, localZipUnreadable, managedDependencyCopyWarning, manifestInvalidJson, needsInstall, noCompanionExtensionsResolved, normalizeBrowser, notAZipArchive, operaBuildUnminified, packagingDistributionFiles, packagingSourceFiles, previewHasNothingToRun, previewing, previewingCustomOutput, previewingSourceFallback, productionControlOpen, productionLoopbackOrigins, productionLoopbackOriginsText, projectInstallFallbackToNpm, projectInstallInWorkspaceRoot, projectInstallScriptsDisabled, relativeToDir, remoteArchiveCacheRoot, remoteSourceDestinationTaken, remoteZipAccessRefused, remoteZipDamaged, resolveProjectStructureSync, reusingDownloadedProject, runtimeChunkKeptInline, safariAppIconNotFound, safariBuildOutputNotFound, safariInvalidBundleId, sessionStateIgnoreAdded, starting, toPosixPath, tokenExpiry, treeWithDistFilesBrowser, treeWithSourceAndDistFiles, treeWithSourceFiles, unpackagedSuccessfully, unpackagingExtension, updatingTypeDefinitions, writingTypeDefinitions, writingTypeDefinitionsError, zipArtifactNotCreated, zipArtifactReady, zipEdgeKeyDropped, zipEntryOutsideFolder, zipSkippedSymlinks };
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
2
  import postcss from "postcss";
3
- import { cssParseErrorShippedVerbatim } from "./524~0.mjs";
4
- import { verbatimCssModulePlaceholder, verbatimCssPlaceholder, registerVerbatimCss } from "./88~0.mjs";
3
+ import { cssParseErrorShippedVerbatim } from "./9~0.mjs";
4
+ import { verbatimCssModulePlaceholder, verbatimCssPlaceholder, registerVerbatimCss } from "./j6~0.mjs";
5
5
  import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
6
6
  function cssParseGuardLoader(source) {
7
7
  return source;
package/dist/c~0.mjs ADDED
@@ -0,0 +1,56 @@
1
+ import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
+ import { createHash } from "node:crypto";
3
+ import { isGeckoBasedBrowser, isWebkitBasedBrowser } from "./q~0.mjs";
4
+ const EXTENSION_BASE_FROM_STACK = '(function(){try{var m=String(new Error().stack||"").match(/[a-z-]+-extension:\\/\\/[^\\/\\s)]+\\//);return m?m[0]:""}catch(_){return ""}})()';
5
+ const EXTENSION_BASE_GLOBAL = '__EXTJS_EXTENSION_BASE__';
6
+ const EXTENSION_BASE_ATTRIBUTE = 'data-extjs-extension-base';
7
+ const TAKEN_EXTENSION_BASE = '__extjsTakenBase';
8
+ function extensionBaseFromFile(gecko) {
9
+ if (!gecko) return EXTENSION_BASE_FROM_STACK;
10
+ return `((typeof ${TAKEN_EXTENSION_BASE} === "string" && ${TAKEN_EXTENSION_BASE}) || ${EXTENSION_BASE_FROM_STACK})`;
11
+ }
12
+ function closedOnSlash(name) {
13
+ return `(${name}[${name}.length - 1] === "/" ? ${name} : ${name} + "/")`;
14
+ }
15
+ const GECKO_EXTENSION_SCHEME = 'moz-extension';
16
+ const CHROMIUM_EXTENSION_SCHEME = 'chrome-extension';
17
+ const WEBKIT_EXTENSION_SCHEME = 'safari-web-extension';
18
+ function extensionSchemeFor(browser) {
19
+ if (isGeckoBasedBrowser(browser)) return GECKO_EXTENSION_SCHEME;
20
+ if (isWebkitBasedBrowser(browser)) return WEBKIT_EXTENSION_SCHEME;
21
+ return CHROMIUM_EXTENSION_SCHEME;
22
+ }
23
+ function unlessExtensionAddress(name, scheme = GECKO_EXTENSION_SCHEME) {
24
+ const from = JSON.stringify(`${scheme}://`);
25
+ const to = JSON.stringify(`${scheme}:/0`);
26
+ return `if (typeof ${name} !== "string" || ${name} < ${from} || ${name} >= ${to}) ${name} = "";`;
27
+ }
28
+ const KEYED_GLOBAL = /^__EXTJS_EXTENSION_BASE_(?:[0-9a-f]{8}_)?_/;
29
+ const GLOBAL_KEY = /^__EXTJS_EXTENSION_BASE_([0-9a-f]{8})__$/;
30
+ const TAKE_BLOCK_READ = `{let ${TAKEN_EXTENSION_BASE}="";try{${TAKEN_EXTENSION_BASE}=`;
31
+ const TAKE_BLOCK_CHECK = `}catch(error){}if(typeof ${TAKEN_EXTENSION_BASE}!=="string"||${TAKEN_EXTENSION_BASE}<"moz-extension://"||${TAKEN_EXTENSION_BASE}>="moz-extension:/0")${TAKEN_EXTENSION_BASE}="";`;
32
+ function extensionBaseGlobal(identity) {
33
+ const digest = createHash('sha256').update(identity).digest('hex');
34
+ return `${EXTENSION_BASE_GLOBAL.slice(0, -1)}${digest.slice(0, 8)}__`;
35
+ }
36
+ function extensionBaseAttribute(global = EXTENSION_BASE_GLOBAL) {
37
+ const key = GLOBAL_KEY.exec(global);
38
+ return key ? `${EXTENSION_BASE_ATTRIBUTE}-${key[1]}` : EXTENSION_BASE_ATTRIBUTE;
39
+ }
40
+ function takeBlockOpen(global = EXTENSION_BASE_GLOBAL) {
41
+ return `${TAKE_BLOCK_READ}${global}${TAKE_BLOCK_CHECK}`;
42
+ }
43
+ takeBlockOpen();
44
+ function readTakeBlock(text) {
45
+ if (!text.startsWith(TAKE_BLOCK_READ)) return null;
46
+ const global = KEYED_GLOBAL.exec(text.slice(TAKE_BLOCK_READ.length, TAKE_BLOCK_READ.length + 64));
47
+ if (!global) return null;
48
+ const open = takeBlockOpen(global[0]);
49
+ return text.startsWith(open) ? open : null;
50
+ }
51
+ function prependBehindTakeBlock(text, prefix) {
52
+ const open = readTakeBlock(text);
53
+ if (!open) return `${prefix}${text}`;
54
+ return `${open}${prefix}${text.slice(open.length)}`;
55
+ }
56
+ export { CHROMIUM_EXTENSION_SCHEME, EXTENSION_BASE_ATTRIBUTE, EXTENSION_BASE_FROM_STACK, EXTENSION_BASE_GLOBAL, GECKO_EXTENSION_SCHEME, TAKEN_EXTENSION_BASE, closedOnSlash, extensionBaseAttribute, extensionBaseFromFile, extensionBaseGlobal, extensionSchemeFor, prependBehindTakeBlock, readTakeBlock, takeBlockOpen, unlessExtensionAddress };
@@ -1,120 +1,11 @@
1
1
  import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
2
  import { WebpackError } from "@rspack/core";
3
- import { isDeadCssUrlRef, publicOwnedOutputName, extractCssUrlRefs, toPosixPath, replaceCssUrlRefs } from "./273~0.mjs";
4
- import { EXTENSION_BASE_FROM_STACK } from "./527~0.mjs";
5
- import { toJsStringLiteral } from "./363~0.mjs";
6
- import { resolvePublicFolder, publicContainmentRoot } from "./105~0.mjs";
7
- import { canonicalizeDir, canonicalizeResourcePath } from "./712~0.mjs";
8
- import { deadCssUrlRef } from "./524~0.mjs";
3
+ import { resolvePublicFolder, publicContainmentRoot } from "./g0~0.mjs";
4
+ import { canonicalizeDir, canonicalizeResourcePath } from "./ka~0.mjs";
5
+ import { isDeadCssUrlRef, extractCssUrlRefs, toPosixPath } from "./6l~0.mjs";
6
+ import { deadCssUrlRef } from "./9~0.mjs";
7
+ import { toRuntimeStylesheetModule, rewriteInlinedCssUrls, isSfcStyleBlock } from "./y~0.mjs";
9
8
  import * as __rspack_external_node_path_806ed179 from "node:path";
10
- import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
11
- const EXTENSION_ROOT_PLACEHOLDER = '__EXTENSIONJS_EXTENSION_ROOT__/';
12
- const BUNDLED_FILE_TOKEN = /__EXTENSIONJS_CSS_FILE_(\d+)__([^"\\]*)/g;
13
- function bundledFileToken(index) {
14
- return `__EXTENSIONJS_CSS_FILE_${index}__`;
15
- }
16
- function isFile(candidate) {
17
- try {
18
- return __rspack_external_node_fs_1b05aee1.statSync(candidate).isFile();
19
- } catch {
20
- return false;
21
- }
22
- }
23
- function resolveTarget(req, { resourcePath, manifestDir, publicRoot, publicDir }) {
24
- if (req.startsWith('/')) {
25
- const rel = req.slice(1);
26
- const fromPublic = __rspack_external_node_path_806ed179.join(publicRoot, rel);
27
- if (isFile(fromPublic)) return {
28
- absolutePath: fromPublic,
29
- outputName: toPosixPath(__rspack_external_node_path_806ed179.normalize(rel)),
30
- publicOwned: true
31
- };
32
- const fromManifest = __rspack_external_node_path_806ed179.join(manifestDir, rel);
33
- if (!isFile(fromManifest)) return;
34
- return {
35
- absolutePath: fromManifest,
36
- publicOwned: false
37
- };
38
- }
39
- const absolutePath = __rspack_external_node_path_806ed179.resolve(__rspack_external_node_path_806ed179.dirname(resourcePath), req);
40
- if (!isFile(absolutePath)) return;
41
- const publicPath = publicOwnedOutputName(absolutePath, publicDir);
42
- if (publicPath) return {
43
- absolutePath,
44
- outputName: publicPath,
45
- publicOwned: true
46
- };
47
- return {
48
- absolutePath,
49
- publicOwned: false
50
- };
51
- }
52
- function rewriteInlinedCssUrls(source, context) {
53
- const targets = [];
54
- const seen = new Map();
55
- const css = replaceCssUrlRefs(source, (request)=>{
56
- const suffixAt = request.search(/[?#]/);
57
- const req = -1 === suffixAt ? request : request.slice(0, suffixAt);
58
- const suffix = -1 === suffixAt ? '' : request.slice(suffixAt);
59
- if (!req || req.startsWith('//') || /^[a-z][a-z0-9+.-]*:/i.test(req)) return;
60
- if (req.startsWith('~') || req.startsWith('@')) return;
61
- if (req.startsWith(EXTENSION_ROOT_PLACEHOLDER)) return;
62
- let named = seen.get(req);
63
- if (!named) {
64
- const target = resolveTarget(req, context);
65
- if (!target) return;
66
- named = target.publicOwned ? `${EXTENSION_ROOT_PLACEHOLDER}${target.outputName}` : bundledFileToken(targets.filter((other)=>!other.publicOwned).length);
67
- seen.set(req, named);
68
- targets.push({
69
- request: req,
70
- ...target
71
- });
72
- }
73
- return `${named}${suffix}`;
74
- });
75
- return {
76
- css,
77
- targets
78
- };
79
- }
80
- function toRuntimeStylesheetModule(css, bundledRequests = []) {
81
- const root = JSON.stringify(EXTENSION_ROOT_PLACEHOLDER);
82
- const rooted = `__extjsCssText.split(${root}).join(__extjsExtensionRoot())`;
83
- const text = 0 === bundledRequests.length ? rooted : `${rooted}.replace(${String(BUNDLED_FILE_TOKEN)}, __extjsCssFile)`;
84
- return [
85
- `var __extjsCssText = ${JSON.stringify(css)};`,
86
- 'function __extjsExtensionRoot() {',
87
- ' try {',
88
- ' var b = globalThis.browser;',
89
- ' if (typeof b === "object" && b && b.runtime && typeof b.runtime.getURL === "function") return String(b.runtime.getURL("/"));',
90
- ' } catch (error) {}',
91
- ' try {',
92
- ' var c = globalThis.chrome;',
93
- ' if (typeof c === "object" && c && c.runtime && typeof c.runtime.getURL === "function") return String(c.runtime.getURL("/"));',
94
- ' } catch (error) {}',
95
- ' try {',
96
- ` var base = ${EXTENSION_BASE_FROM_STACK} || ((typeof globalThis === "object" && globalThis && globalThis.__EXTJS_EXTENSION_BASE__) ? String(globalThis.__EXTJS_EXTENSION_BASE__) : "");`,
97
- ' if (!base && typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");',
98
- ' if (!base && typeof __webpack_require__ === "function" && __webpack_require__.extjsBase) base = String(__webpack_require__.extjsBase);',
99
- ' if (base) return base.replace(/\\/+$/, "") + "/";',
100
- ' } catch (error) {}',
101
- ' return "/";',
102
- '}',
103
- ...0 === bundledRequests.length ? [] : [
104
- `var __extjsCssFiles = [${bundledRequests.map((request)=>`function(){ return new URL(${toJsStringLiteral(request)}, import.meta.url); }`).join(', ')}];`,
105
- 'function __extjsCssFile(match, index, suffix) {',
106
- ' try {',
107
- ' var file = __extjsCssFiles[Number(index)]();',
108
- ' if (file.protocol === "data:") return file.href;',
109
- ' return __extjsExtensionRoot() + String(file.pathname).replace(/^\\/+/, "") + suffix;',
110
- ' } catch (error) {}',
111
- ' return "about:invalid";',
112
- '}'
113
- ],
114
- `module.exports = "data:text/css;charset=utf-8," + encodeURIComponent(${text});`,
115
- ''
116
- ].join('\n');
117
- }
118
9
  function reportDeadRefs(loader, source, manifestDir, publicRoot) {
119
10
  const roots = [
120
11
  publicRoot,
@@ -160,19 +51,29 @@ function resolveTargets(loader, source, manifestDir, publicRoot, publicDir) {
160
51
  bundledRequests
161
52
  };
162
53
  }
163
- function deadCssUrlLoader(source) {
54
+ function inlineStylesheetUrls(loader, source) {
164
55
  let css = source;
165
56
  let bundledRequests = [];
166
- const options = this.getOptions() || {};
57
+ const options = loader.getOptions() || {};
167
58
  try {
168
59
  const { manifestPath, projectPath } = options;
169
60
  if (manifestPath && projectPath) {
170
61
  const manifestDir = canonicalizeDir(__rspack_external_node_path_806ed179.dirname(manifestPath));
171
62
  const publicRoot = canonicalizeDir(publicContainmentRoot(manifestPath, projectPath));
172
- reportDeadRefs(this, source, manifestDir, publicRoot);
173
- ({ css, bundledRequests } = resolveTargets(this, source, manifestDir, publicRoot, resolvePublicFolder(manifestPath, projectPath)));
63
+ reportDeadRefs(loader, source, manifestDir, publicRoot);
64
+ ({ css, bundledRequests } = resolveTargets(loader, source, manifestDir, publicRoot, resolvePublicFolder(manifestPath, projectPath)));
174
65
  }
175
66
  } catch {}
176
- return toRuntimeStylesheetModule(css, bundledRequests);
67
+ return {
68
+ css,
69
+ bundledRequests
70
+ };
71
+ }
72
+ function deadCssUrlLoader(source) {
73
+ if (isSfcStyleBlock(this)) return source;
74
+ const { css, bundledRequests } = inlineStylesheetUrls(this, source);
75
+ const options = this.getOptions() || {};
76
+ return toRuntimeStylesheetModule(css, bundledRequests, void 0, true === options.gecko, options.baseAttribute, options.baseScheme);
177
77
  }
178
78
  export default deadCssUrlLoader;
79
+ export { inlineStylesheetUrls };
@@ -16,14 +16,20 @@ export interface ActionRecord {
16
16
  export interface ActionsSink {
17
17
  write(record: ActionRecord): void;
18
18
  }
19
+ export interface ActionsFileOwner {
20
+ runId: string;
21
+ logsFilePath: string;
22
+ }
19
23
  export interface ActionsFileOptions {
20
24
  filePath: string;
25
+ owner?: ActionsFileOwner;
21
26
  maxBytes?: number;
22
27
  maxLines?: number;
23
28
  generations?: number;
24
29
  }
25
30
  export declare class ActionsFileWriter implements ActionsSink {
26
31
  private readonly opts;
32
+ private readonly owner?;
27
33
  private bytes;
28
34
  private lines;
29
35
  private started;
@@ -31,6 +37,7 @@ export declare class ActionsFileWriter implements ActionsSink {
31
37
  start(): void;
32
38
  write(record: ActionRecord): void;
33
39
  close(): void;
40
+ private isSuperseded;
34
41
  private rotatedName;
35
42
  private rotate;
36
43
  }
@@ -1,10 +1,11 @@
1
1
  import { type ActionsSink } from './actions-file.js';
2
- import { type AnyFrame, type BridgeEngine, type CommandFrame, type DevReloadKind, type IncomingLogEvent, type ReloadAckOutcome, type ServerFrame } from './contracts.js';
2
+ import { type AnyFrame, type BootRegistrationsOutcome, type BridgeEngine, type CommandFrame, type DevReloadKind, type HelloFrame, type IncomingLogEvent, type LateReloadRestart, type ReloadAckOutcome, type ReloadFrame, type ReloadRestartOutcome, type ServerFrame } from './contracts.js';
3
3
  import type { LogsFileWriter } from './logs-file.js';
4
4
  import { LogRingBuffer } from './ring-buffer.js';
5
5
  export interface BridgeConnection {
6
6
  readonly id: string;
7
7
  readonly origin?: string;
8
+ readonly remoteAddress?: string;
8
9
  send(frame: ServerFrame | CommandFrame): boolean;
9
10
  close(code?: number, reason?: string): void;
10
11
  }
@@ -30,12 +31,17 @@ export interface BridgeBrokerOptions {
30
31
  onExecutorDetached?: () => void;
31
32
  wakeExecutor?: () => Promise<boolean>;
32
33
  onReloadApplied?: (kind: string, label?: string) => void;
34
+ onLateBootRegistration?: (afterMs?: number) => void;
35
+ sessionCommand?: BridgeSessionCommand;
33
36
  }
34
- export { CLOSE_BAD_HELLO, CLOSE_BAD_INSTANCE, CLOSE_CONTROL_UNAVAILABLE, CLOSE_SLOW_CONSUMER } from './contracts.js';
37
+ export type BridgeSessionCommand = 'dev' | 'start' | 'preview';
38
+ export { CLOSE_BAD_HELLO, CLOSE_BAD_INSTANCE, CLOSE_CONTROL_UNAVAILABLE, CLOSE_SLOW_CONSUMER, CLOSE_TOKEN_REQUIRED } from './contracts.js';
35
39
  export declare const DEFAULT_CMD_TIMEOUT_MS = 5000;
36
40
  export declare const MAX_CMD_TIMEOUT_MS = 30000;
37
41
  export declare const WAKE_HELLO_WAIT_MS = 5000;
38
42
  export declare const RELOAD_ACK_TIMEOUT_MS = 3000;
43
+ export declare const RELOAD_RESTART_TIMEOUT_MS = 15000;
44
+ export declare function alreadyRunsLatchedBuild(hello: HelloFrame, frame: ReloadFrame): boolean;
39
45
  export declare class BridgeBroker {
40
46
  private readonly instanceId;
41
47
  private readonly runId;
@@ -45,6 +51,7 @@ export declare class BridgeBroker {
45
51
  private readonly ring;
46
52
  private readonly file?;
47
53
  private readonly roles;
54
+ private readonly sessionExtensionOrigins;
48
55
  private readonly allowControl;
49
56
  private readonly allowEval;
50
57
  private readonly controlToken?;
@@ -63,17 +70,29 @@ export declare class BridgeBroker {
63
70
  private readonly onExecutorAttached?;
64
71
  private readonly onExecutorDetached?;
65
72
  private readonly wakeExecutor?;
73
+ private bootRegistrations;
74
+ private bootRegistrationsAwaited;
75
+ private lateBootRegistrationSaid;
76
+ private readonly bootRegistrationWaiters;
77
+ private readonly onLateBootRegistration?;
66
78
  private readonly executorWaiters;
67
79
  private readonly waking;
68
80
  private readonly onReloadApplied?;
81
+ private readonly sessionCommand;
82
+ private producerless;
69
83
  private lastProducerDisconnectedAt;
70
84
  private browserExitedAt;
71
85
  private browserExitHow;
72
86
  private lastStaleHelloAt;
73
87
  private pendingReload?;
88
+ private replayedTabs;
89
+ private latchedReloadDelivered?;
74
90
  private readonly ackingProducers;
91
+ private readonly sessionBuilds;
92
+ private readonly producerBuilds;
75
93
  private reloadSeq;
76
94
  private reloadAck;
95
+ private reloadRestart;
77
96
  constructor(options: BridgeBrokerOptions);
78
97
  get consumerCount(): number;
79
98
  get producerCount(): number;
@@ -90,21 +109,42 @@ export declare class BridgeBroker {
90
109
  label?: string;
91
110
  changedFiles?: string[];
92
111
  changedScriptFiles?: string[];
112
+ refreshedStylesheets?: {
113
+ file: string;
114
+ digest: string;
115
+ }[];
116
+ standalonePages?: string[];
117
+ build?: string;
93
118
  }): number;
119
+ runsBuild(build: string): boolean;
94
120
  noteReloadApplied(kind: string, label?: string): void;
95
121
  awaitReloadAck(): Promise<ReloadAckOutcome>;
122
+ reloadReplayedTabs(): number;
96
123
  private armReloadAck;
97
124
  private onReloadAck;
125
+ awaitBootRegistrations(timeoutMs: number): Promise<BootRegistrationsOutcome>;
126
+ private onBootRegistrations;
127
+ awaitReloadRestart(): Promise<ReloadRestartOutcome>;
128
+ awaitLateReloadRestart(): Promise<LateReloadRestart | null>;
129
+ private armReloadRestart;
130
+ deliverLatchedReload(): Promise<boolean>;
98
131
  undeliveredReloadWarning(options?: {
99
132
  producerRestartExpected?: boolean;
100
133
  }): string | null;
101
134
  pingProducers(): number;
102
135
  ingestLog(incoming: IncomingLogEvent): void;
103
136
  private allowStaleProducerResync;
137
+ noteSessionBuild(build: string): void;
138
+ private compiledBefore;
139
+ private runsEarlierSessionBuild;
140
+ private resyncEarlierSessionProducer;
104
141
  private onHello;
142
+ noteNoBackground(): void;
105
143
  noteControlPortUnavailable(reason?: string | null): void;
106
144
  noteBrowserExited(at: string, how?: string | null): void;
107
145
  private diagnoseExecutorAbsence;
146
+ isSessionExtensionOrigin(origin: unknown): boolean;
147
+ private isRemotePeer;
108
148
  private gateEval;
109
149
  private controllerReady;
110
150
  private onCommand;
@@ -10,15 +10,21 @@ export interface ReadyContractInfo {
10
10
  schema?: number;
11
11
  logsPath?: string;
12
12
  status?: string;
13
+ /** The command that wrote the contract: `dev`, `start` or `preview`. */
14
+ command?: string;
13
15
  engine?: string;
14
16
  /** Dev-server pid; absent in pre-4.1 contracts. */
15
17
  pid?: number;
18
+ /** When that pid's process started (ISO UTC); a reused pid will not match it. */
19
+ pidStartedAt?: string;
16
20
  /** Browser CDP port, stamped post-launch, may lag `status: 'ready'`. */
17
21
  cdpPort?: number;
18
22
  /** Gecko debugger-server port, the `cdpPort` of a Firefox-family session. */
19
23
  rdpPort?: number;
20
24
  /** The launched browser process, the only handle on its liveness. */
21
25
  browserPid?: number;
26
+ /** When the browser process started (ISO UTC), the same check for `browserPid`. */
27
+ browserStartedAt?: string;
22
28
  /** Stamped when the launched browser exits while the server keeps running. */
23
29
  browserExitedAt?: string;
24
30
  browserExitCode?: number;
@@ -47,6 +53,7 @@ export interface ConsumerOptions {
47
53
  instanceId: string;
48
54
  host?: string;
49
55
  path?: string;
56
+ token?: string;
50
57
  reconnect?: boolean;
51
58
  onReady?: (frame: ReadyFrame) => void;
52
59
  onLog?: (event: LogEvent) => void;
@@ -66,6 +66,7 @@ export interface HelloFrame {
66
66
  instanceId: string;
67
67
  token?: string;
68
68
  acksReloads?: boolean;
69
+ build?: string;
69
70
  }
70
71
  export interface ReadyFrame {
71
72
  type: 'ready';
@@ -121,6 +122,7 @@ export interface ResultFrame {
121
122
  stack?: string;
122
123
  engine?: string;
123
124
  code?: BridgeRefusalCode;
125
+ hint?: string;
124
126
  };
125
127
  }
126
128
  /**
@@ -146,14 +148,38 @@ export interface ReloadFrame {
146
148
  changedFiles?: string[];
147
149
  /** Emitted scripts/ bundles the SW should replay its executeScript calls for. */
148
150
  changedScriptFiles?: string[];
151
+ /** Declared stylesheets rewritten under the same name, to swap on open tabs. */
152
+ refreshedStylesheets?: {
153
+ file: string;
154
+ digest: string;
155
+ }[];
156
+ /** Pages shipped as written, with no dev client, whose open tabs reload. */
157
+ standalonePages?: string[];
158
+ /** The build this reload ships, compared with the one a returning worker runs. */
159
+ build?: string;
149
160
  }
150
161
  export interface ReloadAckFrame {
151
162
  type: 'reload-ack';
152
163
  reloadType: DevReloadKind;
153
164
  reloadId?: string;
154
165
  label?: string;
166
+ replayedTabs?: number;
155
167
  }
168
+ export interface BootRegistrationsFrame {
169
+ type: 'boot-registrations';
170
+ calls?: number;
171
+ landed?: boolean;
172
+ pending?: boolean;
173
+ late?: boolean;
174
+ afterMs?: number;
175
+ }
176
+ export type BootRegistrationsOutcome = 'settled' | 'timeout';
156
177
  export type ReloadAckOutcome = 'acked' | 'unacked' | 'not-expected';
178
+ export type ReloadRestartOutcome = 'restarted' | 'not-restarted' | 'not-expected';
179
+ export interface LateReloadRestart {
180
+ afterMs: number;
181
+ runsBuild: boolean;
182
+ }
157
183
  /**
158
184
  * Server → producer keepalive. An MV3 service worker idles out after ~30s
159
185
  * without events, and a stopped SW holds no control socket, reload
@@ -166,7 +192,7 @@ export type ReloadAckOutcome = 'acked' | 'unacked' | 'not-expected';
166
192
  export interface PingFrame {
167
193
  type: 'ping';
168
194
  }
169
- export type ClientFrame = HelloFrame | LogFrame | CommandFrame | ReloadAckFrame;
195
+ export type ClientFrame = HelloFrame | LogFrame | CommandFrame | ReloadAckFrame | BootRegistrationsFrame;
170
196
  export type ServerFrame = ReadyFrame | LogFrame | GapFrame | ResultFrame | ReloadFrame | PingFrame;
171
197
  export type AnyFrame = ClientFrame | ServerFrame;
172
198
  export declare const CONTROL_WS_PATH = "/extjs-control";
@@ -176,5 +202,7 @@ export declare const CLOSE_BAD_INSTANCE = 4001;
176
202
  export declare const CLOSE_BAD_HELLO = 4002;
177
203
  /** A controller dialed a session started without `--allow-control`. */
178
204
  export declare const CLOSE_CONTROL_UNAVAILABLE = 4003;
205
+ /** A consumer or controller beyond loopback sent no session token, or the wrong one. */
206
+ export declare const CLOSE_TOKEN_REQUIRED = 4004;
179
207
  /** The socket fell far enough behind that it was dropped to protect the broker. */
180
208
  export declare const CLOSE_SLOW_CONSUMER = 4008;
@@ -8,6 +8,12 @@ export interface LogsFileOptions {
8
8
  flushIntervalMs?: number;
9
9
  maxQueue?: number;
10
10
  }
11
+ export declare function readLogDescriptorRunId(fd: number): string | undefined;
12
+ export declare function readLogFileRunId(filePath: string): string | undefined;
13
+ export declare function isLogFileOwnedByAnotherRun(filePath: string, runId: string): boolean;
14
+ export type OwnedAppendResult = 'written' | 'foreign' | 'failed';
15
+ export declare function appendToOwnedLogFile(filePath: string, runId: string, payload: string): OwnedAppendResult;
16
+ export declare function replaceLogFile(filePath: string, content: string): void;
11
17
  export declare class LogsFileWriter {
12
18
  private readonly opts;
13
19
  private queue;
@@ -0,0 +1 @@
1
+ export declare function isLoopbackAddress(address: string | undefined | null): boolean;