diff --git a/.bun-version b/.bun-version index 1c99cf0..e516bb9 100644 --- a/.bun-version +++ b/.bun-version @@ -1 +1 @@ -1.4.4 +1.4.5 diff --git a/README.md b/README.md index 0912672..c292a9b 100644 --- a/README.md +++ b/README.md @@ -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.4.4](https://bun.sh/blog/bun-v1.4.4) +Current bun version: [1.4.5](https://bun.sh/blog/bun-v1.4.5) ## Installation diff --git a/src/index.ts b/src/index.ts index 9c392c3..5bd26cc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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.4.4"; +const bunVersion = "1.4.5"; export interface BunFunctionProps extends Omit< FunctionProps, diff --git a/test/runtime.test.ts b/test/runtime.test.ts index 25d76a0..7245611 100644 --- a/test/runtime.test.ts +++ b/test/runtime.test.ts @@ -66,57 +66,14 @@ async function waitFor(props: { condition: () => boolean; timeoutMs: number }): } } -// JS reserved words cannot be used as a `const`/`function` binding name, so a -// generated handler like `export const in = ...` is a syntax error. Excluding -// them keeps the generated identifiers valid (otherwise the test is flaky). -const reservedWords = new Set([ - "break", - "case", - "catch", - "class", - "const", - "continue", - "debugger", - "default", - "delete", - "do", - "else", - "enum", - "export", - "extends", - "false", - "finally", - "for", - "function", - "if", - "import", - "in", - "instanceof", - "new", - "null", - "return", - "super", - "switch", - "this", - "throw", - "true", - "try", - "typeof", - "var", - "void", - "while", - "with", - "yield", - "let", - "static", - "await", - "async", -]); - +// The "h" prefix guarantees a valid identifier: a bare generated name can be a +// reserved word in strict-mode ESM (e.g. `in`, `public`, `eval`), which makes +// the generated handler module a syntax error and the test flaky. function validIdentifier(props: { minLength: number; maxLength: number }): fc.Arbitrary { return fc .string({ minLength: props.minLength, maxLength: props.maxLength }) - .filter((value) => /^[a-zA-Z][a-zA-Z0-9]*$/.test(value) && !reservedWords.has(value)); + .filter((value) => /^[a-zA-Z0-9]+$/.test(value)) + .map((value) => `h${value}`); } describe("handler string resolution (Property 1)", () => {