This commit is contained in:
2024-11-03 17:16:20 +01:00
commit fd6412d6f2
8090 changed files with 778406 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import path from "node:path";
import { pathToFileURL } from "node:url";
function addTrailingSlash(path) {
if(path.endsWith("/")) {
return path;
}
return path + "/";
}
function getWorkingDirectory() {
// Trailing slash required
// `import` and `require` should both be relative to working directory (not this file)
return addTrailingSlash(pathToFileURL(path.resolve(".")).toString());
}
export { getWorkingDirectory };

23
node_modules/node-retrieve-globals/util/vmModules.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
import vm from "vm";
function isSupported() {
// node --experimental-vm-modules …
if(process.execArgv.find(entry => entry == "--experimental-vm-modules")) {
return true;
}
// NODE_OPTIONS='--experimental-vm-modules' node …
if((process.env?.NODE_OPTIONS || "").split(" ").find(entry => entry == "--experimental-vm-modules")) {
return true;
}
// Feature test for a future when --experimental-vm-modules is not needed
// and vm.Module is stable:
try {
new vm.SourceTextModule(`/* hi */`);
return true;
} catch(e) {}
return false;
}
export { isSupported };