@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
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import { getImmediateParentsNames } from "../build-object-types.js";
|
|
5
|
-
import {
|
|
6
|
-
ArraySchema,
|
|
7
|
-
DictionarySchema,
|
|
8
|
-
ObjectSchema,
|
|
9
|
-
Schema,
|
|
10
|
-
SchemaContext,
|
|
11
|
-
} from "../interfaces.js";
|
|
12
|
-
import {
|
|
13
|
-
TypeScriptType,
|
|
14
|
-
getArrayObjectType,
|
|
15
|
-
getNativeArrayType,
|
|
16
|
-
getRecordType,
|
|
17
|
-
getUnionType,
|
|
18
|
-
isArrayObject,
|
|
19
|
-
isNativeArray,
|
|
20
|
-
leaveBracket,
|
|
21
|
-
leaveStringQuotes,
|
|
22
|
-
toTypeScriptTypeFromName,
|
|
23
|
-
toTypeScriptTypeFromSchema,
|
|
24
|
-
} from "./type-util.js";
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Generate parameter type value for the given type and parameter name
|
|
28
|
-
* @param type the typescript type
|
|
29
|
-
* @param parameterName the parameter name
|
|
30
|
-
* @param schemaMap the schema info to help generate the value
|
|
31
|
-
* @param path optional path to help detect self reference
|
|
32
|
-
* @param _allowMockValue the flag to indicate whether to allow mock value, currently we always generate mock value
|
|
33
|
-
* @returns
|
|
34
|
-
*/
|
|
35
|
-
export function generateParameterTypeValue(
|
|
36
|
-
type: string,
|
|
37
|
-
parameterName: string,
|
|
38
|
-
schemaMap: Map<string, Schema>,
|
|
39
|
-
path: Set<string> = new Set(),
|
|
40
|
-
_allowMockValue = true,
|
|
41
|
-
): string | undefined {
|
|
42
|
-
type = leaveBracket(type?.trim());
|
|
43
|
-
let tsType: TypeScriptType | undefined;
|
|
44
|
-
// Give priority to suggest the ts-type from schema
|
|
45
|
-
if (schemaMap.has(type)) {
|
|
46
|
-
tsType = toTypeScriptTypeFromSchema(schemaMap.get(type)!);
|
|
47
|
-
}
|
|
48
|
-
// Fallback to suggest ts-type from the type iteself
|
|
49
|
-
if (!tsType) {
|
|
50
|
-
tsType = toTypeScriptTypeFromName(type);
|
|
51
|
-
}
|
|
52
|
-
switch (tsType) {
|
|
53
|
-
case TypeScriptType.string:
|
|
54
|
-
return `"{Your ${leaveStringQuotes(parameterName)}}"`;
|
|
55
|
-
case TypeScriptType.number:
|
|
56
|
-
return "123";
|
|
57
|
-
case TypeScriptType.boolean:
|
|
58
|
-
return "true";
|
|
59
|
-
case TypeScriptType.date:
|
|
60
|
-
return "new Date()";
|
|
61
|
-
case TypeScriptType.unknown:
|
|
62
|
-
return `"Unknown Type"`;
|
|
63
|
-
case TypeScriptType.object: {
|
|
64
|
-
return generateObjectValues(type, parameterName, schemaMap, path);
|
|
65
|
-
}
|
|
66
|
-
case TypeScriptType.array: {
|
|
67
|
-
return generateArrayValues(type, parameterName, schemaMap, path);
|
|
68
|
-
}
|
|
69
|
-
case TypeScriptType.record: {
|
|
70
|
-
return generateRecordValues(type, parameterName, schemaMap, path);
|
|
71
|
-
}
|
|
72
|
-
case TypeScriptType.enum: {
|
|
73
|
-
return mockEnumValues(type, parameterName, schemaMap, path);
|
|
74
|
-
}
|
|
75
|
-
case TypeScriptType.union: {
|
|
76
|
-
return mockUnionValues(type, parameterName, schemaMap, path);
|
|
77
|
-
}
|
|
78
|
-
case TypeScriptType.constant:
|
|
79
|
-
return type;
|
|
80
|
-
}
|
|
81
|
-
return `undefined /**FIXME */`;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function mockEnumValues(
|
|
85
|
-
type: string,
|
|
86
|
-
parameterName: string,
|
|
87
|
-
schemaMap: Map<string, Schema>,
|
|
88
|
-
path: Set<string> = new Set(),
|
|
89
|
-
) {
|
|
90
|
-
const schema = schemaMap.get(type);
|
|
91
|
-
if (schema && schema.enum && schema.enum.length > 0) {
|
|
92
|
-
return schema.enum[0].type;
|
|
93
|
-
}
|
|
94
|
-
return generateParameterTypeValue(getUnionType(type), parameterName, schemaMap, path);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function mockUnionValues(
|
|
98
|
-
type: string,
|
|
99
|
-
parameterName: string,
|
|
100
|
-
schemaMap: Map<string, Schema>,
|
|
101
|
-
path: Set<string> = new Set(),
|
|
102
|
-
) {
|
|
103
|
-
const schema = schemaMap.get(type);
|
|
104
|
-
if (schema && schema.enum && schema.enum.length > 0) {
|
|
105
|
-
addToSchemaMap(schemaMap, schema.enum[0]);
|
|
106
|
-
return generateParameterTypeValue(
|
|
107
|
-
getAccurateTypeName(schema.enum[0]) ?? schema.enum[0],
|
|
108
|
-
parameterName,
|
|
109
|
-
schemaMap,
|
|
110
|
-
path,
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
return generateParameterTypeValue(getUnionType(type), parameterName, schemaMap, path);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function generateRecordValues(
|
|
117
|
-
type: string,
|
|
118
|
-
parameterName: string,
|
|
119
|
-
schemaMap: Map<string, Schema>,
|
|
120
|
-
path: Set<string> = new Set(),
|
|
121
|
-
) {
|
|
122
|
-
let recordType = getRecordType(type);
|
|
123
|
-
const schema = schemaMap.get(type) as DictionarySchema;
|
|
124
|
-
if (schema && schema.additionalProperties) {
|
|
125
|
-
recordType = getAccurateTypeName(schema.additionalProperties);
|
|
126
|
-
addToSchemaMap(schemaMap, schema.additionalProperties);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return recordType
|
|
130
|
-
? `{"key": ${generateParameterTypeValue(recordType, parameterName, schemaMap, path)}}`
|
|
131
|
-
: `{}`;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function generateArrayValues(
|
|
135
|
-
type: string,
|
|
136
|
-
parameterName: string,
|
|
137
|
-
schemaMap: Map<string, Schema>,
|
|
138
|
-
path: Set<string> = new Set(),
|
|
139
|
-
) {
|
|
140
|
-
let arrayType;
|
|
141
|
-
const schema = schemaMap.get(type) as ArraySchema;
|
|
142
|
-
if (schema && schema.items) {
|
|
143
|
-
arrayType = getAccurateTypeName(schema.items);
|
|
144
|
-
addToSchemaMap(schemaMap, schema.items);
|
|
145
|
-
} else if (isArrayObject(type)) {
|
|
146
|
-
arrayType = getArrayObjectType(type);
|
|
147
|
-
} else if (isNativeArray(type)) {
|
|
148
|
-
arrayType = getNativeArrayType(type);
|
|
149
|
-
}
|
|
150
|
-
const itemValue = arrayType
|
|
151
|
-
? generateParameterTypeValue(arrayType, parameterName, schemaMap, path)
|
|
152
|
-
: undefined;
|
|
153
|
-
return itemValue ? `[${itemValue}]` : `[]`;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function generateObjectValues(
|
|
157
|
-
type: string,
|
|
158
|
-
_parameterName: string,
|
|
159
|
-
schemaMap: Map<string, Schema>,
|
|
160
|
-
path: Set<string> = new Set(),
|
|
161
|
-
) {
|
|
162
|
-
if (path.has(type)) {
|
|
163
|
-
// skip generating if self referenced
|
|
164
|
-
return `{} as any /**FIXME */`;
|
|
165
|
-
}
|
|
166
|
-
path.add(type);
|
|
167
|
-
// Extract all properties from the schema
|
|
168
|
-
const allProperties = getAllProperties(schemaMap.get(type), schemaMap);
|
|
169
|
-
const values = extractObjectProperties(allProperties, schemaMap, path);
|
|
170
|
-
|
|
171
|
-
path.delete(type);
|
|
172
|
-
return `{${values.join(", ")}}`;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function getAllProperties(
|
|
176
|
-
schema?: ObjectSchema,
|
|
177
|
-
schemaMap: Map<string, Schema> = new Map(),
|
|
178
|
-
): Map<string, Schema> {
|
|
179
|
-
const propertiesMap: Map<string, Schema> = new Map();
|
|
180
|
-
if (!schema) {
|
|
181
|
-
return new Map();
|
|
182
|
-
}
|
|
183
|
-
getImmediateParentsNames(schema, [SchemaContext.Input])?.forEach((p) => {
|
|
184
|
-
const parentProperties = getAllProperties(schemaMap.get(p), schemaMap);
|
|
185
|
-
for (const prop of parentProperties.keys()) {
|
|
186
|
-
propertiesMap.set(prop, parentProperties.get(prop)!);
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
for (const prop in schema.properties) {
|
|
190
|
-
const propValue = schema.properties[prop];
|
|
191
|
-
if (propValue) {
|
|
192
|
-
propertiesMap.set(prop, propValue);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return propertiesMap;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function extractObjectProperties(
|
|
199
|
-
properties: Map<string, Schema>,
|
|
200
|
-
schemaMap: Map<string, Schema> = new Map(),
|
|
201
|
-
path: Set<string> = new Set(),
|
|
202
|
-
) {
|
|
203
|
-
const values: string[] = [];
|
|
204
|
-
for (const name of properties.keys()) {
|
|
205
|
-
const property = properties.get(name);
|
|
206
|
-
if (!property || property.readOnly || property.type === "never") {
|
|
207
|
-
continue;
|
|
208
|
-
}
|
|
209
|
-
addToSchemaMap(schemaMap, property);
|
|
210
|
-
values.push(
|
|
211
|
-
`${name}: ` +
|
|
212
|
-
generateParameterTypeValue(getAccurateTypeName(property), name, schemaMap, path),
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
return values;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function getAccurateTypeName(schema: Schema) {
|
|
219
|
-
// For extensible enum, fallback to use the type
|
|
220
|
-
if (schema.typeName === "string" && schema.enum && schema.enum.length > 0) {
|
|
221
|
-
return schema.type;
|
|
222
|
-
}
|
|
223
|
-
return schema.typeName ?? schema.type;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function addToSchemaMap(schemaMap: Map<string, Schema>, schema: Schema) {
|
|
227
|
-
const type = getAccurateTypeName(schema);
|
|
228
|
-
if (!type) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
if (!schemaMap.has(type) && !["string", "number", "boolean"].includes(schema.type)) {
|
|
232
|
-
schemaMap.set(type, schema);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import { Project } from "ts-morph";
|
|
5
|
-
import { isAzurePackage } from "../helpers/package-util.js";
|
|
6
|
-
import { RLCModel } from "../interfaces.js";
|
|
7
|
-
|
|
8
|
-
export function buildRollupConfig(model: RLCModel) {
|
|
9
|
-
const azureSdkForJs = Boolean(model.options?.azureSdkForJs);
|
|
10
|
-
// Only generate the file when it is not in sdk repo
|
|
11
|
-
if (isAzurePackage(model) && (azureSdkForJs === true || azureSdkForJs === undefined)) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const project = new Project();
|
|
16
|
-
const filePath = "rollup.config.js";
|
|
17
|
-
const rollupFile = project.createSourceFile(filePath, undefined, {
|
|
18
|
-
overwrite: true,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
rollupFile.addStatements(
|
|
22
|
-
`import nodeResolve from "@rollup/plugin-node-resolve";
|
|
23
|
-
import cjs from "@rollup/plugin-commonjs";
|
|
24
|
-
import sourcemaps from "rollup-plugin-sourcemaps";
|
|
25
|
-
import multiEntry from "@rollup/plugin-multi-entry";
|
|
26
|
-
import json from "@rollup/plugin-json";
|
|
27
|
-
|
|
28
|
-
import nodeBuiltins from "builtin-modules";
|
|
29
|
-
|
|
30
|
-
// #region Warning Handler
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* A function that can determine whether a rollup warning should be ignored. If
|
|
34
|
-
* the function returns \`true\`, then the warning will not be displayed.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
function ignoreNiseSinonEval(warning) {
|
|
38
|
-
return (
|
|
39
|
-
warning.code === "EVAL" &&
|
|
40
|
-
(warning.id && ((warning.id.includes("node_modules/nise")) ||
|
|
41
|
-
warning.id.includes("node_modules/sinon")) === true)
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function ignoreChaiCircularDependency(warning) {
|
|
46
|
-
return (
|
|
47
|
-
warning.code === "CIRCULAR_DEPENDENCY" &&
|
|
48
|
-
(warning.importer && warning.importer.includes("node_modules/chai") === true)
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const warningInhibitors = [
|
|
53
|
-
ignoreChaiCircularDependency,
|
|
54
|
-
ignoreNiseSinonEval
|
|
55
|
-
];
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Construct a warning handler for the shared rollup configuration
|
|
59
|
-
* that ignores certain warnings that are not relevant to testing.
|
|
60
|
-
*/
|
|
61
|
-
function makeOnWarnForTesting() {
|
|
62
|
-
return (warning, warn) => {
|
|
63
|
-
// If every inhibitor returns false (i.e. no inhibitors), then show the warning
|
|
64
|
-
if (warningInhibitors.every(inhib => !inhib(warning))) {
|
|
65
|
-
warn(warning);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// #endregion
|
|
71
|
-
|
|
72
|
-
function makeBrowserTestConfig() {
|
|
73
|
-
const config = {
|
|
74
|
-
input: {
|
|
75
|
-
include: ["dist-esm/test/**/*.spec.js"],
|
|
76
|
-
exclude: ["dist-esm/test/**/node/**"]
|
|
77
|
-
},
|
|
78
|
-
output: {
|
|
79
|
-
file: \`dist-test/index.browser.js\`,
|
|
80
|
-
format: "umd",
|
|
81
|
-
sourcemap: true
|
|
82
|
-
},
|
|
83
|
-
preserveSymlinks: false,
|
|
84
|
-
plugins: [
|
|
85
|
-
multiEntry({ exports: false }),
|
|
86
|
-
nodeResolve({
|
|
87
|
-
mainFields: ["module", "browser"]
|
|
88
|
-
}),
|
|
89
|
-
cjs(),
|
|
90
|
-
json(),
|
|
91
|
-
sourcemaps()
|
|
92
|
-
//viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
|
|
93
|
-
],
|
|
94
|
-
onwarn: makeOnWarnForTesting(),
|
|
95
|
-
// Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0,
|
|
96
|
-
// rollup started respecting the "sideEffects" field in package.json. Since
|
|
97
|
-
// our package.json sets "sideEffects=false", this also applies to test
|
|
98
|
-
// code, which causes all tests to be removed by tree-shaking.
|
|
99
|
-
treeshake: false
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
return config;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const defaultConfigurationOptions = {
|
|
106
|
-
disableBrowserBundle: false
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export function makeConfig(
|
|
110
|
-
pkg,
|
|
111
|
-
options
|
|
112
|
-
) {
|
|
113
|
-
options = {
|
|
114
|
-
...defaultConfigurationOptions,
|
|
115
|
-
...(options || {})
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const baseConfig = {
|
|
119
|
-
// Use the package's module field if it has one
|
|
120
|
-
input: pkg["module"] || "dist-esm/src/index.js",
|
|
121
|
-
external: [
|
|
122
|
-
...nodeBuiltins,
|
|
123
|
-
...Object.keys(pkg.dependencies),
|
|
124
|
-
...Object.keys(pkg.devDependencies)
|
|
125
|
-
],
|
|
126
|
-
output: { file: "dist/index.js", format: "cjs", sourcemap: true },
|
|
127
|
-
preserveSymlinks: false,
|
|
128
|
-
plugins: [sourcemaps(), nodeResolve()]
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const config = [baseConfig];
|
|
132
|
-
|
|
133
|
-
if (!options.disableBrowserBundle) {
|
|
134
|
-
config.push(makeBrowserTestConfig());
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return config;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export default makeConfig(require("./package.json"));`,
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
return {
|
|
144
|
-
path: filePath,
|
|
145
|
-
content: rollupFile.getFullText(),
|
|
146
|
-
};
|
|
147
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
AzurePackageInfoConfig,
|
|
6
|
-
getAzureCommonPackageInfo,
|
|
7
|
-
getAzurePackageDependencies,
|
|
8
|
-
getAzurePackageDevDependencies,
|
|
9
|
-
} from "./azure-package-common.js";
|
|
10
|
-
import { getCommonPackageScripts, getPackageCommonInfo } from "./package-common.js";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Builds the package.json for an Azure package that won't be hosted in the azure-sdk-for-js repo.
|
|
14
|
-
*/
|
|
15
|
-
export function buildAzureStandalonePackage(config: AzurePackageInfoConfig) {
|
|
16
|
-
const packageInfo = {
|
|
17
|
-
...getAzureStandalonePackageInfo(config),
|
|
18
|
-
...getAzureStandaloneDependencies(config),
|
|
19
|
-
scripts: getAzureStandaloneScripts(config),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
return packageInfo;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function getAzureStandalonePackageInfo(config: AzurePackageInfoConfig): Record<string, any> {
|
|
26
|
-
const commonPackageInfo = getPackageCommonInfo(config);
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
...commonPackageInfo,
|
|
30
|
-
...getAzureCommonPackageInfo(config),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function getAzureStandaloneDependencies(config: AzurePackageInfoConfig): Record<string, any> {
|
|
35
|
-
return {
|
|
36
|
-
dependencies: {
|
|
37
|
-
...getAzurePackageDependencies(config),
|
|
38
|
-
},
|
|
39
|
-
devDependencies: {
|
|
40
|
-
...getStandaloneDevDependencies(config),
|
|
41
|
-
"@microsoft/api-extractor": "^7.40.3",
|
|
42
|
-
rimraf: "^5.0.5",
|
|
43
|
-
mkdirp: "^3.0.1",
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function getStandaloneDevDependencies(config: AzurePackageInfoConfig) {
|
|
49
|
-
return {
|
|
50
|
-
...getAzurePackageDevDependencies(config),
|
|
51
|
-
"@microsoft/api-extractor": "^7.40.3",
|
|
52
|
-
...getStandaloneCjsDevDependencies(config),
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function getStandaloneCjsDevDependencies(config: AzurePackageInfoConfig) {
|
|
57
|
-
if (config.moduleKind !== "cjs") {
|
|
58
|
-
return {};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
"@rollup/plugin-commonjs": "^24.0.0",
|
|
63
|
-
"@rollup/plugin-json": "^6.0.0",
|
|
64
|
-
"@rollup/plugin-multi-entry": "^6.0.0",
|
|
65
|
-
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
66
|
-
...(config.moduleKind === "cjs" && config.withTests && { "cross-env": "^7.0.2" }),
|
|
67
|
-
rollup: "^2.66.1",
|
|
68
|
-
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
69
|
-
"uglify-js": "^3.4.9",
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function getAzureStandaloneScripts(config: AzurePackageInfoConfig): Record<string, any> {
|
|
74
|
-
const testScripts = {
|
|
75
|
-
"test:browser": "karma start --single-run",
|
|
76
|
-
"test:node": `nyc mocha -r esm --require source-map-support/register --timeout 5000000 --full-trace "dist-esm/test/{,!(browser)/**/}*.spec.js"`,
|
|
77
|
-
test: "npm run test:node && npm run test:browser",
|
|
78
|
-
};
|
|
79
|
-
return {
|
|
80
|
-
...getCommonPackageScripts(),
|
|
81
|
-
clean: "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
|
|
82
|
-
...(config.withTests && testScripts),
|
|
83
|
-
...getCjsScripts(config),
|
|
84
|
-
...getEsmScripts(config),
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function getCjsScripts(config: AzurePackageInfoConfig): Record<string, any> {
|
|
89
|
-
if (config.moduleKind !== "cjs") {
|
|
90
|
-
return {};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const testScripts = {
|
|
94
|
-
"build:test": "tsc -p . && rollup -c 2>&1",
|
|
95
|
-
"build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1",
|
|
96
|
-
"build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1",
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
build:
|
|
101
|
-
"npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api",
|
|
102
|
-
...(config.withTests && testScripts),
|
|
103
|
-
minify:
|
|
104
|
-
"uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js",
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function getEsmScripts(config: AzurePackageInfoConfig): Record<string, any> {
|
|
109
|
-
if (config.moduleKind !== "esm") {
|
|
110
|
-
return {};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const testScripts = {
|
|
114
|
-
test: "npm run clean && tshy && npm run unit-test:node && npm run unit-test:browser && npm run integration-test",
|
|
115
|
-
"test:node": "vitest -c vitest.config.ts",
|
|
116
|
-
"test:browser": "vitest -c vitest.browser.config.ts",
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
build: "npm run clean && tshy && npm run extract-api",
|
|
121
|
-
...(config.withTests && testScripts),
|
|
122
|
-
};
|
|
123
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
PackageCommonInfoConfig,
|
|
6
|
-
commonPackageDependencies,
|
|
7
|
-
getCommonPackageDevDependencies,
|
|
8
|
-
getCommonPackageScripts,
|
|
9
|
-
getPackageCommonInfo,
|
|
10
|
-
} from "./package-common.js";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Builds the package.json for a flavorless package.
|
|
14
|
-
*/
|
|
15
|
-
export function buildFlavorlessPackage(config: PackageCommonInfoConfig) {
|
|
16
|
-
const packageInfo = {
|
|
17
|
-
...getFlavorlessPackageInfo(config),
|
|
18
|
-
scripts: getFlavorlessScripts(config),
|
|
19
|
-
devDependencies: {
|
|
20
|
-
...getCommonPackageDevDependencies(config),
|
|
21
|
-
"@microsoft/api-extractor": "^7.40.3",
|
|
22
|
-
rimraf: "^5.0.5",
|
|
23
|
-
mkdirp: "^3.0.1",
|
|
24
|
-
},
|
|
25
|
-
dependencies: {
|
|
26
|
-
...commonPackageDependencies,
|
|
27
|
-
"@typespec/ts-http-runtime": "0.1.0",
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return packageInfo;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function getFlavorlessPackageInfo(config: PackageCommonInfoConfig): Record<string, any> {
|
|
35
|
-
const commonPackageInfo = getPackageCommonInfo(config);
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
...commonPackageInfo,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function getFlavorlessScripts(config: PackageCommonInfoConfig) {
|
|
43
|
-
return {
|
|
44
|
-
...getCommonPackageScripts(),
|
|
45
|
-
...getCjsScripts(config),
|
|
46
|
-
...getEsmScripts(config),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function getCjsScripts({ moduleKind }: PackageCommonInfoConfig) {
|
|
51
|
-
if (moduleKind !== "cjs") {
|
|
52
|
-
return {};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
build: "npm run clean && tsc && npm run extract-api",
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function getEsmScripts({ moduleKind }: PackageCommonInfoConfig) {
|
|
61
|
-
if (moduleKind !== "esm") {
|
|
62
|
-
return {};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
build: "npm run clean && tshy && npm run extract-api",
|
|
67
|
-
};
|
|
68
|
-
}
|