Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

[WIP] Setup experimental Rust codegen #96

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e66b466
Spike Rust codegen project
timkendall Dec 5, 2021
1a2ad6e
Add Rust output to .gitignore
timkendall Dec 5, 2021
7b90315
Get basline performance comparison
timkendall Jan 10, 2022
158b14b
Add Rust code formatting to pre-commit
timkendall Jan 10, 2022
44bd8b8
Get ast printing working
timkendall Jan 11, 2022
cb92905
Define structure of Rust codegen
timkendall Jan 17, 2022
1b8da96
Convert Plugin to a trait
timkendall Jan 17, 2022
e704337
Configure mutable SchemaVistorContext
timkendall Jan 17, 2022
2ea7ea9
Use matching instead of condition and unwrap
timkendall Jan 17, 2022
b5c1e0b
Render interface fields as string types
timkendall Jan 17, 2022
a350104
Spike out 'to_ts_type' utility
timkendall Jan 17, 2022
17d3b8f
Use dprint to format output
timkendall Jan 17, 2022
4e45450
Create a JavaScript bindings crate for the Rust codegen implementation
timkendall Jan 18, 2022
de02c02
Add codegen-rust-typescript build to source control
timkendall Jan 18, 2022
f20c84c
Experiment with WASI CLI
timkendall Feb 1, 2022
37df811
Run Rust CLI via WASI
timkendall Feb 1, 2022
1006bdc
Add enum definition support
timkendall Feb 2, 2022
8d46cc8
Add scalar definition support
timkendall Feb 2, 2022
2863cbc
Add union type support
timkendall Feb 2, 2022
237dd87
Spike out interface type generation
timkendall Feb 19, 2022
3093079
Rename codegen to compiler
timkendall Feb 19, 2022
bfd5014
Move wasm32-wasi binary to bin/
timkendall Feb 19, 2022
57d845c
Generate TypeScript interfaces for InputObjectTypes
timkendall Feb 19, 2022
ae43c2c
Make ObjectType and InterfaceType __typename fields required
timkendall Feb 19, 2022
77c5503
WIP
timkendall Jul 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,8 @@ notes.txt
failing-examples

sdk.ts
*_test.ts
*_test.ts

target

.DS_Store
8 changes: 8 additions & 0 deletions __tests__/starwars.schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
scalar ID
scalar String
scalar Int
scalar Float
scalar Boolean

scalar DateTime

schema {
query: Query
mutation: Mutation
Expand Down
29 changes: 29 additions & 0 deletions bin/tql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env node --experimental-wasi-unstable-preview1

const fs = require("fs");
const { WASI } = require("wasi");
const path = require('path')

const BINARY_PATH = './bin/tql.wasm'
const WASM_BINARY = fs.readFileSync(BINARY_PATH)

const [_node, _bin, ...rest] = process.argv

const schemaPath = rest[0]
const schemaDir = schemaPath && path.dirname(schemaPath)

const wasi = new WASI({
// first arg provided to wasi must still be the executable path
args: [_bin, ...rest],
preopens: schemaDir && {
// preopens must be directories not files
[schemaDir]: schemaDir
}
});

const importObject = { wasi_snapshot_preview1: wasi.wasiImport };

WebAssembly
.compile(WASM_BINARY)
.then(wasm => WebAssembly.instantiate(wasm, importObject))
.then(instance => wasi.start(instance));
Binary file added bin/tql.wasm
Binary file not shown.
Empty file removed codegen/__tests__/.gitkeep
Empty file.
2 changes: 0 additions & 2 deletions codegen/bin/index

This file was deleted.

55 changes: 0 additions & 55 deletions codegen/package.json

This file was deleted.

48 changes: 0 additions & 48 deletions codegen/src/CLI.ts

This file was deleted.

132 changes: 0 additions & 132 deletions codegen/src/__tests__/render.test.ts

This file was deleted.

3 changes: 0 additions & 3 deletions codegen/src/index.ts

This file was deleted.

27 changes: 0 additions & 27 deletions codegen/src/printers.ts

This file was deleted.

Loading