@h-rig/core 0.0.6-alpha.153 → 0.0.6-alpha.154

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.
@@ -120,7 +120,7 @@ function definePlugin(meta, runtime) {
120
120
  throw new Error(`definePlugin(${validated.name}): executable cli command "${command.id}" has no matching metadata entry in contributes.cliCommands`);
121
121
  }
122
122
  }
123
- return { ...validated, __runtime: runtime };
123
+ return { ...validated, ...runtime };
124
124
  }
125
125
  export {
126
126
  definePlugin,
@@ -3,7 +3,7 @@ import type { RigPluginRuntime, RigPluginWithRuntime } from "./plugin-runtime";
3
3
  /**
4
4
  * Define a Rig plugin. The first argument is the schema-validated metadata
5
5
  * (id strings, version, contributions). The optional second argument carries
6
- * executable bits (validator `run` functions, etc.) that Schema cannot
7
- * represent they travel alongside the validated metadata as `__runtime`.
6
+ * executable fields (validator `run` functions, task-source factories, CLI
7
+ * handlers, etc.) on the returned plugin object itself.
8
8
  */
9
9
  export declare function definePlugin(meta: RigPlugin, runtime?: RigPluginRuntime): RigPluginWithRuntime;
@@ -91,7 +91,7 @@ function definePlugin(meta, runtime) {
91
91
  throw new Error(`definePlugin(${validated.name}): executable cli command "${command.id}" has no matching metadata entry in contributes.cliCommands`);
92
92
  }
93
93
  }
94
- return { ...validated, __runtime: runtime };
94
+ return { ...validated, ...runtime };
95
95
  }
96
96
  export {
97
97
  definePlugin
package/dist/src/index.js CHANGED
@@ -91,7 +91,7 @@ function definePlugin(meta, runtime) {
91
91
  throw new Error(`definePlugin(${validated.name}): executable cli command "${command.id}" has no matching metadata entry in contributes.cliCommands`);
92
92
  }
93
93
  }
94
- return { ...validated, __runtime: runtime };
94
+ return { ...validated, ...runtime };
95
95
  }
96
96
  // packages/core/src/define-config.ts
97
97
  import { Schema as Schema2 } from "effect";
@@ -146,7 +146,7 @@ function assertUniquePluginNames(plugins) {
146
146
  }
