extension-develop 4.1.39 → 4.1.40-canary.459.2c1ba7b

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 (210) hide show
  1. package/README.md +13 -10
  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 +8644 -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} +66 -17
  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 +56 -18
  46. package/dist/feature-scripts-content-script-wrapper.mjs +56 -18
  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/manifest-types.d.ts +276 -0
  60. package/dist/lib/messages.d.ts +6 -2
  61. package/dist/lib/process-started-at.d.ts +1 -0
  62. package/dist/lib/real-path.d.ts +8 -0
  63. package/dist/lib/resource-path.d.ts +1 -0
  64. package/dist/lib/session-paths.d.ts +2 -0
  65. package/dist/lib/split-chunks.d.ts +2 -1
  66. package/dist/lib/stats-handler.d.ts +1 -0
  67. package/dist/lib/tsconfig-includes-file.d.ts +1 -0
  68. package/dist/l~0.mjs +2290 -0
  69. package/dist/main-world-bridge.js +92 -23
  70. package/dist/main-world-bridge.mjs +92 -23
  71. package/dist/manifest-entry.d.ts +2 -0
  72. package/dist/manifest.mjs +3 -1
  73. package/dist/module.mjs +3 -3
  74. package/dist/{832~0.mjs → m~0.mjs} +2244 -288
  75. package/dist/o~0.mjs +47 -0
  76. package/dist/plugin-browsers/index.d.ts +7 -0
  77. package/dist/plugin-browsers/safari-dev-plugin.d.ts +2 -0
  78. package/dist/plugin-compatibility/compatibility-lib/messages.d.ts +5 -1
  79. package/dist/plugin-compatibility/compatibility-lib/native-browser-namespace.d.ts +5 -0
  80. package/dist/plugin-compatibility/feature-browser-global.d.ts +11 -1
  81. package/dist/plugin-compatibility/index.d.ts +2 -0
  82. package/dist/plugin-compilation/compilation-lib/messages.d.ts +4 -1
  83. package/dist/plugin-compilation/env.d.ts +1 -0
  84. package/dist/plugin-compilation/index.d.ts +2 -0
  85. package/dist/plugin-compilation/node-builtins.d.ts +5 -0
  86. package/dist/plugin-compilation/one-diagnostic-per-location.d.ts +13 -0
  87. package/dist/plugin-compilation/resolve-file-requests.d.ts +16 -0
  88. package/dist/plugin-compilation/warm-ancestor-watchers.d.ts +19 -0
  89. package/dist/plugin-compilation/watch-real-project-path.d.ts +27 -0
  90. package/dist/plugin-compilation/zip.d.ts +2 -0
  91. package/dist/plugin-css/css-in-content-script-loader.d.ts +1 -1
  92. package/dist/plugin-css/css-lib/build-css-rules.d.ts +3 -0
  93. package/dist/plugin-css/css-lib/inline-content-script-css.d.ts +3 -1
  94. package/dist/plugin-css/css-lib/messages.d.ts +4 -0
  95. package/dist/plugin-css/css-lib/sfc-style-block.d.ts +26 -0
  96. package/dist/plugin-css/css-lib/unplaced-style-imports.d.ts +7 -0
  97. package/dist/plugin-css/css-lib/verbatim-css.d.ts +1 -0
  98. package/dist/plugin-css/dead-css-url-loader.d.ts +9 -1
  99. package/dist/plugin-css/index.d.ts +1 -0
  100. package/dist/plugin-css/sfc-style-block-loader.d.ts +18 -0
  101. package/dist/plugin-css/unplaced-style-import-loader.d.ts +16 -0
  102. package/dist/plugin-playwright/index.d.ts +22 -0
  103. package/dist/plugin-reload/classify-reload.d.ts +20 -0
  104. package/dist/plugin-reload/index.d.ts +4 -2
  105. package/dist/plugin-reload/messages.d.ts +1 -0
  106. package/dist/plugin-reload/reload-dispatch.d.ts +21 -2
  107. package/dist/plugin-reload/reload-lib/dev-content-scripts.d.ts +6 -0
  108. package/dist/plugin-reload/reload-lib/scripts-replay-shim.d.ts +1 -1
  109. package/dist/plugin-reload/steps/inject-bridge-producer.d.ts +6 -0
  110. package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/ChunkLoader.d.ts +3 -0
  111. package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/RuntimeModules/AutoPublicPath.d.ts +1 -1
  112. package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/RuntimeModules/BaseUri.d.ts +1 -1
  113. package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/RuntimeModules/LoadScript.d.ts +1 -1
  114. package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/RuntimeModules/PublicPath.d.ts +1 -1
  115. package/dist/plugin-special-folders/get-data.d.ts +2 -0
  116. package/dist/plugin-special-folders/hint-import-only-scripts.d.ts +4 -0
  117. package/dist/plugin-special-folders/include-files.d.ts +2 -0
  118. package/dist/plugin-special-folders/messages.d.ts +1 -0
  119. package/dist/plugin-web-extension/feature-html/html-lib/inject.d.ts +1 -1
  120. package/dist/plugin-web-extension/feature-html/html-lib/patch-html.d.ts +1 -0
  121. package/dist/plugin-web-extension/feature-html/steps/update-html-file.d.ts +1 -0
  122. package/dist/plugin-web-extension/feature-icons/extract-action-theme-icons.d.ts +1 -0
  123. package/dist/plugin-web-extension/feature-icons/extract-icon-variants.d.ts +2 -0
  124. package/dist/plugin-web-extension/feature-json/json-validation.d.ts +2 -1
  125. package/dist/plugin-web-extension/feature-json/messages.d.ts +2 -0
  126. package/dist/plugin-web-extension/feature-json/process-assets.d.ts +1 -1
  127. package/dist/plugin-web-extension/feature-manifest/manifest-lib/filter-keys-gecko.d.ts +21 -0
  128. package/dist/plugin-web-extension/feature-manifest/manifest-lib/filter-keys-safari.d.ts +1 -1
  129. package/dist/plugin-web-extension/feature-manifest/manifest-lib/icon-variants-fallback.d.ts +15 -0
  130. package/dist/plugin-web-extension/feature-manifest/manifest-lib/sanitize-fatal-shapes.d.ts +2 -1
  131. package/dist/plugin-web-extension/feature-manifest/manifest-lib/webkit-unsupported-keys.d.ts +15 -0
  132. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/content_scripts.d.ts +1 -1
  133. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/icons.d.ts +3 -2
  134. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/omnibox.d.ts +1 -1
  135. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/page_action.d.ts +2 -1
  136. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/permissions.d.ts +1 -1
  137. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/sandbox.d.ts +1 -1
  138. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv2/browser_action.d.ts +4 -3
  139. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv3/action.d.ts +3 -2
  140. package/dist/plugin-web-extension/feature-manifest/messages.d.ts +15 -1
  141. package/dist/plugin-web-extension/feature-manifest/normalize-manifest-path.d.ts +2 -0
  142. package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/dev-additions.d.ts +8 -0
  143. package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/patch-background.d.ts +2 -2
  144. package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/patch-externally-connectable.d.ts +1 -1
  145. package/dist/plugin-web-extension/feature-manifest/steps/patch-gecko-background.d.ts +1 -0
  146. package/dist/plugin-web-extension/feature-manifest/steps/warn-content-script-host-access.d.ts +17 -0
  147. package/dist/plugin-web-extension/feature-manifest/steps/warn-description-length.d.ts +26 -0
  148. package/dist/plugin-web-extension/feature-manifest/steps/warn-gecko-unsupported-apis.d.ts +37 -2
  149. package/dist/plugin-web-extension/feature-scripts/contracts.d.ts +3 -0
  150. package/dist/plugin-web-extension/feature-scripts/index.d.ts +1 -0
  151. package/dist/plugin-web-extension/feature-scripts/messages.d.ts +10 -1
  152. package/dist/plugin-web-extension/feature-scripts/scripts-lib/completion-value.d.ts +13 -0
  153. package/dist/plugin-web-extension/feature-scripts/scripts-lib/injected-sheet-urls.d.ts +5 -0
  154. package/dist/plugin-web-extension/feature-scripts/scripts-lib/main-world-bridge-pairing.d.ts +5 -0
  155. package/dist/plugin-web-extension/feature-scripts/scripts-lib/main-world-copy-routing.d.ts +2 -0
  156. package/dist/plugin-web-extension/feature-scripts/scripts-lib/registration-worlds.d.ts +10 -0
  157. package/dist/plugin-web-extension/feature-scripts/scripts-lib/runtime-main-world-scripts.d.ts +25 -2
  158. package/dist/plugin-web-extension/feature-scripts/scripts-lib/runtime-script-sheet.d.ts +14 -0
  159. package/dist/plugin-web-extension/feature-scripts/scripts-lib/taken-extension-base.d.ts +10 -0
  160. package/dist/plugin-web-extension/feature-scripts/steps/add-base-uri-runtime-module.d.ts +7 -1
  161. package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/content-script-wrapper.d.ts +2 -0
  162. package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/index.d.ts +2 -0
  163. package/dist/plugin-web-extension/feature-scripts/steps/add-public-path-runtime-module.d.ts +6 -0
  164. package/dist/plugin-web-extension/feature-scripts/steps/classic-traced-globals-loader.d.ts +1 -0
  165. package/dist/plugin-web-extension/feature-scripts/steps/compile-main-world-scripts.d.ts +4 -0
  166. package/dist/plugin-web-extension/feature-scripts/steps/keep-completion-value.d.ts +6 -0
  167. package/dist/plugin-web-extension/feature-scripts/steps/pair-runtime-main-world-bridges.d.ts +12 -0
  168. package/dist/plugin-web-extension/feature-scripts/steps/place-runtime-script-sheets.d.ts +12 -0
  169. package/dist/plugin-web-extension/feature-scripts/steps/prune-main-world-bridges.d.ts +1 -0
  170. package/dist/plugin-web-extension/feature-scripts/steps/root-injected-sheet-urls.d.ts +9 -0
  171. package/dist/plugin-web-extension/feature-scripts/steps/route-main-world-copies.d.ts +10 -0
  172. package/dist/plugin-web-extension/feature-scripts/steps/source-literals.d.ts +24 -0
  173. package/dist/plugin-web-extension/feature-scripts/steps/take-extension-base.d.ts +11 -0
  174. package/dist/plugin-web-extension/feature-scripts/steps/trace-runtime-loaded-files.d.ts +18 -3
  175. package/dist/plugin-web-extension/feature-scripts/steps/warn-main-world-registration-changed.d.ts +12 -0
  176. package/dist/plugin-web-extension/feature-scripts/steps/warn-moved-page-relative-urls.d.ts +30 -0
  177. package/dist/plugin-web-extension/feature-scripts/steps/warn-page-relative-script-path.d.ts +10 -0
  178. package/dist/plugin-web-extension/feature-scripts/steps/warn-unknown-registration-world.d.ts +10 -0
  179. package/dist/plugin-web-extension/feature-web-resources/collect-entry-imports.d.ts +1 -0
  180. package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/messages.d.ts +2 -0
  181. package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/page-requests.d.ts +5 -0
  182. package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/resolve-war.d.ts +1 -0
  183. package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/unreachable-resources.d.ts +1 -0
  184. package/dist/plugin-web-extension/shared/script-graph.d.ts +12 -0
  185. package/dist/preprocessor-passthrough-loader.mjs +1 -1
  186. package/dist/preview.mjs +1 -1
  187. package/dist/public-css-url-loader.mjs +1 -1
  188. package/dist/{331~0.mjs → q~0.mjs} +2 -2
  189. package/dist/rj~0.mjs +125 -0
  190. package/dist/{519~0.mjs → rl~0.mjs} +56 -5
  191. package/dist/rspack-config~0.mjs +3140 -3302
  192. package/dist/{177~0.mjs → r~0.mjs} +2 -2
  193. package/dist/sfc-style-block-loader.mjs +49 -0
  194. package/dist/stats-handler~0.mjs +15 -7
  195. package/dist/tm~0.mjs +71 -0
  196. package/dist/types.d.ts +46 -5
  197. package/dist/{285~0.mjs → t~0.mjs} +41 -26
  198. package/dist/unplaced-style-import-loader.mjs +131 -0
  199. package/dist/x~0.mjs +3 -0
  200. package/dist/y~0.mjs +234 -0
  201. package/dist/zip~0.mjs +5 -4
  202. package/dist/{363~0.mjs → z~0.mjs} +563 -281
  203. package/package.json +6 -6
  204. package/dist/527~0.mjs +0 -3
  205. package/dist/840~0.mjs +0 -5635
  206. /package/dist/{895~0.mjs → 3~0.mjs} +0 -0
  207. /package/dist/{374~0.mjs → 5~0.mjs} +0 -0
  208. /package/dist/{206~0.mjs → 6~0.mjs} +0 -0
  209. /package/dist/{471~0.mjs → g~0.mjs} +0 -0
  210. /package/dist/{117~0.mjs → w~0.mjs} +0 -0
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- [npm-version-image]: https://img.shields.io/npm/v/extension-develop.svg?color=0971fe
1
+ [npm-version-image]: https://img.shields.io/npm/v/extension-develop.svg?color=0065e6
2
2
  [npm-version-url]: https://www.npmjs.com/package/extension-develop
