extension 2.0.0-rc.23 → 2.0.0-rc.24
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/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 +72 -293
- 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
|
@@ -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,339 +1,118 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
-
mod
|
|
24
|
-
));
|
|
25
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
-
|
|
27
|
-
// cli.ts
|
|
28
|
-
var cli_exports = {};
|
|
29
|
-
module.exports = __toCommonJS(cli_exports);
|
|
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");
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_commander__ from "commander";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_extension_create_5be76cf7__ from "extension-create";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_extension_develop_96f8da50__ from "extension-develop";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_chalk__ from "chalk";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_update_check_b6e6c873__ from "update-check";
|
|
36
7
|
function updateFailed(err) {
|
|
37
|
-
|
|
8
|
+
return "\uD83E\uDDE9\n" + __WEBPACK_EXTERNAL_MODULE_chalk__["default"].red(`Failed to check for updates: ${err.message}`);
|
|
38
9
|
}
|
|
39
10
|
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
|
-
`;
|
|
11
|
+
return `\u{1F9E9}\n${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].yellow('Notice:')} A new version of ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('Extension.js')} is available!\nYou are currently using version ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].yellow(packageJson.version)}.\nThe latest stable version is ${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].yellow(update.latest)}.\nPlease update to the latest version to enjoy new features and improvements.\n`;
|
|
48
12
|
}
|
|
49
13
|
function programHelp() {
|
|
50
|
-
|
|
51
|
-
${
|
|
14
|
+
return `\u{1F9E9}
|
|
15
|
+
${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].underline('Help center for the Extension.js program')}
|
|
52
16
|
|
|
53
|
-
${
|
|
17
|
+
${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].yellow('Usage:')} extension [command] [options]
|
|
54
18
|
|
|
55
|
-
${
|
|
19
|
+
${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].yellow('Note:')} If you are looking for a specific list of options,
|
|
56
20
|
all high-level commands offer their own \`--help\` file with
|
|
57
21
|
information about usage and a list of command flags available.
|
|
58
22
|
|
|
59
23
|
For example:
|
|
60
24
|
|
|
61
|
-
${
|
|
25
|
+
${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('extension create --help')}
|
|
62
26
|
outputs information about the "create" command.
|
|
63
27
|
|
|
64
28
|
Options available:
|
|
65
29
|
|
|
66
|
-
${
|
|
30
|
+
${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('extension create <extension-name>')}
|
|
67
31
|
Creates a new extension from a template. The "create" command
|
|
68
32
|
is optional and can be omitted.
|
|
69
33
|
|
|
70
|
-
${
|
|
34
|
+
${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('extension dev <extension-path>')}
|
|
71
35
|
Starts a new browser instance in development mode, with the target
|
|
72
36
|
extension loaded and auto-reloaded based on file changes.
|
|
73
37
|
|
|
74
|
-
${
|
|
38
|
+
${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('extension start <extension-path>')}
|
|
75
39
|
Starts a new browser instance in production mode, with the target
|
|
76
40
|
extension compiled based on the browser choice.
|
|
77
41
|
|
|
78
|
-
${
|
|
42
|
+
${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('extension build <extension-path>')}
|
|
79
43
|
Builds the target extension with browser defaults, ready for packaging.
|
|
80
44
|
|
|
81
|
-
${
|
|
45
|
+
${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].green('extension --help')}
|
|
82
46
|
This command ;) Outputs a help file with key command options.
|
|
83
47
|
|
|
84
|
-
${
|
|
85
|
-
${
|
|
48
|
+
${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].yellow('Feels something is wrong? Help by reporting a bug:')}
|
|
49
|
+
${__WEBPACK_EXTERNAL_MODULE_chalk__["default"].underline('https://github.com/cezaraugusto/extension/issues/new')}
|
|
86
50
|
`;
|
|
87
51
|
}
|
|
88
|
-
|
|
89
|
-
// check-updates.ts
|
|
90
|
-
var import_update_check = __toESM(require("update-check"));
|
|
91
52
|
function isStableVersion(version) {
|
|
92
|
-
|
|
53
|
+
return !/[a-zA-Z]/.test(version);
|
|
93
54
|
}
|
|
94
|
-
async function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
console.error(updateFailed(err));
|
|
55
|
+
async function check_updates_checkUpdates(packageJson) {
|
|
56
|
+
let update = null;
|
|
57
|
+
try {
|
|
58
|
+
update = await (0, __WEBPACK_EXTERNAL_MODULE_update_check_b6e6c873__["default"])(packageJson);
|
|
59
|
+
} catch (err) {
|
|
60
|
+
if ('development' === process.env.EXTENSION_ENV) console.error(updateFailed(err));
|
|
101
61
|
}
|
|
102
|
-
|
|
103
|
-
if (update && isStableVersion(update.latest)) {
|
|
104
|
-
console.log(checkUpdates(packageJson, update));
|
|
105
|
-
}
|
|
62
|
+
if (update && isStableVersion(update.latest)) console.log(checkUpdates(packageJson, update));
|
|
106
63
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
},
|
|
119
|
-
name: "extension",
|
|
120
|
-
version: "2.0.0-rc.23",
|
|
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.3.1",
|
|
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
|
-
cliVersion: package_default.version
|
|
205
|
-
});
|
|
64
|
+
var package_namespaceObject = JSON.parse('{"license":"MIT","repository":{"type":"git","url":"https://github.com/cezaraugusto/extension.git","directory":"programs/cli"},"engines":{"node":">=18"},"type":"module","exports":{".":{"types":"./dist/cli.d.ts","import":"./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.24","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"}}');
|
|
65
|
+
check_updates_checkUpdates(package_namespaceObject);
|
|
66
|
+
const extensionJs = __WEBPACK_EXTERNAL_MODULE_commander__.program;
|
|
67
|
+
const vendors = (browser)=>'all' === browser ? 'chrome,edge,firefox'.split(',') : browser.split(',');
|
|
68
|
+
extensionJs.name(package_namespaceObject.name).description(package_namespaceObject.description).version(package_namespaceObject.version).addHelpText('after', programHelp());
|
|
69
|
+
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 }) {
|
|
70
|
+
await (0, __WEBPACK_EXTERNAL_MODULE_extension_create_5be76cf7__.extensionCreate)(pathOrRemoteUrl, {
|
|
71
|
+
template,
|
|
72
|
+
install,
|
|
73
|
+
cliVersion: package_namespaceObject.version
|
|
74
|
+
});
|
|
206
75
|
});
|
|
207
|
-
extensionJs.command(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
"--gecko-binary <path-to-binary>",
|
|
218
|
-
"specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default"
|
|
219
|
-
).option(
|
|
220
|
-
"--polyfill [boolean]",
|
|
221
|
-
"whether or not to apply the cross-browser polyfill. Defaults to `false`"
|
|
222
|
-
).option(
|
|
223
|
-
"--open [boolean]",
|
|
224
|
-
"whether or not to open the browser automatically. Defaults to `true`"
|
|
225
|
-
).option(
|
|
226
|
-
"--starting-url <url>",
|
|
227
|
-
"specify the starting URL for the browser. Defaults to `undefined`"
|
|
228
|
-
).option(
|
|
229
|
-
"--port <port>",
|
|
230
|
-
"specify the port to use for the development server. Defaults to `8080`"
|
|
231
|
-
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...devOptions }) {
|
|
232
|
-
for (const vendor of vendors(browser)) {
|
|
233
|
-
await (0, import_extension_develop.extensionDev)(pathOrRemoteUrl, {
|
|
234
|
-
...devOptions,
|
|
235
|
-
profile: devOptions.profile,
|
|
236
|
-
browser: vendor,
|
|
237
|
-
chromiumBinary: devOptions.chromiumBinary,
|
|
238
|
-
geckoBinary: devOptions.geckoBinary,
|
|
239
|
-
// @ts-expect-error open is a boolean
|
|
240
|
-
polyfill: devOptions.polyfill === "false" ? false : true,
|
|
241
|
-
open: devOptions.open,
|
|
242
|
-
startingUrl: devOptions.startingUrl
|
|
76
|
+
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 }) {
|
|
77
|
+
for (const vendor of vendors(browser))await (0, __WEBPACK_EXTERNAL_MODULE_extension_develop_96f8da50__.extensionDev)(pathOrRemoteUrl, {
|
|
78
|
+
...devOptions,
|
|
79
|
+
profile: devOptions.profile,
|
|
80
|
+
browser: vendor,
|
|
81
|
+
chromiumBinary: devOptions.chromiumBinary,
|
|
82
|
+
geckoBinary: devOptions.geckoBinary,
|
|
83
|
+
polyfill: 'false' !== devOptions.polyfill,
|
|
84
|
+
open: devOptions.open,
|
|
85
|
+
startingUrl: devOptions.startingUrl
|
|
243
86
|
});
|
|
244
|
-
}
|
|
245
87
|
});
|
|
246
|
-
extensionJs.command(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
"whether or not to apply the cross-browser polyfill. Defaults to `true`"
|
|
255
|
-
).option(
|
|
256
|
-
"--chromium-binary <path-to-binary>",
|
|
257
|
-
"specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default"
|
|
258
|
-
).option(
|
|
259
|
-
"--gecko-binary <path-to-binary>",
|
|
260
|
-
"specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default"
|
|
261
|
-
).option(
|
|
262
|
-
"--starting-url <url>",
|
|
263
|
-
"specify the starting URL for the browser. Defaults to `undefined`"
|
|
264
|
-
).option(
|
|
265
|
-
"--port <port>",
|
|
266
|
-
"specify the port to use for the development server. Defaults to `8080`"
|
|
267
|
-
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...startOptions }) {
|
|
268
|
-
for (const vendor of vendors(browser)) {
|
|
269
|
-
await (0, import_extension_develop.extensionStart)(pathOrRemoteUrl, {
|
|
270
|
-
mode: "production",
|
|
271
|
-
profile: startOptions.profile,
|
|
272
|
-
browser: vendor,
|
|
273
|
-
chromiumBinary: startOptions.chromiumBinary,
|
|
274
|
-
geckoBinary: startOptions.geckoBinary,
|
|
275
|
-
startingUrl: startOptions.startingUrl
|
|
88
|
+
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 }) {
|
|
89
|
+
for (const vendor of vendors(browser))await (0, __WEBPACK_EXTERNAL_MODULE_extension_develop_96f8da50__.extensionStart)(pathOrRemoteUrl, {
|
|
90
|
+
mode: 'production',
|
|
91
|
+
profile: startOptions.profile,
|
|
92
|
+
browser: vendor,
|
|
93
|
+
chromiumBinary: startOptions.chromiumBinary,
|
|
94
|
+
geckoBinary: startOptions.geckoBinary,
|
|
95
|
+
startingUrl: startOptions.startingUrl
|
|
276
96
|
});
|
|
277
|
-
}
|
|
278
97
|
});
|
|
279
|
-
extensionJs.command(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
"specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default"
|
|
288
|
-
).option(
|
|
289
|
-
"--gecko-binary <path-to-binary>",
|
|
290
|
-
"specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default"
|
|
291
|
-
).option(
|
|
292
|
-
"--starting-url <url>",
|
|
293
|
-
"specify the starting URL for the browser. Defaults to `undefined`"
|
|
294
|
-
).option(
|
|
295
|
-
"--port <port>",
|
|
296
|
-
"specify the port to use for the development server. Defaults to `8080`"
|
|
297
|
-
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...previewOptions }) {
|
|
298
|
-
for (const vendor of vendors(browser)) {
|
|
299
|
-
await (0, import_extension_develop.extensionPreview)(pathOrRemoteUrl, {
|
|
300
|
-
mode: "production",
|
|
301
|
-
profile: previewOptions.profile,
|
|
302
|
-
browser: vendor,
|
|
303
|
-
chromiumBinary: previewOptions.chromiumBinary,
|
|
304
|
-
geckoBinary: previewOptions.geckoBinary,
|
|
305
|
-
startingUrl: previewOptions.startingUrl
|
|
98
|
+
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 }) {
|
|
99
|
+
for (const vendor of vendors(browser))await (0, __WEBPACK_EXTERNAL_MODULE_extension_develop_96f8da50__.extensionPreview)(pathOrRemoteUrl, {
|
|
100
|
+
mode: 'production',
|
|
101
|
+
profile: previewOptions.profile,
|
|
102
|
+
browser: vendor,
|
|
103
|
+
chromiumBinary: previewOptions.chromiumBinary,
|
|
104
|
+
geckoBinary: previewOptions.geckoBinary,
|
|
105
|
+
startingUrl: previewOptions.startingUrl
|
|
306
106
|
});
|
|
307
|
-
}
|
|
308
107
|
});
|
|
309
|
-
extensionJs.command(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
"whether or not to compress the extension into a ZIP file. Defaults to `false`"
|
|
318
|
-
).option(
|
|
319
|
-
"--zip-source [boolean]",
|
|
320
|
-
"whether or not to include the source files in the ZIP file. Defaults to `false`"
|
|
321
|
-
).option(
|
|
322
|
-
"--zip-filename <string>",
|
|
323
|
-
"specify the name of the ZIP file. Defaults to the extension name and version"
|
|
324
|
-
).option(
|
|
325
|
-
"--silent [boolean]",
|
|
326
|
-
"whether or not to open the browser automatically. Defaults to `false`"
|
|
327
|
-
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...buildOptions }) {
|
|
328
|
-
for (const vendor of vendors(browser)) {
|
|
329
|
-
await (0, import_extension_develop.extensionBuild)(pathOrRemoteUrl, {
|
|
330
|
-
browser: vendor,
|
|
331
|
-
polyfill: buildOptions.polyfill,
|
|
332
|
-
zip: buildOptions.zip,
|
|
333
|
-
zipSource: buildOptions.zipSource,
|
|
334
|
-
zipFilename: buildOptions.zipFilename,
|
|
335
|
-
silent: buildOptions.silent
|
|
108
|
+
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 }) {
|
|
109
|
+
for (const vendor of vendors(browser))await (0, __WEBPACK_EXTERNAL_MODULE_extension_develop_96f8da50__.extensionBuild)(pathOrRemoteUrl, {
|
|
110
|
+
browser: vendor,
|
|
111
|
+
polyfill: buildOptions.polyfill,
|
|
112
|
+
zip: buildOptions.zip,
|
|
113
|
+
zipSource: buildOptions.zipSource,
|
|
114
|
+
zipFilename: buildOptions.zipFilename,
|
|
115
|
+
silent: buildOptions.silent
|
|
336
116
|
});
|
|
337
|
-
}
|
|
338
117
|
});
|
|
339
118
|
extensionJs.parse();
|
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
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/cli.d.ts",
|
|
15
|
+
"import": "./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.24",
|
|
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.
|
|
54
|
-
"extension-develop": "2.0.0-rc.
|
|
59
|
+
"extension-create": "2.0.0-rc.24",
|
|
60
|
+
"extension-develop": "2.0.0-rc.24"
|
|
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.3.1",
|
|
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
|