@pi-r/chrome 0.3.6 → 0.3.7

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 (3) hide show
  1. package/index.js +142 -114
  2. package/package.json +1 -1
  3. package/types/index.d.ts +2 -1
package/index.js CHANGED
@@ -46,9 +46,13 @@ const REGEXP_VARIABLES_UNSAFE = new RegExp(`(\\s*)(--[^\\s:]*)\\s*:[^;}]*([;}])`
46
46
  const REGEXP_FONTFACE_UNSAFE = new RegExp(`(\\s*)@font-face\\s*{([^}]+)}` + dom_1.DomWriter.PATTERN_TRAILINGSPACE, 'gi');
47
47
  const REGEXP_FONTFAMILY_UNSAFE = /font-family\s*:([^;}]+)/i;
48
48
  const REGEXP_KEYFRAMES_UNSAFE = /(\s*)@keyframes\s+([^{]+){/gi;
49
+ const REGEXP_OBJECT_NAME = /([^[.\s]+)((?:\s*\[[^\]]+\]\s*)+)?\s*\.?\s*/g;
50
+ const REGEXP_OBJECT_SUBSCRIPT = /\[\s*(["'])?(.+?)\1\s*\]/g;
51
+ const REGEXP_TEMPLATE_LEADING = /\s*\{\{- \s*((?:[^}]|}(?!}))+?)\}\}/g;
52
+ const REGEXP_TEMPLATE_TRAILING = /\{\{((?:[^}]|}(?!}))+?)\s*? -\}\}\s*/g;
49
53
  function removeNamespace(name, source, newline, comments) {
50
54
  if (source.indexOf('-' + name) !== -1) {
51
- const dataset = CACHE_DATASET[name] || (CACHE_DATASET[name] = [
55
+ const [a, b, c, d, e] = CACHE_DATASET[name] || (CACHE_DATASET[name] = [
52
56
  new RegExp(`(\\s*)<(script|style)(${dom_1.DomWriter.PATTERN_TAGOPEN}+)>[\\S\\s]*?<\\/\\2\\s*>` + dom_1.DomWriter.PATTERN_TRAILINGSPACE, 'gi'),
53
57
  new RegExp(`(\\s*)<link(${dom_1.DomWriter.PATTERN_TAGOPEN}+)>` + dom_1.DomWriter.PATTERN_TRAILINGSPACE, 'gi'),
54
58
  new RegExp(`\\s+data-${name}-[a-z-]+\\s*` + dom_1.DomWriter.PATTERN_ATTRVALUE, 'g'),
@@ -56,24 +60,26 @@ function removeNamespace(name, source, newline, comments) {
56
60
  new RegExp(`data-${name}-template\\s*` + dom_1.DomWriter.PATTERN_ATTRVALUE)
57
61
  ]);
58
62
  source = source
59
- .replace(dataset[0], (...capture) => dataset[3].test(capture[3]) || dataset[4].test(capture[3]) ? getNewlineString(capture[1], capture[7], newline) : capture[0])
60
- .replace(dataset[1], (...capture) => dataset[3].test(capture[2]) ? getNewlineString(capture[1], capture[6], newline) : capture[0])
61
- .replace(dataset[2], '');
63
+ .replace(a, (...capture) => d.test(capture[3]) || e.test(capture[3]) ? getNewlineString(capture[1], capture[7], newline) : capture[0])
64
+ .replace(b, (...capture) => d.test(capture[2]) ? getNewlineString(capture[1], capture[6], newline) : capture[0])
65
+ .replace(c, '');
62
66
  }
63
67
  return (0, types_1.isArray)(comments) ? source.replace(REGEXP_BLOCKEXCLUDE, (...capture) => getNewlineString(capture[1], capture[2], newline)) : source;
64
68
  }
65
69
  function getObjectValue(value, key) {
66
- const pattern = /([^[.\s]+)((?:\s*\[[^\]]+\]\s*)+)?\s*\.?\s*/g;
70
+ REGEXP_OBJECT_NAME.lastIndex = 0;
67
71
  let found, match;
68
- while (match = pattern.exec(key)) {
72
+ while (match = REGEXP_OBJECT_NAME.exec(key)) {
69
73
  if ((0, types_1.isObject)(value)) {
70
74
  value = value[match[1]];
71
- if (match[2]) {
72
- const subscript = /\[\s*(["'])?(.+?)\1\s*\]/g;
75
+ const name = match[2];
76
+ if (name) {
77
+ REGEXP_OBJECT_SUBSCRIPT.lastIndex = 0;
73
78
  let index;
74
- while (index = subscript.exec(match[2])) {
75
- const attr = index[1] ? index[2] : index[2].trim();
76
- if (index[1] && (0, types_1.isObject)(value) || /^\d+$/.test(attr) && (typeof value === 'string' || (0, types_1.isObject)(value))) {
79
+ while (index = REGEXP_OBJECT_SUBSCRIPT.exec(name)) {
80
+ const quote = index[1];
81
+ const attr = quote ? index[2] : index[2].trim();
82
+ if (quote && (0, types_1.isObject)(value) || /^\d+$/.test(attr) && (typeof value === 'string' || (0, types_1.isObject)(value))) {
77
83
  value = value[attr];
78
84
  }
79
85
  else {
@@ -91,14 +97,14 @@ function getObjectValue(value, key) {
91
97
  return found ? value : null;
92
98
  }
93
99
  function trimTemplate(value) {
94
- const leading = /\s*\{\{- \s*((?:[^}]|}(?!}))+?)\}\}/g;
100
+ REGEXP_TEMPLATE_LEADING.lastIndex = 0;
95
101
  let match;
96
- while (match = leading.exec(value)) {
97
- value = replaceMatch(match, value, 1, leading);
102
+ while (match = REGEXP_TEMPLATE_LEADING.exec(value)) {
103
+ value = replaceMatch(match, value, 1, REGEXP_TEMPLATE_LEADING);
98
104
  }
99
- const trailing = /\{\{((?:[^}]|}(?!}))+?)\s*? -\}\}\s*/g;
100
- while (match = trailing.exec(value)) {
101
- value = replaceMatch(match, value, 1, trailing);
105
+ REGEXP_TEMPLATE_TRAILING.lastIndex = 0;
106
+ while (match = REGEXP_TEMPLATE_TRAILING.exec(value)) {
107
+ value = replaceMatch(match, value, 1, REGEXP_TEMPLATE_TRAILING);
102
108
  }
103
109
  return value;
104
110
  }
@@ -176,9 +182,9 @@ function hasCondition(data, condition) {
176
182
  }
177
183
  let match = REGEXP_TEMPLATEMATCH.exec(condition.trim());
178
184
  if (match) {
179
- if (match[2]) {
185
+ const comparison = match[2];
186
+ if (comparison) {
180
187
  const join = match[1];
181
- const comparison = match[2];
182
188
  const items = [];
183
189
  while (match = REGEXP_TEMPLATECOMPARISON.exec(comparison)) {
184
190
  if (items.length && !isSpace(match[0][0])) {
@@ -283,17 +289,14 @@ function hasSameOrigin(value, ...other) {
283
289
  return false;
284
290
  }
285
291
  function restoreSearchParams(value, prefix = '__sqd') {
286
- if (value) {
287
- if (value.indexOf(prefix) !== -1) {
288
- const params = new URLSearchParams(value);
289
- params.forEach((_, key) => key.startsWith(prefix) && params.delete(key));
290
- if (value = params.toString()) {
291
- return '?' + value;
292
- }
292
+ if ((value === null || value === void 0 ? void 0 : value.indexOf(prefix)) !== -1) {
293
+ const params = new URLSearchParams(value);
294
+ params.forEach((_, key) => key.startsWith(prefix) && params.delete(key));
295
+ if (value = params.toString()) {
296
+ return '?' + value;
293
297
  }
294
- return value;
295
298
  }
296
- return '';
299
+ return value || '';
297
300
  }
298
301
  function getBaseURLs(asset, baseUrl) {
299
302
  const result = [];
@@ -323,26 +326,27 @@ function getBaseURLs(asset, baseUrl) {
323
326
  }
324
327
  function createHash(host, file, bufferMap) {
325
328
  const hash = file.hash;
326
- if (hash) {
327
- try {
328
- const localUri = file.localUri;
329
- const buffer = localUri && bufferMap[localUri] || getBuffer(file);
330
- if (buffer) {
331
- const [algorithm, length] = (0, util_1.getHashData)(hash);
332
- let value;
333
- if (algorithm && (value = Document.asHash(buffer, { algorithm, encoding: file.encoding }))) {
334
- if (localUri) {
335
- bufferMap[localUri] = buffer;
336
- }
337
- host.rename(file, (0, util_1.appendSuffix)(file.filename, length ? value.substring(0, length) : value));
338
- return file.filename;
329
+ if (!hash) {
330
+ return;
331
+ }
332
+ const { filename, localUri } = file;
333
+ try {
334
+ const buffer = localUri && bufferMap[localUri] || getBuffer(file);
335
+ if (buffer) {
336
+ const [algorithm, length] = (0, util_1.getHashData)(hash);
337
+ let value;
338
+ if (algorithm && (value = Document.asHash(buffer, { algorithm, encoding: file.encoding }))) {
339
+ if (localUri) {
340
+ bufferMap[localUri] = buffer;
339
341
  }
342
+ host.rename(file, (0, util_1.appendSuffix)(filename, length ? value.substring(0, length) : value));
343
+ return file.filename;
340
344
  }
341
- throw (0, types_1.errorMessage)('hash', 'Source not found', file.filename);
342
- }
343
- catch (err) {
344
- host.writeFail(["Unable to read file", file.filename], err, 32);
345
345
  }
346
+ throw (0, types_1.errorMessage)('hash', 'Source not found', filename);
347
+ }
348
+ catch (err) {
349
+ host.writeFail(["Unable to read file", filename], err, 32);
346
350
  }
347
351
  }
348
352
  function getSrcURL(parent, file) {
@@ -664,7 +668,7 @@ function transformOptions(file, mimeType, code, bundleContent) {
664
668
  const metadata = { userAgentData: this.userAgentData };
665
669
  switch (mimeType) {
666
670
  case 'text/html':
667
- metadata['__fromhtml__'] = true;
671
+ metadata.__fromhtml__ = true;
668
672
  case 'text/css':
669
673
  Object.assign(metadata, this.config);
670
674
  default:
@@ -763,11 +767,12 @@ function replaceCss(file) {
763
767
  map[id] = this.removeServerRoot(map[id]);
764
768
  }
765
769
  };
766
- if (file.inlineUrlMap) {
767
- sanitize(file.inlineUrlMap);
770
+ const { inlineUrlMap, inlineUrlCloudMap } = file;
771
+ if (inlineUrlMap) {
772
+ sanitize(inlineUrlMap);
768
773
  }
769
- if (file.inlineUrlCloudMap) {
770
- sanitize(file.inlineUrlCloudMap);
774
+ if (inlineUrlCloudMap) {
775
+ sanitize(inlineUrlCloudMap);
771
776
  }
772
777
  }
773
778
  function replaceHtml(source, { productionRelease, contentMap }, cssMap) {
@@ -843,6 +848,10 @@ async function checkData(item, name, result, validate) {
843
848
  }
844
849
  }
845
850
  }
851
+ function getBuffer(item) {
852
+ let localUri;
853
+ return item.sourceUTF8 || item.buffer || ((localUri = item.localUri) && isPath(localUri) ? fs.readFileSync(localUri, item.encoding) : null);
854
+ }
846
855
  const getNewlineString = dom_1.DomWriter.getNewlineString.bind(dom_1.DomWriter);
847
856
  const isSpace = dom_1.DomWriter.isSpace.bind(dom_1.DomWriter);
848
857
  const replaceMatch = dom_1.DomWriter.replaceMatch.bind(dom_1.DomWriter);
@@ -853,11 +862,10 @@ const asString = Document.asString.bind(Document);
853
862
  const resolvePath = Document.resolvePath.bind(Document);
854
863
  const toPosix = Document.toPosix.bind(Document);
855
864
  const isDir = Document.isDir.bind(Document);
856
- const hasSourceMap = (metadata, value) => (0, types_1.isObject)(metadata) && metadata['__sourcemap__'] === value;
865
+ const hasSourceMap = (metadata, value) => (0, types_1.isObject)(metadata) && metadata.__sourcemap__ === value;
857
866
  const isBundled = (value, main) => typeof value === 'number' && (value > 0 || main && value === 0);
858
867
  const isFont = (value) => value === 'truetype' || value === 'opentype' || value === 'woff' || value === 'woff2';
859
868
  const isImage = (value) => typeof value === 'string' && value.startsWith('image/') && value !== 'image/svg+xml';
860
- const getBuffer = (item) => item.sourceUTF8 || item.buffer || (item.localUri && isPath(item.localUri) ? fs.readFileSync(item.localUri, item.encoding) : null);
861
869
  const isRemoved = (item) => item.exclude === true || isBundled(item.bundleIndex);
862
870
  const isUnedited = (item) => !item.attributes && !item.inlineContent && !item.srcSet && !item.element.dynamic && item.element.textContent === undefined && (!item.uri && !isBundled(item.bundleIndex, true) || (0, util_1.hasValue)(item.format, 'crossorigin'));
863
871
  const isIgnored = (item, exists) => item.invalid || (0, types_1.ignoreFlag)(item.flags) || !exists && (0, types_1.existsFlag)(item.flags);
@@ -1073,15 +1081,16 @@ class ChromeDocument extends Document {
1073
1081
  const items = new Set((asset.watch.assets || []));
1074
1082
  (function recurse(children) {
1075
1083
  for (const item of children) {
1076
- if (!items.has(item)) {
1077
- if (isWatched.call(instance, item)) {
1078
- item.flags |= 8;
1079
- }
1080
- items.add(item);
1081
- const next = related.get(item);
1082
- if (next) {
1083
- recurse(next);
1084
- }
1084
+ if (items.has(item)) {
1085
+ continue;
1086
+ }
1087
+ if (isWatched.call(instance, item)) {
1088
+ item.flags |= 8;
1089
+ }
1090
+ items.add(item);
1091
+ const next = related.get(item);
1092
+ if (next) {
1093
+ recurse(next);
1085
1094
  }
1086
1095
  }
1087
1096
  })(includes);
@@ -1090,34 +1099,37 @@ class ChromeDocument extends Document {
1090
1099
  }
1091
1100
  }
1092
1101
  let productionRelease = instance.productionRelease;
1093
- if ((0, types_1.isString)(productionRelease)) {
1094
- if (path.isAbsolute(productionRelease = path.normalize(productionRelease)) && isDir(productionRelease)) {
1095
- if (this.canWrite(productionRelease)) {
1096
- const serverRoot = ChromeDocument.INTERNAL_SERVERROOT;
1097
- const srcDir = path.join(this.baseDirectory, serverRoot);
1098
- if (isDir(srcDir)) {
1099
- const result = await Document.copyDir(srcDir, productionRelease, this.incremental !== 'staging');
1100
- const failed = result.failed.map(value => this.removeCwd(value));
1101
- for (const value of this.files) {
1102
- if (value.startsWith(serverRoot)) {
1103
- if (!failed.includes(value)) {
1104
- this.delete(value);
1105
- }
1106
- else {
1107
- instance.writeFail(["Unable to move file", instance.moduleName], (0, types_1.errorMessage)('production', path.join(this.baseDirectory, value)), { fatal: true });
1108
- }
1109
- }
1110
- }
1111
- }
1102
+ if (!(0, types_1.isString)(productionRelease)) {
1103
+ return;
1104
+ }
1105
+ if (path.isAbsolute(productionRelease = path.normalize(productionRelease)) && isDir(productionRelease)) {
1106
+ if (this.canWrite(productionRelease)) {
1107
+ const serverRoot = ChromeDocument.INTERNAL_SERVERROOT;
1108
+ const srcDir = path.join(this.baseDirectory, serverRoot);
1109
+ if (!isDir(srcDir)) {
1110
+ return;
1112
1111
  }
1113
- else {
1114
- instance.writeFail(["Unable to write directory", instance.moduleName], (0, types_1.errorMessage)('production', 'Access denied', productionRelease));
1112
+ const result = await Document.copyDir(srcDir, productionRelease, this.incremental !== 'staging');
1113
+ const failed = result.failed.map(value => this.removeCwd(value));
1114
+ for (const value of this.files) {
1115
+ if (!value.startsWith(serverRoot)) {
1116
+ continue;
1117
+ }
1118
+ if (!failed.includes(value)) {
1119
+ this.delete(value);
1120
+ }
1121
+ else {
1122
+ instance.writeFail(["Unable to move file", instance.moduleName], (0, types_1.errorMessage)('production', path.join(this.baseDirectory, value)), { fatal: true });
1123
+ }
1115
1124
  }
1116
1125
  }
1117
1126
  else {
1118
- instance.writeFail(["Unable to read directory", instance.moduleName], (0, types_1.errorMessage)('production', 'Invalid directory', productionRelease), 32);
1127
+ instance.writeFail(["Unable to write directory", instance.moduleName], (0, types_1.errorMessage)('production', 'Access denied', productionRelease));
1119
1128
  }
1120
1129
  }
1130
+ else {
1131
+ instance.writeFail(["Unable to read directory", instance.moduleName], (0, types_1.errorMessage)('production', 'Invalid directory', productionRelease), 32);
1132
+ }
1121
1133
  }
1122
1134
  static sanitizeAssets(assets, exclusions = []) {
1123
1135
  assets.forEach(item => {
@@ -1198,6 +1210,7 @@ class ChromeDocument extends Document {
1198
1210
  }
1199
1211
  return 0;
1200
1212
  });
1213
+ let imports;
1201
1214
  if (config) {
1202
1215
  const { useUnsafeReplace, baseUrl, productionRelease, productionIncremental, templateMap, userAgentData, cache } = config;
1203
1216
  const target = this.config;
@@ -1244,25 +1257,37 @@ class ChromeDocument extends Document {
1244
1257
  if ((0, types_1.isObject)(userAgentData)) {
1245
1258
  this.userAgentData = userAgentData;
1246
1259
  }
1247
- const imports = (0, types_1.isPlainObject)(config.imports) ? { ...this.module.imports, ...config.imports } : this.module.imports;
1248
- if (imports) {
1249
- this.imports = imports;
1250
- }
1251
1260
  if ((0, types_1.isObject)(cache) && 'transform' in cache) {
1252
1261
  this.customize({ transform: cache.transform });
1253
1262
  }
1263
+ if (!(0, types_1.isPlainObject)(imports = config.imports)) {
1264
+ imports = undefined;
1265
+ }
1254
1266
  }
1255
1267
  super.init(assets, config);
1256
1268
  const mimeMap = this._mimeMap;
1257
- if (mimeMap && 'format' in mimeMap) {
1258
- const format = mimeMap.format;
1259
- if ((0, types_1.isObject)(format)) {
1260
- this.formatMap = 'pathname' in format || 'filename' in format || 'dictionary' in format ? { uuid: format } : format;
1269
+ if (mimeMap) {
1270
+ if ('imports' in mimeMap) {
1271
+ const imported = mimeMap.imports;
1272
+ if ((0, types_1.isPlainObject)(imported)) {
1273
+ imports = imports ? Object.assign(imported, imports) : imported;
1274
+ }
1275
+ delete mimeMap.imports;
1261
1276
  }
1262
- else {
1263
- this.formatMap = undefined;
1277
+ if ('format' in mimeMap) {
1278
+ const format = mimeMap.format;
1279
+ if ((0, types_1.isObject)(format)) {
1280
+ this.formatMap = 'pathname' in format || 'filename' in format || 'dictionary' in format ? { uuid: format } : format;
1281
+ }
1282
+ else {
1283
+ this.formatMap = undefined;
1284
+ }
1285
+ delete mimeMap.format;
1264
1286
  }
1265
1287
  }
1288
+ if (imports) {
1289
+ this.imports = imports;
1290
+ }
1266
1291
  for (const storage of cloud) {
1267
1292
  for (const { service, upload, download } of storage) {
1268
1293
  if (upload) {
@@ -1690,8 +1715,9 @@ class ChromeDocument extends Document {
1690
1715
  this._cloudUrlMap = Object.create(null);
1691
1716
  this._cloudUploaded = new Set();
1692
1717
  this._cloudEndpoint = null;
1693
- if (this.htmlFile) {
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;
1718
+ const htmlFile = this.htmlFile;
1719
+ if (htmlFile) {
1720
+ 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;
1695
1721
  if (endpoint) {
1696
1722
  this._cloudEndpoint = new RegExp((0, types_1.escapePattern)(toPosix(endpoint)) + '/', 'g');
1697
1723
  }
@@ -1872,9 +1898,7 @@ class ChromeDocument extends Document {
1872
1898
  }
1873
1899
  }
1874
1900
  search !== null && search !== void 0 ? search : (search = restoreSearchParams((_a = asset.url) === null || _a === void 0 ? void 0 : _a.search));
1875
- if (status) {
1876
- status = status.filter(item => item.type >= types_1.STATUS_TYPE.FATAL && item.type <= types_1.STATUS_TYPE.WARN);
1877
- }
1901
+ status && (status = status.filter(item => item.type >= types_1.STATUS_TYPE.FATAL && item.type <= types_1.STATUS_TYPE.WARN));
1878
1902
  watch.send(types_1.WATCH_EVENT.MODIFIED, {
1879
1903
  action: pathname && watch.hot && !watch.main ? 'hot' : '',
1880
1904
  type: asset.mimeType,
@@ -2051,8 +2075,9 @@ class ChromeDocument extends Document {
2051
2075
  item.modified = true;
2052
2076
  }
2053
2077
  source = sanitizeSource(item, source);
2054
- if (item.format) {
2055
- const result = await this.transform('html', source, item.format, transformOptions.call(this, item, 'image/svg+xml'));
2078
+ const format = item.format;
2079
+ if (format) {
2080
+ const result = await this.transform('html', source, format, transformOptions.call(this, item, 'image/svg+xml'));
2056
2081
  if (result) {
2057
2082
  item.modified = true;
2058
2083
  source = result.code;
@@ -2162,11 +2187,12 @@ class ChromeDocument extends Document {
2162
2187
  await this.setElementAttributes(processing, domBase);
2163
2188
  await this.applyDataSource(processing, domBase);
2164
2189
  for (const item of this.assets) {
2165
- if (item.element && isRemoved(item) && !(0, types_1.ignoreFlag)(item.flags)) {
2166
- const domElement = new dom_1.HtmlElement(moduleName, item.element, item.attributes);
2190
+ const element = item.element;
2191
+ if (element && isRemoved(item) && !(0, types_1.ignoreFlag)(item.flags)) {
2192
+ const domElement = new dom_1.HtmlElement(moduleName, element, item.attributes);
2167
2193
  domElement.remove = true;
2168
2194
  if (!domBase.write(domElement)) {
2169
- this.writeFail('Unable to exclude HTML element', errorHtml(item.element), 4);
2195
+ this.writeFail('Unable to exclude HTML element', errorHtml(element), 4);
2170
2196
  }
2171
2197
  }
2172
2198
  }
@@ -2187,13 +2213,15 @@ class ChromeDocument extends Document {
2187
2213
  if ((0, types_1.isString)(config.stripCommentsAndCDATA)) {
2188
2214
  source = dom_1.DomWriter.getCommentsAndCDATA(source, config.stripCommentsAndCDATA, true, true);
2189
2215
  }
2190
- if (htmlFile.format) {
2191
- const result = await this.transform('html', source, htmlFile.format, {
2216
+ const format = htmlFile.format;
2217
+ if (format) {
2218
+ const { filename, uri, encoding, metadata } = htmlFile;
2219
+ const result = await this.transform('html', source, format, {
2192
2220
  pathname: path.dirname(localUri),
2193
- filename: htmlFile.filename,
2221
+ filename,
2194
2222
  mimeType: 'text/html',
2195
- metadata: Object.assign({ '__fromhtml__': true, ...this.config }, htmlFile.metadata),
2196
- cacheData: !productionRelease || this.productionIncremental ? { uri: htmlFile.uri, encoding: htmlFile.encoding } : undefined
2223
+ metadata: Object.assign({ '__fromhtml__': true, ...this.config }, metadata),
2224
+ cacheData: !productionRelease || this.productionIncremental ? { uri, encoding } : undefined
2197
2225
  });
2198
2226
  if (result) {
2199
2227
  source = result.code;
@@ -2227,12 +2255,12 @@ class ChromeDocument extends Document {
2227
2255
  const cloud = host.Cloud;
2228
2256
  const removeWatchReload = (item) => (0, types_1.isObject)(item.watch) && delete item.watch.reload;
2229
2257
  for (const item of this.assets) {
2230
- const element = item.element;
2258
+ const { element, inlineContent } = item;
2231
2259
  if (!element || element.removed || isRemoved(item) || isUnedited(item) || (0, types_1.ignoreFlag)(item.flags) && !(0, types_1.processFlag)(item.flags)) {
2232
2260
  continue;
2233
2261
  }
2234
2262
  const domElement = new dom_1.HtmlElement(moduleName, element, item.attributes);
2235
- if (item.inlineContent) {
2263
+ if (inlineContent) {
2236
2264
  let [innerXml, sourceMappingURL, inlineMap] = transform_1.SourceMap.removeSourceMappingURL(host.getUTF8String(item).trim());
2237
2265
  if (sourceMappingURL && !inlineMap && item.localUri) {
2238
2266
  let mapUri = path.resolve(sourceMappingURL = decodeURIComponent(sourceMappingURL));
@@ -2241,7 +2269,7 @@ class ChromeDocument extends Document {
2241
2269
  }
2242
2270
  host.deleteFile(mapUri);
2243
2271
  }
2244
- domElement.tagName = item.inlineContent;
2272
+ domElement.tagName = inlineContent;
2245
2273
  domElement.innerXml = innerXml;
2246
2274
  domElement.removeAttribute('src', 'href');
2247
2275
  }
@@ -2331,10 +2359,10 @@ class ChromeDocument extends Document {
2331
2359
  }
2332
2360
  }
2333
2361
  if (!domBase.write(domElement)) {
2334
- this.writeFail(item.inlineContent ? 'Inline tag replacement' : 'Element attribute replacement', errorHtml(element), { type: 4, startTime });
2362
+ this.writeFail(inlineContent ? 'Inline tag replacement' : 'Element attribute replacement', errorHtml(element), { type: 4, startTime });
2335
2363
  delete item.inlineUrlCloud;
2336
2364
  }
2337
- else if (item.inlineContent) {
2365
+ else if (inlineContent) {
2338
2366
  host.removeAsset(item);
2339
2367
  removeWatchReload(item);
2340
2368
  }
@@ -2931,7 +2959,7 @@ class ChromeDocument extends Document {
2931
2959
  for (let j = 0, match; j < items.length; ++j) {
2932
2960
  const row = items[j];
2933
2961
  if ((0, types_1.isPlainObject)(row)) {
2934
- (_c = row['__index__']) !== null && _c !== void 0 ? _c : (row['__index__'] = j + 1);
2962
+ (_c = row.__index__) !== null && _c !== void 0 ? _c : (row.__index__ = j + 1);
2935
2963
  }
2936
2964
  let segment = template;
2937
2965
  while (match = REGEXP_TEMPLATECONDITIONAL.exec(segment)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/chrome",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Chrome document constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
package/types/index.d.ts CHANGED
@@ -104,10 +104,11 @@ export interface IChromeDocument<T extends IFileManager<U>, U extends DocumentAs
104
104
  cloudObject(state: CloudScopeOrigin<T, U, V>, file: U): boolean;
105
105
  cloudUpload(state: CloudScopeOrigin<T, U, V>, file: U, url: string, active: boolean): Promise<boolean>;
106
106
  cloudFinalize(state: CloudScopeOrigin<T, U, V>): Promise<unknown[]>;
107
- get settings(): ChromeDocumentSettings;
108
107
  get editing(): U[];
108
+ set dataSource(value);
109
109
  get dataSource(): DataSource[];
110
110
  get elements(): XmlTagNode[];
111
+ get settings(): ChromeDocumentSettings;
111
112
  }
112
113
 
113
114
  export interface ChromeDocumentConstructor<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends DocumentConstructor<T, U> {