@botpress/cli 0.0.14 → 0.0.17
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/api-client.js +1 -0
- package/dist/api-client.js.map +7 -0
- package/dist/code-generation/action.js +1 -0
- package/dist/code-generation/action.js.map +7 -0
- package/dist/code-generation/channel.js +1 -0
- package/dist/code-generation/channel.js.map +7 -0
- package/dist/code-generation/configuration.js +1 -0
- package/dist/code-generation/configuration.js.map +7 -0
- package/dist/code-generation/const.js +1 -0
- package/dist/code-generation/const.js.map +7 -0
- package/dist/code-generation/event.js +1 -0
- package/dist/code-generation/event.js.map +7 -0
- package/dist/code-generation/index.js +1 -0
- package/dist/code-generation/index.js.map +7 -0
- package/dist/code-generation/integration-impl.js +1 -0
- package/dist/code-generation/integration-impl.js.map +7 -0
- package/dist/code-generation/integration-instance.js +1 -0
- package/dist/code-generation/integration-instance.js.map +7 -0
- package/dist/code-generation/integration-secret.js +1 -0
- package/dist/code-generation/integration-secret.js.map +7 -0
- package/dist/code-generation/message.js +1 -0
- package/dist/code-generation/message.js.map +7 -0
- package/dist/code-generation/module.js +1 -0
- package/dist/code-generation/module.js.map +7 -0
- package/dist/code-generation/typings.js +1 -0
- package/dist/code-generation/typings.js.map +7 -0
- package/dist/command-definitions.js +1 -0
- package/dist/command-definitions.js.map +7 -0
- package/dist/command-implementations/add-command.js +1 -0
- package/dist/command-implementations/add-command.js.map +7 -0
- package/dist/command-implementations/base-command.js +8 -1
- package/dist/command-implementations/base-command.js.map +7 -0
- package/dist/command-implementations/bot-commands.js +1 -0
- package/dist/command-implementations/bot-commands.js.map +7 -0
- package/dist/command-implementations/build-command.js +1 -0
- package/dist/command-implementations/build-command.js.map +7 -0
- package/dist/command-implementations/bundle-command.js +1 -0
- package/dist/command-implementations/bundle-command.js.map +7 -0
- package/dist/command-implementations/deploy-command.js +21 -3
- package/dist/command-implementations/deploy-command.js.map +7 -0
- package/dist/command-implementations/dev-command.js +1 -0
- package/dist/command-implementations/dev-command.js.map +7 -0
- package/dist/command-implementations/gen-command.js +1 -0
- package/dist/command-implementations/gen-command.js.map +7 -0
- package/dist/command-implementations/global-command.js +1 -0
- package/dist/command-implementations/global-command.js.map +7 -0
- package/dist/command-implementations/index.js +1 -0
- package/dist/command-implementations/index.js.map +7 -0
- package/dist/command-implementations/init-command.js +1 -0
- package/dist/command-implementations/init-command.js.map +7 -0
- package/dist/command-implementations/integration-commands.js +1 -0
- package/dist/command-implementations/integration-commands.js.map +7 -0
- package/dist/command-implementations/login-command.js +1 -0
- package/dist/command-implementations/login-command.js.map +7 -0
- package/dist/command-implementations/logout-command.js +1 -0
- package/dist/command-implementations/logout-command.js.map +7 -0
- package/dist/command-implementations/project-command.js +1 -0
- package/dist/command-implementations/project-command.js.map +7 -0
- package/dist/command-implementations/serve-command.js +1 -0
- package/dist/command-implementations/serve-command.js.map +7 -0
- package/dist/command-tree.js +1 -0
- package/dist/command-tree.js.map +7 -0
- package/dist/config.js +1 -0
- package/dist/config.js.map +7 -0
- package/dist/consts.js +1 -0
- package/dist/consts.js.map +7 -0
- package/dist/errors.js +27 -1
- package/dist/errors.js.map +7 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +7 -0
- package/dist/init.js +1 -0
- package/dist/init.js.map +7 -0
- package/dist/integration-ref.js +1 -0
- package/dist/integration-ref.js.map +7 -0
- package/dist/logger/base-logger.js +1 -0
- package/dist/logger/base-logger.js.map +7 -0
- package/dist/logger/index.js +1 -0
- package/dist/logger/index.js.map +7 -0
- package/dist/register-yargs.js +1 -0
- package/dist/register-yargs.js.map +7 -0
- package/dist/typings.js +1 -0
- package/dist/typings.js.map +7 -0
- package/dist/utils/cache-utils.js +1 -0
- package/dist/utils/cache-utils.js.map +7 -0
- package/dist/utils/case-utils.js +1 -0
- package/dist/utils/case-utils.js.map +7 -0
- package/dist/utils/esbuild-utils.js +1 -0
- package/dist/utils/esbuild-utils.js.map +7 -0
- package/dist/utils/event-emitter.js +1 -0
- package/dist/utils/event-emitter.js.map +7 -0
- package/dist/utils/file-watcher.js +1 -0
- package/dist/utils/file-watcher.js.map +7 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +7 -0
- package/dist/utils/path-utils.js +1 -0
- package/dist/utils/path-utils.js.map +7 -0
- package/dist/utils/prompt-utils.js +1 -0
- package/dist/utils/prompt-utils.js.map +7 -0
- package/dist/utils/require-utils.js +1 -0
- package/dist/utils/require-utils.js.map +7 -0
- package/dist/worker/child-entrypoint.js +1 -0
- package/dist/worker/child-entrypoint.js.map +7 -0
- package/dist/worker/child-wrapper.js +1 -0
- package/dist/worker/child-wrapper.js.map +7 -0
- package/dist/worker/config.js +1 -0
- package/dist/worker/config.js.map +7 -0
- package/dist/worker/index.js +1 -0
- package/dist/worker/index.js.map +7 -0
- package/dist/worker/is-child.js +1 -0
- package/dist/worker/is-child.js.map +7 -0
- package/dist/worker/worker-state.js +1 -0
- package/dist/worker/worker-state.js.map +7 -0
- package/dist/worker/worker.js +1 -0
- package/dist/worker/worker.js.map +7 -0
- package/package.json +13 -13
- package/templates/echo-bot/package.json +1 -2
- package/templates/empty-integration/integration.definition.ts +2 -2
- package/templates/empty-integration/package.json +1 -2
- package/build.ts +0 -12
- package/dist/app/api-utils.js +0 -112
- package/dist/app/base.js +0 -71
- package/dist/app/cache.js +0 -95
- package/dist/app/errors.js +0 -156
- package/dist/app/file-paths.js +0 -79
- package/dist/app/generator/action.js +0 -76
- package/dist/app/generator/channel.js +0 -51
- package/dist/app/generator/configuration.js +0 -40
- package/dist/app/generator/const.js +0 -31
- package/dist/app/generator/event.js +0 -47
- package/dist/app/generator/index.js +0 -83
- package/dist/app/generator/integration-impl.js +0 -147
- package/dist/app/generator/integration-instance.js +0 -85
- package/dist/app/generator/message.js +0 -47
- package/dist/app/generator/module.js +0 -115
- package/dist/app/generator/strings.js +0 -38
- package/dist/app/generator/typings.js +0 -16
- package/dist/app/index.js +0 -82
- package/dist/app/integration-ref.js +0 -61
- package/dist/app/project.js +0 -486
- package/dist/app/typings.js +0 -16
- package/dist/app/user.js +0 -237
- package/dist/esbuild-utils.js +0 -89
- package/dist/event-emitter.js +0 -62
- package/dist/path-utils.js +0 -72
- package/dist/require-utils.js +0 -49
- package/dist/update-notif.js +0 -47
- package/dist/utils/string-utils.js +0 -68
- package/dist/watcher.js +0 -68
- package/templates/echo-bot/.botpress/project.cache.json +0 -1
package/dist/app/user.js
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var user_exports = {};
|
|
26
|
-
__export(user_exports, {
|
|
27
|
-
UserCommands: () => UserCommands
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(user_exports);
|
|
30
|
-
var import_chalk = __toESM(require("chalk"));
|
|
31
|
-
var import_fs = __toESM(require("fs"));
|
|
32
|
-
var import_lodash = __toESM(require("lodash"));
|
|
33
|
-
var import_path = __toESM(require("path"));
|
|
34
|
-
var import_prompts = __toESM(require("prompts"));
|
|
35
|
-
var consts = __toESM(require("../consts"));
|
|
36
|
-
var pathutils = __toESM(require("../path-utils"));
|
|
37
|
-
var import_api_utils = require("./api-utils");
|
|
38
|
-
var import_base = require("./base");
|
|
39
|
-
var errors = __toESM(require("./errors"));
|
|
40
|
-
var import_integration_ref = require("./integration-ref");
|
|
41
|
-
class UserCommands extends import_base.BaseCommands {
|
|
42
|
-
constructor(props, _paths, userCache, logger) {
|
|
43
|
-
super(props, userCache, logger);
|
|
44
|
-
this._paths = _paths;
|
|
45
|
-
}
|
|
46
|
-
async login(argv) {
|
|
47
|
-
const promptedToken = await this._userCache.sync("token", argv.token, async (previousToken) => {
|
|
48
|
-
const { prompted } = await (0, import_prompts.default)({
|
|
49
|
-
type: "password",
|
|
50
|
-
name: "prompted",
|
|
51
|
-
message: "Enter your Personal Access Token",
|
|
52
|
-
initial: previousToken
|
|
53
|
-
});
|
|
54
|
-
if (!prompted) {
|
|
55
|
-
throw new errors.ParamRequiredError("Personal Access Token");
|
|
56
|
-
}
|
|
57
|
-
return prompted;
|
|
58
|
-
});
|
|
59
|
-
const promptedWorkspaceId = await this._userCache.sync("workspaceId", argv.workspaceId, async (defaultId) => {
|
|
60
|
-
const tmpApi = new import_api_utils.ApiUtils({ host: argv.host, token: promptedToken }, this._logger);
|
|
61
|
-
const userWorkspaces = await tmpApi.listAllPages(tmpApi.client.listWorkspaces, (r) => r.workspaces).catch((thrown) => {
|
|
62
|
-
throw errors.BotpressCLIError.wrap(thrown, "Could not list workspaces");
|
|
63
|
-
});
|
|
64
|
-
if (userWorkspaces.length === 0) {
|
|
65
|
-
throw new errors.NoWorkspacesFoundError();
|
|
66
|
-
}
|
|
67
|
-
const initial = userWorkspaces.find((ws) => ws.id === defaultId);
|
|
68
|
-
const { prompted } = await (0, import_prompts.default)({
|
|
69
|
-
type: "autocomplete",
|
|
70
|
-
name: "prompted",
|
|
71
|
-
message: "Which workspace do you want to login to?",
|
|
72
|
-
initial: initial?.name,
|
|
73
|
-
choices: userWorkspaces.map((ws) => ({ title: ws.name, value: ws.id }))
|
|
74
|
-
});
|
|
75
|
-
if (!prompted) {
|
|
76
|
-
throw new errors.ParamRequiredError("Workspace Id");
|
|
77
|
-
}
|
|
78
|
-
return prompted;
|
|
79
|
-
});
|
|
80
|
-
await this._userCache.set("host", argv.host);
|
|
81
|
-
const api = new import_api_utils.ApiUtils({ host: argv.host, token: promptedToken, workspaceId: promptedWorkspaceId }, this._logger);
|
|
82
|
-
await api.testLogin();
|
|
83
|
-
this._logger.success("Logged In");
|
|
84
|
-
}
|
|
85
|
-
async logout() {
|
|
86
|
-
await this._userCache.clear();
|
|
87
|
-
this._logger.success("Logged Out");
|
|
88
|
-
}
|
|
89
|
-
async createBot(argv) {
|
|
90
|
-
const { client } = await this._ensureLoginAndCreateClient(argv);
|
|
91
|
-
try {
|
|
92
|
-
const { bot } = await client.createBot({ name: argv.name });
|
|
93
|
-
this._logger.success(`Bot ${import_chalk.default.bold(bot.id)}:`);
|
|
94
|
-
this._logger.json(bot);
|
|
95
|
-
} catch (thrown) {
|
|
96
|
-
throw errors.BotpressCLIError.wrap(thrown, "Could not create bot");
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
async getBot(botId, argv) {
|
|
100
|
-
const { client } = await this._ensureLoginAndCreateClient(argv);
|
|
101
|
-
try {
|
|
102
|
-
const { bot } = await client.getBot({ id: botId });
|
|
103
|
-
this._logger.success(`Bot ${import_chalk.default.bold(botId)}:`);
|
|
104
|
-
this._logger.json(bot);
|
|
105
|
-
} catch (thrown) {
|
|
106
|
-
throw errors.BotpressCLIError.wrap(thrown, `Could not get bot ${botId}`);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
async listBots(argv) {
|
|
110
|
-
const api = await this._ensureLoginAndCreateClient(argv);
|
|
111
|
-
try {
|
|
112
|
-
const bots = await api.listAllPages(api.client.listBots, (r) => r.bots);
|
|
113
|
-
this._logger.success("Bots:");
|
|
114
|
-
this._logger.json(bots);
|
|
115
|
-
} catch (thrown) {
|
|
116
|
-
throw errors.BotpressCLIError.wrap(thrown, "Could not list bots");
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
async deleteBot(botId, argv) {
|
|
120
|
-
const { client } = await this._ensureLoginAndCreateClient(argv);
|
|
121
|
-
try {
|
|
122
|
-
await client.deleteBot({ id: botId });
|
|
123
|
-
this._logger.success(`Bot ${import_chalk.default.bold(botId)} deleted`);
|
|
124
|
-
} catch (thrown) {
|
|
125
|
-
throw errors.BotpressCLIError.wrap(thrown, `Could not delete bot ${botId}`);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async getIntegration(integrationRef, argv) {
|
|
129
|
-
const api = await this._ensureLoginAndCreateClient(argv);
|
|
130
|
-
const parsedRef = (0, import_integration_ref.parseIntegrationRef)(integrationRef);
|
|
131
|
-
if (!parsedRef) {
|
|
132
|
-
throw new errors.InvalidIntegrationReferenceError(integrationRef);
|
|
133
|
-
}
|
|
134
|
-
try {
|
|
135
|
-
const integration = await api.findIntegration(parsedRef);
|
|
136
|
-
if (integration) {
|
|
137
|
-
this._logger.success(`Integration ${import_chalk.default.bold(integrationRef)}:`);
|
|
138
|
-
this._logger.json(integration);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
} catch (thrown) {
|
|
142
|
-
throw errors.BotpressCLIError.wrap(thrown, `Could not get integration ${integrationRef}`);
|
|
143
|
-
}
|
|
144
|
-
throw new errors.BotpressCLIError(`Integration ${integrationRef} not found`);
|
|
145
|
-
}
|
|
146
|
-
async listIntegrations(argv) {
|
|
147
|
-
const api = await this._ensureLoginAndCreateClient(argv);
|
|
148
|
-
const privateLister = (req) => api.client.listIntegrations({ nextToken: req.nextToken, name: argv.name, version: argv.version });
|
|
149
|
-
const publicLister = (req) => api.client.listPublicIntegrations({ nextToken: req.nextToken, name: argv.name, version: argv.version });
|
|
150
|
-
try {
|
|
151
|
-
const privateIntegrations = await api.listAllPages(privateLister, (r) => r.integrations);
|
|
152
|
-
const publicIntegrations = await api.listAllPages(publicLister, (r) => r.integrations);
|
|
153
|
-
const integrations = import_lodash.default.uniqBy([...privateIntegrations, ...publicIntegrations], (i) => i.id);
|
|
154
|
-
this._logger.success("Integrations:");
|
|
155
|
-
this._logger.json(integrations);
|
|
156
|
-
} catch (thrown) {
|
|
157
|
-
throw errors.BotpressCLIError.wrap(thrown, "Could not list integrations");
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
async deleteIntegration(integrationRef, argv) {
|
|
161
|
-
const api = await this._ensureLoginAndCreateClient(argv);
|
|
162
|
-
const parsedRef = (0, import_integration_ref.parseIntegrationRef)(integrationRef);
|
|
163
|
-
if (!parsedRef) {
|
|
164
|
-
throw new errors.InvalidIntegrationReferenceError(integrationRef);
|
|
165
|
-
}
|
|
166
|
-
let integration;
|
|
167
|
-
try {
|
|
168
|
-
integration = await api.findPrivateIntegration(parsedRef);
|
|
169
|
-
} catch (thrown) {
|
|
170
|
-
throw errors.BotpressCLIError.wrap(thrown, `Could not get integration ${integrationRef}`);
|
|
171
|
-
}
|
|
172
|
-
if (!integration) {
|
|
173
|
-
const publicIntegration = await api.findPublicIntegration(parsedRef);
|
|
174
|
-
if (publicIntegration) {
|
|
175
|
-
throw new errors.BotpressCLIError(`Integration ${integrationRef} does not belong to your workspace`);
|
|
176
|
-
}
|
|
177
|
-
throw new errors.BotpressCLIError(`Integration ${integrationRef} not found`);
|
|
178
|
-
}
|
|
179
|
-
try {
|
|
180
|
-
await api.client.deleteIntegration({ id: integration.id });
|
|
181
|
-
} catch (thrown) {
|
|
182
|
-
throw errors.BotpressCLIError.wrap(thrown, `Could not delete integration ${integrationRef}`);
|
|
183
|
-
}
|
|
184
|
-
this._logger.success(`Integration ${import_chalk.default.bold(integrationRef)} deleted`);
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
async initProject(argv) {
|
|
188
|
-
let { type: projectType } = argv;
|
|
189
|
-
if (!projectType) {
|
|
190
|
-
const { promptedType } = await (0, import_prompts.default)({
|
|
191
|
-
type: "autocomplete",
|
|
192
|
-
name: "promptedType",
|
|
193
|
-
message: "What type of project do you wish to initialize?",
|
|
194
|
-
choices: ["bot", "integration"].map((t) => ({ title: t, value: t }))
|
|
195
|
-
});
|
|
196
|
-
if (!promptedType) {
|
|
197
|
-
throw new errors.ParamRequiredError("Project Type");
|
|
198
|
-
}
|
|
199
|
-
projectType = promptedType;
|
|
200
|
-
}
|
|
201
|
-
const workDir = pathutils.absoluteFrom(pathutils.cwd(), argv.workDir);
|
|
202
|
-
if (projectType === "bot") {
|
|
203
|
-
const destination2 = import_path.default.join(workDir, argv.name ?? consts.echoBotName);
|
|
204
|
-
const exist2 = await this._checkIfDestinationExists(destination2);
|
|
205
|
-
if (exist2) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
await import_fs.default.promises.cp(this._paths.abs.echoBotTemplate, destination2, { recursive: true });
|
|
209
|
-
this._logger.success(`Bot project initialized in ${import_chalk.default.bold(workDir)}`);
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
const destination = import_path.default.join(workDir, argv.name ?? consts.emptyIntegrationName);
|
|
213
|
-
const exist = await this._checkIfDestinationExists(destination);
|
|
214
|
-
if (exist) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
await import_fs.default.promises.cp(this._paths.abs.emptyIntegrationTemplate, destination, { recursive: true });
|
|
218
|
-
this._logger.success(`Integration project initialized in ${import_chalk.default.bold(argv.workDir)}`);
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
_checkIfDestinationExists = async (destination) => {
|
|
222
|
-
if (import_fs.default.existsSync(destination)) {
|
|
223
|
-
const override = await this._confirm(
|
|
224
|
-
`Directory ${import_chalk.default.bold(destination)} already exists. Do you want to overwrite it?`
|
|
225
|
-
);
|
|
226
|
-
if (!override) {
|
|
227
|
-
this._logger.log("Aborting");
|
|
228
|
-
return true;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return false;
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
235
|
-
0 && (module.exports = {
|
|
236
|
-
UserCommands
|
|
237
|
-
});
|
package/dist/esbuild-utils.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var esbuild_utils_exports = {};
|
|
20
|
-
__export(esbuild_utils_exports, {
|
|
21
|
-
buildCode: () => buildCode,
|
|
22
|
-
buildEntrypoint: () => buildEntrypoint
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(esbuild_utils_exports);
|
|
25
|
-
var import_esbuild = require("esbuild");
|
|
26
|
-
const keepNames = true;
|
|
27
|
-
function buildCode({
|
|
28
|
-
cwd,
|
|
29
|
-
minify = true,
|
|
30
|
-
bundle = true,
|
|
31
|
-
sourcemap = false,
|
|
32
|
-
logLevel = "silent",
|
|
33
|
-
outfile,
|
|
34
|
-
code,
|
|
35
|
-
write
|
|
36
|
-
}) {
|
|
37
|
-
return (0, import_esbuild.build)({
|
|
38
|
-
stdin: {
|
|
39
|
-
contents: code,
|
|
40
|
-
resolveDir: cwd,
|
|
41
|
-
loader: "ts"
|
|
42
|
-
},
|
|
43
|
-
logOverride: {
|
|
44
|
-
"equals-negative-zero": "silent"
|
|
45
|
-
},
|
|
46
|
-
platform: "node",
|
|
47
|
-
target: "es2020",
|
|
48
|
-
sourcemap,
|
|
49
|
-
minify,
|
|
50
|
-
bundle,
|
|
51
|
-
outfile,
|
|
52
|
-
absWorkingDir: cwd,
|
|
53
|
-
logLevel,
|
|
54
|
-
keepNames,
|
|
55
|
-
write
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function buildEntrypoint({
|
|
59
|
-
cwd,
|
|
60
|
-
minify = true,
|
|
61
|
-
bundle = true,
|
|
62
|
-
sourcemap = false,
|
|
63
|
-
logLevel = "silent",
|
|
64
|
-
outfile,
|
|
65
|
-
entrypoint,
|
|
66
|
-
write
|
|
67
|
-
}) {
|
|
68
|
-
return (0, import_esbuild.build)({
|
|
69
|
-
entryPoints: [entrypoint],
|
|
70
|
-
logOverride: {
|
|
71
|
-
"equals-negative-zero": "silent"
|
|
72
|
-
},
|
|
73
|
-
platform: "node",
|
|
74
|
-
target: "es2020",
|
|
75
|
-
sourcemap,
|
|
76
|
-
minify,
|
|
77
|
-
bundle,
|
|
78
|
-
outfile,
|
|
79
|
-
absWorkingDir: cwd,
|
|
80
|
-
logLevel,
|
|
81
|
-
keepNames,
|
|
82
|
-
write
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
-
0 && (module.exports = {
|
|
87
|
-
buildCode,
|
|
88
|
-
buildEntrypoint
|
|
89
|
-
});
|
package/dist/event-emitter.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var event_emitter_exports = {};
|
|
20
|
-
__export(event_emitter_exports, {
|
|
21
|
-
EventEmitter: () => EventEmitter
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(event_emitter_exports);
|
|
24
|
-
class EventEmitter {
|
|
25
|
-
listeners = {};
|
|
26
|
-
emit(type, event) {
|
|
27
|
-
const listeners = this.listeners[type];
|
|
28
|
-
if (!listeners) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
for (const listener of listeners) {
|
|
32
|
-
listener(event);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
once(type, listener) {
|
|
36
|
-
const wrapped = (event) => {
|
|
37
|
-
this.off(type, wrapped);
|
|
38
|
-
listener(event);
|
|
39
|
-
};
|
|
40
|
-
this.on(type, wrapped);
|
|
41
|
-
}
|
|
42
|
-
on(type, listener) {
|
|
43
|
-
if (!this.listeners[type]) {
|
|
44
|
-
this.listeners[type] = [];
|
|
45
|
-
}
|
|
46
|
-
this.listeners[type].push(listener);
|
|
47
|
-
}
|
|
48
|
-
off(type, listener) {
|
|
49
|
-
const listeners = this.listeners[type];
|
|
50
|
-
if (!listeners) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const index = listeners.indexOf(listener);
|
|
54
|
-
if (index !== -1) {
|
|
55
|
-
listeners.splice(index, 1);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
-
0 && (module.exports = {
|
|
61
|
-
EventEmitter
|
|
62
|
-
});
|
package/dist/path-utils.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var path_utils_exports = {};
|
|
26
|
-
__export(path_utils_exports, {
|
|
27
|
-
absoluteFrom: () => absoluteFrom,
|
|
28
|
-
cwd: () => cwd,
|
|
29
|
-
isAbsolute: () => isAbsolute,
|
|
30
|
-
isPath: () => isPath,
|
|
31
|
-
join: () => join,
|
|
32
|
-
relativeFrom: () => relativeFrom,
|
|
33
|
-
rmExtension: () => rmExtension,
|
|
34
|
-
toUnix: () => toUnix
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(path_utils_exports);
|
|
37
|
-
var import_path = __toESM(require("path"));
|
|
38
|
-
const cwd = () => process.cwd();
|
|
39
|
-
const isAbsolute = (path) => import_path.default.isAbsolute(path);
|
|
40
|
-
const isPath = (path) => isAbsolute(path) || path.startsWith(".");
|
|
41
|
-
const join = (abs, ...paths) => {
|
|
42
|
-
const joined = import_path.default.join(abs, ...paths);
|
|
43
|
-
return import_path.default.normalize(joined);
|
|
44
|
-
};
|
|
45
|
-
const rmExtension = (filename) => filename.replace(/\.[^/.]+$/, "");
|
|
46
|
-
const toUnix = (path) => path.split(import_path.default.sep).join(import_path.default.posix.sep);
|
|
47
|
-
const absoluteFrom = (rootdir, target) => {
|
|
48
|
-
if (isAbsolute(target)) {
|
|
49
|
-
return target;
|
|
50
|
-
}
|
|
51
|
-
return import_path.default.join(rootdir, target);
|
|
52
|
-
};
|
|
53
|
-
const relativeFrom = (rootdir, target) => {
|
|
54
|
-
let absPath;
|
|
55
|
-
if (isAbsolute(target)) {
|
|
56
|
-
absPath = target;
|
|
57
|
-
} else {
|
|
58
|
-
absPath = import_path.default.resolve(import_path.default.join(rootdir, target));
|
|
59
|
-
}
|
|
60
|
-
return import_path.default.relative(rootdir, absPath);
|
|
61
|
-
};
|
|
62
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
-
0 && (module.exports = {
|
|
64
|
-
absoluteFrom,
|
|
65
|
-
cwd,
|
|
66
|
-
isAbsolute,
|
|
67
|
-
isPath,
|
|
68
|
-
join,
|
|
69
|
-
relativeFrom,
|
|
70
|
-
rmExtension,
|
|
71
|
-
toUnix
|
|
72
|
-
});
|
package/dist/require-utils.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var require_utils_exports = {};
|
|
26
|
-
__export(require_utils_exports, {
|
|
27
|
-
requireJsCode: () => requireJsCode,
|
|
28
|
-
requireJsFile: () => requireJsFile
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(require_utils_exports);
|
|
31
|
-
var import_module = __toESM(require("module"));
|
|
32
|
-
var import_path = __toESM(require("path"));
|
|
33
|
-
const requireJsFile = (path) => {
|
|
34
|
-
return require(path);
|
|
35
|
-
};
|
|
36
|
-
const requireJsCode = (code) => {
|
|
37
|
-
const filedir = "tmp";
|
|
38
|
-
const filename = `${Date.now()}.js`;
|
|
39
|
-
const fileid = import_path.default.join(filedir, filename);
|
|
40
|
-
const m = new import_module.default(fileid);
|
|
41
|
-
m.filename = filename;
|
|
42
|
-
m._compile(code, filename);
|
|
43
|
-
return m.exports;
|
|
44
|
-
};
|
|
45
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 && (module.exports = {
|
|
47
|
-
requireJsCode,
|
|
48
|
-
requireJsFile
|
|
49
|
-
});
|
package/dist/update-notif.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var update_notif_exports = {};
|
|
26
|
-
__export(update_notif_exports, {
|
|
27
|
-
notifyUpdate: () => notifyUpdate
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(update_notif_exports);
|
|
30
|
-
var import_chalk = __toESM(require("chalk"));
|
|
31
|
-
var import_latest_version = __toESM(require("latest-version"));
|
|
32
|
-
const updateMsg = (props) => `${import_chalk.default.bold("Update available")} ${import_chalk.default.dim(props.version)} \u2192 ${import_chalk.default.green(props.latest)}
|
|
33
|
-
|
|
34
|
-
To update, run:
|
|
35
|
-
for npm ${import_chalk.default.cyan(`npm i -g ${props.name}`)}
|
|
36
|
-
for yarn ${import_chalk.default.cyan(`yarn global add ${props.name}`)}
|
|
37
|
-
for pnpm ${import_chalk.default.cyan(`pnpm i -g ${props.name}`)}`;
|
|
38
|
-
const notifyUpdate = async (props, logger) => {
|
|
39
|
-
const latest = await (0, import_latest_version.default)(props.name);
|
|
40
|
-
if (latest !== props.version) {
|
|
41
|
-
logger.box(updateMsg({ ...props, latest }));
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
notifyUpdate
|
|
47
|
-
});
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to2, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to2, key) && key !== except)
|
|
14
|
-
__defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to2;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var string_utils_exports = {};
|
|
20
|
-
__export(string_utils_exports, {
|
|
21
|
-
is: () => is,
|
|
22
|
-
to: () => to
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(string_utils_exports);
|
|
25
|
-
const capitalizeFirstLetter = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
26
|
-
const splitHyphens = (tokens) => tokens.flatMap((token) => token.split("-"));
|
|
27
|
-
const splitUnderscores = (tokens) => tokens.flatMap((token) => token.split("_"));
|
|
28
|
-
const splitCaseChange = (tokens) => tokens.flatMap((token) => token.split(/(?<=[a-z])(?=[A-Z])/));
|
|
29
|
-
const split = (tokens) => {
|
|
30
|
-
const steps = [splitHyphens, splitUnderscores, splitCaseChange];
|
|
31
|
-
return steps.reduce((acc, step) => step(acc), tokens);
|
|
32
|
-
};
|
|
33
|
-
var to;
|
|
34
|
-
((to2) => {
|
|
35
|
-
to2.pascalCase = (text) => {
|
|
36
|
-
const words = split([text]);
|
|
37
|
-
return words.map(capitalizeFirstLetter).join("");
|
|
38
|
-
};
|
|
39
|
-
to2.kebabCase = (text) => {
|
|
40
|
-
const words = split([text]);
|
|
41
|
-
return words.map((word) => word.toLowerCase()).join("-");
|
|
42
|
-
};
|
|
43
|
-
to2.snakeCase = (text) => {
|
|
44
|
-
const words = split([text]);
|
|
45
|
-
return words.map((word) => word.toLowerCase()).join("_");
|
|
46
|
-
};
|
|
47
|
-
to2.screamingSnakeCase = (text) => {
|
|
48
|
-
const words = split([text]);
|
|
49
|
-
return words.map((word) => word.toUpperCase()).join("_");
|
|
50
|
-
};
|
|
51
|
-
to2.camelCase = (text) => {
|
|
52
|
-
const [first, ...words] = split([text]);
|
|
53
|
-
return [first.toLowerCase(), ...words.map(capitalizeFirstLetter)].join("");
|
|
54
|
-
};
|
|
55
|
-
})(to || (to = {}));
|
|
56
|
-
var is;
|
|
57
|
-
((is2) => {
|
|
58
|
-
is2.pascalCase = (text) => text === to.pascalCase(text);
|
|
59
|
-
is2.kebabCase = (text) => text === to.kebabCase(text);
|
|
60
|
-
is2.snakeCase = (text) => text === to.snakeCase(text);
|
|
61
|
-
is2.screamingSnakeCase = (text) => text === to.screamingSnakeCase(text);
|
|
62
|
-
is2.camelCase = (text) => text === to.camelCase(text);
|
|
63
|
-
})(is || (is = {}));
|
|
64
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
-
0 && (module.exports = {
|
|
66
|
-
is,
|
|
67
|
-
to
|
|
68
|
-
});
|