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

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.
@@ -27,3 +27,4 @@ export declare const BASE_COMPONENTS_STYLE_PATH = "@dcloudio/uni-components/styl
27
27
  export declare const COMMON_EXCLUDE: RegExp[];
28
28
  export declare const KNOWN_ASSET_TYPES: string[];
29
29
  export declare const DEFAULT_ASSETS_RE: RegExp;
30
+ export declare const TEXT_STYLE: string[];
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_ASSETS_RE = exports.KNOWN_ASSET_TYPES = exports.COMMON_EXCLUDE = exports.BASE_COMPONENTS_STYLE_PATH = exports.H5_COMPONENTS_STYLE_PATH = exports.H5_FRAMEWORK_STYLE_PATH = exports.H5_API_STYLE_PATH = exports.PAGE_EXTNAME = exports.PAGE_EXTNAME_APP = exports.BINDING_COMPONENTS = exports.APP_CONFIG_SERVICE = exports.APP_CONFIG = exports.APP_SERVICE_FILENAME = exports.ASSETS_INLINE_LIMIT = exports.JSON_JS_MAP = exports.MANIFEST_JSON_JS = exports.PAGES_JSON_JS = exports.extensions = exports.EXTNAME_TS_RE = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE_TEMPLATE = exports.EXTNAME_VUE = exports.EXTNAME_TS = exports.EXTNAME_JS = exports.PUBLIC_DIR = void 0;
3
+ exports.TEXT_STYLE = exports.DEFAULT_ASSETS_RE = exports.KNOWN_ASSET_TYPES = exports.COMMON_EXCLUDE = exports.BASE_COMPONENTS_STYLE_PATH = exports.H5_COMPONENTS_STYLE_PATH = exports.H5_FRAMEWORK_STYLE_PATH = exports.H5_API_STYLE_PATH = exports.PAGE_EXTNAME = exports.PAGE_EXTNAME_APP = exports.BINDING_COMPONENTS = exports.APP_CONFIG_SERVICE = exports.APP_CONFIG = exports.APP_SERVICE_FILENAME = exports.ASSETS_INLINE_LIMIT = exports.JSON_JS_MAP = exports.MANIFEST_JSON_JS = exports.PAGES_JSON_JS = exports.extensions = exports.EXTNAME_TS_RE = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE_TEMPLATE = exports.EXTNAME_VUE = exports.EXTNAME_TS = exports.EXTNAME_JS = exports.PUBLIC_DIR = void 0;
4
4
  exports.PUBLIC_DIR = 'static';
5
5
  exports.EXTNAME_JS = ['.js', '.ts', '.jsx', '.tsx'];
6
6
  exports.EXTNAME_TS = ['.ts', '.tsx'];
@@ -77,3 +77,4 @@ exports.KNOWN_ASSET_TYPES = [
77
77
  'txt',
78
78
  ];
