@normed/bundle 4.5.0 → 4.5.2

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
@@ -69240,6 +69240,7 @@ async function processHtmlAssets(html, pugFilePath, options) {
69240
69240
  const hashedPath = await processAsset(
69241
69241
  assetPath,
69242
69242
  pugDir,
69243
+ pugFilePath,
69243
69244
  outdir,
69244
69245
  outbase,
69245
69246
  assetNames,
@@ -69269,6 +69270,7 @@ async function processHtmlAssets(html, pugFilePath, options) {
69269
69270
  const hashedPath = await processAsset(
69270
69271
  value,
69271
69272
  pugDir,
69273
+ pugFilePath,
69272
69274
  outdir,
69273
69275
  outbase,
69274
69276
  assetNames,
@@ -69287,7 +69289,7 @@ async function processHtmlAssets(html, pugFilePath, options) {
69287
69289
  }
69288
69290
  return { html: modifiedHtml, assets, pugReferences };
69289
69291
  }
69290
- async function processAsset(assetPath, pugDir, outdir, outbase, assetNames, publicPath, assets, processedAssets) {
69292
+ async function processAsset(assetPath, pugDir, pugFilePath, outdir, outbase, assetNames, publicPath, assets, processedAssets) {
69291
69293
  const absoluteSource = import_path5.default.resolve(pugDir, assetPath);
69292
69294
  if (processedAssets.has(absoluteSource)) {
69293
69295
  return processedAssets.get(absoluteSource);
@@ -69305,7 +69307,15 @@ async function processAsset(assetPath, pugDir, outdir, outbase, assetNames, publ
69305
69307
  outbase
69306
69308
  );
69307
69309
  const absoluteOutput = import_path5.default.join(outdir, hashedFilename);
69308
- const htmlPath = publicPath ? publicPath.replace(/\/$/, "") + "/" + hashedFilename : hashedFilename;
69310
+ const pugRelativeToOutbase = import_path5.default.relative(outbase, pugFilePath);
69311
+ const htmlOutputPath = import_path5.default.join(outdir, pugRelativeToOutbase);
69312
+ const htmlOutputDir = import_path5.default.dirname(htmlOutputPath);
69313
+ let htmlPath;
69314
+ if (publicPath) {
69315
+ htmlPath = publicPath.replace(/\/$/, "") + "/" + hashedFilename;
69316
+ } else {
69317
+ htmlPath = import_path5.default.relative(htmlOutputDir, absoluteOutput);
69318
+ }
69309
69319
  assets.push({
69310
69320
  originalPath: assetPath,
69311
69321
  hashedPath: htmlPath,
@@ -69748,7 +69758,11 @@ var esbuilder = {
69748
69758
  let transforms = [];
69749
69759
  const oFM_result = currentOutputFilesMap.get(relativeFilePath);
69750
69760
  if (oFM_result) {
69751
- relativeTarget = oFM_result.entrypoint?.outfile.relative ?? relativeFilePath;
69761
+ if (oFM_result.entrypoint) {
69762
+ relativeTarget = oFM_result.entrypoint.outfile.relative;
69763
+ } else if (relativeFilePath.endsWith(".pug")) {
69764
+ relativeTarget = relativeFilePath.replace(/\.pug$/, ".html");
69765
+ }
69752
69766
  oFM_result.present = true;
69753
69767
  if (expectingSourcemap && oFM_result.mapFileExpected) {
69754
69768
  }
@@ -69773,7 +69787,7 @@ var esbuilder = {
69773
69787
  `Correcting output file name "${relativeFilePath}" to be "${relativeTarget}".`
69774
69788
  );
69775
69789
  }
69776
- const isHtmlOutput = relativeFilePath.endsWith(".html");
69790
+ const isHtmlOutput = relativeTarget.endsWith(".html");
69777
69791
  const sourcePath = oFM_result?.sourcePath;
69778
69792
  if (isHtmlOutput && sourcePath) {
69779
69793
  const pugRefs = discoveredPugReferences.get(sourcePath) || [];
@@ -69857,8 +69871,7 @@ var esbuilder = {
69857
69871
  const discoveredOutputFilesMap = /* @__PURE__ */ new Map();
69858
69872
  for (const pugSourcePath of newEntryPoints) {
69859
69873
  const relativeSource = import_path7.default.relative(indir, pugSourcePath);
69860
- const expectedOutput = relativeSource.replace(/\.pug$/, ".html");
69861
- discoveredOutputFilesMap.set(expectedOutput, {
69874
+ discoveredOutputFilesMap.set(relativeSource, {
69862
69875
  entrypoint: void 0,
69863
69876
  sourcePath: pugSourcePath,
69864
69877
  present: false,