UNPKG

939 BTypeScriptView Raw
1import { Plugin } from 'rollup';
2import { InstallTarget } from '../scan-imports';
3/**
4 * rollup-plugin-wrap-install-targets
5 *
6 * How it works:
7 * 1. An array of "install targets" are passed in, describing all known imports + metadata.
8 * 2. If isTreeshake: Known imports are marked for tree-shaking by appending 'snowpack-wrap:' to the input value.
9 * 3. If autoDetectPackageExports match: Also mark for wrapping, and use automatic export detection.
10 * 4. On load, we return a false virtual file for all "snowpack-wrap:" inputs.
11 * a. That virtual file contains only `export ... from 'ACTUAL_FILE_PATH';` exports
12 * b. Rollup uses those exports to drive its tree-shaking algorithm.
13 * c. Rollup uses those exports to inform its "namedExports" for Common.js entrypoints.
14 */
15export declare function rollupPluginWrapInstallTargets(isTreeshake: boolean, autoDetectPackageExports: string[], installTargets: InstallTarget[]): Plugin;