Update USDPL to v0.10

This commit is contained in:
NGnius (Graham) 2023-02-20 22:56:08 -05:00
parent b6e70c2c79
commit dc68a1f1fb
10 changed files with 461 additions and 149 deletions

1
.gitignore vendored
View file

@ -48,3 +48,4 @@ backend
# packaged teasers # packaged teasers
*.zip *.zip
*.tar.gz *.tar.gz
Fantastic/

108
backend-rs/Cargo.lock generated
View file

@ -2,6 +2,28 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "async-recursion"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b015a331cc64ebd1774ba119538573603427eaace0a1950c423ab971f903796"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "async-trait"
version = "0.1.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
@ -104,6 +126,70 @@ dependencies = [
"crypto-common", "crypto-common",
] ]
[[package]]
name = "encoding"
version = "0.2.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
dependencies = [
"encoding-index-japanese",
"encoding-index-korean",
"encoding-index-simpchinese",
"encoding-index-singlebyte",
"encoding-index-tradchinese",
]
[[package]]
name = "encoding-index-japanese"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-korean"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-simpchinese"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-singlebyte"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-tradchinese"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding_index_tests"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
[[package]] [[package]]
name = "fantastic-rs" name = "fantastic-rs"
version = "0.4.0" version = "0.4.0"
@ -203,6 +289,16 @@ dependencies = [
"wasi", "wasi",
] ]
[[package]]
name = "gettext-ng"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2c86be871deb255ef65fc8395048a2505912c595f1eddc4da03aeb6fda5cf34"
dependencies = [
"byteorder",
"encoding",
]
[[package]] [[package]]
name = "h2" name = "h2"
version = "0.3.13" version = "0.3.13"
@ -955,11 +1051,15 @@ dependencies = [
[[package]] [[package]]
name = "usdpl-back" name = "usdpl-back"
version = "0.5.3" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d237439986405621b9b6da350aefcfca9e2b808c10695f55f8b80ccc324b2c0" checksum = "b64335d4a1eda1a4b56b80fcf22eaf43543b22186d20999a400f80eecd7587e0"
dependencies = [ dependencies = [
"async-recursion",
"async-trait",
"bytes", "bytes",
"gettext-ng",
"log",
"tokio", "tokio",
"usdpl-core", "usdpl-core",
"warp", "warp",
@ -967,9 +1067,9 @@ dependencies = [
[[package]] [[package]]
name = "usdpl-core" name = "usdpl-core"
version = "0.5.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dd726b9f0121d4449082e3ce73586dea0a0448494031833b7b173e4476f0ea5" checksum = "bd73bec3df5bed5862cab15aaa645d76c388e00128a14c372806907e2f331960"
dependencies = [ dependencies = [
"base64", "base64",
] ]

View file

@ -4,7 +4,7 @@ version = "0.4.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
usdpl-back = { version = "0.5.3", features = ["blocking"]}#, path = "../usdpl/usdpl-back"} usdpl-back = { version = "0.10", features = ["blocking"]}
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"

9
src/usdpl/README.md Normal file
View file

@ -0,0 +1,9 @@
[![Crates.io](https://img.shields.io/crates/v/usdpl-front?style=flat-square)](https://crates.io/crates/usdpl-front)
# usdpl-front-front
Front-end library to be called from Javascript.
Targets WASM.
In true Javascript tradition, this part of the library does not support error handling.

View file

@ -4,7 +4,7 @@
"NGnius (Graham) <ngniusness@gmail.com>" "NGnius (Graham) <ngniusness@gmail.com>"
], ],
"description": "Universal Steam Deck Plugin Library front-end designed for WASM", "description": "Universal Steam Deck Plugin Library front-end designed for WASM",
"version": "0.4.0", "version": "0.10.0",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": { "repository": {
"type": "git", "type": "git",

13
src/usdpl/rebuild.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
git clone https://github.com/NGnius/usdpl-rs usdpl-rs
cd usdpl-rs/usdpl-front/
./build.sh $1 $2
cd ../..
cp -f ./usdpl-rs/usdpl-front/pkg/* ./
#rm ./.gitignore
rm -rf ./usdpl-rs

View file

@ -9,7 +9,25 @@ export function init_usdpl(port: number): void;
* Get the targeted plugin framework, or "any" if unknown * Get the targeted plugin framework, or "any" if unknown
* @returns {string} * @returns {string}
*/ */
export function target(): string; export function target_usdpl(): string;
/**
* Get the UDSPL front-end version
* @returns {string}
*/
export function version_usdpl(): string;
/**
* Get the targeted plugin framework, or "any" if unknown
* @param {string} key
* @param {any} value
* @returns {any}
*/
export function set_value(key: string, value: any): any;
/**
* Get the targeted plugin framework, or "any" if unknown
* @param {string} key
* @returns {any}
*/
export function get_value(key: string): any;
/** /**
* Call a function on the back-end. * Call a function on the back-end.
* Returns null (None) if this fails for any reason. * Returns null (None) if this fails for any reason.
@ -18,24 +36,60 @@ export function target(): string;
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
export function call_backend(name: string, parameters: any[]): Promise<any>; export function call_backend(name: string, parameters: any[]): Promise<any>;
/**
* Initialize translation strings for the front-end
* @param {string} locale
* @returns {Promise<void>}
*/
export function init_tr(locale: string): Promise<void>;
/**
* Translate a phrase, equivalent to tr_n(msg_id, 0)
* @param {string} msg_id
* @returns {string}
*/
export function tr(msg_id: string): string;
/**
* Translate a phrase, retrieving the plural form for `n` items
* @param {string} msg_id
* @param {number} n
* @returns {string}
*/
export function tr_n(msg_id: string, n: number): string;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput { export interface InitOutput {
readonly memory: WebAssembly.Memory; readonly memory: WebAssembly.Memory;
readonly init_usdpl: (a: number) => void; readonly init_usdpl: (a: number) => void;
readonly target: (a: number) => void; readonly target_usdpl: (a: number) => void;
readonly version_usdpl: (a: number) => void;
readonly set_value: (a: number, b: number, c: number) => number;
readonly get_value: (a: number, b: number) => number;
readonly call_backend: (a: number, b: number, c: number, d: number) => number; readonly call_backend: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_malloc: (a: number) => number; readonly init_tr: (a: number, b: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number; readonly tr: (a: number, b: number, c: number) => void;
readonly tr_n: (a: number, b: number, c: number, d: number) => void;
readonly __wbindgen_export_0: (a: number) => number;
readonly __wbindgen_export_1: (a: number, b: number, c: number) => number;
readonly __wbindgen_export_2: WebAssembly.Table; readonly __wbindgen_export_2: WebAssembly.Table;
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2bd47cee569ae4c6: (a: number, b: number, c: number) => void; readonly __wbindgen_export_3: (a: number, b: number, c: number) => void;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number; readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_free: (a: number, b: number) => void; readonly __wbindgen_export_4: (a: number, b: number) => void;
readonly __wbindgen_exn_store: (a: number) => void; readonly __wbindgen_export_5: (a: number) => void;
readonly wasm_bindgen__convert__closures__invoke2_mut__hfe1195d34914cc54: (a: number, b: number, c: number, d: number) => void; readonly __wbindgen_export_6: (a: number, b: number, c: number, d: number) => void;
} }
export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {SyncInitInput} module
*
* @returns {InitOutput}
*/
export function initSync(module: SyncInitInput): InitOutput;
/** /**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly. * for everything else, calls `WebAssembly.instantiate` directly.

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -2,13 +2,19 @@
/* eslint-disable */ /* eslint-disable */
export const memory: WebAssembly.Memory; export const memory: WebAssembly.Memory;
export function init_usdpl(a: number): void; export function init_usdpl(a: number): void;
export function target(a: number): void; export function target_usdpl(a: number): void;
export function version_usdpl(a: number): void;
export function set_value(a: number, b: number, c: number): number;
export function get_value(a: number, b: number): number;
export function call_backend(a: number, b: number, c: number, d: number): number; export function call_backend(a: number, b: number, c: number, d: number): number;
export function __wbindgen_malloc(a: number): number; export function init_tr(a: number, b: number): number;
export function __wbindgen_realloc(a: number, b: number, c: number): number; export function tr(a: number, b: number, c: number): void;
export function tr_n(a: number, b: number, c: number, d: number): void;
export function __wbindgen_export_0(a: number): number;
export function __wbindgen_export_1(a: number, b: number, c: number): number;
export const __wbindgen_export_2: WebAssembly.Table; export const __wbindgen_export_2: WebAssembly.Table;
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2bd47cee569ae4c6(a: number, b: number, c: number): void; export function __wbindgen_export_3(a: number, b: number, c: number): void;
export function __wbindgen_add_to_stack_pointer(a: number): number; export function __wbindgen_add_to_stack_pointer(a: number): number;
export function __wbindgen_free(a: number, b: number): void; export function __wbindgen_export_4(a: number, b: number): void;
export function __wbindgen_exn_store(a: number): void; export function __wbindgen_export_5(a: number): void;
export function wasm_bindgen__convert__closures__invoke2_mut__hfe1195d34914cc54(a: number, b: number, c: number, d: number): void; export function __wbindgen_export_6(a: number, b: number, c: number, d: number): void;