extension 2.0.0-beta.1 → 2.0.0-beta.3

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
@@ -13,7 +13,7 @@
13
13
  [fossa-image]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcezaraugusto%2Fextension.svg?type=shield&issueType=license
14
14
  [fossa-url]: https://app.fossa.com/projects/git%2Bgithub.com%2Fcezaraugusto%2Fextension?ref=badge_shield&issueType=license
15
15
  [discord-image]: https://img.shields.io/discord/1253608412890271755?label=Discord&logo=discord&style=flat
16
- [discord-url]: https://discord.gg/1253608412890271755
16
+ [discord-url]: https://discord.gg/v9h2RgeTSN
17
17
 
18
18
  # Extension.js [![fossa][fossa-image]][fossa-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![workflow][action-image]][action-url] [![discord][discord-image]][discord-url]
19
19
 
@@ -52,11 +52,11 @@ https://github.com/cezaraugusto/extension/assets/4672033/7263d368-99c4-434f-a60a
52
52
 
53
53
  ## Web Standards and Modern JavaScript Support
54
54
 
55
- For a preview of extensions running these technologies, see documentation about [Templates](https://extension.js.org/n/getting-started/templates/).
55
+ For a preview of extensions running these technologies, see documentation about [Templates](https://extension.js.org/docs/getting-started/templates).
56
56
 
57
57
  | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/a9e2541a-96f0-4caa-9fc9-5fc5c3e901c8" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/b42c5330-9e2a-4045-99c3-1f7d264dfaf4" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/f19edff3-9005-4f50-b05c-fba615896a7f" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/ff64721d-d145-4213-930d-e70193f8d57e" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/15f1314a-aa65-4ce2-a3f3-cf53c4f730cf" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/c5f8a127-3c2a-4ceb-bb46-948cf2c8bd89" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/de1082fd-7cf6-4202-8c12-a5c3cd3e5b42" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/78e5fe3d-dc79-4aa2-954e-1a5973d1d9db" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/8807efd9-93e5-4db5-a1d2-9ac524f7ecc2" width="70"> |
58
58
  | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: |
59
- | ESNext<br>✅ | TypeScript<br>✅ | WASM<br>✅ | React<br>✅ | Vue<br>✅ | Angular<br>👋 | Svelte<br>👋 | Solid<br>👋 | Preact<br>✅ |
59
+ | ESNext<br>✅ | TypeScript<br>✅ | WASM<br>✅ | React<br>✅ | Vue<br>✅ | Angular<br>👋 | Svelte<br>✅ | Solid<br>👋 | Preact<br>✅ |
60
60
 
61
61
  👋 = PR Welcome!
62
62
 
package/dist/cli.js CHANGED
@@ -117,7 +117,7 @@ var package_default = {
117
117
  node: ">=18"
118
118
  },
119
119
  name: "extension",
120
- version: "2.0.0-beta.1",
120
+ version: "2.0.0-beta.3",
121
121
  description: "Create cross-browser extensions with no build configuration.",
122
122
  main: "./dist/cli.js",
123
123
  types: "./dist/cli.d.ts",
@@ -188,8 +188,8 @@ var package_default = {
188
188
  // cli.ts
189
189
  checkUpdates2(package_default);
190
190
  var extensionJs = import_commander.program;
191
- extensionJs.name(package_default.name).description(package_default.description).version(package_default.version).addHelpText("after", programHelp());
192
191
  var vendors = (browser) => browser === "all" ? "chrome,edge,firefox".split(",") : browser.split(",");
192
+ extensionJs.name(package_default.name).description(package_default.description).version(package_default.version).addHelpText("after", programHelp());
193
193
  extensionJs.command("create").arguments("<project-name|project-path>").usage("create <project-name|project-path> [options]").description("Creates a new extension.").option(
194
194
  "-t, --template <template-name>",
195
195
  "specify a template for the created project"
@@ -203,14 +203,11 @@ extensionJs.command("create").arguments("<project-name|project-path>").usage("cr
203
203
  });
204
204
  });
205
205
  extensionJs.command("dev").arguments("[project-path|remote-url]").usage("dev [project-path|remote-url] [options]").description("Starts the development server (development mode)").option(
206
- "-u, --user-data-dir <path-to-file | boolean>",
207
- '[DEPRECATED - Use "--profile" instead] what path to use for the browser profile. A boolean value of false sets the profile to the default user profile. Defaults to a fresh profile'
208
- ).option(
209
206
  "--profile <path-to-file | boolean>",
210
207
  "what path to use for the browser profile. A boolean value of false sets the profile to the default user profile. Defaults to a fresh profile"
211
208
  ).option(
212
- "-b, --browser <chrome | edge | firefox>",
213
- "specify a browser to run your extension in development mode"
209
+ "--browser <chrome | edge | firefox>",
210
+ "specify a browser to preview your extension in production mode. Defaults to `chrome`"
214
211
  ).option(
215
212
  "--chromium-binary <path-to-binary>",
216
213
  "specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default"
@@ -219,27 +216,37 @@ extensionJs.command("dev").arguments("[project-path|remote-url]").usage("dev [pr
219
216
  "specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default"
220
217
  ).option(
221
218
  "--polyfill [boolean]",
222
- "whether or not to apply the cross-browser polyfill. Defaults to `true`"
219
+ "whether or not to apply the cross-browser polyfill. Defaults to `false`"
220
+ ).option(
221
+ "--open [boolean]",
222
+ "whether or not to open the browser automatically. Defaults to `true`"
223
223
  ).option(
224
- "-p, --port <number>",
225
- "what port should Extension.js WebSocket server run. Defaults to `8000`"
224
+ "--starting-url <url>",
225
+ "specify the starting URL for the browser. Defaults to `undefined`"
226
226
  ).action(async function(pathOrRemoteUrl, { browser = "chrome", ...devOptions }) {
227
227
  for (const vendor of vendors(browser)) {
228
228
  await (0, import_extension_develop.extensionDev)(pathOrRemoteUrl, {
229
+ ...devOptions,
230
+ profile: devOptions.profile,
229
231
  browser: vendor,
230
- ...devOptions
232
+ chromiumBinary: devOptions.chromiumBinary,
233
+ geckoBinary: devOptions.geckoBinary,
234
+ // @ts-expect-error open is a boolean
235
+ polyfill: devOptions.polyfill === "false" ? false : true,
236
+ open: devOptions.open,
237
+ startingUrl: devOptions.startingUrl
231
238
  });
232
239
  }
233
240
  });
234
241
  extensionJs.command("start").arguments("[project-path|remote-url]").usage("start [project-path|remote-url] [options]").description("Starts the development server (production mode)").option(
235
- "-u, --user-data-dir <path-to-file | boolean>",
236
- '[DEPRECATED - Use "--profile" instead] what path to use for the browser profile. A boolean value of false sets the profile to the default user profile. Defaults to a fresh profile'
237
- ).option(
238
242
  "--profile <path-to-file | boolean>",
239
243
  "what path to use for the browser profile. A boolean value of false sets the profile to the default user profile. Defaults to a fresh profile"
240
244
  ).option(
241
- "-b, --browser <chrome | edge | firefox>",
242
- "specify a browser to run your extension in development mode"
245
+ "--browser <chrome | edge | firefox>",
246
+ "specify a browser to preview your extension in production mode. Defaults to `chrome`"
247
+ ).option(
248
+ "--polyfill [boolean]",
249
+ "whether or not to apply the cross-browser polyfill. Defaults to `true`"
243
250
  ).option(
244
251
  "--chromium-binary <path-to-binary>",
245
252
  "specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default"
@@ -247,22 +254,50 @@ extensionJs.command("start").arguments("[project-path|remote-url]").usage("start
247
254
  "--gecko-binary <path-to-binary>",
248
255
  "specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default"
249
256
  ).option(
250
- "--polyfill [boolean]",
251
- "whether or not to apply the cross-browser polyfill. Defaults to `true`"
252
- ).option(
253
- "-p, --port <number>",
254
- "what port should Extension.js run. Defaults to `3000`"
257
+ "--starting-url <url>",
258
+ "specify the starting URL for the browser. Defaults to `undefined`"
255
259
  ).action(async function(pathOrRemoteUrl, { browser = "chrome", ...startOptions }) {
256
260
  for (const vendor of vendors(browser)) {
257
261
  await (0, import_extension_develop.extensionStart)(pathOrRemoteUrl, {
262
+ mode: "production",
263
+ profile: startOptions.profile,
258
264
  browser: vendor,
259
- ...startOptions
265
+ chromiumBinary: startOptions.chromiumBinary,
266
+ geckoBinary: startOptions.geckoBinary,
267
+ startingUrl: startOptions.startingUrl
268
+ });
269
+ }
270
+ });
271
+ extensionJs.command("preview").arguments("[project-name]").usage("preview [path-to-remote-extension] [options]").description("Preview the extension in production mode").option(
272
+ "--profile <path-to-file | boolean>",
273
+ "what path to use for the browser profile. A boolean value of false sets the profile to the default user profile. Defaults to a fresh profile"
274
+ ).option(
275
+ "--browser <chrome | edge | firefox>",
276
+ "specify a browser to preview your extension in production mode. Defaults to `chrome`"
277
+ ).option(
278
+ "--chromium-binary <path-to-binary>",
279
+ "specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default"
280
+ ).option(
281
+ "--gecko-binary <path-to-binary>",
282
+ "specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default"
283
+ ).option(
284
+ "--starting-url <url>",
285
+ "specify the starting URL for the browser. Defaults to `undefined`"
286
+ ).action(async function(pathOrRemoteUrl, { browser = "chrome", ...previewOptions }) {
287
+ for (const vendor of vendors(browser)) {
288
+ await (0, import_extension_develop.extensionPreview)(pathOrRemoteUrl, {
289
+ mode: "production",
290
+ profile: previewOptions.profile,
291
+ browser: vendor,
292
+ chromiumBinary: previewOptions.chromiumBinary,
293
+ geckoBinary: previewOptions.geckoBinary,
294
+ startingUrl: previewOptions.startingUrl
260
295
  });
261
296
  }
262
297
  });
263
298
  extensionJs.command("build").arguments("[project-name]").usage("build [path-to-remote-extension] [options]").description("Builds the extension for production").option(
264
- "-b, --browser <chrome | edge | firefox>",
265
- "specify a browser to run your extension in development mode"
299
+ "--browser <chrome | edge | firefox>",
300
+ "specify a browser to preview your extension in production mode. Defaults to `chrome`"
266
301
  ).option(
267
302
  "--polyfill [boolean]",
268
303
  "whether or not to apply the cross-browser polyfill. Defaults to `false`"
@@ -275,11 +310,18 @@ extensionJs.command("build").arguments("[project-name]").usage("build [path-to-r
275
310
  ).option(
276
311
  "--zip-filename <string>",
277
312
  "specify the name of the ZIP file. Defaults to the extension name and version"
313
+ ).option(
314
+ "--silent [boolean]",
315
+ "whether or not to open the browser automatically. Defaults to `false`"
278
316
  ).action(async function(pathOrRemoteUrl, { browser = "chrome", ...buildOptions }) {
279
317
  for (const vendor of vendors(browser)) {
280
318
  await (0, import_extension_develop.extensionBuild)(pathOrRemoteUrl, {
281
319
  browser: vendor,
282
- ...buildOptions
320
+ polyfill: buildOptions.polyfill,
321
+ zip: buildOptions.zip,
322
+ zipSource: buildOptions.zipSource,
323
+ zipFilename: buildOptions.zipFilename,
324
+ silent: buildOptions.silent
283
325
  });
284
326
  }
285
327
  });
@@ -1,7 +1,6 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="react" />
3
- /// <reference types="react-dom" />
4
2
  /// <reference types="chrome" />
3
+ /// <reference types="./js-frameworks.d.ts" />
5
4
  /// <reference path="./css-content.d.ts" />
6
5
  /// <reference path="./css-modules.d.ts" />
7
6
  /// <reference path="./images.d.ts" />
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ /// <reference types="react-dom" />
3
+ /// <reference types="svelte" />
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=18"
10
10
  },
11
11
  "name": "extension",
12
- "version": "2.0.0-beta.1",
12
+ "version": "2.0.0-beta.3",
13
13
  "description": "Create cross-browser extensions with no build configuration.",
14
14
  "main": "./dist/cli.js",
15
15
  "types": "./dist/cli.d.ts",
@@ -49,8 +49,8 @@
49
49
  "semver": "^7.5.4",
50
50
  "update-check": "^1.5.4",
51
51
  "webextension-polyfill": "^0.12.0",
52
- "extension-create": "2.0.0-beta.1",
53
- "extension-develop": "2.0.0-beta.1"
52
+ "extension-create": "2.0.0-beta.3",
53
+ "extension-develop": "2.0.0-beta.3"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/jest": "^29.5.11",