@sous-io/plugin-api 1.0.15 → 1.0.16

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/config.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Environment, ProjectInfo } from "./context.js";
2
+ import type { IntentDefinition } from "./intents.js";
2
3
  import type { EntityReader } from "./entities.js";
3
4
  import type { JsonObject, JsonValue, Patch, PatchSet, PathInput } from "./json.js";
4
5
  import type { DocumentNode } from "./node.js";
@@ -111,6 +112,11 @@ export interface ConfigBuilder extends Reporter {
111
112
  readonly contributor: ContributorInfo;
112
113
  readonly project: ProjectInfo | undefined;
113
114
  readonly env: Environment;
115
+ /**
116
+ * What the front end is about to run, when it said (`BuildOptions.plan`); `undefined` when
117
+ * nothing is known, as for a library caller or a command only a plugin loaded later adds.
118
+ */
119
+ readonly plan: RunPlan | undefined;
114
120
  }
115
121
  /**
116
122
  * A contributor: anything that adds to the config.
@@ -167,4 +173,22 @@ export interface BuildOptions {
167
173
  * where the warning is noise above the answer. The build is still timed (`--timings`).
168
174
  */
169
175
  reportBudgets?: boolean;
176
+ /**
177
+ * What the front end is about to run, when it read its command line before the config was built.
178
+ * The engine keeps it for every later build in the same run, and contributors read it as
179
+ * `config.plan`.
180
+ */
181
+ plan?: RunPlan;
182
+ }
183
+ /**
184
+ * What a front end is about to run, read from its command line before the config was built.
185
+ *
186
+ * ```ts
187
+ * { intent: buildDefinition } // `sous build`
188
+ * { intent: undefined } // `sous --help`, `sous --version`: no intent runs
189
+ * ```
190
+ */
191
+ export interface RunPlan {
192
+ /** The intent it will submit, or `undefined` when it runs none (help, the version). */
193
+ readonly intent: IntentDefinition | undefined;
170
194
  }
package/dist/intents.d.ts CHANGED
@@ -102,6 +102,13 @@ export interface IntentDefinition<N extends string = string, S extends SousSchem
102
102
  * config is built, when the project loads no plugin beyond the built-in ones.
103
103
  */
104
104
  runsWithoutConfig?: boolean;
105
+ /**
106
+ * `boolean = false`. It reads the files of the recipes the project subscribes to (their config
107
+ * layers, plugins, variables or content), so sous downloads every pinned recipe this machine lacks
108
+ * before it runs, and fails when one cannot be downloaded. Any other intent runs with the recipe
109
+ * files already on this machine, so it works offline and without credentials.
110
+ */
111
+ needsRecipeFiles?: boolean;
105
112
  /**
106
113
  * It works on a project, so it fails, before it runs, when sous was started outside one: the
107
114
  * error says no sous config was found and how to set a project up.
package/dist/plugin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ContributorDefinition } from "./config.js";
1
+ import type { ContributorDefinition, RunPlan } from "./config.js";
2
2
  import type { Environment, EngineHandle, ProjectInfo } from "./context.js";
3
3
  import type { EntityKindOptions, EntityReader } from "./entities.js";
4
4
  import type { EventFor, EventForPattern, EventPattern, EventPayload, Listener, ListenerOptions } from "./events.js";
@@ -60,6 +60,12 @@ export interface FrontEndDefinition {
60
60
  * building the config when the project loads no further plugin.
61
61
  */
62
62
  needsConfig?(engine: EngineHandle, argv: readonly string[]): boolean;
63
+ /**
64
+ * What `argv` will run, read before the config is built (asked on the config of the built-in
65
+ * plugins' registrations alone), or `undefined` when it cannot tell. The application passes it to
66
+ * the config build as `plan`.
67
+ */
68
+ plan?(engine: EngineHandle, argv: readonly string[]): RunPlan | undefined;
63
69
  }
64
70
  /** `sous.intents`. */
65
71
  export interface IntentRegistry {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sous-io/plugin-api",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "The plugin interface of sous: definePlugin, the shared type interfaces, Reporter, Prompter and the error classes",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",