extension 2.0.0-rc.25 → 2.0.0-rc.26
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/cli.d.ts +2 -1
- package/dist/cli.js +100 -292
- package/dist/types/index.d.ts +28 -11
- package/package.json +19 -18
- package/dist/stylelint.config.js +0 -7
- package/dist/tailwind.config.js +0 -25
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,339 +1,147 @@
|
|
|
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
|
-
|
|
118
|
-
},
|
|
119
|
-
name: "extension",
|
|
120
|
-
version: "2.0.0-rc.25",
|
|
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
|
-
});
|
|
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.26","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
|
|
99
|
+
});
|
|
206
100
|
});
|
|
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
|
|
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))await (0, external_extension_develop_namespaceObject.extensionDev)(pathOrRemoteUrl, {
|
|
103
|
+
...devOptions,
|
|
104
|
+
profile: devOptions.profile,
|
|
105
|
+
browser: vendor,
|
|
106
|
+
chromiumBinary: devOptions.chromiumBinary,
|
|
107
|
+
geckoBinary: devOptions.geckoBinary,
|
|
108
|
+
polyfill: 'false' !== devOptions.polyfill,
|
|
109
|
+
open: devOptions.open,
|
|
110
|
+
startingUrl: devOptions.startingUrl
|
|
243
111
|
});
|
|
244
|
-
}
|
|
245
112
|
});
|
|
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
|
|
113
|
+
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 }) {
|
|
114
|
+
for (const vendor of vendors(browser))await (0, external_extension_develop_namespaceObject.extensionStart)(pathOrRemoteUrl, {
|
|
115
|
+
mode: 'production',
|
|
116
|
+
profile: startOptions.profile,
|
|
117
|
+
browser: vendor,
|
|
118
|
+
chromiumBinary: startOptions.chromiumBinary,
|
|
119
|
+
geckoBinary: startOptions.geckoBinary,
|
|
120
|
+
startingUrl: startOptions.startingUrl
|
|
276
121
|
});
|
|
277
|
-
}
|
|
278
122
|
});
|
|
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
|
|
123
|
+
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 }) {
|
|
124
|
+
for (const vendor of vendors(browser))await (0, external_extension_develop_namespaceObject.extensionPreview)(pathOrRemoteUrl, {
|
|
125
|
+
mode: 'production',
|
|
126
|
+
profile: previewOptions.profile,
|
|
127
|
+
browser: vendor,
|
|
128
|
+
chromiumBinary: previewOptions.chromiumBinary,
|
|
129
|
+
geckoBinary: previewOptions.geckoBinary,
|
|
130
|
+
startingUrl: previewOptions.startingUrl
|
|
306
131
|
});
|
|
307
|
-
}
|
|
308
132
|
});
|
|
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
|
|
133
|
+
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 }) {
|
|
134
|
+
for (const vendor of vendors(browser))await (0, external_extension_develop_namespaceObject.extensionBuild)(pathOrRemoteUrl, {
|
|
135
|
+
browser: vendor,
|
|
136
|
+
polyfill: buildOptions.polyfill,
|
|
137
|
+
zip: buildOptions.zip,
|
|
138
|
+
zipSource: buildOptions.zipSource,
|
|
139
|
+
zipFilename: buildOptions.zipFilename,
|
|
140
|
+
silent: buildOptions.silent
|
|
336
141
|
});
|
|
337
|
-
}
|
|
338
142
|
});
|
|
339
143
|
extensionJs.parse();
|
|
144
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
145
|
+
Object.defineProperty(exports, '__esModule', {
|
|
146
|
+
value: true
|
|
147
|
+
});
|
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/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.26",
|
|
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-rc.
|
|
54
|
-
"extension-develop": "2.0.0-rc.
|
|
59
|
+
"extension-create": "2.0.0-rc.26",
|
|
60
|
+
"extension-develop": "2.0.0-rc.26"
|
|
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
|