Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: rollup types #42

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "./src/jimp.d.ts",
"bundledPackages": [
"jimp",
"@jimp/bmp",
"@jimp/core",
"@jimp/gif",
"@jimp/jpeg",
"@jimp/plugin-blit",
"@jimp/plugin-blur",
"@jimp/plugin-circle",
"@jimp/plugin-color",
"@jimp/plugin-contain",
"@jimp/plugin-cover",
"@jimp/plugin-crop",
"@jimp/plugin-displace",
"@jimp/plugin-dither",
"@jimp/plugin-fisheye",
"@jimp/plugin-flip",
"@jimp/plugin-gaussian",
"@jimp/plugin-invert",
"@jimp/plugin-mask",
"@jimp/plugin-normalize",
"@jimp/plugin-print",
"@jimp/plugin-resize",
"@jimp/plugin-rotate",
"@jimp/plugins",
"@jimp/plugin-scale",
"@jimp/plugin-shadow",
"@jimp/plugin-threshold",
"@jimp/png",
"@jimp/tiff",
"@jimp/types"
],
"compiler": {},
"apiReport": {
"enabled": false
},
"docModel": {
"enabled": false
},
"dtsRollup": {
"enabled": true
},
"tsdocMetadata": {},
"messages": {
"compilerMessageReporting": {
"default": {
"logLevel": "warning"
}
},
"extractorMessageReporting": {
"default": {
"logLevel": "warning"
},
"ae-missing-release-tag": {
"logLevel": "none"
}
},
"tsdocMessageReporting": {
"default": {
"logLevel": "warning"
}
}
}
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
"types": "./dist/jimp.d.ts",
"scripts": {
"build": "jiti ./build",
"build:types": "api-extractor run",
"test": "node ./test/index.js"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.18.9",
"@types/fs-extra": "^9.0.12",
"@types/jimp": "^0.2.28",
"@vercel/ncc": "^0.31.1",
Expand Down
43 changes: 43 additions & 0 deletions src/jimp.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {
Jimp as JimpType,
UnionToIntersection,
GetPluginVal,
GetPluginConst,
GetPluginEncoders,
GetPluginDecoders,
JimpConstructors
} from '@jimp/core';
import typeFn from '@jimp/types';
import pluginFn from '@jimp/plugins';

export * from '@jimp/core';
export * from '@jimp/types'

export type Types = ReturnType<typeof typeFn>;
export type Plugins = ReturnType<typeof pluginFn>;

export type IntersectedPluginTypes = UnionToIntersection<
GetPluginVal<Types> | GetPluginVal<Plugins>
>;

export type IntersectedPluginConsts = UnionToIntersection<
GetPluginConst<Types> | GetPluginConst<Plugins>
>;

export type IntersectedPluginEncoders = UnionToIntersection<
GetPluginEncoders<Types> | GetPluginEncoders<Plugins>
>;

export type IntersectedPluginDecoders = UnionToIntersection<
GetPluginDecoders<Types> | GetPluginDecoders<Plugins>
>;

export type Jimp = JimpType & IntersectedPluginTypes;

export declare const Jimp: JimpConstructors & IntersectedPluginConsts & {
prototype: Jimp;
encoders: IntersectedPluginEncoders;
decoders: IntersectedPluginDecoders;
};

export default Jimp;
Loading