@lingxiteam/assets 3.3.1-alpha.4 → 3.3.1-alpha.7

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/es/theme/index.js CHANGED
@@ -22,13 +22,15 @@ var options = {
22
22
  };
23
23
 
24
24
  // 下载远程zip文件到本地
25
- var downloadRemoteZipFile = function downloadRemoteZipFile(hostname) {
25
+ var downloadRemoteZipFile = function downloadRemoteZipFile(_ref) {
26
+ var url = _ref.url,
27
+ hostname = _ref.hostname;
26
28
  var file = fs.createWriteStream(localFilePath);
27
29
  var _options = _objectSpread({
28
30
  hostname: hostname
29
31
  }, options);
30
32
  return new Promise(function (resolve, reject) {
31
- https.get(_options, function (response) {
33
+ https.get(url || _options, function (response) {
32
34
  response.pipe(file);
33
35
  file.on('finish', function () {
34
36
  file.close();
@@ -57,8 +59,8 @@ var extractZip = function extractZip() {
57
59
  };
58
60
 
59
61
  // 获取主题
60
- var getTheme = /*#__PURE__*/function () {
61
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
62
+ var getThemeImpl = /*#__PURE__*/function () {
63
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
62
64
  var domains, downRes, i;
63
65
  return _regeneratorRuntime().wrap(function _callee$(_context) {
64
66
  while (1) {
@@ -66,33 +68,83 @@ var getTheme = /*#__PURE__*/function () {
66
68
  case 0:
67
69
  domains = ['fastly.jsdelivr.net', 'cdn.jsdelivr.net', 'gcore.jsdelivr.net', 'jsdelivr.codeqihan.com'];
68
70
  downRes = false;
71
+ if (!url) {
72
+ _context.next = 9;
73
+ break;
74
+ }
75
+ _context.next = 5;
76
+ return downloadRemoteZipFile({
77
+ url: url
78
+ });
79
+ case 5:
80
+ downRes = _context.sent;
81
+ console.log('remote zip file download success!from https://dev.iwhalecloud.com ......');
82
+ _context.next = 18;
83
+ break;
84
+ case 9:
69
85
  i = 0;
70
- case 3:
86
+ case 10:
71
87
  if (!(!downRes && i < 4)) {
72
- _context.next = 10;
88
+ _context.next = 18;
73
89
  break;
74
90
  }
75
- _context.next = 6;
76
- return downloadRemoteZipFile(domains[i]);
77
- case 6:
91
+ _context.next = 13;
92
+ return downloadRemoteZipFile({
93
+ hostname: domains[i]
94
+ });
95
+ case 13:
78
96
  downRes = _context.sent;
97
+ console.log("remote zip file download success\uFF01from ".concat(domains[i], "....."));
79
98
  i += 1;
80
- _context.next = 3;
99
+ _context.next = 10;
81
100
  break;
82
- case 10:
101
+ case 18:
83
102
  if (downRes) {
84
- console.log('remote zip file download success!,beigin extract......');
85
103
  extractZip();
86
104
  }
87
- case 11:
105
+ return _context.abrupt("return", downRes);
106
+ case 20:
88
107
  case "end":
89
108
  return _context.stop();
90
109
  }
91
110
  }
92
111
  }, _callee);
93
112
  }));
113
+ return function getThemeImpl(_x) {
114
+ return _ref2.apply(this, arguments);
115
+ };
116
+ }();
117
+ var getTheme = /*#__PURE__*/function () {
118
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
119
+ var url, res;
120
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
121
+ while (1) {
122
+ switch (_context2.prev = _context2.next) {
123
+ case 0:
124
+ url = 'https://dev.iwhalecloud.com/portal/zcm-doc/file/download?filePath=document/book-275/doc/uploads/63433/ad4b0668-59d1-4535-8ab9-9633517f95b0/default.zip';
125
+ _context2.prev = 1;
126
+ _context2.next = 4;
127
+ return getThemeImpl(url);
128
+ case 4:
129
+ res = _context2.sent;
130
+ if (!res) {
131
+ getThemeImpl();
132
+ }
133
+ _context2.next = 11;
134
+ break;
135
+ case 8:
136
+ _context2.prev = 8;
137
+ _context2.t0 = _context2["catch"](1);
138
+ console.error(_context2.t0);
139
+ case 11:
140
+ case "end":
141
+ return _context2.stop();
142
+ }
143
+ }
144
+ }, _callee2, null, [[1, 8]]);
145
+ }));
94
146
  return function getTheme() {
95
- return _ref.apply(this, arguments);
147
+ return _ref3.apply(this, arguments);
96
148
  };
97
149
  }();
98
150
  export default getTheme;
@@ -28,13 +28,15 @@ var options = {
28
28
  };
29
29
 
30
30
  // 下载远程zip文件到本地
31
- var downloadRemoteZipFile = function downloadRemoteZipFile(hostname) {
31
+ var downloadRemoteZipFile = function downloadRemoteZipFile(_ref) {
32
+ var url = _ref.url,
33
+ hostname = _ref.hostname;
32
34
  var file = fs.createWriteStream(localFilePath);
33
35
  var _options = _objectSpread({
34
36
  hostname: hostname
35
37
  }, options);
36
38
  return new Promise(function (resolve, reject) {
37
- https.get(_options, function (response) {
39
+ https.get(url || _options, function (response) {
38
40
  response.pipe(file);
39
41
  file.on('finish', function () {
40
42
  file.close();
@@ -63,8 +65,8 @@ var extractZip = function extractZip() {
63
65
  };
64
66
 
65
67
  // 获取主题
66
- var getTheme = /*#__PURE__*/function () {
67
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
68
+ var getThemeImpl = /*#__PURE__*/function () {
69
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
68
70
  var domains, downRes, i;
69
71
  return _regeneratorRuntime().wrap(function _callee$(_context) {
70
72
  while (1) {
@@ -72,33 +74,83 @@ var getTheme = /*#__PURE__*/function () {
72
74
  case 0:
73
75
  domains = ['fastly.jsdelivr.net', 'cdn.jsdelivr.net', 'gcore.jsdelivr.net', 'jsdelivr.codeqihan.com'];
74
76
  downRes = false;
77
+ if (!url) {
78
+ _context.next = 9;
79
+ break;
80
+ }
81
+ _context.next = 5;
82
+ return downloadRemoteZipFile({
83
+ url: url
84
+ });
85
+ case 5:
86
+ downRes = _context.sent;
87
+ console.log('remote zip file download success!from https://dev.iwhalecloud.com ......');
88
+ _context.next = 18;
89
+ break;
90
+ case 9:
75
91
  i = 0;
76
- case 3:
92
+ case 10:
77
93
  if (!(!downRes && i < 4)) {
78
- _context.next = 10;
94
+ _context.next = 18;
79
95
  break;
80
96
  }
81
- _context.next = 6;
82
- return downloadRemoteZipFile(domains[i]);
83
- case 6:
97
+ _context.next = 13;
98
+ return downloadRemoteZipFile({
99
+ hostname: domains[i]
100
+ });
101
+ case 13:
84
102
  downRes = _context.sent;
103
+ console.log("remote zip file download success\uFF01from ".concat(domains[i], "....."));
85
104
  i += 1;
86
- _context.next = 3;
105
+ _context.next = 10;
87
106
  break;
88
- case 10:
107
+ case 18:
89
108
  if (downRes) {
90
- console.log('remote zip file download success!,beigin extract......');
91
109
  extractZip();
92
110
  }
93
- case 11:
111
+ return _context.abrupt("return", downRes);
112
+ case 20:
94
113
  case "end":
95
114
  return _context.stop();
96
115
  }
97
116
  }
98
117
  }, _callee);
99
118
  }));
119
+ return function getThemeImpl(_x) {
120
+ return _ref2.apply(this, arguments);
121
+ };
122
+ }();
123
+ var getTheme = /*#__PURE__*/function () {
124
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
125
+ var url, res;
126
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
127
+ while (1) {
128
+ switch (_context2.prev = _context2.next) {
129
+ case 0:
130
+ url = 'https://dev.iwhalecloud.com/portal/zcm-doc/file/download?filePath=document/book-275/doc/uploads/63433/ad4b0668-59d1-4535-8ab9-9633517f95b0/default.zip';
131
+ _context2.prev = 1;
132
+ _context2.next = 4;
133
+ return getThemeImpl(url);
134
+ case 4:
135
+ res = _context2.sent;
136
+ if (!res) {
137
+ getThemeImpl();
138
+ }
139
+ _context2.next = 11;
140
+ break;
141
+ case 8:
142
+ _context2.prev = 8;
143
+ _context2.t0 = _context2["catch"](1);
144
+ console.error(_context2.t0);
145
+ case 11:
146
+ case "end":
147
+ return _context2.stop();
148
+ }
149
+ }
150
+ }, _callee2, null, [[1, 8]]);
151
+ }));
100
152
  return function getTheme() {
101
- return _ref.apply(this, arguments);
153
+ return _ref3.apply(this, arguments);
102
154
  };
103
155
  }();
104
156
  var _default = getTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/assets",
3
- "version": "3.3.1-alpha.4",
3
+ "version": "3.3.1-alpha.7",
4
4
  "description": "灵犀低代码平台移动端 - 工具类",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",