@alloy-js/typescript 0.23.0-dev.0 → 0.23.0-dev.10
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/dev/src/builtins/index.js +2 -0
- package/dist/dev/src/builtins/index.js.map +1 -0
- package/dist/dev/src/builtins/node.js +42 -0
- package/dist/dev/src/builtins/node.js.map +1 -0
- package/dist/dev/src/components/ArrayExpression.js +59 -0
- package/dist/dev/src/components/ArrayExpression.js.map +1 -0
- package/dist/dev/src/components/ArrowFunction.js +74 -0
- package/dist/dev/src/components/ArrowFunction.js.map +1 -0
- package/dist/dev/src/components/BarrelFile.js +87 -0
- package/dist/dev/src/components/BarrelFile.js.map +1 -0
- package/dist/dev/src/components/BlockScope.js +28 -0
- package/dist/dev/src/components/BlockScope.js.map +1 -0
- package/dist/dev/src/components/CallSignature.js +42 -0
- package/dist/dev/src/components/CallSignature.js.map +1 -0
- package/dist/dev/src/components/ClassDeclaration.js +279 -0
- package/dist/dev/src/components/ClassDeclaration.js.map +1 -0
- package/dist/dev/src/components/CommaList.js +21 -0
- package/dist/dev/src/components/CommaList.js.map +1 -0
- package/dist/dev/src/components/Declaration.js +60 -0
- package/dist/dev/src/components/Declaration.js.map +1 -0
- package/dist/dev/src/components/EnumDeclaration.js +96 -0
- package/dist/dev/src/components/EnumDeclaration.js.map +1 -0
- package/dist/dev/src/components/EnumMember.js +69 -0
- package/dist/dev/src/components/EnumMember.js.map +1 -0
- package/dist/dev/src/components/ExportStatement.js +18 -0
- package/dist/dev/src/components/ExportStatement.js.map +1 -0
- package/dist/dev/src/components/FunctionBase.js +364 -0
- package/dist/dev/src/components/FunctionBase.js.map +1 -0
- package/dist/dev/src/components/FunctionCallExpression.js +41 -0
- package/dist/dev/src/components/FunctionCallExpression.js.map +1 -0
- package/dist/dev/src/components/FunctionDeclaration.js +118 -0
- package/dist/dev/src/components/FunctionDeclaration.js.map +1 -0
- package/dist/dev/src/components/FunctionExpression.js +73 -0
- package/dist/dev/src/components/FunctionExpression.js.map +1 -0
- package/dist/dev/src/components/FunctionType.js +106 -0
- package/dist/dev/src/components/FunctionType.js.map +1 -0
- package/dist/dev/src/components/IfStatement.js +45 -0
- package/dist/dev/src/components/IfStatement.js.map +1 -0
- package/dist/dev/src/components/ImportStatement.js +142 -0
- package/dist/dev/src/components/ImportStatement.js.map +1 -0
- package/dist/dev/src/components/Interface.js +254 -0
- package/dist/dev/src/components/Interface.js.map +1 -0
- package/dist/dev/src/components/InterfaceMethod.js +120 -0
- package/dist/dev/src/components/InterfaceMethod.js.map +1 -0
- package/dist/dev/src/components/JSDoc.js +28 -0
- package/dist/dev/src/components/JSDoc.js.map +1 -0
- package/dist/dev/src/components/JSDocComment.js +27 -0
- package/dist/dev/src/components/JSDocComment.js.map +1 -0
- package/dist/dev/src/components/JSDocExample.js +44 -0
- package/dist/dev/src/components/JSDocExample.js.map +1 -0
- package/dist/dev/src/components/JSDocParam.js +175 -0
- package/dist/dev/src/components/JSDocParam.js.map +1 -0
- package/dist/dev/src/components/LexicalScope.js +29 -0
- package/dist/dev/src/components/LexicalScope.js.map +1 -0
- package/dist/dev/src/components/MemberDeclaration.js +29 -0
- package/dist/dev/src/components/MemberDeclaration.js.map +1 -0
- package/dist/dev/src/components/MemberExpression.js +284 -0
- package/dist/dev/src/components/MemberExpression.js.map +1 -0
- package/dist/dev/src/components/MemberScope.js +26 -0
- package/dist/dev/src/components/MemberScope.js.map +1 -0
- package/dist/dev/src/components/NewExpression.js +17 -0
- package/dist/dev/src/components/NewExpression.js.map +1 -0
- package/dist/dev/src/components/ObjectExpression.js +179 -0
- package/dist/dev/src/components/ObjectExpression.js.map +1 -0
- package/dist/dev/src/components/PackageDirectory.js +108 -0
- package/dist/dev/src/components/PackageDirectory.js.map +1 -0
- package/dist/dev/src/components/PackageJson.js +78 -0
- package/dist/dev/src/components/PackageJson.js.map +1 -0
- package/dist/dev/src/components/PropertyName.js +37 -0
- package/dist/dev/src/components/PropertyName.js.map +1 -0
- package/dist/dev/src/components/Reference.js +17 -0
- package/dist/dev/src/components/Reference.js.map +1 -0
- package/dist/dev/src/components/SingleLineCommentBlock.js +27 -0
- package/dist/dev/src/components/SingleLineCommentBlock.js.map +1 -0
- package/dist/dev/src/components/SourceFile.js +150 -0
- package/dist/dev/src/components/SourceFile.js.map +1 -0
- package/dist/dev/src/components/SwitchStatement.js +74 -0
- package/dist/dev/src/components/SwitchStatement.js.map +1 -0
- package/dist/dev/src/components/TryStatement.js +128 -0
- package/dist/dev/src/components/TryStatement.js.map +1 -0
- package/dist/dev/src/components/TryStatement.test.js +181 -0
- package/dist/dev/src/components/TryStatement.test.js.map +1 -0
- package/dist/dev/src/components/TsConfigJson.js +62 -0
- package/dist/dev/src/components/TsConfigJson.js.map +1 -0
- package/dist/dev/src/components/TypeDeclaration.js +46 -0
- package/dist/dev/src/components/TypeDeclaration.js.map +1 -0
- package/dist/dev/src/components/TypeRefContext.js +58 -0
- package/dist/dev/src/components/TypeRefContext.js.map +1 -0
- package/dist/dev/src/components/ValueExpression.js +42 -0
- package/dist/dev/src/components/ValueExpression.js.map +1 -0
- package/dist/dev/src/components/VarDeclaration.js +107 -0
- package/dist/dev/src/components/VarDeclaration.js.map +1 -0
- package/dist/dev/src/components/index.js +40 -0
- package/dist/dev/src/components/index.js.map +1 -0
- package/dist/dev/src/components/interface/expression.test.js +217 -0
- package/dist/dev/src/components/interface/expression.test.js.map +1 -0
- package/dist/dev/src/components/stc/index.js +48 -0
- package/dist/dev/src/components/stc/index.js.map +1 -0
- package/dist/dev/src/context/index.js +3 -0
- package/dist/dev/src/context/index.js.map +1 -0
- package/dist/dev/src/context/package-metadata.js +3 -0
- package/dist/dev/src/context/package-metadata.js.map +1 -0
- package/dist/dev/src/context/type-ref-context.js +13 -0
- package/dist/dev/src/context/type-ref-context.js.map +1 -0
- package/dist/dev/src/create-package.js +178 -0
- package/dist/dev/src/create-package.js.map +1 -0
- package/dist/dev/src/index.js +10 -0
- package/dist/dev/src/index.js.map +1 -0
- package/dist/dev/src/name-conflict-resolver.js +21 -0
- package/dist/dev/src/name-conflict-resolver.js.map +1 -0
- package/dist/dev/src/name-policy.js +52 -0
- package/dist/dev/src/name-policy.js.map +1 -0
- package/dist/dev/src/parameter-descriptor.js +2 -0
- package/dist/dev/src/parameter-descriptor.js.map +1 -0
- package/dist/dev/src/source-directory-data.js +13 -0
- package/dist/dev/src/source-directory-data.js.map +1 -0
- package/dist/dev/src/symbols/index.js +151 -0
- package/dist/dev/src/symbols/index.js.map +1 -0
- package/dist/dev/src/symbols/reference.js +155 -0
- package/dist/dev/src/symbols/reference.js.map +1 -0
- package/dist/dev/src/symbols/scopes.js +31 -0
- package/dist/dev/src/symbols/scopes.js.map +1 -0
- package/dist/dev/src/symbols/ts-lexical-scope.js +17 -0
- package/dist/dev/src/symbols/ts-lexical-scope.js.map +1 -0
- package/dist/dev/src/symbols/ts-member-scope.js +19 -0
- package/dist/dev/src/symbols/ts-member-scope.js.map +1 -0
- package/dist/dev/src/symbols/ts-module-scope.js +137 -0
- package/dist/dev/src/symbols/ts-module-scope.js.map +1 -0
- package/dist/dev/src/symbols/ts-output-symbol.js +144 -0
- package/dist/dev/src/symbols/ts-output-symbol.js.map +1 -0
- package/dist/dev/src/symbols/ts-package-scope.js +90 -0
- package/dist/dev/src/symbols/ts-package-scope.js.map +1 -0
- package/dist/dev/src/utils.js +46 -0
- package/dist/dev/src/utils.js.map +1 -0
- package/dist/dev/test/array.test.js +158 -0
- package/dist/dev/test/array.test.js.map +1 -0
- package/dist/dev/test/arrow-function.test.js +308 -0
- package/dist/dev/test/arrow-function.test.js.map +1 -0
- package/dist/dev/test/barrel.test.js +115 -0
- package/dist/dev/test/barrel.test.js.map +1 -0
- package/dist/dev/test/basic.test.js +131 -0
- package/dist/dev/test/basic.test.js.map +1 -0
- package/dist/dev/test/block-scope.test.js +51 -0
- package/dist/dev/test/block-scope.test.js.map +1 -0
- package/dist/dev/test/class.test.js +940 -0
- package/dist/dev/test/class.test.js.map +1 -0
- package/dist/dev/test/decl-helpers.test.js +217 -0
- package/dist/dev/test/decl-helpers.test.js.map +1 -0
- package/dist/dev/test/enum-jsdoc.test.js +133 -0
- package/dist/dev/test/enum-jsdoc.test.js.map +1 -0
- package/dist/dev/test/enum.test.js +461 -0
- package/dist/dev/test/enum.test.js.map +1 -0
- package/dist/dev/test/externals.test.js +493 -0
- package/dist/dev/test/externals.test.js.map +1 -0
- package/dist/dev/test/function-call-expression.test.js +144 -0
- package/dist/dev/test/function-call-expression.test.js.map +1 -0
- package/dist/dev/test/function-declaration-jsdoc.test.js +128 -0
- package/dist/dev/test/function-declaration-jsdoc.test.js.map +1 -0
- package/dist/dev/test/function-declaration.test.js +671 -0
- package/dist/dev/test/function-declaration.test.js.map +1 -0
- package/dist/dev/test/function-expression.test.js +308 -0
- package/dist/dev/test/function-expression.test.js.map +1 -0
- package/dist/dev/test/function-type.test.js +201 -0
- package/dist/dev/test/function-type.test.js.map +1 -0
- package/dist/dev/test/if-statement.test.js +38 -0
- package/dist/dev/test/if-statement.test.js.map +1 -0
- package/dist/dev/test/imports-reactive.test.js +223 -0
- package/dist/dev/test/imports-reactive.test.js.map +1 -0
- package/dist/dev/test/imports.test.js +1673 -0
- package/dist/dev/test/imports.test.js.map +1 -0
- package/dist/dev/test/interface-jsdoc.test.js +267 -0
- package/dist/dev/test/interface-jsdoc.test.js.map +1 -0
- package/dist/dev/test/interface.test.js +986 -0
- package/dist/dev/test/interface.test.js.map +1 -0
- package/dist/dev/test/jscomment.test.js +123 -0
- package/dist/dev/test/jscomment.test.js.map +1 -0
- package/dist/dev/test/jsdoc.test.js +203 -0
- package/dist/dev/test/jsdoc.test.js.map +1 -0
- package/dist/dev/test/jsdocparam.test.js +237 -0
- package/dist/dev/test/jsdocparam.test.js.map +1 -0
- package/dist/dev/test/member-expression.test.js +2021 -0
- package/dist/dev/test/member-expression.test.js.map +1 -0
- package/dist/dev/test/name-conflict.test.js +119 -0
- package/dist/dev/test/name-conflict.test.js.map +1 -0
- package/dist/dev/test/name-policy.test.js +215 -0
- package/dist/dev/test/name-policy.test.js.map +1 -0
- package/dist/dev/test/new-expression.test.js +100 -0
- package/dist/dev/test/new-expression.test.js.map +1 -0
- package/dist/dev/test/object.test.js +167 -0
- package/dist/dev/test/object.test.js.map +1 -0
- package/dist/dev/test/package-external.test.js +281 -0
- package/dist/dev/test/package-external.test.js.map +1 -0
- package/dist/dev/test/package-json.test.js +113 -0
- package/dist/dev/test/package-json.test.js.map +1 -0
- package/dist/dev/test/package.test.js +188 -0
- package/dist/dev/test/package.test.js.map +1 -0
- package/dist/dev/test/reference.test.js +141 -0
- package/dist/dev/test/reference.test.js.map +1 -0
- package/dist/dev/test/source-file.test.js +50 -0
- package/dist/dev/test/source-file.test.js.map +1 -0
- package/dist/dev/test/switch-statement.test.js +94 -0
- package/dist/dev/test/switch-statement.test.js.map +1 -0
- package/dist/dev/test/utils.js +77 -0
- package/dist/dev/test/utils.js.map +1 -0
- package/dist/dev/test/value-expression.test.js +35 -0
- package/dist/dev/test/value-expression.test.js.map +1 -0
- package/dist/dev/test/values.test.js +618 -0
- package/dist/dev/test/values.test.js.map +1 -0
- package/dist/dev/test/var-declaration-jsdoc.test.js +63 -0
- package/dist/dev/test/var-declaration-jsdoc.test.js.map +1 -0
- package/dist/dev/test/var-declaration.test.js +395 -0
- package/dist/dev/test/var-declaration.test.js.map +1 -0
- package/dist/dev/test/vitest.setup.js +2 -0
- package/dist/dev/test/vitest.setup.js.map +1 -0
- package/dist/dev/testing/create-wrapper.js +12 -0
- package/dist/dev/testing/create-wrapper.js.map +1 -0
- package/dist/dev/testing/create-wrapper.test.js +231 -0
- package/dist/dev/testing/create-wrapper.test.js.map +1 -0
- package/dist/dev/testing/index.js +2 -0
- package/dist/dev/testing/index.js.map +1 -0
- package/dist/src/components/FunctionBase.js +1 -5
- package/dist/src/components/FunctionBase.js.map +1 -1
- package/dist/src/components/FunctionType.d.ts +1 -1
- package/dist/src/components/FunctionType.js +1 -1
- package/dist/src/components/FunctionType.js.map +1 -1
- package/dist/src/components/IfStatement.d.ts.map +1 -1
- package/dist/src/components/IfStatement.js +2 -3
- package/dist/src/components/IfStatement.js.map +1 -1
- package/dist/src/components/ImportStatement.d.ts.map +1 -1
- package/dist/src/components/ImportStatement.js +16 -8
- package/dist/src/components/ImportStatement.js.map +1 -1
- package/dist/src/components/Interface.d.ts +1 -1
- package/dist/src/components/Interface.d.ts.map +1 -1
- package/dist/src/components/Interface.js +24 -9
- package/dist/src/components/Interface.js.map +1 -1
- package/dist/src/components/MemberExpression.d.ts +1 -1
- package/dist/src/components/MemberExpression.d.ts.map +1 -1
- package/dist/src/components/MemberExpression.js +115 -330
- package/dist/src/components/MemberExpression.js.map +1 -1
- package/dist/src/components/MemberScope.d.ts.map +1 -1
- package/dist/src/components/MemberScope.js +6 -2
- package/dist/src/components/MemberScope.js.map +1 -1
- package/dist/src/components/PackageDirectory.d.ts.map +1 -1
- package/dist/src/components/PackageDirectory.js +2 -2
- package/dist/src/components/PackageDirectory.js.map +1 -1
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +4 -2
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/TryStatement.d.ts +80 -0
- package/dist/src/components/TryStatement.d.ts.map +1 -0
- package/dist/src/components/TryStatement.js +112 -0
- package/dist/src/components/TryStatement.js.map +1 -0
- package/dist/src/components/TryStatement.test.d.ts +2 -0
- package/dist/src/components/TryStatement.test.d.ts.map +1 -0
- package/dist/src/components/TryStatement.test.js +121 -0
- package/dist/src/components/TryStatement.test.js.map +1 -0
- package/dist/src/components/TsConfigJson.d.ts.map +1 -1
- package/dist/src/components/TsConfigJson.js +5 -0
- package/dist/src/components/TsConfigJson.js.map +1 -1
- package/dist/src/components/TypeDeclaration.d.ts +1 -1
- package/dist/src/components/TypeDeclaration.d.ts.map +1 -1
- package/dist/src/components/TypeDeclaration.js +1 -1
- package/dist/src/components/TypeDeclaration.js.map +1 -1
- package/dist/src/components/TypeRefContext.d.ts +1 -1
- package/dist/src/components/TypeRefContext.d.ts.map +1 -1
- package/dist/src/components/TypeRefContext.js +1 -1
- package/dist/src/components/TypeRefContext.js.map +1 -1
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/context/type-ref-context.d.ts.map +1 -1
- package/dist/src/context/type-ref-context.js +2 -2
- package/dist/src/context/type-ref-context.js.map +1 -1
- package/dist/src/create-package.d.ts.map +1 -1
- package/dist/src/create-package.js +7 -6
- package/dist/src/create-package.js.map +1 -1
- package/dist/src/name-conflict-resolver.d.ts +2 -2
- package/dist/src/name-conflict-resolver.d.ts.map +1 -1
- package/dist/src/name-conflict-resolver.js +8 -2
- package/dist/src/name-conflict-resolver.js.map +1 -1
- package/dist/src/symbols/index.d.ts.map +1 -1
- package/dist/src/symbols/index.js +53 -11
- package/dist/src/symbols/index.js.map +1 -1
- package/dist/src/symbols/reference.d.ts.map +1 -1
- package/dist/src/symbols/reference.js +13 -3
- package/dist/src/symbols/reference.js.map +1 -1
- package/dist/src/symbols/ts-module-scope.d.ts +8 -0
- package/dist/src/symbols/ts-module-scope.d.ts.map +1 -1
- package/dist/src/symbols/ts-module-scope.js +80 -5
- package/dist/src/symbols/ts-module-scope.js.map +1 -1
- package/dist/src/symbols/ts-output-symbol.d.ts +1 -0
- package/dist/src/symbols/ts-output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/ts-output-symbol.js +20 -3
- package/dist/src/symbols/ts-output-symbol.js.map +1 -1
- package/dist/src/symbols/ts-package-scope.d.ts +1 -0
- package/dist/src/symbols/ts-package-scope.d.ts.map +1 -1
- package/dist/src/symbols/ts-package-scope.js +8 -0
- package/dist/src/symbols/ts-package-scope.js.map +1 -1
- package/dist/test/externals.test.js +5 -1
- package/dist/test/externals.test.js.map +1 -1
- package/dist/test/function-declaration.test.js +42 -0
- package/dist/test/function-declaration.test.js.map +1 -1
- package/dist/test/imports-reactive.test.d.ts +2 -0
- package/dist/test/imports-reactive.test.d.ts.map +1 -0
- package/dist/test/imports-reactive.test.js +167 -0
- package/dist/test/imports-reactive.test.js.map +1 -0
- package/dist/test/imports.test.js +121 -3
- package/dist/test/imports.test.js.map +1 -1
- package/dist/test/name-conflict.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/api/components/ArrowFunction.md +71 -0
- package/docs/api/components/BarrelFile.md +58 -0
- package/docs/api/components/BlockScope.md +97 -0
- package/docs/api/components/CallSignature.md +45 -0
- package/docs/api/components/CaseClause.md +102 -0
- package/docs/api/components/CatchClause.md +50 -0
- package/docs/api/components/ClassDeclaration.md +61 -0
- package/docs/api/components/ClassField.md +63 -0
- package/docs/api/components/ClassMember.md +56 -0
- package/docs/api/components/ClassMethod.md +75 -0
- package/docs/api/components/CommaList.md +31 -0
- package/docs/api/components/Declaration.md +87 -0
- package/docs/api/components/ElseClause.md +29 -0
- package/docs/api/components/ElseIfClause.md +30 -0
- package/docs/api/components/EnumDeclaration.md +29 -0
- package/docs/api/components/EnumMember.md +46 -0
- package/docs/api/components/ExportStatement.md +26 -0
- package/docs/api/components/FinallyClause.md +50 -0
- package/docs/api/components/FunctionCallExpression.md +29 -0
- package/docs/api/components/FunctionDeclaration.md +57 -0
- package/docs/api/components/FunctionExpression.md +71 -0
- package/docs/api/components/IfStatement.md +30 -0
- package/docs/api/components/ImportStatement.md +29 -0
- package/docs/api/components/ImportStatements.md +25 -0
- package/docs/api/components/InterfaceDeclaration.md +38 -0
- package/docs/api/components/InterfaceMember.md +99 -0
- package/docs/api/components/InterfaceMethod.md +74 -0
- package/docs/api/components/JSDoc.md +29 -0
- package/docs/api/components/JSDocComment.md +29 -0
- package/docs/api/components/JSDocExample.md +31 -0
- package/docs/api/components/MemberExpression.md +58 -0
- package/docs/api/components/NewExpression.md +26 -0
- package/docs/api/components/ObjectExpression.md +32 -0
- package/docs/api/components/ObjectProperty.md +44 -0
- package/docs/api/components/ObjectSpreadProperty.md +29 -0
- package/docs/api/components/PackageDirectory.md +102 -0
- package/docs/api/components/PackageJsonFile.md +82 -0
- package/docs/api/components/Reference.md +26 -0
- package/docs/api/components/SingleLineCommentBlock.md +29 -0
- package/docs/api/components/SourceFile.md +41 -0
- package/docs/api/components/SwitchStatement.md +30 -0
- package/docs/api/components/TSConfigJson.md +25 -0
- package/docs/api/components/TryStatement.md +50 -0
- package/docs/api/components/TypeRefContext.md +35 -0
- package/docs/api/components/ValueExpression.md +25 -0
- package/docs/api/components/VarDeclaration.md +44 -0
- package/docs/api/components/ensureTypeRefContext.md +28 -0
- package/docs/api/components/index.md +49 -0
- package/docs/api/contexts/Package-context.md +21 -0
- package/docs/api/contexts/PackageMetadata-context.md +18 -0
- package/docs/api/contexts/SourceFile-context.md +20 -0
- package/docs/api/contexts/index.md +5 -0
- package/docs/api/functions/createInstanceMemberSymbol.md +38 -0
- package/docs/api/functions/createLexicalScope.md +27 -0
- package/docs/api/functions/createMemberScope.md +28 -0
- package/docs/api/functions/createMemberSymbol.md +42 -0
- package/docs/api/functions/createPackage.md +18 -0
- package/docs/api/functions/createPrivateInstanceMemberSymbol.md +38 -0
- package/docs/api/functions/createPrivateStaticMemberSymbol.md +38 -0
- package/docs/api/functions/createStaticMemberSymbol.md +38 -0
- package/docs/api/functions/createTSNamePolicy.md +17 -0
- package/docs/api/functions/createTransientValueSymbol.md +17 -0
- package/docs/api/functions/createTypeAndValueSymbol.md +38 -0
- package/docs/api/functions/createTypeSymbol.md +38 -0
- package/docs/api/functions/createValueSymbol.md +38 -0
- package/docs/api/functions/decl.md +38 -0
- package/docs/api/functions/declMember.md +42 -0
- package/docs/api/functions/declType.md +38 -0
- package/docs/api/functions/getPackageScope.md +20 -0
- package/docs/api/functions/getSourceDirectoryData.md +18 -0
- package/docs/api/functions/index.md +27 -0
- package/docs/api/functions/ref.md +25 -0
- package/docs/api/functions/tsNameConflictResolver.md +19 -0
- package/docs/api/functions/useTSLexicalScope.md +17 -0
- package/docs/api/functions/useTSLexicalScopeIfPresent.md +17 -0
- package/docs/api/functions/useTSMemberScope.md +17 -0
- package/docs/api/functions/useTSNamePolicy.md +17 -0
- package/docs/api/functions/useTSScope.md +17 -0
- package/docs/api/index.md +7 -0
- package/docs/api/types/AddImportOptions.md +7 -0
- package/docs/api/types/BlockScopeProps.md +5 -0
- package/docs/api/types/CaseClauseProps.md +5 -0
- package/docs/api/types/CaseClausePropsBase.md +9 -0
- package/docs/api/types/CommonDeclarationProps.md +7 -0
- package/docs/api/types/CreatePackageProps.md +12 -0
- package/docs/api/types/CreateTsSymbolOptions.md +12 -0
- package/docs/api/types/DeclarationProps.md +5 -0
- package/docs/api/types/DeclarationPropsBase.md +8 -0
- package/docs/api/types/ExportConditions.md +7 -0
- package/docs/api/types/ExportPath.md +5 -0
- package/docs/api/types/ExternalPackage.md +7 -0
- package/docs/api/types/FunctionBodyProps.md +7 -0
- package/docs/api/types/FunctionParametersProps.md +10 -0
- package/docs/api/types/FunctionTypeParameterDescriptor.md +10 -0
- package/docs/api/types/FunctionTypeParametersProps.md +10 -0
- package/docs/api/types/FunctionTypeProps.md +13 -0
- package/docs/api/types/ImportRecords.md +5 -0
- package/docs/api/types/ImportedSymbol.md +8 -0
- package/docs/api/types/InterfaceExpressionProps.md +7 -0
- package/docs/api/types/InterfaceMemberProps.md +5 -0
- package/docs/api/types/InterfaceMemberPropsBase.md +11 -0
- package/docs/api/types/MemberExpressionPartProps.md +15 -0
- package/docs/api/types/ModuleExports.md +18 -0
- package/docs/api/types/ModuleSymbolsDescriptor.md +10 -0
- package/docs/api/types/NamedMap.md +18 -0
- package/docs/api/types/NamedModuleDescriptor.md +17 -0
- package/docs/api/types/PackageDescriptor.md +7 -0
- package/docs/api/types/PackageExports.md +7 -0
- package/docs/api/types/PackageRefkeys.md +10 -0
- package/docs/api/types/ParameterDescriptor.md +11 -0
- package/docs/api/types/ParameterDescriptorBase.md +16 -0
- package/docs/api/types/RefOptions.md +7 -0
- package/docs/api/types/SourceDirectoryData.md +7 -0
- package/docs/api/types/SourceFileHeaderProps.md +8 -0
- package/docs/api/types/TSLexicalScope.md +13 -0
- package/docs/api/types/TSMemberScope.md +14 -0
- package/docs/api/types/TSModuleScope.md +17 -0
- package/docs/api/types/TSOutputScope.md +5 -0
- package/docs/api/types/TSOutputSymbol.md +28 -0
- package/docs/api/types/TSPackageScope.md +21 -0
- package/docs/api/types/TSPackageScopeOptions.md +9 -0
- package/docs/api/types/TypeDeclarationProps.md +8 -0
- package/docs/api/types/TypeParameterDescriptor.md +13 -0
- package/docs/api/types/TypeScriptElements.md +5 -0
- package/docs/api/types/index.md +47 -0
- package/docs/api/variables/FunctionType.md +24 -0
- package/docs/api/variables/InterfaceExpression.md +5 -0
- package/docs/api/variables/TSSymbolFlags.md +5 -0
- package/docs/api/variables/TypeDeclaration.md +5 -0
- package/docs/api/variables/index.md +6 -0
- package/package.json +14 -6
- package/src/components/FunctionBase.tsx +1 -1
- package/src/components/FunctionType.tsx +1 -1
- package/src/components/IfStatement.tsx +3 -3
- package/src/components/ImportStatement.tsx +26 -12
- package/src/components/Interface.tsx +58 -29
- package/src/components/MemberExpression.tsx +194 -454
- package/src/components/MemberScope.tsx +13 -3
- package/src/components/PackageDirectory.tsx +2 -1
- package/src/components/SourceFile.tsx +4 -1
- package/src/components/TryStatement.test.tsx +123 -0
- package/src/components/TryStatement.tsx +141 -0
- package/src/components/TsConfigJson.tsx +18 -9
- package/src/components/TypeDeclaration.tsx +15 -15
- package/src/components/TypeRefContext.tsx +2 -2
- package/src/components/index.ts +1 -0
- package/src/context/type-ref-context.tsx +6 -2
- package/src/create-package.ts +29 -15
- package/src/name-conflict-resolver.ts +12 -8
- package/src/symbols/index.ts +51 -10
- package/src/symbols/reference.tsx +17 -6
- package/src/symbols/ts-module-scope.ts +115 -11
- package/src/symbols/ts-output-symbol.ts +21 -2
- package/src/symbols/ts-package-scope.ts +9 -0
- package/temp/api.json +547 -73
- package/test/externals.test.tsx +5 -1
- package/test/function-declaration.test.tsx +36 -0
- package/test/imports-reactive.test.tsx +128 -0
- package/test/imports.test.tsx +136 -2
- package/test/name-conflict.test.tsx +4 -4
- package/vitest.config.ts +8 -0
package/test/externals.test.tsx
CHANGED
|
@@ -175,7 +175,11 @@ it("can import static members", () => {
|
|
|
175
175
|
</Output>,
|
|
176
176
|
).toRenderTo({
|
|
177
177
|
"index.ts": `
|
|
178
|
-
import {
|
|
178
|
+
import {
|
|
179
|
+
noMembers,
|
|
180
|
+
server,
|
|
181
|
+
simpleName,
|
|
182
|
+
} from "@modelcontextprotocol/sdk/server/index.js";
|
|
179
183
|
|
|
180
184
|
function foo() {
|
|
181
185
|
server();
|
|
@@ -388,6 +388,42 @@ describe("symbols", () => {
|
|
|
388
388
|
}
|
|
389
389
|
`);
|
|
390
390
|
});
|
|
391
|
+
|
|
392
|
+
it("adds symbols for members of parameters when a type and default are provided", () => {
|
|
393
|
+
const ifaceRk = refkey();
|
|
394
|
+
const ifaceMemberRk = refkey();
|
|
395
|
+
const paramRk = refkey();
|
|
396
|
+
|
|
397
|
+
const param: ParameterDescriptor = {
|
|
398
|
+
name: "myParam",
|
|
399
|
+
refkey: paramRk,
|
|
400
|
+
type: ifaceRk,
|
|
401
|
+
default: "undefined",
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
const decl = (
|
|
405
|
+
<List doubleHardline>
|
|
406
|
+
<InterfaceDeclaration name="IFace" refkey={ifaceRk}>
|
|
407
|
+
<InterfaceMember name="myProp" refkey={ifaceMemberRk}>
|
|
408
|
+
string
|
|
409
|
+
</InterfaceMember>
|
|
410
|
+
</InterfaceDeclaration>
|
|
411
|
+
<FunctionDeclaration name="fn" parameters={[param]}>
|
|
412
|
+
{memberRefkey(paramRk, ifaceMemberRk)}
|
|
413
|
+
</FunctionDeclaration>
|
|
414
|
+
</List>
|
|
415
|
+
);
|
|
416
|
+
|
|
417
|
+
expect(toSourceText(decl)).toBe(d`
|
|
418
|
+
interface IFace {
|
|
419
|
+
myProp: string
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
function fn(myParam: IFace = undefined) {
|
|
423
|
+
myParam.myProp
|
|
424
|
+
}
|
|
425
|
+
`);
|
|
426
|
+
});
|
|
391
427
|
});
|
|
392
428
|
|
|
393
429
|
it("has parameters and return type in type ref context", () => {
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Output,
|
|
3
|
+
printTree,
|
|
4
|
+
ref,
|
|
5
|
+
refkey,
|
|
6
|
+
renderTree,
|
|
7
|
+
Show,
|
|
8
|
+
} from "@alloy-js/core";
|
|
9
|
+
import "@alloy-js/core/testing";
|
|
10
|
+
import { expect, it } from "vitest";
|
|
11
|
+
import * as ts from "../src/components/index.js";
|
|
12
|
+
import { createPackage, PackageDirectory, SourceFile } from "../src/index.js";
|
|
13
|
+
|
|
14
|
+
const testLib = () =>
|
|
15
|
+
createPackage({
|
|
16
|
+
name: "testLib",
|
|
17
|
+
version: "1.0.0",
|
|
18
|
+
descriptor: {
|
|
19
|
+
".": { named: ["foo"] },
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
function sourceFileText(printed: string): string {
|
|
24
|
+
// Strip the surrounding package.json / tsconfig.json blobs and keep the
|
|
25
|
+
// text from index.ts onwards. The file content follows the last tsconfig
|
|
26
|
+
// closing brace.
|
|
27
|
+
const marker = "\n}";
|
|
28
|
+
const idx = printed.lastIndexOf(marker);
|
|
29
|
+
return idx === -1 ? printed : printed.slice(idx + marker.length);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
it("removes an import when the reference is removed", () => {
|
|
33
|
+
const lib = testLib();
|
|
34
|
+
const showIt = ref(true);
|
|
35
|
+
|
|
36
|
+
const tree = renderTree(
|
|
37
|
+
<Output externals={[lib]}>
|
|
38
|
+
<PackageDirectory path="." name="test" version="1.0.0">
|
|
39
|
+
<SourceFile path="index.ts">
|
|
40
|
+
<Show when={showIt.value}>x = {lib.foo};</Show>
|
|
41
|
+
</SourceFile>
|
|
42
|
+
</PackageDirectory>
|
|
43
|
+
</Output>,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const initial = sourceFileText(printTree(tree));
|
|
47
|
+
showIt.value = false;
|
|
48
|
+
const off = sourceFileText(printTree(tree));
|
|
49
|
+
showIt.value = true;
|
|
50
|
+
const back = sourceFileText(printTree(tree));
|
|
51
|
+
|
|
52
|
+
// With no live reference, the import line should not be in the file.
|
|
53
|
+
expect(off).not.toMatch(/import .* from "testLib"/);
|
|
54
|
+
// After re-showing, we should be back to the initial output.
|
|
55
|
+
expect(back).toEqual(initial);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("does not leak name-conflict aliases across re-renders", () => {
|
|
59
|
+
const lib = testLib();
|
|
60
|
+
const showLocal = ref(true);
|
|
61
|
+
const fooRk = refkey("local-foo");
|
|
62
|
+
|
|
63
|
+
const tree = renderTree(
|
|
64
|
+
<Output externals={[lib]}>
|
|
65
|
+
<PackageDirectory path="." name="test" version="1.0.0">
|
|
66
|
+
<SourceFile path="index.ts">
|
|
67
|
+
<Show when={showLocal.value}>
|
|
68
|
+
<ts.VarDeclaration const name="foo" refkey={fooRk}>
|
|
69
|
+
1
|
|
70
|
+
</ts.VarDeclaration>
|
|
71
|
+
;
|
|
72
|
+
</Show>
|
|
73
|
+
use = {lib.foo};
|
|
74
|
+
</SourceFile>
|
|
75
|
+
</PackageDirectory>
|
|
76
|
+
</Output>,
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
sourceFileText(printTree(tree));
|
|
80
|
+
showLocal.value = false;
|
|
81
|
+
const off = sourceFileText(printTree(tree));
|
|
82
|
+
showLocal.value = true;
|
|
83
|
+
const back = sourceFileText(printTree(tree));
|
|
84
|
+
showLocal.value = false;
|
|
85
|
+
const off2 = sourceFileText(printTree(tree));
|
|
86
|
+
showLocal.value = true;
|
|
87
|
+
const back2 = sourceFileText(printTree(tree));
|
|
88
|
+
|
|
89
|
+
// While the local is hidden, the import should be the plain name, not an
|
|
90
|
+
// alias — the conflict is gone.
|
|
91
|
+
expect(off).toMatch(/import \{ foo \} from "testLib"/);
|
|
92
|
+
expect(off2).toMatch(/import \{ foo \} from "testLib"/);
|
|
93
|
+
// Off snapshots after repeated toggles must be identical (no drift).
|
|
94
|
+
expect(off2).toEqual(off);
|
|
95
|
+
// Back-on snapshots after repeated toggles must be identical too — no
|
|
96
|
+
// `foo_3`/`foo_4` drift.
|
|
97
|
+
expect(back2).toEqual(back);
|
|
98
|
+
// No generated name should drift beyond the expected `_2` suffix.
|
|
99
|
+
expect(back).not.toMatch(/foo_3|foo_4/);
|
|
100
|
+
expect(back2).not.toMatch(/foo_3|foo_4/);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("removes only one ref count at a time", () => {
|
|
104
|
+
const lib = testLib();
|
|
105
|
+
const showA = ref(true);
|
|
106
|
+
const showB = ref(true);
|
|
107
|
+
|
|
108
|
+
const tree = renderTree(
|
|
109
|
+
<Output externals={[lib]}>
|
|
110
|
+
<PackageDirectory path="." name="test" version="1.0.0">
|
|
111
|
+
<SourceFile path="index.ts">
|
|
112
|
+
<Show when={showA.value}>a = {lib.foo};</Show>
|
|
113
|
+
<Show when={showB.value}>b = {lib.foo};</Show>
|
|
114
|
+
</SourceFile>
|
|
115
|
+
</PackageDirectory>
|
|
116
|
+
</Output>,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
// Hide only one of the two references — the import must still be present.
|
|
120
|
+
showA.value = false;
|
|
121
|
+
const oneHidden = sourceFileText(printTree(tree));
|
|
122
|
+
expect(oneHidden).toMatch(/import \{ foo \} from "testLib"/);
|
|
123
|
+
|
|
124
|
+
// Hide the second — now the import should go away.
|
|
125
|
+
showB.value = false;
|
|
126
|
+
const bothHidden = sourceFileText(printTree(tree));
|
|
127
|
+
expect(bothHidden).not.toMatch(/import .* from "testLib"/);
|
|
128
|
+
});
|
package/test/imports.test.tsx
CHANGED
|
@@ -276,8 +276,14 @@ it("works with importing the same name many times from different files with the
|
|
|
276
276
|
).toRenderTo({
|
|
277
277
|
"test-import.ts": `
|
|
278
278
|
import { conflict, type MyInterface } from "./test1.js";
|
|
279
|
-
import {
|
|
280
|
-
|
|
279
|
+
import {
|
|
280
|
+
conflict as conflict_2,
|
|
281
|
+
type MyInterface as MyInterface_2,
|
|
282
|
+
} from "./test2.js";
|
|
283
|
+
import {
|
|
284
|
+
conflict as conflict_3,
|
|
285
|
+
type MyInterface as MyInterface_3,
|
|
286
|
+
} from "./test3.js";
|
|
281
287
|
|
|
282
288
|
const one: MyInterface = conflict;
|
|
283
289
|
const two: MyInterface_2 = conflict_2;
|
|
@@ -634,3 +640,131 @@ describe("type imports", () => {
|
|
|
634
640
|
});
|
|
635
641
|
});
|
|
636
642
|
});
|
|
643
|
+
|
|
644
|
+
describe("import formatting", () => {
|
|
645
|
+
it("breaks long imports across lines", () => {
|
|
646
|
+
const lib = createPackage({
|
|
647
|
+
name: "testLib",
|
|
648
|
+
version: "1.0.0",
|
|
649
|
+
descriptor: {
|
|
650
|
+
".": {
|
|
651
|
+
named: [
|
|
652
|
+
"alphaItem",
|
|
653
|
+
"bravoItem",
|
|
654
|
+
"charlieItem",
|
|
655
|
+
"deltaItem",
|
|
656
|
+
"echoItem",
|
|
657
|
+
"foxtrotItem",
|
|
658
|
+
],
|
|
659
|
+
},
|
|
660
|
+
},
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
expect(
|
|
664
|
+
<Output externals={[lib]} printWidth={40}>
|
|
665
|
+
<ts.SourceFile path="test.ts">
|
|
666
|
+
{lib.alphaItem};
|
|
667
|
+
<hbr />
|
|
668
|
+
{lib.bravoItem};
|
|
669
|
+
<hbr />
|
|
670
|
+
{lib.charlieItem};
|
|
671
|
+
<hbr />
|
|
672
|
+
{lib.deltaItem};
|
|
673
|
+
<hbr />
|
|
674
|
+
{lib.echoItem};
|
|
675
|
+
<hbr />
|
|
676
|
+
{lib.foxtrotItem};
|
|
677
|
+
</ts.SourceFile>
|
|
678
|
+
</Output>,
|
|
679
|
+
).toRenderTo({
|
|
680
|
+
"test.ts": `
|
|
681
|
+
import {
|
|
682
|
+
alphaItem,
|
|
683
|
+
bravoItem,
|
|
684
|
+
charlieItem,
|
|
685
|
+
deltaItem,
|
|
686
|
+
echoItem,
|
|
687
|
+
foxtrotItem,
|
|
688
|
+
} from "testLib";
|
|
689
|
+
|
|
690
|
+
alphaItem;
|
|
691
|
+
bravoItem;
|
|
692
|
+
charlieItem;
|
|
693
|
+
deltaItem;
|
|
694
|
+
echoItem;
|
|
695
|
+
foxtrotItem;
|
|
696
|
+
`,
|
|
697
|
+
});
|
|
698
|
+
});
|
|
699
|
+
|
|
700
|
+
it("keeps short imports on one line", () => {
|
|
701
|
+
const lib = createPackage({
|
|
702
|
+
name: "testLib",
|
|
703
|
+
version: "1.0.0",
|
|
704
|
+
descriptor: {
|
|
705
|
+
".": { named: ["a", "b"] },
|
|
706
|
+
},
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
expect(
|
|
710
|
+
<Output externals={[lib]} printWidth={40}>
|
|
711
|
+
<ts.SourceFile path="test.ts">
|
|
712
|
+
{lib.a};
|
|
713
|
+
<hbr />
|
|
714
|
+
{lib.b};
|
|
715
|
+
</ts.SourceFile>
|
|
716
|
+
</Output>,
|
|
717
|
+
).toRenderTo({
|
|
718
|
+
"test.ts": `
|
|
719
|
+
import { a, b } from "testLib";
|
|
720
|
+
|
|
721
|
+
a;
|
|
722
|
+
b;
|
|
723
|
+
`,
|
|
724
|
+
});
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
it("breaks long default + named imports", () => {
|
|
728
|
+
const lib = createPackage({
|
|
729
|
+
name: "testLib",
|
|
730
|
+
version: "1.0.0",
|
|
731
|
+
descriptor: {
|
|
732
|
+
".": {
|
|
733
|
+
default: "Big",
|
|
734
|
+
named: ["alphaItem", "bravoItem", "charlieItem", "deltaItem"],
|
|
735
|
+
},
|
|
736
|
+
},
|
|
737
|
+
});
|
|
738
|
+
|
|
739
|
+
expect(
|
|
740
|
+
<Output externals={[lib]} printWidth={40}>
|
|
741
|
+
<ts.SourceFile path="test.ts">
|
|
742
|
+
{lib.default};
|
|
743
|
+
<hbr />
|
|
744
|
+
{lib.alphaItem};
|
|
745
|
+
<hbr />
|
|
746
|
+
{lib.bravoItem};
|
|
747
|
+
<hbr />
|
|
748
|
+
{lib.charlieItem};
|
|
749
|
+
<hbr />
|
|
750
|
+
{lib.deltaItem};
|
|
751
|
+
</ts.SourceFile>
|
|
752
|
+
</Output>,
|
|
753
|
+
).toRenderTo({
|
|
754
|
+
"test.ts": `
|
|
755
|
+
import Big, {
|
|
756
|
+
alphaItem,
|
|
757
|
+
bravoItem,
|
|
758
|
+
charlieItem,
|
|
759
|
+
deltaItem,
|
|
760
|
+
} from "testLib";
|
|
761
|
+
|
|
762
|
+
Big;
|
|
763
|
+
alphaItem;
|
|
764
|
+
bravoItem;
|
|
765
|
+
charlieItem;
|
|
766
|
+
deltaItem;
|
|
767
|
+
`,
|
|
768
|
+
});
|
|
769
|
+
});
|
|
770
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Output } from "@alloy-js/core";
|
|
1
|
+
import { Output, OutputSymbol } from "@alloy-js/core";
|
|
2
2
|
import { camelCase } from "change-case";
|
|
3
3
|
import { expect, it } from "vitest";
|
|
4
4
|
import {
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
import { ParameterDescriptor } from "../src/parameter-descriptor.js";
|
|
11
11
|
|
|
12
12
|
it("handles custom name conflict resolver based on metadata", () => {
|
|
13
|
-
function resolver(name: string, symbols:
|
|
14
|
-
const goodNamedSymbols = symbols.filter(
|
|
13
|
+
function resolver(name: string, symbols: OutputSymbol[]) {
|
|
14
|
+
const goodNamedSymbols = (symbols as TSOutputSymbol[]).filter(
|
|
15
15
|
(s) => ~s.tsFlags & TSSymbolFlags.LocalImportSymbol,
|
|
16
16
|
);
|
|
17
|
-
const badNamedSymbols = symbols.filter(
|
|
17
|
+
const badNamedSymbols = (symbols as TSOutputSymbol[]).filter(
|
|
18
18
|
(s) => s.tsFlags & TSSymbolFlags.LocalImportSymbol,
|
|
19
19
|
);
|
|
20
20
|
let nameCount = 1;
|
package/vitest.config.ts
CHANGED
|
@@ -2,6 +2,14 @@ import alloyPlugin from "@alloy-js/rollup-plugin";
|
|
|
2
2
|
import { defineConfig } from "vitest/config";
|
|
3
3
|
|
|
4
4
|
export default defineConfig({
|
|
5
|
+
resolve: {
|
|
6
|
+
conditions: ["source"],
|
|
7
|
+
},
|
|
8
|
+
ssr: {
|
|
9
|
+
resolve: {
|
|
10
|
+
conditions: ["source"],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
5
13
|
esbuild: {
|
|
6
14
|
jsx: "preserve",
|
|
7
15
|
sourcemap: "both",
|