@e-mc/document 0.8.7 → 0.8.8

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/LICENSE CHANGED
@@ -1,11 +1,7 @@
1
1
  Copyright 2024 An Pham
2
2
 
3
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
5
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
6
 
7
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
-
9
- 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
-
11
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @e-mc/document
2
2
 
3
3
  * NodeJS 14
4
- * ES2020
4
+ * ES2019
5
5
 
6
6
  ## General Usage
7
7
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- - https://www.unpkg.com/@e-mc/types@0.8.7/lib/index.d.ts
12
+ - https://www.unpkg.com/@e-mc/types@0.8.8/lib/index.d.ts
13
13
 
14
14
  ```typescript
15
15
  import type { DataSource, ViewEngine } from "./squared";
@@ -85,15 +85,15 @@ interface DocumentConstructor extends ModuleConstructor {
85
85
 
86
86
  ## References
87
87
 
88
- - https://www.unpkg.com/@e-mc/types@0.8.7/lib/squared.d.ts
89
- - https://www.unpkg.com/@e-mc/types@0.8.7/lib/asset.d.ts
90
- - https://www.unpkg.com/@e-mc/types@0.8.7/lib/core.d.ts
91
- - https://www.unpkg.com/@e-mc/types@0.8.7/lib/document.d.ts
92
- - https://www.unpkg.com/@e-mc/types@0.8.7/lib/filemanager.d.ts
93
- - https://www.unpkg.com/@e-mc/types@0.8.7/lib/logger.d.ts
94
- - https://www.unpkg.com/@e-mc/types@0.8.7/lib/settings.d.ts
95
- - https://www.unpkg.com/@e-mc/types@0.8.7/lib/watch.d.ts
88
+ - https://www.unpkg.com/@e-mc/types@0.8.8/lib/squared.d.ts
89
+ - https://www.unpkg.com/@e-mc/types@0.8.8/lib/asset.d.ts
90
+ - https://www.unpkg.com/@e-mc/types@0.8.8/lib/core.d.ts
91
+ - https://www.unpkg.com/@e-mc/types@0.8.8/lib/document.d.ts
92
+ - https://www.unpkg.com/@e-mc/types@0.8.8/lib/filemanager.d.ts
93
+ - https://www.unpkg.com/@e-mc/types@0.8.8/lib/logger.d.ts
94
+ - https://www.unpkg.com/@e-mc/types@0.8.8/lib/settings.d.ts
95
+ - https://www.unpkg.com/@e-mc/types@0.8.8/lib/watch.d.ts
96
96
 
97
97
  ## LICENSE
98
98
 
99
- BSD 3-Clause
99
+ MIT
package/index.js CHANGED
@@ -254,6 +254,7 @@ class Document extends core_1.Client {
254
254
  return lastIndex > 0 ? spliceSource(source, lastIndex, lastIndex, content) : source + newline + content;
255
255
  }
256
256
  static generateLintTable(messages, options) {
257
+ var _a, _b, _c;
257
258
  const { leadingText, trailingText, pathname, filename, ruleWidth = 30, messageWidth = 60 } = options;
258
259
  const result = [];
259
260
  const truncate = (value, width) => value.length > width ? value.substring(0, width - 3) + '...' : value.padStart(width);
@@ -299,9 +300,9 @@ class Document extends core_1.Client {
299
300
  maxWidth += maxLine + maxColumn;
300
301
  const title = (leadingText || '') + (pathname || filename ? (leadingText ? ': ' : '') + (pathname && filename ? path.join(pathname, filename) : pathname || filename) : '');
301
302
  const divider = { type: types_1.STATUS_TYPE.INFO, value: '-'.repeat(maxWidth), timeStamp };
302
- errorCount = (options.errorCount ?? errorCount).toString();
303
- warningCount = (options.warningCount ?? warningCount).toString();
304
- fatalErrorCount = (options.fatalErrorCount ?? fatalErrorCount).toString();
303
+ errorCount = ((_a = options.errorCount) !== null && _a !== void 0 ? _a : errorCount).toString();
304
+ warningCount = ((_b = options.warningCount) !== null && _b !== void 0 ? _b : warningCount).toString();
305
+ fatalErrorCount = ((_c = options.fatalErrorCount) !== null && _c !== void 0 ? _c : fatalErrorCount).toString();
305
306
  const hasFatal = fatalErrorCount !== '0';
306
307
  result.unshift(divider, { type: types_1.STATUS_TYPE.INFO, value: title + ' '.repeat(maxWidth - title.length - (hasFatal ? fatalErrorCount.length + 9 : 0)) + (hasFatal ? `fatal(${chalk.bold.bgRed.white(` ${fatalErrorCount} `)})` : ''), timeStamp, duration: currentTime - timeStamp }, divider);
307
308
  result.push(divider);
@@ -386,7 +387,7 @@ class Document extends core_1.Client {
386
387
  }
387
388
  }
388
389
  }
389
- if (this.dataSource.length && !ignoreModules?.includes('db')) {
390
+ if (this.dataSource.length && !(ignoreModules === null || ignoreModules === void 0 ? void 0 : ignoreModules.includes('db'))) {
390
391
  const db = (_a = this.module).db || (_a.db = {});
391
392
  const handler = db.handler;
392
393
  const database = this.dataSource.filter(this.forDb.bind(this));
@@ -469,7 +470,7 @@ class Document extends core_1.Client {
469
470
  this._transformConfig = null;
470
471
  return;
471
472
  }
472
- switch (algorithm = algorithm?.toLowerCase()) {
473
+ switch (algorithm = algorithm === null || algorithm === void 0 ? void 0 : algorithm.toLowerCase()) {
473
474
  case 'md5':
474
475
  case 'sha1':
475
476
  case 'sha224':
@@ -587,11 +588,12 @@ class Document extends core_1.Client {
587
588
  delete data[name];
588
589
  }
589
590
  resolveDir(name, ...paths) {
590
- let baseDir = this.settings.directory?.[name];
591
+ var _a, _b;
592
+ let baseDir = (_a = this.settings.directory) === null || _a === void 0 ? void 0 : _a[name];
591
593
  if (baseDir) {
592
594
  try {
593
595
  baseDir = path.resolve(baseDir);
594
- const username = this.host?.username;
596
+ const username = (_b = this.host) === null || _b === void 0 ? void 0 : _b.username;
595
597
  let result;
596
598
  if (username) {
597
599
  const leading = path.join(baseDir, 'users', username);
@@ -664,6 +666,7 @@ class Document extends core_1.Client {
664
666
  return null;
665
667
  }
666
668
  findVersion(name, fallback = '') {
669
+ var _a;
667
670
  let result;
668
671
  const versions = this.module.versions;
669
672
  if (versions) {
@@ -675,7 +678,7 @@ class Document extends core_1.Client {
675
678
  }
676
679
  }
677
680
  else {
678
- result = this.module.versions?.[name];
681
+ result = (_a = this.module.versions) === null || _a === void 0 ? void 0 : _a[name];
679
682
  }
680
683
  }
681
684
  return result || fallback;
@@ -695,6 +698,7 @@ class Document extends core_1.Client {
695
698
  return [];
696
699
  }
697
700
  findSourceRoot(uri, imports = this.imports) {
701
+ var _a, _b;
698
702
  if (!(0, types_1.isPlainObject)(imports)) {
699
703
  return;
700
704
  }
@@ -706,7 +710,7 @@ class Document extends core_1.Client {
706
710
  }
707
711
  return value.endsWith(sep) ? value : value + sep;
708
712
  };
709
- const importsStrict = this.getUserSettings()?.imports_strict ?? this.settings.imports_strict;
713
+ const importsStrict = (_b = (_a = this.getUserSettings()) === null || _a === void 0 ? void 0 : _a.imports_strict) !== null && _b !== void 0 ? _b : this.settings.imports_strict;
710
714
  const scopes = (importsStrict ? this.findSourceScope(uri, imports) : []).concat([imports]);
711
715
  const isDir = /[\\/]$/;
712
716
  let result;
@@ -777,6 +781,7 @@ class Document extends core_1.Client {
777
781
  }
778
782
  locateSourceFiles(file, code, bundleContent) {
779
783
  return (imports = this.imports) => {
784
+ var _a;
780
785
  const href = file.uri;
781
786
  const sourceFile = [];
782
787
  let mainFile, invalid;
@@ -819,7 +824,7 @@ class Document extends core_1.Client {
819
824
  invalid = true;
820
825
  break;
821
826
  }
822
- sourceFile.push(['', this.resolveImports?.(item, source, localFile) || source, localFile]);
827
+ sourceFile.push(['', ((_a = this.resolveImports) === null || _a === void 0 ? void 0 : _a.call(this, item, source, localFile)) || source, localFile]);
823
828
  }
824
829
  }
825
830
  }
@@ -830,10 +835,11 @@ class Document extends core_1.Client {
830
835
  }
831
836
  resolveSourceFile(file) {
832
837
  return (code, imports = this.imports) => {
838
+ var _a;
833
839
  const uri = file.uri;
834
840
  let source, sourceFile;
835
841
  if (code && imports && Object.keys(imports).length) {
836
- const output = this.resolveImports?.(file, code, uri && this.findSourceRoot(uri, imports));
842
+ const output = (_a = this.resolveImports) === null || _a === void 0 ? void 0 : _a.call(this, file, code, uri && this.findSourceRoot(uri, imports));
837
843
  if (output) {
838
844
  source = output;
839
845
  }
@@ -874,19 +880,22 @@ class Document extends core_1.Client {
874
880
  return item.source !== 'cloud';
875
881
  }
876
882
  hasEval(name) {
877
- return !!this.module.eval?.[name];
883
+ var _a;
884
+ return !!((_a = this.module.eval) === null || _a === void 0 ? void 0 : _a[name]);
878
885
  }
879
886
  settingsOf(name, option) {
880
- const options = this.settings.options?.[name];
887
+ var _a;
888
+ const options = (_a = this.settings.options) === null || _a === void 0 ? void 0 : _a[name];
881
889
  if ((0, types_1.isObject)(options)) {
882
890
  return options[option];
883
891
  }
884
892
  }
885
893
  async parseTemplate(viewEngine, template, data) {
894
+ var _a, _b, _c, _d, _e, _f;
886
895
  let target, stored;
887
896
  if (typeof viewEngine === 'string') {
888
- target = this.settings.view_engine?.[viewEngine];
889
- const userConfig = this.getUserSettings()?.view_engine?.[viewEngine];
897
+ target = (_a = this.settings.view_engine) === null || _a === void 0 ? void 0 : _a[viewEngine];
898
+ const userConfig = (_c = (_b = this.getUserSettings()) === null || _b === void 0 ? void 0 : _b.view_engine) === null || _c === void 0 ? void 0 : _c[viewEngine];
890
899
  if ((0, types_1.isPlainObject)(userConfig)) {
891
900
  if ((0, types_1.isPlainObject)(target)) {
892
901
  (0, types_1.cloneObject)(userConfig, { target, deep: true, preserve: true });
@@ -926,7 +935,7 @@ class Document extends core_1.Client {
926
935
  (0, types_1.coerceObject)(output, stored);
927
936
  }
928
937
  }
929
- const username = this.host?.username || '';
938
+ const username = ((_d = this.host) === null || _d === void 0 ? void 0 : _d.username) || '';
930
939
  const cache = CACHE_TEMPLATE[name] || (CACHE_TEMPLATE[name] = {});
931
940
  const cacheKey = username + core_1.Client.asHash(template + (compile ? core_1.Client.asString(compile) : ''));
932
941
  let result = '', render, valid;
@@ -939,7 +948,7 @@ class Document extends core_1.Client {
939
948
  }
940
949
  for (let i = 0, j = 0, row; i < length; ++i) {
941
950
  if ((0, types_1.isPlainObject)(row = data[i])) {
942
- row.__index__ ?? (row.__index__ = ++j);
951
+ (_e = row.__index__) !== null && _e !== void 0 ? _e : (row.__index__ = ++j);
943
952
  if (output) {
944
953
  row = { ...output, ...row };
945
954
  }
@@ -956,7 +965,7 @@ class Document extends core_1.Client {
956
965
  }
957
966
  }
958
967
  }
959
- return singleRow ? render.call(context, data) ?? null : valid ? result : null;
968
+ return singleRow ? (_f = render.call(context, data)) !== null && _f !== void 0 ? _f : null : valid ? result : null;
960
969
  }
961
970
  catch (err) {
962
971
  this.abort('view_engine');
@@ -965,13 +974,14 @@ class Document extends core_1.Client {
965
974
  return null;
966
975
  }
967
976
  async transform(type, code, format, options = {}) {
977
+ var _a, _b, _c, _d;
968
978
  let transform = this.settings.transform, data;
969
979
  if (!transform || !(0, types_1.isObject)(data = transform[type])) {
970
980
  return;
971
981
  }
972
982
  format = typeof format === 'string' ? format.trim().split(/\s*\+\s*/) : format.map(item => typeof item === 'string' ? item.trim() : '');
973
983
  const moduleName = this.moduleName;
974
- const username = this.host?.username || '';
984
+ const username = ((_a = this.host) === null || _a === void 0 ? void 0 : _a.username) || '';
975
985
  const config = this._transformConfig;
976
986
  const cacheData = config && options.cacheData;
977
987
  const cacheType = username && core_1.Client.enabled("memory.settings.users", username) ? true : this.cacheDir || core_1.Client.enabled("memory.settings.users");
@@ -1049,7 +1059,7 @@ class Document extends core_1.Client {
1049
1059
  }
1050
1060
  }
1051
1061
  if (result) {
1052
- result.storedLog?.forEach(log => this.addLog(log));
1062
+ (_b = result.storedLog) === null || _b === void 0 ? void 0 : _b.forEach(log => this.addLog(log));
1053
1063
  this.formatMessage(4, type, [joinString(cacheName, format.filter(value => value).join(' | '), options.filename), 'cache'], uri, { ...core_1.Client.LOG_STYLE_NOTICE, hintBold: true });
1054
1064
  return result;
1055
1065
  }
@@ -1061,7 +1071,7 @@ class Document extends core_1.Client {
1061
1071
  const series = new transform_1.TransformSeries(type, code, options);
1062
1072
  series.init(this, __dirname);
1063
1073
  let valid, excluded, userData, userImports, ignoreCache, storedLog, sourceFiles;
1064
- if (username && (transform = this.settings.users?.[username]?.transform)) {
1074
+ if (username && (transform = (_d = (_c = this.settings.users) === null || _c === void 0 ? void 0 : _c[username]) === null || _d === void 0 ? void 0 : _d.transform)) {
1065
1075
  userData = transform[type];
1066
1076
  userImports = transform.imports;
1067
1077
  }
@@ -1070,12 +1080,12 @@ class Document extends core_1.Client {
1070
1080
  this.abort('transform');
1071
1081
  };
1072
1082
  const includes = (name) => {
1073
- const include = config?.include[type];
1074
- if (include === true || include?.includes(name)) {
1083
+ const include = config === null || config === void 0 ? void 0 : config.include[type];
1084
+ if (include === true || (include === null || include === void 0 ? void 0 : include.includes(name))) {
1075
1085
  const exclude = config.exclude[type];
1076
1086
  return !exclude || exclude === true && include !== true || Array.isArray(exclude) && !exclude.includes(name);
1077
1087
  }
1078
- return cacheData?.override === true;
1088
+ return (cacheData === null || cacheData === void 0 ? void 0 : cacheData.override) === true;
1079
1089
  };
1080
1090
  for (let i = 0, length = format.length, name; i < length; ++i) {
1081
1091
  if (this.aborted) {
@@ -1194,7 +1204,7 @@ class Document extends core_1.Client {
1194
1204
  let transformer = CACHE_PACKAGE[plugin + username];
1195
1205
  if (!transformer) {
1196
1206
  try {
1197
- let pkg = this.resolveDir('package', plugin + '.js') || userImports?.[plugin] || imports[plugin] || util_1.IMPORTS[plugin];
1207
+ let pkg = this.resolveDir('package', plugin + '.js') || (userImports === null || userImports === void 0 ? void 0 : userImports[plugin]) || imports[plugin] || util_1.IMPORTS[plugin];
1198
1208
  if ((0, types_1.isString)(pkg)) {
1199
1209
  const match = /^(@?\S+)@(\d+(?:\.\d+(?:\.\S+)?)?|[a-z]+)$/.exec(pkg);
1200
1210
  if (match) {
@@ -1263,7 +1273,7 @@ class Document extends core_1.Client {
1263
1273
  output.map = sourceMap.map;
1264
1274
  }
1265
1275
  if ((0, types_1.isArray)(series.supplementChunks)) {
1266
- output.chunks = series.supplementChunks.map(item => ({ code: item.code, map: output.map && item.sourceMap?.map, entryPoint: item.entryPoint, filename: item.filename }));
1276
+ output.chunks = series.supplementChunks.map(item => { var _a; return ({ code: item.code, map: output.map && ((_a = item.sourceMap) === null || _a === void 0 ? void 0 : _a.map), entryPoint: item.entryPoint, filename: item.filename }); });
1267
1277
  }
1268
1278
  if (sourceFiles) {
1269
1279
  output.sourceFiles = sourceFiles;
@@ -1353,6 +1363,7 @@ class Document extends core_1.Client {
1353
1363
  return this._dataSource || [];
1354
1364
  }
1355
1365
  set imports(value) {
1366
+ var _a;
1356
1367
  if (!(0, types_1.isPlainObject)(value)) {
1357
1368
  this._imports = null;
1358
1369
  return;
@@ -1362,7 +1373,7 @@ class Document extends core_1.Client {
1362
1373
  this._imports = Object.assign(imports, value);
1363
1374
  }
1364
1375
  else {
1365
- imports = this.getUserSettings()?.imports || this.module.imports;
1376
+ imports = ((_a = this.getUserSettings()) === null || _a === void 0 ? void 0 : _a.imports) || this.module.imports;
1366
1377
  this._imports = Object.assign(this._imports || {}, (0, types_1.isPlainObject)(imports) ? imports : undefined, value);
1367
1378
  }
1368
1379
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/document",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "description": "Document constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -17,12 +17,12 @@
17
17
  "squared-functions"
18
18
  ],
19
19
  "author": "An Pham <anpham6@gmail.com>",
20
- "license": "BSD 3-Clause",
20
+ "license": "MIT",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/core": "0.8.7",
24
- "@e-mc/db": "0.8.7",
25
- "@e-mc/types": "0.8.7",
23
+ "@e-mc/core": "0.8.8",
24
+ "@e-mc/db": "0.8.8",
25
+ "@e-mc/types": "0.8.8",
26
26
  "chalk": "4.1.2",
27
27
  "htmlparser2": "^9.1.0",
28
28
  "js-yaml": "^4.1.0",
package/parse/dom.js CHANGED
@@ -34,7 +34,7 @@ class DomWriter extends index_1.XmlWriter {
34
34
  tagGroup.push(new RegExp('^' + (0, types_1.escapePattern)(start)));
35
35
  }
36
36
  const end = ignoreTagGroup[i + 1];
37
- if (end?.[end.length - 1] === '>') {
37
+ if ((end === null || end === void 0 ? void 0 : end[end.length - 1]) === '>') {
38
38
  tagGroup.push(new RegExp((0, types_1.escapePattern)(start) + '$'));
39
39
  }
40
40
  }
@@ -226,7 +226,8 @@ class HtmlElement extends index_1.XmlElement {
226
226
  this._documentType = "HTML";
227
227
  }
228
228
  getTagOffset(source) {
229
- switch (this.node.append?.tagName || this.tagName) {
229
+ var _a;
230
+ switch (((_a = this.node.append) === null || _a === void 0 ? void 0 : _a.tagName) || this.tagName) {
230
231
  case 'html':
231
232
  case 'title':
232
233
  case 'style':
package/parse/index.js CHANGED
@@ -235,7 +235,7 @@ class XmlWriter {
235
235
  return result;
236
236
  }
237
237
  const nodes = domutils.getElementsByTagName(node.tagName, outDom, true);
238
- if (!parser?.xmlMode) {
238
+ if (!(parser === null || parser === void 0 ? void 0 : parser.xmlMode)) {
239
239
  nodes.filter(item => item.next && item.next.startIndex <= item.endIndex).forEach(item => {
240
240
  for (let i = 0, length = nodes.length; i < length; ++i) {
241
241
  const element = nodes[i];
@@ -262,7 +262,7 @@ class XmlWriter {
262
262
  const locator = node.locator;
263
263
  if (locator && locatorAttr) {
264
264
  const { element } = this.locateElement(source, locator, locatorAttr, { parser, outDom });
265
- if (element?.tagName === node.tagName) {
265
+ if ((element === null || element === void 0 ? void 0 : element.tagName) === node.tagName) {
266
266
  result.element = element;
267
267
  index = nodes.findIndex(item => item === element);
268
268
  }
@@ -346,10 +346,12 @@ class XmlWriter {
346
346
  CACHE_TAGVOID[type] = values;
347
347
  }
348
348
  static isTagVoid(type, tagName) {
349
- return !!CACHE_TAGVOID[type]?.includes(tagName);
349
+ var _a;
350
+ return !!((_a = CACHE_TAGVOID[type]) === null || _a === void 0 ? void 0 : _a.includes(tagName));
350
351
  }
351
352
  static getNodeId(node, document) {
352
- return node.id?.[document] || '';
353
+ var _a;
354
+ return ((_a = node.id) === null || _a === void 0 ? void 0 : _a[document]) || '';
353
355
  }
354
356
  static getNameOfId(document) {
355
357
  return `data-${document}-id`;
@@ -424,7 +426,7 @@ class XmlWriter {
424
426
  if ((ignoreCase ? tagName.toLowerCase() === other.tagName.toLowerCase() : tagName === other.tagName) && (index === other.index && isIndex(index) || tagIndex === other.tagIndex && tagCount === other.tagCount && isIndex(tagIndex) && isCount(tagCount))) {
425
427
  return true;
426
428
  }
427
- return document && other.id && id?.[document] ? id[document] === other.id[document] : false;
429
+ return document && other.id && (id === null || id === void 0 ? void 0 : id[document]) ? id[document] === other.id[document] : false;
428
430
  }
429
431
  static isIndex(value) {
430
432
  return isIndex(value);
@@ -450,7 +452,7 @@ class XmlWriter {
450
452
  this._patternIgnore = null;
451
453
  this._writeStartIndex = -1;
452
454
  this._source = source;
453
- this.parser = options?.parser;
455
+ this.parser = options === null || options === void 0 ? void 0 : options.parser;
454
456
  }
455
457
  init(offsetMap) {
456
458
  const appending = [];
@@ -461,7 +463,7 @@ class XmlWriter {
461
463
  }
462
464
  if (isCount(item.tagCount)) {
463
465
  const tagName = item.tagName;
464
- item.tagCount += offsetMap?.[tagName] || 0;
466
+ item.tagCount += (offsetMap === null || offsetMap === void 0 ? void 0 : offsetMap[tagName]) || 0;
465
467
  this._tagCount[tagName] = item.tagCount;
466
468
  }
467
469
  deletePosition(item, rootName);
@@ -550,6 +552,7 @@ class XmlWriter {
550
552
  return null;
551
553
  }
552
554
  write(element) {
555
+ var _a;
553
556
  if (!element.modified) {
554
557
  return true;
555
558
  }
@@ -580,7 +583,7 @@ class XmlWriter {
580
583
  if (append) {
581
584
  const { tagName, id, textContent = '', prepend, nextSibling } = append;
582
585
  if (!prepend) {
583
- node.index = nextSibling ?? -1;
586
+ node.index = nextSibling !== null && nextSibling !== void 0 ? nextSibling : -1;
584
587
  }
585
588
  (node.id || (node.id = {}))[this.documentName] = id;
586
589
  element.id = id;
@@ -603,7 +606,7 @@ class XmlWriter {
603
606
  this.renameTag(node, element.tagName);
604
607
  }
605
608
  this.update(node, outerXml, append, element.tagOffset);
606
- if (element.innerXml && !element.remove && (element.hasModifiedContent() || this.patternIgnore?.test(element.tagName))) {
609
+ if (element.innerXml && !element.remove && (element.hasModifiedContent() || ((_a = this.patternIgnore) === null || _a === void 0 ? void 0 : _a.test(element.tagName)))) {
607
610
  this._hasInvalidContent = true;
608
611
  this._writeStartIndex = -1;
609
612
  }
@@ -802,6 +805,7 @@ class XmlWriter {
802
805
  }
803
806
  }
804
807
  indexTag(tagName, append, offset = 0) {
808
+ var _a;
805
809
  if (tagName in this._tagCount) {
806
810
  const elements = [];
807
811
  const revised = [];
@@ -871,7 +875,7 @@ class XmlWriter {
871
875
  return;
872
876
  }
873
877
  }
874
- const id = append ? append.id : revised[0].id?.[this.documentName];
878
+ const id = append ? append.id : (_a = revised[0].id) === null || _a === void 0 ? void 0 : _a[this.documentName];
875
879
  if (id) {
876
880
  const element = XmlWriter.findElement(this.source, (append || revised[0]), { document: this.documentName, id, tagCount: nextCount, parser: this.parser });
877
881
  if (element) {
@@ -893,7 +897,7 @@ class XmlWriter {
893
897
  item.index = -1;
894
898
  }
895
899
  const append = item.append;
896
- if (append?.tagName === tagName) {
900
+ if ((append === null || append === void 0 ? void 0 : append.tagName) === tagName) {
897
901
  delete append.tagCount;
898
902
  const nextSibling = append.nextSibling;
899
903
  if (isIndex(nextSibling)) {
@@ -954,6 +958,7 @@ class XmlWriter {
954
958
  }
955
959
  getElementsByTagName(tagName, ignoreCase = false, options) {
956
960
  var _a;
961
+ var _b;
957
962
  let tagVoid;
958
963
  if (options) {
959
964
  ({ tagVoid } = options);
@@ -963,14 +968,14 @@ class XmlWriter {
963
968
  const result = [];
964
969
  const patternId = XmlWriter.getPatternId(this.nameOfId);
965
970
  const flags = ignoreCase ? 'gi' : 'g';
966
- const pattern = CACHE_TAGNAME[_a = tagName + flags + '3'] || (CACHE_TAGNAME[_a] = new RegExp(`<${escapeTagName(tagName) + PATTERN_TAGOPEN}*>`, flags));
971
+ const pattern = CACHE_TAGNAME[_b = tagName + flags + '3'] || (CACHE_TAGNAME[_b] = new RegExp(`<${escapeTagName(tagName) + PATTERN_TAGOPEN}*>`, flags));
967
972
  pattern.lastIndex = 0;
968
973
  let match;
969
974
  while (match = pattern.exec(source)) {
970
975
  const startIndex = match.index;
971
976
  let outerXml = match[0], endIndex = startIndex + outerXml.length - 1;
972
977
  if (!invalid || isValidIndex(invalid, startIndex, endIndex)) {
973
- const id = patternId.exec(outerXml)?.[1];
978
+ const id = (_a = patternId.exec(outerXml)) === null || _a === void 0 ? void 0 : _a[1];
974
979
  if (!tagVoid) {
975
980
  const [index, closeTag] = findCloseIndex(source, tagName, endIndex + 1, ignoreCase);
976
981
  if (index !== -1) {
@@ -1152,6 +1157,7 @@ class XmlElement {
1152
1157
  }
1153
1158
  }
1154
1159
  getAttribute(name) {
1160
+ var _a;
1155
1161
  let result = this._attributes.get(this._ignoreCase ? name = name.toLowerCase() : name);
1156
1162
  if (result) {
1157
1163
  return result;
@@ -1164,7 +1170,7 @@ class XmlElement {
1164
1170
  if (outerXml) {
1165
1171
  const index = XmlWriter.findCloseTag(outerXml);
1166
1172
  if (index !== -1) {
1167
- return XmlWriter.getPatternId(this.nameOfId).exec(outerXml.substring(0, index))?.[1] || '';
1173
+ return ((_a = XmlWriter.getPatternId(this.nameOfId).exec(outerXml.substring(0, index))) === null || _a === void 0 ? void 0 : _a[1]) || '';
1168
1174
  }
1169
1175
  }
1170
1176
  }
@@ -1376,7 +1382,8 @@ class XmlElement {
1376
1382
  return [this.tagName, attributes, this.innerXml];
1377
1383
  }
1378
1384
  getInnerOffset(tagName) {
1379
- return this._tagOffset?.[tagName] || 0;
1385
+ var _a;
1386
+ return ((_a = this._tagOffset) === null || _a === void 0 ? void 0 : _a[tagName]) || 0;
1380
1387
  }
1381
1388
  hasPosition() {
1382
1389
  return isIndex(this.node.startIndex) && isIndex(this.node.endIndex);
@@ -1412,7 +1419,8 @@ class XmlElement {
1412
1419
  return this._documentType || this.documentName;
1413
1420
  }
1414
1421
  get tagVoid() {
1415
- return this._tagVoid ?? XmlWriter.isTagVoid(this.documentType, this.tagName);
1422
+ var _a;
1423
+ return (_a = this._tagVoid) !== null && _a !== void 0 ? _a : XmlWriter.isTagVoid(this.documentType, this.tagName);
1416
1424
  }
1417
1425
  set innerXml(value) {
1418
1426
  if (!this.tagVoid && value !== this._innerXml) {
@@ -136,8 +136,9 @@ class TransformSeries extends core_1.Module {
136
136
  return context;
137
137
  }
138
138
  close(instance) {
139
+ var _e;
139
140
  core_1.AbortComponent.detach(instance, this.signal);
140
- this.host?.release(this);
141
+ (_e = this.host) === null || _e === void 0 ? void 0 : _e.release(this);
141
142
  }
142
143
  set code(value) {
143
144
  this[kCode] = value;