@design-edito/tools 0.2.0 → 0.2.1
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/agnostic/arrays/index.js +11 -11
- package/agnostic/arrays/random-pick/index.js +6 -6
- package/agnostic/colors/index.js +11 -11
- package/agnostic/colors/lighten-color/index.js +2 -2
- package/agnostic/colors/saturate-color/index.js +2 -2
- package/agnostic/css/index.js +10 -10
- package/agnostic/css/styles-set/index.js +6 -6
- package/agnostic/errors/index.js +2 -2
- package/agnostic/html/hyper-json/cast/index.js +5 -5
- package/agnostic/html/hyper-json/index.js +6 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/add/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/addclass/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/and/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/append/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/at/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/clone/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/getattribute/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperties/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/if/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/join/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/length/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/negate/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/notrailing/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/or/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/pickrandom/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/print/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/push/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeclass/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/select/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/split/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/toarray/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/toboolean/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/toelement/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/toggleclass/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonodelist/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonull/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonumber/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/torecord/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/toref/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/tostring/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/totext/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/trim/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/boolean/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/element/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/get/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/global/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/number/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/record/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/ref/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/string/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/text/index.js +5 -5
- package/agnostic/html/hyper-json/tree/index.js +5 -5
- package/agnostic/html/hyper-json/utils/index.js +5 -5
- package/agnostic/html/index.js +17 -17
- package/agnostic/html/sanitize/index.js +6 -6
- package/agnostic/html/selector-to-element/index.js +6 -6
- package/agnostic/html/string-to-nodes/index.js +7 -7
- package/agnostic/misc/assert/index.js +3 -3
- package/agnostic/misc/crossenv/index.js +2 -2
- package/agnostic/misc/index.js +21 -21
- package/agnostic/misc/lorem-ipsum/index.js +13 -13
- package/agnostic/numbers/index.js +3 -3
- package/agnostic/objects/index.js +3 -3
- package/agnostic/strings/index.js +12 -12
- package/agnostic/time/index.js +5 -5
- package/chunks/chunk-2FC5KUMS.js +18 -0
- package/chunks/chunk-2HU2AWWJ.js +35 -0
- package/chunks/chunk-3SRJYILO.js +31 -0
- package/chunks/chunk-3YW3KBO5.js +18 -0
- package/chunks/chunk-4UV3XIGE.js +18 -0
- package/chunks/chunk-5JX7EWIW.js +21 -0
- package/chunks/chunk-6T7A6ZNA.js +40 -0
- package/chunks/chunk-6Z6GDMOR.js +28 -0
- package/chunks/chunk-7NOLNBF6.js +19 -0
- package/chunks/chunk-BTAPMJXX.js +37 -0
- package/chunks/chunk-CJL2V4VT.js +37 -0
- package/chunks/chunk-DEQWCMAL.js +40 -0
- package/chunks/chunk-E5VEMHHS.js +56 -0
- package/chunks/chunk-FORJXSIW.js +43 -0
- package/chunks/chunk-FOXX52QA.js +2456 -0
- package/chunks/chunk-GVGPJLS7.js +191 -0
- package/chunks/chunk-INGSSBWK.js +40 -0
- package/chunks/chunk-IWDIKDYR.js +60 -0
- package/chunks/chunk-IWZAUQGO.js +40 -0
- package/chunks/chunk-J4C3U3MK.js +24 -0
- package/chunks/chunk-J7JWEDGE.js +31 -0
- package/chunks/chunk-JSW6R3ZH.js +40 -0
- package/chunks/chunk-KBFSUJ57.js +40 -0
- package/chunks/chunk-KZKHIPWQ.js +24 -0
- package/chunks/chunk-MAOVZE34.js +20 -0
- package/chunks/chunk-MMGAJ7EW.js +26 -0
- package/chunks/chunk-MRIVEZFA.js +20 -0
- package/chunks/chunk-MROXW73J.js +168 -0
- package/chunks/chunk-MTT7TVR3.js +127 -0
- package/chunks/chunk-MW3KNVTG.js +29 -0
- package/chunks/chunk-NUGVP2MM.js +191 -0
- package/chunks/chunk-NYVARFI7.js +20 -0
- package/chunks/chunk-ODDE3NBH.js +24 -0
- package/chunks/chunk-PJFSPYPO.js +16 -0
- package/chunks/chunk-QPG45V6W.js +56 -0
- package/chunks/chunk-R765J7H2.js +114 -0
- package/chunks/chunk-S6S6O3VI.js +168 -0
- package/chunks/chunk-T3D55RRI.js +22 -0
- package/chunks/chunk-UFKH5WD2.js +21 -0
- package/chunks/chunk-UODICVLG.js +173 -0
- package/chunks/chunk-UPSIFUMS.js +18 -0
- package/chunks/chunk-VCAG4DZP.js +2456 -0
- package/chunks/chunk-VTDLFWOD.js +21 -0
- package/chunks/chunk-WC2LQPQP.js +26 -0
- package/chunks/chunk-WNDMYNDU.js +8 -0
- package/chunks/chunk-X7KWB2VQ.js +21 -0
- package/chunks/chunk-XYVNT74Y.js +60 -0
- package/chunks/chunk-YA2YCZUF.js +8 -0
- package/chunks/chunk-YTGB73UX.js +16 -0
- package/node/@aws-s3/index.js +6 -6
- package/node/@aws-s3/storage/file/index.js +4 -4
- package/node/@aws-s3/storage/index.js +6 -6
- package/node/@google-cloud/index.js +9 -9
- package/node/@google-cloud/storage/file/index.js +10 -10
- package/node/@google-cloud/storage/index.js +11 -11
- package/node/cloud-storage/index.js +24 -24
- package/node/cloud-storage/operations/index.js +31 -31
- package/node/encryption/index.js +3 -3
- package/node/files/index.js +3 -3
- package/node/ftps/file/index.js +4 -4
- package/node/ftps/index.js +5 -5
- package/node/images/format/index.d.ts +0 -7
- package/node/images/format/index.js +1 -3
- package/node/images/get-metadata/index.d.ts +4 -0
- package/node/images/get-metadata/index.js +7 -0
- package/node/images/index.d.ts +3 -3
- package/node/images/index.js +22 -48
- package/node/images/transform/index.d.ts +74 -23
- package/node/images/transform/index.js +20 -48
- package/node/images/transform/operations/blur/index.d.ts +6 -0
- package/node/images/transform/operations/blur/index.js +10 -0
- package/node/images/transform/operations/brighten/index.d.ts +6 -0
- package/node/images/transform/operations/brighten/index.js +10 -0
- package/node/images/transform/operations/extend/index.d.ts +11 -0
- package/node/images/transform/operations/extend/index.js +11 -0
- package/node/images/transform/operations/extract/index.d.ts +9 -0
- package/node/images/transform/operations/extract/index.js +10 -0
- package/node/images/transform/operations/flatten/index.d.ts +6 -0
- package/node/images/transform/operations/flatten/index.js +11 -0
- package/node/images/transform/operations/flip/index.d.ts +2 -0
- package/node/images/transform/operations/flip/index.js +7 -0
- package/node/images/transform/operations/flop/index.d.ts +2 -0
- package/node/images/transform/operations/flop/index.js +7 -0
- package/node/images/transform/operations/hue/index.d.ts +6 -0
- package/node/images/transform/operations/hue/index.js +10 -0
- package/node/images/transform/operations/level/index.d.ts +7 -0
- package/node/images/transform/operations/level/index.js +10 -0
- package/node/images/transform/operations/lighten/index.d.ts +6 -0
- package/node/images/transform/operations/lighten/index.js +10 -0
- package/node/images/transform/operations/normalize/index.d.ts +7 -0
- package/node/images/transform/operations/normalize/index.js +10 -0
- package/node/images/transform/operations/resize/index.d.ts +14 -0
- package/node/images/transform/operations/resize/index.js +11 -0
- package/node/images/transform/operations/rotate/index.d.ts +7 -0
- package/node/images/transform/operations/rotate/index.js +11 -0
- package/node/images/transform/operations/saturate/index.d.ts +6 -0
- package/node/images/transform/operations/saturate/index.js +10 -0
- package/node/images/transform/utils/index.d.ts +2 -0
- package/node/images/transform/utils/index.js +8 -0
- package/node/sftp/file/index.js +4 -4
- package/node/sftp/index.js +5 -5
- package/package.json +1 -1
@@ -0,0 +1,168 @@
|
|
1
|
+
import {
|
2
|
+
isSaturateOperationParams,
|
3
|
+
saturate
|
4
|
+
} from "./chunk-UPSIFUMS.js";
|
5
|
+
import {
|
6
|
+
extend,
|
7
|
+
isExtendOperationParams
|
8
|
+
} from "./chunk-MMGAJ7EW.js";
|
9
|
+
import {
|
10
|
+
flop
|
11
|
+
} from "./chunk-YA2YCZUF.js";
|
12
|
+
import {
|
13
|
+
isLevelOperationParams,
|
14
|
+
level
|
15
|
+
} from "./chunk-T3D55RRI.js";
|
16
|
+
import {
|
17
|
+
hue,
|
18
|
+
isHueOperationParams
|
19
|
+
} from "./chunk-3YW3KBO5.js";
|
20
|
+
import {
|
21
|
+
isLightenOperationParams,
|
22
|
+
lighten
|
23
|
+
} from "./chunk-2FC5KUMS.js";
|
24
|
+
import {
|
25
|
+
isNormalizeOperationParams,
|
26
|
+
normalize
|
27
|
+
} from "./chunk-7NOLNBF6.js";
|
28
|
+
import {
|
29
|
+
isResizeOperationParams,
|
30
|
+
resize
|
31
|
+
} from "./chunk-FORJXSIW.js";
|
32
|
+
import {
|
33
|
+
isRotateOperationParams,
|
34
|
+
rotate
|
35
|
+
} from "./chunk-KZKHIPWQ.js";
|
36
|
+
import {
|
37
|
+
blur,
|
38
|
+
isBlurOperationParams
|
39
|
+
} from "./chunk-PJFSPYPO.js";
|
40
|
+
import {
|
41
|
+
flatten,
|
42
|
+
isFlattenOperationParams
|
43
|
+
} from "./chunk-VTDLFWOD.js";
|
44
|
+
import {
|
45
|
+
brighten,
|
46
|
+
isBrightenOperationParams
|
47
|
+
} from "./chunk-YTGB73UX.js";
|
48
|
+
import {
|
49
|
+
flip
|
50
|
+
} from "./chunk-WNDMYNDU.js";
|
51
|
+
import {
|
52
|
+
extract,
|
53
|
+
isExtractOperationParams
|
54
|
+
} from "./chunk-5JX7EWIW.js";
|
55
|
+
import {
|
56
|
+
__export
|
57
|
+
} from "./chunk-WSFCRVEQ.js";
|
58
|
+
|
59
|
+
// src/node/images/transform/index.ts
|
60
|
+
var transform_exports = {};
|
61
|
+
__export(transform_exports, {
|
62
|
+
OpName: () => OpName,
|
63
|
+
isOperationDescriptor: () => isOperationDescriptor,
|
64
|
+
transform: () => transform
|
65
|
+
});
|
66
|
+
import sharp from "sharp";
|
67
|
+
var OpName = /* @__PURE__ */ ((OpName2) => {
|
68
|
+
OpName2["BLUR"] = "blur";
|
69
|
+
OpName2["BRIGHTEN"] = "brighten";
|
70
|
+
OpName2["EXTEND"] = "extend";
|
71
|
+
OpName2["EXTRACT"] = "extract";
|
72
|
+
OpName2["FLATTEN"] = "flatten";
|
73
|
+
OpName2["FLIP"] = "flip";
|
74
|
+
OpName2["FLOP"] = "flop";
|
75
|
+
OpName2["HUE"] = "hue";
|
76
|
+
OpName2["LEVEL"] = "level";
|
77
|
+
OpName2["LIGHTEN"] = "lighten";
|
78
|
+
OpName2["NORMALIZE"] = "normalize";
|
79
|
+
OpName2["RESIZE"] = "resize";
|
80
|
+
OpName2["ROTATE"] = "rotate";
|
81
|
+
OpName2["SATURATE"] = "saturate";
|
82
|
+
return OpName2;
|
83
|
+
})(OpName || {});
|
84
|
+
function isOperationDescriptor(obj) {
|
85
|
+
if (typeof obj !== "object" || obj === null) return false;
|
86
|
+
if (!("name" in obj)) return false;
|
87
|
+
if (obj.name === "blur" /* BLUR */) return isBlurOperationParams(obj);
|
88
|
+
if (obj.name === "brighten" /* BRIGHTEN */) return isBrightenOperationParams(obj);
|
89
|
+
if (obj.name === "extend" /* EXTEND */) return isExtendOperationParams(obj);
|
90
|
+
if (obj.name === "extract" /* EXTRACT */) return isExtractOperationParams(obj);
|
91
|
+
if (obj.name === "flatten" /* FLATTEN */) return isFlattenOperationParams(obj);
|
92
|
+
if (obj.name === "flip" /* FLIP */) return true;
|
93
|
+
if (obj.name === "flop" /* FLOP */) return true;
|
94
|
+
if (obj.name === "hue" /* HUE */) return isHueOperationParams(obj);
|
95
|
+
if (obj.name === "level" /* LEVEL */) return isLevelOperationParams(obj);
|
96
|
+
if (obj.name === "lighten" /* LIGHTEN */) return isLightenOperationParams(obj);
|
97
|
+
if (obj.name === "normalize" /* NORMALIZE */) return isNormalizeOperationParams(obj);
|
98
|
+
if (obj.name === "resize" /* RESIZE */) return isResizeOperationParams(obj);
|
99
|
+
if (obj.name === "rotate" /* ROTATE */) return isRotateOperationParams(obj);
|
100
|
+
if (obj.name === "saturate" /* SATURATE */) return isSaturateOperationParams(obj);
|
101
|
+
return false;
|
102
|
+
}
|
103
|
+
async function transform(input, operationsSequence) {
|
104
|
+
if (Buffer.isBuffer(input)) return transformBuffer(input, operationsSequence);
|
105
|
+
return transformSharpInstance(input, operationsSequence);
|
106
|
+
}
|
107
|
+
async function transformSharpInstance(sharpInstance, operationsSequence) {
|
108
|
+
for (const operation of operationsSequence) {
|
109
|
+
switch (operation.name) {
|
110
|
+
case "blur" /* BLUR */:
|
111
|
+
sharpInstance = await blur(sharpInstance, operation);
|
112
|
+
break;
|
113
|
+
case "brighten" /* BRIGHTEN */:
|
114
|
+
sharpInstance = await brighten(sharpInstance, operation);
|
115
|
+
break;
|
116
|
+
case "extend" /* EXTEND */:
|
117
|
+
sharpInstance = await extend(sharpInstance, operation);
|
118
|
+
break;
|
119
|
+
case "extract" /* EXTRACT */:
|
120
|
+
sharpInstance = await extract(sharpInstance, operation);
|
121
|
+
break;
|
122
|
+
case "flatten" /* FLATTEN */:
|
123
|
+
sharpInstance = await flatten(sharpInstance, operation);
|
124
|
+
break;
|
125
|
+
case "flip" /* FLIP */:
|
126
|
+
sharpInstance = await flip(sharpInstance);
|
127
|
+
break;
|
128
|
+
case "flop" /* FLOP */:
|
129
|
+
sharpInstance = await flop(sharpInstance);
|
130
|
+
break;
|
131
|
+
case "hue" /* HUE */:
|
132
|
+
sharpInstance = await hue(sharpInstance, operation);
|
133
|
+
break;
|
134
|
+
case "level" /* LEVEL */:
|
135
|
+
sharpInstance = await level(sharpInstance, operation);
|
136
|
+
break;
|
137
|
+
case "lighten" /* LIGHTEN */:
|
138
|
+
sharpInstance = await lighten(sharpInstance, operation);
|
139
|
+
break;
|
140
|
+
case "normalize" /* NORMALIZE */:
|
141
|
+
sharpInstance = await normalize(sharpInstance, operation);
|
142
|
+
break;
|
143
|
+
case "resize" /* RESIZE */:
|
144
|
+
sharpInstance = await resize(sharpInstance, operation);
|
145
|
+
break;
|
146
|
+
case "rotate" /* ROTATE */:
|
147
|
+
sharpInstance = await rotate(sharpInstance, operation);
|
148
|
+
break;
|
149
|
+
case "saturate" /* SATURATE */:
|
150
|
+
sharpInstance = await saturate(sharpInstance, operation);
|
151
|
+
break;
|
152
|
+
default:
|
153
|
+
sharpInstance = sharpInstance;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
return sharpInstance;
|
157
|
+
}
|
158
|
+
async function transformBuffer(fileBuffer, operationsSequence) {
|
159
|
+
const sharpInstance = sharp(fileBuffer);
|
160
|
+
return transformSharpInstance(sharpInstance, operationsSequence);
|
161
|
+
}
|
162
|
+
|
163
|
+
export {
|
164
|
+
OpName,
|
165
|
+
isOperationDescriptor,
|
166
|
+
transform,
|
167
|
+
transform_exports
|
168
|
+
};
|
@@ -0,0 +1,127 @@
|
|
1
|
+
import {
|
2
|
+
register
|
3
|
+
} from "./chunk-WC2LQPQP.js";
|
4
|
+
|
5
|
+
// src/agnostic/html/sanitize/index.ts
|
6
|
+
var Sanitize;
|
7
|
+
((Sanitize2) => {
|
8
|
+
Sanitize2.defaultOptions = { depth: 20 };
|
9
|
+
function sanitize(inputStr, options = Sanitize2.defaultOptions) {
|
10
|
+
const actualDocument = options.documentObj ?? window.document;
|
11
|
+
if (actualDocument === null) throw register.getError("no-window-document-on-runtime-please-provide" /* NO_DOCUMENT_PLEASE_PROVIDE */, "See documentObj in the options object");
|
12
|
+
const wrapperDiv = actualDocument.createElement("div");
|
13
|
+
const { inputFreeTransform } = options;
|
14
|
+
wrapperDiv.innerHTML = inputFreeTransform !== void 0 ? inputFreeTransform(inputStr) : inputStr;
|
15
|
+
const sanitizedWrapper = sanitizeElement(wrapperDiv, options);
|
16
|
+
const returned = sanitizedWrapper?.innerHTML;
|
17
|
+
return returned ?? "";
|
18
|
+
}
|
19
|
+
Sanitize2.sanitize = sanitize;
|
20
|
+
function sanitizeElement(element, options = Sanitize2.defaultOptions) {
|
21
|
+
const actualDocument = options.documentObj ?? window.document;
|
22
|
+
if (actualDocument === null) throw register.getError("no-window-document-on-runtime-please-provide" /* NO_DOCUMENT_PLEASE_PROVIDE */, "See documentObj in the options object");
|
23
|
+
const { tagName, attributes, childNodes } = element;
|
24
|
+
const {
|
25
|
+
allowedTags = [],
|
26
|
+
allowedAttributes = {},
|
27
|
+
forbiddenTags = [],
|
28
|
+
forbiddenAttributes = {},
|
29
|
+
depth = 20,
|
30
|
+
verbose = false
|
31
|
+
} = options;
|
32
|
+
if (depth <= 0) {
|
33
|
+
console.warn("Max depth reached");
|
34
|
+
return null;
|
35
|
+
}
|
36
|
+
const normalizedTagName = tagName.toLowerCase().trim();
|
37
|
+
const tagIsInForbidden = forbiddenTags.includes("*") || forbiddenTags.includes(normalizedTagName);
|
38
|
+
if (tagIsInForbidden) {
|
39
|
+
if (verbose === true) console.warn(tagName, "tag is forbidden");
|
40
|
+
return null;
|
41
|
+
}
|
42
|
+
const tagIsInAllowed = allowedTags.includes("*") || allowedTags.includes(normalizedTagName);
|
43
|
+
if (!tagIsInAllowed) {
|
44
|
+
if (verbose === true) console.warn(tagName, "tag is not allowed");
|
45
|
+
return null;
|
46
|
+
}
|
47
|
+
const returnedElement = actualDocument.createElement(tagName);
|
48
|
+
const returnedAttributes = Array.from(attributes).filter(({ name: attributeName, value: attributeValue }) => {
|
49
|
+
const allTagsForbiddenAttributes = forbiddenAttributes["*"] ?? [];
|
50
|
+
const thisTagForbiddenAttributes = forbiddenAttributes[normalizedTagName] ?? [];
|
51
|
+
const mergedForbiddenAttributes = [...allTagsForbiddenAttributes, ...thisTagForbiddenAttributes];
|
52
|
+
const isInForbidden = mergedForbiddenAttributes.some(({
|
53
|
+
attributeName: nameTester,
|
54
|
+
attributeValues: valTesters
|
55
|
+
}) => {
|
56
|
+
if (typeof nameTester === "string" && nameTester !== "*" && attributeName !== nameTester) return false;
|
57
|
+
if (typeof nameTester !== "string" && !nameTester.test(attributeName)) return false;
|
58
|
+
if (valTesters === void 0) {
|
59
|
+
if (verbose === true) console.warn(attributeName, "attribute on", tagName, "tag is forbidden");
|
60
|
+
return true;
|
61
|
+
}
|
62
|
+
if (valTesters.includes("*")) {
|
63
|
+
if (verbose === true) console.warn(attributeName, "attribute on", tagName, "tag is forbidden");
|
64
|
+
return true;
|
65
|
+
}
|
66
|
+
return valTesters.some((valTester) => {
|
67
|
+
if (typeof valTester === "string" && attributeValue === valTester) {
|
68
|
+
if (verbose === true) console.warn(attributeValue, "value for", attributeName, "attribute on", tagName, "tag is forbidden. Rule:", valTester);
|
69
|
+
return true;
|
70
|
+
}
|
71
|
+
if (typeof valTester !== "string" && valTester.test(attributeValue)) {
|
72
|
+
if (verbose === true) console.warn(attributeValue, "value for", attributeName, "attribute on", tagName, "tag is forbidden. Rule:", valTester);
|
73
|
+
return true;
|
74
|
+
}
|
75
|
+
return false;
|
76
|
+
});
|
77
|
+
});
|
78
|
+
if (isInForbidden) return false;
|
79
|
+
const allTagsAllowedAttributes = allowedAttributes["*"] ?? [];
|
80
|
+
const thisTagAllowedAttributes = allowedAttributes[normalizedTagName] ?? [];
|
81
|
+
const mergedAllowedAttributes = [...allTagsAllowedAttributes, ...thisTagAllowedAttributes];
|
82
|
+
let latestNotAllowedReason = [tagName, "has no allowed attributes"];
|
83
|
+
const isInAllowed = mergedAllowedAttributes.some(({
|
84
|
+
attributeName: nameTester,
|
85
|
+
attributeValues: valTesters
|
86
|
+
}) => {
|
87
|
+
if (typeof nameTester === "string" && nameTester !== "*" && attributeName !== nameTester) {
|
88
|
+
latestNotAllowedReason = [attributeName, "attribute on", tagName, "tag is not allowed"];
|
89
|
+
return false;
|
90
|
+
}
|
91
|
+
if (typeof nameTester !== "string" && !nameTester.test(attributeName)) {
|
92
|
+
latestNotAllowedReason = [attributeName, "attribute on", tagName, "tag is not allowed"];
|
93
|
+
return false;
|
94
|
+
}
|
95
|
+
if (valTesters === void 0) return true;
|
96
|
+
if (valTesters.includes("*")) return true;
|
97
|
+
return valTesters.some((valTester) => {
|
98
|
+
if (typeof valTester === "string" && attributeValue === valTester) return true;
|
99
|
+
if (typeof valTester !== "string" && valTester.test(attributeValue)) return true;
|
100
|
+
latestNotAllowedReason = [attributeValue, "value for", attributeName, "attribute on", tagName, "tag is not allowed"];
|
101
|
+
return false;
|
102
|
+
});
|
103
|
+
});
|
104
|
+
if (!isInAllowed) {
|
105
|
+
if (verbose === true) console.warn(...latestNotAllowedReason);
|
106
|
+
return false;
|
107
|
+
}
|
108
|
+
return true;
|
109
|
+
});
|
110
|
+
returnedAttributes.forEach(({ name, value }) => {
|
111
|
+
returnedElement.setAttribute(name, value);
|
112
|
+
});
|
113
|
+
const sanitizedChildNodes = Array.from(childNodes).map((node) => {
|
114
|
+
if (node.nodeType === Node.ELEMENT_NODE) return sanitizeElement(node, { ...options, depth: depth - 1 });
|
115
|
+
else if (node.nodeType === Node.TEXT_NODE) return node;
|
116
|
+
else if (options.keepComments === true && node.nodeType === Node.COMMENT_NODE) return node;
|
117
|
+
return null;
|
118
|
+
}).filter((elt) => elt !== null);
|
119
|
+
returnedElement.replaceChildren(...sanitizedChildNodes);
|
120
|
+
return returnedElement;
|
121
|
+
}
|
122
|
+
Sanitize2.sanitizeElement = sanitizeElement;
|
123
|
+
})(Sanitize || (Sanitize = {}));
|
124
|
+
|
125
|
+
export {
|
126
|
+
Sanitize
|
127
|
+
};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import {
|
2
|
+
register
|
3
|
+
} from "./chunk-WC2LQPQP.js";
|
4
|
+
|
5
|
+
// src/agnostic/arrays/random-pick/index.ts
|
6
|
+
function randomPick(arr, exclude = []) {
|
7
|
+
const filteredArr = [...arr].filter((elt) => !exclude.includes(elt));
|
8
|
+
const length = filteredArr.length;
|
9
|
+
if (length === 0) throw register.getError("impossible-to-pick-in-array" /* IMPOSSIBLE_TO_PICK_IN_ARRAY */, arr);
|
10
|
+
const pos = Math.floor(Math.random() * length);
|
11
|
+
const found = filteredArr[pos];
|
12
|
+
return found;
|
13
|
+
}
|
14
|
+
function randomPickMany(howMuch, arr, exclude = []) {
|
15
|
+
const grindedArr = [...arr];
|
16
|
+
const pickedSelection = [];
|
17
|
+
for (let i = 0; i < howMuch; i++) {
|
18
|
+
const picked = randomPick(grindedArr, exclude);
|
19
|
+
const indexOfPicked = grindedArr.indexOf(picked);
|
20
|
+
grindedArr.splice(indexOfPicked, 1);
|
21
|
+
pickedSelection.push(picked);
|
22
|
+
}
|
23
|
+
return pickedSelection;
|
24
|
+
}
|
25
|
+
|
26
|
+
export {
|
27
|
+
randomPick,
|
28
|
+
randomPickMany
|
29
|
+
};
|
@@ -0,0 +1,191 @@
|
|
1
|
+
import {
|
2
|
+
Arrays
|
3
|
+
} from "./chunk-3SRJYILO.js";
|
4
|
+
import {
|
5
|
+
Random
|
6
|
+
} from "./chunk-S32K7POB.js";
|
7
|
+
|
8
|
+
// src/agnostic/misc/lorem-ipsum/index.ts
|
9
|
+
var LoremIpsum;
|
10
|
+
((LoremIpsum2) => {
|
11
|
+
LoremIpsum2.words = [
|
12
|
+
"a",
|
13
|
+
"ac",
|
14
|
+
"accumsan",
|
15
|
+
"adipiscing",
|
16
|
+
"aenean",
|
17
|
+
"aliquam",
|
18
|
+
"aliquet",
|
19
|
+
"amet",
|
20
|
+
"ante",
|
21
|
+
"arcu",
|
22
|
+
"at",
|
23
|
+
"auctor",
|
24
|
+
"augue",
|
25
|
+
"bibendum",
|
26
|
+
"blandit",
|
27
|
+
"condimentum",
|
28
|
+
"consectetur",
|
29
|
+
"consequat",
|
30
|
+
"convallis",
|
31
|
+
"cras",
|
32
|
+
"curabitur",
|
33
|
+
"cursus",
|
34
|
+
"dapibus",
|
35
|
+
"diam",
|
36
|
+
"dictum",
|
37
|
+
"dictumst",
|
38
|
+
"dignissim",
|
39
|
+
"dolor",
|
40
|
+
"donec",
|
41
|
+
"dui",
|
42
|
+
"duis",
|
43
|
+
"efficitur",
|
44
|
+
"egestas",
|
45
|
+
"eget",
|
46
|
+
"eleifend",
|
47
|
+
"elementum",
|
48
|
+
"elit",
|
49
|
+
"enim",
|
50
|
+
"erat",
|
51
|
+
"eros",
|
52
|
+
"est",
|
53
|
+
"et",
|
54
|
+
"eu",
|
55
|
+
"euismod",
|
56
|
+
"ex",
|
57
|
+
"facilisis",
|
58
|
+
"faucibus",
|
59
|
+
"felis",
|
60
|
+
"feugiat",
|
61
|
+
"finibus",
|
62
|
+
"fringilla",
|
63
|
+
"fusce",
|
64
|
+
"gravida",
|
65
|
+
"habitasse",
|
66
|
+
"hac",
|
67
|
+
"hendrerit",
|
68
|
+
"iaculis",
|
69
|
+
"id",
|
70
|
+
"imperdiet",
|
71
|
+
"in",
|
72
|
+
"integer",
|
73
|
+
"interdum",
|
74
|
+
"ipsum",
|
75
|
+
"justo",
|
76
|
+
"lacinia",
|
77
|
+
"lacus",
|
78
|
+
"laoreet",
|
79
|
+
"lectus",
|
80
|
+
"leo",
|
81
|
+
"libero",
|
82
|
+
"ligula",
|
83
|
+
"lobortis",
|
84
|
+
"lorem",
|
85
|
+
"luctus",
|
86
|
+
"maecenas",
|
87
|
+
"magna",
|
88
|
+
"malesuada",
|
89
|
+
"massa",
|
90
|
+
"mattis",
|
91
|
+
"mauris",
|
92
|
+
"maximus",
|
93
|
+
"metus",
|
94
|
+
"mi",
|
95
|
+
"molestie",
|
96
|
+
"mollis",
|
97
|
+
"morbi",
|
98
|
+
"nam",
|
99
|
+
"nec",
|
100
|
+
"neque",
|
101
|
+
"nibh",
|
102
|
+
"nisi",
|
103
|
+
"nisl",
|
104
|
+
"non",
|
105
|
+
"nulla",
|
106
|
+
"nullam",
|
107
|
+
"nunc",
|
108
|
+
"odio",
|
109
|
+
"orci",
|
110
|
+
"ornare",
|
111
|
+
"pellentesque",
|
112
|
+
"pharetra",
|
113
|
+
"phasellus",
|
114
|
+
"placerat",
|
115
|
+
"platea",
|
116
|
+
"porta",
|
117
|
+
"porttitor",
|
118
|
+
"posuere",
|
119
|
+
"praesent",
|
120
|
+
"pulvinar",
|
121
|
+
"purus",
|
122
|
+
"quam",
|
123
|
+
"quis",
|
124
|
+
"quisque",
|
125
|
+
"risus",
|
126
|
+
"rutrum",
|
127
|
+
"sagittis",
|
128
|
+
"sapien",
|
129
|
+
"sed",
|
130
|
+
"sem",
|
131
|
+
"semper",
|
132
|
+
"sit",
|
133
|
+
"sodales",
|
134
|
+
"sollicitudin",
|
135
|
+
"suscipit",
|
136
|
+
"suspendisse",
|
137
|
+
"tellus",
|
138
|
+
"tempor",
|
139
|
+
"tempus",
|
140
|
+
"tincidunt",
|
141
|
+
"tortor",
|
142
|
+
"tristique",
|
143
|
+
"turpis",
|
144
|
+
"ultrices",
|
145
|
+
"ultricies",
|
146
|
+
"urna",
|
147
|
+
"ut",
|
148
|
+
"vehicula",
|
149
|
+
"vel",
|
150
|
+
"velit",
|
151
|
+
"venenatis",
|
152
|
+
"vestibulum",
|
153
|
+
"vitae",
|
154
|
+
"vivamus",
|
155
|
+
"viverra",
|
156
|
+
"volutpat",
|
157
|
+
"vulputate"
|
158
|
+
];
|
159
|
+
LoremIpsum2.generateSentence = (wordCount) => {
|
160
|
+
const resultArr = [];
|
161
|
+
let currentWordCound = wordCount;
|
162
|
+
for (let i = 0; i < currentWordCound; i++) {
|
163
|
+
const picked = Arrays.randomPick(LoremIpsum2.words);
|
164
|
+
if (typeof picked === "string") resultArr.push(picked);
|
165
|
+
else {
|
166
|
+
currentWordCound += 1;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
const [firstWord, ...otherWords] = resultArr;
|
170
|
+
if (firstWord === void 0) return "";
|
171
|
+
const capFirstLetter = firstWord?.charAt(0).toUpperCase();
|
172
|
+
const restOfFirstWord = firstWord?.slice(1);
|
173
|
+
const sentence = [
|
174
|
+
`${capFirstLetter}${restOfFirstWord}`,
|
175
|
+
...otherWords
|
176
|
+
].join(" ");
|
177
|
+
return `${sentence}.`;
|
178
|
+
};
|
179
|
+
LoremIpsum2.generateSentences = (sentencesCount, maxSentenceLength = 12, minSentenceLength = 4) => {
|
180
|
+
const sentences = [];
|
181
|
+
for (let i = 0; i < sentencesCount; i++) {
|
182
|
+
const length = Random.randomInt(maxSentenceLength, minSentenceLength) ?? 8;
|
183
|
+
sentences.push((0, LoremIpsum2.generateSentence)(length));
|
184
|
+
}
|
185
|
+
return sentences;
|
186
|
+
};
|
187
|
+
})(LoremIpsum || (LoremIpsum = {}));
|
188
|
+
|
189
|
+
export {
|
190
|
+
LoremIpsum
|
191
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import {
|
2
|
+
__export
|
3
|
+
} from "./chunk-WSFCRVEQ.js";
|
4
|
+
|
5
|
+
// src/node/images/get-metadata/index.ts
|
6
|
+
var get_metadata_exports = {};
|
7
|
+
__export(get_metadata_exports, {
|
8
|
+
getMetadata: () => getMetadata
|
9
|
+
});
|
10
|
+
import { Buffer } from "node:buffer";
|
11
|
+
import sharp from "sharp";
|
12
|
+
async function getMetadata(imageInput) {
|
13
|
+
const sharpInstance = Buffer.isBuffer(imageInput) ? sharp(imageInput) : imageInput;
|
14
|
+
return sharpInstance.metadata();
|
15
|
+
}
|
16
|
+
|
17
|
+
export {
|
18
|
+
getMetadata,
|
19
|
+
get_metadata_exports
|
20
|
+
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import {
|
2
|
+
bucket_exports
|
3
|
+
} from "./chunk-BD56ZAYF.js";
|
4
|
+
import {
|
5
|
+
file_exports
|
6
|
+
} from "./chunk-XYVNT74Y.js";
|
7
|
+
import {
|
8
|
+
directory_exports
|
9
|
+
} from "./chunk-WJ3XV35I.js";
|
10
|
+
import {
|
11
|
+
__export
|
12
|
+
} from "./chunk-WSFCRVEQ.js";
|
13
|
+
|
14
|
+
// src/node/@google-cloud/storage/index.ts
|
15
|
+
var storage_exports = {};
|
16
|
+
__export(storage_exports, {
|
17
|
+
Bucket: () => bucket_exports,
|
18
|
+
Directory: () => directory_exports,
|
19
|
+
File: () => file_exports
|
20
|
+
});
|
21
|
+
|
22
|
+
export {
|
23
|
+
storage_exports
|
24
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import {
|
2
|
+
zod_default
|
3
|
+
} from "./chunk-OT4SVHDX.js";
|
4
|
+
|
5
|
+
// src/node/images/transform/operations/blur/index.ts
|
6
|
+
function isBlurOperationParams(obj) {
|
7
|
+
return zod_default.object({ sigma: zod_default.number() }).safeParse(obj).success;
|
8
|
+
}
|
9
|
+
async function blur(sharpInstance, params) {
|
10
|
+
return sharpInstance.blur(params.sigma);
|
11
|
+
}
|
12
|
+
|
13
|
+
export {
|
14
|
+
isBlurOperationParams,
|
15
|
+
blur
|
16
|
+
};
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import {
|
2
|
+
move_file_exports
|
3
|
+
} from "./chunk-646R6BQZ.js";
|
4
|
+
import {
|
5
|
+
remove_file_exports
|
6
|
+
} from "./chunk-H4LW6FP3.js";
|
7
|
+
import {
|
8
|
+
move_dir_exports
|
9
|
+
} from "./chunk-FS6LRTDK.js";
|
10
|
+
import {
|
11
|
+
remove_dir_exports
|
12
|
+
} from "./chunk-CA3UPHYO.js";
|
13
|
+
import {
|
14
|
+
stat_file_exports
|
15
|
+
} from "./chunk-UK4HNSEJ.js";
|
16
|
+
import {
|
17
|
+
upload_file_exports
|
18
|
+
} from "./chunk-NOLQR5RW.js";
|
19
|
+
import {
|
20
|
+
copy_dir_exports
|
21
|
+
} from "./chunk-6NLNUGBI.js";
|
22
|
+
import {
|
23
|
+
copy_file_exports
|
24
|
+
} from "./chunk-OA7Y2A5T.js";
|
25
|
+
import {
|
26
|
+
download_file_exports
|
27
|
+
} from "./chunk-EOTOFHUR.js";
|
28
|
+
import {
|
29
|
+
exists_file_exports
|
30
|
+
} from "./chunk-24ZUWYIR.js";
|
31
|
+
import {
|
32
|
+
list_dir_exports
|
33
|
+
} from "./chunk-DPQRXSZH.js";
|
34
|
+
import {
|
35
|
+
__export
|
36
|
+
} from "./chunk-WSFCRVEQ.js";
|
37
|
+
|
38
|
+
// src/node/cloud-storage/operations/index.ts
|
39
|
+
var operations_exports = {};
|
40
|
+
__export(operations_exports, {
|
41
|
+
CopyDir: () => copy_dir_exports,
|
42
|
+
CopyFile: () => copy_file_exports,
|
43
|
+
DownloadFile: () => download_file_exports,
|
44
|
+
ExistsFile: () => exists_file_exports,
|
45
|
+
ListDir: () => list_dir_exports,
|
46
|
+
MoveDir: () => move_dir_exports,
|
47
|
+
MoveFile: () => move_file_exports,
|
48
|
+
RemoveDir: () => remove_dir_exports,
|
49
|
+
RemoveFile: () => remove_file_exports,
|
50
|
+
StatFile: () => stat_file_exports,
|
51
|
+
UploadFile: () => upload_file_exports
|
52
|
+
});
|
53
|
+
|
54
|
+
export {
|
55
|
+
operations_exports
|
56
|
+
};
|