@graphitation/supermassive 0.1.3 → 0.2.0
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/.eslintcache +1 -1
- package/CHANGELOG.md +10 -2
- package/README.md +88 -0
- package/bin/supermassive.js +5 -0
- package/graphitation-supermassive-0.1.3-1.tgz +0 -0
- package/graphitation-supermassive-0.1.3-2.tgz +0 -0
- package/graphitation-supermassive-0.1.3.tgz +0 -0
- package/lib/{src/ast → ast}/TypedAST.d.ts +2 -0
- package/lib/ast/TypedAST.d.ts.map +1 -0
- package/lib/{src/ast → ast}/addTypesToRequestDocument.d.ts +0 -0
- package/lib/ast/addTypesToRequestDocument.d.ts.map +1 -0
- package/lib/ast/addTypesToRequestDocument.js +8 -5
- package/lib/ast/addTypesToRequestDocument.mjs +9 -5
- package/lib/benchmarks/index.d.ts.map +1 -1
- package/lib/benchmarks/index.js +127 -0
- package/lib/benchmarks/index.mjs +109 -0
- package/lib/benchmarks/nice-benchmark.d.ts +1 -1
- package/lib/benchmarks/nice-benchmark.d.ts.map +1 -1
- package/lib/benchmarks/nice-benchmark.js +72 -0
- package/lib/benchmarks/nice-benchmark.mjs +49 -0
- package/lib/benchmarks/swapi-schema/index.d.ts +1 -0
- package/lib/benchmarks/swapi-schema/index.d.ts.map +1 -1
- package/lib/benchmarks/swapi-schema/index.js +39 -0
- package/lib/benchmarks/swapi-schema/index.mjs +16 -0
- package/lib/benchmarks/swapi-schema/models.d.ts.map +1 -1
- package/lib/benchmarks/swapi-schema/models.js +29 -0
- package/lib/benchmarks/swapi-schema/models.mjs +6 -0
- package/lib/benchmarks/swapi-schema/resolvers.d.ts.map +1 -1
- package/lib/benchmarks/swapi-schema/resolvers.js +237 -0
- package/lib/benchmarks/swapi-schema/resolvers.mjs +231 -0
- package/lib/bin/supermassive.d.ts +3 -0
- package/lib/bin/supermassive.d.ts.map +1 -0
- package/lib/bin/supermassive.js +83 -0
- package/lib/bin/supermassive.mjs +60 -0
- package/lib/bin/typeDefsToImplicitResolvers.d.ts +3 -0
- package/lib/bin/typeDefsToImplicitResolvers.d.ts.map +1 -0
- package/lib/bin/typeDefsToImplicitResolvers.js +82 -0
- package/lib/bin/typeDefsToImplicitResolvers.mjs +59 -0
- package/lib/collectFields.d.ts +17 -0
- package/lib/collectFields.d.ts.map +1 -0
- package/lib/collectFields.js +83 -0
- package/lib/collectFields.mjs +60 -0
- package/lib/compiledQuery.d.ts +1 -0
- package/lib/compiledQuery.d.ts.map +1 -0
- package/lib/compiledQuery.js +0 -0
- package/lib/compiledQuery.mjs +0 -0
- package/lib/execute.d.ts +128 -0
- package/lib/execute.d.ts.map +1 -0
- package/lib/execute.js +376 -0
- package/lib/execute.mjs +365 -0
- package/lib/executeWithSchema.d.ts +4 -0
- package/lib/executeWithSchema.d.ts.map +1 -0
- package/lib/{index.test.js → executeWithSchema.js} +44 -45
- package/lib/executeWithSchema.mjs +62 -0
- package/lib/executeWithoutSchema.d.ts +99 -0
- package/lib/executeWithoutSchema.d.ts.map +1 -0
- package/lib/executeWithoutSchema.js +376 -0
- package/lib/executeWithoutSchema.mjs +365 -0
- package/lib/extractImplicitTypes.d.ts +6 -0
- package/lib/extractImplicitTypes.d.ts.map +1 -0
- package/lib/extractImplicitTypes.js +246 -0
- package/lib/extractImplicitTypes.mjs +233 -0
- package/lib/extractImplicitTypesRuntime.d.ts +4 -0
- package/lib/extractImplicitTypesRuntime.d.ts.map +1 -0
- package/lib/extractImplicitTypesRuntime.js +103 -0
- package/lib/extractImplicitTypesRuntime.mjs +90 -0
- package/lib/extractImplicitTypesToTypescript.d.ts +4 -0
- package/lib/extractImplicitTypesToTypescript.d.ts.map +1 -0
- package/lib/extractImplicitTypesToTypescript.js +169 -0
- package/lib/extractImplicitTypesToTypescript.mjs +148 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +14 -29
- package/lib/index.mjs +14 -29
- package/lib/jsutils/Maybe.d.ts +3 -0
- package/lib/jsutils/Maybe.d.ts.map +1 -0
- package/lib/jsutils/Maybe.js +3 -0
- package/lib/jsutils/Maybe.mjs +0 -0
- package/lib/jsutils/ObjMap.d.ts +13 -0
- package/lib/jsutils/ObjMap.d.ts.map +1 -0
- package/lib/jsutils/ObjMap.js +3 -0
- package/lib/jsutils/ObjMap.mjs +0 -0
- package/lib/jsutils/Path.d.ts +15 -0
- package/lib/jsutils/Path.d.ts.map +1 -0
- package/lib/jsutils/Path.js +23 -0
- package/lib/jsutils/Path.mjs +16 -0
- package/lib/jsutils/PromiseOrValue.d.ts +2 -0
- package/lib/jsutils/PromiseOrValue.d.ts.map +1 -0
- package/lib/jsutils/PromiseOrValue.js +3 -0
- package/lib/jsutils/PromiseOrValue.mjs +0 -0
- package/lib/jsutils/devAssert.d.ts +2 -0
- package/lib/jsutils/devAssert.d.ts.map +1 -0
- package/lib/jsutils/devAssert.js +16 -0
- package/lib/jsutils/devAssert.mjs +9 -0
- package/lib/jsutils/didYouMean.d.ts +6 -0
- package/lib/jsutils/didYouMean.d.ts.map +1 -0
- package/lib/jsutils/didYouMean.js +30 -0
- package/lib/jsutils/didYouMean.mjs +23 -0
- package/lib/jsutils/identityFunc.d.ts +5 -0
- package/lib/jsutils/identityFunc.d.ts.map +1 -0
- package/lib/jsutils/identityFunc.js +13 -0
- package/lib/jsutils/identityFunc.mjs +6 -0
- package/lib/jsutils/inspect.d.ts +5 -0
- package/lib/jsutils/inspect.d.ts.map +1 -0
- package/lib/jsutils/inspect.js +89 -0
- package/lib/jsutils/inspect.mjs +82 -0
- package/lib/jsutils/instanceOf.d.ts +14 -0
- package/lib/jsutils/instanceOf.d.ts.map +1 -0
- package/lib/jsutils/instanceOf.js +55 -0
- package/lib/jsutils/instanceOf.mjs +32 -0
- package/lib/jsutils/invariant.d.ts +2 -0
- package/lib/jsutils/invariant.d.ts.map +1 -0
- package/lib/jsutils/invariant.js +16 -0
- package/lib/jsutils/invariant.mjs +9 -0
- package/lib/jsutils/isAsyncIterable.d.ts +6 -0
- package/lib/jsutils/isAsyncIterable.d.ts.map +1 -0
- package/lib/jsutils/isAsyncIterable.js +13 -0
- package/lib/jsutils/isAsyncIterable.mjs +6 -0
- package/lib/jsutils/isIterableObject.d.ts +18 -0
- package/lib/jsutils/isIterableObject.d.ts.map +1 -0
- package/lib/jsutils/isIterableObject.js +13 -0
- package/lib/jsutils/isIterableObject.mjs +6 -0
- package/lib/jsutils/isObjectLike.d.ts +8 -0
- package/lib/jsutils/isObjectLike.d.ts.map +1 -0
- package/lib/jsutils/isObjectLike.js +13 -0
- package/lib/jsutils/isObjectLike.mjs +6 -0
- package/lib/jsutils/isPromise.d.ts +6 -0
- package/lib/jsutils/isPromise.d.ts.map +1 -0
- package/lib/jsutils/isPromise.js +13 -0
- package/lib/jsutils/isPromise.mjs +6 -0
- package/lib/jsutils/keyMap.d.ts +26 -0
- package/lib/jsutils/keyMap.d.ts.map +1 -0
- package/lib/jsutils/keyMap.js +17 -0
- package/lib/jsutils/keyMap.mjs +10 -0
- package/lib/jsutils/keyValMap.d.ts +20 -0
- package/lib/jsutils/keyValMap.d.ts.map +1 -0
- package/lib/jsutils/keyValMap.js +17 -0
- package/lib/jsutils/keyValMap.mjs +10 -0
- package/lib/jsutils/mapValue.d.ts +7 -0
- package/lib/jsutils/mapValue.d.ts.map +1 -0
- package/lib/jsutils/mapValue.js +17 -0
- package/lib/jsutils/mapValue.mjs +10 -0
- package/lib/jsutils/memoize3.d.ts +5 -0
- package/lib/jsutils/memoize3.d.ts.map +1 -0
- package/lib/jsutils/memoize3.js +34 -0
- package/lib/jsutils/memoize3.mjs +27 -0
- package/lib/jsutils/naturalCompare.d.ts +9 -0
- package/lib/jsutils/naturalCompare.d.ts.map +1 -0
- package/lib/jsutils/naturalCompare.js +53 -0
- package/lib/jsutils/naturalCompare.mjs +46 -0
- package/lib/jsutils/printPathArray.d.ts +5 -0
- package/lib/jsutils/printPathArray.d.ts.map +1 -0
- package/lib/jsutils/printPathArray.js +13 -0
- package/lib/jsutils/printPathArray.mjs +6 -0
- package/lib/jsutils/promiseForObject.d.ts +10 -0
- package/lib/jsutils/promiseForObject.d.ts.map +1 -0
- package/lib/jsutils/promiseForObject.js +19 -0
- package/lib/jsutils/promiseForObject.mjs +12 -0
- package/lib/jsutils/promiseReduce.d.ts +10 -0
- package/lib/jsutils/promiseReduce.d.ts.map +1 -0
- package/lib/jsutils/promiseReduce.js +34 -0
- package/lib/jsutils/promiseReduce.mjs +11 -0
- package/lib/jsutils/suggestionList.d.ts +6 -0
- package/lib/jsutils/suggestionList.d.ts.map +1 -0
- package/lib/jsutils/suggestionList.js +109 -0
- package/lib/jsutils/suggestionList.mjs +86 -0
- package/lib/jsutils/toObjMap.d.ts +4 -0
- package/lib/jsutils/toObjMap.d.ts.map +1 -0
- package/lib/jsutils/toObjMap.js +20 -0
- package/lib/jsutils/toObjMap.mjs +13 -0
- package/lib/transforms/annotateDocumentGraphQLTransform.d.ts +3 -0
- package/lib/transforms/annotateDocumentGraphQLTransform.d.ts.map +1 -0
- package/lib/transforms/annotateDocumentGraphQLTransform.js +37 -0
- package/lib/transforms/annotateDocumentGraphQLTransform.mjs +16 -0
- package/lib/transforms/transformerTestUtils.d.ts +79 -0
- package/lib/transforms/transformerTestUtils.d.ts.map +1 -0
- package/lib/transforms/transformerTestUtils.js +175 -0
- package/lib/transforms/transformerTestUtils.mjs +154 -0
- package/lib/types.d.ts +74 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +3 -0
- package/lib/types.mjs +0 -0
- package/lib/utilities/typeNameFromAST.d.ts +3 -0
- package/lib/utilities/typeNameFromAST.d.ts.map +1 -0
- package/lib/utilities/typeNameFromAST.js +34 -0
- package/lib/utilities/typeNameFromAST.mjs +11 -0
- package/lib/values.d.ts +64 -0
- package/lib/values.d.ts.map +1 -0
- package/lib/values.js +145 -0
- package/lib/values.mjs +137 -0
- package/package.json +9 -4
- package/CHANGELOG.json +0 -65
- package/benchmarks/fixtures/query1.graphql +0 -20
- package/benchmarks/index.ts +0 -68
- package/benchmarks/nice-benchmark.ts +0 -32
- package/benchmarks/swapi-schema/index.ts +0 -13
- package/benchmarks/swapi-schema/models.ts +0 -4
- package/benchmarks/swapi-schema/resolvers.ts +0 -331
- package/benchmarks/swapi-schema/schema.graphql +0 -164
- package/benchmarks/swapi-schema/starwars.json +0 -5991
- package/lib/index.test.mjs +0 -63
- package/lib/src/ast/TypedAST.d.ts.map +0 -1
- package/lib/src/ast/addTypesToRequestDocument.d.ts.map +0 -1
- package/lib/src/index.d.ts +0 -16
- package/lib/src/index.d.ts.map +0 -1
- package/lib/src/index.test.d.ts +0 -2
- package/lib/src/index.test.d.ts.map +0 -1
- package/starwars.json +0 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
6
|
+
};
|
|
7
|
+
__markAsModule(exports);
|
|
8
|
+
__export(exports, {
|
|
9
|
+
naturalCompare: () => naturalCompare
|
|
10
|
+
});
|
|
11
|
+
function naturalCompare(aStr, bStr) {
|
|
12
|
+
let aIndex = 0;
|
|
13
|
+
let bIndex = 0;
|
|
14
|
+
while (aIndex < aStr.length && bIndex < bStr.length) {
|
|
15
|
+
let aChar = aStr.charCodeAt(aIndex);
|
|
16
|
+
let bChar = bStr.charCodeAt(bIndex);
|
|
17
|
+
if (isDigit(aChar) && isDigit(bChar)) {
|
|
18
|
+
let aNum = 0;
|
|
19
|
+
do {
|
|
20
|
+
++aIndex;
|
|
21
|
+
aNum = aNum * 10 + aChar - DIGIT_0;
|
|
22
|
+
aChar = aStr.charCodeAt(aIndex);
|
|
23
|
+
} while (isDigit(aChar) && aNum > 0);
|
|
24
|
+
let bNum = 0;
|
|
25
|
+
do {
|
|
26
|
+
++bIndex;
|
|
27
|
+
bNum = bNum * 10 + bChar - DIGIT_0;
|
|
28
|
+
bChar = bStr.charCodeAt(bIndex);
|
|
29
|
+
} while (isDigit(bChar) && bNum > 0);
|
|
30
|
+
if (aNum < bNum) {
|
|
31
|
+
return -1;
|
|
32
|
+
}
|
|
33
|
+
if (aNum > bNum) {
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
if (aChar < bChar) {
|
|
38
|
+
return -1;
|
|
39
|
+
}
|
|
40
|
+
if (aChar > bChar) {
|
|
41
|
+
return 1;
|
|
42
|
+
}
|
|
43
|
+
++aIndex;
|
|
44
|
+
++bIndex;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return aStr.length - bStr.length;
|
|
48
|
+
}
|
|
49
|
+
const DIGIT_0 = 48;
|
|
50
|
+
const DIGIT_9 = 57;
|
|
51
|
+
function isDigit(code) {
|
|
52
|
+
return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9;
|
|
53
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
function naturalCompare(aStr, bStr) {
|
|
2
|
+
let aIndex = 0;
|
|
3
|
+
let bIndex = 0;
|
|
4
|
+
while (aIndex < aStr.length && bIndex < bStr.length) {
|
|
5
|
+
let aChar = aStr.charCodeAt(aIndex);
|
|
6
|
+
let bChar = bStr.charCodeAt(bIndex);
|
|
7
|
+
if (isDigit(aChar) && isDigit(bChar)) {
|
|
8
|
+
let aNum = 0;
|
|
9
|
+
do {
|
|
10
|
+
++aIndex;
|
|
11
|
+
aNum = aNum * 10 + aChar - DIGIT_0;
|
|
12
|
+
aChar = aStr.charCodeAt(aIndex);
|
|
13
|
+
} while (isDigit(aChar) && aNum > 0);
|
|
14
|
+
let bNum = 0;
|
|
15
|
+
do {
|
|
16
|
+
++bIndex;
|
|
17
|
+
bNum = bNum * 10 + bChar - DIGIT_0;
|
|
18
|
+
bChar = bStr.charCodeAt(bIndex);
|
|
19
|
+
} while (isDigit(bChar) && bNum > 0);
|
|
20
|
+
if (aNum < bNum) {
|
|
21
|
+
return -1;
|
|
22
|
+
}
|
|
23
|
+
if (aNum > bNum) {
|
|
24
|
+
return 1;
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
if (aChar < bChar) {
|
|
28
|
+
return -1;
|
|
29
|
+
}
|
|
30
|
+
if (aChar > bChar) {
|
|
31
|
+
return 1;
|
|
32
|
+
}
|
|
33
|
+
++aIndex;
|
|
34
|
+
++bIndex;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return aStr.length - bStr.length;
|
|
38
|
+
}
|
|
39
|
+
const DIGIT_0 = 48;
|
|
40
|
+
const DIGIT_9 = 57;
|
|
41
|
+
function isDigit(code) {
|
|
42
|
+
return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9;
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
naturalCompare
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printPathArray.d.ts","sourceRoot":"","sources":["../../src/jsutils/printPathArray.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAM3E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
6
|
+
};
|
|
7
|
+
__markAsModule(exports);
|
|
8
|
+
__export(exports, {
|
|
9
|
+
printPathArray: () => printPathArray
|
|
10
|
+
});
|
|
11
|
+
function printPathArray(path) {
|
|
12
|
+
return path.map((key) => typeof key === "number" ? "[" + key.toString() + "]" : "." + key).join("");
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ObjMap } from './ObjMap';
|
|
2
|
+
/**
|
|
3
|
+
* This function transforms a JS object `ObjMap<Promise<T>>` into
|
|
4
|
+
* a `Promise<ObjMap<T>>`
|
|
5
|
+
*
|
|
6
|
+
* This is akin to bluebird's `Promise.props`, but implemented only using
|
|
7
|
+
* `Promise.all` so it will work with any implementation of ES6 promises.
|
|
8
|
+
*/
|
|
9
|
+
export declare function promiseForObject<T>(object: ObjMap<Promise<T>>): Promise<ObjMap<T>>;
|
|
10
|
+
//# sourceMappingURL=promiseForObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promiseForObject.d.ts","sourceRoot":"","sources":["../../src/jsutils/promiseForObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAQpB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
6
|
+
};
|
|
7
|
+
__markAsModule(exports);
|
|
8
|
+
__export(exports, {
|
|
9
|
+
promiseForObject: () => promiseForObject
|
|
10
|
+
});
|
|
11
|
+
function promiseForObject(object) {
|
|
12
|
+
return Promise.all(Object.values(object)).then((resolvedValues) => {
|
|
13
|
+
const resolvedObject = Object.create(null);
|
|
14
|
+
for (const [i, key] of Object.keys(object).entries()) {
|
|
15
|
+
resolvedObject[key] = resolvedValues[i];
|
|
16
|
+
}
|
|
17
|
+
return resolvedObject;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function promiseForObject(object) {
|
|
2
|
+
return Promise.all(Object.values(object)).then((resolvedValues) => {
|
|
3
|
+
const resolvedObject = Object.create(null);
|
|
4
|
+
for (const [i, key] of Object.keys(object).entries()) {
|
|
5
|
+
resolvedObject[key] = resolvedValues[i];
|
|
6
|
+
}
|
|
7
|
+
return resolvedObject;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
promiseForObject
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PromiseOrValue } from './PromiseOrValue';
|
|
2
|
+
/**
|
|
3
|
+
* Similar to Array.prototype.reduce(), however the reducing callback may return
|
|
4
|
+
* a Promise, in which case reduction will continue after each promise resolves.
|
|
5
|
+
*
|
|
6
|
+
* If the callback does not return a Promise, then this function will also not
|
|
7
|
+
* return a Promise.
|
|
8
|
+
*/
|
|
9
|
+
export declare function promiseReduce<T, U>(values: Iterable<T>, callbackFn: (accumulator: U, currentValue: T) => PromiseOrValue<U>, initialValue: PromiseOrValue<U>): PromiseOrValue<U>;
|
|
10
|
+
//# sourceMappingURL=promiseReduce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promiseReduce.d.ts","sourceRoot":"","sources":["../../src/jsutils/promiseReduce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIvD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAChC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EACnB,UAAU,EAAE,CAAC,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,EAClE,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC,GAC9B,cAAc,CAAC,CAAC,CAAC,CAQnB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toModule = (module2) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
|
|
22
|
+
};
|
|
23
|
+
__markAsModule(exports);
|
|
24
|
+
__export(exports, {
|
|
25
|
+
promiseReduce: () => promiseReduce
|
|
26
|
+
});
|
|
27
|
+
var import_isPromise = __toModule(require("./isPromise"));
|
|
28
|
+
function promiseReduce(values, callbackFn, initialValue) {
|
|
29
|
+
let accumulator = initialValue;
|
|
30
|
+
for (const value of values) {
|
|
31
|
+
accumulator = (0, import_isPromise.isPromise)(accumulator) ? accumulator.then((resolved) => callbackFn(resolved, value)) : callbackFn(accumulator, value);
|
|
32
|
+
}
|
|
33
|
+
return accumulator;
|
|
34
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {isPromise} from "./isPromise";
|
|
2
|
+
function promiseReduce(values, callbackFn, initialValue) {
|
|
3
|
+
let accumulator = initialValue;
|
|
4
|
+
for (const value of values) {
|
|
5
|
+
accumulator = isPromise(accumulator) ? accumulator.then((resolved) => callbackFn(resolved, value)) : callbackFn(accumulator, value);
|
|
6
|
+
}
|
|
7
|
+
return accumulator;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
promiseReduce
|
|
11
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Given an invalid input string and a list of valid options, returns a filtered
|
|
3
|
+
* list of valid options sorted based on their similarity with the input.
|
|
4
|
+
*/
|
|
5
|
+
export declare function suggestionList(input: string, options: ReadonlyArray<string>): Array<string>;
|
|
6
|
+
//# sourceMappingURL=suggestionList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggestionList.d.ts","sourceRoot":"","sources":["../../src/jsutils/suggestionList.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,GAC7B,KAAK,CAAC,MAAM,CAAC,CAgBf"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toModule = (module2) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
|
|
22
|
+
};
|
|
23
|
+
__markAsModule(exports);
|
|
24
|
+
__export(exports, {
|
|
25
|
+
suggestionList: () => suggestionList
|
|
26
|
+
});
|
|
27
|
+
var import_naturalCompare = __toModule(require("./naturalCompare"));
|
|
28
|
+
function suggestionList(input, options) {
|
|
29
|
+
const optionsByDistance = Object.create(null);
|
|
30
|
+
const lexicalDistance = new LexicalDistance(input);
|
|
31
|
+
const threshold = Math.floor(input.length * 0.4) + 1;
|
|
32
|
+
for (const option of options) {
|
|
33
|
+
const distance = lexicalDistance.measure(option, threshold);
|
|
34
|
+
if (distance !== void 0) {
|
|
35
|
+
optionsByDistance[option] = distance;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return Object.keys(optionsByDistance).sort((a, b) => {
|
|
39
|
+
const distanceDiff = optionsByDistance[a] - optionsByDistance[b];
|
|
40
|
+
return distanceDiff !== 0 ? distanceDiff : (0, import_naturalCompare.naturalCompare)(a, b);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
class LexicalDistance {
|
|
44
|
+
constructor(input) {
|
|
45
|
+
this._input = input;
|
|
46
|
+
this._inputLowerCase = input.toLowerCase();
|
|
47
|
+
this._inputArray = stringToArray(this._inputLowerCase);
|
|
48
|
+
this._rows = [
|
|
49
|
+
new Array(input.length + 1).fill(0),
|
|
50
|
+
new Array(input.length + 1).fill(0),
|
|
51
|
+
new Array(input.length + 1).fill(0)
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
measure(option, threshold) {
|
|
55
|
+
if (this._input === option) {
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
const optionLowerCase = option.toLowerCase();
|
|
59
|
+
if (this._inputLowerCase === optionLowerCase) {
|
|
60
|
+
return 1;
|
|
61
|
+
}
|
|
62
|
+
let a = stringToArray(optionLowerCase);
|
|
63
|
+
let b = this._inputArray;
|
|
64
|
+
if (a.length < b.length) {
|
|
65
|
+
const tmp = a;
|
|
66
|
+
a = b;
|
|
67
|
+
b = tmp;
|
|
68
|
+
}
|
|
69
|
+
const aLength = a.length;
|
|
70
|
+
const bLength = b.length;
|
|
71
|
+
if (aLength - bLength > threshold) {
|
|
72
|
+
return void 0;
|
|
73
|
+
}
|
|
74
|
+
const rows = this._rows;
|
|
75
|
+
for (let j = 0; j <= bLength; j++) {
|
|
76
|
+
rows[0][j] = j;
|
|
77
|
+
}
|
|
78
|
+
for (let i = 1; i <= aLength; i++) {
|
|
79
|
+
const upRow = rows[(i - 1) % 3];
|
|
80
|
+
const currentRow = rows[i % 3];
|
|
81
|
+
let smallestCell = currentRow[0] = i;
|
|
82
|
+
for (let j = 1; j <= bLength; j++) {
|
|
83
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
84
|
+
let currentCell = Math.min(upRow[j] + 1, currentRow[j - 1] + 1, upRow[j - 1] + cost);
|
|
85
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
86
|
+
const doubleDiagonalCell = rows[(i - 2) % 3][j - 2];
|
|
87
|
+
currentCell = Math.min(currentCell, doubleDiagonalCell + 1);
|
|
88
|
+
}
|
|
89
|
+
if (currentCell < smallestCell) {
|
|
90
|
+
smallestCell = currentCell;
|
|
91
|
+
}
|
|
92
|
+
currentRow[j] = currentCell;
|
|
93
|
+
}
|
|
94
|
+
if (smallestCell > threshold) {
|
|
95
|
+
return void 0;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const distance = rows[aLength % 3][bLength];
|
|
99
|
+
return distance <= threshold ? distance : void 0;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function stringToArray(str) {
|
|
103
|
+
const strLength = str.length;
|
|
104
|
+
const array = new Array(strLength);
|
|
105
|
+
for (let i = 0; i < strLength; ++i) {
|
|
106
|
+
array[i] = str.charCodeAt(i);
|
|
107
|
+
}
|
|
108
|
+
return array;
|
|
109
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {naturalCompare} from "./naturalCompare";
|
|
2
|
+
function suggestionList(input, options) {
|
|
3
|
+
const optionsByDistance = Object.create(null);
|
|
4
|
+
const lexicalDistance = new LexicalDistance(input);
|
|
5
|
+
const threshold = Math.floor(input.length * 0.4) + 1;
|
|
6
|
+
for (const option of options) {
|
|
7
|
+
const distance = lexicalDistance.measure(option, threshold);
|
|
8
|
+
if (distance !== void 0) {
|
|
9
|
+
optionsByDistance[option] = distance;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return Object.keys(optionsByDistance).sort((a, b) => {
|
|
13
|
+
const distanceDiff = optionsByDistance[a] - optionsByDistance[b];
|
|
14
|
+
return distanceDiff !== 0 ? distanceDiff : naturalCompare(a, b);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
class LexicalDistance {
|
|
18
|
+
constructor(input) {
|
|
19
|
+
this._input = input;
|
|
20
|
+
this._inputLowerCase = input.toLowerCase();
|
|
21
|
+
this._inputArray = stringToArray(this._inputLowerCase);
|
|
22
|
+
this._rows = [
|
|
23
|
+
new Array(input.length + 1).fill(0),
|
|
24
|
+
new Array(input.length + 1).fill(0),
|
|
25
|
+
new Array(input.length + 1).fill(0)
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
measure(option, threshold) {
|
|
29
|
+
if (this._input === option) {
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
const optionLowerCase = option.toLowerCase();
|
|
33
|
+
if (this._inputLowerCase === optionLowerCase) {
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
let a = stringToArray(optionLowerCase);
|
|
37
|
+
let b = this._inputArray;
|
|
38
|
+
if (a.length < b.length) {
|
|
39
|
+
const tmp = a;
|
|
40
|
+
a = b;
|
|
41
|
+
b = tmp;
|
|
42
|
+
}
|
|
43
|
+
const aLength = a.length;
|
|
44
|
+
const bLength = b.length;
|
|
45
|
+
if (aLength - bLength > threshold) {
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
const rows = this._rows;
|
|
49
|
+
for (let j = 0; j <= bLength; j++) {
|
|
50
|
+
rows[0][j] = j;
|
|
51
|
+
}
|
|
52
|
+
for (let i = 1; i <= aLength; i++) {
|
|
53
|
+
const upRow = rows[(i - 1) % 3];
|
|
54
|
+
const currentRow = rows[i % 3];
|
|
55
|
+
let smallestCell = currentRow[0] = i;
|
|
56
|
+
for (let j = 1; j <= bLength; j++) {
|
|
57
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
58
|
+
let currentCell = Math.min(upRow[j] + 1, currentRow[j - 1] + 1, upRow[j - 1] + cost);
|
|
59
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
60
|
+
const doubleDiagonalCell = rows[(i - 2) % 3][j - 2];
|
|
61
|
+
currentCell = Math.min(currentCell, doubleDiagonalCell + 1);
|
|
62
|
+
}
|
|
63
|
+
if (currentCell < smallestCell) {
|
|
64
|
+
smallestCell = currentCell;
|
|
65
|
+
}
|
|
66
|
+
currentRow[j] = currentCell;
|
|
67
|
+
}
|
|
68
|
+
if (smallestCell > threshold) {
|
|
69
|
+
return void 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const distance = rows[aLength % 3][bLength];
|
|
73
|
+
return distance <= threshold ? distance : void 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function stringToArray(str) {
|
|
77
|
+
const strLength = str.length;
|
|
78
|
+
const array = new Array(strLength);
|
|
79
|
+
for (let i = 0; i < strLength; ++i) {
|
|
80
|
+
array[i] = str.charCodeAt(i);
|
|
81
|
+
}
|
|
82
|
+
return array;
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
suggestionList
|
|
86
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ObjMap, ObjMapLike, ReadOnlyObjMap, ReadOnlyObjMapLike } from './ObjMap';
|
|
2
|
+
export declare function toObjMap<T>(obj: ObjMapLike<T>): ObjMap<T>;
|
|
3
|
+
export declare function toObjMap<T>(obj: ReadOnlyObjMapLike<T>): ReadOnlyObjMap<T>;
|
|
4
|
+
//# sourceMappingURL=toObjMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toObjMap.d.ts","sourceRoot":"","sources":["../../src/jsutils/toObjMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAC3D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
6
|
+
};
|
|
7
|
+
__markAsModule(exports);
|
|
8
|
+
__export(exports, {
|
|
9
|
+
toObjMap: () => toObjMap
|
|
10
|
+
});
|
|
11
|
+
function toObjMap(obj) {
|
|
12
|
+
if (Object.getPrototypeOf(obj) === null) {
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
const map = Object.create(null);
|
|
16
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
17
|
+
map[key] = value;
|
|
18
|
+
}
|
|
19
|
+
return map;
|
|
20
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FragmentDefinitionNode, GraphQLSchema, OperationDefinitionNode } from "graphql";
|
|
2
|
+
export declare const annotateDocumentGraphQLTransform: (schema: GraphQLSchema) => (node: FragmentDefinitionNode | OperationDefinitionNode) => import("../ast/TypedAST").DefinitionNode;
|
|
3
|
+
//# sourceMappingURL=annotateDocumentGraphQLTransform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotateDocumentGraphQLTransform.d.ts","sourceRoot":"","sources":["../../src/transforms/annotateDocumentGraphQLTransform.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,aAAa,EAEb,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,gCAAgC,WAAY,aAAa,YACtD,sBAAsB,GAAG,uBAAuB,6CAO/D,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toModule = (module2) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
|
|
22
|
+
};
|
|
23
|
+
__markAsModule(exports);
|
|
24
|
+
__export(exports, {
|
|
25
|
+
annotateDocumentGraphQLTransform: () => annotateDocumentGraphQLTransform
|
|
26
|
+
});
|
|
27
|
+
var import_graphql = __toModule(require("graphql"));
|
|
28
|
+
var import_addTypesToRequestDocument = __toModule(require("../ast/addTypesToRequestDocument"));
|
|
29
|
+
const annotateDocumentGraphQLTransform = (schema) => {
|
|
30
|
+
return (node) => {
|
|
31
|
+
const document = (0, import_addTypesToRequestDocument.addTypesToRequestDocument)(schema, {
|
|
32
|
+
kind: import_graphql.Kind.DOCUMENT,
|
|
33
|
+
definitions: [node]
|
|
34
|
+
});
|
|
35
|
+
return document.definitions[0];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Kind
|
|
3
|
+
} from "graphql";
|
|
4
|
+
import {addTypesToRequestDocument} from "../ast/addTypesToRequestDocument";
|
|
5
|
+
const annotateDocumentGraphQLTransform = (schema) => {
|
|
6
|
+
return (node) => {
|
|
7
|
+
const document = addTypesToRequestDocument(schema, {
|
|
8
|
+
kind: Kind.DOCUMENT,
|
|
9
|
+
definitions: [node]
|
|
10
|
+
});
|
|
11
|
+
return document.definitions[0];
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
annotateDocumentGraphQLTransform
|
|
16
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import Ts from "typescript";
|
|
2
|
+
import { Project } from "@ts-morph/bootstrap";
|
|
3
|
+
export declare type TransformerFn = (program: Ts.Program) => Ts.TransformerFactory<Ts.SourceFile>;
|
|
4
|
+
export declare class Transformer {
|
|
5
|
+
private compilerOptions;
|
|
6
|
+
private filePath?;
|
|
7
|
+
private file?;
|
|
8
|
+
private mocks;
|
|
9
|
+
private sources;
|
|
10
|
+
private transformers;
|
|
11
|
+
private project?;
|
|
12
|
+
private clone;
|
|
13
|
+
addMock(moduleDescriptor: ModuleDescriptor): Transformer;
|
|
14
|
+
addSource(source: File): Transformer;
|
|
15
|
+
addTransformer(transformer: TransformerFn): Transformer;
|
|
16
|
+
addTransformers(transformers: TransformerFn[]): Transformer;
|
|
17
|
+
setCompilerOptions(options: Ts.CompilerOptions): Transformer;
|
|
18
|
+
setFile(file: File): Transformer;
|
|
19
|
+
setFilePath(filePath: string): Transformer;
|
|
20
|
+
transform(input?: string): string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export interface ModuleDescriptor {
|
|
26
|
+
name: string;
|
|
27
|
+
content: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @alpha
|
|
31
|
+
*/
|
|
32
|
+
export interface File {
|
|
33
|
+
path: string;
|
|
34
|
+
contents: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @alpha
|
|
38
|
+
*/
|
|
39
|
+
export interface TransformFileOptions {
|
|
40
|
+
project?: Project;
|
|
41
|
+
sources?: ReadonlyArray<File>;
|
|
42
|
+
mocks?: ReadonlyArray<ModuleDescriptor>;
|
|
43
|
+
compilerOptions?: Partial<Ts.CompilerOptions>;
|
|
44
|
+
transforms: ((program: Ts.Program) => Ts.TransformerFactory<Ts.SourceFile>)[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Transform a TypeScript file given a project context and transform function
|
|
48
|
+
* in a virtual filesystem
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const file = {
|
|
53
|
+
* path: '/index.ts',
|
|
54
|
+
* contents: `
|
|
55
|
+
* import { world } from "./world";
|
|
56
|
+
* console.log("Hello,", world);
|
|
57
|
+
* `
|
|
58
|
+
* };
|
|
59
|
+
*
|
|
60
|
+
* const sources = [
|
|
61
|
+
* {
|
|
62
|
+
* path: '/world.ts',
|
|
63
|
+
* contents: `export const world = 'World'`
|
|
64
|
+
* }
|
|
65
|
+
* ];
|
|
66
|
+
*
|
|
67
|
+
* transformFile(file, {
|
|
68
|
+
* sources,
|
|
69
|
+
* transform() { ... }
|
|
70
|
+
* })
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @alpha
|
|
74
|
+
* @param file - File to use as project root
|
|
75
|
+
* @param options - Options providing context to the transformation
|
|
76
|
+
*/
|
|
77
|
+
export declare const transformFile: (file: File, options: TransformFileOptions) => string;
|
|
78
|
+
export declare function getCompilerOptions(options?: Partial<Ts.CompilerOptions>): Ts.CompilerOptions;
|
|
79
|
+
//# sourceMappingURL=transformerTestUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformerTestUtils.d.ts","sourceRoot":"","sources":["../../src/transforms/transformerTestUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAqB,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEjE,oBAAY,aAAa,GAAG,CAC1B,OAAO,EAAE,EAAE,CAAC,OAAO,KAChB,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;AAE1C,qBAAa,WAAW;IACtB,OAAO,CAAC,eAAe,CAA0B;IACjD,OAAO,CAAC,QAAQ,CAAC,CAAS;IAC1B,OAAO,CAAC,IAAI,CAAC,CAAO;IACpB,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,OAAO,CAAC,CAAU;IAE1B,OAAO,CAAC,KAAK;IAYN,OAAO,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,WAAW;IAMxD,SAAS,CAAC,MAAM,EAAE,IAAI,GAAG,WAAW;IAOpC,cAAc,CAAC,WAAW,EAAE,aAAa,GAAG,WAAW;IAOvD,eAAe,CAAC,YAAY,EAAE,aAAa,EAAE,GAAG,WAAW;IAO3D,kBAAkB,CAAC,OAAO,EAAE,EAAE,CAAC,eAAe,GAAG,WAAW;IAe5D,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,WAAW;IAOhC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW;IAO1C,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;CA8BzC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IAEnB,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IAEnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,OAAO,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAE9B,KAAK,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAExC,eAAe,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC;IAE9C,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;CAC/E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,aAAa,SAClB,IAAI,WACD,oBAAoB,KAC5B,MAwDF,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,eAAe,CAAC,GACpC,EAAE,CAAC,eAAe,CAepB"}
|