@mnrendra/rollup-utils
Version:
Rollup plugin utilities.
66 lines (62 loc) • 2.18 kB
TypeScript
/**
* `@mnrendra/rollup-utils` interface to validate the `store` properties.
*
* A `Store` must have:
*
* - pluginName: A `string` to store your `Rollup` plugin name.
* - name: A `string` to store your `package.json` name.
* - version: A `string` to store your `package.json` version.
* - homepage: A `string` to store your `package.json` homepage.
* - aliases: An array of `Aliases` to store alias values from
* `@mnrendra/tsconfig-alias-parser`.
*
* @see https://www.npmjs.com/package/@mnrendra/rollup-utils#usage
*/
interface Store {
/**
* Your `Rollup` plugin name that will be read by `Rollup`.
*/
pluginName: string;
/**
* Your package `name`, read from `package.json`, that will be converted into
* `pluginName`.
*/
name: string;
/**
* Your package `version`, read from `package.json`, that will be used by
* `Rollup`.
*/
version: string;
/**
* Your package `homepage`, read from `package.json`, that will be utilized by
* `@mnrendra/rollup-utils` utilities in their error handler to provide the
* more info link.
*/
homepage: string;
}
/**
* To initialize the `store` to save the expensive data (e.g., `package.json`
* values).
*
* It will automatically read `package.json` and store the required properties
* in the `store`.
*
* @param {Store} store - An empty `Store` object.
* @param {Record<string, any>} additional - Additional store properties.
*
* @see https://www.npmjs.com/package/@mnrendra/rollup-utils#-initstore
*/
declare const initStore: <T extends Record<string, any> = Record<string, any>>(store: Store, additional?: T) => Promise<void>;
/**
* To print `Rollup` plugin information from the `store`.
*
* The current format is: `• pluginName: version`. If you wish to change the
* format, please request it at https://github.com/mnrendra/rollup-utils/issues.
*
* @param {Store} store - A `Store` object.
*
* @see https://www.npmjs.com/package/@mnrendra/rollup-utils#-printinfo
*/
declare const printInfo: ({ pluginName, version }: Store) => void;
export { type Store, initStore, printInfo };
//# sourceMappingURL=index.d.ts.map