extension-develop 4.1.12 → 4.1.14

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 (111) hide show
  1. package/dist/0~dev-server.mjs +147 -81
  2. package/dist/0~rspack-config.mjs +1098 -694
  3. package/dist/0~zip.mjs +1 -1
  4. package/dist/101.mjs +190 -900
  5. package/dist/129.mjs +89 -0
  6. package/dist/278.mjs +52 -0
  7. package/dist/292.mjs +61 -0
  8. package/dist/372.mjs +87 -0
  9. package/dist/518.mjs +434 -0
  10. package/dist/77.mjs +933 -0
  11. package/dist/80.mjs +6 -4
  12. package/dist/839.mjs +176 -39
  13. package/dist/845.mjs +10 -1
  14. package/dist/887.mjs +1 -1
  15. package/dist/bridge-entry.d.ts +2 -1
  16. package/dist/bridge.mjs +56 -7
  17. package/dist/css-parse-guard-loader.mjs +3 -0
  18. package/dist/dead-css-url-loader.mjs +51 -24
  19. package/dist/dev-server/cleanup.d.ts +2 -1
  20. package/dist/dev-server/control-bridge/broker.d.ts +1 -0
  21. package/dist/dev-server/control-bridge/contracts.d.ts +2 -0
  22. package/dist/dev-server/control-bridge/logs-query.d.ts +12 -1
  23. package/dist/dev-server/control-bridge/producer-runtime.d.ts +1 -1
  24. package/dist/dev-server/messages.d.ts +8 -0
  25. package/dist/dev-server/session-restart.d.ts +29 -0
  26. package/dist/ensure-hmr-for-scripts.js +37 -20
  27. package/dist/ensure-hmr-for-scripts.mjs +37 -20
  28. package/dist/extension-js-devtools/chrome/content_scripts/content-0.js +2 -2
  29. package/dist/extension-js-devtools/chrome/scripts/logger-client.js +1 -1
  30. package/dist/extension-js-devtools/chromium/content_scripts/content-0.js +2 -2
  31. package/dist/extension-js-devtools/chromium/scripts/logger-client.js +1 -1
  32. package/dist/extension-js-devtools/edge/content_scripts/content-0.js +2 -2
  33. package/dist/extension-js-devtools/edge/scripts/logger-client.js +1 -1
  34. package/dist/extension-js-devtools/firefox/content_scripts/content-0.js +2 -2
  35. package/dist/extension-js-devtools/firefox/scripts/logger-client.js +1 -1
  36. package/dist/feature-scripts-classic-concat-loader.js +58 -5
  37. package/dist/feature-scripts-classic-concat-loader.mjs +58 -5
  38. package/dist/feature-scripts-content-script-wrapper.js +14 -17
  39. package/dist/feature-scripts-content-script-wrapper.mjs +14 -17
  40. package/dist/feature-scripts-native-geturl-import-loader.mjs +10 -3
  41. package/dist/lib/asset-source-maps.d.ts +7 -0
  42. package/dist/lib/config-loader.d.ts +7 -34
  43. package/dist/lib/loader-source-maps.d.ts +17 -0
  44. package/dist/lib/messages.d.ts +1 -0
  45. package/dist/lib/msg-placeholders.d.ts +2 -0
  46. package/dist/lib/paths.d.ts +2 -0
  47. package/dist/lib/project.d.ts +3 -0
  48. package/dist/lib/session-project-root.d.ts +1 -0
  49. package/dist/minimum-script-file.js +41 -1
  50. package/dist/minimum-script-file.mjs +41 -1
  51. package/dist/module.d.ts +1 -1
  52. package/dist/module.mjs +1 -1
  53. package/dist/plugin-css/css-lib/dead-url-refs.d.ts +5 -0
  54. package/dist/plugin-css/css-lib/inline-content-script-css.d.ts +32 -0
  55. package/dist/plugin-css/css-lib/messages.d.ts +3 -0
  56. package/dist/plugin-css/css-lib/verbatim-css.d.ts +9 -0
  57. package/dist/plugin-css/css-parse-guard-loader.d.ts +3 -0
  58. package/dist/plugin-css/css-tools/postcss.d.ts +1 -0
  59. package/dist/plugin-css/dead-css-url-loader.d.ts +8 -4
  60. package/dist/plugin-css/index.d.ts +1 -0
  61. package/dist/plugin-js-frameworks/js-frameworks-lib/jsx-transform.d.ts +10 -0
  62. package/dist/plugin-js-frameworks/js-tools/solid-jsx-runtime.d.ts +8 -0
  63. package/dist/plugin-js-frameworks/js-tools/solid.d.ts +3 -0
  64. package/dist/plugin-js-frameworks/swc-targets.d.ts +3 -0
  65. package/dist/plugin-reload/classify-reload.d.ts +6 -0
  66. package/dist/plugin-reload/index.d.ts +2 -1
  67. package/dist/plugin-reload/reload-dispatch.d.ts +1 -0
  68. package/dist/plugin-special-folders/folder-extensions/resolve-dirs.d.ts +1 -0
  69. package/dist/plugin-special-folders/folder-extensions/utils.d.ts +3 -0
  70. package/dist/plugin-special-folders/messages.d.ts +2 -0
  71. package/dist/plugin-special-folders/resolve-public-folder.d.ts +13 -0
  72. package/dist/plugin-web-extension/feature-html/html-lib/assets.d.ts +1 -1
  73. package/dist/plugin-web-extension/feature-html/html-lib/base-href.d.ts +11 -0
  74. package/dist/plugin-web-extension/feature-html/html-lib/patch-html.d.ts +2 -2
  75. package/dist/plugin-web-extension/feature-html/html-lib/utils.d.ts +13 -0
  76. package/dist/plugin-web-extension/feature-html/index.d.ts +1 -0
  77. package/dist/plugin-web-extension/feature-html/steps/ensure-hmr-for-scripts.d.ts +1 -1
  78. package/dist/plugin-web-extension/feature-icons/extract-action-theme-icons.d.ts +2 -0
  79. package/dist/plugin-web-extension/feature-icons/omnibox-fields.d.ts +2 -0
  80. package/dist/plugin-web-extension/feature-icons/theme-image-fields.d.ts +2 -0
  81. package/dist/plugin-web-extension/feature-json/json-validation.d.ts +1 -0
  82. package/dist/plugin-web-extension/feature-manifest/index.d.ts +1 -0
  83. package/dist/plugin-web-extension/feature-manifest/manifest-lib/manifest.d.ts +1 -1
  84. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/index.d.ts +1 -1
  85. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/sandbox.d.ts +1 -1
  86. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/storage.d.ts +1 -1
  87. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/theme.d.ts +1 -1
  88. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/index.d.ts +1 -1
  89. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv2/chrome_settings_overrides.d.ts +1 -1
  90. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv2/index.d.ts +1 -1
  91. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv2/theme_experiment.d.ts +1 -1
  92. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv3/action.d.ts +2 -1
  93. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv3/declarative_net_request.d.ts +1 -1
  94. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv3/index.d.ts +1 -1
  95. package/dist/plugin-web-extension/feature-manifest/messages.d.ts +2 -0
  96. package/dist/plugin-web-extension/feature-manifest/normalize-manifest-path.d.ts +4 -0
  97. package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/patch-csp.d.ts +1 -1
  98. package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults.d.ts +1 -0
  99. package/dist/plugin-web-extension/feature-scripts/steps/native-geturl-import-loader.d.ts +7 -2
  100. package/dist/plugin-web-extension/feature-web-resources/collect-entry-imports.d.ts +1 -0
  101. package/dist/plugin-web-extension/index.d.ts +1 -0
  102. package/dist/plugin-web-extension/shared/html-surfaces.d.ts +19 -0
  103. package/dist/plugin-web-extension/shared/manifest-fields-change-detector.d.ts +1 -0
  104. package/dist/plugin-web-extension/shared/manifest-fields.d.ts +18 -0
  105. package/dist/plugin-web-extension/shared/manifest-path-assets.d.ts +4 -0
  106. package/dist/plugin-web-extension/shared/paths.d.ts +1 -0
  107. package/dist/solid-jsx-runtime.mjs +15 -0
  108. package/dist/types.d.ts +20 -7
  109. package/package.json +1 -1
  110. package/dist/494.mjs +0 -89
  111. package/dist/86.mjs +0 -36
