@pi-r/chrome 0.2.10 → 0.2.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/index.js +96 -34
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -11,6 +11,9 @@ const transform_1 = require("@e-mc/document/transform");
|
|
|
11
11
|
const Document = require('@e-mc/document');
|
|
12
12
|
const CACHE_DBRESULT = new Map();
|
|
13
13
|
const CACHE_LOCALFILE = new Map();
|
|
14
|
+
const CACHE_ETAG = new Map();
|
|
15
|
+
const CACHE_CONTENT = new Map();
|
|
16
|
+
const CACHE_FORMAT = new Map();
|
|
14
17
|
const CACHE_DATASET = {};
|
|
15
18
|
const CACHE_ATRULES = {};
|
|
16
19
|
let CACHE_TOTAL = 0;
|
|
@@ -374,6 +377,7 @@ function getSrcURL(parent, file) {
|
|
|
374
377
|
return [found ? joinPath('../'.repeat(prefix.length), suffix.join('/'), file.filename) : '../'.repeat(prefix.length) + relativeUrl];
|
|
375
378
|
}
|
|
376
379
|
function transformURL(host, parent, type, source, importFile) {
|
|
380
|
+
var _a;
|
|
377
381
|
const related = [];
|
|
378
382
|
const baseHref = getBaseURLs(importFile || parent, this.baseUrl);
|
|
379
383
|
const isHtml = type === 'html';
|
|
@@ -439,12 +443,13 @@ function transformURL(host, parent, type, source, importFile) {
|
|
|
439
443
|
}
|
|
440
444
|
}
|
|
441
445
|
const setOutputURL = (value, asset) => {
|
|
446
|
+
var _a;
|
|
442
447
|
if (!value) {
|
|
443
448
|
return;
|
|
444
449
|
}
|
|
445
450
|
if (asset) {
|
|
446
451
|
if (!asset.inlineBase64) {
|
|
447
|
-
if (host.Cloud
|
|
452
|
+
if ((_a = host.Cloud) === null || _a === void 0 ? void 0 : _a.getStorage('upload', asset.cloudStorage)) {
|
|
448
453
|
const inlineUrlCloud = asset.inlineUrlCloud || (asset.inlineUrlCloud = (0, types_1.generateUUID)());
|
|
449
454
|
(parent.inlineUrlCloudMap || (parent.inlineUrlCloudMap = {}))[inlineUrlCloud] = value;
|
|
450
455
|
value = inlineUrlCloud;
|
|
@@ -525,7 +530,7 @@ function transformURL(host, parent, type, source, importFile) {
|
|
|
525
530
|
url = trimQuote(content);
|
|
526
531
|
}
|
|
527
532
|
if (url.startsWith('data:')) {
|
|
528
|
-
const base64 = url.split(',')[1]
|
|
533
|
+
const base64 = (_a = url.split(',')[1]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
529
534
|
if (base64) {
|
|
530
535
|
for (const item of this.assets) {
|
|
531
536
|
if (item.base64 === base64) {
|
|
@@ -744,7 +749,7 @@ function transformJs(host, file, output) {
|
|
|
744
749
|
this.writeFail(["Unable to write file", path.basename(chunkUri)], err, 32);
|
|
745
750
|
}
|
|
746
751
|
}
|
|
747
|
-
appending
|
|
752
|
+
appending === null || appending === void 0 ? void 0 : appending.forEach(item => item.order += order);
|
|
748
753
|
}
|
|
749
754
|
if ((0, types_1.isArray)(sourceFiles)) {
|
|
750
755
|
file.sourceFiles = sourceFiles;
|
|
@@ -859,7 +864,7 @@ const isIgnored = (item, exists) => item.invalid || (0, types_1.ignoreFlag)(item
|
|
|
859
864
|
const findFont = (value) => value && (Array.isArray(value) ? value : [value]).find(format => isFont(format));
|
|
860
865
|
const spliceString = (source, startIndex, endIndex, content) => source.substring(0, startIndex) + content + source.substring(endIndex);
|
|
861
866
|
const getEndIndex = (match) => match.index + match[0].length;
|
|
862
|
-
const getRelativeURL = (file) => joinPath(file.moveTo, file.pathname, file.inlineFilename || file.filename) + (!file.static ? restoreSearchParams(file.url
|
|
867
|
+
const getRelativeURL = (file) => { var _a; return joinPath(file.moveTo, file.pathname, file.inlineFilename || file.filename) + (!file.static ? restoreSearchParams((_a = file.url) === null || _a === void 0 ? void 0 : _a.search) : ''); };
|
|
863
868
|
const errorHtml = ({ tagName, tagIndex = -1 }) => (0, types_1.errorMessage)('html', 'Location did not resolve', tagName.toLowerCase() + (tagIndex >= 0 ? ': ' + tagIndex : ''));
|
|
864
869
|
const errorDataSource = (value, hint) => (0, types_1.errorMessage)('data-source', value, hint);
|
|
865
870
|
class ChromeDocument extends Document {
|
|
@@ -929,10 +934,14 @@ class ChromeDocument extends Document {
|
|
|
929
934
|
}
|
|
930
935
|
CACHE_TOTAL = stored.length - result;
|
|
931
936
|
}
|
|
937
|
+
CACHE_ETAG.clear();
|
|
938
|
+
CACHE_CONTENT.clear();
|
|
939
|
+
CACHE_FORMAT.clear();
|
|
932
940
|
}
|
|
933
941
|
return result + (parent && result > 0 ? await super.purgeMemory(typeof parent === 'number' && parent > 0 ? parent : percent, limit, true) : 0);
|
|
934
942
|
}
|
|
935
943
|
static async finalize(instance) {
|
|
944
|
+
var _a;
|
|
936
945
|
if (instance.aborted) {
|
|
937
946
|
return Promise.reject((0, types_1.createAbortError)());
|
|
938
947
|
}
|
|
@@ -944,7 +953,7 @@ class ChromeDocument extends Document {
|
|
|
944
953
|
db.writeTimeElapsed('DB', ["Transactions were committed", db.moduleName], processing.startTime, { ...Document.LOG_STYLE_SUCCESS, type: 65536 });
|
|
945
954
|
}
|
|
946
955
|
if (instance.dataSource.length === 0 && outHtml) {
|
|
947
|
-
const incremental = htmlFile.incremental
|
|
956
|
+
const incremental = (_a = htmlFile.incremental) !== null && _a !== void 0 ? _a : this.incremental;
|
|
948
957
|
if (incremental === 'etag' || incremental === 'exists') {
|
|
949
958
|
const fetched = this.fetchedAssets;
|
|
950
959
|
const isHtmlOnly = () => !fetched.find(item => item !== htmlFile && assets.includes(item));
|
|
@@ -955,12 +964,27 @@ class ChromeDocument extends Document {
|
|
|
955
964
|
if (outHtml) {
|
|
956
965
|
const { etag, initialValue } = htmlFile;
|
|
957
966
|
let buffer;
|
|
958
|
-
if (!initialValue || !(etag && initialValue.etag === etag && (buffer = initialValue.buffer)) || fetched.find(item => item.
|
|
967
|
+
if (!initialValue || !(etag && initialValue.etag === etag && (buffer = initialValue.buffer)) || fetched.find(item => item !== htmlFile && item.etag && CACHE_ETAG.get(item.localUri) !== item.etag && (item.inlineContent || item.bundleReplace && (!Array.isArray(item.from) || item.from.includes('style'))))) {
|
|
968
|
+
const isValid = (item) => !!item.localUri && item !== htmlFile && !item.invalid;
|
|
969
|
+
for (const item of fetched) {
|
|
970
|
+
if (item.etag && !item.content && isValid(item)) {
|
|
971
|
+
CACHE_ETAG.set(item.localUri, item.etag);
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
for (const item of instance.assets) {
|
|
975
|
+
if (isValid(item)) {
|
|
976
|
+
if (item.content) {
|
|
977
|
+
CACHE_CONTENT.set(item.localUri, item.content);
|
|
978
|
+
}
|
|
979
|
+
if (item.format) {
|
|
980
|
+
CACHE_FORMAT.set(item.localUri, item.format.toString());
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
}
|
|
959
984
|
break;
|
|
960
985
|
}
|
|
961
986
|
try {
|
|
962
|
-
|
|
963
|
-
fs.writeFileSync(localUri, buffer, (0, types_1.getEncoding)(encoding));
|
|
987
|
+
fs.writeFileSync(htmlFile.localUri, buffer, (0, types_1.getEncoding)(htmlFile.encoding));
|
|
964
988
|
htmlFile.buffer = buffer;
|
|
965
989
|
htmlFile.sourceUTF8 = undefined;
|
|
966
990
|
}
|
|
@@ -968,12 +992,39 @@ class ChromeDocument extends Document {
|
|
|
968
992
|
break;
|
|
969
993
|
}
|
|
970
994
|
}
|
|
971
|
-
const
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
995
|
+
const wasModified = (item) => {
|
|
996
|
+
const localUri = item.localUri;
|
|
997
|
+
let result = fetched.includes(item) || Array.isArray(item.from) && item.from.includes('style');
|
|
998
|
+
if (localUri) {
|
|
999
|
+
if (item.etag && !item.content && !item.invalid) {
|
|
1000
|
+
CACHE_ETAG.set(localUri, item.etag);
|
|
1001
|
+
}
|
|
1002
|
+
else {
|
|
1003
|
+
CACHE_ETAG.delete(localUri);
|
|
1004
|
+
}
|
|
1005
|
+
if (!item.content || item.invalid) {
|
|
1006
|
+
CACHE_CONTENT.delete(localUri);
|
|
1007
|
+
}
|
|
1008
|
+
else if (CACHE_CONTENT.get(localUri) !== item.content || !item.inlineContent && !Document.isPath(localUri)) {
|
|
1009
|
+
CACHE_CONTENT.set(localUri, item.content);
|
|
1010
|
+
result = true;
|
|
1011
|
+
}
|
|
1012
|
+
if (!item.format || item.invalid) {
|
|
1013
|
+
CACHE_FORMAT.delete(localUri);
|
|
1014
|
+
}
|
|
1015
|
+
else {
|
|
1016
|
+
const format = item.format.toString();
|
|
1017
|
+
if (CACHE_FORMAT.get(localUri) !== format || !item.inlineContent && !Document.isPath(localUri)) {
|
|
1018
|
+
CACHE_FORMAT.set(localUri, format);
|
|
1019
|
+
result = true;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
return result || this.copiedAssets.includes(item) && (!(0, types_1.isEmpty)(item.bundleId) || !(0, types_1.isEmpty)(item.trailingContent));
|
|
1024
|
+
};
|
|
1025
|
+
const js = instance.jsFiles.filter(item => wasModified(item) || !!item.imports);
|
|
1026
|
+
const css = instance.cssFiles.filter(wasModified);
|
|
1027
|
+
const svg = instance.svgFiles.filter(wasModified);
|
|
977
1028
|
if (js.length || css.length || svg.length) {
|
|
978
1029
|
instance.jsFiles = js;
|
|
979
1030
|
instance.cssFiles = css;
|
|
@@ -1525,6 +1576,7 @@ class ChromeDocument extends Document {
|
|
|
1525
1576
|
}
|
|
1526
1577
|
resolveImports(file, code, baseFile) {
|
|
1527
1578
|
var _a;
|
|
1579
|
+
var _b;
|
|
1528
1580
|
if (!Array.isArray(file.imports)) {
|
|
1529
1581
|
return;
|
|
1530
1582
|
}
|
|
@@ -1540,7 +1592,7 @@ class ChromeDocument extends Document {
|
|
|
1540
1592
|
}
|
|
1541
1593
|
const importMap = {};
|
|
1542
1594
|
for (const item of file.imports) {
|
|
1543
|
-
(importMap[
|
|
1595
|
+
(importMap[_b = item.placeholder] || (importMap[_b] = [])).push(item);
|
|
1544
1596
|
}
|
|
1545
1597
|
for (const placeholder in importMap) {
|
|
1546
1598
|
const items = importMap[placeholder];
|
|
@@ -1550,7 +1602,7 @@ class ChromeDocument extends Document {
|
|
|
1550
1602
|
const { uri, original, type, dynamic } = items[i];
|
|
1551
1603
|
let value;
|
|
1552
1604
|
if (type === 'css') {
|
|
1553
|
-
const asset = this.host
|
|
1605
|
+
const asset = (_a = this.host) === null || _a === void 0 ? void 0 : _a.findAsset(uri);
|
|
1554
1606
|
if (asset) {
|
|
1555
1607
|
const [relativeUrl, sameDir] = getSrcURL.call(this, bundleMain || file, asset);
|
|
1556
1608
|
if (relativeUrl) {
|
|
@@ -1578,12 +1630,13 @@ class ChromeDocument extends Document {
|
|
|
1578
1630
|
}
|
|
1579
1631
|
}
|
|
1580
1632
|
replaceContent(source, statement, mimeType) {
|
|
1633
|
+
var _a;
|
|
1581
1634
|
switch (mimeType) {
|
|
1582
1635
|
case 'text/css': {
|
|
1583
1636
|
const match = REGEXP_REPLACECSS.exec((typeof statement === 'string' ? statement : statement[0]).trim());
|
|
1584
1637
|
if (match) {
|
|
1585
1638
|
const layer = match[1];
|
|
1586
|
-
const supports = match[3]
|
|
1639
|
+
const supports = (_a = match[3]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
1587
1640
|
const query = match[4].trim();
|
|
1588
1641
|
if (layer || supports || query) {
|
|
1589
1642
|
const newline = (0, util_1.getNewline)(source);
|
|
@@ -1620,8 +1673,9 @@ class ChromeDocument extends Document {
|
|
|
1620
1673
|
}
|
|
1621
1674
|
}
|
|
1622
1675
|
writeImage(data) {
|
|
1676
|
+
var _a;
|
|
1623
1677
|
const { file, output, command } = data;
|
|
1624
|
-
if (output && command && file.element
|
|
1678
|
+
if (output && command && ((_a = file.element) === null || _a === void 0 ? void 0 : _a.outerXml)) {
|
|
1625
1679
|
const match = REGEXP_SRCSETSIZE.exec(command);
|
|
1626
1680
|
if (match) {
|
|
1627
1681
|
(file.srcSet || (file.srcSet = [])).push(toPosix(data.baseDirectory ? output.substring(data.baseDirectory.length + 1) : output), match[1] + match[2].toLowerCase());
|
|
@@ -1632,11 +1686,12 @@ class ChromeDocument extends Document {
|
|
|
1632
1686
|
return false;
|
|
1633
1687
|
}
|
|
1634
1688
|
cloudInit({ instance }) {
|
|
1689
|
+
var _a, _b;
|
|
1635
1690
|
this._cloudUrlMap = Object.create(null);
|
|
1636
1691
|
this._cloudUploaded = new Set();
|
|
1637
1692
|
this._cloudEndpoint = null;
|
|
1638
1693
|
if (this.htmlFile) {
|
|
1639
|
-
const endpoint = instance.getStorage('upload', this.htmlFile.cloudStorage)
|
|
1694
|
+
const endpoint = (_b = (_a = instance.getStorage('upload', this.htmlFile.cloudStorage)) === null || _a === void 0 ? void 0 : _a.upload) === null || _b === void 0 ? void 0 : _b.endpoint;
|
|
1640
1695
|
if (endpoint) {
|
|
1641
1696
|
this._cloudEndpoint = new RegExp((0, types_1.escapePattern)(toPosix(endpoint)) + '/', 'g');
|
|
1642
1697
|
}
|
|
@@ -1649,6 +1704,7 @@ class ChromeDocument extends Document {
|
|
|
1649
1704
|
return this.editing.includes(file);
|
|
1650
1705
|
}
|
|
1651
1706
|
cloudUpload({ host }, file, url, active) {
|
|
1707
|
+
var _a;
|
|
1652
1708
|
if (active) {
|
|
1653
1709
|
const endpoint = this._cloudEndpoint;
|
|
1654
1710
|
const inlineUrlCloud = file.inlineUrlCloud;
|
|
@@ -1658,7 +1714,7 @@ class ChromeDocument extends Document {
|
|
|
1658
1714
|
const htmlFile = this.htmlFile;
|
|
1659
1715
|
const pattern = new RegExp((0, types_1.escapePattern)(inlineUrlCloud), 'g');
|
|
1660
1716
|
for (const item of this.editing) {
|
|
1661
|
-
if (item.inlineUrlCloudMap
|
|
1717
|
+
if ((_a = item.inlineUrlCloudMap) === null || _a === void 0 ? void 0 : _a[inlineUrlCloud]) {
|
|
1662
1718
|
const source = host.getUTF8String(item);
|
|
1663
1719
|
const output = source.replace(pattern, endpoint && item !== htmlFile && cloudUrl.indexOf('/') !== -1 ? url : cloudUrl);
|
|
1664
1720
|
if (source !== output) {
|
|
@@ -1673,6 +1729,7 @@ class ChromeDocument extends Document {
|
|
|
1673
1729
|
return Promise.resolve(false);
|
|
1674
1730
|
}
|
|
1675
1731
|
async cloudFinalize(state) {
|
|
1732
|
+
var _a;
|
|
1676
1733
|
if (this.aborted) {
|
|
1677
1734
|
return Promise.reject((0, types_1.createAbortError)());
|
|
1678
1735
|
}
|
|
@@ -1721,7 +1778,7 @@ class ChromeDocument extends Document {
|
|
|
1721
1778
|
for (const storage of cloudStorage) {
|
|
1722
1779
|
if (instance.hasCredential('storage', storage)) {
|
|
1723
1780
|
const { service, admin, bucket, upload } = storage;
|
|
1724
|
-
const website = admin
|
|
1781
|
+
const website = (_a = admin === null || admin === void 0 ? void 0 : admin.configBucket) === null || _a === void 0 ? void 0 : _a.website;
|
|
1725
1782
|
if ((0, types_1.isPlainObject)(website) && bucket && upload) {
|
|
1726
1783
|
let filename = joinPath(upload.pathname, upload.filename || path.basename(htmlFile.localUri));
|
|
1727
1784
|
if (website.indexPage === true) {
|
|
@@ -1757,7 +1814,7 @@ class ChromeDocument extends Document {
|
|
|
1757
1814
|
}
|
|
1758
1815
|
const main = watch.main;
|
|
1759
1816
|
let result;
|
|
1760
|
-
if (main
|
|
1817
|
+
if ((main === null || main === void 0 ? void 0 : main.editing) && main.mimeType === 'text/html') {
|
|
1761
1818
|
const inlineUrlCloudMap = main.inlineUrlCloudMap || {};
|
|
1762
1819
|
const using = [];
|
|
1763
1820
|
let found;
|
|
@@ -1794,6 +1851,7 @@ class ChromeDocument extends Document {
|
|
|
1794
1851
|
}
|
|
1795
1852
|
watchModified(watch, assets) {
|
|
1796
1853
|
return (files, errors, status) => {
|
|
1854
|
+
var _a;
|
|
1797
1855
|
if (!watch.server || watch.captured || watch.aborted) {
|
|
1798
1856
|
return;
|
|
1799
1857
|
}
|
|
@@ -1813,7 +1871,7 @@ class ChromeDocument extends Document {
|
|
|
1813
1871
|
search = next.url.search;
|
|
1814
1872
|
}
|
|
1815
1873
|
}
|
|
1816
|
-
search
|
|
1874
|
+
search !== null && search !== void 0 ? search : (search = restoreSearchParams((_a = asset.url) === null || _a === void 0 ? void 0 : _a.search));
|
|
1817
1875
|
if (status) {
|
|
1818
1876
|
status = status.filter(item => item.type >= types_1.STATUS_TYPE.FATAL && item.type <= types_1.STATUS_TYPE.WARN);
|
|
1819
1877
|
}
|
|
@@ -1887,11 +1945,13 @@ class ChromeDocument extends Document {
|
|
|
1887
1945
|
}
|
|
1888
1946
|
}
|
|
1889
1947
|
findDataValue(name) {
|
|
1948
|
+
var _a;
|
|
1890
1949
|
if (this.hasEval('template')) {
|
|
1891
|
-
return this.templateMap.data
|
|
1950
|
+
return (_a = this.templateMap.data) === null || _a === void 0 ? void 0 : _a[name];
|
|
1892
1951
|
}
|
|
1893
1952
|
}
|
|
1894
1953
|
setInlinedAttributes({ host, startTime, hashed, contentMap, bufferMap, productionRelease }) {
|
|
1954
|
+
var _a, _b;
|
|
1895
1955
|
const readBase64 = (item, uuid) => {
|
|
1896
1956
|
if (!contentMap[uuid]) {
|
|
1897
1957
|
try {
|
|
@@ -1921,7 +1981,7 @@ class ChromeDocument extends Document {
|
|
|
1921
1981
|
const filename = createHash(host, item, bufferMap);
|
|
1922
1982
|
if (filename) {
|
|
1923
1983
|
for (const hash of this.assets) {
|
|
1924
|
-
const url = inlineUrl ? hash.inlineUrlMap
|
|
1984
|
+
const url = inlineUrl ? (_a = hash.inlineUrlMap) === null || _a === void 0 ? void 0 : _a[inlineUrl] : (_b = hash.inlineUrlCloudMap) === null || _b === void 0 ? void 0 : _b[inlineUrlCloud];
|
|
1925
1985
|
if (url) {
|
|
1926
1986
|
const search = url.indexOf('?');
|
|
1927
1987
|
const index = (search !== -1 ? url.substring(0, search) : url).lastIndexOf('/');
|
|
@@ -1969,10 +2029,10 @@ class ChromeDocument extends Document {
|
|
|
1969
2029
|
const sortNested = (a, b) => {
|
|
1970
2030
|
const { inlineUrlCloud: urlA, inlineUrlCloudMap: mapA } = a;
|
|
1971
2031
|
const { inlineUrlCloud: urlB, inlineUrlCloudMap: mapB } = b;
|
|
1972
|
-
if (urlA && mapB
|
|
2032
|
+
if (urlA && (mapB === null || mapB === void 0 ? void 0 : mapB[urlA])) {
|
|
1973
2033
|
return -1;
|
|
1974
2034
|
}
|
|
1975
|
-
if (urlB && mapA
|
|
2035
|
+
if (urlB && (mapA === null || mapA === void 0 ? void 0 : mapA[urlB])) {
|
|
1976
2036
|
return 1;
|
|
1977
2037
|
}
|
|
1978
2038
|
return 0;
|
|
@@ -2198,7 +2258,7 @@ class ChromeDocument extends Document {
|
|
|
2198
2258
|
}
|
|
2199
2259
|
}
|
|
2200
2260
|
if (uri && !(0, util_1.hasValue)(item.format, 'crossorigin') && item !== htmlFile) {
|
|
2201
|
-
if (cloud
|
|
2261
|
+
if (cloud === null || cloud === void 0 ? void 0 : cloud.getStorage('upload', item.cloudStorage)) {
|
|
2202
2262
|
const inlineUrlCloud = item.inlineUrlCloud || (item.inlineUrlCloud = (0, types_1.generateUUID)());
|
|
2203
2263
|
((_a = htmlFile).inlineUrlCloudMap || (_a.inlineUrlCloudMap = {}))[inlineUrlCloud] = productionRelease ? this.removeServerRoot(uri) : uri;
|
|
2204
2264
|
uri = inlineUrlCloud;
|
|
@@ -2366,7 +2426,7 @@ class ChromeDocument extends Document {
|
|
|
2366
2426
|
batchGroup.push([item]);
|
|
2367
2427
|
break;
|
|
2368
2428
|
default:
|
|
2369
|
-
if (db
|
|
2429
|
+
if (db === null || db === void 0 ? void 0 : db.hasSource(type)) {
|
|
2370
2430
|
try {
|
|
2371
2431
|
await db.setCredential(item);
|
|
2372
2432
|
const credential = item.credential;
|
|
@@ -2399,6 +2459,7 @@ class ChromeDocument extends Document {
|
|
|
2399
2459
|
}
|
|
2400
2460
|
return this.allSettled(batchGroup.map(batch => {
|
|
2401
2461
|
return new Promise(async (resolve, reject) => {
|
|
2462
|
+
var _a, _b, _c;
|
|
2402
2463
|
const errorRemove = (item, reason) => {
|
|
2403
2464
|
removeElement(item);
|
|
2404
2465
|
reject(reason);
|
|
@@ -2457,7 +2518,7 @@ class ChromeDocument extends Document {
|
|
|
2457
2518
|
}
|
|
2458
2519
|
else {
|
|
2459
2520
|
this.abort(type);
|
|
2460
|
-
errorRemove(current, target ? errorDataSource('Not found', target) : errorDataSource('Not defined - ' + (this.settings.directory
|
|
2521
|
+
errorRemove(current, target ? errorDataSource('Not found', target) : errorDataSource('Not defined - ' + (((_a = this.settings.directory) === null || _a === void 0 ? void 0 : _a.data) ? 'file' : 'directory'), type));
|
|
2461
2522
|
return;
|
|
2462
2523
|
}
|
|
2463
2524
|
}
|
|
@@ -2586,7 +2647,7 @@ class ChromeDocument extends Document {
|
|
|
2586
2647
|
if (!getData) {
|
|
2587
2648
|
const { settings, encoding, persist = true } = current;
|
|
2588
2649
|
if (!target) {
|
|
2589
|
-
target = settings && this.settings.export
|
|
2650
|
+
target = settings && ((_b = this.settings.export) === null || _b === void 0 ? void 0 : _b[settings]) || pathname;
|
|
2590
2651
|
}
|
|
2591
2652
|
if (typeof target === 'function') {
|
|
2592
2653
|
getData = target;
|
|
@@ -2646,7 +2707,7 @@ class ChromeDocument extends Document {
|
|
|
2646
2707
|
break;
|
|
2647
2708
|
}
|
|
2648
2709
|
default:
|
|
2649
|
-
if (db
|
|
2710
|
+
if (db === null || db === void 0 ? void 0 : db.hasSource(type)) {
|
|
2650
2711
|
switch (type) {
|
|
2651
2712
|
case 'mongodb':
|
|
2652
2713
|
for (let j = 0; j < length; ++j) {
|
|
@@ -2870,7 +2931,7 @@ class ChromeDocument extends Document {
|
|
|
2870
2931
|
for (let j = 0, match; j < items.length; ++j) {
|
|
2871
2932
|
const row = items[j];
|
|
2872
2933
|
if ((0, types_1.isPlainObject)(row)) {
|
|
2873
|
-
row['__index__']
|
|
2934
|
+
(_c = row['__index__']) !== null && _c !== void 0 ? _c : (row['__index__'] = j + 1);
|
|
2874
2935
|
}
|
|
2875
2936
|
let segment = template;
|
|
2876
2937
|
while (match = REGEXP_TEMPLATECONDITIONAL.exec(segment)) {
|
|
@@ -3153,6 +3214,7 @@ class ChromeDocument extends Document {
|
|
|
3153
3214
|
}
|
|
3154
3215
|
}
|
|
3155
3216
|
setProductionAttributes({ host, hashed, bufferMap, startTime }) {
|
|
3217
|
+
var _a;
|
|
3156
3218
|
for (const item of this.assets) {
|
|
3157
3219
|
if (isIgnored(item, true)) {
|
|
3158
3220
|
continue;
|
|
@@ -3160,7 +3222,7 @@ class ChromeDocument extends Document {
|
|
|
3160
3222
|
if (!hashed.has(item)) {
|
|
3161
3223
|
createHash(host, item, bufferMap);
|
|
3162
3224
|
}
|
|
3163
|
-
switch (item.element
|
|
3225
|
+
switch ((_a = item.element) === null || _a === void 0 ? void 0 : _a.tagName.toLowerCase()) {
|
|
3164
3226
|
case 'style':
|
|
3165
3227
|
if (!item.content) {
|
|
3166
3228
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/chrome",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "Chrome document constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -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.5.
|
|
24
|
-
"@e-mc/core": "^0.5.
|
|
25
|
-
"@e-mc/document": "^0.5.
|
|
26
|
-
"@e-mc/types": "^0.5.
|
|
23
|
+
"@e-mc/cloud": "^0.5.10",
|
|
24
|
+
"@e-mc/core": "^0.5.10",
|
|
25
|
+
"@e-mc/document": "^0.5.10",
|
|
26
|
+
"@e-mc/types": "^0.5.10"
|
|
27
27
|
}
|
|
28
28
|
}
|