@dcloudio/uni-cli-shared 3.0.0-alpha-5000920260515001 → 3.0.0-alpha-5010120260519001

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 (51) hide show
  1. package/dist/dom2/sharedData.js +3 -1
  2. package/dist/dom2/vue.d.ts +2 -0
  3. package/dist/dom2/vue.js +12 -3
  4. package/dist/easycom.d.ts +1 -0
  5. package/dist/easycom.js +10 -0
  6. package/dist/hbx/alias.js +43 -6
  7. package/dist/hbx/log.js +9 -2
  8. package/dist/json/index.d.ts +1 -1
  9. package/dist/json/index.js +2 -1
  10. package/dist/json/uni-x/index.d.ts +6 -0
  11. package/dist/json/uni-x/index.js +54 -1
  12. package/dist/messages/en.d.ts +5 -0
  13. package/dist/messages/en.js +5 -0
  14. package/dist/messages/index.d.ts +10 -0
  15. package/dist/messages/zh_CN.d.ts +5 -0
  16. package/dist/messages/zh_CN.js +5 -0
  17. package/dist/mp/style.js +6 -2
  18. package/dist/uni_modules.cloud.d.ts +2 -1
  19. package/dist/uni_modules.cloud.js +1 -0
  20. package/dist/uts.d.ts +1 -0
  21. package/dist/uts.js +86 -4
  22. package/dist/vite/plugins/stats.js +30 -3
  23. package/dist/vite/plugins/uts/uni_modules.d.ts +1 -1
  24. package/dist/vite/plugins/uts/uni_modules.js +18 -10
  25. package/dist/vite/plugins/vitejs/plugins/css.d.ts +2 -2
  26. package/dist/vite/plugins/vitejs/plugins/css.js +4 -1
  27. package/dist/workers.d.ts +1 -0
  28. package/dist/workers.js +10 -5
  29. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.js +58 -63
  30. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.prod.js +58 -63
  31. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.d.ts +6 -1
  32. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.esm-bundler.js +22 -47
  33. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.js +12 -23
  34. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +12 -22
  35. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +23 -74
  36. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +5 -5
  37. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +3 -20
  38. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.js +310 -363
  39. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.prod.js +5 -5
  40. package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +446 -468
  41. package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.d.ts +33 -11114
  42. package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +1518 -1214
  43. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +951 -562
  44. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.d.ts +435 -325
  45. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +1100 -694
  46. package/lib/dom2/app/@vue/compiler-vapor-dom2/dist/compiler-vapor-dom2.cjs.js +1 -1
  47. package/lib/dom2/app/@vue/shared/dist/shared.cjs.js +16 -25
  48. package/lib/dom2/app/@vue/shared/dist/shared.cjs.prod.js +16 -25
  49. package/lib/dom2/app/@vue/shared/dist/shared.d.ts +5 -0
  50. package/lib/dom2/app/@vue/shared/dist/shared.esm-bundler.js +11 -23
  51. package/package.json +6 -6
@@ -22,7 +22,9 @@ function initSharedDataOptions() {
22
22
  compilerVersion: process.env.HX_Version || process.env.UNI_COMPILER_VERSION,
23
23
  androidOptions: (0, x_1.isUniAppXAndroidJsEngine)()
24
24
  ? {
25
- package: (0, manifest_1.parseUniXAppAndroidPackage)(manifest.appid),
25
+ package: process.env.UNI_COMPILE_TARGET === 'ext-api'
26
+ ? 'io.dcloud.uniapp.extapi'
27
+ : (0, manifest_1.parseUniXAppAndroidPackage)(manifest.appid),
26
28
  }
27
29
  : undefined,
28
30
  };
