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>
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
|
|
const Module = require('module');
|
|
const path = require('path');
|
|
|
|
// borrowed from babel-eslint
|
|
/** @type {(filename: string) => Module} */
|
|
function createModule(filename) {
|
|
const mod = new Module(filename);
|
|
mod.filename = filename;
|
|
// @ts-expect-error _nodeModulesPaths are undocumented
|
|
mod.paths = Module._nodeModulePaths(path.dirname(filename));
|
|
return mod;
|
|
}
|
|
|
|
/** @type {import('./module-require').default} */
|
|
exports.default = function moduleRequire(p) {
|
|
try {
|
|
// attempt to get espree relative to eslint
|
|
const eslintPath = require.resolve('eslint');
|
|
const eslintModule = createModule(eslintPath);
|
|
// @ts-expect-error _resolveFilename is undocumented
|
|
return require(Module._resolveFilename(p, eslintModule));
|
|
} catch (err) { /* ignore */ }
|
|
|
|
try {
|
|
// try relative to entry point
|
|
// @ts-expect-error TODO: figure out what this is
|
|
return require.main.require(p);
|
|
} catch (err) { /* ignore */ }
|
|
|
|
// finally, try from here
|
|
return require(p);
|
|
};
|