From 34bfba060603fec1dd4986d3f1ac4eb8d44ce70f Mon Sep 17 00:00:00 2001 From: Mayank Date: Wed, 18 Dec 2024 14:18:44 +0530 Subject: [PATCH 1/3] fix auto-import from file --- lib/src/index.ts | 3 ++- packages/shared/src/client/demo/demo.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/index.ts b/lib/src/index.ts index 1b3e5c50..42c19ef8 100644 --- a/lib/src/index.ts +++ b/lib/src/index.ts @@ -40,7 +40,8 @@ export const raw: (options?: RawPluginOptions) => Plugin = options => ({ }); build.onLoad({ filter: /\?raw$/, namespace: "raw" }, args => { let filePath = args.pluginData; - if (fs.lstatSync(filePath).isDirectory()) filePath += path.sep + "index"; + if (fs.existsSync(filePath) && fs.lstatSync(filePath).isDirectory()) + filePath += path.sep + "index"; if (!fs.existsSync(filePath)) for (const e of ext) if (fs.existsSync(filePath + "." + e)) { diff --git a/packages/shared/src/client/demo/demo.tsx b/packages/shared/src/client/demo/demo.tsx index f3232b06..05a8f8a6 100644 --- a/packages/shared/src/client/demo/demo.tsx +++ b/packages/shared/src/client/demo/demo.tsx @@ -4,7 +4,7 @@ import styles from "./demo.module.scss"; import { LiveProvider, LiveEditor, LivePreview } from "react-live"; import { Dots1, Dots2, Bars1, Bars2 } from "react18-loaders/dist/server"; import text from "./index.ts?raw"; -import code from "./loader-demo.tsx?raw"; +import code from "./loader-demo?raw"; /** React live demo */ export function Demo() { From c32902e3e65595c3b664e51f6298da8893a90a8f Mon Sep 17 00:00:00 2001 From: Mayank Date: Wed, 18 Dec 2024 14:19:10 +0530 Subject: [PATCH 2/3] docs(changeset): Fix a bug in autoimport logic --- .changeset/lazy-emus-walk.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lazy-emus-walk.md diff --git a/.changeset/lazy-emus-walk.md b/.changeset/lazy-emus-walk.md new file mode 100644 index 00000000..f94d3382 --- /dev/null +++ b/.changeset/lazy-emus-walk.md @@ -0,0 +1,5 @@ +--- +"esbuild-raw-plugin": patch +--- + +Fix a bug in autoimport logic From 5f6b1405dda80d52d9bbbdcf920432c20a0b82e4 Mon Sep 17 00:00:00 2001 From: Mayank Date: Wed, 18 Dec 2024 14:19:51 +0530 Subject: [PATCH 3/3] RELEASING: Releasing 2 package(s) Releases: esbuild-raw-plugin@0.1.1 @repo/shared@0.0.2 --- .changeset/lazy-emus-walk.md | 5 ----- lib/CHANGELOG.md | 6 ++++++ lib/package.json | 2 +- packages/shared/CHANGELOG.md | 7 +++++++ packages/shared/package.json | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) delete mode 100644 .changeset/lazy-emus-walk.md diff --git a/.changeset/lazy-emus-walk.md b/.changeset/lazy-emus-walk.md deleted file mode 100644 index f94d3382..00000000 --- a/.changeset/lazy-emus-walk.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"esbuild-raw-plugin": patch ---- - -Fix a bug in autoimport logic diff --git a/lib/CHANGELOG.md b/lib/CHANGELOG.md index e2d12347..7e62e30a 100644 --- a/lib/CHANGELOG.md +++ b/lib/CHANGELOG.md @@ -1,5 +1,11 @@ # esbuild-raw-plugin +## 0.1.1 + +### Patch Changes + +- c32902e: Fix a bug in autoimport logic + ## 0.1.0 ### Minor Changes diff --git a/lib/package.json b/lib/package.json index 5c2f26fd..83b17e26 100644 --- a/lib/package.json +++ b/lib/package.json @@ -2,7 +2,7 @@ "name": "esbuild-raw-plugin", "author": "Mayank Kumar Chaudhari ", "private": false, - "version": "0.1.0", + "version": "0.1.1", "description": "An ESBuild and TSUP plugin that allows importing files as raw text. Useful for loading code files in documentation, interactive demos, or tools like react-live.", "license": "MPL-2.0", "main": "./dist/index.js", diff --git a/packages/shared/CHANGELOG.md b/packages/shared/CHANGELOG.md index 96e554d3..67b3d7f0 100644 --- a/packages/shared/CHANGELOG.md +++ b/packages/shared/CHANGELOG.md @@ -1,5 +1,12 @@ # @repo/shared +## 0.0.2 + +### Patch Changes + +- Updated dependencies [c32902e] + - esbuild-raw-plugin@0.1.1 + ## 0.0.1 ### Patch Changes diff --git a/packages/shared/package.json b/packages/shared/package.json index a431ad0e..e05776f1 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@repo/shared", - "version": "0.0.1", + "version": "0.0.2", "private": true, "sideEffects": false, "main": "./dist/index.js",