Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
// src/bun.ts
|
|
import { builtinModules } from "node:module";
|
|
import { checkModule, getModules, bundledBunModules, implementedNodeModules } from "./shared";
|
|
import { MINIMUM_BUN_VERSION } from "./shared";
|
|
var currentBunVersion = Bun.version;
|
|
var bunModules = { ...bundledBunModules };
|
|
for (const moduleName of builtinModules) {
|
|
if (moduleName.startsWith("bun:")) {
|
|
bunModules[moduleName] ??= `>=${currentBunVersion}`;
|
|
}
|
|
}
|
|
function isBunModule(moduleName, bunVersion) {
|
|
return checkModule(moduleName, bunModules, bunVersion ?? currentBunVersion);
|
|
}
|
|
function isBunImplementedNodeModule(moduleName, bunVersion) {
|
|
return checkModule(moduleName, implementedNodeModules, bunVersion ?? currentBunVersion);
|
|
}
|
|
function isBunBuiltin(moduleName, bunVersion) {
|
|
return isBunModule(moduleName, bunVersion) || isBunImplementedNodeModule(moduleName, bunVersion);
|
|
}
|
|
function getBunModules(bunVersion) {
|
|
return getModules(bunModules, bunVersion ?? currentBunVersion);
|
|
}
|
|
function getBunImplementedNodeModules(bunVersion) {
|
|
return getModules(implementedNodeModules, bunVersion ?? currentBunVersion);
|
|
}
|
|
function getBunBuiltinModules(bunVersion) {
|
|
return [...getBunModules(bunVersion), ...getBunImplementedNodeModules(bunVersion)];
|
|
}
|
|
export {
|
|
MINIMUM_BUN_VERSION,
|
|
getBunBuiltinModules,
|
|
getBunImplementedNodeModules,
|
|
getBunModules,
|
|
isBunBuiltin,
|
|
isBunImplementedNodeModule,
|
|
isBunModule
|
|
};
|