@dooboostore/simple-boot-http-server 1.0.21 → 1.0.22
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/cjs/filters/ResourceFilter.js +59 -19
- package/dist/cjs/filters/ResourceFilter.js.map +2 -2
- package/dist/cjs/models/RequestResponse.js +23 -1
- package/dist/cjs/models/RequestResponse.js.map +2 -2
- package/dist/esm/filters/ResourceFilter.js +56 -18
- package/dist/esm/filters/ResourceFilter.js.map +2 -2
- package/dist/esm/models/RequestResponse.js +23 -1
- package/dist/esm/models/RequestResponse.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js +176 -158
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js.map +4 -4
- package/dist/types/filters/ResourceFilter.d.ts +16 -6
- package/dist/types/filters/ResourceFilter.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -38
- package/dist/types/models/RequestResponse.d.ts +2 -1
- package/dist/types/models/RequestResponse.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js +183 -165
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js.map +4 -4
- package/package.json +14 -14
- package/src/filters/ResourceFilter.ts +67 -20
- package/src/models/RequestResponse.ts +26 -2
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
mod
|
|
31
31
|
));
|
|
32
32
|
|
|
33
|
-
//
|
|
33
|
+
// ../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.json
|
|
34
34
|
var require_db = __commonJS({
|
|
35
|
-
"
|
|
35
|
+
"../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.json"(exports, module) {
|
|
36
36
|
module.exports = {
|
|
37
37
|
"application/1d-interleaved-parityfec": {
|
|
38
38
|
source: "iana"
|
|
@@ -8555,16 +8555,16 @@ var require_db = __commonJS({
|
|
|
8555
8555
|
}
|
|
8556
8556
|
});
|
|
8557
8557
|
|
|
8558
|
-
//
|
|
8558
|
+
// ../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.js
|
|
8559
8559
|
var require_mime_db = __commonJS({
|
|
8560
|
-
"
|
|
8560
|
+
"../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.js"(exports, module) {
|
|
8561
8561
|
module.exports = require_db();
|
|
8562
8562
|
}
|
|
8563
8563
|
});
|
|
8564
8564
|
|
|
8565
|
-
//
|
|
8565
|
+
// ../../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js
|
|
8566
8566
|
var require_mime_types = __commonJS({
|
|
8567
|
-
"
|
|
8567
|
+
"../../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js"(exports) {
|
|
8568
8568
|
"use strict";
|
|
8569
8569
|
var db = require_mime_db();
|
|
8570
8570
|
var extname = __require("path").extname;
|
|
@@ -8652,9 +8652,9 @@ var require_mime_types = __commonJS({
|
|
|
8652
8652
|
}
|
|
8653
8653
|
});
|
|
8654
8654
|
|
|
8655
|
-
//
|
|
8655
|
+
// ../../../node_modules/.pnpm/node-gzip@1.1.2/node_modules/node-gzip/dist/index.js
|
|
8656
8656
|
var require_dist = __commonJS({
|
|
8657
|
-
"
|
|
8657
|
+
"../../../node_modules/.pnpm/node-gzip@1.1.2/node_modules/node-gzip/dist/index.js"(exports, module) {
|
|
8658
8658
|
"use strict";
|
|
8659
8659
|
var zlib = __require("zlib");
|
|
8660
8660
|
module.exports = {
|
|
@@ -8680,9 +8680,9 @@ var require_dist = __commonJS({
|
|
|
8680
8680
|
}
|
|
8681
8681
|
});
|
|
8682
8682
|
|
|
8683
|
-
//
|
|
8683
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/helpers.js
|
|
8684
8684
|
var require_helpers = __commonJS({
|
|
8685
|
-
"
|
|
8685
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/helpers.js"(exports) {
|
|
8686
8686
|
var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
|
|
8687
8687
|
var extendStatics = function(d, b) {
|
|
8688
8688
|
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
@@ -8848,9 +8848,9 @@ var require_helpers = __commonJS({
|
|
|
8848
8848
|
}
|
|
8849
8849
|
});
|
|
8850
8850
|
|
|
8851
|
-
//
|
|
8851
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/core.js
|
|
8852
8852
|
var require_core = __commonJS({
|
|
8853
|
-
"
|
|
8853
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/core.js"(exports) {
|
|
8854
8854
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8855
8855
|
var helpers_js_1 = require_helpers();
|
|
8856
8856
|
exports.JsonPatchError = helpers_js_1.PatchError;
|
|
@@ -9181,9 +9181,9 @@ var require_core = __commonJS({
|
|
|
9181
9181
|
}
|
|
9182
9182
|
});
|
|
9183
9183
|
|
|
9184
|
-
//
|
|
9184
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/duplex.js
|
|
9185
9185
|
var require_duplex = __commonJS({
|
|
9186
|
-
"
|
|
9186
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/duplex.js"(exports) {
|
|
9187
9187
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9188
9188
|
var helpers_js_1 = require_helpers();
|
|
9189
9189
|
var core_js_1 = require_core();
|
|
@@ -9355,9 +9355,9 @@ var require_duplex = __commonJS({
|
|
|
9355
9355
|
}
|
|
9356
9356
|
});
|
|
9357
9357
|
|
|
9358
|
-
//
|
|
9358
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.js
|
|
9359
9359
|
var require_fast_json_patch = __commonJS({
|
|
9360
|
-
"
|
|
9360
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.js"(exports) {
|
|
9361
9361
|
var core = require_core();
|
|
9362
9362
|
Object.assign(exports, core);
|
|
9363
9363
|
var duplex = require_duplex();
|
|
@@ -10185,6 +10185,18 @@ var FileUtils;
|
|
|
10185
10185
|
const buffer = config?.option ? node_fs.readFileSync(p, config.option) : node_fs.readFileSync(p);
|
|
10186
10186
|
return buffer;
|
|
10187
10187
|
};
|
|
10188
|
+
FileUtils2.readAsync = async (path22, config) => {
|
|
10189
|
+
const p = FileUtils2.path(path22);
|
|
10190
|
+
return node_fs.promises.readFile(p, config?.option);
|
|
10191
|
+
};
|
|
10192
|
+
FileUtils2.readStringSync = (path22) => {
|
|
10193
|
+
const p = FileUtils2.path(path22);
|
|
10194
|
+
return node_fs.readFileSync(p, "utf-8");
|
|
10195
|
+
};
|
|
10196
|
+
FileUtils2.readStringAsync = async (path22) => {
|
|
10197
|
+
const p = FileUtils2.path(path22);
|
|
10198
|
+
return node_fs.promises.readFile(p, "utf-8");
|
|
10199
|
+
};
|
|
10188
10200
|
FileUtils2.read = async (path22, config) => {
|
|
10189
10201
|
const p = FileUtils2.path(path22);
|
|
10190
10202
|
return node_fs.readFile(p, config.option);
|
|
@@ -10432,20 +10444,33 @@ var OpenApi3Filter = class {
|
|
|
10432
10444
|
|
|
10433
10445
|
// src/filters/ResourceFilter.ts
|
|
10434
10446
|
var import_mime_types = __toESM(require_mime_types(), 1);
|
|
10435
|
-
import fs from "fs";
|
|
10436
|
-
import path from "path";
|
|
10447
|
+
import fs from "node:fs";
|
|
10448
|
+
import path from "node:path";
|
|
10449
|
+
import { Blob } from "node:buffer";
|
|
10450
|
+
var isPathDist = (item) => {
|
|
10451
|
+
return typeof item === "object" && "request" in item && "dist" in item;
|
|
10452
|
+
};
|
|
10453
|
+
var isDataDist = (item) => {
|
|
10454
|
+
return typeof item === "object" && "request" in item && "response" in item;
|
|
10455
|
+
};
|
|
10437
10456
|
var ResourceFilter = class {
|
|
10438
|
-
constructor(
|
|
10439
|
-
|
|
10440
|
-
|
|
10457
|
+
constructor(resourceDistPathOrResourceRegex, resourceRegex) {
|
|
10458
|
+
if (typeof resourceDistPathOrResourceRegex === "string") {
|
|
10459
|
+
this.resourceDistPath = resourceDistPathOrResourceRegex;
|
|
10460
|
+
this.resources = resourceRegex;
|
|
10461
|
+
} else {
|
|
10462
|
+
this.resources = resourceDistPathOrResourceRegex;
|
|
10463
|
+
}
|
|
10441
10464
|
}
|
|
10465
|
+
// constructor(private resourceDistPath: string, private resourceRegex: (RequestFilterType | { request: RequestFilterType, dist: string | ((rr: RequestResponse, app: SimpleBootHttpServer) => (string|Promise<Blob |ArrayBuffer| Response>)) })[] = []) {
|
|
10466
|
+
// }
|
|
10442
10467
|
async onInit(app) {
|
|
10443
10468
|
}
|
|
10444
10469
|
async proceedBefore({ rr, app }) {
|
|
10445
10470
|
const url = (rr.reqUrlPathName ?? "").replace(/\.\./g, "");
|
|
10446
10471
|
const urlObj = rr.reqUrlObject;
|
|
10447
10472
|
let sw = true;
|
|
10448
|
-
const regExps = this.
|
|
10473
|
+
const regExps = this.resources?.filter((it) => {
|
|
10449
10474
|
if (it instanceof RegExp) {
|
|
10450
10475
|
return it.test(url);
|
|
10451
10476
|
}
|
|
@@ -10461,21 +10486,44 @@ var ResourceFilter = class {
|
|
|
10461
10486
|
}
|
|
10462
10487
|
return RegExp(it.request).test(url);
|
|
10463
10488
|
}
|
|
10464
|
-
});
|
|
10489
|
+
}) ?? [];
|
|
10465
10490
|
for (const it of regExps) {
|
|
10466
|
-
const resourcePath = path.join(this.resourceDistPath, typeof it === "object" && "dist" in it ? it.dist : urlObj.pathname);
|
|
10467
10491
|
sw = false;
|
|
10468
|
-
if (
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10492
|
+
if (isDataDist(it)) {
|
|
10493
|
+
let distValue = typeof it.response === "function" ? it.response(rr, app) : it.response;
|
|
10494
|
+
if (distValue instanceof Promise) {
|
|
10495
|
+
const result = await distValue;
|
|
10496
|
+
if (result instanceof Response) {
|
|
10497
|
+
await rr.resEnd(result);
|
|
10498
|
+
break;
|
|
10499
|
+
} else if (result instanceof Blob) {
|
|
10500
|
+
rr.resStatusCode(200 /* Ok */);
|
|
10501
|
+
await rr.resEnd(result);
|
|
10502
|
+
break;
|
|
10503
|
+
}
|
|
10504
|
+
}
|
|
10473
10505
|
} else {
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10506
|
+
const dist = typeof it === "object" && "dist" in it ? it.dist : urlObj.pathname;
|
|
10507
|
+
let distValue = typeof dist === "function" ? dist(rr, app) : dist;
|
|
10508
|
+
if (this.resourceDistPath) {
|
|
10509
|
+
const resourcePath = path.join(this.resourceDistPath, distValue);
|
|
10510
|
+
if (fs.existsSync(resourcePath)) {
|
|
10511
|
+
rr.resStatusCode(200 /* Ok */);
|
|
10512
|
+
rr.resSetHeader(HttpHeaders.ContentType, import_mime_types.default.lookup(resourcePath).toString());
|
|
10513
|
+
await rr.resEnd(fs.readFileSync(resourcePath));
|
|
10514
|
+
break;
|
|
10515
|
+
} else {
|
|
10516
|
+
rr.resStatusCode(404 /* NotFound */);
|
|
10517
|
+
await rr.resEnd();
|
|
10518
|
+
break;
|
|
10519
|
+
}
|
|
10520
|
+
} else {
|
|
10521
|
+
rr.resStatusCode(500 /* InternalServerError */);
|
|
10522
|
+
await rr.resEnd();
|
|
10523
|
+
break;
|
|
10524
|
+
}
|
|
10477
10525
|
}
|
|
10478
|
-
sw =
|
|
10526
|
+
sw = true;
|
|
10479
10527
|
}
|
|
10480
10528
|
return sw;
|
|
10481
10529
|
}
|
|
@@ -10510,117 +10558,6 @@ var InjectSituationType;
|
|
|
10510
10558
|
InjectSituationType2.TransactionManager = Symbol("TransactionManager");
|
|
10511
10559
|
})(InjectSituationType || (InjectSituationType = {}));
|
|
10512
10560
|
|
|
10513
|
-
// ../core/dist/esm/string/StringUtils.js
|
|
10514
|
-
var StringUtils;
|
|
10515
|
-
((StringUtils2) => {
|
|
10516
|
-
StringUtils2.deleteEnter = (data) => {
|
|
10517
|
-
return data.replace(/\r?\n/g, "");
|
|
10518
|
-
};
|
|
10519
|
-
StringUtils2.pickEmoji = (data) => {
|
|
10520
|
-
return data.match(/[\p{Emoji}]/gu) ?? [];
|
|
10521
|
-
};
|
|
10522
|
-
StringUtils2.regexExec = (regex, text) => {
|
|
10523
|
-
let varExec = regex.exec(text);
|
|
10524
|
-
const usingVars = [];
|
|
10525
|
-
while (varExec) {
|
|
10526
|
-
usingVars.push(varExec);
|
|
10527
|
-
varExec = regex.exec(varExec.input);
|
|
10528
|
-
}
|
|
10529
|
-
return usingVars;
|
|
10530
|
-
};
|
|
10531
|
-
StringUtils2.regexExecArrayReplace = (origin, regexpExecArrayOrRegex, replace) => {
|
|
10532
|
-
const regexpExecArrays = Array.isArray(regexpExecArrayOrRegex) ? regexpExecArrayOrRegex : StringUtils2.regexExec(regexpExecArrayOrRegex, origin);
|
|
10533
|
-
regexpExecArrays.reverse().forEach((it) => {
|
|
10534
|
-
const r = typeof replace === "string" ? replace : replace(it);
|
|
10535
|
-
origin = origin.substr(0, it.index) + origin.substr(it.index).replace(it[0], r);
|
|
10536
|
-
});
|
|
10537
|
-
return origin;
|
|
10538
|
-
};
|
|
10539
|
-
StringUtils2.escapeSpecialCharacterRegExp = (data) => {
|
|
10540
|
-
return data.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
10541
|
-
};
|
|
10542
|
-
StringUtils2.trim = (data) => data.trim();
|
|
10543
|
-
StringUtils2.rsubString = (data_s, blen_n) => data_s.substring(data_s.length - blen_n, data_s.length);
|
|
10544
|
-
StringUtils2.lsubString = (data_s, alen_n) => data_s.substring(0, alen_n);
|
|
10545
|
-
StringUtils2.lpad = (fill_s, len_n, full_s) => {
|
|
10546
|
-
while (len_n > full_s.length) {
|
|
10547
|
-
full_s = fill_s + full_s;
|
|
10548
|
-
}
|
|
10549
|
-
return StringUtils2.rsubString(full_s, len_n);
|
|
10550
|
-
};
|
|
10551
|
-
StringUtils2.rpad = (fill_s, len_n, full_s) => {
|
|
10552
|
-
while (len_n > full_s.length) {
|
|
10553
|
-
full_s += fill_s;
|
|
10554
|
-
}
|
|
10555
|
-
return StringUtils2.lsubString(full_s, len_n);
|
|
10556
|
-
};
|
|
10557
|
-
StringUtils2.lappend = (count_n, input_s) => {
|
|
10558
|
-
let s = "";
|
|
10559
|
-
let i = 0;
|
|
10560
|
-
while (i++ < count_n) {
|
|
10561
|
-
s += input_s;
|
|
10562
|
-
}
|
|
10563
|
-
return s;
|
|
10564
|
-
};
|
|
10565
|
-
StringUtils2.unescape = (html) => {
|
|
10566
|
-
if (!html) return "";
|
|
10567
|
-
const htmlEntity = {
|
|
10568
|
-
quot: '"',
|
|
10569
|
-
amp: "&",
|
|
10570
|
-
apos: "'",
|
|
10571
|
-
lt: "<",
|
|
10572
|
-
gt: ">",
|
|
10573
|
-
nbsp: "\xA0",
|
|
10574
|
-
iexcl: "\xA1",
|
|
10575
|
-
cent: "\xA2",
|
|
10576
|
-
pound: "\xA3",
|
|
10577
|
-
curren: "\xA4",
|
|
10578
|
-
yen: "\xA5",
|
|
10579
|
-
brvbar: "\xA6",
|
|
10580
|
-
sect: "\xA7",
|
|
10581
|
-
uml: "\xA8",
|
|
10582
|
-
copy: "\xA9",
|
|
10583
|
-
ordf: "\xAA",
|
|
10584
|
-
laquo: "\xAB",
|
|
10585
|
-
not: "\xAC",
|
|
10586
|
-
shy: "\xAD",
|
|
10587
|
-
reg: "\xAE",
|
|
10588
|
-
macr: "\xAF",
|
|
10589
|
-
deg: "\xB0",
|
|
10590
|
-
plusmn: "\xB1",
|
|
10591
|
-
sup2: "\xB2",
|
|
10592
|
-
sup3: "\xB3",
|
|
10593
|
-
acute: "\xB4",
|
|
10594
|
-
micro: "\xB5",
|
|
10595
|
-
para: "\xB6",
|
|
10596
|
-
middot: "\xB7",
|
|
10597
|
-
cedil: "\xB8",
|
|
10598
|
-
sup1: "\xB9",
|
|
10599
|
-
ordm: "\xBA",
|
|
10600
|
-
raquo: "\xBB",
|
|
10601
|
-
frac14: "\xBC",
|
|
10602
|
-
frac12: "\xBD",
|
|
10603
|
-
frac34: "\xBE",
|
|
10604
|
-
iquest: "\xBF",
|
|
10605
|
-
"#x27": "'"
|
|
10606
|
-
};
|
|
10607
|
-
return html.replace(/&((?:(?:[a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});?)+);/gi, (match, entity) => {
|
|
10608
|
-
const entities = entity.toLowerCase().split(";");
|
|
10609
|
-
return entities.map((it) => it in htmlEntity ? htmlEntity[it] : match).join("");
|
|
10610
|
-
});
|
|
10611
|
-
};
|
|
10612
|
-
StringUtils2.executeExpression = (formatString, object) => {
|
|
10613
|
-
return formatString.replace(/\${([^{}]*)}/g, (matched, piece) => String(object[piece] ?? matched));
|
|
10614
|
-
};
|
|
10615
|
-
StringUtils2.ellipsis = (text, length) => {
|
|
10616
|
-
if (text.length > length) return `${text.slice(0, length)}...`;
|
|
10617
|
-
return text;
|
|
10618
|
-
};
|
|
10619
|
-
StringUtils2.appendPostposition = (text, { vowel, consonant }) => {
|
|
10620
|
-
return `${text}${ValidUtils.lastConsonantLetter(text) ? consonant : vowel}`;
|
|
10621
|
-
};
|
|
10622
|
-
})(StringUtils || (StringUtils = {}));
|
|
10623
|
-
|
|
10624
10561
|
// ../core/dist/esm/expression/Expression.js
|
|
10625
10562
|
var Expression;
|
|
10626
10563
|
((Expression2) => {
|
|
@@ -10635,17 +10572,6 @@ var Expression;
|
|
|
10635
10572
|
return binder;
|
|
10636
10573
|
});
|
|
10637
10574
|
};
|
|
10638
|
-
let Group;
|
|
10639
|
-
((Group2) => {
|
|
10640
|
-
Group2.isExpression = (data) => {
|
|
10641
|
-
const reg = /[$#]\{([\s\S.]*?)\}[$#]/g;
|
|
10642
|
-
return reg.test(data ?? "");
|
|
10643
|
-
};
|
|
10644
|
-
Group2.expressionGroups = (data) => {
|
|
10645
|
-
const reg = /[$#]\{([\s\S.]*?)\}[$#]/g;
|
|
10646
|
-
return StringUtils.regexExec(reg, data ?? "");
|
|
10647
|
-
};
|
|
10648
|
-
})(Group = Expression2.Group || (Expression2.Group = {}));
|
|
10649
10575
|
let Path;
|
|
10650
10576
|
((Path2) => {
|
|
10651
10577
|
Path2.pathNameData = (pathName, urlExpression) => {
|
|
@@ -10775,6 +10701,7 @@ var ReqHeader = class {
|
|
|
10775
10701
|
|
|
10776
10702
|
// src/models/RequestResponse.ts
|
|
10777
10703
|
var import_node_gzip = __toESM(require_dist(), 1);
|
|
10704
|
+
import { Blob as Blob2 } from "node:buffer";
|
|
10778
10705
|
|
|
10779
10706
|
// ../core/dist/esm/entity/Point2D.js
|
|
10780
10707
|
var Point2D = class _Point2D {
|
|
@@ -12330,7 +12257,7 @@ var ObjectUtils;
|
|
|
12330
12257
|
const func = new Function("window", "document", "console", `"use strict"; ${script}; `);
|
|
12331
12258
|
func.call(destUser, globalContext.window, globalContext.document, globalContext.console);
|
|
12332
12259
|
} catch (e) {
|
|
12333
|
-
console.error("detectPathFromScript error:", e);
|
|
12260
|
+
console.error("detectPathFromScript error:", script, e);
|
|
12334
12261
|
}
|
|
12335
12262
|
if (options?.excludeThis) {
|
|
12336
12263
|
const filteredVars = /* @__PURE__ */ new Set();
|
|
@@ -12542,6 +12469,74 @@ var ConvertUtils2;
|
|
|
12542
12469
|
ConvertUtils22.decodeHTMLEscape = (data) => {
|
|
12543
12470
|
return data.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(///g, "/");
|
|
12544
12471
|
};
|
|
12472
|
+
function escapeHTML(htmlString, option) {
|
|
12473
|
+
if (!htmlString) return "";
|
|
12474
|
+
const escapeMap = {
|
|
12475
|
+
"&": "&",
|
|
12476
|
+
// 반드시 먼저 처리
|
|
12477
|
+
"<": "<",
|
|
12478
|
+
">": ">",
|
|
12479
|
+
'"': """,
|
|
12480
|
+
"'": "'",
|
|
12481
|
+
// or ' (하지만 HTML4에서는 ' 권장)
|
|
12482
|
+
"/": "/",
|
|
12483
|
+
"`": "`",
|
|
12484
|
+
"=": "=",
|
|
12485
|
+
"{": "{",
|
|
12486
|
+
"}": "}",
|
|
12487
|
+
"#": "#",
|
|
12488
|
+
"$": "$",
|
|
12489
|
+
"\n": " ",
|
|
12490
|
+
// newline
|
|
12491
|
+
"\r": " ",
|
|
12492
|
+
// carriage return
|
|
12493
|
+
" ": "	",
|
|
12494
|
+
// tab
|
|
12495
|
+
"\xA0": " ",
|
|
12496
|
+
// non-breaking space
|
|
12497
|
+
"\xA2": "¢",
|
|
12498
|
+
"\xA3": "£",
|
|
12499
|
+
"\xA5": "¥",
|
|
12500
|
+
"\u20AC": "€",
|
|
12501
|
+
"\xA9": "©",
|
|
12502
|
+
"\xAE": "®",
|
|
12503
|
+
"\u2122": "™",
|
|
12504
|
+
"\xB0": "°",
|
|
12505
|
+
"\xB1": "±",
|
|
12506
|
+
"\xD7": "×",
|
|
12507
|
+
"\xF7": "÷",
|
|
12508
|
+
"\u2212": "−",
|
|
12509
|
+
"\u2022": "•",
|
|
12510
|
+
"\u2026": "…",
|
|
12511
|
+
"\u2190": "←",
|
|
12512
|
+
"\u2192": "→",
|
|
12513
|
+
"\u2191": "↑",
|
|
12514
|
+
"\u2193": "↓",
|
|
12515
|
+
"\u2194": "↔"
|
|
12516
|
+
};
|
|
12517
|
+
const targetsSet = option?.targets ? new Set(option.targets) : null;
|
|
12518
|
+
const filteredEscapeMap = targetsSet ? Object.fromEntries(Object.entries(escapeMap).filter(([key]) => targetsSet.has(key))) : escapeMap;
|
|
12519
|
+
const shouldEscapeAmpersand = !targetsSet || targetsSet.has("&");
|
|
12520
|
+
const charsToEscape = Object.keys(filteredEscapeMap).filter((char) => char !== "&");
|
|
12521
|
+
if (charsToEscape.length === 0 && !shouldEscapeAmpersand) {
|
|
12522
|
+
return htmlString;
|
|
12523
|
+
}
|
|
12524
|
+
const escapedChars = charsToEscape.map((char) => {
|
|
12525
|
+
return char.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
12526
|
+
}).join("");
|
|
12527
|
+
let result = htmlString;
|
|
12528
|
+
if (shouldEscapeAmpersand) {
|
|
12529
|
+
result = result.replace(/&/g, "&");
|
|
12530
|
+
}
|
|
12531
|
+
if (escapedChars.length > 0) {
|
|
12532
|
+
const regex = new RegExp(`[${escapedChars}]`, "g");
|
|
12533
|
+
result = result.replace(regex, (match) => {
|
|
12534
|
+
return filteredEscapeMap[match] || match;
|
|
12535
|
+
});
|
|
12536
|
+
}
|
|
12537
|
+
return result;
|
|
12538
|
+
}
|
|
12539
|
+
ConvertUtils22.escapeHTML = escapeHTML;
|
|
12545
12540
|
ConvertUtils22.copyObject = (obj, update = {}) => {
|
|
12546
12541
|
return { ...obj, ...update };
|
|
12547
12542
|
};
|
|
@@ -13102,7 +13097,28 @@ var RequestResponse = class _RequestResponse {
|
|
|
13102
13097
|
this.res.end(data);
|
|
13103
13098
|
}
|
|
13104
13099
|
async resEnd(chunk) {
|
|
13105
|
-
|
|
13100
|
+
if (chunk instanceof Response) {
|
|
13101
|
+
chunk.headers.forEach((value, key) => {
|
|
13102
|
+
this.res.setHeader(`ORIGIN-${key}`, value);
|
|
13103
|
+
});
|
|
13104
|
+
if (!this.resHeader(HttpHeaders.ContentType)) {
|
|
13105
|
+
const contentType = chunk.headers.get(HttpHeaders.ContentType);
|
|
13106
|
+
if (contentType) {
|
|
13107
|
+
this.res.setHeader(HttpHeaders.ContentType, contentType);
|
|
13108
|
+
}
|
|
13109
|
+
}
|
|
13110
|
+
this.res.statusCode = chunk.status;
|
|
13111
|
+
this.resWriteChunk = Buffer2.from(await chunk.arrayBuffer());
|
|
13112
|
+
} else if (chunk instanceof Blob2) {
|
|
13113
|
+
this.resWriteChunk = Buffer2.from(await chunk.arrayBuffer());
|
|
13114
|
+
if (!this.resHeader(HttpHeaders.ContentType)) {
|
|
13115
|
+
this.res.setHeader(HttpHeaders.ContentType, chunk.type);
|
|
13116
|
+
}
|
|
13117
|
+
} else if (chunk instanceof ArrayBuffer) {
|
|
13118
|
+
this.resWriteChunk = Buffer2.from(chunk);
|
|
13119
|
+
} else {
|
|
13120
|
+
this.resWriteChunk = chunk ?? this.resWriteChunk;
|
|
13121
|
+
}
|
|
13106
13122
|
if (this.req.readable) {
|
|
13107
13123
|
await this.reqBodyData();
|
|
13108
13124
|
await this.resEndChunk();
|
|
@@ -15357,7 +15373,9 @@ export {
|
|
|
15357
15373
|
getTRACE,
|
|
15358
15374
|
getTRACES,
|
|
15359
15375
|
getUrlMapping,
|
|
15360
|
-
getUrlMappings
|
|
15376
|
+
getUrlMappings,
|
|
15377
|
+
isDataDist,
|
|
15378
|
+
isPathDist
|
|
15361
15379
|
};
|
|
15362
15380
|
/*! Bundled license information:
|
|
15363
15381
|
|