keep-a-changelog 2.0.1 → 2.2.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/CHANGELOG.md +28 -2
- package/README.md +21 -6
- package/esm/_dnt.polyfills.js +15 -0
- package/esm/bin.js +9 -4
- package/esm/deps/deno.land/std@0.173.0/_util/asserts.js +21 -0
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/_util/os.js +4 -1
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/flags/mod.js +145 -36
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_constants.js +1 -0
- package/esm/deps/deno.land/std@0.173.0/path/_interface.js +3 -0
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_util.js +1 -0
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/common.js +1 -1
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/glob.js +1 -1
- package/esm/deps/deno.land/std@0.173.0/path/mod.js +32 -0
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/posix.js +23 -16
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/separator.js +1 -1
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/win32.js +20 -15
- package/esm/deps/{deno_land/x/semver_v1.4.0 → deno.land/std@0.173.0/semver}/mod.js +227 -334
- package/esm/deps/{deno_land/std_0.51.0 → deno.land/std@0.51.0}/fs/eol.js +0 -0
- package/esm/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/ini.js +1 -1
- package/esm/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/mod.js +0 -0
- package/esm/mod.js +1 -0
- package/esm/src/Change.js +15 -15
- package/esm/src/Changelog.js +9 -1
- package/esm/src/Release.js +21 -4
- package/esm/src/deps.js +1 -1
- package/esm/src/parser.js +24 -5
- package/esm/test/changelog.custom.type.md +0 -1
- package/esm/test/changelog.expected.linted.md +208 -0
- package/esm/test/changelog.expected.md +6 -4
- package/esm/test/changelog.md +7 -3
- package/esm/test/empty.expected.md +0 -1
- package/package.json +13 -8
- package/script/_dnt.polyfills.js +16 -0
- package/script/_dnt.shims.js +66 -0
- package/script/bin.js +144 -0
- package/script/deps/deno.land/std@0.173.0/_util/asserts.js +27 -0
- package/script/deps/deno.land/std@0.173.0/_util/os.js +44 -0
- package/script/deps/deno.land/std@0.173.0/flags/mod.js +368 -0
- package/script/deps/deno.land/std@0.173.0/path/_constants.js +49 -0
- package/script/deps/deno.land/std@0.173.0/path/_interface.js +4 -0
- package/script/deps/deno.land/std@0.173.0/path/_util.js +125 -0
- package/script/deps/deno.land/std@0.173.0/path/common.js +40 -0
- package/script/deps/deno.land/std@0.173.0/path/glob.js +391 -0
- package/script/deps/deno.land/std@0.173.0/path/mod.js +63 -0
- package/script/deps/deno.land/std@0.173.0/path/posix.js +539 -0
- package/script/deps/deno.land/std@0.173.0/path/separator.js +8 -0
- package/script/deps/deno.land/std@0.173.0/path/win32.js +1007 -0
- package/script/deps/deno.land/std@0.173.0/semver/mod.js +1458 -0
- package/script/deps/deno.land/std@0.51.0/fs/eol.js +34 -0
- package/script/deps/deno.land/x/ini@v2.1.0/ini.js +256 -0
- package/script/deps/deno.land/x/ini@v2.1.0/mod.js +17 -0
- package/script/mod.js +15 -0
- package/{umd → script}/package.json +0 -0
- package/script/src/Change.js +51 -0
- package/script/src/Changelog.js +148 -0
- package/script/src/Release.js +227 -0
- package/script/src/deps.js +9 -0
- package/script/src/parser.js +184 -0
- package/{umd → script}/test/changelog.custom.type.md +0 -1
- package/script/test/changelog.expected.linted.md +208 -0
- package/{umd → script}/test/changelog.expected.md +6 -4
- package/{umd → script}/test/changelog.md +7 -3
- package/{umd → script}/test/empty.expected.md +0 -1
- package/types/_dnt.polyfills.d.ts +11 -0
- package/types/_dnt.shims.d.ts +0 -4
- package/types/bin.d.ts +1 -1
- package/types/deps/deno.land/std@0.173.0/_util/asserts.d.ts +10 -0
- package/types/deps/deno.land/std@0.173.0/_util/os.d.ts +4 -0
- package/types/deps/deno.land/std@0.173.0/flags/mod.d.ts +166 -0
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_constants.d.ts +0 -0
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_interface.d.ts +1 -1
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_util.d.ts +0 -0
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/common.d.ts +0 -0
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/glob.d.ts +10 -5
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/mod.d.ts +0 -0
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/posix.d.ts +9 -5
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/separator.d.ts +0 -0
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/win32.d.ts +7 -5
- package/types/deps/deno.land/std@0.173.0/semver/mod.d.ts +398 -0
- package/types/deps/{deno_land/std_0.51.0 → deno.land/std@0.51.0}/fs/eol.d.ts +0 -0
- package/types/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/ini.d.ts +0 -0
- package/types/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/mod.d.ts +0 -0
- package/types/mod.d.ts +1 -0
- package/types/src/Changelog.d.ts +1 -0
- package/types/src/Release.d.ts +2 -0
- package/types/src/deps.d.ts +1 -1
- package/esm/deps/deno_land/std_0.120.0/_util/assert.js +0 -13
- package/esm/deps/deno_land/std_0.120.0/path/_interface.js +0 -3
- package/esm/deps/deno_land/std_0.120.0/path/mod.js +0 -14
- package/types/deps/deno_land/std_0.120.0/_util/assert.d.ts +0 -5
- package/types/deps/deno_land/std_0.120.0/_util/os.d.ts +0 -3
- package/types/deps/deno_land/std_0.120.0/flags/mod.d.ts +0 -50
- package/types/deps/deno_land/x/semver_v1.4.0/mod.d.ts +0 -116
- package/umd/_dnt.shims.js +0 -76
- package/umd/bin.js +0 -145
- package/umd/deps/deno_land/std_0.120.0/_util/assert.js +0 -28
- package/umd/deps/deno_land/std_0.120.0/_util/os.js +0 -47
- package/umd/deps/deno_land/std_0.120.0/flags/mod.js +0 -269
- package/umd/deps/deno_land/std_0.120.0/path/_constants.js +0 -58
- package/umd/deps/deno_land/std_0.120.0/path/_interface.js +0 -14
- package/umd/deps/deno_land/std_0.120.0/path/_util.js +0 -134
- package/umd/deps/deno_land/std_0.120.0/path/common.js +0 -50
- package/umd/deps/deno_land/std_0.120.0/path/glob.js +0 -397
- package/umd/deps/deno_land/std_0.120.0/path/mod.js +0 -51
- package/umd/deps/deno_land/std_0.120.0/path/posix.js +0 -538
- package/umd/deps/deno_land/std_0.120.0/path/separator.js +0 -18
- package/umd/deps/deno_land/std_0.120.0/path/win32.js +0 -1008
- package/umd/deps/deno_land/std_0.51.0/fs/eol.js +0 -44
- package/umd/deps/deno_land/x/ini_v2.1.0/ini.js +0 -262
- package/umd/deps/deno_land/x/ini_v2.1.0/mod.js +0 -23
- package/umd/deps/deno_land/x/semver_v1.4.0/mod.js +0 -1578
- package/umd/mod.js +0 -24
- package/umd/src/Change.js +0 -61
- package/umd/src/Changelog.js +0 -150
- package/umd/src/Release.js +0 -220
- package/umd/src/deps.js +0 -19
- package/umd/src/parser.js +0 -175
package/types/_dnt.shims.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { Deno } from "@deno/shim-deno";
|
|
2
2
|
export { Deno } from "@deno/shim-deno";
|
|
3
|
-
declare const dntGlobals: {
|
|
4
|
-
Deno: typeof Deno;
|
|
5
|
-
};
|
|
6
3
|
export declare const dntGlobalThis: Omit<typeof globalThis, "Deno"> & {
|
|
7
4
|
Deno: typeof Deno;
|
|
8
5
|
};
|
|
9
|
-
export declare type dntGlobalThisType = Omit<typeof dntGlobals, keyof typeof dntGlobals> & typeof dntGlobals & {};
|
package/types/bin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import "./_dnt.polyfills.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All internal non-test code, that is files that do not have `test` or `bench` in the name, must use the assertion functions within `_utils/asserts.ts` and not `testing/asserts.ts`. This is to create a separation of concerns between internal and testing assertions.
|
|
3
|
+
*/
|
|
4
|
+
export declare class DenoStdInternalError extends Error {
|
|
5
|
+
constructor(message: string);
|
|
6
|
+
}
|
|
7
|
+
/** Make an assertion, if not `true`, then throw. */
|
|
8
|
+
export declare function assert(expr: unknown, msg?: string): asserts expr;
|
|
9
|
+
/** Use this to assert unreachable code. */
|
|
10
|
+
export declare function unreachable(): never;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/** Combines recursively all intersection types and returns a new single type. */
|
|
2
|
+
type Id<TRecord> = TRecord extends Record<string, unknown> ? TRecord extends infer InferredRecord ? {
|
|
3
|
+
[Key in keyof InferredRecord]: Id<InferredRecord[Key]>;
|
|
4
|
+
} : never : TRecord;
|
|
5
|
+
/** Converts a union type `A | B | C` into an intersection type `A & B & C`. */
|
|
6
|
+
type UnionToIntersection<TValue> = (TValue extends unknown ? (args: TValue) => unknown : never) extends (args: infer R) => unknown ? R extends Record<string, unknown> ? R : never : never;
|
|
7
|
+
type BooleanType = boolean | string | undefined;
|
|
8
|
+
type StringType = string | undefined;
|
|
9
|
+
type ArgType = StringType | BooleanType;
|
|
10
|
+
type Collectable = string | undefined;
|
|
11
|
+
type Negatable = string | undefined;
|
|
12
|
+
type UseTypes<TBooleans extends BooleanType, TStrings extends StringType, TCollectable extends Collectable> = undefined extends ((false extends TBooleans ? undefined : TBooleans) & TCollectable & TStrings) ? false : true;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a record with all available flags with the corresponding type and
|
|
15
|
+
* default type.
|
|
16
|
+
*/
|
|
17
|
+
type Values<TBooleans extends BooleanType, TStrings extends StringType, TCollectable extends Collectable, TNegatable extends Negatable, TDefault extends Record<string, unknown> | undefined, TAliases extends Aliases | undefined> = UseTypes<TBooleans, TStrings, TCollectable> extends true ? Record<string, unknown> & AddAliases<SpreadDefaults<CollectValues<TStrings, string, TCollectable, TNegatable> & RecursiveRequired<CollectValues<TBooleans, boolean, TCollectable>> & CollectUnknownValues<TBooleans, TStrings, TCollectable, TNegatable>, DedotRecord<TDefault>>, TAliases> : Record<string, any>;
|
|
18
|
+
type Aliases<TArgNames = string, TAliasNames extends string = string> = Partial<Record<Extract<TArgNames, string>, TAliasNames | ReadonlyArray<TAliasNames>>>;
|
|
19
|
+
type AddAliases<TArgs, TAliases extends Aliases | undefined> = {
|
|
20
|
+
[TArgName in keyof TArgs as AliasNames<TArgName, TAliases>]: TArgs[TArgName];
|
|
21
|
+
};
|
|
22
|
+
type AliasNames<TArgName, TAliases extends Aliases | undefined> = TArgName extends keyof TAliases ? string extends TAliases[TArgName] ? TArgName : TAliases[TArgName] extends string ? TArgName | TAliases[TArgName] : TAliases[TArgName] extends Array<string> ? TArgName | TAliases[TArgName][number] : TArgName : TArgName;
|
|
23
|
+
/**
|
|
24
|
+
* Spreads all default values of Record `TDefaults` into Record `TArgs`
|
|
25
|
+
* and makes default values required.
|
|
26
|
+
*
|
|
27
|
+
* **Example:**
|
|
28
|
+
* `SpreadValues<{ foo?: boolean, bar?: number }, { foo: number }>`
|
|
29
|
+
*
|
|
30
|
+
* **Result:** `{ foo: boolean | number, bar?: number }`
|
|
31
|
+
*/
|
|
32
|
+
type SpreadDefaults<TArgs, TDefaults> = TDefaults extends undefined ? TArgs : TArgs extends Record<string, unknown> ? Omit<TArgs, keyof TDefaults> & {
|
|
33
|
+
[Default in keyof TDefaults]: Default extends keyof TArgs ? (TArgs[Default] & TDefaults[Default] | TDefaults[Default]) extends Record<string, unknown> ? NonNullable<SpreadDefaults<TArgs[Default], TDefaults[Default]>> : TDefaults[Default] | NonNullable<TArgs[Default]> : unknown;
|
|
34
|
+
} : never;
|
|
35
|
+
/**
|
|
36
|
+
* Defines the Record for the `default` option to add
|
|
37
|
+
* auto-suggestion support for IDE's.
|
|
38
|
+
*/
|
|
39
|
+
type Defaults<TBooleans extends BooleanType, TStrings extends StringType> = Id<UnionToIntersection<Record<string, unknown> & MapTypes<TStrings, unknown> & MapTypes<TBooleans, unknown> & MapDefaults<TBooleans> & MapDefaults<TStrings>>>;
|
|
40
|
+
type MapDefaults<TArgNames extends ArgType> = Partial<Record<TArgNames extends string ? TArgNames : string, unknown>>;
|
|
41
|
+
type RecursiveRequired<TRecord> = TRecord extends Record<string, unknown> ? {
|
|
42
|
+
[Key in keyof TRecord]-?: RecursiveRequired<TRecord[Key]>;
|
|
43
|
+
} : TRecord;
|
|
44
|
+
/** Same as `MapTypes` but also supports collectable options. */
|
|
45
|
+
type CollectValues<TArgNames extends ArgType, TType, TCollectable extends Collectable, TNegatable extends Negatable = undefined> = UnionToIntersection<Extract<TArgNames, TCollectable> extends string ? (Exclude<TArgNames, TCollectable> extends never ? Record<never, never> : MapTypes<Exclude<TArgNames, TCollectable>, TType, TNegatable>) & (Extract<TArgNames, TCollectable> extends never ? Record<never, never> : RecursiveRequired<MapTypes<Extract<TArgNames, TCollectable>, Array<TType>, TNegatable>>) : MapTypes<TArgNames, TType, TNegatable>>;
|
|
46
|
+
/** Same as `Record` but also supports dotted and negatable options. */
|
|
47
|
+
type MapTypes<TArgNames extends ArgType, TType, TNegatable extends Negatable = undefined> = undefined extends TArgNames ? Record<never, never> : TArgNames extends `${infer Name}.${infer Rest}` ? {
|
|
48
|
+
[Key in Name]?: MapTypes<Rest, TType, TNegatable extends `${Name}.${infer Negate}` ? Negate : undefined>;
|
|
49
|
+
} : TArgNames extends string ? Partial<Record<TArgNames, TNegatable extends TArgNames ? TType | false : TType>> : Record<never, never>;
|
|
50
|
+
type CollectUnknownValues<TBooleans extends BooleanType, TStrings extends StringType, TCollectable extends Collectable, TNegatable extends Negatable> = UnionToIntersection<TCollectable extends TBooleans & TStrings ? Record<never, never> : DedotRecord<Record<Exclude<Extract<Exclude<TCollectable, TNegatable>, string>, Extract<TStrings | TBooleans, string>>, Array<unknown>> & Record<Exclude<Extract<Extract<TCollectable, TNegatable>, string>, Extract<TStrings | TBooleans, string>>, Array<unknown> | false>>>;
|
|
51
|
+
/** Converts `{ "foo.bar.baz": unknown }` into `{ foo: { bar: { baz: unknown } } }`. */
|
|
52
|
+
type DedotRecord<TRecord> = Record<string, unknown> extends TRecord ? TRecord : TRecord extends Record<string, unknown> ? UnionToIntersection<ValueOf<{
|
|
53
|
+
[Key in keyof TRecord]: Key extends string ? Dedot<Key, TRecord[Key]> : never;
|
|
54
|
+
}>> : TRecord;
|
|
55
|
+
type Dedot<TKey extends string, TValue> = TKey extends `${infer Name}.${infer Rest}` ? {
|
|
56
|
+
[Key in Name]: Dedot<Rest, TValue>;
|
|
57
|
+
} : {
|
|
58
|
+
[Key in TKey]: TValue;
|
|
59
|
+
};
|
|
60
|
+
type ValueOf<TValue> = TValue[keyof TValue];
|
|
61
|
+
/** The value returned from `parse`. */
|
|
62
|
+
export type Args<TArgs extends Record<string, unknown> = Record<string, any>, TDoubleDash extends boolean | undefined = undefined> = Id<TArgs & {
|
|
63
|
+
/** Contains all the arguments that didn't have an option associated with
|
|
64
|
+
* them. */
|
|
65
|
+
_: Array<string | number>;
|
|
66
|
+
} & (boolean extends TDoubleDash ? DoubleDash : true extends TDoubleDash ? Required<DoubleDash> : Record<never, never>)>;
|
|
67
|
+
type DoubleDash = {
|
|
68
|
+
/** Contains all the arguments that appear after the double dash: "--". */
|
|
69
|
+
"--"?: Array<string>;
|
|
70
|
+
};
|
|
71
|
+
/** The options for the `parse` call. */
|
|
72
|
+
export interface ParseOptions<TBooleans extends BooleanType = BooleanType, TStrings extends StringType = StringType, TCollectable extends Collectable = Collectable, TNegatable extends Negatable = Negatable, TDefault extends Record<string, unknown> | undefined = Record<string, unknown> | undefined, TAliases extends Aliases | undefined = Aliases | undefined, TDoubleDash extends boolean | undefined = boolean | undefined> {
|
|
73
|
+
/**
|
|
74
|
+
* When `true`, populate the result `_` with everything before the `--` and
|
|
75
|
+
* the result `['--']` with everything after the `--`.
|
|
76
|
+
*
|
|
77
|
+
* @default {false}
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* // $ deno run example.ts -- a arg1
|
|
82
|
+
* import { parse } from "https://deno.land/std@$STD_VERSION/flags/mod.ts";
|
|
83
|
+
* console.dir(parse(Deno.args, { "--": false }));
|
|
84
|
+
* // output: { _: [ "a", "arg1" ] }
|
|
85
|
+
* console.dir(parse(Deno.args, { "--": true }));
|
|
86
|
+
* // output: { _: [], --: [ "a", "arg1" ] }
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
"--"?: TDoubleDash;
|
|
90
|
+
/**
|
|
91
|
+
* An object mapping string names to strings or arrays of string argument
|
|
92
|
+
* names to use as aliases.
|
|
93
|
+
*/
|
|
94
|
+
alias?: TAliases;
|
|
95
|
+
/**
|
|
96
|
+
* A boolean, string or array of strings to always treat as booleans. If
|
|
97
|
+
* `true` will treat all double hyphenated arguments without equal signs as
|
|
98
|
+
* `boolean` (e.g. affects `--foo`, not `-f` or `--foo=bar`).
|
|
99
|
+
* All `boolean` arguments will be set to `false` by default.
|
|
100
|
+
*/
|
|
101
|
+
boolean?: TBooleans | ReadonlyArray<Extract<TBooleans, string>>;
|
|
102
|
+
/** An object mapping string argument names to default values. */
|
|
103
|
+
default?: TDefault & Defaults<TBooleans, TStrings>;
|
|
104
|
+
/**
|
|
105
|
+
* When `true`, populate the result `_` with everything after the first
|
|
106
|
+
* non-option.
|
|
107
|
+
*/
|
|
108
|
+
stopEarly?: boolean;
|
|
109
|
+
/** A string or array of strings argument names to always treat as strings. */
|
|
110
|
+
string?: TStrings | ReadonlyArray<Extract<TStrings, string>>;
|
|
111
|
+
/**
|
|
112
|
+
* A string or array of strings argument names to always treat as arrays.
|
|
113
|
+
* Collectable options can be used multiple times. All values will be
|
|
114
|
+
* collected into one array. If a non-collectable option is used multiple
|
|
115
|
+
* times, the last value is used.
|
|
116
|
+
* All Collectable arguments will be set to `[]` by default.
|
|
117
|
+
*/
|
|
118
|
+
collect?: TCollectable | ReadonlyArray<Extract<TCollectable, string>>;
|
|
119
|
+
/**
|
|
120
|
+
* A string or array of strings argument names which can be negated
|
|
121
|
+
* by prefixing them with `--no-`, like `--no-config`.
|
|
122
|
+
*/
|
|
123
|
+
negatable?: TNegatable | ReadonlyArray<Extract<TNegatable, string>>;
|
|
124
|
+
/**
|
|
125
|
+
* A function which is invoked with a command line parameter not defined in
|
|
126
|
+
* the `options` configuration object. If the function returns `false`, the
|
|
127
|
+
* unknown option is not added to `parsedArgs`.
|
|
128
|
+
*/
|
|
129
|
+
unknown?: (arg: string, key?: string, value?: unknown) => unknown;
|
|
130
|
+
}
|
|
131
|
+
/** Take a set of command line arguments, optionally with a set of options, and
|
|
132
|
+
* return an object representing the flags found in the passed arguments.
|
|
133
|
+
*
|
|
134
|
+
* By default, any arguments starting with `-` or `--` are considered boolean
|
|
135
|
+
* flags. If the argument name is followed by an equal sign (`=`) it is
|
|
136
|
+
* considered a key-value pair. Any arguments which could not be parsed are
|
|
137
|
+
* available in the `_` property of the returned object.
|
|
138
|
+
*
|
|
139
|
+
* By default, the flags module tries to determine the type of all arguments
|
|
140
|
+
* automatically and the return type of the `parse` method will have an index
|
|
141
|
+
* signature with `any` as value (`{ [x: string]: any }`).
|
|
142
|
+
*
|
|
143
|
+
* If the `string`, `boolean` or `collect` option is set, the return value of
|
|
144
|
+
* the `parse` method will be fully typed and the index signature of the return
|
|
145
|
+
* type will change to `{ [x: string]: unknown }`.
|
|
146
|
+
*
|
|
147
|
+
* Any arguments after `'--'` will not be parsed and will end up in `parsedArgs._`.
|
|
148
|
+
*
|
|
149
|
+
* Numeric-looking arguments will be returned as numbers unless `options.string`
|
|
150
|
+
* or `options.boolean` is set for that argument name.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* import { parse } from "https://deno.land/std@$STD_VERSION/flags/mod.ts";
|
|
155
|
+
* const parsedArgs = parse(Deno.args);
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* import { parse } from "https://deno.land/std@$STD_VERSION/flags/mod.ts";
|
|
161
|
+
* const parsedArgs = parse(["--foo", "--bar=baz", "./quux.txt"]);
|
|
162
|
+
* // parsedArgs: { foo: true, bar: "baz", _: ["./quux.txt"] }
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export declare function parse<TArgs extends Values<TBooleans, TStrings, TCollectable, TNegatable, TDefaults, TAliases>, TDoubleDash extends boolean | undefined = undefined, TBooleans extends BooleanType = undefined, TStrings extends StringType = undefined, TCollectable extends Collectable = undefined, TNegatable extends Negatable = undefined, TDefaults extends Record<string, unknown> | undefined = undefined, TAliases extends Aliases<TAliasArgNames, TAliasNames> | undefined = undefined, TAliasArgNames extends string = string, TAliasNames extends string = string>(args: string[], { "--": doubleDash, alias, boolean, default: defaults, stopEarly, string, collect, negatable, unknown, }?: ParseOptions<TBooleans, TStrings, TCollectable, TNegatable, TDefaults, TAliases, TDoubleDash>): Args<TArgs, TDoubleDash>;
|
|
166
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import type { OSType } from "../_util/os.js";
|
|
2
2
|
export interface GlobOptions {
|
|
3
3
|
/** Extended glob syntax.
|
|
4
|
-
* See https://www.linuxjournal.com/content/bash-extended-globbing.
|
|
5
|
-
*
|
|
4
|
+
* See https://www.linuxjournal.com/content/bash-extended-globbing.
|
|
5
|
+
*
|
|
6
|
+
* @default {true}
|
|
7
|
+
*/
|
|
6
8
|
extended?: boolean;
|
|
7
9
|
/** Globstar syntax.
|
|
8
10
|
* See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option.
|
|
9
|
-
* If false, `**` is treated like `*`.
|
|
11
|
+
* If false, `**` is treated like `*`.
|
|
12
|
+
*
|
|
13
|
+
* @default {true}
|
|
14
|
+
*/
|
|
10
15
|
globstar?: boolean;
|
|
11
|
-
/** Whether globstar should be case
|
|
16
|
+
/** Whether globstar should be case-insensitive. */
|
|
12
17
|
caseInsensitive?: boolean;
|
|
13
18
|
/** Operating system. Defaults to the native OS. */
|
|
14
19
|
os?: OSType;
|
|
15
20
|
}
|
|
16
|
-
export
|
|
21
|
+
export type GlobToRegExpOptions = GlobOptions;
|
|
17
22
|
/** Convert a glob string to a regular expression.
|
|
18
23
|
*
|
|
19
24
|
* Tries to match bash glob expansion as closely as possible.
|
|
File without changes
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import type { FormatInputPathObject, ParsedPath } from "./_interface.js";
|
|
2
3
|
export declare const sep = "/";
|
|
3
4
|
export declare const delimiter = ":";
|
|
@@ -8,6 +9,8 @@ export declare const delimiter = ":";
|
|
|
8
9
|
export declare function resolve(...pathSegments: string[]): string;
|
|
9
10
|
/**
|
|
10
11
|
* Normalize the `path`, resolving `'..'` and `'.'` segments.
|
|
12
|
+
* Note that resolving these segments does not necessarily mean that all will be eliminated.
|
|
13
|
+
* A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
|
|
11
14
|
* @param path to be normalized
|
|
12
15
|
*/
|
|
13
16
|
export declare function normalize(path: string): string;
|
|
@@ -33,8 +36,8 @@ export declare function relative(from: string, to: string): string;
|
|
|
33
36
|
*/
|
|
34
37
|
export declare function toNamespacedPath(path: string): string;
|
|
35
38
|
/**
|
|
36
|
-
* Return the directory
|
|
37
|
-
* @param path to determine
|
|
39
|
+
* Return the directory path of a `path`.
|
|
40
|
+
* @param path to determine the directory path for
|
|
38
41
|
*/
|
|
39
42
|
export declare function dirname(path: string): string;
|
|
40
43
|
/**
|
|
@@ -44,8 +47,9 @@ export declare function dirname(path: string): string;
|
|
|
44
47
|
*/
|
|
45
48
|
export declare function basename(path: string, ext?: string): string;
|
|
46
49
|
/**
|
|
47
|
-
* Return the extension of the `path
|
|
50
|
+
* Return the extension of the `path` with leading period.
|
|
48
51
|
* @param path with extension
|
|
52
|
+
* @returns extension (ex. for `file.ts` returns `.ts`)
|
|
49
53
|
*/
|
|
50
54
|
export declare function extname(path: string): string;
|
|
51
55
|
/**
|
|
@@ -62,7 +66,7 @@ export declare function parse(path: string): ParsedPath;
|
|
|
62
66
|
* Converts a file URL to a path string.
|
|
63
67
|
*
|
|
64
68
|
* ```ts
|
|
65
|
-
* import { fromFileUrl } from "
|
|
69
|
+
* import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/posix.ts";
|
|
66
70
|
* fromFileUrl("file:///home/foo"); // "/home/foo"
|
|
67
71
|
* ```
|
|
68
72
|
* @param url of a file URL
|
|
@@ -72,7 +76,7 @@ export declare function fromFileUrl(url: string | URL): string;
|
|
|
72
76
|
* Converts a path string to a file URL.
|
|
73
77
|
*
|
|
74
78
|
* ```ts
|
|
75
|
-
* import { toFileUrl } from "
|
|
79
|
+
* import { toFileUrl } from "https://deno.land/std@$STD_VERSION/path/posix.ts";
|
|
76
80
|
* toFileUrl("/home/foo"); // new URL("file:///home/foo")
|
|
77
81
|
* ```
|
|
78
82
|
* @param path to convert to file URL
|
|
File without changes
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import type { FormatInputPathObject, ParsedPath } from "./_interface.js";
|
|
2
3
|
export declare const sep = "\\";
|
|
3
4
|
export declare const delimiter = ";";
|
|
@@ -36,8 +37,8 @@ export declare function relative(from: string, to: string): string;
|
|
|
36
37
|
*/
|
|
37
38
|
export declare function toNamespacedPath(path: string): string;
|
|
38
39
|
/**
|
|
39
|
-
* Return the directory
|
|
40
|
-
* @param path to determine
|
|
40
|
+
* Return the directory path of a `path`.
|
|
41
|
+
* @param path to determine the directory path for
|
|
41
42
|
*/
|
|
42
43
|
export declare function dirname(path: string): string;
|
|
43
44
|
/**
|
|
@@ -47,8 +48,9 @@ export declare function dirname(path: string): string;
|
|
|
47
48
|
*/
|
|
48
49
|
export declare function basename(path: string, ext?: string): string;
|
|
49
50
|
/**
|
|
50
|
-
* Return the extension of the `path
|
|
51
|
+
* Return the extension of the `path` with leading period.
|
|
51
52
|
* @param path with extension
|
|
53
|
+
* @returns extension (ex. for `file.ts` returns `.ts`)
|
|
52
54
|
*/
|
|
53
55
|
export declare function extname(path: string): string;
|
|
54
56
|
/**
|
|
@@ -65,7 +67,7 @@ export declare function parse(path: string): ParsedPath;
|
|
|
65
67
|
* Converts a file URL to a path string.
|
|
66
68
|
*
|
|
67
69
|
* ```ts
|
|
68
|
-
* import { fromFileUrl } from "
|
|
70
|
+
* import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
|
|
69
71
|
* fromFileUrl("file:///home/foo"); // "\\home\\foo"
|
|
70
72
|
* fromFileUrl("file:///C:/Users/foo"); // "C:\\Users\\foo"
|
|
71
73
|
* fromFileUrl("file://localhost/home/foo"); // "\\\\localhost\\home\\foo"
|
|
@@ -77,7 +79,7 @@ export declare function fromFileUrl(url: string | URL): string;
|
|
|
77
79
|
* Converts a path string to a file URL.
|
|
78
80
|
*
|
|
79
81
|
* ```ts
|
|
80
|
-
* import { toFileUrl } from "
|
|
82
|
+
* import { toFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
|
|
81
83
|
* toFileUrl("\\home\\foo"); // new URL("file:///home/foo")
|
|
82
84
|
* toFileUrl("C:\\Users\\foo"); // new URL("file:///C:/Users/foo")
|
|
83
85
|
* toFileUrl("\\\\127.0.0.1\\home\\foo"); // new URL("file://127.0.0.1/home/foo")
|