79
79
  exports.DEFAULT_ASSETS_RE = new RegExp(`\\.(` + exports.KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
80
+ exports.TEXT_STYLE = ['black', 'white'];
@@ -15,4 +15,5 @@ export declare function initDefine(stringifyBoolean?: boolean): {
15
15
  'process.env.UNI_CLOUD_PROVIDER': string;
16
16
  'process.env.UNICLOUD_DEBUG': string;
17
17
  'process.env.VUE_APP_PLATFORM': string;
18
+ 'process.env.VUE_APP_DARK_MODE': string;
18
19
  };
@@ -5,6 +5,7 @@ const env_1 = require("../hbx/env");
5
5
  const json_1 = require("../json");
6
6
  function initDefine(stringifyBoolean = false) {
7
7
  const manifestJson = (0, json_1.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR);
8
+ const platformManifestJson = (0, json_1.getPlatformManifestJsonOnce)();
8
9
  const isRunByHBuilderX = (0, env_1.runByHBuilderX)();
9
10
  const isDebug = !!manifestJson.debug;
10
11
  return {
@@ -30,6 +31,7 @@ function initDefine(stringifyBoolean = false) {
30
31
  'process.env.UNICLOUD_DEBUG': JSON.stringify(process.env.UNICLOUD_DEBUG || ''),
31
32
  // 兼容旧版本
32
33
  'process.env.VUE_APP_PLATFORM': JSON.stringify(process.env.UNI_PLATFORM || ''),
34
+ 'process.env.VUE_APP_DARK_MODE': JSON.stringify(platformManifestJson.darkmode || false),
33
35
  };
34
36
  }
35
37
  exports.initDefine = initDefine;
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.getNVueFlexDirection = exports.getNVueStyleCompiler = exports.getNVueCompiler = exports.hasConfusionFile = exports.isConfusionFile = exports.APP_CONFUSION_FILENAME = exports.normalizeAppManifestJson = void 0;
18
+ const shared_1 = require("@vue/shared");
18
19
  const merge_1 = require("./merge");
19
20
  const defaultManifestJson_1 = require("./defaultManifestJson");
20
21
  const statusbar_1 = require("./statusbar");
@@ -29,8 +30,12 @@ const launchwebview_1 = require("./launchwebview");
29
30
  const checksystemwebview_1 = require("./checksystemwebview");
30
31
  const tabBar_1 = require("./tabBar");
31
32
  const i18n_1 = require("./i18n");
33
+ const theme_1 = require("../../theme");
32
34
  function normalizeAppManifestJson(userManifestJson, pagesJson) {
33
- const manifestJson = (0, merge_1.initRecursiveMerge)((0, statusbar_1.initAppStatusbar)((0, defaultManifestJson_1.initDefaultManifestJson)(), pagesJson), userManifestJson);
35
+ const manifestJson = (0, merge_1.initRecursiveMerge)((0, defaultManifestJson_1.initDefaultManifestJson)(), userManifestJson);
36
+ const { pages, globalStyle, tabBar } = (0, theme_1.initTheme)(manifestJson, pagesJson);
37
+ (0, shared_1.extend)(pagesJson, { pages, globalStyle, tabBar });
38
+ (0, statusbar_1.initAppStatusbar)(manifestJson, pagesJson);
34
39
  (0, arguments_1.initArguments)(manifestJson, pagesJson);
35
40
  (0, plus_1.initPlus)(manifestJson, pagesJson);
36
41
  (0, nvue_1.initNVue)(manifestJson, pagesJson);
@@ -35,6 +35,14 @@ function initPlus(manifestJson, pagesJson) {
35
35
  manifestJson.plus.distribute.plugins = distribute.sdkConfigs;
36
36
  delete manifestJson.plus.distribute.sdkConfigs;
37
37
  }
38
+ if (manifestJson.plus.darkmode) {
39
+ if (!(distribute.google || (distribute.google = {})).defaultNightMode) {
40
+ distribute.google.defaultNightMode = 'auto';
41
+ }
42
+ if (!(distribute.apple || (distribute.apple = {})).UIUserInterfaceStyle) {
43
+ distribute.apple.UIUserInterfaceStyle = 'Automatic';
44
+ }
45
+ }
38
46
  }
39
47
  // 屏幕启动方向
40
48
  if (manifestJson.plus.screenOrientation) {
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initAppStatusbar = void 0;
4
4
  function initAppStatusbar(manifestJson, pagesJson) {
5
5
  var _a;
6
- const { titleColor = '#000', backgroundColor = '#000000' } = ((_a = pagesJson.globalStyle) === null || _a === void 0 ? void 0 : _a.navigationBar) || {};
6
+ const { titleColor = '#000000', backgroundColor = '#000000' } = ((_a = pagesJson.globalStyle) === null || _a === void 0 ? void 0 : _a.navigationBar) || {};
7
7
  manifestJson.plus.statusbar = {
8
8
  immersed: 'supportedDevice',
9
- style: titleColor === '#000' ? 'dark' : 'light',
9
+ style: titleColor === '#000000' ? 'dark' : 'light',
10
10
  background: backgroundColor,
11
11
  };
12
12
  return manifestJson;
@@ -2,19 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initTabBar = void 0;
4
4
  const uni_shared_1 = require("@dcloudio/uni-shared");
5
- const borderStyles = {
6
- black: 'rgba(0,0,0,0.4)',
7
- white: 'rgba(255,255,255,0.4)',
8
- };
9
5
  function initTabBar(entryPagePath, manifestJson, pagesJson) {
10
6
  var _a, _b;
11
7
  if (!((_b = (_a = pagesJson.tabBar) === null || _a === void 0 ? void 0 : _a.list) === null || _b === void 0 ? void 0 : _b.length)) {
12
8
  return;
13
9
  }
14
10
  const tabBar = JSON.parse(JSON.stringify(pagesJson.tabBar));
15
- if (tabBar.borderStyle in borderStyles) {
16
- tabBar.borderStyle = borderStyles[tabBar.borderStyle];
17
- }
11
+ tabBar.borderStyle = (0, uni_shared_1.normalizeTabBarStyles)(tabBar.borderStyle);
18
12
  if (!tabBar.selectedColor) {
19
13
  tabBar.selectedColor = uni_shared_1.SELECTED_COLOR;
20
14
  }
@@ -10,9 +10,11 @@ const manifest_1 = require("../../manifest");
10
10
  const manifest_2 = require("../manifest");
11
11
  const arguments_1 = require("../manifest/arguments");
12
12
  const splashscreen_1 = require("../manifest/splashscreen");
13
+ const theme_1 = require("../../theme");
13
14
  function normalizeAppUniConfig(pagesJson, manifestJson) {
14
15
  var _a;
15
16
  const { autoclose, alwaysShowBeforeRender } = (0, splashscreen_1.getSplashscreen)(manifestJson);
17
+ const platformConfig = (0, manifest_1.getPlatformManifestJsonOnce)();
16
18
  const config = {
17
19
  pages: [],
18
20
  globalStyle: pagesJson.globalStyle,
@@ -32,6 +34,8 @@ function normalizeAppUniConfig(pagesJson, manifestJson) {
32
34
  networkTimeout: (0, manifest_1.normalizeNetworkTimeout)(manifestJson.networkTimeout),
33
35
  tabBar: pagesJson.tabBar,
34
36
  locales: (0, i18n_1.initLocales)(path_1.default.join(process.env.UNI_INPUT_DIR, 'locale')),
37
+ darkmode: platformConfig.darkmode || false,
38
+ themeConfig: (0, theme_1.normalizeThemeConfigOnce)(platformConfig),
35
39
  };
36
40
  // TODO 待支持分包
37
41
  return JSON.stringify(config);
@@ -3,3 +3,4 @@ export * from './app';
3
3
  export * from './json';
4
4
  export * from './pages';
5
5
  export * from './manifest';
6
+ export * from './theme';
@@ -19,3 +19,4 @@ __exportStar(require("./app"), exports);
19
19
  __exportStar(require("./json"), exports);
20
20
  __exportStar(require("./pages"), exports);
21
21
  __exportStar(require("./manifest"), exports);
22
+ __exportStar(require("./theme"), exports);
@@ -29,4 +29,5 @@ export declare function getRouterOptions(manifestJson: Record<string, any>): {
29
29
  };
30
30
  export declare function isEnableTreeShaking(manifestJson: Record<string, any>): boolean;
31
31
  export declare function getDevServerOptions(manifestJson: Record<string, any>): any;
32
+ export declare function getPlatformManifestJsonOnce(): any;
32
33
  export {};
@@ -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.getDevServerOptions = exports.isEnableTreeShaking = exports.getRouterOptions = exports.isUniPushOffline = exports.isEnableSecureNetwork = exports.isEnableUniPushV2 = exports.isEnableUniPushV1 = exports.getUniStatistics = exports.normalizeNetworkTimeout = exports.parseCompatConfigOnce = exports.parseRpx2UnitOnce = exports.parseManifestJsonOnce = exports.parseManifestJson = void 0;
6
+ exports.getPlatformManifestJsonOnce = exports.getDevServerOptions = exports.isEnableTreeShaking = exports.getRouterOptions = exports.isUniPushOffline = exports.isEnableSecureNetwork = exports.isEnableUniPushV2 = exports.isEnableUniPushV1 = exports.getUniStatistics = exports.normalizeNetworkTimeout = exports.parseCompatConfigOnce = exports.parseRpx2UnitOnce = exports.parseManifestJsonOnce = exports.parseManifestJson = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const shared_1 = require("@vue/shared");
@@ -103,3 +103,10 @@ function getDevServerOptions(manifestJson) {
103
103
  return (0, shared_1.extend)({}, (_a = manifestJson.h5) === null || _a === void 0 ? void 0 : _a.devServer);
104
104
  }
105
105
  exports.getDevServerOptions = getDevServerOptions;
106
+ function getPlatformManifestJsonOnce() {
107
+ const platform = process.env.UNI_PLATFORM === 'app' ? 'app-plus' : process.env.UNI_PLATFORM;
108
+ return !process.env.UNI_INPUT_DIR
109
+ ? {}
110
+ : (0, exports.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR)[platform] || {};
111
+ }
112
+ exports.getPlatformManifestJsonOnce = getPlatformManifestJsonOnce;
@@ -12,6 +12,8 @@ const pages_1 = require("../pages");
12
12
  const utils_1 = require("./utils");
13
13
  const utils_2 = require("../../utils");
14
14
  const project_1 = require("./project");
15
+ const manifest_1 = require("../manifest");
16
+ const theme_1 = require("../theme");
15
17
  function parseMiniProgramPagesJson(jsonStr, platform, options = { subpackages: false }) {
16
18
  return parsePagesJson(jsonStr, platform, options);
17
19
  }
@@ -37,11 +39,11 @@ exports.mergeMiniProgramAppJson = mergeMiniProgramAppJson;
37
39
  function parsePagesJson(jsonStr, platform, { debug, darkmode, networkTimeout, subpackages, windowOptionsMap, tabBarOptionsMap, tabBarItemOptionsMap, } = {
38
40
  subpackages: false,
39
41
  }) {
40
- const appJson = {
42
+ let appJson = {
41
43
  pages: [],
42
44
  };
43
- const pageJsons = {};
44
- const nvuePages = [];
45
+ let pageJsons = {};
46
+ let nvuePages = [];
45
47
  // preprocess
46
48
  const pagesJson = (0, json_1.parseJson)(jsonStr, true);
47
49
  if (!pagesJson) {
@@ -127,6 +129,12 @@ function parsePagesJson(jsonStr, platform, { debug, darkmode, networkTimeout, su
127
129
  appJson.darkmode = true;
128
130
  appJson.themeLocation = 'theme.json';
129
131
  }
132
+ else {
133
+ const manifestJson = (0, manifest_1.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR);
134
+ const { pages, window, tabBar } = (0, theme_1.initTheme)(manifestJson, appJson);
135
+ (0, shared_1.extend)(appJson, { pages, window, tabBar });
136
+ pageJsons = (0, theme_1.initTheme)(manifestJson, pageJsons);
137
+ }
130
138
  return {
131
139
  appJson,
132
140
  pageJsons,
@@ -13,6 +13,8 @@ const json_1 = require("./json");
13
13
  const utils_2 = require("../vue/utils");
14
14
  const vite_1 = require("../vite");
15
15
  const constants_1 = require("../constants");
16
+ const theme_1 = require("./theme");
17
+ const manifest_1 = require("./manifest");
16
18
  const pagesCacheSet = new Set();
17
19
  function isUniPageFile(file, inputDir = process.env.UNI_INPUT_DIR) {
18
20
  if (inputDir && path_1.default.isAbsolute(file)) {
@@ -109,6 +111,11 @@ function normalizePagesJson(jsonStr, platform, { subpackages, } = { subpackages:
109
111
  // 缓存页面列表
110
112
  pagesCacheSet.clear();
111
113
  pagesJson.pages.forEach((page) => pagesCacheSet.add(page.path));
114
+ const manifestJsonPlatform = (0, manifest_1.getPlatformManifestJsonOnce)();
115
+ if (!manifestJsonPlatform.darkmode) {
116
+ const { pages, globalStyle, tabBar } = (0, theme_1.initTheme)(manifestJsonPlatform, pagesJson);
117
+ (0, shared_1.extend)(pagesJson, { pages, globalStyle, tabBar });
118
+ }
112
119
  return pagesJson;
113
120
  }
114
121
  exports.normalizePagesJson = normalizePagesJson;
@@ -271,8 +278,13 @@ function normalizeNavigationBar(pageStyle) {
271
278
  delete navigationBar.titleText;
272
279
  }
273
280
  if (!navigationBar.titleColor && (0, shared_1.hasOwn)(navigationBar, 'textStyle')) {
274
- navigationBar.titleColor =
275
- navigationBar.textStyle === 'black' ? '#000000' : '#ffffff';
281
+ const textStyle = navigationBar.textStyle;
282
+ if (constants_1.TEXT_STYLE.includes(textStyle)) {
283
+ navigationBar.titleColor = (0, uni_shared_1.normalizeTitleColor)(textStyle);
284
+ }
285
+ else {
286
+ navigationBar.titleColor = navigationBar.textStyle;
287
+ }
276
288
  delete navigationBar.textStyle;
277
289
  }
278
290
  if (pageStyle.navigationBarShadow &&
@@ -280,8 +292,9 @@ function normalizeNavigationBar(pageStyle) {
280
292
  navigationBar.shadowColorType = pageStyle.navigationBarShadow.colorType;
281
293
  delete pageStyle.navigationBarShadow;
282
294
  }
295
+ const parsedNavigationBar = (0, theme_1.initTheme)((0, manifest_1.getPlatformManifestJsonOnce)(), navigationBar);
283
296
  if ((0, shared_1.isArray)(navigationBar.buttons)) {
284
- navigationBar.buttons = navigationBar.buttons.map((btn) => normalizeNavigationBarButton(btn, navigationBar.type, navigationBar.titleColor));
297
+ navigationBar.buttons = navigationBar.buttons.map((btn) => normalizeNavigationBarButton(btn, navigationBar.type, parsedNavigationBar.titleColor));
285
298
  }
286
299
  if ((0, shared_1.isPlainObject)(navigationBar.searchInput)) {
287
300
  navigationBar.searchInput = normalizeNavigationBarSearchInput(navigationBar.searchInput);
@@ -334,20 +347,6 @@ function normalizeTabBar(tabBar, platform) {
334
347
  return;
335
348
  }
336
349
  tabBar = (0, shared_1.extend)({}, DEFAULT_TAB_BAR, tabBar);
337
- if (platform === 'h5') {
338
- const len = list.length;
339
- if (len % 2 === 0 && (0, shared_1.isPlainObject)(midButton)) {
340
- list.splice(Math.floor(len / 2), 0, (0, shared_1.extend)({
341
- type: 'midButton',
342
- width: '50px',
343
- height: '50px',
344
- iconWidth: '24px',
345
- }, midButton));
346
- }
347
- else {
348
- delete tabBar.midButton;
349
- }
350
- }
351
350
  list.forEach((item) => {
352
351
  if (item.iconPath) {
353
352
  item.iconPath = normalizeFilepath(item.iconPath);
@@ -355,10 +354,10 @@ function normalizeTabBar(tabBar, platform) {
355
354
  if (item.selectedIconPath) {
356
355
  item.selectedIconPath = normalizeFilepath(item.selectedIconPath);
357
356
  }
358
- if (item.type === 'midButton' && item.backgroundImage) {
359
- item.backgroundImage = normalizeFilepath(item.backgroundImage);
360
- }
361
357
  });
358
+ if (midButton && midButton.backgroundImage) {
359
+ midButton.backgroundImage = normalizeFilepath(midButton.backgroundImage);
360
+ }
362
361
  tabBar.selectedIndex = 0;
363
362
  tabBar.shown = true;
364
363
  return tabBar;
@@ -366,6 +365,9 @@ function normalizeTabBar(tabBar, platform) {
366
365
  const SCHEME_RE = /^([a-z-]+:)?\/\//i;
367
366
  const DATA_RE = /^data:.*,.*/;
368
367
  function normalizeFilepath(filepath) {
368
+ const themeConfig = (0, theme_1.normalizeThemeConfigOnce)()['light'] || {};
369
+ if (themeConfig[filepath.replace('@', '')])
370
+ return filepath;
369
371
  if (!(SCHEME_RE.test(filepath) || DATA_RE.test(filepath)) &&
370
372
  filepath.indexOf('/') !== 0) {
371
373
  return (0, uni_shared_1.addLeadingSlash)(filepath);
@@ -0,0 +1,3 @@
1
+ export declare const parseThemeJson: (themeLocation?: string) => UniApp.ThemeJson;
2
+ export declare const normalizeThemeConfigOnce: (manifestJsonPlatform?: Record<string, any>) => UniApp.ThemeJson;
3
+ export declare function initTheme<T extends object>(manifestJson: Record<string, any>, pagesJson: T): T;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.initTheme = exports.normalizeThemeConfigOnce = exports.parseThemeJson = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const json_1 = require("./json");
10
+ const uni_shared_1 = require("@dcloudio/uni-shared");
11
+ const parseThemeJson = (themeLocation = 'theme.json') => {
12
+ if (!themeLocation || !process.env.UNI_INPUT_DIR) {
13
+ return {};
14
+ }
15
+ themeLocation = path_1.default.join(process.env.UNI_INPUT_DIR, themeLocation);
16
+ if (!fs_1.default.existsSync(themeLocation)) {
17
+ return {};
18
+ }
19
+ const jsonStr = fs_1.default.readFileSync(themeLocation, 'utf8');
20
+ return (0, json_1.parseJson)(jsonStr, true);
21
+ };
22
+ exports.parseThemeJson = parseThemeJson;
23
+ exports.normalizeThemeConfigOnce = (0, uni_shared_1.once)((manifestJsonPlatform = {}) => (0, exports.parseThemeJson)(manifestJsonPlatform.themeLocation));
24
+ function initTheme(manifestJson, pagesJson) {
25
+ const platform = process.env.UNI_PLATFORM === 'app' ? 'app-plus' : process.env.UNI_PLATFORM;
26
+ const manifestPlatform = manifestJson['plus'] || manifestJson[platform] || {};
27
+ const themeConfig = (0, exports.normalizeThemeConfigOnce)(manifestPlatform);
28
+ return (0, uni_shared_1.normalizeStyles)(pagesJson, themeConfig);
29
+ }
30
+ exports.initTheme = initTheme;
@@ -9,6 +9,7 @@ declare const _default: {
9
9
  readonly 'dev.watching.end': "DONE Build complete. Watching for changes...";
10
10
  readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
11
11
  readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
12
+ readonly 'compiler.build.failed': "Build failed with errors.";
12
13
  readonly 'stat.warn.appid': "The current application is not configured with Appid, and uni statistics cannot be used. For details, see https://ask.dcloud.net.cn/article/36303";
13
14
  readonly 'stat.warn.version': "The uni statistics version is not configured. The default version is 1.0.uni statistics version 2.0 is recommended, private deployment data is more secure and code is open source and customizable. details: https://uniapp.dcloud.io/uni-stat";
14
15
  readonly 'stat.warn.tip': "uni statistics version: {version}";
@@ -19,6 +20,9 @@ declare const _default: {
19
20
  readonly 'mp.component.args[1]': "{0} requires two parameters";
20
21
  readonly 'mp.360.unsupported': "360 is unsupported";
21
22
  readonly 'file.notfound': "{file} is not found";
22
- readonly 'uts.ios.tips': "The project uses the uts plug-in. After the uts plug-in code is modified, the [Custom playground native runner](https://uniapp.dcloud.net.cn/tutorial/run/run-app.html#customplayground) needs to be regenerated to take effect";
23
+ readonly 'uts.ios.tips': "The project uses the uts plugin. After the uts plug-in code is modified, the [Custom playground native runner](https://uniapp.dcloud.net.cn/tutorial/run/run-app.html#customplayground) needs to be regenerated to take effect";
24
+ readonly 'uts.android.compiler.server': "The project uses the uts plugin, installing the uts Android runtime extension...";
25
+ readonly 'uts.ios.windows.tips': "When running on Windows to iOS mobile phone, the modification of the uts plugin code needs to be submitted to the cloud to package the custom playground to take effect.";
26
+ readonly 'uts.ios.standard.tips': "When the standard playground runs to an IOS phone, the uts plugin is temporarily not supported. If you need to call the uts plugin, please use a custom playground";
23
27
  };
24
28
  export default _default;
@@ -11,6 +11,7 @@ exports.default = {
11
11
  'dev.watching.end': 'DONE Build complete. Watching for changes...',
12
12
  'dev.watching.end.pages': 'DONE Build complete. PAGES:{pages}',
13
13
  'dev.watching.end.files': 'DONE Build complete. FILES:{files}',
14
+ 'compiler.build.failed': 'Build failed with errors.',
14
15
  'stat.warn.appid': 'The current application is not configured with Appid, and uni statistics cannot be used. For details, see https://ask.dcloud.net.cn/article/36303',
15
16
  'stat.warn.version': 'The uni statistics version is not configured. The default version is 1.0.uni statistics version 2.0 is recommended, private deployment data is more secure and code is open source and customizable. details: https://uniapp.dcloud.io/uni-stat',
16
17
  'stat.warn.tip': 'uni statistics version: {version}',
@@ -21,5 +22,8 @@ exports.default = {
21
22
  'mp.component.args[1]': '{0} requires two parameters',
22
23
  'mp.360.unsupported': '360 is unsupported',
23
24
  'file.notfound': '{file} is not found',
24
- 'uts.ios.tips': 'The project uses the uts plug-in. After the uts plug-in code is modified, the [Custom playground native runner](https://uniapp.dcloud.net.cn/tutorial/run/run-app.html#customplayground) needs to be regenerated to take effect',
25
+ 'uts.ios.tips': 'The project uses the uts plugin. After the uts plug-in code is modified, the [Custom playground native runner](https://uniapp.dcloud.net.cn/tutorial/run/run-app.html#customplayground) needs to be regenerated to take effect',
26
+ 'uts.android.compiler.server': 'The project uses the uts plugin, installing the uts Android runtime extension...',
27
+ 'uts.ios.windows.tips': 'When running on Windows to iOS mobile phone, the modification of the uts plugin code needs to be submitted to the cloud to package the custom playground to take effect.',
28
+ 'uts.ios.standard.tips': 'When the standard playground runs to an IOS phone, the uts plugin is temporarily not supported. If you need to call the uts plugin, please use a custom playground',
25
29
  };
@@ -9,6 +9,7 @@ export declare const M: {
9
9
  readonly 'dev.watching.end': "DONE Build complete. Watching for changes...";
10
10
  readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
11
11
  readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
12
+ readonly 'compiler.build.failed': "编译失败";
12
13
  readonly 'stat.warn.appid': "当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303";
13
14
  readonly 'stat.warn.version': "当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:https://uniapp.dcloud.io/uni-stat";
14
15
  readonly 'stat.warn.tip': "已开启 uni统计{version} 版本";
@@ -20,6 +21,9 @@ export declare const M: {
20
21
  readonly 'mp.360.unsupported': "vue3暂不支持360小程序";
21
22
  readonly 'file.notfound': "{file} 文件不存在";
22
23
  readonly 'uts.ios.tips': "项目使用了uts插件,iOS平台uts插件代码修改后需要重新生成[自定义基座](https://uniapp.dcloud.net.cn/tutorial/run/run-app.html#customplayground)才能生效";
24
+ readonly 'uts.android.compiler.server': "项目使用了uts插件,正在安装 uts Android 运行扩展...";
25
+ readonly 'uts.ios.windows.tips': "iOS手机在windows上真机运行时uts插件代码修改需提交云端打包自定义基座才能生效";
26
+ readonly 'uts.ios.standard.tips': "iOS手机在标准基座真机运行暂不支持uts插件,如需调用uts插件请使用自定义基座";
23
27
  } | {
24
28
  readonly 'app.compiler.version': "Compiler version: {version}";
25
29
  readonly compiling: "Compiling...";
@@ -31,6 +35,7 @@ export declare const M: {
31
35
  readonly 'dev.watching.end': "DONE Build complete. Watching for changes...";
32
36
  readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
33
37
  readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
38
+ readonly 'compiler.build.failed': "Build failed with errors.";
34
39
  readonly 'stat.warn.appid': "The current application is not configured with Appid, and uni statistics cannot be used. For details, see https://ask.dcloud.net.cn/article/36303";
35
40
  readonly 'stat.warn.version': "The uni statistics version is not configured. The default version is 1.0.uni statistics version 2.0 is recommended, private deployment data is more secure and code is open source and customizable. details: https://uniapp.dcloud.io/uni-stat";
36
41
  readonly 'stat.warn.tip': "uni statistics version: {version}";
@@ -41,5 +46,8 @@ export declare const M: {
41
46
  readonly 'mp.component.args[1]': "{0} requires two parameters";
42
47
  readonly 'mp.360.unsupported': "360 is unsupported";
43
48
  readonly 'file.notfound': "{file} is not found";
44
- readonly 'uts.ios.tips': "The project uses the uts plug-in. After the uts plug-in code is modified, the [Custom playground native runner](https://uniapp.dcloud.net.cn/tutorial/run/run-app.html#customplayground) needs to be regenerated to take effect";
49
+ readonly 'uts.ios.tips': "The project uses the uts plugin. After the uts plug-in code is modified, the [Custom playground native runner](https://uniapp.dcloud.net.cn/tutorial/run/run-app.html#customplayground) needs to be regenerated to take effect";
50
+ readonly 'uts.android.compiler.server': "The project uses the uts plugin, installing the uts Android runtime extension...";
51
+ readonly 'uts.ios.windows.tips': "When running on Windows to iOS mobile phone, the modification of the uts plugin code needs to be submitted to the cloud to package the custom playground to take effect.";
52
+ readonly 'uts.ios.standard.tips': "When the standard playground runs to an IOS phone, the uts plugin is temporarily not supported. If you need to call the uts plugin, please use a custom playground";
45
53
  };
@@ -9,6 +9,7 @@ declare const _default: {
9
9
  readonly 'dev.watching.end': "DONE Build complete. Watching for changes...";
10
10
  readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
11
11
  readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
12
+ readonly 'compiler.build.failed': "编译失败";
12
13
  readonly 'stat.warn.appid': "当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303";
13
14
  readonly 'stat.warn.version': "当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:https://uniapp.dcloud.io/uni-stat";
14
15
  readonly 'stat.warn.tip': "已开启 uni统计{version} 版本";
@@ -20,5 +21,8 @@ declare const _default: {
20
21
  readonly 'mp.360.unsupported': "vue3暂不支持360小程序";
21
22
  readonly 'file.notfound': "{file} 文件不存在";
22
23
  readonly 'uts.ios.tips': "项目使用了uts插件,iOS平台uts插件代码修改后需要重新生成[自定义基座](https://uniapp.dcloud.net.cn/tutorial/run/run-app.html#customplayground)才能生效";
24
+ readonly 'uts.android.compiler.server': "项目使用了uts插件,正在安装 uts Android 运行扩展...";
25
+ readonly 'uts.ios.windows.tips': "iOS手机在windows上真机运行时uts插件代码修改需提交云端打包自定义基座才能生效";
26
+ readonly 'uts.ios.standard.tips': "iOS手机在标准基座真机运行暂不支持uts插件,如需调用uts插件请使用自定义基座";
23
27
  };
24
28
  export default _default;
@@ -11,6 +11,7 @@ exports.default = {
11
11
  'dev.watching.end': 'DONE Build complete. Watching for changes...',
12
12
  'dev.watching.end.pages': 'DONE Build complete. PAGES:{pages}',
13
13
  'dev.watching.end.files': 'DONE Build complete. FILES:{files}',
14
+ 'compiler.build.failed': '编译失败',
14
15
  'stat.warn.appid': '当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303',
15
16
  'stat.warn.version': '当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:https://uniapp.dcloud.io/uni-stat',
16
17
  'stat.warn.tip': '已开启 uni统计{version} 版本',
@@ -22,4 +23,7 @@ exports.default = {
22
23
  'mp.360.unsupported': 'vue3暂不支持360小程序',
23
24
  'file.notfound': '{file} 文件不存在',
24
25
  'uts.ios.tips': '项目使用了uts插件,iOS平台uts插件代码修改后需要重新生成[自定义基座](https://uniapp.dcloud.net.cn/tutorial/run/run-app.html#customplayground)才能生效',
26
+ 'uts.android.compiler.server': '项目使用了uts插件,正在安装 uts Android 运行扩展...',
27
+ 'uts.ios.windows.tips': 'iOS手机在windows上真机运行时uts插件代码修改需提交云端打包自定义基座才能生效',
28
+ 'uts.ios.standard.tips': 'iOS手机在标准基座真机运行暂不支持uts插件,如需调用uts插件请使用自定义基座',
25
29
  };
@@ -7,6 +7,6 @@ export * from './assets';
7
7
  export * from './template';
8
8
  export * from './constants';
9
9
  export { HTML_TO_MINI_PROGRAM_TAGS } from './tags';
10
- export { copyMiniProgramPluginJson } from './plugin';
10
+ export { copyMiniProgramPluginJson, copyMiniProgramThemeJson } from './plugin';
11
11
  export { parseMainDescriptor, parseScriptDescriptor, parseTemplateDescriptor, transformDynamicImports, updateMiniProgramGlobalComponents, updateMiniProgramComponentsByMainFilename, updateMiniProgramComponentsByScriptFilename, updateMiniProgramComponentsByTemplateFilename, } from './usingComponents';
12
12
  export { hasExternalClasses, parseExternalClasses, findMiniProgramComponentExternalClasses, updateMiniProgramComponentExternalClasses, } from './externalClasses';
package/dist/mp/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.updateMiniProgramComponentExternalClasses = exports.findMiniProgramComponentExternalClasses = exports.parseExternalClasses = exports.hasExternalClasses = exports.updateMiniProgramComponentsByTemplateFilename = exports.updateMiniProgramComponentsByScriptFilename = exports.updateMiniProgramComponentsByMainFilename = exports.updateMiniProgramGlobalComponents = exports.transformDynamicImports = exports.parseTemplateDescriptor = exports.parseScriptDescriptor = exports.parseMainDescriptor = exports.copyMiniProgramPluginJson = exports.HTML_TO_MINI_PROGRAM_TAGS = void 0;
17
+ exports.updateMiniProgramComponentExternalClasses = exports.findMiniProgramComponentExternalClasses = exports.parseExternalClasses = exports.hasExternalClasses = exports.updateMiniProgramComponentsByTemplateFilename = exports.updateMiniProgramComponentsByScriptFilename = exports.updateMiniProgramComponentsByMainFilename = exports.updateMiniProgramGlobalComponents = exports.transformDynamicImports = exports.parseTemplateDescriptor = exports.parseScriptDescriptor = exports.parseMainDescriptor = exports.copyMiniProgramThemeJson = exports.copyMiniProgramPluginJson = exports.HTML_TO_MINI_PROGRAM_TAGS = void 0;
18
18
  __exportStar(require("./ast"), exports);
19
19
  __exportStar(require("./wxs"), exports);
20
20
  __exportStar(require("./nvue"), exports);
@@ -27,6 +27,7 @@ var tags_1 = require("./tags");
27
27
  Object.defineProperty(exports, "HTML_TO_MINI_PROGRAM_TAGS", { enumerable: true, get: function () { return tags_1.HTML_TO_MINI_PROGRAM_TAGS; } });
28
28
  var plugin_1 = require("./plugin");
29
29
  Object.defineProperty(exports, "copyMiniProgramPluginJson", { enumerable: true, get: function () { return plugin_1.copyMiniProgramPluginJson; } });
30
+ Object.defineProperty(exports, "copyMiniProgramThemeJson", { enumerable: true, get: function () { return plugin_1.copyMiniProgramThemeJson; } });
30
31
  var usingComponents_1 = require("./usingComponents");
31
32
  Object.defineProperty(exports, "parseMainDescriptor", { enumerable: true, get: function () { return usingComponents_1.parseMainDescriptor; } });
32
33
  Object.defineProperty(exports, "parseScriptDescriptor", { enumerable: true, get: function () { return usingComponents_1.parseScriptDescriptor; } });
@@ -1,2 +1,3 @@
1
1
  import { UniViteCopyPluginTarget } from '../vite/plugins/copy';
2
2
  export declare const copyMiniProgramPluginJson: UniViteCopyPluginTarget;
3
+ export declare const copyMiniProgramThemeJson: () => UniViteCopyPluginTarget[];
package/dist/mp/plugin.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.copyMiniProgramPluginJson = void 0;
3
+ exports.copyMiniProgramThemeJson = exports.copyMiniProgramPluginJson = void 0;
4
4
  const json_1 = require("../json/json");
5
+ const manifest_1 = require("../json/manifest");
5
6
  exports.copyMiniProgramPluginJson = {
6
7
  src: ['plugin.json'],
7
8
  get dest() {
@@ -11,3 +12,23 @@ exports.copyMiniProgramPluginJson = {
11
12
  return JSON.stringify((0, json_1.parseJson)(source.toString(), true), null, 2);
12
13
  },
13
14
  };
15
+ const copyMiniProgramThemeJson = () => {
16
+ if (!process.env.UNI_INPUT_DIR)
17
+ 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
+ ? [
22
+ {
23
+ src: [manifestJson.themeLocation],
24
+ get dest() {
25
+ return process.env.UNI_OUTPUT_DIR;
26
+ },
27
+ transform(source) {
28
+ return JSON.stringify((0, json_1.parseJson)(source.toString(), true), null, 2);
29
+ },
30
+ },
31
+ ]
32
+ : [];
33
+ };
34
+ exports.copyMiniProgramThemeJson = copyMiniProgramThemeJson;
@@ -56,6 +56,19 @@ function walkDecls(rpx2unit) {
56
56
  decl.value = rpx2unit(decl.value);
57
57
  };
58
58
  }
59
+ function filterPrefersColorScheme(root) {
60
+ var _a;
61
+ if (process.env.VUE_APP_DARK_MODE !== 'true') {
62
+ const filePath = (_a = root.source) === null || _a === void 0 ? void 0 : _a.input.file;
63
+ if (filePath && filePath.includes('@dcloudio')) {
64
+ root.walkAtRules((rule) => {
65
+ if (rule.params.includes('prefers-color-scheme')) {
66
+ rule.remove();
67
+ }
68
+ });
69
+ }
70
+ }
71
+ }
59
72
  const baiduTags = {
60
73
  navigator: 'nav',
61
74
  };
@@ -96,6 +109,7 @@ const uniapp = (opts) => {
96
109
  OnceExit(root) {
97
110
  root.walkDecls(walkDecls(rpx2unit));
98
111
  const rewriteTag = transforms[platform];
112
+ filterPrefersColorScheme(root);
99
113
  if (rewriteTag) {
100
114
  root.walkRules(walkRules({
101
115
  rewriteTag,
package/lib/.DS_Store ADDED
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-3060820221027002",
3
+ "version": "3.0.0-alpha-3060820221027004",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@ampproject/remapping": "^2.1.2",
25
- "@babel/core": "^7.18.13",
26
- "@babel/parser": "^7.18.13",
27
- "@babel/types": "^7.17.0",
28
- "@dcloudio/uni-i18n": "3.0.0-alpha-3060820221027002",
29
- "@dcloudio/uni-shared": "3.0.0-alpha-3060820221027002",
25
+ "@babel/core": "^7.19.6",
26
+ "@babel/parser": "^7.19.6",
27
+ "@babel/types": "^7.20.0",
28
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3060820221027004",
29
+ "@dcloudio/uni-shared": "3.0.0-alpha-3060820221027004",
30
30
  "@intlify/core-base": "9.1.9",
31
31
  "@intlify/shared": "9.1.9",
32
32
  "@intlify/vue-devtools": "9.1.9",
@@ -36,7 +36,7 @@
36
36
  "@vue/compiler-sfc": "3.2.41",
37
37
  "@vue/server-renderer": "3.2.41",
38
38
  "@vue/shared": "3.2.41",
39
- "autoprefixer": "^10.4.12",
39
+ "autoprefixer": "^10.4.13",
40
40
  "base64url": "^3.0.1",
41
41
  "chokidar": "^3.5.3",
42
42
  "compare-versions": "^3.6.0",
@@ -48,7 +48,7 @@
48
48
  "fs-extra": "^10.0.0",
49
49
  "hash-sum": "^2.0.0",
50
50
  "jsonc-parser": "^3.0.0",
51
- "magic-string": "^0.26.3",
51
+ "magic-string": "^0.26.7",
52
52
  "merge": "^2.1.1",
53
53
  "mime": "^3.0.0",
54
54
  "module-alias": "^2.2.2",
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
66
66
  "devDependencies": {
67
- "@dcloudio/uni-uts-v1": "3.0.0-alpha-3060820221027002",
67
+ "@dcloudio/uni-uts-v1": "3.0.0-alpha-3060820221027004",
68
68
  "@types/babel__core": "^7.1.19",
69
69
  "@types/debug": "^4.1.7",
70
70
  "@types/estree": "^0.0.51",