@pbuilder/sdk 0.19.0 → 0.21.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.
Files changed (68) hide show
  1. package/README.md +81 -38
  2. package/dist/acl/irwire/stdio-engine-client.d.ts +1 -0
  3. package/dist/acl/irwire/stdio-engine-client.js +9 -0
  4. package/dist/bin/pbuilder-codegen.js +90 -18
  5. package/dist/bounded-contexts/authoring/application/usecases/authoring-verbs/index.d.ts +15 -0
  6. package/dist/bounded-contexts/authoring/application/usecases/authoring-verbs/index.js +17 -0
  7. package/dist/bounded-contexts/authoring/application/usecases/run-factory/context.d.ts +16 -3
  8. package/dist/bounded-contexts/authoring/application/usecases/run-factory/context.js +45 -11
  9. package/dist/bounded-contexts/authoring/domain/aggregates/session/session.d.ts +3 -1
  10. package/dist/bounded-contexts/authoring/domain/aggregates/session/session.js +10 -1
  11. package/dist/bounded-contexts/authoring/domain/ports/engine-client.d.ts +1 -0
  12. package/dist/bounded-contexts/authoring/domain/services/define-dialect.d.ts +28 -1
  13. package/dist/bounded-contexts/authoring/domain/services/define-dialect.js +27 -3
  14. package/dist/bounded-contexts/authoring/domain/services/evaluation.d.ts +29 -0
  15. package/dist/bounded-contexts/authoring/domain/services/evaluation.js +43 -0
  16. package/dist/bounded-contexts/authoring/domain/services/glob-match.d.ts +4 -0
  17. package/dist/bounded-contexts/authoring/domain/services/glob-match.js +81 -0
  18. package/dist/bounded-contexts/authoring/domain/services/schema/input-rejection.d.ts +1 -0
  19. package/dist/bounded-contexts/authoring/domain/services/schema/input-rejection.js +4 -0
  20. package/dist/bounded-contexts/authoring/domain/services/schema/schema-validate.d.ts +2 -1
  21. package/dist/bounded-contexts/authoring/domain/services/schema/schema-validate.js +6 -2
  22. package/dist/bounded-contexts/authoring/domain/valueobjects/findings.d.ts +12 -0
  23. package/dist/bounded-contexts/authoring/domain/valueobjects/findings.js +57 -0
  24. package/dist/bounded-contexts/authoring/domain/valueobjects/schema-model.d.ts +2 -0
  25. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/cli.d.ts +7 -2
  26. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/cli.js +28 -7
  27. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/emit-type.d.ts +6 -2
  28. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/emit-type.js +23 -13
  29. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/project-codegen.d.ts +1 -0
  30. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/project-codegen.js +5 -2
  31. package/dist/bounded-contexts/authoring/infrastructure/in/commons/index.d.ts +2 -1
  32. package/dist/bounded-contexts/authoring/infrastructure/in/commons/index.js +1 -1
  33. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/angular/index.d.ts +14 -1
  34. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/angular/index.js +15 -0
  35. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/aspnet/index.d.ts +14 -1
  36. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/aspnet/index.js +15 -0
  37. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/csharp/index.d.ts +14 -1
  38. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/csharp/index.js +15 -0
  39. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/css/index.d.ts +14 -1
  40. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/css/index.js +15 -0
  41. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/json/index.d.ts +14 -1
  42. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/json/index.js +15 -0
  43. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/msbuild/index.d.ts +14 -1
  44. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/msbuild/index.js +15 -0
  45. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/nestjs/index.d.ts +14 -1
  46. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/nestjs/index.js +15 -0
  47. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/index.d.ts +14 -1
  48. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/index.js +15 -0
  49. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/typescript/index.d.ts +14 -1
  50. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/typescript/index.js +15 -0
  51. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/yaml/index.d.ts +14 -1
  52. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/yaml/index.js +15 -0
  53. package/dist/bounded-contexts/authoring/testing/contract-fake.d.ts +1 -0
  54. package/dist/bounded-contexts/authoring/testing/contract-fake.js +8 -0
  55. package/dist/bounded-contexts/authoring/testing/glob-pattern.d.ts +5 -0
  56. package/dist/bounded-contexts/authoring/testing/glob-pattern.js +20 -0
  57. package/dist/bounded-contexts/authoring/testing/harness/index.d.ts +8 -0
  58. package/dist/bounded-contexts/authoring/testing/harness/index.js +12 -1
  59. package/dist/bounded-contexts/authoring/testing/run-vehicle.d.ts +1 -0
  60. package/dist/bounded-contexts/authoring/testing/run-vehicle.js +4 -0
  61. package/dist/bounded-contexts/runner-hosting/infrastructure/in/bootstrap-bridge.d.ts +3 -0
  62. package/dist/bounded-contexts/runner-hosting/infrastructure/in/bootstrap-bridge.js +4 -0
  63. package/dist/bounded-contexts/runner-hosting/infrastructure/in/runner.js +15 -3
  64. package/dist/runner-manifest.json +33 -9
  65. package/dist/shared-kernel/wire-protocol.d.ts +1 -1
  66. package/dist/shared-kernel/wire-protocol.js +1 -1
  67. package/package.json +1 -1
  68. package/schemas/project-builder.schema.json +75 -2
