@clerc/core 0.25.0 → 0.25.1
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/index.js +3 -2
- package/dist/index.mjs +3 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -276,7 +276,8 @@ const _Clerc = class {
|
|
|
276
276
|
}
|
|
277
277
|
const { handler = void 0, ...commandToSave } = isCommandObject ? nameOrCommand : { name, description, ...options };
|
|
278
278
|
const nameList = [commandToSave.name];
|
|
279
|
-
commandToSave.alias
|
|
279
|
+
const aliasList = commandToSave.alias ? toArray(commandToSave.alias) : [];
|
|
280
|
+
commandToSave.alias && nameList.push(...aliasList);
|
|
280
281
|
for (const name2 of nameList) {
|
|
281
282
|
if (__privateGet(this, _usedNames).has(name2)) {
|
|
282
283
|
throw new CommandExistsError(formatCommandName(name2));
|
|
@@ -284,7 +285,7 @@ const _Clerc = class {
|
|
|
284
285
|
}
|
|
285
286
|
__privateGet(this, _commands)[name] = commandToSave;
|
|
286
287
|
__privateGet(this, _usedNames).add(commandToSave.name);
|
|
287
|
-
|
|
288
|
+
aliasList.forEach((a) => __privateGet(this, _usedNames).add(a));
|
|
288
289
|
isCommandObject && handler && this.on(nameOrCommand.name, handler);
|
|
289
290
|
return this;
|
|
290
291
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -276,7 +276,8 @@ const _Clerc = class {
|
|
|
276
276
|
}
|
|
277
277
|
const { handler = void 0, ...commandToSave } = isCommandObject ? nameOrCommand : { name, description, ...options };
|
|
278
278
|
const nameList = [commandToSave.name];
|
|
279
|
-
commandToSave.alias
|
|
279
|
+
const aliasList = commandToSave.alias ? toArray(commandToSave.alias) : [];
|
|
280
|
+
commandToSave.alias && nameList.push(...aliasList);
|
|
280
281
|
for (const name2 of nameList) {
|
|
281
282
|
if (__privateGet(this, _usedNames).has(name2)) {
|
|
282
283
|
throw new CommandExistsError(formatCommandName(name2));
|
|
@@ -284,7 +285,7 @@ const _Clerc = class {
|
|
|
284
285
|
}
|
|
285
286
|
__privateGet(this, _commands)[name] = commandToSave;
|
|
286
287
|
__privateGet(this, _usedNames).add(commandToSave.name);
|
|
287
|
-
|
|
288
|
+
aliasList.forEach((a) => __privateGet(this, _usedNames).add(a));
|
|
288
289
|
isCommandObject && handler && this.on(nameOrCommand.name, handler);
|
|
289
290
|
return this;
|
|
290
291
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clerc/core",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.1",
|
|
4
4
|
"author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",
|
|
5
5
|
"description": "Clerc core",
|
|
6
6
|
"keywords": [
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"is-platform": "^0.2.0",
|
|
51
51
|
"lite-emit": "^1.4.0",
|
|
52
|
-
"type-fest": "^3.5.
|
|
52
|
+
"type-fest": "^3.5.3",
|
|
53
53
|
"type-flag": "^3.0.0",
|
|
54
|
-
"@clerc/utils": "0.25.
|
|
54
|
+
"@clerc/utils": "0.25.1"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "puild",
|