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

clipanion

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clipanion - npm Package Compare versions

Comparing version 4.0.0-rc.2 to 4.0.0-rc.3

6

lib/advanced/Cli.js

@@ -8,3 +8,3 @@ 'use strict';

var format = require('../format.js');
var platform = require('../platform');
var platform_node = require('../platform/node.js');
var advanced_Command = require('./Command.js');

@@ -226,3 +226,3 @@ var advanced_HelpCommand = require('./HelpCommand.js');

const activate = this.enableCapture
? (_b = platform.getCaptureActivator(context)) !== null && _b !== void 0 ? _b : noopCaptureActivator
? (_b = platform_node.getCaptureActivator(context)) !== null && _b !== void 0 ? _b : noopCaptureActivator
: noopCaptureActivator;

@@ -456,3 +456,3 @@ let exitCode;

stderr: process.stderr,
colorDepth: platform.getDefaultColorDepth(),
colorDepth: platform_node.getDefaultColorDepth(),
};

@@ -459,0 +459,0 @@ function noopCaptureActivator(fn) {

@@ -47,3 +47,2 @@ import { NodeType } from './constants';

selectedIndex: number | null;
partial: boolean;
tokens: Array<Token>;

@@ -86,3 +85,3 @@ };

to: number;
reducer: "setCandidateState" | "setSelectedIndex" | "setPartialIndex" | "pushBatch" | "pushBound" | "pushPath" | "pushPositional" | "pushExtra" | "pushExtraNoLimits" | "pushTrue" | "pushFalse" | "pushUndefined" | "pushStringValue" | "setStringValue" | "inhibateOptions" | "useHelp" | "setError" | "setOptionArityError" | ["setCandidateState" | "setSelectedIndex" | "setPartialIndex" | "pushBatch" | "pushBound" | "pushPath" | "pushPositional" | "pushExtra" | "pushExtraNoLimits" | "pushTrue" | "pushFalse" | "pushUndefined" | "pushStringValue" | "setStringValue" | "inhibateOptions" | "useHelp" | "setError" | "setOptionArityError"] | ["setCandidateState" | "setSelectedIndex" | "setPartialIndex" | "pushBatch" | "pushBound" | "pushPath" | "pushPositional" | "pushExtra" | "pushExtraNoLimits" | "pushTrue" | "pushFalse" | "pushUndefined" | "pushStringValue" | "setStringValue" | "inhibateOptions" | "useHelp" | "setError" | "setOptionArityError", Partial<RunState>] | ["setCandidateState" | "setSelectedIndex" | "setPartialIndex" | "pushBatch" | "pushBound" | "pushPath" | "pushPositional" | "pushExtra" | "pushExtraNoLimits" | "pushTrue" | "pushFalse" | "pushUndefined" | "pushStringValue" | "setStringValue" | "inhibateOptions" | "useHelp" | "setError" | "setOptionArityError", number] | ["setCandidateState" | "setSelectedIndex" | "setPartialIndex" | "pushBatch" | "pushBound" | "pushPath" | "pushPositional" | "pushExtra" | "pushExtraNoLimits" | "pushTrue" | "pushFalse" | "pushUndefined" | "pushStringValue" | "setStringValue" | "inhibateOptions" | "useHelp" | "setError" | "setOptionArityError", Map<string, string>] | ["setCandidateState" | "setSelectedIndex" | "setPartialIndex" | "pushBatch" | "pushBound" | "pushPath" | "pushPositional" | "pushExtra" | "pushExtraNoLimits" | "pushTrue" | "pushFalse" | "pushUndefined" | "pushStringValue" | "setStringValue" | "inhibateOptions" | "useHelp" | "setError" | "setOptionArityError", string] | undefined;
reducer: "setCandidateState" | "setSelectedIndex" | "pushBatch" | "pushBound" | "pushPath" | "pushPositional" | "pushExtra" | "pushExtraNoLimits" | "pushTrue" | "pushFalse" | "pushUndefined" | "pushStringValue" | "setStringValue" | "inhibateOptions" | "useHelp" | "setError" | "setOptionArityError" | ["setCandidateState" | "setSelectedIndex" | "pushBatch" | "pushBound" | "pushPath" | "pushPositional" | "pushExtra" | "pushExtraNoLimits" | "pushTrue" | "pushFalse" | "pushUndefined" | "pushStringValue" | "setStringValue" | "inhibateOptions" | "useHelp" | "setError" | "setOptionArityError"] | ["setCandidateState" | "setSelectedIndex" | "pushBatch" | "pushBound" | "pushPath" | "pushPositional" | "pushExtra" | "pushExtraNoLimits" | "pushTrue" | "pushFalse" | "pushUndefined" | "pushStringValue" | "setStringValue" | "inhibateOptions" | "useHelp" | "setError" | "setOptionArityError", Partial<RunState>] | ["setCandidateState" | "setSelectedIndex" | "pushBatch" | "pushBound" | "pushPath" | "pushPositional" | "pushExtra" | "pushExtraNoLimits" | "pushTrue" | "pushFalse" | "pushUndefined" | "pushStringValue" | "setStringValue" | "inhibateOptions" | "useHelp" | "setError" | "setOptionArityError", number] | ["setCandidateState" | "setSelectedIndex" | "pushBatch" | "pushBound" | "pushPath" | "pushPositional" | "pushExtra" | "pushExtraNoLimits" | "pushTrue" | "pushFalse" | "pushUndefined" | "pushStringValue" | "setStringValue" | "inhibateOptions" | "useHelp" | "setError" | "setOptionArityError", Map<string, string>] | ["setCandidateState" | "setSelectedIndex" | "pushBatch" | "pushBound" | "pushPath" | "pushPositional" | "pushExtra" | "pushExtraNoLimits" | "pushTrue" | "pushFalse" | "pushUndefined" | "pushStringValue" | "setStringValue" | "inhibateOptions" | "useHelp" | "setError" | "setOptionArityError", string] | undefined;
};

