extension 3.15.1 → 3.16.0

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.
package/README.md CHANGED
@@ -64,7 +64,7 @@ If you have used [Plasmo](https://www.plasmo.com), [WXT](https://wxt.dev), or [C
64
64
 
65
65
  | <img alt="ESNext" src="https://github.com/cezaraugusto/extension.js/assets/4672033/a9e2541a-96f0-4caa-9fc9-5fc5c3e901c8" width="70"> | <img alt="TypeScript" src="https://github.com/cezaraugusto/extension.js/assets/4672033/b42c5330-9e2a-4045-99c3-1f7d264dfaf4" width="70"> | <img alt="WASM" src="https://github.com/cezaraugusto/extension.js/assets/4672033/f19edff3-9005-4f50-b05c-fba615896a7f" width="70"> | <img alt="React" src="https://github.com/cezaraugusto/extension.js/assets/4672033/ff64721d-d145-4213-930d-e70193f8d57e" width="70"> | <img alt="Vue" src="https://github.com/cezaraugusto/extension.js/assets/4672033/15f1314a-aa65-4ce2-a3f3-cf53c4f730cf" width="70"> | <img alt="Svelte" src="https://github.com/cezaraugusto/extension.js/assets/4672033/de1082fd-7cf6-4202-8c12-a5c3cd3e5b42" width="70"> | <img alt="Preact" src="https://github.com/cezaraugusto/extension.js/assets/4672033/8807efd9-93e5-4db5-a1d2-9ac524f7ecc2" width="70"> |
66
66
  | :-: | :-: | :-: | :-: | :-: | :-: | :-: |
67
- | ESNext<br>[Try out](https://templates.extension.dev/javascript) | TypeScript<br>[Try out](https://templates.extension.dev/typescript) | WASM<br>[Try out](https://github.com/extension-js/examples/tree/main/examples/sidebar-transformers-js) | React<br>[Try out](https://templates.extension.dev/react) | Vue<br>[Try out](https://templates.extension.dev/vue) | Svelte<br>[Try out](https://templates.extension.dev/svelte) | Preact<br>[Try out](https://templates.extension.dev/preact) |
67
+ | ESNext<br>[Try out](https://templates.extension.dev/javascript) | TypeScript<br>[Try out](https://templates.extension.dev/typescript) | WASM<br>[Try out](https://github.com/extension-js/examples/tree/main/examples/transformers-js) | React<br>[Try out](https://templates.extension.dev/react) | Vue<br>[Try out](https://templates.extension.dev/vue) | Svelte<br>[Try out](https://templates.extension.dev/svelte) | Preact<br>[Try out](https://templates.extension.dev/preact) |
68
68
 
69
69
  </div>
70
70
 
package/dist/browsers.cjs CHANGED
@@ -1924,16 +1924,29 @@ var __webpack_modules__ = {
1924
1924
  process.on('SIGHUP', cleanup);
1925
1925
  process.on('exit', cleanup);
1926
1926
  process.on('uncaughtException', (error)=>{
1927
+ if (isBenignSocketTeardown(error)) return;
1927
1928
  console.error(messages.F41(browser, error));
1928
1929
  cleanup();
1929
1930
  process.exit(1);
1930
1931
  });
1931
1932
  process.on('unhandledRejection', (reason)=>{
1933
+ if (isBenignSocketTeardown(reason)) return;
1932
1934
  console.error(messages.N4O(browser, reason));
1933
1935
  cleanup();
1934
1936
  process.exit(1);
1935
1937
  });
1936
1938
  }
1939
+ const BENIGN_SOCKET_ERROR_CODES = new Set([
1940
+ 'ECONNRESET',
1941
+ 'EPIPE',
1942
+ 'ECONNABORTED',
1943
+ 'ENOTCONN'
1944
+ ]);
1945
+ function isBenignSocketTeardown(value) {
1946
+ if (!value || 'object' != typeof value) return false;
1947
+ const code = value.code;
1948
+ return 'string' == typeof code && BENIGN_SOCKET_ERROR_CODES.has(code);
1949
+ }
1937
1950
  function logChromiumDryRun(browserBinaryLocation, chromiumConfig) {
1938
1951
  console.log(messages.xyq());
1939
1952
  console.log(messages.Nk3());
@@ -2839,16 +2852,29 @@ var __webpack_modules__ = {
2839
2852
  process.on('SIGBREAK', onSignal);
2840
2853
  process.on('beforeExit', onSignal);
2841
2854
  process.on('uncaughtException', async (error)=>{
2855
+ if (isBenignSocketTeardown(error)) return;
2842
2856
  console.error(messages.F41(browser, error));
2843
2857
  await attemptCleanup();
2844
2858
  process.exit(1);
2845
2859
  });
2846
2860
  process.on('unhandledRejection', async (reason)=>{
2861
+ if (isBenignSocketTeardown(reason)) return;
2847
2862
  console.error(messages.N4O(browser, reason));
2848
2863
  await attemptCleanup();
2849
2864
  process.exit(1);
2850
2865
  });
2851
2866
  }
2867
+ const BENIGN_SOCKET_ERROR_CODES = new Set([
2868
+ 'ECONNRESET',
2869
+ 'EPIPE',
2870
+ 'ECONNABORTED',
2871
+ 'ENOTCONN'
2872
+ ]);
2873
+ function isBenignSocketTeardown(value) {
2874
+ if (!value || 'object' != typeof value) return false;
2875
+ const code = value.code;
2876
+ return 'string' == typeof code && BENIGN_SOCKET_ERROR_CODES.has(code);
2877
+ }
2852
2878
  const external_events_namespaceObject = require("events");
2853
2879
  var external_events_default = /*#__PURE__*/ __webpack_require__.n(external_events_namespaceObject);
2854
2880
  var external_net_ = __webpack_require__("net");
package/dist/cli.cjs CHANGED
@@ -1923,16 +1923,29 @@ var __webpack_modules__ = {
1923
1923
  process.on('SIGHUP', cleanup);
1924
1924
  process.on('exit', cleanup);
1925
1925
  process.on('uncaughtException', (error)=>{
1926
+ if (isBenignSocketTeardown(error)) return;
1926
1927
  console.error(messages.F41(browser, error));
1927
1928
  cleanup();
1928
1929
  process.exit(1);
1929
1930
  });
1930
1931
  process.on('unhandledRejection', (reason)=>{
1932
+ if (isBenignSocketTeardown(reason)) return;
1931
1933
  console.error(messages.N4O(browser, reason));
1932
1934
  cleanup();
1933
1935
  process.exit(1);
1934
1936
  });
1935
1937
  }
1938
+ const BENIGN_SOCKET_ERROR_CODES = new Set([
1939
+ 'ECONNRESET',
1940
+ 'EPIPE',
1941
+ 'ECONNABORTED',
1942
+ 'ENOTCONN'
1943
+ ]);
1944
+ function isBenignSocketTeardown(value) {
1945
+ if (!value || 'object' != typeof value) return false;
1946
+ const code = value.code;
1947
+ return 'string' == typeof code && BENIGN_SOCKET_ERROR_CODES.has(code);
1948
+ }
1936
1949
  function logChromiumDryRun(browserBinaryLocation, chromiumConfig) {
1937
1950
  console.log(messages.xyq());
1938
1951
  console.log(messages.Nk3());
@@ -2838,16 +2851,29 @@ var __webpack_modules__ = {
2838
2851
  process.on('SIGBREAK', onSignal);
2839
2852
  process.on('beforeExit', onSignal);
2840
2853
  process.on('uncaughtException', async (error)=>{
2854
+ if (isBenignSocketTeardown(error)) return;
2841
2855
  console.error(messages.F41(browser, error));
2842
2856
  await attemptCleanup();
2843
2857
  process.exit(1);
2844
2858
  });
2845
2859
  process.on('unhandledRejection', async (reason)=>{
2860
+ if (isBenignSocketTeardown(reason)) return;
2846
2861
  console.error(messages.N4O(browser, reason));
2847
2862
  await attemptCleanup();
2848
2863
  process.exit(1);
2849
2864
  });
2850
2865
  }
2866
+ const BENIGN_SOCKET_ERROR_CODES = new Set([
2867
+ 'ECONNRESET',
2868
+ 'EPIPE',
2869
+ 'ECONNABORTED',
2870
+ 'ENOTCONN'
2871
+ ]);
2872
+ function isBenignSocketTeardown(value) {
2873
+ if (!value || 'object' != typeof value) return false;
2874
+ const code = value.code;
2875
+ return 'string' == typeof code && BENIGN_SOCKET_ERROR_CODES.has(code);
2876
+ }
2851
2877
  const external_events_namespaceObject = require("events");
2852
2878
  var external_events_default = /*#__PURE__*/ __webpack_require__.n(external_events_namespaceObject);
2853
2879
  var external_net_ = __webpack_require__("net");
@@ -6137,6 +6163,7 @@ Cross-Browser Compatibility
6137
6163
  var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_);
6138
6164
  var external_path_ = __webpack_require__("path");
6139
6165
  var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_);
6166
+ const external_url_namespaceObject = require("url");
6140
6167
  var external_module_ = __webpack_require__("module");
6141
6168
  const extension_develop_runtime_require = (0, external_module_.createRequire)(__rslib_import_meta_url__);
6142
6169
  function parseJsonSafe(filePath) {
@@ -6201,9 +6228,9 @@ Cross-Browser Compatibility
6201
6228
  function resolveDevelopDistEntry(root, name = 'module') {
6202
6229
  const base = external_path_default().join(root, 'dist', name);
6203
6230
  const candidates = [
6231
+ `${base}.mjs`,
6204
6232
  `${base}.cjs`,
6205
6233
  `${base}.js`,
6206
- `${base}.mjs`,
6207
6234
  base
6208
6235
  ];
6209
6236
  for (const candidate of candidates)if (external_fs_default().existsSync(candidate)) return candidate;
@@ -6225,23 +6252,30 @@ Cross-Browser Compatibility
6225
6252
  return fallbackVersion || '0.0.0';
6226
6253
  }
6227
6254
  }
6228
- function loadExtensionDevelopModule(startDir = __dirname) {
6255
+ async function importModule(filePath) {
6256
+ const mod = await import((0, external_url_namespaceObject.pathToFileURL)(filePath).href);
6257
+ return mod?.default && 'object' == typeof mod.default ? {
6258
+ ...mod.default,
6259
+ ...mod
6260
+ } : mod;
6261
+ }
6262
+ async function loadExtensionDevelopModule(startDir = __dirname) {
6229
6263
  const root = resolveExtensionDevelopRoot(startDir);
6230
6264
  const { source } = resolvePreferredDevelopRoot(startDir);
6231
6265
  const distEntry = resolveDevelopDistEntry(root);
6232
- if (distEntry) return extension_develop_runtime_require(distEntry);
6266
+ if (distEntry) return importModule(distEntry);
6233
6267
  if ('workspace' === source) throw new Error(`Local extension-develop runtime is not built at ${external_path_default().join(root, 'dist')}. Run \`pnpm --filter extension-develop compile\` before invoking the local CLI.`);
6234
- return extension_develop_runtime_require('extension-develop');
6268
+ return await import("extension-develop");
6235
6269
  }
6236
- function loadExtensionDevelopPreviewModule(startDir = __dirname) {
6270
+ async function loadExtensionDevelopPreviewModule(startDir = __dirname) {
6237
6271
  const root = resolveExtensionDevelopRoot(startDir);
6238
6272
  const { source } = resolvePreferredDevelopRoot(startDir);
6239
6273
  const previewEntry = resolveDevelopDistEntry(root, 'preview');
6240
- if (previewEntry) return extension_develop_runtime_require(previewEntry);
6274
+ if (previewEntry) return importModule(previewEntry);
6241
6275
  const fullEntry = resolveDevelopDistEntry(root);
6242
- if (fullEntry) return extension_develop_runtime_require(fullEntry);
6276
+ if (fullEntry) return importModule(fullEntry);
6243
6277
  if ('workspace' === source) throw new Error(`Local extension-develop runtime is not built at ${external_path_default().join(root, 'dist')}. Run \`pnpm --filter extension-develop compile\` before invoking the local CLI.`);
6244
- return extension_develop_runtime_require('extension-develop/preview');
6278
+ return await import("extension-develop/preview");
6245
6279
  }
6246
6280
  const external_node_os_namespaceObject = require("node:os");
6247
6281
  var external_node_os_default = /*#__PURE__*/ __webpack_require__.n(external_node_os_namespaceObject);
@@ -6901,7 +6935,7 @@ Cross-Browser Compatibility
6901
6935
  devOptions.sourceMaxBytes = normalizeSourceMaxBytesOption(devOptions.sourceMaxBytes);
6902
6936
  devOptions.sourceIncludeShadow = normalizeSourceIncludeShadowOption(devOptions.sourceIncludeShadow, sourceEnabled);
6903
6937
  devOptions.sourceDiff = normalizeSourceDiffOption(devOptions.sourceDiff, devOptions.watchSource);
6904
- const { extensionDev } = loadExtensionDevelopModule();
6938
+ const { extensionDev } = await loadExtensionDevelopModule();
6905
6939
  const noBrowser = '1' === process.env.EXTENSION_CLI_NO_BROWSER;
6906
6940
  for (const vendor of list){
6907
6941
  const logsOption = devOptions.logs;
@@ -6974,7 +7008,7 @@ Cross-Browser Compatibility
6974
7008
  }));
6975
7009
  return;
6976
7010
  }
6977
- const { extensionBuild } = loadExtensionDevelopModule();
7011
+ const { extensionBuild } = await loadExtensionDevelopModule();
6978
7012
  for (const vendor of list){
6979
7013
  const logsOption = startOptions.logs;
6980
7014
  const logContextOption = startOptions.logContext;
@@ -6989,7 +7023,7 @@ Cross-Browser Compatibility
6989
7023
  });
6990
7024
  const noBrowser = '1' === process.env.EXTENSION_CLI_NO_BROWSER;
6991
7025
  if (noBrowser) continue;
6992
- const { extensionPreview } = loadExtensionDevelopPreviewModule();
7026
+ const { extensionPreview } = await loadExtensionDevelopPreviewModule();
6993
7027
  await extensionPreview(pathOrRemoteUrl, {
6994
7028
  mode: 'production',
6995
7029
  profile: startOptions.profile,
@@ -7026,7 +7060,7 @@ Cross-Browser Compatibility
7026
7060
  const isRemote = 'string' == typeof pathOrRemoteUrl && /^https?:/i.test(pathOrRemoteUrl);
7027
7061
  if (isRemote) process.env.EXTJS_LIGHT = '1';
7028
7062
  }
7029
- const { extensionPreview } = loadExtensionDevelopPreviewModule();
7063
+ const { extensionPreview } = await loadExtensionDevelopPreviewModule();
7030
7064
  for (const vendor of list){
7031
7065
  const logsOption = previewOptions.logs;
7032
7066
  const logContextOption = previewOptions.logContext;
@@ -7071,7 +7105,7 @@ Cross-Browser Compatibility
7071
7105
  process.exit(1);
7072
7106
  }
7073
7107
  }
7074
- const { extensionBuild } = loadExtensionDevelopModule();
7108
+ const { extensionBuild } = await loadExtensionDevelopModule();
7075
7109
  for (const vendor of list)await extensionBuild(pathOrRemoteUrl, {
7076
7110
  browser: vendor,
7077
7111
  polyfill: buildOptions.polyfill,
@@ -1,9 +1,9 @@
1
1
  export declare function resolveExtensionDevelopRoot(startDir?: string): string;
2
2
  export declare function resolveExtensionDevelopVersion(startDir?: string, fallbackVersion?: string): string;
3
- export declare function loadExtensionDevelopModule<T = any>(startDir?: string): T;
3
+ export declare function loadExtensionDevelopModule<T = any>(startDir?: string): Promise<T>;
4
4
  /**
5
5
  * Load only the lightweight preview entry from extension-develop.
6
6
  * This avoids pulling in rspack and the full build toolchain, making
7
7
  * `extension preview` start significantly faster.
8
8
  */
9
- export declare function loadExtensionDevelopPreviewModule<T = any>(startDir?: string): T;
9
+ export declare function loadExtensionDevelopPreviewModule<T = any>(startDir?: string): Promise<T>;
package/package.json CHANGED
@@ -38,7 +38,7 @@
38
38
  "extension": "./bin/extension.cjs"
39
39
  },
40
40
  "name": "extension",
41
- "version": "3.15.1",
41
+ "version": "3.16.0",
42
42
  "description": "Create cross-browser extensions with no build configuration.",
43
43
  "homepage": "https://extension.js.org/",
44
44
  "bugs": {
@@ -100,9 +100,9 @@
100
100
  "cross-spawn": "^7.0.6",
101
101
  "edge-location": "2.2.0",
102
102
  "firefox-location2": "3.0.0",
103
- "extension-create": "3.15.1",
104
- "extension-develop": "3.15.1",
105
- "extension-install": "3.15.1",
103
+ "extension-create": "3.16.0",
104
+ "extension-develop": "3.16.0",
105
+ "extension-install": "3.16.0",
106
106
  "commander": "^14.0.3",
107
107
  "pintor": "0.3.0",
108
108
  "semver": "^7.7.3",