@richiesams/vitepress-plugin-images 0.1.0 → 0.2.0
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 +5 -2
- package/dist/cache.d.ts +1 -1
- package/dist/imageData.d.ts +1 -1
- package/dist/index.d.ts +5 -6
- package/dist/index.js +3 -4
- package/dist/loader.d.ts +1 -1
- package/dist/loader.js +4 -4
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +2 -2
- package/dist/presets.d.ts +1 -1
- package/dist/runtime/OptimizedImage.d.ts +1 -1
- package/dist/runtime/register.js +1 -1
- package/dist/sharp.d.ts +1 -1
- package/dist/sharp.js +1 -1
- package/dist/transform.d.ts +1 -1
- package/dist/vite.d.ts +3 -0
- package/dist/vite.js +2 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ In `.vitepress/config.ts`:
|
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
30
|
import { defineConfig } from "vitepress";
|
|
31
|
-
import { optimizedImagesPlugin } from "@richiesams/vitepress-plugin-images";
|
|
31
|
+
import { optimizedImagesPlugin } from "@richiesams/vitepress-plugin-images/vite";
|
|
32
32
|
|
|
33
33
|
export default defineConfig({
|
|
34
34
|
vite: {
|
|
@@ -83,11 +83,12 @@ You can provide custom presets via `optimizedImagesPlugin({ presets: { ... } })`
|
|
|
83
83
|
|
|
84
84
|
```ts
|
|
85
85
|
import {
|
|
86
|
-
optimizedImagesPlugin,
|
|
87
86
|
registerOptimizedImageComponent,
|
|
88
87
|
OptimizedImage,
|
|
89
88
|
defaultPresets,
|
|
90
89
|
} from "@richiesams/vitepress-plugin-images";
|
|
90
|
+
|
|
91
|
+
import { optimizedImagesPlugin } from "@richiesams/vitepress-plugin-images/vite";
|
|
91
92
|
```
|
|
92
93
|
|
|
93
94
|
## Development
|
|
@@ -131,3 +132,5 @@ The `prepublishOnly` script runs validation automatically before publish:
|
|
|
131
132
|
|
|
132
133
|
- Package exports are configured for ESM (`import`) and types (`.d.ts`).
|
|
133
134
|
- Runtime dependencies include Sharp, Magic String, and Vue SFC parser support.
|
|
135
|
+
- Use `@richiesams/vitepress-plugin-images/vite` for VitePress config plugin imports.
|
|
136
|
+
- Use `@richiesams/vitepress-plugin-images` in theme/runtime code.
|
package/dist/cache.d.ts
CHANGED
package/dist/imageData.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { OptimizedImageData } from "./types";
|
|
1
|
+
export type { OptimizedImageData } from "./types.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export type {
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export { registerOptimizedImageComponent } from "./runtime/register";
|
|
1
|
+
export { defaultPresets } from "./presets.js";
|
|
2
|
+
export type { OptimizedImageData } from "./imageData.js";
|
|
3
|
+
export type { OptimizedImagePreset, OptimizedImagesPluginOptions } from "./types.js";
|
|
4
|
+
export { OptimizedImage } from "./runtime/OptimizedImage.js";
|
|
5
|
+
export { registerOptimizedImageComponent } from "./runtime/register.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { registerOptimizedImageComponent } from "./runtime/register";
|
|
1
|
+
export { defaultPresets } from "./presets.js";
|
|
2
|
+
export { OptimizedImage } from "./runtime/OptimizedImage.js";
|
|
3
|
+
export { registerOptimizedImageComponent } from "./runtime/register.js";
|
package/dist/loader.d.ts
CHANGED
package/dist/loader.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { ImageProcessCache } from "./cache";
|
|
3
|
-
import { defaultPresets, resolvePreset } from "./presets";
|
|
4
|
-
import { processImageWithSharp, toBuildAssetPath } from "./sharp";
|
|
5
|
-
import { ensureStartsWithSlash, isImagePath, normalizePathForId, parseQuery, stripQuery, } from "./utils";
|
|
2
|
+
import { ImageProcessCache } from "./cache.js";
|
|
3
|
+
import { defaultPresets, resolvePreset } from "./presets.js";
|
|
4
|
+
import { processImageWithSharp, toBuildAssetPath } from "./sharp.js";
|
|
5
|
+
import { ensureStartsWithSlash, isImagePath, normalizePathForId, parseQuery, stripQuery, } from "./utils.js";
|
|
6
6
|
const QUERY_FLAG = "optimized-image";
|
|
7
7
|
const DEV_ROUTE_PREFIX = "/@optimized-images/";
|
|
8
8
|
function makeDevUrl(fileName) {
|
package/dist/plugin.d.ts
CHANGED
package/dist/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createImageLoaderPlugin } from "./loader";
|
|
2
|
-
import { transformOptimizedImages } from "./transform";
|
|
1
|
+
import { createImageLoaderPlugin } from "./loader.js";
|
|
2
|
+
import { transformOptimizedImages } from "./transform.js";
|
|
3
3
|
export function optimizedImagesPlugin(options = {}) {
|
|
4
4
|
const componentName = options.componentName ?? "OptimizedImage";
|
|
5
5
|
return [
|
package/dist/presets.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { OptimizedImagePreset, ResolvedPreset } from "./types";
|
|
1
|
+
import type { OptimizedImagePreset, ResolvedPreset } from "./types.js";
|
|
2
2
|
export declare const defaultPresets: Record<string, OptimizedImagePreset>;
|
|
3
3
|
export declare function resolvePreset(presets: Record<string, OptimizedImagePreset>, presetName: string): ResolvedPreset;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PropType } from "vue";
|
|
2
|
-
import type { OptimizedImageData } from "../types";
|
|
2
|
+
import type { OptimizedImageData } from "../types.js";
|
|
3
3
|
export declare const OptimizedImage: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
4
|
image: {
|
|
5
5
|
type: PropType<OptimizedImageData>;
|
package/dist/runtime/register.js
CHANGED
package/dist/sharp.d.ts
CHANGED
package/dist/sharp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import sharp from "sharp";
|
|
4
|
-
import { hash } from "./utils";
|
|
4
|
+
import { hash } from "./utils.js";
|
|
5
5
|
const PLUGIN_VERSION = "0.1.0";
|
|
6
6
|
export async function processImageWithSharp(input) {
|
|
7
7
|
const stat = await fs.stat(input.sourcePath);
|
package/dist/transform.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { TransformResult } from "./types";
|
|
1
|
+
import type { TransformResult } from "./types.js";
|
|
2
2
|
export declare function transformOptimizedImages(code: string, id: string, componentName: string): TransformResult | null;
|
package/dist/vite.d.ts
ADDED
package/dist/vite.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@richiesams/vitepress-plugin-images",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Static image optimization pipeline for VitePress",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
".": {
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./vite": {
|
|
23
|
+
"types": "./dist/vite.d.ts",
|
|
24
|
+
"import": "./dist/vite.js"
|
|
21
25
|
}
|
|
22
26
|
},
|
|
23
27
|
"files": [
|