From 261fbd305ac761f1e7ab39ff40ca2eae10a7b59b Mon Sep 17 00:00:00 2001 From: Mayank Kumar Chaudhari Date: Sun, 2 Jun 2024 14:56:27 +0530 Subject: [PATCH 1/2] Do not remove ';' when require statement starts with ','. --- lib/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/index.ts b/lib/src/index.ts index 5cc1768b..a84cd1fa 100644 --- a/lib/src/index.ts +++ b/lib/src/index.ts @@ -168,7 +168,8 @@ function onEndCallBack(result: BuildResult, options: React18PluginOptions, write for (let index = 1; index < jsxMatches.length; index++) { let token = jsxMatches[index]; if (/^,.*,$/.test(token)) token = token.slice(1); - else if (token.startsWith("var ") && token.endsWith(",")) token = token.slice(4); + else if (/^,.*;$/.test(token)) token = token.replace(";", ""); + else if (/^var .*,$/.test(token)) token = token.slice(4); txt = txt.replace(token, ""); const v1 = jsxMatches[index] .replace(regExp2replace2GetVar, "") From 97ccace50682db678fc00d5af8863f365c568717 Mon Sep 17 00:00:00 2001 From: Mayank Kumar Chaudhari Date: Sun, 2 Jun 2024 14:57:12 +0530 Subject: [PATCH 2/2] Apply changesets --- lib/CHANGELOG.md | 6 ++++++ lib/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/CHANGELOG.md b/lib/CHANGELOG.md index 5b22ec02..bdd84843 100644 --- a/lib/CHANGELOG.md +++ b/lib/CHANGELOG.md @@ -1,5 +1,11 @@ # esbuild-plugin-react18 +## 0.2.4 + +### Patch Changes + +- Do not remove ';' when require statement starts with ','. + ## 0.2.3 ### Patch Changes diff --git a/lib/package.json b/lib/package.json index 94897a66..9fb79479 100644 --- a/lib/package.json +++ b/lib/package.json @@ -2,7 +2,7 @@ "name": "esbuild-plugin-react18", "author": "Mayank Kumar Chaudhari ", "private": false, - "version": "0.2.3", + "version": "0.2.4", "description": "Unlock the Potential of React Server Components! Harness the power of an ESBuild plugin designed for crafting libraries compatible with RSC (React18 Server Components).", "license": "MPL-2.0", "main": "./dist/index.js",