@lonik/oh-image 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Oh Image
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@lonik/oh-image)](https://www.npmjs.com/package/@lonik/oh-image)
4
+
3
5
  The missing `<Image />` component for Vite and React.
4
6
 
5
7
  For full documentation, visit [docs](https://lukonik.github.io/oh-image).
package/dist/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # Oh Image
2
+
3
+ [![npm](https://img.shields.io/npm/v/@lonik/oh-image)](https://www.npmjs.com/package/@lonik/oh-image)
4
+
5
+ The missing `<Image />` component for Vite and React.
6
+
7
+ For full documentation, visit [docs](https://lukonik.github.io/oh-image).
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @lonik/oh-image sharp --save
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ### 1. Register the Vite plugin
18
+
19
+ ```ts
20
+ // vite.config.ts
21
+ import { defineConfig } from "vite";
22
+ import react from "@vitejs/plugin-react";
23
+ import { ohImage } from "@lonik/oh-image/plugin";
24
+
25
+ export default defineConfig({
26
+ plugins: [react(), ohImage()],
27
+ });
28
+ ```
29
+
30
+ ### 2. Use the Image component
31
+
32
+ ```tsx
33
+ import { Image } from "@lonik/oh-image/react";
34
+ import heroImg from "./hero.jpg?oh";
35
+
36
+ function App() {
37
+ return <Image src={heroImg} alt="Hero" />;
38
+ }
39
+ ```
40
+ ## License
41
+
42
+ [MIT](./LICENSE)
package/dist/plugin.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { FormatEnum } from "sharp";
2
- import * as vite0 from "vite";
3
- import * as rollup0 from "rollup";
2
+ import { Plugin } from "vite";
4
3
 
5
4
  //#region src/plugin/types.d.ts
6
5
  interface PluginConfig extends Required<Pick<ImageOptions, "placeholder" | "bps" | "format">> {
@@ -21,18 +20,6 @@ interface ImageOptions {
21
20
  }
22
21
  //#endregion
23
22
  //#region src/plugin/plugin.d.ts
24
- declare function ohImage(options?: Partial<PluginConfig>): {
25
- name: string;
26
- configResolved(this: vite0.MinimalPluginContextWithoutEnvironment, viteConfig: vite0.ResolvedConfig): void;
27
- enforce: "pre";
28
- configureServer(this: vite0.MinimalPluginContextWithoutEnvironment, server: vite0.ViteDevServer): void;
29
- load: {
30
- filter: {
31
- id: RegExp;
32
- };
33
- handler(this: rollup0.PluginContext, id: string): Promise<string | null>;
34
- };
35
- writeBundle(this: rollup0.PluginContext): Promise<void>;
36
- };
23
+ declare function ohImage(options?: Partial<PluginConfig>): Plugin;
37
24
  //#endregion
38
25
  export { type ImageOptions, type PluginConfig, ohImage };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lonik/oh-image",
3
3
  "type": "module",
4
- "version": "1.2.2",
4
+ "version": "1.2.4",
5
5
  "description": "A React component library for optimized image handling.",
6
6
  "author": "Luka Onikadze <lukonik@gmail.com>",
7
7
  "license": "MIT",