ts-graphviz 1.3.3-dev.dc36620d2 → 1.3.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 (2) hide show
  1. package/lib/adapter/deno/mod.js +13 -1
  2. package/package.json +109 -109
@@ -16,6 +16,7 @@ export async function toStream(dot, options) {
16
16
  const cp = new Deno.Command(command, {
17
17
  args: args,
18
18
  stdin: 'piped',
19
+ stdout: 'piped',
19
20
  }).spawn();
20
21
  const stdin = cp.stdin.getWriter();
21
22
  await stdin.write(new TextEncoder().encode(dot));
@@ -23,11 +24,22 @@ export async function toStream(dot, options) {
23
24
  return cp.stdout;
24
25
  }
25
26
 
27
+ function open(path) {
28
+ try {
29
+ return Deno.open(path, { write: true });
30
+ } catch (e) {
31
+ if (e instanceof Deno.errors.NotFound) {
32
+ return Deno.open(path, { createNew: true, write: true });
33
+ }
34
+ throw e;
35
+ }
36
+ }
37
+
26
38
  /**
27
39
  * Execute the Graphviz dot command and output the results to a file.
28
40
  */
29
41
  export async function toFile(dot, path, options) {
30
- const output = await Deno.open(path, { write: true });
42
+ const output = await open(path);
31
43
  const stream = await toStream(dot, options);
32
44
  await stream.pipeTo(output.writable);
33
45
  }
package/package.json CHANGED
@@ -1,114 +1,114 @@
1
1
  {
2
- "name": "ts-graphviz",
3
- "version": "1.3.3-dev.dc36620d2",
4
- "author": "kamiazya <yuki@kamiazya.tech>",
5
- "description": "Graphviz library for TypeScript.",
6
- "homepage": "https://ts-graphviz.github.io/ts-graphviz/",
7
- "type": "module",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/ts-graphviz/ts-graphviz.git"
2
+ "name": "ts-graphviz",
3
+ "version": "1.3.3",
4
+ "author": "kamiazya <yuki@kamiazya.tech>",
5
+ "description": "Graphviz library for TypeScript.",
6
+ "homepage": "https://ts-graphviz.github.io/ts-graphviz/",
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/ts-graphviz/ts-graphviz.git"
11
+ },
12
+ "keywords": [
13
+ "graphviz",
14
+ "dot"
15
+ ],
16
+ "bugs": {
17
+ "url": "https://github.com/ts-graphviz/ts-graphviz/issues"
18
+ },
19
+ "funding": {
20
+ "type": "github",
21
+ "url": "https://github.com/sponsors/kamiazya"
22
+ },
23
+ "main": "./lib/index.cjs",
24
+ "module": "./lib/index.js",
25
+ "types": "lib/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "require": {
29
+ "types": "./lib/index.d.ts",
30
+ "default": "./lib/index.cjs"
31
+ },
32
+ "import": {
33
+ "types": "./lib/index.d.ts",
34
+ "default": "./lib/index.js"
35
+ }
11
36
  },
