@e-mc/document 0.13.8 → 0.13.10

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 CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.13.8/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.13.10/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { DataSource, ViewEngine } from "./squared";
@@ -76,7 +76,9 @@ interface DocumentConstructor extends ModuleConstructor {
76
76
  createSourceMap(code: string, remove: boolean): SourceMap;
77
77
  createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
78
78
  writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): string | undefined;
79
+ /** @deprecated */
79
80
  updateGradle(source: string, namespaces: string[], value: string, upgrade: boolean): string;
81
+ /** @deprecated */
80
82
  updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions): string;
81
83
  generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
82
84
  cleanup?(this: IFileManager, instance: IDocument): Promise<unknown>;
@@ -185,14 +187,14 @@ NOTE: **@e-mc/document** is an abstract base class and cannot be instantiated. *
185
187
 
186
188
  ## References
187
189
 
188
- - https://www.unpkg.com/@e-mc/types@0.13.8/lib/squared.d.ts
189
- - https://www.unpkg.com/@e-mc/types@0.13.8/lib/asset.d.ts
190
- - https://www.unpkg.com/@e-mc/types@0.13.8/lib/core.d.ts
191
- - https://www.unpkg.com/@e-mc/types@0.13.8/lib/document.d.ts
192
- - https://www.unpkg.com/@e-mc/types@0.13.8/lib/filemanager.d.ts
193
- - https://www.unpkg.com/@e-mc/types@0.13.8/lib/logger.d.ts
194
- - https://www.unpkg.com/@e-mc/types@0.13.8/lib/settings.d.ts
195
- - https://www.unpkg.com/@e-mc/types@0.13.8/lib/watch.d.ts
190
+ - https://www.unpkg.com/@e-mc/types@0.13.10/lib/squared.d.ts
191
+ - https://www.unpkg.com/@e-mc/types@0.13.10/lib/asset.d.ts
192
+ - https://www.unpkg.com/@e-mc/types@0.13.10/lib/core.d.ts
193
+ - https://www.unpkg.com/@e-mc/types@0.13.10/lib/document.d.ts
194
+ - https://www.unpkg.com/@e-mc/types@0.13.10/lib/filemanager.d.ts
195
+ - https://www.unpkg.com/@e-mc/types@0.13.10/lib/logger.d.ts
196
+ - https://www.unpkg.com/@e-mc/types@0.13.10/lib/settings.d.ts
197
+ - https://www.unpkg.com/@e-mc/types@0.13.10/lib/watch.d.ts
196
198
 
197
199
  ## LICENSE
198
200
 
