@vft/business 0.0.5 → 0.0.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/constants/navigation-url/me.ts +8 -1
- package/constants/navigation-url/utility.ts +1 -0
- package/package.json +2 -2
- package/vite/dist/index.cjs +7 -0
- package/vite/dist/index.d.ts +1 -0
- package/vite/dist/index.mjs +15 -0
- package/vite/node_modules/.bin/browserslist +17 -0
- package/vite/node_modules/.bin/rollup +17 -0
- package/vite/node_modules/.bin/tsc +17 -0
- package/vite/node_modules/.bin/tsserver +17 -0
- package/vite/node_modules/.bin/unbuild +17 -0
- package/vite/package.json +22 -0
- package/vite/src/common-config.ts +7 -0
- package/vite/src/comp/comp-resolver.ts +197 -0
- package/vite/src/comp/custom-config.ts +128 -0
- package/vite/src/comp/index.ts +2 -0
- package/vite/src/comp/vite-config.ts +30 -0
- package/vite/src/index.ts +3 -0
- package/vite/src/utils.ts +12 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const list = [
|
|
2
|
+
['合肥高新租房', 'https://gzfgl.hfgx.com/lhm/gateway/index'],
|
|
2
3
|
['小米账号登录', 'https://account.xiaomi.com/fe/service/login/password'],
|
|
3
4
|
[
|
|
4
5
|
'谷歌广告',
|
|
@@ -7,11 +8,17 @@ const list = [
|
|
|
7
8
|
['百度站长', 'https://ziyuan.baidu.com/linksubmit/index'],
|
|
8
9
|
[
|
|
9
10
|
'百度联盟',
|
|
10
|
-
'https://
|
|
11
|
+
'https://unionsudo yum -y update\n.baidu.com/bqt/#/?fromPage=%2Fbqt%2Fmodules.html#/account/info?mioflyFx',
|
|
11
12
|
],
|
|
12
13
|
['阿里云服务器', 'https://account.aliyun.com/login/login.htm'],
|
|
13
14
|
['中小学教师资格考试', 'https://ntce.neea.edu.cn/'],
|
|
14
15
|
['腾讯云域名', 'https://console.cloud.tencent.com/domain'],
|
|
16
|
+
['七彩课堂', 'https://www.timebook.cc/column84'],
|
|
17
|
+
[
|
|
18
|
+
'国家中小学智慧教育平台',
|
|
19
|
+
'https://basic.smartedu.cn/tchMaterial?defaultTag=dfb9da8a-2ae2-4b2e-a733-687e0252443f%2F8c9f2e5c-e403-4f55-812c-289021ac66a0%2F9d7edc22-dfc0-4653-95a5-cbe7e4908755%2F0e4e66fc-ae0b-451e-9a91-9b7d86c0752e',
|
|
20
|
+
],
|
|
21
|
+
['国家普通话报名系统', 'https://bm.cltt.org/#/documents-print'],
|
|
15
22
|
];
|
|
16
23
|
|
|
17
24
|
export default {
|
|
@@ -32,6 +32,7 @@ const list = [
|
|
|
32
32
|
],
|
|
33
33
|
['免费资源导航', 'https://www.thosefree.com/'],
|
|
34
34
|
['公众号音频提取', 'https://tool.wpjam.com/mp_audio/'],
|
|
35
|
+
['https签名', 'https://www.ihuandu.com/ziqian/'],
|
|
35
36
|
[
|
|
36
37
|
'模拟api接口',
|
|
37
38
|
'https://api.apiopen.top/swagger/index.html#/%E5%BC%80%E6%94%BE%E6%8E%A5%E5%8F%A3/get_getImages',
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vft/business",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"lodash": "*",
|
|
6
6
|
"jsencrypt": "*",
|
|
7
|
-
"@vft/utils": "0.0.
|
|
7
|
+
"@vft/utils": "0.0.55"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"pub": "tsx ../scripts/build/src/publish.ts --pkg business"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
module.exports = require("/Users/wfly/Documents/code/wfly/node_modules/.pnpm/jiti@1.20.0/node_modules/jiti/lib/index.js")(null, {
|
|
2
|
+
"esmResolve": true,
|
|
3
|
+
"interopDefault": true,
|
|
4
|
+
"alias": {
|
|
5
|
+
"@vft/business-vite": "/Users/wfly/Documents/code/wfly/business/vite"
|
|
6
|
+
}
|
|
7
|
+
})("/Users/wfly/Documents/code/wfly/business/vite/src/index.ts")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "/Users/wfly/Documents/code/wfly/business/vite/src/index";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import jiti from "file:///Users/wfly/Documents/code/wfly/node_modules/.pnpm/jiti@1.20.0/node_modules/jiti/lib/index.js";
|
|
2
|
+
|
|
3
|
+
/** @type {import("/Users/wfly/Documents/code/wfly/business/vite/src/index")} */
|
|
4
|
+
const _module = jiti(null, {
|
|
5
|
+
"esmResolve": true,
|
|
6
|
+
"interopDefault": true,
|
|
7
|
+
"alias": {
|
|
8
|
+
"@vft/business-vite": "/Users/wfly/Documents/code/wfly/business/vite"
|
|
9
|
+
}
|
|
10
|
+
})("/Users/wfly/Documents/code/wfly/business/vite/src/index.ts");
|
|
11
|
+
|
|
12
|
+
export const COMMON_CUSTOM_CONFIG = _module.COMMON_CUSTOM_CONFIG;
|
|
13
|
+
export const deepMerge = _module.deepMerge;
|
|
14
|
+
export const customCompConfig = _module.customCompConfig;
|
|
15
|
+
export const viteCompConfig = _module.viteCompConfig;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/Users/wfly/Documents/code/wfly/node_modules/.pnpm/browserslist@4.22.1/node_modules/browserslist/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/browserslist@4.22.1/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="/Users/wfly/Documents/code/wfly/node_modules/.pnpm/browserslist@4.22.1/node_modules/browserslist/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/browserslist@4.22.1/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/browserslist@4.22.1/node_modules/browserslist/cli.js" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../../../../node_modules/.pnpm/browserslist@4.22.1/node_modules/browserslist/cli.js" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/Users/wfly/Documents/code/wfly/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/bin/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/rollup@3.29.4/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="/Users/wfly/Documents/code/wfly/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/bin/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/rollup@3.29.4/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/bin/rollup" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../../../../node_modules/.pnpm/rollup@3.29.4/node_modules/rollup/dist/bin/rollup" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/Users/wfly/Documents/code/wfly/node_modules/.pnpm/typescript@5.1.6/node_modules/typescript/bin/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/typescript@5.1.6/node_modules/typescript/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/typescript@5.1.6/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="/Users/wfly/Documents/code/wfly/node_modules/.pnpm/typescript@5.1.6/node_modules/typescript/bin/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/typescript@5.1.6/node_modules/typescript/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/typescript@5.1.6/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/typescript@5.1.6/node_modules/typescript/bin/tsc" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../../../../node_modules/.pnpm/typescript@5.1.6/node_modules/typescript/bin/tsc" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/Users/wfly/Documents/code/wfly/node_modules/.pnpm/typescript@5.1.6/node_modules/typescript/bin/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/typescript@5.1.6/node_modules/typescript/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/typescript@5.1.6/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="/Users/wfly/Documents/code/wfly/node_modules/.pnpm/typescript@5.1.6/node_modules/typescript/bin/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/typescript@5.1.6/node_modules/typescript/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/typescript@5.1.6/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/typescript@5.1.6/node_modules/typescript/bin/tsserver" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../../../../node_modules/.pnpm/typescript@5.1.6/node_modules/typescript/bin/tsserver" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/Users/wfly/Documents/code/wfly/node_modules/.pnpm/unbuild@2.0.0_sass@1.67.0_typescript@5.1.6/node_modules/unbuild/dist/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/unbuild@2.0.0_sass@1.67.0_typescript@5.1.6/node_modules/unbuild/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/unbuild@2.0.0_sass@1.67.0_typescript@5.1.6/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="/Users/wfly/Documents/code/wfly/node_modules/.pnpm/unbuild@2.0.0_sass@1.67.0_typescript@5.1.6/node_modules/unbuild/dist/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/unbuild@2.0.0_sass@1.67.0_typescript@5.1.6/node_modules/unbuild/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/unbuild@2.0.0_sass@1.67.0_typescript@5.1.6/node_modules:/Users/wfly/Documents/code/wfly/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/unbuild@2.0.0_sass@1.67.0_typescript@5.1.6/node_modules/unbuild/dist/cli.mjs" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../../../../node_modules/.pnpm/unbuild@2.0.0_sass@1.67.0_typescript@5.1.6/node_modules/unbuild/dist/cli.mjs" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vft/business-vite",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./dist/index.cjs",
|
|
5
|
+
"module": "./dist/index.mjs",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"require": "./dist/index.cjs",
|
|
11
|
+
"import": "./dist/index.mjs"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "unbuild --stub",
|
|
16
|
+
"postinstall": "unbuild --stub",
|
|
17
|
+
"build": "unbuild --stub"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"unbuild": "2.0.0"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { upperFirst } from 'lodash';
|
|
2
|
+
|
|
3
|
+
export interface ImportInfo {
|
|
4
|
+
as?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
from: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type SideEffectsInfo =
|
|
10
|
+
| (ImportInfo | string)[]
|
|
11
|
+
| ImportInfo
|
|
12
|
+
| string
|
|
13
|
+
| undefined;
|
|
14
|
+
|
|
15
|
+
export interface ComponentInfo extends ImportInfo {
|
|
16
|
+
sideEffects?: SideEffectsInfo;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type Awaitable<T> = T | PromiseLike<T>;
|
|
20
|
+
|
|
21
|
+
export type ComponentResolveResult = Awaitable<
|
|
22
|
+
string | ComponentInfo | null | undefined | void
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
export type ComponentResolverFunction = (
|
|
26
|
+
name: string,
|
|
27
|
+
) => ComponentResolveResult;
|
|
28
|
+
|
|
29
|
+
export interface ComponentResolverObject {
|
|
30
|
+
type: 'component' | 'directive';
|
|
31
|
+
resolve: ComponentResolverFunction;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type ComponentResolver =
|
|
35
|
+
| ComponentResolverFunction
|
|
36
|
+
| ComponentResolverObject;
|
|
37
|
+
|
|
38
|
+
function kebabCase(key: string) {
|
|
39
|
+
const result = key.replace(/([A-Z])/g, ' $1').trim();
|
|
40
|
+
return result.split(' ').join('-').toLowerCase();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface CompResolverOptions {
|
|
44
|
+
/**
|
|
45
|
+
* import style css or sass with components
|
|
46
|
+
*
|
|
47
|
+
* @default 'css'
|
|
48
|
+
*/
|
|
49
|
+
importStyle?: boolean | 'css' | 'sass';
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* use commonjs lib & source css or scss for ssr
|
|
53
|
+
*/
|
|
54
|
+
ssr?: boolean;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* auto import for directives
|
|
58
|
+
*
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
directives?: boolean;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* exclude component name, if match do not resolve the name
|
|
65
|
+
*/
|
|
66
|
+
exclude?: RegExp;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* a list of component names that have no styles, so resolving their styles file should be prevented
|
|
70
|
+
*/
|
|
71
|
+
noStylesComponents?: string[];
|
|
72
|
+
/**
|
|
73
|
+
* conponent
|
|
74
|
+
*/
|
|
75
|
+
compName?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
type CompResolverOptionsResolved = Required<
|
|
79
|
+
Omit<CompResolverOptions, 'exclude'>
|
|
80
|
+
> &
|
|
81
|
+
Pick<CompResolverOptions, 'exclude'>;
|
|
82
|
+
|
|
83
|
+
function getSideEffects(
|
|
84
|
+
dirName: string,
|
|
85
|
+
options: CompResolverOptionsResolved,
|
|
86
|
+
): SideEffectsInfo | undefined {
|
|
87
|
+
const { importStyle, ssr } = options;
|
|
88
|
+
const themeFolder = options.compName + '/theme-style';
|
|
89
|
+
const esComponentsFolder = options.compName + '/es/components';
|
|
90
|
+
|
|
91
|
+
if (importStyle === 'sass') {
|
|
92
|
+
return ssr
|
|
93
|
+
? [`${themeFolder}/src/base.scss`, `${themeFolder}/src/${dirName}.scss`]
|
|
94
|
+
: [
|
|
95
|
+
`${esComponentsFolder}/base/style/index`,
|
|
96
|
+
`${esComponentsFolder}/${dirName}/style/index`,
|
|
97
|
+
];
|
|
98
|
+
} else if (importStyle === true || importStyle === 'css') {
|
|
99
|
+
return ssr
|
|
100
|
+
? [`${themeFolder}/base.css`, `${themeFolder}/el-${dirName}.css`]
|
|
101
|
+
: [
|
|
102
|
+
`${esComponentsFolder}/base/style/css`,
|
|
103
|
+
`${esComponentsFolder}/${dirName}/style/css`,
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function resolveComponent(
|
|
109
|
+
name: string,
|
|
110
|
+
options: CompResolverOptionsResolved,
|
|
111
|
+
): ComponentInfo | undefined {
|
|
112
|
+
if (options.exclude && name.match(options.exclude)) return;
|
|
113
|
+
|
|
114
|
+
const reg = new RegExp(`^${upperFirst(options.compName)}[A-Z]`);
|
|
115
|
+
if (!name.match(reg)) return;
|
|
116
|
+
|
|
117
|
+
const partialName = kebabCase(name.slice(options.compName.length)); // VftTableColumn -> table-column
|
|
118
|
+
const { ssr } = options;
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
name,
|
|
122
|
+
from: `${options.compName}/${ssr ? 'lib' : 'es'}`,
|
|
123
|
+
sideEffects: getSideEffects(partialName, options),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function resolveDirective(
|
|
128
|
+
name: string,
|
|
129
|
+
options: CompResolverOptionsResolved,
|
|
130
|
+
): ComponentInfo | undefined {
|
|
131
|
+
if (!options.directives) return;
|
|
132
|
+
|
|
133
|
+
const directives: Record<string, { importName: string; styleName: string }> =
|
|
134
|
+
{
|
|
135
|
+
Loading: { importName: 'VftLoadingDirective', styleName: 'loading' },
|
|
136
|
+
Popover: { importName: 'VftPopoverDirective', styleName: 'popover' },
|
|
137
|
+
InfiniteScroll: {
|
|
138
|
+
importName: 'VftInfiniteScroll',
|
|
139
|
+
styleName: 'infinite-scroll',
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const directive = directives[name];
|
|
144
|
+
|
|
145
|
+
if (!directive) return;
|
|
146
|
+
|
|
147
|
+
const { ssr } = options;
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
name: directive.importName,
|
|
151
|
+
from: `${options.compName}/${ssr ? 'lib' : 'es'}`,
|
|
152
|
+
sideEffects: getSideEffects(directive.styleName, options),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const noStylesComponents = ['VftAutoResizer'];
|
|
157
|
+
|
|
158
|
+
export function CompResolver(
|
|
159
|
+
options: CompResolverOptions = {},
|
|
160
|
+
): ComponentResolver[] {
|
|
161
|
+
let optionsResolved: CompResolverOptionsResolved;
|
|
162
|
+
|
|
163
|
+
async function resolveOptions() {
|
|
164
|
+
if (optionsResolved) return optionsResolved;
|
|
165
|
+
optionsResolved = {
|
|
166
|
+
compName: 'vft',
|
|
167
|
+
ssr: false,
|
|
168
|
+
importStyle: 'css',
|
|
169
|
+
directives: true,
|
|
170
|
+
exclude: undefined,
|
|
171
|
+
noStylesComponents: options.noStylesComponents || [],
|
|
172
|
+
...options,
|
|
173
|
+
};
|
|
174
|
+
return optionsResolved;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return [
|
|
178
|
+
{
|
|
179
|
+
type: 'component',
|
|
180
|
+
resolve: async (name: string) => {
|
|
181
|
+
const options = await resolveOptions();
|
|
182
|
+
|
|
183
|
+
if (
|
|
184
|
+
[...options.noStylesComponents, ...noStylesComponents].includes(name)
|
|
185
|
+
)
|
|
186
|
+
return resolveComponent(name, { ...options, importStyle: false });
|
|
187
|
+
else return resolveComponent(name, options);
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
type: 'directive',
|
|
192
|
+
resolve: async (name: string) => {
|
|
193
|
+
return resolveDirective(name, await resolveOptions());
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
];
|
|
197
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { CompResolver } from './comp-resolver';
|
|
2
|
+
|
|
3
|
+
export function customCompConfig({
|
|
4
|
+
addAutoImport = true,
|
|
5
|
+
addAd = true,
|
|
6
|
+
addSass = true,
|
|
7
|
+
addCompress = true,
|
|
8
|
+
addComp = true,
|
|
9
|
+
addGlobalConfig = true,
|
|
10
|
+
addPwa = true,
|
|
11
|
+
addPageRoute = true,
|
|
12
|
+
pwaCfg = {
|
|
13
|
+
name: '',
|
|
14
|
+
short_name: '',
|
|
15
|
+
},
|
|
16
|
+
pageRouteCfg = {
|
|
17
|
+
basePageDir: '',
|
|
18
|
+
baseLayout: '',
|
|
19
|
+
dirs: '',
|
|
20
|
+
},
|
|
21
|
+
}) {
|
|
22
|
+
const { name, short_name } = pwaCfg;
|
|
23
|
+
const { basePageDir, baseLayout, dirs } = pageRouteCfg;
|
|
24
|
+
const autoImportCfg = addAutoImport
|
|
25
|
+
? {
|
|
26
|
+
autoImportOption: {
|
|
27
|
+
imports: [
|
|
28
|
+
{
|
|
29
|
+
vft: ['Message'],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
dirs: ['./src/utils'],
|
|
33
|
+
addPiniaPersist: true,
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
: undefined;
|
|
37
|
+
|
|
38
|
+
const adConfig = addAd
|
|
39
|
+
? {
|
|
40
|
+
htmlOption: {
|
|
41
|
+
inject: {
|
|
42
|
+
tags: [
|
|
43
|
+
{
|
|
44
|
+
tag: 'script',
|
|
45
|
+
attrs: {
|
|
46
|
+
async: true,
|
|
47
|
+
crossorigin: 'anonymous',
|
|
48
|
+
src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4046301015031382',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
: undefined;
|
|
56
|
+
|
|
57
|
+
const sassCfg = addSass
|
|
58
|
+
? {
|
|
59
|
+
scssVarsData: '@use "src/styles/vars.scss" as *;',
|
|
60
|
+
}
|
|
61
|
+
: undefined;
|
|
62
|
+
|
|
63
|
+
const compressCfg = addCompress
|
|
64
|
+
? {
|
|
65
|
+
compressOptions: {
|
|
66
|
+
exclude: [/\.(png|jepg|jpg|ico)$/, /\.(gz)$/],
|
|
67
|
+
deleteOriginalAssets: false,
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
: undefined;
|
|
71
|
+
|
|
72
|
+
const autoComponent = addComp
|
|
73
|
+
? {
|
|
74
|
+
autoComponentsOption: {
|
|
75
|
+
resolvers: [
|
|
76
|
+
CompResolver({
|
|
77
|
+
importStyle: 'sass',
|
|
78
|
+
directives: true,
|
|
79
|
+
}),
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
: undefined;
|
|
84
|
+
|
|
85
|
+
const globalConfig = addGlobalConfig
|
|
86
|
+
? {
|
|
87
|
+
globalConfig: true,
|
|
88
|
+
}
|
|
89
|
+
: undefined;
|
|
90
|
+
|
|
91
|
+
const pwaConfig = addPwa
|
|
92
|
+
? {
|
|
93
|
+
pwaCfg: {
|
|
94
|
+
manifest: {
|
|
95
|
+
name,
|
|
96
|
+
short_name,
|
|
97
|
+
},
|
|
98
|
+
devOptions: {
|
|
99
|
+
enabled: false,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
: undefined;
|
|
104
|
+
|
|
105
|
+
const pageRouteConfig = addPageRoute
|
|
106
|
+
? {
|
|
107
|
+
pageRouterOption: {
|
|
108
|
+
basePageDir,
|
|
109
|
+
baseLayout,
|
|
110
|
+
dirs,
|
|
111
|
+
extensions: ['vue', 'md'],
|
|
112
|
+
exclude: ['**/components/*.vue'],
|
|
113
|
+
},
|
|
114
|
+
}
|
|
115
|
+
: undefined;
|
|
116
|
+
|
|
117
|
+
return Object.assign(
|
|
118
|
+
{},
|
|
119
|
+
autoImportCfg,
|
|
120
|
+
adConfig,
|
|
121
|
+
sassCfg,
|
|
122
|
+
compressCfg,
|
|
123
|
+
autoComponent,
|
|
124
|
+
globalConfig,
|
|
125
|
+
pwaConfig,
|
|
126
|
+
pageRouteConfig,
|
|
127
|
+
);
|
|
128
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
2
|
+
|
|
3
|
+
export function viteCompConfig({
|
|
4
|
+
addAlias = true,
|
|
5
|
+
proPathCfg = { epRoot: '', pkgRoot: '', themeRoot: '' },
|
|
6
|
+
}) {
|
|
7
|
+
const { epRoot, pkgRoot, themeRoot } = proPathCfg;
|
|
8
|
+
const aliasCfg = addAlias
|
|
9
|
+
? {
|
|
10
|
+
resolve: {
|
|
11
|
+
alias: [
|
|
12
|
+
{
|
|
13
|
+
find: /^vft(\/(es|lib))?$/,
|
|
14
|
+
replacement: resolve(epRoot, 'index.ts'),
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
find: /^vft\/(es|lib)\/(.*)$/,
|
|
18
|
+
replacement: `${pkgRoot}/$2`,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
find: /^vft(\/theme-style)(.*)$/,
|
|
22
|
+
replacement: `${themeRoot}/$2`,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
: undefined;
|
|
28
|
+
|
|
29
|
+
return Object.assign({}, aliasCfg);
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { deepMerge as _deepMerge } from '@vft/utils';
|
|
2
|
+
|
|
3
|
+
export function deepMerge<
|
|
4
|
+
T extends object | null | undefined,
|
|
5
|
+
U extends object | null | undefined,
|
|
6
|
+
>(
|
|
7
|
+
source: T,
|
|
8
|
+
target: U,
|
|
9
|
+
mergeArrays: 'union' | 'intersection' | 'concat' | 'replace' = 'union',
|
|
10
|
+
): T & U {
|
|
11
|
+
return _deepMerge(source, target, mergeArrays);
|
|
12
|
+
}
|