Skip to main content
Module

x/deno_graph/schemas/module-graph.json

The module graph logic for Deno CLI
Go to Latest
File
{ "$id": "https://deno.land/schemas/module-graph.json", "$schema": "http://json-schema.org/draft-07/schema", "description": "A JSON representation of a Deno module dependency graph.", "required": [ "roots", "modules", "redirects" ], "title": "Deno Dependency Graph Schema", "type": "object", "properties": { "roots": { "default": "", "description": "The root specifiers for the graph.", "examples": [ [ "https://deno.land/x/mod.ts" ] ], "type": "array", "items": { "type": "string" } }, "modules": { "default": [], "description": "The modules that are part of the graph.", "type": "array", "items": { "$ref": "#/definitions/module" } }, "imports": { "default": [], "description": "Dependencies that have been injected into the graph.", "type": "array", "items": { "$ref": "#/definitions/graphImport" } }, "redirects": { "default": {}, "description": "Any modules that were redirected when being resolved for the module graph. The key will be the requested URL and the value will be the fully qualified destination URL.", "type": "object", "patternProperties": { "^.*$": { "type": "string" } } } }, "definitions": { "module": { "type": "object", "required": [ "specifier" ], "properties": { "specifier": { "type": "string", "description": "The fully qualified module specifier (URL) for the module." }, "dependencies": { "type": "array", "description": "An array of dependencies of the module.", "items": { "$ref": "#/definitions/dependency" } }, "typeDependency": { "$ref": "#/definitions/typeDependency", "description": "The type dependency for the module. This is set when the file contains a reference to its types or the module was supplied with a types header." }, "size": { "type": "integer", "description": "The size of the module on disk in bytes." }, "mediaType": { "type": "string", "description": "How the file is treated within Deno. All the possible media types that Deno considers are listed here, but in practice, several of them would never appear in a module graph.", "enum": [ "JavaScript", "TypeScript", "JSX", "TSX", "Dts", "Json", "Wasm", "TsBuildInfo", "SourceMap", "Unknown" ] }, "local": { "type": "string", "description": "The path to the local file. For local modules this will be the local file path, for remote modules and data URLs, this would be the path to the file in the Deno cache." }, "checksum": { "type": "string", "description": "The checksum of the local source file. This can be used to validate if the current on disk version matches the version described here." }, "emit": { "type": "string", "description": "The path to an emitted version of the module, if the module requires transpilation to be loaded into the Deno runtime." }, "map": { "type": "string", "description": "The path to an optionally emitted source map between the original and emitted version of the file." }, "sourceMap": { "description": "The source map that was parsed from the source of the module, which indicates an \"upstream\" source map that applies to the module.", "$ref": "https://json.schemastore.org/sourcemap-v3.json" }, "sourceMapUrl": { "type": "string", "description": "The source map URL parsed from the source of the module, which indicates there is an \"upstream\" source map that applies to the module." }, "error": { "type": "string", "description": "If when resolving the module, Deno encountered an error and the module is unavailable, the text of that error will be indicated here." } } }, "graphImport": { "type": "object", "required": [ "referrer" ], "properties": { "referrer": { "type": "string", "description": "The string specifier that was used as the base when resolving dependencies." }, "dependencies": { "type": "array", "description": "An array of dependencies of the module.", "items": { "$ref": "#/definitions/dependency" } } } }, "typeDependency": { "type": "object", "required": [ "specifier", "dependency" ], "properties": { "specifier": { "type": "string", "description": "The string specifier that was used for the dependency." }, "dependency": { "$ref": "#/definitions/resolvedDependency", "description": "An object pointing to the resolved dependency." } } }, "dependency": { "type": "object", "required": [ "specifier" ], "properties": { "specifier": { "type": "string", "description": "The specifier provided from within the module." }, "isDynamic": { "type": "boolean", "description": "A flag that indicates if the import is dynamically imported. A dynamic import may not be fully resolved until it is accessed at runtime." }, "code": { "$ref": "#/definitions/resolvedDependency", "description": "The fully qualified module specifier (URL) for the code dependency." }, "type": { "$ref": "#/definitions/resolvedDependency", "description": "The fully qualified module specifier (URL) for the type only dependency." }, "assertType": { "type": "string", "description": "A value that provides the type attribute of an import assertion." } } }, "resolvedDependency": { "type": "object", "required": [ "span" ], "properties": { "specifier": { "type": "string", "description": "The resolved specifier of the dependency" }, "error": { "type": "string", "description": "If the specifier could not be resolved, the resulting error message" }, "span": { "$ref": "#/definitions/span" } } }, "span": { "type": "object", "required": [ "start", "end" ], "properties": { "start": { "$ref": "#/definitions/location" }, "end": { "$ref": "#/definitions/location" } } }, "location": { "type": "object", "required": [ "line", "character" ], "properties": { "line": { "type": "number" }, "character": { "type": "number" } } } }}