@azure-tools/rlc-common
Advanced tools
Comparing version 0.33.0-alpha.20241101.1 to 0.33.0-alpha.20241104.1
@@ -43,4 +43,4 @@ { | ||
"packages/rlc-common/src/metadata/buildLicenseFile.ts": "93aede17cfd25fd7793180cab3a4398af90edc9e", | ||
"packages/rlc-common/src/metadata/buildPackageFile.ts": "e26607379554662538b1bb27aa1971083374bc5c", | ||
"packages/rlc-common/src/metadata/buildReadmeFile.ts": "9f947ea770025a7a6f46ea99bf3c45b28dd4ea4a", | ||
"packages/rlc-common/src/metadata/buildPackageFile.ts": "1409fcde8699eecb056e274d1e548ea9c4263a96", | ||
"packages/rlc-common/src/metadata/buildReadmeFile.ts": "cf1256665e32a9feabad2fb1de7eaf3d1dbc0a1c", | ||
"packages/rlc-common/src/metadata/buildRollupConfig.ts": "6d05e8cdab182f7529b725cdc70d7adfdeb108f1", | ||
@@ -51,3 +51,3 @@ "packages/rlc-common/src/metadata/buildSampleEnvFile.ts": "e55ac377ede580e7a708d9f780d793e3e7ee8bbf", | ||
"packages/rlc-common/src/metadata/packageJson/azurePackageCommon.ts": "b3979324e4b89411dc0e8ca85c1a1ed13d3690d0", | ||
"packages/rlc-common/src/metadata/packageJson/buildAzureMonorepoPackage.ts": "2e5ef14870c62e71ad3c77815a40d17beb882bf5", | ||
"packages/rlc-common/src/metadata/packageJson/buildAzureMonorepoPackage.ts": "46e1290f95fd2ee0ce27da004d8c51233640efd2", | ||
"packages/rlc-common/src/metadata/packageJson/buildAzureStandalonePackage.ts": "f324e3615ed634f535e1d31262a0f62910c80168", | ||
@@ -68,4 +68,4 @@ "packages/rlc-common/src/metadata/packageJson/buildFlavorlessPackage.ts": "b73f3a331e00bbf5c4c9c4d62e852e748e060b45", | ||
"packages/rlc-common/test/helpers/typeUtil.spec.ts": "ddabcac40ae1c30c0088ca421c612c4f2a7b3a31", | ||
"packages/rlc-common/test/integration/mockHelper.ts": "5c7f57aaaea34fb206bd37571491fb56ac80613b", | ||
"packages/rlc-common/test/integration/packageJson.spec.ts": "15b0292e7a45ccf3d4d285264bca60c657a28b6a", | ||
"packages/rlc-common/test/integration/mockHelper.ts": "a15f0920c58066a9d90792ac85b2027f4cdea491", | ||
"packages/rlc-common/test/integration/packageJson.spec.ts": "3d07ea7d2fae2510a319aef2219a566c84e00b1f", | ||
"packages/rlc-common/test/integration/static/package.json": "09d24ae57d9e1d9ff74e057c0caa90a22ffe147a", | ||
@@ -72,0 +72,0 @@ "packages/rlc-common/test/integration/vitestConfig.spec.ts": "ec157c5cdbcd50f8e3864c069c9447ab85034e1e", |
@@ -11,3 +11,3 @@ // Copyright (c) Microsoft Corporation. | ||
import { getRelativePartFromSrcPath } from "../helpers/pathUtils.js"; | ||
export function buildPackageFile(model, { exports, dependencies } = {}) { | ||
export function buildPackageFile(model, { exports, dependencies, clientContextPaths } = {}) { | ||
const config = { | ||
@@ -32,3 +32,4 @@ description: getDescription(model), | ||
specSource: model.options?.sourceFrom ?? "TypeSpec", | ||
dependencies | ||
dependencies, | ||
clientContextPaths | ||
}; | ||
@@ -35,0 +36,0 @@ if (isAzureMonorepoPackage(model)) { |
@@ -91,13 +91,15 @@ // Copyright (c) Microsoft Corporation. | ||
Key links: | ||
{{#if packageSourceURL}} | ||
[Source code]({{ packageSourceURL }}) | | ||
- [Source code]({{ packageSourceURL }}) | ||
{{/if}} | ||
{{#if packageNPMURL}} | ||
[Package (NPM)]({{ packageNPMURL }}) | | ||
- [Package (NPM)]({{ packageNPMURL }}) | ||
{{/if}} | ||
{{#if apiRefURL}} | ||
[API reference documentation]({{ apiRefURL }}) | | ||
- [API reference documentation]({{ apiRefURL }}) | ||
{{/if}} | ||
{{#if samplesURL}} | ||
[Samples]({{samplesURL}}) | ||
- [Samples]({{samplesURL}}) | ||
{{/if}} | ||
@@ -104,0 +106,0 @@ |
@@ -40,12 +40,2 @@ // Copyright (c) Microsoft Corporation. | ||
export function getAzureMonorepoPackageInfo(config) { | ||
const metadata = { | ||
constantPaths: [] | ||
}; | ||
addSwaggerMetadata(metadata, config.specSource); | ||
for (const clientFilePath of config.clientFilePaths) { | ||
metadata.constantPaths.push({ | ||
path: clientFilePath, | ||
prefix: "userAgentInfo" | ||
}); | ||
} | ||
const commonPackageInfo = getPackageCommonInfo(config); | ||
@@ -64,3 +54,3 @@ return { | ||
prettier: "@azure/eslint-plugin-azure-sdk/prettier.json", | ||
"//metadata": metadata | ||
"//metadata": getMetadataInfo(config) | ||
}; | ||
@@ -194,2 +184,18 @@ } | ||
} | ||
function getMetadataInfo(config) { | ||
const metadata = { | ||
constantPaths: [] | ||
}; | ||
const paths = config.isModularLibrary | ||
? config.clientContextPaths | ||
: config.clientFilePaths; | ||
addSwaggerMetadata(metadata, config.specSource); | ||
for (const path of paths ?? []) { | ||
metadata.constantPaths.push({ | ||
path: path, | ||
prefix: "userAgentInfo" | ||
}); | ||
} | ||
return metadata; | ||
} | ||
//# sourceMappingURL=buildAzureMonorepoPackage.js.map |
@@ -15,3 +15,3 @@ "use strict"; | ||
const pathUtils_js_1 = require("../helpers/pathUtils.js"); | ||
function buildPackageFile(model, { exports, dependencies } = {}) { | ||
function buildPackageFile(model, { exports, dependencies, clientContextPaths } = {}) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; | ||
@@ -37,3 +37,4 @@ const config = { | ||
specSource: (_m = (_l = model.options) === null || _l === void 0 ? void 0 : _l.sourceFrom) !== null && _m !== void 0 ? _m : "TypeSpec", | ||
dependencies | ||
dependencies, | ||
clientContextPaths | ||
}; | ||
@@ -40,0 +41,0 @@ if ((0, packageUtil_js_1.isAzureMonorepoPackage)(model)) { |
@@ -94,13 +94,15 @@ "use strict"; | ||
Key links: | ||
{{#if packageSourceURL}} | ||
[Source code]({{ packageSourceURL }}) | | ||
- [Source code]({{ packageSourceURL }}) | ||
{{/if}} | ||
{{#if packageNPMURL}} | ||
[Package (NPM)]({{ packageNPMURL }}) | | ||
- [Package (NPM)]({{ packageNPMURL }}) | ||
{{/if}} | ||
{{#if apiRefURL}} | ||
[API reference documentation]({{ apiRefURL }}) | | ||
- [API reference documentation]({{ apiRefURL }}) | ||
{{/if}} | ||
{{#if samplesURL}} | ||
[Samples]({{samplesURL}}) | ||
- [Samples]({{samplesURL}}) | ||
{{/if}} | ||
@@ -107,0 +109,0 @@ |
@@ -45,12 +45,2 @@ "use strict"; | ||
function getAzureMonorepoPackageInfo(config) { | ||
const metadata = { | ||
constantPaths: [] | ||
}; | ||
addSwaggerMetadata(metadata, config.specSource); | ||
for (const clientFilePath of config.clientFilePaths) { | ||
metadata.constantPaths.push({ | ||
path: clientFilePath, | ||
prefix: "userAgentInfo" | ||
}); | ||
} | ||
const commonPackageInfo = (0, packageCommon_js_1.getPackageCommonInfo)(config); | ||
@@ -69,3 +59,3 @@ return { | ||
prettier: "@azure/eslint-plugin-azure-sdk/prettier.json", | ||
"//metadata": metadata | ||
"//metadata": getMetadataInfo(config) | ||
}; | ||
@@ -199,2 +189,18 @@ } | ||
} | ||
function getMetadataInfo(config) { | ||
const metadata = { | ||
constantPaths: [] | ||
}; | ||
const paths = config.isModularLibrary | ||
? config.clientContextPaths | ||
: config.clientFilePaths; | ||
addSwaggerMetadata(metadata, config.specSource); | ||
for (const path of paths !== null && paths !== void 0 ? paths : []) { | ||
metadata.constantPaths.push({ | ||
path: path, | ||
prefix: "userAgentInfo" | ||
}); | ||
} | ||
return metadata; | ||
} | ||
//# sourceMappingURL=buildAzureMonorepoPackage.js.map |
{ | ||
"name": "@azure-tools/rlc-common", | ||
"version": "0.33.0-alpha.20241101.1", | ||
"version": "0.33.0-alpha.20241104.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -22,2 +22,3 @@ // Copyright (c) Microsoft Corporation. | ||
dependencies?: Record<string, string>; | ||
clientContextPaths?: string[]; | ||
} | ||
@@ -27,3 +28,3 @@ | ||
model: RLCModel, | ||
{ exports, dependencies }: PackageFileOptions = {} | ||
{ exports, dependencies, clientContextPaths }: PackageFileOptions = {} | ||
) { | ||
@@ -51,3 +52,4 @@ const config: PackageCommonInfoConfig = { | ||
specSource: model.options?.sourceFrom ?? "TypeSpec", | ||
dependencies | ||
dependencies, | ||
clientContextPaths | ||
}; | ||
@@ -54,0 +56,0 @@ |
@@ -95,13 +95,15 @@ // Copyright (c) Microsoft Corporation. | ||
Key links: | ||
{{#if packageSourceURL}} | ||
[Source code]({{ packageSourceURL }}) | | ||
- [Source code]({{ packageSourceURL }}) | ||
{{/if}} | ||
{{#if packageNPMURL}} | ||
[Package (NPM)]({{ packageNPMURL }}) | | ||
- [Package (NPM)]({{ packageNPMURL }}) | ||
{{/if}} | ||
{{#if apiRefURL}} | ||
[API reference documentation]({{ apiRefURL }}) | | ||
- [API reference documentation]({{ apiRefURL }}) | ||
{{/if}} | ||
{{#if samplesURL}} | ||
[Samples]({{samplesURL}}) | ||
- [Samples]({{samplesURL}}) | ||
{{/if}} | ||
@@ -108,0 +110,0 @@ |
@@ -18,2 +18,3 @@ // Copyright (c) Microsoft Corporation. | ||
clientFilePaths: string[]; | ||
clientContextPaths?: string[]; | ||
} | ||
@@ -61,14 +62,2 @@ | ||
): Record<string, any> { | ||
const metadata: Record<string, any> = { | ||
constantPaths: [] | ||
}; | ||
addSwaggerMetadata(metadata, config.specSource); | ||
for (const clientFilePath of config.clientFilePaths) { | ||
metadata.constantPaths.push({ | ||
path: clientFilePath, | ||
prefix: "userAgentInfo" | ||
}); | ||
} | ||
const commonPackageInfo = getPackageCommonInfo(config); | ||
@@ -88,3 +77,3 @@ | ||
prettier: "@azure/eslint-plugin-azure-sdk/prettier.json", | ||
"//metadata": metadata | ||
"//metadata": getMetadataInfo(config) | ||
}; | ||
@@ -261,1 +250,19 @@ } | ||
} | ||
function getMetadataInfo(config: AzureMonorepoInfoConfig) { | ||
const metadata: Record<string, any> = { | ||
constantPaths: [] | ||
}; | ||
const paths = config.isModularLibrary | ||
? config.clientContextPaths | ||
: config.clientFilePaths; | ||
addSwaggerMetadata(metadata, config.specSource); | ||
for (const path of paths ?? []) { | ||
metadata.constantPaths.push({ | ||
path: path, | ||
prefix: "userAgentInfo" | ||
}); | ||
} | ||
return metadata; | ||
} |
@@ -22,2 +22,3 @@ import { | ||
isModularLibrary?: boolean; | ||
azureSdkForJs?: boolean; | ||
}; | ||
@@ -52,3 +53,3 @@ | ||
sourceFrom: config.source ?? "TypeSpec", | ||
isModularLibrary: config.isModularLibrary ?? false | ||
isModularLibrary: config.isModularLibrary ?? false, | ||
}, | ||
@@ -55,0 +56,0 @@ helperDetails: { |
@@ -449,2 +449,28 @@ // Copyright (c) Microsoft Corporation. | ||
}); | ||
it("[esm] should read clientContextPaths from config for modular", () => { | ||
const model = createMockModel({ | ||
...baseConfig, | ||
moduleKind: "esm", | ||
isModularLibrary: true | ||
}); | ||
const packageFileContent = buildPackageFile(model, { | ||
clientContextPaths: ["src/api/chatCompletionsContext.ts"] | ||
}); | ||
const packageFile = JSON.parse(packageFileContent?.content ?? "{}"); | ||
expect(packageFile).to.have.property("//metadata"); | ||
expect(packageFile["//metadata"]["constantPaths"][0]).to.have.property("path", "src/api/chatCompletionsContext.ts", "modular"); | ||
}); | ||
it("[esm] should read clientPath from config for rlc", () => { | ||
const model = createMockModel({ | ||
...baseConfig, | ||
moduleKind: "esm", | ||
}); | ||
const packageFileContent = buildPackageFile(model); | ||
const packageFile = JSON.parse(packageFileContent?.content ?? "{}"); | ||
expect(packageFile).to.have.property("//metadata"); | ||
expect(packageFile["//metadata"]["constantPaths"][0]).to.have.property("path", "src/msinternal/test.ts", "rlc"); | ||
}); | ||
}); | ||
@@ -451,0 +477,0 @@ |
@@ -5,4 +5,5 @@ import { RLCModel } from "../interfaces.js"; | ||
dependencies?: Record<string, string>; | ||
clientContextPaths?: string[]; | ||
} | ||
export declare function buildPackageFile(model: RLCModel, { exports, dependencies }?: PackageFileOptions): { | ||
export declare function buildPackageFile(model: RLCModel, { exports, dependencies, clientContextPaths }?: PackageFileOptions): { | ||
path: string; | ||
@@ -9,0 +10,0 @@ content: string; |
@@ -5,2 +5,3 @@ import { AzurePackageInfoConfig } from "./azurePackageCommon.js"; | ||
clientFilePaths: string[]; | ||
clientContextPaths?: string[]; | ||
} | ||
@@ -7,0 +8,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1231354
22342