@loaders.gl/graphs 4.5.3

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.
Files changed (54) hide show
  1. package/LICENSE +41 -0
  2. package/README.md +66 -0
  3. package/dist/dot-loader-types.d.ts +16 -0
  4. package/dist/dot-loader-types.d.ts.map +1 -0
  5. package/dist/dot-loader-types.js +20 -0
  6. package/dist/dot-loader-types.js.map +1 -0
  7. package/dist/dot-loader.cjs +732 -0
  8. package/dist/dot-loader.cjs.map +7 -0
  9. package/dist/dot-loader.d.ts +19 -0
  10. package/dist/dot-loader.d.ts.map +1 -0
  11. package/dist/dot-loader.js +13 -0
  12. package/dist/dot-loader.js.map +1 -0
  13. package/dist/dot-types.d.ts +32 -0
  14. package/dist/dot-types.d.ts.map +1 -0
  15. package/dist/dot-types.js +5 -0
  16. package/dist/dot-types.js.map +1 -0
  17. package/dist/graph-types.d.ts +28 -0
  18. package/dist/graph-types.d.ts.map +1 -0
  19. package/dist/graph-types.js +5 -0
  20. package/dist/graph-types.js.map +1 -0
  21. package/dist/graphml-loader-types.d.ts +16 -0
  22. package/dist/graphml-loader-types.d.ts.map +1 -0
  23. package/dist/graphml-loader-types.js +20 -0
  24. package/dist/graphml-loader-types.js.map +1 -0
  25. package/dist/graphml-loader.cjs +315 -0
  26. package/dist/graphml-loader.cjs.map +7 -0
  27. package/dist/graphml-loader.d.ts +19 -0
  28. package/dist/graphml-loader.d.ts.map +1 -0
  29. package/dist/graphml-loader.js +13 -0
  30. package/dist/graphml-loader.js.map +1 -0
  31. package/dist/index.cjs +1022 -0
  32. package/dist/index.cjs.map +7 -0
  33. package/dist/index.d.ts +5 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +6 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/lib/parse-dot.d.ts +4 -0
  38. package/dist/lib/parse-dot.d.ts.map +1 -0
  39. package/dist/lib/parse-dot.js +724 -0
  40. package/dist/lib/parse-dot.js.map +1 -0
  41. package/dist/lib/parse-graphml.d.ts +6 -0
  42. package/dist/lib/parse-graphml.d.ts.map +1 -0
  43. package/dist/lib/parse-graphml.js +296 -0
  44. package/dist/lib/parse-graphml.js.map +1 -0
  45. package/package.json +58 -0
  46. package/src/dot-loader-types.ts +24 -0
  47. package/src/dot-loader.ts +14 -0
  48. package/src/dot-types.ts +38 -0
  49. package/src/graph-types.ts +33 -0
  50. package/src/graphml-loader-types.ts +24 -0
  51. package/src/graphml-loader.ts +14 -0
  52. package/src/index.ts +8 -0
  53. package/src/lib/parse-dot.ts +924 -0
  54. package/src/lib/parse-graphml.ts +414 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts", "../src/graphml-loader-types.ts", "../src/lib/parse-graphml.ts", "../src/graphml-loader.ts", "../src/dot-loader-types.ts", "../src/lib/parse-dot.ts", "../src/dot-loader.ts"],
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {GraphMLLoaderWithParser as GraphMLLoader} from './graphml-loader';\nexport type {GraphData, GraphNode, GraphEdge} from './graph-types';\nexport {DOTLoaderWithParser as DOTLoader} from './dot-loader';\nexport type {DOTGraphData, DOTMetadata, DOTSubgraph} from './dot-types';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader} from '@loaders.gl/loader-utils';\nimport type {GraphData} from './graph-types';\n\n// @ts-ignore __VERSION__ is injected by the build.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/** Metadata-only loader for GraphML 1.0 documents. */\nexport const GraphMLLoader = {\n name: 'GraphML',\n id: 'graphml',\n module: 'graphs',\n version: VERSION,\n extensions: ['graphml'],\n mimeTypes: ['application/graphml+xml'],\n text: true,\n worker: false,\n dataType: null as unknown as GraphData,\n batchType: null as never,\n options: {}\n} as const satisfies Loader<GraphData, never>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {XMLParser} from 'fast-xml-parser';\n\nimport type {GraphData, GraphEdge, GraphNode} from '../graph-types';\n\nconst XML_ATTRIBUTE_PREFIX = '@_';\nconst XML_TEXT_KEY = '#text';\n\n/** Supported key scopes. */\ntype GraphMLDomain = 'all' | 'node' | 'edge' | 'graph';\n\n/** Supported scalar attribute types. */\ntype GraphMLAttributeType = 'boolean' | 'int' | 'long' | 'float' | 'double' | 'string';\n\n/** A declared GraphML key and its default. */\ntype GraphMLKeyDefinition = {\n /** Key identifier. */\n id: string;\n /** Application attribute name. */\n name: string;\n /** Elements to which defaults apply. */\n domain: GraphMLDomain;\n /** Declared scalar type. */\n type: GraphMLAttributeType;\n /** Typed default value. */\n defaultValue?: unknown;\n};\n\n/** XML element representation emitted by fast-xml-parser. */\ntype GraphMLObject = Record<string, unknown> & {\n /** Element text content. */\n [XML_TEXT_KEY]?: string;\n};\n\nconst graphmlParser = new XMLParser({\n ignoreAttributes: false,\n attributeNamePrefix: XML_ATTRIBUTE_PREFIX,\n textNodeName: XML_TEXT_KEY,\n trimValues: true,\n parseAttributeValue: false,\n parseTagValue: false,\n removeNSPrefix: true\n});\n\n/** Accepted GraphML document inputs. */\nexport type GraphMLInput = string | ArrayBuffer | Uint8Array;\n\n/** Parses the first GraphML graph into framework-independent node and edge records. */\nexport function parseGraphML(graphml: GraphMLInput): GraphData {\n const xmlText = decodeGraphML(graphml);\n const document = graphmlParser.parse(xmlText) as GraphMLObject;\n const graphmlRoot = getGraphMLRoot(document);\n if (!graphmlRoot) {\n throw new Error('GraphML document does not contain a <graphml> element.');\n }\n\n const graphElement = getGraphElement(graphmlRoot);\n if (!graphElement) {\n throw new Error('GraphML document does not contain a <graph> element.');\n }\n\n const keyDefinitions = collectKeyDefinitions(graphmlRoot, graphElement);\n const defaultDirected = parseEdgeDefault(graphElement[`${XML_ATTRIBUTE_PREFIX}edgedefault`]);\n\n const nodes = normalizeArray(graphElement.node).map((node) => parseNode(node, keyDefinitions));\n const edges = normalizeArray(graphElement.edge).map((edge, index) =>\n parseEdge(edge, index, keyDefinitions, defaultDirected)\n );\n\n const filteredNodes = nodes.filter((node): node is GraphNode => Boolean(node));\n const filteredEdges = edges.filter((edge): edge is GraphEdge => Boolean(edge));\n\n return {\n shape: 'plain-graph-data',\n nodes: filteredNodes,\n edges: filteredEdges\n } satisfies GraphData;\n}\n\n/** Decodes text or UTF-8 binary input. */\nfunction decodeGraphML(graphml: GraphMLInput): string {\n if (typeof graphml === 'string') {\n return graphml;\n }\n\n if (graphml instanceof Uint8Array) {\n return new TextDecoder().decode(graphml);\n }\n\n if (graphml instanceof ArrayBuffer) {\n return new TextDecoder().decode(new Uint8Array(graphml));\n }\n\n throw new Error('Unsupported GraphML input. Expected a string, ArrayBuffer, or Uint8Array.');\n}\n\n/** Finds the GraphML document root. */\nfunction getGraphMLRoot(document: GraphMLObject): GraphMLObject | null {\n const root = document.graphml;\n if (isObject(root)) {\n return root;\n }\n\n return null;\n}\n\n/** Selects the first graph element. */\nfunction getGraphElement(graphmlRoot: GraphMLObject): GraphMLObject | null {\n const graph = graphmlRoot.graph;\n if (!graph) {\n return null;\n }\n\n if (Array.isArray(graph)) {\n const firstGraph = graph.find((entry) => isObject(entry));\n return isObject(firstGraph) ? firstGraph : null;\n }\n\n return isObject(graph) ? graph : null;\n}\n\n/** Collects scoped keys and typed defaults. */\nfunction collectKeyDefinitions(\n graphmlRoot: GraphMLObject,\n graphElement: GraphMLObject\n): Map<string, GraphMLKeyDefinition> {\n const keys = new Map<string, GraphMLKeyDefinition>();\n\n for (const candidate of [\n ...normalizeArray(graphmlRoot.key),\n ...normalizeArray(graphElement.key)\n ]) {\n if (isObject(candidate)) {\n const id = String(candidate[`${XML_ATTRIBUTE_PREFIX}id`] ?? '').trim();\n if (id) {\n const domain = normalizeDomain(candidate[`${XML_ATTRIBUTE_PREFIX}for`]);\n const name = String(candidate[`${XML_ATTRIBUTE_PREFIX}attr.name`] ?? id).trim();\n const type = normalizeType(candidate[`${XML_ATTRIBUTE_PREFIX}attr.type`]);\n const defaultNode = candidate.default ?? null;\n const defaultValue = defaultNode !== null ? castDataValue(defaultNode, type) : undefined;\n\n keys.set(id, {id, domain, name, type, defaultValue});\n }\n }\n }\n\n return keys;\n}\n\n/** Converts a node element into a graph record. */\nfunction parseNode(\n node: unknown,\n keyDefinitions: Map<string, GraphMLKeyDefinition>\n): GraphNode | null {\n if (!isObject(node)) {\n return null;\n }\n\n const id = node[`${XML_ATTRIBUTE_PREFIX}id`];\n if (typeof id !== 'string') {\n return null;\n }\n\n const attributes = buildAttributeBag('node', node.data, keyDefinitions);\n\n const graphNode: GraphNode = {\n id,\n attributes: Object.keys(attributes).length > 0 ? attributes : undefined\n };\n\n const label = attributes.label;\n if (typeof label === 'string') {\n graphNode.label = label;\n }\n\n return graphNode;\n}\n\n/** Converts an edge element with its effective direction. */\nfunction parseEdge(\n edge: unknown,\n index: number,\n keyDefinitions: Map<string, GraphMLKeyDefinition>,\n defaultDirected: boolean\n): GraphEdge | null {\n if (!isObject(edge)) {\n return null;\n }\n\n const sourceId = edge[`${XML_ATTRIBUTE_PREFIX}source`];\n const targetId = edge[`${XML_ATTRIBUTE_PREFIX}target`];\n if (typeof sourceId !== 'string') {\n return null;\n }\n if (typeof targetId !== 'string') {\n return null;\n }\n\n const rawId = edge[`${XML_ATTRIBUTE_PREFIX}id`];\n const id = typeof rawId === 'string' ? rawId : `edge-${index}`;\n const directed = parseDirected(edge[`${XML_ATTRIBUTE_PREFIX}directed`], defaultDirected);\n const attributes = buildAttributeBag('edge', edge.data, keyDefinitions);\n\n const graphEdge: GraphEdge = {\n id,\n sourceId,\n targetId,\n directed,\n attributes: Object.keys(attributes).length > 0 ? attributes : undefined\n };\n\n const label = attributes.label;\n if (typeof label === 'string') {\n graphEdge.label = label;\n }\n\n return graphEdge;\n}\n\n/** Applies scoped defaults followed by explicit data values. */\nfunction buildAttributeBag(\n domain: GraphMLDomain,\n data: unknown,\n keyDefinitions: Map<string, GraphMLKeyDefinition>\n): Record<string, unknown> {\n const attributes: Record<string, unknown> = Object.create(null);\n\n for (const key of keyDefinitions.values()) {\n if (key.domain === 'all' || key.domain === domain) {\n if (key.defaultValue !== undefined) {\n attributes[key.name] = key.defaultValue;\n }\n }\n }\n\n for (const entry of normalizeArray(data)) {\n assignAttributeFromDataEntry(entry, keyDefinitions, attributes);\n }\n\n return attributes;\n}\n\n/** Assigns a data value using its declared key or original key ID. */\nfunction assignAttributeFromDataEntry(\n entry: unknown,\n keyDefinitions: Map<string, GraphMLKeyDefinition>,\n attributes: Record<string, unknown>\n): void {\n if (!isObject(entry)) {\n return;\n }\n\n const keyId = entry[`${XML_ATTRIBUTE_PREFIX}key`];\n if (typeof keyId !== 'string') {\n return;\n }\n\n const definition = keyDefinitions.get(keyId);\n const attributeName = definition?.name ?? keyId;\n const value = castDataValue(entry, definition?.type ?? 'string');\n if (value !== undefined) {\n attributes[attributeName] = value;\n }\n}\n\n/** Converts GraphML scalar types while preserving unparseable numeric text. */\nfunction castDataValue(value: unknown, type: GraphMLAttributeType): unknown {\n if (value === null || typeof value === 'undefined') {\n return undefined;\n }\n\n const text = extractTextContent(value);\n if (text === undefined) {\n return undefined;\n }\n\n if (type === 'boolean') {\n return parseBoolean(text);\n }\n if (type === 'int' || type === 'long') {\n const parsed = Number.parseInt(text, 10);\n return Number.isNaN(parsed) ? text : parsed;\n }\n if (type === 'float' || type === 'double') {\n const parsed = Number.parseFloat(text);\n return Number.isNaN(parsed) ? text : parsed;\n }\n return text;\n}\n\n/** Extracts scalar text or serializes structured vendor data. */\nfunction extractTextContent(value: unknown): string | undefined {\n if (typeof value === 'string') {\n return value;\n }\n\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n\n if (Array.isArray(value)) {\n return extractTextContent(value[0]);\n }\n\n if (isObject(value)) {\n const text = value[XML_TEXT_KEY];\n if (typeof text === 'string') {\n return text;\n }\n\n const nonAttributeEntries = Object.entries(value).filter(\n ([key]) => !key.startsWith(XML_ATTRIBUTE_PREFIX)\n );\n if (nonAttributeEntries.length === 0) {\n return undefined;\n }\n return JSON.stringify(Object.fromEntries(nonAttributeEntries));\n }\n\n return undefined;\n}\n\n/** Normalizes singleton and repeated XML elements. */\nfunction normalizeArray<T>(value: T | T[] | null | undefined): T[] {\n if (!value) {\n return [];\n }\n return Array.isArray(value) ? value : [value];\n}\n\n/** Tests whether a value is an XML element object. */\nfunction isObject(value: unknown): value is GraphMLObject {\n return Boolean(value) && typeof value === 'object' && !Array.isArray(value);\n}\n\n/** Normalizes a key scope, defaulting to all elements. */\nfunction normalizeDomain(value: unknown): GraphMLDomain {\n if (typeof value !== 'string') {\n return 'all';\n }\n\n const lower = value.toLowerCase();\n if (lower === 'node' || lower === 'edge' || lower === 'graph' || lower === 'all') {\n return lower;\n }\n return 'all';\n}\n\n/** Normalizes supported GraphML scalar types. */\nfunction normalizeType(value: unknown): GraphMLAttributeType {\n if (typeof value !== 'string') {\n return 'string';\n }\n\n const lower = value.toLowerCase();\n if (\n lower === 'boolean' ||\n lower === 'int' ||\n lower === 'long' ||\n lower === 'float' ||\n lower === 'double'\n ) {\n return lower;\n }\n return 'string';\n}\n\n/** Converts an edge element with its effective direction. */\n/** Reads the graph-wide default edge direction. */\nfunction parseEdgeDefault(value: unknown): boolean {\n if (typeof value !== 'string') {\n return false;\n }\n return value.toLowerCase() !== 'undirected';\n}\n\n/** Reads an edge direction override. */\nfunction parseDirected(value: unknown, defaultDirected: boolean): boolean {\n if (typeof value === 'string') {\n const normalized = value.trim().toLowerCase();\n if (\n normalized === 'true' ||\n normalized === '1' ||\n normalized === 'yes' ||\n normalized === 'directed'\n ) {\n return true;\n }\n if (\n normalized === 'false' ||\n normalized === '0' ||\n normalized === 'no' ||\n normalized === 'undirected'\n ) {\n return false;\n }\n }\n return defaultDirected;\n}\n\n/** Converts common boolean spellings. */\nfunction parseBoolean(value: string): boolean {\n const normalized = value.trim().toLowerCase();\n if (normalized === 'true' || normalized === '1' || normalized === 'yes' || normalized === 'y') {\n return true;\n }\n if (normalized === 'false' || normalized === '0' || normalized === 'no' || normalized === 'n') {\n return false;\n }\n return Boolean(value);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {GraphMLLoader} from './graphml-loader-types';\nimport {parseGraphML} from './lib/parse-graphml';\n\n/** Parser-bearing loader for synchronous and asynchronous GraphML parsing. */\nexport const GraphMLLoaderWithParser = {\n ...GraphMLLoader,\n parse: async (data: ArrayBuffer) => parseGraphML(data),\n parseSync: parseGraphML,\n parseTextSync: parseGraphML\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader} from '@loaders.gl/loader-utils';\nimport type {DOTGraphData} from './dot-types';\n\n// @ts-ignore __VERSION__ is injected by the build.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/** Metadata-only loader for Graphviz DOT documents. */\nexport const DOTLoader = {\n name: 'DOT',\n id: 'dot',\n module: 'graphs',\n version: VERSION,\n extensions: ['dot', 'gv'],\n mimeTypes: ['text/vnd.graphviz', 'text/x-graphviz', 'application/vnd.graphviz'],\n text: true,\n worker: false,\n dataType: null as unknown as DOTGraphData,\n batchType: null as never,\n options: {}\n} as const satisfies Loader<DOTGraphData, never>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {DOTGraphData} from '../dot-types';\n\n/** Internal DOT parsing representation. */\ntype DOTAttributeMap = Record<string, unknown>;\n\n/** Internal DOT parsing representation. */\ntype ParsedNode = {\n /** Id in the DOT parse state. */\n id: string;\n /** Attributes in the DOT parse state. */\n attributes: DOTAttributeMap;\n /** Subgraphs in the DOT parse state. */\n subgraphs: Set<string>;\n};\n\n/** Internal DOT parsing representation. */\ntype ParsedEdge = {\n /** Id in the DOT parse state. */\n id: string;\n /** SourceId in the DOT parse state. */\n sourceId: string;\n /** TargetId in the DOT parse state. */\n targetId: string;\n /** Directed in the DOT parse state. */\n directed: boolean;\n /** Attributes in the DOT parse state. */\n attributes: DOTAttributeMap;\n /** Subgraphs in the DOT parse state. */\n subgraphs: string[];\n};\n\n/** Internal DOT parsing representation. */\ntype ParsedSubgraph = {\n /** Id in the DOT parse state. */\n id: string;\n /** Attributes in the DOT parse state. */\n attributes: DOTAttributeMap;\n /** ParentId in the DOT parse state. */\n parentId?: string | null;\n};\n\n/** Internal DOT parsing representation. */\ntype DOTParseResult = {\n /** Id in the DOT parse state. */\n id?: string;\n /** Directed in the DOT parse state. */\n directed: boolean;\n /** Strict in the DOT parse state. */\n strict: boolean;\n /** GraphAttributes in the DOT parse state. */\n graphAttributes: DOTAttributeMap;\n /** Nodes in the DOT parse state. */\n nodes: Map<string, ParsedNode>;\n /** Edges in the DOT parse state. */\n edges: ParsedEdge[];\n /** Subgraphs in the DOT parse state. */\n subgraphs: Map<string, ParsedSubgraph>;\n};\n\n/** Parses DOT source into plain graph records without a visualization dependency. */\nexport function parseDOT(input: string): DOTGraphData {\n const parsed = parseDOTDocument(input);\n const subgraphs = Array.from(parsed.subgraphs.values(), (subgraph) => ({\n ...subgraph,\n attributes: {...subgraph.attributes}\n }));\n return {\n shape: 'plain-graph-data',\n nodes: Array.from(parsed.nodes.values(), (node) => ({\n id: node.id,\n ...(typeof node.attributes.label === 'string' ? {label: node.attributes.label} : {}),\n attributes: {\n ...node.attributes,\n ...(node.subgraphs.size\n ? {subgraphs: Array.from(node.subgraphs, (id) => describeSubgraph(id, parsed.subgraphs))}\n : {})\n }\n })),\n edges: parsed.edges.map((edge) => ({\n id: edge.id,\n sourceId: edge.sourceId,\n targetId: edge.targetId,\n directed: edge.directed,\n ...(typeof edge.attributes.label === 'string' ? {label: edge.attributes.label} : {}),\n attributes: {\n ...edge.attributes,\n ...(edge.subgraphs.length\n ? {subgraphs: edge.subgraphs.map((id) => describeSubgraph(id, parsed.subgraphs))}\n : {})\n }\n })),\n metadata: {\n id: parsed.id,\n directed: parsed.directed,\n strict: parsed.strict,\n attributes: {...parsed.graphAttributes},\n subgraphs\n }\n };\n}\n\n/** Copies a subgraph descriptor into node or edge attributes. */\nfunction describeSubgraph(\n id: string,\n descriptors: Map<string, ParsedSubgraph>\n): {id: string; attributes: DOTAttributeMap; parentId?: string | null} {\n const subgraph = descriptors.get(id)!;\n return {\n id,\n attributes: {...subgraph.attributes},\n parentId: subgraph.parentId\n };\n}\n\n/** Internal DOT parsing representation. */\ntype TokenType =\n | 'identifier'\n | 'string'\n | 'html'\n | 'arrow'\n | 'lbrace'\n | 'rbrace'\n | 'lbrack'\n | 'rbrack'\n | 'equals'\n | 'comma'\n | 'semicolon';\n\n/** Internal DOT parsing representation. */\ntype Token = {\n /** Type in the DOT parse state. */\n type: TokenType;\n /** Value in the DOT parse state. */\n value: string;\n};\n\n/** Internal DOT parsing representation. */\ntype ScopeContext = {\n /** Id in the DOT parse state. */\n id?: string;\n /** NodeDefaults in the DOT parse state. */\n nodeDefaults: DOTAttributeMap;\n /** EdgeDefaults in the DOT parse state. */\n edgeDefaults: DOTAttributeMap;\n /** GraphAttributes in the DOT parse state. */\n graphAttributes: DOTAttributeMap;\n};\n\n/** Recursive parser for the supported DOT statement subset. */\nclass DOTParser {\n /** Tokens for DOT parsing. */\n private readonly tokens: Token[];\n /** Position for DOT parsing. */\n private position = 0;\n /** Accumulated graph records and attributes. */\n private readonly result: DOTParseResult = {\n directed: false,\n strict: false,\n graphAttributes: Object.create(null),\n nodes: new Map(),\n edges: [],\n subgraphs: new Map()\n };\n\n /** Scopes for DOT parsing. */\n private readonly scopes: ScopeContext[] = [\n {\n nodeDefaults: Object.create(null),\n edgeDefaults: Object.create(null),\n graphAttributes: Object.create(null)\n }\n ];\n\n /** Subgraph counter for DOT parsing. */\n private subgraphCounter = 0;\n /** Edge counter for DOT parsing. */\n private edgeCounter = 0;\n\n /** Edge lookup used to coalesce parallel edges in strict graphs. */\n private readonly strictEdges = new Map<string, ParsedEdge>();\n\n /** Persistent attributes and defaults for reopened named subgraphs. */\n private readonly subgraphScopes = new Map<string, ScopeContext>();\n\n /** Explicit names reserved so anonymous subgraph IDs cannot collide with them. */\n private readonly namedSubgraphIds = new Set<string>();\n\n /** Initializes the token stream. */\n constructor(tokens: Token[]) {\n this.tokens = tokens;\n for (let index = 0; index < tokens.length - 1; index++) {\n if (isKeyword(tokens[index], 'subgraph') && isIdentifierLike(tokens[index + 1])) {\n this.namedSubgraphIds.add(tokens[index + 1].value);\n }\n }\n }\n\n /** Parses one complete DOT document. */\n parse(): DOTParseResult {\n this.parseGraph();\n this.consumeOptionalSemicolon();\n if (this.peek()) {\n throw new Error('Unexpected content after DOT graph.');\n }\n return this.result;\n }\n\n /** Reads graph identity, declaration, and statements. */\n private parseGraph(): void {\n const strictToken = this.peek();\n if (strictToken && isKeyword(strictToken, 'strict')) {\n this.consume();\n this.result.strict = true;\n }\n\n const typeToken = this.peek();\n if (!typeToken || !isGraphType(typeToken)) {\n throw new Error('DOT graph must start with graph or digraph keyword.');\n }\n this.consume();\n this.result.directed = isKeyword(typeToken, 'digraph');\n\n const idToken = this.peek();\n if (idToken && isIdentifierLike(idToken)) {\n this.result.id = parseIdentifierValue(this.consume());\n }\n\n this.expect('lbrace');\n while (!this.match('rbrace')) {\n if (!this.parseStatement()) {\n throw new Error('Expected closing brace in DOT graph.');\n }\n }\n this.result.graphAttributes = {...this.scopes[0].graphAttributes};\n }\n\n /** Dispatches a graph statement. */\n private parseStatement(): boolean {\n if (this.consumeSemicolonIfPresent()) {\n return true;\n }\n\n const token = this.peek();\n if (!token) {\n return false;\n }\n\n if (this.tryParseSubgraphStatement(token)) {\n return true;\n }\n\n if (this.tryParseKeywordStatement(token)) {\n return true;\n }\n\n if (this.tryParseAssignmentStatement(token)) {\n return true;\n }\n\n if (isIdentifierLike(token)) {\n this.parseNodeOrEdgeStatement();\n this.consumeOptionalSemicolon();\n return true;\n }\n\n throw new Error(`Unexpected token: ${token.value}`);\n }\n\n /** Consumes an empty statement. */\n private consumeSemicolonIfPresent(): boolean {\n const next = this.peek();\n if (next?.type === 'semicolon') {\n this.consume();\n return true;\n }\n return false;\n }\n\n /** Reads a standalone subgraph statement. */\n private tryParseSubgraphStatement(token: Token): boolean {\n if (token.type !== 'lbrace' && !isKeyword(token, 'subgraph')) {\n return false;\n }\n this.parseSubgraph();\n return true;\n }\n\n /** Applies graph, node, or edge defaults. */\n private tryParseKeywordStatement(token: Token): boolean {\n if (!(isKeyword(token, 'graph') || isKeyword(token, 'node') || isKeyword(token, 'edge'))) {\n return false;\n }\n\n this.consume();\n const explicitAttributes = this.parseAttributeList();\n\n if (isKeyword(token, 'graph')) {\n Object.assign(this.currentScope().graphAttributes, explicitAttributes);\n } else if (isKeyword(token, 'node')) {\n Object.assign(this.currentScope().nodeDefaults, explicitAttributes);\n } else {\n Object.assign(this.currentScope().edgeDefaults, explicitAttributes);\n }\n\n this.consumeOptionalSemicolon();\n return true;\n }\n\n /** Reads a graph attribute assignment. */\n private tryParseAssignmentStatement(token: Token): boolean {\n if (!isIdentifierLike(token)) {\n return false;\n }\n const next = this.peek(1);\n if (next?.type !== 'equals') {\n return false;\n }\n\n const key = parseIdentifierValue(this.consume());\n this.consume();\n const valueToken = this.consume();\n const value = parseAttributeValue(valueToken);\n this.currentScope().graphAttributes[key] = value;\n this.consumeOptionalSemicolon();\n return true;\n }\n\n /** Reads a node statement or chained edges. */\n private parseNodeOrEdgeStatement(): void {\n const first = parseIdentifierValue(this.consume());\n const references: string[] = [first];\n const operators: string[] = [];\n\n let operatorToken = this.match('arrow');\n while (operatorToken) {\n operators.push(operatorToken.value);\n const referenceToken = this.consume();\n if (!isIdentifierLike(referenceToken)) {\n throw new Error('Expected node identifier in edge statement.');\n }\n references.push(parseIdentifierValue(referenceToken));\n operatorToken = this.match('arrow');\n }\n\n if (operators.length === 0) {\n const explicitAttributes = this.parseAttributeList();\n this.addNode(first, explicitAttributes);\n return;\n }\n\n const explicitAttributes = this.parseAttributeList();\n this.addEdgeChain(references, operators, explicitAttributes);\n }\n\n /** Merges explicit attributes into a node. */\n private addNode(id: string, explicitAttributes: DOTAttributeMap): void {\n const membership = this.getCurrentSubgraphChain();\n const node = this.ensureNode(id, membership);\n node.attributes = {...node.attributes, ...explicitAttributes};\n }\n\n /** Expands an edge chain into node and edge records. */\n private addEdgeChain(\n nodes: string[],\n operators: string[],\n explicitAttributes: DOTAttributeMap\n ): void {\n const membership = this.getCurrentSubgraphChain();\n const defaults = this.currentScope().edgeDefaults;\n const attributes = {...defaults, ...explicitAttributes};\n\n for (let index = 0; index < nodes.length - 1; index++) {\n const sourceId = nodes[index];\n const targetId = nodes[index + 1];\n const operator = operators[index];\n const directed = operator === '->';\n if (directed !== this.result.directed) {\n throw new Error('DOT edge operator must match graph or digraph declaration.');\n }\n\n const edgeId = deriveEdgeId(attributes, sourceId, targetId, ++this.edgeCounter);\n const edgeAttributes = {...attributes};\n this.ensureNode(sourceId, membership);\n this.ensureNode(targetId, membership);\n\n const strictKey = JSON.stringify(\n directed ? [sourceId, targetId] : [sourceId, targetId].sort()\n );\n const existingEdge = this.result.strict ? this.strictEdges.get(strictKey) : undefined;\n if (existingEdge) {\n existingEdge.attributes = {...existingEdge.attributes, ...explicitAttributes};\n existingEdge.directed = deriveDirectedFlag(existingEdge.attributes, directed);\n existingEdge.subgraphs = Array.from(new Set([...existingEdge.subgraphs, ...membership]));\n continue;\n }\n const directedOverride = deriveDirectedFlag(edgeAttributes, directed);\n const edge: ParsedEdge = {\n id: edgeId,\n sourceId,\n targetId,\n directed: directedOverride,\n attributes: edgeAttributes,\n subgraphs: membership\n };\n this.result.edges.push(edge);\n if (this.result.strict) {\n this.strictEdges.set(strictKey, edge);\n }\n }\n }\n\n /** Reads a nested scope with inherited defaults. */\n private parseSubgraph(): void {\n let idToken = this.peek();\n let subgraphId: string;\n\n if (idToken && isKeyword(idToken, 'subgraph')) {\n this.consume();\n idToken = this.peek();\n }\n\n if (idToken && isIdentifierLike(idToken)) {\n subgraphId = parseIdentifierValue(this.consume());\n } else {\n do {\n subgraphId = `subgraph_${++this.subgraphCounter}`;\n } while (this.namedSubgraphIds.has(subgraphId));\n }\n\n this.expect('lbrace');\n const parentId = this.findCurrentSubgraphId();\n let context = this.subgraphScopes.get(subgraphId);\n if (!context) {\n context = {\n id: subgraphId,\n nodeDefaults: Object.assign(Object.create(null), this.currentScope().nodeDefaults),\n edgeDefaults: Object.assign(Object.create(null), this.currentScope().edgeDefaults),\n graphAttributes: Object.create(null)\n };\n this.subgraphScopes.set(subgraphId, context);\n this.result.subgraphs.set(subgraphId, {\n id: subgraphId,\n attributes: context.graphAttributes,\n parentId\n });\n }\n this.scopes.push(context);\n\n let shouldContinue = true;\n while (shouldContinue) {\n if (this.match('rbrace')) {\n break;\n }\n shouldContinue = this.parseStatement();\n if (!shouldContinue) {\n throw new Error('Expected closing brace in DOT subgraph.');\n }\n }\n\n this.scopes.pop();\n }\n\n /** Reads repeated attribute lists. */\n private parseAttributeList(): DOTAttributeMap {\n const attributes: DOTAttributeMap = Object.create(null);\n while (this.match('lbrack')) {\n while (!this.match('rbrack')) {\n const keyToken = this.consume();\n if (!isIdentifierLike(keyToken)) {\n throw new Error('Expected attribute name.');\n }\n const key = parseIdentifierValue(keyToken);\n let value: unknown = true;\n if (this.match('equals')) {\n const valueToken = this.consume();\n value = parseAttributeValue(valueToken);\n }\n attributes[key] = value;\n if (this.peek()?.type === 'comma' || this.peek()?.type === 'semicolon') {\n this.consume();\n }\n }\n }\n return attributes;\n }\n\n /** Creates an implicit node and records its subgraph memberships. */\n private ensureNode(id: string, membership: string[]): ParsedNode {\n let node = this.result.nodes.get(id);\n if (!node) {\n const defaults = this.currentScope().nodeDefaults;\n node = {id, attributes: {...defaults}, subgraphs: new Set()};\n this.result.nodes.set(id, node);\n }\n membership.forEach((subgraphId) => node.subgraphs.add(subgraphId));\n return node;\n }\n\n /** Lists enclosing subgraphs. */\n private getCurrentSubgraphChain(): string[] {\n const chain: string[] = [];\n for (const scope of this.scopes) {\n if (scope.id) {\n chain.push(scope.id);\n }\n }\n return chain;\n }\n\n /** Finds the nearest enclosing named or generated subgraph. */\n private findCurrentSubgraphId(): string | undefined {\n for (let index = this.scopes.length - 1; index >= 0; index--) {\n const scope = this.scopes[index];\n if (scope.id) {\n return scope.id;\n }\n }\n return undefined;\n }\n\n /** Returns the active attribute scope. */\n private currentScope(): ScopeContext {\n return this.scopes[this.scopes.length - 1];\n }\n\n /** Consumes an optional statement terminator. */\n private consumeOptionalSemicolon(): void {\n const next = this.peek();\n if (next?.type === 'semicolon') {\n this.consume();\n }\n }\n\n /** Requires the next token to have the requested type. */\n private expect(type: TokenType): Token {\n const token = this.consume();\n if (!token || token.type !== type) {\n throw new Error(`Expected token ${type}.`);\n }\n return token;\n }\n\n /** Consumes the next token or reports truncated input. */\n private consume(): Token {\n const token = this.tokens[this.position];\n if (!token) {\n throw new Error('Unexpected end of DOT input.');\n }\n this.position++;\n return token;\n }\n\n /** Consumes a token when its type matches. */\n private match(type: TokenType): Token | null {\n const token = this.peek();\n if (token && token.type === type) {\n this.position++;\n return token;\n }\n return null;\n }\n\n /** Inspects a token without consuming it. */\n private peek(offset = 0): Token | null {\n return this.tokens[this.position + offset] ?? null;\n }\n}\n\n/** Tokenizes and parses a DOT document. */\nfunction parseDOTDocument(input: string): DOTParseResult {\n const parser = new DOTParser(tokenize(input));\n return parser.parse();\n}\n\nconst IDENTIFIER_TERMINATORS = new Set(['{', '}', '[', ']', '=', ';', ',', '\"', '<', '#']);\n\n/** Builds a token stream from DOT text. */\nfunction tokenize(input: string): Token[] {\n const tokens: Token[] = [];\n let index = 0;\n\n while (index < input.length) {\n const {token, nextIndex} = readNextToken(input, index);\n if (nextIndex <= index) {\n throw new Error(`Tokenizer did not advance at position ${index}.`);\n }\n if (token) {\n tokens.push(token);\n }\n index = nextIndex;\n }\n\n return tokens;\n}\n\n/** Reads a token or skips whitespace and comments. */\nfunction readNextToken(input: string, index: number): {token: Token | null; nextIndex: number} {\n if (index >= input.length) {\n return {token: null, nextIndex: input.length};\n }\n\n const character = input[index];\n\n if (isWhitespace(character)) {\n return {token: null, nextIndex: index + 1};\n }\n\n const commentEnd = skipComment(input, index);\n if (commentEnd !== null) {\n return {token: null, nextIndex: commentEnd};\n }\n\n const arrowToken = readArrowToken(input, index);\n if (arrowToken) {\n return arrowToken;\n }\n\n const punctuation = readPunctuationToken(character);\n if (punctuation) {\n return {token: punctuation, nextIndex: index + 1};\n }\n\n if (character === '\"') {\n const {value, nextIndex} = readQuotedString(input, index + 1);\n return {token: {type: 'string', value}, nextIndex};\n }\n\n if (character === '<') {\n const {value, nextIndex} = readHtmlString(input, index + 1);\n return {token: {type: 'html', value}, nextIndex};\n }\n\n const identifier = readIdentifier(input, index);\n if (identifier.value) {\n return {\n token: {type: 'identifier', value: identifier.value},\n nextIndex: identifier.nextIndex\n };\n }\n\n throw new Error(`Unexpected token at position ${index}.`);\n}\n\n/** Skips line, block, or hash comments. */\nfunction skipComment(input: string, index: number): number | null {\n const character = input[index];\n if (character === '/') {\n const next = input[index + 1];\n if (next === '/') {\n return skipLineComment(input, index + 2);\n }\n if (next === '*') {\n return skipBlockComment(input, index + 2);\n }\n return null;\n }\n\n if (character === '#') {\n return skipLineComment(input, index + 1);\n }\n\n return null;\n}\n\n/** Scans to the next line break. */\nfunction skipLineComment(input: string, startIndex: number): number {\n let cursor = startIndex;\n while (cursor < input.length && !isLineBreak(input[cursor])) {\n cursor++;\n }\n return cursor;\n}\n\n/** Scans to a block comment terminator. */\nfunction skipBlockComment(input: string, startIndex: number): number {\n let cursor = startIndex;\n while (cursor < input.length) {\n if (input[cursor] === '*' && input[cursor + 1] === '/') {\n return cursor + 2;\n }\n cursor++;\n }\n throw new Error('Unterminated block comment in DOT source.');\n}\n\n/** Recognizes directed and undirected edge operators. */\nfunction readArrowToken(input: string, index: number): {token: Token; nextIndex: number} | null {\n const next = input[index + 1];\n if (input[index] === '-' && next === '-') {\n return {token: {type: 'arrow', value: '--'}, nextIndex: index + 2};\n }\n if (input[index] === '-' && next === '>') {\n return {token: {type: 'arrow', value: '->'}, nextIndex: index + 2};\n }\n return null;\n}\n\n/** Recognizes DOT structural punctuation. */\nfunction readPunctuationToken(character: string): Token | null {\n switch (character) {\n case '{':\n return {type: 'lbrace', value: character};\n case '}':\n return {type: 'rbrace', value: character};\n case '[':\n return {type: 'lbrack', value: character};\n case ']':\n return {type: 'rbrack', value: character};\n case '=':\n return {type: 'equals', value: character};\n case ',':\n return {type: 'comma', value: character};\n case ';':\n return {type: 'semicolon', value: character};\n default:\n return null;\n }\n}\n\n/** Reads a quoted string and decodes its escapes. */\nfunction readQuotedString(input: string, startIndex: number): {value: string; nextIndex: number} {\n let value = '';\n let index = startIndex;\n while (index < input.length) {\n const character = input[index];\n if (character === '\"') {\n return {value, nextIndex: index + 1};\n }\n if (character === '\\\\') {\n const escape = readEscapedCharacter(input, index + 1);\n value += escape.value;\n index = escape.nextIndex;\n } else {\n value += character;\n index++;\n }\n }\n throw new Error('Unterminated string literal in DOT source.');\n}\n\n/** Decodes one quoted-string escape. */\nfunction readEscapedCharacter(\n input: string,\n startIndex: number\n): {value: string; nextIndex: number} {\n const next = input[startIndex];\n switch (next) {\n case 'n':\n case 'l':\n case 'L':\n return {value: '\\n', nextIndex: startIndex + 1};\n case 't':\n return {value: '\\t', nextIndex: startIndex + 1};\n case 'r':\n return {value: '\\r', nextIndex: startIndex + 1};\n case '\"':\n return {value: '\"', nextIndex: startIndex + 1};\n case '\\\\':\n return {value: '\\\\', nextIndex: startIndex + 1};\n default: {\n if (typeof next === 'undefined') {\n throw new Error('Unterminated escape sequence in DOT source.');\n }\n return {value: next, nextIndex: startIndex + 1};\n }\n }\n}\n\n/** Reads a balanced HTML-like label. */\nfunction readHtmlString(input: string, startIndex: number): {value: string; nextIndex: number} {\n let value = '<';\n let depth = 1;\n let index = startIndex;\n while (index < input.length) {\n const character = input[index];\n value += character;\n if (character === '<') {\n depth++;\n } else if (character === '>') {\n depth--;\n if (depth === 0) {\n return {value, nextIndex: index + 1};\n }\n }\n index++;\n }\n throw new Error('Unterminated HTML-like string literal in DOT source.');\n}\n\n/** Reads an unquoted identifier. */\nfunction readIdentifier(input: string, startIndex: number): {value: string; nextIndex: number} {\n let index = startIndex;\n let value = '';\n while (index < input.length && !isIdentifierTerminator(input, index)) {\n value += input[index];\n index++;\n }\n if (value.includes(':')) {\n throw new Error('DOT node ports are not supported; quote identifiers containing colons.');\n }\n /** Return {value, nextIndex in the DOT parse state. */\n return {value, nextIndex: index};\n}\n\n/** Tests whether a character terminates an identifier. */\nfunction isIdentifierTerminator(input: string, index: number): boolean {\n const character = input[index];\n if (isWhitespace(character) || IDENTIFIER_TERMINATORS.has(character)) {\n return true;\n }\n if (isArrowOperatorStart(input, index)) {\n return true;\n }\n if (isCommentStart(input, index)) {\n return true;\n }\n return false;\n}\n\n/** Tests whether an edge operator starts at this position. */\nfunction isArrowOperatorStart(input: string, index: number): boolean {\n if (input[index] !== '-') {\n return false;\n }\n const next = input[index + 1];\n return next === '-' || next === '>';\n}\n\n/** Tests whether a slash comment starts at this position. */\nfunction isCommentStart(input: string, index: number): boolean {\n if (input[index] !== '/') {\n return false;\n }\n const next = input[index + 1];\n return next === '/' || next === '*';\n}\n\n/** Recognizes supported whitespace characters. */\nfunction isWhitespace(character: string): boolean {\n return (\n character === ' ' ||\n character === '\\n' ||\n character === '\\r' ||\n character === '\\t' ||\n character === '\\f'\n );\n}\n\n/** Recognizes a line break. */\nfunction isLineBreak(character: string): boolean {\n return character === '\\n' || character === '\\r';\n}\n\n/** Matches an unquoted keyword case-insensitively. */\nfunction isKeyword(token: Token, keyword: string): boolean {\n return token.type === 'identifier' && token.value.toLowerCase() === keyword.toLowerCase();\n}\n\n/** Recognizes graph and digraph declarations. */\nfunction isGraphType(token: Token): boolean {\n return isKeyword(token, 'graph') || isKeyword(token, 'digraph');\n}\n\n/** Tests whether a token can name a node or attribute. */\nfunction isIdentifierLike(token: Token): boolean {\n return token.type === 'identifier' || token.type === 'string' || token.type === 'html';\n}\n\n/** Preserves the text of a DOT identifier. */\nfunction parseIdentifierValue(token: Token): string {\n return token.value;\n}\n\n/** Preserves quoted text and converts unquoted numeric attributes. */\nfunction parseAttributeValue(token: Token): unknown {\n if (token.type === 'string' || token.type === 'html') {\n return token.value;\n }\n if (token.type === 'identifier') {\n const numeric = Number(token.value);\n if (!Number.isNaN(numeric)) {\n return numeric;\n }\n return token.value;\n }\n throw new Error('Invalid attribute value in DOT input.');\n}\n\n/** Uses an explicit ID or generates a stable edge identifier. */\nfunction deriveEdgeId(\n attributes: DOTAttributeMap,\n sourceId: string,\n targetId: string,\n counter: number\n): string {\n const candidate = attributes.id ?? attributes.Id ?? attributes.ID;\n if (typeof candidate === 'string' || typeof candidate === 'number') {\n return String(candidate);\n }\n return `${String(sourceId)}-${String(targetId)}-${counter}`;\n}\n\n/** Applies direction flags over the edge operator default. */\nfunction deriveDirectedFlag(attributes: DOTAttributeMap, defaultDirected: boolean): boolean {\n const candidate = attributes.directed;\n if (typeof candidate === 'boolean') {\n return candidate;\n }\n\n const directionAttribute = attributes.dir;\n if (typeof directionAttribute === 'string') {\n const normalized = directionAttribute.toLowerCase();\n if (normalized === 'none') {\n return false;\n }\n return true;\n }\n\n return defaultDirected;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {DOTLoader} from './dot-loader-types';\nimport {parseDOT} from './lib/parse-dot';\n\n/** Parser-bearing loader for synchronous and asynchronous DOT parsing. */\nexport const DOTLoaderWithParser = {\n ...DOTLoader,\n parse: async (data: ArrayBuffer) => parseDOT(new TextDecoder().decode(data)),\n parseSync: (data: ArrayBuffer) => parseDOT(new TextDecoder().decode(data)),\n parseTextSync: parseDOT\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;ACQA,IAAM,UAAU,OAAoC,UAAe;AAG5D,IAAM,gBAAgB;EA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K;AACpD;AAGA,SAAS,mBAAmB,YAA6B,iBAAwB;AAC/E,QAAM,YAAY,WAAW;AAC7B,MAAI,OAAO,cAAc,WAAW;AAClC,WAAO;EACT;AAEA,QAAM,qBAAqB,WAAW;AACtC,MAAI,OAAO,uBAAuB,UAAU;AAC1C,UAAM,aAAa,mBAAmB,YAAW;AACjD,QAAI,eAAe,QAAQ;AACzB,aAAO;IACT;AACA,WAAO;EACT;AAEA,SAAO;AACT;;;ACn5BO,IAAM,sBAAsB;EACjC,GAAG;EACH,OAAO,OAAO,SAAsB,SAAS,IAAI,YAAW,EAAG,OAAO,IAAI,CAAC;EAC3E,WAAW,CAAC,SAAsB,SAAS,IAAI,YAAW,EAAG,OAAO,IAAI,CAAC;EACzE,eAAe;;",
6
+ "names": ["VERSION", "explicitAttributes"]
7
+ }
@@ -0,0 +1,5 @@
1
+ export { GraphMLLoaderWithParser as GraphMLLoader } from "./graphml-loader.js";
2
+ export type { GraphData, GraphNode, GraphEdge } from "./graph-types.js";
3
+ export { DOTLoaderWithParser as DOTLoader } from "./dot-loader.js";
4
+ export type { DOTGraphData, DOTMetadata, DOTSubgraph } from "./dot-types.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,uBAAuB,IAAI,aAAa,EAAC,4BAAyB;AAC1E,YAAY,EAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAC,yBAAsB;AACnE,OAAO,EAAC,mBAAmB,IAAI,SAAS,EAAC,wBAAqB;AAC9D,YAAY,EAAC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAC,uBAAoB"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ export { GraphMLLoaderWithParser as GraphMLLoader } from "./graphml-loader.js";
5
+ export { DOTLoaderWithParser as DOTLoader } from "./dot-loader.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,uBAAuB,IAAI,aAAa,EAAC,4BAAyB;AAE1E,OAAO,EAAC,mBAAmB,IAAI,SAAS,EAAC,wBAAqB"}
@@ -0,0 +1,4 @@
1
+ import type { DOTGraphData } from "../dot-types.js";
2
+ /** Parses DOT source into plain graph records without a visualization dependency. */
3
+ export declare function parseDOT(input: string): DOTGraphData;
4
+ //# sourceMappingURL=parse-dot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-dot.d.ts","sourceRoot":"","sources":["../../src/lib/parse-dot.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,wBAAqB;AA2D/C,qFAAqF;AACrF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAuCpD"}