@pi-r/chrome 0.5.0 → 0.5.3
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/LICENSE +1 -1
- package/README.md +4 -2
- package/index.js +84 -80
- package/package.json +6 -6
- package/types/index.d.ts +7 -7
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright 2023
|
|
1
|
+
Copyright 2023 Haruhi Suzumiya
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
const path = require("path");
|
|
4
3
|
const fs = require("fs");
|
|
5
4
|
const asset_1 = require("@e-mc/document/asset");
|
|
@@ -17,31 +16,37 @@ const CACHE_SELECTOR = new Map();
|
|
|
17
16
|
const CACHE_DATASET = {};
|
|
18
17
|
const CACHE_ATRULES = {};
|
|
19
18
|
let CACHE_TOTAL = 0;
|
|
20
|
-
const REGEXP_SRCSETSIZE = /~\s*([\d.]+)\s*([wx])/i;
|
|
21
|
-
const REGEXP_TEMPLATECONDITIONAL = /(\n\s+)?\{\{if\s+((?:[^}]|}(?!}))+?)\}\}(\s*)([\S\s]*?)(?:\s*\{\{else(?:\s+if\s+((?:[^}]|}(?!}))+?))?\}\}(\s*)([\S\s]*?)\s*)?\s*\{\{end\}\}/g;
|
|
22
|
-
const REGEXP_TEMPLATECOMPARISON = /\s*\(\s*(?:(eq|ne|lt|le|gt|ge)\s+)?("[^"]+"|'[^']+'|[^\s)]+)(?:\s+("[^"]+"|'[^']+'|[^\s)]+))?\s*\)/g;
|
|
23
|
-
const REGEXP_TEMPLATEMATCH = new RegExp(`^(?:(and|or|not)\\s+)?((?:${REGEXP_TEMPLATECOMPARISON.source})+)|(!|not\\s+)?([^\\s][\\S\\s]*)$`);
|
|
24
|
-
const REGEXP_IMPORTMODULE = /(?:(?:^|[\n;]+)\s*import\s+(?:("(?:[^"]|(?<=\\)")+"|'(?:[^']|(?<=\\)')+')|.+?from\s+("(?:[^"]|(?<=\\)")+"|'(?:[^']|(?<=\\)')+')(?:[ \t]+assert[ \t]+\{((?:"(?:[^"]|(?<=\\)")+"|'(?:[^']|(?<=\\)')+'|`(?:[^`]|(?<=\\)`)+`|{[^{]*{|{[^}]*}|}[^}]*}|(?![{}])[^"'`])+)\})?)|\bimport\(\s*("(?:[^"]|(?<=\\)")+"|'(?:[^']|(?<=\\)')+')\s*(?:,\s*\{((?:"(?:[^"]|(?<=\\)")+"|'(?:[^']|(?<=\\)')+'|`(?:[^`]|(?<=\\)`)+`|{[^{]*{|{[^}]*}|}[^}]*}|(?![{}])[^"'`])+)\}\s*)?\))/g;
|
|
25
|
-
const REGEXP_BLOCKEXCLUDE = new RegExp(`(\\s*)<!--\\s*exclude\\s*:\\s*(?:start|end)\\s*-->` + dom_1.DomWriter.PATTERN_TRAILINGSPACE, 'gi');
|
|
26
19
|
const [PATTERN_STRING_SOME, PATTERN_STRING_MANY] = (function () {
|
|
27
20
|
const grouping = '(?:\\s|' + dom_1.DomWriter.PATTERN_COMMENT + '|`[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}`)';
|
|
28
21
|
return [grouping + '*', grouping + '+'];
|
|
29
22
|
})();
|
|
23
|
+
const [REGEXP_NTHCHILD, REGEXP_NTHCHILD_UNSAFE, REGEXP_REPLACECSS] = (function () {
|
|
24
|
+
const parenthesis = '(?:,[^()]+(?=\\))|[^()]|\\([^()]*\\(+|\\([^()]*\\)|(?:\\)[^()]+)?\\)*?)+';
|
|
25
|
+
return [
|
|
26
|
+
new RegExp(`\\(${PATTERN_STRING_SOME}([+-])?(?:(\\d*)[nN]|(0))?${PATTERN_STRING_SOME}([+-])?${PATTERN_STRING_SOME}(\\d*)(?:${PATTERN_STRING_MANY}[oO][fF]${PATTERN_STRING_MANY}(${parenthesis})${PATTERN_STRING_SOME}\\)|${PATTERN_STRING_SOME}\\))`, 'g'),
|
|
27
|
+
new RegExp(`\\(\\s*([+-])?(?:(\\d*)[nN]|(0))?\\s*([+-])?\\s*(\\d*)(?:\\s+[oO][fF]\\s+(${parenthesis})\\s*\\)|\\s*\\))`, 'g'),
|
|
28
|
+
new RegExp(`^@import\\s+(?:url\\((?:[^)]|(?<=\\\\)\\))+\\)|"(?:[^"]|(?<=\\\\)")+"|'(?:[^']|(?<=\\\\)')+')(\\s*layer(?:\\(([^)]*)\\)|\\b))?(?:\\s*supports\\((${parenthesis})\\))?(.*?);?$`)
|
|
29
|
+
];
|
|
30
|
+
})();
|
|
31
|
+
const REGEXP_SRCSETSIZE = /~\s*([\d.]+)\s*([wx])/i;
|
|
32
|
+
const REGEXP_TEMPLATECONDITIONAL = /(\n\s+)?\{\{if\s+((?:[^}]|}(?!}))+?)\}\}(\s*)([\S\s]*?)(?:\s*\{\{else(?:\s+if\s+((?:[^}]|}(?!}))+?))?\}\}(\s*)([\S\s]*?)\s*)?\s*\{\{end\}\}/g;
|
|
33
|
+
const REGEXP_TEMPLATECOMPARISON = /\s*\(\s*(?:\b(eq|ne|lt|le|gt|ge)\s+)?("[^"]+"|'[^']+'|[^\s)]+)(?:\s+("[^"]+"|'[^']+'|[^\s)]+))?\s*\)/g;
|
|
34
|
+
const REGEXP_TEMPLATEMATCH = new RegExp(`^(?:\\b(and|or|not)\\s+)?((?:${REGEXP_TEMPLATECOMPARISON.source})+)|(!|not\\s+)?([^\\s][\\S\\s]*)$`);
|
|
35
|
+
const REGEXP_IMPORTMODULE = /(?:(?:^|[\n;]+)\s*import\s+(?:("(?:[^"]|(?<=\\)")+"|'(?:[^']|(?<=\\)')+')|.+?from\s+("(?:[^"]|(?<=\\)")+"|'(?:[^']|(?<=\\)')+')(?:[ \t]+assert[ \t]+\{((?:"(?:[^"]|(?<=\\)")+"|'(?:[^']|(?<=\\)')+'|`(?:[^`]|(?<=\\)`)+`|{[^{]*{|{[^}]*}|}[^}]*}|[^"'`]+)+)\})?)|\bimport\(\s*("(?:[^"]|(?<=\\)")+"|'(?:[^']|(?<=\\)')+')\s*(?:,\s*\{((?:"(?:[^"]|(?<=\\)")+"|'(?:[^']|(?<=\\)')+'|`(?:[^`]|(?<=\\)`)+`|{[^{]*{|{[^}]*}|}[^}]*}|[^"'`]+)+)\}\s*)?\))/g;
|
|
36
|
+
const REGEXP_BLOCKEXCLUDE = new RegExp(`(\\s*)<!--\\s*exclude\\s*:\\s*(?:start|end)\\s*-->` + dom_1.DomWriter.PATTERN_TRAILINGSPACE, 'gi');
|
|
30
37
|
const REGEXP_COMMENT = new RegExp(dom_1.DomWriter.PATTERN_COMMENT, 'g');
|
|
31
|
-
const
|
|
38
|
+
const REGEXP_QUOTEDVALUE = new RegExp(`\\b(?:@import${PATTERN_STRING_MANY}|content${PATTERN_STRING_SOME}:${PATTERN_STRING_SOME})(?:"[^"]*"|'[^']*')`, 'gi');
|
|
32
39
|
const REGEXP_STYLE = new RegExp(`(<style${dom_1.DomWriter.PATTERN_TAGOPEN}*>)([\\S\\s]*?)(<\\/style\\s*>)`, 'gi');
|
|
33
40
|
const REGEXP_VARIABLES = new RegExp(`(\\s*)(--[^\\s:]*)${PATTERN_STRING_SOME}:[^;}]*([;}])` + dom_1.DomWriter.PATTERN_TRAILINGSPACE, 'g');
|
|
34
41
|
const REGEXP_FONTFACE = new RegExp(`(\\s*)@font-face${PATTERN_STRING_SOME}{([^}]+)}` + dom_1.DomWriter.PATTERN_TRAILINGSPACE, 'gi');
|
|
35
|
-
const REGEXP_FONTFAMILY = new RegExp(
|
|
42
|
+
const REGEXP_FONTFAMILY = new RegExp(`\\bfont-family${PATTERN_STRING_SOME}:([^;}]+)`, 'i');
|
|
36
43
|
const REGEXP_KEYFRAMES = new RegExp(`(\\s*)@keyframes${PATTERN_STRING_MANY}([^{]+){`, 'gi');
|
|
37
44
|
const REGEXP_PROPERTY = new RegExp(`(\\s*)@property${PATTERN_STRING_MANY}(--[^\\s]+)${PATTERN_STRING_SOME}{`, 'gi');
|
|
38
|
-
const REGEXP_NTHCHILD = new RegExp(`\\(${PATTERN_STRING_SOME}([+-])?(?:(\\d*)[nN]|(0))${PATTERN_STRING_SOME}([+-])?${PATTERN_STRING_SOME}(\\d*)${PATTERN_STRING_SOME}\\)`, 'g');
|
|
39
45
|
const REGEXP_VARIABLES_UNSAFE = new RegExp(`(\\s*)(--[^\\s:]*)\\s*:[^;}]*([;}])` + dom_1.DomWriter.PATTERN_TRAILINGSPACE, 'g');
|
|
40
46
|
const REGEXP_FONTFACE_UNSAFE = new RegExp(`(\\s*)@font-face\\s*{([^}]+)}` + dom_1.DomWriter.PATTERN_TRAILINGSPACE, 'gi');
|
|
41
|
-
const REGEXP_FONTFAMILY_UNSAFE =
|
|
47
|
+
const REGEXP_FONTFAMILY_UNSAFE = /\bfont-family\s*:([^;}]+)/i;
|
|
42
48
|
const REGEXP_KEYFRAMES_UNSAFE = /(\s*)@keyframes\s+([^{]+){/gi;
|
|
43
49
|
const REGEXP_PROPERTY_UNSAFE = /(\s*)@property\s+(--[^\s]+)\s*{/gi;
|
|
44
|
-
const REGEXP_NTHCHILD_UNSAFE = /\(\s*([+-])?(?:(\d*)[nN]|(0))\s*([+-])?\s*(\d*)\s*\)/g;
|
|
45
50
|
const REGEXP_OBJECT_NAME = /([^[.\s]+)((?:\s*\[[^\]]+\]\s*)+)?\s*\.?\s*/g;
|
|
46
51
|
const REGEXP_OBJECT_SUBSCRIPT = /\[\s*(["'])?(.+?)\1\s*\]/g;
|
|
47
52
|
const REGEXP_TEMPLATE_LEADING = /\s*\{\{- \s*((?:[^}]|}(?!}))+?)\}\}/g;
|
|
@@ -49,9 +54,8 @@ const REGEXP_TEMPLATE_TRAILING = /\{\{((?:[^}]|}(?!}))+?)\s*? -\}\}\s*/g;
|
|
|
49
54
|
const REGEXP_URL = /(?:\b[Uu][Rr][Ll]\(|@import\s+(["'])|\b([Hh][Rr][Ee][Ff])\s*=)/g;
|
|
50
55
|
const REGEXP_URL_JS = /\bimport\(/g;
|
|
51
56
|
const REGEXP_URL_SVG = /(?:\b[Uu][Rr][Ll]\(|@import\s+(["'])|\b([Hh][Rr][Ee][Ff])\s*=)/g;
|
|
52
|
-
const REGEXP_IMAGESET =
|
|
57
|
+
const REGEXP_IMAGESET = /\b(?:-webkit-)?image-set\(/gi;
|
|
53
58
|
const REGEXP_IMAGESET_URL = /(?:^|[^(])\s*("(\s*[^)][^"]*)"|'(\s*[^)][^"]*)')\s*(?:,|$|[^)][^,]*,?)/g;
|
|
54
|
-
const REGEXP_REPLACECSS = /^@import\s+(?:url\((?:[^)]|(?<=\\)\))+\)|"(?:[^"]|(?<=\\)")+"|'(?:[^']|(?<=\\)')+')(\s*layer(?:\(([^)]*)\)|\b))?(?:\s*supports\(((?:\([^(]+\(|\([^)]+\)|\)[^)]+\)|(?:(?!\))[^(])+|(?:(?!\()[^)])+)+)\))?(.*?);?$/;
|
|
55
59
|
function removeNamespace(name, source, newline, comments) {
|
|
56
60
|
if (source.indexOf('-' + name) !== -1) {
|
|
57
61
|
const [a, b, c, d, e] = CACHE_DATASET[name] || (CACHE_DATASET[name] = [
|
|
@@ -161,7 +165,7 @@ function addCacheItem(map, key, data, timeout) {
|
|
|
161
165
|
map.set(key, [
|
|
162
166
|
Date.now(),
|
|
163
167
|
data,
|
|
164
|
-
setTimeout(() => deleteCacheItem(map, key), timeout * 1000
|
|
168
|
+
setTimeout(() => deleteCacheItem(map, key), timeout * 1000)
|
|
165
169
|
]);
|
|
166
170
|
}
|
|
167
171
|
function deleteCacheItem(map, key) {
|
|
@@ -219,10 +223,10 @@ function hasCondition(data, condition) {
|
|
|
219
223
|
if (arg2) {
|
|
220
224
|
switch (item[0]) {
|
|
221
225
|
case 'eq':
|
|
222
|
-
valid = parseArg(arg1) == parseArg(arg2);
|
|
226
|
+
valid = parseArg(arg1) == parseArg(arg2);
|
|
223
227
|
break;
|
|
224
228
|
case 'ne':
|
|
225
|
-
valid = parseArg(arg1) != parseArg(arg2);
|
|
229
|
+
valid = parseArg(arg1) != parseArg(arg2);
|
|
226
230
|
break;
|
|
227
231
|
case 'lt':
|
|
228
232
|
valid = parseArg(arg1) < parseArg(arg2);
|
|
@@ -346,7 +350,7 @@ function createHash(host, file, hash, bufferMap) {
|
|
|
346
350
|
throw (0, types_1.errorMessage)('hash', 'Source not found', filename);
|
|
347
351
|
}
|
|
348
352
|
catch (err) {
|
|
349
|
-
host.writeFail(["Unable to read file"
|
|
353
|
+
host.writeFail(["Unable to read file", filename], err, 32);
|
|
350
354
|
}
|
|
351
355
|
}
|
|
352
356
|
function getSrcURL(parent, file) {
|
|
@@ -508,7 +512,7 @@ function transformURL(host, parent, type, source, importFile) {
|
|
|
508
512
|
}
|
|
509
513
|
}
|
|
510
514
|
if (asset.initialValue && !asset.initialValue.cacheable) {
|
|
511
|
-
parent.flags |= 16
|
|
515
|
+
parent.flags |= 16;
|
|
512
516
|
}
|
|
513
517
|
related.push(asset);
|
|
514
518
|
}
|
|
@@ -604,7 +608,7 @@ function transformURL(host, parent, type, source, importFile) {
|
|
|
604
608
|
else {
|
|
605
609
|
related.push(asset);
|
|
606
610
|
if (!(0, types_1.existsFlag)(asset.flags)) {
|
|
607
|
-
asset.flags |= 8
|
|
611
|
+
asset.flags |= 8;
|
|
608
612
|
}
|
|
609
613
|
}
|
|
610
614
|
modified = true;
|
|
@@ -764,12 +768,12 @@ function transformJs(host, file, output) {
|
|
|
764
768
|
});
|
|
765
769
|
}
|
|
766
770
|
else {
|
|
767
|
-
this.writeFail(['Unable to create script entry point', path.basename(chunkUri)], (0, types_1.errorMessage)('js', 'Element not found', chunkUri), 4
|
|
771
|
+
this.writeFail(['Unable to create script entry point', path.basename(chunkUri)], (0, types_1.errorMessage)('js', 'Element not found', chunkUri), 4);
|
|
768
772
|
}
|
|
769
773
|
}
|
|
770
774
|
}
|
|
771
775
|
catch (err) {
|
|
772
|
-
this.writeFail(["Unable to write file"
|
|
776
|
+
this.writeFail(["Unable to write file", path.basename(chunkUri)], err, 32);
|
|
773
777
|
}
|
|
774
778
|
}
|
|
775
779
|
appending?.forEach(item => item.order += order);
|
|
@@ -857,19 +861,18 @@ async function checkData(item, name, result, validate) {
|
|
|
857
861
|
if (typeof callback === 'function') {
|
|
858
862
|
try {
|
|
859
863
|
let output;
|
|
860
|
-
|
|
861
|
-
if (callback["__cjs__" /* INTERNAL.CJS */]) {
|
|
864
|
+
if (callback["__cjs__"]) {
|
|
862
865
|
output = await callback(result, item);
|
|
863
866
|
}
|
|
864
867
|
else {
|
|
865
|
-
output = await callback.apply(Document.enabled("node.process.inline"
|
|
868
|
+
output = await callback.apply(Document.enabled("node.process.inline") ? process : null, Document.enabled("node.require.inline") ? [result, item, require] : [result, item]);
|
|
866
869
|
}
|
|
867
870
|
if (validate(output)) {
|
|
868
871
|
return output;
|
|
869
872
|
}
|
|
870
873
|
}
|
|
871
874
|
catch (err) {
|
|
872
|
-
this.writeFail(["Unable to parse inline method"
|
|
875
|
+
this.writeFail(["Unable to parse inline method", name], err);
|
|
873
876
|
}
|
|
874
877
|
}
|
|
875
878
|
}
|
|
@@ -897,7 +900,6 @@ const getEndIndex = (match) => match.index + match[0].length;
|
|
|
897
900
|
const getRelativeURL = (file) => joinPath(file.moveTo, file.pathname, file.inlineFilename || file.filename) + (!file.static ? restoreSearchParams(file.url?.search) : '');
|
|
898
901
|
const errorHtml = ({ tagName, tagIndex = -1 }) => (0, types_1.errorMessage)('html', 'Location did not resolve', tagName.toLowerCase() + (tagIndex >= 0 ? ': ' + tagIndex : ''));
|
|
899
902
|
const errorDataSource = (value, hint) => (0, types_1.errorMessage)('data-source', value, hint);
|
|
900
|
-
// @ts-ignore
|
|
901
903
|
class ChromeDocument extends Document {
|
|
902
904
|
constructor() {
|
|
903
905
|
super(...arguments);
|
|
@@ -981,7 +983,7 @@ class ChromeDocument extends Document {
|
|
|
981
983
|
const { Db: db, htmlFile, assets } = instance;
|
|
982
984
|
const outHtml = htmlFile && !isIgnored(htmlFile, true);
|
|
983
985
|
if (db && await db.commit()) {
|
|
984
|
-
db.writeTimeElapsed('DB', ["Transactions were committed"
|
|
986
|
+
db.writeTimeElapsed('DB', ["Transactions were committed", db.moduleName], processing.startTime, { ...Document.LOG_STYLE_SUCCESS, type: 65536 });
|
|
985
987
|
}
|
|
986
988
|
if (instance.dataSource.length === 0 && outHtml) {
|
|
987
989
|
const incremental = htmlFile.incremental ?? this.incremental;
|
|
@@ -1024,7 +1026,7 @@ class ChromeDocument extends Document {
|
|
|
1024
1026
|
}
|
|
1025
1027
|
case 'exists':
|
|
1026
1028
|
if (hint || isHtmlOnly()) {
|
|
1027
|
-
this.formatMessage(4
|
|
1029
|
+
this.formatMessage(4, 'HTML', ['No changes detected', 'incremental: ' + incremental], hint, { ...Document.LOG_STYLE_NOTICE, messageBgColor: 'bgWhite', messageColor: 'black' });
|
|
1028
1030
|
return super.finalize.call(this, instance);
|
|
1029
1031
|
}
|
|
1030
1032
|
break;
|
|
@@ -1064,7 +1066,7 @@ class ChromeDocument extends Document {
|
|
|
1064
1066
|
for (const item of children) {
|
|
1065
1067
|
if (!items.has(item)) {
|
|
1066
1068
|
if (isWatched.call(instance, item)) {
|
|
1067
|
-
item.flags |= 8
|
|
1069
|
+
item.flags |= 8;
|
|
1068
1070
|
}
|
|
1069
1071
|
items.add(item);
|
|
1070
1072
|
const next = related.get(item);
|
|
@@ -1095,18 +1097,18 @@ class ChromeDocument extends Document {
|
|
|
1095
1097
|
this.delete(value);
|
|
1096
1098
|
}
|
|
1097
1099
|
else {
|
|
1098
|
-
instance.writeFail(["Unable to move file"
|
|
1100
|
+
instance.writeFail(["Unable to move file", instance.moduleName], (0, types_1.errorMessage)('production', path.join(this.baseDirectory, value)), { fatal: true });
|
|
1099
1101
|
}
|
|
1100
1102
|
}
|
|
1101
1103
|
}
|
|
1102
1104
|
}
|
|
1103
1105
|
}
|
|
1104
1106
|
else {
|
|
1105
|
-
instance.writeFail(["Unable to write directory"
|
|
1107
|
+
instance.writeFail(["Unable to write directory", instance.moduleName], (0, types_1.errorMessage)('production', 'Access denied', productionRelease));
|
|
1106
1108
|
}
|
|
1107
1109
|
}
|
|
1108
1110
|
else {
|
|
1109
|
-
instance.writeFail(["Unable to read directory"
|
|
1111
|
+
instance.writeFail(["Unable to read directory", instance.moduleName], (0, types_1.errorMessage)('production', 'Invalid directory', productionRelease), 32);
|
|
1110
1112
|
}
|
|
1111
1113
|
}
|
|
1112
1114
|
static sanitizeAssets(assets, exclusions = []) {
|
|
@@ -1426,7 +1428,7 @@ class ChromeDocument extends Document {
|
|
|
1426
1428
|
await instance.tryFile(buffer, { format: to, filename: file.filename, etag: file.etag }, (err, result, ext) => {
|
|
1427
1429
|
if (err) {
|
|
1428
1430
|
setFormat();
|
|
1429
|
-
this.writeFail("Unable to compress file"
|
|
1431
|
+
this.writeFail("Unable to compress file", err, 8);
|
|
1430
1432
|
}
|
|
1431
1433
|
else if (result) {
|
|
1432
1434
|
if (ext) {
|
|
@@ -1440,7 +1442,7 @@ class ChromeDocument extends Document {
|
|
|
1440
1442
|
host.replace(file, output);
|
|
1441
1443
|
}
|
|
1442
1444
|
else {
|
|
1443
|
-
this.writeFail("Unable to write file"
|
|
1445
|
+
this.writeFail("Unable to write file", error, 32);
|
|
1444
1446
|
}
|
|
1445
1447
|
});
|
|
1446
1448
|
}
|
|
@@ -1598,12 +1600,14 @@ class ChromeDocument extends Document {
|
|
|
1598
1600
|
}
|
|
1599
1601
|
for (const placeholder in importMap) {
|
|
1600
1602
|
const items = importMap[placeholder];
|
|
1603
|
+
let found;
|
|
1601
1604
|
for (let i = 0, length = items.length; i < length; ++i) {
|
|
1602
1605
|
const index = code.indexOf(placeholder);
|
|
1603
1606
|
if (index !== -1) {
|
|
1604
1607
|
const { uri, original, type, dynamic } = items[i];
|
|
1608
|
+
const hosted = type === 'css';
|
|
1605
1609
|
let value;
|
|
1606
|
-
if (
|
|
1610
|
+
if (hosted) {
|
|
1607
1611
|
const asset = this.host?.findAsset(uri);
|
|
1608
1612
|
if (asset) {
|
|
1609
1613
|
const [relativeUrl, sameDir] = getSrcURL.call(this, bundleMain || file, asset);
|
|
@@ -1615,11 +1619,12 @@ class ChromeDocument extends Document {
|
|
|
1615
1619
|
else if (!(dynamic && file.imported !== false)) {
|
|
1616
1620
|
value = this.findSourceRoot(uri);
|
|
1617
1621
|
}
|
|
1618
|
-
if (!value) {
|
|
1622
|
+
if (!value || !hosted && !Document.isPath(value)) {
|
|
1619
1623
|
if (i < length - 1) {
|
|
1624
|
+
found || (found = value);
|
|
1620
1625
|
continue;
|
|
1621
1626
|
}
|
|
1622
|
-
value = original;
|
|
1627
|
+
value = found || original;
|
|
1623
1628
|
}
|
|
1624
1629
|
code = spliceString(code, index, index + placeholder.length, value);
|
|
1625
1630
|
modified = true;
|
|
@@ -1641,7 +1646,7 @@ class ChromeDocument extends Document {
|
|
|
1641
1646
|
const query = match[4].trim();
|
|
1642
1647
|
if (layer || supports || query) {
|
|
1643
1648
|
const newline = (0, util_1.getNewline)(source);
|
|
1644
|
-
let result = supports ? `@supports (${
|
|
1649
|
+
let result = supports ? `@supports (${supports}) {` + newline : '';
|
|
1645
1650
|
if (query) {
|
|
1646
1651
|
result += `@media ${query} {` + newline;
|
|
1647
1652
|
}
|
|
@@ -1750,7 +1755,7 @@ class ChromeDocument extends Document {
|
|
|
1750
1755
|
item.sourceUTF8 = output;
|
|
1751
1756
|
}
|
|
1752
1757
|
catch (err) {
|
|
1753
|
-
host.writeFail(["Unable to write file"
|
|
1758
|
+
host.writeFail(["Unable to write file", path.basename(item.localUri)], err, 32);
|
|
1754
1759
|
}
|
|
1755
1760
|
}
|
|
1756
1761
|
}
|
|
@@ -1952,7 +1957,7 @@ class ChromeDocument extends Document {
|
|
|
1952
1957
|
host.removeAsset(item);
|
|
1953
1958
|
}
|
|
1954
1959
|
catch (err) {
|
|
1955
|
-
this.writeFail(["Unable to read file"
|
|
1960
|
+
this.writeFail(["Unable to read file", item.filename], err, { type: 32, startTime });
|
|
1956
1961
|
return false;
|
|
1957
1962
|
}
|
|
1958
1963
|
}
|
|
@@ -2135,7 +2140,7 @@ class ChromeDocument extends Document {
|
|
|
2135
2140
|
const { moduleName, config } = this;
|
|
2136
2141
|
const htmlFile = this.htmlFile;
|
|
2137
2142
|
const localUri = htmlFile.localUri;
|
|
2138
|
-
this.formatMessage(4
|
|
2143
|
+
this.formatMessage(4, 'HTML', ['Rewriting content...', path.dirname(localUri)]);
|
|
2139
2144
|
let source = host.getUTF8String(htmlFile, localUri), output;
|
|
2140
2145
|
const domBase = new dom_1.DomWriter(moduleName, source, this.elements, { normalize: config.normalizeHtmlOutput, stripComments: config.stripCommentsAndCDATA, ignoreTagGroup: config.ignoreServerCodeBlocks, escapeEntities: config.escapeReservedCharacters });
|
|
2141
2146
|
if (config.useUnsafeHtmlReplace) {
|
|
@@ -2161,7 +2166,7 @@ class ChromeDocument extends Document {
|
|
|
2161
2166
|
const domElement = new dom_1.HtmlElement(moduleName, element, item.attributes);
|
|
2162
2167
|
domElement.remove = true;
|
|
2163
2168
|
if (!domBase.write(domElement)) {
|
|
2164
|
-
this.writeFail('Unable to exclude HTML element', errorHtml(element), 4
|
|
2169
|
+
this.writeFail('Unable to exclude HTML element', errorHtml(element), 4);
|
|
2165
2170
|
}
|
|
2166
2171
|
}
|
|
2167
2172
|
}
|
|
@@ -2201,7 +2206,7 @@ class ChromeDocument extends Document {
|
|
|
2201
2206
|
domBase.errors.forEach(err => this.addLog(types_1.STATUS_TYPE.WARN, 'dom-writer -> ' + err.message, timeStamp));
|
|
2202
2207
|
}
|
|
2203
2208
|
if (domBase.failCount > 0) {
|
|
2204
|
-
this.writeFail(['Unable to update document', moduleName], (0, types_1.errorMessage)('html', 'DOM rewrite failed', domBase.failCount + ' errors'), { type: 4
|
|
2209
|
+
this.writeFail(['Unable to update document', moduleName], (0, types_1.errorMessage)('html', 'DOM rewrite failed', domBase.failCount + ' errors'), { type: 4, startTime });
|
|
2205
2210
|
}
|
|
2206
2211
|
else {
|
|
2207
2212
|
this.writeTimeProcess('html', `dom-writer (${domBase.modifyCount} modified) -> ` + path.basename(localUri), startTime);
|
|
@@ -2212,7 +2217,7 @@ class ChromeDocument extends Document {
|
|
|
2212
2217
|
for (const name in data) {
|
|
2213
2218
|
message.push(name + `(${data[name]})`);
|
|
2214
2219
|
}
|
|
2215
|
-
this.formatMessage(65536
|
|
2220
|
+
this.formatMessage(65536, 'DB', ['Cache statistics', cacheMiss.length + ' missed'], message.join(' - '), { ...Document.LOG_STYLE_NOTICE, hintBold: true });
|
|
2216
2221
|
}
|
|
2217
2222
|
}
|
|
2218
2223
|
htmlFile.modified = true;
|
|
@@ -2328,7 +2333,7 @@ class ChromeDocument extends Document {
|
|
|
2328
2333
|
}
|
|
2329
2334
|
}
|
|
2330
2335
|
if (!domBase.write(domElement)) {
|
|
2331
|
-
this.writeFail(inlineContent ? 'Inline tag replacement' : 'Element attribute replacement', errorHtml(element), { type: 4
|
|
2336
|
+
this.writeFail(inlineContent ? 'Inline tag replacement' : 'Element attribute replacement', errorHtml(element), { type: 4, startTime });
|
|
2332
2337
|
delete item.inlineUrlCloud;
|
|
2333
2338
|
}
|
|
2334
2339
|
else if (inlineContent) {
|
|
@@ -2352,7 +2357,7 @@ class ChromeDocument extends Document {
|
|
|
2352
2357
|
if (item.removeEmpty || item.type === 'display') {
|
|
2353
2358
|
(element || (element = new dom_1.HtmlElement(moduleName, item.element))).remove = true;
|
|
2354
2359
|
if (!domBase.write(element)) {
|
|
2355
|
-
this.writeFail('Unable to remove element', errorHtml(item.element), { type: 4
|
|
2360
|
+
this.writeFail('Unable to remove element', errorHtml(item.element), { type: 4, startTime });
|
|
2356
2361
|
}
|
|
2357
2362
|
}
|
|
2358
2363
|
};
|
|
@@ -2360,7 +2365,7 @@ class ChromeDocument extends Document {
|
|
|
2360
2365
|
removeElement(item);
|
|
2361
2366
|
const pkg = getPackageName(err);
|
|
2362
2367
|
if (!(pkg && this.checkPackage(err, pkg))) {
|
|
2363
|
-
this.writeFail(["Invalid credentials"
|
|
2368
|
+
this.writeFail(["Invalid credentials", item.source], err);
|
|
2364
2369
|
}
|
|
2365
2370
|
};
|
|
2366
2371
|
const checkObject = (item, data) => {
|
|
@@ -2390,7 +2395,7 @@ class ChromeDocument extends Document {
|
|
|
2390
2395
|
}
|
|
2391
2396
|
catch (err) {
|
|
2392
2397
|
this.abort(item.source);
|
|
2393
|
-
this.checkPackage(err, pkg, ["Unable to filter results"
|
|
2398
|
+
this.checkPackage(err, pkg, ["Unable to filter results", item.source]);
|
|
2394
2399
|
}
|
|
2395
2400
|
}
|
|
2396
2401
|
}
|
|
@@ -2413,7 +2418,7 @@ class ChromeDocument extends Document {
|
|
|
2413
2418
|
(batchMap[key] || (batchMap[key] = [])).push(item);
|
|
2414
2419
|
}
|
|
2415
2420
|
else {
|
|
2416
|
-
errorCredential(item, (0, types_1.errorValue)("Cloud module not installed"
|
|
2421
|
+
errorCredential(item, (0, types_1.errorValue)("Cloud module not installed", service));
|
|
2417
2422
|
}
|
|
2418
2423
|
break;
|
|
2419
2424
|
}
|
|
@@ -2446,7 +2451,7 @@ class ChromeDocument extends Document {
|
|
|
2446
2451
|
}
|
|
2447
2452
|
}
|
|
2448
2453
|
else {
|
|
2449
|
-
errorCredential(item, (0, types_1.errorValue)(db ? "Database provider not found"
|
|
2454
|
+
errorCredential(item, (0, types_1.errorValue)(db ? "Database provider not found" : "Db module not installed", type));
|
|
2450
2455
|
}
|
|
2451
2456
|
break;
|
|
2452
2457
|
}
|
|
@@ -2463,7 +2468,7 @@ class ChromeDocument extends Document {
|
|
|
2463
2468
|
const errorClient = (item, reason) => {
|
|
2464
2469
|
removeElement(item);
|
|
2465
2470
|
if (reason) {
|
|
2466
|
-
this.writeFail(["Unable to configure client"
|
|
2471
|
+
this.writeFail(["Unable to configure client", item.source], reason);
|
|
2467
2472
|
}
|
|
2468
2473
|
reject();
|
|
2469
2474
|
};
|
|
@@ -2505,7 +2510,7 @@ class ChromeDocument extends Document {
|
|
|
2505
2510
|
}
|
|
2506
2511
|
catch (err) {
|
|
2507
2512
|
this.abort(type);
|
|
2508
|
-
this.writeFail(["Unable to read file"
|
|
2513
|
+
this.writeFail(["Unable to read file", path.basename(location)], err, { type: 32, startTime });
|
|
2509
2514
|
errorRemove(current);
|
|
2510
2515
|
return;
|
|
2511
2516
|
}
|
|
@@ -2541,7 +2546,7 @@ class ChromeDocument extends Document {
|
|
|
2541
2546
|
}
|
|
2542
2547
|
catch (err) {
|
|
2543
2548
|
this.abort(type);
|
|
2544
|
-
this.writeFail(["Unable to download file"
|
|
2549
|
+
this.writeFail(["Unable to download file", target], err, { type: 1024, startTime });
|
|
2545
2550
|
errorRemove(current);
|
|
2546
2551
|
return;
|
|
2547
2552
|
}
|
|
@@ -2570,7 +2575,7 @@ class ChromeDocument extends Document {
|
|
|
2570
2575
|
}
|
|
2571
2576
|
catch (err) {
|
|
2572
2577
|
this.abort(type);
|
|
2573
|
-
this.writeFail(["Unable to read file"
|
|
2578
|
+
this.writeFail(["Unable to read file", path.basename(pathname)], err, { type: 32, startTime });
|
|
2574
2579
|
errorRemove(current);
|
|
2575
2580
|
return;
|
|
2576
2581
|
}
|
|
@@ -2584,7 +2589,7 @@ class ChromeDocument extends Document {
|
|
|
2584
2589
|
}
|
|
2585
2590
|
catch (err) {
|
|
2586
2591
|
this.abort(type);
|
|
2587
|
-
this.writeFail(['Unable to parse data source', format], err, { type: 4
|
|
2592
|
+
this.writeFail(['Unable to parse data source', format], err, { type: 4, startTime });
|
|
2588
2593
|
errorRemove(current);
|
|
2589
2594
|
return;
|
|
2590
2595
|
}
|
|
@@ -2660,13 +2665,12 @@ class ChromeDocument extends Document {
|
|
|
2660
2665
|
if (params && this.settingsOf(type, 'coerce') === true) {
|
|
2661
2666
|
(0, types_1.coerceObject)(params);
|
|
2662
2667
|
}
|
|
2663
|
-
|
|
2664
|
-
if (getData["__cjs__" /* INTERNAL.CJS */]) {
|
|
2668
|
+
if (getData["__cjs__"]) {
|
|
2665
2669
|
data = await getData(params);
|
|
2666
2670
|
}
|
|
2667
2671
|
else {
|
|
2668
|
-
const thisArg = Document.enabled("node.process.inline"
|
|
2669
|
-
const inline = Document.enabled("node.require.inline"
|
|
2672
|
+
const thisArg = Document.enabled("node.process.inline") ? process : null;
|
|
2673
|
+
const inline = Document.enabled("node.require.inline");
|
|
2670
2674
|
const args = [params];
|
|
2671
2675
|
if (getData.toString().startsWith('async')) {
|
|
2672
2676
|
if (inline) {
|
|
@@ -2688,7 +2692,7 @@ class ChromeDocument extends Document {
|
|
|
2688
2692
|
}
|
|
2689
2693
|
catch (err) {
|
|
2690
2694
|
this.abort(type);
|
|
2691
|
-
this.writeFail(['Unable to retrieve data source', hint], err, { type: 4
|
|
2695
|
+
this.writeFail(['Unable to retrieve data source', hint], err, { type: 4, startTime });
|
|
2692
2696
|
errorRemove(current);
|
|
2693
2697
|
return;
|
|
2694
2698
|
}
|
|
@@ -2774,12 +2778,12 @@ class ChromeDocument extends Document {
|
|
|
2774
2778
|
}
|
|
2775
2779
|
}
|
|
2776
2780
|
else {
|
|
2777
|
-
throw (0, types_1.errorMessage)(type, "File not found"
|
|
2781
|
+
throw (0, types_1.errorMessage)(type, "File not found", query);
|
|
2778
2782
|
}
|
|
2779
2783
|
}
|
|
2780
2784
|
catch (err) {
|
|
2781
2785
|
this.abort(type);
|
|
2782
|
-
this.writeFail(["Unable to read file"
|
|
2786
|
+
this.writeFail(["Unable to read file", pathname ? path.basename(pathname) : query], err, { startTime });
|
|
2783
2787
|
errorRemove(current);
|
|
2784
2788
|
return;
|
|
2785
2789
|
}
|
|
@@ -2816,7 +2820,7 @@ class ChromeDocument extends Document {
|
|
|
2816
2820
|
this.abort(type);
|
|
2817
2821
|
}
|
|
2818
2822
|
if (err) {
|
|
2819
|
-
this.writeFail(["Unable to execute query"
|
|
2823
|
+
this.writeFail(["Unable to execute query", message || "Unknown"], err instanceof Error ? errors = err : err, { type: 65536, startTime });
|
|
2820
2824
|
}
|
|
2821
2825
|
return this.aborted;
|
|
2822
2826
|
};
|
|
@@ -2830,7 +2834,7 @@ class ChromeDocument extends Document {
|
|
|
2830
2834
|
}
|
|
2831
2835
|
break;
|
|
2832
2836
|
}
|
|
2833
|
-
errorRemove(current, errorDataSource('Not found', type || "Unknown"
|
|
2837
|
+
errorRemove(current, errorDataSource('Not found', type || "Unknown"));
|
|
2834
2838
|
return;
|
|
2835
2839
|
}
|
|
2836
2840
|
if (this.aborted) {
|
|
@@ -2894,7 +2898,7 @@ class ChromeDocument extends Document {
|
|
|
2894
2898
|
setCacheData.call(this, item, item.value, pathname, cacheData, true);
|
|
2895
2899
|
}
|
|
2896
2900
|
catch (err) {
|
|
2897
|
-
this.writeFail(["Unable to read file"
|
|
2901
|
+
this.writeFail(["Unable to read file", path.basename(pathname)], err, { type: 32, startTime });
|
|
2898
2902
|
errors = true;
|
|
2899
2903
|
}
|
|
2900
2904
|
}
|
|
@@ -2937,7 +2941,7 @@ class ChromeDocument extends Document {
|
|
|
2937
2941
|
const literal = segment.trim();
|
|
2938
2942
|
if (literal[0] === '`' && literal[literal.length - 1] === '`') {
|
|
2939
2943
|
if (!this.hasEval('function')) {
|
|
2940
|
-
errors = (0, types_1.errorMessage)('eval', "Unsupported access"
|
|
2944
|
+
errors = (0, types_1.errorMessage)('eval', "Unsupported access", 'function');
|
|
2941
2945
|
continue;
|
|
2942
2946
|
}
|
|
2943
2947
|
try {
|
|
@@ -2958,7 +2962,7 @@ class ChromeDocument extends Document {
|
|
|
2958
2962
|
else {
|
|
2959
2963
|
const pattern = /\$\{\s*([^\s}]+)\s*\}/g;
|
|
2960
2964
|
while (match = pattern.exec(segment)) {
|
|
2961
|
-
segment = replaceMatch(match, segment, match[1] === "__index__"
|
|
2965
|
+
segment = replaceMatch(match, segment, match[1] === "__index__" && !(0, types_1.isObject)(row) ? (j + 1).toString() : valueAsString(getObjectValue(row, match[1]), ', '), pattern);
|
|
2962
2966
|
}
|
|
2963
2967
|
}
|
|
2964
2968
|
value += trimTemplate(segment);
|
|
@@ -3153,37 +3157,37 @@ class ChromeDocument extends Document {
|
|
|
3153
3157
|
default:
|
|
3154
3158
|
removeElement(item, domElement);
|
|
3155
3159
|
if (length === 1) {
|
|
3156
|
-
reject(errorDataSource('Invalid action', item.type || "Unknown"
|
|
3160
|
+
reject(errorDataSource('Invalid action', item.type || "Unknown"));
|
|
3157
3161
|
return;
|
|
3158
3162
|
}
|
|
3159
3163
|
break invalid;
|
|
3160
3164
|
}
|
|
3161
3165
|
if (!domBase.write(domElement) || errors) {
|
|
3162
|
-
this.writeFail(item.type === 'display' ? domElement.remove ? errors ? 'Element was removed with errors' : 'Unable to remove element' : 'Unable to determine display conditional' : 'Unable to replace ' + item.type, errors instanceof Error ? errors : errorHtml(element), { type: 4
|
|
3166
|
+
this.writeFail(item.type === 'display' ? domElement.remove ? errors ? 'Element was removed with errors' : 'Unable to remove element' : 'Unable to determine display conditional' : 'Unable to replace ' + item.type, errors instanceof Error ? errors : errorHtml(element), { type: 4, startTime });
|
|
3163
3167
|
}
|
|
3164
3168
|
}
|
|
3165
3169
|
}
|
|
3166
3170
|
else {
|
|
3167
3171
|
if (!empty && item.type !== 'display' || item.transactionFail) {
|
|
3168
3172
|
const emptyResponse = (value, service = item.source) => {
|
|
3169
|
-
value || (value = "Unknown"
|
|
3173
|
+
value || (value = "Unknown");
|
|
3170
3174
|
return errors instanceof Error ? (0, types_1.errorMessage)(service, value, errors.message) : errorDataSource(service + ' -> Empty', value);
|
|
3171
3175
|
};
|
|
3172
3176
|
switch (item.source) {
|
|
3173
3177
|
case 'cloud': {
|
|
3174
3178
|
const { service, table, id, query } = item;
|
|
3175
3179
|
const queryString = (table ? 'table=' + table : '') + (id || query ? (table ? ';' : '') + (id ? 'id=' + id : 'query=' + asString(query)) : '');
|
|
3176
|
-
(cloud || this).formatFail(64
|
|
3180
|
+
(cloud || this).formatFail(64, service, ["Unable to execute query", queryString], emptyResponse(queryString, service), { ...Cloud.LOG_CLOUD_FAIL, startTime });
|
|
3177
3181
|
break;
|
|
3178
3182
|
}
|
|
3179
3183
|
case 'uri': {
|
|
3180
3184
|
const { uri, format = uri && path.extname(uri).substring(1) } = item;
|
|
3181
|
-
this.formatFail(4
|
|
3185
|
+
this.formatFail(4, format || 'URI', ['No records were found', uri], emptyResponse(uri), { startTime });
|
|
3182
3186
|
break;
|
|
3183
3187
|
}
|
|
3184
3188
|
case 'local': {
|
|
3185
3189
|
const { pathname, format = pathname && path.extname(pathname).substring(1) } = item;
|
|
3186
|
-
this.formatFail(4
|
|
3190
|
+
this.formatFail(4, format || 'LOCAL', ['No records were found', pathname], emptyResponse(pathname), { startTime });
|
|
3187
3191
|
break;
|
|
3188
3192
|
}
|
|
3189
3193
|
case 'export': {
|
|
@@ -3192,7 +3196,7 @@ class ChromeDocument extends Document {
|
|
|
3192
3196
|
if (typeof target === 'function') {
|
|
3193
3197
|
target = target.name;
|
|
3194
3198
|
}
|
|
3195
|
-
this.formatFail(4
|
|
3199
|
+
this.formatFail(4, 'EXPORT', ['No records were retrieved', target], emptyResponse(target), { startTime });
|
|
3196
3200
|
break;
|
|
3197
3201
|
}
|
|
3198
3202
|
}
|
|
@@ -3244,7 +3248,7 @@ class ChromeDocument extends Document {
|
|
|
3244
3248
|
throw (0, types_1.errorMessage)('hash', 'Source not found', item.filename);
|
|
3245
3249
|
}
|
|
3246
3250
|
catch (err) {
|
|
3247
|
-
this.writeFail(["Unable to read file"
|
|
3251
|
+
this.writeFail(["Unable to read file", item.filename], err, { type: 32, startTime });
|
|
3248
3252
|
}
|
|
3249
3253
|
default:
|
|
3250
3254
|
if (algorithm) {
|
|
@@ -3272,7 +3276,7 @@ class ChromeDocument extends Document {
|
|
|
3272
3276
|
const parseSelector = (value) => {
|
|
3273
3277
|
const items = [];
|
|
3274
3278
|
const revised = value.replace(useUnsafeCssReplace ? REGEXP_NTHCHILD_UNSAFE : REGEXP_NTHCHILD, (...capture) => {
|
|
3275
|
-
return '`%' + (items.push('\\(' + getStringSome() + (capture[1] === '-' ? '\\x2d' : '\\x2b?') + (capture[2] || '[01]?') + (capture[3] === '0' ? !capture[1] && !capture[2] && !capture[4] && !capture[5] ? '[+-]?0[nN]?' : '0' : '[nN]') + getStringSome() + (capture[5] ? (capture[4] === '-' ? '\\x2d' : '\\x2b') + getStringSome() + capture[5] : `(?:[+-]${getStringSome()}0)?`) + getStringSome() + '\\)') - 1) + '`';
|
|
3279
|
+
return '`%' + (items.push('\\(' + getStringSome() + (capture[1] === '-' ? '\\x2d' : '\\x2b?') + (capture[2] || '[01]?') + (capture[3] === '0' ? !capture[1] && !capture[2] && !capture[4] && !capture[5] ? '[+-]?0[nN]?' : '0' : '[nN]') + getStringSome() + (capture[5] ? (capture[4] === '-' ? '\\x2d' : '\\x2b') + getStringSome() + capture[5] : `(?:[+-]${getStringSome()}0)?`) + (capture[6] ? getStringMany() + '[oO][fF]' + getStringMany() + capture[6].trim() : '') + getStringSome() + '\\)') - 1) + '`';
|
|
3276
3280
|
});
|
|
3277
3281
|
let selector = '';
|
|
3278
3282
|
for (let i = 0, length = revised.length, casing = false, attr = false, quote = false; i < length; i++) {
|
|
@@ -3442,7 +3446,7 @@ class ChromeDocument extends Document {
|
|
|
3442
3446
|
pattern.lastIndex = 0;
|
|
3443
3447
|
};
|
|
3444
3448
|
replaceBracket(REGEXP_COMMENT);
|
|
3445
|
-
replaceBracket(
|
|
3449
|
+
replaceBracket(REGEXP_QUOTEDVALUE);
|
|
3446
3450
|
const values = (0, util_1.splitEnclosing)(current, /\burl/gi);
|
|
3447
3451
|
for (let i = 0, length = values.length; i < length; ++i) {
|
|
3448
3452
|
const seg = values[i];
|
|
@@ -3683,7 +3687,7 @@ class ChromeDocument extends Document {
|
|
|
3683
3687
|
return (_a = this.module).settings || (_a.settings = {});
|
|
3684
3688
|
}
|
|
3685
3689
|
}
|
|
3686
|
-
ChromeDocument.INTERNAL_ASSIGNUUID = "__assign__"
|
|
3687
|
-
ChromeDocument.INTERNAL_SERVERROOT = "__serverroot__"
|
|
3690
|
+
ChromeDocument.INTERNAL_ASSIGNUUID = "__assign__";
|
|
3691
|
+
ChromeDocument.INTERNAL_SERVERROOT = "__serverroot__";
|
|
3688
3692
|
|
|
3689
3693
|
module.exports = ChromeDocument;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/chrome",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Chrome document constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/anpham6/pi-r.git",
|
|
11
|
+
"url": "git+https://github.com/anpham6/pi-r.git",
|
|
12
12
|
"directory": "src/module/chrome"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/cloud": "^0.7.
|
|
24
|
-
"@e-mc/core": "^0.7.
|
|
25
|
-
"@e-mc/document": "^0.7.
|
|
26
|
-
"@e-mc/types": "^0.7.
|
|
23
|
+
"@e-mc/cloud": "^0.7.3",
|
|
24
|
+
"@e-mc/core": "^0.7.3",
|
|
25
|
+
"@e-mc/document": "^0.7.3",
|
|
26
|
+
"@e-mc/types": "^0.7.3"
|
|
27
27
|
}
|
|
28
28
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -98,12 +98,12 @@ export interface IChromeDocument<T extends IFileManager<U>, U extends DocumentAs
|
|
|
98
98
|
formatMap?: ObjectMap<FormatUri>;
|
|
99
99
|
setElementSrc(asset: U, element: IXmlElement, value: string): void;
|
|
100
100
|
findDataValue(name: string): Undef<string>;
|
|
101
|
-
setInlinedAttributes(processing: FinalizeProcessing<T>): void;
|
|
102
|
-
applyTransforms(processing: FinalizeProcessing<T>): Promise<void>;
|
|
103
|
-
rewriteHtml(processing: FinalizeProcessing<T>): Promise<void>;
|
|
104
|
-
setElementAttributes(processing: FinalizeProcessing<T>, domBase: IDomWriter): Promise<void>;
|
|
105
|
-
applyDataSource(processing: FinalizeProcessing<T>, domBase: IDomWriter): Promise<void>;
|
|
106
|
-
setProductionAttributes(processing: FinalizeProcessing<T>): void;
|
|
101
|
+
setInlinedAttributes(processing: FinalizeProcessing<T, U>): void;
|
|
102
|
+
applyTransforms(processing: FinalizeProcessing<T, U>): Promise<void>;
|
|
103
|
+
rewriteHtml(processing: FinalizeProcessing<T, U>): Promise<void>;
|
|
104
|
+
setElementAttributes(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
|
|
105
|
+
applyDataSource(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
|
|
106
|
+
setProductionAttributes(processing: FinalizeProcessing<T, U>): void;
|
|
107
107
|
removeUnusedStyles(source: string, options?: UserConfig): Undef<string>;
|
|
108
108
|
removeServerRoot(value: string): string;
|
|
109
109
|
replaceContent(source: string, match: RegExpExecArray | string, mimeType?: string): Undef<string>;
|
|
@@ -123,4 +123,4 @@ export interface ChromeDocumentConstructor<T extends IFileManager<U>, U extends
|
|
|
123
123
|
INTERNAL_SERVERROOT: string;
|
|
124
124
|
readonly prototype: IChromeDocument<T, U>;
|
|
125
125
|
new(module?: DocumentModule, ...args: unknown[]): IChromeDocument<T, U>;
|
|
126
|
-
}
|
|
126
|
+
}
|