@e-mc/document 0.8.23 → 0.8.24
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
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
12
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/index.d.ts
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { DataSource, ViewEngine } from "./squared";
|
|
@@ -85,14 +85,14 @@ interface DocumentConstructor extends ModuleConstructor {
|
|
|
85
85
|
|
|
86
86
|
## References
|
|
87
87
|
|
|
88
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
89
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
90
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
91
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
92
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
93
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
94
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
95
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
88
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/squared.d.ts
|
|
89
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/asset.d.ts
|
|
90
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/core.d.ts
|
|
91
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/document.d.ts
|
|
92
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/filemanager.d.ts
|
|
93
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/logger.d.ts
|
|
94
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/settings.d.ts
|
|
95
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/watch.d.ts
|
|
96
96
|
|
|
97
97
|
## LICENSE
|
|
98
98
|
|
package/index.js
CHANGED
|
@@ -1218,10 +1218,10 @@ class Document extends core_1.Client {
|
|
|
1218
1218
|
context = this;
|
|
1219
1219
|
pkg = undefined;
|
|
1220
1220
|
}
|
|
1221
|
-
if (transformer && typeof transformer
|
|
1221
|
+
if ((0, types_1.isObject)(transformer) && typeof transformer.default === 'function') {
|
|
1222
1222
|
transformer = transformer.default;
|
|
1223
1223
|
}
|
|
1224
|
-
if (typeof transformer !== 'function') {
|
|
1224
|
+
else if (typeof transformer !== 'function') {
|
|
1225
1225
|
throw (0, types_1.errorMessage)(plugin, pkg || name, 'Invalid function');
|
|
1226
1226
|
}
|
|
1227
1227
|
if (pkg) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/document",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.24",
|
|
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": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/core": "0.8.
|
|
24
|
-
"@e-mc/db": "0.8.
|
|
25
|
-
"@e-mc/types": "0.8.
|
|
23
|
+
"@e-mc/core": "0.8.24",
|
|
24
|
+
"@e-mc/db": "0.8.24",
|
|
25
|
+
"@e-mc/types": "0.8.24",
|
|
26
26
|
"chalk": "4.1.2",
|
|
27
27
|
"domhandler": "^5.0.3",
|
|
28
28
|
"domutils": "^3.1.0",
|
package/util.js
CHANGED
|
@@ -23,13 +23,26 @@ exports.IMPORTS = {
|
|
|
23
23
|
"uglify-js": "@pi-r/uglify-js"
|
|
24
24
|
};
|
|
25
25
|
function loadPlugins(name, plugins = []) {
|
|
26
|
-
if (Array.isArray(name)) {
|
|
27
|
-
plugins = name;
|
|
28
|
-
}
|
|
29
26
|
const result = [];
|
|
30
|
-
|
|
27
|
+
const items = (Array.isArray(name) ? name : plugins).map(value => {
|
|
28
|
+
let pkg, options;
|
|
29
|
+
if ((0, types_1.isString)(value)) {
|
|
30
|
+
pkg = value;
|
|
31
|
+
}
|
|
32
|
+
else if (Array.isArray(value)) {
|
|
33
|
+
[pkg, options] = value;
|
|
34
|
+
if (!(0, types_1.isString)(pkg)) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else if (typeof value === 'function') {
|
|
39
|
+
return [value];
|
|
40
|
+
}
|
|
41
|
+
return pkg ? [pkg, options] : null;
|
|
42
|
+
});
|
|
43
|
+
for (const plugin of items) {
|
|
31
44
|
if (plugin) {
|
|
32
|
-
let method = require(plugin[0]), options = plugin[1];
|
|
45
|
+
let method = typeof plugin[0] === 'function' ? plugin[0] : require(plugin[0]), options = plugin[1];
|
|
33
46
|
if ((0, types_1.isPlainObject)(method)) {
|
|
34
47
|
const attr = options === null || options === void 0 ? void 0 : options.__default__;
|
|
35
48
|
if ((0, types_1.isString)(attr)) {
|