package/index.js CHANGED
@@ -685,7 +685,7 @@ class Document extends core_1.Client {
685
685
  let instance = null;
686
686
  if (handler && handler !== "@e-mc/db") {
687
687
  try {
688
- const Module = require(handler);
688
+ const Module = (0, types_1.requireESM)(handler);
689
689
  if (core_1.Client.constructorOf(Module, 'clientdb')) {
690
690
  instance = new Module(db, database);
691
691
  }
@@ -846,8 +846,9 @@ class Document extends core_1.Client {
846
846
  let encoding, cache;
847
847
  if (typeof options === 'boolean') {
848
848
  cache = options;
849
+ options = undefined;
849
850
  }
850
- else if ((0, types_1.isObject)(options)) {
851
+ else if (options) {
851
852
  ({ encoding, cache } = options);
852
853
  }
853
854
  let result, pkgName;
@@ -856,7 +857,8 @@ class Document extends core_1.Client {
856
857
  if (!core_1.Client.enabled("node.require.npm")) {
857
858
  return null;
858
859
  }
859
- result = require(pkgName = value.substring(4));
860
+ pkgName = value.substring(4);
861
+ result = options?.default ? (0, types_1.requireESM)(pkgName, options.url) : require(pkgName);
860
862
  if (typeof result === 'function') {
861
863
  return Object.defineProperty(result, "__cjs__", { value: true });
862
864
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/document",
3
- "version": "0.13.8",
3
+ "version": "0.13.10",
4
4
  "description": "Document constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -19,14 +19,14 @@
19
19
  "license": "BSD-3-Clause",
20
20
  "homepage": "https://github.com/anpham6/e-mc#readme",
21
21
  "dependencies": {
22
- "@e-mc/core": "0.13.8",
23
- "@e-mc/db": "0.13.8",
24
- "@e-mc/types": "0.13.8",
22
+ "@e-mc/core": "0.13.10",
23
+ "@e-mc/db": "0.13.10",
24
+ "@e-mc/types": "0.13.10",
25
25
  "chalk": "4.1.2",
26
26
  "domhandler": "^5.0.3",
27
27
  "domutils": "^3.2.2",
28
28
  "htmlparser2": "^10.0.0",
29
29
  "js-yaml": "^4.1.1",
30
- "picomatch": "^4.0.3"
30
+ "picomatch": "^4.0.4"
31
31
  }
32
32
  }
package/parse/index.js CHANGED
@@ -179,12 +179,13 @@ class XmlWriter {
179
179
  });
180
180
  }
181
181
  static escapeAttributes(source) {
182
- let escaped, match, attribute;
182
+ let match, attribute;
183
183
  while (match = REGEXP_TAGATTR.exec(source)) {
184
184
  let output = match[0], modified = false;
185
- while (attribute = REGEXP_ATTRVALUE.exec(match[1])) {
185
+ while (attribute = REGEXP_ATTRVALUE.exec(output)) {
186
186
  const value = attribute[2] || attribute[3] || attribute[4];
187
- if (value && (escaped = this.escapeXmlString(value)) !== value) {
187
+ const escaped = this.escapeXmlString(value);
188
+ if (value !== escaped) {
188
189
  output = (0, util_1.spliceMatch)(output, attribute, attribute[1] + `="${escaped}"`, REGEXP_ATTRVALUE);
189
190
  modified = true;
190
191
  }
@@ -400,7 +401,6 @@ class XmlWriter {
400
401
  const result = [];
401
402
  const flags = ignoreCase ? 'gi' : 'g';
402
403
  let pattern = CACHE_TAGNAME[tagPattern + flags] ||= new RegExp(`<(?:(!--[\\S\\s]*?--)|(!\\[CDATA\\[[\\S\\s]*?\\]\\])` + (tagPattern ? '|' + `(${tagPattern})${this.PATTERN_TAGOPEN}*` : '') + ')>', flags), match;
403
- pattern.lastIndex = 0;
404
404
  while (match = pattern.exec(source)) {
405
405
  if (stripXml) {
406
406
  source = this.replaceMatch(match, source, '', { pattern, trimLeading: true });
@@ -417,6 +417,7 @@ class XmlWriter {
417
417
  }
418
418
  }
419
419
  }
420
+ pattern.lastIndex = 0;
420
421
  if (stripXml) {
421
422
  return source;
422
423
  }
@@ -1135,7 +1136,6 @@ class XmlElement {
1135
1136
  }
1136
1137
  this._tagVoid = isVoid;
1137
1138
  REGEXP_ATTRVALUE.lastIndex = 0;
1138
- REGEXP_ATTRNAME.lastIndex = 0;
1139
1139
  }
1140
1140
  else if (tagVoid) {
1141
1141
  this._tagVoid = true;
package/util.js CHANGED
@@ -42,7 +42,7 @@ function loadPlugins(plugins, map) {
42
42
  });
43
43
  for (const plugin of items) {
44
44
  if (plugin) {
45
- let method = typeof plugin[0] === 'function' ? plugin[0] : require(plugin[0]), options = plugin[1];
45
+ let method = typeof plugin[0] === 'function' ? plugin[0] : (0, types_1.requireESM)(plugin[0]), options = plugin[1];
46
46
  if ((0, types_1.isPlainObject)(method)) {
47
47
  const attr = options?.__default__;
48
48
  if ((0, types_1.isString)(attr)) {