@dcloudio/uni-cli-shared 3.0.0-alpha-3060820221027004 → 3.0.0-alpha-3060920221111002

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.js CHANGED
@@ -43,7 +43,7 @@ if (typeof console !== 'undefined') {
43
43
  // overridedConsole('error', console.error, ZERO_WIDTH_CHAR.ERROR)
44
44
  }
45
45
  function formatAtFilename(filename, line, column) {
46
- return `at ${picocolors_1.default.cyan((0, utils_1.normalizePath)(path_1.default.relative(process.env.UNI_INPUT_DIR, filename.split('?')[0])) +
46
+ return `at ${picocolors_1.default.cyan((0, utils_1.normalizePath)(path_1.default.relative(process.env.UNI_INPUT_DIR, filename.replace('\x00', '').split('?')[0])) +
47
47
  ':' +
48
48
  (line || 1) +
49
49
  ':' +
@@ -34,7 +34,7 @@ const theme_1 = require("../../theme");
34
34
  function normalizeAppManifestJson(userManifestJson, pagesJson) {
35
35
  const manifestJson = (0, merge_1.initRecursiveMerge)((0, defaultManifestJson_1.initDefaultManifestJson)(), userManifestJson);
36
36
  const { pages, globalStyle, tabBar } = (0, theme_1.initTheme)(manifestJson, pagesJson);
37
- (0, shared_1.extend)(pagesJson, { pages, globalStyle, tabBar });
37
+ (0, shared_1.extend)(pagesJson, JSON.parse(JSON.stringify({ pages, globalStyle, tabBar })));
38
38
  (0, statusbar_1.initAppStatusbar)(manifestJson, pagesJson);
39
39
  (0, arguments_1.initArguments)(manifestJson, pagesJson);
40
40
  (0, plus_1.initPlus)(manifestJson, pagesJson);
@@ -125,16 +125,19 @@ function parsePagesJson(jsonStr, platform, { debug, darkmode, networkTimeout, su
125
125
  if (networkTimeout) {
126
126
  appJson.networkTimeout = networkTimeout;
127
127
  }
128
- if (darkmode) {
129
- appJson.darkmode = true;
130
- appJson.themeLocation = 'theme.json';
131
- }
132
- else {
133
- const manifestJson = (0, manifest_1.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR);
128
+ const manifestJson = (0, manifest_1.getPlatformManifestJsonOnce)();
129
+ if (!darkmode) {
134
130
  const { pages, window, tabBar } = (0, theme_1.initTheme)(manifestJson, appJson);
135
- (0, shared_1.extend)(appJson, { pages, window, tabBar });
131
+ (0, shared_1.extend)(appJson, JSON.parse(JSON.stringify({ pages, window, tabBar })));
132
+ delete appJson.darkmode;
133
+ delete appJson.themeLocation;
136
134
  pageJsons = (0, theme_1.initTheme)(manifestJson, pageJsons);
137
135
  }
136
+ else {
137
+ const themeLocation = manifestJson.themeLocation || 'theme.json';
138
+ if ((0, theme_1.hasThemeJson)(path_1.default.join(process.env.UNI_INPUT_DIR, themeLocation)))
139
+ appJson.themeLocation = themeLocation;
140
+ }
138
141
  return {
139
142
  appJson,
140
143
  pageJsons,
@@ -1,3 +1,4 @@
1
+ export declare function hasThemeJson(themeLocation: string): boolean;
1
2
  export declare const parseThemeJson: (themeLocation?: string) => UniApp.ThemeJson;
2
3
  export declare const normalizeThemeConfigOnce: (manifestJsonPlatform?: Record<string, any>) => UniApp.ThemeJson;
3
4
  export declare function initTheme<T extends object>(manifestJson: Record<string, any>, pagesJson: T): T;
@@ -3,17 +3,24 @@ 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.initTheme = exports.normalizeThemeConfigOnce = exports.parseThemeJson = void 0;
6
+ exports.initTheme = exports.normalizeThemeConfigOnce = exports.parseThemeJson = exports.hasThemeJson = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const json_1 = require("./json");
10
10
  const uni_shared_1 = require("@dcloudio/uni-shared");
11
+ function hasThemeJson(themeLocation) {
12
+ if (!fs_1.default.existsSync(themeLocation)) {
13
+ return false;
14
+ }
15
+ return true;
16
+ }
17
+ exports.hasThemeJson = hasThemeJson;
11
18
  const parseThemeJson = (themeLocation = 'theme.json') => {
12
19
  if (!themeLocation || !process.env.UNI_INPUT_DIR) {
13
20
  return {};
14
21
  }
15
22
  themeLocation = path_1.default.join(process.env.UNI_INPUT_DIR, themeLocation);
16
- if (!fs_1.default.existsSync(themeLocation)) {
23
+ if (!hasThemeJson(themeLocation)) {
17
24
  return {};
18
25
  }
19
26
  const jsonStr = fs_1.default.readFileSync(themeLocation, 'utf8');
package/dist/mp/plugin.js CHANGED
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.copyMiniProgramThemeJson = exports.copyMiniProgramPluginJson = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
4
9
  const json_1 = require("../json/json");
5
10
  const manifest_1 = require("../json/manifest");
6
11
  exports.copyMiniProgramPluginJson = {
@@ -15,12 +20,13 @@ exports.copyMiniProgramPluginJson = {
15
20
  const copyMiniProgramThemeJson = () => {
16
21
  if (!process.env.UNI_INPUT_DIR)
17
22
  return [];
18
- const manifestJson = (0, manifest_1.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR)[process.env.UNI_PLATFORM] || {};
19
- return (manifestJson.darkmode && manifestJson.themeLocation) ||
20
- (manifestJson.themeLocation = 'theme.json')
21
- ? [
23
+ const manifestJson = (0, manifest_1.getPlatformManifestJsonOnce)();
24
+ const themeLocation = manifestJson.themeLocation || 'theme.json';
25
+ const hasThemeJson = fs_1.default.existsSync(path_1.default.resolve(process.env.UNI_INPUT_DIR, themeLocation));
26
+ if (hasThemeJson) {
27
+ return [
22
28
  {
23
- src: [manifestJson.themeLocation],
29
+ src: [(manifestJson.themeLocation = themeLocation)],
24
30
  get dest() {
25
31
  return process.env.UNI_OUTPUT_DIR;
26
32
  },
@@ -28,7 +34,8 @@ const copyMiniProgramThemeJson = () => {
28
34
  return JSON.stringify((0, json_1.parseJson)(source.toString(), true), null, 2);
29
35
  },
30
36
  },
31
- ]
32
- : [];
37
+ ];
38
+ }
39
+ return [];
33
40
  };
34
41
  exports.copyMiniProgramThemeJson = copyMiniProgramThemeJson;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-3060820221027004",
3
+ "version": "3.0.0-alpha-3060920221111002",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,8 +25,8 @@
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-3060820221027004",
29
- "@dcloudio/uni-shared": "3.0.0-alpha-3060820221027004",
28
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3060920221111002",
29
+ "@dcloudio/uni-shared": "3.0.0-alpha-3060920221111002",
30
30
  "@intlify/core-base": "9.1.9",
31
31
  "@intlify/shared": "9.1.9",
32
32
  "@intlify/vue-devtools": "9.1.9",
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
66
66
  "devDependencies": {
67
- "@dcloudio/uni-uts-v1": "3.0.0-alpha-3060820221027004",
67
+ "@dcloudio/uni-uts-v1": "3.0.0-alpha-3060920221111002",
68
68
  "@types/babel__core": "^7.1.19",
69
69
  "@types/debug": "^4.1.7",
70
70
  "@types/estree": "^0.0.51",
package/lib/.DS_Store DELETED
Binary file
Binary file