webpb 0.0.21 → 0.0.23

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 CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function f(e,o,n){if(!(!e||!o||typeof e!="object"||typeof o!="object"))for(const[r,t]of Object.entries(e))t!==void 0&&!u(r,n)&&(o[r]=t)}function u(e,o){if(!o)return!1;for(const n of o)if(n===e)return!0;return!1}function c(e,o){if(e==null||typeof e!="object")return null;for(const n of o.split("."))if(e=e[n],e==null)return e;return e}function s(e,o){const n=[];for(const[r,t]of Object.entries(o)){if(t==null||typeof t=="function")continue;const i=encodeURIComponent(String(t));i&&n.push(`${r}=${i}`)}return n.length?`${e}${n.join("&")}`:""}function l(e,o){if(!e||typeof e!="object"||Array.isArray(e))return e;const n={};for(const[r,t]of Object.entries(e)){const i=t==null?void 0:t.toAlias;typeof i=="function"?n[r]=i():o&&o[r]?n[o[r]]=t:n[r]=t}return n}function y(e,o){return Object.entries(e).reduce((n,[r,t])=>(n[r]=o(t),n),{})}exports.assign=f;exports.getter=c;exports.mapValues=y;exports.query=s;exports.toAlias=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function s(e,t,o=[]){if(!(!e||!t||typeof e!="object"||typeof t!="object"))for(const[r,n]of Object.entries(e))n!==void 0&&o.indexOf(r)<0&&(t[r]=n)}function l(e,t){if(e==null||typeof e!="object")return null;for(const o of t.split("."))if(e=e[o],e==null)return null;return e}function y(e,t){const o=[];for(const[r,n]of Object.entries(t)){if(n==null||typeof n=="function")continue;let i;Array.isArray(n)?i=n.join(","):typeof n=="object"?i=Object.entries(n).map(([u,c])=>`${u},${c}`).join(";"):i=String(n);const f=encodeURIComponent(i);f&&o.push(`${r}=${f}`)}return o.length?`${e}${o.join("&")}`:""}function j(e,t){if(!e||typeof e!="object"||Array.isArray(e))return e;const o={};for(const[r,n]of Object.entries(e)){const i=n==null?void 0:n.toAlias;typeof i=="function"?o[r]=i():t&&t[r]?o[t[r]]=n:o[r]=n}return o}function p(e,t){return Object.entries(e).reduce((o,[r,n])=>(o[r]=t(n),o),{})}exports.assign=s;exports.getter=l;exports.mapValues=p;exports.query=y;exports.toAlias=j;
package/dist/index.mjs ADDED
@@ -0,0 +1,45 @@
1
+ function s(e, t, o = []) {
2
+ if (!(!e || !t || typeof e != "object" || typeof t != "object"))
3
+ for (const [r, n] of Object.entries(e))
4
+ n !== void 0 && o.indexOf(r) < 0 && (t[r] = n);
5
+ }
6
+ function l(e, t) {
7
+ if (e == null || typeof e != "object")
8
+ return null;
9
+ for (const o of t.split("."))
10
+ if (e = e[o], e == null)
11
+ return null;
12
+ return e;
13
+ }
14
+ function y(e, t) {
15
+ const o = [];
16
+ for (const [r, n] of Object.entries(t)) {
17
+ if (n == null || typeof n == "function")
18
+ continue;
19
+ let i;
20
+ Array.isArray(n) ? i = n.join(",") : typeof n == "object" ? i = Object.entries(n).map(([u, c]) => `${u},${c}`).join(";") : i = String(n);
21
+ const f = encodeURIComponent(i);
22
+ f && o.push(`${r}=${f}`);
23
+ }
24
+ return o.length ? `${e}${o.join("&")}` : "";
25
+ }
26
+ function j(e, t) {
27
+ if (!e || typeof e != "object" || Array.isArray(e))
28
+ return e;
29
+ const o = {};
30
+ for (const [r, n] of Object.entries(e)) {
31
+ const i = n == null ? void 0 : n.toAlias;
32
+ typeof i == "function" ? o[r] = i() : t && t[r] ? o[t[r]] = n : o[r] = n;
33
+ }
34
+ return o;
35
+ }
36
+ function p(e, t) {
37
+ return Object.entries(e).reduce((o, [r, n]) => (o[r] = t(n), o), {});
38
+ }
39
+ export {
40
+ s as assign,
41
+ l as getter,
42
+ p as mapValues,
43
+ y as query,
44
+ j as toAlias
45
+ };
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "webpb",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "The webpb runtime library",
5
- "types": "./dist/index.d.ts",
6
5
  "scripts": {
7
6
  "build": "rimraf build/**/* && tsc && vite build && dts-bundle-generator --config ./dts-bundle-generator.config.ts && copyfiles ./README.md ./package.json build",
8
7
  "check": "npm run lint && npm run test",
@@ -21,11 +20,14 @@
21
20
  "type": "git",
22
21
  "url": "https://github.com/jinganix/webpb"
23
22
  },
