@alloy-js/typescript 0.7.0 → 0.8.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/CHANGELOG.md +28 -0
- package/dist/src/components/ArrayExpression.d.ts.map +1 -1
- package/dist/src/components/ArrayExpression.js +9 -3
- package/dist/src/components/ArrayExpression.js.map +1 -1
- package/dist/src/components/BlockScope.d.ts +13 -0
- package/dist/src/components/BlockScope.d.ts.map +1 -0
- package/dist/src/components/BlockScope.js +20 -0
- package/dist/src/components/BlockScope.js.map +1 -0
- package/dist/src/components/CallSignature.d.ts +38 -0
- package/dist/src/components/CallSignature.d.ts.map +1 -0
- package/dist/src/components/CallSignature.js +26 -0
- package/dist/src/components/CallSignature.js.map +1 -0
- package/dist/src/components/ClassDeclaration.d.ts +3 -4
- package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
- package/dist/src/components/ClassDeclaration.js +99 -41
- package/dist/src/components/ClassDeclaration.js.map +1 -1
- package/dist/src/components/Declaration.d.ts +21 -8
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +39 -21
- package/dist/src/components/Declaration.js.map +1 -1
- package/dist/src/components/EnumDeclaration.d.ts.map +1 -1
- package/dist/src/components/EnumDeclaration.js +18 -6
- package/dist/src/components/EnumDeclaration.js.map +1 -1
- package/dist/src/components/EnumMember.d.ts +8 -0
- package/dist/src/components/EnumMember.d.ts.map +1 -1
- package/dist/src/components/EnumMember.js +27 -5
- package/dist/src/components/EnumMember.js.map +1 -1
- package/dist/src/components/FunctionCallExpression.js +1 -1
- package/dist/src/components/FunctionCallExpression.js.map +1 -1
- package/dist/src/components/FunctionDeclaration.d.ts +21 -13
- package/dist/src/components/FunctionDeclaration.d.ts.map +1 -1
- package/dist/src/components/FunctionDeclaration.js +79 -45
- package/dist/src/components/FunctionDeclaration.js.map +1 -1
- package/dist/src/components/IfStatement.d.ts +25 -0
- package/dist/src/components/IfStatement.d.ts.map +1 -0
- package/dist/src/components/IfStatement.js +34 -0
- package/dist/src/components/IfStatement.js.map +1 -0
- package/dist/src/components/Interface.d.ts +10 -2
- package/dist/src/components/Interface.d.ts.map +1 -1
- package/dist/src/components/Interface.js +66 -6
- package/dist/src/components/Interface.js.map +1 -1
- package/dist/src/components/JSDoc.d.ts.map +1 -1
- package/dist/src/components/JSDoc.js +1 -5
- package/dist/src/components/JSDoc.js.map +1 -1
- package/dist/src/components/JSDocParam.d.ts +22 -0
- package/dist/src/components/JSDocParam.d.ts.map +1 -0
- package/dist/src/components/JSDocParam.js +121 -0
- package/dist/src/components/JSDocParam.js.map +1 -0
- package/dist/src/components/ObjectExpression.d.ts.map +1 -1
- package/dist/src/components/ObjectExpression.js +9 -2
- package/dist/src/components/ObjectExpression.js.map +1 -1
- package/dist/src/components/PropertyName.d.ts +19 -0
- package/dist/src/components/PropertyName.d.ts.map +1 -0
- package/dist/src/components/PropertyName.js +36 -0
- package/dist/src/components/PropertyName.js.map +1 -0
- package/dist/src/components/SingleLineCommentBlock.d.ts +10 -0
- package/dist/src/components/SingleLineCommentBlock.d.ts.map +1 -0
- package/dist/src/components/SingleLineCommentBlock.js +20 -0
- package/dist/src/components/SingleLineCommentBlock.js.map +1 -0
- package/dist/src/components/SourceFile.d.ts +6 -0
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +31 -0
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/SwitchStatement.d.ts +31 -0
- package/dist/src/components/SwitchStatement.d.ts.map +1 -0
- package/dist/src/components/SwitchStatement.js +48 -0
- package/dist/src/components/SwitchStatement.js.map +1 -0
- package/dist/src/components/TypeDeclaration.d.ts.map +1 -1
- package/dist/src/components/TypeDeclaration.js +16 -3
- package/dist/src/components/TypeDeclaration.js.map +1 -1
- package/dist/src/components/VarDeclaration.d.ts +1 -1
- package/dist/src/components/VarDeclaration.d.ts.map +1 -1
- package/dist/src/components/VarDeclaration.js +19 -6
- package/dist/src/components/VarDeclaration.js.map +1 -1
- package/dist/src/components/index.d.ts +7 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +7 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/stc/index.d.ts +35 -112
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js +8 -1
- package/dist/src/components/stc/index.js.map +1 -1
- package/dist/src/context/index.d.ts +2 -0
- package/dist/src/context/index.d.ts.map +1 -0
- package/dist/src/context/index.js +1 -0
- package/dist/src/context/index.js.map +1 -0
- package/dist/src/context/private-scope.d.ts +18 -0
- package/dist/src/context/private-scope.d.ts.map +1 -0
- package/dist/src/context/private-scope.js +9 -0
- package/dist/src/context/private-scope.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/parameter-descriptor.d.ts +60 -0
- package/dist/src/parameter-descriptor.d.ts.map +1 -0
- package/dist/src/parameter-descriptor.js +1 -0
- package/dist/src/parameter-descriptor.js.map +1 -0
- package/dist/src/symbols/reference.d.ts.map +1 -1
- package/dist/src/symbols/reference.js +50 -12
- package/dist/src/symbols/reference.js.map +1 -1
- package/dist/src/symbols/ts-member-scope.d.ts +1 -1
- package/dist/src/symbols/ts-member-scope.d.ts.map +1 -1
- package/dist/src/symbols/ts-member-scope.js +2 -0
- package/dist/src/symbols/ts-member-scope.js.map +1 -1
- package/dist/src/symbols/ts-output-symbol.d.ts +7 -4
- package/dist/src/symbols/ts-output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/ts-output-symbol.js +11 -2
- package/dist/src/symbols/ts-output-symbol.js.map +1 -1
- package/dist/src/utils.d.ts +7 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +17 -0
- package/dist/src/utils.js.map +1 -1
- package/dist/test/block-scope.test.d.ts +2 -0
- package/dist/test/block-scope.test.d.ts.map +1 -0
- package/dist/test/enum-jsdoc.test.d.ts +2 -0
- package/dist/test/enum-jsdoc.test.d.ts.map +1 -0
- package/dist/test/function-declaration-jsdoc.test.d.ts +2 -0
- package/dist/test/function-declaration-jsdoc.test.d.ts.map +1 -0
- package/dist/test/if-statement.test.d.ts +2 -0
- package/dist/test/if-statement.test.d.ts.map +1 -0
- package/dist/test/interface-jsdoc.test.d.ts +2 -0
- package/dist/test/interface-jsdoc.test.d.ts.map +1 -0
- package/dist/test/jscomment.test.d.ts +2 -0
- package/dist/test/jscomment.test.d.ts.map +1 -0
- package/dist/test/jsdoc.test.d.ts.map +1 -1
- package/dist/test/jsdocparam.test.d.ts +2 -0
- package/dist/test/jsdocparam.test.d.ts.map +1 -0
- package/dist/test/name-conflict.test.d.ts +2 -0
- package/dist/test/name-conflict.test.d.ts.map +1 -0
- package/dist/test/package-json.test.d.ts +2 -0
- package/dist/test/package-json.test.d.ts.map +1 -0
- package/dist/test/source-file.test.d.ts +2 -0
- package/dist/test/source-file.test.d.ts.map +1 -0
- package/dist/test/switch-statement.test.d.ts +2 -0
- package/dist/test/switch-statement.test.d.ts.map +1 -0
- package/dist/test/var-declaration-jsdoc.test.d.ts +2 -0
- package/dist/test/var-declaration-jsdoc.test.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/ArrayExpression.tsx +13 -12
- package/src/components/BlockScope.tsx +31 -0
- package/src/components/CallSignature.tsx +67 -0
- package/src/components/ClassDeclaration.tsx +103 -50
- package/src/components/Declaration.tsx +72 -27
- package/src/components/EnumDeclaration.tsx +26 -18
- package/src/components/EnumMember.tsx +24 -4
- package/src/components/FunctionCallExpression.tsx +1 -1
- package/src/components/FunctionDeclaration.tsx +106 -82
- package/src/components/IfStatement.tsx +51 -0
- package/src/components/Interface.tsx +61 -14
- package/src/components/JSDoc.tsx +1 -10
- package/src/components/JSDocParam.tsx +115 -0
- package/src/components/ObjectExpression.tsx +7 -2
- package/src/components/PropertyName.tsx +50 -0
- package/src/components/SingleLineCommentBlock.tsx +21 -0
- package/src/components/SourceFile.tsx +29 -0
- package/src/components/SwitchStatement.tsx +78 -0
- package/src/components/TypeDeclaration.tsx +11 -4
- package/src/components/VarDeclaration.tsx +19 -11
- package/src/components/index.ts +7 -0
- package/src/components/stc/index.ts +8 -1
- package/src/context/index.ts +1 -0
- package/src/context/private-scope.ts +23 -0
- package/src/index.ts +1 -0
- package/src/parameter-descriptor.ts +71 -0
- package/src/symbols/reference.ts +70 -18
- package/src/symbols/ts-member-scope.ts +6 -2
- package/src/symbols/ts-output-symbol.ts +24 -11
- package/src/utils.ts +33 -0
- package/temp/api.json +3816 -1925
- package/test/array.test.tsx +60 -0
- package/test/basic.test.tsx +2 -2
- package/test/block-scope.test.tsx +29 -0
- package/test/class.test.tsx +173 -5
- package/test/enum-jsdoc.test.tsx +74 -0
- package/test/enum.test.tsx +50 -3
- package/test/function-call-expression.test.tsx +5 -2
- package/test/function-declaration-jsdoc.test.tsx +89 -0
- package/test/function-declaration.test.tsx +13 -9
- package/test/if-statement.test.tsx +28 -0
- package/test/interface-jsdoc.test.tsx +164 -0
- package/test/interface.test.tsx +14 -0
- package/test/jscomment.test.tsx +104 -0
- package/test/jsdoc.test.tsx +9 -15
- package/test/jsdocparam.test.tsx +188 -0
- package/test/name-conflict.test.tsx +105 -0
- package/test/name-policy.test.tsx +1 -1
- package/test/package-json.test.tsx +93 -0
- package/test/reference.test.tsx +6 -2
- package/test/source-file.test.tsx +38 -0
- package/test/switch-statement.test.tsx +50 -0
- package/test/value-expression.test.tsx +9 -0
- package/test/var-declaration-jsdoc.test.tsx +70 -0
- package/test/var-declaration.test.tsx +1 -1
- package/tsconfig.json +1 -8
- package/vitest.config.ts +2 -10
- package/dist/src/components/JSDocParagraph.d.ts +0 -10
- package/dist/src/components/JSDocParagraph.d.ts.map +0 -1
- package/dist/src/components/JSDocParagraph.js +0 -23
- package/dist/src/components/JSDocParagraph.js.map +0 -1
- package/src/components/JSDocParagraph.tsx +0 -35
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Children, Refkey } from "@alloy-js/core";
|
|
2
|
+
/**
|
|
3
|
+
* Information for a TypeScript function parameter.
|
|
4
|
+
*/
|
|
5
|
+
export interface ParameterDescriptor {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the parameter.
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* The type of the parameter.
|
|
12
|
+
*/
|
|
13
|
+
type?: Children;
|
|
14
|
+
/**
|
|
15
|
+
* The default value of the parameter.
|
|
16
|
+
*/
|
|
17
|
+
default?: Children;
|
|
18
|
+
/**
|
|
19
|
+
* The refkey for this parameter.
|
|
20
|
+
*/
|
|
21
|
+
refkey?: Refkey | Refkey[];
|
|
22
|
+
/**
|
|
23
|
+
* Whether the parameter is optional.
|
|
24
|
+
*/
|
|
25
|
+
optional?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Arbitrary metadata for the parameter symbol.
|
|
28
|
+
*/
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* Documentation for the parameter.
|
|
32
|
+
*/
|
|
33
|
+
doc?: Children;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Information for a TypeScript generic type parameter.
|
|
37
|
+
*/
|
|
38
|
+
export interface TypeParameterDescriptor {
|
|
39
|
+
/**
|
|
40
|
+
* The name of the type parameter.
|
|
41
|
+
*/
|
|
42
|
+
name: string;
|
|
43
|
+
/**
|
|
44
|
+
* The extends constraint for the type parameter.
|
|
45
|
+
*/
|
|
46
|
+
extends?: Children;
|
|
47
|
+
/**
|
|
48
|
+
* The default type of the type parameter.
|
|
49
|
+
*/
|
|
50
|
+
default?: Children;
|
|
51
|
+
/**
|
|
52
|
+
* A refkey or array of refkeys for this type parameter.
|
|
53
|
+
*/
|
|
54
|
+
refkey?: Refkey | Refkey[];
|
|
55
|
+
/**
|
|
56
|
+
* Arbitrary metadata for the type parameter symbol.
|
|
57
|
+
*/
|
|
58
|
+
metadata?: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=parameter-descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameter-descriptor.d.ts","sourceRoot":"","sources":["../../src/parameter-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEnC;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameter-descriptor.js","names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/symbols/reference.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,
|
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/symbols/reference.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EAKP,MAAM,gBAAgB,CAAC;AAcxB,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,MAAM,CAkGhD"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { memo, OutputSymbolFlags, resolve, untrack, useContext } from "@alloy-js/core";
|
|
1
|
+
import { memo, OutputSymbolFlags, resolve, untrack, useContext, useMemberScope } from "@alloy-js/core";
|
|
2
2
|
import { usePackage } from "../components/PackageDirectory.js";
|
|
3
3
|
import { SourceFileContext } from "../components/SourceFile.js";
|
|
4
|
+
import { usePrivateScope } from "../context/private-scope.js";
|
|
5
|
+
import { isValidJSIdentifier } from "../utils.js";
|
|
6
|
+
import { TSSymbolFlags } from "./ts-output-symbol.js";
|
|
4
7
|
export function ref(refkey) {
|
|
5
8
|
const sourceFile = useContext(SourceFileContext);
|
|
6
9
|
const resolveResult = resolve(refkey);
|
|
10
|
+
const currentScope = useMemberScope();
|
|
11
|
+
const currentPrivateScope = usePrivateScope();
|
|
7
12
|
return memo(() => {
|
|
8
13
|
if (resolveResult.value === undefined) {
|
|
9
14
|
return "<Unresolved Symbol>";
|
|
@@ -13,7 +18,21 @@ export function ref(refkey) {
|
|
|
13
18
|
pathDown,
|
|
14
19
|
memberPath
|
|
15
20
|
} = resolveResult.value;
|
|
16
|
-
|
|
21
|
+
|
|
22
|
+
// if we resolved a instance member, check if we should be able to access
|
|
23
|
+
// it.
|
|
24
|
+
if (targetDeclaration.flags & OutputSymbolFlags.InstanceMember) {
|
|
25
|
+
if (targetDeclaration.tsFlags & TSSymbolFlags.PrivateMember) {
|
|
26
|
+
if (currentPrivateScope?.instanceMembers !== targetDeclaration.scope) {
|
|
27
|
+
throw new Error("Cannot resolve private member symbols from a different scope");
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
if (currentScope?.instanceMembers !== targetDeclaration.scope) {
|
|
31
|
+
throw new Error("Cannot resolve member symbols from a different member scope");
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
validateSymbolReachable(pathDown, memberPath, currentPrivateScope);
|
|
17
36
|
|
|
18
37
|
// Where the target declaration is relative to the referencing scope.
|
|
19
38
|
// * package: target symbol is in a different package
|
|
@@ -52,27 +71,46 @@ export function ref(refkey) {
|
|
|
52
71
|
if (localSymbol) {
|
|
53
72
|
memberPath[0] = localSymbol;
|
|
54
73
|
}
|
|
55
|
-
return
|
|
74
|
+
return buildMemberExpression(memberPath);
|
|
56
75
|
} else {
|
|
57
|
-
return
|
|
76
|
+
return buildMemberExpression([localSymbol ?? targetDeclaration]);
|
|
58
77
|
}
|
|
59
78
|
});
|
|
60
79
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
80
|
+
function buildMemberExpression(path) {
|
|
81
|
+
let memberExpr = "";
|
|
82
|
+
const base = path[0];
|
|
83
|
+
if (base.flags & OutputSymbolFlags.InstanceMember) {
|
|
84
|
+
memberExpr += "this";
|
|
64
85
|
} else {
|
|
65
|
-
|
|
86
|
+
memberExpr += base.name;
|
|
87
|
+
path = path.slice(1);
|
|
66
88
|
}
|
|
89
|
+
for (const sym of path) {
|
|
90
|
+
if (sym.tsFlags & TSSymbolFlags.PrivateMember) {
|
|
91
|
+
memberExpr += `.#${sym.name}`;
|
|
92
|
+
} else if (isValidJSIdentifier(sym.name)) {
|
|
93
|
+
memberExpr += `.${sym.name}`;
|
|
94
|
+
} else {
|
|
95
|
+
memberExpr += `[${JSON.stringify(sym.name)}]`;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return memberExpr;
|
|
67
99
|
}
|
|
68
|
-
function
|
|
69
|
-
return symbolPath.map(sym => sym.name).join(".");
|
|
70
|
-
}
|
|
71
|
-
function validateSymbolReachable(path) {
|
|
100
|
+
function validateSymbolReachable(path, memberPath, currentPrivateScope) {
|
|
72
101
|
for (const scope of path) {
|
|
73
102
|
if (scope.kind === "function") {
|
|
74
103
|
throw new Error("Cannot reference a symbol inside a function from outside a function");
|
|
75
104
|
}
|
|
76
105
|
}
|
|
106
|
+
if (memberPath) {
|
|
107
|
+
for (const sym of memberPath) {
|
|
108
|
+
// make sure we're not trying to access a static private from outside
|
|
109
|
+
// the static member scope.
|
|
110
|
+
if (sym.flags & OutputSymbolFlags.StaticMember && sym.tsFlags & TSSymbolFlags.PrivateMember && currentPrivateScope?.staticMembers !== sym.scope) {
|
|
111
|
+
throw new Error("Cannot resolve private static member symbols from a different scope");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
77
115
|
}
|
|
78
116
|
//# sourceMappingURL=reference.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference.js","names":["memo","OutputSymbolFlags","resolve","untrack","useContext","usePackage","SourceFileContext","ref","refkey","sourceFile","resolveResult","value","undefined","targetDeclaration","pathDown","memberPath","validateSymbolReachable","targetLocation","kind","localSymbol","pkg","sourcePackage","builtin","
|
|
1
|
+
{"version":3,"file":"reference.js","names":["memo","OutputSymbolFlags","resolve","untrack","useContext","useMemberScope","usePackage","SourceFileContext","usePrivateScope","isValidJSIdentifier","TSSymbolFlags","ref","refkey","sourceFile","resolveResult","currentScope","currentPrivateScope","value","undefined","targetDeclaration","pathDown","memberPath","flags","InstanceMember","tsFlags","PrivateMember","instanceMembers","scope","Error","validateSymbolReachable","targetLocation","kind","localSymbol","pkg","sourcePackage","builtin","addDependency","symbolPath","slice","map","s","owner","importSymbol","module","exportedSymbols","values","refkeys","has","addImport","name","length","buildMemberExpression","path","memberExpr","base","sym","JSON","stringify","StaticMember","staticMembers"],"sources":["../../../src/symbols/reference.ts"],"sourcesContent":[null],"mappings":"AAA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B,IAAqB,EACrB/B,UAAwC,EACxCL,mBAAoD,EACpD;EACA,KAAK,MAAMW,KAAK,IAAIyB,IAAI,EAAE;IACxB,IAAIzB,KAAK,CAACI,IAAI,KAAK,UAAU,EAAE;MAC7B,MAAM,IAAIH,KAAK,CACb,qEACF,CAAC;IACH;EACF;EAEA,IAAIP,UAAU,EAAE;IACd,KAAK,MAAMkC,GAAG,IAAIlC,UAAU,EAAE;MAC5B;MACA;MACA,IACEkC,GAAG,CAACjC,KAAK,GAAGrB,iBAAiB,CAACyD,YAAY,IAC1CH,GAAG,CAAC/B,OAAO,GAAGd,aAAa,CAACe,aAAa,IACzCT,mBAAmB,EAAE2C,aAAa,KAAKJ,GAAG,CAAC5B,KAAK,EAChD;QACA,MAAM,IAAIC,KAAK,CACb,qEACF,CAAC;MACH;IACF;EACF;AACF","ignoreList":[]}
|
|
@@ -5,5 +5,5 @@ export interface TSMemberScope extends OutputScope {
|
|
|
5
5
|
owner: TSOutputSymbol;
|
|
6
6
|
isStatic: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare function createTSMemberScope(binder: Binder, parent: OutputScope, owner: TSOutputSymbol, isStatic?: boolean): TSMemberScope;
|
|
8
|
+
export declare function createTSMemberScope(binder: Binder, parent: OutputScope | undefined, owner: TSOutputSymbol, isStatic?: boolean): TSMemberScope;
|
|
9
9
|
//# sourceMappingURL=ts-member-scope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-member-scope.d.ts","sourceRoot":"","sources":["../../../src/symbols/ts-member-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"ts-member-scope.d.ts","sourceRoot":"","sources":["../../../src/symbols/ts-member-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAoB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,KAAK,EAAE,cAAc,EACrB,QAAQ,GAAE,OAAe,GACxB,aAAa,CAYf"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { OutputScopeFlags } from "@alloy-js/core";
|
|
1
2
|
export function createTSMemberScope(binder, parent, owner, isStatic = false) {
|
|
2
3
|
return binder.createScope({
|
|
3
4
|
kind: "member",
|
|
4
5
|
name: "members",
|
|
6
|
+
flags: isStatic ? OutputScopeFlags.StaticMemberScope : OutputScopeFlags.MemberScope,
|
|
5
7
|
owner,
|
|
6
8
|
parent,
|
|
7
9
|
isStatic
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-member-scope.js","names":["createTSMemberScope","binder","parent","owner","isStatic","createScope","kind","name"],"sources":["../../../src/symbols/ts-member-scope.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"file":"ts-member-scope.js","names":["OutputScopeFlags","createTSMemberScope","binder","parent","owner","isStatic","createScope","kind","name","flags","StaticMemberScope","MemberScope"],"sources":["../../../src/symbols/ts-member-scope.ts"],"sourcesContent":[null],"mappings":"AAAA,SAA8BA,gBAAgB,QAAQ,gBAAgB;AAStE,OAAO,SAASC,mBAAmBA,CACjCC,MAAc,EACdC,MAA+B,EAC/BC,KAAqB,EACrBC,QAAiB,GAAG,KAAK,EACV;EACf,OAAOH,MAAM,CAACI,WAAW,CAAgB;IACvCC,IAAI,EAAE,QAAQ;IACdC,IAAI,EAAE,SAAS;IACfC,KAAK,EACHJ,QAAQ,GACNL,gBAAgB,CAACU,iBAAiB,GAClCV,gBAAgB,CAACW,WAAW;IAChCP,KAAK;IACLD,MAAM;IACNE;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -5,25 +5,28 @@ export declare enum TSSymbolFlags {
|
|
|
5
5
|
None = 0,
|
|
6
6
|
LocalImportSymbol = 1,
|
|
7
7
|
TypeSymbol = 2,
|
|
8
|
-
ParameterSymbol = 4
|
|
8
|
+
ParameterSymbol = 4,
|
|
9
|
+
PrivateMember = 8,
|
|
10
|
+
PrivateMemberContainer = 16
|
|
9
11
|
}
|
|
10
12
|
export interface TSOutputSymbol extends OutputSymbol {
|
|
11
13
|
scope: TSOutputScope;
|
|
12
14
|
export: boolean;
|
|
13
15
|
default: boolean;
|
|
14
16
|
tsFlags: TSSymbolFlags;
|
|
15
|
-
|
|
17
|
+
privateMemberScope?: TSMemberScope;
|
|
18
|
+
privateStaticMemberScope?: TSMemberScope;
|
|
16
19
|
}
|
|
17
20
|
export interface createTsSymbolOptions {
|
|
18
21
|
name: string;
|
|
19
|
-
refkey?: Refkey;
|
|
20
|
-
refkeys?: Refkey[];
|
|
22
|
+
refkey?: Refkey | Refkey[];
|
|
21
23
|
binder?: Binder;
|
|
22
24
|
scope?: TSOutputScope;
|
|
23
25
|
export?: boolean;
|
|
24
26
|
default?: boolean;
|
|
25
27
|
flags?: OutputSymbolFlags;
|
|
26
28
|
tsFlags?: TSSymbolFlags;
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
27
30
|
}
|
|
28
31
|
export declare function createTSSymbol(options: createTsSymbolOptions): TSOutputSymbol;
|
|
29
32
|
//# sourceMappingURL=ts-output-symbol.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-output-symbol.d.ts","sourceRoot":"","sources":["../../../src/symbols/ts-output-symbol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"ts-output-symbol.d.ts","sourceRoot":"","sources":["../../../src/symbols/ts-output-symbol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAuB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1E,oBAAY,aAAa;IACvB,IAAI,IAAsB;IAC1B,iBAAiB,IAAc;IAC/B,UAAU,IAAqB;IAC/B,eAAe,IAAgB;IAC/B,aAAa,IAAkB;IAC/B,sBAAsB,KAAS;CAChC;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,aAAa,CAAC;IACvB,kBAAkB,CAAC,EAAE,aAAa,CAAC;IACnC,wBAAwB,CAAC,EAAE,aAAa,CAAC;CAC1C;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CAsC7E"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { OutputSymbolFlags, useDefaultScope } from "@alloy-js/core";
|
|
2
|
+
import { createTSMemberScope } from "./ts-member-scope.js";
|
|
3
|
+
|
|
2
4
|
// prettier-ignore
|
|
3
5
|
export let TSSymbolFlags = /*#__PURE__*/function (TSSymbolFlags) {
|
|
4
6
|
TSSymbolFlags[TSSymbolFlags["None"] = 0] = "None";
|
|
5
7
|
TSSymbolFlags[TSSymbolFlags["LocalImportSymbol"] = 1] = "LocalImportSymbol";
|
|
6
8
|
TSSymbolFlags[TSSymbolFlags["TypeSymbol"] = 2] = "TypeSymbol";
|
|
7
9
|
TSSymbolFlags[TSSymbolFlags["ParameterSymbol"] = 4] = "ParameterSymbol";
|
|
10
|
+
TSSymbolFlags[TSSymbolFlags["PrivateMember"] = 8] = "PrivateMember";
|
|
11
|
+
TSSymbolFlags[TSSymbolFlags["PrivateMemberContainer"] = 16] = "PrivateMemberContainer";
|
|
8
12
|
return TSSymbolFlags;
|
|
9
13
|
}({});
|
|
10
14
|
export function createTSSymbol(options) {
|
|
@@ -13,16 +17,21 @@ export function createTSSymbol(options) {
|
|
|
13
17
|
throw new Error("Can't export symbol from non-module scope");
|
|
14
18
|
}
|
|
15
19
|
const binder = scope.binder;
|
|
20
|
+
const tsFlags = options.tsFlags ?? TSSymbolFlags.None;
|
|
16
21
|
const sym = binder.createSymbol({
|
|
17
22
|
name: options.name,
|
|
18
23
|
scope,
|
|
19
24
|
refkey: options.refkey,
|
|
20
|
-
refkeys: options.refkeys,
|
|
21
25
|
export: !!options.export,
|
|
22
26
|
default: !!options.default,
|
|
23
27
|
flags: options.flags ?? OutputSymbolFlags.None,
|
|
24
|
-
tsFlags
|
|
28
|
+
tsFlags,
|
|
29
|
+
metadata: options.metadata
|
|
25
30
|
});
|
|
31
|
+
if (tsFlags & TSSymbolFlags.PrivateMemberContainer) {
|
|
32
|
+
sym.privateMemberScope = createTSMemberScope(binder, undefined, sym);
|
|
33
|
+
sym.privateStaticMemberScope = createTSMemberScope(binder, undefined, sym, true);
|
|
34
|
+
}
|
|
26
35
|
if (options.export && scope.kind === "module") {
|
|
27
36
|
for (const refkey of sym.refkeys) {
|
|
28
37
|
scope.exportedSymbols.set(refkey, sym);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-output-symbol.js","names":["OutputSymbolFlags","useDefaultScope","TSSymbolFlags","createTSSymbol","options","scope","flags","kind","export","default","Error","binder","sym","createSymbol","name","refkey","
|
|
1
|
+
{"version":3,"file":"ts-output-symbol.js","names":["OutputSymbolFlags","useDefaultScope","createTSMemberScope","TSSymbolFlags","createTSSymbol","options","scope","flags","kind","export","default","Error","binder","tsFlags","None","sym","createSymbol","name","refkey","metadata","PrivateMemberContainer","privateMemberScope","undefined","privateStaticMemberScope","refkeys","exportedSymbols","set"],"sources":["../../../src/symbols/ts-output-symbol.ts"],"sourcesContent":[null],"mappings":"AAAA,SAGEA,iBAAiB,EAEjBC,eAAe,QACV,gBAAgB;AAEvB,SAASC,mBAAmB,QAAuB,sBAAsB;;AAEzE;AACA,WAAYC,aAAa,0BAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AA8BzB,OAAO,SAASC,cAAcA,CAACC,OAA8B,EAAkB;EAC7E,MAAMC,KAAK,GACTD,OAAO,CAACC,KAAK,IAAKL,eAAe,CAACI,OAAO,CAACE,KAAK,CAAmB;EAEpE,IAAID,KAAK,CAACE,IAAI,KAAK,QAAQ,KAAKH,OAAO,CAACI,MAAM,IAAIJ,OAAO,CAACK,OAAO,CAAC,EAAE;IAClE,MAAM,IAAIC,KAAK,CAAC,2CAA2C,CAAC;EAC9D;EAEA,MAAMC,MAAM,GAAGN,KAAK,CAACM,MAAM;EAC3B,MAAMC,OAAO,GAAGR,OAAO,CAACQ,OAAO,IAAIV,aAAa,CAACW,IAAI;EACrD,MAAMC,GAAG,GAAGH,MAAM,CAACI,YAAY,CAAiB;IAC9CC,IAAI,EAAEZ,OAAO,CAACY,IAAI;IAClBX,KAAK;IACLY,MAAM,EAAEb,OAAO,CAACa,MAAM;IACtBT,MAAM,EAAE,CAAC,CAACJ,OAAO,CAACI,MAAM;IACxBC,OAAO,EAAE,CAAC,CAACL,OAAO,CAACK,OAAO;IAC1BH,KAAK,EAAEF,OAAO,CAACE,KAAK,IAAIP,iBAAiB,CAACc,IAAI;IAC9CD,OAAO;IACPM,QAAQ,EAAEd,OAAO,CAACc;EACpB,CAAC,CAAC;EAEF,IAAIN,OAAO,GAAGV,aAAa,CAACiB,sBAAsB,EAAE;IAClDL,GAAG,CAACM,kBAAkB,GAAGnB,mBAAmB,CAACU,MAAM,EAAEU,SAAS,EAAEP,GAAG,CAAC;IACpEA,GAAG,CAACQ,wBAAwB,GAAGrB,mBAAmB,CAChDU,MAAM,EACNU,SAAS,EACTP,GAAG,EACH,IACF,CAAC;EACH;EAEA,IAAIV,OAAO,CAACI,MAAM,IAAIH,KAAK,CAACE,IAAI,KAAK,QAAQ,EAAE;IAC7C,KAAK,MAAMU,MAAM,IAAIH,GAAG,CAACS,OAAO,EAAE;MAChClB,KAAK,CAACmB,eAAe,CAACC,GAAG,CAACR,MAAM,EAAEH,GAAG,CAAC;IACxC;EACF;EAEA,OAAOA,GAAG;AACZ","ignoreList":[]}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
import { CallSignatureProps } from "./components/CallSignature.jsx";
|
|
1
2
|
export declare function modulePath(path: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Extract only the call signature props from a props object which extends
|
|
5
|
+
* `CallSignatureProps`. You can provide default values for the props.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getCallSignatureProps(props: CallSignatureProps, defaults?: Partial<CallSignatureProps>): CallSignatureProps;
|
|
8
|
+
export declare function isValidJSIdentifier(str: string): boolean;
|
|
2
9
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,UAMtC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,kBAAkB,EACzB,QAAQ,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,sBAevC;AAKD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,WAE9C"}
|
package/dist/src/utils.js
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
|
+
import { defaultProps, splitProps } from "@alloy-js/core/jsx-runtime";
|
|
1
2
|
export function modulePath(path) {
|
|
2
3
|
if (path[0] !== ".") {
|
|
3
4
|
path = "./" + path;
|
|
4
5
|
}
|
|
5
6
|
return path.replace(/\.ts$/, ".js");
|
|
6
7
|
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Extract only the call signature props from a props object which extends
|
|
11
|
+
* `CallSignatureProps`. You can provide default values for the props.
|
|
12
|
+
*/
|
|
13
|
+
export function getCallSignatureProps(props, defaults) {
|
|
14
|
+
const [callSignatureProps] = splitProps(props, ["parameters", "parametersChildren", "typeParameters", "typeParametersChildren", "returnType"]);
|
|
15
|
+
if (!defaults) {
|
|
16
|
+
return callSignatureProps;
|
|
17
|
+
}
|
|
18
|
+
return defaultProps(callSignatureProps, defaults);
|
|
19
|
+
}
|
|
20
|
+
const identifierRegex = /^(?:[\p{ID_Start}$_])(?:[\p{ID_Continue}$\u200C\u200D])*$/u;
|
|
21
|
+
export function isValidJSIdentifier(str) {
|
|
22
|
+
return identifierRegex.test(str);
|
|
23
|
+
}
|
|
7
24
|
//# sourceMappingURL=utils.js.map
|
package/dist/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["modulePath","path","replace"],"sources":["../../src/utils.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.js","names":["defaultProps","splitProps","modulePath","path","replace","getCallSignatureProps","props","defaults","callSignatureProps","identifierRegex","isValidJSIdentifier","str","test"],"sources":["../../src/utils.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,YAAY,EAAEC,UAAU,QAAQ,4BAA4B;AAGrE,OAAO,SAASC,UAAUA,CAACC,IAAY,EAAE;EACvC,IAAIA,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;IACnBA,IAAI,GAAG,IAAI,GAAGA,IAAI;EACpB;EAEA,OAAOA,IAAI,CAACC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC;AACrC;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CACnCC,KAAyB,EACzBC,QAAsC,EACtC;EACA,MAAM,CAACC,kBAAkB,CAAC,GAAGP,UAAU,CAACK,KAAK,EAAE,CAC7C,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACxB,YAAY,CACb,CAAC;EAEF,IAAI,CAACC,QAAQ,EAAE;IACb,OAAOC,kBAAkB;EAC3B;EAEA,OAAOR,YAAY,CAACQ,kBAAkB,EAAED,QAAQ,CAAC;AACnD;AAEA,MAAME,eAAe,GACnB,4DAA4D;AAE9D,OAAO,SAASC,mBAAmBA,CAACC,GAAW,EAAE;EAC/C,OAAOF,eAAe,CAACG,IAAI,CAACD,GAAG,CAAC;AAClC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-scope.test.d.ts","sourceRoot":"","sources":["../../test/block-scope.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum-jsdoc.test.d.ts","sourceRoot":"","sources":["../../test/enum-jsdoc.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-declaration-jsdoc.test.d.ts","sourceRoot":"","sources":["../../test/function-declaration-jsdoc.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"if-statement.test.d.ts","sourceRoot":"","sources":["../../test/if-statement.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface-jsdoc.test.d.ts","sourceRoot":"","sources":["../../test/interface-jsdoc.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jscomment.test.d.ts","sourceRoot":"","sources":["../../test/jscomment.test.tsx"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsdoc.test.d.ts","sourceRoot":"","sources":["../../test/jsdoc.test.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jsdoc.test.d.ts","sourceRoot":"","sources":["../../test/jsdoc.test.tsx"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsdocparam.test.d.ts","sourceRoot":"","sources":["../../test/jsdocparam.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name-conflict.test.d.ts","sourceRoot":"","sources":["../../test/name-conflict.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-json.test.d.ts","sourceRoot":"","sources":["../../test/package-json.test.tsx"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file.test.d.ts","sourceRoot":"","sources":["../../test/source-file.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch-statement.test.d.ts","sourceRoot":"","sources":["../../test/switch-statement.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"var-declaration-jsdoc.test.d.ts","sourceRoot":"","sources":["../../test/var-declaration-jsdoc.test.tsx"],"names":[],"mappings":""}
|