@dcloudio/uni-cli-shared 3.0.0-5000620260331001 → 3.0.0-5000720260410001

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.
@@ -7,7 +7,6 @@ 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";
11
10
  export declare const SPECIAL_CHARS: {
12
11
  WARN_BLOCK: string;
13
12
  ERROR_BLOCK: string;
@@ -40,3 +39,6 @@ export declare const COMMON_EXCLUDE: RegExp[];
40
39
  export declare const KNOWN_ASSET_TYPES: string[];
41
40
  export declare const DEFAULT_ASSETS_RE: RegExp;
42
41
  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.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;
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;
4
4
  exports.PUBLIC_DIR = 'static';
5
5
  exports.EXTNAME_JS = ['.js', '.ts', '.jsx', '.tsx', '.uts'];
6
6
  exports.EXTNAME_TS = ['.ts', '.tsx'];
@@ -10,7 +10,6 @@ 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';
14
13
  exports.SPECIAL_CHARS = {
15
14
  WARN_BLOCK: '\uFEFF', // 警告块前后标识
16
15
  ERROR_BLOCK: '\u2060', // 错误块前后标识
@@ -89,3 +88,8 @@ exports.KNOWN_ASSET_TYPES = [
89
88
  ];
90
89
  exports.DEFAULT_ASSETS_RE = new RegExp(`\\.(` + exports.KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
91
90
  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,7 +5,6 @@ export declare const API_DEPS_CSS: (isX: boolean) => {
5
5
  previewImage: string[];
6
6
  openLocation: string[];
7
7
  chooseLocation: string[];
8
- showLoading: string[];
9
8
  };
10
9
  export declare const COMPONENT_DEPS_CSS: (isX: boolean) => {
11
10
  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: [],
9
+ showModal: [`${constants_1.H5_API_STYLE_PATH}modal.css`],
10
10
  showToast: [`${constants_1.H5_API_STYLE_PATH}toast.css`],
11
- showActionSheet: [],
11
+ showActionSheet: [`${constants_1.H5_API_STYLE_PATH}action-sheet.css`],
12
12
  previewImage: [
13
13
  RESIZE_SENSOR_CSS,
14
14
  `${constants_1.BASE_COMPONENTS_STYLE_PATH}swiper.css`,
@@ -17,31 +17,22 @@ 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
- 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`,
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`]),
28
27
  `${constants_1.BASE_COMPONENTS_STYLE_PATH}/input.css`,
29
28
  `${constants_1.H5_COMPONENTS_STYLE_PATH}/map.css`,
30
29
  `${constants_1.BASE_COMPONENTS_STYLE_PATH}/scroll-view.css`,
31
- `${constants_1.BASE_COMPONENTS_STYLE_PATH}/image.css`,
32
- ];
30
+ ],
31
+ };
32
+ if (isX) {
33
+ // @ts-expect-error
33
34
  deps_css.showLoading = [`${constants_1.X_BASE_COMPONENTS_STYLE_PATH}loading.css`];
34
35
  }
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
- }
45
36
  return deps_css;
46
37
  };
47
38
  exports.API_DEPS_CSS = API_DEPS_CSS;
@@ -1,3 +1 @@
1
1
  export * from './sharedData';