@@ -16,6 +16,7 @@ import { checkSufficiency } from "../../../domain/services/schema/schema-suffici
16
16
  import { isErrnoException } from "../../../../../platform/fs-errors.js";
17
17
  import { emitInputType, UnrecognizedPropertyTypeError } from "./emit-type.js";
18
18
  import { discoverProject } from "./project-codegen.js";
19
+ import { SCOPE_INPUTS } from "../../../domain/valueobjects/findings.js";
19
20
  export const GENERATED_FILENAME = "schema.generated.ts";
20
21
  export const SUCCESS_LINE = "pbuilder-codegen: wrote schema.generated.ts";
21
22
  export const USAGE = [
@@ -35,6 +36,22 @@ export class SchemaSufficiencyFailure extends Error {
35
36
  this.findings = findings;
36
37
  }
37
38
  }
39
+ /** A-120 / A-122: a `schema.json` that declares what the role `evaluation` imposes. */
40
+ export class RoleContractFailure extends Error {
41
+ constructor(problem) {
42
+ super(problem);
43
+ this.name = "RoleContractFailure";
44
+ }
45
+ }
46
+ function checkEvaluationSchema(schema) {
47
+ if (schema.result !== undefined) {
48
+ throw new RoleContractFailure("an evaluation schematic declares a Result, which the role fixes as Findings");
49
+ }
50
+ const imposed = schema.properties.find((property) => SCOPE_INPUTS.includes(property.key));
51
+ if (imposed !== undefined) {
52
+ throw new RoleContractFailure(`an evaluation schematic declares the input ${JSON.stringify(imposed.key)}, which the role imposes`);
53
+ }
54
+ }
38
55
  class OutputWriteFailure extends Error {
39
56
  constructor(outputPath, cause, reason) {
40
57
  const code = isErrnoException(cause) ? cause.code : undefined;
@@ -60,9 +77,10 @@ function assertOutputLeaf(outputPath) {
60
77
  }
61
78
  /**
62
79
  * Reads `<packageDir>/schema.json`, parses it, and writes `<packageDir>/schema.generated.ts`
63
- * — the bin's fixed, non-configurable output location (REQ-TFO-05.1/FPS-01).
80
+ * — the bin's fixed, non-configurable output location (REQ-TFO-05.1/FPS-01). `evaluation` is set
81
+ * when the schematic's Collection definition entry declares the role `evaluation`.
64
82
  */
65
- export function generateSchema(packageDir) {
83
+ export function generateSchema(packageDir, evaluation = false) {
66
84
  const schemaPath = schemaPathFor(packageDir);
67
85
  const raw = readFileSync(schemaPath, "utf-8");
68
86
  const schema = parseSchema(raw);
@@ -70,8 +88,10 @@ export function generateSchema(packageDir) {
70
88
  if (sufficiencyFindings.length > 0) {
71
89
  throw new SchemaSufficiencyFailure(sufficiencyFindings);
72
90
  }
91
+ if (evaluation)
92
+ checkEvaluationSchema(schema);
73
93
  const digest = computeSchemaDigest(raw);
74
- const output = emitInputType(schema, digest);
94
+ const output = emitInputType(schema, digest, evaluation);
75
95
  const outputPath = join(packageDir, GENERATED_FILENAME);
76
96
  try {
77
97
  if (process.platform === "linux" || process.platform === "darwin") {
@@ -288,16 +308,17 @@ function runProject(directory) {
288
308
  seen.add(output);
289
309
  if (!statSync(schemaPath).isFile())
290
310
  throw new Error("nonregular schema");
291
- generateSchema(entry.directory);
311
+ generateSchema(entry.directory, entry.evaluation);
292
312
  generated++;
293
313
  }
294
314
  catch (error) {
295
315
  failed++;
296
316
  const diagnostic = error instanceof SchemaParseFailure ? formatParseError(schemaPath, error)
297
317
  : error instanceof SchemaSufficiencyFailure ? formatSufficiencyError(schemaPath, error)
298
- : error instanceof WriteContainmentRefusal ? "refusing to write outside the selected project root"
299
- : error instanceof OutputWriteFailure ? "cannot write a regular, non-symbolic-link output"
300
- : "cannot read or generate schema.json";
318
+ : error instanceof RoleContractFailure ? `pbuilder-codegen: ${schemaPath}: ${error.message}`
319
+ : error instanceof WriteContainmentRefusal ? "refusing to write outside the selected project root"
320
+ : error instanceof OutputWriteFailure ? "cannot write a regular, non-symbolic-link output"
321
+ : "cannot read or generate schema.json";
301
322
  console.error(`pbuilder-codegen: ${JSON.stringify(entry.label)} (${JSON.stringify(entry.directory)}): ${JSON.stringify(diagnostic)}`);
302
323
  }
303
324
  }
@@ -4,5 +4,9 @@ export declare class UnrecognizedPropertyTypeError extends Error {
4
4
  readonly field: string;
5
5
  constructor(field: string);
6
6
  }
7
- /** The Input type, and the Result type when the schema declares a Result (A-15). */
8
- export declare function emitInputType(schema: Schema, digest: string): string;
7
+ /**
8
+ * The Input type, and the Result type when the schema declares a Result (A-15). With the role
9
+ * `evaluation` the Input also holds the scope inputs and the Result is the Findings the role
10
+ * imposes (A-120, A-122); the caller has already refused a schema that declares either.
11
+ */
12
+ export declare function emitInputType(schema: Schema, digest: string, evaluation?: boolean): string;
@@ -6,6 +6,7 @@
6
6
  // discipline still holds so a hostile schema can never distort the emitted TEXT into
7
7
  // something a human misreads or a downstream tool mis-tokenizes.
8
8
  import { RECOGNIZED_KINDS } from "../../../domain/services/schema/schema-sufficiency.js";
9
+ import { FINDINGS } from "../../../domain/valueobjects/findings.js";
9
10
  export const GENERATED_HEADER = "// AUTO-GENERATED by pbuilder-codegen — do not edit. Regenerate: pbuilder-codegen <package-dir>";
10
11
  const IDENTIFIER_RE = /^[A-Za-z_$][\w$]*$/;
11
12
  // schema-parse.ts casts `type` to `SchemaKind` with zero runtime validation (`value.type as
@@ -69,23 +70,32 @@ function emitResult(result) {
69
70
  const members = result.properties.map(({ key, schema }) => `${emitPropertyKey(key)}${required.has(key) ? "" : "?"}: ${emitResult(schema)}`);
70
71
  return members.length === 0 ? "Record<string, never>" : `{ ${members.join("; ")} }`;
71
72
  }
73
+ case "string":
74
+ return result.choices === undefined ? kind : result.choices.map((choice) => JSON.stringify(choice)).join(" | ");
72
75
  default:
73
76
  return kind;
74
77
  }
75
78
  })
76
79
  .join(" | ");
77
80
  }
78
- /** The Input type, and the Result type when the schema declares a Result (A-15). */
79
- export function emitInputType(schema, digest) {
80
- const members = schema.properties.map(emitProperty).join("\n");
81
- return [
82
- GENERATED_HEADER,
83
- `// @schema-digest sha256:${digest}`,
84
- "",
85
- "export type Input = {",
86
- members,
87
- "};",
88
- ...(schema.result === undefined ? [] : ["", `export type Result = ${emitResult(schema.result)};`]),
89
- "",
90
- ].join("\n");
81
+ // A-122: the scope inputs the role `evaluation` imposes, after the author's own.
82
+ const SCOPE_MEMBERS = [
83
+ " /** Globs or literal paths to check */",
84
+ " include?: string[];",
85
+ " /** Globs or literal paths to skip */",
86
+ " exclude?: string[];",
87
+ ];
88
+ /**
89
+ * The Input type, and the Result type when the schema declares a Result (A-15). With the role
90
+ * `evaluation` the Input also holds the scope inputs and the Result is the Findings the role
91
+ * imposes (A-120, A-122); the caller has already refused a schema that declares either.
92
+ */
93
+ export function emitInputType(schema, digest, evaluation = false) {
94
+ const members = [...schema.properties.map(emitProperty), ...(evaluation ? SCOPE_MEMBERS : [])].join("\n");
95
+ const result = evaluation
96
+ ? ["", `export type Findings = ${emitResult(FINDINGS)};`, "", "export type Result = Findings;"]
97
+ : schema.result === undefined
98
+ ? []
99
+ : ["", `export type Result = ${emitResult(schema.result)};`];
100
+ return [GENERATED_HEADER, `// @schema-digest sha256:${digest}`, "", "export type Input = {", members, "};", ...result, ""].join("\n");
91
101
  }
@@ -2,6 +2,7 @@ type ProjectEntry = {
2
2
  kind: "target";
3
3
  label: string;
4
4
  directory: string;
5
+ evaluation: boolean;
5
6
  } | {
6
7
  kind: "failure";
7
8
  label: string;
@@ -11,6 +11,9 @@ function readObject(path) {
11
11
  throw new Error("invalid object");
12
12
  return value;
13
13
  }
14
+ function isEvaluation(registration) {
15
+ return isPlainObject(registration) && registration.role === "evaluation";
16
+ }
14
17
  export function discoverProject(directory) {
15
18
  let selected = resolve(directory ?? process.cwd());
16
19
  if (directory === undefined) {
@@ -77,7 +80,7 @@ export function discoverProject(directory) {
77
80
  try {
78
81
  if (!statSync(module).isFile())
79
82
  throw new Error("nonregular module");
80
- entries.push({ kind: "target", label, directory: dirname(realpathSync(module)) });
83
+ entries.push({ kind: "target", label, directory: dirname(realpathSync(module)), evaluation: isEvaluation(registration) });
81
84
  }
82
85
  catch {
83
86
  entries.push({ kind: "failure", label, diagnostic: `cannot resolve factory module ${JSON.stringify(module)}` });
@@ -120,7 +123,7 @@ export function discoverProject(directory) {
120
123
  }
121
124
  if (factories !== 1)
122
125
  throw new Error("ambiguous or missing factory");
123
- entries.push({ kind: "target", label, directory: realpathSync(path) });
126
+ entries.push({ kind: "target", label, directory: realpathSync(path), evaluation: isEvaluation(registration) });
124
127
  }
125
128
  catch {
126
129
  entries.push({ kind: "failure", label, diagnostic: `directory requires exactly one regular factory.ts or factory.js: ${JSON.stringify(path)}` });
@@ -4,11 +4,12 @@ import { AuthoringError } from "../../../domain/valueobjects/authoring-error.ts"
4
4
  import type { AuthoringVerb, AuthoringReason, AuthoringOrigin } from "../../../domain/valueobjects/authoring-error.ts";
5
5
  import type { ScaffoldArgs } from "../../../application/usecases/scaffold/index.ts";
6
6
  export type { FoundHandle, WritableHandle };
7
+ export type { GlobOptions } from "../../../domain/services/define-dialect.ts";
7
8
  export { AuthoringError };
8
9
  export type { AuthoringVerb, AuthoringReason, AuthoringOrigin };
9
10
  export { classifyContent } from "../../../domain/services/classify-content.ts";
10
11
  export type { ContentState } from "../../../domain/services/classify-content.ts";
11
- export { find, replaceContent, remove, rename, move, copy, pendingDirectives } from "../../../application/usecases/authoring-verbs/index.ts";
12
+ export { find, glob, replaceContent, remove, rename, move, copy, pendingDirectives } from "../../../application/usecases/authoring-verbs/index.ts";
12
13
  /**
13
14
  * Options for the `create` author verb.
14
15
  *
@@ -13,7 +13,7 @@ export { AuthoringError };
13
13
  // from the AuthoringError cluster above — no other component references it.
14
14
  export { classifyContent } from "../../../domain/services/classify-content.js";
15
15
  // The verbs that need no adapting are the use case's own functions.
16
- export { find, replaceContent, remove, rename, move, copy, pendingDirectives } from "../../../application/usecases/authoring-verbs/index.js";
16
+ export { find, glob, replaceContent, remove, rename, move, copy, pendingDirectives } from "../../../application/usecases/authoring-verbs/index.js";
17
17
  export function create(path, opts) {
18
18
  return verbs.create(path, opts, (options) => "templateFile" in opts ? readTemplateFile(opts.templateFile, path, options, opts.force) : opts.template);
19
19
  }
@@ -1,5 +1,5 @@
1
1
  import type { SourceFile } from "ts-morph";
2
- import { type Handle } from "../../../../domain/services/define-dialect.ts";
2
+ import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
3
3
  import { typescriptOps } from "../typescript/pack.ts";
4
4
  import type { ArrayElement } from "../typescript/array-element.ts";
5
5
  import { type InjectionOptions, type InputOptions, type LazyRouteSpec, type NamedImport, type OutputOptions, type RouteSpec, type StateOptions } from "./ops.ts";
@@ -61,3 +61,16 @@ type AngularOps = {
61
61
  * // -> export const appConfig: ApplicationConfig = { providers: [provideRouter(routes), provideHttpClient(withFetch())] };
62
62
  */
63
63
  export declare function find(path: string): Handle<"found", SourceFile, AngularOps & typeof typescriptOps>;
64
+ /**
65
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
66
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
67
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
68
+ *
69
+ * @example
70
+ * import * as angular from "@pbuilder/sdk/angular";
71
+ *
72
+ * export const run = async () => {
73
+ * for (const file of await angular.glob("src/app/**\/*.ts")) await file.read();
74
+ * };
75
+ */
76
+ export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", SourceFile, AngularOps & typeof typescriptOps>[]>;
@@ -66,3 +66,18 @@ const angularDialect = withOps(baseDialect, typescriptOps, angularOps);
66
66
  export function find(path) {
67
67
  return angularDialect.find(path);
68
68
  }
69
+ /**
70
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
71
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
72
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
73
+ *
74
+ * @example
75
+ * import * as angular from "@pbuilder/sdk/angular";
76
+ *
77
+ * export const run = async () => {
78
+ * for (const file of await angular.glob("src/app/**\/*.ts")) await file.read();
79
+ * };
80
+ */
81
+ export function glob(pattern, options) {
82
+ return angularDialect.glob(pattern, options);
83
+ }
@@ -1,4 +1,4 @@
1
- import { type Handle } from "../../../../domain/services/define-dialect.ts";
1
+ import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
2
2
  import { type CsharpDocument } from "../csharp/ast.ts";
3
3
  import { type CsharpOps } from "../csharp/pack.ts";
4
4
  import { type Lifetime, type ServiceOptions } from "./ops.ts";
@@ -49,3 +49,16 @@ type AspnetOps = CsharpOps & ServiceOps;
49
49
  * // -> var app = builder.Build();
50
50
  */
51
51
  export declare function find(path: string): Handle<"found", CsharpDocument, AspnetOps>;
52
+ /**
53
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
54
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
55
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
56
+ *
57
+ * @example
58
+ * import * as aspnet from "@pbuilder/sdk/aspnet";
59
+ *
60
+ * export const run = async () => {
61
+ * for (const file of await aspnet.glob("src/**\/*.cs")) await file.read();
62
+ * };
63
+ */
64
+ export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", CsharpDocument, AspnetOps>[]>;
@@ -47,3 +47,18 @@ const aspnetDialect = withOps(defineDialect({ extensions: [".cs"], ast: { parse,
47
47
  export function find(path) {
48
48
  return aspnetDialect.find(path);
49
49
  }
50
+ /**
51
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
52
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
53
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
54
+ *
55
+ * @example
56
+ * import * as aspnet from "@pbuilder/sdk/aspnet";
57
+ *
58
+ * export const run = async () => {
59
+ * for (const file of await aspnet.glob("src/**\/*.cs")) await file.read();
60
+ * };
61
+ */
62
+ export function glob(pattern, options) {
63
+ return aspnetDialect.glob(pattern, options);
64
+ }
@@ -1,4 +1,4 @@
1
- import { type Handle } from "../../../../domain/services/define-dialect.ts";
1
+ import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
2
2
  import { type CsharpDocument } from "./ast.ts";
3
3
  import type { FromOptions, UsingOptions } from "./ops.ts";
4
4
  import { type CsharpOps } from "./pack.ts";
@@ -42,3 +42,16 @@ export type { CsharpDocument, FromOptions, UsingOptions };
42
42
  * // -> }
43
43
  */
44
44
  export declare function find(path: string): Handle<"found", CsharpDocument, CsharpOps>;
45
+ /**
46
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
47
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
48
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
49
+ *
50
+ * @example
51
+ * import * as csharp from "@pbuilder/sdk/csharp";
52
+ *
53
+ * export const run = async () => {
54
+ * for (const file of await csharp.glob("src/**\/*.cs")) await file.read();
55
+ * };
56
+ */
57
+ export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", CsharpDocument, CsharpOps>[]>;
@@ -43,3 +43,18 @@ const csharpDialect = withOps(defineDialect({ extensions: [".cs"], ast: { parse,
43
43
  export function find(path) {
44
44
  return csharpDialect.find(path);
45
45
  }
46
+ /**
47
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
48
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
49
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
50
+ *
51
+ * @example
52
+ * import * as csharp from "@pbuilder/sdk/csharp";
53
+ *
54
+ * export const run = async () => {
55
+ * for (const file of await csharp.glob("src/**\/*.cs")) await file.read();
56
+ * };
57
+ */
58
+ export function glob(pattern, options) {
59
+ return csharpDialect.glob(pattern, options);
60
+ }
@@ -1,5 +1,5 @@
1
1
  import type { Root } from "postcss";
2
- import { type Handle, type Query } from "../../../../domain/services/define-dialect.ts";
2
+ import { type GlobOptions, type Handle, type Query } from "../../../../domain/services/define-dialect.ts";
3
3
  import { getDeclaration, type CssTarget, type DeclarationOptions } from "./ops.ts";
4
4
  export * as astLibrary from "postcss";
5
5
  export { getDeclaration };
@@ -38,3 +38,16 @@ type CssOps = {
38
38
  * // -> }
39
39
  */
40
40
  export declare function find(path: string): Handle<"found", Root, CssOps>;
41
+ /**
42
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
43
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
44
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
45
+ *
46
+ * @example
47
+ * import * as css from "@pbuilder/sdk/css";
48
+ *
49
+ * export const run = async () => {
50
+ * for (const file of await css.glob("src/**\/*.css")) await file.read();
51
+ * };
52
+ */
53
+ export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", Root, CssOps>[]>;
@@ -36,3 +36,18 @@ const cssDialect = withOps(defineDialect({ extensions: [".css"], ast: { parse, p
36
36
  export function find(path) {
37
37
  return cssDialect.find(path);
38
38
  }
39
+ /**
40
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
41
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
42
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
43
+ *
44
+ * @example
45
+ * import * as css from "@pbuilder/sdk/css";
46
+ *
47
+ * export const run = async () => {
48
+ * for (const file of await css.glob("src/**\/*.css")) await file.read();
49
+ * };
50
+ */
51
+ export function glob(pattern, options) {
52
+ return cssDialect.glob(pattern, options);
53
+ }
@@ -1,4 +1,4 @@
1
- import { type Handle } from "../../../../domain/services/define-dialect.ts";
1
+ import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
2
2
  import type { JsonPath, JsonValue } from "../../../../domain/valueobjects/json-value.ts";
3
3
  import { type JsonDocument } from "./ast.ts";
4
4
  import { type AppendOptions, type KeyPosition, type SortOptions } from "./ops.ts";
@@ -53,3 +53,16 @@ type JsonOps = {
53
53
  * // -> }
54
54
  */
55
55
  export declare function find(path: string): Handle<"found", JsonDocument, JsonOps>;
56
+ /**
57
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
58
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
59
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
60
+ *
61
+ * @example
62
+ * import * as json from "@pbuilder/sdk/json";
63
+ *
64
+ * export const run = async () => {
65
+ * for (const file of await json.glob("**\/package.json")) await file.read();
66
+ * };
67
+ */
68
+ export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", JsonDocument, JsonOps>[]>;
@@ -52,3 +52,18 @@ const jsonDialect = withOps(defineDialect({ extensions: [".json", ".jsonc"], ast
52
52
  export function find(path) {
53
53
  return jsonDialect.find(path);
54
54
  }
55
+ /**
56
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
57
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
58
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
59
+ *
60
+ * @example
61
+ * import * as json from "@pbuilder/sdk/json";
62
+ *
63
+ * export const run = async () => {
64
+ * for (const file of await json.glob("**\/package.json")) await file.read();
65
+ * };
66
+ */
67
+ export function glob(pattern, options) {
68
+ return jsonDialect.glob(pattern, options);
69
+ }
@@ -1,4 +1,4 @@
1
- import { type Handle } from "../../../../domain/services/define-dialect.ts";
1
+ import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
2
2
  import { type MsbuildDocument } from "./ast.ts";
3
3
  import { type ProjectOptions } from "./ops.ts";
4
4
  export * as astLibrary from "saxes";
@@ -53,3 +53,16 @@ type MsbuildOps = {
53
53
  * // -> </Solution>
54
54
  */
55
55
  export declare function find(path: string): Handle<"found", MsbuildDocument, MsbuildOps>;
56
+ /**
57
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
58
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
59
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
60
+ *
61
+ * @example
62
+ * import * as msbuild from "@pbuilder/sdk/msbuild";
63
+ *
64
+ * export const run = async () => {
65
+ * for (const file of await msbuild.glob("**\/*.csproj")) await file.read();
66
+ * };
67
+ */
68
+ export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", MsbuildDocument, MsbuildOps>[]>;
@@ -52,3 +52,18 @@ const msbuildDialect = withOps(defineDialect({ extensions: [".csproj", ".props",
52
52
  export function find(path) {
53
53
  return msbuildDialect.find(path);
54
54
  }
55
+ /**
56
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
57
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
58
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
59
+ *
60
+ * @example
61
+ * import * as msbuild from "@pbuilder/sdk/msbuild";
62
+ *
63
+ * export const run = async () => {
64
+ * for (const file of await msbuild.glob("**\/*.csproj")) await file.read();
65
+ * };
66
+ */
67
+ export function glob(pattern, options) {
68
+ return msbuildDialect.glob(pattern, options);
69
+ }
@@ -1,5 +1,5 @@
1
1
  import type { SourceFile } from "ts-morph";
2
- import { type Handle } from "../../../../domain/services/define-dialect.ts";
2
+ import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
3
3
  import { typescriptOps } from "../typescript/pack.ts";
4
4
  export * as astLibrary from "ts-morph";
5
5
  type ModuleOps = {
@@ -41,3 +41,16 @@ type NestOps = typeof typescriptOps & ModuleOps;
41
41
  * // -> export class AppModule {}
42
42
  */
43
43
  export declare function find(path: string): Handle<"found", SourceFile, NestOps>;
44
+ /**
45
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
46
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
47
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
48
+ *
49
+ * @example
50
+ * import * as nestjs from "@pbuilder/sdk/nestjs";
51
+ *
52
+ * export const run = async () => {
53
+ * for (const file of await nestjs.glob("src/**\/*.module.ts")) await file.read();
54
+ * };
55
+ */
56
+ export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", SourceFile, NestOps>[]>;
@@ -44,3 +44,18 @@ const nestjsDialect = withOps(baseDialect, typescriptOps, moduleOps);
44
44
  export function find(path) {
45
45
  return nestjsDialect.find(path);
46
46
  }
47
+ /**
48
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
49
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
50
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
51
+ *
52
+ * @example
53
+ * import * as nestjs from "@pbuilder/sdk/nestjs";
54
+ *
55
+ * export const run = async () => {
56
+ * for (const file of await nestjs.glob("src/**\/*.module.ts")) await file.read();
57
+ * };
58
+ */
59
+ export function glob(pattern, options) {
60
+ return nestjsDialect.glob(pattern, options);
61
+ }
@@ -1,5 +1,5 @@
1
1
  import type { SourceFile } from "ts-morph";
2
- import { type Handle } from "../../../../domain/services/define-dialect.ts";
2
+ import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
3
3
  import { typescriptOps } from "../typescript/pack.ts";
4
4
  import { type JsxTarget } from "./ops.ts";
5
5
  export * as astLibrary from "ts-morph";
@@ -50,3 +50,16 @@ type ReactOps = typeof typescriptOps & JsxOps;
50
50
  * // -> const el = <Button onClick={handleClick} />;
51
51
  */
52
52
  export declare function find(path: string): Handle<"found", SourceFile, ReactOps>;
53
+ /**
54
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
55
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
56
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
57
+ *
58
+ * @example
59
+ * import * as react from "@pbuilder/sdk/react";
60
+ *
61
+ * export const run = async () => {
62
+ * for (const file of await react.glob("src/**\/*.tsx")) await file.read();
63
+ * };
64
+ */
65
+ export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", SourceFile, ReactOps>[]>;
@@ -71,3 +71,18 @@ export function find(path) {
71
71
  }
72
72
  throw dialectError("find(path) — .tsx and .jsx are the only extensions the React dialect supports.");
73
73
  }
74
+ /**
75
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
76
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
77
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
78
+ *
79
+ * @example
80
+ * import * as react from "@pbuilder/sdk/react";
81
+ *
82
+ * export const run = async () => {
83
+ * for (const file of await react.glob("src/**\/*.tsx")) await file.read();
84
+ * };
85
+ */
86
+ export function glob(pattern, options) {
87
+ return reactDialect.glob(pattern, options);
88
+ }
@@ -1,5 +1,5 @@
1
1
  import type { SourceFile } from "ts-morph";
2
- import { type Handle } from "../../../../domain/services/define-dialect.ts";
2
+ import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
3
3
  import type { ArrayElement, ArrayLocator } from "./array-element.ts";
4
4
  import type { ClassPropertyOptions } from "./class-property.ts";
5
5
  export * as astLibrary from "ts-morph";
@@ -51,3 +51,16 @@ type TypeScriptOps = {
51
51
  * };
52
52
  */
53
53
  export declare function find(path: string): Handle<"found", SourceFile, TypeScriptOps>;
54
+ /**
55
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
56
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
57
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
58
+ *
59
+ * @example
60
+ * import * as ts from "@pbuilder/sdk/typescript";
61
+ *
62
+ * export const run = async () => {
63
+ * for (const file of await ts.glob("src/**\/*.ts")) await file.read();
64
+ * };
65
+ */
66
+ export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", SourceFile, TypeScriptOps>[]>;
@@ -35,3 +35,18 @@ const typescriptDialect = withOps(baseDialect, opsPack);
35
35
  export function find(path) {
36
36
  return typescriptDialect.find(path);
37
37
  }
38
+ /**
39
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
40
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
41
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
42
+ *
43
+ * @example
44
+ * import * as ts from "@pbuilder/sdk/typescript";
45
+ *
46
+ * export const run = async () => {
47
+ * for (const file of await ts.glob("src/**\/*.ts")) await file.read();
48
+ * };
49
+ */
50
+ export function glob(pattern, options) {
51
+ return typescriptDialect.glob(pattern, options);
52
+ }
@@ -1,4 +1,4 @@
1
- import { type Handle } from "../../../../domain/services/define-dialect.ts";
1
+ import { type GlobOptions, type Handle } from "../../../../domain/services/define-dialect.ts";
2
2
  import { type YamlStream } from "./ast.ts";
3
3
  import type { DocumentOption, YamlPath, YamlValue } from "./paths.ts";
4
4
  import { type CollectionStyle, type CommentOptions, type ScalarStyle } from "./presentation.ts";
@@ -67,3 +67,16 @@ type YamlOps = {
67
67
  * // -> - 3000:3000
68
68
  */
69
69
  export declare function find(path: string): Handle<"found", YamlStream, YamlOps>;
70
+ /**
71
+ * Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
72
+ * other extension is left out without an error (A-132). Resolves `[]` when none matches. The
73
+ * pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
74
+ *
75
+ * @example
76
+ * import * as yaml from "@pbuilder/sdk/yaml";
77
+ *
78
+ * export const run = async () => {
79
+ * for (const file of await yaml.glob("**\/*.{yml,yaml}")) await file.read();
80
+ * };
81
+ */
82
+ export declare function glob(pattern: string, options?: GlobOptions): Promise<Handle<"found", YamlStream, YamlOps>[]>;