@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/index.js CHANGED
@@ -43933,7 +43933,18 @@ ${registrations}
43933
43933
  await Promise.all(entries.map(({ target }) => fs2.mkdir(dirname11(target), { recursive: true })));
43934
43934
  await Promise.all(entries.map(({ target, content }) => fs2.writeFile(target, content, "utf-8")));
43935
43935
  return entries.map(({ target }) => target);
43936
- }, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
43936
+ }, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
43937
+ const re2 = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
43938
+ let match;
43939
+ while ((match = re2.exec(source)) !== null) {
43940
+ const lineStart = source.lastIndexOf(`
43941
+ `, match.index - 1) + 1;
43942
+ const beforeMatch = source.slice(lineStart, match.index);
43943
+ if (!/^\s*\/\//.test(beforeMatch))
43944
+ return match;
43945
+ }
43946
+ return null;
43947
+ }, resolveAngularDeferImportSpecifier = () => {
43937
43948
  const sourceEntry = resolve19(import.meta.dir, "../angular/components/index.ts");
43938
43949
  if (existsSync16(sourceEntry)) {
43939
43950
  return sourceEntry.replace(/\\/g, "/");
@@ -44069,7 +44080,7 @@ ${fields}
44069
44080
  const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
44070
44081
  return escapeTemplateContent(content);
44071
44082
  }, inlineTemplateAndLowerDefer = async (source, fileDir) => {
44072
- const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
44083
+ const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
44073
44084
  if (templateUrlMatch?.[1]) {
44074
44085
  const templatePath = join15(fileDir, templateUrlMatch[1]);
44075
44086
  if (!existsSync16(templatePath)) {
@@ -44078,13 +44089,13 @@ ${fields}
44078
44089
  const templateRaw2 = await fs2.readFile(templatePath, "utf-8");
44079
44090
  const lowered2 = lowerAngularDeferSyntax(templateRaw2);
44080
44091
  const escaped2 = escapeTemplateContent(lowered2.template);
44081
- const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
44092
+ const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
44082
44093
  return {
44083
44094
  deferSlots: lowered2.slots,
44084
44095
  source: injectDeferSlotFields(replacedSource2, lowered2.slots, resolveAngularDeferImportSpecifier())
44085
44096
  };
44086
44097
  }
44087
- const inlineTemplateMatch = source.match(/template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/);
44098
+ const inlineTemplateMatch = findUncommentedMatch(source, /template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/);
44088
44099
  if (!inlineTemplateMatch) {
44089
44100
  return { deferSlots: [], source };
44090
44101
  }
@@ -44094,13 +44105,13 @@ ${fields}
44094
44105
  return { deferSlots: lowered.slots, source };
44095
44106
  }
44096
44107
  const escaped = escapeTemplateContent(lowered.template);
44097
- const replacedSource = source.replace(/template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/, `template: \`${escaped}\``);
44108
+ const replacedSource = source.slice(0, inlineTemplateMatch.index) + `template: \`${escaped}\`` + source.slice(inlineTemplateMatch.index + inlineTemplateMatch[0].length);
44098
44109
  return {
44099
44110
  deferSlots: lowered.slots,
44100
44111
  source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
44101
44112
  };
44102
44113
  }, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
44103
- const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
44114
+ const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
44104
44115
  if (templateUrlMatch?.[1]) {
44105
44116
  const templatePath = join15(fileDir, templateUrlMatch[1]);
44106
44117
  if (!existsSync16(templatePath)) {
@@ -44109,13 +44120,13 @@ ${fields}
44109
44120
  const templateRaw2 = readFileSync10(templatePath, "utf-8");
44110
44121
  const lowered2 = lowerAngularDeferSyntax(templateRaw2);
44111
44122
  const escaped2 = escapeTemplateContent(lowered2.template);
44112
- const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
44123
+ const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
44113
44124
  return {
44114
44125
  deferSlots: lowered2.slots,
44115
44126
  source: injectDeferSlotFields(replacedSource2, lowered2.slots, resolveAngularDeferImportSpecifier())
44116
44127
  };
44117
44128
  }
44118
- const inlineTemplateMatch = source.match(/template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/);
44129
+ const inlineTemplateMatch = findUncommentedMatch(source, /template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/);
44119
44130
  if (!inlineTemplateMatch) {
44120
44131
  return { deferSlots: [], source };
44121
44132
  }
@@ -44125,13 +44136,13 @@ ${fields}
44125
44136
  return { deferSlots: lowered.slots, source };
44126
44137
  }
44127
44138
  const escaped = escapeTemplateContent(lowered.template);
44128
- const replacedSource = source.replace(/template\s*:\s*(`([\s\S]*?)`|'([^']*)'|"([^"]*)")/, `template: \`${escaped}\``);
44139
+ const replacedSource = source.slice(0, inlineTemplateMatch.index) + `template: \`${escaped}\`` + source.slice(inlineTemplateMatch.index + inlineTemplateMatch[0].length);
44129
44140
  return {
44130
44141
  deferSlots: lowered.slots,
44131
44142
  source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
44132
44143
  };
44133
44144
  }, inlineStyleUrls = async (source, fileDir, stylePreprocessors) => {
44134
- const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
44145
+ const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
44135
44146
  if (!styleUrlsMatch?.[1])
44136
44147
  return source;
44137
44148
  const urlMatches = styleUrlsMatch[1].match(/['"]([^'"]+)['"]/g);
@@ -44145,15 +44156,15 @@ ${fields}
44145
44156
  const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
44146
44157
  if (inlinedStyles.length === 0)
44147
44158
  return source;
44148
- return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
44159
+ return source.slice(0, styleUrlsMatch.index) + `styles: [${inlinedStyles.join(", ")}]` + source.slice(styleUrlsMatch.index + styleUrlsMatch[0].length);
44149
44160
  }, inlineSingleStyleUrl = async (source, fileDir, stylePreprocessors) => {
44150
- const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
44161
+ const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
44151
44162
  if (!styleUrlMatch?.[1])
44152
44163
  return source;
44153
44164
  const escaped = await readAndEscapeFile(join15(fileDir, styleUrlMatch[1]), stylePreprocessors);
44154
44165
  if (!escaped)
44155
44166
  return source;
44156
- return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
44167
+ return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
44157
44168
  }, inlineResources = async (source, fileDir, stylePreprocessors) => {
44158
44169
  const inlinedTemplate = await inlineTemplateAndLowerDefer(source, fileDir);
44159
44170
  let result = inlinedTemplate.source;
@@ -58384,5 +58395,5 @@ export {
58384
58395
  ANGULAR_INIT_TIMEOUT_MS
58385
58396
  };
58386
58397
 
58387
- //# debugId=A657374A198E35BF64756E2164756E21
58398
+ //# debugId=F3641C03D1F4163164756E2164756E21
58388
58399
  //# sourceMappingURL=index.js.map