24
- "module": "./dist/index.js",
25
23
  "type": "module",
24
+ "main": "./dist/index.cjs",
25
+ "module": "./dist/index.mjs",
26
+ "types": "./dist/index.d.ts",
26
27
  "exports": {
27
28
  ".": [
28
29
  {
30
+ "types": "./dist/index.d.ts",
29
31
  "import": "./dist/index.mjs",
30
32
  "require": "./dist/index.cjs"
31
33
  },
@@ -34,13 +36,13 @@
34
36
  },
35
37
  "devDependencies": {
36
38
  "@eslint/compat": "^1.2.4",
37
- "@types/node": "^22.10.1",
38
- "@typescript-eslint/eslint-plugin": "^8.17.0",
39
- "@typescript-eslint/parser": "^8.17.0",
39
+ "@types/node": "^22.10.2",
40
+ "@typescript-eslint/eslint-plugin": "^8.18.2",
41
+ "@typescript-eslint/parser": "^8.18.2",
40
42
  "@vitest/coverage-v8": "^2.1.8",
41
43
  "copyfiles": "^2.4.1",
42
44
  "dts-bundle-generator": "^9.5.1",
43
- "eslint": "^9.16.0",
45
+ "eslint": "^9.17.0",
44
46
  "eslint-config-prettier": "^9.1.0",
45
47
  "eslint-plugin-import": "^2.31.0",
46
48
  "eslint-plugin-import-quotes": "^0.0.1",
@@ -52,8 +54,8 @@
52
54
  "rimraf": "^6.0.1",
53
55
  "ts-node": "^10.9.2",
54
56
  "typescript": "^5.7.2",
55
- "typescript-eslint": "^8.17.0",
56
- "vite": "^6.0.3",
57
+ "typescript-eslint": "^8.18.2",
58
+ "vite": "^6.0.5",
57
59
  "vitest": "^2.1.8"
58
60
  }
59
61
  }
package/dist/index.ejs DELETED
@@ -1,51 +0,0 @@
1
- function u(e, o, n) {
2
- if (!(!e || !o || typeof e != "object" || typeof o != "object"))
3
- for (const [r, t] of Object.entries(e))
4
- t !== void 0 && !i(r, n) && (o[r] = t);
5
- }
6
- function i(e, o) {
7
- if (!o)
8
- return !1;
9
- for (const n of o)
10
- if (n === e)
11
- return !0;
12
- return !1;
13
- }
14
- function c(e, o) {
15
- if (e == null || typeof e != "object")
16
- return null;
17
- for (const n of o.split("."))
18
- if (e = e[n], e == null)
19
- return e;
20
- return e;
21
- }
22
- function s(e, o) {
23
- const n = [];
24
- for (const [r, t] of Object.entries(o)) {
25
- if (t == null || typeof t == "function")
26
- continue;
27
- const f = encodeURIComponent(String(t));
28
- f && n.push(`${r}=${f}`);
29
- }
30
- return n.length ? `${e}${n.join("&")}` : "";
31
- }
32
- function l(e, o) {
33
- if (!e || typeof e != "object" || Array.isArray(e))
34
- return e;
35
- const n = {};
36
- for (const [r, t] of Object.entries(e)) {
37
- const f = t == null ? void 0 : t.toAlias;
38
- typeof f == "function" ? n[r] = f() : o && o[r] ? n[o[r]] = t : n[r] = t;
39
- }
40
- return n;
41
- }
42
- function y(e, o) {
43
- return Object.entries(e).reduce((n, [r, t]) => (n[r] = o(t), n), {});
44
- }
45
- export {
46
- u as assign,
47
- c as getter,
48
- y as mapValues,
49
- s as query,
50
- l as toAlias
51
- };