diff --git a/CHANGELOG.md b/CHANGELOG.md index f7ebb6ab..c06f6e5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,16 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [v0.4.4] - 2023-08-05 + +### Features + +- Added ability to compile with WASM-32 support (no WASI) + +### Fixes + +- Fixed a bug where the signature generation would not generate typescript signatures + ## [v0.4.3] - 2023-08-04 ### Changes @@ -271,7 +281,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Initial release of the Scale Runtime library. -[unreleased]: https://github.com/loopholelabs/scale/compare/v0.4.3...HEAD +[unreleased]: https://github.com/loopholelabs/scale/compare/v0.4.4...HEAD +[v0.4.4]: https://github.com/loopholelabs/scale/compare/v0.4.4 [v0.4.3]: https://github.com/loopholelabs/scale/compare/v0.4.3 [v0.4.2]: https://github.com/loopholelabs/scale/compare/v0.4.2 [v0.4.1]: https://github.com/loopholelabs/scale/compare/v0.4.1 diff --git a/Cargo.toml b/Cargo.toml index 02ba54c1..ba3e9650 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scale_rs" -version = "0.4.3" +version = "0.4.4" edition = "2021" description = "Scale is a framework for building high-performance plugin systems into any application, all powered by WebAssembly." homepage = "https://scale.sh" diff --git a/build/build.go b/build/build.go index eb476ab9..435f6faf 100644 --- a/build/build.go +++ b/build/build.go @@ -20,4 +20,5 @@ type Target int const ( WASITarget Target = iota + WASMTarget ) diff --git a/build/golang.go b/build/golang.go index 4b05d1b1..304fe499 100644 --- a/build/golang.go +++ b/build/golang.go @@ -196,6 +196,8 @@ func LocalGolang(options *LocalGolangOptions) (*scalefunc.Schema, error) { switch options.Target { case WASITarget: target = "wasi" + case WASMTarget: + target = "wasm" default: return nil, fmt.Errorf("unknown build target %d", options.Target) } diff --git a/build/rust.go b/build/rust.go index 7e03b3ee..7dafba91 100644 --- a/build/rust.go +++ b/build/rust.go @@ -173,6 +173,8 @@ func LocalRust(options *LocalRustOptions) (*scalefunc.Schema, error) { switch options.Target { case WASITarget: target = "wasm32-wasi" + case WASMTarget: + target = "wasm32-unknown-unknown" default: return nil, fmt.Errorf("unknown build target %d", options.Target) } diff --git a/build/typescript.go b/build/typescript.go index b73ff3af..0fe1a37c 100644 --- a/build/typescript.go +++ b/build/typescript.go @@ -167,6 +167,8 @@ func LocalTypescript(options *LocalTypescriptOptions) (*scalefunc.Schema, error) switch options.Target { case WASITarget: target = api.PlatformNode + case WASMTarget: + target = api.PlatformBrowser default: return nil, fmt.Errorf("unknown build target %d", options.Target) } diff --git a/integration/golang_tests/generated/generated.go b/integration/golang_tests/generated/generated.go index d501e4ad..9f4bf6b8 100644 --- a/integration/golang_tests/generated/generated.go +++ b/integration/golang_tests/generated/generated.go @@ -1,4 +1,4 @@ -// Code generated by scale-signature v0.4.3, DO NOT EDIT. +// Code generated by scale-signature v0.4.4, DO NOT EDIT. // output: generated package generated diff --git a/integration/golang_tests/host_signature/host.go b/integration/golang_tests/host_signature/host.go index 5cb1f9de..e925c063 100644 --- a/integration/golang_tests/host_signature/host.go +++ b/integration/golang_tests/host_signature/host.go @@ -1,4 +1,4 @@ -// Code generated by scale-signature v0.4.3, DO NOT EDIT. +// Code generated by scale-signature v0.4.4, DO NOT EDIT. // output: signature package signature diff --git a/integration/golang_tests/host_signature/types.go b/integration/golang_tests/host_signature/types.go index eab9d0c8..59dc60d4 100644 --- a/integration/golang_tests/host_signature/types.go +++ b/integration/golang_tests/host_signature/types.go @@ -1,4 +1,4 @@ -// Code generated by scale-signature v0.4.3, DO NOT EDIT. +// Code generated by scale-signature v0.4.4, DO NOT EDIT. // output: signature package signature diff --git a/integration/golang_tests/signature/guest.go b/integration/golang_tests/signature/guest.go index 2f68d100..469fb3f5 100644 --- a/integration/golang_tests/signature/guest.go +++ b/integration/golang_tests/signature/guest.go @@ -1,4 +1,4 @@ -// Code generated by scale-signature v0.4.3, DO NOT EDIT. +// Code generated by scale-signature v0.4.4, DO NOT EDIT. // output: signature package signature diff --git a/integration/golang_tests/signature/types.go b/integration/golang_tests/signature/types.go index 76e355f9..e4e9ba22 100644 --- a/integration/golang_tests/signature/types.go +++ b/integration/golang_tests/signature/types.go @@ -1,4 +1,4 @@ -// Code generated by scale-signature v0.4.3, DO NOT EDIT. +// Code generated by scale-signature v0.4.4, DO NOT EDIT. // output: signature package signature diff --git a/integration/rust_tests/generated/generated.rs b/integration/rust_tests/generated/generated.rs index 39982681..0dd384b0 100644 --- a/integration/rust_tests/generated/generated.rs +++ b/integration/rust_tests/generated/generated.rs @@ -1,4 +1,4 @@ -// Code generated by scale-signature 0.4.3, DO NOT EDIT. +// Code generated by scale-signature 0.4.4, DO NOT EDIT. // output: generated #![allow(dead_code)] diff --git a/integration/rust_tests/signature/guest.rs b/integration/rust_tests/signature/guest.rs index 57a17484..1fde0765 100644 --- a/integration/rust_tests/signature/guest.rs +++ b/integration/rust_tests/signature/guest.rs @@ -1,4 +1,4 @@ -// Code generated by scale-signature 0.4.3, DO NOT EDIT. +// Code generated by scale-signature 0.4.4, DO NOT EDIT. // output: local_example_latest_guest pub mod types; diff --git a/integration/rust_tests/signature/types.rs b/integration/rust_tests/signature/types.rs index 6cdb38b8..a60df82d 100644 --- a/integration/rust_tests/signature/types.rs +++ b/integration/rust_tests/signature/types.rs @@ -1,4 +1,4 @@ -// Code generated by scale-signature 0.4.3, DO NOT EDIT. +// Code generated by scale-signature 0.4.4, DO NOT EDIT. // output: local_example_latest_guest #![allow(dead_code)] diff --git a/integration/typescript_tests/generated/generated.d.ts b/integration/typescript_tests/generated/generated.d.ts index 9211fbd3..a9ff3afc 100644 --- a/integration/typescript_tests/generated/generated.d.ts +++ b/integration/typescript_tests/generated/generated.d.ts @@ -1,4 +1,4 @@ -// Code generated by scale-signature 0.4.3, DO NOT EDIT. +// Code generated by scale-signature 0.4.4, DO NOT EDIT. // output: generated import { Encoder, Decoder, Kind } from "@loopholelabs/polyglot" diff --git a/integration/typescript_tests/generated/generated.js b/integration/typescript_tests/generated/generated.js index c9d1accc..2d4fcdfc 100644 --- a/integration/typescript_tests/generated/generated.js +++ b/integration/typescript_tests/generated/generated.js @@ -1,4 +1,4 @@ -// Code generated by scale-signature 0.4.3, DO NOT EDIT. +// Code generated by scale-signature 0.4.4, DO NOT EDIT. // output: generated "use strict"; diff --git a/integration/typescript_tests/generated/generated.js.map b/integration/typescript_tests/generated/generated.js.map index 7a051832..74853834 100644 --- a/integration/typescript_tests/generated/generated.js.map +++ b/integration/typescript_tests/generated/generated.js.map @@ -2,7 +2,7 @@ "version": 3, "sources": [""], "sourceRoot": "generated.js", - "sourcesContent": ["// Code generated by scale-signature 0.4.3, DO NOT EDIT.\n// output: generated\n\nimport { Encoder, Decoder, Kind } from \"@loopholelabs/polyglot\"\n\nexport class Context {\n a: number;\n b: number;\n c: number;\n\n /**\n * @throws {Error}\n */\n constructor (decoder?: Decoder) {\n if (decoder) {\n let err: Error | undefined;\n try {\n err = decoder.error();\n } catch (_) {}\n if (typeof err !== \"undefined\") {\n throw err;\n }\n this.a = decoder.int32();\n this.b = decoder.int32();\n this.c = decoder.int32();\n } else {\n this.a = 0;\n this.b = 0;\n this.c = 0;\n }\n }\n\n /**\n * @throws {Error}\n */\n encode (encoder: Encoder) {\n encoder.int32(this.a);\n encoder.int32(this.b);\n encoder.int32(this.c);\n }\n\n /**\n * @throws {Error}\n */\n static decode (decoder: Decoder): Context | undefined {\n if (decoder.null()) {\n return undefined\n }\n return new Context(decoder);\n }\n\n /**\n * @throws {Error}\n */\n static encode_undefined (encoder: Encoder) {\n encoder.null();\n }\n}\n\n"], + "sourcesContent": ["// Code generated by scale-signature 0.4.4, DO NOT EDIT.\n// output: generated\n\nimport { Encoder, Decoder, Kind } from \"@loopholelabs/polyglot\"\n\nexport class Context {\n a: number;\n b: number;\n c: number;\n\n /**\n * @throws {Error}\n */\n constructor (decoder?: Decoder) {\n if (decoder) {\n let err: Error | undefined;\n try {\n err = decoder.error();\n } catch (_) {}\n if (typeof err !== \"undefined\") {\n throw err;\n }\n this.a = decoder.int32();\n this.b = decoder.int32();\n this.c = decoder.int32();\n } else {\n this.a = 0;\n this.b = 0;\n this.c = 0;\n }\n }\n\n /**\n * @throws {Error}\n */\n encode (encoder: Encoder) {\n encoder.int32(this.a);\n encoder.int32(this.b);\n encoder.int32(this.c);\n }\n\n /**\n * @throws {Error}\n */\n static decode (decoder: Decoder): Context | undefined {\n if (decoder.null()) {\n return undefined\n }\n return new Context(decoder);\n }\n\n /**\n * @throws {Error}\n */\n static encode_undefined (encoder: Encoder) {\n encoder.null();\n }\n}\n\n"], "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,MAAM,QAAQ;AAAA;AAAA;AAAA;AAAA,EAQnB,YAAa,SAAmB;AAC9B,QAAI,SAAS;AACX,UAAI;AACJ,UAAI;AACF,cAAM,QAAQ,MAAM;AAAA,MACtB,SAAS,GAAG;AAAA,MAAC;AACb,UAAI,OAAO,QAAQ,aAAa;AAC9B,cAAM;AAAA,MACR;AACA,WAAK,IAAI,QAAQ,MAAM;AACvB,WAAK,IAAI,QAAQ,MAAM;AACvB,WAAK,IAAI,QAAQ,MAAM;AAAA,IACzB,OAAO;AACL,WAAK,IAAI;AACT,WAAK,IAAI;AACT,WAAK,IAAI;AAAA,IACX;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,OAAQ,SAAkB;AACxB,YAAQ,MAAM,KAAK,CAAC;AACpB,YAAQ,MAAM,KAAK,CAAC;AACpB,YAAQ,MAAM,KAAK,CAAC;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,OAAQ,SAAuC;AACpD,QAAI,QAAQ,KAAK,GAAG;AAClB,aAAO;AAAA,IACT;AACA,WAAO,IAAI,QAAQ,OAAO;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,iBAAkB,SAAkB;AACzC,YAAQ,KAAK;AAAA,EACf;AACF;", "names": [] } diff --git a/integration/typescript_tests/host_signature/index.ts b/integration/typescript_tests/host_signature/index.ts index ebaae2d5..2e9bf756 100644 --- a/integration/typescript_tests/host_signature/index.ts +++ b/integration/typescript_tests/host_signature/index.ts @@ -1,4 +1,4 @@ -// Code generated by scale-signature 0.4.3, DO NOT EDIT. +// Code generated by scale-signature 0.4.4, DO NOT EDIT. // output: local-example-latest-host /* eslint no-bitwise: off */ diff --git a/integration/typescript_tests/host_signature/types.ts b/integration/typescript_tests/host_signature/types.ts index 7333d6a7..dbd46d23 100644 --- a/integration/typescript_tests/host_signature/types.ts +++ b/integration/typescript_tests/host_signature/types.ts @@ -1,4 +1,4 @@ -// Code generated by scale-signature 0.4.3, DO NOT EDIT. +// Code generated by scale-signature 0.4.4, DO NOT EDIT. // output: local-example-latest-host import { Encoder, Decoder, Kind } from "@loopholelabs/polyglot" diff --git a/integration/typescript_tests/signature/index.ts b/integration/typescript_tests/signature/index.ts index 08af6339..61ad18b9 100644 --- a/integration/typescript_tests/signature/index.ts +++ b/integration/typescript_tests/signature/index.ts @@ -1,4 +1,4 @@ -// Code generated by scale-signature 0.4.3, DO NOT EDIT. +// Code generated by scale-signature 0.4.4, DO NOT EDIT. // output: local-example-latest-guest /* eslint no-bitwise: off */ diff --git a/integration/typescript_tests/signature/types.ts b/integration/typescript_tests/signature/types.ts index 015b9fff..e81bcd77 100644 --- a/integration/typescript_tests/signature/types.ts +++ b/integration/typescript_tests/signature/types.ts @@ -1,4 +1,4 @@ -// Code generated by scale-signature 0.4.3, DO NOT EDIT. +// Code generated by scale-signature 0.4.4, DO NOT EDIT. // output: local-example-latest-guest import { Encoder, Decoder, Kind } from "@loopholelabs/polyglot" diff --git a/package.json b/package.json index fd4d586a..55b429df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@loopholelabs/scale", - "version": "0.4.3", + "version": "0.4.4", "description": "Scale is a framework for building high-performance plugin systems into any application, all powered by WebAssembly.", "source": "index.ts", "types": "types.d.ts", diff --git a/signature/converter/converter_tests/generated.go b/signature/converter/converter_tests/generated.go index 7480ba0a..beb753eb 100644 --- a/signature/converter/converter_tests/generated.go +++ b/signature/converter/converter_tests/generated.go @@ -1,4 +1,4 @@ -// Code generated by scale-signature v0.4.3, DO NOT EDIT. +// Code generated by scale-signature v0.4.4, DO NOT EDIT. // output: generated package generated diff --git a/signature/generator/golang/generated.txt b/signature/generator/golang/generated.txt index 1f3c49fb..670213f6 100644 --- a/signature/generator/golang/generated.txt +++ b/signature/generator/golang/generated.txt @@ -1,4 +1,4 @@ -// Code generated by scale-signature v0.4.3, DO NOT EDIT. +// Code generated by scale-signature v0.4.4, DO NOT EDIT. // output: types package types diff --git a/signature/generator/rust/generated.txt b/signature/generator/rust/generated.txt index 3b9d9f69..f23b3790 100755 --- a/signature/generator/rust/generated.txt +++ b/signature/generator/rust/generated.txt @@ -1,4 +1,4 @@ -// Code generated by scale-signature 0.4.3, DO NOT EDIT. +// Code generated by scale-signature 0.4.4, DO NOT EDIT. // output: types #![allow(dead_code)] diff --git a/signature/generator/typescript/generated.txt b/signature/generator/typescript/generated.txt index e1041ec6..e43dd975 100755 --- a/signature/generator/typescript/generated.txt +++ b/signature/generator/typescript/generated.txt @@ -1,4 +1,4 @@ -// Code generated by scale-signature 0.4.3, DO NOT EDIT. +// Code generated by scale-signature 0.4.4, DO NOT EDIT. // output: types import { Encoder, Decoder, Kind } from "@loopholelabs/polyglot" diff --git a/storage/signature.go b/storage/signature.go index 4325b06a..1e11023f 100644 --- a/storage/signature.go +++ b/storage/signature.go @@ -30,6 +30,7 @@ import ( ) const ( + defaultVersion = "v0.1.0" SignatureDirectory = "signatures" ) @@ -311,10 +312,13 @@ func GenerateSignature(sig *signature.Schema, name string, tag string, org strin Signature: sig, GolangPackageImportPath: "signature", - GolangPackageVersion: "v0.1.0", + GolangPackageVersion: defaultVersion, RustPackageName: fmt.Sprintf("%s_%s_%s_guest", org, name, tag), - RustPackageVersion: "0.1.0", + RustPackageVersion: defaultVersion, + + TypescriptPackageName: fmt.Sprintf("%s-%s-%s-guest", org, name, tag), + TypescriptPackageVersion: defaultVersion, }) if err != nil { return err @@ -335,9 +339,13 @@ func GenerateSignature(sig *signature.Schema, name string, tag string, org strin } hostPackage, err := generator.GenerateHostLocal(&generator.Options{ - Signature: sig, + Signature: sig, + GolangPackageImportPath: "signature", - GolangPackageVersion: "v0.1.0", + GolangPackageVersion: defaultVersion, + + TypescriptPackageName: fmt.Sprintf("%s-%s-%s-host", org, name, tag), + TypescriptPackageVersion: defaultVersion, }) if err != nil { return err diff --git a/version/current_version b/version/current_version index b37392d3..5ab76976 100644 --- a/version/current_version +++ b/version/current_version @@ -1 +1 @@ -v0.4.3 \ No newline at end of file +v0.4.4 \ No newline at end of file