@@ -134,3 +133,2 @@ export declare function cloneNode(input: Node, offset?: number): Node;

selectedIndex: number | null;
partial: boolean;
tokens: Array<Token>;

@@ -154,24 +152,4 @@ };

remainder: string | null;
partial: boolean;
tokens: Array<Token>;
};
setPartialIndex: (state: RunState, segment: string, segmentIndex: number, index: number) => {
selectedIndex: number;
partial: boolean;
candidateUsage: string | null;
requiredOptions: Array<Array<string>>;
errorMessage: string | null;
ignoreOptions: boolean;
options: Array<{
name: string;
value: any;
}>;
path: Array<string>;
positionals: Array<{
value: string;
extra: boolean | typeof NoLimits;
}>;
remainder: string | null;
tokens: Array<Token>;
};
pushBatch: (state: RunState, segment: string, segmentIndex: number, names: Map<string, string>) => {

@@ -194,3 +172,2 @@ options: {

selectedIndex: number | null;
partial: boolean;
};

@@ -214,3 +191,2 @@ pushBound: (state: RunState, segment: string, segmentIndex: number) => {

selectedIndex: number | null;
partial: boolean;
};

@@ -234,3 +210,2 @@ pushPath: (state: RunState, segment: string, segmentIndex: number) => {

selectedIndex: number | null;
partial: boolean;
};

@@ -254,3 +229,2 @@ pushPositional: (state: RunState, segment: string, segmentIndex: number) => {

selectedIndex: number | null;
partial: boolean;
};

@@ -274,3 +248,2 @@ pushExtra: (state: RunState, segment: string, segmentIndex: number) => {

selectedIndex: number | null;
partial: boolean;
};

@@ -294,3 +267,2 @@ pushExtraNoLimits: (state: RunState, segment: string, segmentIndex: number) => {

selectedIndex: number | null;
partial: boolean;
};

@@ -314,3 +286,2 @@ pushTrue: (state: RunState, segment: string, segmentIndex: number, name: string) => {

selectedIndex: number | null;
partial: boolean;
};

@@ -334,3 +305,2 @@ pushFalse: (state: RunState, segment: string, segmentIndex: number, name: string) => {

selectedIndex: number | null;
partial: boolean;
};

@@ -354,3 +324,2 @@ pushUndefined: (state: RunState, segment: string, segmentIndex: number, name: string) => {

selectedIndex: number | null;
partial: boolean;
};

@@ -374,3 +343,2 @@ pushStringValue: (state: RunState, segment: string, segmentIndex: number) => {

selectedIndex: number | null;
partial: boolean;
};

@@ -394,3 +362,2 @@ setStringValue: (state: RunState, segment: string, segmentIndex: number) => {

selectedIndex: number | null;
partial: boolean;
};

@@ -413,3 +380,2 @@ inhibateOptions: (state: RunState) => {

selectedIndex: number | null;
partial: boolean;
tokens: Array<Token>;

@@ -433,3 +399,2 @@ };

selectedIndex: number | null;
partial: boolean;
tokens: Array<Token>;

@@ -453,3 +418,2 @@ };

