@azure-tools/typespec-ts 0.54.0-dev.6 → 0.54.0-dev.7
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/dist/src/contextManager.d.ts +5 -5
- package/dist/src/contextManager.d.ts.map +1 -1
- package/dist/src/contextManager.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 -4
- package/dist/src/framework/declaration.js.map +1 -1
- package/dist/src/framework/dependency.d.ts.map +1 -1
- 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 +12 -20
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.d.ts +1 -1
- package/dist/src/framework/hooks/sdkTypes.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.js +8 -11
- package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
- package/dist/src/framework/hooks/useDependencies.d.ts.map +1 -1
- package/dist/src/framework/hooks/useDependencies.js +1 -1
- package/dist/src/framework/hooks/useDependencies.js.map +1 -1
- package/dist/src/framework/load-static-helpers.d.ts +1 -1
- package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.js +12 -25
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/framework/reference.d.ts.map +1 -1
- package/dist/src/framework/reference.js +1 -1
- package/dist/src/framework/reference.js.map +1 -1
- package/dist/src/framework/sample.js +8 -8
- package/dist/src/framework/sample.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +47 -48
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +1 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +140 -140
- package/dist/src/lib.js.map +1 -1
- package/dist/src/metaTree.d.ts +1 -1
- package/dist/src/metaTree.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalClient.d.ts +1 -1
- package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalClient.js +49 -62
- package/dist/src/modular/buildClassicalClient.js.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.d.ts +2 -2
- package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.js +4 -7
- package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
- package/dist/src/modular/buildClientContext.d.ts +2 -2
- package/dist/src/modular/buildClientContext.d.ts.map +1 -1
- package/dist/src/modular/buildClientContext.js +30 -36
- package/dist/src/modular/buildClientContext.js.map +1 -1
- package/dist/src/modular/buildModularOptions.d.ts +1 -1
- package/dist/src/modular/buildModularOptions.d.ts.map +1 -1
- package/dist/src/modular/buildModularOptions.js +2 -2
- package/dist/src/modular/buildModularOptions.js.map +1 -1
- package/dist/src/modular/buildOperations.d.ts +3 -3
- package/dist/src/modular/buildOperations.d.ts.map +1 -1
- package/dist/src/modular/buildOperations.js +22 -23
- package/dist/src/modular/buildOperations.js.map +1 -1
- package/dist/src/modular/buildProjectFiles.d.ts +1 -1
- package/dist/src/modular/buildProjectFiles.d.ts.map +1 -1
- package/dist/src/modular/buildProjectFiles.js +7 -9
- package/dist/src/modular/buildProjectFiles.js.map +1 -1
- package/dist/src/modular/buildRestorePoller.d.ts +1 -1
- package/dist/src/modular/buildRestorePoller.d.ts.map +1 -1
- package/dist/src/modular/buildRestorePoller.js +11 -11
- package/dist/src/modular/buildRestorePoller.js.map +1 -1
- package/dist/src/modular/buildRootIndex.d.ts +2 -2
- package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
- package/dist/src/modular/buildRootIndex.js +30 -39
- package/dist/src/modular/buildRootIndex.js.map +1 -1
- package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
- package/dist/src/modular/buildSubpathIndex.js +9 -17
- package/dist/src/modular/buildSubpathIndex.js.map +1 -1
- package/dist/src/modular/emitLoggerFile.d.ts.map +1 -1
- package/dist/src/modular/emitLoggerFile.js +2 -2
- package/dist/src/modular/emitLoggerFile.js.map +1 -1
- package/dist/src/modular/emitModels.d.ts +1 -1
- package/dist/src/modular/emitModels.d.ts.map +1 -1
- package/dist/src/modular/emitModels.js +54 -72
- package/dist/src/modular/emitModels.js.map +1 -1
- package/dist/src/modular/emitModelsOptions.d.ts +1 -1
- package/dist/src/modular/emitModelsOptions.d.ts.map +1 -1
- package/dist/src/modular/emitModelsOptions.js +6 -7
- package/dist/src/modular/emitModelsOptions.js.map +1 -1
- package/dist/src/modular/emitSamples.d.ts.map +1 -1
- package/dist/src/modular/emitSamples.js +40 -52
- package/dist/src/modular/emitSamples.js.map +1 -1
- package/dist/src/modular/emitTests.d.ts.map +1 -1
- package/dist/src/modular/emitTests.js +9 -12
- package/dist/src/modular/emitTests.js.map +1 -1
- package/dist/src/modular/external-dependencies.js +54 -54
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.js +27 -36
- package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.js +20 -38
- package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientOptionHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/clientOptionHelpers.js.map +1 -1
- package/dist/src/modular/helpers/exampleValueHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/exampleValueHelpers.js +39 -58
- package/dist/src/modular/helpers/exampleValueHelpers.js.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.js +4 -5
- package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.js +136 -196
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.js +1 -1
- package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.js +50 -56
- package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.js +52 -59
- package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js +43 -51
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/serializeUtils.d.ts.map +1 -1
- package/dist/src/modular/serialization/serializeUtils.js +4 -11
- package/dist/src/modular/serialization/serializeUtils.js.map +1 -1
- package/dist/src/modular/static-helpers-metadata.js +60 -60
- package/dist/src/modular/type-expressions/get-credential-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-credential-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.js +7 -9
- package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts +1 -1
- 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.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.js +4 -8
- package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.d.ts +1 -1
- 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/rlc-common/buildClient.d.ts +1 -1
- package/dist/src/rlc-common/buildClient.d.ts.map +1 -1
- package/dist/src/rlc-common/buildClient.js +48 -66
- package/dist/src/rlc-common/buildClient.js.map +1 -1
- package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +1 -1
- package/dist/src/rlc-common/buildClientDefinitions.js +24 -42
- package/dist/src/rlc-common/buildClientDefinitions.js.map +1 -1
- package/dist/src/rlc-common/buildIndexFile.d.ts.map +1 -1
- package/dist/src/rlc-common/buildIndexFile.js +57 -57
- package/dist/src/rlc-common/buildIndexFile.js.map +1 -1
- package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js +32 -35
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +1 -1
- package/dist/src/rlc-common/buildLogger.d.ts.map +1 -1
- package/dist/src/rlc-common/buildLogger.js +3 -3
- package/dist/src/rlc-common/buildLogger.js.map +1 -1
- package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +1 -1
- package/dist/src/rlc-common/buildMethodShortcuts.js +3 -3
- package/dist/src/rlc-common/buildMethodShortcuts.js.map +1 -1
- package/dist/src/rlc-common/buildObjectTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildObjectTypes.js +29 -46
- package/dist/src/rlc-common/buildObjectTypes.js.map +1 -1
- package/dist/src/rlc-common/buildPaginateHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildPaginateHelper.js +2 -2
- package/dist/src/rlc-common/buildPaginateHelper.js.map +1 -1
- package/dist/src/rlc-common/buildParameterTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildParameterTypes.js +42 -50
- package/dist/src/rlc-common/buildParameterTypes.js.map +1 -1
- package/dist/src/rlc-common/buildPollingHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildPollingHelper.js +5 -5
- package/dist/src/rlc-common/buildPollingHelper.js.map +1 -1
- package/dist/src/rlc-common/buildResponseTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildResponseTypes.js +19 -22
- package/dist/src/rlc-common/buildResponseTypes.js.map +1 -1
- package/dist/src/rlc-common/buildSamples.d.ts +1 -1
- package/dist/src/rlc-common/buildSamples.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSamples.js +2 -2
- package/dist/src/rlc-common/buildSchemaType.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSchemaType.js +9 -13
- package/dist/src/rlc-common/buildSchemaType.js.map +1 -1
- package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSerializeHelper.js +4 -4
- package/dist/src/rlc-common/buildSerializeHelper.js.map +1 -1
- package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +1 -1
- package/dist/src/rlc-common/buildTopLevelIndexFile.js +9 -13
- package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +1 -1
- package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/apiVersionUtil.js +2 -3
- package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/importsUtil.js +23 -25
- package/dist/src/rlc-common/helpers/importsUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/nameConstructors.js.map +1 -1
- package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/nameUtils.js +8 -13
- package/dist/src/rlc-common/helpers/nameUtils.js.map +1 -1
- package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/operationHelpers.js +8 -12
- package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/pathUtils.js +1 -3
- package/dist/src/rlc-common/helpers/pathUtils.js.map +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.js +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.js +2 -2
- package/dist/src/rlc-common/helpers/shortcutMethods.js.map +1 -1
- package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/typeUtil.js +1 -2
- package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js +3 -4
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +1 -1
- package/dist/src/rlc-common/index.d.ts +28 -28
- package/dist/src/rlc-common/index.d.ts.map +1 -1
- package/dist/src/rlc-common/index.js +28 -28
- package/dist/src/rlc-common/index.js.map +1 -1
- 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/buildApiExtractorConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +13 -13
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildChangelogFile.js +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.js +3 -5
- package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildLicenseFile.js +1 -1
- package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildPackageFile.js +16 -16
- package/dist/src/rlc-common/metadata/buildPackageFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildReadmeFile.js +10 -18
- package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildRollupConfig.js +3 -4
- package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +2 -3
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildTestConfig.js +8 -8
- package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildTsConfig.js +23 -21
- package/dist/src/rlc-common/metadata/buildTsConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildVitestConfig.js +3 -4
- package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildWarpConfig.js +2 -2
- package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +13 -13
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +22 -26
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +15 -16
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +8 -8
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +26 -29
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -1
- package/dist/src/rlc-common/test/buildKarmaConfig.js +1 -1
- package/dist/src/rlc-common/test/buildRecordedClient.js +3 -3
- package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -1
- package/dist/src/rlc-common/test/buildSampleTest.js +2 -2
- package/dist/src/rlc-common/test/buildSampleTest.js.map +1 -1
- package/dist/src/rlc-common/test/buildSnippets.d.ts.map +1 -1
- package/dist/src/rlc-common/test/buildSnippets.js +4 -6
- package/dist/src/rlc-common/test/buildSnippets.js.map +1 -1
- package/dist/src/rlc-common/transformSampleGroups.d.ts.map +1 -1
- package/dist/src/rlc-common/transformSampleGroups.js +19 -23
- package/dist/src/rlc-common/transformSampleGroups.js.map +1 -1
- package/dist/src/testing/index.d.ts.map +1 -1
- package/dist/src/testing/index.js +1 -1
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/transform/transform.d.ts +1 -1
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +10 -11
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.d.ts +1 -1
- package/dist/src/transform/transformApiVersionInfo.d.ts.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.js +8 -10
- package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.d.ts +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.js +9 -11
- package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -1
- package/dist/src/transform/transformParameters.d.ts +2 -2
- package/dist/src/transform/transformParameters.d.ts.map +1 -1
- package/dist/src/transform/transformParameters.js +22 -28
- package/dist/src/transform/transformParameters.js.map +1 -1
- package/dist/src/transform/transformPaths.d.ts +1 -1
- package/dist/src/transform/transformPaths.d.ts.map +1 -1
- package/dist/src/transform/transformPaths.js +11 -12
- package/dist/src/transform/transformPaths.js.map +1 -1
- package/dist/src/transform/transformResponses.d.ts +1 -1
- package/dist/src/transform/transformResponses.d.ts.map +1 -1
- package/dist/src/transform/transformResponses.js +12 -12
- package/dist/src/transform/transformResponses.js.map +1 -1
- package/dist/src/transform/transformSchemas.d.ts.map +1 -1
- package/dist/src/transform/transformSchemas.js +9 -15
- package/dist/src/transform/transformSchemas.js.map +1 -1
- package/dist/src/transform/transformTelemetryInfo.d.ts +1 -1
- package/dist/src/transform/transformTelemetryInfo.d.ts.map +1 -1
- package/dist/src/transform/transformTelemetryInfo.js +3 -3
- package/dist/src/transform/transformTelemetryInfo.js.map +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
- package/dist/src/transform/transfromRLCOptions.js +14 -26
- package/dist/src/transform/transfromRLCOptions.js.map +1 -1
- package/dist/src/utils/clientUtils.d.ts +1 -1
- package/dist/src/utils/clientUtils.d.ts.map +1 -1
- package/dist/src/utils/clientUtils.js +11 -14
- package/dist/src/utils/clientUtils.js.map +1 -1
- package/dist/src/utils/credentialUtils.d.ts +1 -1
- package/dist/src/utils/credentialUtils.d.ts.map +1 -1
- package/dist/src/utils/credentialUtils.js +3 -3
- package/dist/src/utils/credentialUtils.js.map +1 -1
- package/dist/src/utils/crossLanguageDef.d.ts.map +1 -1
- package/dist/src/utils/crossLanguageDef.js +8 -12
- package/dist/src/utils/crossLanguageDef.js.map +1 -1
- package/dist/src/utils/emitUtil.d.ts +1 -1
- package/dist/src/utils/emitUtil.d.ts.map +1 -1
- package/dist/src/utils/emitUtil.js +4 -6
- package/dist/src/utils/emitUtil.js.map +1 -1
- package/dist/src/utils/fileSystemUtils.d.ts.map +1 -1
- package/dist/src/utils/fileSystemUtils.js +2 -2
- package/dist/src/utils/fileSystemUtils.js.map +1 -1
- package/dist/src/utils/importHelper.d.ts.map +1 -1
- package/dist/src/utils/importHelper.js +2 -4
- package/dist/src/utils/importHelper.js.map +1 -1
- package/dist/src/utils/interfaces.d.ts +1 -1
- package/dist/src/utils/interfaces.d.ts.map +1 -1
- package/dist/src/utils/mediaTypes.d.ts.map +1 -1
- package/dist/src/utils/mediaTypes.js +7 -19
- package/dist/src/utils/mediaTypes.js.map +1 -1
- package/dist/src/utils/modelUtils.d.ts +2 -2
- package/dist/src/utils/modelUtils.d.ts.map +1 -1
- package/dist/src/utils/modelUtils.js +107 -170
- package/dist/src/utils/modelUtils.js.map +1 -1
- package/dist/src/utils/namespaceUtils.d.ts.map +1 -1
- package/dist/src/utils/namespaceUtils.js +2 -2
- package/dist/src/utils/namespaceUtils.js.map +1 -1
- package/dist/src/utils/operationUtil.d.ts +1 -1
- package/dist/src/utils/operationUtil.d.ts.map +1 -1
- package/dist/src/utils/operationUtil.js +29 -42
- package/dist/src/utils/operationUtil.js.map +1 -1
- package/dist/src/utils/parameterUtils.d.ts +1 -1
- package/dist/src/utils/parameterUtils.d.ts.map +1 -1
- package/dist/src/utils/parameterUtils.js +19 -22
- package/dist/src/utils/parameterUtils.js.map +1 -1
- package/dist/src/utils/resolve-project-root.js +2 -2
- package/dist/src/utils/resolve-project-root.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -3
- package/src/contextManager.ts +6 -9
- package/src/framework/declaration.ts +18 -28
- package/src/framework/dependency.ts +1 -2
- package/src/framework/hooks/binder.ts +47 -120
- package/src/framework/hooks/sdkTypes.ts +27 -54
- package/src/framework/hooks/useDependencies.ts +2 -4
- package/src/framework/load-static-helpers.ts +28 -51
- package/src/framework/reference.ts +2 -5
- package/src/framework/sample.ts +9 -9
- package/src/index.ts +111 -180
- package/src/lib.ts +143 -158
- package/src/metaTree.ts +1 -1
- package/src/modular/buildClassicalClient.ts +83 -160
- package/src/modular/buildClassicalOperationGroups.ts +14 -39
- package/src/modular/buildClientContext.ts +54 -83
- package/src/modular/buildModularOptions.ts +4 -5
- package/src/modular/buildOperations.ts +46 -73
- package/src/modular/buildProjectFiles.ts +18 -47
- package/src/modular/buildRestorePoller.ts +27 -46
- package/src/modular/buildRootIndex.ts +86 -159
- package/src/modular/buildSubpathIndex.ts +35 -58
- package/src/modular/emitLoggerFile.ts +4 -9
- package/src/modular/emitModels.ts +136 -266
- package/src/modular/emitModelsOptions.ts +10 -16
- package/src/modular/emitSamples.ts +91 -177
- package/src/modular/emitTests.ts +28 -61
- package/src/modular/external-dependencies.ts +54 -54
- package/src/modular/helpers/classicalOperationHelpers.ts +73 -126
- package/src/modular/helpers/clientHelpers.ts +41 -88
- package/src/modular/helpers/clientOptionHelpers.ts +4 -11
- package/src/modular/helpers/exampleValueHelpers.ts +97 -209
- package/src/modular/helpers/namingHelpers.ts +12 -28
- package/src/modular/helpers/operationHelpers.ts +430 -757
- package/src/modular/helpers/typeHelpers.ts +11 -22
- package/src/modular/serialization/buildDeserializerFunction.ts +88 -122
- package/src/modular/serialization/buildSerializerFunction.ts +91 -129
- package/src/modular/serialization/buildXmlSerializerFunction.ts +104 -183
- package/src/modular/serialization/serializeUtils.ts +12 -21
- package/src/modular/static/rollup.test.config.js +11 -14
- package/src/modular/static/scripts/renameOutput.mjs +2 -2
- package/src/modular/static-helpers-metadata.ts +60 -60
- package/src/modular/type-expressions/get-credential-expression.ts +1 -1
- package/src/modular/type-expressions/get-enum-expression.ts +5 -10
- package/src/modular/type-expressions/get-model-expression.ts +13 -17
- package/src/modular/type-expressions/get-nullable-expression.ts +4 -5
- package/src/modular/type-expressions/get-type-expression.ts +8 -12
- package/src/modular/type-expressions/get-union-expression.ts +4 -4
- package/src/modular/type-expressions/utils.ts +1 -1
- package/src/rlc-common/buildClient.ts +70 -141
- package/src/rlc-common/buildClientDefinitions.ts +43 -87
- package/src/rlc-common/buildIndexFile.ts +78 -78
- package/src/rlc-common/buildIsUnexpectedHelper.ts +34 -41
- package/src/rlc-common/buildLogger.ts +7 -7
- package/src/rlc-common/buildMethodShortcuts.ts +9 -21
- package/src/rlc-common/buildObjectTypes.ts +78 -155
- package/src/rlc-common/buildPaginateHelper.ts +9 -12
- package/src/rlc-common/buildParameterTypes.ts +92 -137
- package/src/rlc-common/buildPollingHelper.ts +7 -7
- package/src/rlc-common/buildResponseTypes.ts +34 -57
- package/src/rlc-common/buildSamples.ts +3 -3
- package/src/rlc-common/buildSchemaType.ts +12 -29
- package/src/rlc-common/buildSerializeHelper.ts +5 -5
- package/src/rlc-common/buildTopLevelIndexFile.ts +12 -19
- package/src/rlc-common/helpers/apiVersionUtil.ts +5 -10
- package/src/rlc-common/helpers/importsUtil.ts +27 -30
- package/src/rlc-common/helpers/nameConstructors.ts +16 -50
- package/src/rlc-common/helpers/nameUtils.ts +19 -42
- package/src/rlc-common/helpers/operationHelpers.ts +14 -31
- package/src/rlc-common/helpers/pathUtils.ts +2 -7
- package/src/rlc-common/helpers/schemaHelpers.ts +4 -15
- package/src/rlc-common/helpers/shortcutMethods.ts +6 -15
- package/src/rlc-common/helpers/typeUtil.ts +4 -11
- package/src/rlc-common/helpers/valueGenerationUtil.ts +16 -39
- package/src/rlc-common/index.ts +28 -28
- package/src/rlc-common/interfaces.ts +3 -11
- package/src/rlc-common/metadata/buildApiExtractorConfig.ts +17 -24
- package/src/rlc-common/metadata/buildChangelogFile.ts +1 -1
- package/src/rlc-common/metadata/buildESLintConfig.ts +3 -5
- package/src/rlc-common/metadata/buildLicenseFile.ts +1 -1
- package/src/rlc-common/metadata/buildPackageFile.ts +27 -35
- package/src/rlc-common/metadata/buildReadmeFile.ts +16 -29
- package/src/rlc-common/metadata/buildRollupConfig.ts +5 -8
- package/src/rlc-common/metadata/buildSampleEnvFile.ts +2 -3
- package/src/rlc-common/metadata/buildTestConfig.ts +10 -10
- package/src/rlc-common/metadata/buildTsConfig.ts +32 -35
- package/src/rlc-common/metadata/buildVitestConfig.ts +4 -10
- package/src/rlc-common/metadata/buildWarpConfig.ts +3 -6
- package/src/rlc-common/metadata/packageJson/azurePackageCommon.ts +16 -25
- package/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts +29 -50
- package/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.ts +20 -31
- package/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.ts +11 -13
- package/src/rlc-common/metadata/packageJson/packageCommon.ts +32 -52
- package/src/rlc-common/test/buildKarmaConfig.ts +1 -1
- package/src/rlc-common/test/buildRecordedClient.ts +3 -3
- package/src/rlc-common/test/buildSampleTest.ts +3 -3
- package/src/rlc-common/test/buildSnippets.ts +6 -12
- package/src/rlc-common/transformSampleGroups.ts +54 -105
- package/src/testing/index.ts +2 -5
- package/src/transform/transform.ts +22 -34
- package/src/transform/transformApiVersionInfo.ts +17 -30
- package/src/transform/transformHelperFunctionDetails.ts +14 -26
- package/src/transform/transformParameters.ts +55 -105
- package/src/transform/transformPaths.ts +26 -43
- package/src/transform/transformResponses.ts +26 -33
- package/src/transform/transformSchemas.ts +15 -33
- package/src/transform/transformTelemetryInfo.ts +8 -14
- package/src/transform/transfromRLCOptions.ts +53 -115
- package/src/utils/clientUtils.ts +22 -41
- package/src/utils/credentialUtils.ts +8 -19
- package/src/utils/crossLanguageDef.ts +15 -34
- package/src/utils/emitUtil.ts +11 -17
- package/src/utils/fileSystemUtils.ts +4 -6
- package/src/utils/importHelper.ts +5 -10
- package/src/utils/interfaces.ts +1 -1
- package/src/utils/mediaTypes.ts +13 -34
- package/src/utils/modelUtils.ts +174 -383
- package/src/utils/namespaceUtils.ts +8 -24
- package/src/utils/operationUtil.ts +98 -190
- package/src/utils/parameterUtils.ts +31 -54
- package/src/utils/resolve-project-root.ts +3 -3
- package/static/static-helpers/cloudSettingHelpers.ts +4 -6
- package/static/static-helpers/multipartHelpers.ts +3 -3
- package/static/static-helpers/pagingHelpers.ts +28 -63
- package/static/static-helpers/pollingHelpers.ts +15 -28
- package/static/static-helpers/serialization/build-multi-collection.ts +1 -4
- package/static/static-helpers/serialization/check-prop-undefined.ts +1 -4
- package/static/static-helpers/serialization/get-binary-response.ts +2 -2
- package/static/static-helpers/serialization/get-binary-stream-response.ts +2 -4
- package/static/static-helpers/serialization/serialize-record.ts +1 -1
- package/static/static-helpers/serialization/serializers.ts +4 -7
- package/static/static-helpers/serialization/xml-helpers.ts +41 -89
- package/static/static-helpers/simplePollerHelpers.ts +9 -18
- package/static/static-helpers/storageCompatResponse.ts +10 -27
- package/static/static-helpers/urlTemplate.ts +4 -7
- package/static/test-helpers/recordedClient.ts +5 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-ts",
|
|
3
|
-
"version": "0.54.0-dev.
|
|
3
|
+
"version": "0.54.0-dev.7",
|
|
4
4
|
"description": "An experimental TypeSpec emitter for TypeScript RLC",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -99,8 +99,6 @@
|
|
|
99
99
|
"lint:fix": "eslint src --fix --ext .ts",
|
|
100
100
|
"check:tree": "tsx ./test/commands/check-clean-tree.ts",
|
|
101
101
|
"test:ts:e2e": "npm run copy:typespec && npm run integration-test-ci:azure-rlc && npm run integration-test-ci:azure-modular",
|
|
102
|
-
"format": "npm run -s prettier -- --write",
|
|
103
|
-
"check-format": "npm run prettier -- --check",
|
|
104
102
|
"prettier": "prettier --config ./.prettierrc \"{src,test,static}/**/*.ts\" \"!test/**/generated/**/*.ts\"",
|
|
105
103
|
"integration-test-ci": "npm-run-all copy:typespec integration-test-ci:rlc integration-test-ci:azure-rlc integration-test-ci:modular integration-test-ci:azure-modular",
|
|
106
104
|
"integration-test-ci:sequential": "npm-run-all --serial copy:typespec integration-test-ci:modular && npm run integration-test-ci:modular",
|
package/src/contextManager.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Project, SourceFile } from "ts-morph";
|
|
2
|
-
import { RlcMetaTree } from "./metaTree.js";
|
|
3
|
-
import { EmitContext } from "@typespec/compiler";
|
|
4
1
|
import { SdkContext } from "@azure-tools/typespec-client-generator-core";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { EmitContext } from "@typespec/compiler";
|
|
3
|
+
import { Project, SourceFile } from "ts-morph";
|
|
7
4
|
import { ExternalDependencies } from "./framework/dependency.js";
|
|
5
|
+
import { Binder } from "./framework/hooks/binder.js";
|
|
6
|
+
import { SdkTypeContext } from "./framework/hooks/sdkTypes.js";
|
|
7
|
+
import { RlcMetaTree } from "./metaTree.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Contexts Object Guidelines
|
|
@@ -96,9 +96,6 @@ export function useContext<K extends ContextKey>(key: K): Contexts[K] {
|
|
|
96
96
|
* @param {ContextKey} key - The key of the context to provide.
|
|
97
97
|
* @param {Contexts[K]} value - The value to set for the specified context.
|
|
98
98
|
*/
|
|
99
|
-
export function provideContext<K extends ContextKey>(
|
|
100
|
-
key: K,
|
|
101
|
-
value: Contexts[K]
|
|
102
|
-
): void {
|
|
99
|
+
export function provideContext<K extends ContextKey>(key: K, value: Contexts[K]): void {
|
|
103
100
|
contextManager.setContext(key, value);
|
|
104
101
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
ClassDeclaration,
|
|
3
3
|
ClassDeclarationStructure,
|
|
4
|
+
EnumDeclaration,
|
|
4
5
|
EnumDeclarationStructure,
|
|
6
|
+
FunctionDeclaration,
|
|
5
7
|
FunctionDeclarationStructure,
|
|
8
|
+
InterfaceDeclaration,
|
|
6
9
|
InterfaceDeclarationStructure,
|
|
7
|
-
|
|
10
|
+
SourceFile,
|
|
8
11
|
StructureKind,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
FunctionDeclaration,
|
|
12
|
-
InterfaceDeclaration,
|
|
13
|
-
TypeAliasDeclaration
|
|
12
|
+
TypeAliasDeclaration,
|
|
13
|
+
TypeAliasDeclarationStructure,
|
|
14
14
|
} from "ts-morph";
|
|
15
15
|
import { useBinder } from "./hooks/binder.js";
|
|
16
16
|
import { refkey as getRefKey } from "./refkey.js";
|
|
@@ -31,58 +31,50 @@ export type Declarations =
|
|
|
31
31
|
export function addDeclaration(
|
|
32
32
|
sourceFile: SourceFile,
|
|
33
33
|
declaration: ClassDeclarationStructure,
|
|
34
|
-
refkey: unknown
|
|
34
|
+
refkey: unknown,
|
|
35
35
|
): void;
|
|
36
36
|
|
|
37
37
|
export function addDeclaration(
|
|
38
38
|
sourceFile: SourceFile,
|
|
39
39
|
declaration: EnumDeclarationStructure,
|
|
40
|
-
refkey: unknown
|
|
40
|
+
refkey: unknown,
|
|
41
41
|
): void;
|
|
42
42
|
|
|
43
43
|
export function addDeclaration(
|
|
44
44
|
sourceFile: SourceFile,
|
|
45
45
|
declaration: FunctionDeclarationStructure,
|
|
46
|
-
refkey: unknown
|
|
46
|
+
refkey: unknown,
|
|
47
47
|
): void;
|
|
48
48
|
|
|
49
49
|
export function addDeclaration(
|
|
50
50
|
sourceFile: SourceFile,
|
|
51
51
|
declaration: InterfaceDeclarationStructure,
|
|
52
|
-
refkey: unknown
|
|
52
|
+
refkey: unknown,
|
|
53
53
|
): void;
|
|
54
54
|
|
|
55
55
|
export function addDeclaration(
|
|
56
56
|
sourceFile: SourceFile,
|
|
57
57
|
declaration: TypeAliasDeclarationStructure,
|
|
58
|
-
refkey: unknown
|
|
59
|
-
): void;
|
|
60
|
-
export function addDeclaration(
|
|
61
|
-
sourceFile: SourceFile,
|
|
62
|
-
declaration: string,
|
|
63
|
-
refkey: unknown
|
|
58
|
+
refkey: unknown,
|
|
64
59
|
): void;
|
|
60
|
+
export function addDeclaration(sourceFile: SourceFile, declaration: string, refkey: unknown): void;
|
|
65
61
|
export function addDeclaration(
|
|
66
62
|
sourceFile: SourceFile,
|
|
67
63
|
input: DeclarationStructures | string,
|
|
68
|
-
refkey: unknown
|
|
64
|
+
refkey: unknown,
|
|
69
65
|
): void {
|
|
70
66
|
const binder = useBinder();
|
|
71
67
|
const declaration: DeclarationStructures =
|
|
72
|
-
typeof input === "string"
|
|
73
|
-
? ({ name: input, kind: StructureKind.TypeAlias } as any)
|
|
74
|
-
: input;
|
|
68
|
+
typeof input === "string" ? ({ name: input, kind: StructureKind.TypeAlias } as any) : input;
|
|
75
69
|
if (!declaration.name) {
|
|
76
|
-
throw new Error(
|
|
77
|
-
`Declaration must have a name ${JSON.stringify(declaration)}`
|
|
78
|
-
);
|
|
70
|
+
throw new Error(`Declaration must have a name ${JSON.stringify(declaration)}`);
|
|
79
71
|
}
|
|
80
72
|
|
|
81
73
|
const stringRefkey = typeof refkey === "string" ? refkey : getRefKey(refkey);
|
|
82
74
|
const trackedDeclarationName = binder.trackDeclaration(
|
|
83
75
|
stringRefkey,
|
|
84
76
|
declaration.name,
|
|
85
|
-
sourceFile
|
|
77
|
+
sourceFile,
|
|
86
78
|
);
|
|
87
79
|
|
|
88
80
|
// Update the declaration name to be unique
|
|
@@ -107,8 +99,6 @@ export function addDeclaration(
|
|
|
107
99
|
}
|
|
108
100
|
break;
|
|
109
101
|
default:
|
|
110
|
-
throw new Error(
|
|
111
|
-
`Unsupported declaration kind ${(trackedDeclaration as any).kind}`
|
|
112
|
-
);
|
|
102
|
+
throw new Error(`Unsupported declaration kind ${(trackedDeclaration as any).kind}`);
|
|
113
103
|
}
|
|
114
104
|
}
|
|
@@ -5,8 +5,7 @@ export interface ReferenceableSymbol {
|
|
|
5
5
|
visibility?: "internal" | "public";
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export type ExternalDependencies = CoreDependencies &
|
|
9
|
-
Record<string, ReferenceableSymbol>;
|
|
8
|
+
export type ExternalDependencies = CoreDependencies & Record<string, ReferenceableSymbol>;
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* This interface defines the well known Core dependencies that plugins can use to override and provide their own implementations if needed
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
+
import { normalizePath } from "@typespec/compiler";
|
|
2
|
+
import path from "path/posix";
|
|
1
3
|
import {
|
|
2
|
-
SourceFile,
|
|
3
4
|
ImportDeclarationStructure,
|
|
4
|
-
StructureKind,
|
|
5
5
|
ImportSpecifierStructure,
|
|
6
|
-
Project
|
|
6
|
+
Project,
|
|
7
|
+
SourceFile,
|
|
8
|
+
StructureKind,
|
|
7
9
|
} from "ts-morph";
|
|
8
10
|
import { provideContext, useContext } from "../../contextManager.js";
|
|
11
|
+
import { generateLocallyUniqueName } from "../../modular/helpers/namingHelpers.js";
|
|
9
12
|
import { ReferenceableSymbol } from "../dependency.js";
|
|
10
|
-
import {
|
|
13
|
+
import { SourceFileSymbol, StaticHelperMetadata } from "../load-static-helpers.js";
|
|
11
14
|
import { refkey } from "../refkey.js";
|
|
12
|
-
import {
|
|
13
|
-
SourceFileSymbol,
|
|
14
|
-
StaticHelperMetadata
|
|
15
|
-
} from "../load-static-helpers.js";
|
|
16
|
-
import path from "path/posix";
|
|
17
|
-
import { normalizePath } from "@typespec/compiler";
|
|
18
|
-
import { generateLocallyUniqueName } from "../../modular/helpers/namingHelpers.js";
|
|
15
|
+
import { provideDependencies, useDependencies } from "./useDependencies.js";
|
|
19
16
|
|
|
20
17
|
export interface DeclarationInfo {
|
|
21
18
|
name: string;
|
|
@@ -39,11 +36,7 @@ export interface Binder {
|
|
|
39
36
|
* @param sourceFile - The source file where the declaration is made.
|
|
40
37
|
* @returns The tracked declaration name.
|
|
41
38
|
*/
|
|
42
|
-
trackDeclaration(
|
|
43
|
-
refkey: unknown,
|
|
44
|
-
name: string,
|
|
45
|
-
sourceFile: SourceFile
|
|
46
|
-
): string;
|
|
39
|
+
trackDeclaration(refkey: unknown, name: string, sourceFile: SourceFile): string;
|
|
47
40
|
resolveReference(refkey: unknown): string;
|
|
48
41
|
resolveAllReferences(sourceRoot: string, testRoot?: string): void;
|
|
49
42
|
}
|
|
@@ -69,15 +62,8 @@ class BinderImp implements Binder {
|
|
|
69
62
|
this.useSubpathImports = options.useSubpathImports ?? false;
|
|
70
63
|
}
|
|
71
64
|
|
|
72
|
-
trackDeclaration(
|
|
73
|
-
|
|
74
|
-
name: string,
|
|
75
|
-
sourceFile: SourceFile
|
|
76
|
-
): string {
|
|
77
|
-
const uniqueName = this.generateLocallyUniqueDeclarationName(
|
|
78
|
-
name,
|
|
79
|
-
sourceFile
|
|
80
|
-
);
|
|
65
|
+
trackDeclaration(refkey: unknown, name: string, sourceFile: SourceFile): string {
|
|
66
|
+
const uniqueName = this.generateLocallyUniqueDeclarationName(name, sourceFile);
|
|
81
67
|
const declarationInfo: DeclarationInfo = { name: uniqueName, sourceFile };
|
|
82
68
|
this.declarations.set(refkey, declarationInfo);
|
|
83
69
|
|
|
@@ -96,12 +82,8 @@ class BinderImp implements Binder {
|
|
|
96
82
|
* @param sourceFile - The source file where the declaration is made.
|
|
97
83
|
* @returns A unique name for the declaration within the file.
|
|
98
84
|
*/
|
|
99
|
-
private generateLocallyUniqueDeclarationName(
|
|
100
|
-
|
|
101
|
-
sourceFile: SourceFile
|
|
102
|
-
): string {
|
|
103
|
-
const existingNamesInFile =
|
|
104
|
-
this.symbolsBySourceFile.get(sourceFile) ?? new Set<string>();
|
|
85
|
+
private generateLocallyUniqueDeclarationName(name: string, sourceFile: SourceFile): string {
|
|
86
|
+
const existingNamesInFile = this.symbolsBySourceFile.get(sourceFile) ?? new Set<string>();
|
|
105
87
|
return generateLocallyUniqueName(name, existingNamesInFile);
|
|
106
88
|
}
|
|
107
89
|
|
|
@@ -111,10 +93,7 @@ class BinderImp implements Binder {
|
|
|
111
93
|
* @param sourceFile - The source file where the import is made.
|
|
112
94
|
* @returns A unique name for the import within the file.
|
|
113
95
|
*/
|
|
114
|
-
private generateLocallyUniqueImportName(
|
|
115
|
-
name: string,
|
|
116
|
-
sourceFile: SourceFile
|
|
117
|
-
): string {
|
|
96
|
+
private generateLocallyUniqueImportName(name: string, sourceFile: SourceFile): string {
|
|
118
97
|
const existingImports = (this.imports.get(sourceFile) ?? [])
|
|
119
98
|
.flatMap((i) => i.namedImports as ImportSpecifierStructure[])
|
|
120
99
|
.map((i) => i.alias ?? i.name);
|
|
@@ -123,15 +102,12 @@ class BinderImp implements Binder {
|
|
|
123
102
|
const actualImports = sourceFile
|
|
124
103
|
.getImportDeclarations()
|
|
125
104
|
.flatMap((imp) => imp.getNamedImports())
|
|
126
|
-
.map(
|
|
127
|
-
(namedImp) => namedImp.getAliasNode()?.getText() ?? namedImp.getName()
|
|
128
|
-
);
|
|
105
|
+
.map((namedImp) => namedImp.getAliasNode()?.getText() ?? namedImp.getName());
|
|
129
106
|
|
|
130
|
-
const existingDeclarations =
|
|
131
|
-
this.symbolsBySourceFile.get(sourceFile) ?? new Set<string>();
|
|
107
|
+
const existingDeclarations = this.symbolsBySourceFile.get(sourceFile) ?? new Set<string>();
|
|
132
108
|
return generateLocallyUniqueName(
|
|
133
109
|
name,
|
|
134
|
-
new Set([...existingImports, ...actualImports, ...existingDeclarations])
|
|
110
|
+
new Set([...existingImports, ...actualImports, ...existingDeclarations]),
|
|
135
111
|
);
|
|
136
112
|
}
|
|
137
113
|
|
|
@@ -166,12 +142,9 @@ class BinderImp implements Binder {
|
|
|
166
142
|
private addImport(
|
|
167
143
|
fileWhereImportIsAdded: SourceFile,
|
|
168
144
|
fileWhereImportPointsTo: SourceFile | string,
|
|
169
|
-
name: string
|
|
145
|
+
name: string,
|
|
170
146
|
): ImportSpecifierStructure {
|
|
171
|
-
const importAlias = this.generateLocallyUniqueImportName(
|
|
172
|
-
name,
|
|
173
|
-
fileWhereImportIsAdded
|
|
174
|
-
);
|
|
147
|
+
const importAlias = this.generateLocallyUniqueImportName(name, fileWhereImportIsAdded);
|
|
175
148
|
let moduleSpecifier = "";
|
|
176
149
|
if (typeof fileWhereImportPointsTo === "string") {
|
|
177
150
|
moduleSpecifier = fileWhereImportPointsTo;
|
|
@@ -180,35 +153,30 @@ class BinderImp implements Binder {
|
|
|
180
153
|
.getRelativePathTo(fileWhereImportPointsTo)
|
|
181
154
|
.replace(".ts", ".js");
|
|
182
155
|
moduleSpecifier =
|
|
183
|
-
relative.startsWith(".") || relative.startsWith("/")
|
|
184
|
-
? relative
|
|
185
|
-
: `./${relative}`;
|
|
156
|
+
relative.startsWith(".") || relative.startsWith("/") ? relative : `./${relative}`;
|
|
186
157
|
}
|
|
187
158
|
|
|
188
159
|
const importStructures = this.imports.get(fileWhereImportIsAdded) || [];
|
|
189
160
|
|
|
190
|
-
let importStructure = importStructures.find(
|
|
191
|
-
(imp) => imp.moduleSpecifier === moduleSpecifier
|
|
192
|
-
);
|
|
161
|
+
let importStructure = importStructures.find((imp) => imp.moduleSpecifier === moduleSpecifier);
|
|
193
162
|
|
|
194
163
|
if (!importStructure) {
|
|
195
164
|
importStructure = {
|
|
196
165
|
kind: StructureKind.ImportDeclaration,
|
|
197
166
|
moduleSpecifier,
|
|
198
|
-
namedImports: []
|
|
167
|
+
namedImports: [],
|
|
199
168
|
};
|
|
200
169
|
importStructures.push(importStructure);
|
|
201
170
|
}
|
|
202
171
|
|
|
203
|
-
const namedImports =
|
|
204
|
-
importStructure.namedImports as ImportSpecifierStructure[];
|
|
172
|
+
const namedImports = importStructure.namedImports as ImportSpecifierStructure[];
|
|
205
173
|
let importSpecifier = namedImports.find((n) => n.name === importAlias);
|
|
206
174
|
|
|
207
175
|
if (!importSpecifier) {
|
|
208
176
|
importSpecifier = {
|
|
209
177
|
name: name,
|
|
210
178
|
alias: name === importAlias ? undefined : importAlias,
|
|
211
|
-
kind: StructureKind.ImportSpecifier
|
|
179
|
+
kind: StructureKind.ImportSpecifier,
|
|
212
180
|
};
|
|
213
181
|
namedImports.push(importSpecifier);
|
|
214
182
|
}
|
|
@@ -225,21 +193,15 @@ class BinderImp implements Binder {
|
|
|
225
193
|
* e.g. "src/static-helpers/serialization/get-binary-response.ts"
|
|
226
194
|
* -> "#platform/static-helpers/serialization/get-binary-response"
|
|
227
195
|
*/
|
|
228
|
-
private getPlatformImportSpecifier(
|
|
229
|
-
declarationSourceFile: SourceFile
|
|
230
|
-
): string | undefined {
|
|
196
|
+
private getPlatformImportSpecifier(declarationSourceFile: SourceFile): string | undefined {
|
|
231
197
|
if (!this.useSubpathImports) return undefined;
|
|
232
198
|
const filePath = declarationSourceFile.getFilePath();
|
|
233
199
|
const srcIndex = filePath.indexOf("/src/");
|
|
234
200
|
if (srcIndex === -1) return undefined;
|
|
235
201
|
// Check if a -browser.mts or -react-native.mts sibling exists
|
|
236
202
|
const basePath = filePath.replace(/\.ts$/, "");
|
|
237
|
-
const hasBrowserVariant = this.project.getSourceFile(
|
|
238
|
-
|
|
239
|
-
);
|
|
240
|
-
const hasReactNativeVariant = this.project.getSourceFile(
|
|
241
|
-
basePath + "-react-native.mts"
|
|
242
|
-
);
|
|
203
|
+
const hasBrowserVariant = this.project.getSourceFile(basePath + "-browser.mts");
|
|
204
|
+
const hasReactNativeVariant = this.project.getSourceFile(basePath + "-react-native.mts");
|
|
243
205
|
if (!hasBrowserVariant && !hasReactNativeVariant) return undefined;
|
|
244
206
|
const relativePath = filePath.substring(srcIndex + "/src/".length);
|
|
245
207
|
return "#platform/" + relativePath.replace(/\.ts$/, "");
|
|
@@ -255,23 +217,14 @@ class BinderImp implements Binder {
|
|
|
255
217
|
[unknown, DeclarationInfo | StaticHelperMetadata]
|
|
256
218
|
>();
|
|
257
219
|
for (const [key, value] of this.declarations) {
|
|
258
|
-
declarationByPlaceholder.set(this.serializePlaceholder(key), [
|
|
259
|
-
key,
|
|
260
|
-
value
|
|
261
|
-
]);
|
|
220
|
+
declarationByPlaceholder.set(this.serializePlaceholder(key), [key, value]);
|
|
262
221
|
}
|
|
263
222
|
for (const [key, value] of this.staticHelpers) {
|
|
264
|
-
declarationByPlaceholder.set(this.serializePlaceholder(key), [
|
|
265
|
-
key,
|
|
266
|
-
value
|
|
267
|
-
]);
|
|
223
|
+
declarationByPlaceholder.set(this.serializePlaceholder(key), [key, value]);
|
|
268
224
|
}
|
|
269
225
|
const dependencyByPlaceholder = new Map<string, ReferenceableSymbol>();
|
|
270
226
|
for (const dependency of Object.values(this.dependencies)) {
|
|
271
|
-
dependencyByPlaceholder.set(
|
|
272
|
-
this.serializePlaceholder(refkey(dependency)),
|
|
273
|
-
dependency
|
|
274
|
-
);
|
|
227
|
+
dependencyByPlaceholder.set(this.serializePlaceholder(refkey(dependency)), dependency);
|
|
275
228
|
}
|
|
276
229
|
|
|
277
230
|
this.project.getSourceFiles().map((file) => {
|
|
@@ -285,13 +238,13 @@ class BinderImp implements Binder {
|
|
|
285
238
|
file,
|
|
286
239
|
declarationByPlaceholder,
|
|
287
240
|
presentPlaceholders,
|
|
288
|
-
replacementMap
|
|
241
|
+
replacementMap,
|
|
289
242
|
);
|
|
290
243
|
this.resolveDependencyReferences(
|
|
291
244
|
file,
|
|
292
245
|
dependencyByPlaceholder,
|
|
293
246
|
presentPlaceholders,
|
|
294
|
-
replacementMap
|
|
247
|
+
replacementMap,
|
|
295
248
|
);
|
|
296
249
|
if (replacementMap.size > 0) {
|
|
297
250
|
applyReplacements(file, replacementMap);
|
|
@@ -300,9 +253,7 @@ class BinderImp implements Binder {
|
|
|
300
253
|
const importStructures = this.imports.get(file);
|
|
301
254
|
if (importStructures && importStructures.length > 0) {
|
|
302
255
|
// Sort imports in place by module specifier to ensure consistent ordering
|
|
303
|
-
importStructures.sort((a, b) =>
|
|
304
|
-
a.moduleSpecifier < b.moduleSpecifier ? -1 : 1
|
|
305
|
-
);
|
|
256
|
+
importStructures.sort((a, b) => (a.moduleSpecifier < b.moduleSpecifier ? -1 : 1));
|
|
306
257
|
file.addImportDeclarations(importStructures);
|
|
307
258
|
}
|
|
308
259
|
});
|
|
@@ -322,7 +273,7 @@ class BinderImp implements Binder {
|
|
|
322
273
|
file: SourceFile,
|
|
323
274
|
dependencyByPlaceholder: Map<string, ReferenceableSymbol>,
|
|
324
275
|
presentPlaceholders: Set<string>,
|
|
325
|
-
replacementMap: Map<string, string
|
|
276
|
+
replacementMap: Map<string, string>,
|
|
326
277
|
) {
|
|
327
278
|
for (const [placeholder, dependency] of dependencyByPlaceholder) {
|
|
328
279
|
if (!presentPlaceholders.has(placeholder)) {
|
|
@@ -346,17 +297,11 @@ class BinderImp implements Binder {
|
|
|
346
297
|
*/
|
|
347
298
|
private resolveDeclarationReferences(
|
|
348
299
|
file: SourceFile,
|
|
349
|
-
declarationByPlaceholder: Map<
|
|
350
|
-
string,
|
|
351
|
-
[unknown, DeclarationInfo | StaticHelperMetadata]
|
|
352
|
-
>,
|
|
300
|
+
declarationByPlaceholder: Map<string, [unknown, DeclarationInfo | StaticHelperMetadata]>,
|
|
353
301
|
presentPlaceholders: Set<string>,
|
|
354
|
-
replacementMap: Map<string, string
|
|
302
|
+
replacementMap: Map<string, string>,
|
|
355
303
|
) {
|
|
356
|
-
for (const [
|
|
357
|
-
placeholderKey,
|
|
358
|
-
[declarationKey, declaration]
|
|
359
|
-
] of declarationByPlaceholder) {
|
|
304
|
+
for (const [placeholderKey, [declarationKey, declaration]] of declarationByPlaceholder) {
|
|
360
305
|
if (!presentPlaceholders.has(placeholderKey)) {
|
|
361
306
|
continue;
|
|
362
307
|
}
|
|
@@ -373,9 +318,7 @@ class BinderImp implements Binder {
|
|
|
373
318
|
if (file !== declarationSourceFile) {
|
|
374
319
|
this.trackReference(declarationKey, file);
|
|
375
320
|
// Use #platform/ subpath import specifier for static helpers in warp packages
|
|
376
|
-
const platformSpecifier = this.getPlatformImportSpecifier(
|
|
377
|
-
declarationSourceFile
|
|
378
|
-
);
|
|
321
|
+
const platformSpecifier = this.getPlatformImportSpecifier(declarationSourceFile);
|
|
379
322
|
const importTarget = platformSpecifier ?? declarationSourceFile;
|
|
380
323
|
const importDec = this.addImport(file, importTarget, name);
|
|
381
324
|
name = importDec.alias ?? name;
|
|
@@ -399,7 +342,7 @@ class BinderImp implements Binder {
|
|
|
399
342
|
if (!sourceFile) {
|
|
400
343
|
// This should be unreachable
|
|
401
344
|
throw new Error(
|
|
402
|
-
`Static helper ${helper.name} does not have a source file. Make sure that loadStaticHelpers has been correctly initialized in index.ts
|
|
345
|
+
`Static helper ${helper.name} does not have a source file. Make sure that loadStaticHelpers has been correctly initialized in index.ts`,
|
|
403
346
|
);
|
|
404
347
|
}
|
|
405
348
|
const referencedHelper = this.references.get(refkey(helper));
|
|
@@ -411,11 +354,9 @@ class BinderImp implements Binder {
|
|
|
411
354
|
|
|
412
355
|
// Also keep files that are imported by any used helper file
|
|
413
356
|
const helperFiles = this.project.getSourceFiles(
|
|
414
|
-
normalizePath(path.join(sourceRoot, "static-helpers/**/*.*ts"))
|
|
415
|
-
);
|
|
416
|
-
const usedFiles = helperFiles.filter(
|
|
417
|
-
(file) => !isFileUnused(file, usedHelperNames)
|
|
357
|
+
normalizePath(path.join(sourceRoot, "static-helpers/**/*.*ts")),
|
|
418
358
|
);
|
|
359
|
+
const usedFiles = helperFiles.filter((file) => !isFileUnused(file, usedHelperNames));
|
|
419
360
|
for (const usedFile of usedFiles) {
|
|
420
361
|
for (const importDecl of usedFile.getImportDeclarations()) {
|
|
421
362
|
const resolved = importDecl.getModuleSpecifierSourceFile();
|
|
@@ -437,19 +378,14 @@ class BinderImp implements Binder {
|
|
|
437
378
|
}
|
|
438
379
|
this.project
|
|
439
380
|
//normalizae the final path to adapt to different systems
|
|
440
|
-
.getSourceFiles(
|
|
441
|
-
normalizePath(path.join(testRoot, "test/generated/util/**/*.*ts"))
|
|
442
|
-
)
|
|
381
|
+
.getSourceFiles(normalizePath(path.join(testRoot, "test/generated/util/**/*.*ts")))
|
|
443
382
|
.filter((file) => isFileUnused(file, usedHelperNames))
|
|
444
383
|
.forEach((helperFile) => helperFile.delete());
|
|
445
384
|
}
|
|
446
385
|
}
|
|
447
386
|
|
|
448
387
|
// Provide the binder context to be used globally
|
|
449
|
-
export function provideBinder(
|
|
450
|
-
project: Project,
|
|
451
|
-
options: BinderOptions = {}
|
|
452
|
-
): Binder {
|
|
388
|
+
export function provideBinder(project: Project, options: BinderOptions = {}): Binder {
|
|
453
389
|
const binder = new BinderImp(project, options);
|
|
454
390
|
provideContext("binder", binder);
|
|
455
391
|
return binder;
|
|
@@ -460,7 +396,7 @@ function isFileUnused(file: SourceFile, usedHelperNames: string[]) {
|
|
|
460
396
|
// A file is used if it matches a used helper name exactly,
|
|
461
397
|
// or is a platform-specific variant (e.g. "foo-browser" for helper "foo")
|
|
462
398
|
return !usedHelperNames.some(
|
|
463
|
-
(s) => name === s || name === `${s}-browser` || name === `${s}-react-native
|
|
399
|
+
(s) => name === s || name === `${s}-browser` || name === `${s}-react-native`,
|
|
464
400
|
);
|
|
465
401
|
}
|
|
466
402
|
|
|
@@ -478,18 +414,12 @@ export function useBinder(): Binder {
|
|
|
478
414
|
* @param sourceFile - The source file to mutate.
|
|
479
415
|
* @param replacementMap - A map from each placeholder string to its replacement value.
|
|
480
416
|
*/
|
|
481
|
-
function applyReplacements(
|
|
482
|
-
sourceFile: SourceFile,
|
|
483
|
-
replacementMap: Map<string, string>
|
|
484
|
-
): void {
|
|
417
|
+
function applyReplacements(sourceFile: SourceFile, replacementMap: Map<string, string>): void {
|
|
485
418
|
if (replacementMap.size === 0) {
|
|
486
419
|
return;
|
|
487
420
|
}
|
|
488
421
|
const text = sourceFile.getFullText();
|
|
489
|
-
const placeholderRegex = new RegExp(
|
|
490
|
-
`${escapeRegExp(PLACEHOLDER_PREFIX)}.+?__`,
|
|
491
|
-
"g"
|
|
492
|
-
);
|
|
422
|
+
const placeholderRegex = new RegExp(`${escapeRegExp(PLACEHOLDER_PREFIX)}.+?__`, "g");
|
|
493
423
|
let changed = false;
|
|
494
424
|
const updatedText = text.replace(placeholderRegex, (match) => {
|
|
495
425
|
const replacement = replacementMap.get(match);
|
|
@@ -517,10 +447,7 @@ function collectPlaceholders(sourceFile: SourceFile): Set<string> {
|
|
|
517
447
|
return result;
|
|
518
448
|
}
|
|
519
449
|
// Refkeys are alphanumeric (see refkey.ts), so `.+?` safely stops at `__`.
|
|
520
|
-
const placeholderRegex = new RegExp(
|
|
521
|
-
`${escapeRegExp(PLACEHOLDER_PREFIX)}.+?__`,
|
|
522
|
-
"g"
|
|
523
|
-
);
|
|
450
|
+
const placeholderRegex = new RegExp(`${escapeRegExp(PLACEHOLDER_PREFIX)}.+?__`, "g");
|
|
524
451
|
let match: RegExpExecArray | null;
|
|
525
452
|
while ((match = placeholderRegex.exec(text)) !== null) {
|
|
526
453
|
result.add(match[0]);
|