extension 2.0.0-rc.3 → 2.0.0-rc.31
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 +36 -100
- package/dist/check-updates.d.ts +1 -0
- package/dist/cli-lib/messages.d.ts +8 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +104 -283
- package/dist/rslib.config.d.ts +2 -0
- package/dist/types/index.d.ts +28 -11
- package/dist/types.d.ts +16 -0
- package/package.json +19 -18
- package/dist/stylelint.config.js +0 -7
- package/dist/tailwind.config.js +0 -25
package/README.md
CHANGED
|
@@ -1,134 +1,81 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[npm-image]: https://img.shields.io/npm/v/extension.svg
|
|
4
|
-
[npm-url]: https://npmjs.org/package/extension
|
|
1
|
+
[npm-version-image]: https://img.shields.io/npm/v/extension.svg?color=0971fe
|
|
2
|
+
[npm-version-url]: https://www.npmjs.com/package/extension
|
|
5
3
|
[downloads-image]: https://img.shields.io/npm/dm/extension.svg
|
|
6
4
|
[downloads-url]: https://npmjs.org/package/extension
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[prs]: https://img.shields.io/badge/PRs-welcome-brightgreen.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
|
|
13
|
-
[fossa-image]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcezaraugusto%2Fextension.svg?type=shield&issueType=license
|
|
14
|
-
[fossa-url]: https://app.fossa.com/projects/git%2Bgithub.com%2Fcezaraugusto%2Fextension?ref=badge_shield&issueType=license
|
|
5
|
+
[action-image]: https://github.com/extension-js/extension.js/actions/workflows/ci.yml/badge.svg?branch=main
|
|
6
|
+
[action-url]: https://github.com/extension-js/extension.js/actions
|
|
15
7
|
[discord-image]: https://img.shields.io/discord/1253608412890271755?label=Discord&logo=discord&style=flat
|
|
16
8
|
[discord-url]: https://discord.gg/v9h2RgeTSN
|
|
9
|
+
[snyk-image]: https://snyk.io/test/github/extension-js/extension/badge.svg
|
|
10
|
+
[snyk-url]: https://snyk.io/test/github/extension-js/extension
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<!-- > Plug-and-play, zero-config, cross-browser extension development tool. -->
|
|
21
|
-
|
|
22
|
-
<!-- > Make it very easy to develop cross-browser extensions. -->
|
|
23
|
-
|
|
24
|
-
<!-- <img alt="Extension.js with all the browser runners open" src="https://github.com/cezaraugusto/extension.js/assets/4672033/f0f5bbfc-e873-4856-9fdd-db2b42d9ab96">
|
|
25
|
-
<hr> -->
|
|
26
|
-
|
|
27
|
-
<img alt="Logo" align="right" src="https://user-images.githubusercontent.com/4672033/102850460-4d22aa80-43f8-11eb-82db-9efce586f73e.png" width="25%" />
|
|
12
|
+
> The cross-browser extension framework
|
|
28
13
|
|
|
29
|
-
|
|
14
|
+
# Extension.js [![Version][npm-version-image]][npm-version-url] [![Downloads][downloads-image]][downloads-url] [![workflow][action-image]][action-url] [![discord][discord-image]][discord-url]
|
|
30
15
|
|
|
31
|
-
|
|
16
|
+
<img alt="Logo" align="right" src="https://github.com/user-attachments/assets/698a3b2e-c77a-4857-bd2a-1d2eb180120b" width="20%" />
|
|
32
17
|
|
|
33
18
|
- [Create A New Extension](#create-a-new-extension) — How to create a new extension.
|
|
34
19
|
- [Get Started Immediately](#get-started-immediately) — Get work done in no time.
|
|
35
|
-
- [
|
|
20
|
+
- [Start From An Example](https://github.com/extension-js/extension.js/tree/main/examples) — Start with your favorite tool.
|
|
21
|
+
- [I have An Extension](#i-have-an-extension) — Use only specific parts of Extension.js.
|
|
36
22
|
|
|
37
|
-
Extension.js
|
|
23
|
+
Extension.js makes it very easy to develop cross-browser extensions.<br />Developers prefer it for its fast builds, unified interface, and zero configuration setup.
|
|
38
24
|
|
|
39
25
|
## Create A New Extension
|
|
40
26
|
|
|
27
|
+
Use the `create` command to generate a new extension. Also works with pnpm, yarn, and bun.
|
|
28
|
+
|
|
41
29
|
```bash
|
|
42
|
-
npx extension create my-extension
|
|
30
|
+
npx extension@latest create my-extension
|
|
43
31
|
cd my-extension
|
|
44
32
|
npm run dev
|
|
45
33
|
```
|
|
46
34
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
You are done. Time to hack on your extension!
|
|
35
|
+
### Watch Demo
|
|
50
36
|
|
|
51
37
|
https://github.com/cezaraugusto/extension/assets/4672033/7263d368-99c4-434f-a60a-72c489672586
|
|
52
38
|
|
|
53
|
-
## Web Standards and
|
|
39
|
+
## Web Standards and Framework Support
|
|
54
40
|
|
|
55
|
-
For a preview of extensions running these technologies, see
|
|
41
|
+
<!-- For a preview of extensions running these technologies, see the [templates](https://templates.extension.land) website. -->
|
|
56
42
|
|
|
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/
|
|
43
|
+
| <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/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/c5f8a127-3c2a-4ceb-bb46-948cf2c8bd89" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/8807efd9-93e5-4db5-a1d2-9ac524f7ecc2" width="70"> |
|
|
58
44
|
| :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: |
|
|
59
|
-
|
|
|
45
|
+
| ESNext<br>latest | TypeScript<br>latest | WASM<br>latest | React<br>18+ | Vue<br>3+ | Svelte<br>5+ | Preact<br>10+ | Angular<br>👋 | Solid<br>👋 |
|
|
60
46
|
|
|
61
47
|
👋 = PR Welcome!
|
|
62
48
|
|
|
63
49
|
## Get Started Immediately
|
|
64
50
|
|
|
65
|
-
|
|
51
|
+
Start developing an extension using a sample from Chrome Extension Samples
|
|
66
52
|
|
|
67
|
-
|
|
53
|
+
See the example below where we request the sample [page-redder](https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/functional-samples/sample.page-redder) from [Google Chrome Extension Samples](https://github.com/GoogleChrome/chrome-extensions-samples).
|
|
68
54
|
|
|
69
|
-
|
|
70
|
-
npx extension dev https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/functional-samples/sample.page-redder --browser=edge
|
|
71
|
-
```
|
|
55
|
+
### Watch Demo
|
|
72
56
|
|
|
73
57
|
https://github.com/cezaraugusto/extension/assets/4672033/ee221a94-6ec7-4e04-8553-8812288927f1
|
|
74
58
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<details>
|
|
78
|
-
<summary>
|
|
79
|
-
🔥 Use Edge to start developing an extension from Chrome Extension Samples
|
|
80
|
-
</summary>
|
|
81
|
-
|
|
82
|
-
> See the example below where we request the sample [magic8ball](https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/api-samples/topSites/magic8ball) from from [Google Chrome Extension Samples](https://github.com/GoogleChrome/chrome-extensions-samples) with Edge as the runtime browser.
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
npx extension dev https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/api-samples/topSites/magic8ball --browser=edge
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
https://github.com/cezaraugusto/extension/assets/4672033/2db2a1f6-3110-4380-9a49-dc9d034146aa
|
|
89
|
-
|
|
90
|
-
</details>
|
|
91
|
-
|
|
92
|
-
<details>
|
|
93
|
-
<summary>
|
|
94
|
-
🔥🔥 Use Edge to start developing a Mozilla Add-On from MDN WebExtensions Examples
|
|
95
|
-
</summary>
|
|
96
|
-
|
|
97
|
-
> See the example below where we request the sample [Apply CSS](https://github.com/mdn/webextensions-examples/tree/main/apply-css) from [MDN WebExtensions Examples](https://github.com/mdn/webextensions-examples) using Edge as the runtime browser.
|
|
59
|
+
### Try Yourself
|
|
98
60
|
|
|
99
61
|
```bash
|
|
100
|
-
npx extension dev https://github.com/
|
|
62
|
+
npx extension@latest dev https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/functional-samples/sample.page-redder --browser=edge
|
|
101
63
|
```
|
|
102
64
|
|
|
103
|
-
https://github.com/cezaraugusto/extension/assets/4672033/130cb430-1567-419c-8c90-23fddcf20f00
|
|
104
|
-
|
|
105
65
|
</details>
|
|
106
66
|
|
|
107
|
-
|
|
108
|
-
<summary>
|
|
109
|
-
🔥🔥🔥 Use Chrome and Firefox to start developing a Mozilla Add-On from MDN WebExtensions Examples
|
|
110
|
-
</summary>
|
|
111
|
-
|
|
112
|
-
> See the example below where we request the sample [firefox-code-search](https://github.com/mdn/webextensions-examples/tree/main/firefox-code-search) from [MDN WebExtensions Examples](https://github.com/mdn/webextensions-examples) using Chrome and Firefox as the runtime browsers.
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
npx extension dev https://github.com/mdn/webextensions-examples/tree/main/firefox-code-search --browser=chrome,firefox --polyfill=true
|
|
116
|
-
```
|
|
67
|
+
## I have An Extension
|
|
117
68
|
|
|
118
|
-
|
|
69
|
+
If you have an existing extension which is using a package manager, you can install the Extension.js package and manually create the scripts used to run your extension.
|
|
119
70
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
## I have An Extension
|
|
71
|
+
### See How It Works
|
|
123
72
|
|
|
124
73
|
https://github.com/cezaraugusto/extension/assets/4672033/48694a23-b7f1-4098-9c5d-eff49983739c
|
|
125
74
|
|
|
126
|
-
If you have an existing extension which is using a package manager, you can install the Extension.js package and manually create the scripts used to run your extension. See the demo above or follow these instructions to get it done:
|
|
127
|
-
|
|
128
75
|
**Step 1 - Install extension as a `devDependency`**
|
|
129
76
|
|
|
130
77
|
```bash
|
|
131
|
-
npm install extension --save-dev
|
|
78
|
+
npm install extension@latest --save-dev
|
|
132
79
|
```
|
|
133
80
|
|
|
134
81
|
**Step 2 - Link your npm scripts with the executable Extension.js commands**
|
|
@@ -138,7 +85,7 @@ npm install extension --save-dev
|
|
|
138
85
|
"scripts": {
|
|
139
86
|
"build": "extension build",
|
|
140
87
|
"dev": "extension dev",
|
|
141
|
-
"
|
|
88
|
+
"preview": "extension preview"
|
|
142
89
|
},
|
|
143
90
|
"devDependencies": {
|
|
144
91
|
// ...other dependencies
|
|
@@ -150,18 +97,18 @@ npm install extension --save-dev
|
|
|
150
97
|
Done. You are all set!
|
|
151
98
|
|
|
152
99
|
- To develop the extension, run `npm run dev`.
|
|
153
|
-
- To visualize the extension in production mode, run `npm run start`.
|
|
154
100
|
- To build the extension in production mode, run `npm run build`.
|
|
101
|
+
- To visualize the extension in production mode, run `npm run build` and `npm run preview`.
|
|
155
102
|
|
|
156
103
|
## Using a specific browser for development
|
|
157
104
|
|
|
158
105
|
### Desktop Browsers
|
|
159
106
|
|
|
160
|
-
| <img src="https://
|
|
161
|
-
|
|
|
162
|
-
|
|
|
107
|
+
| <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome.svg" width="70"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge.svg" width="70"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox.svg" width="70"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera.svg" width="70"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari.svg" width="70"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/chromium/chromium.svg" width="70"> |
|
|
108
|
+
| :-----------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: |
|
|
109
|
+
| Chrome<br>✅ | Edge<br>✅ | Firefox<br>✅ | Opera<br>☑️ | Safari<br>⛔️ | Chromium<br>☑️ |
|
|
163
110
|
|
|
164
|
-
|
|
111
|
+
The browsers listed above represent those with official extension stores. Note that Chromium-based browsers (like Arc, Brave, Vivaldi, and many others) are theoretically supported through the Chrome/Chromium compatibility layer.
|
|
165
112
|
|
|
166
113
|
### Mobile Browsers
|
|
167
114
|
|
|
@@ -169,17 +116,6 @@ Done. You are all set!
|
|
|
169
116
|
| :-------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------: |
|
|
170
117
|
| Firefox (Android)<br>⛔️ | Safari (iOS)<br>⛔️ |
|
|
171
118
|
|
|
172
|
-
If you want to target a specific browser, just pass the `--browser` flag to the `dev`/`start` command (based on the list available above), like `npx extension dev path/to/extension --browser=edge`.
|
|
173
|
-
|
|
174
|
-
> Hint
|
|
175
|
-
> Pass --browser="all" to load all available browsers at once.
|
|
176
|
-
|
|
177
|
-
```sh
|
|
178
|
-
extension dev --browser=all
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
<img alt="Extension.js with all the browser runners open" src="https://github.com/cezaraugusto/extension.js/assets/4672033/f0f5bbfc-e873-4856-9fdd-db2b42d9ab96">
|
|
182
|
-
|
|
183
119
|
## License
|
|
184
120
|
|
|
185
|
-
MIT (c) Cezar Augusto.
|
|
121
|
+
MIT (c) Cezar Augusto and the Extension.js Authors.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function checkUpdates(packageJson: Record<string, any>): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function updateFailed(err: any): string;
|
|
2
|
+
export declare function checkUpdates(packageJson: Record<string, any>, update: {
|
|
3
|
+
latest: string;
|
|
4
|
+
}): string;
|
|
5
|
+
export declare function unsupportedNodeVersion(): string;
|
|
6
|
+
export declare function noURLWithoutStart(argument: string): string;
|
|
7
|
+
export declare function notImplemented(argument: string): string;
|
|
8
|
+
export declare function programHelp(): string;
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,329 +1,150 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var import_commander = require("commander");
|
|
31
|
-
var import_extension_create = require("extension-create");
|
|
32
|
-
var import_extension_develop = require("extension-develop");
|
|
33
|
-
|
|
34
|
-
// cli-lib/messages.ts
|
|
35
|
-
var import_safe = require("@colors/colors/safe");
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.n = (module)=>{
|
|
6
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
7
|
+
__webpack_require__.d(getter, {
|
|
8
|
+
a: getter
|
|
9
|
+
});
|
|
10
|
+
return getter;
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
(()=>{
|
|
14
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
15
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: definition[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
})();
|
|
21
|
+
(()=>{
|
|
22
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
const external_commander_namespaceObject = require("commander");
|
|
26
|
+
const external_extension_create_namespaceObject = require("extension-create");
|
|
27
|
+
const external_extension_develop_namespaceObject = require("extension-develop");
|
|
28
|
+
const external_chalk_namespaceObject = require("chalk");
|
|
29
|
+
var external_chalk_default = /*#__PURE__*/ __webpack_require__.n(external_chalk_namespaceObject);
|
|
36
30
|
function updateFailed(err) {
|
|
37
|
-
|
|
31
|
+
return "\uD83E\uDDE9\n" + external_chalk_default().red(`Failed to check for updates: ${err.message}`);
|
|
38
32
|
}
|
|
39
33
|
function checkUpdates(packageJson, update) {
|
|
40
|
-
|
|
41
|
-
${(0, import_safe.brightYellow)("Notice:")} A new version of ${(0, import_safe.brightGreen)(
|
|
42
|
-
"Extension.js"
|
|
43
|
-
)} is available!
|
|
44
|
-
You are currently using version ${(0, import_safe.brightYellow)(packageJson.version)}.
|
|
45
|
-
The latest stable version is ${(0, import_safe.brightYellow)(update.latest)}.
|
|
46
|
-
Please update to the latest version to enjoy new features and improvements.
|
|
47
|
-
`;
|
|
34
|
+
return `\u{1F9E9}\n${external_chalk_default().yellow('Notice:')} A new version of ${external_chalk_default().green('Extension.js')} is available!\nYou are currently using version ${external_chalk_default().yellow(packageJson.version)}.\nThe latest stable version is ${external_chalk_default().yellow(update.latest)}.\nPlease update to the latest version to enjoy new features and improvements.\n`;
|
|
48
35
|
}
|
|
49
36
|
function programHelp() {
|
|
50
|
-
|
|
51
|
-
${(
|
|
37
|
+
return `\u{1F9E9}
|
|
38
|
+
${external_chalk_default().underline('Help center for the Extension.js program')}
|
|
52
39
|
|
|
53
|
-
${(
|
|
40
|
+
${external_chalk_default().yellow('Usage:')} extension [command] [options]
|
|
54
41
|
|
|
55
|
-
${(
|
|
42
|
+
${external_chalk_default().yellow('Note:')} If you are looking for a specific list of options,
|
|
56
43
|
all high-level commands offer their own \`--help\` file with
|
|
57
44
|
information about usage and a list of command flags available.
|
|
58
45
|
|
|
59
46
|
For example:
|
|
60
47
|
|
|
61
|
-
${(
|
|
48
|
+
${external_chalk_default().green('extension create --help')}
|
|
62
49
|
outputs information about the "create" command.
|
|
63
50
|
|
|
64
51
|
Options available:
|
|
65
52
|
|
|
66
|
-
${(
|
|
53
|
+
${external_chalk_default().green('extension create <extension-name>')}
|
|
67
54
|
Creates a new extension from a template. The "create" command
|
|
68
55
|
is optional and can be omitted.
|
|
69
56
|
|
|
70
|
-
${(
|
|
57
|
+
${external_chalk_default().green('extension dev <extension-path>')}
|
|
71
58
|
Starts a new browser instance in development mode, with the target
|
|
72
59
|
extension loaded and auto-reloaded based on file changes.
|
|
73
60
|
|
|
74
|
-
${(
|
|
61
|
+
${external_chalk_default().green('extension start <extension-path>')}
|
|
75
62
|
Starts a new browser instance in production mode, with the target
|
|
76
63
|
extension compiled based on the browser choice.
|
|
77
64
|
|
|
78
|
-
${(
|
|
65
|
+
${external_chalk_default().green('extension build <extension-path>')}
|
|
79
66
|
Builds the target extension with browser defaults, ready for packaging.
|
|
80
67
|
|
|
81
|
-
${(
|
|
68
|
+
${external_chalk_default().green('extension --help')}
|
|
82
69
|
This command ;) Outputs a help file with key command options.
|
|
83
70
|
|
|
84
|
-
${(
|
|
85
|
-
${(
|
|
71
|
+
${external_chalk_default().yellow('Feels something is wrong? Help by reporting a bug:')}
|
|
72
|
+
${external_chalk_default().underline('https://github.com/cezaraugusto/extension/issues/new')}
|
|
86
73
|
`;
|
|
87
74
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
var import_update_check = __toESM(require("update-check"));
|
|
75
|
+
const external_update_check_namespaceObject = require("update-check");
|
|
76
|
+
var external_update_check_default = /*#__PURE__*/ __webpack_require__.n(external_update_check_namespaceObject);
|
|
91
77
|
function isStableVersion(version) {
|
|
92
|
-
|
|
78
|
+
return !/[a-zA-Z]/.test(version);
|
|
93
79
|
}
|
|
94
|
-
async function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
console.error(updateFailed(err));
|
|
80
|
+
async function check_updates_checkUpdates(packageJson) {
|
|
81
|
+
let update = null;
|
|
82
|
+
try {
|
|
83
|
+
update = await external_update_check_default()(packageJson);
|
|
84
|
+
} catch (err) {
|
|
85
|
+
if ('development' === process.env.EXTENSION_ENV) console.error(updateFailed(err));
|
|
101
86
|
}
|
|
102
|
-
|
|
103
|
-
if (update && isStableVersion(update.latest)) {
|
|
104
|
-
console.log(checkUpdates(packageJson, update));
|
|
105
|
-
}
|
|
87
|
+
if (update && isStableVersion(update.latest)) console.log(checkUpdates(packageJson, update));
|
|
106
88
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
node: ">=18"
|
|
118
|
-
},
|
|
119
|
-
name: "extension",
|
|
120
|
-
version: "2.0.0-rc.3",
|
|
121
|
-
description: "Create cross-browser extensions with no build configuration.",
|
|
122
|
-
main: "./dist/cli.js",
|
|
123
|
-
types: "./dist/cli.d.ts",
|
|
124
|
-
files: [
|
|
125
|
-
"dist",
|
|
126
|
-
"README.md"
|
|
127
|
-
],
|
|
128
|
-
bin: {
|
|
129
|
-
extension: "./dist/cli.js"
|
|
130
|
-
},
|
|
131
|
-
author: {
|
|
132
|
-
name: "Cezar Augusto",
|
|
133
|
-
email: "boss@cezaraugusto.net",
|
|
134
|
-
url: "https://cezaraugusto.com"
|
|
135
|
-
},
|
|
136
|
-
scripts: {
|
|
137
|
-
watch: "pnpm compile --watch",
|
|
138
|
-
"compile:types": "bash install_scripts.sh",
|
|
139
|
-
"compile:readme-files": "node ./scripts/copyMarkdownFilesToCli.js",
|
|
140
|
-
"compile:tailwind-config": "node ./scripts/copyTailwindConfig.js",
|
|
141
|
-
"compile:stylelint-config": "node ./scripts/copyStylelintConfig.js",
|
|
142
|
-
"compile:cli": "tsup-node ./cli.ts --format cjs --dts --target=node18",
|
|
143
|
-
compile: "pnpm compile:readme-files && pnpm compile:tailwind-config && pnpm compile:stylelint-config && pnpm compile:cli && pnpm compile:types",
|
|
144
|
-
clean: "rm -rf dist",
|
|
145
|
-
test: 'echo "Note: no test specified" && exit 0',
|
|
146
|
-
"test:cli": "jest __spec__/cli.spec.ts"
|
|
147
|
-
},
|
|
148
|
-
keywords: [
|
|
149
|
-
"zero-config",
|
|
150
|
-
"build",
|
|
151
|
-
"develop",
|
|
152
|
-
"browser",
|
|
153
|
-
"extension",
|
|
154
|
-
"chrome extension",
|
|
155
|
-
"edge extension",
|
|
156
|
-
"firefox extension",
|
|
157
|
-
"safari extension",
|
|
158
|
-
"web",
|
|
159
|
-
"react",
|
|
160
|
-
"typescript"
|
|
161
|
-
],
|
|
162
|
-
dependencies: {
|
|
163
|
-
"@colors/colors": "^1.6.0",
|
|
164
|
-
"@types/chrome": "^0.0.287",
|
|
165
|
-
"@types/firefox-webext-browser": "^120.0.4",
|
|
166
|
-
"@types/node": "^22.10.1",
|
|
167
|
-
"@types/react": "^19.0.1",
|
|
168
|
-
"@types/react-dom": "^19.0.1",
|
|
169
|
-
commander: "^12.1.0",
|
|
170
|
-
"extension-create": "workspace:*",
|
|
171
|
-
"extension-develop": "workspace:*",
|
|
172
|
-
semver: "^7.6.3",
|
|
173
|
-
"update-check": "^1.5.4",
|
|
174
|
-
"webextension-polyfill": "^0.12.0"
|
|
175
|
-
},
|
|
176
|
-
devDependencies: {
|
|
177
|
-
"@types/jest": "^29.5.14",
|
|
178
|
-
"@types/mock-fs": "^4.13.4",
|
|
179
|
-
"@types/semver": "^7.5.8",
|
|
180
|
-
jest: "^29.7.0",
|
|
181
|
-
"mock-fs": "^5.4.1",
|
|
182
|
-
"ts-jest": "^29.2.5",
|
|
183
|
-
tsconfig: "*",
|
|
184
|
-
tsup: "^8.3.5",
|
|
185
|
-
typescript: "5.7.2"
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
// cli.ts
|
|
190
|
-
checkUpdates2(package_default);
|
|
191
|
-
var extensionJs = import_commander.program;
|
|
192
|
-
var vendors = (browser) => browser === "all" ? "chrome,edge,firefox".split(",") : browser.split(",");
|
|
193
|
-
extensionJs.name(package_default.name).description(package_default.description).version(package_default.version).addHelpText("after", programHelp());
|
|
194
|
-
extensionJs.command("create").arguments("<project-name|project-path>").usage("create <project-name|project-path> [options]").description("Creates a new extension.").option(
|
|
195
|
-
"-t, --template <template-name>",
|
|
196
|
-
"specify a template for the created project"
|
|
197
|
-
).option(
|
|
198
|
-
"--install",
|
|
199
|
-
"whether or not to install the dependencies after creating the project"
|
|
200
|
-
).action(async function(pathOrRemoteUrl, { template, install }) {
|
|
201
|
-
await (0, import_extension_create.extensionCreate)(pathOrRemoteUrl, {
|
|
202
|
-
template,
|
|
203
|
-
install
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
extensionJs.command("dev").arguments("[project-path|remote-url]").usage("dev [project-path|remote-url] [options]").description("Starts the development server (development mode)").option(
|
|
207
|
-
"--profile <path-to-file | boolean>",
|
|
208
|
-
"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"
|
|
209
|
-
).option(
|
|
210
|
-
"--browser <chrome | edge | firefox>",
|
|
211
|
-
"specify a browser to preview your extension in production mode. Defaults to `chrome`"
|
|
212
|
-
).option(
|
|
213
|
-
"--chromium-binary <path-to-binary>",
|
|
214
|
-
"specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default"
|
|
215
|
-
).option(
|
|
216
|
-
"--gecko-binary <path-to-binary>",
|
|
217
|
-
"specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default"
|
|
218
|
-
).option(
|
|
219
|
-
"--polyfill [boolean]",
|
|
220
|
-
"whether or not to apply the cross-browser polyfill. Defaults to `false`"
|
|
221
|
-
).option(
|
|
222
|
-
"--open [boolean]",
|
|
223
|
-
"whether or not to open the browser automatically. Defaults to `true`"
|
|
224
|
-
).option(
|
|
225
|
-
"--starting-url <url>",
|
|
226
|
-
"specify the starting URL for the browser. Defaults to `undefined`"
|
|
227
|
-
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...devOptions }) {
|
|
228
|
-
for (const vendor of vendors(browser)) {
|
|
229
|
-
await (0, import_extension_develop.extensionDev)(pathOrRemoteUrl, {
|
|
230
|
-
...devOptions,
|
|
231
|
-
profile: devOptions.profile,
|
|
232
|
-
browser: vendor,
|
|
233
|
-
chromiumBinary: devOptions.chromiumBinary,
|
|
234
|
-
geckoBinary: devOptions.geckoBinary,
|
|
235
|
-
// @ts-expect-error open is a boolean
|
|
236
|
-
polyfill: devOptions.polyfill === "false" ? false : true,
|
|
237
|
-
open: devOptions.open,
|
|
238
|
-
startingUrl: devOptions.startingUrl
|
|
89
|
+
var package_namespaceObject = JSON.parse('{"license":"MIT","repository":{"type":"git","url":"https://github.com/cezaraugusto/extension.git","directory":"programs/cli"},"engines":{"node":">=18"},"exports":{".":{"types":"./dist/cli.d.ts","import":"./dist/cli.js","require":"./dist/cli.js"}},"main":"./dist/cli.js","types":"./dist/cli.d.ts","files":["dist"],"bin":{"extension":"./dist/cli.js"},"name":"extension","version":"2.0.0-rc.31","description":"Create cross-browser extensions with no build configuration.","author":{"name":"Cezar Augusto","email":"boss@cezaraugusto.net","url":"https://cezaraugusto.com"},"scripts":{"watch":"rslib build --watch","compile:types":"bash install_scripts.sh","compile:readme-files":"node ./scripts/copyMarkdownFilesToCli.js","compile:cli":"rslib build","compile":"pnpm compile:readme-files && pnpm compile:cli && pnpm compile:types","clean":"rm -rf dist","test":"echo \\"Note: no test specified\\" && exit 0","test:cli":"vitest run"},"keywords":["zero-config","build","develop","browser","extension","chrome extension","edge extension","firefox extension","safari extension","web","react","typescript"],"dependencies":{"chalk":"^5.3.0","@types/chrome":"^0.0.287","@types/firefox-webext-browser":"^120.0.4","@types/node":"^22.10.1","@types/react":"^19.0.1","@types/react-dom":"^19.0.1","commander":"^12.1.0","extension-create":"workspace:*","extension-develop":"workspace:*","semver":"^7.6.3","update-check":"^1.5.4","webextension-polyfill":"^0.12.0"},"devDependencies":{"@rslib/core":"^0.6.9","@types/mock-fs":"^4.13.4","@types/semver":"^7.5.8","mock-fs":"^5.4.1","tsconfig":"*","typescript":"5.7.2"}}');
|
|
90
|
+
check_updates_checkUpdates(package_namespaceObject);
|
|
91
|
+
const extensionJs = external_commander_namespaceObject.program;
|
|
92
|
+
const vendors = (browser)=>'all' === browser ? 'chrome,edge,firefox'.split(',') : browser.split(',');
|
|
93
|
+
extensionJs.name(package_namespaceObject.name).description(package_namespaceObject.description).version(package_namespaceObject.version).addHelpText('after', programHelp());
|
|
94
|
+
extensionJs.command('create').arguments('<project-name|project-path>').usage('create <project-name|project-path> [options]').description('Creates a new extension.').option('-t, --template <template-name>', 'specify a template for the created project').option('--install', 'whether or not to install the dependencies after creating the project').action(async function(pathOrRemoteUrl, { template, install }) {
|
|
95
|
+
await (0, external_extension_create_namespaceObject.extensionCreate)(pathOrRemoteUrl, {
|
|
96
|
+
template,
|
|
97
|
+
install,
|
|
98
|
+
cliVersion: package_namespaceObject.version
|
|
239
99
|
});
|
|
240
|
-
}
|
|
241
100
|
});
|
|
242
|
-
extensionJs.command(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
).
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
)
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
).option(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
browser: vendor,
|
|
266
|
-
chromiumBinary: startOptions.chromiumBinary,
|
|
267
|
-
geckoBinary: startOptions.geckoBinary,
|
|
268
|
-
startingUrl: startOptions.startingUrl
|
|
101
|
+
extensionJs.command('dev').arguments('[project-path|remote-url]').usage('dev [project-path|remote-url] [options]').description('Starts the development server (development mode)').option('--profile <path-to-file | boolean>', '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').option('--browser <chrome | edge | firefox>', 'specify a browser to preview your extension in production mode. Defaults to `chrome`').option('--chromium-binary <path-to-binary>', 'specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default').option('--gecko-binary <path-to-binary>', 'specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default').option('--polyfill [boolean]', 'whether or not to apply the cross-browser polyfill. Defaults to `false`').option('--open [boolean]', 'whether or not to open the browser automatically. Defaults to `true`').option('--starting-url <url>', 'specify the starting URL for the browser. Defaults to `undefined`').option('--port <port>', 'specify the port to use for the development server. Defaults to `8080`').action(async function(pathOrRemoteUrl, { browser = 'chrome', ...devOptions }) {
|
|
102
|
+
for (const vendor of vendors(browser)){
|
|
103
|
+
var _devOptions_polyfill;
|
|
104
|
+
await (0, external_extension_develop_namespaceObject.extensionDev)(pathOrRemoteUrl, {
|
|
105
|
+
...devOptions,
|
|
106
|
+
profile: devOptions.profile,
|
|
107
|
+
browser: vendor,
|
|
108
|
+
chromiumBinary: devOptions.chromiumBinary,
|
|
109
|
+
geckoBinary: devOptions.geckoBinary,
|
|
110
|
+
polyfill: (null == (_devOptions_polyfill = devOptions.polyfill) ? void 0 : _devOptions_polyfill.toString()) !== 'false',
|
|
111
|
+
open: devOptions.open,
|
|
112
|
+
startingUrl: devOptions.startingUrl
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
extensionJs.command('start').arguments('[project-path|remote-url]').usage('start [project-path|remote-url] [options]').description('Starts the development server (production mode)').option('--profile <path-to-file | boolean>', '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').option('--browser <chrome | edge | firefox>', 'specify a browser to preview your extension in production mode. Defaults to `chrome`').option('--polyfill [boolean]', 'whether or not to apply the cross-browser polyfill. Defaults to `true`').option('--chromium-binary <path-to-binary>', 'specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default').option('--gecko-binary <path-to-binary>', 'specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default').option('--starting-url <url>', 'specify the starting URL for the browser. Defaults to `undefined`').option('--port <port>', 'specify the port to use for the development server. Defaults to `8080`').action(async function(pathOrRemoteUrl, { browser = 'chrome', ...startOptions }) {
|
|
117
|
+
for (const vendor of vendors(browser))await (0, external_extension_develop_namespaceObject.extensionStart)(pathOrRemoteUrl, {
|
|
118
|
+
mode: 'production',
|
|
119
|
+
profile: startOptions.profile,
|
|
120
|
+
browser: vendor,
|
|
121
|
+
chromiumBinary: startOptions.chromiumBinary,
|
|
122
|
+
geckoBinary: startOptions.geckoBinary,
|
|
123
|
+
startingUrl: startOptions.startingUrl
|
|
269
124
|
});
|
|
270
|
-
}
|
|
271
125
|
});
|
|
272
|
-
extensionJs.command(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
"specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default"
|
|
281
|
-
).option(
|
|
282
|
-
"--gecko-binary <path-to-binary>",
|
|
283
|
-
"specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default"
|
|
284
|
-
).option(
|
|
285
|
-
"--starting-url <url>",
|
|
286
|
-
"specify the starting URL for the browser. Defaults to `undefined`"
|
|
287
|
-
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...previewOptions }) {
|
|
288
|
-
for (const vendor of vendors(browser)) {
|
|
289
|
-
await (0, import_extension_develop.extensionPreview)(pathOrRemoteUrl, {
|
|
290
|
-
mode: "production",
|
|
291
|
-
profile: previewOptions.profile,
|
|
292
|
-
browser: vendor,
|
|
293
|
-
chromiumBinary: previewOptions.chromiumBinary,
|
|
294
|
-
geckoBinary: previewOptions.geckoBinary,
|
|
295
|
-
startingUrl: previewOptions.startingUrl
|
|
126
|
+
extensionJs.command('preview').arguments('[project-name]').usage('preview [path-to-remote-extension] [options]').description('Preview the extension in production mode').option('--profile <path-to-file | boolean>', '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').option('--browser <chrome | edge | firefox>', 'specify a browser to preview your extension in production mode. Defaults to `chrome`').option('--chromium-binary <path-to-binary>', 'specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default').option('--gecko-binary <path-to-binary>', 'specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default').option('--starting-url <url>', 'specify the starting URL for the browser. Defaults to `undefined`').option('--port <port>', 'specify the port to use for the development server. Defaults to `8080`').action(async function(pathOrRemoteUrl, { browser = 'chrome', ...previewOptions }) {
|
|
127
|
+
for (const vendor of vendors(browser))await (0, external_extension_develop_namespaceObject.extensionPreview)(pathOrRemoteUrl, {
|
|
128
|
+
mode: 'production',
|
|
129
|
+
profile: previewOptions.profile,
|
|
130
|
+
browser: vendor,
|
|
131
|
+
chromiumBinary: previewOptions.chromiumBinary,
|
|
132
|
+
geckoBinary: previewOptions.geckoBinary,
|
|
133
|
+
startingUrl: previewOptions.startingUrl
|
|
296
134
|
});
|
|
297
|
-
}
|
|
298
135
|
});
|
|
299
|
-
extensionJs.command(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
"whether or not to compress the extension into a ZIP file. Defaults to `false`"
|
|
308
|
-
).option(
|
|
309
|
-
"--zip-source [boolean]",
|
|
310
|
-
"whether or not to include the source files in the ZIP file. Defaults to `false`"
|
|
311
|
-
).option(
|
|
312
|
-
"--zip-filename <string>",
|
|
313
|
-
"specify the name of the ZIP file. Defaults to the extension name and version"
|
|
314
|
-
).option(
|
|
315
|
-
"--silent [boolean]",
|
|
316
|
-
"whether or not to open the browser automatically. Defaults to `false`"
|
|
317
|
-
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...buildOptions }) {
|
|
318
|
-
for (const vendor of vendors(browser)) {
|
|
319
|
-
await (0, import_extension_develop.extensionBuild)(pathOrRemoteUrl, {
|
|
320
|
-
browser: vendor,
|
|
321
|
-
polyfill: buildOptions.polyfill,
|
|
322
|
-
zip: buildOptions.zip,
|
|
323
|
-
zipSource: buildOptions.zipSource,
|
|
324
|
-
zipFilename: buildOptions.zipFilename,
|
|
325
|
-
silent: buildOptions.silent
|
|
136
|
+
extensionJs.command('build').arguments('[project-name]').usage('build [path-to-remote-extension] [options]').description('Builds the extension for production').option('--browser <chrome | edge | firefox>', 'specify a browser to preview your extension in production mode. Defaults to `chrome`').option('--polyfill [boolean]', 'whether or not to apply the cross-browser polyfill. Defaults to `false`').option('--zip [boolean]', 'whether or not to compress the extension into a ZIP file. Defaults to `false`').option('--zip-source [boolean]', 'whether or not to include the source files in the ZIP file. Defaults to `false`').option('--zip-filename <string>', 'specify the name of the ZIP file. Defaults to the extension name and version').option('--silent [boolean]', 'whether or not to open the browser automatically. Defaults to `false`').action(async function(pathOrRemoteUrl, { browser = 'chrome', ...buildOptions }) {
|
|
137
|
+
for (const vendor of vendors(browser))await (0, external_extension_develop_namespaceObject.extensionBuild)(pathOrRemoteUrl, {
|
|
138
|
+
browser: vendor,
|
|
139
|
+
polyfill: buildOptions.polyfill,
|
|
140
|
+
zip: buildOptions.zip,
|
|
141
|
+
zipSource: buildOptions.zipSource,
|
|
142
|
+
zipFilename: buildOptions.zipFilename,
|
|
143
|
+
silent: buildOptions.silent
|
|
326
144
|
});
|
|
327
|
-
}
|
|
328
145
|
});
|
|
329
146
|
extensionJs.parse();
|
|
147
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
148
|
+
Object.defineProperty(exports, '__esModule', {
|
|
149
|
+
value: true
|
|
150
|
+
});
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,25 +5,42 @@
|
|
|
5
5
|
/// <reference path="./css-modules.d.ts" />
|
|
6
6
|
/// <reference path="./images.d.ts" />
|
|
7
7
|
|
|
8
|
+
type ExtensionBrowser =
|
|
9
|
+
| 'chrome'
|
|
10
|
+
| 'edge'
|
|
11
|
+
| 'firefox'
|
|
12
|
+
| 'chromium-based'
|
|
13
|
+
| 'gecko-based'
|
|
14
|
+
type ExtensionMode = 'development' | 'production'
|
|
15
|
+
|
|
16
|
+
interface ExtensionEnv {
|
|
17
|
+
EXTENSION_BROWSER: ExtensionBrowser
|
|
18
|
+
EXTENSION_MODE: ExtensionMode
|
|
19
|
+
EXTENSION_PUBLIC_BROWSER: ExtensionBrowser
|
|
20
|
+
EXTENSION_PUBLIC_MODE: ExtensionMode
|
|
21
|
+
EXTENSION_PUBLIC_DESCRIPTION_TEXT: string
|
|
22
|
+
EXTENSION_PUBLIC_OPENAI_API_KEY: string
|
|
23
|
+
EXTENSION_ENV: ExtensionMode
|
|
24
|
+
}
|
|
25
|
+
|
|
8
26
|
declare namespace NodeJS {
|
|
9
|
-
interface ProcessEnv {
|
|
10
|
-
|
|
11
|
-
| 'chrome'
|
|
12
|
-
| 'edge'
|
|
13
|
-
| 'firefox'
|
|
14
|
-
| 'chromium-based'
|
|
15
|
-
| 'gecko-based'
|
|
16
|
-
readonly EXTENSION_MODE: 'development' | 'production'
|
|
27
|
+
interface ProcessEnv extends ExtensionEnv {
|
|
28
|
+
[key: string]: string | undefined
|
|
17
29
|
}
|
|
18
30
|
}
|
|
19
31
|
|
|
20
|
-
interface ImportMetaEnv {
|
|
21
|
-
|
|
22
|
-
readonly EXTENSION_MODE: NodeJS.ProcessEnv['EXTENSION_MODE']
|
|
32
|
+
interface ImportMetaEnv extends ExtensionEnv {
|
|
33
|
+
// Remove duplicate index signature since it's already inherited from ExtensionEnv
|
|
23
34
|
}
|
|
24
35
|
|
|
25
36
|
interface ImportMeta {
|
|
26
37
|
readonly env: ImportMetaEnv
|
|
38
|
+
// @ts-expect-error - This is a webpack specific property
|
|
39
|
+
readonly webpackHot?: {
|
|
40
|
+
accept: (module?: string | string[], callback?: () => void) => void
|
|
41
|
+
dispose: (callback: () => void) => void
|
|
42
|
+
}
|
|
43
|
+
url: string
|
|
27
44
|
}
|
|
28
45
|
|
|
29
46
|
interface Window {
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type BrowsersSupported = 'chrome' | 'edge' | 'firefox' | 'chromium-based' | 'gecko-based' | 'all';
|
|
2
|
+
export interface CreateOptions {
|
|
3
|
+
template?: string;
|
|
4
|
+
targetDir?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface DevOptions {
|
|
7
|
+
port?: number;
|
|
8
|
+
browser?: BrowsersSupported;
|
|
9
|
+
}
|
|
10
|
+
export interface StartOptions {
|
|
11
|
+
port?: number;
|
|
12
|
+
browser?: BrowsersSupported;
|
|
13
|
+
}
|
|
14
|
+
export interface BuildOptions {
|
|
15
|
+
browser?: BrowsersSupported;
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -8,18 +8,24 @@
|
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": ">=18"
|
|
10
10
|
},
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/cli.d.ts",
|
|
14
|
+
"import": "./dist/cli.js",
|
|
15
|
+
"require": "./dist/cli.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
14
18
|
"main": "./dist/cli.js",
|
|
15
19
|
"types": "./dist/cli.d.ts",
|
|
16
20
|
"files": [
|
|
17
|
-
"dist"
|
|
18
|
-
"README.md"
|
|
21
|
+
"dist"
|
|
19
22
|
],
|
|
20
23
|
"bin": {
|
|
21
24
|
"extension": "./dist/cli.js"
|
|
22
25
|
},
|
|
26
|
+
"name": "extension",
|
|
27
|
+
"version": "2.0.0-rc.31",
|
|
28
|
+
"description": "Create cross-browser extensions with no build configuration.",
|
|
23
29
|
"author": {
|
|
24
30
|
"name": "Cezar Augusto",
|
|
25
31
|
"email": "boss@cezaraugusto.net",
|
|
@@ -40,7 +46,7 @@
|
|
|
40
46
|
"typescript"
|
|
41
47
|
],
|
|
42
48
|
"dependencies": {
|
|
43
|
-
"
|
|
49
|
+
"chalk": "^5.3.0",
|
|
44
50
|
"@types/chrome": "^0.0.287",
|
|
45
51
|
"@types/firefox-webext-browser": "^120.0.4",
|
|
46
52
|
"@types/node": "^22.10.1",
|
|
@@ -50,30 +56,25 @@
|
|
|
50
56
|
"semver": "^7.6.3",
|
|
51
57
|
"update-check": "^1.5.4",
|
|
52
58
|
"webextension-polyfill": "^0.12.0",
|
|
53
|
-
"extension-create": "2.0.0",
|
|
54
|
-
"extension-develop": "2.0.0"
|
|
59
|
+
"extension-create": "2.0.0-rc.31",
|
|
60
|
+
"extension-develop": "2.0.0-rc.31"
|
|
55
61
|
},
|
|
56
62
|
"devDependencies": {
|
|
57
|
-
"@
|
|
63
|
+
"@rslib/core": "^0.6.9",
|
|
58
64
|
"@types/mock-fs": "^4.13.4",
|
|
59
65
|
"@types/semver": "^7.5.8",
|
|
60
|
-
"jest": "^29.7.0",
|
|
61
66
|
"mock-fs": "^5.4.1",
|
|
62
|
-
"ts-jest": "^29.2.5",
|
|
63
67
|
"tsconfig": "*",
|
|
64
|
-
"tsup": "^8.3.5",
|
|
65
68
|
"typescript": "5.7.2"
|
|
66
69
|
},
|
|
67
70
|
"scripts": {
|
|
68
|
-
"watch": "
|
|
71
|
+
"watch": "rslib build --watch",
|
|
69
72
|
"compile:types": "bash install_scripts.sh",
|
|
70
73
|
"compile:readme-files": "node ./scripts/copyMarkdownFilesToCli.js",
|
|
71
|
-
"compile:
|
|
72
|
-
"compile
|
|
73
|
-
"compile:cli": "tsup-node ./cli.ts --format cjs --dts --target=node18",
|
|
74
|
-
"compile": "pnpm compile:readme-files && pnpm compile:tailwind-config && pnpm compile:stylelint-config && pnpm compile:cli && pnpm compile:types",
|
|
74
|
+
"compile:cli": "rslib build",
|
|
75
|
+
"compile": "pnpm compile:readme-files && pnpm compile:cli && pnpm compile:types",
|
|
75
76
|
"clean": "rm -rf dist",
|
|
76
77
|
"test": "echo \"Note: no test specified\" && exit 0",
|
|
77
|
-
"test:cli": "
|
|
78
|
+
"test:cli": "vitest run"
|
|
78
79
|
}
|
|
79
80
|
}
|
package/dist/stylelint.config.js
DELETED
package/dist/tailwind.config.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const fs = require('fs')
|
|
3
|
-
|
|
4
|
-
const [, pathOrRemoteUrl] = process.argv.slice(2)
|
|
5
|
-
const projectDir = pathOrRemoteUrl.startsWith('http')
|
|
6
|
-
? process.cwd() + path.basename(pathOrRemoteUrl)
|
|
7
|
-
: path.resolve(__dirname, pathOrRemoteUrl)
|
|
8
|
-
|
|
9
|
-
const tailwindConfig = path.join(projectDir, 'tailwind.config.js')
|
|
10
|
-
|
|
11
|
-
/** @type {import('tailwindcss').Config} */
|
|
12
|
-
const tailwindConfigData = fs.existsSync(tailwindConfig)
|
|
13
|
-
? require(tailwindConfig)
|
|
14
|
-
: {content: []}
|
|
15
|
-
|
|
16
|
-
/** @type {import('tailwindcss').Config} */
|
|
17
|
-
const tailwindRootConfig = {
|
|
18
|
-
...tailwindConfigData,
|
|
19
|
-
content: [
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
21
|
-
...tailwindConfigData.content.map((file) => path.join(projectDir, file))
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
module.exports = tailwindRootConfig
|