@azure-tools/typespec-ts 0.55.0-dev.3 → 0.55.0-dev.4
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/framework/load-static-helpers.d.ts +4 -1
- package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.js +15 -10
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/framework/sample.js +1 -1
- package/dist/src/framework/sample.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +37 -18
- package/dist/src/index.js.map +1 -1
- package/dist/src/modular/emit-tests.d.ts +2 -1
- package/dist/src/modular/emit-tests.d.ts.map +1 -1
- package/dist/src/modular/emit-tests.js +18 -8
- package/dist/src/modular/emit-tests.js.map +1 -1
- package/dist/src/rlc-common/build-client-definitions.js +1 -1
- package/dist/src/rlc-common/build-client-definitions.js.map +1 -1
- package/dist/src/rlc-common/build-client.js +1 -1
- package/dist/src/rlc-common/build-client.js.map +1 -1
- package/dist/src/rlc-common/build-index-file.js +1 -1
- package/dist/src/rlc-common/build-index-file.js.map +1 -1
- package/dist/src/rlc-common/build-is-unexpected-helper.js +1 -1
- package/dist/src/rlc-common/build-is-unexpected-helper.js.map +1 -1
- package/dist/src/rlc-common/build-logger.js +1 -1
- package/dist/src/rlc-common/build-logger.js.map +1 -1
- package/dist/src/rlc-common/build-parameter-types.js +1 -1
- package/dist/src/rlc-common/build-parameter-types.js.map +1 -1
- package/dist/src/rlc-common/build-response-types.js +1 -1
- package/dist/src/rlc-common/build-response-types.js.map +1 -1
- package/dist/src/rlc-common/build-schema-type.js +1 -1
- package/dist/src/rlc-common/build-schema-type.js.map +1 -1
- package/dist/src/rlc-common/build-top-level-index-file.js +1 -1
- package/dist/src/rlc-common/build-top-level-index-file.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.js +1 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-es-lint-config.js +1 -1
- package/dist/src/rlc-common/metadata/build-es-lint-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-package-file.js +1 -1
- package/dist/src/rlc-common/metadata/build-package-file.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts +2 -2
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-readme-file.js +5 -8
- package/dist/src/rlc-common/metadata/build-readme-file.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-rollup-config.js +1 -1
- package/dist/src/rlc-common/metadata/build-rollup-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-ts-config.js +1 -1
- package/dist/src/rlc-common/metadata/build-ts-config.js.map +1 -1
- package/dist/src/utils/emit-util.d.ts.map +1 -1
- package/dist/src/utils/emit-util.js +7 -1
- package/dist/src/utils/emit-util.js.map +1 -1
- package/dist/src/utils/file-system-utils.d.ts +4 -4
- package/dist/src/utils/file-system-utils.d.ts.map +1 -1
- package/dist/src/utils/file-system-utils.js +12 -13
- package/dist/src/utils/file-system-utils.js.map +1 -1
- package/dist/src/utils/resolve-project-root.d.ts +6 -4
- package/dist/src/utils/resolve-project-root.d.ts.map +1 -1
- package/dist/src/utils/resolve-project-root.js +11 -16
- package/dist/src/utils/resolve-project-root.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/framework/load-static-helpers.ts +25 -13
- package/src/framework/sample.ts +1 -1
- package/src/index.ts +44 -16
- package/src/modular/emit-tests.ts +22 -9
- package/src/rlc-common/build-client-definitions.ts +1 -1
- package/src/rlc-common/build-client.ts +1 -1
- package/src/rlc-common/build-index-file.ts +1 -1
- package/src/rlc-common/build-is-unexpected-helper.ts +1 -1
- package/src/rlc-common/build-logger.ts +1 -1
- package/src/rlc-common/build-parameter-types.ts +1 -1
- package/src/rlc-common/build-response-types.ts +1 -1
- package/src/rlc-common/build-schema-type.ts +1 -1
- package/src/rlc-common/build-top-level-index-file.ts +1 -1
- package/src/rlc-common/metadata/build-api-extractor-config.ts +1 -1
- package/src/rlc-common/metadata/build-es-lint-config.ts +1 -1
- package/src/rlc-common/metadata/build-package-file.ts +1 -1
- package/src/rlc-common/metadata/build-readme-file.ts +5 -8
- package/src/rlc-common/metadata/build-rollup-config.ts +1 -1
- package/src/rlc-common/metadata/build-ts-config.ts +1 -1
- package/src/utils/emit-util.ts +7 -4
- package/src/utils/file-system-utils.ts +13 -13
- package/src/utils/resolve-project-root.ts +11 -22
|
@@ -1,38 +1,37 @@
|
|
|
1
1
|
import { NoTarget, resolvePath } from "@typespec/compiler";
|
|
2
|
-
import { mkdir, readdir, rm, stat } from "fs/promises";
|
|
3
2
|
import { reportDiagnostic } from "../lib.js";
|
|
4
|
-
export async function pathExists(targetPath) {
|
|
3
|
+
export async function pathExists(host, targetPath) {
|
|
5
4
|
try {
|
|
6
|
-
await stat(targetPath);
|
|
5
|
+
await host.stat(targetPath);
|
|
7
6
|
return true;
|
|
8
7
|
}
|
|
9
8
|
catch {
|
|
10
9
|
return false;
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
|
-
export async function emptyDir(dirPath) {
|
|
12
|
+
export async function emptyDir(host, dirPath) {
|
|
14
13
|
let entries;
|
|
15
14
|
try {
|
|
16
|
-
entries = await
|
|
15
|
+
entries = await host.readDir(dirPath);
|
|
17
16
|
}
|
|
18
17
|
catch {
|
|
19
|
-
await
|
|
18
|
+
await host.mkdirp(dirPath);
|
|
20
19
|
return;
|
|
21
20
|
}
|
|
22
|
-
await Promise.all(entries.map((entry) => rm(resolvePath(dirPath, entry), { recursive: true
|
|
21
|
+
await Promise.all(entries.map((entry) => host.rm(resolvePath(dirPath, entry), { recursive: true })));
|
|
23
22
|
}
|
|
24
|
-
export async function clearDirectory(dirPath, excludeNames = [], program) {
|
|
25
|
-
if (!(await pathExists(dirPath))) {
|
|
23
|
+
export async function clearDirectory(host, dirPath, excludeNames = [], program) {
|
|
24
|
+
if (!(await pathExists(host, dirPath))) {
|
|
26
25
|
return;
|
|
27
26
|
}
|
|
28
27
|
// If no exclude names, just use regular emptyDir for efficiency
|
|
29
28
|
if (excludeNames.length === 0) {
|
|
30
|
-
await emptyDir(dirPath);
|
|
29
|
+
await emptyDir(host, dirPath);
|
|
31
30
|
return;
|
|
32
31
|
}
|
|
33
32
|
try {
|
|
34
33
|
// Get all subdirectories and files
|
|
35
|
-
const entries = await
|
|
34
|
+
const entries = await host.readDir(dirPath);
|
|
36
35
|
// Filter entries to exclude those that should be preserved
|
|
37
36
|
const filteredEntries = entries.filter((entry) => {
|
|
38
37
|
return !excludeNames.includes(entry);
|
|
@@ -40,7 +39,7 @@ export async function clearDirectory(dirPath, excludeNames = [], program) {
|
|
|
40
39
|
// Process each entry
|
|
41
40
|
for (const entry of filteredEntries) {
|
|
42
41
|
const entryPath = resolvePath(dirPath, entry);
|
|
43
|
-
await rm(entryPath, { recursive: true
|
|
42
|
+
await host.rm(entryPath, { recursive: true });
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
catch (error) {
|
|
@@ -52,7 +51,7 @@ export async function clearDirectory(dirPath, excludeNames = [], program) {
|
|
|
52
51
|
target: NoTarget,
|
|
53
52
|
});
|
|
54
53
|
}
|
|
55
|
-
await emptyDir(dirPath);
|
|
54
|
+
await emptyDir(host, dirPath);
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
//# sourceMappingURL=file-system-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-system-utils.js","sourceRoot":"","sources":["../../../src/utils/file-system-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAW,WAAW,
|
|
1
|
+
{"version":3,"file":"file-system-utils.js","sourceRoot":"","sources":["../../../src/utils/file-system-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAW,WAAW,EAAqB,MAAM,oBAAoB,CAAC;AACvF,O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2DAA2D;QAC3D,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YAC/C,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,qBAAqB;QACrB,KAAK,MAAM,KAAK,IAAI,eAAe,EAAE,CAAC;YACpC,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC9C,MAAM,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,qDAAqD;QACrD,IAAI,OAAO,EAAE,CAAC;YACZ,gBAAgB,CAAC,OAAO,EAAE;gBACxB,IAAI,EAAE,2BAA2B;gBACjC,MAAM,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE;gBACpD,MAAM,EAAE,QAAQ;aACjB,CAAC,CAAC;QACL,CAAC;QACD,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Returns the package root directory for the emitter.
|
|
3
|
+
*
|
|
4
|
+
* The compiled output lives at `dist/src/utils/resolve-project-root.js`,
|
|
5
|
+
* so the package root is 3 levels up. This avoids filesystem access,
|
|
6
|
+
* making it compatible with virtual file systems (e.g., the playground).
|
|
5
7
|
*/
|
|
6
|
-
export declare function resolveProjectRoot(
|
|
8
|
+
export declare function resolveProjectRoot(): string;
|
|
7
9
|
//# sourceMappingURL=resolve-project-root.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-project-root.d.ts","sourceRoot":"","sources":["../../../src/utils/resolve-project-root.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-project-root.d.ts","sourceRoot":"","sources":["../../../src/utils/resolve-project-root.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAK3C"}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { dirname, resolve } from "path";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
1
|
+
import { resolvePath } from "@typespec/compiler";
|
|
4
2
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* Returns the package root directory for the emitter.
|
|
4
|
+
*
|
|
5
|
+
* The compiled output lives at `dist/src/utils/resolve-project-root.js`,
|
|
6
|
+
* so the package root is 3 levels up. This avoids filesystem access,
|
|
7
|
+
* making it compatible with virtual file systems (e.g., the playground).
|
|
8
8
|
*/
|
|
9
|
-
export function resolveProjectRoot(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const parentDir = resolve(currentDir, "..");
|
|
15
|
-
if (parentDir === currentDir) {
|
|
16
|
-
throw new Error("Could not find package.json");
|
|
17
|
-
}
|
|
18
|
-
return resolveProjectRoot(parentDir);
|
|
9
|
+
export function resolveProjectRoot() {
|
|
10
|
+
// Use the global URL constructor (works in both Node.js and browsers)
|
|
11
|
+
const currentDir = new URL(".", import.meta.url).pathname;
|
|
12
|
+
// From dist/src/utils/ -> package root (3 levels: utils -> src -> dist -> root)
|
|
13
|
+
return resolvePath(currentDir, "../../..");
|
|
19
14
|
}
|
|
20
15
|
//# sourceMappingURL=resolve-project-root.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-project-root.js","sourceRoot":"","sources":["../../../src/utils/resolve-project-root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"resolve-project-root.js","sourceRoot":"","sources":["../../../src/utils/resolve-project-root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB;IAChC,sEAAsE;IACtE,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;IAC1D,gFAAgF;IAChF,OAAO,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAC7C,CAAC"}
|