@nocobase/utils 0.5.0-alpha.34 → 0.5.0-alpha.35
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 +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +17 -15
- package/lib/index.js.map +1 -1
- package/lib/merge.d.ts +1 -0
- package/lib/merge.d.ts.map +1 -0
- package/lib/merge.js +37 -0
- package/lib/merge.js.map +1 -0
- package/lib/umiConfig.d.ts +17 -0
- package/lib/umiConfig.d.ts.map +1 -0
- package/lib/umiConfig.js +58 -0
- package/lib/umiConfig.js.map +1 -0
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './merge';
|
|
2
|
+
export * from './umiConfig';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC","file":"index.d.ts","sourcesContent":["export * from './merge';\nexport * from './umiConfig';\n"]}
|
package/lib/index.js
CHANGED
|
@@ -12,26 +12,28 @@ function _react() {
|
|
|
12
12
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
Object.defineProperty(o, k2, {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function get() {
|
|
20
|
+
return m[k];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
} : function (o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
29
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
30
|
};
|
|
20
31
|
|
|
21
32
|
Object.defineProperty(exports, "__esModule", {
|
|
22
33
|
value: true
|
|
23
34
|
});
|
|
24
|
-
exports.merge = void 0;
|
|
25
35
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray;
|
|
29
|
-
|
|
30
|
-
function merge(obj1, obj2) {
|
|
31
|
-
return (0, deepmerge_1.default)(obj1, obj2, {
|
|
32
|
-
arrayMerge: overwriteMerge
|
|
33
|
-
});
|
|
34
|
-
}
|
|
36
|
+
__exportStar(require("./merge"), exports);
|
|
35
37
|
|
|
36
|
-
exports
|
|
38
|
+
__exportStar(require("./umiConfig"), exports);
|
|
37
39
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB;AACxB,8CAA4B","file":"index.js","sourcesContent":["export * from './merge';\nexport * from './umiConfig';\n"]}
|
package/lib/merge.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function merge(obj1: any, obj2: any): unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["merge.ts"],"names":[],"mappings":"AAIA,wBAAgB,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,WAIzC","file":"merge.d.ts","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"]}
|
package/lib/merge.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _react() {
|
|
4
|
+
const data = _interopRequireDefault(require("react"));
|
|
5
|
+
|
|
6
|
+
_react = function _react() {
|
|
7
|
+
return data;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
|
|
15
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
16
|
+
return mod && mod.__esModule ? mod : {
|
|
17
|
+
"default": mod
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
Object.defineProperty(exports, "__esModule", {
|
|
22
|
+
value: true
|
|
23
|
+
});
|
|
24
|
+
exports.merge = void 0;
|
|
25
|
+
|
|
26
|
+
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
27
|
+
|
|
28
|
+
const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray;
|
|
29
|
+
|
|
30
|
+
function merge(obj1, obj2) {
|
|
31
|
+
return (0, deepmerge_1.default)(obj1, obj2, {
|
|
32
|
+
arrayMerge: overwriteMerge
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
exports.merge = merge;
|
|
37
|
+
//# sourceMappingURL=merge.js.map
|
package/lib/merge.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["merge.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAElC,MAAM,cAAc,GAAG,CAAC,gBAAgB,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,CAAA;AAE9E,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","file":"merge.js","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"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function getUmiConfig(): {
|
|
2
|
+
define: {
|
|
3
|
+
'process.env.API_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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["umiConfig.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY;;;;;;;;;;;;;;;;EAmC3B","file":"umiConfig.d.ts","sourcesContent":["export function getUmiConfig() {\n const { API_PORT, API_BASE_URL } = process.env;\n const API_BASE_PATH = process.env.API_BASE_PATH || '/api/';\n const PROXY_TARGET_URL = process.env.PROXY_TARGET_URL || `http://127.0.0.1:${API_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.API_BASE_URL': API_BASE_URL || API_BASE_PATH,\n },\n // only proxy when using `umi dev`\n // if the assets are built, will not proxy\n proxy: {\n [API_BASE_PATH]: {\n target: PROXY_TARGET_URL,\n changeOrigin: true,\n pathRewrite: { [`^${API_BASE_PATH}`]: API_BASE_PATH },\n },\n // for local storage\n ...getLocalStorageProxy(),\n },\n };\n}\n"]}
|
package/lib/umiConfig.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _react() {
|
|
4
|
+
const data = _interopRequireDefault(require("react"));
|
|
5
|
+
|
|
6
|
+
_react = function _react() {
|
|
7
|
+
return data;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
|
|
15
|
+
Object.defineProperty(exports, "__esModule", {
|
|
16
|
+
value: true
|
|
17
|
+
});
|
|
18
|
+
exports.getUmiConfig = void 0;
|
|
19
|
+
|
|
20
|
+
function getUmiConfig() {
|
|
21
|
+
const _process$env = process.env,
|
|
22
|
+
API_PORT = _process$env.API_PORT,
|
|
23
|
+
API_BASE_URL = _process$env.API_BASE_URL;
|
|
24
|
+
const API_BASE_PATH = process.env.API_BASE_PATH || '/api/';
|
|
25
|
+
const PROXY_TARGET_URL = process.env.PROXY_TARGET_URL || `http://127.0.0.1:${API_PORT}`;
|
|
26
|
+
const LOCAL_STORAGE_BASE_URL = process.env.LOCAL_STORAGE_BASE_URL || '/uploads';
|
|
27
|
+
|
|
28
|
+
function getLocalStorageProxy() {
|
|
29
|
+
if (LOCAL_STORAGE_BASE_URL.startsWith('http')) {
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
[LOCAL_STORAGE_BASE_URL]: {
|
|
35
|
+
target: PROXY_TARGET_URL,
|
|
36
|
+
changeOrigin: true
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
define: {
|
|
43
|
+
'process.env.API_BASE_URL': API_BASE_URL || API_BASE_PATH
|
|
44
|
+
},
|
|
45
|
+
proxy: Object.assign({
|
|
46
|
+
[API_BASE_PATH]: {
|
|
47
|
+
target: PROXY_TARGET_URL,
|
|
48
|
+
changeOrigin: true,
|
|
49
|
+
pathRewrite: {
|
|
50
|
+
[`^${API_BASE_PATH}`]: API_BASE_PATH
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, getLocalStorageProxy())
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
exports.getUmiConfig = getUmiConfig;
|
|
58
|
+
//# sourceMappingURL=umiConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["umiConfig.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY;IAC1B,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAC/C,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,OAAO,CAAC;IAC3D,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,oBAAoB,QAAQ,EAAE,CAAC;IACxF,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,0BAA0B,EAAE,YAAY,IAAI,aAAa;SAC1D;QAGD,KAAK,kBACH,CAAC,aAAa,CAAC,EAAE;gBACf,MAAM,EAAE,gBAAgB;gBACxB,YAAY,EAAE,IAAI;gBAClB,WAAW,EAAE,EAAE,CAAC,IAAI,aAAa,EAAE,CAAC,EAAE,aAAa,EAAE;aACtD,IAEE,oBAAoB,EAAE,CAC1B;KACF,CAAC;AACJ,CAAC;AAnCD,oCAmCC","file":"umiConfig.js","sourcesContent":["export function getUmiConfig() {\n const { API_PORT, API_BASE_URL } = process.env;\n const API_BASE_PATH = process.env.API_BASE_PATH || '/api/';\n const PROXY_TARGET_URL = process.env.PROXY_TARGET_URL || `http://127.0.0.1:${API_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.API_BASE_URL': API_BASE_URL || API_BASE_PATH,\n },\n // only proxy when using `umi dev`\n // if the assets are built, will not proxy\n proxy: {\n [API_BASE_PATH]: {\n target: PROXY_TARGET_URL,\n changeOrigin: true,\n pathRewrite: { [`^${API_BASE_PATH}`]: API_BASE_PATH },\n },\n // for local storage\n ...getLocalStorageProxy(),\n },\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/utils",
|
|
3
|
-
"version": "0.5.0-alpha.
|
|
3
|
+
"version": "0.5.0-alpha.35",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"deepmerge": "^4.2.2",
|
|
10
10
|
"flat-to-nested": "^1.1.1"
|
|
11
11
|
},
|
|
12
|
-
"gitHead": "
|
|
12
|
+
"gitHead": "2b81a6af327ee784a6943aff6e028fde3298dec9"
|
|
13
13
|
}
|