@vixt/react 0.4.1 → 0.4.2
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/dist/index.mjs +8 -8
- package/package.json +3 -3
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(
|
|
160
|
-
const {
|
|
161
|
-
const
|
|
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:
|
|
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
|
|
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(
|
|
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.
|
|
4
|
+
"version": "0.4.2",
|
|
5
5
|
"author": "SoulLyoko<https://github.com/SoulLyoko>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/SoulLyoko/vixt#readme",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@types/react": "^19.1.5",
|
|
22
22
|
"@types/react-dom": "^19.1.5",
|
|
23
|
-
"@vitejs/plugin-react": "^4.
|
|
23
|
+
"@vitejs/plugin-react": "^4.5.0",
|
|
24
24
|
"ahooks": "^3.8.5",
|
|
25
25
|
"extract-comments": "^1.1.0",
|
|
26
26
|
"fast-glob": "^3.3.3",
|
|
@@ -33,7 +33,7 @@
|
|
|
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.
|
|
36
|
+
"@vixt/core": "0.4.2"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "unbuild",
|