@nocobase/utils 0.7.0-alpha.8 → 0.7.0-alpha.80
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/lib/index.d.ts +0 -1
- package/lib/index.js +69 -18
- package/lib/merge.js +23 -12
- package/lib/mixin/AsyncEmitter.js +70 -59
- package/lib/mixin/index.js +11 -10
- package/lib/registry.js +44 -29
- package/lib/uid.js +17 -12
- package/package.json +2 -7
- package/esm/index.d.ts +0 -6
- package/esm/index.js +0 -7
- package/esm/index.js.map +0 -1
- package/esm/merge.d.ts +0 -1
- package/esm/merge.js +0 -8
- package/esm/merge.js.map +0 -1
- package/esm/mixin/AsyncEmitter.d.ts +0 -3
- package/esm/mixin/AsyncEmitter.js +0 -59
- package/esm/mixin/AsyncEmitter.js.map +0 -1
- package/esm/mixin/index.d.ts +0 -1
- package/esm/mixin/index.js +0 -9
- package/esm/mixin/index.js.map +0 -1
- package/esm/registry.d.ts +0 -14
- package/esm/registry.js +0 -30
- package/esm/registry.js.map +0 -1
- package/esm/uid.d.ts +0 -1
- package/esm/uid.js +0 -10
- package/esm/uid.js.map +0 -1
- package/esm/umiConfig.d.ts +0 -17
- package/esm/umiConfig.js +0 -30
- package/esm/umiConfig.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/merge.js.map +0 -1
- package/lib/mixin/AsyncEmitter.js.map +0 -1
- package/lib/mixin/index.js.map +0 -1
- package/lib/registry.js.map +0 -1
- package/lib/uid.js.map +0 -1
- package/lib/umiConfig.d.ts +0 -17
- package/lib/umiConfig.js +0 -34
- package/lib/umiConfig.js.map +0 -1
- package/tsconfig.build.json +0 -9
- package/umiConfig.d.ts +0 -17
- package/umiConfig.js +0 -38
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,19 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Object.defineProperty(exports,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _merge = require("./merge");
|
|
8
|
+
|
|
9
|
+
Object.keys(_merge).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _merge[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _merge[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var _mixin = require("./mixin");
|
|
21
|
+
|
|
22
|
+
Object.keys(_mixin).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _mixin[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _mixin[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _AsyncEmitter = require("./mixin/AsyncEmitter");
|
|
34
|
+
|
|
35
|
+
Object.keys(_AsyncEmitter).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (key in exports && exports[key] === _AsyncEmitter[key]) return;
|
|
38
|
+
Object.defineProperty(exports, key, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _AsyncEmitter[key];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
var _registry = require("./registry");
|
|
47
|
+
|
|
48
|
+
Object.keys(_registry).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (key in exports && exports[key] === _registry[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function get() {
|
|
54
|
+
return _registry[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
var _uid = require("./uid");
|
|
60
|
+
|
|
61
|
+
Object.keys(_uid).forEach(function (key) {
|
|
62
|
+
if (key === "default" || key === "__esModule") return;
|
|
63
|
+
if (key in exports && exports[key] === _uid[key]) return;
|
|
64
|
+
Object.defineProperty(exports, key, {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function get() {
|
|
67
|
+
return _uid[key];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
package/lib/merge.js
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.merge =
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.merge = merge;
|
|
7
|
+
|
|
8
|
+
function _deepmerge() {
|
|
9
|
+
const data = _interopRequireDefault(require("deepmerge"));
|
|
10
|
+
|
|
11
|
+
_deepmerge = function _deepmerge() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
8
20
|
const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray;
|
|
21
|
+
|
|
9
22
|
function merge(obj1, obj2) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
exports.merge = merge;
|
|
15
|
-
//# sourceMappingURL=merge.js.map
|
|
23
|
+
return (0, _deepmerge().default)(obj1, obj2, {
|
|
24
|
+
arrayMerge: overwriteMerge
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -1,63 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
12
6
|
exports.AsyncEmitter = void 0;
|
|
7
|
+
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
|
|
10
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
|
+
|
|
13
12
|
class AsyncEmitter {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
13
|
+
emitAsync(event, ...args) {
|
|
14
|
+
var _this = this;
|
|
15
|
+
|
|
16
|
+
return _asyncToGenerator(function* () {
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
const events = _this._events;
|
|
19
|
+
let callbacks = events[event];
|
|
20
|
+
|
|
21
|
+
if (!callbacks) {
|
|
22
|
+
return false;
|
|
23
|
+
} // helper function to reuse as much code as possible
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
const run = cb => {
|
|
27
|
+
switch (args.length) {
|
|
28
|
+
// fast cases
|
|
29
|
+
case 0:
|
|
30
|
+
cb = cb.call(_this);
|
|
31
|
+
break;
|
|
32
|
+
|
|
33
|
+
case 1:
|
|
34
|
+
cb = cb.call(_this, args[0]);
|
|
35
|
+
break;
|
|
36
|
+
|
|
37
|
+
case 2:
|
|
38
|
+
cb = cb.call(_this, args[0], args[1]);
|
|
39
|
+
break;
|
|
40
|
+
|
|
41
|
+
case 3:
|
|
42
|
+
cb = cb.call(_this, args[0], args[1], args[2]);
|
|
43
|
+
break;
|
|
44
|
+
// slower
|
|
45
|
+
|
|
46
|
+
default:
|
|
47
|
+
cb = cb.apply(_this, args);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (cb && (cb instanceof Promise || typeof cb.then === 'function')) {
|
|
51
|
+
return cb;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return Promise.resolve(true);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
if (typeof callbacks === 'function') {
|
|
58
|
+
yield run(callbacks);
|
|
59
|
+
} else if (typeof callbacks === 'object') {
|
|
60
|
+
callbacks = callbacks.slice().filter(Boolean);
|
|
61
|
+
yield callbacks.reduce((prev, next) => {
|
|
62
|
+
return prev.then(res => {
|
|
63
|
+
return run(next).then(result => Promise.resolve(res.concat(result)));
|
|
64
|
+
});
|
|
65
|
+
}, Promise.resolve([]));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return true;
|
|
69
|
+
})();
|
|
70
|
+
}
|
|
71
|
+
|
|
61
72
|
}
|
|
62
|
-
|
|
63
|
-
|
|
73
|
+
|
|
74
|
+
exports.AsyncEmitter = AsyncEmitter;
|
package/lib/mixin/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.applyMixins = applyMixins;
|
|
7
|
+
|
|
4
8
|
function applyMixins(derivedCtor, constructors) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.create(null));
|
|
9
|
-
});
|
|
9
|
+
constructors.forEach(baseCtor => {
|
|
10
|
+
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
|
|
11
|
+
Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null));
|
|
10
12
|
});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
13
|
+
});
|
|
14
|
+
}
|
package/lib/registry.js
CHANGED
|
@@ -1,34 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Registry = void 0;
|
|
7
|
+
|
|
4
8
|
class Registry {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// const files = await fs.readdir(directory);
|
|
17
|
-
// return files.filter(file => extensions.includes(path.extname(file)))
|
|
18
|
-
// }
|
|
19
|
-
get(key) {
|
|
20
|
-
return this.map.get(key);
|
|
21
|
-
}
|
|
22
|
-
getKeys() {
|
|
23
|
-
return this.map.keys();
|
|
24
|
-
}
|
|
25
|
-
getValues() {
|
|
26
|
-
return this.map.values();
|
|
27
|
-
}
|
|
28
|
-
getEntities() {
|
|
29
|
-
return this.map.entries();
|
|
9
|
+
constructor(options = {
|
|
10
|
+
override: false
|
|
11
|
+
}) {
|
|
12
|
+
this.map = new Map();
|
|
13
|
+
this.options = void 0;
|
|
14
|
+
this.options = options;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
register(key, value) {
|
|
18
|
+
if (!this.options.override && this.map.has(key)) {
|
|
19
|
+
throw new Error(`this registry does not allow to override existing keys: "${key}"`);
|
|
30
20
|
}
|
|
21
|
+
|
|
22
|
+
this.map.set(key, value);
|
|
23
|
+
} // async import({ directory, extensions = ['.js', '.ts', '.json'] }) {
|
|
24
|
+
// const files = await fs.readdir(directory);
|
|
25
|
+
// return files.filter(file => extensions.includes(path.extname(file)))
|
|
26
|
+
// }
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
get(key) {
|
|
30
|
+
return this.map.get(key);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
getKeys() {
|
|
34
|
+
return this.map.keys();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
getValues() {
|
|
38
|
+
return this.map.values();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getEntities() {
|
|
42
|
+
return this.map.entries();
|
|
43
|
+
}
|
|
44
|
+
|
|
31
45
|
}
|
|
46
|
+
|
|
32
47
|
exports.Registry = Registry;
|
|
33
|
-
|
|
34
|
-
|
|
48
|
+
var _default = Registry;
|
|
49
|
+
exports.default = _default;
|
package/lib/uid.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
HEX += IDX.toString(36);
|
|
7
|
-
function uid(len) {
|
|
8
|
-
let str = '', num = len || 11;
|
|
9
|
-
while (num--)
|
|
10
|
-
str += HEX[(Math.random() * 36) | 0];
|
|
11
|
-
return str;
|
|
12
|
-
}
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
13
6
|
exports.uid = uid;
|
|
14
|
-
|
|
7
|
+
let IDX = 36,
|
|
8
|
+
HEX = '';
|
|
9
|
+
|
|
10
|
+
while (IDX--) HEX += IDX.toString(36);
|
|
11
|
+
|
|
12
|
+
function uid(len) {
|
|
13
|
+
let str = '',
|
|
14
|
+
num = len || 11;
|
|
15
|
+
|
|
16
|
+
while (num--) str += HEX[Math.random() * 36 | 0];
|
|
17
|
+
|
|
18
|
+
return str;
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/utils",
|
|
3
|
-
"version": "0.7.0-alpha.
|
|
3
|
+
"version": "0.7.0-alpha.80",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,14 +10,9 @@
|
|
|
10
10
|
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
|
11
11
|
}
|
|
12
12
|
],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm",
|
|
15
|
-
"build:cjs": "tsc --project tsconfig.build.json",
|
|
16
|
-
"build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm"
|
|
17
|
-
},
|
|
18
13
|
"dependencies": {
|
|
19
14
|
"deepmerge": "^4.2.2",
|
|
20
15
|
"flat-to-nested": "^1.1.1"
|
|
21
16
|
},
|
|
22
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "9ec196c514d958d2c32c0879def6b98f24bf92fc"
|
|
23
18
|
}
|
package/esm/index.d.ts
DELETED
package/esm/index.js
DELETED
package/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC","sourcesContent":["export * from './merge';\nexport * from './mixin';\nexport * from './mixin/AsyncEmitter';\nexport * from './registry';\nexport * from './uid';\nexport * from './umiConfig';\n\n"]}
|
package/esm/merge.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function merge(obj1: any, obj2: any): unknown;
|
package/esm/merge.js
DELETED
package/esm/merge.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,MAAM,cAAc,GAAG,CAAC,gBAAgB,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC;AAE/E,MAAM,UAAU,KAAK,CAAC,IAAS,EAAE,IAAS;IACxC,OAAO,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE;QAC3B,UAAU,EAAE,cAAc;KAC3B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import deepmerge from 'deepmerge';\n\nconst overwriteMerge = (destinationArray, sourceArray, options) => sourceArray;\n\nexport function merge(obj1: any, obj2: any) {\n return deepmerge(obj1, obj2, {\n arrayMerge: overwriteMerge,\n });\n}\n"]}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export class AsyncEmitter {
|
|
11
|
-
emitAsync(event, ...args) {
|
|
12
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
const events = this._events;
|
|
15
|
-
let callbacks = events[event];
|
|
16
|
-
if (!callbacks) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
// helper function to reuse as much code as possible
|
|
20
|
-
const run = (cb) => {
|
|
21
|
-
switch (args.length) {
|
|
22
|
-
// fast cases
|
|
23
|
-
case 0:
|
|
24
|
-
cb = cb.call(this);
|
|
25
|
-
break;
|
|
26
|
-
case 1:
|
|
27
|
-
cb = cb.call(this, args[0]);
|
|
28
|
-
break;
|
|
29
|
-
case 2:
|
|
30
|
-
cb = cb.call(this, args[0], args[1]);
|
|
31
|
-
break;
|
|
32
|
-
case 3:
|
|
33
|
-
cb = cb.call(this, args[0], args[1], args[2]);
|
|
34
|
-
break;
|
|
35
|
-
// slower
|
|
36
|
-
default:
|
|
37
|
-
cb = cb.apply(this, args);
|
|
38
|
-
}
|
|
39
|
-
if (cb && (cb instanceof Promise || typeof cb.then === 'function')) {
|
|
40
|
-
return cb;
|
|
41
|
-
}
|
|
42
|
-
return Promise.resolve(true);
|
|
43
|
-
};
|
|
44
|
-
if (typeof callbacks === 'function') {
|
|
45
|
-
yield run(callbacks);
|
|
46
|
-
}
|
|
47
|
-
else if (typeof callbacks === 'object') {
|
|
48
|
-
callbacks = callbacks.slice().filter(Boolean);
|
|
49
|
-
yield callbacks.reduce((prev, next) => {
|
|
50
|
-
return prev.then((res) => {
|
|
51
|
-
return run(next).then((result) => Promise.resolve(res.concat(result)));
|
|
52
|
-
});
|
|
53
|
-
}, Promise.resolve([]));
|
|
54
|
-
}
|
|
55
|
-
return true;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=AsyncEmitter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncEmitter.js","sourceRoot":"","sources":["../../src/mixin/AsyncEmitter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,OAAO,YAAY;IACjB,SAAS,CAAC,KAAsB,EAAE,GAAG,IAAW;;YACpD,aAAa;YACb,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;YAC5B,IAAI,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC9B,IAAI,CAAC,SAAS,EAAE;gBACd,OAAO,KAAK,CAAC;aACd;YACD,oDAAoD;YACpD,MAAM,GAAG,GAAG,CAAC,EAAE,EAAE,EAAE;gBACjB,QAAQ,IAAI,CAAC,MAAM,EAAE;oBACnB,aAAa;oBACb,KAAK,CAAC;wBACJ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;wBACnB,MAAM;oBACR,KAAK,CAAC;wBACJ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;wBAC5B,MAAM;oBACR,KAAK,CAAC;wBACJ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;wBACrC,MAAM;oBACR,KAAK,CAAC;wBACJ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;wBAC9C,MAAM;oBACR,SAAS;oBACT;wBACE,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;iBAC7B;gBAED,IAAI,EAAE,IAAI,CAAC,EAAE,YAAY,OAAO,IAAI,OAAO,EAAE,CAAC,IAAI,KAAK,UAAU,CAAC,EAAE;oBAClE,OAAO,EAAE,CAAC;iBACX;gBAED,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC,CAAC;YAEF,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE;gBACnC,MAAM,GAAG,CAAC,SAAS,CAAC,CAAC;aACtB;iBAAM,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;gBACxC,SAAS,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAC9C,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;oBACpC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;wBACvB,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAC/B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CACpC,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACL,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;aACzB;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;CACF","sourcesContent":["export class AsyncEmitter {\n async emitAsync(event: string | symbol, ...args: any[]): Promise<boolean> {\n // @ts-ignore\n const events = this._events;\n let callbacks = events[event];\n if (!callbacks) {\n return false;\n }\n // helper function to reuse as much code as possible\n const run = (cb) => {\n switch (args.length) {\n // fast cases\n case 0:\n cb = cb.call(this);\n break;\n case 1:\n cb = cb.call(this, args[0]);\n break;\n case 2:\n cb = cb.call(this, args[0], args[1]);\n break;\n case 3:\n cb = cb.call(this, args[0], args[1], args[2]);\n break;\n // slower\n default:\n cb = cb.apply(this, args);\n }\n\n if (cb && (cb instanceof Promise || typeof cb.then === 'function')) {\n return cb;\n }\n\n return Promise.resolve(true);\n };\n\n if (typeof callbacks === 'function') {\n await run(callbacks);\n } else if (typeof callbacks === 'object') {\n callbacks = callbacks.slice().filter(Boolean);\n await callbacks.reduce((prev, next) => {\n return prev.then((res) => {\n return run(next).then((result) =>\n Promise.resolve(res.concat(result)),\n );\n });\n }, Promise.resolve([]));\n }\n\n return true;\n }\n}\n"]}
|
package/esm/mixin/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function applyMixins(derivedCtor: any, constructors: any[]): void;
|
package/esm/mixin/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export function applyMixins(derivedCtor, constructors) {
|
|
2
|
-
constructors.forEach((baseCtor) => {
|
|
3
|
-
Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
|
|
4
|
-
Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||
|
|
5
|
-
Object.create(null));
|
|
6
|
-
});
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
package/esm/mixin/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mixin/index.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,WAAgB,EAAE,YAAmB;IAC/D,YAAY,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAChC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC9D,MAAM,CAAC,cAAc,CACnB,WAAW,CAAC,SAAS,EACrB,IAAI,EACJ,MAAM,CAAC,wBAAwB,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;gBACvD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CACtB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["export function applyMixins(derivedCtor: any, constructors: any[]) {\n constructors.forEach((baseCtor) => {\n Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {\n Object.defineProperty(\n derivedCtor.prototype,\n name,\n Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||\n Object.create(null),\n );\n });\n });\n}\n"]}
|
package/esm/registry.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface RegistryOptions {
|
|
2
|
-
override: boolean;
|
|
3
|
-
}
|
|
4
|
-
export declare class Registry<T> {
|
|
5
|
-
private map;
|
|
6
|
-
options: RegistryOptions;
|
|
7
|
-
constructor(options?: RegistryOptions);
|
|
8
|
-
register(key: string, value: T): void;
|
|
9
|
-
get(key: string): T;
|
|
10
|
-
getKeys(): Iterable<string>;
|
|
11
|
-
getValues(): Iterable<T>;
|
|
12
|
-
getEntities(): Iterable<[string, T]>;
|
|
13
|
-
}
|
|
14
|
-
export default Registry;
|
package/esm/registry.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export class Registry {
|
|
2
|
-
constructor(options = { override: false }) {
|
|
3
|
-
this.map = new Map();
|
|
4
|
-
this.options = options;
|
|
5
|
-
}
|
|
6
|
-
register(key, value) {
|
|
7
|
-
if (!this.options.override && this.map.has(key)) {
|
|
8
|
-
throw new Error(`this registry does not allow to override existing keys: "${key}"`);
|
|
9
|
-
}
|
|
10
|
-
this.map.set(key, value);
|
|
11
|
-
}
|
|
12
|
-
// async import({ directory, extensions = ['.js', '.ts', '.json'] }) {
|
|
13
|
-
// const files = await fs.readdir(directory);
|
|
14
|
-
// return files.filter(file => extensions.includes(path.extname(file)))
|
|
15
|
-
// }
|
|
16
|
-
get(key) {
|
|
17
|
-
return this.map.get(key);
|
|
18
|
-
}
|
|
19
|
-
getKeys() {
|
|
20
|
-
return this.map.keys();
|
|
21
|
-
}
|
|
22
|
-
getValues() {
|
|
23
|
-
return this.map.values();
|
|
24
|
-
}
|
|
25
|
-
getEntities() {
|
|
26
|
-
return this.map.entries();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export default Registry;
|
|
30
|
-
//# sourceMappingURL=registry.js.map
|
package/esm/registry.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,QAAQ;IAInB,YAAY,UAA2B,EAAE,QAAQ,EAAE,KAAK,EAAE;QAHlD,QAAG,GAAG,IAAI,GAAG,EAAa,CAAC;QAIjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAQ;QAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YAC/C,MAAM,IAAI,KAAK,CAAC,4DAA4D,GAAG,GAAG,CAAC,CAAC;SACrF;QAED,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,sEAAsE;IACtE,+CAA+C;IAC/C,yEAAyE;IACzE,IAAI;IAEJ,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IAC3B,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;CACF;AAED,eAAe,QAAQ,CAAC","sourcesContent":["\nexport interface RegistryOptions {\n override: boolean;\n}\n\nexport class Registry<T> {\n private map = new Map<string, T>();\n options: RegistryOptions;\n\n constructor(options: RegistryOptions = { override: false }) {\n this.options = options;\n }\n\n register(key: string, value: T): void {\n if (!this.options.override && this.map.has(key)) {\n throw new Error(`this registry does not allow to override existing keys: \"${key}\"`);\n }\n\n this.map.set(key, value);\n }\n\n // async import({ directory, extensions = ['.js', '.ts', '.json'] }) {\n // const files = await fs.readdir(directory);\n // return files.filter(file => extensions.includes(path.extname(file)))\n // }\n\n get(key: string): T {\n return this.map.get(key);\n }\n\n getKeys(): Iterable<string> {\n return this.map.keys();\n }\n\n getValues(): Iterable<T> {\n return this.map.values();\n }\n\n getEntities(): Iterable<[string, T]> {\n return this.map.entries();\n }\n}\n\nexport default Registry;\n"]}
|
package/esm/uid.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function uid(len?: number): string;
|
package/esm/uid.js
DELETED
package/esm/uid.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uid.js","sourceRoot":"","sources":["../src/uid.ts"],"names":[],"mappings":"AAAA,IAAI,GAAG,GAAG,EAAE,EACV,GAAG,GAAG,EAAE,CAAC;AACX,OAAO,GAAG,EAAE;IAAE,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAEtC,MAAM,UAAU,GAAG,CAAC,GAAY;IAC9B,IAAI,GAAG,GAAG,EAAE,EACV,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC;IAClB,OAAO,GAAG,EAAE;QAAE,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACnD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["let IDX = 36,\n HEX = '';\nwhile (IDX--) HEX += IDX.toString(36);\n\nexport function uid(len?: number) {\n let str = '',\n num = len || 11;\n while (num--) str += HEX[(Math.random() * 36) | 0];\n return str;\n}\n"]}
|
package/esm/umiConfig.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare function getUmiConfig(): {
|
|
2
|
-
define: {
|
|
3
|
-
'process.env.SERVER_BASE_URL': string;
|
|
4
|
-
};
|
|
5
|
-
proxy: {
|
|
6
|
-
[x: string]: {
|
|
7
|
-
target: string;
|
|
8
|
-
changeOrigin: boolean;
|
|
9
|
-
} | {
|
|
10
|
-
target: string;
|
|
11
|
-
changeOrigin: boolean;
|
|
12
|
-
pathRewrite: {
|
|
13
|
-
[x: string]: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
};
|
package/esm/umiConfig.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export function getUmiConfig() {
|
|
2
|
-
const { SERVER_PORT, SERVER_BASE_URL } = process.env;
|
|
3
|
-
const SERVER_BASE_PATH = process.env.SERVER_BASE_PATH || '/api/';
|
|
4
|
-
const PROXY_TARGET_URL = process.env.PROXY_TARGET_URL || `http://127.0.0.1:${SERVER_PORT}`;
|
|
5
|
-
const LOCAL_STORAGE_BASE_URL = process.env.LOCAL_STORAGE_BASE_URL || '/uploads';
|
|
6
|
-
function getLocalStorageProxy() {
|
|
7
|
-
if (LOCAL_STORAGE_BASE_URL.startsWith('http')) {
|
|
8
|
-
return {};
|
|
9
|
-
}
|
|
10
|
-
return {
|
|
11
|
-
[LOCAL_STORAGE_BASE_URL]: {
|
|
12
|
-
target: PROXY_TARGET_URL,
|
|
13
|
-
changeOrigin: true,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
define: {
|
|
19
|
-
'process.env.SERVER_BASE_URL': SERVER_BASE_URL || SERVER_BASE_PATH,
|
|
20
|
-
},
|
|
21
|
-
// only proxy when using `umi dev`
|
|
22
|
-
// if the assets are built, will not proxy
|
|
23
|
-
proxy: Object.assign({ [SERVER_BASE_PATH]: {
|
|
24
|
-
target: PROXY_TARGET_URL,
|
|
25
|
-
changeOrigin: true,
|
|
26
|
-
pathRewrite: { [`^${SERVER_BASE_PATH}`]: SERVER_BASE_PATH },
|
|
27
|
-
} }, getLocalStorageProxy()),
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=umiConfig.js.map
|
package/esm/umiConfig.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"umiConfig.js","sourceRoot":"","sources":["../src/umiConfig.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY;IAC1B,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IACrD,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,OAAO,CAAC;IACjE,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,oBAAoB,WAAW,EAAE,CAAC;IAC3F,MAAM,sBAAsB,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,UAAU,CAAC;IAEhF,SAAS,oBAAoB;QAC3B,IAAI,sBAAsB,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;YAC7C,OAAO,EAAE,CAAC;SACX;QAED,OAAO;YACL,CAAC,sBAAsB,CAAC,EAAE;gBACxB,MAAM,EAAE,gBAAgB;gBACxB,YAAY,EAAE,IAAI;aACnB;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM,EAAE;YACN,6BAA6B,EAAE,eAAe,IAAI,gBAAgB;SACnE;QACD,kCAAkC;QAClC,0CAA0C;QAC1C,KAAK,kBACH,CAAC,gBAAgB,CAAC,EAAE;gBAClB,MAAM,EAAE,gBAAgB;gBACxB,YAAY,EAAE,IAAI;gBAClB,WAAW,EAAE,EAAE,CAAC,IAAI,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,EAAE;aAC5D,IAEE,oBAAoB,EAAE,CAC1B;KACF,CAAC;AACJ,CAAC","sourcesContent":["export function getUmiConfig() {\n const { SERVER_PORT, SERVER_BASE_URL } = process.env;\n const SERVER_BASE_PATH = process.env.SERVER_BASE_PATH || '/api/';\n const PROXY_TARGET_URL = process.env.PROXY_TARGET_URL || `http://127.0.0.1:${SERVER_PORT}`;\n const LOCAL_STORAGE_BASE_URL = process.env.LOCAL_STORAGE_BASE_URL || '/uploads';\n\n function getLocalStorageProxy() {\n if (LOCAL_STORAGE_BASE_URL.startsWith('http')) {\n return {};\n }\n\n return {\n [LOCAL_STORAGE_BASE_URL]: {\n target: PROXY_TARGET_URL,\n changeOrigin: true,\n },\n };\n }\n\n return {\n define: {\n 'process.env.SERVER_BASE_URL': SERVER_BASE_URL || SERVER_BASE_PATH,\n },\n // only proxy when using `umi dev`\n // if the assets are built, will not proxy\n proxy: {\n [SERVER_BASE_PATH]: {\n target: PROXY_TARGET_URL,\n changeOrigin: true,\n pathRewrite: { [`^${SERVER_BASE_PATH}`]: SERVER_BASE_PATH },\n },\n // for local storage\n ...getLocalStorageProxy(),\n },\n };\n}\n"]}
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB;AACxB,0CAAwB;AACxB,uDAAqC;AACrC,6CAA2B;AAC3B,wCAAsB;AACtB,8CAA4B","sourcesContent":["export * from './merge';\nexport * from './mixin';\nexport * from './mixin/AsyncEmitter';\nexport * from './registry';\nexport * from './uid';\nexport * from './umiConfig';\n\n"]}
|
package/lib/merge.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAElC,MAAM,cAAc,GAAG,CAAC,gBAAgB,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC;AAE/E,SAAgB,KAAK,CAAC,IAAS,EAAE,IAAS;IACxC,OAAO,IAAA,mBAAS,EAAC,IAAI,EAAE,IAAI,EAAE;QAC3B,UAAU,EAAE,cAAc;KAC3B,CAAC,CAAC;AACL,CAAC;AAJD,sBAIC","sourcesContent":["import deepmerge from 'deepmerge';\n\nconst overwriteMerge = (destinationArray, sourceArray, options) => sourceArray;\n\nexport function merge(obj1: any, obj2: any) {\n return deepmerge(obj1, obj2, {\n arrayMerge: overwriteMerge,\n });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncEmitter.js","sourceRoot":"","sources":["../../src/mixin/AsyncEmitter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,MAAa,YAAY;IACjB,SAAS,CAAC,KAAsB,EAAE,GAAG,IAAW;;YACpD,aAAa;YACb,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;YAC5B,IAAI,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC9B,IAAI,CAAC,SAAS,EAAE;gBACd,OAAO,KAAK,CAAC;aACd;YACD,oDAAoD;YACpD,MAAM,GAAG,GAAG,CAAC,EAAE,EAAE,EAAE;gBACjB,QAAQ,IAAI,CAAC,MAAM,EAAE;oBACnB,aAAa;oBACb,KAAK,CAAC;wBACJ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;wBACnB,MAAM;oBACR,KAAK,CAAC;wBACJ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;wBAC5B,MAAM;oBACR,KAAK,CAAC;wBACJ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;wBACrC,MAAM;oBACR,KAAK,CAAC;wBACJ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;wBAC9C,MAAM;oBACR,SAAS;oBACT;wBACE,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;iBAC7B;gBAED,IAAI,EAAE,IAAI,CAAC,EAAE,YAAY,OAAO,IAAI,OAAO,EAAE,CAAC,IAAI,KAAK,UAAU,CAAC,EAAE;oBAClE,OAAO,EAAE,CAAC;iBACX;gBAED,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC,CAAC;YAEF,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE;gBACnC,MAAM,GAAG,CAAC,SAAS,CAAC,CAAC;aACtB;iBAAM,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;gBACxC,SAAS,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAC9C,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;oBACpC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;wBACvB,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAC/B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CACpC,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACL,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;aACzB;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;CACF;AAnDD,oCAmDC","sourcesContent":["export class AsyncEmitter {\n async emitAsync(event: string | symbol, ...args: any[]): Promise<boolean> {\n // @ts-ignore\n const events = this._events;\n let callbacks = events[event];\n if (!callbacks) {\n return false;\n }\n // helper function to reuse as much code as possible\n const run = (cb) => {\n switch (args.length) {\n // fast cases\n case 0:\n cb = cb.call(this);\n break;\n case 1:\n cb = cb.call(this, args[0]);\n break;\n case 2:\n cb = cb.call(this, args[0], args[1]);\n break;\n case 3:\n cb = cb.call(this, args[0], args[1], args[2]);\n break;\n // slower\n default:\n cb = cb.apply(this, args);\n }\n\n if (cb && (cb instanceof Promise || typeof cb.then === 'function')) {\n return cb;\n }\n\n return Promise.resolve(true);\n };\n\n if (typeof callbacks === 'function') {\n await run(callbacks);\n } else if (typeof callbacks === 'object') {\n callbacks = callbacks.slice().filter(Boolean);\n await callbacks.reduce((prev, next) => {\n return prev.then((res) => {\n return run(next).then((result) =>\n Promise.resolve(res.concat(result)),\n );\n });\n }, Promise.resolve([]));\n }\n\n return true;\n }\n}\n"]}
|
package/lib/mixin/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mixin/index.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,WAAgB,EAAE,YAAmB;IAC/D,YAAY,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAChC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC9D,MAAM,CAAC,cAAc,CACnB,WAAW,CAAC,SAAS,EACrB,IAAI,EACJ,MAAM,CAAC,wBAAwB,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;gBACvD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CACtB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAXD,kCAWC","sourcesContent":["export function applyMixins(derivedCtor: any, constructors: any[]) {\n constructors.forEach((baseCtor) => {\n Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {\n Object.defineProperty(\n derivedCtor.prototype,\n name,\n Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||\n Object.create(null),\n );\n });\n });\n}\n"]}
|
package/lib/registry.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":";;;AAKA,MAAa,QAAQ;IAInB,YAAY,UAA2B,EAAE,QAAQ,EAAE,KAAK,EAAE;QAHlD,QAAG,GAAG,IAAI,GAAG,EAAa,CAAC;QAIjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAQ;QAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YAC/C,MAAM,IAAI,KAAK,CAAC,4DAA4D,GAAG,GAAG,CAAC,CAAC;SACrF;QAED,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,sEAAsE;IACtE,+CAA+C;IAC/C,yEAAyE;IACzE,IAAI;IAEJ,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IAC3B,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;CACF;AApCD,4BAoCC;AAED,kBAAe,QAAQ,CAAC","sourcesContent":["\nexport interface RegistryOptions {\n override: boolean;\n}\n\nexport class Registry<T> {\n private map = new Map<string, T>();\n options: RegistryOptions;\n\n constructor(options: RegistryOptions = { override: false }) {\n this.options = options;\n }\n\n register(key: string, value: T): void {\n if (!this.options.override && this.map.has(key)) {\n throw new Error(`this registry does not allow to override existing keys: \"${key}\"`);\n }\n\n this.map.set(key, value);\n }\n\n // async import({ directory, extensions = ['.js', '.ts', '.json'] }) {\n // const files = await fs.readdir(directory);\n // return files.filter(file => extensions.includes(path.extname(file)))\n // }\n\n get(key: string): T {\n return this.map.get(key);\n }\n\n getKeys(): Iterable<string> {\n return this.map.keys();\n }\n\n getValues(): Iterable<T> {\n return this.map.values();\n }\n\n getEntities(): Iterable<[string, T]> {\n return this.map.entries();\n }\n}\n\nexport default Registry;\n"]}
|
package/lib/uid.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uid.js","sourceRoot":"","sources":["../src/uid.ts"],"names":[],"mappings":";;;AAAA,IAAI,GAAG,GAAG,EAAE,EACV,GAAG,GAAG,EAAE,CAAC;AACX,OAAO,GAAG,EAAE;IAAE,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAEtC,SAAgB,GAAG,CAAC,GAAY;IAC9B,IAAI,GAAG,GAAG,EAAE,EACV,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC;IAClB,OAAO,GAAG,EAAE;QAAE,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACnD,OAAO,GAAG,CAAC;AACb,CAAC;AALD,kBAKC","sourcesContent":["let IDX = 36,\n HEX = '';\nwhile (IDX--) HEX += IDX.toString(36);\n\nexport function uid(len?: number) {\n let str = '',\n num = len || 11;\n while (num--) str += HEX[(Math.random() * 36) | 0];\n return str;\n}\n"]}
|
package/lib/umiConfig.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare function getUmiConfig(): {
|
|
2
|
-
define: {
|
|
3
|
-
'process.env.SERVER_BASE_URL': string;
|
|
4
|
-
};
|
|
5
|
-
proxy: {
|
|
6
|
-
[x: string]: {
|
|
7
|
-
target: string;
|
|
8
|
-
changeOrigin: boolean;
|
|
9
|
-
} | {
|
|
10
|
-
target: string;
|
|
11
|
-
changeOrigin: boolean;
|
|
12
|
-
pathRewrite: {
|
|
13
|
-
[x: string]: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
};
|
package/lib/umiConfig.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUmiConfig = void 0;
|
|
4
|
-
function getUmiConfig() {
|
|
5
|
-
const { SERVER_PORT, SERVER_BASE_URL } = process.env;
|
|
6
|
-
const SERVER_BASE_PATH = process.env.SERVER_BASE_PATH || '/api/';
|
|
7
|
-
const PROXY_TARGET_URL = process.env.PROXY_TARGET_URL || `http://127.0.0.1:${SERVER_PORT}`;
|
|
8
|
-
const LOCAL_STORAGE_BASE_URL = process.env.LOCAL_STORAGE_BASE_URL || '/uploads';
|
|
9
|
-
function getLocalStorageProxy() {
|
|
10
|
-
if (LOCAL_STORAGE_BASE_URL.startsWith('http')) {
|
|
11
|
-
return {};
|
|
12
|
-
}
|
|
13
|
-
return {
|
|
14
|
-
[LOCAL_STORAGE_BASE_URL]: {
|
|
15
|
-
target: PROXY_TARGET_URL,
|
|
16
|
-
changeOrigin: true,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
define: {
|
|
22
|
-
'process.env.SERVER_BASE_URL': SERVER_BASE_URL || SERVER_BASE_PATH,
|
|
23
|
-
},
|
|
24
|
-
// only proxy when using `umi dev`
|
|
25
|
-
// if the assets are built, will not proxy
|
|
26
|
-
proxy: Object.assign({ [SERVER_BASE_PATH]: {
|
|
27
|
-
target: PROXY_TARGET_URL,
|
|
28
|
-
changeOrigin: true,
|
|
29
|
-
pathRewrite: { [`^${SERVER_BASE_PATH}`]: SERVER_BASE_PATH },
|
|
30
|
-
} }, getLocalStorageProxy()),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
exports.getUmiConfig = getUmiConfig;
|
|
34
|
-
//# sourceMappingURL=umiConfig.js.map
|
package/lib/umiConfig.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"umiConfig.js","sourceRoot":"","sources":["../src/umiConfig.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY;IAC1B,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IACrD,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,OAAO,CAAC;IACjE,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,oBAAoB,WAAW,EAAE,CAAC;IAC3F,MAAM,sBAAsB,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,UAAU,CAAC;IAEhF,SAAS,oBAAoB;QAC3B,IAAI,sBAAsB,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;YAC7C,OAAO,EAAE,CAAC;SACX;QAED,OAAO;YACL,CAAC,sBAAsB,CAAC,EAAE;gBACxB,MAAM,EAAE,gBAAgB;gBACxB,YAAY,EAAE,IAAI;aACnB;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM,EAAE;YACN,6BAA6B,EAAE,eAAe,IAAI,gBAAgB;SACnE;QACD,kCAAkC;QAClC,0CAA0C;QAC1C,KAAK,kBACH,CAAC,gBAAgB,CAAC,EAAE;gBAClB,MAAM,EAAE,gBAAgB;gBACxB,YAAY,EAAE,IAAI;gBAClB,WAAW,EAAE,EAAE,CAAC,IAAI,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,EAAE;aAC5D,IAEE,oBAAoB,EAAE,CAC1B;KACF,CAAC;AACJ,CAAC;AAnCD,oCAmCC","sourcesContent":["export function getUmiConfig() {\n const { SERVER_PORT, SERVER_BASE_URL } = process.env;\n const SERVER_BASE_PATH = process.env.SERVER_BASE_PATH || '/api/';\n const PROXY_TARGET_URL = process.env.PROXY_TARGET_URL || `http://127.0.0.1:${SERVER_PORT}`;\n const LOCAL_STORAGE_BASE_URL = process.env.LOCAL_STORAGE_BASE_URL || '/uploads';\n\n function getLocalStorageProxy() {\n if (LOCAL_STORAGE_BASE_URL.startsWith('http')) {\n return {};\n }\n\n return {\n [LOCAL_STORAGE_BASE_URL]: {\n target: PROXY_TARGET_URL,\n changeOrigin: true,\n },\n };\n }\n\n return {\n define: {\n 'process.env.SERVER_BASE_URL': SERVER_BASE_URL || SERVER_BASE_PATH,\n },\n // only proxy when using `umi dev`\n // if the assets are built, will not proxy\n proxy: {\n [SERVER_BASE_PATH]: {\n target: PROXY_TARGET_URL,\n changeOrigin: true,\n pathRewrite: { [`^${SERVER_BASE_PATH}`]: SERVER_BASE_PATH },\n },\n // for local storage\n ...getLocalStorageProxy(),\n },\n };\n}\n"]}
|
package/tsconfig.build.json
DELETED
package/umiConfig.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare function getUmiConfig(): {
|
|
2
|
-
define: {
|
|
3
|
-
'process.env.SERVER_BASE_URL': string;
|
|
4
|
-
};
|
|
5
|
-
proxy: {
|
|
6
|
-
[x: string]: {
|
|
7
|
-
target: string;
|
|
8
|
-
changeOrigin: boolean;
|
|
9
|
-
} | {
|
|
10
|
-
target: string;
|
|
11
|
-
changeOrigin: boolean;
|
|
12
|
-
pathRewrite: {
|
|
13
|
-
[x: string]: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
};
|
package/umiConfig.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
function getUmiConfig() {
|
|
2
|
-
const { SERVER_PORT, SERVER_BASE_URL } = process.env;
|
|
3
|
-
const SERVER_BASE_PATH = process.env.SERVER_BASE_PATH || '/api/';
|
|
4
|
-
const PROXY_TARGET_URL = process.env.PROXY_TARGET_URL || `http://127.0.0.1:${SERVER_PORT}`;
|
|
5
|
-
const LOCAL_STORAGE_BASE_URL = process.env.LOCAL_STORAGE_BASE_URL || '/uploads';
|
|
6
|
-
|
|
7
|
-
function getLocalStorageProxy() {
|
|
8
|
-
if (LOCAL_STORAGE_BASE_URL.startsWith('http')) {
|
|
9
|
-
return {};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
[LOCAL_STORAGE_BASE_URL]: {
|
|
14
|
-
target: PROXY_TARGET_URL,
|
|
15
|
-
changeOrigin: true,
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
define: {
|
|
22
|
-
'process.env.SERVER_BASE_URL': SERVER_BASE_URL || SERVER_BASE_PATH,
|
|
23
|
-
},
|
|
24
|
-
// only proxy when using `umi dev`
|
|
25
|
-
// if the assets are built, will not proxy
|
|
26
|
-
proxy: {
|
|
27
|
-
[SERVER_BASE_PATH]: {
|
|
28
|
-
target: PROXY_TARGET_URL,
|
|
29
|
-
changeOrigin: true,
|
|
30
|
-
pathRewrite: { [`^${SERVER_BASE_PATH}`]: SERVER_BASE_PATH },
|
|
31
|
-
},
|
|
32
|
-
// for local storage
|
|
33
|
-
...getLocalStorageProxy(),
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
exports.getUmiConfig = getUmiConfig;
|