dts-gen 0.6.0 → 0.7.1
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/SECURITY.md +41 -0
- package/bin/lib/definitely-typed.js +57 -48
- package/bin/lib/index.js +14 -12
- package/bin/lib/names.js +1 -0
- package/bin/lib/run.js +16 -12
- package/package.json +1 -1
- package/.vscode/launch.json +0 -19
package/SECURITY.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
|
|
2
|
+
|
|
3
|
+
## Security
|
|
4
|
+
|
|
5
|
+
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
|
6
|
+
|
|
7
|
+
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
|
|
8
|
+
|
|
9
|
+
## Reporting Security Issues
|
|
10
|
+
|
|
11
|
+
**Please do not report security vulnerabilities through public GitHub issues.**
|
|
12
|
+
|
|
13
|
+
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
|
|
14
|
+
|
|
15
|
+
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
|
|
16
|
+
|
|
17
|
+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
|
|
18
|
+
|
|
19
|
+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
|
20
|
+
|
|
21
|
+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
|
22
|
+
* Full paths of source file(s) related to the manifestation of the issue
|
|
23
|
+
* The location of the affected source code (tag/branch/commit or direct URL)
|
|
24
|
+
* Any special configuration required to reproduce the issue
|
|
25
|
+
* Step-by-step instructions to reproduce the issue
|
|
26
|
+
* Proof-of-concept or exploit code (if possible)
|
|
27
|
+
* Impact of the issue, including how an attacker might exploit the issue
|
|
28
|
+
|
|
29
|
+
This information will help us triage your report more quickly.
|
|
30
|
+
|
|
31
|
+
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
|
|
32
|
+
|
|
33
|
+
## Preferred Languages
|
|
34
|
+
|
|
35
|
+
We prefer all communications to be in English.
|
|
36
|
+
|
|
37
|
+
## Policy
|
|
38
|
+
|
|
39
|
+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
|
|
40
|
+
|
|
41
|
+
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
5
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
6
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) :
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
9
|
});
|
|
9
10
|
};
|
|
10
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
12
|
const fs_1 = require("fs");
|
|
12
13
|
const http_1 = require("http");
|
|
14
|
+
const https_1 = require("https");
|
|
13
15
|
const os_1 = require("os");
|
|
14
16
|
const parseGitConfig = require("parse-git-config");
|
|
15
17
|
const path_1 = require("path");
|
|
16
18
|
const url_1 = require("url");
|
|
17
19
|
const names_1 = require("./names");
|
|
18
20
|
function writeDefinitelyTypedPackage(indexDtsContent, packageName, overwrite) {
|
|
19
|
-
const dtName = names_1.getDTName(packageName);
|
|
20
|
-
const packageDir = path_1.join("types", dtName);
|
|
21
|
+
const dtName = (0, names_1.getDTName)(packageName);
|
|
22
|
+
const packageDir = (0, path_1.join)("types", dtName);
|
|
21
23
|
// Check for overwrite
|
|
22
24
|
if (!overwrite) {
|
|
23
|
-
if (fs_1.existsSync(packageDir)) {
|
|
24
|
-
console.log(`Directory ${packageDir} already exists and
|
|
25
|
+
if ((0, fs_1.existsSync)(packageDir)) {
|
|
26
|
+
console.log(`Directory ${packageDir} already exists and --overwrite was not specified; exiting.`);
|
|
25
27
|
process.exit(2);
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
|
-
if (!fs_1.existsSync(packageDir)) {
|
|
29
|
-
fs_1.mkdirSync(packageDir);
|
|
30
|
+
if (!(0, fs_1.existsSync)(packageDir)) {
|
|
31
|
+
(0, fs_1.mkdirSync)(packageDir);
|
|
30
32
|
}
|
|
31
33
|
run(indexDtsContent, packageName, dtName, packageDir).catch(e => {
|
|
32
34
|
console.error(e);
|
|
@@ -37,24 +39,45 @@ exports.default = writeDefinitelyTypedPackage;
|
|
|
37
39
|
function run(indexDtsContent, packageName, dtName, packageDir) {
|
|
38
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
41
|
const files = [
|
|
40
|
-
["index.d.ts",
|
|
42
|
+
["index.d.ts", indexDtsContent],
|
|
41
43
|
[`${dtName}-tests.ts`, ""],
|
|
42
44
|
["tsconfig.json", `${JSON.stringify(getTSConfig(dtName), undefined, 4)}\n`],
|
|
43
|
-
["
|
|
45
|
+
["package.json", `${JSON.stringify(yield getPackageJson(dtName, packageName), undefined, 4)}\n`],
|
|
46
|
+
["tslint.json", '{ "extends": "@definitelytyped/dtslint/dt.json" }\n'],
|
|
44
47
|
];
|
|
45
48
|
for (const [name, text] of files) {
|
|
46
|
-
fs_1.writeFileSync(path_1.join(packageDir, name), text, "utf-8");
|
|
49
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(packageDir, name), text, "utf-8");
|
|
47
50
|
}
|
|
48
51
|
});
|
|
49
52
|
}
|
|
50
|
-
function
|
|
53
|
+
function getTSConfig(dtName) {
|
|
54
|
+
return {
|
|
55
|
+
compilerOptions: {
|
|
56
|
+
module: "commonjs",
|
|
57
|
+
lib: ["es6"],
|
|
58
|
+
noImplicitAny: true,
|
|
59
|
+
noImplicitThis: true,
|
|
60
|
+
strictFunctionTypes: true,
|
|
61
|
+
strictNullChecks: true,
|
|
62
|
+
types: [],
|
|
63
|
+
noEmit: true,
|
|
64
|
+
forceConsistentCasingInFileNames: true,
|
|
65
|
+
},
|
|
66
|
+
files: [
|
|
67
|
+
"index.d.ts",
|
|
68
|
+
`${dtName}-tests.ts`,
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function getPackageJson(dtName, packageName) {
|
|
73
|
+
var _a, _b, _c;
|
|
51
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
75
|
let version = "x.x";
|
|
53
76
|
let project = "https://github.com/baz/foo " +
|
|
54
77
|
"(Does not have to be to GitHub, " +
|
|
55
78
|
"but prefer linking to a source code repository rather than to a project website.)";
|
|
56
79
|
try {
|
|
57
|
-
const reg = JSON.parse(yield loadString(`
|
|
80
|
+
const reg = JSON.parse(yield loadString(`https://registry.npmjs.org/${packageName}`));
|
|
58
81
|
const { latest } = reg["dist-tags"];
|
|
59
82
|
const { homepage } = reg.versions[latest];
|
|
60
83
|
version = latest.split(".").slice(0, 2).join("."); // Just major.minor
|
|
@@ -66,7 +89,7 @@ function getIndex(content, packageName) {
|
|
|
66
89
|
}
|
|
67
90
|
let authorName = 'My Self';
|
|
68
91
|
try {
|
|
69
|
-
const globalGitConfig = parseGitConfig.sync({ cwd: os_1.homedir(), path: '.gitconfig' });
|
|
92
|
+
const globalGitConfig = parseGitConfig.sync({ cwd: (0, os_1.homedir)(), path: '.gitconfig' });
|
|
70
93
|
if (globalGitConfig.user && globalGitConfig.user.name) {
|
|
71
94
|
authorName = globalGitConfig.user.name;
|
|
72
95
|
}
|
|
@@ -76,54 +99,40 @@ function getIndex(content, packageName) {
|
|
|
76
99
|
}
|
|
77
100
|
let authorUserName = 'me';
|
|
78
101
|
try {
|
|
79
|
-
const repoGitConfig = parseGitConfig.sync({ path: path_1.join('.git', 'config') });
|
|
102
|
+
const repoGitConfig = parseGitConfig.sync({ path: (0, path_1.join)('.git', 'config') });
|
|
80
103
|
if (repoGitConfig['remote "origin"'] && repoGitConfig['remote "origin"'].url) {
|
|
81
|
-
const url = url_1.parse(repoGitConfig['remote "origin"'].url);
|
|
104
|
+
const url = (0, url_1.parse)(repoGitConfig['remote "origin"'].url);
|
|
82
105
|
if (url.hostname === 'github.com' && url.pathname) {
|
|
83
106
|
authorUserName = url.pathname.split('/')[1] || authorUserName;
|
|
84
107
|
}
|
|
108
|
+
else if ((_a = url.pathname) === null || _a === void 0 ? void 0 : _a.startsWith('git@github.com')) {
|
|
109
|
+
authorUserName = ((_c = (_b = url.pathname.split(':')) === null || _b === void 0 ? void 0 : _b[1].split('/')) === null || _c === void 0 ? void 0 : _c[0]) || authorUserName;
|
|
110
|
+
}
|
|
85
111
|
}
|
|
86
112
|
}
|
|
87
113
|
catch (e) {
|
|
88
114
|
console.warn(`Warning: Could not retrieve author's user name: ${e.message}`);
|
|
89
115
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
116
|
+
return {
|
|
117
|
+
private: true,
|
|
118
|
+
name: `@types/${dtName}`,
|
|
119
|
+
version: `${version}.0.99999`,
|
|
120
|
+
projects: [project],
|
|
121
|
+
devDependencies: {
|
|
122
|
+
[`@types/${dtName}`]: "workspace:."
|
|
123
|
+
},
|
|
124
|
+
contributors: [
|
|
125
|
+
{
|
|
126
|
+
name: authorName,
|
|
127
|
+
githubUsername: authorUserName
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
};
|
|
101
131
|
});
|
|
102
132
|
}
|
|
103
|
-
function getTSConfig(dtName) {
|
|
104
|
-
return {
|
|
105
|
-
compilerOptions: {
|
|
106
|
-
module: "commonjs",
|
|
107
|
-
lib: ["es6"],
|
|
108
|
-
noImplicitAny: true,
|
|
109
|
-
noImplicitThis: true,
|
|
110
|
-
strictFunctionTypes: true,
|
|
111
|
-
strictNullChecks: true,
|
|
112
|
-
baseUrl: "../",
|
|
113
|
-
typeRoots: ["../"],
|
|
114
|
-
types: [],
|
|
115
|
-
noEmit: true,
|
|
116
|
-
forceConsistentCasingInFileNames: true,
|
|
117
|
-
},
|
|
118
|
-
files: [
|
|
119
|
-
"index.d.ts",
|
|
120
|
-
`${dtName}-tests.ts`,
|
|
121
|
-
],
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
133
|
function loadString(url) {
|
|
125
134
|
return new Promise((resolve, reject) => {
|
|
126
|
-
|
|
135
|
+
(0, https_1.get)(url, res => {
|
|
127
136
|
if (res.statusCode !== 200) {
|
|
128
137
|
return reject(new Error(`HTTP Error ${res.statusCode}: ${http_1.STATUS_CODES[res.statusCode || 500]} for ${url}`));
|
|
129
138
|
}
|
package/bin/lib/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateIdentifierDeclarationFile = exports.generateModuleDeclarationFile = void 0;
|
|
3
4
|
const dom = require("dts-dom");
|
|
4
5
|
const dts_dom_1 = require("dts-dom");
|
|
5
|
-
const names_1 = require("./names");
|
|
6
6
|
const ts = require("typescript");
|
|
7
|
+
const names_1 = require("./names");
|
|
7
8
|
const builtins = {
|
|
8
9
|
Date,
|
|
9
10
|
RegExp,
|
|
@@ -12,29 +13,29 @@ const builtins = {
|
|
|
12
13
|
};
|
|
13
14
|
function forceAsIdentifier(s) {
|
|
14
15
|
// TODO: Make this more comprehensive
|
|
15
|
-
return names_1.getDTName(s.replace(/-/g, '_'));
|
|
16
|
+
return (0, names_1.getDTName)(s.replace(/-/g, '_'));
|
|
16
17
|
}
|
|
17
18
|
function getValueTypes(value) {
|
|
18
19
|
if (typeof value === 'object') {
|
|
19
20
|
// Objects can't be callable, so no need to check for class / function
|
|
20
|
-
return 4 /* Object */;
|
|
21
|
+
return 4 /* ValueTypes.Object */;
|
|
21
22
|
}
|
|
22
23
|
else if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
23
|
-
return 8 /* Primitive */;
|
|
24
|
+
return 8 /* ValueTypes.Primitive */;
|
|
24
25
|
}
|
|
25
26
|
else if (value === null || value === undefined) {
|
|
26
|
-
return 16 /* NullOrUndefined */;
|
|
27
|
+
return 16 /* ValueTypes.NullOrUndefined */;
|
|
27
28
|
}
|
|
28
29
|
else if (typeof value === 'function') {
|
|
29
30
|
if (isClasslike(value)) {
|
|
30
|
-
return 1 /* Class */ | (hasCloduleProperties(value) ? 4 /* Object */ : 0 /* None */);
|
|
31
|
+
return 1 /* ValueTypes.Class */ | (hasCloduleProperties(value) ? 4 /* ValueTypes.Object */ : 0 /* ValueTypes.None */);
|
|
31
32
|
}
|
|
32
33
|
else {
|
|
33
|
-
return 2 /* Function */ | (hasFunduleProperties(value) ? 4 /* Object */ : 0 /* None */);
|
|
34
|
+
return 2 /* ValueTypes.Function */ | (hasFunduleProperties(value) ? 4 /* ValueTypes.Object */ : 0 /* ValueTypes.None */);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
else {
|
|
37
|
-
return 32 /* Unknown */;
|
|
38
|
+
return 32 /* ValueTypes.Unknown */;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
// A class has clodule properties if it has any classes. Anything else can be written with 'static'
|
|
@@ -182,11 +183,11 @@ function getTopLevelDeclarations(name, obj) {
|
|
|
182
183
|
// If anything in here is classlike or functionlike, write it as a namespace.
|
|
183
184
|
// Otherwise, write as a 'const'
|
|
184
185
|
const keys = getKeysOfObject(obj);
|
|
185
|
-
let constituentTypes = 0 /* None */;
|
|
186
|
+
let constituentTypes = 0 /* ValueTypes.None */;
|
|
186
187
|
for (const k of keys) {
|
|
187
188
|
constituentTypes = constituentTypes | getValueTypes(obj[k]);
|
|
188
189
|
}
|
|
189
|
-
if (constituentTypes & (1 /* Class */ | 2 /* Function */)) {
|
|
190
|
+
if (constituentTypes & (1 /* ValueTypes.Class */ | 2 /* ValueTypes.Function */)) {
|
|
190
191
|
const ns = dom.create.namespace(name);
|
|
191
192
|
for (const k of keys) {
|
|
192
193
|
const decls = getTopLevelDeclarations(k, obj[k]);
|
|
@@ -341,8 +342,9 @@ function inferParameterType(_fn, _param) {
|
|
|
341
342
|
// TODO: Inspect function body for clues
|
|
342
343
|
return dom.type.any;
|
|
343
344
|
}
|
|
345
|
+
const stringifyFunction = Function.prototype.call.bind(Function.prototype.toString);
|
|
344
346
|
function parseFunctionBody(fn) {
|
|
345
|
-
const setup = `const myFn = ${fn
|
|
347
|
+
const setup = `const myFn = ${stringifyFunction(fn)};`;
|
|
346
348
|
const srcFile = ts.createSourceFile('test.ts', setup, ts.ScriptTarget.Latest, true);
|
|
347
349
|
const statement = srcFile.statements[0];
|
|
348
350
|
const decl = statement.declarationList.declarations[0];
|
|
@@ -350,5 +352,5 @@ function parseFunctionBody(fn) {
|
|
|
350
352
|
return init;
|
|
351
353
|
}
|
|
352
354
|
function isNativeFunction(fn) {
|
|
353
|
-
return fn
|
|
355
|
+
return stringifyFunction(fn).indexOf('{ [native code] }') > 0;
|
|
354
356
|
}
|
package/bin/lib/names.js
CHANGED
package/bin/lib/run.js
CHANGED
|
@@ -42,17 +42,17 @@ try {
|
|
|
42
42
|
throw new ArgsError('Must specify exactly one input');
|
|
43
43
|
}
|
|
44
44
|
if (typeof args.name === 'boolean')
|
|
45
|
-
throw new ArgsError('Must specify a value for "
|
|
45
|
+
throw new ArgsError('Must specify a value for "--name"');
|
|
46
46
|
if (typeof args.identifier === 'boolean')
|
|
47
|
-
throw new ArgsError('Must specify a value for "
|
|
47
|
+
throw new ArgsError('Must specify a value for "--identifier"');
|
|
48
48
|
if (typeof args.module === 'boolean')
|
|
49
|
-
throw new ArgsError('Must specify a value for "
|
|
49
|
+
throw new ArgsError('Must specify a value for "--module"');
|
|
50
50
|
if (args.overwrite !== undefined && args.overwrite !== true)
|
|
51
|
-
throw new ArgsError('
|
|
51
|
+
throw new ArgsError('--overwrite does not accept an argument');
|
|
52
52
|
let name;
|
|
53
53
|
if (args.module) {
|
|
54
54
|
if (args.name)
|
|
55
|
-
throw new ArgsError('Cannot use
|
|
55
|
+
throw new ArgsError('Cannot use --name with --module');
|
|
56
56
|
name = args.module;
|
|
57
57
|
module.paths.unshift(process.cwd() + '/node_modules');
|
|
58
58
|
result = guess.generateModuleDeclarationFile(args.module, require(args.module));
|
|
@@ -63,7 +63,7 @@ try {
|
|
|
63
63
|
}
|
|
64
64
|
else if (args['expression-file']) {
|
|
65
65
|
if (args.name)
|
|
66
|
-
throw new ArgsError('Cannot use
|
|
66
|
+
throw new ArgsError('Cannot use --name with --expression-file');
|
|
67
67
|
const filename = args['expression-file'];
|
|
68
68
|
name = path.basename(filename, path.extname(filename)).replace(/[^A-Za-z0-9]/g, '_');
|
|
69
69
|
module.paths.unshift(process.cwd() + '/node_modules');
|
|
@@ -72,7 +72,7 @@ try {
|
|
|
72
72
|
}
|
|
73
73
|
else if (args.identifier) {
|
|
74
74
|
if (args.name)
|
|
75
|
-
throw new ArgsError('Cannot use
|
|
75
|
+
throw new ArgsError('Cannot use --name with --identifier');
|
|
76
76
|
if (args.module || args.expression)
|
|
77
77
|
throw new ArgsError('Cannot specify more than one input');
|
|
78
78
|
name = args.identifier;
|
|
@@ -83,14 +83,14 @@ try {
|
|
|
83
83
|
throw new ArgsError('Needs a name');
|
|
84
84
|
name = args.name;
|
|
85
85
|
if (args.module || args.expression)
|
|
86
|
-
throw new ArgsError('Cannot mix
|
|
86
|
+
throw new ArgsError('Cannot mix --template with --module or --expression');
|
|
87
87
|
result = getTemplate(args.template);
|
|
88
88
|
}
|
|
89
89
|
else {
|
|
90
90
|
throw new Error('Internal error, please log a bug with the commandline you specified');
|
|
91
91
|
}
|
|
92
92
|
if (args.dt) {
|
|
93
|
-
definitely_typed_1.default(result, name, !!args.overwrite);
|
|
93
|
+
(0, definitely_typed_1.default)(result, name, !!args.overwrite);
|
|
94
94
|
}
|
|
95
95
|
else if (args.stdout) {
|
|
96
96
|
console.log(result);
|
|
@@ -101,7 +101,7 @@ try {
|
|
|
101
101
|
filename = filename + '.d.ts';
|
|
102
102
|
}
|
|
103
103
|
if (!args.overwrite && fs.existsSync(filename)) {
|
|
104
|
-
console.error(`File ${filename} already exists and
|
|
104
|
+
console.error(`File ${filename} already exists and --overwrite was not specified; exiting.`);
|
|
105
105
|
process.exit(2);
|
|
106
106
|
}
|
|
107
107
|
fs.writeFileSync(filename, prependOurHeader(result), 'utf-8');
|
|
@@ -116,8 +116,9 @@ catch (e) {
|
|
|
116
116
|
process.exit(1);
|
|
117
117
|
}
|
|
118
118
|
else if (e.code === 'MODULE_NOT_FOUND') {
|
|
119
|
-
console.
|
|
120
|
-
|
|
119
|
+
console.error(`Error loading module "${args.module}".\n` +
|
|
120
|
+
getErrorMessageFirstLine(e).replace(/'/g, '"') + '.\n' +
|
|
121
|
+
`Please install missing module and try again.`);
|
|
121
122
|
process.exit(1);
|
|
122
123
|
}
|
|
123
124
|
else {
|
|
@@ -160,3 +161,6 @@ function getTemplate(templateName) {
|
|
|
160
161
|
function allTemplateNames() {
|
|
161
162
|
return fs.readdirSync(templatesDirectory).map(t => t.slice(0, t.length - ".d.ts".length)).join(", ");
|
|
162
163
|
}
|
|
164
|
+
function getErrorMessageFirstLine(error) {
|
|
165
|
+
return error.message.split('\n', 1)[0];
|
|
166
|
+
}
|
package/package.json
CHANGED
package/.vscode/launch.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Use IntelliSense to learn about possible attributes.
|
|
3
|
-
// Hover to view descriptions of existing attributes.
|
|
4
|
-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
-
"version": "0.2.0",
|
|
6
|
-
"configurations": [
|
|
7
|
-
{
|
|
8
|
-
"type": "node",
|
|
9
|
-
"request": "attach",
|
|
10
|
-
"name": "Attach",
|
|
11
|
-
"port": 9229,
|
|
12
|
-
"sourceMaps": true
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"name": "Launch Program",
|
|
16
|
-
"program": "${workspaceFolder}/bin/lib/index.js"
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
}
|