@pi-r/chrome 0.6.6 → 0.6.8

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.
Files changed (2) hide show
  1. package/index.js +97 -35
  2. package/package.json +5 -5
package/index.js CHANGED
@@ -13,6 +13,9 @@ const CACHE_DBRESULT = new Map();
13
13
  const CACHE_LOCALFILE = new Map();
14
14
  const CACHE_QUERY = new Map();
15
15
  const CACHE_SELECTOR = new Map();
16
+ const CACHE_ETAG = new Map();
17
+ const CACHE_CONTENT = new Map();
18
+ const CACHE_FORMAT = new Map();
16
19
  const CACHE_DATASET = {};
17
20
  const CACHE_ATRULES = {};
18
21
  let CACHE_TOTAL = 0;
@@ -297,7 +300,7 @@ function hasSameOrigin(value, ...other) {
297
300
  return false;
298
301
  }
299
302
  function restoreSearchParams(value, prefix = '__sqd') {
300
- if (value?.includes(prefix)) {
303
+ if (value === null || value === void 0 ? void 0 : value.includes(prefix)) {
301
304
  const params = new URLSearchParams(value);
302
305
  params.forEach((_, key) => key.startsWith(prefix) && params.delete(key));
303
306
  if (value = params.toString()) {
@@ -385,6 +388,7 @@ function getSrcURL(parent, file) {
385
388
  return [found ? joinPath('../'.repeat(prefix.length), suffix.join('/'), file.filename) : '../'.repeat(prefix.length) + relativeUrl];
386
389
  }
387
390
  function transformURL(host, parent, type, source, importFile) {
391
+ var _a;
388
392
  const related = [];
389
393
  const baseHref = getBaseURLs(importFile || parent, this.baseUrl);
390
394
  const isHtml = type === 'html';
@@ -471,12 +475,13 @@ function transformURL(host, parent, type, source, importFile) {
471
475
  }
472
476
  }
473
477
  const setOutputURL = (value, asset) => {
478
+ var _a;
474
479
  if (!value) {
475
480
  return;
476
481
  }
477
482
  if (asset) {
478
483
  if (!asset.inlineBase64) {
479
- if (host.Cloud?.getStorage('upload', asset.cloudStorage)) {
484
+ if ((_a = host.Cloud) === null || _a === void 0 ? void 0 : _a.getStorage('upload', asset.cloudStorage)) {
480
485
  const inlineUrlCloud = asset.inlineUrlCloud || (asset.inlineUrlCloud = (0, types_1.generateUUID)());
481
486
  (parent.inlineUrlCloudMap || (parent.inlineUrlCloudMap = {}))[inlineUrlCloud] = value;
482
487
  value = inlineUrlCloud;
@@ -557,7 +562,7 @@ function transformURL(host, parent, type, source, importFile) {
557
562
  url = trimQuote(content);
558
563
  }
559
564
  if (url.startsWith('data:')) {
560
- const base64 = url.split(',')[1]?.trim();
565
+ const base64 = (_a = url.split(',')[1]) === null || _a === void 0 ? void 0 : _a.trim();
561
566
  if (base64) {
562
567
  for (const item of this.assets) {
563
568
  if (item.base64 === base64) {
@@ -776,7 +781,7 @@ function transformJs(host, file, output) {
776
781
  this.writeFail(["Unable to write file", path.basename(chunkUri)], err, 32);
777
782
  }
778
783
  }
779
- appending?.forEach(item => item.order += order);
784
+ appending === null || appending === void 0 ? void 0 : appending.forEach(item => item.order += order);
780
785
  }
781
786
  if ((0, types_1.isArray)(sourceFiles)) {
782
787
  file.sourceFiles = sourceFiles;
@@ -897,7 +902,7 @@ const isIgnored = (item, exists) => item.invalid || (0, types_1.ignoreFlag)(item
897
902
  const findFont = (value) => value && (Array.isArray(value) ? value : [value]).find(format => isFont(format));
898
903
  const spliceString = (source, startIndex, endIndex, content) => source.substring(0, startIndex) + content + source.substring(endIndex);
899
904
  const getEndIndex = (match) => match.index + match[0].length;
900
- const getRelativeURL = (file) => joinPath(file.moveTo, file.pathname, file.inlineFilename || file.filename) + (!file.static ? restoreSearchParams(file.url?.search) : '');
905
+ 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) : ''); };
901
906
  const errorHtml = ({ tagName, tagIndex = -1 }) => (0, types_1.errorMessage)('html', 'Location did not resolve', tagName.toLowerCase() + (tagIndex >= 0 ? ': ' + tagIndex : ''));
902
907
  const errorDataSource = (value, hint) => (0, types_1.errorMessage)('data-source', value, hint);
903
908
  class ChromeDocument extends Document {
@@ -971,10 +976,14 @@ class ChromeDocument extends Document {
971
976
  }
972
977
  CACHE_QUERY.clear();
973
978
  CACHE_SELECTOR.clear();
979
+ CACHE_ETAG.clear();
980
+ CACHE_CONTENT.clear();
981
+ CACHE_FORMAT.clear();
974
982
  }
975
983
  return result + (parent && result > 0 ? await super.purgeMemory(typeof parent === 'number' && parent > 0 ? parent : percent, limit, true) : 0);
976
984
  }
977
985
  static async finalize(instance) {
986
+ var _a;
978
987
  if (instance.aborted) {
979
988
  return Promise.reject((0, types_1.createAbortError)());
980
989
  }
@@ -986,7 +995,7 @@ class ChromeDocument extends Document {
986
995
  db.writeTimeElapsed('DB', ["Transactions were committed", db.moduleName], processing.startTime, { ...Document.LOG_STYLE_SUCCESS, type: 65536 });
987
996
  }
988
997
  if (instance.dataSource.length === 0 && outHtml) {
989
- const incremental = htmlFile.incremental ?? this.incremental;
998
+ const incremental = (_a = htmlFile.incremental) !== null && _a !== void 0 ? _a : this.incremental;
990
999
  if (incremental === 'etag' || incremental === 'exists') {
991
1000
  const fetched = this.fetchedAssets;
992
1001
  const isHtmlOnly = () => !fetched.find(item => item !== htmlFile && assets.includes(item));
@@ -997,12 +1006,27 @@ class ChromeDocument extends Document {
997
1006
  if (outHtml) {
998
1007
  const { etag, initialValue } = htmlFile;
999
1008
  let buffer;
1000
- if (!initialValue || !(etag && initialValue.etag === etag && (buffer = initialValue.buffer)) || fetched.find(item => item.bundleReplace && (!(0, types_1.isArray)(item.from) || item.from.includes('style')))) {
1009
+ 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'))))) {
1010
+ const isValid = (item) => !!item.localUri && item !== htmlFile && !item.invalid;
1011
+ for (const item of fetched) {
1012
+ if (item.etag && !item.content && isValid(item)) {
1013
+ CACHE_ETAG.set(item.localUri, item.etag);
1014
+ }
1015
+ }
1016
+ for (const item of instance.assets) {
1017
+ if (isValid(item)) {
1018
+ if (item.content) {
1019
+ CACHE_CONTENT.set(item.localUri, item.content);
1020
+ }
1021
+ if (item.format) {
1022
+ CACHE_FORMAT.set(item.localUri, item.format.toString());
1023
+ }
1024
+ }
1025
+ }
1001
1026
  break;
1002
1027
  }
1003
1028
  try {
1004
- const { localUri, encoding } = htmlFile;
1005
- fs.writeFileSync(localUri, buffer, (0, types_1.getEncoding)(encoding));
1029
+ fs.writeFileSync(htmlFile.localUri, buffer, (0, types_1.getEncoding)(htmlFile.encoding));
1006
1030
  htmlFile.buffer = buffer;
1007
1031
  htmlFile.sourceUTF8 = undefined;
1008
1032
  }
@@ -1010,12 +1034,39 @@ class ChromeDocument extends Document {
1010
1034
  break;
1011
1035
  }
1012
1036
  }
1013
- const { jsFiles, cssFiles, svgFiles } = instance;
1014
- const copiedAssets = this.copiedAssets;
1015
- const wasModified = (item) => fetched.includes(item) || copiedAssets.includes(item) && (!(0, types_1.isEmpty)(item.bundleId) || !(0, types_1.isEmpty)(item.trailingContent));
1016
- const js = jsFiles.filter(item => item.imports || wasModified(item));
1017
- const css = cssFiles.filter(wasModified);
1018
- const svg = svgFiles.filter(wasModified);
1037
+ const wasModified = (item) => {
1038
+ const localUri = item.localUri;
1039
+ let result = fetched.includes(item) || Array.isArray(item.from) && item.from.includes('style');
1040
+ if (localUri) {
1041
+ if (item.etag && !item.content && !item.invalid) {
1042
+ CACHE_ETAG.set(localUri, item.etag);
1043
+ }
1044
+ else {
1045
+ CACHE_ETAG.delete(localUri);
1046
+ }
1047
+ if (!item.content || item.invalid) {
1048
+ CACHE_CONTENT.delete(localUri);
1049
+ }
1050
+ else if (CACHE_CONTENT.get(localUri) !== item.content || !item.inlineContent && !Document.isPath(localUri)) {
1051
+ CACHE_CONTENT.set(localUri, item.content);
1052
+ result = true;
1053
+ }
1054
+ if (!item.format || item.invalid) {
1055
+ CACHE_FORMAT.delete(localUri);
1056
+ }
1057
+ else {
1058
+ const format = item.format.toString();
1059
+ if (CACHE_FORMAT.get(localUri) !== format || !item.inlineContent && !Document.isPath(localUri)) {
1060
+ CACHE_FORMAT.set(localUri, format);
1061
+ result = true;
1062
+ }
1063
+ }
1064
+ }
1065
+ return result || this.copiedAssets.includes(item) && (!(0, types_1.isEmpty)(item.bundleId) || !(0, types_1.isEmpty)(item.trailingContent));
1066
+ };
1067
+ const js = instance.jsFiles.filter(item => wasModified(item) || !!item.imports);
1068
+ const css = instance.cssFiles.filter(wasModified);
1069
+ const svg = instance.svgFiles.filter(wasModified);
1019
1070
  if (js.length || css.length || svg.length) {
1020
1071
  instance.jsFiles = js;
1021
1072
  instance.cssFiles = css;
@@ -1582,6 +1633,7 @@ class ChromeDocument extends Document {
1582
1633
  }
1583
1634
  resolveImports(file, code, baseFile) {
1584
1635
  var _a;
1636
+ var _b;
1585
1637
  if (!Array.isArray(file.imports)) {
1586
1638
  return;
1587
1639
  }
@@ -1597,7 +1649,7 @@ class ChromeDocument extends Document {
1597
1649
  }
1598
1650
  const importMap = {};
1599
1651
  for (const item of file.imports) {
1600
- (importMap[_a = item.placeholder] || (importMap[_a] = [])).push(item);
1652
+ (importMap[_b = item.placeholder] || (importMap[_b] = [])).push(item);
1601
1653
  }
1602
1654
  for (const placeholder in importMap) {
1603
1655
  const items = importMap[placeholder];
@@ -1609,7 +1661,7 @@ class ChromeDocument extends Document {
1609
1661
  const hosted = type === 'css';
1610
1662
  let value;
1611
1663
  if (hosted) {
1612
- const asset = this.host?.findAsset(uri);
1664
+ const asset = (_a = this.host) === null || _a === void 0 ? void 0 : _a.findAsset(uri);
1613
1665
  if (asset) {
1614
1666
  const [relativeUrl, sameDir] = getSrcURL.call(this, bundleMain || file, asset);
1615
1667
  if (relativeUrl) {
@@ -1638,12 +1690,13 @@ class ChromeDocument extends Document {
1638
1690
  }
1639
1691
  }
1640
1692
  replaceContent(source, statement, mimeType) {
1693
+ var _a;
1641
1694
  switch (mimeType) {
1642
1695
  case 'text/css': {
1643
1696
  const match = REGEXP_REPLACECSS.exec((typeof statement === 'string' ? statement : statement[0]).trim());
1644
1697
  if (match) {
1645
1698
  const layer = match[1];
1646
- const supports = match[3]?.trim();
1699
+ const supports = (_a = match[3]) === null || _a === void 0 ? void 0 : _a.trim();
1647
1700
  const query = match[4].trim();
1648
1701
  if (layer || supports || query) {
1649
1702
  const newline = (0, util_1.getNewline)(source);
@@ -1680,8 +1733,9 @@ class ChromeDocument extends Document {
1680
1733
  }
1681
1734
  }
1682
1735
  writeImage(data) {
1736
+ var _a;
1683
1737
  const { file, output, command } = data;
1684
- if (output && command && file.element?.outerXml) {
1738
+ if (output && command && ((_a = file.element) === null || _a === void 0 ? void 0 : _a.outerXml)) {
1685
1739
  const match = REGEXP_SRCSETSIZE.exec(command);
1686
1740
  if (match) {
1687
1741
  (file.srcSet || (file.srcSet = [])).push(toPosix(data.baseDirectory ? output.substring(data.baseDirectory.length + 1) : output), match[1] + match[2].toLowerCase());
@@ -1692,12 +1746,13 @@ class ChromeDocument extends Document {
1692
1746
  return false;
1693
1747
  }
1694
1748
  cloudInit({ instance }) {
1749
+ var _a, _b;
1695
1750
  this._cloudUrlMap = Object.create(null);
1696
1751
  this._cloudUploaded = new Set();
1697
1752
  this._cloudEndpoint = null;
1698
1753
  const htmlFile = this.htmlFile;
1699
1754
  if (htmlFile) {
1700
- const endpoint = instance.getStorage('upload', htmlFile.cloudStorage)?.upload?.endpoint;
1755
+ const endpoint = (_b = (_a = instance.getStorage('upload', htmlFile.cloudStorage)) === null || _a === void 0 ? void 0 : _a.upload) === null || _b === void 0 ? void 0 : _b.endpoint;
1701
1756
  if (endpoint) {
1702
1757
  this._cloudEndpoint = new RegExp((0, types_1.escapePattern)(toPosix(endpoint)) + '/', 'g');
1703
1758
  }
@@ -1710,6 +1765,7 @@ class ChromeDocument extends Document {
1710
1765
  return this.editing.includes(file);
1711
1766
  }
1712
1767
  async cloudUpload({ host }, file, url, active) {
1768
+ var _a;
1713
1769
  if (active) {
1714
1770
  const endpoint = this._cloudEndpoint;
1715
1771
  const inlineUrlCloud = file.inlineUrlCloud;
@@ -1718,7 +1774,7 @@ class ChromeDocument extends Document {
1718
1774
  if (inlineUrlCloud) {
1719
1775
  const pattern = new RegExp((0, types_1.escapePattern)(inlineUrlCloud), 'g');
1720
1776
  for (const item of this.editing) {
1721
- if (item.inlineUrlCloudMap?.[inlineUrlCloud]) {
1777
+ if ((_a = item.inlineUrlCloudMap) === null || _a === void 0 ? void 0 : _a[inlineUrlCloud]) {
1722
1778
  const source = host.getUTF8String(item);
1723
1779
  const output = source.replace(pattern, endpoint && item.imported && cloudUrl.includes('/') ? url : cloudUrl);
1724
1780
  if (source !== output) {
@@ -1733,6 +1789,7 @@ class ChromeDocument extends Document {
1733
1789
  return false;
1734
1790
  }
1735
1791
  async cloudFinalize(state) {
1792
+ var _a;
1736
1793
  if (this.aborted) {
1737
1794
  return Promise.reject((0, types_1.createAbortError)());
1738
1795
  }
@@ -1781,7 +1838,7 @@ class ChromeDocument extends Document {
1781
1838
  for (const storage of cloudStorage) {
1782
1839
  if (instance.hasCredential('storage', storage)) {
1783
1840
  const { service, admin, bucket, upload } = storage;
1784
- const website = admin?.configBucket?.website;
1841
+ const website = (_a = admin === null || admin === void 0 ? void 0 : admin.configBucket) === null || _a === void 0 ? void 0 : _a.website;
1785
1842
  if ((0, types_1.isPlainObject)(website) && bucket && upload) {
1786
1843
  let filename = joinPath(upload.pathname, upload.filename || path.basename(htmlFile.localUri));
1787
1844
  if (website.indexPage === true) {
@@ -1817,7 +1874,7 @@ class ChromeDocument extends Document {
1817
1874
  }
1818
1875
  const main = watch.main;
1819
1876
  let result;
1820
- if (main?.editing && main.mimeType === 'text/html') {
1877
+ if ((main === null || main === void 0 ? void 0 : main.editing) && main.mimeType === 'text/html') {
1821
1878
  const inlineUrlCloudMap = main.inlineUrlCloudMap || {};
1822
1879
  const using = [];
1823
1880
  let found;
@@ -1854,6 +1911,7 @@ class ChromeDocument extends Document {
1854
1911
  }
1855
1912
  watchModified(watch, assets) {
1856
1913
  return (files, errors, status) => {
1914
+ var _a;
1857
1915
  if (!watch.server || watch.captured || watch.aborted) {
1858
1916
  return;
1859
1917
  }
@@ -1873,7 +1931,7 @@ class ChromeDocument extends Document {
1873
1931
  search = next.url.search;
1874
1932
  }
1875
1933
  }
1876
- search ?? (search = restoreSearchParams(asset.url?.search));
1934
+ search !== null && search !== void 0 ? search : (search = restoreSearchParams((_a = asset.url) === null || _a === void 0 ? void 0 : _a.search));
1877
1935
  status && (status = status.filter(item => item.type >= types_1.STATUS_TYPE.FATAL && item.type <= types_1.STATUS_TYPE.WARN));
1878
1936
  watch.send(types_1.WATCH_EVENT.MODIFIED, {
1879
1937
  action: pathname && watch.hot && !watch.main ? 'hot' : '',
@@ -1945,11 +2003,13 @@ class ChromeDocument extends Document {
1945
2003
  }
1946
2004
  }
1947
2005
  findDataValue(name) {
2006
+ var _a;
1948
2007
  if (this.hasEval('template')) {
1949
- return this.templateMap.data?.[name];
2008
+ return (_a = this.templateMap.data) === null || _a === void 0 ? void 0 : _a[name];
1950
2009
  }
1951
2010
  }
1952
2011
  setInlinedAttributes({ host, startTime, hashed, contentMap, bufferMap, productionRelease }) {
2012
+ var _a, _b;
1953
2013
  const readBase64 = (item, uuid) => {
1954
2014
  if (!contentMap[uuid]) {
1955
2015
  try {
@@ -1979,7 +2039,7 @@ class ChromeDocument extends Document {
1979
2039
  const filename = hash && createHash(host, item, hash, bufferMap);
1980
2040
  if (filename) {
1981
2041
  for (const asset of this.assets) {
1982
- const url = inlineUrl ? asset.inlineUrlMap?.[inlineUrl] : asset.inlineUrlCloudMap?.[inlineUrlCloud];
2042
+ const url = inlineUrl ? (_a = asset.inlineUrlMap) === null || _a === void 0 ? void 0 : _a[inlineUrl] : (_b = asset.inlineUrlCloudMap) === null || _b === void 0 ? void 0 : _b[inlineUrlCloud];
1983
2043
  if (url) {
1984
2044
  const search = url.indexOf('?');
1985
2045
  const index = (search !== -1 ? url.substring(0, search) : url).lastIndexOf('/');
@@ -2027,10 +2087,10 @@ class ChromeDocument extends Document {
2027
2087
  const sortNested = (a, b) => {
2028
2088
  const { inlineUrlCloud: urlA, inlineUrlCloudMap: mapA } = a;
2029
2089
  const { inlineUrlCloud: urlB, inlineUrlCloudMap: mapB } = b;
2030
- if (urlA && mapB?.[urlA]) {
2090
+ if (urlA && (mapB === null || mapB === void 0 ? void 0 : mapB[urlA])) {
2031
2091
  return -1;
2032
2092
  }
2033
- if (urlB && mapA?.[urlB]) {
2093
+ if (urlB && (mapA === null || mapA === void 0 ? void 0 : mapA[urlB])) {
2034
2094
  return 1;
2035
2095
  }
2036
2096
  return 0;
@@ -2260,7 +2320,7 @@ class ChromeDocument extends Document {
2260
2320
  }
2261
2321
  }
2262
2322
  if (uri && !(0, util_1.hasValue)(item.format, 'crossorigin') && item !== htmlFile) {
2263
- if (cloud?.getStorage('upload', item.cloudStorage)) {
2323
+ if (cloud === null || cloud === void 0 ? void 0 : cloud.getStorage('upload', item.cloudStorage)) {
2264
2324
  const inlineUrlCloud = item.inlineUrlCloud || (item.inlineUrlCloud = (0, types_1.generateUUID)());
2265
2325
  ((_a = htmlFile).inlineUrlCloudMap || (_a.inlineUrlCloudMap = {}))[inlineUrlCloud] = productionRelease ? this.removeServerRoot(uri) : uri;
2266
2326
  uri = inlineUrlCloud;
@@ -2432,7 +2492,7 @@ class ChromeDocument extends Document {
2432
2492
  batchGroup.push([item]);
2433
2493
  break;
2434
2494
  default:
2435
- if (db?.hasSource(type)) {
2495
+ if (db === null || db === void 0 ? void 0 : db.hasSource(type)) {
2436
2496
  try {
2437
2497
  await db.setCredential(item);
2438
2498
  const credential = item.credential;
@@ -2465,6 +2525,7 @@ class ChromeDocument extends Document {
2465
2525
  }
2466
2526
  return this.allSettled(batchGroup.map(async (batch) => {
2467
2527
  return new Promise(async (resolve, reject) => {
2528
+ var _a, _b, _c;
2468
2529
  const errorRemove = (item, reason) => {
2469
2530
  removeElement(item);
2470
2531
  reject(reason);
@@ -2531,7 +2592,7 @@ class ChromeDocument extends Document {
2531
2592
  }
2532
2593
  else {
2533
2594
  this.abort(type);
2534
- errorRemove(current, target ? errorDataSource('Not found', target) : errorDataSource('Not defined - ' + (this.settings.directory?.data ? 'file' : 'directory'), type));
2595
+ 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));
2535
2596
  return;
2536
2597
  }
2537
2598
  }
@@ -2677,7 +2738,7 @@ class ChromeDocument extends Document {
2677
2738
  }
2678
2739
  if (!getData) {
2679
2740
  const { settings, encoding, persist = true } = current;
2680
- target || (target = settings && this.settings.export?.[settings] || pathname);
2741
+ target || (target = settings && ((_b = this.settings.export) === null || _b === void 0 ? void 0 : _b[settings]) || pathname);
2681
2742
  if (typeof target === 'function') {
2682
2743
  getData = target;
2683
2744
  hint = target.name;
@@ -2736,7 +2797,7 @@ class ChromeDocument extends Document {
2736
2797
  break;
2737
2798
  }
2738
2799
  default:
2739
- if (db?.hasSource(type)) {
2800
+ if (db === null || db === void 0 ? void 0 : db.hasSource(type)) {
2740
2801
  switch (type) {
2741
2802
  case 'mongodb':
2742
2803
  for (let j = 0; j < length; ++j) {
@@ -2960,7 +3021,7 @@ class ChromeDocument extends Document {
2960
3021
  for (let j = 0, match; j < items.length; ++j) {
2961
3022
  const row = items[j];
2962
3023
  if ((0, types_1.isPlainObject)(row)) {
2963
- row.__index__ ?? (row.__index__ = j + 1);
3024
+ (_c = row.__index__) !== null && _c !== void 0 ? _c : (row.__index__ = j + 1);
2964
3025
  }
2965
3026
  let segment = template;
2966
3027
  while (match = REGEXP_TEMPLATECONDITIONAL.exec(segment)) {
@@ -3253,6 +3314,7 @@ class ChromeDocument extends Document {
3253
3314
  }
3254
3315
  }
3255
3316
  setProductionAttributes({ host, hashed, bufferMap, startTime }) {
3317
+ var _a;
3256
3318
  for (const item of this.assets) {
3257
3319
  if (isIgnored(item, true)) {
3258
3320
  continue;
@@ -3260,7 +3322,7 @@ class ChromeDocument extends Document {
3260
3322
  if (item.hash && !hashed.has(item)) {
3261
3323
  createHash(host, item, item.hash, bufferMap);
3262
3324
  }
3263
- switch (item.element?.tagName.toLowerCase()) {
3325
+ switch ((_a = item.element) === null || _a === void 0 ? void 0 : _a.tagName.toLowerCase()) {
3264
3326
  case 'style':
3265
3327
  if (!item.content) {
3266
3328
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/chrome",
3
- "version": "0.6.6",
3
+ "version": "0.6.8",
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.8.7",
24
- "@e-mc/core": "^0.8.7",
25
- "@e-mc/document": "^0.8.7",
26
- "@e-mc/types": "^0.8.7"
23
+ "@e-mc/cloud": "^0.8.14",
24
+ "@e-mc/core": "^0.8.14",
25
+ "@e-mc/document": "^0.8.14",
26
+ "@e-mc/types": "^0.8.14"
27
27
  }
28
28
  }