@event-driven-io/emmett 0.20.1-alpha.3 → 0.20.1-alpha.5
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.cjs +251 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +1552 -13
- package/dist/index.cjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-CJZAVRMT.cjs +0 -2
- package/dist/chunk-CJZAVRMT.cjs.map +0 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,16 +1,257 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/cli.ts
|
|
32
|
+
var cli_exports = {};
|
|
33
|
+
__export(cli_exports, {
|
|
34
|
+
configCommand: () => configCommand,
|
|
35
|
+
default: () => cli_default,
|
|
36
|
+
generateConfigFile: () => generateConfigFile,
|
|
37
|
+
importPluginsConfig: () => importPluginsConfig,
|
|
38
|
+
loadPlugins: () => loadPlugins,
|
|
39
|
+
registerCliPlugins: () => registerCliPlugins,
|
|
40
|
+
sampleConfig: () => sampleConfig
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(cli_exports);
|
|
43
|
+
var import_commander4 = require("commander");
|
|
44
|
+
|
|
45
|
+
// src/commandLine/config.ts
|
|
46
|
+
var import_commander = require("commander");
|
|
47
|
+
var import_node_fs = require("fs");
|
|
48
|
+
var import_process = require("process");
|
|
49
|
+
var sampleConfig = (plugins = ["emmett-expressjs"]) => {
|
|
50
|
+
const pluginsNames = plugins.length > 0 ? `[
|
|
51
|
+
${plugins.map((p) => `"${p}"`).join(",\n")}
|
|
52
|
+
]` : "[]";
|
|
53
|
+
return `
|
|
3
54
|
export default {
|
|
4
|
-
plugins: ${
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
]`:"[]"},
|
|
55
|
+
plugins: ${pluginsNames},
|
|
56
|
+
};
|
|
57
|
+
`;
|
|
8
58
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
59
|
+
var generateConfigFile = (configPath, collectionNames) => {
|
|
60
|
+
try {
|
|
61
|
+
(0, import_node_fs.writeFileSync)(configPath, sampleConfig(collectionNames), "utf8");
|
|
62
|
+
console.log(`Configuration file stored at: ${configPath}`);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.error(`Error: Couldn't store config file: ${configPath}!`);
|
|
65
|
+
console.error(error);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
var configCommand = new import_commander.Command("config").description(
|
|
70
|
+
"Manage Pongo configuration"
|
|
71
|
+
);
|
|
72
|
+
configCommand.command("sample").description("Generate or print sample configuration").option(
|
|
73
|
+
"-plg, --plugins <name>",
|
|
74
|
+
"Specify the plugin name",
|
|
75
|
+
(value, previous) => {
|
|
76
|
+
return previous.concat([value]);
|
|
77
|
+
},
|
|
78
|
+
[]
|
|
79
|
+
).option(
|
|
80
|
+
"-f, --file <path>",
|
|
81
|
+
"Path to configuration file with collection list"
|
|
82
|
+
).option("-g, --generate", "Generate sample config file").option("-p, --print", "Print sample config file").action((options) => {
|
|
83
|
+
const plugins = options.plugin.length > 0 ? options.plugin : ["@event-driven-io/emmett-expressjs"];
|
|
84
|
+
if (!("print" in options) && !("generate" in options)) {
|
|
85
|
+
console.error(
|
|
86
|
+
"Error: Please provide either:\n--print param to print sample config or\n--generate to generate sample config file"
|
|
87
|
+
);
|
|
88
|
+
(0, import_process.exit)(1);
|
|
89
|
+
}
|
|
90
|
+
if ("print" in options) {
|
|
91
|
+
console.log(`${sampleConfig(plugins)}`);
|
|
92
|
+
} else if ("generate" in options) {
|
|
93
|
+
if (!options.file) {
|
|
94
|
+
console.error(
|
|
95
|
+
"Error: You need to provide a config file through a --file"
|
|
96
|
+
);
|
|
97
|
+
(0, import_process.exit)(1);
|
|
98
|
+
}
|
|
99
|
+
generateConfigFile(options.file, plugins);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// src/commandLine/plugins.ts
|
|
104
|
+
var import_commander3 = require("commander");
|
|
105
|
+
var import_path = __toESM(require("path"), 1);
|
|
106
|
+
|
|
107
|
+
// src/config/plugins/index.ts
|
|
108
|
+
var import_commander2 = require("commander");
|
|
109
|
+
var isPluginConfig = (plugin) => plugin !== void 0 && (typeof plugin === "string" || "name" in plugin && plugin.name !== void 0 && typeof plugin.name === "string");
|
|
12
110
|
|
|
13
|
-
|
|
111
|
+
// src/validation/index.ts
|
|
112
|
+
var isNumber = (val) => typeof val === "number" && val === val;
|
|
113
|
+
var isString = (val) => typeof val === "string";
|
|
114
|
+
|
|
115
|
+
// src/errors/index.ts
|
|
116
|
+
var EmmettError = class _EmmettError extends Error {
|
|
117
|
+
errorCode;
|
|
118
|
+
constructor(options) {
|
|
119
|
+
const errorCode = options && typeof options === "object" && "errorCode" in options ? options.errorCode : isNumber(options) ? options : 500;
|
|
120
|
+
const message = options && typeof options === "object" && "message" in options ? options.message : isString(options) ? options : `Error with status code '${errorCode}' ocurred during Emmett processing`;
|
|
121
|
+
super(message);
|
|
122
|
+
this.errorCode = errorCode;
|
|
123
|
+
Object.setPrototypeOf(this, _EmmettError.prototype);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
14
126
|
|
|
15
|
-
|
|
127
|
+
// src/commandLine/plugins.ts
|
|
128
|
+
var PluginsConfigImportError = {
|
|
129
|
+
missingDefaultExport: `Error: Config should contain default export, e.g.
|
|
130
|
+
|
|
131
|
+
${sampleConfig()}`,
|
|
132
|
+
missingPluginsPropertyExport: `Error: Config should contain default export with plugins array, e.g.
|
|
133
|
+
|
|
134
|
+
${sampleConfig()}`,
|
|
135
|
+
wrongPluginStructure: `Error: Plugin config should be either string with plugin name or object with plugin name, e.g. { name: 'emmett-expressjs' }`
|
|
136
|
+
};
|
|
137
|
+
var importPluginsConfig = async (options) => {
|
|
138
|
+
const configPath = import_path.default.join(
|
|
139
|
+
process.cwd(),
|
|
140
|
+
options?.configPath ?? "./dist/emmett.config.js"
|
|
141
|
+
);
|
|
142
|
+
console.log("IMPORTING" + configPath);
|
|
143
|
+
try {
|
|
144
|
+
const imported = await import(configPath);
|
|
145
|
+
if (!imported.default) {
|
|
146
|
+
return new EmmettError(PluginsConfigImportError.missingDefaultExport);
|
|
147
|
+
}
|
|
148
|
+
if (!imported.default.plugins || !Array.isArray(imported.default.plugins)) {
|
|
149
|
+
return new EmmettError(
|
|
150
|
+
PluginsConfigImportError.missingPluginsPropertyExport
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
if (!imported.default.plugins.every(isPluginConfig)) {
|
|
154
|
+
return new EmmettError(PluginsConfigImportError.wrongPluginStructure);
|
|
155
|
+
}
|
|
156
|
+
return { plugins: imported.default.plugins };
|
|
157
|
+
} catch (error) {
|
|
158
|
+
if (!options?.configPath) {
|
|
159
|
+
console.warn("Didn`t find config file: " + configPath, error);
|
|
160
|
+
return { plugins: [] };
|
|
161
|
+
}
|
|
162
|
+
return new EmmettError(
|
|
163
|
+
`Error: Couldn't load file:` + error.toString()
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
var loadPlugins = async (options) => {
|
|
168
|
+
try {
|
|
169
|
+
const pluginsConfig = await importPluginsConfig({
|
|
170
|
+
configPath: options?.configPath
|
|
171
|
+
});
|
|
172
|
+
if (pluginsConfig instanceof EmmettError) throw pluginsConfig;
|
|
173
|
+
if (pluginsConfig.plugins.length === 0) {
|
|
174
|
+
console.log(`No extensions specified in config ${options?.configPath}.`);
|
|
175
|
+
return [];
|
|
176
|
+
}
|
|
177
|
+
const pluginsToLoad = filterPluginsByType(
|
|
178
|
+
pluginsConfig.plugins,
|
|
179
|
+
options?.pluginType
|
|
180
|
+
);
|
|
181
|
+
const pluginsPromises = pluginsToLoad.map(async (pluginConfig) => {
|
|
182
|
+
const importPath = getImportPath(pluginConfig, options?.pluginType);
|
|
183
|
+
try {
|
|
184
|
+
const plugin = await import(importPath);
|
|
185
|
+
console.info(`Loaded plugin: ${importPath}`);
|
|
186
|
+
if (!plugin.default) {
|
|
187
|
+
throw new Error(`Plugin: ${importPath} is missing default export`);
|
|
188
|
+
}
|
|
189
|
+
return plugin.default;
|
|
190
|
+
} catch (error) {
|
|
191
|
+
console.error(`Failed to load extension "${importPath}":`, error);
|
|
192
|
+
return void 0;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
return (await Promise.all(pluginsPromises)).filter(
|
|
196
|
+
(plugin) => plugin !== void 0
|
|
197
|
+
);
|
|
198
|
+
} catch (error) {
|
|
199
|
+
console.error(`Failed to load config ${options?.configPath}:`, error);
|
|
200
|
+
return [];
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
var registerCliPlugins = async (program2, plugins) => {
|
|
204
|
+
const result = [];
|
|
205
|
+
for (const plugin of plugins) {
|
|
206
|
+
const pluginName = plugin.name;
|
|
207
|
+
if (!("registerCommands" in plugin)) {
|
|
208
|
+
console.warn(`No registerCommands function found in ${pluginName}`);
|
|
209
|
+
}
|
|
210
|
+
await plugin.registerCommands(program2);
|
|
211
|
+
console.log(`Loaded extension: ${plugin.name}`);
|
|
212
|
+
result.push(plugin);
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
var filterPluginsByType = (plugins, pluginType) => plugins.filter(
|
|
216
|
+
(p) => typeof p === "string" || pluginType && (p.register === void 0 || p.register.some((r) => r.pluginType === pluginType))
|
|
217
|
+
);
|
|
218
|
+
var getImportPath = (pluginConfig, pluginType) => {
|
|
219
|
+
if (typeof pluginConfig === "string") {
|
|
220
|
+
return pluginType ? `${pluginConfig}/${pluginType}` : pluginConfig;
|
|
221
|
+
}
|
|
222
|
+
const pluginSubpath = pluginConfig.register.find((r) => pluginType && r.pluginType === pluginType)?.path ?? pluginType;
|
|
223
|
+
return pluginSubpath ? `${pluginConfig.name}/${pluginSubpath}` : pluginConfig.name;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// src/cli.ts
|
|
227
|
+
var program = new import_commander4.Command();
|
|
228
|
+
program.name("emmett").description("CLI tool for Emmett").option("--config <path>", "Path to the configuration file");
|
|
229
|
+
var initCLI = async () => {
|
|
230
|
+
const configIndex = process.argv.indexOf("--config");
|
|
231
|
+
const configPath = configIndex !== -1 && process.argv.length > configIndex + 1 ? process.argv[configIndex + 1] : void 0;
|
|
232
|
+
try {
|
|
233
|
+
const plugins = await loadPlugins({
|
|
234
|
+
pluginType: "cli",
|
|
235
|
+
configPath
|
|
236
|
+
});
|
|
237
|
+
await registerCliPlugins(program, plugins);
|
|
238
|
+
program.parse(process.argv);
|
|
239
|
+
} catch (err) {
|
|
240
|
+
console.error(`Failed to load config from ${configPath}:`, err);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
initCLI().catch((err) => {
|
|
244
|
+
console.error(`CLI initialization failed:`);
|
|
245
|
+
console.error(err);
|
|
246
|
+
});
|
|
247
|
+
var cli_default = program;
|
|
248
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
249
|
+
0 && (module.exports = {
|
|
250
|
+
configCommand,
|
|
251
|
+
generateConfigFile,
|
|
252
|
+
importPluginsConfig,
|
|
253
|
+
loadPlugins,
|
|
254
|
+
registerCliPlugins,
|
|
255
|
+
sampleConfig
|
|
256
|
+
});
|
|
16
257
|
//# sourceMappingURL=cli.cjs.map
|
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/emmett/emmett/src/packages/emmett/dist/cli.cjs","../src/cli.ts","../src/commandLine/config.ts","../src/commandLine/plugins.ts"],"names":["sampleConfig","plugins","p","generateConfigFile","configPath","collectionNames","writeFileSync"],"mappings":"AAAA;AACA,2lCAA+C,sCCAvB,wBCCM,kCACT,IAERA,CAAAA,CAAe,CAACC,CAAAA,CAAoB,CAAC,kBAAkB,CAAA,CAAA,EAM3D,CAAA;AAAA;AAAA,WAAA,EAJLA,CAAAA,CAAQ,MAAA,CAAS,CAAA,CACb,CAAA;AAAA,EAAMA,CAAAA,CAAQ,GAAA,CAAKC,CAAAA,EAAM,CAAA,CAAA,EAAIA,CAAC,CAAA,CAAA,CAAG,CAAA,CAAE,IAAA,CAAK,CAAA;AAAA,CAAK,CAAC,CAAA;AAAA,CAAA,CAAA,CAC9C,IAIiB,CAAA;AAAA;AAAA,CAAA,CAKZC,CAAAA,8BAAqB,CAChCC,CAAAA,CACAC,CAAAA,CAAAA,EACS,CACT,GAAI,CACFC,+BAAAA,CAAcF,CAAYJ,CAAAA,CAAaK,CAAe,CAAA,CAAG,MAAM,CAAA,CAC/D,OAAA,CAAQ,GAAA,CAAI,CAAA,8BAAA,EAAiCD,CAAU,CAAA,CAAA;AAiDnD;AAMiC,yCAAA;ACjEjB;AACQ;AAAA;AACR","file":"/home/runner/work/emmett/emmett/src/packages/emmett/dist/cli.cjs","sourcesContent":[null,"#!/usr/bin/env node\nimport { Command } from 'commander';\nimport { loadPlugins, registerCliPlugins } from './commandLine';\n\nconst program = new Command();\n\nprogram\n .name('emmett')\n .description('CLI tool for Emmett')\n .option('--config <path>', 'Path to the configuration file');\n\n// Load extensions and parse CLI arguments\nconst initCLI = async () => {\n const configIndex = process.argv.indexOf('--config');\n\n const configPath =\n configIndex !== -1 && process.argv.length > configIndex + 1\n ? process.argv[configIndex + 1]\n : undefined;\n\n try {\n const plugins = await loadPlugins({\n pluginType: 'cli',\n configPath: configPath,\n });\n await registerCliPlugins(program, plugins);\n\n // Parse the CLI arguments\n program.parse(process.argv);\n } catch (err) {\n console.error(`Failed to load config from ${configPath}:`, err);\n }\n};\n\n//Initialize CLI and handle errors\ninitCLI().catch((err) => {\n console.error(`CLI initialization failed:`);\n console.error(err);\n});\n\nexport default program;\nexport * from './commandLine';\n","import { Command as CliCommand } from 'commander';\n// eslint-disable-next-line no-restricted-imports\nimport { writeFileSync } from 'node:fs';\nimport { exit } from 'process';\n\nexport const sampleConfig = (plugins: string[] = ['emmett-expressjs']) => {\n const pluginsNames =\n plugins.length > 0\n ? `[\\n${plugins.map((p) => `\"${p}\"`).join(',\\n')} \\n]`\n : '[]';\n\n return `\nexport default {\n plugins: ${pluginsNames},\n};\n`;\n};\n\nexport const generateConfigFile = (\n configPath: string,\n collectionNames: string[],\n): void => {\n try {\n writeFileSync(configPath, sampleConfig(collectionNames), 'utf8');\n console.log(`Configuration file stored at: ${configPath}`);\n } catch (error) {\n console.error(`Error: Couldn't store config file: ${configPath}!`);\n console.error(error);\n process.exit(1);\n }\n};\n\nexport const configCommand = new CliCommand('config').description(\n 'Manage Pongo configuration',\n);\n\ntype SampleConfigOptions =\n | {\n plugin: string[];\n print?: boolean;\n }\n | {\n plugin: string[];\n generate?: boolean;\n file?: string;\n };\n\nconfigCommand\n .command('sample')\n .description('Generate or print sample configuration')\n .option(\n '-plg, --plugins <name>',\n 'Specify the plugin name',\n (value: string, previous: string[]) => {\n // Accumulate plugins names into an array (explicitly typing `previous` as `string[]`)\n return previous.concat([value]);\n },\n [] as string[],\n )\n .option(\n '-f, --file <path>',\n 'Path to configuration file with collection list',\n )\n .option('-g, --generate', 'Generate sample config file')\n .option('-p, --print', 'Print sample config file')\n .action((options: SampleConfigOptions) => {\n const plugins =\n options.plugin.length > 0\n ? options.plugin\n : ['@event-driven-io/emmett-expressjs'];\n\n if (!('print' in options) && !('generate' in options)) {\n console.error(\n 'Error: Please provide either:\\n--print param to print sample config or\\n--generate to generate sample config file',\n );\n exit(1);\n }\n\n if ('print' in options) {\n console.log(`${sampleConfig(plugins)}`);\n } else if ('generate' in options) {\n if (!options.file) {\n console.error(\n 'Error: You need to provide a config file through a --file',\n );\n exit(1);\n }\n\n generateConfigFile(options.file, plugins);\n }\n });\n","import { Command as CliCommand } from 'commander';\nimport path from 'path';\nimport {\n isPluginConfig,\n type EmmettCliPlugin,\n type EmmettPlugin,\n type EmmettPluginConfig,\n type EmmettPluginsConfig,\n type EmmettPluginType,\n} from '../config';\nimport { EmmettError } from '../errors';\nimport { sampleConfig } from './config';\n\nconst PluginsConfigImportError = {\n missingDefaultExport: `Error: Config should contain default export, e.g.\\n\\n${sampleConfig()}`,\n missingPluginsPropertyExport: `Error: Config should contain default export with plugins array, e.g.\\n\\n${sampleConfig()}`,\n wrongPluginStructure: `Error: Plugin config should be either string with plugin name or object with plugin name, e.g. { name: 'emmett-expressjs' }`,\n};\nexport const importPluginsConfig = async (options?: {\n configPath?: string | undefined;\n}): Promise<EmmettPluginsConfig | EmmettError> => {\n const configPath = path.join(\n process.cwd(),\n options?.configPath ?? './dist/emmett.config.js',\n );\n\n console.log('IMPORTING' + configPath);\n\n try {\n const imported = (await import(configPath)) as {\n default: Partial<EmmettPluginsConfig>;\n };\n\n if (!imported.default) {\n return new EmmettError(PluginsConfigImportError.missingDefaultExport);\n }\n\n if (!imported.default.plugins || !Array.isArray(imported.default.plugins)) {\n return new EmmettError(\n PluginsConfigImportError.missingPluginsPropertyExport,\n );\n }\n\n if (!imported.default.plugins.every(isPluginConfig)) {\n return new EmmettError(PluginsConfigImportError.wrongPluginStructure);\n }\n\n return { plugins: imported.default.plugins };\n } catch (error) {\n if (!options?.configPath) {\n console.warn('Didn`t find config file: ' + configPath, error);\n return { plugins: [] };\n }\n return new EmmettError(\n `Error: Couldn't load file:` + (error as Error).toString(),\n );\n }\n};\n\nexport const loadPlugins = async (options?: {\n pluginType?: EmmettPluginType;\n configPath?: string;\n}): Promise<EmmettPlugin[]> => {\n try {\n const pluginsConfig = await importPluginsConfig({\n configPath: options?.configPath,\n });\n\n if (pluginsConfig instanceof EmmettError) throw pluginsConfig;\n\n if (pluginsConfig.plugins.length === 0) {\n console.log(`No extensions specified in config ${options?.configPath}.`);\n return [];\n }\n\n const pluginsToLoad = filterPluginsByType(\n pluginsConfig.plugins,\n options?.pluginType,\n );\n\n const pluginsPromises = pluginsToLoad.map(async (pluginConfig) => {\n const importPath = getImportPath(pluginConfig, options?.pluginType);\n try {\n const plugin = (await import(importPath)) as { default: EmmettPlugin };\n\n console.info(`Loaded plugin: ${importPath}`);\n\n if (!plugin.default) {\n throw new Error(`Plugin: ${importPath} is missing default export`);\n }\n\n return plugin.default;\n } catch (error) {\n console.error(`Failed to load extension \"${importPath}\":`, error);\n return undefined;\n }\n });\n\n return (await Promise.all(pluginsPromises)).filter(\n (plugin) => plugin !== undefined,\n );\n } catch (error) {\n console.error(`Failed to load config ${options?.configPath}:`, error);\n return [];\n }\n};\n\nexport const registerCliPlugins = async (\n program: CliCommand,\n plugins: EmmettCliPlugin[],\n): Promise<void> => {\n const result: EmmettCliPlugin[] = [];\n\n for (const plugin of plugins) {\n const pluginName = plugin.name;\n\n if (!('registerCommands' in plugin)) {\n console.warn(`No registerCommands function found in ${pluginName}`);\n }\n await plugin.registerCommands(program);\n console.log(`Loaded extension: ${plugin.name}`);\n result.push(plugin);\n }\n};\n\nconst filterPluginsByType = (\n plugins: EmmettPluginConfig[],\n pluginType?: EmmettPluginType,\n): EmmettPluginConfig[] =>\n plugins.filter(\n (p) =>\n typeof p === 'string' ||\n (pluginType &&\n (p.register === undefined ||\n p.register.some((r) => r.pluginType === pluginType))),\n );\n\nconst getImportPath = (\n pluginConfig: EmmettPluginConfig,\n pluginType: EmmettPluginType | undefined,\n) => {\n if (typeof pluginConfig === 'string') {\n return pluginType ? `${pluginConfig}/${pluginType}` : pluginConfig;\n }\n\n const pluginSubpath =\n pluginConfig.register.find((r) => pluginType && r.pluginType === pluginType)\n ?.path ?? pluginType;\n\n return pluginSubpath\n ? `${pluginConfig.name}/${pluginSubpath}`\n : pluginConfig.name;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/commandLine/config.ts","../src/commandLine/plugins.ts","../src/config/plugins/index.ts","../src/validation/index.ts","../src/errors/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from 'commander';\nimport { loadPlugins, registerCliPlugins } from './commandLine';\n\nconst program = new Command();\n\nprogram\n .name('emmett')\n .description('CLI tool for Emmett')\n .option('--config <path>', 'Path to the configuration file');\n\n// Load extensions and parse CLI arguments\nconst initCLI = async () => {\n const configIndex = process.argv.indexOf('--config');\n\n const configPath =\n configIndex !== -1 && process.argv.length > configIndex + 1\n ? process.argv[configIndex + 1]\n : undefined;\n\n try {\n const plugins = await loadPlugins({\n pluginType: 'cli',\n configPath: configPath,\n });\n await registerCliPlugins(program, plugins);\n\n // Parse the CLI arguments\n program.parse(process.argv);\n } catch (err) {\n console.error(`Failed to load config from ${configPath}:`, err);\n }\n};\n\n//Initialize CLI and handle errors\ninitCLI().catch((err) => {\n console.error(`CLI initialization failed:`);\n console.error(err);\n});\n\nexport default program;\nexport * from './commandLine';\n","import { Command as CliCommand } from 'commander';\n// eslint-disable-next-line no-restricted-imports\nimport { writeFileSync } from 'node:fs';\nimport { exit } from 'process';\n\nexport const sampleConfig = (plugins: string[] = ['emmett-expressjs']) => {\n const pluginsNames =\n plugins.length > 0\n ? `[\\n${plugins.map((p) => `\"${p}\"`).join(',\\n')} \\n]`\n : '[]';\n\n return `\nexport default {\n plugins: ${pluginsNames},\n};\n`;\n};\n\nexport const generateConfigFile = (\n configPath: string,\n collectionNames: string[],\n): void => {\n try {\n writeFileSync(configPath, sampleConfig(collectionNames), 'utf8');\n console.log(`Configuration file stored at: ${configPath}`);\n } catch (error) {\n console.error(`Error: Couldn't store config file: ${configPath}!`);\n console.error(error);\n process.exit(1);\n }\n};\n\nexport const configCommand = new CliCommand('config').description(\n 'Manage Pongo configuration',\n);\n\ntype SampleConfigOptions =\n | {\n plugin: string[];\n print?: boolean;\n }\n | {\n plugin: string[];\n generate?: boolean;\n file?: string;\n };\n\nconfigCommand\n .command('sample')\n .description('Generate or print sample configuration')\n .option(\n '-plg, --plugins <name>',\n 'Specify the plugin name',\n (value: string, previous: string[]) => {\n // Accumulate plugins names into an array (explicitly typing `previous` as `string[]`)\n return previous.concat([value]);\n },\n [] as string[],\n )\n .option(\n '-f, --file <path>',\n 'Path to configuration file with collection list',\n )\n .option('-g, --generate', 'Generate sample config file')\n .option('-p, --print', 'Print sample config file')\n .action((options: SampleConfigOptions) => {\n const plugins =\n options.plugin.length > 0\n ? options.plugin\n : ['@event-driven-io/emmett-expressjs'];\n\n if (!('print' in options) && !('generate' in options)) {\n console.error(\n 'Error: Please provide either:\\n--print param to print sample config or\\n--generate to generate sample config file',\n );\n exit(1);\n }\n\n if ('print' in options) {\n console.log(`${sampleConfig(plugins)}`);\n } else if ('generate' in options) {\n if (!options.file) {\n console.error(\n 'Error: You need to provide a config file through a --file',\n );\n exit(1);\n }\n\n generateConfigFile(options.file, plugins);\n }\n });\n","import { Command as CliCommand } from 'commander';\nimport path from 'path';\nimport {\n isPluginConfig,\n type EmmettCliPlugin,\n type EmmettPlugin,\n type EmmettPluginConfig,\n type EmmettPluginsConfig,\n type EmmettPluginType,\n} from '../config';\nimport { EmmettError } from '../errors';\nimport { sampleConfig } from './config';\n\nconst PluginsConfigImportError = {\n missingDefaultExport: `Error: Config should contain default export, e.g.\\n\\n${sampleConfig()}`,\n missingPluginsPropertyExport: `Error: Config should contain default export with plugins array, e.g.\\n\\n${sampleConfig()}`,\n wrongPluginStructure: `Error: Plugin config should be either string with plugin name or object with plugin name, e.g. { name: 'emmett-expressjs' }`,\n};\nexport const importPluginsConfig = async (options?: {\n configPath?: string | undefined;\n}): Promise<EmmettPluginsConfig | EmmettError> => {\n const configPath = path.join(\n process.cwd(),\n options?.configPath ?? './dist/emmett.config.js',\n );\n\n console.log('IMPORTING' + configPath);\n\n try {\n const imported = (await import(configPath)) as {\n default: Partial<EmmettPluginsConfig>;\n };\n\n if (!imported.default) {\n return new EmmettError(PluginsConfigImportError.missingDefaultExport);\n }\n\n if (!imported.default.plugins || !Array.isArray(imported.default.plugins)) {\n return new EmmettError(\n PluginsConfigImportError.missingPluginsPropertyExport,\n );\n }\n\n if (!imported.default.plugins.every(isPluginConfig)) {\n return new EmmettError(PluginsConfigImportError.wrongPluginStructure);\n }\n\n return { plugins: imported.default.plugins };\n } catch (error) {\n if (!options?.configPath) {\n console.warn('Didn`t find config file: ' + configPath, error);\n return { plugins: [] };\n }\n return new EmmettError(\n `Error: Couldn't load file:` + (error as Error).toString(),\n );\n }\n};\n\nexport const loadPlugins = async (options?: {\n pluginType?: EmmettPluginType;\n configPath?: string;\n}): Promise<EmmettPlugin[]> => {\n try {\n const pluginsConfig = await importPluginsConfig({\n configPath: options?.configPath,\n });\n\n if (pluginsConfig instanceof EmmettError) throw pluginsConfig;\n\n if (pluginsConfig.plugins.length === 0) {\n console.log(`No extensions specified in config ${options?.configPath}.`);\n return [];\n }\n\n const pluginsToLoad = filterPluginsByType(\n pluginsConfig.plugins,\n options?.pluginType,\n );\n\n const pluginsPromises = pluginsToLoad.map(async (pluginConfig) => {\n const importPath = getImportPath(pluginConfig, options?.pluginType);\n try {\n const plugin = (await import(importPath)) as { default: EmmettPlugin };\n\n console.info(`Loaded plugin: ${importPath}`);\n\n if (!plugin.default) {\n throw new Error(`Plugin: ${importPath} is missing default export`);\n }\n\n return plugin.default;\n } catch (error) {\n console.error(`Failed to load extension \"${importPath}\":`, error);\n return undefined;\n }\n });\n\n return (await Promise.all(pluginsPromises)).filter(\n (plugin) => plugin !== undefined,\n );\n } catch (error) {\n console.error(`Failed to load config ${options?.configPath}:`, error);\n return [];\n }\n};\n\nexport const registerCliPlugins = async (\n program: CliCommand,\n plugins: EmmettCliPlugin[],\n): Promise<void> => {\n const result: EmmettCliPlugin[] = [];\n\n for (const plugin of plugins) {\n const pluginName = plugin.name;\n\n if (!('registerCommands' in plugin)) {\n console.warn(`No registerCommands function found in ${pluginName}`);\n }\n await plugin.registerCommands(program);\n console.log(`Loaded extension: ${plugin.name}`);\n result.push(plugin);\n }\n};\n\nconst filterPluginsByType = (\n plugins: EmmettPluginConfig[],\n pluginType?: EmmettPluginType,\n): EmmettPluginConfig[] =>\n plugins.filter(\n (p) =>\n typeof p === 'string' ||\n (pluginType &&\n (p.register === undefined ||\n p.register.some((r) => r.pluginType === pluginType))),\n );\n\nconst getImportPath = (\n pluginConfig: EmmettPluginConfig,\n pluginType: EmmettPluginType | undefined,\n) => {\n if (typeof pluginConfig === 'string') {\n return pluginType ? `${pluginConfig}/${pluginType}` : pluginConfig;\n }\n\n const pluginSubpath =\n pluginConfig.register.find((r) => pluginType && r.pluginType === pluginType)\n ?.path ?? pluginType;\n\n return pluginSubpath\n ? `${pluginConfig.name}/${pluginSubpath}`\n : pluginConfig.name;\n};\n","import { Command as CliCommand } from 'commander';\n\nexport type EmmettPluginConfig =\n | {\n name: string;\n register: EmmettPluginRegistration[];\n }\n | string;\n\nexport type EmmettPluginType = 'cli';\n\nexport type EmmettCliPluginRegistration = { pluginType: 'cli'; path?: string };\n\nexport type EmmettPluginRegistration = EmmettCliPluginRegistration;\n\nexport type EmmettCliPlugin = {\n pluginType: 'cli';\n name: string;\n registerCommands: (program: CliCommand) => Promise<void> | void;\n};\n\nexport type EmmettPlugin = EmmettCliPlugin;\n\nexport const isPluginConfig = (\n plugin: Partial<EmmettPluginConfig> | string | undefined,\n): plugin is EmmettPluginConfig =>\n plugin !== undefined &&\n (typeof plugin === 'string' ||\n ('name' in plugin &&\n plugin.name !== undefined &&\n typeof plugin.name === 'string'));\n","import { ValidationError } from '../errors';\n\nexport const enum ValidationErrors {\n NOT_A_NONEMPTY_STRING = 'NOT_A_NONEMPTY_STRING',\n NOT_A_POSITIVE_NUMBER = 'NOT_A_POSITIVE_NUMBER',\n NOT_AN_UNSIGNED_BIGINT = 'NOT_AN_UNSIGNED_BIGINT',\n}\n\nexport const isNumber = (val: unknown): val is number =>\n typeof val === 'number' && val === val;\n\nexport const isString = (val: unknown): val is string =>\n typeof val === 'string';\n\nexport const assertNotEmptyString = (value: unknown): string => {\n if (!isString(value) || value.length === 0) {\n throw new ValidationError(ValidationErrors.NOT_A_NONEMPTY_STRING);\n }\n return value;\n};\n\nexport const assertPositiveNumber = (value: unknown): number => {\n if (!isNumber(value) || value <= 0) {\n throw new ValidationError(ValidationErrors.NOT_A_POSITIVE_NUMBER);\n }\n return value;\n};\n\nexport const assertUnsignedBigInt = (value: string): bigint => {\n const number = BigInt(value);\n if (number < 0) {\n throw new ValidationError(ValidationErrors.NOT_AN_UNSIGNED_BIGINT);\n }\n return number;\n};\n\nexport * from './dates';\n","import { isNumber, isString } from '../validation';\n\nexport type ErrorConstructor<ErrorType extends Error> = new (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...args: any[]\n) => ErrorType;\n\nexport const isErrorConstructor = <ErrorType extends Error>(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n expect: Function,\n): expect is ErrorConstructor<ErrorType> => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (\n typeof expect === 'function' &&\n expect.prototype &&\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n expect.prototype.constructor === expect\n );\n};\n\nexport class EmmettError extends Error {\n public errorCode: number;\n\n constructor(\n options?: { errorCode: number; message?: string } | string | number,\n ) {\n const errorCode =\n options && typeof options === 'object' && 'errorCode' in options\n ? options.errorCode\n : isNumber(options)\n ? options\n : 500;\n const message =\n options && typeof options === 'object' && 'message' in options\n ? options.message\n : isString(options)\n ? options\n : `Error with status code '${errorCode}' ocurred during Emmett processing`;\n\n super(message);\n this.errorCode = errorCode;\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, EmmettError.prototype);\n }\n}\n\nexport class ConcurrencyError extends EmmettError {\n constructor(\n public current: string | undefined,\n public expected: string,\n message?: string,\n ) {\n super({\n errorCode: 412,\n message:\n message ??\n `Expected version ${expected.toString()} does not match current ${current?.toString()}`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, ConcurrencyError.prototype);\n }\n}\n\nexport class ValidationError extends EmmettError {\n constructor(message?: string) {\n super({\n errorCode: 400,\n message: message ?? `Validation Error ocurred during Emmett processing`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n\nexport class IllegalStateError extends EmmettError {\n constructor(message?: string) {\n super({\n errorCode: 403,\n message: message ?? `Illegal State ocurred during Emmett processing`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, IllegalStateError.prototype);\n }\n}\n\nexport class NotFoundError extends EmmettError {\n constructor(options?: { id: string; type: string; message?: string }) {\n super({\n errorCode: 404,\n message:\n options?.message ??\n (options?.id\n ? options.type\n ? `${options.type} with ${options.id} was not found during Emmett processing`\n : `State with ${options.id} was not found during Emmett processing`\n : options?.type\n ? `${options.type} was not found during Emmett processing`\n : 'State was not found during Emmett processing'),\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,oBAAwB;;;ACDxB,uBAAsC;AAEtC,qBAA8B;AAC9B,qBAAqB;AAEd,IAAM,eAAe,CAAC,UAAoB,CAAC,kBAAkB,MAAM;AACxE,QAAM,eACJ,QAAQ,SAAS,IACb;AAAA,EAAM,QAAQ,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,KAAK,KAAK,CAAC;AAAA,KAC9C;AAEN,SAAO;AAAA;AAAA,aAEI,YAAY;AAAA;AAAA;AAGzB;AAEO,IAAM,qBAAqB,CAChC,YACA,oBACS;AACT,MAAI;AACF,sCAAc,YAAY,aAAa,eAAe,GAAG,MAAM;AAC/D,YAAQ,IAAI,iCAAiC,UAAU,EAAE;AAAA,EAC3D,SAAS,OAAO;AACd,YAAQ,MAAM,sCAAsC,UAAU,GAAG;AACjE,YAAQ,MAAM,KAAK;AACnB,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAEO,IAAM,gBAAgB,IAAI,iBAAAC,QAAW,QAAQ,EAAE;AAAA,EACpD;AACF;AAaA,cACG,QAAQ,QAAQ,EAChB,YAAY,wCAAwC,EACpD;AAAA,EACC;AAAA,EACA;AAAA,EACA,CAAC,OAAe,aAAuB;AAErC,WAAO,SAAS,OAAO,CAAC,KAAK,CAAC;AAAA,EAChC;AAAA,EACA,CAAC;AACH,EACC;AAAA,EACC;AAAA,EACA;AACF,EACC,OAAO,kBAAkB,6BAA6B,EACtD,OAAO,eAAe,0BAA0B,EAChD,OAAO,CAAC,YAAiC;AACxC,Q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