@dcloudio/uni-cli-shared 3.0.0-alpha-3021320211117002 → 3.0.0-alpha-3021320211117003

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/hbx/log.d.ts CHANGED
@@ -3,4 +3,6 @@ export declare const h5ServeFormatter: Formatter;
3
3
  export declare const removeInfoFormatter: Formatter;
4
4
  export declare const removeWarnFormatter: Formatter;
5
5
  export declare const FilenameFormatter: Formatter;
6
+ export declare const VueFilenameFormatter: Formatter;
6
7
  export declare const HBuilderXFileFormatter: Formatter;
8
+ export declare const HBuilderXVueFileFormatter: Formatter;
package/dist/hbx/log.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.HBuilderXFileFormatter = exports.FilenameFormatter = exports.removeWarnFormatter = exports.removeInfoFormatter = exports.h5ServeFormatter = void 0;
6
+ exports.HBuilderXVueFileFormatter = exports.HBuilderXFileFormatter = exports.VueFilenameFormatter = exports.FilenameFormatter = exports.removeWarnFormatter = exports.removeInfoFormatter = exports.h5ServeFormatter = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const utils_1 = require("../utils");
9
9
  const SIGNAL_H5_LOCAL = ' > Local:';
@@ -65,6 +65,17 @@ exports.FilenameFormatter = {
65
65
  });
66
66
  },
67
67
  };
68
+ const vueFileRE = /file:\s(.*)\?vue&type=(.*)/;
69
+ exports.VueFilenameFormatter = {
70
+ test(msg) {
71
+ return vueFileRE.test(msg);
72
+ },
73
+ format(msg) {
74
+ return msg.replace(vueFileRE, (_, filename) => {
75
+ return `file: ${filename.split('?')[0]}`;
76
+ });
77
+ },
78
+ };
68
79
  exports.HBuilderXFileFormatter = {
69
80
  test(msg) {
70
81
  return fileRE.test(msg);
@@ -83,3 +94,18 @@ exports.HBuilderXFileFormatter = {
83
94
  }));
84
95
  },
85
96
  };
97
+ exports.HBuilderXVueFileFormatter = {
98
+ test(msg) {
99
+ return vueFileRE.test(msg);
100
+ },
101
+ format(msg) {
102
+ return (msg
103
+ // remove color
104
+ .replace(/\x1B[[(?);]{0,2}(;?\d)*./g, '')
105
+ .replace(vueFileRE, (_, filename) => {
106
+ return ('at ' +
107
+ (0, utils_1.normalizePath)(path_1.default.relative(process.env.UNI_INPUT_DIR, filename)) +
108
+ ':1');
109
+ }));
110
+ },
111
+ };
@@ -14,9 +14,11 @@ const initErrFormattersOnce = (0, uni_shared_1.once)(() => {
14
14
  }
15
15
  if ((0, env_1.runByHBuilderX)()) {
16
16
  errFormatters.push(log_1.HBuilderXFileFormatter);
17
+ errFormatters.push(log_1.HBuilderXVueFileFormatter);
17
18
  }
18
19
  else {
19
20
  errFormatters.push(log_1.FilenameFormatter);
21
+ errFormatters.push(log_1.VueFilenameFormatter);
20
22
  }
21
23
  });
22
24
  const initInfoFormattersOnce = (0, uni_shared_1.once)(() => {
@@ -165,15 +165,16 @@ function cssPostPlugin(config, { chunkCssFilename, chunkCssCode, }) {
165
165
  }
166
166
  // resolve asset URL placeholders to their built file URLs and perform
167
167
  // minification if necessary
168
- const processChunkCSS = async (css, { dirname, inlined, minify, }) => {
168
+ const processChunkCSS = async (css, { filename, inlined, minify, }) => {
169
169
  // replace asset url references with resolved url.
170
170
  css = css.replace(asset_1.assetUrlRE, (_, fileHash, postfix = '') => {
171
- return (0, utils_1.normalizePath)(path_1.default.relative(dirname, (0, asset_1.getAssetFilename)(fileHash, config) + postfix));
171
+ return (0, utils_1.normalizePath)(path_1.default.relative(path_1.default.dirname(filename), (0, asset_1.getAssetFilename)(fileHash, config) + postfix));
172
172
  });
173
173
  if (minify && config.build.minify) {
174
174
  css = await minifyCSS(css, config);
175
175
  }
176
- return css;
176
+ // 压缩后再处理,小程序平台会补充 @import nvue 代码,esbuild 的压缩会把 `@import "./nvue.css";` 的空格移除,变成 `@import"./nvue.css";` 在支付宝小程序中不支持
177
+ return chunkCssCode(filename, css);
177
178
  };
178
179
  const genCssCode = (fileName) => {
179
180
  return [...cssChunks.get(fileName)]
@@ -182,8 +183,8 @@ function cssPostPlugin(config, { chunkCssFilename, chunkCssCode, }) {
182
183
  };
183
184
  for (const filename of cssChunks.keys()) {
184
185
  const cssCode = genCssCode(filename);
185
- let source = await processChunkCSS(chunkCssCode(filename, cssCode), {
186
- dirname: path_1.default.dirname(filename),
186
+ let source = await processChunkCSS(cssCode, {
187
+ filename: filename,
187
188
  inlined: false,
188
189
  minify: true,
189
190
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-3021320211117002",
3
+ "version": "3.0.0-alpha-3021320211117003",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,8 +20,8 @@
20
20
  "dependencies": {
21
21
  "@babel/parser": "^7.15.0",
22
22
  "@babel/types": "^7.15.0",
23
- "@dcloudio/uni-i18n": "3.0.0-alpha-3021320211117002",
24
- "@dcloudio/uni-shared": "3.0.0-alpha-3021320211117002",
23
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3021320211117003",
24
+ "@dcloudio/uni-shared": "3.0.0-alpha-3021320211117003",
25
25
  "@rollup/pluginutils": "^4.1.1",
26
26
  "@vue/compiler-core": "3.2.22",
27
27
  "@vue/compiler-dom": "3.2.22",