@loomcli/core 0.5.0 → 0.6.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/application.d.ts +18 -2
- package/dist/application.js +266 -71
- package/dist/bindings.d.ts +15 -10
- package/dist/bindings.js +34 -15
- package/dist/chain.d.ts +15 -6
- package/dist/chain.js +40 -20
- package/dist/command-rules.d.ts +55 -0
- package/dist/command-rules.js +142 -0
- package/dist/command.d.ts +65 -23
- package/dist/command.js +695 -226
- package/dist/controls.d.ts +8 -0
- package/dist/controls.js +23 -0
- package/dist/defect.d.ts +18 -0
- package/dist/defect.js +272 -0
- package/dist/developer.d.ts +24 -0
- package/dist/developer.js +52 -0
- package/dist/diagnostic-text.d.ts +81 -0
- package/dist/diagnostic-text.js +283 -0
- package/dist/diagnostic.d.ts +11 -0
- package/dist/diagnostic.js +70 -0
- package/dist/errors.d.ts +108 -24
- package/dist/errors.js +324 -53
- package/dist/exit-codes.d.ts +45 -0
- package/dist/exit-codes.js +46 -0
- package/dist/extension.d.ts +41 -8
- package/dist/extension.js +142 -57
- package/dist/facts.d.ts +66 -11
- package/dist/facts.js +98 -22
- package/dist/globals.d.ts +29 -21
- package/dist/globals.js +115 -46
- package/dist/hints.d.ts +79 -0
- package/dist/hints.js +247 -0
- package/dist/host.d.ts +13 -0
- package/dist/host.js +43 -1
- package/dist/identity.d.ts +19 -0
- package/dist/identity.js +72 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +5 -0
- package/dist/input-rules.d.ts +64 -0
- package/dist/input-rules.js +145 -0
- package/dist/inspect.d.ts +12 -4
- package/dist/inspect.js +88 -28
- package/dist/lanes.js +1 -1
- package/dist/locate.js +4 -4
- package/dist/options.d.ts +23 -2
- package/dist/options.js +135 -44
- package/dist/output.d.ts +9 -2
- package/dist/output.js +18 -2
- package/dist/plain.d.ts +6 -0
- package/dist/plain.js +12 -0
- package/dist/plugin-rules.d.ts +62 -0
- package/dist/plugin-rules.js +155 -0
- package/dist/plugin.d.ts +22 -10
- package/dist/plugin.js +348 -116
- package/dist/prototypes.d.ts +7 -0
- package/dist/prototypes.js +29 -0
- package/dist/rendering.d.ts +6 -1
- package/dist/rendering.js +23 -5
- package/dist/rules.d.ts +51 -0
- package/dist/rules.js +115 -0
- package/dist/sequence.js +6 -1
- package/dist/sources.d.ts +6 -4
- package/dist/sources.js +22 -13
- package/dist/style-wire.js +1 -1
- package/dist/style.js +1 -1
- package/dist/theme.d.ts +4 -0
- package/dist/theme.js +25 -5
- package/dist/thenable.d.ts +15 -0
- package/dist/thenable.js +29 -0
- package/dist/translators.d.ts +69 -0
- package/dist/translators.js +253 -0
- package/dist/types.d.ts +11 -1
- package/dist/validation.d.ts +44 -3
- package/dist/validation.js +156 -57
- package/dist/view.d.ts +48 -14
- package/dist/view.js +155 -77
- package/package.json +1 -1
package/dist/plugin.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { MiddlewareContext } from './chain.js';
|
|
2
2
|
import type { AttachedChild, Command } from './command.js';
|
|
3
|
-
import type { AnyExtension, DescriptorRegistry } from './extension.js';
|
|
3
|
+
import type { AdmittedDescriptor, AnyExtension, DescriptorRegistry } from './extension.js';
|
|
4
4
|
import type { InputRecords } from './globals.js';
|
|
5
|
+
import type { FailureHook } from './hints.js';
|
|
5
6
|
import type { CommandGraph, OptionNode } from './inspect.js';
|
|
6
7
|
import type { OptionValues } from './options.js';
|
|
7
8
|
import type { ProcessSignal } from './signals.js';
|
|
8
9
|
import type { Palette } from './style-state.js';
|
|
9
10
|
import type { ContextualStyle, ThemeConstraint, ThemeMapping } from './style.js';
|
|
11
|
+
import type { Translation, TranslationContributor } from './translators.js';
|
|
10
12
|
import type { CommandAttachHook, Host, OptionValue, Out, PluginOptionConfig } from './types.js';
|
|
11
13
|
import type { OptionInput } from './validation.js';
|
|
12
|
-
import type { ViewContribution } from './view.js';
|
|
14
|
+
import type { ViewContribution, ViewSubject } from './view.js';
|
|
13
15
|
/**
|
|
14
16
|
* The declaration record a plugin contributes its options under: the parsing part of an option
|
|
15
17
|
* config, keyed by option name. A plugin option carries no schema and no presence rule, so the
|
|
@@ -78,9 +80,10 @@ interface SourceAnswer {
|
|
|
78
80
|
type SourceResolver<Contributor extends Plugin | ((...args: never[]) => Plugin)> = (context: SourceContext<OptionsOf<Contributor>>) => Promise<Readonly<Record<string, SourceAnswer>>>;
|
|
79
81
|
/**
|
|
80
82
|
* Everything a plugin declares. `plugin()` checks every rule the definition carries on its own, and
|
|
81
|
-
* creating and installing the value runs none of its code:
|
|
82
|
-
*
|
|
83
|
-
* stage when an unfilled option carries its binding
|
|
83
|
+
* creating and installing the value runs none of its code: `onCommandAttach` runs at graph build,
|
|
84
|
+
* `onFailure` runs when `run()` renders a failure, the middleware runs inside an invocation, the
|
|
85
|
+
* configuration source runs in the input-source stage when an unfilled option carries its binding,
|
|
86
|
+
* and a translator runs when a foreign throw its key matches leaves the application's work.
|
|
84
87
|
*/
|
|
85
88
|
interface PluginDefinition<Options extends PluginOptions = PluginOptions, Theme extends ThemeMapping = ThemeMapping> {
|
|
86
89
|
theme?: Theme & ThemeConstraint<Theme>;
|
|
@@ -92,8 +95,10 @@ interface PluginDefinition<Options extends PluginOptions = PluginOptions, Theme
|
|
|
92
95
|
}>;
|
|
93
96
|
};
|
|
94
97
|
onCommandAttach?: CommandAttachHook;
|
|
98
|
+
onFailure?: FailureHook;
|
|
95
99
|
extensions?: readonly AnyExtension[];
|
|
96
100
|
views?: readonly ViewContribution[];
|
|
101
|
+
translators?: readonly Translation[];
|
|
97
102
|
signals?: readonly ('SIGINT' | 'SIGTERM')[];
|
|
98
103
|
source?: {
|
|
99
104
|
binding: AnyExtension & {
|
|
@@ -107,13 +112,16 @@ interface PluginDefinition<Options extends PluginOptions = PluginOptions, Theme
|
|
|
107
112
|
}
|
|
108
113
|
/**
|
|
109
114
|
* One plugin: an identity and the contributions it carries. Creating and installing the value runs
|
|
110
|
-
* none of its code:
|
|
111
|
-
*
|
|
115
|
+
* none of its code: `onCommandAttach` runs at graph build, `onFailure` runs when `run()` renders a
|
|
116
|
+
* failure, and the middleware runs inside an invocation, so an installed plugin an invocation never
|
|
117
|
+
* reaches costs that invocation its hooks alone. Every rule
|
|
112
118
|
* that one definition carries on its own throws here, before the value exists.
|
|
113
119
|
*/
|
|
114
120
|
declare function plugin<Options extends PluginOptions = {}, const Theme extends ThemeMapping = {}>(identity: string, definition: PluginDefinition<Options, Theme>): Plugin<NoInfer<Options>, NoInfer<Theme>>;
|
|
115
121
|
/** How every plugin diagnostic names one plugin at the start of a sentence. */
|
|
116
122
|
declare function pluginSentence(identity: string): string;
|
|
123
|
+
/** The subject a plugin's `views` list reports under, and the call that declared it. */
|
|
124
|
+
declare function pluginViews(identity: string): ViewSubject;
|
|
117
125
|
/** What the installed list resolves to: the plugins in order, and every descriptor they define. */
|
|
118
126
|
interface InstalledPlugins {
|
|
119
127
|
descriptors: DescriptorRegistry;
|
|
@@ -126,7 +134,7 @@ interface InstalledPlugins {
|
|
|
126
134
|
* defensively, because a JavaScript author reaches it with any value. Each plugin's own rules
|
|
127
135
|
* already ran at its `plugin()` call.
|
|
128
136
|
*/
|
|
129
|
-
declare function installPlugins(plugins: unknown): InstalledPlugins;
|
|
137
|
+
declare function installPlugins(application: string, plugins: unknown): InstalledPlugins;
|
|
130
138
|
/**
|
|
131
139
|
* The default export one plugin loader resolves to, checked by the guard its caller supplies. A
|
|
132
140
|
* loader that throws where it is called and one that rejects later are one failure, and a module
|
|
@@ -154,8 +162,12 @@ interface BuiltPlugin {
|
|
|
154
162
|
theme: Palette | undefined;
|
|
155
163
|
/** The hook core calls once per Command at graph build, or nothing where none is declared. */
|
|
156
164
|
onCommandAttach: CommandAttachHook | undefined;
|
|
165
|
+
/** The hook core calls for each failure `run()` renders after graph build, or nothing. */
|
|
166
|
+
onFailure: FailureHook | undefined;
|
|
157
167
|
/** The plugin's own `views` slot, read once the validated theme is in place. */
|
|
158
168
|
views: unknown;
|
|
169
|
+
/** The translations the plugin registers, which resolve after the application's. */
|
|
170
|
+
translators: TranslationContributor;
|
|
159
171
|
identity: string;
|
|
160
172
|
inputs: readonly OptionInput[];
|
|
161
173
|
middleware: BuiltMiddleware | undefined;
|
|
@@ -164,7 +176,7 @@ interface BuiltPlugin {
|
|
|
164
176
|
/** The Commands the plugin attaches to the root, in list order. */
|
|
165
177
|
commands: readonly AttachedChild[];
|
|
166
178
|
/** Every descriptor the plugin defines or its options' values name, by identity. */
|
|
167
|
-
descriptors: ReadonlyMap<string,
|
|
179
|
+
descriptors: ReadonlyMap<string, AdmittedDescriptor>;
|
|
168
180
|
/** The extension record each of the plugin's own options carries. */
|
|
169
181
|
records: InputRecords;
|
|
170
182
|
}
|
|
@@ -183,4 +195,4 @@ declare function pluginValues(inputs: readonly OptionInput[], values: OptionValu
|
|
|
183
195
|
declare function pluginSpellings(inputs: readonly OptionInput[], values: OptionValues): Readonly<Record<string, string>>;
|
|
184
196
|
type ThemeOf<Contributor> = [Contributor] extends [never] ? {} : Contributor extends Plugin<PluginOptions, infer Theme> ? Theme : {};
|
|
185
197
|
export type { ThemeOf, BuiltPlugin, BuiltSource, PluginValues, SourceAnswer, SourceContext, SourceResolver, Middleware, OptionsOf, Plugin, PluginDefinition, PluginOptions, PluginOptionSpellings, PluginOptionValues, };
|
|
186
|
-
export { installPlugins, loadDefault, ownedSignals, plugin, pluginSentence, pluginSpellings, pluginValues, };
|
|
198
|
+
export { installPlugins, loadDefault, ownedSignals, plugin, pluginSentence, pluginSpellings, pluginViews, pluginValues, };
|