mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
* feat: ship the self-hosted native scriptc CLI - Run the shared compiler and CLI natively, including library builds and compile-time evaluation. - Install native platform packages and ship relocatable standalone distributions. - Preserve program semantics and reuse validated build artifacts for fast rebuilds. * fix: complete native CLI integration and validation - Preserve library diagnostics and run recursive compiler work on the main stack. - Restore packaged helper permissions and exercise native npm and Wasm library builds. - Recover interrupted Sandbox status probes within the original command deadline.
18 lines
806 B
TypeScript
18 lines
806 B
TypeScript
import { createHash, createHmac } from "node:crypto";
|
|
|
|
const environment: Record<string, string | undefined> = { present: "hello" };
|
|
for (const name of ["present", "missing"]) {
|
|
const value = environment[name];
|
|
const text: string = value ?? "";
|
|
console.log(createHash("sha256").update(text).digest("hex"));
|
|
console.log(createHmac("sha256", "secret").update(text).digest("hex"));
|
|
if (value !== undefined) console.log(createHash("sha256").update(value).digest("hex"));
|
|
}
|
|
|
|
const buffers: (Buffer | undefined)[] = [Buffer.from("hello"), undefined];
|
|
for (let index = 0; index < buffers.length; index++) {
|
|
const buffer = buffers[index] ?? Buffer.from("");
|
|
console.log(createHash("sha256").update(buffer).digest("hex"));
|
|
console.log(createHmac("sha256", "secret").update(buffer).digest("hex"));
|
|
}
|