12
- "keywords": [
13
- "graphviz",
14
- "dot"
15
- ],
16
- "bugs": {
17
- "url": "https://github.com/ts-graphviz/ts-graphviz/issues"
37
+ "./ast": {
38
+ "require": {
39
+ "types": "./lib/ast/index.d.ts",
40
+ "default": "./lib/ast/index.cjs"
41
+ },
42
+ "import": {
43
+ "types": "./lib/ast/index.d.ts",
44
+ "default": "./lib/ast/index.js"
45
+ }
18
46
  },
19
- "funding": {
20
- "type": "github",
21
- "url": "https://github.com/sponsors/kamiazya"
47
+ "./adapter": {
48
+ "deno": {
49
+ "types": "./lib/adapter/deno/mod.d.ts",
50
+ "default": "./lib/adapter/deno/mod.js"
51
+ },
52
+ "node": {
53
+ "require": "./lib/adapter/index.cjs",
54
+ "import": "./lib/adapter/index.js",
55
+ "types": "./lib/adapter/index.d.ts"
56
+ }
22
57
  },
23
- "main": "./lib/index.cjs",
24
- "module": "./lib/index.js",
25
- "types": "lib/index.d.ts",
26
- "exports": {
27
- ".": {
28
- "require": {
29
- "types": "./lib/index.d.ts",
30
- "default": "./lib/index.cjs"
31
- },
32
- "import": {
33
- "types": "./lib/index.d.ts",
34
- "default": "./lib/index.js"
35
- }
36
- },
37
- "./ast": {
38
- "require": {
39
- "types": "./lib/ast/index.d.ts",
40
- "default": "./lib/ast/index.cjs"
41
- },
42
- "import": {
43
- "types": "./lib/ast/index.d.ts",
44
- "default": "./lib/ast/index.js"
45
- }
46
- },
47
- "./adapter": {
48
- "deno": {
49
- "types": "./lib/adapter/deno/mod.d.ts",
50
- "default": "./lib/adapter/deno/mod.js"
51
- },
52
- "node": {
53
- "require": "./lib/adapter/index.cjs",
54
- "import": "./lib/adapter/index.js",
55
- "types": "./lib/adapter/index.d.ts"
56
- }
57
- },
58
- "./package.json": "./package.json"
59
- },
60
- "typesVersions": {
61
- "*": {
62
- "ast": [
63
- "lib/ast"
64
- ],
65
- "adapter": [
66
- "lib/adapter"
67
- ]
68
- }
69
- },
70
- "license": "MIT",
71
- "engines": {
72
- "node": ">=14.16"
73
- },
74
- "scripts": {
75
- "build:peggy": "peggy --plugin ts-pegjs --extra-options-file src/ast/dot-shim/parser/peggy.options.json -o src/ast/dot-shim/parser/_parse.ts src/ast/dot-shim/parser/dot.peggy",
76
- "prebuild": "yarn build:peggy",
77
- "build:deno": "cp -r src/adapter/deno lib/adapter/deno",
78
- "build:node": "tsc -p tsconfig.build.json && rollup -c",
79
- "build": "yarn build:node && yarn build:deno",
80
- "postbuild": "prettier --write ./lib/**/index.{js,cjs,d.ts}",
81
- "pretest": "yarn build:peggy",
82
- "test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",
83
- "format": "eslint --ext ts src --fix && prettier --write './**/*.{ts,js,json,yaml}' '!lib'",
84
- "lint": "eslint --ext ts src",
85
- "predoc": "yarn build:peggy",
86
- "doc": "typedoc"
87
- },
88
- "devDependencies": {
89
- "@rollup/plugin-replace": "^4.0.0",
90
- "@types/jest": "^28.1.6",
91
- "@types/jest-specific-snapshot": "^0.5.6",
92
- "@typescript-eslint/eslint-plugin": "^5.33.0",
93
- "@typescript-eslint/parser": "^5.33.0",
94
- "eslint": "^8.22.0",
95
- "eslint-config-prettier": "^8.5.0",
96
- "eslint-plugin-import": "^2.26.0",
97
- "eslint-plugin-jest": "^26.8.2",
98
- "eslint-plugin-prettier": "^4.2.1",
99
- "jest": "^28.1.3",
100
- "jest-snapshot-serializer-raw": "^1.2.0",
101
- "jest-specific-snapshot": "^5.0.0",
102
- "peggy": "^2.0.1",
103
- "prettier": "^2.7.1",
104
- "prettier-plugin-pegjs": "^0.5.0",
105
- "rollup": "^2.77.3",
106
- "rollup-plugin-delete": "^2.0.0",
107
- "rollup-plugin-dts": "^4.2.2",
108
- "svgo": "^2.8.0",
109
- "ts-jest": "^28.0.7",
110
- "ts-pegjs": "^2.1.0",
111
- "typedoc": "^0.23.15",
112
- "typescript": "^4.7.4"
58
+ "./package.json": "./package.json"
59
+ },
60
+ "typesVersions": {
61
+ "*": {
62
+ "ast": [
63
+ "lib/ast"
64
+ ],
65
+ "adapter": [
66
+ "lib/adapter"
67
+ ]
113
68
  }
114
- }
69
+ },
70
+ "license": "MIT",
71
+ "engines": {
72
+ "node": ">=14.16"
73
+ },
74
+ "scripts": {
75
+ "build:peggy": "peggy --plugin ts-pegjs --extra-options-file src/ast/dot-shim/parser/peggy.options.json -o src/ast/dot-shim/parser/_parse.ts src/ast/dot-shim/parser/dot.peggy",
76
+ "prebuild": "yarn build:peggy",
77
+ "build:deno": "cp -r src/adapter/deno lib/adapter/deno",
78
+ "build:node": "tsc -p tsconfig.build.json && rollup -c",
79
+ "build": "yarn build:node && yarn build:deno",
80
+ "postbuild": "prettier --write ./lib/**/index.{js,cjs,d.ts}",
81
+ "pretest": "yarn build:peggy",
82
+ "test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",
83
+ "format": "eslint --ext ts src --fix && prettier --write './**/*.{ts,js,json,yaml}' '!lib'",
84
+ "lint": "eslint --ext ts src",
85
+ "predoc": "yarn build:peggy",
86
+ "doc": "typedoc"
87
+ },
88
+ "devDependencies": {
89
+ "@rollup/plugin-replace": "^4.0.0",
90
+ "@types/jest": "^28.1.6",
91
+ "@types/jest-specific-snapshot": "^0.5.6",
92
+ "@typescript-eslint/eslint-plugin": "^5.33.0",
93
+ "@typescript-eslint/parser": "^5.33.0",
94
+ "eslint": "^8.22.0",
95
+ "eslint-config-prettier": "^8.5.0",
96
+ "eslint-plugin-import": "^2.26.0",
97
+ "eslint-plugin-jest": "^26.8.2",
98
+ "eslint-plugin-prettier": "^4.2.1",
99
+ "jest": "^28.1.3",
100
+ "jest-snapshot-serializer-raw": "^1.2.0",
101
+ "jest-specific-snapshot": "^5.0.0",
102
+ "peggy": "^2.0.1",
103
+ "prettier": "^2.7.1",
104
+ "prettier-plugin-pegjs": "^0.5.0",
105
+ "rollup": "^2.77.3",
106
+ "rollup-plugin-delete": "^2.0.0",
107
+ "rollup-plugin-dts": "^4.2.2",
108
+ "svgo": "^2.8.0",
109
+ "ts-jest": "^28.0.7",
110
+ "ts-pegjs": "^2.1.0",
111
+ "typedoc": "^0.23.15",
112
+ "typescript": "^4.7.4"
113
+ }
114
+ }