@dcloudio/uni-cli-shared 3.0.0-alpha-4000320240308002 → 3.0.0-alpha-4000320240309001

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.
@@ -14,6 +14,7 @@ const utils_1 = require("../../utils");
14
14
  const uniRoutes_1 = require("../app/pages/uniRoutes");
15
15
  const uniConfig_1 = require("./uniConfig");
16
16
  const utils_2 = require("../../vite/plugins/vitejs/utils");
17
+ const preprocess_1 = require("../../preprocess");
17
18
  var manifest_1 = require("./manifest");
18
19
  Object.defineProperty(exports, "parseUniXFlexDirection", { enumerable: true, get: function () { return manifest_1.parseUniXFlexDirection; } });
19
20
  Object.defineProperty(exports, "parseUniXSplashScreen", { enumerable: true, get: function () { return manifest_1.parseUniXSplashScreen; } });
@@ -133,6 +134,8 @@ function walkNode(node, pagePathNodes) {
133
134
  }
134
135
  }
135
136
  function normalizeUniAppXAppPagesJson(jsonStr) {
137
+ // 先条件编译
138
+ jsonStr = (0, preprocess_1.preUVueJson)(jsonStr);
136
139
  checkPagesJson(jsonStr, process.env.UNI_INPUT_DIR);
137
140
  const pagesJson = {
138
141
  pages: [],
@@ -142,9 +145,9 @@ function normalizeUniAppXAppPagesJson(jsonStr) {
142
145
  pages: [],
143
146
  globalStyle: {},
144
147
  };
145
- // preprocess
146
148
  try {
147
- userPagesJson = (0, json_1.parseJson)(jsonStr, true);
149
+ // 此处不需要条件编译了
150
+ userPagesJson = (0, json_1.parseJson)(jsonStr, false);
148
151
  }
149
152
  catch (e) {
150
153
  console.error(`[vite] Error: pages.json parse failed.\n`, jsonStr, e);
@@ -70,7 +70,7 @@ function initPreContext(platform, userPreContext, utsPlatform, isX) {
70
70
  }
71
71
  if (platform === 'app' || platform === 'app-plus') {
72
72
  defaultContext.APP = true;
73
- defaultContext.APP_PLUS = true;
73
+ defaultContext.APP_PLUS = isX ? false : true;
74
74
  vueContext.APP_VUE = true;
75
75
  nvueContext.APP_NVUE = true;
76
76
  nvueContext.APP_PLUS_NVUE = true;
@@ -1116,15 +1116,22 @@ const preCssExtNames = ['.scss', '.sass', '.styl', '.stylus'];
1116
1116
  * 目前主要解决 scss 文件被 @import 的条件编译
1117
1117
  */
1118
1118
  function rewriteScssReadFileSync() {
1119
+ // 目前 1.0 App 端,只要包含了APP-NVUE条件编译,就不pre,因为区分不出来APP-NVUE
1120
+ const ignoreAppNVue = process.env.UNI_APP_X !== 'true' &&
1121
+ (process.env.UNI_PLATFORM === 'app' ||
1122
+ process.env.UNI_PLATFORM === 'app-plus');
1119
1123
  const { readFileSync } = fs_1.default;
1120
1124
  fs_1.default.readFileSync = ((filepath, options) => {
1121
1125
  const content = readFileSync(filepath, options);
1122
1126
  if ((0, shared_1.isString)(filepath) &&
1123
1127
  (0, shared_1.isString)(content) &&
1124
1128
  preCssExtNames.includes(path_1.default.extname(filepath)) &&
1125
- content.includes('#endif') &&
1126
- // 目前无法区分app-nvue
1127
- !content.includes('APP-NVUE')) {
1129
+ content.includes('#endif')
1130
+ // 目前无法区分app-nvue
1131
+ ) {
1132
+ if (ignoreAppNVue && content.includes('APP-NVUE')) {
1133
+ return content;
1134
+ }
1128
1135
  return (0, preprocess_1.preCss)(content);
1129
1136
  }
1130
1137
  return content;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-4000320240308002",
3
+ "version": "3.0.0-alpha-4000320240309001",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,8 +26,8 @@
26
26
  "@babel/core": "^7.21.3",
27
27
  "@babel/parser": "^7.23.5",
28
28
  "@babel/types": "^7.20.7",
29
- "@dcloudio/uni-i18n": "3.0.0-alpha-4000320240308002",
30
- "@dcloudio/uni-shared": "3.0.0-alpha-4000320240308002",
29
+ "@dcloudio/uni-i18n": "3.0.0-alpha-4000320240309001",
30
+ "@dcloudio/uni-shared": "3.0.0-alpha-4000320240309001",
31
31
  "@intlify/core-base": "9.1.9",
32
32
  "@intlify/shared": "9.1.9",
33
33
  "@intlify/vue-devtools": "9.1.9",
@@ -67,7 +67,7 @@
67
67
  },
68
68
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
69
69
  "devDependencies": {
70
- "@dcloudio/uni-uts-v1": "3.0.0-alpha-4000320240308002",
70
+ "@dcloudio/uni-uts-v1": "3.0.0-alpha-4000320240309001",
71
71
  "@types/babel__code-frame": "^7.0.6",
72
72
  "@types/babel__core": "^7.1.19",
73
73
  "@types/debug": "^4.1.7",