@antelopejs/tooling-configs 0.2.14 → 0.2.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.
@@ -155,6 +155,24 @@ function renameNeeds(document, from, to) {
155
155
  }
156
156
  }
157
157
  }
158
+ function escapeRegExp(text) {
159
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
160
+ }
161
+ function renameNeedsReferences(text, from, to) {
162
+ const id = escapeRegExp(from);
163
+ const reference = new RegExp(`(?<![\\w.'"-])needs(?:\\.${id}(?![\\w-])|\\[\\s*(['"])${id}\\1\\s*\\])`, "g");
164
+ return text.replace(reference, (_match, quote) => quote === void 0 ? `needs.${to}` : `needs[${quote}${to}${quote}]`);
165
+ }
166
+ function isText(value) {
167
+ return String(value) === value;
168
+ }
169
+ function renameNeedsExpressions(document, from, to) {
170
+ visit(document, { Scalar(key, node, path) {
171
+ if (key === "key" || !isText(node.value)) return;
172
+ const parent = path.at(-1);
173
+ node.value = isPair(parent) && isScalar(parent.key) && parent.key.value === "if" ? renameNeedsReferences(node.value, from, to) : node.value.replace(/\$\{\{[\s\S]*?\}\}/g, (expression) => renameNeedsReferences(expression, from, to));
174
+ } });
175
+ }
158
176
  function hasDispatch(document) {
159
177
  const trigger = document.get("on", true);
160
178
  if (isMap(trigger)) return trigger.has("workflow_dispatch");
@@ -238,6 +256,7 @@ function ciWorkflow(current, callers, syncCallers) {
238
256
  if (caller.id !== "ci") {
239
257
  if (isScalar(pair.key)) pair.key.value = "ci";
240
258
  renameNeeds(document, caller.id, "ci");
259
+ renameNeedsExpressions(document, caller.id, "ci");
241
260
  changed = true;
242
261
  }
243
262
  changed = grant(document, pair.value, { contents: "read" }) || changed;
@@ -37,7 +37,7 @@ type BehaviourMethod = {
37
37
  interface FormalCheck {
38
38
  name: string;
39
39
  covers: string[];
40
- /** Globs of the check's own files (its model, its tests): a diff that changes one also runs the check on the base. */
40
+ /** Globs of the check's own files (its model, its tests): a diff that changes one runs the check, even when no covered file changed, and also runs it on the base. */
41
41
  files?: string[];
42
42
  /** Runs from the repository root; exits 0 while every finding breaks as recorded. */
43
43
  command: string[];
@@ -171,7 +171,7 @@ interface JourneyContext {
171
171
  service(name: string): ServiceEndpoint;
172
172
  /** Runs a command inside a service's container: the read-back through the native client. */
173
173
  native(name: string, service: string, args: string[]): Promise<CommandResult>;
174
- /** Writes the fixture project of the interface or module kind and returns its folder. */
174
+ /** Writes the fixture project of the interface or module kind and returns its folder. Each call writes a fresh project, so a journey can hold several. */
175
175
  fixture(options?: {
176
176
  moduleConfig?: JsonObject;
177
177
  }): string;
@@ -197,8 +197,8 @@ interface InterfaceCall<Api> {
197
197
  }
198
198
  /** Repo-owned hooks of the interface kind for contracts that are not interface proxies. */
199
199
  interface InterfaceHooks<Api> {
200
- /** Runs in the stub provider module after the generic stubs attach, for example to call `internal.SetClient`. */
201
- provide?(api: Api): void | Promise<void>;
200
+ /** Runs in the stub provider module after the generic stubs attach, for example to call `internal.SetClient`; `services` are the run's backing services as they answer from the host. */
201
+ provide?(api: Api, services: ServiceEndpoint[]): void | Promise<void>;
202
202
  /** Plain exported functions, by path such as `.:GetClient`, called by the driver module. */
203
203
  calls?: {
204
204
  [path: string]: InterfaceCall<Api>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/tooling-configs",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "description": "Shared tooling presets for AntelopeJS repositories: oxlint (with the vendored anti-slop rules), oxfmt, ESLint for Nuxt layers, Knip, and an interface range check",
5
5
  "keywords": [
6
6
  "antelopejs",