@e-mc/document 0.10.2 → 0.10.3

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.10.2/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.10.3/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { DataSource, ViewEngine } from "./squared";
@@ -183,14 +183,14 @@ NOTE: **@e-mc/document** is an abstract base class and cannot be instantiated. *
183
183
 
184
184
  ## References
185
185
 
186
- - https://www.unpkg.com/@e-mc/types@0.10.2/lib/squared.d.ts
187
- - https://www.unpkg.com/@e-mc/types@0.10.2/lib/asset.d.ts
188
- - https://www.unpkg.com/@e-mc/types@0.10.2/lib/core.d.ts
189
- - https://www.unpkg.com/@e-mc/types@0.10.2/lib/document.d.ts
190
- - https://www.unpkg.com/@e-mc/types@0.10.2/lib/filemanager.d.ts
191
- - https://www.unpkg.com/@e-mc/types@0.10.2/lib/logger.d.ts
192
- - https://www.unpkg.com/@e-mc/types@0.10.2/lib/settings.d.ts
193
- - https://www.unpkg.com/@e-mc/types@0.10.2/lib/watch.d.ts
186
+ - https://www.unpkg.com/@e-mc/types@0.10.3/lib/squared.d.ts
187
+ - https://www.unpkg.com/@e-mc/types@0.10.3/lib/asset.d.ts
188
+ - https://www.unpkg.com/@e-mc/types@0.10.3/lib/core.d.ts
189
+ - https://www.unpkg.com/@e-mc/types@0.10.3/lib/document.d.ts
190
+ - https://www.unpkg.com/@e-mc/types@0.10.3/lib/filemanager.d.ts
191
+ - https://www.unpkg.com/@e-mc/types@0.10.3/lib/logger.d.ts
192
+ - https://www.unpkg.com/@e-mc/types@0.10.3/lib/settings.d.ts
193
+ - https://www.unpkg.com/@e-mc/types@0.10.3/lib/watch.d.ts
194
194
 
195
195
  ## LICENSE
196
196
 
package/asset.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ExternalAsset, InitialValue } from '../types/lib/asset';
1
+ import type { ExternalAsset, InitialValue } from '@e-mc/types/lib/asset';
2
2
 
3
3
  declare namespace asset {
4
4
  function isEqual(item: ExternalAsset, other: ExternalAsset): boolean;
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { DocumentConstructor, IFileManager } from '../types/lib';
2
-
3
- declare const Document: DocumentConstructor<IFileManager>;
4
-
1
+ import type { DocumentConstructor, IFileManager } from '@e-mc/types/lib';
2
+
3
+ declare const Document: DocumentConstructor<IFileManager>;
4
+
5
5
  export = Document;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/document",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "Document constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -17,13 +17,15 @@
17
17
  "squared-functions"
18
18
  ],
19
19
  "author": "An Pham <anpham6@gmail.com>",
20
- "license": "BSD 3-Clause",
20
+ "license": "BSD-3-Clause",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/core": "0.10.2",
24
- "@e-mc/db": "0.10.2",
25
- "@e-mc/types": "0.10.2",
23
+ "@e-mc/core": "0.10.3",
24
+ "@e-mc/db": "0.10.3",
25
+ "@e-mc/types": "0.10.3",
26
26
  "chalk": "4.1.2",
27
+ "domhandler": "^5.0.3",
28
+ "domutils": "^3.1.0",
27
29
  "htmlparser2": "^9.1.0",
28
30
  "js-yaml": "^4.1.0",
29
31
  "picomatch": "^4.0.2"
package/parse/dom.js CHANGED
@@ -3,9 +3,9 @@ exports.IGNORE_FLAG = exports.HtmlElement = exports.DomWriter = void 0;
3
3
  const htmlparser2 = require("htmlparser2");
4
4
  const domhandler = require("domhandler");
5
5
  const domutils = require("domutils");
6
+ const types_1 = require("@e-mc/types");
6
7
  const index_1 = require("@e-mc/document/parse");
7
8
  Object.defineProperty(exports, "IGNORE_FLAG", { enumerable: true, get: function () { return index_1.IGNORE_FLAG; } });
8
- const types_1 = require("@e-mc/types");
9
9
  const util_1 = require("@e-mc/document/util");
10
10
  const Parser = htmlparser2.Parser;
11
11
  const DomHandler = domhandler.DomHandler;
package/parse/index.js CHANGED
@@ -4,8 +4,8 @@ const htmlparser2 = require("htmlparser2");
4
4
  const domhandler = require("domhandler");
5
5
  const domutils = require("domutils");
6
6
  const crypto = require("crypto");
7
- const module_1 = require("@e-mc/module");
8
7
  const types_1 = require("@e-mc/types");
8
+ const module_1 = require("@e-mc/module");
9
9
  const util_1 = require("@e-mc/document/util");
10
10
  var IGNORE_FLAG;
11
11
  (function (IGNORE_FLAG) {
@@ -1,4 +1,4 @@
1
- import type { XmlTagNode as IXmlTagNode, TagAppend, TagData } from '../../../types/lib/squared';
1
+ import type { XmlTagNode as IXmlTagNode, TagAppend, TagData } from '@e-mc/types/lib/squared';
2
2
 
3
3
  import type { ParserOptions } from 'htmlparser2';
4
4
  import type { AnyNode, Element } from 'domhandler';
@@ -1,8 +1,8 @@
1
- import type { SourceMapConstructor, TransformSeriesConstructor } from '../../types/lib/document';
2
-
3
- declare namespace transform {
4
- const TransformSeries: TransformSeriesConstructor;
5
- const SourceMap: SourceMapConstructor;
6
- }
7
-
1
+ import type { SourceMapConstructor, TransformSeriesConstructor } from '@e-mc/types/lib/document';
2
+
3
+ declare namespace transform {
4
+ const TransformSeries: TransformSeriesConstructor;
5
+ const SourceMap: SourceMapConstructor;
6
+ }
7
+
8
8
  export = transform;
@@ -2,8 +2,8 @@
2
2
  var _a, _b, _c, _d;
3
3
  exports.SourceMap = exports.TransformSeries = void 0;
4
4
  const path = require("path");
5
- const core_1 = require("@e-mc/core");
6
5
  const types_1 = require("@e-mc/types");
6
+ const core_1 = require("@e-mc/core");
7
7
  const kCode = Symbol('code');
8
8
  const kMap = Symbol('map');
9
9
  const kOut = Symbol('out');
package/util.js CHANGED
@@ -22,10 +22,18 @@ function loadPlugins(name, plugins = []) {
22
22
  plugins = name;
23
23
  }
24
24
  const result = [];
25
- for (const plugin of plugins.map(item => (0, types_1.isString)(item) ? [item] : Array.isArray(item) && (0, types_1.isString)(item[0]) ? item : null)) {
25
+ for (const plugin of plugins.map(item => (0, types_1.isString)(item) ? [item, undefined] : Array.isArray(item) && (0, types_1.isString)(item[0]) ? item : null)) {
26
26
  if (plugin) {
27
- const [pkg, options] = plugin;
28
- result.push(require(pkg)(options));
27
+ let method = require(plugin[0]), options = plugin[1];
28
+ if ((0, types_1.isPlainObject)(method)) {
29
+ const attr = options?.__default__;
30
+ if ((0, types_1.isString)(attr)) {
31
+ method = method[attr];
32
+ options = { ...options };
33
+ delete options.__default__;
34
+ }
35
+ }
36
+ result.push(method(options));
29
37
  }
30
38
  }
31
39
  return result;