@dcloudio/uni-cli-shared 3.0.0-alpha-3060920221114001 → 3.0.0-alpha-3060920221117002

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.
@@ -157,6 +157,7 @@ function getMac() {
157
157
  else if (
158
158
  // Node >= v18
159
159
  typeof item.family === 'number' &&
160
+ // @ts-ignore
160
161
  (item.family === 4 || item.family === 6)) {
161
162
  mac = item.mac;
162
163
  break;
package/dist/esbuild.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { BuildOptions } from 'esbuild';
1
+ import type { BuildOptions } from 'esbuild';
2
2
  export declare function transformWithEsbuild(code: string, filename: string, options: BuildOptions): Promise<import("esbuild").BuildResult>;
3
3
  export declare function esbuild(options: BuildOptions): Promise<import("esbuild").BuildResult>;
package/dist/hbx/env.d.ts CHANGED
@@ -4,3 +4,4 @@ export declare const runByHBuilderX: () => boolean;
4
4
  * 增加 node_modules
5
5
  */
6
6
  export declare function initModulePaths(): void;
7
+ export declare function fixBinaryPath(): void;
package/dist/hbx/env.js CHANGED
@@ -3,10 +3,12 @@ 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.initModulePaths = exports.runByHBuilderX = exports.isInHBuilderX = void 0;
6
+ exports.fixBinaryPath = exports.initModulePaths = exports.runByHBuilderX = exports.isInHBuilderX = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const module_1 = __importDefault(require("module"));
9
9
  const uni_shared_1 = require("@dcloudio/uni-shared");
10
+ const resolve_1 = require("../resolve");
11
+ const utils_1 = require("../utils");
10
12
  exports.isInHBuilderX = (0, uni_shared_1.once)(() => {
11
13
  try {
12
14
  const { name } = require(path_1.default.resolve(process.cwd(), '../about/package.json'));
@@ -43,3 +45,30 @@ function initModulePaths() {
43
45
  };
44
46
  }
45
47
  exports.initModulePaths = initModulePaths;
48
+ function resolveEsbuildModule(name) {
49
+ try {
50
+ return path_1.default.dirname(require.resolve(name + '/package.json', {
51
+ paths: [path_1.default.dirname((0, resolve_1.resolveBuiltIn)('esbuild/package.json'))],
52
+ }));
53
+ }
54
+ catch (e) { }
55
+ return '';
56
+ }
57
+ function fixBinaryPath() {
58
+ // cli 工程在 HBuilderX 中运行
59
+ if (!(0, exports.isInHBuilderX)() && (0, exports.runByHBuilderX)()) {
60
+ if (utils_1.isWindows) {
61
+ const win64 = resolveEsbuildModule('esbuild-windows-64');
62
+ if (win64) {
63
+ process.env.ESBUILD_BINARY_PATH = path_1.default.join(win64, 'esbuild.exe');
64
+ }
65
+ }
66
+ else {
67
+ const arm64 = resolveEsbuildModule('esbuild-darwin-arm64');
68
+ if (arm64) {
69
+ process.env.ESBUILD_BINARY_PATH = path_1.default.join(arm64, 'bin/esbuild');
70
+ }
71
+ }
72
+ }
73
+ }
74
+ exports.fixBinaryPath = fixBinaryPath;
@@ -2,8 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initAppStatusbar = void 0;
4
4
  function initAppStatusbar(manifestJson, pagesJson) {
5
- var _a;
6
- const { titleColor = '#000000', backgroundColor = '#000000' } = ((_a = pagesJson.globalStyle) === null || _a === void 0 ? void 0 : _a.navigationBar) || {};
5
+ const titleColor = pagesJson.pages[0].style.navigationBar.titleColor ||
6
+ pagesJson.globalStyle.navigationBar.titleColor ||
7
+ '#ffffff';
8
+ const backgroundColor = pagesJson.globalStyle.navigationBar.backgroundColor || '#000000';
7
9
  manifestJson.plus.statusbar = {
8
10
  immersed: 'supportedDevice',
9
11
  style: titleColor === '#000000' ? 'dark' : 'light',
@@ -1,3 +1,4 @@
1
1
  export declare function registerPlatform(platform: string): void;
2
2
  export declare function getPlatforms(): string[];
3
3
  export declare function getPlatformDir(): "quickapp-webview-huawei" | "quickapp-webview-union";
4
+ export declare function isMiniProgramPlatform(): boolean;
package/dist/platform.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPlatformDir = exports.getPlatforms = exports.registerPlatform = void 0;
3
+ exports.isMiniProgramPlatform = exports.getPlatformDir = exports.getPlatforms = exports.registerPlatform = void 0;
4
4
  const BUILT_IN_PLATFORMS = [
5
5
  'app',
6
6
  'app-plus',
@@ -33,3 +33,7 @@ function getPlatformDir() {
33
33
  return process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM;
34
34
  }
35
35
  exports.getPlatformDir = getPlatformDir;
36
+ function isMiniProgramPlatform() {
37
+ return !['app', 'app-plus', 'h5', 'web'].includes(process.env.UNI_PLATFORM);
38
+ }
39
+ exports.isMiniProgramPlatform = isMiniProgramPlatform;
package/dist/resolve.js CHANGED
@@ -51,7 +51,7 @@ function resolveNodeModulePath(modulePath) {
51
51
  return nodeModulesPaths;
52
52
  }
53
53
  function initPaths() {
54
- const cliContext = process.env.UNI_CLI_CONTEXT;
54
+ const cliContext = process.env.UNI_CLI_CONTEXT || process.cwd();
55
55
  if (cliContext) {
56
56
  const pathSet = new Set();
57
57
  pathSet.add(path_1.default.join(cliContext, 'node_modules'));
package/dist/utils.d.ts CHANGED
@@ -16,3 +16,4 @@ export declare function pathToGlob(pathString: string, glob: string, options?: {
16
16
  escape?: boolean;
17
17
  }): string;
18
18
  export declare function resolveSourceMapPath(outputDir?: string, platform?: UniApp.PLATFORM): string;
19
+ export declare function installDepTips(type: 'dependencies' | 'devDependencies', module: string, version?: string): string;
package/dist/utils.js CHANGED
@@ -3,10 +3,11 @@ 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.resolveSourceMapPath = exports.pathToGlob = exports.normalizeParsePlugins = exports.normalizeMiniProgramFilename = exports.normalizeNodeModules = exports.removeExt = exports.normalizePagePath = exports.normalizeIdentifier = exports.checkElementNodeTag = exports.normalizePath = exports.isWindows = exports.isRunningWithYarnPnp = exports.hash = void 0;
6
+ exports.installDepTips = exports.resolveSourceMapPath = exports.pathToGlob = exports.normalizeParsePlugins = exports.normalizeMiniProgramFilename = exports.normalizeNodeModules = exports.removeExt = exports.normalizePagePath = exports.normalizeIdentifier = exports.checkElementNodeTag = exports.normalizePath = exports.isWindows = exports.isRunningWithYarnPnp = exports.hash = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const os_1 = __importDefault(require("os"));
9
9
  const path_1 = __importDefault(require("path"));
10
+ const picocolors_1 = __importDefault(require("picocolors"));
10
11
  const shared_1 = require("@vue/shared");
11
12
  var hash_sum_1 = require("hash-sum");
12
13
  Object.defineProperty(exports, "hash", { enumerable: true, get: function () { return __importDefault(hash_sum_1).default; } });
@@ -91,3 +92,21 @@ function resolveSourceMapPath(outputDir, platform) {
91
92
  return path_1.default.resolve(outputDir || process.env.UNI_OUTPUT_DIR, '../.sourcemap/' + (platform || (0, platform_1.getPlatformDir)()));
92
93
  }
93
94
  exports.resolveSourceMapPath = resolveSourceMapPath;
95
+ function hasProjectYarn(cwd) {
96
+ return fs_1.default.existsSync(path_1.default.join(cwd, 'yarn.lock'));
97
+ }
98
+ function hasProjectPnpm(cwd) {
99
+ return fs_1.default.existsSync(path_1.default.join(cwd, 'pnpm-lock.yaml'));
100
+ }
101
+ function getInstallCommand(cwd) {
102
+ return hasProjectYarn(cwd)
103
+ ? 'yarn add'
104
+ : hasProjectPnpm(cwd)
105
+ ? 'pnpm i'
106
+ : 'npm i';
107
+ }
108
+ function installDepTips(type, module, version) {
109
+ return `Cannot find module: ${module}
110
+ Please run \`${picocolors_1.default.cyan(`${getInstallCommand(process.cwd())} ${module + (version ? '@' + version : '')}${type === 'devDependencies' ? ' -D' : ''}`)}\` and try again.`;
111
+ }
112
+ exports.installDepTips = installDepTips;
package/dist/uts.js CHANGED
@@ -87,10 +87,14 @@ function resolveUTSCompiler() {
87
87
  paths: [process.env.UNI_CLI_CONTEXT],
88
88
  });
89
89
  }
90
- catch (e) { }
91
- }
92
- if (!compilerPath) {
93
- throw 'uts compiler is not found';
90
+ catch (e) {
91
+ let version = require('@dcloudio/uni-cli-shared/package.json').version;
92
+ if (version.startsWith('2.0.')) {
93
+ version = '^3.0.0-alpha-3060920221117001';
94
+ }
95
+ console.error((0, utils_1.installDepTips)('devDependencies', '@dcloudio/uni-uts-v1', version));
96
+ process.exit(0);
97
+ }
94
98
  }
95
99
  return require(compilerPath);
96
100
  }
@@ -36,7 +36,6 @@ const pluginutils_1 = require("@rollup/pluginutils");
36
36
  const utils_1 = require("../utils");
37
37
  const asset_1 = require("./asset");
38
38
  const magic_string_1 = __importDefault(require("magic-string"));
39
- const esbuild_1 = require("esbuild");
40
39
  const preprocess_1 = require("../../../../preprocess");
41
40
  const constants_1 = require("../../../../constants");
42
41
  const cleanString_1 = require("../cleanString");
@@ -644,20 +643,26 @@ async function doImportCSSReplace(rawUrl, matched, replacer) {
644
643
  }
645
644
  async function minifyCSS(css, config) {
646
645
  try {
647
- const { code, warnings } = await (0, esbuild_1.transform)(css, {
648
- loader: 'css',
649
- minify: true,
650
- target: config.build.cssTarget || undefined,
646
+ const { code, warnings } = await Promise.resolve().then(() => __importStar(require('esbuild'))).then(({ transform }) => {
647
+ return transform(css, {
648
+ loader: 'css',
649
+ minify: true,
650
+ target: config.build.cssTarget || undefined,
651
+ });
651
652
  });
652
653
  if (warnings.length) {
653
- const msgs = await (0, esbuild_1.formatMessages)(warnings, { kind: 'warning' });
654
+ const msgs = await Promise.resolve().then(() => __importStar(require('esbuild'))).then(({ formatMessages }) => {
655
+ return formatMessages(warnings, { kind: 'warning' });
656
+ });
654
657
  config.logger.warn(picocolors_1.default.yellow(`warnings when minifying css:\n${msgs.join('\n')}`));
655
658
  }
656
659
  return code;
657
660
  }
658
661
  catch (e) {
659
662
  if (e.errors) {
660
- const msgs = await (0, esbuild_1.formatMessages)(e.errors, { kind: 'error' });
663
+ const msgs = await Promise.resolve().then(() => __importStar(require('esbuild'))).then(({ formatMessages }) => {
664
+ return formatMessages(e.errors, { kind: 'error' });
665
+ });
661
666
  e.frame = '\n' + msgs.join('\n');
662
667
  e.loc = e.errors[0].location;
663
668
  }
@@ -112,7 +112,7 @@ async function processSrcSet(srcs, replacer) {
112
112
  const src = s.replace(escapedSpaceCharacters, ' ').trim();
113
113
  const [url] = imageSetUrlRE.exec(src) || [];
114
114
  return {
115
- url,
115
+ url: url,
116
116
  descriptor: src === null || src === void 0 ? void 0 : src.slice(url.length).trim(),
117
117
  };
118
118
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-3060920221114001",
3
+ "version": "3.0.0-alpha-3060920221117002",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,17 +25,17 @@
25
25
  "@babel/core": "^7.19.6",
26
26
  "@babel/parser": "^7.19.6",
27
27
  "@babel/types": "^7.20.0",
28
- "@dcloudio/uni-i18n": "3.0.0-alpha-3060920221114001",
29
- "@dcloudio/uni-shared": "3.0.0-alpha-3060920221114001",
28
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3060920221117002",
29
+ "@dcloudio/uni-shared": "3.0.0-alpha-3060920221117002",
30
30
  "@intlify/core-base": "9.1.9",
31
31
  "@intlify/shared": "9.1.9",
32
32
  "@intlify/vue-devtools": "9.1.9",
33
33
  "@rollup/pluginutils": "^4.2.0",
34
- "@vue/compiler-core": "3.2.41",
35
- "@vue/compiler-dom": "3.2.41",
36
- "@vue/compiler-sfc": "3.2.41",
37
- "@vue/server-renderer": "3.2.41",
38
- "@vue/shared": "3.2.41",
34
+ "@vue/compiler-core": "3.2.45",
35
+ "@vue/compiler-dom": "3.2.45",
36
+ "@vue/compiler-sfc": "3.2.45",
37
+ "@vue/server-renderer": "3.2.45",
38
+ "@vue/shared": "3.2.45",
39
39
  "autoprefixer": "^10.4.13",
40
40
  "base64url": "^3.0.1",
41
41
  "chokidar": "^3.5.3",
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
66
66
  "devDependencies": {
67
- "@dcloudio/uni-uts-v1": "3.0.0-alpha-3060920221114001",
67
+ "@dcloudio/uni-uts-v1": "3.0.0-alpha-3060920221117002",
68
68
  "@types/babel__core": "^7.1.19",
69
69
  "@types/debug": "^4.1.7",
70
70
  "@types/estree": "^0.0.51",
@@ -77,6 +77,6 @@
77
77
  "@types/sass": "^1.43.1",
78
78
  "@types/stylus": "^0.48.36",
79
79
  "postcss": "^8.4.16",
80
- "vue": "3.2.41"
80
+ "vue": "3.2.45"
81
81
  }
82
82
  }