@shapeshift-labs/frontier-lang-compiler 0.2.181 → 0.2.182

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.
@@ -185,6 +185,13 @@ function cssModuleUseSiteGraphRecords(importBindings, useSites, blockers) {
185
185
  }
186
186
 
187
187
  function cssModuleUseSiteGraphRecord(cssModuleSourcePath, bindings, graphUseSites, graphBlockers) {
188
+ const jsTsUseSiteGraphHash = hashSemanticValue({
189
+ kind: 'frontier.lang.cssModuleJsTsUseSiteGraph.v1',
190
+ cssModuleSourcePath,
191
+ bindings: bindings.map(cssModuleUseSiteBindingSignature).sort(stableStringCompare),
192
+ useSites: graphUseSites.map(cssModuleUseSiteSignature).sort(stableStringCompare),
193
+ blockers: graphBlockers.map(cssModuleUseSiteBlockerSignature).sort(stableStringCompare)
194
+ });
188
195
  const graphHash = hashSemanticValue({
189
196
  kind: 'frontier.lang.cssModuleUseSiteGraph.v1',
190
197
  cssModuleSourcePath,
@@ -208,6 +215,7 @@ function cssModuleUseSiteGraphRecord(cssModuleSourcePath, bindings, graphUseSite
208
215
  cssModuleExportNamesHash: bindings.find((binding) => binding.cssModuleExportNamesHash)?.cssModuleExportNamesHash,
209
216
  bundlerTransformHash: bindings.find((binding) => binding.bundlerTransformHash)?.bundlerTransformHash,
210
217
  sourceMapProofHash: bindings.find((binding) => binding.sourceMapProofHash)?.sourceMapProofHash,
218
+ jsTsUseSiteGraphHash,
211
219
  status: graphBlockers.length ? 'blocked' : 'ready',
212
220
  graphHash,
213
221
  autoMergeClaim: false,
@@ -215,6 +223,48 @@ function cssModuleUseSiteGraphRecord(cssModuleSourcePath, bindings, graphUseSite
215
223
  });
216
224
  }
217
225
 
226
+ function cssModuleUseSiteBindingSignature(binding) {
227
+ return JSON.stringify({
228
+ sourcePath: binding.sourcePath,
229
+ sourceHash: binding.sourceHash,
230
+ moduleSpecifier: binding.moduleSpecifier,
231
+ resolvedModulePath: binding.resolvedModulePath,
232
+ importKind: binding.importKind,
233
+ importedName: binding.importedName,
234
+ localName: binding.localName
235
+ });
236
+ }
237
+
238
+ function cssModuleUseSiteSignature(site) {
239
+ return JSON.stringify({
240
+ jsSourcePath: site.jsSourcePath,
241
+ jsSourceHash: site.jsSourceHash,
242
+ exportName: site.exportName,
243
+ useSiteKind: site.useSiteKind,
244
+ accessKind: site.accessKind,
245
+ receiverLocalName: site.receiverLocalName,
246
+ localReferenceName: site.localReferenceName,
247
+ expressionText: site.expressionText,
248
+ sourceSpan: semanticSpanForHash(site.sourceSpan),
249
+ conditionalRuntimePresence: site.conditionalRuntimePresence
250
+ });
251
+ }
252
+
253
+ function cssModuleUseSiteBlockerSignature(blocker) {
254
+ return JSON.stringify({
255
+ sourcePath: blocker.sourcePath,
256
+ sourceHash: blocker.sourceHash,
257
+ moduleSpecifier: blocker.moduleSpecifier,
258
+ localName: blocker.localName,
259
+ expressionText: blocker.expressionText,
260
+ reasonCode: blocker.reasonCode,
261
+ writeOperation: blocker.writeOperation,
262
+ sourceSpan: semanticSpanForHash(blocker.sourceSpan)
263
+ });
264
+ }
265
+
266
+ function stableStringCompare(left, right) { return left.localeCompare(right); }
267
+
218
268
  function cssModuleExportHash(binding, exportName) {
219
269
  if (!exportName || !Array.isArray(binding.cssModuleExportNames) || !binding.cssModuleExportNames.includes(exportName)) return undefined;
220
270
  return hashSemanticValue({ kind: 'frontier.lang.cssModuleExport.v1', cssModuleHash: binding.cssModuleHash, exportName });
@@ -260,13 +310,4 @@ function uniqueSortedStrings(values) {
260
310
  return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))].sort();
261
311
  }
