@bamboocss/node 1.60.0 → 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);
@@ -5986,10 +6015,17 @@ var Builder = class {
5986
6015
  * Later calls stay narrow, which is what the guard was reaching for. A watch rebuild re-emits
5987
6016
  * only the artifacts a config change affected, and a rebuild that changed no config writes
5988
6017
  * nothing at all.
6018
+ *
6019
+ * Unless the output directory is gone: the flag says this builder wrote the artifacts once, not
6020
+ * that they are still there. A process running several builds with the same plugin instances,
6021
+ * and cleaning `styled-system/` between them, failed every build after the first on
6022
+ * `Could not load styled-system/css`.
5989
6023
  */
5990
6024
  async emit() {
5991
- if (!this.hasEmitted) {
5992
- _bamboocss_logger.logger.debug("builder", "Emit artifacts");
6025
+ const ctx = this.context;
6026
+ const gone = this.hasEmitted && ctx !== void 0 && !(0, node_fs.existsSync)(ctx.runtime.path.join(...ctx.paths.root));
6027
+ if (!this.hasEmitted || gone) {
6028
+ _bamboocss_logger.logger.debug("builder", gone ? "Emit artifacts, the output directory having been removed" : "Emit artifacts");
5993
6029
  await codegen(this.getContextOrThrow());
5994
6030
  } else if (this.affecteds?.hasConfigChanged) {
5995
6031
  _bamboocss_logger.logger.debug("builder", "Emit artifacts after config change");
package/dist/index.d.cts CHANGED
@@ -1023,6 +1023,11 @@ declare class Builder {
1023
1023
  * Later calls stay narrow, which is what the guard was reaching for. A watch rebuild re-emits
1024
1024
  * only the artifacts a config change affected, and a rebuild that changed no config writes
1025
1025
  * nothing at all.
1026
+ *
1027
+ * Unless the output directory is gone: the flag says this builder wrote the artifacts once, not
1028
+ * that they are still there. A process running several builds with the same plugin instances,
1029
+ * and cleaning `styled-system/` between them, failed every build after the first on
1030
+ * `Could not load styled-system/css`.
1026
1031
  */
1027
1032
  emit(): Promise<void>;
1028
1033
  setupContext: (options: SetupContextOptions) => Promise<BambooContext>;
package/dist/index.d.mts CHANGED
@@ -1023,6 +1023,11 @@ declare class Builder {
1023
1023
  * Later calls stay narrow, which is what the guard was reaching for. A watch rebuild re-emits
1024
1024
  * only the artifacts a config change affected, and a rebuild that changed no config writes
1025
1025
  * nothing at all.
1026
+ *
1027
+ * Unless the output directory is gone: the flag says this builder wrote the artifacts once, not
1028
+ * that they are still there. A process running several builds with the same plugin instances,
1029
+ * and cleaning `styled-system/` between them, failed every build after the first on
1030
+ * `Could not load styled-system/css`.
1026
1031
  */
1027
1032
  emit(): Promise<void>;
1028
1033
  setupContext: (options: SetupContextOptions) => Promise<BambooContext>;
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);
@@ -5974,10 +6003,17 @@ var Builder = class {
5974
6003
  * Later calls stay narrow, which is what the guard was reaching for. A watch rebuild re-emits
5975
6004
  * only the artifacts a config change affected, and a rebuild that changed no config writes
5976
6005
  * nothing at all.
6006
+ *
6007
+ * Unless the output directory is gone: the flag says this builder wrote the artifacts once, not
6008
+ * that they are still there. A process running several builds with the same plugin instances,
6009
+ * and cleaning `styled-system/` between them, failed every build after the first on
6010
+ * `Could not load styled-system/css`.
5977
6011
  */
5978
6012
  async emit() {
5979
- if (!this.hasEmitted) {
5980
- logger.debug("builder", "Emit artifacts");
6013
+ const ctx = this.context;
6014
+ const gone = this.hasEmitted && ctx !== void 0 && !existsSync(ctx.runtime.path.join(...ctx.paths.root));
6015
+ if (!this.hasEmitted || gone) {
6016
+ logger.debug("builder", gone ? "Emit artifacts, the output directory having been removed" : "Emit artifacts");
5981
6017
  await codegen(this.getContextOrThrow());
5982
6018
  } else if (this.affecteds?.hasConfigChanged) {
5983
6019
  logger.debug("builder", "Emit artifacts after config change");
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.0",
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.0",
64
- "@bamboocss/core": "1.60.0",
65
- "@bamboocss/generator": "1.60.0",
66
- "@bamboocss/logger": "1.60.0",
67
- "@bamboocss/plugin-svelte": "1.60.0",
68
- "@bamboocss/plugin-vue": "1.60.0",
69
- "@bamboocss/reporter": "1.60.0",
70
- "@bamboocss/shared": "1.60.0",
71
- "@bamboocss/token-dictionary": "1.60.0",
72
- "@bamboocss/types": "1.60.0"
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.0"
80
+ "@bamboocss/native-extractor": "1.60.2"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "@astrojs/compiler": ">=2",