@azure-tools/typespec-ts 0.54.2 → 0.55.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/CHANGELOG.md +0 -9
- package/README.md +68 -105
- package/dist/src/framework/hooks/binder.d.ts +1 -1
- package/dist/src/framework/hooks/binder.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.js +3 -4
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdk-types.d.ts +2 -3
- package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdk-types.js +2 -3
- package/dist/src/framework/hooks/sdk-types.js.map +1 -1
- package/dist/src/framework/load-static-helpers.d.ts +4 -1
- package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.js +26 -34
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/framework/sample.js +1 -1
- package/dist/src/framework/sample.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +104 -170
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +2 -18
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +30 -124
- package/dist/src/lib.js.map +1 -1
- package/dist/src/modular/build-classical-client.js +2 -2
- package/dist/src/modular/build-classical-client.js.map +1 -1
- package/dist/src/modular/build-client-context.d.ts.map +1 -1
- package/dist/src/modular/build-client-context.js +6 -15
- package/dist/src/modular/build-client-context.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.js +2 -2
- 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 +9 -13
- 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 +4 -4
- package/dist/src/modular/build-subpath-index.js.map +1 -1
- package/dist/src/modular/emit-logger-file.d.ts.map +1 -1
- package/dist/src/modular/emit-logger-file.js +0 -3
- package/dist/src/modular/emit-logger-file.js.map +1 -1
- package/dist/src/modular/emit-models-options.js +2 -2
- package/dist/src/modular/emit-models-options.js.map +1 -1
- package/dist/src/modular/emit-models.d.ts.map +1 -1
- package/dist/src/modular/emit-models.js +7 -22
- 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 +10 -28
- package/dist/src/modular/emit-samples.js.map +1 -1
- package/dist/src/modular/emit-tests.d.ts +2 -1
- package/dist/src/modular/emit-tests.d.ts.map +1 -1
- package/dist/src/modular/emit-tests.js +21 -11
- package/dist/src/modular/emit-tests.js.map +1 -1
- package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/client-helpers.js +6 -16
- package/dist/src/modular/helpers/client-helpers.js.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.d.ts +1 -1
- package/dist/src/modular/helpers/example-value-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.js +11 -28
- package/dist/src/modular/helpers/example-value-helpers.js.map +1 -1
- package/dist/src/modular/serialization/serialize-utils.js +2 -2
- package/dist/src/modular/serialization/serialize-utils.js.map +1 -1
- package/dist/src/rlc-common/helpers/imports-util.d.ts +3 -4
- package/dist/src/rlc-common/helpers/imports-util.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/imports-util.js +43 -56
- package/dist/src/rlc-common/helpers/imports-util.js.map +1 -1
- package/dist/src/rlc-common/helpers/name-constructors.d.ts +0 -9
- package/dist/src/rlc-common/helpers/name-constructors.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/name-constructors.js +1 -17
- package/dist/src/rlc-common/helpers/name-constructors.js.map +1 -1
- package/dist/src/rlc-common/index.d.ts +0 -18
- package/dist/src/rlc-common/index.d.ts.map +1 -1
- package/dist/src/rlc-common/index.js +0 -18
- package/dist/src/rlc-common/index.js.map +1 -1
- package/dist/src/rlc-common/interfaces.d.ts +2 -20
- package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
- package/dist/src/rlc-common/interfaces.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts +1 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.js +5 -42
- package/dist/src/rlc-common/metadata/build-api-extractor-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts +2 -2
- package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-es-lint-config.js +3 -41
- package/dist/src/rlc-common/metadata/build-es-lint-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-package-file.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-package-file.js +25 -73
- package/dist/src/rlc-common/metadata/build-package-file.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts +2 -2
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-readme-file.js +18 -108
- package/dist/src/rlc-common/metadata/build-readme-file.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-sample-env-file.js +1 -2
- package/dist/src/rlc-common/metadata/build-sample-env-file.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-test-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-test-config.js +1 -4
- package/dist/src/rlc-common/metadata/build-test-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-ts-config.d.ts +2 -2
- package/dist/src/rlc-common/metadata/build-ts-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-ts-config.js +19 -60
- package/dist/src/rlc-common/metadata/build-ts-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-warp-config.d.ts +1 -1
- package/dist/src/rlc-common/metadata/build-warp-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-warp-config.js +0 -3
- package/dist/src/rlc-common/metadata/build-warp-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts +1 -38
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.js +1 -108
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.js.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts +0 -39
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js +4 -20
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/package-common.d.ts +1 -22
- package/dist/src/rlc-common/metadata/package-json/package-common.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/package-common.js +21 -98
- package/dist/src/rlc-common/metadata/package-json/package-common.js.map +1 -1
- package/dist/src/rlc-common/static/polling-content.d.ts +1 -1
- package/dist/src/rlc-common/static/polling-content.d.ts.map +1 -1
- package/dist/src/rlc-common/static/polling-content.js +1 -1
- package/dist/src/rlc-common/test/build-recorded-client.d.ts +1 -1
- package/dist/src/rlc-common/test/build-recorded-client.d.ts.map +1 -1
- package/dist/src/rlc-common/test/build-recorded-client.js +2 -5
- package/dist/src/rlc-common/test/build-recorded-client.js.map +1 -1
- package/dist/src/rlc-common/test/build-sample-test.d.ts +1 -1
- package/dist/src/rlc-common/test/build-sample-test.d.ts.map +1 -1
- package/dist/src/rlc-common/test/build-sample-test.js +2 -5
- package/dist/src/rlc-common/test/build-sample-test.js.map +1 -1
- package/dist/src/rlc-common/test/build-snippets.d.ts +1 -1
- package/dist/src/rlc-common/test/build-snippets.d.ts.map +1 -1
- package/dist/src/rlc-common/test/build-snippets.js +2 -6
- package/dist/src/rlc-common/test/build-snippets.js.map +1 -1
- package/dist/src/rlc-common/test/template.d.ts +3 -3
- package/dist/src/rlc-common/test/template.d.ts.map +1 -1
- package/dist/src/rlc-common/test/template.js +1 -35
- package/dist/src/rlc-common/test/template.js.map +1 -1
- package/dist/src/transform/transform-helper-function-details.d.ts +2 -2
- package/dist/src/transform/transform-helper-function-details.d.ts.map +1 -1
- package/dist/src/transform/transform-helper-function-details.js +1 -9
- package/dist/src/transform/transform-helper-function-details.js.map +1 -1
- package/dist/src/transform/transform-schemas.js +1 -1
- package/dist/src/transform/transform-schemas.js.map +1 -1
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +9 -16
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transfrom-rlc-options.d.ts +2 -2
- package/dist/src/transform/transfrom-rlc-options.d.ts.map +1 -1
- package/dist/src/transform/transfrom-rlc-options.js +29 -94
- package/dist/src/transform/transfrom-rlc-options.js.map +1 -1
- package/dist/src/utils/client-utils.d.ts +1 -1
- package/dist/src/utils/client-utils.d.ts.map +1 -1
- package/dist/src/utils/client-utils.js +4 -5
- package/dist/src/utils/client-utils.js.map +1 -1
- package/dist/src/utils/emit-util.d.ts +0 -1
- package/dist/src/utils/emit-util.d.ts.map +1 -1
- package/dist/src/utils/emit-util.js +13 -24
- package/dist/src/utils/emit-util.js.map +1 -1
- package/dist/src/utils/file-system-utils.d.ts +4 -4
- package/dist/src/utils/file-system-utils.d.ts.map +1 -1
- package/dist/src/utils/file-system-utils.js +14 -16
- package/dist/src/utils/file-system-utils.js.map +1 -1
- package/dist/src/utils/import-helper.js +3 -3
- package/dist/src/utils/import-helper.js.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 -11
- package/dist/src/utils/model-utils.js.map +1 -1
- package/dist/src/utils/resolve-project-root.d.ts +6 -4
- package/dist/src/utils/resolve-project-root.d.ts.map +1 -1
- package/dist/src/utils/resolve-project-root.js +11 -18
- package/dist/src/utils/resolve-project-root.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -59
- package/src/framework/hooks/binder.ts +4 -5
- package/src/framework/hooks/sdk-types.ts +2 -3
- package/src/framework/load-static-helpers.ts +38 -41
- package/src/framework/sample.ts +1 -1
- package/src/index.ts +126 -204
- package/src/lib.ts +32 -143
- package/src/modular/build-classical-client.ts +2 -2
- package/src/modular/build-client-context.ts +6 -14
- package/src/modular/build-project-files.ts +11 -4
- package/src/modular/build-restore-poller.ts +2 -2
- package/src/modular/build-root-index.ts +9 -13
- package/src/modular/build-subpath-index.ts +4 -4
- package/src/modular/emit-logger-file.ts +0 -3
- package/src/modular/emit-models-options.ts +2 -2
- package/src/modular/emit-models.ts +7 -23
- package/src/modular/emit-samples.ts +10 -26
- package/src/modular/emit-tests.ts +28 -11
- package/src/modular/helpers/client-helpers.ts +7 -17
- package/src/modular/helpers/example-value-helpers.ts +11 -26
- package/src/modular/serialization/serialize-utils.ts +2 -2
- package/src/rlc-common/helpers/imports-util.ts +44 -56
- package/src/rlc-common/helpers/name-constructors.ts +1 -23
- package/src/rlc-common/index.ts +0 -18
- package/src/rlc-common/interfaces.ts +2 -23
- package/src/rlc-common/metadata/build-api-extractor-config.ts +5 -47
- package/src/rlc-common/metadata/build-es-lint-config.ts +3 -42
- package/src/rlc-common/metadata/build-package-file.ts +24 -86
- package/src/rlc-common/metadata/build-readme-file.ts +19 -121
- package/src/rlc-common/metadata/build-sample-env-file.ts +1 -4
- package/src/rlc-common/metadata/build-test-config.ts +1 -6
- package/src/rlc-common/metadata/build-ts-config.ts +30 -72
- package/src/rlc-common/metadata/build-warp-config.ts +0 -4
- package/src/rlc-common/metadata/package-json/azure-package-common.ts +2 -134
- package/src/rlc-common/metadata/package-json/build-azure-monorepo-package.ts +4 -24
- package/src/rlc-common/metadata/package-json/package-common.ts +22 -120
- package/src/rlc-common/static/polling-content.ts +1 -1
- package/src/rlc-common/test/build-recorded-client.ts +2 -5
- package/src/rlc-common/test/build-sample-test.ts +2 -5
- package/src/rlc-common/test/build-snippets.ts +2 -6
- package/src/rlc-common/test/template.ts +1 -35
- package/src/transform/transform-helper-function-details.ts +1 -10
- package/src/transform/transform-schemas.ts +1 -1
- package/src/transform/transform.ts +8 -19
- package/src/transform/transfrom-rlc-options.ts +29 -127
- package/src/utils/client-utils.ts +4 -5
- package/src/utils/emit-util.ts +14 -39
- package/src/utils/file-system-utils.ts +14 -15
- package/src/utils/import-helper.ts +3 -3
- package/src/utils/model-utils.ts +4 -17
- package/src/utils/resolve-project-root.ts +11 -24
- package/dist/src/rlc-common/build-client-definitions.d.ts +0 -6
- package/dist/src/rlc-common/build-client-definitions.d.ts.map +0 -1
- package/dist/src/rlc-common/build-client-definitions.js +0 -157
- package/dist/src/rlc-common/build-client-definitions.js.map +0 -1
- package/dist/src/rlc-common/build-client.d.ts +0 -9
- package/dist/src/rlc-common/build-client.d.ts.map +0 -1
- package/dist/src/rlc-common/build-client.js +0 -391
- package/dist/src/rlc-common/build-client.js.map +0 -1
- package/dist/src/rlc-common/build-index-file.d.ts +0 -6
- package/dist/src/rlc-common/build-index-file.d.ts.map +0 -1
- package/dist/src/rlc-common/build-index-file.js +0 -241
- package/dist/src/rlc-common/build-index-file.js.map +0 -1
- package/dist/src/rlc-common/build-is-unexpected-helper.d.ts +0 -6
- package/dist/src/rlc-common/build-is-unexpected-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/build-is-unexpected-helper.js +0 -223
- package/dist/src/rlc-common/build-is-unexpected-helper.js.map +0 -1
- package/dist/src/rlc-common/build-logger.d.ts +0 -6
- package/dist/src/rlc-common/build-logger.d.ts.map +0 -1
- package/dist/src/rlc-common/build-logger.js +0 -31
- package/dist/src/rlc-common/build-logger.js.map +0 -1
- package/dist/src/rlc-common/build-method-shortcuts.d.ts +0 -5
- package/dist/src/rlc-common/build-method-shortcuts.d.ts.map +0 -1
- package/dist/src/rlc-common/build-method-shortcuts.js +0 -54
- package/dist/src/rlc-common/build-method-shortcuts.js.map +0 -1
- package/dist/src/rlc-common/build-object-types.d.ts +0 -29
- package/dist/src/rlc-common/build-object-types.d.ts.map +0 -1
- package/dist/src/rlc-common/build-object-types.js +0 -412
- package/dist/src/rlc-common/build-object-types.js.map +0 -1
- package/dist/src/rlc-common/build-paginate-helper.d.ts +0 -6
- package/dist/src/rlc-common/build-paginate-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/build-paginate-helper.js +0 -27
- package/dist/src/rlc-common/build-paginate-helper.js.map +0 -1
- package/dist/src/rlc-common/build-parameter-types.d.ts +0 -14
- package/dist/src/rlc-common/build-parameter-types.d.ts.map +0 -1
- package/dist/src/rlc-common/build-parameter-types.js +0 -391
- package/dist/src/rlc-common/build-parameter-types.js.map +0 -1
- package/dist/src/rlc-common/build-polling-helper.d.ts +0 -6
- package/dist/src/rlc-common/build-polling-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/build-polling-helper.js +0 -61
- package/dist/src/rlc-common/build-polling-helper.js.map +0 -1
- package/dist/src/rlc-common/build-response-types.d.ts +0 -6
- package/dist/src/rlc-common/build-response-types.d.ts.map +0 -1
- package/dist/src/rlc-common/build-response-types.js +0 -143
- package/dist/src/rlc-common/build-response-types.js.map +0 -1
- package/dist/src/rlc-common/build-samples.d.ts +0 -3
- package/dist/src/rlc-common/build-samples.d.ts.map +0 -1
- package/dist/src/rlc-common/build-samples.js +0 -30
- package/dist/src/rlc-common/build-samples.js.map +0 -1
- package/dist/src/rlc-common/build-schema-type.d.ts +0 -20
- package/dist/src/rlc-common/build-schema-type.d.ts.map +0 -1
- package/dist/src/rlc-common/build-schema-type.js +0 -71
- package/dist/src/rlc-common/build-schema-type.js.map +0 -1
- package/dist/src/rlc-common/build-serialize-helper.d.ts +0 -6
- package/dist/src/rlc-common/build-serialize-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/build-serialize-helper.js +0 -36
- package/dist/src/rlc-common/build-serialize-helper.js.map +0 -1
- package/dist/src/rlc-common/build-top-level-index-file.d.ts +0 -6
- package/dist/src/rlc-common/build-top-level-index-file.d.ts.map +0 -1
- package/dist/src/rlc-common/build-top-level-index-file.js +0 -48
- package/dist/src/rlc-common/build-top-level-index-file.js.map +0 -1
- package/dist/src/rlc-common/helpers/package-util.d.ts +0 -7
- package/dist/src/rlc-common/helpers/package-util.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/package-util.js +0 -10
- package/dist/src/rlc-common/helpers/package-util.js.map +0 -1
- package/dist/src/rlc-common/helpers/path-utils.d.ts +0 -2
- package/dist/src/rlc-common/helpers/path-utils.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/path-utils.js +0 -10
- package/dist/src/rlc-common/helpers/path-utils.js.map +0 -1
- package/dist/src/rlc-common/helpers/shortcut-methods.d.ts +0 -4
- package/dist/src/rlc-common/helpers/shortcut-methods.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/shortcut-methods.js +0 -49
- package/dist/src/rlc-common/helpers/shortcut-methods.js.map +0 -1
- package/dist/src/rlc-common/helpers/value-generation-util.d.ts +0 -12
- package/dist/src/rlc-common/helpers/value-generation-util.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/value-generation-util.js +0 -161
- package/dist/src/rlc-common/helpers/value-generation-util.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-rollup-config.d.ts +0 -6
- package/dist/src/rlc-common/metadata/build-rollup-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-rollup-config.js +0 -140
- package/dist/src/rlc-common/metadata/build-rollup-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.d.ts +0 -8
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.js +0 -101
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.js.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts +0 -57
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js +0 -53
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js.map +0 -1
- package/dist/src/rlc-common/transform-sample-groups.d.ts +0 -9
- package/dist/src/rlc-common/transform-sample-groups.d.ts.map +0 -1
- package/dist/src/rlc-common/transform-sample-groups.js +0 -313
- package/dist/src/rlc-common/transform-sample-groups.js.map +0 -1
- package/dist/src/utils/dirname.d.ts +0 -9
- package/dist/src/utils/dirname.d.ts.map +0 -1
- package/dist/src/utils/dirname.js +0 -12
- package/dist/src/utils/dirname.js.map +0 -1
- package/src/rlc-common/build-client-definitions.ts +0 -235
- package/src/rlc-common/build-client.ts +0 -490
- package/src/rlc-common/build-index-file.ts +0 -344
- package/src/rlc-common/build-is-unexpected-helper.ts +0 -248
- package/src/rlc-common/build-logger.ts +0 -43
- package/src/rlc-common/build-method-shortcuts.ts +0 -71
- package/src/rlc-common/build-object-types.ts +0 -603
- package/src/rlc-common/build-paginate-helper.ts +0 -31
- package/src/rlc-common/build-parameter-types.ts +0 -554
- package/src/rlc-common/build-polling-helper.ts +0 -83
- package/src/rlc-common/build-response-types.ts +0 -180
- package/src/rlc-common/build-samples.ts +0 -32
- package/src/rlc-common/build-schema-type.ts +0 -89
- package/src/rlc-common/build-serialize-helper.ts +0 -49
- package/src/rlc-common/build-top-level-index-file.ts +0 -58
- package/src/rlc-common/helpers/package-util.ts +0 -13
- package/src/rlc-common/helpers/path-utils.ts +0 -10
- package/src/rlc-common/helpers/shortcut-methods.ts +0 -58
- package/src/rlc-common/helpers/value-generation-util.ts +0 -234
- package/src/rlc-common/metadata/build-rollup-config.ts +0 -147
- package/src/rlc-common/metadata/package-json/build-azure-standalone-package.ts +0 -123
- package/src/rlc-common/metadata/package-json/build-flavorless-package.ts +0 -68
- package/src/rlc-common/transform-sample-groups.ts +0 -407
- package/src/utils/dirname.ts +0 -12
package/src/index.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
EmitContext,
|
|
6
|
+
Program,
|
|
7
|
+
getBaseFileName,
|
|
8
|
+
getDirectoryPath,
|
|
9
|
+
joinPaths,
|
|
10
|
+
resolvePath,
|
|
11
|
+
type CompilerHost,
|
|
12
|
+
} from "@typespec/compiler";
|
|
5
13
|
import { provideContext, useContext } from "./context-manager.js";
|
|
6
14
|
import { buildRootIndex, buildSubClientIndexFile } from "./modular/build-root-index.js";
|
|
7
15
|
import {
|
|
@@ -9,7 +17,6 @@ import {
|
|
|
9
17
|
AzureIdentityDependencies,
|
|
10
18
|
AzurePollingDependencies,
|
|
11
19
|
AzureTestDependencies,
|
|
12
|
-
DefaultCoreDependencies,
|
|
13
20
|
} from "./modular/external-dependencies.js";
|
|
14
21
|
import {
|
|
15
22
|
CloudSettingHelpers,
|
|
@@ -29,29 +36,16 @@ import {
|
|
|
29
36
|
RLCOptions,
|
|
30
37
|
buildApiExtractorConfig,
|
|
31
38
|
buildChangelogFile,
|
|
32
|
-
buildClient,
|
|
33
|
-
buildClientDefinitions,
|
|
34
39
|
buildEsLintConfig,
|
|
35
|
-
buildIndexFile,
|
|
36
|
-
buildIsUnexpectedHelper,
|
|
37
40
|
buildLicenseFile,
|
|
38
|
-
buildLogger,
|
|
39
41
|
buildPackageFile,
|
|
40
|
-
buildParameterTypes,
|
|
41
|
-
buildPollingHelper,
|
|
42
|
-
buildPaginateHelper as buildRLCPaginateHelper,
|
|
43
42
|
buildReadmeFile,
|
|
44
43
|
buildRecordedClientFile,
|
|
45
|
-
buildResponseTypes,
|
|
46
|
-
buildRollupConfig,
|
|
47
44
|
buildSampleEnvFile,
|
|
48
45
|
buildSampleTest,
|
|
49
|
-
buildSamples,
|
|
50
|
-
buildSerializeHelper,
|
|
51
46
|
buildSnippets,
|
|
52
47
|
buildTestBrowserTsConfig,
|
|
53
48
|
buildTestNodeTsConfig,
|
|
54
|
-
buildTopLevelIndex,
|
|
55
49
|
buildTsConfig,
|
|
56
50
|
buildTsLintConfig,
|
|
57
51
|
buildTsSampleConfig,
|
|
@@ -65,11 +59,10 @@ import {
|
|
|
65
59
|
getClientName,
|
|
66
60
|
hasClientNameChanged,
|
|
67
61
|
hasUnexpectedHelper,
|
|
68
|
-
isAzurePackage,
|
|
69
62
|
updatePackageFile,
|
|
70
63
|
updateReadmeFile,
|
|
71
64
|
} from "./rlc-common/index.js";
|
|
72
|
-
import { emitContentByBuilder
|
|
65
|
+
import { emitContentByBuilder } from "./utils/emit-util.js";
|
|
73
66
|
import { clearDirectory, emptyDir, pathExists } from "./utils/file-system-utils.js";
|
|
74
67
|
import { GenerationDirDetail, SdkContext } from "./utils/interfaces.js";
|
|
75
68
|
|
|
@@ -79,8 +72,6 @@ import {
|
|
|
79
72
|
createSdkContext,
|
|
80
73
|
listAllServiceNamespaces,
|
|
81
74
|
} from "@azure-tools/typespec-client-generator-core";
|
|
82
|
-
import { existsSync } from "fs";
|
|
83
|
-
import { basename, join } from "path";
|
|
84
75
|
import { Project } from "ts-morph";
|
|
85
76
|
import { provideBinder } from "./framework/hooks/binder.js";
|
|
86
77
|
import { provideSdkTypes } from "./framework/hooks/sdk-types.js";
|
|
@@ -118,8 +109,15 @@ export async function $onEmit(context: EmitContext) {
|
|
|
118
109
|
return;
|
|
119
110
|
}
|
|
120
111
|
/** Shared status */
|
|
121
|
-
const outputProject = new Project();
|
|
112
|
+
const outputProject = new Project({ useInMemoryFileSystem: true });
|
|
122
113
|
const program: Program = context.program;
|
|
114
|
+
const host: CompilerHost = program.host;
|
|
115
|
+
// Derive the emitter package root from the compiler's resolved emitter entry point.
|
|
116
|
+
// This works correctly in both Node.js and the browser playground VFS.
|
|
117
|
+
const emitterRef = program.emitters.find((e) => e.metadata.name === "@azure-tools/typespec-ts");
|
|
118
|
+
const emitterPackageRoot = emitterRef
|
|
119
|
+
? resolvePath(getDirectoryPath(emitterRef.main), "../..")
|
|
120
|
+
: undefined;
|
|
123
121
|
const emitterOptions: EmitterOptions = context.options;
|
|
124
122
|
const dpgContext = await createContextWithDefaultOptions(context);
|
|
125
123
|
|
|
@@ -161,22 +159,22 @@ export async function $onEmit(context: EmitContext) {
|
|
|
161
159
|
rootDir: dpgContext.generationPathDetail?.rootDir,
|
|
162
160
|
options: rlcOptions,
|
|
163
161
|
program,
|
|
162
|
+
host,
|
|
163
|
+
packageRoot: emitterPackageRoot,
|
|
164
164
|
},
|
|
165
165
|
);
|
|
166
|
-
const extraDependencies =
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
: { ...DefaultCoreDependencies };
|
|
166
|
+
const extraDependencies = {
|
|
167
|
+
...AzurePollingDependencies,
|
|
168
|
+
...AzureCoreDependencies,
|
|
169
|
+
...AzureIdentityDependencies,
|
|
170
|
+
...AzureTestDependencies,
|
|
171
|
+
};
|
|
174
172
|
const binder = provideBinder(outputProject, {
|
|
175
173
|
staticHelpers,
|
|
176
174
|
dependencies: {
|
|
177
175
|
...extraDependencies,
|
|
178
176
|
},
|
|
179
|
-
useSubpathImports:
|
|
177
|
+
useSubpathImports: true,
|
|
180
178
|
});
|
|
181
179
|
provideSdkTypes(dpgContext);
|
|
182
180
|
|
|
@@ -191,11 +189,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
191
189
|
await clearSamplesDevFolder();
|
|
192
190
|
|
|
193
191
|
// 4. Generate sources
|
|
194
|
-
|
|
195
|
-
await generateModularSources();
|
|
196
|
-
} else {
|
|
197
|
-
await generateRLCSources();
|
|
198
|
-
}
|
|
192
|
+
await generateModularSources();
|
|
199
193
|
|
|
200
194
|
// 5. Generate metadata and test files
|
|
201
195
|
function getTypespecTsVersion(context: EmitContext): string | undefined {
|
|
@@ -212,35 +206,33 @@ export async function $onEmit(context: EmitContext) {
|
|
|
212
206
|
dpgContext.generationPathDetail = generationPathDetail;
|
|
213
207
|
dpgContext.allServiceNamespaces = listAllServiceNamespaces(dpgContext);
|
|
214
208
|
const options: RLCOptions = transformRLCOptions(emitterOptions, dpgContext);
|
|
215
|
-
emitterOptions["is-modular-library"] = options.isModularLibrary;
|
|
216
209
|
emitterOptions["generate-sample"] = options.generateSample;
|
|
217
210
|
// clear output folder if needed
|
|
218
211
|
if (options.clearOutputFolder) {
|
|
219
212
|
// Clear output directory while preserving TempTypeSpecFiles
|
|
220
|
-
await clearDirectory(context.emitterOutputDir, ["TempTypeSpecFiles"], program);
|
|
213
|
+
await clearDirectory(host, context.emitterOutputDir, ["TempTypeSpecFiles"], program);
|
|
221
214
|
}
|
|
222
215
|
const hasTestFolder = await pathExists(
|
|
223
|
-
|
|
216
|
+
host,
|
|
217
|
+
joinPaths(dpgContext.generationPathDetail?.metadataDir ?? "", "test"),
|
|
224
218
|
);
|
|
225
219
|
options.generateTest =
|
|
226
220
|
options.generateTest === true ||
|
|
227
|
-
(options.generateTest === undefined &&
|
|
228
|
-
(!hasTestFolder || (options.azureSdkForJs && options.azureArm)) &&
|
|
229
|
-
isAzurePackage({ options: options }));
|
|
221
|
+
(options.generateTest === undefined && (!hasTestFolder || options.azureArm));
|
|
230
222
|
dpgContext.rlcOptions = options;
|
|
231
223
|
}
|
|
232
224
|
|
|
233
225
|
async function calculateGenerationDir(): Promise<GenerationDirDetail> {
|
|
234
226
|
const projectRoot = context.emitterOutputDir ?? "";
|
|
235
|
-
const customizationFolder =
|
|
236
|
-
const srcGeneratedFolder =
|
|
227
|
+
const customizationFolder = joinPaths(projectRoot, "generated");
|
|
228
|
+
const srcGeneratedFolder = joinPaths(projectRoot, "src", "generated");
|
|
237
229
|
// if customization folder exists, use it as sources root
|
|
238
|
-
const finalCustomizationFolder = (await pathExists(srcGeneratedFolder))
|
|
230
|
+
const finalCustomizationFolder = (await pathExists(host, srcGeneratedFolder))
|
|
239
231
|
? srcGeneratedFolder
|
|
240
232
|
: customizationFolder;
|
|
241
|
-
const sourcesRoot = (await pathExists(finalCustomizationFolder))
|
|
233
|
+
const sourcesRoot = (await pathExists(host, finalCustomizationFolder))
|
|
242
234
|
? finalCustomizationFolder
|
|
243
|
-
:
|
|
235
|
+
: joinPaths(projectRoot, "src");
|
|
244
236
|
return {
|
|
245
237
|
rootDir: projectRoot,
|
|
246
238
|
metadataDir: projectRoot,
|
|
@@ -251,6 +243,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
251
243
|
|
|
252
244
|
async function clearSrcFolder() {
|
|
253
245
|
await emptyDir(
|
|
246
|
+
host,
|
|
254
247
|
dpgContext.generationPathDetail?.modularSourcesDir ??
|
|
255
248
|
dpgContext.generationPathDetail?.rlcSourcesDir ??
|
|
256
249
|
"",
|
|
@@ -259,9 +252,12 @@ export async function $onEmit(context: EmitContext) {
|
|
|
259
252
|
|
|
260
253
|
async function clearSamplesDevFolder() {
|
|
261
254
|
if (emitterOptions["generate-sample"] === true) {
|
|
262
|
-
const samplesDevPath =
|
|
263
|
-
|
|
264
|
-
|
|
255
|
+
const samplesDevPath = joinPaths(
|
|
256
|
+
dpgContext.generationPathDetail?.rootDir ?? "",
|
|
257
|
+
"samples-dev",
|
|
258
|
+
);
|
|
259
|
+
if (await pathExists(host, samplesDevPath)) {
|
|
260
|
+
await emptyDir(host, samplesDevPath);
|
|
265
261
|
}
|
|
266
262
|
}
|
|
267
263
|
}
|
|
@@ -277,57 +273,6 @@ export async function $onEmit(context: EmitContext) {
|
|
|
277
273
|
}
|
|
278
274
|
}
|
|
279
275
|
|
|
280
|
-
async function generateRLCSources() {
|
|
281
|
-
for (const rlcModels of rlcCodeModels) {
|
|
282
|
-
await emitModels(rlcModels, program);
|
|
283
|
-
await emitContentByBuilder(program, buildClientDefinitions, rlcModels);
|
|
284
|
-
await emitContentByBuilder(program, buildResponseTypes, rlcModels);
|
|
285
|
-
await emitContentByBuilder(program, buildClient, rlcModels);
|
|
286
|
-
await emitContentByBuilder(program, buildParameterTypes, rlcModels);
|
|
287
|
-
await emitContentByBuilder(program, buildIsUnexpectedHelper, rlcModels);
|
|
288
|
-
await emitContentByBuilder(program, buildIndexFile, rlcModels);
|
|
289
|
-
await emitContentByBuilder(program, buildLogger, rlcModels);
|
|
290
|
-
await emitContentByBuilder(program, buildTopLevelIndex, rlcModels);
|
|
291
|
-
await emitContentByBuilder(program, buildRLCPaginateHelper, rlcModels);
|
|
292
|
-
await emitContentByBuilder(program, buildPollingHelper, rlcModels);
|
|
293
|
-
await emitContentByBuilder(program, buildSerializeHelper, rlcModels);
|
|
294
|
-
await emitContentByBuilder(
|
|
295
|
-
program,
|
|
296
|
-
buildSamples,
|
|
297
|
-
rlcModels,
|
|
298
|
-
dpgContext.generationPathDetail?.metadataDir,
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
// The binder is only resolved in the modular path, so static helper files
|
|
302
|
-
// loaded into the outputProject are never written to disk in the RLC path.
|
|
303
|
-
// The RLC builders reference the platform-types helper (NodeReadableStream),
|
|
304
|
-
// so emit those files here.
|
|
305
|
-
await emitRLCStaticHelpers();
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
async function emitRLCStaticHelpers() {
|
|
309
|
-
if (program.compilerOptions.noEmit || program.hasError() || !rlcCodeModels[0]) {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
const project = useContext("outputProject");
|
|
313
|
-
for (const helperFile of project.getSourceFiles()) {
|
|
314
|
-
const filePath = helperFile.getFilePath();
|
|
315
|
-
// RLC builders (buildParameterTypes / buildSchemaType) only reference
|
|
316
|
-
// platform-types (and its browser/react-native variants); emit those
|
|
317
|
-
// files directly under src/ (strip the static-helpers/ segment) to match
|
|
318
|
-
// the RLC design where all generated output lives in src/.
|
|
319
|
-
if (!basename(filePath).startsWith("platform-types")) {
|
|
320
|
-
continue;
|
|
321
|
-
}
|
|
322
|
-
const outputPath = filePath.replace(/\/static-helpers\//g, "/");
|
|
323
|
-
await emitContentByBuilder(
|
|
324
|
-
program,
|
|
325
|
-
() => ({ content: helperFile.getFullText(), path: outputPath }),
|
|
326
|
-
rlcCodeModels[0],
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
276
|
async function generateModularSources() {
|
|
332
277
|
const modularSourcesRoot = dpgContext.generationPathDetail?.modularSourcesDir ?? "src";
|
|
333
278
|
const project = useContext("outputProject");
|
|
@@ -428,9 +373,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
428
373
|
if (emitterVersion !== undefined) {
|
|
429
374
|
content.emitterVersion = emitterVersion;
|
|
430
375
|
}
|
|
431
|
-
|
|
432
|
-
content.crossLanguageDefinitions = generateCrossLanguageDefinitionFile(dpgContext);
|
|
433
|
-
}
|
|
376
|
+
content.crossLanguageDefinitions = generateCrossLanguageDefinitionFile(dpgContext);
|
|
434
377
|
return {
|
|
435
378
|
path: "metadata.json",
|
|
436
379
|
content: JSON.stringify(content, null, 2),
|
|
@@ -450,27 +393,29 @@ export async function $onEmit(context: EmitContext) {
|
|
|
450
393
|
// to avoid unexpected modifications to files like package.json, README.md,
|
|
451
394
|
// warp.config.yml, and snippets.spec.ts. metadata.json is still updated.
|
|
452
395
|
const sourcesDir = dpgContext.generationPathDetail?.modularSourcesDir ?? "";
|
|
453
|
-
const hasManualConvenienceLayer =
|
|
454
|
-
const isAzureFlavor = isAzurePackage({ options: option });
|
|
396
|
+
const hasManualConvenienceLayer = getBaseFileName(sourcesDir) === "generated";
|
|
455
397
|
// Generate metadata
|
|
456
|
-
const existingPackageFilePath =
|
|
398
|
+
const existingPackageFilePath = joinPaths(
|
|
457
399
|
dpgContext.generationPathDetail?.metadataDir ?? "",
|
|
458
400
|
"package.json",
|
|
459
401
|
);
|
|
460
|
-
const hasPackageFile = await
|
|
461
|
-
const existingReadmeFilePath =
|
|
402
|
+
const hasPackageFile = await pathExists(host, existingPackageFilePath);
|
|
403
|
+
const existingReadmeFilePath = joinPaths(
|
|
462
404
|
dpgContext.generationPathDetail?.metadataDir ?? "",
|
|
463
405
|
"README.md",
|
|
464
406
|
);
|
|
465
|
-
const hasReadmeFile = await
|
|
466
|
-
const existingChangelogFilePath =
|
|
407
|
+
const hasReadmeFile = await pathExists(host, existingReadmeFilePath);
|
|
408
|
+
const existingChangelogFilePath = joinPaths(
|
|
467
409
|
dpgContext.generationPathDetail?.metadataDir ?? "",
|
|
468
410
|
"CHANGELOG.md",
|
|
469
411
|
);
|
|
470
|
-
const hasChangelogFile = await
|
|
412
|
+
const hasChangelogFile = await pathExists(host, existingChangelogFilePath);
|
|
471
413
|
const shouldGenerateMetadata = option.generateMetadata === true || !hasPackageFile;
|
|
472
|
-
const existingTestFolderPath =
|
|
473
|
-
|
|
414
|
+
const existingTestFolderPath = joinPaths(
|
|
415
|
+
dpgContext.generationPathDetail?.metadataDir ?? "",
|
|
416
|
+
"test",
|
|
417
|
+
);
|
|
418
|
+
const hasTestFolder = await pathExists(host, existingTestFolderPath);
|
|
474
419
|
if (option.generateTest === undefined) {
|
|
475
420
|
if (hasTestFolder) {
|
|
476
421
|
option.generateTest = false;
|
|
@@ -480,15 +425,12 @@ export async function $onEmit(context: EmitContext) {
|
|
|
480
425
|
}
|
|
481
426
|
|
|
482
427
|
//TODO Need consider multi-client cases
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
rlcClient.libraryName = subClient.name;
|
|
486
|
-
}
|
|
428
|
+
for (const subClient of dpgContext.sdkPackage.clients) {
|
|
429
|
+
rlcClient.libraryName = subClient.name;
|
|
487
430
|
}
|
|
488
431
|
|
|
489
432
|
if (shouldGenerateMetadata) {
|
|
490
433
|
const commonBuilders = [
|
|
491
|
-
buildRollupConfig,
|
|
492
434
|
buildApiExtractorConfig,
|
|
493
435
|
buildReadmeFile,
|
|
494
436
|
buildLicenseFile,
|
|
@@ -500,73 +442,52 @@ export async function $onEmit(context: EmitContext) {
|
|
|
500
442
|
commonBuilders.push((model) => buildTestBrowserTsConfig(model));
|
|
501
443
|
commonBuilders.push((model) => buildTestNodeTsConfig(model));
|
|
502
444
|
}
|
|
503
|
-
|
|
504
|
-
commonBuilders.push(buildEsLintConfig);
|
|
505
|
-
}
|
|
445
|
+
commonBuilders.push(buildEsLintConfig);
|
|
506
446
|
if (!hasChangelogFile) {
|
|
507
447
|
commonBuilders.push(buildChangelogFile);
|
|
508
448
|
}
|
|
509
449
|
if (
|
|
510
450
|
emitterOptions["generate-test"] === true &&
|
|
511
|
-
option.azureSdkForJs === true &&
|
|
512
451
|
emitterOptions["generate-metadata"] === true
|
|
513
452
|
) {
|
|
514
|
-
await emitTests(dpgContext);
|
|
453
|
+
await emitTests(dpgContext, host);
|
|
515
454
|
}
|
|
516
|
-
let modularPackageInfo = {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
};
|
|
455
|
+
let modularPackageInfo: Record<string, any> = {
|
|
456
|
+
exports: getModuleExports(context, modularEmitterOptions),
|
|
457
|
+
};
|
|
458
|
+
{
|
|
521
459
|
// Build dependencies
|
|
522
460
|
const dependencies: Record<string, string> = {};
|
|
523
|
-
|
|
524
|
-
dependencies["@azure/core-util"] = "^1.9.2";
|
|
525
|
-
}
|
|
461
|
+
dependencies["@azure/core-util"] = "^1.9.2";
|
|
526
462
|
// Add fast-xml-parser if XML serialization is used
|
|
527
463
|
if (packageUsesXmlSerialization(dpgContext.sdkPackage)) {
|
|
528
464
|
dependencies["fast-xml-parser"] = "^4.5.0";
|
|
529
465
|
}
|
|
530
|
-
|
|
531
|
-
modularPackageInfo
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
};
|
|
536
|
-
} else if (Object.keys(dependencies).length > 0) {
|
|
537
|
-
modularPackageInfo = {
|
|
538
|
-
...modularPackageInfo,
|
|
539
|
-
dependencies,
|
|
540
|
-
};
|
|
541
|
-
}
|
|
466
|
+
modularPackageInfo = {
|
|
467
|
+
...modularPackageInfo,
|
|
468
|
+
dependencies,
|
|
469
|
+
clientContextPaths: getRelativeContextPaths(context, modularEmitterOptions),
|
|
470
|
+
};
|
|
542
471
|
}
|
|
543
472
|
commonBuilders.push((model) => buildPackageFile(model, modularPackageInfo));
|
|
544
473
|
// Generate warp.config.yml for Azure monorepo ESM packages
|
|
545
|
-
|
|
546
|
-
commonBuilders.push((model) => buildWarpConfig(model, modularPackageInfo));
|
|
547
|
-
}
|
|
474
|
+
commonBuilders.push((model) => buildWarpConfig(model, modularPackageInfo));
|
|
548
475
|
commonBuilders.push(buildTsConfig);
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
commonBuilders.push(buildTsSampleConfig);
|
|
558
|
-
}
|
|
559
|
-
if (isAzureFlavor) {
|
|
560
|
-
commonBuilders.push(buildTsLintConfig);
|
|
561
|
-
}
|
|
476
|
+
commonBuilders.push(buildTsSrcEsmConfig);
|
|
477
|
+
commonBuilders.push(buildTsSrcBrowserConfig);
|
|
478
|
+
if (option.generateReactNativeTarget) {
|
|
479
|
+
commonBuilders.push(buildTsSrcReactNativeConfig);
|
|
480
|
+
}
|
|
481
|
+
commonBuilders.push(buildTsSrcCjsConfig);
|
|
482
|
+
if (option.generateSample) {
|
|
483
|
+
commonBuilders.push(buildTsSampleConfig);
|
|
562
484
|
}
|
|
485
|
+
commonBuilders.push(buildTsLintConfig);
|
|
563
486
|
|
|
564
487
|
// TODO: need support snippets generation for multi-client cases. https://github.com/Azure/autorest.typescript/issues/3048
|
|
565
488
|
if (option.generateTest) {
|
|
566
489
|
for (const subClient of dpgContext.sdkPackage.clients) {
|
|
567
|
-
commonBuilders.push((model) =>
|
|
568
|
-
buildSnippets(model, subClient.name, option.azureSdkForJs),
|
|
569
|
-
);
|
|
490
|
+
commonBuilders.push((model) => buildSnippets(model, subClient.name));
|
|
570
491
|
}
|
|
571
492
|
commonBuilders.push(buildTsSnippetsConfig);
|
|
572
493
|
}
|
|
@@ -579,64 +500,67 @@ export async function $onEmit(context: EmitContext) {
|
|
|
579
500
|
dpgContext.generationPathDetail?.metadataDir,
|
|
580
501
|
);
|
|
581
502
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
);
|
|
589
|
-
}
|
|
503
|
+
for (const file of project.getSourceFiles()) {
|
|
504
|
+
await emitContentByBuilder(
|
|
505
|
+
program,
|
|
506
|
+
() => ({ content: file.getFullText(), path: file.getFilePath() }),
|
|
507
|
+
modularEmitterOptions as any,
|
|
508
|
+
);
|
|
590
509
|
}
|
|
591
510
|
} else if (hasPackageFile && !hasManualConvenienceLayer) {
|
|
592
511
|
const updateBuilders = [];
|
|
593
|
-
let modularPackageInfo = {};
|
|
594
512
|
|
|
595
513
|
// update existing package.json file with correct dependencies
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
additionalDependencies["fast-xml-parser"] = "^4.5.0";
|
|
602
|
-
}
|
|
603
|
-
modularPackageInfo = {
|
|
604
|
-
exports: getModuleExports(context, modularEmitterOptions),
|
|
605
|
-
clientContextPaths: getRelativeContextPaths(context, modularEmitterOptions),
|
|
606
|
-
...(Object.keys(additionalDependencies).length > 0 && {
|
|
607
|
-
dependencies: additionalDependencies,
|
|
608
|
-
}),
|
|
609
|
-
};
|
|
514
|
+
// Additional format-specific dependencies to merge when migrating
|
|
515
|
+
// (e.g. fast-xml-parser when XML serialization is used)
|
|
516
|
+
const additionalDependencies: Record<string, string> = {};
|
|
517
|
+
if (packageUsesXmlSerialization(dpgContext.sdkPackage)) {
|
|
518
|
+
additionalDependencies["fast-xml-parser"] = "^4.5.0";
|
|
610
519
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
520
|
+
const modularPackageInfo = {
|
|
521
|
+
exports: getModuleExports(context, modularEmitterOptions),
|
|
522
|
+
clientContextPaths: getRelativeContextPaths(context, modularEmitterOptions),
|
|
523
|
+
...(Object.keys(additionalDependencies).length > 0 && {
|
|
524
|
+
dependencies: additionalDependencies,
|
|
525
|
+
}),
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
// Always update package.json (adds #platform/* imports) and, for modular
|
|
529
|
+
// packages, exports, clientContextPaths and LRO deps.
|
|
530
|
+
{
|
|
531
|
+
// Read package.json content via host and pass parsed object
|
|
532
|
+
const pkgSourceFile = await host.readFile(existingPackageFilePath);
|
|
533
|
+
let packageInfo: Record<string, any>;
|
|
534
|
+
try {
|
|
535
|
+
packageInfo = JSON.parse(pkgSourceFile.text);
|
|
536
|
+
} catch {
|
|
537
|
+
packageInfo = {};
|
|
538
|
+
}
|
|
615
539
|
updateBuilders.push((model: RLCModel) =>
|
|
616
|
-
updatePackageFile(model,
|
|
540
|
+
updatePackageFile(model, packageInfo, modularPackageInfo),
|
|
617
541
|
);
|
|
618
542
|
}
|
|
619
543
|
|
|
620
544
|
// Update warp.config.yml for Azure monorepo packages
|
|
621
|
-
|
|
622
|
-
updateBuilders.push((model: RLCModel) => buildWarpConfig(model, modularPackageInfo));
|
|
623
|
-
}
|
|
545
|
+
updateBuilders.push((model: RLCModel) => buildWarpConfig(model, modularPackageInfo));
|
|
624
546
|
|
|
625
547
|
// If the client name changed, regenerate the README and snippets completely;
|
|
626
548
|
// otherwise update only the API reference link in-place.
|
|
627
549
|
if (hasReadmeFile) {
|
|
628
|
-
const
|
|
550
|
+
const readmeSourceFile = await host.readFile(existingReadmeFilePath);
|
|
551
|
+
const existingReadmeContent = readmeSourceFile.text;
|
|
552
|
+
const clientNameChanged = hasClientNameChanged(rlcClient, existingReadmeContent);
|
|
629
553
|
updateBuilders.push(
|
|
630
554
|
clientNameChanged
|
|
631
555
|
? buildReadmeFile
|
|
632
|
-
: (model: RLCModel) => updateReadmeFile(model,
|
|
556
|
+
: (model: RLCModel) => updateReadmeFile(model, existingReadmeContent),
|
|
633
557
|
);
|
|
634
558
|
|
|
635
559
|
// Regenerate snippets.spec.ts only when the client name changed
|
|
636
|
-
if (clientNameChanged
|
|
560
|
+
if (clientNameChanged) {
|
|
637
561
|
for (const subClient of dpgContext.sdkPackage.clients) {
|
|
638
562
|
updateBuilders.push((model: RLCModel) =>
|
|
639
|
-
buildSnippets(model, getClassicalClientName(subClient)
|
|
563
|
+
buildSnippets(model, getClassicalClientName(subClient)),
|
|
640
564
|
);
|
|
641
565
|
}
|
|
642
566
|
}
|
|
@@ -650,14 +574,12 @@ export async function $onEmit(context: EmitContext) {
|
|
|
650
574
|
dpgContext.generationPathDetail?.metadataDir,
|
|
651
575
|
);
|
|
652
576
|
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
);
|
|
660
|
-
}
|
|
577
|
+
await emitContentByBuilder(
|
|
578
|
+
program,
|
|
579
|
+
buildMetadataJson,
|
|
580
|
+
rlcClient,
|
|
581
|
+
dpgContext.generationPathDetail?.metadataDir,
|
|
582
|
+
);
|
|
661
583
|
|
|
662
584
|
// Generate test relevant files
|
|
663
585
|
if (option.generateTest && !hasTestFolder) {
|