3
- [npm-downloads-image]: https://img.shields.io/npm/dm/extension-develop.svg?color=0971fe
3
+ [npm-downloads-image]: https://img.shields.io/npm/dm/extension-develop.svg?color=0065e6
4
4
  [npm-downloads-url]: https://www.npmjs.com/package/extension-develop
5
- [powered-image]: https://img.shields.io/badge/Powered%20by-Extension.js-0971fe
5
+ [powered-image]: https://img.shields.io/badge/Powered%20by-Extension.js-0065e6
6
6
  [powered-url]: https://extension.js.org
7
- [action-image]: https://github.com/extension-js/extension.js/actions/workflows/ci.yml/badge.svg?branch=main&color=0971fe
7
+ [action-image]: https://github.com/extension-js/extension.js/actions/workflows/ci.yml/badge.svg?branch=main&color=0065e6
8
8
  [action-url]: https://github.com/extension-js/extension.js/actions
9
9
 
10
10
  [![Powered by Extension.js][powered-image]][powered-url]
@@ -64,7 +64,7 @@ run()
64
64
  ## Features
65
65
 
66
66
  - Live reload/HMR development server with per-instance browser runners
67
- - Cross-browser support: Chrome, Edge, Firefox, Chromium-based, Gecko-based
67
+ - Cross-browser support: Chrome, Edge, Firefox, Safari, Chromium-based, Gecko-based
68
68
  - Rspack-based build with opinionated plugin stack
