@helios-lang/contract-utils 0.1.39 → 0.1.41
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.
- package/package.json +5 -5
- package/src/hl2ts.js +16 -21
- package/types/hl2ts.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helios-lang/contract-utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.41",
|
|
4
4
|
"description": "Convenience and type-safety utilities for using Helios validators from within Typescript",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"@helios-lang/compiler": "*"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@helios-lang/cli-utils": "^0.1.
|
|
38
|
+
"@helios-lang/cli-utils": "^0.1.4",
|
|
39
39
|
"@helios-lang/codec-utils": "^0.1.29",
|
|
40
|
-
"@helios-lang/compiler-utils": "^0.1.
|
|
41
|
-
"@helios-lang/ledger": "^0.1.
|
|
40
|
+
"@helios-lang/compiler-utils": "^0.1.22",
|
|
41
|
+
"@helios-lang/ledger": "^0.1.49",
|
|
42
42
|
"@helios-lang/type-utils": "^0.1.8",
|
|
43
|
-
"@helios-lang/uplc": "^0.1.
|
|
43
|
+
"@helios-lang/uplc": "^0.1.27"
|
|
44
44
|
}
|
|
45
45
|
}
|
package/src/hl2ts.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import {
|
|
4
4
|
existsSync,
|
|
5
5
|
fstat,
|
|
6
|
+
mkdirSync,
|
|
6
7
|
promises,
|
|
7
8
|
readFileSync,
|
|
8
9
|
writeFileSync
|
|
@@ -103,8 +104,12 @@ async function mainInternal(_args, { outDir, format }) {
|
|
|
103
104
|
console.log(` Output:`)
|
|
104
105
|
console.log(` ${tsPath}`)
|
|
105
106
|
} else {
|
|
106
|
-
const
|
|
107
|
-
|
|
107
|
+
const resolvedOutDir = resolve(outDir)
|
|
108
|
+
|
|
109
|
+
mkdirIfNotExists(resolvedOutDir)
|
|
110
|
+
|
|
111
|
+
const jsPath = join(resolvedOutDir, "index.js")
|
|
112
|
+
const dtsPath = join(resolvedOutDir, "index.d.ts")
|
|
108
113
|
|
|
109
114
|
writeFileSync(jsPath, js)
|
|
110
115
|
writeFileSync(dtsPath, dts)
|
|
@@ -117,25 +122,6 @@ async function mainInternal(_args, { outDir, format }) {
|
|
|
117
122
|
|
|
118
123
|
main()
|
|
119
124
|
|
|
120
|
-
/**
|
|
121
|
-
* @param {string[]} args
|
|
122
|
-
* @returns {{outDir: string, isTypescript: boolean}}
|
|
123
|
-
*/
|
|
124
|
-
function parseArgs(args) {
|
|
125
|
-
const isTypescript = args.indexOf("--ts") != -1
|
|
126
|
-
|
|
127
|
-
let i = args.indexOf("-o")
|
|
128
|
-
if (i != -1) {
|
|
129
|
-
if (i == args.length - 1 || args[i + 1].startsWith("-")) {
|
|
130
|
-
throw new Error("expected argument after -o")
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return { outDir: resolve(args[i + 1]), isTypescript }
|
|
134
|
-
} else {
|
|
135
|
-
return { outDir: process.cwd(), isTypescript }
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
125
|
/**
|
|
140
126
|
* @param {string} dir
|
|
141
127
|
* @param {string} ext
|
|
@@ -197,3 +183,12 @@ function findPackageJson(fileName = "package.json") {
|
|
|
197
183
|
return None
|
|
198
184
|
}
|
|
199
185
|
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @param {string} dir
|
|
189
|
+
*/
|
|
190
|
+
function mkdirIfNotExists(dir) {
|
|
191
|
+
if (!existsSync(dir)) {
|
|
192
|
+
mkdirSync(dir, { recursive: true })
|
|
193
|
+
}
|
|
194
|
+
}
|
package/types/hl2ts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hl2ts.d.ts","sourceRoot":"","sources":["../src/hl2ts.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"hl2ts.d.ts","sourceRoot":"","sources":["../src/hl2ts.js"],"names":[],"mappings":";0BAkBa,OAAO,2BAA2B,EAAE,WAAW;4BAC/C,OAAO,2BAA2B,EAAE,iBAAiB;+BACrD,OAAO,2BAA2B,EAAE,oBAAoB;4BAIxD;IACZ,MAAU,MAAM,CAAA;IAChB,OAAW,EAAE,MAAM,CAAA;IACnB,UAAc,EAAE,MAAM,CAAA;CACnB;yBAIS,YAAY,GAAG,YAAY"}
|