@xlr-lib/xlr-utils 0.2.0--canary.2.120 → 1.0.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/dist/cjs/index.cjs +74 -522
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +73 -494
- package/dist/index.mjs +73 -494
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
- package/src/__tests__/validation-helpers.test.ts +2 -2
- package/src/__tests__/xlr-helpers.test.ts +543 -0
- package/src/index.ts +1 -3
- package/src/type-checks.ts +0 -72
- package/src/validation-helpers.ts +2 -8
- package/src/{ts-helpers.ts → xlr-helpers.ts} +70 -178
- package/types/index.d.ts +1 -3
- package/types/type-checks.d.ts +0 -27
- package/types/xlr-helpers.d.ts +13 -0
- package/src/__tests__/annotations.test.ts +0 -40
- package/src/__tests__/documentation.test.ts +0 -116
- package/src/__tests__/ts-helpers.test.ts +0 -180
- package/src/__tests__/type-check.test.ts +0 -39
- package/src/annotations.ts +0 -237
- package/src/documentation.ts +0 -243
- package/types/annotations.d.ts +0 -7
- package/types/documentation.d.ts +0 -14
- package/types/ts-helpers.d.ts +0 -50
package/types/documentation.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { SymbolDisplayPart } from "typescript";
|
|
2
|
-
import type { NodeType } from "@xlr-lib/xlr";
|
|
3
|
-
/**
|
|
4
|
-
* Generate a documentation string for a given node
|
|
5
|
-
*
|
|
6
|
-
* @param node - The source node to author the docs string for
|
|
7
|
-
* @returns - documentation string
|
|
8
|
-
*/
|
|
9
|
-
export declare function createTSDocString(node: NodeType): Array<SymbolDisplayPart>;
|
|
10
|
-
/** Convert the TS SymbolDisplayParts into a single string */
|
|
11
|
-
export declare function symbolDisplayToString(displayParts: Array<SymbolDisplayPart>): string;
|
|
12
|
-
/** Create a documentation string from node */
|
|
13
|
-
export declare function createDocString(node: NodeType): string;
|
|
14
|
-
//# sourceMappingURL=documentation.d.ts.map
|
package/types/ts-helpers.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import type { NodeType, OrType } from "@xlr-lib/xlr";
|
|
3
|
-
/**
|
|
4
|
-
* Returns the required type or the optionally required type
|
|
5
|
-
*/
|
|
6
|
-
export declare function tsStripOptionalType(node: ts.TypeNode): ts.TypeNode;
|
|
7
|
-
/**
|
|
8
|
-
* Returns if the top level declaration is exported
|
|
9
|
-
*/
|
|
10
|
-
export declare function isExportedDeclaration(node: ts.Statement): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Returns if the node is exported from the source file
|
|
13
|
-
*/
|
|
14
|
-
export declare function isNodeExported(node: ts.Node): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Returns the actual type and will following import chains if needed
|
|
17
|
-
*/
|
|
18
|
-
export declare function getReferencedType(node: ts.TypeReferenceNode, typeChecker: ts.TypeChecker): {
|
|
19
|
-
declaration: ts.TypeAliasDeclaration | ts.InterfaceDeclaration;
|
|
20
|
-
exported: boolean;
|
|
21
|
-
} | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* Checks if a type reference points to a TypeScript built-in type
|
|
24
|
-
* by examining whether its declaration comes from TypeScript's lib files.
|
|
25
|
-
*
|
|
26
|
-
* This is more robust than maintaining a hardcoded list of built-in types
|
|
27
|
-
* as it automatically handles all TypeScript lib types (Map, Set, WeakMap,
|
|
28
|
-
* Promise, Array, Date, Error, RegExp, etc.).
|
|
29
|
-
*/
|
|
30
|
-
export declare function isTypeScriptLibType(node: ts.TypeReferenceNode, typeChecker: ts.TypeChecker): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Returns list of string literals from potential union of strings
|
|
33
|
-
*/
|
|
34
|
-
export declare function getStringLiteralsFromUnion(node: ts.Node): Set<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Converts a format string into a regex that can be used to validate a given string matches the template
|
|
37
|
-
*/
|
|
38
|
-
export declare function buildTemplateRegex(node: ts.TemplateLiteralTypeNode, typeChecker: ts.TypeChecker): string;
|
|
39
|
-
/**
|
|
40
|
-
* Walks generics to fill in values from a combination of the default, constraint, and passed in map values
|
|
41
|
-
* TODO convert this to use simpleTransformGenerator
|
|
42
|
-
*/
|
|
43
|
-
export declare function fillInGenerics(xlrNode: NodeType, generics?: Map<string, NodeType>): NodeType;
|
|
44
|
-
/** Applies the TS `Pick` or `Omit` type to an interface/union/intersection */
|
|
45
|
-
export declare function applyPickOrOmitToNodeType(baseObject: NodeType, operation: "Pick" | "Omit", properties: Set<string>): NodeType | undefined;
|
|
46
|
-
/** Applies the TS `Partial` or `Required` type to an interface/union/intersection */
|
|
47
|
-
export declare function applyPartialOrRequiredToNodeType(baseObject: NodeType, modifier: boolean): NodeType;
|
|
48
|
-
/** Applies the TS `Exclude` type to a union */
|
|
49
|
-
export declare function applyExcludeToNodeType(baseObject: OrType, filters: NodeType | OrType): NodeType;
|
|
50
|
-
//# sourceMappingURL=ts-helpers.d.ts.map
|