@pi-r/chrome 0.12.3 → 0.12.5
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 +209 -198
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -29,10 +29,10 @@ const REGEXP_TEMPLATECOMPARISON = /\s*\(\s*(?:(eq|ne|lt|le|gt|ge)\s+)?("[^"]+"|'
|
|
|
29
29
|
const REGEXP_TEMPLATEMATCH = new RegExp(`^(?:(and|or|not)\\s+)?((?:${REGEXP_TEMPLATECOMPARISON.source})+)|(!|not\\s+)?([^\\s].*)$`, 's');
|
|
30
30
|
const REGEXP_IMPORTMODULE = /(?:(?:^|[\n;]+)\s*import\s+(?:("[^"]+"|'[^']+')|.+from\s+("[^"]+"|'[^']+')(?:[ \t]+with[ \t]+\{((?:"[^"]+"|'[^']+'|`[^`]+`|{[^{]*{|{[^}]*}|}[^}]*}|[^"'`]+)+)\})?)|\bimport\(\s*("[^"]+"|'[^']+')\s*(?:,\s*\{((?:"[^"]+"|'[^']+'|`[^`]+`|{[^{]*{|{[^}]*}|}[^}]*}|[^"'`]+)+)\}\s*)?\))/gd;
|
|
31
31
|
const REGEXP_BLOCKEXCLUDE = new RegExp(`(\\s*)<!--\\s*exclude\\s*:\\s*(?:start|end)\\s*-->` + DomWriter.PATTERN_TRAILINGSPACE, 'gi');
|
|
32
|
-
const REGEXP_STYLE = new RegExp(`(<style${DomWriter.PATTERN_TAGOPEN}*>)(.*?)(<\\/style\\s*>)`, '
|
|
32
|
+
const REGEXP_STYLE = new RegExp(`(<style${DomWriter.PATTERN_TAGOPEN}*>)(.*?)(<\\/style\\s*>)`, 'gis');
|
|
33
33
|
const REGEXP_SANITIZEALL = new RegExp(`(?:\\s+|\\b)data-(?:pathname|filename|intl-locales|(?:use|exclude)-[^=\\s]+)\\s*${DomWriter.PATTERN_ATTRVALUE}(?=(?:[^"<]+"[^"]*"|[^'<]+'[^']*')*[^<>]*>)`, 'g');
|
|
34
34
|
const REGEXP_IMAGESET_URL = /(?:^|[^(])\s*("(\s*[^)][^"]*)"|'(\s*[^)][^"]*)')\s*(?:,|$|[^)][^,]*,?)/gd;
|
|
35
|
-
const REGEXP_REPLACECSS = new RegExp(`^@import\\s+(?:url\\((?:[^)]|(?<=\\\\)\\))+\\)|"(?:[^"]|(?<=\\\\)")+"|'(?:[^']|(?<=\\\\)')+')(
|
|
35
|
+
const REGEXP_REPLACECSS = new RegExp(`^@import\\s+(?:url\\((?:[^)]|(?<=\\\\)\\))+\\)|"(?:[^"]|(?<=\\\\)")+"|'(?:[^']|(?<=\\\\)')+')((?:(?:\\s+|(?<=["'\\\\]))(?:(?:layer|supports)\\(${PATTERN_PARENTHESIS}\\)|layer\\b)){1,2})?(.*)$`, 'is');
|
|
36
36
|
function removeNamespace(name, source, newline, comments) {
|
|
37
37
|
if (source.includes('-' + name)) {
|
|
38
38
|
const [a, b, c, d, e] = CACHE_DATASET[name] ||= [
|
|
@@ -1236,18 +1236,27 @@ class ChromeDocument extends Document {
|
|
|
1236
1236
|
case "text/css": {
|
|
1237
1237
|
const match = REGEXP_REPLACECSS.exec((typeof statement === 'string' ? statement : statement[0]).trim());
|
|
1238
1238
|
if (match) {
|
|
1239
|
-
const
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1239
|
+
const trailing = match[1];
|
|
1240
|
+
let layer, supports;
|
|
1241
|
+
if (trailing) {
|
|
1242
|
+
const name = /\blayer(?:\(([^)]+)\)|\s|$)/i.exec(trailing);
|
|
1243
|
+
if (name) {
|
|
1244
|
+
layer = name[1]?.trim() || '';
|
|
1245
|
+
supports = spliceString(trailing, name.index, name.index + name[0].length, '').trim();
|
|
1246
|
+
}
|
|
1247
|
+
else {
|
|
1248
|
+
supports = trailing.trimStart();
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
const query = match[2].trim().replace(/\s*;+$/, '');
|
|
1252
|
+
if (typeof layer === 'string' || supports || query) {
|
|
1243
1253
|
const newline = getNewline(source);
|
|
1244
1254
|
let result = supports ? `@supports (${normalizeSpace(supports)}) {` + newline : '';
|
|
1245
1255
|
if (query) {
|
|
1246
1256
|
result += `@media ${normalizeSpace(query)} {` + newline;
|
|
1247
1257
|
}
|
|
1248
|
-
if (layer) {
|
|
1249
|
-
|
|
1250
|
-
result += '@layer ' + (name ? name.slice(1, -1) + ' ' : '') + `{${newline + source + newline}}` + (query ? newline + '}' : '');
|
|
1258
|
+
if (typeof layer === 'string') {
|
|
1259
|
+
result += '@layer ' + (layer ? layer + ' ' : '') + `{${newline + source + newline}}` + (query ? newline + '}' : '');
|
|
1251
1260
|
}
|
|
1252
1261
|
else if (query) {
|
|
1253
1262
|
result += source + newline + '}';
|
|
@@ -3126,10 +3135,10 @@ class ChromeDocument extends Document {
|
|
|
3126
3135
|
processUrl(host, file, source, type, importFile) {
|
|
3127
3136
|
const related = [];
|
|
3128
3137
|
const baseHref = collectBaseUrl(importFile || file, this.baseUrl);
|
|
3129
|
-
const isHtml = type === 'html';
|
|
3138
|
+
const isHtml = type === 'html' || type === 'svg';
|
|
3130
3139
|
const isJs = type === 'js';
|
|
3131
3140
|
const imageSet = /(?:\b(?<!-)|(?<!-)-webkit-)image-set\(/gi;
|
|
3132
|
-
const pattern = isJs ? /\b(?<!-)import\(/g :
|
|
3141
|
+
const pattern = isJs ? /\b(?<!-)import\(/g : !isHtml ? /(?:\b(?<!-)url\(|@import\s+(["']))/gi : /(?:\b(?<!-)url\(|@import\s+(["'])|\b(?<!-)(href)\s*=)/gi;
|
|
3133
3142
|
let length = source.length, modified = false, match;
|
|
3134
3143
|
while (match = imageSet.exec(source)) {
|
|
3135
3144
|
const startIndex = match.index + match[0].length;
|
|
@@ -3155,231 +3164,233 @@ class ChromeDocument extends Document {
|
|
|
3155
3164
|
const isUrl = !isText && !isHref;
|
|
3156
3165
|
const startIndex = match.index;
|
|
3157
3166
|
let quote = match[1], content = '', trailing = '', closed = -1, i = startIndex + match[0].length;
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
if (
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
}
|
|
3167
|
-
if (source[i - 1] !== '\\') {
|
|
3168
|
-
if (isText) {
|
|
3167
|
+
pass: {
|
|
3168
|
+
for (let j = -1; i < length; ++i) {
|
|
3169
|
+
const ch = source[i];
|
|
3170
|
+
if (quote && ch === quote) {
|
|
3171
|
+
if (!isText) {
|
|
3172
|
+
content += ch;
|
|
3173
|
+
}
|
|
3174
|
+
if (isHref) {
|
|
3169
3175
|
break;
|
|
3170
3176
|
}
|
|
3171
|
-
if (
|
|
3172
|
-
|
|
3177
|
+
if (source[i - 1] !== '\\') {
|
|
3178
|
+
if (isText) {
|
|
3179
|
+
break;
|
|
3180
|
+
}
|
|
3181
|
+
if (closed === -1) {
|
|
3182
|
+
closed = i + 1;
|
|
3183
|
+
}
|
|
3173
3184
|
}
|
|
3185
|
+
j = i + 1;
|
|
3186
|
+
continue;
|
|
3174
3187
|
}
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
break;
|
|
3188
|
+
if (!quote && (ch === '"' || ch === "'" || ch === '`' && isJs) && (isHref || !content.trim())) {
|
|
3189
|
+
quote = ch;
|
|
3190
|
+
}
|
|
3191
|
+
else if (isHref && (ch === '#' || !quote && isSpace(ch)) && content.trim()) {
|
|
3192
|
+
break pass;
|
|
3193
|
+
}
|
|
3194
|
+
else if (ch === ')') {
|
|
3195
|
+
if (isUrl) {
|
|
3196
|
+
if (quote && closed !== -1 || !quote && (isJs || source[i - 1] !== '\\')) {
|
|
3197
|
+
break;
|
|
3198
|
+
}
|
|
3199
|
+
j = i;
|
|
3188
3200
|
}
|
|
3189
|
-
j = i;
|
|
3190
3201
|
}
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3202
|
+
else if (j !== -1 && (ch === '\n' ||
|
|
3203
|
+
isText && (ch === ';' || ch === '{') ||
|
|
3204
|
+
isHref && (ch === '=' || ch === '>') ||
|
|
3205
|
+
isUrl && (ch === ';' ||
|
|
3206
|
+
!isJs && (!isHtml && (ch === ':' && !isJs || ch === '}') ||
|
|
3207
|
+
isHtml && (ch === '"' || ch === "'" || ch === ':' || ch === '>'))))) {
|
|
3208
|
+
if (closed !== -1) {
|
|
3209
|
+
i = closed;
|
|
3210
|
+
}
|
|
3211
|
+
else {
|
|
3212
|
+
i = j;
|
|
3213
|
+
content = content.slice(0, i);
|
|
3214
|
+
}
|
|
3215
|
+
break;
|
|
3200
3216
|
}
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
content = content.slice(0, i);
|
|
3217
|
+
if (closed === -1) {
|
|
3218
|
+
content += ch;
|
|
3204
3219
|
}
|
|
3205
|
-
break;
|
|
3206
3220
|
}
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
i = k;
|
|
3239
|
-
break found;
|
|
3221
|
+
const setOutputURL = (value, asset) => {
|
|
3222
|
+
if (!value) {
|
|
3223
|
+
return;
|
|
3224
|
+
}
|
|
3225
|
+
if (asset) {
|
|
3226
|
+
if (!asset.inlineBase64) {
|
|
3227
|
+
if (host.Cloud?.getStorage('upload', asset.cloudStorage)) {
|
|
3228
|
+
const inlineUrlCloud = asset.inlineUrlCloud ||= randomUUID();
|
|
3229
|
+
(file.inlineUrlCloudMap ||= {})[inlineUrlCloud] = value;
|
|
3230
|
+
value = inlineUrlCloud;
|
|
3231
|
+
}
|
|
3232
|
+
else if (asset.hash && this.productionRelease) {
|
|
3233
|
+
const inlineUrl = asset.inlineUrl ||= randomUUID();
|
|
3234
|
+
(file.inlineUrlMap ||= {})[inlineUrl] = value;
|
|
3235
|
+
value = inlineUrl;
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
const font = findFont(asset.format);
|
|
3239
|
+
if (font) {
|
|
3240
|
+
found: {
|
|
3241
|
+
for (let k = i + 1; k < length; ++k) {
|
|
3242
|
+
switch (source[k]) {
|
|
3243
|
+
case ')': {
|
|
3244
|
+
const component = source.slice(i + 1, k + 1);
|
|
3245
|
+
const format = /\s+format\([^)]+\)$/i.exec(component);
|
|
3246
|
+
if (format) {
|
|
3247
|
+
trailing = component.replace(format[0], ` format("${font}")`);
|
|
3248
|
+
i = k;
|
|
3249
|
+
break found;
|
|
3250
|
+
}
|
|
3251
|
+
break;
|
|
3240
3252
|
}
|
|
3241
|
-
|
|
3253
|
+
case ',':
|
|
3254
|
+
case ';':
|
|
3255
|
+
case ':':
|
|
3256
|
+
case '}':
|
|
3257
|
+
break found;
|
|
3242
3258
|
}
|
|
3243
|
-
case ',':
|
|
3244
|
-
case ';':
|
|
3245
|
-
case ':':
|
|
3246
|
-
case '}':
|
|
3247
|
-
break found;
|
|
3248
3259
|
}
|
|
3249
3260
|
}
|
|
3250
3261
|
}
|
|
3262
|
+
if (asset.initialValue && !asset.initialValue.cacheable) {
|
|
3263
|
+
file.flags |= 16;
|
|
3264
|
+
}
|
|
3265
|
+
related.push(asset);
|
|
3266
|
+
}
|
|
3267
|
+
if (!quote && !isHtml && !isJs) {
|
|
3268
|
+
if (!value.includes('"')) {
|
|
3269
|
+
quote = '"';
|
|
3270
|
+
}
|
|
3271
|
+
else if (!value.includes("'")) {
|
|
3272
|
+
quote = "'";
|
|
3273
|
+
}
|
|
3251
3274
|
}
|
|
3252
|
-
if (
|
|
3253
|
-
|
|
3275
|
+
if (isUrl) {
|
|
3276
|
+
const index = value.indexOf('#');
|
|
3277
|
+
if (index !== -1) {
|
|
3278
|
+
value = value.slice(0, index);
|
|
3279
|
+
}
|
|
3254
3280
|
}
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
if (!quote && !isHtml && !isJs) {
|
|
3258
|
-
if (!value.includes('"')) {
|
|
3259
|
-
quote = '"';
|
|
3281
|
+
if (quote) {
|
|
3282
|
+
value = quote + value + quote;
|
|
3260
3283
|
}
|
|
3261
|
-
|
|
3262
|
-
|
|
3284
|
+
const revised = isJs ? `import(${value + trailing})` : isHref ? 'href=' + value : (isText ? '@import ' + value : `url(${value})`) + trailing;
|
|
3285
|
+
source = spliceString(source, startIndex, i + 1, revised, pattern);
|
|
3286
|
+
length = source.length;
|
|
3287
|
+
modified = true;
|
|
3288
|
+
};
|
|
3289
|
+
let url;
|
|
3290
|
+
if (isJs) {
|
|
3291
|
+
if (!quote) {
|
|
3292
|
+
continue;
|
|
3263
3293
|
}
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3294
|
+
const target = new RegExp(`^\\s*(${quote}((?:[^${quote}]|(?<=\\\\)${quote})+)${quote})\\s*(,.+)$`).exec(content);
|
|
3295
|
+
if (target) {
|
|
3296
|
+
url = target[1].trim();
|
|
3297
|
+
trailing = target[2].trim();
|
|
3298
|
+
}
|
|
3299
|
+
else {
|
|
3300
|
+
url = trimQuote(content);
|
|
3269
3301
|
}
|
|
3270
|
-
}
|
|
3271
|
-
if (quote) {
|
|
3272
|
-
value = quote + value + quote;
|
|
3273
|
-
}
|
|
3274
|
-
const revised = isJs ? `import(${value + trailing})` : isHref ? 'href=' + value : (isText ? '@import ' + value : `url(${value})`) + trailing;
|
|
3275
|
-
source = spliceString(source, startIndex, i + 1, revised, pattern);
|
|
3276
|
-
length = source.length;
|
|
3277
|
-
modified = true;
|
|
3278
|
-
};
|
|
3279
|
-
let url;
|
|
3280
|
-
if (isJs) {
|
|
3281
|
-
if (!quote) {
|
|
3282
|
-
continue;
|
|
3283
|
-
}
|
|
3284
|
-
const target = new RegExp(`^\\s*(${quote}((?:[^${quote}]|(?<=\\\\)${quote})+)${quote})\\s*(,.+)$`).exec(content);
|
|
3285
|
-
if (target) {
|
|
3286
|
-
url = target[1].trim();
|
|
3287
|
-
trailing = target[2].trim();
|
|
3288
3302
|
}
|
|
3289
3303
|
else {
|
|
3290
3304
|
url = trimQuote(content);
|
|
3291
3305
|
}
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
if (item.base64 === base64) {
|
|
3301
|
-
setOutputURL(this.getSrcUrl(file, item)[0], item);
|
|
3302
|
-
break;
|
|
3306
|
+
if (url.startsWith('data:')) {
|
|
3307
|
+
const base64 = url.split(',')[1]?.trim();
|
|
3308
|
+
if (base64) {
|
|
3309
|
+
for (const item of this.assets) {
|
|
3310
|
+
if (item.base64 === base64) {
|
|
3311
|
+
setOutputURL(this.getSrcUrl(file, item)[0], item);
|
|
3312
|
+
break;
|
|
3313
|
+
}
|
|
3303
3314
|
}
|
|
3304
3315
|
}
|
|
3305
3316
|
}
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
+
else if (baseHref.length > 0) {
|
|
3318
|
+
let fullUrl, asset;
|
|
3319
|
+
for (const parentUrl of baseHref) {
|
|
3320
|
+
asset = host.findAsset(fullUrl = Document.resolvePath(url, parentUrl), { replaced: true });
|
|
3321
|
+
if (!asset) {
|
|
3322
|
+
const assets = this.related.get(file);
|
|
3323
|
+
asset = assets && host.findAsset(fullUrl, { assets: Array.from(assets), replaced: true });
|
|
3324
|
+
}
|
|
3325
|
+
if (asset) {
|
|
3326
|
+
break;
|
|
3327
|
+
}
|
|
3317
3328
|
}
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
valid = source.slice(k, j + 1).toLowerCase() === '@import';
|
|
3328
|
-
}
|
|
3329
|
-
else {
|
|
3330
|
-
k = startIndex;
|
|
3331
|
-
}
|
|
3332
|
-
if (valid) {
|
|
3333
|
-
let l = i, revised = SourceMap.removeSourceMappingURL(host.getUTF8String(asset))[0];
|
|
3334
|
-
for (let ch; l < length; ++l) {
|
|
3335
|
-
if ((ch = source[l]) === ';' || ch === '\n') {
|
|
3336
|
-
break;
|
|
3337
|
-
}
|
|
3329
|
+
if (asset && asset !== importFile) {
|
|
3330
|
+
if (!hasValue(asset.format, 'base64')) {
|
|
3331
|
+
if (asset.bundleReplace) {
|
|
3332
|
+
let k = 0, valid = true;
|
|
3333
|
+
if (!isText) {
|
|
3334
|
+
let j = startIndex;
|
|
3335
|
+
while (isSpace(source[--j])) { }
|
|
3336
|
+
k = j - 6;
|
|
3337
|
+
valid = source.slice(k, j + 1).toLowerCase() === '@import';
|
|
3338
3338
|
}
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
revised = layer;
|
|
3339
|
+
else {
|
|
3340
|
+
k = startIndex;
|
|
3342
3341
|
}
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
asset.flags |= 8;
|
|
3342
|
+
if (valid) {
|
|
3343
|
+
let l = i, revised = SourceMap.removeSourceMappingURL(host.getUTF8String(asset))[0];
|
|
3344
|
+
for (let ch; l < length; ++l) {
|
|
3345
|
+
if ((ch = source[l]) === ';' || ch === '\n') {
|
|
3346
|
+
break;
|
|
3347
|
+
}
|
|
3350
3348
|
}
|
|
3349
|
+
const layer = this.replaceContent(revised, source.slice(k, l + 1), "text/css");
|
|
3350
|
+
if (layer) {
|
|
3351
|
+
revised = layer;
|
|
3352
|
+
}
|
|
3353
|
+
revised = this.processUrl(host, file, this.removeServerRoot(revised), type, asset) || revised;
|
|
3354
|
+
source = spliceString(source, k, l + 1, revised, pattern);
|
|
3355
|
+
length = source.length;
|
|
3356
|
+
if (file.watch) {
|
|
3357
|
+
related.push(asset);
|
|
3358
|
+
if (!existsFlag(asset.flags)) {
|
|
3359
|
+
asset.flags |= 8;
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
else if (asset.localUri) {
|
|
3363
|
+
host.deleteFile(asset.localUri, { ignorePermission: true, emptyDir: true, all: true, id: asset.id });
|
|
3364
|
+
asset.invalid = true;
|
|
3365
|
+
}
|
|
3366
|
+
modified = true;
|
|
3367
|
+
continue;
|
|
3351
3368
|
}
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3369
|
+
}
|
|
3370
|
+
if (hasSameOrigin(asset.url || fullUrl, ...baseHref)) {
|
|
3371
|
+
let sameDir = false;
|
|
3372
|
+
[fullUrl, sameDir] = this.getSrcUrl(file, asset);
|
|
3373
|
+
if (sameDir && isJs) {
|
|
3374
|
+
fullUrl = './' + fullUrl;
|
|
3355
3375
|
}
|
|
3356
|
-
modified = true;
|
|
3357
|
-
continue;
|
|
3358
3376
|
}
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
if (sameDir && isJs) {
|
|
3364
|
-
fullUrl = './' + fullUrl;
|
|
3377
|
+
else {
|
|
3378
|
+
const pathname = file.pathname;
|
|
3379
|
+
const count = pathname && pathname !== '/' ? pathname.split('/').length : 0;
|
|
3380
|
+
fullUrl = (count ? '../'.repeat(count) : '') + asset.relativeUrl;
|
|
3365
3381
|
}
|
|
3366
3382
|
}
|
|
3367
|
-
else {
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3383
|
+
else if (!asset.invalid) {
|
|
3384
|
+
fullUrl = asset.inlineBase64 ||= randomUUID();
|
|
3385
|
+
}
|
|
3386
|
+
if (url !== fullUrl) {
|
|
3387
|
+
setOutputURL(fullUrl, asset);
|
|
3371
3388
|
}
|
|
3372
3389
|
}
|
|
3373
|
-
else if (
|
|
3374
|
-
fullUrl
|
|
3375
|
-
}
|
|
3376
|
-
if (url !== fullUrl) {
|
|
3377
|
-
setOutputURL(fullUrl, asset);
|
|
3390
|
+
else if (importFile && url !== fullUrl) {
|
|
3391
|
+
setOutputURL(fullUrl);
|
|
3378
3392
|
}
|
|
3379
3393
|
}
|
|
3380
|
-
else if (importFile && url !== fullUrl) {
|
|
3381
|
-
setOutputURL(fullUrl);
|
|
3382
|
-
}
|
|
3383
3394
|
}
|
|
3384
3395
|
}
|
|
3385
3396
|
if (modified) {
|
|
@@ -3469,7 +3480,7 @@ class ChromeDocument extends Document {
|
|
|
3469
3480
|
}
|
|
3470
3481
|
}
|
|
3471
3482
|
if ((!this.productionRelease || this.productionIncremental) && !modifiedFlag(file.flags)) {
|
|
3472
|
-
options.cacheData = { uri: !file.exported ? uri : undefined, etag: !file.modified ? file.etag : undefined, encoding: file.encoding };
|
|
3483
|
+
options.cacheData = Object.freeze({ uri: !file.exported ? uri : undefined, etag: !file.modified ? file.etag : undefined, encoding: file.encoding });
|
|
3473
3484
|
}
|
|
3474
3485
|
return options;
|
|
3475
3486
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/chrome",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.5",
|
|
4
4
|
"description": "Chrome document constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@e-mc/cloud": "^0.14.
|
|
21
|
-
"@e-mc/core": "^0.14.
|
|
22
|
-
"@e-mc/document": "^0.14.
|
|
23
|
-
"@e-mc/types": "^0.14.
|
|
20
|
+
"@e-mc/cloud": "^0.14.6",
|
|
21
|
+
"@e-mc/core": "^0.14.6",
|
|
22
|
+
"@e-mc/document": "^0.14.6",
|
|
23
|
+
"@e-mc/types": "^0.14.6",
|
|
24
24
|
"image-size": "^2.0.2"
|
|
25
25
|
}
|
|
26
26
|
}
|