mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +08:00
- Run production scope and closure capture logic with native TypeScript 7 symbols. - Give lowering caches explicit pass ownership and stable symbol identities. - Support reference collection arrays and optional Set seeds on both native backends.
22 lines
829 B
TypeScript
22 lines
829 B
TypeScript
/// <reference types="node" />
|
|
const baseUrl = process.argv[2]!;
|
|
const base: { init: RequestInit } = { init: { cache: "no-store" } };
|
|
const options: { init: RequestInit } = { ...base, init: { method: "GET" } };
|
|
const response = await fetch(`${baseUrl}/text`, options.init);
|
|
const text: string = await response.text();
|
|
console.log(`${response.status}`, text);
|
|
|
|
let order = "";
|
|
function source(): { init: RequestInit } {
|
|
order += "source";
|
|
return base;
|
|
}
|
|
function replacement(): RequestInit {
|
|
order += ",replacement";
|
|
return { method: "POST", body: "spread body" };
|
|
}
|
|
const copied: { init: RequestInit } = { ...source(), init: replacement() };
|
|
const posted = await fetch(`${baseUrl}/post-echo`, copied.init);
|
|
const body = await posted.json() as { method: string; body: string };
|
|
console.log(order, body.method, body.body);
|