@azure-tools/typespec-go 0.17.7-dev.7 → 0.18.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +109 -0
- package/dist/src/codegen/core/helpers.d.ts +7 -0
- package/dist/src/codegen/core/helpers.d.ts.map +1 -1
- package/dist/src/codegen/core/helpers.js +20 -0
- package/dist/src/codegen/core/helpers.js.map +1 -1
- package/dist/src/codegen/core/operations.js +15 -2
- package/dist/src/codegen/core/operations.js.map +1 -1
- package/dist/src/codegen/fake/factory.js +1 -1
- package/dist/src/codegen/fake/factory.js.map +1 -1
- package/dist/src/codegen/fake/internal.js +1 -1
- package/dist/src/codegen/fake/servers.js +1 -1
- package/dist/src/codegen/fake/servers.js.map +1 -1
- package/dist/src/codemodel/module.js +2 -2
- package/dist/src/codemodel/module.js.map +1 -1
- package/dist/src/codemodel/type.js +2 -2
- package/dist/src/codemodel/type.js.map +1 -1
- package/dist/src/emitter.d.ts +1 -9
- package/dist/src/emitter.d.ts.map +1 -1
- package/dist/src/emitter.js +24 -157
- package/dist/src/emitter.js.map +1 -1
- package/dist/src/node-runner.browser.d.ts +3 -0
- package/dist/src/node-runner.browser.d.ts.map +1 -0
- package/dist/src/node-runner.browser.js +6 -0
- package/dist/src/node-runner.browser.js.map +1 -0
- package/dist/src/node-runner.d.ts +5 -0
- package/dist/src/node-runner.d.ts.map +1 -0
- package/dist/src/node-runner.js +96 -0
- package/dist/src/node-runner.js.map +1 -0
- package/dist/src/tcgcadapter/metadata.d.ts.map +1 -1
- package/dist/src/tcgcadapter/metadata.js +2 -29
- package/dist/src/tcgcadapter/metadata.js.map +1 -1
- package/package.json +27 -24
package/dist/src/emitter.js
CHANGED
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { NoTarget } from "@typespec/compiler";
|
|
6
|
-
import { execSync } from "child_process";
|
|
7
|
-
import { existsSync, opendirSync, readFileSync, unlinkSync } from "fs";
|
|
8
|
-
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
9
|
-
import * as path from "path";
|
|
5
|
+
import { getDirectoryPath, joinPaths, NoTarget, } from "@typespec/compiler";
|
|
10
6
|
import * as codegen from "./codegen/index.js";
|
|
11
7
|
import { CodeModelError } from "./codemodel/errors.js";
|
|
12
8
|
import { reportDiagnostic } from "./lib.js";
|
|
9
|
+
import { cleanupGeneratedFiles, runGoTools } from "./node-runner.js";
|
|
13
10
|
import { Adapter, ExternalError } from "./tcgcadapter/adapter.js";
|
|
14
11
|
import { AdapterError } from "./tcgcadapter/errors.js";
|
|
12
|
+
export { cleanupGeneratedFiles } from "./node-runner.js";
|
|
15
13
|
export async function $onEmit(context) {
|
|
16
14
|
try {
|
|
15
|
+
const host = context.program.host;
|
|
17
16
|
// if there's an existing go.mod file, we'll use its module
|
|
18
17
|
// identity instead of the provided value. this ensures we
|
|
19
18
|
// get the correct major version suffix (if any). if there's
|
|
@@ -22,9 +21,9 @@ export async function $onEmit(context) {
|
|
|
22
21
|
let moduleIdentity;
|
|
23
22
|
let currentDir = context.emitterOutputDir;
|
|
24
23
|
while (true) {
|
|
25
|
-
const goModFile =
|
|
26
|
-
if (
|
|
27
|
-
const goModFileContent =
|
|
24
|
+
const goModFile = joinPaths(currentDir, "go.mod");
|
|
25
|
+
if (await fileExists(host, goModFile)) {
|
|
26
|
+
const goModFileContent = (await host.readFile(goModFile)).text;
|
|
28
27
|
// the module identity is specified on the "module" directive, e.g.
|
|
29
28
|
// module github.com/Azure/azure-sdk-for-go/sdk/foo/v2
|
|
30
29
|
const match = goModFileContent.match(/^module\s+(\S+)/m);
|
|
@@ -41,7 +40,7 @@ export async function $onEmit(context) {
|
|
|
41
40
|
break;
|
|
42
41
|
}
|
|
43
42
|
// move to the parent directory
|
|
44
|
-
const parentDir =
|
|
43
|
+
const parentDir = getDirectoryPath(currentDir);
|
|
45
44
|
if (parentDir === currentDir) {
|
|
46
45
|
// we've reached the filesystem root without finding a go.mod.
|
|
47
46
|
// this is expected the first time an SDK is generated, in which
|
|
@@ -81,7 +80,7 @@ export async function $onEmit(context) {
|
|
|
81
80
|
}
|
|
82
81
|
const adapter = await Adapter.create(context);
|
|
83
82
|
const codeModel = adapter.tcgcToGoCodeModel();
|
|
84
|
-
await
|
|
83
|
+
await host.mkdirp(context.emitterOutputDir);
|
|
85
84
|
// clean up existing generated Go files
|
|
86
85
|
cleanupGeneratedFiles(context.emitterOutputDir);
|
|
87
86
|
let filePrefix;
|
|
@@ -93,13 +92,12 @@ export async function $onEmit(context) {
|
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
94
|
const emitter = new codegen.Emitter(codeModel, {
|
|
96
|
-
exists: (name) =>
|
|
97
|
-
|
|
98
|
-
},
|
|
99
|
-
read: (name) => readFile(`${context.emitterOutputDir}/${name}`, "utf8"),
|
|
95
|
+
exists: (name) => fileExists(host, joinPaths(context.emitterOutputDir, name)),
|
|
96
|
+
read: async (name) => (await host.readFile(joinPaths(context.emitterOutputDir, name))).text,
|
|
100
97
|
write: async (name, content) => {
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
const filePath = joinPaths(context.emitterOutputDir, name);
|
|
99
|
+
await host.mkdirp(getDirectoryPath(filePath));
|
|
100
|
+
return host.writeFile(filePath, content);
|
|
103
101
|
},
|
|
104
102
|
}, { filePrefix });
|
|
105
103
|
await emitter.emit("tsp");
|
|
@@ -107,91 +105,7 @@ export async function $onEmit(context) {
|
|
|
107
105
|
await emitter.emitExamples();
|
|
108
106
|
await emitter.emitLicenseFile();
|
|
109
107
|
await emitter.emitMetadataFile();
|
|
110
|
-
|
|
111
|
-
const goGenerateFileExists = goGenerateFile
|
|
112
|
-
? existsSync(`${context.emitterOutputDir}/${goGenerateFile}`)
|
|
113
|
-
: false;
|
|
114
|
-
if (goGenerateFile && !goGenerateFileExists) {
|
|
115
|
-
// go-generate was specified but we didn't find the file, so error and exit
|
|
116
|
-
context.program.reportDiagnostic({
|
|
117
|
-
code: "gogenerate",
|
|
118
|
-
severity: "error",
|
|
119
|
-
message: `the go-generate file wasn't found. the complete path is ${context.emitterOutputDir}/${goGenerateFile}`,
|
|
120
|
-
target: NoTarget,
|
|
121
|
-
});
|
|
122
|
-
// don't continue so the state of the SDK can be inspected without any additional changes
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
// probe to see if Go tools are on the path
|
|
126
|
-
try {
|
|
127
|
-
execSync("go version", { stdio: ["ignore", "ignore", "ignore"] });
|
|
128
|
-
}
|
|
129
|
-
catch {
|
|
130
|
-
// if the transforms file exists and we don't have Go
|
|
131
|
-
// on the path then make this an error as it means we
|
|
132
|
-
// expect to transform the generated code but were unable
|
|
133
|
-
// to do so.
|
|
134
|
-
let severity = "warning";
|
|
135
|
-
let message = "skip executing post emitter steps (is go on the path?)";
|
|
136
|
-
if (goGenerateFileExists) {
|
|
137
|
-
severity = "error";
|
|
138
|
-
message =
|
|
139
|
-
"unable to execute post emitter transformations due to missing go tool (is go on the path?)";
|
|
140
|
-
}
|
|
141
|
-
context.program.reportDiagnostic({
|
|
142
|
-
code: "GoVersion",
|
|
143
|
-
severity: severity,
|
|
144
|
-
message: message,
|
|
145
|
-
target: NoTarget,
|
|
146
|
-
});
|
|
147
|
-
// no Go tools available so exit
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
// if we have a post-generation transforms file then "go generate" it
|
|
151
|
-
if (goGenerateFileExists) {
|
|
152
|
-
try {
|
|
153
|
-
execSync(`go generate ${goGenerateFile}`, {
|
|
154
|
-
cwd: context.emitterOutputDir,
|
|
155
|
-
encoding: "ascii",
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
catch (err) {
|
|
159
|
-
context.program.reportDiagnostic({
|
|
160
|
-
code: "gogenerate",
|
|
161
|
-
severity: "error",
|
|
162
|
-
message: postEmitToolErrorMessage(`go generate ${goGenerateFile}`, err, context.emitterOutputDir),
|
|
163
|
-
target: NoTarget,
|
|
164
|
-
});
|
|
165
|
-
// don't continue so the state of the SDK can be inspected without any additional changes
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
// format after transforms in case any formatting gets munged
|
|
170
|
-
try {
|
|
171
|
-
execSync("gofmt -s -w .", { cwd: context.emitterOutputDir, encoding: "ascii" });
|
|
172
|
-
}
|
|
173
|
-
catch (err) {
|
|
174
|
-
context.program.reportDiagnostic({
|
|
175
|
-
code: "gofmt",
|
|
176
|
-
severity: "error",
|
|
177
|
-
message: postEmitToolErrorMessage("gofmt -s -w .", err, context.emitterOutputDir),
|
|
178
|
-
target: NoTarget,
|
|
179
|
-
});
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
// now go mod tidy
|
|
183
|
-
try {
|
|
184
|
-
execSync("go mod tidy", { cwd: context.emitterOutputDir, encoding: "ascii" });
|
|
185
|
-
}
|
|
186
|
-
catch (err) {
|
|
187
|
-
context.program.reportDiagnostic({
|
|
188
|
-
code: "gomodtidy",
|
|
189
|
-
severity: "error",
|
|
190
|
-
message: postEmitToolErrorMessage("go mod tidy", err, context.emitterOutputDir),
|
|
191
|
-
target: NoTarget,
|
|
192
|
-
});
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
108
|
+
runGoTools(context);
|
|
195
109
|
}
|
|
196
110
|
catch (error) {
|
|
197
111
|
if (error instanceof AdapterError) {
|
|
@@ -241,35 +155,16 @@ export async function $onEmit(context) {
|
|
|
241
155
|
}
|
|
242
156
|
}
|
|
243
157
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
* the Windows maximum path length, the underlying failure surfaces as a
|
|
254
|
-
* spurious ENOENT against the command shell rather than anything mentioning the
|
|
255
|
-
* path. In that case, replace the opaque error with an actionable explanation.
|
|
256
|
-
*
|
|
257
|
-
* @param command the command that was executed (for context in the message)
|
|
258
|
-
* @param err the error thrown by execSync
|
|
259
|
-
* @param outputDir the emitter output directory used as the working directory
|
|
260
|
-
* @returns the diagnostic message
|
|
261
|
-
*/
|
|
262
|
-
function postEmitToolErrorMessage(command, err, outputDir) {
|
|
263
|
-
const error = err;
|
|
264
|
-
if (process.platform === "win32" &&
|
|
265
|
-
error.code === "ENOENT" &&
|
|
266
|
-
outputDir.length > WINDOWS_MAX_PATH) {
|
|
267
|
-
return (`unable to run '${command}': the tool could not be launched. This is typically caused by the ` +
|
|
268
|
-
`emitter output directory path (${outputDir.length} characters) exceeding the Windows maximum ` +
|
|
269
|
-
`path length of ${WINDOWS_MAX_PATH}; Windows cannot use a working directory longer than this. ` +
|
|
270
|
-
`Emit to a shorter output directory. (output directory: ${outputDir})`);
|
|
158
|
+
async function fileExists(host, path) {
|
|
159
|
+
try {
|
|
160
|
+
return (await host.stat(path)).isFile();
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
if (error.code === "ENOENT") {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
throw error;
|
|
271
167
|
}
|
|
272
|
-
return error.message;
|
|
273
168
|
}
|
|
274
169
|
/**
|
|
275
170
|
* drop frames after the specified frame.
|
|
@@ -300,32 +195,4 @@ function majorVersion(identity) {
|
|
|
300
195
|
const match = identity.match(/\/v(\d+)$/);
|
|
301
196
|
return match ? parseInt(match[1], 10) : 1;
|
|
302
197
|
}
|
|
303
|
-
/**
|
|
304
|
-
* Clean up existing generated Go files in the output directory.
|
|
305
|
-
* Removes any .go files that contain the Microsoft code generator comment.
|
|
306
|
-
*
|
|
307
|
-
* exported for testing purposes only.
|
|
308
|
-
*
|
|
309
|
-
* @param outputDir the directory to clean up
|
|
310
|
-
*/
|
|
311
|
-
export function cleanupGeneratedFiles(outputDir) {
|
|
312
|
-
if (!existsSync(outputDir)) {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
const dir = opendirSync(outputDir);
|
|
316
|
-
while (true) {
|
|
317
|
-
const dirEnt = dir.readSync();
|
|
318
|
-
if (dirEnt === null) {
|
|
319
|
-
break;
|
|
320
|
-
}
|
|
321
|
-
if (dirEnt.isFile() && dirEnt.name.endsWith(".go")) {
|
|
322
|
-
const content = readFileSync(dir.path + "/" + dirEnt.name, "utf8");
|
|
323
|
-
if (codegen.doNotEditRegex.test(content)) {
|
|
324
|
-
unlinkSync(dir.path + "/" + dirEnt.name);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
dir.closeSync();
|
|
329
|
-
cleanupGeneratedFiles(outputDir + "/fake");
|
|
330
|
-
}
|
|
331
198
|
//# sourceMappingURL=emitter.js.map
|
package/dist/src/emitter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,
|
|
1
|
+
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAGL,gBAAgB,EAChB,SAAS,EACT,QAAQ,GACT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAyB,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,CAAC,KAAK,UAAU,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UAAU,SAAK"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License. See License.txt in the project root for license information.
|
|
3
|
+
// The playground owns its virtual output tree and cannot run native Go tools.
|
|
4
|
+
export function cleanupGeneratedFiles(_outputDir) { }
|
|
5
|
+
export function runGoTools() { }
|
|
6
|
+
//# sourceMappingURL=node-runner.browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-runner.browser.js","sourceRoot":"","sources":["../../src/node-runner.browser.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,8EAA8E;AAC9E,MAAM,UAAU,qBAAqB,CAAC,UAAkB,IAAG,CAAC;AAC5D,MAAM,UAAU,UAAU,KAAI,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type EmitContext } from "@typespec/compiler";
|
|
2
|
+
import type { GoEmitterOptions } from "./lib.js";
|
|
3
|
+
export declare function runGoTools(context: EmitContext<GoEmitterOptions>): void;
|
|
4
|
+
export declare function cleanupGeneratedFiles(outputDir: string): void;
|
|
5
|
+
//# sourceMappingURL=node-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-runner.d.ts","sourceRoot":"","sources":["../../src/node-runner.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,WAAW,EAAY,MAAM,oBAAoB,CAAC;AAIzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,gBAAgB,CAAC,QAuDhE;AAmBD,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,QAmBtD"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License. See License.txt in the project root for license information.
|
|
3
|
+
import { NoTarget } from "@typespec/compiler";
|
|
4
|
+
import { execSync } from "child_process";
|
|
5
|
+
import { existsSync, opendirSync, readFileSync, unlinkSync } from "fs";
|
|
6
|
+
import { doNotEditRegex } from "./codegen/index.js";
|
|
7
|
+
export function runGoTools(context) {
|
|
8
|
+
const goGenerateFile = context.options["go-generate"];
|
|
9
|
+
const goGenerateFileExists = goGenerateFile
|
|
10
|
+
? existsSync(`${context.emitterOutputDir}/${goGenerateFile}`)
|
|
11
|
+
: false;
|
|
12
|
+
if (goGenerateFile && !goGenerateFileExists) {
|
|
13
|
+
context.program.reportDiagnostic({
|
|
14
|
+
code: "gogenerate",
|
|
15
|
+
severity: "error",
|
|
16
|
+
message: `the go-generate file wasn't found. the complete path is ${context.emitterOutputDir}/${goGenerateFile}`,
|
|
17
|
+
target: NoTarget,
|
|
18
|
+
});
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
execSync("go version", { stdio: ["ignore", "ignore", "ignore"] });
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
let severity = "warning";
|
|
26
|
+
let message = "skip executing post emitter steps (is go on the path?)";
|
|
27
|
+
if (goGenerateFileExists) {
|
|
28
|
+
severity = "error";
|
|
29
|
+
message =
|
|
30
|
+
"unable to execute post emitter transformations due to missing go tool (is go on the path?)";
|
|
31
|
+
}
|
|
32
|
+
context.program.reportDiagnostic({
|
|
33
|
+
code: "GoVersion",
|
|
34
|
+
severity,
|
|
35
|
+
message,
|
|
36
|
+
target: NoTarget,
|
|
37
|
+
});
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const commands = [
|
|
41
|
+
...(goGenerateFileExists
|
|
42
|
+
? [[`go generate ${goGenerateFile}`, "gogenerate"]]
|
|
43
|
+
: []),
|
|
44
|
+
["gofmt -s -w .", "gofmt"],
|
|
45
|
+
["go mod tidy", "gomodtidy"],
|
|
46
|
+
];
|
|
47
|
+
for (const [command, code] of commands) {
|
|
48
|
+
try {
|
|
49
|
+
execSync(command, { cwd: context.emitterOutputDir, encoding: "ascii" });
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
context.program.reportDiagnostic({
|
|
53
|
+
code,
|
|
54
|
+
severity: "error",
|
|
55
|
+
message: postEmitToolErrorMessage(command, err, context.emitterOutputDir),
|
|
56
|
+
target: NoTarget,
|
|
57
|
+
});
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* When Windows cannot launch a tool because its working directory is too long,
|
|
64
|
+
* replace the misleading ENOENT error with an actionable diagnostic.
|
|
65
|
+
*/
|
|
66
|
+
function postEmitToolErrorMessage(command, err, outputDir) {
|
|
67
|
+
const error = err;
|
|
68
|
+
if (process.platform === "win32" && error.code === "ENOENT" && outputDir.length > 260) {
|
|
69
|
+
return (`unable to run '${command}': the tool could not be launched. This is typically caused by the ` +
|
|
70
|
+
`emitter output directory path (${outputDir.length} characters) exceeding the Windows maximum ` +
|
|
71
|
+
`path length of 260; Windows cannot use a working directory longer than this. ` +
|
|
72
|
+
`Emit to a shorter output directory. (output directory: ${outputDir})`);
|
|
73
|
+
}
|
|
74
|
+
return error.message;
|
|
75
|
+
}
|
|
76
|
+
export function cleanupGeneratedFiles(outputDir) {
|
|
77
|
+
if (!existsSync(outputDir)) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const dir = opendirSync(outputDir);
|
|
81
|
+
while (true) {
|
|
82
|
+
const dirEnt = dir.readSync();
|
|
83
|
+
if (dirEnt === null) {
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
if (dirEnt.isFile() && dirEnt.name.endsWith(".go")) {
|
|
87
|
+
const content = readFileSync(dir.path + "/" + dirEnt.name, "utf8");
|
|
88
|
+
if (doNotEditRegex.test(content)) {
|
|
89
|
+
unlinkSync(dir.path + "/" + dirEnt.name);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
dir.closeSync();
|
|
94
|
+
cleanupGeneratedFiles(outputDir + "/fake");
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=node-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-runner.js","sourceRoot":"","sources":["../../src/node-runner.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,OAAO,EAA6C,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,MAAM,UAAU,UAAU,CAAC,OAAsC;IAC/D,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACtD,MAAM,oBAAoB,GAAG,cAAc;QACzC,CAAC,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,gBAAgB,IAAI,cAAc,EAAE,CAAC;QAC7D,CAAC,CAAC,KAAK,CAAC;IAEV,IAAI,cAAc,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5C,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC;YAC/B,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,2DAA2D,OAAO,CAAC,gBAAgB,IAAI,cAAc,EAAE;YAChH,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,QAAQ,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;IACpE,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,QAAQ,GAAuB,SAAS,CAAC;QAC7C,IAAI,OAAO,GAA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ts","sourceRoot":"","sources":["../../../src/tcgcadapter/metadata.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,IAAI,MAAM,6CAA6C,CAAC;AAGpE;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,UAAU,CAAC,GAC3D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB"}
|
|
@@ -3,34 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as tcgc from "@azure-tools/typespec-client-generator-core";
|
|
6
|
-
import
|
|
7
|
-
import { createRequire } from "module";
|
|
8
|
-
import { dirname, join } from "path";
|
|
9
|
-
import { fileURLToPath } from "url";
|
|
10
|
-
/**
|
|
11
|
-
* Locates this emitter's own package.json version by walking up from the current
|
|
12
|
-
* module directory. Walking up (rather than using a fixed relative path) keeps
|
|
13
|
-
* this working across both the built layout and when the emitter is loaded from
|
|
14
|
-
* source (for example under vitest).
|
|
15
|
-
*/
|
|
16
|
-
function getEmitterVersion() {
|
|
17
|
-
const require = createRequire(import.meta.url);
|
|
18
|
-
let dir = dirname(fileURLToPath(import.meta.url));
|
|
19
|
-
for (;;) {
|
|
20
|
-
const candidate = join(dir, "package.json");
|
|
21
|
-
if (existsSync(candidate)) {
|
|
22
|
-
const pkg = require(candidate);
|
|
23
|
-
if (pkg["name"] === "@azure-tools/typespec-go") {
|
|
24
|
-
return pkg["version"];
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
const parent = dirname(dir);
|
|
28
|
-
if (parent === dir) {
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
dir = parent;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
6
|
+
import packageJson from "../../package.json" with { type: "json" };
|
|
34
7
|
/**
|
|
35
8
|
* Build the package metadata from the TCGC SDK package metadata.
|
|
36
9
|
*
|
|
@@ -42,7 +15,7 @@ export function buildMetadata(metadata) {
|
|
|
42
15
|
if (metadata.apiVersions && metadata.apiVersions.size > 0) {
|
|
43
16
|
result.apiVersions = Object.fromEntries(metadata.apiVersions);
|
|
44
17
|
}
|
|
45
|
-
result.emitterVersion =
|
|
18
|
+
result.emitterVersion = packageJson.version;
|
|
46
19
|
return result;
|
|
47
20
|
}
|
|
48
21
|
//# sourceMappingURL=metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/tcgcadapter/metadata.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,IAAI,MAAM,6CAA6C,CAAC;AACpE,OAAO,
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/tcgcadapter/metadata.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,IAAI,MAAM,6CAA6C,CAAC;AACpE,OAAO,WAAW,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,QAA4D;IAE5D,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,IAAI,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,CAAC,cAAc,GAAG,WAAW,CAAC,OAAO,CAAC;IAE5C,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-go",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0-dev.10",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec emitter for Go SDKs",
|
|
6
6
|
"homepage": "https://azure.github.io/typespec-azure",
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
"default": "./dist/src/index.js"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
+
"browser": {
|
|
30
|
+
"./src/node-runner.js": "./src/node-runner.browser.js"
|
|
31
|
+
},
|
|
29
32
|
"tspMain": "dist/src/index.js",
|
|
30
33
|
"engines": {
|
|
31
34
|
"node": ">=22.0.0"
|
|
@@ -38,51 +41,51 @@
|
|
|
38
41
|
"LICENSE"
|
|
39
42
|
],
|
|
40
43
|
"peerDependencies": {
|
|
41
|
-
"@azure-tools/typespec-autorest": "^0.73.
|
|
42
|
-
"@azure-tools/typespec-azure-core": "^0.73.0 || >= 0.74.0-dev.
|
|
43
|
-
"@azure-tools/typespec-azure-resource-manager": "^0.73.0 || >= 0.74.0-dev.
|
|
44
|
-
"@azure-tools/typespec-azure-rulesets": "^0.73.0 || >= 0.74.0-dev.
|
|
45
|
-
"@azure-tools/typespec-client-generator-core": "^0.73.0 || >= 0.74.0-dev.
|
|
46
|
-
"@typespec/
|
|
44
|
+
"@azure-tools/typespec-autorest": "^0.73.2 || >= 0.74.0-dev.2",
|
|
45
|
+
"@azure-tools/typespec-azure-core": "^0.73.0 || >= 0.74.0-dev.5",
|
|
46
|
+
"@azure-tools/typespec-azure-resource-manager": "^0.73.0 || >= 0.74.0-dev.10",
|
|
47
|
+
"@azure-tools/typespec-azure-rulesets": "^0.73.0 || >= 0.74.0-dev.13",
|
|
48
|
+
"@azure-tools/typespec-client-generator-core": "^0.73.0 || >= 0.74.0-dev.12",
|
|
49
|
+
"@typespec/events": "^0.87.0",
|
|
47
50
|
"@typespec/openapi": "^1.17.0",
|
|
48
51
|
"@typespec/rest": "^0.87.0",
|
|
49
|
-
"@typespec/
|
|
50
|
-
"@typespec/compiler": "^1.17.0",
|
|
52
|
+
"@typespec/streams": "^0.87.0",
|
|
51
53
|
"@typespec/versioning": "^0.87.0",
|
|
52
|
-
"@typespec/sse": "^0.87.0",
|
|
53
54
|
"@typespec/xml": "^0.87.0",
|
|
54
|
-
"@typespec/
|
|
55
|
+
"@typespec/sse": "^0.87.0",
|
|
56
|
+
"@typespec/compiler": "^1.17.0",
|
|
57
|
+
"@typespec/http": "^1.17.0"
|
|
55
58
|
},
|
|
56
59
|
"dependencies": {
|
|
57
60
|
"semver": "^7.8.5"
|
|
58
61
|
},
|
|
59
62
|
"devDependencies": {
|
|
60
|
-
"@azure-tools/azure-http-specs": "^0.1.0-alpha.46 || >= 0.1.0-alpha.47-dev.
|
|
61
|
-
"@azure-tools/typespec-autorest": "^0.73.
|
|
62
|
-
"@azure-tools/typespec-azure-core": "^0.73.0 || >= 0.74.0-dev.
|
|
63
|
-
"@azure-tools/typespec-azure-resource-manager": "^0.73.0 || >= 0.74.0-dev.
|
|
64
|
-
"@azure-tools/typespec-azure-rulesets": "^0.73.0 || >= 0.74.0-dev.
|
|
65
|
-
"@azure-tools/typespec-client-generator-core": "^0.73.0 || >= 0.74.0-dev.
|
|
63
|
+
"@azure-tools/azure-http-specs": "^0.1.0-alpha.46 || >= 0.1.0-alpha.47-dev.3",
|
|
64
|
+
"@azure-tools/typespec-autorest": "^0.73.2 || >= 0.74.0-dev.2",
|
|
65
|
+
"@azure-tools/typespec-azure-core": "^0.73.0 || >= 0.74.0-dev.5",
|
|
66
|
+
"@azure-tools/typespec-azure-resource-manager": "^0.73.0 || >= 0.74.0-dev.10",
|
|
67
|
+
"@azure-tools/typespec-azure-rulesets": "^0.73.0 || >= 0.74.0-dev.13",
|
|
68
|
+
"@azure-tools/typespec-client-generator-core": "^0.73.0 || >= 0.74.0-dev.12",
|
|
66
69
|
"@types/node": "^26.6.4",
|
|
67
70
|
"@types/semver": "^7.8.0",
|
|
68
|
-
"@vitest/coverage-v8": "^5.0.
|
|
69
|
-
"@vitest/ui": "^5.0.
|
|
71
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
72
|
+
"@vitest/ui": "^5.0.5",
|
|
70
73
|
"rimraf": "^6.1.3",
|
|
71
74
|
"typescript": "npm:@typescript/typescript6@~6.0.2",
|
|
72
|
-
"vitest": "^5.0.
|
|
75
|
+
"vitest": "^5.0.5",
|
|
73
76
|
"@azure-tools/spector-runner": "^0.1.0",
|
|
74
77
|
"@typespec/events": "^0.87.0",
|
|
75
78
|
"@typespec/compiler": "^1.17.0",
|
|
76
79
|
"@typespec/http": "^1.17.0",
|
|
77
|
-
"@typespec/http-specs": "^0.1.0-alpha.
|
|
80
|
+
"@typespec/http-specs": "^0.1.0-alpha.45",
|
|
78
81
|
"@typespec/openapi": "^1.17.0",
|
|
79
82
|
"@typespec/rest": "^0.87.0",
|
|
83
|
+
"@typespec/streams": "^0.87.0",
|
|
80
84
|
"@typespec/spec-api": "^0.1.0-alpha.17",
|
|
81
|
-
"@typespec/spector": "^0.1.0-alpha.30",
|
|
82
85
|
"@typespec/sse": "^0.87.0",
|
|
83
|
-
"@typespec/
|
|
84
|
-
"@typespec/versioning": "^0.87.0",
|
|
86
|
+
"@typespec/spector": "^0.1.0-alpha.30",
|
|
85
87
|
"@typespec/tspd": "^0.77.1",
|
|
88
|
+
"@typespec/versioning": "^0.87.0",
|
|
86
89
|
"@typespec/xml": "^0.87.0"
|
|
87
90
|
},
|
|
88
91
|
"scripts": {
|