@pi-r/chrome 0.5.0 → 0.6.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.
Files changed (2) hide show
  1. package/index.js +46 -38
  2. package/package.json +5 -5
package/index.js CHANGED
@@ -17,31 +17,36 @@ const CACHE_SELECTOR = new Map();
17
17
  const CACHE_DATASET = {};
18
18
  const CACHE_ATRULES = {};
19
19
  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
20
  const [PATTERN_STRING_SOME, PATTERN_STRING_MANY] = (function () {
27
21
  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
22
  return [grouping + '*', grouping + '+'];
29
23
  })();
24
+ const [REGEXP_NTHCHILD, REGEXP_NTHCHILD_UNSAFE] = (function () {
25
+ const parenthesis = '(?:,[^()]+(?=\\))|[^()]|\\([^()]*\\(+|\\([^()]*\\)|(?:\\)[^()]+)?\\)*?)+';
26
+ return [
27
+ 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'),
28
+ new RegExp(`\\(\\s*([+-])?(?:(\\d*)[nN]|(0))?\\s*([+-])?\\s*(\\d*)(?:\\s+[oO][fF]\\s+(${parenthesis})\\s*\\)|\\s*\\))`, 'g')
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 REGEXP_CONTENT = new RegExp(`\\bcontent${PATTERN_STRING_SOME}:${PATTERN_STRING_SOME}(?:"[^"]*"|'[^']*')`, 'gi');
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
- const REGEXP_VARIABLES = new RegExp(`(\\s*)(--[^\\s:]*)${PATTERN_STRING_SOME}:[^;}]*([;}])` + dom_1.DomWriter.PATTERN_TRAILINGSPACE, 'g');
40
+ const REGEXP_VARIABLES = new RegExp(`(?<!style\\()(\\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(`font-family${PATTERN_STRING_SOME}:([^;}]+)`, 'i');
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
- const REGEXP_VARIABLES_UNSAFE = new RegExp(`(\\s*)(--[^\\s:]*)\\s*:[^;}]*([;}])` + dom_1.DomWriter.PATTERN_TRAILINGSPACE, 'g');
45
+ const REGEXP_VARIABLES_UNSAFE = new RegExp(`(?<!style\\()(\\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 = /font-family\s*:([^;}]+)/i;
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,11 +54,11 @@ 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 = /(?:-webkit-)?image-set\(/gi;
57
+ const REGEXP_IMAGESET = /\b(?:-webkit-)?image-set\(/gi;
53
58
  const REGEXP_IMAGESET_URL = /(?:^|[^(])\s*("(\s*[^)][^"]*)"|'(\s*[^)][^"]*)')\s*(?:,|$|[^)][^,]*,?)/g;
54
59
  const REGEXP_REPLACECSS = /^@import\s+(?:url\((?:[^)]|(?<=\\)\))+\)|"(?:[^"]|(?<=\\)")+"|'(?:[^']|(?<=\\)')+')(\s*layer(?:\(([^)]*)\)|\b))?(?:\s*supports\(((?:\([^(]+\(|\([^)]+\)|\)[^)]+\)|(?:(?!\))[^(])+|(?:(?!\()[^)])+)+)\))?(.*?);?$/;
