Port forward to ts-rs 8.1 (currently: git only; waiting for 8.1.1+) (#2443)
Port forward to ts-rs 8.1
We're just waiting on a release that includes a PR that we sent[1] for this
to use the cargo version. For now we'll have to use the git release.
[1]: c5109a00e4
This commit is contained in:
@ -21,6 +21,9 @@ const projectWellFormed = {
|
|||||||
created: now.toISOString(),
|
created: now.toISOString(),
|
||||||
modified: now.toISOString(),
|
modified: now.toISOString(),
|
||||||
size: 32,
|
size: 32,
|
||||||
|
accessed: null,
|
||||||
|
type: null,
|
||||||
|
permission: null,
|
||||||
},
|
},
|
||||||
kcl_file_count: 1,
|
kcl_file_count: 1,
|
||||||
directory_count: 0,
|
directory_count: 0,
|
||||||
|
@ -75,6 +75,7 @@ export class CoreDumpManager {
|
|||||||
const osinfo: OsInfo = {
|
const osinfo: OsInfo = {
|
||||||
platform,
|
platform,
|
||||||
arch,
|
arch,
|
||||||
|
browser: 'tauri',
|
||||||
version: kernelVersion,
|
version: kernelVersion,
|
||||||
}
|
}
|
||||||
return JSON.stringify(osinfo)
|
return JSON.stringify(osinfo)
|
||||||
@ -89,6 +90,7 @@ export class CoreDumpManager {
|
|||||||
platform: userAgent,
|
platform: userAgent,
|
||||||
arch: userAgent,
|
arch: userAgent,
|
||||||
version: userAgent,
|
version: userAgent,
|
||||||
|
browser: userAgent,
|
||||||
}
|
}
|
||||||
return new Promise((resolve) => resolve(JSON.stringify(osinfo)))
|
return new Promise((resolve) => resolve(JSON.stringify(osinfo)))
|
||||||
}
|
}
|
||||||
@ -96,9 +98,9 @@ export class CoreDumpManager {
|
|||||||
const parser = new UAParser(userAgent)
|
const parser = new UAParser(userAgent)
|
||||||
const parserResults = parser.getResult()
|
const parserResults = parser.getResult()
|
||||||
const osinfo: OsInfo = {
|
const osinfo: OsInfo = {
|
||||||
platform: parserResults.os.name,
|
platform: parserResults.os.name || userAgent,
|
||||||
arch: parserResults.cpu.architecture,
|
arch: parserResults.cpu.architecture || userAgent,
|
||||||
version: parserResults.os.version,
|
version: parserResults.os.version || userAgent,
|
||||||
browser: userAgent,
|
browser: userAgent,
|
||||||
}
|
}
|
||||||
return new Promise((resolve) => resolve(JSON.stringify(osinfo)))
|
return new Promise((resolve) => resolve(JSON.stringify(osinfo)))
|
||||||
|
@ -39,7 +39,9 @@ export const settingsLoader: LoaderFunction = async ({
|
|||||||
)
|
)
|
||||||
if (projectPathData) {
|
if (projectPathData) {
|
||||||
const { project_path } = projectPathData
|
const { project_path } = projectPathData
|
||||||
const { settings: s } = await loadAndValidateSettings(project_path)
|
const { settings: s } = await loadAndValidateSettings(
|
||||||
|
project_path || undefined
|
||||||
|
)
|
||||||
settings = s
|
settings = s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,6 +120,7 @@ export const fileLoader: LoaderFunction = async ({
|
|||||||
children: [],
|
children: [],
|
||||||
kcl_file_count: 0,
|
kcl_file_count: 0,
|
||||||
directory_count: 0,
|
directory_count: 0,
|
||||||
|
metadata: null,
|
||||||
default_file: project_path,
|
default_file: project_path,
|
||||||
},
|
},
|
||||||
file: {
|
file: {
|
||||||
|
@ -45,7 +45,7 @@ export function sortProject(project: FileEntry[]): FileEntry[] {
|
|||||||
if ('children' in fileOrDir && fileOrDir.children !== undefined) {
|
if ('children' in fileOrDir && fileOrDir.children !== undefined) {
|
||||||
return {
|
return {
|
||||||
...fileOrDir,
|
...fileOrDir,
|
||||||
children: sortProject(fileOrDir.children),
|
children: sortProject(fileOrDir.children || []),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return fileOrDir
|
return fileOrDir
|
||||||
|
11
src/wasm-lib/Cargo.lock
generated
11
src/wasm-lib/Cargo.lock
generated
@ -4390,9 +4390,8 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ts-rs"
|
name = "ts-rs"
|
||||||
version = "7.1.1"
|
version = "8.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/Aleph-Alpha/ts-rs#badbac08e61e65b312880aa64e9ece2976f1bbef"
|
||||||
checksum = "fc2cae1fc5d05d47aa24b64f9a4f7cba24cdc9187a2084dd97ac57bef5eccae6"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
@ -4403,11 +4402,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ts-rs-macros"
|
name = "ts-rs-macros"
|
||||||
version = "7.1.1"
|
version = "8.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/Aleph-Alpha/ts-rs#badbac08e61e65b312880aa64e9ece2976f1bbef"
|
||||||
checksum = "73f7f9b821696963053a89a7bd8b292dc34420aea8294d7b225274d488f3ec92"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"Inflector",
|
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.65",
|
"syn 2.0.65",
|
||||||
|
@ -38,7 +38,8 @@ serde_json = "1.0.116"
|
|||||||
sha2 = "0.10.8"
|
sha2 = "0.10.8"
|
||||||
thiserror = "1.0.61"
|
thiserror = "1.0.61"
|
||||||
toml = "0.8.13"
|
toml = "0.8.13"
|
||||||
ts-rs = { version = "7.1.1", features = ["uuid-impl", "url-impl", "chrono-impl", "no-serde-warnings"] }
|
# TODO: change this to a cargo release once 8.1.1 comes out
|
||||||
|
ts-rs = { git = "https://github.com/Aleph-Alpha/ts-rs", features = ["uuid-impl", "url-impl", "chrono-impl", "no-serde-warnings"] }
|
||||||
url = { version = "2.5.0", features = ["serde"] }
|
url = { version = "2.5.0", features = ["serde"] }
|
||||||
uuid = { version = "1.8.0", features = ["v4", "js", "serde"] }
|
uuid = { version = "1.8.0", features = ["v4", "js", "serde"] }
|
||||||
validator = { version = "0.18.1", features = ["derive"] }
|
validator = { version = "0.18.1", features = ["derive"] }
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
//! Functions for generating docs for our stdlib functions.
|
//! Functions for generating docs for our stdlib functions.
|
||||||
|
|
||||||
|
use crate::std::Primitive;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::path::Path;
|
||||||
use tower_lsp::lsp_types::{
|
use tower_lsp::lsp_types::{
|
||||||
CompletionItem, CompletionItemKind, CompletionItemLabelDetails, Documentation, InsertTextFormat, MarkupContent,
|
CompletionItem, CompletionItemKind, CompletionItemLabelDetails, Documentation, InsertTextFormat, MarkupContent,
|
||||||
MarkupKind, ParameterInformation, ParameterLabel, SignatureHelp, SignatureInformation,
|
MarkupKind, ParameterInformation, ParameterLabel, SignatureHelp, SignatureInformation,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::std::Primitive;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, ts_rs::TS)]
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, ts_rs::TS)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
@ -262,21 +262,30 @@ impl<'de> Deserialize<'de> for Box<dyn StdLibFn> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ts_rs::TS for dyn StdLibFn {
|
impl ts_rs::TS for dyn StdLibFn {
|
||||||
const EXPORT_TO: Option<&'static str> = Some("bindings/StdLibFnData");
|
type WithoutGenerics = Self;
|
||||||
|
|
||||||
fn name() -> String {
|
fn name() -> String {
|
||||||
"StdLibFnData".to_string()
|
"StdLibFnData".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dependencies() -> Vec<ts_rs::Dependency>
|
fn decl() -> String {
|
||||||
where
|
StdLibFnData::decl()
|
||||||
Self: 'static,
|
|
||||||
{
|
|
||||||
StdLibFnData::dependencies()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn transparent() -> bool {
|
fn decl_concrete() -> String {
|
||||||
StdLibFnData::transparent()
|
StdLibFnData::decl_concrete()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn inline() -> String {
|
||||||
|
StdLibFnData::inline()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn inline_flattened() -> String {
|
||||||
|
StdLibFnData::inline_flattened()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn output_path() -> Option<&'static Path> {
|
||||||
|
StdLibFnData::output_path()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::types::{BodyItem, FunctionExpression, Program, Value},
|
ast::types::{BodyItem, FunctionExpression, Program, Value},
|
||||||
@ -17,21 +18,30 @@ pub trait KclStdLibFn: StdLibFn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ts_rs::TS for dyn KclStdLibFn {
|
impl ts_rs::TS for dyn KclStdLibFn {
|
||||||
const EXPORT_TO: Option<&'static str> = Some("bindings/StdLibFnData");
|
type WithoutGenerics = Self;
|
||||||
|
|
||||||
fn name() -> String {
|
fn name() -> String {
|
||||||
"StdLibFnData".to_string()
|
"StdLibFnData".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dependencies() -> Vec<ts_rs::Dependency>
|
fn decl() -> String {
|
||||||
where
|
StdLibFnData::decl()
|
||||||
Self: 'static,
|
|
||||||
{
|
|
||||||
StdLibFnData::dependencies()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn transparent() -> bool {
|
fn decl_concrete() -> String {
|
||||||
StdLibFnData::transparent()
|
StdLibFnData::decl_concrete()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn inline() -> String {
|
||||||
|
StdLibFnData::inline()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn inline_flattened() -> String {
|
||||||
|
StdLibFnData::inline_flattened()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn output_path() -> Option<&'static Path> {
|
||||||
|
StdLibFnData::output_path()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user