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

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) {
@@ -31,11 +31,10 @@ exports.getNVueStyleCompiler = getNVueStyleCompiler;
31
31
  const flexDirs = ['row', 'row-reverse', 'column', 'column-reverse'];
32
32
  function getNVueFlexDirection(manifestJson) {
33
33
  let flexDir = 'column';
34
- if (manifestJson['app-plus']?.nvue?.['flex-direction']) {
35
- flexDir = manifestJson['app-plus'].nvue['flex-direction'];
36
- if (flexDirs.indexOf(flexDir) === -1) {
37
- flexDir = 'column';
38
- }
34
+ const appPlusJson = manifestJson['app-plus'] || manifestJson['plus'];
35
+ if (appPlusJson?.nvue?.['flex-direction'] &&
36
+ flexDirs.includes(appPlusJson?.nvue?.['flex-direction'])) {
37
+ flexDir = appPlusJson.nvue['flex-direction'];
39
38
  }
40
39
  return flexDir;
41
40
  }
@@ -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 {};
@@ -12,6 +12,13 @@ function parseUniExtApis(vite = true) {
12
12
  if (!fs_extra_1.default.existsSync(uniModulesDir)) {
13
13
  return {};
14
14
  }
15
+ let platform = process.env.UNI_PLATFORM;
16
+ if (platform === 'h5') {
17
+ platform = 'web';
18
+ }
19
+ else if (platform === 'app-plus') {
20
+ platform = 'app';
21
+ }
15
22
  const injects = {};
16
23
  fs_extra_1.default.readdirSync(uniModulesDir).forEach((uniModuleDir) => {
17
24
  // 必须以 uni- 开头
@@ -26,9 +33,19 @@ function parseUniExtApis(vite = true) {
26
33
  const exports = JSON.parse(fs_extra_1.default.readFileSync(pkgPath, 'utf8'))
27
34
  ?.uni_modules?.['uni-ext-api'];
28
35
  if (exports) {
29
- Object.assign(injects, parseInjects(vite, process.env.UNI_PLATFORM === 'h5'
30
- ? 'web'
31
- : process.env.UNI_PLATFORM, `@/uni_modules/${uniModuleDir}`, exports));
36
+ const curInjects = parseInjects(vite, platform, `@/uni_modules/${uniModuleDir}`, exports);
37
+ if (platform === 'app') {
38
+ Object.keys(curInjects).forEach((name) => {
39
+ const options = curInjects[name];
40
+ // js 平台禁用了
41
+ if (Array.isArray(options) && options.length === 3) {
42
+ if (options[2] && options[2].js === false) {
43
+ delete curInjects[name];
44
+ }
45
+ }
46
+ });
47
+ }
48
+ Object.assign(injects, curInjects);
32
49
  }
33
50
  }
34
51
  catch (e) { }
@@ -74,12 +91,12 @@ function parseInjects(vite = true, platform, source, exports = {}) {
74
91
  }
75
92
  const injects = {};
76
93
  for (const key in rootDefines) {
77
- Object.assign(injects, parseInject(vite, source, 'uni', rootDefines[key]));
94
+ Object.assign(injects, parseInject(vite, platform, source, 'uni', rootDefines[key]));
78
95
  }
79
96
  return injects;
80
97
  }
81
98
  exports.parseInjects = parseInjects;
82
- function parseInject(vite = true, source, globalObject, define) {
99
+ function parseInject(vite = true, platform, source, globalObject, define) {
83
100
  const injects = {};
84
101
  if (define === false) {
85
102
  }
@@ -96,7 +113,24 @@ function parseInject(vite = true, source, globalObject, define) {
96
113
  else {
97
114
  const keys = Object.keys(define);
98
115
  keys.forEach((d) => {
99
- injects[globalObject + '.' + d] = [source, define[d]];
116
+ if (typeof define[d] === 'string') {
117
+ injects[globalObject + '.' + d] = [source, define[d]];
118
+ }
119
+ else {
120
+ const defineOptions = define[d];
121
+ if (defineOptions[platform] !== false) {
122
+ if (platform === 'app') {
123
+ injects[globalObject + '.' + d] = [
124
+ source,
125
+ defineOptions.name || d,
126
+ defineOptions.app,
127
+ ];
128
+ }
129
+ else {
130
+ injects[globalObject + '.' + d] = [source, defineOptions.name || d];
131
+ }
132
+ }
133
+ }
100
134
  });
101
135
  }
102
136
  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-3071220230331002",
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-3071220230331002",
29
+ "@dcloudio/uni-shared": "3.0.0-alpha-3071220230331002",
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-3071220230331002",
68
68
  "@types/babel__core": "^7.1.19",
69
69
  "@types/debug": "^4.1.7",
70
70
  "@types/estree": "^0.0.51",