@getchomp/core 0.2.42 → 0.2.44
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 +21 -0
- package/dist/layout/types.d.ts +5 -0
- package/dist/layout/visualLinter.d.ts +1 -1
- package/dist/layout/visualLinter.js +69 -1
- package/dist/version.js +2 -2
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chomp
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/layout/types.d.ts
CHANGED
|
@@ -290,6 +290,11 @@ export interface MacroPackageEdge {
|
|
|
290
290
|
pinCount: number;
|
|
291
291
|
status?: "DETERMINISTIC" | "INFERRED";
|
|
292
292
|
diffStatus?: DiffVisualStatus;
|
|
293
|
+
/** Pre-routed obstacle-free orthogonal polyline in Macro Grid coordinates (`[PAT-VIS-34]`). */
|
|
294
|
+
points?: Array<{
|
|
295
|
+
x: number;
|
|
296
|
+
y: number;
|
|
297
|
+
}>;
|
|
293
298
|
}
|
|
294
299
|
/** The canonical layout payload returned by GET /api/layout. */
|
|
295
300
|
export interface LayoutData {
|
|
@@ -51,7 +51,7 @@ export interface MacroPackageOverlapIssue {
|
|
|
51
51
|
}
|
|
52
52
|
export interface WireObstacleCollisionIssue {
|
|
53
53
|
edgeId: string;
|
|
54
|
-
kind: "INTRA_PACKAGE_CARD" | "CROSS_PACKAGE_BOX";
|
|
54
|
+
kind: "INTRA_PACKAGE_CARD" | "CROSS_PACKAGE_BOX" | "MACRO_PACKAGE_CARD";
|
|
55
55
|
blockerId: string;
|
|
56
56
|
blockerLabel: string;
|
|
57
57
|
packageName?: string;
|
|
@@ -265,13 +265,76 @@ export function auditLayoutGeometry(payload) {
|
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
+
// Macro-Package Edge coordinate finiteness & obstacle-free gutter verification ([PAT-VIS-34])
|
|
269
|
+
const MACRO_CARD_W = 280;
|
|
270
|
+
const MACRO_CARD_H = 92;
|
|
271
|
+
const MACRO_COL_STEP = 440;
|
|
272
|
+
const MACRO_ROW_STEP = 160;
|
|
273
|
+
const macroCardBoxes = [];
|
|
274
|
+
for (const [pkg, box] of validBoundsList) {
|
|
275
|
+
if (typeof box.macroCol === "number" && typeof box.macroRow === "number") {
|
|
276
|
+
const minX = box.macroCol * MACRO_COL_STEP;
|
|
277
|
+
const minY = box.macroRow * MACRO_ROW_STEP;
|
|
278
|
+
macroCardBoxes.push({
|
|
279
|
+
pkg,
|
|
280
|
+
minX,
|
|
281
|
+
maxX: minX + MACRO_CARD_W,
|
|
282
|
+
minY,
|
|
283
|
+
maxY: minY + MACRO_CARD_H,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
for (const me of payload.macroEdges ?? []) {
|
|
288
|
+
if (!Array.isArray(me?.points) || me.points.length < 2)
|
|
289
|
+
continue;
|
|
290
|
+
let invalidMacroPt = false;
|
|
291
|
+
for (const pt of me.points) {
|
|
292
|
+
if (!pt || !Number.isFinite(pt.x) || !Number.isFinite(pt.y)) {
|
|
293
|
+
report.nonFiniteItems.push(`Macro edge ${me.id} has non-finite routing coordinate (${pt?.x}, ${pt?.y})`);
|
|
294
|
+
invalidMacroPt = true;
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (invalidMacroPt)
|
|
299
|
+
continue;
|
|
300
|
+
let recordedMacroCollision = false;
|
|
301
|
+
for (let k = 0; k < me.points.length - 1 && !recordedMacroCollision; k++) {
|
|
302
|
+
const p1 = me.points[k];
|
|
303
|
+
const p2 = me.points[k + 1];
|
|
304
|
+
const minX = Math.min(p1.x, p2.x);
|
|
305
|
+
const maxX = Math.max(p1.x, p2.x);
|
|
306
|
+
const minY = Math.min(p1.y, p2.y);
|
|
307
|
+
const maxY = Math.max(p1.y, p2.y);
|
|
308
|
+
for (const card of macroCardBoxes) {
|
|
309
|
+
const isSrcExitSeg = card.pkg === me.sourcePkg && k === 0;
|
|
310
|
+
const isTgtEntrySeg = card.pkg === me.targetPkg && k === me.points.length - 2;
|
|
311
|
+
if (isSrcExitSeg || isTgtEntrySeg)
|
|
312
|
+
continue;
|
|
313
|
+
const inset = card.pkg === me.sourcePkg || card.pkg === me.targetPkg ? 2 : 0;
|
|
314
|
+
if (maxX > card.minX + inset &&
|
|
315
|
+
minX < card.maxX - inset &&
|
|
316
|
+
maxY > card.minY + inset &&
|
|
317
|
+
minY < card.maxY - inset) {
|
|
318
|
+
report.wireCollisions.push({
|
|
319
|
+
edgeId: String(me.id),
|
|
320
|
+
kind: "MACRO_PACKAGE_CARD",
|
|
321
|
+
blockerId: card.pkg,
|
|
322
|
+
blockerLabel: card.pkg,
|
|
323
|
+
});
|
|
324
|
+
recordedMacroCollision = true;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
268
330
|
report.passed =
|
|
269
331
|
report.duplicateNodeIds.length === 0 &&
|
|
270
332
|
report.duplicateInvariantKeys.length === 0 &&
|
|
271
333
|
report.nonFiniteItems.length === 0 &&
|
|
272
334
|
report.stationOverlaps.length === 0 &&
|
|
273
335
|
report.packageBoundsLeaks.length === 0 &&
|
|
274
|
-
report.macroPackageOverlaps.length === 0
|
|
336
|
+
report.macroPackageOverlaps.length === 0 &&
|
|
337
|
+
report.wireCollisions.every((w) => w.kind !== "MACRO_PACKAGE_CARD");
|
|
275
338
|
return report;
|
|
276
339
|
}
|
|
277
340
|
/**
|
|
@@ -374,5 +437,10 @@ export function validateLayoutPayload(payload) {
|
|
|
374
437
|
for (const macroOv of geometry.macroPackageOverlaps) {
|
|
375
438
|
errors.push(`Rule Violation: ${macroOv.detail}`);
|
|
376
439
|
}
|
|
440
|
+
for (const wc of geometry.wireCollisions) {
|
|
441
|
+
if (wc.kind === "MACRO_PACKAGE_CARD") {
|
|
442
|
+
errors.push(`Rule Violation [PAT-VIS-34]: Macro edge "${wc.edgeId}" crosses intermediate package card "${wc.blockerLabel}"`);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
377
445
|
return errors;
|
|
378
446
|
}
|
package/dist/version.js
CHANGED
|
@@ -5,7 +5,7 @@ function readCoreExtractorVersion() {
|
|
|
5
5
|
try {
|
|
6
6
|
const metaUrl = typeof import.meta !== 'undefined' ? import.meta.url : undefined;
|
|
7
7
|
if (typeof metaUrl !== 'string' || !metaUrl.startsWith('file:')) {
|
|
8
|
-
return '0.2.
|
|
8
|
+
return '0.2.44';
|
|
9
9
|
}
|
|
10
10
|
const here = path.dirname(fileURLToPath(metaUrl));
|
|
11
11
|
for (const rel of ['../package.json', '../../package.json']) {
|
|
@@ -23,7 +23,7 @@ function readCoreExtractorVersion() {
|
|
|
23
23
|
catch {
|
|
24
24
|
// Non-Node / Cloudflare Worker / bundled ESM fallback
|
|
25
25
|
}
|
|
26
|
-
return '0.2.
|
|
26
|
+
return '0.2.44';
|
|
27
27
|
}
|
|
28
28
|
/** Canonical extractor version read from `@chomp/core`'s `package.json`. */
|
|
29
29
|
export const CORE_EXTRACTOR_VERSION = readCoreExtractorVersion();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getchomp/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.44",
|
|
4
4
|
"description": "Deterministic single-pass TypeScript and JavaScript AST extraction engine for Chomp.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://getchomp.dev",
|
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
},
|
|
70
70
|
"files": [
|
|
71
71
|
"dist",
|
|
72
|
-
"README.md"
|
|
72
|
+
"README.md",
|
|
73
|
+
"LICENSE"
|
|
73
74
|
],
|
|
74
75
|
"dependencies": {
|
|
75
76
|
"fast-glob": "^3.3.3",
|