extension-develop 4.1.31 → 4.1.32

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 (88) hide show
  1. package/README.md +2 -0
  2. package/dist/105~0.mjs +1 -1
  3. package/dist/177~0.mjs +87 -19
  4. package/dist/273~0.mjs +13 -3
  5. package/dist/363~0.mjs +1874 -0
  6. package/dist/{896~0.mjs → 469~0.mjs} +116 -586
  7. package/dist/519~0.mjs +21 -8
  8. package/dist/616~0.mjs +1 -1
  9. package/dist/771~0.mjs +103 -0
  10. package/dist/832~0.mjs +229 -463
  11. package/dist/840~0.mjs +1189 -54
  12. package/dist/846~0.mjs +453 -0
  13. package/dist/852~0.mjs +8 -6
  14. package/dist/bridge.mjs +3 -2
  15. package/dist/command-preview.d.ts +1 -0
  16. package/dist/contract/codes.json +39 -29
  17. package/dist/contract/envelope.schema.json +16 -0
  18. package/dist/contract/golden.build.compile.json +20 -3
  19. package/dist/contract/golden.eval.csp-blocks-eval.page.json +15 -0
  20. package/dist/css-parse-guard-loader.mjs +3 -1
  21. package/dist/dead-css-url-loader.mjs +129 -13
  22. package/dist/dev-server/cleanup.d.ts +1 -1
  23. package/dist/dev-server/lifecycle-stream.d.ts +14 -3
  24. package/dist/dev-server/session-start-prune.d.ts +13 -0
  25. package/dist/dev-server~0.mjs +91 -14
  26. package/dist/ensure-hmr-for-scripts.js +4 -8
  27. package/dist/ensure-hmr-for-scripts.mjs +4 -8
  28. package/dist/extension-js-devtools/build-stamp.json +2 -2
  29. package/dist/extension-js-theme/build-stamp.json +2 -2
  30. package/dist/feature-scripts-content-script-wrapper.js +7 -4
  31. package/dist/feature-scripts-content-script-wrapper.mjs +7 -4
  32. package/dist/lib/build-summary.d.ts +4 -1
  33. package/dist/lib/coded-warnings.d.ts +3 -0
  34. package/dist/lib/compilation-diagnostics.d.ts +23 -0
  35. package/dist/lib/config-loader.d.ts +2 -2
  36. package/dist/lib/config-resolved-plugin.d.ts +3 -2
  37. package/dist/lib/corepack-registry.d.ts +3 -0
  38. package/dist/lib/diagnostic-code.d.ts +6 -0
  39. package/dist/lib/merge-options.d.ts +1 -0
  40. package/dist/lib/messages.d.ts +4 -1
  41. package/dist/lib/messaging.d.ts +12 -4
  42. package/dist/lib/output-files.d.ts +11 -0
  43. package/dist/lib/package-manager.d.ts +2 -2
  44. package/dist/module.mjs +2 -1
  45. package/dist/plugin-browsers/index.d.ts +1 -0
  46. package/dist/plugin-compatibility/compatibility-lib/free-browser-references.d.ts +9 -0
  47. package/dist/plugin-css/css-lib/dead-url-refs.d.ts +5 -1
  48. package/dist/plugin-css/css-lib/inline-content-script-css.d.ts +4 -2
  49. package/dist/plugin-css/css-lib/line-rewrite-source-map.d.ts +8 -0
  50. package/dist/plugin-css/dead-css-url-loader.d.ts +0 -2
  51. package/dist/plugin-css/public-css-url-loader.d.ts +8 -3
  52. package/dist/plugin-playwright/index.d.ts +9 -4
  53. package/dist/plugin-reload/classify-reload.d.ts +2 -0
  54. package/dist/plugin-reload/messages.d.ts +1 -0
  55. package/dist/plugin-reload/reload-lib/dev-content-scripts.d.ts +4 -0
  56. package/dist/plugin-reload/steps/prune-unreachable-chunks.d.ts +5 -0
  57. package/dist/plugin-special-folders/messages.d.ts +1 -1
  58. package/dist/plugin-special-folders/prune-removed-public-files.d.ts +7 -0
  59. package/dist/plugin-static-assets/check-namespace-imports.d.ts +4 -0
  60. package/dist/plugin-static-assets/static-assets-lib/asset-output-name.d.ts +8 -0
  61. package/dist/plugin-static-assets/static-assets-lib/messages.d.ts +1 -0
  62. package/dist/plugin-web-extension/feature-html/html-lib/utils.d.ts +2 -1
  63. package/dist/plugin-web-extension/feature-icons/messages.d.ts +1 -4
  64. package/dist/plugin-web-extension/feature-locales/get-locales.d.ts +2 -0
  65. package/dist/plugin-web-extension/feature-locales/messages.d.ts +3 -1
  66. package/dist/plugin-web-extension/feature-locales/validation.d.ts +1 -0
  67. package/dist/plugin-web-extension/feature-manifest/manifest-lib/filter-keys-safari.d.ts +1 -0
  68. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/content_scripts.d.ts +1 -0
  69. package/dist/plugin-web-extension/feature-manifest/messages.d.ts +1 -0
  70. package/dist/plugin-web-extension/feature-scripts/index.d.ts +2 -0
  71. package/dist/plugin-web-extension/feature-scripts/messages.d.ts +4 -3
  72. package/dist/plugin-web-extension/feature-scripts/scripts-lib/load-time-constants.d.ts +11 -0
  73. package/dist/plugin-web-extension/feature-scripts/steps/trace-runtime-loaded-files.d.ts +4 -0
  74. package/dist/plugin-web-extension/feature-scripts/steps/warn-missing-build-constants.d.ts +24 -0
  75. package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/declared-pages.d.ts +2 -0
  76. package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/resolve-war.d.ts +5 -0
  77. package/dist/plugin-web-extension/index.d.ts +1 -0
  78. package/dist/plugin-web-extension/shared/classic-concat.d.ts +1 -0
  79. package/dist/plugin-web-extension/shared/compilation-issues.d.ts +1 -1
  80. package/dist/preprocessor-passthrough-loader.mjs +3 -1
  81. package/dist/public-css-url-loader.mjs +1 -1
  82. package/dist/rspack-config~0.mjs +4925 -5885
  83. package/dist/stats-handler~0.mjs +12 -4
  84. package/dist/types.d.ts +19 -2
  85. package/dist/zip~0.mjs +20 -2
  86. package/package.json +4 -4
  87. package/dist/300~0.mjs +0 -394
  88. package/dist/747~0.mjs +0 -90
