first commit
This commit is contained in:
38
node_modules/is-bun-module/dist/bun.mjs
generated
vendored
Normal file
38
node_modules/is-bun-module/dist/bun.mjs
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
// 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
|
||||
};
|
||||
44
node_modules/is-bun-module/dist/generic.d.ts
generated
vendored
Normal file
44
node_modules/is-bun-module/dist/generic.d.ts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { BunVersion } from './shared';
|
||||
export { BunVersion, MINIMUM_BUN_VERSION } from './shared';
|
||||
|
||||
/**
|
||||
* Checks if the given module name is a native Bun module.
|
||||
* @param moduleName - The name of the module to check
|
||||
* @param bunVersion - Optional. The Bun version to check against. Defaults to the current Bun version if available, otherwise "latest".
|
||||
* @returns `true` if the module is a Bun module, `false` otherwise
|
||||
*/
|
||||
declare function isBunModule(moduleName: string, bunVersion?: BunVersion): boolean;
|
||||
/**
|
||||
* Checks if the given module name is a Node.js module implemented in Bun.
|
||||
* @param moduleName - The name of the module to check
|
||||
* @param bunVersion - Optional. The Bun version to check against. Defaults to the current Bun version if available, otherwise "latest".
|
||||
* @returns `true` if the module is a Node.js module implemented in Bun, `false` otherwise
|
||||
*/
|
||||
declare function isBunImplementedNodeModule(moduleName: string, bunVersion?: BunVersion): boolean;
|
||||
/**
|
||||
* Checks if the given module name is a Bun builtin (either a Bun module or a Node.js module implemented in Bun).
|
||||
* @param moduleName - The name of the module to check
|
||||
* @param bunVersion - Optional. The Bun version to check against. Defaults to the current Bun version if available, otherwise "latest".
|
||||
* @returns `true` if the module is a Bun builtin, `false` otherwise
|
||||
*/
|
||||
declare function isBunBuiltin(moduleName: string, bunVersion?: BunVersion): boolean;
|
||||
/**
|
||||
* Gets a list of all native Bun modules.
|
||||
* @param bunVersion - Optional. The Bun version to check against. Defaults to the current Bun version if available, otherwise "latest".
|
||||
* @returns An array of module names
|
||||
*/
|
||||
declare function getBunModules(bunVersion?: BunVersion): string[];
|
||||
/**
|
||||
* Gets a list of all Node.js modules implemented in Bun.
|
||||
* @param bunVersion - Optional. The Bun version to check against. Defaults to the current Bun version if available, otherwise "latest".
|
||||
* @returns An array of module names
|
||||
*/
|
||||
declare function getBunImplementedNodeModules(bunVersion?: BunVersion): string[];
|
||||
/**
|
||||
* Gets a list of all Bun builtin modules (both Bun modules and Node.js modules implemented in Bun).
|
||||
* @param bunVersion - Optional. The Bun version to check against. Defaults to the current Bun version if available, otherwise "latest".
|
||||
* @returns An array of module names
|
||||
*/
|
||||
declare function getBunBuiltinModules(bunVersion?: BunVersion): string[];
|
||||
|
||||
export { getBunBuiltinModules, getBunImplementedNodeModules, getBunModules, isBunBuiltin, isBunImplementedNodeModule, isBunModule };
|
||||
61
node_modules/is-bun-module/dist/generic.js
generated
vendored
Normal file
61
node_modules/is-bun-module/dist/generic.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/generic.ts
|
||||
var generic_exports = {};
|
||||
__export(generic_exports, {
|
||||
MINIMUM_BUN_VERSION: () => import_shared2.MINIMUM_BUN_VERSION,
|
||||
getBunBuiltinModules: () => getBunBuiltinModules,
|
||||
getBunImplementedNodeModules: () => getBunImplementedNodeModules,
|
||||
getBunModules: () => getBunModules,
|
||||
isBunBuiltin: () => isBunBuiltin,
|
||||
isBunImplementedNodeModule: () => isBunImplementedNodeModule,
|
||||
isBunModule: () => isBunModule
|
||||
});
|
||||
module.exports = __toCommonJS(generic_exports);
|
||||
var import_shared = require("./shared");
|
||||
var import_shared2 = require("./shared");
|
||||
function isBunModule(moduleName, bunVersion) {
|
||||
return (0, import_shared.checkModule)(moduleName, import_shared.bundledBunModules, bunVersion != null ? bunVersion : "latest");
|
||||
}
|
||||
function isBunImplementedNodeModule(moduleName, bunVersion) {
|
||||
return (0, import_shared.checkModule)(moduleName, import_shared.implementedNodeModules, bunVersion != null ? bunVersion : "latest");
|
||||
}
|
||||
function isBunBuiltin(moduleName, bunVersion) {
|
||||
return isBunModule(moduleName, bunVersion) || isBunImplementedNodeModule(moduleName, bunVersion);
|
||||
}
|
||||
function getBunModules(bunVersion) {
|
||||
return (0, import_shared.getModules)(import_shared.bundledBunModules, bunVersion != null ? bunVersion : "latest");
|
||||
}
|
||||
function getBunImplementedNodeModules(bunVersion) {
|
||||
return (0, import_shared.getModules)(import_shared.implementedNodeModules, bunVersion != null ? bunVersion : "latest");
|
||||
}
|
||||
function getBunBuiltinModules(bunVersion) {
|
||||
return [...getBunModules(bunVersion), ...getBunImplementedNodeModules(bunVersion)];
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
MINIMUM_BUN_VERSION,
|
||||
getBunBuiltinModules,
|
||||
getBunImplementedNodeModules,
|
||||
getBunModules,
|
||||
isBunBuiltin,
|
||||
isBunImplementedNodeModule,
|
||||
isBunModule
|
||||
});
|
||||
164
node_modules/is-bun-module/dist/shared.d.ts
generated
vendored
Normal file
164
node_modules/is-bun-module/dist/shared.d.ts
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
var bun = true;
|
||||
var bunModules = {
|
||||
bun: bun,
|
||||
"bun:ffi": true,
|
||||
"bun:jsc": true,
|
||||
"bun:sqlite": true,
|
||||
"bun:test": true,
|
||||
"bun:wrap": true
|
||||
};
|
||||
|
||||
var assert = true;
|
||||
var async_hooks = true;
|
||||
var buffer = true;
|
||||
var child_process = true;
|
||||
var constants = true;
|
||||
var cluster = ">= 1.1.25";
|
||||
var console = true;
|
||||
var crypto = true;
|
||||
var dgram = ">= 1.1.6";
|
||||
var diagnostics_channel = true;
|
||||
var dns = true;
|
||||
var domain = true;
|
||||
var events = true;
|
||||
var fs = true;
|
||||
var http = true;
|
||||
var http2 = ">= 1.0.13";
|
||||
var https = true;
|
||||
var module = true;
|
||||
var net = true;
|
||||
var os = true;
|
||||
var path = true;
|
||||
var perf_hooks = true;
|
||||
var process = true;
|
||||
var punycode = true;
|
||||
var querystring = true;
|
||||
var readline = true;
|
||||
var stream = true;
|
||||
var string_decoder = true;
|
||||
var sys = true;
|
||||
var timers = true;
|
||||
var tls = true;
|
||||
var tty = true;
|
||||
var url = true;
|
||||
var util = true;
|
||||
var v8 = true;
|
||||
var vm = true;
|
||||
var wasi = true;
|
||||
var worker_threads = true;
|
||||
var zlib = true;
|
||||
var implementedNodeModules = {
|
||||
assert: assert,
|
||||
"assert/strict": true,
|
||||
"node:assert": true,
|
||||
"node:assert/strict": true,
|
||||
async_hooks: async_hooks,
|
||||
"node:async_hooks": true,
|
||||
"async_hooks/async_context": true,
|
||||
buffer: buffer,
|
||||
"node:buffer": true,
|
||||
child_process: child_process,
|
||||
"node:child_process": true,
|
||||
constants: constants,
|
||||
"node:constants": true,
|
||||
cluster: cluster,
|
||||
"node:cluster": ">= 1.1.25",
|
||||
console: console,
|
||||
"node:console": true,
|
||||
crypto: crypto,
|
||||
"node:crypto": true,
|
||||
dgram: dgram,
|
||||
"node:dgram": ">= 1.1.6",
|
||||
diagnostics_channel: diagnostics_channel,
|
||||
"node:diagnostics_channel": true,
|
||||
dns: dns,
|
||||
"dns/promises": true,
|
||||
"node:dns": true,
|
||||
"node:dns/promises": true,
|
||||
domain: domain,
|
||||
"node:domain": true,
|
||||
events: events,
|
||||
"node:events": true,
|
||||
fs: fs,
|
||||
"fs/promises": true,
|
||||
"node:fs": true,
|
||||
"node:fs/promises": true,
|
||||
http: http,
|
||||
"node:http": true,
|
||||
http2: http2,
|
||||
"node:http2": ">= 1.0.13",
|
||||
https: https,
|
||||
"node:https": true,
|
||||
module: module,
|
||||
"node:module": true,
|
||||
net: net,
|
||||
"node:net": true,
|
||||
os: os,
|
||||
"node:os": true,
|
||||
path: path,
|
||||
"path/posix": true,
|
||||
"path/win32": true,
|
||||
"node:path": true,
|
||||
"node:path/posix": true,
|
||||
"node:path/win32": true,
|
||||
perf_hooks: perf_hooks,
|
||||
"node:perf_hooks": true,
|
||||
process: process,
|
||||
"node:process": true,
|
||||
punycode: punycode,
|
||||
"node:punycode": true,
|
||||
querystring: querystring,
|
||||
"node:querystring": true,
|
||||
readline: readline,
|
||||
"readline/promises": true,
|
||||
"node:readline": true,
|
||||
"node:readline/promises": true,
|
||||
stream: stream,
|
||||
"stream/consumers": true,
|
||||
"stream/promises": true,
|
||||
"stream/web": true,
|
||||
"node:stream": true,
|
||||
"node:stream/consumers": true,
|
||||
"node:stream/promises": true,
|
||||
"node:stream/web": true,
|
||||
string_decoder: string_decoder,
|
||||
"node:string_decoder": true,
|
||||
sys: sys,
|
||||
"node:sys": true,
|
||||
timers: timers,
|
||||
"timers/promises": true,
|
||||
"node:timers": true,
|
||||
"node:timers/promises": true,
|
||||
tls: tls,
|
||||
"node:tls": true,
|
||||
tty: tty,
|
||||
"node:tty": true,
|
||||
url: url,
|
||||
"node:url": true,
|
||||
util: util,
|
||||
"util/types": true,
|
||||
"node:util": true,
|
||||
"node:util/types": true,
|
||||
v8: v8,
|
||||
"node:v8": true,
|
||||
vm: vm,
|
||||
"node:vm": true,
|
||||
wasi: wasi,
|
||||
"node:wasi": true,
|
||||
worker_threads: worker_threads,
|
||||
"node:worker_threads": true,
|
||||
zlib: zlib,
|
||||
"node:zlib": true,
|
||||
"node:test": ">=1.2.6"
|
||||
};
|
||||
|
||||
type SemVerBaseStringified = `${bigint}.${bigint}.${bigint}`;
|
||||
type SemVerStringifiedWithReleaseName = `${SemVerBaseStringified}-${string}`;
|
||||
type SemVerStringified = SemVerBaseStringified | SemVerStringifiedWithReleaseName;
|
||||
type BunVersion = SemVerStringified | "latest";
|
||||
type Modules = Record<string, string | boolean>;
|
||||
declare const MINIMUM_BUN_VERSION = "1.0.0";
|
||||
declare function checkModule(moduleName: string, modules: Modules, bunVersion: BunVersion): boolean;
|
||||
declare function getModules(modules: Modules, bunVersion?: BunVersion): string[];
|
||||
|
||||
export { type BunVersion, MINIMUM_BUN_VERSION, type Modules, bunModules as bundledBunModules, checkModule, getModules, implementedNodeModules };
|
||||
197
node_modules/is-bun-module/dist/shared.js
generated
vendored
Normal file
197
node_modules/is-bun-module/dist/shared.js
generated
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/shared.ts
|
||||
var shared_exports = {};
|
||||
__export(shared_exports, {
|
||||
MINIMUM_BUN_VERSION: () => MINIMUM_BUN_VERSION,
|
||||
bundledBunModules: () => bun_modules_default,
|
||||
checkModule: () => checkModule,
|
||||
getModules: () => getModules,
|
||||
implementedNodeModules: () => implemented_node_modules_default
|
||||
});
|
||||
module.exports = __toCommonJS(shared_exports);
|
||||
var import_valid = __toESM(require("semver/functions/valid"));
|
||||
var import_satisfies = __toESM(require("semver/functions/satisfies"));
|
||||
var import_lt = __toESM(require("semver/functions/lt"));
|
||||
|
||||
// src/assets/bun-modules.json
|
||||
var bun_modules_default = {
|
||||
bun: true,
|
||||
"bun:ffi": true,
|
||||
"bun:jsc": true,
|
||||
"bun:sqlite": true,
|
||||
"bun:test": true,
|
||||
"bun:wrap": true
|
||||
};
|
||||
|
||||
// src/assets/implemented-node-modules.json
|
||||
var implemented_node_modules_default = {
|
||||
assert: true,
|
||||
"assert/strict": true,
|
||||
"node:assert": true,
|
||||
"node:assert/strict": true,
|
||||
async_hooks: true,
|
||||
"node:async_hooks": true,
|
||||
"async_hooks/async_context": true,
|
||||
buffer: true,
|
||||
"node:buffer": true,
|
||||
child_process: true,
|
||||
"node:child_process": true,
|
||||
constants: true,
|
||||
"node:constants": true,
|
||||
cluster: ">= 1.1.25",
|
||||
"node:cluster": ">= 1.1.25",
|
||||
console: true,
|
||||
"node:console": true,
|
||||
crypto: true,
|
||||
"node:crypto": true,
|
||||
dgram: ">= 1.1.6",
|
||||
"node:dgram": ">= 1.1.6",
|
||||
diagnostics_channel: true,
|
||||
"node:diagnostics_channel": true,
|
||||
dns: true,
|
||||
"dns/promises": true,
|
||||
"node:dns": true,
|
||||
"node:dns/promises": true,
|
||||
domain: true,
|
||||
"node:domain": true,
|
||||
events: true,
|
||||
"node:events": true,
|
||||
fs: true,
|
||||
"fs/promises": true,
|
||||
"node:fs": true,
|
||||
"node:fs/promises": true,
|
||||
http: true,
|
||||
"node:http": true,
|
||||
http2: ">= 1.0.13",
|
||||
"node:http2": ">= 1.0.13",
|
||||
https: true,
|
||||
"node:https": true,
|
||||
module: true,
|
||||
"node:module": true,
|
||||
net: true,
|
||||
"node:net": true,
|
||||
os: true,
|
||||
"node:os": true,
|
||||
path: true,
|
||||
"path/posix": true,
|
||||
"path/win32": true,
|
||||
"node:path": true,
|
||||
"node:path/posix": true,
|
||||
"node:path/win32": true,
|
||||
perf_hooks: true,
|
||||
"node:perf_hooks": true,
|
||||
process: true,
|
||||
"node:process": true,
|
||||
punycode: true,
|
||||
"node:punycode": true,
|
||||
querystring: true,
|
||||
"node:querystring": true,
|
||||
readline: true,
|
||||
"readline/promises": true,
|
||||
"node:readline": true,
|
||||
"node:readline/promises": true,
|
||||
stream: true,
|
||||
"stream/consumers": true,
|
||||
"stream/promises": true,
|
||||
"stream/web": true,
|
||||
"node:stream": true,
|
||||
"node:stream/consumers": true,
|
||||
"node:stream/promises": true,
|
||||
"node:stream/web": true,
|
||||
string_decoder: true,
|
||||
"node:string_decoder": true,
|
||||
sys: true,
|
||||
"node:sys": true,
|
||||
timers: true,
|
||||
"timers/promises": true,
|
||||
"node:timers": true,
|
||||
"node:timers/promises": true,
|
||||
tls: true,
|
||||
"node:tls": true,
|
||||
tty: true,
|
||||
"node:tty": true,
|
||||
url: true,
|
||||
"node:url": true,
|
||||
util: true,
|
||||
"util/types": true,
|
||||
"node:util": true,
|
||||
"node:util/types": true,
|
||||
v8: true,
|
||||
"node:v8": true,
|
||||
vm: true,
|
||||
"node:vm": true,
|
||||
wasi: true,
|
||||
"node:wasi": true,
|
||||
worker_threads: true,
|
||||
"node:worker_threads": true,
|
||||
zlib: true,
|
||||
"node:zlib": true,
|
||||
"node:test": ">=1.2.6"
|
||||
};
|
||||
|
||||
// src/shared.ts
|
||||
var MINIMUM_BUN_VERSION = "1.0.0";
|
||||
function checkModule(moduleName, modules, bunVersion) {
|
||||
if (typeof moduleName !== "string") throw new TypeError("Module name must be a string");
|
||||
if (!(moduleName in modules)) return false;
|
||||
const targetBunVersion = toSemVerStringified(bunVersion);
|
||||
if ((0, import_lt.default)(targetBunVersion, MINIMUM_BUN_VERSION)) {
|
||||
throw new RangeError(`Bun version must be at least ${MINIMUM_BUN_VERSION}`);
|
||||
}
|
||||
return satisfiesVersionRange(targetBunVersion, modules[moduleName]);
|
||||
}
|
||||
function getModules(modules, bunVersion) {
|
||||
const targetBunVersion = toSemVerStringified(bunVersion);
|
||||
if ((0, import_lt.default)(targetBunVersion, MINIMUM_BUN_VERSION)) {
|
||||
throw new RangeError(`Bun version must be at least ${MINIMUM_BUN_VERSION}`);
|
||||
}
|
||||
return Object.keys(modules).filter((moduleName) => {
|
||||
return satisfiesVersionRange(targetBunVersion, modules[moduleName]);
|
||||
});
|
||||
}
|
||||
function satisfiesVersionRange(version, versionRange) {
|
||||
if (typeof versionRange === "boolean") return versionRange;
|
||||
return (0, import_satisfies.default)(version, versionRange);
|
||||
}
|
||||
function toSemVerStringified(input) {
|
||||
if (typeof input !== "string") throw new TypeError("Bun version must be a string");
|
||||
if (input === "latest") return "999.999.999";
|
||||
if ((0, import_valid.default)(input)) return input;
|
||||
throw new TypeError("Bun version must be a string like '1.0.0' or 'latest'");
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
MINIMUM_BUN_VERSION,
|
||||
bundledBunModules,
|
||||
checkModule,
|
||||
getModules,
|
||||
implementedNodeModules
|
||||
});
|
||||
Reference in New Issue
Block a user