Add initial 11ty website structure

This commit is contained in:
Marc Froehlich
2026-07-06 01:04:06 +02:00
parent 62b6bbdcbc
commit 80214bf42d
1378 changed files with 204162 additions and 0 deletions
+18
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
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 };