@absolutejs/absolute 0.19.0-beta.739 → 0.19.0-beta.740

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.
@@ -3462,7 +3462,18 @@ ${registrations}
3462
3462
  await Promise.all(entries.map(({ target }) => fs.mkdir(dirname4(target), { recursive: true })));
3463
3463
  await Promise.all(entries.map(({ target, content }) => fs.writeFile(target, content, "utf-8")));
3464
3464
  return entries.map(({ target }) => target);
3465
- }, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
3465
+ }, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
3466
+ const re = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
3467
+ let match;
3468
+ while ((match = re.exec(source)) !== null) {
3469
+ const lineStart = source.lastIndexOf(`
3470
+ `, match.index - 1) + 1;
3471
+ const beforeMatch = source.slice(lineStart, match.index);
3472
+ if (!/^\s*\/\//.test(beforeMatch))
3473
+ return match;
3474
+ }
3475
+ return null;
3476
+ }, resolveAngularDeferImportSpecifier = () => {
3466
3477
  const sourceEntry = resolve6(import.meta.dir, "../angular/components/index.ts");
3467
3478
  if (existsSync5(sourceEntry)) {
3468
3479
  return sourceEntry.replace(/\\/g, "/");
@@ -3598,7 +3609,7 @@ ${fields}
3598
3609
  const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
3599
3610
  return escapeTemplateContent(content);
3600
3611
  }, inlineTemplateAndLowerDefer = async (source, fileDir) => {
3601
- const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
3612
+ const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
3602
3613
  if (templateUrlMatch?.[1]) {
3603
3614
  const templatePath = join5(fileDir, templateUrlMatch[1]);
3604
3615
  if (!existsSync5(templatePath)) {
@@ -3607,13 +3618,13 @@ ${fields}
3607
3618
  const templateRaw2 = await fs.readFile(templatePath, "utf-8");
3608
3619
  const lowered2 = lowerAngularDeferSyntax(templateRaw2);
3609
3620
  const escaped2 = escapeTemplateContent(lowered2.template);
3610
- const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
3621
+ const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
3611
3622
  return {
3612
3623
  deferSlots: lowered2.slots,
3613
3624
  source: injectDeferSlotFields(replacedSource2, lowered2.slots, resolveAngularDeferImportSpecifier())
3614
3625
  };
3615
3626
  }
3616
- const inlineTemplateMatch = source.match(/template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/);
3627
+ const inlineTemplateMatch = findUncommentedMatch(source, /template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/);
3617
3628
  if (!inlineTemplateMatch) {
3618
3629
  return { deferSlots: [], source };
3619
3630
  }
@@ -3623,13 +3634,13 @@ ${fields}
3623
3634
  return { deferSlots: lowered.slots, source };
3624
3635
  }
3625
3636
  const escaped = escapeTemplateContent(lowered.template);
3626
- const replacedSource = source.replace(/template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/, `template: \`${escaped}\``);
3637
+ const replacedSource = source.slice(0, inlineTemplateMatch.index) + `template: \`${escaped}\`` + source.slice(inlineTemplateMatch.index + inlineTemplateMatch[0].length);
3627
3638
  return {
3628
3639
  deferSlots: lowered.slots,
3629
3640
  source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
3630
3641
  };
3631
3642
  }, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
3632
- const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
3643
+ const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
3633
3644
  if (templateUrlMatch?.[1]) {
3634
3645
  const templatePath = join5(fileDir, templateUrlMatch[1]);
3635
3646
  if (!existsSync5(templatePath)) {
@@ -3638,13 +3649,13 @@ ${fields}
3638
3649
  const templateRaw2 = readFileSync4(templatePath, "utf-8");
3639
3650
  const lowered2 = lowerAngularDeferSyntax(templateRaw2);
3640
3651
  const escaped2 = escapeTemplateContent(lowered2.template);
3641
- const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
3652
+ const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
3642
3653
  return {
3643
3654
  deferSlots: lowered2.slots,
3644
3655
  source: injectDeferSlotFields(replacedSource2, lowered2.slots, resolveAngularDeferImportSpecifier())
3645
3656
  };
3646
3657
  }
3647
- const inlineTemplateMatch = source.match(/template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/);
3658
+ const inlineTemplateMatch = findUncommentedMatch(source, /template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/);
3648
3659
  if (!inlineTemplateMatch) {
3649
3660
  return { deferSlots: [], source };
3650
3661
  }
@@ -3654,13 +3665,13 @@ ${fields}
3654
3665
  return { deferSlots: lowered.slots, source };
3655
3666
  }
3656
3667
  const escaped = escapeTemplateContent(lowered.template);
3657
- const replacedSource = source.replace(/template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/, `template: \`${escaped}\``);
3668
+ const replacedSource = source.slice(0, inlineTemplateMatch.index) + `template: \`${escaped}\`` + source.slice(inlineTemplateMatch.index + inlineTemplateMatch[0].length);
3658
3669
  return {
3659
3670
  deferSlots: lowered.slots,
3660
3671
  source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
3661
3672
  };
3662
3673
  }, inlineStyleUrls = async (source, fileDir, stylePreprocessors) => {
3663
- const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
3674
+ const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
3664
3675
  if (!styleUrlsMatch?.[1])
3665
3676
  return source;
3666
3677
  const urlMatches = styleUrlsMatch[1].match(/['"]([^'"]+)['"]/g);
@@ -3674,15 +3685,15 @@ ${fields}
3674
3685
  const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
3675
3686
  if (inlinedStyles.length === 0)
3676
3687
  return source;
3677
- return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
3688
+ return source.slice(0, styleUrlsMatch.index) + `styles: [${inlinedStyles.join(", ")}]` + source.slice(styleUrlsMatch.index + styleUrlsMatch[0].length);
3678
3689
  }, inlineSingleStyleUrl = async (source, fileDir, stylePreprocessors) => {
3679
- const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
3690
+ const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
3680
3691
  if (!styleUrlMatch?.[1])
3681
3692
  return source;
3682
3693
  const escaped = await readAndEscapeFile(join5(fileDir, styleUrlMatch[1]), stylePreprocessors);
3683
3694
  if (!escaped)
3684
3695
  return source;
3685
- return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
3696
+ return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
3686
3697
  }, inlineResources = async (source, fileDir, stylePreprocessors) => {
3687
3698
  const inlinedTemplate = await inlineTemplateAndLowerDefer(source, fileDir);
3688
3699
  let result = inlinedTemplate.source;
@@ -5079,5 +5090,5 @@ export {
5079
5090
  handleAngularPageRequest
5080
5091
  };
5081
5092
 
5082
- //# debugId=BE57FD8D6737129D64756E2164756E21
5093
+ //# debugId=CC06E227EE05A7F464756E2164756E21
5083
5094
  //# sourceMappingURL=server.js.map