@b9g/libuild 0.1.8 → 0.1.9

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,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.9] - 2025-10-29
6
+
7
+ ### Fixed
8
+ - Preserve import attributes (`with { type: "json" }`) in externalized JSON imports to prevent Node.js runtime errors
9
+ - Upgrade Node.js target to 18+ and engines requirement to >=18.20.0 for import attributes support
10
+
5
11
  ## [0.1.8] - 2025-10-29
6
12
 
7
13
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b9g/libuild",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Zero-config library builds",
5
5
  "keywords": [
6
6
  "build",
@@ -37,7 +37,7 @@
37
37
  }
38
38
  },
39
39
  "engines": {
40
- "node": ">=16.0.0",
40
+ "node": ">=18.20.0",
41
41
  "bun": ">=1.0.0"
42
42
  },
43
43
  "type": "module",
package/src/libuild.cjs CHANGED
@@ -215345,7 +215345,6 @@ function generateExports(entries, mainEntry, options, existingExports = {}) {
215345
215345
  return exportEntry;
215346
215346
  }
215347
215347
  function expandExistingExport(existing, entryFromPath) {
215348
- var _a;
215349
215348
  if (typeof existing === "string") {
215350
215349
  if (existing === "./package.json" || existing.endsWith("/package.json")) {
215351
215350
  return existing;
@@ -215379,7 +215378,7 @@ function generateExports(entries, mainEntry, options, existingExports = {}) {
215379
215378
  throw new Error(`Export path '${existing}' must point to a valid entrypoint in src/ (e.g., './src/utils.js'). Nested directories and internal files (starting with '_' or '.') are not allowed.`);
215380
215379
  } else if (typeof existing === "object" && existing !== null) {
215381
215380
  if (options.formats.cjs && !existing.require && existing.import) {
215382
- const match = (_a = existing.import) == null ? void 0 : _a.match(/\.\/src\/([^/]+\.(?:ts|js))$/);
215381
+ const match = existing.import?.match(/\.\/src\/([^/]+\.(?:ts|js))$/);
215383
215382
  if (match) {
215384
215383
  const filename = match[1];
215385
215384
  if (!isValidEntrypoint(filename)) {
@@ -215764,8 +215763,9 @@ async function build2(cwd, save = false) {
215764
215763
  sourcemap: false,
215765
215764
  external: externalDeps,
215766
215765
  platform: "node",
215767
- target: "node16",
215766
+ target: "node18",
215768
215767
  packages: "external",
215768
+ supported: { "import-attributes": true },
215769
215769
  plugins: [
215770
215770
  externalEntrypointsPlugin({
215771
215771
  entryNames,
@@ -215790,7 +215790,8 @@ async function build2(cwd, save = false) {
215790
215790
  sourcemap: false,
215791
215791
  external: externalDeps,
215792
215792
  platform: "node",
215793
- target: "node16",
215793
+ target: "node18",
215794
+ supported: { "import-attributes": true },
215794
215795
  plugins: [
215795
215796
  externalEntrypointsPlugin({
215796
215797
  entryNames,
@@ -215813,7 +215814,8 @@ async function build2(cwd, save = false) {
215813
215814
  sourcemap: false,
215814
215815
  external: externalDeps,
215815
215816
  platform: "node",
215816
- target: "node16",
215817
+ target: "node18",
215818
+ supported: { "import-attributes": true },
215817
215819
  plugins: [umdPlugin({ globalName })]
215818
215820
  });
215819
215821
  }
package/src/libuild.js CHANGED
@@ -324,7 +324,6 @@ function generateExports(entries, mainEntry, options, existingExports = {}) {
324
324
  return exportEntry;
325
325
  }
326
326
  function expandExistingExport(existing, entryFromPath) {
327
- var _a;
328
327
  if (typeof existing === "string") {
329
328
  if (existing === "./package.json" || existing.endsWith("/package.json")) {
330
329
  return existing;
@@ -358,7 +357,7 @@ function generateExports(entries, mainEntry, options, existingExports = {}) {
358
357
  throw new Error(`Export path '${existing}' must point to a valid entrypoint in src/ (e.g., './src/utils.js'). Nested directories and internal files (starting with '_' or '.') are not allowed.`);
359
358
  } else if (typeof existing === "object" && existing !== null) {
360
359
  if (options.formats.cjs && !existing.require && existing.import) {
361
- const match = (_a = existing.import) == null ? void 0 : _a.match(/\.\/src\/([^/]+\.(?:ts|js))$/);
360
+ const match = existing.import?.match(/\.\/src\/([^/]+\.(?:ts|js))$/);
362
361
  if (match) {
363
362
  const filename = match[1];
364
363
  if (!isValidEntrypoint(filename)) {
@@ -743,8 +742,9 @@ async function build2(cwd, save = false) {
743
742
  sourcemap: false,
744
743
  external: externalDeps,
745
744
  platform: "node",
746
- target: "node16",
745
+ target: "node18",
747
746
  packages: "external",
747
+ supported: { "import-attributes": true },
748
748
  plugins: [
749
749
  externalEntrypointsPlugin({
750
750
  entryNames,
@@ -769,7 +769,8 @@ async function build2(cwd, save = false) {
769
769
  sourcemap: false,
770
770
  external: externalDeps,
771
771
  platform: "node",
772
- target: "node16",
772
+ target: "node18",
773
+ supported: { "import-attributes": true },
773
774
  plugins: [
774
775
  externalEntrypointsPlugin({
775
776
  entryNames,
@@ -792,7 +793,8 @@ async function build2(cwd, save = false) {
792
793
  sourcemap: false,
793
794
  external: externalDeps,
794
795
  platform: "node",
795
- target: "node16",
796
+ target: "node18",
797
+ supported: { "import-attributes": true },
796
798
  plugins: [umdPlugin({ globalName })]
797
799
  });
798
800
  }