@e-mc/document 0.0.4 → 0.2.0
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/android/template/kotlin/build.gradle.kts +1 -1
- package/index.js +4 -4
- package/package.json +4 -3
- package/transform/index.js +16 -5
- package/util.d.ts +1 -1
- package/util.js +22 -13
|
@@ -38,7 +38,7 @@ java {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
dependencies {
|
|
41
|
-
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.8.
|
|
41
|
+
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.8.10")
|
|
42
42
|
implementation("androidx.core:core-ktx:1.9.0")
|
|
43
43
|
testImplementation("junit:junit:4.13.2")
|
|
44
44
|
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
package/index.js
CHANGED
|
@@ -194,8 +194,8 @@ class Document extends core_1.Client {
|
|
|
194
194
|
catch {
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
static createSourceMap(code, uri) {
|
|
198
|
-
return new transform_1.SourceMap(code, uri);
|
|
197
|
+
static createSourceMap(code, uri, remove) {
|
|
198
|
+
return new transform_1.SourceMap(code, uri, remove);
|
|
199
199
|
}
|
|
200
200
|
static updateGradle(source, namespaces, value, options) {
|
|
201
201
|
const local = /^(\w+)\s*(=)?\s*(".+"|'.+'|\([\S\s]+\)||\[[\S\s]+\]|\S+)$/.exec(value = value.trim());
|
|
@@ -860,13 +860,13 @@ class Document extends core_1.Client {
|
|
|
860
860
|
}
|
|
861
861
|
const username = this.host?.username || '';
|
|
862
862
|
const cache = CACHE_TEMPLATE[name] || (CACHE_TEMPLATE[name] = {});
|
|
863
|
-
const cacheKey = username + core_1.Client.asHash(template + (compile ? core_1.Client.asString(compile) : '')
|
|
863
|
+
const cacheKey = username + core_1.Client.asHash(template + (compile ? core_1.Client.asString(compile) : ''));
|
|
864
864
|
let result = '', render, valid;
|
|
865
865
|
if (!(render = cache[cacheKey])) {
|
|
866
866
|
render = await context.compile(template, compile); // eslint-disable-line @typescript-eslint/await-thenable
|
|
867
867
|
cache[cacheKey] = render;
|
|
868
868
|
if (!core_1.Client.enabled("memory.settings.users" /* KEY_NAME.MEMORY_SETTINGS_USERS */, username)) {
|
|
869
|
-
setTimeout(() => delete cache[cacheKey], 60000 /* VALUES.
|
|
869
|
+
setTimeout(() => delete cache[cacheKey], 60000 /* VALUES.TEMPLATE_EXPIRES */);
|
|
870
870
|
}
|
|
871
871
|
}
|
|
872
872
|
for (let i = 0, j = 0, row; i < length; ++i) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/document",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Document constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,8 +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.0
|
|
24
|
-
"@e-mc/db": "0.0
|
|
23
|
+
"@e-mc/core": "0.2.0",
|
|
24
|
+
"@e-mc/db": "0.2.0",
|
|
25
|
+
"@e-mc/types": "0.2.0",
|
|
25
26
|
"chalk": "4.1.2",
|
|
26
27
|
"htmlparser2": "^8.0.1",
|
|
27
28
|
"js-yaml": "^4.1.0",
|
package/transform/index.js
CHANGED
|
@@ -248,16 +248,27 @@ class SourceMap {
|
|
|
248
248
|
static isRaw(map) {
|
|
249
249
|
return (0, types_1.isObject)(map) && (0, types_1.isString)(map.mappings);
|
|
250
250
|
}
|
|
251
|
-
constructor(code, uri) {
|
|
252
|
-
this.code = code;
|
|
251
|
+
constructor(code, uri, remove) {
|
|
253
252
|
this.output = new Map();
|
|
254
253
|
this.sourceMappingURL = '';
|
|
255
254
|
this[_d] = undefined;
|
|
256
|
-
|
|
257
|
-
|
|
255
|
+
if (typeof uri === 'boolean') {
|
|
256
|
+
remove = uri;
|
|
257
|
+
uri = undefined;
|
|
258
|
+
}
|
|
259
|
+
let map;
|
|
260
|
+
if (remove) {
|
|
261
|
+
const items = SourceMap.removeSourceMappingURL(code);
|
|
262
|
+
if (map = items[2]) {
|
|
263
|
+
code = items[0];
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
map || (map = SourceMap.findSourceMap(code, uri));
|
|
258
267
|
if (SourceMap.isRaw(map)) {
|
|
259
268
|
this.nextMap('unknown', code, map);
|
|
260
269
|
}
|
|
270
|
+
this[kCode] = code;
|
|
271
|
+
this.code = code;
|
|
261
272
|
}
|
|
262
273
|
reset(restore) {
|
|
263
274
|
if (restore) {
|
|
@@ -307,4 +318,4 @@ class SourceMap {
|
|
|
307
318
|
}
|
|
308
319
|
exports.SourceMap = SourceMap;
|
|
309
320
|
_d = kMap;
|
|
310
|
-
SourceMap.RE_SOURCE_MAPPING_URL =
|
|
321
|
+
SourceMap.RE_SOURCE_MAPPING_URL = /(?:\r\n|\n)*(?:(\/\/)|(\/\*))\s*[#@][ ]+sourceMappingURL=(data:[^,]+,)?(\S+)\s*(\*\/)?\r?\n?/g;
|
package/util.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ declare namespace util {
|
|
|
2
2
|
function loadPlugins<T = unknown>(name: string | unknown[], plugins?: unknown[]): T[];
|
|
3
3
|
function replaceAll(source: string, valueOf: (name: string) => string, opening?: string, closing?: string): string;
|
|
4
4
|
function concatString(values: string[] | string | undefined, newline?: string): string;
|
|
5
|
-
function splitEnclosing(value: string, pattern?: string | RegExp, trim?: boolean | number, opening?: string, closing?: string): string[];
|
|
5
|
+
function splitEnclosing(value: string, pattern?: string | RegExp, options?: { trim?: boolean, start?: number, startWith?: number, count?: number } | boolean | number, opening?: string, closing?: string): string[];
|
|
6
6
|
function appendSuffix(filename: string, value: string, separator?: string): string;
|
|
7
7
|
function getIndent(value: string, spaces?: number): string;
|
|
8
8
|
function getNewline(value: string): string;
|
package/util.js
CHANGED
|
@@ -38,7 +38,7 @@ function concatString(values, newline) {
|
|
|
38
38
|
return typeof values === 'string' ? values : '';
|
|
39
39
|
}
|
|
40
40
|
exports.concatString = concatString;
|
|
41
|
-
function splitEnclosing(value, pattern,
|
|
41
|
+
function splitEnclosing(value, pattern, options, opening = '(', closing = ')') {
|
|
42
42
|
pattern || (pattern = opening);
|
|
43
43
|
let position = 0, index = -1, end = 0, char;
|
|
44
44
|
if (typeof pattern === 'string') {
|
|
@@ -70,18 +70,27 @@ function splitEnclosing(value, pattern, trim, opening = '(', closing = ')') {
|
|
|
70
70
|
return -1;
|
|
71
71
|
};
|
|
72
72
|
complete: {
|
|
73
|
-
let j = 0,
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
let j = 0, count = 0, trim;
|
|
74
|
+
if (options !== undefined) {
|
|
75
|
+
switch (typeof options) {
|
|
76
|
+
case 'number':
|
|
77
|
+
count = options;
|
|
78
|
+
break;
|
|
79
|
+
case 'boolean':
|
|
80
|
+
trim = options;
|
|
81
|
+
break;
|
|
82
|
+
default: {
|
|
83
|
+
let start, startWith;
|
|
84
|
+
({ trim, start, startWith, count = 0 } = options);
|
|
85
|
+
if (startWith !== undefined) {
|
|
86
|
+
result.push(value.substring(0, position = startWith));
|
|
87
|
+
}
|
|
88
|
+
else if (start !== undefined) {
|
|
89
|
+
position = start;
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
83
93
|
}
|
|
84
|
-
trim = false;
|
|
85
94
|
}
|
|
86
95
|
while ((index = nextIndex()) !== -1) {
|
|
87
96
|
if (index !== position) {
|
|
@@ -106,7 +115,7 @@ function splitEnclosing(value, pattern, trim, opening = '(', closing = ')') {
|
|
|
106
115
|
if (position === length) {
|
|
107
116
|
return result;
|
|
108
117
|
}
|
|
109
|
-
if (++j ===
|
|
118
|
+
if (++j === count) {
|
|
110
119
|
break complete;
|
|
111
120
|
}
|
|
112
121
|
break found;
|