Compare commits

..

5 Commits

Author SHA1 Message Date
Gregory Schier
5c456fd4d5 Add APPLE_TEAM_ID 2023-10-18 14:12:08 -07:00
Gregory Schier
38c247e350 Revert artifacts things 2023-10-18 13:25:35 -07:00
Gregory Schier
0c8f72124a Bump cargo deps 2023-10-18 13:25:20 -07:00
Gregory Schier
80ed6b1525 Bump version 2023-10-18 12:14:38 -07:00
Gregory Schier
4424b3f208 Fix sidebar drag-n-drop 2023-10-18 11:58:58 -07:00
8 changed files with 1018 additions and 808 deletions

View File

@@ -11,7 +11,7 @@ jobs:
include:
- os: macos-12
target: aarch64-apple-darwin
- os: macos-12
- os: macos-latest
target: x86_64-apple-darwin
- os: windows-2022
target: x86_64-pc-windows-msvc
@@ -58,6 +58,7 @@ jobs:
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
with:
tagName: 'v__VERSION__'

972
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -33,7 +33,7 @@
"@tanstack/react-query": "^4.28.0",
"@tanstack/react-query-devtools": "^4.28.0",
"@tanstack/react-query-persist-client": "^4.28.0",
"@tauri-apps/api": "^1.3.0",
"@tauri-apps/api": "^1.5.1",
"@vitejs/plugin-react": "^3.1.0",
"buffer": "^6.0.3",
"classnames": "^2.3.2",
@@ -55,7 +55,7 @@
},
"devDependencies": {
"@tailwindcss/nesting": "^0.0.0-insiders.565cd3e",
"@tauri-apps/cli": "^1.3.1",
"@tauri-apps/cli": "^1.5.4",
"@types/node": "^18.7.10",
"@types/papaparse": "^5.3.7",
"@types/parse-color": "^1.0.1",

730
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -15,7 +15,7 @@ tauri-build = { version = "1.2", features = [] }
[target.'cfg(target_os = "macos")'.dependencies]
objc = "0.2.7"
cocoa = "0.24.1"
cocoa = "0.25.0"
[dependencies]
serde_json = { version = "1.0", features = ["raw_value"] }
@@ -25,8 +25,8 @@ http = "0.2.8"
reqwest = { version = "0.11.14", features = ["json"] }
tokio = { version = "1.25.0", features = ["sync"] }
futures = "0.3.26"
deno_core = "0.179.0"
deno_ast = { version = "0.25.0", features = ["transpiling"] }
deno_core = "0.222.0"
deno_ast = { version = "0.29.5", features = ["transpiling"] }
sqlx = { version = "0.6.2", features = ["sqlite", "runtime-tokio-rustls", "json", "chrono", "time", "offline"] }
uuid = "1.3.0"
rand = "0.8.5"

View File

@@ -1,9 +1,16 @@
use std::cell::RefCell;
use std::collections::HashMap;
use std::pin::Pin;
use std::rc::Rc;
use deno_ast::{MediaType, ParseParams, SourceTextInfo};
use deno_core::anyhow::{anyhow, bail, Error};
use deno_core::error::AnyError;
use deno_core::futures::FutureExt;
use deno_core::{op, Extension, JsRuntime, ModuleCode, ModuleSource, ModuleType, RuntimeOptions};
use deno_core::{
resolve_import, Extension, JsRuntime, ModuleLoader, ModuleSource, ModuleSourceFuture,
ModuleSpecifier, ModuleType, ResolutionKind, RuntimeOptions, SourceMapGetter,
};
use futures::executor;
pub fn run_plugin_sync(file_path: &str) -> Result<(), AnyError> {
@@ -11,19 +18,24 @@ pub fn run_plugin_sync(file_path: &str) -> Result<(), AnyError> {
}
pub async fn run_plugin(file_path: &str) -> Result<(), AnyError> {
let extension = Extension::builder("runtime")
.ops(vec![op_hello::decl()])
.build();
let extension = Extension {
name: "runtime",
// ops: std::borrow::Cow::Borrowed(&[op_hello::DECL]),
..Default::default()
};
let source_map_store = SourceMapStore(Rc::new(RefCell::new(HashMap::new())));
// Initialize a runtime instance
let mut runtime = JsRuntime::new(RuntimeOptions {
module_loader: Some(Rc::new(TsModuleLoader)),
module_loader: Some(Rc::new(TypescriptModuleLoader {
source_maps: source_map_store.clone(),
})),
extensions: vec![extension],
..Default::default()
});
runtime
.execute_script("<runtime>", include_str!("runtime.js"))
.execute_script_static("<runtime>", include_str!("runtime.js"))
.expect("Failed to execute runtime.js");
let current_dir = &std::env::current_dir().expect("Unable to get CWD");
@@ -41,41 +53,50 @@ pub async fn run_plugin(file_path: &str) -> Result<(), AnyError> {
result.await?
}
#[op]
async fn op_hello(name: String) -> Result<String, AnyError> {
let contents = format!("Hello {} from Rust!", name);
println!("{}", contents);
Ok(contents)
#[derive(Clone)]
struct SourceMapStore(Rc<RefCell<HashMap<String, Vec<u8>>>>);
impl SourceMapGetter for SourceMapStore {
fn get_source_map(&self, specifier: &str) -> Option<Vec<u8>> {
self.0.borrow().get(specifier).cloned()
}
fn get_source_line(&self, _file_name: &str, _line_number: usize) -> Option<String> {
None
}
}
struct TsModuleLoader;
struct TypescriptModuleLoader {
source_maps: SourceMapStore,
}
impl deno_core::ModuleLoader for TsModuleLoader {
impl ModuleLoader for TypescriptModuleLoader {
fn resolve(
&self,
specifier: &str,
referrer: &str,
_kind: deno_core::ResolutionKind,
) -> Result<deno_core::ModuleSpecifier, AnyError> {
deno_core::resolve_import(specifier, referrer).map_err(|e| e.into())
_kind: ResolutionKind,
) -> Result<ModuleSpecifier, Error> {
Ok(resolve_import(specifier, referrer)?)
}
fn load(
&self,
module_specifier: &deno_core::ModuleSpecifier,
_maybe_referrer: Option<deno_core::ModuleSpecifier>,
module_specifier: &ModuleSpecifier,
_maybe_referrer: Option<&ModuleSpecifier>,
_is_dyn_import: bool,
) -> std::pin::Pin<Box<deno_core::ModuleSourceFuture>> {
let module_specifier = module_specifier.clone();
async move {
) -> Pin<Box<ModuleSourceFuture>> {
let source_maps = self.source_maps.clone();
fn load(
source_maps: SourceMapStore,
module_specifier: &ModuleSpecifier,
) -> Result<ModuleSource, AnyError> {
let path = module_specifier
.to_file_path()
.expect("Failed to convert to file path");
.map_err(|_| anyhow!("Only file:// URLs are supported."))?;
// Determine what the MediaType is (this is done based on the file
// extension) and whether transpiling is required.
let media_type = MediaType::from_path(&path);
let (module_type, should_transpile) = match media_type {
let (module_type, should_transpile) = match MediaType::from_path(&path) {
MediaType::JavaScript | MediaType::Mjs | MediaType::Cjs => {
(ModuleType::JavaScript, false)
}
@@ -88,10 +109,9 @@ impl deno_core::ModuleLoader for TsModuleLoader {
| MediaType::Dcts
| MediaType::Tsx => (ModuleType::JavaScript, true),
MediaType::Json => (ModuleType::Json, false),
_ => panic!("Unknown extension {:?}", path.extension()),
_ => bail!("Unknown extension {:?}", path.extension()),
};
// Read the file, transpile if necessary.
let code = std::fs::read_to_string(&path)?;
let code = if should_transpile {
let parsed = deno_ast::parse_module(ParseParams {
@@ -102,20 +122,28 @@ impl deno_core::ModuleLoader for TsModuleLoader {
scope_analysis: false,
maybe_syntax: None,
})?;
parsed.transpile(&Default::default())?.text
let res = parsed.transpile(&deno_ast::EmitOptions {
inline_source_map: false,
source_map: true,
inline_sources: true,
..Default::default()
})?;
let source_map = res.source_map.unwrap();
source_maps
.0
.borrow_mut()
.insert(module_specifier.to_string(), source_map.into_bytes());
res.text
} else {
code
};
// Load and return module.
let module = ModuleSource {
code: ModuleCode::from(code),
Ok(ModuleSource::new(
module_type,
module_url_specified: module_specifier.to_string(),
module_url_found: module_specifier.to_string(),
};
Ok(module)
code.into(),
module_specifier,
))
}
.boxed_local()
futures::future::ready(load(source_maps, module_specifier)).boxed_local()
}
}

View File

@@ -8,7 +8,7 @@
},
"package": {
"productName": "Yaak",
"version": "2023.0.18"
"version": "2023.0.19"
},
"tauri": {
"windows": [],

View File

@@ -242,6 +242,7 @@ type SidebarItemProps = {
useProminentStyles?: boolean;
selected?: boolean;
onSelect: (requestId: string) => void;
draggable?: boolean;
};
const _SidebarItem = forwardRef(function SidebarItem(
@@ -300,16 +301,13 @@ const _SidebarItem = forwardRef(function SidebarItem(
return (
<li ref={ref} className={classnames(className, 'block group/item px-2 pb-0.5')}>
<button
tabIndex={-1}
color="custom"
// tabIndex={-1} // Will prevent drag-n-drop
onClick={handleSelect}
disabled={editing}
draggable={false} // Item should drag, not the link
onDoubleClick={handleStartEditing}
data-active={isActive}
data-selected={selected}
className={classnames(
// 'outline-none',
'w-full flex items-center text-sm h-xs px-2 rounded-md transition-colors',
editing && 'ring-1 focus-within:ring-focus',
isActive && 'bg-highlight text-gray-800',
@@ -396,6 +394,7 @@ const DraggableSidebarItem = memo(function DraggableSidebarItem({
return (
<SidebarItem
ref={ref}
draggable
className={classnames(isDragging && 'opacity-20')}
requestName={requestName}
requestId={requestId}