@dcloudio/uni-cli-shared 3.0.0-alpha-5010320260611001 → 3.0.0-alpha-1000920260615733

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 (54) hide show
  1. package/dist/hbx/alias.js +21 -2
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +1 -2
  4. package/dist/json/app/manifest/plus.js +1 -9
  5. package/dist/json/app/pages/definePage.js +1 -1
  6. package/dist/logs/console.js +4 -1
  7. package/dist/messages/en.d.ts +2 -3
  8. package/dist/messages/en.js +2 -3
  9. package/dist/messages/index.d.ts +4 -6
  10. package/dist/messages/zh_CN.d.ts +2 -3
  11. package/dist/messages/zh_CN.js +2 -3
  12. package/dist/uni_modules.cloud.d.ts +0 -4
  13. package/dist/uni_modules.cloud.js +1 -80
  14. package/dist/utils.d.ts +1 -1
  15. package/dist/vite/cloud.js +2 -0
  16. package/dist/vite/plugins/console.js +2 -1
  17. package/dist/vite/plugins/inject.js +7 -2
  18. package/dist/vite/plugins/sfc.js +4 -1
  19. package/dist/vite/plugins/stats.js +0 -26
  20. package/dist/vite/plugins/uts/uni_modules.js +0 -5
  21. package/dist/vite/plugins/vitejs/plugins/asset.d.ts +1 -0
  22. package/dist/vite/plugins/vitejs/plugins/asset.js +6 -1
  23. package/dist/vite/plugins/vitejs/plugins/css.js +5 -1
  24. package/dist/vue/transforms/templateTransformAssetUrl.js +4 -4
  25. package/dist/vue/transforms/templateTransformSrcset.js +4 -4
  26. package/dist/vue/transforms/x/transformDirection.js +4 -33
  27. package/dist/watcher.d.ts +1 -0
  28. package/dist/x.d.ts +1 -0
  29. package/dist/x.js +5 -1
  30. package/lib/@vue/compiler-core/dist/compiler-core.cjs.js +16 -23
  31. package/lib/@vue/compiler-core/dist/compiler-core.cjs.prod.js +16 -23
  32. package/lib/@vue/compiler-core/dist/compiler-core.esm-bundler.js +16 -23
  33. package/lib/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +23 -66
  34. package/lib/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +67 -115
  35. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.js +1 -1
  36. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.prod.js +1 -1
  37. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.esm-bundler.js +1 -1
  38. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.js +1 -1
  39. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +1 -1
  40. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +1 -1
  41. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +1 -1
  42. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +1 -1
  43. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.js +1 -1
  44. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.prod.js +1 -1
  45. package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +3 -3
  46. package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +45 -217
  47. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +43 -218
  48. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.d.ts +12 -62
  49. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +44 -228
  50. package/lib/dom2/app/@vue/compiler-vapor-dom2/dist/compiler-vapor-dom2.cjs.js +1 -1
  51. package/lib/dom2/app/@vue/shared/dist/shared.cjs.js +1 -1
  52. package/lib/dom2/app/@vue/shared/dist/shared.cjs.prod.js +1 -1
  53. package/lib/dom2/app/@vue/shared/dist/shared.esm-bundler.js +1 -1
  54. package/package.json +18 -19
