@dcloudio/uni-cli-shared 3.0.0-alpha-5010120260522001 → 3.0.0-alpha-1000920260525733

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 (45) hide show
  1. package/dist/hbx/alias.js +21 -2
  2. package/dist/json/app/pages/definePage.js +1 -1
  3. package/dist/logs/console.js +4 -1
  4. package/dist/messages/en.d.ts +0 -1
  5. package/dist/messages/en.js +0 -1
  6. package/dist/messages/index.d.ts +0 -2
  7. package/dist/messages/zh_CN.d.ts +0 -1
  8. package/dist/messages/zh_CN.js +0 -1
  9. package/dist/vite/cloud.js +2 -0
  10. package/dist/vite/plugins/console.js +2 -1
  11. package/dist/vite/plugins/inject.js +7 -2
  12. package/dist/vite/plugins/sfc.js +4 -1
  13. package/dist/vite/plugins/stats.js +0 -26
  14. package/dist/vite/plugins/vitejs/plugins/asset.d.ts +1 -0
  15. package/dist/vite/plugins/vitejs/plugins/asset.js +6 -1
  16. package/dist/vite/plugins/vitejs/plugins/css.js +5 -1
  17. package/dist/vue/transforms/x/transformDirection.js +4 -33
  18. package/dist/watcher.d.ts +1 -0
  19. package/dist/x.d.ts +1 -0
  20. package/dist/x.js +5 -1
  21. package/lib/@vue/compiler-core/dist/compiler-core.cjs.js +16 -23
  22. package/lib/@vue/compiler-core/dist/compiler-core.cjs.prod.js +16 -23
  23. package/lib/@vue/compiler-core/dist/compiler-core.esm-bundler.js +16 -23
  24. package/lib/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +23 -66
  25. package/lib/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +67 -115
  26. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.js +1 -1
  27. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.prod.js +1 -1
  28. package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.esm-bundler.js +1 -1
  29. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.js +1 -1
  30. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +1 -1
  31. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +1 -1
  32. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +1 -1
  33. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +1 -1
  34. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.js +1 -1
  35. package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.prod.js +1 -1
  36. package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +3 -3
  37. package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +43 -201
  38. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +41 -199
  39. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.d.ts +12 -50
  40. package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +42 -212
  41. package/lib/dom2/app/@vue/compiler-vapor-dom2/dist/compiler-vapor-dom2.cjs.js +1 -1
  42. package/lib/dom2/app/@vue/shared/dist/shared.cjs.js +1 -1
  43. package/lib/dom2/app/@vue/shared/dist/shared.cjs.prod.js +1 -1
  44. package/lib/dom2/app/@vue/shared/dist/shared.esm-bundler.js +1 -1
  45. package/package.json +7 -8
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';
@@ -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,7 +15,6 @@ 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";
@@ -17,7 +17,6 @@ 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',
@@ -15,7 +15,6 @@ 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";
@@ -72,7 +71,6 @@ 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";
@@ -15,7 +15,6 @@ 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";
@@ -17,7 +17,6 @@ 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',
@@ -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']);
@@ -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 {
@@ -4,7 +4,6 @@ exports.transformDirection = void 0;
4
4
  const vite_1 = require("../../../vite");
5
5
  const utils_1 = require("../../utils");
6
6
  const compiler_core_1 = require("@vue/compiler-core");
7
- const shared_1 = require("@vue/shared");
8
7
  /**
9
8
  * 将direction属性转化为scroll-x和scroll-y
10
9
  * 注意transformMPBuiltInTag内会讲list-view转化为scroll-view,所以此transform应该在transformMPBuiltInTag之后执行
@@ -28,7 +27,7 @@ const transformDirection = function (node, context) {
28
27
  return;
29
28
  }
30
29
  const directionProp = node.props[directionPropIndex];
31
- if ((0, vite_1.isAttributeNode)(directionProp)) {
30
+ if (directionProp.type === compiler_core_1.NodeTypes.ATTRIBUTE) {
32
31
  const directionValue = directionProp.value?.content;
33
32
  const scrollX = directionValue === 'horizontal' || directionValue === 'all';
34
33
  const scrollY = !directionValue ||
@@ -40,16 +39,12 @@ const transformDirection = function (node, context) {
40
39
  }
41
40
  else if (directionProp.type === compiler_core_1.NodeTypes.DIRECTIVE) {
42
41
  if (!directionProp.arg ||
43
- !(0, vite_1.isSimpleExpressionNode)(directionProp.arg) ||
42
+ directionProp.arg.type !== compiler_core_1.NodeTypes.SIMPLE_EXPRESSION ||
44
43
  !directionProp.exp ||
45
- !((0, vite_1.isSimpleExpressionNode)(directionProp.exp) ||
46
- (0, vite_1.isCompoundExpressionNode)(directionProp.exp))) {
47
- return;
48
- }
49
- const exp = stringifyExpression(directionProp.exp);
50
- if (!exp) {
44
+ directionProp.exp.type !== compiler_core_1.NodeTypes.SIMPLE_EXPRESSION) {
51
45
  return;
52
46
  }
47
+ const exp = directionProp.exp.content;
53
48
  const scrollX = `(${exp}) === 'horizontal' || (${exp}) === 'all'`;
54
49
  const scrollY = `!(${exp}) || (${exp}) === 'vertical' || (${exp}) === 'all'`;
55
50
  node.props.splice(directionPropIndex, 1);
@@ -58,27 +53,3 @@ const transformDirection = function (node, context) {
58
53
  }
59
54
  };
60
55
  exports.transformDirection = transformDirection;
61
- function stringifyExpression(exp) {
62
- if ((0, vite_1.isSimpleExpressionNode)(exp)) {
63
- return exp.content;
64
- }
65
- if ((0, vite_1.isCompoundExpressionNode)(exp)) {
66
- const children = [];
67
- for (const child of exp.children) {
68
- if ((0, shared_1.isString)(child)) {
69
- children.push(child);
70
- }
71
- else if ((0, shared_1.isSymbol)(child)) {
72
- return;
73
- }
74
- else {
75
- const content = stringifyExpression(child);
76
- if (content === undefined) {
77
- return;
78
- }
79
- children.push(content);
80
- }
81
- }
82
- return children.join('');
83
- }
84
- }
package/dist/watcher.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { type FSWatcher, type WatchOptions } from 'chokidar';
3
4
  type FileTransform = (source: Buffer, filename: string) => void | string;
4
5
  export interface FileWatcherOptions {
package/dist/x.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare function isUniAppX(): boolean;
3
3
  export declare function isUniAppXAndroid(platform?: AppXPlatform): boolean;
4
4
  export declare function isUniAppXIOS(platform?: AppXPlatform): boolean;
5
5
  export declare function isUniAppXVapor(): boolean;
6
+ export declare function shouldUseHighResolutionSourceMap(): boolean;
6
7
  export declare function isUniAppXAndroidVapor(platform?: AppXPlatform): boolean;
7
8
  export declare function isUniAppXJsEngine(): boolean;
8
9
  export declare function isUniAppXAndroidJsEngine(platform?: AppXPlatform): boolean;
package/dist/x.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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;
3
+ exports.isUniAppXAndroidNative = exports.isUniAppXAndroidJsEngine = exports.isUniAppXJsEngine = exports.isUniAppXAndroidVapor = exports.shouldUseHighResolutionSourceMap = exports.isUniAppXVapor = exports.isUniAppXIOS = exports.isUniAppXAndroid = exports.isUniAppX = void 0;
4
4
  function isUniAppX() {
5
5
  return process.env.UNI_APP_X === 'true';
6
6
  }
@@ -17,6 +17,10 @@ function isUniAppXVapor() {
17
17
  return isUniAppX() && process.env.UNI_APP_X_DOM2 === 'true';
18
18
  }
19
19
  exports.isUniAppXVapor = isUniAppXVapor;
20
+ function shouldUseHighResolutionSourceMap() {
21
+ return !(process.env.NODE_ENV === 'development' && isUniAppXVapor());
22
+ }
23
+ exports.shouldUseHighResolutionSourceMap = shouldUseHighResolutionSourceMap;
20
24
  function isUniAppXAndroidVapor(platform = process.env.UNI_UTS_PLATFORM) {
21
25
  return isUniAppXAndroid(platform) && process.env.UNI_APP_X_DOM2 === 'true';
22
26
  }
@@ -374,12 +374,6 @@ function convertToBlock(node, { helper, removeHelper, inSSR }) {
374
374
  }
375
375
  }
376
376
 
377
- var __defProp = Object.defineProperty;
378
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
379
- var __publicField = (obj, key, value) => {
380
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
381
- return value;
382
- };
383
377
  const defaultDelimitersOpen = new Uint8Array([123, 123]);
384
378
  const defaultDelimitersClose = new Uint8Array([125, 125]);
385
379
  function isTagStartChar(c) {
@@ -430,32 +424,31 @@ class Tokenizer {
430
424
  this.stack = stack;
431
425
  this.cbs = cbs;
432
426
  /** The current state the tokenizer is in. */
433
- __publicField(this, "state", 1);
427
+ this.state = 1;
434
428
  /** The read buffer. */
435
- __publicField(this, "buffer", "");
429
+ this.buffer = "";
436
430
  /** The beginning of the section that is currently being read. */
437
- __publicField(this, "sectionStart", 0);
431
+ this.sectionStart = 0;
438
432
  /** The index within the buffer that we are currently looking at. */
439
- __publicField(this, "index", 0);
433
+ this.index = 0;
440
434
  /** The start of the last entity. */
441
- __publicField(this, "entityStart", 0);
435
+ this.entityStart = 0;
442
436
  /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
443
- __publicField(this, "baseState", 1);
437
+ this.baseState = 1;
444
438
  /** For special parsing behavior inside of script and style tags. */
445
- __publicField(this, "inRCDATA", false);
439
+ this.inRCDATA = false;
446
440
  /** For disabling RCDATA tags handling */
447
- __publicField(this, "inXML", false);
441
+ this.inXML = false;
448
442
  /** For disabling interpolation parsing in v-pre */
449
- __publicField(this, "inVPre", false);
443
+ this.inVPre = false;
450
444
  /** Record newline positions for fast line / column calculation */
451
- __publicField(this, "newlines", []);
452
- __publicField(this, "entityDecoder");
453
- __publicField(this, "mode", 0);
454
- __publicField(this, "delimiterOpen", defaultDelimitersOpen);
455
- __publicField(this, "delimiterClose", defaultDelimitersClose);
456
- __publicField(this, "delimiterIndex", -1);
457
- __publicField(this, "currentSequence");
458
- __publicField(this, "sequenceIndex", 0);
445
+ this.newlines = [];
446
+ this.mode = 0;
447
+ this.delimiterOpen = defaultDelimitersOpen;
448
+ this.delimiterClose = defaultDelimitersClose;
449
+ this.delimiterIndex = -1;
450
+ this.currentSequence = void 0;
451
+ this.sequenceIndex = 0;
459
452
  {
460
453
  this.entityDecoder = new decode_js.EntityDecoder(
461
454
  decode_js.htmlDecodeTree,
@@ -374,12 +374,6 @@ function convertToBlock(node, { helper, removeHelper, inSSR }) {
374
374
  }
375
375
  }
376
376
 
377
- var __defProp = Object.defineProperty;
378
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
379
- var __publicField = (obj, key, value) => {
380
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
381
- return value;
382
- };
383
377
  const defaultDelimitersOpen = new Uint8Array([123, 123]);
384
378
  const defaultDelimitersClose = new Uint8Array([125, 125]);
385
379
  function isTagStartChar(c) {
@@ -430,32 +424,31 @@ class Tokenizer {
430
424
  this.stack = stack;
431
425
  this.cbs = cbs;
432
426
  /** The current state the tokenizer is in. */
433
- __publicField(this, "state", 1);
427
+ this.state = 1;
434
428
  /** The read buffer. */
435
- __publicField(this, "buffer", "");
429
+ this.buffer = "";
436
430
  /** The beginning of the section that is currently being read. */
437
- __publicField(this, "sectionStart", 0);
431
+ this.sectionStart = 0;
438
432
  /** The index within the buffer that we are currently looking at. */
439
- __publicField(this, "index", 0);
433
+ this.index = 0;
440
434
  /** The start of the last entity. */
441
- __publicField(this, "entityStart", 0);
435
+ this.entityStart = 0;
442
436
  /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
443
- __publicField(this, "baseState", 1);
437
+ this.baseState = 1;
444
438
  /** For special parsing behavior inside of script and style tags. */
445
- __publicField(this, "inRCDATA", false);
439
+ this.inRCDATA = false;
446
440
  /** For disabling RCDATA tags handling */
447
- __publicField(this, "inXML", false);
441
+ this.inXML = false;
448
442
  /** For disabling interpolation parsing in v-pre */
449
- __publicField(this, "inVPre", false);
443
+ this.inVPre = false;
450
444
  /** Record newline positions for fast line / column calculation */
451
- __publicField(this, "newlines", []);
452
- __publicField(this, "entityDecoder");
453
- __publicField(this, "mode", 0);
454
- __publicField(this, "delimiterOpen", defaultDelimitersOpen);
455
- __publicField(this, "delimiterClose", defaultDelimitersClose);
456
- __publicField(this, "delimiterIndex", -1);
457
- __publicField(this, "currentSequence");
458
- __publicField(this, "sequenceIndex", 0);
445
+ this.newlines = [];
446
+ this.mode = 0;
447
+ this.delimiterOpen = defaultDelimitersOpen;
448
+ this.delimiterClose = defaultDelimitersClose;
449
+ this.delimiterIndex = -1;
450
+ this.currentSequence = void 0;
451
+ this.sequenceIndex = 0;
459
452
  {
460
453
  this.entityDecoder = new decode_js.EntityDecoder(
461
454
  decode_js.htmlDecodeTree,
@@ -368,12 +368,6 @@ function convertToBlock(node, { helper, removeHelper, inSSR }) {
368
368
  }
369
369
  }
370
370
 
371
- var __defProp = Object.defineProperty;
372
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
373
- var __publicField = (obj, key, value) => {
374
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
375
- return value;
376
- };
377
371
  const defaultDelimitersOpen = new Uint8Array([123, 123]);
378
372
  const defaultDelimitersClose = new Uint8Array([125, 125]);
379
373
  function isTagStartChar(c) {
@@ -424,32 +418,31 @@ class Tokenizer {
424
418
  this.stack = stack;
425
419
  this.cbs = cbs;
426
420
  /** The current state the tokenizer is in. */
427
- __publicField(this, "state", 1);
421
+ this.state = 1;
428
422
  /** The read buffer. */
429
- __publicField(this, "buffer", "");
423
+ this.buffer = "";
430
424
  /** The beginning of the section that is currently being read. */
431
- __publicField(this, "sectionStart", 0);
425
+ this.sectionStart = 0;
432
426
  /** The index within the buffer that we are currently looking at. */
433
- __publicField(this, "index", 0);
427
+ this.index = 0;
434
428
  /** The start of the last entity. */
435
- __publicField(this, "entityStart", 0);
429
+ this.entityStart = 0;
436
430
  /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
437
- __publicField(this, "baseState", 1);
431
+ this.baseState = 1;
438
432
  /** For special parsing behavior inside of script and style tags. */
439
- __publicField(this, "inRCDATA", false);
433
+ this.inRCDATA = false;
440
434
  /** For disabling RCDATA tags handling */
441
- __publicField(this, "inXML", false);
435
+ this.inXML = false;
442
436
  /** For disabling interpolation parsing in v-pre */
443
- __publicField(this, "inVPre", false);
437
+ this.inVPre = false;
444
438
  /** Record newline positions for fast line / column calculation */
445
- __publicField(this, "newlines", []);
446
- __publicField(this, "entityDecoder");
447
- __publicField(this, "mode", 0);
448
- __publicField(this, "delimiterOpen", defaultDelimitersOpen);
449
- __publicField(this, "delimiterClose", defaultDelimitersClose);
450
- __publicField(this, "delimiterIndex", -1);
451
- __publicField(this, "currentSequence");
452
- __publicField(this, "sequenceIndex", 0);
439
+ this.newlines = [];
440
+ this.mode = 0;
441
+ this.delimiterOpen = defaultDelimitersOpen;
442
+ this.delimiterClose = defaultDelimitersClose;
443
+ this.delimiterIndex = -1;
444
+ this.currentSequence = void 0;
445
+ this.sequenceIndex = 0;
453
446
  }
454
447
  get inSFCRoot() {
455
448
  return this.mode === 2 && this.stack.length === 0;