Skip to content

Commit

Permalink
Merge pull request #3 from react18-tools/fix-autoimport
Browse files Browse the repository at this point in the history
Fix autoimport
  • Loading branch information
mayank1513 authored Dec 18, 2024
2 parents c304b3d + 5f6b140 commit fc6a5db
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
6 changes: 6 additions & 0 deletions lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# esbuild-raw-plugin

## 0.1.1

### Patch Changes

- c32902e: Fix a bug in autoimport logic

## 0.1.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "esbuild-raw-plugin",
"author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
"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",
Expand Down
3 changes: 2 additions & 1 deletion lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
7 changes: 7 additions & 0 deletions packages/shared/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@repo/shared",
"version": "0.0.1",
"version": "0.0.2",
"private": true,
"sideEffects": false,
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/client/demo/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit fc6a5db

Please sign in to comment.