Skip to content

Commit e24bf09

Browse files
authored
fix(backend): remove legacy saslprep dependency (#1991)
1 parent fa5c6ba commit e24bf09

3 files changed

Lines changed: 5 additions & 26 deletions

File tree

bun.lock

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/backend/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"lodash.mergewith": "^4.6.2",
1515
"mongodb": "^7.2.0",
1616
"rrule": "^2.7.2",
17-
"saslprep": "^1.0.3",
1817
"supertokens-node": "^23.0.1",
1918
"tslib": "^2.4.0"
2019
},

packages/scripts/src/commands/build.backend.ts

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Bundles the Express app into a single Bun-native file.
55
* All JS/TS dependencies (including @compass/core) are inlined.
6-
* Only native C/Rust modules are kept external and installed separately.
6+
* All dependencies are inlined.
77
*
88
* Usage:
99
* bun run build:backend
@@ -33,17 +33,13 @@ await $`rm -rf ${BACKEND_BUILD}`.quiet();
3333
log.success("Removed old backend build");
3434

3535
// 2. Bundle — full bundle so @compass/core and all JS/TS deps are inlined.
36-
// Native modules (C/Rust binaries) must stay external and be installed below.
3736
log.info("Bundling backend ...");
3837
const result = await Bun.build({
3938
entrypoints: [path.join(COMPASS_ROOT_DEV, "packages/backend/src/app.ts")],
4039
outdir: BACKEND_BUILD,
4140
target: "bun",
4241
sourcemap: "inline",
4342
minify: false,
44-
external: [
45-
"saslprep", // MongoDB optional C binding
46-
],
4743
});
4844

4945
if (!result.success) {
@@ -65,27 +61,14 @@ if (await Bun.file(configPath).exists()) {
6561
log.warning(`Compass config file not found: ${configPath}`);
6662
}
6763

68-
// 4. Write a minimal package.json for the external native modules only.
69-
// Everything else is inlined in app.js — no full workspace needed.
70-
const backendPkg = JSON.parse(
71-
await Bun.file(
72-
path.join(COMPASS_ROOT_DEV, "packages/backend/package.json"),
73-
).text(),
74-
) as { dependencies?: Record<string, string> };
75-
76-
const externalVersions: Record<string, string> = {};
77-
for (const name of ["saslprep"]) {
78-
const version = backendPkg.dependencies?.[name];
79-
if (version) externalVersions[name] = version;
80-
}
81-
64+
// 4. Write a minimal package.json. Everything is inlined in app.js.
8265
await Bun.write(
8366
path.join(BACKEND_BUILD, "package.json"),
84-
JSON.stringify({ dependencies: externalVersions }, null, 2),
67+
JSON.stringify({ dependencies: {} }, null, 2),
8568
);
8669

87-
// 5. Install only the external native modules
88-
log.info("Installing native module dependencies ...");
70+
// 5. Install an empty production dependency tree so Bun writes its runtime files.
71+
log.info("Installing production dependency metadata ...");
8972
const install = Bun.spawnSync({
9073
cmd: ["bun", "install", "--production", "--ignore-scripts", "--no-progress"],
9174
cwd: BACKEND_BUILD,

0 commit comments

Comments
 (0)