Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 1x 5x 8x 2x 6x 6x 5x 5x 1x | import type {
CustomPluginOptions,
ResolveIdResult,
Plugin as RollupPlugin,
} from "rollup";
export default function plugin(): RollupPlugin {
return {
name: "seismic",
version: "1.0.0",
async resolveId(
source: string,
_importer?: string,
options?: {
attributes: Record<string, string>;
custom?: CustomPluginOptions;
isEntry: boolean;
},
): Promise<ResolveIdResult> {
if (source.startsWith("/uxasset/externals/")) {
return {
id: source,
external: true,
resolvedBy: "seismic",
};
}
const withAssetExternal = options?.attributes?.external === "uxasset";
if (withAssetExternal) {
const resolvedPath = `/uxasset/externals/${source}/index.jsdbx`;
return {
id: resolvedPath,
external: true,
// makes sure the code output doesn't produce an `assert` like `import _ from '/uxasset/externals/lodash/index.jsdbx' assert { external: 'uxasset' };`
attributes: {},
resolvedBy: "seismic",
};
}
return null;
},
};
}
|