UNPKG

atlassian-webresource-webpack-plugin

Version:

Auto-generates web-resource definitions from your webpacked code, for usage in an Atlassian product or plugin.

46 lines (45 loc) 2.31 kB
import type { Compiler } from 'webpack'; import type { DataProvidersMap, Options, ProvidedDependenciesMap, ResourceParamMap, TransformationMap } from './types/types'; declare type TransformerExtensions = { [key: string]: string[]; }; declare class WrmPlugin { static extendTransformations(values: TransformerExtensions): Map<any, any>; private options; /** * A Webpack plugin that takes the compilation tree and creates <web-resource> XML definitions that mirror the * dependency graph. * * This plugin will: * * - generate <web-resource> definitions for each entrypoint, along with additional <web-resource> definitions for * and appropriate dependencies on all chunks generated during compilation. * - Add <dependency> declarations to each generated <web-resource> as appropriate, both for internal and external * dependencies in the graph. * - Add appropriate metadata to the <web-resource> definition, such as appropriate <context>s, * enabled/disabled state, and more. * @param {Options} options */ constructor(options: Options); /** * Generate an asset uuid per build - this is used to ensure we have a new "cache" for our assets per build. * As JIRA-Server does not "rebuild" too often, this can be considered reasonable. */ getAssetsUUID(isProduction: boolean): string; ensureTransformationsAreUnique(transformations: TransformationMap): TransformationMap; ensureResourceParamsAreUnique(params: ResourceParamMap): ResourceParamMap; ensureProvidedDependenciesAreUnique(providedDependencies: ProvidedDependenciesMap): ProvidedDependenciesMap; ensureDataProvidersMapIsValid(dataProvidersMap: DataProvidersMap): DataProvidersMap; checkConfig(compiler: Compiler): void; overwritePublicPath(compiler: Compiler): void; hookUpProvidedDependencies(compiler: Compiler): void; injectWRMSpecificRequestTypes(compiler: Compiler): void; /** * Ensure the WRM.require function is available at runtime and is used to load any code-split chunks. */ enableAsyncLoadingWithWRM(compiler: Compiler): void; shouldOverwritePublicPath(): boolean; shouldEnableAsyncLoadingWithWRM(): boolean; apply(compiler: Compiler): void; } export = WrmPlugin;