147
147
  function assertRuntimeMatchesMetadata(plugin) {
148
148
  const declaredValidators = new Map((plugin.contributes?.validators ?? []).map((validator) => [validator.id, validator]));
149
- const runtimeValidators = new Map((plugin.__runtime?.validators ?? []).map((validator) => [validator.id, validator]));
149
+ const runtimeValidators = new Map((plugin?.validators ?? []).map((validator) => [validator.id, validator]));
150
150
  for (const validator of runtimeValidators.values()) {
151
151
  const metadata = declaredValidators.get(validator.id);
152
152
  if (!metadata) {
@@ -156,7 +156,7 @@ function assertRuntimeMatchesMetadata(plugin) {
156
156
  throw new Error(`plugin "${plugin.name}" executable validator "${validator.id}" category "${validator.category}" does not match metadata category "${metadata.category}"`);
157
157
  }
158
158
  }
159
- if (plugin.__runtime?.validators) {
159
+ if (plugin?.validators) {
160
160
  for (const validator of declaredValidators.values()) {
161
161
  if (!runtimeValidators.has(validator.id)) {
162
162
  throw new Error(`plugin "${plugin.name}" validator metadata "${validator.id}" has no runtime implementation`);
@@ -164,7 +164,7 @@ function assertRuntimeMatchesMetadata(plugin) {
164
164
  }
165
165
  }
166
166
  const declaredTaskSources = new Map((plugin.contributes?.taskSources ?? []).map((source) => [source.id, source]));
167
- const runtimeTaskSources = new Map((plugin.__runtime?.taskSources ?? []).map((source) => [source.id, source]));
167
+ const runtimeTaskSources = new Map((plugin?.taskSources ?? []).map((source) => [source.id, source]));
168
168
  for (const source of runtimeTaskSources.values()) {
169
169
  const metadata = declaredTaskSources.get(source.id);
170
170
  if (!metadata) {
@@ -174,7 +174,7 @@ function assertRuntimeMatchesMetadata(plugin) {
174
174
  throw new Error(`plugin "${plugin.name}" executable task source "${source.id}" kind "${source.kind}" does not match metadata kind "${metadata.kind}"`);
175
175
  }
176
176
  }
177
- if (plugin.__runtime?.taskSources) {
177
+ if (plugin?.taskSources) {
178
178
  for (const source of declaredTaskSources.values()) {
179
179
  if (!runtimeTaskSources.has(source.id)) {
180
180
  throw new Error(`plugin "${plugin.name}" task source metadata "${source.id}" has no runtime implementation`);
@@ -182,7 +182,7 @@ function assertRuntimeMatchesMetadata(plugin) {
182
182
  }
183
183
  }
184
184
  const declaredHooks = new Map((plugin.contributes?.hooks ?? []).map((hook) => [hook.id, hook]));
185
- const runtimeHooks = plugin.__runtime?.hooks;
185
+ const runtimeHooks = plugin?.hooks;
186
186
  for (const hookId of Object.keys(runtimeHooks ?? {})) {
187
187
  const metadata = declaredHooks.get(hookId);
188
188
  if (!metadata) {
@@ -200,14 +200,14 @@ function assertRuntimeMatchesMetadata(plugin) {
200
200
  }
201
201
  }
202
202
  const declaredCapabilities = new Map((plugin.contributes?.capabilities ?? []).map((capability) => [capability.id, capability]));
203
- const runtimeCapabilities = new Map((plugin.__runtime?.featureCapabilities ?? []).map((capability) => [capability.id, capability]));
203
+ const runtimeCapabilities = new Map((plugin?.featureCapabilities ?? []).map((capability) => [capability.id, capability]));
204
204
  for (const capability of runtimeCapabilities.values()) {
205
205
  if (!declaredCapabilities.has(capability.id)) {
206
206
  throw new Error(`plugin "${plugin.name}" executable capability "${capability.id}" has no matching metadata entry in contributes.capabilities`);
207
207
  }
208
208
  }
209
209
  const declaredPanels = new Map((plugin.contributes?.panels ?? []).map((panel) => [panel.id, panel]));
210
- const runtimePanels = new Map((plugin.__runtime?.panels ?? []).map((panel) => [panel.id, panel]));
210
+ const runtimePanels = new Map((plugin?.panels ?? []).map((panel) => [panel.id, panel]));
211
211
  for (const panel of runtimePanels.values()) {
212
212
  const metadata = declaredPanels.get(panel.id);
213
213
  if (!metadata) {
@@ -221,14 +221,14 @@ function assertRuntimeMatchesMetadata(plugin) {
221
221
  }
222
222
  }
223
223
  const declaredBlockerClassifiers = new Map((plugin.contributes?.blockerClassifiers ?? []).map((classifier) => [classifier.id, classifier]));
224
- const runtimeBlockerClassifiers = new Map((plugin.__runtime?.blockerClassifiers ?? []).map((classifier) => [classifier.id, classifier]));
224
+ const runtimeBlockerClassifiers = new Map((plugin?.blockerClassifiers ?? []).map((classifier) => [classifier.id, classifier]));
225
225
  for (const classifier of runtimeBlockerClassifiers.values()) {
226
226
  if (!declaredBlockerClassifiers.has(classifier.id)) {
227
227
  throw new Error(`plugin "${plugin.name}" executable blocker classifier "${classifier.id}" has no matching metadata entry in contributes.blockerClassifiers`);
228
228
  }
229
229
  }
230
230
  const declaredCliCommands = new Map((plugin.contributes?.cliCommands ?? []).map((command) => [command.id, command]));
231
- const runtimeCliCommands = new Map((plugin.__runtime?.cliCommands ?? []).map((command) => [command.id, command]));
231
+ const runtimeCliCommands = new Map((plugin?.cliCommands ?? []).map((command) => [command.id, command]));
232
232
  for (const command of runtimeCliCommands.values()) {
233
233
  if (!declaredCliCommands.has(command.id)) {
234
234
  throw new Error(`plugin "${plugin.name}" executable cli command "${command.id}" has no matching metadata entry in contributes.cliCommands`);
@@ -265,23 +265,23 @@ function createPluginHost(plugins) {
265
265
  if (!c)
266
266
  continue;
267
267
  const pluginName = plugin.name;
268
- if (plugin.__runtime?.validators) {
269
- executableValidators.push(...plugin.__runtime.validators.map((item) => ({ item, pluginName })));
268
+ if (plugin?.validators) {
269
+ executableValidators.push(...plugin.validators.map((item) => ({ item, pluginName })));
270
270
  }
271
- if (plugin.__runtime?.taskSources) {
272
- executableTaskSources.push(...plugin.__runtime.taskSources.map((item) => ({ item, pluginName })));
271
+ if (plugin?.taskSources) {
272
+ executableTaskSources.push(...plugin.taskSources.map((item) => ({ item, pluginName })));
273
273
  }
274
- if (plugin.__runtime?.featureCapabilities) {
275
- executableCapabilities.push(...plugin.__runtime.featureCapabilities.map((item) => ({ item, pluginName })));
274
+ if (plugin?.featureCapabilities) {
275
+ executableCapabilities.push(...plugin.featureCapabilities.map((item) => ({ item, pluginName })));
276
276
  }
277
- if (plugin.__runtime?.panels) {
278
- executablePanels.push(...plugin.__runtime.panels.map((item) => ({ item, pluginName })));
277
+ if (plugin?.panels) {
278
+ executablePanels.push(...plugin.panels.map((item) => ({ item, pluginName })));
279
279
  }
280
- if (plugin.__runtime?.blockerClassifiers) {
281
- executableBlockerClassifiers.push(...plugin.__runtime.blockerClassifiers.map((item) => ({ item, pluginName })));
280
+ if (plugin?.blockerClassifiers) {
281
+ executableBlockerClassifiers.push(...plugin.blockerClassifiers.map((item) => ({ item, pluginName })));
282
282
  }
283
- if (plugin.__runtime?.cliCommands) {
284
- executableCliCommands.push(...plugin.__runtime.cliCommands.map((item) => ({ item, pluginName })));
283
+ if (plugin?.cliCommands) {
284
+ executableCliCommands.push(...plugin.cliCommands.map((item) => ({ item, pluginName })));
285
285
  }
286
286
  if (c.validators)
287
287
  validators.push(...c.validators.map((item) => ({ item, pluginName })));
@@ -309,8 +309,8 @@ function createPluginHost(plugins) {
309
309
  stages.push(...c.stages.map((item) => ({ item, pluginName })));
310
310
  if (c.stageMutations)
311
311
  stageMutations.push(...c.stageMutations.map((item) => ({ item, pluginName })));
312
- if (plugin.__runtime?.stages)
313
- Object.assign(stageExecutors, plugin.__runtime.stages);
312
+ if (plugin?.stages)
313
+ Object.assign(stageExecutors, plugin.stages);
314
314
  }
315
315
  indexById(executableValidators, "executableValidator");
316
316
  indexById(executableTaskSources, "executableTaskSource");
@@ -23,7 +23,7 @@ function assertUniquePluginNames(plugins) {
23
23
  }
24
24
  function assertRuntimeMatchesMetadata(plugin) {
25
25
  const declaredValidators = new Map((plugin.contributes?.validators ?? []).map((validator) => [validator.id, validator]));
26
- const runtimeValidators = new Map((plugin.__runtime?.validators ?? []).map((validator) => [validator.id, validator]));
26
+ const runtimeValidators = new Map((plugin?.validators ?? []).map((validator) => [validator.id, validator]));
27
27
  for (const validator of runtimeValidators.values()) {
28
28
  const metadata = declaredValidators.get(validator.id);
29
29
  if (!metadata) {
@@ -33,7 +33,7 @@ function assertRuntimeMatchesMetadata(plugin) {
33
33
  throw new Error(`plugin "${plugin.name}" executable validator "${validator.id}" category "${validator.category}" does not match metadata category "${metadata.category}"`);
34
34
  }
35
35
  }
36
- if (plugin.__runtime?.validators) {
36
+ if (plugin?.validators) {
37
37
  for (const validator of declaredValidators.values()) {
38
38
  if (!runtimeValidators.has(validator.id)) {
39
39
  throw new Error(`plugin "${plugin.name}" validator metadata "${validator.id}" has no runtime implementation`);
@@ -41,7 +41,7 @@ function assertRuntimeMatchesMetadata(plugin) {
41
41
  }
42
42
  }
43
43
  const declaredTaskSources = new Map((plugin.contributes?.taskSources ?? []).map((source) => [source.id, source]));
44
- const runtimeTaskSources = new Map((plugin.__runtime?.taskSources ?? []).map((source) => [source.id, source]));
44
+ const runtimeTaskSources = new Map((plugin?.taskSources ?? []).map((source) => [source.id, source]));
45
45
  for (const source of runtimeTaskSources.values()) {
46
46
  const metadata = declaredTaskSources.get(source.id);
47
47
  if (!metadata) {
@@ -51,7 +51,7 @@ function assertRuntimeMatchesMetadata(plugin) {
51
51
  throw new Error(`plugin "${plugin.name}" executable task source "${source.id}" kind "${source.kind}" does not match metadata kind "${metadata.kind}"`);
52
52
  }
53
53
  }
54
- if (plugin.__runtime?.taskSources) {
54
+ if (plugin?.taskSources) {
55
55
  for (const source of declaredTaskSources.values()) {
56
56
  if (!runtimeTaskSources.has(source.id)) {
57
57
  throw new Error(`plugin "${plugin.name}" task source metadata "${source.id}" has no runtime implementation`);
@@ -59,7 +59,7 @@ function assertRuntimeMatchesMetadata(plugin) {
59
59
  }
60
60
  }
61
61
  const declaredHooks = new Map((plugin.contributes?.hooks ?? []).map((hook) => [hook.id, hook]));
62
- const runtimeHooks = plugin.__runtime?.hooks;
62
+ const runtimeHooks = plugin?.hooks;
63
63
  for (const hookId of Object.keys(runtimeHooks ?? {})) {
64
64
  const metadata = declaredHooks.get(hookId);
65
65
  if (!metadata) {
@@ -77,14 +77,14 @@ function assertRuntimeMatchesMetadata(plugin) {
77
77
  }
78
78
  }
79
79
  const declaredCapabilities = new Map((plugin.contributes?.capabilities ?? []).map((capability) => [capability.id, capability]));
80
- const runtimeCapabilities = new Map((plugin.__runtime?.featureCapabilities ?? []).map((capability) => [capability.id, capability]));
80
+ const runtimeCapabilities = new Map((plugin?.featureCapabilities ?? []).map((capability) => [capability.id, capability]));
81
81
  for (const capability of runtimeCapabilities.values()) {
82
82
  if (!declaredCapabilities.has(capability.id)) {
83
83
  throw new Error(`plugin "${plugin.name}" executable capability "${capability.id}" has no matching metadata entry in contributes.capabilities`);
84
84
  }
85
85
  }
86
86
  const declaredPanels = new Map((plugin.contributes?.panels ?? []).map((panel) => [panel.id, panel]));
87
- const runtimePanels = new Map((plugin.__runtime?.panels ?? []).map((panel) => [panel.id, panel]));
87
+ const runtimePanels = new Map((plugin?.panels ?? []).map((panel) => [panel.id, panel]));
88
88
  for (const panel of runtimePanels.values()) {
89
89
  const metadata = declaredPanels.get(panel.id);
90
90
  if (!metadata) {
@@ -98,14 +98,14 @@ function assertRuntimeMatchesMetadata(plugin) {
98
98
  }
99
99
  }
100
100
  const declaredBlockerClassifiers = new Map((plugin.contributes?.blockerClassifiers ?? []).map((classifier) => [classifier.id, classifier]));
101
- const runtimeBlockerClassifiers = new Map((plugin.__runtime?.blockerClassifiers ?? []).map((classifier) => [classifier.id, classifier]));
101
+ const runtimeBlockerClassifiers = new Map((plugin?.blockerClassifiers ?? []).map((classifier) => [classifier.id, classifier]));
102
102
  for (const classifier of runtimeBlockerClassifiers.values()) {
103
103
  if (!declaredBlockerClassifiers.has(classifier.id)) {
104
104
  throw new Error(`plugin "${plugin.name}" executable blocker classifier "${classifier.id}" has no matching metadata entry in contributes.blockerClassifiers`);
105
105
  }
106
106
  }
107
107
  const declaredCliCommands = new Map((plugin.contributes?.cliCommands ?? []).map((command) => [command.id, command]));
108
- const runtimeCliCommands = new Map((plugin.__runtime?.cliCommands ?? []).map((command) => [command.id, command]));
108
+ const runtimeCliCommands = new Map((plugin?.cliCommands ?? []).map((command) => [command.id, command]));
109
109
  for (const command of runtimeCliCommands.values()) {
110
110
  if (!declaredCliCommands.has(command.id)) {
111
111
  throw new Error(`plugin "${plugin.name}" executable cli command "${command.id}" has no matching metadata entry in contributes.cliCommands`);
@@ -142,23 +142,23 @@ function createPluginHost(plugins) {
142
142
  if (!c)
143
143
  continue;
144
144
  const pluginName = plugin.name;
145
- if (plugin.__runtime?.validators) {
146
- executableValidators.push(...plugin.__runtime.validators.map((item) => ({ item, pluginName })));
145
+ if (plugin?.validators) {
146
+ executableValidators.push(...plugin.validators.map((item) => ({ item, pluginName })));
147
147
  }
148
- if (plugin.__runtime?.taskSources) {
149
- executableTaskSources.push(...plugin.__runtime.taskSources.map((item) => ({ item, pluginName })));
148
+ if (plugin?.taskSources) {
149
+ executableTaskSources.push(...plugin.taskSources.map((item) => ({ item, pluginName })));
150
150
  }
151
- if (plugin.__runtime?.featureCapabilities) {
152
- executableCapabilities.push(...plugin.__runtime.featureCapabilities.map((item) => ({ item, pluginName })));
151
+ if (plugin?.featureCapabilities) {
152
+ executableCapabilities.push(...plugin.featureCapabilities.map((item) => ({ item, pluginName })));
153
153
  }
154
- if (plugin.__runtime?.panels) {
155
- executablePanels.push(...plugin.__runtime.panels.map((item) => ({ item, pluginName })));
154
+ if (plugin?.panels) {
155
+ executablePanels.push(...plugin.panels.map((item) => ({ item, pluginName })));
156
156
  }
157
- if (plugin.__runtime?.blockerClassifiers) {
158
- executableBlockerClassifiers.push(...plugin.__runtime.blockerClassifiers.map((item) => ({ item, pluginName })));
157
+ if (plugin?.blockerClassifiers) {
158
+ executableBlockerClassifiers.push(...plugin.blockerClassifiers.map((item) => ({ item, pluginName })));
159
159
  }
160
- if (plugin.__runtime?.cliCommands) {
161
- executableCliCommands.push(...plugin.__runtime.cliCommands.map((item) => ({ item, pluginName })));
160
+ if (plugin?.cliCommands) {
161
+ executableCliCommands.push(...plugin.cliCommands.map((item) => ({ item, pluginName })));
162
162
  }
163
163
  if (c.validators)
164
164
  validators.push(...c.validators.map((item) => ({ item, pluginName })));
@@ -186,8 +186,8 @@ function createPluginHost(plugins) {
186
186
  stages.push(...c.stages.map((item) => ({ item, pluginName })));
187
187
  if (c.stageMutations)
188
188
  stageMutations.push(...c.stageMutations.map((item) => ({ item, pluginName })));
189
- if (plugin.__runtime?.stages)
190
- Object.assign(stageExecutors, plugin.__runtime.stages);
189
+ if (plugin?.stages)
190
+ Object.assign(stageExecutors, plugin.stages);
191
191
  }
192
192
  indexById(executableValidators, "executableValidator");
193
193
  indexById(executableTaskSources, "executableTaskSource");
@@ -100,6 +100,4 @@ export interface RigPluginRuntime {
100
100
  */
101
101
  capabilities?: Record<string, unknown>;
102
102
  }
103
- export type RigPluginWithRuntime = RigPlugin & {
104
- __runtime?: RigPluginRuntime;
105
- };
103
+ export type RigPluginWithRuntime = RigPlugin & RigPluginRuntime;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/core",
3
- "version": "0.0.6-alpha.153",
3
+ "version": "0.0.6-alpha.154",
4
4
  "type": "module",
5
5
  "description": "Config and plugin composition library for Rig's OMP extension ecosystem; not a product host/runtime.",
6
6
  "license": "UNLICENSED",
@@ -49,7 +49,7 @@
49
49
  "module": "./dist/src/index.js",
50
50
  "types": "./dist/src/index.d.ts",
51
51
  "dependencies": {
52
- "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.153",
52
+ "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.154",
53
53
  "effect": "4.0.0-beta.90"
54
54
  }
55
55
  }