@ng-doc/builder 22.1.0 → 22.2.0
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/generator/bootstrap/bin.js +150 -107
- package/generator/bootstrap/cli.js +150 -107
- package/generator/bootstrap/index.js +125 -99
- package/generator/bootstrap/process-tree.d.ts +5 -4
- package/generator/build-metafile.json +177 -78
- package/generator/build-provenance.json +3 -3
- package/generator/compiler/index.js +689 -484
- package/generator/content/html-worker.js +8 -0
- package/generator/contracts.d.ts +20 -2
- package/generator/kernel/flags.d.ts +3 -0
- package/generator/outputs/index.d.ts +22 -6
- package/generator/templates/demo-routes.ts.nunj +21 -1
- package/generator/templates/page.ts.nunj +5 -1
- package/generator/vite/angular/analog-provenance.json +1 -1
- package/generator/vite/angular-composition.d.ts +25 -1
- package/generator/vite/content-updates.d.ts +62 -0
- package/generator/vite/host-updates.d.ts +85 -5
- package/generator/vite/index.js +621 -243
- package/generator/vite/lifecycle.d.ts +39 -2
- package/helpers/playground/get-playground-inputs.js +6 -3
- package/helpers/playground/get-playground-inputs.js.map +1 -1
- package/helpers/playground/playground-options.d.ts +28 -0
- package/helpers/playground/playground-options.js +122 -0
- package/helpers/playground/playground-options.js.map +1 -0
- package/helpers/playground/written-union-order.d.ts +33 -0
- package/helpers/playground/written-union-order.js +106 -0
- package/helpers/playground/written-union-order.js.map +1 -0
- package/interfaces/configuration.d.ts +11 -3
- package/package.json +4 -4
- package/templates/demo-routes.ts.nunj +21 -1
- package/templates/page.ts.nunj +5 -1
|
@@ -479,6 +479,22 @@ var init_kebab_case = __esm({
|
|
|
479
479
|
}
|
|
480
480
|
});
|
|
481
481
|
|
|
482
|
+
// libs/core/helpers/playground-target-slugs.ts
|
|
483
|
+
function \u0275playgroundTargetSlugs(targets) {
|
|
484
|
+
const seen = /* @__PURE__ */ new Map();
|
|
485
|
+
return targets.map((target) => {
|
|
486
|
+
const base = target.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "target";
|
|
487
|
+
const count = (seen.get(base) ?? 0) + 1;
|
|
488
|
+
seen.set(base, count);
|
|
489
|
+
return count === 1 ? base : `${base}-${count}`;
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
var init_playground_target_slugs = __esm({
|
|
493
|
+
"libs/core/helpers/playground-target-slugs.ts"() {
|
|
494
|
+
"use strict";
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
|
|
482
498
|
// libs/core/helpers/stringify.ts
|
|
483
499
|
var init_stringify = __esm({
|
|
484
500
|
"libs/core/helpers/stringify.ts"() {
|
|
@@ -524,6 +540,7 @@ var init_helpers = __esm({
|
|
|
524
540
|
init_is_same_object();
|
|
525
541
|
init_kebab_case();
|
|
526
542
|
init_object_keys();
|
|
543
|
+
init_playground_target_slugs();
|
|
527
544
|
init_stringify();
|
|
528
545
|
init_uid();
|
|
529
546
|
init_unique();
|
|
@@ -887,60 +904,60 @@ var init_helpers2 = __esm({
|
|
|
887
904
|
});
|
|
888
905
|
|
|
889
906
|
// libs/utils/html/plugins/keyword-positions.ts
|
|
890
|
-
function scanInlineCode(
|
|
891
|
-
if (WHOLE_KEYWORD.test(
|
|
907
|
+
function scanInlineCode(text2) {
|
|
908
|
+
if (WHOLE_KEYWORD.test(text2)) {
|
|
892
909
|
return { whole: true, position: () => REFERENCE };
|
|
893
910
|
}
|
|
894
|
-
if (HTML_START.test(
|
|
911
|
+
if (HTML_START.test(text2) || !(CODE_PUNCTUATION.test(text2) || DECLARATION_START.test(text2))) {
|
|
895
912
|
return void 0;
|
|
896
913
|
}
|
|
897
|
-
const scan = scanTypeScript(
|
|
898
|
-
return isProse(
|
|
914
|
+
const scan = scanTypeScript(text2);
|
|
915
|
+
return isProse(text2, scan.masked) ? void 0 : scan;
|
|
899
916
|
}
|
|
900
|
-
function scanCodeBlock(
|
|
901
|
-
return mode === "html" ? scanHtml(
|
|
917
|
+
function scanCodeBlock(text2, mode) {
|
|
918
|
+
return mode === "html" ? scanHtml(text2) : scanTypeScript(text2);
|
|
902
919
|
}
|
|
903
|
-
function scanTypeScript(
|
|
904
|
-
const masked = maskTypeScript(
|
|
905
|
-
const locals = localBindings(
|
|
920
|
+
function scanTypeScript(text2) {
|
|
921
|
+
const masked = maskTypeScript(text2);
|
|
922
|
+
const locals = localBindings(text2, masked);
|
|
906
923
|
return {
|
|
907
924
|
whole: false,
|
|
908
925
|
masked,
|
|
909
926
|
position(start, end, key) {
|
|
910
927
|
if (masked[start] === TEMPLATE) {
|
|
911
|
-
const before =
|
|
912
|
-
const element = key.includes("-") && (before === "<" || before === "/" &&
|
|
928
|
+
const before = text2[start - 1] ?? "";
|
|
929
|
+
const element = key.includes("-") && (before === "<" || before === "/" && text2[start - 2] === "<");
|
|
913
930
|
const controlFlow = CONTROL_FLOW.test(key) && !WORD_CHARACTER.test(before);
|
|
914
931
|
return element || controlFlow ? REFERENCE : NOT_A_REFERENCE;
|
|
915
932
|
}
|
|
916
933
|
if (masked[start] !== CODE) {
|
|
917
934
|
return NOT_A_REFERENCE;
|
|
918
935
|
}
|
|
919
|
-
const previous = previousSignificant(
|
|
920
|
-
const next = nextSignificant(
|
|
921
|
-
const nextCharacter =
|
|
936
|
+
const previous = previousSignificant(text2, start, masked);
|
|
937
|
+
const next = nextSignificant(text2, end, masked);
|
|
938
|
+
const nextCharacter = text2[next] ?? "";
|
|
922
939
|
if (SYNTAX_WORDS.has(key) || RESERVED_WORDS.has(key) && nextCharacter !== "(") {
|
|
923
940
|
return NOT_A_REFERENCE;
|
|
924
941
|
}
|
|
925
|
-
if (
|
|
926
|
-
const ownerEnd =
|
|
927
|
-
const owner =
|
|
928
|
-
const word =
|
|
942
|
+
if (text2[previous] === "." && text2[previous - 1] !== ".") {
|
|
943
|
+
const ownerEnd = text2[previous - 1] === "?" ? previous - 1 : previous;
|
|
944
|
+
const owner = text2.slice(0, ownerEnd).match(IDENTIFIER_BEFORE)?.[0];
|
|
945
|
+
const word = text2.slice(start, end);
|
|
929
946
|
return owner && !/[.#]/.test(word) ? { link: true, keyword: `${owner}.${key.toLowerCase()}` } : NOT_A_REFERENCE;
|
|
930
947
|
}
|
|
931
|
-
if (isDeclaredName(
|
|
948
|
+
if (isDeclaredName(text2, masked, previous, next)) {
|
|
932
949
|
return NOT_A_REFERENCE;
|
|
933
950
|
}
|
|
934
951
|
return locals.has(key) ? NOT_A_REFERENCE : REFERENCE;
|
|
935
952
|
}
|
|
936
953
|
};
|
|
937
954
|
}
|
|
938
|
-
function isDeclaredName(
|
|
939
|
-
const after =
|
|
940
|
-
const afterNext =
|
|
941
|
-
if (after === ":" &&
|
|
942
|
-
const ternary =
|
|
943
|
-
return !ternary && previousWord(
|
|
955
|
+
function isDeclaredName(text2, masked, previous, next) {
|
|
956
|
+
const after = text2[next];
|
|
957
|
+
const afterNext = text2[nextSignificant(text2, next + 1, masked)];
|
|
958
|
+
if (after === ":" && text2[next + 1] !== ":") {
|
|
959
|
+
const ternary = text2[previous] === "?" && text2[previous + 1] !== ".";
|
|
960
|
+
return !ternary && previousWord(text2, previous) !== "case";
|
|
944
961
|
}
|
|
945
962
|
if ((after === "?" || after === "!") && afterNext === ":") {
|
|
946
963
|
return true;
|
|
@@ -948,36 +965,36 @@ function isDeclaredName(text, masked, previous, next) {
|
|
|
948
965
|
if (after === "?" && (afterNext === ")" || afterNext === ",")) {
|
|
949
966
|
return true;
|
|
950
967
|
}
|
|
951
|
-
if (after === "=" &&
|
|
952
|
-
return !TYPE_CONTEXT.includes(
|
|
968
|
+
if (after === "=" && text2[next + 1] !== "=" && text2[next + 1] !== ">") {
|
|
969
|
+
return !TYPE_CONTEXT.includes(text2[previous] ?? "") && !TYPE_WORDS.includes(previousWord(text2, previous));
|
|
953
970
|
}
|
|
954
971
|
return false;
|
|
955
972
|
}
|
|
956
|
-
function scanHtml(
|
|
957
|
-
const masked = maskHtml(
|
|
973
|
+
function scanHtml(text2) {
|
|
974
|
+
const masked = maskHtml(text2);
|
|
958
975
|
return {
|
|
959
976
|
whole: false,
|
|
960
977
|
position: (start) => masked[start] === CODE ? REFERENCE : NOT_A_REFERENCE
|
|
961
978
|
};
|
|
962
979
|
}
|
|
963
|
-
function maskTypeScript(
|
|
964
|
-
const masked = new Uint8Array(
|
|
980
|
+
function maskTypeScript(text2) {
|
|
981
|
+
const masked = new Uint8Array(text2.length);
|
|
965
982
|
const templates = [];
|
|
966
983
|
let depth = 0;
|
|
967
984
|
let index = 0;
|
|
968
985
|
const string2 = (quote) => {
|
|
969
986
|
const start = index++;
|
|
970
|
-
while (index <
|
|
971
|
-
index +=
|
|
987
|
+
while (index < text2.length && text2[index] !== quote && text2[index] !== "\n") {
|
|
988
|
+
index += text2[index] === "\\" ? 2 : 1;
|
|
972
989
|
}
|
|
973
|
-
masked.fill(STRING, start, Math.min(++index,
|
|
990
|
+
masked.fill(STRING, start, Math.min(++index, text2.length));
|
|
974
991
|
};
|
|
975
992
|
const template = () => {
|
|
976
993
|
const start = index++;
|
|
977
|
-
while (index <
|
|
978
|
-
if (
|
|
994
|
+
while (index < text2.length && text2[index] !== "`") {
|
|
995
|
+
if (text2[index] === "\\") {
|
|
979
996
|
index += 2;
|
|
980
|
-
} else if (
|
|
997
|
+
} else if (text2[index] === "$" && text2[index + 1] === "{") {
|
|
981
998
|
masked.fill(TEMPLATE, start, index);
|
|
982
999
|
templates.push(depth);
|
|
983
1000
|
index += 2;
|
|
@@ -986,18 +1003,18 @@ function maskTypeScript(text) {
|
|
|
986
1003
|
index++;
|
|
987
1004
|
}
|
|
988
1005
|
}
|
|
989
|
-
masked.fill(TEMPLATE, start, Math.min(++index,
|
|
1006
|
+
masked.fill(TEMPLATE, start, Math.min(++index, text2.length));
|
|
990
1007
|
};
|
|
991
|
-
while (index <
|
|
992
|
-
const character =
|
|
993
|
-
if (character === "/" &&
|
|
994
|
-
const end =
|
|
995
|
-
const stop = end < 0 ?
|
|
1008
|
+
while (index < text2.length) {
|
|
1009
|
+
const character = text2[index];
|
|
1010
|
+
if (character === "/" && text2[index + 1] === "/") {
|
|
1011
|
+
const end = text2.indexOf("\n", index);
|
|
1012
|
+
const stop = end < 0 ? text2.length : end;
|
|
996
1013
|
masked.fill(COMMENT, index, stop);
|
|
997
1014
|
index = stop;
|
|
998
|
-
} else if (character === "/" &&
|
|
999
|
-
const end =
|
|
1000
|
-
const stop = end < 0 ?
|
|
1015
|
+
} else if (character === "/" && text2[index + 1] === "*") {
|
|
1016
|
+
const end = text2.indexOf("*/", index + 2);
|
|
1017
|
+
const stop = end < 0 ? text2.length : end + 2;
|
|
1001
1018
|
masked.fill(COMMENT, index, stop);
|
|
1002
1019
|
index = stop;
|
|
1003
1020
|
} else if (character === "'" || character === '"') {
|
|
@@ -1021,49 +1038,49 @@ function maskTypeScript(text) {
|
|
|
1021
1038
|
}
|
|
1022
1039
|
return masked;
|
|
1023
1040
|
}
|
|
1024
|
-
function maskHtml(
|
|
1025
|
-
const masked = new Uint8Array(
|
|
1041
|
+
function maskHtml(text2) {
|
|
1042
|
+
const masked = new Uint8Array(text2.length);
|
|
1026
1043
|
let index = 0;
|
|
1027
|
-
while (index <
|
|
1028
|
-
if (
|
|
1029
|
-
const end =
|
|
1030
|
-
const stop = end < 0 ?
|
|
1044
|
+
while (index < text2.length) {
|
|
1045
|
+
if (text2.startsWith("<!--", index)) {
|
|
1046
|
+
const end = text2.indexOf("-->", index + 4);
|
|
1047
|
+
const stop = end < 0 ? text2.length : end + 3;
|
|
1031
1048
|
masked.fill(COMMENT, index, stop);
|
|
1032
1049
|
index = stop;
|
|
1033
|
-
} else if (
|
|
1034
|
-
index = maskTag(
|
|
1050
|
+
} else if (text2[index] === "<" && /[A-Za-z/]/.test(text2[index + 1] ?? "")) {
|
|
1051
|
+
index = maskTag(text2, index + 1, masked);
|
|
1035
1052
|
} else {
|
|
1036
1053
|
index++;
|
|
1037
1054
|
}
|
|
1038
1055
|
}
|
|
1039
1056
|
return masked;
|
|
1040
1057
|
}
|
|
1041
|
-
function maskTag(
|
|
1042
|
-
while (index <
|
|
1043
|
-
if (
|
|
1058
|
+
function maskTag(text2, index, masked) {
|
|
1059
|
+
while (index < text2.length && text2[index] !== ">") {
|
|
1060
|
+
if (text2[index] !== "=") {
|
|
1044
1061
|
index++;
|
|
1045
1062
|
continue;
|
|
1046
1063
|
}
|
|
1047
1064
|
index++;
|
|
1048
|
-
while (
|
|
1049
|
-
const quote =
|
|
1065
|
+
while (text2[index] === " " || text2[index] === " " || text2[index] === "\n") index++;
|
|
1066
|
+
const quote = text2[index];
|
|
1050
1067
|
const start = index;
|
|
1051
1068
|
if (quote === '"' || quote === "'") {
|
|
1052
|
-
const end =
|
|
1053
|
-
index = end < 0 ?
|
|
1069
|
+
const end = text2.indexOf(quote, index + 1);
|
|
1070
|
+
index = end < 0 ? text2.length : end + 1;
|
|
1054
1071
|
} else {
|
|
1055
|
-
while (index <
|
|
1072
|
+
while (index < text2.length && !/[\s>]/.test(text2[index] ?? "")) index++;
|
|
1056
1073
|
}
|
|
1057
1074
|
masked.fill(STRING, start, index);
|
|
1058
1075
|
}
|
|
1059
1076
|
return index + 1;
|
|
1060
1077
|
}
|
|
1061
|
-
function localBindings(
|
|
1078
|
+
function localBindings(text2, masked) {
|
|
1062
1079
|
const names = /* @__PURE__ */ new Set();
|
|
1063
|
-
for (const match of
|
|
1080
|
+
for (const match of text2.matchAll(/\b(?:const|let|var)\s+([\p{L}_$][\p{L}\w$]*)/gu)) {
|
|
1064
1081
|
if (!masked[match.index]) names.add(match[1] ?? "");
|
|
1065
1082
|
}
|
|
1066
|
-
for (const match of
|
|
1083
|
+
for (const match of text2.matchAll(
|
|
1067
1084
|
/\bimport\s+(?:type\s+)?([^;]*?)\s+from\s+(['"])\.{1,2}\/[^'"]*\2/gu
|
|
1068
1085
|
)) {
|
|
1069
1086
|
if (masked[match.index]) continue;
|
|
@@ -1076,8 +1093,8 @@ function localBindings(text, masked) {
|
|
|
1076
1093
|
}
|
|
1077
1094
|
return names;
|
|
1078
1095
|
}
|
|
1079
|
-
function isProse(
|
|
1080
|
-
for (const match of
|
|
1096
|
+
function isProse(text2, masked) {
|
|
1097
|
+
for (const match of text2.matchAll(/[\p{L}_$][\p{L}\w$]*(?: [\p{L}_$][\p{L}\w$]*){2,}/gu)) {
|
|
1081
1098
|
const words2 = match[0].split(" ");
|
|
1082
1099
|
const plain = words2.filter((word) => !SYNTAX_WORDS.has(word) && !RESERVED_WORDS.has(word));
|
|
1083
1100
|
if (!masked[match.index] && plain.length >= 3) {
|
|
@@ -1086,23 +1103,23 @@ function isProse(text, masked) {
|
|
|
1086
1103
|
}
|
|
1087
1104
|
return false;
|
|
1088
1105
|
}
|
|
1089
|
-
function previousSignificant(
|
|
1106
|
+
function previousSignificant(text2, index, masked) {
|
|
1090
1107
|
let position = index - 1;
|
|
1091
|
-
while (position >= 0 && insignificant(
|
|
1108
|
+
while (position >= 0 && insignificant(text2, position, masked)) position--;
|
|
1092
1109
|
return position;
|
|
1093
1110
|
}
|
|
1094
|
-
function nextSignificant(
|
|
1111
|
+
function nextSignificant(text2, index, masked) {
|
|
1095
1112
|
let position = index;
|
|
1096
|
-
while (position <
|
|
1113
|
+
while (position < text2.length && insignificant(text2, position, masked)) position++;
|
|
1097
1114
|
return position;
|
|
1098
1115
|
}
|
|
1099
|
-
function insignificant(
|
|
1100
|
-
return masked[index] === COMMENT || /\s/.test(
|
|
1116
|
+
function insignificant(text2, index, masked) {
|
|
1117
|
+
return masked[index] === COMMENT || /\s/.test(text2[index] ?? "");
|
|
1101
1118
|
}
|
|
1102
|
-
function previousWord(
|
|
1119
|
+
function previousWord(text2, index) {
|
|
1103
1120
|
let start = index;
|
|
1104
|
-
while (start >= 0 && WORD_CHARACTER.test(
|
|
1105
|
-
return
|
|
1121
|
+
while (start >= 0 && WORD_CHARACTER.test(text2[start] ?? "")) start--;
|
|
1122
|
+
return text2.slice(start + 1, index + 1);
|
|
1106
1123
|
}
|
|
1107
1124
|
var WORD_CHARACTER, IDENTIFIER_BEFORE, WHOLE_KEYWORD, CODE_PUNCTUATION, DECLARATION_START, HTML_START, SYNTAX_WORDS, RESERVED_WORDS, TYPE_CONTEXT, TYPE_WORDS, CODE, STRING, COMMENT, TEMPLATE, CONTROL_FLOW, NOT_A_REFERENCE, REFERENCE;
|
|
1108
1125
|
var init_keyword_positions = __esm({
|
|
@@ -1224,8 +1241,8 @@ function keywordsPlugin(config) {
|
|
|
1224
1241
|
return;
|
|
1225
1242
|
}
|
|
1226
1243
|
const offsets = textOffsets(node);
|
|
1227
|
-
const
|
|
1228
|
-
const scan = isInlineCode ? scanInlineCode(
|
|
1244
|
+
const text2 = Array.from(offsets.keys()).map((textNode) => textNode.value).join("");
|
|
1245
|
+
const scan = isInlineCode ? scanInlineCode(text2) : scanCodeBlock(text2, HTML_LANGUAGES.includes(lang) ? "html" : "typescript");
|
|
1229
1246
|
if (!scan) {
|
|
1230
1247
|
return;
|
|
1231
1248
|
}
|
|
@@ -1252,9 +1269,9 @@ function keywordsPlugin(config) {
|
|
|
1252
1269
|
function textOffsets(node) {
|
|
1253
1270
|
const offsets = /* @__PURE__ */ new Map();
|
|
1254
1271
|
let offset = 0;
|
|
1255
|
-
visitParents(node, "text", (
|
|
1256
|
-
offsets.set(
|
|
1257
|
-
offset +=
|
|
1272
|
+
visitParents(node, "text", (text2) => {
|
|
1273
|
+
offsets.set(text2, offset);
|
|
1274
|
+
offset += text2.value.length;
|
|
1258
1275
|
});
|
|
1259
1276
|
return offsets;
|
|
1260
1277
|
}
|
|
@@ -1316,7 +1333,7 @@ function getNodes(node, parent, isInlineCode, config, language, scan, offset) {
|
|
|
1316
1333
|
) : { type: "text", value: word };
|
|
1317
1334
|
});
|
|
1318
1335
|
}
|
|
1319
|
-
function createLinkNode(
|
|
1336
|
+
function createLinkNode(text2, href, type, description) {
|
|
1320
1337
|
return {
|
|
1321
1338
|
type: "element",
|
|
1322
1339
|
tagName: "a",
|
|
@@ -1326,7 +1343,7 @@ function createLinkNode(text, href, type, description) {
|
|
|
1326
1343
|
"data-link-type": type,
|
|
1327
1344
|
ngDocTooltip: description
|
|
1328
1345
|
},
|
|
1329
|
-
children: [{ type: "text", value:
|
|
1346
|
+
children: [{ type: "text", value: text2 }]
|
|
1330
1347
|
};
|
|
1331
1348
|
}
|
|
1332
1349
|
var ALWAYS_ALLOWED_LANGUAGES, HTML_LANGUAGES, LANGUAGES, SPLIT_REGEXP, MATCH_KEYWORD_REGEXP;
|
|
@@ -2109,19 +2126,19 @@ function canonical(value, path18) {
|
|
|
2109
2126
|
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
2110
2127
|
if (path18.has(value)) throw new TypeError("Converting circular structure to canonical JSON");
|
|
2111
2128
|
path18.add(value);
|
|
2112
|
-
let
|
|
2129
|
+
let text2;
|
|
2113
2130
|
if (Array.isArray(value)) {
|
|
2114
|
-
|
|
2131
|
+
text2 = `[${Array.from(value, (item) => canonical(item, path18) ?? "null").join(",")}]`;
|
|
2115
2132
|
} else {
|
|
2116
2133
|
const fields = [];
|
|
2117
2134
|
for (const key of Object.keys(value).sort(compareCodeUnits)) {
|
|
2118
2135
|
const item = canonical(value[key], path18);
|
|
2119
2136
|
if (item !== void 0) fields.push(`${JSON.stringify(key)}:${item}`);
|
|
2120
2137
|
}
|
|
2121
|
-
|
|
2138
|
+
text2 = `{${fields.join(",")}}`;
|
|
2122
2139
|
}
|
|
2123
2140
|
path18.delete(value);
|
|
2124
|
-
return
|
|
2141
|
+
return text2;
|
|
2125
2142
|
}
|
|
2126
2143
|
function canonicalJsonStrict(value) {
|
|
2127
2144
|
try {
|
|
@@ -2165,8 +2182,8 @@ function digestOf(value) {
|
|
|
2165
2182
|
function bytesDigest(bytes) {
|
|
2166
2183
|
return sha256Hex(bytes);
|
|
2167
2184
|
}
|
|
2168
|
-
function contentDigest(
|
|
2169
|
-
return sha256Hex(
|
|
2185
|
+
function contentDigest(text2) {
|
|
2186
|
+
return sha256Hex(text2);
|
|
2170
2187
|
}
|
|
2171
2188
|
function dependencyIdentity(dependency) {
|
|
2172
2189
|
switch (dependency.kind) {
|
|
@@ -2213,9 +2230,9 @@ var ObservationRecorder = class {
|
|
|
2213
2230
|
let value = cloneDependency(dependency);
|
|
2214
2231
|
if (value.kind === "content" && existing?.kind === "content" && existing.digest !== value.digest)
|
|
2215
2232
|
value = { ...value, digest: CONFLICTING_CONTENT_DIGEST };
|
|
2216
|
-
const
|
|
2217
|
-
if (this.values.get(identity)?.text ===
|
|
2218
|
-
this.values.set(identity, { dependency: value, text });
|
|
2233
|
+
const text2 = JSON.stringify(value);
|
|
2234
|
+
if (this.values.get(identity)?.text === text2) return;
|
|
2235
|
+
this.values.set(identity, { dependency: value, text: text2 });
|
|
2219
2236
|
this.ordered = void 0;
|
|
2220
2237
|
}
|
|
2221
2238
|
/** Records whether the file exists and, when it does, its content. */
|
|
@@ -3428,12 +3445,12 @@ function entryText(artifact) {
|
|
|
3428
3445
|
return `${JSON.stringify(artifact)}
|
|
3429
3446
|
`;
|
|
3430
3447
|
}
|
|
3431
|
-
function miss(reason, code,
|
|
3448
|
+
function miss(reason, code, text2, source) {
|
|
3432
3449
|
return {
|
|
3433
3450
|
status: "miss",
|
|
3434
3451
|
reason,
|
|
3435
3452
|
diagnostics: [
|
|
3436
|
-
{ code, severity: "warning", stage: "cache", message:
|
|
3453
|
+
{ code, severity: "warning", stage: "cache", message: text2, source: { path: slash(source) } }
|
|
3437
3454
|
]
|
|
3438
3455
|
};
|
|
3439
3456
|
}
|
|
@@ -3468,7 +3485,7 @@ function stringArray(value) {
|
|
|
3468
3485
|
function isIdentity(value) {
|
|
3469
3486
|
if (!isRecord(value) || !exact(value, ["projectId", "entryId", "role"], ["declarationId", "part"]))
|
|
3470
3487
|
return false;
|
|
3471
|
-
return string(value
|
|
3488
|
+
return string(value["projectId"]) && string(value["entryId"]) && [
|
|
3472
3489
|
"page-shell",
|
|
3473
3490
|
"content",
|
|
3474
3491
|
"demo-assets",
|
|
@@ -3476,7 +3493,7 @@ function isIdentity(value) {
|
|
|
3476
3493
|
"category",
|
|
3477
3494
|
"api-list",
|
|
3478
3495
|
"aggregate"
|
|
3479
|
-
].includes(String(value
|
|
3496
|
+
].includes(String(value["role"])) && (value["declarationId"] === void 0 || string(value["declarationId"])) && (value["part"] === void 0 || string(value["part"]));
|
|
3480
3497
|
}
|
|
3481
3498
|
function isFingerprint(value) {
|
|
3482
3499
|
return isRecord(value) && exact(value, [
|
|
@@ -3486,40 +3503,40 @@ function isFingerprint(value) {
|
|
|
3486
3503
|
"configurationDigest",
|
|
3487
3504
|
"inputDigest",
|
|
3488
3505
|
"keywordDigest"
|
|
3489
|
-
]) && value
|
|
3490
|
-
value
|
|
3491
|
-
value
|
|
3492
|
-
value
|
|
3493
|
-
value
|
|
3494
|
-
value
|
|
3506
|
+
]) && value["schemaVersion"] === SCHEMA_VERSION && [
|
|
3507
|
+
value["compilerVersion"],
|
|
3508
|
+
value["toolchainDigest"],
|
|
3509
|
+
value["configurationDigest"],
|
|
3510
|
+
value["inputDigest"],
|
|
3511
|
+
value["keywordDigest"]
|
|
3495
3512
|
].every(string);
|
|
3496
3513
|
}
|
|
3497
3514
|
function isDependency(value) {
|
|
3498
|
-
if (!isRecord(value) || !string(value
|
|
3499
|
-
if (value
|
|
3500
|
-
return exact(value, ["kind", "path", "digest"]) && string(value
|
|
3501
|
-
if (value
|
|
3502
|
-
return exact(value, ["kind", "path", "exists"]) && string(value
|
|
3503
|
-
if (value
|
|
3504
|
-
return exact(value, ["kind", "root", "include", "exclude", "members"]) && string(value
|
|
3505
|
-
if (value
|
|
3506
|
-
return exact(value, ["kind", "scopeId", "digest", "files", "reason"]) && string(value
|
|
3507
|
-
if (value
|
|
3508
|
-
return exact(value, ["kind", "scopeId", "digest", "reason"]) && string(value
|
|
3509
|
-
if (value
|
|
3510
|
-
return exact(value, ["kind", "scopeId", "key", "digest"]) && string(value
|
|
3511
|
-
if (value
|
|
3512
|
-
return exact(value, ["kind", "entryId", "digest"]) && string(value
|
|
3513
|
-
return value
|
|
3515
|
+
if (!isRecord(value) || !string(value["kind"])) return false;
|
|
3516
|
+
if (value["kind"] === "content")
|
|
3517
|
+
return exact(value, ["kind", "path", "digest"]) && string(value["path"]) && string(value["digest"]);
|
|
3518
|
+
if (value["kind"] === "existence")
|
|
3519
|
+
return exact(value, ["kind", "path", "exists"]) && string(value["path"]) && typeof value["exists"] === "boolean";
|
|
3520
|
+
if (value["kind"] === "glob")
|
|
3521
|
+
return exact(value, ["kind", "root", "include", "exclude", "members"]) && string(value["root"]) && stringArray(value["include"]) && stringArray(value["exclude"]) && stringArray(value["members"]);
|
|
3522
|
+
if (value["kind"] === "semantic")
|
|
3523
|
+
return exact(value, ["kind", "scopeId", "digest", "files", "reason"]) && string(value["scopeId"]) && string(value["digest"]) && stringArray(value["files"]) && string(value["reason"]);
|
|
3524
|
+
if (value["kind"] === "semantic-reference")
|
|
3525
|
+
return exact(value, ["kind", "scopeId", "digest", "reason"]) && string(value["scopeId"]) && string(value["digest"]) && string(value["reason"]);
|
|
3526
|
+
if (value["kind"] === "semantic-closure")
|
|
3527
|
+
return exact(value, ["kind", "scopeId", "key", "digest"]) && string(value["scopeId"]) && string(value["key"]) && string(value["digest"]);
|
|
3528
|
+
if (value["kind"] === "evaluated")
|
|
3529
|
+
return exact(value, ["kind", "entryId", "digest"]) && string(value["entryId"]) && string(value["digest"]);
|
|
3530
|
+
return value["kind"] === "keyword" && exact(value, ["kind", "key", "digest"]) && string(value["key"]) && string(value["digest"]);
|
|
3514
3531
|
}
|
|
3515
3532
|
function isKeyword(value) {
|
|
3516
|
-
return isRecord(value) && exact(value, ["key", "title", "path"], ["type", "languages", "description"]) && string(value
|
|
3533
|
+
return isRecord(value) && exact(value, ["key", "title", "path"], ["type", "languages", "description"]) && string(value["key"]) && string(value["title"]) && string(value["path"]) && (value["type"] === void 0 || value["type"] === "link") && (value["languages"] === void 0 || stringArray(value["languages"])) && [value["description"], value["signature"]].every((item) => item === void 0 || string(item));
|
|
3517
3534
|
}
|
|
3518
3535
|
function isSource(value) {
|
|
3519
|
-
return isRecord(value) && exact(value, ["path"], ["line", "column"]) && string(value
|
|
3536
|
+
return isRecord(value) && exact(value, ["path"], ["line", "column"]) && string(value["path"]) && (value["line"] === void 0 || finite(value["line"])) && (value["column"] === void 0 || finite(value["column"]));
|
|
3520
3537
|
}
|
|
3521
3538
|
function isDiagnostic(value) {
|
|
3522
|
-
return isRecord(value) && exact(value, ["code", "severity", "message", "stage"], ["source", "ownerId", "related"]) && string(value
|
|
3539
|
+
return isRecord(value) && exact(value, ["code", "severity", "message", "stage"], ["source", "ownerId", "related"]) && string(value["code"]) && ["error", "warning", "info"].includes(String(value["severity"])) && string(value["message"]) && [
|
|
3523
3540
|
"discovery",
|
|
3524
3541
|
"evaluation",
|
|
3525
3542
|
"semantic",
|
|
@@ -3528,8 +3545,8 @@ function isDiagnostic(value) {
|
|
|
3528
3545
|
"cache",
|
|
3529
3546
|
"commit",
|
|
3530
3547
|
"host"
|
|
3531
|
-
].includes(String(value
|
|
3532
|
-
(item) => isRecord(item) && exact(item, ["message", "source"]) && string(item
|
|
3548
|
+
].includes(String(value["stage"])) && (value["source"] === void 0 || isSource(value["source"])) && (value["ownerId"] === void 0 || string(value["ownerId"])) && (value["related"] === void 0 || Array.isArray(value["related"]) && value["related"].every(
|
|
3549
|
+
(item) => isRecord(item) && exact(item, ["message", "source"]) && string(item["message"]) && isSource(item["source"])
|
|
3533
3550
|
));
|
|
3534
3551
|
}
|
|
3535
3552
|
function isSearch(value) {
|
|
@@ -3537,17 +3554,17 @@ function isSearch(value) {
|
|
|
3537
3554
|
value,
|
|
3538
3555
|
["breadcrumbs", "pageType", "title", "section", "route", "content"],
|
|
3539
3556
|
["fragment", "kind", "signature", "description"]
|
|
3540
|
-
) && stringArray(value
|
|
3557
|
+
) && stringArray(value["breadcrumbs"]) && ["guide", "api"].includes(String(value["pageType"])) && [value["title"], value["section"], value["route"], value["content"]].every(string) && [value["fragment"], value["kind"], value["signature"], value["description"]].every(
|
|
3541
3558
|
(item) => item === void 0 || string(item)
|
|
3542
3559
|
);
|
|
3543
3560
|
}
|
|
3544
3561
|
function isAnchor(value) {
|
|
3545
|
-
return isRecord(value) && exact(value, ["anchorId", "anchor", "title", "type"], ["scope"]) && [value
|
|
3562
|
+
return isRecord(value) && exact(value, ["anchorId", "anchor", "title", "type"], ["scope"]) && [value["anchorId"], value["anchor"], value["title"]].every(string) && ["heading", "member"].includes(String(value["type"])) && (value["scope"] === void 0 || isRecord(value["scope"]) && exact(value["scope"], ["key", "title"]) && string(value["scope"]["key"]) && string(value["scope"]["title"]));
|
|
3546
3563
|
}
|
|
3547
3564
|
function isLinkedContent(value) {
|
|
3548
|
-
if (!isRecord(value) || !exact(value, ["ir", "html", "searchRecords", "keywordDigest"]) || !string(value
|
|
3565
|
+
if (!isRecord(value) || !exact(value, ["ir", "html", "searchRecords", "keywordDigest"]) || !string(value["html"]) || !string(value["keywordDigest"]) || !Array.isArray(value["searchRecords"]) || !value["searchRecords"].every(isSearch) || !isRecord(value["ir"]))
|
|
3549
3566
|
return false;
|
|
3550
|
-
const ir = value
|
|
3567
|
+
const ir = value["ir"];
|
|
3551
3568
|
return exact(
|
|
3552
3569
|
ir,
|
|
3553
3570
|
[
|
|
@@ -3566,7 +3583,9 @@ function isLinkedContent(value) {
|
|
|
3566
3583
|
"diagnostics"
|
|
3567
3584
|
],
|
|
3568
3585
|
["icon", "searchBreadcrumbs"]
|
|
3569
|
-
) && ir
|
|
3586
|
+
) && ir["schemaVersion"] === SCHEMA_VERSION && [ir["id"], ir["entryId"], ir["title"], ir["route"], ir["absoluteRoute"], ir["html"]].every(
|
|
3587
|
+
string
|
|
3588
|
+
) && ["guide-tab", "api-tab", "header", "demo-assets"].includes(String(ir["role"])) && (ir["searchBreadcrumbs"] === void 0 || stringArray(ir["searchBreadcrumbs"])) && (ir["icon"] === void 0 || string(ir["icon"])) && Array.isArray(ir["anchors"]) && ir["anchors"].every(isAnchor) && Array.isArray(ir["exportedKeywords"]) && ir["exportedKeywords"].every(isKeyword) && stringArray(ir["usedKeywords"]) && Array.isArray(ir["dependencies"]) && ir["dependencies"].every(isDependency) && Array.isArray(ir["diagnostics"]) && ir["diagnostics"].every(isDiagnostic);
|
|
3570
3589
|
}
|
|
3571
3590
|
function isRoute(value) {
|
|
3572
3591
|
return isRecord(value) && exact(
|
|
@@ -3582,23 +3601,29 @@ function isRoute(value) {
|
|
|
3582
3601
|
"modulePath",
|
|
3583
3602
|
"apiListSegment",
|
|
3584
3603
|
"demoModulePath",
|
|
3585
|
-
"demoNames"
|
|
3604
|
+
"demoNames",
|
|
3605
|
+
"playgroundPages"
|
|
3586
3606
|
]
|
|
3587
|
-
) && [value
|
|
3607
|
+
) && [value["id"], value["path"], value["title"]].every(string) && (value["parentId"] === void 0 || string(value["parentId"])) && (value["order"] === void 0 || finite(value["order"])) && (value["hidden"] === void 0 || typeof value["hidden"] === "boolean") && (value["icon"] === void 0 || string(value["icon"])) && (value["modulePath"] === void 0 || string(value["modulePath"])) && (value["apiListSegment"] === void 0 || string(value["apiListSegment"])) && (value["demoModulePath"] === void 0 || string(value["demoModulePath"])) && (value["demoNames"] === void 0 || stringArray(value["demoNames"])) && (value["playgroundPages"] === void 0 || stringArray(value["playgroundPages"])) && (value["metadata"] === void 0 || isRecord(value["metadata"]) && exact(value["metadata"], ["description", "tags"]) && string(value["metadata"]["description"]) && isRecord(value["metadata"]["tags"]) && Object.values(value["metadata"]["tags"]).every(stringArray)) && (value["category"] === void 0 || isRecord(value["category"]) && exact(value["category"], ["runtimeImport"], ["expandable", "expanded"]) && isRecord(value["category"]["runtimeImport"]) && exact(value["category"]["runtimeImport"], ["source", "exportName"]) && string(value["category"]["runtimeImport"]["source"]) && string(value["category"]["runtimeImport"]["exportName"]) && (value["category"]["expandable"] === void 0 || typeof value["category"]["expandable"] === "boolean") && (value["category"]["expanded"] === void 0 || typeof value["category"]["expanded"] === "boolean"));
|
|
3588
3608
|
}
|
|
3589
3609
|
function isApiList(value) {
|
|
3590
3610
|
return isRecord(value) && exact(
|
|
3591
3611
|
value,
|
|
3592
3612
|
["apiEntryId", "scopeId", "scopeTitle", "name", "type", "route"],
|
|
3593
3613
|
["description", "signature"]
|
|
3594
|
-
) && [
|
|
3595
|
-
|
|
3596
|
-
|
|
3614
|
+
) && [
|
|
3615
|
+
value["apiEntryId"],
|
|
3616
|
+
value["scopeId"],
|
|
3617
|
+
value["scopeTitle"],
|
|
3618
|
+
value["name"],
|
|
3619
|
+
value["type"],
|
|
3620
|
+
value["route"]
|
|
3621
|
+
].every(string) && [value["description"], value["signature"]].every((item) => item === void 0 || string(item));
|
|
3597
3622
|
}
|
|
3598
3623
|
function isFileOutput(value) {
|
|
3599
|
-
return isRecord(value) && exact(value, ["path", "role", "encoding", "content", "digest"]) && string(value
|
|
3600
|
-
String(value
|
|
3601
|
-
) && ["utf8", "base64"].includes(String(value
|
|
3624
|
+
return isRecord(value) && exact(value, ["path", "role", "encoding", "content", "digest"]) && string(value["path"]) && ["angular", "content", "asset", "routes", "context", "search", "api-list"].includes(
|
|
3625
|
+
String(value["role"])
|
|
3626
|
+
) && ["utf8", "base64"].includes(String(value["encoding"])) && string(value["content"]) && string(value["digest"]);
|
|
3602
3627
|
}
|
|
3603
3628
|
function isContentDescriptor(value) {
|
|
3604
3629
|
if (!isRecord(value) || !exact(
|
|
@@ -3622,23 +3647,23 @@ function isContentDescriptor(value) {
|
|
|
3622
3647
|
["icon", "keyword"]
|
|
3623
3648
|
))
|
|
3624
3649
|
return false;
|
|
3625
|
-
if (value
|
|
3626
|
-
value
|
|
3627
|
-
value
|
|
3628
|
-
value
|
|
3629
|
-
value
|
|
3630
|
-
value
|
|
3631
|
-
value
|
|
3632
|
-
value
|
|
3633
|
-
].every(string) || ![value
|
|
3650
|
+
if (value["schemaVersion"] !== SCHEMA_VERSION || ![
|
|
3651
|
+
value["id"],
|
|
3652
|
+
value["ownerId"],
|
|
3653
|
+
value["title"],
|
|
3654
|
+
value["route"],
|
|
3655
|
+
value["absoluteRoute"],
|
|
3656
|
+
value["inputDigest"],
|
|
3657
|
+
value["requestDigest"]
|
|
3658
|
+
].every(string) || ![value["id"], value["ownerId"], value["inputDigest"], value["requestDigest"]].every(
|
|
3634
3659
|
(item) => string(item) && item.length > 0 && !item.includes("\0")
|
|
3635
|
-
) || !finite(value
|
|
3660
|
+
) || !finite(value["ordinal"]) || value["ordinal"] < 0 || !Number.isInteger(value["ordinal"]) || !["guide-tab", "api-tab", "header"].includes(String(value["role"])) || !stringArray(value["searchBreadcrumbs"]) || !Array.isArray(value["dependencies"]) || !value["dependencies"].every((dependency) => isPhysicalDescriptorDependency(dependency)) || new Set(value["dependencies"].map((dependency) => canonicalJson(dependency))).size !== value["dependencies"].length || !stringArray(value["closureIds"]) || value["icon"] !== void 0 && !string(value["icon"]) || value["keyword"] !== void 0 && !string(value["keyword"]) || !isRecord(value["locator"]))
|
|
3636
3661
|
return false;
|
|
3637
|
-
const locator = value
|
|
3638
|
-
return value
|
|
3662
|
+
const locator = value["locator"];
|
|
3663
|
+
return value["role"] === "header" ? exact(locator, ["kind"]) && locator["kind"] === "header" : value["role"] === "guide-tab" ? exact(locator, ["kind", "markdown"]) && locator["kind"] === "guide-tab" && string(locator["markdown"]) : exact(locator, ["kind", "declarationId"]) && locator["kind"] === "api-tab" && string(locator["declarationId"]);
|
|
3639
3664
|
}
|
|
3640
3665
|
function isPhysicalDescriptorDependency(value) {
|
|
3641
|
-
return isRecord(value) && (value
|
|
3666
|
+
return isRecord(value) && (value["kind"] === "content" && exact(value, ["kind", "path", "digest"]) && absoluteNormalizedPath(value["path"]) && string(value["digest"]) || value["kind"] === "existence" && exact(value, ["kind", "path", "exists"]) && absoluteNormalizedPath(value["path"]) && typeof value["exists"] === "boolean");
|
|
3642
3667
|
}
|
|
3643
3668
|
function validDescriptorPlan(artifact) {
|
|
3644
3669
|
const descriptors = artifact.contentDescriptors;
|
|
@@ -3723,7 +3748,7 @@ function isPageArtifact(value) {
|
|
|
3723
3748
|
"diagnostics"
|
|
3724
3749
|
],
|
|
3725
3750
|
["contentDescriptors"]
|
|
3726
|
-
) && string(value
|
|
3751
|
+
) && string(value["id"]) && isIdentity(value["identity"]) && string(value["revision"]) && isFingerprint(value["fingerprint"]) && Array.isArray(value["dependencies"]) && value["dependencies"].every(isDependency) && Array.isArray(value["content"]) && value["content"].every(isLinkedContent) && Array.isArray(value["exportedKeywords"]) && value["exportedKeywords"].every(isKeyword) && stringArray(value["usedKeywords"]) && Array.isArray(value["searchRecords"]) && value["searchRecords"].every(isSearch) && Array.isArray(value["routes"]) && value["routes"].every(isRoute) && Array.isArray(value["apiList"]) && value["apiList"].every(isApiList) && Array.isArray(value["outputs"]) && value["outputs"].every((output2) => isFileOutput(output2) && validOutputDigest(output2)) && Array.isArray(value["diagnostics"]) && value["diagnostics"].every(isDiagnostic) && validDescriptorPlan(value);
|
|
3727
3752
|
}
|
|
3728
3753
|
function isJsonTree(value, ancestors = /* @__PURE__ */ new WeakSet()) {
|
|
3729
3754
|
if (value === null || string(value) || typeof value === "boolean") return true;
|
|
@@ -3874,14 +3899,14 @@ async function saveClosureStore(file, identity, artifacts, record) {
|
|
|
3874
3899
|
}),
|
|
3875
3900
|
order: [...order]
|
|
3876
3901
|
};
|
|
3877
|
-
const
|
|
3902
|
+
const text2 = JSON.stringify(content);
|
|
3878
3903
|
const temporary = `${file}.${randomUUID2()}.tmp`;
|
|
3879
3904
|
try {
|
|
3880
3905
|
await mkdir2(path3.dirname(file), { recursive: true });
|
|
3881
3906
|
await sweepTemporaries(file);
|
|
3882
|
-
await writeFile2(temporary,
|
|
3907
|
+
await writeFile2(temporary, text2, { flag: "wx" });
|
|
3883
3908
|
await retryingRename(rename2)(temporary, file);
|
|
3884
|
-
known.set(file, { key, content: contentDigest(
|
|
3909
|
+
known.set(file, { key, content: contentDigest(text2) });
|
|
3885
3910
|
} catch {
|
|
3886
3911
|
known.delete(file);
|
|
3887
3912
|
} finally {
|
|
@@ -3903,21 +3928,21 @@ async function sweepTemporaries(file) {
|
|
|
3903
3928
|
}
|
|
3904
3929
|
}
|
|
3905
3930
|
function isStoreFile(value) {
|
|
3906
|
-
const
|
|
3907
|
-
const texts = (item) => Array.isArray(item) && item.every(
|
|
3931
|
+
const text2 = (item) => typeof item === "string";
|
|
3932
|
+
const texts = (item) => Array.isArray(item) && item.every(text2);
|
|
3908
3933
|
if (!value || typeof value !== "object" || Array.isArray(value) || value["schemaVersion"] !== 2)
|
|
3909
3934
|
return false;
|
|
3910
3935
|
const file = value;
|
|
3911
3936
|
const files = file["files"];
|
|
3912
3937
|
const records = file["records"];
|
|
3913
|
-
if (typeof file["generatorSchemaVersion"] !== "number" || !
|
|
3938
|
+
if (typeof file["generatorSchemaVersion"] !== "number" || !text2(file["compilerVersion"]) || !text2(file["toolchainDigest"]) || !text2(file["configurationDigest"]) || !texts(files) || !texts(file["order"]) || !Array.isArray(records))
|
|
3914
3939
|
return false;
|
|
3915
3940
|
return records.every((item) => {
|
|
3916
3941
|
if (!Array.isArray(item) || item.length !== 3 && item.length !== 4) return false;
|
|
3917
3942
|
const [digest3, positions, derived, wide] = item;
|
|
3918
|
-
return
|
|
3943
|
+
return text2(digest3) && Array.isArray(positions) && positions.every(
|
|
3919
3944
|
(position) => Number.isInteger(position) && position >= 0 && position < files.length
|
|
3920
|
-
) && texts(derived) && (item.length === 3 || !!wide && typeof wide === "object" && !Array.isArray(wide) && Object.values(wide).every(
|
|
3945
|
+
) && texts(derived) && (item.length === 3 || !!wide && typeof wide === "object" && !Array.isArray(wide) && Object.values(wide).every(text2));
|
|
3921
3946
|
});
|
|
3922
3947
|
}
|
|
3923
3948
|
|
|
@@ -3933,7 +3958,10 @@ var INCREMENTAL_PROGRAM_FLAG = "NGDOC_INCREMENTAL_PROGRAM";
|
|
|
3933
3958
|
var SHAPE_CLOSURE_FLAG = "NGDOC_SHAPE_CLOSURE";
|
|
3934
3959
|
var ANGULAR_SHARED_PASS_FLAG = "NGDOC_ANGULAR_SHARED_PASS";
|
|
3935
3960
|
var ANGULAR_STRUCTURAL_PASS_FLAG = "NGDOC_ANGULAR_STRUCTURAL_PASS";
|
|
3961
|
+
var ANGULAR_DESCRIPTION_PASS_FLAG = "NGDOC_ANGULAR_DESCRIPTION_PASS";
|
|
3962
|
+
var VITE_CONTENT_UPDATE_FLAG = "NGDOC_VITE_CONTENT_UPDATE";
|
|
3936
3963
|
var VITE_BUILD_HANDOFF_FLAG = "NGDOC_VITE_BUILD_HANDOFF";
|
|
3964
|
+
var VITE_MODULELESS_SETTLE_FLAG = "NGDOC_VITE_MODULELESS_SETTLE";
|
|
3937
3965
|
var TRACKED_PROGRAM_REUSE_FLAG = "NGDOC_TRACKED_PROGRAM_REUSE";
|
|
3938
3966
|
var FAST_START_FLAG = "NGDOC_FAST_START";
|
|
3939
3967
|
var PARALLEL_WRITES_FLAG = "NGDOC_PARALLEL_WRITES";
|
|
@@ -4008,6 +4036,21 @@ var FLAGS = Object.freeze(
|
|
|
4008
4036
|
description: "In the Vite host, the generated modules and description modules a generation creates or deletes join that generation's Angular compiler pass instead of starting a pass of their own.",
|
|
4009
4037
|
verify: false
|
|
4010
4038
|
},
|
|
4039
|
+
{
|
|
4040
|
+
name: ANGULAR_DESCRIPTION_PASS_FLAG,
|
|
4041
|
+
description: "In the Vite host, an edited description module joins the Angular compiler pass of the generation it starts, when that generation rewrites generated TypeScript modules, instead of taking a pass of its own first.",
|
|
4042
|
+
verify: false
|
|
4043
|
+
},
|
|
4044
|
+
{
|
|
4045
|
+
name: VITE_CONTENT_UPDATE_FLAG,
|
|
4046
|
+
description: "In the Vite host, a generation that changes only content modules and the search index updates the open pages in place instead of reloading them.",
|
|
4047
|
+
verify: false
|
|
4048
|
+
},
|
|
4049
|
+
{
|
|
4050
|
+
name: VITE_MODULELESS_SETTLE_FLAG,
|
|
4051
|
+
description: "In the Vite host, a hot update that hands Vite no module to update settles once it is acknowledged, instead of waiting for the newest generation to be published.",
|
|
4052
|
+
verify: false
|
|
4053
|
+
},
|
|
4011
4054
|
{
|
|
4012
4055
|
name: VITE_BUILD_HANDOFF_FLAG,
|
|
4013
4056
|
description: "The server build of the Vite production pipeline publishes the browser build's generation instead of generating again.",
|
|
@@ -4061,7 +4104,7 @@ function flagOff(name, env = process.env) {
|
|
|
4061
4104
|
}
|
|
4062
4105
|
|
|
4063
4106
|
// libs/builder/generator/kernel/runtime-identity.ts
|
|
4064
|
-
import { existsSync as existsSync3, readFileSync as readFileSync4 } from "node:fs";
|
|
4107
|
+
import { existsSync as existsSync3, readFileSync as readFileSync4, realpathSync as realpathSync2 } from "node:fs";
|
|
4065
4108
|
import path4 from "node:path";
|
|
4066
4109
|
import { fileURLToPath } from "node:url";
|
|
4067
4110
|
var RUNTIME_PACKAGES = [
|
|
@@ -4117,7 +4160,7 @@ function packageVersions(list, from) {
|
|
|
4117
4160
|
function packageDirectory(name, directory) {
|
|
4118
4161
|
for (let current2 = directory; ; current2 = path4.dirname(current2)) {
|
|
4119
4162
|
const candidate = path4.join(current2, "node_modules", name);
|
|
4120
|
-
if (existsSync3(path4.join(candidate, "package.json"))) return candidate;
|
|
4163
|
+
if (existsSync3(path4.join(candidate, "package.json"))) return realpathSync2(candidate);
|
|
4121
4164
|
if (path4.dirname(current2) === current2) return void 0;
|
|
4122
4165
|
}
|
|
4123
4166
|
}
|
|
@@ -4266,14 +4309,14 @@ var FormatSession = class {
|
|
|
4266
4309
|
context: this.context,
|
|
4267
4310
|
entries: Object.fromEntries(keys.map((key) => [key, memory.get(key)]))
|
|
4268
4311
|
};
|
|
4269
|
-
const
|
|
4312
|
+
const text2 = JSON.stringify(content);
|
|
4270
4313
|
const temporary = `${file}.${randomUUID3()}.tmp`;
|
|
4271
4314
|
try {
|
|
4272
4315
|
await mkdir3(path5.dirname(file), { recursive: true });
|
|
4273
4316
|
await sweepTemporaries(file);
|
|
4274
|
-
await writeFile3(temporary,
|
|
4317
|
+
await writeFile3(temporary, text2, { flag: "wx" });
|
|
4275
4318
|
await retryingRename(rename3)(temporary, file);
|
|
4276
|
-
packs.set(file, { context: this.context, keys, content: contentDigest(
|
|
4319
|
+
packs.set(file, { context: this.context, keys, content: contentDigest(text2) });
|
|
4277
4320
|
this.replaced = false;
|
|
4278
4321
|
} catch {
|
|
4279
4322
|
packs.delete(file);
|
|
@@ -4520,14 +4563,14 @@ var HighlightSession = class {
|
|
|
4520
4563
|
context: this.context,
|
|
4521
4564
|
entries: Object.fromEntries(keys.map((key) => [key, memory2.get(key)]))
|
|
4522
4565
|
};
|
|
4523
|
-
const
|
|
4566
|
+
const text2 = JSON.stringify(content);
|
|
4524
4567
|
const temporary = `${file}.${randomUUID4()}.tmp`;
|
|
4525
4568
|
try {
|
|
4526
4569
|
await mkdir4(path6.dirname(file), { recursive: true });
|
|
4527
4570
|
await sweepTemporaries(file);
|
|
4528
|
-
await writeFile4(temporary,
|
|
4571
|
+
await writeFile4(temporary, text2, { flag: "wx" });
|
|
4529
4572
|
await retryingRename(rename4)(temporary, file);
|
|
4530
|
-
packs2.set(file, { context: this.context, keys, content: contentDigest(
|
|
4573
|
+
packs2.set(file, { context: this.context, keys, content: contentDigest(text2) });
|
|
4531
4574
|
this.replaced = false;
|
|
4532
4575
|
} catch {
|
|
4533
4576
|
packs2.delete(file);
|
|
@@ -4825,8 +4868,8 @@ function parseSnippet(string2) {
|
|
|
4825
4868
|
|
|
4826
4869
|
// libs/builder/generator/content/code-snippet.ts
|
|
4827
4870
|
var MARKER = /^.*((\/\/|<!--|\/\*)\s*)(snippet.*?(?=(-->|\*\/)?))\s*(-->|\*\/)?$/;
|
|
4828
|
-
function snippetRegion(
|
|
4829
|
-
const lines =
|
|
4871
|
+
function snippetRegion(text2, id) {
|
|
4872
|
+
const lines = text2.split("\n").map((line) => line.replace(/\r$/, ""));
|
|
4830
4873
|
const markers = lines.map((line) => {
|
|
4831
4874
|
const match = MARKER.exec(line);
|
|
4832
4875
|
return match ? parseSnippet(match[3].trim())?.id ?? null : void 0;
|
|
@@ -5509,13 +5552,13 @@ var GeneratorContentCompiler = class {
|
|
|
5509
5552
|
dependencies.push(...metadata.dependencies);
|
|
5510
5553
|
diagnostics.push(...metadata.diagnostics);
|
|
5511
5554
|
if (!metadata.value && metadata.diagnostics.length) return { dependencies, diagnostics };
|
|
5512
|
-
let
|
|
5555
|
+
let text2 = DEFAULT_GUIDE_HEADER;
|
|
5513
5556
|
const template = this.services.configuration.headerTemplate;
|
|
5514
5557
|
if (template) {
|
|
5515
5558
|
dependencies.push({ kind: "existence", path: template, exists: false });
|
|
5516
5559
|
try {
|
|
5517
5560
|
const read = await readTextFile(template);
|
|
5518
|
-
|
|
5561
|
+
text2 = read.text;
|
|
5519
5562
|
dependencies[dependencies.length - 1] = {
|
|
5520
5563
|
kind: "content",
|
|
5521
5564
|
path: template,
|
|
@@ -5533,7 +5576,7 @@ var GeneratorContentCompiler = class {
|
|
|
5533
5576
|
{
|
|
5534
5577
|
entryId: entry.id,
|
|
5535
5578
|
source: entry.source,
|
|
5536
|
-
text,
|
|
5579
|
+
text: text2,
|
|
5537
5580
|
scope: this.services.configuration.workspaceRoot,
|
|
5538
5581
|
kind: "header",
|
|
5539
5582
|
values: {
|
|
@@ -5898,9 +5941,9 @@ var GeneratorContentCompiler = class {
|
|
|
5898
5941
|
readPhysicalFile(source, dependencies, diagnostics, diagnosticCode) {
|
|
5899
5942
|
const dependencyIndex = dependencies.push({ kind: "existence", path: source, exists: false }) - 1;
|
|
5900
5943
|
try {
|
|
5901
|
-
const { text, digest: digest3 } = readText(source);
|
|
5944
|
+
const { text: text2, digest: digest3 } = readText(source);
|
|
5902
5945
|
dependencies[dependencyIndex] = { kind: "content", path: source, digest: digest3 };
|
|
5903
|
-
return
|
|
5946
|
+
return text2;
|
|
5904
5947
|
} catch (error) {
|
|
5905
5948
|
diagnostics.push(this.diag(diagnosticCode, String(error), source));
|
|
5906
5949
|
return void 0;
|
|
@@ -6505,7 +6548,7 @@ init_core();
|
|
|
6505
6548
|
import * as esbuild from "esbuild";
|
|
6506
6549
|
import fg2 from "fast-glob";
|
|
6507
6550
|
import matter2 from "gray-matter";
|
|
6508
|
-
import { existsSync as existsSync6, realpathSync as
|
|
6551
|
+
import { existsSync as existsSync6, realpathSync as realpathSync3 } from "node:fs";
|
|
6509
6552
|
import { createRequire } from "node:module";
|
|
6510
6553
|
import path9 from "node:path";
|
|
6511
6554
|
import { types as nodeTypes } from "node:util";
|
|
@@ -6593,13 +6636,13 @@ var DiscoveryServiceImpl = class {
|
|
|
6593
6636
|
if (!configEvaluation) return failure(dependencies, diagnostics);
|
|
6594
6637
|
configScope = configEvaluation.scope;
|
|
6595
6638
|
const rawConfig = configEvaluation.modules.find((item) => item.kind === "config")?.value ?? {};
|
|
6596
|
-
const configuredRoots = asArray2(rawConfig
|
|
6639
|
+
const configuredRoots = asArray2(rawConfig["docsPath"] ?? request.defaults.docsRoot).map(
|
|
6597
6640
|
(root) => normalizeAbsolute(String(root), workspaceRoot)
|
|
6598
6641
|
);
|
|
6599
6642
|
const descriptions = scanDescriptions(configuredRoots, dependencies);
|
|
6600
6643
|
const entryEvaluation = await evaluateModules(
|
|
6601
6644
|
workspaceRoot,
|
|
6602
|
-
String(rawConfig
|
|
6645
|
+
String(rawConfig["tsConfig"] ?? request.defaults.tsConfig),
|
|
6603
6646
|
void 0,
|
|
6604
6647
|
descriptions,
|
|
6605
6648
|
dependencies,
|
|
@@ -6790,9 +6833,17 @@ function guideValuesOf(entry, entryId, dependencies) {
|
|
|
6790
6833
|
}
|
|
6791
6834
|
try {
|
|
6792
6835
|
const playgrounds = Object.fromEntries(
|
|
6793
|
-
Object.entries(recordOrEmpty(entry
|
|
6794
|
-
const
|
|
6795
|
-
|
|
6836
|
+
Object.entries(recordOrEmpty(entry["playgrounds"])).map(([id, value]) => {
|
|
6837
|
+
const playground = recordOrEmpty(asRecord(value, `playground ${id}`));
|
|
6838
|
+
const controls = playground["controls"];
|
|
6839
|
+
return [
|
|
6840
|
+
id,
|
|
6841
|
+
{
|
|
6842
|
+
controls: controls === void 0 ? {} : assertJson(controls),
|
|
6843
|
+
// Only when set, so every other guide keeps its values and their digest.
|
|
6844
|
+
...playground["isolated"] === true ? { isolated: true } : {}
|
|
6845
|
+
}
|
|
6846
|
+
];
|
|
6796
6847
|
})
|
|
6797
6848
|
);
|
|
6798
6849
|
return { value: assertJson({ playgrounds }), dependencies, diagnostics: [] };
|
|
@@ -6824,8 +6875,8 @@ var TrackingLoader = class extends nunjucks.Loader {
|
|
|
6824
6875
|
const source = normalizeAbsolute(name, this.scope);
|
|
6825
6876
|
const bytes = this.dependencies.readFile(source);
|
|
6826
6877
|
if (!bytes) throw new Error(`Template include not found: ${source}`);
|
|
6827
|
-
const
|
|
6828
|
-
return { src: this.compile(source,
|
|
6878
|
+
const text2 = bytes.toString("utf8");
|
|
6879
|
+
return { src: this.compile(source, text2), path: source, noCache: true };
|
|
6829
6880
|
}
|
|
6830
6881
|
/**
|
|
6831
6882
|
* Compiles an included, imported or extended template now, exactly as `Template#_compile`
|
|
@@ -6838,7 +6889,7 @@ var TrackingLoader = class extends nunjucks.Loader {
|
|
|
6838
6889
|
* error escapes later as an uncaught exception. Thrown from the loader, it fails this render
|
|
6839
6890
|
* synchronously, and each including template prefixes its own path to the message.
|
|
6840
6891
|
*/
|
|
6841
|
-
compile(path18,
|
|
6892
|
+
compile(path18, text2) {
|
|
6842
6893
|
const environment = this.environment();
|
|
6843
6894
|
try {
|
|
6844
6895
|
return {
|
|
@@ -6846,7 +6897,7 @@ var TrackingLoader = class extends nunjucks.Loader {
|
|
|
6846
6897
|
obj: new Function(
|
|
6847
6898
|
// eslint-disable-line no-new-func
|
|
6848
6899
|
nunjucksCompiler.compile(
|
|
6849
|
-
|
|
6900
|
+
text2,
|
|
6850
6901
|
environment.asyncFilters,
|
|
6851
6902
|
environment.extensionsList,
|
|
6852
6903
|
path18,
|
|
@@ -7234,7 +7285,7 @@ function sanitizeDescription(source, kind) {
|
|
|
7234
7285
|
if (!ts.isPropertyAssignment(playground) || !ts.isObjectLiteralExpression(playground.initializer))
|
|
7235
7286
|
return [];
|
|
7236
7287
|
const controls = playground.initializer.properties.filter(
|
|
7237
|
-
(item) => propertyName(item)
|
|
7288
|
+
(item) => ["controls", "isolated"].includes(propertyName(item) ?? "")
|
|
7238
7289
|
);
|
|
7239
7290
|
return [
|
|
7240
7291
|
context.factory.updatePropertyAssignment(
|
|
@@ -7400,17 +7451,17 @@ var EvaluationScope = class {
|
|
|
7400
7451
|
new vm.Script(code, {
|
|
7401
7452
|
filename: path9.join(this.workspaceRoot, ".ng-doc-discovery-evaluator.cjs")
|
|
7402
7453
|
}).runInContext(this.context, { timeout: timeoutMs });
|
|
7403
|
-
return this.context
|
|
7454
|
+
return this.context["module"].exports;
|
|
7404
7455
|
}
|
|
7405
7456
|
invoke(callback, timeoutMs) {
|
|
7406
7457
|
this.assertActive();
|
|
7407
|
-
this.context
|
|
7458
|
+
this.context["__ngDocInvoke"] = callback;
|
|
7408
7459
|
try {
|
|
7409
7460
|
return new vm.Script("__ngDocInvoke()").runInContext(this.context, {
|
|
7410
7461
|
timeout: timeoutMs
|
|
7411
7462
|
});
|
|
7412
7463
|
} finally {
|
|
7413
|
-
delete this.context
|
|
7464
|
+
delete this.context["__ngDocInvoke"];
|
|
7414
7465
|
}
|
|
7415
7466
|
}
|
|
7416
7467
|
dispose() {
|
|
@@ -7536,10 +7587,13 @@ function demoApplicationSettings(raw, source, diagnostics) {
|
|
|
7536
7587
|
});
|
|
7537
7588
|
return void 0;
|
|
7538
7589
|
};
|
|
7539
|
-
const { isolatedDemos, demoApplication, demoProviders } = raw;
|
|
7590
|
+
const { isolatedDemos, isolatedPlaygrounds, demoApplication, demoProviders } = raw;
|
|
7540
7591
|
if (isolatedDemos !== void 0 && typeof isolatedDemos !== "boolean") {
|
|
7541
7592
|
return invalid("DISCOVERY_DEMO_APPLICATION_INVALID", "isolatedDemos must be a boolean.");
|
|
7542
7593
|
}
|
|
7594
|
+
if (isolatedPlaygrounds !== void 0 && typeof isolatedPlaygrounds !== "boolean") {
|
|
7595
|
+
return invalid("DISCOVERY_DEMO_APPLICATION_INVALID", "isolatedPlaygrounds must be a boolean.");
|
|
7596
|
+
}
|
|
7543
7597
|
const configured = demoApplication !== null && typeof demoApplication === "object";
|
|
7544
7598
|
if (demoApplication !== void 0 && typeof demoApplication !== "boolean" && !configured) {
|
|
7545
7599
|
return invalid(
|
|
@@ -7570,10 +7624,22 @@ function demoApplicationSettings(raw, source, diagnostics) {
|
|
|
7570
7624
|
source: { path: source }
|
|
7571
7625
|
});
|
|
7572
7626
|
}
|
|
7627
|
+
if (demoApplication === false && isolatedPlaygrounds === true) {
|
|
7628
|
+
diagnostics.push({
|
|
7629
|
+
code: "DISCOVERY_DEMO_APPLICATION_OFF",
|
|
7630
|
+
severity: "warning",
|
|
7631
|
+
stage: "evaluation",
|
|
7632
|
+
message: "isolatedPlaygrounds has no effect while demoApplication is false: playgrounds render in the page.",
|
|
7633
|
+
source: { path: source }
|
|
7634
|
+
});
|
|
7635
|
+
}
|
|
7573
7636
|
const pages = demoApplication === false ? "none" : isolatedDemos === true || demoApplication === true || configured ? "all" : void 0;
|
|
7637
|
+
const playgroundPages = pages !== "none" && isolatedPlaygrounds === true ? "all" : void 0;
|
|
7574
7638
|
const settings2 = {
|
|
7575
7639
|
...pages ? { pages } : {},
|
|
7576
7640
|
...isolatedDemos === true && pages !== "none" ? { isolated: true } : {},
|
|
7641
|
+
...playgroundPages ? { playgroundPages } : {},
|
|
7642
|
+
...isolatedPlaygrounds === true && pages !== "none" ? { isolatedPlaygrounds: true } : {},
|
|
7577
7643
|
...demoPath && demoPath !== DEFAULT_DEMO_PATH ? { path: demoPath } : {},
|
|
7578
7644
|
...providers ? { providers } : {}
|
|
7579
7645
|
};
|
|
@@ -7628,12 +7694,12 @@ function describeEntries(projectId, workspaceRoot, routePrefix, modules, closure
|
|
|
7628
7694
|
if (!filtered.has(module.source)) {
|
|
7629
7695
|
filtered.set(module.source, {
|
|
7630
7696
|
kind: module.kind,
|
|
7631
|
-
title: typeof entry
|
|
7697
|
+
title: typeof entry["title"] === "string" ? entry["title"] : "",
|
|
7632
7698
|
source: module.source,
|
|
7633
7699
|
absoluteRoute,
|
|
7634
7700
|
...onlyForTags ? { onlyForTags } : {},
|
|
7635
7701
|
filteredBy,
|
|
7636
|
-
...module.kind === "guide" ? guideKeywords(entry
|
|
7702
|
+
...module.kind === "guide" ? guideKeywords(entry["mdFile"], module.source, allDependencies) : {}
|
|
7637
7703
|
});
|
|
7638
7704
|
}
|
|
7639
7705
|
return { excluded: true, absoluteRoute, filteredBy };
|
|
@@ -7662,12 +7728,12 @@ function describeEntries(projectId, workspaceRoot, routePrefix, modules, closure
|
|
|
7662
7728
|
return void 0;
|
|
7663
7729
|
}
|
|
7664
7730
|
const ownFilter = onlyForTags && !onlyForTags.some((tag) => tags.has(tag)) ? {
|
|
7665
|
-
title: typeof entry
|
|
7731
|
+
title: typeof entry["title"] === "string" ? entry["title"] : "",
|
|
7666
7732
|
source: module.source,
|
|
7667
7733
|
onlyForTags
|
|
7668
7734
|
} : void 0;
|
|
7669
|
-
const parentModule = entry
|
|
7670
|
-
if (entry
|
|
7735
|
+
const parentModule = entry["category"] && typeof entry["category"] === "object" ? moduleByObject.get(entry["category"]) : void 0;
|
|
7736
|
+
if (entry["category"] && !parentModule) {
|
|
7671
7737
|
if (ownFilter) return exclude(module, routePrefix, ownFilter, onlyForTags);
|
|
7672
7738
|
diagnostics.push({
|
|
7673
7739
|
code: "DISCOVERY_CATEGORY_SOURCE_MISSING",
|
|
@@ -7687,7 +7753,7 @@ function describeEntries(projectId, workspaceRoot, routePrefix, modules, closure
|
|
|
7687
7753
|
return exclude(module, described?.absoluteRoute ?? routePrefix, ownFilter, onlyForTags);
|
|
7688
7754
|
}
|
|
7689
7755
|
const parent = described;
|
|
7690
|
-
if (typeof entry
|
|
7756
|
+
if (typeof entry["title"] !== "string" || entry["title"].length === 0) {
|
|
7691
7757
|
diagnostics.push({
|
|
7692
7758
|
code: "DISCOVERY_INVALID_ENTRY",
|
|
7693
7759
|
severity: "error",
|
|
@@ -7703,19 +7769,19 @@ function describeEntries(projectId, workspaceRoot, routePrefix, modules, closure
|
|
|
7703
7769
|
const common = {
|
|
7704
7770
|
id,
|
|
7705
7771
|
source: { path: module.source },
|
|
7706
|
-
title: entry
|
|
7772
|
+
title: entry["title"],
|
|
7707
7773
|
route,
|
|
7708
7774
|
absoluteRoute: joinRoute(parent?.absoluteRoute ?? routePrefix, route),
|
|
7709
|
-
breadcrumbs: [...parent?.breadcrumbs ?? [], entry
|
|
7775
|
+
breadcrumbs: [...parent?.breadcrumbs ?? [], entry["title"]],
|
|
7710
7776
|
parentId: parent?.id,
|
|
7711
|
-
order: numberValue(entry
|
|
7712
|
-
hidden: booleanValue(entry
|
|
7777
|
+
order: numberValue(entry["order"]),
|
|
7778
|
+
hidden: booleanValue(entry["hidden"]),
|
|
7713
7779
|
runtimeImport,
|
|
7714
7780
|
dependencies: []
|
|
7715
7781
|
};
|
|
7716
7782
|
liveEntries.set(id, entry);
|
|
7717
7783
|
if (module.kind === "guide") {
|
|
7718
|
-
const markdown = asArray2(entry
|
|
7784
|
+
const markdown = asArray2(entry["mdFile"]).map(
|
|
7719
7785
|
(file) => normalizeAbsolute(String(file), path9.dirname(module.source))
|
|
7720
7786
|
);
|
|
7721
7787
|
for (const file of markdown) allDependencies.observeFile(file);
|
|
@@ -7743,21 +7809,21 @@ function describeEntries(projectId, workspaceRoot, routePrefix, modules, closure
|
|
|
7743
7809
|
closures.get(module.source)
|
|
7744
7810
|
),
|
|
7745
7811
|
kind: "category",
|
|
7746
|
-
expandable: booleanValue(entry
|
|
7747
|
-
expanded: booleanValue(entry
|
|
7812
|
+
expandable: booleanValue(entry["expandable"]),
|
|
7813
|
+
expanded: booleanValue(entry["expanded"])
|
|
7748
7814
|
};
|
|
7749
7815
|
}
|
|
7750
|
-
const scopesValue = Array.isArray(entry
|
|
7816
|
+
const scopesValue = Array.isArray(entry["scopes"]) ? entry["scopes"] : [];
|
|
7751
7817
|
const scopes = scopesValue.map((scope) => {
|
|
7752
7818
|
const value = asRecord(scope, module.source);
|
|
7753
|
-
const scopeRoute = normalizeRoute(String(value
|
|
7819
|
+
const scopeRoute = normalizeRoute(String(value["route"] ?? ""));
|
|
7754
7820
|
return {
|
|
7755
7821
|
id: `${id}:scope:${scopeRoute}`,
|
|
7756
|
-
name: String(value
|
|
7822
|
+
name: String(value["name"] ?? ""),
|
|
7757
7823
|
route: scopeRoute,
|
|
7758
|
-
order: numberValue(value
|
|
7759
|
-
include: asArray2(value
|
|
7760
|
-
exclude: asArray2(value
|
|
7824
|
+
order: numberValue(value["order"]),
|
|
7825
|
+
include: asArray2(value["include"]).map(String),
|
|
7826
|
+
exclude: asArray2(value["exclude"]).map(String)
|
|
7761
7827
|
};
|
|
7762
7828
|
});
|
|
7763
7829
|
return {
|
|
@@ -7768,8 +7834,8 @@ function describeEntries(projectId, workspaceRoot, routePrefix, modules, closure
|
|
|
7768
7834
|
closures.get(module.source)
|
|
7769
7835
|
),
|
|
7770
7836
|
kind: "api",
|
|
7771
|
-
keyword: stringValue(entry
|
|
7772
|
-
assetRoute: normalizeRoute(typeof entry
|
|
7837
|
+
keyword: stringValue(entry["keyword"]),
|
|
7838
|
+
assetRoute: normalizeRoute(typeof entry["route"] === "string" ? entry["route"] : ""),
|
|
7773
7839
|
scopes
|
|
7774
7840
|
};
|
|
7775
7841
|
};
|
|
@@ -7789,8 +7855,8 @@ function guideKeywords(mdFile, source, dependencies) {
|
|
|
7789
7855
|
const keywords = /* @__PURE__ */ new Set();
|
|
7790
7856
|
for (const file of asArray2(mdFile)) {
|
|
7791
7857
|
try {
|
|
7792
|
-
const
|
|
7793
|
-
const keyword =
|
|
7858
|
+
const text2 = dependencies.readFile(normalizeAbsolute(String(file), path9.dirname(source)));
|
|
7859
|
+
const keyword = text2 ? matter2(text2.toString("utf8")).data["keyword"] : void 0;
|
|
7794
7860
|
if (typeof keyword === "string" && keyword) keywords.add(`*${keyword}`);
|
|
7795
7861
|
} catch {
|
|
7796
7862
|
}
|
|
@@ -7806,7 +7872,7 @@ function normalizeBuildTags(value) {
|
|
|
7806
7872
|
return [...new Set(tags.map((tag) => tag.trim()))].sort();
|
|
7807
7873
|
}
|
|
7808
7874
|
function entryOnlyForTags(module) {
|
|
7809
|
-
const value = module.value
|
|
7875
|
+
const value = module.value["onlyForTags"];
|
|
7810
7876
|
if (module.kind === "api" || value === void 0 || value === null || value === "")
|
|
7811
7877
|
return void 0;
|
|
7812
7878
|
const tags = Array.isArray(value) ? value : [value];
|
|
@@ -7926,11 +7992,11 @@ function kindFor(file) {
|
|
|
7926
7992
|
return kind;
|
|
7927
7993
|
}
|
|
7928
7994
|
function entryRoute(kind, entry, source) {
|
|
7929
|
-
const route = entry
|
|
7995
|
+
const route = entry["route"];
|
|
7930
7996
|
if (kind === "guide") {
|
|
7931
7997
|
if (typeof route === "object" && route !== null)
|
|
7932
7998
|
return normalizeRoute(
|
|
7933
|
-
String(route
|
|
7999
|
+
String(route["path"] ?? path9.basename(path9.dirname(source)))
|
|
7934
8000
|
);
|
|
7935
8001
|
return normalizeRoute(String(route ?? path9.basename(path9.dirname(source))));
|
|
7936
8002
|
}
|
|
@@ -7949,9 +8015,9 @@ function digestDependencies(dependencies) {
|
|
|
7949
8015
|
}
|
|
7950
8016
|
function normalizeAbsolute(value, base) {
|
|
7951
8017
|
const absolute = path9.isAbsolute(value) ? path9.resolve(value) : path9.resolve(base ?? process.cwd(), value);
|
|
7952
|
-
if (existsSync6(absolute)) return normalizePath2(
|
|
8018
|
+
if (existsSync6(absolute)) return normalizePath2(realpathSync3.native(absolute));
|
|
7953
8019
|
const existingParent = nearestExistingParent(path9.dirname(absolute));
|
|
7954
|
-
const canonicalParent =
|
|
8020
|
+
const canonicalParent = realpathSync3.native(existingParent);
|
|
7955
8021
|
return normalizePath2(path9.join(canonicalParent, path9.relative(existingParent, absolute)));
|
|
7956
8022
|
}
|
|
7957
8023
|
function nearestExistingParent(value) {
|
|
@@ -8176,6 +8242,7 @@ function isBuildFailure(error) {
|
|
|
8176
8242
|
}
|
|
8177
8243
|
|
|
8178
8244
|
// libs/builder/generator/outputs/index.ts
|
|
8245
|
+
init_core();
|
|
8179
8246
|
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
8180
8247
|
import { dirname, isAbsolute, posix, relative, resolve, sep } from "node:path";
|
|
8181
8248
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
@@ -8218,11 +8285,17 @@ var STRUCTURAL_TEMPLATES = [
|
|
|
8218
8285
|
var DEFAULT_DEMO_PATH2 = "demo-preview";
|
|
8219
8286
|
var DEMO_NAME = /^[A-Za-z0-9_$-]+$/;
|
|
8220
8287
|
var DEMO_ACTION = /<ng-doc-demo\b[^>]*>\s*<div\b[^>]*\bid="options"[^>]*>([^<]*)<\/div>/g;
|
|
8288
|
+
var PLAYGROUND_ACTION = /<ng-doc-playground\b[^>]*>([\s\S]*?)<\/ng-doc-playground>/g;
|
|
8289
|
+
var PLAYGROUND_OPTIONS = /<div\b[^>]*\bid="options"[^>]*>([^<]*)<\/div>/;
|
|
8290
|
+
var PLAYGROUND_SEGMENT = "playground";
|
|
8221
8291
|
function demoSettings(configuration) {
|
|
8222
8292
|
const settings2 = configuration.demoApplication;
|
|
8293
|
+
const pages = settings2?.pages ?? "isolated";
|
|
8223
8294
|
return {
|
|
8224
|
-
pages
|
|
8295
|
+
pages,
|
|
8225
8296
|
isolated: settings2?.isolated === true,
|
|
8297
|
+
playgroundPages: pages === "none" ? "none" : settings2?.playgroundPages ?? "isolated",
|
|
8298
|
+
isolatedPlaygrounds: settings2?.isolatedPlaygrounds === true,
|
|
8226
8299
|
path: settings2?.path ?? DEFAULT_DEMO_PATH2,
|
|
8227
8300
|
...settings2?.providers ? { providers: settings2.providers } : {}
|
|
8228
8301
|
};
|
|
@@ -8237,19 +8310,31 @@ function decodeHtmlText(value) {
|
|
|
8237
8310
|
}
|
|
8238
8311
|
);
|
|
8239
8312
|
}
|
|
8313
|
+
function isolatedOption(text2) {
|
|
8314
|
+
try {
|
|
8315
|
+
return JSON.parse(decodeHtmlText(text2))?.isolated === true;
|
|
8316
|
+
} catch {
|
|
8317
|
+
return false;
|
|
8318
|
+
}
|
|
8319
|
+
}
|
|
8240
8320
|
function hasIsolatedDemo(html) {
|
|
8241
8321
|
for (const match of html?.matchAll(DEMO_ACTION) ?? []) {
|
|
8242
|
-
|
|
8243
|
-
if (JSON.parse(decodeHtmlText(match[1]))?.isolated === true) {
|
|
8244
|
-
return true;
|
|
8245
|
-
}
|
|
8246
|
-
} catch {
|
|
8247
|
-
}
|
|
8322
|
+
if (isolatedOption(match[1])) return true;
|
|
8248
8323
|
}
|
|
8249
8324
|
return false;
|
|
8250
8325
|
}
|
|
8326
|
+
function hasIsolatedPlayground(html) {
|
|
8327
|
+
for (const match of html?.matchAll(PLAYGROUND_ACTION) ?? []) {
|
|
8328
|
+
const options = PLAYGROUND_OPTIONS.exec(match[1])?.[1];
|
|
8329
|
+
if (options !== void 0 && isolatedOption(options)) return true;
|
|
8330
|
+
}
|
|
8331
|
+
return false;
|
|
8332
|
+
}
|
|
8333
|
+
function playgroundTargets(playground) {
|
|
8334
|
+
return playground.pipeName ? [playground.pipeName] : (playground.selector ?? "").split(",").map((selector) => selector.trim()).filter(Boolean);
|
|
8335
|
+
}
|
|
8251
8336
|
function pageAssemblyKey(request, templates) {
|
|
8252
|
-
const
|
|
8337
|
+
const text2 = canonicalJsonStrict({
|
|
8253
8338
|
schema: "page-assembly-key-v1",
|
|
8254
8339
|
ownerId: request.ownerId,
|
|
8255
8340
|
configuration: request.configuration,
|
|
@@ -8260,7 +8345,7 @@ function pageAssemblyKey(request, templates) {
|
|
|
8260
8345
|
metadata: request.metadata,
|
|
8261
8346
|
templates
|
|
8262
8347
|
});
|
|
8263
|
-
return
|
|
8348
|
+
return text2 === void 0 ? void 0 : sha256Hex(text2);
|
|
8264
8349
|
}
|
|
8265
8350
|
function normalize(value) {
|
|
8266
8351
|
return value.replace(/\\/g, "/");
|
|
@@ -8994,7 +9079,8 @@ var OutputAssemblerImpl = class {
|
|
|
8994
9079
|
entryHasImports: request.entry.hasImports,
|
|
8995
9080
|
...demoPages ? {
|
|
8996
9081
|
demoRoute: `${demoSettingsOfPage.path}/${request.entry.absoluteRoute}`,
|
|
8997
|
-
isolatedDemos: demoSettingsOfPage.isolated
|
|
9082
|
+
isolatedDemos: demoSettingsOfPage.isolated,
|
|
9083
|
+
isolatedPlaygrounds: demoSettingsOfPage.isolatedPlaygrounds
|
|
8998
9084
|
} : {},
|
|
8999
9085
|
demoAssetsPath: resolve(request.configuration.outputRoot, demoPath),
|
|
9000
9086
|
playgroundsPath: resolve(request.configuration.outputRoot, playgroundPath)
|
|
@@ -9092,35 +9178,59 @@ var OutputAssemblerImpl = class {
|
|
|
9092
9178
|
...request.entry.hidden === void 0 ? {} : { hidden: request.entry.hidden },
|
|
9093
9179
|
...request.metadata ? { metadata: request.metadata } : {},
|
|
9094
9180
|
modulePath: wrapperPath,
|
|
9095
|
-
...demoPages ? { demoModulePath: demoPages.path, demoNames: demoPages.names } : {}
|
|
9181
|
+
...demoPages ? { demoModulePath: demoPages.path, demoNames: demoPages.names } : {},
|
|
9182
|
+
...demoPages?.playgroundPages.length ? { playgroundPages: demoPages.playgroundPages } : {}
|
|
9096
9183
|
});
|
|
9097
9184
|
}
|
|
9098
9185
|
/**
|
|
9099
|
-
* Writes the guide's demo routes module
|
|
9100
|
-
*
|
|
9101
|
-
*
|
|
9102
|
-
*
|
|
9186
|
+
* Writes the guide's demo routes module when the guide gets demo or playground pages, and
|
|
9187
|
+
* returns its path, the names of the demos that got a page and the playground pages (relative
|
|
9188
|
+
* to the guide's demo route), or undefined.
|
|
9189
|
+
*
|
|
9190
|
+
* - Demo pages: with `pages: 'all'`, by default when its content has a demo with
|
|
9191
|
+
* `isolated: true`, and whenever the guide gets playground pages: the page then has a demo
|
|
9192
|
+
* route, and the runtime offers every demo of such a page its demo page.
|
|
9193
|
+
* - Playground pages (`playground/<id>/<target>`, one per target of every playground of the
|
|
9194
|
+
* guide, under the page's providers and its generated playground classes): with
|
|
9195
|
+
* `playgroundPages: 'all'`, or by default when a `playground` action of its content or a
|
|
9196
|
+
* playground of its configuration has `isolated: true`.
|
|
9103
9197
|
*/
|
|
9104
9198
|
demoRoutes(request, directory, slots, outputs, diagnostics) {
|
|
9105
9199
|
const settings2 = demoSettings(request.configuration);
|
|
9200
|
+
if (settings2.pages === "none") return void 0;
|
|
9201
|
+
const playgrounds = this.playgroundRoutes(request, slots, diagnostics);
|
|
9106
9202
|
const names = Object.keys(request.semantics?.demos ?? {});
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
|
|
9203
|
+
const withDemoPages = names.length > 0 && (settings2.pages === "all" || playgrounds.length > 0 || slots.some((slot) => hasIsolatedDemo(slot.linked?.html)));
|
|
9204
|
+
if (!withDemoPages && !playgrounds.length) return void 0;
|
|
9205
|
+
const demos = (withDemoPages ? names : []).filter((name) => {
|
|
9206
|
+
if (!DEMO_NAME.test(name)) {
|
|
9207
|
+
diagnostics.push({
|
|
9208
|
+
...diagnostic2(
|
|
9209
|
+
"OUTPUT_DEMO_NAME_INVALID",
|
|
9210
|
+
`Demo ${JSON.stringify(name)} has no demo page: a demo name must be letters, digits, '_', '$' or '-' to be its page's URL segment.`,
|
|
9211
|
+
request.entry.id
|
|
9212
|
+
),
|
|
9213
|
+
severity: "warning"
|
|
9214
|
+
});
|
|
9215
|
+
return false;
|
|
9216
|
+
}
|
|
9217
|
+
if (playgrounds.length && name === PLAYGROUND_SEGMENT) {
|
|
9218
|
+
diagnostics.push({
|
|
9219
|
+
...diagnostic2(
|
|
9220
|
+
"OUTPUT_DEMO_NAME_RESERVED",
|
|
9221
|
+
`Demo ${JSON.stringify(name)} has no demo page: '${PLAYGROUND_SEGMENT}' is the URL segment of the guide's playground pages. Rename the demo.`,
|
|
9222
|
+
request.entry.id
|
|
9223
|
+
),
|
|
9224
|
+
severity: "warning"
|
|
9225
|
+
});
|
|
9226
|
+
return false;
|
|
9227
|
+
}
|
|
9228
|
+
return true;
|
|
9121
9229
|
});
|
|
9122
9230
|
const path18 = joinOutput(directory, "demo-routes.ts");
|
|
9123
|
-
|
|
9231
|
+
const playgroundsPath = joinOutput(directory, "playgrounds.ts");
|
|
9232
|
+
if (!path18 || !playgroundsPath || !demos.length && !playgrounds.length) return void 0;
|
|
9233
|
+
const routesDirectory = dirname(resolve(request.configuration.outputRoot, path18));
|
|
9124
9234
|
this.renderOutput(
|
|
9125
9235
|
outputs,
|
|
9126
9236
|
diagnostics,
|
|
@@ -9128,18 +9238,60 @@ var OutputAssemblerImpl = class {
|
|
|
9128
9238
|
"angular",
|
|
9129
9239
|
"demo-routes.ts.nunj",
|
|
9130
9240
|
{
|
|
9131
|
-
entryImport: moduleSpecifier(
|
|
9132
|
-
dirname(resolve(request.configuration.outputRoot, path18)),
|
|
9133
|
-
request.entry.runtimeImport.source
|
|
9134
|
-
),
|
|
9241
|
+
entryImport: moduleSpecifier(routesDirectory, request.entry.runtimeImport.source),
|
|
9135
9242
|
demos: demos.map((name) => ({
|
|
9136
9243
|
name,
|
|
9137
9244
|
title: `${request.entry.title}: ${name}`
|
|
9138
|
-
}))
|
|
9245
|
+
})),
|
|
9246
|
+
playgrounds,
|
|
9247
|
+
...playgrounds.length ? {
|
|
9248
|
+
playgroundsImport: moduleSpecifier(
|
|
9249
|
+
routesDirectory,
|
|
9250
|
+
resolve(request.configuration.outputRoot, playgroundsPath)
|
|
9251
|
+
)
|
|
9252
|
+
} : {}
|
|
9139
9253
|
},
|
|
9140
9254
|
request.entry.id
|
|
9141
9255
|
);
|
|
9142
|
-
return outputs.has(path18) ? { path: path18, names: demos } : void 0;
|
|
9256
|
+
return outputs.has(path18) ? { path: path18, names: demos, playgroundPages: playgrounds.map((route) => route.path) } : void 0;
|
|
9257
|
+
}
|
|
9258
|
+
/**
|
|
9259
|
+
* The playground pages of a guide, when it gets them (see `demoRoutes`): one per target of each
|
|
9260
|
+
* playground, in the order of the guide's playgrounds and of `playgroundTargets`. A playground
|
|
9261
|
+
* whose ID is no URL segment gets none, with a warning.
|
|
9262
|
+
* @param request - The guide's assembly request.
|
|
9263
|
+
* @param slots - The guide's content.
|
|
9264
|
+
* @param diagnostics - Receives the warnings.
|
|
9265
|
+
*/
|
|
9266
|
+
playgroundRoutes(request, slots, diagnostics) {
|
|
9267
|
+
const settings2 = demoSettings(request.configuration);
|
|
9268
|
+
const playgrounds = request.semantics?.playgrounds ?? [];
|
|
9269
|
+
if (settings2.playgroundPages === "none" || !playgrounds.length || settings2.playgroundPages === "isolated" && !playgrounds.some((playground) => playground.isolated === true) && !slots.some((slot) => hasIsolatedPlayground(slot.linked?.html))) {
|
|
9270
|
+
return [];
|
|
9271
|
+
}
|
|
9272
|
+
return playgrounds.flatMap((playground) => {
|
|
9273
|
+
if (!DEMO_NAME.test(playground.id)) {
|
|
9274
|
+
diagnostics.push({
|
|
9275
|
+
...diagnostic2(
|
|
9276
|
+
"OUTPUT_PLAYGROUND_NAME_INVALID",
|
|
9277
|
+
`Playground ${JSON.stringify(playground.id)} has no playground pages: a playground name must be letters, digits, '_', '$' or '-' to be a URL segment of its pages.`,
|
|
9278
|
+
request.entry.id
|
|
9279
|
+
),
|
|
9280
|
+
severity: "warning"
|
|
9281
|
+
});
|
|
9282
|
+
return [];
|
|
9283
|
+
}
|
|
9284
|
+
const targets = playgroundTargets(playground);
|
|
9285
|
+
const slugs = \u0275playgroundTargetSlugs(targets);
|
|
9286
|
+
return targets.map((target, index) => ({
|
|
9287
|
+
path: `${PLAYGROUND_SEGMENT}/${playground.id}/${slugs[index]}`,
|
|
9288
|
+
title: `${request.entry.title}: ${playground.id}`,
|
|
9289
|
+
data: {
|
|
9290
|
+
id: playground.id,
|
|
9291
|
+
...playground.pipeName ? { pipeName: target } : { selector: target }
|
|
9292
|
+
}
|
|
9293
|
+
}));
|
|
9294
|
+
});
|
|
9143
9295
|
}
|
|
9144
9296
|
apiEntry(request, outputs, routes, diagnostics) {
|
|
9145
9297
|
const assetRoute = apiAssetRoute(request.entry, request.configuration);
|
|
@@ -9371,8 +9523,8 @@ export default source;
|
|
|
9371
9523
|
}
|
|
9372
9524
|
/**
|
|
9373
9525
|
* Writes `demo-app.ts`, the routes of the demo application (one lazy route per guide with demo
|
|
9374
|
-
* pages, under its categories' providers)
|
|
9375
|
-
* pages. Returns whether it did.
|
|
9526
|
+
* or playground pages, under its categories' providers), every such page (`NG_DOC_DEMO_PAGES`)
|
|
9527
|
+
* and its `demoProviders` import, when a guide has demo pages. Returns whether it did.
|
|
9376
9528
|
*/
|
|
9377
9529
|
demoApplication(request, records, outputs, diagnostics) {
|
|
9378
9530
|
const settings2 = demoSettings(request.configuration);
|
|
@@ -9391,7 +9543,9 @@ export default source;
|
|
|
9391
9543
|
const route = `${settings2.path}/${entries.get(record.id).absoluteRoute}`;
|
|
9392
9544
|
return {
|
|
9393
9545
|
path: route,
|
|
9394
|
-
demos:
|
|
9546
|
+
demos: [...record.demoNames ?? [], ...record.playgroundPages ?? []].map(
|
|
9547
|
+
(page) => `${route}/${page}`
|
|
9548
|
+
),
|
|
9395
9549
|
categories: chain,
|
|
9396
9550
|
importPath: moduleSpecifier(outputRoot, resolve(outputRoot, record.demoModulePath))
|
|
9397
9551
|
};
|
|
@@ -9469,8 +9623,8 @@ import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
|
9469
9623
|
init_core();
|
|
9470
9624
|
import { dirname as dirname2, resolve as resolve3 } from "node:path";
|
|
9471
9625
|
import {
|
|
9472
|
-
Node as
|
|
9473
|
-
TypeFormatFlags as
|
|
9626
|
+
Node as Node17,
|
|
9627
|
+
TypeFormatFlags as TypeFormatFlags3
|
|
9474
9628
|
} from "ts-morph";
|
|
9475
9629
|
|
|
9476
9630
|
// libs/builder/helpers/typescript/class/for-all-classes.ts
|
|
@@ -9793,10 +9947,15 @@ function getTemplateForPlayground(playground) {
|
|
|
9793
9947
|
return "";
|
|
9794
9948
|
}
|
|
9795
9949
|
|
|
9950
|
+
// libs/builder/helpers/playground/playground-options.ts
|
|
9951
|
+
import { Node as Node14, SyntaxKind as SyntaxKind2, TypeFormatFlags } from "ts-morph";
|
|
9952
|
+
|
|
9796
9953
|
// libs/builder/helpers/playground/written-union-order.ts
|
|
9797
9954
|
import { Node as Node13 } from "ts-morph";
|
|
9798
9955
|
function writtenUnionOrder(declaration, type, members2 = type.getUnionTypes()) {
|
|
9799
|
-
|
|
9956
|
+
return writtenOrder(writtenTypeNode(declaration), members2);
|
|
9957
|
+
}
|
|
9958
|
+
function writtenOrder(node, members2) {
|
|
9800
9959
|
if (!node || members2.length < 2) return members2;
|
|
9801
9960
|
const written = [];
|
|
9802
9961
|
collect(node, written, /* @__PURE__ */ new Set());
|
|
@@ -9856,6 +10015,61 @@ function regularType(type) {
|
|
|
9856
10015
|
return type.regularType ?? type;
|
|
9857
10016
|
}
|
|
9858
10017
|
|
|
10018
|
+
// libs/builder/helpers/playground/playground-options.ts
|
|
10019
|
+
var OPTION_TEXT_FLAGS = TypeFormatFlags.NoTruncation | TypeFormatFlags.UseSingleQuotesForStringLiteralType;
|
|
10020
|
+
function playgroundOption(member) {
|
|
10021
|
+
if (member.isEnumLiteral()) {
|
|
10022
|
+
const value = member.getLiteralValue();
|
|
10023
|
+
const name = member.getSymbol()?.getName();
|
|
10024
|
+
if (name && (typeof value === "string" || typeof value === "number"))
|
|
10025
|
+
return { label: name, value };
|
|
10026
|
+
}
|
|
10027
|
+
return member.getText(void 0, OPTION_TEXT_FLAGS);
|
|
10028
|
+
}
|
|
10029
|
+
function playgroundArrayOptions(declaration, type) {
|
|
10030
|
+
const arrays = withoutNullish(type.isUnion() ? type.getUnionTypes() : [type]);
|
|
10031
|
+
const array = arrays.length === 1 ? arrays[0] : void 0;
|
|
10032
|
+
if (!array || !(array.isArray() || array.isReadonlyArray()) || array.getAliasSymbol()) {
|
|
10033
|
+
return void 0;
|
|
10034
|
+
}
|
|
10035
|
+
const item = array.getTypeArguments()[0];
|
|
10036
|
+
const members2 = item?.isUnion() ? withoutNullish(item.getUnionTypes()) : [];
|
|
10037
|
+
if (!members2.length || !members2.every(isLiteral) || members2.every((member) => member.isBooleanLiteral())) {
|
|
10038
|
+
return void 0;
|
|
10039
|
+
}
|
|
10040
|
+
const byText = [...members2].sort((a, b) => compareTexts(text(a), text(b)));
|
|
10041
|
+
return writtenOrder(itemTypeNode(writtenTypeNode(declaration)), byText).map(playgroundOption);
|
|
10042
|
+
}
|
|
10043
|
+
function itemTypeNode(node) {
|
|
10044
|
+
if (!node) return void 0;
|
|
10045
|
+
if (Node14.isParenthesizedTypeNode(node)) return itemTypeNode(node.getTypeNode());
|
|
10046
|
+
if (Node14.isUnionTypeNode(node)) {
|
|
10047
|
+
const rest = node.getTypeNodes().filter((member) => !isNullish(member));
|
|
10048
|
+
return rest.length === 1 ? itemTypeNode(rest[0]) : void 0;
|
|
10049
|
+
}
|
|
10050
|
+
if (Node14.isTypeOperatorTypeNode(node) && node.getOperator() === SyntaxKind2.ReadonlyKeyword)
|
|
10051
|
+
return itemTypeNode(node.getTypeNode());
|
|
10052
|
+
if (Node14.isArrayTypeNode(node)) return node.getElementTypeNode();
|
|
10053
|
+
if (Node14.isTypeReference(node) && /^(?:Readonly)?Array$/.test(node.getTypeName().getText()))
|
|
10054
|
+
return node.getTypeArguments()[0];
|
|
10055
|
+
return void 0;
|
|
10056
|
+
}
|
|
10057
|
+
function isNullish(node) {
|
|
10058
|
+
return node.getKind() === SyntaxKind2.UndefinedKeyword || Node14.isLiteralTypeNode(node) && node.getLiteral().getKind() === SyntaxKind2.NullKeyword;
|
|
10059
|
+
}
|
|
10060
|
+
function withoutNullish(types) {
|
|
10061
|
+
return types.filter((type) => !type.isUndefined() && !type.isNull());
|
|
10062
|
+
}
|
|
10063
|
+
function isLiteral(type) {
|
|
10064
|
+
return type.isStringLiteral() || type.isNumberLiteral() || type.isBooleanLiteral() || type.isEnumLiteral();
|
|
10065
|
+
}
|
|
10066
|
+
function text(type) {
|
|
10067
|
+
return type.getText(void 0, OPTION_TEXT_FLAGS);
|
|
10068
|
+
}
|
|
10069
|
+
function compareTexts(a, b) {
|
|
10070
|
+
return compareText(a, b) || (a < b ? -1 : a > b ? 1 : 0);
|
|
10071
|
+
}
|
|
10072
|
+
|
|
9859
10073
|
// libs/builder/helpers/snippets-from-asset.ts
|
|
9860
10074
|
import path12 from "path";
|
|
9861
10075
|
|
|
@@ -10073,15 +10287,15 @@ function snippetsFromAsset(asset, inlineStylesType, configDirectory) {
|
|
|
10073
10287
|
}
|
|
10074
10288
|
|
|
10075
10289
|
// libs/builder/helpers/typescript/display-type.ts
|
|
10076
|
-
import { Node as
|
|
10077
|
-
function displayType(node, typeFormatFlags =
|
|
10078
|
-
return
|
|
10290
|
+
import { Node as Node15, TypeFormatFlags as TypeFormatFlags2 } from "ts-morph";
|
|
10291
|
+
function displayType(node, typeFormatFlags = TypeFormatFlags2.NoTruncation) {
|
|
10292
|
+
return Node15.isTypeAliasDeclaration(node) ? node.getTypeNodeOrThrow().getText(void 0) : formatType(node.getType(), typeFormatFlags);
|
|
10079
10293
|
}
|
|
10080
|
-
function formatType(type, typeFormatFlags =
|
|
10294
|
+
function formatType(type, typeFormatFlags = TypeFormatFlags2.NoTruncation) {
|
|
10081
10295
|
return type.getText(void 0, typeFormatFlags);
|
|
10082
10296
|
}
|
|
10083
|
-
function displayReturnType(node, typeFormatFlags =
|
|
10084
|
-
if (
|
|
10297
|
+
function displayReturnType(node, typeFormatFlags = TypeFormatFlags2.NoTruncation) {
|
|
10298
|
+
if (Node15.isReturnTyped(node)) {
|
|
10085
10299
|
return node.getReturnType().getText(void 0, typeFormatFlags);
|
|
10086
10300
|
}
|
|
10087
10301
|
return "";
|
|
@@ -10091,7 +10305,7 @@ function displayReturnType(node, typeFormatFlags = TypeFormatFlags.NoTruncation)
|
|
|
10091
10305
|
import { existsSync as existsSync8 } from "node:fs";
|
|
10092
10306
|
import { resolve as resolve2 } from "node:path";
|
|
10093
10307
|
var normalize2 = (file) => resolve2(file).replace(/\\/g, "/");
|
|
10094
|
-
var digest2 = (
|
|
10308
|
+
var digest2 = (text2) => sha256Hex(text2);
|
|
10095
10309
|
var SemanticFailure = class extends Error {
|
|
10096
10310
|
constructor(code, message2, source) {
|
|
10097
10311
|
super(message2);
|
|
@@ -10116,9 +10330,9 @@ var TrackedFiles = class extends ObservationRecorder {
|
|
|
10116
10330
|
const path18 = normalize2(file);
|
|
10117
10331
|
this.add({ kind: "existence", path: path18, exists: existsSync8(path18) });
|
|
10118
10332
|
try {
|
|
10119
|
-
const { text, digest: digest3 } = readText(path18);
|
|
10333
|
+
const { text: text2, digest: digest3 } = readText(path18);
|
|
10120
10334
|
this.add({ kind: "content", path: path18, digest: digest3 });
|
|
10121
|
-
return
|
|
10335
|
+
return text2;
|
|
10122
10336
|
} catch (error) {
|
|
10123
10337
|
throw new SemanticFailure(
|
|
10124
10338
|
"SEMANTIC_INPUT_READ",
|
|
@@ -10134,7 +10348,7 @@ import { ts as ts4 } from "ts-morph";
|
|
|
10134
10348
|
|
|
10135
10349
|
// libs/builder/generator/semantic/recorder.ts
|
|
10136
10350
|
import * as tsMorph from "ts-morph";
|
|
10137
|
-
import { Node as
|
|
10351
|
+
import { Node as Node16, Project, ts as ts3 } from "ts-morph";
|
|
10138
10352
|
var stack = [];
|
|
10139
10353
|
var suspended = 0;
|
|
10140
10354
|
function top() {
|
|
@@ -10474,7 +10688,7 @@ function installVerifyHooks() {
|
|
|
10474
10688
|
verifyInstalled = true;
|
|
10475
10689
|
const prototypes = /* @__PURE__ */ new Set();
|
|
10476
10690
|
for (const value of Object.values(tsMorph)) {
|
|
10477
|
-
if (typeof value !== "function" || !(value ===
|
|
10691
|
+
if (typeof value !== "function" || !(value === Node16 || value.prototype instanceof Node16))
|
|
10478
10692
|
continue;
|
|
10479
10693
|
for (let prototype = value.prototype; prototype && prototype !== Object.prototype; prototype = Object.getPrototypeOf(prototype))
|
|
10480
10694
|
prototypes.add(prototype);
|
|
@@ -10762,37 +10976,25 @@ function canonicalMembers(type) {
|
|
|
10762
10976
|
members2.map((member) => member.compilerType),
|
|
10763
10977
|
(member) => wrappers.get(member).getText(
|
|
10764
10978
|
void 0,
|
|
10765
|
-
|
|
10979
|
+
TypeFormatFlags3.NoTruncation | TypeFormatFlags3.UseSingleQuotesForStringLiteralType
|
|
10766
10980
|
)
|
|
10767
10981
|
).map((member) => wrappers.get(member));
|
|
10768
10982
|
}
|
|
10769
|
-
function playgroundOption(member) {
|
|
10770
|
-
if (member.isEnumLiteral()) {
|
|
10771
|
-
const value = member.getLiteralValue();
|
|
10772
|
-
const name = member.getSymbol()?.getName();
|
|
10773
|
-
if (name && (typeof value === "string" || typeof value === "number"))
|
|
10774
|
-
return { label: name, value };
|
|
10775
|
-
}
|
|
10776
|
-
return member.getText(
|
|
10777
|
-
void 0,
|
|
10778
|
-
TypeFormatFlags2.NoTruncation | TypeFormatFlags2.UseSingleQuotesForStringLiteralType
|
|
10779
|
-
);
|
|
10780
|
-
}
|
|
10781
10983
|
function unwrap(node, seen = /* @__PURE__ */ new Set()) {
|
|
10782
10984
|
if (!node || seen.has(node)) return void 0;
|
|
10783
10985
|
seen.add(node);
|
|
10784
|
-
if (
|
|
10986
|
+
if (Node17.isAsExpression(node) || Node17.isSatisfiesExpression(node) || Node17.isParenthesizedExpression(node) || Node17.isTypeAssertion(node))
|
|
10785
10987
|
return unwrap(node.getExpression(), seen);
|
|
10786
|
-
if (
|
|
10787
|
-
if (
|
|
10988
|
+
if (Node17.isIdentifier(node)) return unwrap(node.getSymbol()?.getDeclarations()[0], seen);
|
|
10989
|
+
if (Node17.isVariableDeclaration(node) || Node17.isPropertyAssignment(node))
|
|
10788
10990
|
return unwrap(node.getInitializer(), seen);
|
|
10789
|
-
if (
|
|
10991
|
+
if (Node17.isExportAssignment(node)) return unwrap(node.getExpression(), seen);
|
|
10790
10992
|
return node;
|
|
10791
10993
|
}
|
|
10792
10994
|
function entryObject(source) {
|
|
10793
10995
|
const exported = source.getDefaultExportSymbol()?.getDeclarations()[0];
|
|
10794
10996
|
const object = unwrap(exported);
|
|
10795
|
-
if (!
|
|
10997
|
+
if (!Node17.isObjectLiteralExpression(object))
|
|
10796
10998
|
throw new SemanticFailure(
|
|
10797
10999
|
"SEMANTIC_ENTRY_OBJECT",
|
|
10798
11000
|
`Cannot resolve default entry object in ${source.getFilePath()}`
|
|
@@ -10801,19 +11003,19 @@ function entryObject(source) {
|
|
|
10801
11003
|
}
|
|
10802
11004
|
function literal(node) {
|
|
10803
11005
|
const value = unwrap(node);
|
|
10804
|
-
if (
|
|
11006
|
+
if (Node17.isStringLiteral(value) || Node17.isNoSubstitutionTemplateLiteral(value))
|
|
10805
11007
|
return value.getLiteralValue();
|
|
10806
|
-
if (
|
|
11008
|
+
if (Node17.isNumericLiteral(value)) return value.getLiteralValue();
|
|
10807
11009
|
if (value?.getText() === "true") return true;
|
|
10808
11010
|
if (value?.getText() === "false") return false;
|
|
10809
11011
|
if (value?.getText() === "null") return null;
|
|
10810
|
-
if (
|
|
11012
|
+
if (Node17.isPrefixUnaryExpression(value) && /^-\d/.test(value.getText()))
|
|
10811
11013
|
return Number(value.getText());
|
|
10812
|
-
if (
|
|
10813
|
-
if (
|
|
11014
|
+
if (Node17.isArrayLiteralExpression(value)) return value.getElements().map((item) => literal(item));
|
|
11015
|
+
if (Node17.isObjectLiteralExpression(value))
|
|
10814
11016
|
return Object.fromEntries(
|
|
10815
11017
|
value.getProperties().map((property) => {
|
|
10816
|
-
if (!
|
|
11018
|
+
if (!Node17.isPropertyAssignment(property))
|
|
10817
11019
|
throw new SemanticFailure(
|
|
10818
11020
|
"SEMANTIC_DYNAMIC_CONTROLS",
|
|
10819
11021
|
"Computed controls require readGuideValues"
|
|
@@ -10909,13 +11111,13 @@ function guideSemantics(source, files, config, docs, values) {
|
|
|
10909
11111
|
const demoClasses = getDemoClassDeclarations(object);
|
|
10910
11112
|
const demoExpression = unwrap(object.getProperty("demos"));
|
|
10911
11113
|
if (demoExpression) {
|
|
10912
|
-
if (!
|
|
11114
|
+
if (!Node17.isObjectLiteralExpression(demoExpression))
|
|
10913
11115
|
throw new SemanticFailure(
|
|
10914
11116
|
"SEMANTIC_DEMO_OBJECT",
|
|
10915
11117
|
"Demos require an object literal mapping names to component classes"
|
|
10916
11118
|
);
|
|
10917
11119
|
for (const property of demoExpression.getProperties()) {
|
|
10918
|
-
const name =
|
|
11120
|
+
const name = Node17.isPropertyAssignment(property) || Node17.isShorthandPropertyAssignment(property) ? property.getName().replace(/^['"]|['"]$/g, "") : "";
|
|
10919
11121
|
if (!demoClasses[name] || !getComponentSourceFiles(demoClasses[name]).length)
|
|
10920
11122
|
throw new SemanticFailure("SEMANTIC_DEMO_TARGET", `Cannot resolve component demo ${name}`);
|
|
10921
11123
|
}
|
|
@@ -10925,7 +11127,7 @@ function guideSemantics(source, files, config, docs, values) {
|
|
|
10925
11127
|
);
|
|
10926
11128
|
const playgrounds = unwrap(object.getProperty("playgrounds"));
|
|
10927
11129
|
if (!playgrounds) return { demos, playgrounds: [] };
|
|
10928
|
-
if (!
|
|
11130
|
+
if (!Node17.isObjectLiteralExpression(playgrounds))
|
|
10929
11131
|
throw new SemanticFailure(
|
|
10930
11132
|
"SEMANTIC_PLAYGROUNDS_OBJECT",
|
|
10931
11133
|
"Playgrounds must expose an object literal for target analysis"
|
|
@@ -10934,14 +11136,14 @@ function guideSemantics(source, files, config, docs, values) {
|
|
|
10934
11136
|
return {
|
|
10935
11137
|
demos,
|
|
10936
11138
|
playgrounds: playgrounds.getProperties().map((property) => {
|
|
10937
|
-
if (!
|
|
11139
|
+
if (!Node17.isPropertyAssignment(property))
|
|
10938
11140
|
throw new SemanticFailure(
|
|
10939
11141
|
"SEMANTIC_PLAYGROUND_OBJECT",
|
|
10940
11142
|
"Playgrounds require named property assignments"
|
|
10941
11143
|
);
|
|
10942
11144
|
const id = property.getName().replace(/^['"]|['"]$/g, "");
|
|
10943
11145
|
const expression = unwrap(property.getInitializer());
|
|
10944
|
-
if (!
|
|
11146
|
+
if (!Node17.isObjectLiteralExpression(expression))
|
|
10945
11147
|
throw new SemanticFailure("SEMANTIC_PLAYGROUND_OBJECT", `Cannot resolve playground ${id}`);
|
|
10946
11148
|
const target = getTargetForPlayground(expression);
|
|
10947
11149
|
if (!target?.getName())
|
|
@@ -10962,25 +11164,26 @@ function guideSemantics(source, files, config, docs, values) {
|
|
|
10962
11164
|
const properties = {};
|
|
10963
11165
|
const inputs = pipeName ? target.getMethodOrThrow("transform").getParameters().slice(1) : getComponentInputs(target);
|
|
10964
11166
|
for (const input of inputs) {
|
|
10965
|
-
const type =
|
|
10966
|
-
let name =
|
|
10967
|
-
if (
|
|
11167
|
+
const type = Node17.isPropertyDeclaration(input) ? getInputType(input) : input.getType();
|
|
11168
|
+
let name = Node17.isParameterDeclaration(input) ? input.getName() : getInputName(input);
|
|
11169
|
+
if (Node17.isPropertyDeclaration(input)) {
|
|
10968
11170
|
const call = input.getInitializer();
|
|
10969
|
-
if (
|
|
11171
|
+
if (Node17.isCallExpression(call) && /\.required$/.test(call.getExpression().getText())) {
|
|
10970
11172
|
const options = call.getArguments()[0];
|
|
10971
|
-
const alias =
|
|
10972
|
-
if (
|
|
11173
|
+
const alias = Node17.isObjectLiteralExpression(options) ? unwrap(options.getProperty("alias")) : void 0;
|
|
11174
|
+
if (Node17.isStringLiteral(alias)) name = alias.getLiteralValue();
|
|
10973
11175
|
}
|
|
10974
11176
|
}
|
|
10975
11177
|
properties[input.getName()] = {
|
|
10976
11178
|
inputName: name,
|
|
10977
11179
|
type: formatType(
|
|
10978
11180
|
type,
|
|
10979
|
-
|
|
11181
|
+
TypeFormatFlags3.NoTruncation | TypeFormatFlags3.UseSingleQuotesForStringLiteralType
|
|
10980
11182
|
),
|
|
10981
|
-
description:
|
|
10982
|
-
// In the written order: the checker's (stable) order sorts literals by value.
|
|
10983
|
-
|
|
11183
|
+
description: Node17.isParameterDeclaration(input) ? docs.getJsDocParam(target.getMethodOrThrow("transform"), input.getName()) : docs.getJsDocDescription(input),
|
|
11184
|
+
// In the written order: the checker's (stable) order sorts literals by value. An array
|
|
11185
|
+
// of a union of literals gets the members of its item type, as in the legacy engine.
|
|
11186
|
+
options: playgroundArrayOptions(input, type) ?? writtenUnionOrder(input, type, canonicalMembers(type)).map(playgroundOption)
|
|
10984
11187
|
};
|
|
10985
11188
|
}
|
|
10986
11189
|
const controls = evaluated?.playgrounds?.[id]?.controls ?? (expression.getProperty("controls") ? literal(expression.getProperty("controls")) : {});
|
|
@@ -10997,6 +11200,7 @@ function guideSemantics(source, files, config, docs, values) {
|
|
|
10997
11200
|
delete properties[key];
|
|
10998
11201
|
}
|
|
10999
11202
|
const templateInputs = getPlaygroundTemplateInputs(properties);
|
|
11203
|
+
const isolated = evaluated ? evaluated.playgrounds?.[id]?.isolated === true : unwrap(expression.getProperty("isolated"))?.getText() === "true";
|
|
11000
11204
|
return {
|
|
11001
11205
|
id,
|
|
11002
11206
|
target: { source: target.getSourceFile().getFilePath(), exportName: target.getName() },
|
|
@@ -11010,7 +11214,8 @@ function guideSemantics(source, files, config, docs, values) {
|
|
|
11010
11214
|
])
|
|
11011
11215
|
),
|
|
11012
11216
|
properties,
|
|
11013
|
-
content
|
|
11217
|
+
content,
|
|
11218
|
+
...isolated ? { isolated: true } : {}
|
|
11014
11219
|
};
|
|
11015
11220
|
})
|
|
11016
11221
|
};
|
|
@@ -11019,24 +11224,24 @@ function guideSemantics(source, files, config, docs, values) {
|
|
|
11019
11224
|
// libs/builder/generator/semantic/api-enumeration.ts
|
|
11020
11225
|
init_core();
|
|
11021
11226
|
import { posix as posix2, relative as relative2 } from "node:path";
|
|
11022
|
-
import { Node as
|
|
11227
|
+
import { Node as Node21 } from "ts-morph";
|
|
11023
11228
|
|
|
11024
11229
|
// libs/builder/helpers/declaration-folder-name.ts
|
|
11025
|
-
import { Node as
|
|
11230
|
+
import { Node as Node18 } from "ts-morph";
|
|
11026
11231
|
function declarationFolderName(declaration) {
|
|
11027
|
-
if (
|
|
11232
|
+
if (Node18.isClassDeclaration(declaration)) {
|
|
11028
11233
|
return "classes";
|
|
11029
|
-
} else if (
|
|
11234
|
+
} else if (Node18.isInterfaceDeclaration(declaration)) {
|
|
11030
11235
|
return "interfaces";
|
|
11031
|
-
} else if (
|
|
11236
|
+
} else if (Node18.isEnumDeclaration(declaration)) {
|
|
11032
11237
|
return "enums";
|
|
11033
|
-
} else if (
|
|
11238
|
+
} else if (Node18.isFunctionDeclaration(declaration)) {
|
|
11034
11239
|
return "functions";
|
|
11035
|
-
} else if (
|
|
11240
|
+
} else if (Node18.isVariableDeclaration(declaration)) {
|
|
11036
11241
|
return "variables";
|
|
11037
|
-
} else if (
|
|
11242
|
+
} else if (Node18.isTypeAliasDeclaration(declaration)) {
|
|
11038
11243
|
return "type-aliases";
|
|
11039
|
-
} else if (
|
|
11244
|
+
} else if (Node18.isModuleDeclaration(declaration)) {
|
|
11040
11245
|
return "modules";
|
|
11041
11246
|
} else {
|
|
11042
11247
|
return "unknowns";
|
|
@@ -11045,7 +11250,7 @@ function declarationFolderName(declaration) {
|
|
|
11045
11250
|
|
|
11046
11251
|
// libs/builder/helpers/get-kind-type.ts
|
|
11047
11252
|
init_core();
|
|
11048
|
-
import { Node as
|
|
11253
|
+
import { Node as Node19 } from "ts-morph";
|
|
11049
11254
|
|
|
11050
11255
|
// libs/builder/helpers/get-declaration-type.ts
|
|
11051
11256
|
init_core();
|
|
@@ -11060,7 +11265,7 @@ function getDeclarationType(node) {
|
|
|
11060
11265
|
|
|
11061
11266
|
// libs/builder/helpers/get-kind-type.ts
|
|
11062
11267
|
function getKindType(node) {
|
|
11063
|
-
if (
|
|
11268
|
+
if (Node19.isClassDeclaration(node)) {
|
|
11064
11269
|
for (const decorator of NgDocAngularEntities) {
|
|
11065
11270
|
if (node.getDecorator(decorator)) {
|
|
11066
11271
|
return decorator;
|
|
@@ -11072,7 +11277,7 @@ function getKindType(node) {
|
|
|
11072
11277
|
|
|
11073
11278
|
// libs/builder/generator/semantic/api-summary.ts
|
|
11074
11279
|
import {
|
|
11075
|
-
Node as
|
|
11280
|
+
Node as Node20
|
|
11076
11281
|
} from "ts-morph";
|
|
11077
11282
|
var API_DESCRIPTION_LIMIT = 160;
|
|
11078
11283
|
var TYPE_LIMIT = 80;
|
|
@@ -11082,16 +11287,16 @@ function apiSummary(node, doc) {
|
|
|
11082
11287
|
}
|
|
11083
11288
|
function signature(node) {
|
|
11084
11289
|
const name = node.getName() ?? "default";
|
|
11085
|
-
if (
|
|
11086
|
-
if (
|
|
11290
|
+
if (Node20.isClassDeclaration(node)) return classSignature(node, name);
|
|
11291
|
+
if (Node20.isInterfaceDeclaration(node))
|
|
11087
11292
|
return `${words(modifiers(node), "interface", name + typeParameters(node), heritage(node))} { \u2026 }`;
|
|
11088
|
-
if (
|
|
11089
|
-
if (
|
|
11293
|
+
if (Node20.isEnumDeclaration(node)) return `${words(modifiers(node), "enum", name)} { \u2026 }`;
|
|
11294
|
+
if (Node20.isTypeAliasDeclaration(node)) {
|
|
11090
11295
|
const written = flat(node.getTypeNode()?.getText() ?? "");
|
|
11091
11296
|
const type2 = written && written.length <= TYPE_LIMIT ? written : "\u2026";
|
|
11092
11297
|
return words(modifiers(node), "type", name + typeParameters(node), "=", type2);
|
|
11093
11298
|
}
|
|
11094
|
-
if (
|
|
11299
|
+
if (Node20.isFunctionDeclaration(node)) return functionSignature(node, name);
|
|
11095
11300
|
const statement = node.getVariableStatement();
|
|
11096
11301
|
const type = node.getTypeNode();
|
|
11097
11302
|
return words(
|
|
@@ -11103,22 +11308,22 @@ function signature(node) {
|
|
|
11103
11308
|
var DECLARATION_LINE = 72;
|
|
11104
11309
|
function apiDeclaration(node) {
|
|
11105
11310
|
const name = node.getName() ?? "default";
|
|
11106
|
-
if (
|
|
11311
|
+
if (Node20.isEnumDeclaration(node)) return `${words(modifiers(node), "enum", name)} { \u2026 }`;
|
|
11107
11312
|
const head = words(
|
|
11108
11313
|
modifiers(node),
|
|
11109
|
-
|
|
11314
|
+
Node20.isClassDeclaration(node) ? "class" : "interface",
|
|
11110
11315
|
name + typeParameters(node)
|
|
11111
11316
|
);
|
|
11112
11317
|
const clauses = node.getHeritageClauses().map((clause) => flat(clause.getText()));
|
|
11113
11318
|
const line = words(head, clauses);
|
|
11114
11319
|
const header2 = line.length <= DECLARATION_LINE ? line : [head, ...clauses].join("\n ");
|
|
11115
|
-
const decorators =
|
|
11320
|
+
const decorators = Node20.isClassDeclaration(node) ? decoratorLines(node) : [];
|
|
11116
11321
|
return [...decorators, `${header2} { \u2026 }`].join("\n");
|
|
11117
11322
|
}
|
|
11118
11323
|
function decoratorLines(node) {
|
|
11119
11324
|
return node.getDecorators().map((decorator) => {
|
|
11120
11325
|
const [first, ...rest] = decorator.getArguments();
|
|
11121
|
-
const argument = !first ? "" :
|
|
11326
|
+
const argument = !first ? "" : Node20.isObjectLiteralExpression(first) && !rest.length ? "{ \u2026 }" : "\u2026";
|
|
11122
11327
|
return `@${decorator.getName()}${decorator.isDecoratorFactory() ? `(${argument})` : ""}`;
|
|
11123
11328
|
});
|
|
11124
11329
|
}
|
|
@@ -11143,34 +11348,34 @@ function parameter(node) {
|
|
|
11143
11348
|
return (node.isRestParameter() ? "..." : "") + node.getName() + (node.hasQuestionToken() || node.hasInitializer() ? "?" : "") + (type ? `: ${flat(type.getText())}` : "");
|
|
11144
11349
|
}
|
|
11145
11350
|
function modifiers(node) {
|
|
11146
|
-
return
|
|
11351
|
+
return Node20.isModifierable(node) ? node.getModifiers().filter((modifier) => !Node20.isDecorator(modifier)).map((modifier) => modifier.getText()) : [];
|
|
11147
11352
|
}
|
|
11148
11353
|
function typeParameters(node) {
|
|
11149
11354
|
const parameters = node.getTypeParameters().map((item) => flat(item.getText()));
|
|
11150
11355
|
return parameters.length ? `<${parameters.join(", ")}>` : "";
|
|
11151
11356
|
}
|
|
11152
11357
|
function heritage(node) {
|
|
11153
|
-
return
|
|
11358
|
+
return Node20.isHeritageClauseable(node) ? node.getHeritageClauses().map((clause) => flat(clause.getText())).join(" ") : "";
|
|
11154
11359
|
}
|
|
11155
11360
|
function words(...parts) {
|
|
11156
11361
|
return parts.flat().filter(Boolean).join(" ");
|
|
11157
11362
|
}
|
|
11158
|
-
function flat(
|
|
11159
|
-
return
|
|
11363
|
+
function flat(text2) {
|
|
11364
|
+
return text2.replace(/\s+/g, " ").trim();
|
|
11160
11365
|
}
|
|
11161
11366
|
function plainDescription(doc) {
|
|
11162
11367
|
const paragraph = (doc.getJsDocs().at(-1)?.getDescription() ?? "").trim().split(/\n\s*\n/)[0];
|
|
11163
|
-
const
|
|
11368
|
+
const text2 = flat(
|
|
11164
11369
|
paragraph.replace(
|
|
11165
11370
|
/\{@link(?:code|plain)?\s+([^\s}|]+)(?:\s*\|\s*|\s+)?([^}]*)\}/g,
|
|
11166
11371
|
(_, target, label) => String(label).trim() || String(target)
|
|
11167
11372
|
).replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/(\*\*|__)(.+?)\1/g, "$2").replace(/`/g, "")
|
|
11168
11373
|
);
|
|
11169
|
-
if (!
|
|
11170
|
-
if (
|
|
11171
|
-
const sentence = /^(.+?[.!?])(?=\s)/.exec(
|
|
11374
|
+
if (!text2) return void 0;
|
|
11375
|
+
if (text2.length <= API_DESCRIPTION_LIMIT) return text2;
|
|
11376
|
+
const sentence = /^(.+?[.!?])(?=\s)/.exec(text2)?.[1];
|
|
11172
11377
|
if (sentence && sentence.length <= API_DESCRIPTION_LIMIT) return sentence;
|
|
11173
|
-
return `${
|
|
11378
|
+
return `${text2.slice(0, API_DESCRIPTION_LIMIT - 1).replace(/\s+\S*$/, "")}\u2026`;
|
|
11174
11379
|
}
|
|
11175
11380
|
|
|
11176
11381
|
// libs/builder/generator/semantic/program-state.ts
|
|
@@ -11204,11 +11409,11 @@ var RetainedProgram = class {
|
|
|
11204
11409
|
|
|
11205
11410
|
// libs/builder/generator/semantic/api-enumeration.ts
|
|
11206
11411
|
function docNode(node) {
|
|
11207
|
-
const candidate =
|
|
11208
|
-
return candidate &&
|
|
11412
|
+
const candidate = Node21.isVariableDeclaration(node) ? node.getVariableStatement() : node;
|
|
11413
|
+
return candidate && Node21.isJSDocable(candidate) ? candidate : void 0;
|
|
11209
11414
|
}
|
|
11210
11415
|
function supported(node) {
|
|
11211
|
-
return
|
|
11416
|
+
return Node21.isClassDeclaration(node) || Node21.isInterfaceDeclaration(node) || Node21.isEnumDeclaration(node) || Node21.isFunctionDeclaration(node) || Node21.isVariableDeclaration(node) || Node21.isTypeAliasDeclaration(node);
|
|
11212
11417
|
}
|
|
11213
11418
|
function declarationIdentity(project, api, scope, workspace, source, name) {
|
|
11214
11419
|
return `declaration:${digest2(JSON.stringify([project, api, scope, relative2(workspace, source).replace(/\\/g, "/"), name]))}`;
|
|
@@ -11375,7 +11580,7 @@ init_minify();
|
|
|
11375
11580
|
import { resolve as resolve8 } from "node:path";
|
|
11376
11581
|
|
|
11377
11582
|
// libs/builder/generator/semantic/derived-classes.ts
|
|
11378
|
-
import { Node as
|
|
11583
|
+
import { Node as Node22, SyntaxKind as SyntaxKind3, ts as ts6 } from "ts-morph";
|
|
11379
11584
|
var DerivedClassIndex = class {
|
|
11380
11585
|
constructor(program) {
|
|
11381
11586
|
this.names = /* @__PURE__ */ new Set();
|
|
@@ -11431,12 +11636,12 @@ function immediateDerivedClasses(declaration) {
|
|
|
11431
11636
|
const nameNode = declaration.getNameNode();
|
|
11432
11637
|
if (nameNode == null) return classes;
|
|
11433
11638
|
for (let node of nameNode.findReferencesAsNodes()) {
|
|
11434
|
-
node = node.getParentWhileKind(
|
|
11435
|
-
const nodeParent = node.getParentIfKind(
|
|
11639
|
+
node = node.getParentWhileKind(SyntaxKind3.PropertyAccessExpression) ?? node;
|
|
11640
|
+
const nodeParent = node.getParentIfKind(SyntaxKind3.ExpressionWithTypeArguments);
|
|
11436
11641
|
if (nodeParent == null) continue;
|
|
11437
|
-
const heritageClause = nodeParent.getParentIfKind(
|
|
11438
|
-
if (heritageClause == null || heritageClause.getToken() !==
|
|
11439
|
-
const derivedClass = heritageClause.getParentIfKind(
|
|
11642
|
+
const heritageClause = nodeParent.getParentIfKind(SyntaxKind3.HeritageClause);
|
|
11643
|
+
if (heritageClause == null || heritageClause.getToken() !== SyntaxKind3.ExtendsKeyword) continue;
|
|
11644
|
+
const derivedClass = heritageClause.getParentIfKind(SyntaxKind3.ClassDeclaration);
|
|
11440
11645
|
if (derivedClass == null) continue;
|
|
11441
11646
|
classes.push(derivedClass);
|
|
11442
11647
|
}
|
|
@@ -11464,9 +11669,9 @@ function derivedClassList(project, identity) {
|
|
|
11464
11669
|
const start = Number(identity.slice(separator + 1));
|
|
11465
11670
|
const source = project.getSourceFile(identity.slice(0, separator));
|
|
11466
11671
|
let node = source?.getDescendantAtPos(start);
|
|
11467
|
-
while (node && !(
|
|
11672
|
+
while (node && !(Node22.isClassDeclaration(node) && node.getStart() === start))
|
|
11468
11673
|
node = node.getParent();
|
|
11469
|
-
if (!node || !
|
|
11674
|
+
if (!node || !Node22.isClassDeclaration(node)) return "absent";
|
|
11470
11675
|
return JSON.stringify(
|
|
11471
11676
|
getDerivedClasses(node, derivedClassIndex(project)).map((derived) => [
|
|
11472
11677
|
classIdentity(derived.compilerNode),
|
|
@@ -11475,7 +11680,7 @@ function derivedClassList(project, identity) {
|
|
|
11475
11680
|
);
|
|
11476
11681
|
}
|
|
11477
11682
|
function withIndexedDerivedClasses(declaration, project, render3) {
|
|
11478
|
-
if (!
|
|
11683
|
+
if (!Node22.isClassDeclaration(declaration) || Object.hasOwn(declaration, "getDerivedClasses"))
|
|
11479
11684
|
return render3();
|
|
11480
11685
|
Object.defineProperty(declaration, "getDerivedClasses", {
|
|
11481
11686
|
configurable: true,
|
|
@@ -11501,7 +11706,7 @@ import { Project as Project3, ts as ts9 } from "ts-morph";
|
|
|
11501
11706
|
// libs/builder/generator/semantic/owned-roots.ts
|
|
11502
11707
|
import { minimatch as minimatch2 } from "minimatch";
|
|
11503
11708
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
11504
|
-
import { realpathSync as
|
|
11709
|
+
import { realpathSync as realpathSync4 } from "node:fs";
|
|
11505
11710
|
import { basename, dirname as dirname3, isAbsolute as isAbsolute2, join as join2, parse as parse3, posix as posix3 } from "node:path";
|
|
11506
11711
|
import { Project as Project2 } from "ts-morph";
|
|
11507
11712
|
var OwnedRoots = class {
|
|
@@ -11528,10 +11733,10 @@ var OwnedRoots = class {
|
|
|
11528
11733
|
return this.has(real2) && !this.has(path18) ? path18 : real2;
|
|
11529
11734
|
}
|
|
11530
11735
|
/** Notes a raw text read of the program's file system (see {@link contentDigest}). */
|
|
11531
|
-
recordRead(file,
|
|
11736
|
+
recordRead(file, text2) {
|
|
11532
11737
|
const path18 = normalize2(file);
|
|
11533
|
-
if (
|
|
11534
|
-
this.marked.set(path18, { text:
|
|
11738
|
+
if (text2.charCodeAt(0) === 65279)
|
|
11739
|
+
this.marked.set(path18, { text: text2.slice(1), digest: contentDigest(text2) });
|
|
11535
11740
|
else this.marked.delete(path18);
|
|
11536
11741
|
}
|
|
11537
11742
|
/**
|
|
@@ -11540,9 +11745,9 @@ var OwnedRoots = class {
|
|
|
11540
11745
|
* file's bytes; so a file read with one is digested from its raw read, and the recorded digest
|
|
11541
11746
|
* matches theirs.
|
|
11542
11747
|
*/
|
|
11543
|
-
contentDigest(file,
|
|
11748
|
+
contentDigest(file, text2) {
|
|
11544
11749
|
const marked = this.marked.get(normalize2(file));
|
|
11545
|
-
return marked && marked.text ===
|
|
11750
|
+
return marked && marked.text === text2 ? marked.digest : contentDigest(text2);
|
|
11546
11751
|
}
|
|
11547
11752
|
/** A module resolution host view without owned paths; owned probes are neither made nor recorded. */
|
|
11548
11753
|
resolutionHost(host) {
|
|
@@ -11565,7 +11770,7 @@ function canonical2(path18) {
|
|
|
11565
11770
|
const missing = [];
|
|
11566
11771
|
for (let cursor = normalize2(path18); ; cursor = dirname3(cursor)) {
|
|
11567
11772
|
try {
|
|
11568
|
-
return normalize2(join2(
|
|
11773
|
+
return normalize2(join2(realpathSync4(cursor), ...missing));
|
|
11569
11774
|
} catch {
|
|
11570
11775
|
if (dirname3(cursor) === cursor) return normalize2(path18);
|
|
11571
11776
|
missing.unshift(basename(cursor));
|
|
@@ -11623,15 +11828,15 @@ var OwnedRootsFileSystem = class {
|
|
|
11623
11828
|
}
|
|
11624
11829
|
async readFile(filePath, encoding) {
|
|
11625
11830
|
if (this.owned.has(filePath)) throw fileNotFound(filePath);
|
|
11626
|
-
const
|
|
11627
|
-
this.owned.recordRead(filePath,
|
|
11628
|
-
return
|
|
11831
|
+
const text2 = await this.real.readFile(filePath, encoding);
|
|
11832
|
+
this.owned.recordRead(filePath, text2);
|
|
11833
|
+
return text2;
|
|
11629
11834
|
}
|
|
11630
11835
|
readFileSync(filePath, encoding) {
|
|
11631
11836
|
if (this.owned.has(filePath)) throw fileNotFound(filePath);
|
|
11632
|
-
const
|
|
11633
|
-
this.owned.recordRead(filePath,
|
|
11634
|
-
return
|
|
11837
|
+
const text2 = this.real.readFileSync(filePath, encoding);
|
|
11838
|
+
this.owned.recordRead(filePath, text2);
|
|
11839
|
+
return text2;
|
|
11635
11840
|
}
|
|
11636
11841
|
writeFile(filePath, fileText) {
|
|
11637
11842
|
return this.real.writeFile(filePath, fileText);
|
|
@@ -12756,12 +12961,12 @@ async function patchProgram(previous, assessment, discovery) {
|
|
|
12756
12961
|
reason: `${path18} cannot be read: ${error instanceof Error ? error.message : String(error)}`
|
|
12757
12962
|
};
|
|
12758
12963
|
}
|
|
12759
|
-
const
|
|
12760
|
-
const reason = patchable(path18, compiled.text, "before") ?? patchable(path18,
|
|
12964
|
+
const text2 = raw.text.charCodeAt(0) === 65279 ? raw.text.slice(1) : raw.text;
|
|
12965
|
+
const reason = patchable(path18, compiled.text, "before") ?? patchable(path18, text2, "after");
|
|
12761
12966
|
if (reason) return { kind: "refused", reason: `${path18}: ${reason}` };
|
|
12762
|
-
if (references(path18, compiled.text) !== references(path18,
|
|
12967
|
+
if (references(path18, compiled.text) !== references(path18, text2))
|
|
12763
12968
|
return discovery ? restructureProgram(previous, files, discovery) : { kind: "refused", reason: `${path18}: its imports, directives or pragmas changed` };
|
|
12764
|
-
plans.push({ path: path18, source, raw, text, before: comparable(importer) });
|
|
12969
|
+
plans.push({ path: path18, source, raw, text: text2, before: comparable(importer) });
|
|
12765
12970
|
}
|
|
12766
12971
|
for (const plan of plans) mirror.appliedSinceBase.set(plan.path, plan.raw.digest);
|
|
12767
12972
|
mirror.version += 1;
|
|
@@ -12852,10 +13057,10 @@ async function restructureProgram(previous, edited, discovery) {
|
|
|
12852
13057
|
reason: `${path18} cannot be read: ${error instanceof Error ? error.message : String(error)}`
|
|
12853
13058
|
};
|
|
12854
13059
|
}
|
|
12855
|
-
const
|
|
12856
|
-
const reason = patchable(path18, source.compilerNode.text, "before") ?? patchable(path18,
|
|
13060
|
+
const text2 = raw.text.charCodeAt(0) === 65279 ? raw.text.slice(1) : raw.text;
|
|
13061
|
+
const reason = patchable(path18, source.compilerNode.text, "before") ?? patchable(path18, text2, "after");
|
|
12857
13062
|
if (reason) return { kind: "refused", reason: `${path18}: ${reason}` };
|
|
12858
|
-
plans.push({ path: path18, source, raw, text, before: comparable(importer) });
|
|
13063
|
+
plans.push({ path: path18, source, raw, text: text2, before: comparable(importer) });
|
|
12859
13064
|
}
|
|
12860
13065
|
for (const path18 of deleted) {
|
|
12861
13066
|
const source = project.getSourceFile(path18);
|
|
@@ -12863,16 +13068,16 @@ async function restructureProgram(previous, edited, discovery) {
|
|
|
12863
13068
|
if (reason) return { kind: "refused", reason: `deleted ${path18}: ${reason}` };
|
|
12864
13069
|
}
|
|
12865
13070
|
for (const path18 of added) {
|
|
12866
|
-
let
|
|
13071
|
+
let text2;
|
|
12867
13072
|
try {
|
|
12868
|
-
|
|
13073
|
+
text2 = readText(path18).text;
|
|
12869
13074
|
} catch (error) {
|
|
12870
13075
|
return {
|
|
12871
13076
|
kind: "refused",
|
|
12872
13077
|
reason: `${path18} cannot be read: ${error instanceof Error ? error.message : String(error)}`
|
|
12873
13078
|
};
|
|
12874
13079
|
}
|
|
12875
|
-
const reason = patchable(path18,
|
|
13080
|
+
const reason = patchable(path18, text2.charCodeAt(0) === 65279 ? text2.slice(1) : text2, "after");
|
|
12876
13081
|
if (reason) return { kind: "refused", reason: `new ${path18}: ${reason}` };
|
|
12877
13082
|
}
|
|
12878
13083
|
for (const plan of plans) mirror.appliedSinceBase.set(plan.path, plan.raw.digest);
|
|
@@ -12992,11 +13197,11 @@ function sourceFactory(project) {
|
|
|
12992
13197
|
const factory = project._context?.compilerFactory;
|
|
12993
13198
|
return typeof factory?.createCompilerSourceFileFromText === "function" && typeof factory.replaceCompilerNode === "function" ? factory : void 0;
|
|
12994
13199
|
}
|
|
12995
|
-
function replaceSource(factory, source,
|
|
13200
|
+
function replaceSource(factory, source, text2) {
|
|
12996
13201
|
source.forgetDescendants();
|
|
12997
13202
|
factory.replaceCompilerNode(
|
|
12998
13203
|
source,
|
|
12999
|
-
factory.createCompilerSourceFileFromText(source.getFilePath(),
|
|
13204
|
+
factory.createCompilerSourceFileFromText(source.getFilePath(), text2)
|
|
13000
13205
|
);
|
|
13001
13206
|
}
|
|
13002
13207
|
function withPinnedRoots(program, roots, action, hostFor = (host) => host) {
|
|
@@ -13014,11 +13219,11 @@ function withPinnedRoots(program, roots, action, hostFor = (host) => host) {
|
|
|
13014
13219
|
}
|
|
13015
13220
|
var TYPESCRIPT_SOURCE = /\.(?:[cm]?ts|tsx)$/;
|
|
13016
13221
|
var DECLARATION = /\.d\.(?:[^/]*\.)?[cm]?ts$/;
|
|
13017
|
-
function patchable(path18,
|
|
13222
|
+
function patchable(path18, text2, when) {
|
|
13018
13223
|
if (!TYPESCRIPT_SOURCE.test(path18) || DECLARATION.test(path18))
|
|
13019
13224
|
return "not a TypeScript source file";
|
|
13020
13225
|
if (path18.includes("/node_modules/")) return "a library file";
|
|
13021
|
-
const source = ts12.createSourceFile(path18,
|
|
13226
|
+
const source = ts12.createSourceFile(path18, text2, ts12.ScriptTarget.Latest, false);
|
|
13022
13227
|
if (!ts12.isExternalModule(source)) return `a script ${when} the edit`;
|
|
13023
13228
|
for (const statement of source.statements) {
|
|
13024
13229
|
if (ts12.isModuleDeclaration(statement) && (ts12.isStringLiteral(statement.name) || (statement.flags & ts12.NodeFlags.GlobalAugmentation) !== 0))
|
|
@@ -13027,9 +13232,9 @@ function patchable(path18, text, when) {
|
|
|
13027
13232
|
}
|
|
13028
13233
|
return void 0;
|
|
13029
13234
|
}
|
|
13030
|
-
function references(path18,
|
|
13031
|
-
const info = ts12.preProcessFile(
|
|
13032
|
-
const pragmas = ts12.createSourceFile(path18,
|
|
13235
|
+
function references(path18, text2) {
|
|
13236
|
+
const info = ts12.preProcessFile(text2, true, true);
|
|
13237
|
+
const pragmas = ts12.createSourceFile(path18, text2, ts12.ScriptTarget.Latest, false).pragmas;
|
|
13033
13238
|
const argumentsOf = (value) => Array.isArray(value) ? value.map(argumentsOf) : value?.arguments ?? null;
|
|
13034
13239
|
return JSON.stringify([
|
|
13035
13240
|
[...pragmas ?? /* @__PURE__ */ new Map()].map(([name, value]) => [name, argumentsOf(value)]),
|
|
@@ -13066,7 +13271,7 @@ import {
|
|
|
13066
13271
|
import { Marked as Marked2 } from "marked";
|
|
13067
13272
|
import { dirname as dirname8, resolve as resolve7 } from "node:path";
|
|
13068
13273
|
import nunjucks2, { Environment as Environment2, Loader as Loader2 } from "nunjucks";
|
|
13069
|
-
import { Node as
|
|
13274
|
+
import { Node as Node42 } from "ts-morph";
|
|
13070
13275
|
|
|
13071
13276
|
// libs/builder/helpers/filter-useless-members.ts
|
|
13072
13277
|
var EXCLUDING_RULES = [/^ɵ/];
|
|
@@ -13095,7 +13300,7 @@ __export(presentation_exports, {
|
|
|
13095
13300
|
});
|
|
13096
13301
|
init_core();
|
|
13097
13302
|
import {
|
|
13098
|
-
Node as
|
|
13303
|
+
Node as Node23,
|
|
13099
13304
|
Scope
|
|
13100
13305
|
} from "ts-morph";
|
|
13101
13306
|
function constructorPresentation(constructor, configDirectory) {
|
|
@@ -13111,9 +13316,9 @@ function constructorPresentation(constructor, configDirectory) {
|
|
|
13111
13316
|
}
|
|
13112
13317
|
function accessorPresentation(accessor, configDirectory) {
|
|
13113
13318
|
const parameters = accessor.getParameters().map(parameterPresentation).join(", ");
|
|
13114
|
-
const prefix =
|
|
13115
|
-
const header2 =
|
|
13116
|
-
const returnType =
|
|
13319
|
+
const prefix = Node23.isGetAccessorDeclaration(accessor) ? "get" : "set";
|
|
13320
|
+
const header2 = Node23.isGetAccessorDeclaration(accessor) ? `${accessor.getName()}():` : `${accessor.getName()}(${parameters})`;
|
|
13321
|
+
const returnType = Node23.isGetAccessorDeclaration(accessor) ? displayReturnType(accessor) : "";
|
|
13117
13322
|
const presentation = [staticPresentation(accessor), scopePresentation(accessor), prefix, header2, returnType].filter(isPresent).join(" ") + ";";
|
|
13118
13323
|
return formatCode(presentation, "TypeScript", configDirectory);
|
|
13119
13324
|
}
|
|
@@ -13172,12 +13377,12 @@ function scopePresentation(node) {
|
|
|
13172
13377
|
return (node.getScope && node.getScope()?.replace(Scope.Public, "")) ?? "";
|
|
13173
13378
|
}
|
|
13174
13379
|
function staticPresentation(node) {
|
|
13175
|
-
return
|
|
13380
|
+
return Node23.isStaticable(node) && node.isStatic() ? "static" : "";
|
|
13176
13381
|
}
|
|
13177
13382
|
function memberModifiers(member) {
|
|
13178
13383
|
return [
|
|
13179
|
-
|
|
13180
|
-
|
|
13384
|
+
Node23.isAbstractable(member) && member.isAbstract() && "abstract" || "",
|
|
13385
|
+
Node23.isAsyncable(member) && member.isAsync() && "async" || ""
|
|
13181
13386
|
].filter(isPresent).join(" ");
|
|
13182
13387
|
}
|
|
13183
13388
|
function modPresentation(node) {
|
|
@@ -13201,7 +13406,7 @@ __export(accessor_exports, {
|
|
|
13201
13406
|
|
|
13202
13407
|
// libs/builder/helpers/typescript/accessor/get-accessor-chain.ts
|
|
13203
13408
|
import {
|
|
13204
|
-
Node as
|
|
13409
|
+
Node as Node27
|
|
13205
13410
|
} from "ts-morph";
|
|
13206
13411
|
|
|
13207
13412
|
// libs/builder/helpers/typescript/class/find-base-class.ts
|
|
@@ -13231,12 +13436,12 @@ function findClass(cls, condition) {
|
|
|
13231
13436
|
}
|
|
13232
13437
|
|
|
13233
13438
|
// libs/builder/helpers/typescript/interface/for-all-interfaces.ts
|
|
13234
|
-
import { Node as
|
|
13439
|
+
import { Node as Node24 } from "ts-morph";
|
|
13235
13440
|
function forAllInterfaces(int, fn) {
|
|
13236
13441
|
const baseInterface = int;
|
|
13237
13442
|
if (!fn(baseInterface)) {
|
|
13238
13443
|
baseInterface.getExtends().map((expr) => expr.getType().getSymbol()?.getDeclarations()[0]).reverse().forEach(
|
|
13239
|
-
(node) =>
|
|
13444
|
+
(node) => Node24.isInterfaceDeclaration(node) && forAllInterfaces(node, fn)
|
|
13240
13445
|
);
|
|
13241
13446
|
}
|
|
13242
13447
|
}
|
|
@@ -13244,17 +13449,17 @@ function forAllInterfaces(int, fn) {
|
|
|
13244
13449
|
// libs/builder/helpers/typescript/accessor/get-interface-accessors.ts
|
|
13245
13450
|
init_core();
|
|
13246
13451
|
import {
|
|
13247
|
-
Node as
|
|
13452
|
+
Node as Node26
|
|
13248
13453
|
} from "ts-morph";
|
|
13249
13454
|
|
|
13250
13455
|
// libs/builder/helpers/typescript/interface/find-interface.ts
|
|
13251
|
-
import { Node as
|
|
13456
|
+
import { Node as Node25 } from "ts-morph";
|
|
13252
13457
|
function findInterface(int, fn) {
|
|
13253
13458
|
const baseInterface = int;
|
|
13254
13459
|
if (fn(baseInterface)) {
|
|
13255
13460
|
return baseInterface;
|
|
13256
13461
|
}
|
|
13257
|
-
const ext = baseInterface.getExtends().map((expr) => expr.getType().getSymbol()?.getDeclarations()[0]).filter((node) =>
|
|
13462
|
+
const ext = baseInterface.getExtends().map((expr) => expr.getType().getSymbol()?.getDeclarations()[0]).filter((node) => Node25.isInterfaceDeclaration(node)).reverse();
|
|
13258
13463
|
for (const i of ext) {
|
|
13259
13464
|
const deepResult = findInterface(i, fn);
|
|
13260
13465
|
if (deepResult) {
|
|
@@ -13268,8 +13473,8 @@ function findInterface(int, fn) {
|
|
|
13268
13473
|
function getInterfaceAccessors(int) {
|
|
13269
13474
|
const accessors = /* @__PURE__ */ new Map();
|
|
13270
13475
|
forAllInterfaces(int, (i) => {
|
|
13271
|
-
const getters = i.getMembers().filter(
|
|
13272
|
-
const setters = i.getMembers().filter(
|
|
13476
|
+
const getters = i.getMembers().filter(Node26.isGetAccessorDeclaration);
|
|
13477
|
+
const setters = i.getMembers().filter(Node26.isSetAccessorDeclaration);
|
|
13273
13478
|
getters.forEach((getter) => {
|
|
13274
13479
|
const name = getter.getName();
|
|
13275
13480
|
if (!accessors.get(`get${name}`)) {
|
|
@@ -13291,15 +13496,15 @@ function getAccessorChain(accessor) {
|
|
|
13291
13496
|
const parent = accessor.getParent();
|
|
13292
13497
|
const accessors = [];
|
|
13293
13498
|
const name = accessor.getName();
|
|
13294
|
-
if (
|
|
13499
|
+
if (Node27.isClassDeclaration(parent)) {
|
|
13295
13500
|
forAllClasses(parent, (cls) => {
|
|
13296
|
-
if (
|
|
13501
|
+
if (Node27.isGetAccessorDeclaration(accessor)) {
|
|
13297
13502
|
const getter = cls.getGetAccessor(name);
|
|
13298
13503
|
if (getter) {
|
|
13299
13504
|
accessors.push(getter);
|
|
13300
13505
|
}
|
|
13301
13506
|
}
|
|
13302
|
-
if (
|
|
13507
|
+
if (Node27.isSetAccessorDeclaration(accessor)) {
|
|
13303
13508
|
const setter = cls.getSetAccessor(name);
|
|
13304
13509
|
if (setter) {
|
|
13305
13510
|
accessors.push(setter);
|
|
@@ -13307,13 +13512,13 @@ function getAccessorChain(accessor) {
|
|
|
13307
13512
|
}
|
|
13308
13513
|
});
|
|
13309
13514
|
}
|
|
13310
|
-
if (
|
|
13515
|
+
if (Node27.isInterfaceDeclaration(parent)) {
|
|
13311
13516
|
forAllInterfaces(parent, (int) => {
|
|
13312
13517
|
getInterfaceAccessors(int).filter((acc) => acc.getName() === name).forEach((acc) => {
|
|
13313
|
-
if (
|
|
13518
|
+
if (Node27.isGetAccessorDeclaration(accessor) && Node27.isGetAccessorDeclaration(acc)) {
|
|
13314
13519
|
accessors.push(acc);
|
|
13315
13520
|
}
|
|
13316
|
-
if (
|
|
13521
|
+
if (Node27.isSetAccessorDeclaration(accessor) && Node27.isSetAccessorDeclaration(acc)) {
|
|
13317
13522
|
accessors.push(acc);
|
|
13318
13523
|
}
|
|
13319
13524
|
});
|
|
@@ -13345,14 +13550,14 @@ function getClassAccessors(cls) {
|
|
|
13345
13550
|
|
|
13346
13551
|
// libs/builder/helpers/typescript/accessor/group-accessors.ts
|
|
13347
13552
|
init_core();
|
|
13348
|
-
import { Node as
|
|
13553
|
+
import { Node as Node28 } from "ts-morph";
|
|
13349
13554
|
function groupAccessors(accessors) {
|
|
13350
13555
|
const map = /* @__PURE__ */ new Map();
|
|
13351
13556
|
accessors.forEach((accessor) => {
|
|
13352
|
-
if (
|
|
13557
|
+
if (Node28.isGetAccessorDeclaration(accessor)) {
|
|
13353
13558
|
map.set(accessor.getName(), { ...map.get(accessor.getName()), get: accessor });
|
|
13354
13559
|
}
|
|
13355
|
-
if (
|
|
13560
|
+
if (Node28.isSetAccessorDeclaration(accessor)) {
|
|
13356
13561
|
map.set(accessor.getName(), { ...map.get(accessor.getName()), set: accessor });
|
|
13357
13562
|
}
|
|
13358
13563
|
});
|
|
@@ -13367,7 +13572,7 @@ __export(call_signature_exports, {
|
|
|
13367
13572
|
});
|
|
13368
13573
|
|
|
13369
13574
|
// libs/builder/helpers/typescript/call-signature/get-call-signature-chain.ts
|
|
13370
|
-
import { Node as
|
|
13575
|
+
import { Node as Node29 } from "ts-morph";
|
|
13371
13576
|
|
|
13372
13577
|
// libs/builder/helpers/typescript/call-signature/get-call-signature-name.ts
|
|
13373
13578
|
function getCallSignatureName(callSignature) {
|
|
@@ -13379,7 +13584,7 @@ function getCallSignatureChain(callSignature) {
|
|
|
13379
13584
|
const parent = callSignature.getParent();
|
|
13380
13585
|
const callSignatures = [];
|
|
13381
13586
|
const name = getCallSignatureName(callSignature);
|
|
13382
|
-
if (
|
|
13587
|
+
if (Node29.isInterfaceDeclaration(parent)) {
|
|
13383
13588
|
forAllInterfaces(parent, (int) => {
|
|
13384
13589
|
const callSignature2 = int.getCallSignature(
|
|
13385
13590
|
(cs) => getCallSignatureName(cs) === name
|
|
@@ -13419,15 +13624,15 @@ function filterByStatic(nodes, isStatic) {
|
|
|
13419
13624
|
}
|
|
13420
13625
|
|
|
13421
13626
|
// libs/builder/helpers/typescript/first-node-with-comment.ts
|
|
13422
|
-
import { Node as
|
|
13627
|
+
import { Node as Node30 } from "ts-morph";
|
|
13423
13628
|
function firstNodeWithComment(nodes) {
|
|
13424
|
-
return nodes.find((n) =>
|
|
13629
|
+
return nodes.find((n) => Node30.isJSDocable(n) && n.getJsDocs().length) ?? nodes[0];
|
|
13425
13630
|
}
|
|
13426
13631
|
|
|
13427
13632
|
// libs/builder/helpers/typescript/is-named.ts
|
|
13428
|
-
import { Node as
|
|
13633
|
+
import { Node as Node31 } from "ts-morph";
|
|
13429
13634
|
function isNamed(node) {
|
|
13430
|
-
return
|
|
13635
|
+
return Node31.isNamed(node);
|
|
13431
13636
|
}
|
|
13432
13637
|
|
|
13433
13638
|
// libs/builder/helpers/typescript/member/index.ts
|
|
@@ -13442,35 +13647,35 @@ __export(member_exports, {
|
|
|
13442
13647
|
});
|
|
13443
13648
|
|
|
13444
13649
|
// libs/builder/helpers/typescript/member/find-member.ts
|
|
13445
|
-
import { Node as
|
|
13650
|
+
import { Node as Node34 } from "ts-morph";
|
|
13446
13651
|
|
|
13447
13652
|
// libs/builder/helpers/typescript/interface/get-interface-member.ts
|
|
13448
|
-
import { Node as
|
|
13653
|
+
import { Node as Node32 } from "ts-morph";
|
|
13449
13654
|
function getInterfaceMember(int, name) {
|
|
13450
13655
|
return int.getMembers().filter(
|
|
13451
|
-
(m) => !
|
|
13656
|
+
(m) => !Node32.isConstructSignatureDeclaration(m) && !Node32.isCallSignatureDeclaration(m) && !Node32.isIndexSignatureDeclaration(m)
|
|
13452
13657
|
).find((m) => m.getName() === name);
|
|
13453
13658
|
}
|
|
13454
13659
|
|
|
13455
13660
|
// libs/builder/helpers/typescript/member/member-type.ts
|
|
13456
13661
|
import {
|
|
13457
|
-
Node as
|
|
13662
|
+
Node as Node33
|
|
13458
13663
|
} from "ts-morph";
|
|
13459
13664
|
function isClassMember(member) {
|
|
13460
|
-
return
|
|
13665
|
+
return Node33.isMethodDeclaration(member) || Node33.isPropertyDeclaration(member) || Node33.isGetAccessorDeclaration(member) || Node33.isSetAccessorDeclaration(member);
|
|
13461
13666
|
}
|
|
13462
13667
|
|
|
13463
13668
|
// libs/builder/helpers/typescript/member/find-member.ts
|
|
13464
13669
|
function findMember(node, name) {
|
|
13465
|
-
if (
|
|
13670
|
+
if (Node34.isClassDeclaration(node)) {
|
|
13466
13671
|
const member = findClass(
|
|
13467
13672
|
node,
|
|
13468
13673
|
(cls) => !!cls.getInstanceMember(name)
|
|
13469
13674
|
)?.getInstanceMember(name);
|
|
13470
13675
|
return member && isClassMember(member) ? member : void 0;
|
|
13471
13676
|
}
|
|
13472
|
-
if (
|
|
13473
|
-
if (
|
|
13677
|
+
if (Node34.isInterfaceDeclaration(node)) {
|
|
13678
|
+
if (Node34.isInterfaceDeclaration(node)) {
|
|
13474
13679
|
const baseInterface = findInterface(
|
|
13475
13680
|
node,
|
|
13476
13681
|
(int) => !!getInterfaceMember(int, name)
|
|
@@ -13483,36 +13688,36 @@ function findMember(node, name) {
|
|
|
13483
13688
|
|
|
13484
13689
|
// libs/builder/helpers/typescript/member/get-implemented-member.ts
|
|
13485
13690
|
init_core();
|
|
13486
|
-
import { Node as
|
|
13691
|
+
import { Node as Node36 } from "ts-morph";
|
|
13487
13692
|
|
|
13488
13693
|
// libs/builder/helpers/typescript/member/get-member-parent.ts
|
|
13489
|
-
import { Node as
|
|
13694
|
+
import { Node as Node35 } from "ts-morph";
|
|
13490
13695
|
function getMemberParent(member) {
|
|
13491
13696
|
const parent = member.getParent();
|
|
13492
|
-
return
|
|
13697
|
+
return Node35.isConstructorDeclaration(parent) ? parent.getParent() : parent;
|
|
13493
13698
|
}
|
|
13494
13699
|
|
|
13495
13700
|
// libs/builder/helpers/typescript/member/get-implemented-member.ts
|
|
13496
13701
|
function getImplementedMember(member) {
|
|
13497
13702
|
const parent = getMemberParent(member);
|
|
13498
13703
|
const name = member.getName();
|
|
13499
|
-
if (
|
|
13704
|
+
if (Node36.isClassDeclaration(parent)) {
|
|
13500
13705
|
const baseClass = parent.getBaseClass();
|
|
13501
13706
|
if (baseClass) {
|
|
13502
13707
|
const member2 = findMember(baseClass, name);
|
|
13503
|
-
if (
|
|
13708
|
+
if (Node36.isAbstractable(member2) && member2.isAbstract()) {
|
|
13504
13709
|
return member2;
|
|
13505
13710
|
}
|
|
13506
13711
|
}
|
|
13507
13712
|
const nodes = parent.getImplements().map((expr) => expr.getType().getSymbol()?.getDeclarations()[0]).filter(isPresent).reverse();
|
|
13508
13713
|
for (const node of nodes) {
|
|
13509
|
-
if (
|
|
13714
|
+
if (Node36.isClassDeclaration(node)) {
|
|
13510
13715
|
const member2 = findMember(node, name);
|
|
13511
|
-
if (
|
|
13716
|
+
if (Node36.isAbstractable(member2) && member2.isAbstract()) {
|
|
13512
13717
|
return member2;
|
|
13513
13718
|
}
|
|
13514
13719
|
}
|
|
13515
|
-
if (
|
|
13720
|
+
if (Node36.isInterfaceDeclaration(node)) {
|
|
13516
13721
|
const member2 = findMember(node, name);
|
|
13517
13722
|
if (member2) {
|
|
13518
13723
|
return member2;
|
|
@@ -13524,32 +13729,32 @@ function getImplementedMember(member) {
|
|
|
13524
13729
|
}
|
|
13525
13730
|
|
|
13526
13731
|
// libs/builder/helpers/typescript/member/get-inherited-parent.ts
|
|
13527
|
-
import { Node as
|
|
13732
|
+
import { Node as Node37 } from "ts-morph";
|
|
13528
13733
|
function getInheritedParent(member, currentNode) {
|
|
13529
13734
|
const memberParent = getMemberParent(member);
|
|
13530
|
-
if (
|
|
13735
|
+
if (Node37.isConstructorDeclaration(currentNode)) {
|
|
13531
13736
|
currentNode = currentNode.getParent();
|
|
13532
13737
|
}
|
|
13533
13738
|
return memberParent === currentNode ? void 0 : memberParent;
|
|
13534
13739
|
}
|
|
13535
13740
|
|
|
13536
13741
|
// libs/builder/helpers/typescript/member/get-overridden-member.ts
|
|
13537
|
-
import { Node as
|
|
13742
|
+
import { Node as Node38 } from "ts-morph";
|
|
13538
13743
|
function getOverriddenMember(member) {
|
|
13539
13744
|
const parent = getMemberParent(member);
|
|
13540
13745
|
const name = member.getName();
|
|
13541
|
-
if (
|
|
13746
|
+
if (Node38.isClassDeclaration(parent)) {
|
|
13542
13747
|
const baseClass = findBaseClass(
|
|
13543
13748
|
parent,
|
|
13544
13749
|
(cls) => {
|
|
13545
13750
|
const member2 = findMember(cls, name);
|
|
13546
|
-
const isAbstract =
|
|
13751
|
+
const isAbstract = Node38.isAbstractable(member2) && member2.isAbstract();
|
|
13547
13752
|
return !!member2 && !isAbstract;
|
|
13548
13753
|
}
|
|
13549
13754
|
);
|
|
13550
13755
|
return baseClass && findMember(baseClass, name);
|
|
13551
13756
|
}
|
|
13552
|
-
if (
|
|
13757
|
+
if (Node38.isInterfaceDeclaration(parent)) {
|
|
13553
13758
|
const baseInterface = findInterface(
|
|
13554
13759
|
parent,
|
|
13555
13760
|
(int) => int !== parent && !!findMember(int, name)
|
|
@@ -13599,12 +13804,12 @@ function getInterfaceMethods(int) {
|
|
|
13599
13804
|
|
|
13600
13805
|
// libs/builder/helpers/typescript/method/get-method-chain.ts
|
|
13601
13806
|
import {
|
|
13602
|
-
Node as
|
|
13807
|
+
Node as Node39
|
|
13603
13808
|
} from "ts-morph";
|
|
13604
13809
|
function getMethodChain(method) {
|
|
13605
13810
|
const parent = method.getParent();
|
|
13606
13811
|
const methods = [];
|
|
13607
|
-
if (
|
|
13812
|
+
if (Node39.isClassDeclaration(parent)) {
|
|
13608
13813
|
forAllClasses(parent, (cls) => {
|
|
13609
13814
|
const mtd = cls.getMethod(method.getName());
|
|
13610
13815
|
if (mtd) {
|
|
@@ -13612,7 +13817,7 @@ function getMethodChain(method) {
|
|
|
13612
13817
|
}
|
|
13613
13818
|
});
|
|
13614
13819
|
}
|
|
13615
|
-
if (
|
|
13820
|
+
if (Node39.isInterfaceDeclaration(parent)) {
|
|
13616
13821
|
forAllInterfaces(parent, (int) => {
|
|
13617
13822
|
const mtd = int.getMethod(method.getName());
|
|
13618
13823
|
if (mtd) {
|
|
@@ -13655,14 +13860,14 @@ function getClassProperties(cls) {
|
|
|
13655
13860
|
}
|
|
13656
13861
|
|
|
13657
13862
|
// libs/builder/helpers/typescript/property/get-defined-in-parent.ts
|
|
13658
|
-
import { SyntaxKind as
|
|
13863
|
+
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
13659
13864
|
function getDefinedInParent(property, currentNode) {
|
|
13660
13865
|
const propertyParent = property.getParent();
|
|
13661
13866
|
const excludeCurrentNode = (node) => node === currentNode ? void 0 : node;
|
|
13662
|
-
if (propertyParent?.isKind(
|
|
13867
|
+
if (propertyParent?.isKind(SyntaxKind4.TypeLiteral)) {
|
|
13663
13868
|
return excludeCurrentNode(getDefinedInParent(propertyParent, currentNode) ?? propertyParent);
|
|
13664
13869
|
}
|
|
13665
|
-
if (propertyParent?.isKind(
|
|
13870
|
+
if (propertyParent?.isKind(SyntaxKind4.IntersectionType)) {
|
|
13666
13871
|
return excludeCurrentNode(getDefinedInParent(propertyParent, currentNode) ?? propertyParent);
|
|
13667
13872
|
}
|
|
13668
13873
|
return excludeCurrentNode(propertyParent);
|
|
@@ -13685,20 +13890,20 @@ function getInterfaceProperties(int) {
|
|
|
13685
13890
|
|
|
13686
13891
|
// libs/builder/helpers/typescript/property/get-property-chain.ts
|
|
13687
13892
|
import {
|
|
13688
|
-
Node as
|
|
13893
|
+
Node as Node41
|
|
13689
13894
|
} from "ts-morph";
|
|
13690
13895
|
function getPropertyChain(property) {
|
|
13691
13896
|
const parent = property.getParent();
|
|
13692
13897
|
const name = property.getName();
|
|
13693
13898
|
const properties = [];
|
|
13694
|
-
if (
|
|
13899
|
+
if (Node41.isClassDeclaration(parent)) {
|
|
13695
13900
|
forAllClasses(parent, (cls) => {
|
|
13696
13901
|
const prop = cls.getProperty(name);
|
|
13697
13902
|
if (prop) {
|
|
13698
13903
|
properties.push(prop);
|
|
13699
13904
|
}
|
|
13700
13905
|
});
|
|
13701
|
-
} else if (
|
|
13906
|
+
} else if (Node41.isInterfaceDeclaration(parent)) {
|
|
13702
13907
|
forAllInterfaces(parent, (int) => {
|
|
13703
13908
|
const prop = int.getProperty(name);
|
|
13704
13909
|
if (prop) {
|
|
@@ -13713,31 +13918,31 @@ function getPropertyChain(property) {
|
|
|
13713
13918
|
|
|
13714
13919
|
// libs/builder/helpers/typescript/property/get-type-alias-properties.ts
|
|
13715
13920
|
init_core();
|
|
13716
|
-
import { SyntaxKind as
|
|
13921
|
+
import { SyntaxKind as SyntaxKind5 } from "ts-morph";
|
|
13717
13922
|
function getTypeAliasProperties(ta) {
|
|
13718
13923
|
const properties = /* @__PURE__ */ new Map();
|
|
13719
13924
|
const signatures = [];
|
|
13720
13925
|
const getProperties = (typeNode2) => {
|
|
13721
|
-
if (typeNode2.isKind(
|
|
13926
|
+
if (typeNode2.isKind(SyntaxKind5.TypeLiteral)) {
|
|
13722
13927
|
const members2 = typeNode2.getMembers();
|
|
13723
13928
|
members2.forEach((member) => {
|
|
13724
|
-
if (member.isKind(
|
|
13929
|
+
if (member.isKind(SyntaxKind5.PropertySignature)) {
|
|
13725
13930
|
signatures.push(member);
|
|
13726
13931
|
}
|
|
13727
13932
|
});
|
|
13728
|
-
} else if (typeNode2?.isKind(
|
|
13933
|
+
} else if (typeNode2?.isKind(SyntaxKind5.IntersectionType)) {
|
|
13729
13934
|
const types = typeNode2.getTypeNodes();
|
|
13730
13935
|
types.forEach((typ) => {
|
|
13731
13936
|
getProperties(typ);
|
|
13732
13937
|
});
|
|
13733
|
-
} else if (typeNode2.isKind(
|
|
13938
|
+
} else if (typeNode2.isKind(SyntaxKind5.TypeReference)) {
|
|
13734
13939
|
const symbol = typeNode2.getTypeName().getSymbol();
|
|
13735
13940
|
if (symbol) {
|
|
13736
13941
|
const declarations = symbol.getDeclarations();
|
|
13737
13942
|
declarations.forEach((decl) => {
|
|
13738
|
-
if (decl.isKind(
|
|
13943
|
+
if (decl.isKind(SyntaxKind5.TypeLiteral)) {
|
|
13739
13944
|
getProperties(decl);
|
|
13740
|
-
} else if (decl.isKind(
|
|
13945
|
+
} else if (decl.isKind(SyntaxKind5.TypeAliasDeclaration)) {
|
|
13741
13946
|
const typeNode3 = decl.getTypeNode();
|
|
13742
13947
|
if (typeNode3) {
|
|
13743
13948
|
getProperties(typeNode3);
|
|
@@ -13759,7 +13964,7 @@ function getTypeAliasProperties(ta) {
|
|
|
13759
13964
|
}
|
|
13760
13965
|
|
|
13761
13966
|
// libs/builder/generator/semantic/rendering.ts
|
|
13762
|
-
var renderMarkdown = (
|
|
13967
|
+
var renderMarkdown = (text2, context) => {
|
|
13763
13968
|
const renderer = new Marked2({
|
|
13764
13969
|
renderer: {
|
|
13765
13970
|
code(code, language) {
|
|
@@ -13787,7 +13992,7 @@ var renderMarkdown = (text, context) => {
|
|
|
13787
13992
|
}
|
|
13788
13993
|
}
|
|
13789
13994
|
});
|
|
13790
|
-
return renderer.parse(
|
|
13995
|
+
return renderer.parse(text2, { async: false });
|
|
13791
13996
|
};
|
|
13792
13997
|
function createJsDoc(markdown) {
|
|
13793
13998
|
const renderNodes = (nodes) => {
|
|
@@ -13856,9 +14061,9 @@ function createJsDoc(markdown) {
|
|
|
13856
14061
|
}
|
|
13857
14062
|
var { compiler: nunjucksCompiler2, lib: nunjucksLib2 } = nunjucks2;
|
|
13858
14063
|
var compiledTemplates = /* @__PURE__ */ new Map();
|
|
13859
|
-
function compiledSource(path18,
|
|
14064
|
+
function compiledSource(path18, text2, environment) {
|
|
13860
14065
|
const cacheable = !environment.extensionsList.length;
|
|
13861
|
-
const key = JSON.stringify([
|
|
14066
|
+
const key = JSON.stringify([text2, environment.asyncFilters, environment.opts]);
|
|
13862
14067
|
const cached = compiledTemplates.get(path18);
|
|
13863
14068
|
if (cacheable && cached?.key === key) return { type: "code", obj: cached.code };
|
|
13864
14069
|
let code;
|
|
@@ -13866,7 +14071,7 @@ function compiledSource(path18, text, environment) {
|
|
|
13866
14071
|
code = new Function(
|
|
13867
14072
|
// eslint-disable-line no-new-func
|
|
13868
14073
|
nunjucksCompiler2.compile(
|
|
13869
|
-
|
|
14074
|
+
text2,
|
|
13870
14075
|
environment.asyncFilters,
|
|
13871
14076
|
environment.extensionsList,
|
|
13872
14077
|
path18,
|
|
@@ -13881,8 +14086,8 @@ function compiledSource(path18, text, environment) {
|
|
|
13881
14086
|
return { type: "code", obj: code };
|
|
13882
14087
|
}
|
|
13883
14088
|
function signalMember(node) {
|
|
13884
|
-
const initializer =
|
|
13885
|
-
if (!initializer || !
|
|
14089
|
+
const initializer = Node42.isPropertyDeclaration(node) ? node.getInitializer() : void 0;
|
|
14090
|
+
if (!initializer || !Node42.isCallExpression(initializer)) return void 0;
|
|
13886
14091
|
const callee = initializer.getExpression().getText().replace(/\s+/g, "");
|
|
13887
14092
|
const match = /^(input|model)(\.required)?$|^(output|outputFromObservable)$/.exec(callee);
|
|
13888
14093
|
if (!match) return void 0;
|
|
@@ -13892,8 +14097,8 @@ function renderApiTemplate(template, context, root, files, markdown, configDirec
|
|
|
13892
14097
|
class TrackedLoader extends Loader2 {
|
|
13893
14098
|
getSource(name) {
|
|
13894
14099
|
const path18 = hostPath(resolve7(root, name));
|
|
13895
|
-
const
|
|
13896
|
-
const src = compiledSource(path18,
|
|
14100
|
+
const text2 = files.read(path18);
|
|
14101
|
+
const src = compiledSource(path18, text2, environment);
|
|
13897
14102
|
return { src, path: path18, noCache: true };
|
|
13898
14103
|
}
|
|
13899
14104
|
}
|
|
@@ -13934,7 +14139,7 @@ function renderApiTemplate(template, context, root, files, markdown, configDirec
|
|
|
13934
14139
|
Object.entries(filters).forEach(([name, filter2]) => {
|
|
13935
14140
|
if (typeof filter2 === "function") environment.addFilter(name, filter2);
|
|
13936
14141
|
});
|
|
13937
|
-
environment.addGlobal("Node",
|
|
14142
|
+
environment.addGlobal("Node", Node42);
|
|
13938
14143
|
return environment.render(template, context);
|
|
13939
14144
|
}
|
|
13940
14145
|
|
|
@@ -14038,7 +14243,7 @@ function renderFragment(state, request, files, context) {
|
|
|
14038
14243
|
},
|
|
14039
14244
|
context.templateRoot(),
|
|
14040
14245
|
files,
|
|
14041
|
-
(
|
|
14246
|
+
(text2) => context.markdown(text2, source, files),
|
|
14042
14247
|
state.discovery.configuration.workspaceRoot
|
|
14043
14248
|
)
|
|
14044
14249
|
)
|
|
@@ -14857,8 +15062,8 @@ var SemanticServiceImpl = class {
|
|
|
14857
15062
|
recorder: this.recorder,
|
|
14858
15063
|
scoped: () => this.closures.enabled,
|
|
14859
15064
|
trackedProgramReuse: options.trackedProgramReuse ?? !flagOff(TRACKED_PROGRAM_REUSE_FLAG),
|
|
14860
|
-
docs: (source, files) => createJsDoc((
|
|
14861
|
-
markdown: (
|
|
15065
|
+
docs: (source, files) => createJsDoc((text2) => this.markdown(text2, source, files)),
|
|
15066
|
+
markdown: (text2, source, files) => this.markdown(text2, source, files),
|
|
14862
15067
|
templateRoot: () => this.options.templateRoot ?? resolve9(dirname9(fileURLToPath4(import.meta.url)), "../../templates")
|
|
14863
15068
|
};
|
|
14864
15069
|
}
|
|
@@ -15193,8 +15398,8 @@ var SemanticServiceImpl = class {
|
|
|
15193
15398
|
this.disposed ? "Semantic service is disposed" : "Semantic synchronization aborted"
|
|
15194
15399
|
);
|
|
15195
15400
|
}
|
|
15196
|
-
markdown(
|
|
15197
|
-
return (this.options.markdown ?? renderMarkdown)(
|
|
15401
|
+
markdown(text2, source, files) {
|
|
15402
|
+
return (this.options.markdown ?? renderMarkdown)(text2, {
|
|
15198
15403
|
source,
|
|
15199
15404
|
read: (file) => files.read(file)
|
|
15200
15405
|
});
|
|
@@ -15409,14 +15614,14 @@ async function saveFastStart(file, input) {
|
|
|
15409
15614
|
diagnostics: result.diagnostics,
|
|
15410
15615
|
program
|
|
15411
15616
|
};
|
|
15412
|
-
const
|
|
15413
|
-
const digest3 = contentDigest(
|
|
15617
|
+
const text2 = JSON.stringify(record);
|
|
15618
|
+
const digest3 = contentDigest(text2);
|
|
15414
15619
|
if (known2.get(file) === digest3 && currentDigest(file) === digest3) return;
|
|
15415
15620
|
const temporary = `${file}.${randomUUID6()}.tmp`;
|
|
15416
15621
|
try {
|
|
15417
15622
|
await mkdir5(path13.dirname(file), { recursive: true });
|
|
15418
15623
|
await sweepTemporaries(file);
|
|
15419
|
-
await writeFile5(temporary,
|
|
15624
|
+
await writeFile5(temporary, text2, { flag: "wx" });
|
|
15420
15625
|
await retryingRename(rename5)(temporary, file);
|
|
15421
15626
|
known2.set(file, digest3);
|
|
15422
15627
|
} catch {
|
|
@@ -15624,13 +15829,13 @@ function createMemoState(enabled, root, options) {
|
|
|
15624
15829
|
}
|
|
15625
15830
|
function isMemoFile(value) {
|
|
15626
15831
|
const record = (item) => !!item && typeof item === "object" && !Array.isArray(item);
|
|
15627
|
-
const
|
|
15832
|
+
const text2 = (item) => typeof item === "string";
|
|
15628
15833
|
const entries = (item, valid) => record(item) && Object.values(item).every((entry) => record(entry) && valid(entry));
|
|
15629
|
-
const stamp = (item) => record(item) && ["dev", "ino", "size", "mtimeNs", "ctimeNs", "observedNs"].every((key) =>
|
|
15630
|
-
return record(value) && value["schemaVersion"] === MEMO_SCHEMA_VERSION &&
|
|
15834
|
+
const stamp = (item) => record(item) && ["dev", "ino", "size", "mtimeNs", "ctimeNs", "observedNs"].every((key) => text2(item[key]));
|
|
15835
|
+
return record(value) && value["schemaVersion"] === MEMO_SCHEMA_VERSION && text2(value["compilerVersion"]) && text2(value["toolchainDigest"]) && entries(
|
|
15631
15836
|
value["link"],
|
|
15632
|
-
(entry) =>
|
|
15633
|
-
) && entries(value["assembly"], (entry) =>
|
|
15837
|
+
(entry) => text2(entry["input"]) && text2(entry["output"]) && Array.isArray(entry["keys"]) && entry["keys"].every(text2) && text2(entry["bindings"])
|
|
15838
|
+
) && entries(value["assembly"], (entry) => text2(entry["key"]) && text2(entry["revision"])) && entries(value["cache"], (entry) => text2(entry["revision"]) && stamp(entry["stamp"]));
|
|
15634
15839
|
}
|
|
15635
15840
|
|
|
15636
15841
|
// libs/builder/generator/compiler/plan.ts
|
|
@@ -15830,7 +16035,7 @@ import { appendFileSync } from "node:fs";
|
|
|
15830
16035
|
import { existsSync as existsSync15, statSync as statSync3 } from "node:fs";
|
|
15831
16036
|
|
|
15832
16037
|
// libs/builder/generator/graph/unit-index.ts
|
|
15833
|
-
import { existsSync as existsSync14, realpathSync as
|
|
16038
|
+
import { existsSync as existsSync14, realpathSync as realpathSync5 } from "node:fs";
|
|
15834
16039
|
import path16 from "node:path";
|
|
15835
16040
|
function normalizePath3(file) {
|
|
15836
16041
|
return file.charCodeAt(0) === 47 && !file.includes("/.") && !file.includes("//") && !file.includes("\\") && !file.endsWith("/") ? file : path16.resolve(file).replace(/\\/g, "/");
|
|
@@ -15856,7 +16061,7 @@ function createCanonicalAliases(ports = {}) {
|
|
|
15856
16061
|
const {
|
|
15857
16062
|
normalize: normalize4 = normalizePath3,
|
|
15858
16063
|
exists = existsSync14,
|
|
15859
|
-
realpath: realpath2 = (directory) =>
|
|
16064
|
+
realpath: realpath2 = (directory) => realpathSync5.native(directory)
|
|
15860
16065
|
} = ports;
|
|
15861
16066
|
const directories = /* @__PURE__ */ new Map();
|
|
15862
16067
|
const physicalDirectory = (directory) => {
|
|
@@ -18031,12 +18236,12 @@ function createLinkReuse(input) {
|
|
|
18031
18236
|
const bindingsDigest = (keys) => sha256Hex(
|
|
18032
18237
|
JSON.stringify(
|
|
18033
18238
|
keys.map((key) => {
|
|
18034
|
-
let
|
|
18035
|
-
if (
|
|
18036
|
-
|
|
18037
|
-
bindingTexts.set(key,
|
|
18239
|
+
let text2 = bindingTexts.get(key);
|
|
18240
|
+
if (text2 === void 0) {
|
|
18241
|
+
text2 = stable(bindings.get(key) ?? null);
|
|
18242
|
+
bindingTexts.set(key, text2);
|
|
18038
18243
|
}
|
|
18039
|
-
return [key,
|
|
18244
|
+
return [key, text2];
|
|
18040
18245
|
})
|
|
18041
18246
|
)
|
|
18042
18247
|
);
|
|
@@ -18190,9 +18395,9 @@ var CompilationProgress = class _CompilationProgress {
|
|
|
18190
18395
|
};
|
|
18191
18396
|
function clip(reason) {
|
|
18192
18397
|
if (typeof reason !== "string") return void 0;
|
|
18193
|
-
const
|
|
18194
|
-
if (!
|
|
18195
|
-
return
|
|
18398
|
+
const text2 = reason.trim();
|
|
18399
|
+
if (!text2) return void 0;
|
|
18400
|
+
return text2.length > REASON_LENGTH ? `${text2.slice(0, REASON_LENGTH - 3)}...` : text2;
|
|
18196
18401
|
}
|
|
18197
18402
|
|
|
18198
18403
|
// libs/builder/generator/compiler/render.ts
|