@dcloudio/uni-cli-shared 2.0.2-3080720230630001 → 2.0.2-3081220230814001

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.
package/lib/manifest.js CHANGED
@@ -158,6 +158,14 @@ function isUniPushOffline (manifestJson) {
158
158
  return unipush && unipush.offline === true
159
159
  }
160
160
 
161
+ function hasPushModule (manifestJson) {
162
+ if (!manifestJson) {
163
+ manifestJson = getManifestJson()
164
+ }
165
+ const platformOptions = manifestJson['app-plus']
166
+ return platformOptions && platformOptions.modules && platformOptions.modules.Push
167
+ }
168
+
161
169
  module.exports = {
162
170
  getManifestJson,
163
171
  parseManifestJson,
@@ -166,5 +174,6 @@ module.exports = {
166
174
  isEnableUniPushV1,
167
175
  isEnableUniPushV2,
168
176
  isUniPushOffline,
177
+ hasPushModule,
169
178
  isEnableSecureNetwork
170
179
  }
package/lib/platform.js CHANGED
@@ -168,8 +168,14 @@ module.exports = {
168
168
  : 'import \'@dcloudio/uni-stat/dist/uni-stat.es.js\';'
169
169
  },
170
170
  getPlatformPush () {
171
- if (process.env.UNI_PUSH_V2_OFFLINE || process.env.UNI_PUSH_V1) {
172
- return ';import \'@dcloudio/vue-cli-plugin-uni/packages/uni-push/dist/uni-push.plus.es.js\';'
171
+ if (process.env.UNI_PUSH_V1) {
172
+ if (process.env.UNI_PUSH_MODULE) {
173
+ return ';import \'@dcloudio/vue-cli-plugin-uni/packages/uni-push/dist/uni-push-v1.plus.es.js\';'
174
+ }
175
+ } else if (process.env.UNI_PUSH_V2_OFFLINE) {
176
+ if (process.env.UNI_PUSH_MODULE) {
177
+ return ';import \'@dcloudio/vue-cli-plugin-uni/packages/uni-push/dist/uni-push.plus.es.js\';'
178
+ }
173
179
  } else if (process.env.UNI_PUSH_V2) {
174
180
  return ';import \'@dcloudio/vue-cli-plugin-uni/packages/uni-push/dist/uni-push.es.js\';'
175
181
  }
@@ -199,4 +205,4 @@ module.exports = {
199
205
  ]
200
206
  }
201
207
  }
202
- }
208
+ }
@@ -7,6 +7,9 @@ exports.parseInjects = exports.parseUniExtApis = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const fs_extra_1 = __importDefault(require("fs-extra"));
9
9
  function parseUniExtApis(vite = true, platform, language = 'javascript') {
10
+ if (!process.env.UNI_INPUT_DIR) {
11
+ return {};
12
+ }
10
13
  const uniModulesDir = path_1.default.resolve(process.env.UNI_INPUT_DIR, 'uni_modules');
11
14
  if (!fs_extra_1.default.existsSync(uniModulesDir)) {
12
15
  return {};
@@ -23,8 +26,11 @@ function parseUniExtApis(vite = true, platform, language = 'javascript') {
23
26
  return;
24
27
  }
25
28
  try {
26
- const exports = JSON.parse(fs_extra_1.default.readFileSync(pkgPath, 'utf8'))
27
- ?.uni_modules?.['uni-ext-api'];
29
+ let exports;
30
+ const pkg = JSON.parse(fs_extra_1.default.readFileSync(pkgPath, 'utf8'));
31
+ if (pkg && pkg.uni_modules && pkg.uni_modules['uni-ext-api']) {
32
+ exports = pkg.uni_modules['uni-ext-api'];
33
+ }
28
34
  if (exports) {
29
35
  const curInjects = parseInjects(vite, platform, language, `@/uni_modules/${uniModuleDir}`, uniModuleRootDir, exports);
30
36
  Object.assign(injects, curInjects);
@@ -98,7 +104,9 @@ function parseInject(vite = true, platform, language, source, globalObject, defi
98
104
  const keys = Object.keys(define);
99
105
  keys.forEach((d) => {
100
106
  if (typeof define[d] === 'string') {
101
- injects[globalObject + '.' + d] = [source, define[d]];
107
+ if (hasPlatformFile) {
108
+ injects[globalObject + '.' + d] = [source, define[d]];
109
+ }
102
110
  }
103
111
  else {
104
112
  const defineOptions = define[d];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "2.0.2-3080720230630001",
3
+ "version": "2.0.2-3081220230814001",
4
4
  "description": "uni-cli-shared",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -26,5 +26,5 @@
26
26
  "postcss-urlrewrite": "^0.2.2",
27
27
  "strip-json-comments": "^2.0.1"
28
28
  },
29
- "gitHead": "3270825d23dfede1b8534dbfb60e4246e98f6edc"
29
+ "gitHead": "d5467845de45fc9e954d6b6ad269ea831773e15c"
30
30
  }