extension-develop 4.0.20 → 4.0.21

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.
@@ -12,7 +12,7 @@ import { filterKeysForThisBrowser as external_browser_extension_manifest_fields_
12
12
  import content_security_policy_parser from "content-security-policy-parser";
13
13
  import node_fs from "node:fs";
14
14
  import node_path from "node:path";
15
- import { debugExtensionsToLoad, package_namespaceObject, getDirs, asAbsolute, browserRunnerDisabled, treeWithDistFilesBrowser, packagingDistributionFiles, toPosixPath, resolveCompanionExtensionDirs, debugContextPath, PlaywrightPlugin, isGeckoBasedBrowser, spacerLine, messages_ready, CHROMIUM_FAMILY_ALIASES, treeWithSourceAndDistFiles, computeExtensionsToLoad, noCompanionExtensionsResolved, treeWithSourceFiles, bundlerFatalError, bundlerRecompiling, noEntrypointsDetected, GECKO_FAMILY_ALIASES, packagingSourceFiles, debugBrowser, debugOutputPath, manifestInvalidJson, isChromiumBasedBrowser, getSpecialFoldersDataForCompiler } from "./101.mjs";
15
+ import { debugExtensionsToLoad, package_namespaceObject, getDirs, asAbsolute, browserRunnerDisabled, treeWithDistFilesBrowser, packagingDistributionFiles, zipArtifactReady, resolveCompanionExtensionDirs, debugContextPath, toPosixPath, isGeckoBasedBrowser, spacerLine, PlaywrightPlugin, messages_ready, CHROMIUM_FAMILY_ALIASES, treeWithSourceAndDistFiles, computeExtensionsToLoad, noCompanionExtensionsResolved, treeWithSourceFiles, bundlerFatalError, bundlerRecompiling, noEntrypointsDetected, GECKO_FAMILY_ALIASES, packagingSourceFiles, debugBrowser, debugOutputPath, manifestInvalidJson, isChromiumBasedBrowser, getSpecialFoldersDataForCompiler } from "./101.mjs";
16
16
  import { stripBom, parseJsonSafe } from "./23.mjs";
17
17
  import { isResourceUnderDirs, canonicalizeDir, toResourceKey } from "./93.mjs";
18
18
  import { prefix as messaging_prefix, isDebug } from "./349.mjs";
@@ -1315,6 +1315,12 @@ class EnvPlugin {
1315
1315
  function sanitize(input) {
1316
1316
  return input.toLowerCase().replace(/[^a-z0-9 ]/gi, '').trim().replace(/\s+/g, '-');
1317
1317
  }
1318
+ function explicitZipFilename(input) {
1319
+ const flat = __rspack_external_node_path_c5b9b54f.basename(input.trim());
1320
+ const safe = flat.replace(/[<>:"/\\|?*\u0000-\u001f]/g, '').replace(/\.+$/, '').trim();
1321
+ if (!safe) return 'extension.zip';
1322
+ return /\.zip$/i.test(safe) ? safe : `${safe}.zip`;
1323
+ }
1318
1324
  function resolveManifestName(rawName, manifest, searchRoots, fallback) {
1319
1325
  const raw = 'string' == typeof rawName ? rawName : '';
1320
1326
  const msgMatch = raw.match(/^__MSG_(.+)__$/);
@@ -1394,8 +1400,8 @@ class ZipPlugin {
1394
1400
  if (this.zipData.zip) {
1395
1401
  const distZip = new adm_zip();
1396
1402
  distZip.addLocalFolder(outPath);
1397
- const filename = this.zipData.zipFilename ? sanitize(this.zipData.zipFilename) : name;
1398
- const distPath = __rspack_external_node_path_c5b9b54f.join(outPath, `${filename}.zip`);
1403
+ const zipName = this.zipData.zipFilename ? explicitZipFilename(this.zipData.zipFilename) : `${name}.zip`;
1404
+ const distPath = __rspack_external_node_path_c5b9b54f.join(outPath, zipName);
1399
1405
  if (isDebug()) console.log(packagingDistributionFiles(distPath));
1400
1406
  distZip.writeZip(distPath);
1401
1407
  created.push({
@@ -1403,6 +1409,13 @@ class ZipPlugin {
1403
1409
  path: distPath
1404
1410
  });
1405
1411
  }
1412
+ for (const artifact of created){
1413
+ let size = 0;
1414
+ try {
1415
+ size = __rspack_external_node_fs_5ea92f0c.statSync(artifact.path).size;
1416
+ } catch {}
1417
+ console.log(zipArtifactReady(this.browser, artifact.path, size));
1418
+ }
1406
1419
  if (isDebug()) {
1407
1420
  const sourceItem = created.find((c)=>'source' === c.kind);
1408
1421
  const distItem = created.find((c)=>'dist' === c.kind);
package/dist/101.mjs CHANGED
@@ -8,7 +8,7 @@ import node_fs from "node:fs";
8
8
  import node_path from "node:path";
9
9
  import { getSpecialFoldersData } from "browser-extension-manifest-fields";
10
10
  import { createHash } from "node:crypto";
11
- import { fmt, isDebug, artifactNoun as messaging_artifactNoun, prefix as messaging_prefix, card } from "./349.mjs";
11
+ import { fmt, browserRowValue, isDebug, artifactNoun as messaging_artifactNoun, prefix as messaging_prefix, card } from "./349.mjs";
12
12
  import { stripBom, parseJsonSafe } from "./23.mjs";
13
13
  import { findNearestDenoConfigSync, validateDenoConfig, PROJECT_MANIFEST_FILENAMES, readProjectDependencies } from "./80.mjs";
14
14
  import { readyContractPath, browserArtifactsDir, eventsPath as session_paths_eventsPath } from "./494.mjs";
@@ -57,6 +57,9 @@ function manifestNotFoundError(manifestPath, candidates = []) {
57
57
  function previewing(browser) {
58
58
  return `${getLoggingPrefix('info')} Preview the extension on ${capitalizedBrowserName(browser)}.`;
59
59
  }
60
+ function starting(browser) {
61
+ return `${getLoggingPrefix('info')} Start the extension on ${capitalizedBrowserName(browser)}.`;
62
+ }
60
63
  function previewSkippedNoBrowser(browser) {
61
64
  return `${getLoggingPrefix('info')} Skip the browser launch for ${capitalizedBrowserName(browser)} (no-browser).`;
62
65
  }
@@ -209,6 +212,9 @@ function downloadedProjectFolderNotFound(cwd, candidates) {
209
212
  function packagingSourceFiles(zipPath) {
210
213
  return `${messaging_prefix('debug')} zip pack=source gitignore=excluded path=${zipPath}`;
211
214
  }
215
+ function zipArtifactReady(browser, zipPath, sizeInBytes) {
216
+ return `${messaging_prefix('info')} zip browser=${String(browser)} path=${zipPath} (${getFileSize(sizeInBytes)})`;
217
+ }
212
218
  function packagingDistributionFiles(zipPath) {
213
219
  return `${messaging_prefix('debug')} zip pack=dist path=${zipPath}`;
214
220
  }
@@ -644,7 +650,7 @@ async function config_loader_isUsingExperimentalConfig(projectPath) {
644
650
  }
645
651
  return false;
646
652
  }
647
- var package_namespaceObject = /*#__PURE__*/ JSON.parse('{"rE":"4.0.20","El":{"@prefresh/core":"1.5.9","@prefresh/utils":"1.2.1","@rspack/core":"^2.1.1","@rspack/dev-server":"2.1.0","@rspack/plugin-preact-refresh":"2.0.1","@rspack/plugin-react-refresh":"2.0.2","@vue/compiler-sfc":"3.5.26","acorn":"^8.16.0","adm-zip":"^0.6.0","browser-extension-manifest-fields":"^2.2.9","case-sensitive-paths-webpack-plugin":"^2.4.0","content-security-policy-parser":"^0.6.0","dotenv":"^17.2.3","es-module-lexer":"^2.1.0","extension-from-store":"^0.1.1","go-git-it":"^5.1.5","ignore":"^7.0.5","less":"4.6.7","less-loader":"13.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","postcss":"8.5.18","postcss-loader":"8.2.1","postcss-preset-env":"11.1.1","postcss-scss":"4.0.9","preact":"10.27.3","prefers-yarn":"2.0.1","react-refresh":"0.18.0","sass-loader":"17.0.0","schema-utils":"^4.3.3","svelte-loader":"3.2.4","tiny-glob":"^0.2.9","vue":"3.5.26","vue-loader":"17.4.2","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.20.1"}}');
653
+ var package_namespaceObject = /*#__PURE__*/ JSON.parse('{"rE":"4.0.21","El":{"@prefresh/core":"1.5.9","@prefresh/utils":"1.2.1","@rspack/core":"^2.1.1","@rspack/dev-server":"2.1.0","@rspack/plugin-preact-refresh":"2.0.1","@rspack/plugin-react-refresh":"2.0.2","@vue/compiler-sfc":"3.5.26","acorn":"^8.16.0","adm-zip":"^0.6.0","browser-extension-manifest-fields":"^2.2.9","case-sensitive-paths-webpack-plugin":"^2.4.0","content-security-policy-parser":"^0.6.0","dotenv":"^17.2.3","es-module-lexer":"^2.1.0","extension-from-store":"^0.1.1","go-git-it":"^5.1.5","ignore":"^7.0.5","less":"4.6.7","less-loader":"13.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","postcss":"8.5.18","postcss-loader":"8.2.1","postcss-preset-env":"11.1.1","postcss-scss":"4.0.9","preact":"10.27.3","prefers-yarn":"2.0.1","react-refresh":"0.18.0","sass-loader":"17.0.0","schema-utils":"^4.3.3","svelte-loader":"3.2.4","tiny-glob":"^0.2.9","vue":"3.5.26","vue-loader":"17.4.2","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.20.1"}}');
648
654
  function asAbsolute(p) {
649
655
  return __rspack_external_node_path_c5b9b54f.isAbsolute(p) ? p : __rspack_external_node_path_c5b9b54f.resolve(p);
650
656
  }
@@ -1615,7 +1621,7 @@ function browserRunnerDisabled(args) {
1615
1621
  rows: [
1616
1622
  {
1617
1623
  label: 'Browser',
1618
- value: args.browserModeLabel || `${browserLabel} (build-only mode)`
1624
+ value: browserRowValue(String(args.browser || 'unknown'), args.browserModeLabel || `${browserLabel} (build-only mode)`)
1619
1625
  },
1620
1626
  {
1621
1627
  label: 'Extension',
@@ -2206,6 +2212,7 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions, browserLauncher
2206
2212
  const outputPath = computePreviewOutputPath(projectStructure, browser, previewOptions.outputPath);
2207
2213
  const distPath = getDistPath(packageJsonDir, browser);
2208
2214
  const metadataCommand = 'start' === previewOptions.metadataCommand ? 'start' : 'preview';
2215
+ const runningMessage = 'start' === metadataCommand ? starting : previewing;
2209
2216
  const metadata = createPlaywrightMetadataWriter({
2210
2217
  packageJsonDir,
2211
2218
  browser: String(browser),
@@ -2237,12 +2244,12 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions, browserLauncher
2237
2244
  browserModeLabel: `${browserLabel.charAt(0).toUpperCase() + browserLabel.slice(1)} (no-browser mode)`
2238
2245
  }));
2239
2246
  console.log(spacerLine());
2240
- console.log(previewing(browser));
2247
+ console.log(runningMessage(browser));
2241
2248
  console.log(previewSkippedNoBrowser(browser));
2242
2249
  metadata.writeReady();
2243
2250
  return;
2244
2251
  }
2245
- console.log(previewing(browser));
2252
+ console.log(runningMessage(browser));
2246
2253
  const safeBrowserConfig = sanitize(browserConfig);
2247
2254
  const safeCommandConfig = sanitize(commandConfig);
2248
2255
  const safePreviewOptions = sanitize(previewOptions);
@@ -2297,4 +2304,4 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions, browserLauncher
2297
2304
  await browserLauncher(resolvedOpts);
2298
2305
  metadata.writeReady();
2299
2306
  }
2300
- export { CHROMIUM_FAMILY_ALIASES, GECKO_FAMILY_ALIASES, PlaywrightPlugin, asAbsolute, assertNoManagedDependencyConflicts, authorInstallNotice, autoExitForceKill, autoExitModeEnabled, autoExitTriggered, browserLaunchFailed, browserRunnerDisabled, buildCommandFailed, buildSuccess, buildSuccessWithWarnings, buildWarningsDetails, buildWebpack, bundlerFatalError, bundlerRecompiling, computeExtensionsToLoad, createPlaywrightMetadataWriter, debugBrowser, debugContextPath, debugDirs, debugExtensionsToLoad, debugOutputPath, devCommandFailed, devServerStartTimeout, downloadingText, extensionJsRunnerError, extensionLoadRecovered, extensionLoadStillRefused, extensionPreview, failedToDownloadOrExtractZIPFileError, getDirs, getDistPath, getProjectStructure, getSessionRunId, getSpecialFoldersDataForCompiler, getSpecialFoldersDataForProjectRoot, invalidRemoteZip, isChromiumBasedBrowser, isGeckoBasedBrowser, loadBrowserConfig, loadCommandConfig, loadCustomConfig, localZipNotFound, manifestInvalidJson, messages_ready, needsInstall, noCompanionExtensionsResolved, noEntrypointsDetected, normalizeBrowser, notAZipArchive, package_namespaceObject, packagingDistributionFiles, packagingSourceFiles, portInUse, projectInstallFallbackToNpm, projectInstallScriptsDisabled, resolveCompanionExtensionDirs, resolveCompanionExtensionsConfig, sanitize, spacerLine, toPosixPath, treeWithDistFilesBrowser, treeWithSourceAndDistFiles, treeWithSourceFiles, unpackagedSuccessfully, unpackagingExtension, writingTypeDefinitions, writingTypeDefinitionsError };
2307
+ export { CHROMIUM_FAMILY_ALIASES, GECKO_FAMILY_ALIASES, PlaywrightPlugin, asAbsolute, assertNoManagedDependencyConflicts, authorInstallNotice, autoExitForceKill, autoExitModeEnabled, autoExitTriggered, browserLaunchFailed, browserRunnerDisabled, buildCommandFailed, buildSuccess, buildSuccessWithWarnings, buildWarningsDetails, buildWebpack, bundlerFatalError, bundlerRecompiling, computeExtensionsToLoad, createPlaywrightMetadataWriter, debugBrowser, debugContextPath, debugDirs, debugExtensionsToLoad, debugOutputPath, devCommandFailed, devServerStartTimeout, downloadingText, extensionJsRunnerError, extensionLoadRecovered, extensionLoadStillRefused, extensionPreview, failedToDownloadOrExtractZIPFileError, getDirs, getDistPath, getProjectStructure, getSessionRunId, getSpecialFoldersDataForCompiler, getSpecialFoldersDataForProjectRoot, invalidRemoteZip, isChromiumBasedBrowser, isGeckoBasedBrowser, loadBrowserConfig, loadCommandConfig, loadCustomConfig, localZipNotFound, manifestInvalidJson, messages_ready, needsInstall, noCompanionExtensionsResolved, noEntrypointsDetected, normalizeBrowser, notAZipArchive, package_namespaceObject, packagingDistributionFiles, packagingSourceFiles, portInUse, projectInstallFallbackToNpm, projectInstallScriptsDisabled, resolveCompanionExtensionDirs, resolveCompanionExtensionsConfig, sanitize, spacerLine, toPosixPath, treeWithDistFilesBrowser, treeWithSourceAndDistFiles, treeWithSourceFiles, unpackagedSuccessfully, unpackagingExtension, writingTypeDefinitions, writingTypeDefinitionsError, zipArtifactReady };
package/dist/349.mjs CHANGED
@@ -58,6 +58,14 @@ function card(input = {}) {
58
58
  ...body
59
59
  ].join('\n');
60
60
  }
61
+ function browserRowValue(browser, versionLine) {
62
+ const name = String(browser || '').trim() || 'unknown';
63
+ const display = name.charAt(0).toUpperCase() + name.slice(1);
64
+ const line = String(versionLine || '').trim();
65
+ if (!line) return display;
66
+ if (!/[a-zA-Z]/.test(line)) return `${display} ${line}`;
67
+ return line.charAt(0).toUpperCase() + line.slice(1);
68
+ }
61
69
  const CARD_KEYS_ENV = 'EXTENSION_CLI_CARD_KEYS';
62
70
  const CARD_KEYS_SEPARATOR = '\u001f';
63
71
  function isCardKeyClaimed(key) {
@@ -248,4 +256,4 @@ const ENVELOPE = {
248
256
  }, extras);
249
257
  }
250
258
  };
251
- export { CODES, ENVELOPE, artifactNoun, card, claimCardKey, fmt, isDebug, prefix };
259
+ export { CODES, ENVELOPE, artifactNoun, browserRowValue, card, claimCardKey, fmt, isDebug, prefix };
package/dist/839.mjs CHANGED
@@ -4,7 +4,7 @@ import { execFileSync, spawn, spawnSync as external_node_child_process_spawnSync
4
4
  import { buildExecEnv, detectPackageManagerFromLockfile } from "prefers-yarn";
5
5
  import pintor from "pintor";
6
6
  import { EventEmitter } from "node:events";
7
- import { isDebug, ENVELOPE, CODES, prefix as messaging_prefix, claimCardKey, card } from "./349.mjs";
7
+ import { browserRowValue, isDebug, CODES, ENVELOPE, prefix as messaging_prefix, claimCardKey, card } from "./349.mjs";
8
8
  import { package_namespaceObject, buildWarningsDetails, sanitize, getDirs, projectInstallFallbackToNpm, assertNoManagedDependencyConflicts, debugDirs, browserLaunchFailed, buildSuccess, extensionLoadRecovered, writingTypeDefinitionsError, extensionLoadStillRefused, projectInstallScriptsDisabled, authorInstallNotice, getSpecialFoldersDataForProjectRoot, buildSuccessWithWarnings, loadCommandConfig, needsInstall, buildCommandFailed, writingTypeDefinitions, buildWebpack, normalizeBrowser, debugBrowser, debugOutputPath, loadCustomConfig, devCommandFailed, getProjectStructure, getDistPath, resolveCompanionExtensionsConfig, loadBrowserConfig } from "./101.mjs";
9
9
  import { stripBom, parseJsonSafe } from "./23.mjs";
10
10
  import { hasProjectDependency, findNearestProjectManifestDirSync } from "./80.mjs";
@@ -927,7 +927,7 @@ function printBuildCard(manifestPath, browser, distPath) {
927
927
  const version = String(manifest?.version || '').trim();
928
928
  extensionLabel = name && version ? `${name} ${version}` : name;
929
929
  } catch {}
930
- const browserLabel = String(browser || '').split('-').filter(Boolean).map((token)=>token.charAt(0).toUpperCase() + token.slice(1)).join('-');
930
+ const browserLabel = browserRowValue(String(browser || ''));
931
931
  const suffix = process.env.EXTENSION_CLI_UPDATE_SUFFIX || '';
932
932
  if (suffix) delete process.env.EXTENSION_CLI_UPDATE_SUFFIX;
933
933
  humanLine(' ');
@@ -9,6 +9,7 @@ export declare function notAnExtensionManifestError(manifestPath: string): strin
9
9
  export declare function manifestNotFoundError(manifestPath: string, candidates?: string[]): string;
10
10
  export declare function building(browser: DevOptions['browser']): string;
11
11
  export declare function previewing(browser: DevOptions['browser']): string;
12
+ export declare function starting(browser: DevOptions['browser']): string;
12
13
  export declare function previewSkippedNoBrowser(browser: DevOptions['browser']): string;
13
14
  export declare function extensionLoadRecovered(): string;
14
15
  export declare function extensionLoadStillRefused(reason: string): string;
@@ -38,6 +39,7 @@ export declare function downloadingProjectPath(projectName: string): string;
38
39
  export declare function creatingProjectPath(projectPath: string): string;
39
40
  export declare function downloadedProjectFolderNotFound(cwd: string, candidates: string[]): string;
40
41
  export declare function packagingSourceFiles(zipPath: string): string;
42
+ export declare function zipArtifactReady(browser: DevOptions['browser'], zipPath: string, sizeInBytes: number): string;
41
43
  export declare function packagingDistributionFiles(zipPath: string): string;
42
44
  export declare function treeWithSourceAndDistFiles(browser: DevOptions['browser'], name: string, sourceZip: string, destZip: string): string;
43
45
  export declare function treeWithDistFilesBrowser(name: string, ext: string, browser: DevOptions['browser'], zipPath: string): string;
@@ -20,6 +20,7 @@ export interface CardInput {
20
20
  rows?: CardRow[];
21
21
  }
22
22
  export declare function card(input?: CardInput): string;
23
+ export declare function browserRowValue(browser: string, versionLine?: string): string;
23
24
  export declare function isCardKeyClaimed(key: string): boolean;
24
25
  export declare function claimCardKey(key: string): boolean;
25
26
  export declare function artifactNoun(browser: string): 'Add-on' | 'Extension';
package/package.json CHANGED
@@ -43,7 +43,7 @@
43
43
  "runtime"
44
44
  ],
45
45
  "name": "extension-develop",
46
- "version": "4.0.20",
46
+ "version": "4.0.21",
47
47
  "description": "Develop, build, preview, and package Extension.js projects.",
48
48
  "author": {
49
49
  "name": "Cezar Augusto",