lib.importCycles
The import cycles of a tree of TypeScript sources: the cycles at runtime (after the import elision), of the declared imports, or of each import
MCPCLI- Package
- @procedures/lib · README
- Path
["lib","importCycles"]- CLI
mark lib importCycles --path <string>- MCP tool
lib.importCycleson thedev-toolsserver- As data
{"$proc":["lib","importCycles"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/lib/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["lib","importCycles"], { path: "<path>" });
console.log(JSON.stringify(result));From the command line
$ mark lib importCycles --path <string>
As data, in a program
{ "$proc": ["lib", "importCycles"], "input": { "path": "<path>" } }Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | yes | The folder of the sources, for example packages/web/src | |
mode | "runtime" | "declared" | "raw" | no | The edges to count: runtime (after the import elision, the default), declared or raw | |
diDecorators | string[] | no | The decorators whose class keeps the types of its constructor parameters at runtime (Angular: Injectable, Component, Directive, Pipe, NgModule) | |
exclude | string[] | no | The glob patterns of the files to leave out (default: node_modules, declarations and tests) | |
limits | object | no | Lower limits than the defaults. A higher value is refused. |
Output
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | yes | The folder of the sources | |
mode | "runtime" | "declared" | "raw" | yes | The edges that the call counted | |
files | number | yes | The number of files | |
edges | number | yes | The number of import edges between the files | |
acyclic | boolean | yes | True when the graph has no cycle | |
components | string[][] | yes | Each cycle: the files of a strongly connected component, in name order. The largest cycle comes first. | |
filesInCycles | number | yes | The number of files in a cycle | |
skipped | object[] | yes | The files larger than limits.maxFileBytes: the call did not read them |
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "The folder of the sources, for example packages/web/src"
},
"mode": {
"description": "The edges to count: runtime (after the import elision, the default), declared or raw",
"type": "string",
"enum": [
"runtime",
"declared",
"raw"
]
},
"diDecorators": {
"description": "The decorators whose class keeps the types of its constructor parameters at runtime (Angular: Injectable, Component, Directive, Pipe, NgModule)",
"type": "array",
"items": {
"type": "string"
}
},
"exclude": {
"description": "The glob patterns of the files to leave out (default: node_modules, declarations and tests)",
"type": "array",
"items": {
"type": "string"
}
},
"limits": {
"description": "Lower limits than the defaults. A higher value is refused.",
"type": "object",
"properties": {
"maxFiles": {
"description": "The most files of the call: 20000 at most, and the default. A call with more files is refused before it reads a file.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 20000
},
"maxFileBytes": {
"description": "The largest file that the call reads, in bytes: 1 MiB at most, and the default. The result lists each larger file.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 1048576
}
}
}
},
"required": [
"path"
]
},
"output": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "The folder of the sources"
},
"mode": {
"type": "string",
"enum": [
"runtime",
"declared",
"raw"
],
"description": "The edges that the call counted"
},
"files": {
"type": "number",
"description": "The number of files"
},
"edges": {
"type": "number",
"description": "The number of import edges between the files"
},
"acyclic": {
"type": "boolean",
"description": "True when the graph has no cycle"
},
"components": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string"
}
},
"description": "Each cycle: the files of a strongly connected component, in name order. The largest cycle comes first."
},
"filesInCycles": {
"type": "number",
"description": "The number of files in a cycle"
},
"skipped": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "The file, relative to the folder"
},
"bytes": {
"type": "number",
"description": "The size of the file"
}
},
"required": [
"path",
"bytes"
],
"additionalProperties": false
},
"description": "The files larger than limits.maxFileBytes: the call did not read them"
}
},
"required": [
"path",
"mode",
"files",
"edges",
"acyclic",
"components",
"filesInCycles",
"skipped"
],
"additionalProperties": {}
}
}