@putout/engine-loader 17.0.2 → 17.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/load/async-loader.js +1 -5
- package/lib/load/load.js +1 -6
- package/lib/module.js +11 -0
- package/lib/plugins/load-plugins.js +1 -5
- package/package.json +1 -1
package/lib/load/async-loader.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import {join} from 'node:path';
|
|
3
|
-
import module from 'node:module';
|
|
4
3
|
import tryToCatch from 'try-to-catch';
|
|
4
|
+
import {createRequire} from '../module.js';
|
|
5
5
|
import {simpleImport as _simpleImport} from './simple-import.js';
|
|
6
6
|
|
|
7
|
-
const returns = (a) => () => a;
|
|
8
|
-
const noop = () => {};
|
|
9
|
-
|
|
10
|
-
const {createRequire = returns(noop)} = module;
|
|
11
7
|
const require = createRequire(import.meta.url);
|
|
12
8
|
|
|
13
9
|
const {assign} = Object;
|
package/lib/load/load.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
|
-
import module from 'node:module';
|
|
3
2
|
import {join} from 'node:path';
|
|
4
3
|
import tryCatch from 'try-catch';
|
|
5
|
-
|
|
6
|
-
const returns = (a) => () => a;
|
|
7
|
-
const noop = () => {};
|
|
8
|
-
|
|
9
|
-
const {createRequire: _createRequire = returns(noop)} = module;
|
|
4
|
+
import {createRequire as _createRequire} from '../module.js';
|
|
10
5
|
|
|
11
6
|
const bigFirst = (a) => `${a[0].toUpperCase()}${a.slice(1)}`;
|
|
12
7
|
|
package/lib/module.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import _module from 'node:module';
|
|
2
|
+
|
|
3
|
+
const returns = (a) => () => a;
|
|
4
|
+
const noop = () => {};
|
|
5
|
+
|
|
6
|
+
export const createRequire = (url, overrides = {}) => {
|
|
7
|
+
const {module = _module} = overrides;
|
|
8
|
+
const {createRequire = returns(noop)} = module;
|
|
9
|
+
|
|
10
|
+
return createRequire(url);
|
|
11
|
+
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {createRequire} from '../module.js';
|
|
2
2
|
import validatePlugin from './validate-plugin.js';
|
|
3
3
|
import {prepareRules} from './prepare-rules.js';
|
|
4
4
|
import {isEnabled} from '../rules/index.js';
|
|
5
5
|
import {filterEnabledPlugins} from './filter-enabled-plugins.js';
|
|
6
6
|
import {check, checkRule} from '../check/index.js';
|
|
7
7
|
|
|
8
|
-
const noop = () => {};
|
|
9
|
-
const returns = (a) => () => a;
|
|
10
|
-
|
|
11
|
-
const {createRequire = returns(noop)} = module;
|
|
12
8
|
const {isArray} = Array;
|
|
13
9
|
|
|
14
10
|
export const loadPlugins = (options) => {
|
package/package.json
CHANGED