@vixt/uni 0.5.6 → 0.5.8

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.d.mts CHANGED
@@ -79,11 +79,22 @@ declare function patchNormalizeNodeModules(): void;
79
79
  * @see https://github.com/dcloudio/uni-app/pull/5605/files
80
80
  */
81
81
  declare function patchAdjustCssExtname(config: ResolvedConfig): void;
82
+ /**
83
+ * fix unocss^66.1.0 hot reload fail `[unocss:global:build:scan] Could not load xxx/src/__uno.css`
84
+ * @see https://github.com/unocss/unocss/issues/4616
85
+ * @see https://github.com/unocss/unocss/pull/4737
86
+ */
87
+ declare function patchUnocssGlobalBuildScan(config: ResolvedConfig): void;
88
+ /**
89
+ * fix `@uni-helper/vite-plugin-uni-components` load slowly
90
+ * @see https://github.com/uni-helper/vite-plugin-uni-components/blob/main/packages/core/src/index.ts#L27
91
+ */
92
+ declare function patchUniComponents(config: ResolvedConfig): void;
82
93
  declare const uniPatch: (options?: any) => vite.PluginOption;
83
94
 
84
95
  declare function uniVueUseResolver(): ImportsMap;
85
96
 
86
97
  declare const _default: (options?: _vixt_core.VixtOptions | undefined) => vite.PluginOption;
87
98
 
88
- export { appUni, _default as default, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
99
+ export { appUni, _default as default, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUnocssGlobalBuildScan, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
89
100
  export type { ModuleOptions };
package/dist/index.d.ts CHANGED
@@ -79,11 +79,22 @@ declare function patchNormalizeNodeModules(): void;
79
79
  * @see https://github.com/dcloudio/uni-app/pull/5605/files
80
80
  */
81
81
  declare function patchAdjustCssExtname(config: ResolvedConfig): void;
82
+ /**
83
+ * fix unocss^66.1.0 hot reload fail `[unocss:global:build:scan] Could not load xxx/src/__uno.css`
84
+ * @see https://github.com/unocss/unocss/issues/4616
85
+ * @see https://github.com/unocss/unocss/pull/4737
86
+ */
87
+ declare function patchUnocssGlobalBuildScan(config: ResolvedConfig): void;
88
+ /**
89
+ * fix `@uni-helper/vite-plugin-uni-components` load slowly
90
+ * @see https://github.com/uni-helper/vite-plugin-uni-components/blob/main/packages/core/src/index.ts#L27
91
+ */
92
+ declare function patchUniComponents(config: ResolvedConfig): void;
82
93
  declare const uniPatch: (options?: any) => vite.PluginOption;
83
94
 
84
95
  declare function uniVueUseResolver(): ImportsMap;
85
96
 
86
97
  declare const _default: (options?: _vixt_core.VixtOptions | undefined) => vite.PluginOption;
87
98
 
88
- export { appUni, _default as default, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
99
+ export { appUni, _default as default, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUnocssGlobalBuildScan, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
89
100
  export type { ModuleOptions };
package/dist/index.mjs CHANGED
@@ -10,6 +10,7 @@ import defu from 'defu';
10
10
  import UnoCSS from 'unocss/vite';
11
11
  import AutoImport from 'unplugin-auto-import/vite';
12
12
  import { resolvePathSync } from 'mlly';
13
+ import { normalizePath } from 'vite';
13
14
  import { readFileSync } from 'node:fs';
14
15
  import process from 'node:process';
15
16
  import { uniuseAutoImports } from '@uni-helper/uni-use';
@@ -138,20 +139,49 @@ function patchAdjustCssExtname(config) {
138
139
  plugin.generateBundle = { order: "post", handler };
139
140
  }
140
141
  }
142
+ function patchUnocssGlobalBuildScan(config) {
143
+ const plugin = config.plugins.find((p) => p.name === "unocss:global:build:scan");
144
+ if (plugin)
145
+ plugin.shouldTransformCachedModule = ({ id }) => id.endsWith("main.ts");
146
+ }
147
+ function patchUniComponents(config) {
148
+ if (JSON.stringify(config.build.watch) === "{}")
149
+ config.build.watch = null;
150
+ }
141
151
  const uniPatch = defineVitePlugin(() => {
142
152
  patchNormalizeNodeModules();
143
- return {
144
- name: "vixt:uni-patch",
145
- enforce: "post",
146
- configResolved(config) {
147
- patchAdjustCssExtname(config);
153
+ return [
154
+ {
155
+ name: "vixt:uni-patch-runtime",
156
+ transform(code, id) {
157
+ id = normalizePath(id);
158
+ code = transformMpRuntime(code, id);
159
+ code = transformH5Runtime(code, id);
160
+ return code;
161
+ }
162
+ },
163
+ {
164
+ name: "vixt:uni-patch-uni-components",
165
+ configResolved(config) {
166
+ patchUniComponents(config);
167
+ }
148
168
  },
149
- transform(code, id) {
150
- code = transformMpRuntime(code, id);
151
- code = transformH5Runtime(code, id);
152
- return code;
169
+ {
170
+ name: "vixt:uni-patch-unocss-global-build-scan",
171
+ apply: "build",
172
+ enforce: "pre",
173
+ configResolved(config) {
174
+ patchUnocssGlobalBuildScan(config);
175
+ }
176
+ },
177
+ {
178
+ name: "vixt:uni-patch-adjust-css-extname",
179
+ enforce: "post",
180
+ configResolved(config) {
181
+ patchAdjustCssExtname(config);
182
+ }
153
183
  }
154
- };
184
+ ];
155
185
  });
156
186
 
157
187
  let _cache;
@@ -289,4 +319,4 @@ const defaults = {
289
319
  };
290
320
  const index = createVixtPlugin({ defaults });
291
321
 
292
- export { appUni, index as default, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
322
+ export { appUni, index as default, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUnocssGlobalBuildScan, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/uni",
3
3
  "type": "module",
4
- "version": "0.5.6",
4
+ "version": "0.5.8",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://soullyoko.github.io/vixt/",
@@ -33,8 +33,8 @@
33
33
  "@uni-helper/vite-plugin-uni-layouts": "^0.1.10",
34
34
  "@uni-helper/vite-plugin-uni-pages": "^0.2.28",
35
35
  "unocss-applet": "^0.10.0",
36
- "@vixt/core": "0.5.6",
37
- "@vixt/vue": "0.5.6"
36
+ "@vixt/core": "0.5.8",
37
+ "@vixt/vue": "0.5.8"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "unbuild",