@shapeshift-labs/frontier-lang-compiler 0.2.110 → 0.2.111
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.
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
JsTsSafeMergeSummary
|
|
8
8
|
} from './js-ts-safe-merge.js';
|
|
9
9
|
import type { JsTsSafeMemberMergePolicy, JsTsSafeMemberMergePolicyRegion } from './js-ts-safe-member-merge.js';
|
|
10
|
+
import type { NativeProjectImportResult, NativeProjectSymbolGraphSummary } from './native-project.js';
|
|
10
11
|
|
|
11
12
|
export type JsTsProjectSafeMergeStatus = 'merged' | 'blocked';
|
|
12
13
|
export type JsTsProjectSafeMergeFileStatus = 'merged' | 'blocked';
|
|
@@ -53,6 +54,7 @@ export interface JsTsProjectSafeMergeInput {
|
|
|
53
54
|
readonly headFiles?: JsTsProjectSafeMergeFileMap;
|
|
54
55
|
readonly allowFileAdditions?: boolean;
|
|
55
56
|
readonly allowFileDeletes?: boolean;
|
|
57
|
+
readonly includeOutputProjectSymbolGraph?: boolean;
|
|
56
58
|
readonly workerChangeSetId?: string;
|
|
57
59
|
readonly headChangeSetId?: string;
|
|
58
60
|
readonly policy?: JsTsSafeMemberMergePolicy | readonly JsTsSafeMemberMergePolicyRegion[];
|
|
@@ -112,6 +114,8 @@ export interface JsTsProjectSafeMergeResult {
|
|
|
112
114
|
readonly status: JsTsProjectSafeMergeStatus;
|
|
113
115
|
readonly files: readonly JsTsProjectSafeMergeFileResult[];
|
|
114
116
|
readonly outputFiles: readonly JsTsProjectSafeMergeOutputFile[];
|
|
117
|
+
readonly outputProjectImport?: NativeProjectImportResult;
|
|
118
|
+
readonly outputProjectSymbolGraph?: NativeProjectSymbolGraphSummary;
|
|
115
119
|
readonly conflicts: readonly JsTsSafeMergeConflict[];
|
|
116
120
|
readonly admission: JsTsProjectSafeMergeAdmission;
|
|
117
121
|
readonly summary: {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { idFragment } from './native-import-utils.js';
|
|
2
|
+
import { createNativeProjectImportResult } from './internal/index-impl/createNativeProjectImportResult.js';
|
|
3
|
+
import { importNativeSource } from './internal/index-impl/importNativeSource.js';
|
|
4
|
+
|
|
5
|
+
function createJsTsProjectSafeMergeGraphArtifacts(input, outputFiles, mergeId) {
|
|
6
|
+
const sources = outputFiles.map((file) => ({
|
|
7
|
+
id: `${mergeId}_output_${idFragment(file.sourcePath)}`,
|
|
8
|
+
language: file.language ?? input.language ?? languageForPath(file.sourcePath),
|
|
9
|
+
sourcePath: file.sourcePath,
|
|
10
|
+
sourceText: file.sourceText,
|
|
11
|
+
metadata: { semanticImportExpected: true, projectSafeMergeOutput: true }
|
|
12
|
+
}));
|
|
13
|
+
const imports = sources.map((source) => importNativeSource(source));
|
|
14
|
+
const projectImport = createNativeProjectImportResult({
|
|
15
|
+
id: `${mergeId}_output_project_import`,
|
|
16
|
+
projectRoot: input.projectRoot,
|
|
17
|
+
sources,
|
|
18
|
+
metadata: {
|
|
19
|
+
projectSafeMergeId: mergeId,
|
|
20
|
+
outputProjectSymbolGraph: true
|
|
21
|
+
}
|
|
22
|
+
}, imports);
|
|
23
|
+
return {
|
|
24
|
+
projectImport,
|
|
25
|
+
projectSymbolGraph: projectImport.projectSymbolGraph
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function languageForPath(sourcePath) {
|
|
30
|
+
const path = String(sourcePath ?? '').toLowerCase();
|
|
31
|
+
if (path.endsWith('.js') || path.endsWith('.jsx') || path.endsWith('.mjs') || path.endsWith('.cjs')) return 'javascript';
|
|
32
|
+
return 'typescript';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { createJsTsProjectSafeMergeGraphArtifacts };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { hashSemanticValue } from '@shapeshift-labs/frontier-lang-kernel';
|
|
2
2
|
import { safeMergeJsTsSource } from './js-ts-safe-merge-composed.js';
|
|
3
3
|
import { compactRecord } from './js-ts-safe-merge-context.js';
|
|
4
|
+
import { createJsTsProjectSafeMergeGraphArtifacts } from './js-ts-safe-project-merge-graph.js';
|
|
4
5
|
|
|
5
6
|
function safeMergeJsTsProject(input = {}) {
|
|
6
7
|
const id = String(input.id ?? 'js_ts_project_safe_merge');
|
|
@@ -18,6 +19,9 @@ function safeMergeJsTsProject(input = {}) {
|
|
|
18
19
|
operation: file.operation
|
|
19
20
|
}));
|
|
20
21
|
const reasonCodes = uniqueStrings(blockedFiles.flatMap((file) => file.admission.reasonCodes));
|
|
22
|
+
const graphArtifacts = status === 'merged' && input.includeOutputProjectSymbolGraph
|
|
23
|
+
? createJsTsProjectSafeMergeGraphArtifacts(input, outputFiles, id)
|
|
24
|
+
: undefined;
|
|
21
25
|
const core = {
|
|
22
26
|
kind: 'frontier.lang.jsTsProjectSafeMerge',
|
|
23
27
|
version: 1,
|
|
@@ -26,6 +30,8 @@ function safeMergeJsTsProject(input = {}) {
|
|
|
26
30
|
status,
|
|
27
31
|
files: fileResults,
|
|
28
32
|
outputFiles,
|
|
33
|
+
outputProjectImport: graphArtifacts?.projectImport,
|
|
34
|
+
outputProjectSymbolGraph: graphArtifacts?.projectSymbolGraph,
|
|
29
35
|
conflicts: fileResults.flatMap((file) => file.conflicts),
|
|
30
36
|
admission: {
|
|
31
37
|
status: status === 'merged' ? 'auto-merge-candidate' : 'blocked',
|
|
@@ -43,6 +49,7 @@ function safeMergeJsTsProject(input = {}) {
|
|
|
43
49
|
headChangeSetId: input.headChangeSetId,
|
|
44
50
|
projectRoot: input.projectRoot,
|
|
45
51
|
filesInput: Array.isArray(input.files) ? 'records' : 'maps',
|
|
52
|
+
outputProjectSymbolGraph: Boolean(graphArtifacts?.projectSymbolGraph),
|
|
46
53
|
autoMergeClaim: false,
|
|
47
54
|
semanticEquivalenceClaim: false
|
|
48
55
|
})
|
package/package.json
CHANGED