single-file-core 1.3.3 → 1.3.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.
@@ -533,7 +533,7 @@ function getProcessorHelperClass(utilInstance) {
533
533
  fontTests.set(source.src, source.valid);
534
534
  }
535
535
  }));
536
- const findSourceByFormat = (fontFormat, testValidity) => fontInfo.find(source => !source.src.match(EMPTY_URL_SOURCE) && source.format == fontFormat && (!testValidity || source.valid));
536
+ const findSourceByFormat = (fontFormat, testValidity) => fontInfo.findLast(source => !source.src.match(EMPTY_URL_SOURCE) && source.format == fontFormat && (!testValidity || source.valid));
537
537
  const filterSources = fontSource => fontInfo.filter(source => source == fontSource || source.src.startsWith(LOCAL_SOURCE));
538
538
  stats.fonts.processed += fontInfo.length;
539
539
  stats.fonts.discarded += fontInfo.length;
@@ -74,12 +74,12 @@ function getProcessorHelperClass(utilInstance) {
74
74
 
75
75
  async processStylesheetElement(element, stylesheetInfo, stylesheets, baseURI, options, workStyleElement, resources) {
76
76
  if (!options.blockStylesheets) {
77
+ stylesheets.set({ element }, stylesheetInfo);
77
78
  if (element.tagName.toUpperCase() == "LINK") {
78
79
  await this.resolveLinkStylesheetURLs(stylesheetInfo, element, element.href, baseURI, options, workStyleElement, resources, stylesheets);
79
80
  } else {
80
81
  stylesheetInfo.stylesheet = cssTree.parse(element.textContent, { context: "stylesheet", parseCustomProperty: true });
81
82
  await this.resolveImportURLs(stylesheetInfo, baseURI, options, workStyleElement, resources, stylesheets);
82
- stylesheets.set({ element }, stylesheetInfo);
83
83
  }
84
84
  } else {
85
85
  if (element.tagName.toUpperCase() == "LINK") {
@@ -150,15 +150,10 @@ function getProcessorHelperClass(utilInstance) {
150
150
  };
151
151
  const content = await this.getStylesheetContent(resourceURL, options);
152
152
  stylesheetInfo.url = resourceURL = content.resourceURL;
153
- const existingStylesheet = Array.from(stylesheets).find(([, stylesheetInfo]) => stylesheetInfo.resourceURL == resourceURL);
154
- if (existingStylesheet) {
155
- stylesheets.set({ urlNode }, { url: resourceURL, stylesheet: existingStylesheet[1].stylesheet, scoped });
156
- } else {
157
- content.data = getUpdatedResourceContent(resourceURL, options) || content.data;
158
- stylesheetInfo.stylesheet = cssTree.parse(content.data, { context: "stylesheet", parseCustomProperty: true });
159
- await this.resolveImportURLs(stylesheetInfo, resourceURL, options, workStylesheet, resources, stylesheets);
160
- stylesheets.set({ urlNode }, stylesheetInfo);
161
- }
153
+ content.data = getUpdatedResourceContent(resourceURL, options) || content.data;
154
+ stylesheetInfo.stylesheet = cssTree.parse(content.data, { context: "stylesheet", parseCustomProperty: true });
155
+ await this.resolveImportURLs(stylesheetInfo, resourceURL, options, workStylesheet, resources, stylesheets);
156
+ stylesheets.set({ urlNode }, stylesheetInfo);
162
157
  }
163
158
  }
164
159
  }
@@ -195,18 +190,9 @@ function getProcessorHelperClass(utilInstance) {
195
190
  this.resolveLinkStylesheetURLs(stylesheetInfo, element, resourceURL, baseURI, options, workStylesheet, resources, stylesheets);
196
191
  }
197
192
  resourceURL = content.resourceURL;
198
- if (existingStylesheet) {
199
- stylesheets.set({ element }, {
200
- url: resourceURL,
201
- stylesheet: existingStylesheet[1].stylesheet,
202
- mediaText: stylesheetInfo.mediaText
203
- });
204
- } else {
205
- content.data = getUpdatedResourceContent(content.resourceURL, options) || content.data;
206
- stylesheetInfo.stylesheet = cssTree.parse(content.data, { context: "stylesheet", parseCustomProperty: true });
207
- await this.resolveImportURLs(stylesheetInfo, resourceURL, options, workStylesheet, resources, stylesheets);
208
- stylesheets.set({ element }, stylesheetInfo);
209
- }
193
+ content.data = getUpdatedResourceContent(content.resourceURL, options) || content.data;
194
+ stylesheetInfo.stylesheet = cssTree.parse(content.data, { context: "stylesheet", parseCustomProperty: true });
195
+ await this.resolveImportURLs(stylesheetInfo, resourceURL, options, workStylesheet, resources, stylesheets);
210
196
  }
