@normed/bundle 4.5.5 → 4.5.7

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/bundles/index.js CHANGED
@@ -69683,22 +69683,26 @@ var ts = __toESM(require("typescript"));
69683
69683
  var import_path8 = __toESM(require("path"));
69684
69684
  var import_fs7 = __toESM(require("fs"));
69685
69685
  import_chalk3.default.level = 3;
69686
- function rewritePugReferencesInHtml(html, pugReferences, pugToOutputPath) {
69686
+ function rewritePugReferencesInHtml(html, pugReferences, pugToOutputPath, htmlOutputDir, outdir) {
69687
69687
  let result = html;
69688
69688
  for (const ref of pugReferences) {
69689
69689
  const outputPath = pugToOutputPath.get(ref.absolutePath);
69690
69690
  if (outputPath) {
69691
- result = result.split(ref.originalHref).join(outputPath);
69691
+ const absoluteOutputPath = import_path8.default.join(outdir, outputPath);
69692
+ const relativePath = import_path8.default.relative(htmlOutputDir, absoluteOutputPath);
69693
+ result = result.split(ref.originalHref).join(relativePath);
69692
69694
  }
69693
69695
  }
69694
69696
  return result;
69695
69697
  }
69696
- function rewriteLessReferencesInHtml(html, lessReferences, lessToOutputPath) {
69698
+ function rewriteLessReferencesInHtml(html, lessReferences, lessToOutputPath, htmlOutputDir, outdir) {
69697
69699
  let result = html;
69698
69700
  for (const ref of lessReferences) {
69699
69701
  const outputPath = lessToOutputPath.get(ref.absolutePath);
69700
69702
  if (outputPath) {
69701
- result = result.split(ref.originalHref).join(outputPath);
69703
+ const absoluteOutputPath = import_path8.default.join(outdir, outputPath);
69704
+ const relativePath = import_path8.default.relative(htmlOutputDir, absoluteOutputPath);
69705
+ result = result.split(ref.originalHref).join(relativePath);
69702
69706
  }
69703
69707
  }
69704
69708
  return result;
@@ -70012,7 +70016,7 @@ var esbuilder = {
70012
70016
  );
70013
70017
  for (const lessSourcePath of newEntryPoints) {
70014
70018
  processedLessFiles.add(lessSourcePath);
70015
- const entryNames = finalConfig.assetNames?.replace("[ext]", "") || "[name]-[hash]";
70019
+ const entryNames = finalConfig.assetNames?.replace("[ext]", "") || "[dir]/[name]-[hash]";
70016
70020
  const lessConfig = {
70017
70021
  ...finalConfig,
70018
70022
  entryPoints: [lessSourcePath],
@@ -70023,13 +70027,13 @@ var esbuilder = {
70023
70027
  const relativeFilePath = import_path8.default.relative(outdir, file.path);
70024
70028
  if (relativeFilePath.endsWith(".css")) {
70025
70029
  lessToOutputPath.set(lessSourcePath, relativeFilePath);
70026
- await fileWriter.writeFile(file.path, file.contents, {
70027
- encoding: "utf-8"
70028
- });
70029
70030
  log_default.debug(
70030
70031
  `Built less file: ${import_path8.default.relative(indir, lessSourcePath)} -> ${relativeFilePath}`
70031
70032
  );
70032
70033
  }
70034
+ await fileWriter.writeFile(file.path, file.contents, {
70035
+ encoding: "utf-8"
70036
+ });
70033
70037
  }
70034
70038
  }
70035
70039
  }
@@ -70039,18 +70043,23 @@ var esbuilder = {
70039
70043
  const htmlWriters = [];
70040
70044
  for (const [_sourcePath, output] of pugHtmlOutputs.entries()) {
70041
70045
  let html = output.content;
70046
+ const htmlOutputDir = import_path8.default.dirname(output.outputPath);
70042
70047
  if (output.pugReferences.length > 0) {
70043
70048
  html = rewritePugReferencesInHtml(
70044
70049
  html,
70045
70050
  output.pugReferences,
70046
- pugToOutputPath
70051
+ pugToOutputPath,
70052
+ htmlOutputDir,
70053
+ outdir
70047
70054
  );
70048
70055
  }
70049
70056
  if (output.lessReferences.length > 0) {
70050
70057
  html = rewriteLessReferencesInHtml(
70051
70058
  html,
70052
70059
  output.lessReferences,
70053
- lessToOutputPath
70060
+ lessToOutputPath,
70061
+ htmlOutputDir,
70062
+ outdir
70054
70063
  );
70055
70064
  }
70056
70065
  const promise = fileWriter.writeFile(output.outputPath, html, {