@dcloudio/uni-cli-shared 3.0.0-alpha-3021320211119002 → 3.0.0-alpha-3021320211119003

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.
@@ -1 +1,5 @@
1
1
  export declare function initSplashscreen(manifestJson: Record<string, any>, userManifestJson: Record<string, any>): void;
2
+ export declare function getSplashscreen(manifestJson: Record<string, any>): {
3
+ autoclose: boolean;
4
+ alwaysShowBeforeRender: boolean;
5
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initSplashscreen = void 0;
3
+ exports.getSplashscreen = exports.initSplashscreen = void 0;
4
4
  const shared_1 = require("@vue/shared");
5
5
  function initSplashscreen(manifestJson, userManifestJson) {
6
6
  if (!manifestJson.plus.splashscreen) {
@@ -21,8 +21,6 @@ function initSplashscreen(manifestJson, userManifestJson) {
21
21
  }
22
22
  manifestJson.plus.splashscreen.autoclose = true;
23
23
  manifestJson.plus.splashscreen.delay = 0;
24
- // 简单起见,直接设置环境变量,这样生成uniConfig时,直接读取判断
25
- process.env.UNI_SPLASHSCREEN_ALWAYSSHOWBEFORERENDER = 'true';
26
24
  }
27
25
  else {
28
26
  // 不启用白屏检测
@@ -30,10 +28,17 @@ function initSplashscreen(manifestJson, userManifestJson) {
30
28
  if (manifestJson.plus.splashscreen.autoclose) {
31
29
  // 启用 uni-app 框架关闭 splash
32
30
  manifestJson.plus.splashscreen.autoclose = false; // 原 5+ autoclose 改为 false
33
- // 简单起见,直接设置环境变量,这样生成uniConfig时,直接读取判断
34
- process.env.UNI_SPLASHSCREEN_AUTOCLOSE = 'true';
35
31
  }
36
32
  }
37
33
  delete manifestJson.plus.splashscreen.alwaysShowBeforeRender;
38
34
  }
39
35
  exports.initSplashscreen = initSplashscreen;
36
+ function getSplashscreen(manifestJson) {
37
+ var _a;
38
+ const splashscreenOptions = (_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.splashscreen;
39
+ return {
40
+ autoclose: splashscreenOptions.autoclose !== false,
41
+ alwaysShowBeforeRender: splashscreenOptions.alwaysShowBeforeRender !== false,
42
+ };
43
+ }
44
+ exports.getSplashscreen = getSplashscreen;
@@ -8,8 +8,10 @@ const path_1 = __importDefault(require("path"));
8
8
  const i18n_1 = require("../../../i18n");
9
9
  const manifest_1 = require("../../manifest");
10
10
  const manifest_2 = require("../manifest");
11
+ const splashscreen_1 = require("../manifest/splashscreen");
11
12
  function normalizeAppUniConfig(pagesJson, manifestJson) {
12
13
  var _a;
14
+ const { autoclose, alwaysShowBeforeRender } = (0, splashscreen_1.getSplashscreen)(manifestJson);
13
15
  const config = {
14
16
  pages: [],
15
17
  globalStyle: pagesJson.globalStyle,
@@ -21,11 +23,8 @@ function normalizeAppUniConfig(pagesJson, manifestJson) {
21
23
  renderer: ((_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.renderer) === 'native' ? 'native' : 'auto',
22
24
  appname: manifestJson.name || '',
23
25
  splashscreen: {
24
- alwaysShowBeforeRender: process.env
25
- .UNI_SPLASHSCREEN_ALWAYSSHOWBEFORERENDER
26
- ? true
27
- : false,
28
- autoclose: process.env.UNI_SPLASHSCREEN_AUTOCLOSE ? true : false,
26
+ alwaysShowBeforeRender,
27
+ autoclose,
29
28
  },
30
29
  compilerVersion: process.env.UNI_COMPILER_VERSION,
31
30
  entryPagePath: pagesJson.pages[0].path,
package/dist/resolve.js CHANGED
@@ -10,6 +10,7 @@ const debug_1 = __importDefault(require("debug"));
10
10
  const resolve_1 = __importDefault(require("resolve"));
11
11
  const uni_shared_1 = require("@dcloudio/uni-shared");
12
12
  const utils_1 = require("./utils");
13
+ const env_1 = require("./hbx/env");
13
14
  const DEFAULT_EXTENSIONS = ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'];
14
15
  function resolveWithSymlinks(id, basedir) {
15
16
  return resolve_1.default.sync(id, {
@@ -50,20 +51,23 @@ function initPaths() {
50
51
  if (cliContext) {
51
52
  const pathSet = new Set();
52
53
  pathSet.add(path_1.default.join(cliContext, 'node_modules'));
53
- [`@dcloudio/uni-` + process.env.UNI_PLATFORM, ...ownerModules].forEach((ownerModule) => {
54
- let pkgPath = '';
55
- try {
56
- pkgPath = require.resolve(ownerModule + '/package.json', {
57
- paths: [cliContext],
58
- });
59
- }
60
- catch (e) { }
61
- if (pkgPath) {
62
- resolveNodeModulePath(path_1.default.dirname(pkgPath)).forEach((nodeModulePath) => {
63
- pathSet.add(nodeModulePath);
64
- });
65
- }
66
- });
54
+ if (!(0, env_1.isInHBuilderX)()) {
55
+ ;
56
+ [`@dcloudio/uni-` + process.env.UNI_PLATFORM, ...ownerModules].forEach((ownerModule) => {
57
+ let pkgPath = '';
58
+ try {
59
+ pkgPath = require.resolve(ownerModule + '/package.json', {
60
+ paths: [cliContext],
61
+ });
62
+ }
63
+ catch (e) { }
64
+ if (pkgPath) {
65
+ resolveNodeModulePath(path_1.default.dirname(pkgPath)).forEach((nodeModulePath) => {
66
+ pathSet.add(nodeModulePath);
67
+ });
68
+ }
69
+ });
70
+ }
67
71
  paths.push(...pathSet);
68
72
  (0, debug_1.default)('uni-paths')(paths);
69
73
  }
@@ -82,7 +86,12 @@ exports.resolveBuiltIn = resolveBuiltIn;
82
86
  let componentsLibPath = '';
83
87
  function resolveComponentsLibPath() {
84
88
  if (!componentsLibPath) {
85
- componentsLibPath = path_1.default.join(resolveWithSymlinks('@dcloudio/uni-components/package.json', process.env.UNI_INPUT_DIR), '../lib');
89
+ if ((0, env_1.isInHBuilderX)()) {
90
+ componentsLibPath = path_1.default.join(resolveBuiltIn('@dcloudio/uni-components/package.json'), '../lib');
91
+ }
92
+ else {
93
+ componentsLibPath = path_1.default.join(resolveWithSymlinks('@dcloudio/uni-components/package.json', process.env.UNI_INPUT_DIR), '../lib');
94
+ }
86
95
  }
87
96
  return componentsLibPath;
88
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-3021320211119002",
3
+ "version": "3.0.0-alpha-3021320211119003",
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-3021320211119002",
24
- "@dcloudio/uni-shared": "3.0.0-alpha-3021320211119002",
23
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3021320211119003",
24
+ "@dcloudio/uni-shared": "3.0.0-alpha-3021320211119003",
25
25
  "@rollup/pluginutils": "^4.1.1",
26
26
  "@vue/compiler-core": "3.2.22",
27
27
  "@vue/compiler-dom": "3.2.22",