Skip to content

Instantly share code, notes, and snippets.

View DuCanhGH's full-sized avatar
🙂
Hate going outside

Ngô Đức Anh DuCanhGH

🙂
Hate going outside
View GitHub Profile
@DuCanhGH
DuCanhGH / copy-traced-files.ts
Last active December 17, 2024 06:11
Reimplementing Next.js's Output File Tracing with a custom server
import { nodeFileTrace } from "@vercel/nft";
import { Sema } from "async-sema";
import { glob } from "glob";
import { NextConfigComplete } from "next/dist/server/config-shared";
import fs from "node:fs/promises";
import path from "node:path";
interface RequiredServerFilesManifest {
version: number;
config: NextConfigComplete;
// basically I went insane
// for emergency reasons (thanks orac)
// implemented as if using C because what sort of C++ doesn't support std::string
#ifndef __STRING_HPP
#define __STRING_HPP
#include <cstdlib>
#include <cstring>
#include <limits>
#include <istream>
@DuCanhGH
DuCanhGH / utils_types.ts
Last active October 3, 2023 04:33
utils_types.ts
/**
* Make certain fields in a object type required
*
* @example
* interface A {
* a?: string;
* b?: string;
* c?: string;
* }
* type B = RequireFields<A, "b" | "c">;