@e-mc/document 0.10.11 → 0.10.12
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
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.12/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.12/lib/squared.d.ts
|
|
187
|
+
- https://www.unpkg.com/@e-mc/types@0.10.12/lib/asset.d.ts
|
|
188
|
+
- https://www.unpkg.com/@e-mc/types@0.10.12/lib/core.d.ts
|
|
189
|
+
- https://www.unpkg.com/@e-mc/types@0.10.12/lib/document.d.ts
|
|
190
|
+
- https://www.unpkg.com/@e-mc/types@0.10.12/lib/filemanager.d.ts
|
|
191
|
+
- https://www.unpkg.com/@e-mc/types@0.10.12/lib/logger.d.ts
|
|
192
|
+
- https://www.unpkg.com/@e-mc/types@0.10.12/lib/settings.d.ts
|
|
193
|
+
- https://www.unpkg.com/@e-mc/types@0.10.12/lib/watch.d.ts
|
|
194
194
|
|
|
195
195
|
## LICENSE
|
|
196
196
|
|
package/index.js
CHANGED
|
@@ -54,7 +54,7 @@ const fixHint = (warningCount, errorCount, value) => warningCount > 0 || errorCo
|
|
|
54
54
|
const compareValue = (value) => value.replace(/["'()]/g, '').trim();
|
|
55
55
|
const toPath = (uri, hostname) => path.resolve(hostname[1], uri.substring(normalizeDir(hostname[0]).length).split('?')[0]);
|
|
56
56
|
const toBase64 = (value) => 'data:application/json;base64,' + Buffer.from(value).toString('base64');
|
|
57
|
-
const toPosix = (value) => value.replace(/(?:^\\|\\+)/g, '/');
|
|
57
|
+
const toPosix = (value) => core_1.Client.PLATFORM_WIN32 ? value.trim().replace(/(?:^\\|\\+)/g, '/') : value;
|
|
58
58
|
const joinString = (name, ...values) => (name ? name + ': ' : '') + values.reduce((a, b) => b ? a + (a ? ' -> ' : '') + b : a, '');
|
|
59
59
|
const truncateString = (value, width) => value.length > width ? value.substring(0, width - 3) + '...' : value.padStart(width);
|
|
60
60
|
const spliceSource = (source, startIndex, endIndex, content) => source.substring(0, startIndex) + content + source.substring(endIndex);
|
|
@@ -909,34 +909,33 @@ class Document extends core_1.Client {
|
|
|
909
909
|
}
|
|
910
910
|
const importsStrict = this.getUserSettings()?.imports_strict ?? this.settings.imports_strict;
|
|
911
911
|
const scopes = (importsStrict ? this.findSourceScope(uri, imports) : []).concat([imports]);
|
|
912
|
-
const
|
|
912
|
+
const protocol = core_1.Client.isURL(uri);
|
|
913
913
|
let result;
|
|
914
914
|
for (const scope of scopes) {
|
|
915
915
|
for (const url in scope) {
|
|
916
916
|
if (uri === url && (0, types_1.isString)(result = scope[url])) {
|
|
917
917
|
if (importsStrict) {
|
|
918
|
-
if (
|
|
919
|
-
|
|
918
|
+
if (core_1.Client.isPath(result) && !(protocol ? url : toPosix(url)).endsWith('/')) {
|
|
919
|
+
return toPosix(result);
|
|
920
920
|
}
|
|
921
|
-
|
|
921
|
+
continue;
|
|
922
922
|
}
|
|
923
923
|
return result;
|
|
924
924
|
}
|
|
925
925
|
}
|
|
926
926
|
}
|
|
927
|
-
const remote = toPosix(uri);
|
|
928
927
|
const found = [];
|
|
929
928
|
if (importsStrict) {
|
|
930
|
-
const
|
|
929
|
+
const remote = protocol ? uri : toPosix(uri);
|
|
931
930
|
for (const scope of scopes) {
|
|
932
931
|
for (const url in scope) {
|
|
933
932
|
const local = protocol ? url : toPosix(url);
|
|
934
|
-
if (
|
|
933
|
+
if (local.endsWith('/') && remote.startsWith(local) && (result = scope[url]) && result.endsWith('/')) {
|
|
935
934
|
if (protocol) {
|
|
936
935
|
found.push([url, result]);
|
|
937
936
|
}
|
|
938
937
|
else if (core_1.Client.isPath(result = path.join(result, remote.substring(local.length)))) {
|
|
939
|
-
return
|
|
938
|
+
return toPosix(result);
|
|
940
939
|
}
|
|
941
940
|
}
|
|
942
941
|
}
|
|
@@ -971,7 +970,7 @@ class Document extends core_1.Client {
|
|
|
971
970
|
result = toPath(uri, found[0]);
|
|
972
971
|
}
|
|
973
972
|
if (result) {
|
|
974
|
-
return
|
|
973
|
+
return toPosix(result);
|
|
975
974
|
}
|
|
976
975
|
}
|
|
977
976
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/document",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.12",
|
|
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.12",
|
|
24
|
+
"@e-mc/db": "0.10.12",
|
|
25
|
+
"@e-mc/types": "0.10.12",
|
|
26
26
|
"chalk": "4.1.2",
|
|
27
27
|
"domhandler": "^5.0.3",
|
|
28
28
|
"domutils": "^3.1.0",
|
package/util.js
CHANGED
|
@@ -212,7 +212,7 @@ function hasValue(target, ...values) {
|
|
|
212
212
|
return false;
|
|
213
213
|
}
|
|
214
214
|
function getModuleName(err) {
|
|
215
|
-
const match = err instanceof Error && /Cannot find module '([^']+)'/.exec(err.message);
|
|
215
|
+
const match = err instanceof Error && /Cannot find (?:module|package) '([^']+)'/.exec(err.message);
|
|
216
216
|
if (match) {
|
|
217
217
|
return match[1];
|
|
218
218
|
}
|