2
- export * from './vue';
3
- export * from './fontFamily';
@@ -15,5 +15,3 @@ 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,6 +1,2 @@
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,52 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initUts2jsSharedDataOptions = exports.initSourceFileCallback = exports.uniSharedDataPlugin = void 0;
3
+ 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
- const x_1 = require("../x");
9
- const manifest_1 = require("../json/uni-x/manifest");
10
- const manifest_2 = require("../json/manifest");
11
- function initSharedDataOptions() {
8
+ function uniSharedDataPlugin() {
9
+ const { USDP } = (0, utils_1.requireUniHelpers)();
12
10
  const compiler = require('@dcloudio/compiler-vapor-dom2');
13
- const manifest = (0, manifest_2.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR);
14
- return {
15
- platform: process.env.UNI_UTS_PLATFORM,
11
+ return USDP({
16
12
  compilerVaporDom2: compiler,
17
13
  utsCompiler: (0, uts_1.resolveUTSCompiler)(),
18
14
  isUniPageFile: pages_1.isUniPageFile,
19
15
  getSharedDataResult: compiler.getSharedDataResult,
20
16
  getAssetFilenameById: asset_1.getAssetFilenameById,
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());
17
+ });
32
18
  }
33
19
  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;
package/dist/easycom.js CHANGED
@@ -10,7 +10,6 @@ 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");
14
13
  const utils_1 = require("./utils");
15
14
  const pages_1 = require("./json/pages");
16
15
  const messages_1 = require("./messages");
@@ -110,8 +109,8 @@ function initEasycoms(inputDir, { dirs, platform, isX, }) {
110
109
  clearEasycom();
111
110
  (0, uts_1.clearUTSComponents)();
112
111
  (0, uts_1.clearUTSCustomElements)();
113
- initEasycom(res.easyComOptions);
114
- if (supportCustomElements) {
112
+ initEasycom(easyComOptions);
113
+ if (isX) {
115
114
  initUTSEasycomCustomElements();
116
115
  }
117
116
  initUTSEasycom();
@@ -198,11 +197,6 @@ function matchEasycom(tag) {
198
197
  source = tag.replace(matcher.pattern, matcher.replacement);
199
198
  easycomsCache.set(tag, source);
200
199
  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
- }
206
200
  return source;
207
201
  }
208
202
  exports.matchEasycom = matchEasycom;
@@ -261,7 +255,12 @@ function initAutoScanEasycom(platform, dir, rootDir, extensions) {
261
255
  easycoms[`^${name}$`] =
262
256
  // mp平台,这里不处理,由uniEntryPlugin处理
263
257
  is_easycom_encrypt_uni_modules && !isMp
264
- ? (0, utils_1.normalizePath)(path_1.default.join(rootDir, `uni_modules/${uni_modules_plugin_id}?${(0, x_1.isUniAppXAndroidNative)() ? 'uts-proxy' : 'uni_helpers'}`))
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'}`))
265
264
  : `${importDir}/${name}${ext}`;
266
265
  break;
267
266
  }
@@ -314,10 +313,7 @@ function createImportDeclaration(local, source, imported) {
314
313
  }
315
314
  const RESOLVE_EASYCOM_IMPORT_CODE = `import { resolveDynamicComponent as __resolveDynamicComponent } from 'vue';import { resolveEasycom } from '@dcloudio/uni-app';`;
316
315
  function genResolveEasycomCode(importDeclarations, code, name) {
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')) {
316
+ if (process.env.UNI_APP_X_DOM2 === 'true') {
321
317
  // dom2 模式下,为了性能,不再考虑优先级问题,如果开发者需要区别,可以手动导入为其他名称
322
318
  return name;
323
319
  }
@@ -2,6 +2,7 @@ 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;
5
6
  'process.env.NODE_ENV': string;
6
7
  'process.env.UNI_DEBUG': string | boolean;
7
8
  'process.env.UNI_APP_ID': string;
@@ -15,9 +15,17 @@ 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
- const mpXDefine = {
19
- __UNI_FEATURE_VIRTUAL_HOST__: isX && isMP && platformManifestJson.enableVirtualHost !== false,
20
- };
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
+ }
21
29
  const styleIsolation = stringifyBoolean
22
30
  ? JSON.stringify(isNewStyleIsolation)
23
31
  : isNewStyleIsolation;
package/dist/hbx/alias.js CHANGED
@@ -1,15 +1,13 @@
1
1
  "use strict";
2
+ // 注意:该文件尽可能少依赖其他文件,否则可能会导致还没有alias的时候,就加载了目标模块
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
5
  };
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
6
7
  exports.formatInstallHBuilderXPluginTips = exports.moduleAliasFormatter = exports.installHBuilderXPlugin = exports.initModuleAlias = void 0;
7
- // 注意:该文件尽可能少依赖其他文件,否则可能会导致还没有alias的时候,就加载了目标模块
8
- const fs_1 = __importDefault(require("fs"));
9
8
  const path_1 = __importDefault(require("path"));
10
9
  const module_alias_1 = __importDefault(require("module-alias"));
11
10
  const utils_1 = require("./utils");
12
- const jsonc_parser_1 = require("jsonc-parser");
13
11
  const hbxPlugins = {
14
12
  typescript: 'compile-typescript/node_modules/typescript',
15
13
  less: 'compile-less/node_modules/less',
@@ -21,55 +19,19 @@ function initModuleAlias() {
21
19
  const libDir = path_1.default.resolve(__dirname, '../../lib');
22
20
  const compilerSfcPath = path_1.default.resolve(libDir, '@vue/compiler-sfc');
23
21
  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
- }
46
22
  if (process.env.UNI_APP_X_DOM2 === 'true') {
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');
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');
64
29
  }
65
30
  }
66
31
  }
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
- }
32
+ else {
33
+ // 目前仅支持 app-harmony 平台启用 dom2
34
+ delete process.env.UNI_APP_X_DOM2;
73
35
  }
74
36
  }
75
37
  if (process.env.UNI_APP_X_DOM2 === 'true') {
package/dist/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export * from './hbx';
6
6
  export * from './ssr';
7
7
  export * from './vue';
8
8
  export * from './uts';
9
- export * from './x';
10
9
  export * from './logs';
11
10
  export * from './dom2';
12
11
  export * from './i18n';
package/dist/index.js CHANGED
@@ -23,7 +23,6 @@ __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);
27
26
  __exportStar(require("./logs"), exports);
28
27
  __exportStar(require("./dom2"), exports);
29
28
  __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,7 +2,6 @@
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");
6
5
  const flexDirs = ['row', 'row-reverse', 'column', 'column-reverse'];
