@dcloudio/uni-cli-shared 3.0.0-alpha-3041520220610001 → 3.0.0-alpha-3041820220617001

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.
@@ -149,7 +149,7 @@ function getMac() {
149
149
  }
150
150
  if (
151
151
  // Node < v18
152
- typeof item.family === 'string' &&
152
+ (0, shared_1.isString)(item.family) &&
153
153
  (item.family === 'IPv4' || item.family === 'IPv6')) {
154
154
  mac = item.mac;
155
155
  break;
package/dist/hbx/log.js CHANGED
@@ -7,6 +7,7 @@ exports.errorFormatter = exports.removeWarnFormatter = exports.removeInfoFormatt
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const picocolors_1 = __importDefault(require("picocolors"));
10
+ const shared_1 = require("@vue/shared");
10
11
  const utils_1 = require("../utils");
11
12
  const constants_1 = require("../constants");
12
13
  const ast_1 = require("../vite/utils/ast");
@@ -52,7 +53,7 @@ const REMOVED_MSGS = [
52
53
  ];
53
54
  exports.removeInfoFormatter = {
54
55
  test(msg) {
55
- return !!REMOVED_MSGS.find((m) => typeof m === 'string' ? msg.includes(m) : m(msg));
56
+ return !!REMOVED_MSGS.find((m) => ((0, shared_1.isString)(m) ? msg.includes(m) : m(msg)));
56
57
  },
57
58
  format() {
58
59
  return '';
@@ -16,15 +16,18 @@ function parseMiniProgramPagesJson(jsonStr, platform, options = { subpackages: f
16
16
  return parsePagesJson(jsonStr, platform, options);
17
17
  }
18
18
  exports.parseMiniProgramPagesJson = parseMiniProgramPagesJson;
19
+ const NON_APP_JSON_KEYS = [
20
+ 'unipush',
21
+ 'usingComponents',
22
+ 'optimization',
23
+ 'scopedSlotsCompiler',
24
+ 'usingComponents',
25
+ 'uniStatistics',
26
+ ];
19
27
  function mergeMiniProgramAppJson(appJson, platformJson = {}) {
20
28
  Object.keys(platformJson).forEach((name) => {
21
29
  if (!(0, project_1.isMiniProgramProjectJsonKey)(name) &&
22
- ![
23
- 'unipush',
24
- 'usingComponents',
25
- 'optimization',
26
- 'scopedSlotsCompiler',
27
- ].includes(name)) {
30
+ !NON_APP_JSON_KEYS.includes(name)) {
28
31
  appJson[name] = platformJson[name];
29
32
  }
30
33
  });
@@ -103,7 +103,7 @@ function normalizePagesJson(jsonStr, platform, { subpackages, } = { subpackages:
103
103
  }
104
104
  exports.normalizePagesJson = normalizePagesJson;
105
105
  function validatePages(pagesJson, jsonStr) {
106
- if (!Array.isArray(pagesJson.pages)) {
106
+ if (!(0, shared_1.isArray)(pagesJson.pages)) {
107
107
  pagesJson.pages = [];
108
108
  throw new Error(`[uni-app] Error: pages.json->pages parse failed.`);
109
109
  }
@@ -140,7 +140,7 @@ function normalizePages(pages, platform) {
140
140
  }
141
141
  function normalizeSubpackages(subpackages) {
142
142
  const pages = [];
143
- if (Array.isArray(subpackages)) {
143
+ if ((0, shared_1.isArray)(subpackages)) {
144
144
  subpackages.forEach(({ root, pages: subPages }) => {
145
145
  if (root && subPages.length) {
146
146
  subPages.forEach((subPage) => {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatWarnMsg = exports.formatInfoMsg = exports.removeNVueInfoFormatter = exports.formatErrMsg = void 0;
4
4
  const uni_shared_1 = require("@dcloudio/uni-shared");
5
+ const shared_1 = require("@vue/shared");
5
6
  const env_1 = require("../hbx/env");
6
7
  const alias_1 = require("../hbx/alias");
7
8
  const log_1 = require("../hbx/log");
@@ -45,7 +46,7 @@ const REMOVED_NVUE_MSGS = [
45
46
  ];
46
47
  exports.removeNVueInfoFormatter = {
47
48
  test(msg) {
48
- return !!REMOVED_NVUE_MSGS.find((m) => typeof m === 'string' ? msg.includes(m) : m(msg));
49
+ return !!REMOVED_NVUE_MSGS.find((m) => (0, shared_1.isString)(m) ? msg.includes(m) : m(msg));
49
50
  },
50
51
  format() {
51
52
  return '';
@@ -56,6 +57,9 @@ const initNVueInfoFormattersOnce = (0, uni_shared_1.once)(() => {
56
57
  nvueInfoFormatters.push(exports.removeNVueInfoFormatter);
57
58
  });
58
59
  function formatInfoMsg(msg, options) {
60
+ if (options && (0, env_1.isInHBuilderX)()) {
61
+ options.timestamp = false;
62
+ }
59
63
  initInfoFormattersOnce();
60
64
  const formatter = infoFormatters.find(({ test }) => test(msg, options));
61
65
  if (formatter) {
@@ -74,7 +74,7 @@ function uniViteInjectPlugin(name, options) {
74
74
  if (mods.length === 2) {
75
75
  mod = namespaceModulesMap.get(mods[0] + '.');
76
76
  if (mod) {
77
- if (Array.isArray(mod)) {
77
+ if ((0, shared_1.isArray)(mod)) {
78
78
  const testFn = mod[1];
79
79
  if (testFn(mods[1])) {
80
80
  mod = [mod[0], mods[1]];
@@ -90,7 +90,7 @@ function uniViteInjectPlugin(name, options) {
90
90
  }
91
91
  }
92
92
  if (mod && !imports.has(name) && !scope.contains(name)) {
93
- if (typeof mod === 'string')
93
+ if ((0, shared_1.isString)(mod))
94
94
  mod = [mod, 'default'];
95
95
  if (mod[0] === id)
96
96
  return false;
@@ -188,7 +188,7 @@ const flatten = (startNode) => {
188
188
  };
189
189
  function normalizeModulesMap(modulesMap) {
190
190
  modulesMap.forEach((mod, key) => {
191
- modulesMap.set(key, Array.isArray(mod)
191
+ modulesMap.set(key, (0, shared_1.isArray)(mod)
192
192
  ? [mod[0].split(path_1.sep).join('/'), mod[1]]
193
193
  : mod.split(path_1.sep).join('/'));
194
194
  });
@@ -35,6 +35,7 @@ const magic_string_1 = __importDefault(require("magic-string"));
35
35
  const crypto_1 = require("crypto");
36
36
  const utils_1 = require("../utils");
37
37
  const utils_2 = require("../../../../vite/utils/utils");
38
+ const shared_1 = require("@vue/shared");
38
39
  exports.assetUrlRE = /__VITE_ASSET__([a-z\d]{8})__(?:\$_(.*?)__)?/g;
39
40
  // urls in JS must be quoted as strings, so when replacing them we need
40
41
  // a different regex
@@ -178,17 +179,17 @@ function assetFileNamesToFileName(assetFileNames, file, contentHash, content) {
178
179
  const ext = extname.substring(1);
179
180
  const name = basename.slice(0, -extname.length);
180
181
  const hash = contentHash;
181
- if (typeof assetFileNames === 'function') {
182
+ if ((0, shared_1.isFunction)(assetFileNames)) {
182
183
  assetFileNames = assetFileNames({
183
184
  name: file,
184
185
  source: content,
185
186
  type: 'asset',
186
187
  });
187
- if (typeof assetFileNames !== 'string') {
188
+ if (!(0, shared_1.isString)(assetFileNames)) {
188
189
  throw new TypeError('assetFileNames must return a string');
189
190
  }
190
191
  }
191
- else if (typeof assetFileNames !== 'string') {
192
+ else if (!(0, shared_1.isString)(assetFileNames)) {
192
193
  throw new TypeError('assetFileNames must be a string or a function');
193
194
  }
194
195
  const fileName = assetFileNames.replace(/\[\w+\]/g, (placeholder) => {
@@ -40,6 +40,7 @@ const esbuild_1 = require("esbuild");
40
40
  const preprocess_1 = require("../../../../preprocess");
41
41
  const constants_1 = require("../../../../constants");
42
42
  const cleanString_1 = require("../cleanString");
43
+ const shared_1 = require("@vue/shared");
43
44
  const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`;
44
45
  exports.cssLangRE = new RegExp(cssLangs);
45
46
  const cssModuleRE = new RegExp(`\\.module${cssLangs}`);
@@ -341,7 +342,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
341
342
  ...modulesOptions,
342
343
  getJSON(cssFileName, _modules, outputFileName) {
343
344
  modules = _modules;
344
- if (modulesOptions && typeof modulesOptions.getJSON === 'function') {
345
+ if (modulesOptions && (0, shared_1.isFunction)(modulesOptions.getJSON)) {
345
346
  modulesOptions.getJSON(cssFileName, _modules, outputFileName);
346
347
  }
347
348
  },
@@ -369,15 +370,19 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
369
370
  ...postcssOptions,
370
371
  to: id,
371
372
  from: id,
372
- map: {
373
- inline: false,
374
- annotation: false,
375
- // postcss may return virtual files
376
- // we cannot obtain content of them, so this needs to be enabled
377
- sourcesContent: true,
378
- // when "prev: preprocessorMap", the result map may include duplicate filename in `postcssResult.map.sources`
379
- // prev: preprocessorMap,
380
- },
373
+ ...(devSourcemap
374
+ ? {
375
+ map: {
376
+ inline: false,
377
+ annotation: false,
378
+ // postcss may return virtual files
379
+ // we cannot obtain content of them, so this needs to be enabled
380
+ sourcesContent: true,
381
+ // when "prev: preprocessorMap", the result map may include duplicate filename in `postcssResult.map.sources`
382
+ // prev: preprocessorMap,
383
+ },
384
+ }
385
+ : {}),
381
386
  });
382
387
  // record CSS dependencies from @imports
383
388
  for (const message of postcssResult.messages) {
@@ -490,7 +495,7 @@ async function resolvePostcssConfig(config) {
490
495
  };
491
496
  }
492
497
  else {
493
- const searchPath = typeof inlineOptions === 'string' ? inlineOptions : config.root;
498
+ const searchPath = (0, shared_1.isString)(inlineOptions) ? inlineOptions : config.root;
494
499
  try {
495
500
  // @ts-ignore
496
501
  result = await (0, postcss_load_config_1.default)({}, searchPath);
@@ -706,7 +711,7 @@ const scss = async (source, root, options, resolvers, isNVue) => {
706
711
  };
707
712
  const importer = [internalImporter];
708
713
  if (options.importer) {
709
- Array.isArray(options.importer)
714
+ (0, shared_1.isArray)(options.importer)
710
715
  ? importer.push(...options.importer)
711
716
  : importer.push(options.importer);
712
717
  }
@@ -794,7 +799,7 @@ async function rebaseUrls(file, rootFile, alias, isNVue = false) {
794
799
  return url;
795
800
  // match alias, no need to rewrite
796
801
  for (const { find } of alias) {
797
- const matches = typeof find === 'string' ? url.startsWith(find) : find.test(url);
802
+ const matches = (0, shared_1.isString)(find) ? url.startsWith(find) : find.test(url);
798
803
  if (matches) {
799
804
  return url;
800
805
  }
@@ -959,9 +964,9 @@ function formatStylusSourceMap(mapBefore, root) {
959
964
  async function getSource(source, filename, additionalData, enableSourcemap, sep = '') {
960
965
  if (!additionalData)
961
966
  return { content: source };
962
- if (typeof additionalData === 'function') {
967
+ if ((0, shared_1.isFunction)(additionalData)) {
963
968
  const newContent = await additionalData(source, filename);
964
- if (typeof newContent === 'string') {
969
+ if ((0, shared_1.isString)(newContent)) {
965
970
  return { content: newContent };
966
971
  }
967
972
  return newContent;
@@ -31,7 +31,7 @@ function replacePlugins(plugins, config) {
31
31
  }
32
32
  exports.replacePlugins = replacePlugins;
33
33
  function removePlugins(plugins, config) {
34
- if (!Array.isArray(plugins)) {
34
+ if (!(0, shared_1.isArray)(plugins)) {
35
35
  plugins = [plugins];
36
36
  }
37
37
  plugins.forEach((name) => {
package/dist/watcher.js CHANGED
@@ -7,9 +7,10 @@ exports.FileWatcher = void 0;
7
7
  const fs_extra_1 = __importDefault(require("fs-extra"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const chokidar_1 = require("chokidar");
10
+ const shared_1 = require("@vue/shared");
10
11
  class FileWatcher {
11
12
  constructor({ src, dest, transform, verbose }) {
12
- this.src = !Array.isArray(src) ? [src] : src;
13
+ this.src = !(0, shared_1.isArray)(src) ? [src] : src;
13
14
  this.dest = dest;
14
15
  this.transform = transform;
15
16
  this.verbose = verbose;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-3041520220610001",
3
+ "version": "3.0.0-alpha-3041820220617001",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,17 +22,17 @@
22
22
  "@babel/core": "^7.17.9",
23
23
  "@babel/parser": "^7.17.9",
24
24
  "@babel/types": "^7.17.0",
25
- "@dcloudio/uni-i18n": "3.0.0-alpha-3041520220610001",
26
- "@dcloudio/uni-shared": "3.0.0-alpha-3041520220610001",
25
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3041820220617001",
26
+ "@dcloudio/uni-shared": "3.0.0-alpha-3041820220617001",
27
27
  "@intlify/core-base": "9.1.9",
28
28
  "@intlify/shared": "9.1.9",
29
29
  "@intlify/vue-devtools": "9.1.9",
30
30
  "@rollup/pluginutils": "^4.2.0",
31
- "@vue/compiler-core": "3.2.33",
32
- "@vue/compiler-dom": "3.2.33",
33
- "@vue/compiler-sfc": "3.2.33",
34
- "@vue/server-renderer": "3.2.33",
35
- "@vue/shared": "3.2.33",
31
+ "@vue/compiler-core": "3.2.37",
32
+ "@vue/compiler-dom": "3.2.37",
33
+ "@vue/compiler-sfc": "3.2.37",
34
+ "@vue/server-renderer": "3.2.37",
35
+ "@vue/shared": "3.2.37",
36
36
  "autoprefixer": "^10.4.7",
37
37
  "base64url": "^3.0.1",
38
38
  "chokidar": "^3.5.3",
@@ -72,6 +72,6 @@
72
72
  "@types/sass": "^1.43.1",
73
73
  "@types/stylus": "^0.48.36",
74
74
  "postcss": "^8.4.13",
75
- "vue": "3.2.33"
75
+ "vue": "3.2.37"
76
76
  }
77
77
  }