@clerc/plugin-strict-flags 0.25.1 → 0.26.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.
package/dist/index.js CHANGED
@@ -1,23 +1 @@
1
- import { definePlugin } from '@clerc/core';
2
-
3
- const semanticArray = (arr) => {
4
- if (arr.length <= 1) {
5
- return arr[0];
6
- }
7
- return `${arr.slice(0, -1).join(", ")} and ${arr[arr.length - 1]}`;
8
- };
9
-
10
- const strictFlagsPlugin = () => definePlugin({
11
- setup: (cli) => {
12
- return cli.inspector((ctx, next) => {
13
- const keys = Object.keys(ctx.unknownFlags);
14
- if (!ctx.resolved || keys.length === 0) {
15
- next();
16
- } else {
17
- throw new Error(`Unexpected flag${keys.length > 1 ? "s" : ""}: ${semanticArray(keys)}`);
18
- }
19
- });
20
- }
21
- });
22
-
23
- export { strictFlagsPlugin };
1
+ import{definePlugin as l}from"@clerc/core";const o=n=>n.length<=1?n[0]:`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`,r=()=>l({setup:n=>n.inspector((t,s)=>{const e=Object.keys(t.unknownFlags);if(!t.resolved||e.length===0)s();else throw new Error(`Unexpected flag${e.length>1?"s":""}: ${o(e)}`)})});export{r as strictFlagsPlugin};
package/dist/index.mjs CHANGED
@@ -1,23 +1 @@
1
- import { definePlugin } from '@clerc/core';
2
-
3
- const semanticArray = (arr) => {
4
- if (arr.length <= 1) {
5
- return arr[0];
6
- }
7
- return `${arr.slice(0, -1).join(", ")} and ${arr[arr.length - 1]}`;
8
- };
9
-
10
- const strictFlagsPlugin = () => definePlugin({
11
- setup: (cli) => {
12
- return cli.inspector((ctx, next) => {
13
- const keys = Object.keys(ctx.unknownFlags);
14
- if (!ctx.resolved || keys.length === 0) {
15
- next();
16
- } else {
17
- throw new Error(`Unexpected flag${keys.length > 1 ? "s" : ""}: ${semanticArray(keys)}`);
18
- }
19
- });
20
- }
21
- });
22
-
23
- export { strictFlagsPlugin };
1
+ import{definePlugin as l}from"@clerc/core";const o=n=>n.length<=1?n[0]:`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`,r=()=>l({setup:n=>n.inspector((t,s)=>{const e=Object.keys(t.unknownFlags);if(!t.resolved||e.length===0)s();else throw new Error(`Unexpected flag${e.length>1?"s":""}: ${o(e)}`)})});export{r as strictFlagsPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/plugin-strict-flags",
3
- "version": "0.25.1",
3
+ "version": "0.26.0",
4
4
  "author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",
5
5
  "description": "Clerc plugin strict flags",
6
6
  "keywords": [
@@ -51,10 +51,11 @@
51
51
  "@clerc/core": "*"
52
52
  },
53
53
  "devDependencies": {
54
- "@clerc/core": "0.25.1"
54
+ "@clerc/core": "0.26.0",
55
+ "@clerc/utils": "0.26.0"
55
56
  },
56
57
  "scripts": {
57
- "build": "puild",
58
+ "build": "puild --minify",
58
59
  "watch": "puild --watch"
59
60
  }
60
61
  }