@vixt/react 0.4.1 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.mjs +8 -8
  2. package/package.json +7 -7
package/dist/index.mjs CHANGED
@@ -7,6 +7,7 @@ import UnoCSS from 'unocss/vite';
7
7
  import AutoImport from 'unplugin-auto-import/vite';
8
8
  import Pages from 'vite-plugin-pages';
9
9
  import Layouts from 'vite-plugin-vue-layouts';
10
+ import { cwd } from 'node:process';
10
11
  import fg from 'fast-glob';
11
12
  import { pascalCase } from 'unplugin-vue-components';
12
13
  import extractComments from 'extract-comments';
@@ -156,19 +157,18 @@ const app = defineVixtModule({
156
157
  }
157
158
  });
158
159
 
159
- function componentsResolver(vixt) {
160
- const { components = [] } = resolveLayersDirs([...vixt._layers].reverse());
161
- const root = vixt.options.rootDir;
162
- const files = fg.sync(components.map((c) => `${c}/**/*.(t|j)sx`), {
160
+ function componentsResolver(options = {}) {
161
+ const { dirs = ["src/components"] } = options;
162
+ const files = fg.sync(dirs.map((c) => `${c}/**/*.(t|j)sx`), {
163
163
  ignore: ["node_modules"],
164
164
  onlyFiles: true,
165
- cwd: root,
165
+ cwd: cwd(),
166
166
  absolute: true
167
167
  });
168
168
  const imports = {};
169
169
  files.forEach((componentPath) => {
170
170
  let componentName = componentPath.replace(/\/index\.(t|j)sx$/, "").replace(/\.(t|j)sx$/, "");
171
- for (const dir of components) {
171
+ for (const dir of dirs) {
172
172
  componentName = componentName.replace(dir, "");
173
173
  }
174
174
  componentName = pascalCase(componentName.replace(/\//g, "-"));
@@ -214,7 +214,7 @@ const name = "vixt:preset-react";
214
214
  const presetReact = defineVixtModule({
215
215
  meta: { name },
216
216
  async setup(_, vixt) {
217
- const { constants = [], hooks = [], layouts = [], pages = [], stores = [], utils = [] } = resolveLayersDirs([...vixt._layers].reverse());
217
+ const { components = [], constants = [], hooks = [], layouts = [], pages = [], stores = [], utils = [] } = resolveLayersDirs([...vixt._layers].reverse());
218
218
  const { buildTypesDir, buildImportsDir } = vixt.options;
219
219
  const defaultOptions = {
220
220
  react: {},
@@ -229,7 +229,7 @@ const presetReact = defineVixtModule({
229
229
  importMode: () => "sync"
230
230
  },
231
231
  imports: {
232
- imports: ["react", "react-router", "ahooks", componentsResolver(vixt)],
232
+ imports: ["react", "react-router", "ahooks", componentsResolver({ dirs: components })],
233
233
  dts: `${buildTypesDir}/auto-imports.d.ts`,
234
234
  dirs: [constants, hooks, stores, utils, buildImportsDir].flat()
235
235
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/react",
3
3
  "type": "module",
4
- "version": "0.4.1",
4
+ "version": "0.4.3",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/SoulLyoko/vixt#readme",
@@ -18,22 +18,22 @@
18
18
  "dist"
19
19
  ],
20
20
  "dependencies": {
21
- "@types/react": "^19.1.5",
22
- "@types/react-dom": "^19.1.5",
23
- "@vitejs/plugin-react": "^4.4.1",
21
+ "@types/react": "^19.1.8",
22
+ "@types/react-dom": "^19.1.6",
23
+ "@vitejs/plugin-react": "^4.6.0",
24
24
  "ahooks": "^3.8.5",
25
25
  "extract-comments": "^1.1.0",
26
26
  "fast-glob": "^3.3.3",
27
27
  "react": "^19.1.0",
28
28
  "react-dom": "^19.1.0",
29
- "react-router": "^7.6.0",
29
+ "react-router": "^7.6.2",
30
30
  "unocss": "66.0.0",
31
- "unplugin-auto-import": "^19.2.0",
31
+ "unplugin-auto-import": "^19.3.0",
32
32
  "unplugin-vue-components": "28.0.0",
33
33
  "vite-plugin-pages": "^0.33.0",
34
34
  "vite-plugin-vue-layouts": "^0.11.0",
35
35
  "yaml": "^2.8.0",
36
- "@vixt/core": "0.4.1"
36
+ "@vixt/core": "0.4.3"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "unbuild",