@vixt/uni 0.11.1 → 0.12.0
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/client/entry.d.ts +1 -2
- package/dist/client/index.d.ts +1 -1
- package/dist/client/plugins/router.d.ts +1 -3
- package/dist/node/index.d.mts +2 -4
- package/dist/node/index.mjs +2 -2
- package/dist/node/modules/preset-uni.d.mts +1 -2
- package/dist/node/modules/preset-uni.mjs +1 -1
- package/dist/node/modules/uni-layouts.d.mts +1 -1
- package/dist/node/modules/uni-modules.d.mts +2 -15
- package/dist/node/modules/uni-patch.d.mts +16 -17
- package/dist/node/modules/uni-patch.mjs +47 -76
- package/dist/node/node.d.mts +4 -1
- package/dist/node/{uni-layouts-B1hWgSc_.d.mts → uni-layouts-DiqR237-.d.mts} +1 -3
- package/dist/node/uni-modules-DKxzU50K.d.mts +13 -0
- package/package.json +22 -8
package/dist/client/entry.d.ts
CHANGED
package/dist/client/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UniVixtApp } from "./client.js";
|
|
2
|
-
export { UniVixtApp };
|
|
2
|
+
export type { UniVixtApp };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import * as _$_vixt_core_client0 from "@vixt/core/client";
|
|
2
|
-
|
|
3
1
|
//#region src/client/plugins/router.d.ts
|
|
4
|
-
declare const _default:
|
|
2
|
+
declare const _default: import("@vixt/core/client").VixtPlugin;
|
|
5
3
|
//#endregion
|
|
6
4
|
export { _default as default };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { UniVixtOptions } from "./node.mjs";
|
|
2
|
-
import * as _$_vixt_core0 from "@vixt/core";
|
|
3
|
-
import * as _$vite from "vite";
|
|
4
2
|
|
|
5
3
|
//#region src/node/index.d.ts
|
|
6
4
|
/** @hidden */
|
|
7
|
-
declare const _default: (options?:
|
|
5
|
+
declare const _default: (options?: import("@vixt/core").VixtOptions | undefined) => import("vite").PluginOption;
|
|
8
6
|
//#endregion
|
|
9
|
-
export { UniVixtOptions, _default as default };
|
|
7
|
+
export { type UniVixtOptions, _default as default };
|
package/dist/node/index.mjs
CHANGED
|
@@ -26,9 +26,9 @@ var node_default = createVixtPlugin({ defaults: {
|
|
|
26
26
|
compilerOptions: { types: [
|
|
27
27
|
"@vixt/uni/types",
|
|
28
28
|
"@dcloudio/types",
|
|
29
|
-
"@uni-helper/uni-
|
|
29
|
+
"@uni-helper/uni-types"
|
|
30
30
|
] },
|
|
31
|
-
vueCompilerOptions: { plugins: ["@uni-helper/uni-
|
|
31
|
+
vueCompilerOptions: { plugins: ["@uni-helper/uni-types/volar-plugin"] }
|
|
32
32
|
} },
|
|
33
33
|
vite: { optimizeDeps: { exclude: plugins } }
|
|
34
34
|
} });
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as _$_vixt_core0 from "@vixt/core";
|
|
2
1
|
import { VixtOptions } from "@vixt/core";
|
|
3
2
|
|
|
4
3
|
//#region src/node/modules/preset-uni.d.ts
|
|
5
|
-
declare const _default:
|
|
4
|
+
declare const _default: import("@vixt/core").VixtModule<VixtOptions>;
|
|
6
5
|
//#endregion
|
|
7
6
|
export { _default as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as _default, t as UniLayoutsOptions } from "../uni-layouts-
|
|
1
|
+
import { n as _default, t as UniLayoutsOptions } from "../uni-layouts-DiqR237-.mjs";
|
|
2
2
|
export { UniLayoutsOptions, _default as default };
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/node/modules/uni-modules.d.ts
|
|
4
|
-
declare module '@vixt/core' {
|
|
5
|
-
interface VixtOptions {
|
|
6
|
-
uniModules?: ModuleOptions;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
interface ModuleOptions {
|
|
10
|
-
include?: string[];
|
|
11
|
-
exclude?: string[];
|
|
12
|
-
}
|
|
13
|
-
declare const _default: _$_vixt_core0.VixtModule<_$_vixt_core0.ModuleOptions>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { ModuleOptions, _default as default };
|
|
1
|
+
import { n as _default, t as UniModulesOptions } from "../uni-modules-DKxzU50K.mjs";
|
|
2
|
+
export { UniModulesOptions, _default as default };
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import * as _$vite from "vite";
|
|
2
1
|
import { ResolvedConfig } from "vite";
|
|
3
2
|
|
|
4
3
|
//#region src/node/modules/uni-patch.d.ts
|
|
4
|
+
/** 移除路径中的'../' */
|
|
5
|
+
declare function overrideNormalizeNodeModules(): void;
|
|
6
|
+
/**
|
|
7
|
+
* fix `@uni-helper/vite-plugin-uni-pages` client types
|
|
8
|
+
* @see https://github.com/uni-helper/vite-plugin-uni-pages/blob/v0.3.24/packages/core/client.d.ts#L4
|
|
9
|
+
*/
|
|
10
|
+
declare function overrideUniPagesTypes(): void;
|
|
5
11
|
/** 增加小程序中vueuse的运行所需 */
|
|
6
12
|
declare function transformMpRuntime(code: string, id: string): string;
|
|
7
13
|
/**
|
|
@@ -11,29 +17,22 @@ declare function transformMpRuntime(code: string, id: string): string;
|
|
|
11
17
|
declare function transformH5Runtime(code: string, id: string): string;
|
|
12
18
|
/** 修复app运行白屏,原因是pinia调用了@vue/devtools-kit的setupDevToolsPlugin */
|
|
13
19
|
declare function transformPinia(code: string, id: string): string;
|
|
14
|
-
/**
|
|
15
|
-
|
|
20
|
+
/**
|
|
21
|
+
* fix `@uni-helper/vite-plugin-uni-components` load slowly
|
|
22
|
+
* @see https://github.com/uni-helper/vite-plugin-uni-components/blob/v0.2.6/packages/core/src/index.ts#L27
|
|
23
|
+
*/
|
|
24
|
+
declare function modifyUniComponentsConfig(config: ResolvedConfig): void;
|
|
16
25
|
/**
|
|
17
26
|
* 兼容 unocss^66.1.0 小程序平台的css文件后缀名
|
|
18
27
|
* @see https://github.com/dcloudio/uni-app/pull/5605/files
|
|
28
|
+
* @fixed 官方已修复
|
|
19
29
|
*/
|
|
20
|
-
declare function patchAdjustCssExtname(config: ResolvedConfig): void;
|
|
21
30
|
/**
|
|
22
31
|
* fix unocss^66.1.0 hot reload fail `[unocss:global:build:scan] Could not load xxx/src/__uno.css`
|
|
23
32
|
* @see https://github.com/unocss/unocss/issues/4616
|
|
24
33
|
* @see https://github.com/unocss/unocss/pull/4737
|
|
34
|
+
* @fixed 官方已修复
|
|
25
35
|
*/
|
|
26
|
-
declare
|
|
27
|
-
/**
|
|
28
|
-
* fix `@uni-helper/vite-plugin-uni-components` load slowly
|
|
29
|
-
* @see https://github.com/uni-helper/vite-plugin-uni-components/blob/main/packages/core/src/index.ts#L27
|
|
30
|
-
*/
|
|
31
|
-
declare function patchUniComponents(config: ResolvedConfig): void;
|
|
32
|
-
/**
|
|
33
|
-
* fix `@uni-helper/vite-plugin-uni-pages` client types
|
|
34
|
-
* @see https://github.com/uni-helper/vite-plugin-uni-pages/blob/main/packages/core/client.d.ts#L4
|
|
35
|
-
*/
|
|
36
|
-
declare function patchUniPagesTypes(): void;
|
|
37
|
-
declare const _default: (options?: any) => _$vite.PluginOption;
|
|
36
|
+
declare const _default: (options?: any) => import("vite").PluginOption;
|
|
38
37
|
//#endregion
|
|
39
|
-
export { _default as default,
|
|
38
|
+
export { _default as default, modifyUniComponentsConfig, overrideNormalizeNodeModules, overrideUniPagesTypes, transformH5Runtime, transformMpRuntime, transformPinia };
|
|
@@ -4,6 +4,31 @@ import { resolvePathSync } from "mlly";
|
|
|
4
4
|
import path from "pathe";
|
|
5
5
|
import { normalizePath } from "vite";
|
|
6
6
|
//#region src/node/modules/uni-patch.ts
|
|
7
|
+
/** 移除路径中的'../' */
|
|
8
|
+
function overrideNormalizeNodeModules() {
|
|
9
|
+
const matched = `str = normalizePath(str).replace(NODE_MODULES_REGEX, 'node-modules');`;
|
|
10
|
+
const replaced = `str = normalizePath(str).replace(NODE_MODULES_REGEX, 'node-modules').replace(/\\.\\.\\//g, '');`;
|
|
11
|
+
const codePath = resolvePathSync("@dcloudio/uni-cli-shared/dist/utils.js");
|
|
12
|
+
let code = fs.readFileSync(codePath, "utf-8");
|
|
13
|
+
if (code.includes(matched)) {
|
|
14
|
+
code = code.replace(matched, replaced);
|
|
15
|
+
fs.writeFileSync(codePath, code);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* fix `@uni-helper/vite-plugin-uni-pages` client types
|
|
20
|
+
* @see https://github.com/uni-helper/vite-plugin-uni-pages/blob/v0.3.24/packages/core/client.d.ts#L4
|
|
21
|
+
*/
|
|
22
|
+
function overrideUniPagesTypes() {
|
|
23
|
+
const matched = ` import type { SubPackage } from './src/config/types/index'\n import type { PageMetaDatum } from './src/types'`;
|
|
24
|
+
const replaced = ` import type { PageMetaDatum, SubPackage } from '@uni-helper/vite-plugin-uni-pages'`;
|
|
25
|
+
const codePath = path.resolve(resolvePathSync("@uni-helper/vite-plugin-uni-pages"), "../../client.d.ts");
|
|
26
|
+
let code = codePath && fs.readFileSync(codePath, "utf-8");
|
|
27
|
+
if (code.includes(matched)) {
|
|
28
|
+
code = code.replace(matched, replaced);
|
|
29
|
+
fs.outputFileSync(codePath, code);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
7
32
|
/** 增加小程序中vueuse的运行所需 */
|
|
8
33
|
function transformMpRuntime(code, id) {
|
|
9
34
|
if (!id.endsWith("@dcloudio/uni-mp-vue/dist/vue.runtime.esm.js")) return code;
|
|
@@ -28,94 +53,40 @@ function transformPinia(code, id) {
|
|
|
28
53
|
code = code.replace(`import { setupDevtoolsPlugin } from '@vue/devtools-api';`, `function setupDevtoolsPlugin() {};`);
|
|
29
54
|
return code;
|
|
30
55
|
}
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (code.includes(matched)) {
|
|
38
|
-
code = code.replace(matched, replaced);
|
|
39
|
-
fs.writeFileSync(codePath, code);
|
|
40
|
-
}
|
|
56
|
+
/**
|
|
57
|
+
* fix `@uni-helper/vite-plugin-uni-components` load slowly
|
|
58
|
+
* @see https://github.com/uni-helper/vite-plugin-uni-components/blob/v0.2.6/packages/core/src/index.ts#L27
|
|
59
|
+
*/
|
|
60
|
+
function modifyUniComponentsConfig(config) {
|
|
61
|
+
if (JSON.stringify(config.build.watch) === "{}") config.build.watch = null;
|
|
41
62
|
}
|
|
42
63
|
/**
|
|
43
64
|
* 兼容 unocss^66.1.0 小程序平台的css文件后缀名
|
|
44
65
|
* @see https://github.com/dcloudio/uni-app/pull/5605/files
|
|
66
|
+
* @fixed 官方已修复
|
|
45
67
|
*/
|
|
46
|
-
function patchAdjustCssExtname(config) {
|
|
47
|
-
const plugin = config.plugins.find((p) => p.name === "uni:adjust-css-extname");
|
|
48
|
-
if (plugin && typeof plugin.generateBundle === "function") plugin.generateBundle = {
|
|
49
|
-
order: "post",
|
|
50
|
-
handler: plugin.generateBundle
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
68
|
/**
|
|
54
69
|
* fix unocss^66.1.0 hot reload fail `[unocss:global:build:scan] Could not load xxx/src/__uno.css`
|
|
55
70
|
* @see https://github.com/unocss/unocss/issues/4616
|
|
56
71
|
* @see https://github.com/unocss/unocss/pull/4737
|
|
72
|
+
* @fixed 官方已修复
|
|
57
73
|
*/
|
|
58
|
-
function patchUnocssGlobalBuildScan(config) {
|
|
59
|
-
const plugin = config.plugins.find((p) => p.name === "unocss:global:build:scan");
|
|
60
|
-
if (plugin) plugin.shouldTransformCachedModule = ({ code }) => code.includes("virtual:uno.css");
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* fix `@uni-helper/vite-plugin-uni-components` load slowly
|
|
64
|
-
* @see https://github.com/uni-helper/vite-plugin-uni-components/blob/main/packages/core/src/index.ts#L27
|
|
65
|
-
*/
|
|
66
|
-
function patchUniComponents(config) {
|
|
67
|
-
if (JSON.stringify(config.build.watch) === "{}") config.build.watch = null;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* fix `@uni-helper/vite-plugin-uni-pages` client types
|
|
71
|
-
* @see https://github.com/uni-helper/vite-plugin-uni-pages/blob/main/packages/core/client.d.ts#L4
|
|
72
|
-
*/
|
|
73
|
-
function patchUniPagesTypes() {
|
|
74
|
-
const matched = ` import type { SubPackage } from './src/config/types/index'\n import type { PageMetaDatum } from './src/types'`;
|
|
75
|
-
const replaced = ` import type { PageMetaDatum, SubPackage } from '@uni-helper/vite-plugin-uni-pages'`;
|
|
76
|
-
const codePath = path.resolve(resolvePathSync("@uni-helper/vite-plugin-uni-pages"), "../../client.d.ts");
|
|
77
|
-
let code = codePath && fs.readFileSync(codePath, "utf-8");
|
|
78
|
-
if (code.includes(matched)) {
|
|
79
|
-
code = code.replace(matched, replaced);
|
|
80
|
-
fs.outputFileSync(codePath, code);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
74
|
var uni_patch_default = defineVitePlugin(() => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return code;
|
|
95
|
-
}
|
|
75
|
+
overrideNormalizeNodeModules();
|
|
76
|
+
overrideUniPagesTypes();
|
|
77
|
+
return {
|
|
78
|
+
name: "vixt:uni-patch",
|
|
79
|
+
transform(code, id) {
|
|
80
|
+
id = normalizePath(id);
|
|
81
|
+
code = transformMpRuntime(code, id);
|
|
82
|
+
code = transformH5Runtime(code, id);
|
|
83
|
+
code = transformPinia(code, id);
|
|
84
|
+
return code;
|
|
96
85
|
},
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
configResolved(config) {
|
|
100
|
-
patchUniComponents(config);
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
name: "vixt:uni-patch-unocss-global-build-scan",
|
|
105
|
-
apply: "build",
|
|
106
|
-
enforce: "pre",
|
|
107
|
-
configResolved(config) {
|
|
108
|
-
patchUnocssGlobalBuildScan(config);
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: "vixt:uni-patch-adjust-css-extname",
|
|
113
|
-
enforce: "post",
|
|
114
|
-
configResolved(config) {
|
|
115
|
-
patchAdjustCssExtname(config);
|
|
116
|
-
}
|
|
86
|
+
configResolved(config) {
|
|
87
|
+
modifyUniComponentsConfig(config);
|
|
117
88
|
}
|
|
118
|
-
|
|
89
|
+
};
|
|
119
90
|
});
|
|
120
91
|
//#endregion
|
|
121
|
-
export { uni_patch_default as default,
|
|
92
|
+
export { uni_patch_default as default, modifyUniComponentsConfig, overrideNormalizeNodeModules, overrideUniPagesTypes, transformH5Runtime, transformMpRuntime, transformPinia };
|
package/dist/node/node.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { t as UniLayoutsOptions } from "./uni-layouts-
|
|
1
|
+
import { t as UniLayoutsOptions } from "./uni-layouts-DiqR237-.mjs";
|
|
2
|
+
import { t as UniModulesOptions } from "./uni-modules-DKxzU50K.mjs";
|
|
2
3
|
import { ExtractPluginOptions } from "@vixt/core";
|
|
3
4
|
import Uni from "@dcloudio/vite-plugin-uni";
|
|
4
5
|
import Components from "@uni-helper/vite-plugin-uni-components";
|
|
@@ -13,6 +14,8 @@ interface UniVixtOptions {
|
|
|
13
14
|
uniLayouts?: UniLayoutsOptions;
|
|
14
15
|
/** https://github.com/uni-helper/vite-plugin-uni-components */
|
|
15
16
|
uniComponents?: ExtractPluginOptions<typeof Components>;
|
|
17
|
+
/** Options for extends `uni-modules` */
|
|
18
|
+
uniModules?: UniModulesOptions;
|
|
16
19
|
}
|
|
17
20
|
declare module '@vixt/core' {
|
|
18
21
|
interface VixtOptions extends UniVixtOptions {}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as _$vite from "vite";
|
|
2
|
-
|
|
3
1
|
//#region src/node/modules/uni-layouts.d.ts
|
|
4
2
|
interface UniLayoutsOptions {
|
|
5
3
|
/**
|
|
@@ -17,6 +15,6 @@ interface UniLayoutsOptions {
|
|
|
17
15
|
*/
|
|
18
16
|
defaultLayout?: string;
|
|
19
17
|
}
|
|
20
|
-
declare const _default: (options?: UniLayoutsOptions | undefined) =>
|
|
18
|
+
declare const _default: (options?: UniLayoutsOptions | undefined) => import("vite").PluginOption;
|
|
21
19
|
//#endregion
|
|
22
20
|
export { _default as n, UniLayoutsOptions as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/node/modules/uni-modules.d.ts
|
|
2
|
+
declare module '@vixt/core' {
|
|
3
|
+
interface VixtOptions {
|
|
4
|
+
uniModules?: UniModulesOptions;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
interface UniModulesOptions {
|
|
8
|
+
include?: string[];
|
|
9
|
+
exclude?: string[];
|
|
10
|
+
}
|
|
11
|
+
declare const _default: import("@vixt/core").VixtModule<import("@vixt/core").ModuleOptions>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { _default as n, UniModulesOptions as t };
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vixt/uni",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"author": "SoulLyoko<https://github.com/SoulLyoko>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://soullyoko.github.io/vixt/",
|
|
8
|
-
"repository":
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/SoulLyoko/vixt.git"
|
|
11
|
+
},
|
|
9
12
|
"keywords": [
|
|
10
13
|
"vixt",
|
|
11
14
|
"vite",
|
|
@@ -24,16 +27,27 @@
|
|
|
24
27
|
"files": [
|
|
25
28
|
"dist"
|
|
26
29
|
],
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@dcloudio/vite-plugin-uni": "*",
|
|
32
|
+
"pinia": "*"
|
|
33
|
+
},
|
|
27
34
|
"dependencies": {
|
|
28
35
|
"@dcloudio/types": "^3.4.28",
|
|
29
|
-
"@uni-helper/uni-
|
|
30
|
-
"@uni-helper/uni-use": "^0.19.17",
|
|
31
|
-
"@uni-helper/unocss-preset-uni": "^0.2.11",
|
|
36
|
+
"@uni-helper/uni-types": "^1.1.0",
|
|
32
37
|
"@uni-helper/vite-plugin-uni-components": "0.2.6",
|
|
33
38
|
"@uni-helper/vite-plugin-uni-layouts": "^0.1.11",
|
|
34
39
|
"@uni-helper/vite-plugin-uni-pages": "^0.3.24",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
40
|
+
"defu": "^6.1.7",
|
|
41
|
+
"fast-glob": "^3.3.3",
|
|
42
|
+
"fs-extra": "^11.3.6",
|
|
43
|
+
"mlly": "^1.8.2",
|
|
44
|
+
"pathe": "^2.0.3",
|
|
45
|
+
"vite": "^7.3.6",
|
|
46
|
+
"vue": "^3.5.39",
|
|
47
|
+
"@vixt/core": "0.12.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@dcloudio/vite-plugin-uni": "3.0.0-5000720260410001",
|
|
51
|
+
"pinia": "^3.0.4"
|
|
38
52
|
}
|
|
39
53
|
}
|