@b9g/libuild 0.1.19 → 0.1.20

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
@@ -2,6 +2,11 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.20] - 2025-12-08
6
+
7
+ ### Fixed
8
+ - **Ambient .d.ts export validation** - Fixed validation error when using `--save` with ambient .d.ts files. The build now correctly handles both `./src/` and `./dist/src/` paths for ambient declarations in exports.
9
+
5
10
  ## [0.1.19] - 2025-12-08
6
11
 
7
12
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b9g/libuild",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "Zero-config library builds",
5
5
  "keywords": [
6
6
  "build",
package/src/libuild.cjs CHANGED
@@ -213059,6 +213059,9 @@ async function generateExports(entries, mainEntry, options, existingExports = {}
213059
213059
  if (existing === "./package.json" || existing.endsWith("/package.json")) {
213060
213060
  return existing;
213061
213061
  }
213062
+ if (existing.endsWith(".d.ts") && existing.match(/\.\/(?:dist\/)?src\/[^/]+\.d\.ts$/)) {
213063
+ return existing;
213064
+ }
213062
213065
  const match = existing.match(/\.\/src\/([^/]+\.(?:ts|js))$/);
213063
213066
  if (match) {
213064
213067
  const filename = match[1];
@@ -213819,14 +213822,14 @@ async function build2(cwd, save = false) {
213819
213822
  console.info(" Generating package.json...");
213820
213823
  const cleanedPkg = await cleanPackageJSON(pkg, mainEntry, options, cwd, distDir);
213821
213824
  const exportsResult = await generateExports(entries, mainEntry, options, pkg.exports, distDir, allBinEntries);
213822
- cleanedPkg.exports = fixExportsForDist(exportsResult.exports);
213823
213825
  for (const dtsFile of ambientDtsFiles) {
213824
213826
  const baseName = Path3.basename(dtsFile, ".d.ts");
213825
213827
  const exportKey = `./${baseName}.d.ts`;
213826
- if (!cleanedPkg.exports[exportKey]) {
213827
- cleanedPkg.exports[exportKey] = `./src/${dtsFile}`;
213828
+ if (!exportsResult.exports[exportKey]) {
213829
+ exportsResult.exports[exportKey] = `./src/${dtsFile}`;
213828
213830
  }
213829
213831
  }
213832
+ cleanedPkg.exports = fixExportsForDist(exportsResult.exports);
213830
213833
  if (exportsResult.staleExports.length > 0) {
213831
213834
  console.warn(`\u26A0\uFE0F WARNING: Found ${exportsResult.staleExports.length} stale export(s) pointing to missing src/ files:`);
213832
213835
  for (const staleExport of exportsResult.staleExports) {
package/src/libuild.js CHANGED
@@ -452,6 +452,9 @@ async function generateExports(entries, mainEntry, options, existingExports = {}
452
452
  if (existing === "./package.json" || existing.endsWith("/package.json")) {
453
453
  return existing;
454
454
  }
455
+ if (existing.endsWith(".d.ts") && existing.match(/\.\/(?:dist\/)?src\/[^/]+\.d\.ts$/)) {
456
+ return existing;
457
+ }
455
458
  const match = existing.match(/\.\/src\/([^/]+\.(?:ts|js))$/);
456
459
  if (match) {
457
460
  const filename = match[1];
@@ -1212,14 +1215,14 @@ async function build2(cwd, save = false) {
1212
1215
  console.info(" Generating package.json...");
1213
1216
  const cleanedPkg = await cleanPackageJSON(pkg, mainEntry, options, cwd, distDir);
1214
1217
  const exportsResult = await generateExports(entries, mainEntry, options, pkg.exports, distDir, allBinEntries);
1215
- cleanedPkg.exports = fixExportsForDist(exportsResult.exports);
1216
1218
  for (const dtsFile of ambientDtsFiles) {
1217
1219
  const baseName = Path3.basename(dtsFile, ".d.ts");
1218
1220
  const exportKey = `./${baseName}.d.ts`;
1219
- if (!cleanedPkg.exports[exportKey]) {
1220
- cleanedPkg.exports[exportKey] = `./src/${dtsFile}`;
1221
+ if (!exportsResult.exports[exportKey]) {
1222
+ exportsResult.exports[exportKey] = `./src/${dtsFile}`;
1221
1223
  }
1222
1224
  }
1225
+ cleanedPkg.exports = fixExportsForDist(exportsResult.exports);
1223
1226
  if (exportsResult.staleExports.length > 0) {
1224
1227
  console.warn(`\u26A0\uFE0F WARNING: Found ${exportsResult.staleExports.length} stale export(s) pointing to missing src/ files:`);
1225
1228
  for (const staleExport of exportsResult.staleExports) {