@vixt/uni 0.10.1 → 0.11.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/client.d.ts +15 -0
- package/dist/client/entry.d.ts +1 -1
- package/dist/client/entry.js +1 -2
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +2 -0
- package/dist/{index.d.mts → node/index.d.mts} +4 -2
- package/dist/node/index.mjs +37 -0
- package/dist/node/modules/preset-uni.d.mts +7 -0
- package/dist/node/modules/preset-uni.mjs +35 -0
- package/dist/node/modules/uni-layouts.d.mts +2 -0
- package/dist/node/modules/uni-layouts.mjs +71 -0
- package/dist/node/modules/uni-modules.d.mts +15 -0
- package/dist/node/modules/uni-modules.mjs +49 -0
- package/dist/node/modules/uni-patch.d.mts +39 -0
- package/dist/node/modules/uni-patch.mjs +121 -0
- package/dist/node/node.d.mts +21 -0
- package/dist/node/uni-layouts-B1hWgSc_.d.mts +22 -0
- package/dist/types/index.d.ts +2 -2
- package/package.json +6 -6
- package/dist/client/plugins/pinia.d.ts +0 -6
- package/dist/client/plugins/pinia.js +0 -22
- package/dist/index.mjs +0 -280
- package/dist/types/client.d.ts +0 -18
- package/dist/types/node.d.ts +0 -23
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PageMetaDatum } from "@uni-helper/vite-plugin-uni-pages";
|
|
2
|
+
import { App } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/client/client.d.ts
|
|
5
|
+
interface UniVixtApp {
|
|
6
|
+
/** Uni-app app instance */
|
|
7
|
+
app: App;
|
|
8
|
+
/** Uni-app pages */
|
|
9
|
+
routes: PageMetaDatum[];
|
|
10
|
+
}
|
|
11
|
+
declare module '@vixt/core/client' {
|
|
12
|
+
interface VixtApp extends UniVixtApp {}
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { UniVixtApp };
|
package/dist/client/entry.d.ts
CHANGED
package/dist/client/entry.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { createSSRApp } from "vue";
|
|
1
2
|
import "virtual:vixt:css";
|
|
2
|
-
import "virtual:uno.css";
|
|
3
3
|
import { applyPlugins, createVixtApp } from "@vixt/core/client";
|
|
4
4
|
import * as Pinia from "pinia";
|
|
5
5
|
import appConfig from "virtual:vixt:app-config";
|
|
6
6
|
import plugins from "virtual:vixt:plugins";
|
|
7
|
-
import { createSSRApp } from "vue";
|
|
8
7
|
import RootComponent from "@/App.vue";
|
|
9
8
|
//#region src/client/entry.ts
|
|
10
9
|
function createApp() {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { UniVixtOptions } from "./node.mjs";
|
|
1
2
|
import * as _$_vixt_core0 from "@vixt/core";
|
|
2
3
|
import * as _$vite from "vite";
|
|
3
4
|
|
|
4
|
-
//#region src/index.d.ts
|
|
5
|
+
//#region src/node/index.d.ts
|
|
6
|
+
/** @hidden */
|
|
5
7
|
declare const _default: (options?: _$_vixt_core0.VixtOptions | undefined) => _$vite.PluginOption;
|
|
6
8
|
//#endregion
|
|
7
|
-
export { _default as default };
|
|
9
|
+
export { UniVixtOptions, _default as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import preset_uni_default from "./modules/preset-uni.mjs";
|
|
2
|
+
import uni_modules_default from "./modules/uni-modules.mjs";
|
|
3
|
+
import { UniVixtOptions } from "./node.d.mts";
|
|
4
|
+
import { createVixtPlugin } from "@vixt/core";
|
|
5
|
+
import fs from "fs-extra";
|
|
6
|
+
import { resolvePathSync } from "mlly";
|
|
7
|
+
//#region src/node/index.ts
|
|
8
|
+
/** @module uni */
|
|
9
|
+
const plugins = ["@vixt/uni/client/plugins/router"];
|
|
10
|
+
/** @hidden */
|
|
11
|
+
var node_default = createVixtPlugin({ defaults: {
|
|
12
|
+
modules: [preset_uni_default, uni_modules_default],
|
|
13
|
+
plugins,
|
|
14
|
+
app: {
|
|
15
|
+
entryFile: "main.ts",
|
|
16
|
+
entryCode: fs.readFileSync(resolvePathSync("@vixt/uni/client/entry"), "utf-8"),
|
|
17
|
+
head: { meta: [{ charset: "utf-8" }, {
|
|
18
|
+
name: "viewport",
|
|
19
|
+
content: "width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
|
20
|
+
}] }
|
|
21
|
+
},
|
|
22
|
+
imports: {
|
|
23
|
+
imports: ["vue", "uni-app"],
|
|
24
|
+
vueTemplate: true
|
|
25
|
+
},
|
|
26
|
+
typescript: { tsConfig: {
|
|
27
|
+
compilerOptions: { types: [
|
|
28
|
+
"@vixt/uni/types",
|
|
29
|
+
"@dcloudio/types",
|
|
30
|
+
"@uni-helper/uni-app-types"
|
|
31
|
+
] },
|
|
32
|
+
vueCompilerOptions: { plugins: ["@uni-helper/uni-app-types/volar-plugin"] }
|
|
33
|
+
} },
|
|
34
|
+
vite: { optimizeDeps: { exclude: plugins } }
|
|
35
|
+
} });
|
|
36
|
+
//#endregion
|
|
37
|
+
export { UniVixtOptions, node_default as default };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import uni_layouts_default from "./uni-layouts.mjs";
|
|
2
|
+
import uni_patch_default from "./uni-patch.mjs";
|
|
3
|
+
import { defineVixtModule, resolveLayersDirs } from "@vixt/core";
|
|
4
|
+
import Uni from "@dcloudio/vite-plugin-uni";
|
|
5
|
+
import Components from "@uni-helper/vite-plugin-uni-components";
|
|
6
|
+
import Pages from "@uni-helper/vite-plugin-uni-pages";
|
|
7
|
+
import defu from "defu";
|
|
8
|
+
var preset_uni_default = defineVixtModule({
|
|
9
|
+
meta: { name: "vixt:preset-uni" },
|
|
10
|
+
setup(_, vixt) {
|
|
11
|
+
const { components = [], layouts = [] } = resolveLayersDirs([...vixt._layers].reverse());
|
|
12
|
+
const { buildTypesDir } = vixt.options;
|
|
13
|
+
const defaultOptions = {
|
|
14
|
+
uni: {},
|
|
15
|
+
uniPages: { dts: `${buildTypesDir}/uni-pages.d.ts` },
|
|
16
|
+
uniLayouts: { layoutsDirs: layouts },
|
|
17
|
+
uniComponents: {
|
|
18
|
+
dts: `${buildTypesDir}/components.d.ts`,
|
|
19
|
+
dirs: [...components].reverse(),
|
|
20
|
+
directoryAsNamespace: true,
|
|
21
|
+
collapseSamePrefixes: true
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const options = vixt.options = defu(vixt.options, defaultOptions);
|
|
25
|
+
return [
|
|
26
|
+
Pages(options.uniPages),
|
|
27
|
+
uni_layouts_default(options.uniLayouts),
|
|
28
|
+
Components(options.uniComponents),
|
|
29
|
+
uni_patch_default(),
|
|
30
|
+
(Uni?.default ?? Uni)(options.uni)
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
export { preset_uni_default as default };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { defineVitePlugin } from "@vixt/core";
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import { resolvePathSync } from "mlly";
|
|
4
|
+
import { camelCase, kebabCase, pascalCase } from "@uni-helper/vite-plugin-uni-components";
|
|
5
|
+
import { parse } from "node:path";
|
|
6
|
+
import { cwd } from "node:process";
|
|
7
|
+
import fg from "fast-glob";
|
|
8
|
+
//#region src/node/modules/uni-layouts.ts
|
|
9
|
+
/** 从插件中返回ctx */
|
|
10
|
+
function patchUniLayouts() {
|
|
11
|
+
const matched = `name: "vite-plugin-uni-layouts"`;
|
|
12
|
+
const replaced = `ctx,name: "vite-plugin-uni-layouts"`;
|
|
13
|
+
const codePath = resolvePathSync("@uni-helper/vite-plugin-uni-layouts");
|
|
14
|
+
let code = fs.readFileSync(codePath, "utf-8");
|
|
15
|
+
if (!code.includes(replaced)) {
|
|
16
|
+
code = code.replace(matched, replaced);
|
|
17
|
+
fs.writeFileSync(codePath, code);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function scanLayoutsDirs(dirs, exclude = []) {
|
|
21
|
+
return fg.sync(dirs.map((c) => `${c}/**/*.vue`), {
|
|
22
|
+
ignore: [
|
|
23
|
+
"node_modules",
|
|
24
|
+
".git",
|
|
25
|
+
...exclude
|
|
26
|
+
],
|
|
27
|
+
onlyFiles: true,
|
|
28
|
+
cwd: cwd(),
|
|
29
|
+
absolute: true
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @return kebabCase
|
|
34
|
+
*/
|
|
35
|
+
function getNameFromFilePath(filePath, dirs) {
|
|
36
|
+
const parsedFilePath = parse(filePath);
|
|
37
|
+
let strippedPath = "";
|
|
38
|
+
for (const dir of dirs) if (parsedFilePath.dir.startsWith(dir)) {
|
|
39
|
+
strippedPath = parsedFilePath.dir.slice(dir.length);
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
const folders = strippedPath.slice(1).split("/").filter(Boolean);
|
|
43
|
+
let filename = parsedFilePath.name;
|
|
44
|
+
if (filename === "index") filename = "";
|
|
45
|
+
filename = [...folders, filename].filter(Boolean).join("-");
|
|
46
|
+
return filename;
|
|
47
|
+
}
|
|
48
|
+
function getLayouts(files, dirs) {
|
|
49
|
+
const layoutsMap = {};
|
|
50
|
+
files.forEach((file) => {
|
|
51
|
+
const name = getNameFromFilePath(file, dirs);
|
|
52
|
+
layoutsMap[name] = {
|
|
53
|
+
path: file,
|
|
54
|
+
name: camelCase(name),
|
|
55
|
+
pascalName: pascalCase(name),
|
|
56
|
+
kebabName: kebabCase(name)
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
return Object.values(layoutsMap);
|
|
60
|
+
}
|
|
61
|
+
var uni_layouts_default = defineVitePlugin(async (options) => {
|
|
62
|
+
patchUniLayouts();
|
|
63
|
+
const UniLayouts = await import("@uni-helper/vite-plugin-uni-layouts").then((m) => m.default);
|
|
64
|
+
const { layoutsDirs = ["src/layouts"], defaultLayout = "default", exclude = [] } = options ?? {};
|
|
65
|
+
const plugin = UniLayouts({ layout: defaultLayout });
|
|
66
|
+
const pluginCtx = plugin.ctx;
|
|
67
|
+
if (pluginCtx) pluginCtx.layouts = getLayouts(scanLayoutsDirs(layoutsDirs, exclude), layoutsDirs);
|
|
68
|
+
return plugin;
|
|
69
|
+
});
|
|
70
|
+
//#endregion
|
|
71
|
+
export { uni_layouts_default as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as _$_vixt_core0 from "@vixt/core";
|
|
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 };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { defineVixtModule, isSamePath, resolveLayersDirs } from "@vixt/core";
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import path from "pathe";
|
|
4
|
+
//#region src/node/modules/uni-modules.ts
|
|
5
|
+
function copyUniModules(options, vixt) {
|
|
6
|
+
const { srcDir } = vixt.options;
|
|
7
|
+
const { include, exclude } = options ?? {};
|
|
8
|
+
const { uni_modules = [] } = resolveLayersDirs(vixt._layers);
|
|
9
|
+
const srcUniModulesPath = path.join(srcDir, "uni_modules");
|
|
10
|
+
uni_modules.forEach((uniModulesPath) => {
|
|
11
|
+
fs.readdirSync(uniModulesPath).filter((dir) => {
|
|
12
|
+
if (include?.length) return include.includes(dir);
|
|
13
|
+
if (exclude?.length) return !exclude.includes(dir);
|
|
14
|
+
return true;
|
|
15
|
+
}).forEach((dir) => {
|
|
16
|
+
const srcPath = path.join(uniModulesPath, dir);
|
|
17
|
+
const destPath = path.join(srcUniModulesPath, dir);
|
|
18
|
+
if (srcPath !== destPath) try {
|
|
19
|
+
fs.emptyDirSync(destPath);
|
|
20
|
+
fs.copySync(srcPath, destPath);
|
|
21
|
+
fs.writeFileSync(path.join(destPath, ".gitignore"), "*", "utf-8");
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.error(`Error copying ${srcPath} to ${destPath}:\n`, e);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const name = "vixt:uni-modules";
|
|
29
|
+
var uni_modules_default = defineVixtModule({
|
|
30
|
+
meta: {
|
|
31
|
+
name,
|
|
32
|
+
configKey: "uniModules"
|
|
33
|
+
},
|
|
34
|
+
setup(options, vixt) {
|
|
35
|
+
copyUniModules(options, vixt);
|
|
36
|
+
return {
|
|
37
|
+
name,
|
|
38
|
+
configureServer(server) {
|
|
39
|
+
const { uni_modules = [] } = resolveLayersDirs(vixt._layers.filter((e) => !isSamePath(e.cwd, vixt.options.rootDir)));
|
|
40
|
+
server.watcher.add(uni_modules);
|
|
41
|
+
server.watcher.on("all", (_, file) => {
|
|
42
|
+
if (uni_modules.some((e) => path.normalize(file).match(e))) copyUniModules(options, vixt);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
export { uni_modules_default as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as _$vite from "vite";
|
|
2
|
+
import { ResolvedConfig } from "vite";
|
|
3
|
+
|
|
4
|
+
//#region src/node/modules/uni-patch.d.ts
|
|
5
|
+
/** 增加小程序中vueuse的运行所需 */
|
|
6
|
+
declare function transformMpRuntime(code: string, id: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* 修复h5报错`Cannot assign to read only property '_' of object '#<Object>'`
|
|
9
|
+
* @see https://ask.dcloud.net.cn/question/194973
|
|
10
|
+
*/
|
|
11
|
+
declare function transformH5Runtime(code: string, id: string): string;
|
|
12
|
+
/** 修复app运行白屏,原因是pinia调用了@vue/devtools-kit的setupDevToolsPlugin */
|
|
13
|
+
declare function transformPinia(code: string, id: string): string;
|
|
14
|
+
/** 移除路径中的'../' */
|
|
15
|
+
declare function patchNormalizeNodeModules(): void;
|
|
16
|
+
/**
|
|
17
|
+
* 兼容 unocss^66.1.0 小程序平台的css文件后缀名
|
|
18
|
+
* @see https://github.com/dcloudio/uni-app/pull/5605/files
|
|
19
|
+
*/
|
|
20
|
+
declare function patchAdjustCssExtname(config: ResolvedConfig): void;
|
|
21
|
+
/**
|
|
22
|
+
* fix unocss^66.1.0 hot reload fail `[unocss:global:build:scan] Could not load xxx/src/__uno.css`
|
|
23
|
+
* @see https://github.com/unocss/unocss/issues/4616
|
|
24
|
+
* @see https://github.com/unocss/unocss/pull/4737
|
|
25
|
+
*/
|
|
26
|
+
declare function patchUnocssGlobalBuildScan(config: ResolvedConfig): void;
|
|
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;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { _default as default, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUniPagesTypes, patchUnocssGlobalBuildScan, transformH5Runtime, transformMpRuntime, transformPinia };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { defineVitePlugin } from "@vixt/core";
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import { resolvePathSync } from "mlly";
|
|
4
|
+
import path from "pathe";
|
|
5
|
+
import { normalizePath } from "vite";
|
|
6
|
+
//#region src/node/modules/uni-patch.ts
|
|
7
|
+
/** 增加小程序中vueuse的运行所需 */
|
|
8
|
+
function transformMpRuntime(code, id) {
|
|
9
|
+
if (!id.endsWith("@dcloudio/uni-mp-vue/dist/vue.runtime.esm.js")) return code;
|
|
10
|
+
code += `
|
|
11
|
+
export const render = () => {}
|
|
12
|
+
export const TransitionGroup = {}
|
|
13
|
+
`;
|
|
14
|
+
return code;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 修复h5报错`Cannot assign to read only property '_' of object '#<Object>'`
|
|
18
|
+
* @see https://ask.dcloud.net.cn/question/194973
|
|
19
|
+
*/
|
|
20
|
+
function transformH5Runtime(code, id) {
|
|
21
|
+
if (!id.endsWith("@dcloudio/uni-h5-vue/dist/vue.runtime.esm.js")) return code;
|
|
22
|
+
code = code.replace(`def(children, "_", type);`, `def(children, "_", type, true);`);
|
|
23
|
+
return code;
|
|
24
|
+
}
|
|
25
|
+
/** 修复app运行白屏,原因是pinia调用了@vue/devtools-kit的setupDevToolsPlugin */
|
|
26
|
+
function transformPinia(code, id) {
|
|
27
|
+
if (!id.endsWith("pinia/dist/pinia.mjs")) return code;
|
|
28
|
+
code = code.replace(`import { setupDevtoolsPlugin } from '@vue/devtools-api';`, `function setupDevtoolsPlugin() {};`);
|
|
29
|
+
return code;
|
|
30
|
+
}
|
|
31
|
+
/** 移除路径中的'../' */
|
|
32
|
+
function patchNormalizeNodeModules() {
|
|
33
|
+
const matched = `str = normalizePath(str).replace(NODE_MODULES_REGEX, 'node-modules');`;
|
|
34
|
+
const replaced = `str = normalizePath(str).replace(NODE_MODULES_REGEX, 'node-modules').replace(/\\.\\.\\//g, '');`;
|
|
35
|
+
const codePath = resolvePathSync("@dcloudio/uni-cli-shared/dist/utils.js");
|
|
36
|
+
let code = fs.readFileSync(codePath, "utf-8");
|
|
37
|
+
if (code.includes(matched)) {
|
|
38
|
+
code = code.replace(matched, replaced);
|
|
39
|
+
fs.writeFileSync(codePath, code);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 兼容 unocss^66.1.0 小程序平台的css文件后缀名
|
|
44
|
+
* @see https://github.com/dcloudio/uni-app/pull/5605/files
|
|
45
|
+
*/
|
|
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
|
+
/**
|
|
54
|
+
* fix unocss^66.1.0 hot reload fail `[unocss:global:build:scan] Could not load xxx/src/__uno.css`
|
|
55
|
+
* @see https://github.com/unocss/unocss/issues/4616
|
|
56
|
+
* @see https://github.com/unocss/unocss/pull/4737
|
|
57
|
+
*/
|
|
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
|
+
var uni_patch_default = defineVitePlugin(() => {
|
|
84
|
+
patchNormalizeNodeModules();
|
|
85
|
+
patchUniPagesTypes();
|
|
86
|
+
return [
|
|
87
|
+
{
|
|
88
|
+
name: "vixt:uni-patch-runtime",
|
|
89
|
+
transform(code, id) {
|
|
90
|
+
id = normalizePath(id);
|
|
91
|
+
code = transformMpRuntime(code, id);
|
|
92
|
+
code = transformH5Runtime(code, id);
|
|
93
|
+
code = transformPinia(code, id);
|
|
94
|
+
return code;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "vixt:uni-patch-uni-components",
|
|
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
|
+
}
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
});
|
|
120
|
+
//#endregion
|
|
121
|
+
export { uni_patch_default as default, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUniPagesTypes, patchUnocssGlobalBuildScan, transformH5Runtime, transformMpRuntime, transformPinia };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { t as UniLayoutsOptions } from "./uni-layouts-B1hWgSc_.mjs";
|
|
2
|
+
import { ExtractPluginOptions } from "@vixt/core";
|
|
3
|
+
import Uni from "@dcloudio/vite-plugin-uni";
|
|
4
|
+
import Components from "@uni-helper/vite-plugin-uni-components";
|
|
5
|
+
import Pages from "@uni-helper/vite-plugin-uni-pages";
|
|
6
|
+
|
|
7
|
+
//#region src/node/node.d.ts
|
|
8
|
+
interface UniVixtOptions {
|
|
9
|
+
uni?: ExtractPluginOptions<typeof Uni>;
|
|
10
|
+
/** https://github.com/uni-helper/vite-plugin-uni-pages */
|
|
11
|
+
uniPages?: ExtractPluginOptions<typeof Pages>;
|
|
12
|
+
/** https://github.com/uni-helper/vite-plugin-uni-layouts */
|
|
13
|
+
uniLayouts?: UniLayoutsOptions;
|
|
14
|
+
/** https://github.com/uni-helper/vite-plugin-uni-components */
|
|
15
|
+
uniComponents?: ExtractPluginOptions<typeof Components>;
|
|
16
|
+
}
|
|
17
|
+
declare module '@vixt/core' {
|
|
18
|
+
interface VixtOptions extends UniVixtOptions {}
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { UniVixtOptions };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as _$vite from "vite";
|
|
2
|
+
|
|
3
|
+
//#region src/node/modules/uni-layouts.d.ts
|
|
4
|
+
interface UniLayoutsOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Relative path to the directory to search for page components.
|
|
7
|
+
* @default ['src/layouts']
|
|
8
|
+
*/
|
|
9
|
+
layoutsDirs?: string[];
|
|
10
|
+
/**
|
|
11
|
+
* List of path globs to exclude when resolving pages.
|
|
12
|
+
*/
|
|
13
|
+
exclude?: string[];
|
|
14
|
+
/**
|
|
15
|
+
* Filename of default layout (".vue" is not needed)
|
|
16
|
+
* @default 'default'
|
|
17
|
+
*/
|
|
18
|
+
defaultLayout?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const _default: (options?: UniLayoutsOptions | undefined) => _$vite.PluginOption;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { _default as n, UniLayoutsOptions as t };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import '
|
|
1
|
+
import '../client/client.d'
|
|
2
|
+
import '../node/node.d'
|
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.11.0",
|
|
5
5
|
"author": "SoulLyoko<https://github.com/SoulLyoko>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://soullyoko.github.io/vixt/",
|
|
@@ -14,26 +14,26 @@
|
|
|
14
14
|
"uni-app"
|
|
15
15
|
],
|
|
16
16
|
"exports": {
|
|
17
|
-
".": "./dist/index.mjs",
|
|
17
|
+
".": "./dist/node/index.mjs",
|
|
18
18
|
"./client/*": "./dist/client/*.js",
|
|
19
19
|
"./types": "./dist/types/index.d.ts",
|
|
20
20
|
"./package.json": "./package.json"
|
|
21
21
|
},
|
|
22
|
-
"main": "./dist/index.mjs",
|
|
22
|
+
"main": "./dist/node/index.mjs",
|
|
23
23
|
"types": "./dist/types/index.d.ts",
|
|
24
24
|
"files": [
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@dcloudio/types": "^3.4.28",
|
|
29
|
-
"@uni-helper/uni-app-types": "^1.0.0
|
|
29
|
+
"@uni-helper/uni-app-types": "^1.0.0",
|
|
30
30
|
"@uni-helper/uni-use": "^0.19.17",
|
|
31
31
|
"@uni-helper/unocss-preset-uni": "^0.2.11",
|
|
32
32
|
"@uni-helper/vite-plugin-uni-components": "0.2.6",
|
|
33
33
|
"@uni-helper/vite-plugin-uni-layouts": "^0.1.11",
|
|
34
34
|
"@uni-helper/vite-plugin-uni-pages": "^0.3.24",
|
|
35
35
|
"unocss-applet": "^0.12.2",
|
|
36
|
-
"@vixt/core": "0.
|
|
37
|
-
"@vixt/vue": "0.
|
|
36
|
+
"@vixt/core": "0.11.0",
|
|
37
|
+
"@vixt/vue": "0.11.0"
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { defineVixtPlugin } from "@vixt/core/client";
|
|
2
|
-
import { createPinia } from "pinia";
|
|
3
|
-
import { createPersistedState } from "pinia-plugin-persistedstate";
|
|
4
|
-
//#region src/client/plugins/pinia.ts
|
|
5
|
-
var pinia_default = defineVixtPlugin({
|
|
6
|
-
name: "vixt:pinia",
|
|
7
|
-
setup(vixt) {
|
|
8
|
-
const { app, appConfig } = vixt;
|
|
9
|
-
const pinia = createPinia();
|
|
10
|
-
pinia.use(createPersistedState({
|
|
11
|
-
storage: {
|
|
12
|
-
getItem: uni.getStorageSync,
|
|
13
|
-
setItem: uni.setStorageSync
|
|
14
|
-
},
|
|
15
|
-
...appConfig.piniaPersistedState
|
|
16
|
-
}));
|
|
17
|
-
app.use(pinia);
|
|
18
|
-
vixt.pinia = pinia;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
//#endregion
|
|
22
|
-
export { pinia_default as default };
|
package/dist/index.mjs
DELETED
|
@@ -1,280 +0,0 @@
|
|
|
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";
|
|
17
|
-
//#region src/modules/uni-patch.ts
|
|
18
|
-
/** 增加小程序中vueuse的运行所需 */
|
|
19
|
-
function transformMpRuntime(code, id) {
|
|
20
|
-
if (!id.endsWith("@dcloudio/uni-mp-vue/dist/vue.runtime.esm.js")) return code;
|
|
21
|
-
code += `
|
|
22
|
-
export const render = () => {}
|
|
23
|
-
export const TransitionGroup = {}
|
|
24
|
-
`;
|
|
25
|
-
return code;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* 修复h5报错`Cannot assign to read only property '_' of object '#<Object>'`
|
|
29
|
-
* @see https://ask.dcloud.net.cn/question/194973
|
|
30
|
-
*/
|
|
31
|
-
function transformH5Runtime(code, id) {
|
|
32
|
-
if (!id.endsWith("@dcloudio/uni-h5-vue/dist/vue.runtime.esm.js")) return code;
|
|
33
|
-
code = code.replace(`def(children, "_", type);`, `def(children, "_", type, true);`);
|
|
34
|
-
return code;
|
|
35
|
-
}
|
|
36
|
-
/** 修复app运行白屏,原因是pinia调用了@vue/devtools-kit的setupDevToolsPlugin */
|
|
37
|
-
function transformPinia(code, id) {
|
|
38
|
-
if (!id.endsWith("pinia/dist/pinia.mjs")) return code;
|
|
39
|
-
code = code.replace(`import { setupDevtoolsPlugin } from '@vue/devtools-api';`, `function setupDevtoolsPlugin() {};`);
|
|
40
|
-
return code;
|
|
41
|
-
}
|
|
42
|
-
/** 移除路径中的'../' */
|
|
43
|
-
function patchNormalizeNodeModules() {
|
|
44
|
-
const matched = `str = normalizePath(str).replace(NODE_MODULES_REGEX, 'node-modules');`;
|
|
45
|
-
const replaced = `str = normalizePath(str).replace(NODE_MODULES_REGEX, 'node-modules').replace(/\\.\\.\\//g, '');`;
|
|
46
|
-
const codePath = resolvePathSync("@dcloudio/uni-cli-shared/dist/utils.js");
|
|
47
|
-
let code = fs.readFileSync(codePath, "utf-8");
|
|
48
|
-
if (code.includes(matched)) {
|
|
49
|
-
code = code.replace(matched, replaced);
|
|
50
|
-
fs.writeFileSync(codePath, code);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* 兼容 unocss^66.1.0 小程序平台的css文件后缀名
|
|
55
|
-
* @see https://github.com/dcloudio/uni-app/pull/5605/files
|
|
56
|
-
*/
|
|
57
|
-
function patchAdjustCssExtname(config) {
|
|
58
|
-
const plugin = config.plugins.find((p) => p.name === "uni:adjust-css-extname");
|
|
59
|
-
if (plugin && typeof plugin.generateBundle === "function") plugin.generateBundle = {
|
|
60
|
-
order: "post",
|
|
61
|
-
handler: plugin.generateBundle
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* fix unocss^66.1.0 hot reload fail `[unocss:global:build:scan] Could not load xxx/src/__uno.css`
|
|
66
|
-
* @see https://github.com/unocss/unocss/issues/4616
|
|
67
|
-
* @see https://github.com/unocss/unocss/pull/4737
|
|
68
|
-
*/
|
|
69
|
-
function patchUnocssGlobalBuildScan(config) {
|
|
70
|
-
const plugin = config.plugins.find((p) => p.name === "unocss:global:build:scan");
|
|
71
|
-
if (plugin) plugin.shouldTransformCachedModule = ({ id }) => id.endsWith("main.ts");
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* fix `@uni-helper/vite-plugin-uni-components` load slowly
|
|
75
|
-
* @see https://github.com/uni-helper/vite-plugin-uni-components/blob/main/packages/core/src/index.ts#L27
|
|
76
|
-
*/
|
|
77
|
-
function patchUniComponents(config) {
|
|
78
|
-
if (JSON.stringify(config.build.watch) === "{}") config.build.watch = null;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* fix `@uni-helper/vite-plugin-uni-pages` client types
|
|
82
|
-
* @see https://github.com/uni-helper/vite-plugin-uni-pages/blob/main/packages/core/client.d.ts#L4
|
|
83
|
-
*/
|
|
84
|
-
function patchUniPagesTypes() {
|
|
85
|
-
const matched = ` import type { SubPackage } from './src/config/types/index'\n import type { PageMetaDatum } from './src/types'`;
|
|
86
|
-
const replaced = ` import type { PageMetaDatum, SubPackage } from '@uni-helper/vite-plugin-uni-pages'`;
|
|
87
|
-
const codePath = path.resolve(resolvePathSync("@uni-helper/vite-plugin-uni-pages"), "../../client.d.ts");
|
|
88
|
-
let code = codePath && fs.readFileSync(codePath, "utf-8");
|
|
89
|
-
if (code.includes(matched)) {
|
|
90
|
-
code = code.replace(matched, replaced);
|
|
91
|
-
fs.outputFileSync(codePath, code);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const uniPatch = defineVitePlugin(() => {
|
|
95
|
-
patchNormalizeNodeModules();
|
|
96
|
-
patchUniPagesTypes();
|
|
97
|
-
return [
|
|
98
|
-
{
|
|
99
|
-
name: "vixt:uni-patch-runtime",
|
|
100
|
-
transform(code, id) {
|
|
101
|
-
id = normalizePath(id);
|
|
102
|
-
code = transformMpRuntime(code, id);
|
|
103
|
-
code = transformH5Runtime(code, id);
|
|
104
|
-
code = transformPinia(code, id);
|
|
105
|
-
return code;
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: "vixt:uni-patch-uni-components",
|
|
110
|
-
configResolved(config) {
|
|
111
|
-
patchUniComponents(config);
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name: "vixt:uni-patch-unocss-global-build-scan",
|
|
116
|
-
apply: "build",
|
|
117
|
-
enforce: "pre",
|
|
118
|
-
configResolved(config) {
|
|
119
|
-
patchUnocssGlobalBuildScan(config);
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
name: "vixt:uni-patch-adjust-css-extname",
|
|
124
|
-
enforce: "post",
|
|
125
|
-
configResolved(config) {
|
|
126
|
-
patchAdjustCssExtname(config);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
];
|
|
130
|
-
});
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region src/modules/uni-use.ts
|
|
133
|
-
let _cache;
|
|
134
|
-
function uniVueUseResolver() {
|
|
135
|
-
const excluded = [
|
|
136
|
-
"toRefs",
|
|
137
|
-
"utils",
|
|
138
|
-
"toRef",
|
|
139
|
-
"toValue",
|
|
140
|
-
"tryOnScopeDispose",
|
|
141
|
-
"useNetwork",
|
|
142
|
-
"useOnline",
|
|
143
|
-
"usePreferredDark",
|
|
144
|
-
"useStorage",
|
|
145
|
-
"useStorageAsync"
|
|
146
|
-
];
|
|
147
|
-
if (!_cache) {
|
|
148
|
-
let indexesJson;
|
|
149
|
-
try {
|
|
150
|
-
const corePath = resolveModule("@vueuse/core") || process.cwd();
|
|
151
|
-
const path = resolveModule("@vueuse/core/indexes.json") || resolveModule("@vueuse/metadata/index.json") || resolveModule("@vueuse/metadata/index.json", { paths: [corePath] });
|
|
152
|
-
indexesJson = JSON.parse(readFileSync(path, "utf-8"));
|
|
153
|
-
} catch (error) {
|
|
154
|
-
console.error(error);
|
|
155
|
-
throw new Error("[auto-import] failed to load @vueuse/core, have you installed it?");
|
|
156
|
-
}
|
|
157
|
-
if (indexesJson) _cache = {
|
|
158
|
-
"@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)),
|
|
159
|
-
...uniuseAutoImports()
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
return _cache || {};
|
|
163
|
-
}
|
|
164
|
-
var preset_uni_default = defineVixtModule({
|
|
165
|
-
meta: { name: "vixt:preset-uni" },
|
|
166
|
-
setup(_, vixt) {
|
|
167
|
-
const { components = [], composables = [], constants = [], utils = [], stores = [] } = resolveLayersDirs([...vixt._layers].reverse());
|
|
168
|
-
const { buildTypesDir } = vixt.options;
|
|
169
|
-
const defaultOptions = {
|
|
170
|
-
uni: {},
|
|
171
|
-
uniPages: { dts: `${buildTypesDir}/uni-pages.d.ts` },
|
|
172
|
-
uniLayouts: {},
|
|
173
|
-
uniComponents: {
|
|
174
|
-
dts: `${buildTypesDir}/components.d.ts`,
|
|
175
|
-
dirs: [...components].reverse(),
|
|
176
|
-
directoryAsNamespace: true,
|
|
177
|
-
collapseSamePrefixes: true
|
|
178
|
-
},
|
|
179
|
-
imports: {
|
|
180
|
-
imports: [
|
|
181
|
-
"vue",
|
|
182
|
-
"uni-app",
|
|
183
|
-
"pinia",
|
|
184
|
-
uniVueUseResolver(),
|
|
185
|
-
VixtClientAutoImports
|
|
186
|
-
],
|
|
187
|
-
dts: `${buildTypesDir}/auto-imports.d.ts`,
|
|
188
|
-
dirs: [
|
|
189
|
-
composables,
|
|
190
|
-
constants,
|
|
191
|
-
stores,
|
|
192
|
-
utils
|
|
193
|
-
].flat(),
|
|
194
|
-
vueTemplate: true
|
|
195
|
-
},
|
|
196
|
-
unocss: {}
|
|
197
|
-
};
|
|
198
|
-
const options = vixt.options = defu(vixt.options, defaultOptions);
|
|
199
|
-
return [
|
|
200
|
-
Pages(options.uniPages),
|
|
201
|
-
Layouts(options.uniLayouts),
|
|
202
|
-
Components(options.uniComponents),
|
|
203
|
-
AutoImport(options.imports),
|
|
204
|
-
UnoCSS(options.unocss),
|
|
205
|
-
uniPatch(),
|
|
206
|
-
(Uni?.default ?? Uni)(options.uni)
|
|
207
|
-
];
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
//#endregion
|
|
211
|
-
//#region src/modules/uni-modules.ts
|
|
212
|
-
function copyUniModules(options, vixt) {
|
|
213
|
-
const { srcDir } = vixt.options;
|
|
214
|
-
const { include, exclude } = options ?? {};
|
|
215
|
-
const { uni_modules = [] } = resolveLayersDirs(vixt._layers);
|
|
216
|
-
const srcUniModulesPath = path.join(srcDir, "uni_modules");
|
|
217
|
-
uni_modules.forEach((uniModulesPath) => {
|
|
218
|
-
fs.readdirSync(uniModulesPath).filter((dir) => {
|
|
219
|
-
if (include?.length) return include.includes(dir);
|
|
220
|
-
if (exclude?.length) return !exclude.includes(dir);
|
|
221
|
-
return true;
|
|
222
|
-
}).forEach((dir) => {
|
|
223
|
-
const srcPath = path.join(uniModulesPath, dir);
|
|
224
|
-
const destPath = path.join(srcUniModulesPath, dir);
|
|
225
|
-
if (srcPath !== destPath) try {
|
|
226
|
-
fs.emptyDirSync(destPath);
|
|
227
|
-
fs.copySync(srcPath, destPath);
|
|
228
|
-
fs.writeFileSync(path.join(destPath, ".gitignore"), "*", "utf-8");
|
|
229
|
-
} catch (e) {
|
|
230
|
-
console.error(`Error copying ${srcPath} to ${destPath}:\n`, e);
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
const name = "vixt:uni-modules";
|
|
236
|
-
var uni_modules_default = defineVixtModule({
|
|
237
|
-
meta: {
|
|
238
|
-
name,
|
|
239
|
-
configKey: "uniModules"
|
|
240
|
-
},
|
|
241
|
-
setup(options, vixt) {
|
|
242
|
-
copyUniModules(options, vixt);
|
|
243
|
-
return {
|
|
244
|
-
name,
|
|
245
|
-
configureServer(server) {
|
|
246
|
-
const { uni_modules = [] } = resolveLayersDirs(vixt._layers.filter((e) => !isSamePath(e.cwd, vixt.options.rootDir)));
|
|
247
|
-
server.watcher.add(uni_modules);
|
|
248
|
-
server.watcher.on("all", (_, file) => {
|
|
249
|
-
if (uni_modules.some((e) => path.normalize(file).match(e))) copyUniModules(options, vixt);
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
//#endregion
|
|
256
|
-
//#region src/index.ts
|
|
257
|
-
const plugins = ["@vixt/uni/client/plugins/pinia", "@vixt/uni/client/plugins/router"];
|
|
258
|
-
var src_default = createVixtPlugin({ defaults: {
|
|
259
|
-
modules: [preset_uni_default, uni_modules_default],
|
|
260
|
-
plugins,
|
|
261
|
-
app: {
|
|
262
|
-
entryFile: "main.ts",
|
|
263
|
-
entryCode: fs.readFileSync(resolvePathSync("@vixt/uni/client/entry"), "utf-8"),
|
|
264
|
-
head: { meta: [{ charset: "utf-8" }, {
|
|
265
|
-
name: "viewport",
|
|
266
|
-
content: "width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
|
267
|
-
}] }
|
|
268
|
-
},
|
|
269
|
-
typescript: { tsConfig: {
|
|
270
|
-
compilerOptions: { types: [
|
|
271
|
-
"@vixt/uni/types",
|
|
272
|
-
"@dcloudio/types",
|
|
273
|
-
"@uni-helper/uni-app-types"
|
|
274
|
-
] },
|
|
275
|
-
vueCompilerOptions: { plugins: ["@uni-helper/uni-app-types/volar-plugin"] }
|
|
276
|
-
} },
|
|
277
|
-
vite: { optimizeDeps: { exclude: plugins } }
|
|
278
|
-
} });
|
|
279
|
-
//#endregion
|
|
280
|
-
export { src_default as default };
|
package/dist/types/client.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/types/node.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
}
|