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