selectedIndex: number | null;
partial: boolean;
tokens: Array<Token>;

@@ -473,3 +437,2 @@ };

selectedIndex: number | null;
partial: boolean;
tokens: Array<Token>;

@@ -476,0 +439,0 @@ };

@@ -24,3 +24,2 @@ 'use strict';

selectedIndex: constants.HELP_COMMAND_INDEX,
partial: false,
tokens: [],

@@ -119,3 +118,2 @@ };

selectedIndex: null,
partial: false,
tokens: [],

@@ -233,10 +231,5 @@ },

function selectBestState(input, states) {
let terminalStates = states.filter(state => {
const terminalStates = states.filter(state => {
return state.selectedIndex !== null;
});
const noPartialStates = terminalStates.filter(state => {
return !state.partial;
});
if (noPartialStates.length > 0)
terminalStates = noPartialStates;
if (terminalStates.length === 0)

@@ -402,5 +395,2 @@ throw new Error();

},
setPartialIndex: (state, segment, segmentIndex, index) => {
return { ...state, selectedIndex: index, partial: true };
},
pushBatch: (state, segment, segmentIndex, names) => {

@@ -626,2 +616,10 @@ const options = state.options.slice();

lastPathNode = nextPathNode;
if (t + 1 < path.length) {
// Allow to pass `-h` (without anything after it) after each part of a path.
// Note that we do not do this for the last part, otherwise there would be
// some redundancy with the `useHelp` attached later.
const helpNode = injectNode(machine, makeNode());
registerDynamic(machine, lastPathNode, `isHelp`, helpNode, [`useHelp`, this.cliIndex]);
registerStatic(machine, helpNode, constants.SpecialToken.EndOfInput, constants.NodeType.SuccessNode, [`setSelectedIndex`, constants.HELP_COMMAND_INDEX]);
}
}

@@ -637,3 +635,3 @@ if (this.arity.leading.length > 0 || !this.arity.proxy) {

registerStatic(machine, lastPathNode, constants.SpecialToken.EndOfInput, constants.NodeType.ErrorNode, [`setError`, `Not enough positional arguments`]);
registerStatic(machine, lastPathNode, constants.SpecialToken.EndOfPartialInput, constants.NodeType.SuccessNode, [`setPartialIndex`, this.cliIndex]);
registerStatic(machine, lastPathNode, constants.SpecialToken.EndOfPartialInput, constants.NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);
}

@@ -647,3 +645,3 @@ let lastLeadingNode = lastPathNode;

registerStatic(machine, nextLeadingNode, constants.SpecialToken.EndOfInput, constants.NodeType.ErrorNode, [`setError`, `Not enough positional arguments`]);
registerStatic(machine, nextLeadingNode, constants.SpecialToken.EndOfPartialInput, constants.NodeType.SuccessNode, [`setPartialIndex`, this.cliIndex]);
registerStatic(machine, nextLeadingNode, constants.SpecialToken.EndOfPartialInput, constants.NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);
}

@@ -679,3 +677,3 @@ registerDynamic(machine, lastLeadingNode, `isNotOptionLike`, nextLeadingNode, `pushPositional`);

registerStatic(machine, lastExtraNode, constants.SpecialToken.EndOfInput, constants.NodeType.ErrorNode, [`setError`, `Not enough positional arguments`]);
registerStatic(machine, lastExtraNode, constants.SpecialToken.EndOfPartialInput, constants.NodeType.SuccessNode, [`setPartialIndex`, this.cliIndex]);
registerStatic(machine, lastExtraNode, constants.SpecialToken.EndOfPartialInput, constants.NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);
}

