@dcloudio/uni-cli-shared 3.0.0-alpha-3071220230324001 → 3.0.0-alpha-3071220230331001

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/i18n.js CHANGED
@@ -17,7 +17,7 @@ function initI18nOptions(platform, inputDir, warning = false, withMessages = tru
17
17
  return;
18
18
  }
19
19
  const manifestJson = (0, json_1.parseManifestJsonOnce)(inputDir);
20
- const fallbackLocale = manifestJson.fallbackLocale || manifestJson.locale;
20
+ let fallbackLocale = manifestJson.fallbackLocale || 'en';
21
21
  const locale = resolveI18nLocale(platform, Object.keys(locales), fallbackLocale);
22
22
  if (warning) {
23
23
  if (!fallbackLocale) {
@@ -32,6 +32,7 @@ function normalizeAppUniConfig(pagesJson, manifestJson) {
32
32
  ...parseEntryPagePath(pagesJson),
33
33
  networkTimeout: (0, manifest_1.normalizeNetworkTimeout)(manifestJson.networkTimeout),
34
34
  tabBar: pagesJson.tabBar,
35
+ fallbackLocale: manifestJson.fallbackLocale,
35
36
  locales: (0, i18n_1.initLocales)(path_1.default.join(process.env.UNI_INPUT_DIR, 'locale')),
36
37
  darkmode: platformConfig.darkmode || false,
37
38
  themeConfig: (0, theme_1.normalizeThemeConfigOnce)(platformConfig),
package/dist/mp/style.js CHANGED
@@ -1,9 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformScopedCss = void 0;
4
+ const tags_1 = require("./tags");
5
+ const logs_1 = require("../logs");
4
6
  function transformScopedCss(cssCode) {
7
+ checkHtmlTagSelector(cssCode);
5
8
  return cssCode.replace(/\[(data-v-[a-f0-9]{8})\]/gi, (_, scopedId) => {
6
9
  return '.' + scopedId;
7
10
  });
8
11
  }
9
12
  exports.transformScopedCss = transformScopedCss;
13
+ function checkHtmlTagSelector(cssCode) {
14
+ for (const tag in tags_1.HTML_TO_MINI_PROGRAM_TAGS) {
15
+ if (new RegExp(`( |\n|\t|,|})${tag}( *)(,|{)`, 'g').test(cssCode)) {
16
+ (0, logs_1.output)('warn', `小程序端 style 暂不支持 ${tag} 标签选择器,推荐使用 class 选择器,详情参考:https://uniapp.dcloud.net.cn/tutorial/migration-to-vue3.html#style`);
17
+ break;
18
+ }
19
+ }
20
+ }
@@ -1,13 +1,22 @@
1
- type Define = string | string[] | Record<string, string> | false;
1
+ type DefineOptions = {
2
+ name?: string;
3
+ app?: boolean | {
4
+ js?: boolean;
5
+ kotlin?: boolean;
6
+ swift?: boolean;
7
+ };
8
+ [key: string]: any;
9
+ };
10
+ type Define = string | string[] | Record<string, string | DefineOptions> | false;
2
11
  type Defines = {
3
12
  [name: string]: Define;
4
13
  };
5
- interface Exports {
14
+ export interface Exports {
6
15
  [name: string]: Define | Defines | false;
7
16
  }
8
17
  export declare function parseUniExtApis(vite?: boolean): Injects;
9
18
  type Injects = {
10
- [name: string]: string | string[] | false;
19
+ [name: string]: string | [string, string] | [string, string, DefineOptions['app']] | false;
11
20
  };
12
21
  /**
13
22
  * uni:'getBatteryInfo'
@@ -31,5 +40,5 @@ type Injects = {
31
40
  * @returns
32
41
  */
33
42
  export declare function parseInjects(vite: boolean | undefined, platform: UniApp.PLATFORM, source: string, exports?: Exports): Injects;
34
- export declare function parseInject(vite: boolean | undefined, source: string, globalObject: string, define: Define): Injects;
43
+ export declare function parseInject(vite: boolean | undefined, platform: UniApp.PLATFORM, source: string, globalObject: string, define: Define): Injects;
35
44
  export {};
@@ -74,12 +74,12 @@ function parseInjects(vite = true, platform, source, exports = {}) {
74
74
  }
75
75
  const injects = {};
76
76
  for (const key in rootDefines) {
77
- Object.assign(injects, parseInject(vite, source, 'uni', rootDefines[key]));
77
+ Object.assign(injects, parseInject(vite, platform, source, 'uni', rootDefines[key]));
78
78
  }
79
79
  return injects;
80
80
  }
81
81
  exports.parseInjects = parseInjects;
82
- function parseInject(vite = true, source, globalObject, define) {
82
+ function parseInject(vite = true, platform, source, globalObject, define) {
83
83
  const injects = {};
84
84
  if (define === false) {
85
85
  }
@@ -96,7 +96,24 @@ function parseInject(vite = true, source, globalObject, define) {
96
96
  else {
97
97
  const keys = Object.keys(define);
98
98
  keys.forEach((d) => {
99
- injects[globalObject + '.' + d] = [source, define[d]];
99
+ if (typeof define[d] === 'string') {
100
+ injects[globalObject + '.' + d] = [source, define[d]];
101
+ }
102
+ else {
103
+ const defineOptions = define[d];
104
+ if (defineOptions[platform] !== false) {
105
+ if (platform === 'app') {
106
+ injects[globalObject + '.' + d] = [
107
+ source,
108
+ defineOptions.name || d,
109
+ defineOptions.app,
110
+ ];
111
+ }
112
+ else {
113
+ injects[globalObject + '.' + d] = [source, defineOptions.name || d];
114
+ }
115
+ }
116
+ }
100
117
  });
101
118
  }
102
119
  return injects;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-3071220230324001",
3
+ "version": "3.0.0-alpha-3071220230331001",
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.20.5",
26
26
  "@babel/parser": "^7.20.5",
27
27
  "@babel/types": "^7.20.7",
28
- "@dcloudio/uni-i18n": "3.0.0-alpha-3071220230324001",
29
- "@dcloudio/uni-shared": "3.0.0-alpha-3071220230324001",
28
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3071220230331001",
29
+ "@dcloudio/uni-shared": "3.0.0-alpha-3071220230331001",
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-3071220230324001",
67
+ "@dcloudio/uni-uts-v1": "3.0.0-alpha-3071220230331001",
68
68
  "@types/babel__core": "^7.1.19",
69
69
  "@types/debug": "^4.1.7",
70
70
  "@types/estree": "^0.0.51",