7
6
  function parseUniXFlexDirection(manifestJson) {
8
7
  const flexDir = manifestJson?.['uni-app-x']?.['flex-direction'];
@@ -21,6 +20,6 @@ function parseUniXSplashScreen(platform, manifestJson) {
21
20
  }
22
21
  exports.parseUniXSplashScreen = parseUniXSplashScreen;
23
22
  function parseUniXAppAndroidPackage(appid) {
24
- return 'uni.' + (appid || constants_1.DEFAULT_APPID).replace(/_/g, '');
23
+ return 'uni.' + appid.replace(/_/g, '');
25
24
  }
26
25
  exports.parseUniXAppAndroidPackage = parseUniXAppAndroidPackage;
@@ -64,30 +64,6 @@ 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
- }
91
67
  for (const node of pagePathNodes) {
92
68
  const pagePath = node.value ?? '';
93
69
  if (!pageExistsWithCaseSync(path_1.default.join(inputDir, pagePath))) {
@@ -1,6 +1,5 @@
1
1
  declare const _default: {
2
2
  readonly 'app.compiler.version': "Compiler version: {version}";
3
- readonly 'style.isolation.version': "Style isolation version: {version}";
4
3
  readonly compiling: "Compiling...";
5
4
  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.";
6
5
  readonly 'dev.performance.nvue': "Especially the sourcemap of app-nvue has a greater impact";
@@ -49,6 +48,5 @@ declare const _default: {
49
48
  readonly 'uni_modules.import': "Plug-in [{0}] only supports @/uni_modules/{1}.";
50
49
  readonly 'pages.json.page.notfound': "The page \"{pagePath}\" does not exist.";
51
50
  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\".";
53
51
  };
54
52
  export default _default;
@@ -2,7 +2,6 @@
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}',
6
5
  compiling: 'Compiling...',
7
6
  '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.',
8
7
  'dev.performance.nvue': 'Especially the sourcemap of app-nvue has a greater impact',
@@ -51,5 +50,4 @@ exports.default = {
51
50
  'uni_modules.import': 'Plug-in [{0}] only supports @/uni_modules/{1}.',
52
51
  'pages.json.page.notfound': 'The page "{pagePath}" does not exist.',
53
52
  '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".',
55
53
  };
@@ -1,6 +1,5 @@
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";
4
3
  readonly compiling: "正在编译中...";
5
4
  readonly 'dev.performance': "请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。";
6
5
  readonly 'dev.performance.nvue': "尤其是 app-nvue 的 sourcemap 影响较大";
@@ -49,10 +48,8 @@ export declare const M: {
49
48
  readonly 'uni_modules.import': "插件[{0}]仅支持 @/uni_modules/{1} 方式引入,不支持直接导入内部文件 {2}。";
50
49
  readonly 'pages.json.page.notfound': "页面\"{pagePath}\"不存在,请确保填写的页面路径不包含文件后缀,且必须与真实的文件路径大小写保持一致。";
51
50
  readonly 'pages.json.page.slash': "路径 \"{pagePath}\" 不能以 \"/\" 开头";
52
- readonly 'pages.json.tabbar.page.notfound': "tabBar 中配置的页面 \"{pagePath}\" 未在 pages.json 中注册。";
53
51
  } | {
54
52
  readonly 'app.compiler.version': "Compiler version: {version}";
55
- readonly 'style.isolation.version': "Style isolation version: {version}";
56
53
  readonly compiling: "Compiling...";
57
54
  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.";
58
55
  readonly 'dev.performance.nvue': "Especially the sourcemap of app-nvue has a greater impact";
@@ -101,5 +98,4 @@ export declare const M: {
101
98
  readonly 'uni_modules.import': "Plug-in [{0}] only supports @/uni_modules/{1}.";
102
99
  readonly 'pages.json.page.notfound': "The page \"{pagePath}\" does not exist.";
103
100
  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\".";
105
101
  };
@@ -1,6 +1,5 @@
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";
4
3
  readonly compiling: "正在编译中...";
5
4
  readonly 'dev.performance': "请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。";
6
5
  readonly 'dev.performance.nvue': "尤其是 app-nvue 的 sourcemap 影响较大";
@@ -49,6 +48,5 @@ declare const _default: {
49
48
  readonly 'uni_modules.import': "插件[{0}]仅支持 @/uni_modules/{1} 方式引入,不支持直接导入内部文件 {2}。";
50
49
  readonly 'pages.json.page.notfound': "页面\"{pagePath}\"不存在,请确保填写的页面路径不包含文件后缀,且必须与真实的文件路径大小写保持一致。";
51
50
  readonly 'pages.json.page.slash': "路径 \"{pagePath}\" 不能以 \"/\" 开头";
52
- readonly 'pages.json.tabbar.page.notfound': "tabBar 中配置的页面 \"{pagePath}\" 未在 pages.json 中注册。";
53
51
  };
54
52
  export default _default;
@@ -2,7 +2,6 @@
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',
6
5
  compiling: '正在编译中...',
7
6
  'dev.performance': '请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。',
8
7
  'dev.performance.nvue': '尤其是 app-nvue 的 sourcemap 影响较大',
@@ -52,5 +51,4 @@ exports.default = {
52
51
  'uni_modules.import': '插件[{0}]仅支持 @/uni_modules/{1} 方式引入,不支持直接导入内部文件 {2}。',
53
52
  'pages.json.page.notfound': '页面"{pagePath}"不存在,请确保填写的页面路径不包含文件后缀,且必须与真实的文件路径大小写保持一致。',
54
53
  'pages.json.page.slash': '路径 "{pagePath}" 不能以 "/" 开头',
55
- 'pages.json.tabbar.page.notfound': 'tabBar 中配置的页面 "{pagePath}" 未在 pages.json 中注册。',
56
54
  };
@@ -12,7 +12,6 @@ const easycom_1 = require("./easycom");
12
12
  const messages_1 = require("./messages");
13
13
  const constants_1 = require("./constants");
14
14
  const url_1 = require("./url");
15
- const x_1 = require("./x");
16
15
  function genEncryptEasyComModuleIndex(pluginId, platform, components) {
17
16
  const isMp = platform.startsWith('mp-');
18
17
  const imports = [];
@@ -24,7 +23,7 @@ function genEncryptEasyComModuleIndex(pluginId, platform, components) {
24
23
  ids.push(id);
25
24
  }
26
25
  let instance = '';
27
- if ((0, x_1.isUniAppXAndroidNative)(platform)) {
26
+ if (platform === 'app-android') {
28
27
  instance = (0, easycom_1.genUTSComponentPublicInstanceIdent)(component);
29
28
  // 类型
30
29
  ids.push(instance);
@@ -308,15 +307,14 @@ const KNOWN_ASSET_TYPES = [
308
307
  'txt',
309
308
  ];
310
309
  function findUniModuleFiles(platform, id, inputDir) {
311
- const useUniAppXAndroidNative = (0, x_1.isUniAppXAndroidNative)(platform);
312
310
  return (0, fast_glob_1.sync)(`uni_modules/${id}/**/*`, {
313
311
  cwd: inputDir,
314
312
  absolute: true,
315
313
  ignore: [
316
314
  '**/*.md',
317
- ...(useUniAppXAndroidNative // 仅旧版 Android x 需要扫描 assets
318
- ? []
319
- : [`**/*.{${KNOWN_ASSET_TYPES.join(',')}}`]),
315
+ ...(platform !== 'app-android' // android 平台不需要扫描 assets
316
+ ? [`**/*.{${KNOWN_ASSET_TYPES.join(',')}}`]
317
+ : []),
320
318
  ],
321
319
  });
322
320
  }
@@ -369,10 +367,8 @@ function resolveEncryptUniModule(id, platform, isX = true) {
369
367
  }
370
368
  }
371
369
  }
372
- // 仅旧版 Android x 原生引擎走 uts-proxy,JS 引擎与其他平台统一走 uni_helpers
373
- return (0, utils_1.normalizePath)(path_1.default.join(process.env.UNI_INPUT_DIR, `uni_modules/${uniModuleId}?${isX && (0, x_1.isUniAppXAndroidNative)(platform)
374
- ? 'uts-proxy'
375
- : 'uni_helpers'}`));
370
+ // 原生平台走旧的uts-proxy
371
+ return (0, utils_1.normalizePath)(path_1.default.join(process.env.UNI_INPUT_DIR, `uni_modules/${uniModuleId}?${isX && platform === 'app-android' ? 'uts-proxy' : 'uni_helpers'}`));
376
372
  }
377
373
  }
378
374
  }
@@ -387,14 +383,15 @@ async function checkEncryptUniModules(inputDir, params, sdkType = 'all') {
387
383
  return {};
388
384
  }
389
385
  const cacheDir = process.env.UNI_MODULES_ENCRYPT_CACHE_DIR;
390
- const { zipFile, modules } = packUploadEncryptUniModules(curEncryptUniModules, params.platform, inputDir, cacheDir);
386
+ const { zipFile, modules } = packUploadEncryptUniModules(curEncryptUniModules, process.env.UNI_UTS_PLATFORM, inputDir, cacheDir);
391
387
  if (zipFile) {
392
388
  const downloadFile = path_1.default.resolve(cacheDir, 'uni_modules.download.zip');
393
389
  const { C, D, R, U } = (0, utils_1.requireUniHelpers)();
394
390
  try {
395
391
  const isLogin = await C();
396
- const useUniAppXAndroidNative = (0, x_1.isUniAppXAndroidNative)(params.platform);
397
- const tips = !useUniAppXAndroidNative ? '(此过程耗时较长)' : '';
392
+ const tips = process.env.UNI_UTS_PLATFORM !== 'app-android'
393
+ ? '(此过程耗时较长)'
394
+ : '';
398
395
  console.log(`正在云编译插件${isLogin ? '' : '(请先登录)'}${tips}:${modules.join(',')}...`);
399
396
  let downloadUrl = '';
400
397
  try {
@@ -434,9 +431,8 @@ async function checkEncryptUniModules(inputDir, params, sdkType = 'all') {
434
431
  }
435
432
  }
436
433
  else {
437
- const useUniAppXAndroidNative = (0, x_1.isUniAppXAndroidNative)(params.platform);
438
- // 仅旧版 Android x 需要在缓存命中时额外初始化
439
- if (useUniAppXAndroidNative) {
434
+ // android 平台需要在这里初始化
435
+ if (params.platform === 'app-android') {
440
436
  const { R } = (0, utils_1.requireUniHelpers)();
441
437
  R({
442
438
  dir: process.env.UNI_INPUT_DIR,
@@ -7,7 +7,6 @@ exports.parseUTSModuleDeps = exports.capitalize = exports.camelize = exports.par
7
7
  // 重要:此文件编译后的js,需同步至 vue2 编译器中 uni-cli-shared/lib/uts/uni_modules.js
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const fs_extra_1 = __importDefault(require("fs-extra"));
10
- const x_1 = require("./x");
11
10
  const extApiProviders = [];
12
11
  const extApiPlugins = new Set();
13
12
  function getNonTreeShakingPlugins() {
@@ -229,7 +228,7 @@ function parseInjects(vite = true, platform, language, source, uniModuleRootDir,
229
228
  // source = `${source}/utssdk/index.uts`
230
229
  // }
231
230
  }
232
- else if ((0, x_1.isUniAppXJsEngine)()) {
231
+ else if (process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'js') {
233
232
  if (fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'app-js', 'index.uts'))) {
234
233
  source = `${source}/utssdk/app-js/index.uts`;
235
234
  }
@@ -292,7 +291,7 @@ function parseInject(vite = true, platform, language, source, globalObject, defi
292
291
  const appOptions = defineOptions.app;
293
292
  if (isPlainObject(appOptions)) {
294
293
  // js engine 下且存在 app-js,不检查
295
- const skipCheck = ((0, x_1.isUniAppXJsEngine)() ||
294
+ const skipCheck = (process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'js' ||
296
295
  process.env.UNI_UTS_PLATFORM === 'app-harmony') &&
297
296
  source.includes('app-js');
298
297
  if (!skipCheck) {
package/dist/uts.js CHANGED
@@ -12,8 +12,6 @@ const unimport_1 = require("unimport");
12
12
  const hbx_1 = require("./hbx");
13
13
  const utils_1 = require("./utils");
14
14
  const uni_modules_1 = require("./uni_modules");
15
- const preprocess_1 = require("./preprocess");
16
- const x_1 = require("./x");
17
15
  function once(fn, ctx = null) {
18
16
  let res;
19
17
  return ((...args) => {
@@ -38,7 +36,7 @@ function resolveUTSAppModule(platform, id, importer, includeUTSSDK = true) {
38
36
  if (parentDir === 'uni_modules' ||
39
37
  (includeUTSSDK && parentDir === 'utssdk')) {
40
38
  const basedir = parentDir === 'uni_modules' ? 'utssdk' : '';
41
- if ((0, x_1.isUniAppXJsEngine)()) {
39
+ if (process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'js') {
42
40
  // js engine
43
41
  if (parentDir === 'uni_modules') {
44
42
  const appJsIndex = path_1.default.resolve(id, basedir, 'app-js', 'index.uts');
@@ -512,7 +510,7 @@ async function parseUniExtApiAutoImports(uniExtApiAutoImports, extApis, parseSou
512
510
  const filename = `uni_modules/${pluginId}/utssdk/interface.uts`;
513
511
  const interfaceFileName = path_1.default.resolve(process.env.UNI_INPUT_DIR, filename);
514
512
  if (fs_extra_1.default.existsSync(interfaceFileName)) {
515
- const ids = await parseExportIdentifiers(interfaceFileName, preprocess_1.preUVueJs);
513
+ const ids = await parseExportIdentifiers(interfaceFileName);
516
514
  ids
517
515
  // 过滤掉 Uni
518
516
  .filter((id) => id !== 'Uni')
@@ -9,7 +9,6 @@ const uni_shared_1 = require("@dcloudio/uni-shared");
9
9
  const uts_1 = require("../uts");
10
10
  const workers_1 = require("../workers");
11
11
  const utils_1 = require("../utils");
12
- const x_1 = require("../x");
13
12
  const uniWebLifeCyclePreset = {
14
13
  from: '@dcloudio/uni-app',
15
14
  imports: [
@@ -285,10 +284,8 @@ const vuePreset = {
285
284
  function initAutoImportOptions(platform, { imports = [], ...userOptions }) {
286
285
  rewriteAutoImportOnce();
287
286
  const autoImport = [vuePreset];
288
- // JS 引擎的 App 平台统一走 vue 生命周期导入
289
- if (platform === 'app-ios' ||
290
- platform === 'app-harmony' ||
291
- (0, x_1.isUniAppXAndroidJsEngine)(platform)) {
287
+ // 只有app-ios和app-harmony平台特殊处理
288
+ if (platform === 'app-ios' || platform === 'app-harmony') {
292
289
  autoImport.push(uniAppLifeCyclePreset);
293
290
  }
294
291
  else if (platform === 'web') {
@@ -320,8 +317,8 @@ function initAutoImportOptions(platform, { imports = [], ...userOptions }) {
320
317
  include: [/\.[u]?ts$/, /\.[u]?vue/],
321
318
  exclude,
322
319
  imports: imports.concat(
323
- // 旧版 Android x 仍由专有编译流程处理,Android Vapor 对齐 iOS 走通用自动导入
324
- (0, x_1.isUniAppXAndroidNative)(platform) ? [] : autoImport),
320
+ // app-android 平台暂不注入其他
321
+ platform === 'app-android' ? [] : autoImport),
325
322
  dts: false,
326
323
  };
327
324
  }
@@ -15,8 +15,6 @@ const uni_modules_1 = require("./plugins/uts/uni_modules");
15
15
  const utils_3 = require("./utils");
16
16
  const json_1 = require("../json");
17
17
  const workers_1 = require("../workers");
18
- const dom2_1 = require("../dom2");
19
- const x_1 = require("../x");
20
18
  function createEncryptCssUrlReplacer(resolve) {
21
19
  return async (url, importer) => {
22
20
  if (url.startsWith('/') && !url.startsWith('//')) {
@@ -66,7 +64,6 @@ exports.uniEncryptUniModulesAssetsPlugin = uniEncryptUniModulesAssetsPlugin;
66
64
  function uniEncryptUniModulesPlugin() {
67
65
  let resolvedConfig;
68
66
  const isMp = process.env.UNI_UTS_PLATFORM.startsWith('mp-');
69
- const useUniAppXAndroidNative = (0, x_1.isUniAppXAndroidNative)();
70
67
  const encryptModuleOutputFiles = [];
71
68
  return {
72
69
  name: 'uni:encrypt-uni-modules',
@@ -95,7 +92,7 @@ function uniEncryptUniModulesPlugin() {
95
92
  resolvedConfig = config;
96
93
  },
97
94
  resolveId(id, importer) {
98
- if (!useUniAppXAndroidNative) {
95
+ if (process.env.UNI_UTS_PLATFORM !== 'app-android') {
99
96
  if (resolvedConfig.assetsInclude((0, utils_1.cleanUrl)(id))) {
100
97
  id = (0, utils_2.normalizePath)(id);
101
98
  if (importer && (id.startsWith('./') || id.startsWith('../'))) {
@@ -109,7 +106,7 @@ function uniEncryptUniModulesPlugin() {
109
106
  }
110
107
  },
111
108
  load(id) {
112
- if (!useUniAppXAndroidNative) {
109
+ if (process.env.UNI_UTS_PLATFORM !== 'app-android') {
113
110
  if (resolvedConfig.assetsInclude((0, utils_1.cleanUrl)(id))) {
114
111
  return {
115
112
  code: `export default ${JSON.stringify(id.replace(/\0/g, ''))}`,
@@ -122,8 +119,8 @@ function uniEncryptUniModulesPlugin() {
122
119
  Object.keys(bundle).forEach((fileName) => {
123
120
  if (fileName.endsWith('.module.js')) {
124
121
  const uniModuleId = path_1.default.basename(fileName).replace('.module.js', '');
125
- // 仅旧版 Android x 不需要 js
126
- if (!useUniAppXAndroidNative) {
122
+ // app-android 不需要 js
123
+ if (process.env.UNI_UTS_PLATFORM !== 'app-android') {
127
124
  const newFileName = 'uni_modules/' +
128
125
  fileName.replace('.module.js', '/index.module.js');
129
126
  bundle[newFileName] = bundle[fileName];
@@ -174,13 +171,12 @@ function uniEncryptUniModulesPlugin() {
174
171
  }
175
172
  },
176
173
  async writeBundle() {
177
- if (!useUniAppXAndroidNative) {
174
+ if (process.env.UNI_UTS_PLATFORM !== 'app-android') {
178
175
  return;
179
176
  }
180
177
  const uniXKotlinCompiler = process.env.UNI_APP_X_TSC === 'true'
181
178
  ? (0, uts_1.resolveUTSCompiler)().createUniXKotlinCompilerOnce({
182
179
  resolveWorkers: () => (0, workers_1.getWorkers)(),
183
- sourceFileCallback: (0, dom2_1.initSourceFileCallback)(),
184
180
  })
185
181
  : null;
186
182
  if (uniXKotlinCompiler) {
@@ -397,10 +393,7 @@ function compileCloudUniModuleWithTsc(platform, pluginDir) {
397
393
  const isX = process.env.UNI_APP_X === 'true';
398
394
  const resolveWorkers = () => (0, workers_1.getWorkers)();
399
395
  return compileUniModuleWithTsc(platform, pluginDir, platform === 'app-android'
400
- ? createUniXKotlinCompilerOnce({
401
- resolveWorkers,
402
- sourceFileCallback: (0, dom2_1.initSourceFileCallback)(),
403
- })
396
+ ? createUniXKotlinCompilerOnce({ resolveWorkers })
404
397
  : platform === 'app-harmony'
405
398
  ? createUniXArkTSCompilerOnce({ resolveWorkers })
406
399
  : createUniXSwiftCompilerOnce({ resolveWorkers }), {
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.uniUniModulesExtApiPlugin = void 0;
4
4
  const uts_1 = require("../uts");
5
5
  const resolve_1 = require("../resolve");
6
- const x_1 = require("../x");
7
6
  function uniUniModulesExtApiPlugin() {
8
7
  return {
9
8
  name: 'uni:uni-modules_ext-api',
@@ -22,9 +21,7 @@ function uniUniModulesExtApiPlugin() {
22
21
  },
23
22
  };
24
23
  const build = {};
25
- if (process.env.UNI_UTS_PLATFORM === 'app-ios' ||
26
- process.env.UNI_UTS_PLATFORM === 'app-harmony' ||
27
- (0, x_1.isUniAppXAndroidJsEngine)()) {
24
+ if (['app-ios', 'app-harmony'].includes(process.env.UNI_UTS_PLATFORM)) {
28
25
  build.rollupOptions = rollupOptions;
29
26
  }
30
27
  return {
@@ -9,19 +9,86 @@ const json_1 = require("../../json");
9
9
  const preprocess_1 = require("../../preprocess");
10
10
  const utils_1 = require("../utils");
11
11
  function uniJsonPlugin() {
12
+ const UTS_CAST_ARRAY_MARKER = '/*__UTS_CAST_UTSJSON_ARRAY__*/';
13
+ const UTS_CAST_OBJECT_MARKER = '/*__UTS_CAST_UTSJSON_OBJECT__*/';
14
+ const IS_UNI_X_ANDROID = process.env.UNI_APP_X === 'true' &&
15
+ process.env.UNI_UTS_PLATFORM === 'app-android';
12
16
  return {
13
17
  name: 'uni:json',
14
18
  enforce: 'pre',
19
+ generateBundle(options, bundle) {
20
+ if (IS_UNI_X_ANDROID) {
21
+ for (const [fileName, file] of Object.entries(bundle)) {
22
+ if (fileName.endsWith('.json.ts')) {
23
+ if (file.type === 'asset' && file.source) {
24
+ const source = file.source.toString();
25
+ if (source.includes(UTS_CAST_ARRAY_MARKER) ||
26
+ source.includes(UTS_CAST_OBJECT_MARKER)) {
27
+ file.source = source
28
+ .replace(new RegExp(UTS_CAST_ARRAY_MARKER.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), ' as UTSJSONObject[]')
29
+ .replace(new RegExp(UTS_CAST_OBJECT_MARKER.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), ' as UTSJSONObject');
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ },
15
36
  transform(code, id) {
16
37
  // 如果已经被其他插件处理过了,就不再处理,比如 commonjs 插件,ICAPRegistrar.json?commonjs-external
17
38
  if (id.startsWith('\0')) {
18
39
  return;
19
40
  }
20
- if (path_1.default.extname((0, utils_1.parseVueRequest)(id).filename) !== '.json') {
41
+ const { filename } = (0, utils_1.parseVueRequest)(id);
42
+ if (path_1.default.extname(filename) !== '.json') {
21
43
  return;
22
44
  }
45
+ let codeObj = (0, json_1.parseJson)((0, preprocess_1.preJson)(code, id), false, id);
46
+ let codeJson = '';
47
+ if (IS_UNI_X_ANDROID) {
48
+ if (Array.isArray(codeObj)) {
49
+ codeJson +=
50
+ 'export default JSON.parseArray(`' +
51
+ JSON.stringify(codeObj, null, 2) +
52
+ '`)' +
53
+ UTS_CAST_ARRAY_MARKER +
54
+ ';\n';
55
+ }
56
+ else {
57
+ codeJson +=
58
+ 'let __jsonObj = JSON.parseObject(`' +
59
+ JSON.stringify(codeObj, null, 2) +
60
+ '`);\n';
61
+ for (const key in codeObj) {
62
+ if (!Object.hasOwn(codeObj, key))
63
+ continue;
64
+ const element = codeObj[key];
65
+ if (Array.isArray(element)) {
66
+ codeJson += `export const ${key} = __jsonObj?.getArray("${key}")${UTS_CAST_ARRAY_MARKER};\n`;
67
+ }
68
+ else if (typeof element === 'object' && element !== null) {
69
+ codeJson += `export const ${key} = __jsonObj?.get("${key}")${UTS_CAST_OBJECT_MARKER};\n`;
70
+ }
71
+ else if (typeof element === 'string') {
72
+ codeJson += `export const ${key} = __jsonObj?.getString("${key}") ?? '';\n`;
73
+ }
74
+ else if (typeof element === 'number') {
75
+ codeJson += `export const ${key} = __jsonObj?.getNumber("${key}") ?? 0;\n`;
76
+ }
77
+ else if (typeof element === 'boolean') {
78
+ codeJson += `export const ${key} = __jsonObj?.getBoolean("${key}") ?? false;\n`;
79
+ }
80
+ else {
81
+ codeJson += `export const ${key} = __jsonObj?.get("${key}")${UTS_CAST_OBJECT_MARKER};\n`;
82
+ }
83
+ }
84
+ codeJson += `export default __jsonObj;`;
85
+ }
86
+ }
87
+ else {
88
+ codeJson = JSON.stringify(codeObj, null, 2);
89
+ }
23
90
  return {
24
- code: JSON.stringify((0, json_1.parseJson)((0, preprocess_1.preJson)(code, id), false, id), null, 2),
91
+ code: codeJson,
25
92
  map: {
26
93
  mappings: '',
27
94
  },
@@ -13,8 +13,7 @@ function uniStatsPlugin() {
13
13
  let resolvedConfig;
14
14
  let isManifestChanged = false;
15
15
  const shouldTrackManifestChange = process.env.UNI_APP_X === 'true' &&
16
- (process.env.UNI_PLATFORM === 'app' ||
17
- process.env.UNI_PLATFORM === 'app-harmony');
16
+ process.env.UNI_PLATFORM === 'app-harmony';
18
17
  let isVapor = shouldTrackManifestChange && process.env.UNI_APP_X_DOM2 === 'true';
19
18
  return {
20
19
  name: 'uni:app-stats',
@@ -12,7 +12,6 @@ const uts_1 = require("../../../uts");
12
12
  const utils_1 = require("../../utils");
13
13
  const uni_modules_1 = require("../../../uni_modules");
14
14
  const uni_modules_cloud_1 = require("../../../uni_modules.cloud");
15
- const x_1 = require("../../../x");
16
15
  const utils_2 = require("../../../utils");
17
16
  const json_1 = require("../../../json");
18
17
  const fs_1 = require("../../../fs");
@@ -20,7 +19,6 @@ const context_1 = require("../../../preprocess/context");
20
19
  const hbx_1 = require("../../../hbx");
21
20
  const console_1 = require("../../../logs/console");
22
21
  const workers_1 = require("../../../workers");
23
- const dom2_1 = require("../../../dom2");
24
22
  /* eslint-disable no-restricted-globals */
25
23
  const { preprocess } = require('../../../../lib/preprocess');
26
24
  function rewriteUniModulesConsoleExpr(fileName, content) {
@@ -244,10 +242,7 @@ function uniUTSAppUniModulesPlugin(options = {}) {
244
242
  const uniXKotlinCompiler = process.env.UNI_APP_X_TSC === 'true' &&
245
243
  (process.env.UNI_UTS_PLATFORM === 'app-android' ||
246
244
  process.env.UNI_UTS_PLATFORM === 'app')
247
- ? createUniXKotlinCompilerOnce({
248
- resolveWorkers,
249
- sourceFileCallback: (0, dom2_1.initSourceFileCallback)(),
250
- })
245
+ ? createUniXKotlinCompilerOnce({ resolveWorkers })
251
246
  : null;
252
247
  const uniXSwiftCompiler = process.env.UNI_APP_X_TSC === 'true' &&
253
248
  (process.env.UNI_UTS_PLATFORM === 'app-ios' ||
@@ -432,7 +427,7 @@ function uniUTSAppUniModulesPlugin(options = {}) {
432
427
  for (const plugin of plugins) {
433
428
  const pluginDir = path_1.default.resolve(inputDir, 'uni_modules', plugin.plugin);
434
429
  // 如果是 app-js 环境
435
- if ((0, x_1.isUniAppXJsEngine)()) {
430
+ if (process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'js') {
436
431
  if (fs_extra_1.default.existsSync(path_1.default.resolve(pluginDir, 'utssdk', 'app-js', 'index.uts'))) {
437
432
  continue;
438
433
  }
@@ -43,7 +43,6 @@ const preprocess_1 = require("../../../../preprocess");
43
43
  const uniapp_1 = require("../../../../postcss/plugins/uniapp");
44
44
  const cleanString_1 = require("../cleanString");
45
45
  const constants_1 = require("../../../../constants");
46
- const fontFamily_1 = require("../../../../dom2/fontFamily");
47
46
  const utils_2 = require("../../../utils/utils");
48
47
  const compiler_core_1 = require("@vue/compiler-core");
49
48
  const utils_3 = require("../../../../utils");
@@ -224,8 +223,7 @@ function cssPostPlugin(config, { platform, isJsCode, preserveModules, chunkCssFi
224
223
  // styles initialization in buildStart causes a styling loss in watch
225
224
  const styles = new Map();
226
225
  let cssChunks;
227
- const isDom2 = process.env.UNI_APP_X_DOM2 === 'true';
228
- const isDom2App = isDom2 && platform.startsWith('app');
226
+ const isDom2Harmony = process.env.UNI_APP_X_DOM2 === 'true' && platform === 'app-harmony';
229
227
  return {
230
228
  name: 'vite:css-post',
231
229
  buildStart() {
@@ -242,8 +240,8 @@ function cssPostPlugin(config, { platform, isJsCode, preserveModules, chunkCssFi
242
240
  return {
243
241
  code: modulesCode ||
244
242
  (isJsCode
245
- ? isDom2App
246
- ? `export default ${(0, fontFamily_1.createJsStylePlaceholder)(id)}`
243
+ ? isDom2Harmony
244
+ ? `export default ${constants_1.JS_STYLE_PLACEHOLDER_STR}`
247
245
  : 'export default {}'
248
246
  : ''),
249
247
  map: { mappings: '' },
@@ -253,7 +251,7 @@ function cssPostPlugin(config, { platform, isJsCode, preserveModules, chunkCssFi
253
251
  };
254
252
  },
255
253
  async renderChunk(_code, chunk, _opts) {
256
- if (isDom2) {
254
+ if (isDom2Harmony) {
257
255
  // 通过 generateBundle 实现
258
256
  return null;
259
257
  }
package/dist/workers.js CHANGED
@@ -13,7 +13,6 @@ const json_1 = require("./json");
13
13
  const uts_1 = require("./uts");
14
14
  const uni_modules_1 = require("./vite/plugins/uts/uni_modules");
15
15
  const resolve_1 = require("./resolve");
16
- const dom2_1 = require("./dom2");
17
16
  const debugWorkers = (0, debug_1.default)('uni:workers');
18
17
  let workersRootDir = null;
19
18
  let workersRootDirs = [];
@@ -77,7 +76,6 @@ function uniWorkersPlugin() {
77
76
  const uniXKotlinCompiler = platform === 'app-android'
78
77
  ? (0, uts_1.resolveUTSCompiler)().createUniXKotlinCompilerOnce({
79
78
  resolveWorkers,
80
- sourceFileCallback: (0, dom2_1.initSourceFileCallback)(),
81
79
  })
82
80
  : null;
83
81
  const uniXSwiftCompiler = platform === 'app-ios'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-5000620260331001",
3
+ "version": "3.0.0-5000720260410001",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -69,9 +69,9 @@
69
69
  "unimport": "4.1.1",
70
70
  "unplugin-auto-import": "19.1.0",
71
71
  "xregexp": "5.1.2",
72
- "@dcloudio/uni-i18n": "3.0.0-5000620260331001",
73
- "@dcloudio/uni-shared": "3.0.0-5000620260331001",
74
- "@dcloudio/uni-nvue-styler": "3.0.0-5000620260331001"
72
+ "@dcloudio/uni-i18n": "3.0.0-5000720260410001",
73
+ "@dcloudio/uni-nvue-styler": "3.0.0-5000720260410001",
74
+ "@dcloudio/uni-shared": "3.0.0-5000720260410001"
75
75
  },
76
76
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
77
77
  "devDependencies": {
@@ -91,6 +91,6 @@
91
91
  "code-frame": "link:@types/@babel/code-frame",
92
92
  "postcss": "8.4.45",
93
93
  "vue": "3.4.21",
94
- "@dcloudio/uni-uts-v1": "3.0.0-5000620260331001"
94
+ "@dcloudio/uni-uts-v1": "3.0.0-5000720260410001"
95
95
  }
96
96
  }
@@ -1,4 +0,0 @@
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;
@@ -1,21 +0,0 @@
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,15 +0,0 @@
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
- };
package/dist/dom2/vue.js DELETED
@@ -1,41 +0,0 @@
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/x.d.ts DELETED
@@ -1,10 +0,0 @@
1
- type AppXPlatform = typeof process.env.UNI_UTS_PLATFORM;
2
- export declare function isUniAppX(): boolean;
3
- export declare function isUniAppXAndroid(platform?: AppXPlatform): boolean;
4
- export declare function isUniAppXIOS(platform?: AppXPlatform): boolean;
5
- export declare function isUniAppXVapor(): boolean;
6
- export declare function isUniAppXAndroidVapor(platform?: AppXPlatform): boolean;
7
- export declare function isUniAppXJsEngine(): boolean;
8
- export declare function isUniAppXAndroidJsEngine(platform?: AppXPlatform): boolean;
9
- export declare function isUniAppXAndroidNative(platform?: AppXPlatform): boolean;
10
- export {};
package/dist/x.js DELETED
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isUniAppXAndroidNative = exports.isUniAppXAndroidJsEngine = exports.isUniAppXJsEngine = exports.isUniAppXAndroidVapor = exports.isUniAppXVapor = exports.isUniAppXIOS = exports.isUniAppXAndroid = exports.isUniAppX = void 0;
4
- function isUniAppX() {
5
- return process.env.UNI_APP_X === 'true';
6
- }
7
- exports.isUniAppX = isUniAppX;
8
- function isUniAppXAndroid(platform = process.env.UNI_UTS_PLATFORM) {
9
- return isUniAppX() && platform === 'app-android';
10
- }
11
- exports.isUniAppXAndroid = isUniAppXAndroid;
12
- function isUniAppXIOS(platform = process.env.UNI_UTS_PLATFORM) {
13
- return isUniAppX() && platform === 'app-ios';
14
- }
15
- exports.isUniAppXIOS = isUniAppXIOS;
16
- function isUniAppXVapor() {
17
- return isUniAppX() && process.env.UNI_APP_X_DOM2 === 'true';
18
- }
19
- exports.isUniAppXVapor = isUniAppXVapor;
20
- function isUniAppXAndroidVapor(platform = process.env.UNI_UTS_PLATFORM) {
21
- return isUniAppXAndroid(platform) && process.env.UNI_APP_X_DOM2 === 'true';
22
- }
23
- exports.isUniAppXAndroidVapor = isUniAppXAndroidVapor;
24
- function isUniAppXJsEngine() {
25
- return isUniAppX() && process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'js';
26
- }
27
- exports.isUniAppXJsEngine = isUniAppXJsEngine;
28
- function isUniAppXAndroidJsEngine(platform = process.env.UNI_UTS_PLATFORM) {
29
- return (isUniAppXAndroid(platform) &&
30
- process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'js');
31
- }
32
- exports.isUniAppXAndroidJsEngine = isUniAppXAndroidJsEngine;
33
- function isUniAppXAndroidNative(platform = process.env.UNI_UTS_PLATFORM) {
34
- return (isUniAppXAndroid(platform) &&
35
- // 非 Vapor 或者 Vapor 但使用 native 引擎
36
- (process.env.UNI_APP_X_DOM2 !== 'true' ||
37
- process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'native'));
38
- }
39
- exports.isUniAppXAndroidNative = isUniAppXAndroidNative;