@vanillaes/esmtk 0.9.0 → 0.11.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/.vscode/launch.json +26 -2
- package/README.md +2 -0
- package/bin/commands/minify.js +12 -2
- package/bin/commands/types.js +16 -7
- package/bin/esmtk.js +6 -4
- package/package.json +4 -7
package/.vscode/launch.json
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.2.0",
|
|
3
3
|
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"name": "Version",
|
|
6
|
+
"type": "node",
|
|
7
|
+
"request": "launch",
|
|
8
|
+
"skipFiles": [
|
|
9
|
+
"<node_internals>/**"
|
|
10
|
+
],
|
|
11
|
+
"program": "${workspaceFolder}/bin/esmtk.js",
|
|
12
|
+
"cwd": "${workspaceFolder}",
|
|
13
|
+
"args": ["--version"],
|
|
14
|
+
"console": "integratedTerminal",
|
|
15
|
+
},
|
|
4
16
|
{
|
|
5
17
|
"name": "Lint",
|
|
6
18
|
"type": "node",
|
|
@@ -22,7 +34,7 @@
|
|
|
22
34
|
],
|
|
23
35
|
"program": "${workspaceFolder}/bin/esmtk.js",
|
|
24
36
|
"cwd": "${workspaceFolder}",
|
|
25
|
-
"args": ["types", "./
|
|
37
|
+
"args": ["types", "./src/index.js"],
|
|
26
38
|
"console": "integratedTerminal",
|
|
27
39
|
},
|
|
28
40
|
{
|
|
@@ -34,7 +46,19 @@
|
|
|
34
46
|
],
|
|
35
47
|
"program": "${workspaceFolder}/bin/esmtk.js",
|
|
36
48
|
"cwd": "${workspaceFolder}",
|
|
37
|
-
"args": ["typings", "./
|
|
49
|
+
"args": ["typings", "./src/index.js"],
|
|
50
|
+
"console": "integratedTerminal",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "Minify",
|
|
54
|
+
"type": "node",
|
|
55
|
+
"request": "launch",
|
|
56
|
+
"skipFiles": [
|
|
57
|
+
"<node_internals>/**"
|
|
58
|
+
],
|
|
59
|
+
"program": "${workspaceFolder}/bin/esmtk.js",
|
|
60
|
+
"cwd": "${workspaceFolder}",
|
|
61
|
+
"args": ["minify", "--sourcemap", "./src/index.js", "./src/index.min.js"],
|
|
38
62
|
"console": "integratedTerminal",
|
|
39
63
|
},
|
|
40
64
|
{
|
package/README.md
CHANGED
|
@@ -34,6 +34,7 @@ Type check the JSDoc typings (using Typescript)
|
|
|
34
34
|
`esmtk types index.js`
|
|
35
35
|
|
|
36
36
|
- `[entry]` - the entry-point for the source
|
|
37
|
+
- `--strict` - enable 'strict mode' type checks
|
|
37
38
|
|
|
38
39
|
### Usage
|
|
39
40
|
|
|
@@ -84,6 +85,7 @@ Bundle and Minify the source code to an ECMAScript module (using ESBuild)
|
|
|
84
85
|
|
|
85
86
|
- `[input]` - the input source file path
|
|
86
87
|
- `[output]` - the output bundle file path
|
|
88
|
+
- `--sourcemap` - generate a source map for the minified bundle
|
|
87
89
|
|
|
88
90
|
### Usage
|
|
89
91
|
|
package/bin/commands/minify.js
CHANGED
|
@@ -6,7 +6,7 @@ import { spawn } from 'child_process'
|
|
|
6
6
|
* @param {string} input the input path
|
|
7
7
|
* @param {string} output the output path
|
|
8
8
|
*/
|
|
9
|
-
export async function minify (input, output) {
|
|
9
|
+
export async function minify (input, output, options) {
|
|
10
10
|
const npmExists = await which('npm')
|
|
11
11
|
if (!npmExists) {
|
|
12
12
|
console.error('npm not found')
|
|
@@ -21,7 +21,17 @@ export async function minify (input, output) {
|
|
|
21
21
|
process.exit(1)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
const args = []
|
|
25
|
+
args.push('--format=esm')
|
|
26
|
+
args.push('--minify')
|
|
27
|
+
args.push('--bundle')
|
|
28
|
+
if (options?.sourcemap) {
|
|
29
|
+
args.push('--sourcemap')
|
|
30
|
+
}
|
|
31
|
+
args.push(input)
|
|
32
|
+
args.push(`--outfile=${output}`)
|
|
33
|
+
|
|
34
|
+
spawn('esbuild', args, {
|
|
25
35
|
cwd: process.cwd(),
|
|
26
36
|
stdio: ['pipe', process.stdout, process.stderr]
|
|
27
37
|
}).on('error', err => {
|
package/bin/commands/types.js
CHANGED
|
@@ -5,7 +5,7 @@ import { spawn } from 'child_process'
|
|
|
5
5
|
* Type Check the JSDOC typings
|
|
6
6
|
* @param {string} entry the entry point
|
|
7
7
|
*/
|
|
8
|
-
export async function types (entry) {
|
|
8
|
+
export async function types (entry, options) {
|
|
9
9
|
const npmExists = await which('npm')
|
|
10
10
|
if (!npmExists) {
|
|
11
11
|
console.error('npm not found')
|
|
@@ -20,10 +20,19 @@ export async function types (entry) {
|
|
|
20
20
|
process.exit(1)
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
if (options?.strict) {
|
|
24
|
+
spawn('tsc', [entry, '-t', 'esnext', '--allowJS', '--checkJS', '--skipLibCheck', '--noEmit', '--strict'], {
|
|
25
|
+
cwd: process.cwd(),
|
|
26
|
+
stdio: ['pipe', process.stdout, process.stderr]
|
|
27
|
+
}).on('error', err => {
|
|
28
|
+
console.error(err)
|
|
29
|
+
})
|
|
30
|
+
} else {
|
|
31
|
+
spawn('tsc', [entry, '-t', 'esnext', '--allowJS', '--checkJS', '--skipLibCheck', '--noEmit'], {
|
|
32
|
+
cwd: process.cwd(),
|
|
33
|
+
stdio: ['pipe', process.stdout, process.stderr]
|
|
34
|
+
}).on('error', err => {
|
|
35
|
+
console.error(err)
|
|
36
|
+
})
|
|
37
|
+
}
|
|
29
38
|
}
|
package/bin/esmtk.js
CHANGED
|
@@ -18,8 +18,9 @@ program.command('lint')
|
|
|
18
18
|
|
|
19
19
|
program.command('types <entry>')
|
|
20
20
|
.description('Type check the JSDoc typings using Typescript')
|
|
21
|
-
.
|
|
22
|
-
|
|
21
|
+
.option('--strict', 'Enable strict type checks')
|
|
22
|
+
.action((entry, options) => {
|
|
23
|
+
types(entry, options)
|
|
23
24
|
})
|
|
24
25
|
|
|
25
26
|
program.command('typings <entry>')
|
|
@@ -42,8 +43,9 @@ program.command('commonjs <input> <output>')
|
|
|
42
43
|
|
|
43
44
|
program.command('minify <input> <output>')
|
|
44
45
|
.description('Minify the source using ESBuild')
|
|
45
|
-
.
|
|
46
|
-
|
|
46
|
+
.option('--sourcemap', 'Generate a source map')
|
|
47
|
+
.action((input, output, options) => {
|
|
48
|
+
minify(input, output, options)
|
|
47
49
|
})
|
|
48
50
|
|
|
49
51
|
program.command('cp <source> <target>')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vanillaes/esmtk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "ES Module Toolkit",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"esm",
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
"author": "Evan Plaice <evanplaice@gmail.com> (https://evanplaice.com/)",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"type": "module",
|
|
16
|
+
"bin": {
|
|
17
|
+
"esmtk": "bin/esmtk.js"
|
|
18
|
+
},
|
|
16
19
|
"exports": {
|
|
17
20
|
".": {
|
|
18
21
|
"types": "./src/index.d.ts",
|
|
@@ -27,9 +30,6 @@
|
|
|
27
30
|
"default": "./src/rm.js"
|
|
28
31
|
}
|
|
29
32
|
},
|
|
30
|
-
"bin": {
|
|
31
|
-
"esmtk": "bin/esmtk.js"
|
|
32
|
-
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"lint": "./bin/esmtk.js lint",
|
|
35
35
|
"types": "./bin/esmtk.js types src/index.js",
|
|
@@ -41,9 +41,6 @@
|
|
|
41
41
|
"commander": "^14.0.3",
|
|
42
42
|
"standard": "^17.1.2"
|
|
43
43
|
},
|
|
44
|
-
"engines": {
|
|
45
|
-
"node": ">=17"
|
|
46
|
-
},
|
|
47
44
|
"devDependencies": {
|
|
48
45
|
"@types/node": "^25.3.5"
|
|
49
46
|
}
|