extension 2.0.0-alpha.3 → 2.0.0-alpha.30

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
@@ -1,5 +1,5 @@
1
- [action-image]: https://github.com/cezaraugusto/extension/actions/workflows/cli.yml/badge.svg?branch=main
2
- [action-url]: https://github.com/cezaraugusto/extension/actions
1
+ [action-image]: https://github.com/extension-js/extension.js/actions/workflows/ci.yml/badge.svg?branch=main
2
+ [action-url]: https://github.com/extension-js/extension.js/actions
3
3
  [npm-image]: https://img.shields.io/npm/v/extension.svg
4
4
  [npm-url]: https://npmjs.org/package/extension
5
5
  [downloads-image]: https://img.shields.io/npm/dm/extension.svg
@@ -7,14 +7,15 @@
7
7
  [node]: https://img.shields.io/node/v/extension.svg
8
8
  [node-url]: https://nodejs.org
9
9
  [prs]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
10
- [prs-url]: https://github.com/cezaraugusto/extension/blob/main/CONTRIBUTING.md
11
- [vunlerabilities]: https://snyk.io/test/github/cezaraugusto/extension/badge.svg
10
+ [prs-url]: https://github.com/extension-js/extension/blob/main/CONTRIBUTING.md
11
+ [snyk-image]: https://snyk.io/test/github/extension-js/extension/badge.svg
12
+ [snyk-url]: https://snyk.io/test/github/extension-js/extension
12
13
  [fossa-image]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcezaraugusto%2Fextension.svg?type=shield&issueType=license
13
14
  [fossa-url]: https://app.fossa.com/projects/git%2Bgithub.com%2Fcezaraugusto%2Fextension?ref=badge_shield&issueType=license
14
15
  [discord-image]: https://img.shields.io/discord/1253608412890271755?label=Discord&logo=discord&style=flat
15
16
  [discord-url]: https://discord.gg/1253608412890271755
16
17
 
17
- # Extension.js [![fossa][fossa-image]][fossa-url] [![vunlerabilities][vunlerabilities]][vunlerabilities] [![workflow][action-image]][action-url] [![discord][discord-image]][discord-url]
18
+ # Extension.js [![fossa][fossa-image]][fossa-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![workflow][action-image]][action-url] [![discord][discord-image]][discord-url]
18
19
 
19
20
  <!-- > Plug-and-play, zero-config, cross-browser extension development tool. -->
20
21
 
@@ -27,7 +28,7 @@
27
28
 
28
29
  <!-- **Create cross-browser extensions with no build configuration.** -->
29
30
 
30
- > Create cross-browser extensions with no build configuration.
31
+ > Plug-and-play, zero-config, cross-browser extension development tool.
31
32
 
32
33
  - [Create A New Extension](#create-a-new-extension) — How to create a new extension.
33
34
  - [Get Started Immediately](#get-started-immediately) — Get work done in no time.
package/dist/cli.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  #!/usr/bin/env node
2
+ export { FileConfig, Manifest } from 'extension-develop';
package/dist/cli.js CHANGED
@@ -22,8 +22,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
23
  mod
24
24
  ));
25
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
26
 
26
27
  // cli.ts
28
+ var cli_exports = {};
29
+ module.exports = __toCommonJS(cli_exports);
27
30
  var import_commander = require("commander");
28
31
  var import_extension_create = require("extension-create");
29
32
  var import_extension_develop = require("extension-develop");
@@ -45,37 +48,37 @@ Please update to the latest version to enjoy new features and improvements.
45
48
  }