69
69
  - Clean production output in `dist/<browser>`
70
70
  - Zipping: distribution and/or source packages (respects `.gitignore`)
@@ -91,7 +91,7 @@ Options accepted by each command. Values shown are typical types or enumerations
91
91
 
92
92
  | Option | Type / Values | Description |
93
93
  | -------------- | -------------------------------------------------- | --------------------------------------------------------------- |
94
- | browser | chrome, edge, firefox, chromium-based, gecko-based | Target browser/runtime |
94
+ | browser | chrome, edge, firefox, safari, chromium-based, gecko-based | Target browser/runtime |
95
95
  | profile | string or false | Profile path or disable profile persistence |
96
96
  | startingUrl | string | Initial URL to open |
97
97
  | open | boolean | Focus/open the browser window (CLI: use `--no-open` to disable) |
@@ -104,7 +104,7 @@ Options accepted by each command. Values shown are typical types or enumerations
104
104
  | Option | Type / Values | Description |
105
105
  | ------------------- | ----------------------------------- | --------------------------------------------------------------------------------- |
106
106
  | mode | development, production, none | Build mode |
107
- | polyfill | boolean | Include `webextension-polyfill` when possible |
107
+ | polyfill | boolean | Bundle `webextension-polyfill` on a Chromium target, off by default |
108
108
  | port | number or string | Dev server port |
