@e-mc/document 0.8.24 → 0.8.26
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 +9 -10
- package/package.json +4 -4
- package/util.js +1 -1
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.26/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.26/lib/squared.d.ts
|
|
89
|
+
- https://www.unpkg.com/@e-mc/types@0.8.26/lib/asset.d.ts
|
|
90
|
+
- https://www.unpkg.com/@e-mc/types@0.8.26/lib/core.d.ts
|
|
91
|
+
- https://www.unpkg.com/@e-mc/types@0.8.26/lib/document.d.ts
|
|
92
|
+
- https://www.unpkg.com/@e-mc/types@0.8.26/lib/filemanager.d.ts
|
|
93
|
+
- https://www.unpkg.com/@e-mc/types@0.8.26/lib/logger.d.ts
|
|
94
|
+
- https://www.unpkg.com/@e-mc/types@0.8.26/lib/settings.d.ts
|
|
95
|
+
- https://www.unpkg.com/@e-mc/types@0.8.26/lib/watch.d.ts
|
|
96
96
|
|
|
97
97
|
## LICENSE
|
|
98
98
|
|
package/index.js
CHANGED
|
@@ -702,7 +702,7 @@ class Document extends core_1.Client {
|
|
|
702
702
|
if (!(0, types_1.isPlainObject)(imports)) {
|
|
703
703
|
return;
|
|
704
704
|
}
|
|
705
|
-
const toPosix = (value) => value.replace(/(?:^\\|\\+)/g, '/');
|
|
705
|
+
const toPosix = (value) => PLATFORM_WIN32 ? value.trim().replace(/(?:^\\|\\+)/g, '/') : value;
|
|
706
706
|
const normalizeDir = (value, check) => {
|
|
707
707
|
const sep = !check && value.includes('\\') && !value.includes('/') ? '\\' : '/';
|
|
708
708
|
if (check) {
|
|
@@ -712,34 +712,33 @@ class Document extends core_1.Client {
|
|
|
712
712
|
};
|
|
713
713
|
const importsStrict = (_b = (_a = this.getUserSettings()) === null || _a === void 0 ? void 0 : _a.imports_strict) !== null && _b !== void 0 ? _b : this.settings.imports_strict;
|
|
714
714
|
const scopes = (importsStrict ? this.findSourceScope(uri, imports) : []).concat([imports]);
|
|
715
|
-
const
|
|
715
|
+
const protocol = core_1.Client.isURL(uri);
|
|
716
716
|
let result;
|
|
717
717
|
for (const scope of scopes) {
|
|
718
718
|
for (const url in scope) {
|
|
719
719
|
if (uri === url && (0, types_1.isString)(result = scope[url])) {
|
|
720
720
|
if (importsStrict) {
|
|
721
|
-
if (
|
|
722
|
-
|
|
721
|
+
if (core_1.Client.isPath(result) && !(protocol ? url : toPosix(url)).endsWith('/')) {
|
|
722
|
+
return toPosix(result);
|
|
723
723
|
}
|
|
724
|
-
|
|
724
|
+
continue;
|
|
725
725
|
}
|
|
726
726
|
return result;
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
729
|
}
|
|
730
|
-
const remote = toPosix(uri);
|
|
731
730
|
const found = [];
|
|
732
731
|
if (importsStrict) {
|
|
733
|
-
const
|
|
732
|
+
const remote = protocol ? uri : toPosix(uri);
|
|
734
733
|
for (const scope of scopes) {
|
|
735
734
|
for (const url in scope) {
|
|
736
735
|
const local = protocol ? url : toPosix(url);
|
|
737
|
-
if (
|
|
736
|
+
if (local.endsWith('/') && remote.startsWith(local) && (result = scope[url]) && result.endsWith('/')) {
|
|
738
737
|
if (protocol) {
|
|
739
738
|
found.push([url, result]);
|
|
740
739
|
}
|
|
741
740
|
else if (core_1.Client.isPath(result = path.join(result, remote.substring(local.length)))) {
|
|
742
|
-
return
|
|
741
|
+
return toPosix(result);
|
|
743
742
|
}
|
|
744
743
|
}
|
|
745
744
|
}
|
|
@@ -775,7 +774,7 @@ class Document extends core_1.Client {
|
|
|
775
774
|
result = toPath(found[0]);
|
|
776
775
|
}
|
|
777
776
|
if (result) {
|
|
778
|
-
return
|
|
777
|
+
return toPosix(result);
|
|
779
778
|
}
|
|
780
779
|
}
|
|
781
780
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/document",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.26",
|
|
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.26",
|
|
24
|
+
"@e-mc/db": "0.8.26",
|
|
25
|
+
"@e-mc/types": "0.8.26",
|
|
26
26
|
"chalk": "4.1.2",
|
|
27
27
|
"domhandler": "^5.0.3",
|
|
28
28
|
"domutils": "^3.1.0",
|
package/util.js
CHANGED
|
@@ -215,7 +215,7 @@ function hasValue(target, ...values) {
|
|
|
215
215
|
}
|
|
216
216
|
exports.hasValue = hasValue;
|
|
217
217
|
function getModuleName(err) {
|
|
218
|
-
const match = err instanceof Error && /Cannot find module '([^']+)'/.exec(err.message);
|
|
218
|
+
const match = err instanceof Error && /Cannot find (?:module|package) '([^']+)'/.exec(err.message);
|
|
219
219
|
if (match) {
|
|
220
220
|
return match[1];
|
|
221
221
|
}
|