lvyjs 0.2.14 → 0.2.15
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/README.md +1 -1
- package/bin/index.js +1 -2
- package/lib/config.d.ts +6 -6
- package/lib/config.js +15 -15
- package/lib/index.d.ts +3 -11
- package/lib/index.js +58 -56
- package/lib/main.js +29 -31
- package/lib/postcss.js +172 -170
- package/lib/rullup/index.d.ts +3 -3
- package/lib/rullup/index.js +119 -97
- package/lib/rullup/plugins/loader-css.js +46 -44
- package/lib/rullup/plugins/loader-files.js +30 -30
- package/lib/rullup/utils/files.js +19 -20
- package/lib/store.d.ts +48 -66
- package/lib/store.js +26 -25
- package/lib/typing.d.ts +3 -3
- package/package.json +13 -4
- package/lib/content.js +0 -48
- package/lib/loader.d.ts +0 -25
- package/lib/loader.js +0 -74
package/lib/rullup/index.d.ts
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
* @param inputs
|
|
8
8
|
* @param output
|
|
9
9
|
*/
|
|
10
|
-
declare const buildJS: (inputs: string[]) => Promise<void
|
|
10
|
+
declare const buildJS: (inputs: string[]) => Promise<void>;
|
|
11
11
|
/**
|
|
12
12
|
*
|
|
13
13
|
* @param script
|
|
14
14
|
*/
|
|
15
|
-
declare function buildAndRun(): Promise<void
|
|
15
|
+
declare function buildAndRun(): Promise<void>;
|
|
16
16
|
|
|
17
|
-
export { buildAndRun, buildJS }
|
|
17
|
+
export { buildAndRun, buildJS };
|
package/lib/rullup/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { rollup } from 'rollup'
|
|
2
|
-
import { join } from 'path'
|
|
3
|
-
import typescript from '@rollup/plugin-typescript'
|
|
4
|
-
import commonjs from '@rollup/plugin-commonjs'
|
|
5
|
-
import json from '@rollup/plugin-json'
|
|
6
|
-
import styles from 'rollup-plugin-styles'
|
|
7
|
-
import { getScriptFiles } from './utils/files.js'
|
|
8
|
-
import alias from '@rollup/plugin-alias'
|
|
9
|
-
import { rollupStylesCSSImport } from './plugins/loader-css.js'
|
|
10
|
-
import { rollupAssets } from './plugins/loader-files.js'
|
|
11
|
-
import { createAlias } from '../config.js'
|
|
1
|
+
import { rollup } from 'rollup';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import typescript from '@rollup/plugin-typescript';
|
|
4
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
5
|
+
import json from '@rollup/plugin-json';
|
|
6
|
+
import styles from 'rollup-plugin-styles';
|
|
7
|
+
import { getScriptFiles } from './utils/files.js';
|
|
8
|
+
import alias from '@rollup/plugin-alias';
|
|
9
|
+
import { rollupStylesCSSImport } from './plugins/loader-css.js';
|
|
10
|
+
import { rollupAssets } from './plugins/loader-files.js';
|
|
11
|
+
import { createAlias } from '../config.js';
|
|
12
|
+
import { statSync, readFileSync } from 'fs';
|
|
13
|
+
import zlib from 'zlib';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* 用于忽略警告
|
|
@@ -16,9 +18,10 @@ import { createAlias } from '../config.js'
|
|
|
16
18
|
* @param warn
|
|
17
19
|
*/
|
|
18
20
|
const onwarn = (warning, warn) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
if (warning.code === 'UNRESOLVED_IMPORT')
|
|
22
|
+
return;
|
|
23
|
+
warn(warning);
|
|
24
|
+
};
|
|
22
25
|
/**
|
|
23
26
|
* 打包 JS
|
|
24
27
|
* *** 注意 **
|
|
@@ -28,95 +31,114 @@ const onwarn = (warning, warn) => {
|
|
|
28
31
|
* @param inputs
|
|
29
32
|
* @param output
|
|
30
33
|
*/
|
|
31
|
-
const buildJS = async inputs => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
plugins
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
plugins.push(rollupAssets(global.lvyConfig?.assets ?? {}))
|
|
41
|
-
}
|
|
42
|
-
if (typeof global.lvyConfig?.styles !== 'boolean') {
|
|
43
|
-
if (!global.lvyConfig.alias) global.lvyConfig.alias = {}
|
|
44
|
-
plugins.push(
|
|
45
|
-
styles({
|
|
46
|
-
alias: createAlias(global.lvyConfig?.alias),
|
|
47
|
-
mode: ['inject', () => '']
|
|
48
|
-
})
|
|
49
|
-
)
|
|
50
|
-
plugins.push(rollupStylesCSSImport(global.lvyConfig.styles))
|
|
51
|
-
}
|
|
52
|
-
plugins.push(json())
|
|
53
|
-
if (typeof global.lvyConfig.build != 'boolean') {
|
|
54
|
-
//
|
|
55
|
-
for (const key in global.lvyConfig.build) {
|
|
56
|
-
if (typeof global.lvyConfig.build[key] == 'boolean') {
|
|
57
|
-
continue
|
|
58
|
-
}
|
|
59
|
-
if (key == 'commonjs' && !global.lvyConfig.build['@rollup/plugin-commonjs']) {
|
|
60
|
-
plugins.push(commonjs(global.lvyConfig.build[key]))
|
|
61
|
-
} else if (key == 'typescript' && !global.lvyConfig.build['@rollup/plugin-typescript']) {
|
|
62
|
-
plugins.push(typescript(global.lvyConfig.build[key]))
|
|
63
|
-
} else if (key == 'OutputOptions') {
|
|
64
|
-
continue
|
|
65
|
-
} else if (key == 'RollupOptions') {
|
|
66
|
-
continue
|
|
67
|
-
}
|
|
34
|
+
const buildJS = async (inputs) => {
|
|
35
|
+
if (!global.lvyConfig)
|
|
36
|
+
global.lvyConfig = {};
|
|
37
|
+
if (!global.lvyConfig.build)
|
|
38
|
+
global.lvyConfig.build = {};
|
|
39
|
+
// 插件
|
|
40
|
+
const plugins = [];
|
|
41
|
+
if (typeof global.lvyConfig?.alias !== 'boolean') {
|
|
42
|
+
plugins.push(alias(global.lvyConfig?.alias ?? {}));
|
|
68
43
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
for (const key of keys) {
|
|
72
|
-
// 如果是布尔值
|
|
73
|
-
if (typeof global.lvyConfig.build[key] == 'boolean') {
|
|
74
|
-
continue
|
|
75
|
-
}
|
|
76
|
-
// 存在这些配置
|
|
77
|
-
if (global.lvyConfig.build[key]) {
|
|
78
|
-
continue
|
|
79
|
-
}
|
|
80
|
-
//
|
|
81
|
-
if (key === 'commonjs') {
|
|
82
|
-
plugins.push(commonjs())
|
|
83
|
-
} else if (key === 'typescript') {
|
|
84
|
-
plugins.push(typescript())
|
|
85
|
-
}
|
|
44
|
+
if (typeof global.lvyConfig?.assets !== 'boolean') {
|
|
45
|
+
plugins.push(rollupAssets(global.lvyConfig?.assets ?? {}));
|
|
86
46
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
plugins
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
47
|
+
if (typeof global.lvyConfig?.styles !== 'boolean') {
|
|
48
|
+
if (!global.lvyConfig.alias)
|
|
49
|
+
global.lvyConfig.alias = {};
|
|
50
|
+
plugins.push(styles({
|
|
51
|
+
alias: createAlias(global.lvyConfig?.alias),
|
|
52
|
+
mode: ['inject', () => '']
|
|
53
|
+
}));
|
|
54
|
+
plugins.push(rollupStylesCSSImport(global.lvyConfig.styles));
|
|
55
|
+
}
|
|
56
|
+
plugins.push(json());
|
|
57
|
+
if (typeof global.lvyConfig.build != 'boolean') {
|
|
58
|
+
//
|
|
59
|
+
for (const key in global.lvyConfig.build) {
|
|
60
|
+
if (typeof global.lvyConfig.build[key] == 'boolean') {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (key == 'commonjs' && !global.lvyConfig.build['@rollup/plugin-commonjs']) {
|
|
64
|
+
plugins.push(commonjs(global.lvyConfig.build[key]));
|
|
65
|
+
}
|
|
66
|
+
else if (key == 'typescript' && !global.lvyConfig.build['@rollup/plugin-typescript']) {
|
|
67
|
+
plugins.push(typescript(global.lvyConfig.build[key]));
|
|
68
|
+
}
|
|
69
|
+
else if (key == 'OutputOptions') {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
else if (key == 'RollupOptions') {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// 如果不存在这些配置
|
|
77
|
+
const keys = ['commonjs', 'typescript'];
|
|
78
|
+
for (const key of keys) {
|
|
79
|
+
// 如果是布尔值
|
|
80
|
+
if (typeof global.lvyConfig.build[key] == 'boolean') {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
// 存在这些配置
|
|
84
|
+
if (global.lvyConfig.build[key]) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
//
|
|
88
|
+
if (key === 'commonjs') {
|
|
89
|
+
plugins.push(commonjs());
|
|
90
|
+
}
|
|
91
|
+
else if (key === 'typescript') {
|
|
92
|
+
plugins.push(typescript());
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const RollupOptions = global.lvyConfig?.build?.RollupOptions ?? {};
|
|
97
|
+
const plg = await RollupOptions?.plugins;
|
|
98
|
+
const pl = plg && typeof plg != 'boolean' ? plg : [];
|
|
99
|
+
// build
|
|
100
|
+
const bundle = await rollup({
|
|
101
|
+
input: inputs,
|
|
102
|
+
onwarn: onwarn,
|
|
103
|
+
...RollupOptions,
|
|
104
|
+
plugins: Array.isArray(pl) ? [...plugins, ...pl] : pl
|
|
105
|
+
});
|
|
106
|
+
const OutputOptions = global.lvyConfig?.build?.OutputOptions ?? [];
|
|
107
|
+
// 获取 dir 的值
|
|
108
|
+
const outputDir = OutputOptions['dir'] || 'lib';
|
|
109
|
+
// 写入输出文件
|
|
110
|
+
const { output } = await bundle.write({
|
|
111
|
+
dir: outputDir,
|
|
112
|
+
format: 'es',
|
|
113
|
+
sourcemap: false,
|
|
114
|
+
preserveModules: true,
|
|
115
|
+
assetFileNames: 'assets/[name]-[hash][extname]',
|
|
116
|
+
...OutputOptions
|
|
117
|
+
});
|
|
118
|
+
// 打印产出地址和文件大小
|
|
119
|
+
console.log(`✓ ${output.length} modules transformed.`);
|
|
120
|
+
for (const file of output) {
|
|
121
|
+
const filePath = join(outputDir, file.fileName);
|
|
122
|
+
const fileSize = statSync(filePath).size;
|
|
123
|
+
const fileContent = readFileSync(filePath);
|
|
124
|
+
const gzipFileSize = zlib.gzipSync(fileContent).length;
|
|
125
|
+
console.log(`${filePath.padEnd(40)} ${(fileSize / 1024).toFixed(2)} kB │ gzip: ${(gzipFileSize / 1024).toFixed(2)} kB`);
|
|
126
|
+
}
|
|
127
|
+
//
|
|
128
|
+
};
|
|
109
129
|
/**
|
|
110
130
|
*
|
|
111
131
|
* @param script
|
|
112
132
|
*/
|
|
113
133
|
async function buildAndRun() {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
134
|
+
if (!global.lvyConfig)
|
|
135
|
+
global.lvyConfig = {};
|
|
136
|
+
if (!global.lvyConfig.build)
|
|
137
|
+
global.lvyConfig.build = {};
|
|
138
|
+
// rollup 配置
|
|
139
|
+
let inputDir = global.lvyConfig?.build?.OutputOptions?.input ?? 'src';
|
|
140
|
+
const inputFiles = getScriptFiles(join(process.cwd(), inputDir));
|
|
141
|
+
await buildJS(inputFiles);
|
|
120
142
|
}
|
|
121
143
|
|
|
122
|
-
export { buildAndRun, buildJS }
|
|
144
|
+
export { buildAndRun, buildJS };
|
|
@@ -1,54 +1,56 @@
|
|
|
1
|
-
import { createFilter } from '@rollup/pluginutils'
|
|
2
|
-
import { resolve, dirname
|
|
3
|
-
import { stylesRegExp } from '../../config.js'
|
|
1
|
+
import { createFilter } from '@rollup/pluginutils';
|
|
2
|
+
import { basename, resolve, dirname } from 'node:path';
|
|
3
|
+
import { stylesRegExp } from '../../config.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
const rollupStylesCSSImport = options => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
const rollupStylesCSSImport = (options) => {
|
|
10
|
+
const include = options?.filter ?? stylesRegExp;
|
|
11
|
+
const filter = createFilter(include, null);
|
|
12
|
+
return {
|
|
13
|
+
name: 'c-css',
|
|
14
|
+
resolveId(source, importer) {
|
|
15
|
+
if (filter(source) && importer) {
|
|
16
|
+
return resolve(dirname(importer), source);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
load(id) {
|
|
20
|
+
if (filter(id))
|
|
21
|
+
this.addWatchFile(resolve(id));
|
|
22
|
+
return null;
|
|
23
|
+
},
|
|
24
|
+
async transform(code, id) {
|
|
25
|
+
if (!filter(id))
|
|
26
|
+
return null;
|
|
27
|
+
// 删除 export default css
|
|
28
|
+
const codex = code.replace(/(export|default css)/g, '');
|
|
29
|
+
// 使用 eval 执行代码并获取默认导出的值
|
|
30
|
+
const evalCode = `
|
|
29
31
|
(() => {
|
|
30
32
|
${codex}
|
|
31
33
|
return css;
|
|
32
34
|
})()
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
35
|
+
`;
|
|
36
|
+
// 得到css变量的值
|
|
37
|
+
const csscode = eval(evalCode);
|
|
38
|
+
// 确保最后生产的css文件
|
|
39
|
+
const refeId = this.emitFile({
|
|
40
|
+
// 属于静态资源
|
|
41
|
+
type: 'asset',
|
|
42
|
+
name: basename(`${id}.css`),
|
|
43
|
+
// 内容
|
|
44
|
+
source: csscode
|
|
45
|
+
});
|
|
46
|
+
const contents = [
|
|
47
|
+
`const reg = ['win32'].includes(process.platform) ? /^file:\\/\\/\\// : /^file:\\/\\// ;`,
|
|
48
|
+
`const fileUrl = import.meta.ROLLUP_FILE_URL_${refeId}.replace(reg, '');`,
|
|
49
|
+
'export default fileUrl;'
|
|
50
|
+
].join('\n');
|
|
51
|
+
return contents;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
53
55
|
|
|
54
|
-
export { rollupStylesCSSImport }
|
|
56
|
+
export { rollupStylesCSSImport };
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { resolve, dirname
|
|
2
|
-
import { readFileSync } from 'fs'
|
|
3
|
-
import { assetsRegExp } from '../../config.js'
|
|
1
|
+
import { basename, resolve, dirname } from 'path';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { assetsRegExp } from '../../config.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @param {Object} options
|
|
7
7
|
* @returns {Object}
|
|
8
8
|
*/
|
|
9
|
-
const rollupAssets = options => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
9
|
+
const rollupAssets = (options) => {
|
|
10
|
+
const { filter = assetsRegExp } = options ?? {};
|
|
11
|
+
return {
|
|
12
|
+
name: 'rollup-node-files',
|
|
13
|
+
resolveId(source, importer) {
|
|
14
|
+
if (filter.test(source) && importer) {
|
|
15
|
+
return resolve(dirname(importer), source);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
load(id) {
|
|
19
|
+
if (filter.test(id)) {
|
|
20
|
+
const referenceId = this.emitFile({
|
|
21
|
+
type: 'asset',
|
|
22
|
+
name: basename(id),
|
|
23
|
+
source: readFileSync(id)
|
|
24
|
+
});
|
|
25
|
+
const contents = [
|
|
26
|
+
`const reg = ['win32'].includes(process.platform) ? /^file:\\/\\/\\// : /^file:\\/\\// ;`,
|
|
27
|
+
`const fileUrl = import.meta.ROLLUP_FILE_URL_${referenceId}.replace(reg, '');`,
|
|
28
|
+
'export default fileUrl;'
|
|
29
|
+
].join('\n');
|
|
30
|
+
return contents;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
35
|
|
|
36
|
-
export { rollupAssets }
|
|
36
|
+
export { rollupAssets };
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import { join } from 'path'
|
|
2
|
-
import { readdirSync } from 'fs'
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { readdirSync } from 'fs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 获取指定目录下的所有 ts、js、jsx、tsx 文件
|
|
6
6
|
* @param dir 目录路径
|
|
7
7
|
* @returns 文件路径数组
|
|
8
8
|
*/
|
|
9
|
-
const getScriptFiles = dir => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
9
|
+
const getScriptFiles = (dir) => {
|
|
10
|
+
const results = [];
|
|
11
|
+
const list = readdirSync(dir, { withFileTypes: true });
|
|
12
|
+
list.forEach(item => {
|
|
13
|
+
const fullPath = join(dir, item.name);
|
|
14
|
+
if (item.isDirectory()) {
|
|
15
|
+
results.push(...getScriptFiles(fullPath));
|
|
16
|
+
}
|
|
17
|
+
else if (item.isFile() &&
|
|
18
|
+
/\.(ts|js|jsx|tsx)$/.test(item.name) &&
|
|
19
|
+
!item.name.endsWith('.d.ts')) {
|
|
20
|
+
results.push(fullPath);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return results;
|
|
24
|
+
};
|
|
26
25
|
|
|
27
|
-
export { getScriptFiles }
|
|
26
|
+
export { getScriptFiles };
|
package/lib/store.d.ts
CHANGED
|
@@ -1,106 +1,88 @@
|
|
|
1
|
-
import { RollupCommonJSOptions } from '@rollup/plugin-commonjs'
|
|
2
|
-
import { RollupTypescriptOptions } from '@rollup/plugin-typescript'
|
|
3
|
-
import { RollupOptions, OutputOptions } from 'rollup'
|
|
4
|
-
import { Alias } from './typing.js'
|
|
1
|
+
import { RollupCommonJSOptions } from '@rollup/plugin-commonjs';
|
|
2
|
+
import { RollupTypescriptOptions } from '@rollup/plugin-typescript';
|
|
3
|
+
import { RollupOptions, OutputOptions } from 'rollup';
|
|
4
|
+
import { Alias } from './typing.js';
|
|
5
5
|
|
|
6
|
-
type PluginsValue = (options: Options) => void
|
|
7
|
-
type PluginsCallBack =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
type PluginsOptions = (options: Options) => PluginsCallBack | void
|
|
6
|
+
type PluginsValue = (options: Options) => void;
|
|
7
|
+
type PluginsCallBack = PluginsValue | {
|
|
8
|
+
load?: PluginsValue;
|
|
9
|
+
build?: PluginsValue;
|
|
10
|
+
};
|
|
11
|
+
type PluginsOptions = (options: Options) => PluginsCallBack | void;
|
|
14
12
|
type Options = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
| {
|
|
13
|
+
/**
|
|
14
|
+
* 配置调整机及其回调插件
|
|
15
|
+
*/
|
|
16
|
+
plugins?: PluginsOptions[];
|
|
17
|
+
/**
|
|
18
|
+
* 别名
|
|
19
|
+
*/
|
|
20
|
+
alias?: {
|
|
24
21
|
/**
|
|
25
22
|
* 别名规则
|
|
26
23
|
*/
|
|
27
|
-
entries?: Alias[]
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
assets?:
|
|
34
|
-
| {
|
|
24
|
+
entries?: Alias[];
|
|
25
|
+
} | false;
|
|
26
|
+
/**
|
|
27
|
+
* 静态资源识别
|
|
28
|
+
*/
|
|
29
|
+
assets?: {
|
|
35
30
|
/**
|
|
36
31
|
* 过滤得到指定格式的文件识别之为静态资源
|
|
37
32
|
*/
|
|
38
|
-
filter?: RegExp
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
styles?:
|
|
42
|
-
| {
|
|
33
|
+
filter?: RegExp;
|
|
34
|
+
} | false;
|
|
35
|
+
styles?: {
|
|
43
36
|
/**
|
|
44
37
|
* 过滤得到指定格式的文件识别之为静态资源
|
|
45
38
|
*/
|
|
46
|
-
filter?: RegExp
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
build?:
|
|
53
|
-
| {
|
|
39
|
+
filter?: RegExp;
|
|
40
|
+
} | false;
|
|
41
|
+
/**
|
|
42
|
+
* 打包时配置
|
|
43
|
+
*/
|
|
44
|
+
build?: {
|
|
54
45
|
/**
|
|
55
46
|
* cjs文件处理
|
|
56
47
|
*/
|
|
57
|
-
commonjs?: RollupCommonJSOptions | false
|
|
48
|
+
commonjs?: RollupCommonJSOptions | false;
|
|
58
49
|
/**
|
|
59
50
|
* ts配置
|
|
60
51
|
*/
|
|
61
|
-
typescript?: RollupTypescriptOptions | false
|
|
52
|
+
typescript?: RollupTypescriptOptions | false;
|
|
62
53
|
/**
|
|
63
54
|
*
|
|
64
55
|
*/
|
|
65
|
-
RollupOptions?: RollupOptions
|
|
56
|
+
RollupOptions?: RollupOptions;
|
|
66
57
|
/**
|
|
67
58
|
*
|
|
68
59
|
*/
|
|
69
60
|
OutputOptions?: OutputOptions & {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
61
|
+
/**
|
|
62
|
+
* 默认 src
|
|
63
|
+
*/
|
|
64
|
+
input?: string;
|
|
65
|
+
};
|
|
66
|
+
} | false;
|
|
67
|
+
};
|
|
78
68
|
/**
|
|
79
69
|
*
|
|
80
70
|
*/
|
|
81
71
|
declare global {
|
|
82
|
-
|
|
72
|
+
var lvyConfig: Options;
|
|
83
73
|
}
|
|
84
74
|
/**
|
|
85
75
|
*
|
|
86
76
|
*/
|
|
87
|
-
declare const initConfig: () => Promise<void
|
|
77
|
+
declare const initConfig: () => Promise<void>;
|
|
88
78
|
/**
|
|
89
79
|
* @returns
|
|
90
80
|
*/
|
|
91
|
-
declare const getOptions: () => Options
|
|
81
|
+
declare const getOptions: () => Options;
|
|
92
82
|
/**
|
|
93
83
|
* @param param0
|
|
94
84
|
* @returns
|
|
95
85
|
*/
|
|
96
|
-
declare const defineConfig: (optoins?: Options) => Options | undefined
|
|
86
|
+
declare const defineConfig: (optoins?: Options) => Options | undefined;
|
|
97
87
|
|
|
98
|
-
export {
|
|
99
|
-
type Options,
|
|
100
|
-
type PluginsCallBack,
|
|
101
|
-
type PluginsOptions,
|
|
102
|
-
type PluginsValue,
|
|
103
|
-
defineConfig,
|
|
104
|
-
getOptions,
|
|
105
|
-
initConfig
|
|
106
|
-
}
|
|
88
|
+
export { type Options, type PluginsCallBack, type PluginsOptions, type PluginsValue, defineConfig, getOptions, initConfig };
|