|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Rev | Line | |
|---|
| [9af201e] | 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | exports.__esModule = true;
|
|---|
| 4 |
|
|---|
| 5 | const Module = require('module');
|
|---|
| 6 | const path = require('path');
|
|---|
| 7 |
|
|---|
| 8 | // borrowed from babel-eslint
|
|---|
| 9 | /** @type {(filename: string) => Module} */
|
|---|
| 10 | function createModule(filename) {
|
|---|
| 11 | const mod = new Module(filename);
|
|---|
| 12 | mod.filename = filename;
|
|---|
| 13 | // @ts-expect-error _nodeModulesPaths are undocumented
|
|---|
| 14 | mod.paths = Module._nodeModulePaths(path.dirname(filename));
|
|---|
| 15 | return mod;
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | /** @type {import('./module-require').default} */
|
|---|
| 19 | exports.default = function moduleRequire(p) {
|
|---|
| 20 | try {
|
|---|
| 21 | // attempt to get espree relative to eslint
|
|---|
| 22 | const eslintPath = require.resolve('eslint');
|
|---|
| 23 | const eslintModule = createModule(eslintPath);
|
|---|
| 24 | // @ts-expect-error _resolveFilename is undocumented
|
|---|
| 25 | return require(Module._resolveFilename(p, eslintModule));
|
|---|
| 26 | } catch (err) { /* ignore */ }
|
|---|
| 27 |
|
|---|
| 28 | try {
|
|---|
| 29 | // try relative to entry point
|
|---|
| 30 | // @ts-expect-error TODO: figure out what this is
|
|---|
| 31 | return require.main.require(p);
|
|---|
| 32 | } catch (err) { /* ignore */ }
|
|---|
| 33 |
|
|---|
| 34 | // finally, try from here
|
|---|
| 35 | return require(p);
|
|---|
| 36 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.