@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.
- package/README.md +28 -11
- package/package.json +27 -17
- package/src/component/html.js +12 -6
- package/src/component/jsx.d.ts +12 -0
- package/src/component/jsx.js +18 -0
- package/src/component/react.js +17 -10
- package/src/constants.js +5 -4
- package/src/image-plugins.d.ts +3 -11
- package/src/image-plugins.js +40 -29
- package/src/image-processor.d.ts +7 -1
- package/src/image-processor.js +148 -135
- package/src/image-renderer.d.ts +1 -1
- package/src/image-renderer.js +222 -220
- package/src/image-runtime-state.d.ts +20 -0
- package/src/image-runtime-state.js +59 -0
- package/src/image-types.d.ts +3 -0
- package/src/image-utils.js +109 -98
- package/src/index.js +3 -3
- package/src/plugin.d.ts +17 -20
- package/src/plugin.js +275 -259
- package/src/types.js +1 -0
- package/src/utils.js +24 -25
- package/CHANGELOG.md +0 -19
- package/src/bun-plugins.d.ts +0 -22
- package/src/bun-plugins.js +0 -33
package/src/bun-plugins.d.ts
DELETED
|
@@ -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;
|
package/src/bun-plugins.js
DELETED
|
@@ -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
|
-
};
|