Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bun-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.14
1.4.0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A custom [Bun](https://bun.sh) runtime for AWS Lambda with CDK constructs for ea
> [!NOTE]
> **v3 is ESM-only and no longer published as a jsii package.** Polyglot CDK support (Python, Java, .NET) has been removed — there were zero consumers. If you need the layer without CDK, the zip is available as a GitHub Release asset. See [ADR: Drop jsii](docs/adr-drop-jsii.md) for the full rationale.

Current bun version: [1.3.14](https://bun.sh/blog/bun-v1.3.14)
Current bun version: [1.4.0](https://bun.sh/blog/bun-v1.4.0)

## Installation

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { LayerVersionProps } from "aws-cdk-lib/aws-lambda";
import { LogGroup, RetentionDays } from "aws-cdk-lib/aws-logs";
import type { Construct } from "constructs";

const bunVersion = "1.3.14";
const bunVersion = "1.4.0";

export interface BunFunctionProps extends Omit<
FunctionProps,
Expand Down
12 changes: 6 additions & 6 deletions test/buildLayer.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";

const srcIndex = readFileSync(resolve(__dirname, "../src/index.ts"), "utf8");
const bunVersion = srcIndex.match(/const bunVersion = "([^"]+)"/)?.[1] ?? "";

describe("version parameter precedence (Property 6)", () => {
// Uses non-existent versions that pass validation but 404 at download (fast failure)
Expand All @@ -20,17 +25,12 @@ describe("version parameter precedence (Property 6)", () => {
});

test("falls back to src/index.ts version when both are absent", () => {
// The script resolves 1.3.14 from src/index.ts and starts downloading.
// We don't wait for the full download — just verify it found the right version.
// Use a fake non-downloadable version by temporarily patching would be complex,
// so instead we rely on the output showing the resolved version.
const proc = Bun.spawnSync(["bun", "command/buildLayer.ts"], {
env: { ...process.env, BUN_VERSION: undefined },
timeout: 3000,
});
const output = proc.stdout.toString() + proc.stderr.toString();
// The script should print "Downloading Bun v1.3.14" proving it read src/index.ts
expect(output).toContain("1.3.14");
expect(output).toContain(bunVersion);
});
});

Expand Down
7 changes: 5 additions & 2 deletions test/constructs.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, test, beforeAll, afterAll } from "bun:test";
import { existsSync, writeFileSync, unlinkSync } from "node:fs";
import { existsSync, readFileSync, writeFileSync, unlinkSync } from "node:fs";
import { resolve } from "node:path";

import { App, Stack } from "aws-cdk-lib";
Expand All @@ -8,8 +8,11 @@ import * as fc from "fast-check";

import { BunFunction, BunLambdaLayer } from "../src/index";

const srcIndex = readFileSync(resolve(__dirname, "../src/index.ts"), "utf8");
const bunVersion = srcIndex.match(/const bunVersion = "([^"]+)"/)?.[1] ?? "";

// CDK's Code.fromAsset requires the zip to exist on disk during synth
const dummyZipPath = resolve(__dirname, "../src/bun-lambda-layer-1.3.14.zip");
const dummyZipPath = resolve(__dirname, `../src/bun-lambda-layer-${bunVersion}.zip`);

beforeAll(() => {
if (!existsSync(dummyZipPath)) {
Expand Down