@@ -6,6 +6,8 @@ export declare function initVueTemplateCompilerExtraOptions(descriptor: SFCDescr
6
6
  filename: string;
7
7
  relativeFilename: string;
8
8
  helper: any;
9
+ enableRootScrollViewTransform: boolean;
10
+ rootScrollView: import("src/json/uni-x").UniXPageOptions | undefined;
9
11
  scriptCppBlocks: any;
10
12
  disableStaticStyle: boolean;
11
13
  onVueTemplateCompileLog(type: 'warn' | 'error', error: CompilerError): void;
package/dist/dom2/vue.js CHANGED
@@ -11,10 +11,16 @@ const vue_1 = require("../vue");
11
11
  function initVueTemplateCompilerExtraOptions(descriptor) {
12
12
  const filename = (0, utils_1.normalizePath)(descriptor.filename.split('?')[0]);
13
13
  const relativeFilename = (0, utils_1.normalizePath)(path_1.default.relative(process.env.UNI_INPUT_DIR, filename));
14
+ const rootScrollView = (0, json_1.parseUniXPageOptions)(filename);
15
+ const componentType = rootScrollView || (0, json_1.isUniPageFile)(filename) ? 'page' : 'component';
14
16
  const isDevX = process.env.UNI_HX_VERSION_DEV === 'true' &&
15
17
  process.env.UNI_APP_X === 'true';
18
+ const isDynamic = process.env.UNI_APP_X_DOM2_DYNAMIC === 'true';
16
19
  let disableStaticStyle = false;
17
- if (isDevX && process.env.NODE_ENV === 'development') {
20
+ if (isDevX &&
21
+ // 动态渲染时,仍旧使用静态样式,避免性能问题。
22
+ !isDynamic &&
23
+ process.env.NODE_ENV === 'development') {
18
24
  if (process.env.UNI_UTS_PLATFORM === 'app-harmony') {
19
25
  // 开发版本、开发模式下,非鸿蒙release模式打包
20
26
  disableStaticStyle = process.env.UNI_APP_HARMONY_RUN_MODE !== 'release';
@@ -24,10 +30,13 @@ function initVueTemplateCompilerExtraOptions(descriptor) {
24
30
  return {
25
31
  root: (0, utils_1.normalizePath)(process.env.UNI_INPUT_DIR),
26
32
  platform: process.env.UNI_UTS_PLATFORM,
27
- componentType: (0, json_1.isUniPageFile)(filename) ? 'page' : 'component',
33
+ componentType,
28
34
  filename: filename,
29
35
  relativeFilename,
30
36
  helper,
37
+ enableRootScrollViewTransform: true,
38
+ // 仅页面透传 rootScrollView,避免非页面组件误触发 ROOT 自动包裹逻辑。
39
+ rootScrollView: componentType === 'page' ? rootScrollView : undefined,
31
40
  scriptCppBlocks: descriptor.scriptCppBlocks,
32
41
  disableStaticStyle,
33
42
  onVueTemplateCompileLog(type, error) {
@@ -35,7 +44,7 @@ function initVueTemplateCompilerExtraOptions(descriptor) {
35
44
  },
36
45
  r: helper.K,
37
46
  className: helper.GCN(descriptor.filename, process.env.UNI_INPUT_DIR),
38
- inlineRender: process.env.UNI_UTS_PLATFORM === 'app-android',
47
+ inlineRender: !isDynamic && process.env.UNI_UTS_PLATFORM === 'app-android',
39
48
  };
40
49
  }
41
50
  exports.initVueTemplateCompilerExtraOptions = initVueTemplateCompilerExtraOptions;
package/dist/easycom.d.ts CHANGED
@@ -11,6 +11,7 @@ export interface EasycomMatcher {
11
11
  name: string;
12
12
  pattern: RegExp;
13
13
  replacement: string;
14
+ dom2IncompatibleFile?: string;
14
15
  }
15
16
  interface EasycomCustom {
16
17
  [key: string]: string;
package/dist/easycom.js CHANGED
@@ -65,6 +65,9 @@ function initEasycoms(inputDir, { dirs, platform, isX, }) {
65
65
  ;
66
66
  globalThis.uts2jsSourceCodeMap.initUts2jsEasycom(easycoms);
67
67
  }
68
+ // UTS / customElements 组件是在 initEasycom 之后补充进去的,
69
+ // 这里补一次状态,避免项目里只有这类组件时被误判为没有 easycom。
70
+ hasEasycom = !!easycoms.length;
68
71
  };
69
72
  const initUTSEasycomCustomElements = () => {
70
73
  (0, uts_1.initUTSCustomElements)(inputDir, platform).forEach((item) => {
@@ -195,6 +198,13 @@ function matchEasycom(tag) {
195
198
  easycomsInvalidCache.add(tag);
196
199
  return false;
197
200
  }
201
+ // dom2 不支持旧版 uni-app 兼容模式组件,这里在 easycom 真正命中时再报错,
202
+ // 避免扫描阶段就对未使用的插件组件产生误报。
203
+ if (process.env.UNI_APP_X_DOM2 === 'true' && matcher.dom2IncompatibleFile) {
204
+ throw new Error(messages_1.M['dom2.compatible.component']
205
+ .replace('{name}', `<${tag}>`)
206
+ .replace('{file}', matcher.dom2IncompatibleFile));
207
+ }
198
208
  source = tag.replace(matcher.pattern, matcher.replacement);
199
209
  easycomsCache.set(tag, source);
200
210
  debugEasycom('matchEasycom', tag, source);
package/dist/hbx/alias.js CHANGED
@@ -27,6 +27,7 @@ function initModuleAlias() {
27
27
  process.env.UNI_APP_X_DOM2_CPP_DIR =
28
28
  process.env.UNI_APP_HARMONY_DOM2_CPP_DIR;
29
29
  }
30
+ // TODO 等待正式对外推出后,删除这个兼容逻辑
30
31
  if (process.env.UNI_APP_PLATFORM === 'ios' ||
31
32
  process.env.UNI_APP_PLATFORM === 'android') {
32
33
  if (process.env.UNI_INPUT_DIR) {
@@ -49,14 +50,24 @@ function initModuleAlias() {
49
50
  process.env.UNI_PLATFORM === 'app-plus' ||
50
51
  process.env.UNI_PLATFORM === 'app-harmony')) {
51
52
  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;
53
+ let baseDir = '';
54
+ const isAndroid = process.env.UNI_APP_PLATFORM === 'android';
55
+ const isIOS = process.env.UNI_APP_PLATFORM === 'ios';
56
+ if (process.env.NODE_ENV !== 'development' && (isAndroid || isIOS)) {
57
+ baseDir = path_1.default.resolve(process.env.UNI_OUTPUT_DIR, '.uniappx', isAndroid ? 'android' : 'ios');
58
+ }
59
+ else {
60
+ baseDir =
61
+ process.env.UNI_PLATFORM === 'app-harmony'
62
+ ? process.env.UNI_OUTPUT_DIR
63
+ : process.env.UNI_APP_X_CACHE_DIR || process.env.UNI_OUTPUT_DIR;
64
+ }
55
65
  process.env.UNI_APP_X_DOM2_CPP_DIR = path_1.default.resolve(baseDir, 'cpp');
66
+ process.env.UNI_APP_X_DOM2_SO_DIR = path_1.default.resolve(baseDir, 'so');
56
67
  }
57
68
  if (!process.env.UNI_APP_X_DOM2_KT_DIR) {
58
69
  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');
70
+ process.env.UNI_APP_X_DOM2_KT_DIR = path_1.default.resolve(process.env.UNI_OUTPUT_DIR, '.uniappx/android', 'src');
60
71
  }
61
72
  else {
62
73
  process.env.UNI_APP_X_DOM2_KT_DIR = path_1.default.resolve(process.env.UNI_APP_X_CACHE_DIR ||
@@ -66,10 +77,36 @@ function initModuleAlias() {
66
77
  }
67
78
  if (process.env.UNI_APP_PLATFORM ||
68
79
  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)) {
80
+ if (!process.env.UNI_APP_X_VAPOR_RENDER_TARGET) {
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
+ }
102
+ }
103
+ if (process.env.UNI_APP_X_VAPOR_RENDER_TARGET?.includes('bytecode')) {
71
104
  process.env.UNI_APP_X_DOM2_DYNAMIC = 'true';
72
105
  }
106
+ // 如果是 ext-api 目标,强制使用 nativecode 目标
107
+ if (process.env.UNI_COMPILE_TARGET === 'ext-api') {
108
+ delete process.env.UNI_APP_X_DOM2_DYNAMIC;
109
+ }
73
110
  }
74
111
  }
75
112
  if (process.env.UNI_APP_X_DOM2 === 'true') {
package/dist/hbx/log.js CHANGED
@@ -10,9 +10,10 @@ const picocolors_1 = __importDefault(require("picocolors"));
10
10
  const compiler_core_1 = require("@vue/compiler-core");
11
11
  const shared_1 = require("@vue/shared");
12
12
  const utils_1 = require("../utils");
13
+ const utils_2 = require("./utils");
13
14
  const constants_1 = require("../constants");
14
15
  const ast_1 = require("../vite/utils/ast");
15
- const utils_2 = require("../vite/plugins/vitejs/utils");
16
+ const utils_3 = require("../vite/plugins/vitejs/utils");
16
17
  const SIGNAL_H5_LOCAL = ' ➜ Local:';
17
18
  const SIGNAL_H5_NETWORK = ' ➜ Network:';
18
19
  const networkLogs = [];
@@ -29,6 +30,12 @@ function overridedConsole(name, oldFn, char) {
29
30
  console[name] = function (...args) {
30
31
  oldFn.apply(this, args.map((arg) => {
31
32
  let item;
33
+ if ((0, utils_2.isInHBuilderX)() && typeof arg === 'string' && arg.includes('\n')) {
34
+ arg = arg
35
+ .split('\n')
36
+ .map((line) => `${char}${line}${char}`)
37
+ .join('\n');
38
+ }
32
39
  if (typeof arg !== 'object') {
33
40
  item = `${char}${arg}${char}`;
34
41
  }
@@ -200,7 +207,7 @@ function buildErrorMessage(err, args = [], includeStack = true) {
200
207
  const scriptNode = ast.children.find((node) => node.type === compiler_core_1.NodeTypes.ELEMENT && node.tag === 'script');
201
208
  if (scriptNode) {
202
209
  const scriptLoc = scriptNode.loc;
203
- args.push(picocolors_1.default.yellow(pad((0, utils_2.generateCodeFrame)(scriptLoc.source, err.loc))));
210
+ args.push(picocolors_1.default.yellow(pad((0, utils_3.generateCodeFrame)(scriptLoc.source, err.loc))));
204
211
  // correct error location
205
212
  err.loc.line = scriptLoc.start.line + err.loc.line - 1;
206
213
  }
@@ -4,5 +4,5 @@ export * from './json';
4
4
  export * from './pages';
5
5
  export * from './manifest';
6
6
  export * from './theme';
7
- export { normalizeUniAppXAppPagesJson, normalizeUniAppXAppConfig, parseUniXFlexDirection, parseUniXSplashScreen, isUniXPageFile, getUniXPagePaths, parseUniXAppAndroidPackage, } from './uni-x';
7
+ export { normalizeUniAppXAppPagesJson, normalizeUniAppXAppConfig, parseUniXPageOptions, parseUniXFlexDirection, parseUniXSplashScreen, isUniXPageFile, getUniXPagePaths, parseUniXAppAndroidPackage, } from './uni-x';
8
8
  export { checkPagesJson } from './utils';
@@ -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.checkPagesJson = exports.parseUniXAppAndroidPackage = exports.getUniXPagePaths = exports.isUniXPageFile = exports.parseUniXSplashScreen = exports.parseUniXFlexDirection = exports.normalizeUniAppXAppConfig = exports.normalizeUniAppXAppPagesJson = void 0;
17
+ exports.checkPagesJson = exports.parseUniXAppAndroidPackage = exports.getUniXPagePaths = exports.isUniXPageFile = exports.parseUniXSplashScreen = exports.parseUniXFlexDirection = exports.parseUniXPageOptions = exports.normalizeUniAppXAppConfig = exports.normalizeUniAppXAppPagesJson = void 0;
18
18
  __exportStar(require("./mp"), exports);
19
19
  __exportStar(require("./app"), exports);
20
20
  __exportStar(require("./json"), exports);
@@ -24,6 +24,7 @@ __exportStar(require("./theme"), exports);
24
24
  var uni_x_1 = require("./uni-x");
25
25
  Object.defineProperty(exports, "normalizeUniAppXAppPagesJson", { enumerable: true, get: function () { return uni_x_1.normalizeUniAppXAppPagesJson; } });
26
26
  Object.defineProperty(exports, "normalizeUniAppXAppConfig", { enumerable: true, get: function () { return uni_x_1.normalizeUniAppXAppConfig; } });
27
+ Object.defineProperty(exports, "parseUniXPageOptions", { enumerable: true, get: function () { return uni_x_1.parseUniXPageOptions; } });
27
28
  Object.defineProperty(exports, "parseUniXFlexDirection", { enumerable: true, get: function () { return uni_x_1.parseUniXFlexDirection; } });
28
29
  Object.defineProperty(exports, "parseUniXSplashScreen", { enumerable: true, get: function () { return uni_x_1.parseUniXSplashScreen; } });
29
30
  Object.defineProperty(exports, "isUniXPageFile", { enumerable: true, get: function () { return uni_x_1.isUniXPageFile; } });
@@ -1,5 +1,11 @@
1
1
  export * from './manifest';
2
+ export interface UniXPageOptions {
3
+ disableScroll?: boolean;
4
+ enablePullDownRefresh?: boolean;
5
+ scrollIndicator?: 'none';
6
+ }
2
7
  export declare function normalizeUniAppXAppPagesJson(jsonStr: string): UniApp.PagesJson;
8
+ export declare function parseUniXPageOptions(filename: string): UniXPageOptions | undefined;
3
9
  /**
4
10
  * TODO 应该闭包,通过globalThis赋值?
5
11
  * @param pagesJson
@@ -17,7 +17,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.getUniXPagePaths = exports.isUniXPageFile = exports.normalizeUniAppXAppConfig = exports.normalizeUniAppXAppPagesJson = void 0;
20
+ exports.getUniXPagePaths = exports.isUniXPageFile = exports.normalizeUniAppXAppConfig = exports.parseUniXPageOptions = exports.normalizeUniAppXAppPagesJson = void 0;
21
+ const fs_1 = __importDefault(require("fs"));
21
22
  const path_1 = __importDefault(require("path"));
22
23
  const shared_1 = require("@vue/shared");
23
24
  const json_1 = require("../json");
@@ -28,6 +29,7 @@ const uniConfig_1 = require("./uniConfig");
28
29
  const preprocess_1 = require("../../preprocess");
29
30
  const utils_2 = require("../utils");
30
31
  __exportStar(require("./manifest"), exports);
32
+ const uniXPageOptionsCache = new Map();
31
33
  function normalizeUniAppXAppPagesJson(jsonStr) {
32
34
  // 先条件编译
33
35
  jsonStr = (0, preprocess_1.preUVueJson)(jsonStr, 'pages.json');
@@ -77,9 +79,60 @@ function normalizeUniAppXAppPagesJson(jsonStr) {
77
79
  // 缓存页面列表
78
80
  pages_1.pagesCacheSet.clear();
79
81
  pagesJson.pages.forEach((page) => pages_1.pagesCacheSet.add(page.path));
82
+ updateUniXPageOptions(pagesJson);
80
83
  return pagesJson;
81
84
  }
82
85
  exports.normalizeUniAppXAppPagesJson = normalizeUniAppXAppPagesJson;
86
+ function updateUniXPageOptions(pagesJson) {
87
+ const inputDir = getUniXInputDir();
88
+ if (!inputDir) {
89
+ return;
90
+ }
91
+ const pageOptions = new Map();
92
+ pagesJson.pages.forEach((page) => {
93
+ pageOptions.set(page.path, normalizeRootPageOptions(page.style));
94
+ });
95
+ uniXPageOptionsCache.set(inputDir, pageOptions);
96
+ }
97
+ function normalizeRootPageOptions(pageStyle) {
98
+ if (!pageStyle) {
99
+ return {};
100
+ }
101
+ return {
102
+ disableScroll: pageStyle.disableScroll === true || undefined,
103
+ enablePullDownRefresh: isEnablePullDownRefresh(pageStyle) || undefined,
104
+ scrollIndicator: pageStyle.scrollIndicator,
105
+ };
106
+ }
107
+ function initUniXPageOptions() {
108
+ const inputDir = getUniXInputDir();
109
+ if (!inputDir || uniXPageOptionsCache.has(inputDir)) {
110
+ return;
111
+ }
112
+ const filename = path_1.default.resolve(inputDir, 'pages.json');
113
+ if (!fs_1.default.existsSync(filename)) {
114
+ return;
115
+ }
116
+ normalizeUniAppXAppPagesJson(fs_1.default.readFileSync(filename, 'utf8'));
117
+ }
118
+ function isEnablePullDownRefresh(pageStyle) {
119
+ return pageStyle.enablePullDownRefresh || pageStyle.pullToRefresh?.support;
120
+ }
121
+ function parseUniXPageOptions(filename) {
122
+ initUniXPageOptions();
123
+ const inputDir = getUniXInputDir();
124
+ if (!inputDir) {
125
+ return;
126
+ }
127
+ const pagePath = (0, utils_1.removeExt)((0, utils_1.normalizePath)(path_1.default.relative(inputDir, filename.split('?')[0])));
128
+ return uniXPageOptionsCache.get(inputDir)?.get(pagePath);
129
+ }
130
+ exports.parseUniXPageOptions = parseUniXPageOptions;
131
+ function getUniXInputDir() {
132
+ return process.env.UNI_INPUT_DIR
133
+ ? (0, utils_1.normalizePath)(process.env.UNI_INPUT_DIR)
134
+ : undefined;
135
+ }
83
136
  function normalizeSubPackages(subPackages) {
84
137
  const pages = [];
85
138
  if ((0, shared_1.isArray)(subPackages)) {
@@ -1,5 +1,8 @@
1
1
  declare const _default: {
2
2
  readonly 'app.compiler.version': "Compiler version: {version}";
3
+ readonly 'view.render.compiler.target': "Current view.render compile target: {target}";
4
+ readonly 'view.render.compiler.target.bytecode': "bytecode";
5
+ readonly 'view.render.compiler.target.nativecode': "nativecode";
3
6
  readonly 'style.isolation.version': "Style isolation version: {version}";
4
7
  readonly compiling: "Compiling...";
5
8
  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.";
@@ -12,6 +15,7 @@ declare const _default: {
12
15
  readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
13
16
  readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
14
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}.";
15
19
  readonly 'build.failed': "DONE Build failed.";
16
20
  readonly 'compiler.build.failed': "Build failed with errors.";
17
21
  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";
@@ -20,6 +24,7 @@ declare const _default: {
20
24
  readonly 'i18n.fallbackLocale.default': "fallbackLocale is missing in manifest.json, use: {locale}";
21
25
  readonly 'i18n.fallbackLocale.missing': "./local/{locale}.json is missing";
22
26
  readonly 'easycom.conflict': "easycom component conflict: ";
27
+ readonly 'dom2.compatible.component': "Vapor mode does not support the uni-app compatibility component {name}. The implementation file {file} was detected. Please use the standard UTS component implementation for this purpose.";
23
28
  readonly 'mp.component.args[0]': "The first parameter of {0} must be a static string";
24
29
  readonly 'mp.component.args[1]': "{0} requires two parameters";
25
30
  readonly 'mp.360.unsupported': "360 is unsupported";
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  'app.compiler.version': 'Compiler version: {version}',
5
+ 'view.render.compiler.target': 'Current view.render compile target: {target}',
6
+ 'view.render.compiler.target.bytecode': 'bytecode',
7
+ 'view.render.compiler.target.nativecode': 'nativecode',
5
8
  'style.isolation.version': 'Style isolation version: {version}',
6
9
  compiling: 'Compiling...',
7
10
  '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.',
@@ -14,6 +17,7 @@ exports.default = {
14
17
  'dev.watching.end.pages': 'DONE Build complete. PAGES:{pages}',
15
18
  'dev.watching.end.files': 'DONE Build complete. FILES:{files}',
16
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}.',
17
21
  'build.failed': 'DONE Build failed.',
18
22
  'compiler.build.failed': 'Build failed with errors.',
19
23
  '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,6 +26,7 @@ exports.default = {
22
26
  'i18n.fallbackLocale.default': 'fallbackLocale is missing in manifest.json, use: {locale}',
23
27
  'i18n.fallbackLocale.missing': './local/{locale}.json is missing',
24
28
  'easycom.conflict': 'easycom component conflict: ',
29
+ 'dom2.compatible.component': 'Vapor mode does not support the uni-app compatibility component {name}. The implementation file {file} was detected. Please use the standard UTS component implementation for this purpose.',
25
30
  'mp.component.args[0]': 'The first parameter of {0} must be a static string',
26
31
  'mp.component.args[1]': '{0} requires two parameters',
27
32
  'mp.360.unsupported': '360 is unsupported',
@@ -1,5 +1,8 @@
1
1
  export declare const M: {
2
2
  readonly 'app.compiler.version': "编译器版本:{version}";
3
+ readonly 'view.render.compiler.target': "当前视图层编译目标:{target}";
4
+ readonly 'view.render.compiler.target.bytecode': "字节码";
5
+ readonly 'view.render.compiler.target.nativecode': "机器码";
3
6
  readonly 'style.isolation.version': "当前样式隔离策略:{version}。详见:https://doc.dcloud.net.cn/uni-app-x/css/common/style-isolation.html";
4
7
  readonly compiling: "正在编译中...";
5
8
  readonly 'dev.performance': "请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。";
@@ -12,6 +15,7 @@ export declare const M: {
12
15
  readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
13
16
  readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
14
17
  readonly 'dev.watching.restart.vapor': "DONE Restart required. 切换蒸汽模式需要重新运行才能生效。";
18
+ readonly 'dev.watching.vapor.render.target': "manifest.json 中更改了视图层编译目标为{manifestTarget},但注意运行控制台还是{runtimeTarget}。";
15
19
  readonly 'build.failed': "DONE Build failed.";
16
20
  readonly 'compiler.build.failed': "编译失败";
17
21
  readonly 'stat.warn.appid': "当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303";
@@ -20,6 +24,7 @@ export declare const M: {
20
24
  readonly 'i18n.fallbackLocale.default': "当前应用未在 manifest.json 配置 fallbackLocale,默认使用:{locale}";
21
25
  readonly 'i18n.fallbackLocale.missing': "当前应用配置的 fallbackLocale 或 locale 为:{locale},但 locale 目录缺少该语言文件";
22
26
  readonly 'easycom.conflict': "easycom组件冲突:";
27
+ readonly 'dom2.compatible.component': "蒸汽模式不支持 uni-app 兼容模式组件 {name},检测到其实现文件为 {file}。请改用标准模式的UTS组件实现来实现。";
23
28
  readonly 'mp.component.args[0]': "{0}的第一个参数必须为静态字符串";
24
29
  readonly 'mp.component.args[1]': "{0}需要两个参数";
25
30
  readonly 'mp.360.unsupported': "vue3暂不支持360小程序";
@@ -52,6 +57,9 @@ export declare const M: {
52
57
  readonly 'pages.json.tabbar.page.notfound': "tabBar 中配置的页面 \"{pagePath}\" 未在 pages.json 中注册。";
53
58
  } | {
54
59
  readonly 'app.compiler.version': "Compiler version: {version}";
60
+ readonly 'view.render.compiler.target': "Current view.render compile target: {target}";
61
+ readonly 'view.render.compiler.target.bytecode': "bytecode";
62
+ readonly 'view.render.compiler.target.nativecode': "nativecode";
55
63
  readonly 'style.isolation.version': "Style isolation version: {version}";
56
64
  readonly compiling: "Compiling...";
57
65
  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.";
@@ -64,6 +72,7 @@ export declare const M: {
64
72
  readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
65
73
  readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
66
74
  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}.";
67
76
  readonly 'build.failed': "DONE Build failed.";
68
77
  readonly 'compiler.build.failed': "Build failed with errors.";
69
78
  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";
@@ -72,6 +81,7 @@ export declare const M: {
72
81
  readonly 'i18n.fallbackLocale.default': "fallbackLocale is missing in manifest.json, use: {locale}";
73
82
  readonly 'i18n.fallbackLocale.missing': "./local/{locale}.json is missing";
74
83
  readonly 'easycom.conflict': "easycom component conflict: ";
84
+ readonly 'dom2.compatible.component': "Vapor mode does not support the uni-app compatibility component {name}. The implementation file {file} was detected. Please use the standard UTS component implementation for this purpose.";
75
85
  readonly 'mp.component.args[0]': "The first parameter of {0} must be a static string";
76
86
  readonly 'mp.component.args[1]': "{0} requires two parameters";
77
87
  readonly 'mp.360.unsupported': "360 is unsupported";
@@ -1,5 +1,8 @@
1
1
  declare const _default: {
2
2
  readonly 'app.compiler.version': "编译器版本:{version}";
3
+ readonly 'view.render.compiler.target': "当前视图层编译目标:{target}";
4
+ readonly 'view.render.compiler.target.bytecode': "字节码";
5
+ readonly 'view.render.compiler.target.nativecode': "机器码";
3
6
  readonly 'style.isolation.version': "当前样式隔离策略:{version}。详见:https://doc.dcloud.net.cn/uni-app-x/css/common/style-isolation.html";
4
7
  readonly compiling: "正在编译中...";
5
8
  readonly 'dev.performance': "请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。";
@@ -12,6 +15,7 @@ declare const _default: {
12
15
  readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
13
16
  readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
14
17
  readonly 'dev.watching.restart.vapor': "DONE Restart required. 切换蒸汽模式需要重新运行才能生效。";
18
+ readonly 'dev.watching.vapor.render.target': "manifest.json 中更改了视图层编译目标为{manifestTarget},但注意运行控制台还是{runtimeTarget}。";
15
19
  readonly 'build.failed': "DONE Build failed.";
16
20
  readonly 'compiler.build.failed': "编译失败";
17
21
  readonly 'stat.warn.appid': "当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303";
@@ -20,6 +24,7 @@ declare const _default: {
20
24
  readonly 'i18n.fallbackLocale.default': "当前应用未在 manifest.json 配置 fallbackLocale,默认使用:{locale}";
21
25
  readonly 'i18n.fallbackLocale.missing': "当前应用配置的 fallbackLocale 或 locale 为:{locale},但 locale 目录缺少该语言文件";
22
26
  readonly 'easycom.conflict': "easycom组件冲突:";
27
+ readonly 'dom2.compatible.component': "蒸汽模式不支持 uni-app 兼容模式组件 {name},检测到其实现文件为 {file}。请改用标准模式的UTS组件实现来实现。";
23
28
  readonly 'mp.component.args[0]': "{0}的第一个参数必须为静态字符串";
24
29
  readonly 'mp.component.args[1]': "{0}需要两个参数";
25
30
  readonly 'mp.360.unsupported': "vue3暂不支持360小程序";
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  'app.compiler.version': '编译器版本:{version}',
5
+ 'view.render.compiler.target': '当前视图层编译目标:{target}',
6
+ 'view.render.compiler.target.bytecode': '字节码',
7
+ 'view.render.compiler.target.nativecode': '机器码',
5
8
  'style.isolation.version': '当前样式隔离策略:{version}。详见:https://doc.dcloud.net.cn/uni-app-x/css/common/style-isolation.html',
6
9
  compiling: '正在编译中...',
7
10
  'dev.performance': '请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。',
@@ -14,6 +17,7 @@ exports.default = {
14
17
  'dev.watching.end.pages': 'DONE Build complete. PAGES:{pages}',
15
18
  'dev.watching.end.files': 'DONE Build complete. FILES:{files}',
16
19
  'dev.watching.restart.vapor': 'DONE Restart required. 切换蒸汽模式需要重新运行才能生效。',
20
+ 'dev.watching.vapor.render.target': 'manifest.json 中更改了视图层编译目标为{manifestTarget},但注意运行控制台还是{runtimeTarget}。',
17
21
  'build.failed': 'DONE Build failed.',
18
22
  'compiler.build.failed': '编译失败',
19
23
  'stat.warn.appid': '当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303',
@@ -22,6 +26,7 @@ exports.default = {
22
26
  'i18n.fallbackLocale.default': '当前应用未在 manifest.json 配置 fallbackLocale,默认使用:{locale}',
23
27
  'i18n.fallbackLocale.missing': '当前应用配置的 fallbackLocale 或 locale 为:{locale},但 locale 目录缺少该语言文件',
24
28
  'easycom.conflict': 'easycom组件冲突:',
29
+ 'dom2.compatible.component': '蒸汽模式不支持 uni-app 兼容模式组件 {name},检测到其实现文件为 {file}。请改用标准模式的UTS组件实现来实现。',
25
30
  'mp.component.args[0]': '{0}的第一个参数必须为静态字符串',
26
31
  'mp.component.args[1]': '{0}需要两个参数',
27
32
  'mp.360.unsupported': 'vue3暂不支持360小程序',
package/dist/mp/style.js CHANGED
@@ -4,6 +4,7 @@ exports.transformPartSelector = exports.transformScopedCss = void 0;
4
4
  const tags_1 = require("./tags");
5
5
  const logs_1 = require("../logs");
6
6
  const uni_shared_1 = require("@dcloudio/uni-shared");
7
+ const HTML_TAG_SELECTOR_RE = new RegExp(`/\\*[\\s\\S]*?(?:\\*/|$)|[\\s,}](${Object.keys(tags_1.HTML_TO_MINI_PROGRAM_TAGS).join('|')})\\s*(?=,|\\{)`, 'g');
7
8
  function transformScopedCss(cssCode) {
8
9
  checkHtmlTagSelector(cssCode);
9
10
  return cssCode.replace(/\[(data-v-[a-f0-9]{8})\]/gi, (_, scopedId) => {
@@ -18,8 +19,11 @@ function transformPartSelector(cssCode) {
18
19
  }
19
20
  exports.transformPartSelector = transformPartSelector;
20
21
  function checkHtmlTagSelector(cssCode) {
21
- for (const tag in tags_1.HTML_TO_MINI_PROGRAM_TAGS) {
22
- if (new RegExp(`( |\n|\t|,|})${tag}( *)(,|{)`, 'g').test(cssCode)) {
22
+ HTML_TAG_SELECTOR_RE.lastIndex = 0;
23
+ let match;
24
+ while ((match = HTML_TAG_SELECTOR_RE.exec(cssCode))) {
25
+ const tag = match[1];
26
+ if (tag) {
23
27
  (0, logs_1.output)('warn', `小程序端 style 暂不支持 ${tag} 标签选择器,推荐使用 class 选择器,详情参考:https://uniapp.dcloud.net.cn/tutorial/migration-to-vue3.html#style`);
24
28
  break;
25
29
  }
@@ -32,6 +32,7 @@ export interface EncryptPackageJson {
32
32
  dependencies: string[];
33
33
  artifacts: {
34
34
  env: {
35
+ vapor: boolean;
35
36
  compilerVersion: string;
36
37
  } & Record<string, any>;
37
38
  apis: string[];
@@ -45,7 +46,7 @@ export interface EncryptPackageJson {
45
46
  };
46
47
  };
47
48
  }
48
- export declare function initCheckEnv(): Record<string, string>;
49
+ export declare function initCheckEnv(): Record<string, unknown>;
49
50
  export declare function resolveEncryptUniModule(id: string, platform: typeof process.env.UNI_UTS_PLATFORM, isX?: boolean): string | undefined;
50
51
  type CloudCompileSdkType = 'utssdk' | 'easycom' | 'all';
51
52
  export interface CloudCompileParams {
@@ -323,6 +323,7 @@ function findUniModuleFiles(platform, id, inputDir) {
323
323
  function initCheckEnv() {
324
324
  return {
325
325
  // 云端编译的版本号不带日期及小版本
326
+ vapor: process.env.UNI_APP_X_DOM2 === 'true',
326
327
  compilerVersion: process.env.UNI_COMPILER_VERSION,
327
328
  };
328
329
  }
package/dist/uts.d.ts CHANGED
@@ -11,6 +11,7 @@ import type { EasycomMatcher } from './easycom';
11
11
  */
12
12
  export declare function resolveUTSAppModule(platform: typeof process.env.UNI_UTS_PLATFORM, id: string, importer: string, includeUTSSDK?: boolean): string | undefined;
13
13
  export declare function resolveUTSModule(id: string, importer: string, includeUTSSDK?: boolean): string | undefined;
14
+ export declare function hasUTSModulePlatformFile(pluginDir: string, platform: typeof process.env.UNI_UTS_PLATFORM): boolean;
14
15
  export declare function resolveUTSCompiler(throwError?: boolean): typeof UTSCompiler;
15
16
  export declare function resolveUTSCompilerVersion(): string;
16
17
  interface UTSComponentMeta {