262
312
 
263
- export {
264
- cssModuleAccessBlocker,
265
- cssModuleBindingBlocker,
266
- cssModuleImportBindingRecord,
267
- cssModuleMissingExportBlockers,
268
- cssModulePropBlocker,
269
- cssModuleTransformBlockers,
270
- cssModuleUseSiteGraphRecords,
271
- cssModuleUseSiteRecord
272
- };
313
+ export { cssModuleAccessBlocker, cssModuleBindingBlocker, cssModuleImportBindingRecord, cssModuleMissingExportBlockers, cssModulePropBlocker, cssModuleTransformBlockers, cssModuleUseSiteGraphRecords, cssModuleUseSiteRecord };
@@ -0,0 +1,318 @@
1
+ import { hashSemanticValue } from '@shapeshift-labs/frontier-lang-kernel';
2
+ import { parseCssSemanticSheet } from '@shapeshift-labs/frontier-lang-css';
3
+ import { createJsTsProjectSafeMergeGraphArtifacts } from './js-ts-safe-project-merge-graph.js';
4
+ import { hashText, safeId } from './js-ts-safe-project-merge-core.js';
5
+ import { importNativeSource } from './internal/index-impl/importNativeSource.js';
6
+
7
+ const CssModulePathPattern = /\.module\.css(?:[?#].*)?$/i;
8
+ const CssModuleContractProofGap = 'css-module-contract-source-proof-unproved';
9
+
10
+ function createProjectCssModuleMergeEvidence(input, files, projectId) {
11
+ const cssModuleFiles = files.filter((file) => isCssModulePath(file.sourcePath));
12
+ if (!cssModuleFiles.length || input.disableProjectCssModuleProofSynthesis === true) return undefined;
13
+ const proofFiles = projectCssModuleProofFiles(files, input);
14
+ if (!proofFiles.length || !projectJsTsSourcesStable(files, input)) return {
15
+ status: 'blocked',
16
+ reasonCode: 'css-module-js-ts-output-graph-unproved',
17
+ graphsByPath: new Map(),
18
+ graphArtifacts: undefined
19
+ };
20
+ const cssImports = proofFiles
21
+ .filter((file) => isCssModulePath(file.sourcePath))
22
+ .map((file) => cssModuleProofImport(input, file))
23
+ .filter(Boolean);
24
+ const graphArtifacts = createJsTsProjectSafeMergeGraphArtifacts({
25
+ ...input,
26
+ includeOutputProjectSymbolGraph: true,
27
+ outputProjectImports: cssImports
28
+ }, proofFiles, `${projectId}_css_module_project_proof`);
29
+ const graphs = graphArtifacts?.projectSymbolGraph?.cssModuleUseSiteGraphs ?? [];
30
+ return {
31
+ status: 'ready',
32
+ graphsByPath: new Map(graphs.map((graph) => [graph.cssModuleSourcePath, graph])),
33
+ graphArtifacts
34
+ };
35
+ }
36
+
37
+ function projectCssModuleMergeOptionsForFile(evidence, sourcePath) {
38
+ const graph = evidence?.graphsByPath?.get(sourcePath);
39
+ if (!graph?.jsTsUseSiteGraphHash) return {};
40
+ return {
41
+ jsTsUseSiteGraphHash: graph.jsTsUseSiteGraphHash,
42
+ projectCssModuleUseSiteGraphHash: graph.graphHash,
43
+ projectCssModuleUseSiteGraphStatus: graph.status
44
+ };
45
+ }
46
+
47
+ function projectCssModuleProofOptionsForBlockedMerge(input) {
48
+ const { evidence, sourcePath, mergeOptions, firstResult, base, worker, head } = input;
49
+ if (!isCssModulePath(sourcePath) || !firstResult?.candidateMergedSourceHash) return undefined;
50
+ if (!hasOnlyCssModuleContractProofGap(firstResult)) return missingTransformProofBlockedResult(input);
51
+ const graph = evidence?.graphsByPath?.get(sourcePath);
52
+ const transformConflictResult = missingTransformProofBlockedResult(input);
53
+ if (transformConflictResult) return transformConflictResult;
54
+ if (graph?.status !== 'ready' || !graph.jsTsUseSiteGraphHash) return undefined;
55
+ const generatedClassNameMapHash = cssModuleGeneratedClassNameMapHash(mergeOptions);
56
+ if (!generatedClassNameMapHash) return undefined;
57
+ const proofHashes = cssModuleContractProofHashes({
58
+ sourcePath,
59
+ base,
60
+ worker,
61
+ head,
62
+ output: firstResult.candidateMergedSourceText,
63
+ generatedClassNameMapHash,
64
+ jsTsUseSiteGraphHash: graph.jsTsUseSiteGraphHash,
65
+ mergeOptions
66
+ });
67
+ if (!proofHashes.length) return undefined;
68
+ return {
69
+ mergeOptions: {
70
+ cssModuleContractProofs: proofHashes.map((proof, index) => ({
71
+ id: `project_css_module_contract_${safeId(sourcePath)}_${index}`,
72
+ kind: 'css-source-bound-module-contract-proof',
73
+ status: 'passed',
74
+ sourcePath,
75
+ baseSourceHash: hashText(base),
76
+ workerSourceHash: hashText(worker),
77
+ headSourceHash: hashText(head),
78
+ outputSourceHash: firstResult.candidateMergedSourceHash,
79
+ moduleHash: proof.moduleHash,
80
+ generatedClassNameMapHash,
81
+ jsTsUseSiteGraphHash: graph.jsTsUseSiteGraphHash,
82
+ cssModuleCompositionGraphHash: proof.cssModuleCompositionGraphHash,
83
+ icssGraphHash: proof.icssGraphHash,
84
+ bundlerTransformHash: firstString(mergeOptions.bundlerTransformHash, mergeOptions.cssModuleBundlerTransformHash),
85
+ sourceMapProofHash: firstString(mergeOptions.sourceMapProofHash, mergeOptions.cssModuleSourceMapProofHash),
86
+ proofLevel: 'css-module-contract-project-source-bound'
87
+ }))
88
+ }
89
+ };
90
+ }
91
+
92
+ function projectCssModuleOutputProjectImports(evidence, fileResults, input) {
93
+ if (!evidence) return [];
94
+ return fileResults
95
+ .filter((file) => file.status === 'merged' && isCssModulePath(file.sourcePath) && typeof file.outputSourceText === 'string')
96
+ .map((file) => cssModuleOutputProjectImport(evidence, file, input))
97
+ .filter(Boolean);
98
+ }
99
+
100
+ function mergeOutputProjectImports(input, imports) {
101
+ if (!imports.length) return input;
102
+ return {
103
+ ...input,
104
+ outputProjectImports: [...normalizeProjectImports(input.outputProjectImports ?? input.projectGraphImports?.output), ...imports]
105
+ };
106
+ }
107
+
108
+ function missingTransformProofBlockedResult({ firstResult, sourcePath, mergeOptions }) {
109
+ if (!firstResult || !hasOnlyCssModuleContractProofGap(firstResult)) return undefined;
110
+ const conflicts = [];
111
+ if (!firstString(mergeOptions.bundlerTransformHash, mergeOptions.cssModuleBundlerTransformHash)) {
112
+ conflicts.push(cssModuleProofConflict(firstResult.id, sourcePath, 'css-module-bundler-transform-identity-unproved'));
113
+ }
114
+ if (!firstString(mergeOptions.sourceMapProofHash, mergeOptions.cssModuleSourceMapProofHash)) {
115
+ conflicts.push(cssModuleProofConflict(firstResult.id, sourcePath, 'css-module-source-map-proof-unproved'));
116
+ }
117
+ if (!conflicts.length) return undefined;
118
+ const mergedConflicts = [...(firstResult.conflicts ?? []), ...conflicts];
119
+ return {
120
+ result: {
121
+ ...firstResult,
122
+ conflicts: mergedConflicts,
123
+ admission: {
124
+ ...(firstResult.admission ?? {}),
125
+ reasonCodes: uniqueStrings([
126
+ ...(firstResult.admission?.reasonCodes ?? []),
127
+ ...conflicts.map((conflict) => conflict.details.reasonCode)
128
+ ])
129
+ }
130
+ }
131
+ };
132
+ }
133
+
134
+ function cssModuleContractProofHashes(input) {
135
+ const options = {
136
+ sourcePath: input.sourcePath,
137
+ generatedClassNameMapHash: input.generatedClassNameMapHash,
138
+ jsTsUseSiteGraphHash: input.jsTsUseSiteGraphHash,
139
+ cssModuleCompositionGraphHash: firstString(input.mergeOptions.cssModuleCompositionGraphHash),
140
+ icssGraphHash: firstString(input.mergeOptions.icssGraphHash)
141
+ };
142
+ const sheets = [
143
+ parseCssModuleSheet(input.base, options),
144
+ parseCssModuleSheet(input.worker, options),
145
+ parseCssModuleSheet(input.head, options),
146
+ parseCssModuleSheet(input.output, options)
147
+ ].filter(Boolean);
148
+ const hashes = new Map();
149
+ for (const sheet of sheets) {
150
+ const cssModules = sheet.cssModules;
151
+ if (!cssModules?.moduleHash) continue;
152
+ hashes.set(cssModules.moduleHash, {
153
+ moduleHash: cssModules.moduleHash,
154
+ cssModuleCompositionGraphHash: cssModules.cssModuleCompositionGraphHash,
155
+ icssGraphHash: cssModules.icssGraphHash
156
+ });
157
+ }
158
+ return [...hashes.values()];
159
+ }
160
+
161
+ function parseCssModuleSheet(sourceText, options) {
162
+ if (typeof sourceText !== 'string') return undefined;
163
+ try {
164
+ return parseCssSemanticSheet(sourceText, options);
165
+ } catch {
166
+ return undefined;
167
+ }
168
+ }
169
+
170
+ function cssModuleGeneratedClassNameMapHash(mergeOptions) {
171
+ return firstString(mergeOptions.generatedClassNameMapHash, mergeOptions.cssModuleGeneratedClassNameMapHash)
172
+ ?? (mergeOptions.generatedClassNameMap ? hashSemanticValue({
173
+ kind: 'frontier.lang.css.modules.generatedClassNameMap.v1',
174
+ generatedClassNameMap: mergeOptions.generatedClassNameMap
175
+ }) : undefined);
176
+ }
177
+
178
+ function hasOnlyCssModuleContractProofGap(result) {
179
+ const conflicts = result?.conflicts ?? [];
180
+ return conflicts.length > 0 && conflicts.every((conflict) => conflict.details?.reasonCode === CssModuleContractProofGap);
181
+ }
182
+
183
+ function cssModuleProofImport(input, file) {
184
+ const mergeOptions = cssMergeOptionsForProjectFile(input, file.sourcePath);
185
+ return importNativeSource({
186
+ language: 'css',
187
+ sourcePath: file.sourcePath,
188
+ sourceText: file.sourceText,
189
+ sourceHash: file.sourceHash,
190
+ metadata: {
191
+ generatedClassNameMap: mergeOptions.generatedClassNameMap,
192
+ generatedClassNameMapHash: cssModuleGeneratedClassNameMapHash(mergeOptions),
193
+ cssModuleCompositionGraphHash: mergeOptions.cssModuleCompositionGraphHash,
194
+ icssGraphHash: mergeOptions.icssGraphHash,
195
+ bundlerTransformHash: firstString(mergeOptions.bundlerTransformHash, mergeOptions.cssModuleBundlerTransformHash),
196
+ sourceMapProofHash: firstString(mergeOptions.sourceMapProofHash, mergeOptions.cssModuleSourceMapProofHash)
197
+ }
198
+ });
199
+ }
200
+
201
+ function cssModuleOutputProjectImport(evidence, file, input) {
202
+ const mergeOptions = cssMergeOptionsForProjectFile(input, file.sourcePath);
203
+ const graph = evidence.graphsByPath?.get(file.sourcePath);
204
+ const proof = file.result?.cssModuleContractProofs?.[0] ?? file.result?.admission?.cssModuleContractProofs?.[0];
205
+ return importNativeSource({
206
+ language: 'css',
207
+ sourcePath: file.sourcePath,
208
+ sourceText: file.outputSourceText,
209
+ sourceHash: file.outputHash,
210
+ metadata: {
211
+ generatedClassNameMap: mergeOptions.generatedClassNameMap,
212
+ generatedClassNameMapHash: proof?.generatedClassNameMapHash ?? cssModuleGeneratedClassNameMapHash(mergeOptions),
213
+ jsTsUseSiteGraphHash: proof?.jsTsUseSiteGraphHash ?? graph?.jsTsUseSiteGraphHash,
214
+ cssModuleCompositionGraphHash: proof?.cssModuleCompositionGraphHash ?? mergeOptions.cssModuleCompositionGraphHash,
215
+ icssGraphHash: proof?.icssGraphHash ?? mergeOptions.icssGraphHash,
216
+ bundlerTransformHash: firstString(mergeOptions.bundlerTransformHash, mergeOptions.cssModuleBundlerTransformHash),
217
+ sourceMapProofHash: firstString(mergeOptions.sourceMapProofHash, mergeOptions.cssModuleSourceMapProofHash)
218
+ }
219
+ });
220
+ }
221
+
222
+ function normalizeProjectImports(value) {
223
+ if (!value) return [];
224
+ if (Array.isArray(value)) return value.filter(Boolean);
225
+ if (value instanceof Map) return [...value.values()].filter(Boolean);
226
+ if (typeof value === 'object') return Object.values(value).filter(Boolean);
227
+ return [];
228
+ }
229
+
230
+ function projectCssModuleProofFiles(files, input) {
231
+ return files.flatMap((file) => {
232
+ const sourceText = isCssModulePath(file.sourcePath)
233
+ ? cssModuleProofSourceText(file)
234
+ : stableJsTsSourceText(file, input);
235
+ if (typeof sourceText !== 'string') return [];
236
+ return [{
237
+ sourcePath: file.sourcePath,
238
+ language: file.language ?? languageForPath(file.sourcePath, input),
239
+ sourceText,
240
+ sourceHash: hashText(sourceText)
241
+ }];
242
+ });
243
+ }
244
+
245
+ function projectJsTsSourcesStable(files, input) {
246
+ return files
247
+ .filter((file) => isJsTsLanguage(file.language ?? languageForPath(file.sourcePath, input)))
248
+ .every((file) => typeof stableJsTsSourceText(file, input) === 'string');
249
+ }
250
+
251
+ function cssModuleProofSourceText(file) {
252
+ return firstString(file.workerSourceText, file.headSourceText, file.baseSourceText);
253
+ }
254
+
255
+ function stableJsTsSourceText(file, input) {
256
+ if (!isJsTsLanguage(file.language ?? languageForPath(file.sourcePath, input))) return undefined;
257
+ const base = file.baseSourceText;
258
+ const worker = file.workerDeleted ? undefined : file.workerSourceText ?? base;
259
+ const head = file.headDeleted ? undefined : file.headSourceText ?? base;
260
+ if (typeof worker === 'string' && worker === head) return worker;
261
+ if (typeof base === 'string' && base === worker && base === head) return base;
262
+ return undefined;
263
+ }
264
+
265
+ function cssMergeOptionsForProjectFile(input, sourcePath) {
266
+ const byPath = input.cssMergeOptionsByPath ?? input.styleMergeOptionsByPath;
267
+ return {
268
+ ...(input.cssMergeOptions ?? input.styleMergeOptions),
269
+ ...(byPath?.[sourcePath] ?? {})
270
+ };
271
+ }
272
+
273
+ function cssModuleProofConflict(id, sourcePath, reasonCode) {
274
+ return {
275
+ code: 'css-module-project-proof-blocked',
276
+ gateId: 'css-semantic-merge',
277
+ sourcePath,
278
+ details: {
279
+ reasonCode,
280
+ conflictKey: `css#${id}#${reasonCode}#${sourcePath ?? 'source'}`,
281
+ proofGap: {
282
+ code: reasonCode,
283
+ status: 'not-claimed',
284
+ failClosed: true,
285
+ semanticEquivalenceClaim: false
286
+ }
287
+ }
288
+ };
289
+ }
290
+
291
+ function isCssModulePath(path) {
292
+ return CssModulePathPattern.test(String(path ?? ''));
293
+ }
294
+
295
+ function languageForPath(sourcePath, input) {
296
+ const path = String(sourcePath ?? '').toLowerCase();
297
+ if (path.endsWith('.css')) return 'css';
298
+ if (path.endsWith('.tsx')) return 'tsx';
299
+ if (path.endsWith('.jsx')) return 'jsx';
300
+ if (path.endsWith('.ts') || path.endsWith('.mts') || path.endsWith('.cts')) return 'typescript';
301
+ if (path.endsWith('.js') || path.endsWith('.mjs') || path.endsWith('.cjs')) return 'javascript';
302
+ return input.language;
303
+ }
304
+
305
+ function isJsTsLanguage(language) {
306
+ return ['javascript', 'typescript', 'jsx', 'tsx', 'js', 'ts'].includes(String(language ?? '').toLowerCase());
307
+ }
308
+
309
+ function firstString(...values) {
310
+ for (const value of values) if (value !== undefined && value !== null && String(value)) return String(value);
311
+ return undefined;
312
+ }
313
+
314
+ function uniqueStrings(values) {
315
+ return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))];
316
+ }
317
+
318
+ export { createProjectCssModuleMergeEvidence, mergeOutputProjectImports, projectCssModuleMergeOptionsForFile, projectCssModuleOutputProjectImports, projectCssModuleProofOptionsForBlockedMerge };
@@ -2,6 +2,7 @@ import { safeMergeCssSource } from '@shapeshift-labs/frontier-lang-css';
2
2
  import { safeMergeHtmlSource } from '@shapeshift-labs/frontier-lang-html';
