@e-mc/document 0.10.8 → 0.10.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 +9 -9
- package/index.js +2 -2
- package/package.json +4 -4
- package/util.js +18 -5
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.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.10/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.
|
|
187
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
188
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
189
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
190
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
191
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
192
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
193
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
186
|
+
- https://www.unpkg.com/@e-mc/types@0.10.10/lib/squared.d.ts
|
|
187
|
+
- https://www.unpkg.com/@e-mc/types@0.10.10/lib/asset.d.ts
|
|
188
|
+
- https://www.unpkg.com/@e-mc/types@0.10.10/lib/core.d.ts
|
|
189
|
+
- https://www.unpkg.com/@e-mc/types@0.10.10/lib/document.d.ts
|
|
190
|
+
- https://www.unpkg.com/@e-mc/types@0.10.10/lib/filemanager.d.ts
|
|
191
|
+
- https://www.unpkg.com/@e-mc/types@0.10.10/lib/logger.d.ts
|
|
192
|
+
- https://www.unpkg.com/@e-mc/types@0.10.10/lib/settings.d.ts
|
|
193
|
+
- https://www.unpkg.com/@e-mc/types@0.10.10/lib/watch.d.ts
|
|
194
194
|
|
|
195
195
|
## LICENSE
|
|
196
196
|
|
package/index.js
CHANGED
|
@@ -1384,10 +1384,10 @@ class Document extends core_1.Client {
|
|
|
1384
1384
|
transformer = context;
|
|
1385
1385
|
context = this;
|
|
1386
1386
|
}
|
|
1387
|
-
if ((0, types_1.isObject)(transformer) &&
|
|
1387
|
+
if ((0, types_1.isObject)(transformer) && typeof transformer.default === 'function') {
|
|
1388
1388
|
transformer = transformer.default;
|
|
1389
1389
|
}
|
|
1390
|
-
if (typeof transformer !== 'function') {
|
|
1390
|
+
else if (typeof transformer !== 'function') {
|
|
1391
1391
|
throw (0, types_1.errorMessage)(plugin, pkg || name, "Invalid function");
|
|
1392
1392
|
}
|
|
1393
1393
|
if (pkg) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/document",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.10",
|
|
4
4
|
"description": "Document constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"license": "BSD-3-Clause",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/core": "0.10.
|
|
24
|
-
"@e-mc/db": "0.10.
|
|
25
|
-
"@e-mc/types": "0.10.
|
|
23
|
+
"@e-mc/core": "0.10.10",
|
|
24
|
+
"@e-mc/db": "0.10.10",
|
|
25
|
+
"@e-mc/types": "0.10.10",
|
|
26
26
|
"chalk": "4.1.2",
|
|
27
27
|
"domhandler": "^5.0.3",
|
|
28
28
|
"domutils": "^3.1.0",
|
package/util.js
CHANGED
|
@@ -18,13 +18,26 @@ const types_1 = require("@e-mc/types");
|
|
|
18
18
|
Object.defineProperty(exports, "IMPORTS", { enumerable: true, get: function () { return types_1.IMPORT_MAP; } });
|
|
19
19
|
Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return types_1.isObject; } });
|
|
20
20
|
function loadPlugins(name, plugins = []) {
|
|
21
|
-
if (Array.isArray(name)) {
|
|
22
|
-
plugins = name;
|
|
23
|
-
}
|
|
24
21
|
const result = [];
|
|
25
|
-
|
|
22
|
+
const items = (Array.isArray(name) ? name : plugins).map(value => {
|
|
23
|
+
let pkg, options;
|
|
24
|
+
if ((0, types_1.isString)(value)) {
|
|
25
|
+
pkg = value;
|
|
26
|
+
}
|
|
27
|
+
else if (Array.isArray(value)) {
|
|
28
|
+
[pkg, options] = value;
|
|
29
|
+
if (!(0, types_1.isString)(pkg)) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (typeof value === 'function') {
|
|
34
|
+
return [value];
|
|
35
|
+
}
|
|
36
|
+
return pkg ? [pkg, options] : null;
|
|
37
|
+
});
|
|
38
|
+
for (const plugin of items) {
|
|
26
39
|
if (plugin) {
|
|
27
|
-
let method = require(plugin[0]), options = plugin[1];
|
|
40
|
+
let method = typeof plugin[0] === 'function' ? plugin[0] : require(plugin[0]), options = plugin[1];
|
|
28
41
|
if ((0, types_1.isPlainObject)(method)) {
|
|
29
42
|
const attr = options?.__default__;
|
|
30
43
|
if ((0, types_1.isString)(attr)) {
|