@azure-tools/typespec-ts 0.56.0-dev.14 → 0.56.0-dev.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +8 -9
- package/dist/src/context-manager.d.ts +6 -6
- package/dist/src/context-manager.d.ts.map +1 -1
- package/dist/src/context-manager.js +1 -0
- package/dist/src/context-manager.js.map +1 -1
- package/dist/src/framework/declaration.d.ts +1 -1
- package/dist/src/framework/declaration.d.ts.map +1 -1
- package/dist/src/framework/declaration.js +2 -1
- package/dist/src/framework/declaration.js.map +1 -1
- package/dist/src/framework/hooks/binder.d.ts +2 -5
- package/dist/src/framework/hooks/binder.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.js +2 -29
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdk-types.d.ts +3 -3
- package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdk-types.js.map +1 -1
- package/dist/src/framework/hooks/use-dependencies.d.ts +1 -1
- package/dist/src/framework/hooks/use-dependencies.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.d.ts +2 -2
- package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.js +1 -13
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/framework/reference.js.map +1 -1
- package/dist/src/framework/source-file-batch.d.ts +1 -1
- package/dist/src/framework/source-file-batch.d.ts.map +1 -1
- package/dist/src/framework/source-file-batch.js +1 -1
- package/dist/src/framework/source-file-batch.js.map +1 -1
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +14 -17
- package/dist/src/index.js.map +1 -1
- package/dist/src/interfaces.d.ts +0 -1
- package/dist/src/interfaces.d.ts.map +1 -1
- package/dist/src/lib.d.ts +3 -3
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +0 -1
- package/dist/src/lib.js.map +1 -1
- package/dist/src/meta-tree.d.ts +2 -2
- package/dist/src/meta-tree.d.ts.map +1 -1
- package/dist/src/metadata/build-api-extractor-config.d.ts +1 -1
- package/dist/src/metadata/build-api-extractor-config.d.ts.map +1 -1
- package/dist/src/metadata/build-changelog-file.d.ts +1 -1
- package/dist/src/metadata/build-changelog-file.d.ts.map +1 -1
- package/dist/src/metadata/build-es-lint-config.d.ts +1 -1
- package/dist/src/metadata/build-es-lint-config.d.ts.map +1 -1
- package/dist/src/metadata/build-package-file.d.ts +3 -5
- package/dist/src/metadata/build-package-file.d.ts.map +1 -1
- package/dist/src/metadata/build-package-file.js +10 -45
- package/dist/src/metadata/build-package-file.js.map +1 -1
- package/dist/src/metadata/build-readme-file.d.ts +1 -1
- package/dist/src/metadata/build-readme-file.d.ts.map +1 -1
- package/dist/src/metadata/build-readme-file.js +3 -3
- package/dist/src/metadata/build-readme-file.js.map +1 -1
- package/dist/src/metadata/build-sample-env-file.d.ts +1 -1
- package/dist/src/metadata/build-sample-env-file.d.ts.map +1 -1
- package/dist/src/metadata/build-test-config.d.ts +1 -1
- package/dist/src/metadata/build-test-config.d.ts.map +1 -1
- package/dist/src/metadata/build-ts-config.d.ts +11 -5
- package/dist/src/metadata/build-ts-config.d.ts.map +1 -1
- package/dist/src/metadata/build-ts-config.js +36 -8
- package/dist/src/metadata/build-ts-config.js.map +1 -1
- package/dist/src/metadata/build-vitest-config.d.ts +1 -1
- package/dist/src/metadata/build-vitest-config.d.ts.map +1 -1
- package/dist/src/metadata/build-warp-config.d.ts +1 -3
- package/dist/src/metadata/build-warp-config.d.ts.map +1 -1
- package/dist/src/metadata/build-warp-config.js +0 -2
- package/dist/src/metadata/build-warp-config.js.map +1 -1
- package/dist/src/metadata/package-json/azure-package-common.d.ts +1 -1
- package/dist/src/metadata/package-json/azure-package-common.d.ts.map +1 -1
- package/dist/src/metadata/package-json/build-azure-monorepo-package.d.ts +1 -2
- package/dist/src/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -1
- package/dist/src/metadata/package-json/build-azure-monorepo-package.js +2 -16
- package/dist/src/metadata/package-json/build-azure-monorepo-package.js.map +1 -1
- package/dist/src/metadata/package-json/package-common.d.ts.map +1 -1
- package/dist/src/metadata/package-json/package-common.js +0 -15
- package/dist/src/metadata/package-json/package-common.js.map +1 -1
- package/dist/src/metadata/test/build-recorded-client.d.ts +1 -1
- package/dist/src/metadata/test/build-recorded-client.d.ts.map +1 -1
- package/dist/src/metadata/test/build-sample-test.d.ts +1 -1
- package/dist/src/metadata/test/build-sample-test.d.ts.map +1 -1
- package/dist/src/metadata/test/build-snippets.d.ts +1 -1
- package/dist/src/metadata/test/build-snippets.d.ts.map +1 -1
- package/dist/src/metadata/utils.d.ts +1 -1
- package/dist/src/metadata/utils.d.ts.map +1 -1
- package/dist/src/modular/build-classical-client.d.ts +3 -3
- package/dist/src/modular/build-classical-client.d.ts.map +1 -1
- package/dist/src/modular/build-classical-client.js +1 -1
- package/dist/src/modular/build-classical-client.js.map +1 -1
- package/dist/src/modular/build-classical-operation-groups.d.ts +3 -3
- package/dist/src/modular/build-classical-operation-groups.d.ts.map +1 -1
- package/dist/src/modular/build-classical-operation-groups.js +1 -0
- package/dist/src/modular/build-classical-operation-groups.js.map +1 -1
- package/dist/src/modular/build-client-context.d.ts +3 -3
- package/dist/src/modular/build-client-context.d.ts.map +1 -1
- package/dist/src/modular/build-client-context.js +1 -0
- package/dist/src/modular/build-client-context.js.map +1 -1
- package/dist/src/modular/build-modular-options.d.ts +2 -2
- package/dist/src/modular/build-modular-options.d.ts.map +1 -1
- package/dist/src/modular/build-operations.d.ts +5 -5
- package/dist/src/modular/build-operations.d.ts.map +1 -1
- package/dist/src/modular/build-operations.js +7 -4
- package/dist/src/modular/build-operations.js.map +1 -1
- package/dist/src/modular/build-project-files.d.ts +2 -2
- package/dist/src/modular/build-project-files.d.ts.map +1 -1
- package/dist/src/modular/build-restore-poller.d.ts +3 -3
- package/dist/src/modular/build-restore-poller.d.ts.map +1 -1
- package/dist/src/modular/build-restore-poller.js +1 -0
- package/dist/src/modular/build-restore-poller.js.map +1 -1
- package/dist/src/modular/build-root-index.d.ts +3 -3
- package/dist/src/modular/build-root-index.d.ts.map +1 -1
- package/dist/src/modular/build-root-index.js +4 -3
- package/dist/src/modular/build-root-index.js.map +1 -1
- package/dist/src/modular/build-subpath-index.d.ts +2 -2
- package/dist/src/modular/build-subpath-index.d.ts.map +1 -1
- package/dist/src/modular/build-subpath-index.js +1 -1
- package/dist/src/modular/build-subpath-index.js.map +1 -1
- package/dist/src/modular/emit-logger-file.d.ts +1 -1
- package/dist/src/modular/emit-logger-file.d.ts.map +1 -1
- package/dist/src/modular/emit-models-options.d.ts +3 -3
- package/dist/src/modular/emit-models-options.d.ts.map +1 -1
- package/dist/src/modular/emit-models-options.js.map +1 -1
- package/dist/src/modular/emit-models.d.ts +3 -3
- package/dist/src/modular/emit-models.d.ts.map +1 -1
- package/dist/src/modular/emit-models.js +1 -1
- package/dist/src/modular/emit-models.js.map +1 -1
- package/dist/src/modular/emit-samples.d.ts +1 -1
- package/dist/src/modular/emit-samples.d.ts.map +1 -1
- package/dist/src/modular/emit-samples.js +1 -1
- package/dist/src/modular/emit-samples.js.map +1 -1
- package/dist/src/modular/emit-tests.d.ts +1 -1
- package/dist/src/modular/emit-tests.d.ts.map +1 -1
- package/dist/src/modular/emit-tests.js +1 -0
- package/dist/src/modular/emit-tests.js.map +1 -1
- package/dist/src/modular/external-dependencies.d.ts +1 -1
- package/dist/src/modular/external-dependencies.d.ts.map +1 -1
- package/dist/src/modular/external-dependencies.js +10 -0
- package/dist/src/modular/external-dependencies.js.map +1 -1
- package/dist/src/modular/helpers/classical-operation-helpers.d.ts +3 -3
- package/dist/src/modular/helpers/classical-operation-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/classical-operation-helpers.js +1 -1
- package/dist/src/modular/helpers/classical-operation-helpers.js.map +1 -1
- package/dist/src/modular/helpers/client-helpers.d.ts +6 -6
- package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/client-helpers.js +24 -7
- package/dist/src/modular/helpers/client-helpers.js.map +1 -1
- package/dist/src/modular/helpers/client-option-helpers.d.ts +1 -1
- package/dist/src/modular/helpers/client-option-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.d.ts +3 -3
- package/dist/src/modular/helpers/example-value-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.js +1 -0
- package/dist/src/modular/helpers/example-value-helpers.js.map +1 -1
- package/dist/src/modular/helpers/naming-helpers.d.ts +7 -4
- package/dist/src/modular/helpers/naming-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/naming-helpers.js +44 -5
- package/dist/src/modular/helpers/naming-helpers.js.map +1 -1
- package/dist/src/modular/helpers/operation-helpers.d.ts +7 -7
- package/dist/src/modular/helpers/operation-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operation-helpers.js +24 -21
- package/dist/src/modular/helpers/operation-helpers.js.map +1 -1
- package/dist/src/modular/helpers/type-helpers.d.ts +3 -3
- package/dist/src/modular/helpers/type-helpers.d.ts.map +1 -1
- package/dist/src/modular/interfaces.d.ts +1 -1
- package/dist/src/modular/interfaces.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-deserializer-function.d.ts +4 -4
- package/dist/src/modular/serialization/build-deserializer-function.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-deserializer-function.js.map +1 -1
- package/dist/src/modular/serialization/build-serializer-function.d.ts +4 -4
- package/dist/src/modular/serialization/build-serializer-function.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-serializer-function.js.map +1 -1
- package/dist/src/modular/serialization/build-xml-serializer-function.d.ts +4 -4
- package/dist/src/modular/serialization/build-xml-serializer-function.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-xml-serializer-function.js.map +1 -1
- package/dist/src/modular/serialization/serialize-utils.d.ts +1 -1
- package/dist/src/modular/serialization/serialize-utils.d.ts.map +1 -1
- package/dist/src/modular/static-helpers-metadata.d.ts +0 -12
- package/dist/src/modular/static-helpers-metadata.d.ts.map +1 -1
- package/dist/src/modular/static-helpers-metadata.js +0 -12
- package/dist/src/modular/static-helpers-metadata.js.map +1 -1
- package/dist/src/modular/type-expressions/get-credential-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-credential-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts +3 -3
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.d.ts +3 -3
- package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts +3 -3
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts.map +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 +2 -2
- package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.d.ts +3 -3
- package/dist/src/modular/type-expressions/get-union-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/utils.d.ts +1 -1
- package/dist/src/modular/type-expressions/utils.d.ts.map +1 -1
- package/dist/src/transform/transform-api-version-info.d.ts +3 -3
- package/dist/src/transform/transform-api-version-info.d.ts.map +1 -1
- package/dist/src/transform/transform-api-version-info.js +1 -1
- package/dist/src/transform/transform-api-version-info.js.map +1 -1
- package/dist/src/transform/transform-client-options.d.ts +4 -4
- package/dist/src/transform/transform-client-options.d.ts.map +1 -1
- package/dist/src/transform/transform-client-options.js +1 -3
- package/dist/src/transform/transform-client-options.js.map +1 -1
- package/dist/src/transform/transform-helper-function-details.d.ts +3 -3
- package/dist/src/transform/transform-helper-function-details.d.ts.map +1 -1
- package/dist/src/transform/transform-helper-function-details.js +1 -1
- package/dist/src/transform/transform-helper-function-details.js.map +1 -1
- package/dist/src/transform/transform-parameters.d.ts +4 -4
- package/dist/src/transform/transform-parameters.d.ts.map +1 -1
- package/dist/src/transform/transform-parameters.js.map +1 -1
- package/dist/src/transform/transform-paths.d.ts +3 -3
- package/dist/src/transform/transform-paths.d.ts.map +1 -1
- package/dist/src/transform/transform-paths.js +1 -1
- package/dist/src/transform/transform-paths.js.map +1 -1
- package/dist/src/transform/transform-responses.d.ts +3 -3
- package/dist/src/transform/transform-responses.d.ts.map +1 -1
- package/dist/src/transform/transform-responses.js +1 -1
- package/dist/src/transform/transform-responses.js.map +1 -1
- package/dist/src/transform/transform-schemas.d.ts +2 -2
- package/dist/src/transform/transform-schemas.d.ts.map +1 -1
- package/dist/src/transform/transform-schemas.js +2 -2
- package/dist/src/transform/transform-schemas.js.map +1 -1
- package/dist/src/transform/transform-telemetry-info.d.ts +2 -2
- package/dist/src/transform/transform-telemetry-info.d.ts.map +1 -1
- package/dist/src/transform/transform.d.ts +3 -3
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/utils/api-version-util.d.ts +1 -1
- package/dist/src/utils/api-version-util.d.ts.map +1 -1
- package/dist/src/utils/client-utils.d.ts +4 -4
- package/dist/src/utils/client-utils.d.ts.map +1 -1
- package/dist/src/utils/credential-utils.d.ts +3 -3
- package/dist/src/utils/credential-utils.d.ts.map +1 -1
- package/dist/src/utils/credential-utils.js.map +1 -1
- package/dist/src/utils/cross-language-def.d.ts +1 -1
- package/dist/src/utils/cross-language-def.d.ts.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/file-system-utils.d.ts +1 -1
- package/dist/src/utils/file-system-utils.d.ts.map +1 -1
- package/dist/src/utils/file-system-utils.js.map +1 -1
- package/dist/src/utils/import-helper.js +1 -0
- package/dist/src/utils/import-helper.js.map +1 -1
- package/dist/src/utils/imports-util.d.ts +1 -1
- package/dist/src/utils/imports-util.d.ts.map +1 -1
- package/dist/src/utils/imports-util.js +2 -1
- package/dist/src/utils/imports-util.js.map +1 -1
- package/dist/src/utils/interfaces.d.ts +3 -3
- package/dist/src/utils/interfaces.d.ts.map +1 -1
- package/dist/src/utils/interfaces.js +2 -1
- package/dist/src/utils/interfaces.js.map +1 -1
- package/dist/src/utils/model-utils.d.ts +4 -4
- package/dist/src/utils/model-utils.d.ts.map +1 -1
- package/dist/src/utils/name-constructors.d.ts +1 -1
- package/dist/src/utils/name-constructors.d.ts.map +1 -1
- package/dist/src/utils/namespace-utils.d.ts +2 -2
- package/dist/src/utils/namespace-utils.d.ts.map +1 -1
- package/dist/src/utils/namespace-utils.js +1 -1
- package/dist/src/utils/namespace-utils.js.map +1 -1
- package/dist/src/utils/operation-helpers.d.ts +2 -2
- package/dist/src/utils/operation-helpers.d.ts.map +1 -1
- package/dist/src/utils/operation-helpers.js.map +1 -1
- package/dist/src/utils/operation-util.d.ts +5 -5
- package/dist/src/utils/operation-util.d.ts.map +1 -1
- package/dist/src/utils/operation-util.js +1 -1
- package/dist/src/utils/operation-util.js.map +1 -1
- package/dist/src/utils/parameter-utils.d.ts +3 -3
- package/dist/src/utils/parameter-utils.d.ts.map +1 -1
- package/dist/src/utils/parameter-utils.js.map +1 -1
- package/dist/src/utils/schema-helpers.d.ts +1 -1
- package/dist/src/utils/schema-helpers.d.ts.map +1 -1
- package/dist/src/utils/schema-helpers.js +1 -1
- package/dist/src/utils/schema-helpers.js.map +1 -1
- package/dist/src/utils/type-util.d.ts +1 -1
- package/dist/src/utils/type-util.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +41 -38
- package/src/context-manager.ts +6 -6
- package/src/framework/declaration.ts +7 -6
- package/src/framework/hooks/binder.ts +5 -33
- package/src/framework/hooks/sdk-types.ts +8 -8
- package/src/framework/hooks/use-dependencies.ts +1 -1
- package/src/framework/load-static-helpers.ts +3 -18
- package/src/framework/reference.ts +2 -2
- package/src/framework/sample.ts +2 -2
- package/src/framework/source-file-batch.ts +2 -2
- package/src/index.ts +23 -27
- package/src/interfaces.ts +0 -1
- package/src/lib.ts +3 -4
- package/src/meta-tree.ts +2 -2
- package/src/metadata/build-api-extractor-config.ts +1 -1
- package/src/metadata/build-changelog-file.ts +1 -1
- package/src/metadata/build-es-lint-config.ts +1 -1
- package/src/metadata/build-package-file.ts +11 -49
- package/src/metadata/build-readme-file.ts +4 -4
- package/src/metadata/build-sample-env-file.ts +1 -1
- package/src/metadata/build-test-config.ts +1 -1
- package/src/metadata/build-ts-config.ts +38 -9
- package/src/metadata/build-vitest-config.ts +1 -1
- package/src/metadata/build-warp-config.ts +1 -3
- package/src/metadata/package-json/azure-package-common.ts +1 -1
- package/src/metadata/package-json/build-azure-monorepo-package.ts +3 -20
- package/src/metadata/package-json/package-common.ts +0 -15
- package/src/metadata/test/build-recorded-client.ts +1 -1
- package/src/metadata/test/build-sample-test.ts +1 -1
- package/src/metadata/test/build-snippets.ts +1 -1
- package/src/metadata/utils.ts +1 -1
- package/src/modular/build-classical-client.ts +6 -6
- package/src/modular/build-classical-operation-groups.ts +6 -3
- package/src/modular/build-client-context.ts +3 -3
- package/src/modular/build-modular-options.ts +2 -2
- package/src/modular/build-operations.ts +12 -9
- package/src/modular/build-project-files.ts +2 -2
- package/src/modular/build-restore-poller.ts +6 -3
- package/src/modular/build-root-index.ts +9 -10
- package/src/modular/build-subpath-index.ts +5 -2
- package/src/modular/emit-logger-file.ts +1 -1
- package/src/modular/emit-models-options.ts +6 -3
- package/src/modular/emit-models.ts +23 -33
- package/src/modular/emit-samples.ts +11 -11
- package/src/modular/emit-tests.ts +3 -3
- package/src/modular/external-dependencies.ts +11 -1
- package/src/modular/helpers/classical-operation-helpers.ts +10 -7
- package/src/modular/helpers/client-helpers.ts +36 -19
- package/src/modular/helpers/client-option-helpers.ts +1 -1
- package/src/modular/helpers/example-value-helpers.ts +9 -9
- package/src/modular/helpers/naming-helpers.ts +55 -7
- package/src/modular/helpers/operation-helpers.ts +46 -44
- package/src/modular/helpers/type-helpers.ts +3 -3
- package/src/modular/interfaces.ts +1 -1
- package/src/modular/serialization/build-deserializer-function.ts +9 -9
- package/src/modular/serialization/build-serializer-function.ts +9 -9
- package/src/modular/serialization/build-xml-serializer-function.ts +7 -7
- package/src/modular/serialization/serialize-utils.ts +1 -1
- package/src/modular/static-helpers-metadata.ts +0 -13
- package/src/modular/type-expressions/get-credential-expression.ts +1 -1
- package/src/modular/type-expressions/get-enum-expression.ts +3 -3
- package/src/modular/type-expressions/get-model-expression.ts +3 -3
- package/src/modular/type-expressions/get-nullable-expression.ts +3 -3
- package/src/modular/type-expressions/get-type-expression.ts +2 -2
- package/src/modular/type-expressions/get-union-expression.ts +3 -3
- package/src/modular/type-expressions/utils.ts +1 -1
- package/src/transform/transform-api-version-info.ts +8 -3
- package/src/transform/transform-client-options.ts +5 -7
- package/src/transform/transform-helper-function-details.ts +6 -3
- package/src/transform/transform-parameters.ts +15 -11
- package/src/transform/transform-paths.ts +10 -4
- package/src/transform/transform-responses.ts +11 -8
- package/src/transform/transform-schemas.ts +7 -4
- package/src/transform/transform-telemetry-info.ts +3 -3
- package/src/transform/transform.ts +11 -11
- package/src/utils/api-version-util.ts +1 -1
- package/src/utils/client-utils.ts +8 -8
- package/src/utils/credential-utils.ts +3 -3
- package/src/utils/cross-language-def.ts +1 -1
- package/src/utils/emit-util.ts +9 -3
- package/src/utils/file-system-utils.ts +1 -1
- package/src/utils/imports-util.ts +2 -2
- package/src/utils/interfaces.ts +3 -3
- package/src/utils/model-utils.ts +23 -23
- package/src/utils/name-constructors.ts +1 -1
- package/src/utils/namespace-utils.ts +8 -2
- package/src/utils/operation-helpers.ts +11 -7
- package/src/utils/operation-util.ts +23 -16
- package/src/utils/parameter-utils.ts +4 -4
- package/src/utils/schema-helpers.ts +7 -1
- package/src/utils/type-util.ts +1 -1
- package/static/static-helpers/multipartHelpers.ts +2 -6
- package/static/static-helpers/platform-types-browser.mts +0 -5
- package/static/static-helpers/platform-types-react-native.mts +0 -5
- package/static/static-helpers/platform-types.ts +0 -7
- package/static/static-helpers/serialization/get-binary-stream-response-browser.mts +0 -22
- package/static/static-helpers/serialization/get-binary-stream-response-react-native.mts +0 -1
- package/static/static-helpers/serialization/get-binary-stream-response.ts +0 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-ts",
|
|
3
|
-
"version": "0.56.0-dev.
|
|
3
|
+
"version": "0.56.0-dev.15",
|
|
4
4
|
"description": "A TypeSpec emitter for TypeScript",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,50 +17,53 @@
|
|
|
17
17
|
"author": "Jose Heredia <joheredi@microsoft.com>",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@azure-rest/core-client": "^2.
|
|
21
|
-
"@
|
|
22
|
-
"@typespec
|
|
23
|
-
"@typespec
|
|
24
|
-
"@typespec
|
|
25
|
-
"@azure-tools/
|
|
26
|
-
"@azure-tools/typespec-autorest": "^0.69.1 || >=0.70.0-dev <0.70.0",
|
|
27
|
-
"@azure-tools/typespec-azure-core": "^0.69.0 || >=0.70.0-dev <0.70.0",
|
|
28
|
-
"@azure-tools/typespec-azure-resource-manager": "^0.69.2 || >=0.70.0-dev <0.70.0",
|
|
29
|
-
"@azure-tools/typespec-client-generator-core": "^0.69.2 || >=0.70.0-dev <0.70.0",
|
|
20
|
+
"@azure-rest/core-client": "^2.7.0",
|
|
21
|
+
"@azure-tools/azure-http-specs": "^0.1.0-alpha.43 || >= 0.1.0-alpha.44-dev.6",
|
|
22
|
+
"@azure-tools/typespec-autorest": "^0.70.1 || >= 0.71.0-dev.4",
|
|
23
|
+
"@azure-tools/typespec-azure-core": "^0.70.0 || >= 0.71.0-dev.7",
|
|
24
|
+
"@azure-tools/typespec-azure-resource-manager": "^0.70.0 || >= 0.71.0-dev.14",
|
|
25
|
+
"@azure-tools/typespec-client-generator-core": "^0.70.0 || >= 0.71.0-dev.13",
|
|
30
26
|
"@azure/abort-controller": "^2.1.2",
|
|
31
27
|
"@azure/core-auth": "^1.6.0",
|
|
32
28
|
"@azure/core-lro": "^3.1.0",
|
|
33
29
|
"@azure/core-paging": "^1.5.0",
|
|
34
|
-
"@azure/core-rest-pipeline": "^1.
|
|
30
|
+
"@azure/core-rest-pipeline": "^1.24.0",
|
|
35
31
|
"@azure/core-util": "^1.4.0",
|
|
36
32
|
"@azure/logger": "^1.0.4",
|
|
37
|
-
"@typespec/
|
|
38
|
-
"@typespec/http": "^1.13.0",
|
|
39
|
-
"@typespec/openapi": "^1.13.0",
|
|
40
|
-
"@typespec/rest": "^0.83.0 || >=0.84.0-dev <0.84.0",
|
|
41
|
-
"@typespec/versioning": "^0.83.0 || >=0.84.0-dev <0.84.0",
|
|
42
|
-
"@typespec/xml": "^0.83.0 || >=0.84.0-dev <0.84.0",
|
|
43
|
-
"@typespec/ts-http-runtime": "0.3.6",
|
|
33
|
+
"@typespec/ts-http-runtime": "0.3.7",
|
|
44
34
|
"cross-env": "^10.1.0",
|
|
45
|
-
"concurrently": "^10.0.
|
|
35
|
+
"concurrently": "^10.0.4",
|
|
46
36
|
"vitest": "^4.1.3",
|
|
47
|
-
"vite": "^8.
|
|
37
|
+
"vite": "^8.1.2",
|
|
48
38
|
"@vitest/coverage-v8": "^4.1.3",
|
|
49
39
|
"@microsoft/api-extractor": "^7.58.1",
|
|
50
|
-
"
|
|
40
|
+
"@types/pluralize": "^0.0.33",
|
|
41
|
+
"yaml": "^2.8.3",
|
|
42
|
+
"@azure-tools/spector-runner": "^0.1.0",
|
|
43
|
+
"@typespec/http-specs": "^0.1.0-alpha.40",
|
|
44
|
+
"@typespec/spector": "^0.1.0-alpha.27",
|
|
45
|
+
"@typespec/tspd": "^0.76.0",
|
|
46
|
+
"@typespec/compiler": "^1.14.0",
|
|
47
|
+
"@typespec/spec-api": "^0.1.0-alpha.15",
|
|
48
|
+
"@typespec/http": "^1.14.0",
|
|
49
|
+
"@typespec/versioning": "^0.84.0",
|
|
50
|
+
"@typespec/xml": "^0.84.0",
|
|
51
|
+
"@typespec/rest": "^0.84.0",
|
|
52
|
+
"@typespec/openapi": "^1.14.0"
|
|
51
53
|
},
|
|
52
54
|
"peerDependencies": {
|
|
53
|
-
"@azure-tools/typespec-azure-core": "^0.
|
|
54
|
-
"@azure-tools/typespec-client-generator-core": "^0.
|
|
55
|
-
"@typespec/compiler": "^1.
|
|
56
|
-
"@typespec/
|
|
57
|
-
"@typespec/
|
|
58
|
-
"@typespec/versioning": "^0.
|
|
59
|
-
"@typespec/xml": "^0.
|
|
55
|
+
"@azure-tools/typespec-azure-core": "^0.70.0 || >= 0.71.0-dev.7",
|
|
56
|
+
"@azure-tools/typespec-client-generator-core": "^0.70.0 || >= 0.71.0-dev.13",
|
|
57
|
+
"@typespec/compiler": "^1.14.0",
|
|
58
|
+
"@typespec/rest": "^0.84.0",
|
|
59
|
+
"@typespec/http": "^1.14.0",
|
|
60
|
+
"@typespec/versioning": "^0.84.0",
|
|
61
|
+
"@typespec/xml": "^0.84.0"
|
|
60
62
|
},
|
|
61
63
|
"dependencies": {
|
|
62
|
-
"fast-xml-parser": "^5.
|
|
63
|
-
"
|
|
64
|
+
"fast-xml-parser": "^5.10.1",
|
|
65
|
+
"pluralize": "^8.0.0",
|
|
66
|
+
"prettier": "^3.9.5",
|
|
64
67
|
"ts-morph": "^23.0.0",
|
|
65
68
|
"tslib": "^2.3.1"
|
|
66
69
|
},
|
|
@@ -85,23 +88,23 @@
|
|
|
85
88
|
"test-next:coverage": "vitest run --project test-next --coverage",
|
|
86
89
|
"clean": "rimraf ./dist ./typespec-output",
|
|
87
90
|
"build": "tsc -p .",
|
|
88
|
-
"test": "
|
|
91
|
+
"test": "pnpm test-next && pnpm unit-test && pnpm integration-test-ci",
|
|
89
92
|
"lint": "oxlint . --deny-warnings",
|
|
90
93
|
"lint:fix": "oxlint . --fix",
|
|
91
94
|
"check:tree": "node ./test/commands/check-clean-tree.ts",
|
|
92
|
-
"integration-test-ci": "
|
|
93
|
-
"spector-test": "concurrently --kill-others --success first \"
|
|
95
|
+
"integration-test-ci": "pnpm copy:typespec && pnpm spector-test",
|
|
96
|
+
"spector-test": "concurrently --kill-others --success first \"pnpm start-test-server\" \"pnpm generate-and-run\"",
|
|
94
97
|
"start-test-server": "node ./test/commands/start-test-server.js",
|
|
95
98
|
"copy:typespec": "node ./test/commands/copy-typespec.ts",
|
|
96
|
-
"generate-and-run": "
|
|
99
|
+
"generate-and-run": "pnpm generate-tsp-only:client && concurrently --kill-others-on-fail \"pnpm integration-test:alone\" \"pnpm generate-tsp-only:declarations\" && pnpm stop-test-server",
|
|
97
100
|
"generate-tsp-only": "node ./test/commands/gen-spector.js",
|
|
98
101
|
"generate-tsp-only:client": "node ./test/commands/gen-spector.js --phase=client",
|
|
99
102
|
"generate-tsp-only:declarations": "node ./test/commands/gen-spector.js --phase=declarations",
|
|
100
|
-
"regen-test-baselines": "
|
|
103
|
+
"regen-test-baselines": "pnpm generate-tsp-only",
|
|
101
104
|
"integration-test:alone": "vitest run --project integration-azure-modular",
|
|
102
|
-
"stop-test-server": "
|
|
105
|
+
"stop-test-server": "pnpm exec tsp-spector server stop -p 3002",
|
|
103
106
|
"unit-test": "cross-env NODE_OPTIONS=--max-old-space-size=1024 vitest run --project unit-modular",
|
|
104
107
|
"gen:scenario-suites": "node ./test/commands/gen-scenario-suites.ts",
|
|
105
|
-
"regen-docs": "
|
|
108
|
+
"regen-docs": "pnpm build && tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/emitters/clients/typespec-ts/reference --skip-js"
|
|
106
109
|
}
|
|
107
110
|
}
|
package/src/context-manager.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SdkContext } from "@azure-tools/typespec-client-generator-core";
|
|
2
|
-
import { EmitContext } from "@typespec/compiler";
|
|
1
|
+
import type { SdkContext } from "@azure-tools/typespec-client-generator-core";
|
|
2
|
+
import type { EmitContext } from "@typespec/compiler";
|
|
3
3
|
import { Project, SourceFile } from "ts-morph";
|
|
4
|
-
import { ExternalDependencies } from "./framework/dependency.js";
|
|
5
|
-
import { Binder } from "./framework/hooks/binder.js";
|
|
6
|
-
import { SdkTypeContext } from "./framework/hooks/sdk-types.js";
|
|
7
|
-
import { ClientTypeMetaTree } from "./meta-tree.js";
|
|
4
|
+
import type { ExternalDependencies } from "./framework/dependency.js";
|
|
5
|
+
import type { Binder } from "./framework/hooks/binder.js";
|
|
6
|
+
import type { SdkTypeContext } from "./framework/hooks/sdk-types.js";
|
|
7
|
+
import type { ClientTypeMetaTree } from "./meta-tree.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Contexts Object Guidelines
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ClassDeclaration,
|
|
3
|
-
ClassDeclarationStructure,
|
|
3
|
+
type ClassDeclarationStructure,
|
|
4
4
|
EnumDeclaration,
|
|
5
|
-
EnumDeclarationStructure,
|
|
5
|
+
type EnumDeclarationStructure,
|
|
6
6
|
FunctionDeclaration,
|
|
7
|
-
FunctionDeclarationStructure,
|
|
7
|
+
type FunctionDeclarationStructure,
|
|
8
8
|
InterfaceDeclaration,
|
|
9
|
-
InterfaceDeclarationStructure,
|
|
9
|
+
type InterfaceDeclarationStructure,
|
|
10
10
|
SourceFile,
|
|
11
|
-
StatementStructures,
|
|
11
|
+
type StatementStructures,
|
|
12
12
|
StructureKind,
|
|
13
13
|
TypeAliasDeclaration,
|
|
14
|
-
TypeAliasDeclarationStructure,
|
|
14
|
+
type TypeAliasDeclarationStructure,
|
|
15
15
|
} from "ts-morph";
|
|
16
16
|
import { useBinder } from "./hooks/binder.js";
|
|
17
17
|
import { refkey as getRefKey } from "./refkey.js";
|
|
@@ -81,6 +81,7 @@ export function addDeclaration(
|
|
|
81
81
|
|
|
82
82
|
// Update the declaration name to be unique
|
|
83
83
|
const trackedDeclaration = { ...declaration, name: trackedDeclarationName };
|
|
84
|
+
trackedDeclaration.leadingTrivia ??= "\n";
|
|
84
85
|
|
|
85
86
|
// Skip empty type aliases (they have no body to emit). Done before
|
|
86
87
|
// dispatching so behaviour is identical whether batching or not.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { joinPaths, normalizePath } from "@typespec/compiler";
|
|
2
2
|
import {
|
|
3
|
-
ImportDeclarationStructure,
|
|
4
|
-
ImportSpecifierStructure,
|
|
3
|
+
type ImportDeclarationStructure,
|
|
4
|
+
type ImportSpecifierStructure,
|
|
5
5
|
Project,
|
|
6
6
|
SourceFile,
|
|
7
7
|
StructureKind,
|
|
8
8
|
} from "ts-morph";
|
|
9
9
|
import { provideContext, useContext } from "../../context-manager.js";
|
|
10
10
|
import { generateLocallyUniqueName } from "../../modular/helpers/naming-helpers.js";
|
|
11
|
-
import { ReferenceableSymbol } from "../dependency.js";
|
|
12
|
-
import { SourceFileSymbol, StaticHelperMetadata } from "../load-static-helpers.js";
|
|
11
|
+
import type { ReferenceableSymbol } from "../dependency.js";
|
|
12
|
+
import { SourceFileSymbol, type StaticHelperMetadata } from "../load-static-helpers.js";
|
|
13
13
|
import { refkey } from "../refkey.js";
|
|
14
14
|
import { provideDependencies, useDependencies } from "./use-dependencies.js";
|
|
15
15
|
|
|
@@ -22,9 +22,6 @@ export interface DeclarationInfo {
|
|
|
22
22
|
export interface BinderOptions {
|
|
23
23
|
staticHelpers?: Map<string, StaticHelperMetadata>;
|
|
24
24
|
dependencies?: Record<string, ReferenceableSymbol>;
|
|
25
|
-
/** When true, use #platform/ subpath imports for static helpers with platform variants.
|
|
26
|
-
* Should be true for warp packages; false for tshy packages. */
|
|
27
|
-
useSubpathImports?: boolean;
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
export interface Binder {
|
|
@@ -50,7 +47,6 @@ class BinderImp implements Binder {
|
|
|
50
47
|
private project: Project;
|
|
51
48
|
private dependencies: Record<string, ReferenceableSymbol>;
|
|
52
49
|
private staticHelpers: Map<string, StaticHelperMetadata>;
|
|
53
|
-
private useSubpathImports: boolean;
|
|
54
50
|
|
|
55
51
|
constructor(project: Project, options: BinderOptions = {}) {
|
|
56
52
|
this.project = project;
|
|
@@ -58,7 +54,6 @@ class BinderImp implements Binder {
|
|
|
58
54
|
provideDependencies(options.dependencies);
|
|
59
55
|
this.staticHelpers = options.staticHelpers ?? new Map();
|
|
60
56
|
this.dependencies = useDependencies();
|
|
61
|
-
this.useSubpathImports = options.useSubpathImports ?? false;
|
|
62
57
|
}
|
|
63
58
|
|
|
64
59
|
trackDeclaration(refkey: unknown, name: string, sourceFile: SourceFile): string {
|
|
@@ -185,27 +180,6 @@ class BinderImp implements Binder {
|
|
|
185
180
|
return importSpecifier;
|
|
186
181
|
}
|
|
187
182
|
|
|
188
|
-
/**
|
|
189
|
-
* Returns the #platform/ subpath import specifier for a static helper file
|
|
190
|
-
* that has a polyfill variant (-browser.mts or -react-native.mts sibling),
|
|
191
|
-
* or undefined if subpath imports are disabled or no variant exists.
|
|
192
|
-
* e.g. "src/static-helpers/serialization/get-binary-response.ts"
|
|
193
|
-
* -> "#platform/static-helpers/serialization/get-binary-response"
|
|
194
|
-
*/
|
|
195
|
-
private getPlatformImportSpecifier(declarationSourceFile: SourceFile): string | undefined {
|
|
196
|
-
if (!this.useSubpathImports) return undefined;
|
|
197
|
-
const filePath = declarationSourceFile.getFilePath();
|
|
198
|
-
const srcIndex = filePath.indexOf("/src/");
|
|
199
|
-
if (srcIndex === -1) return undefined;
|
|
200
|
-
// Check if a -browser.mts or -react-native.mts sibling exists
|
|
201
|
-
const basePath = filePath.replace(/\.ts$/, "");
|
|
202
|
-
const hasBrowserVariant = this.project.getSourceFile(basePath + "-browser.mts");
|
|
203
|
-
const hasReactNativeVariant = this.project.getSourceFile(basePath + "-react-native.mts");
|
|
204
|
-
if (!hasBrowserVariant && !hasReactNativeVariant) return undefined;
|
|
205
|
-
const relativePath = filePath.substring(srcIndex + "/src/".length);
|
|
206
|
-
return "#platform/" + relativePath.replace(/\.ts$/, "");
|
|
207
|
-
}
|
|
208
|
-
|
|
209
183
|
/**
|
|
210
184
|
* Applies all tracked imports to their respective source files.
|
|
211
185
|
*/
|
|
@@ -316,9 +290,7 @@ class BinderImp implements Binder {
|
|
|
316
290
|
|
|
317
291
|
if (file !== declarationSourceFile) {
|
|
318
292
|
this.trackReference(declarationKey, file);
|
|
319
|
-
|
|
320
|
-
const platformSpecifier = this.getPlatformImportSpecifier(declarationSourceFile);
|
|
321
|
-
const importTarget = platformSpecifier ?? declarationSourceFile;
|
|
293
|
+
const importTarget = declarationSourceFile;
|
|
322
294
|
const importDec = this.addImport(file, importTarget, name);
|
|
323
295
|
name = importDec.alias ?? name;
|
|
324
296
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
|
-
SdkClientType,
|
|
3
|
-
SdkHttpOperation,
|
|
4
|
-
SdkModelPropertyType,
|
|
5
|
-
SdkModelType,
|
|
6
|
-
SdkServiceMethod,
|
|
7
|
-
SdkType,
|
|
2
|
+
type SdkClientType,
|
|
3
|
+
type SdkHttpOperation,
|
|
4
|
+
type SdkModelPropertyType,
|
|
5
|
+
type SdkModelType,
|
|
6
|
+
type SdkServiceMethod,
|
|
7
|
+
type SdkType,
|
|
8
8
|
getClientType,
|
|
9
9
|
} from "@azure-tools/typespec-client-generator-core";
|
|
10
|
-
import { Operation, Type, getNamespaceFullName } from "@typespec/compiler";
|
|
10
|
+
import { type Operation, type Type, getNamespaceFullName } from "@typespec/compiler";
|
|
11
11
|
import { provideContext, useContext } from "../../context-manager.js";
|
|
12
12
|
|
|
13
13
|
import { reportDiagnostic } from "../../lib.js";
|
|
14
14
|
import { visitPackageTypes } from "../../modular/emit-models.js";
|
|
15
15
|
import { getAllAncestors, getAllProperties } from "../../modular/helpers/operation-helpers.js";
|
|
16
16
|
import { normalizeModelPropertyName } from "../../modular/type-expressions/get-type-expression.js";
|
|
17
|
-
import { SdkContext } from "../../utils/interfaces.js";
|
|
17
|
+
import type { SdkContext } from "../../utils/interfaces.js";
|
|
18
18
|
import { NameType, normalizeName } from "../../utils/name-utils.js";
|
|
19
19
|
|
|
20
20
|
export const emitQueue: Set<SdkType> = new Set<SdkType>();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { provideContext, useContext } from "../../context-manager.js";
|
|
2
2
|
import { DefaultCoreDependencies } from "../../modular/external-dependencies.js";
|
|
3
|
-
import { ExternalDependencies } from "../dependency.js";
|
|
3
|
+
import type { ExternalDependencies } from "../dependency.js";
|
|
4
4
|
|
|
5
5
|
export function provideDependencies(customDependencies: Partial<ExternalDependencies> = {}) {
|
|
6
6
|
const dependencies = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CompilerHost, joinPaths, NoTarget, Program } from "@typespec/compiler";
|
|
1
|
+
import { type CompilerHost, joinPaths, NoTarget, type Program } from "@typespec/compiler";
|
|
2
2
|
import {
|
|
3
3
|
ClassDeclaration,
|
|
4
4
|
EnumDeclaration,
|
|
@@ -9,10 +9,11 @@ import {
|
|
|
9
9
|
TypeAliasDeclaration,
|
|
10
10
|
} from "ts-morph";
|
|
11
11
|
import { reportDiagnostic } from "../lib.js";
|
|
12
|
-
import { ModularEmitterOptions } from "../modular/interfaces.js";
|
|
12
|
+
import type { ModularEmitterOptions } from "../modular/interfaces.js";
|
|
13
13
|
import { resolveProjectRoot } from "../utils/resolve-project-root.js";
|
|
14
14
|
import { refkey } from "./refkey.js";
|
|
15
15
|
export const SourceFileSymbol = Symbol("SourceFile");
|
|
16
|
+
|
|
16
17
|
export interface StaticHelperMetadata {
|
|
17
18
|
name: string;
|
|
18
19
|
kind: "function" | "interface" | "typeAlias" | "class" | "enum";
|
|
@@ -94,22 +95,6 @@ export async function loadStaticHelpers(
|
|
|
94
95
|
const addedFile = project.createSourceFile(targetPath, contents, {
|
|
95
96
|
overwrite: true,
|
|
96
97
|
});
|
|
97
|
-
addedFile.getImportDeclarations().map((i) => {
|
|
98
|
-
// Rewrite relative platform-types imports to #platform/ specifiers
|
|
99
|
-
// so that browser/react-native variants are resolved via subpath imports.
|
|
100
|
-
// Only rewrite imports to the default variant (not -browser/-react-native variants
|
|
101
|
-
// which are already platform-specific direct imports).
|
|
102
|
-
const specifier = i.getModuleSpecifierValue();
|
|
103
|
-
if (
|
|
104
|
-
specifier.startsWith(".") &&
|
|
105
|
-
specifier.includes("platform-types") &&
|
|
106
|
-
!specifier.includes("-browser") &&
|
|
107
|
-
!specifier.includes("-react-native")
|
|
108
|
-
) {
|
|
109
|
-
i.setModuleSpecifier("#platform/static-helpers/platform-types");
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
|
|
113
98
|
for (const entry of Object.values(helpers)) {
|
|
114
99
|
if (!addedFile.getFilePath().endsWith(entry.location)) {
|
|
115
100
|
continue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReferenceableSymbol } from "./dependency.js";
|
|
1
|
+
import type { ReferenceableSymbol } from "./dependency.js";
|
|
2
2
|
import { useBinder } from "./hooks/binder.js";
|
|
3
|
-
import { SourceFileSymbol, StaticHelperMetadata } from "./load-static-helpers.js";
|
|
3
|
+
import { SourceFileSymbol, type StaticHelperMetadata } from "./load-static-helpers.js";
|
|
4
4
|
import { refkey as getRefkey } from "./refkey.js";
|
|
5
5
|
|
|
6
6
|
export function resolveReference(refkey: unknown): string {
|
package/src/framework/sample.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type CompilerHost,
|
|
6
|
+
type EmitContext,
|
|
7
|
+
type Program,
|
|
7
8
|
getBaseFileName,
|
|
8
9
|
getDirectoryPath,
|
|
9
10
|
joinPaths,
|
|
10
11
|
resolvePath,
|
|
11
|
-
type CompilerHost,
|
|
12
12
|
} from "@typespec/compiler";
|
|
13
13
|
import { clearContexts, provideContext, useContext } from "./context-manager.js";
|
|
14
14
|
import { buildRootIndex, buildSubClientIndexFile } from "./modular/build-root-index.js";
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
CreateRecorderHelpers,
|
|
24
24
|
MultipartHelpers,
|
|
25
25
|
PagingHelpers,
|
|
26
|
-
PlatformTypeHelpers,
|
|
27
26
|
PollingHelpers,
|
|
28
27
|
SerializationHelpers,
|
|
29
28
|
SimplePollerHelpers,
|
|
@@ -33,11 +32,11 @@ import {
|
|
|
33
32
|
} from "./modular/static-helpers-metadata.js";
|
|
34
33
|
import { emitContentByBuilder } from "./utils/emit-util.js";
|
|
35
34
|
import { clearDirectory, emptyDir, pathExists } from "./utils/file-system-utils.js";
|
|
36
|
-
import { GenerationDirDetail, SdkContext } from "./utils/interfaces.js";
|
|
35
|
+
import type { GenerationDirDetail, SdkContext } from "./utils/interfaces.js";
|
|
37
36
|
|
|
38
37
|
import {
|
|
39
|
-
SdkClientType,
|
|
40
|
-
SdkServiceOperation,
|
|
38
|
+
type SdkClientType,
|
|
39
|
+
type SdkServiceOperation,
|
|
41
40
|
createSdkContext,
|
|
42
41
|
listAllServiceNamespaces,
|
|
43
42
|
} from "@azure-tools/typespec-client-generator-core";
|
|
@@ -45,8 +44,8 @@ import { Project } from "ts-morph";
|
|
|
45
44
|
import { provideBinder } from "./framework/hooks/binder.js";
|
|
46
45
|
import { provideSdkTypes, resetSdkTypesState } from "./framework/hooks/sdk-types.js";
|
|
47
46
|
import { loadStaticHelpers } from "./framework/load-static-helpers.js";
|
|
48
|
-
import { ClientModel, ClientOptions } from "./interfaces.js";
|
|
49
|
-
import { EmitterOptions } from "./lib.js";
|
|
47
|
+
import type { ClientModel, ClientOptions } from "./interfaces.js";
|
|
48
|
+
import type { EmitterOptions } from "./lib.js";
|
|
50
49
|
import { buildApiExtractorConfig } from "./metadata/build-api-extractor-config.js";
|
|
51
50
|
import { buildChangelogFile } from "./metadata/build-changelog-file.js";
|
|
52
51
|
import { buildEsLintConfig } from "./metadata/build-es-lint-config.js";
|
|
@@ -76,7 +75,7 @@ import { buildSampleTest } from "./metadata/test/build-sample-test.js";
|
|
|
76
75
|
import { buildSnippets } from "./metadata/test/build-snippets.js";
|
|
77
76
|
import { buildClassicalClient } from "./modular/build-classical-client.js";
|
|
78
77
|
import { buildClassicOperationFiles } from "./modular/build-classical-operation-groups.js";
|
|
79
|
-
import { buildClientContext
|
|
78
|
+
import { buildClientContext } from "./modular/build-client-context.js";
|
|
80
79
|
import { transformModularEmitterOptions } from "./modular/build-modular-options.js";
|
|
81
80
|
import { buildOperationFiles } from "./modular/build-operations.js";
|
|
82
81
|
import { getModuleExports } from "./modular/build-project-files.js";
|
|
@@ -88,7 +87,7 @@ import { emitNonModelResponseTypes, emitTypes } from "./modular/emit-models.js";
|
|
|
88
87
|
import { emitSamples } from "./modular/emit-samples.js";
|
|
89
88
|
import { emitTests } from "./modular/emit-tests.js";
|
|
90
89
|
import { getClassicalClientName } from "./modular/helpers/naming-helpers.js";
|
|
91
|
-
import { ModularEmitterOptions } from "./modular/interfaces.js";
|
|
90
|
+
import type { ModularEmitterOptions } from "./modular/interfaces.js";
|
|
92
91
|
import { packageUsesXmlSerialization } from "./modular/serialization/build-xml-serializer-function.js";
|
|
93
92
|
import { transformClientOptions } from "./transform/transform-client-options.js";
|
|
94
93
|
import { transformClientModel } from "./transform/transform.js";
|
|
@@ -139,7 +138,6 @@ export async function $onEmit(context: EmitContext) {
|
|
|
139
138
|
...SimplePollerHelpers,
|
|
140
139
|
...UrlTemplateHelpers,
|
|
141
140
|
...MultipartHelpers,
|
|
142
|
-
...PlatformTypeHelpers,
|
|
143
141
|
...CloudSettingHelpers,
|
|
144
142
|
...XmlHelpers,
|
|
145
143
|
...(resolvedEmitterOptions.generateTest ? CreateRecorderHelpers : {}),
|
|
@@ -165,7 +163,6 @@ export async function $onEmit(context: EmitContext) {
|
|
|
165
163
|
dependencies: {
|
|
166
164
|
...extraDependencies,
|
|
167
165
|
},
|
|
168
|
-
useSubpathImports: true,
|
|
169
166
|
});
|
|
170
167
|
provideSdkTypes(dpgContext);
|
|
171
168
|
|
|
@@ -455,19 +452,18 @@ export async function $onEmit(context: EmitContext) {
|
|
|
455
452
|
modularPackageInfo = {
|
|
456
453
|
...modularPackageInfo,
|
|
457
454
|
dependencies,
|
|
458
|
-
clientContextPaths: getRelativeContextPaths(context, modularEmitterOptions),
|
|
459
455
|
};
|
|
460
456
|
}
|
|
461
457
|
commonBuilders.push((model) => buildPackageFile(model, modularPackageInfo));
|
|
462
458
|
// Generate warp.config.yml for Azure monorepo ESM packages
|
|
463
459
|
commonBuilders.push((model) => buildWarpConfig(model, modularPackageInfo));
|
|
464
460
|
commonBuilders.push(buildTsConfig);
|
|
465
|
-
commonBuilders.push(buildTsSrcEsmConfig);
|
|
466
|
-
commonBuilders.push(buildTsSrcBrowserConfig);
|
|
461
|
+
commonBuilders.push(() => buildTsSrcEsmConfig(modularPackageInfo["exports"]));
|
|
462
|
+
commonBuilders.push(() => buildTsSrcBrowserConfig(modularPackageInfo["exports"]));
|
|
467
463
|
if (option.generateReactNativeTarget) {
|
|
468
|
-
commonBuilders.push(buildTsSrcReactNativeConfig);
|
|
464
|
+
commonBuilders.push(() => buildTsSrcReactNativeConfig(modularPackageInfo["exports"]));
|
|
469
465
|
}
|
|
470
|
-
commonBuilders.push(buildTsSrcCjsConfig);
|
|
466
|
+
commonBuilders.push(() => buildTsSrcCjsConfig(modularPackageInfo["exports"]));
|
|
471
467
|
if (option.generateSample) {
|
|
472
468
|
commonBuilders.push(buildTsSampleConfig);
|
|
473
469
|
}
|
|
@@ -508,14 +504,13 @@ export async function $onEmit(context: EmitContext) {
|
|
|
508
504
|
}
|
|
509
505
|
const modularPackageInfo = {
|
|
510
506
|
exports: getModuleExports(context, modularEmitterOptions),
|
|
511
|
-
clientContextPaths: getRelativeContextPaths(context, modularEmitterOptions),
|
|
512
507
|
...(Object.keys(additionalDependencies).length > 0 && {
|
|
513
508
|
dependencies: additionalDependencies,
|
|
514
509
|
}),
|
|
515
510
|
};
|
|
516
511
|
|
|
517
512
|
// Always update package.json (adds #platform/* imports) along with
|
|
518
|
-
// exports
|
|
513
|
+
// exports and LRO deps.
|
|
519
514
|
{
|
|
520
515
|
// Read package.json content via host and pass parsed object
|
|
521
516
|
const pkgSourceFile = await host.readFile(existingPackageFilePath);
|
|
@@ -533,6 +528,14 @@ export async function $onEmit(context: EmitContext) {
|
|
|
533
528
|
// Update warp.config.yml for Azure monorepo packages
|
|
534
529
|
updateBuilders.push((model: ClientModel) => buildWarpConfig(model, modularPackageInfo));
|
|
535
530
|
|
|
531
|
+
// Re-sync tsconfig.src.*.json `include` with the warp exports
|
|
532
|
+
updateBuilders.push(() => buildTsSrcEsmConfig(modularPackageInfo["exports"]));
|
|
533
|
+
updateBuilders.push(() => buildTsSrcBrowserConfig(modularPackageInfo["exports"]));
|
|
534
|
+
if (option.generateReactNativeTarget) {
|
|
535
|
+
updateBuilders.push(() => buildTsSrcReactNativeConfig(modularPackageInfo["exports"]));
|
|
536
|
+
}
|
|
537
|
+
updateBuilders.push(() => buildTsSrcCjsConfig(modularPackageInfo["exports"]));
|
|
538
|
+
|
|
536
539
|
// If the client name changed, regenerate the README and snippets completely;
|
|
537
540
|
// otherwise update only the API reference link in-place.
|
|
538
541
|
if (hasReadmeFile) {
|
|
@@ -580,13 +583,6 @@ export async function $onEmit(context: EmitContext) {
|
|
|
580
583
|
);
|
|
581
584
|
}
|
|
582
585
|
}
|
|
583
|
-
|
|
584
|
-
function getRelativeContextPaths(context: SdkContext, options: ModularEmitterOptions) {
|
|
585
|
-
const clientMap = getClientHierarchyMap(context);
|
|
586
|
-
return Array.from(clientMap)
|
|
587
|
-
.map((subClient) => getClientContextPath(subClient, options))
|
|
588
|
-
.map((path) => path.substring(path.indexOf("src")));
|
|
589
|
-
}
|
|
590
586
|
}
|
|
591
587
|
|
|
592
588
|
export async function createContextWithDefaultOptions(
|
package/src/interfaces.ts
CHANGED
package/src/lib.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { createTypeSpecLibrary, JSONSchemaType, paramMessage } from "@typespec/compiler";
|
|
5
|
-
import { Options } from "prettier";
|
|
6
|
-
import { PackageDetails } from "./interfaces.js";
|
|
4
|
+
import { createTypeSpecLibrary, type JSONSchemaType, paramMessage } from "@typespec/compiler";
|
|
5
|
+
import type { Options } from "prettier";
|
|
6
|
+
import type { PackageDetails } from "./interfaces.js";
|
|
7
7
|
|
|
8
8
|
export interface EmitterOptions {
|
|
9
9
|
/**
|
|
@@ -137,7 +137,6 @@ export const EmitterOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
137
137
|
nameWithoutScope: { type: "string", nullable: true },
|
|
138
138
|
description: { type: "string", nullable: true },
|
|
139
139
|
version: { type: "string", nullable: true },
|
|
140
|
-
isVersionUserProvided: { type: "boolean", nullable: true },
|
|
141
140
|
},
|
|
142
141
|
required: ["name"],
|
|
143
142
|
nullable: true,
|
package/src/meta-tree.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import { Project } from "ts-morph";
|
|
5
|
-
import { ClientModel } from "../interfaces.js";
|
|
5
|
+
import type { ClientModel } from "../interfaces.js";
|
|
6
6
|
|
|
7
7
|
export function buildApiExtractorConfig(_model: ClientModel) {
|
|
8
8
|
const project = new Project({ useInMemoryFileSystem: true });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { ClientModel } from "../interfaces.js";
|
|
4
|
+
import type { ClientModel } from "../interfaces.js";
|
|
5
5
|
|
|
6
6
|
function getPackageVersion(model: ClientModel): string {
|
|
7
7
|
return model.options?.packageDetails?.version ?? "1.0.0-beta.1";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import { Project } from "ts-morph";
|
|
5
|
-
import { ClientModel } from "../interfaces.js";
|
|
5
|
+
import type { ClientModel } from "../interfaces.js";
|
|
6
6
|
|
|
7
7
|
const esLintConfigEsmAzureSdk = `import azsdkEslint from "@azure/eslint-plugin-azure-sdk";
|
|
8
8
|
|