@initx-plugin/core 0.0.14 → 0.0.16

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.
Files changed (2) hide show
  1. package/dist/index.mjs +7 -6
  2. package/package.json +1 -2
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path';
2
+ import fs from 'fs-extra';
2
3
  import { c } from '@initx-plugin/utils';
3
- import { readdirSync, existsSync, readFileSync } from 'fs-extra';
4
4
 
5
5
  class InitxHandler {
6
6
  run(options, ...others) {
@@ -79,20 +79,21 @@ class InitxHandler {
79
79
  }
80
80
 
81
81
  async function loadPlugins() {
82
- const { stdout: npmPath } = await c("npm", ["config", "get", "prefix"]);
82
+ const { content: npmPath } = await c("npm", ["config", "get", "prefix"]);
83
83
  const nodeModules = path.join(npmPath, "node_modules");
84
- const communityPlugins = readdirSync(nodeModules);
84
+ const communityPlugins = fs.readdirSync(nodeModules);
85
85
  const officialPluginPath = path.join(nodeModules, "@initx-plugin");
86
- const officialPlugins = existsSync(officialPluginPath) ? readdirSync(officialPluginPath).map((name) => `@initx-plugin/${name}`) : [];
86
+ const officialPlugins = fs.existsSync(officialPluginPath) ? fs.readdirSync(officialPluginPath).map((name) => `@initx-plugin/${name}`) : [];
87
87
  const pluginsName = [
88
88
  ...officialPlugins,
89
89
  ...communityPlugins
90
90
  ].filter(
91
91
  (name) => /^(?:@initx-plugin\/|initx-plugin-)/.test(name) && !/@initx-plugin\/(?:core|utils)$/.test(name)
92
92
  );
93
+ const x = await import('importx');
93
94
  return Promise.all(pluginsName.map(async (dirname) => {
94
- const InitxHandlerClass = await import('importx').then((x) => x.import(path.join(nodeModules, dirname), import.meta.url)).then((x) => x.default);
95
- const packageAll = JSON.parse(readFileSync(path.join(nodeModules, dirname, "package.json"), "utf-8"));
95
+ const InitxHandlerClass = await x.import(path.join(nodeModules, dirname), import.meta.url).then((x2) => x2.default);
96
+ const packageAll = JSON.parse(fs.readFileSync(path.join(nodeModules, dirname, "package.json"), "utf-8"));
96
97
  const packageInfo = {
97
98
  name: packageAll.name,
98
99
  version: packageAll.version,
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@initx-plugin/core",
3
3
  "type": "module",
4
- "version": "0.0.14",
4
+ "version": "0.0.16",
5
5
  "description": "core module for initx plugins",
6
- "author": "imba97",
7
6
  "license": "MIT",
8
7
  "homepage": "https://github.com/initx-collective/initx#readme",
9
8
  "repository": {