package/dist/519~0.mjs CHANGED
@@ -30,7 +30,7 @@ function injectedCompiledSourceLiteral(assetName, literal, emittedPath) {
30
30
  lines.push(`Inject the emitted path: ${pintor.blue(emittedPath)}.`);
31
31
  return lines.join('\n');
32
32
  }
33
- const SPLIT_ENTRY_RECIPE_URL = 'https://extension.js.org/docs/features/rspack-configuration#share-a-module-between-entries';
33
+ const SPLIT_ENTRY_RECIPE_URL = 'https://extension.js.org/docs/features/rspack-configuration?utm_source=cli#share-a-module-between-entries';
34
34
  const SPLIT_ENTRY_SURFACES = {
35
35
  page: {
36
36
  loads: (entryName)=>`${entryName}.html references only`,
@@ -85,28 +85,41 @@ function fetchedFileDependencyMissing(assetName, literal, expectedPath) {
85
85
  lines.push(`Move the file so it resolves to ${pintor.blue(expectedPath)}, or serve it from ${pintor.blue('public/')} so it ships with the extension.`);
86
86
  return lines.join('\n');
87
87
  }
88
- function getURLDependencyMissing(assetName, literal, expectedPath) {
88
+ function moveFileHint(expectedPath, foundOutside) {
89
+ if (foundOutside) return `The file exists at ${pintor.blue(foundOutside)}, outside the manifest folder. Declare it under ${pintor.blue('web_accessible_resources')} so it ships at that path, or move it to ${pintor.blue(expectedPath)} or ${pintor.blue('public/')}.`;
90
+ return `Move the file to ${pintor.blue(expectedPath)} or ${pintor.blue('public/')} so it ships with the extension.`;
91
+ }
92
+ function getURLDependencyMissing(assetName, literal, expectedPath, foundOutside) {
89
93
  const lines = [];
90
94
  lines.push(`${assetName} references '${literal}' via chrome.runtime.getURL(), but the file isn't in the output.`);
91
95
  lines.push(`${pintor.gray('NOT FOUND')} ${pintor.underline(expectedPath)}`);
92
96
  lines.push("The reference fails at runtime.");
93
- lines.push(`Move the file to ${pintor.blue(expectedPath)} or ${pintor.blue('public/')} so it ships with the extension.`);
97
+ lines.push(moveFileHint(expectedPath, foundOutside));
94
98
  return lines.join('\n');
95
99
  }
96
- function runtimeSetSurfaceDependencyMissing(assetName, literal, expectedPath) {
100
+ function runtimeSetSurfaceDependencyMissing(assetName, literal, expectedPath, foundOutside) {
97
101
  const lines = [];
98
102
  lines.push(`${assetName} names '${literal}' at runtime (setPopup, setIcon, panels.create, tabs.create and friends), but the file isn't in the output.`);
99
103
  lines.push(`${pintor.gray('NOT FOUND')} ${pintor.underline(expectedPath)}`);
100
104
  lines.push("The surface opens a 404 at runtime.");
101
- lines.push(`Move the file to ${pintor.blue(expectedPath)} or ${pintor.blue('public/')} so it ships with the extension.`);
105
+ lines.push(moveFileHint(expectedPath, foundOutside));
102
106
  return lines.join('\n');
103
107
  }
104
- function staticImportDependencyMissing(assetName, literal, expectedPath) {
108
+ function staticImportDependencyMissing(assetName, literal, expectedPath, foundOutside) {
105
109
  const lines = [];
106
110
  lines.push(`${assetName} (copied verbatim into the output) imports '${literal}', but the file isn't in the output.`);
107
111
  lines.push(`${pintor.gray('NOT FOUND')} ${pintor.underline(expectedPath)}`);
108
112
  lines.push("The import fails at runtime.");
109
- lines.push(`Move the file to ${pintor.blue(expectedPath)} or ${pintor.blue('public/')} so it ships with the extension.`);
113
+ lines.push(moveFileHint(expectedPath, foundOutside));
114
+ return lines.join('\n');
115
+ }
116
+ function buildConstantNeverDefined(file, name, entryName) {
117
+ const lines = [];
118
+ lines.push(`${file} reads ${name} as it loads, but nothing defines it, so ${entryName} throws "${name} is not defined" before it registers a listener.`);
119
+ lines.push(`${pintor.gray('FILE')} ${pintor.underline(file)}`);
120
+ lines.push(`${pintor.gray('CONSTANT')} ${pintor.underline(name)}`);
121
+ lines.push(`- Set it in extension.config.js: ${pintor.blue(`define: {${name}: value}`)}, or ${pintor.blue("browser.<vendor>.define")} for a value per browser.`);
122
+ lines.push("- Or declare it in the file before the first read.");
110
123
  return lines.join('\n');
111
124
  }
112
125
  function reservedScriptsFolder(relPath, indicators) {
@@ -122,4 +135,4 @@ function compiledSourceSpelling(assetName, api, literal, emittedPath) {
122
135
  lines.push(`Reference the emitted path: ${pintor.blue(emittedPath)}.`);
123
136
  return lines.join('\n');
124
137
  }
125
- export { compiledSourceSpelling, entrySplitAcrossInitialFiles, fetchedFileDependencyMissing, getURLDependencyMissing, importScriptsDependencyMissing, injectedCompiledSourceLiteral, injectedFileDependencyMissing, reservedScriptsFolder, runtimeSetSurfaceDependencyMissing, staticImportDependencyMissing, workerStartedFromPageContext };
138
+ export { buildConstantNeverDefined, compiledSourceSpelling, entrySplitAcrossInitialFiles, fetchedFileDependencyMissing, getURLDependencyMissing, importScriptsDependencyMissing, injectedCompiledSourceLiteral, injectedFileDependencyMissing, reservedScriptsFolder, runtimeSetSurfaceDependencyMissing, staticImportDependencyMissing, workerStartedFromPageContext };
package/dist/616~0.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
- import { CONTROL_TOKEN_FILE_PREFIX, controlTokenPath, legacyControlTokenPath, sessionStateDir } from "./896~0.mjs";
2
+ import { CONTROL_TOKEN_FILE_PREFIX, controlTokenPath, legacyControlTokenPath, sessionStateDir } from "./771~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
  import * as __rspack_external_node_crypto_2e7c4b46 from "node:crypto";
package/dist/771~0.mjs ADDED
@@ -0,0 +1,103 @@
1
+ import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
+ import { spawnSync } from "node:child_process";
3
+ import { humanLine } from "./852~0.mjs";
4
+ import { sessionStateIgnoreAdded } from "./469~0.mjs";
5
+ import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
6
+ import * as __rspack_external_node_path_806ed179 from "node:path";
7
+ function sessionStateDir(projectPath) {
8
+ return __rspack_external_node_path_806ed179.resolve(projectPath, '.extension-js');
9
+ }
10
+ function controlPortFilePath(projectPath, browser) {
11
+ return __rspack_external_node_path_806ed179.join(sessionStateDir(projectPath), `control-port-${browser}`);
12
+ }
13
+ function legacyControlPortFilePath(projectPath, browser) {
14
+ return __rspack_external_node_path_806ed179.join(browserArtifactsDir(projectPath, browser), 'control-port');
15
+ }
16
+ const CONTROL_TOKEN_FILE_PREFIX = 'control-token-';
17
+ function controlTokenPath(projectPath, browser) {
18
+ return __rspack_external_node_path_806ed179.join(sessionStateDir(projectPath), `${CONTROL_TOKEN_FILE_PREFIX}${browser}`);
19
+ }
20
+ function legacyControlTokenPath(projectPath) {
21
+ return __rspack_external_node_path_806ed179.join(sessionStateDir(projectPath), 'control.token');
22
+ }
23
+ function sessionArtifactsRootDir(projectPath) {
24
+ return __rspack_external_node_path_806ed179.resolve(projectPath, 'dist', 'extension-js');
25
+ }
26
+ const SESSION_ARTIFACTS_IGNORE_CONTENT = "# Extension.js session state: managed browser profiles (cookies, history,\n# logins), session logs and machine contracts. Personal data lives here:\n# this directory must never be committed or shipped.\n*\n";
27
+ function sessionArtifactsIgnoreFilePath(projectPath) {
28
+ return __rspack_external_node_path_806ed179.join(sessionArtifactsRootDir(projectPath), '.gitignore');
29
+ }
30
+ const PROJECT_ROOT_MARKERS = [
31
+ 'package.json',
32
+ 'deno.jsonc',
33
+ 'deno.json',
34
+ 'manifest.json'
35
+ ];
36
+ function holdsProjectRootMarker(projectPath) {
37
+ return PROJECT_ROOT_MARKERS.some((marker)=>__rspack_external_node_fs_1b05aee1.existsSync(__rspack_external_node_path_806ed179.join(projectPath, marker)));
38
+ }
39
+ function ensureSessionArtifactsIgnoreFile(projectPath) {
40
+ try {
41
+ if (!holdsProjectRootMarker(projectPath)) return;
42
+ const ignoreFile = sessionArtifactsIgnoreFilePath(projectPath);
43
+ if (__rspack_external_node_fs_1b05aee1.existsSync(ignoreFile)) return;
44
+ __rspack_external_node_fs_1b05aee1.mkdirSync(__rspack_external_node_path_806ed179.dirname(ignoreFile), {
45
+ recursive: true
46
+ });
47
+ __rspack_external_node_fs_1b05aee1.writeFileSync(ignoreFile, SESSION_ARTIFACTS_IGNORE_CONTENT);
48
+ } catch {}
49
+ }
50
+ function isAlreadyIgnoredByGit(projectPath) {
51
+ try {
52
+ const result = spawnSync('git', [
53
+ 'check-ignore',
54
+ '-q',
55
+ '--',
56
+ '.extension-js/'
57
+ ], {
58
+ cwd: projectPath,
59
+ stdio: 'ignore'
60
+ });
61
+ return 0 === result.status;
62
+ } catch {
63
+ return false;
64
+ }
65
+ }
66
+ function ensureSessionStateInProjectGitignore(projectPath) {
67
+ try {
68
+ const gitignorePath = __rspack_external_node_path_806ed179.resolve(projectPath, '.gitignore');
69
+ if (!__rspack_external_node_fs_1b05aee1.existsSync(gitignorePath)) return;
70
+ const content = __rspack_external_node_fs_1b05aee1.readFileSync(gitignorePath, 'utf8');
71
+ const lines = content.split(/\r?\n/).map((line)=>line.trim());
72
+ if (lines.includes('.extension-js') || lines.includes('.extension-js/')) return;
73
+ if (isAlreadyIgnoredByGit(projectPath)) return;
74
+ const prefix = content.length > 0 && !content.endsWith('\n') ? '\n' : '';
75
+ __rspack_external_node_fs_1b05aee1.appendFileSync(gitignorePath, `${prefix}\n# Extension.js local session state\n.extension-js\n`);
76
+ humanLine(sessionStateIgnoreAdded(gitignorePath));
77
+ } catch {}
78
+ }
79
+ function browserArtifactsDir(projectPath, browser) {
80
+ return __rspack_external_node_path_806ed179.join(sessionArtifactsRootDir(projectPath), browser);
81
+ }
82
+ function browserProfileRootDir(projectPath, browser) {
83
+ return __rspack_external_node_path_806ed179.join(sessionArtifactsRootDir(projectPath), 'profiles', `${browser}-profile`);
84
+ }
85
+ function browserDistDir(projectPath, browser) {
86
+ return __rspack_external_node_path_806ed179.resolve(projectPath, 'dist', browser);
87
+ }
88
+ function readyContractPath(projectPath, browser) {
89
+ return __rspack_external_node_path_806ed179.join(browserArtifactsDir(projectPath, browser), 'ready.json');
90
+ }
91
+ function eventsPath(projectPath, browser) {
92
+ return __rspack_external_node_path_806ed179.join(browserArtifactsDir(projectPath, browser), 'events.ndjson');
93
+ }
94
+ function logsPath(projectPath, browser) {
95
+ return __rspack_external_node_path_806ed179.join(browserArtifactsDir(projectPath, browser), 'logs.ndjson');
96
+ }
97
+ function actionsPath(projectPath, browser) {
98
+ return __rspack_external_node_path_806ed179.join(browserArtifactsDir(projectPath, browser), 'actions.ndjson');
99
+ }
100
+ function buildSummaryPath(projectPath, browser) {
101
+ return __rspack_external_node_path_806ed179.join(browserArtifactsDir(projectPath, browser), 'build-summary.json');
102
+ }
103
+ export { CONTROL_TOKEN_FILE_PREFIX, actionsPath, browserArtifactsDir, browserDistDir, browserProfileRootDir, buildSummaryPath, controlPortFilePath, controlTokenPath, ensureSessionArtifactsIgnoreFile, ensureSessionStateInProjectGitignore, eventsPath, legacyControlPortFilePath, legacyControlTokenPath, logsPath, readyContractPath, sessionArtifactsRootDir, sessionStateDir };