@poppinss/utils 7.0.0-next.0 → 7.0.0-next.2
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/README.md +3 -3
- package/build/chunk-SKNTF5Q5.js +14 -0
- package/build/chunk-XFX47BKO.js +23 -0
- package/build/chunk-YFSCSJNE.js +33 -0
- package/build/index.js +19 -76
- package/build/lodash/main.cjs +16 -16
- package/build/modules/assert.js +31 -0
- package/build/modules/base64.js +43 -0
- package/build/modules/exception.d.ts +1 -1
- package/build/modules/exception.js +12 -0
- package/build/modules/fs/main.js +82 -0
- package/build/modules/json/main.js +8 -0
- package/build/modules/string/main.js +6 -0
- package/build/modules/string/string_builder.js +6 -0
- package/build/modules/types.js +2 -0
- package/build/src/compose.d.ts +1 -1
- package/lodash/lodash.types.d.ts +18 -0
- package/package.json +17 -18
package/README.md
CHANGED
|
@@ -40,9 +40,7 @@ Even though I do not care much about package size (most of my work is consumed o
|
|
|
40
40
|
|
|
41
41
|
Here's the last checked install size of this package.
|
|
42
42
|
|
|
43
|
-
<a href="https://pkg-size.dev/@poppinss/utils@next">
|
|
44
|
-
<img src="https://pkg-size.dev/badge/install/319382" title="Install size for @poppinss/utils">
|
|
45
|
-
</a>
|
|
43
|
+
<a href="https://pkg-size.dev/@poppinss/utils@next"><img src="https://pkg-size.dev/badge/install/370120" title="Install size for @poppinss/utils"></a>
|
|
46
44
|
|
|
47
45
|
## Installation
|
|
48
46
|
|
|
@@ -106,7 +104,9 @@ Lodash is quite a big library, and we do not use all its helper methods. Therefo
|
|
|
106
104
|
- merge
|
|
107
105
|
- size
|
|
108
106
|
- clone
|
|
107
|
+
- cloneWith
|
|
109
108
|
- cloneDeep
|
|
109
|
+
- cloneDeepWith
|
|
110
110
|
- toPath
|
|
111
111
|
|
|
112
112
|
You can use the methods as follows.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/natural_sort.ts
|
|
2
|
+
function naturalSort(current, next) {
|
|
3
|
+
return current.localeCompare(next, void 0, { numeric: true, sensitivity: "base" });
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// src/is_script_file.ts
|
|
7
|
+
import { extname } from "path";
|
|
8
|
+
var JS_MODULES = [".js", ".json", ".cjs", ".mjs"];
|
|
9
|
+
function isScriptFile(filePath) {
|
|
10
|
+
const ext = extname(filePath);
|
|
11
|
+
if (JS_MODULES.includes(ext)) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (ext === ".ts" && !filePath.endsWith(".d.ts")) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
naturalSort,
|
|
22
|
+
isScriptFile
|
|
23
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// modules/json/safe_parse.ts
|
|
2
|
+
import { parse } from "secure-json-parse";
|
|
3
|
+
function safeParse(jsonString, reviver) {
|
|
4
|
+
return parse(jsonString, reviver, {
|
|
5
|
+
protoAction: "remove",
|
|
6
|
+
constructorAction: "remove"
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// modules/json/safe_stringify.ts
|
|
11
|
+
import { configure } from "safe-stable-stringify";
|
|
12
|
+
var stringify = configure({
|
|
13
|
+
bigint: false,
|
|
14
|
+
circularValue: void 0,
|
|
15
|
+
deterministic: false
|
|
16
|
+
});
|
|
17
|
+
function jsonStringifyReplacer(replacer) {
|
|
18
|
+
return function(key, value) {
|
|
19
|
+
const val = replacer ? replacer.call(this, key, value) : value;
|
|
20
|
+
if (typeof val === "bigint") {
|
|
21
|
+
return val.toString();
|
|
22
|
+
}
|
|
23
|
+
return val;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function safeStringify(value, replacer, space) {
|
|
27
|
+
return stringify(value, jsonStringifyReplacer(replacer), space);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
safeParse,
|
|
32
|
+
safeStringify
|
|
33
|
+
};
|
package/build/index.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
1
|
+
import {
|
|
2
|
+
RuntimeException
|
|
3
|
+
} from "./chunk-SKNTF5Q5.js";
|
|
4
|
+
import {
|
|
5
|
+
isScriptFile,
|
|
6
|
+
naturalSort
|
|
7
|
+
} from "./chunk-XFX47BKO.js";
|
|
8
|
+
import {
|
|
9
|
+
safeParse,
|
|
10
|
+
safeStringify
|
|
11
|
+
} from "./chunk-YFSCSJNE.js";
|
|
14
12
|
|
|
15
13
|
// src/secret.ts
|
|
16
14
|
var REDACTED = "[redacted]";
|
|
@@ -64,53 +62,29 @@ function flatten(input, glue, keepNullish) {
|
|
|
64
62
|
}
|
|
65
63
|
|
|
66
64
|
// src/safe_equal.ts
|
|
67
|
-
import { Buffer
|
|
65
|
+
import { Buffer } from "buffer";
|
|
68
66
|
import { timingSafeEqual } from "crypto";
|
|
69
67
|
function safeEqual(trustedValue, userInput) {
|
|
70
68
|
if (typeof trustedValue === "string" && typeof userInput === "string") {
|
|
71
|
-
const trustedLength =
|
|
72
|
-
const trustedValueBuffer =
|
|
69
|
+
const trustedLength = Buffer.byteLength(trustedValue);
|
|
70
|
+
const trustedValueBuffer = Buffer.alloc(trustedLength, 0, "utf-8");
|
|
73
71
|
trustedValueBuffer.write(trustedValue);
|
|
74
|
-
const userValueBuffer =
|
|
72
|
+
const userValueBuffer = Buffer.alloc(trustedLength, 0, "utf-8");
|
|
75
73
|
userValueBuffer.write(userInput);
|
|
76
|
-
return timingSafeEqual(trustedValueBuffer, userValueBuffer) && trustedLength ===
|
|
74
|
+
return timingSafeEqual(trustedValueBuffer, userValueBuffer) && trustedLength === Buffer.byteLength(userInput);
|
|
77
75
|
}
|
|
78
76
|
return timingSafeEqual(
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
Buffer.from(trustedValue),
|
|
78
|
+
Buffer.from(userInput)
|
|
81
79
|
);
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
// src/natural_sort.ts
|
|
85
|
-
function naturalSort(current, next) {
|
|
86
|
-
return current.localeCompare(next, void 0, { numeric: true, sensitivity: "base" });
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// src/is_script_file.ts
|
|
90
|
-
import { extname } from "path";
|
|
91
|
-
var JS_MODULES = [".js", ".json", ".cjs", ".mjs"];
|
|
92
|
-
function isScriptFile(filePath) {
|
|
93
|
-
const ext = extname(filePath);
|
|
94
|
-
if (JS_MODULES.includes(ext)) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
if (ext === ".ts" && !filePath.endsWith(".d.ts")) {
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// modules/exception.ts
|
|
104
|
-
var exception_exports = {};
|
|
105
|
-
__reExport(exception_exports, exception_star);
|
|
106
|
-
import * as exception_star from "@poppinss/exception";
|
|
107
|
-
|
|
108
82
|
// src/import_default.ts
|
|
109
83
|
async function importDefault(importFn, filePath) {
|
|
110
84
|
const moduleExports = await importFn();
|
|
111
85
|
if (!("default" in moduleExports)) {
|
|
112
86
|
const errorMessage = filePath ? `Missing "export default" in module "${filePath}"` : `Missing "export default" from lazy import "${importFn}"`;
|
|
113
|
-
throw new
|
|
87
|
+
throw new RuntimeException(errorMessage, {
|
|
114
88
|
cause: {
|
|
115
89
|
source: importFn
|
|
116
90
|
}
|
|
@@ -121,37 +95,6 @@ async function importDefault(importFn, filePath) {
|
|
|
121
95
|
|
|
122
96
|
// src/message_builder.ts
|
|
123
97
|
import string from "@poppinss/string";
|
|
124
|
-
|
|
125
|
-
// modules/json/safe_parse.ts
|
|
126
|
-
import { parse } from "secure-json-parse";
|
|
127
|
-
function safeParse(jsonString, reviver) {
|
|
128
|
-
return parse(jsonString, reviver, {
|
|
129
|
-
protoAction: "remove",
|
|
130
|
-
constructorAction: "remove"
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// modules/json/safe_stringify.ts
|
|
135
|
-
import { configure } from "safe-stable-stringify";
|
|
136
|
-
var stringify = configure({
|
|
137
|
-
bigint: false,
|
|
138
|
-
circularValue: void 0,
|
|
139
|
-
deterministic: false
|
|
140
|
-
});
|
|
141
|
-
function jsonStringifyReplacer(replacer) {
|
|
142
|
-
return function(key, value) {
|
|
143
|
-
const val = replacer ? replacer.call(this, key, value) : value;
|
|
144
|
-
if (typeof val === "bigint") {
|
|
145
|
-
return val.toString();
|
|
146
|
-
}
|
|
147
|
-
return val;
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
function safeStringify(value, replacer, space) {
|
|
151
|
-
return stringify(value, jsonStringifyReplacer(replacer), space);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// src/message_builder.ts
|
|
155
98
|
var MessageBuilder = class {
|
|
156
99
|
#getExpiryDate(expiresIn) {
|
|
157
100
|
if (!expiresIn) {
|
package/build/lodash/main.cjs
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* Lodash (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
|
|
4
|
-
* Build: `lodash include="pick,omit,has,get,set,unset,mergeWith,merge,size,clone,cloneDeep,toPath" --production`
|
|
4
|
+
* Build: `lodash include="pick,omit,has,get,set,unset,mergeWith,merge,size,clone,cloneWith,cloneDeep,cloneDeepWith,toPath" --production`
|
|
5
5
|
*/
|
|
6
6
|
;(function(){function t(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function e(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&false!==e(t[n],n,t););}function n(t,e){for(var n=-1,r=null==t?0:t.length,u=0,o=[];++n<r;){var c=t[n];e(c,n,t)&&(o[u++]=c)}return o}function r(t,e){for(var n=-1,r=null==t?0:t.length,u=Array(r);++n<r;)u[n]=e(t[n],n,t);return u}function u(t,e){for(var n=-1,r=e.length,u=t.length;++n<r;)t[u+n]=e[n];
|
|
7
7
|
return t}function o(t){return function(e){return t(e)}}function c(t){var e=Object;return function(n){return t(e(n))}}function i(){}function f(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function a(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function l(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function s(t){this.size=(this.__data__=new a(t)).size}function b(t,e){
|
|
8
8
|
var n=Ye(t),r=!n&&Xe(t),u=!n&&!r&&Ze(t),o=!n&&!r&&!u&&nn(t);if(n=n||r||u||o){for(var r=t.length,c=String,i=-1,f=Array(r);++i<r;)f[i]=c(i);r=f}else r=[];var a,c=r.length;for(a in t)!e&&!fe.call(t,a)||n&&("length"==a||u&&("offset"==a||"parent"==a)||o&&("buffer"==a||"byteLength"==a||"byteOffset"==a)||ut(a,c))||r.push(a);return r}function p(t,e,n){(n===Mt||bt(t[e],n))&&(n!==Mt||e in t)||d(t,e,n)}function h(t,e,n){var r=t[e];fe.call(t,e)&&bt(r,n)&&(n!==Mt||e in t)||d(t,e,n)}function y(t,e){for(var n=t.length;n--;)if(bt(t[n][0],e))return n;
|
|
9
|
-
return-1}function j(t,e){return t&&
|
|
9
|
+
return-1}function j(t,e){return t&&V(e,St(e),t)}function _(t,e){return t&&V(e,zt(e),t)}function d(t,e,n){"__proto__"==e&&we?we(t,e,{configurable:true,enumerable:true,value:n,writable:true}):t[e]=n}function g(t,n,r,u,o,c){var i,f=1&n,a=2&n,l=4&n;if(r&&(i=o?r(t,u,o,c):r(t)),i!==Mt)return i;if(!_t(t))return t;if(u=Ye(t)){if(i=tt(t),!f)return T(t,i)}else{var b=Je(t),p="[object Function]"==b||"[object GeneratorFunction]"==b;if(Ze(t))return R(t,f);if("[object Object]"==b||"[object Arguments]"==b||p&&!o){if(i=a||p?{}:et(t),
|
|
10
10
|
!f)return a?G(t,_(i,t)):N(t,j(i,t))}else{if(!Gt[b])return o?t:{};i=nt(t,b,f)}}if(c||(c=new s),o=c.get(t))return o;if(c.set(t,i),en(t))return t.forEach(function(e){i.add(g(e,n,r,e,t,c))}),i;if(tn(t))return t.forEach(function(e,u){i.set(u,g(e,n,r,u,t,c))}),i;var a=l?a?Q:K:a?zt:St,y=u?Mt:a(t);return e(y||t,function(e,u){y&&(u=e,e=t[u]),h(i,u,g(e,n,r,u,t,c))}),i}function v(t,e,n,r,o){var c=-1,i=t.length;for(n||(n=rt),o||(o=[]);++c<i;){var f=t[c];0<e&&n(f)?1<e?v(f,e-1,n,r,o):u(o,f):r||(o[o.length]=f)}
|
|
11
11
|
return o}function A(t,e){e=C(e,t);for(var n=0,r=e.length;null!=t&&n<r;)t=t[it(e[n++])];return n&&n==r?t:Mt}function m(t,e,n){return e=e(t),Ye(t)?e:u(e,n(t))}function w(t){if(null==t)t=t===Mt?"[object Undefined]":"[object Null]";else if(me&&me in Object(t)){var e=fe.call(t,me),n=t[me];try{t[me]=Mt;var r=true}catch(t){}var u=le.call(t);r&&(e?t[me]=n:delete t[me]),t=u}else t=le.call(t);return t}function O(t,e){return null!=t&&fe.call(t,e)}function S(t,e){return null!=t&&e in Object(t)}function z(t){return dt(t)&&"[object Arguments]"==w(t);
|
|
12
12
|
}function x(t){return dt(t)&&"[object Map]"==Je(t)}function k(t){return dt(t)&&"[object Set]"==Je(t)}function F(t){return dt(t)&&jt(t.length)&&!!Nt[w(t)]}function I(t){if(!ot(t))return ze(t);var e,n=[];for(e in Object(t))fe.call(t,e)&&"constructor"!=e&&n.push(e);return n}function M(t,e,n,r,u){t!==e&&Ne(e,function(o,c){if(_t(o)){u||(u=new s);var i=u,f="__proto__"==c?Mt:t[c],a="__proto__"==c?Mt:e[c],l=i.get(a);if(l)p(t,c,l);else{var l=r?r(f,a,c+"",t,e,i):Mt,b=l===Mt;if(b){var h=Ye(a),y=!h&&Ze(a),j=!h&&!y&&nn(a),l=a;
|
|
13
|
-
h||y||j?Ye(f)?l=f:ht(f)?l=
|
|
14
|
-
if(!_t(t))return t;e=C(e,t);for(var r=-1,u=e.length,o=u-1,c=t;null!=c&&++r<u;){var i=it(e[r]),f=n;if(r!=o){var a=c[i],f=Mt;f===Mt&&(f=_t(a)?a:ut(e[r+1])?[]:{})}h(c,i,f),c=c[i]}return t}function $(t){if(typeof t=="string")return t;if(Ye(t))return r(t,$)+"";if(At(t))return
|
|
15
|
-
n=A(t,u)}return t=n,null==t||delete t[it(lt(e))]}function C(t,e){var n;return Ye(t)?n=t:(Ye(t)?n=false:(n=typeof t,n=!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!At(t))||(Pt.test(t)||!Ut.test(t)||null!=e&&t in Object(e))),n=n?[t]:Qe(wt(t))),n}function R(t,e){if(e)return t.slice();var n=t.length,n=je?je(n):new t.constructor(n);return t.copy(n),n}function
|
|
16
|
-
}function
|
|
13
|
+
h||y||j?Ye(f)?l=f:ht(f)?l=T(f):y?(b=false,l=R(a,true)):j?(b=false,l=L(a,true)):l=[]:gt(a)||Xe(a)?(l=f,Xe(f)?l=mt(f):(!_t(f)||n&&yt(f))&&(l=et(a))):b=false}b&&(i.set(a,l),M(l,a,n,r,i),i.delete(a)),p(t,c,l)}}else i=r?r("__proto__"==c?Mt:t[c],o,c+"",t,e,u):Mt,i===Mt&&(i=o),p(t,c,i)},zt)}function E(t,e){return U(t,e,function(e,n){return Ot(t,n)})}function U(t,e,n){for(var r=-1,u=e.length,o={};++r<u;){var c=e[r],i=A(t,c);n(i,c)&&D(o,C(c,t),i)}return o}function P(t){return Ke(ct(t,void 0,kt),t+"")}function D(t,e,n){
|
|
14
|
+
if(!_t(t))return t;e=C(e,t);for(var r=-1,u=e.length,o=u-1,c=t;null!=c&&++r<u;){var i=it(e[r]),f=n;if(r!=o){var a=c[i],f=Mt;f===Mt&&(f=_t(a)?a:ut(e[r+1])?[]:{})}h(c,i,f),c=c[i]}return t}function $(t){if(typeof t=="string")return t;if(Ye(t))return r(t,$)+"";if(At(t))return Te?Te.call(t):"";var e=t+"";return"0"==e&&1/t==-Et?"-0":e}function B(t,e){e=C(e,t);var n;if(2>e.length)n=t;else{n=e;var r=0,u=-1,o=-1,c=n.length;for(0>r&&(r=-r>c?0:c+r),u=u>c?c:u,0>u&&(u+=c),c=r>u?0:u-r>>>0,r>>>=0,u=Array(c);++o<c;)u[o]=n[o+r];
|
|
15
|
+
n=A(t,u)}return t=n,null==t||delete t[it(lt(e))]}function C(t,e){var n;return Ye(t)?n=t:(Ye(t)?n=false:(n=typeof t,n=!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!At(t))||(Pt.test(t)||!Ut.test(t)||null!=e&&t in Object(e))),n=n?[t]:Qe(wt(t))),n}function R(t,e){if(e)return t.slice();var n=t.length,n=je?je(n):new t.constructor(n);return t.copy(n),n}function W(t){var e=new t.constructor(t.byteLength);return new ye(e).set(new ye(t)),e}function L(t,e){return new t.constructor(e?W(t.buffer):t.buffer,t.byteOffset,t.length);
|
|
16
|
+
}function T(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}function V(t,e,n){var r=!n;n||(n={});for(var u=-1,o=e.length;++u<o;){var c=e[u],i=Mt;i===Mt&&(i=t[c]),r?d(n,c,i):h(n,c,i)}return n}function N(t,e){return V(t,qe(t),e)}function G(t,e){return V(t,He(t),e)}function q(t){return P(function(e,n){var r,u=-1,o=n.length,c=1<o?n[o-1]:Mt,i=2<o?n[2]:Mt,c=3<t.length&&typeof c=="function"?(o--,c):Mt;if(r=i){r=n[0];var f=n[1];if(_t(i)){var a=typeof f;r=!!("number"==a?pt(i)&&ut(f,i.length):"string"==a&&f in i)&&bt(i[f],r);
|
|
17
17
|
}else r=false}for(r&&(c=3>o?Mt:c,o=1),e=Object(e);++u<o;)(i=n[u])&&t(e,i,u,c);return e})}function H(t){return gt(t)?Mt:t}function J(t){return Ke(ct(t,Mt,at),t+"")}function K(t){return m(t,St,qe)}function Q(t){return m(t,zt,He)}function X(t,e){var n=t.__data__,r=typeof e;return("string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e)?n[typeof e=="string"?"string":"hash"]:n.map}function Y(t,e){var n=null==t?Mt:t[e];return(!_t(n)||ae&&ae in n?0:(yt(n)?be:Ct).test(ft(n)))?n:Mt}function Z(t,e,n){
|
|
18
|
-
e=C(e,t);for(var r=-1,u=e.length,o=false;++r<u;){var c=it(e[r]);if(!(o=null!=t&&n(t,c)))break;t=t[c]}return o||++r!=u?o:(u=null==t?0:t.length,!!u&&jt(u)&&ut(c,u)&&(Ye(t)||Xe(t)))}function tt(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&fe.call(t,"index")&&(n.index=t.index,n.input=t.input),n}function et(t){return typeof t.constructor!="function"||ot(t)?{}:
|
|
19
|
-
case"[object Date]":return new r(+t);case"[object DataView]":return e=n?
|
|
20
|
-
return e=new t.constructor(t.source,Bt.exec(t)),e.lastIndex=t.lastIndex,e;case"[object Set]":return new r;case"[object Symbol]":return
|
|
18
|
+
e=C(e,t);for(var r=-1,u=e.length,o=false;++r<u;){var c=it(e[r]);if(!(o=null!=t&&n(t,c)))break;t=t[c]}return o||++r!=u?o:(u=null==t?0:t.length,!!u&&jt(u)&&ut(c,u)&&(Ye(t)||Xe(t)))}function tt(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&fe.call(t,"index")&&(n.index=t.index,n.input=t.input),n}function et(t){return typeof t.constructor!="function"||ot(t)?{}:Ve(_e(t))}function nt(t,e,n){var r=t.constructor;switch(e){case"[object ArrayBuffer]":return W(t);case"[object Boolean]":
|
|
19
|
+
case"[object Date]":return new r(+t);case"[object DataView]":return e=n?W(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return L(t,n);case"[object Map]":return new r;case"[object Number]":case"[object String]":return new r(t);case"[object RegExp]":
|
|
20
|
+
return e=new t.constructor(t.source,Bt.exec(t)),e.lastIndex=t.lastIndex,e;case"[object Set]":return new r;case"[object Symbol]":return Le?Object(Le.call(t)):{}}}function rt(t){return Ye(t)||Xe(t)||!!(Ae&&t&&t[Ae])}function ut(t,e){var n=typeof t;return e=null==e?9007199254740991:e,!!e&&("number"==n||"symbol"!=n&&Rt.test(t))&&-1<t&&0==t%1&&t<e}function ot(t){var e=t&&t.constructor;return t===(typeof e=="function"&&e.prototype||oe)}function ct(e,n,r){return n=xe(n===Mt?e.length-1:n,0),function(){for(var u=arguments,o=-1,c=xe(u.length-n,0),i=Array(c);++o<c;)i[o]=u[n+o];
|
|
21
21
|
for(o=-1,c=Array(n+1);++o<n;)c[o]=u[o];return c[n]=r(i),t(e,this,c)}}function it(t){if(typeof t=="string"||At(t))return t;var e=t+"";return"0"==e&&1/t==-Et?"-0":e}function ft(t){if(null!=t){try{return ie.call(t)}catch(t){}return t+""}return""}function at(t){return(null==t?0:t.length)?v(t,1):[]}function lt(t){var e=null==t?0:t.length;return e?t[e-1]:Mt}function st(t,e){function n(){var r=arguments,u=e?e.apply(this,r):r[0],o=n.cache;return o.has(u)?o.get(u):(r=t.apply(this,r),n.cache=o.set(u,r)||o,
|
|
22
22
|
r)}if(typeof t!="function"||null!=e&&typeof e!="function")throw new TypeError("Expected a function");return n.cache=new(st.Cache||l),n}function bt(t,e){return t===e||t!==t&&e!==e}function pt(t){return null!=t&&jt(t.length)&&!yt(t)}function ht(t){return dt(t)&&pt(t)}function yt(t){return!!_t(t)&&(t=w(t),"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function jt(t){return typeof t=="number"&&-1<t&&0==t%1&&9007199254740991>=t}function _t(t){
|
|
23
|
-
var e=typeof t;return null!=t&&("object"==e||"function"==e)}function dt(t){return null!=t&&typeof t=="object"}function gt(t){return!(!dt(t)||"[object Object]"!=w(t))&&(t=_e(t),null===t||(t=fe.call(t,"constructor")&&t.constructor,typeof t=="function"&&t instanceof t&&ie.call(t)==se))}function vt(t){return typeof t=="string"||!Ye(t)&&dt(t)&&"[object String]"==w(t)}function At(t){return typeof t=="symbol"||dt(t)&&"[object Symbol]"==w(t)}function mt(t){return
|
|
24
|
-
}function Ot(t,e){return null!=t&&Z(t,e,S)}function St(t){return pt(t)?b(t):I(t)}function zt(t){if(pt(t))t=b(t,true);else if(_t(t)){var e,n=ot(t),r=[];for(e in t)("constructor"!=e||!n&&fe.call(t,e))&&r.push(e);t=r}else{if(e=[],null!=t)for(n in Object(t))e.push(n);t=e}return t}function xt(t){return function(){return t}}function kt(t){return t}function Ft(){return[]}function It(){return false}var Mt,Et=1/0,Ut=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pt=/^\w*$/,Dt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$t=/\\(\\)?/g,Bt=/\w*$/,Ct=/^\[object .+?Constructor\]$/,Rt=/^(?:0|[1-9]\d*)$/,
|
|
23
|
+
var e=typeof t;return null!=t&&("object"==e||"function"==e)}function dt(t){return null!=t&&typeof t=="object"}function gt(t){return!(!dt(t)||"[object Object]"!=w(t))&&(t=_e(t),null===t||(t=fe.call(t,"constructor")&&t.constructor,typeof t=="function"&&t instanceof t&&ie.call(t)==se))}function vt(t){return typeof t=="string"||!Ye(t)&&dt(t)&&"[object String]"==w(t)}function At(t){return typeof t=="symbol"||dt(t)&&"[object Symbol]"==w(t)}function mt(t){return V(t,zt(t))}function wt(t){return null==t?"":$(t);
|
|
24
|
+
}function Ot(t,e){return null!=t&&Z(t,e,S)}function St(t){return pt(t)?b(t):I(t)}function zt(t){if(pt(t))t=b(t,true);else if(_t(t)){var e,n=ot(t),r=[];for(e in t)("constructor"!=e||!n&&fe.call(t,e))&&r.push(e);t=r}else{if(e=[],null!=t)for(n in Object(t))e.push(n);t=e}return t}function xt(t){return function(){return t}}function kt(t){return t}function Ft(){return[]}function It(){return false}var Mt,Et=1/0,Ut=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pt=/^\w*$/,Dt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$t=/\\(\\)?/g,Bt=/\w*$/,Ct=/^\[object .+?Constructor\]$/,Rt=/^(?:0|[1-9]\d*)$/,Wt="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",Lt="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",Tt=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+Lt+Wt,"g"),Vt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),Nt={};
|
|
25
25
|
Nt["[object Float32Array]"]=Nt["[object Float64Array]"]=Nt["[object Int8Array]"]=Nt["[object Int16Array]"]=Nt["[object Int32Array]"]=Nt["[object Uint8Array]"]=Nt["[object Uint8ClampedArray]"]=Nt["[object Uint16Array]"]=Nt["[object Uint32Array]"]=true,Nt["[object Arguments]"]=Nt["[object Array]"]=Nt["[object ArrayBuffer]"]=Nt["[object Boolean]"]=Nt["[object DataView]"]=Nt["[object Date]"]=Nt["[object Error]"]=Nt["[object Function]"]=Nt["[object Map]"]=Nt["[object Number]"]=Nt["[object Object]"]=Nt["[object RegExp]"]=Nt["[object Set]"]=Nt["[object String]"]=Nt["[object WeakMap]"]=false;
|
|
26
26
|
var Gt={};Gt["[object Arguments]"]=Gt["[object Array]"]=Gt["[object ArrayBuffer]"]=Gt["[object DataView]"]=Gt["[object Boolean]"]=Gt["[object Date]"]=Gt["[object Float32Array]"]=Gt["[object Float64Array]"]=Gt["[object Int8Array]"]=Gt["[object Int16Array]"]=Gt["[object Int32Array]"]=Gt["[object Map]"]=Gt["[object Number]"]=Gt["[object Object]"]=Gt["[object RegExp]"]=Gt["[object Set]"]=Gt["[object String]"]=Gt["[object Symbol]"]=Gt["[object Uint8Array]"]=Gt["[object Uint8ClampedArray]"]=Gt["[object Uint16Array]"]=Gt["[object Uint32Array]"]=true,
|
|
27
27
|
Gt["[object Error]"]=Gt["[object Function]"]=Gt["[object WeakMap]"]=false;var qt,Ht=typeof global=="object"&&global&&global.Object===Object&&global,Jt=typeof self=="object"&&self&&self.Object===Object&&self,Kt=Ht||Jt||Function("return this")(),Qt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Xt=Qt&&typeof module=="object"&&module&&!module.nodeType&&module,Yt=Xt&&Xt.exports===Qt,Zt=Yt&&Ht.process;t:{try{qt=Zt&&Zt.binding&&Zt.binding("util");break t}catch(t){}qt=void 0}var te=qt&&qt.isMap,ee=qt&&qt.isSet,ne=qt&&qt.isTypedArray,re=function(t){
|
|
28
28
|
return function(e){return null==e?Mt:e[t]}}("length"),ue=Array.prototype,oe=Object.prototype,ce=Kt["__core-js_shared__"],ie=Function.prototype.toString,fe=oe.hasOwnProperty,ae=function(){var t=/[^.]+$/.exec(ce&&ce.keys&&ce.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),le=oe.toString,se=ie.call(Object),be=RegExp("^"+ie.call(fe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pe=Yt?Kt.Buffer:Mt,he=Kt.Symbol,ye=Kt.Uint8Array,je=pe?pe.a:Mt,_e=c(Object.getPrototypeOf),de=Object.create,ge=oe.propertyIsEnumerable,ve=ue.splice,Ae=he?he.isConcatSpreadable:Mt,me=he?he.toStringTag:Mt,we=function(){
|
|
29
|
-
try{var t=Y(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Oe=Object.getOwnPropertySymbols,Se=pe?pe.isBuffer:Mt,ze=c(Object.keys),xe=Math.max,ke=Date.now,Fe=Y(Kt,"DataView"),Ie=Y(Kt,"Map"),Me=Y(Kt,"Promise"),Ee=Y(Kt,"Set"),Ue=Y(Kt,"WeakMap"),Pe=Y(Object,"create"),De=ft(Fe),$e=ft(Ie),Be=ft(Me),Ce=ft(Ee),Re=ft(Ue),
|
|
29
|
+
try{var t=Y(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Oe=Object.getOwnPropertySymbols,Se=pe?pe.isBuffer:Mt,ze=c(Object.keys),xe=Math.max,ke=Date.now,Fe=Y(Kt,"DataView"),Ie=Y(Kt,"Map"),Me=Y(Kt,"Promise"),Ee=Y(Kt,"Set"),Ue=Y(Kt,"WeakMap"),Pe=Y(Object,"create"),De=ft(Fe),$e=ft(Ie),Be=ft(Me),Ce=ft(Ee),Re=ft(Ue),We=he?he.prototype:Mt,Le=We?We.valueOf:Mt,Te=We?We.toString:Mt,Ve=function(){function t(){}return function(e){return _t(e)?de?de(e):(t.prototype=e,e=new t,t.prototype=Mt,e):{};
|
|
30
30
|
}}();f.prototype.clear=function(){this.__data__=Pe?Pe(null):{},this.size=0},f.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},f.prototype.get=function(t){var e=this.__data__;return Pe?(t=e[t],"__lodash_hash_undefined__"===t?Mt:t):fe.call(e,t)?e[t]:Mt},f.prototype.has=function(t){var e=this.__data__;return Pe?e[t]!==Mt:fe.call(e,t)},f.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Pe&&e===Mt?"__lodash_hash_undefined__":e,
|
|
31
31
|
this},a.prototype.clear=function(){this.__data__=[],this.size=0},a.prototype.delete=function(t){var e=this.__data__;return t=y(e,t),!(0>t)&&(t==e.length-1?e.pop():ve.call(e,t,1),--this.size,true)},a.prototype.get=function(t){var e=this.__data__;return t=y(e,t),0>t?Mt:e[t][1]},a.prototype.has=function(t){return-1<y(this.__data__,t)},a.prototype.set=function(t,e){var n=this.__data__,r=y(n,t);return 0>r?(++this.size,n.push([t,e])):n[r][1]=e,this},l.prototype.clear=function(){this.size=0,this.__data__={
|
|
32
32
|
hash:new f,map:new(Ie||a),string:new f}},l.prototype.delete=function(t){return t=X(this,t).delete(t),this.size-=t?1:0,t},l.prototype.get=function(t){return X(this,t).get(t)},l.prototype.has=function(t){return X(this,t).has(t)},l.prototype.set=function(t,e){var n=X(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},s.prototype.clear=function(){this.__data__=new a,this.size=0},s.prototype.delete=function(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t},s.prototype.get=function(t){
|
|
33
33
|
return this.__data__.get(t)},s.prototype.has=function(t){return this.__data__.has(t)},s.prototype.set=function(t,e){var n=this.__data__;if(n instanceof a){var r=n.__data__;if(!Ie||199>r.length)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new l(r)}return n.set(t,e),this.size=n.size,this};var Ne=function(t){return function(e,n,r){var u=-1,o=Object(e);r=r(e);for(var c=r.length;c--;){var i=r[t?c:++u];if(false===n(o[i],i,o))break}return e}}(),Ge=we?function(t,e){return we(t,"toString",{configurable:true,
|
|
34
34
|
enumerable:false,value:xt(e),writable:true})}:kt,qe=Oe?function(t){return null==t?[]:(t=Object(t),n(Oe(t),function(e){return ge.call(t,e)}))}:Ft,He=Oe?function(t){for(var e=[];t;)u(e,qe(t)),t=_e(t);return e}:Ft,Je=w;(Fe&&"[object DataView]"!=Je(new Fe(new ArrayBuffer(1)))||Ie&&"[object Map]"!=Je(new Ie)||Me&&"[object Promise]"!=Je(Me.resolve())||Ee&&"[object Set]"!=Je(new Ee)||Ue&&"[object WeakMap]"!=Je(new Ue))&&(Je=function(t){var e=w(t);if(t=(t="[object Object]"==e?t.constructor:Mt)?ft(t):"")switch(t){
|
|
35
35
|
case De:return"[object DataView]";case $e:return"[object Map]";case Be:return"[object Promise]";case Ce:return"[object Set]";case Re:return"[object WeakMap]"}return e});var Ke=function(t){var e=0,n=0;return function(){var r=ke(),u=16-(r-n);if(n=r,0<u){if(800<=++e)return arguments[0]}else e=0;return t.apply(Mt,arguments)}}(Ge),Qe=function(t){t=st(t,function(t){return 500===e.size&&e.clear(),t});var e=t.cache;return t}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Dt,function(t,n,r,u){
|
|
36
|
-
e.push(r?u.replace($t,"$1"):n||t)}),e});st.Cache=l;var Xe=z(function(){return arguments}())?z:function(t){return dt(t)&&fe.call(t,"callee")&&!ge.call(t,"callee")},Ye=Array.isArray,Ze=Se||It,tn=te?o(te):x,en=ee?o(ee):k,nn=ne?o(ne):F,rn=q(function(t,e,n){M(t,e,n)}),un=q(function(t,e,n,r){M(t,e,n,r)}),on=J(function(t,e){var n={};if(null==t)return n;var u=false;e=r(e,function(e){return e=C(e,t),u||(u=1<e.length),e}),
|
|
37
|
-
return null==t?{}:E(t,e)});i.constant=xt,i.flatten=at,i.keys=St,i.keysIn=zt,i.memoize=st,i.merge=rn,i.mergeWith=un,i.omit=on,i.pick=cn,i.set=function(t,e,n){return null==t?t:D(t,e,n)},i.toPath=function(t){return Ye(t)?r(t,it):At(t)?[t]:
|
|
38
|
-
},i.hasIn=Ot,i.identity=kt,i.isArguments=Xe,i.isArray=Ye,i.isArrayLike=pt,i.isArrayLikeObject=ht,i.isBuffer=Ze,i.isFunction=yt,i.isLength=jt,i.isMap=tn,i.isObject=_t,i.isObjectLike=dt,i.isPlainObject=gt,i.isSet=en,i.isString=vt,i.isSymbol=At,i.isTypedArray=nn,i.last=lt,i.stubArray=Ft,i.stubFalse=It,i.size=function(t){if(null==t)return 0;if(pt(t)){if(vt(t))if(
|
|
39
|
-
},i.toString=wt,i.VERSION="4.17.5",typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Kt._=i, define(function(){return i})):Xt?((Xt.exports=i)._=i,Qt._=i):Kt._=i}).call(this);
|
|
36
|
+
e.push(r?u.replace($t,"$1"):n||t)}),e});st.Cache=l;var Xe=z(function(){return arguments}())?z:function(t){return dt(t)&&fe.call(t,"callee")&&!ge.call(t,"callee")},Ye=Array.isArray,Ze=Se||It,tn=te?o(te):x,en=ee?o(ee):k,nn=ne?o(ne):F,rn=q(function(t,e,n){M(t,e,n)}),un=q(function(t,e,n,r){M(t,e,n,r)}),on=J(function(t,e){var n={};if(null==t)return n;var u=false;e=r(e,function(e){return e=C(e,t),u||(u=1<e.length),e}),V(t,Q(t),n),u&&(n=g(n,7,H));for(var o=e.length;o--;)B(n,e[o]);return n}),cn=J(function(t,e){
|
|
37
|
+
return null==t?{}:E(t,e)});i.constant=xt,i.flatten=at,i.keys=St,i.keysIn=zt,i.memoize=st,i.merge=rn,i.mergeWith=un,i.omit=on,i.pick=cn,i.set=function(t,e,n){return null==t?t:D(t,e,n)},i.toPath=function(t){return Ye(t)?r(t,it):At(t)?[t]:T(Qe(wt(t)))},i.toPlainObject=mt,i.unset=function(t,e){return null==t||B(t,e)},i.clone=function(t){return g(t,4)},i.cloneDeep=function(t){return g(t,5)},i.cloneDeepWith=function(t,e){return e=typeof e=="function"?e:Mt,g(t,5,e)},i.cloneWith=function(t,e){return e=typeof e=="function"?e:Mt,
|
|
38
|
+
g(t,4,e)},i.eq=bt,i.get=function(t,e,n){return t=null==t?Mt:A(t,e),t===Mt?n:t},i.has=function(t,e){return null!=t&&Z(t,e,O)},i.hasIn=Ot,i.identity=kt,i.isArguments=Xe,i.isArray=Ye,i.isArrayLike=pt,i.isArrayLikeObject=ht,i.isBuffer=Ze,i.isFunction=yt,i.isLength=jt,i.isMap=tn,i.isObject=_t,i.isObjectLike=dt,i.isPlainObject=gt,i.isSet=en,i.isString=vt,i.isSymbol=At,i.isTypedArray=nn,i.last=lt,i.stubArray=Ft,i.stubFalse=It,i.size=function(t){if(null==t)return 0;if(pt(t)){if(vt(t))if(Vt.test(t)){for(var e=Tt.lastIndex=0;Tt.test(t);)++e;
|
|
39
|
+
t=e}else t=re(t);else t=t.length;return t}return e=Je(t),"[object Map]"==e||"[object Set]"==e?t.size:I(t).length},i.toString=wt,i.VERSION="4.17.5",typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Kt._=i, define(function(){return i})):Xt?((Xt.exports=i)._=i,Qt._=i):Kt._=i}).call(this);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// modules/assert.ts
|
|
2
|
+
import { inspect } from "util";
|
|
3
|
+
import { AssertionError } from "assert";
|
|
4
|
+
function assert(value, message) {
|
|
5
|
+
return assertExists(value, message);
|
|
6
|
+
}
|
|
7
|
+
function assertExists(value, message) {
|
|
8
|
+
if (!value) {
|
|
9
|
+
throw new AssertionError({ message: message ?? "value is falsy" });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function assertUnreachable(x) {
|
|
13
|
+
throw new AssertionError({ message: `unreachable code executed: ${inspect(x)}` });
|
|
14
|
+
}
|
|
15
|
+
function assertNotNull(value, message) {
|
|
16
|
+
if (value === null) {
|
|
17
|
+
throw new AssertionError({ message: message ?? "unexpected null value" });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function assertIsDefined(value, message) {
|
|
21
|
+
if (value === void 0) {
|
|
22
|
+
throw new AssertionError({ message: message ?? "unexpected undefined value" });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
assert,
|
|
27
|
+
assertExists,
|
|
28
|
+
assertIsDefined,
|
|
29
|
+
assertNotNull,
|
|
30
|
+
assertUnreachable
|
|
31
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// modules/base64.ts
|
|
2
|
+
var Base64 = class {
|
|
3
|
+
encode(data, encoding) {
|
|
4
|
+
if (typeof data === "string") {
|
|
5
|
+
return Buffer.from(data, encoding).toString("base64");
|
|
6
|
+
}
|
|
7
|
+
if (Buffer.isBuffer(data)) {
|
|
8
|
+
return data.toString("base64");
|
|
9
|
+
}
|
|
10
|
+
return Buffer.from(data).toString("base64");
|
|
11
|
+
}
|
|
12
|
+
decode(encoded, encoding = "utf-8", strict = false) {
|
|
13
|
+
if (Buffer.isBuffer(encoded)) {
|
|
14
|
+
return encoded.toString(encoding);
|
|
15
|
+
}
|
|
16
|
+
const decoded = Buffer.from(encoded, "base64").toString(encoding);
|
|
17
|
+
const isInvalid = this.encode(decoded, encoding) !== encoded;
|
|
18
|
+
if (strict && isInvalid) {
|
|
19
|
+
throw new Error("Cannot decode malformed value");
|
|
20
|
+
}
|
|
21
|
+
return isInvalid ? null : decoded;
|
|
22
|
+
}
|
|
23
|
+
urlEncode(data, encoding) {
|
|
24
|
+
const encoded = typeof data === "string" ? this.encode(data, encoding) : this.encode(data);
|
|
25
|
+
return encoded.replace(/\+/g, "-").replace(/\//g, "_").replace(/\=/g, "");
|
|
26
|
+
}
|
|
27
|
+
urlDecode(encoded, encoding = "utf-8", strict = false) {
|
|
28
|
+
if (Buffer.isBuffer(encoded)) {
|
|
29
|
+
return encoded.toString(encoding);
|
|
30
|
+
}
|
|
31
|
+
const decoded = Buffer.from(encoded, "base64").toString(encoding);
|
|
32
|
+
const isInvalid = this.urlEncode(decoded, encoding) !== encoded;
|
|
33
|
+
if (strict && isInvalid) {
|
|
34
|
+
throw new Error("Cannot urlDecode malformed value");
|
|
35
|
+
}
|
|
36
|
+
return isInvalid ? null : decoded;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var base64 = new Base64();
|
|
40
|
+
var base64_default = base64;
|
|
41
|
+
export {
|
|
42
|
+
base64_default as default
|
|
43
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { RuntimeException, InvalidArgumentsException, Exception, createError, } from '@poppinss/exception';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isScriptFile,
|
|
3
|
+
naturalSort
|
|
4
|
+
} from "../../chunk-XFX47BKO.js";
|
|
5
|
+
|
|
6
|
+
// modules/fs/fs_read_all.ts
|
|
7
|
+
import string from "@poppinss/string";
|
|
8
|
+
import { join, relative, sep } from "path";
|
|
9
|
+
import { readdir, stat } from "fs/promises";
|
|
10
|
+
import { fileURLToPath, pathToFileURL } from "url";
|
|
11
|
+
async function fsReadAll(location, options) {
|
|
12
|
+
const normalizedLocation = typeof location === "string" ? location : fileURLToPath(location);
|
|
13
|
+
const normalizedOptions = Object.assign({ absolute: false, sort: naturalSort }, options);
|
|
14
|
+
const pathType = normalizedOptions.pathType || "relative";
|
|
15
|
+
try {
|
|
16
|
+
await stat(normalizedLocation);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
if (normalizedOptions.ignoreMissingRoot) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
const dirents = await readdir(normalizedLocation, { recursive: true, withFileTypes: true });
|
|
24
|
+
const files = dirents.filter((dirent) => {
|
|
25
|
+
if (!dirent.isFile()) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (dirent.name.startsWith(".") || dirent.parentPath.split(sep).some((segment) => segment.startsWith("."))) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}).map((file) => {
|
|
33
|
+
switch (pathType) {
|
|
34
|
+
case "relative":
|
|
35
|
+
return join(relative(normalizedLocation, file.parentPath), file.name);
|
|
36
|
+
case "absolute":
|
|
37
|
+
return join(file.parentPath, file.name);
|
|
38
|
+
case "unixRelative":
|
|
39
|
+
return string.toUnixSlash(join(relative(normalizedLocation, file.parentPath), file.name));
|
|
40
|
+
case "unixAbsolute":
|
|
41
|
+
return string.toUnixSlash(join(file.parentPath, file.name));
|
|
42
|
+
case "url":
|
|
43
|
+
return pathToFileURL(join(file.parentPath, file.name)).href;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
if (normalizedOptions.filter) {
|
|
47
|
+
return files.filter(normalizedOptions.filter).sort(normalizedOptions.sort);
|
|
48
|
+
}
|
|
49
|
+
return files.sort(normalizedOptions.sort);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// modules/fs/fs_import_all.ts
|
|
53
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
54
|
+
import lodash from "@poppinss/utils/lodash";
|
|
55
|
+
import { extname, relative as relative2, sep as sep2 } from "path";
|
|
56
|
+
async function importFile(basePath, fileURL, values, options) {
|
|
57
|
+
const filePath = fileURLToPath2(fileURL);
|
|
58
|
+
const fileExtension = extname(filePath);
|
|
59
|
+
const collectionKey = relative2(basePath, filePath).replace(new RegExp(`${fileExtension}$`), "").split(sep2);
|
|
60
|
+
const exportedValue = fileExtension === ".json" ? await import(fileURL, { with: { type: "json" } }) : await import(fileURL);
|
|
61
|
+
lodash.set(
|
|
62
|
+
values,
|
|
63
|
+
options.transformKeys ? options.transformKeys(collectionKey) : collectionKey,
|
|
64
|
+
exportedValue.default ? exportedValue.default : { ...exportedValue }
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
async function fsImportAll(location, options) {
|
|
68
|
+
options = options || {};
|
|
69
|
+
const collection = {};
|
|
70
|
+
const normalizedLocation = typeof location === "string" ? location : fileURLToPath2(location);
|
|
71
|
+
const files = await fsReadAll(normalizedLocation, {
|
|
72
|
+
filter: isScriptFile,
|
|
73
|
+
...options,
|
|
74
|
+
pathType: "url"
|
|
75
|
+
});
|
|
76
|
+
await Promise.all(files.map((file) => importFile(normalizedLocation, file, collection, options)));
|
|
77
|
+
return collection;
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
fsImportAll,
|
|
81
|
+
fsReadAll
|
|
82
|
+
};
|
package/build/src/compose.d.ts
CHANGED
package/lodash/lodash.types.d.ts
CHANGED
|
@@ -35,7 +35,25 @@ declare module '@poppinss/utils/lodash' {
|
|
|
35
35
|
merge: (object: any, ...otherArgs: any[]) => any
|
|
36
36
|
size: (collection: object | string | null | undefined) => number
|
|
37
37
|
clone: <T>(value: T) => T
|
|
38
|
+
cloneWith: <T>(
|
|
39
|
+
value: T,
|
|
40
|
+
customizer: (
|
|
41
|
+
value: any,
|
|
42
|
+
key: number | string | undefined,
|
|
43
|
+
object: TObject | undefined,
|
|
44
|
+
stack: any
|
|
45
|
+
) => T | undefined
|
|
46
|
+
) => T
|
|
38
47
|
cloneDeep: <T>(value: T) => T
|
|
48
|
+
cloneDeepWith: <T>(
|
|
49
|
+
value: T,
|
|
50
|
+
customizer: (
|
|
51
|
+
value: any,
|
|
52
|
+
key: number | string | undefined,
|
|
53
|
+
object: TObject | undefined,
|
|
54
|
+
stack: any
|
|
55
|
+
) => T | undefined
|
|
56
|
+
) => T
|
|
39
57
|
toPath: (value: any) => string[]
|
|
40
58
|
}
|
|
41
59
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poppinss/utils",
|
|
3
|
-
"version": "7.0.0-next.
|
|
3
|
+
"version": "7.0.0-next.2",
|
|
4
4
|
"description": "Handy utilities for repetitive work",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"build",
|
|
9
9
|
"!build/tests",
|
|
10
|
-
"!build/test_helpers",
|
|
11
10
|
"!build/bin",
|
|
12
11
|
"lodash"
|
|
13
12
|
],
|
|
@@ -33,7 +32,7 @@
|
|
|
33
32
|
"scripts": {
|
|
34
33
|
"pretest": "npm run lint",
|
|
35
34
|
"test": "npm run build:lodash && npm run quick:test",
|
|
36
|
-
"build:lodash": "lodash include=\"pick,omit,has,get,set,unset,mergeWith,merge,size,clone,cloneDeep,toPath\" --production && move-file ./lodash.custom.min.js build/lodash/main.cjs",
|
|
35
|
+
"build:lodash": "lodash include=\"pick,omit,has,get,set,unset,mergeWith,merge,size,clone,cloneWith,cloneDeep,cloneDeepWith,toPath\" --production && move-file ./lodash.custom.min.js build/lodash/main.cjs",
|
|
37
36
|
"lint": "eslint",
|
|
38
37
|
"format": "prettier --write .",
|
|
39
38
|
"typecheck": "tsc --noEmit",
|
|
@@ -46,25 +45,25 @@
|
|
|
46
45
|
"quick:test": "node --import=@poppinss/ts-exec bin/test.ts"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
|
-
"@adonisjs/eslint-config": "^
|
|
48
|
+
"@adonisjs/eslint-config": "^3.0.0-next.0",
|
|
50
49
|
"@adonisjs/logger": "^6.0.6",
|
|
51
|
-
"@adonisjs/prettier-config": "^1.4.
|
|
52
|
-
"@adonisjs/tsconfig": "^
|
|
50
|
+
"@adonisjs/prettier-config": "^1.4.5",
|
|
51
|
+
"@adonisjs/tsconfig": "^2.0.0-next.0",
|
|
53
52
|
"@japa/assert": "^4.0.1",
|
|
54
53
|
"@japa/expect-type": "^2.0.3",
|
|
55
54
|
"@japa/runner": "^4.2.0",
|
|
56
|
-
"@poppinss/ts-exec": "^1.
|
|
55
|
+
"@poppinss/ts-exec": "^1.4.0",
|
|
57
56
|
"@release-it/conventional-changelog": "^10.0.1",
|
|
58
57
|
"@types/fs-extra": "^11.0.4",
|
|
59
|
-
"@types/node": "^
|
|
58
|
+
"@types/node": "^24.0.3",
|
|
60
59
|
"c8": "^10.1.3",
|
|
61
|
-
"eslint": "^9.
|
|
60
|
+
"eslint": "^9.29.0",
|
|
62
61
|
"fs-extra": "^11.3.0",
|
|
63
62
|
"lodash": "^4.17.21",
|
|
64
63
|
"lodash-cli": "^4.17.5",
|
|
65
64
|
"move-file-cli": "^3.0.0",
|
|
66
65
|
"prettier": "^3.5.3",
|
|
67
|
-
"release-it": "^19.0.
|
|
66
|
+
"release-it": "^19.0.3",
|
|
68
67
|
"tsup": "^8.5.0",
|
|
69
68
|
"typescript": "^5.8.3"
|
|
70
69
|
},
|
|
@@ -98,14 +97,14 @@
|
|
|
98
97
|
"tsup": {
|
|
99
98
|
"entry": [
|
|
100
99
|
"./index.ts",
|
|
101
|
-
"./
|
|
102
|
-
"./
|
|
103
|
-
"./
|
|
104
|
-
"./
|
|
105
|
-
"./
|
|
106
|
-
"./
|
|
107
|
-
"./
|
|
108
|
-
"./
|
|
100
|
+
"./modules/fs/main.ts",
|
|
101
|
+
"./modules/json/main.ts",
|
|
102
|
+
"./modules/string/main.ts",
|
|
103
|
+
"./modules/string/string_builder.ts",
|
|
104
|
+
"./modules/assert.ts",
|
|
105
|
+
"./modules/base64.ts",
|
|
106
|
+
"./modules/exception.ts",
|
|
107
|
+
"./modules/types.ts"
|
|
109
108
|
],
|
|
110
109
|
"outDir": "./build",
|
|
111
110
|
"clean": true,
|