@happyvertical/smrt-scanner 0.57.28 → 0.57.29
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/chunks/{scanner-DPJwlSPw.js → scanner-FB4nRHQB.js} +30 -2
- package/dist/chunks/scanner-FB4nRHQB.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/inheritance-resolver.d.ts +22 -0
- package/dist/inheritance-resolver.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/chunks/scanner-DPJwlSPw.js.map +0 -1
|
@@ -1095,12 +1095,40 @@ var InheritanceResolver = class {
|
|
|
1095
1095
|
if (position === void 0) {
|
|
1096
1096
|
positions.set(field.name, allFields.length);
|
|
1097
1097
|
allFields.push(field);
|
|
1098
|
-
} else allFields[position] = field;
|
|
1098
|
+
} else allFields[position] = this.mergeSTIFieldOverride(allFields[position], field);
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
return allFields;
|
|
1102
1102
|
}
|
|
1103
1103
|
/**
|
|
1104
|
+
* Merge a descendant's redeclared STI field with the entry it replaces.
|
|
1105
|
+
*
|
|
1106
|
+
* Leaf-wins: the descendant's own declaration (its initializer, type
|
|
1107
|
+
* annotation, decorators, optionality) always takes precedence — a
|
|
1108
|
+
* redeclaration that carries its own options keeps them. But a bare
|
|
1109
|
+
* `override fieldName = value` redeclaration (no type annotation, no
|
|
1110
|
+
* decorators) carries no metadata source of its own, so everything the
|
|
1111
|
+
* declaring ancestor attached — an enum type annotation, a
|
|
1112
|
+
* `@field({ description })` decorator — would otherwise be dropped from
|
|
1113
|
+
* the merged raw field and, with it, from the converted manifest. Fill
|
|
1114
|
+
* that missing metadata in from the ancestor entry being replaced so a
|
|
1115
|
+
* grandchild's bare override keeps the inherited field's `enum` and
|
|
1116
|
+
* `description` (#4005).
|
|
1117
|
+
*
|
|
1118
|
+
* @param ancestor - The previously merged (nearest declaring ancestor)
|
|
1119
|
+
* field entry being replaced.
|
|
1120
|
+
* @param descendant - The descendant's own redeclaration, which wins.
|
|
1121
|
+
* @returns The descendant's field with missing `typeAnnotation` and
|
|
1122
|
+
* `decorators` filled from the ancestor.
|
|
1123
|
+
*/
|
|
1124
|
+
mergeSTIFieldOverride(ancestor, descendant) {
|
|
1125
|
+
return {
|
|
1126
|
+
...descendant,
|
|
1127
|
+
...descendant.typeAnnotation === null && ancestor.typeAnnotation !== null ? { typeAnnotation: ancestor.typeAnnotation } : {},
|
|
1128
|
+
...descendant.decorators.length === 0 && ancestor.decorators.length > 0 ? { decorators: ancestor.decorators } : {}
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1104
1132
|
* Return all known descendants of a class.
|
|
1105
1133
|
*
|
|
1106
1134
|
* Useful for STI schema generation where the base table must accommodate
|
|
@@ -4976,4 +5004,4 @@ var OxcScanner = class {
|
|
|
4976
5004
|
//#endregion
|
|
4977
5005
|
export { isPrunedAgentSurfacePath as C, sourceMayDeclareAgentSurface as E, isAgentSurfaceSourcePath as S, scanSvelteAgentSurface as T, normalizeGlobSeparators as _, extractSmrtImports as a, emptyAgentSurface as b, parseRecipeFile as c, extractRecipes as d, resolveRecipes as f, discoverSourceFiles as g, resolveEnumValues as h, defaultCollectionName as i, parseSource as l, InheritanceResolver as m, parseUiSelectorsFile as n, parseAgentSurfaceFile as o, sourceMayDeclareRecipe as p, ManifestAdapter as r, parseFile as s, OxcScanner as t, deriveHelpFieldRefs as u, relativeGlobToCwd as v, mergeAgentSurfaces as w, extractAgentSurface as x, checkAgentSurfaceToolNames as y };
|
|
4978
5006
|
|
|
4979
|
-
//# sourceMappingURL=scanner-
|
|
5007
|
+
//# sourceMappingURL=scanner-FB4nRHQB.js.map
|