@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.
package/dist/build.js CHANGED
@@ -43741,7 +43741,18 @@ ${registrations}
43741
43741
  await Promise.all(entries.map(({ target }) => fs2.mkdir(dirname10(target), { recursive: true })));
43742
43742
  await Promise.all(entries.map(({ target, content }) => fs2.writeFile(target, content, "utf-8")));
43743
43743
  return entries.map(({ target }) => target);
43744
- }, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
43744
+ }, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
43745
+ const re2 = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
43746
+ let match;
43747
+ while ((match = re2.exec(source)) !== null) {
43748
+ const lineStart = source.lastIndexOf(`
43749
+ `, match.index - 1) + 1;
43750
+ const beforeMatch = source.slice(lineStart, match.index);
43751
+ if (!/^\s*\/\//.test(beforeMatch))
43752
+ return match;
43753
+ }
43754
+ return null;
43755
+ }, resolveAngularDeferImportSpecifier = () => {
43745
43756
  const sourceEntry = resolve16(import.meta.dir, "../angular/components/index.ts");
43746
43757
  if (existsSync16(sourceEntry)) {
43747
43758
  return sourceEntry.replace(/\\/g, "/");
@@ -43877,7 +43888,7 @@ ${fields}
43877
43888
  const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
43878
43889
  return escapeTemplateContent(content);
43879
43890
  }, inlineTemplateAndLowerDefer = async (source, fileDir) => {
43880
- const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
43891
+ const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
43881
43892
  if (templateUrlMatch?.[1]) {
43882
43893
  const templatePath = join15(fileDir, templateUrlMatch[1]);
43883
43894
  if (!existsSync16(templatePath)) {
@@ -43886,13 +43897,13 @@ ${fields}
43886
43897
  const templateRaw2 = await fs2.readFile(templatePath, "utf-8");
43887
43898
  const lowered2 = lowerAngularDeferSyntax(templateRaw2);
43888
43899
  const escaped2 = escapeTemplateContent(lowered2.template);
43889
- const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
43900
+ const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
43890
43901
  return {
43891
43902
  deferSlots: lowered2.slots,
43892
43903
  source: injectDeferSlotFields(replacedSource2, lowered2.slots, resolveAngularDeferImportSpecifier())
43893
43904
  };
43894
43905
  }
43895
- const inlineTemplateMatch = source.match(/template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/);
43906
+ const inlineTemplateMatch = findUncommentedMatch(source, /template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/);
43896
43907
  if (!inlineTemplateMatch) {
43897
43908
  return { deferSlots: [], source };
43898
43909
  }
@@ -43902,13 +43913,13 @@ ${fields}
43902
43913
  return { deferSlots: lowered.slots, source };
43903
43914
  }
43904
43915
  const escaped = escapeTemplateContent(lowered.template);
43905
- const replacedSource = source.replace(/template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/, `template: \`${escaped}\``);
43916
+ const replacedSource = source.slice(0, inlineTemplateMatch.index) + `template: \`${escaped}\`` + source.slice(inlineTemplateMatch.index + inlineTemplateMatch[0].length);
43906
43917
  return {
43907
43918
  deferSlots: lowered.slots,
43908
43919
  source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
43909
43920
  };
43910
43921
  }, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
43911
- const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
43922
+ const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
43912
43923
  if (templateUrlMatch?.[1]) {
43913
43924
  const templatePath = join15(fileDir, templateUrlMatch[1]);
43914
43925
  if (!existsSync16(templatePath)) {
@@ -43917,13 +43928,13 @@ ${fields}
43917
43928
  const templateRaw2 = readFileSync9(templatePath, "utf-8");
43918
43929
  const lowered2 = lowerAngularDeferSyntax(templateRaw2);
43919
43930
  const escaped2 = escapeTemplateContent(lowered2.template);
43920
- const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
43931
+ const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
43921
43932
  return {
43922
43933
  deferSlots: lowered2.slots,
43923
43934
  source: injectDeferSlotFields(replacedSource2, lowered2.slots, resolveAngularDeferImportSpecifier())
43924
43935
  };
43925
43936
  }
43926
- const inlineTemplateMatch = source.match(/template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/);
43937
+ const inlineTemplateMatch = findUncommentedMatch(source, /template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/);
43927
43938
  if (!inlineTemplateMatch) {
43928
43939
  return { deferSlots: [], source };
43929
43940
  }
@@ -43933,13 +43944,13 @@ ${fields}
43933
43944
  return { deferSlots: lowered.slots, source };
43934
43945
  }
43935
43946
  const escaped = escapeTemplateContent(lowered.template);
43936
- const replacedSource = source.replace(/template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/, `template: \`${escaped}\``);
43947
+ const replacedSource = source.slice(0, inlineTemplateMatch.index) + `template: \`${escaped}\`` + source.slice(inlineTemplateMatch.index + inlineTemplateMatch[0].length);
43937
43948
  return {
43938
43949
  deferSlots: lowered.slots,
43939
43950
  source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
43940
43951
  };
43941
43952
  }, inlineStyleUrls = async (source, fileDir, stylePreprocessors) => {
43942
- const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
43953
+ const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
43943
43954
  if (!styleUrlsMatch?.[1])
43944
43955
  return source;
43945
43956
  const urlMatches = styleUrlsMatch[1].match(/['"]([^'"]+)['"]/g);
@@ -43953,15 +43964,15 @@ ${fields}
43953
43964
  const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
43954
43965
  if (inlinedStyles.length === 0)
43955
43966
  return source;
43956
- return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
43967
+ return source.slice(0, styleUrlsMatch.index) + `styles: [${inlinedStyles.join(", ")}]` + source.slice(styleUrlsMatch.index + styleUrlsMatch[0].length);
43957
43968
  }, inlineSingleStyleUrl = async (source, fileDir, stylePreprocessors) => {
43958
- const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
43969
+ const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
43959
43970
  if (!styleUrlMatch?.[1])
43960
43971
  return source;
43961
43972
  const escaped = await readAndEscapeFile(join15(fileDir, styleUrlMatch[1]), stylePreprocessors);
43962
43973
  if (!escaped)
43963
43974
  return source;
43964
- return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
43975
+ return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
43965
43976
  }, inlineResources = async (source, fileDir, stylePreprocessors) => {
43966
43977
  const inlinedTemplate = await inlineTemplateAndLowerDefer(source, fileDir);
43967
43978
  let result = inlinedTemplate.source;
@@ -49924,5 +49935,5 @@ export {
49924
49935
  build
49925
49936
  };
49926
49937
 
49927
- //# debugId=E2CF1DC5C8E6083D64756E2164756E21
49938
+ //# debugId=04D574E7770009A664756E2164756E21
49928
49939
  //# sourceMappingURL=build.js.map