@ecopages/image-processor 0.2.1 → 0.3.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.
@@ -1,22 +0,0 @@
1
- /**
2
- * This file contains the plugins for bundling the image specifications.
3
- * @module @ecopages/image-processor/bun-plugins
4
- */
5
- import type { EcoBuildPlugin } from '@ecopages/core/build/build-types';
6
- import type { ImageMap } from './plugin.js';
7
- /**
8
- * This function creates a plugin for bundling the image specifications.
9
- * https://bun.sh/docs/runtime/plugins#virtual-modules
10
- * @param exports
11
- * @returns
12
- */
13
- export declare function createImagePlugin(exports: ImageMap): EcoBuildPlugin;
14
- /**
15
- * This function creates a plugin for bundling the image specifications.
16
- * Due to some limitations in the bundler, we need to use a different approach.
17
- * https://bun.sh/docs/runtime/plugins#virtual-modules > bun-v1.2.5
18
- * (This feature is currently only available at runtime with Bun.plugin and not yet supported in the bundler, but you can mimic the behavior using onResolve and onLoad.)
19
- * @param exports
20
- * @returns
21
- */
22
- export declare function createImagePluginBundler(exports: ImageMap): EcoBuildPlugin;
@@ -1,33 +0,0 @@
1
- import { anyCaseToCamelCase } from "./utils.js";
2
- function createPluginResult(exports) {
3
- return {
4
- contents: `${Object.entries(exports).map(([key, value]) => `export const ${anyCaseToCamelCase(key)} = ${JSON.stringify(value)};`).join("\n")}`,
5
- loader: "ts"
6
- };
7
- }
8
- function createImagePlugin(exports) {
9
- return {
10
- name: "ecopages:images",
11
- setup(build) {
12
- build.module("ecopages:images", () => createPluginResult(exports));
13
- }
14
- };
15
- }
16
- function createImagePluginBundler(exports) {
17
- return {
18
- name: "ecopages:images",
19
- setup(build) {
20
- build.onResolve({ filter: /^ecopages:images$/ }, () => {
21
- return {
22
- namespace: "ecopages-images",
23
- path: "ecopages:images"
24
- };
25
- });
26
- build.onLoad({ filter: /.*/, namespace: "ecopages-images" }, () => createPluginResult(exports));
27
- }
28
- };
29
- }
30
- export {
31
- createImagePlugin,
32
- createImagePluginBundler
33
- };