@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/CHANGELOG.md CHANGED
@@ -6,6 +6,15 @@ Given a version number MAJOR.MINOR.PATCH, increment the:
6
6
  2. MINOR version when you add functionality in a backwards compatible manner, and
7
7
  3. PATCH version when you make backwards compatible bug fixes.
8
8
 
9
+ # 4.5.2
10
+
11
+ * PATCH: Fixes incorrect asset path resolution in pug templates when using custom `assetNames` configuration. Asset paths are now correctly computed relative to the HTML output location.
12
+
13
+ # 4.5.1
14
+
15
+ * PATCH: Fixes discovered pug files being output with `.pug` extension instead of `.html`.
16
+ * PATCH: Fixes pug reference rewriting not detecting HTML outputs correctly.
17
+
9
18
  # 4.5.0
10
19
 
11
20
  * MINOR: Adds asset processing for pug entrypoints. Images, fonts, and other assets referenced in pug files are now hashed, copied to the output directory, and their paths rewritten automatically.
@@ -69226,6 +69226,7 @@ async function processHtmlAssets(html, pugFilePath, options2) {
69226
69226
  const hashedPath = await processAsset(
69227
69227
  assetPath,
69228
69228
  pugDir,
69229
+ pugFilePath,
69229
69230
  outdir,
69230
69231
  outbase,
69231
69232
  assetNames,
@@ -69255,6 +69256,7 @@ async function processHtmlAssets(html, pugFilePath, options2) {
69255
69256
  const hashedPath = await processAsset(
69256
69257
  value,
69257
69258
  pugDir,
69259
+ pugFilePath,
69258
69260
  outdir,
69259
69261
  outbase,
69260
69262
  assetNames,
@@ -69273,7 +69275,7 @@ async function processHtmlAssets(html, pugFilePath, options2) {
69273
69275
  }
69274
69276
  return { html: modifiedHtml, assets, pugReferences };
69275
69277
  }
69276
- async function processAsset(assetPath, pugDir, outdir, outbase, assetNames, publicPath, assets, processedAssets) {
69278
+ async function processAsset(assetPath, pugDir, pugFilePath, outdir, outbase, assetNames, publicPath, assets, processedAssets) {
69277
69279
  const absoluteSource = import_path5.default.resolve(pugDir, assetPath);
69278
69280
  if (processedAssets.has(absoluteSource)) {
69279
69281
  return processedAssets.get(absoluteSource);
@@ -69291,7 +69293,15 @@ async function processAsset(assetPath, pugDir, outdir, outbase, assetNames, publ
69291
69293
  outbase
69292
69294
  );
69293
69295
  const absoluteOutput = import_path5.default.join(outdir, hashedFilename);
69294
- const htmlPath = publicPath ? publicPath.replace(/\/$/, "") + "/" + hashedFilename : hashedFilename;
69296
+ const pugRelativeToOutbase = import_path5.default.relative(outbase, pugFilePath);
69297
+ const htmlOutputPath = import_path5.default.join(outdir, pugRelativeToOutbase);
69298
+ const htmlOutputDir = import_path5.default.dirname(htmlOutputPath);
69299
+ let htmlPath;
69300
+ if (publicPath) {
69301
+ htmlPath = publicPath.replace(/\/$/, "") + "/" + hashedFilename;
69302
+ } else {
69303
+ htmlPath = import_path5.default.relative(htmlOutputDir, absoluteOutput);
69304
+ }
69295
69305
  assets.push({
69296
69306
  originalPath: assetPath,
69297
69307
  hashedPath: htmlPath,
@@ -69734,7 +69744,11 @@ var esbuilder = {
69734
69744
  let transforms = [];
69735
69745
  const oFM_result = currentOutputFilesMap.get(relativeFilePath);
69736
69746
  if (oFM_result) {
69737
- relativeTarget = oFM_result.entrypoint?.outfile.relative ?? relativeFilePath;
69747
+ if (oFM_result.entrypoint) {
69748
+ relativeTarget = oFM_result.entrypoint.outfile.relative;
69749
+ } else if (relativeFilePath.endsWith(".pug")) {
69750
+ relativeTarget = relativeFilePath.replace(/\.pug$/, ".html");
69751
+ }
69738
69752
  oFM_result.present = true;
69739
69753
  if (expectingSourcemap && oFM_result.mapFileExpected) {
69740
69754
  }
@@ -69759,7 +69773,7 @@ var esbuilder = {
69759
69773
  `Correcting output file name "${relativeFilePath}" to be "${relativeTarget}".`
69760
69774
  );
69761
69775
  }
69762
- const isHtmlOutput = relativeFilePath.endsWith(".html");
69776
+ const isHtmlOutput = relativeTarget.endsWith(".html");
69763
69777
  const sourcePath = oFM_result?.sourcePath;
69764
69778
  if (isHtmlOutput && sourcePath) {
69765
69779
  const pugRefs = discoveredPugReferences.get(sourcePath) || [];
@@ -69843,8 +69857,7 @@ var esbuilder = {
69843
69857
  const discoveredOutputFilesMap = /* @__PURE__ */ new Map();
69844
69858
  for (const pugSourcePath of newEntryPoints) {
69845
69859
  const relativeSource = import_path7.default.relative(indir, pugSourcePath);
69846
- const expectedOutput = relativeSource.replace(/\.pug$/, ".html");
69847
- discoveredOutputFilesMap.set(expectedOutput, {
69860
+ discoveredOutputFilesMap.set(relativeSource, {
69848
69861
  entrypoint: void 0,
69849
69862
  sourcePath: pugSourcePath,
69850
69863
  present: false,