@alloy-js/typescript 0.7.0 → 0.9.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 +35 -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/MemberExpression.d.ts +62 -0
- package/dist/src/components/MemberExpression.d.ts.map +1 -0
- package/dist/src/components/MemberExpression.js +179 -0
- package/dist/src/components/MemberExpression.js.map +1 -0
- package/dist/src/components/ObjectExpression.d.ts +1 -1
- 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/member-expression.test.d.ts +2 -0
- package/dist/test/member-expression.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/MemberExpression.tsx +237 -0
- package/src/components/ObjectExpression.tsx +8 -3
- 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 +3819 -1915
- 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/member-expression.test.tsx +297 -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,19 @@
|
|
|
1
|
+
export interface PropertyNameProps {
|
|
2
|
+
/**
|
|
3
|
+
* The name of the property.
|
|
4
|
+
*/
|
|
5
|
+
name?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Whether the property is a private property. If `true`, the property will be
|
|
8
|
+
* prefixed with `#`.
|
|
9
|
+
*/
|
|
10
|
+
private?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A TypeScript property name for an interface, class, or object member. If the
|
|
14
|
+
* name is not a valid JavaScript identifier, it will be quoted. If a `name` prop
|
|
15
|
+
* is provided, it will be used as the property name. Otherwise, the name will be
|
|
16
|
+
* taken from the {@link (MemberDeclarationContext:variable)}.
|
|
17
|
+
*/
|
|
18
|
+
export declare function PropertyName(props: PropertyNameProps): import("@alloy-js/core").Children;
|
|
19
|
+
//# sourceMappingURL=PropertyName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyName.d.ts","sourceRoot":"","sources":["../../../src/components/PropertyName.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qCAkBpD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { MemberDeclarationContext, useContext } from "@alloy-js/core";
|
|
3
|
+
import { TSSymbolFlags } from "../symbols/ts-output-symbol.js";
|
|
4
|
+
import { isValidJSIdentifier } from "../utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* A TypeScript property name for an interface, class, or object member. If the
|
|
7
|
+
* name is not a valid JavaScript identifier, it will be quoted. If a `name` prop
|
|
8
|
+
* is provided, it will be used as the property name. Otherwise, the name will be
|
|
9
|
+
* taken from the {@link (MemberDeclarationContext:variable)}.
|
|
10
|
+
*/
|
|
11
|
+
export function PropertyName(props) {
|
|
12
|
+
if (props.name) {
|
|
13
|
+
if (props.private) {
|
|
14
|
+
return "#" + props.name;
|
|
15
|
+
}
|
|
16
|
+
return quoteIfNeeded(props.name);
|
|
17
|
+
} else {
|
|
18
|
+
const declSymbol = useContext(MemberDeclarationContext);
|
|
19
|
+
if (!declSymbol) {
|
|
20
|
+
return "(no member declaration context)";
|
|
21
|
+
}
|
|
22
|
+
if (declSymbol.tsFlags & TSSymbolFlags.PrivateMember) {
|
|
23
|
+
return ["#", _$memo(() => declSymbol.name)];
|
|
24
|
+
} else {
|
|
25
|
+
return [_$memo(() => quoteIfNeeded(declSymbol.name))];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function quoteIfNeeded(name) {
|
|
30
|
+
if (isValidJSIdentifier(name)) {
|
|
31
|
+
return name;
|
|
32
|
+
} else {
|
|
33
|
+
return `"${name.replace(/"/g, '\\"')}"`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=PropertyName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyName.js","names":["MemberDeclarationContext","useContext","TSSymbolFlags","isValidJSIdentifier","PropertyName","props","name","private","quoteIfNeeded","declSymbol","tsFlags","PrivateMember","_$memo","replace"],"sources":["../../../src/components/PropertyName.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,wBAAwB,EAAEC,UAAU,QAAQ,gBAAgB;AACrE,SAAyBC,aAAa,QAAQ,gCAAgC;AAC9E,SAASC,mBAAmB,QAAQ,aAAa;AAejD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,KAAwB,EAAE;EACrD,IAAIA,KAAK,CAACC,IAAI,EAAE;IACd,IAAID,KAAK,CAACE,OAAO,EAAE;MACjB,OAAO,GAAG,GAAGF,KAAK,CAACC,IAAI;IACzB;IACA,OAAOE,aAAa,CAACH,KAAK,CAACC,IAAI,CAAC;EAClC,CAAC,MAAM;IACL,MAAMG,UAAU,GAAGR,UAAU,CAACD,wBAAwB,CAAmB;IACzE,IAAI,CAACS,UAAU,EAAE;MACf,OAAO,iCAAiC;IAC1C;IAEA,IAAIA,UAAU,CAACC,OAAO,GAAGR,aAAa,CAACS,aAAa,EAAE;MACpD,aAAAC,MAAA,OAAWH,UAAU,CAACH,IAAI;IAC5B,CAAC,MAAM;MACL,QAAAM,MAAA,OAAUJ,aAAa,CAACC,UAAU,CAACH,IAAI,CAAC;IAC1C;EACF;AACF;AAEA,SAASE,aAAaA,CAACF,IAAY,EAAE;EACnC,IAAIH,mBAAmB,CAACG,IAAI,CAAC,EAAE;IAC7B,OAAOA,IAAI;EACb,CAAC,MAAM;IACL,OAAO,IAAIA,IAAI,CAACO,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG;EACzC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
export interface SingleLineCommentBlockProps {
|
|
3
|
+
children: Children;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A single line comment block. The children are rendered as a prose element, which means that they
|
|
7
|
+
* are broken into multiple lines
|
|
8
|
+
*/
|
|
9
|
+
export declare function SingleLineCommentBlock(props: SingleLineCommentBlockProps): Children;
|
|
10
|
+
//# sourceMappingURL=SingleLineCommentBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SingleLineCommentBlock.d.ts","sourceRoot":"","sources":["../../../src/components/SingleLineCommentBlock.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,YASxE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { Prose } from "@alloy-js/core";
|
|
4
|
+
/**
|
|
5
|
+
* A single line comment block. The children are rendered as a prose element, which means that they
|
|
6
|
+
* are broken into multiple lines
|
|
7
|
+
*/
|
|
8
|
+
export function SingleLineCommentBlock(props) {
|
|
9
|
+
return ["//", " ", _$createIntrinsic("align", {
|
|
10
|
+
string: "// ",
|
|
11
|
+
get children() {
|
|
12
|
+
return _$createComponent(Prose, {
|
|
13
|
+
get children() {
|
|
14
|
+
return props.children;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
})];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=SingleLineCommentBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SingleLineCommentBlock.js","names":["Prose","SingleLineCommentBlock","props","_$createIntrinsic","string","children","_$createComponent"],"sources":["../../../src/components/SingleLineCommentBlock.tsx"],"sourcesContent":[null],"mappings":";;AAAA,SAASA,KAAK,QAAQ,gBAAgB;AAOtC;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAACC,KAAkC,EAAE;EACzE,cAEO,GAAG,EAAAC,iBAAA;IACCC,MAAM;IAAA,IAAAC,SAAA;MAAA,OAAAC,iBAAA,CACVN,KAAK;QAAA,IAAAK,SAAA;UAAA,OAAEH,KAAK,CAACG,QAAQ;QAAA;MAAA;IAAA;EAAA;AAI9B","ignoreList":[]}
|
|
@@ -9,7 +9,13 @@ export declare function useSourceFile(): SourceFileContext;
|
|
|
9
9
|
export interface SourceFileProps {
|
|
10
10
|
path: string;
|
|
11
11
|
children?: Children;
|
|
12
|
+
header?: Children;
|
|
13
|
+
headerComment?: string;
|
|
12
14
|
export?: boolean | string;
|
|
13
15
|
}
|
|
14
16
|
export declare function SourceFile(props: SourceFileProps): Children;
|
|
17
|
+
export interface SourceFileHeaderProps {
|
|
18
|
+
header?: Children;
|
|
19
|
+
headerComment?: string;
|
|
20
|
+
}
|
|
15
21
|
//# sourceMappingURL=SourceFile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceFile.d.ts","sourceRoot":"","sources":["../../../src/components/SourceFile.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EASjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAGtD,OAAO,EAAuB,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"SourceFile.d.ts","sourceRoot":"","sources":["../../../src/components/SourceFile.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EASjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAGtD,OAAO,EAAuB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKzE,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,CAAC,iBAAiB,CACX,CAAC;AAExD,wBAAgB,aAAa,sBAE5B;AACD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YAmDhD;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -7,6 +7,7 @@ import { createTSModuleScope } from "../symbols/index.js";
|
|
|
7
7
|
import { ImportStatements } from "./ImportStatement.js";
|
|
8
8
|
import { PackageContext } from "./PackageDirectory.js";
|
|
9
9
|
import { Reference } from "./Reference.js";
|
|
10
|
+
import { SingleLineCommentBlock } from "./SingleLineCommentBlock.js";
|
|
10
11
|
export const SourceFileContext = createNamedContext("@alloy-js/typescript SourceFile");
|
|
11
12
|
export function useSourceFile() {
|
|
12
13
|
return useContext(SourceFileContext);
|
|
@@ -34,12 +35,21 @@ export function SourceFile(props) {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
}
|
|
38
|
+
const header = props.header || props.headerComment ? _$createComponent(SourceFileHeader, {
|
|
39
|
+
get header() {
|
|
40
|
+
return props.header;
|
|
41
|
+
},
|
|
42
|
+
get headerComment() {
|
|
43
|
+
return props.headerComment;
|
|
44
|
+
}
|
|
45
|
+
}) : undefined;
|
|
37
46
|
return _$createComponent(CoreSourceFile, {
|
|
38
47
|
get path() {
|
|
39
48
|
return props.path;
|
|
40
49
|
},
|
|
41
50
|
filetype: "typescript",
|
|
42
51
|
reference: Reference,
|
|
52
|
+
header: header,
|
|
43
53
|
get children() {
|
|
44
54
|
return [_$createComponent(Show, {
|
|
45
55
|
get when() {
|
|
@@ -66,4 +76,25 @@ export function SourceFile(props) {
|
|
|
66
76
|
}
|
|
67
77
|
});
|
|
68
78
|
}
|
|
79
|
+
function SourceFileHeader(props) {
|
|
80
|
+
return [_$createComponent(Show, {
|
|
81
|
+
get when() {
|
|
82
|
+
return props.headerComment !== undefined;
|
|
83
|
+
},
|
|
84
|
+
get children() {
|
|
85
|
+
return _$createComponent(SingleLineCommentBlock, {
|
|
86
|
+
get children() {
|
|
87
|
+
return props.headerComment;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}), _$createComponent(Show, {
|
|
92
|
+
get when() {
|
|
93
|
+
return props.header !== undefined;
|
|
94
|
+
},
|
|
95
|
+
get children() {
|
|
96
|
+
return props.header;
|
|
97
|
+
}
|
|
98
|
+
}), _$createIntrinsic("hbr", {})];
|
|
99
|
+
}
|
|
69
100
|
//# sourceMappingURL=SourceFile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceFile.js","names":["SourceFile","CoreSourceFile","createNamedContext","Scope","Show","SourceDirectoryContext","useBinder","useContext","useScope","join","getSourceDirectoryData","createTSModuleScope","ImportStatements","PackageContext","Reference","SourceFileContext","useSourceFile","props","directoryContext","sdData","currentDir","path","scope","modules","add","pkg","addModule","sfContext","export","addExport","_$createComponent","filetype","reference","children","when","importedModules","size","records","_$createIntrinsic","Provider","value"],"sources":["../../../src/components/SourceFile.tsx"],"sourcesContent":[null],"mappings":";;AAAA,SAEEA,UAAU,IAAIC,cAAc,EAC5BC,kBAAkB,EAClBC,KAAK,EACLC,IAAI,EACJC,sBAAsB,EACtBC,SAAS,EACTC,UAAU,EACVC,QAAQ,QACH,gBAAgB;AAGvB,SAASC,IAAI,QAAQ,OAAO;AAC5B,SAASC,sBAAsB,QAAQ,6BAA6B;AACpE,SAASC,mBAAmB,QAAuB,qBAAqB;AACxE,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,SAAS,QAAQ,gBAAgB;
|
|
1
|
+
{"version":3,"file":"SourceFile.js","names":["SourceFile","CoreSourceFile","createNamedContext","Scope","Show","SourceDirectoryContext","useBinder","useContext","useScope","join","getSourceDirectoryData","createTSModuleScope","ImportStatements","PackageContext","Reference","SingleLineCommentBlock","SourceFileContext","useSourceFile","props","directoryContext","sdData","currentDir","path","scope","modules","add","pkg","addModule","sfContext","export","addExport","header","headerComment","_$createComponent","SourceFileHeader","undefined","filetype","reference","children","when","importedModules","size","records","_$createIntrinsic","Provider","value"],"sources":["../../../src/components/SourceFile.tsx"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
export interface SwitchStatementProps {
|
|
3
|
+
expression: Children;
|
|
4
|
+
children: Children;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A switch statement.
|
|
8
|
+
*/
|
|
9
|
+
export declare function SwitchStatement(props: SwitchStatementProps): Children;
|
|
10
|
+
export interface CaseClausePropsBase {
|
|
11
|
+
children: Children;
|
|
12
|
+
block?: boolean;
|
|
13
|
+
break?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface CaseClausePropsWithExpression extends CaseClausePropsBase {
|
|
16
|
+
expression: Children;
|
|
17
|
+
}
|
|
18
|
+
export interface CaseClausePropsWithValue extends CaseClausePropsBase {
|
|
19
|
+
jsValue: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface CaseClausePropsWithDefault extends CaseClausePropsBase {
|
|
22
|
+
default: true;
|
|
23
|
+
}
|
|
24
|
+
export type CaseClauseProps = CaseClausePropsWithExpression | CaseClausePropsWithValue | CaseClausePropsWithDefault;
|
|
25
|
+
/**
|
|
26
|
+
* A case clause in a switch statement. Provide either an expression or a JS
|
|
27
|
+
* value to compare to the switch expression. Can optionally be wrapped in a
|
|
28
|
+
* block. Pass `break` to finish with a break statement.
|
|
29
|
+
*/
|
|
30
|
+
export declare function CaseClause(props: CaseClauseProps): Children;
|
|
31
|
+
//# sourceMappingURL=SwitchStatement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchStatement.d.ts","sourceRoot":"","sources":["../../../src/components/SwitchStatement.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAItD,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,QAAQ,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,YAM1D;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,6BAA8B,SAAQ,mBAAmB;IACxE,UAAU,EAAE,QAAQ,CAAC;CACtB;AAED,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACnE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACrE,OAAO,EAAE,IAAI,CAAC;CACf;AAED,MAAM,MAAM,eAAe,GACvB,6BAA6B,GAC7B,wBAAwB,GACxB,0BAA0B,CAAC;AAE/B;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YA4BhD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
4
|
+
import { Block, Indent, Match, Switch } from "@alloy-js/core";
|
|
5
|
+
import { BlockScope } from "./BlockScope.js";
|
|
6
|
+
import { ValueExpression } from "./ValueExpression.js";
|
|
7
|
+
/**
|
|
8
|
+
* A switch statement.
|
|
9
|
+
*/
|
|
10
|
+
export function SwitchStatement(props) {
|
|
11
|
+
return ["switch (", _$memo(() => props.expression), ") ", _$createComponent(Block, {
|
|
12
|
+
get children() {
|
|
13
|
+
return props.children;
|
|
14
|
+
}
|
|
15
|
+
})];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A case clause in a switch statement. Provide either an expression or a JS
|
|
19
|
+
* value to compare to the switch expression. Can optionally be wrapped in a
|
|
20
|
+
* block. Pass `break` to finish with a break statement.
|
|
21
|
+
*/
|
|
22
|
+
export function CaseClause(props) {
|
|
23
|
+
const Wrapper = props.block ? BlockScope : Indent;
|
|
24
|
+
return [_$createComponent(Switch, {
|
|
25
|
+
get children() {
|
|
26
|
+
return [_$createComponent(Match, {
|
|
27
|
+
get when() {
|
|
28
|
+
return "default" in props && props.default;
|
|
29
|
+
},
|
|
30
|
+
children: "default "
|
|
31
|
+
}), _$createComponent(Match, {
|
|
32
|
+
"else": true,
|
|
33
|
+
get children() {
|
|
34
|
+
return ["case", " ", _$memo(() => _$memo(() => "expression" in props)() ? props.expression : _$createComponent(ValueExpression, {
|
|
35
|
+
get jsValue() {
|
|
36
|
+
return props.jsValue;
|
|
37
|
+
}
|
|
38
|
+
}))];
|
|
39
|
+
}
|
|
40
|
+
})];
|
|
41
|
+
}
|
|
42
|
+
}), ": ", _$createComponent(Wrapper, {
|
|
43
|
+
get children() {
|
|
44
|
+
return [_$memo(() => props.children), _$memo(() => _$memo(() => !!props.break)() && [_$createIntrinsic("hbr", {}), "break;"])];
|
|
45
|
+
}
|
|
46
|
+
})];
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=SwitchStatement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchStatement.js","names":["Block","Indent","Match","Switch","BlockScope","ValueExpression","SwitchStatement","props","_$memo","expression","_$createComponent","children","CaseClause","Wrapper","block","when","default","jsValue","break","_$createIntrinsic"],"sources":["../../../src/components/SwitchStatement.tsx"],"sourcesContent":[null],"mappings":";;;AAAA,SAASA,KAAK,EAAEC,MAAM,EAAEC,KAAK,EAAEC,MAAM,QAAQ,gBAAgB;AAE7D,SAASC,UAAU;AACnB,SAASC,eAAe;AAOxB;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAACC,KAA2B,EAAE;EAC3D,oBAAAC,MAAA,OAEaD,KAAK,CAACE,UAAU,SAAAC,iBAAA,CAAIV,KAAK;IAAA,IAAAW,SAAA;MAAA,OAAEJ,KAAK,CAACI,QAAQ;IAAA;EAAA;AAGxD;AAyBA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAACL,KAAsB,EAAE;EACjD,MAAMM,OAAO,GAAGN,KAAK,CAACO,KAAK,GAAGV,UAAU,GAAGH,MAAM;EACjD,QAAAS,iBAAA,CAEKP,MAAM;IAAA,IAAAQ,SAAA;MAAA,QAAAD,iBAAA,CACJR,KAAK;QAAA,IAACa,IAAIA,CAAA;UAAA,OAAE,SAAS,IAAIR,KAAK,IAAIA,KAAK,CAACS,OAAO;QAAA;QAAAL,QAAA;MAAA,IAAAD,iBAAA,CAC/CR,KAAK;QAAA;QAAA,IAAAS,SAAA;UAAA,gBACC,GAAG,EAAAH,MAAA,OACPA,MAAA,mBAAY,IAAID,KAAK,MACpBA,KAAK,CAACE,UAAU,GAAAC,iBAAA,CACfL,eAAe;YAAA,IACdY,OAAOA,CAAA;cAAA,OAAGV,KAAK,CAA8BU,OAAO;YAAA;UAAA,EACpD;QAAA;MAAA;IAAA;EAAA,IAIP,IAAI,EAAAP,iBAAA,CACJG,OAAO;IAAA,IAAAF,SAAA;MAAA,QAAAH,MAAA,OACLD,KAAK,CAACI,QAAQ,GAAAH,MAAA,OACdA,MAAA,SAAAD,KAAK,CAACW,KAAK,QAAAC,iBAAA,sBAKX;IAAA;EAAA;AAIT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/TypeDeclaration.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAe,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"TypeDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/TypeDeclaration.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAe,MAAM,kBAAkB,CAAC;AAGrE,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;CAAG;AAErE,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qCAY1D"}
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import { mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
3
4
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
4
|
-
import { Name } from "@alloy-js/core";
|
|
5
|
+
import { Name, Show } from "@alloy-js/core";
|
|
5
6
|
import { Declaration } from "./Declaration.js";
|
|
7
|
+
import { JSDoc } from "./JSDoc.js";
|
|
6
8
|
export function TypeDeclaration(props) {
|
|
7
|
-
return _$createComponent(
|
|
9
|
+
return [_$createComponent(Show, {
|
|
10
|
+
get when() {
|
|
11
|
+
return Boolean(props.doc);
|
|
12
|
+
},
|
|
13
|
+
get children() {
|
|
14
|
+
return [_$createComponent(JSDoc, {
|
|
15
|
+
get children() {
|
|
16
|
+
return props.doc;
|
|
17
|
+
}
|
|
18
|
+
}), _$createIntrinsic("hbr", {})];
|
|
19
|
+
}
|
|
20
|
+
}), _$createComponent(Declaration, _$mergeProps(props, {
|
|
8
21
|
nameKind: "type",
|
|
9
22
|
get children() {
|
|
10
23
|
return ["type ", _$createComponent(Name, {}), " = ", _$memo(() => props.children), ";"];
|
|
11
24
|
}
|
|
12
|
-
}));
|
|
25
|
+
}))];
|
|
13
26
|
}
|
|
14
27
|
//# sourceMappingURL=TypeDeclaration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeDeclaration.js","names":["Name","Declaration","TypeDeclaration","props","_$createComponent","_$
|
|
1
|
+
{"version":3,"file":"TypeDeclaration.js","names":["Name","Show","Declaration","JSDoc","TypeDeclaration","props","_$createComponent","when","Boolean","doc","children","_$createIntrinsic","_$mergeProps","nameKind","_$memo"],"sources":["../../../src/components/TypeDeclaration.tsx"],"sourcesContent":[null],"mappings":";;;;AAAA,SAASA,IAAI,EAAEC,IAAI,QAAQ,gBAAgB;AAC3C,SAA+BC,WAAW,QAAQ,kBAAkB;AACpE,SAASC,KAAK;AAId,OAAO,SAASC,eAAeA,CAACC,KAA2B,EAAE;EAC3D,QAAAC,iBAAA,CAEKL,IAAI;IAAA,IAACM,IAAIA,CAAA;MAAA,OAAEC,OAAO,CAACH,KAAK,CAACI,GAAG,CAAC;IAAA;IAAA,IAAAC,SAAA;MAAA,QAAAJ,iBAAA,CAC3BH,KAAK;QAAA,IAACO,QAAQA,CAAA;UAAA,OAAEL,KAAK,CAACI,GAAG;QAAA;MAAA,IAAAE,iBAAA;IAAA;EAAA,IAAAL,iBAAA,CAG3BJ,WAAW,EAAAU,YAAA,CAAKP,KAAK;IAAEQ,QAAQ;IAAA,IAAAH,SAAA;MAAA,iBAAAJ,iBAAA,CACxBN,IAAI,cAAAc,MAAA,OAAOT,KAAK,CAACK,QAAQ;IAAA;EAAA;AAIvC","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ export interface VarDeclarationProps extends BaseDeclarationProps {
|
|
|
4
4
|
const?: boolean;
|
|
5
5
|
let?: boolean;
|
|
6
6
|
var?: boolean;
|
|
7
|
-
|
|
7
|
+
initializer?: Children;
|
|
8
8
|
type?: Children;
|
|
9
9
|
}
|
|
10
10
|
export declare function VarDeclaration(props: VarDeclarationProps): Children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VarDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/VarDeclaration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,
|
|
1
|
+
{"version":3,"file":"VarDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/VarDeclaration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAKT,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAC/D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,YAkCxD"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
1
2
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
3
|
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { AssignmentContext, Declaration as CoreDeclaration, createAssignmentContext, Name } from "@alloy-js/core";
|
|
4
|
+
import { AssignmentContext, Declaration as CoreDeclaration, createAssignmentContext, Name, Show } from "@alloy-js/core";
|
|
4
5
|
import { useTSNamePolicy } from "../name-policy.js";
|
|
5
6
|
import { createTSSymbol } from "../symbols/index.js";
|
|
7
|
+
import { JSDoc } from "./JSDoc.js";
|
|
6
8
|
export function VarDeclaration(props) {
|
|
7
9
|
const keyword = props.var ? "var" : props.let ? "let" : "const";
|
|
8
10
|
const type = props.type ? [": ", _$memo(() => props.type)] : undefined;
|
|
@@ -10,21 +12,32 @@ export function VarDeclaration(props) {
|
|
|
10
12
|
const sym = createTSSymbol({
|
|
11
13
|
name: name,
|
|
12
14
|
refkey: props.refkey,
|
|
13
|
-
refkeys: props.refkeys,
|
|
14
15
|
default: props.default,
|
|
15
|
-
export: props.export
|
|
16
|
+
export: props.export,
|
|
17
|
+
metadata: props.metadata
|
|
16
18
|
});
|
|
17
19
|
const assignmentContext = createAssignmentContext(sym);
|
|
18
|
-
return _$createComponent(
|
|
20
|
+
return [_$createComponent(Show, {
|
|
21
|
+
get when() {
|
|
22
|
+
return Boolean(props.doc);
|
|
23
|
+
},
|
|
24
|
+
get children() {
|
|
25
|
+
return [_$createComponent(JSDoc, {
|
|
26
|
+
get children() {
|
|
27
|
+
return props.doc;
|
|
28
|
+
}
|
|
29
|
+
}), _$createIntrinsic("hbr", {})];
|
|
30
|
+
}
|
|
31
|
+
}), _$createComponent(CoreDeclaration, {
|
|
19
32
|
symbol: sym,
|
|
20
33
|
get children() {
|
|
21
34
|
return [_$memo(() => props.export ? "export " : ""), _$memo(() => props.default ? "default " : ""), keyword, " ", _$createComponent(Name, {}), type, " =", " ", _$createComponent(AssignmentContext.Provider, {
|
|
22
35
|
value: assignmentContext,
|
|
23
36
|
get children() {
|
|
24
|
-
return props.
|
|
37
|
+
return props.initializer ?? props.children;
|
|
25
38
|
}
|
|
26
39
|
})];
|
|
27
40
|
}
|
|
28
|
-
});
|
|
41
|
+
})];
|
|
29
42
|
}
|
|
30
43
|
//# sourceMappingURL=VarDeclaration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VarDeclaration.js","names":["AssignmentContext","Declaration","CoreDeclaration","createAssignmentContext","Name","useTSNamePolicy","createTSSymbol","VarDeclaration","props","keyword","var","let","type","_$memo","undefined","name","getName","sym","refkey","
|
|
1
|
+
{"version":3,"file":"VarDeclaration.js","names":["AssignmentContext","Declaration","CoreDeclaration","createAssignmentContext","Name","Show","useTSNamePolicy","createTSSymbol","JSDoc","VarDeclaration","props","keyword","var","let","type","_$memo","undefined","name","getName","sym","refkey","default","export","metadata","assignmentContext","_$createComponent","when","Boolean","doc","children","_$createIntrinsic","symbol","Provider","value","initializer"],"sources":["../../../src/components/VarDeclaration.tsx"],"sourcesContent":[null],"mappings":";;;AAAA,SACEA,iBAAiB,EAEjBC,WAAW,IAAIC,eAAe,EAC9BC,uBAAuB,EACvBC,IAAI,EACJC,IAAI,QACC,gBAAgB;AACvB,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,cAAc,QAAQ,qBAAqB;AAEpD,SAASC,KAAK;AAUd,OAAO,SAASC,cAAcA,CAACC,KAA0B,EAAE;EACzD,MAAMC,OAAO,GACXD,KAAK,CAACE,GAAG,GAAG,KAAK,GACfF,KAAK,CAACG,GAAG,GAAG,KAAK,GACjB,OAAO;EACX,MAAMC,IAAI,GAAGJ,KAAK,CAACI,IAAI,UAAAC,MAAA,OAAQL,KAAK,CAACI,IAAI,KAAOE,SAAS;EACzD,MAAMC,IAAI,GAAGX,eAAe,CAAC,CAAC,CAACY,OAAO,CAACR,KAAK,CAACO,IAAI,EAAE,UAAU,CAAC;EAC9D,MAAME,GAAG,GAAGZ,cAAc,CAAC;IACzBU,IAAI,EAAEA,IAAI;IACVG,MAAM,EAAEV,KAAK,CAACU,MAAM;IACpBC,OAAO,EAAEX,KAAK,CAACW,OAAO;IACtBC,MAAM,EAAEZ,KAAK,CAACY,MAAM;IACpBC,QAAQ,EAAEb,KAAK,CAACa;EAClB,CAAC,CAAC;EAEF,MAAMC,iBAAiB,GAAGrB,uBAAuB,CAACgB,GAAG,CAAC;EAEtD,QAAAM,iBAAA,CAEKpB,IAAI;IAAA,IAACqB,IAAIA,CAAA;MAAA,OAAEC,OAAO,CAACjB,KAAK,CAACkB,GAAG,CAAC;IAAA;IAAA,IAAAC,SAAA;MAAA,QAAAJ,iBAAA,CAC3BjB,KAAK;QAAA,IAACqB,QAAQA,CAAA;UAAA,OAAEnB,KAAK,CAACkB,GAAG;QAAA;MAAA,IAAAE,iBAAA;IAAA;EAAA,IAAAL,iBAAA,CAG3BvB,eAAe;IAAC6B,MAAM,EAAEZ,GAAG;IAAA,IAAAU,SAAA;MAAA,QAAAd,MAAA,OACzBL,KAAK,CAACY,MAAM,GAAG,SAAS,GAAG,EAAE,GAAAP,MAAA,OAC7BL,KAAK,CAACW,OAAO,GAAG,UAAU,GAAG,EAAE,GAC/BV,OAAO,OAAAc,iBAAA,CAAGrB,IAAI,OACdU,IAAI,QAAI,GAAG,EAAAW,iBAAA,CACXzB,iBAAiB,CAACgC,QAAQ;QAACC,KAAK,EAAET,iBAAiB;QAAA,IAAAK,SAAA;UAAA,OACjDnB,KAAK,CAACwB,WAAW,IAAIxB,KAAK,CAACmB,QAAQ;QAAA;MAAA;IAAA;EAAA;AAK9C","ignoreList":[]}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
export * from "../parameter-descriptor.js";
|
|
1
2
|
export * from "./ArrayExpression.js";
|
|
2
3
|
export * from "./BarrelFile.js";
|
|
4
|
+
export * from "./BlockScope.js";
|
|
5
|
+
export * from "./CallSignature.jsx";
|
|
3
6
|
export * from "./ClassDeclaration.jsx";
|
|
4
7
|
export * from "./CommaList.jsx";
|
|
5
8
|
export * from "./Declaration.js";
|
|
@@ -10,12 +13,16 @@ export * from "./FunctionCallExpression.js";
|
|
|
10
13
|
export * from "./FunctionDeclaration.js";
|
|
11
14
|
export * from "./ImportStatement.js";
|
|
12
15
|
export * from "./Interface.js";
|
|
16
|
+
export * from "./JSDoc.jsx";
|
|
17
|
+
export * from "./JSDocComment.jsx";
|
|
18
|
+
export * from "./JSDocExample.jsx";
|
|
13
19
|
export * from "./MemberChainExpression.jsx";
|
|
14
20
|
export * from "./ObjectExpression.js";
|
|
15
21
|
export * from "./PackageDirectory.js";
|
|
16
22
|
export * from "./PackageJson.js";
|
|
17
23
|
export * from "./Reference.js";
|
|
18
24
|
export * from "./SourceFile.js";
|
|
25
|
+
export * from "./SwitchStatement.jsx";
|
|
19
26
|
export * from "./TsConfigJson.js";
|
|
20
27
|
export * from "./TypeDeclaration.js";
|
|
21
28
|
export * from "./ValueExpression.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
export * from "../parameter-descriptor.js";
|
|
1
2
|
export * from "./ArrayExpression.js";
|
|
2
3
|
export * from "./BarrelFile.js";
|
|
4
|
+
export * from "./BlockScope.js";
|
|
5
|
+
export * from "./CallSignature.js";
|
|
3
6
|
export * from "./ClassDeclaration.js";
|
|
4
7
|
export * from "./CommaList.js";
|
|
5
8
|
export * from "./Declaration.js";
|
|
@@ -10,12 +13,16 @@ export * from "./FunctionCallExpression.js";
|
|
|
10
13
|
export * from "./FunctionDeclaration.js";
|
|
11
14
|
export * from "./ImportStatement.js";
|
|
12
15
|
export * from "./Interface.js";
|
|
16
|
+
export * from "./JSDoc.js";
|
|
17
|
+
export * from "./JSDocComment.js";
|
|
18
|
+
export * from "./JSDocExample.js";
|
|
13
19
|
export * from "./MemberChainExpression.js";
|
|
14
20
|
export * from "./ObjectExpression.js";
|
|
15
21
|
export * from "./PackageDirectory.js";
|
|
16
22
|
export * from "./PackageJson.js";
|
|
17
23
|
export * from "./Reference.js";
|
|
18
24
|
export * from "./SourceFile.js";
|
|
25
|
+
export * from "./SwitchStatement.js";
|
|
19
26
|
export * from "./TsConfigJson.js";
|
|
20
27
|
export * from "./TypeDeclaration.js";
|
|
21
28
|
export * from "./ValueExpression.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc,sBAAsB;AACpC,cAAc,iBAAiB;AAC/B;AACA;AACA,cAAc,kBAAkB;AAChC,cAAc,sBAAsB;AACpC,cAAc,iBAAiB;AAC/B,cAAc,sBAAsB;AACpC,cAAc,6BAA6B;AAC3C,cAAc,0BAA0B;AACxC,cAAc,sBAAsB;AACpC,cAAc,gBAAgB;AAC9B;AACA,cAAc,uBAAuB;AACrC,cAAc,uBAAuB;AACrC,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc,4BAA4B;AAC1C,cAAc,sBAAsB;AACpC,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA,cAAc,kBAAkB;AAChC,cAAc,sBAAsB;AACpC,cAAc,iBAAiB;AAC/B,cAAc,sBAAsB;AACpC,cAAc,6BAA6B;AAC3C,cAAc,0BAA0B;AACxC,cAAc,sBAAsB;AACpC,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA,cAAc,uBAAuB;AACrC,cAAc,uBAAuB;AACrC,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B;AACA,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,qBAAqB","ignoreList":[]}
|