@alicloud/alfa-react 1.3.4-alpha.1 → 1.3.4

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.
@@ -11,6 +11,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
11
11
  import React, { useRef, useEffect, useState, useMemo } from 'react';
12
12
  import Loading from './components/Loading';
13
13
  import { normalizeName } from './utils';
14
+ import { version as loaderVersion } from './version';
14
15
 
15
16
  /**
16
17
  * container for microApp mount
@@ -48,13 +49,15 @@ export default function createApplication(loader) {
48
49
  var tagName = normalizeName(props.name);
49
50
  var sandbox = useMemo(function () {
50
51
  return _objectSpread(_objectSpread({}, customSandbox), {}, {
51
- allowResources: [].concat(_toConsumableArray((customSandbox === null || customSandbox === void 0 ? void 0 : customSandbox.allowResources) || []), [/^https?:\/\/at\.alicdn\.com\//]),
52
+ // allowResources: [
53
+ // ...(customSandbox?.allowResources || []),
54
+ // /^https?:\/\/at\.alicdn\.com\//,
55
+ // ],
52
56
  externalsVars: [].concat(_toConsumableArray((customSandbox === null || customSandbox === void 0 ? void 0 : customSandbox.externalsVars) || []), [// global vars used in ConsoleBase.forApp
53
57
  '_console_base_ready_'])
54
58
  });
55
59
  }, [customSandbox]);
56
60
  useEffect(function () {
57
- // eslint-disable-next-line no-useless-catch
58
61
  _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
59
62
  var _yield$loader$registe, App, logger;
60
63
 
@@ -62,15 +65,7 @@ export default function createApplication(loader) {
62
65
  while (1) {
63
66
  switch (_context.prev = _context.next) {
64
67
  case 0:
65
- if (!app) {
66
- _context.next = 2;
67
- break;
68
- }
69
-
70
- return _context.abrupt("return");
71
-
72
- case 2:
73
- _context.next = 4;
68
+ _context.next = 2;
74
69
  return loader.register({
75
70
  entry: entry,
76
71
  url: url,
@@ -90,13 +85,13 @@ export default function createApplication(loader) {
90
85
  beforeUpdate: beforeUpdate
91
86
  });
92
87
 
93
- case 4:
88
+ case 2:
94
89
  _yield$loader$registe = _context.sent;
95
90
  App = _yield$loader$registe.app;
96
91
  logger = _yield$loader$registe.logger;
97
92
 
98
93
  if (App) {
99
- _context.next = 9;
94
+ _context.next = 7;
100
95
  break;
101
96
  }
102
97
 
@@ -104,9 +99,9 @@ export default function createApplication(loader) {
104
99
  E_MSG: 'load app failed.'
105
100
  }));
106
101
 
107
- case 9:
102
+ case 7:
108
103
  if (appRef.current) {
109
- _context.next = 11;
104
+ _context.next = 9;
110
105
  break;
111
106
  }
112
107
 
@@ -114,16 +109,16 @@ export default function createApplication(loader) {
114
109
  E_MSG: 'cannot find container.'
115
110
  }));
116
111
 
117
- case 11:
118
- _context.next = 13;
112
+ case 9:
113
+ _context.next = 11;
119
114
  return App.mount(appRef.current, {
120
115
  customProps: customProps
121
116
  });
122
117
 
123
- case 13:
118
+ case 11:
124
119
  setApp(App);
125
120
 
126
- case 14:
121
+ case 12:
127
122
  case "end":
128
123
  return _context.stop();
129
124
  }
@@ -142,15 +137,23 @@ export default function createApplication(loader) {
142
137
  app.update(customProps);
143
138
  }
144
139
 
140
+ var dataAttrs = {
141
+ dataId: version,
142
+ dataVersion: version,
143
+ dataLoader: loaderVersion
144
+ };
145
145
  return /*#__PURE__*/React.createElement(React.Fragment, null, !app ? /*#__PURE__*/React.createElement(Loading, {
146
146
  loading: loading
147
- }) : null, sandbox && sandbox.disableFakeBody ? /*#__PURE__*/React.createElement(tagName, {
147
+ }) : null, sandbox && sandbox.disableFakeBody ? /*#__PURE__*/React.createElement(tagName, _objectSpread({
148
148
  style: style,
149
149
  className: className,
150
- ref: appRef,
151
- dataId: name
152
- }) : /*#__PURE__*/React.createElement(tagName, {}, /*#__PURE__*/React.createElement('div', {
153
150
  ref: appRef
151
+ }, dataAttrs)) : /*#__PURE__*/React.createElement(tagName, {
152
+ dataAttrs: dataAttrs
153
+ }, /*#__PURE__*/React.createElement('div', {
154
+ ref: appRef,
155
+ style: style,
156
+ className: className
154
157
  })));
155
158
  };
156
159
  }
package/es/version.js CHANGED
@@ -1 +1 @@
1
- export var version = '1.3.4-alpha.1';
1
+ export var version = '1.3.4';
@@ -25,6 +25,8 @@ var _Loading = _interopRequireDefault(require("./components/Loading"));
25
25
 
26
26
  var _utils = require("./utils");
27
27
 
28
+ var _version = require("./version");
29
+
28
30
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
31
 
