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 1.4.1-dev.1f5b79680 to 1.4.1-dev.5b3016beb

lib/adapter/types/index.cjs

14

lib/adapter/deno/mod.d.ts

@@ -1,13 +0,7 @@

export type Format = 'png' | 'svg' | 'json' | 'jpg' | 'pdf' | 'xdot' | 'plain' | 'dot_json';
import { Options, Format, Layout } from '../types/index.d.ts';
export interface Options {
format?: Format;
suppressWarnings?: boolean;
dotCommand?: string;
}
/**
* Execute the Graphviz dot command and make a Stream of the results.
*/
export function toStream(dot: string, options?: Options): Promise<ReadableStream>;
export function toStream<T extends Layout>(dot: string, options?: Options<T>): Promise<ReadableStream<Uint8Array>>;

@@ -17,2 +11,4 @@ /**

*/
export function toFile(dot: string, path: string, options?: Options): Promise<void>;
export function toFile<T extends Layout>(dot: string, path: string, options?: Options<T>): Promise<void>;
export { Options, Format, Layout };

@@ -1,11 +0,2 @@

function commandBuilder({ dotCommand = 'dot', suppressWarnings = true, format = 'svg' } = {}) {
const args = [
...(function* () {
if (suppressWarnings) yield '-q';
yield `-T${format}`;
})(),
];
return [dotCommand, args];
}
import { commandBuilder } from '../utils/index.js';
/**

@@ -12,0 +3,0 @@ * Execute the Graphviz dot command and make a Stream of the results.

/// <reference types="node" />
type Format = 'png' | 'svg' | 'json' | 'jpg' | 'pdf' | 'xdot' | 'plain' | 'dot_json';
interface Options {
format?: Format;
suppressWarnings?: boolean;
dotCommand?: string;
}
import { Layout, Options } from '../types/index.js';
export { Format, Options } from '../types/index.js';
/**
* Execute the Graphviz dot command and make a Stream of the results.
*/
declare function toStream(dot: string, options?: Options): Promise<NodeJS.ReadableStream>;
declare function toStream<T extends Layout>(dot: string, options?: Options<T>): Promise<NodeJS.ReadableStream>;
/**
* Execute the Graphviz dot command and output the results to a file.
*/
declare function toFile(dot: string, path: string, options?: Options): Promise<void>;
declare function toFile<T extends Layout>(dot: string, path: string, options?: Options<T>): Promise<void>;
export { Format, Options, toFile, toStream };
export { toFile, toStream };

@@ -1,20 +0,8 @@

import { createWriteStream } from 'node:fs';
import { pipeline as pipeline$1, Readable } from 'node:stream';
import { spawn } from 'node:child_process';
import { commandBuilder } from '../utils/index.js';
import { promisify } from 'node:util';
import { spawn } from 'node:child_process';
import { createWriteStream } from 'node:fs';
/**
* @module ts-graphviz/adapter
* @beta
*/
function commandBuilder({ dotCommand = 'dot', suppressWarnings = true, format = 'svg' } = {}) {
const args = [
...(function* () {
if (suppressWarnings) yield '-q';
yield `-T${format}`;
})(),
];
return [dotCommand, args];
}
/**
* NOTE:

@@ -25,2 +13,3 @@ * The node:stream/promises standard module is not provided in Node 14.

const pipeline = promisify(pipeline$1);
/**

@@ -30,3 +19,3 @@ * Execute the Graphviz dot command and make a Stream of the results.

async function toStream(dot, options) {
const [command, args] = commandBuilder(options);
const [command, args] = commandBuilder(options ?? {});
const p = spawn(command, args, { stdio: 'pipe' });

@@ -36,2 +25,3 @@ await pipeline(Readable.from([dot]), p.stdin);

}
/**

@@ -38,0 +28,0 @@ * Execute the Graphviz dot command and output the results to a file.

{
"name": "ts-graphviz",
"version": "1.4.1-dev.1f5b79680",
"version": "1.4.1-dev.5b3016beb",
"author": "kamiazya <yuki@kamiazya.tech>",

@@ -87,6 +87,6 @@ "description": "Graphviz library for TypeScript.",

"prebuild": "yarn build:peggy",
"build:deno": "cp -r src/adapter/deno lib/adapter/deno",
"build:deno": "mkdir -p lib/adapter/deno && cp -r src/adapter/deno/* lib/adapter/deno && sed -i \"s/index.ts/index.js/g\" lib/adapter/deno/mod.js && sed -i \"s/index.ts/index.d.ts/g\" lib/adapter/deno/mod.d.ts",
"build:node": "tsc -p tsconfig.build.json && rollup -c",
"build": "yarn build:node && yarn build:deno",
"postbuild": "prettier --write ./lib/**/index.{js,cjs,d.ts}",
"postbuild": "prettier --write ./lib/**/*.{js,cjs,d.ts}",
"pretest": "yarn build:peggy",

@@ -93,0 +93,0 @@ "test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",

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