package/dist/hbx/alias.js CHANGED
@@ -78,8 +78,27 @@ function initModuleAlias() {
78
78
  if (process.env.UNI_APP_PLATFORM ||
79
79
  process.env.UNI_PLATFORM === 'app-harmony') {
80
80
  if (!process.env.UNI_APP_X_VAPOR_RENDER_TARGET) {
81
- // 默认 app 平台使用 bytecode 目标
82
- process.env.UNI_APP_X_VAPOR_RENDER_TARGET = 'bytecode';
81
+ // ios harmony 平台默认使用 bytecode 目标,存在 .native 文件时使用 native 目标;其他平台如果存在 .dynamic 文件则使用 bytecode 目标,否则使用 native 目标
82
+ if (process.env.UNI_APP_PLATFORM === 'ios' ||
83
+ process.env.UNI_APP_PLATFORM === 'harmony' ||
84
+ process.env.UNI_PLATFORM === 'app-harmony') {
85
+ if (process.env.UNI_INPUT_DIR &&
86
+ fs_1.default.existsSync(path_1.default.resolve(process.env.UNI_INPUT_DIR, '.native'))) {
87
+ process.env.UNI_APP_X_VAPOR_RENDER_TARGET = 'nativecode';
88
+ }
89
+ else {
90
+ process.env.UNI_APP_X_VAPOR_RENDER_TARGET = 'bytecode';
91
+ }
92
+ }
93
+ else {
94
+ if (process.env.UNI_INPUT_DIR &&
95
+ fs_1.default.existsSync(path_1.default.resolve(process.env.UNI_INPUT_DIR, '.dynamic'))) {
96
+ process.env.UNI_APP_X_VAPOR_RENDER_TARGET = 'bytecode';
97
+ }
98
+ else {
99
+ process.env.UNI_APP_X_VAPOR_RENDER_TARGET = 'nativecode';
100
+ }
101
+ }
83
102
  }
84
103
  if (process.env.UNI_APP_X_VAPOR_RENDER_TARGET?.includes('bytecode')) {
85
104
  process.env.UNI_APP_X_DOM2_DYNAMIC = 'true';
package/dist/index.d.ts CHANGED
@@ -26,7 +26,7 @@ export * from './platform';
26
26
  export * from './utsUtils';
27
27
  export * from './workers';
28
28
  export { parseUniExtApi, parseUniExtApis, parseInjects, Define, DefineOptions, Defines, getUniExtApiProviderRegisters, formatExtApiProviderName, } from './uni_modules';
29
- export { copyEncryptUniModulesDom2Bytes, getUniModulesEncryptType, parseUniModulesArtifacts, resolveEncryptUniModule, } from './uni_modules.cloud';
29
+ export { getUniModulesEncryptType, parseUniModulesArtifacts, resolveEncryptUniModule, } from './uni_modules.cloud';
30
30
  import type { EncryptPackageJson } from './uni_modules.cloud';
31
31
  export type EncryptArtifacts = EncryptPackageJson['uni_modules']['artifacts'];
32
32
  export { M } from './messages';
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.checkUpdate = exports.M = exports.resolveEncryptUniModule = exports.parseUniModulesArtifacts = exports.getUniModulesEncryptType = exports.copyEncryptUniModulesDom2Bytes = exports.formatExtApiProviderName = exports.getUniExtApiProviderRegisters = exports.parseInjects = exports.parseUniExtApis = exports.parseUniExtApi = void 0;
17
+ exports.checkUpdate = exports.M = exports.resolveEncryptUniModule = exports.parseUniModulesArtifacts = exports.getUniModulesEncryptType = exports.formatExtApiProviderName = exports.getUniExtApiProviderRegisters = exports.parseInjects = exports.parseUniExtApis = exports.parseUniExtApi = void 0;
18
18
  __exportStar(require("./fs"), exports);
19
19
  __exportStar(require("./mp"), exports);
20
20
  __exportStar(require("./url"), exports);
@@ -49,7 +49,6 @@ Object.defineProperty(exports, "parseInjects", { enumerable: true, get: function
49
49
  Object.defineProperty(exports, "getUniExtApiProviderRegisters", { enumerable: true, get: function () { return uni_modules_1.getUniExtApiProviderRegisters; } });
50
50
  Object.defineProperty(exports, "formatExtApiProviderName", { enumerable: true, get: function () { return uni_modules_1.formatExtApiProviderName; } });
51
51
  var uni_modules_cloud_1 = require("./uni_modules.cloud");
52
- Object.defineProperty(exports, "copyEncryptUniModulesDom2Bytes", { enumerable: true, get: function () { return uni_modules_cloud_1.copyEncryptUniModulesDom2Bytes; } });
53
52
  Object.defineProperty(exports, "getUniModulesEncryptType", { enumerable: true, get: function () { return uni_modules_cloud_1.getUniModulesEncryptType; } });
54
53
  Object.defineProperty(exports, "parseUniModulesArtifacts", { enumerable: true, get: function () { return uni_modules_cloud_1.parseUniModulesArtifacts; } });
55
54
  Object.defineProperty(exports, "resolveEncryptUniModule", { enumerable: true, get: function () { return uni_modules_cloud_1.resolveEncryptUniModule; } });
@@ -117,15 +117,7 @@ function initUniStatistics(manifestJson) {
117
117
  if (!uniStatistics) {
118
118
  return;
119
119
  }
120
- /**
121
- * 判断是否为私有版统计:
122
- * - 新配置:type === 'private'
123
- * - 旧配置兼容:version === 2
124
- */
125
- const isPrivateStat = uniStatistics.type === 'private' ||
126
- uniStatistics.version === 2 ||
127
- uniStatistics.version === '2';
128
- if (isPrivateStat) {
120
+ if (uniStatistics.version === 2 || uniStatistics.version === '2') {
129
121
  if (uniStatistics.uniCloud && uniStatistics.uniCloud.spaceId) {
130
122
  return;
131
123
  }
@@ -46,7 +46,7 @@ function defineNVuePageCode(pagesJson) {
46
46
  }
47
47
  const pagePathWithExtname = (0, utils_1.normalizePagePath)(page.path, 'app');
48
48
  if (pagePathWithExtname) {
49
- importNVuePagesCode.push(`import('./${pagePathWithExtname}').then((res)=>{res()})`);
49
+ importNVuePagesCode.push(`import('./${pagePathWithExtname}').then((res)=>res.default)`);
50
50
  }
51
51
  });
52
52
  return importNVuePagesCode.join('\n');
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.appendConsoleExpr = exports.restoreConsoleExpr = exports.rewriteConsoleExpr = void 0;
7
7
  const magic_string_1 = __importDefault(require("magic-string"));
8
8
  const utils_1 = require("../utils");
9
+ const x_1 = require("../x");
9
10
  function rewriteConsoleExpr(method, id, filename, code, sourceMap = false) {
10
11
  filename = (0, utils_1.normalizePath)(filename);
11
12
  const re = /(console\.(log|info|debug|warn|error))\s*\(([^)]+)\)/g;
@@ -19,7 +20,9 @@ function rewriteConsoleExpr(method, id, filename, code, sourceMap = false) {
19
20
  if (s.hasChanged()) {
20
21
  return {
21
22
  code: s.toString(),
22
- map: sourceMap ? s.generateMap({ hires: true }) : { mappings: '' },
23
+ map: sourceMap
24
+ ? s.generateMap({ hires: (0, x_1.shouldUseHighResolutionSourceMap)() })
25
+ : { mappings: '' },
23
26
  };
24
27
  }
25
28
  return { code, map: null };
@@ -15,12 +15,11 @@ declare const _default: {
15
15
  readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
16
16
  readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
17
17
  readonly 'dev.watching.restart.vapor': "DONE Restart required. Switching vapor mode requires restarting to take effect.";
18
- readonly 'dev.watching.vapor.render.target': "vapor-render-target in manifest.json was changed to {manifestTarget}, but the running console is still {runtimeTarget}.";
19
18
  readonly 'build.failed': "DONE Build failed.";
20
19
  readonly 'compiler.build.failed': "Build failed with errors.";
21
20
  readonly 'stat.warn.appid': "The current application is not configured with Appid, and uni statistics cannot be used. For details, see https://ask.dcloud.net.cn/article/36303";
22
- readonly 'stat.warn.version': "The uni statistics type is not configured. The default type is public. You can set it to public or private. Details: https://uniapp.dcloud.io/uni-stat";
23
- readonly 'stat.warn.tip': "uni statistics enabled: {type}";
21
+ readonly 'stat.warn.version': "The uni statistics version is not configured. The default version is 1.0.uni statistics version 2.0 is recommended, private deployment data is more secure and code is open source and customizable. details: https://uniapp.dcloud.io/uni-stat";
22
+ readonly 'stat.warn.tip': "uni statistics version: {version}";
24
23
  readonly 'i18n.fallbackLocale.default': "fallbackLocale is missing in manifest.json, use: {locale}";
25
24
  readonly 'i18n.fallbackLocale.missing': "./local/{locale}.json is missing";
26
25
  readonly 'easycom.conflict': "easycom component conflict: ";
@@ -17,12 +17,11 @@ exports.default = {
17
17
  'dev.watching.end.pages': 'DONE Build complete. PAGES:{pages}',
18
18
  'dev.watching.end.files': 'DONE Build complete. FILES:{files}',
19
19
  'dev.watching.restart.vapor': 'DONE Restart required. Switching vapor mode requires restarting to take effect.',
20
- 'dev.watching.vapor.render.target': 'vapor-render-target in manifest.json was changed to {manifestTarget}, but the running console is still {runtimeTarget}.',
21
20
  'build.failed': 'DONE Build failed.',
22
21
  'compiler.build.failed': 'Build failed with errors.',
23
22
  'stat.warn.appid': 'The current application is not configured with Appid, and uni statistics cannot be used. For details, see https://ask.dcloud.net.cn/article/36303',
24
- 'stat.warn.version': 'The uni statistics type is not configured. The default type is public. You can set it to public or private. Details: https://uniapp.dcloud.io/uni-stat',
25
- 'stat.warn.tip': 'uni statistics enabled: {type}',
23
+ 'stat.warn.version': 'The uni statistics version is not configured. The default version is 1.0.uni statistics version 2.0 is recommended, private deployment data is more secure and code is open source and customizable. details: https://uniapp.dcloud.io/uni-stat',
24
+ 'stat.warn.tip': 'uni statistics version: {version}',
26
25
  'i18n.fallbackLocale.default': 'fallbackLocale is missing in manifest.json, use: {locale}',
27
26
  'i18n.fallbackLocale.missing': './local/{locale}.json is missing',
28
27
  'easycom.conflict': 'easycom component conflict: ',
@@ -15,12 +15,11 @@ export declare const M: {
15
15
  readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
16
16
  readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
17
17
  readonly 'dev.watching.restart.vapor': "DONE Restart required. 切换蒸汽模式需要重新运行才能生效。";
18
- readonly 'dev.watching.vapor.render.target': "manifest.json 中更改了视图层编译目标为{manifestTarget},但注意运行控制台还是{runtimeTarget}。";
19
18
  readonly 'build.failed': "DONE Build failed.";
20
19
  readonly 'compiler.build.failed': "编译失败";
21
20
  readonly 'stat.warn.appid': "当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303";
22
- readonly 'stat.warn.version': "当前应用未配置 uni 统计版本,默认使用公有版;可配置为公有版或私有版。详情:https://uniapp.dcloud.io/uni-stat";
23
- readonly 'stat.warn.tip': "已开启uni 统计 2.0{type}";
21
+ readonly 'stat.warn.version': "当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:https://uniapp.dcloud.io/uni-stat";
22
+ readonly 'stat.warn.tip': "已开启 uni统计{version} 版本";
24
23
  readonly 'i18n.fallbackLocale.default': "当前应用未在 manifest.json 配置 fallbackLocale,默认使用:{locale}";
25
24
  readonly 'i18n.fallbackLocale.missing': "当前应用配置的 fallbackLocale 或 locale 为:{locale},但 locale 目录缺少该语言文件";
26
25
  readonly 'easycom.conflict': "easycom组件冲突:";
@@ -72,12 +71,11 @@ export declare const M: {
72
71
  readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
73
72
  readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
74
73
  readonly 'dev.watching.restart.vapor': "DONE Restart required. Switching vapor mode requires restarting to take effect.";
75
- readonly 'dev.watching.vapor.render.target': "vapor-render-target in manifest.json was changed to {manifestTarget}, but the running console is still {runtimeTarget}.";
76
74
  readonly 'build.failed': "DONE Build failed.";
77
75
  readonly 'compiler.build.failed': "Build failed with errors.";
78
76
  readonly 'stat.warn.appid': "The current application is not configured with Appid, and uni statistics cannot be used. For details, see https://ask.dcloud.net.cn/article/36303";
79
- readonly 'stat.warn.version': "The uni statistics type is not configured. The default type is public. You can set it to public or private. Details: https://uniapp.dcloud.io/uni-stat";
80
- readonly 'stat.warn.tip': "uni statistics enabled: {type}";
77
+ readonly 'stat.warn.version': "The uni statistics version is not configured. The default version is 1.0.uni statistics version 2.0 is recommended, private deployment data is more secure and code is open source and customizable. details: https://uniapp.dcloud.io/uni-stat";
78
+ readonly 'stat.warn.tip': "uni statistics version: {version}";
81
79
  readonly 'i18n.fallbackLocale.default': "fallbackLocale is missing in manifest.json, use: {locale}";
82
80
  readonly 'i18n.fallbackLocale.missing': "./local/{locale}.json is missing";
83
81
  readonly 'easycom.conflict': "easycom component conflict: ";
@@ -15,12 +15,11 @@ declare const _default: {
15
15
  readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
16
16
  readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
17
17
  readonly 'dev.watching.restart.vapor': "DONE Restart required. 切换蒸汽模式需要重新运行才能生效。";
18
- readonly 'dev.watching.vapor.render.target': "manifest.json 中更改了视图层编译目标为{manifestTarget},但注意运行控制台还是{runtimeTarget}。";
19
18
  readonly 'build.failed': "DONE Build failed.";
20
19
  readonly 'compiler.build.failed': "编译失败";
21
20
  readonly 'stat.warn.appid': "当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303";
22
- readonly 'stat.warn.version': "当前应用未配置 uni 统计版本,默认使用公有版;可配置为公有版或私有版。详情:https://uniapp.dcloud.io/uni-stat";
23
- readonly 'stat.warn.tip': "已开启uni 统计 2.0{type}";
21
+ readonly 'stat.warn.version': "当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:https://uniapp.dcloud.io/uni-stat";
22
+ readonly 'stat.warn.tip': "已开启 uni统计{version} 版本";
24
23
  readonly 'i18n.fallbackLocale.default': "当前应用未在 manifest.json 配置 fallbackLocale,默认使用:{locale}";
25
24
  readonly 'i18n.fallbackLocale.missing': "当前应用配置的 fallbackLocale 或 locale 为:{locale},但 locale 目录缺少该语言文件";
26
25
  readonly 'easycom.conflict': "easycom组件冲突:";
@@ -17,12 +17,11 @@ exports.default = {
17
17
  'dev.watching.end.pages': 'DONE Build complete. PAGES:{pages}',
18
18
  'dev.watching.end.files': 'DONE Build complete. FILES:{files}',
19
19
  'dev.watching.restart.vapor': 'DONE Restart required. 切换蒸汽模式需要重新运行才能生效。',
20
- 'dev.watching.vapor.render.target': 'manifest.json 中更改了视图层编译目标为{manifestTarget},但注意运行控制台还是{runtimeTarget}。',
21
20
  'build.failed': 'DONE Build failed.',
22
21
  'compiler.build.failed': '编译失败',
23
22
  'stat.warn.appid': '当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303',
24
- 'stat.warn.version': '当前应用未配置 uni 统计版本,默认使用公有版;可配置为公有版或私有版。详情:https://uniapp.dcloud.io/uni-stat',
25
- 'stat.warn.tip': '已开启uni 统计 2.0{type}',
23
+ 'stat.warn.version': '当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:https://uniapp.dcloud.io/uni-stat',
24
+ 'stat.warn.tip': '已开启 uni统计{version} 版本',
26
25
  'i18n.fallbackLocale.default': '当前应用未在 manifest.json 配置 fallbackLocale,默认使用:{locale}',
27
26
  'i18n.fallbackLocale.missing': '当前应用配置的 fallbackLocale 或 locale 为:{locale},但 locale 目录缺少该语言文件',
28
27
  'easycom.conflict': 'easycom组件冲突:',
@@ -49,7 +49,6 @@ export interface EncryptPackageJson {
49
49
  export declare function initCheckEnv(): Record<string, unknown>;
50
50
  export declare function resolveEncryptUniModule(id: string, platform: typeof process.env.UNI_UTS_PLATFORM, isX?: boolean): string | undefined;
51
51
  type CloudCompileSdkType = 'utssdk' | 'easycom' | 'all';
52
- type VaporRenderTarget = 'bytecode' | 'nativecode';
53
52
  export interface CloudCompileParams {
54
53
  mode: 'development' | 'production';
55
54
  packType: 'debug' | 'release';
@@ -58,8 +57,6 @@ export interface CloudCompileParams {
58
57
  appname: string;
59
58
  platform: typeof process.env.UNI_UTS_PLATFORM;
60
59
  'uni-app-x': boolean;
61
- vapor: boolean;
62
- vaporRenderTarget?: VaporRenderTarget;
63
60
  env: Record<string, string>;
64
61
  }
65
62
  export declare function checkEncryptUniModules(inputDir: string, params: CloudCompileParams, sdkType?: CloudCompileSdkType): Promise<{} | undefined>;
@@ -70,6 +67,5 @@ export declare function parseUniModulesArtifacts(): {
70
67
  scopedSlots: string[];
71
68
  declaration: string;
72
69
  }[];
73
- export declare function copyEncryptUniModulesDom2Bytes(): boolean | Promise<boolean>;
74
70
  export declare function virtualComponentPath(filepath: string): string;
75
71
  export {};
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.virtualComponentPath = exports.copyEncryptUniModulesDom2Bytes = exports.parseUniModulesArtifacts = exports.getUniModulesEncryptType = exports.checkEncryptUniModules = exports.resolveEncryptUniModule = exports.initCheckEnv = exports.packUploadEncryptUniModules = exports.findUploadEncryptUniModulesFiles = exports.findCloudEncryptUniModules = exports.parseEasyComComponents = exports.parseUniModulesWithComponents = exports.genEncryptUTSModuleCode = exports.genEncryptEasyComModuleCode = void 0;
6
+ exports.virtualComponentPath = exports.parseUniModulesArtifacts = exports.getUniModulesEncryptType = exports.checkEncryptUniModules = exports.resolveEncryptUniModule = exports.initCheckEnv = exports.packUploadEncryptUniModules = exports.findUploadEncryptUniModulesFiles = exports.findCloudEncryptUniModules = exports.parseEasyComComponents = exports.parseUniModulesWithComponents = exports.genEncryptUTSModuleCode = exports.genEncryptEasyComModuleCode = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const fs_extra_1 = __importDefault(require("fs-extra"));
9
9
  const fast_glob_1 = require("fast-glob");
@@ -429,7 +429,6 @@ async function checkEncryptUniModules(inputDir, params, sdkType = 'all') {
429
429
  const AdmZip = require('adm-zip');
430
430
  const zip = new AdmZip(downloadFile);
431
431
  zip.extractAllTo(cacheDir, true);
432
- await Promise.resolve(copyEncryptUniModulesDom2Bytes());
433
432
  fs_extra_1.default.unlinkSync(zipFile);
434
433
  fs_extra_1.default.unlinkSync(downloadFile);
435
434
  R({
@@ -447,7 +446,6 @@ async function checkEncryptUniModules(inputDir, params, sdkType = 'all') {
447
446
  }
448
447
  }
449
448
  else {
450
- await Promise.resolve(copyEncryptUniModulesDom2Bytes());
451
449
  const useUniAppXAndroidNative = (0, x_1.isUniAppXAndroidNative)(params.platform);
452
450
  // 仅旧版 Android x 需要在缓存命中时额外初始化
453
451
  if (useUniAppXAndroidNative) {
@@ -482,83 +480,6 @@ function parseUniModulesArtifacts() {
482
480
  return res;
483
481
  }
484
482
  exports.parseUniModulesArtifacts = parseUniModulesArtifacts;
485
- function copyEncryptUniModulesDom2Bytes() {
486
- if (process.env.UNI_APP_X_DOM2 !== 'true') {
487
- return false;
488
- }
489
- if (!['app-android', 'app-ios', 'app-harmony'].includes(process.env.UNI_UTS_PLATFORM)) {
490
- return false;
491
- }
492
- const cacheDir = process.env.UNI_MODULES_ENCRYPT_CACHE_DIR;
493
- const outputDir = process.env.UNI_OUTPUT_DIR;
494
- if (!cacheDir || !outputDir) {
495
- return false;
496
- }
497
- if (process.env.UNI_APP_X_VAPOR_RENDER_TARGET === 'bytecode') {
498
- return copyEncryptUniModulesDom2BytesTarget(cacheDir, outputDir);
499
- }
500
- if (process.env.UNI_APP_X_VAPOR_RENDER_TARGET === 'nativecode') {
501
- return copyEncryptUniModulesDom2CppTarget(cacheDir, outputDir);
502
- }
503
- return false;
504
- }
505
- exports.copyEncryptUniModulesDom2Bytes = copyEncryptUniModulesDom2Bytes;
506
- function copyEncryptUniModulesDom2BytesTarget(cacheDir, outputDir) {
507
- // 只依赖编译环境变量定位缓存目录和输出目录,避免拼接具体 unpackage/dist 路径。
508
- const sourceBytesDir = path_1.default.resolve(cacheDir, 'bytes');
509
- if (!fs_extra_1.default.existsSync(sourceBytesDir) ||
510
- !fs_extra_1.default.statSync(sourceBytesDir).isDirectory()) {
511
- return false;
512
- }
513
- const outputBytesDir = path_1.default.resolve(outputDir, 'bytes');
514
- // 云编译产出的 bytecode 在缓存目录中,这里只合并复制到当前编译输出目录。
515
- fs_extra_1.default.copySync(sourceBytesDir, outputBytesDir, { overwrite: true });
516
- return true;
517
- }
518
- async function copyEncryptUniModulesDom2CppTarget(cacheDir, outputDir) {
519
- const sourceCppDir = path_1.default.resolve(cacheDir, 'cpp');
520
- if (!fs_extra_1.default.existsSync(sourceCppDir) ||
521
- !fs_extra_1.default.statSync(sourceCppDir).isDirectory()) {
522
- return false;
523
- }
524
- const outputCppDir = process.env.UNI_APP_X_DOM2_CPP_DIR || path_1.default.resolve(outputDir, 'cpp');
525
- // nativecode 的 cpp/h 暂时不走 DUM 解密,直接复制云端产物。
526
- // const cppFiles = sync('**/*.{cpp,h}', {
527
- // absolute: false,
528
- // cwd: sourceCppDir,
529
- // onlyFiles: true,
530
- // }).filter((file) => !isIgnoreDom2CppFile(file))
531
- // if (cppFiles.length) {
532
- // const files = cppFiles.reduce((files, file) => {
533
- // files[path.resolve(sourceCppDir, file)] = path.resolve(outputCppDir, file)
534
- // return files
535
- // }, {} as Record<string, string>)
536
- // const { DUM } = requireUniHelpers()
537
- // const errMsg = await DUM(path.basename(sourceCppDir), files)
538
- // if (errMsg) {
539
- // console.error(errMsg)
540
- // process.exit(0)
541
- // }
542
- // }
543
- // cpp 目录保持原目录结构直接复制,shared_data_init.h 由当前编译流程生成,不复制云端缓存版本。
544
- fs_extra_1.default.copySync(sourceCppDir, outputCppDir, {
545
- filter(src) {
546
- if (fs_extra_1.default.statSync(src).isDirectory()) {
547
- return true;
548
- }
549
- // shared_data_init.h 由当前编译生成,不能复制云端缓存里的旧文件覆盖本地结果。
550
- if (isIgnoreDom2CppFile(src)) {
551
- return false;
552
- }
553
- return true;
554
- },
555
- overwrite: true,
556
- });
557
- return true;
558
- }
559
- function isIgnoreDom2CppFile(filename) {
560
- return path_1.default.basename(filename) === 'shared_data_init.h';
561
- }
562
483
  const uniComponentPrefix = 'uniComponent://';
563
484
  function virtualComponentPath(filepath) {
564
485
  return uniComponentPrefix + (0, url_1.encodeBase64Url)(filepath);
package/dist/utils.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare function normalizePagePath(pagePath: string, platform: UniApp.PLA
15
15
  export declare function removeExt(str: string): string;
16
16
  export declare function normalizeNodeModules(str: string): string;
17
17
  export declare function normalizeMiniProgramFilename(filename: string, inputDir?: string): string;
18
- export declare function normalizeParsePlugins(importer: string, babelParserPlugins?: ParserPlugin[]): (import("@babel/parser").ParserPluginWithOptions | ("jsx" | "typescript" | "asyncDoExpressions" | "asyncGenerators" | "bigInt" | "classPrivateMethods" | "classPrivateProperties" | "classProperties" | "classStaticBlock" | "decimal" | "decorators-legacy" | "deferredImportEvaluation" | "decoratorAutoAccessors" | "destructuringPrivate" | "doExpressions" | "dynamicImport" | "explicitResourceManagement" | "exportDefaultFrom" | "exportNamespaceFrom" | "flow" | "flowComments" | "functionBind" | "functionSent" | "importMeta" | "logicalAssignment" | "importAssertions" | "importAttributes" | "importReflection" | "moduleBlocks" | "moduleStringNames" | "nullishCoalescingOperator" | "numericSeparator" | "objectRestSpread" | "optionalCatchBinding" | "optionalChaining" | "partialApplication" | "placeholders" | "privateIn" | "regexpUnicodeSets" | "sourcePhaseImports" | "throwExpressions" | "topLevelAwait" | "v8intrinsic" | "decorators" | "estree" | "moduleAttributes" | "optionalChainingAssign" | "pipelineOperator" | "recordAndTuple"))[];
18
+ export declare function normalizeParsePlugins(importer: string, babelParserPlugins?: ParserPlugin[]): ParserPlugin[];
19
19
  export declare function pathToGlob(pathString: string, glob: string, options?: {
20
20
  windows?: boolean;
21
21
  escape?: boolean;
@@ -135,7 +135,9 @@ function uniEncryptUniModulesPlugin() {
135
135
  type: 'asset',
136
136
  fileName: pkg,
137
137
  name: pkg,
138
+ names: [pkg],
138
139
  originalFileName: null,
140
+ originalFileNames: [],
139
141
  needsCodeReference: false,
140
142
  source: genUniModulesPackageJson(uniModuleId, process.env.UNI_INPUT_DIR, {
141
143
  env: (0, uni_modules_cloud_1.initCheckEnv)(),
@@ -22,7 +22,8 @@ function uniConsolePlugin(options) {
22
22
  resolvedConfig = config;
23
23
  // 理论上发行模式就不应该有这个逻辑了,只不过为了尽量不引发兼容性问题,目前严谨一些判断是否配置了 drop_console
24
24
  if (process.env.NODE_ENV !== 'development') {
25
- const compressOptions = resolvedConfig.build.terserOptions?.compress;
25
+ const compressOptions = resolvedConfig.build.terserOptions
26
+ ?.compress;
26
27
  if (compressOptions && typeof compressOptions === 'object') {
27
28
  dropConsole = !!compressOptions.drop_console;
28
29
  }
@@ -12,6 +12,7 @@ const shared_1 = require("@vue/shared");
12
12
  const magic_string_1 = __importDefault(require("magic-string"));
13
13
  const utils_1 = require("../utils");
14
14
  const uts_1 = require("../../uts");
15
+ const x_1 = require("../../x");
15
16
  const debugInject = (0, debug_1.default)('uni:inject');
16
17
  // const debugInjectTry = debug('uni:inject-try')
17
18
  function uniViteInjectPlugin(name, options) {
@@ -128,7 +129,7 @@ function uniViteInjectPlugin(name, options) {
128
129
  }
129
130
  (0, estree_walker_1.walk)(ast, {
130
131
  enter(node, parent) {
131
- if (sourceMap) {
132
+ if (sourceMap && (0, x_1.shouldUseHighResolutionSourceMap)()) {
132
133
  magicString.addSourcemapLocation(node.start);
133
134
  magicString.addSourcemapLocation(node.end);
134
135
  }
@@ -170,7 +171,11 @@ function uniViteInjectPlugin(name, options) {
170
171
  magicString.prepend(`${importBlock}\n\n`);
171
172
  return {
172
173
  code: magicString.toString(),
173
- map: sourceMap ? magicString.generateMap({ hires: true }) : null,
174
+ map: sourceMap
175
+ ? magicString.generateMap({
176
+ hires: (0, x_1.shouldUseHighResolutionSourceMap)(),
177
+ })
178
+ : null,
174
179
  };
175
180
  },
176
181
  };
@@ -9,6 +9,7 @@ const magic_string_1 = __importDefault(require("magic-string"));
9
9
  const vue_1 = require("../../vue");
10
10
  const utils_1 = require("../utils");
11
11
  const preprocess_1 = require("../../preprocess");
12
+ const x_1 = require("../../x");
12
13
  const SRC_IMPORT_RE = /<(template|script|style)[^>]*src\s*=\s*["']([^"']+)["'][^>]*>/;
13
14
  const SRC_IMPORT_VUE_RE = /<(template|script|style)[^>]*src\s*=\s*["'](.*\.uvue|.*\.vue)["'][^>]*>/;
14
15
  function isSrcImport(code) {
@@ -120,7 +121,9 @@ function uniViteSfcSrcImportPlugin({ onlyVue } = { onlyVue: true }) {
120
121
  }
121
122
  return {
122
123
  code: s.toString(),
123
- map: sourceMap ? s.generateMap({ hires: true }) : null,
124
+ map: sourceMap
125
+ ? s.generateMap({ hires: (0, x_1.shouldUseHighResolutionSourceMap)() })
126
+ : null,
124
127
  };
125
128
  },
126
129
  };
@@ -9,23 +9,6 @@ const utils_1 = require("../../utils");
9
9
  const json_1 = require("../../json");
10
10
  const messages_1 = require("../../messages");
11
11
  const emittedHashMap = new WeakMap();
12
- function normalizeVaporRenderTarget(target) {
13
- if (typeof target !== 'string') {
14
- return;
15
- }
16
- if (target.includes('bytecode')) {
17
- return 'bytecode';
18
- }
19
- if (target.includes('nativecode')) {
20
- return 'nativecode';
21
- }
22
- }
23
- function formatVaporRenderTarget(target) {
24
- return messages_1.M[`view.render.compiler.target.${target}`];
25
- }
26
- function getManifestVaporRenderTarget(manifest) {
27
- return normalizeVaporRenderTarget(manifest['uni-app-x']?.['vapor-render-target']);
28
- }
29
12
  function uniStatsPlugin() {
30
13
  let resolvedConfig;
31
14
  let isManifestChanged = false;
@@ -45,15 +28,6 @@ function uniStatsPlugin() {
45
28
  try {
46
29
  const manifest = (0, json_1.parseJson)(fs_extra_1.default.readFileSync(id, 'utf-8'), true, 'manifest.json');
47
30
  const uniAppX = manifest['uni-app-x'] || {};
48
- const vaporRenderTarget = getManifestVaporRenderTarget(manifest);
49
- const runtimeVaporRenderTarget = normalizeVaporRenderTarget(process.env.UNI_APP_X_VAPOR_RENDER_TARGET);
50
- if (vaporRenderTarget &&
51
- runtimeVaporRenderTarget &&
52
- vaporRenderTarget !== runtimeVaporRenderTarget) {
53
- console.warn(messages_1.M['dev.watching.vapor.render.target']
54
- .replace('{manifestTarget}', formatVaporRenderTarget(vaporRenderTarget))
55
- .replace('{runtimeTarget}', formatVaporRenderTarget(runtimeVaporRenderTarget)));
56
- }
57
31
  if (uniAppX.vapor !== isVapor) {
58
32
  isVapor = uniAppX.vapor === true;
59
33
  console.warn(messages_1.M['dev.watching.restart.vapor']);
@@ -623,13 +623,8 @@ function uniDecryptUniModulesPlugin() {
623
623
  appname: manifest.name,
624
624
  platform: process.env.UNI_UTS_PLATFORM,
625
625
  'uni-app-x': isX,
626
- vapor: process.env.UNI_APP_X_DOM2 === 'true',
627
626
  env,
628
627
  };
629
- if (options.vapor) {
630
- options.vaporRenderTarget =
631
- process.env.UNI_APP_X_VAPOR_RENDER_TARGET || 'bytecode';
632
- }
633
628
  // 鸿蒙平台需要拆分两次云编译
634
629
  if (process.env.UNI_UTS_PLATFORM === 'app-harmony') {
635
630
  const harmonyEnv = {
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import type { OutputOptions, PluginContext, RenderedChunk } from 'rollup';
3
4
  import type { Plugin } from '../plugin';
4
5
  import type { ResolvedConfig } from '../config';
@@ -37,6 +37,7 @@ const shared_1 = require("@vue/shared");
37
37
  const utils_1 = require("../utils");
38
38
  const utils_2 = require("../../../../vite/utils/utils");
39
39
  const utils_3 = require("../../../../utils");
40
+ const x_1 = require("../../../../x");
40
41
  const static_1 = require("./static");
41
42
  exports.assetUrlRE = /__VITE_ASSET__([a-z\d]{8})__(?:\$_(.*?)__)?/g;
42
43
  const rawRE = /(\?|&)raw(?:&|$)/;
@@ -124,7 +125,9 @@ function assetPlugin(config, options) {
124
125
  if (s) {
125
126
  return {
126
127
  code: s.toString(),
127
- map: (0, utils_2.withSourcemap)(config) ? s.generateMap({ hires: true }) : null,
128
+ map: (0, utils_2.withSourcemap)(config)
129
+ ? s.generateMap({ hires: (0, x_1.shouldUseHighResolutionSourceMap)() })
130
+ : null,
128
131
  };
129
132
  }
130
133
  else {
@@ -237,7 +240,9 @@ function assetFileNamesToFileName(assetFileNames, file, contentHash, content) {
237
240
  if ((0, shared_1.isFunction)(assetFileNames)) {
238
241
  assetFileNames = assetFileNames({
239
242
  name: file,
243
+ names: [file],
240
244
  originalFileName: null,
245
+ originalFileNames: [],
241
246
  source: content,
242
247
  type: 'asset',
243
248
  });
@@ -42,6 +42,7 @@ const shared_1 = require("@vue/shared");
42
42
  const preprocess_1 = require("../../../../preprocess");
43
43
  const uniapp_1 = require("../../../../postcss/plugins/uniapp");
44
44
  const cleanString_1 = require("../cleanString");
45
+ const x_1 = require("../../../../x");
45
46
  const constants_1 = require("../../../../constants");
46
47
  const fontFamily_1 = require("../../../../dom2/fontFamily");
47
48
  const utils_2 = require("../../../utils/utils");
@@ -935,6 +936,9 @@ const scss = async (source, root, options, resolvers, isNVue) => {
935
936
  if (err) {
936
937
  reject(err);
937
938
  }
939
+ else if (!res) {
940
+ reject(new Error('Sass render result is empty.'));
941
+ }
938
942
  else {
939
943
  resolve(res);
940
944
  }
@@ -1175,7 +1179,7 @@ async function getSource(source, filename, additionalData, enableSourcemap, sep
1175
1179
  const ms = new magic_string_1.default(source);
1176
1180
  ms.appendLeft(0, sep);
1177
1181
  ms.appendLeft(0, additionalData);
1178
- const map = ms.generateMap({ hires: true });
1182
+ const map = ms.generateMap({ hires: (0, x_1.shouldUseHighResolutionSourceMap)() });
1179
1183
  map.file = filename;
1180
1184
  map.sources = [filename];
1181
1185
  return {
@@ -140,7 +140,7 @@ function getImportsExpressionExp(path, hash, loc, context) {
140
140
  }
141
141
  else {
142
142
  name = `_imports_${context.imports.length}`;
143
- exp = (0, compiler_core_1.createSimpleExpression)(name, false, loc, compiler_core_1.ConstantTypes.CAN_HOIST);
143
+ exp = (0, compiler_core_1.createSimpleExpression)(name, false, loc, compiler_core_1.ConstantTypes.CAN_CACHE);
144
144
  context.imports.push({ exp, path });
145
145
  }
146
146
  if (!hash) {
@@ -154,11 +154,11 @@ function getImportsExpressionExp(path, hash, loc, context) {
154
154
  h.content === hashExp);
155
155
  });
156
156
  if (existingHoistIndex > -1) {
157
- return (0, compiler_core_1.createSimpleExpression)(`_hoisted_${existingHoistIndex + 1}`, false, loc, compiler_core_1.ConstantTypes.CAN_HOIST);
157
+ return (0, compiler_core_1.createSimpleExpression)(`_hoisted_${existingHoistIndex + 1}`, false, loc, compiler_core_1.ConstantTypes.CAN_CACHE);
158
158
  }
159
- return context.hoist((0, compiler_core_1.createSimpleExpression)(hashExp, false, loc, compiler_core_1.ConstantTypes.CAN_HOIST));
159
+ return context.hoist((0, compiler_core_1.createSimpleExpression)(hashExp, false, loc, compiler_core_1.ConstantTypes.CAN_CACHE));
160
160
  }
161
161
  else {
162
- return (0, compiler_core_1.createSimpleExpression)(`''`, false, loc, compiler_core_1.ConstantTypes.CAN_HOIST);
162
+ return (0, compiler_core_1.createSimpleExpression)(`''`, false, loc, compiler_core_1.ConstantTypes.CAN_CACHE);
163
163
  }
164
164
  }
@@ -80,17 +80,17 @@ const transformSrcset = (node, context, options = templateTransformAssetUrl_1.de
80
80
  if (path) {
81
81
  const existingImportsIndex = context.imports.findIndex((i) => i.path === path);
82
82
  if (existingImportsIndex > -1) {
83
- exp = (0, compiler_core_1.createSimpleExpression)(`_imports_${existingImportsIndex}`, false, attr.loc, compiler_core_1.ConstantTypes.CAN_HOIST);
83
+ exp = (0, compiler_core_1.createSimpleExpression)(`_imports_${existingImportsIndex}`, false, attr.loc, compiler_core_1.ConstantTypes.CAN_CACHE);
84
84
  }
85
85
  else {
86
- exp = (0, compiler_core_1.createSimpleExpression)(`_imports_${context.imports.length}`, false, attr.loc, compiler_core_1.ConstantTypes.CAN_HOIST);
86
+ exp = (0, compiler_core_1.createSimpleExpression)(`_imports_${context.imports.length}`, false, attr.loc, compiler_core_1.ConstantTypes.CAN_CACHE);
87
87
  context.imports.push({ exp, path });
88
88
  }
89
89
  compoundExpression.children.push(exp);
90
90
  }
91
91
  }
92
92
  else {
93
- const exp = (0, compiler_core_1.createSimpleExpression)(`"${url}"`, false, attr.loc, compiler_core_1.ConstantTypes.CAN_HOIST);
93
+ const exp = (0, compiler_core_1.createSimpleExpression)(`"${url}"`, false, attr.loc, compiler_core_1.ConstantTypes.CAN_CACHE);
94
94
  compoundExpression.children.push(exp);
95
95
  }
96
96
  const isNotLast = imageCandidates.length - 1 > index;
@@ -105,7 +105,7 @@ const transformSrcset = (node, context, options = templateTransformAssetUrl_1.de
105
105
  }
106
106
  });
107
107
  const hoisted = context.hoist(compoundExpression);
108
- hoisted.constType = compiler_core_1.ConstantTypes.CAN_HOIST;
108
+ hoisted.constType = compiler_core_1.ConstantTypes.CAN_CACHE;
109
109
  node.props[index] = {
110
110
  type: compiler_core_1.NodeTypes.DIRECTIVE,
111
111
  name: 'bind',