typespec-rust-emitter 0.1.0
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 +220 -0
- package/dist/src/emitter.d.ts +7 -0
- package/dist/src/emitter.js +490 -0
- package/dist/src/emitter.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib.d.ts +12 -0
- package/dist/src/lib.js +7 -0
- package/dist/src/lib.js.map +1 -0
- package/dist/src/testing/index.d.ts +2 -0
- package/dist/src/testing/index.js +8 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/test/hello.test.d.ts +1 -0
- package/dist/test/hello.test.js +140 -0
- package/dist/test/hello.test.js.map +1 -0
- package/dist/test/test-host.d.ts +4 -0
- package/dist/test/test-host.js +16 -0
- package/dist/test/test-host.js.map +1 -0
- package/eslint.config.js +20 -0
- package/example/lib/learning/models.tsp +189 -0
- package/example/lib/learning/operations.tsp +319 -0
- package/example/main.tsp +8 -0
- package/example/output-rust/Cargo.lock +1731 -0
- package/example/output-rust/Cargo.toml +12 -0
- package/example/output-rust/src/generated/mod.rs +1 -0
- package/example/output-rust/src/generated/types.rs +315 -0
- package/example/output-rust/src/main.rs +5 -0
- package/example/output-rust/src/mod.rs +1 -0
- package/example/package-lock.json +1495 -0
- package/example/package.json +15 -0
- package/example/tspconfig.yaml +10 -0
- package/justfile +15 -0
- package/package.json +64 -0
- package/prettierrc.yaml +8 -0
- package/src/emitter.ts +685 -0
- package/src/index.ts +3 -0
- package/src/lib.ts +8 -0
- package/src/lib.tsp +6 -0
- package/src/testing/index.ts +8 -0
- package/test/hello.test.ts +168 -0
- package/test/test-host.ts +20 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "example",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": true,
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@typespec/compiler": "latest",
|
|
8
|
+
"@typespec/http": "latest",
|
|
9
|
+
"@typespec/rest": "latest",
|
|
10
|
+
"@typespec/openapi": "latest",
|
|
11
|
+
"@typespec/openapi3": "latest",
|
|
12
|
+
"typespec-rust-emitter": "file:.."
|
|
13
|
+
},
|
|
14
|
+
"packageManager": "npm@11.12.1+sha512.cdca14b85d647b3192028d02aadbe82d75f79a446aceea9874be98e6d768f20ebd3555770a48d0e9906106007877bbc690f715e9372f2e2dc644a3c3157fb14c"
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
emit:
|
|
2
|
+
- "@typespec/openapi3"
|
|
3
|
+
- "typespec-rust-emitter"
|
|
4
|
+
options:
|
|
5
|
+
"@typespec/openapi3":
|
|
6
|
+
emitter-output-dir: "{output-dir}/schema"
|
|
7
|
+
openapi-versions:
|
|
8
|
+
- 3.1.0
|
|
9
|
+
"typespec-rust-emitter":
|
|
10
|
+
emitter-output-dir: "{output-dir}/../output-rust/src/generated"
|
package/justfile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
build:
|
|
2
|
+
npm run build
|
|
3
|
+
|
|
4
|
+
install:
|
|
5
|
+
npm install
|
|
6
|
+
cd example && npm install
|
|
7
|
+
|
|
8
|
+
compile: install
|
|
9
|
+
cd example && rm -rf output-rust/src/generated && mkdir -p output-rust/src/generated && tsp compile . && echo 'mod types;' > output-rust/src/generated/mod.rs
|
|
10
|
+
|
|
11
|
+
test:
|
|
12
|
+
npm test
|
|
13
|
+
|
|
14
|
+
check-rust:
|
|
15
|
+
cd example/output-rust && cargo check
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "typespec-rust-emitter",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeSpec emitter that generates idiomatic Rust types and structs",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"typespec",
|
|
7
|
+
"typespec-emitter",
|
|
8
|
+
"rust",
|
|
9
|
+
"codegen",
|
|
10
|
+
"openapi",
|
|
11
|
+
"api"
|
|
12
|
+
],
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "opencode",
|
|
15
|
+
"url": "https://opencode.ai"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/cuikho210/typespec-rust-emitter"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/cuikho210/typespec-rust-emitter/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/cuikho210/typespec-rust-emitter#readme",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "dist/src/index.js",
|
|
28
|
+
"tspMain": "src/lib.tsp",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"typespec": "./src/lib.tsp",
|
|
32
|
+
"types": "./dist/src/index.d.ts",
|
|
33
|
+
"default": "./dist/src/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./testing": {
|
|
36
|
+
"types": "./dist/src/testing/index.d.ts",
|
|
37
|
+
"default": "./dist/src/testing/index.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@typespec/compiler": ">=1.0.0",
|
|
42
|
+
"@typespec/emitter-framework": "^0.17.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "latest",
|
|
46
|
+
"@typespec/compiler": "latest",
|
|
47
|
+
"eslint": "^9.15.0",
|
|
48
|
+
"prettier": "^3.3.3",
|
|
49
|
+
"typescript": "^5.3.3",
|
|
50
|
+
"typescript-eslint": "^8.49.0"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsc",
|
|
54
|
+
"watch": "tsc --watch",
|
|
55
|
+
"test": "tsc && node --test 'dist/test**/*.test.js'",
|
|
56
|
+
"lint": "eslint src/ test/ --report-unused-disable-directives --max-warnings=0",
|
|
57
|
+
"lint:fix": "eslint . --report-unused-disable-directives --fix",
|
|
58
|
+
"format": "prettier . --write",
|
|
59
|
+
"format:check": "prettier --check ."
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=18.0.0"
|
|
63
|
+
}
|
|
64
|
+
}
|
package/prettierrc.yaml
ADDED