@dcloudio/uni-cli-shared 3.0.0-alpha-5000420260319001 → 3.0.0-alpha-5000720260327001

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.
Files changed (61) hide show
  1. package/dist/constants.d.ts +1 -3
  2. package/dist/constants.js +2 -6
  3. package/dist/deps.d.ts +1 -0
  4. package/dist/deps.js +22 -13
  5. package/dist/dom2/fontFamily.d.ts +4 -0
  6. package/dist/dom2/fontFamily.js +21 -0
  7. package/dist/dom2/index.d.ts +2 -0
  8. package/dist/dom2/index.js +2 -0
  9. package/dist/dom2/sharedData.d.ts +4 -0
  10. package/dist/dom2/sharedData.js +38 -5
  11. package/dist/dom2/vue.d.ts +15 -0
  12. package/dist/dom2/vue.js +41 -0
  13. package/dist/easycom.js +13 -9
  14. package/dist/env/define.d.ts +0 -1
  15. package/dist/env/define.js +3 -11
  16. package/dist/hbx/alias.js +48 -10
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.js +1 -0
  19. package/dist/json/uni-x/manifest.d.ts +1 -1
  20. package/dist/json/uni-x/manifest.js +2 -1
  21. package/dist/json/utils.js +24 -0
  22. package/dist/messages/en.d.ts +2 -0
  23. package/dist/messages/en.js +2 -0
  24. package/dist/messages/index.d.ts +4 -0
  25. package/dist/messages/zh_CN.d.ts +2 -0
  26. package/dist/messages/zh_CN.js +2 -0
  27. package/dist/uni_modules.cloud.js +16 -12
  28. package/dist/uni_modules.js +3 -2
  29. package/dist/uts.js +4 -2
  30. package/dist/vite/autoImport.js +7 -4
  31. package/dist/vite/cloud.js +13 -6
  32. package/dist/vite/extApi.js +4 -1
  33. package/dist/vite/plugins/stats.js +2 -1
  34. package/dist/vite/plugins/uts/uni_modules.js +7 -2
  35. package/dist/vite/plugins/vitejs/plugins/css.js +6 -4
  36. package/dist/workers.js +2 -0
  37. package/dist/x.d.ts +10 -0
  38. package/dist/x.js +39 -0
  39. package/lib/dom2/app/@vitejs/plugin-vue/dist/index.cjs +0 -7
  40. package/lib/dom2/app/@vitejs/plugin-vue/dist/index.mjs +0 -7
  41. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.js +1 -1
  42. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.prod.js +1 -1
  43. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.d.ts +1 -0
  44. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.esm-bundler.js +1 -1
  45. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.js +1 -1
  46. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +1 -1
  47. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +1 -1
  48. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +1 -1
  49. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +1 -1
  50. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.js +1 -1
  51. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.prod.js +1 -1
  52. package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +348 -120
  53. package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +99 -56
  54. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +70 -47
  55. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.d.ts +127 -107
  56. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +70 -48
  57. package/lib/dom2/app/@vue/compiler-vapor-dom2/dist/compiler-vapor-dom2.cjs.js +1 -1
  58. package/lib/dom2/app/@vue/shared/dist/shared.cjs.js +1 -1
  59. package/lib/dom2/app/@vue/shared/dist/shared.cjs.prod.js +1 -1
  60. package/lib/dom2/app/@vue/shared/dist/shared.esm-bundler.js +1 -1
  61. package/package.json +5 -5
@@ -7,6 +7,7 @@ export declare const EXTNAME_VUE_TEMPLATE: string[];
7
7
  export declare const EXTNAME_VUE_RE: RegExp;
8
8
  export declare const EXTNAME_JS_RE: RegExp;
9
9
  export declare const EXTNAME_TS_RE: RegExp;
