@vanillaes/esmtk 1.3.0 → 1.4.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/README.md CHANGED
@@ -122,8 +122,14 @@ Type check the JSDoc typings (using Typescript)
122
122
  # type check the sources
123
123
  esmtk type index.js
124
124
 
125
+ # type check the sources (with 'node' module resolution)
126
+ esmtk type --module nodenext index.js
127
+
125
128
  # type check the sources (with 'strict mode' enabled)
126
129
  esmtk type --strict index.js
130
+
131
+ # type check the sources (with '@types/node' typings included)
132
+ esmtk type --types node index.js
127
133
  ```
128
134
 
129
135
  **Node: Due to Typescript limitations, inline JSDoc typings will be ignored if typings (ie `*.d.ts` files) exist.**
@@ -211,12 +217,20 @@ Generate Type Declarations (.d.ts) from JSDoc (using Typescript)
211
217
  `esmtk typings [entry]`
212
218
 
213
219
  - `[entry]` - the entry-point for the source
220
+ - `--module [module]` - module resolution type (default `esnext`)
221
+ - `--types [types]` - specify type package names to include (ex `node` for `@types/node`)
214
222
 
215
223
  ### Usage
216
224
 
217
225
  ```sh
218
226
  # generate .d.ts files for all linked source files
219
227
  esmtk typings index.js
228
+
229
+ # generate .d.ts files for all linked source files (with 'node' module resolution)
230
+ esmtk type --module nodenext index.js
231
+
232
+ # generate .d.ts files for all linked source files (with '@types/node' typings included)
233
+ esmtk type --types node index.js
220
234
  ```
221
235
 
222
236
 
@@ -37,6 +37,10 @@ export async function typings (entry, options) {
37
37
  }
38
38
  args.push('--noEmitOnError')
39
39
  args.push('--skipLibCheck')
40
+ if (options?.types) {
41
+ args.push('--types')
42
+ args.push(options.types)
43
+ }
40
44
 
41
45
  spawn('tsc', args, {
42
46
  cwd: process.cwd(),
package/bin/esmtk.js CHANGED
@@ -45,6 +45,7 @@ program.command('type <entry>')
45
45
  program.command('typings <entry>')
46
46
  .description('Generate typings from JSDoc using Typescript')
47
47
  .option('--module <module>', 'Module resolution type (default esnext)', 'esnext')
48
+ .option('--types <types>', 'specify type package names to include (ex `node` for `@types/node`)')
48
49
  .action((entry, options) => {
49
50
  typings(entry, options)
50
51
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanillaes/esmtk",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "ES Module Toolkit",
5
5
  "keywords": [
6
6
  "ecmascript",
@@ -40,10 +40,10 @@
40
40
  "scripts": {
41
41
  "test": "./bin/esmtk.js test",
42
42
  "lint": "./bin/esmtk.js lint",
43
- "type": "./bin/esmtk.js type src/index.js && ./bin/esmtk.js type bin/esmtk.js --module nodenext",
43
+ "type": "./bin/esmtk.js type --module nodenext src/index.js && ./bin/esmtk.js type bin/esmtk.js --module nodenext",
44
44
  "bundle": "./bin/esmtk.js bundle --platform=node src/index.js src/index.esm.js",
45
45
  "minify": "./bin/esmtk.js minify --platform=node src/index.js src/index.min.js",
46
- "typings": "./bin/esmtk.js typings src/index.js",
46
+ "typings": "./bin/esmtk.js typings --module nodenext src/index.js",
47
47
  "clean": "./bin/esmtk.js clean --typings",
48
48
  "preview": "./bin/esmtk.js preview",
49
49
  "preversion": "npm run test && npm run lint && npm run type",