@vixt/uni 0.5.6 → 0.5.7

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
@@ -138,20 +138,48 @@ function patchAdjustCssExtname(config) {
138
138
  plugin.generateBundle = { order: "post", handler };
139
139
  }
140
140
  }
141
+ function patchUnocssGlobalBuildScan(config) {
142
+ const plugin = config.plugins.find((p) => p.name === "unocss:global:build:scan");
143
+ if (plugin)
144
+ plugin.shouldTransformCachedModule = ({ id }) => id.endsWith("main.ts");
145
+ }
146
+ function patchUniComponents(config) {
147
+ if (JSON.stringify(config.build.watch) === "{}")
148
+ config.build.watch = null;
149
+ }
141
150
  const uniPatch = defineVitePlugin(() => {
142
151
  patchNormalizeNodeModules();
143
- return {
144
- name: "vixt:uni-patch",
145
- enforce: "post",
146
- configResolved(config) {
147
- patchAdjustCssExtname(config);
152
+ return [
153
+ {
154
+ name: "vixt:uni-patch-runtime",
155
+ transform(code, id) {
156
+ code = transformMpRuntime(code, id);
157
+ code = transformH5Runtime(code, id);
158
+ return code;
159
+ }
160
+ },
161
+ {
162
+ name: "vixt:uni-patch-uni-components",
163
+ configResolved(config) {
164
+ patchUniComponents(config);
165
+ }
148
166
  },
149
- transform(code, id) {
150
- code = transformMpRuntime(code, id);
151
- code = transformH5Runtime(code, id);
152
- return code;
167
+ {
168
+ name: "vixt:uni-patch-unocss-global-build-scan",
169
+ apply: "build",
170
+ enforce: "pre",
171
+ configResolved(config) {
172
+ patchUnocssGlobalBuildScan(config);
173
+ }
174
+ },
175
+ {
176
+ name: "vixt:uni-patch-adjust-css-extname",
177
+ enforce: "post",
178
+ configResolved(config) {
179
+ patchAdjustCssExtname(config);
180
+ }
153
181
  }
154
- };
182
+ ];
155
183
  });
156
184
 
157
185
  let _cache;
@@ -289,4 +317,4 @@ const defaults = {
289
317
  };
290
318
  const index = createVixtPlugin({ defaults });
291
319
 
292
- export { appUni, index as default, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
320
+ 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.7",
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.7",
37
+ "@vixt/vue": "0.5.7"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "unbuild",