@continuedev/fetch 1.0.0 → 1.0.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/dist/fetch.d.ts +3 -0
- package/dist/fetch.js +90 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/stream.d.ts +5 -0
- package/dist/stream.js +95 -0
- package/jest.config.d.ts +7 -0
- package/jest.config.js +143 -0
- package/package.json +7 -4
- package/src/fetch.ts +1 -1
- package/src/index.ts +2 -2
- package/tsconfig.json +20 -105
package/dist/fetch.d.ts
ADDED
package/dist/fetch.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as followRedirects from "follow-redirects";
|
|
2
|
+
import { HttpProxyAgent } from "http-proxy-agent";
|
|
3
|
+
import { globalAgent } from "https";
|
|
4
|
+
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
5
|
+
import fetch from "node-fetch";
|
|
6
|
+
import * as fs from "node:fs";
|
|
7
|
+
import tls from "node:tls";
|
|
8
|
+
const { http, https } = followRedirects.default;
|
|
9
|
+
export function fetchwithRequestOptions(url_, init, requestOptions) {
|
|
10
|
+
let url = url_;
|
|
11
|
+
if (typeof url === "string") {
|
|
12
|
+
url = new URL(url);
|
|
13
|
+
}
|
|
14
|
+
const TIMEOUT = 7200; // 7200 seconds = 2 hours
|
|
15
|
+
let globalCerts = [];
|
|
16
|
+
if (process.env.IS_BINARY) {
|
|
17
|
+
if (Array.isArray(globalAgent.options.ca)) {
|
|
18
|
+
globalCerts = [...globalAgent.options.ca.map((cert) => cert.toString())];
|
|
19
|
+
}
|
|
20
|
+
else if (typeof globalAgent.options.ca !== "undefined") {
|
|
21
|
+
globalCerts.push(globalAgent.options.ca.toString());
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const ca = Array.from(new Set([...tls.rootCertificates, ...globalCerts]));
|
|
25
|
+
const customCerts = typeof requestOptions?.caBundlePath === "string"
|
|
26
|
+
? [requestOptions?.caBundlePath]
|
|
27
|
+
: requestOptions?.caBundlePath;
|
|
28
|
+
if (customCerts) {
|
|
29
|
+
ca.push(...customCerts.map((customCert) => fs.readFileSync(customCert, "utf8")));
|
|
30
|
+
}
|
|
31
|
+
const timeout = (requestOptions?.timeout ?? TIMEOUT) * 1000; // measured in ms
|
|
32
|
+
const agentOptions = {
|
|
33
|
+
ca,
|
|
34
|
+
rejectUnauthorized: requestOptions?.verifySsl,
|
|
35
|
+
timeout,
|
|
36
|
+
sessionTimeout: timeout,
|
|
37
|
+
keepAlive: true,
|
|
38
|
+
keepAliveMsecs: timeout,
|
|
39
|
+
};
|
|
40
|
+
// Handle ClientCertificateOptions
|
|
41
|
+
if (requestOptions?.clientCertificate) {
|
|
42
|
+
agentOptions.cert = fs.readFileSync(requestOptions.clientCertificate.cert, "utf8");
|
|
43
|
+
agentOptions.key = fs.readFileSync(requestOptions.clientCertificate.key, "utf8");
|
|
44
|
+
if (requestOptions.clientCertificate.passphrase) {
|
|
45
|
+
agentOptions.passphrase = requestOptions.clientCertificate.passphrase;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const proxy = requestOptions?.proxy;
|
|
49
|
+
// Create agent
|
|
50
|
+
const protocol = url.protocol === "https:" ? https : http;
|
|
51
|
+
const agent = proxy && !requestOptions?.noProxy?.includes(url.hostname)
|
|
52
|
+
? protocol === https
|
|
53
|
+
? new HttpsProxyAgent(proxy, agentOptions)
|
|
54
|
+
: new HttpProxyAgent(proxy, agentOptions)
|
|
55
|
+
: new protocol.Agent(agentOptions);
|
|
56
|
+
let headers = {};
|
|
57
|
+
for (const [key, value] of Object.entries(init?.headers || {})) {
|
|
58
|
+
headers[key] = value;
|
|
59
|
+
}
|
|
60
|
+
headers = {
|
|
61
|
+
...headers,
|
|
62
|
+
...requestOptions?.headers,
|
|
63
|
+
};
|
|
64
|
+
// Replace localhost with 127.0.0.1
|
|
65
|
+
if (url.hostname === "localhost") {
|
|
66
|
+
url.hostname = "127.0.0.1";
|
|
67
|
+
}
|
|
68
|
+
// add extra body properties if provided
|
|
69
|
+
let updatedBody = undefined;
|
|
70
|
+
try {
|
|
71
|
+
if (requestOptions?.extraBodyProperties && typeof init?.body === "string") {
|
|
72
|
+
const parsedBody = JSON.parse(init.body);
|
|
73
|
+
updatedBody = JSON.stringify({
|
|
74
|
+
...parsedBody,
|
|
75
|
+
...requestOptions.extraBodyProperties,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
console.log("Unable to parse HTTP request body: ", e);
|
|
81
|
+
}
|
|
82
|
+
// fetch the request with the provided options
|
|
83
|
+
const resp = fetch(url, {
|
|
84
|
+
...init,
|
|
85
|
+
body: updatedBody ?? init?.body,
|
|
86
|
+
headers: headers,
|
|
87
|
+
agent: agent,
|
|
88
|
+
});
|
|
89
|
+
return resp;
|
|
90
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/stream.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
export declare function toAsyncIterable(nodeReadable: NodeJS.ReadableStream): AsyncGenerator<Uint8Array>;
|
|
3
|
+
export declare function streamResponse(response: Response): AsyncGenerator<string>;
|
|
4
|
+
export declare function streamSse(response: Response): AsyncGenerator<any>;
|
|
5
|
+
export declare function streamJSON(response: Response): AsyncGenerator<any>;
|
package/dist/stream.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export async function* toAsyncIterable(nodeReadable) {
|
|
2
|
+
for await (const chunk of nodeReadable) {
|
|
3
|
+
yield chunk;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export async function* streamResponse(response) {
|
|
7
|
+
if (response.status !== 200) {
|
|
8
|
+
throw new Error(await response.text());
|
|
9
|
+
}
|
|
10
|
+
if (!response.body) {
|
|
11
|
+
throw new Error("No response body returned.");
|
|
12
|
+
}
|
|
13
|
+
// Get the major version of Node.js
|
|
14
|
+
const nodeMajorVersion = parseInt(process.versions.node.split(".")[0], 10);
|
|
15
|
+
if (nodeMajorVersion >= 20) {
|
|
16
|
+
// Use the new API for Node 20 and above
|
|
17
|
+
const stream = ReadableStream.from(response.body);
|
|
18
|
+
for await (const chunk of stream.pipeThrough(new TextDecoderStream("utf-8"))) {
|
|
19
|
+
yield chunk;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
// Fallback for Node versions below 20
|
|
24
|
+
// Streaming with this method doesn't work as version 20+ does
|
|
25
|
+
const decoder = new TextDecoder("utf-8");
|
|
26
|
+
const nodeStream = response.body;
|
|
27
|
+
for await (const chunk of toAsyncIterable(nodeStream)) {
|
|
28
|
+
yield decoder.decode(chunk, { stream: true });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function parseDataLine(line) {
|
|
33
|
+
const json = line.startsWith("data: ")
|
|
34
|
+
? line.slice("data: ".length)
|
|
35
|
+
: line.slice("data:".length);
|
|
36
|
+
try {
|
|
37
|
+
const data = JSON.parse(json);
|
|
38
|
+
if (data.error) {
|
|
39
|
+
throw new Error(`Error streaming response: ${data.error}`);
|
|
40
|
+
}
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
throw new Error(`Malformed JSON sent from server: ${json}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function parseSseLine(line) {
|
|
48
|
+
if (line.startsWith("data: [DONE]")) {
|
|
49
|
+
return { done: true, data: undefined };
|
|
50
|
+
}
|
|
51
|
+
if (line.startsWith("data:")) {
|
|
52
|
+
return { done: false, data: parseDataLine(line) };
|
|
53
|
+
}
|
|
54
|
+
if (line.startsWith(": ping")) {
|
|
55
|
+
return { done: true, data: undefined };
|
|
56
|
+
}
|
|
57
|
+
return { done: false, data: undefined };
|
|
58
|
+
}
|
|
59
|
+
export async function* streamSse(response) {
|
|
60
|
+
let buffer = "";
|
|
61
|
+
for await (const value of streamResponse(response)) {
|
|
62
|
+
buffer += value;
|
|
63
|
+
let position;
|
|
64
|
+
while ((position = buffer.indexOf("\n")) >= 0) {
|
|
65
|
+
const line = buffer.slice(0, position);
|
|
66
|
+
buffer = buffer.slice(position + 1);
|
|
67
|
+
const { done, data } = parseSseLine(line);
|
|
68
|
+
if (done) {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
if (data) {
|
|
72
|
+
yield data;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (buffer.length > 0) {
|
|
77
|
+
const { done, data } = parseSseLine(buffer);
|
|
78
|
+
if (!done && data) {
|
|
79
|
+
yield data;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export async function* streamJSON(response) {
|
|
84
|
+
let buffer = "";
|
|
85
|
+
for await (const value of streamResponse(response)) {
|
|
86
|
+
buffer += value;
|
|
87
|
+
let position;
|
|
88
|
+
while ((position = buffer.indexOf("\n")) >= 0) {
|
|
89
|
+
const line = buffer.slice(0, position);
|
|
90
|
+
const data = JSON.parse(line);
|
|
91
|
+
yield data;
|
|
92
|
+
buffer = buffer.slice(position + 1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
package/jest.config.d.ts
ADDED
package/jest.config.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* For a detailed explanation regarding each configuration property, visit:
|
|
3
|
+
* https://jestjs.io/docs/configuration
|
|
4
|
+
*/
|
|
5
|
+
const config = {
|
|
6
|
+
// All imported modules in your tests should be mocked automatically
|
|
7
|
+
// automock: false,
|
|
8
|
+
// Stop running tests after `n` failures
|
|
9
|
+
// bail: 0,
|
|
10
|
+
// The directory where Jest should store its cached dependency information
|
|
11
|
+
// cacheDirectory: "/private/var/folders/n_/c3r8w0s95xl271j98y2lzhz80000gn/T/jest_dx",
|
|
12
|
+
// Automatically clear mock calls, instances, contexts and results before every test
|
|
13
|
+
clearMocks: true,
|
|
14
|
+
// Indicates whether the coverage information should be collected while executing the test
|
|
15
|
+
collectCoverage: true,
|
|
16
|
+
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
|
17
|
+
// collectCoverageFrom: undefined,
|
|
18
|
+
// The directory where Jest should output its coverage files
|
|
19
|
+
coverageDirectory: "coverage",
|
|
20
|
+
// An array of regexp pattern strings used to skip coverage collection
|
|
21
|
+
// coveragePathIgnorePatterns: [
|
|
22
|
+
// "/node_modules/"
|
|
23
|
+
// ],
|
|
24
|
+
// Indicates which provider should be used to instrument code for coverage
|
|
25
|
+
coverageProvider: "v8",
|
|
26
|
+
// A list of reporter names that Jest uses when writing coverage reports
|
|
27
|
+
// coverageReporters: [
|
|
28
|
+
// "json",
|
|
29
|
+
// "text",
|
|
30
|
+
// "lcov",
|
|
31
|
+
// "clover"
|
|
32
|
+
// ],
|
|
33
|
+
// An object that configures minimum threshold enforcement for coverage results
|
|
34
|
+
// coverageThreshold: undefined,
|
|
35
|
+
// A path to a custom dependency extractor
|
|
36
|
+
// dependencyExtractor: undefined,
|
|
37
|
+
// Make calling deprecated APIs throw helpful error messages
|
|
38
|
+
// errorOnDeprecated: false,
|
|
39
|
+
// The default configuration for fake timers
|
|
40
|
+
// fakeTimers: {
|
|
41
|
+
// "enableGlobally": false
|
|
42
|
+
// },
|
|
43
|
+
// Force coverage collection from ignored files using an array of glob patterns
|
|
44
|
+
// forceCoverageMatch: [],
|
|
45
|
+
// A path to a module which exports an async function that is triggered once before all test suites
|
|
46
|
+
// globalSetup: undefined,
|
|
47
|
+
// A path to a module which exports an async function that is triggered once after all test suites
|
|
48
|
+
// globalTeardown: undefined,
|
|
49
|
+
// A set of global variables that need to be available in all test environments
|
|
50
|
+
// globals: {},
|
|
51
|
+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
|
52
|
+
// maxWorkers: "50%",
|
|
53
|
+
// An array of directory names to be searched recursively up from the requiring module's location
|
|
54
|
+
// moduleDirectories: [
|
|
55
|
+
// "node_modules"
|
|
56
|
+
// ],
|
|
57
|
+
// An array of file extensions your modules use
|
|
58
|
+
// moduleFileExtensions: [
|
|
59
|
+
// "js",
|
|
60
|
+
// "mjs",
|
|
61
|
+
// "cjs",
|
|
62
|
+
// "jsx",
|
|
63
|
+
// "ts",
|
|
64
|
+
// "tsx",
|
|
65
|
+
// "json",
|
|
66
|
+
// "node"
|
|
67
|
+
// ],
|
|
68
|
+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
|
69
|
+
// moduleNameMapper: {},
|
|
70
|
+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
|
71
|
+
// modulePathIgnorePatterns: [],
|
|
72
|
+
// Activates notifications for test results
|
|
73
|
+
// notify: false,
|
|
74
|
+
// An enum that specifies notification mode. Requires { notify: true }
|
|
75
|
+
// notifyMode: "failure-change",
|
|
76
|
+
// A preset that is used as a base for Jest's configuration
|
|
77
|
+
// preset: undefined,
|
|
78
|
+
// Run tests from one or more projects
|
|
79
|
+
// projects: undefined,
|
|
80
|
+
// Use this configuration option to add custom reporters to Jest
|
|
81
|
+
// reporters: undefined,
|
|
82
|
+
// Automatically reset mock state before every test
|
|
83
|
+
// resetMocks: false,
|
|
84
|
+
// Reset the module registry before running each individual test
|
|
85
|
+
// resetModules: false,
|
|
86
|
+
// A path to a custom resolver
|
|
87
|
+
// resolver: undefined,
|
|
88
|
+
// Automatically restore mock state and implementation before every test
|
|
89
|
+
// restoreMocks: false,
|
|
90
|
+
// The root directory that Jest should scan for tests and modules within
|
|
91
|
+
// rootDir: undefined,
|
|
92
|
+
// A list of paths to directories that Jest should use to search for files in
|
|
93
|
+
// roots: [
|
|
94
|
+
// "<rootDir>"
|
|
95
|
+
// ],
|
|
96
|
+
// Allows you to use a custom runner instead of Jest's default test runner
|
|
97
|
+
// runner: "jest-runner",
|
|
98
|
+
// The paths to modules that run some code to configure or set up the testing environment before each test
|
|
99
|
+
// setupFiles: [],
|
|
100
|
+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
|
101
|
+
// setupFilesAfterEnv: [],
|
|
102
|
+
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
|
103
|
+
// slowTestThreshold: 5,
|
|
104
|
+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
|
105
|
+
// snapshotSerializers: [],
|
|
106
|
+
// The test environment that will be used for testing
|
|
107
|
+
// testEnvironment: "jest-environment-node",
|
|
108
|
+
// Options that will be passed to the testEnvironment
|
|
109
|
+
// testEnvironmentOptions: {},
|
|
110
|
+
// Adds a location field to test results
|
|
111
|
+
// testLocationInResults: false,
|
|
112
|
+
// The glob patterns Jest uses to detect test files
|
|
113
|
+
// testMatch: [
|
|
114
|
+
// "**/__tests__/**/*.[jt]s?(x)",
|
|
115
|
+
// "**/?(*.)+(spec|test).[tj]s?(x)"
|
|
116
|
+
// ],
|
|
117
|
+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
|
118
|
+
// testPathIgnorePatterns: [
|
|
119
|
+
// "/node_modules/"
|
|
120
|
+
// ],
|
|
121
|
+
// The regexp pattern or array of patterns that Jest uses to detect test files
|
|
122
|
+
// testRegex: [],
|
|
123
|
+
// This option allows the use of a custom results processor
|
|
124
|
+
// testResultsProcessor: undefined,
|
|
125
|
+
// This option allows use of a custom test runner
|
|
126
|
+
// testRunner: "jest-circus/runner",
|
|
127
|
+
// A map from regular expressions to paths to transformers
|
|
128
|
+
// transform: undefined,
|
|
129
|
+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
|
130
|
+
// transformIgnorePatterns: [
|
|
131
|
+
// "/node_modules/",
|
|
132
|
+
// "\\.pnp\\.[^\\/]+$"
|
|
133
|
+
// ],
|
|
134
|
+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
|
135
|
+
// unmockedModulePathPatterns: undefined,
|
|
136
|
+
// Indicates whether each individual test should be reported during the run
|
|
137
|
+
// verbose: undefined,
|
|
138
|
+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
|
139
|
+
// watchPathIgnorePatterns: [],
|
|
140
|
+
// Whether to use watchman for file crawling
|
|
141
|
+
// watchman: true,
|
|
142
|
+
};
|
|
143
|
+
export default config;
|
package/package.json
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@continuedev/fetch",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
6
8
|
"scripts": {
|
|
7
|
-
"test": "jest"
|
|
9
|
+
"test": "jest",
|
|
10
|
+
"build": "tsc"
|
|
8
11
|
},
|
|
9
12
|
"author": "Nate Sesti and Ty Dunn",
|
|
10
13
|
"license": "Apache-2.0",
|
|
11
14
|
"dependencies": {
|
|
12
|
-
"@continuedev/config-types": "^1.0.
|
|
15
|
+
"@continuedev/config-types": "^1.0.5",
|
|
13
16
|
"follow-redirects": "^1.15.6",
|
|
14
17
|
"http-proxy-agent": "^7.0.2",
|
|
15
18
|
"https-proxy-agent": "^7.0.5",
|
package/src/fetch.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequestOptions } from "@continuedev/config-types/src/index";
|
|
1
|
+
import { RequestOptions } from "@continuedev/config-types/src/index.js";
|
|
2
2
|
import * as followRedirects from "follow-redirects";
|
|
3
3
|
import { HttpProxyAgent } from "http-proxy-agent";
|
|
4
4
|
import { globalAgent } from "https";
|
package/src/index.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,108 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// "
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
-
|
|
27
|
-
/* Modules */
|
|
28
|
-
"module": "commonjs", /* Specify what module code is generated. */
|
|
29
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
-
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
39
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
40
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
41
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
42
|
-
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
43
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
44
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
45
|
-
|
|
46
|
-
/* JavaScript Support */
|
|
47
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
48
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
49
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
50
|
-
|
|
51
|
-
/* Emit */
|
|
52
|
-
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
53
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
54
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
55
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
56
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
57
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
58
|
-
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
59
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
60
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
61
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
62
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
63
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
64
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
65
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
66
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
67
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
68
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
69
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
70
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
71
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
72
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
73
|
-
|
|
74
|
-
/* Interop Constraints */
|
|
75
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
76
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
77
|
-
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
78
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
79
|
-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
80
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
81
|
-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
82
|
-
|
|
83
|
-
/* Type Checking */
|
|
84
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
85
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
86
|
-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
87
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
88
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
89
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
90
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
91
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
92
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
93
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
94
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
95
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
96
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
97
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
98
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
99
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
100
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
101
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
102
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
103
|
-
|
|
104
|
-
/* Completeness */
|
|
105
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
106
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
107
|
-
}
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": ["DOM", "ESNext"],
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"moduleResolution": "NodeNext",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"noEmitOnError": false,
|
|
17
|
+
"types": ["node"],
|
|
18
|
+
"outDir": "dist",
|
|
19
|
+
"declaration": true
|
|
20
|
+
// "sourceMap": true
|
|
21
|
+
},
|
|
22
|
+
"include": ["src/**/*"]
|
|
108
23
|
}
|