@bamboocss/node 1.60.1 → 1.60.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/dist/index.cjs CHANGED
@@ -1196,13 +1196,42 @@ const prepareAstroTemplate = (source) => {
1196
1196
  };
1197
1197
  //#endregion
1198
1198
  //#region src/native-extractor.ts
1199
- const nativeBinaryName = () => {
1200
- if (process.platform === "darwin" && process.arch === "arm64") return "darwin-arm64.node";
1201
- if (process.platform === "darwin" && process.arch === "x64") return "darwin-x64.node";
1202
- if (process.platform === "linux" && process.arch === "arm64") return "linux-arm64-gnu.node";
1203
- if (process.platform === "linux" && process.arch === "x64") return "linux-x64-gnu.node";
1204
- if (process.platform === "win32" && process.arch === "x64") return "win32-x64-msvc.node";
1199
+ /**
1200
+ * The binaries the release workflow builds into `dist/native`, by platform and architecture and,
1201
+ * on Linux, the C library Node runs on. `__tests__/native-binaries.test.ts` holds the workflow to
1202
+ * building and shipping every one.
1203
+ */
1204
+ const NATIVE_BINARIES = {
1205
+ "darwin-arm64": "darwin-arm64.node",
1206
+ "darwin-x64": "darwin-x64.node",
1207
+ "linux-arm64-gnu": "linux-arm64-gnu.node",
1208
+ "linux-arm64-musl": "linux-arm64-musl.node",
1209
+ "linux-x64-gnu": "linux-x64-gnu.node",
1210
+ "linux-x64-musl": "linux-x64-musl.node",
1211
+ "win32-arm64": "win32-arm64-msvc.node",
1212
+ "win32-x64": "win32-x64-msvc.node"
1213
+ };
1214
+ let musl;
1215
+ /**
1216
+ * Whether Node runs on musl, as on Alpine. A gnu binary fails there on x64, naming glibc's dynamic
1217
+ * loader, and loads on arm64 only because musl's does not check the glibc versions it asks for.
1218
+ *
1219
+ * Alpine's `ldd` is musl's own loader and glibc's is a script naming glibc, so reading it answers
1220
+ * without starting anything. Without one, as in a distroless image, the report Node writes names
1221
+ * the glibc it runs on, and has none to name under musl.
1222
+ */
1223
+ const isMusl = () => {
1224
+ if (musl !== void 0) return musl;
1225
+ try {
1226
+ musl = (0, node_fs.readFileSync)("/usr/bin/ldd", "utf8").includes("musl");
1227
+ } catch {
1228
+ const report = process.report?.getReport();
1229
+ musl = report?.header !== void 0 && !report.header.glibcVersionRuntime;
1230
+ }
1231
+ return musl;
1205
1232
  };
1233
+ /** This machine's binary in `dist/native`, or undefined where the release builds none. */
1234
+ const nativeBinaryName = () => NATIVE_BINARIES[process.platform === "linux" ? `linux-${process.arch}-${isMusl() ? "musl" : "gnu"}` : `${process.platform}-${process.arch}`];
1206
1235
  /** Load the required Rust extractor from the workspace or the published prebuild directory. */
1207
1236
  const loadNativeExtractor = () => {
1208
1237
  const nativeRequire = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
package/dist/index.mjs CHANGED
@@ -1184,13 +1184,42 @@ const prepareAstroTemplate = (source) => {
1184
1184
  };
1185
1185
  //#endregion
1186
1186
  //#region src/native-extractor.ts
1187
- const nativeBinaryName = () => {
1188
- if (process.platform === "darwin" && process.arch === "arm64") return "darwin-arm64.node";
1189
- if (process.platform === "darwin" && process.arch === "x64") return "darwin-x64.node";
1190
- if (process.platform === "linux" && process.arch === "arm64") return "linux-arm64-gnu.node";
1191
- if (process.platform === "linux" && process.arch === "x64") return "linux-x64-gnu.node";
1192
- if (process.platform === "win32" && process.arch === "x64") return "win32-x64-msvc.node";
1187
+ /**
1188
+ * The binaries the release workflow builds into `dist/native`, by platform and architecture and,
1189
+ * on Linux, the C library Node runs on. `__tests__/native-binaries.test.ts` holds the workflow to
1190
+ * building and shipping every one.
1191
+ */
1192
+ const NATIVE_BINARIES = {
1193
+ "darwin-arm64": "darwin-arm64.node",
1194
+ "darwin-x64": "darwin-x64.node",
1195
+ "linux-arm64-gnu": "linux-arm64-gnu.node",
1196
+ "linux-arm64-musl": "linux-arm64-musl.node",
1197
+ "linux-x64-gnu": "linux-x64-gnu.node",
1198
+ "linux-x64-musl": "linux-x64-musl.node",
1199
+ "win32-arm64": "win32-arm64-msvc.node",
1200
+ "win32-x64": "win32-x64-msvc.node"
1201
+ };
1202
+ let musl;
1203
+ /**
1204
+ * Whether Node runs on musl, as on Alpine. A gnu binary fails there on x64, naming glibc's dynamic
1205
+ * loader, and loads on arm64 only because musl's does not check the glibc versions it asks for.
1206
+ *
1207
+ * Alpine's `ldd` is musl's own loader and glibc's is a script naming glibc, so reading it answers
1208
+ * without starting anything. Without one, as in a distroless image, the report Node writes names
1209
+ * the glibc it runs on, and has none to name under musl.
1210
+ */
1211
+ const isMusl = () => {
1212
+ if (musl !== void 0) return musl;
1213
+ try {
1214
+ musl = readFileSync("/usr/bin/ldd", "utf8").includes("musl");
1215
+ } catch {
1216
+ const report = process.report?.getReport();
1217
+ musl = report?.header !== void 0 && !report.header.glibcVersionRuntime;
1218
+ }
1219
+ return musl;
1193
1220
  };
1221
+ /** This machine's binary in `dist/native`, or undefined where the release builds none. */
1222
+ const nativeBinaryName = () => NATIVE_BINARIES[process.platform === "linux" ? `linux-${process.arch}-${isMusl() ? "musl" : "gnu"}` : `${process.platform}-${process.arch}`];
1194
1223
  /** Load the required Rust extractor from the workspace or the published prebuild directory. */
1195
1224
  const loadNativeExtractor = () => {
1196
1225
  const nativeRequire = createRequire(import.meta.url);
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/node",
3
- "version": "1.60.1",
3
+ "version": "1.60.2",
4
4
  "description": "The core css bamboo library",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -60,16 +60,16 @@
60
60
  "pkg-types": "2.3.0",
61
61
  "pluralize": "8.0.0",
62
62
  "ts-pattern": "5.9.0",
63
- "@bamboocss/config": "1.60.1",
64
- "@bamboocss/core": "1.60.1",
65
- "@bamboocss/generator": "1.60.1",
66
- "@bamboocss/logger": "1.60.1",
67
- "@bamboocss/plugin-svelte": "1.60.1",
68
- "@bamboocss/plugin-vue": "1.60.1",
69
- "@bamboocss/reporter": "1.60.1",
70
- "@bamboocss/shared": "1.60.1",
71
- "@bamboocss/token-dictionary": "1.60.1",
72
- "@bamboocss/types": "1.60.1"
63
+ "@bamboocss/config": "1.60.2",
64
+ "@bamboocss/core": "1.60.2",
65
+ "@bamboocss/generator": "1.60.2",
66
+ "@bamboocss/logger": "1.60.2",
67
+ "@bamboocss/plugin-svelte": "1.60.2",
68
+ "@bamboocss/plugin-vue": "1.60.2",
69
+ "@bamboocss/reporter": "1.60.2",
70
+ "@bamboocss/shared": "1.60.2",
71
+ "@bamboocss/token-dictionary": "1.60.2",
72
+ "@bamboocss/types": "1.60.2"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@astrojs/compiler": "3.0.1",
@@ -77,7 +77,7 @@
77
77
  "@types/fs-extra": "11.0.4",
78
78
  "@types/picomatch": "4.0.2",
79
79
  "boxen": "8.0.1",
80
- "@bamboocss/native-extractor": "1.60.1"
80
+ "@bamboocss/native-extractor": "1.60.2"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "@astrojs/compiler": ">=2",