imapflow 1.0.187 → 1.0.189

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/types.js DELETED
@@ -1,56 +0,0 @@
1
- 'use strict';
2
-
3
- // Utility script to build TypeScript typings
4
-
5
- const { exec } = require('child_process');
6
- const fs = require('fs');
7
-
8
- const path = 'lib/types.d.ts';
9
-
10
- // Generate lib/types.d.ts
11
- exec('jsdoc -t node_modules/tsd-jsdoc/dist -r lib/imap-flow.js --destination lib/', (err, stdout, stderr) => {
12
- if (err) {
13
- console.error(err);
14
- return process.exit(1);
15
- }
16
- stderr = (stderr || '').trim();
17
- if (stderr) {
18
- console.error(stderr);
19
- }
20
-
21
- // lib/types.d.ts uses EVentEmitter so we need to reference it from node typings
22
-
23
- fs.stat(path, (err, stats) => {
24
- if (err) {
25
- console.error(err);
26
- return process.exit(1);
27
- }
28
- if (!stats || !stats.isFile()) {
29
- console.error(`${path} is not a file`);
30
- return process.exit(1);
31
- }
32
-
33
- fs.readFile(path, 'utf-8', (err, content) => {
34
- if (err) {
35
- console.error(err);
36
- return process.exit(1);
37
- }
38
-
39
- // make sure node types are referenced
40
- content = '/// <reference types="node" />\n\n' + content;
41
-
42
- // inject EventEmitter definitions from node typings
43
- content = content.replace(/(declare module[^\n]+)/, '$1\n import { EventEmitter } from "events";\n');
44
-
45
- // path tls object to allow undocumented keys
46
- content = content.replace(/(tls: \{[^\n]*)/, '$1\n [prop: string]: any;\n } & {');
47
-
48
- fs.writeFile(path, Buffer.from(content), err => {
49
- if (err) {
50
- console.error(err);
51
- return process.exit(1);
52
- }
53
- });
54
- });
55
- });
56
- });