@clerc/plugin-strict-flags 1.1.0 → 1.2.0

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.
Files changed (2) hide show
  1. package/dist/index.mjs +1 -14
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1,14 +1 @@
1
- import { definePlugin } from "@clerc/core";
2
- import { joinWithAnd } from "@clerc/utils";
3
-
4
- //#region src/index.ts
5
- const strictFlagsPlugin = () => definePlugin({ setup: (cli) => {
6
- cli.interceptor(async (ctx, next) => {
7
- const keys = Object.keys(ctx.rawParsed.unknown);
8
- if (!ctx.command || keys.length === 0) await next();
9
- else throw keys.length > 1 ? /* @__PURE__ */ new Error(`Unexpected flags: ${joinWithAnd(keys)}`) : /* @__PURE__ */ new Error(`Unexpected flag: ${keys[0]}`);
10
- });
11
- } });
12
-
13
- //#endregion
14
- export { strictFlagsPlugin };
1
+ import{definePlugin as e}from"@clerc/core";import{joinWithAnd as t}from"@clerc/utils";const n=()=>e({setup:e=>{e.interceptor(async(e,n)=>{let r=Object.keys(e.rawParsed.unknown);if(!e.command||r.length===0)await n();else throw r.length>1?Error(`Unexpected flags: ${t(r)}`):Error(`Unexpected flag: ${r[0]}`)})}});export{n as strictFlagsPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/plugin-strict-flags",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5
5
  "type": "module",
6
6
  "description": "Clerc plugin strict flags",
@@ -38,10 +38,10 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@clerc/utils": "1.1.0"
41
+ "@clerc/utils": "1.2.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@clerc/core": "1.1.0"
44
+ "@clerc/core": "1.2.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@clerc/core": "*"