211
197
  }
212
198
  }
@@ -442,8 +428,8 @@ function getProcessorHelperClass(utilInstance) {
442
428
  fontTests.set(source.src, source.valid);
443
429
  }
444
430
  }));
445
- const findSourceByFormat = (fontFormat, testValidity) => fontInfo.find(source => !source.src.match(EMPTY_URL_SOURCE) && source.format == fontFormat && (!testValidity || source.valid));
446
- const findSourceByContentType = (contentType, testValidity) => fontInfo.find(source => !source.src.match(EMPTY_URL_SOURCE) && source.contentType == contentType && (!testValidity || source.valid));
431
+ const findSourceByFormat = (fontFormat, testValidity) => fontInfo.findLast(source => !source.src.match(EMPTY_URL_SOURCE) && source.format == fontFormat && (!testValidity || source.valid));
432
+ const findSourceByContentType = (contentType, testValidity) => fontInfo.findLast(source => !source.src.match(EMPTY_URL_SOURCE) && source.contentType == contentType && (!testValidity || source.valid));
447
433
  const filterSources = fontSource => fontInfo.filter(source => source == fontSource || source.src.startsWith(LOCAL_SOURCE));
448
434
  stats.fonts.processed += fontInfo.length;
449
435
  stats.fonts.discarded += fontInfo.length;
package/core/util.js CHANGED
@@ -21,7 +21,7 @@
21
21
  * Source.
22
22
  */
23
23
 
24
- /* global globalThis, URLSearchParams */
24
+ /* global globalThis */
25
25
 
26
26
  import * as vendor from "./../vendor/index.js";
27
27
  import * as modules from "./../modules/index.js";
@@ -73,6 +73,7 @@ const Blob = globalThis.Blob;
73
73
  const FileReader = globalThis.FileReader;
74
74
  const fetch = (url, options) => globalThis.fetch(url, options);
75
75
  const TextDecoder = globalThis.TextDecoder;
76
+ const URLSearchParams = globalThis.URLSearchParams;
76
77
 
