@vixt/uni 0.5.16 → 0.6.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 +12 -0
- package/dist/client/entry.js +25 -0
- package/dist/client/plugins/pinia.d.ts +6 -0
- package/dist/client/plugins/pinia.js +24 -0
- package/dist/client/plugins/router.d.ts +6 -0
- package/dist/client/plugins/router.js +13 -0
- package/dist/index.d.mts +6 -103
- package/dist/index.mjs +259 -313
- package/dist/types/client.d.ts +18 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/node.d.ts +23 -0
- package/package.json +9 -13
- package/dist/index.d.ts +0 -104
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "virtual:vixt:css";
|
|
2
|
+
import "virtual:uno.css";
|
|
3
|
+
import * as Pinia from "pinia";
|
|
4
|
+
import * as vue0 from "vue";
|
|
5
|
+
|
|
6
|
+
//#region src/client/entry.d.ts
|
|
7
|
+
declare function createApp(): {
|
|
8
|
+
app: vue0.App<Element>;
|
|
9
|
+
Pinia: typeof Pinia;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { createApp as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "virtual:vixt:css";
|
|
2
|
+
import "virtual:uno.css";
|
|
3
|
+
import { applyPlugins, createVixtApp } from "@vixt/core/client";
|
|
4
|
+
import * as Pinia from "pinia";
|
|
5
|
+
import appConfig from "virtual:vixt:app-config";
|
|
6
|
+
import plugins from "virtual:vixt:plugins";
|
|
7
|
+
import { createSSRApp } from "vue";
|
|
8
|
+
import RootComponent from "@/App.vue";
|
|
9
|
+
|
|
10
|
+
//#region src/client/entry.ts
|
|
11
|
+
function createApp() {
|
|
12
|
+
const app = createSSRApp(RootComponent);
|
|
13
|
+
applyPlugins(createVixtApp({
|
|
14
|
+
app,
|
|
15
|
+
appConfig
|
|
16
|
+
}), plugins);
|
|
17
|
+
return {
|
|
18
|
+
app,
|
|
19
|
+
Pinia
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
var entry_default = createApp;
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { entry_default as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineVixtPlugin } from "@vixt/core/client";
|
|
2
|
+
import { createPinia } from "pinia";
|
|
3
|
+
import { createPersistedState } from "pinia-plugin-persistedstate";
|
|
4
|
+
|
|
5
|
+
//#region src/client/plugins/pinia.ts
|
|
6
|
+
var pinia_default = defineVixtPlugin({
|
|
7
|
+
name: "vixt:pinia",
|
|
8
|
+
setup(vixt) {
|
|
9
|
+
const { app, appConfig } = vixt;
|
|
10
|
+
const pinia = createPinia();
|
|
11
|
+
pinia.use(createPersistedState({
|
|
12
|
+
storage: {
|
|
13
|
+
getItem: uni.getStorageSync,
|
|
14
|
+
setItem: uni.setStorageSync
|
|
15
|
+
},
|
|
16
|
+
...appConfig.piniaPersistedState
|
|
17
|
+
}));
|
|
18
|
+
app.use(pinia);
|
|
19
|
+
vixt.pinia = pinia;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { pinia_default as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineVixtPlugin } from "@vixt/core/client";
|
|
2
|
+
import { pages } from "virtual:uni-pages";
|
|
3
|
+
|
|
4
|
+
//#region src/client/plugins/router.ts
|
|
5
|
+
var router_default = defineVixtPlugin({
|
|
6
|
+
name: "vixt:router",
|
|
7
|
+
setup(vixt) {
|
|
8
|
+
vixt.routes = pages;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { router_default as default };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,104 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import * as _vixt_core from '@vixt/core';
|
|
4
|
-
import { AppOptions, Vixt, PluginOptions as PluginOptions$1, VixtOptions } from '@vixt/core';
|
|
5
|
-
import Pages, { PageMetaDatum } from '@uni-helper/vite-plugin-uni-pages';
|
|
6
|
-
import { Pinia } from 'pinia';
|
|
7
|
-
import { PluginOptions } from 'pinia-plugin-persistedstate';
|
|
8
|
-
import { App } from 'vue';
|
|
9
|
-
import Uni from '@dcloudio/vite-plugin-uni';
|
|
10
|
-
import Components from '@uni-helper/vite-plugin-uni-components';
|
|
11
|
-
import Layouts from '@uni-helper/vite-plugin-uni-layouts';
|
|
12
|
-
import UnoCSS from 'unocss/vite';
|
|
13
|
-
import AutoImport from 'unplugin-auto-import/vite';
|
|
14
|
-
import { ImportsMap } from 'unplugin-auto-import/types';
|
|
1
|
+
import * as _vixt_core0 from "@vixt/core";
|
|
2
|
+
import * as vite0 from "vite";
|
|
15
3
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface VixtApp {
|
|
23
|
-
app: App
|
|
24
|
-
routes: PageMetaDatum[]
|
|
25
|
-
pinia: Pinia
|
|
26
|
-
appConfig: VixtAppConfig
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
declare const appUni: _vixt_core.VixtModule<AppOptions>;
|
|
31
|
-
|
|
32
|
-
declare function generateMainTs(options: AppOptions, vixt: Vixt): string;
|
|
33
|
-
|
|
34
|
-
declare module '@vixt/core' {
|
|
35
|
-
interface VixtOptions {
|
|
36
|
-
uni?: PluginOptions$1<typeof Uni>;
|
|
37
|
-
/** https://github.com/uni-helper/vite-plugin-uni-pages */
|
|
38
|
-
uniPages?: PluginOptions$1<typeof Pages>;
|
|
39
|
-
/** https://github.com/uni-helper/vite-plugin-uni-layouts */
|
|
40
|
-
uniLayouts?: PluginOptions$1<typeof Layouts>;
|
|
41
|
-
/** https://github.com/uni-helper/vite-plugin-uni-components */
|
|
42
|
-
uniComponents?: PluginOptions$1<typeof Components>;
|
|
43
|
-
/** https://github.com/antfu/unplugin-auto-import */
|
|
44
|
-
imports?: PluginOptions$1<typeof AutoImport>;
|
|
45
|
-
/** https://github.com/antfu/unocss */
|
|
46
|
-
unocss?: PluginOptions$1<typeof UnoCSS>;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
declare module '@vixt/core/client' {
|
|
50
|
-
interface VixtAppConfig {
|
|
51
|
-
/** https://github.com/prazdevs/pinia-plugin-persistedstate */
|
|
52
|
-
piniaPersistedState?: PluginOptions;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
declare const presetUni: _vixt_core.VixtModule<VixtOptions>;
|
|
56
|
-
|
|
57
|
-
declare module '@vixt/core' {
|
|
58
|
-
interface VixtOptions {
|
|
59
|
-
uniModules?: ModuleOptions;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
interface ModuleOptions {
|
|
63
|
-
include?: string[];
|
|
64
|
-
exclude?: string[];
|
|
65
|
-
}
|
|
66
|
-
declare const uniModules: _vixt_core.VixtModule<_vixt_core.ModuleOptions>;
|
|
67
|
-
|
|
68
|
-
/** 增加小程序中vueuse的运行所需 */
|
|
69
|
-
declare function transformMpRuntime(code: string, id: string): string;
|
|
70
|
-
/**
|
|
71
|
-
* 修复h5报错`Cannot assign to read only property '_' of object '#<Object>'`
|
|
72
|
-
* @see https://ask.dcloud.net.cn/question/194973
|
|
73
|
-
*/
|
|
74
|
-
declare function transformH5Runtime(code: string, id: string): string;
|
|
75
|
-
/** 修复app运行白屏,原因是pinia调用了@vue/devtools-kit的setupDevToolsPlugin */
|
|
76
|
-
declare function transformVueDevtools(code: string, id: string): string;
|
|
77
|
-
/** 移除路径中的'../' */
|
|
78
|
-
declare function patchNormalizeNodeModules(): void;
|
|
79
|
-
/**
|
|
80
|
-
* 兼容 unocss^66.1.0 小程序平台的css文件后缀名
|
|
81
|
-
* @see https://github.com/dcloudio/uni-app/pull/5605/files
|
|
82
|
-
*/
|
|
83
|
-
declare function patchAdjustCssExtname(config: ResolvedConfig): void;
|
|
84
|
-
/**
|
|
85
|
-
* fix unocss^66.1.0 hot reload fail `[unocss:global:build:scan] Could not load xxx/src/__uno.css`
|
|
86
|
-
* @see https://github.com/unocss/unocss/issues/4616
|
|
87
|
-
* @see https://github.com/unocss/unocss/pull/4737
|
|
88
|
-
*/
|
|
89
|
-
declare function patchUnocssGlobalBuildScan(config: ResolvedConfig): void;
|
|
90
|
-
/**
|
|
91
|
-
* fix `@uni-helper/vite-plugin-uni-components` load slowly
|
|
92
|
-
* @see https://github.com/uni-helper/vite-plugin-uni-components/blob/main/packages/core/src/index.ts#L27
|
|
93
|
-
*/
|
|
94
|
-
declare function patchUniComponents(config: ResolvedConfig): void;
|
|
95
|
-
declare const uniPatch: (options?: any) => vite.PluginOption;
|
|
96
|
-
|
|
97
|
-
declare function uniVueUseResolver(): ImportsMap;
|
|
98
|
-
|
|
99
|
-
declare function genarateVirtualUniPagesTypes(vixt: Vixt): void;
|
|
100
|
-
|
|
101
|
-
declare const _default: (options?: _vixt_core.VixtOptions | undefined) => vite.PluginOption;
|
|
102
|
-
|
|
103
|
-
export { appUni, _default as default, genarateVirtualUniPagesTypes, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUnocssGlobalBuildScan, presetUni, transformH5Runtime, transformMpRuntime, transformVueDevtools, uniModules, uniPatch, uniVueUseResolver };
|
|
104
|
-
export type { ModuleOptions };
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
declare const _default: (options?: _vixt_core0.VixtOptions | undefined) => vite0.PluginOption;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _default as default };
|
package/dist/index.mjs
CHANGED
|
@@ -1,346 +1,292 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import { resolveModule } from 'local-pkg';
|
|
18
|
-
|
|
19
|
-
function generateMainTs(options, vixt) {
|
|
20
|
-
const { buildDir, srcDir } = vixt.options;
|
|
21
|
-
const mainTsPath = path.resolve(srcDir, "main.ts");
|
|
22
|
-
if (!fs.existsSync(mainTsPath))
|
|
23
|
-
fs.outputFileSync(mainTsPath, `// Generated by Vixt
|
|
24
|
-
// This file transform from '${path.basename(buildDir)}/main.ts'
|
|
25
|
-
`);
|
|
26
|
-
generateClient(vixt);
|
|
27
|
-
const appComponentTemplate = genarateAppComponent(vixt);
|
|
28
|
-
const cssTemplate = generateCss(options);
|
|
29
|
-
const appConfigTemplate = generateAppConfig(vixt);
|
|
30
|
-
const pluginsTemplate = generatePlugins(vixt);
|
|
31
|
-
const code = `// Generated by Vixt
|
|
32
|
-
// This file transform to '${srcDir}/main.ts'
|
|
33
|
-
// @ts-nocheck
|
|
34
|
-
${appComponentTemplate}
|
|
35
|
-
${cssTemplate}
|
|
36
|
-
${appConfigTemplate}
|
|
37
|
-
${pluginsTemplate}
|
|
38
|
-
|
|
39
|
-
import 'virtual:uno.css'
|
|
40
|
-
import { createSSRApp } from 'vue'
|
|
41
|
-
import * as Pinia from 'pinia'
|
|
42
|
-
import { createPersistedState } from 'pinia-plugin-persistedstate'
|
|
43
|
-
import { pages as routes } from 'virtual:uni-pages'
|
|
44
|
-
|
|
45
|
-
export function createApp() {
|
|
46
|
-
const app = createSSRApp(App)
|
|
47
|
-
const pinia = Pinia.createPinia()
|
|
48
|
-
pinia.use(createPersistedState({
|
|
49
|
-
storage: {
|
|
50
|
-
getItem: uni.getStorageSync,
|
|
51
|
-
setItem: uni.setStorageSync,
|
|
52
|
-
},
|
|
53
|
-
...appConfig.piniaPersistedState,
|
|
54
|
-
}))
|
|
55
|
-
app.use(pinia)
|
|
56
|
-
usePlugins({ app, routes, pinia, appConfig })
|
|
57
|
-
|
|
58
|
-
return { app, Pinia }
|
|
59
|
-
}
|
|
60
|
-
`;
|
|
61
|
-
fs.outputFileSync(path.resolve(buildDir, "main.ts"), code);
|
|
62
|
-
return code;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const name$2 = "vixt:app-uni";
|
|
66
|
-
const defaults$1 = {
|
|
67
|
-
rootId: "app",
|
|
68
|
-
rootTag: "div",
|
|
69
|
-
baseURL: "/",
|
|
70
|
-
entryFile: "main.ts",
|
|
71
|
-
css: [],
|
|
72
|
-
head: {
|
|
73
|
-
meta: [
|
|
74
|
-
{ charset: "utf-8" },
|
|
75
|
-
{ name: "viewport", content: "width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" }
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
const appUni = defineVixtModule({
|
|
80
|
-
meta: { name: name$2, configKey: "app" },
|
|
81
|
-
defaults: defaults$1,
|
|
82
|
-
setup(options, vixt) {
|
|
83
|
-
let indexHtmlCode;
|
|
84
|
-
let mainTsCode;
|
|
85
|
-
const mainTsPath = path.resolve(vixt.options.srcDir, "main.ts");
|
|
86
|
-
return {
|
|
87
|
-
name: name$2,
|
|
88
|
-
configResolved() {
|
|
89
|
-
indexHtmlCode = generateIndexHtml(options, vixt);
|
|
90
|
-
mainTsCode = generateMainTs(options, vixt);
|
|
91
|
-
},
|
|
92
|
-
transformIndexHtml: {
|
|
93
|
-
order: "pre",
|
|
94
|
-
handler() {
|
|
95
|
-
return indexHtmlCode;
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
transform: {
|
|
99
|
-
order: "pre",
|
|
100
|
-
handler(_, id) {
|
|
101
|
-
if (id !== mainTsPath)
|
|
102
|
-
return;
|
|
103
|
-
return mainTsCode;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
});
|
|
1
|
+
import { VixtClientAutoImports, createVixtPlugin, defineVitePlugin, defineVixtModule, isSamePath, resolveLayersDirs } from "@vixt/core";
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import { resolvePathSync } from "mlly";
|
|
4
|
+
import Uni from "@dcloudio/vite-plugin-uni";
|
|
5
|
+
import Components from "@uni-helper/vite-plugin-uni-components";
|
|
6
|
+
import Layouts from "@uni-helper/vite-plugin-uni-layouts";
|
|
7
|
+
import Pages from "@uni-helper/vite-plugin-uni-pages";
|
|
8
|
+
import defu from "defu";
|
|
9
|
+
import UnoCSS from "unocss/vite";
|
|
10
|
+
import AutoImport from "unplugin-auto-import/vite";
|
|
11
|
+
import path from "pathe";
|
|
12
|
+
import { normalizePath } from "vite";
|
|
13
|
+
import { readFileSync } from "node:fs";
|
|
14
|
+
import process from "node:process";
|
|
15
|
+
import { uniuseAutoImports } from "@uni-helper/uni-use";
|
|
16
|
+
import { resolveModule } from "local-pkg";
|
|
109
17
|
|
|
18
|
+
//#region src/modules/uni-patch.ts
|
|
19
|
+
/** 增加小程序中vueuse的运行所需 */
|
|
110
20
|
function transformMpRuntime(code, id) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
code += `
|
|
21
|
+
if (!id.endsWith("@dcloudio/uni-mp-vue/dist/vue.runtime.esm.js")) return code;
|
|
22
|
+
code += `
|
|
114
23
|
export const render = () => {}
|
|
115
24
|
export const TransitionGroup = {}
|
|
116
25
|
`;
|
|
117
|
-
|
|
26
|
+
return code;
|
|
118
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* 修复h5报错`Cannot assign to read only property '_' of object '#<Object>'`
|
|
30
|
+
* @see https://ask.dcloud.net.cn/question/194973
|
|
31
|
+
*/
|
|
119
32
|
function transformH5Runtime(code, id) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return code;
|
|
33
|
+
if (!id.endsWith("@dcloudio/uni-h5-vue/dist/vue.runtime.esm.js")) return code;
|
|
34
|
+
code = code.replace(`def(children, "_", type);`, `def(children, "_", type, true);`);
|
|
35
|
+
return code;
|
|
124
36
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}`, `function setupDevToolsPlugin(pluginDescriptor, setupFn) {}`);
|
|
131
|
-
return code;
|
|
37
|
+
/** 修复app运行白屏,原因是pinia调用了@vue/devtools-kit的setupDevToolsPlugin */
|
|
38
|
+
function transformPinia(code, id) {
|
|
39
|
+
if (!id.endsWith("pinia/dist/pinia.mjs")) return code;
|
|
40
|
+
code = code.replace(`import { setupDevtoolsPlugin } from '@vue/devtools-api';`, `function setupDevtoolsPlugin() {};`);
|
|
41
|
+
return code;
|
|
132
42
|
}
|
|
43
|
+
/** 移除路径中的'../' */
|
|
133
44
|
function patchNormalizeNodeModules() {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
45
|
+
const matched = `str = normalizePath(str).replace(NODE_MODULES_REGEX, 'node-modules');`;
|
|
46
|
+
const replaced = `str = normalizePath(str).replace(NODE_MODULES_REGEX, 'node-modules').replace(/\\.\\.\\//g, '');`;
|
|
47
|
+
const codePath = resolvePathSync("@dcloudio/uni-cli-shared/dist/utils.js");
|
|
48
|
+
let code = fs.readFileSync(codePath, "utf8");
|
|
49
|
+
if (code.includes(matched)) {
|
|
50
|
+
code = code.replace(matched, replaced);
|
|
51
|
+
fs.writeFileSync(codePath, code);
|
|
52
|
+
}
|
|
142
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* 兼容 unocss^66.1.0 小程序平台的css文件后缀名
|
|
56
|
+
* @see https://github.com/dcloudio/uni-app/pull/5605/files
|
|
57
|
+
*/
|
|
143
58
|
function patchAdjustCssExtname(config) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
59
|
+
const plugin = config.plugins.find((p) => p.name === "uni:adjust-css-extname");
|
|
60
|
+
if (plugin && typeof plugin.generateBundle === "function") plugin.generateBundle = {
|
|
61
|
+
order: "post",
|
|
62
|
+
handler: plugin.generateBundle
|
|
63
|
+
};
|
|
149
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* fix unocss^66.1.0 hot reload fail `[unocss:global:build:scan] Could not load xxx/src/__uno.css`
|
|
67
|
+
* @see https://github.com/unocss/unocss/issues/4616
|
|
68
|
+
* @see https://github.com/unocss/unocss/pull/4737
|
|
69
|
+
*/
|
|
150
70
|
function patchUnocssGlobalBuildScan(config) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
plugin.shouldTransformCachedModule = ({ id }) => id.endsWith("main.ts");
|
|
71
|
+
const plugin = config.plugins.find((p) => p.name === "unocss:global:build:scan");
|
|
72
|
+
if (plugin) plugin.shouldTransformCachedModule = ({ id }) => id.endsWith("main.ts");
|
|
154
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* fix `@uni-helper/vite-plugin-uni-components` load slowly
|
|
76
|
+
* @see https://github.com/uni-helper/vite-plugin-uni-components/blob/main/packages/core/src/index.ts#L27
|
|
77
|
+
*/
|
|
155
78
|
function patchUniComponents(config) {
|
|
156
|
-
|
|
157
|
-
|
|
79
|
+
if (JSON.stringify(config.build.watch) === "{}") config.build.watch = null;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* fix `@uni-helper/vite-plugin-uni-pages` client types
|
|
83
|
+
* @see https://github.com/uni-helper/vite-plugin-uni-pages/blob/main/packages/core/client.d.ts#L4
|
|
84
|
+
*/
|
|
85
|
+
function patchUniPagesTypes() {
|
|
86
|
+
const matched = ` import type { SubPackage } from './src/config/types/index'\n import type { PageMetaDatum } from './src/types'`;
|
|
87
|
+
const replaced = ` import type { PageMetaDatum, SubPackage } from '@uni-helper/vite-plugin-uni-pages'`;
|
|
88
|
+
const codePath = path.resolve(resolvePathSync("@uni-helper/vite-plugin-uni-pages"), "../../client.d.ts");
|
|
89
|
+
let code = codePath && fs.readFileSync(codePath, "utf-8");
|
|
90
|
+
if (code.includes(matched)) {
|
|
91
|
+
code = code.replace(matched, replaced);
|
|
92
|
+
fs.outputFileSync(codePath, code);
|
|
93
|
+
}
|
|
158
94
|
}
|
|
159
95
|
const uniPatch = defineVitePlugin(() => {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
96
|
+
patchNormalizeNodeModules();
|
|
97
|
+
patchUniPagesTypes();
|
|
98
|
+
return [
|
|
99
|
+
{
|
|
100
|
+
name: "vixt:uni-patch-runtime",
|
|
101
|
+
transform(code, id) {
|
|
102
|
+
id = normalizePath(id);
|
|
103
|
+
code = transformMpRuntime(code, id);
|
|
104
|
+
code = transformH5Runtime(code, id);
|
|
105
|
+
code = transformPinia(code, id);
|
|
106
|
+
return code;
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "vixt:uni-patch-uni-components",
|
|
111
|
+
configResolved(config) {
|
|
112
|
+
patchUniComponents(config);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "vixt:uni-patch-unocss-global-build-scan",
|
|
117
|
+
apply: "build",
|
|
118
|
+
enforce: "pre",
|
|
119
|
+
configResolved(config) {
|
|
120
|
+
patchUnocssGlobalBuildScan(config);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "vixt:uni-patch-adjust-css-extname",
|
|
125
|
+
enforce: "post",
|
|
126
|
+
configResolved(config) {
|
|
127
|
+
patchAdjustCssExtname(config);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
];
|
|
194
131
|
});
|
|
195
132
|
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/modules/uni-use.ts
|
|
196
135
|
let _cache;
|
|
197
136
|
function uniVueUseResolver() {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
return _cache || {};
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
function genarateVirtualUniPagesTypes(vixt) {
|
|
231
|
-
const { buildTypesDir } = vixt.options;
|
|
232
|
-
const codePath = path.resolve(buildTypesDir, "virtual-uni-pages.d.ts");
|
|
233
|
-
const code = `declare module 'virtual:uni-pages' {
|
|
234
|
-
import type { PageMetaDatum, SubPackage } from '@uni-helper/vite-plugin-uni-pages'
|
|
235
|
-
|
|
236
|
-
export const pages: PageMetaDatum[]
|
|
237
|
-
export const subPackages: SubPackage[]
|
|
238
|
-
}
|
|
239
|
-
`;
|
|
240
|
-
fs.outputFileSync(codePath, code);
|
|
137
|
+
const excluded = [
|
|
138
|
+
"toRefs",
|
|
139
|
+
"utils",
|
|
140
|
+
"toRef",
|
|
141
|
+
"toValue",
|
|
142
|
+
"tryOnScopeDispose",
|
|
143
|
+
"useNetwork",
|
|
144
|
+
"useOnline",
|
|
145
|
+
"usePreferredDark",
|
|
146
|
+
"useStorage",
|
|
147
|
+
"useStorageAsync"
|
|
148
|
+
];
|
|
149
|
+
if (!_cache) {
|
|
150
|
+
let indexesJson;
|
|
151
|
+
try {
|
|
152
|
+
const corePath = resolveModule("@vueuse/core") || process.cwd();
|
|
153
|
+
const path$1 = resolveModule("@vueuse/core/indexes.json") || resolveModule("@vueuse/metadata/index.json") || resolveModule("@vueuse/metadata/index.json", { paths: [corePath] });
|
|
154
|
+
indexesJson = JSON.parse(readFileSync(path$1, "utf-8"));
|
|
155
|
+
} catch (error) {
|
|
156
|
+
console.error(error);
|
|
157
|
+
throw new Error("[auto-import] failed to load @vueuse/core, have you installed it?");
|
|
158
|
+
}
|
|
159
|
+
if (indexesJson) _cache = {
|
|
160
|
+
"@vueuse/core": indexesJson.functions.filter((i) => ["core", "shared"].includes(i.package)).flatMap((i) => [i.name, ...i.alias || []]).filter((i) => i && i.length >= 4 && !excluded.includes(i)),
|
|
161
|
+
...uniuseAutoImports()
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
return _cache || {};
|
|
241
165
|
}
|
|
242
166
|
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/modules/preset-uni.ts
|
|
243
169
|
const name$1 = "vixt:preset-uni";
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
170
|
+
var preset_uni_default = defineVixtModule({
|
|
171
|
+
meta: { name: name$1 },
|
|
172
|
+
setup(_, vixt) {
|
|
173
|
+
const { components = [], composables = [], constants = [], utils = [], stores = [] } = resolveLayersDirs([...vixt._layers].reverse());
|
|
174
|
+
const { buildTypesDir } = vixt.options;
|
|
175
|
+
const defaultOptions = {
|
|
176
|
+
uni: {},
|
|
177
|
+
uniPages: { dts: `${buildTypesDir}/uni-pages.d.ts` },
|
|
178
|
+
uniLayouts: {},
|
|
179
|
+
uniComponents: {
|
|
180
|
+
dts: `${buildTypesDir}/components.d.ts`,
|
|
181
|
+
dirs: [...components].reverse(),
|
|
182
|
+
directoryAsNamespace: true,
|
|
183
|
+
collapseSamePrefixes: true
|
|
184
|
+
},
|
|
185
|
+
imports: {
|
|
186
|
+
imports: [
|
|
187
|
+
"vue",
|
|
188
|
+
"uni-app",
|
|
189
|
+
"pinia",
|
|
190
|
+
uniVueUseResolver(),
|
|
191
|
+
VixtClientAutoImports
|
|
192
|
+
],
|
|
193
|
+
dts: `${buildTypesDir}/auto-imports.d.ts`,
|
|
194
|
+
dirs: [
|
|
195
|
+
composables,
|
|
196
|
+
constants,
|
|
197
|
+
stores,
|
|
198
|
+
utils
|
|
199
|
+
].flat(),
|
|
200
|
+
vueTemplate: true
|
|
201
|
+
},
|
|
202
|
+
unocss: {}
|
|
203
|
+
};
|
|
204
|
+
const options = vixt.options = defu(vixt.options, defaultOptions);
|
|
205
|
+
return [
|
|
206
|
+
Pages(options.uniPages),
|
|
207
|
+
Layouts(options.uniLayouts),
|
|
208
|
+
Components(options.uniComponents),
|
|
209
|
+
AutoImport(options.imports),
|
|
210
|
+
UnoCSS(options.unocss),
|
|
211
|
+
uniPatch(),
|
|
212
|
+
(Uni?.default ?? Uni)(options.uni)
|
|
213
|
+
];
|
|
214
|
+
}
|
|
281
215
|
});
|
|
282
216
|
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/modules/uni-modules.ts
|
|
283
219
|
function copyUniModules(options, vixt) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
`, e);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
});
|
|
220
|
+
const { srcDir } = vixt.options;
|
|
221
|
+
const { include, exclude } = options ?? {};
|
|
222
|
+
const { uni_modules = [] } = resolveLayersDirs(vixt._layers);
|
|
223
|
+
const srcUniModulesPath = path.join(srcDir, "uni_modules");
|
|
224
|
+
uni_modules.forEach((uniModulesPath) => {
|
|
225
|
+
fs.readdirSync(uniModulesPath).filter((dir) => {
|
|
226
|
+
if (include?.length) return include.includes(dir);
|
|
227
|
+
if (exclude?.length) return !exclude.includes(dir);
|
|
228
|
+
return true;
|
|
229
|
+
}).forEach((dir) => {
|
|
230
|
+
const srcPath = path.join(uniModulesPath, dir);
|
|
231
|
+
const destPath = path.join(srcUniModulesPath, dir);
|
|
232
|
+
if (srcPath !== destPath) try {
|
|
233
|
+
fs.emptyDirSync(destPath);
|
|
234
|
+
fs.copySync(srcPath, destPath);
|
|
235
|
+
fs.writeFileSync(path.join(destPath, ".gitignore"), "*", "utf-8");
|
|
236
|
+
} catch (e) {
|
|
237
|
+
console.error(`Error copying ${srcPath} to ${destPath}:\n`, e);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
});
|
|
310
241
|
}
|
|
311
242
|
const name = "vixt:uni-modules";
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
243
|
+
var uni_modules_default = defineVixtModule({
|
|
244
|
+
meta: {
|
|
245
|
+
name,
|
|
246
|
+
configKey: "uniModules"
|
|
247
|
+
},
|
|
248
|
+
setup(options, vixt) {
|
|
249
|
+
copyUniModules(options, vixt);
|
|
250
|
+
return {
|
|
251
|
+
name,
|
|
252
|
+
configureServer(server) {
|
|
253
|
+
const { uni_modules = [] } = resolveLayersDirs(vixt._layers.filter((e) => !isSamePath(e.cwd, vixt.options.rootDir)));
|
|
254
|
+
server.watcher.add(uni_modules);
|
|
255
|
+
server.watcher.on("all", (_, file) => {
|
|
256
|
+
if (uni_modules.some((e) => path.normalize(file).match(e))) copyUniModules(options, vixt);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
}
|
|
329
261
|
});
|
|
330
262
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/index.ts
|
|
265
|
+
var src_default = createVixtPlugin({ defaults: {
|
|
266
|
+
modules: [preset_uni_default, uni_modules_default],
|
|
267
|
+
plugins: ["@vixt/uni/client/plugins/pinia", "@vixt/uni/client/plugins/router"],
|
|
268
|
+
app: {
|
|
269
|
+
entryFile: "main.ts",
|
|
270
|
+
entryCode: fs.readFileSync(resolvePathSync("@vixt/uni/client/entry"), "utf-8"),
|
|
271
|
+
head: { meta: [{ charset: "utf-8" }, {
|
|
272
|
+
name: "viewport",
|
|
273
|
+
content: "width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
|
274
|
+
}] }
|
|
275
|
+
},
|
|
276
|
+
typescript: { tsConfig: {
|
|
277
|
+
compilerOptions: { types: [
|
|
278
|
+
"@vixt/uni/types",
|
|
279
|
+
"@dcloudio/types",
|
|
280
|
+
"@uni-helper/uni-app-types"
|
|
281
|
+
] },
|
|
282
|
+
vueCompilerOptions: { plugins: ["@uni-helper/uni-app-types/volar-plugin"] }
|
|
283
|
+
} },
|
|
284
|
+
vite: { optimizeDeps: { exclude: [
|
|
285
|
+
"@vixt/uni/client/entry",
|
|
286
|
+
"@vixt/uni/client/plugins/pinia",
|
|
287
|
+
"@vixt/uni/client/plugins/router"
|
|
288
|
+
] } }
|
|
289
|
+
} });
|
|
345
290
|
|
|
346
|
-
|
|
291
|
+
//#endregion
|
|
292
|
+
export { src_default as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PageMetaDatum } from '@uni-helper/vite-plugin-uni-pages'
|
|
2
|
+
import type { Pinia } from 'pinia'
|
|
3
|
+
import type { PluginOptions as PersistedStateOptions } from 'pinia-plugin-persistedstate'
|
|
4
|
+
import type { App } from 'vue'
|
|
5
|
+
|
|
6
|
+
declare module '@vixt/core/client' {
|
|
7
|
+
interface VixtAppConfig {
|
|
8
|
+
/** https://github.com/prazdevs/pinia-plugin-persistedstate */
|
|
9
|
+
piniaPersistedState?: PersistedStateOptions
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface VixtApp {
|
|
13
|
+
app: App
|
|
14
|
+
routes: PageMetaDatum[]
|
|
15
|
+
pinia: Pinia
|
|
16
|
+
appConfig: VixtAppConfig
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type Uni from '@dcloudio/vite-plugin-uni'
|
|
2
|
+
import type Components from '@uni-helper/vite-plugin-uni-components'
|
|
3
|
+
import type Layouts from '@uni-helper/vite-plugin-uni-layouts'
|
|
4
|
+
import type Pages from '@uni-helper/vite-plugin-uni-pages'
|
|
5
|
+
import type { ExtractPluginOptions } from '@vixt/core'
|
|
6
|
+
import type UnoCSS from 'unocss/vite'
|
|
7
|
+
import type AutoImport from 'unplugin-auto-import/vite'
|
|
8
|
+
|
|
9
|
+
declare module '@vixt/core' {
|
|
10
|
+
interface VixtOptions {
|
|
11
|
+
uni?: ExtractPluginOptions<typeof Uni>
|
|
12
|
+
/** https://github.com/uni-helper/vite-plugin-uni-pages */
|
|
13
|
+
uniPages?: ExtractPluginOptions<typeof Pages>
|
|
14
|
+
/** https://github.com/uni-helper/vite-plugin-uni-layouts */
|
|
15
|
+
uniLayouts?: ExtractPluginOptions<typeof Layouts>
|
|
16
|
+
/** https://github.com/uni-helper/vite-plugin-uni-components */
|
|
17
|
+
uniComponents?: ExtractPluginOptions<typeof Components>
|
|
18
|
+
/** https://github.com/antfu/unplugin-auto-import */
|
|
19
|
+
imports?: ExtractPluginOptions<typeof AutoImport>
|
|
20
|
+
/** https://github.com/antfu/unocss */
|
|
21
|
+
unocss?: ExtractPluginOptions<typeof UnoCSS>
|
|
22
|
+
}
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vixt/uni",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"author": "SoulLyoko<https://github.com/SoulLyoko>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://soullyoko.github.io/vixt/",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"uni-app"
|
|
15
15
|
],
|
|
16
16
|
"exports": {
|
|
17
|
-
".":
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
".": "./dist/index.mjs",
|
|
18
|
+
"./client/*": "./dist/client/*.js",
|
|
19
|
+
"./types": "./dist/types/index.d.ts",
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
21
|
},
|
|
22
|
-
"main": "dist/index.mjs",
|
|
23
|
-
"types": "dist/index.d.ts",
|
|
22
|
+
"main": "./dist/index.mjs",
|
|
23
|
+
"types": "./dist/types/index.d.ts",
|
|
24
24
|
"files": [
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
@@ -33,11 +33,7 @@
|
|
|
33
33
|
"@uni-helper/vite-plugin-uni-layouts": "^0.1.11",
|
|
34
34
|
"@uni-helper/vite-plugin-uni-pages": "^0.3.22",
|
|
35
35
|
"unocss-applet": "^0.12.2",
|
|
36
|
-
"@vixt/core": "0.
|
|
37
|
-
"@vixt/vue": "0.
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "unbuild",
|
|
41
|
-
"dev": "unbuild --stub"
|
|
36
|
+
"@vixt/core": "0.6.0",
|
|
37
|
+
"@vixt/vue": "0.6.0"
|
|
42
38
|
}
|
|
43
39
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import * as vite from 'vite';
|
|
2
|
-
import { ResolvedConfig } from 'vite';
|
|
3
|
-
import * as _vixt_core from '@vixt/core';
|
|
4
|
-
import { AppOptions, Vixt, PluginOptions as PluginOptions$1, VixtOptions } from '@vixt/core';
|
|
5
|
-
import Pages, { PageMetaDatum } from '@uni-helper/vite-plugin-uni-pages';
|
|
6
|
-
import { Pinia } from 'pinia';
|
|
7
|
-
import { PluginOptions } from 'pinia-plugin-persistedstate';
|
|
8
|
-
import { App } from 'vue';
|
|
9
|
-
import Uni from '@dcloudio/vite-plugin-uni';
|
|
10
|
-
import Components from '@uni-helper/vite-plugin-uni-components';
|
|
11
|
-
import Layouts from '@uni-helper/vite-plugin-uni-layouts';
|
|
12
|
-
import UnoCSS from 'unocss/vite';
|
|
13
|
-
import AutoImport from 'unplugin-auto-import/vite';
|
|
14
|
-
import { ImportsMap } from 'unplugin-auto-import/types';
|
|
15
|
-
|
|
16
|
-
declare module '@vixt/core/client' {
|
|
17
|
-
interface VixtAppConfig {
|
|
18
|
-
/** https://github.com/prazdevs/pinia-plugin-persistedstate */
|
|
19
|
-
piniaPersistedState?: PluginOptions
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface VixtApp {
|
|
23
|
-
app: App
|
|
24
|
-
routes: PageMetaDatum[]
|
|
25
|
-
pinia: Pinia
|
|
26
|
-
appConfig: VixtAppConfig
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
declare const appUni: _vixt_core.VixtModule<AppOptions>;
|
|
31
|
-
|
|
32
|
-
declare function generateMainTs(options: AppOptions, vixt: Vixt): string;
|
|
33
|
-
|
|
34
|
-
declare module '@vixt/core' {
|
|
35
|
-
interface VixtOptions {
|
|
36
|
-
uni?: PluginOptions$1<typeof Uni>;
|
|
37
|
-
/** https://github.com/uni-helper/vite-plugin-uni-pages */
|
|
38
|
-
uniPages?: PluginOptions$1<typeof Pages>;
|
|
39
|
-
/** https://github.com/uni-helper/vite-plugin-uni-layouts */
|
|
40
|
-
uniLayouts?: PluginOptions$1<typeof Layouts>;
|
|
41
|
-
/** https://github.com/uni-helper/vite-plugin-uni-components */
|
|
42
|
-
uniComponents?: PluginOptions$1<typeof Components>;
|
|
43
|
-
/** https://github.com/antfu/unplugin-auto-import */
|
|
44
|
-
imports?: PluginOptions$1<typeof AutoImport>;
|
|
45
|
-
/** https://github.com/antfu/unocss */
|
|
46
|
-
unocss?: PluginOptions$1<typeof UnoCSS>;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
declare module '@vixt/core/client' {
|
|
50
|
-
interface VixtAppConfig {
|
|
51
|
-
/** https://github.com/prazdevs/pinia-plugin-persistedstate */
|
|
52
|
-
piniaPersistedState?: PluginOptions;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
declare const presetUni: _vixt_core.VixtModule<VixtOptions>;
|
|
56
|
-
|
|
57
|
-
declare module '@vixt/core' {
|
|
58
|
-
interface VixtOptions {
|
|
59
|
-
uniModules?: ModuleOptions;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
interface ModuleOptions {
|
|
63
|
-
include?: string[];
|
|
64
|
-
exclude?: string[];
|
|
65
|
-
}
|
|
66
|
-
declare const uniModules: _vixt_core.VixtModule<_vixt_core.ModuleOptions>;
|
|
67
|
-
|
|
68
|
-
/** 增加小程序中vueuse的运行所需 */
|
|
69
|
-
declare function transformMpRuntime(code: string, id: string): string;
|
|
70
|
-
/**
|
|
71
|
-
* 修复h5报错`Cannot assign to read only property '_' of object '#<Object>'`
|
|
72
|
-
* @see https://ask.dcloud.net.cn/question/194973
|
|
73
|
-
*/
|
|
74
|
-
declare function transformH5Runtime(code: string, id: string): string;
|
|
75
|
-
/** 修复app运行白屏,原因是pinia调用了@vue/devtools-kit的setupDevToolsPlugin */
|
|
76
|
-
declare function transformVueDevtools(code: string, id: string): string;
|
|
77
|
-
/** 移除路径中的'../' */
|
|
78
|
-
declare function patchNormalizeNodeModules(): void;
|
|
79
|
-
/**
|
|
80
|
-
* 兼容 unocss^66.1.0 小程序平台的css文件后缀名
|
|
81
|
-
* @see https://github.com/dcloudio/uni-app/pull/5605/files
|
|
82
|
-
*/
|
|
83
|
-
declare function patchAdjustCssExtname(config: ResolvedConfig): void;
|
|
84
|
-
/**
|
|
85
|
-
* fix unocss^66.1.0 hot reload fail `[unocss:global:build:scan] Could not load xxx/src/__uno.css`
|
|
86
|
-
* @see https://github.com/unocss/unocss/issues/4616
|
|
87
|
-
* @see https://github.com/unocss/unocss/pull/4737
|
|
88
|
-
*/
|
|
89
|
-
declare function patchUnocssGlobalBuildScan(config: ResolvedConfig): void;
|
|
90
|
-
/**
|
|
91
|
-
* fix `@uni-helper/vite-plugin-uni-components` load slowly
|
|
92
|
-
* @see https://github.com/uni-helper/vite-plugin-uni-components/blob/main/packages/core/src/index.ts#L27
|
|
93
|
-
*/
|
|
94
|
-
declare function patchUniComponents(config: ResolvedConfig): void;
|
|
95
|
-
declare const uniPatch: (options?: any) => vite.PluginOption;
|
|
96
|
-
|
|
97
|
-
declare function uniVueUseResolver(): ImportsMap;
|
|
98
|
-
|
|
99
|
-
declare function genarateVirtualUniPagesTypes(vixt: Vixt): void;
|
|
100
|
-
|
|
101
|
-
declare const _default: (options?: _vixt_core.VixtOptions | undefined) => vite.PluginOption;
|
|
102
|
-
|
|
103
|
-
export { appUni, _default as default, genarateVirtualUniPagesTypes, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUnocssGlobalBuildScan, presetUni, transformH5Runtime, transformMpRuntime, transformVueDevtools, uniModules, uniPatch, uniVueUseResolver };
|
|
104
|
-
export type { ModuleOptions };
|