webpb 0.0.25 → 0.0.26
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/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +66 -50
- package/package.json +24 -23
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function t(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function n(e){if(!t(e))return;let n=e;if(typeof n.toAlias==`function`)return n.toAlias.bind(e);if(typeof n.toWebpbAlias==`function`)return n.toWebpbAlias.bind(e)}function r(e){return n(e)!==void 0}function i(e){let t=n(e);return t?t():e}function a(n,r,i=[]){if(!e(n)||!t(r))return;let a=new Set(i);for(let[e,t]of Object.entries(n))t!==void 0&&!a.has(e)&&(r[e]=t)}function o(e,n){if(e==null)return null;let r=n.split(`.`).filter(e=>e.length>0);if(r.length===0)return e;let i=e;for(let e of r)if(!t(i)||(i=i[e],i==null))return null;return i}function s(t,n){let r=[],i=(e,t)=>{e&&t&&r.push(`${e}=${encodeURIComponent(t)}`)};for(let[t,r]of Object.entries(n))if(!(r==null||typeof r==`function`)){if(Array.isArray(r)){r.length>0&&i(t,r.join(`,`));continue}if(e(r)){for(let e of Object.keys(r)){let n=r[e];n==null||n===``?e&&i(t,e):e&&i(t,`${e},${n}`)}continue}i(t,String(r))}return r.length?`${t}${r.join(`&`)}`:``}function c(t,n){if(!e(t))return t;let a={};for(let[e,o]of Object.entries(t))r(o)?a[e]=i(o):n[e]?a[n[e]]=o:a[e]=o;return a}function l(t,n){return e(t)?Object.entries(t).reduce((e,[t,r])=>(e[t]=n(r),e),{}):{}}exports.assign=a,exports.getter=o,exports.mapValues=l,exports.query=s,exports.toAlias=c;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
export type Constructor<T> = {
|
|
4
4
|
new (): T;
|
|
5
|
-
fromAlias
|
|
5
|
+
fromAlias(data?: unknown): T;
|
|
6
6
|
};
|
|
7
7
|
export type AnyObject = Record<string | number, unknown>;
|
|
8
8
|
export interface WebpbMessage {
|
|
@@ -15,7 +15,7 @@ export interface WebpbMeta {
|
|
|
15
15
|
context: string;
|
|
16
16
|
path: string;
|
|
17
17
|
}
|
|
18
|
-
export declare function assign(src: unknown, dest: unknown, excludes?: string[]): void;
|
|
18
|
+
export declare function assign(src: unknown, dest: unknown, excludes?: readonly string[]): void;
|
|
19
19
|
export declare function getter(data: unknown, path: string): unknown;
|
|
20
20
|
export declare function query(pre: string, params: {
|
|
21
21
|
[key: string]: unknown;
|
|
@@ -23,6 +23,6 @@ export declare function query(pre: string, params: {
|
|
|
23
23
|
export declare function toAlias(data: unknown, aliases: {
|
|
24
24
|
[key: string]: string;
|
|
25
25
|
}): unknown;
|
|
26
|
-
export declare function mapValues(record: AnyObject, mapping: (v: unknown) => unknown): AnyObject;
|
|
26
|
+
export declare function mapValues(record: AnyObject | null | undefined, mapping: (v: unknown) => unknown): AnyObject;
|
|
27
27
|
|
|
28
28
|
export {};
|
package/dist/index.mjs
CHANGED
|
@@ -1,50 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function
|
|
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
|
-
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
4
|
+
let t = Object.getPrototypeOf(e);
|
|
5
|
+
return t === null || t === Object.prototype;
|
|
6
|
+
}
|
|
7
|
+
function t(e) {
|
|
8
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
9
|
+
}
|
|
10
|
+
function n(e) {
|
|
11
|
+
if (!t(e)) return;
|
|
12
|
+
let n = e;
|
|
13
|
+
if (typeof n.toAlias == "function") return n.toAlias.bind(e);
|
|
14
|
+
if (typeof n.toWebpbAlias == "function") return n.toWebpbAlias.bind(e);
|
|
15
|
+
}
|
|
16
|
+
function r(e) {
|
|
17
|
+
return n(e) !== void 0;
|
|
18
|
+
}
|
|
19
|
+
function i(e) {
|
|
20
|
+
let t = n(e);
|
|
21
|
+
return t ? t() : e;
|
|
22
|
+
}
|
|
23
|
+
function a(n, r, i = []) {
|
|
24
|
+
if (!e(n) || !t(r)) return;
|
|
25
|
+
let a = new Set(i);
|
|
26
|
+
for (let [e, t] of Object.entries(n)) t !== void 0 && !a.has(e) && (r[e] = t);
|
|
27
|
+
}
|
|
28
|
+
function o(e, n) {
|
|
29
|
+
if (e == null) return null;
|
|
30
|
+
let r = n.split(".").filter((e) => e.length > 0);
|
|
31
|
+
if (r.length === 0) return e;
|
|
32
|
+
let i = e;
|
|
33
|
+
for (let e of r) if (!t(i) || (i = i[e], i == null)) return null;
|
|
34
|
+
return i;
|
|
35
|
+
}
|
|
36
|
+
function s(t, n) {
|
|
37
|
+
let r = [], i = (e, t) => {
|
|
38
|
+
e && t && r.push(`${e}=${encodeURIComponent(t)}`);
|
|
39
|
+
};
|
|
40
|
+
for (let [t, r] of Object.entries(n)) if (!(r == null || typeof r == "function")) {
|
|
41
|
+
if (Array.isArray(r)) {
|
|
42
|
+
r.length > 0 && i(t, r.join(","));
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (e(r)) {
|
|
46
|
+
for (let e of Object.keys(r)) {
|
|
47
|
+
let n = r[e];
|
|
48
|
+
n == null || n === "" ? e && i(t, e) : e && i(t, `${e},${n}`);
|
|
49
|
+
}
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
i(t, String(r));
|
|
53
|
+
}
|
|
54
|
+
return r.length ? `${t}${r.join("&")}` : "";
|
|
55
|
+
}
|
|
56
|
+
function c(t, n) {
|
|
57
|
+
if (!e(t)) return t;
|
|
58
|
+
let a = {};
|
|
59
|
+
for (let [e, o] of Object.entries(t)) r(o) ? a[e] = i(o) : n[e] ? a[n[e]] = o : a[e] = o;
|
|
60
|
+
return a;
|
|
61
|
+
}
|
|
62
|
+
function l(t, n) {
|
|
63
|
+
return e(t) ? Object.entries(t).reduce((e, [t, r]) => (e[t] = n(r), e), {}) : {};
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { a as assign, o as getter, l as mapValues, s as query, c as toAlias };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "The webpb runtime library",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rimraf build/**/* && tsc && vite build && dts-bundle-generator --config ./dts-bundle-generator.config.cjs && copyfiles ./README.md ./package.json build",
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
"lint": "eslint --quiet src/**/*.ts",
|
|
9
9
|
"lint:fix": "eslint --fix src/**/*.ts",
|
|
10
10
|
"deploy": "npm run check && npm run build && npm publish ./build --access public",
|
|
11
|
+
"publish": "npm run sync-version && npm run build && npm publish ./build --access public",
|
|
12
|
+
"sync-version": "node scripts/sync-version.mjs",
|
|
11
13
|
"test": "vitest --coverage"
|
|
12
14
|
},
|
|
13
15
|
"author": "jinganix@gmail.com",
|
|
@@ -21,41 +23,40 @@
|
|
|
21
23
|
"url": "https://github.com/jinganix/webpb"
|
|
22
24
|
},
|
|
23
25
|
"type": "module",
|
|
26
|
+
"sideEffects": false,
|
|
24
27
|
"main": "./dist/index.cjs",
|
|
25
28
|
"module": "./dist/index.mjs",
|
|
26
29
|
"types": "./dist/index.d.ts",
|
|
27
30
|
"exports": {
|
|
28
|
-
".":
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
"./dist/index.cjs"
|
|
35
|
-
]
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.mjs",
|
|
34
|
+
"require": "./dist/index.cjs"
|
|
35
|
+
}
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@eslint/
|
|
39
|
-
"@types/node": "^25.
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
41
|
-
"@typescript-eslint/parser": "^8.
|
|
42
|
-
"@vitest/coverage-v8": "^4.
|
|
38
|
+
"@eslint/js": "^10.0.1",
|
|
39
|
+
"@types/node": "^25.9.3",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^8.59.4",
|
|
41
|
+
"@typescript-eslint/parser": "^8.59.4",
|
|
42
|
+
"@vitest/coverage-v8": "^4.1.7",
|
|
43
43
|
"copyfiles": "^2.4.1",
|
|
44
44
|
"dts-bundle-generator": "^9.5.1",
|
|
45
|
-
"eslint": "^
|
|
45
|
+
"eslint": "^10.4.1",
|
|
46
46
|
"eslint-config-prettier": "^10.1.8",
|
|
47
|
-
"eslint-plugin-import": "^2.32.0",
|
|
48
47
|
"eslint-plugin-import-quotes": "^0.0.1",
|
|
48
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
49
49
|
"eslint-plugin-no-null": "^1.0.2",
|
|
50
|
+
"eslint-plugin-perfectionist": "^4.15.0",
|
|
50
51
|
"eslint-plugin-prettier": "^5.5.5",
|
|
51
|
-
"
|
|
52
|
-
"prettier": "^3.8.
|
|
52
|
+
"globals": "^14.0.0",
|
|
53
|
+
"prettier": "^3.8.4",
|
|
53
54
|
"pretty-quick": "^4.2.2",
|
|
54
|
-
"rimraf": "^6.1.
|
|
55
|
+
"rimraf": "^6.1.3",
|
|
55
56
|
"ts-node": "^10.9.2",
|
|
56
|
-
"typescript": "^
|
|
57
|
-
"typescript-eslint": "^8.
|
|
58
|
-
"vite": "^
|
|
59
|
-
"vitest": "^4.
|
|
57
|
+
"typescript": "^6.0.3",
|
|
58
|
+
"typescript-eslint": "^8.59.4",
|
|
59
|
+
"vite": "^8.0.14",
|
|
60
|
+
"vitest": "^4.1.7"
|
|
60
61
|
}
|
|
61
62
|
}
|