109
109
  | source | string | Inspect a source directory |
110
110
  | watchSource | boolean | Watch the source directory |
@@ -134,7 +134,9 @@ Options accepted by each command. Values shown are typical types or enumerations
134
134
  | zip | boolean | Package `dist/<browser>` as an artifact (e.g., `.zip`, `.xpi`) |
135
135
  | zipSource | boolean | Package source files (respects `.gitignore`) |
136
136
  | zipFilename | string | Custom base name for artifacts |
137
- | polyfill | boolean | Include `webextension-polyfill` when possible |
137
+ | zipDir | string | Folder for the artifacts, relative to the project or absolute |
138
+ | sourceMaps | boolean | Write source maps beside a production build, never zipped |
139
+ | polyfill | boolean | Bundle `webextension-polyfill` on Chromium, off by default |
138
140
  | silent | boolean | Suppress non-error logs |
139
141
 
140
142
  ### start
@@ -142,7 +144,7 @@ Options accepted by each command. Values shown are typical types or enumerations
142
144
  | Option | Type / Values | Description |
143
145
  | -------- | ------------- | --------------------------------------------- |
144
146
  | mode | `production` | Build mode |
145
- | polyfill | boolean | Include `webextension-polyfill` when possible |
147
+ | polyfill | boolean | Bundle `webextension-polyfill`, default off |
146
148
 
147
149
  ### preview
148
150
 
