Skip to content

Commit d435a5d

Browse files
authored
Fix: Storage Typescript Signature Generation (#114)
* Adding WASM-specific target for building, and enabling typescript signature generation Signed-off-by: Shivansh Vij <[email protected]> * Updating changelog and bumping versions Signed-off-by: Shivansh Vij <[email protected]> --------- Signed-off-by: Shivansh Vij <[email protected]>
1 parent b797dc2 commit d435a5d

File tree

28 files changed

+53
-27
lines changed

28 files changed

+53
-27
lines changed

CHANGELOG.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
99

10+
## [v0.4.4] - 2023-08-05
11+
12+
### Features
13+
14+
- Added ability to compile with WASM-32 support (no WASI)
15+
16+
### Fixes
17+
18+
- Fixed a bug where the signature generation would not generate typescript signatures
19+
1020
## [v0.4.3] - 2023-08-04
1121

1222
### Changes
@@ -271,7 +281,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
271281

272282
- Initial release of the Scale Runtime library.
273283

274-
[unreleased]: https://github.com/loopholelabs/scale/compare/v0.4.3...HEAD
284+
[unreleased]: https://github.com/loopholelabs/scale/compare/v0.4.4...HEAD
285+
[v0.4.4]: https://github.com/loopholelabs/scale/compare/v0.4.4
275286
[v0.4.3]: https://github.com/loopholelabs/scale/compare/v0.4.3
276287
[v0.4.2]: https://github.com/loopholelabs/scale/compare/v0.4.2
277288
[v0.4.1]: https://github.com/loopholelabs/scale/compare/v0.4.1

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "scale_rs"
3-
version = "0.4.3"
3+
version = "0.4.4"
44
edition = "2021"
55
description = "Scale is a framework for building high-performance plugin systems into any application, all powered by WebAssembly."
66
homepage = "https://scale.sh"

build/build.go

+1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ type Target int
2020

2121
const (
2222
WASITarget Target = iota
23+
WASMTarget
2324
)

build/golang.go

+2
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ func LocalGolang(options *LocalGolangOptions) (*scalefunc.Schema, error) {
196196
switch options.Target {
197197
case WASITarget:
198198
target = "wasi"
199+
case WASMTarget:
200+
target = "wasm"
199201
default:
200202
return nil, fmt.Errorf("unknown build target %d", options.Target)
201203
}

build/rust.go

+2
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ func LocalRust(options *LocalRustOptions) (*scalefunc.Schema, error) {
173173
switch options.Target {
174174
case WASITarget:
175175
target = "wasm32-wasi"
176+
case WASMTarget:
177+
target = "wasm32-unknown-unknown"
176178
default:
177179
return nil, fmt.Errorf("unknown build target %d", options.Target)
178180
}

build/typescript.go

+2
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ func LocalTypescript(options *LocalTypescriptOptions) (*scalefunc.Schema, error)
167167
switch options.Target {
168168
case WASITarget:
169169
target = api.PlatformNode
170+
case WASMTarget:
171+
target = api.PlatformBrowser
170172
default:
171173
return nil, fmt.Errorf("unknown build target %d", options.Target)
172174
}

integration/golang_tests/generated/generated.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_tests/host_signature/host.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_tests/host_signature/types.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_tests/signature/guest.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_tests/signature/types.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/rust_tests/generated/generated.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature 0.4.3, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.4, DO NOT EDIT.
22
// output: generated
33

44
#![allow(dead_code)]

integration/rust_tests/signature/guest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature 0.4.3, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.4, DO NOT EDIT.
22
// output: local_example_latest_guest
33

44
pub mod types;

integration/rust_tests/signature/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature 0.4.3, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.4, DO NOT EDIT.
22
// output: local_example_latest_guest
33

44
#![allow(dead_code)]

integration/typescript_tests/generated/generated.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature 0.4.3, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.4, DO NOT EDIT.
22
// output: generated
33

44
import { Encoder, Decoder, Kind } from "@loopholelabs/polyglot"

integration/typescript_tests/generated/generated.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/typescript_tests/generated/generated.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/typescript_tests/host_signature/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature 0.4.3, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.4, DO NOT EDIT.
22
// output: local-example-latest-host
33

44
/* eslint no-bitwise: off */

integration/typescript_tests/host_signature/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature 0.4.3, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.4, DO NOT EDIT.
22
// output: local-example-latest-host
33

44
import { Encoder, Decoder, Kind } from "@loopholelabs/polyglot"

integration/typescript_tests/signature/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature 0.4.3, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.4, DO NOT EDIT.
22
// output: local-example-latest-guest
33

44
/* eslint no-bitwise: off */

integration/typescript_tests/signature/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature 0.4.3, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.4, DO NOT EDIT.
22
// output: local-example-latest-guest
33

44
import { Encoder, Decoder, Kind } from "@loopholelabs/polyglot"

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@loopholelabs/scale",
3-
"version": "0.4.3",
3+
"version": "0.4.4",
44
"description": "Scale is a framework for building high-performance plugin systems into any application, all powered by WebAssembly.",
55
"source": "index.ts",
66
"types": "types.d.ts",

signature/converter/converter_tests/generated.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

signature/generator/golang/generated.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature v0.4.3, DO NOT EDIT.
1+
// Code generated by scale-signature v0.4.4, DO NOT EDIT.
22
// output: types
33

44
package types

signature/generator/rust/generated.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature 0.4.3, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.4, DO NOT EDIT.
22
// output: types
33

44
#![allow(dead_code)]

signature/generator/typescript/generated.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature 0.4.3, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.4, DO NOT EDIT.
22
// output: types
33

44
import { Encoder, Decoder, Kind } from "@loopholelabs/polyglot"

storage/signature.go

+12-4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
)
3131

3232
const (
33+
defaultVersion = "v0.1.0"
3334
SignatureDirectory = "signatures"
3435
)
3536

@@ -311,10 +312,13 @@ func GenerateSignature(sig *signature.Schema, name string, tag string, org strin
311312
Signature: sig,
312313

313314
GolangPackageImportPath: "signature",
314-
GolangPackageVersion: "v0.1.0",
315+
GolangPackageVersion: defaultVersion,
315316

316317
RustPackageName: fmt.Sprintf("%s_%s_%s_guest", org, name, tag),
317-
RustPackageVersion: "0.1.0",
318+
RustPackageVersion: defaultVersion,
319+
320+
TypescriptPackageName: fmt.Sprintf("%s-%s-%s-guest", org, name, tag),
321+
TypescriptPackageVersion: defaultVersion,
318322
})
319323
if err != nil {
320324
return err
@@ -335,9 +339,13 @@ func GenerateSignature(sig *signature.Schema, name string, tag string, org strin
335339
}
336340

337341
hostPackage, err := generator.GenerateHostLocal(&generator.Options{
338-
Signature: sig,
342+
Signature: sig,
343+
339344
GolangPackageImportPath: "signature",
340-
GolangPackageVersion: "v0.1.0",
345+
GolangPackageVersion: defaultVersion,
346+
347+
TypescriptPackageName: fmt.Sprintf("%s-%s-%s-host", org, name, tag),
348+
TypescriptPackageVersion: defaultVersion,
341349
})
342350
if err != nil {
343351
return err

version/current_version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.4.3
1+
v0.4.4

0 commit comments

Comments
 (0)