@dcloudio/uni-push 3.0.0-alpha-3030820220114007

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.
@@ -0,0 +1,64 @@
1
+ 'use strict';
2
+
3
+ var path = require('path');
4
+ var debug = require('debug');
5
+ var uniCliShared = require('@dcloudio/uni-cli-shared');
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
10
+ var debug__default = /*#__PURE__*/_interopDefaultLegacy(debug);
11
+
12
+ const debugPush = debug__default["default"]('uni:push');
13
+ var index = () => [
14
+ uniCliShared.defineUniMainJsPlugin((opts) => {
15
+ let isEnable = false;
16
+ let isOffline = false;
17
+ return {
18
+ name: 'uni:push',
19
+ enforce: 'pre',
20
+ config(config, env) {
21
+ if (uniCliShared.isSsr(env.command, config)) {
22
+ return;
23
+ }
24
+ const inputDir = process.env.UNI_INPUT_DIR;
25
+ const platform = process.env.UNI_PLATFORM;
26
+ isOffline = platform === 'app' && uniCliShared.isUniPushOffline(inputDir);
27
+ if (isOffline) {
28
+ isEnable = true;
29
+ return;
30
+ }
31
+ const { appid, enable, debug } = uniCliShared.getUniPush(inputDir, platform);
32
+ isEnable = appid && enable === true;
33
+ if (!isEnable) {
34
+ return;
35
+ }
36
+ debugPush('appid', appid, 'deubg', debug);
37
+ return {
38
+ define: {
39
+ 'process.env.UNI_PUSH_APP_ID': JSON.stringify(appid),
40
+ 'process.env.UNI_PUSH_DEBUG': !!debug,
41
+ },
42
+ };
43
+ },
44
+ resolveId(id) {
45
+ if (id === '@dcloudio/uni-push') {
46
+ return uniCliShared.resolveBuiltIn(path__default["default"].join('@dcloudio/uni-push', isOffline ? 'dist/uni-push.plus.es.js' : 'dist/uni-push.es.js'));
47
+ }
48
+ },
49
+ transform(code, id) {
50
+ if (!opts.filter(id)) {
51
+ return;
52
+ }
53
+ if (isEnable) {
54
+ return {
55
+ code: code + `;import '@dcloudio/uni-push';`,
56
+ map: null,
57
+ };
58
+ }
59
+ },
60
+ };
61
+ }),
62
+ ];
63
+
64
+ module.exports = index;
package/lib/version ADDED
@@ -0,0 +1 @@
1
+ 1.0.0.20220127134911
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@dcloudio/uni-push",
3
+ "version": "3.0.0-alpha-3030820220114007",
4
+ "description": "@dcloudio/uni-push",
5
+ "main": "lib/uni-push.js",
6
+ "module": "lib/uni-push.js",
7
+ "files": [
8
+ "lib"
9
+ ],
10
+ "sideEffects": false,
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/dcloudio/uni-app.git",
14
+ "directory": "packages/uni-push"
15
+ },
16
+ "license": "Apache-2.0",
17
+ "bugs": {
18
+ "url": "https://github.com/dcloudio/uni-app/issues"
19
+ },
20
+ "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
21
+ "dependencies": {
22
+ "@dcloudio/uni-cli-shared": "3.0.0-alpha-3030820220114007",
23
+ "debug": "^4.3.2"
24
+ },
25
+ "devDependencies": {
26
+ "@types/debug": "^4.1.7"
27
+ }
28
+ }