liferay-npm-bundler-preset-reactjs
Version:
liferay npm bundler preset react
54 lines (53 loc) • 2.09 kB
TypeScript
/**
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/** Structure of `config.imports` section of `.npmbundlerrc` */
export interface ImportsConfig {
/** Version constraints for provider packages theirselves */
''?: PackageConstraints;
/** Version constraints for packages provided by provider packages */
[index: string]: PackageConstraints | ProviderImports;
}
/** Version constraints indexed by package name */
export interface PackageConstraints {
/** Version constraints for a package name */
[index: string]: string;
}
/**
* Version constraints indexed by package name (may include the provider package
* itself)
*/
export interface ProviderImports extends PackageConstraints {
/** Version constraints for the provider package itself */
'/'?: string;
}
/**
* Another format form {@link ImportsConfig} unrolled for easy indexing of
* imported packages.
*/
export interface UnrolledImportsConfig {
/** Import configuration for a given imported package name */
[index: string]: UnrolledImport;
}
/** Import configuration for an imported package */
export interface UnrolledImport {
/** Provider package name */
name: string;
/** Provider package version constraints */
version: string;
}
/**
* Normalize an imports configuration to canonicalize all syntactic sugar.
* @param importsConfig the configuration in its original format
* @param useSlashFormat whether to use slash or empty string format for
* provider packages version constraints
* @return the normalized configuration after resolving all syntactic sugar
*/
export declare function normalizeImportsConfig(importsConfig: ImportsConfig, useSlashFormat?: boolean): ImportsConfig;
/**
* Unrolls the imports configuration section of .npmbundlerrc file.
* @param importsConfig the configuration in its original format
* @return the unrolled configuration with one entry per module name
*/
export declare function unrollImportsConfig(importsConfig: ImportsConfig): UnrolledImportsConfig;