@normed/bundle 4.5.1 → 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,10 @@ 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
+
9
13
  # 4.5.1
10
14
 
11
15
  * PATCH: Fixes discovered pug files being output with `.pug` extension instead of `.html`.
@@ -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,