request-iframe 0.1.1 → 0.2.1
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/QUICKSTART.CN.md +4 -2
- package/QUICKSTART.md +4 -2
- package/README.CN.md +129 -33
- package/README.md +116 -15
- package/cdn/request-iframe-react.umd.js +3354 -0
- package/cdn/request-iframe-react.umd.js.map +1 -0
- package/cdn/request-iframe-react.umd.min.js +2 -0
- package/cdn/request-iframe-react.umd.min.js.map +1 -0
- package/cdn/request-iframe.umd.js +19761 -0
- package/cdn/request-iframe.umd.js.map +1 -0
- package/cdn/request-iframe.umd.min.js +4 -0
- package/cdn/request-iframe.umd.min.js.map +1 -0
- package/esm/api/client.js +29 -21
- package/esm/api/endpoint.js +229 -0
- package/esm/api/server.js +16 -8
- package/esm/constants/debug.js +17 -0
- package/esm/constants/index.js +84 -67
- package/esm/constants/log.js +11 -0
- package/esm/constants/messages.js +3 -0
- package/esm/constants/warn-once.js +15 -0
- package/esm/endpoint/facade.js +390 -0
- package/esm/endpoint/heartbeat/heartbeat.js +60 -0
- package/esm/endpoint/heartbeat/ping.js +20 -0
- package/esm/endpoint/index.js +13 -0
- package/esm/endpoint/infra/hub.js +316 -0
- package/esm/endpoint/infra/inbox.js +232 -0
- package/esm/endpoint/infra/outbox.js +408 -0
- package/esm/endpoint/stream/dispatcher.js +58 -0
- package/esm/endpoint/stream/errors.js +27 -0
- package/esm/endpoint/stream/factory.js +76 -0
- package/esm/endpoint/stream/file-auto-resolve.js +34 -0
- package/esm/endpoint/stream/file-writable.js +105 -0
- package/esm/endpoint/stream/handler.js +26 -0
- package/esm/{core → impl}/client.js +240 -317
- package/esm/{core → impl}/response.js +113 -155
- package/esm/impl/server.js +568 -0
- package/esm/index.js +13 -6
- package/esm/message/ack.js +27 -0
- package/esm/message/channel-cache.js +108 -0
- package/esm/message/channel.js +90 -4
- package/esm/message/dispatcher.js +115 -75
- package/esm/stream/error.js +22 -0
- package/esm/stream/index.js +3 -1
- package/esm/stream/readable-stream.js +45 -9
- package/esm/stream/stream-core.js +7 -2
- package/esm/stream/writable-stream.js +97 -26
- package/esm/utils/blob.js +16 -0
- package/esm/utils/cache.js +25 -76
- package/esm/utils/content-type.js +81 -0
- package/esm/utils/debug.js +156 -179
- package/esm/utils/hooks.js +130 -0
- package/esm/utils/id.js +14 -0
- package/esm/utils/iframe.js +20 -0
- package/esm/utils/index.js +11 -163
- package/esm/utils/is.js +3 -0
- package/esm/utils/logger.js +55 -0
- package/esm/utils/promise.js +3 -0
- package/esm/utils/window.js +31 -0
- package/library/api/client.d.ts.map +1 -1
- package/library/api/client.js +30 -22
- package/library/api/endpoint.d.ts +23 -0
- package/library/api/endpoint.d.ts.map +1 -0
- package/library/api/endpoint.js +235 -0
- package/library/api/server.d.ts +4 -1
- package/library/api/server.d.ts.map +1 -1
- package/library/api/server.js +16 -8
- package/library/constants/debug.d.ts +18 -0
- package/library/constants/debug.d.ts.map +1 -0
- package/library/constants/debug.js +23 -0
- package/library/constants/index.d.ts +22 -2
- package/library/constants/index.d.ts.map +1 -1
- package/library/constants/index.js +110 -67
- package/library/constants/log.d.ts +12 -0
- package/library/constants/log.d.ts.map +1 -0
- package/library/constants/log.js +17 -0
- package/library/constants/messages.d.ts +3 -0
- package/library/constants/messages.d.ts.map +1 -1
- package/library/constants/messages.js +3 -0
- package/library/constants/warn-once.d.ts +12 -0
- package/library/constants/warn-once.d.ts.map +1 -0
- package/library/constants/warn-once.js +22 -0
- package/library/endpoint/facade.d.ts +238 -0
- package/library/endpoint/facade.d.ts.map +1 -0
- package/library/endpoint/facade.js +398 -0
- package/library/endpoint/heartbeat/heartbeat.d.ts +34 -0
- package/library/endpoint/heartbeat/heartbeat.d.ts.map +1 -0
- package/library/endpoint/heartbeat/heartbeat.js +67 -0
- package/library/endpoint/heartbeat/ping.d.ts +18 -0
- package/library/endpoint/heartbeat/ping.d.ts.map +1 -0
- package/library/endpoint/heartbeat/ping.js +26 -0
- package/library/endpoint/index.d.ts +16 -0
- package/library/endpoint/index.d.ts.map +1 -0
- package/library/endpoint/index.js +114 -0
- package/library/endpoint/infra/hub.d.ts +170 -0
- package/library/endpoint/infra/hub.d.ts.map +1 -0
- package/library/endpoint/infra/hub.js +323 -0
- package/library/endpoint/infra/inbox.d.ts +73 -0
- package/library/endpoint/infra/inbox.d.ts.map +1 -0
- package/library/endpoint/infra/inbox.js +239 -0
- package/library/endpoint/infra/outbox.d.ts +149 -0
- package/library/endpoint/infra/outbox.d.ts.map +1 -0
- package/library/endpoint/infra/outbox.js +415 -0
- package/library/endpoint/stream/dispatcher.d.ts +33 -0
- package/library/endpoint/stream/dispatcher.d.ts.map +1 -0
- package/library/endpoint/stream/dispatcher.js +66 -0
- package/library/endpoint/stream/errors.d.ts +20 -0
- package/library/endpoint/stream/errors.d.ts.map +1 -0
- package/library/endpoint/stream/errors.js +32 -0
- package/library/endpoint/stream/factory.d.ts +44 -0
- package/library/endpoint/stream/factory.d.ts.map +1 -0
- package/library/endpoint/stream/factory.js +82 -0
- package/library/endpoint/stream/file-auto-resolve.d.ts +26 -0
- package/library/endpoint/stream/file-auto-resolve.d.ts.map +1 -0
- package/library/endpoint/stream/file-auto-resolve.js +41 -0
- package/library/endpoint/stream/file-writable.d.ts +33 -0
- package/library/endpoint/stream/file-writable.d.ts.map +1 -0
- package/library/endpoint/stream/file-writable.js +115 -0
- package/library/endpoint/stream/handler.d.ts +20 -0
- package/library/endpoint/stream/handler.d.ts.map +1 -0
- package/library/endpoint/stream/handler.js +32 -0
- package/library/{core → impl}/client.d.ts +16 -13
- package/library/impl/client.d.ts.map +1 -0
- package/library/{core → impl}/client.js +251 -330
- package/library/{core → impl}/request.d.ts.map +1 -1
- package/library/{core → impl}/response.d.ts +5 -10
- package/library/impl/response.d.ts.map +1 -0
- package/library/{core → impl}/response.js +113 -155
- package/library/{core → impl}/server.d.ts +22 -55
- package/library/impl/server.d.ts.map +1 -0
- package/library/impl/server.js +575 -0
- package/library/index.d.ts +13 -6
- package/library/index.d.ts.map +1 -1
- package/library/index.js +16 -16
- package/library/message/ack.d.ts +15 -0
- package/library/message/ack.d.ts.map +1 -0
- package/library/message/ack.js +33 -0
- package/library/message/channel-cache.d.ts +26 -0
- package/library/message/channel-cache.d.ts.map +1 -0
- package/library/message/channel-cache.js +115 -0
- package/library/message/channel.d.ts +53 -6
- package/library/message/channel.d.ts.map +1 -1
- package/library/message/channel.js +94 -8
- package/library/message/dispatcher.d.ts +7 -0
- package/library/message/dispatcher.d.ts.map +1 -1
- package/library/message/dispatcher.js +116 -76
- package/library/stream/error.d.ts +24 -0
- package/library/stream/error.d.ts.map +1 -0
- package/library/stream/error.js +29 -0
- package/library/stream/index.d.ts +4 -1
- package/library/stream/index.d.ts.map +1 -1
- package/library/stream/index.js +7 -4
- package/library/stream/readable-stream.d.ts.map +1 -1
- package/library/stream/readable-stream.js +46 -10
- package/library/stream/stream-core.d.ts.map +1 -1
- package/library/stream/stream-core.js +6 -1
- package/library/stream/writable-stream.d.ts.map +1 -1
- package/library/stream/writable-stream.js +99 -28
- package/library/types/index.d.ts +15 -19
- package/library/types/index.d.ts.map +1 -1
- package/library/utils/blob.d.ts +3 -0
- package/library/utils/blob.d.ts.map +1 -0
- package/library/utils/blob.js +22 -0
- package/library/utils/cache.d.ts +10 -20
- package/library/utils/cache.d.ts.map +1 -1
- package/library/utils/cache.js +25 -79
- package/library/utils/content-type.d.ts +13 -0
- package/library/utils/content-type.d.ts.map +1 -0
- package/library/utils/content-type.js +87 -0
- package/library/utils/debug.d.ts.map +1 -1
- package/library/utils/debug.js +155 -177
- package/library/utils/hooks.d.ts +30 -0
- package/library/utils/hooks.d.ts.map +1 -0
- package/library/utils/hooks.js +139 -0
- package/library/utils/id.d.ts +9 -0
- package/library/utils/id.d.ts.map +1 -0
- package/library/utils/id.js +21 -0
- package/library/utils/iframe.d.ts +5 -0
- package/library/utils/iframe.d.ts.map +1 -0
- package/library/utils/iframe.js +25 -0
- package/library/utils/index.d.ts +7 -34
- package/library/utils/index.d.ts.map +1 -1
- package/library/utils/index.js +58 -194
- package/library/utils/is.d.ts +2 -0
- package/library/utils/is.d.ts.map +1 -0
- package/library/utils/is.js +9 -0
- package/library/utils/logger.d.ts +13 -0
- package/library/utils/logger.d.ts.map +1 -0
- package/library/utils/logger.js +63 -0
- package/library/utils/promise.d.ts +2 -0
- package/library/utils/promise.d.ts.map +1 -0
- package/library/utils/promise.js +9 -0
- package/library/utils/window.d.ts +2 -0
- package/library/utils/window.d.ts.map +1 -0
- package/library/utils/window.js +38 -0
- package/package.json +49 -2
- package/react/package.json +2 -1
- package/esm/core/client-server.js +0 -294
- package/esm/core/server.js +0 -776
- package/library/core/client-server.d.ts +0 -97
- package/library/core/client-server.d.ts.map +0 -1
- package/library/core/client-server.js +0 -301
- package/library/core/client.d.ts.map +0 -1
- package/library/core/response.d.ts.map +0 -1
- package/library/core/server.d.ts.map +0 -1
- package/library/core/server.js +0 -781
- /package/esm/{core → impl}/request.js +0 -0
- /package/library/{core → impl}/request.d.ts +0 -0
- /package/library/{core → impl}/request.js +0 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
4
|
+
require("core-js/modules/es.array.from.js");
|
|
5
|
+
require("core-js/modules/es.array.slice.js");
|
|
6
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
7
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
8
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
exports.SyncHook = exports.AsyncSeriesHook = void 0;
|
|
13
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
14
|
+
require("core-js/modules/es.array.index-of.js");
|
|
15
|
+
require("core-js/modules/es.array.iterator.js");
|
|
16
|
+
require("core-js/modules/es.array.splice.js");
|
|
17
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
18
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
19
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
21
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
22
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
23
|
+
/**
|
|
24
|
+
* A tiny "Tapable-like" hook implementation.
|
|
25
|
+
*
|
|
26
|
+
* Design goals:
|
|
27
|
+
* - Zero dependencies
|
|
28
|
+
* - Browser-friendly
|
|
29
|
+
* - Familiar API surface (tap/call, tapPromise/promise)
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* SyncHook - runs taps synchronously in registration order.
|
|
34
|
+
*/
|
|
35
|
+
class SyncHook {
|
|
36
|
+
constructor() {
|
|
37
|
+
(0, _defineProperty2.default)(this, "taps", []);
|
|
38
|
+
}
|
|
39
|
+
tap(name, fn) {
|
|
40
|
+
var tap = {
|
|
41
|
+
name,
|
|
42
|
+
fn
|
|
43
|
+
};
|
|
44
|
+
this.taps.push(tap);
|
|
45
|
+
return () => {
|
|
46
|
+
var idx = this.taps.indexOf(tap);
|
|
47
|
+
if (idx >= 0) this.taps.splice(idx, 1);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
call(...args) {
|
|
51
|
+
var _iterator = _createForOfIteratorHelper(this.taps),
|
|
52
|
+
_step;
|
|
53
|
+
try {
|
|
54
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
55
|
+
var t = _step.value;
|
|
56
|
+
t.fn(...args);
|
|
57
|
+
}
|
|
58
|
+
} catch (err) {
|
|
59
|
+
_iterator.e(err);
|
|
60
|
+
} finally {
|
|
61
|
+
_iterator.f();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* AsyncSeriesHook - runs taps in series, awaiting each.
|
|
68
|
+
*/
|
|
69
|
+
exports.SyncHook = SyncHook;
|
|
70
|
+
class AsyncSeriesHook {
|
|
71
|
+
constructor() {
|
|
72
|
+
(0, _defineProperty2.default)(this, "taps", []);
|
|
73
|
+
}
|
|
74
|
+
tapPromise(name, fn) {
|
|
75
|
+
var tap = {
|
|
76
|
+
name,
|
|
77
|
+
fn
|
|
78
|
+
};
|
|
79
|
+
this.taps.push(tap);
|
|
80
|
+
return () => {
|
|
81
|
+
var idx = this.taps.indexOf(tap);
|
|
82
|
+
if (idx >= 0) this.taps.splice(idx, 1);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
tap(name, fn) {
|
|
86
|
+
return this.tapPromise(name, /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(...args) {
|
|
87
|
+
return _regenerator.default.wrap(function (_context) {
|
|
88
|
+
while (1) switch (_context.prev = _context.next) {
|
|
89
|
+
case 0:
|
|
90
|
+
_context.next = 1;
|
|
91
|
+
return fn(...args);
|
|
92
|
+
case 1:
|
|
93
|
+
case "end":
|
|
94
|
+
return _context.stop();
|
|
95
|
+
}
|
|
96
|
+
}, _callee);
|
|
97
|
+
})));
|
|
98
|
+
}
|
|
99
|
+
promise(...args) {
|
|
100
|
+
var _this = this;
|
|
101
|
+
return (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
102
|
+
var _iterator2, _step2, t, _t;
|
|
103
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
104
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
105
|
+
case 0:
|
|
106
|
+
_iterator2 = _createForOfIteratorHelper(_this.taps);
|
|
107
|
+
_context2.prev = 1;
|
|
108
|
+
_iterator2.s();
|
|
109
|
+
case 2:
|
|
110
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
111
|
+
_context2.next = 4;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
t = _step2.value;
|
|
115
|
+
_context2.next = 3;
|
|
116
|
+
return t.fn(...args);
|
|
117
|
+
case 3:
|
|
118
|
+
_context2.next = 2;
|
|
119
|
+
break;
|
|
120
|
+
case 4:
|
|
121
|
+
_context2.next = 6;
|
|
122
|
+
break;
|
|
123
|
+
case 5:
|
|
124
|
+
_context2.prev = 5;
|
|
125
|
+
_t = _context2["catch"](1);
|
|
126
|
+
_iterator2.e(_t);
|
|
127
|
+
case 6:
|
|
128
|
+
_context2.prev = 6;
|
|
129
|
+
_iterator2.f();
|
|
130
|
+
return _context2.finish(6);
|
|
131
|
+
case 7:
|
|
132
|
+
case "end":
|
|
133
|
+
return _context2.stop();
|
|
134
|
+
}
|
|
135
|
+
}, _callee2, null, [[1, 5, 6, 7]]);
|
|
136
|
+
}))();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.AsyncSeriesHook = AsyncSeriesHook;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../src/utils/id.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generateInstanceId = generateInstanceId;
|
|
7
|
+
exports.generateRequestId = generateRequestId;
|
|
8
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
9
|
+
/**
|
|
10
|
+
* Generate unique request ID
|
|
11
|
+
*/
|
|
12
|
+
function generateRequestId() {
|
|
13
|
+
return `req_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Generate unique instance ID
|
|
18
|
+
*/
|
|
19
|
+
function generateInstanceId() {
|
|
20
|
+
return `inst_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iframe.d.ts","sourceRoot":"","sources":["../../src/utils/iframe.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CASvE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getIframeTargetOrigin = getIframeTargetOrigin;
|
|
7
|
+
require("core-js/modules/es.array.iterator.js");
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
require("core-js/modules/web.url.js");
|
|
10
|
+
require("core-js/modules/web.url.to-json.js");
|
|
11
|
+
require("core-js/modules/web.url-search-params.js");
|
|
12
|
+
var _constants = require("../constants");
|
|
13
|
+
/**
|
|
14
|
+
* Derive targetOrigin from iframe.src
|
|
15
|
+
*/
|
|
16
|
+
function getIframeTargetOrigin(iframe) {
|
|
17
|
+
if (!iframe.src) {
|
|
18
|
+
return _constants.OriginConstant.ANY;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
return new URL(iframe.src).origin;
|
|
22
|
+
} catch (e) {
|
|
23
|
+
return _constants.OriginConstant.ANY;
|
|
24
|
+
}
|
|
25
|
+
}
|
package/library/utils/index.d.ts
CHANGED
|
@@ -1,40 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
export declare function generateInstanceId(): string;
|
|
9
|
-
/**
|
|
10
|
-
* Derive targetOrigin from iframe.src
|
|
11
|
-
*/
|
|
12
|
-
export declare function getIframeTargetOrigin(iframe: HTMLIFrameElement): string;
|
|
13
|
-
export declare function isPromise<T>(value: any): value is Promise<T>;
|
|
14
|
-
/**
|
|
15
|
-
* Check if target window is still available (not closed/removed)
|
|
16
|
-
* @param targetWindow Target window to check
|
|
17
|
-
* @returns true if window is available, false otherwise
|
|
18
|
-
*/
|
|
19
|
-
export declare function isWindowAvailable(targetWindow: Window | null | undefined): boolean;
|
|
1
|
+
export { generateRequestId, generateInstanceId } from './id';
|
|
2
|
+
export { getIframeTargetOrigin } from './iframe';
|
|
3
|
+
export { isPromise } from './promise';
|
|
4
|
+
export { isFunction } from './is';
|
|
5
|
+
export { isWindowAvailable } from './window';
|
|
6
|
+
export { detectContentType } from './content-type';
|
|
20
7
|
export { createPostMessage, isValidPostMessage, validatePostMessage, validateProtocolVersion, isRequestIframeMessage, getProtocolVersion, isCompatibleVersion } from './protocol';
|
|
21
|
-
export * from './cache';
|
|
22
8
|
export * from './path-match';
|
|
23
9
|
export * from './origin';
|
|
24
10
|
export * from './cookie';
|
|
25
11
|
export { RequestIframeError } from './error';
|
|
26
|
-
|
|
27
|
-
* Detect Content-Type based on data type
|
|
28
|
-
* @param data The data to detect Content-Type for
|
|
29
|
-
* @param options Options for detection
|
|
30
|
-
* @param options.checkStream Whether to check for IframeWritableStream (default: false)
|
|
31
|
-
* @param options.isIframeWritableStream Optional function to check if data is a stream (required if checkStream is true)
|
|
32
|
-
* @returns The detected Content-Type, or null if Content-Type should not be auto-set
|
|
33
|
-
*/
|
|
34
|
-
export declare function detectContentType(data: any, options?: {
|
|
35
|
-
checkStream?: boolean;
|
|
36
|
-
isIframeWritableStream?: (value: any) => boolean;
|
|
37
|
-
}): string | null;
|
|
38
|
-
/** Convert Blob to base64 string */
|
|
39
|
-
export declare function blobToBase64(blob: Blob): Promise<string>;
|
|
12
|
+
export { blobToBase64 } from './blob';
|
|
40
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAQpB,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAKzB,cAAc,UAAU,CAAC;AAGzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC"}
|
package/library/utils/index.js
CHANGED
|
@@ -9,9 +9,9 @@ var _exportNames = {
|
|
|
9
9
|
generateInstanceId: true,
|
|
10
10
|
getIframeTargetOrigin: true,
|
|
11
11
|
isPromise: true,
|
|
12
|
+
isFunction: true,
|
|
12
13
|
isWindowAvailable: true,
|
|
13
14
|
detectContentType: true,
|
|
14
|
-
blobToBase64: true,
|
|
15
15
|
createPostMessage: true,
|
|
16
16
|
isValidPostMessage: true,
|
|
17
17
|
validatePostMessage: true,
|
|
@@ -19,7 +19,8 @@ var _exportNames = {
|
|
|
19
19
|
isRequestIframeMessage: true,
|
|
20
20
|
getProtocolVersion: true,
|
|
21
21
|
isCompatibleVersion: true,
|
|
22
|
-
RequestIframeError: true
|
|
22
|
+
RequestIframeError: true,
|
|
23
|
+
blobToBase64: true
|
|
23
24
|
};
|
|
24
25
|
Object.defineProperty(exports, "RequestIframeError", {
|
|
25
26
|
enumerable: true,
|
|
@@ -27,17 +28,42 @@ Object.defineProperty(exports, "RequestIframeError", {
|
|
|
27
28
|
return _error.RequestIframeError;
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
|
-
exports
|
|
31
|
+
Object.defineProperty(exports, "blobToBase64", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function get() {
|
|
34
|
+
return _blob.blobToBase64;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
31
37
|
Object.defineProperty(exports, "createPostMessage", {
|
|
32
38
|
enumerable: true,
|
|
33
39
|
get: function get() {
|
|
34
40
|
return _protocol.createPostMessage;
|
|
35
41
|
}
|
|
36
42
|
});
|
|
37
|
-
exports
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
Object.defineProperty(exports, "detectContentType", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _contentType.detectContentType;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "generateInstanceId", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function get() {
|
|
52
|
+
return _id.generateInstanceId;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "generateRequestId", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function get() {
|
|
58
|
+
return _id.generateRequestId;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "getIframeTargetOrigin", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function get() {
|
|
64
|
+
return _iframe.getIframeTargetOrigin;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
41
67
|
Object.defineProperty(exports, "getProtocolVersion", {
|
|
42
68
|
enumerable: true,
|
|
43
69
|
get: function get() {
|
|
@@ -50,7 +76,18 @@ Object.defineProperty(exports, "isCompatibleVersion", {
|
|
|
50
76
|
return _protocol.isCompatibleVersion;
|
|
51
77
|
}
|
|
52
78
|
});
|
|
53
|
-
exports
|
|
79
|
+
Object.defineProperty(exports, "isFunction", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function get() {
|
|
82
|
+
return _is.isFunction;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(exports, "isPromise", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function get() {
|
|
88
|
+
return _promise.isPromise;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
54
91
|
Object.defineProperty(exports, "isRequestIframeMessage", {
|
|
55
92
|
enumerable: true,
|
|
56
93
|
get: function get() {
|
|
@@ -63,7 +100,12 @@ Object.defineProperty(exports, "isValidPostMessage", {
|
|
|
63
100
|
return _protocol.isValidPostMessage;
|
|
64
101
|
}
|
|
65
102
|
});
|
|
66
|
-
exports
|
|
103
|
+
Object.defineProperty(exports, "isWindowAvailable", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function get() {
|
|
106
|
+
return _window.isWindowAvailable;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
67
109
|
Object.defineProperty(exports, "validatePostMessage", {
|
|
68
110
|
enumerable: true,
|
|
69
111
|
get: function get() {
|
|
@@ -76,29 +118,13 @@ Object.defineProperty(exports, "validateProtocolVersion", {
|
|
|
76
118
|
return _protocol.validateProtocolVersion;
|
|
77
119
|
}
|
|
78
120
|
});
|
|
79
|
-
require("
|
|
80
|
-
require("
|
|
81
|
-
require("
|
|
82
|
-
require("
|
|
83
|
-
require("
|
|
84
|
-
require("
|
|
85
|
-
require("core-js/modules/web.url.js");
|
|
86
|
-
require("core-js/modules/web.url.to-json.js");
|
|
87
|
-
require("core-js/modules/web.url-search-params.js");
|
|
88
|
-
var _constants = require("../constants");
|
|
121
|
+
var _id = require("./id");
|
|
122
|
+
var _iframe = require("./iframe");
|
|
123
|
+
var _promise = require("./promise");
|
|
124
|
+
var _is = require("./is");
|
|
125
|
+
var _window = require("./window");
|
|
126
|
+
var _contentType = require("./content-type");
|
|
89
127
|
var _protocol = require("./protocol");
|
|
90
|
-
var _cache = require("./cache");
|
|
91
|
-
Object.keys(_cache).forEach(function (key) {
|
|
92
|
-
if (key === "default" || key === "__esModule") return;
|
|
93
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
94
|
-
if (key in exports && exports[key] === _cache[key]) return;
|
|
95
|
-
Object.defineProperty(exports, key, {
|
|
96
|
-
enumerable: true,
|
|
97
|
-
get: function get() {
|
|
98
|
-
return _cache[key];
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
128
|
var _pathMatch = require("./path-match");
|
|
103
129
|
Object.keys(_pathMatch).forEach(function (key) {
|
|
104
130
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -136,166 +162,4 @@ Object.keys(_cookie).forEach(function (key) {
|
|
|
136
162
|
});
|
|
137
163
|
});
|
|
138
164
|
var _error = require("./error");
|
|
139
|
-
|
|
140
|
-
* Generate unique request ID
|
|
141
|
-
*/
|
|
142
|
-
function generateRequestId() {
|
|
143
|
-
return `req_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Generate unique instance ID
|
|
148
|
-
*/
|
|
149
|
-
function generateInstanceId() {
|
|
150
|
-
return `inst_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Derive targetOrigin from iframe.src
|
|
155
|
-
*/
|
|
156
|
-
function getIframeTargetOrigin(iframe) {
|
|
157
|
-
if (!iframe.src) {
|
|
158
|
-
return _constants.OriginConstant.ANY;
|
|
159
|
-
}
|
|
160
|
-
try {
|
|
161
|
-
return new URL(iframe.src).origin;
|
|
162
|
-
} catch (e) {
|
|
163
|
-
return _constants.OriginConstant.ANY;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function isPromise(value) {
|
|
167
|
-
return value !== null && typeof value === 'object' && 'then' in value;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Check if target window is still available (not closed/removed)
|
|
172
|
-
* @param targetWindow Target window to check
|
|
173
|
-
* @returns true if window is available, false otherwise
|
|
174
|
-
*/
|
|
175
|
-
function isWindowAvailable(targetWindow) {
|
|
176
|
-
if (!targetWindow) {
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
try {
|
|
180
|
-
// Must have postMessage to be a usable target
|
|
181
|
-
if (typeof targetWindow.postMessage !== 'function') {
|
|
182
|
-
return false;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// For windows opened via window.open(), check closed property
|
|
186
|
-
if ('closed' in targetWindow && targetWindow.closed === true) {
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Avoid touching cross-origin properties (like document) which may throw.
|
|
191
|
-
// If closed is not true and postMessage exists, treat as available.
|
|
192
|
-
return true;
|
|
193
|
-
} catch (e) {
|
|
194
|
-
// If accessing window properties throws an error, window is likely closed
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
// Export protocol-related functions
|
|
199
|
-
|
|
200
|
-
// Export cache-related functions
|
|
201
|
-
|
|
202
|
-
// Export path matching functions
|
|
203
|
-
|
|
204
|
-
// Export origin matching functions
|
|
205
|
-
|
|
206
|
-
// ack is a reserved protocol field (internal). Do not export helpers publicly.
|
|
207
|
-
|
|
208
|
-
// Export Cookie-related functions
|
|
209
|
-
|
|
210
|
-
// Export Error class
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Detect Content-Type based on data type
|
|
214
|
-
* @param data The data to detect Content-Type for
|
|
215
|
-
* @param options Options for detection
|
|
216
|
-
* @param options.checkStream Whether to check for IframeWritableStream (default: false)
|
|
217
|
-
* @param options.isIframeWritableStream Optional function to check if data is a stream (required if checkStream is true)
|
|
218
|
-
* @returns The detected Content-Type, or null if Content-Type should not be auto-set
|
|
219
|
-
*/
|
|
220
|
-
function detectContentType(data, options) {
|
|
221
|
-
if (data === null || data === undefined) return null;
|
|
222
|
-
var _ref = options || {},
|
|
223
|
-
_ref$checkStream = _ref.checkStream,
|
|
224
|
-
checkStream = _ref$checkStream === void 0 ? false : _ref$checkStream,
|
|
225
|
-
isIframeWritableStream = _ref.isIframeWritableStream;
|
|
226
|
-
|
|
227
|
-
// Stream - handled separately (only for response)
|
|
228
|
-
if (checkStream && isIframeWritableStream) {
|
|
229
|
-
if (isIframeWritableStream(data)) {
|
|
230
|
-
return null; // Stream will be handled by sendStream
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// File
|
|
235
|
-
if (typeof File !== 'undefined' && data instanceof File) {
|
|
236
|
-
return data.type || 'application/octet-stream';
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// Blob
|
|
240
|
-
if (typeof Blob !== 'undefined' && data instanceof Blob) {
|
|
241
|
-
return data.type || 'application/octet-stream';
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// ArrayBuffer
|
|
245
|
-
if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {
|
|
246
|
-
return 'application/octet-stream';
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// FormData
|
|
250
|
-
if (typeof FormData !== 'undefined' && data instanceof FormData) {
|
|
251
|
-
// FormData typically doesn't need Content-Type header (browser sets it with boundary)
|
|
252
|
-
return null;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// URLSearchParams
|
|
256
|
-
if (typeof URLSearchParams !== 'undefined' && data instanceof URLSearchParams) {
|
|
257
|
-
return 'application/x-www-form-urlencoded';
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// String - check if it's JSON string
|
|
261
|
-
if (typeof data === 'string') {
|
|
262
|
-
// Try to parse as JSON, if successful, treat as JSON
|
|
263
|
-
try {
|
|
264
|
-
JSON.parse(data);
|
|
265
|
-
return 'application/json';
|
|
266
|
-
} catch (_unused) {
|
|
267
|
-
return 'text/plain; charset=utf-8';
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
// Number, boolean - treat as JSON
|
|
272
|
-
if (typeof data === 'number' || typeof data === 'boolean') {
|
|
273
|
-
return 'application/json';
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// Plain object or array - treat as JSON
|
|
277
|
-
if (typeof data === 'object') {
|
|
278
|
-
// Exclude common binary/file types (already checked above, but double-check for safety)
|
|
279
|
-
if (typeof Blob !== 'undefined' && data instanceof Blob) return null;
|
|
280
|
-
if (typeof File !== 'undefined' && data instanceof File) return null;
|
|
281
|
-
if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) return null;
|
|
282
|
-
if (typeof FormData !== 'undefined' && data instanceof FormData) return null;
|
|
283
|
-
if (typeof URLSearchParams !== 'undefined' && data instanceof URLSearchParams) return null;
|
|
284
|
-
return 'application/json';
|
|
285
|
-
}
|
|
286
|
-
return null;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/** Convert Blob to base64 string */
|
|
290
|
-
function blobToBase64(blob) {
|
|
291
|
-
return new Promise((resolve, reject) => {
|
|
292
|
-
var reader = new FileReader();
|
|
293
|
-
reader.onloadend = () => {
|
|
294
|
-
var result = reader.result;
|
|
295
|
-
var base64 = result.includes(',') ? result.split(',')[1] : result;
|
|
296
|
-
resolve(base64);
|
|
297
|
-
};
|
|
298
|
-
reader.onerror = reject;
|
|
299
|
-
reader.readAsDataURL(blob);
|
|
300
|
-
});
|
|
301
|
-
}
|
|
165
|
+
var _blob = require("./blob");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is.d.ts","sourceRoot":"","sources":["../../src/utils/is.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,KAAK,SAAS,GAAG,EAAE,GAAG,GAAG,EAAE,EAAE,OAAO,GAAG,GAAG,EACnE,KAAK,EAAE,GAAG,GACT,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAEtC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RequestIframeLogLevel } from '../types';
|
|
2
|
+
export declare function getRequestIframeLogLevel(): RequestIframeLogLevel;
|
|
3
|
+
export declare function setRequestIframeLogLevel(level: RequestIframeLogLevel): void;
|
|
4
|
+
/**
|
|
5
|
+
* Ensure current log level is at least as verbose as `level`.
|
|
6
|
+
* - Example: current 'warn' + ensure 'trace' => becomes 'trace'
|
|
7
|
+
*/
|
|
8
|
+
export declare function ensureRequestIframeLogLevel(level: RequestIframeLogLevel): void;
|
|
9
|
+
/**
|
|
10
|
+
* Log with level gating + unified prefix.
|
|
11
|
+
*/
|
|
12
|
+
export declare function requestIframeLog(level: Exclude<RequestIframeLogLevel, 'silent'>, message: string, data?: unknown): void;
|
|
13
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAsBtD,wBAAgB,wBAAwB,IAAI,qBAAqB,CAEhE;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAE3E;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAI9E;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,qBAAqB,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAkBvH"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ensureRequestIframeLogLevel = ensureRequestIframeLogLevel;
|
|
7
|
+
exports.getRequestIframeLogLevel = getRequestIframeLogLevel;
|
|
8
|
+
exports.requestIframeLog = requestIframeLog;
|
|
9
|
+
exports.setRequestIframeLogLevel = setRequestIframeLogLevel;
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
/**
|
|
12
|
+
* Built-in leveled logger for request-iframe.
|
|
13
|
+
*
|
|
14
|
+
* - Default level is 'warn' (prints warn/error only)
|
|
15
|
+
* - Trace/debug tools can raise to 'info' or 'trace'
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
var DEBUG_PREFIX = '[request-iframe]';
|
|
19
|
+
var levelOrder = {
|
|
20
|
+
[_constants.LogLevel.TRACE]: 10,
|
|
21
|
+
[_constants.LogLevel.INFO]: 20,
|
|
22
|
+
[_constants.LogLevel.WARN]: 30,
|
|
23
|
+
[_constants.LogLevel.ERROR]: 40,
|
|
24
|
+
[_constants.LogLevel.SILENT]: 100
|
|
25
|
+
};
|
|
26
|
+
var currentLevel = _constants.LogLevel.WARN;
|
|
27
|
+
function getRequestIframeLogLevel() {
|
|
28
|
+
return currentLevel;
|
|
29
|
+
}
|
|
30
|
+
function setRequestIframeLogLevel(level) {
|
|
31
|
+
currentLevel = level;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Ensure current log level is at least as verbose as `level`.
|
|
36
|
+
* - Example: current 'warn' + ensure 'trace' => becomes 'trace'
|
|
37
|
+
*/
|
|
38
|
+
function ensureRequestIframeLogLevel(level) {
|
|
39
|
+
if (levelOrder[level] < levelOrder[currentLevel]) {
|
|
40
|
+
currentLevel = level;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function shouldLog(level) {
|
|
44
|
+
return levelOrder[level] >= levelOrder[currentLevel];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Log with level gating + unified prefix.
|
|
49
|
+
*/
|
|
50
|
+
function requestIframeLog(level, message, data) {
|
|
51
|
+
if (currentLevel === _constants.LogLevel.SILENT) return;
|
|
52
|
+
if (!shouldLog(level)) return;
|
|
53
|
+
var timestamp = new Date().toISOString();
|
|
54
|
+
var prefix = `${DEBUG_PREFIX} [${timestamp}] [${level.toUpperCase()}]`;
|
|
55
|
+
var prefixStyle = 'font-weight:bold';
|
|
56
|
+
var messageStyle = level === _constants.LogLevel.INFO ? 'color: #1976d2' : '';
|
|
57
|
+
var method = level === _constants.LogLevel.TRACE ? 'debug' : level;
|
|
58
|
+
if (data !== undefined) {
|
|
59
|
+
console[method](`%c${prefix}%c ${message}`, prefixStyle, messageStyle, data);
|
|
60
|
+
} else {
|
|
61
|
+
console[method](`%c${prefix}%c ${message}`, prefixStyle, messageStyle);
|
|
62
|
+
}
|
|
63
|
+
}
|