mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-06-08 06:01:57 -07:00
global: snapshot
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
# Builds
|
||||
target
|
||||
dist
|
||||
websites/dist
|
||||
vecid-to-indexes.js
|
||||
|
||||
# Copies
|
||||
|
||||
Generated
+37
-37
@@ -448,9 +448,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.9.1"
|
||||
version = "2.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
||||
checksum = "6a65b545ab31d687cff52899d4890855fec459eb6afe0da6417b8a18da87aa29"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -669,7 +669,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sse-stream",
|
||||
"thiserror 2.0.14",
|
||||
"thiserror 2.0.15",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tokio-util",
|
||||
@@ -700,7 +700,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"append-only-vec",
|
||||
"arcstr",
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"brk_rolldown_common",
|
||||
"brk_rolldown_debug",
|
||||
"brk_rolldown_ecmascript",
|
||||
@@ -749,7 +749,7 @@ checksum = "23cd66173b33436aaec126f64e8f1d0938539d2eb934e88c633cf6181f7e4c53"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arcstr",
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"brk_rolldown_ecmascript",
|
||||
"brk_rolldown_error",
|
||||
"brk_rolldown_fs",
|
||||
@@ -831,7 +831,7 @@ checksum = "9fd007c612609bcf46e3dca4f9f3c79d16dc1f0bdf7cd0047bfe752fbc6fbecc"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arcstr",
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"brk_rolldown_utils",
|
||||
"derive_more",
|
||||
"heck",
|
||||
@@ -862,7 +862,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"arcstr",
|
||||
"async-trait",
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"brk_rolldown_common",
|
||||
"brk_rolldown_debug",
|
||||
"brk_rolldown_ecmascript",
|
||||
@@ -1078,9 +1078,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brotli"
|
||||
version = "8.0.1"
|
||||
version = "8.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9991eea70ea4f293524138648e41ee89b0b2b12ddef3b255effa43c8056e0e0d"
|
||||
checksum = "4bd8b9603c7aa97359dbd97ecf258968c95f3adddd6db2f7e7a5bef101c84560"
|
||||
dependencies = [
|
||||
"alloc-no-stdlib",
|
||||
"alloc-stdlib",
|
||||
@@ -2260,7 +2260,7 @@ version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"inotify-sys",
|
||||
"libc",
|
||||
]
|
||||
@@ -2289,7 +2289,7 @@ version = "0.7.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
]
|
||||
@@ -2435,7 +2435,7 @@ version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
]
|
||||
@@ -2584,7 +2584,7 @@ version = "0.30.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
@@ -2611,7 +2611,7 @@ version = "8.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"fsevent-sys",
|
||||
"inotify",
|
||||
"kqueue",
|
||||
@@ -2748,7 +2748,7 @@ dependencies = [
|
||||
"rustc-hash",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 2.0.14",
|
||||
"thiserror 2.0.15",
|
||||
"time",
|
||||
]
|
||||
|
||||
@@ -2762,7 +2762,7 @@ dependencies = [
|
||||
"owo-colors",
|
||||
"oxc-miette-derive",
|
||||
"textwrap",
|
||||
"thiserror 2.0.14",
|
||||
"thiserror 2.0.15",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
@@ -2798,7 +2798,7 @@ version = "0.81.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "989b81258ce151e23adee6f1393f7c0fb7e10e3a6c6c001f71bbaff4081c72a4"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"oxc_allocator",
|
||||
"oxc_ast_macros",
|
||||
"oxc_data_structures",
|
||||
@@ -2839,7 +2839,7 @@ version = "0.81.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5361ef66f38635d9671596d83abf44bcdbc3e39dbff303f3517828b86ad60e8f"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"itertools",
|
||||
"nonmax",
|
||||
"oxc_index",
|
||||
@@ -2854,7 +2854,7 @@ version = "0.81.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fde8fc6f7337632fce3e9e51c150f57fb0ef234524c6947f63e8009e1ea613cf"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"cow-utils",
|
||||
"dragonbox_ecma",
|
||||
"nonmax",
|
||||
@@ -2932,7 +2932,7 @@ version = "0.81.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "83d8c311d64fa0bf8cab1bde3f7760cd828e71ed483ca0878799f1f72542cb4d"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"oxc_allocator",
|
||||
"oxc_ast",
|
||||
"oxc_ast_visit",
|
||||
@@ -2987,7 +2987,7 @@ version = "0.81.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70253728183a5a92d1ba964d9952201e0269ebd07c4917c4553283d564225bab"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"cow-utils",
|
||||
"memchr",
|
||||
"num-bigint",
|
||||
@@ -3010,7 +3010,7 @@ version = "0.81.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de5bb2ed6646bb7815126e0f36787c349e13561fed2c05f95b27a1f82dd066c4"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"oxc_allocator",
|
||||
"oxc_ast_macros",
|
||||
"oxc_diagnostics",
|
||||
@@ -3036,7 +3036,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"simdutf8",
|
||||
"thiserror 2.0.14",
|
||||
"thiserror 2.0.15",
|
||||
"tracing",
|
||||
"url",
|
||||
]
|
||||
@@ -3095,7 +3095,7 @@ version = "0.81.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72d9d80d47d2eee5c1e6dbcdf1841b42afc4f1cd1f63701fc346162616dac52f"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"cow-utils",
|
||||
"dragonbox_ecma",
|
||||
"nonmax",
|
||||
@@ -3390,7 +3390,7 @@ dependencies = [
|
||||
"rustc-hash",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 2.0.14",
|
||||
"thiserror 2.0.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3456,9 +3456,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.97"
|
||||
version = "1.0.101"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d61789d7719defeb74ea5fe81f2fdfdbd28a803847077cecce2ff14e1472f6f1"
|
||||
checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -3600,7 +3600,7 @@ version = "0.5.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3714,7 +3714,7 @@ version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
@@ -4227,11 +4227,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "2.0.14"
|
||||
version = "2.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b0949c3a6c842cbde3f1686d6eea5a010516deb7085f79db747562d4102f41e"
|
||||
checksum = "80d76d3f064b981389ecb4b6b7f45a0bf9fdac1d5b9204c7bd6714fecc302850"
|
||||
dependencies = [
|
||||
"thiserror-impl 2.0.14",
|
||||
"thiserror-impl 2.0.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4247,9 +4247,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "2.0.14"
|
||||
version = "2.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc5b44b4ab9c2fdd0e0512e6bece8388e214c0749f5862b114cc5b7a25daf227"
|
||||
checksum = "44d29feb33e986b6ea906bd9c3559a856983f92371b3eaa5e83782a351623de0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -4421,7 +4421,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2"
|
||||
dependencies = [
|
||||
"async-compression",
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"http",
|
||||
@@ -4544,7 +4544,7 @@ version = "11.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ef1b7a6d914a34127ed8e1fa927eb7088903787bcded4fa3eef8f85ee1568be"
|
||||
dependencies = [
|
||||
"thiserror 2.0.14",
|
||||
"thiserror 2.0.15",
|
||||
"ts-rs-macros",
|
||||
]
|
||||
|
||||
@@ -5086,7 +5086,7 @@ version = "0.39.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bitflags 2.9.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -23,7 +23,7 @@ const VERSION: Version = Version::ZERO;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
starting_height: Height,
|
||||
starting_height: Option<Height>,
|
||||
|
||||
pub state: Option<AddressCohortState>,
|
||||
|
||||
@@ -50,7 +50,7 @@ impl Vecs {
|
||||
let suffix = |s: &str| cohort_name.map_or(s.to_string(), |name| format!("{name}_{s}"));
|
||||
|
||||
Ok(Self {
|
||||
starting_height: Height::ZERO,
|
||||
starting_height: None,
|
||||
state: states_path.map(|states_path| {
|
||||
AddressCohortState::new(
|
||||
states_path,
|
||||
@@ -98,12 +98,16 @@ impl DynCohortVecs for Vecs {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn set_starting_height(&mut self, starting_height: Height) {
|
||||
self.starting_height = Some(starting_height);
|
||||
}
|
||||
|
||||
fn import_state_at(&mut self, starting_height: Height) -> Result<()> {
|
||||
if starting_height > self.starting_height() {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
self.starting_height = starting_height;
|
||||
self.set_starting_height(starting_height);
|
||||
|
||||
if let Some(prev_height) = starting_height.decremented() {
|
||||
self.state.as_mut().unwrap().address_count = *self
|
||||
@@ -113,7 +117,7 @@ impl DynCohortVecs for Vecs {
|
||||
}
|
||||
|
||||
self.inner.import_state_at(
|
||||
&mut self.starting_height,
|
||||
self.starting_height.unwrap(),
|
||||
&mut self.state.as_mut().unwrap().inner,
|
||||
)
|
||||
}
|
||||
@@ -128,7 +132,7 @@ impl DynCohortVecs for Vecs {
|
||||
}
|
||||
|
||||
fn forced_pushed_at(&mut self, height: Height, exit: &Exit) -> Result<()> {
|
||||
if self.starting_height > height {
|
||||
if self.starting_height.unwrap() > height {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
||||
@@ -1030,7 +1030,7 @@ impl Vecs {
|
||||
|
||||
pub fn import_state_at(
|
||||
&mut self,
|
||||
starting_height: &mut Height,
|
||||
starting_height: Height,
|
||||
state: &mut CohortState,
|
||||
) -> Result<()> {
|
||||
if let Some(prev_height) = starting_height.decremented() {
|
||||
|
||||
@@ -13,7 +13,7 @@ use log::info;
|
||||
use rayon::prelude::*;
|
||||
use vecdb::{
|
||||
AnyCollectableVec, AnyStoredVec, AnyVec, CollectableVec, Database, EagerVec, Exit, Format,
|
||||
GenericStoredVec, PAGE_SIZE, RawVec, Reader, Stamp, StoredIndex, VecIterator,
|
||||
GenericStoredVec, ImportOptions, PAGE_SIZE, RawVec, Reader, Stamp, StoredIndex, VecIterator,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@@ -47,8 +47,6 @@ pub struct Vecs {
|
||||
// ---
|
||||
// States
|
||||
// ---
|
||||
|
||||
// Rollback: diff on stamped_flush + add rollback to stamp
|
||||
pub chain_state: RawVec<Height, SupplyState>,
|
||||
pub p2pk33addressindex_to_anyaddressindex: RawVec<P2PK33AddressIndex, AnyAddressIndex>,
|
||||
pub p2pk65addressindex_to_anyaddressindex: RawVec<P2PK65AddressIndex, AnyAddressIndex>,
|
||||
@@ -61,7 +59,6 @@ pub struct Vecs {
|
||||
pub loadedaddressindex_to_loadedaddressdata: RawVec<LoadedAddressIndex, LoadedAddressData>,
|
||||
pub emptyaddressindex_to_emptyaddressdata: RawVec<EmptyAddressIndex, EmptyAddressData>,
|
||||
|
||||
// Rollback: inner state: save price_to_amount_STAMP instead of price_to_amount
|
||||
pub utxo_cohorts: utxo_cohorts::Vecs,
|
||||
pub address_cohorts: address_cohorts::Vecs,
|
||||
|
||||
@@ -81,6 +78,8 @@ pub struct Vecs {
|
||||
pub indexes_to_empty_address_count: ComputedVecsFromHeight<StoredU64>,
|
||||
}
|
||||
|
||||
const SAVED_STAMPED_CHANGES: u16 = 10;
|
||||
|
||||
impl Vecs {
|
||||
pub fn forced_import(
|
||||
parent: &Path,
|
||||
@@ -99,10 +98,9 @@ impl Vecs {
|
||||
let chain_db = Database::open(&parent.join("chain"))?;
|
||||
|
||||
Ok(Self {
|
||||
chain_state: RawVec::forced_import(
|
||||
&chain_db,
|
||||
"chain",
|
||||
version + VERSION + Version::ZERO,
|
||||
chain_state: RawVec::forced_import_with(
|
||||
ImportOptions::new(&chain_db, "chain", version + VERSION + Version::ZERO)
|
||||
.with_saved_stamped_changes(SAVED_STAMPED_CHANGES),
|
||||
)?,
|
||||
|
||||
height_to_unspendable_supply: EagerVec::forced_import_compressed(
|
||||
@@ -390,56 +388,46 @@ impl Vecs {
|
||||
states_path,
|
||||
)?,
|
||||
|
||||
p2aaddressindex_to_anyaddressindex: RawVec::forced_import(
|
||||
&db,
|
||||
"anyaddressindex",
|
||||
version + VERSION + Version::ZERO,
|
||||
p2aaddressindex_to_anyaddressindex: RawVec::forced_import_with(
|
||||
ImportOptions::new(&db, "anyaddressindex", version + VERSION + Version::ZERO)
|
||||
.with_saved_stamped_changes(SAVED_STAMPED_CHANGES),
|
||||
)?,
|
||||
p2pk33addressindex_to_anyaddressindex: RawVec::forced_import(
|
||||
&db,
|
||||
"anyaddressindex",
|
||||
version + VERSION + Version::ZERO,
|
||||
p2pk33addressindex_to_anyaddressindex: RawVec::forced_import_with(
|
||||
ImportOptions::new(&db, "anyaddressindex", version + VERSION + Version::ZERO)
|
||||
.with_saved_stamped_changes(SAVED_STAMPED_CHANGES),
|
||||
)?,
|
||||
p2pk65addressindex_to_anyaddressindex: RawVec::forced_import(
|
||||
&db,
|
||||
"anyaddressindex",
|
||||
version + VERSION + Version::ZERO,
|
||||
p2pk65addressindex_to_anyaddressindex: RawVec::forced_import_with(
|
||||
ImportOptions::new(&db, "anyaddressindex", version + VERSION + Version::ZERO)
|
||||
.with_saved_stamped_changes(SAVED_STAMPED_CHANGES),
|
||||
)?,
|
||||
p2pkhaddressindex_to_anyaddressindex: RawVec::forced_import(
|
||||
&db,
|
||||
"anyaddressindex",
|
||||
version + VERSION + Version::ZERO,
|
||||
p2pkhaddressindex_to_anyaddressindex: RawVec::forced_import_with(
|
||||
ImportOptions::new(&db, "anyaddressindex", version + VERSION + Version::ZERO)
|
||||
.with_saved_stamped_changes(SAVED_STAMPED_CHANGES),
|
||||
)?,
|
||||
p2shaddressindex_to_anyaddressindex: RawVec::forced_import(
|
||||
&db,
|
||||
"anyaddressindex",
|
||||
version + VERSION + Version::ZERO,
|
||||
p2shaddressindex_to_anyaddressindex: RawVec::forced_import_with(
|
||||
ImportOptions::new(&db, "anyaddressindex", version + VERSION + Version::ZERO)
|
||||
.with_saved_stamped_changes(SAVED_STAMPED_CHANGES),
|
||||
)?,
|
||||
p2traddressindex_to_anyaddressindex: RawVec::forced_import(
|
||||
&db,
|
||||
"anyaddressindex",
|
||||
version + VERSION + Version::ZERO,
|
||||
p2traddressindex_to_anyaddressindex: RawVec::forced_import_with(
|
||||
ImportOptions::new(&db, "anyaddressindex", version + VERSION + Version::ZERO)
|
||||
.with_saved_stamped_changes(SAVED_STAMPED_CHANGES),
|
||||
)?,
|
||||
p2wpkhaddressindex_to_anyaddressindex: RawVec::forced_import(
|
||||
&db,
|
||||
"anyaddressindex",
|
||||
version + VERSION + Version::ZERO,
|
||||
p2wpkhaddressindex_to_anyaddressindex: RawVec::forced_import_with(
|
||||
ImportOptions::new(&db, "anyaddressindex", version + VERSION + Version::ZERO)
|
||||
.with_saved_stamped_changes(SAVED_STAMPED_CHANGES),
|
||||
)?,
|
||||
p2wshaddressindex_to_anyaddressindex: RawVec::forced_import(
|
||||
&db,
|
||||
"anyaddressindex",
|
||||
version + VERSION + Version::ZERO,
|
||||
p2wshaddressindex_to_anyaddressindex: RawVec::forced_import_with(
|
||||
ImportOptions::new(&db, "anyaddressindex", version + VERSION + Version::ZERO)
|
||||
.with_saved_stamped_changes(SAVED_STAMPED_CHANGES),
|
||||
)?,
|
||||
|
||||
loadedaddressindex_to_loadedaddressdata: RawVec::forced_import(
|
||||
&db,
|
||||
"loadedaddressdata",
|
||||
version + VERSION + Version::ZERO,
|
||||
loadedaddressindex_to_loadedaddressdata: RawVec::forced_import_with(
|
||||
ImportOptions::new(&db, "loadedaddressdata", version + VERSION + Version::ZERO)
|
||||
.with_saved_stamped_changes(SAVED_STAMPED_CHANGES),
|
||||
)?,
|
||||
emptyaddressindex_to_emptyaddressdata: RawVec::forced_import(
|
||||
&db,
|
||||
"emptyaddressdata",
|
||||
version + VERSION + Version::ZERO,
|
||||
emptyaddressindex_to_emptyaddressdata: RawVec::forced_import_with(
|
||||
ImportOptions::new(&db, "emptyaddressdata", version + VERSION + Version::ZERO)
|
||||
.with_saved_stamped_changes(SAVED_STAMPED_CHANGES),
|
||||
)?,
|
||||
|
||||
db,
|
||||
@@ -572,7 +560,6 @@ impl Vecs {
|
||||
|
||||
let mut chain_state: Vec<BlockState> = vec![];
|
||||
let mut chain_state_starting_height = Height::from(self.chain_state.len());
|
||||
|
||||
let stateful_starting_height = match separate_utxo_vecs
|
||||
.par_iter_mut()
|
||||
.map(|(_, v)| v.starting_height())
|
||||
@@ -659,18 +646,15 @@ impl Vecs {
|
||||
self.loadedaddressindex_to_loadedaddressdata.reset()?;
|
||||
self.emptyaddressindex_to_emptyaddressdata.reset()?;
|
||||
|
||||
info!("Resetting utxo price maps...");
|
||||
|
||||
separate_utxo_vecs
|
||||
.par_iter_mut()
|
||||
.flat_map(|(_, v)| v.state.as_mut())
|
||||
.try_for_each(|state| state.reset_price_to_amount_if_needed())?;
|
||||
|
||||
info!("Resetting address price maps...");
|
||||
separate_utxo_vecs.par_iter_mut().try_for_each(|(_, v)| {
|
||||
v.set_starting_height(starting_height);
|
||||
v.state.as_mut().unwrap().reset_price_to_amount_if_needed()
|
||||
})?;
|
||||
|
||||
separate_address_vecs
|
||||
.par_iter_mut()
|
||||
.try_for_each(|(_, v)| {
|
||||
v.set_starting_height(starting_height);
|
||||
v.state.as_mut().unwrap().reset_price_to_amount_if_needed()
|
||||
})?;
|
||||
}
|
||||
@@ -753,6 +737,13 @@ impl Vecs {
|
||||
&mut anyaddressindex_to_anyaddressdata_reader_opt,
|
||||
);
|
||||
|
||||
let last_height = Height::from(
|
||||
height_to_date_fixed
|
||||
.len()
|
||||
.checked_sub(1)
|
||||
.unwrap_or_default(),
|
||||
);
|
||||
|
||||
(height.unwrap_to_usize()..height_to_date_fixed.len())
|
||||
.map(Height::from)
|
||||
.try_for_each(|_height| -> Result<()> {
|
||||
@@ -1150,13 +1141,13 @@ impl Vecs {
|
||||
)
|
||||
})?;
|
||||
|
||||
if height != Height::ZERO && height.unwrap_to_usize() % 10_000 == 0 {
|
||||
if height != last_height && height != Height::ZERO && height.unwrap_to_usize() % 10_000 == 0 {
|
||||
let _lock = exit.lock();
|
||||
|
||||
addresstypeindex_to_anyaddressindex_reader_opt.take();
|
||||
anyaddressindex_to_anyaddressdata_reader_opt.take();
|
||||
|
||||
self.flush_states(height, &chain_state, mem::take(&mut addresstype_to_typeindex_to_loadedaddressdata), mem::take(&mut addresstype_to_typeindex_to_emptyaddressdata), exit)?;
|
||||
self.flush_states(height, &chain_state, mem::take(&mut addresstype_to_typeindex_to_loadedaddressdata), mem::take(&mut addresstype_to_typeindex_to_emptyaddressdata), false, exit)?;
|
||||
|
||||
self.reset_readers_options(
|
||||
&mut addresstypeindex_to_anyaddressindex_reader_opt,
|
||||
@@ -1177,6 +1168,7 @@ impl Vecs {
|
||||
&chain_state,
|
||||
mem::take(&mut addresstype_to_typeindex_to_loadedaddressdata),
|
||||
mem::take(&mut addresstype_to_typeindex_to_emptyaddressdata),
|
||||
true,
|
||||
exit,
|
||||
)?;
|
||||
}
|
||||
@@ -1507,6 +1499,7 @@ impl Vecs {
|
||||
mut addresstype_to_typeindex_to_emptyaddressdata: AddressTypeToTypeIndexTree<
|
||||
WithAddressDataSource<EmptyAddressData>,
|
||||
>,
|
||||
with_changes: bool,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
info!("Flushing...");
|
||||
@@ -1676,32 +1669,35 @@ impl Vecs {
|
||||
})
|
||||
})?;
|
||||
|
||||
let stamp = Stamp::from(height);
|
||||
|
||||
self.p2pk33addressindex_to_anyaddressindex
|
||||
.stamped_flush(Stamp::from(height))?;
|
||||
.stamped_flush_maybe_with_changes(stamp, with_changes)?;
|
||||
self.p2pk65addressindex_to_anyaddressindex
|
||||
.stamped_flush(Stamp::from(height))?;
|
||||
.stamped_flush_maybe_with_changes(stamp, with_changes)?;
|
||||
self.p2pkhaddressindex_to_anyaddressindex
|
||||
.stamped_flush(Stamp::from(height))?;
|
||||
.stamped_flush_maybe_with_changes(stamp, with_changes)?;
|
||||
self.p2shaddressindex_to_anyaddressindex
|
||||
.stamped_flush(Stamp::from(height))?;
|
||||
.stamped_flush_maybe_with_changes(stamp, with_changes)?;
|
||||
self.p2traddressindex_to_anyaddressindex
|
||||
.stamped_flush(Stamp::from(height))?;
|
||||
.stamped_flush_maybe_with_changes(stamp, with_changes)?;
|
||||
self.p2wpkhaddressindex_to_anyaddressindex
|
||||
.stamped_flush(Stamp::from(height))?;
|
||||
.stamped_flush_maybe_with_changes(stamp, with_changes)?;
|
||||
self.p2wshaddressindex_to_anyaddressindex
|
||||
.stamped_flush(Stamp::from(height))?;
|
||||
.stamped_flush_maybe_with_changes(stamp, with_changes)?;
|
||||
self.p2aaddressindex_to_anyaddressindex
|
||||
.stamped_flush(Stamp::from(height))?;
|
||||
.stamped_flush_maybe_with_changes(stamp, with_changes)?;
|
||||
self.loadedaddressindex_to_loadedaddressdata
|
||||
.stamped_flush(Stamp::from(height))?;
|
||||
.stamped_flush_maybe_with_changes(stamp, with_changes)?;
|
||||
self.emptyaddressindex_to_emptyaddressdata
|
||||
.stamped_flush(Stamp::from(height))?;
|
||||
.stamped_flush_maybe_with_changes(stamp, with_changes)?;
|
||||
|
||||
self.chain_state.truncate_if_needed(Height::ZERO)?;
|
||||
chain_state.iter().for_each(|block_state| {
|
||||
self.chain_state.push(block_state.supply.clone());
|
||||
});
|
||||
self.chain_state.flush()?;
|
||||
self.chain_state
|
||||
.stamped_flush_maybe_with_changes(stamp, with_changes)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::{Indexes, indexes, market, price};
|
||||
|
||||
pub trait DynCohortVecs: Send + Sync {
|
||||
fn starting_height(&self) -> Height;
|
||||
fn set_starting_height(&mut self, starting_height: Height);
|
||||
|
||||
fn import_state_at(&mut self, starting_height: Height) -> Result<()>;
|
||||
|
||||
|
||||
@@ -69,17 +69,19 @@ impl DynCohortVecs for Vecs {
|
||||
self.inner.starting_height()
|
||||
}
|
||||
|
||||
fn set_starting_height(&mut self, starting_height: Height) {
|
||||
self.starting_height = Some(starting_height);
|
||||
}
|
||||
|
||||
fn import_state_at(&mut self, starting_height: Height) -> Result<()> {
|
||||
if starting_height > self.starting_height() {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
self.starting_height = Some(starting_height);
|
||||
self.set_starting_height(starting_height);
|
||||
|
||||
self.inner.import_state_at(
|
||||
self.starting_height.as_mut().unwrap(),
|
||||
self.state.as_mut().unwrap(),
|
||||
)
|
||||
self.inner
|
||||
.import_state_at(self.starting_height.unwrap(), self.state.as_mut().unwrap())
|
||||
}
|
||||
|
||||
fn validate_computed_versions(&mut self, base_version: Version) -> Result<()> {
|
||||
|
||||
@@ -234,12 +234,12 @@ impl Vecs {
|
||||
.into_owned();
|
||||
let range = first_index..first_index + count as usize;
|
||||
range.into_iter().fold(Sats::ZERO, |total, outputindex| {
|
||||
total
|
||||
+ outputindex_to_value_iter
|
||||
.next_at(outputindex)
|
||||
.unwrap()
|
||||
.1
|
||||
.into_owned()
|
||||
let v = outputindex_to_value_iter
|
||||
.next_at(outputindex)
|
||||
.unwrap()
|
||||
.1
|
||||
.into_owned();
|
||||
total + v
|
||||
})
|
||||
})
|
||||
},
|
||||
@@ -704,10 +704,21 @@ impl Vecs {
|
||||
// },
|
||||
// )?;
|
||||
|
||||
self.txindex_to_fee.compute_subtract(
|
||||
self.txindex_to_fee.compute_transform3(
|
||||
starting_indexes.txindex,
|
||||
&self.txindex_to_input_value,
|
||||
&self.txindex_to_output_value,
|
||||
&self.txindex_to_is_coinbase,
|
||||
|(i, input, output, coinbase, ..)| {
|
||||
(
|
||||
i,
|
||||
if coinbase.is_true() {
|
||||
Sats::ZERO
|
||||
} else {
|
||||
input.checked_sub(output).unwrap()
|
||||
},
|
||||
)
|
||||
},
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use vecdb::{Printable, StoredCompressed};
|
||||
use derive_deref::Deref;
|
||||
use serde::Serialize;
|
||||
use vecdb::{Printable, StoredCompressed};
|
||||
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
|
||||
|
||||
#[derive(
|
||||
@@ -25,6 +25,14 @@ pub struct StoredBool(u16);
|
||||
impl StoredBool {
|
||||
pub const FALSE: Self = Self(0);
|
||||
pub const TRUE: Self = Self(1);
|
||||
|
||||
pub fn is_true(&self) -> bool {
|
||||
*self == Self::TRUE
|
||||
}
|
||||
|
||||
pub fn is_false(&self) -> bool {
|
||||
*self == Self::FALSE
|
||||
}
|
||||
}
|
||||
|
||||
impl From<bool> for StoredBool {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
LICENSE
|
||||
*.json
|
||||
*webcomponent*
|
||||
README.md
|
||||
cli*
|
||||
extras/
|
||||
*.cjs
|
||||
dev.js
|
||||
*.development*
|
||||
*.iife.*
|
||||
nano.*
|
||||
@@ -0,0 +1 @@
|
||||
*.js
|
||||
+41
-41
@@ -1,4 +1,4 @@
|
||||
declare module "lean-qr" {
|
||||
declare module 'lean-qr' {
|
||||
interface ImageDataLike {
|
||||
readonly data: Uint8ClampedArray;
|
||||
}
|
||||
@@ -11,7 +11,7 @@ declare module "lean-qr" {
|
||||
interface CanvasLike<DataT extends ImageDataLike> {
|
||||
width: number;
|
||||
height: number;
|
||||
getContext(type: "2d"): Context2DLike<DataT> | null;
|
||||
getContext(type: '2d'): Context2DLike<DataT> | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +92,7 @@ declare module "lean-qr" {
|
||||
*/
|
||||
toImageData<DataT extends ImageDataLike>(
|
||||
context: Context2DLike<DataT>,
|
||||
options?: Readonly<ImageDataOptions>
|
||||
options?: Readonly<ImageDataOptions>,
|
||||
): DataT;
|
||||
|
||||
/**
|
||||
@@ -107,7 +107,7 @@ declare module "lean-qr" {
|
||||
type?: `image/${string}`;
|
||||
scale?: number;
|
||||
}
|
||||
>
|
||||
>,
|
||||
): string;
|
||||
|
||||
/**
|
||||
@@ -121,7 +121,7 @@ declare module "lean-qr" {
|
||||
*/
|
||||
toCanvas(
|
||||
canvas: CanvasLike<ImageDataLike>,
|
||||
options?: Readonly<ImageDataOptions>
|
||||
options?: Readonly<ImageDataOptions>,
|
||||
): void;
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ declare module "lean-qr" {
|
||||
*/
|
||||
export type GenerateFn = (
|
||||
data: Mode | string,
|
||||
options?: Readonly<GenerateOptions>
|
||||
options?: Readonly<GenerateOptions>,
|
||||
) => Bitmap2D;
|
||||
interface Generate extends GenerateFn {
|
||||
/**
|
||||
@@ -221,23 +221,23 @@ declare module "lean-qr" {
|
||||
export const generate: Generate;
|
||||
}
|
||||
|
||||
declare module "lean-qr/nano" {
|
||||
declare module 'lean-qr/nano' {
|
||||
import type {
|
||||
Correction,
|
||||
Bitmap2D as FullBitmap2D,
|
||||
GenerateOptions as FullGenerateOptions,
|
||||
} from "lean-qr";
|
||||
import { correction as fullCorrection } from "lean-qr";
|
||||
} from 'lean-qr';
|
||||
import { correction as fullCorrection } from 'lean-qr';
|
||||
|
||||
export type { Correction };
|
||||
|
||||
export const correction: Pick<typeof fullCorrection, "L" | "M" | "Q" | "H">;
|
||||
export const correction: Pick<typeof fullCorrection, 'L' | 'M' | 'Q' | 'H'>;
|
||||
|
||||
export type Bitmap2D = Pick<FullBitmap2D, "size" | "get" | "toCanvas">;
|
||||
export type Bitmap2D = Pick<FullBitmap2D, 'size' | 'get' | 'toCanvas'>;
|
||||
|
||||
export type GenerateOptions = Pick<
|
||||
FullGenerateOptions,
|
||||
"minCorrectionLevel" | "minVersion"
|
||||
'minCorrectionLevel' | 'minVersion'
|
||||
>;
|
||||
|
||||
/**
|
||||
@@ -249,14 +249,14 @@ declare module "lean-qr/nano" {
|
||||
*/
|
||||
export function generate(
|
||||
data: string,
|
||||
options?: Readonly<GenerateOptions>
|
||||
options?: Readonly<GenerateOptions>,
|
||||
): Bitmap2D;
|
||||
}
|
||||
|
||||
declare module "lean-qr/extras/svg" {
|
||||
import type { Bitmap2D as FullBitmap2D } from "lean-qr";
|
||||
declare module 'lean-qr/extras/svg' {
|
||||
import type { Bitmap2D as FullBitmap2D } from 'lean-qr';
|
||||
|
||||
type Bitmap2D = Pick<FullBitmap2D, "size" | "get">;
|
||||
type Bitmap2D = Pick<FullBitmap2D, 'size' | 'get'>;
|
||||
|
||||
export interface SVGOptions {
|
||||
/** the colour to use for modules which are 'on' (typically black) */
|
||||
@@ -293,7 +293,7 @@ declare module "lean-qr/extras/svg" {
|
||||
export function toSvg(
|
||||
code: Bitmap2D,
|
||||
target: Document | SVGElement,
|
||||
options?: Readonly<SVGOptions>
|
||||
options?: Readonly<SVGOptions>,
|
||||
): SVGElement;
|
||||
|
||||
/**
|
||||
@@ -311,7 +311,7 @@ declare module "lean-qr/extras/svg" {
|
||||
/** `true` to include an XML declaration at the start of the source (for standalone documents which will not be embedded inside another document) */
|
||||
xmlDeclaration?: boolean;
|
||||
}
|
||||
>
|
||||
>,
|
||||
): string;
|
||||
|
||||
/**
|
||||
@@ -323,14 +323,14 @@ declare module "lean-qr/extras/svg" {
|
||||
*/
|
||||
export function toSvgDataURL(
|
||||
code: Bitmap2D,
|
||||
options?: Readonly<SVGOptions>
|
||||
options?: Readonly<SVGOptions>,
|
||||
): string;
|
||||
}
|
||||
|
||||
declare module "lean-qr/extras/node_export" {
|
||||
import type { RGBA, Bitmap2D as FullBitmap2D } from "lean-qr";
|
||||
declare module 'lean-qr/extras/node_export' {
|
||||
import type { RGBA, Bitmap2D as FullBitmap2D } from 'lean-qr';
|
||||
|
||||
type Bitmap2D = Pick<FullBitmap2D, "size" | "get">;
|
||||
type Bitmap2D = Pick<FullBitmap2D, 'size' | 'get'>;
|
||||
|
||||
export interface PNGOptions {
|
||||
/** the colour to use for modules which are 'on' (typically black) */
|
||||
@@ -355,7 +355,7 @@ declare module "lean-qr/extras/node_export" {
|
||||
*/
|
||||
export function toPngBuffer(
|
||||
code: Bitmap2D,
|
||||
options?: Readonly<PNGOptions>
|
||||
options?: Readonly<PNGOptions>,
|
||||
): Uint8Array;
|
||||
|
||||
/**
|
||||
@@ -367,29 +367,29 @@ declare module "lean-qr/extras/node_export" {
|
||||
*/
|
||||
export function toPngDataURL(
|
||||
code: Bitmap2D,
|
||||
options?: Readonly<PNGOptions>
|
||||
options?: Readonly<PNGOptions>,
|
||||
): string;
|
||||
}
|
||||
|
||||
declare module "lean-qr/extras/react" {
|
||||
declare module 'lean-qr/extras/react' {
|
||||
import type {
|
||||
Bitmap2D as FullBitmap2D,
|
||||
GenerateOptions,
|
||||
ImageDataOptions,
|
||||
} from "lean-qr";
|
||||
} from 'lean-qr';
|
||||
import type {
|
||||
SVGOptions,
|
||||
toSvgDataURL as toSvgDataURLFn,
|
||||
} from "lean-qr/extras/svg";
|
||||
} from 'lean-qr/extras/svg';
|
||||
|
||||
export interface AsyncFramework<T> {
|
||||
createElement: (
|
||||
type: "canvas",
|
||||
type: 'canvas',
|
||||
props: {
|
||||
ref: any;
|
||||
style: { imageRendering: "pixelated" };
|
||||
style: { imageRendering: 'pixelated' };
|
||||
className: string;
|
||||
}
|
||||
},
|
||||
) => T;
|
||||
useRef<T>(initialValue: T | null): { readonly current: T | null };
|
||||
useEffect(fn: () => void | (() => void), deps: unknown[]): void;
|
||||
@@ -406,7 +406,7 @@ declare module "lean-qr/extras/react" {
|
||||
QRComponentProps {}
|
||||
|
||||
export type AsyncQRComponent<T> = (
|
||||
props: Readonly<AsyncQRComponentProps>
|
||||
props: Readonly<AsyncQRComponentProps>,
|
||||
) => T;
|
||||
|
||||
/**
|
||||
@@ -427,19 +427,19 @@ declare module "lean-qr/extras/react" {
|
||||
framework: Readonly<AsyncFramework<T>>,
|
||||
generate: (
|
||||
data: string,
|
||||
options?: Readonly<GenerateOptions>
|
||||
) => Pick<FullBitmap2D, "toCanvas">,
|
||||
defaultProps?: Readonly<Partial<AsyncQRComponentProps>>
|
||||
options?: Readonly<GenerateOptions>,
|
||||
) => Pick<FullBitmap2D, 'toCanvas'>,
|
||||
defaultProps?: Readonly<Partial<AsyncQRComponentProps>>,
|
||||
): AsyncQRComponent<T>;
|
||||
|
||||
export interface SyncFramework<T> {
|
||||
createElement: (
|
||||
type: "img",
|
||||
type: 'img',
|
||||
props: {
|
||||
src: string;
|
||||
style: { imageRendering: "pixelated" };
|
||||
style: { imageRendering: 'pixelated' };
|
||||
className: string;
|
||||
}
|
||||
},
|
||||
) => T;
|
||||
useMemo<T>(fn: () => T, deps: unknown[]): T;
|
||||
}
|
||||
@@ -471,14 +471,14 @@ declare module "lean-qr/extras/react" {
|
||||
framework: Readonly<SyncFramework<T>>,
|
||||
generate: (
|
||||
data: string,
|
||||
options?: Readonly<GenerateOptions>
|
||||
) => Pick<FullBitmap2D, "size" | "get">,
|
||||
options?: Readonly<GenerateOptions>,
|
||||
) => Pick<FullBitmap2D, 'size' | 'get'>,
|
||||
toSvgDataURL: typeof toSvgDataURLFn,
|
||||
defaultProps?: Readonly<Partial<SyncQRComponentProps>>
|
||||
defaultProps?: Readonly<Partial<SyncQRComponentProps>>,
|
||||
): SyncQRComponent<T>;
|
||||
}
|
||||
|
||||
declare module "lean-qr/extras/errors" {
|
||||
declare module 'lean-qr/extras/errors' {
|
||||
/**
|
||||
* Convert an error into a human-readable message. This is intended for use
|
||||
* with Lean QR errors, but will return somewhat meaningful messages for
|
||||
+1
-3
File diff suppressed because one or more lines are too long
@@ -1,3 +0,0 @@
|
||||
URL + Version:
|
||||
|
||||
https://unpkg.com/browse/lean-qr@latest/
|
||||
@@ -0,0 +1,6 @@
|
||||
LICENSE
|
||||
*.json
|
||||
webcomponent*
|
||||
README.md
|
||||
cli*
|
||||
extras/
|
||||
+7
-7
@@ -9,28 +9,28 @@ declare class uFuzzy {
|
||||
outOfOrder?: number,
|
||||
/** default = 1e3 */
|
||||
infoThresh?: number,
|
||||
preFiltered?: uFuzzy.HaystackIdxs | null
|
||||
preFiltered?: uFuzzy.HaystackIdxs | null,
|
||||
): uFuzzy.SearchResult;
|
||||
|
||||
/** initial haystack filter, can accept idxs from previous prefix/typeahead match as optimization */
|
||||
filter(
|
||||
haystack: string[],
|
||||
needle: string,
|
||||
idxs?: uFuzzy.HaystackIdxs
|
||||
idxs?: uFuzzy.HaystackIdxs,
|
||||
): uFuzzy.HaystackIdxs | null;
|
||||
|
||||
/** collects stats about pre-filtered matches, does additional filtering based on term boundary settings, finds highlight ranges */
|
||||
info(
|
||||
idxs: uFuzzy.HaystackIdxs,
|
||||
haystack: string[],
|
||||
needle: string
|
||||
needle: string,
|
||||
): uFuzzy.Info;
|
||||
|
||||
/** performs final result sorting via Array.sort(), relying on Info */
|
||||
sort(
|
||||
info: uFuzzy.Info,
|
||||
haystack: string[],
|
||||
needle: string
|
||||
needle: string,
|
||||
): uFuzzy.InfoIdxOrder;
|
||||
|
||||
/** utility for splitting needle into terms following defined interSplit/intraSplit opts. useful for out-of-order permutes */
|
||||
@@ -49,7 +49,7 @@ declare class uFuzzy {
|
||||
|
||||
mark?: (part: string, matched: boolean) => TMarkedPart,
|
||||
accum?: TAccum,
|
||||
append?: (accum: TAccum, part: TMarkedPart) => TAccum | undefined
|
||||
append?: (accum: TAccum, part: TMarkedPart) => TAccum | undefined,
|
||||
): TAccum;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ declare namespace uFuzzy {
|
||||
export type RankedResult = [
|
||||
uFuzzy.HaystackIdxs,
|
||||
uFuzzy.Info,
|
||||
uFuzzy.InfoIdxOrder
|
||||
uFuzzy.InfoIdxOrder,
|
||||
];
|
||||
|
||||
export type SearchResult = FilteredResult | RankedResult | AbortedResult;
|
||||
@@ -173,7 +173,7 @@ declare namespace uFuzzy {
|
||||
info: Info,
|
||||
haystack: string[],
|
||||
needle: string,
|
||||
compare?: CompareFn
|
||||
compare?: CompareFn,
|
||||
) => InfoIdxOrder;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
*charts.pro*
|
||||
light*.js
|
||||
+3
-4
@@ -1,7 +1,6 @@
|
||||
// Generated by dts-bundle-generator v9.5.1
|
||||
|
||||
type CanvasRenderingTarget2D = any;
|
||||
// import { CanvasRenderingTarget2D } from 'fancy-canvas';
|
||||
|
||||
declare const areaSeries: SeriesDefinition<"Area">;
|
||||
declare const barSeries: SeriesDefinition<"Bar">;
|
||||
@@ -4298,7 +4297,7 @@ export interface TouchMouseEventData {
|
||||
*/
|
||||
readonly ctrlKey: boolean;
|
||||
/**
|
||||
* Returns a boolean value that is true if the Alt (Option or ⌥ on macOS) key was active when the
|
||||
* Returns a boolean value that is true if the Alt (Option or ⌥ on macOS) key was active when the
|
||||
* key event was generated.
|
||||
*/
|
||||
readonly altKey: boolean;
|
||||
@@ -4307,8 +4306,8 @@ export interface TouchMouseEventData {
|
||||
*/
|
||||
readonly shiftKey: boolean;
|
||||
/**
|
||||
* Returns a boolean value that is true if the Meta key (on Mac keyboards, the ⌘ Command key; on
|
||||
* Windows keyboards, the Windows key (⊞)) was active when the key event was generated.
|
||||
* Returns a boolean value that is true if the Meta key (on Mac keyboards, the ⌘ Command key; on
|
||||
* Windows keyboards, the Windows key (⊞)) was active when the key event was generated.
|
||||
*/
|
||||
readonly metaKey: boolean;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
// @ts-check
|
||||
|
||||
/** @import { IChartApi, ISeriesApi as _ISeriesApi, SeriesDefinition, SingleValueData as _SingleValueData, CandlestickData as _CandlestickData, BaselineData as _BaselineData, SeriesType, IPaneApi, LineSeriesPartialOptions, BaselineSeriesPartialOptions, CandlestickSeriesPartialOptions, WhitespaceData, DeepPartial, ChartOptions, Time, LineData as _LineData } from './v5.0.8/types' */
|
||||
/** @import { IChartApi, ISeriesApi as _ISeriesApi, SeriesDefinition, SingleValueData as _SingleValueData, CandlestickData as _CandlestickData, BaselineData as _BaselineData, SeriesType, IPaneApi, LineSeriesPartialOptions, BaselineSeriesPartialOptions, CandlestickSeriesPartialOptions, WhitespaceData, DeepPartial, ChartOptions, Time, LineData as _LineData } from './5.0.8/dist/typings' */
|
||||
|
||||
/**
|
||||
* @typedef {[number, number, number, number]} OHLCTuple
|
||||
@@ -49,7 +49,7 @@ import {
|
||||
CandlestickSeries,
|
||||
LineSeries,
|
||||
BaselineSeries,
|
||||
} from "./v5.0.8/script.js";
|
||||
} from "./5.0.8/dist/lightweight-charts.standalone.production.mjs";
|
||||
|
||||
const oklchToRGBA = createOklchToRGBA();
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
https://app.unpkg.com/@solidjs/signals@latest/files/dist/prod.js
|
||||
@@ -1,3 +0,0 @@
|
||||
export { Owner, getOwner, onCleanup, untrack } from "./core/index.js";
|
||||
export type { SignalOptions, Context, ContextRecord, Disposable, IQueue } from "./core/index.js";
|
||||
export * from "./signals.js";
|
||||
@@ -1 +0,0 @@
|
||||
export declare function reconcile<T extends U, U>(value: T, key: string | ((item: NonNullable<any>) => any)): (state: U) => T;
|
||||
@@ -1,35 +0,0 @@
|
||||
import { Computation } from "../core/index.js";
|
||||
export type Store<T> = Readonly<T>;
|
||||
export type StoreSetter<T> = (fn: (state: T) => void) => void;
|
||||
type DataNode = Computation<any>;
|
||||
type DataNodes = Record<PropertyKey, DataNode>;
|
||||
declare const $RAW: unique symbol, $TRACK: unique symbol, $TARGET: unique symbol, $PROXY: unique symbol;
|
||||
export declare const STORE_VALUE = "v", STORE_NODE = "n", STORE_HAS = "h";
|
||||
export { $PROXY, $TRACK, $RAW, $TARGET };
|
||||
export type StoreNode = {
|
||||
[STORE_VALUE]: Record<PropertyKey, any>;
|
||||
[STORE_NODE]?: DataNodes;
|
||||
[STORE_HAS]?: DataNodes;
|
||||
};
|
||||
export declare namespace SolidStore {
|
||||
interface Unwrappable {
|
||||
}
|
||||
}
|
||||
export type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined | SolidStore.Unwrappable[keyof SolidStore.Unwrappable];
|
||||
export declare function wrap<T extends Record<PropertyKey, any>>(value: T): T;
|
||||
export declare function isWrappable<T>(obj: T | NotWrappable): obj is T;
|
||||
/**
|
||||
* Returns the underlying data in the store without a proxy.
|
||||
* @param item store proxy object
|
||||
* @example
|
||||
* ```js
|
||||
* const initial = {z...};
|
||||
* const [state, setState] = createStore(initial);
|
||||
* initial === state; // => false
|
||||
* initial === unwrap(state); // => true
|
||||
* ```
|
||||
*/
|
||||
export declare function unwrap<T>(item: T, deep?: boolean, set?: Set<unknown>): T;
|
||||
export declare function createStore<T extends object = {}>(store: T | Store<T>): [get: Store<T>, set: StoreSetter<T>];
|
||||
export declare function createStore<T extends object = {}>(fn: (store: T) => void, store: T | Store<T>): [get: Store<T>, set: StoreSetter<T>];
|
||||
export declare function deep<T extends object>(store: Store<T>): Store<any>;
|
||||
+758
-636
File diff suppressed because it is too large
Load Diff
+2
@@ -32,6 +32,7 @@ export interface SignalOptions<T> {
|
||||
id?: string;
|
||||
name?: string;
|
||||
equals?: ((prev: T, next: T) => boolean) | false;
|
||||
pureWrite?: boolean;
|
||||
unobserved?: () => void;
|
||||
}
|
||||
interface SourceType {
|
||||
@@ -63,6 +64,7 @@ export declare class Computation<T = any> extends Owner implements SourceType, O
|
||||
_name: string | undefined;
|
||||
_equals: false | ((a: T, b: T) => boolean);
|
||||
_unobserved: (() => void) | undefined;
|
||||
_pureWrite: boolean;
|
||||
/** Whether the computation is an error or has ancestors that are unresolved */
|
||||
_stateFlags: number;
|
||||
/** Which flags raised by sources are handled, vs. being passed through. */
|
||||
+6
-3
@@ -7,7 +7,7 @@ import { Computation, type SignalOptions } from "./core.js";
|
||||
*/
|
||||
export declare class Effect<T = any> extends Computation<T> {
|
||||
_effect: (val: T, prev: T | undefined) => void | (() => void);
|
||||
_onerror: ((err: unknown) => void | (() => void)) | undefined;
|
||||
_onerror: ((err: unknown, cleanup: () => void) => void) | undefined;
|
||||
_cleanup: (() => void) | undefined;
|
||||
_modified: boolean;
|
||||
_prevValue: T | undefined;
|
||||
@@ -20,15 +20,18 @@ export declare class Effect<T = any> extends Computation<T> {
|
||||
_notify(state: number, skipQueue?: boolean): void;
|
||||
_setError(error: unknown): void;
|
||||
_disposeNode(): void;
|
||||
_runEffect(type: number): void;
|
||||
_run(type: number): void;
|
||||
}
|
||||
export declare class EagerComputation<T = any> extends Computation<T> {
|
||||
constructor(initialValue: T, compute: () => T, options?: SignalOptions<T> & {
|
||||
defer?: boolean;
|
||||
});
|
||||
_notify(state: number, skipQueue?: boolean): void;
|
||||
_run(): void;
|
||||
}
|
||||
export declare class ProjectionComputation extends Computation {
|
||||
export declare class FirewallComputation extends Computation {
|
||||
firewall: boolean;
|
||||
constructor(compute: () => void);
|
||||
_notify(state: number, skipQueue?: boolean): void;
|
||||
_run(): void;
|
||||
}
|
||||
-3
@@ -6,6 +6,3 @@ export declare class NoOwnerError extends Error {
|
||||
export declare class ContextNotFoundError extends Error {
|
||||
constructor();
|
||||
}
|
||||
export declare class EffectError extends Error {
|
||||
constructor(effect: Function, cause: unknown);
|
||||
}
|
||||
+1
-1
@@ -2,6 +2,6 @@ export { ContextNotFoundError, NoOwnerError, NotReadyError } from "./error.js";
|
||||
export { Owner, createContext, getContext, setContext, hasContext, getOwner, onCleanup, type Context, type ContextRecord, type Disposable } from "./owner.js";
|
||||
export { Computation, getObserver, isEqual, untrack, hasUpdated, isPending, latest, UNCHANGED, compute, runWithObserver, type SignalOptions } from "./core.js";
|
||||
export { Effect, EagerComputation } from "./effect.js";
|
||||
export { flushSync, Queue, incrementClock, getClock, type IQueue } from "./scheduler.js";
|
||||
export { flush, Queue, incrementClock, getClock, type IQueue } from "./scheduler.js";
|
||||
export * from "./constants.js";
|
||||
export * from "./flags.js";
|
||||
+2
-2
@@ -27,7 +27,7 @@ export declare class Queue implements IQueue {
|
||||
export declare const globalQueue: Queue;
|
||||
/**
|
||||
* By default, changes are batched on the microtask queue which is an async process. You can flush
|
||||
* the queue synchronously to get the latest updates by calling `flushSync()`.
|
||||
* the queue synchronously to get the latest updates by calling `flush()`.
|
||||
*/
|
||||
export declare function flushSync(): void;
|
||||
export declare function flush(): void;
|
||||
export {};
|
||||
@@ -0,0 +1,6 @@
|
||||
export { Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, Queue, createContext, flush, getContext, setContext, hasContext, getOwner, onCleanup, getObserver, isEqual, untrack, hasUpdated, isPending, latest, runWithObserver, SUPPORTS_PROXY } from "./core/index.js";
|
||||
export type { SignalOptions, Context, ContextRecord, Disposable, IQueue } from "./core/index.js";
|
||||
export { mapArray, repeat, type Maybe } from "./map.js";
|
||||
export * from "./signals.js";
|
||||
export * from "./store/index.js";
|
||||
export { createSuspense, createErrorBoundary, createBoundary, flatten, type BoundaryMode } from "./boundaries.js";
|
||||
+46
-2
@@ -10,6 +10,10 @@ export type Setter<in out T> = {
|
||||
export type Signal<T> = [get: Accessor<T>, set: Setter<T>];
|
||||
export type ComputeFunction<Prev, Next extends Prev = Prev> = (v: Prev) => Next;
|
||||
export type EffectFunction<Prev, Next extends Prev = Prev> = (v: Next, p?: Prev) => (() => void) | void;
|
||||
export type EffectBundle<Prev, Next extends Prev = Prev> = {
|
||||
effect: EffectFunction<Prev, Next>;
|
||||
error: (err: unknown, cleanup: () => void) => void;
|
||||
};
|
||||
export interface EffectOptions {
|
||||
name?: string;
|
||||
defer?: boolean;
|
||||
@@ -77,6 +81,9 @@ export declare function createMemo<Next extends Prev, Init = Next, Prev = Next>(
|
||||
*
|
||||
* @description https://docs.solidjs.com/reference/basic-reactivity/create-async
|
||||
*/
|
||||
export declare function createAsync<T>(compute: (prev: T | undefined, refreshing: boolean) => Promise<T> | AsyncIterable<T> | T, value?: T, options?: MemoOptions<T>): Accessor<T> & {
|
||||
refresh: () => void;
|
||||
};
|
||||
/**
|
||||
* Creates a reactive effect that runs after the render phase
|
||||
* ```typescript
|
||||
@@ -95,8 +102,8 @@ export declare function createMemo<Next extends Prev, Init = Next, Prev = Next>(
|
||||
*
|
||||
* @description https://docs.solidjs.com/reference/basic-reactivity/create-effect
|
||||
*/
|
||||
export declare function createEffect<Next>(compute: ComputeFunction<undefined | NoInfer<Next>, Next>, effect: EffectFunction<NoInfer<Next>, Next>, error?: (err: unknown) => void): void;
|
||||
export declare function createEffect<Next, Init = Next>(compute: ComputeFunction<Init | Next, Next>, effect: EffectFunction<Next, Next>, error: ((err: unknown) => void) | undefined, value: Init, options?: EffectOptions): void;
|
||||
export declare function createEffect<Next>(compute: ComputeFunction<undefined | NoInfer<Next>, Next>, effect: EffectFunction<NoInfer<Next>, Next> | EffectBundle<NoInfer<Next>, Next>): void;
|
||||
export declare function createEffect<Next, Init = Next>(compute: ComputeFunction<Init | Next, Next>, effect: EffectFunction<Next, Next> | EffectBundle<Next, Next>, value: Init, options?: EffectOptions): void;
|
||||
/**
|
||||
* Creates a reactive computation that runs during the render phase as DOM elements are created and updated but not necessarily connected
|
||||
* ```typescript
|
||||
@@ -114,6 +121,8 @@ export declare function createEffect<Next, Init = Next>(compute: ComputeFunction
|
||||
*
|
||||
* @description https://docs.solidjs.com/reference/secondary-primitives/create-render-effect
|
||||
*/
|
||||
export declare function createRenderEffect<Next>(compute: ComputeFunction<undefined | NoInfer<Next>, Next>, effect: EffectFunction<NoInfer<Next>, Next>): void;
|
||||
export declare function createRenderEffect<Next, Init = Next>(compute: ComputeFunction<Init | Next, Next>, effect: EffectFunction<Next, Next>, value: Init, options?: EffectOptions): void;
|
||||
/**
|
||||
* Creates a new non-tracked reactive context with manual disposal
|
||||
*
|
||||
@@ -136,3 +145,38 @@ export declare function runWithOwner<T>(owner: Owner | null, run: () => T): T;
|
||||
* Returns a promise of the resolved value of a reactive expression
|
||||
* @param fn a reactive expression to resolve
|
||||
*/
|
||||
export declare function resolve<T>(fn: () => T): Promise<T>;
|
||||
/**
|
||||
* Runs the given function and returns a tuple with the result or an error.
|
||||
* If the function throws an error, it will be caught and returned as the first element of the tuple.
|
||||
* If the function returns a promise, it will resolve to a tuple with the result or an error.
|
||||
*
|
||||
* @param fn The function to run.
|
||||
* @returns A tuple with either [undefined, result] or [error].
|
||||
*
|
||||
* @description https://docs.solidjs.com/reference/reactive-utilities/try-catch
|
||||
*/
|
||||
export type TryCatchResult<T, E> = [undefined, T] | [E];
|
||||
export declare function tryCatch<T, E = Error>(fn: () => Promise<T>): Promise<TryCatchResult<T, E>>;
|
||||
export declare function tryCatch<T, E = Error>(fn: () => T): TryCatchResult<T, E>;
|
||||
/**
|
||||
* Runs the given function in a transition scope, allowing for batch updates and optimizations.
|
||||
* This is useful for grouping multiple state updates together to avoid unnecessary re-renders.
|
||||
*
|
||||
* @param fn A function that receives a resume function to continue the transition.
|
||||
* The resume function can be called with another function to continue the transition.
|
||||
*
|
||||
* @description https://docs.solidjs.com/reference/advanced-reactivity/transition
|
||||
*/
|
||||
export declare function transition(fn: (resume: (fn: () => any | Promise<any>) => void) => any | Promise<any>): void;
|
||||
/**
|
||||
* Creates an optimistic signal that can be used to optimistically update a value
|
||||
* and then revert it back to the previous value at end of transition.
|
||||
*
|
||||
* @param initial The initial value of the signal.
|
||||
* @param compute An optional function to compute the next value based on the previous value and change.
|
||||
* @param options Optional signal options.
|
||||
*
|
||||
* @returns A tuple containing an accessor for the current value and a setter function to apply changes.
|
||||
*/
|
||||
export declare function createOptimistic<T, U>(initial: T, compute?: (prev: T, change: U) => void, options?: SignalOptions<T>): [Accessor<T>, (v: U) => void];
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
export type { Store, StoreSetter, StoreNode, NotWrappable, SolidStore } from "./store.js";
|
||||
export type { Merge, Omit } from "./utils.js";
|
||||
export { unwrap, isWrappable, createStore, deep, $RAW, $TRACK, $PROXY, $TARGET } from "./store.js";
|
||||
export { isWrappable, createStore, deep, $TRACK, $PROXY, $TARGET } from "./store.js";
|
||||
export { createProjection } from "./projection.js";
|
||||
export { reconcile } from "./reconcile.js";
|
||||
export { merge, omit } from "./utils.js";
|
||||
export { snapshot, merge, omit } from "./utils.js";
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
import { type Store, type StoreSetter } from "./store.js";
|
||||
import { type Store } from "./store.js";
|
||||
/**
|
||||
* Creates a mutable derived value
|
||||
*
|
||||
* @see {@link https://github.com/solidjs/x-reactivity#createprojection}
|
||||
*/
|
||||
export declare function createProjection<T extends Object>(fn: (draft: T) => void, initialValue?: T): Store<T>;
|
||||
export declare function wrapProjection<T>(fn: (draft: T) => void, store: Store<T>, setStore: StoreSetter<T>): [Store<T>, StoreSetter<T>];
|
||||
+1
@@ -0,0 +1 @@
|
||||
export declare function reconcile<T extends U, U>(value: T, key: string | ((item: NonNullable<any>) => any), all?: boolean): (state: U) => void;
|
||||
@@ -0,0 +1,33 @@
|
||||
import { Computation } from "../core/index.js";
|
||||
export type Store<T> = Readonly<T>;
|
||||
export type StoreSetter<T> = (fn: (state: T) => void) => void;
|
||||
type DataNode = Computation<any>;
|
||||
type DataNodes = Record<PropertyKey, DataNode>;
|
||||
export declare const $TRACK: unique symbol, $DEEP: unique symbol, $TARGET: unique symbol, $PROXY: unique symbol, $DELETED: unique symbol;
|
||||
export declare const STORE_VALUE = "v", STORE_OVERRIDE = "o", STORE_NODE = "n", STORE_HAS = "h", STORE_WRAP = "w", STORE_LOOKUP = "l";
|
||||
export type StoreNode = {
|
||||
[$PROXY]: any;
|
||||
[STORE_VALUE]: Record<PropertyKey, any>;
|
||||
[STORE_OVERRIDE]?: Record<PropertyKey, any>;
|
||||
[STORE_NODE]?: DataNodes;
|
||||
[STORE_HAS]?: DataNodes;
|
||||
[STORE_WRAP]?: (value: any, target?: StoreNode) => any;
|
||||
[STORE_LOOKUP]?: WeakMap<any, any>;
|
||||
};
|
||||
export declare namespace SolidStore {
|
||||
interface Unwrappable {
|
||||
}
|
||||
}
|
||||
export type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined | SolidStore.Unwrappable[keyof SolidStore.Unwrappable];
|
||||
export declare function createStoreProxy<T extends object>(value: T, traps?: ProxyHandler<StoreNode>, extend?: Record<PropertyKey, any>): any;
|
||||
export declare const storeLookup: WeakMap<object, any>;
|
||||
export declare function wrap<T extends Record<PropertyKey, any>>(value: T, target?: StoreNode): T;
|
||||
export declare function isWrappable<T>(obj: T | NotWrappable): obj is T;
|
||||
export declare function getKeys(source: Record<PropertyKey, any>, override: Record<PropertyKey, any> | undefined, enumerable?: boolean): PropertyKey[];
|
||||
export declare function getPropertyDescriptor(source: Record<PropertyKey, any>, override: Record<PropertyKey, any> | undefined, property: PropertyKey): PropertyDescriptor | undefined;
|
||||
export declare const storeTraps: ProxyHandler<StoreNode>;
|
||||
export declare function storeSetter<T extends object>(store: Store<T>, fn: (draft: T) => void): void;
|
||||
export declare function createStore<T extends object = {}>(store: T | Store<T>): [get: Store<T>, set: StoreSetter<T>];
|
||||
export declare function createStore<T extends object = {}>(fn: (store: T) => void, store: T | Store<T>): [get: Store<T>, set: StoreSetter<T>];
|
||||
export declare function deep<T extends object>(store: Store<T>): Store<any>;
|
||||
export {};
|
||||
+7
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* Returns a non reactive copy of the store object.
|
||||
* It will attempt to preserver the original reference unless the value has been modified.
|
||||
* @param item store proxy object
|
||||
*/
|
||||
export declare function snapshot<T>(item: T): T;
|
||||
export declare function snapshot<T>(item: T, map?: Map<unknown, unknown>, lookup?: WeakMap<any, any>): T;
|
||||
type DistributeOverride<T, F> = T extends undefined ? F : T;
|
||||
type Override<T, U> = T extends any ? U extends any ? {
|
||||
[K in keyof T]: K extends keyof U ? DistributeOverride<U[K], T[K]> : T[K];
|
||||
+8
-8
@@ -1,9 +1,9 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* @import { SignalOptions } from "./v0.3.2/types/core/core"
|
||||
* @import { getOwner as GetOwner, onCleanup as OnCleanup } from "./v0.3.2/types/core/owner"
|
||||
* @import { createSignal as CreateSignal, createEffect as CreateEffect, createMemo as CreateMemo, createRoot as CreateRoot, runWithOwner as RunWithOwner, Setter } from "./v0.3.2/types/signals";
|
||||
* @import { SignalOptions } from "./0.4.1/dist/types/core/core"
|
||||
* @import { getOwner as GetOwner, onCleanup as OnCleanup } from "./0.4.1/dist/types/core/owner"
|
||||
* @import { createSignal as CreateSignal, createEffect as CreateEffect, createMemo as CreateMemo, createRoot as CreateRoot, runWithOwner as RunWithOwner, Setter } from "./0.4.1/dist/types/signals";
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
createRoot,
|
||||
runWithOwner,
|
||||
onCleanup,
|
||||
} from "./v0.3.2/script.js";
|
||||
} from "./0.4.1/dist/prod.js";
|
||||
|
||||
let effectCount = 0;
|
||||
|
||||
@@ -75,7 +75,7 @@ const signals = {
|
||||
createSignal(initialValue, options) {
|
||||
const [get, set] = this.createSolidSignal(
|
||||
/** @type {any} */ (initialValue),
|
||||
options
|
||||
options,
|
||||
);
|
||||
|
||||
// @ts-ignore
|
||||
@@ -94,7 +94,7 @@ const signals = {
|
||||
typeof save.keyPrefix === "string"
|
||||
? save.keyPrefix
|
||||
: save.keyPrefix()
|
||||
}-${paramKey}`
|
||||
}-${paramKey}`,
|
||||
);
|
||||
|
||||
let serialized = /** @type {string | null} */ (null);
|
||||
@@ -116,7 +116,7 @@ const signals = {
|
||||
try {
|
||||
serialized = localStorage.getItem(storageKey);
|
||||
set(() =>
|
||||
serialized ? save.deserialize(serialized) : initialValue
|
||||
serialized ? save.deserialize(serialized) : initialValue,
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ function writeParam(key, value) {
|
||||
window.history.replaceState(
|
||||
null,
|
||||
"",
|
||||
`${window.location.pathname}?${urlParams.toString()}`
|
||||
`${window.location.pathname}?${urlParams.toString()}`,
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
URL:
|
||||
https://github.com/leeoniya/uFuzzy/commits/main/dist
|
||||
|
||||
Head:
|
||||
|
||||
- SHA: 6bb27a8d8c41e4be5458844afc5c89f6c2399512
|
||||
- Date: Feb 21, 2024
|
||||
- Version: v1.0.18
|
||||
-1094
File diff suppressed because it is too large
Load Diff
Executable
+410
@@ -0,0 +1,410 @@
|
||||
#!/bin/bash
|
||||
|
||||
# unpkg-downloader.sh - Download complete packages from unpkg.com
|
||||
# Usage: ./unpkg-downloader.sh <package-name> <version> [output-dir]
|
||||
# Example: ./unpkg-downloader.sh "@solidjs/signals" "0.4.1"
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Function to print colored output
|
||||
print_status() {
|
||||
echo -e "${BLUE}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||
}
|
||||
|
||||
print_debug() {
|
||||
if [[ "${DEBUG:-}" == "1" ]]; then
|
||||
echo -e "${YELLOW}[DEBUG]${NC} $1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if required tools are installed
|
||||
check_dependencies() {
|
||||
local missing_deps=()
|
||||
|
||||
if ! command -v curl &> /dev/null; then
|
||||
missing_deps+=("curl")
|
||||
fi
|
||||
|
||||
if ! command -v grep &> /dev/null; then
|
||||
missing_deps+=("grep")
|
||||
fi
|
||||
|
||||
if ! command -v sed &> /dev/null; then
|
||||
missing_deps+=("sed")
|
||||
fi
|
||||
|
||||
if [ ${#missing_deps[@]} -ne 0 ]; then
|
||||
print_error "Missing required dependencies: ${missing_deps[*]}"
|
||||
print_error "Please install them and try again."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to URL encode a string
|
||||
url_encode() {
|
||||
local string="${1}"
|
||||
local strlen=${#string}
|
||||
local encoded=""
|
||||
local pos c o
|
||||
|
||||
for ((pos=0; pos<strlen; pos++)); do
|
||||
c=${string:$pos:1}
|
||||
case "$c" in
|
||||
[-_.~a-zA-Z0-9] ) o="${c}" ;;
|
||||
* ) printf -v o '%%%02x' "'$c"
|
||||
esac
|
||||
encoded+="${o}"
|
||||
done
|
||||
echo "${encoded}"
|
||||
}
|
||||
|
||||
# Function to create directory if it doesn't exist
|
||||
create_dir() {
|
||||
local dir="$1"
|
||||
if [ ! -d "$dir" ]; then
|
||||
mkdir -p "$dir"
|
||||
print_status "Created directory: $dir"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to resolve "latest" version to actual version number
|
||||
resolve_latest_version() {
|
||||
local package_name="$1"
|
||||
local version="$2"
|
||||
|
||||
# If version is not "latest", return as-is
|
||||
if [[ "$version" != "latest" ]]; then
|
||||
echo "$version"
|
||||
return
|
||||
fi
|
||||
|
||||
print_status "Resolving 'latest' version for $package_name..." >&2
|
||||
|
||||
# URL encode the package name
|
||||
local encoded_package=$(url_encode "$package_name")
|
||||
local latest_url="https://app.unpkg.com/${encoded_package}@latest"
|
||||
|
||||
# Use curl to follow redirects and get the final URL
|
||||
local final_url
|
||||
final_url=$(curl -L -s -o /dev/null -w '%{url_effective}' "$latest_url")
|
||||
|
||||
if [[ -z "$final_url" ]]; then
|
||||
print_error "Failed to resolve latest version for $package_name" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Extract version from the final URL
|
||||
# Format: https://app.unpkg.com/@solidjs/signals@0.4.1
|
||||
local resolved_version
|
||||
# Use a different delimiter (#) to avoid issues with / in package names
|
||||
resolved_version=$(echo "$final_url" | sed -n "s#.*${package_name}@\([^\/]*\).*#\1#p")
|
||||
|
||||
if [[ -z "$resolved_version" ]]; then
|
||||
print_error "Could not extract version from URL: $final_url" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
print_success "Resolved 'latest' to version: $resolved_version" >&2
|
||||
echo "$resolved_version"
|
||||
}
|
||||
|
||||
# Function to download a file
|
||||
download_file() {
|
||||
local file_url="$1"
|
||||
local local_path="$2"
|
||||
local dir=$(dirname "$local_path")
|
||||
|
||||
create_dir "$dir"
|
||||
|
||||
print_status "Downloading: $file_url"
|
||||
if curl -L -s -f "$file_url" -o "$local_path"; then
|
||||
print_success "Downloaded: $local_path"
|
||||
return 0
|
||||
else
|
||||
print_error "Failed to download: $file_url"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to parse HTML and extract file/folder links using a much simpler approach
|
||||
parse_directory() {
|
||||
local html_content="$1"
|
||||
local current_path="$2"
|
||||
local package_name="$3"
|
||||
local version="$4"
|
||||
|
||||
print_debug "Parsing directory for path: '$current_path'"
|
||||
|
||||
# The HTML contains the original (unencoded) package name in URLs
|
||||
# So we search for the original package name, not the encoded version
|
||||
|
||||
# Find all links that point to files/folders in this package
|
||||
# Look for the pattern: <a href="...">filename</a> or <a href="...">foldername/</a>
|
||||
local links=$(echo "$html_content" | grep -o '<a href="[^"]*"[^>]*>[^<]*</a>' | grep "${package_name}@${version}/files")
|
||||
|
||||
print_debug "Found $(echo "$links" | wc -l) total links"
|
||||
|
||||
if [[ "${DEBUG:-}" == "1" ]]; then
|
||||
print_debug "All found links:"
|
||||
echo "$links" | while read -r link; do
|
||||
[[ -n "$link" ]] && print_debug " $link"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "$links" | while read -r link_line; do
|
||||
if [[ -z "$link_line" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Extract the href URL
|
||||
local href=$(echo "$link_line" | sed -n 's/.*href="\([^"]*\)".*/\1/p')
|
||||
# Extract the link text (what's between <a> and </a>)
|
||||
local link_text=$(echo "$link_line" | sed -n 's/.*<a[^>]*>\([^<]*\)<\/a>.*/\1/p')
|
||||
|
||||
print_debug "Processing link: href='$href' text='$link_text'"
|
||||
|
||||
# Skip if we couldn't extract both parts
|
||||
if [[ -z "$href" ]] || [[ -z "$link_text" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Skip parent directory links
|
||||
if [[ "$link_text" == "../" ]] || [[ "$link_text" == ".." ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Extract the file/folder path from the URL
|
||||
# URL format: https://app.unpkg.com/@solidjs/signals@0.4.1/files/path/to/item
|
||||
# Note: href contains the original (unencoded) package name
|
||||
local url_path="${href#*${package_name}@${version}/files}"
|
||||
url_path="${url_path#/}" # Remove leading slash
|
||||
|
||||
print_debug "URL path extracted: '$url_path'"
|
||||
|
||||
# Skip if this is not a direct child of current directory
|
||||
if [[ -n "$current_path" ]]; then
|
||||
# We're in a subdirectory, so the URL path should start with current_path
|
||||
local current_clean="${current_path#/}"
|
||||
if [[ "$url_path" != "${current_clean}"* ]]; then
|
||||
print_debug "Skipping - not in current path"
|
||||
continue
|
||||
fi
|
||||
# Get the relative path from current directory
|
||||
local relative_path="${url_path#${current_clean}}"
|
||||
relative_path="${relative_path#/}"
|
||||
else
|
||||
# We're in root, so relative_path is the same as url_path
|
||||
local relative_path="$url_path"
|
||||
fi
|
||||
|
||||
print_debug "Relative path: '$relative_path'"
|
||||
|
||||
# Skip if this contains subdirectories (we only want direct children)
|
||||
if [[ "$relative_path" == *"/"* ]]; then
|
||||
print_debug "Skipping - contains subdirectories"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Skip empty paths
|
||||
if [[ -z "$relative_path" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Determine if it's a folder or file based on the link text
|
||||
if [[ "$link_text" == *"/" ]]; then
|
||||
# It's a folder
|
||||
local folder_name="${relative_path%/}"
|
||||
if [[ -n "$current_path" ]]; then
|
||||
echo "FOLDER:${current_path}/${folder_name}"
|
||||
else
|
||||
echo "FOLDER:/${folder_name}"
|
||||
fi
|
||||
else
|
||||
# It's a file
|
||||
if [[ -n "$current_path" ]]; then
|
||||
echo "FILE:${current_path}/${relative_path}"
|
||||
else
|
||||
echo "FILE:/${relative_path}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Function to check if item was already processed
|
||||
is_processed() {
|
||||
local item="$1"
|
||||
local processed_list="$2"
|
||||
|
||||
[[ "$processed_list" == *"|${item}|"* ]]
|
||||
}
|
||||
|
||||
# Function to add item to processed list
|
||||
add_processed() {
|
||||
local item="$1"
|
||||
local processed_list="$2"
|
||||
|
||||
echo "${processed_list}|${item}|"
|
||||
}
|
||||
|
||||
# Function to process a directory (download files and recurse into subdirectories)
|
||||
process_directory() {
|
||||
local package_name="$1"
|
||||
local version="$2"
|
||||
local dir_path="$3"
|
||||
local output_dir="$4"
|
||||
local processed_dirs="$5"
|
||||
|
||||
# Encode the package name for URL
|
||||
local encoded_package=$(url_encode "$package_name")
|
||||
local app_url="https://app.unpkg.com/${encoded_package}@${version}/files${dir_path}"
|
||||
local download_base_url="https://unpkg.com/${encoded_package}@${version}"
|
||||
|
||||
# Check if we've already processed this directory
|
||||
if is_processed "$dir_path" "$processed_dirs"; then
|
||||
print_warning "Already processed directory: $dir_path"
|
||||
return
|
||||
fi
|
||||
|
||||
print_status "Processing directory: ${dir_path:-'(root)'}"
|
||||
print_status "Fetching: $app_url"
|
||||
|
||||
# Download the directory listing HTML
|
||||
local html_content
|
||||
if ! html_content=$(curl -L -s -f "$app_url"); then
|
||||
print_error "Failed to fetch directory listing: $app_url"
|
||||
return
|
||||
fi
|
||||
|
||||
print_status "Fetched HTML content (${#html_content} characters)"
|
||||
|
||||
# Mark this directory as processed
|
||||
processed_dirs=$(add_processed "$dir_path" "$processed_dirs")
|
||||
|
||||
# Parse the HTML to find files and folders
|
||||
local items
|
||||
items=$(parse_directory "$html_content" "$dir_path" "$package_name" "$version")
|
||||
|
||||
print_debug "Parsed items:"
|
||||
print_debug "$items"
|
||||
|
||||
# Collect unique files and folders
|
||||
local files=()
|
||||
local folders=()
|
||||
local seen_files=""
|
||||
local seen_folders=""
|
||||
|
||||
while IFS= read -r item; do
|
||||
[[ -z "$item" ]] && continue
|
||||
|
||||
if [[ "$item" == FILE:* ]]; then
|
||||
local file_path="${item#FILE:}"
|
||||
if ! is_processed "$file_path" "$seen_files"; then
|
||||
files+=("$file_path")
|
||||
seen_files=$(add_processed "$file_path" "$seen_files")
|
||||
print_debug "Added file: $file_path"
|
||||
fi
|
||||
elif [[ "$item" == FOLDER:* ]]; then
|
||||
local folder_path="${item#FOLDER:}"
|
||||
if ! is_processed "$folder_path" "$seen_folders"; then
|
||||
folders+=("$folder_path")
|
||||
seen_folders=$(add_processed "$folder_path" "$seen_folders")
|
||||
print_debug "Added folder: $folder_path"
|
||||
fi
|
||||
fi
|
||||
done <<< "$items"
|
||||
|
||||
print_status "Found ${#files[@]} files and ${#folders[@]} folders"
|
||||
|
||||
# Download all files in this directory
|
||||
for file_path in "${files[@]}"; do
|
||||
if [[ -n "$file_path" ]]; then
|
||||
local file_url="${download_base_url}${file_path}"
|
||||
local local_path="${output_dir}${file_path}"
|
||||
download_file "$file_url" "$local_path"
|
||||
fi
|
||||
done
|
||||
|
||||
# Recursively process all folders
|
||||
for folder_path in "${folders[@]}"; do
|
||||
if [[ -n "$folder_path" ]]; then
|
||||
process_directory "$package_name" "$version" "$folder_path" "$output_dir" "$processed_dirs"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
# Check dependencies
|
||||
check_dependencies
|
||||
|
||||
# Parse command line arguments
|
||||
if [ $# -lt 1 ] || [ $# -gt 3 ]; then
|
||||
echo "Usage: $0 <package-name> [version] [output-dir]"
|
||||
echo "Example: $0 \"@solidjs/signals\""
|
||||
echo "Example: $0 \"@solidjs/signals\" \"0.4.1\""
|
||||
echo "Example: $0 \"@solidjs/signals\" \"latest\""
|
||||
echo "Example: $0 \"@solidjs/signals\" \"latest\" \"./downloads\""
|
||||
echo "Example: $0 \"lodash\" \"4.17.21\" \"./downloads\""
|
||||
echo ""
|
||||
echo "Version defaults to 'latest' if not specified"
|
||||
echo "Set DEBUG=1 environment variable for verbose output"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local package_name="$1"
|
||||
local version="${2:-latest}"
|
||||
|
||||
# Resolve latest version if needed (do this once at the start)
|
||||
local resolved_version
|
||||
if ! resolved_version=$(resolve_latest_version "$package_name" "$version"); then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Use resolved version for output directory
|
||||
local output_dir="${3:-./$(echo "${package_name}" | sed 's/@//g' | sed 's/\//-/g')/${resolved_version}}"
|
||||
|
||||
print_status "Starting download of package: $package_name@$version"
|
||||
if [[ "$version" == "latest" ]]; then
|
||||
print_status "Resolved to actual version: $resolved_version"
|
||||
fi
|
||||
print_status "Output directory: $output_dir"
|
||||
|
||||
# Check if the directory already exists and has content
|
||||
if [[ -d "$output_dir" ]] && [[ -n "$(ls -A "$output_dir" 2>/dev/null)" ]]; then
|
||||
print_error "Directory already exists and is not empty: $output_dir"
|
||||
print_error "Package $package_name@$resolved_version appears to already be downloaded."
|
||||
print_error "Remove the directory or choose a different output location to proceed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create the base output directory
|
||||
create_dir "$output_dir"
|
||||
|
||||
# Start processing from the root directory using the resolved version
|
||||
process_directory "$package_name" "$resolved_version" "" "$output_dir" ""
|
||||
|
||||
print_success "Package download completed!"
|
||||
print_status "Files downloaded to: $output_dir"
|
||||
}
|
||||
|
||||
# Run the main function with all arguments
|
||||
main "$@"
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
./unpkg.sh "@solidjs/signals"
|
||||
./unpkg.sh "@leeoniya/ufuzzy"
|
||||
./unpkg.sh "lean-qr"
|
||||
./unpkg.sh "lightweight-charts"
|
||||
@@ -3,9 +3,9 @@
|
||||
/**
|
||||
* @import { Option, PartialChartOption, ChartOption, AnyPartialOption, ProcessedOptionAddons, OptionsTree, SimulationOption, AnySeriesBlueprint, SeriesType } from "./options"
|
||||
* @import { Valued, SingleValueData, CandlestickData, OHLCTuple, Series, ISeries, LineData, BaselineData, PartialLineStyleOptions, PartialBaselineStyleOptions, PartialCandlestickStyleOptions } from "../packages/lightweight-charts/wrapper"
|
||||
* @import * as _ from "../packages/ufuzzy/v1.0.18/types"
|
||||
* @import * as _ from "../packages/leeoniya-ufuzzy/1.0.18/dist/uFuzzy.d.ts"
|
||||
* @import { SerializedChartableIndex } from "./chart";
|
||||
* @import { Signal, Signals, Accessor } from "../packages/solid-signals/wrapper";
|
||||
* @import { Signal, Signals, Accessor } from "../packages/solidjs-signals/wrapper";
|
||||
* @import { DateIndex, DecadeIndex, DifficultyEpoch, Index, HalvingEpoch, Height, MonthIndex, P2PK33AddressIndex, P2PK65AddressIndex, P2PKHAddressIndex, P2SHAddressIndex, P2MSOutputIndex, P2AAddressIndex, P2TRAddressIndex, P2WPKHAddressIndex, P2WSHAddressIndex, TxIndex, InputIndex, OutputIndex, VecId, WeekIndex, SemesterIndex, YearIndex, VecIdToIndexes, QuarterIndex, EmptyOutputIndex, OpReturnIndex, UnknownOutputIndex } from "./vecid-to-indexes"
|
||||
*/
|
||||
|
||||
@@ -63,7 +63,7 @@ const localhost = window.location.hostname === "localhost";
|
||||
function initPackages() {
|
||||
const imports = {
|
||||
async signals() {
|
||||
return import("../packages/solid-signals/wrapper.js").then(
|
||||
return import("../packages/solidjs-signals/wrapper.js").then(
|
||||
(d) => d.default,
|
||||
);
|
||||
},
|
||||
@@ -75,10 +75,10 @@ function initPackages() {
|
||||
);
|
||||
},
|
||||
async leanQr() {
|
||||
return import("../packages/lean-qr/v2.5.0/script.js").then((d) => d);
|
||||
return import("../packages/lean-qr/2.5.0/index.mjs").then((d) => d);
|
||||
},
|
||||
async ufuzzy() {
|
||||
return import("../packages/ufuzzy/v1.0.18/script.js").then(
|
||||
return import("../packages/leeoniya-ufuzzy/1.0.18/dist/uFuzzy.mjs").then(
|
||||
({ default: d }) => d,
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user