@azure-tools/typespec-ts 0.56.0-dev.0 → 0.56.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/README.md +1 -13
- package/dist/src/context-manager.d.ts +2 -2
- package/dist/src/context-manager.d.ts.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.map +1 -1
- package/dist/src/framework/hooks/sdk-types.js +1 -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 +63 -60
- 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/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.js +1 -1
- 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 +2 -2
- package/src/framework/declaration.ts +8 -20
- package/src/framework/hooks/sdk-types.ts +1 -1
- package/src/framework/source-file-batch.ts +140 -0
- package/src/index.ts +81 -101
- 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/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.ts +1 -1
- 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/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/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;
|
|
@@ -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,M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AG,IAAI;IAIzE;;;;OAIG;IACI,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS;CAGzE;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"}
|
|
@@ -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"}
|
|
@@ -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,EAChB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,OAAO,EAER,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAwB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk-types.d.ts","sourceRoot":"","sources":["../../../../src/framework/hooks/sdk-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,OAAO,EAER,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAwB,MAAM,oBAAoB,CAAC;AAO3E,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,eAAO,MAAM,SAAS,EAAE,GAAG,CAAC,OAAO,CAAsB,CAAC;AAC1D,eAAO,MAAM,uBAAuB,EAAE,GAAG,CAAC,oBAAoB,EAAE,YAAY,CAGzE,CAAC;AACJ;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,cAAqB,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC1D,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1B,iBAAiB,EAAE,GAAG,CAAC,oBAAoB,EAAE,yBAAyB,CAAC,CAAC;CACzE;AAED,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,YAAY,CAAC;IACxB,WAAW,CAAC,EAAE,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;CACjD;AAED,wBAAgB,WAAW;WAIC,SAAS,GAAG,gBAAgB,CAAC,gBAAgB,CAAC;WAC9C,IAAI,GAAG,OAAO;EAwBzC;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,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
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-types.js","sourceRoot":"","sources":["../../../../src/framework/hooks/sdk-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,aAAa,GACd,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,uDAAuD,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk-types.js","sourceRoot":"","sources":["../../../../src/framework/hooks/sdk-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,aAAa,GACd,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,uDAAuD,CAAC;AAEnG,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,CAAC,MAAM,SAAS,GAAiB,IAAI,GAAG,EAAW,CAAC;AAC1D,MAAM,CAAC,MAAM,uBAAuB,GAA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W,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;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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AM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;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,iBAiejD;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"}
|
package/dist/src/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import { provideContext, useContext } from "./context-manager.js";
|
|
|
5
5
|
import { buildRootIndex, buildSubClientIndexFile } from "./modular/build-root-index.js";
|
|
6
6
|
import { AzureCoreDependencies, AzureIdentityDependencies, AzurePollingDependencies, AzureTestDependencies, } from "./modular/external-dependencies.js";
|
|
7
7
|
import { CloudSettingHelpers, CreateRecorderHelpers, MultipartHelpers, PagingHelpers, PlatformTypeHelpers, PollingHelpers, SerializationHelpers, SimplePollerHelpers, StorageCompatHelpers, UrlTemplateHelpers, XmlHelpers, } from "./modular/static-helpers-metadata.js";
|
|
8
|
-
import { buildApiExtractorConfig, buildChangelogFile, buildEsLintConfig, buildLicenseFile, buildPackageFile, buildReadmeFile, buildRecordedClientFile, buildSampleEnvFile, buildSampleTest, buildSnippets, buildTestBrowserTsConfig, buildTestNodeTsConfig, buildTsConfig, buildTsLintConfig, buildTsSampleConfig, buildTsSnippetsConfig, buildTsSrcBrowserConfig, buildTsSrcCjsConfig, buildTsSrcEsmConfig, buildTsSrcReactNativeConfig, buildVitestConfig, buildWarpConfig, getClientName, hasClientNameChanged, hasUnexpectedHelper, updatePackageFile, updateReadmeFile, } from "./rlc-common/index.js";
|
|
9
8
|
import { emitContentByBuilder } from "./utils/emit-util.js";
|
|
10
9
|
import { clearDirectory, emptyDir, pathExists } from "./utils/file-system-utils.js";
|
|
11
10
|
import { createSdkContext, listAllServiceNamespaces, } from "@azure-tools/typespec-client-generator-core";
|
|
@@ -13,6 +12,20 @@ import { Project } from "ts-morph";
|
|
|
13
12
|
import { provideBinder } from "./framework/hooks/binder.js";
|
|
14
13
|
import { provideSdkTypes } from "./framework/hooks/sdk-types.js";
|
|
15
14
|
import { loadStaticHelpers } from "./framework/load-static-helpers.js";
|
|
15
|
+
import { buildApiExtractorConfig } from "./metadata/build-api-extractor-config.js";
|
|
16
|
+
import { buildChangelogFile } from "./metadata/build-changelog-file.js";
|
|
17
|
+
import { buildEsLintConfig } from "./metadata/build-es-lint-config.js";
|
|
18
|
+
import { buildLicenseFile } from "./metadata/build-license-file.js";
|
|
19
|
+
import { buildPackageFile, updatePackageFile } from "./metadata/build-package-file.js";
|
|
20
|
+
import { buildReadmeFile, hasClientNameChanged, updateReadmeFile, } from "./metadata/build-readme-file.js";
|
|
21
|
+
import { buildSampleEnvFile } from "./metadata/build-sample-env-file.js";
|
|
22
|
+
import { buildTestBrowserTsConfig, buildTestNodeTsConfig } from "./metadata/build-test-config.js";
|
|
23
|
+
import { buildTsConfig, buildTsLintConfig, buildTsSampleConfig, buildTsSnippetsConfig, buildTsSrcBrowserConfig, buildTsSrcCjsConfig, buildTsSrcEsmConfig, buildTsSrcReactNativeConfig, } from "./metadata/build-ts-config.js";
|
|
24
|
+
import { buildVitestConfig } from "./metadata/build-vitest-config.js";
|
|
25
|
+
import { buildWarpConfig } from "./metadata/build-warp-config.js";
|
|
26
|
+
import { buildRecordedClientFile } from "./metadata/test/build-recorded-client.js";
|
|
27
|
+
import { buildSampleTest } from "./metadata/test/build-sample-test.js";
|
|
28
|
+
import { buildSnippets } from "./metadata/test/build-snippets.js";
|
|
16
29
|
import { buildClassicalClient } from "./modular/build-classical-client.js";
|
|
17
30
|
import { buildClassicOperationFiles } from "./modular/build-classical-operation-groups.js";
|
|
18
31
|
import { buildClientContext, getClientContextPath } from "./modular/build-client-context.js";
|
|
@@ -28,9 +41,9 @@ import { emitSamples } from "./modular/emit-samples.js";
|
|
|
28
41
|
import { emitTests } from "./modular/emit-tests.js";
|
|
29
42
|
import { getClassicalClientName } from "./modular/helpers/naming-helpers.js";
|
|
30
43
|
import { packageUsesXmlSerialization } from "./modular/serialization/build-xml-serializer-function.js";
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import { getClientHierarchyMap,
|
|
44
|
+
import { transformClientOptions } from "./transform/transform-client-options.js";
|
|
45
|
+
import { transformClientModel } from "./transform/transform.js";
|
|
46
|
+
import { getClientHierarchyMap, getClientModuleInfo, getClients } from "./utils/client-utils.js";
|
|
34
47
|
import { generateCrossLanguageDefinitionFile } from "./utils/cross-language-def.js";
|
|
35
48
|
export * from "./lib.js";
|
|
36
49
|
export async function $onEmit(context) {
|
|
@@ -55,10 +68,8 @@ export async function $onEmit(context) {
|
|
|
55
68
|
}
|
|
56
69
|
// Enrich the dpg context with path detail and common options
|
|
57
70
|
await enrichDpgContext();
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
const serviceNameToRlcModelsMap = new Map();
|
|
61
|
-
provideContext("rlcMetaTree", new Map());
|
|
71
|
+
const resolvedEmitterOptions = dpgContext.emitterOptions ?? {};
|
|
72
|
+
provideContext("clientTypeMetaTree", new Map());
|
|
62
73
|
provideContext("symbolMap", new Map());
|
|
63
74
|
provideContext("outputProject", outputProject);
|
|
64
75
|
provideContext("emitContext", {
|
|
@@ -75,12 +86,12 @@ export async function $onEmit(context) {
|
|
|
75
86
|
...PlatformTypeHelpers,
|
|
76
87
|
...CloudSettingHelpers,
|
|
77
88
|
...XmlHelpers,
|
|
78
|
-
...(
|
|
79
|
-
...(
|
|
89
|
+
...(resolvedEmitterOptions.generateTest ? CreateRecorderHelpers : {}),
|
|
90
|
+
...(resolvedEmitterOptions.enableStorageCompat ? StorageCompatHelpers : {}),
|
|
80
91
|
}, {
|
|
81
|
-
sourcesDir: dpgContext.generationPathDetail?.
|
|
92
|
+
sourcesDir: dpgContext.generationPathDetail?.sourcesDir,
|
|
82
93
|
rootDir: dpgContext.generationPathDetail?.rootDir,
|
|
83
|
-
options:
|
|
94
|
+
options: resolvedEmitterOptions,
|
|
84
95
|
program,
|
|
85
96
|
host,
|
|
86
97
|
packageRoot: emitterPackageRoot,
|
|
@@ -99,18 +110,14 @@ export async function $onEmit(context) {
|
|
|
99
110
|
useSubpathImports: true,
|
|
100
111
|
});
|
|
101
112
|
provideSdkTypes(dpgContext);
|
|
102
|
-
const rlcCodeModels = [];
|
|
103
113
|
let modularEmitterOptions;
|
|
104
114
|
// 1. Clear sources folder
|
|
105
115
|
await clearSrcFolder();
|
|
106
|
-
// 2.
|
|
107
|
-
// TODO: skip this step in modular once modular generator is sufficiently decoupled
|
|
108
|
-
await buildRLCCodeModels();
|
|
109
|
-
// 3. Clear samples-dev folder if generateSample is true
|
|
116
|
+
// 2. Clear samples-dev folder if generateSample is true
|
|
110
117
|
await clearSamplesDevFolder();
|
|
111
|
-
//
|
|
112
|
-
await
|
|
113
|
-
//
|
|
118
|
+
// 3. Generate sources
|
|
119
|
+
await generateSources();
|
|
120
|
+
// 4. Generate metadata and test files
|
|
114
121
|
function getTypespecTsVersion(context) {
|
|
115
122
|
const emitterMetadata = context.program.emitters.find((emitter) => emitter.metadata.name === "@azure-tools/typespec-ts");
|
|
116
123
|
return emitterMetadata?.metadata.version;
|
|
@@ -120,7 +127,7 @@ export async function $onEmit(context) {
|
|
|
120
127
|
const generationPathDetail = await calculateGenerationDir();
|
|
121
128
|
dpgContext.generationPathDetail = generationPathDetail;
|
|
122
129
|
dpgContext.allServiceNamespaces = listAllServiceNamespaces(dpgContext);
|
|
123
|
-
const options =
|
|
130
|
+
const options = transformClientOptions(emitterOptions, dpgContext);
|
|
124
131
|
emitterOptions["generate-sample"] = options.generateSample;
|
|
125
132
|
// clear output folder if needed
|
|
126
133
|
if (options.clearOutputFolder) {
|
|
@@ -131,7 +138,7 @@ export async function $onEmit(context) {
|
|
|
131
138
|
options.generateTest =
|
|
132
139
|
options.generateTest === true ||
|
|
133
140
|
(options.generateTest === undefined && (!hasTestFolder || options.azureArm));
|
|
134
|
-
dpgContext.
|
|
141
|
+
dpgContext.emitterOptions = options;
|
|
135
142
|
}
|
|
136
143
|
async function calculateGenerationDir() {
|
|
137
144
|
const projectRoot = context.emitterOutputDir ?? "";
|
|
@@ -147,14 +154,11 @@ export async function $onEmit(context) {
|
|
|
147
154
|
return {
|
|
148
155
|
rootDir: projectRoot,
|
|
149
156
|
metadataDir: projectRoot,
|
|
150
|
-
|
|
151
|
-
modularSourcesDir: sourcesRoot,
|
|
157
|
+
sourcesDir: sourcesRoot,
|
|
152
158
|
};
|
|
153
159
|
}
|
|
154
160
|
async function clearSrcFolder() {
|
|
155
|
-
await emptyDir(host, dpgContext.generationPathDetail?.
|
|
156
|
-
dpgContext.generationPathDetail?.rlcSourcesDir ??
|
|
157
|
-
"");
|
|
161
|
+
await emptyDir(host, dpgContext.generationPathDetail?.sourcesDir ?? "");
|
|
158
162
|
}
|
|
159
163
|
async function clearSamplesDevFolder() {
|
|
160
164
|
if (emitterOptions["generate-sample"] === true) {
|
|
@@ -164,28 +168,26 @@ export async function $onEmit(context) {
|
|
|
164
168
|
}
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
|
-
async function
|
|
168
|
-
const
|
|
171
|
+
async function buildClientCodeModels() {
|
|
172
|
+
const models = [];
|
|
173
|
+
const clients = getClients(dpgContext);
|
|
169
174
|
for (const client of clients) {
|
|
170
|
-
|
|
171
|
-
rlcCodeModels.push(rlcModels);
|
|
172
|
-
const serviceName = client.services[0]?.name ?? "Unknown";
|
|
173
|
-
serviceNameToRlcModelsMap.set(serviceName, rlcModels);
|
|
174
|
-
needUnexpectedHelper.set(getClientName(rlcModels), hasUnexpectedHelper(rlcModels));
|
|
175
|
+
models.push(await transformClientModel(client, dpgContext));
|
|
175
176
|
}
|
|
177
|
+
return models;
|
|
176
178
|
}
|
|
177
|
-
async function
|
|
178
|
-
const
|
|
179
|
+
async function generateSources() {
|
|
180
|
+
const sourcesRoot = dpgContext.generationPathDetail?.sourcesDir ?? "src";
|
|
179
181
|
const project = useContext("outputProject");
|
|
180
|
-
modularEmitterOptions = transformModularEmitterOptions(dpgContext,
|
|
182
|
+
modularEmitterOptions = transformModularEmitterOptions(dpgContext, sourcesRoot, {
|
|
181
183
|
casing: "camel",
|
|
182
184
|
});
|
|
183
|
-
emitLoggerFile(modularEmitterOptions,
|
|
184
|
-
const rootIndexFile = project.createSourceFile(`${
|
|
185
|
+
emitLoggerFile(modularEmitterOptions, sourcesRoot);
|
|
186
|
+
const rootIndexFile = project.createSourceFile(`${sourcesRoot}/index.ts`, "", {
|
|
185
187
|
overwrite: true,
|
|
186
188
|
});
|
|
187
|
-
emitTypes(dpgContext, { sourceRoot:
|
|
188
|
-
emitNonModelResponseTypes(dpgContext, { sourceRoot:
|
|
189
|
+
emitTypes(dpgContext, { sourceRoot: sourcesRoot });
|
|
190
|
+
emitNonModelResponseTypes(dpgContext, { sourceRoot: sourcesRoot });
|
|
189
191
|
buildSubpathIndexFile(modularEmitterOptions, "models", undefined, {
|
|
190
192
|
recursive: true,
|
|
191
193
|
});
|
|
@@ -200,7 +202,7 @@ export async function $onEmit(context) {
|
|
|
200
202
|
buildOperationFiles(dpgContext, subClient, modularEmitterOptions);
|
|
201
203
|
buildClientContext(dpgContext, subClient, modularEmitterOptions);
|
|
202
204
|
buildRestorePoller(dpgContext, subClient, modularEmitterOptions);
|
|
203
|
-
if (dpgContext.
|
|
205
|
+
if (dpgContext.emitterOptions?.hierarchyClient) {
|
|
204
206
|
buildSubpathIndexFile(modularEmitterOptions, "api", subClient, {
|
|
205
207
|
exportIndex: false,
|
|
206
208
|
recursive: true,
|
|
@@ -218,23 +220,23 @@ export async function $onEmit(context) {
|
|
|
218
220
|
exportIndex: true,
|
|
219
221
|
interfaceOnly: true,
|
|
220
222
|
});
|
|
221
|
-
const { subfolder } =
|
|
223
|
+
const { subfolder } = getClientModuleInfo(subClient);
|
|
222
224
|
// Generate index file for clients with subfolders (multi-client scenarios and nested clients)
|
|
223
225
|
if (subfolder) {
|
|
224
226
|
buildSubClientIndexFile(dpgContext, subClient, modularEmitterOptions);
|
|
225
227
|
}
|
|
226
228
|
buildRootIndex(dpgContext, modularEmitterOptions, rootIndexFile, subClient);
|
|
227
229
|
}
|
|
228
|
-
//
|
|
230
|
+
// Sample generation is enabled only when the modular generator actually emits
|
|
231
|
+
// samples. Reset the baseline here, then re-enable it below if any are emitted.
|
|
232
|
+
dpgContext.emitterOptions.generateSample = false;
|
|
229
233
|
if (emitterOptions["generate-sample"] === true) {
|
|
230
234
|
const samples = emitSamples(dpgContext);
|
|
231
|
-
// Refine the rlc sample generation logic
|
|
232
|
-
// TODO: remember to remove this out when RLC is splitted from Modular
|
|
233
235
|
if (samples.length > 0) {
|
|
234
|
-
dpgContext.
|
|
236
|
+
dpgContext.emitterOptions.generateSample = true;
|
|
235
237
|
}
|
|
236
238
|
}
|
|
237
|
-
binder.resolveAllReferences(
|
|
239
|
+
binder.resolveAllReferences(sourcesRoot, dpgContext.generationPathDetail?.rootDir);
|
|
238
240
|
if (program.compilerOptions.noEmit || program.hasError()) {
|
|
239
241
|
return;
|
|
240
242
|
}
|
|
@@ -263,17 +265,18 @@ export async function $onEmit(context) {
|
|
|
263
265
|
}
|
|
264
266
|
async function generateMetadataAndTest(context) {
|
|
265
267
|
const project = useContext("outputProject");
|
|
266
|
-
|
|
268
|
+
const clientCodeModels = await buildClientCodeModels();
|
|
269
|
+
if (clientCodeModels.length === 0 || !clientCodeModels[0]) {
|
|
267
270
|
return;
|
|
268
271
|
}
|
|
269
|
-
const
|
|
270
|
-
const option = dpgContext.
|
|
272
|
+
const clientModel = clientCodeModels[0];
|
|
273
|
+
const option = dpgContext.emitterOptions;
|
|
271
274
|
// When generateMetadata is explicitly false and the sources are generated
|
|
272
275
|
// into a path ending with "generated" (e.g. src/generated), this package
|
|
273
276
|
// has a manual convenience layer. Skip all metadata/test file generation
|
|
274
277
|
// to avoid unexpected modifications to files like package.json, README.md,
|
|
275
278
|
// warp.config.yml, and snippets.spec.ts. metadata.json is still updated.
|
|
276
|
-
const sourcesDir = dpgContext.generationPathDetail?.
|
|
279
|
+
const sourcesDir = dpgContext.generationPathDetail?.sourcesDir ?? "";
|
|
277
280
|
const hasManualConvenienceLayer = getBaseFileName(sourcesDir) === "generated";
|
|
278
281
|
// Generate metadata
|
|
279
282
|
const existingPackageFilePath = joinPaths(dpgContext.generationPathDetail?.metadataDir ?? "", "package.json");
|
|
@@ -295,7 +298,7 @@ export async function $onEmit(context) {
|
|
|
295
298
|
}
|
|
296
299
|
//TODO Need consider multi-client cases
|
|
297
300
|
for (const subClient of dpgContext.sdkPackage.clients) {
|
|
298
|
-
|
|
301
|
+
clientModel.libraryName = subClient.name;
|
|
299
302
|
}
|
|
300
303
|
if (shouldGenerateMetadata) {
|
|
301
304
|
const commonBuilders = [
|
|
@@ -357,7 +360,7 @@ export async function $onEmit(context) {
|
|
|
357
360
|
commonBuilders.push(buildTsSnippetsConfig);
|
|
358
361
|
}
|
|
359
362
|
// build metadata relevant files
|
|
360
|
-
await emitContentByBuilder(program, commonBuilders,
|
|
363
|
+
await emitContentByBuilder(program, commonBuilders, clientModel, dpgContext.generationPathDetail?.metadataDir);
|
|
361
364
|
for (const file of project.getSourceFiles()) {
|
|
362
365
|
await emitContentByBuilder(program, () => ({ content: file.getFullText(), path: file.getFilePath() }), modularEmitterOptions);
|
|
363
366
|
}
|
|
@@ -378,8 +381,8 @@ export async function $onEmit(context) {
|
|
|
378
381
|
dependencies: additionalDependencies,
|
|
379
382
|
}),
|
|
380
383
|
};
|
|
381
|
-
// Always update package.json (adds #platform/* imports)
|
|
382
|
-
//
|
|
384
|
+
// Always update package.json (adds #platform/* imports) along with
|
|
385
|
+
// exports, clientContextPaths and LRO deps.
|
|
383
386
|
{
|
|
384
387
|
// Read package.json content via host and pass parsed object
|
|
385
388
|
const pkgSourceFile = await host.readFile(existingPackageFilePath);
|
|
@@ -399,7 +402,7 @@ export async function $onEmit(context) {
|
|
|
399
402
|
if (hasReadmeFile) {
|
|
400
403
|
const readmeSourceFile = await host.readFile(existingReadmeFilePath);
|
|
401
404
|
const existingReadmeContent = readmeSourceFile.text;
|
|
402
|
-
const clientNameChanged = hasClientNameChanged(
|
|
405
|
+
const clientNameChanged = hasClientNameChanged(clientModel, existingReadmeContent);
|
|
403
406
|
updateBuilders.push(clientNameChanged
|
|
404
407
|
? buildReadmeFile
|
|
405
408
|
: (model) => updateReadmeFile(model, existingReadmeContent));
|
|
@@ -411,12 +414,12 @@ export async function $onEmit(context) {
|
|
|
411
414
|
}
|
|
412
415
|
}
|
|
413
416
|
// update metadata relevant files
|
|
414
|
-
await emitContentByBuilder(program, updateBuilders,
|
|
417
|
+
await emitContentByBuilder(program, updateBuilders, clientModel, dpgContext.generationPathDetail?.metadataDir);
|
|
415
418
|
}
|
|
416
|
-
await emitContentByBuilder(program, buildMetadataJson,
|
|
419
|
+
await emitContentByBuilder(program, buildMetadataJson, clientModel, dpgContext.generationPathDetail?.metadataDir);
|
|
417
420
|
// Generate test relevant files
|
|
418
421
|
if (option.generateTest && !hasTestFolder) {
|
|
419
|
-
await emitContentByBuilder(program, [buildRecordedClientFile, buildSampleTest],
|
|
422
|
+
await emitContentByBuilder(program, [buildRecordedClientFile, buildSampleTest], clientModel, dpgContext.generationPathDetail?.metadataDir);
|
|
420
423
|
}
|
|
421
424
|
}
|
|
422
425
|
function getRelativeContextPaths(context, options) {
|