10
+ export declare const DEFAULT_APPID = "__UNI__uniappx";
10
11
  export declare const SPECIAL_CHARS: {
11
12
  WARN_BLOCK: string;
12
13
  ERROR_BLOCK: string;
@@ -39,6 +40,3 @@ export declare const COMMON_EXCLUDE: RegExp[];
39
40
  export declare const KNOWN_ASSET_TYPES: string[];
40
41
  export declare const DEFAULT_ASSETS_RE: RegExp;
41
42
  export declare const TEXT_STYLE: string[];
42
- export declare const JS_STYLE_PLACEHOLDER_MARKER = "__js_style_placeholder__";
43
- export declare const JS_STYLE_PLACEHOLDER_STR: string;
44
- export declare const JS_STYLE_PLACEHOLDER_RE: RegExp;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JS_STYLE_PLACEHOLDER_RE = exports.JS_STYLE_PLACEHOLDER_STR = exports.JS_STYLE_PLACEHOLDER_MARKER = exports.TEXT_STYLE = exports.DEFAULT_ASSETS_RE = exports.KNOWN_ASSET_TYPES = exports.COMMON_EXCLUDE = exports.X_BASE_COMPONENTS_STYLE_PATH = exports.BASE_COMPONENTS_STYLE_PATH = exports.H5_COMPONENTS_STYLE_PATH = exports.H5_FRAMEWORK_STYLE_PATH = exports.H5_API_STYLE_PATH = exports.X_PAGE_EXTNAME_APP = exports.X_PAGE_EXTNAME = 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_UTS = exports.MANIFEST_JSON_JS = exports.PAGES_JSON_UTS = exports.PAGES_JSON_JS = exports.uni_app_x_extensions = exports.extensions = exports.SPECIAL_CHARS = exports.EXTNAME_TS_RE = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE_TEMPLATE = exports.X_EXTNAME_VUE = 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.X_BASE_COMPONENTS_STYLE_PATH = exports.BASE_COMPONENTS_STYLE_PATH = exports.H5_COMPONENTS_STYLE_PATH = exports.H5_FRAMEWORK_STYLE_PATH = exports.H5_API_STYLE_PATH = exports.X_PAGE_EXTNAME_APP = exports.X_PAGE_EXTNAME = 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_UTS = exports.MANIFEST_JSON_JS = exports.PAGES_JSON_UTS = exports.PAGES_JSON_JS = exports.uni_app_x_extensions = exports.extensions = exports.SPECIAL_CHARS = exports.DEFAULT_APPID = exports.EXTNAME_TS_RE = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE_TEMPLATE = exports.X_EXTNAME_VUE = 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', '.uts'];
6
6
  exports.EXTNAME_TS = ['.ts', '.tsx'];
@@ -10,6 +10,7 @@ exports.EXTNAME_VUE_TEMPLATE = ['.vue', '.nvue', '.uvue', '.jsx', '.tsx'];
10
10
  exports.EXTNAME_VUE_RE = /\.(vue|nvue|uvue)$/;
11
11
  exports.EXTNAME_JS_RE = /\.(js|jsx|ts|uts|tsx|mjs)$/;
12
12
  exports.EXTNAME_TS_RE = /\.tsx?$/;
13
+ exports.DEFAULT_APPID = '__UNI__uniappx';
13
14
  exports.SPECIAL_CHARS = {
14
15
  WARN_BLOCK: '\uFEFF', // 警告块前后标识
15
16
  ERROR_BLOCK: '\u2060', // 错误块前后标识
@@ -88,8 +89,3 @@ exports.KNOWN_ASSET_TYPES = [
88
89
  ];
89
90
  exports.DEFAULT_ASSETS_RE = new RegExp(`\\.(` + exports.KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
90
91
  exports.TEXT_STYLE = ['black', 'white'];
91
- exports.JS_STYLE_PLACEHOLDER_MARKER = '__js_style_placeholder__';
92
- exports.JS_STYLE_PLACEHOLDER_STR = JSON.stringify({
93
- [exports.JS_STYLE_PLACEHOLDER_MARKER]: 0,
94
- });
95
- exports.JS_STYLE_PLACEHOLDER_RE = /\{\s*"__js_style_placeholder__"\s*:\s*0\s*}/g;
package/dist/deps.d.ts CHANGED
@@ -5,6 +5,7 @@ export declare const API_DEPS_CSS: (isX: boolean) => {
5
5
  previewImage: string[];
6
6
  openLocation: string[];
7
7
  chooseLocation: string[];
8
+ showLoading: string[];
8
9
  };
9
10
  export declare const COMPONENT_DEPS_CSS: (isX: boolean) => {
10
11
  canvas: string[];
package/dist/deps.js CHANGED
@@ -6,9 +6,9 @@ const RESIZE_SENSOR_CSS = constants_1.BASE_COMPONENTS_STYLE_PATH + 'resize-senso
6
6
  const REFRESHER_CSS = constants_1.BASE_COMPONENTS_STYLE_PATH + 'refresher.css';
7
7
  const API_DEPS_CSS = (isX) => {
8
8
  const deps_css = {
9
- showModal: [`${constants_1.H5_API_STYLE_PATH}modal.css`],
9
+ showModal: [],
10
10
  showToast: [`${constants_1.H5_API_STYLE_PATH}toast.css`],
11
- showActionSheet: [`${constants_1.H5_API_STYLE_PATH}action-sheet.css`],
11
+ showActionSheet: [],
12
12
  previewImage: [
13
13
  RESIZE_SENSOR_CSS,
14
14
  `${constants_1.BASE_COMPONENTS_STYLE_PATH}swiper.css`,
@@ -17,22 +17,31 @@ const API_DEPS_CSS = (isX) => {
17
17
  `${constants_1.BASE_COMPONENTS_STYLE_PATH}movable-view.css`,
18
18
  ],
19
19
  openLocation: [`${constants_1.H5_API_STYLE_PATH}location-view.css`],
20
- chooseLocation: [
21
- ...(isX
22
- ? [
23
- `${constants_1.BASE_COMPONENTS_STYLE_PATH}/view.css`,
24
- `${constants_1.BASE_COMPONENTS_STYLE_PATH}/text.css`,
25
- ]
26
- : [`${constants_1.H5_API_STYLE_PATH}/location-picker.css`]),
20
+ chooseLocation: [],
21
+ showLoading: [],
22
+ };
23
+ if (isX) {
24
+ deps_css.showModal = [`${constants_1.BASE_COMPONENTS_STYLE_PATH}textarea.css`];
25
+ deps_css.chooseLocation = [
26
+ `${constants_1.BASE_COMPONENTS_STYLE_PATH}/view.css`,
27
+ `${constants_1.BASE_COMPONENTS_STYLE_PATH}/text.css`,
27
28
  `${constants_1.BASE_COMPONENTS_STYLE_PATH}/input.css`,
28
29
  `${constants_1.H5_COMPONENTS_STYLE_PATH}/map.css`,
29
30
  `${constants_1.BASE_COMPONENTS_STYLE_PATH}/scroll-view.css`,
30
- ],
31
- };
32
- if (isX) {
33
- // @ts-expect-error
31
+ `${constants_1.BASE_COMPONENTS_STYLE_PATH}/image.css`,
32
+ ];
34
33
  deps_css.showLoading = [`${constants_1.X_BASE_COMPONENTS_STYLE_PATH}loading.css`];
35
34
  }
35
+ else {
36
+ deps_css.showModal = [`${constants_1.H5_API_STYLE_PATH}modal.css`];
37
+ deps_css.showActionSheet = [`${constants_1.H5_API_STYLE_PATH}action-sheet.css`];
38
+ deps_css.chooseLocation = [
39
+ `${constants_1.H5_API_STYLE_PATH}/location-picker.css`,
40
+ `${constants_1.BASE_COMPONENTS_STYLE_PATH}/input.css`,
41
+ `${constants_1.H5_COMPONENTS_STYLE_PATH}/map.css`,
42
+ `${constants_1.BASE_COMPONENTS_STYLE_PATH}/scroll-view.css`,
43
+ ];
44
+ }
36
45
  return deps_css;
37
46
  };
38
47
  exports.API_DEPS_CSS = API_DEPS_CSS;
@@ -0,0 +1,4 @@
1
+ export declare const JS_STYLE_PLACEHOLDER_MARKER = "__js_style_placeholder__";
2
+ export declare function createJsStylePlaceholder(id: string): string;
3
+ export declare function createJsStylePlaceholderRegExp(id: string): RegExp;
4
+ export declare const ANY_JS_STYLE_PLACEHOLDER_RE: RegExp;
@@ -0,0 +1,21 @@
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.ANY_JS_STYLE_PLACEHOLDER_RE = exports.createJsStylePlaceholderRegExp = exports.createJsStylePlaceholder = exports.JS_STYLE_PLACEHOLDER_MARKER = void 0;
7
+ const hash_sum_1 = __importDefault(require("hash-sum"));
8
+ exports.JS_STYLE_PLACEHOLDER_MARKER = '__js_style_placeholder__';
9
+ function createJsStylePlaceholder(id) {
10
+ const hashId = (0, hash_sum_1.default)(id);
11
+ return JSON.stringify({
12
+ [exports.JS_STYLE_PLACEHOLDER_MARKER]: hashId,
13
+ });
14
+ }
15
+ exports.createJsStylePlaceholder = createJsStylePlaceholder;
16
+ function createJsStylePlaceholderRegExp(id) {
17
+ const hashId = (0, hash_sum_1.default)(id);
18
+ return new RegExp(`\\{\\s*"${exports.JS_STYLE_PLACEHOLDER_MARKER}"\\s*:\\s*"${hashId}"\\s*\\}`, 'g');
19
+ }
20
+ exports.createJsStylePlaceholderRegExp = createJsStylePlaceholderRegExp;
21
+ exports.ANY_JS_STYLE_PLACEHOLDER_RE = new RegExp(`\\{\\s*"${exports.JS_STYLE_PLACEHOLDER_MARKER}"\\s*:\\s*".+?"\\s*\\}`, 'g');
@@ -1 +1,3 @@
1
1
  export * from './sharedData';
2
+ export * from './vue';
3
+ export * from './fontFamily';
@@ -15,3 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./sharedData"), exports);
18
+ __exportStar(require("./vue"), exports);
19
+ __exportStar(require("./fontFamily"), exports);
@@ -1,2 +1,6 @@
1
1
  import type { Plugin } from 'vite';
2
2
  export declare function uniSharedDataPlugin(): Plugin;
3
+ export declare function initSourceFileCallback(): ((sourceFile: import('typescript').SourceFile) => void) | undefined;
4
+ export declare function initUts2jsSharedDataOptions(): {
5
+ resolveFieldMeta: any;
6
+ } | undefined;
@@ -1,19 +1,52 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uniSharedDataPlugin = void 0;
3
+ exports.initUts2jsSharedDataOptions = exports.initSourceFileCallback = exports.uniSharedDataPlugin = void 0;
4
4
  const uts_1 = require("../uts");
5
5
  const pages_1 = require("../json/pages");
6
6
  const utils_1 = require("../utils");
7
7
  const asset_1 = require("../vite/plugins/vitejs/plugins/asset");
8
- function uniSharedDataPlugin() {
9
- const { USDP } = (0, utils_1.requireUniHelpers)();
8
+ const x_1 = require("../x");
9
+ const manifest_1 = require("../json/uni-x/manifest");
10
+ const manifest_2 = require("../json/manifest");
11
+ function initSharedDataOptions() {
10
12
  const compiler = require('@dcloudio/compiler-vapor-dom2');
11
- return USDP({
13
+ const manifest = (0, manifest_2.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR);
14
+ return {
15
+ platform: process.env.UNI_UTS_PLATFORM,
12
16
  compilerVaporDom2: compiler,
13
17
  utsCompiler: (0, uts_1.resolveUTSCompiler)(),
14
18
  isUniPageFile: pages_1.isUniPageFile,
15
19
  getSharedDataResult: compiler.getSharedDataResult,
16
20
  getAssetFilenameById: asset_1.getAssetFilenameById,
17
- });
21
+ uvueScriptEngine: (0, x_1.isUniAppXAndroidNative)() ? 'native' : 'js',
22
+ compilerVersion: process.env.HX_Version || process.env.UNI_COMPILER_VERSION,
23
+ androidOptions: (0, x_1.isUniAppXAndroidJsEngine)()
24
+ ? {
25
+ package: (0, manifest_1.parseUniXAppAndroidPackage)(manifest.appid),
26
+ }
27
+ : undefined,
28
+ };
29
+ }
30
+ function uniSharedDataPlugin() {
31
+ return (0, utils_1.requireUniHelpers)().USDP(initSharedDataOptions());
18
32
  }
19
33
  exports.uniSharedDataPlugin = uniSharedDataPlugin;
34
+ function initSourceFileCallback() {
35
+ if (process.env.UNI_APP_X_DOM2 === 'true' && (0, x_1.isUniAppXAndroidNative)()) {
36
+ const { TSDBSF } = (0, utils_1.requireUniHelpers)();
37
+ const options = initSharedDataOptions();
38
+ return (sourceFile) => {
39
+ TSDBSF(sourceFile, options);
40
+ };
41
+ }
42
+ }
43
+ exports.initSourceFileCallback = initSourceFileCallback;
44
+ function initUts2jsSharedDataOptions() {
45
+ if (process.env.UNI_APP_X_DOM2 === 'true') {
46
+ return {
47
+ resolveFieldMeta: require('@dcloudio/compiler-vapor-dom2')
48
+ .resolveSharedDataFieldMeta,
49
+ };
50
+ }
51
+ }
52
+ exports.initUts2jsSharedDataOptions = initUts2jsSharedDataOptions;
@@ -0,0 +1,15 @@
1
+ import type { CompilerError, SFCDescriptor } from '@vue/compiler-sfc';
2
+ export declare function initVueTemplateCompilerExtraOptions(descriptor: SFCDescriptor): {
3
+ root: string;
4
+ platform: keyof UniApp.PagesJsonPagePlatformStyle;
5
+ componentType: string;
6
+ filename: string;
7
+ relativeFilename: string;
8
+ helper: any;
9
+ scriptCppBlocks: any;
10
+ disableStaticStyle: boolean;
11
+ onVueTemplateCompileLog(type: 'warn' | 'error', error: CompilerError): void;
12
+ r: any;
13
+ className: any;
14
+ inlineRender: boolean;
15
+ };
@@ -0,0 +1,41 @@
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.initVueTemplateCompilerExtraOptions = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const utils_1 = require("../utils");
9
+ const json_1 = require("../json");
10
+ const vue_1 = require("../vue");
11
+ function initVueTemplateCompilerExtraOptions(descriptor) {
12
+ const filename = (0, utils_1.normalizePath)(descriptor.filename.split('?')[0]);
13
+ const relativeFilename = (0, utils_1.normalizePath)(path_1.default.relative(process.env.UNI_INPUT_DIR, filename));
14
+ const isDevX = process.env.UNI_HX_VERSION_DEV === 'true' &&
15
+ process.env.UNI_APP_X === 'true';
16
+ let disableStaticStyle = false;
17
+ if (isDevX && process.env.NODE_ENV === 'development') {
18
+ if (process.env.UNI_UTS_PLATFORM === 'app-harmony') {
19
+ // 开发版本、开发模式下,非鸿蒙release模式打包
20
+ disableStaticStyle = process.env.UNI_APP_HARMONY_RUN_MODE !== 'release';
21
+ }
22
+ }
23
+ const helper = (0, utils_1.requireUniHelpers)();
24
+ return {
25
+ root: (0, utils_1.normalizePath)(process.env.UNI_INPUT_DIR),
26
+ platform: process.env.UNI_UTS_PLATFORM,
27
+ componentType: (0, json_1.isUniPageFile)(filename) ? 'page' : 'component',
28
+ filename: filename,
29
+ relativeFilename,
30
+ helper,
31
+ scriptCppBlocks: descriptor.scriptCppBlocks,
32
+ disableStaticStyle,
33
+ onVueTemplateCompileLog(type, error) {
34
+ return (0, vue_1.onVueTemplateCompileLog)(type, error, descriptor.source, relativeFilename);
35
+ },
36
+ r: helper.K,
37
+ className: helper.GCN(descriptor.filename, process.env.UNI_INPUT_DIR),
38
+ inlineRender: process.env.UNI_UTS_PLATFORM === 'app-android',
39
+ };
40
+ }
41
+ exports.initVueTemplateCompilerExtraOptions = initVueTemplateCompilerExtraOptions;
package/dist/easycom.js CHANGED
@@ -10,6 +10,7 @@ const debug_1 = __importDefault(require("debug"));
10
10
  const shared_1 = require("@vue/shared");
11
11
  const pluginutils_1 = require("@rollup/pluginutils");
12
12
  const uni_shared_1 = require("@dcloudio/uni-shared");
13
+ const x_1 = require("./x");
13
14
  const utils_1 = require("./utils");
14
15
  const pages_1 = require("./json/pages");
15
16
  const messages_1 = require("./messages");
@@ -109,8 +110,8 @@ function initEasycoms(inputDir, { dirs, platform, isX, }) {
109
110
  clearEasycom();
110
111
  (0, uts_1.clearUTSComponents)();
111
112
  (0, uts_1.clearUTSCustomElements)();
112
- initEasycom(easyComOptions);
113
- if (isX) {
113
+ initEasycom(res.easyComOptions);
114
+ if (supportCustomElements) {
114
115
  initUTSEasycomCustomElements();
115
116
  }
116
117
  initUTSEasycom();
@@ -197,6 +198,11 @@ function matchEasycom(tag) {
197
198
  source = tag.replace(matcher.pattern, matcher.replacement);
198
199
  easycomsCache.set(tag, source);
199
200
  debugEasycom('matchEasycom', tag, source);
201
+ // 检查 H5 专用组件 ask163203
202
+ const H5_ONLY_COMPONENTS = ['custom-tab-bar'];
203
+ if (H5_ONLY_COMPONENTS.includes(tag) && process.env.UNI_PLATFORM !== 'h5') {
204
+ console.warn(`[uni-app] 组件 <${tag}> 是 H5 平台专用组件,在 ${process.env.UNI_PLATFORM} 平台使用可能导致错误。如果你要引入自定义 tabBar 可重命名为其他名称。`);
205
+ }
200
206
  return source;
201
207
  }
202
208
  exports.matchEasycom = matchEasycom;
@@ -255,12 +261,7 @@ function initAutoScanEasycom(platform, dir, rootDir, extensions) {
255
261
  easycoms[`^${name}$`] =
256
262
  // mp平台,这里不处理,由uniEntryPlugin处理
257
263
  is_easycom_encrypt_uni_modules && !isMp
258
- ? (0, utils_1.normalizePath)(path_1.default.join(rootDir, `uni_modules/${uni_modules_plugin_id}?${
259
- // android 走 proxy
260
- process.env.UNI_APP_X === 'true' &&
261
- process.env.UNI_UTS_PLATFORM === 'app-android'
262
- ? 'uts-proxy'
263
- : 'uni_helpers'}`))
264
+ ? (0, utils_1.normalizePath)(path_1.default.join(rootDir, `uni_modules/${uni_modules_plugin_id}?${(0, x_1.isUniAppXAndroidNative)() ? 'uts-proxy' : 'uni_helpers'}`))
264
265
  : `${importDir}/${name}${ext}`;
265
266
  break;
266
267
  }
@@ -313,7 +314,10 @@ function createImportDeclaration(local, source, imported) {
313
314
  }
314
315
  const RESOLVE_EASYCOM_IMPORT_CODE = `import { resolveDynamicComponent as __resolveDynamicComponent } from 'vue';import { resolveEasycom } from '@dcloudio/uni-app';`;
315
316
  function genResolveEasycomCode(importDeclarations, code, name) {
316
- if (process.env.UNI_APP_X_DOM2 === 'true') {
317
+ if (process.env.UNI_APP_X_DOM2 === 'true' ||
318
+ // 内部 dev 版本,需要本地开发内置组件,比如web-view,此时需要直接返回本地easycom,不然会找到基座内置的
319
+ (process.env.UNI_HX_VERSION_DEV === 'true' &&
320
+ process.env.UNI_APP_X === 'true')) {
317
321
  // dom2 模式下,为了性能,不再考虑优先级问题,如果开发者需要区别,可以手动导入为其他名称
318
322
  return name;
319
323
  }
@@ -2,7 +2,6 @@ export declare function initDefine(stringifyBoolean?: boolean): {
2
2
  __X_STYLE_ISOLATION__: string | boolean;
3
3
  __X_STYLE_ISOLATION_UP_ARROW__: string | boolean;
4
4
  'process.env.UNI_APP_X_NEW_STYLE_ISOLATION': string | boolean;
5
- __UNI_FEATURE_VIRTUAL_HOST__: boolean;
6
5
  'process.env.NODE_ENV': string;
7
6
  'process.env.UNI_DEBUG': string | boolean;
8
7
  'process.env.UNI_APP_ID': string;
@@ -15,17 +15,9 @@ function initDefine(stringifyBoolean = false) {
15
15
  const isNewStyleIsolationUpArrow = isNewStyleIsolation && process.env.UNI_PLATFORM === 'mp-weixin';
16
16
  const isMP = process.env.UNI_PLATFORM && process.env.UNI_PLATFORM.startsWith('mp-');
17
17
  process.env['UNI_APP_ID'] = manifestJson.appid;
18
- let mpXDefine = isX && isMP
19
- ? {
20
- __UNI_FEATURE_VIRTUAL_HOST__: true,
21
- }
22
- : {
23
- __UNI_FEATURE_VIRTUAL_HOST__: false,
24
- };
25
- if (isX && isMP) {
26
- mpXDefine.__UNI_FEATURE_VIRTUAL_HOST__ =
27
- platformManifestJson.enableVirtualHost !== false;
28
- }
18
+ const mpXDefine = {
19
+ __UNI_FEATURE_VIRTUAL_HOST__: isX && isMP && platformManifestJson.enableVirtualHost !== false,
20
+ };
29
21
  const styleIsolation = stringifyBoolean
30
22
  ? JSON.stringify(isNewStyleIsolation)
31
23
  : isNewStyleIsolation;
package/dist/hbx/alias.js CHANGED
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
- // 注意:该文件尽可能少依赖其他文件,否则可能会导致还没有alias的时候,就加载了目标模块
3
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
4
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
4
  };
6
5
  Object.defineProperty(exports, "__esModule", { value: true });
7
6
  exports.formatInstallHBuilderXPluginTips = exports.moduleAliasFormatter = exports.installHBuilderXPlugin = exports.initModuleAlias = void 0;
7
+ // 注意:该文件尽可能少依赖其他文件,否则可能会导致还没有alias的时候,就加载了目标模块
8
+ const fs_1 = __importDefault(require("fs"));
8
9
  const path_1 = __importDefault(require("path"));
9
10
  const module_alias_1 = __importDefault(require("module-alias"));
10
11
  const utils_1 = require("./utils");
12
+ const jsonc_parser_1 = require("jsonc-parser");
11
13
  const hbxPlugins = {
12
14
  typescript: 'compile-typescript/node_modules/typescript',
13
15
  less: 'compile-less/node_modules/less',
@@ -19,19 +21,55 @@ function initModuleAlias() {
19
21
  const libDir = path_1.default.resolve(__dirname, '../../lib');
20
22
  const compilerSfcPath = path_1.default.resolve(libDir, '@vue/compiler-sfc');
21
23
  const serverRendererPath = require.resolve('@vue/server-renderer');
24
+ // 对路径进行兼容
25
+ if (!process.env.UNI_APP_X_DOM2_CPP_DIR &&
26
+ process.env.UNI_APP_HARMONY_DOM2_CPP_DIR) {
27
+ process.env.UNI_APP_X_DOM2_CPP_DIR =
28
+ process.env.UNI_APP_HARMONY_DOM2_CPP_DIR;
29
+ }
30
+ if (process.env.UNI_APP_PLATFORM === 'ios' ||
31
+ process.env.UNI_APP_PLATFORM === 'android') {
32
+ if (process.env.UNI_INPUT_DIR) {
33
+ const manifestJsonFilename = path_1.default.resolve(process.env.UNI_INPUT_DIR, 'manifest.json');
34
+ if (fs_1.default.existsSync(manifestJsonFilename)) {
35
+ const manifestJsonStr = fs_1.default.readFileSync(manifestJsonFilename, 'utf-8');
36
+ const manifestJson = (0, jsonc_parser_1.parse)(manifestJsonStr);
37
+ if (manifestJson?.['uni-app-x']?.vapor === true) {
38
+ const vaporFilename = path_1.default.resolve(process.env.UNI_INPUT_DIR, '.vapor');
39
+ if (fs_1.default.existsSync(vaporFilename)) {
40
+ process.env.UNI_APP_X_DOM2 = 'true';
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
22
46
  if (process.env.UNI_APP_X_DOM2 === 'true') {
23
- if (
24
- // 该代码执行较早,不能使用UNI_UTS_PLATFORM
25
- process.env.UNI_PLATFORM === 'app-harmony') {
26
- if (process.env.UNI_OUTPUT_DIR) {
27
- if (!process.env.UNI_APP_HARMONY_DOM2_CPP_DIR) {
28
- process.env.UNI_APP_HARMONY_DOM2_CPP_DIR = path_1.default.resolve(process.env.UNI_OUTPUT_DIR, 'cpp');
47
+ if (process.env.UNI_OUTPUT_DIR &&
48
+ (process.env.UNI_PLATFORM === 'app' ||
49
+ process.env.UNI_PLATFORM === 'app-plus' ||
50
+ process.env.UNI_PLATFORM === 'app-harmony')) {
51
+ if (!process.env.UNI_APP_X_DOM2_CPP_DIR) {
52
+ const baseDir = process.env.UNI_PLATFORM === 'app-harmony'
53
+ ? process.env.UNI_OUTPUT_DIR
54
+ : process.env.UNI_APP_X_CACHE_DIR || process.env.UNI_OUTPUT_DIR;
55
+ process.env.UNI_APP_X_DOM2_CPP_DIR = path_1.default.resolve(baseDir, 'cpp');
56
+ }
57
+ if (!process.env.UNI_APP_X_DOM2_KT_DIR) {
58
+ if (process.env.NODE_ENV !== 'development') {
59
+ process.env.UNI_APP_X_DOM2_KT_DIR = path_1.default.resolve(process.env.UNI_OUTPUT_DIR, 'src/.uniappx/android', 'src');
60
+ }
61
+ else {
62
+ process.env.UNI_APP_X_DOM2_KT_DIR = path_1.default.resolve(process.env.UNI_APP_X_CACHE_DIR ||
63
+ path_1.default.resolve(process.env.UNI_OUTPUT_DIR, '../.cache'), 'src');
29
64
  }
30
65
  }
31
66
  }
32
- else {
33
- // 目前仅支持 app-harmony 平台启用 dom2
34
- delete process.env.UNI_APP_X_DOM2;
67
+ if (process.env.UNI_APP_PLATFORM ||
68
+ process.env.UNI_PLATFORM === 'app-harmony') {
69
+ const dynamicFilename = path_1.default.resolve(process.env.UNI_INPUT_DIR, '.dynamic');
70
+ if (fs_1.default.existsSync(dynamicFilename)) {
71
+ process.env.UNI_APP_X_DOM2_DYNAMIC = 'true';
72
+ }
35
73
  }
36
74
  }
37
75
  if (process.env.UNI_APP_X_DOM2 === 'true') {
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './hbx';
6
6
  export * from './ssr';
7
7
  export * from './vue';
8
8
  export * from './uts';
9
+ export * from './x';
9
10
  export * from './logs';
10
11
  export * from './dom2';
11
12
  export * from './i18n';
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ __exportStar(require("./hbx"), exports);
23
23
  __exportStar(require("./ssr"), exports);
24
24
  __exportStar(require("./vue"), exports);
25
25
  __exportStar(require("./uts"), exports);
26
+ __exportStar(require("./x"), exports);
26
27
  __exportStar(require("./logs"), exports);
27
28
  __exportStar(require("./dom2"), exports);
28
29
  __exportStar(require("./i18n"), exports);
@@ -1,3 +1,3 @@
1
1
  export declare function parseUniXFlexDirection(manifestJson: Record<string, any>): any;
2
2
  export declare function parseUniXSplashScreen(platform: 'app-android' | 'app-ios' | 'app-harmony', manifestJson: Record<string, any>): false | object;
3
- export declare function parseUniXAppAndroidPackage(appid: string): string;
3
+ export declare function parseUniXAppAndroidPackage(appid?: string): string;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseUniXAppAndroidPackage = exports.parseUniXSplashScreen = exports.parseUniXFlexDirection = void 0;
4
4
  const shared_1 = require("@vue/shared");
5
+ const constants_1 = require("../../constants");
5
6
  const flexDirs = ['row', 'row-reverse', 'column', 'column-reverse'];
6
7
  function parseUniXFlexDirection(manifestJson) {
7
8
  const flexDir = manifestJson?.['uni-app-x']?.['flex-direction'];
@@ -20,6 +21,6 @@ function parseUniXSplashScreen(platform, manifestJson) {
20
21
  }
21
22
  exports.parseUniXSplashScreen = parseUniXSplashScreen;
22
23
  function parseUniXAppAndroidPackage(appid) {
23
- return 'uni.' + appid.replace(/_/g, '');
24
+ return 'uni.' + (appid || constants_1.DEFAULT_APPID).replace(/_/g, '');
24
25
  }
25
26
  exports.parseUniXAppAndroidPackage = parseUniXAppAndroidPackage;
@@ -64,6 +64,30 @@ function checkPagesJson(jsonStr, inputDir) {
64
64
  });
65
65
  }
66
66
  });
67
+ const tabBarNode = root.children?.find((child) => child.type === 'property' &&
68
+ child.children?.length === 2 &&
69
+ child.children[0].value === 'tabBar');
70
+ if (process.env.UNI_APP_X_DOM2 !== 'true' && tabBarNode) {
71
+ // dom2下不支持tabBar配置项,这里先不校验
72
+ let allPages = []; // 收集全部页面,包含分包页面
73
+ let tabBarPages = []; // 收集 tabBar 页面
74
+ allPages.push(...pagePathNodes.map((node) => node.value));
75
+ findRootNode(tabBarNode.children[1], ['list']).forEach((node) => {
76
+ const pagePathNode = node.type === 'object' &&
77
+ node.children?.find((child) => child.type === 'property' &&
78
+ child.children?.length === 2 &&
79
+ child.children[0].value === 'pagePath');
80
+ if (pagePathNode) {
81
+ const pagePathValueNode = pagePathNode.children[1];
82
+ const pagePath = pagePathValueNode.value;
83
+ tabBarPages.push(pagePath);
84
+ if (!allPages.includes(pagePath) &&
85
+ !allPages.includes(pagePath.substring(1))) {
86
+ throwCompilerError(jsonStr, pagePathValueNode, messages_1.M['pages.json.tabbar.page.notfound'].replace('{pagePath}', pagePath));
87
+ }
88
+ }
89
+ });
90
+ }
67
91
  for (const node of pagePathNodes) {
68
92
  const pagePath = node.value ?? '';
69
93
  if (!pageExistsWithCaseSync(path_1.default.join(inputDir, pagePath))) {
@@ -1,5 +1,6 @@
1
1
  declare const _default: {
2
2
  readonly 'app.compiler.version': "Compiler version: {version}";
3
+ readonly 'style.isolation.version': "Style isolation version: {version}";
3
4
  readonly compiling: "Compiling...";
4
5
  readonly 'dev.performance': "Please note that in running mode, due to log output, sourcemap, and uncompressed source code, the performance and package size are not as good as release mode.";
5
6
  readonly 'dev.performance.nvue': "Especially the sourcemap of app-nvue has a greater impact";
@@ -48,5 +49,6 @@ declare const _default: {
48
49
  readonly 'uni_modules.import': "Plug-in [{0}] only supports @/uni_modules/{1}.";
49
50
  readonly 'pages.json.page.notfound': "The page \"{pagePath}\" does not exist.";
50
51
  readonly 'pages.json.page.slash': "The Path \"{pagePath}\" cannot start with \"/\"";
52
+ readonly 'pages.json.tabbar.page.notfound': "The tabBar page \"{pagePath}\" is not declared in \"pages.json\".";
51
53
  };
52
54
  export default _default;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  'app.compiler.version': 'Compiler version: {version}',
5
+ 'style.isolation.version': 'Style isolation version: {version}',
5
6
  compiling: 'Compiling...',
6
7
  'dev.performance': 'Please note that in running mode, due to log output, sourcemap, and uncompressed source code, the performance and package size are not as good as release mode.',
7
8
  'dev.performance.nvue': 'Especially the sourcemap of app-nvue has a greater impact',
@@ -50,4 +51,5 @@ exports.default = {
50
51
  'uni_modules.import': 'Plug-in [{0}] only supports @/uni_modules/{1}.',
51
52
  'pages.json.page.notfound': 'The page "{pagePath}" does not exist.',
52
53
  'pages.json.page.slash': 'The Path "{pagePath}" cannot start with "/"',
54
+ 'pages.json.tabbar.page.notfound': 'The tabBar page "{pagePath}" is not declared in "pages.json".',
53
55
  };
@@ -1,5 +1,6 @@
1
1
  export declare const M: {
2
2
  readonly 'app.compiler.version': "编译器版本:{version}";
3
+ readonly 'style.isolation.version': "当前样式隔离策略:{version}。详见:https://doc.dcloud.net.cn/uni-app-x/css/common/style-isolation.html";
3
4
  readonly compiling: "正在编译中...";
4
5
  readonly 'dev.performance': "请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。";
5
6
  readonly 'dev.performance.nvue': "尤其是 app-nvue 的 sourcemap 影响较大";
@@ -48,8 +49,10 @@ export declare const M: {
48
49
  readonly 'uni_modules.import': "插件[{0}]仅支持 @/uni_modules/{1} 方式引入,不支持直接导入内部文件 {2}。";
49
50
  readonly 'pages.json.page.notfound': "页面\"{pagePath}\"不存在,请确保填写的页面路径不包含文件后缀,且必须与真实的文件路径大小写保持一致。";
50
51
  readonly 'pages.json.page.slash': "路径 \"{pagePath}\" 不能以 \"/\" 开头";
52
+ readonly 'pages.json.tabbar.page.notfound': "tabBar 中配置的页面 \"{pagePath}\" 未在 pages.json 中注册。";
51
53
  } | {
52
54
  readonly 'app.compiler.version': "Compiler version: {version}";
55
+ readonly 'style.isolation.version': "Style isolation version: {version}";
53
56
  readonly compiling: "Compiling...";
54
57
  readonly 'dev.performance': "Please note that in running mode, due to log output, sourcemap, and uncompressed source code, the performance and package size are not as good as release mode.";
55
58
  readonly 'dev.performance.nvue': "Especially the sourcemap of app-nvue has a greater impact";
@@ -98,4 +101,5 @@ export declare const M: {
98
101
  readonly 'uni_modules.import': "Plug-in [{0}] only supports @/uni_modules/{1}.";
99
102
  readonly 'pages.json.page.notfound': "The page \"{pagePath}\" does not exist.";
100
103
  readonly 'pages.json.page.slash': "The Path \"{pagePath}\" cannot start with \"/\"";
104
+ readonly 'pages.json.tabbar.page.notfound': "The tabBar page \"{pagePath}\" is not declared in \"pages.json\".";
101
105
  };
@@ -1,5 +1,6 @@
1
1
  declare const _default: {
2
2
  readonly 'app.compiler.version': "编译器版本:{version}";
3
+ readonly 'style.isolation.version': "当前样式隔离策略:{version}。详见:https://doc.dcloud.net.cn/uni-app-x/css/common/style-isolation.html";
3
4
  readonly compiling: "正在编译中...";
4
5
  readonly 'dev.performance': "请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。";
5
6
  readonly 'dev.performance.nvue': "尤其是 app-nvue 的 sourcemap 影响较大";
@@ -48,5 +49,6 @@ declare const _default: {
48
49
  readonly 'uni_modules.import': "插件[{0}]仅支持 @/uni_modules/{1} 方式引入,不支持直接导入内部文件 {2}。";
49
50
  readonly 'pages.json.page.notfound': "页面\"{pagePath}\"不存在,请确保填写的页面路径不包含文件后缀,且必须与真实的文件路径大小写保持一致。";
50
51
  readonly 'pages.json.page.slash': "路径 \"{pagePath}\" 不能以 \"/\" 开头";
52
+ readonly 'pages.json.tabbar.page.notfound': "tabBar 中配置的页面 \"{pagePath}\" 未在 pages.json 中注册。";
51
53
  };
52
54
  export default _default;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  'app.compiler.version': '编译器版本:{version}',
5
+ 'style.isolation.version': '当前样式隔离策略:{version}。详见:https://doc.dcloud.net.cn/uni-app-x/css/common/style-isolation.html',
5
6
  compiling: '正在编译中...',
6
7
  'dev.performance': '请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。',
7
8
  'dev.performance.nvue': '尤其是 app-nvue 的 sourcemap 影响较大',
@@ -51,4 +52,5 @@ exports.default = {
51
52
  'uni_modules.import': '插件[{0}]仅支持 @/uni_modules/{1} 方式引入,不支持直接导入内部文件 {2}。',
52
53
  'pages.json.page.notfound': '页面"{pagePath}"不存在,请确保填写的页面路径不包含文件后缀,且必须与真实的文件路径大小写保持一致。',
53
54
  'pages.json.page.slash': '路径 "{pagePath}" 不能以 "/" 开头',
55
+ 'pages.json.tabbar.page.notfound': 'tabBar 中配置的页面 "{pagePath}" 未在 pages.json 中注册。',
54
56
  };