@e-mc/document 0.9.11 → 0.9.13

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.9.11/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.9.13/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.9.11/lib/squared.d.ts
187
- - https://www.unpkg.com/@e-mc/types@0.9.11/lib/asset.d.ts
188
- - https://www.unpkg.com/@e-mc/types@0.9.11/lib/core.d.ts
189
- - https://www.unpkg.com/@e-mc/types@0.9.11/lib/document.d.ts
190
- - https://www.unpkg.com/@e-mc/types@0.9.11/lib/filemanager.d.ts
191
- - https://www.unpkg.com/@e-mc/types@0.9.11/lib/logger.d.ts
192
- - https://www.unpkg.com/@e-mc/types@0.9.11/lib/settings.d.ts
193
- - https://www.unpkg.com/@e-mc/types@0.9.11/lib/watch.d.ts
186
+ - https://www.unpkg.com/@e-mc/types@0.9.13/lib/squared.d.ts
187
+ - https://www.unpkg.com/@e-mc/types@0.9.13/lib/asset.d.ts
188
+ - https://www.unpkg.com/@e-mc/types@0.9.13/lib/core.d.ts
189
+ - https://www.unpkg.com/@e-mc/types@0.9.13/lib/document.d.ts
190
+ - https://www.unpkg.com/@e-mc/types@0.9.13/lib/filemanager.d.ts
191
+ - https://www.unpkg.com/@e-mc/types@0.9.13/lib/logger.d.ts
192
+ - https://www.unpkg.com/@e-mc/types@0.9.13/lib/settings.d.ts
193
+ - https://www.unpkg.com/@e-mc/types@0.9.13/lib/watch.d.ts
194
194
 
195
195
  ## LICENSE
196
196
 
package/index.js CHANGED
@@ -7,9 +7,9 @@ const chalk = require("chalk");
7
7
  const types_1 = require("@e-mc/types");
8
8
  const core_1 = require("@e-mc/core");
9
9
  const db_1 = require("@e-mc/db");
10
- const util_1 = require("@e-mc/document/util");
11
10
  const transform_1 = require("@e-mc/document/transform");
12
11
  const parse_1 = require("@e-mc/document/parse");
12
+ const util_1 = require("@e-mc/document/util");
13
13
  const PLATFORM_WIN32 = process.platform === 'win32';
14
14
  const CACHE_PACKAGE = {};
15
15
  const CACHE_REQUIRE = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/document",
3
- "version": "0.9.11",
3
+ "version": "0.9.13",
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.9.11",
24
- "@e-mc/db": "0.9.11",
25
- "@e-mc/types": "0.9.11",
23
+ "@e-mc/core": "0.9.13",
24
+ "@e-mc/db": "0.9.13",
25
+ "@e-mc/types": "0.9.13",
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
@@ -4,9 +4,9 @@ const htmlparser2 = require("htmlparser2");
4
4
  const domhandler = require("domhandler");
5
5
  const domutils = require("domutils");
6
6
  const types_1 = require("@e-mc/types");
7
- const util_1 = require("@e-mc/document/util");
8
7
  const index_1 = require("@e-mc/document/parse");
9
8
  Object.defineProperty(exports, "IGNORE_FLAG", { enumerable: true, get: function () { return index_1.IGNORE_FLAG; } });
9
+ const util_1 = require("@e-mc/document/util");
10
10
  const Parser = htmlparser2.Parser;
11
11
  const DomHandler = domhandler.DomHandler;
12
12
  const TAG_VOID = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
package/util.js CHANGED
@@ -26,10 +26,18 @@ function loadPlugins(name, plugins = []) {
26
26
  plugins = name;
27
27
  }
28
28
  const result = [];
29
- for (const plugin of plugins.map(item => (0, types_1.isString)(item) ? [item] : Array.isArray(item) && (0, types_1.isString)(item[0]) ? item : null)) {
29
+ 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)) {
30
30
  if (plugin) {
31
- const [pkg, options] = plugin;
32
- result.push(require(pkg)(options));
31
+ let method = require(plugin[0]), options = plugin[1];
32
+ if ((0, types_1.isPlainObject)(method)) {
33
+ const attr = options?.__default__;
34
+ if ((0, types_1.isString)(attr)) {
35
+ method = method[attr];
36
+ options = { ...options };
37
+ delete options.__default__;
38
+ }
39
+ }
40
+ result.push(method(options));
33
41
  }
34
42
  }
35
43
  return result;