lvyjs 0.2.20 → 0.2.21

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/lib/config.js CHANGED
@@ -7,6 +7,9 @@ const stylesRegExp = /\.(css|scss|less|sass|less)$/;
7
7
  */
8
8
  const createAlias = val => {
9
9
  const alias = {};
10
+ if (!Array.isArray(val.entries)) {
11
+ return alias;
12
+ }
10
13
  // 遍历 entries 数组
11
14
  val.entries.forEach(entry => {
12
15
  alias[entry.find] = entry.replacement;
@@ -54,6 +54,9 @@ const buildJS = async (inputs) => {
54
54
  plugins.push(rollupStylesCSSImport(global.lvyConfig.styles));
55
55
  }
56
56
  plugins.push(json());
57
+ const OutputOptions = global.lvyConfig?.build?.OutputOptions ?? [];
58
+ // 获取 dir 的值
59
+ const outputDir = OutputOptions['dir'] || 'lib';
57
60
  if (typeof global.lvyConfig.build != 'boolean') {
58
61
  //
59
62
  for (const key in global.lvyConfig.build) {
@@ -64,7 +67,11 @@ const buildJS = async (inputs) => {
64
67
  plugins.push(commonjs(global.lvyConfig.build[key]));
65
68
  }
66
69
  else if (key == 'typescript' && !global.lvyConfig.build['@rollup/plugin-typescript']) {
67
- plugins.push(typescript(global.lvyConfig.build[key]));
70
+ const config = global.lvyConfig.build[key] || {};
71
+ if (config.declarationDir === undefined) {
72
+ config.declarationDir = outputDir;
73
+ }
74
+ plugins.push(typescript(config));
68
75
  }
69
76
  else if (key == 'OutputOptions') {
70
77
  continue;
@@ -103,9 +110,6 @@ const buildJS = async (inputs) => {
103
110
  ...RollupOptions,
104
111
  plugins: Array.isArray(pl) ? [...plugins, ...pl] : pl
105
112
  });
106
- const OutputOptions = global.lvyConfig?.build?.OutputOptions ?? [];
107
- // 获取 dir 的值
108
- const outputDir = OutputOptions['dir'] || 'lib';
109
113
  // 写入输出文件
110
114
  const { output } = await bundle.write({
111
115
  dir: outputDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lvyjs",
3
- "version": "0.2.20",
3
+ "version": "0.2.21",
4
4
  "description": "tsx compile script",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",