30
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -69,13 +71,15 @@ function createApplication(loader) {
69
71
  var tagName = (0, _utils.normalizeName)(props.name);
70
72
  var sandbox = (0, _react.useMemo)(function () {
71
73
  return _objectSpread(_objectSpread({}, customSandbox), {}, {
72
- allowResources: [].concat((0, _toConsumableArray2.default)((customSandbox === null || customSandbox === void 0 ? void 0 : customSandbox.allowResources) || []), [/^https?:\/\/at\.alicdn\.com\//]),
74
+ // allowResources: [
75
+ // ...(customSandbox?.allowResources || []),
76
+ // /^https?:\/\/at\.alicdn\.com\//,
77
+ // ],
73
78
  externalsVars: [].concat((0, _toConsumableArray2.default)((customSandbox === null || customSandbox === void 0 ? void 0 : customSandbox.externalsVars) || []), [// global vars used in ConsoleBase.forApp
74
79
  '_console_base_ready_'])
75
80
  });
76
81
  }, [customSandbox]);
77
82
  (0, _react.useEffect)(function () {
78
- // eslint-disable-next-line no-useless-catch
79
83
  (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
80
84
  var _yield$loader$registe, App, logger;
81
85
 
@@ -83,15 +87,7 @@ function createApplication(loader) {
83
87
  while (1) {
84
88
  switch (_context.prev = _context.next) {
85
89
  case 0:
86
- if (!app) {
87
- _context.next = 2;
88
- break;
89
- }
90
-
91
- return _context.abrupt("return");
92
-
93
- case 2:
94
- _context.next = 4;
90
+ _context.next = 2;
95
91
  return loader.register({
96
92
  entry: entry,
97
93
  url: url,
@@ -111,13 +107,13 @@ function createApplication(loader) {
111
107
  beforeUpdate: beforeUpdate
112
108
  });
113
109
 
114
- case 4:
110
+ case 2:
115
111
  _yield$loader$registe = _context.sent;
116
112
  App = _yield$loader$registe.app;
117
113
  logger = _yield$loader$registe.logger;
118
114
 
119
115
  if (App) {
120
- _context.next = 9;
116
+ _context.next = 7;
121
117
  break;
122
118
  }
123
119
 
@@ -125,9 +121,9 @@ function createApplication(loader) {
125
121
  E_MSG: 'load app failed.'
126
122
  }));
127
123
 
128
- case 9:
124
+ case 7:
129
125
  if (appRef.current) {
130
- _context.next = 11;
126
+ _context.next = 9;
131
127
  break;
132
128
  }
133
129
 
@@ -135,16 +131,16 @@ function createApplication(loader) {
135
131
  E_MSG: 'cannot find container.'
136
132
  }));
137
133
 
138
- case 11:
139
- _context.next = 13;
134
+ case 9:
135
+ _context.next = 11;
140
136
  return App.mount(appRef.current, {
141
137
  customProps: customProps
142
138
  });
143
139
 
144
- case 13:
140
+ case 11:
145
141
  setApp(App);
146
142
 
147
- case 14:
143
+ case 12:
148
144
  case "end":
149
145
  return _context.stop();
150
146
  }
@@ -162,15 +158,23 @@ function createApplication(loader) {
162
158
  app.update(customProps);
163
159
  }
164
160
 
161
+ var dataAttrs = {
162
+ dataId: version,
163
+ dataVersion: version,
164
+ dataLoader: _version.version
165
+ };
165
166
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !app ? /*#__PURE__*/_react.default.createElement(_Loading.default, {
166
167
  loading: loading
167
- }) : null, sandbox && sandbox.disableFakeBody ? /*#__PURE__*/_react.default.createElement(tagName, {
168
+ }) : null, sandbox && sandbox.disableFakeBody ? /*#__PURE__*/_react.default.createElement(tagName, _objectSpread({
168
169
  style: style,
169
170
  className: className,
170
- ref: appRef,
171
- dataId: name
172
- }) : /*#__PURE__*/_react.default.createElement(tagName, {}, /*#__PURE__*/_react.default.createElement('div', {
173
171
  ref: appRef
172
+ }, dataAttrs)) : /*#__PURE__*/_react.default.createElement(tagName, {
173
+ dataAttrs: dataAttrs
174
+ }, /*#__PURE__*/_react.default.createElement('div', {
175
+ ref: appRef,
176
+ style: style,
177
+ className: className
174
178
  })));
175
179
  };
176
180
  }
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "1.3.4-alpha.1";
1
+ export declare const version = "1.3.4";
package/lib/version.js CHANGED
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = void 0;
7
- var version = '1.3.4-alpha.1';
7
+ var version = '1.3.4';
8
8
  exports.version = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/alfa-react",
3
- "version": "1.3.4-alpha.1",
3
+ "version": "1.3.4",
4
4
  "description": "Alfa Framework (React Version)",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -15,7 +15,7 @@
15
15
  "babel:esm": "breezr build --engine babel --es-module",
16
16
  "build": "breezr build --engine webpack",
17
17
  "clean": "rm -rf lib yarn.lock",
18
- "version": "node -p \"'export const version = \\'' + require('./package.json').version + '\\';'\" > src/version.ts && git add src/version.ts && git commit -m \"chore: gen version\""
18
+ "version": "node -p \"'export const version = \\'' + require('./package.json').version + '\\';'\" > src/version.ts"
19
19
  },
20
20
  "publishConfig": {
21
21
  "access": "public"