Skip to content
Merged
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
4 changes: 3 additions & 1 deletion crates/perry-api-manifest/src/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2012,10 +2012,12 @@ pub static API_MANIFEST: &[ApiEntry] = &[
method("crypto", "sha256", false, None),
method("crypto", "md5", false, None),
method("crypto", "getRandomValues", false, None),
// crypto.randomFillSync(buffer, offset?, size?) — fills the
// crypto.randomFill(buffer[, offset][, size], callback) /
// randomFillSync(buffer, offset?, size?) — fills the
// typed-array / Buffer with cryptographically strong random
// bytes in-place and returns the same object. Required by
// axios (Uint32Array) for ID generation.
method("crypto", "randomFill", false, None),
method("crypto", "randomFillSync", false, None),
method("crypto", "createHash", false, None),
method("crypto", "createSign", false, None),
Expand Down
13 changes: 13 additions & 0 deletions crates/perry-api-manifest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,19 @@ mod tests {
assert!(matches!(entry.returns, TypeSpec::Bool));
}

#[test]
fn crypto_random_fill_is_manifest_method() {
let entry = module_has_symbol("node:crypto", "randomFill")
.expect("crypto.randomFill should be in the manifest");
assert!(matches!(
entry.kind,
ApiKind::Method {
has_receiver: false,
class_filter: None
}
));
}

#[test]
fn deprecated_constants_alias_has_manifest_entries() {
for name in [
Expand Down
4 changes: 3 additions & 1 deletion docs/api/perry.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Auto-generated from Perry's API manifest (#465). Do not edit by hand.
// Source: perry-api-manifest::API_MANIFEST
// Coverage: 1778 entries across 88 modules
// Coverage: 1779 entries across 88 modules

type PerryU32 = number & { readonly __perryU32?: never };
type PerryU64 = number & { readonly __perryU64?: never };
Expand Down Expand Up @@ -863,6 +863,8 @@ declare module "crypto" {
/** stdlib */
export function randomBytes(...args: any[]): any;
/** stdlib */
export function randomFill(...args: any[]): any;
/** stdlib */
export function randomFillSync(...args: any[]): any;
/** stdlib */
export function randomInt(...args: any[]): any;
Expand Down
3 changes: 2 additions & 1 deletion docs/src/api/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This page is auto-generated from Perry's compile-time API manifest (`perry-api-manifest::API_MANIFEST`). It is the source of truth for what `perry compile` accepts; references to symbols not listed here produce `R005 UnimplementedApi` (issue #463). Stubs (#464) are flagged ⚠ — they link cleanly but no-op at runtime on the chosen target.

Total: 1778 entries across 88 modules.
Total: 1779 entries across 88 modules.

## Modules

Expand Down Expand Up @@ -651,6 +651,7 @@ Total: 1778 entries across 88 modules.
- `publicDecrypt` — module
- `publicEncrypt` — module
- `randomBytes` — module
- `randomFill` — module
- `randomFillSync` — module
- `randomInt` — module
- `randomInt` — module
Expand Down