dts-gen 0.7.4 → 0.8.2
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/CHANGELOG.md +19 -0
- package/LICENSE +17 -17
- package/README.md +148 -172
- package/dist/definitely-typed.d.ts +1 -0
- package/dist/definitely-typed.js +129 -0
- package/dist/definitely-typed.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/{bin/lib → dist}/index.js +76 -50
- package/dist/index.js.map +1 -0
- package/dist/names.d.ts +1 -0
- package/{bin/lib → dist}/names.js +3 -2
- package/dist/names.js.map +1 -0
- package/dist/run.d.ts +2 -0
- package/dist/run.js +199 -0
- package/dist/run.js.map +1 -0
- package/package.json +31 -39
- package/templates/global-modifying-module.d.ts +8 -8
- package/templates/global-plugin.d.ts +7 -7
- package/templates/global.d.ts +35 -35
- package/templates/module-class.d.ts +7 -7
- package/templates/module-function.d.ts +15 -15
- package/templates/module-plugin.d.ts +17 -17
- package/templates/module.d.ts +11 -11
- package/SECURITY.md +0 -41
- package/bin/lib/definitely-typed.js +0 -145
- package/bin/lib/run.js +0 -166
- package/tsconfig.json +0 -21
- package/tslint.json +0 -24
- package/webpack.config.js +0 -19
package/CHANGELOG.md
ADDED
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
11
|
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
14
|
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
package/README.md
CHANGED
|
@@ -1,172 +1,148 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
> npm install -g
|
|
29
|
-
>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
declare
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
The
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
The file will be
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
Specify `-o` to allow overwriting of files.
|
|
150
|
-
|
|
151
|
-
# Browser
|
|
152
|
-
|
|
153
|
-
<table><td>
|
|
154
|
-
📝 <strong>Note:</strong> Browser support in progress! This is not quite ready yet.
|
|
155
|
-
</td></table>
|
|
156
|
-
|
|
157
|
-
To generate a definition file for a browser-only module, we'll use the in-browser popup window.
|
|
158
|
-
This works by injecting the `dts-gen` script into the current page by adding it as a `script` tag.
|
|
159
|
-
|
|
160
|
-
Run this in your browser's developer console:
|
|
161
|
-
```js
|
|
162
|
-
var s = document.createElement('script'); s.src = 'https://unpkg.com/dts-gen/bin/browser-bundle.js'; document.body.appendChild(s);
|
|
163
|
-
```
|
|
164
|
-
If this script is blocked by the same-origin content policy of the page, go to
|
|
165
|
-
https://microsoft.github.io/dts-gen/manual.html and copy the script text shown on the page.
|
|
166
|
-
Paste this into the browser console.
|
|
167
|
-
|
|
168
|
-
When the window appears, enter an identifier or expression in the textbox and click "Generate".
|
|
169
|
-
|
|
170
|
-
TODO: Screenshot
|
|
171
|
-
|
|
172
|
-
You can then copy and paste the contents of the textarea into a definition file.
|
|
1
|
+
|
|
2
|
+
# dts-gen: A TypeScript Definition File Generator
|
|
3
|
+
|
|
4
|
+
`dts-gen` is a tool that generates TypeScript definition files (.d.ts) from *any* JavaScript object.
|
|
5
|
+
|
|
6
|
+
`dts-gen` works differently from TypeScript, Flowtype, Tern, etc. because it simply examines the objects as they appear at runtime, rather than needing the source code that creates the object.
|
|
7
|
+
This means no matter how the object was written, anything, including native objects, can be given an inferred shape.
|
|
8
|
+
|
|
9
|
+
This trade-off comes with a price -- you'll see a lot of `any`s in function parameters and return types.
|
|
10
|
+
You may also see properties that are not intended for public use.
|
|
11
|
+
`dts-gen` is meant to be a *starting point* for writing a high-quality definition file.
|
|
12
|
+
|
|
13
|
+
# How do I use it?
|
|
14
|
+
|
|
15
|
+
`dts-gen` can operate on NPM modules, arbitrary identifiers, or arbitrary expressions.
|
|
16
|
+
If you are generating a .d.ts file for a node module, the best way is to use the `dts-gen` commandline tool.
|
|
17
|
+
|
|
18
|
+
Some libraries only load in browsers; for this you can use the console-launched pop-up window.
|
|
19
|
+
|
|
20
|
+
# Command-line
|
|
21
|
+
|
|
22
|
+
Let's generate a .d.ts file for the `yargs` NPM module.
|
|
23
|
+
This already has a handwritten definition file, but let's pretend that doesn't exist yet.
|
|
24
|
+
You'll need to first install `dts-gen` if you haven't already, then globally install the module you're generating for.
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
> npm install -g dts-gen
|
|
28
|
+
> npm install -g yargs
|
|
29
|
+
> dts-gen -m yargs
|
|
30
|
+
```
|
|
31
|
+
This will generate a file `yargs.d.ts`.
|
|
32
|
+
Here's what it looks like
|
|
33
|
+
```ts
|
|
34
|
+
export = yargs;
|
|
35
|
+
declare function yargs(processArgs: any, cwd: any): any;
|
|
36
|
+
declare namespace yargs {
|
|
37
|
+
const $0: string;
|
|
38
|
+
const argv: {
|
|
39
|
+
$0: string;
|
|
40
|
+
// ... more
|
|
41
|
+
```
|
|
42
|
+
As you can see, `dts-gen` produced the correct module shape for the node module.
|
|
43
|
+
The function arguments got their correct names and arity, though it didn't detect that `cwd` is optional.
|
|
44
|
+
The parameter types are `any`, which is fine, and we can read the `yargs` documentation to find out what types it actually accepts.
|
|
45
|
+
|
|
46
|
+
## Command-line options
|
|
47
|
+
|
|
48
|
+
Here's the commandline help you'll see when running `dts-gen`:
|
|
49
|
+
```
|
|
50
|
+
Usage: dts-gen input [settings] [output]
|
|
51
|
+
|
|
52
|
+
Input Options:
|
|
53
|
+
-m[odule] fs The "fs" node module (must be installed)
|
|
54
|
+
-i[dentifier] Math The global variable "Math"
|
|
55
|
+
-e[xpression] "new C()" The expression "new C()"
|
|
56
|
+
-t[emplate] module Name of a template. Templates are:
|
|
57
|
+
global-modifying-module, global-plugin, global, module-class, module-function, module-plugin, module
|
|
58
|
+
|
|
59
|
+
Settings:
|
|
60
|
+
-n[ame] n The name to emit when generating for an expression
|
|
61
|
+
|
|
62
|
+
Output Options:
|
|
63
|
+
-f[ile] [filename.d.ts] Write to a file (default)
|
|
64
|
+
-d[t] [dirName] Create a folder suitable for DefinitelyTyped
|
|
65
|
+
-s[tdout] Write to stdout
|
|
66
|
+
-o[verwrite] Allow overwriting files
|
|
67
|
+
|
|
68
|
+
Example: dts-gen -m fs
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Input Options
|
|
72
|
+
|
|
73
|
+
Only one of the following inputs may be specified.
|
|
74
|
+
|
|
75
|
+
#### `--module` (`-m`)
|
|
76
|
+
|
|
77
|
+
Example: `--module express`
|
|
78
|
+
|
|
79
|
+
The name of the node module to generate a file for.
|
|
80
|
+
This string will be `require`'d at runtime, so the normal nodejs rules about the module needing to be installed still apply.
|
|
81
|
+
|
|
82
|
+
#### `--identifier` (`-i`)
|
|
83
|
+
|
|
84
|
+
Example: `--identifier Math`
|
|
85
|
+
|
|
86
|
+
A bare identifier to generate a file for.
|
|
87
|
+
Certain dotted names will work here.
|
|
88
|
+
This string will be `eval`'d to get the value.
|
|
89
|
+
|
|
90
|
+
#### `--expression` (`-e`)
|
|
91
|
+
|
|
92
|
+
Example: `--expression "new Date()"`
|
|
93
|
+
|
|
94
|
+
An arbitrary expression to generate a file for.
|
|
95
|
+
By default, this will be assigned to the name `dts_gen_expr` and generated as `dts_gen_expr.d.ts`.
|
|
96
|
+
You can use the `-name` parameter to change this.
|
|
97
|
+
|
|
98
|
+
#### `--expression-file`
|
|
99
|
+
|
|
100
|
+
Example: `--expression-file "expressions.js"`
|
|
101
|
+
##### expressions.js
|
|
102
|
+
```js
|
|
103
|
+
var fs = require('fs');
|
|
104
|
+
fs.lstatSync('.');
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
A file containing arbitrary expression to generate a file for.
|
|
108
|
+
The file will be named `${basename}.d.ts`, i.e. `expressions.d.ts`.
|
|
109
|
+
The contents of the file will be `eval`'d, and the last statement in the file will be the value used.
|
|
110
|
+
|
|
111
|
+
#### `--name` (`-n`)
|
|
112
|
+
|
|
113
|
+
Example: `--name MyVar`
|
|
114
|
+
|
|
115
|
+
When using `--expression`, the `--name` parameter changes the global name given to the inferred result.
|
|
116
|
+
|
|
117
|
+
### Output Options
|
|
118
|
+
|
|
119
|
+
At most one output option may be specified.
|
|
120
|
+
If no output option is given, the default is `--file`.
|
|
121
|
+
|
|
122
|
+
#### `--file` (`-f`)
|
|
123
|
+
|
|
124
|
+
Example: `--file my.d.ts`
|
|
125
|
+
|
|
126
|
+
Sets the filename to write to.
|
|
127
|
+
If no filename is specified, the name will be inferred from the module or identifier name.
|
|
128
|
+
|
|
129
|
+
#### `--stdout` (`-s`)
|
|
130
|
+
|
|
131
|
+
Writes the output to `stdout`
|
|
132
|
+
|
|
133
|
+
#### `--dt` (`-d`)
|
|
134
|
+
|
|
135
|
+
Example: `--dt` or `--dt myFolder`
|
|
136
|
+
|
|
137
|
+
Creates a folder suitable for submitting to DefinitelyTyped.
|
|
138
|
+
Before submitting, you'll need to write some tests and fill in the header comments in `index.d.ts`.
|
|
139
|
+
You may change the name of the folder by specifing an argument, otherwise the folder name will be inferred.
|
|
140
|
+
|
|
141
|
+
1. Clone [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped).
|
|
142
|
+
2. `cd DefinitelyTyped/types`
|
|
143
|
+
3. Run dts-gen; eg `dts-gen --dt --name yargs`
|
|
144
|
+
|
|
145
|
+
#### `--overwrite` (`-o`)
|
|
146
|
+
|
|
147
|
+
By default, `dts-gen` will not overwrite existing files on disk.
|
|
148
|
+
Specify `-o` to allow overwriting of files.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function writeDefinitelyTypedPackage(indexDtsContent: string, packageName: string, overwrite: boolean): void;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fs_1 = require("fs");
|
|
4
|
+
const http_1 = require("http");
|
|
5
|
+
const https_1 = require("https");
|
|
6
|
+
const os_1 = require("os");
|
|
7
|
+
const parseGitConfig = require("parse-git-config");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const url_1 = require("url");
|
|
10
|
+
const names_1 = require("./names");
|
|
11
|
+
function writeDefinitelyTypedPackage(indexDtsContent, packageName, overwrite) {
|
|
12
|
+
const dtName = (0, names_1.getDTName)(packageName);
|
|
13
|
+
const packageDir = (0, path_1.join)("types", dtName);
|
|
14
|
+
// Check for overwrite
|
|
15
|
+
if (!overwrite) {
|
|
16
|
+
if ((0, fs_1.existsSync)(packageDir)) {
|
|
17
|
+
console.log(`Directory ${packageDir} already exists and --overwrite was not specified; exiting.`);
|
|
18
|
+
process.exit(2);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (!(0, fs_1.existsSync)(packageDir)) {
|
|
22
|
+
(0, fs_1.mkdirSync)(packageDir);
|
|
23
|
+
}
|
|
24
|
+
run(indexDtsContent, packageName, dtName, packageDir).catch((e) => {
|
|
25
|
+
console.error(e);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.default = writeDefinitelyTypedPackage;
|
|
30
|
+
async function run(indexDtsContent, packageName, dtName, packageDir) {
|
|
31
|
+
const files = [
|
|
32
|
+
["index.d.ts", indexDtsContent],
|
|
33
|
+
[`${dtName}-tests.ts`, ""],
|
|
34
|
+
["tsconfig.json", `${JSON.stringify(getTSConfig(dtName), undefined, 4)}\n`],
|
|
35
|
+
["package.json", `${JSON.stringify(await getPackageJson(dtName, packageName), undefined, 4)}\n`],
|
|
36
|
+
[".npmignore", ["*", "!**/*.d.ts", "!**/*.d.cts", "!**/*.d.mts", "!**/*.d.*.ts"].join("\n") + "\n"],
|
|
37
|
+
];
|
|
38
|
+
for (const [name, text] of files) {
|
|
39
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(packageDir, name), text, "utf-8");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function getTSConfig(dtName) {
|
|
43
|
+
return {
|
|
44
|
+
compilerOptions: {
|
|
45
|
+
module: "commonjs",
|
|
46
|
+
lib: ["es6"],
|
|
47
|
+
noImplicitAny: true,
|
|
48
|
+
noImplicitThis: true,
|
|
49
|
+
strictFunctionTypes: true,
|
|
50
|
+
strictNullChecks: true,
|
|
51
|
+
types: [],
|
|
52
|
+
noEmit: true,
|
|
53
|
+
forceConsistentCasingInFileNames: true,
|
|
54
|
+
},
|
|
55
|
+
files: ["index.d.ts", `${dtName}-tests.ts`],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
async function getPackageJson(dtName, packageName) {
|
|
59
|
+
var _a, _b, _c;
|
|
60
|
+
let version = "x.x";
|
|
61
|
+
let project = "https://github.com/baz/foo " +
|
|
62
|
+
"(Does not have to be to GitHub, " +
|
|
63
|
+
"but prefer linking to a source code repository rather than to a project website.)";
|
|
64
|
+
try {
|
|
65
|
+
const reg = JSON.parse(await loadString(`https://registry.npmjs.org/${packageName}`));
|
|
66
|
+
const { latest } = reg["dist-tags"];
|
|
67
|
+
const { homepage } = reg.versions[latest];
|
|
68
|
+
version = latest.split(".").slice(0, 2).join("."); // Just major.minor
|
|
69
|
+
if (homepage !== undefined)
|
|
70
|
+
project = homepage;
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
console.warn(`Warning: Could not retrieve version/homepage information: ${e.message}`);
|
|
74
|
+
}
|
|
75
|
+
let authorName = "My Self";
|
|
76
|
+
try {
|
|
77
|
+
const globalGitConfig = parseGitConfig.sync({ cwd: (0, os_1.homedir)(), path: ".gitconfig" });
|
|
78
|
+
if (globalGitConfig.user && globalGitConfig.user.name) {
|
|
79
|
+
authorName = globalGitConfig.user.name;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
console.warn(`Warning: Could not retrieve author name: ${e.message}`);
|
|
84
|
+
}
|
|
85
|
+
let authorUserName = "me";
|
|
86
|
+
try {
|
|
87
|
+
const repoGitConfig = parseGitConfig.sync({ path: (0, path_1.join)(".git", "config") });
|
|
88
|
+
if (repoGitConfig['remote "origin"'] && repoGitConfig['remote "origin"'].url) {
|
|
89
|
+
const url = (0, url_1.parse)(repoGitConfig['remote "origin"'].url);
|
|
90
|
+
if (url.hostname === "github.com" && url.pathname) {
|
|
91
|
+
authorUserName = url.pathname.split("/")[1] || authorUserName;
|
|
92
|
+
}
|
|
93
|
+
else if ((_a = url.pathname) === null || _a === void 0 ? void 0 : _a.startsWith("git@github.com")) {
|
|
94
|
+
authorUserName = ((_c = (_b = url.pathname.split(":")) === null || _b === void 0 ? void 0 : _b[1].split("/")) === null || _c === void 0 ? void 0 : _c[0]) || authorUserName;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
console.warn(`Warning: Could not retrieve author's user name: ${e.message}`);
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
private: true,
|
|
103
|
+
name: `@types/${dtName}`,
|
|
104
|
+
version: `${version}.0.9999`,
|
|
105
|
+
projects: [project],
|
|
106
|
+
devDependencies: {
|
|
107
|
+
[`@types/${dtName}`]: "workspace:.",
|
|
108
|
+
},
|
|
109
|
+
owners: [
|
|
110
|
+
{
|
|
111
|
+
name: authorName,
|
|
112
|
+
githubUsername: authorUserName,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function loadString(url) {
|
|
118
|
+
return new Promise((resolve, reject) => {
|
|
119
|
+
(0, https_1.get)(url, (res) => {
|
|
120
|
+
if (res.statusCode !== 200) {
|
|
121
|
+
return reject(new Error(`HTTP Error ${res.statusCode}: ${http_1.STATUS_CODES[res.statusCode || 500]} for ${url}`));
|
|
122
|
+
}
|
|
123
|
+
let rawData = "";
|
|
124
|
+
res.on("data", (chunk) => (rawData += chunk));
|
|
125
|
+
res.on("end", () => resolve(rawData));
|
|
126
|
+
}).on("error", (e) => reject(e));
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=definitely-typed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitely-typed.js","sourceRoot":"","sources":["../src/definitely-typed.ts"],"names":[],"mappings":";;AAAA,2BAA0D;AAC1D,+BAAoC;AACpC,iCAA4B;AAC5B,2BAA6B;AAC7B,mDAAoD;AACpD,+BAAyC;AACzC,6BAAwC;AACxC,mCAAoC;AAEpC,SAAwB,2BAA2B,CACjD,eAAuB,EACvB,WAAmB,EACnB,SAAkB;IAElB,MAAM,MAAM,GAAG,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,IAAA,WAAS,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAE9C,sBAAsB;IACtB,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,IAAI,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE,C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