77
78
  export {
78
79
  getInstance
@@ -21,11 +21,16 @@
21
21
  * Source.
22
22
  */
23
23
 
24
- /* global Blob, FileReader, URL, URLSearchParams */
24
+ /* global globalThis */
25
25
 
26
26
  import { parse } from "./template-parser.js";
27
27
  import { getContentSize, digest } from "./../core/helper.js";
28
28
 
29
+ const Blob = globalThis.Blob;
30
+ const FileReader = globalThis.FileReader;
31
+ const URL = globalThis.URL;
32
+ const URLSearchParams = globalThis.URLSearchParams;
33
+
29
34
  // eslint-disable-next-line quotes
30
35
  const DEFAULT_REPLACED_CHARACTERS = ["~", "+", "\\\\", "?", "%", "*", ":", "|", '"', "<", ">", "\x00-\x1f", "\x7F"];
31
36
  const DEFAULT_REPLACEMENT_CHARACTER = "_";
@@ -17020,7 +17025,7 @@ async function evalTemplate(template = "", options, content, doc, dontReplaceSla
17020
17025
  template = replaceAll(template, "\\{", "\\\\{");
17021
17026
  template = replaceAll(template, "\\|", "\\\\|");
17022
17027
  template = replaceAll(template, "\\>", "\\\\>");
17023
- const result = (await parse(template, {
17028
+ let result = (await parse(template, {
17024
17029
  async callFunction(name, [argument, optionalArguments], lengthData) {
17025
17030
  const fn = functions[name];
17026
17031
  if (fn) {
@@ -17050,12 +17055,11 @@ async function evalTemplate(template = "", options, content, doc, dontReplaceSla
17050
17055
  }
17051
17056
  }
17052
17057
  }));
17053
- let resultString = result.join("");
17054
- resultString = replaceAll(resultString, "\\\\%", "%");
17055
- resultString = replaceAll(resultString, "\\\\{", "{");
17056
- resultString = replaceAll(resultString, "\\\\|", "|");
17057
- resultString = replaceAll(resultString, "\\\\>", ">");
17058
- return resultString;
17058
+ result = replaceAll(result, "\\\\%", "%");
17059
+ result = replaceAll(result, "\\\\{", "{");
17060
+ result = replaceAll(result, "\\\\|", "|");
17061
+ result = replaceAll(result, "\\\\>", ">");
17062
+ return result;
17059
17063
 
17060
17064
  function addDateVariables(date, prefix = "") {
17061
17065
  variables[prefix + "datetime-iso"] = { getter: () => date.toISOString() };
@@ -1,8 +1,9 @@
1
1
  start = expression
2
- expression = statement*
2
+ expression = expression:statement* { return expression.join("") }
3
3
  statement = functionCall / variable / text
4
- arg = "|"? value:statement { return value; }
5
- args = arg arg*
4
+ arg = "|" value:expression { return value; }
5
+ optionalArgs = arg+
6
+ args = value:expression optionalArgs?
6
7
  functionCall = "%" name:identifier "<" args:args ">" length:resultLength? { return options.callFunction(name, args, length); }
7
8
  variable = "{" name:identifier "}" length:resultLength? { return options.getVariableValue(name, length); }
8
9
  resultLength = "[" length:number unit:lengthUnit "]" { return { length, unit }; }
@@ -171,43 +171,44 @@ async function peg$parse(input, options) {
171
171
  peg$startRuleFunctions = { start: peg$parsestart },
172
172
  peg$startRuleFunction = peg$parsestart,
173
173
 
174
- peg$c0 = "|",
175
- peg$c1 = peg$literalExpectation("|", false),
176
- peg$c2 = function (value) { return value; },
177
- peg$c3 = "%",
178
- peg$c4 = peg$literalExpectation("%", false),
179
- peg$c5 = "<",
180
- peg$c6 = peg$literalExpectation("<", false),
181
- peg$c7 = ">",
182
- peg$c8 = peg$literalExpectation(">", false),
183
- peg$c9 = function (name, args, length) { return options.callFunction(name, args, length); },
184
- peg$c10 = "{",
185
- peg$c11 = peg$literalExpectation("{", false),
186
- peg$c12 = "}",
187
- peg$c13 = peg$literalExpectation("}", false),
188
- peg$c14 = function (name, length) { return options.getVariableValue(name, length); },
189
- peg$c15 = "[",
190
- peg$c16 = peg$literalExpectation("[", false),
191
- peg$c17 = "]",
192
- peg$c18 = peg$literalExpectation("]", false),
193
- peg$c19 = function (length, unit) { return { length, unit }; },
194
- peg$c20 = "ch",
195
- peg$c21 = peg$literalExpectation("ch", false),
196
- peg$c22 = /^[a-z0-9-]/,
197
- peg$c23 = peg$classExpectation([["a", "z"], ["0", "9"], "-"], false, false),
198
- peg$c24 = function () { return text(); },
199
- peg$c25 = /^[0-9]/,
200
- peg$c26 = peg$classExpectation([["0", "9"]], false, false),
201
- peg$c27 = function () { return Number(text()); },
202
- peg$c28 = "\\\\{",
203
- peg$c29 = peg$literalExpectation("\\\\{", false),
204
- peg$c30 = "\\\\>",
205
- peg$c31 = peg$literalExpectation("\\\\>", false),
206
- peg$c32 = "\\\\%",
207
- peg$c33 = peg$literalExpectation("\\\\%", false),
208
- peg$c34 = "\\\\|",
209
- peg$c35 = peg$literalExpectation("\\\\|", false),
210
- peg$c36 = peg$anyExpectation(),
174
+ peg$c0 = function (expression) { return expression.join(""); },
175
+ peg$c1 = "|",
176
+ peg$c2 = peg$literalExpectation("|", false),
177
+ peg$c3 = function (value) { return value; },
178
+ peg$c4 = "%",
179
+ peg$c5 = peg$literalExpectation("%", false),
180
+ peg$c6 = "<",
181
+ peg$c7 = peg$literalExpectation("<", false),
182
+ peg$c8 = ">",
183
+ peg$c9 = peg$literalExpectation(">", false),
184
+ peg$c10 = function (name, args, length) { return options.callFunction(name, args, length); },
185
+ peg$c11 = "{",
186
+ peg$c12 = peg$literalExpectation("{", false),
187
+ peg$c13 = "}",
188
+ peg$c14 = peg$literalExpectation("}", false),
189
+ peg$c15 = function (name, length) { return options.getVariableValue(name, length); },
190
+ peg$c16 = "[",
191
+ peg$c17 = peg$literalExpectation("[", false),
192
+ peg$c18 = "]",
193
+ peg$c19 = peg$literalExpectation("]", false),
194
+ peg$c20 = function (length, unit) { return { length, unit }; },
195
+ peg$c21 = "ch",
196
+ peg$c22 = peg$literalExpectation("ch", false),
197
+ peg$c23 = /^[a-z0-9-]/,
198
+ peg$c24 = peg$classExpectation([["a", "z"], ["0", "9"], "-"], false, false),
199
+ peg$c25 = function () { return text(); },
200
+ peg$c26 = /^[0-9]/,
201
+ peg$c27 = peg$classExpectation([["0", "9"]], false, false),
202
+ peg$c28 = function () { return Number(text()); },
203
+ peg$c29 = "\\\\%",
204
+ peg$c30 = peg$literalExpectation("\\\\%", false),
205
+ peg$c31 = "\\\\{",
206
+ peg$c32 = peg$literalExpectation("\\\\{", false),
207
+ peg$c33 = "\\\\|",
208
+ peg$c34 = peg$literalExpectation("\\\\|", false),
209
+ peg$c35 = "\\\\>",
210
+ peg$c36 = peg$literalExpectation("\\\\>", false),
211
+ peg$c37 = peg$anyExpectation(),
211
212
 
212
213
  peg$currPos = 0,
213
214
  peg$savedPos = 0,
@@ -326,14 +327,20 @@ async function peg$parse(input, options) {
326
327
  }
327
328
 
328
329
  async function peg$parseexpression() {
329
- var s0, s1;
330
+ var s0, s1, s2;
330
331
 
331
- s0 = [];
332
- s1 = await peg$parsestatement();
333
- while (s1 !== peg$FAILED) {
334
- s0.push(s1);
335
- s1 = await peg$parsestatement();
332
+ s0 = peg$currPos;
333
+ s1 = [];
334
+ s2 = await peg$parsestatement();
335
+ while (s2 !== peg$FAILED) {
336
+ s1.push(s2);
337
+ s2 = await peg$parsestatement();
336
338
  }
339
+ if (s1 !== peg$FAILED) {
340
+ peg$savedPos = s0;
341
+ s1 = peg$c0(s1);
342
+ }
343
+ s0 = s1;
337
344
 
338
345
  return s0;
339
346
  }
@@ -357,20 +364,17 @@ async function peg$parse(input, options) {
357
364
 
358
365
  s0 = peg$currPos;
359
366
  if (input.charCodeAt(peg$currPos) === 124) {
360
- s1 = peg$c0;
367
+ s1 = peg$c1;
361
368
  peg$currPos++;
362
369
  } else {
363
370
  s1 = peg$FAILED;
364
- if (peg$silentFails === 0) { peg$fail(peg$c1); }
365
- }
366
- if (s1 === peg$FAILED) {
367
- s1 = null;
371
+ if (peg$silentFails === 0) { peg$fail(peg$c2); }
368
372
  }
369
373
  if (s1 !== peg$FAILED) {
370
- s2 = await peg$parsestatement();
374
+ s2 = await peg$parseexpression();
371
375
  if (s2 !== peg$FAILED) {
372
376
  peg$savedPos = s0;
373
- s1 = peg$c2(s2);
377
+ s1 = peg$c3(s2);
374
378
  s0 = s1;
375
379
  } else {
376
380
  peg$currPos = s0;
@@ -384,17 +388,32 @@ async function peg$parse(input, options) {
384
388
  return s0;
385
389
  }
386
390
 
391
+ async function peg$parseoptionalArgs() {
392
+ var s0, s1;
393
+
394
+ s0 = [];
395
+ s1 = await peg$parsearg();
396
+ if (s1 !== peg$FAILED) {
397
+ while (s1 !== peg$FAILED) {
398
+ s0.push(s1);
399
+ s1 = await peg$parsearg();
400
+ }
401
+ } else {
402
+ s0 = peg$FAILED;
403
+ }
404
+
405
+ return s0;
406
+ }
407
+
387
408
  async function peg$parseargs() {
388
- var s0, s1, s2, s3;
409
+ var s0, s1, s2;
389
410
 
390
411
  s0 = peg$currPos;
391
- s1 = await peg$parsearg();
412
+ s1 = await peg$parseexpression();
392
413
  if (s1 !== peg$FAILED) {
393
- s2 = [];
394
- s3 = await peg$parsearg();
395
- while (s3 !== peg$FAILED) {
396
- s2.push(s3);
397
- s3 = await peg$parsearg();
414
+ s2 = await peg$parseoptionalArgs();
415
+ if (s2 === peg$FAILED) {
416
+ s2 = null;
398
417
  }
399
418
  if (s2 !== peg$FAILED) {
400
419
  s1 = [s1, s2];
@@ -416,31 +435,31 @@ async function peg$parse(input, options) {
416
435
 
417
436
  s0 = peg$currPos;
418
437
  if (input.charCodeAt(peg$currPos) === 37) {
419
- s1 = peg$c3;
438
+ s1 = peg$c4;
420
439
  peg$currPos++;
421
440
  } else {
422
441
  s1 = peg$FAILED;
423
- if (peg$silentFails === 0) { peg$fail(peg$c4); }
442
+ if (peg$silentFails === 0) { peg$fail(peg$c5); }
424
443
  }
425
444
  if (s1 !== peg$FAILED) {
426
445
  s2 = peg$parseidentifier();
427
446
  if (s2 !== peg$FAILED) {
428
447
  if (input.charCodeAt(peg$currPos) === 60) {
429
- s3 = peg$c5;
448
+ s3 = peg$c6;
430
449
  peg$currPos++;
431
450
  } else {
432
451
  s3 = peg$FAILED;
433
- if (peg$silentFails === 0) { peg$fail(peg$c6); }
452
+ if (peg$silentFails === 0) { peg$fail(peg$c7); }
434
453
  }
435
454
  if (s3 !== peg$FAILED) {
436
455
  s4 = await peg$parseargs();
437
456
  if (s4 !== peg$FAILED) {
438
457
  if (input.charCodeAt(peg$currPos) === 62) {
439
- s5 = peg$c7;
458
+ s5 = peg$c8;
440
459
  peg$currPos++;
441
460
  } else {
442
461
  s5 = peg$FAILED;
443
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
462
+ if (peg$silentFails === 0) { peg$fail(peg$c9); }
444
463
  }
445
464
  if (s5 !== peg$FAILED) {
446
465
  s6 = peg$parseresultLength();
@@ -449,7 +468,7 @@ async function peg$parse(input, options) {
449
468
  }
450
469
  if (s6 !== peg$FAILED) {
451
470
  peg$savedPos = s0;
452
- s1 = await peg$c9(s2, s4, s6);
471
+ s1 = await peg$c10(s2, s4, s6);
453
472
  s0 = s1;
454
473
  } else {
455
474
  peg$currPos = s0;
@@ -484,21 +503,21 @@ async function peg$parse(input, options) {
484
503
 
485
504
  s0 = peg$currPos;
486
505
  if (input.charCodeAt(peg$currPos) === 123) {
487
- s1 = peg$c10;
506
+ s1 = peg$c11;
488
507
  peg$currPos++;
489
508
  } else {
490
509
  s1 = peg$FAILED;
491
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
510
+ if (peg$silentFails === 0) { peg$fail(peg$c12); }
492
511
  }
493
512
  if (s1 !== peg$FAILED) {
494
513
  s2 = peg$parseidentifier();
495
514
  if (s2 !== peg$FAILED) {
496
515
  if (input.charCodeAt(peg$currPos) === 125) {
497
- s3 = peg$c12;
516
+ s3 = peg$c13;
498
517
  peg$currPos++;
499
518
  } else {
500
519
  s3 = peg$FAILED;
501
- if (peg$silentFails === 0) { peg$fail(peg$c13); }
520
+ if (peg$silentFails === 0) { peg$fail(peg$c14); }
502
521
  }
503
522
  if (s3 !== peg$FAILED) {
504
523
  s4 = peg$parseresultLength();
@@ -507,7 +526,7 @@ async function peg$parse(input, options) {
507
526
  }
508
527
  if (s4 !== peg$FAILED) {
509
528
  peg$savedPos = s0;
510
- s1 = await peg$c14(s2, s4);
529
+ s1 = await peg$c15(s2, s4);
511
530
  s0 = s1;
512
531
  } else {
513
532
  peg$currPos = s0;
@@ -534,11 +553,11 @@ async function peg$parse(input, options) {
534
553
 
535
554
  s0 = peg$currPos;
536
555
  if (input.charCodeAt(peg$currPos) === 91) {
537
- s1 = peg$c15;
556
+ s1 = peg$c16;
538
557
  peg$currPos++;
539
558
  } else {
540
559
  s1 = peg$FAILED;
541
- if (peg$silentFails === 0) { peg$fail(peg$c16); }
560
+ if (peg$silentFails === 0) { peg$fail(peg$c17); }
542
561
  }
543
562
  if (s1 !== peg$FAILED) {
544
563
  s2 = peg$parsenumber();
@@ -546,15 +565,15 @@ async function peg$parse(input, options) {
546
565
  s3 = peg$parselengthUnit();
547
566
  if (s3 !== peg$FAILED) {
548
567
  if (input.charCodeAt(peg$currPos) === 93) {
549
- s4 = peg$c17;
568
+ s4 = peg$c18;
550
569
  peg$currPos++;
551
570
  } else {
552
571
  s4 = peg$FAILED;
553
- if (peg$silentFails === 0) { peg$fail(peg$c18); }
572
+ if (peg$silentFails === 0) { peg$fail(peg$c19); }
554
573
  }
555
574
  if (s4 !== peg$FAILED) {
556
575
  peg$savedPos = s0;
557
- s1 = peg$c19(s2, s3);
576
+ s1 = peg$c20(s2, s3);
558
577
  s0 = s1;
559
578
  } else {
560
579
  peg$currPos = s0;
@@ -579,12 +598,12 @@ async function peg$parse(input, options) {
579
598
  function peg$parselengthUnit() {
580
599
  var s0;
581
600
 
582
- if (input.substr(peg$currPos, 2) === peg$c20) {
583
- s0 = peg$c20;
601
+ if (input.substr(peg$currPos, 2) === peg$c21) {
602
+ s0 = peg$c21;
584
603
  peg$currPos += 2;
585
604
  } else {
586
605
  s0 = peg$FAILED;
587
- if (peg$silentFails === 0) { peg$fail(peg$c21); }
606
+ if (peg$silentFails === 0) { peg$fail(peg$c22); }
588
607
  }
589
608
  if (s0 === peg$FAILED) {
590
609
  s0 = null;
@@ -598,22 +617,22 @@ async function peg$parse(input, options) {
598
617
 
599
618
  s0 = peg$currPos;
600
619
  s1 = [];
601
- if (peg$c22.test(input.charAt(peg$currPos))) {
620
+ if (peg$c23.test(input.charAt(peg$currPos))) {
602
621
  s2 = input.charAt(peg$currPos);
603
622
  peg$currPos++;
604
623
  } else {
605
624
  s2 = peg$FAILED;
606
- if (peg$silentFails === 0) { peg$fail(peg$c23); }
625
+ if (peg$silentFails === 0) { peg$fail(peg$c24); }
607
626
  }
608
627
  if (s2 !== peg$FAILED) {
609
628
  while (s2 !== peg$FAILED) {
610
629
  s1.push(s2);
611
- if (peg$c22.test(input.charAt(peg$currPos))) {
630
+ if (peg$c23.test(input.charAt(peg$currPos))) {
612
631
  s2 = input.charAt(peg$currPos);
613
632
  peg$currPos++;
614
633
  } else {
615
634
  s2 = peg$FAILED;
616
- if (peg$silentFails === 0) { peg$fail(peg$c23); }
635
+ if (peg$silentFails === 0) { peg$fail(peg$c24); }
617
636
  }
618
637
  }
619
638
  } else {
@@ -621,7 +640,7 @@ async function peg$parse(input, options) {
621
640
  }
622
641
  if (s1 !== peg$FAILED) {
623
642
  peg$savedPos = s0;
624
- s1 = peg$c24();
643
+ s1 = peg$c25();
625
644
  }
626
645
  s0 = s1;
627
646
 
@@ -633,22 +652,22 @@ async function peg$parse(input, options) {
633
652
 
634
653
  s0 = peg$currPos;
635
654
  s1 = [];
636
- if (peg$c25.test(input.charAt(peg$currPos))) {
655
+ if (peg$c26.test(input.charAt(peg$currPos))) {
637
656
  s2 = input.charAt(peg$currPos);
638
657
  peg$currPos++;
639
658
  } else {
640
659
  s2 = peg$FAILED;
641
- if (peg$silentFails === 0) { peg$fail(peg$c26); }
660
+ if (peg$silentFails === 0) { peg$fail(peg$c27); }
642
661
  }
643
662
  if (s2 !== peg$FAILED) {
644
663
  while (s2 !== peg$FAILED) {
645
664
  s1.push(s2);
646
- if (peg$c25.test(input.charAt(peg$currPos))) {
665
+ if (peg$c26.test(input.charAt(peg$currPos))) {
647
666
  s2 = input.charAt(peg$currPos);
648
667
  peg$currPos++;
649
668
  } else {
650
669
  s2 = peg$FAILED;
651
- if (peg$silentFails === 0) { peg$fail(peg$c26); }
670
+ if (peg$silentFails === 0) { peg$fail(peg$c27); }
652
671
  }
653
672
  }
654
673
  } else {
@@ -656,7 +675,7 @@ async function peg$parse(input, options) {
656
675
  }
657
676
  if (s1 !== peg$FAILED) {
658
677
  peg$savedPos = s0;
659
- s1 = peg$c27();
678
+ s1 = peg$c28();
660
679
  }
661
680
  s0 = s1;
662
681
 
@@ -679,7 +698,7 @@ async function peg$parse(input, options) {
679
698
  }
680
699
  if (s1 !== peg$FAILED) {
681
700
  peg$savedPos = s0;
682
- s1 = peg$c24();
701
+ s1 = peg$c25();
683
702
  }
684
703
  s0 = s1;
685
704
 
@@ -692,12 +711,12 @@ async function peg$parse(input, options) {
692
711
  s0 = peg$currPos;
693
712
  s1 = peg$currPos;
694
713
  peg$silentFails++;
695
- if (input.charCodeAt(peg$currPos) === 123) {
696
- s2 = peg$c10;
714
+ if (input.charCodeAt(peg$currPos) === 37) {
715
+ s2 = peg$c4;
697
716
  peg$currPos++;
698
717
  } else {
699
718
  s2 = peg$FAILED;
700
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
719
+ if (peg$silentFails === 0) { peg$fail(peg$c5); }
701
720
  }
702
721
  peg$silentFails--;
703
722
  if (s2 === peg$FAILED) {
@@ -709,12 +728,12 @@ async function peg$parse(input, options) {
709
728
  if (s1 !== peg$FAILED) {
710
729
  s2 = peg$currPos;
711
730
  peg$silentFails++;
712
- if (input.charCodeAt(peg$currPos) === 62) {
713
- s3 = peg$c7;
731
+ if (input.charCodeAt(peg$currPos) === 123) {
732
+ s3 = peg$c11;
714
733
  peg$currPos++;
715
734
  } else {
716
735
  s3 = peg$FAILED;
717
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
736
+ if (peg$silentFails === 0) { peg$fail(peg$c12); }
718
737
  }
719
738
  peg$silentFails--;
720
739
  if (s3 === peg$FAILED) {
@@ -726,12 +745,12 @@ async function peg$parse(input, options) {
726
745
  if (s2 !== peg$FAILED) {
727
746
  s3 = peg$currPos;
728
747
  peg$silentFails++;
729
- if (input.charCodeAt(peg$currPos) === 37) {
730
- s4 = peg$c3;
748
+ if (input.charCodeAt(peg$currPos) === 124) {
749
+ s4 = peg$c1;
731
750
  peg$currPos++;
732
751
  } else {
733
752
  s4 = peg$FAILED;
734
- if (peg$silentFails === 0) { peg$fail(peg$c4); }
753
+ if (peg$silentFails === 0) { peg$fail(peg$c2); }
735
754
  }
736
755
  peg$silentFails--;
737
756
  if (s4 === peg$FAILED) {
@@ -743,12 +762,12 @@ async function peg$parse(input, options) {
743
762
  if (s3 !== peg$FAILED) {
744
763
  s4 = peg$currPos;
745
764
  peg$silentFails++;
746
- if (input.charCodeAt(peg$currPos) === 124) {
747
- s5 = peg$c0;
765
+ if (input.charCodeAt(peg$currPos) === 62) {
766
+ s5 = peg$c8;
748
767
  peg$currPos++;
749
768
  } else {
750
769
  s5 = peg$FAILED;
751
- if (peg$silentFails === 0) { peg$fail(peg$c1); }
770
+ if (peg$silentFails === 0) { peg$fail(peg$c9); }
752
771
  }
753
772
  peg$silentFails--;
754
773
  if (s5 === peg$FAILED) {
@@ -789,36 +808,36 @@ async function peg$parse(input, options) {
789
808
  function peg$parseescapedChar() {
790
809
  var s0;
791
810
 
792
- if (input.substr(peg$currPos, 3) === peg$c28) {
793
- s0 = peg$c28;
811
+ if (input.substr(peg$currPos, 3) === peg$c29) {
812
+ s0 = peg$c29;
794
813
  peg$currPos += 3;
795
814
  } else {
796
815
  s0 = peg$FAILED;
797
- if (peg$silentFails === 0) { peg$fail(peg$c29); }
816
+ if (peg$silentFails === 0) { peg$fail(peg$c30); }
798
817
  }
799
818
  if (s0 === peg$FAILED) {
800
- if (input.substr(peg$currPos, 3) === peg$c30) {
801
- s0 = peg$c30;
819
+ if (input.substr(peg$currPos, 3) === peg$c31) {
820
+ s0 = peg$c31;
802
821
  peg$currPos += 3;
803
822
  } else {
804
823
  s0 = peg$FAILED;
805
- if (peg$silentFails === 0) { peg$fail(peg$c31); }
824
+ if (peg$silentFails === 0) { peg$fail(peg$c32); }
806
825
  }
807
826
  if (s0 === peg$FAILED) {
808
- if (input.substr(peg$currPos, 3) === peg$c32) {
809
- s0 = peg$c32;
827
+ if (input.substr(peg$currPos, 3) === peg$c33) {
828
+ s0 = peg$c33;
810
829
  peg$currPos += 3;
811
830
  } else {
812
831
  s0 = peg$FAILED;
813
- if (peg$silentFails === 0) { peg$fail(peg$c33); }
832
+ if (peg$silentFails === 0) { peg$fail(peg$c34); }
814
833
  }
815
834
  if (s0 === peg$FAILED) {
816
- if (input.substr(peg$currPos, 3) === peg$c34) {
817
- s0 = peg$c34;
835
+ if (input.substr(peg$currPos, 3) === peg$c35) {
836
+ s0 = peg$c35;
818
837
  peg$currPos += 3;
819
838
  } else {
820
839
  s0 = peg$FAILED;
821
- if (peg$silentFails === 0) { peg$fail(peg$c35); }
840
+ if (peg$silentFails === 0) { peg$fail(peg$c36); }
822
841
  }
823
842
  if (s0 === peg$FAILED) {
824
843
  if (input.length > peg$currPos) {
@@ -826,7 +845,7 @@ async function peg$parse(input, options) {
826
845
  peg$currPos++;
827
846
  } else {
828
847
  s0 = peg$FAILED;
829
- if (peg$silentFails === 0) { peg$fail(peg$c36); }
848
+ if (peg$silentFails === 0) { peg$fail(peg$c37); }
830
849
  }
831
850
  }
832
851
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -21,7 +21,7 @@
21
21
  * Source.
22
22
  */
23
23
 
24
- /* global globalThis, FileReader, Node */
24
+ /* global globalThis, Node, FileReader */
25
25
 
26
26
  import {
27
27
  configure,
@@ -21,7 +21,7 @@
21
21
  * Source.
22
22
  */
23
23
 
24
- /* global window, globalThis */
24
+ /* global globalThis, window */
25
25
 
26
26
  (globalThis => {
27
27