@solid-stack/mason 1.0.29 → 1.0.31
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/dist/bin.cjs +64 -3
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +64 -3
- package/dist/bin.js.map +1 -1
- package/dist/core/lintEngine.d.ts +1 -0
- package/dist/core/lintEngine.d.ts.map +1 -1
- package/dist/index.cjs +64 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +64 -3
- package/dist/index.js.map +1 -1
- package/dist/types/lint.d.ts +1 -1
- package/dist/types/lint.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ export declare class DependencyRuleError extends Error {
|
|
|
7
7
|
export interface TargetInfo {
|
|
8
8
|
isExternal: boolean;
|
|
9
9
|
isDiFramework: boolean;
|
|
10
|
+
isGlobalConfig?: boolean | undefined;
|
|
10
11
|
targetFeature?: string | undefined;
|
|
11
12
|
targetLayer?: LayerType | undefined;
|
|
12
13
|
targetSubfolder?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lintEngine.d.ts","sourceRoot":"","sources":["../../src/core/lintEngine.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,sBAAsB,EAEtB,yBAAyB,EACzB,SAAS,EACT,WAAW,EACX,WAAW,EAEX,SAAS,EACV,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"lintEngine.d.ts","sourceRoot":"","sources":["../../src/core/lintEngine.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,sBAAsB,EAEtB,yBAAyB,EACzB,SAAS,EACT,WAAW,EACX,WAAW,EAEX,SAAS,EACV,MAAM,kBAAkB,CAAC;AAI1B,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,SAAgB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxC,SAAgB,UAAU,EAAE,OAAO,CAAC;IAEpC,YAAY,OAAO,EAAE,MA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AAC,EAAE,SAAS,KAAK,IAAI,GACnC,IAAI,CAwGN;AAED,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,CAAC,CAAC,EAAE,SAAS,KAAK,IAAI,GACnC,IAAI,CAwGN;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,WAAgB,GAAG,WAAW,CAiqBnE"}
|
package/dist/index.cjs
CHANGED
|
@@ -4951,14 +4951,19 @@ function classifyTarget(specifier, sourceFileAbs, projectRoot) {
|
|
|
4951
4951
|
resolvedRel = specifier.replace(/^[@~]\//, "src/");
|
|
4952
4952
|
} else if (specifier.startsWith("@shared/")) {
|
|
4953
4953
|
resolvedRel = "src/" + specifier.slice(1);
|
|
4954
|
+
} else if (specifier.startsWith("@/configs/") || specifier.startsWith("~/configs/") || specifier === "@/configs" || specifier === "~/configs") {
|
|
4955
|
+
resolvedRel = specifier.replace(/^[@~]\//, "src/");
|
|
4956
|
+
} else if (specifier === "@configs" || specifier.startsWith("@configs/")) {
|
|
4957
|
+
resolvedRel = "src/" + specifier.slice(1);
|
|
4954
4958
|
} else if (specifier.startsWith("@/") || specifier.startsWith("~/")) {
|
|
4955
4959
|
resolvedRel = "src/" + specifier.slice(2);
|
|
4956
|
-
} else if (specifier.startsWith("features/") || specifier.startsWith("shared/")) {
|
|
4960
|
+
} else if (specifier.startsWith("features/") || specifier.startsWith("shared/") || specifier.startsWith("configs/") || specifier === "configs") {
|
|
4957
4961
|
resolvedRel = specifier;
|
|
4958
4962
|
}
|
|
4959
4963
|
if (!resolvedRel) {
|
|
4960
4964
|
return { isExternal: true, isDiFramework: false };
|
|
4961
4965
|
}
|
|
4966
|
+
const isGlobalConfig = resolvedRel.startsWith("src/configs/") || resolvedRel === "src/configs" || resolvedRel.startsWith("configs/") || resolvedRel === "configs";
|
|
4962
4967
|
const featMatch = resolvedRel.match(/(?:^|\/)(?:src\/)?features\/([^/]+)\/([^/]+)(?:\/(.*))?$/);
|
|
4963
4968
|
if (featMatch && featMatch[1] && featMatch[2]) {
|
|
4964
4969
|
const targetFeature = featMatch[1];
|
|
@@ -5009,7 +5014,7 @@ function classifyTarget(specifier, sourceFileAbs, projectRoot) {
|
|
|
5009
5014
|
isSharedDomain
|
|
5010
5015
|
};
|
|
5011
5016
|
}
|
|
5012
|
-
return { isExternal: true, isDiFramework: false };
|
|
5017
|
+
return { isExternal: true, isDiFramework: false, isGlobalConfig };
|
|
5013
5018
|
}
|
|
5014
5019
|
function extractImportStatements(content) {
|
|
5015
5020
|
const statements = [];
|
|
@@ -5580,6 +5585,44 @@ Code: ${v.code}`;
|
|
|
5580
5585
|
}
|
|
5581
5586
|
});
|
|
5582
5587
|
}
|
|
5588
|
+
if (target.targetLayer === "domain" && !target.isTargetPort) {
|
|
5589
|
+
addViolation({
|
|
5590
|
+
feature: feat.name,
|
|
5591
|
+
layer,
|
|
5592
|
+
file,
|
|
5593
|
+
relativePath: relPath,
|
|
5594
|
+
line: stmt.line,
|
|
5595
|
+
category: "Cross-Feature Domain Violation",
|
|
5596
|
+
code: stmt.rawCode,
|
|
5597
|
+
ruleId: "F1_CROSS_FEATURE_DOMAIN",
|
|
5598
|
+
severity: "error",
|
|
5599
|
+
advice: `Cannot import domain entities/factories directly from foreign feature '${target.targetFeature}'. This bypasses its use cases and breaks Bounded Context encapsulation. Communicate via ports instead.`,
|
|
5600
|
+
fixExample: {
|
|
5601
|
+
bad: stmt.rawCode,
|
|
5602
|
+
good: `// Define a Port in ${feat.name}/domain/ and implement the cross-feature communication in ${feat.name}/infrastructure/ (which can then call ${target.targetFeature}'s Use Case).`
|
|
5603
|
+
}
|
|
5604
|
+
});
|
|
5605
|
+
}
|
|
5606
|
+
}
|
|
5607
|
+
if (target.isGlobalConfig) {
|
|
5608
|
+
addViolation({
|
|
5609
|
+
feature: feat.name,
|
|
5610
|
+
layer,
|
|
5611
|
+
file,
|
|
5612
|
+
relativePath: relPath,
|
|
5613
|
+
line: stmt.line,
|
|
5614
|
+
category: "Global Configuration Violation",
|
|
5615
|
+
code: stmt.rawCode,
|
|
5616
|
+
ruleId: "F2_GLOBAL_CONFIG_DEPENDENCY",
|
|
5617
|
+
severity: "error",
|
|
5618
|
+
advice: `Feature layers (${layer}) must not depend directly on global configurations. Define a configuration interface/token within the feature (e.g., '${feat.name}/domain/I${toPascalCase(feat.name)}Config') and inject it. The feature's diProvider.ts will handle mapping the global config to this token.`,
|
|
5619
|
+
fixExample: {
|
|
5620
|
+
bad: stmt.rawCode,
|
|
5621
|
+
good: `// 1. Define I${toPascalCase(feat.name)}Config locally
|
|
5622
|
+
// 2. Inject it via static deps
|
|
5623
|
+
// 3. Import and bind global configs inside diProvider.ts`
|
|
5624
|
+
}
|
|
5625
|
+
});
|
|
5583
5626
|
}
|
|
5584
5627
|
if (layer === "domain") {
|
|
5585
5628
|
if (target.targetLayer && ["useCases", "services", "infrastructure", "presentation"].includes(target.targetLayer)) {
|
|
@@ -5636,7 +5679,7 @@ Code: ${v.code}`;
|
|
|
5636
5679
|
}
|
|
5637
5680
|
});
|
|
5638
5681
|
}
|
|
5639
|
-
if (target.isExternal && !target.isDiFramework) {
|
|
5682
|
+
if (target.isExternal && !target.isDiFramework && !target.isGlobalConfig) {
|
|
5640
5683
|
addViolation({
|
|
5641
5684
|
feature: feat.name,
|
|
5642
5685
|
layer,
|
|
@@ -5946,6 +5989,24 @@ Code: ${v.code}`;
|
|
|
5946
5989
|
}
|
|
5947
5990
|
});
|
|
5948
5991
|
}
|
|
5992
|
+
if (target.targetLayer === "domain" && !target.isTargetPort && !target.isTargetRepo) {
|
|
5993
|
+
addViolation({
|
|
5994
|
+
feature: feat.name,
|
|
5995
|
+
layer,
|
|
5996
|
+
file,
|
|
5997
|
+
relativePath: relPath,
|
|
5998
|
+
line: stmt.line,
|
|
5999
|
+
category: "Presentation Layer Violation",
|
|
6000
|
+
code: stmt.rawCode,
|
|
6001
|
+
ruleId: "P5_DIRECT_DOMAIN_ENTITY",
|
|
6002
|
+
severity: "error",
|
|
6003
|
+
advice: "Presentation handlers must not directly instantiate or import domain entities/factories. They must map requests to flat DTOs and pass them to the Use Case.",
|
|
6004
|
+
fixExample: {
|
|
6005
|
+
bad: stmt.rawCode,
|
|
6006
|
+
good: "// Construct a DTO and pass it into the injected Use Case's execute() method."
|
|
6007
|
+
}
|
|
6008
|
+
});
|
|
6009
|
+
}
|
|
5949
6010
|
}
|
|
5950
6011
|
}
|
|
5951
6012
|
}
|