-
Notifications
You must be signed in to change notification settings - Fork 49
feat(wasm-as): codegen should create IModule interface #1460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
4557869
wip: module class for assemblyscript wrapper
Niraj-Kamdar 9c0f92e
feat: e2e for bigint wasm-as wrapper working
Niraj-Kamdar 51ea8d7
fix: add tests for wasm-as wrappers
Niraj-Kamdar e55af62
fix: wasm-as.spec.ts
Niraj-Kamdar e2224aa
debug
Niraj-Kamdar e09f4d8
debug: react
Niraj-Kamdar 7214d3d
Merge branch 'origin-dev' into nk/module-class-wasm
Niraj-Kamdar 65d7416
fix: react issue
Niraj-Kamdar 53080d6
fix: e2e test issues
Niraj-Kamdar e4b3a3f
fix: wasm-wrapper tests
Niraj-Kamdar 068f806
Merge remote-tracking branch 'upstream/origin-dev' into nk/module-cla…
Niraj-Kamdar d28dbb8
revert: react patch since merged
Niraj-Kamdar c34541e
fix: yarn.lock
Niraj-Kamdar fcf65b5
fix: issues
Niraj-Kamdar 4ffbfe7
revert: test-env-js changes
Niraj-Kamdar b183636
fix: validate and plugins tests
Niraj-Kamdar 6f19410
fix: cli tests
Niraj-Kamdar 9659dcf
fix: entry point
Niraj-Kamdar 1ded87b
feat: use transform to add hasEnv to moduleType
Niraj-Kamdar 47e579c
feat: reserve dunder methods for polywrap binding usecases
Niraj-Kamdar 8721c8d
feat: add env as reserved keyword for polywrap bindings
Niraj-Kamdar 6197791
fix(wasm-as): bindings for env
Niraj-Kamdar ae2555e
fix(wasm-as): binding test cases
Niraj-Kamdar 442dd22
Merge branch 'origin-dev' into nk/module-class-wasm
Niraj-Kamdar 66839d7
fix: issues
Niraj-Kamdar 93ffd62
fix: issues
Niraj-Kamdar ed8141c
fix: issues
Niraj-Kamdar 7fa372e
Merge remote-tracking branch 'upstream/origin-dev' into nk/module-cla…
Niraj-Kamdar 22842d9
feat: env should be available as function parameter when required
Niraj-Kamdar edc6374
WIP: Plugin env refactor
Niraj-Kamdar ad7662c
Merge remote-tracking branch 'upstream/origin-dev' into nk/module-cla…
Niraj-Kamdar d4fd225
fix: update template
Niraj-Kamdar 2423c07
Update types.ts
Niraj-Kamdar 410865a
merge origin-dev
dOrgJelli 8416de4
chore: fix merge
dOrgJelli ad08c4f
chore: use wrap-test-harness branch
dOrgJelli 482d4f9
chore: remove validate test cases
dOrgJelli 3d8be87
chore: remove moduleHasEnv, not used
dOrgJelli 570c45d
chore: trigger CI
dOrgJelli 4683e6e
chore: fix env passing to wrap-test-harness CLI
dOrgJelli 75555bd
chore: fix wrap-test-harness workflow
dOrgJelli 4d52d38
chore: fix ci-wrap-test-harness toolchain checkout branch ref
dOrgJelli a9cd928
chore: disable .cargo registry index mount
dOrgJelli bf3bef2
chore: add back .cargo cache volume
dOrgJelli 314621d
fix: mount entire ~/.cargo directory, fixing parallel builds
dOrgJelli 6d6e220
chore: lint fix
dOrgJelli cd2bad9
chore: fix tests
dOrgJelli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| master | ||
| module-class-wasm-as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...ges/schema/bind/src/bindings/assemblyscript/wasm/templates/module-type/module-ts.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import * as Types from ".."; | ||
|
|
||
| import { | ||
| BigInt, | ||
| BigNumber, | ||
| Box, | ||
| JSON, | ||
| } from "@polywrap/wasm-as"; | ||
|
|
||
| export abstract class ModuleBase { | ||
| {{#methods}} | ||
| abstract {{#detectKeyword}}{{name}}{{/detectKeyword}}( | ||
| args: Types.Args_{{#detectKeyword}}{{name}}{{/detectKeyword}}{{#env}}, | ||
| env: {{#required}}Types.Env{{/required}}{{^required}}Types.Env | null{{/required}}{{/env}} | ||
| ): {{#return}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/return}}; | ||
| {{^last}} | ||
|
|
||
| {{/last}} | ||
| {{/methods}} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
packages/schema/parse/src/__tests__/dunder-methods.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import { parseSchema } from ".."; | ||
|
|
||
| const ErrorSchemas = { | ||
| "__new__": ` | ||
| type Module { | ||
| __new__: String! | ||
| } | ||
| `, | ||
| "__hello__": ` | ||
| type Module { | ||
| __hello__: String! | ||
| } | ||
| `, | ||
| } | ||
|
|
||
| const ValidSchemas = { | ||
| "_new_": ` | ||
| type Module { | ||
| _new_: String! | ||
| } | ||
| `, | ||
| "__new": ` | ||
| type Module { | ||
| __new: String! | ||
| } | ||
| `, | ||
| "new__": ` | ||
| type Module { | ||
| new__: String! | ||
| } | ||
| `, | ||
| "_hello__": ` | ||
| type Module { | ||
| _hello__: String! | ||
| } | ||
| ` | ||
| } | ||
|
|
||
| describe("Polywrap Schema shouldn't contain dunder method name", () => { | ||
|
|
||
| for (const [key, value] of Object.entries(ErrorSchemas)) { | ||
| it(`should throw error for ${key}`, () => { | ||
| expect(() => parseSchema(value)).toThrowError(); | ||
| }); | ||
| } | ||
|
|
||
| for (const [key, value] of Object.entries(ValidSchemas)) { | ||
| it(`shouldn't throw error for ${key}`, () => { | ||
| expect(() => parseSchema(value)).not.toThrowError(); | ||
| }); | ||
| } | ||
|
|
||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| import { Args_sampleMethod, SampleResult } from "./wrap"; | ||
| import { Args_sampleMethod, SampleResult, ModuleBase } from "./wrap"; | ||
|
|
||
| export function sampleMethod(args: Args_sampleMethod): SampleResult { | ||
| return { | ||
| result: args.arg, | ||
| }; | ||
| export class Module extends ModuleBase { | ||
| sampleMethod(args: Args_sampleMethod): SampleResult { | ||
| return { | ||
| result: args.arg, | ||
| }; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,4 @@ export { | |
| Args_optionalEnvMethod, | ||
| Args__if | ||
| }; | ||
| export { ModuleBase } from "./module"; | ||
28 changes: 28 additions & 0 deletions
28
packages/test-cases/cases/bind/sanity/output/wasm-as/Module/module.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import * as Types from ".."; | ||
|
|
||
| import { | ||
| BigInt, | ||
| BigNumber, | ||
| Box, | ||
| JSON, | ||
| } from "@polywrap/wasm-as"; | ||
|
|
||
| export abstract class ModuleBase { | ||
| abstract moduleMethod( | ||
| args: Types.Args_moduleMethod | ||
| ): i32; | ||
|
|
||
| abstract objectMethod( | ||
| args: Types.Args_objectMethod, | ||
| env: Types.Env | ||
| ): Types.AnotherType | null; | ||
|
|
||
| abstract optionalEnvMethod( | ||
| args: Types.Args_optionalEnvMethod, | ||
| env: Types.Env | null | ||
| ): Types.AnotherType | null; | ||
|
|
||
| abstract _if( | ||
| args: Types.Args__if | ||
| ): Types._else; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.