UNPKG

@atlassian/webresource-webpack-plugin

Version:

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

62 lines (61 loc) 3 kB
import './shims/empty-wrm-module.js'; import type { Compiler } from 'webpack'; import type { DataProvidersMap, Options, ProvidedDependenciesMap, ResourceParamMap, TransformationMap } from './types/types'; type TransformerExtensions = { [key: string]: string[]; }; declare class WrmPlugin { static extendTransformations(values: TransformerExtensions): Map<any, any>; private options; private dependencyModuleMap; private resourceModuleMap; private dependencyIssuerMap; private resourceIssuerMap; private resourceAssetsMap; /** * 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; private storeMapEntryInValueSet; private storeModuleDependency; hookUpModuleDependencies(compiler: Compiler): void; hookUpWrInlineLoaders(compiler: Compiler): void; /** * We need to handle CSS url(...) assets so that we can include them as resources in the web-resource, * and so they can be correctly relativized by a transformer from WRM. * In a very specific setup (see `test/test-cases/asset-loading-via-css`), we can't rely on chunk.auxiliaryFiles * and need to track these assets manually. */ hookUpCssUrlAssets(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; private clearInternalMaps; apply(compiler: Compiler): void; } export = WrmPlugin;