@vixt/uni 0.5.5 → 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 +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.mjs +48 -10
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
|
+
import { ResolvedConfig } from 'vite';
|
|
2
3
|
import * as _vixt_core from '@vixt/core';
|
|
3
4
|
import { AppOptions, Vixt, PluginOptions as PluginOptions$1, VixtOptions } from '@vixt/core';
|
|
4
5
|
import Pages, { PageMetaDatum } from '@uni-helper/vite-plugin-uni-pages';
|
|
@@ -73,11 +74,27 @@ declare function transformMpRuntime(code: string, id: string): string;
|
|
|
73
74
|
declare function transformH5Runtime(code: string, id: string): string;
|
|
74
75
|
/** 移除路径中的'../' */
|
|
75
76
|
declare function patchNormalizeNodeModules(): void;
|
|
77
|
+
/**
|
|
78
|
+
* 兼容 unocss^66.1.0 小程序平台的css文件后缀名
|
|
79
|
+
* @see https://github.com/dcloudio/uni-app/pull/5605/files
|
|
80
|
+
*/
|
|
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;
|
|
76
93
|
declare const uniPatch: (options?: any) => vite.PluginOption;
|
|
77
94
|
|
|
78
95
|
declare function uniVueUseResolver(): ImportsMap;
|
|
79
96
|
|
|
80
97
|
declare const _default: (options?: _vixt_core.VixtOptions | undefined) => vite.PluginOption;
|
|
81
98
|
|
|
82
|
-
export { appUni, _default as default, generateMainTs, patchNormalizeNodeModules, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
|
|
99
|
+
export { appUni, _default as default, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUnocssGlobalBuildScan, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
|
|
83
100
|
export type { ModuleOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
|
+
import { ResolvedConfig } from 'vite';
|
|
2
3
|
import * as _vixt_core from '@vixt/core';
|
|
3
4
|
import { AppOptions, Vixt, PluginOptions as PluginOptions$1, VixtOptions } from '@vixt/core';
|
|
4
5
|
import Pages, { PageMetaDatum } from '@uni-helper/vite-plugin-uni-pages';
|
|
@@ -73,11 +74,27 @@ declare function transformMpRuntime(code: string, id: string): string;
|
|
|
73
74
|
declare function transformH5Runtime(code: string, id: string): string;
|
|
74
75
|
/** 移除路径中的'../' */
|
|
75
76
|
declare function patchNormalizeNodeModules(): void;
|
|
77
|
+
/**
|
|
78
|
+
* 兼容 unocss^66.1.0 小程序平台的css文件后缀名
|
|
79
|
+
* @see https://github.com/dcloudio/uni-app/pull/5605/files
|
|
80
|
+
*/
|
|
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;
|
|
76
93
|
declare const uniPatch: (options?: any) => vite.PluginOption;
|
|
77
94
|
|
|
78
95
|
declare function uniVueUseResolver(): ImportsMap;
|
|
79
96
|
|
|
80
97
|
declare const _default: (options?: _vixt_core.VixtOptions | undefined) => vite.PluginOption;
|
|
81
98
|
|
|
82
|
-
export { appUni, _default as default, generateMainTs, patchNormalizeNodeModules, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
|
|
99
|
+
export { appUni, _default as default, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUnocssGlobalBuildScan, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
|
|
83
100
|
export type { ModuleOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generateClient, generateCss, generateAppConfig, generatePlugins, defineVixtModule, generateIndexHtml, defineVitePlugin, resolveLayersDirs,
|
|
1
|
+
import { generateClient, generateCss, generateAppConfig, generatePlugins, defineVixtModule, generateIndexHtml, defineVitePlugin, resolveLayersDirs, createVixtPlugin } from '@vixt/core';
|
|
2
2
|
import path from 'pathe';
|
|
3
3
|
import { genarateAppComponent } from '@vixt/vue';
|
|
4
4
|
import fs from 'fs-extra';
|
|
@@ -131,16 +131,55 @@ function patchNormalizeNodeModules() {
|
|
|
131
131
|
fs.writeFileSync(codePath, code);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
+
function patchAdjustCssExtname(config) {
|
|
135
|
+
const plugin = config.plugins.find((p) => p.name === "uni:adjust-css-extname");
|
|
136
|
+
if (plugin && typeof plugin.generateBundle === "function") {
|
|
137
|
+
const handler = plugin.generateBundle;
|
|
138
|
+
plugin.generateBundle = { order: "post", handler };
|
|
139
|
+
}
|
|
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
|
+
}
|
|
134
150
|
const uniPatch = defineVitePlugin(() => {
|
|
135
151
|
patchNormalizeNodeModules();
|
|
136
|
-
return
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
+
}
|
|
166
|
+
},
|
|
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
|
+
}
|
|
142
181
|
}
|
|
143
|
-
|
|
182
|
+
];
|
|
144
183
|
});
|
|
145
184
|
|
|
146
185
|
let _cache;
|
|
@@ -202,7 +241,6 @@ const presetUni = defineVixtModule({
|
|
|
202
241
|
unocss: {}
|
|
203
242
|
};
|
|
204
243
|
const options = vixt.options = defu(vixt.options, defaultOptions);
|
|
205
|
-
patchUnocss();
|
|
206
244
|
const modules = [
|
|
207
245
|
Pages(options.uniPages),
|
|
208
246
|
Layouts(options.uniLayouts),
|
|
@@ -279,4 +317,4 @@ const defaults = {
|
|
|
279
317
|
};
|
|
280
318
|
const index = createVixtPlugin({ defaults });
|
|
281
319
|
|
|
282
|
-
export { appUni, index as default, generateMainTs, 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.
|
|
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.
|
|
37
|
-
"@vixt/vue": "0.5.
|
|
36
|
+
"@vixt/core": "0.5.7",
|
|
37
|
+
"@vixt/vue": "0.5.7"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "unbuild",
|