From 298f3f8f99bac1ef012da68a3278ce4fcd674a91 Mon Sep 17 00:00:00 2001 From: bq Date: Wed, 18 Feb 2026 18:05:04 +0100 Subject: [PATCH 1/2] add test cases --- src/plugin.test.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/plugin.test.ts b/src/plugin.test.ts index 9cb90bc..66809c3 100644 --- a/src/plugin.test.ts +++ b/src/plugin.test.ts @@ -340,6 +340,21 @@ describe("runtimeVersion 1", () => { expect(output).toMatchSnapshot() }) + it("removes `node:` import prefixes", async (ctx) => { + const input = dedent` + import crypto from "node:crypto" + + var hash = crypto.createHash("sha1") + hash.update("data") + hash.digest("base64") + ` + const result = await buildFile(ctx, input) + + const output = getOutput(result) + expect(output).not.toContain("node:") + expect(output).toContain('from "crypto"') + }) + it("minification does not rename handler function", async (ctx) => { const input = dedent` function handler(event: Record) { @@ -672,6 +687,22 @@ describe("runtimeVersion 2", () => { const output = getOutput(result) expect(output).toMatchSnapshot() }) + + it("removes `node:` import prefixes", async (ctx) => { + const input = dedent` + import crypto from "node:crypto" + + var hash = crypto.createHash("sha1") + hash.update("data") + hash.digest("base64") + ` + const result = await buildFile(ctx, input) + + const output = getOutput(result) + expect(output).not.toContain("node:") + expect(output).toContain('from "crypto"') + }) + it("minification does not rename handler function", async (ctx) => { const input = dedent` function handler(event: Record) { From 5b9d5307a3c2711133693dad1faad4f938fa1493 Mon Sep 17 00:00:00 2001 From: bq Date: Wed, 18 Feb 2026 18:05:28 +0100 Subject: [PATCH 2/2] add options (that dont seem to do anything) --- src/plugin.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugin.ts b/src/plugin.ts index 333c23b..6907207 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -13,6 +13,9 @@ const supportedV1 = { "rest-argument": true, // ES 9 named capture groups are supported. "regexp-named-capture-groups": true, + // Cannot use `node:` prefixes + "node-colon-prefix-import": false, + "node-colon-prefix-require": false, } const supportedV2 = {