@pbuilder/sdk 0.18.0 → 0.20.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/README.md +89 -3
- package/dist/acl/irwire/stdio-engine-client.d.ts +2 -1
- package/dist/acl/irwire/stdio-engine-client.js +12 -2
- package/dist/bin/pbuilder-codegen.js +148 -18
- package/dist/bin/pbuilder-conformance.js +24 -5
- package/dist/bounded-contexts/authoring/application/usecases/authoring-verbs/index.d.ts +15 -0
- package/dist/bounded-contexts/authoring/application/usecases/authoring-verbs/index.js +17 -0
- package/dist/bounded-contexts/authoring/application/usecases/run-factory/context.d.ts +21 -5
- package/dist/bounded-contexts/authoring/application/usecases/run-factory/context.js +59 -12
- package/dist/bounded-contexts/authoring/domain/aggregates/session/session.d.ts +4 -2
- package/dist/bounded-contexts/authoring/domain/aggregates/session/session.js +12 -3
- package/dist/bounded-contexts/authoring/domain/ports/engine-client.d.ts +2 -1
- package/dist/bounded-contexts/authoring/domain/services/define-dialect.d.ts +28 -1
- package/dist/bounded-contexts/authoring/domain/services/define-dialect.js +27 -3
- package/dist/bounded-contexts/authoring/domain/services/evaluation.d.ts +29 -0
- package/dist/bounded-contexts/authoring/domain/services/evaluation.js +43 -0
- package/dist/bounded-contexts/authoring/domain/services/glob-match.d.ts +4 -0
- package/dist/bounded-contexts/authoring/domain/services/glob-match.js +81 -0
- package/dist/bounded-contexts/authoring/domain/services/schema/input-rejection.d.ts +2 -0
- package/dist/bounded-contexts/authoring/domain/services/schema/input-rejection.js +8 -0
- package/dist/bounded-contexts/authoring/domain/services/schema/schema-parse.d.ts +3 -2
- package/dist/bounded-contexts/authoring/domain/services/schema/schema-parse.js +46 -4
- package/dist/bounded-contexts/authoring/domain/services/schema/schema-validate.d.ts +18 -2
- package/dist/bounded-contexts/authoring/domain/services/schema/schema-validate.js +131 -2
- package/dist/bounded-contexts/authoring/domain/valueobjects/authoring-error.d.ts +3 -2
- package/dist/bounded-contexts/authoring/domain/valueobjects/authoring-error.js +2 -0
- package/dist/bounded-contexts/authoring/domain/valueobjects/findings.d.ts +12 -0
- package/dist/bounded-contexts/authoring/domain/valueobjects/findings.js +57 -0
- package/dist/bounded-contexts/authoring/domain/valueobjects/schema-model.d.ts +19 -0
- package/dist/bounded-contexts/authoring/domain/valueobjects/schema-model.js +1 -0
- package/dist/bounded-contexts/authoring/infrastructure/in/codegen/cli.d.ts +7 -2
- package/dist/bounded-contexts/authoring/infrastructure/in/codegen/cli.js +28 -7
- package/dist/bounded-contexts/authoring/infrastructure/in/codegen/emit-type.d.ts +6 -1
- package/dist/bounded-contexts/authoring/infrastructure/in/codegen/emit-type.js +44 -11
- package/dist/bounded-contexts/authoring/infrastructure/in/codegen/project-codegen.d.ts +1 -0
- package/dist/bounded-contexts/authoring/infrastructure/in/codegen/project-codegen.js +5 -2
- package/dist/bounded-contexts/authoring/infrastructure/in/commons/index.d.ts +2 -1
- package/dist/bounded-contexts/authoring/infrastructure/in/commons/index.js +1 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/angular/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/angular/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/aspnet/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/aspnet/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/csharp/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/csharp/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/css/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/css/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/json/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/json/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/msbuild/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/msbuild/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/nestjs/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/nestjs/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/typescript/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/typescript/index.js +15 -0
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/yaml/index.d.ts +14 -1
- package/dist/bounded-contexts/authoring/infrastructure/out/dialects/yaml/index.js +15 -0
- package/dist/bounded-contexts/authoring/testing/conformance/run-package.d.ts +17 -0
- package/dist/bounded-contexts/authoring/testing/conformance/run-package.js +124 -44
- package/dist/bounded-contexts/authoring/testing/contract-fake.d.ts +1 -0
- package/dist/bounded-contexts/authoring/testing/contract-fake.js +8 -0
- package/dist/bounded-contexts/authoring/testing/glob-pattern.d.ts +5 -0
- package/dist/bounded-contexts/authoring/testing/glob-pattern.js +20 -0
- package/dist/bounded-contexts/authoring/testing/harness/index.d.ts +18 -4
- package/dist/bounded-contexts/authoring/testing/harness/index.js +17 -4
- package/dist/bounded-contexts/authoring/testing/run-vehicle.d.ts +1 -0
- package/dist/bounded-contexts/authoring/testing/run-vehicle.js +4 -0
- package/dist/bounded-contexts/runner-hosting/infrastructure/in/bootstrap-bridge.d.ts +3 -0
- package/dist/bounded-contexts/runner-hosting/infrastructure/in/bootstrap-bridge.js +4 -0
- package/dist/bounded-contexts/runner-hosting/infrastructure/in/runner.js +52 -13
- package/dist/bounded-contexts/runner-hosting/infrastructure/in/single-instance-probe.d.ts +14 -3
- package/dist/bounded-contexts/runner-hosting/infrastructure/in/single-instance-probe.js +17 -8
- package/dist/conformance/index.d.ts +1 -1
- package/dist/conformance/index.js +1 -1
- package/dist/runner-manifest.json +37 -13
- package/dist/shared-kernel/wire-protocol.d.ts +1 -1
- package/dist/shared-kernel/wire-protocol.js +1 -1
- package/package.json +1 -1
|
@@ -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>[]>;
|
|
@@ -68,3 +68,18 @@ const yamlDialect = withOps(baseDialect, opsPack);
|
|
|
68
68
|
export function find(path) {
|
|
69
69
|
return yamlDialect.find(path);
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Opens every file `pattern` matches that this dialect edits, ordered by path; a file of any
|
|
73
|
+
* other extension is left out without an error (A-132). Resolves `[]` when none matches. The
|
|
74
|
+
* pattern syntax and `ignore` are commons `glob`'s, and it sees the run as `find` does.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* import * as yaml from "@pbuilder/sdk/yaml";
|
|
78
|
+
*
|
|
79
|
+
* export const run = async () => {
|
|
80
|
+
* for (const file of await yaml.glob("**\/*.{yml,yaml}")) await file.read();
|
|
81
|
+
* };
|
|
82
|
+
*/
|
|
83
|
+
export function glob(pattern, options) {
|
|
84
|
+
return yamlDialect.glob(pattern, options);
|
|
85
|
+
}
|
|
@@ -18,3 +18,20 @@ export interface ConformanceReport {
|
|
|
18
18
|
* if (!report.passed) console.log(report.failures.map((failure) => failure.case));
|
|
19
19
|
*/
|
|
20
20
|
export declare function checkDialectPackage(dir: string): Promise<ConformanceReport>;
|
|
21
|
+
export interface LocalDialect {
|
|
22
|
+
/** The key of the dialect's declaration in the Manifest. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** The dialect's base file, the module that exports the Dialect. */
|
|
25
|
+
path: string;
|
|
26
|
+
/** The file that exports the dialect's conformance fixture data. */
|
|
27
|
+
conformance: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Runs the conformance fixture of a local dialect (CA-18). The fixture data must test a Dialect
|
|
31
|
+
* named after the declaration's key and exported by the base file, and sit in the base file's
|
|
32
|
+
* folder. Throws only when a module the fixture imports cannot be resolved.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* const report = await checkLocalDialect({ name: "ini", path: "/ws/dialects/ini/index.ts", conformance: "/ws/dialects/ini/conformance.ts" });
|
|
36
|
+
*/
|
|
37
|
+
export declare function checkLocalDialect({ name, path, conformance }: LocalDialect): Promise<ConformanceReport>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// CA-13 / A-16: runs the conformance fixture a dialect
|
|
2
|
-
// report names each broken check by a fixed case and reason, never by the fixture's own message,
|
|
1
|
+
// CA-13 / CA-18 / A-16: runs the conformance fixture of a dialect, published (`<pkg>/conformance`)
|
|
2
|
+
// or local (the file its declaration names). The report names each broken check by a fixed case and reason, never by the fixture's own message,
|
|
3
3
|
// which may carry the author's samples or the text of an error their code threw (A-87).
|
|
4
4
|
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
5
5
|
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
@@ -9,8 +9,8 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
9
9
|
}
|
|
10
10
|
return path;
|
|
11
11
|
};
|
|
12
|
-
import { readFileSync } from "node:fs";
|
|
13
|
-
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
12
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
13
|
+
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
14
14
|
import { pathToFileURL } from "node:url";
|
|
15
15
|
import { testDialect } from "./index.js";
|
|
16
16
|
const FIXTURE_MISSING = {
|
|
@@ -25,6 +25,14 @@ const NAME_MISMATCH = {
|
|
|
25
25
|
case: "name_mismatch",
|
|
26
26
|
reason: "A-16: the dialect's name is not the name of its package",
|
|
27
27
|
};
|
|
28
|
+
const LOCAL_NAME_MISMATCH = {
|
|
29
|
+
case: "name_mismatch",
|
|
30
|
+
reason: "A-16: the dialect's name is not the key of its declaration",
|
|
31
|
+
};
|
|
32
|
+
const BASE_MISMATCH = {
|
|
33
|
+
case: "base_mismatch",
|
|
34
|
+
reason: "A-16: the fixture data tests a Dialect other than the one its base file exports",
|
|
35
|
+
};
|
|
28
36
|
// Matched against testDialect's own message text, first match wins.
|
|
29
37
|
const CHECKS = [
|
|
30
38
|
["REQ-DC-08", { case: "real_parse", reason: "A-11: parse must return an AST distinct from the source" }],
|
|
@@ -37,21 +45,33 @@ const CHECKS = [
|
|
|
37
45
|
["astLibrary runtime library mismatch", { case: "module_shape", reason: "A-11: the module's astLibrary must be the adapter's own library" }],
|
|
38
46
|
];
|
|
39
47
|
const FIXTURE_THREW = { case: "fixture_threw", reason: "A-11: the fixture's own code threw while it ran" };
|
|
48
|
+
const BASE_THREW = { case: "fixture_threw", reason: "A-16: the dialect's base file threw while it loaded" };
|
|
40
49
|
function classify(err) {
|
|
41
50
|
const message = err instanceof Error ? err.message : "";
|
|
42
51
|
return CHECKS.find(([marker]) => message.includes(marker))?.[1] ?? FIXTURE_THREW;
|
|
43
52
|
}
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
const CONDITIONS = ["bun", "import", "default"];
|
|
54
|
+
// The engine's pointer dir (pointerdir.go) picks targets the same way, so the base file the fixture
|
|
55
|
+
// checks is the file the Run loads.
|
|
56
|
+
function pick(target) {
|
|
57
|
+
if (typeof target === "string")
|
|
58
|
+
return target;
|
|
59
|
+
if (typeof target !== "object" || target === null || Array.isArray(target))
|
|
46
60
|
return undefined;
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
for (const condition of CONDITIONS) {
|
|
62
|
+
const picked = pick(target[condition]);
|
|
63
|
+
if (picked !== undefined)
|
|
64
|
+
return picked;
|
|
65
|
+
}
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
// Only a subpath map can export `./conformance`, so a package with a fixture always picks its base
|
|
69
|
+
// file from `exports["."]`; with nothing there it has none and never falls back to `main`.
|
|
70
|
+
function exportTarget(pkg, subpath) {
|
|
71
|
+
const exports = pkg.exports;
|
|
72
|
+
if (typeof exports !== "object" || exports === null || !Object.keys(exports).some((key) => key.startsWith(".")))
|
|
51
73
|
return undefined;
|
|
52
|
-
|
|
53
|
-
const target = conditions.bun ?? conditions.import ?? conditions.default;
|
|
54
|
-
return typeof target === "string" ? target : undefined;
|
|
74
|
+
return pick(exports[subpath]);
|
|
55
75
|
}
|
|
56
76
|
// A resolution failure says the install is incomplete, not that the dialect is wrong.
|
|
57
77
|
function isUnresolvedModule(err) {
|
|
@@ -66,58 +86,76 @@ function isInside(dir, file) {
|
|
|
66
86
|
const path = relative(dir, file);
|
|
67
87
|
return path !== "" && !path.startsWith("..") && !isAbsolute(path);
|
|
68
88
|
}
|
|
89
|
+
// As the pointer dir: a "./" target whose real path stays inside the package, with no probing.
|
|
90
|
+
function baseFile(dir, target) {
|
|
91
|
+
if (target === undefined || !target.startsWith("./"))
|
|
92
|
+
return undefined;
|
|
93
|
+
try {
|
|
94
|
+
const file = realpathSync(resolve(dir, target));
|
|
95
|
+
return isInside(realpathSync(dir), file) ? file : undefined;
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
69
101
|
function isFixture(value) {
|
|
70
102
|
if (typeof value !== "object" || value === null)
|
|
71
103
|
return false;
|
|
72
104
|
const fixture = value;
|
|
73
105
|
return typeof fixture.dialect === "object" && fixture.dialect !== null && Array.isArray(fixture.samples);
|
|
74
106
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
* cannot be resolved. Every finding about the dialect is a failure in the report.
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* const report = await checkDialectPackage("/cache/npm/@company/ini-dialect/1.0.0/package");
|
|
82
|
-
* if (!report.passed) console.log(report.failures.map((failure) => failure.case));
|
|
83
|
-
*/
|
|
84
|
-
export async function checkDialectPackage(dir) {
|
|
85
|
-
const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf-8"));
|
|
86
|
-
if (typeof pkg.name !== "string" || pkg.name.length === 0) {
|
|
87
|
-
throw new Error(`pbuilder-conformance: the package.json in --dialect has no name`);
|
|
107
|
+
async function importModule(file) {
|
|
108
|
+
try {
|
|
109
|
+
return { ok: true, value: (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href))) };
|
|
88
110
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (
|
|
111
|
+
catch (err) {
|
|
112
|
+
if (isUnresolvedModule(err))
|
|
113
|
+
throw new Error("pbuilder-conformance: a module the fixture imports could not be resolved");
|
|
114
|
+
return { ok: false };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async function runFixture({ report, fixture: file, folder, absentFile, base, nameMismatch }) {
|
|
118
|
+
if (file === undefined) {
|
|
97
119
|
report.failures.push(FIXTURE_MISSING);
|
|
98
120
|
return report;
|
|
99
121
|
}
|
|
100
|
-
|
|
101
|
-
if (!isInside(dir, file)) {
|
|
122
|
+
if (!isInside(folder, file)) {
|
|
102
123
|
report.failures.push(FIXTURE_INVALID);
|
|
103
124
|
return report;
|
|
104
125
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
fixture = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href))).default;
|
|
108
|
-
}
|
|
109
|
-
catch (err) {
|
|
110
|
-
if (isUnresolvedModule(err))
|
|
126
|
+
if (!existsSync(file)) {
|
|
127
|
+
if (absentFile === "unresolved")
|
|
111
128
|
throw new Error("pbuilder-conformance: a module the fixture imports could not be resolved");
|
|
129
|
+
report.failures.push(FIXTURE_MISSING);
|
|
130
|
+
return report;
|
|
131
|
+
}
|
|
132
|
+
// Both checks hold for the file that loads, so a link out of the folder is refused too.
|
|
133
|
+
const real = realpathSync(file);
|
|
134
|
+
if (!isInside(realpathSync(folder), real)) {
|
|
135
|
+
report.failures.push(FIXTURE_INVALID);
|
|
136
|
+
return report;
|
|
137
|
+
}
|
|
138
|
+
// By real path, as the base file: Bun 1.4 can load one file twice under two spellings of its
|
|
139
|
+
// path, and the base check compares the Dialect by reference.
|
|
140
|
+
const loaded = await importModule(real);
|
|
141
|
+
if (!loaded.ok) {
|
|
112
142
|
report.failures.push(FIXTURE_THREW);
|
|
113
143
|
return report;
|
|
114
144
|
}
|
|
145
|
+
const fixture = loaded.value.default;
|
|
115
146
|
if (!isFixture(fixture)) {
|
|
116
147
|
report.failures.push(FIXTURE_INVALID);
|
|
117
148
|
return report;
|
|
118
149
|
}
|
|
119
|
-
if (fixture.dialect.name !==
|
|
120
|
-
report.failures.push(
|
|
150
|
+
if (fixture.dialect.name !== report.dialect)
|
|
151
|
+
report.failures.push(nameMismatch);
|
|
152
|
+
const baseModule = base !== undefined && existsSync(base) ? await importModule(base) : undefined;
|
|
153
|
+
if (baseModule !== undefined && !baseModule.ok) {
|
|
154
|
+
report.failures.push(BASE_THREW);
|
|
155
|
+
return report;
|
|
156
|
+
}
|
|
157
|
+
if (baseModule === undefined || !Object.values(baseModule.value).includes(fixture.dialect))
|
|
158
|
+
report.failures.push(BASE_MISMATCH);
|
|
121
159
|
try {
|
|
122
160
|
await testDialect(fixture);
|
|
123
161
|
}
|
|
@@ -127,3 +165,45 @@ export async function checkDialectPackage(dir) {
|
|
|
127
165
|
report.passed = report.failures.length === 0;
|
|
128
166
|
return report;
|
|
129
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Loads the fixture of the dialect package in `dir` and runs it. Throws only when the fixture
|
|
170
|
+
* cannot run: the package.json is unreadable or has no name, or a module the fixture imports
|
|
171
|
+
* cannot be resolved. Every finding about the dialect is a failure in the report.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* const report = await checkDialectPackage("/cache/npm/@company/ini-dialect/1.0.0/package");
|
|
175
|
+
* if (!report.passed) console.log(report.failures.map((failure) => failure.case));
|
|
176
|
+
*/
|
|
177
|
+
export async function checkDialectPackage(dir) {
|
|
178
|
+
const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf-8"));
|
|
179
|
+
if (typeof pkg.name !== "string" || pkg.name.length === 0) {
|
|
180
|
+
throw new Error(`pbuilder-conformance: the package.json in --dialect has no name`);
|
|
181
|
+
}
|
|
182
|
+
const fixture = exportTarget(pkg, "./conformance");
|
|
183
|
+
return runFixture({
|
|
184
|
+
report: { passed: false, dialect: pkg.name, version: typeof pkg.version === "string" ? pkg.version : "", failures: [] },
|
|
185
|
+
fixture: fixture === undefined ? undefined : resolve(dir, fixture),
|
|
186
|
+
folder: dir,
|
|
187
|
+
absentFile: "unresolved",
|
|
188
|
+
base: baseFile(dir, exportTarget(pkg, ".")),
|
|
189
|
+
nameMismatch: NAME_MISMATCH,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Runs the conformance fixture of a local dialect (CA-18). The fixture data must test a Dialect
|
|
194
|
+
* named after the declaration's key and exported by the base file, and sit in the base file's
|
|
195
|
+
* folder. Throws only when a module the fixture imports cannot be resolved.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* const report = await checkLocalDialect({ name: "ini", path: "/ws/dialects/ini/index.ts", conformance: "/ws/dialects/ini/conformance.ts" });
|
|
199
|
+
*/
|
|
200
|
+
export async function checkLocalDialect({ name, path, conformance }) {
|
|
201
|
+
return runFixture({
|
|
202
|
+
report: { passed: false, dialect: name, version: "", failures: [] },
|
|
203
|
+
fixture: resolve(conformance),
|
|
204
|
+
folder: dirname(resolve(path)),
|
|
205
|
+
absentFile: "missing",
|
|
206
|
+
base: existsSync(path) ? realpathSync(path) : undefined,
|
|
207
|
+
nameMismatch: LOCAL_NAME_MISMATCH,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
@@ -14,4 +14,5 @@ export declare class ContractFake implements EngineClient {
|
|
|
14
14
|
committedTree(): ReadonlyMap<string, string>;
|
|
15
15
|
stagingTree(): ReadonlyMap<string, string>;
|
|
16
16
|
read(filePath: string): Promise<string | undefined>;
|
|
17
|
+
list(pattern: string, ignore?: readonly string[]): Promise<readonly string[]>;
|
|
17
18
|
}
|
|
@@ -8,6 +8,7 @@ import { posix as path } from "node:path";
|
|
|
8
8
|
import { exceedsEmitBatchBudget } from "../domain/valueobjects/wire.js";
|
|
9
9
|
import { EMIT_BATCH_BUDGET_BYTES, EMIT_FRAME_ENVELOPE_ALLOWANCE_BYTES } from "../../../shared-kernel/batch-cap.js";
|
|
10
10
|
import { EmitRejection } from "../domain/ports/emit-rejection.js";
|
|
11
|
+
import { listMatching } from "./glob-pattern.js";
|
|
11
12
|
import { deepEqual } from "../../../platform/deep-equal.js";
|
|
12
13
|
import { CONTRACT_FAKE_PREFIX, ALREADY_EXISTS, USE_FORCE_TO_OVERWRITE, NOT_FOUND, EXCEEDS_SIZE_CAP, ROUND_TRIP_FIDELITY_CHECK, JSON_SERIALIZATION, } from "./rejection-messages.js";
|
|
13
14
|
export class ContractFake {
|
|
@@ -98,6 +99,13 @@ export class ContractFake {
|
|
|
98
99
|
}
|
|
99
100
|
return undefined;
|
|
100
101
|
}
|
|
102
|
+
// Sees staging as read() does: staged and seeded paths, minus the deleted ones.
|
|
103
|
+
async list(pattern, ignore) {
|
|
104
|
+
const present = new Set([...Object.keys(this.#seed), ...this.#tree.keys()]);
|
|
105
|
+
for (const p of this.#deleted)
|
|
106
|
+
present.delete(p);
|
|
107
|
+
return listMatching(present, pattern, ignore);
|
|
108
|
+
}
|
|
101
109
|
#exists(p) {
|
|
102
110
|
if (this.#deleted.has(p))
|
|
103
111
|
return false;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The paths among `files` that `pattern` matches and no `ignore` pattern does, sorted bytewise.
|
|
3
|
+
* Every alternative of `pattern` must stay inside the workspace, as the engine's gate requires.
|
|
4
|
+
*/
|
|
5
|
+
export declare function listMatching(files: Iterable<string>, pattern: string, ignore?: readonly string[]): string[];
|