@spine-event-engine/proto-tools 2.0.0-snapshot.10
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/LICENSE +201 -0
- package/README.md +103 -0
- package/REFERENCE.md +90 -0
- package/bin/spine-proto.mjs +2 -0
- package/dist/src/cli/spine-proto-bootstrap.d.ts +4 -0
- package/dist/src/cli/spine-proto-bootstrap.d.ts.map +1 -0
- package/dist/src/cli/spine-proto-bootstrap.js +52 -0
- package/dist/src/cli/spine-proto-bootstrap.js.map +1 -0
- package/dist/src/cli/spine-proto.d.ts +3 -0
- package/dist/src/cli/spine-proto.d.ts.map +1 -0
- package/dist/src/cli/spine-proto.js +32 -0
- package/dist/src/cli/spine-proto.js.map +1 -0
- package/dist/src/generation/authored-interface-provider.d.ts +28 -0
- package/dist/src/generation/authored-interface-provider.d.ts.map +1 -0
- package/dist/src/generation/authored-interface-provider.js +244 -0
- package/dist/src/generation/authored-interface-provider.js.map +1 -0
- package/dist/src/generation/build-time-handler-analyzer.d.ts +195 -0
- package/dist/src/generation/build-time-handler-analyzer.d.ts.map +1 -0
- package/dist/src/generation/build-time-handler-analyzer.js +1308 -0
- package/dist/src/generation/build-time-handler-analyzer.js.map +1 -0
- package/dist/src/generation/generated-registry-writer.d.ts +58 -0
- package/dist/src/generation/generated-registry-writer.d.ts.map +1 -0
- package/dist/src/generation/generated-registry-writer.js +465 -0
- package/dist/src/generation/generated-registry-writer.js.map +1 -0
- package/dist/src/generation/generated-source-policy.d.ts +21 -0
- package/dist/src/generation/generated-source-policy.d.ts.map +1 -0
- package/dist/src/generation/generated-source-policy.js +126 -0
- package/dist/src/generation/generated-source-policy.js.map +1 -0
- package/dist/src/generation/generation-reuse.mjs +106 -0
- package/dist/src/generation/generator.d.ts +195 -0
- package/dist/src/generation/generator.d.ts.map +1 -0
- package/dist/src/generation/generator.js +566 -0
- package/dist/src/generation/generator.js.map +1 -0
- package/dist/src/generation/handler-codegen.d.ts +48 -0
- package/dist/src/generation/handler-codegen.d.ts.map +1 -0
- package/dist/src/generation/handler-codegen.js +214 -0
- package/dist/src/generation/handler-codegen.js.map +1 -0
- package/dist/src/generation/handler-generator.d.ts +7 -0
- package/dist/src/generation/handler-generator.d.ts.map +1 -0
- package/dist/src/generation/handler-generator.js +55 -0
- package/dist/src/generation/handler-generator.js.map +1 -0
- package/dist/src/generation/interface-generator.d.ts +21 -0
- package/dist/src/generation/interface-generator.d.ts.map +1 -0
- package/dist/src/generation/interface-generator.js +277 -0
- package/dist/src/generation/interface-generator.js.map +1 -0
- package/dist/src/generation/interface-provider.d.ts +30 -0
- package/dist/src/generation/interface-provider.d.ts.map +1 -0
- package/dist/src/generation/interface-provider.js +15 -0
- package/dist/src/generation/interface-provider.js.map +1 -0
- package/dist/src/generation/rejection-generator.d.ts +9 -0
- package/dist/src/generation/rejection-generator.d.ts.map +1 -0
- package/dist/src/generation/rejection-generator.js +62 -0
- package/dist/src/generation/rejection-generator.js.map +1 -0
- package/dist/src/generation/source-view.d.ts +103 -0
- package/dist/src/generation/source-view.d.ts.map +1 -0
- package/dist/src/generation/source-view.js +298 -0
- package/dist/src/generation/source-view.js.map +1 -0
- package/dist/src/index.d.ts +139 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +546 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/io/atomic-manifest.d.ts +32 -0
- package/dist/src/io/atomic-manifest.d.ts.map +1 -0
- package/dist/src/io/atomic-manifest.js +56 -0
- package/dist/src/io/atomic-manifest.js.map +1 -0
- package/dist/src/io/manifest-reader.d.ts +8 -0
- package/dist/src/io/manifest-reader.d.ts.map +1 -0
- package/dist/src/io/manifest-reader.js +19 -0
- package/dist/src/io/manifest-reader.js.map +1 -0
- package/dist/src/model/model-graph.d.ts +68 -0
- package/dist/src/model/model-graph.d.ts.map +1 -0
- package/dist/src/model/model-graph.js +220 -0
- package/dist/src/model/model-graph.js.map +1 -0
- package/dist/src/model/npm-package-name.d.ts +7 -0
- package/dist/src/model/npm-package-name.d.ts.map +1 -0
- package/dist/src/model/npm-package-name.js +33 -0
- package/dist/src/model/npm-package-name.js.map +1 -0
- package/dist/src/model/registry-dependency.d.ts +10 -0
- package/dist/src/model/registry-dependency.d.ts.map +1 -0
- package/dist/src/model/registry-dependency.js +66 -0
- package/dist/src/model/registry-dependency.js.map +1 -0
- package/dist/src/testing/index.d.ts +8 -0
- package/dist/src/testing/index.d.ts.map +1 -0
- package/dist/src/testing/index.js +20 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +54 -0
- package/scripts/clean-dist.mjs +7 -0
- package/scripts/copy-runtime-modules.mjs +23 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DescMessage } from "@bufbuild/protobuf";
|
|
2
|
+
import type { ModelSourceView } from "./source-view.js";
|
|
3
|
+
/**
|
|
4
|
+
* A resolved authored interface declaration supplied by an authored-interface provider.
|
|
5
|
+
*/
|
|
6
|
+
export interface AuthoredInterfaceDeclaration {
|
|
7
|
+
/**
|
|
8
|
+
* Public TypeScript identifier of the authored interface.
|
|
9
|
+
*/
|
|
10
|
+
readonly name: string;
|
|
11
|
+
/**
|
|
12
|
+
* Module specifier from which the authored interface is imported.
|
|
13
|
+
*/
|
|
14
|
+
readonly importPath: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolves authored interface declarations for generated message membership.
|
|
18
|
+
*/
|
|
19
|
+
export interface InterfaceDeclarationProvider {
|
|
20
|
+
/**
|
|
21
|
+
* Resolves one compatible authored interface declaration, if available.
|
|
22
|
+
*
|
|
23
|
+
* @param name The requested generated TypeScript interface name.
|
|
24
|
+
* @param members Concrete generated message members of that interface.
|
|
25
|
+
* @param sourceView The validated compiler input view, when generation supplies one.
|
|
26
|
+
* @returns The authored declaration to alias, or `undefined` when unresolved.
|
|
27
|
+
*/
|
|
28
|
+
resolve(name: string, members: readonly DescMessage[], sourceView: ModelSourceView | undefined): AuthoredInterfaceDeclaration | undefined;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=interface-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface-provider.d.ts","sourceRoot":"","sources":["../../../src/generation/interface-provider.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAG3C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAItB;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAG3C;;;;;;;OAOG;IACH,OAAO,CACL,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,WAAW,EAAE,EAC/B,UAAU,EAAE,eAAe,GAAG,SAAS,GACtC,4BAA4B,GAAG,SAAS,CAAC;CAC7C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, CodeMatters. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
5
|
+
* in compliance with the License. You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
10
|
+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
11
|
+
* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
|
+
* the License.
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=interface-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface-provider.js","sourceRoot":"","sources":["../../../src/generation/interface-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Schema } from "@bufbuild/protoplugin";
|
|
2
|
+
/**
|
|
3
|
+
* Generates typed throwable companions for top-level owned rejection messages.
|
|
4
|
+
*/
|
|
5
|
+
export declare const RejectionGenerator: Readonly<{
|
|
6
|
+
generateCompanions(schema: Schema): void;
|
|
7
|
+
tsDoc(comment: string | undefined): string;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=rejection-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rejection-generator.d.ts","sourceRoot":"","sources":["../../../src/generation/rejection-generator.ts"],"names":[],"mappings":"AAcA,OAAO,EAAkD,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAIpG;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC;IACxC,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;CAC5C,CAoDC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, CodeMatters. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
5
|
+
* in compliance with the License. You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
10
|
+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
11
|
+
* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
|
+
* the License.
|
|
13
|
+
*/
|
|
14
|
+
import { createEcmaScriptPlugin, getComments, runNodeJs } from "@bufbuild/protoplugin";
|
|
15
|
+
import { fileURLToPath } from "node:url";
|
|
16
|
+
import { resolve } from "node:path";
|
|
17
|
+
/**
|
|
18
|
+
* Generates typed throwable companions for top-level owned rejection messages.
|
|
19
|
+
*/
|
|
20
|
+
export const RejectionGenerator = Object.freeze({
|
|
21
|
+
generateCompanions(schema) {
|
|
22
|
+
for (const file of schema.files) {
|
|
23
|
+
const sourceName = file.proto.name.split(/[\\/]/u).at(-1);
|
|
24
|
+
const usesRejectionName = sourceName === "rejections.proto" || sourceName?.endsWith("_rejections.proto") === true;
|
|
25
|
+
if (!usesRejectionName || file.proto.name.startsWith("spine/delivery/"))
|
|
26
|
+
continue;
|
|
27
|
+
const messages = file.messages.filter((message) => message.parent === undefined);
|
|
28
|
+
if (messages.length === 0)
|
|
29
|
+
continue;
|
|
30
|
+
const output = schema.generateFile(`${file.name}.ts`);
|
|
31
|
+
const throwable = output.import("RejectionThrowable", "@spine-event-engine/core");
|
|
32
|
+
const messageInit = output.import("MessageInitShape", "@bufbuild/protobuf", true);
|
|
33
|
+
output.preamble(file);
|
|
34
|
+
for (const message of messages) {
|
|
35
|
+
const messageSchema = output.importSchema(message);
|
|
36
|
+
output.print(RejectionGenerator.tsDoc(getComments(message).leading), output.export("const", message.name), ": { readonly create: (input: ", messageInit, "<typeof ", messageSchema, ">) => ", throwable, "<typeof ", messageSchema, "> } = {\n create(input) {\n return ", throwable, ".create(", messageSchema, ", input);\n },\n};\n");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Renders a leading Proto comment as deterministic TypeScript documentation.
|
|
42
|
+
*/
|
|
43
|
+
tsDoc(comment) {
|
|
44
|
+
const lines = (comment ?? "Creates this rejection throwable.")
|
|
45
|
+
.replaceAll("*/", "*/")
|
|
46
|
+
.split(/\r?\n/u)
|
|
47
|
+
.map((line) => line
|
|
48
|
+
.trim()
|
|
49
|
+
.replace(/^\/\/\s?/u, "")
|
|
50
|
+
.replace(/^@/u, "\\@"))
|
|
51
|
+
.filter(Boolean);
|
|
52
|
+
return `/**\n * ${lines.join(" ") || "Creates this rejection throwable."}\n */\n`;
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
const rejectionPlugin = createEcmaScriptPlugin({
|
|
56
|
+
name: "protoc-gen-spine-rejections",
|
|
57
|
+
version: "1.0.0",
|
|
58
|
+
generateTs: RejectionGenerator.generateCompanions,
|
|
59
|
+
});
|
|
60
|
+
if (process.argv[1] !== undefined && resolve(process.argv[1]) === fileURLToPath(import.meta.url))
|
|
61
|
+
runNodeJs(rejectionPlugin);
|
|
62
|
+
//# sourceMappingURL=rejection-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rejection-generator.js","sourceRoot":"","sources":["../../../src/generation/rejection-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,SAAS,EAAe,MAAM,uBAAuB,CAAC;AACpG,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAG1B,MAAM,CAAC,MAAM,CAAC;IACjB,kBAAkB,CAAC,MAAc;QAC/B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YAChC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1D,MAAM,iBAAiB,GACrB,UAAU,KAAK,kBAAkB,IAAI,UAAU,EAAE,QAAQ,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;YAC1F,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CA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I,EAAE,EAAE,CACZ,IAAI;aACD,IAAI,EAAE;aACN,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;aACxB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CACzB;aACA,MAAM,CAAC,OAAO,CAAC,CAAC;QACnB,OAAO,WAAW,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,mCAAmC,SAAS,CAAC;IACpF,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,sBAAsB,CAAC;IAC7C,IAAI,EAAE,6BAA6B;IACnC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,kBAAkB,CAAC,kBAAkB;CAClD,CAAC,CAAC;AAEH,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;IAC9F,SAAS,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Race-safe reads for files owned by a compiler source view.
|
|
3
|
+
*/
|
|
4
|
+
export declare const SourceViewInputs: Readonly<{
|
|
5
|
+
read(path: string): Buffer;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Stable compiler input view for authored sources and staged generated output.
|
|
9
|
+
*/
|
|
10
|
+
export interface ModelSourceView {
|
|
11
|
+
/**
|
|
12
|
+
* Eligible authored TypeScript files, excluding generated publication trees.
|
|
13
|
+
*/
|
|
14
|
+
readonly authoredFiles: readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* Complete same-module compiler inputs, including declarations and allowed JavaScript.
|
|
17
|
+
*/
|
|
18
|
+
readonly compilerFiles?: readonly string[];
|
|
19
|
+
/**
|
|
20
|
+
* Absolute model package root used to resolve authored imports.
|
|
21
|
+
*/
|
|
22
|
+
readonly packageRoot: string;
|
|
23
|
+
/**
|
|
24
|
+
* Canonical live generated root excluded from authored-interface candidates.
|
|
25
|
+
*/
|
|
26
|
+
readonly liveGeneratedRoot: string;
|
|
27
|
+
/**
|
|
28
|
+
* Redirect root used when compiler imports address generated model sources.
|
|
29
|
+
*/
|
|
30
|
+
readonly stagedGeneratedRoot: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Internal source view carrying the required publication revalidation digest.
|
|
34
|
+
*/
|
|
35
|
+
export interface PublicationSourceView extends ModelSourceView {
|
|
36
|
+
/**
|
|
37
|
+
* Complete same-module compiler inputs captured by the publication transaction.
|
|
38
|
+
*/
|
|
39
|
+
readonly compilerFiles: readonly string[];
|
|
40
|
+
/**
|
|
41
|
+
* Fingerprint of configured authored sources and recursive TypeScript configuration inputs.
|
|
42
|
+
*/
|
|
43
|
+
readonly inventoryDigest: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Fixed internal handoff retained by a root model-generation transaction.
|
|
47
|
+
*/
|
|
48
|
+
export interface SourceViewPublicationRecord {
|
|
49
|
+
/**
|
|
50
|
+
* Fixed internal record format version.
|
|
51
|
+
*/
|
|
52
|
+
readonly formatVersion: 1;
|
|
53
|
+
/**
|
|
54
|
+
* SHA-256 fingerprint of the live authored-source and configuration inventory.
|
|
55
|
+
*/
|
|
56
|
+
readonly inventoryDigest: string;
|
|
57
|
+
/**
|
|
58
|
+
* Canonical live generated root excluded from the inventory.
|
|
59
|
+
*/
|
|
60
|
+
readonly liveGeneratedRoot: string;
|
|
61
|
+
/**
|
|
62
|
+
* Canonical live model package root used to recompute the inventory.
|
|
63
|
+
*/
|
|
64
|
+
readonly livePackageRoot: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Checks that the immutable authored-source inventory is current before publication.
|
|
68
|
+
*
|
|
69
|
+
* @param sourceView Compiler input snapshot captured before generation.
|
|
70
|
+
*/
|
|
71
|
+
export declare function assertSourceViewCurrent(sourceView: PublicationSourceView): void;
|
|
72
|
+
/**
|
|
73
|
+
* Writes the fixed internal source-view handoff for an outer generation stage.
|
|
74
|
+
*
|
|
75
|
+
* @param stageRoot Outer staged model package root.
|
|
76
|
+
* @param sourceView Captured live-authored/staged-generated source view.
|
|
77
|
+
*/
|
|
78
|
+
export declare function writeViewRecord(stageRoot: string, sourceView: PublicationSourceView): void;
|
|
79
|
+
/**
|
|
80
|
+
* Reads one bounded root-transaction source-view handoff.
|
|
81
|
+
*
|
|
82
|
+
* @param stageRoot Outer staged model package root.
|
|
83
|
+
* @param expectedLivePackageRoot Canonical selected live model package root.
|
|
84
|
+
* @param expectedLiveGeneratedRoot Canonical selected live generated root.
|
|
85
|
+
* @returns Validated immutable internal handoff.
|
|
86
|
+
*/
|
|
87
|
+
export declare function readViewRecord(stageRoot: string, expectedLivePackageRoot: string, expectedLiveGeneratedRoot: string): SourceViewPublicationRecord;
|
|
88
|
+
/**
|
|
89
|
+
* Rejects a changed live source/configuration inventory captured in a handoff.
|
|
90
|
+
*
|
|
91
|
+
* @param record Validated internal root-transaction handoff.
|
|
92
|
+
*/
|
|
93
|
+
export declare function assertViewRecordCurrent(record: SourceViewPublicationRecord): void;
|
|
94
|
+
/**
|
|
95
|
+
* Creates a live-authored/staged-generated compiler source view.
|
|
96
|
+
*
|
|
97
|
+
* @param packageRoot Model package root.
|
|
98
|
+
* @param generatedRoot Configured live generated root.
|
|
99
|
+
* @param stagedGeneratedRoot Generated tree inside the current stage.
|
|
100
|
+
* @returns Authored compiler candidates and the staged generated redirect root.
|
|
101
|
+
*/
|
|
102
|
+
export declare function modelSourceView(packageRoot: string, generatedRoot: string, stagedGeneratedRoot: string): PublicationSourceView;
|
|
103
|
+
//# sourceMappingURL=source-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-view.d.ts","sourceRoot":"","sources":["../../../src/generation/source-view.ts"],"names":[],"mappings":"AAsCA;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC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ACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,2BAA2B,GAAG,IAAI,CASjF;AA6DD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,mBAAmB,EAAE,MAAM,GAC1B,qBAAqB,CAavB"}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, CodeMatters. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
5
|
+
* in compliance with the License. You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
10
|
+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
11
|
+
* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
|
+
* the License.
|
|
13
|
+
*/
|
|
14
|
+
import { createHash } from "node:crypto";
|
|
15
|
+
import { closeSync, constants, existsSync, fstatSync, lstatSync, openSync, realpathSync, readFileSync, readdirSync, writeFileSync, } from "node:fs";
|
|
16
|
+
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
17
|
+
import ts from "typescript";
|
|
18
|
+
const maximumSourceViewDepth = 32;
|
|
19
|
+
const maximumSourceViewEntries = 10_000;
|
|
20
|
+
const recordFileName = ".spine-source-view-publication.json";
|
|
21
|
+
const recordFormat = 1;
|
|
22
|
+
const maximumRecordBytes = 16 * 1024;
|
|
23
|
+
const nonRegularInputDiagnostic = "spine-proto: source view contains non-regular TypeScript input";
|
|
24
|
+
/**
|
|
25
|
+
* Race-safe reads for files owned by a compiler source view.
|
|
26
|
+
*/
|
|
27
|
+
export const SourceViewInputs = Object.freeze({
|
|
28
|
+
// prettier-ignore
|
|
29
|
+
/**
|
|
30
|
+
* Opens without following the final symlink or waiting on a special file,
|
|
31
|
+
* validates the opened descriptor, and reads that immutable file identity.
|
|
32
|
+
*
|
|
33
|
+
* @param path Source or configuration path.
|
|
34
|
+
* @returns Exact file bytes.
|
|
35
|
+
*/
|
|
36
|
+
read(path) {
|
|
37
|
+
let descriptor;
|
|
38
|
+
try {
|
|
39
|
+
descriptor = openSync(path, constants.O_RDONLY | constants.O_NONBLOCK | constants.O_NOFOLLOW);
|
|
40
|
+
if (!fstatSync(descriptor).isFile())
|
|
41
|
+
throw new Error(nonRegularInputDiagnostic);
|
|
42
|
+
return readFileSync(descriptor);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (error instanceof Error && error.message === nonRegularInputDiagnostic)
|
|
46
|
+
throw error;
|
|
47
|
+
throw new Error(nonRegularInputDiagnostic, { cause: error });
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
if (descriptor !== undefined)
|
|
51
|
+
closeSync(descriptor);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
function projectConfig(root) {
|
|
56
|
+
const configPath = join(root, "tsconfig.json");
|
|
57
|
+
if (!existsSync(configPath))
|
|
58
|
+
return undefined;
|
|
59
|
+
const texts = new Map();
|
|
60
|
+
const host = {
|
|
61
|
+
...ts.sys,
|
|
62
|
+
readFile: (path) => {
|
|
63
|
+
const text = SourceViewInputs.read(path).toString("utf8");
|
|
64
|
+
texts.set(resolve(path), text);
|
|
65
|
+
return text;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
const source = ts.readJsonConfigFile(configPath, host.readFile);
|
|
69
|
+
const parsed = ts.parseJsonSourceFileConfigFileContent(source, host, root, undefined, configPath, undefined, undefined, new Map());
|
|
70
|
+
if (parsed.errors.some((diagnostic) => diagnostic.code !== 18002 && diagnostic.code !== 18003))
|
|
71
|
+
throw new Error("spine-proto: source view has invalid tsconfig.json");
|
|
72
|
+
const extended = source
|
|
73
|
+
.extendedSourceFiles ?? [];
|
|
74
|
+
const files = [source.fileName, ...extended]
|
|
75
|
+
.map((file) => resolve(file))
|
|
76
|
+
.filter((file, index, values) => values.indexOf(file) === index)
|
|
77
|
+
.sort();
|
|
78
|
+
for (const file of files)
|
|
79
|
+
if (!texts.has(file))
|
|
80
|
+
texts.set(file, SourceViewInputs.read(file).toString("utf8"));
|
|
81
|
+
return Object.freeze({
|
|
82
|
+
allowJs: parsed.options.allowJs === true,
|
|
83
|
+
configFiles: Object.freeze(files),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function hashFile(hash, category, file) {
|
|
87
|
+
const content = SourceViewInputs.read(file);
|
|
88
|
+
hash.update(`${String(category.length)}:${category}${String(file.length)}:${file}${String(content.length)}:`);
|
|
89
|
+
hash.update(content);
|
|
90
|
+
}
|
|
91
|
+
function inventoryDigest(files, configs = []) {
|
|
92
|
+
const hash = createHash("sha256");
|
|
93
|
+
for (const file of files)
|
|
94
|
+
hashFile(hash, "source", file);
|
|
95
|
+
for (const config of configs)
|
|
96
|
+
hashFile(hash, "config", config);
|
|
97
|
+
return hash.digest("hex");
|
|
98
|
+
}
|
|
99
|
+
function sourceInventory(root, generated) {
|
|
100
|
+
const generatedDirectory = dirname(generated);
|
|
101
|
+
const generatedName = basename(generated);
|
|
102
|
+
const excluded = [generated, "dist"];
|
|
103
|
+
const siblingStage = join(generatedDirectory, `.${generatedName}.stage-`);
|
|
104
|
+
const siblingRootTransaction = join(generatedDirectory, `.${generatedName}-`);
|
|
105
|
+
const siblingBackup = join(generatedDirectory, `.${generatedName}.`);
|
|
106
|
+
const config = projectConfig(root);
|
|
107
|
+
const inputs = collectAuthored(root, [...excluded, siblingStage, siblingRootTransaction, siblingBackup], config?.allowJs);
|
|
108
|
+
const authoredFiles = Object.freeze(inputs.authoredFiles);
|
|
109
|
+
const compilerFiles = Object.freeze(inputs.compilerFiles);
|
|
110
|
+
return Object.freeze({
|
|
111
|
+
authoredFiles,
|
|
112
|
+
compilerFiles,
|
|
113
|
+
digest: inventoryDigest(compilerFiles, config?.configFiles),
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Checks that the immutable authored-source inventory is current before publication.
|
|
118
|
+
*
|
|
119
|
+
* @param sourceView Compiler input snapshot captured before generation.
|
|
120
|
+
*/
|
|
121
|
+
export function assertSourceViewCurrent(sourceView) {
|
|
122
|
+
try {
|
|
123
|
+
const generated = relative(sourceView.packageRoot, sourceView.liveGeneratedRoot);
|
|
124
|
+
const current = sourceInventory(sourceView.packageRoot, generated);
|
|
125
|
+
if (current.digest === sourceView.inventoryDigest)
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
// Report one stable transaction diagnostic for every inventory mutation.
|
|
130
|
+
}
|
|
131
|
+
throw new Error("spine-proto: authored interface source view changed during generation");
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Writes the fixed internal source-view handoff for an outer generation stage.
|
|
135
|
+
*
|
|
136
|
+
* @param stageRoot Outer staged model package root.
|
|
137
|
+
* @param sourceView Captured live-authored/staged-generated source view.
|
|
138
|
+
*/
|
|
139
|
+
export function writeViewRecord(stageRoot, sourceView) {
|
|
140
|
+
writeFileSync(join(stageRoot, recordFileName), `${JSON.stringify({
|
|
141
|
+
formatVersion: recordFormat,
|
|
142
|
+
inventoryDigest: sourceView.inventoryDigest,
|
|
143
|
+
liveGeneratedRoot: sourceView.liveGeneratedRoot,
|
|
144
|
+
livePackageRoot: sourceView.packageRoot,
|
|
145
|
+
})}\n`, "utf8");
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Reads one bounded root-transaction source-view handoff.
|
|
149
|
+
*
|
|
150
|
+
* @param stageRoot Outer staged model package root.
|
|
151
|
+
* @param expectedLivePackageRoot Canonical selected live model package root.
|
|
152
|
+
* @param expectedLiveGeneratedRoot Canonical selected live generated root.
|
|
153
|
+
* @returns Validated immutable internal handoff.
|
|
154
|
+
*/
|
|
155
|
+
export function readViewRecord(stageRoot, expectedLivePackageRoot, expectedLiveGeneratedRoot) {
|
|
156
|
+
const recordPath = join(stageRoot, recordFileName);
|
|
157
|
+
const stagePath = resolve(stageRoot);
|
|
158
|
+
const candidate = resolve(recordPath);
|
|
159
|
+
let stage;
|
|
160
|
+
let regular = false;
|
|
161
|
+
try {
|
|
162
|
+
stage = realpathSync(stagePath);
|
|
163
|
+
regular = lstatSync(candidate).isFile();
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
throw new Error("spine-proto: invalid source-view publication record");
|
|
167
|
+
}
|
|
168
|
+
if (!candidate.startsWith(`${stagePath}/`) || !regular)
|
|
169
|
+
throw new Error("spine-proto: invalid source-view publication record");
|
|
170
|
+
const canonicalRecord = realpathSync(candidate);
|
|
171
|
+
if (!canonicalRecord.startsWith(`${stage}/`))
|
|
172
|
+
throw new Error("spine-proto: invalid source-view publication record");
|
|
173
|
+
let descriptor;
|
|
174
|
+
let raw;
|
|
175
|
+
try {
|
|
176
|
+
descriptor = openSync(canonicalRecord, constants.O_RDONLY | constants.O_NONBLOCK | constants.O_NOFOLLOW);
|
|
177
|
+
const metadata = fstatSync(descriptor);
|
|
178
|
+
if (!metadata.isFile() || metadata.size > maximumRecordBytes)
|
|
179
|
+
throw new Error("spine-proto: invalid source-view publication record");
|
|
180
|
+
raw = JSON.parse(readFileSync(descriptor).toString("utf8"));
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
throw new Error("spine-proto: invalid source-view publication record");
|
|
184
|
+
}
|
|
185
|
+
finally {
|
|
186
|
+
if (descriptor !== undefined)
|
|
187
|
+
closeSync(descriptor);
|
|
188
|
+
}
|
|
189
|
+
if (raw === null || typeof raw !== "object")
|
|
190
|
+
throw new Error("spine-proto: invalid source-view publication record");
|
|
191
|
+
const record = raw;
|
|
192
|
+
const livePackageRoot = realpathSync(expectedLivePackageRoot);
|
|
193
|
+
const expectedGeneratedRelative = relative(resolve(expectedLivePackageRoot), resolve(expectedLiveGeneratedRoot));
|
|
194
|
+
const liveGeneratedRoot = resolve(livePackageRoot, expectedGeneratedRelative);
|
|
195
|
+
if (record.formatVersion !== recordFormat ||
|
|
196
|
+
record.livePackageRoot !== livePackageRoot ||
|
|
197
|
+
record.liveGeneratedRoot !== liveGeneratedRoot ||
|
|
198
|
+
expectedGeneratedRelative === "" ||
|
|
199
|
+
expectedGeneratedRelative.startsWith("..") ||
|
|
200
|
+
typeof record.inventoryDigest !== "string" ||
|
|
201
|
+
!/^[a-f0-9]{64}$/u.test(record.inventoryDigest) ||
|
|
202
|
+
Object.keys(record).sort().join(",") !==
|
|
203
|
+
"formatVersion,inventoryDigest,liveGeneratedRoot,livePackageRoot")
|
|
204
|
+
throw new Error("spine-proto: invalid source-view publication record");
|
|
205
|
+
return Object.freeze({
|
|
206
|
+
formatVersion: recordFormat,
|
|
207
|
+
inventoryDigest: record.inventoryDigest,
|
|
208
|
+
liveGeneratedRoot,
|
|
209
|
+
livePackageRoot,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Rejects a changed live source/configuration inventory captured in a handoff.
|
|
214
|
+
*
|
|
215
|
+
* @param record Validated internal root-transaction handoff.
|
|
216
|
+
*/
|
|
217
|
+
export function assertViewRecordCurrent(record) {
|
|
218
|
+
try {
|
|
219
|
+
const generated = relative(record.livePackageRoot, record.liveGeneratedRoot);
|
|
220
|
+
if (sourceInventory(record.livePackageRoot, generated).digest === record.inventoryDigest)
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
catch {
|
|
224
|
+
// Report one stable transaction diagnostic for every inventory mutation.
|
|
225
|
+
}
|
|
226
|
+
throw new Error("spine-proto: authored interface source view changed during generation");
|
|
227
|
+
}
|
|
228
|
+
function collectAuthored(root, excluded, allowJs = false) {
|
|
229
|
+
const authoredFiles = [];
|
|
230
|
+
const compilerFiles = [];
|
|
231
|
+
const pending = [{ path: root, depth: 0 }];
|
|
232
|
+
let entries = 0;
|
|
233
|
+
while (pending.length > 0) {
|
|
234
|
+
const current = pending.pop();
|
|
235
|
+
if (current === undefined)
|
|
236
|
+
continue;
|
|
237
|
+
if (current.depth > maximumSourceViewDepth)
|
|
238
|
+
throw new Error("spine-proto: source view exceeds bounded traversal");
|
|
239
|
+
for (const name of readdirSync(current.path).sort().reverse()) {
|
|
240
|
+
entries += 1;
|
|
241
|
+
if (entries > maximumSourceViewEntries)
|
|
242
|
+
throw new Error("spine-proto: source view exceeds bounded traversal");
|
|
243
|
+
const path = join(current.path, name);
|
|
244
|
+
const relativePath = relative(root, path);
|
|
245
|
+
if (excluded.some((entry) => relativePath === entry ||
|
|
246
|
+
relativePath.startsWith(`${entry}${sep}`) ||
|
|
247
|
+
relativePath.startsWith(`${entry}-`) ||
|
|
248
|
+
((entry.endsWith(".") || entry.endsWith("-")) && relativePath.startsWith(entry))))
|
|
249
|
+
continue;
|
|
250
|
+
const entry = lstatSync(path);
|
|
251
|
+
const isTypeScript = [".cts", ".mts", ".ts", ".tsx"].some((extension) => name.endsWith(extension));
|
|
252
|
+
const isAllowedJavaScript = allowJs && [".cjs", ".js", ".jsx", ".mjs"].some((extension) => name.endsWith(extension));
|
|
253
|
+
const isCompilerInput = isTypeScript || isAllowedJavaScript;
|
|
254
|
+
if (entry.isSymbolicLink()) {
|
|
255
|
+
if (isCompilerInput)
|
|
256
|
+
throw new Error(nonRegularInputDiagnostic);
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
if (entry.isDirectory())
|
|
260
|
+
pending.push({ path, depth: current.depth + 1 });
|
|
261
|
+
else if (isCompilerInput) {
|
|
262
|
+
if (!entry.isFile())
|
|
263
|
+
throw new Error(nonRegularInputDiagnostic);
|
|
264
|
+
compilerFiles.push(path);
|
|
265
|
+
if (isTypeScript &&
|
|
266
|
+
![".d.cts", ".d.mts", ".d.ts"].some((extension) => name.endsWith(extension)))
|
|
267
|
+
authoredFiles.push(path);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return Object.freeze({
|
|
272
|
+
authoredFiles: Object.freeze(authoredFiles.sort()),
|
|
273
|
+
compilerFiles: Object.freeze(compilerFiles.sort()),
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Creates a live-authored/staged-generated compiler source view.
|
|
278
|
+
*
|
|
279
|
+
* @param packageRoot Model package root.
|
|
280
|
+
* @param generatedRoot Configured live generated root.
|
|
281
|
+
* @param stagedGeneratedRoot Generated tree inside the current stage.
|
|
282
|
+
* @returns Authored compiler candidates and the staged generated redirect root.
|
|
283
|
+
*/
|
|
284
|
+
export function modelSourceView(packageRoot, generatedRoot, stagedGeneratedRoot) {
|
|
285
|
+
const root = realpathSync(resolve(packageRoot));
|
|
286
|
+
const generated = generatedRoot.replaceAll("\\", "/");
|
|
287
|
+
const liveGeneratedRoot = resolve(root, generated);
|
|
288
|
+
const inventory = sourceInventory(root, generated);
|
|
289
|
+
return Object.freeze({
|
|
290
|
+
authoredFiles: inventory.authoredFiles,
|
|
291
|
+
compilerFiles: inventory.compilerFiles,
|
|
292
|
+
inventoryDigest: inventory.digest,
|
|
293
|
+
packageRoot: root,
|
|
294
|
+
liveGeneratedRoot,
|
|
295
|
+
stagedGeneratedRoot: resolve(stagedGeneratedRoot),
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
//# sourceMappingURL=source-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-view.js","sourceRoot":"","sources":["../../../src/generation/source-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE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