3
3
  import { compactRecord } from './js-ts-safe-merge-context.js';
4
4
  import { hashText, safeId, uniqueStrings } from './js-ts-safe-project-merge-core.js';
5
+ import { projectCssModuleMergeOptionsForFile, projectCssModuleProofOptionsForBlockedMerge } from './js-ts-safe-project-merge-css-module-proofs.js';
5
6
  import { htmlRuntimeBoundaryChanges, htmlRuntimeBoundaryProofForChange, htmlRuntimeBoundaryProofRecord, htmlRuntimeBoundaryProvenResult } from './js-ts-safe-project-merge-html-runtime-boundaries.js';
6
7
 
7
8
  function projectFileLanguage(file, input) {
@@ -9,15 +10,26 @@ function projectFileLanguage(file, input) {
9
10
  }
10
11
 
11
12
  function maybeMergeHtmlCssProjectFile(options) {
12
- const { file, input, projectId, context, base, worker, head, sourceInput } = options;
13
+ const { file, input, projectId, context, base, worker, head, sourceInput, projectCssModuleMergeEvidence } = options;
13
14
  const language = String(context.language ?? '').toLowerCase();
14
15
  const merge = language === 'html' ? safeMergeHtmlSource : language === 'css' ? safeMergeCssSource : undefined;
15
16
  if (!merge) return undefined;
16
17
  const resultId = `${projectId}_${safeId(file.sourcePath)}`;
17
- const mergeOptions = htmlCssMergeOptionsForProjectFile(input, file.sourcePath, language);
18
+ const mergeOptions = {
19
+ ...htmlCssMergeOptionsForProjectFile(input, file.sourcePath, language),
20
+ ...(language === 'css' ? projectCssModuleMergeOptionsForFile(projectCssModuleMergeEvidence, file.sourcePath) : {})
21
+ };
18
22
  const runtimeBoundaryProofs = language === 'html' ? htmlRuntimeBoundaryProofCandidates(input, file.sourcePath, mergeOptions) : [];
19
23
  const runtimeBoundaryMergeOptions = runtimeBoundaryProofs.length ? { htmlRuntimeBoundaryProofs: runtimeBoundaryProofs, htmlSourceBoundRuntimeBoundaryProofs: runtimeBoundaryProofs } : {};
20
- const result = merge({ ...sourceInput, ...mergeOptions, ...context, ...runtimeBoundaryMergeOptions, id: resultId, baseSourceText: base, workerSourceText: worker, headSourceText: head });
24
+ let result = merge({ ...sourceInput, ...mergeOptions, ...context, ...runtimeBoundaryMergeOptions, id: resultId, baseSourceText: base, workerSourceText: worker, headSourceText: head, includeBlockedMergeCandidate: language === 'css' || sourceInput.includeBlockedMergeCandidate === true });
25
+ if (language === 'css' && result.status === 'blocked') {
26
+ const proofOptions = projectCssModuleProofOptionsForBlockedMerge({ evidence: projectCssModuleMergeEvidence, sourcePath: file.sourcePath, mergeOptions, firstResult: result, base, worker, head });
27
+ if (proofOptions?.mergeOptions) {
28
+ result = merge({ ...sourceInput, ...mergeOptions, ...proofOptions.mergeOptions, ...context, id: resultId, baseSourceText: base, workerSourceText: worker, headSourceText: head });
29
+ } else if (proofOptions?.result) {
30
+ result = proofOptions.result;
31
+ }
32
+ }
21
33
  const admittedResult = language === 'html' && result.status === 'merged'
22
34
  ? blockHtmlProofGapChanges({ result, id: resultId, sourcePath: file.sourcePath, base, worker, head, runtimeBoundaryProofs }) ?? result
23
35
  : result;
@@ -20,6 +20,7 @@ import { applyProjectSymbolRenameClassifications, classifyProjectSymbolRenames }
20
20
  import { applyProjectSplitMergeClassifications, classifyProjectSplitMerges } from './js-ts-safe-project-merge-split-merge.js';
21
21
  import { projectConfidence, projectEvidence, projectSummary, projectSummaryWithConfidenceEvidence } from './js-ts-safe-project-merge-summary.js';
22
22
  import { maybeMergeHtmlCssProjectFile, projectFileLanguage } from './js-ts-safe-project-merge-html-css.js';
23
+ import { createProjectCssModuleMergeEvidence, mergeOutputProjectImports, projectCssModuleOutputProjectImports } from './js-ts-safe-project-merge-css-module-proofs.js';
23
24
 
24
25
  function safeMergeJsTsProject(input = {}) {
25
26
  const id = String(input.id ?? 'js_ts_project_safe_merge');
@@ -27,7 +28,8 @@ function safeMergeJsTsProject(input = {}) {
27
28
  const projectMoveRenames = classifyProjectMoveRenames(files, input, id);
28
29
  const projectSymbolRenames = classifyProjectSymbolRenames(files, input);
29
30
  const projectSplitMerges = classifyProjectSplitMerges(files);
30
- const mergedFileResults = files.map((file) => mergeProjectFile(file, input, id, projectSymbolRenames));
31
+ const projectCssModuleMergeEvidence = createProjectCssModuleMergeEvidence(input, files, id);
32
+ const mergedFileResults = files.map((file) => mergeProjectFile(file, input, id, projectSymbolRenames, projectCssModuleMergeEvidence));
31
33
  const fileResults = applyProjectSplitMergeClassifications(
32
34
  applyProjectSymbolRenameClassifications(
33
35
  applyProjectMoveRenameClassifications(mergedFileResults, projectMoveRenames, files, input),
@@ -63,6 +65,7 @@ function safeMergeJsTsProject(input = {}) {
63
65
  parserTriviaEvidence: outputParserTriviaEvidence(inputFilesByPath.get(file.sourcePath), file),
64
66
  operation: file.operation
65
67
  }));
68
+ const graphInput = mergeOutputProjectImports(input, projectCssModuleOutputProjectImports(projectCssModuleMergeEvidence, fileResults, input));
66
69
  const outputDeclarationGate = blockedFiles.length === 0
67
70
  ? createJsTsProjectMergeDeclarationGate(input, outputFiles, id)
68
71
  : undefined;
@@ -70,10 +73,10 @@ function safeMergeJsTsProject(input = {}) {
70
73
  ? createJsTsProjectMergeDeclarationEmitParityProof(input, files, outputFiles, id)
71
74
  : undefined;
72
75
  const projectGraphDelta = blockedFiles.length === 0 && input.includeProjectGraphDelta
73
- ? createJsTsProjectSafeMergeGraphDelta(input, files, outputFiles, id)
76
+ ? createJsTsProjectSafeMergeGraphDelta(graphInput, files, outputFiles, id)
74
77
  : undefined;
75
78
  const graphArtifacts = projectGraphDelta?.stages?.output ?? (blockedFiles.length === 0 && input.includeOutputProjectSymbolGraph
76
- ? createJsTsProjectSafeMergeGraphArtifacts(input, outputFiles, id)
79
+ ? createJsTsProjectSafeMergeGraphArtifacts(graphInput, outputFiles, id)
77
80
  : undefined);
78
81
  const outputDiagnosticsGate = blockedFiles.length === 0
79
82
  ? createJsTsProjectMergeDiagnosticsGate(input, outputFiles, id, { fileResults })
@@ -212,7 +215,7 @@ function outputParserTriviaEvidence(file, resultFile) {
212
215
  : undefined;
213
216
  }
214
217
 
215
- function mergeProjectFile(file, input, projectId, projectSymbolRenames) {
218
+ function mergeProjectFile(file, input, projectId, projectSymbolRenames, projectCssModuleMergeEvidence) {
216
219
  const base = file.baseSourceText;
217
220
  const worker = file.workerDeleted ? undefined : file.workerSourceText ?? base;
218
221
  const head = file.headDeleted ? undefined : file.headSourceText ?? base;
@@ -243,7 +246,7 @@ function mergeProjectFile(file, input, projectId, projectSymbolRenames) {
243
246
  ? syntheticFile(file, context, undefined, 'head-deleted-worker-unchanged')
244
247
  : blockedFile(file, context, 'head-file-delete-conflict');
245
248
  }
246
- const nonJsTsMerge = maybeMergeHtmlCssProjectFile({ file, input, projectId, context, base, worker, head, sourceInput: sourceMergeInputForProjectFile(input) });
249
+ const nonJsTsMerge = maybeMergeHtmlCssProjectFile({ file, input, projectId, context, base, worker, head, sourceInput: sourceMergeInputForProjectFile(input), projectCssModuleMergeEvidence });
247
250
  if (nonJsTsMerge) return nonJsTsMerge;
248
251
  const result = safeMergeJsTsSource({
249
252
  ...sourceMergeInputForProjectFile(input),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshift-labs/frontier-lang-compiler",
3
- "version": "0.2.181",
3
+ "version": "0.2.182",
4
4
  "description": "Compiler facade for Frontier Lang source documents and language projection adapters.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -63,7 +63,7 @@
63
63
  "dependencies": {
64
64
  "@shapeshift-labs/frontier-lang-c": "0.2.9",
65
65
  "@shapeshift-labs/frontier-lang-checker": "0.3.8",
66
- "@shapeshift-labs/frontier-lang-css": "^0.1.18",
66
+ "@shapeshift-labs/frontier-lang-css": "^0.1.20",
67
67
  "@shapeshift-labs/frontier-lang-html": "^0.1.14",
68
68
  "@shapeshift-labs/frontier-lang-javascript": "0.2.9",
69
69
  "@shapeshift-labs/frontier-lang-kernel": "0.3.12",