@@ -177,7 +179,7 @@ Options accepted by each command. Values shown are typical types or enumerations
177
179
  - Example: { dir: "./extensions" } loads every "./extensions/\*" folder that contains a manifest.json.
178
180
  - Precedence when composing options (one contract for every command): stock defaults → browser._ → commands._ → CLI flags.
179
181
  - Scalars: an unset flag never clobbers config, and an explicit flag (including `false`) always wins.
180
- - Example: `commands.dev.polyfill: false` turns the polyfill off for the team, and `--polyfill` turns it back on for one run.
182
+ - Example: `commands.dev.polyfill: true` turns the polyfill on for the team, and `--no-polyfill` turns it back off for one run.
181
183
  - Lists (`browserFlags`, `excludeBrowserFlags`): concatenate across layers in order (browser, then command, then CLI) and dedupe.
182
184
  - Objects (`preferences`): deep-merge, later layers win on key conflict.
183
185
  - Browser key aliases when resolving `browser.*` from `extension.config.*` (engine families adopt product blocks; named products do not adopt engine-based blocks):
@@ -276,6 +278,7 @@ export default {
276
278
 
277
279
  - Distribution artifacts live under `dist/<browser>/` and source artifacts under `dist/`.
278
280
  - File names default to a sanitized form of `manifest.name` plus `manifest.version` (override with `zipFilename`).
281
+ - `zipDir` moves both archives to another folder. A relative path has to stay inside the project, an absolute path is taken as written, and a folder inside `dist/<browser>` is refused.
279
282
  - Source packaging respects `.gitignore`.
280
283
 
281
284
  Example layout when both `zip` and `zipSource` are enabled:
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
2
  import { spawnSync } from "node:child_process";
3
- import { humanLine } from "./852~0.mjs";
4
- import { sessionStateIgnoreAdded } from "./469~0.mjs";
3
+ import { humanLine } from "./k~0.mjs";
4
+ import { sessionStateIgnoreAdded } from "./cp~0.mjs";
5
5
  import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
6
6
  import * as __rspack_external_node_path_806ed179 from "node:path";
7
7
  function sessionStateDir(projectPath) {
@@ -20,6 +20,16 @@ function controlTokenPath(projectPath, browser) {
20
20
  function legacyControlTokenPath(projectPath) {
21
21
  return __rspack_external_node_path_806ed179.join(sessionStateDir(projectPath), 'control.token');
22
22
  }
23
+ const SESSION_STATE_IGNORE_CONTENT = "# Extension.js local session state: the control port and the live control\n# token of a running session. Never commit or ship this directory.\n*\n";
24
+ function ensureSessionStateIgnoreFile(projectPath) {
25
+ try {
26
+ const ignoreFile = __rspack_external_node_path_806ed179.join(sessionStateDir(projectPath), '.gitignore');
27
+ __rspack_external_node_fs_1b05aee1.mkdirSync(__rspack_external_node_path_806ed179.dirname(ignoreFile), {
28
+ recursive: true
29
+ });
30
+ if (!__rspack_external_node_fs_1b05aee1.existsSync(ignoreFile)) __rspack_external_node_fs_1b05aee1.writeFileSync(ignoreFile, SESSION_STATE_IGNORE_CONTENT);
31
+ } catch {}
32
+ }
23
33
  function sessionArtifactsRootDir(projectPath) {
24
34
  return __rspack_external_node_path_806ed179.resolve(projectPath, 'dist', 'extension-js');
25
35
  }
@@ -146,4 +156,4 @@ function actionsPath(projectPath, browser) {
146
156
  function buildSummaryPath(projectPath, browser) {
147
157
  return __rspack_external_node_path_806ed179.join(browserArtifactsDir(projectPath, browser), 'build-summary.json');
148
158
  }
149
- export { CONTROL_TOKEN_FILE_PREFIX, actionsPath, browserArtifactsDir, browserDistDir, browserProfileRootDir, buildSummaryPath, controlPortFilePath, controlTokenPath, ensureSessionArtifactsIgnoreFile, ensureSessionStateInProjectGitignore, eventsPath, legacyControlPortFilePath, legacyControlTokenPath, logsPath, readyContractPath, sessionArtifactsRootDir, sessionStateDir };
159
+ export { CONTROL_TOKEN_FILE_PREFIX, actionsPath, browserArtifactsDir, browserDistDir, browserProfileRootDir, buildSummaryPath, controlPortFilePath, controlTokenPath, ensureSessionArtifactsIgnoreFile, ensureSessionStateIgnoreFile, ensureSessionStateInProjectGitignore, eventsPath, legacyControlPortFilePath, legacyControlTokenPath, logsPath, readyContractPath, sessionArtifactsRootDir, sessionStateDir };
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
- import { canonicalizeDir, canonicalizeResourcePath } from "./712~0.mjs";
2
+ import { canonicalizeDir, canonicalizeResourcePath } from "./ka~0.mjs";
3
3
  import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
4
4
  import * as __rspack_external_node_path_806ed179 from "node:path";
5
5
  const ASSET_EXT = /\.(png|jpe?g|gif|webp|svg|avif|ico|bmp|cur|woff2?|ttf|otf|eot|mp3|mp4|webm|ogg|wav)$/i;
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
2
  import pintor from "pintor";
3
- import { prefix as messaging_prefix } from "./852~0.mjs";
3
+ import { prefix as messaging_prefix } from "./k~0.mjs";
4
4
  function cssIntegrationsEnabled(integrations) {
5
5
  const names = integrations.length > 0 ? integrations.join(',') : 'none';
6
6
  return `${messaging_prefix('debug')} css integrations=${integrations.length} names=${names}`;
@@ -72,6 +72,22 @@ function lateCssImportIgnored(issuerPath, line) {
72
72
  `Move the ${pintor.blue('@import')} above every other rule to make it load.`
73
73
  ].join('\n');
74
74
  }
75
+ function unplacedStyleImport(issuerPath, imports, declared) {
76
+ const first = imports[0];
77
+ const where = first?.line ? `${issuerPath}:${first.line}` : issuerPath;
78
+ const request = first?.request || './styles.css';
79
+ return [
80
+ `${messaging_prefix('warn')} A stylesheet imported only for its side effect styles nothing in a content script.`,
81
+ `${pintor.gray('PATH')} ${pintor.underline(where)}`,
82
+ ...imports.map((entry)=>`${pintor.gray('IMPORT')} ${pintor.blue(`import '${entry.request}'`)}`),
83
+ `There the import evaluates to the sheet as a ${pintor.blue('data:')} URL, and no code reads it.`,
84
+ `Read the value and place it: ${pintor.blue(`import href from '${request}'`)}, then set it on a ${pintor.blue('<link rel="stylesheet">')}.`,
85
+ ...declared ? [
86
+ `Or list the sheet under ${pintor.blue("content_scripts[].css")} in manifest.json, or use a CSS module (${pintor.blue('.module.css')}).`,
87
+ `Extension.js places it for you only in the shadow root of a host marked ${pintor.blue('data-extension-root')}.`
88
+ ] : []
89
+ ].join('\n');
90
+ }
75
91
  function postCssConfigUnreadable(configPath, error) {
76
92
  return `${messaging_prefix('warn')} Could not load the PostCSS config at ${pintor.gray(configPath)}.\n${String(error?.message || error)}\nThe build continues without it. Fix the file or remove it.`;
77
93
  }
@@ -81,4 +97,4 @@ function postCssConfigPluginsShape(configPath, found) {
81
97
  function cssMinifierDroppedRules(assetName, tokens) {
82
98
  return `${messaging_prefix('warn')} The CSS minimizer dropped ${tokens.join(', ')} from ${pintor.gray(assetName)}.\nShipped that stylesheet unminified so production keeps every rule development keeps.`;
83
99
  }
84
- export { cssConfigsDetected, cssIntegrationsEnabled, cssMinifierDroppedRules, cssParseErrorShippedVerbatim, deadCssUrlRef, isUsingIntegration, lateCssImportIgnored, missingSassDependency, postCssConfigPluginsShape, postCssConfigUnreadable, postCssPluginNotResolved, preprocessorShippedUncompiled };
100
+ export { cssConfigsDetected, cssIntegrationsEnabled, cssMinifierDroppedRules, cssParseErrorShippedVerbatim, deadCssUrlRef, isUsingIntegration, lateCssImportIgnored, missingSassDependency, postCssConfigPluginsShape, postCssConfigUnreadable, postCssPluginNotResolved, preprocessorShippedUncompiled, unplacedStyleImport };
@@ -1,5 +1,10 @@
1
1
  import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
2
  const EXTENSIONJS_CONTENT_SCRIPT_LAYER = "extensionjs-content-script";
3
+ const EXTENSIONJS_MAIN_WORLD_IMPORT_LAYER = `${EXTENSIONJS_CONTENT_SCRIPT_LAYER}-main-world-import`;
4
+ const MAIN_WORLD_COPY_SUFFIX = '.extjs-main-world';
5
+ function mainWorldCopyEntryName(entryName) {
6
+ return `${entryName}${MAIN_WORLD_COPY_SUFFIX}`;
7
+ }
3
8
  const CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX = "content_scripts/content-";
4
9
  function getCanonicalContentScriptEntryName(index) {
5
10
  return `${CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX}${index}`;
@@ -30,4 +35,4 @@ function getContentScriptCssProbeMarker(entryName) {
30
35
  function createContentScriptCssProbeMarkerPattern() {
31
36
  return /__EXTENSIONJS_CSS_PROBE__([^"'`\s\\]+?\.css)__/g;
32
37
  }
33
- export { CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX, CONTENT_SCRIPT_CSS_PROBE_MARKER_PREFIX, EXTENSIONJS_CONTENT_SCRIPT_LAYER, createContentScriptCssProbeMarkerPattern, getCanonicalContentScriptCssAssetName, getCanonicalContentScriptEntryName, getCanonicalContentScriptJsAssetName, getContentScriptCssProbeMarker, isCanonicalContentScriptAsset, parseCanonicalContentScriptAsset };
38
+ export { CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX, CONTENT_SCRIPT_CSS_PROBE_MARKER_PREFIX, EXTENSIONJS_CONTENT_SCRIPT_LAYER, EXTENSIONJS_MAIN_WORLD_IMPORT_LAYER, MAIN_WORLD_COPY_SUFFIX, createContentScriptCssProbeMarkerPattern, getCanonicalContentScriptCssAssetName, getCanonicalContentScriptEntryName, getCanonicalContentScriptJsAssetName, getContentScriptCssProbeMarker, isCanonicalContentScriptAsset, mainWorldCopyEntryName, parseCanonicalContentScriptAsset };
package/dist/bridge.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
2
  import { WebSocket } from "ws";
3
- import { readyContractPath, logsPath } from "./771~0.mjs";
4
- import { CONTROL_WS_PATH, LOG_CONTEXTS } from "./285~0.mjs";
5
- import { resolveProjectStructureSync, getDirs } from "./469~0.mjs";
3
+ import { readyContractPath, logsPath } from "./5h~0.mjs";
4
+ import { CONTROL_WS_PATH, LOG_CONTEXTS } from "./t~0.mjs";
5
+ import { resolveProjectStructureSync, getDirs } from "./cp~0.mjs";
6
6
  import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
7
7
  import * as __rspack_external_node_path_806ed179 from "node:path";
8
8
  function readReadyContractDocument(projectPath, browser = 'chrome') {
@@ -28,11 +28,14 @@ function readReadyContract(projectPath, browser = 'chrome') {
28
28
  schema: 'number' == typeof c.schema ? c.schema : void 0,
29
29
  logsPath: c.logsPath,
30
30
  status: c.status,
31
+ command: 'string' == typeof c.command ? c.command : void 0,
31
32
  engine: 'string' == typeof c.engine ? c.engine : void 0,
32
33
  pid: 'number' == typeof c.pid ? c.pid : void 0,
34
+ pidStartedAt: 'string' == typeof c.pidStartedAt ? c.pidStartedAt : void 0,
33
35
  cdpPort: 'number' == typeof c.cdpPort ? c.cdpPort : void 0,
34
36
  rdpPort: 'number' == typeof c.rdpPort ? c.rdpPort : void 0,
35
37
  browserPid: 'number' == typeof c.browserPid ? c.browserPid : void 0,
38
+ browserStartedAt: 'string' == typeof c.browserStartedAt ? c.browserStartedAt : void 0,
36
39
  startedAt: 'string' == typeof c.startedAt ? c.startedAt : void 0,
37
40
  browserExitedAt: 'string' == typeof c.browserExitedAt ? c.browserExitedAt : void 0,
38
41
  browserExitCode: 'number' == typeof c.browserExitCode ? c.browserExitCode : void 0,
@@ -95,7 +98,10 @@ class BridgeConsumer {
95
98
  type: 'hello',
96
99
  v: 1,
97
100
  role: 'consumer',
98
- instanceId: this.opts.instanceId
101
+ instanceId: this.opts.instanceId,
102
+ ...this.opts.token ? {
103
+ token: this.opts.token
104
+ } : {}
99
105
  }));
100
106
  } catch {}
101
107
  });
@@ -203,7 +209,7 @@ class BridgeController {
203
209
  settled = true;
204
210
  clearTimeout(connectTimer);
205
211
  const flag = this.opts.unlockFlag || '--allow-control';
206
- const detail = 4003 === code ? `control is off in the session that answered, so it accepts no controller. A session turns control on with ${flag}, and one that had the flag and still answers this way needs \`extension doctor\`.` : 4001 === code ? "the session that wrote ready.json has been replaced. Re-read ready.json or restart the dev session." : 4002 === code ? "the session did not understand the hello. Update the CLI and the dev session to the same Extension.js version." : 'the session closed the socket during the handshake.';
212
+ const detail = 4003 === code ? `control is off in the session that answered, so it accepts no controller. A session turns control on with ${flag}, and one that had the flag and still answers this way needs \`extension doctor\`.` : 4001 === code ? "the session that wrote ready.json has been replaced. Re-read ready.json or restart the session." : 4002 === code ? "the session did not understand the hello. Update the CLI and the session to the same Extension.js version." : 'the session closed the socket during the handshake.';
207
213
  reject(Object.assign(new Error(`control channel refused the controller (code ${code}${reason ? `: ${reason}` : ''}). ${detail}`), {
208
214
  closeCode: code
209
215
  }));
@@ -417,7 +423,7 @@ var bridge_entry_CLOSE_CONTROL_UNAVAILABLE = 4003;
417
423
  var bridge_entry_CLOSE_SLOW_CONSUMER = 4008;
418
424
  var bridge_entry_CONTROL_ENVELOPE_VERSION = 1;
419
425
  var bridge_entry_LOG_EVENT_VERSION = 1;
420
- export { CONTROL_WS_PATH, LOG_CONTEXTS, REFUSAL_API_UNAVAILABLE, REFUSAL_NEEDS_HEADED_WINDOW, REFUSAL_NEEDS_USER_GESTURE, REFUSAL_SURFACE_NOT_DECLARED, REFUSAL_SURFACE_NOT_OPEN, REFUSAL_TAB_NOT_FOUND, REFUSAL_URL_REFUSED, readControlToken } from "./285~0.mjs";
421
- export { actionsPath, browserArtifactsDir, browserDistDir, browserProfileRootDir, buildSummaryPath, controlPortFilePath, controlTokenPath, eventsPath, logsPath, readyContractPath, sessionArtifactsRootDir, sessionStateDir } from "./771~0.mjs";
422
- export { readPersistedControlPort } from "./117~0.mjs";
426
+ export { CONTROL_WS_PATH, LOG_CONTEXTS, REFUSAL_API_UNAVAILABLE, REFUSAL_NEEDS_HEADED_WINDOW, REFUSAL_NEEDS_USER_GESTURE, REFUSAL_SURFACE_NOT_DECLARED, REFUSAL_SURFACE_NOT_OPEN, REFUSAL_TAB_NOT_FOUND, REFUSAL_URL_REFUSED, readControlToken } from "./t~0.mjs";
427
+ export { actionsPath, browserArtifactsDir, browserDistDir, browserProfileRootDir, buildSummaryPath, controlPortFilePath, controlTokenPath, eventsPath, logsPath, readyContractPath, sessionArtifactsRootDir, sessionStateDir } from "./5h~0.mjs";
428
+ export { readPersistedControlPort } from "./w~0.mjs";
423
429
  export { BridgeConsumer, BridgeController, LOG_LEVEL_FILTERS, LOG_LEVEL_ORDER, bridge_entry_CLOSE_BAD_HELLO as CLOSE_BAD_HELLO, bridge_entry_CLOSE_BAD_INSTANCE as CLOSE_BAD_INSTANCE, bridge_entry_CLOSE_CONTROL_UNAVAILABLE as CLOSE_CONTROL_UNAVAILABLE, bridge_entry_CLOSE_SLOW_CONSUMER as CLOSE_SLOW_CONSUMER, bridge_entry_CONTROL_ENVELOPE_VERSION as CONTROL_ENVELOPE_VERSION, bridge_entry_LOG_EVENT_VERSION as LOG_EVENT_VERSION, isAfterSince, logLevelRank, logQueryProblem, matchesLogQuery, parseLogLevelFilter, parseLogSince, readLogEvents, readReadyContract, readReadyContractDocument, resolveSessionProjectRoot, unknownLogContexts };