Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-graphviz

Package Overview
Dependencies
Maintainers
1
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-graphviz - npm Package Compare versions

Comparing version 0.0.0-pr956-20240225160253 to 0.0.0-pr956-20240225163634

example/runkit.cjs

10

CHANGELOG.md
# ts-graphviz
## 0.0.0-pr956-20240225160253
## 0.0.0-pr956-20240225163634

@@ -300,5 +300,5 @@ ### Major Changes

- Updated dependencies [[`6b2f0e8`](https://github.com/ts-graphviz/ts-graphviz/commit/6b2f0e8349605b4fe0dd950147ba3a8285b24b24)]:
- @ts-graphviz/adapter@0.0.0-pr956-20240225160253
- @ts-graphviz/common@0.0.0-pr956-20240225160253
- @ts-graphviz/core@0.0.0-pr956-20240225160253
- @ts-graphviz/ast@0.0.0-pr956-20240225160253
- @ts-graphviz/adapter@0.0.0-pr956-20240225163634
- @ts-graphviz/common@0.0.0-pr956-20240225163634
- @ts-graphviz/core@0.0.0-pr956-20240225163634
- @ts-graphviz/ast@0.0.0-pr956-20240225163634

@@ -1,237 +0,7 @@

import { RootModelsContext as p, createModelsContext as b, isNodeRefGroupLike as v, toNodeRefGroup as N, toNodeRef as j, isNodeRefLike as l } from "@ts-graphviz/common";
import { registerDefault as l } from "@ts-graphviz/core";
export * from "@ts-graphviz/core";
import { RootModelsContext as d, createModelsContext as y } from "@ts-graphviz/common";
export * from "@ts-graphviz/common";
export * from "@ts-graphviz/core";
import { parse as S, toModel as E, fromModel as $, stringify as G } from "@ts-graphviz/ast";
class h {
}
class f extends h {
/** @hidden */
#e = /* @__PURE__ */ new Map();
constructor(t) {
super(), t !== void 0 && this.apply(t);
}
get values() {
return Array.from(this.#e.entries());
}
get size() {
return this.#e.size;
}
get(t) {
return this.#e.get(t);
}
set(t, e) {
e != null && this.#e.set(t, e);
}
delete(t) {
this.#e.delete(t);
}
apply(t) {
const e = Array.isArray(t) ? t : Object.entries(t);
for (const [s, n] of e)
this.set(s, n);
}
clear() {
this.#e.clear();
}
}
class c extends f {
constructor(t, e) {
super(e), this.$$kind = t;
}
get $$type() {
return "AttributeList";
}
comment;
}
class y extends f {
/** @hidden */
#e = p;
id;
comment;
attributes = Object.freeze({
graph: new c("Graph"),
edge: new c("Edge"),
node: new c("Node")
});
get nodes() {
return Array.from(this.#t.nodes.values());
}
get edges() {
return Array.from(this.#t.edges.values());
}
get subgraphs() {
return Array.from(this.#t.subgraphs.values());
}
/** @hidden */
#t = {
nodes: /* @__PURE__ */ new Map(),
edges: /* @__PURE__ */ new Set(),
subgraphs: /* @__PURE__ */ new Set()
};
with(t) {
this.#e = b(t);
}
addNode(t) {
this.#t.nodes.set(t.id, t);
}
addEdge(t) {
this.#t.edges.add(t);
}
addSubgraph(t) {
this.#t.subgraphs.add(t);
}
existNode(t) {
return this.#t.nodes.has(t);
}
existEdge(t) {
return this.#t.edges.has(t);
}
existSubgraph(t) {
return this.#t.subgraphs.has(t);
}
createSubgraph(...t) {
const e = new this.#e.Subgraph(...t);
return e.with(this.#e), this.addSubgraph(e), e;
}
removeNode(t) {
this.#t.nodes.delete(typeof t == "string" ? t : t.id);
}
removeEdge(t) {
this.#t.edges.delete(t);
}
removeSubgraph(t) {
this.#t.subgraphs.delete(t);
}
createNode(t, e) {
const s = new this.#e.Node(t, e);
return this.addNode(s), s;
}
getSubgraph(t) {
return Array.from(this.#t.subgraphs.values()).find(
(e) => e.id === t
);
}
getNode(t) {
return this.#t.nodes.get(t);
}
createEdge(t, e) {
const s = t.map(
(o) => v(o) ? N(o) : j(o)
), n = new this.#e.Edge(s, e);
return this.addEdge(n), n;
}
subgraph(...t) {
const e = t.find(
(i) => typeof i == "string"
), s = t.find(
(i) => typeof i == "object" && i !== null
), n = t.find(
(i) => typeof i == "function"
), o = e ? this.getSubgraph(e) ?? this.createSubgraph(e) : this.createSubgraph();
return s !== void 0 && o.apply(s), n !== void 0 && n(o), o;
}
node(t, ...e) {
if (typeof t == "string") {
const s = t, n = e.find(
(d) => typeof d == "object" && d !== null
), o = e.find(
(d) => typeof d == "function"
), i = this.getNode(s) ?? this.createNode(s);
return n !== void 0 && i.attributes.apply(n), o !== void 0 && o(i), i;
}
typeof t == "object" && t !== null && this.attributes.node.apply(t);
}
edge(t, ...e) {
if (Array.isArray(t)) {
const s = t, n = e.find(
(d) => typeof d == "object"
), o = e.find(
(d) => typeof d == "function"
), i = this.createEdge(s, n);
return o !== void 0 && o(i), i;
}
typeof t == "object" && t !== null && this.attributes.edge.apply(t);
}
graph(t) {
this.attributes.graph.apply(t);
}
}
class m extends y {
get $$type() {
return "Graph";
}
id;
strict;
constructor(...t) {
super(), this.id = t.find((s) => typeof s == "string"), this.strict = t.find((s) => typeof s == "boolean") ?? !1;
const e = t.find(
(s) => typeof s == "object" && s !== null
);
e !== void 0 && this.apply(e);
}
}
class A extends m {
get directed() {
return !0;
}
}
class w extends f {
comment;
}
class k extends h {
constructor(t, e) {
if (super(), this.targets = t, t.length < 2 && (l(t[0]) && l(t[1])) === !1)
throw Error(
"The element of Edge target is missing or not satisfied as Edge target."
);
this.attributes = new w(e);
}
get $$type() {
return "Edge";
}
comment;
attributes;
}
class M extends m {
get directed() {
return !1;
}
}
class R extends h {
constructor(t, e) {
super(), this.id = t, this.attributes = new w(e);
}
get $$type() {
return "Node";
}
comment;
attributes;
port(t) {
return typeof t == "string" ? { id: this.id, port: t } : { id: this.id, ...t };
}
}
class O extends y {
get $$type() {
return "Subgraph";
}
id;
constructor(...t) {
super(), this.id = t.find((s) => typeof s == "string");
const e = t.find(
(s) => typeof s == "object" && s !== null
);
e !== void 0 && this.apply(e);
}
isSubgraphCluster() {
return typeof this.id == "string" ? this.id.startsWith("cluster") : !1;
}
}
Object.assign(p, {
Graph: M,
Digraph: A,
Subgraph: O,
Node: R,
Edge: k
});
const C = new Proxy(
import { parse as h, toModel as m, fromModel as g, stringify as b } from "@ts-graphviz/ast";
const j = new Proxy(
Object.freeze({}),

@@ -242,44 +12,45 @@ {

);
function g(r, t) {
function f(r, t) {
return (...e) => {
const s = r ? this.Digraph : this.Graph, n = e.find((a) => typeof a == "string"), o = e.find(
(a) => typeof a == "object"
), i = e.find(
(a) => typeof a == "function"
), d = new s(n, t, o);
return d.with(this), typeof i == "function" && i(d), d;
const a = r ? this.Digraph : this.Graph, p = e.find((o) => typeof o == "string"), u = e.find(
(o) => typeof o == "object"
), c = e.find(
(o) => typeof o == "function"
), i = new a(p, t, u);
return i.with(this), typeof c == "function" && c(i), i;
};
}
function u(r, t = p) {
function n(r, t = d) {
return Object.freeze({
digraph: g.call(t, !0, r),
graph: g.call(t, !1, r)
digraph: f.call(t, !0, r),
graph: f.call(t, !1, r)
});
}
const x = u(!1), D = x.digraph, B = x.graph, F = u(!0);
function P(r) {
const t = b(r);
const s = n(!1), A = s.digraph, C = s.graph, D = n(!0);
function z(r) {
const t = y(r);
return Object.freeze({
...u(!1, t),
strict: u(!0, t)
...n(!1, t),
strict: n(!0, t)
});
}
function T(r, t) {
const e = S(r, t?.parse);
function G(r, t) {
const e = h(r, t?.parse);
if (Array.isArray(e) || e.type === "Attribute" || e.type === "AttributeList" || e.type === "Comment" || e.type === "NodeRef" || e.type === "NodeRefGroup" || e.type === "Literal")
throw new Error();
return E(e, t?.convert);
return m(e, t?.convert);
}
function W(r, t) {
const e = $(r, t?.convert);
return G(e, t?.print);
function O(r, t) {
const e = g(r, t?.convert);
return b(e, t?.print);
}
l();
export {
C as attribute,
D as digraph,
T as fromDot,
B as graph,
F as strict,
W as toDot,
P as withContext
j as attribute,
A as digraph,
G as fromDot,
C as graph,
D as strict,
O as toDot,
z as withContext
};
{
"name": "ts-graphviz",
"version": "0.0.0-pr956-20240225160253",
"version": "0.0.0-pr956-20240225163634",
"description": "Graphviz library for TypeScript",

@@ -30,2 +30,3 @@ "keywords": [

"author": "kamiazya <yuki@kamiazya.tech>",
"sideEffects": true,
"type": "module",

@@ -58,14 +59,7 @@ "exports": {

"types": "lib/ts-graphviz.d.ts",
"files": [
"lib",
"media",
"README.md",
"CHANGELOG.md",
"LICENSE"
],
"dependencies": {
"@ts-graphviz/adapter": "^0.0.0-pr956-20240225160253",
"@ts-graphviz/ast": "^0.0.0-pr956-20240225160253",
"@ts-graphviz/common": "^0.0.0-pr956-20240225160253",
"@ts-graphviz/core": "^0.0.0-pr956-20240225160253"
"@ts-graphviz/adapter": "^0.0.0-pr956-20240225163634",
"@ts-graphviz/ast": "^0.0.0-pr956-20240225163634",
"@ts-graphviz/common": "^0.0.0-pr956-20240225163634",
"@ts-graphviz/core": "^0.0.0-pr956-20240225163634"
},

@@ -72,0 +66,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc