liferay-npm-bundler-preset-reactjs
Version:
liferay npm bundler preset react
47 lines (46 loc) • 1.51 kB
TypeScript
/**
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import FilePath from './file-path';
/** Alias configuration as expressed in `package.json` files */
export declare type AliasConfig = false | string | AliasHash | undefined;
/** Value of the right hand side of an alias */
export declare type AliasToValue = false | string;
export declare enum AliasFromType {
EXTERNAL = 0,
LOCAL = 1
}
export declare enum AliasToType {
IGNORE = 0,
EXTERNAL = 1,
LOCAL = 2
}
/**
* Index is the `from` field of the alias (`/` normalized to `./`), value is the
* `to` field.
*/
export interface AliasHash {
[index: string]: AliasToValue;
}
/**
* Get `resolve.aliasFields` configuration value.
*
* @remarks
* The `resolve.aliasFields` name resembles the value webpack's configuration
* uses for the same functionality (see
* https://webpack.js.org/configuration/resolve/#resolvealiasfields)
*/
export declare function getAliasFields(globalConfig: object, config: object): string[];
/**
* Get the type of an alias `from` field (left hand side of alias)
*/
export declare function getAliasFromType(from: string): AliasFromType;
/**
* Get the type of an alias `to` field (right hand side of alias)
*/
export declare function getAliasToType(to: AliasToValue): AliasToType;
/**
* Load aliases from a `package.json` file.
*/
export declare function loadAliases(pkgJsonFile: FilePath, aliasFields: string[]): AliasHash;