@@ -1,6 +1,7 @@
1
- import type { Manifest } from '../../../../types';
1
+ import type { Manifest, ThemeIcon } from '../../../../types';
2
2
  export declare function action(manifest: Manifest): {
3
3
  action: {
4
+ theme_icons?: ThemeIcon[];
4
5
  default_icon?: string | chrome.runtime.ManifestIcons | undefined;
5
6
  default_title?: string | undefined;
6
7
  default_popup?: string | undefined;
@@ -1,2 +1,2 @@
1
1
  import type { Manifest } from '../../../../types';
2
- export declare function declarativeNetRequest(manifest: Manifest, manifestPath?: string): any;
2
+ export declare function declarativeNetRequest(manifest: Manifest, manifestPath?: string, projectPath?: string): any;
@@ -1,2 +1,2 @@
1
1
  import type { Manifest } from '../../../../types';
2
- export declare function manifestV3(manifest: Manifest, manifestPath?: string): any;
2
+ export declare function manifestV3(manifest: Manifest, manifestPath?: string, projectPath?: string): any;
@@ -10,3 +10,5 @@ export declare function manifestEmitSuccess(): string;
10
10
  export declare function manifestOverridesSummary(overrideKeys: number, devCssStubsAdded: number): string;
11
11
  export declare function manifestDepsTracked(addedCount: number): string;
12
12
  export declare function manifestLegacyWarningsSummary(count: number): string;
13
+ export declare function pageActionNotSupportedByBrowser(browser: string): string;
14
+ export declare function pageActionDroppedForBrowserAction(browser: string): string;
@@ -1,3 +1,7 @@
1
1
  export declare function normalizeManifestOutputPath(originalPath: string): string;
2
2
  export declare function manifestPageOutputTarget(raw: string, compiledTarget: string, manifestPath?: string): string;
3
+ export declare function manifestJsonOutputTarget(raw: string, compiledTarget: string, manifestPath?: string, projectPath?: string): string;
4
+ export declare function externalAssetOutputPath(normalized: string, root: string): string;
3
5
  export declare function iconOutputPath(raw: string): string;
6
+ export declare function themeIconOutputPath(raw: string, folder: 'action' | 'browser_action'): string;
7
+ export declare function themeImageOutputPath(raw: string): string;
@@ -1,5 +1,5 @@
1
1
  import type { Manifest } from '../../../../types';
2
- export declare function patchV2CSP(manifest: Manifest): string;
2
+ export declare function patchV2CSP(manifest: Manifest): Manifest['content_security_policy'];
3
3
  export declare function patchV3CSP(manifest: Manifest): {
4
4
  extension_pages: string;
5
5
  };
@@ -8,6 +8,7 @@ export declare function findInjectedOnlyPermissionUses(compilation: Pick<Compila
8
8
  export declare class ApplyDevDefaults {
9
9
  private readonly manifestPath?;
10
10
  private readonly browser;
11
+ private readonly devSession?;
11
12
  constructor(options: PluginInterface);
12
13
  apply(compiler: Compiler): void;
13
14
  }
@@ -1,3 +1,8 @@
1
1
  export declare function annotateGetURLDynamicImports(source: string): string;
2
- /** Loader entry: source-to-source, before the swc transform. */
3
- export default function nativeGetURLImportLoader(this: unknown, source: string): string;
2
+ /** Loader entry: source-to-source, before the swc transform. The map that
3
+ * arrived travels on: the annotation adds a comment inside a line, never a
4
+ * line, so the line map of the loader before this one still holds. */
5
+ export default function nativeGetURLImportLoader(this: {
6
+ callback?: (error: Error | null, content: string, map?: unknown) => void;
7
+ resourcePath?: string;
8
+ }, source: string, inputSourceMap?: unknown): string | undefined;
@@ -3,4 +3,5 @@ import type { FilepathList } from '../../types';
3
3
  export declare const EMITTED_ASSET_REF_PATTERN: RegExp;
4
4
  export declare function listEmittedAssetNames(compilation: Compilation): string[];
5
5
  export declare function collectReferencedRuntimePayloads(source: string, emittedAssetNames: string[]): string[];
6
+ export declare function collectContentScriptAsyncChunkFiles(compilation: Compilation): Record<string, string[]>;
6
7
  export declare function collectContentScriptEntryImports(compilation: Compilation, includeList?: FilepathList): Record<string, string[]>;
@@ -4,6 +4,7 @@ export declare class WebExtensionPlugin {
4
4
  static readonly name: string;
5
5
  readonly manifestPath: string;
6
6
  readonly browser: DevOptions['browser'];
7
+ readonly devSession?: boolean;
7
8
  constructor(options: PluginInterface);
8
9
  apply(compiler: Compiler): void;
9
10
  }
@@ -0,0 +1,19 @@
1
+ import type { DevOptions, Manifest } from '../../types';
2
+ export declare const ACTION_HTML_FEATURE = "action/index";
3
+ export declare const PAGE_ACTION_HTML_FEATURE = "page_action/index";
4
+ export declare const ACTION_HTML_OUTPUT = "action/index.html";
5
+ export declare const PAGE_ACTION_HTML_OUTPUT = "page_action/index.html";
6
+ type HtmlFields = Record<string, string | undefined>;
7
+ export declare function normalizePopupRef(ref: string): string;
8
+ export declare function popupRefsShareSource(a: unknown, b: unknown): boolean;
9
+ export declare function resolveManifestHtmlPath(context: string, relativePath: string): string;
10
+ export declare function actionPopupRef(manifest: Manifest | undefined): string | undefined;
11
+ export declare function pageActionPopupRef(manifest: Manifest | undefined): string | undefined;
12
+ export declare function isPageActionLiveSurface(manifest: Manifest | undefined, browser: DevOptions['browser'] | string | undefined): boolean;
13
+ export type PageActionDropReason = 'unsupported' | 'conflicts';
14
+ export declare function pageActionDropReason(manifest: Manifest | undefined, browser: DevOptions['browser'] | string | undefined): PageActionDropReason | undefined;
15
+ export declare function shouldDropPageAction(manifest: Manifest | undefined, browser: DevOptions['browser'] | string | undefined): boolean;
16
+ export declare function dropPageAction(manifest: Manifest): Manifest;
17
+ export declare function pageActionOutputTarget(manifest: Manifest): string;
18
+ export declare function applyIndependentHtmlSurfaces(html: HtmlFields | undefined, manifest: Manifest, context: string, browser: DevOptions['browser'] | string | undefined): HtmlFields;
19
+ export {};
@@ -8,5 +8,6 @@ export declare class ManifestFieldsChangeDetector {
8
8
  constructor(options: PluginInterface);
9
9
  private readSnapshot;
10
10
  apply(compiler: Compiler): void;
11
+ private tryAutoRestart;
11
12
  private emitErrors;
12
13
  }
@@ -0,0 +1,18 @@
1
+ import type { DevOptions } from '../../types';
2
+ export declare function getResolvedManifestFieldsData(options: {
3
+ manifestPath: string;
4
+ browser?: DevOptions['browser'];
5
+ }): {
6
+ html: Record<string, string | undefined>;
7
+ icons: Record<string, string | string[] | {
8
+ light?: string;
9
+ dark?: string;
10
+ size?: number;
11
+ }[] | undefined>;
12
+ json: Record<string, string | undefined>;
13
+ locales: string[] | undefined;
14
+ scripts: Record<string, string | string[] | undefined>;
15
+ web_accessible_resources: any;
16
+ theme: import("browser-extension-manifest-fields").ThemeFields;
17
+ semantic: import("browser-extension-manifest-fields").SemanticFields;
18
+ };
@@ -0,0 +1,4 @@
1
+ import type { FilepathList } from '../../types';
2
+ export declare function themeExperimentStylesheetEntries(manifestPath: string): FilepathList;
3
+ export declare function settingsOverridesIconFields(manifestPath: string): FilepathList;
4
+ export declare function settingsOverridesStartupPages(manifestPath: string): FilepathList;
@@ -5,3 +5,4 @@ export declare function unixify(filePath: string): string;
5
5
  export declare function resolveRootAbsoluteRef(ref: string, projectRoot: string, publicRoot?: string): string | undefined;
6
6
  /** Root-absolute refs in HTML (`src`/`href`) and CSS (`url(...)`). */
7
7
  export declare function collectRootAbsoluteRefs(source: string): Set<string>;
8
+ export declare function isManifestAddress(value: unknown): boolean;
@@ -0,0 +1,15 @@
1
+ import h from "solid-js/h";
2
+ const hyperscript = h;
3
+ function Fragment(props) {
4
+ return props.children;
5
+ }
6
+ function jsx(type, props = {}, key) {
7
+ const { children, ...rest } = props;
8
+ if (void 0 !== key) rest.key = key;
9
+ return void 0 === children ? hyperscript(type, rest) : hyperscript(type, rest, children);
10
+ }
11
+ const jsxs = jsx;
12
+ function jsxDEV(type, props = {}, key) {
13
+ return jsx(type, props, key);
14
+ }
15
+ export { Fragment, jsx, jsxDEV, jsxs };
package/dist/types.d.ts CHANGED
@@ -14,6 +14,9 @@ export type ChromeManifest = Partial<chrome.runtime.ManifestV2> & Partial<chrome
14
14
  browser_action?: {
15
15
  theme_icons?: ThemeIcon[];
16
16
  };
17
+ action?: chrome.runtime.ManifestV3['action'] & {
18
+ theme_icons?: ThemeIcon[];
19
+ };
17
20
  omnibox?: {
18
21
  keyword?: string;
19
22
  default_icon?: string | Record<string, string>;
@@ -31,6 +34,10 @@ export type PluginInterface = {
31
34
  browser?: DevOptions['browser'];
32
35
  includeList?: FilepathList;
33
36
  transpilePackages?: string[];
37
+ /** True inside `extension dev`: the one axis that turns dev instrumentation
38
+ * (dev CSP, injected permissions, reload client, page HMR) on. A build in
39
+ * development mode is shippable and keeps the author's manifest. */
40
+ devSession?: boolean;
34
41
  };
35
42
  export interface LoaderInterface extends RspackLoaderContext<LoaderInterface> {
36
43
  manifestPath: string;
@@ -207,7 +214,9 @@ export interface BuildOptions {
207
214
  * preserve historical behavior. Setting 'development' is useful for
208
215
  * staging/QA dists that should still pass through the bundler's debug
209
216
  * pipeline (sourcemaps, looser minification). Mirrors `vite build --mode`
210
- * and `webpack --mode`.
217
+ * and `webpack --mode`. The artifact stays shippable: it carries the
218
+ * author's CSP and permissions, no reload client, and its zip holds no
219
+ * maps. Only `extension dev` turns the dev instrumentation on.
211
220
  */
212
221
  mode?: 'development' | 'production' | 'none';
213
222
  /**
@@ -351,8 +360,10 @@ export type OutputConfig = {
351
360
  };
352
361
  /**
353
362
  * Per-category asset size budgets (bytes) for the perf-budgets plugin.
354
- * Set at the top level of extension.config.js, or per command via
355
- * `commands.dev.perfBudgets` / `commands.build.perfBudgets`.
363
+ * Set at the top level of extension.config.js (weakest), under
364
+ * `browser.<vendor>.perfBudgets`, or per command via
365
+ * `commands.dev.perfBudgets` / `commands.build.perfBudgets` (strongest
366
+ * below a CLI flag).
356
367
  */
357
368
  export type PerfBudgetsConfig = Partial<Record<import('./plugin-perf-budgets').AssetCategory, number>>;
358
369
  export interface CommonWebpackOptions {
@@ -442,13 +453,15 @@ export interface FileConfig {
442
453
  */
443
454
  extensions?: CompanionExtensionsConfig;
444
455
  /**
445
- * Default transpile allowlist for all commands.
446
- * Per-command `commands.<name>.transpilePackages` overrides this value.
456
+ * Default transpile allowlist for all commands, the weakest layer.
457
+ * `browser.<vendor>.transpilePackages` overrides it, and per-command
458
+ * `commands.<name>.transpilePackages` overrides both.
447
459
  */
448
460
  transpilePackages?: string[];
449
461
  /**
450
- * Default per-category asset budgets for all commands.
451
- * Per-command `commands.dev|build.perfBudgets` overrides this value.
462
+ * Default per-category asset budgets for all commands, the weakest layer.
463
+ * `browser.<vendor>.perfBudgets` overrides it, and per-command
464
+ * `commands.dev|build.perfBudgets` overrides both.
452
465
  */
453
466
  perfBudgets?: PerfBudgetsConfig;
454
467
  config?: (config: Configuration) => Configuration;
package/package.json CHANGED
@@ -43,7 +43,7 @@
43
43
  "runtime"
44
44
  ],
45
45
  "name": "extension-develop",
46
- "version": "4.1.12",
46
+ "version": "4.1.14",
47
47
  "description": "Develop, build, preview, and package Extension.js projects.",
48
48
  "author": {
49
49
  "name": "Cezar Augusto",
package/dist/494.mjs DELETED
@@ -1,89 +0,0 @@
1
- import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
- import { spawnSync } from "node:child_process";
3
- import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
4
- import * as __rspack_external_node_path_c5b9b54f from "node:path";
5
- function sessionStateDir(projectPath) {
6
- return __rspack_external_node_path_c5b9b54f.resolve(projectPath, '.extension-js');
7
- }
8
- function controlPortFilePath(projectPath, browser) {
9
- return __rspack_external_node_path_c5b9b54f.join(sessionStateDir(projectPath), `control-port-${browser}`);
10
- }
11
- function legacyControlPortFilePath(projectPath, browser) {
12
- return __rspack_external_node_path_c5b9b54f.join(browserArtifactsDir(projectPath, browser), 'control-port');
13
- }
14
- function controlTokenPath(projectPath, browser) {
15
- return __rspack_external_node_path_c5b9b54f.join(sessionStateDir(projectPath), `control-token-${browser}`);
16
- }
17
- function legacyControlTokenPath(projectPath) {
18
- return __rspack_external_node_path_c5b9b54f.join(sessionStateDir(projectPath), 'control.token');
19
- }
20
- function sessionArtifactsRootDir(projectPath) {
21
- return __rspack_external_node_path_c5b9b54f.resolve(projectPath, 'dist', 'extension-js');
22
- }
23
- 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";
24
- function sessionArtifactsIgnoreFilePath(projectPath) {
25
- return __rspack_external_node_path_c5b9b54f.join(sessionArtifactsRootDir(projectPath), '.gitignore');
26
- }
27
- function ensureSessionArtifactsIgnoreFile(projectPath) {
28
- try {
29
- const ignoreFile = sessionArtifactsIgnoreFilePath(projectPath);
30
- if (__rspack_external_node_fs_5ea92f0c.existsSync(ignoreFile)) return;
31
- __rspack_external_node_fs_5ea92f0c.mkdirSync(__rspack_external_node_path_c5b9b54f.dirname(ignoreFile), {
32
- recursive: true
33
- });
34
- __rspack_external_node_fs_5ea92f0c.writeFileSync(ignoreFile, SESSION_ARTIFACTS_IGNORE_CONTENT);
35
- } catch {}
36
- }
37
- function isAlreadyIgnoredByGit(projectPath) {
38
- try {
39
- const result = spawnSync('git', [
40
- 'check-ignore',
41
- '-q',
42
- '--',
43
- '.extension-js/'
44
- ], {
45
- cwd: projectPath,
46
- stdio: 'ignore'
47
- });
48
- return 0 === result.status;
49
- } catch {
50
- return false;
51
- }
52
- }
53
- function ensureSessionStateInProjectGitignore(projectPath) {
54
- try {
55
- const gitignorePath = __rspack_external_node_path_c5b9b54f.resolve(projectPath, '.gitignore');
56
- if (!__rspack_external_node_fs_5ea92f0c.existsSync(gitignorePath)) return;
57
- const content = __rspack_external_node_fs_5ea92f0c.readFileSync(gitignorePath, 'utf8');
58
- const lines = content.split(/\r?\n/).map((line)=>line.trim());
59
- if (lines.includes('.extension-js') || lines.includes('.extension-js/')) return;
60
- if (isAlreadyIgnoredByGit(projectPath)) return;
61
- const prefix = content.length > 0 && !content.endsWith('\n') ? '\n' : '';
62
- __rspack_external_node_fs_5ea92f0c.appendFileSync(gitignorePath, `${prefix}\n# extension.js local session state\n.extension-js\n`);
63
- } catch {}
64
- }
65
- function browserArtifactsDir(projectPath, browser) {
66
- return __rspack_external_node_path_c5b9b54f.join(sessionArtifactsRootDir(projectPath), browser);
67
- }
68
- function browserProfileRootDir(projectPath, browser) {
69
- return __rspack_external_node_path_c5b9b54f.join(sessionArtifactsRootDir(projectPath), 'profiles', `${browser}-profile`);
70
- }
71
- function browserDistDir(projectPath, browser) {
72
- return __rspack_external_node_path_c5b9b54f.resolve(projectPath, 'dist', browser);
73
- }
74
- function readyContractPath(projectPath, browser) {
75
- return __rspack_external_node_path_c5b9b54f.join(browserArtifactsDir(projectPath, browser), 'ready.json');
76
- }
77
- function eventsPath(projectPath, browser) {
78
- return __rspack_external_node_path_c5b9b54f.join(browserArtifactsDir(projectPath, browser), 'events.ndjson');
79
- }
80
- function logsPath(projectPath, browser) {
81
- return __rspack_external_node_path_c5b9b54f.join(browserArtifactsDir(projectPath, browser), 'logs.ndjson');
82
- }
83
- function actionsPath(projectPath, browser) {
84
- return __rspack_external_node_path_c5b9b54f.join(browserArtifactsDir(projectPath, browser), 'actions.ndjson');
85
- }
86
- function buildSummaryPath(projectPath, browser) {
87
- return __rspack_external_node_path_c5b9b54f.join(browserArtifactsDir(projectPath, browser), 'build-summary.json');
88
- }
89
- export { actionsPath, browserArtifactsDir, browserDistDir, browserProfileRootDir, buildSummaryPath, controlPortFilePath, controlTokenPath, ensureSessionArtifactsIgnoreFile, ensureSessionStateInProjectGitignore, eventsPath, legacyControlPortFilePath, legacyControlTokenPath, logsPath, readyContractPath, sessionArtifactsRootDir, sessionStateDir };
package/dist/86.mjs DELETED
@@ -1,36 +0,0 @@
1
- import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
- import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
3
- import * as __rspack_external_node_path_c5b9b54f from "node:path";
4
- const ASSET_EXT = /\.(png|jpe?g|gif|webp|svg|avif|ico|bmp|cur|woff2?|ttf|otf|eot|mp3|mp4|webm|ogg|wav)$/i;
5
- const URL_REF = /url\(\s*(?:"([^"\n]*)"|'([^'\n]*)'|([^)'"\s]*))\s*\)/g;
6
- function toPosixPath(value) {
7
- return String(value).split(__rspack_external_node_path_c5b9b54f.sep).join('/');
8
- }
9
- function isDeadCssUrlRef(rawRequest, { issuerDir, roots }) {
10
- const req = String(rawRequest).split('?')[0].split('#')[0];
11
- if (!req || req.startsWith('//') || /^[a-z][a-z0-9+.-]*:/i.test(req)) return false;
12
- if (req.startsWith('~') || req.startsWith('@')) return false;
13
- const isRootRef = req.startsWith('/');
14
- const isRelativeRef = req.startsWith('./') || req.startsWith('../');
15
- const isBareAssetRef = !isRootRef && !isRelativeRef && ASSET_EXT.test(req);
16
- if (!isRootRef && !isRelativeRef && !isBareAssetRef) return false;
17
- const candidates = isRootRef ? roots.map((root)=>__rspack_external_node_path_c5b9b54f.join(root, req.slice(1))) : [
18
- __rspack_external_node_path_c5b9b54f.resolve(issuerDir, req),
19
- ...isBareAssetRef ? roots.map((root)=>__rspack_external_node_path_c5b9b54f.join(root, req)) : []
20
- ];
21
- return !candidates.some((candidate)=>__rspack_external_node_fs_5ea92f0c.existsSync(candidate));
22
- }
23
- function extractCssUrlRefs(source) {
24
- const found = [];
25
- const seen = new Set();
26
- URL_REF.lastIndex = 0;
27
- let match;
28
- while(null !== (match = URL_REF.exec(source))){
29
- const request = match[1] ?? match[2] ?? match[3] ?? '';
30
- if (!request || seen.has(request)) continue;
31
- seen.add(request);
32
- found.push(request);
33
- }
34
- return found;
35
- }
36
- export { extractCssUrlRefs, isDeadCssUrlRef, toPosixPath };