UNPKG

liferay-npm-bundler-preset-reactjs

Version:

liferay npm bundler preset react

68 lines (67 loc) 2.12 kB
/** * SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> * SPDX-License-Identifier: LGPL-3.0-or-later */ import { Project } from '.'; import { BundlerLoaderEntryPoint, BundlerLoaderMetadata } from '../api/loaders'; import FilePath from '../file-path'; import { VersionInfo } from './types'; /** * A bundler loader plugin descriptor */ export interface BundlerLoaderDescriptor { exec: BundlerLoaderEntryPoint; loader: string; metadata: BundlerLoaderMetadata; options: object; resolvedModule: string; } /** * Implements a restricted subset of webpack rules specification. The rules are * specified as a top level field in `.npmbundlerrc`. Its supported structure * is: * * rules := [<rule>] * rule := { * test: <test>, * include: <include>, * exclude: <exclude>, * use: (<use> | [<use>]) * } * test := (<regexp> | [<regexp>]) * include := (<regexp> | [<regexp>]) * exclude := (<regexp> | [<regexp>]) * regexp := STRING * use := {STRING | <use_with_options>} * use_with_options := { * loader: STRING, * options: OBJECT * } * * See https://webpack.js.org/configuration/module/#modulerules for webpack's * specification. */ export default class Rules { constructor(project: Project); /** Get raw rules config (useful for reports) */ get config(): object[]; /** * Get all available information about versions of loaders used for the * build. * @return a Map where keys are package names */ get versionsInfo(): Map<string, VersionInfo>; /** * Returns the associated rules for a given absolute file path. * @param prjRelPath a native file path relative to `project.dir` */ loadersForFile(prjRelPath: any): BundlerLoaderDescriptor[]; _instantiateLoader(use: BundlerLoaderDescriptor): BundlerLoaderDescriptor; _normalizeRules(): void; _normalizeArrayOfRegExp(rule: object, fieldName: string, defaultValue: any): void; _ruleApplies(rule: any, prjRelFile: FilePath): boolean; private _config; private readonly _project; private _rules; private _versionsInfo; }