46
49
  function programHelp() {
47
50
  return `\u{1F9E9}
48
- ${(0, import_safe.brightGreen)("Help center for the Extension.js program")}
51
+ ${(0, import_safe.underline)("Help center for the Extension.js program")}
49
52
 
50
53
  ${(0, import_safe.brightYellow)("Usage:")} extension [command] [options]
51
54
 
52
- ${(0, import_safe.brightBlue)("Note:")} If you are looking for a specific list of options,
55
+ ${(0, import_safe.brightYellow)("Note:")} If you are looking for a specific list of options,
53
56
  all high-level commands offer their own \`--help\` file with
54
57
  information about usage and a list of command flags available.
55
58
 
56
59
  For example:
57
60
 
58
- ${(0, import_safe.brightBlue)("extension create --help")}
59
- outputs information about the \`create\` command.
61
+ ${(0, import_safe.brightGreen)("extension create --help")}
62
+ outputs information about the "create" command.
60
63
 
61
64
  Options available:
62
65
 
63
- ${(0, import_safe.brightBlue)("extension create <extension-name>")}
66
+ ${(0, import_safe.brightGreen)("extension create <extension-name>")}
64
67
  Creates a new extension from a template. The "create" command
65
68
  is optional and can be omitted.
66
69
 
67
- ${(0, import_safe.brightBlue)("extension dev <extension-path>")}
70
+ ${(0, import_safe.brightGreen)("extension dev <extension-path>")}
68
71
  Starts a new browser instance in development mode, with the target
69
72
  extension loaded and auto-reloaded based on file changes.
70
73
 
71
- ${(0, import_safe.brightBlue)("extension start <extension-path>")}
74
+ ${(0, import_safe.brightGreen)("extension start <extension-path>")}
72
75
  Starts a new browser instance in production mode, with the target
73
76
  extension compiled based on the browser choice.
74
77
 
75
- ${(0, import_safe.brightBlue)("extension build <extension-path>")}
78
+ ${(0, import_safe.brightGreen)("extension build <extension-path>")}
76
79
  Builds the target extension with browser defaults, ready for packaging.
77
80
 
78
- ${(0, import_safe.brightBlue)("extension --help")}
81
+ ${(0, import_safe.brightGreen)("extension --help")}
79
82
  This command ;) Outputs a help file with key command options.
80
83
 
81
84
  ${(0, import_safe.brightYellow)("Feels something is wrong? Help by reporting a bug:")}
@@ -114,7 +117,7 @@ var package_default = {
114
117
  node: ">=18"
115
118
  },
116
119
  name: "extension",
117
- version: "2.0.0-alpha.3",
120
+ version: "2.0.0-alpha.30",
118
121
  description: "Create cross-browser extensions with no build configuration.",
119
122
  main: "./dist/cli.js",
120
123
  types: "./dist/cli.d.ts",
@@ -131,12 +134,13 @@ var package_default = {
131
134
  url: "https://cezaraugusto.com"
132
135
  },
133
136
  scripts: {
134
- watch: "yarn compile --watch",
137
+ watch: "pnpm compile --watch",
138
+ "compile:types": "bash install_scripts.sh",
135
139
  "compile:readme-files": "node ./scripts/copyMarkdownFilesToCli.js",
136
140
  "compile:tailwind-config": "node ./scripts/copyTailwindConfig.js",
137
141
  "compile:stylelint-config": "node ./scripts/copyStylelintConfig.js",
138
142
  "compile:cli": "tsup-node ./cli.ts --format cjs --dts --target=node18",
139
- compile: "yarn compile:readme-files && yarn compile:tailwind-config && yarn compile:stylelint-config &&yarn compile:cli",
143
+ compile: "pnpm compile:readme-files && pnpm compile:tailwind-config && pnpm compile:stylelint-config && pnpm compile:cli && pnpm compile:types",
140
144
  clean: "rm -rf dist",
141
145
  test: 'echo "Note: no test specified" && exit 0',
142
146
  "test:cli": "jest __spec__/cli.spec.ts"
@@ -156,16 +160,21 @@ var package_default = {
156
160
  ],
157
161
  dependencies: {
158
162
  "@colors/colors": "^1.6.0",
159
- "extension-create": "2.0.0-alpha.3",
160
- "extension-develop": "2.0.0-alpha.3",
163
+ "@types/chrome": "^0.0.270",
164
+ "@types/firefox-webext-browser": "^120.0.4",
165
+ "@types/node": "^22.5.3",
166
+ "@types/react": "^18.3.5",
167
+ "@types/react-dom": "^18.2.18",
161
168
  commander: "^11.1.0",
169
+ "extension-create": "workspace:*",
170
+ "extension-develop": "workspace:*",
162
171
  semver: "^7.5.4",
163
- "update-check": "^1.5.4"
172
+ "update-check": "^1.5.4",
173
+ "webextension-polyfill": "^0.12.0"
164
174
  },
165
175
  devDependencies: {
166
176
  "@types/jest": "^29.5.11",
167
177
  "@types/mock-fs": "^4.13.4",
168
- "@types/node": "^20.11.5",
169
178
  "@types/semver": "^7.5.6",
170
179
  jest: "^29.7.0",
171
180
  "mock-fs": "^5.2.0",
@@ -184,21 +193,36 @@ var vendors = (browser) => browser === "all" ? "chrome,edge,firefox".split(",")
184
193
  extensionJs.command("create").arguments("<project-name|project-path>").usage("create <project-name|project-path> [options]").description("Creates a new extension.").option(
185
194
  "-t, --template <template-name>",
186
195
  "specify a template for the created project"
187
- ).action(async function(pathOrRemoteUrl, { template }) {
188
- await (0, import_extension_create.extensionCreate)(pathOrRemoteUrl, { template });
196
+ ).option(
197
+ "--install",
198
+ "whether or not to install the dependencies after creating the project"
199
+ ).action(async function(pathOrRemoteUrl, { template, install }) {
200
+ await (0, import_extension_create.extensionCreate)(pathOrRemoteUrl, {
201
+ template,
202
+ install
203
+ });
189
204
  });
190
205
  extensionJs.command("dev").arguments("[project-path|remote-url]").usage("dev [project-path|remote-url] [options]").description("Starts the development server (development mode)").option(
191
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
+ "--profile <path-to-file | boolean>",
192
210
  "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"
193
211
  ).option(
194
212
  "-b, --browser <chrome | edge | firefox>",
195
213
  "specify a browser to run your extension in development mode"
214
+ ).option(
215
+ "--chromium-binary <path-to-binary>",
216
+ "specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default"
217
+ ).option(
218
+ "--gecko-binary <path-to-binary>",
219
+ "specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default"
196
220
  ).option(
197
221
  "--polyfill [boolean]",
198
222
  "whether or not to apply the cross-browser polyfill. Defaults to `true`"
199
223
  ).option(
200
224
  "-p, --port <number>",
201
- "what port should Extension.js run. Defaults to `3000`"
225
+ "what port should Extension.js WebSocket server run. Defaults to `8000`"
202
226
  ).action(async function(pathOrRemoteUrl, { browser = "chrome", ...devOptions }) {
203
227
  for (const vendor of vendors(browser)) {
204
228
  await (0, import_extension_develop.extensionDev)(pathOrRemoteUrl, {
@@ -209,10 +233,19 @@ extensionJs.command("dev").arguments("[project-path|remote-url]").usage("dev [pr
209
233
  });
210
234
  extensionJs.command("start").arguments("[project-path|remote-url]").usage("start [project-path|remote-url] [options]").description("Starts the development server (production mode)").option(
211
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
+ "--profile <path-to-file | boolean>",
212
239
  "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"
213
240
  ).option(
214
241
  "-b, --browser <chrome | edge | firefox>",
215
242
  "specify a browser to run your extension in development mode"
243
+ ).option(
244
+ "--chromium-binary <path-to-binary>",
245
+ "specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default"
246
+ ).option(
247
+ "--gecko-binary <path-to-binary>",
248
+ "specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default"
216
249
  ).option(
217
250
  "--polyfill [boolean]",
218
251
  "whether or not to apply the cross-browser polyfill. Defaults to `true`"
@@ -0,0 +1,7 @@
1
+ type CSSContentData = Readonly<Record<string, string>>
2
+
3
+ declare module '*.css' {
4
+ const content: CSSContentData
5
+
6
+ export default content
7
+ }
@@ -0,0 +1,19 @@
1
+ type CSSModuleData = Readonly<Record<string, string>>
2
+
3
+ declare module '*.module.css' {
4
+ const content: CSSModuleData
5
+
6
+ export default content
7
+ }
8
+
9
+ declare module '*.module.scss' {
10
+ const content: CSSModuleData
11
+
12
+ export default content
13
+ }
14
+
15
+ declare module '*.module.sass' {
16
+ const content: CSSModuleData
17
+
18
+ export default content
19
+ }
@@ -0,0 +1,58 @@
1
+ declare module '*.png' {
2
+ const content: string
3
+
4
+ export default content
5
+ }
6
+
7
+ declare module '*.jpg' {
8
+ const content: string
9
+
10
+ export default content
11
+ }
12
+
13
+ declare module '*.jpeg' {
14
+ const content: string
15
+
16
+ export default content
17
+ }
18
+
19
+ declare module '*.gif' {
20
+ const content: string
21
+
22
+ export default content
23
+ }
24
+
25
+ declare module '*.webp' {
26
+ const content: string
27
+
28
+ export default content
29
+ }
30
+
31
+ declare module '*.avif' {
32
+ const content: string
33
+
34
+ export default content
35
+ }
36
+
37
+ declare module '*.ico' {
38
+ const content: string
39
+
40
+ export default content
41
+ }
42
+
43
+ declare module '*.bmp' {
44
+ const content: string
45
+
46
+ export default content
47
+ }
48
+
49
+ declare module '*.svg' {
50
+ /**
51
+ * Use `any` to avoid conflicts with
52
+ * `@svgr/webpack` plugin or
53
+ * `babel-plugin-inline-react-svg` plugin.
54
+ */
55
+ const content: any
56
+
57
+ export default content
58
+ }
@@ -0,0 +1,13 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="react" />
3
+ /// <reference types="react-dom" />
4
+ /// <reference types="chrome" />
5
+ /// <reference path="./css-content.d.ts" />
6
+ /// <reference path="./css-modules.d.ts" />
7
+ /// <reference path="./images.d.ts" />
8
+
9
+ declare namespace NodeJS {
10
+ interface ProcessEnv {
11
+ readonly EXTENSION_ENV: 'development' | 'production' | 'test' | 'debug'
12
+ }
13
+ }
@@ -0,0 +1,7 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="react" />
3
+ /// <reference types="react-dom" />
4
+ /// <reference types="chrome" />
5
+ /// <reference path="./css-content.d.ts" />
6
+ /// <reference path="./css-modules.d.ts" />
7
+ /// <reference path="./images.d.ts" />
@@ -0,0 +1 @@
1
+ /// <reference types="webextension-polyfill" />
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=18"
10
10
  },
11
11
  "name": "extension",
12
- "version": "2.0.0-alpha.3",
12
+ "version": "2.0.0-alpha.30",
13
13
  "description": "Create cross-browser extensions with no build configuration.",
14
14
  "main": "./dist/cli.js",
15
15
  "types": "./dist/cli.d.ts",
@@ -25,17 +25,6 @@
25
25
  "email": "boss@cezaraugusto.net",
26
26
  "url": "https://cezaraugusto.com"
27
27
  },
28
- "scripts": {
29
- "watch": "yarn compile --watch",
30
- "compile:readme-files": "node ./scripts/copyMarkdownFilesToCli.js",
31
- "compile:tailwind-config": "node ./scripts/copyTailwindConfig.js",
32
- "compile:stylelint-config": "node ./scripts/copyStylelintConfig.js",
33
- "compile:cli": "tsup-node ./cli.ts --format cjs --dts --target=node18",
34
- "compile": "yarn compile:readme-files && yarn compile:tailwind-config && yarn compile:stylelint-config &&yarn compile:cli",
35
- "clean": "rm -rf dist",
36
- "test": "echo \"Note: no test specified\" && exit 0",
37
- "test:cli": "jest __spec__/cli.spec.ts"
38
- },
39
28
  "keywords": [
40
29
  "zero-config",
41
30
  "build",
@@ -51,16 +40,21 @@
51
40
  ],
52
41
  "dependencies": {
53
42
  "@colors/colors": "^1.6.0",
54
- "extension-create": "2.0.0-alpha.3",
55
- "extension-develop": "2.0.0-alpha.3",
43
+ "@types/chrome": "^0.0.270",
44
+ "@types/firefox-webext-browser": "^120.0.4",
45
+ "@types/node": "^22.5.3",
46
+ "@types/react": "^18.3.5",
47
+ "@types/react-dom": "^18.2.18",
56
48
  "commander": "^11.1.0",
57
49
  "semver": "^7.5.4",
58
- "update-check": "^1.5.4"
50
+ "update-check": "^1.5.4",
51
+ "webextension-polyfill": "^0.12.0",
52
+ "extension-create": "2.0.0-alpha.30",
53
+ "extension-develop": "2.0.0-alpha.30"
59
54
  },
60
55
  "devDependencies": {
61
56
  "@types/jest": "^29.5.11",
62
57
  "@types/mock-fs": "^4.13.4",
63
- "@types/node": "^20.11.5",
64
58
  "@types/semver": "^7.5.6",
65
59
  "jest": "^29.7.0",
66
60
  "mock-fs": "^5.2.0",
@@ -68,5 +62,17 @@
68
62
  "tsconfig": "*",
69
63
  "tsup": "^8.0.1",
70
64
  "typescript": "5.3.3"
65
+ },
66
+ "scripts": {
67
+ "watch": "pnpm compile --watch",
68
+ "compile:types": "bash install_scripts.sh",
69
+ "compile:readme-files": "node ./scripts/copyMarkdownFilesToCli.js",
70
+ "compile:tailwind-config": "node ./scripts/copyTailwindConfig.js",
71
+ "compile:stylelint-config": "node ./scripts/copyStylelintConfig.js",
72
+ "compile:cli": "tsup-node ./cli.ts --format cjs --dts --target=node18",
73
+ "compile": "pnpm compile:readme-files && pnpm compile:tailwind-config && pnpm compile:stylelint-config && pnpm compile:cli && pnpm compile:types",
74
+ "clean": "rm -rf dist",
75
+ "test": "echo \"Note: no test specified\" && exit 0",
76
+ "test:cli": "jest __spec__/cli.spec.ts"
71
77
  }
72
- }
78
+ }