Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ members = [
"crates/perry-runtime",
"crates/perry-ffi",
"crates/perry-native-registration",
"crates/perry-ext-nanoid",
"crates/perry-ext-bcrypt",
"crates/perry-ext-argon2",
"crates/perry-perex",
Expand Down Expand Up @@ -471,7 +470,6 @@ perry-dispatch = { path = "crates/perry-dispatch" }
perry-runtime = { path = "crates/perry-runtime", version = "0.5.1011", default-features = false }
perry-ffi = { path = "crates/perry-ffi", version = "0.5.1011" }
perry-native-registration = { path = "crates/perry-native-registration", version = "0.5.1534" }
perry-ext-nanoid = { path = "crates/perry-ext-nanoid" }
perry-ext-bcrypt = { path = "crates/perry-ext-bcrypt" }
perry-ext-argon2 = { path = "crates/perry-ext-argon2" }
perry-perex = { path = "crates/perry-perex" }
Expand Down
14 changes: 14 additions & 0 deletions changelog.d/10693-nanoid-native-binding-removal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Removed the native `nanoid` binding: `customAlphabet(alphabet, size)` is
documented to return a generator function, but the native implementation
returned the generated id string directly, so the only documented usage
(`const gen = customAlphabet(...); gen();`) crashed with `TypeError: value
is not a function`. `import { nanoid, customAlphabet } from "nanoid"` (no
`perry.compilePackages` entry) now compiles the real npm package from
source, matching Node exactly.

Deleted both duplicate hand-written implementations
(`crates/perry-ext-nanoid` and `crates/perry-stdlib/src/nanoid.rs`, which
independently exported the same `js_nanoid_*` symbols — #10678).
`customAlphabet` turned out to have no call-site wiring anywhere in
`perry-codegen` at all — only plain `nanoid(size)` had a dispatch row,
consistent with the reported crash.
1 change: 0 additions & 1 deletion crates/perry-api-manifest/src/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ pub const NATIVE_MODULES: &[&str] = &[
"ws", // WebSocket client/server
"zlib", // (Node builtin) gzip/deflate/brotli/zstd compression
"crypto", // (Node builtin) hashing, HMAC, cipher, sign/verify, WebCrypto
"nanoid", // compact URL-safe ID generation
"ethers", // Ethereum library (utils/wallet/ABI)
"mongodb", // MongoDB driver
"better-sqlite3", // synchronous SQLite (replaces the N-API addon)
Expand Down
12 changes: 0 additions & 12 deletions crates/perry-api-manifest/src/entries/part_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,18 +1111,6 @@ pub(crate) const API_MANIFEST_PART_1: &[ApiEntry] = &[
),
method("nodemailer", "sendMail", true, None),
method("nodemailer", "verify", true, None),
method_sig(
"nanoid",
"nanoid",
false,
None,
&[ParamSpec::Named {
name: "size",
ty: TypeSpec::Number,
optional: false,
}],
TypeSpec::String,
),
// #4917 — real retry semantics: options (numOfAttempts/startingDelay/
// timeMultiple/maxDelay/delayFirstAttempt/jitter/retry) honored;
// Promise-returning tasks retry on rejection via promise reactions.
Expand Down
12 changes: 0 additions & 12 deletions crates/perry-codegen/src/lower_call/native_table/utils_crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,6 @@ pub(super) const UTILS_CRYPTO_ROWS: &[NativeModSig] = &[
args: &[],
ret: NR_GCPTR,
},
// ========== nanoid ==========
// js_nanoid_sized(NaN) → size=0 → falls back to js_nanoid() (21-char default),
// so nanoid() and nanoid(N) both route through the same entry safely.
NativeModSig {
module: "nanoid",
has_receiver: false,
method: "nanoid",
class_filter: None,
runtime: "js_nanoid_sized",
args: &[NA_F64],
ret: NR_STR,
},
// ========== exponential-backoff ==========
NativeModSig {
module: "exponential-backoff",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,4 @@ pub(crate) fn declare_data_stores(module: &mut LlModule) {
module.declare_function("js_crypto_x25519_shared_secret", I64, &[I64, I64]);
module.declare_function("js_keccak256_native", I64, &[I64]);
module.declare_function("js_keccak256_native_bytes", I64, &[I64]);

// ========== Nanoid ==========
module.declare_function("js_nanoid", I64, &[DOUBLE]);
module.declare_function("js_nanoid_custom", I64, &[I64, DOUBLE]);
}
20 changes: 0 additions & 20 deletions crates/perry-ext-nanoid/Cargo.toml

This file was deleted.

106 changes: 0 additions & 106 deletions crates/perry-ext-nanoid/src/lib.rs

This file was deleted.

15 changes: 6 additions & 9 deletions crates/perry-stdlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,12 @@ rate-limit = ["bundled-ratelimit"]
bundled-ratelimit = ["dep:governor", "async-runtime"]


# UUID/nanoid — `ids` stays as the umbrella for backwards compat;
# from v0.5.534 onwards the per-binding split (`bundled-uuid` /
# `bundled-nanoid`) is what the well-known bindings flip (#466
# Phase 4 step 2) toggles. Each sub-feature pulls in its own
# optional dep + gates its own module so a wrapper port can strip
# exactly one binding from perry-stdlib without affecting the other.
ids = ["bundled-nanoid"]
bundled-nanoid = ["dep:nanoid"]
# `ids` is now an empty umbrella kept only for backwards compat:
# both members are gone — `bundled-uuid` with the uuid binding
# (#10701) and `bundled-nanoid` with the nanoid binding (#10693).
# Real `uuid` / `nanoid` now compile from npm source, so nothing
# needs to be toggled here; enabling `ids` is a harmless no-op.
ids = []

# Async runtime (tokio) - internal feature
async-runtime = ["dep:tokio"]
Expand Down Expand Up @@ -435,7 +433,6 @@ governor = { version = "0.10", optional = true }
# never optional, regardless of the bundled-uuid npm-binding feature
# (removed; see #10678/#466).
uuid = { version = "1.23", features = ["v4", "v1", "v3", "v5", "v7"] }
nanoid = { version = "0.5", optional = true }

# LRU Cache — optional from v0.5.539 so the well-known flip can
# strip the perry-stdlib copy when `import 'lru-cache'` resolves
Expand Down
15 changes: 5 additions & 10 deletions crates/perry-stdlib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,16 +398,11 @@ pub mod ratelimit;
pub use ratelimit::*;

// === IDs ===
// `bundled-uuid` / `bundled-nanoid` (v0.5.534) replace the old
// `ids` umbrella so the well-known flip (#466 Phase 4) can toggle
// each binding independently. The umbrella stays as
// `ids = ["bundled-uuid", "bundled-nanoid"]` so existing
// `--features ids` callers keep working byte-identically.

#[cfg(feature = "bundled-nanoid")]
pub mod nanoid;
#[cfg(feature = "bundled-nanoid")]
pub use nanoid::*;
// Nothing left to gate: `bundled-uuid` went with the uuid binding
// (#10701) and `bundled-nanoid` with the nanoid binding (#10693);
// real `uuid` / `nanoid` now compile from npm source. The `ids`
// umbrella stays (empty) in Cargo.toml so existing
// `--features ids` callers keep working.

// === Container Module ===
#[cfg(feature = "container")]
Expand Down
62 changes: 0 additions & 62 deletions crates/perry-stdlib/src/nanoid.rs

This file was deleted.

8 changes: 0 additions & 8 deletions crates/perry-ui-android/src/stdlib_stubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1267,14 +1267,6 @@ pub extern "C" fn js_mysql2_pool_query() -> i64 {
0
}
#[no_mangle]
pub extern "C" fn js_nanoid() -> i64 {
0
}
#[no_mangle]
pub extern "C" fn js_nanoid_custom() -> i64 {
0
}
#[no_mangle]
pub extern "C" fn js_new_instance() -> i64 {
0
}
Expand Down
Loading
Loading