dugite 3.0.0-rc3 → 3.0.0-rc4
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/.node-version +1 -0
- package/build/lib/env-map.d.ts +20 -0
- package/build/lib/env-map.js +65 -0
- package/build/lib/env-map.js.map +1 -0
- package/build/lib/errors.d.ts +24 -7
- package/build/lib/errors.js +42 -8
- package/build/lib/errors.js.map +1 -1
- package/build/lib/exec.d.ts +101 -0
- package/build/lib/exec.js +53 -0
- package/build/lib/exec.js.map +1 -0
- package/build/lib/git-environment.d.ts +5 -4
- package/build/lib/git-environment.js +29 -40
- package/build/lib/git-environment.js.map +1 -1
- package/build/lib/ignore-closed-input-stream.d.ts +30 -0
- package/build/lib/ignore-closed-input-stream.js +65 -0
- package/build/lib/ignore-closed-input-stream.js.map +1 -0
- package/build/lib/index.d.ts +6 -2
- package/build/lib/index.js +7 -6
- package/build/lib/index.js.map +1 -1
- package/build/lib/parse-bad-config-value-error-info.d.ts +4 -0
- package/build/lib/parse-bad-config-value-error-info.js +20 -0
- package/build/lib/parse-bad-config-value-error-info.js.map +1 -0
- package/build/lib/parse-error.d.ts +2 -0
- package/build/lib/parse-error.js +8 -0
- package/build/lib/parse-error.js.map +1 -0
- package/build/lib/spawn.d.ts +21 -0
- package/build/lib/spawn.js +21 -0
- package/build/lib/spawn.js.map +1 -0
- package/package.json +13 -19
- package/script/config.js +9 -7
- package/script/download-git.js +104 -105
- package/script/test.mjs +43 -0
- package/build/lib/git-process.d.ts +0 -121
- package/build/lib/git-process.js +0 -297
- package/build/lib/git-process.js.map +0 -1
- package/jest.external.config.js +0 -13
- package/jest.fast.config.js +0 -13
- package/jest.slow.config.js +0 -13
- package/script/utils.js +0 -27
@@ -1,121 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
/// <reference types="node" />
|
3
|
-
import { GitError } from './errors';
|
4
|
-
import { ChildProcess } from 'child_process';
|
5
|
-
/** The result of shelling out to git. */
|
6
|
-
export interface IGitResult {
|
7
|
-
/** The standard output from git. */
|
8
|
-
readonly stdout: string;
|
9
|
-
/** The standard error output from git. */
|
10
|
-
readonly stderr: string;
|
11
|
-
/** The exit code of the git process. */
|
12
|
-
readonly exitCode: number;
|
13
|
-
}
|
14
|
-
/**
|
15
|
-
* A set of configuration options that can be passed when
|
16
|
-
* executing a streaming Git command.
|
17
|
-
*/
|
18
|
-
export interface IGitSpawnExecutionOptions {
|
19
|
-
/**
|
20
|
-
* An optional collection of key-value pairs which will be
|
21
|
-
* set as environment variables before executing the git
|
22
|
-
* process.
|
23
|
-
*/
|
24
|
-
readonly env?: Record<string, string | undefined>;
|
25
|
-
}
|
26
|
-
/**
|
27
|
-
* A set of configuration options that can be passed when
|
28
|
-
* executing a git command.
|
29
|
-
*/
|
30
|
-
export interface IGitExecutionOptions {
|
31
|
-
/**
|
32
|
-
* An optional collection of key-value pairs which will be
|
33
|
-
* set as environment variables before executing the git
|
34
|
-
* process.
|
35
|
-
*/
|
36
|
-
readonly env?: Record<string, string | undefined>;
|
37
|
-
/**
|
38
|
-
* An optional string or buffer which will be written to
|
39
|
-
* the child process stdin stream immediately immediately
|
40
|
-
* after spawning the process.
|
41
|
-
*/
|
42
|
-
readonly stdin?: string | Buffer;
|
43
|
-
/**
|
44
|
-
* The encoding to use when writing to stdin, if the stdin
|
45
|
-
* parameter is a string.
|
46
|
-
*/
|
47
|
-
readonly stdinEncoding?: BufferEncoding;
|
48
|
-
/**
|
49
|
-
* The size the output buffer to allocate to the spawned process. Set this
|
50
|
-
* if you are anticipating a large amount of output.
|
51
|
-
*
|
52
|
-
* If not specified, this will be 10MB (10485760 bytes) which should be
|
53
|
-
* enough for most Git operations.
|
54
|
-
*/
|
55
|
-
readonly maxBuffer?: number;
|
56
|
-
/**
|
57
|
-
* An optional callback which will be invoked with the child
|
58
|
-
* process instance after spawning the git process.
|
59
|
-
*
|
60
|
-
* Note that if the stdin parameter was specified the stdin
|
61
|
-
* stream will be closed by the time this callback fires.
|
62
|
-
*/
|
63
|
-
readonly processCallback?: (process: ChildProcess) => void;
|
64
|
-
}
|
65
|
-
export declare class GitProcess {
|
66
|
-
private static pathExists;
|
67
|
-
/**
|
68
|
-
* Execute a command and interact with the process outputs directly.
|
69
|
-
*
|
70
|
-
* The returned promise will reject when the git executable fails to launch,
|
71
|
-
* in which case the thrown Error will have a string `code` property. See
|
72
|
-
* `errors.ts` for some of the known error codes.
|
73
|
-
*/
|
74
|
-
static spawn(args: string[], path: string, options?: IGitSpawnExecutionOptions): ChildProcess;
|
75
|
-
/**
|
76
|
-
* Execute a command and read the output using the embedded Git environment.
|
77
|
-
*
|
78
|
-
* The returned promise will reject when the git executable fails to launch,
|
79
|
-
* in which case the thrown Error will have a string `code` property. See
|
80
|
-
* `errors.ts` for some of the known error codes.
|
81
|
-
*
|
82
|
-
* See the result's `stderr` and `exitCode` for any potential git error
|
83
|
-
* information.
|
84
|
-
*/
|
85
|
-
static exec(args: string[], path: string, options?: IGitExecutionOptions): Promise<IGitResult>;
|
86
|
-
/**
|
87
|
-
* Execute a command and read the output using the embedded Git environment.
|
88
|
-
*
|
89
|
-
* The returned GitTask will will contain `result`, `setPid`, `cancel`
|
90
|
-
* `result` will be a promise, which will reject when the git
|
91
|
-
* executable fails to launch, in which case the thrown Error will
|
92
|
-
* have a string `code` property. See `errors.ts` for some of the
|
93
|
-
* known error codes.
|
94
|
-
* See the result's `stderr` and `exitCode` for any potential git error
|
95
|
-
* information.
|
96
|
-
*
|
97
|
-
* As for, `setPid(pid)`, this is to set the PID
|
98
|
-
*
|
99
|
-
* And `cancel()` will try to cancel the git process
|
100
|
-
*/
|
101
|
-
static execTask(args: string[], path: string, options?: IGitExecutionOptions): IGitTask;
|
102
|
-
/** Try to parse an error type from stderr. */
|
103
|
-
static parseError(stderr: string): GitError | null;
|
104
|
-
static parseBadConfigValueErrorInfo(stderr: string): {
|
105
|
-
key: string;
|
106
|
-
value: string;
|
107
|
-
} | null;
|
108
|
-
}
|
109
|
-
export declare enum GitTaskCancelResult {
|
110
|
-
successfulCancel = 0,
|
111
|
-
processAlreadyEnded = 1,
|
112
|
-
noProcessIdDefined = 2,
|
113
|
-
failedToCancel = 3
|
114
|
-
}
|
115
|
-
/** This interface represents a git task (process). */
|
116
|
-
export interface IGitTask {
|
117
|
-
/** Result of the git process. */
|
118
|
-
readonly result: Promise<IGitResult>;
|
119
|
-
/** Allows to cancel the process if it's running. Returns true if the process was killed. */
|
120
|
-
readonly cancel: () => Promise<GitTaskCancelResult>;
|
121
|
-
}
|
package/build/lib/git-process.js
DELETED
@@ -1,297 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.GitTaskCancelResult = exports.GitProcess = void 0;
|
27
|
-
const fs = __importStar(require("fs"));
|
28
|
-
const process_1 = require("process");
|
29
|
-
const child_process_1 = require("child_process");
|
30
|
-
const errors_1 = require("./errors");
|
31
|
-
const git_environment_1 = require("./git-environment");
|
32
|
-
class GitProcess {
|
33
|
-
static pathExists(path) {
|
34
|
-
try {
|
35
|
-
fs.accessSync(path, fs.F_OK);
|
36
|
-
return true;
|
37
|
-
}
|
38
|
-
catch {
|
39
|
-
return false;
|
40
|
-
}
|
41
|
-
}
|
42
|
-
/**
|
43
|
-
* Execute a command and interact with the process outputs directly.
|
44
|
-
*
|
45
|
-
* The returned promise will reject when the git executable fails to launch,
|
46
|
-
* in which case the thrown Error will have a string `code` property. See
|
47
|
-
* `errors.ts` for some of the known error codes.
|
48
|
-
*/
|
49
|
-
static spawn(args, path, options) {
|
50
|
-
let customEnv = {};
|
51
|
-
if (options && options.env) {
|
52
|
-
customEnv = options.env;
|
53
|
-
}
|
54
|
-
const { env, gitLocation } = (0, git_environment_1.setupEnvironment)(customEnv);
|
55
|
-
const spawnArgs = {
|
56
|
-
env,
|
57
|
-
cwd: path,
|
58
|
-
};
|
59
|
-
const spawnedProcess = (0, child_process_1.spawn)(gitLocation, args, spawnArgs);
|
60
|
-
ignoreClosedInputStream(spawnedProcess);
|
61
|
-
return spawnedProcess;
|
62
|
-
}
|
63
|
-
/**
|
64
|
-
* Execute a command and read the output using the embedded Git environment.
|
65
|
-
*
|
66
|
-
* The returned promise will reject when the git executable fails to launch,
|
67
|
-
* in which case the thrown Error will have a string `code` property. See
|
68
|
-
* `errors.ts` for some of the known error codes.
|
69
|
-
*
|
70
|
-
* See the result's `stderr` and `exitCode` for any potential git error
|
71
|
-
* information.
|
72
|
-
*/
|
73
|
-
static exec(args, path, options) {
|
74
|
-
return this.execTask(args, path, options).result;
|
75
|
-
}
|
76
|
-
/**
|
77
|
-
* Execute a command and read the output using the embedded Git environment.
|
78
|
-
*
|
79
|
-
* The returned GitTask will will contain `result`, `setPid`, `cancel`
|
80
|
-
* `result` will be a promise, which will reject when the git
|
81
|
-
* executable fails to launch, in which case the thrown Error will
|
82
|
-
* have a string `code` property. See `errors.ts` for some of the
|
83
|
-
* known error codes.
|
84
|
-
* See the result's `stderr` and `exitCode` for any potential git error
|
85
|
-
* information.
|
86
|
-
*
|
87
|
-
* As for, `setPid(pid)`, this is to set the PID
|
88
|
-
*
|
89
|
-
* And `cancel()` will try to cancel the git process
|
90
|
-
*/
|
91
|
-
static execTask(args, path, options) {
|
92
|
-
let pidResolve;
|
93
|
-
const pidPromise = new Promise(function (resolve) {
|
94
|
-
pidResolve = resolve;
|
95
|
-
});
|
96
|
-
let result = new GitTask(new Promise(function (resolve, reject) {
|
97
|
-
let customEnv = {};
|
98
|
-
if (options && options.env) {
|
99
|
-
customEnv = options.env;
|
100
|
-
}
|
101
|
-
const { env, gitLocation } = (0, git_environment_1.setupEnvironment)(customEnv);
|
102
|
-
// Explicitly annotate opts since typescript is unable to infer the correct
|
103
|
-
// signature for execFile when options is passed as an opaque hash. The type
|
104
|
-
// definition for execFile currently infers based on the encoding parameter
|
105
|
-
// which could change between declaration time and being passed to execFile.
|
106
|
-
// See https://git.io/vixyQ
|
107
|
-
const execOptions = {
|
108
|
-
cwd: path,
|
109
|
-
encoding: 'utf8',
|
110
|
-
maxBuffer: options ? options.maxBuffer : 10 * 1024 * 1024,
|
111
|
-
env,
|
112
|
-
};
|
113
|
-
const spawnedProcess = (0, child_process_1.execFile)(gitLocation, args, execOptions, function (err, stdout, stderr) {
|
114
|
-
result.updateProcessEnded();
|
115
|
-
if (!err) {
|
116
|
-
resolve({ stdout, stderr, exitCode: 0 });
|
117
|
-
return;
|
118
|
-
}
|
119
|
-
const errWithCode = err;
|
120
|
-
let code = errWithCode.code;
|
121
|
-
// If the error's code is a string then it means the code isn't the
|
122
|
-
// process's exit code but rather an error coming from Node's bowels,
|
123
|
-
// e.g., ENOENT.
|
124
|
-
if (typeof code === 'string') {
|
125
|
-
if (code === 'ENOENT') {
|
126
|
-
let message = err.message;
|
127
|
-
if (GitProcess.pathExists(path) === false) {
|
128
|
-
message = 'Unable to find path to repository on disk.';
|
129
|
-
code = errors_1.RepositoryDoesNotExistErrorCode;
|
130
|
-
}
|
131
|
-
else {
|
132
|
-
message = `Git could not be found at the expected path: '${gitLocation}'. This might be a problem with how the application is packaged, so confirm this folder hasn't been removed when packaging.`;
|
133
|
-
code = errors_1.GitNotFoundErrorCode;
|
134
|
-
}
|
135
|
-
const error = new Error(message);
|
136
|
-
error.name = err.name;
|
137
|
-
error.code = code;
|
138
|
-
reject(error);
|
139
|
-
}
|
140
|
-
else {
|
141
|
-
reject(err);
|
142
|
-
}
|
143
|
-
return;
|
144
|
-
}
|
145
|
-
if (typeof code === 'number') {
|
146
|
-
resolve({ stdout, stderr, exitCode: code });
|
147
|
-
return;
|
148
|
-
}
|
149
|
-
// Git has returned an output that couldn't fit in the specified buffer
|
150
|
-
// as we don't know how many bytes it requires, rethrow the error with
|
151
|
-
// details about what it was previously set to...
|
152
|
-
if (err.message === 'stdout maxBuffer exceeded') {
|
153
|
-
reject(new Error(`The output from the command could not fit into the allocated stdout buffer. Set options.maxBuffer to a larger value than ${execOptions.maxBuffer} bytes`));
|
154
|
-
}
|
155
|
-
else {
|
156
|
-
reject(err);
|
157
|
-
}
|
158
|
-
});
|
159
|
-
pidResolve(spawnedProcess.pid);
|
160
|
-
ignoreClosedInputStream(spawnedProcess);
|
161
|
-
if (options && options.stdin !== undefined && spawnedProcess.stdin) {
|
162
|
-
// See https://github.com/nodejs/node/blob/7b5ffa46fe4d2868c1662694da06eb55ec744bde/test/parallel/test-stdin-pipe-large.js
|
163
|
-
if (options.stdinEncoding) {
|
164
|
-
spawnedProcess.stdin.end(options.stdin, options.stdinEncoding);
|
165
|
-
}
|
166
|
-
else {
|
167
|
-
spawnedProcess.stdin.end(options.stdin);
|
168
|
-
}
|
169
|
-
}
|
170
|
-
if (options && options.processCallback) {
|
171
|
-
options.processCallback(spawnedProcess);
|
172
|
-
}
|
173
|
-
}), pidPromise);
|
174
|
-
return result;
|
175
|
-
}
|
176
|
-
/** Try to parse an error type from stderr. */
|
177
|
-
static parseError(stderr) {
|
178
|
-
for (const [regex, error] of Object.entries(errors_1.GitErrorRegexes)) {
|
179
|
-
if (stderr.match(regex)) {
|
180
|
-
return error;
|
181
|
-
}
|
182
|
-
}
|
183
|
-
return null;
|
184
|
-
}
|
185
|
-
static parseBadConfigValueErrorInfo(stderr) {
|
186
|
-
const errorEntry = Object.entries(errors_1.GitErrorRegexes).find(([_, v]) => v === errors_1.GitError.BadConfigValue);
|
187
|
-
if (errorEntry === undefined) {
|
188
|
-
return null;
|
189
|
-
}
|
190
|
-
const m = stderr.match(errorEntry[0]);
|
191
|
-
if (m === null) {
|
192
|
-
return null;
|
193
|
-
}
|
194
|
-
if (!m[1] || !m[2]) {
|
195
|
-
return null;
|
196
|
-
}
|
197
|
-
return { key: m[2], value: m[1] };
|
198
|
-
}
|
199
|
-
}
|
200
|
-
exports.GitProcess = GitProcess;
|
201
|
-
/**
|
202
|
-
* Prevent errors originating from the stdin stream related
|
203
|
-
* to the child process closing the pipe from bubbling up and
|
204
|
-
* causing an unhandled exception when no error handler is
|
205
|
-
* attached to the input stream.
|
206
|
-
*
|
207
|
-
* The common scenario where this happens is if the consumer
|
208
|
-
* is writing data to the stdin stream of a child process and
|
209
|
-
* the child process for one reason or another decides to either
|
210
|
-
* terminate or simply close its standard input. Imagine this
|
211
|
-
* scenario
|
212
|
-
*
|
213
|
-
* cat /dev/zero | head -c 1
|
214
|
-
*
|
215
|
-
* The 'head' command would close its standard input (by terminating)
|
216
|
-
* the moment it has read one byte. In the case of Git this could
|
217
|
-
* happen if you for example pass badly formed input to apply-patch.
|
218
|
-
*
|
219
|
-
* Since consumers of dugite using the `exec` api are unable to get
|
220
|
-
* a hold of the stream until after we've written data to it they're
|
221
|
-
* unable to fix it themselves so we'll just go ahead and ignore the
|
222
|
-
* error for them. By supressing the stream error we can pick up on
|
223
|
-
* the real error when the process exits when we parse the exit code
|
224
|
-
* and the standard error.
|
225
|
-
*
|
226
|
-
* See https://github.com/desktop/desktop/pull/4027#issuecomment-366213276
|
227
|
-
*/
|
228
|
-
function ignoreClosedInputStream({ stdin }) {
|
229
|
-
// If Node fails to spawn due to a runtime error (EACCESS, EAGAIN, etc)
|
230
|
-
// it will not setup the stdio streams, see
|
231
|
-
// https://github.com/nodejs/node/blob/v10.16.0/lib/internal/child_process.js#L342-L354
|
232
|
-
// The error itself will be emitted asynchronously but we're still in
|
233
|
-
// the synchronous path so if we attempts to call `.on` on `.stdin`
|
234
|
-
// (which is undefined) that error would be thrown before the underlying
|
235
|
-
// error.
|
236
|
-
if (!stdin) {
|
237
|
-
return;
|
238
|
-
}
|
239
|
-
stdin.on('error', err => {
|
240
|
-
const code = err.code;
|
241
|
-
// Is the error one that we'd expect from the input stream being
|
242
|
-
// closed, i.e. EPIPE on macOS and EOF on Windows. We've also
|
243
|
-
// seen ECONNRESET failures on Linux hosts so let's throw that in
|
244
|
-
// there for good measure.
|
245
|
-
if (code === 'EPIPE' || code === 'EOF' || code === 'ECONNRESET') {
|
246
|
-
return;
|
247
|
-
}
|
248
|
-
// Nope, this is something else. Are there any other error listeners
|
249
|
-
// attached than us? If not we'll have to mimic the behavior of
|
250
|
-
// EventEmitter.
|
251
|
-
//
|
252
|
-
// See https://nodejs.org/api/errors.html#errors_error_propagation_and_interception
|
253
|
-
//
|
254
|
-
// "For all EventEmitter objects, if an 'error' event handler is not
|
255
|
-
// provided, the error will be thrown"
|
256
|
-
if (stdin.listeners('error').length <= 1) {
|
257
|
-
throw err;
|
258
|
-
}
|
259
|
-
});
|
260
|
-
}
|
261
|
-
var GitTaskCancelResult;
|
262
|
-
(function (GitTaskCancelResult) {
|
263
|
-
GitTaskCancelResult[GitTaskCancelResult["successfulCancel"] = 0] = "successfulCancel";
|
264
|
-
GitTaskCancelResult[GitTaskCancelResult["processAlreadyEnded"] = 1] = "processAlreadyEnded";
|
265
|
-
GitTaskCancelResult[GitTaskCancelResult["noProcessIdDefined"] = 2] = "noProcessIdDefined";
|
266
|
-
GitTaskCancelResult[GitTaskCancelResult["failedToCancel"] = 3] = "failedToCancel";
|
267
|
-
})(GitTaskCancelResult || (exports.GitTaskCancelResult = GitTaskCancelResult = {}));
|
268
|
-
class GitTask {
|
269
|
-
constructor(result, pid) {
|
270
|
-
this.result = result;
|
271
|
-
this.pid = pid;
|
272
|
-
this.processEnded = false;
|
273
|
-
}
|
274
|
-
pid;
|
275
|
-
/** Process may end because process completed or process errored. Either way, we can no longer cancel it. */
|
276
|
-
processEnded;
|
277
|
-
result;
|
278
|
-
updateProcessEnded() {
|
279
|
-
this.processEnded = true;
|
280
|
-
}
|
281
|
-
async cancel() {
|
282
|
-
if (this.processEnded) {
|
283
|
-
return GitTaskCancelResult.processAlreadyEnded;
|
284
|
-
}
|
285
|
-
const pid = await this.pid;
|
286
|
-
if (pid === undefined) {
|
287
|
-
return GitTaskCancelResult.noProcessIdDefined;
|
288
|
-
}
|
289
|
-
try {
|
290
|
-
(0, process_1.kill)(pid);
|
291
|
-
return GitTaskCancelResult.successfulCancel;
|
292
|
-
}
|
293
|
-
catch (e) { }
|
294
|
-
return GitTaskCancelResult.failedToCancel;
|
295
|
-
}
|
296
|
-
}
|
297
|
-
//# sourceMappingURL=git-process.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"git-process.js","sourceRoot":"","sources":["../../lib/git-process.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,qCAA8B;AAE9B,iDAA8E;AAC9E,qCAKiB;AAGjB,uDAAoD;AA+EpD,MAAa,UAAU;IACb,MAAM,CAAC,UAAU,CAAC,IAAY;QACpC,IAAI,CAAC;YACH,EAAE,CAAC,UAAU,CAAC,IAAI,EAAG,EAAU,CAAC,IAAI,CAAC,CAAA;YACrC,OAAO,IAAI,CAAA;QACb,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CA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AAY,EAAE,CAAC;YACtB,OAAO,mBAAmB,CAAC,mBAAmB,CAAA;QAChD,CAAC;QAED,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,GAAG,CAAA;QAE1B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,OAAO,mBAAmB,CAAC,kBAAkB,CAAA;QAC/C,CAAC;QAED,IAAI,CAAC;YACH,IAAA,cAAI,EAAC,GAAG,CAAC,CAAA;YACT,OAAO,mBAAmB,CAAC,gBAAgB,CAAA;QAC7C,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;QAEd,OAAO,mBAAmB,CAAC,cAAc,CAAA;IAC3C,CAAC;CACF"}
|
package/jest.external.config.js
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
roots: ['<rootDir>/lib/', '<rootDir>/test/'],
|
3
|
-
testMatch: ['**/test/external/**/*-test.ts'],
|
4
|
-
setupFilesAfterEnv: ['<rootDir>/test/slow-setup.ts'],
|
5
|
-
collectCoverageFrom: ['lib/**/*.{js,ts}', '!**/node_modules/**', '!**/index.ts'],
|
6
|
-
coverageReporters: ['text-summary', 'json'],
|
7
|
-
globals: {
|
8
|
-
'ts-jest': {
|
9
|
-
babelConfig: true
|
10
|
-
}
|
11
|
-
},
|
12
|
-
preset: 'ts-jest'
|
13
|
-
}
|
package/jest.fast.config.js
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
roots: ['<rootDir>/lib/', '<rootDir>/test/'],
|
3
|
-
testMatch: ['**/test/fast/**/*-test.ts'],
|
4
|
-
setupFilesAfterEnv: ['<rootDir>/test/fast-setup.ts'],
|
5
|
-
collectCoverageFrom: ['lib/**/*.{js,ts}', '!**/node_modules/**', '!**/index.ts'],
|
6
|
-
coverageReporters: ['text-summary', 'json'],
|
7
|
-
globals: {
|
8
|
-
'ts-jest': {
|
9
|
-
babelConfig: true
|
10
|
-
}
|
11
|
-
},
|
12
|
-
preset: 'ts-jest'
|
13
|
-
}
|
package/jest.slow.config.js
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
roots: ['<rootDir>/lib/', '<rootDir>/test/'],
|
3
|
-
testMatch: ['**/test/slow/**/*-test.ts'],
|
4
|
-
setupFilesAfterEnv: ['<rootDir>/test/slow-setup.ts'],
|
5
|
-
collectCoverageFrom: ['lib/**/*.{js,ts}', '!**/node_modules/**', '!**/index.ts'],
|
6
|
-
coverageReporters: ['text-summary', 'json'],
|
7
|
-
globals: {
|
8
|
-
'ts-jest': {
|
9
|
-
babelConfig: true
|
10
|
-
}
|
11
|
-
},
|
12
|
-
preset: 'ts-jest'
|
13
|
-
}
|
package/script/utils.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
const https = require('https')
|
2
|
-
|
3
|
-
/** Quick-and-dirty async https (only) GET request */
|
4
|
-
const get = url => {
|
5
|
-
const options = {
|
6
|
-
headers: { 'User-Agent': 'dugite' },
|
7
|
-
secureProtocol: 'TLSv1_2_method'
|
8
|
-
}
|
9
|
-
|
10
|
-
return new Promise((resolve, reject) => {
|
11
|
-
https.get(url, options).on('response', res => {
|
12
|
-
if ([301, 302].includes(res.statusCode)) {
|
13
|
-
get(res.headers.location).then(resolve, reject)
|
14
|
-
} else if (res.statusCode !== 200) {
|
15
|
-
reject(new Error(`Got ${res.statusCode} from ${url}`))
|
16
|
-
} else {
|
17
|
-
const chunks = []
|
18
|
-
res.on('data', chunk => chunks.push(chunk))
|
19
|
-
res.on('end', () => {
|
20
|
-
resolve(Buffer.concat(chunks).toString('utf8'))
|
21
|
-
})
|
22
|
-
}
|
23
|
-
})
|
24
|
-
})
|
25
|
-
}
|
26
|
-
|
27
|
-
module.exports = { get }
|