@@ -689,3 +687,3 @@ let lastTrailingNode = lastExtraNode;

registerStatic(machine, nextTrailingNode, constants.SpecialToken.EndOfInput, constants.NodeType.ErrorNode, [`setError`, `Not enough positional arguments`]);
registerStatic(machine, nextTrailingNode, constants.SpecialToken.EndOfPartialInput, constants.NodeType.SuccessNode, [`setPartialIndex`, this.cliIndex]);
registerStatic(machine, nextTrailingNode, constants.SpecialToken.EndOfPartialInput, constants.NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);
}

@@ -692,0 +690,0 @@ registerDynamic(machine, lastTrailingNode, `isNotOptionLike`, nextTrailingNode, `pushPositional`);

@@ -15,3 +15,3 @@ {

],
"version": "4.0.0-rc.2",
"version": "4.0.0-rc.3",
"main": "lib/advanced/index",

@@ -36,6 +36,4 @@ "license": "MIT",

"@rollup/plugin-typescript": "^6.1.0",
"@types/chai": "^4.2.11",
"@types/chai-as-promised": "^7.1.2",
"@types/jest": "^29.5.9",
"@types/lodash": "^4.14.179",
"@types/mocha": "^7.0.2",
"@types/node": "^14.0.13",

@@ -46,14 +44,12 @@ "@typescript-eslint/eslint-plugin": "^5.43.0",

"@yarnpkg/eslint-config": "yarnpkg/berry#workspace=@yarnpkg/eslint-config",
"@yarnpkg/fslib": "^2.3.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"eslint": "^7.16.0",
"@yarnpkg/fslib": "^3.0.1",
"eslint": "^8.54.0",
"eslint-plugin-arca": "^0.10.0",
"eslint-plugin-react": "^7.21.5",
"get-stream": "^5.1.0",
"jest": "^29.7.0",
"lodash": "^4.17.21",
"mocha": "^8.0.1",
"rollup": "^2.16.1",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-multi-input": "^1.3.1",
"ts-jest": "^29.1.1",
"ts-node": "^8.10.2",

@@ -66,8 +62,13 @@ "tslib": "^2.0.0",

"postpack": "rm -rf lib",
"test": "FORCE_COLOR=1 mocha --require ts-node/register --extension ts tests/specs",
"lint": "eslint --max-warnings 0 .",
"test": "jest",
"demo": "node --require ts-node/register demos/advanced.ts"
},
"publishConfig": {
"main": "lib/advanced/index"
"main": "lib/advanced/index",
"module": "lib/advanced/index.mjs",
"browser": {
"./lib/platform/node.js": "./lib/platform/browser.js",
"./lib/platform/node.mjs": "./lib/platform/browser.mjs"
}
},

@@ -77,3 +78,8 @@ "files": [

],
"packageManager": "yarn@3.3.0"
"packageManager": "yarn@4.0.2",
"browser": {
"./lib/platform/node.js": "./lib/platform/browser.js",
"./lib/platform/node.mjs": "./lib/platform/browser.mjs"
},
"module": "lib/advanced/index.mjs"
}

Sorry, the diff of this file is not supported yet

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