@formspec/build 0.1.0-alpha.57 → 0.1.0-alpha.58
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/tsdoc-parser.d.ts.map +1 -1
- package/dist/cli.cjs +55 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +57 -8
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +55 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +57 -8
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +55 -8
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.js +57 -8
- package/dist/internals.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdoc-parser.d.ts","sourceRoot":"","sources":["../../src/analyzer/tsdoc-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAeL,KAAK,4BAA4B,EAIlC,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EAEnB,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"tsdoc-parser.d.ts","sourceRoot":"","sources":["../../src/analyzer/tsdoc-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAeL,KAAK,4BAA4B,EAIlC,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EAEnB,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,0BAA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C,IAAI,GAAG,mBAAmB,CAmC7E;AAMD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,GACX;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAEpD"}
|
package/dist/cli.cjs
CHANGED
|
@@ -2630,6 +2630,7 @@ function processConstraintTag(tagName, text, parsedTag, provenance, node, source
|
|
|
2630
2630
|
sourceFile,
|
|
2631
2631
|
tagName,
|
|
2632
2632
|
parsedTag,
|
|
2633
|
+
text,
|
|
2633
2634
|
provenance,
|
|
2634
2635
|
supportingDeclarations,
|
|
2635
2636
|
options
|
|
@@ -2657,6 +2658,9 @@ function renderSyntheticArgumentExpression(valueKind, argumentText) {
|
|
|
2657
2658
|
case "number":
|
|
2658
2659
|
case "integer":
|
|
2659
2660
|
case "signedInteger":
|
|
2661
|
+
if (trimmed === "Infinity" || trimmed === "-Infinity" || trimmed === "NaN") {
|
|
2662
|
+
return trimmed;
|
|
2663
|
+
}
|
|
2660
2664
|
return Number.isFinite(Number(trimmed)) ? trimmed : JSON.stringify(trimmed);
|
|
2661
2665
|
case "string":
|
|
2662
2666
|
return JSON.stringify(argumentText);
|
|
@@ -2866,7 +2870,7 @@ function hasBuiltinConstraintBroadening(tagName, options) {
|
|
|
2866
2870
|
const broadenedTypeId = getBroadenedCustomTypeId(options?.fieldType);
|
|
2867
2871
|
return broadenedTypeId !== void 0 && options?.extensionRegistry?.findBuiltinConstraintBroadening(broadenedTypeId, tagName) !== void 0;
|
|
2868
2872
|
}
|
|
2869
|
-
function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, parsedTag, provenance, supportingDeclarations, options) {
|
|
2873
|
+
function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, parsedTag, rawText, provenance, supportingDeclarations, options) {
|
|
2870
2874
|
if (!(0, import_internals4.isBuiltinConstraintName)(tagName)) {
|
|
2871
2875
|
return [];
|
|
2872
2876
|
}
|
|
@@ -2887,8 +2891,10 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
|
|
|
2887
2891
|
const log2 = (0, import_internal4.getBuildLogger)();
|
|
2888
2892
|
const broadeningLog = (0, import_internal4.getBroadeningLogger)();
|
|
2889
2893
|
const syntheticLog = (0, import_internal4.getSyntheticLogger)();
|
|
2894
|
+
const typedParserLog = (0, import_internal4.getTypedParserLogger)();
|
|
2890
2895
|
const logsEnabled = log2 !== import_core4.noopLogger || broadeningLog !== import_core4.noopLogger;
|
|
2891
2896
|
const syntheticTraceEnabled = syntheticLog !== import_core4.noopLogger;
|
|
2897
|
+
const typedParserTraceEnabled = typedParserLog !== import_core4.noopLogger;
|
|
2892
2898
|
const logStart = logsEnabled ? (0, import_internal4.nowMicros)() : 0;
|
|
2893
2899
|
const subjectTypeKind = logsEnabled ? (0, import_internal4.describeTypeKind)(subjectType, checker) : "";
|
|
2894
2900
|
function emit(outcome, result2) {
|
|
@@ -2996,16 +3002,57 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
|
|
|
2996
3002
|
]);
|
|
2997
3003
|
}
|
|
2998
3004
|
}
|
|
2999
|
-
const
|
|
3000
|
-
definition.valueKind,
|
|
3001
|
-
parsedTag?.argumentText ?? ""
|
|
3002
|
-
);
|
|
3003
|
-
if (definition.requiresArgument && argumentExpression === null) {
|
|
3004
|
-
return emit("A-pass", []);
|
|
3005
|
-
}
|
|
3005
|
+
const effectiveArgumentText = parsedTag !== null ? (0, import_internal3.parseTagSyntax)(tagName, rawText).argumentText : rawText;
|
|
3006
3006
|
if (hasBroadening) {
|
|
3007
3007
|
return emit("bypass", []);
|
|
3008
3008
|
}
|
|
3009
|
+
const typedParseResult = (0, import_internal4.parseTagArgument)(tagName, effectiveArgumentText, "build");
|
|
3010
|
+
if (!typedParseResult.ok) {
|
|
3011
|
+
if (typedParserTraceEnabled) {
|
|
3012
|
+
typedParserLog.trace("typed-parser C-reject", {
|
|
3013
|
+
consumer: "build",
|
|
3014
|
+
tag: tagName,
|
|
3015
|
+
placement: nonNullPlacement,
|
|
3016
|
+
subjectTypeKind: subjectTypeKind !== "" ? subjectTypeKind : "-",
|
|
3017
|
+
roleOutcome: "C-reject",
|
|
3018
|
+
diagnosticCode: typedParseResult.diagnostic.code
|
|
3019
|
+
});
|
|
3020
|
+
}
|
|
3021
|
+
let mappedCode;
|
|
3022
|
+
switch (typedParseResult.diagnostic.code) {
|
|
3023
|
+
case "MISSING_TAG_ARGUMENT":
|
|
3024
|
+
mappedCode = "MISSING_TAG_ARGUMENT";
|
|
3025
|
+
break;
|
|
3026
|
+
case "INVALID_TAG_ARGUMENT":
|
|
3027
|
+
mappedCode = "INVALID_TAG_ARGUMENT";
|
|
3028
|
+
break;
|
|
3029
|
+
case "UNKNOWN_TAG":
|
|
3030
|
+
throw new Error(
|
|
3031
|
+
`Unexpected UNKNOWN_TAG from parseTagArgument("${tagName}") \u2014 tag was resolved via getTagDefinition.`
|
|
3032
|
+
);
|
|
3033
|
+
default: {
|
|
3034
|
+
const _exhaustive = typedParseResult.diagnostic.code;
|
|
3035
|
+
throw new Error(`Unknown diagnostic code: ${String(_exhaustive)}`);
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
return emit("C-reject", [
|
|
3039
|
+
makeDiagnostic(mappedCode, typedParseResult.diagnostic.message, provenance)
|
|
3040
|
+
]);
|
|
3041
|
+
}
|
|
3042
|
+
if (typedParserTraceEnabled) {
|
|
3043
|
+
typedParserLog.trace("typed-parser C-pass", {
|
|
3044
|
+
consumer: "build",
|
|
3045
|
+
tag: tagName,
|
|
3046
|
+
placement: nonNullPlacement,
|
|
3047
|
+
subjectTypeKind: subjectTypeKind !== "" ? subjectTypeKind : "-",
|
|
3048
|
+
roleOutcome: "C-pass",
|
|
3049
|
+
valueKind: typedParseResult.value.kind
|
|
3050
|
+
});
|
|
3051
|
+
}
|
|
3052
|
+
const argumentExpression = renderSyntheticArgumentExpression(
|
|
3053
|
+
definition.valueKind,
|
|
3054
|
+
effectiveArgumentText
|
|
3055
|
+
);
|
|
3009
3056
|
const subjectTypeText = checker.typeToString(subjectType, node, SYNTHETIC_TYPE_FORMAT_FLAGS);
|
|
3010
3057
|
const hostType = options?.hostType ?? subjectType;
|
|
3011
3058
|
const hostTypeText = checker.typeToString(hostType, node, SYNTHETIC_TYPE_FORMAT_FLAGS);
|