@effect/language-service 0.52.1 → 0.53.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/README.md +2 -1
- package/cli.js +4 -2
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +4 -2
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +172 -112
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +4 -2
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -1243,7 +1243,8 @@ var defaults = {
|
|
|
1243
1243
|
skipLeadingPath: ["src/"]
|
|
1244
1244
|
}],
|
|
1245
1245
|
extendedKeyDetection: false,
|
|
1246
|
-
pipeableMinArgCount: 1
|
|
1246
|
+
pipeableMinArgCount: 1,
|
|
1247
|
+
layerGraphFollowDepth: 0
|
|
1247
1248
|
};
|
|
1248
1249
|
function parseKeyPatterns(patterns) {
|
|
1249
1250
|
const result = [];
|
|
@@ -1279,7 +1280,8 @@ function parse(config) {
|
|
|
1279
1280
|
noExternal: isObject(config) && hasProperty(config, "noExternal") && isBoolean(config.noExternal) ? config.noExternal : defaults.noExternal,
|
|
1280
1281
|
keyPatterns: isObject(config) && hasProperty(config, "keyPatterns") && isArray(config.keyPatterns) ? parseKeyPatterns(config.keyPatterns) : defaults.keyPatterns,
|
|
1281
1282
|
extendedKeyDetection: isObject(config) && hasProperty(config, "extendedKeyDetection") && isBoolean(config.extendedKeyDetection) ? config.extendedKeyDetection : defaults.extendedKeyDetection,
|
|
1282
|
-
pipeableMinArgCount: isObject(config) && hasProperty(config, "pipeableMinArgCount") && isNumber(config.pipeableMinArgCount) ? config.pipeableMinArgCount : defaults.pipeableMinArgCount
|
|
1283
|
+
pipeableMinArgCount: isObject(config) && hasProperty(config, "pipeableMinArgCount") && isNumber(config.pipeableMinArgCount) ? config.pipeableMinArgCount : defaults.pipeableMinArgCount,
|
|
1284
|
+
layerGraphFollowDepth: isObject(config) && hasProperty(config, "layerGraphFollowDepth") && isNumber(config.layerGraphFollowDepth) ? config.layerGraphFollowDepth : defaults.layerGraphFollowDepth
|
|
1283
1285
|
};
|
|
1284
1286
|
}
|
|
1285
1287
|
|
|
@@ -13919,11 +13921,14 @@ var extractLayerGraph = fn("extractLayerGraph")(function* (node, opts) {
|
|
|
13919
13921
|
const visitedNodes = /* @__PURE__ */ new WeakSet();
|
|
13920
13922
|
const nodeInPipeContext = /* @__PURE__ */ new WeakSet();
|
|
13921
13923
|
const nodeToGraph = /* @__PURE__ */ new WeakMap();
|
|
13922
|
-
const
|
|
13923
|
-
const
|
|
13924
|
+
const depthBudget = /* @__PURE__ */ new WeakMap();
|
|
13925
|
+
const nodeToVisit = [];
|
|
13926
|
+
const appendNodeToVisit = (node2, nodeDepthBudget) => {
|
|
13927
|
+
depthBudget.set(node2, nodeDepthBudget);
|
|
13924
13928
|
nodeToVisit.push(node2);
|
|
13925
13929
|
return void 0;
|
|
13926
13930
|
};
|
|
13931
|
+
appendNodeToVisit(node, opts.followSymbolsDepth);
|
|
13927
13932
|
const mutableGraph = beginMutation3(directed());
|
|
13928
13933
|
const extractNodeInfo = fn("extractNodeInfo")(function* (node2) {
|
|
13929
13934
|
let provides = [];
|
|
@@ -13958,14 +13963,19 @@ var extractLayerGraph = fn("extractLayerGraph")(function* (node, opts) {
|
|
|
13958
13963
|
nodeToGraph.set(node2, graphNode);
|
|
13959
13964
|
return graphNode;
|
|
13960
13965
|
});
|
|
13966
|
+
const isSimpleIdentifier = (node2) => {
|
|
13967
|
+
return ts.isIdentifier(node2) || ts.isPropertyAccessExpression(node2) && ts.isIdentifier(node2.name) && isSimpleIdentifier(node2.expression);
|
|
13968
|
+
};
|
|
13969
|
+
const getAdjustedNode2 = (node2) => ts.isPropertyDeclaration(node2) || ts.isVariableDeclaration(node2) ? node2.initializer : ts.isExpression(node2) ? node2 : void 0;
|
|
13961
13970
|
while (nodeToVisit.length > 0) {
|
|
13962
13971
|
const node2 = nodeToVisit.pop();
|
|
13972
|
+
const currentDepthBudget = depthBudget.get(node2);
|
|
13963
13973
|
const pipeArgs = yield* pipe(typeParser.pipeCall(node2), orElse2(() => void_));
|
|
13964
13974
|
if (pipeArgs) {
|
|
13965
13975
|
if (!visitedNodes.has(node2)) {
|
|
13966
|
-
appendNodeToVisit(node2);
|
|
13967
|
-
appendNodeToVisit(pipeArgs.subject);
|
|
13968
|
-
pipeArgs.args.forEach(appendNodeToVisit);
|
|
13976
|
+
appendNodeToVisit(node2, currentDepthBudget);
|
|
13977
|
+
appendNodeToVisit(pipeArgs.subject, currentDepthBudget);
|
|
13978
|
+
pipeArgs.args.forEach((_) => appendNodeToVisit(_, currentDepthBudget));
|
|
13969
13979
|
pipeArgs.args.forEach((_) => nodeInPipeContext.add(_));
|
|
13970
13980
|
visitedNodes.add(node2);
|
|
13971
13981
|
} else {
|
|
@@ -14000,8 +14010,8 @@ var extractLayerGraph = fn("extractLayerGraph")(function* (node, opts) {
|
|
|
14000
14010
|
}
|
|
14001
14011
|
if (shouldExplode) {
|
|
14002
14012
|
if (!visitedNodes.has(node2)) {
|
|
14003
|
-
appendNodeToVisit(node2);
|
|
14004
|
-
node2.arguments.forEach(appendNodeToVisit);
|
|
14013
|
+
appendNodeToVisit(node2, currentDepthBudget);
|
|
14014
|
+
node2.arguments.forEach((_) => appendNodeToVisit(_, currentDepthBudget));
|
|
14005
14015
|
visitedNodes.add(node2);
|
|
14006
14016
|
} else {
|
|
14007
14017
|
const childNodes = node2.arguments.map((_) => nodeToGraph.get(_)).filter(isNumber).filter(
|
|
@@ -14023,8 +14033,8 @@ var extractLayerGraph = fn("extractLayerGraph")(function* (node, opts) {
|
|
|
14023
14033
|
}
|
|
14024
14034
|
if (opts.arrayLiteralAsMerge && ts.isArrayLiteralExpression(node2)) {
|
|
14025
14035
|
if (!visitedNodes.has(node2)) {
|
|
14026
|
-
appendNodeToVisit(node2);
|
|
14027
|
-
node2.elements.forEach(appendNodeToVisit);
|
|
14036
|
+
appendNodeToVisit(node2, currentDepthBudget);
|
|
14037
|
+
node2.elements.forEach((_) => appendNodeToVisit(_, currentDepthBudget));
|
|
14028
14038
|
visitedNodes.add(node2);
|
|
14029
14039
|
} else {
|
|
14030
14040
|
const childNodes = node2.elements.map((_) => nodeToGraph.get(_)).filter(isNumber).filter(
|
|
@@ -14039,110 +14049,153 @@ var extractLayerGraph = fn("extractLayerGraph")(function* (node, opts) {
|
|
|
14039
14049
|
}
|
|
14040
14050
|
continue;
|
|
14041
14051
|
}
|
|
14052
|
+
if (currentDepthBudget > 0 && isSimpleIdentifier(node2)) {
|
|
14053
|
+
let symbol3 = typeChecker.getSymbolAtLocation(node2);
|
|
14054
|
+
if (symbol3) {
|
|
14055
|
+
if (symbol3.flags & ts.SymbolFlags.Alias) {
|
|
14056
|
+
symbol3 = typeChecker.getAliasedSymbol(symbol3);
|
|
14057
|
+
}
|
|
14058
|
+
if (symbol3.declarations && symbol3.declarations.length === 1) {
|
|
14059
|
+
const declarationNode = getAdjustedNode2(symbol3.declarations[0]);
|
|
14060
|
+
if (declarationNode) {
|
|
14061
|
+
if (!visitedNodes.has(declarationNode)) {
|
|
14062
|
+
appendNodeToVisit(node2, currentDepthBudget);
|
|
14063
|
+
appendNodeToVisit(declarationNode, currentDepthBudget - 1);
|
|
14064
|
+
visitedNodes.add(node2);
|
|
14065
|
+
continue;
|
|
14066
|
+
}
|
|
14067
|
+
const childNode = nodeToGraph.get(declarationNode);
|
|
14068
|
+
if (isNumber(childNode)) {
|
|
14069
|
+
const graphNode = yield* addNode2(node2);
|
|
14070
|
+
addEdge(mutableGraph, graphNode, childNode, { relationship: "symbol" });
|
|
14071
|
+
continue;
|
|
14072
|
+
}
|
|
14073
|
+
}
|
|
14074
|
+
}
|
|
14075
|
+
}
|
|
14076
|
+
}
|
|
14042
14077
|
if (ts.isExpression(node2)) {
|
|
14043
14078
|
const nodeInfo = yield* extractNodeInfo(node2);
|
|
14044
14079
|
if (nodeInfo.layerTypes) {
|
|
14045
14080
|
yield* addNode2(node2, nodeInfo);
|
|
14046
|
-
continue;
|
|
14047
14081
|
}
|
|
14082
|
+
continue;
|
|
14048
14083
|
}
|
|
14049
14084
|
return yield* fail(new UnableToProduceLayerGraphError("Unable to produce layer graph for node", node2));
|
|
14050
14085
|
}
|
|
14051
14086
|
return endMutation2(mutableGraph);
|
|
14052
14087
|
});
|
|
14053
|
-
var
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
|
|
14071
|
-
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
};
|
|
14087
|
-
let result = [];
|
|
14088
|
-
for (const [graphNodeIndex, graphNode] of entries(nodes(layerGraph))) {
|
|
14089
|
-
let subgraphDefs = [];
|
|
14090
|
-
for (const kind of ["requires", "provides"]) {
|
|
14091
|
-
const typesMermaidNodes = [];
|
|
14092
|
-
for (let i = 0; i < graphNode[kind].length; i++) {
|
|
14093
|
-
typesMermaidNodes.push(`${graphNodeIndex}_${kind}_${i}["${mermaidSafe(typeName(graphNode[kind][i]))}"]`);
|
|
14094
|
-
}
|
|
14095
|
-
if (typesMermaidNodes.length > 0) {
|
|
14096
|
-
subgraphDefs = [
|
|
14097
|
-
...subgraphDefs,
|
|
14098
|
-
`subgraph ${graphNodeIndex}_${kind} [${kind === "provides" ? "Provides" : "Requires"}]`,
|
|
14099
|
-
...typesMermaidNodes.map((_) => ` ${_}`),
|
|
14100
|
-
`end`,
|
|
14101
|
-
`style ${graphNodeIndex}_${kind} stroke:none`
|
|
14102
|
-
];
|
|
14103
|
-
}
|
|
14104
|
-
}
|
|
14105
|
-
subgraphDefs = [
|
|
14106
|
-
`subgraph ${graphNodeIndex}_wrap[" "]`,
|
|
14107
|
-
...subgraphDefs.map((_) => ` ${_}`),
|
|
14108
|
-
`end`,
|
|
14109
|
-
`style ${graphNodeIndex}_wrap fill:transparent`,
|
|
14110
|
-
`style ${graphNodeIndex}_wrap stroke:none`
|
|
14111
|
-
];
|
|
14112
|
-
const sourceFile = tsUtils.getSourceFileOfNode(graphNode.node);
|
|
14113
|
-
const nodePosition = graphNode.node.getStart(sourceFile, false);
|
|
14114
|
-
const { character, line } = ts.getLineAndCharacterOfPosition(sourceFile, nodePosition);
|
|
14115
|
-
const nodeText = sourceFile.text.substring(graphNode.node.pos, graphNode.node.end).trim();
|
|
14116
|
-
result = [
|
|
14117
|
-
...result,
|
|
14118
|
-
`subgraph ${graphNodeIndex} ["\`${mermaidSafe(nodeText)}<br/>_at ln ${line + 1} col ${character}_\`"]`,
|
|
14119
|
-
...subgraphDefs.map((_) => ` ${_}`),
|
|
14120
|
-
`end`,
|
|
14121
|
-
`style ${graphNodeIndex} fill:transparent`
|
|
14122
|
-
];
|
|
14088
|
+
var formatSourceFileName = (sourceFile) => {
|
|
14089
|
+
let fileName = sourceFile.fileName;
|
|
14090
|
+
if (fileName.indexOf("/") > -1) {
|
|
14091
|
+
fileName = fileName.split("/").pop();
|
|
14092
|
+
}
|
|
14093
|
+
return fileName;
|
|
14094
|
+
};
|
|
14095
|
+
var formatSourceFileNameLineAndColumn = (ts, tsUtils, node, fromSourceFile) => {
|
|
14096
|
+
const nodeSourceFile = tsUtils.getSourceFileOfNode(node);
|
|
14097
|
+
const nodePosition = ts.getTokenPosOfNode(node, nodeSourceFile);
|
|
14098
|
+
const { character, line } = ts.getLineAndCharacterOfPosition(nodeSourceFile, nodePosition);
|
|
14099
|
+
if (!fromSourceFile || nodeSourceFile === fromSourceFile) return `ln ${line + 1} col ${character}`;
|
|
14100
|
+
return `in ${formatSourceFileName(nodeSourceFile)} at ln ${line + 1} col ${character}`;
|
|
14101
|
+
};
|
|
14102
|
+
var formatLayerGraph = fn("formatLayerGraph")(
|
|
14103
|
+
function* (layerGraph, _fromSourceFile) {
|
|
14104
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
14105
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
14106
|
+
const ts = yield* service(TypeScriptApi);
|
|
14107
|
+
return toMermaid(layerGraph, {
|
|
14108
|
+
edgeLabel: (edge) => JSON.stringify(edge),
|
|
14109
|
+
nodeLabel: (graphNode) => {
|
|
14110
|
+
const sourceFile = tsUtils.getSourceFileOfNode(graphNode.node);
|
|
14111
|
+
let text = sourceFile.text.substring(graphNode.node.pos, graphNode.node.end).trim();
|
|
14112
|
+
text += "\nprovides: " + graphNode.provides.map((_) => typeChecker.typeToString(_, void 0, ts.TypeFormatFlags.NoTruncation)).join(
|
|
14113
|
+
", "
|
|
14114
|
+
);
|
|
14115
|
+
text += "\nrequires: " + graphNode.requires.map((_) => typeChecker.typeToString(_, void 0, ts.TypeFormatFlags.NoTruncation)).join(
|
|
14116
|
+
", "
|
|
14117
|
+
);
|
|
14118
|
+
return text;
|
|
14119
|
+
}
|
|
14120
|
+
});
|
|
14123
14121
|
}
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14122
|
+
);
|
|
14123
|
+
var formatNestedLayerGraph = fn("formatNestedLayerGraph")(
|
|
14124
|
+
function* (layerGraph, fromSourceFile) {
|
|
14125
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
14126
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
14127
|
+
const ts = yield* service(TypeScriptApi);
|
|
14128
|
+
const mermaidSafe = (value) => value.replace(/\n/g, " ").replace(
|
|
14129
|
+
/\s+/g,
|
|
14130
|
+
" "
|
|
14131
|
+
).substring(0, 50).replace(/"/g, "#quot;").replace(/</mg, "#lt;").replace(/>/mg, "#gt;").trim();
|
|
14132
|
+
const typeNameCache = /* @__PURE__ */ new Map();
|
|
14133
|
+
const typeName = (type) => {
|
|
14134
|
+
if (typeNameCache.has(type)) return typeNameCache.get(type);
|
|
14135
|
+
const name = typeChecker.typeToString(type, void 0, ts.TypeFormatFlags.NoTruncation);
|
|
14136
|
+
typeNameCache.set(type, name);
|
|
14137
|
+
return name;
|
|
14138
|
+
};
|
|
14139
|
+
let result = [];
|
|
14140
|
+
for (const [graphNodeIndex, graphNode] of entries(nodes(layerGraph))) {
|
|
14141
|
+
let subgraphDefs = [];
|
|
14142
|
+
for (const kind of ["requires", "provides"]) {
|
|
14143
|
+
const typesMermaidNodes = [];
|
|
14144
|
+
for (let i = 0; i < graphNode[kind].length; i++) {
|
|
14145
|
+
typesMermaidNodes.push(`${graphNodeIndex}_${kind}_${i}["${mermaidSafe(typeName(graphNode[kind][i]))}"]`);
|
|
14146
|
+
}
|
|
14147
|
+
if (typesMermaidNodes.length > 0) {
|
|
14148
|
+
subgraphDefs = [
|
|
14149
|
+
...subgraphDefs,
|
|
14150
|
+
`subgraph ${graphNodeIndex}_${kind} [${kind === "provides" ? "Provides" : "Requires"}]`,
|
|
14151
|
+
...typesMermaidNodes.map((_) => ` ${_}`),
|
|
14152
|
+
`end`,
|
|
14153
|
+
`style ${graphNodeIndex}_${kind} stroke:none`
|
|
14154
|
+
];
|
|
14134
14155
|
}
|
|
14135
14156
|
}
|
|
14157
|
+
subgraphDefs = [
|
|
14158
|
+
`subgraph ${graphNodeIndex}_wrap[" "]`,
|
|
14159
|
+
...subgraphDefs.map((_) => ` ${_}`),
|
|
14160
|
+
`end`,
|
|
14161
|
+
`style ${graphNodeIndex}_wrap fill:transparent`,
|
|
14162
|
+
`style ${graphNodeIndex}_wrap stroke:none`
|
|
14163
|
+
];
|
|
14164
|
+
const sourceFile = tsUtils.getSourceFileOfNode(graphNode.node);
|
|
14165
|
+
const nodeText = sourceFile.text.substring(graphNode.node.pos, graphNode.node.end).trim();
|
|
14166
|
+
result = [
|
|
14167
|
+
...result,
|
|
14168
|
+
`subgraph ${graphNodeIndex} ["\`${mermaidSafe(nodeText)}
|
|
14169
|
+
<small>_${mermaidSafe(formatSourceFileNameLineAndColumn(ts, tsUtils, graphNode.node, fromSourceFile))}_</small>\`"]`,
|
|
14170
|
+
...subgraphDefs.map((_) => ` ${_}`),
|
|
14171
|
+
`end`,
|
|
14172
|
+
`style ${graphNodeIndex} fill:transparent`
|
|
14173
|
+
];
|
|
14174
|
+
}
|
|
14175
|
+
for (const edgeInfo of values2(edges(layerGraph))) {
|
|
14176
|
+
const sourceData = layerGraph.nodes.get(edgeInfo.source);
|
|
14177
|
+
const targetData = layerGraph.nodes.get(edgeInfo.target);
|
|
14178
|
+
let connected = false;
|
|
14179
|
+
for (const kind of ["requires", "provides"]) {
|
|
14180
|
+
for (let i = 0; i < sourceData[kind].length; i++) {
|
|
14181
|
+
const targetIdx = targetData[kind].indexOf(sourceData[kind][i]);
|
|
14182
|
+
if (targetIdx > -1) {
|
|
14183
|
+
result.push(`${edgeInfo.source}_${kind}_${i} -.-> ${edgeInfo.target}_${kind}_${targetIdx}`);
|
|
14184
|
+
connected = true;
|
|
14185
|
+
}
|
|
14186
|
+
}
|
|
14187
|
+
}
|
|
14188
|
+
if (!connected) {
|
|
14189
|
+
result.push(`${edgeInfo.source} -.-x ${edgeInfo.target}`);
|
|
14190
|
+
}
|
|
14136
14191
|
}
|
|
14137
|
-
if (
|
|
14138
|
-
|
|
14139
|
-
|
|
14192
|
+
if (result.length === 0) return "";
|
|
14193
|
+
return [
|
|
14194
|
+
`flowchart TB`,
|
|
14195
|
+
...result.map((_) => ` ${_}`)
|
|
14196
|
+
].join("\n");
|
|
14140
14197
|
}
|
|
14141
|
-
|
|
14142
|
-
`flowchart TB`,
|
|
14143
|
-
...result.map((_) => ` ${_}`)
|
|
14144
|
-
].join("\n");
|
|
14145
|
-
});
|
|
14198
|
+
);
|
|
14146
14199
|
var extractOutlineGraph = fn("extractOutlineGraph")(function* (layerGraph) {
|
|
14147
14200
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
14148
14201
|
const mutableGraph = beginMutation3(directed());
|
|
@@ -14185,13 +14238,15 @@ var extractOutlineGraph = fn("extractOutlineGraph")(function* (layerGraph) {
|
|
|
14185
14238
|
return endMutation2(mutableGraph);
|
|
14186
14239
|
});
|
|
14187
14240
|
var formatLayerOutlineGraph = fn("formatLayerOutlineGraph")(
|
|
14188
|
-
function* (layerOutlineGraph) {
|
|
14241
|
+
function* (layerOutlineGraph, fromSourceFile) {
|
|
14189
14242
|
const tsUtils = yield* service(TypeScriptUtils);
|
|
14190
14243
|
return toMermaid(layerOutlineGraph, {
|
|
14191
14244
|
edgeLabel: () => "",
|
|
14192
14245
|
nodeLabel: (graphNode) => {
|
|
14193
14246
|
const sourceFile = tsUtils.getSourceFileOfNode(graphNode.node);
|
|
14194
|
-
|
|
14247
|
+
const nodeText = sourceFile.text.substring(graphNode.node.pos, graphNode.node.end).trim();
|
|
14248
|
+
if (sourceFile === fromSourceFile) return nodeText;
|
|
14249
|
+
return nodeText + "\n_in " + formatSourceFileName(sourceFile) + "_";
|
|
14195
14250
|
}
|
|
14196
14251
|
});
|
|
14197
14252
|
}
|
|
@@ -14298,7 +14353,7 @@ var extractProvidersAndRequirers = fn("extractProvidersAndRequirers")(
|
|
|
14298
14353
|
}
|
|
14299
14354
|
);
|
|
14300
14355
|
var formatLayerProvidersAndRequirersInfo = fn("formatLayerProvidersAndRequirersInfo")(
|
|
14301
|
-
function* (info) {
|
|
14356
|
+
function* (info, fromSourceFile) {
|
|
14302
14357
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
14303
14358
|
const ts = yield* service(TypeScriptApi);
|
|
14304
14359
|
const tsUtils = yield* service(TypeScriptUtils);
|
|
@@ -14312,10 +14367,8 @@ var formatLayerProvidersAndRequirersInfo = fn("formatLayerProvidersAndRequirersI
|
|
|
14312
14367
|
);
|
|
14313
14368
|
const positions = infoNode.nodes.map((_) => {
|
|
14314
14369
|
const sourceFile = tsUtils.getSourceFileOfNode(_);
|
|
14315
|
-
const nodePosition = ts.getTokenPosOfNode(_, sourceFile);
|
|
14316
|
-
const { character, line } = ts.getLineAndCharacterOfPosition(sourceFile, nodePosition);
|
|
14317
14370
|
const nodeText = sourceFile.text.substring(_.pos, _.end).trim().replace(/\n/g, " ").substr(0, 50);
|
|
14318
|
-
return
|
|
14371
|
+
return `${formatSourceFileNameLineAndColumn(ts, tsUtils, _, fromSourceFile)} by \`${nodeText}\``;
|
|
14319
14372
|
});
|
|
14320
14373
|
textualExplanation.push(`- ${typeString} ${infoNode.kind} at ${positions.join(", ")}`);
|
|
14321
14374
|
};
|
|
@@ -14370,16 +14423,21 @@ function getAdjustedNode(sourceFile, position) {
|
|
|
14370
14423
|
}
|
|
14371
14424
|
function parseLayerGraph(layerNode) {
|
|
14372
14425
|
return gen(function* () {
|
|
14426
|
+
const options = yield* service(LanguageServicePluginOptions);
|
|
14427
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
14373
14428
|
const layerGraph = yield* extractLayerGraph(layerNode, {
|
|
14374
14429
|
arrayLiteralAsMerge: false,
|
|
14375
|
-
explodeOnlyLayerCalls: false
|
|
14430
|
+
explodeOnlyLayerCalls: false,
|
|
14431
|
+
followSymbolsDepth: options.layerGraphFollowDepth
|
|
14376
14432
|
});
|
|
14377
|
-
const
|
|
14433
|
+
const sourceFile = tsUtils.getSourceFileOfNode(layerNode);
|
|
14434
|
+
const nestedGraphMermaid = yield* formatNestedLayerGraph(layerGraph, sourceFile);
|
|
14378
14435
|
const outlineGraph = yield* extractOutlineGraph(layerGraph);
|
|
14379
|
-
const outlineGraphMermaid = yield* formatLayerOutlineGraph(outlineGraph);
|
|
14436
|
+
const outlineGraphMermaid = yield* formatLayerOutlineGraph(outlineGraph, sourceFile);
|
|
14380
14437
|
const providersAndRequirers = yield* extractProvidersAndRequirers(layerGraph);
|
|
14381
14438
|
const providersAndRequirersTextualExplanation = yield* formatLayerProvidersAndRequirersInfo(
|
|
14382
|
-
providersAndRequirers
|
|
14439
|
+
providersAndRequirers,
|
|
14440
|
+
sourceFile
|
|
14383
14441
|
);
|
|
14384
14442
|
return { nestedGraphMermaid, outlineGraphMermaid, providersAndRequirersTextualExplanation };
|
|
14385
14443
|
});
|
|
@@ -14974,7 +15032,8 @@ var layerMagic = createRefactor({
|
|
|
14974
15032
|
return pipe(
|
|
14975
15033
|
extractLayerGraph(atLocation, {
|
|
14976
15034
|
arrayLiteralAsMerge: true,
|
|
14977
|
-
explodeOnlyLayerCalls: true
|
|
15035
|
+
explodeOnlyLayerCalls: true,
|
|
15036
|
+
followSymbolsDepth: 0
|
|
14978
15037
|
}),
|
|
14979
15038
|
flatMap2(extractOutlineGraph),
|
|
14980
15039
|
flatMap2(
|
|
@@ -15070,7 +15129,8 @@ var layerMagic = createRefactor({
|
|
|
15070
15129
|
(_targetLayer) => pipe(
|
|
15071
15130
|
extractLayerGraph(_targetLayer.castedStructure, {
|
|
15072
15131
|
arrayLiteralAsMerge: true,
|
|
15073
|
-
explodeOnlyLayerCalls: true
|
|
15132
|
+
explodeOnlyLayerCalls: true,
|
|
15133
|
+
followSymbolsDepth: 0
|
|
15074
15134
|
}),
|
|
15075
15135
|
flatMap2(extractOutlineGraph),
|
|
15076
15136
|
flatMap2(
|