@formspec/build 0.1.0-alpha.54 → 0.1.0-alpha.57
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/analyzer/class-analyzer.d.ts.map +1 -1
- package/dist/analyzer/tsdoc-parser.d.ts.map +1 -1
- package/dist/browser.cjs +44 -12
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +46 -13
- package/dist/browser.js.map +1 -1
- package/dist/build-alpha.d.ts +7 -46
- package/dist/build-beta.d.ts +7 -46
- package/dist/build-internal.d.ts +7 -46
- package/dist/build.d.ts +7 -46
- package/dist/cli.cjs +175 -66
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +172 -54
- package/dist/cli.js.map +1 -1
- package/dist/extensions/registry.d.ts.map +1 -1
- package/dist/generators/class-schema.d.ts +2 -2
- package/dist/generators/class-schema.d.ts.map +1 -1
- package/dist/index.cjs +165 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +167 -51
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +166 -59
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.js +164 -48
- package/dist/internals.js.map +1 -1
- package/dist/json-schema/generator.d.ts +1 -1
- package/dist/json-schema/generator.d.ts.map +1 -1
- package/dist/json-schema/ir-generator.d.ts +1 -1
- package/dist/json-schema/ir-generator.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/extensions/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,EACzB,uCAAuC,EACxC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/extensions/regist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CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,YAAY,EAAE,uCAAuC,CAAC;KAChE,GACD,SAAS,CAAC;IAEd;;;;;OAKG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,4BAA4B,GAAG,SAAS,CAAC;CAChF;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE;;;;;;;;OAQG;IACH,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,IAAI,CAAC;CACpE;AAuBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,SAAS,mBAAmB,EAAE,GACzC,wBAAwB,CAwL1B"}
|
|
@@ -133,7 +133,7 @@ export interface StaticSchemaGenerationOptions {
|
|
|
133
133
|
* @defaultValue "enum"
|
|
134
134
|
* @deprecated Provide a `FormSpecConfig` via the `config` option instead.
|
|
135
135
|
*/
|
|
136
|
-
readonly enumSerialization?: "enum" | "oneOf";
|
|
136
|
+
readonly enumSerialization?: "enum" | "oneOf" | "smart-size";
|
|
137
137
|
/**
|
|
138
138
|
* Metadata resolution policy for static schema generation.
|
|
139
139
|
* @deprecated Provide a `FormSpecConfig` via the `config` option instead.
|
|
@@ -386,7 +386,7 @@ export declare function generateSchemasBatchFromProgram(options: GenerateSchemas
|
|
|
386
386
|
export declare function resolveStaticOptions(options: StaticSchemaGenerationOptions): {
|
|
387
387
|
extensionRegistry: ExtensionRegistry | undefined;
|
|
388
388
|
vendorPrefix: string | undefined;
|
|
389
|
-
enumSerialization: "enum" | "oneOf" | undefined;
|
|
389
|
+
enumSerialization: "enum" | "oneOf" | "smart-size" | undefined;
|
|
390
390
|
metadata: MetadataPolicyInput | undefined;
|
|
391
391
|
};
|
|
392
392
|
//# sourceMappingURL=class-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-schema.d.ts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
|
module.exports = __toCommonJS(index_exports);
|
|
59
|
-
var
|
|
59
|
+
var import_core4 = require("@formspec/core");
|
|
60
60
|
|
|
61
61
|
// src/json-schema/generator.ts
|
|
62
62
|
var import_core = require("@formspec/core");
|
|
@@ -1001,20 +1001,29 @@ function assertNoSerializedNameCollisions(ir) {
|
|
|
1001
1001
|
}
|
|
1002
1002
|
|
|
1003
1003
|
// src/json-schema/ir-generator.ts
|
|
1004
|
+
function parseEnumSerialization(value) {
|
|
1005
|
+
switch (value) {
|
|
1006
|
+
case void 0:
|
|
1007
|
+
case "enum":
|
|
1008
|
+
return "enum";
|
|
1009
|
+
case "oneOf":
|
|
1010
|
+
return "oneOf";
|
|
1011
|
+
case "smart-size":
|
|
1012
|
+
return "smart-size";
|
|
1013
|
+
default:
|
|
1014
|
+
throw new Error(
|
|
1015
|
+
`Invalid enumSerialization "${String(value)}". Expected "enum", "oneOf", or "smart-size".`
|
|
1016
|
+
);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1004
1019
|
function makeContext(options) {
|
|
1005
1020
|
const vendorPrefix = options?.vendorPrefix ?? "x-formspec";
|
|
1006
|
-
const
|
|
1021
|
+
const enumSerialization = parseEnumSerialization(options?.enumSerialization);
|
|
1007
1022
|
if (!vendorPrefix.startsWith("x-")) {
|
|
1008
1023
|
throw new Error(
|
|
1009
1024
|
`Invalid vendorPrefix "${vendorPrefix}". Extension JSON Schema keywords must start with "x-".`
|
|
1010
1025
|
);
|
|
1011
1026
|
}
|
|
1012
|
-
if (rawEnumSerialization !== void 0 && rawEnumSerialization !== "enum" && rawEnumSerialization !== "oneOf") {
|
|
1013
|
-
throw new Error(
|
|
1014
|
-
`Invalid enumSerialization "${rawEnumSerialization}". Expected "enum" or "oneOf".`
|
|
1015
|
-
);
|
|
1016
|
-
}
|
|
1017
|
-
const enumSerialization = rawEnumSerialization ?? "enum";
|
|
1018
1027
|
return {
|
|
1019
1028
|
defs: {},
|
|
1020
1029
|
typeNameMap: {},
|
|
@@ -1222,21 +1231,31 @@ function generatePrimitiveType(type) {
|
|
|
1222
1231
|
};
|
|
1223
1232
|
}
|
|
1224
1233
|
function generateEnumType(type, ctx) {
|
|
1225
|
-
if (ctx.enumSerialization === "oneOf") {
|
|
1234
|
+
if (ctx.enumSerialization === "oneOf" || ctx.enumSerialization === "smart-size" && shouldSerializeEnumAsOneOf(type)) {
|
|
1226
1235
|
return {
|
|
1227
|
-
oneOf: type.members.map((m) =>
|
|
1228
|
-
const
|
|
1229
|
-
title
|
|
1230
|
-
|
|
1236
|
+
oneOf: type.members.map((m) => {
|
|
1237
|
+
const stringValue = String(m.value);
|
|
1238
|
+
const title = m.displayName !== void 0 && m.displayName !== stringValue ? m.displayName : void 0;
|
|
1239
|
+
return title !== void 0 ? { const: m.value, title } : { const: m.value };
|
|
1240
|
+
})
|
|
1231
1241
|
};
|
|
1232
1242
|
}
|
|
1233
1243
|
const schema = { enum: type.members.map((m) => m.value) };
|
|
1244
|
+
if (ctx.enumSerialization === "smart-size") {
|
|
1245
|
+
return schema;
|
|
1246
|
+
}
|
|
1234
1247
|
const displayNames = buildEnumDisplayNameExtension(type);
|
|
1235
1248
|
if (displayNames !== void 0) {
|
|
1236
1249
|
schema[`${ctx.vendorPrefix}-display-names`] = displayNames;
|
|
1237
1250
|
}
|
|
1238
1251
|
return schema;
|
|
1239
1252
|
}
|
|
1253
|
+
function shouldSerializeEnumAsOneOf(type) {
|
|
1254
|
+
return type.members.some((member) => {
|
|
1255
|
+
const title = member.displayName ?? String(member.value);
|
|
1256
|
+
return title !== String(member.value);
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1240
1259
|
function buildEnumDisplayNameExtension(type) {
|
|
1241
1260
|
if (!type.members.some((member) => member.displayName !== void 0)) {
|
|
1242
1261
|
return void 0;
|
|
@@ -2024,6 +2043,11 @@ function buildConstraintTagSources(extensions) {
|
|
|
2024
2043
|
}));
|
|
2025
2044
|
}
|
|
2026
2045
|
function createExtensionRegistry(extensions) {
|
|
2046
|
+
const registryLog = (0, import_internal.getSyntheticLogger)();
|
|
2047
|
+
registryLog.debug("createExtensionRegistry: constructing", {
|
|
2048
|
+
extensionCount: extensions.length,
|
|
2049
|
+
extensionIds: extensions.map((e) => e.extensionId)
|
|
2050
|
+
});
|
|
2027
2051
|
const reservedTagSources = buildConstraintTagSources(extensions);
|
|
2028
2052
|
let symbolMap = /* @__PURE__ */ new Map();
|
|
2029
2053
|
const typeMap = /* @__PURE__ */ new Map();
|
|
@@ -2155,6 +2179,14 @@ function createExtensionRegistry(extensions) {
|
|
|
2155
2179
|
}
|
|
2156
2180
|
}
|
|
2157
2181
|
}
|
|
2182
|
+
registryLog.debug("createExtensionRegistry: complete", {
|
|
2183
|
+
typeCount: typeMap.size,
|
|
2184
|
+
constraintCount: constraintMap.size,
|
|
2185
|
+
constraintTagCount: constraintTagMap.size,
|
|
2186
|
+
broadeningCount: builtinBroadeningMap.size,
|
|
2187
|
+
annotationCount: annotationMap.size,
|
|
2188
|
+
metadataSlotCount: metadataSlotMap.size
|
|
2189
|
+
});
|
|
2158
2190
|
return {
|
|
2159
2191
|
extensions,
|
|
2160
2192
|
findType: (typeId) => typeMap.get(typeId),
|
|
@@ -2242,7 +2274,7 @@ var path = __toESM(require("path"), 1);
|
|
|
2242
2274
|
|
|
2243
2275
|
// src/analyzer/class-analyzer.ts
|
|
2244
2276
|
var ts6 = __toESM(require("typescript"), 1);
|
|
2245
|
-
var
|
|
2277
|
+
var import_internal5 = require("@formspec/analysis/internal");
|
|
2246
2278
|
|
|
2247
2279
|
// src/analyzer/jsdoc-constraints.ts
|
|
2248
2280
|
var ts5 = __toESM(require("typescript"), 1);
|
|
@@ -2252,6 +2284,7 @@ var ts4 = __toESM(require("typescript"), 1);
|
|
|
2252
2284
|
var import_internal3 = require("@formspec/analysis/internal");
|
|
2253
2285
|
var import_internals4 = require("@formspec/core/internals");
|
|
2254
2286
|
var import_internals5 = require("@formspec/core/internals");
|
|
2287
|
+
var import_core3 = require("@formspec/core");
|
|
2255
2288
|
|
|
2256
2289
|
// src/extensions/resolve-custom-type.ts
|
|
2257
2290
|
var ts2 = __toESM(require("typescript"), 1);
|
|
@@ -2379,6 +2412,7 @@ function isIntegerBrandedType(type) {
|
|
|
2379
2412
|
}
|
|
2380
2413
|
|
|
2381
2414
|
// src/analyzer/tsdoc-parser.ts
|
|
2415
|
+
var import_internal4 = require("@formspec/analysis/internal");
|
|
2382
2416
|
function sharedTagValueOptions(options) {
|
|
2383
2417
|
return {
|
|
2384
2418
|
...options?.extensionRegistry !== void 0 ? { registry: options.extensionRegistry } : {},
|
|
@@ -2785,56 +2819,82 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
|
|
|
2785
2819
|
if (definition === null) {
|
|
2786
2820
|
return [];
|
|
2787
2821
|
}
|
|
2822
|
+
const nonNullPlacement = placement;
|
|
2823
|
+
const log = (0, import_internal4.getBuildLogger)();
|
|
2824
|
+
const broadeningLog = (0, import_internal4.getBroadeningLogger)();
|
|
2825
|
+
const syntheticLog = (0, import_internal4.getSyntheticLogger)();
|
|
2826
|
+
const logsEnabled = log !== import_core3.noopLogger || broadeningLog !== import_core3.noopLogger;
|
|
2827
|
+
const syntheticTraceEnabled = syntheticLog !== import_core3.noopLogger;
|
|
2828
|
+
const logStart = logsEnabled ? (0, import_internal4.nowMicros)() : 0;
|
|
2829
|
+
const subjectTypeKind = logsEnabled ? (0, import_internal4.describeTypeKind)(subjectType, checker) : "";
|
|
2830
|
+
function emit(outcome, result2) {
|
|
2831
|
+
if (!logsEnabled) {
|
|
2832
|
+
return result2;
|
|
2833
|
+
}
|
|
2834
|
+
const entry = {
|
|
2835
|
+
consumer: "build",
|
|
2836
|
+
tag: tagName,
|
|
2837
|
+
placement: nonNullPlacement,
|
|
2838
|
+
subjectTypeKind,
|
|
2839
|
+
roleOutcome: outcome,
|
|
2840
|
+
elapsedMicros: (0, import_internal4.elapsedMicros)(logStart)
|
|
2841
|
+
};
|
|
2842
|
+
(0, import_internal4.logTagApplication)(log, entry);
|
|
2843
|
+
if (outcome === "bypass" || outcome === "D1" || outcome === "D2") {
|
|
2844
|
+
(0, import_internal4.logTagApplication)(broadeningLog, entry);
|
|
2845
|
+
}
|
|
2846
|
+
return result2;
|
|
2847
|
+
}
|
|
2788
2848
|
if (!definition.placements.includes(placement)) {
|
|
2789
|
-
return [
|
|
2849
|
+
return emit("A-reject", [
|
|
2790
2850
|
makeDiagnostic(
|
|
2791
2851
|
"INVALID_TAG_PLACEMENT",
|
|
2792
2852
|
`Tag "@${tagName}" is not allowed on ${placementLabel(placement)}.`,
|
|
2793
2853
|
provenance
|
|
2794
2854
|
)
|
|
2795
|
-
];
|
|
2855
|
+
]);
|
|
2796
2856
|
}
|
|
2797
2857
|
const target = parsedTag?.target ?? null;
|
|
2798
2858
|
let evaluatedType = subjectType;
|
|
2799
2859
|
let targetLabel = node.getText(sourceFile);
|
|
2800
2860
|
if (target !== null) {
|
|
2801
2861
|
if (target.kind !== "path") {
|
|
2802
|
-
return [
|
|
2862
|
+
return emit("B-reject", [
|
|
2803
2863
|
makeDiagnostic(
|
|
2804
2864
|
"UNSUPPORTED_TARGETING_SYNTAX",
|
|
2805
2865
|
`Tag "@${tagName}" does not support ${target.kind} targeting syntax.`,
|
|
2806
2866
|
provenance
|
|
2807
2867
|
)
|
|
2808
|
-
];
|
|
2868
|
+
]);
|
|
2809
2869
|
}
|
|
2810
2870
|
if (!target.valid || target.path === null) {
|
|
2811
|
-
return [
|
|
2871
|
+
return emit("B-reject", [
|
|
2812
2872
|
makeDiagnostic(
|
|
2813
2873
|
"UNSUPPORTED_TARGETING_SYNTAX",
|
|
2814
2874
|
`Tag "@${tagName}" has invalid path targeting syntax.`,
|
|
2815
2875
|
provenance
|
|
2816
2876
|
)
|
|
2817
|
-
];
|
|
2877
|
+
]);
|
|
2818
2878
|
}
|
|
2819
2879
|
const resolution = (0, import_internal3.resolvePathTargetType)(subjectType, checker, target.path.segments);
|
|
2820
2880
|
if (resolution.kind === "missing-property") {
|
|
2821
|
-
return [
|
|
2881
|
+
return emit("B-reject", [
|
|
2822
2882
|
makeDiagnostic(
|
|
2823
2883
|
"UNKNOWN_PATH_TARGET",
|
|
2824
2884
|
`Target "${target.rawText}": path-targeted constraint "${tagName}" references unknown path segment "${resolution.segment}"`,
|
|
2825
2885
|
provenance
|
|
2826
2886
|
)
|
|
2827
|
-
];
|
|
2887
|
+
]);
|
|
2828
2888
|
}
|
|
2829
2889
|
if (resolution.kind === "unresolvable") {
|
|
2830
2890
|
const actualType = checker.typeToString(resolution.type, node, SYNTHETIC_TYPE_FORMAT_FLAGS);
|
|
2831
|
-
return [
|
|
2891
|
+
return emit("B-reject", [
|
|
2832
2892
|
makeDiagnostic(
|
|
2833
2893
|
"TYPE_MISMATCH",
|
|
2834
2894
|
`Target "${target.rawText}": path-targeted constraint "${tagName}" is invalid because type "${actualType}" cannot be traversed`,
|
|
2835
2895
|
provenance
|
|
2836
2896
|
)
|
|
2837
|
-
];
|
|
2897
|
+
]);
|
|
2838
2898
|
}
|
|
2839
2899
|
evaluatedType = resolution.type;
|
|
2840
2900
|
targetLabel = target.rawText;
|
|
@@ -2863,13 +2923,13 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
|
|
|
2863
2923
|
tagName,
|
|
2864
2924
|
parsedTag?.argumentText
|
|
2865
2925
|
) : null;
|
|
2866
|
-
return [
|
|
2926
|
+
return emit("B-reject", [
|
|
2867
2927
|
makeDiagnostic(
|
|
2868
2928
|
"TYPE_MISMATCH",
|
|
2869
2929
|
hint === null ? baseMessage : `${baseMessage}. ${hint}`,
|
|
2870
2930
|
provenance
|
|
2871
2931
|
)
|
|
2872
|
-
];
|
|
2932
|
+
]);
|
|
2873
2933
|
}
|
|
2874
2934
|
}
|
|
2875
2935
|
const argumentExpression = renderSyntheticArgumentExpression(
|
|
@@ -2877,14 +2937,23 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
|
|
|
2877
2937
|
parsedTag?.argumentText ?? ""
|
|
2878
2938
|
);
|
|
2879
2939
|
if (definition.requiresArgument && argumentExpression === null) {
|
|
2880
|
-
return [];
|
|
2940
|
+
return emit("A-pass", []);
|
|
2881
2941
|
}
|
|
2882
2942
|
if (hasBroadening) {
|
|
2883
|
-
return [];
|
|
2943
|
+
return emit("bypass", []);
|
|
2884
2944
|
}
|
|
2885
2945
|
const subjectTypeText = checker.typeToString(subjectType, node, SYNTHETIC_TYPE_FORMAT_FLAGS);
|
|
2886
2946
|
const hostType = options?.hostType ?? subjectType;
|
|
2887
2947
|
const hostTypeText = checker.typeToString(hostType, node, SYNTHETIC_TYPE_FORMAT_FLAGS);
|
|
2948
|
+
if (syntheticTraceEnabled) {
|
|
2949
|
+
syntheticLog.trace("invoking synthetic checker", {
|
|
2950
|
+
consumer: "build",
|
|
2951
|
+
tag: tagName,
|
|
2952
|
+
placement,
|
|
2953
|
+
subjectTypeKind,
|
|
2954
|
+
subjectTypeText
|
|
2955
|
+
});
|
|
2956
|
+
}
|
|
2888
2957
|
const result = (0, import_internal3.checkSyntheticTagApplication)({
|
|
2889
2958
|
tagName,
|
|
2890
2959
|
placement,
|
|
@@ -2911,26 +2980,26 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
|
|
|
2911
2980
|
} : {}
|
|
2912
2981
|
});
|
|
2913
2982
|
if (result.diagnostics.length === 0) {
|
|
2914
|
-
return [];
|
|
2983
|
+
return emit("C-pass", []);
|
|
2915
2984
|
}
|
|
2916
2985
|
const setupDiagnostic = result.diagnostics.find((diagnostic) => diagnostic.kind !== "typescript");
|
|
2917
2986
|
if (setupDiagnostic !== void 0) {
|
|
2918
|
-
return [
|
|
2987
|
+
return emit("C-reject", [
|
|
2919
2988
|
makeDiagnostic(
|
|
2920
2989
|
setupDiagnostic.kind === "unsupported-custom-type-override" ? "UNSUPPORTED_CUSTOM_TYPE_OVERRIDE" : "SYNTHETIC_SETUP_FAILURE",
|
|
2921
2990
|
setupDiagnostic.message,
|
|
2922
2991
|
provenance
|
|
2923
2992
|
)
|
|
2924
|
-
];
|
|
2993
|
+
]);
|
|
2925
2994
|
}
|
|
2926
2995
|
const expectedLabel = definition.valueKind === null ? "compatible argument" : capabilityLabel(definition.valueKind);
|
|
2927
|
-
return [
|
|
2996
|
+
return emit("C-reject", [
|
|
2928
2997
|
makeDiagnostic(
|
|
2929
2998
|
"TYPE_MISMATCH",
|
|
2930
2999
|
`Tag "@${tagName}" received an invalid argument for ${expectedLabel}.`,
|
|
2931
3000
|
provenance
|
|
2932
3001
|
)
|
|
2933
|
-
];
|
|
3002
|
+
]);
|
|
2934
3003
|
}
|
|
2935
3004
|
var parseResultCache = /* @__PURE__ */ new Map();
|
|
2936
3005
|
function getExtensionTagNames(options) {
|
|
@@ -3340,7 +3409,7 @@ function createAnalyzerMetadataPolicy(input, discriminator) {
|
|
|
3340
3409
|
};
|
|
3341
3410
|
}
|
|
3342
3411
|
function resolveNodeMetadata(metadataPolicy, declarationKind, logicalName, node, checker, extensionRegistry, buildContext) {
|
|
3343
|
-
const analysis = (0,
|
|
3412
|
+
const analysis = (0, import_internal5.analyzeMetadataForNodeWithChecker)({
|
|
3344
3413
|
checker,
|
|
3345
3414
|
node,
|
|
3346
3415
|
logicalName,
|
|
@@ -3681,7 +3750,7 @@ function getLeadingParsedTags(node) {
|
|
|
3681
3750
|
if (!commentText.startsWith("/**")) {
|
|
3682
3751
|
continue;
|
|
3683
3752
|
}
|
|
3684
|
-
parsedTags.push(...(0,
|
|
3753
|
+
parsedTags.push(...(0, import_internal5.parseCommentBlock)(commentText, { offset: range.pos }).tags);
|
|
3685
3754
|
}
|
|
3686
3755
|
return parsedTags;
|
|
3687
3756
|
}
|
|
@@ -4090,6 +4159,22 @@ function extractReferenceTypeArguments(type, checker, file, typeRegistry, visiti
|
|
|
4090
4159
|
}
|
|
4091
4160
|
return referenceTypeNode.typeArguments.map((argumentNode) => {
|
|
4092
4161
|
const argumentType = checker.getTypeFromTypeNode(argumentNode);
|
|
4162
|
+
const baseSymbol = argumentType.aliasSymbol ?? argumentType.getSymbol();
|
|
4163
|
+
const argumentSymbol = baseSymbol !== void 0 && baseSymbol.flags & ts6.SymbolFlags.Alias ? checker.getAliasedSymbol(baseSymbol) : baseSymbol;
|
|
4164
|
+
const argumentDecl = argumentSymbol?.declarations?.[0];
|
|
4165
|
+
if (argumentDecl !== void 0 && argumentDecl.getSourceFile().fileName !== file) {
|
|
4166
|
+
const argumentName = argumentSymbol?.getName() ?? baseSymbol?.getName();
|
|
4167
|
+
if (argumentName !== void 0) {
|
|
4168
|
+
return {
|
|
4169
|
+
tsType: argumentType,
|
|
4170
|
+
typeNode: {
|
|
4171
|
+
kind: "reference",
|
|
4172
|
+
name: argumentName,
|
|
4173
|
+
typeArguments: []
|
|
4174
|
+
}
|
|
4175
|
+
};
|
|
4176
|
+
}
|
|
4177
|
+
}
|
|
4093
4178
|
return {
|
|
4094
4179
|
tsType: argumentType,
|
|
4095
4180
|
typeNode: resolveTypeNode(
|
|
@@ -4356,22 +4441,10 @@ function resolveTypeNode(type, checker, file, typeRegistry, visiting, sourceNode
|
|
|
4356
4441
|
sourceNode
|
|
4357
4442
|
);
|
|
4358
4443
|
if (customTypeLookup !== null) {
|
|
4359
|
-
const typeId = customTypeIdFromLookup(customTypeLookup);
|
|
4360
|
-
let payload = null;
|
|
4361
|
-
if (customTypeLookup.registration.extractPayload !== void 0) {
|
|
4362
|
-
try {
|
|
4363
|
-
payload = customTypeLookup.registration.extractPayload(type, checker) ?? null;
|
|
4364
|
-
} catch (cause) {
|
|
4365
|
-
throw new Error(
|
|
4366
|
-
`extractPayload for custom type "${customTypeLookup.registration.typeName}" in extension "${customTypeLookup.extensionId}" threw`,
|
|
4367
|
-
{ cause }
|
|
4368
|
-
);
|
|
4369
|
-
}
|
|
4370
|
-
}
|
|
4371
4444
|
return {
|
|
4372
4445
|
kind: "custom",
|
|
4373
|
-
typeId,
|
|
4374
|
-
payload
|
|
4446
|
+
typeId: customTypeIdFromLookup(customTypeLookup),
|
|
4447
|
+
payload: null
|
|
4375
4448
|
};
|
|
4376
4449
|
}
|
|
4377
4450
|
const primitiveAlias = tryResolveNamedPrimitiveAlias(
|
|
@@ -4555,6 +4628,21 @@ function getReferencedTypeAliasDeclaration(sourceNode, checker) {
|
|
|
4555
4628
|
}
|
|
4556
4629
|
return getTypeAliasDeclarationFromTypeReference(typeNode, checker);
|
|
4557
4630
|
}
|
|
4631
|
+
function resolveNamedTypeWithSourceRecovery(type, sourceNode, checker) {
|
|
4632
|
+
const typeName = getNamedTypeName(type);
|
|
4633
|
+
const namedDecl = getNamedTypeDeclaration(type);
|
|
4634
|
+
if (typeName !== null && namedDecl !== void 0) {
|
|
4635
|
+
return { typeName, namedDecl };
|
|
4636
|
+
}
|
|
4637
|
+
if (sourceNode === void 0) {
|
|
4638
|
+
return null;
|
|
4639
|
+
}
|
|
4640
|
+
const refAliasDecl = getReferencedTypeAliasDeclaration(sourceNode, checker);
|
|
4641
|
+
if (refAliasDecl === void 0) {
|
|
4642
|
+
return null;
|
|
4643
|
+
}
|
|
4644
|
+
return { typeName: refAliasDecl.name.text, namedDecl: refAliasDecl };
|
|
4645
|
+
}
|
|
4558
4646
|
function shouldEmitPrimitiveAliasDefinition(typeNode, checker) {
|
|
4559
4647
|
if (!ts6.isTypeReferenceNode(typeNode)) {
|
|
4560
4648
|
return false;
|
|
@@ -4613,8 +4701,23 @@ function resolveAliasedPrimitiveTarget(type, checker, file, typeRegistry, visiti
|
|
|
4613
4701
|
);
|
|
4614
4702
|
}
|
|
4615
4703
|
function resolveUnionType(type, checker, file, typeRegistry, visiting, sourceNode, metadataPolicy = createAnalyzerMetadataPolicy(void 0), extensionRegistry, diagnostics) {
|
|
4616
|
-
const
|
|
4617
|
-
|
|
4704
|
+
const recovered = resolveNamedTypeWithSourceRecovery(type, sourceNode, checker);
|
|
4705
|
+
let typeName = null;
|
|
4706
|
+
let namedDecl;
|
|
4707
|
+
if (recovered !== null) {
|
|
4708
|
+
const recoveredAliasDecl = ts6.isTypeAliasDeclaration(recovered.namedDecl) ? recovered.namedDecl : void 0;
|
|
4709
|
+
if (recoveredAliasDecl !== void 0) {
|
|
4710
|
+
const aliasUnderlyingType = checker.getTypeFromTypeNode(recoveredAliasDecl.type);
|
|
4711
|
+
const isNonGeneric = recoveredAliasDecl.typeParameters === void 0 || recoveredAliasDecl.typeParameters.length === 0;
|
|
4712
|
+
if (isNonGeneric && (aliasUnderlyingType.isUnion() || isObjectType(aliasUnderlyingType))) {
|
|
4713
|
+
typeName = recovered.typeName;
|
|
4714
|
+
namedDecl = recovered.namedDecl;
|
|
4715
|
+
}
|
|
4716
|
+
} else {
|
|
4717
|
+
typeName = recovered.typeName;
|
|
4718
|
+
namedDecl = recovered.namedDecl;
|
|
4719
|
+
}
|
|
4720
|
+
}
|
|
4618
4721
|
if (typeName && typeName in typeRegistry) {
|
|
4619
4722
|
return { kind: "reference", name: typeName, typeArguments: [] };
|
|
4620
4723
|
}
|
|
@@ -4646,6 +4749,10 @@ function resolveUnionType(type, checker, file, typeRegistry, visiting, sourceNod
|
|
|
4646
4749
|
if (!typeName) {
|
|
4647
4750
|
return result;
|
|
4648
4751
|
}
|
|
4752
|
+
const existing = typeRegistry[typeName];
|
|
4753
|
+
if (existing !== void 0 && existing.type !== RESOLVING_TYPE_PLACEHOLDER) {
|
|
4754
|
+
return { kind: "reference", name: typeName, typeArguments: [] };
|
|
4755
|
+
}
|
|
4649
4756
|
const annotations = namedDecl ? extractJSDocAnnotationNodes(namedDecl, file, makeParseOptions(extensionRegistry)) : void 0;
|
|
4650
4757
|
const metadata = namedDecl !== void 0 ? resolveNodeMetadata(
|
|
4651
4758
|
metadataPolicy,
|
|
@@ -5769,9 +5876,9 @@ function findRegistrationByTypeName(registry, typeName) {
|
|
|
5769
5876
|
}
|
|
5770
5877
|
|
|
5771
5878
|
// src/validate/constraint-validator.ts
|
|
5772
|
-
var
|
|
5879
|
+
var import_internal6 = require("@formspec/analysis/internal");
|
|
5773
5880
|
function validateFieldNode(ctx, field) {
|
|
5774
|
-
const analysis = (0,
|
|
5881
|
+
const analysis = (0, import_internal6.analyzeConstraintTargets)(
|
|
5775
5882
|
field.name,
|
|
5776
5883
|
field.type,
|
|
5777
5884
|
field.constraints,
|
|
@@ -5789,7 +5896,7 @@ function validateFieldNode(ctx, field) {
|
|
|
5789
5896
|
}
|
|
5790
5897
|
function validateObjectProperty(ctx, parentName, property) {
|
|
5791
5898
|
const qualifiedName = `${parentName}.${property.name}`;
|
|
5792
|
-
const analysis = (0,
|
|
5899
|
+
const analysis = (0, import_internal6.analyzeConstraintTargets)(
|
|
5793
5900
|
qualifiedName,
|
|
5794
5901
|
property.type,
|
|
5795
5902
|
property.constraints,
|
|
@@ -6201,7 +6308,7 @@ function resolveModuleExportDeclaration(context, exportName = "default") {
|
|
|
6201
6308
|
|
|
6202
6309
|
// src/generators/discovered-schema.ts
|
|
6203
6310
|
var ts11 = __toESM(require("typescript"), 1);
|
|
6204
|
-
var
|
|
6311
|
+
var import_internal7 = require("@formspec/analysis/internal");
|
|
6205
6312
|
var import_internals6 = require("@formspec/core/internals");
|
|
6206
6313
|
function toDiscoveredTypeSchemas(result, resolvedMetadata) {
|
|
6207
6314
|
return {
|
|
@@ -6558,7 +6665,7 @@ function generateSchemasFromReturnType(options) {
|
|
|
6558
6665
|
}
|
|
6559
6666
|
function resolveDeclarationMetadata(options) {
|
|
6560
6667
|
const resolved = resolveStaticOptions(options);
|
|
6561
|
-
const analysis = (0,
|
|
6668
|
+
const analysis = (0, import_internal7.analyzeMetadataForNodeWithChecker)({
|
|
6562
6669
|
checker: options.context.checker,
|
|
6563
6670
|
node: options.declaration,
|
|
6564
6671
|
metadata: resolved.metadata,
|
|
@@ -6801,7 +6908,7 @@ function annotationKey(annotation) {
|
|
|
6801
6908
|
|
|
6802
6909
|
// src/index.ts
|
|
6803
6910
|
function buildFormSchemas(form, options) {
|
|
6804
|
-
const logger = options?.logger ??
|
|
6911
|
+
const logger = options?.logger ?? import_core4.noopLogger;
|
|
6805
6912
|
logger.debug("buildFormSchemas: starting schema generation");
|
|
6806
6913
|
return {
|
|
6807
6914
|
jsonSchema: generateJsonSchema(form, options),
|
|
@@ -6818,7 +6925,7 @@ function writeSchemas(form, options) {
|
|
|
6818
6925
|
metadata,
|
|
6819
6926
|
logger: rawLogger
|
|
6820
6927
|
} = options;
|
|
6821
|
-
const logger = (rawLogger ??
|
|
6928
|
+
const logger = (rawLogger ?? import_core4.noopLogger).child({ stage: "write" });
|
|
6822
6929
|
const buildOptions = vendorPrefix === void 0 && enumSerialization === void 0 && metadata === void 0 ? { logger: rawLogger } : {
|
|
6823
6930
|
...vendorPrefix !== void 0 && { vendorPrefix },
|
|
6824
6931
|
...enumSerialization !== void 0 && { enumSerialization },
|