@wutiange/log-listener-plugin 2.0.1 → 2.0.2-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wutiange/log-listener-plugin",
3
- "version": "2.0.1",
3
+ "version": "2.0.2-alpha.1",
4
4
  "description": "log-record 客户端对应的的插件\r\nLog-record client corresponding plugin",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/dist/console.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/console.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const logPlugin_1 = __importDefault(require("./src/logPlugin"));
7
- const common = require('./src/common');
8
- console.log = (...data) => {
9
- logPlugin_1.default.log(...data);
10
- common.log(...data);
11
- };
12
- console.warn = (...data) => {
13
- logPlugin_1.default.warn(...data);
14
- common.warn(...data);
15
- };
16
- console.error = (...data) => {
17
- logPlugin_1.default.error(...data);
18
- common.error(...data);
19
- };
20
- //# sourceMappingURL=console.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"console.js","sourceRoot":"","sources":["../console.ts"],"names":[],"mappings":";;;;;AAKA,gEAAqC;AACrC,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AACvC,OAAO,CAAC,GAAG,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;IAC/B,mBAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACpB,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;AACtB,CAAC,CAAC;AAEF,OAAO,CAAC,IAAI,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;IAChC,mBAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACrB,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF,OAAO,CAAC,KAAK,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;IACjC,mBAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;IACtB,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;AACxB,CAAC,CAAC"}
package/dist/fetch.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/fetch.js DELETED
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const index_1 = __importDefault(require("./index"));
16
- const utils_1 = require("./src/utils");
17
- const common = require('./src/common');
18
- global.fetch = (input, init) => __awaiter(void 0, void 0, void 0, function* () {
19
- const uniqueId = (Date.now() + Math.random()).toString(16);
20
- index_1.default.uniqueReq(uniqueId, input, init);
21
- let isFetchFinished = false;
22
- let isTimeout = false;
23
- const timeout = index_1.default.getTimeout();
24
- if (timeout !== null) {
25
- (0, utils_1.sleep)(timeout).then(() => {
26
- if (!isFetchFinished) {
27
- isTimeout = true;
28
- index_1.default.resTimeout(uniqueId);
29
- }
30
- });
31
- }
32
- try {
33
- const response = yield common.tempFetch(input, init);
34
- isFetchFinished = true;
35
- if (response instanceof Response && !isTimeout) {
36
- index_1.default.uniqueRes(uniqueId, response.clone());
37
- }
38
- return response;
39
- }
40
- catch (error) {
41
- isFetchFinished = true;
42
- if (!isTimeout) {
43
- index_1.default.resResponseError(uniqueId);
44
- }
45
- throw new Error(error);
46
- }
47
- });
48
- //# sourceMappingURL=fetch.js.map
package/dist/fetch.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,oDAA6B;AAC7B,uCAAkC;AAElC,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAEvC,MAAM,CAAC,KAAK,GAAG,CAAO,KAAwB,EAAE,IAAkB,EAAE,EAAE;IACpE,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC3D,eAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACxC,IAAI,eAAe,GAAG,KAAK,CAAC;IAC5B,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,MAAM,OAAO,GAAG,eAAM,CAAC,UAAU,EAAE,CAAA;IACnC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,IAAA,aAAK,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACvB,IAAI,CAAC,eAAe,EAAE,CAAC;gBACrB,SAAS,GAAG,IAAI,CAAC;gBACjB,eAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACrD,eAAe,GAAG,IAAI,CAAC;QACvB,IAAI,QAAQ,YAAY,QAAQ,IAAI,CAAC,SAAS,EAAE,CAAC;YAC/C,eAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,eAAe,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,eAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACpC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;AACH,CAAC,CAAA,CAAC"}
@@ -1 +0,0 @@
1
- import '../../console';
@@ -1,29 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- require("../../console");
7
- const index_1 = __importDefault(require("../../index"));
8
- describe("重写日志", () => {
9
- it("log 没有提前设置 url", () => {
10
- console.log("log 是否正常打印");
11
- expect(1).toBe(1);
12
- });
13
- it("log 提前设置了 url", () => {
14
- index_1.default.setBaseUrl("http://192.168.118.103");
15
- console.log("log 是否正常打印");
16
- expect(1).toBe(1);
17
- });
18
- it('warn', () => {
19
- index_1.default.setBaseUrl("http://192.168.118.103");
20
- console.warn("warn 是否正常打印");
21
- expect(1).toBe(1);
22
- });
23
- it('error', () => {
24
- index_1.default.setBaseUrl("http://192.168.118.103");
25
- console.error("error 是否正常打印");
26
- expect(1).toBe(1);
27
- });
28
- });
29
- //# sourceMappingURL=console.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"console.test.js","sourceRoot":"","sources":["../../../src/__tests__/console.test.ts"],"names":[],"mappings":";;;;;AAAA,yBAAsB;AACtB,wDAAgC;AAChC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IACpB,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QACzB,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;QACvB,eAAM,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAA;QAC3C,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QACzB,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACd,eAAM,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAA;QAC3C,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QAC3B,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACf,eAAM,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAA;QAC3C,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QAC7B,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
File without changes
File without changes
File without changes