@azure-tools/typespec-ts 0.55.0-dev.5 → 0.55.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/README.md +3 -24
- 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/load-static-helpers.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.js +6 -8
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +20 -29
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +0 -4
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +3 -21
- package/dist/src/lib.js.map +1 -1
- package/dist/src/rlc-common/build-client-definitions.d.ts.map +1 -1
- package/dist/src/rlc-common/build-client-definitions.js +4 -4
- package/dist/src/rlc-common/build-client-definitions.js.map +1 -1
- package/dist/src/rlc-common/build-client.d.ts.map +1 -1
- package/dist/src/rlc-common/build-client.js +4 -13
- package/dist/src/rlc-common/build-client.js.map +1 -1
- package/dist/src/rlc-common/build-index-file.d.ts.map +1 -1
- package/dist/src/rlc-common/build-index-file.js +21 -79
- package/dist/src/rlc-common/build-index-file.js.map +1 -1
- package/dist/src/rlc-common/build-is-unexpected-helper.d.ts.map +1 -1
- package/dist/src/rlc-common/build-is-unexpected-helper.js +1 -5
- package/dist/src/rlc-common/build-is-unexpected-helper.js.map +1 -1
- package/dist/src/rlc-common/build-logger.d.ts.map +1 -1
- package/dist/src/rlc-common/build-logger.js +2 -6
- package/dist/src/rlc-common/build-logger.js.map +1 -1
- package/dist/src/rlc-common/build-object-types.d.ts +1 -1
- package/dist/src/rlc-common/build-object-types.d.ts.map +1 -1
- package/dist/src/rlc-common/build-object-types.js +9 -11
- package/dist/src/rlc-common/build-object-types.js.map +1 -1
- package/dist/src/rlc-common/build-parameter-types.d.ts.map +1 -1
- package/dist/src/rlc-common/build-parameter-types.js +13 -66
- package/dist/src/rlc-common/build-parameter-types.js.map +1 -1
- package/dist/src/rlc-common/build-polling-helper.d.ts.map +1 -1
- package/dist/src/rlc-common/build-polling-helper.js +0 -2
- package/dist/src/rlc-common/build-polling-helper.js.map +1 -1
- package/dist/src/rlc-common/build-response-types.d.ts.map +1 -1
- package/dist/src/rlc-common/build-response-types.js +2 -5
- package/dist/src/rlc-common/build-response-types.js.map +1 -1
- package/dist/src/rlc-common/build-schema-type.d.ts.map +1 -1
- package/dist/src/rlc-common/build-schema-type.js +1 -8
- package/dist/src/rlc-common/build-schema-type.js.map +1 -1
- package/dist/src/rlc-common/build-top-level-index-file.d.ts.map +1 -1
- package/dist/src/rlc-common/build-top-level-index-file.js +1 -5
- package/dist/src/rlc-common/build-top-level-index-file.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 +0 -10
- package/dist/src/rlc-common/helpers/name-constructors.js.map +1 -1
- package/dist/src/rlc-common/index.d.ts +0 -2
- package/dist/src/rlc-common/index.d.ts.map +1 -1
- package/dist/src/rlc-common/index.js +0 -2
- package/dist/src/rlc-common/index.js.map +1 -1
- package/dist/src/rlc-common/interfaces.d.ts +1 -4
- 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 +4 -41
- 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 +1 -1
- 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 +2 -37
- 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 +22 -52
- package/dist/src/rlc-common/metadata/build-package-file.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-readme-file.js +6 -7
- package/dist/src/rlc-common/metadata/build-readme-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 +18 -59
- 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 -38
- 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 +2 -18
- 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 -18
- 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 +20 -94
- 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 -5
- package/dist/src/rlc-common/test/build-snippets.js.map +1 -1
- package/dist/src/rlc-common/test/template.d.ts +2 -2
- package/dist/src/rlc-common/test/template.d.ts.map +1 -1
- package/dist/src/rlc-common/test/template.js +1 -31
- package/dist/src/rlc-common/test/template.js.map +1 -1
- package/dist/src/rlc-common/transform-sample-groups.d.ts.map +1 -1
- package/dist/src/rlc-common/transform-sample-groups.js +4 -8
- package/dist/src/rlc-common/transform-sample-groups.js.map +1 -1
- package/dist/src/transform/transfrom-rlc-options.d.ts.map +1 -1
- package/dist/src/transform/transfrom-rlc-options.js +0 -18
- package/dist/src/transform/transfrom-rlc-options.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/framework/hooks/binder.ts +1 -1
- package/src/framework/load-static-helpers.ts +8 -10
- package/src/index.ts +19 -31
- package/src/lib.ts +3 -26
- package/src/rlc-common/build-client-definitions.ts +4 -13
- package/src/rlc-common/build-client.ts +4 -22
- package/src/rlc-common/build-index-file.ts +21 -142
- package/src/rlc-common/build-is-unexpected-helper.ts +1 -8
- package/src/rlc-common/build-logger.ts +2 -12
- package/src/rlc-common/build-object-types.ts +5 -17
- package/src/rlc-common/build-parameter-types.ts +9 -103
- package/src/rlc-common/build-polling-helper.ts +0 -3
- package/src/rlc-common/build-response-types.ts +2 -12
- package/src/rlc-common/build-schema-type.ts +1 -11
- package/src/rlc-common/build-top-level-index-file.ts +1 -8
- package/src/rlc-common/helpers/name-constructors.ts +0 -15
- package/src/rlc-common/index.ts +0 -2
- package/src/rlc-common/interfaces.ts +1 -4
- package/src/rlc-common/metadata/build-api-extractor-config.ts +4 -46
- package/src/rlc-common/metadata/build-es-lint-config.ts +2 -38
- package/src/rlc-common/metadata/build-package-file.ts +21 -58
- package/src/rlc-common/metadata/build-readme-file.ts +6 -9
- package/src/rlc-common/metadata/build-test-config.ts +1 -6
- package/src/rlc-common/metadata/build-ts-config.ts +28 -70
- 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 +2 -21
- package/src/rlc-common/metadata/package-json/package-common.ts +21 -114
- 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 -5
- package/src/rlc-common/test/template.ts +1 -31
- package/src/rlc-common/transform-sample-groups.ts +3 -12
- package/src/transform/transfrom-rlc-options.ts +0 -20
- package/dist/src/rlc-common/helpers/package-util.d.ts +0 -4
- package/dist/src/rlc-common/helpers/package-util.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/package-util.js +0 -7
- package/dist/src/rlc-common/helpers/package-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 -139
- 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/src/rlc-common/helpers/package-util.ts +0 -9
- package/src/rlc-common/metadata/build-rollup-config.ts +0 -146
- package/src/rlc-common/metadata/package-json/build-azure-standalone-package.ts +0 -123
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ export interface BinderOptions {
|
|
|
23
23
|
staticHelpers?: Map<string, StaticHelperMetadata>;
|
|
24
24
|
dependencies?: Record<string, ReferenceableSymbol>;
|
|
25
25
|
/** When true, use #platform/ subpath imports for static helpers with platform variants.
|
|
26
|
-
* Should be true for warp
|
|
26
|
+
* Should be true for warp packages; false for tshy packages. */
|
|
27
27
|
useSubpathImports?: boolean;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -99,16 +99,14 @@ export async function loadStaticHelpers(
|
|
|
99
99
|
// so that browser/react-native variants are resolved via subpath imports.
|
|
100
100
|
// Only rewrite imports to the default variant (not -browser/-react-native variants
|
|
101
101
|
// which are already platform-specific direct imports).
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
)
|
|
110
|
-
i.setModuleSpecifier("#platform/static-helpers/platform-types");
|
|
111
|
-
}
|
|
102
|
+
const specifier = i.getModuleSpecifierValue();
|
|
103
|
+
if (
|
|
104
|
+
specifier.startsWith(".") &&
|
|
105
|
+
specifier.includes("platform-types") &&
|
|
106
|
+
!specifier.includes("-browser") &&
|
|
107
|
+
!specifier.includes("-react-native")
|
|
108
|
+
) {
|
|
109
|
+
i.setModuleSpecifier("#platform/static-helpers/platform-types");
|
|
112
110
|
}
|
|
113
111
|
});
|
|
114
112
|
|
package/src/index.ts
CHANGED
|
@@ -50,7 +50,6 @@ import {
|
|
|
50
50
|
buildReadmeFile,
|
|
51
51
|
buildRecordedClientFile,
|
|
52
52
|
buildResponseTypes,
|
|
53
|
-
buildRollupConfig,
|
|
54
53
|
buildSampleEnvFile,
|
|
55
54
|
buildSampleTest,
|
|
56
55
|
buildSamples,
|
|
@@ -187,7 +186,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
187
186
|
dependencies: {
|
|
188
187
|
...extraDependencies,
|
|
189
188
|
},
|
|
190
|
-
useSubpathImports:
|
|
189
|
+
useSubpathImports: true,
|
|
191
190
|
});
|
|
192
191
|
provideSdkTypes(dpgContext);
|
|
193
192
|
|
|
@@ -236,8 +235,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
236
235
|
);
|
|
237
236
|
options.generateTest =
|
|
238
237
|
options.generateTest === true ||
|
|
239
|
-
(options.generateTest === undefined &&
|
|
240
|
-
(!hasTestFolder || (options.azureSdkForJs && options.azureArm)));
|
|
238
|
+
(options.generateTest === undefined && (!hasTestFolder || options.azureArm));
|
|
241
239
|
dpgContext.rlcOptions = options;
|
|
242
240
|
}
|
|
243
241
|
|
|
@@ -505,7 +503,6 @@ export async function $onEmit(context: EmitContext) {
|
|
|
505
503
|
|
|
506
504
|
if (shouldGenerateMetadata) {
|
|
507
505
|
const commonBuilders = [
|
|
508
|
-
buildRollupConfig,
|
|
509
506
|
buildApiExtractorConfig,
|
|
510
507
|
buildReadmeFile,
|
|
511
508
|
buildLicenseFile,
|
|
@@ -523,7 +520,6 @@ export async function $onEmit(context: EmitContext) {
|
|
|
523
520
|
}
|
|
524
521
|
if (
|
|
525
522
|
emitterOptions["generate-test"] === true &&
|
|
526
|
-
option.azureSdkForJs === true &&
|
|
527
523
|
emitterOptions["generate-metadata"] === true
|
|
528
524
|
) {
|
|
529
525
|
await emitTests(dpgContext, host);
|
|
@@ -548,29 +544,23 @@ export async function $onEmit(context: EmitContext) {
|
|
|
548
544
|
}
|
|
549
545
|
commonBuilders.push((model) => buildPackageFile(model, modularPackageInfo));
|
|
550
546
|
// Generate warp.config.yml for Azure monorepo ESM packages
|
|
551
|
-
|
|
552
|
-
commonBuilders.push((model) => buildWarpConfig(model, modularPackageInfo));
|
|
553
|
-
}
|
|
547
|
+
commonBuilders.push((model) => buildWarpConfig(model, modularPackageInfo));
|
|
554
548
|
commonBuilders.push(buildTsConfig);
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
commonBuilders.push(buildTsSampleConfig);
|
|
564
|
-
}
|
|
565
|
-
commonBuilders.push(buildTsLintConfig);
|
|
549
|
+
commonBuilders.push(buildTsSrcEsmConfig);
|
|
550
|
+
commonBuilders.push(buildTsSrcBrowserConfig);
|
|
551
|
+
if (option.generateReactNativeTarget) {
|
|
552
|
+
commonBuilders.push(buildTsSrcReactNativeConfig);
|
|
553
|
+
}
|
|
554
|
+
commonBuilders.push(buildTsSrcCjsConfig);
|
|
555
|
+
if (option.generateSample) {
|
|
556
|
+
commonBuilders.push(buildTsSampleConfig);
|
|
566
557
|
}
|
|
558
|
+
commonBuilders.push(buildTsLintConfig);
|
|
567
559
|
|
|
568
560
|
// TODO: need support snippets generation for multi-client cases. https://github.com/Azure/autorest.typescript/issues/3048
|
|
569
561
|
if (option.generateTest) {
|
|
570
562
|
for (const subClient of dpgContext.sdkPackage.clients) {
|
|
571
|
-
commonBuilders.push((model) =>
|
|
572
|
-
buildSnippets(model, subClient.name, option.azureSdkForJs),
|
|
573
|
-
);
|
|
563
|
+
commonBuilders.push((model) => buildSnippets(model, subClient.name));
|
|
574
564
|
}
|
|
575
565
|
commonBuilders.push(buildTsSnippetsConfig);
|
|
576
566
|
}
|
|
@@ -613,9 +603,9 @@ export async function $onEmit(context: EmitContext) {
|
|
|
613
603
|
};
|
|
614
604
|
}
|
|
615
605
|
|
|
616
|
-
// Always update package.json
|
|
617
|
-
//
|
|
618
|
-
|
|
606
|
+
// Always update package.json (adds #platform/* imports) and, for modular
|
|
607
|
+
// packages, exports, clientContextPaths and LRO deps.
|
|
608
|
+
{
|
|
619
609
|
// Read package.json content via host and pass parsed object
|
|
620
610
|
const pkgSourceFile = await host.readFile(existingPackageFilePath);
|
|
621
611
|
let packageInfo: Record<string, any>;
|
|
@@ -630,9 +620,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
630
620
|
}
|
|
631
621
|
|
|
632
622
|
// Update warp.config.yml for Azure monorepo packages
|
|
633
|
-
|
|
634
|
-
updateBuilders.push((model: RLCModel) => buildWarpConfig(model, modularPackageInfo));
|
|
635
|
-
}
|
|
623
|
+
updateBuilders.push((model: RLCModel) => buildWarpConfig(model, modularPackageInfo));
|
|
636
624
|
|
|
637
625
|
// If the client name changed, regenerate the README and snippets completely;
|
|
638
626
|
// otherwise update only the API reference link in-place.
|
|
@@ -647,10 +635,10 @@ export async function $onEmit(context: EmitContext) {
|
|
|
647
635
|
);
|
|
648
636
|
|
|
649
637
|
// Regenerate snippets.spec.ts only when the client name changed
|
|
650
|
-
if (clientNameChanged
|
|
638
|
+
if (clientNameChanged) {
|
|
651
639
|
for (const subClient of dpgContext.sdkPackage.clients) {
|
|
652
640
|
updateBuilders.push((model: RLCModel) =>
|
|
653
|
-
buildSnippets(model, getClassicalClientName(subClient)
|
|
641
|
+
buildSnippets(model, getClassicalClientName(subClient)),
|
|
654
642
|
);
|
|
655
643
|
}
|
|
656
644
|
}
|
package/src/lib.ts
CHANGED
|
@@ -42,7 +42,6 @@ export interface EmitterOptions {
|
|
|
42
42
|
*/
|
|
43
43
|
"generate-test"?: boolean;
|
|
44
44
|
"generate-sample"?: boolean;
|
|
45
|
-
"azure-sdk-for-js"?: boolean;
|
|
46
45
|
"azure-output-directory"?: string;
|
|
47
46
|
"is-typespec-test"?: boolean;
|
|
48
47
|
title?: string;
|
|
@@ -50,9 +49,7 @@ export interface EmitterOptions {
|
|
|
50
49
|
"product-doc-link"?: string;
|
|
51
50
|
"service-info"?: ServiceInfo;
|
|
52
51
|
"azure-arm"?: boolean;
|
|
53
|
-
"source-from"?: "TypeSpec" | "Swagger";
|
|
54
52
|
"is-modular-library"?: boolean;
|
|
55
|
-
"module-kind"?: "esm";
|
|
56
53
|
"enable-operation-group"?: boolean;
|
|
57
54
|
"enable-model-namespace"?: boolean;
|
|
58
55
|
"hierarchy-client"?: boolean;
|
|
@@ -91,7 +88,6 @@ export interface EmitterOptions {
|
|
|
91
88
|
/**
|
|
92
89
|
* When set to true, generates React Native build targets (tsconfig, warp target,
|
|
93
90
|
* package.json exports). Defaults to `false`.
|
|
94
|
-
* Only applicable when `azure-sdk-for-js` is `true`.
|
|
95
91
|
*/
|
|
96
92
|
"generate-react-native-target"?: boolean;
|
|
97
93
|
}
|
|
@@ -193,9 +189,8 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
193
189
|
description: [
|
|
194
190
|
"Whether to generate test files, for basic testing of your generated sdks. Defaults to `undefined`.",
|
|
195
191
|
"other cases:",
|
|
196
|
-
"- If
|
|
197
|
-
"- If
|
|
198
|
-
"- If azure-sdk-for-js is `true` but there's not a test folder under package-dir. Defaults to `true`.",
|
|
192
|
+
"- If there's a test folder under package-dir. Defaults to `false`.",
|
|
193
|
+
"- If there's not a test folder under package-dir. Defaults to `true`.",
|
|
199
194
|
].join("\n"),
|
|
200
195
|
},
|
|
201
196
|
"generate-sample": {
|
|
@@ -204,12 +199,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
204
199
|
description:
|
|
205
200
|
"Whether to generate sample files, for basic samples of your generated sdks. Defaults to `undefined`. Management packages' default to `true`.",
|
|
206
201
|
},
|
|
207
|
-
"azure-sdk-for-js": {
|
|
208
|
-
type: "boolean",
|
|
209
|
-
nullable: true,
|
|
210
|
-
description:
|
|
211
|
-
"This is used to indicate your project is generated in [azure-sdk-for-js](https://github.com/Azure/azure-sdk-for-js) repo or not. If your package is located in that repo we'll leverage `dev-tool` to accelerate our building and testing, however if not we'll remove the dependency for that tool. Defaults to `undefined`. ",
|
|
212
|
-
},
|
|
213
202
|
"azure-output-directory": {
|
|
214
203
|
type: "string",
|
|
215
204
|
nullable: true,
|
|
@@ -256,11 +245,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
256
245
|
nullable: true,
|
|
257
246
|
description: "Whether the package is an arm package.",
|
|
258
247
|
},
|
|
259
|
-
"source-from": {
|
|
260
|
-
type: "string",
|
|
261
|
-
nullable: true,
|
|
262
|
-
description: "Internal option, the value is default for TypeSpec generation",
|
|
263
|
-
},
|
|
264
248
|
"is-modular-library": {
|
|
265
249
|
type: "boolean",
|
|
266
250
|
nullable: true,
|
|
@@ -286,13 +270,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
286
270
|
description:
|
|
287
271
|
"An option to organize the client in a hierarchical way as defined by `@clientInitialization`. This is true by default.",
|
|
288
272
|
},
|
|
289
|
-
"module-kind": {
|
|
290
|
-
type: "string",
|
|
291
|
-
nullable: true,
|
|
292
|
-
enum: ["esm"],
|
|
293
|
-
default: "esm",
|
|
294
|
-
description: "Internal option for test.",
|
|
295
|
-
},
|
|
296
273
|
"compatibility-mode": {
|
|
297
274
|
type: "boolean",
|
|
298
275
|
nullable: true,
|
|
@@ -390,7 +367,7 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
390
367
|
type: "boolean",
|
|
391
368
|
nullable: true,
|
|
392
369
|
description:
|
|
393
|
-
"When set to true, generates React Native build targets (tsconfig, warp target, package.json exports).
|
|
370
|
+
"When set to true, generates React Native build targets (tsconfig, warp target, package.json exports). Defaults to `false`.",
|
|
394
371
|
},
|
|
395
372
|
},
|
|
396
373
|
required: [],
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
|
|
15
15
|
import { REST_CLIENT_RESERVED } from "./build-method-shortcuts.js";
|
|
16
16
|
import { getImportSpecifier } from "./helpers/imports-util.js";
|
|
17
|
-
import { getClientName
|
|
17
|
+
import { getClientName } from "./helpers/name-constructors.js";
|
|
18
18
|
import { CasingConvention, NameType, normalizeName, pascalCase } from "./helpers/name-utils.js";
|
|
19
19
|
import {
|
|
20
20
|
buildMethodDefinitions,
|
|
@@ -83,10 +83,7 @@ export function buildClientDefinitions(model: RLCModel) {
|
|
|
83
83
|
clientDefinitionsFile.addImportDeclaration({
|
|
84
84
|
isTypeOnly: true,
|
|
85
85
|
namedImports: [...options.importedParameters],
|
|
86
|
-
moduleSpecifier:
|
|
87
|
-
{ cjsName: "./parameters", esModulesName: "./parameters.js" },
|
|
88
|
-
model,
|
|
89
|
-
),
|
|
86
|
+
moduleSpecifier: "./parameters.js",
|
|
90
87
|
});
|
|
91
88
|
}
|
|
92
89
|
|
|
@@ -94,10 +91,7 @@ export function buildClientDefinitions(model: RLCModel) {
|
|
|
94
91
|
clientDefinitionsFile.addImportDeclaration({
|
|
95
92
|
isTypeOnly: true,
|
|
96
93
|
namedImports: [...options.importedResponses],
|
|
97
|
-
moduleSpecifier:
|
|
98
|
-
{ cjsName: "./responses", esModulesName: "./responses.js" },
|
|
99
|
-
model,
|
|
100
|
-
),
|
|
94
|
+
moduleSpecifier: "./responses.js",
|
|
101
95
|
});
|
|
102
96
|
}
|
|
103
97
|
|
|
@@ -105,10 +99,7 @@ export function buildClientDefinitions(model: RLCModel) {
|
|
|
105
99
|
clientDefinitionsFile.addImportDeclaration({
|
|
106
100
|
isTypeOnly: true,
|
|
107
101
|
namedImports: Array.from(model.importInfo.internalImports.rlcClientDefinition.importsSet!),
|
|
108
|
-
moduleSpecifier:
|
|
109
|
-
{ cjsName: "./models", esModulesName: "./models.js" },
|
|
110
|
-
model,
|
|
111
|
-
),
|
|
102
|
+
moduleSpecifier: "./models.js",
|
|
112
103
|
});
|
|
113
104
|
}
|
|
114
105
|
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "ts-morph";
|
|
15
15
|
import { buildMethodShortcutImplementation } from "./build-method-shortcuts.js";
|
|
16
16
|
import { getImportSpecifier } from "./helpers/imports-util.js";
|
|
17
|
-
import { getClientName
|
|
17
|
+
import { getClientName } from "./helpers/name-constructors.js";
|
|
18
18
|
import { NameType, normalizeName } from "./helpers/name-utils.js";
|
|
19
19
|
import { File, PathParameter, RLCModel } from "./interfaces.js";
|
|
20
20
|
|
|
@@ -194,13 +194,7 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
194
194
|
clientFile.addImportDeclarations([
|
|
195
195
|
{
|
|
196
196
|
namedImports: ["logger"],
|
|
197
|
-
moduleSpecifier:
|
|
198
|
-
{
|
|
199
|
-
cjsName: loggerPath,
|
|
200
|
-
esModulesName: `${loggerPath}.js`,
|
|
201
|
-
},
|
|
202
|
-
model,
|
|
203
|
-
),
|
|
197
|
+
moduleSpecifier: `${loggerPath}.js`,
|
|
204
198
|
},
|
|
205
199
|
]);
|
|
206
200
|
|
|
@@ -233,13 +227,7 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
233
227
|
{
|
|
234
228
|
isTypeOnly: true,
|
|
235
229
|
namedImports: [`${clientInterfaceName}`],
|
|
236
|
-
moduleSpecifier:
|
|
237
|
-
{
|
|
238
|
-
cjsName: "./clientDefinitions",
|
|
239
|
-
esModulesName: "./clientDefinitions.js",
|
|
240
|
-
},
|
|
241
|
-
model,
|
|
242
|
-
),
|
|
230
|
+
moduleSpecifier: "./clientDefinitions.js",
|
|
243
231
|
},
|
|
244
232
|
]);
|
|
245
233
|
if ((model.importInfo.internalImports?.rlcClientFactory?.importsSet?.size ?? 0) > 0) {
|
|
@@ -247,13 +235,7 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
247
235
|
{
|
|
248
236
|
isTypeOnly: true,
|
|
249
237
|
namedImports: Array.from(model.importInfo.internalImports.rlcClientFactory.importsSet!),
|
|
250
|
-
moduleSpecifier:
|
|
251
|
-
{
|
|
252
|
-
cjsName: `./models`,
|
|
253
|
-
esModulesName: `./models.js`,
|
|
254
|
-
},
|
|
255
|
-
model,
|
|
256
|
-
),
|
|
238
|
+
moduleSpecifier: `./models.js`,
|
|
257
239
|
},
|
|
258
240
|
]);
|
|
259
241
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
import { joinPaths } from "@typespec/compiler";
|
|
5
5
|
import { Project, SourceFile } from "ts-morph";
|
|
6
|
-
import { getImportModuleName } from "./helpers/name-constructors.js";
|
|
7
6
|
import { NameType, normalizeName } from "./helpers/name-utils.js";
|
|
8
7
|
import {
|
|
9
8
|
hasCsvCollection,
|
|
@@ -49,42 +48,24 @@ function generateRLCIndexForMultiClient(file: SourceFile, model: RLCModel) {
|
|
|
49
48
|
|
|
50
49
|
file.addImportDeclaration({
|
|
51
50
|
namespaceImport: "Parameters",
|
|
52
|
-
moduleSpecifier:
|
|
53
|
-
{ cjsName: "./parameters", esModulesName: "./parameters.js" },
|
|
54
|
-
model,
|
|
55
|
-
),
|
|
51
|
+
moduleSpecifier: "./parameters.js",
|
|
56
52
|
});
|
|
57
53
|
|
|
58
54
|
file.addImportDeclaration({
|
|
59
55
|
namespaceImport: "Responses",
|
|
60
|
-
moduleSpecifier:
|
|
61
|
-
{ cjsName: "./responses", esModulesName: "./responses.js" },
|
|
62
|
-
model,
|
|
63
|
-
),
|
|
56
|
+
moduleSpecifier: "./responses.js",
|
|
64
57
|
});
|
|
65
58
|
|
|
66
59
|
file.addImportDeclaration({
|
|
67
60
|
namespaceImport: "Client",
|
|
68
|
-
moduleSpecifier:
|
|
69
|
-
{
|
|
70
|
-
cjsName: "./clientDefinitions",
|
|
71
|
-
esModulesName: "./clientDefinitions.js",
|
|
72
|
-
},
|
|
73
|
-
model,
|
|
74
|
-
),
|
|
61
|
+
moduleSpecifier: "./clientDefinitions.js",
|
|
75
62
|
});
|
|
76
63
|
|
|
77
64
|
const exports = ["Parameters", "Responses", "Client"];
|
|
78
65
|
if (hasInputModels(model)) {
|
|
79
66
|
file.addImportDeclaration({
|
|
80
67
|
namespaceImport: "Models",
|
|
81
|
-
moduleSpecifier:
|
|
82
|
-
{
|
|
83
|
-
cjsName: "./models",
|
|
84
|
-
esModulesName: "./models.js",
|
|
85
|
-
},
|
|
86
|
-
model,
|
|
87
|
-
),
|
|
68
|
+
moduleSpecifier: "./models.js",
|
|
88
69
|
});
|
|
89
70
|
exports.push("Models");
|
|
90
71
|
}
|
|
@@ -92,13 +73,7 @@ function generateRLCIndexForMultiClient(file: SourceFile, model: RLCModel) {
|
|
|
92
73
|
if (hasOutputModels(model)) {
|
|
93
74
|
file.addImportDeclaration({
|
|
94
75
|
namespaceImport: "OutputModels",
|
|
95
|
-
moduleSpecifier:
|
|
96
|
-
{
|
|
97
|
-
cjsName: "./outputModels",
|
|
98
|
-
esModulesName: "./outputModels.js",
|
|
99
|
-
},
|
|
100
|
-
model,
|
|
101
|
-
),
|
|
76
|
+
moduleSpecifier: "./outputModels.js",
|
|
102
77
|
});
|
|
103
78
|
exports.push("OutputModels");
|
|
104
79
|
}
|
|
@@ -106,13 +81,7 @@ function generateRLCIndexForMultiClient(file: SourceFile, model: RLCModel) {
|
|
|
106
81
|
if (hasPagingOperations(model)) {
|
|
107
82
|
file.addImportDeclaration({
|
|
108
83
|
namespaceImport: "PaginateHelper",
|
|
109
|
-
moduleSpecifier:
|
|
110
|
-
{
|
|
111
|
-
cjsName: "./paginateHelper",
|
|
112
|
-
esModulesName: "./paginateHelper.js",
|
|
113
|
-
},
|
|
114
|
-
model,
|
|
115
|
-
),
|
|
84
|
+
moduleSpecifier: "./paginateHelper.js",
|
|
116
85
|
});
|
|
117
86
|
exports.push("PaginateHelper");
|
|
118
87
|
}
|
|
@@ -120,13 +89,7 @@ function generateRLCIndexForMultiClient(file: SourceFile, model: RLCModel) {
|
|
|
120
89
|
if (hasUnexpectedHelper(model)) {
|
|
121
90
|
file.addImportDeclaration({
|
|
122
91
|
namespaceImport: "UnexpectedHelper",
|
|
123
|
-
moduleSpecifier:
|
|
124
|
-
{
|
|
125
|
-
cjsName: "./isUnexpected",
|
|
126
|
-
esModulesName: "./isUnexpected.js",
|
|
127
|
-
},
|
|
128
|
-
model,
|
|
129
|
-
),
|
|
92
|
+
moduleSpecifier: "./isUnexpected.js",
|
|
130
93
|
});
|
|
131
94
|
exports.push("UnexpectedHelper");
|
|
132
95
|
}
|
|
@@ -134,13 +97,7 @@ function generateRLCIndexForMultiClient(file: SourceFile, model: RLCModel) {
|
|
|
134
97
|
if (hasPollingOperations(model)) {
|
|
135
98
|
file.addImportDeclaration({
|
|
136
99
|
namespaceImport: "PollingHelper",
|
|
137
|
-
moduleSpecifier:
|
|
138
|
-
{
|
|
139
|
-
cjsName: "./pollingHelper",
|
|
140
|
-
esModulesName: "./pollingHelper.js",
|
|
141
|
-
},
|
|
142
|
-
model,
|
|
143
|
-
),
|
|
100
|
+
moduleSpecifier: "./pollingHelper.js",
|
|
144
101
|
});
|
|
145
102
|
exports.push("PollingHelper");
|
|
146
103
|
}
|
|
@@ -154,26 +111,14 @@ function generateRLCIndexForMultiClient(file: SourceFile, model: RLCModel) {
|
|
|
154
111
|
) {
|
|
155
112
|
file.addImportDeclaration({
|
|
156
113
|
namespaceImport: "SerializeHelper",
|
|
157
|
-
moduleSpecifier:
|
|
158
|
-
{
|
|
159
|
-
cjsName: "./serializeHelper",
|
|
160
|
-
esModulesName: "./serializeHelper.js",
|
|
161
|
-
},
|
|
162
|
-
model,
|
|
163
|
-
),
|
|
114
|
+
moduleSpecifier: "./serializeHelper.js",
|
|
164
115
|
});
|
|
165
116
|
exports.push("SerializeHelper");
|
|
166
117
|
}
|
|
167
118
|
|
|
168
119
|
file.addExportDeclarations([
|
|
169
120
|
{
|
|
170
|
-
moduleSpecifier:
|
|
171
|
-
{
|
|
172
|
-
cjsName: `./${moduleName}`,
|
|
173
|
-
esModulesName: `./${moduleName}.js`,
|
|
174
|
-
},
|
|
175
|
-
model,
|
|
176
|
-
),
|
|
121
|
+
moduleSpecifier: `./${moduleName}.js`,
|
|
177
122
|
namedExports: [`${createClientFuncName}`, `${clientName}ClientOptions`],
|
|
178
123
|
},
|
|
179
124
|
{
|
|
@@ -188,65 +133,29 @@ function generateRLCIndex(file: SourceFile, model: RLCModel) {
|
|
|
188
133
|
const moduleName = normalizeName(clientName, NameType.File);
|
|
189
134
|
|
|
190
135
|
file.addImportDeclaration({
|
|
191
|
-
moduleSpecifier:
|
|
192
|
-
{
|
|
193
|
-
cjsName: `./${moduleName}`,
|
|
194
|
-
esModulesName: `./${moduleName}.js`,
|
|
195
|
-
},
|
|
196
|
-
model,
|
|
197
|
-
),
|
|
136
|
+
moduleSpecifier: `./${moduleName}.js`,
|
|
198
137
|
defaultImport: createClientFuncName,
|
|
199
138
|
});
|
|
200
139
|
|
|
201
140
|
file.addExportDeclarations([
|
|
202
141
|
{
|
|
203
|
-
moduleSpecifier:
|
|
204
|
-
{
|
|
205
|
-
cjsName: `./${moduleName}`,
|
|
206
|
-
esModulesName: `./${moduleName}.js`,
|
|
207
|
-
},
|
|
208
|
-
model,
|
|
209
|
-
),
|
|
142
|
+
moduleSpecifier: `./${moduleName}.js`,
|
|
210
143
|
},
|
|
211
144
|
{
|
|
212
|
-
moduleSpecifier:
|
|
213
|
-
{
|
|
214
|
-
cjsName: `./parameters`,
|
|
215
|
-
esModulesName: `./parameters.js`,
|
|
216
|
-
},
|
|
217
|
-
model,
|
|
218
|
-
),
|
|
145
|
+
moduleSpecifier: `./parameters.js`,
|
|
219
146
|
},
|
|
220
147
|
{
|
|
221
|
-
moduleSpecifier:
|
|
222
|
-
{
|
|
223
|
-
cjsName: `./responses`,
|
|
224
|
-
esModulesName: `./responses.js`,
|
|
225
|
-
},
|
|
226
|
-
model,
|
|
227
|
-
),
|
|
148
|
+
moduleSpecifier: `./responses.js`,
|
|
228
149
|
},
|
|
229
150
|
{
|
|
230
|
-
moduleSpecifier:
|
|
231
|
-
{
|
|
232
|
-
cjsName: `./clientDefinitions`,
|
|
233
|
-
esModulesName: `./clientDefinitions.js`,
|
|
234
|
-
},
|
|
235
|
-
model,
|
|
236
|
-
),
|
|
151
|
+
moduleSpecifier: `./clientDefinitions.js`,
|
|
237
152
|
},
|
|
238
153
|
]);
|
|
239
154
|
|
|
240
155
|
if (hasUnexpectedHelper(model)) {
|
|
241
156
|
file.addExportDeclarations([
|
|
242
157
|
{
|
|
243
|
-
moduleSpecifier:
|
|
244
|
-
{
|
|
245
|
-
cjsName: `./isUnexpected`,
|
|
246
|
-
esModulesName: `./isUnexpected.js`,
|
|
247
|
-
},
|
|
248
|
-
model,
|
|
249
|
-
),
|
|
158
|
+
moduleSpecifier: `./isUnexpected.js`,
|
|
250
159
|
},
|
|
251
160
|
]);
|
|
252
161
|
}
|
|
@@ -254,13 +163,7 @@ function generateRLCIndex(file: SourceFile, model: RLCModel) {
|
|
|
254
163
|
if (hasInputModels(model)) {
|
|
255
164
|
file.addExportDeclarations([
|
|
256
165
|
{
|
|
257
|
-
moduleSpecifier:
|
|
258
|
-
{
|
|
259
|
-
cjsName: `./models`,
|
|
260
|
-
esModulesName: `./models.js`,
|
|
261
|
-
},
|
|
262
|
-
model,
|
|
263
|
-
),
|
|
166
|
+
moduleSpecifier: `./models.js`,
|
|
264
167
|
},
|
|
265
168
|
]);
|
|
266
169
|
}
|
|
@@ -268,13 +171,7 @@ function generateRLCIndex(file: SourceFile, model: RLCModel) {
|
|
|
268
171
|
if (hasOutputModels(model)) {
|
|
269
172
|
file.addExportDeclarations([
|
|
270
173
|
{
|
|
271
|
-
moduleSpecifier:
|
|
272
|
-
{
|
|
273
|
-
cjsName: `./outputModels`,
|
|
274
|
-
esModulesName: `./outputModels.js`,
|
|
275
|
-
},
|
|
276
|
-
model,
|
|
277
|
-
),
|
|
174
|
+
moduleSpecifier: `./outputModels.js`,
|
|
278
175
|
},
|
|
279
176
|
]);
|
|
280
177
|
}
|
|
@@ -282,13 +179,7 @@ function generateRLCIndex(file: SourceFile, model: RLCModel) {
|
|
|
282
179
|
if (hasPagingOperations(model)) {
|
|
283
180
|
file.addExportDeclarations([
|
|
284
181
|
{
|
|
285
|
-
moduleSpecifier:
|
|
286
|
-
{
|
|
287
|
-
cjsName: `./paginateHelper`,
|
|
288
|
-
esModulesName: `./paginateHelper.js`,
|
|
289
|
-
},
|
|
290
|
-
model,
|
|
291
|
-
),
|
|
182
|
+
moduleSpecifier: `./paginateHelper.js`,
|
|
292
183
|
},
|
|
293
184
|
]);
|
|
294
185
|
}
|
|
@@ -296,13 +187,7 @@ function generateRLCIndex(file: SourceFile, model: RLCModel) {
|
|
|
296
187
|
if (hasPollingOperations(model)) {
|
|
297
188
|
file.addExportDeclarations([
|
|
298
189
|
{
|
|
299
|
-
moduleSpecifier:
|
|
300
|
-
{
|
|
301
|
-
cjsName: `./pollingHelper`,
|
|
302
|
-
esModulesName: `./pollingHelper.js`,
|
|
303
|
-
},
|
|
304
|
-
model,
|
|
305
|
-
),
|
|
190
|
+
moduleSpecifier: `./pollingHelper.js`,
|
|
306
191
|
},
|
|
307
192
|
]);
|
|
308
193
|
}
|
|
@@ -316,13 +201,7 @@ function generateRLCIndex(file: SourceFile, model: RLCModel) {
|
|
|
316
201
|
) {
|
|
317
202
|
file.addExportDeclarations([
|
|
318
203
|
{
|
|
319
|
-
moduleSpecifier:
|
|
320
|
-
{
|
|
321
|
-
cjsName: `./serializeHelper`,
|
|
322
|
-
esModulesName: `./serializeHelper.js`,
|
|
323
|
-
},
|
|
324
|
-
model,
|
|
325
|
-
),
|
|
204
|
+
moduleSpecifier: `./serializeHelper.js`,
|
|
326
205
|
},
|
|
327
206
|
]);
|
|
328
207
|
}
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
Project,
|
|
9
9
|
VariableDeclarationKind,
|
|
10
10
|
} from "ts-morph";
|
|
11
|
-
import { getImportModuleName } from "./helpers/name-constructors.js";
|
|
12
11
|
import { hasUnexpectedHelper } from "./helpers/operation-helpers.js";
|
|
13
12
|
import { RLCModel } from "./interfaces.js";
|
|
14
13
|
export function buildIsUnexpectedHelper(model: RLCModel) {
|
|
@@ -94,13 +93,7 @@ export function buildIsUnexpectedHelper(model: RLCModel) {
|
|
|
94
93
|
isErrorHelper.addImportDeclaration({
|
|
95
94
|
isTypeOnly: true,
|
|
96
95
|
namedImports: [...allResponseTypes],
|
|
97
|
-
moduleSpecifier:
|
|
98
|
-
{
|
|
99
|
-
cjsName: `./responses`,
|
|
100
|
-
esModulesName: `./responses.js`,
|
|
101
|
-
},
|
|
102
|
-
model,
|
|
103
|
-
),
|
|
96
|
+
moduleSpecifier: `./responses.js`,
|
|
104
97
|
});
|
|
105
98
|
|
|
106
99
|
isErrorHelper.addVariableStatement({
|
|
@@ -10,19 +10,9 @@ export function buildLogger(model: RLCModel) {
|
|
|
10
10
|
return undefined;
|
|
11
11
|
}
|
|
12
12
|
const project = new Project({ useInMemoryFileSystem: true });
|
|
13
|
-
const {
|
|
13
|
+
const { rlcSourceDir } = model;
|
|
14
14
|
const { packageDetails } = model.options;
|
|
15
|
-
const filePath = joinPaths(
|
|
16
|
-
model.options.sourceFrom === "Swagger"
|
|
17
|
-
? srcPath.substring(
|
|
18
|
-
0,
|
|
19
|
-
srcPath.includes("generated") && !srcPath.includes("src")
|
|
20
|
-
? srcPath.lastIndexOf("generated") + 10
|
|
21
|
-
: srcPath.lastIndexOf("src") + 4,
|
|
22
|
-
)
|
|
23
|
-
: rlcSourceDir!,
|
|
24
|
-
`logger.ts`,
|
|
25
|
-
);
|
|
15
|
+
const filePath = joinPaths(rlcSourceDir!, `logger.ts`);
|
|
26
16
|
const loggerFile = project.createSourceFile("logger.ts", undefined, {
|
|
27
17
|
overwrite: true,
|
|
28
18
|
});
|