@putout/engine-loader 11.2.0 → 11.3.0

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/README.md CHANGED
@@ -59,6 +59,22 @@ const plugins = loadPlugins({
59
59
  });
60
60
  ```
61
61
 
62
+ #### `import`
63
+
64
+ You can also use schema like this one:
65
+
66
+ ```
67
+ import:escover/plugin
68
+ ```
69
+
70
+ ```js
71
+ const plugins = loadPlugins({
72
+ pluginNames: [
73
+ 'import:commonjs-putout-plugin',
74
+ ],
75
+ });
76
+ ```
77
+
62
78
  ### loadPluginsAsync
63
79
 
64
80
  Load **ESM** plugins:
@@ -14,7 +14,7 @@ module.exports.createAsyncLoader = (type) => nanomemoize(async (name, load) => {
14
14
  if (name.startsWith('import:')) {
15
15
  const shortName = name.replace('import:', '');
16
16
 
17
- return await cleverLoad([shortName], load);
17
+ return await cleverLoad([require.resolve(shortName)], load);
18
18
  }
19
19
 
20
20
  return await cleverLoad([`@putout/${type}-${name}`, `putout-${type}-${name}`], load);
package/lib/load.js CHANGED
@@ -20,6 +20,9 @@ module.exports.loadPlugin = load('plugin');
20
20
  module.exports.loadProcessor = load('processor');
21
21
 
22
22
  function getPath(namespace, type, name) {
23
+ if (name.startsWith('import:'))
24
+ return getModulePath(name.replace('import:', ''));
25
+
23
26
  let [path, customRequire] = getModulePath(`@${namespace}/${type}-${name}`);
24
27
 
25
28
  if (!path)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/engine-loader",
3
- "version": "11.2.0",
3
+ "version": "11.3.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "load plugins and prepare them to run",