Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aomex/console

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aomex/console - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

dist/bin.d.ts

61

CHANGELOG.md
# @aomex/console
## 0.0.5
## 0.0.6
### Patch Changes
- [`13033a9`](https://github.com/aomex/aomex/commit/13033a924a2fbfc4c8360bb198f4aa66fa8e4e04) Thanks [@geekact](https://github.com/geekact)! - feat(console): 挂载中间件时检测到链条自动创建分割点
- [`bbc8dda`](https://github.com/aomex/aomex/commit/bbc8dda9f0876c3402608133085350cc693def6f) Thanks [@geekact](https://github.com/geekact)! - refactor: rename package helper to utility
- [`146b6b5`](https://github.com/aomex/aomex/commit/146b6b5f09d4b9f557c1771686f3585bebf4cfc9) Thanks [@geekact](https://github.com/geekact)! - refactor(helper): 重命名 color 为 chalk
- [`9866b9e`](https://github.com/aomex/aomex/commit/9866b9e63abb71e1197ff8002c38bac04a36dd62) Thanks [@geekact](https://github.com/geekact)! - feat(console): run command parallel is supported
- Updated dependencies [[`146b6b5`](https://github.com/aomex/aomex/commit/146b6b5f09d4b9f557c1771686f3585bebf4cfc9), [`e8dee7c`](https://github.com/aomex/aomex/commit/e8dee7c3f064587cd2afb9cb95ab3341f63ccd27)]:
- @aomex/helper@0.0.3
- @aomex/core@0.0.5
## 0.0.4
### Patch Changes
- [`1a2800d`](https://github.com/aomex/aomex/commit/1a2800d3a27f2b45fd5db314c1ca81295831b77d) Thanks [@geekact](https://github.com/geekact)! - feat(console): help 类型的中间件需判断是否存在 cli 属性
- [`cd9369f`](https://github.com/aomex/aomex/commit/cd9369f585053b0003a121fe5fee71c44d78587e) Thanks [@geekact](https://github.com/geekact)! - feat(console): 导出 scriptName 变量
- [`6a57463`](https://github.com/aomex/aomex/commit/6a57463c1107c38a8b8cf5fa00ff3289bf629c0a) Thanks [@geekact](https://github.com/geekact)! - refactor(middleware): 类型 MiddlewareFn 和 GetMiddlewareProps 迁移到命名空间
- [`f6bbf24`](https://github.com/aomex/aomex/commit/f6bbf247a81d20c14598c1046169c2e6e1e48fec) Thanks [@geekact](https://github.com/geekact)! - fix(console): 从错误的字段中过滤中间件
- [`6849b03`](https://github.com/aomex/aomex/commit/6849b03dc1e0dc9b707d89dfe98327c9f120dc7f) Thanks [@geekact](https://github.com/geekact)! - feat(middleware): chain.flatten 支持传入数组
- [`56a5e1f`](https://github.com/aomex/aomex/commit/56a5e1fffe3e1cec863e52c21d122979d121c630) Thanks [@geekact](https://github.com/geekact)! - fix(console): description 赋值错误
- Updated dependencies [[`956bba9`](https://github.com/aomex/aomex/commit/956bba9e5b954f34486ad5f2b45a5277c1f980c9), [`ee021e3`](https://github.com/aomex/aomex/commit/ee021e342814f12777e538c06a19971e1020f201)]:
- @aomex/helper@0.0.2
- @aomex/core@0.0.4
## 0.0.3
### Patch Changes
- [`ee5f8ca`](https://github.com/aomex/aomex/commit/ee5f8ca34df085ab9b5ef2a3525cf361ac46440a) Thanks [@geekact](https://github.com/geekact)! - request.query 重命名为 request.options
- [`d06c1c1`](https://github.com/aomex/aomex/commit/d06c1c1bdfee8657a74bbcbb06a2880263e85529) Thanks [@geekact](https://github.com/geekact)! - middleware 增加构造函数
- Updated dependencies []:
- @aomex/core@0.0.3
## 0.0.2
### Patch Changes
- [`f0b7c9a`](https://github.com/aomex/aomex/commit/f0b7c9a7ce70774080b645c4952ad9b1d0948cf5) Thanks [@geekact](https://github.com/geekact)! - 增加前置全局中间件概念
- Updated dependencies [[`d1ce4e2`](https://github.com/aomex/aomex/commit/d1ce4e2276f93c44e67ea06666d048917fa94e53)]:
- @aomex/core@0.0.2
## 0.0.1
### Patch Changes
- Updated dependencies [[`be095e9`](https://github.com/aomex/aomex/commit/be095e964ec136982581f4ea09024f716ff93a3d)]:
- @aomex/helper@0.0.1
- @aomex/core@0.0.1
- Updated dependencies [[`589243d`](https://github.com/aomex/aomex/commit/589243da955f3e4296d30fdfe05eac0c45714281), [`24d45f0`](https://github.com/aomex/aomex/commit/24d45f02966cfd936d493de5844bcae73caa6d10), [`cab01c6`](https://github.com/aomex/aomex/commit/cab01c63d60e73a7e24018e6872080d5656c29e2), [`bbc8dda`](https://github.com/aomex/aomex/commit/bbc8dda9f0876c3402608133085350cc693def6f)]:
- @aomex/file-parser@0.0.3
- @aomex/utility@0.0.4
- @aomex/core@0.0.6
import { Chain, PureMiddlewareToken, Next, Middleware, Validator } from '@aomex/core';
import { NonReadonly } from '@aomex/helper';
import { NonReadonly } from '@aomex/utility';
import { Argv } from 'yargs';

@@ -20,14 +20,17 @@ import EventEmitter from 'node:events';

interface ConsoleAppOption {
silent?: boolean;
}
declare class ConsoleApp extends EventEmitter {
protected readonly options: ConsoleAppOption;
readonly chainPoints: string[];
protected running: boolean;
protected level: number;
protected readonly tokenList: ConsoleMiddlewareToken[];
constructor(_options?: ConsoleAppOption);
constructor(options?: ConsoleAppOption);
/**
* 执行命令。如果不传参数,则自动从`process.argv`中获取
* Run command. Builtin `process.argv` will be used by default until you input one or more arguments.
* @see process.argv
*/
run(...commands: string[]): Promise<void>;
log(err: Error): void;
mount(middleware: ConsoleMiddlewareToken): void;
mount(middleware: ConsoleMiddlewareToken | null): void;
}

@@ -101,3 +104,3 @@

/**
* 验证控制台命令的传入参数,同时可以设置参数别名
* Validate command-line options, and make type safe.
*

@@ -113,3 +116,3 @@ * ```typescript

* }, {
* date: ['d'], // 传参形式: --date=xxx 或者 -d=xxx
* date: ['d'], // alias --date or -d
* });

@@ -128,2 +131,18 @@ * ],

export { ConsoleApp, ConsoleAppOption, ConsoleChain, ConsoleContext, ConsoleMiddleware, ConsoleMiddlewareToken, ConsoleOptionMiddleware, ConsoleRequest, ConsoleResponse, HelpMiddleware, YargsInstance, options, scriptName, version };
interface Config {
cliEntry: {
/**
* Entry file by each environment
* @see process.env.NODE_ENV
*/
[NODE_ENV: string]: string | undefined;
/**
* Fallback to `default` if NODE_ENV doesn't match specific file.
* @see process.env.NODE_ENV
*/
default?: string;
};
}
declare const defineConfig: (config: Config) => Config;
export { Config, ConsoleApp, ConsoleAppOption, ConsoleChain, ConsoleContext, ConsoleMiddleware, ConsoleMiddlewareToken, ConsoleOptionMiddleware, ConsoleRequest, ConsoleResponse, HelpMiddleware, YargsInstance, defineConfig, options, scriptName, version };

@@ -9,4 +9,4 @@ // src/override/middleware.ts

// src/info.ts
var version = "0.0.5";
// src/meta.ts
var version = "0.0.6";
var scriptName = "aomex";

@@ -117,18 +117,17 @@

// src/app/app.ts
import { chalk } from "@aomex/helper";
import { chalk } from "@aomex/utility";
var ConsoleApp = class extends EventEmitter {
constructor(options2 = {}) {
super();
this.options = options2;
}
chainPoints = [];
running = false;
level = 0;
tokenList = [];
constructor(_options = {}) {
super();
}
/**
* 执行命令。如果不传参数,则自动从`process.argv`中获取
* Run command. Builtin `process.argv` will be used by default until you input one or more arguments.
* @see process.argv
*/
async run(...commands) {
if (this.running) {
throw new Error('Call "app.run()" multiple times at same time');
}
this.running = true;
const currentLevel = this.level++;
const request = new ConsoleRequest(

@@ -141,3 +140,3 @@ this,

if (!this.listenerCount("error")) {
this.on("error", this.log);
this.on("error", this.log.bind(this));
}

@@ -157,9 +156,11 @@ try {

} catch (e) {
this.emit("error", e);
currentLevel === 0 && this.emit("error", e);
throw e;
} finally {
this.running = false;
--this.level;
}
}
log(err) {
if (this.options.silent)
return;
const stack = (err.stack || err.toString()).split(EOL).map((item) => " " + item);

@@ -171,4 +172,6 @@ console.error(

mount(middleware2) {
if (middleware2 === null)
return;
if (middleware2 instanceof Chain2) {
this.chainPoints.push(Chain2.createPoint(middleware2));
this.chainPoints.push(Chain2.createSplitPoint(middleware2));
}

@@ -232,2 +235,5 @@ this.tokenList.push(middleware2);

var options = (fields, alias) => new ConsoleOptionMiddleware(fields, alias);
// src/define-config.ts
var defineConfig = (config) => config;
export {

@@ -242,2 +248,3 @@ ConsoleApp,

HelpMiddleware,
defineConfig,
options,

@@ -244,0 +251,0 @@ scriptName,

{
"name": "@aomex/console",
"version": "0.0.5",
"version": "0.0.6",
"description": "",

@@ -12,10 +12,6 @@ "type": "module",

},
"./config": {
"types": "./dist/cli/define-config.d.ts",
"import": "./dist/cli/define-config.js"
},
"./package.json": "./package.json"
},
"bin": {
"aomex": "dist/cli/bin.js"
"aomex": "dist/bin.js"
},

@@ -37,7 +33,8 @@ "publishConfig": {

"peerDependencies": {
"@aomex/core": "^0.0.5"
"@aomex/core": "^0.0.6"
},
"dependencies": {
"@aomex/helper": "^0.0.3",
"cosmiconfig": "^8.0.0",
"@aomex/utility": "^0.0.4",
"@aomex/file-parser": "^0.0.3",
"ts-node": "^10.9.1",
"yargs": "^17.6.2",

@@ -47,3 +44,3 @@ "yargs-parser": "^21.1.1"

"devDependencies": {
"@aomex/core": "^0.0.5",
"@aomex/core": "^0.0.6",
"@types/yargs": "^17.0.22",

@@ -50,0 +47,0 @@ "@types/yargs-parser": "^21.0.0",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc