@azure-tools/typespec-ts 0.56.0-dev.1 → 0.56.0-dev.11
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/README.md +1 -13
- package/dist/src/context-manager.d.ts +19 -2
- package/dist/src/context-manager.d.ts.map +1 -1
- package/dist/src/context-manager.js +21 -0
- package/dist/src/context-manager.js.map +1 -1
- package/dist/src/framework/declaration.d.ts.map +1 -1
- package/dist/src/framework/declaration.js +6 -20
- package/dist/src/framework/declaration.js.map +1 -1
- package/dist/src/framework/hooks/sdk-types.d.ts +9 -0
- package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdk-types.js +14 -1
- package/dist/src/framework/hooks/sdk-types.js.map +1 -1
- package/dist/src/framework/source-file-batch.d.ts +35 -0
- package/dist/src/framework/source-file-batch.d.ts.map +1 -0
- package/dist/src/framework/source-file-batch.js +128 -0
- package/dist/src/framework/source-file-batch.js.map +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +73 -62
- package/dist/src/index.js.map +1 -1
- package/dist/src/{rlc-common/interfaces.d.ts → interfaces.d.ts} +12 -14
- package/dist/src/interfaces.d.ts.map +1 -0
- package/dist/src/interfaces.js.map +1 -0
- package/dist/src/lib.d.ts +2 -4
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +2 -12
- package/dist/src/lib.js.map +1 -1
- package/dist/src/meta-tree.d.ts +4 -4
- package/dist/src/meta-tree.d.ts.map +1 -1
- package/dist/src/metadata/build-api-extractor-config.d.ts +6 -0
- package/dist/src/metadata/build-api-extractor-config.d.ts.map +1 -0
- package/dist/src/metadata/build-api-extractor-config.js.map +1 -0
- package/dist/src/metadata/build-changelog-file.d.ts +6 -0
- package/dist/src/metadata/build-changelog-file.d.ts.map +1 -0
- package/dist/src/metadata/build-changelog-file.js.map +1 -0
- package/dist/src/metadata/build-es-lint-config.d.ts +6 -0
- package/dist/src/metadata/build-es-lint-config.d.ts.map +1 -0
- package/dist/src/metadata/build-es-lint-config.js.map +1 -0
- package/dist/src/metadata/build-license-file.d.ts.map +1 -0
- package/dist/src/metadata/build-license-file.js.map +1 -0
- package/dist/src/{rlc-common/metadata → metadata}/build-package-file.d.ts +3 -3
- package/dist/src/metadata/build-package-file.d.ts.map +1 -0
- package/dist/src/{rlc-common/metadata → metadata}/build-package-file.js +1 -1
- package/dist/src/metadata/build-package-file.js.map +1 -0
- package/dist/src/metadata/build-readme-file.d.ts +11 -0
- package/dist/src/metadata/build-readme-file.d.ts.map +1 -0
- package/dist/src/{rlc-common/metadata → metadata}/build-readme-file.js +16 -69
- package/dist/src/metadata/build-readme-file.js.map +1 -0
- package/dist/src/metadata/build-sample-env-file.d.ts +6 -0
- package/dist/src/metadata/build-sample-env-file.d.ts.map +1 -0
- package/dist/src/metadata/build-sample-env-file.js.map +1 -0
- package/dist/src/{rlc-common/metadata → metadata}/build-test-config.d.ts +3 -3
- package/dist/src/metadata/build-test-config.d.ts.map +1 -0
- package/dist/src/metadata/build-test-config.js.map +1 -0
- package/dist/src/{rlc-common/metadata → metadata}/build-ts-config.d.ts +3 -3
- package/dist/src/metadata/build-ts-config.d.ts.map +1 -0
- package/dist/src/metadata/build-ts-config.js.map +1 -0
- package/dist/src/metadata/build-vitest-config.d.ts +6 -0
- package/dist/src/metadata/build-vitest-config.d.ts.map +1 -0
- package/dist/src/metadata/build-vitest-config.js.map +1 -0
- package/dist/src/{rlc-common/metadata → metadata}/build-warp-config.d.ts +2 -2
- package/dist/src/metadata/build-warp-config.d.ts.map +1 -0
- package/dist/src/metadata/build-warp-config.js.map +1 -0
- package/dist/src/metadata/package-json/azure-package-common.d.ts.map +1 -0
- package/dist/src/metadata/package-json/azure-package-common.js.map +1 -0
- package/dist/src/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -0
- package/dist/src/metadata/package-json/build-azure-monorepo-package.js.map +1 -0
- package/dist/src/metadata/package-json/package-common.d.ts.map +1 -0
- package/dist/src/metadata/package-json/package-common.js.map +1 -0
- package/dist/src/metadata/render-template.d.ts +24 -0
- package/dist/src/metadata/render-template.d.ts.map +1 -0
- package/dist/src/metadata/render-template.js +148 -0
- package/dist/src/metadata/render-template.js.map +1 -0
- package/dist/src/metadata/test/build-recorded-client.d.ts +6 -0
- package/dist/src/metadata/test/build-recorded-client.d.ts.map +1 -0
- package/dist/src/metadata/test/build-recorded-client.js +8 -0
- package/dist/src/metadata/test/build-recorded-client.js.map +1 -0
- package/dist/src/metadata/test/build-sample-test.d.ts +6 -0
- package/dist/src/metadata/test/build-sample-test.d.ts.map +1 -0
- package/dist/src/metadata/test/build-sample-test.js +8 -0
- package/dist/src/metadata/test/build-sample-test.js.map +1 -0
- package/dist/src/metadata/test/build-snippets.d.ts +6 -0
- package/dist/src/metadata/test/build-snippets.d.ts.map +1 -0
- package/dist/src/{rlc-common → metadata}/test/build-snippets.js +3 -5
- package/dist/src/metadata/test/build-snippets.js.map +1 -0
- package/dist/src/metadata/test/template.d.ts +4 -0
- package/dist/src/metadata/test/template.d.ts.map +1 -0
- package/dist/src/metadata/test/template.js +100 -0
- package/dist/src/metadata/test/template.js.map +1 -0
- package/dist/src/metadata/utils.d.ts +3 -0
- package/dist/src/metadata/utils.d.ts.map +1 -0
- package/dist/src/metadata/utils.js.map +1 -0
- package/dist/src/modular/build-classical-client.d.ts.map +1 -1
- package/dist/src/modular/build-classical-client.js +9 -9
- package/dist/src/modular/build-classical-client.js.map +1 -1
- package/dist/src/modular/build-classical-operation-groups.d.ts.map +1 -1
- package/dist/src/modular/build-classical-operation-groups.js +3 -3
- package/dist/src/modular/build-classical-operation-groups.js.map +1 -1
- package/dist/src/modular/build-client-context.d.ts.map +1 -1
- package/dist/src/modular/build-client-context.js +7 -7
- package/dist/src/modular/build-client-context.js.map +1 -1
- package/dist/src/modular/build-modular-options.js +3 -3
- package/dist/src/modular/build-modular-options.js.map +1 -1
- package/dist/src/modular/build-operations.d.ts.map +1 -1
- package/dist/src/modular/build-operations.js +6 -6
- package/dist/src/modular/build-operations.js.map +1 -1
- package/dist/src/modular/build-project-files.d.ts.map +1 -1
- package/dist/src/modular/build-project-files.js +4 -4
- package/dist/src/modular/build-project-files.js.map +1 -1
- package/dist/src/modular/build-restore-poller.d.ts.map +1 -1
- package/dist/src/modular/build-restore-poller.js +3 -3
- package/dist/src/modular/build-restore-poller.js.map +1 -1
- package/dist/src/modular/build-root-index.d.ts.map +1 -1
- package/dist/src/modular/build-root-index.js +42 -14
- package/dist/src/modular/build-root-index.js.map +1 -1
- package/dist/src/modular/build-subpath-index.d.ts.map +1 -1
- package/dist/src/modular/build-subpath-index.js +17 -4
- package/dist/src/modular/build-subpath-index.js.map +1 -1
- package/dist/src/modular/emit-models-options.d.ts.map +1 -1
- package/dist/src/modular/emit-models-options.js +3 -3
- package/dist/src/modular/emit-models-options.js.map +1 -1
- package/dist/src/modular/emit-models.d.ts +1 -1
- package/dist/src/modular/emit-models.d.ts.map +1 -1
- package/dist/src/modular/emit-models.js +32 -25
- package/dist/src/modular/emit-models.js.map +1 -1
- package/dist/src/modular/emit-samples.d.ts.map +1 -1
- package/dist/src/modular/emit-samples.js +5 -5
- package/dist/src/modular/emit-samples.js.map +1 -1
- package/dist/src/modular/emit-tests.d.ts.map +1 -1
- package/dist/src/modular/emit-tests.js +1 -1
- package/dist/src/modular/emit-tests.js.map +1 -1
- package/dist/src/modular/helpers/classical-operation-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/classical-operation-helpers.js +11 -11
- package/dist/src/modular/helpers/classical-operation-helpers.js.map +1 -1
- package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/client-helpers.js +3 -3
- package/dist/src/modular/helpers/client-helpers.js.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.js +2 -2
- package/dist/src/modular/helpers/example-value-helpers.js.map +1 -1
- package/dist/src/modular/helpers/naming-helpers.d.ts +1 -1
- package/dist/src/modular/helpers/naming-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/naming-helpers.js +2 -2
- package/dist/src/modular/helpers/naming-helpers.js.map +1 -1
- package/dist/src/modular/helpers/operation-helpers.d.ts +4 -4
- package/dist/src/modular/helpers/operation-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operation-helpers.js +25 -26
- package/dist/src/modular/helpers/operation-helpers.js.map +1 -1
- package/dist/src/modular/helpers/type-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/type-helpers.js +1 -1
- package/dist/src/modular/helpers/type-helpers.js.map +1 -1
- package/dist/src/modular/interfaces.d.ts +4 -4
- package/dist/src/modular/interfaces.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-deserializer-function.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-deserializer-function.js +2 -2
- package/dist/src/modular/serialization/build-deserializer-function.js.map +1 -1
- package/dist/src/modular/serialization/build-serializer-function.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-serializer-function.js +2 -2
- package/dist/src/modular/serialization/build-serializer-function.js.map +1 -1
- package/dist/src/modular/serialization/build-xml-serializer-function.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-xml-serializer-function.js +1 -1
- package/dist/src/modular/serialization/build-xml-serializer-function.js.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.js +3 -3
- package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
- package/dist/src/transform/transform-api-version-info.d.ts +1 -1
- package/dist/src/transform/transform-api-version-info.d.ts.map +1 -1
- package/dist/src/transform/transform-api-version-info.js +4 -3
- package/dist/src/transform/transform-api-version-info.js.map +1 -1
- package/dist/src/transform/{transfrom-rlc-options.d.ts → transform-client-options.d.ts} +3 -3
- package/dist/src/transform/transform-client-options.d.ts.map +1 -0
- package/dist/src/transform/{transfrom-rlc-options.js → transform-client-options.js} +9 -13
- package/dist/src/transform/transform-client-options.js.map +1 -0
- package/dist/src/transform/transform-helper-function-details.d.ts +1 -1
- package/dist/src/transform/transform-helper-function-details.d.ts.map +1 -1
- package/dist/src/transform/transform-helper-function-details.js +4 -4
- package/dist/src/transform/transform-helper-function-details.js.map +1 -1
- package/dist/src/transform/transform-parameters.d.ts +1 -1
- package/dist/src/transform/transform-parameters.d.ts.map +1 -1
- package/dist/src/transform/transform-parameters.js +11 -11
- package/dist/src/transform/transform-parameters.js.map +1 -1
- package/dist/src/transform/transform-paths.d.ts +1 -1
- package/dist/src/transform/transform-paths.d.ts.map +1 -1
- package/dist/src/transform/transform-paths.js +5 -4
- package/dist/src/transform/transform-paths.js.map +1 -1
- package/dist/src/transform/transform-responses.d.ts +1 -1
- package/dist/src/transform/transform-responses.d.ts.map +1 -1
- package/dist/src/transform/transform-responses.js +19 -18
- package/dist/src/transform/transform-responses.js.map +1 -1
- package/dist/src/transform/transform-schemas.js +5 -5
- package/dist/src/transform/transform-schemas.js.map +1 -1
- package/dist/src/transform/transform-telemetry-info.d.ts +1 -1
- package/dist/src/transform/transform-telemetry-info.d.ts.map +1 -1
- package/dist/src/transform/transform-telemetry-info.js +2 -2
- package/dist/src/transform/transform-telemetry-info.js.map +1 -1
- package/dist/src/transform/transform.d.ts +2 -2
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +9 -10
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/utils/api-version-util.d.ts.map +1 -0
- package/dist/src/utils/api-version-util.js.map +1 -0
- package/dist/src/utils/client-utils.d.ts +5 -5
- package/dist/src/utils/client-utils.d.ts.map +1 -1
- package/dist/src/utils/client-utils.js +10 -10
- package/dist/src/utils/client-utils.js.map +1 -1
- package/dist/src/utils/cross-language-def.d.ts.map +1 -1
- package/dist/src/utils/cross-language-def.js +3 -3
- package/dist/src/utils/cross-language-def.js.map +1 -1
- package/dist/src/utils/emit-util.d.ts +2 -2
- package/dist/src/utils/emit-util.d.ts.map +1 -1
- package/dist/src/utils/emit-util.js +2 -2
- package/dist/src/utils/emit-util.js.map +1 -1
- package/dist/src/utils/imports-util.d.ts.map +1 -0
- package/dist/src/{rlc-common/helpers → utils}/imports-util.js +6 -6
- package/dist/src/utils/imports-util.js.map +1 -0
- package/dist/src/utils/interfaces.d.ts +3 -4
- package/dist/src/utils/interfaces.d.ts.map +1 -1
- package/dist/src/utils/model-utils.d.ts +1 -1
- package/dist/src/utils/model-utils.d.ts.map +1 -1
- package/dist/src/utils/model-utils.js +4 -2
- package/dist/src/utils/model-utils.js.map +1 -1
- package/dist/src/{rlc-common/helpers → utils}/name-constructors.d.ts +2 -2
- package/dist/src/utils/name-constructors.d.ts.map +1 -0
- package/dist/src/utils/name-constructors.js.map +1 -0
- package/dist/src/utils/name-utils.d.ts.map +1 -0
- package/dist/src/utils/name-utils.js.map +1 -0
- package/dist/src/utils/namespace-utils.js +4 -4
- package/dist/src/utils/namespace-utils.js.map +1 -1
- package/dist/src/utils/operation-helpers.d.ts +16 -0
- package/dist/src/utils/operation-helpers.d.ts.map +1 -0
- package/dist/src/utils/operation-helpers.js.map +1 -0
- package/dist/src/utils/operation-util.d.ts +2 -2
- package/dist/src/utils/operation-util.d.ts.map +1 -1
- package/dist/src/utils/operation-util.js +17 -18
- package/dist/src/utils/operation-util.js.map +1 -1
- package/dist/src/utils/parameter-utils.d.ts +1 -1
- package/dist/src/utils/parameter-utils.d.ts.map +1 -1
- package/dist/src/utils/parameter-utils.js +2 -4
- package/dist/src/utils/parameter-utils.js.map +1 -1
- package/dist/src/{rlc-common/helpers → utils}/schema-helpers.d.ts +2 -2
- package/dist/src/utils/schema-helpers.d.ts.map +1 -0
- package/dist/src/utils/schema-helpers.js.map +1 -0
- package/dist/src/utils/type-util.d.ts.map +1 -0
- package/dist/src/utils/type-util.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -24
- package/src/context-manager.ts +25 -2
- package/src/framework/declaration.ts +8 -20
- package/src/framework/hooks/sdk-types.ts +15 -1
- package/src/framework/source-file-batch.ts +140 -0
- package/src/index.ts +92 -103
- package/src/{rlc-common/interfaces.ts → interfaces.ts} +14 -16
- package/src/lib.ts +3 -16
- package/src/meta-tree.ts +4 -4
- package/src/{rlc-common/metadata → metadata}/build-api-extractor-config.ts +2 -2
- package/src/{rlc-common/metadata → metadata}/build-changelog-file.ts +3 -3
- package/src/{rlc-common/metadata → metadata}/build-es-lint-config.ts +2 -2
- package/src/{rlc-common/metadata → metadata}/build-package-file.ts +6 -6
- package/src/{rlc-common/metadata → metadata}/build-readme-file.ts +25 -99
- package/src/{rlc-common/metadata → metadata}/build-sample-env-file.ts +2 -2
- package/src/{rlc-common/metadata → metadata}/build-test-config.ts +4 -4
- package/src/{rlc-common/metadata → metadata}/build-ts-config.ts +3 -3
- package/src/{rlc-common/metadata → metadata}/build-vitest-config.ts +2 -2
- package/src/{rlc-common/metadata → metadata}/build-warp-config.ts +2 -2
- package/src/metadata/render-template.ts +202 -0
- package/src/metadata/test/build-recorded-client.ts +9 -0
- package/src/metadata/test/build-sample-test.ts +9 -0
- package/src/{rlc-common → metadata}/test/build-snippets.ts +5 -7
- package/src/metadata/test/template.ts +101 -0
- package/src/{rlc-common/metadata → metadata}/utils.ts +2 -2
- package/src/modular/build-classical-client.ts +9 -9
- package/src/modular/build-classical-operation-groups.ts +3 -3
- package/src/modular/build-client-context.ts +7 -7
- package/src/modular/build-modular-options.ts +3 -3
- package/src/modular/build-operations.ts +6 -6
- package/src/modular/build-project-files.ts +4 -5
- package/src/modular/build-restore-poller.ts +3 -3
- package/src/modular/build-root-index.ts +57 -19
- package/src/modular/build-subpath-index.ts +26 -5
- package/src/modular/emit-models-options.ts +3 -3
- package/src/modular/emit-models.ts +32 -26
- package/src/modular/emit-samples.ts +5 -5
- package/src/modular/emit-tests.ts +1 -1
- package/src/modular/helpers/classical-operation-helpers.ts +11 -11
- package/src/modular/helpers/client-helpers.ts +3 -3
- package/src/modular/helpers/example-value-helpers.ts +2 -2
- package/src/modular/helpers/naming-helpers.ts +2 -2
- package/src/modular/helpers/operation-helpers.ts +27 -27
- package/src/modular/helpers/type-helpers.ts +1 -1
- package/src/modular/interfaces.ts +4 -4
- package/src/modular/serialization/build-deserializer-function.ts +2 -2
- package/src/modular/serialization/build-serializer-function.ts +2 -2
- package/src/modular/serialization/build-xml-serializer-function.ts +1 -1
- package/src/modular/type-expressions/get-enum-expression.ts +1 -1
- package/src/modular/type-expressions/get-nullable-expression.ts +1 -1
- package/src/modular/type-expressions/get-type-expression.ts +3 -3
- package/src/transform/transform-api-version-info.ts +4 -10
- package/src/transform/{transfrom-rlc-options.ts → transform-client-options.ts} +12 -22
- package/src/transform/transform-helper-function-details.ts +5 -5
- package/src/transform/transform-parameters.ts +12 -12
- package/src/transform/transform-paths.ts +5 -12
- package/src/transform/transform-responses.ts +19 -19
- package/src/transform/transform-schemas.ts +5 -5
- package/src/transform/transform-telemetry-info.ts +3 -3
- package/src/transform/transform.ts +13 -18
- package/src/utils/client-utils.ts +11 -11
- package/src/utils/cross-language-def.ts +3 -3
- package/src/utils/emit-util.ts +3 -3
- package/src/{rlc-common/helpers → utils}/imports-util.ts +6 -6
- package/src/utils/interfaces.ts +3 -4
- package/src/utils/model-utils.ts +7 -8
- package/src/{rlc-common/helpers → utils}/name-constructors.ts +2 -2
- package/src/utils/namespace-utils.ts +4 -4
- package/src/{rlc-common/helpers → utils}/operation-helpers.ts +12 -12
- package/src/utils/operation-util.ts +19 -33
- package/src/utils/parameter-utils.ts +2 -4
- package/src/{rlc-common/helpers → utils}/schema-helpers.ts +2 -2
- package/dist/src/rlc-common/helpers/api-version-util.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/api-version-util.js.map +0 -1
- package/dist/src/rlc-common/helpers/imports-util.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/imports-util.js.map +0 -1
- package/dist/src/rlc-common/helpers/name-constructors.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/name-constructors.js.map +0 -1
- package/dist/src/rlc-common/helpers/name-utils.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/name-utils.js.map +0 -1
- package/dist/src/rlc-common/helpers/operation-helpers.d.ts +0 -16
- package/dist/src/rlc-common/helpers/operation-helpers.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/operation-helpers.js.map +0 -1
- package/dist/src/rlc-common/helpers/schema-helpers.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/schema-helpers.js.map +0 -1
- package/dist/src/rlc-common/helpers/type-util.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/type-util.js.map +0 -1
- package/dist/src/rlc-common/index.d.ts +0 -23
- package/dist/src/rlc-common/index.d.ts.map +0 -1
- package/dist/src/rlc-common/index.js +0 -25
- package/dist/src/rlc-common/index.js.map +0 -1
- package/dist/src/rlc-common/interfaces.d.ts.map +0 -1
- package/dist/src/rlc-common/interfaces.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts +0 -6
- package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-changelog-file.d.ts +0 -6
- package/dist/src/rlc-common/metadata/build-changelog-file.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-changelog-file.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts +0 -6
- package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-es-lint-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-license-file.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-license-file.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-package-file.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-package-file.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts +0 -11
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-readme-file.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts +0 -6
- package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-sample-env-file.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-test-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-test-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-ts-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-ts-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-vitest-config.d.ts +0 -6
- package/dist/src/rlc-common/metadata/build-vitest-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-vitest-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-warp-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-warp-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.js.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/package-common.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/package-common.js.map +0 -1
- package/dist/src/rlc-common/metadata/utils.d.ts +0 -3
- package/dist/src/rlc-common/metadata/utils.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/utils.js.map +0 -1
- package/dist/src/rlc-common/static/paginate-content.d.ts +0 -2
- package/dist/src/rlc-common/static/paginate-content.d.ts.map +0 -1
- package/dist/src/rlc-common/static/paginate-content.js +0 -345
- package/dist/src/rlc-common/static/paginate-content.js.map +0 -1
- package/dist/src/rlc-common/static/polling-content.d.ts +0 -2
- package/dist/src/rlc-common/static/polling-content.d.ts.map +0 -1
- package/dist/src/rlc-common/static/polling-content.js +0 -225
- package/dist/src/rlc-common/static/polling-content.js.map +0 -1
- package/dist/src/rlc-common/static/sample-template.d.ts +0 -2
- package/dist/src/rlc-common/static/sample-template.d.ts.map +0 -1
- package/dist/src/rlc-common/static/sample-template.js +0 -56
- package/dist/src/rlc-common/static/sample-template.js.map +0 -1
- package/dist/src/rlc-common/static/serialize-helper.d.ts +0 -6
- package/dist/src/rlc-common/static/serialize-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/static/serialize-helper.js +0 -31
- package/dist/src/rlc-common/static/serialize-helper.js.map +0 -1
- package/dist/src/rlc-common/test/build-karma-config.d.ts +0 -6
- package/dist/src/rlc-common/test/build-karma-config.d.ts.map +0 -1
- package/dist/src/rlc-common/test/build-karma-config.js +0 -11
- package/dist/src/rlc-common/test/build-karma-config.js.map +0 -1
- package/dist/src/rlc-common/test/build-recorded-client.d.ts +0 -6
- package/dist/src/rlc-common/test/build-recorded-client.d.ts.map +0 -1
- package/dist/src/rlc-common/test/build-recorded-client.js +0 -14
- package/dist/src/rlc-common/test/build-recorded-client.js.map +0 -1
- package/dist/src/rlc-common/test/build-sample-test.d.ts +0 -6
- package/dist/src/rlc-common/test/build-sample-test.d.ts.map +0 -1
- package/dist/src/rlc-common/test/build-sample-test.js +0 -11
- package/dist/src/rlc-common/test/build-sample-test.js.map +0 -1
- package/dist/src/rlc-common/test/build-snippets.d.ts +0 -6
- package/dist/src/rlc-common/test/build-snippets.d.ts.map +0 -1
- package/dist/src/rlc-common/test/build-snippets.js.map +0 -1
- package/dist/src/rlc-common/test/template.d.ts +0 -5
- package/dist/src/rlc-common/test/template.d.ts.map +0 -1
- package/dist/src/rlc-common/test/template.js +0 -227
- package/dist/src/rlc-common/test/template.js.map +0 -1
- package/dist/src/transform/transfrom-rlc-options.d.ts.map +0 -1
- package/dist/src/transform/transfrom-rlc-options.js.map +0 -1
- package/src/rlc-common/index.ts +0 -25
- package/src/rlc-common/static/paginate-content.ts +0 -345
- package/src/rlc-common/static/polling-content.ts +0 -225
- package/src/rlc-common/static/sample-template.ts +0 -56
- package/src/rlc-common/static/serialize-helper.ts +0 -34
- package/src/rlc-common/test/build-karma-config.ts +0 -12
- package/src/rlc-common/test/build-recorded-client.ts +0 -15
- package/src/rlc-common/test/build-sample-test.ts +0 -12
- package/src/rlc-common/test/template.ts +0 -229
- /package/dist/src/{rlc-common/interfaces.js → interfaces.js} +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-api-extractor-config.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-changelog-file.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-es-lint-config.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-license-file.d.ts +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-license-file.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-sample-env-file.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-test-config.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-ts-config.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-vitest-config.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-warp-config.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/package-json/azure-package-common.d.ts +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/package-json/azure-package-common.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.d.ts +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/package-json/package-common.d.ts +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/package-json/package-common.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/utils.js +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/api-version-util.d.ts +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/api-version-util.js +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/imports-util.d.ts +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/name-constructors.js +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/name-utils.d.ts +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/name-utils.js +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/operation-helpers.js +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/schema-helpers.js +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/type-util.d.ts +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/type-util.js +0 -0
- /package/src/{rlc-common/metadata → metadata}/build-license-file.ts +0 -0
- /package/src/{rlc-common/metadata → metadata}/package-json/azure-package-common.ts +0 -0
- /package/src/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.ts +0 -0
- /package/src/{rlc-common/metadata → metadata}/package-json/package-common.ts +0 -0
- /package/src/{rlc-common/helpers → utils}/api-version-util.ts +0 -0
- /package/src/{rlc-common/helpers → utils}/name-utils.ts +0 -0
- /package/src/{rlc-common/helpers → utils}/type-util.ts +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @azure-tools/typespec-ts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A TypeSpec emitter for TypeScript
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -126,12 +126,6 @@ other cases:
|
|
|
126
126
|
|
|
127
127
|
Whether to generate sample files, for basic samples of your generated sdks. Defaults to `undefined`. Management packages' default to `true`.
|
|
128
128
|
|
|
129
|
-
### `is-typespec-test`
|
|
130
|
-
|
|
131
|
-
**Type:** `boolean`
|
|
132
|
-
|
|
133
|
-
Internal option for test
|
|
134
|
-
|
|
135
129
|
### `azure-arm`
|
|
136
130
|
|
|
137
131
|
**Type:** `boolean`
|
|
@@ -192,12 +186,6 @@ The emitter will use camel case to normalize the property name, to ignore this n
|
|
|
192
186
|
|
|
193
187
|
The emitter has a normalization logic for enum member key, to ignore this normalization, you can set this option to true
|
|
194
188
|
|
|
195
|
-
### `compatibility-query-multi-format`
|
|
196
|
-
|
|
197
|
-
**Type:** `boolean`
|
|
198
|
-
|
|
199
|
-
Whether to generate the backward-compatible code for query parameter serialization for array types in RLC. Defaults to `false`
|
|
200
|
-
|
|
201
189
|
### `typespec-title-map`
|
|
202
190
|
|
|
203
191
|
**Type:** `object`
|
|
@@ -4,7 +4,7 @@ import { Project, SourceFile } from "ts-morph";
|
|
|
4
4
|
import { ExternalDependencies } from "./framework/dependency.js";
|
|
5
5
|
import { Binder } from "./framework/hooks/binder.js";
|
|
6
6
|
import { SdkTypeContext } from "./framework/hooks/sdk-types.js";
|
|
7
|
-
import {
|
|
7
|
+
import { ClientTypeMetaTree } from "./meta-tree.js";
|
|
8
8
|
/**
|
|
9
9
|
* Contexts Object Guidelines
|
|
10
10
|
* --------------------------
|
|
@@ -19,7 +19,7 @@ import { RlcMetaTree } from "./meta-tree.js";
|
|
|
19
19
|
* Remember, adding too many contexts can lead to complex dependencies and harder-to-maintain code. Always evaluate if the context is truly necessary or if there are better alternatives such as localized state management or passing props for simpler scenarios.
|
|
20
20
|
*/
|
|
21
21
|
type Contexts = {
|
|
22
|
-
|
|
22
|
+
clientTypeMetaTree: ClientTypeMetaTree;
|
|
23
23
|
outputProject: Project;
|
|
24
24
|
symbolMap: Map<string, SourceFile>;
|
|
25
25
|
sdkTypes: SdkTypeContext;
|
|
@@ -56,6 +56,16 @@ declare class ContextManager {
|
|
|
56
56
|
* @returns {Contexts[K] | undefined} The value of the context if found, otherwise undefined.
|
|
57
57
|
*/
|
|
58
58
|
getContext<K extends ContextKey>(key: K): Contexts[K] | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Clears all stored contexts.
|
|
61
|
+
*
|
|
62
|
+
* The manager is a process-wide singleton, so the values provided during an
|
|
63
|
+
* emit (the `EmitContext`/`Program`, the TCGC `SdkContext`, the ts-morph
|
|
64
|
+
* `Project`, etc.) stay reachable from this map until the next emit overwrites
|
|
65
|
+
* them. Clearing at the end of an emit lets the whole previous program graph
|
|
66
|
+
* be collected instead of being retained until the following emit.
|
|
67
|
+
*/
|
|
68
|
+
clearContexts(): void;
|
|
59
69
|
}
|
|
60
70
|
export declare const contextManager: ContextManager;
|
|
61
71
|
/**
|
|
@@ -71,5 +81,12 @@ export declare function useContext<K extends ContextKey>(key: K): Contexts[K];
|
|
|
71
81
|
* @param {Contexts[K]} value - The value to set for the specified context.
|
|
72
82
|
*/
|
|
73
83
|
export declare function provideContext<K extends ContextKey>(key: K, value: Contexts[K]): void;
|
|
84
|
+
/**
|
|
85
|
+
* Clears all contexts held by the singleton context manager. Call this once an
|
|
86
|
+
* emit has finished writing its output so the retained program graph (compiler
|
|
87
|
+
* `EmitContext`/`Program`, TCGC `SdkContext`, ts-morph `Project`, binder, …) can
|
|
88
|
+
* be garbage collected instead of lingering until the next emit overwrites it.
|
|
89
|
+
*/
|
|
90
|
+
export declare function clearContexts(): void;
|
|
74
91
|
export {};
|
|
75
92
|
//# sourceMappingURL=context-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-manager.d.ts","sourceRoot":"","sources":["../../src/context-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"context-manager.d.ts","sourceRoot":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E;;;;;;;;OAQG;IACI,aAAa,IAAI,IAAI;CAG7B;AAGD,eAAO,MAAM,cAAc,gBAA+B,CAAC;AAE3D;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAMpE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,UAAU,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAErF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAEpC"}
|
|
@@ -32,6 +32,18 @@ class ContextManager {
|
|
|
32
32
|
getContext(key) {
|
|
33
33
|
return this.contexts.get(key);
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Clears all stored contexts.
|
|
37
|
+
*
|
|
38
|
+
* The manager is a process-wide singleton, so the values provided during an
|
|
39
|
+
* emit (the `EmitContext`/`Program`, the TCGC `SdkContext`, the ts-morph
|
|
40
|
+
* `Project`, etc.) stay reachable from this map until the next emit overwrites
|
|
41
|
+
* them. Clearing at the end of an emit lets the whole previous program graph
|
|
42
|
+
* be collected instead of being retained until the following emit.
|
|
43
|
+
*/
|
|
44
|
+
clearContexts() {
|
|
45
|
+
this.contexts.clear();
|
|
46
|
+
}
|
|
35
47
|
}
|
|
36
48
|
// Expose the singleton instance of the context manager.
|
|
37
49
|
export const contextManager = ContextManager.getInstance();
|
|
@@ -56,4 +68,13 @@ export function useContext(key) {
|
|
|
56
68
|
export function provideContext(key, value) {
|
|
57
69
|
contextManager.setContext(key, value);
|
|
58
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Clears all contexts held by the singleton context manager. Call this once an
|
|
73
|
+
* emit has finished writing its output so the retained program graph (compiler
|
|
74
|
+
* `EmitContext`/`Program`, TCGC `SdkContext`, ts-morph `Project`, binder, …) can
|
|
75
|
+
* be garbage collected instead of lingering until the next emit overwrites it.
|
|
76
|
+
*/
|
|
77
|
+
export function clearContexts() {
|
|
78
|
+
contextManager.clearContexts();
|
|
79
|
+
}
|
|
59
80
|
//# sourceMappingURL=context-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-manager.js","sourceRoot":"","sources":["../../src/context-manager.ts"],"names":[],"mappings":"AAoCA;;;GAGG;AACH,MAAM,cAAc;IACV,MAAM,CAAC,QAAQ,CAAiB;IAChC,QAAQ,GAAyB,IAAI,GAAG,EAAE,CAAC;IAEnD,gBAAuB,CAAC;IAExB;;;OAGG;IACI,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;YAC7B,cAAc,CAAC,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;QACjD,CAAC;QACD,OAAO,cAAc,CAAC,QAAQ,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACI,UAAU,CAAuB,GAAM,EAAE,KAAkB;QAChE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,UAAU,CAAuB,GAAM;QAC5C,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAA4B,CAAC;IAC3D,CAAC;CACF;AAED,wDAAwD;AACxD,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAuB,GAAM;IACrD,MAAM,OAAO,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,WAAW,GAAG,YAAY,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAuB,GAAM,EAAE,KA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B,GAAM,EAAE,KAAkB;IAC7E,cAAc,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa;IAC3B,cAAc,CAAC,aAAa,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../src/framework/declaration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EACxB,mBAAmB,EACnB,4BAA4B,EAC5B,oBAAoB,EACpB,6BAA6B,EAC7B,UAAU,
|
|
1
|
+
{"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../src/framework/declaration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EACxB,mBAAmB,EACnB,4BAA4B,EAC5B,oBAAoB,EACpB,6BAA6B,EAC7B,UAAU,EAGV,oBAAoB,EACpB,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAIlB,MAAM,MAAM,qBAAqB,GAC7B,yBAAyB,GACzB,wBAAwB,GACxB,4BAA4B,GAC5B,6BAA6B,GAC7B,6BAA6B,CAAC;AAElC,MAAM,MAAM,YAAY,GACpB,gBAAgB,GAChB,eAAe,GACf,mBAAmB,GACnB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,yBAAyB,EACtC,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AAER,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,wBAAwB,EACrC,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AAER,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,4BAA4B,EACzC,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AAER,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,6BAA6B,EAC1C,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AAER,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,6BAA6B,EAC1C,MAAM,EAAE,OAAO,GACd,IAAI,CAAC;AACR,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StructureKind, } from "ts-morph";
|
|
2
2
|
import { useBinder } from "./hooks/binder.js";
|
|
3
3
|
import { refkey as getRefKey } from "./refkey.js";
|
|
4
|
+
import { enqueueStatement } from "./source-file-batch.js";
|
|
4
5
|
export function addDeclaration(sourceFile, input, refkey) {
|
|
5
6
|
const binder = useBinder();
|
|
6
7
|
const declaration = typeof input === "string" ? { name: input, kind: StructureKind.TypeAlias } : input;
|
|
@@ -11,26 +12,11 @@ export function addDeclaration(sourceFile, input, refkey) {
|
|
|
11
12
|
const trackedDeclarationName = binder.trackDeclaration(stringRefkey, declaration.name, sourceFile);
|
|
12
13
|
// Update the declaration name to be unique
|
|
13
14
|
const trackedDeclaration = { ...declaration, name: trackedDeclarationName };
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
case StructureKind.Enum:
|
|
19
|
-
sourceFile.addEnum(trackedDeclaration);
|
|
20
|
-
break;
|
|
21
|
-
case StructureKind.Function:
|
|
22
|
-
sourceFile.addFunction(trackedDeclaration);
|
|
23
|
-
break;
|
|
24
|
-
case StructureKind.Interface:
|
|
25
|
-
sourceFile.addInterface(trackedDeclaration);
|
|
26
|
-
break;
|
|
27
|
-
case StructureKind.TypeAlias:
|
|
28
|
-
if (trackedDeclaration.type) {
|
|
29
|
-
sourceFile.addTypeAlias(trackedDeclaration);
|
|
30
|
-
}
|
|
31
|
-
break;
|
|
32
|
-
default:
|
|
33
|
-
throw new Error(`Unsupported declaration kind ${trackedDeclaration.kind}`);
|
|
15
|
+
// Skip empty type aliases (they have no body to emit). Done before
|
|
16
|
+
// dispatching so behaviour is identical whether batching or not.
|
|
17
|
+
if (trackedDeclaration.kind === StructureKind.TypeAlias && !trackedDeclaration.type) {
|
|
18
|
+
return;
|
|
34
19
|
}
|
|
20
|
+
enqueueStatement(sourceFile, trackedDeclaration);
|
|
35
21
|
}
|
|
36
22
|
//# sourceMappingURL=declaration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../../src/framework/declaration.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../../src/framework/declaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,aAAa,GAGd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AA6C1D,MAAM,UAAU,cAAc,CAC5B,UAAsB,EACtB,KAAqC,EACrC,MAAe;IAEf,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,WAAW,GACf,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,CAAC,SAAS,EAAU,CAAC,CAAC,CAAC,KAAK,CAAC;IAC9F,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC7E,MAAM,sBAAsB,GAAG,MAAM,CAAC,gBAAgB,CACpD,YAAY,EACZ,WAAW,CAAC,IAAI,EAChB,UAAU,CACX,CAAC;IAEF,2CAA2C;IAC3C,MAAM,kBAAkB,GAAG,EAAE,GAAG,WAAW,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC;IAE5E,mEAAmE;IACnE,iEAAiE;IACjE,IAAI,kBAAkB,CAAC,IAAI,KAAK,aAAa,CAAC,SAAS,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;QACpF,OAAO;IACT,CAAC;IAED,gBAAgB,CAAC,UAAU,EAAE,kBAAyC,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -9,6 +9,15 @@ export declare const flattenPropertyModelMap: Map<SdkModelPropertyType, SdkModel
|
|
|
9
9
|
* Precomputed during visitPackageTypes for O(1) lookups in normalizeModelName.
|
|
10
10
|
*/
|
|
11
11
|
export declare const pagedModelsKeptPublic: Set<SdkType>;
|
|
12
|
+
/**
|
|
13
|
+
* Releases the module-level state that accumulates while visiting a package's
|
|
14
|
+
* types. These collections are cleared at the start of every
|
|
15
|
+
* {@link visitPackageTypes} call, but because they live at module scope they
|
|
16
|
+
* otherwise keep the most recently emitted program's SDK types reachable until
|
|
17
|
+
* the next emit runs. Call this once an emit has fully finished so that state
|
|
18
|
+
* can be garbage collected.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resetSdkTypesState(): void;
|
|
12
21
|
export interface SdkTypeContext {
|
|
13
22
|
operations: Map<Type, SdkServiceMethod<SdkHttpOperation>>;
|
|
14
23
|
types: Map<Type, SdkType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-types.d.ts","sourceRoot":"","sources":["../../../../src/framework/hooks/sdk-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,E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UAAU,QAkElD;AAmED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,CAAC,gBAAgB,CAAC,wCAYjF"}
|
|
@@ -5,7 +5,7 @@ import { reportDiagnostic } from "../../lib.js";
|
|
|
5
5
|
import { visitPackageTypes } from "../../modular/emit-models.js";
|
|
6
6
|
import { getAllAncestors, getAllProperties } from "../../modular/helpers/operation-helpers.js";
|
|
7
7
|
import { normalizeModelPropertyName } from "../../modular/type-expressions/get-type-expression.js";
|
|
8
|
-
import { NameType, normalizeName } from "../../
|
|
8
|
+
import { NameType, normalizeName } from "../../utils/name-utils.js";
|
|
9
9
|
export const emitQueue = new Set();
|
|
10
10
|
export const flattenPropertyModelMap = new Map();
|
|
11
11
|
/**
|
|
@@ -14,6 +14,19 @@ export const flattenPropertyModelMap = new Map();
|
|
|
14
14
|
* Precomputed during visitPackageTypes for O(1) lookups in normalizeModelName.
|
|
15
15
|
*/
|
|
16
16
|
export const pagedModelsKeptPublic = new Set();
|
|
17
|
+
/**
|
|
18
|
+
* Releases the module-level state that accumulates while visiting a package's
|
|
19
|
+
* types. These collections are cleared at the start of every
|
|
20
|
+
* {@link visitPackageTypes} call, but because they live at module scope they
|
|
21
|
+
* otherwise keep the most recently emitted program's SDK types reachable until
|
|
22
|
+
* the next emit runs. Call this once an emit has fully finished so that state
|
|
23
|
+
* can be garbage collected.
|
|
24
|
+
*/
|
|
25
|
+
export function resetSdkTypesState() {
|
|
26
|
+
emitQueue.clear();
|
|
27
|
+
flattenPropertyModelMap.clear();
|
|
28
|
+
pagedModelsKeptPublic.clear();
|
|
29
|
+
}
|
|
17
30
|
export function useSdkTypes() {
|
|
18
31
|
const sdkTypesContext = useContext("sdkTypes");
|
|
19
32
|
const { tcgcContext } = useContext("emitContext");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-types.js","sourceRoot":"","sources":["../../../../src/framework/hooks/sdk-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,aAAa,GACd,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AC;QACvC,CAAC;QACD,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SourceFile, StatementStructures } from "ts-morph";
|
|
2
|
+
/**
|
|
3
|
+
* Opens a batching scope. Subsequent `enqueueStatement` calls queue rather
|
|
4
|
+
* than mutate the AST until the matching `flushSourceFileBatch` is called.
|
|
5
|
+
*/
|
|
6
|
+
export declare function beginSourceFileBatch(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Closes the most recent batching scope. When the outermost scope closes,
|
|
9
|
+
* all pending structures are written to their source files in bulk.
|
|
10
|
+
*/
|
|
11
|
+
export declare function flushSourceFileBatch(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Queues a statement structure for bulk-add on flush, or writes it
|
|
14
|
+
* immediately when no batch is open.
|
|
15
|
+
* @param sourceFile - Target source file.
|
|
16
|
+
* @param structure - The statement structure to add.
|
|
17
|
+
*/
|
|
18
|
+
export declare function enqueueStatement(sourceFile: SourceFile, structure: StatementStructures): void;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the set of names exported from `sourceFile` considering both the
|
|
21
|
+
* declarations already present in its AST and any export declarations queued
|
|
22
|
+
* by the current batch. Use this in place of reading `getExportDeclarations`
|
|
23
|
+
* directly when callers dedup against existing exports inside a batch.
|
|
24
|
+
* @param sourceFile - The file to inspect.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getEffectiveExportedNames(sourceFile: SourceFile): Set<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the set of named exports queued in the current batch for
|
|
29
|
+
* `sourceFile`. Use this to union with any AST-based view of exports
|
|
30
|
+
* (e.g. `getExportedDeclarations`) when deduplicating against still-pending
|
|
31
|
+
* writes inside a batch.
|
|
32
|
+
* @param sourceFile - The file to inspect.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getQueuedExportNames(sourceFile: SourceFile): Set<string>;
|
|
35
|
+
//# sourceMappingURL=source-file-batch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file-batch.d.ts","sourceRoot":"","sources":["../../../src/framework/source-file-batch.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,mBAAmB,EAEpB,MAAM,UAAU,CAAC;AAkBlB;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAkB3C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,GAAG,IAAI,CAW7F;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,CAiB7E;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,CAaxE"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { StructureKind, } from "ts-morph";
|
|
2
|
+
/**
|
|
3
|
+
* Generic per-source-file batch for ts-morph `add*` mutations.
|
|
4
|
+
*
|
|
5
|
+
* Each individual `sourceFile.addInterface/addFunction/addExportDeclaration/...`
|
|
6
|
+
* call re-parses the entire source file in ts-morph. Calling them in a loop
|
|
7
|
+
* therefore grows as O(N × file_size). This module collects structures while
|
|
8
|
+
* a batch is open and, on flush, issues a single `addStatements` call per file,
|
|
9
|
+
* collapsing N re-parses into 1.
|
|
10
|
+
*
|
|
11
|
+
* The batch is reference-counted so nested begin/flush pairs compose safely.
|
|
12
|
+
* Statements flush in insertion order and produce byte-identical output.
|
|
13
|
+
*/
|
|
14
|
+
let batchDepth = 0;
|
|
15
|
+
const pendingByFile = new Map();
|
|
16
|
+
/**
|
|
17
|
+
* Opens a batching scope. Subsequent `enqueueStatement` calls queue rather
|
|
18
|
+
* than mutate the AST until the matching `flushSourceFileBatch` is called.
|
|
19
|
+
*/
|
|
20
|
+
export function beginSourceFileBatch() {
|
|
21
|
+
batchDepth++;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Closes the most recent batching scope. When the outermost scope closes,
|
|
25
|
+
* all pending structures are written to their source files in bulk.
|
|
26
|
+
*/
|
|
27
|
+
export function flushSourceFileBatch() {
|
|
28
|
+
if (batchDepth === 0) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
batchDepth--;
|
|
32
|
+
if (batchDepth > 0) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
for (const [sourceFile, statements] of pendingByFile) {
|
|
37
|
+
if (statements.length === 0) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
sourceFile.addStatements(statements);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
pendingByFile.clear();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Queues a statement structure for bulk-add on flush, or writes it
|
|
49
|
+
* immediately when no batch is open.
|
|
50
|
+
* @param sourceFile - Target source file.
|
|
51
|
+
* @param structure - The statement structure to add.
|
|
52
|
+
*/
|
|
53
|
+
export function enqueueStatement(sourceFile, structure) {
|
|
54
|
+
if (batchDepth > 0) {
|
|
55
|
+
let pending = pendingByFile.get(sourceFile);
|
|
56
|
+
if (!pending) {
|
|
57
|
+
pending = [];
|
|
58
|
+
pendingByFile.set(sourceFile, pending);
|
|
59
|
+
}
|
|
60
|
+
pending.push(structure);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
sourceFile.addStatements([structure]);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Returns the set of names exported from `sourceFile` considering both the
|
|
67
|
+
* declarations already present in its AST and any export declarations queued
|
|
68
|
+
* by the current batch. Use this in place of reading `getExportDeclarations`
|
|
69
|
+
* directly when callers dedup against existing exports inside a batch.
|
|
70
|
+
* @param sourceFile - The file to inspect.
|
|
71
|
+
*/
|
|
72
|
+
export function getEffectiveExportedNames(sourceFile) {
|
|
73
|
+
const names = new Set();
|
|
74
|
+
for (const decl of sourceFile.getExportDeclarations()) {
|
|
75
|
+
for (const named of decl.getNamedExports()) {
|
|
76
|
+
names.add(named.getAliasNode()?.getText() ?? named.getName());
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const pending = pendingByFile.get(sourceFile);
|
|
80
|
+
if (pending) {
|
|
81
|
+
for (const structure of pending) {
|
|
82
|
+
if (structure.kind !== StructureKind.ExportDeclaration) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
collectNamedExportNames(structure.namedExports, names);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return names;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns the set of named exports queued in the current batch for
|
|
92
|
+
* `sourceFile`. Use this to union with any AST-based view of exports
|
|
93
|
+
* (e.g. `getExportedDeclarations`) when deduplicating against still-pending
|
|
94
|
+
* writes inside a batch.
|
|
95
|
+
* @param sourceFile - The file to inspect.
|
|
96
|
+
*/
|
|
97
|
+
export function getQueuedExportNames(sourceFile) {
|
|
98
|
+
const names = new Set();
|
|
99
|
+
const pending = pendingByFile.get(sourceFile);
|
|
100
|
+
if (!pending) {
|
|
101
|
+
return names;
|
|
102
|
+
}
|
|
103
|
+
for (const structure of pending) {
|
|
104
|
+
if (structure.kind !== StructureKind.ExportDeclaration) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
collectNamedExportNames(structure.namedExports, names);
|
|
108
|
+
}
|
|
109
|
+
return names;
|
|
110
|
+
}
|
|
111
|
+
function collectNamedExportNames(named, into) {
|
|
112
|
+
if (!named || typeof named === "function") {
|
|
113
|
+
// WriterFunction form is opaque to us; callers can't dedup by name.
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
for (const item of named) {
|
|
117
|
+
if (typeof item === "string") {
|
|
118
|
+
into.add(item);
|
|
119
|
+
}
|
|
120
|
+
else if (typeof item === "function") {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
else if (item) {
|
|
124
|
+
into.add(item.alias ?? item.name);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=source-file-batch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file-batch.js","sourceRoot":"","sources":["../../../src/framework/source-file-batch.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,GACd,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;GAWG;AAEH,IAAI,UAAU,GAAG,CAAC,CAAC;AACnB,MAAM,aAAa,GAAG,IAAI,GAAG,EAAqC,CAAC;AAEnE;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,UAAU,EAAE,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IACD,UAAU,EAAE,CAAC;IACb,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QACH,KAAK,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,aAAa,EAAE,CAAC;YACrD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC5B,SAAS;YACX,CAAC;YACD,UAAU,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;YAAS,CAAC;QACT,aAAa,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAsB,EAAE,SAA8B;IACrF,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACnB,IAAI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AC;IAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACf,CAAC;IACD,KAAK,MAAM,SAAS,IAAI,OAAO,EAAE,CAAC;QAChC,IAAI,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,iBAAiB,EAAE,CAAC;YACvD,SAAS;QACX,CAAC;QACD,uBAAuB,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,uBAAuB,CAC9B,KAAiD,EACjD,IAAiB;IAEjB,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAC1C,oEAAoE;QACpE,OAAO;IACT,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;aAAM,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;YACtC,SAAS;QACX,CAAC;aAAM,IAAI,IAAI,EAAE,CAAC;YAChB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,WAAW,EAOZ,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,WAAW,EAOZ,MAAM,oBAAoB,CAAC;AAwB5B,OAAO,EAAuB,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,EACL,aAAa,EACb,mBAAmB,EAGpB,MAAM,6CAA6C,CAAC;AAgDrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAOhE,cAAc,UAAU,CAAC;AAEzB,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,iBA0ejD;AAED,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GACxC,OAAO,CAAC,UAAU,CAAC,CA2BrB;AAQD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAC1C,cAAc,EAAE,qBAAqB,iBAQtC"}
|