@vanillaes/esmtk 1.2.2 → 1.3.0
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/bin/commands/typings.js +18 -2
- package/bin/esmtk.js +3 -2
- package/package.json +2 -2
- package/src/util.d.ts +1 -1
- package/src/util.js +1 -1
package/bin/commands/typings.js
CHANGED
|
@@ -4,8 +4,9 @@ import { spawn } from 'child_process'
|
|
|
4
4
|
/**
|
|
5
5
|
* Generate Typescript typings from JSDoc
|
|
6
6
|
* @param {string} entry the entry point
|
|
7
|
+
* @param {object} options 'typings' options
|
|
7
8
|
*/
|
|
8
|
-
export async function typings (entry) {
|
|
9
|
+
export async function typings (entry, options) {
|
|
9
10
|
const npmExists = await which('npm')
|
|
10
11
|
if (!npmExists) {
|
|
11
12
|
console.error('npm not found')
|
|
@@ -22,7 +23,22 @@ export async function typings (entry) {
|
|
|
22
23
|
return
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
const args = []
|
|
27
|
+
args.push(entry)
|
|
28
|
+
args.push('-t')
|
|
29
|
+
args.push('esnext')
|
|
30
|
+
args.push('--allowJS')
|
|
31
|
+
args.push('--checkJS')
|
|
32
|
+
args.push('--declaration')
|
|
33
|
+
args.push('--emitDeclarationOnly')
|
|
34
|
+
if (options?.module) {
|
|
35
|
+
args.push('--module')
|
|
36
|
+
args.push(options.module)
|
|
37
|
+
}
|
|
38
|
+
args.push('--noEmitOnError')
|
|
39
|
+
args.push('--skipLibCheck')
|
|
40
|
+
|
|
41
|
+
spawn('tsc', args, {
|
|
26
42
|
cwd: process.cwd(),
|
|
27
43
|
stdio: ['pipe', process.stdout, process.stderr]
|
|
28
44
|
}).on('error', error => {
|
package/bin/esmtk.js
CHANGED
|
@@ -44,8 +44,9 @@ program.command('type <entry>')
|
|
|
44
44
|
|
|
45
45
|
program.command('typings <entry>')
|
|
46
46
|
.description('Generate typings from JSDoc using Typescript')
|
|
47
|
-
.
|
|
48
|
-
|
|
47
|
+
.option('--module <module>', 'Module resolution type (default esnext)', 'esnext')
|
|
48
|
+
.action((entry, options) => {
|
|
49
|
+
typings(entry, options)
|
|
49
50
|
})
|
|
50
51
|
|
|
51
52
|
program.command('bundle <input> <output>')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vanillaes/esmtk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "ES Module Toolkit",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ecmascript",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@vanillaes/lint-es": "^1.0.0",
|
|
57
|
-
"@vanillaes/tape-es": "^4.0.
|
|
57
|
+
"@vanillaes/tape-es": "^4.0.7",
|
|
58
58
|
"commander": "^14.0.3"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
package/src/util.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export function fileExists(path: string): Promise<boolean>;
|
|
|
17
17
|
*/
|
|
18
18
|
export function installed(pkg: string): Promise<boolean>;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Match glob(s)
|
|
21
21
|
* @param {string} pattern glob pattern(s) to match
|
|
22
22
|
* @param {string} cwd the current working directory
|
|
23
23
|
* @param {string} ignore glob of pattern(s) to ignore
|
package/src/util.js
CHANGED