// Which files of an installed package the runtime keeps: every file but docs, source maps, // and native addons. Packages read more than their code at runtime (Astro reads .d.ts // templates, CSS, and .astro components out of its own package), so the rule drops only // what nothing loads: Markdown, .map files, and .node addons, which cannot load here, and // whose absence a napi-rs loader takes as its cue to try the package's wasm build. The // kernel installer applies it to every tarball file and src/node/snapshot.ts imports it // under Node's type stripping, so an install and a snapshot keep the same files. Erasable // TypeScript only. const DROPPED = /\.(?:md|markdown|map|node)$/i; /** `name` is the file's basename. `bytes` are its contents. */ export function keepInPackage(name: string, _bytes: Uint8Array): boolean { return !DROPPED.test(name); }