@rindo/core 3.0.1 → 3.1.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/cli/config-flags.d.ts +122 -122
- package/cli/index.cjs +2301 -2432
- package/cli/index.d.ts +19 -19
- package/cli/index.js +2302 -2433
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.d.ts +73 -73
- package/compiler/rindo.js +66137 -62907
- package/compiler/rindo.min.js +2 -2
- package/compiler/sys/in-memory-fs.d.ts +218 -218
- package/compiler/transpile.d.ts +32 -32
- package/dev-server/client/app-error.d.ts +18 -18
- package/dev-server/client/events.d.ts +6 -6
- package/dev-server/client/hmr-components.d.ts +1 -1
- package/dev-server/client/hmr-external-styles.d.ts +1 -1
- package/dev-server/client/hmr-images.d.ts +1 -1
- package/dev-server/client/hmr-inline-styles.d.ts +1 -1
- package/dev-server/client/hmr-util.d.ts +9 -9
- package/dev-server/client/hmr-window.d.ts +10 -10
- package/dev-server/client/index.d.ts +6 -6
- package/dev-server/client/index.js +781 -781
- package/dev-server/client/logger.d.ts +5 -5
- package/dev-server/client/package.json +1 -1
- package/dev-server/client/progress.d.ts +3 -3
- package/dev-server/client/status.d.ts +4 -4
- package/dev-server/connector.html +2 -2
- package/dev-server/index.d.ts +3 -3
- package/dev-server/index.js +228 -228
- package/dev-server/open-in-editor-api.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +1300 -1281
- package/dev-server/ws.js +1 -1
- package/dev-server/xdg-open +0 -0
- package/internal/app-data/index.cjs +88 -88
- package/internal/app-data/index.d.ts +4 -4
- package/internal/app-data/index.js +88 -88
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +1 -1
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +3380 -3380
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +155 -155
- package/internal/client/patch-esm.js +25 -25
- package/internal/client/shadow-css.js +382 -382
- package/internal/hydrate/package.json +1 -1
- package/internal/index.d.ts +2 -2
- package/internal/index.js +1 -1
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +2272 -2268
- package/internal/rindo-public-compiler.d.ts +2377 -2356
- package/internal/rindo-public-docs.d.ts +139 -139
- package/internal/rindo-public-runtime.d.ts +1636 -1636
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +4766 -4766
- package/mock-doc/index.d.ts +1006 -1006
- package/mock-doc/index.js +4766 -4766
- package/mock-doc/package.json +1 -1
- package/package.json +9 -9
- package/screenshot/connector-base.d.ts +42 -42
- package/screenshot/connector-local.d.ts +7 -7
- package/screenshot/index.d.ts +3 -3
- package/screenshot/index.js +615 -615
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.d.ts +1 -1
- package/screenshot/pixel-match.js +14 -14
- package/screenshot/screenshot-compare.d.ts +3 -3
- package/screenshot/screenshot-fs.d.ts +15 -15
- package/sys/node/autoprefixer.js +2 -2
- package/sys/node/glob.js +1 -1
- package/sys/node/graceful-fs.js +1 -1
- package/sys/node/index.d.ts +22 -22
- package/sys/node/index.js +6 -3
- package/sys/node/node-fetch.js +1 -1
- package/sys/node/package.json +1 -1
- package/sys/node/prompts.js +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.d.ts +12 -12
- package/testing/index.js +7 -3
- package/testing/jest/jest-config.d.ts +16 -16
- package/testing/jest/jest-environment.d.ts +15 -15
- package/testing/jest/jest-preprocessor.d.ts +59 -59
- package/testing/jest/jest-runner.d.ts +10 -10
- package/testing/jest/jest-screenshot.d.ts +2 -2
- package/testing/jest/jest-serializer.d.ts +4 -4
- package/testing/jest/jest-setup-test-framework.d.ts +1 -1
- package/testing/matchers/attributes.d.ts +14 -14
- package/testing/matchers/class-list.d.ts +12 -12
- package/testing/matchers/events.d.ts +21 -21
- package/testing/matchers/html.d.ts +12 -12
- package/testing/matchers/index.d.ts +23 -23
- package/testing/matchers/screenshot.d.ts +5 -5
- package/testing/matchers/text.d.ts +4 -4
- package/testing/mock-fetch.d.ts +11 -11
- package/testing/mocks.d.ts +56 -56
- package/testing/package.json +1 -1
- package/testing/puppeteer/index.d.ts +2 -2
- package/testing/puppeteer/puppeteer-browser.d.ts +6 -6
- package/testing/puppeteer/puppeteer-declarations.d.ts +403 -403
- package/testing/puppeteer/puppeteer-element.d.ts +67 -67
- package/testing/puppeteer/puppeteer-emulate.d.ts +2 -2
- package/testing/puppeteer/puppeteer-events.d.ts +21 -21
- package/testing/puppeteer/puppeteer-page.d.ts +2 -2
- package/testing/puppeteer/puppeteer-screenshot.d.ts +4 -4
- package/testing/reset-build-conditionals.d.ts +2 -2
- package/testing/spec-page.d.ts +2 -2
- package/testing/test-transpile.d.ts +2 -2
- package/testing/testing-logger.d.ts +25 -25
- package/testing/testing-sys.d.ts +6 -6
- package/testing/testing-utils.d.ts +79 -79
- package/testing/testing.d.ts +2 -2
- package/dependencies.json +0 -120
package/cli/config-flags.d.ts
CHANGED
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
import type { LogLevel, TaskCommand } from '../internal/index';
|
|
2
|
-
/**
|
|
3
|
-
* All the Boolean options supported by the Rindo CLI
|
|
4
|
-
*/
|
|
5
|
-
export declare const BOOLEAN_CLI_FLAGS: readonly ["build", "cache", "checkVersion", "ci", "compare", "debug", "dev", "devtools", "docs", "e2e", "es5", "esm", "headless", "help", "log", "open", "prerender", "prerenderExternal", "prod", "profile", "serviceWorker", "screenshot", "serve", "skipNodeCheck", "spec", "ssr", "stats", "updateScreenshot", "verbose", "version", "watch", "all", "automock", "bail", "changedFilesWithAncestor", "clearCache", "clearMocks", "collectCoverage", "color", "colors", "coverage", "detectLeaks", "detectOpenHandles", "errorOnDeprecated", "expand", "findRelatedTests", "forceExit", "init", "injectGlobals", "json", "lastCommit", "listTests", "logHeapUsage", "noStackTrace", "notify", "onlyChanged", "onlyFailures", "passWithNoTests", "resetMocks", "resetModules", "restoreMocks", "runInBand", "runTestsByPath", "showConfig", "silent", "skipFilter", "testLocationInResults", "updateSnapshot", "useStderr", "watchAll", "watchman"];
|
|
6
|
-
/**
|
|
7
|
-
* All the Number options supported by the Rindo CLI
|
|
8
|
-
*/
|
|
9
|
-
export declare const NUMBER_CLI_FLAGS: readonly ["port", "maxConcurrency", "testTimeout"];
|
|
10
|
-
/**
|
|
11
|
-
* All the String options supported by the Rindo CLI
|
|
12
|
-
*/
|
|
13
|
-
export declare const STRING_CLI_FLAGS: readonly ["address", "config", "docsApi", "docsJson", "emulate", "root", "screenshotConnector", "cacheDirectory", "changedSince", "collectCoverageFrom", "coverageDirectory", "coverageThreshold", "env", "filter", "globalSetup", "globalTeardown", "globals", "haste", "moduleNameMapper", "notifyMode", "outputFile", "preset", "prettierPath", "resolver", "rootDir", "runner", "testEnvironment", "testEnvironmentOptions", "testFailureExitCode", "testNamePattern", "testResultsProcessor", "testRunner", "testSequencer", "testURL", "timers", "transform"];
|
|
14
|
-
export declare const STRING_ARRAY_CLI_FLAGS: readonly ["collectCoverageOnlyFrom", "coveragePathIgnorePatterns", "coverageReporters", "moduleDirectories", "moduleFileExtensions", "modulePathIgnorePatterns", "modulePaths", "projects", "reporters", "roots", "selectProjects", "setupFiles", "setupFilesAfterEnv", "snapshotSerializers", "testMatch", "testPathIgnorePatterns", "testPathPattern", "testRegex", "transformIgnorePatterns", "unmockedModulePathPatterns", "watchPathIgnorePatterns"];
|
|
15
|
-
/**
|
|
16
|
-
* All the CLI arguments which may have string or number values
|
|
17
|
-
*
|
|
18
|
-
* `maxWorkers` is an argument which is used both by Rindo _and_ by Jest,
|
|
19
|
-
* which means that we need to support parsing both string and number values.
|
|
20
|
-
*/
|
|
21
|
-
export declare const STRING_NUMBER_CLI_FLAGS: readonly ["maxWorkers"];
|
|
22
|
-
/**
|
|
23
|
-
* All the LogLevel-type options supported by the Rindo CLI
|
|
24
|
-
*
|
|
25
|
-
* This is a bit silly since there's only one such argument atm,
|
|
26
|
-
* but this approach lets us make sure that we're handling all
|
|
27
|
-
* our arguments in a type-safe way.
|
|
28
|
-
*/
|
|
29
|
-
export declare const LOG_LEVEL_CLI_FLAGS: readonly ["logLevel"];
|
|
30
|
-
/**
|
|
31
|
-
* A type which gives the members of a `ReadonlyArray<string>` as
|
|
32
|
-
* an enum-like type which can be used for e.g. keys in a `Record`
|
|
33
|
-
* (as in the `AliasMap` type below)
|
|
34
|
-
*/
|
|
35
|
-
type ArrayValuesAsUnion<T extends ReadonlyArray<string>> = T[number];
|
|
36
|
-
export type BooleanCLIFlag = ArrayValuesAsUnion<typeof BOOLEAN_CLI_FLAGS>;
|
|
37
|
-
export type StringCLIFlag = ArrayValuesAsUnion<typeof STRING_CLI_FLAGS>;
|
|
38
|
-
export type StringArrayCLIFlag = ArrayValuesAsUnion<typeof STRING_ARRAY_CLI_FLAGS>;
|
|
39
|
-
export type NumberCLIFlag = ArrayValuesAsUnion<typeof NUMBER_CLI_FLAGS>;
|
|
40
|
-
export type StringNumberCLIFlag = ArrayValuesAsUnion<typeof STRING_NUMBER_CLI_FLAGS>;
|
|
41
|
-
export type LogCLIFlag = ArrayValuesAsUnion<typeof LOG_LEVEL_CLI_FLAGS>;
|
|
42
|
-
export type KnownCLIFlag = BooleanCLIFlag | StringCLIFlag | StringArrayCLIFlag | NumberCLIFlag | StringNumberCLIFlag | LogCLIFlag;
|
|
43
|
-
type AliasMap = Partial<Record<string, KnownCLIFlag>>;
|
|
44
|
-
/**
|
|
45
|
-
* For a small subset of CLI options we support a short alias e.g. `'h'` for `'help'`
|
|
46
|
-
*/
|
|
47
|
-
export declare const CLI_FLAG_ALIASES: AliasMap;
|
|
48
|
-
/**
|
|
49
|
-
* A regular expression which can be used to match a CLI flag for one of our
|
|
50
|
-
* short aliases.
|
|
51
|
-
*/
|
|
52
|
-
export declare const CLI_FLAG_REGEX: RegExp;
|
|
53
|
-
/**
|
|
54
|
-
* Given two types `K` and `T` where `K` extends `ReadonlyArray<string>`,
|
|
55
|
-
* construct a type which maps the strings in `K` as keys to values of type `T`.
|
|
56
|
-
*
|
|
57
|
-
* Because we use types derived this way to construct an interface (`ConfigFlags`)
|
|
58
|
-
* for which we want optional keys, we make all the properties optional (w/ `'?'`)
|
|
59
|
-
* and possibly null.
|
|
60
|
-
*/
|
|
61
|
-
type ObjectFromKeys<K extends ReadonlyArray<string>, T> = {
|
|
62
|
-
[key in K[number]]?: T | null;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Type containing the possible Boolean configuration flags, to be included
|
|
66
|
-
* in ConfigFlags, below
|
|
67
|
-
*/
|
|
68
|
-
type BooleanConfigFlags = ObjectFromKeys<typeof BOOLEAN_CLI_FLAGS, boolean>;
|
|
69
|
-
/**
|
|
70
|
-
* Type containing the possible String configuration flags, to be included
|
|
71
|
-
* in ConfigFlags, below
|
|
72
|
-
*/
|
|
73
|
-
type StringConfigFlags = ObjectFromKeys<typeof STRING_CLI_FLAGS, string>;
|
|
74
|
-
/**
|
|
75
|
-
* Type containing the possible String Array configuration flags. This is
|
|
76
|
-
* one of the 'constituent types' for `ConfigFlags`.
|
|
77
|
-
*/
|
|
78
|
-
type StringArrayConfigFlags = ObjectFromKeys<typeof STRING_ARRAY_CLI_FLAGS, string[]>;
|
|
79
|
-
/**
|
|
80
|
-
* Type containing the possible numeric configuration flags, to be included
|
|
81
|
-
* in ConfigFlags, below
|
|
82
|
-
*/
|
|
83
|
-
type NumberConfigFlags = ObjectFromKeys<typeof NUMBER_CLI_FLAGS, number>;
|
|
84
|
-
/**
|
|
85
|
-
* Type containing the configuration flags which may be set to either string
|
|
86
|
-
* or number values.
|
|
87
|
-
*/
|
|
88
|
-
type StringNumberConfigFlags = ObjectFromKeys<typeof STRING_NUMBER_CLI_FLAGS, string | number>;
|
|
89
|
-
/**
|
|
90
|
-
* Type containing the possible LogLevel configuration flags, to be included
|
|
91
|
-
* in ConfigFlags, below
|
|
92
|
-
*/
|
|
93
|
-
type LogLevelFlags = ObjectFromKeys<typeof LOG_LEVEL_CLI_FLAGS, LogLevel>;
|
|
94
|
-
/**
|
|
95
|
-
* The configuration flags which can be set by the user on the command line.
|
|
96
|
-
* This interface captures both known arguments (which are enumerated and then
|
|
97
|
-
* parsed according to their types) and unknown arguments which the user may
|
|
98
|
-
* pass at the CLI.
|
|
99
|
-
*
|
|
100
|
-
* Note that this interface is constructed by extending `BooleanConfigFlags`,
|
|
101
|
-
* `StringConfigFlags`, etc. These types are in turn constructed from types
|
|
102
|
-
* extending `ReadonlyArray<string>` which we declare in another module. This
|
|
103
|
-
* allows us to record our known CLI arguments in one place, using a
|
|
104
|
-
* `ReadonlyArray<string>` to get both a type-level representation of what CLI
|
|
105
|
-
* options we support and a runtime list of strings which can be used to match
|
|
106
|
-
* on actual flags passed by the user.
|
|
107
|
-
*/
|
|
108
|
-
export interface ConfigFlags extends BooleanConfigFlags, StringConfigFlags, StringArrayConfigFlags, NumberConfigFlags, StringNumberConfigFlags, LogLevelFlags {
|
|
109
|
-
task: TaskCommand | null;
|
|
110
|
-
args: string[];
|
|
111
|
-
knownArgs: string[];
|
|
112
|
-
unknownArgs: string[];
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Helper function for initializing a `ConfigFlags` object. Provide any overrides
|
|
116
|
-
* for default values and off you go!
|
|
117
|
-
*
|
|
118
|
-
* @param init an object with any overrides for default values
|
|
119
|
-
* @returns a complete CLI flag object
|
|
120
|
-
*/
|
|
121
|
-
export declare const createConfigFlags: (init?: Partial<ConfigFlags>) => ConfigFlags;
|
|
122
|
-
export {};
|
|
1
|
+
import type { LogLevel, TaskCommand } from '../internal/index';
|
|
2
|
+
/**
|
|
3
|
+
* All the Boolean options supported by the Rindo CLI
|
|
4
|
+
*/
|
|
5
|
+
export declare const BOOLEAN_CLI_FLAGS: readonly ["build", "cache", "checkVersion", "ci", "compare", "debug", "dev", "devtools", "docs", "e2e", "es5", "esm", "headless", "help", "log", "open", "prerender", "prerenderExternal", "prod", "profile", "serviceWorker", "screenshot", "serve", "skipNodeCheck", "spec", "ssr", "stats", "updateScreenshot", "verbose", "version", "watch", "all", "automock", "bail", "changedFilesWithAncestor", "clearCache", "clearMocks", "collectCoverage", "color", "colors", "coverage", "detectLeaks", "detectOpenHandles", "errorOnDeprecated", "expand", "findRelatedTests", "forceExit", "init", "injectGlobals", "json", "lastCommit", "listTests", "logHeapUsage", "noStackTrace", "notify", "onlyChanged", "onlyFailures", "passWithNoTests", "resetMocks", "resetModules", "restoreMocks", "runInBand", "runTestsByPath", "showConfig", "silent", "skipFilter", "testLocationInResults", "updateSnapshot", "useStderr", "watchAll", "watchman"];
|
|
6
|
+
/**
|
|
7
|
+
* All the Number options supported by the Rindo CLI
|
|
8
|
+
*/
|
|
9
|
+
export declare const NUMBER_CLI_FLAGS: readonly ["port", "maxConcurrency", "testTimeout"];
|
|
10
|
+
/**
|
|
11
|
+
* All the String options supported by the Rindo CLI
|
|
12
|
+
*/
|
|
13
|
+
export declare const STRING_CLI_FLAGS: readonly ["address", "config", "docsApi", "docsJson", "emulate", "root", "screenshotConnector", "cacheDirectory", "changedSince", "collectCoverageFrom", "coverageDirectory", "coverageThreshold", "env", "filter", "globalSetup", "globalTeardown", "globals", "haste", "moduleNameMapper", "notifyMode", "outputFile", "preset", "prettierPath", "resolver", "rootDir", "runner", "testEnvironment", "testEnvironmentOptions", "testFailureExitCode", "testNamePattern", "testResultsProcessor", "testRunner", "testSequencer", "testURL", "timers", "transform"];
|
|
14
|
+
export declare const STRING_ARRAY_CLI_FLAGS: readonly ["collectCoverageOnlyFrom", "coveragePathIgnorePatterns", "coverageReporters", "moduleDirectories", "moduleFileExtensions", "modulePathIgnorePatterns", "modulePaths", "projects", "reporters", "roots", "selectProjects", "setupFiles", "setupFilesAfterEnv", "snapshotSerializers", "testMatch", "testPathIgnorePatterns", "testPathPattern", "testRegex", "transformIgnorePatterns", "unmockedModulePathPatterns", "watchPathIgnorePatterns"];
|
|
15
|
+
/**
|
|
16
|
+
* All the CLI arguments which may have string or number values
|
|
17
|
+
*
|
|
18
|
+
* `maxWorkers` is an argument which is used both by Rindo _and_ by Jest,
|
|
19
|
+
* which means that we need to support parsing both string and number values.
|
|
20
|
+
*/
|
|
21
|
+
export declare const STRING_NUMBER_CLI_FLAGS: readonly ["maxWorkers"];
|
|
22
|
+
/**
|
|
23
|
+
* All the LogLevel-type options supported by the Rindo CLI
|
|
24
|
+
*
|
|
25
|
+
* This is a bit silly since there's only one such argument atm,
|
|
26
|
+
* but this approach lets us make sure that we're handling all
|
|
27
|
+
* our arguments in a type-safe way.
|
|
28
|
+
*/
|
|
29
|
+
export declare const LOG_LEVEL_CLI_FLAGS: readonly ["logLevel"];
|
|
30
|
+
/**
|
|
31
|
+
* A type which gives the members of a `ReadonlyArray<string>` as
|
|
32
|
+
* an enum-like type which can be used for e.g. keys in a `Record`
|
|
33
|
+
* (as in the `AliasMap` type below)
|
|
34
|
+
*/
|
|
35
|
+
type ArrayValuesAsUnion<T extends ReadonlyArray<string>> = T[number];
|
|
36
|
+
export type BooleanCLIFlag = ArrayValuesAsUnion<typeof BOOLEAN_CLI_FLAGS>;
|
|
37
|
+
export type StringCLIFlag = ArrayValuesAsUnion<typeof STRING_CLI_FLAGS>;
|
|
38
|
+
export type StringArrayCLIFlag = ArrayValuesAsUnion<typeof STRING_ARRAY_CLI_FLAGS>;
|
|
39
|
+
export type NumberCLIFlag = ArrayValuesAsUnion<typeof NUMBER_CLI_FLAGS>;
|
|
40
|
+
export type StringNumberCLIFlag = ArrayValuesAsUnion<typeof STRING_NUMBER_CLI_FLAGS>;
|
|
41
|
+
export type LogCLIFlag = ArrayValuesAsUnion<typeof LOG_LEVEL_CLI_FLAGS>;
|
|
42
|
+
export type KnownCLIFlag = BooleanCLIFlag | StringCLIFlag | StringArrayCLIFlag | NumberCLIFlag | StringNumberCLIFlag | LogCLIFlag;
|
|
43
|
+
type AliasMap = Partial<Record<string, KnownCLIFlag>>;
|
|
44
|
+
/**
|
|
45
|
+
* For a small subset of CLI options we support a short alias e.g. `'h'` for `'help'`
|
|
46
|
+
*/
|
|
47
|
+
export declare const CLI_FLAG_ALIASES: AliasMap;
|
|
48
|
+
/**
|
|
49
|
+
* A regular expression which can be used to match a CLI flag for one of our
|
|
50
|
+
* short aliases.
|
|
51
|
+
*/
|
|
52
|
+
export declare const CLI_FLAG_REGEX: RegExp;
|
|
53
|
+
/**
|
|
54
|
+
* Given two types `K` and `T` where `K` extends `ReadonlyArray<string>`,
|
|
55
|
+
* construct a type which maps the strings in `K` as keys to values of type `T`.
|
|
56
|
+
*
|
|
57
|
+
* Because we use types derived this way to construct an interface (`ConfigFlags`)
|
|
58
|
+
* for which we want optional keys, we make all the properties optional (w/ `'?'`)
|
|
59
|
+
* and possibly null.
|
|
60
|
+
*/
|
|
61
|
+
type ObjectFromKeys<K extends ReadonlyArray<string>, T> = {
|
|
62
|
+
[key in K[number]]?: T | null;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Type containing the possible Boolean configuration flags, to be included
|
|
66
|
+
* in ConfigFlags, below
|
|
67
|
+
*/
|
|
68
|
+
type BooleanConfigFlags = ObjectFromKeys<typeof BOOLEAN_CLI_FLAGS, boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* Type containing the possible String configuration flags, to be included
|
|
71
|
+
* in ConfigFlags, below
|
|
72
|
+
*/
|
|
73
|
+
type StringConfigFlags = ObjectFromKeys<typeof STRING_CLI_FLAGS, string>;
|
|
74
|
+
/**
|
|
75
|
+
* Type containing the possible String Array configuration flags. This is
|
|
76
|
+
* one of the 'constituent types' for `ConfigFlags`.
|
|
77
|
+
*/
|
|
78
|
+
type StringArrayConfigFlags = ObjectFromKeys<typeof STRING_ARRAY_CLI_FLAGS, string[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Type containing the possible numeric configuration flags, to be included
|
|
81
|
+
* in ConfigFlags, below
|
|
82
|
+
*/
|
|
83
|
+
type NumberConfigFlags = ObjectFromKeys<typeof NUMBER_CLI_FLAGS, number>;
|
|
84
|
+
/**
|
|
85
|
+
* Type containing the configuration flags which may be set to either string
|
|
86
|
+
* or number values.
|
|
87
|
+
*/
|
|
88
|
+
type StringNumberConfigFlags = ObjectFromKeys<typeof STRING_NUMBER_CLI_FLAGS, string | number>;
|
|
89
|
+
/**
|
|
90
|
+
* Type containing the possible LogLevel configuration flags, to be included
|
|
91
|
+
* in ConfigFlags, below
|
|
92
|
+
*/
|
|
93
|
+
type LogLevelFlags = ObjectFromKeys<typeof LOG_LEVEL_CLI_FLAGS, LogLevel>;
|
|
94
|
+
/**
|
|
95
|
+
* The configuration flags which can be set by the user on the command line.
|
|
96
|
+
* This interface captures both known arguments (which are enumerated and then
|
|
97
|
+
* parsed according to their types) and unknown arguments which the user may
|
|
98
|
+
* pass at the CLI.
|
|
99
|
+
*
|
|
100
|
+
* Note that this interface is constructed by extending `BooleanConfigFlags`,
|
|
101
|
+
* `StringConfigFlags`, etc. These types are in turn constructed from types
|
|
102
|
+
* extending `ReadonlyArray<string>` which we declare in another module. This
|
|
103
|
+
* allows us to record our known CLI arguments in one place, using a
|
|
104
|
+
* `ReadonlyArray<string>` to get both a type-level representation of what CLI
|
|
105
|
+
* options we support and a runtime list of strings which can be used to match
|
|
106
|
+
* on actual flags passed by the user.
|
|
107
|
+
*/
|
|
108
|
+
export interface ConfigFlags extends BooleanConfigFlags, StringConfigFlags, StringArrayConfigFlags, NumberConfigFlags, StringNumberConfigFlags, LogLevelFlags {
|
|
109
|
+
task: TaskCommand | null;
|
|
110
|
+
args: string[];
|
|
111
|
+
knownArgs: string[];
|
|
112
|
+
unknownArgs: string[];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Helper function for initializing a `ConfigFlags` object. Provide any overrides
|
|
116
|
+
* for default values and off you go!
|
|
117
|
+
*
|
|
118
|
+
* @param init an object with any overrides for default values
|
|
119
|
+
* @returns a complete CLI flag object
|
|
120
|
+
*/
|
|
121
|
+
export declare const createConfigFlags: (init?: Partial<ConfigFlags>) => ConfigFlags;
|
|
122
|
+
export {};
|