55
60
  function removeNamespace(name, source, newline, comments) {
56
- if (source.indexOf('-' + name) !== -1) {
61
+ if (source.includes('-' + name)) {
57
62
  const [a, b, c, d, e] = CACHE_DATASET[name] || (CACHE_DATASET[name] = [
58
63
  new RegExp(`(\\s*)<(script|style)(${dom_1.DomWriter.PATTERN_TAGOPEN}+)>[\\S\\s]*?<\\/\\2\\s*>` + dom_1.DomWriter.PATTERN_TRAILINGSPACE, 'gi'),
59
64
  new RegExp(`(\\s*)<link(${dom_1.DomWriter.PATTERN_TAGOPEN}+)>` + dom_1.DomWriter.PATTERN_TRAILINGSPACE, 'gi'),
@@ -293,7 +298,7 @@ function hasSameOrigin(value, ...other) {
293
298
  return false;
294
299
  }
295
300
  function restoreSearchParams(value, prefix = '__sqd') {
296
- if (value?.indexOf(prefix) !== -1) {
301
+ if (value?.includes(prefix)) {
297
302
  const params = new URLSearchParams(value);
298
303
  params.forEach((_, key) => key.startsWith(prefix) && params.delete(key));
299
304
  if (value = params.toString()) {
@@ -513,10 +518,10 @@ function transformURL(host, parent, type, source, importFile) {
513
518
  related.push(asset);
514
519
  }
515
520
  if (!quote && !isHtml && !isJs) {
516
- if (value.indexOf('"') === -1) {
521
+ if (!value.includes('"')) {
517
522
  quote = '"';
518
523
  }
519
- else if (value.indexOf("'") === -1) {
524
+ else if (!value.includes("'")) {
520
525
  quote = "'";
521
526
  }
522
527
  }
@@ -1598,12 +1603,14 @@ class ChromeDocument extends Document {
1598
1603
  }
1599
1604
  for (const placeholder in importMap) {
1600
1605
  const items = importMap[placeholder];
1606
+ let found;
1601
1607
  for (let i = 0, length = items.length; i < length; ++i) {
1602
1608
  const index = code.indexOf(placeholder);
1603
1609
  if (index !== -1) {
1604
1610
  const { uri, original, type, dynamic } = items[i];
1611
+ const hosted = type === 'css';
1605
1612
  let value;
1606
- if (type === 'css') {
1613
+ if (hosted) {
1607
1614
  const asset = this.host?.findAsset(uri);
1608
1615
  if (asset) {
1609
1616
  const [relativeUrl, sameDir] = getSrcURL.call(this, bundleMain || file, asset);
@@ -1615,11 +1622,12 @@ class ChromeDocument extends Document {
1615
1622
  else if (!(dynamic && file.imported !== false)) {
1616
1623
  value = this.findSourceRoot(uri);
1617
1624
  }
1618
- if (!value) {
1625
+ if (!value || !hosted && !Document.isPath(value)) {
1619
1626
  if (i < length - 1) {
1627
+ found || (found = value);
1620
1628
  continue;
1621
1629
  }
1622
- value = original;
1630
+ value = found || original;
1623
1631
  }
1624
1632
  code = spliceString(code, index, index + placeholder.length, value);
1625
1633
  modified = true;
@@ -1703,7 +1711,7 @@ class ChromeDocument extends Document {
1703
1711
  }
1704
1712
  return this.editing.includes(file);
1705
1713
  }
1706
- cloudUpload({ host }, file, url, active) {
1714
+ async cloudUpload({ host }, file, url, active) {
1707
1715
  if (active) {
1708
1716
  const endpoint = this._cloudEndpoint;
1709
1717
  const inlineUrlCloud = file.inlineUrlCloud;
@@ -1715,7 +1723,7 @@ class ChromeDocument extends Document {
1715
1723
  for (const item of this.editing) {
1716
1724
  if (item.inlineUrlCloudMap?.[inlineUrlCloud]) {
1717
1725
  const source = host.getUTF8String(item);
1718
- const output = source.replace(pattern, endpoint && item !== htmlFile && cloudUrl.indexOf('/') !== -1 ? url : cloudUrl);
1726
+ const output = source.replace(pattern, endpoint && item !== htmlFile && cloudUrl.includes('/') ? url : cloudUrl);
1719
1727
  if (source !== output) {
1720
1728
  item.sourceUTF8 = output;
1721
1729
  item.modified = true;
@@ -1725,7 +1733,7 @@ class ChromeDocument extends Document {
1725
1733
  this._cloudUploaded.add(inlineUrlCloud);
1726
1734
  }
1727
1735
  }
1728
- return Promise.resolve(false);
1736
+ return false;
1729
1737
  }
1730
1738
  async cloudFinalize(state) {
1731
1739
  if (this.aborted) {
@@ -1833,7 +1841,7 @@ class ChromeDocument extends Document {
1833
1841
  }
1834
1842
  else if (current = watch.assets.find(item => (0, asset_1.isEqual)(item, asset))) {
1835
1843
  const { inlineUrlCloud: inlineUrlCloud, initialValue = {} } = current;
1836
- if (inlineUrlCloud && inlineUrlCloudMap[inlineUrlCloud] || path.join(initialValue.pathname || asset.pathname, initialValue.filename || asset.filename).indexOf(ChromeDocument.INTERNAL_ASSIGNUUID) !== -1) {
1844
+ if (inlineUrlCloud && inlineUrlCloudMap[inlineUrlCloud] || path.join(initialValue.pathname || asset.pathname, initialValue.filename || asset.filename).includes(ChromeDocument.INTERNAL_ASSIGNUUID)) {
1837
1845
  using.push(asset);
1838
1846
  }
1839
1847
  }
@@ -1922,7 +1930,7 @@ class ChromeDocument extends Document {
1922
1930
  for (const url of items) {
1923
1931
  const resolve = sameOrigin && !Document.isURL(url);
1924
1932
  const pathname = url.split(/[\\/]/).map(seg => (0, types_1.escapePattern)(seg)).join('[\\\\/]');
1925
- const pattern = new RegExp(`(,?\\s*)(${(resolve && url[0] !== '.' ? `(?:\\.\\.[\\\\/])*\\.\\.${pathname}|` : '') + pathname})(` + (url.indexOf('?') === -1 ? '(?:(?!,)(?:[^?]|$)[^,]*)|(?!\\?)[^,]*)' : '[^,]*)'), 'g');
1933
+ const pattern = new RegExp(`(,?\\s*)(${(resolve && !url.startsWith('.') ? `(?:\\.\\.[\\\\/])*\\.\\.${pathname}|` : '') + pathname})(` + (!url.includes('?') ? '(?:(?!,)(?:[^?]|$)[^,]*)|(?!\\?)[^,]*)' : '[^,]*)'), 'g');
1926
1934
  while (match = pattern.exec(current)) {
1927
1935
  const partial = match[2];
1928
1936
  if (!resolve || baseHref.some(baseUri => uri === resolvePath(partial, baseUri))) {
@@ -2379,7 +2387,7 @@ class ChromeDocument extends Document {
2379
2387
  }
2380
2388
  if (data) {
2381
2389
  if ((0, types_1.isString)(query) && item.source !== 'mongodb') {
2382
- const pkg = query[0] === '$' ? 'jsonpath' : 'jmespath';
2390
+ const pkg = query.startsWith('$') ? 'jsonpath' : 'jmespath';
2383
2391
  try {
2384
2392
  if (pkg === 'jsonpath') {
2385
2393
  data = require(pkg).query(data, query);
@@ -2454,7 +2462,7 @@ class ChromeDocument extends Document {
2454
2462
  for (const key in batchMap) {
2455
2463
  batchGroup.push(batchMap[key]);
2456
2464
  }
2457
- return this.allSettled(batchGroup.map(batch => {
2465
+ return this.allSettled(batchGroup.map(async (batch) => {
2458
2466
  return new Promise(async (resolve, reject) => {
2459
2467
  const errorRemove = (item, reason) => {
2460
2468
  removeElement(item);
@@ -2810,10 +2818,10 @@ class ChromeDocument extends Document {
2810
2818
  }
2811
2819
  }
2812
2820
  if (data.willAbort) {
2813
- this.abort();
2821
+ this.abort(undefined, err);
2814
2822
  }
2815
2823
  else if (aborting) {
2816
- this.abort(type);
2824
+ this.abort(type, err);
2817
2825
  }
2818
2826
  if (err) {
2819
2827
  this.writeFail(["Unable to execute query" /* ERR_DB.EXEC_QUERY */, message || "Unknown" /* ERR_MESSAGE.UNKNOWN */], err instanceof Error ? errors = err : err, { type: 65536 /* LOG_TYPE.DB */, startTime });
@@ -2931,21 +2939,21 @@ class ChromeDocument extends Document {
2931
2939
  let segment = template;
2932
2940
  while (match = REGEXP_TEMPLATECONDITIONAL.exec(segment)) {
2933
2941
  const col = hasCondition(row, match[2]) ? 4 : hasCondition(row, match[5]) ? 7 : -1;
2934
- segment = replaceMatch(match, segment, match[col] ? (!match[1] || match[col - 1].indexOf('\n') !== -1 ? '' : match[1]) + match[col - 1] + match[col] : '', REGEXP_TEMPLATECONDITIONAL);
2942
+ segment = replaceMatch(match, segment, match[col] ? (!match[1] || match[col - 1].includes('\n') ? '' : match[1]) + match[col - 1] + match[col] : '', REGEXP_TEMPLATECONDITIONAL);
2935
2943
  }
2936
2944
  REGEXP_TEMPLATECONDITIONAL.lastIndex = 0;
2937
2945
  const literal = segment.trim();
2938
- if (literal[0] === '`' && literal[literal.length - 1] === '`') {
2946
+ if (literal.startsWith('`') && literal.endsWith('`')) {
2939
2947
  if (!this.hasEval('function')) {
2940
2948
  errors = (0, types_1.errorMessage)('eval', "Unsupported access" /* ERR_MESSAGE.UNSUPPORTED_ACCESS */, 'function');
2941
2949
  continue;
2942
2950
  }
2943
2951
  try {
2944
2952
  let content = new Function('return ' + literal + ';').call(row);
2945
- if (segment[0] !== '`') {
2953
+ if (!segment.startsWith('`')) {
2946
2954
  content = segment.substring(0, segment.indexOf('`')) + content;
2947
2955
  }
2948
- if (segment[segment.length - 1] !== '`') {
2956
+ if (!segment.endsWith('`')) {
2949
2957
  content += segment.substring(segment.lastIndexOf('`') + 1);
2950
2958
  }
2951
2959
  segment = content;
@@ -3005,7 +3013,7 @@ class ChromeDocument extends Document {
3005
3013
  for (const row of items) {
3006
3014
  for (let seg of segment) {
3007
3015
  seg = seg.trim();
3008
- if (seg[0] === ':' && (match = /^:join\(([\S\s]*)\)$/i.exec(seg))) {
3016
+ if (seg.startsWith(':') && (match = /^:join\(([\S\s]*)\)$/i.exec(seg))) {
3009
3017
  joinString = match[1];
3010
3018
  continue;
3011
3019
  }
@@ -3272,7 +3280,7 @@ class ChromeDocument extends Document {
3272
3280
  const parseSelector = (value) => {
3273
3281
  const items = [];
3274
3282
  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) + '`';
3283
+ 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
3284
  });
3277
3285
  let selector = '';
3278
3286
  for (let i = 0, length = revised.length, casing = false, attr = false, quote = false; i < length; i++) {
@@ -3442,7 +3450,7 @@ class ChromeDocument extends Document {
3442
3450
  pattern.lastIndex = 0;
3443
3451
  };
3444
3452
  replaceBracket(REGEXP_COMMENT);
3445
- replaceBracket(REGEXP_CONTENT);
3453
+ replaceBracket(REGEXP_QUOTEDVALUE);
3446
3454
  const values = (0, util_1.splitEnclosing)(current, /\burl/gi);
3447
3455
  for (let i = 0, length = values.length; i < length; ++i) {
3448
3456
  const seg = values[i];
@@ -3500,7 +3508,7 @@ class ChromeDocument extends Document {
3500
3508
  }
3501
3509
  first = false;
3502
3510
  }
3503
- const sibling = match[2][0] === ',';
3511
+ const sibling = match[2].startsWith(',');
3504
3512
  const trailing = match[4];
3505
3513
  const offset = trailing && !sibling ? /^,\s*/.exec(trailing)[0].length : 1;
3506
3514
  header = header.substring(0, start - (sibling ? match[2].length : 0)) + header.substring(start + match[3].length + (trailing ? sibling ? 0 : offset : /\s$/.test(match[3]) ? -1 : 0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/chrome",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
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.7.0",
24
- "@e-mc/core": "^0.7.0",
25
- "@e-mc/document": "^0.7.0",
26
- "@e-mc/types": "^0.7.0"
23
+ "@e-mc/cloud": "^0.8.0",
24
+ "@e-mc/core": "^0.8.0",
25
+ "@e-mc/document": "^0.8.0",
26
+ "@e-mc/types": "^0.8.0"
27
27
  }
28
28
  }