liferay-npm-build-tools-common
Advanced tools
Comparing version 2.18.2 to 3.0.0-snapshot.6ec1bd1
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -6,0 +5,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
/// <reference types="node" /> | ||
import PluginLogger from '../plugin-logger'; | ||
@@ -36,3 +36,3 @@ /** | ||
*/ | ||
encoding?: string | null; | ||
encoding?: BufferEncoding | null; | ||
} | ||
@@ -42,6 +42,6 @@ /** | ||
*/ | ||
export interface BundlerLoaderEntryPoint { | ||
export interface BundlerLoaderEntryPoint<T extends string | Buffer> { | ||
( | ||
/** Context of execution */ | ||
context: BundlerLoaderContext, | ||
context: BundlerLoaderContext<T>, | ||
/** Configured options for the loader */ | ||
@@ -53,5 +53,5 @@ options: object): BundlerLoaderReturn; | ||
*/ | ||
export interface BundlerLoaderContext { | ||
export interface BundlerLoaderContext<T extends string | Buffer> { | ||
/** Content of main transformed object */ | ||
content: string; | ||
content: T; | ||
/** Path to main transformed object (relative to project dir) */ | ||
@@ -58,0 +58,0 @@ filePath: string; |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -16,3 +15,3 @@ */ | ||
interface DefaultValueFactory { | ||
(): any; | ||
(): unknown; | ||
} | ||
@@ -25,3 +24,3 @@ /** | ||
*/ | ||
export declare function get(state: BabelState, defaultValue: any | DefaultValueFactory): any; | ||
export declare function get(state: BabelState, defaultValue: unknown | DefaultValueFactory): unknown; | ||
/** | ||
@@ -32,3 +31,3 @@ * Set an IPC value for a given file path. | ||
*/ | ||
export declare function set(filePath: string, value: any): void; | ||
export declare function set(filePath: string, value: unknown): void; | ||
/** | ||
@@ -35,0 +34,0 @@ * Clear an IPC value for a given file path. |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -11,2 +10,3 @@ */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* eslint-disable @typescript-eslint/camelcase */ | ||
const path_1 = __importDefault(require("path")); | ||
@@ -22,6 +22,9 @@ const file_path_1 = __importDefault(require("./file-path")); | ||
function get(state, defaultValue) { | ||
let defaultValueFactory = defaultValue; | ||
let defaultValueFactory; | ||
if (typeof defaultValue !== 'function') { | ||
defaultValueFactory = () => defaultValue; | ||
defaultValueFactory = (() => defaultValue); | ||
} | ||
else { | ||
defaultValueFactory = defaultValue; | ||
} | ||
if (!state || | ||
@@ -28,0 +31,0 @@ !state.file || |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -12,4 +11,4 @@ */ | ||
const path_1 = __importDefault(require("path")); | ||
const file_path_1 = __importDefault(require("./file-path")); | ||
const project_1 = __importDefault(require("./project")); | ||
const file_path_1 = __importDefault(require("./file-path")); | ||
var FileOrigin; | ||
@@ -57,3 +56,4 @@ (function (FileOrigin) { | ||
} | ||
switch (getFileOrigin(moduleFilePath)) { | ||
const fileOrigin = getFileOrigin(moduleFilePath); | ||
switch (fileOrigin) { | ||
case FileOrigin.SOURCE_DEPENDENCY: { | ||
@@ -88,2 +88,4 @@ const absModuleFilePosixPath = new file_path_1.default(moduleFilePath).resolve().asPosix; | ||
} | ||
default: | ||
throw new Error(`Unkown FileOrigin: ${fileOrigin}`); | ||
} | ||
@@ -119,2 +121,3 @@ packageDirCache[absModuleFilePosixPath] = absPkgDir; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const pkgJson = require(getPackageJsonPath(moduleFilePath)); | ||
@@ -124,8 +127,2 @@ return `${pkgJson.name}@${pkgJson.version}/${moduleName}`; | ||
exports.getModuleName = getModuleName; | ||
function getPackageName(modulePath) { | ||
const modulePathParts = modulePath.split('/'); | ||
return modulePath.startsWith('@') | ||
? `${modulePathParts[0]}/${modulePathParts[1]}` | ||
: modulePathParts[0]; | ||
} | ||
function getFileOrigin(filePath) { | ||
@@ -132,0 +129,0 @@ const absModuleFilePosixPath = new file_path_1.default(filePath).resolve().asPosix; |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -6,0 +5,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
/** | ||
* Tagged template processor for information messages. | ||
* | ||
* Example of use: | ||
* | ||
* ```ts | ||
* info` | ||
* This is an information message with some ${argument} to show | ||
* ` | ||
* ``` | ||
* | ||
* @remarks | ||
* Error messages are prepended with a '⚙' emoji. | ||
*/ | ||
export declare function debug(literals: TemplateStringsArray, ...values: unknown[]): string; | ||
/** | ||
* Tagged template processor for error messages. | ||
@@ -20,3 +34,3 @@ * | ||
*/ | ||
export declare function error(literals: any, ...values: any[]): string; | ||
export declare function error(literals: TemplateStringsArray, ...values: unknown[]): string; | ||
/** | ||
@@ -36,3 +50,3 @@ * Tagged template processor for information messages. | ||
*/ | ||
export declare function info(literals: any, ...values: any[]): string; | ||
export declare function info(literals: TemplateStringsArray, ...values: unknown[]): string; | ||
/** | ||
@@ -68,3 +82,3 @@ * Print an array of lines separating them with CRs or a single line. | ||
*/ | ||
export declare function success(literals: any, ...values: any[]): string; | ||
export declare function success(literals: TemplateStringsArray, ...values: unknown[]): string; | ||
/** | ||
@@ -84,3 +98,3 @@ * Tagged template processor for question messages. | ||
*/ | ||
export declare function question(literals: any, ...values: any[]): string; | ||
export declare function question(literals: TemplateStringsArray, ...values: unknown[]): string; | ||
/** | ||
@@ -97,3 +111,3 @@ * Tagged template processor for titles. | ||
*/ | ||
export declare function title(literals: any, ...values: any[]): string; | ||
export declare function title(literals: TemplateStringsArray, ...values: unknown[]): string; | ||
/** | ||
@@ -113,2 +127,2 @@ * Tagged template processor for warning messages. | ||
*/ | ||
export declare function warn(literals: any, ...values: any[]): string; | ||
export declare function warn(literals: TemplateStringsArray, ...values: unknown[]): string; |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -32,2 +31,3 @@ */ | ||
bold: opts.noDecorations ? verbatim : chalk_1.default.bold, | ||
debug: opts.noColors ? verbatim : chalk_1.default.hex('#666'), | ||
error: opts.noColors ? verbatim : chalk_1.default.hex('#F44'), | ||
@@ -42,2 +42,20 @@ info: opts.noColors ? verbatim : chalk_1.default.hex('#888'), | ||
/** | ||
* Tagged template processor for information messages. | ||
* | ||
* Example of use: | ||
* | ||
* ```ts | ||
* info` | ||
* This is an information message with some ${argument} to show | ||
* ` | ||
* ``` | ||
* | ||
* @remarks | ||
* Error messages are prepended with a '⚙' emoji. | ||
*/ | ||
function debug(literals, ...values) { | ||
return fmt.debug(format('⚙', literals, values)); | ||
} | ||
exports.debug = debug; | ||
/** | ||
* Tagged template processor for error messages. | ||
@@ -44,0 +62,0 @@ * |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -6,0 +5,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -6,0 +5,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -28,3 +27,3 @@ */ | ||
try { | ||
this._data = JSON.parse(fs_extra_1.default.readFileSync(filePath)); | ||
this._data = JSON.parse(fs_extra_1.default.readFileSync(filePath).toString()); | ||
this._loadedFromFile = true; | ||
@@ -31,0 +30,0 @@ return; |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -6,0 +5,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -17,7 +16,7 @@ */ | ||
* @param moduleName a module name | ||
* @param name name of root package | ||
* @param pkgJson package.json object of root package | ||
* @param allowOverride don't fail when trying to change the namespace | ||
* @return the namespaced module name | ||
*/ | ||
export declare function addNamespace(moduleName: string, { name }: { | ||
export declare function addNamespace(moduleName: string, pkgJson: { | ||
name: string; | ||
@@ -42,7 +41,7 @@ }, { allowOverride }?: { | ||
* Compose the namespace of a module according to some root package name. | ||
* @param name name of root package | ||
* @param pkgJson package.json object of root package | ||
* @return the namespace for modules | ||
*/ | ||
export declare function makeNamespace({ name }: { | ||
export declare function makeNamespace(pkgJson: { | ||
name: string; | ||
}): string; |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -30,9 +29,10 @@ */ | ||
* @param moduleName a module name | ||
* @param name name of root package | ||
* @param pkgJson package.json object of root package | ||
* @param allowOverride don't fail when trying to change the namespace | ||
* @return the namespaced module name | ||
*/ | ||
function addNamespace(moduleName, { name }, { allowOverride = false } = {}) { | ||
function addNamespace(moduleName, pkgJson, { allowOverride = false } = {}) { | ||
const name = pkgJson.name; | ||
const moduleNamespace = getNamespace(moduleName); | ||
const namespace = makeNamespace({ name }); | ||
const namespace = makeNamespace(pkgJson); | ||
if (moduleNamespace != null) { | ||
@@ -105,8 +105,8 @@ if (moduleNamespace !== namespace) { | ||
* Compose the namespace of a module according to some root package name. | ||
* @param name name of root package | ||
* @param pkgJson package.json object of root package | ||
* @return the namespace for modules | ||
*/ | ||
function makeNamespace({ name }) { | ||
return name + '$'; | ||
function makeNamespace(pkgJson) { | ||
return pkgJson.name + '$'; | ||
} | ||
exports.makeNamespace = makeNamespace; |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -6,0 +5,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -20,3 +19,3 @@ */ | ||
*/ | ||
constructor(name: string, version: string, pkgPath: string, forceRoot?: boolean); | ||
constructor(name: string, version: string, pkgPath?: string, forceRoot?: boolean); | ||
/** | ||
@@ -23,0 +22,0 @@ * Clone this object and optionally modify some of its fields. |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -6,0 +5,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -12,3 +11,3 @@ */ | ||
level: 'info' | 'warn' | 'error'; | ||
things: any[]; | ||
things: unknown[]; | ||
link?: string; | ||
@@ -33,3 +32,3 @@ } | ||
*/ | ||
info(source: string, ...things: any[]): MessageTweaker; | ||
info(source: string, ...things: unknown[]): MessageTweaker; | ||
/** | ||
@@ -40,3 +39,3 @@ * Log a warn message | ||
*/ | ||
warn(source: string, ...things: any[]): MessageTweaker; | ||
warn(source: string, ...things: unknown[]): MessageTweaker; | ||
/** | ||
@@ -47,3 +46,3 @@ * Log an error message | ||
*/ | ||
error(source: string, ...things: any[]): MessageTweaker; | ||
error(source: string, ...things: unknown[]): MessageTweaker; | ||
/** | ||
@@ -50,0 +49,0 @@ * Get the list of messages |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -109,3 +108,3 @@ */ | ||
toHtml() { | ||
return this._msgs.reduce((str, { level, source, things, link }) => { | ||
return this._msgs.reduce((str, { level, link, source, things }) => { | ||
let html = `${str}${source}:${level}: ${things.join(' ')}<br>`; | ||
@@ -112,0 +111,0 @@ if (link) { |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
import webpack from 'webpack'; | ||
import FilePath from '../file-path'; | ||
import Copy from './copy'; | ||
import Jar from './jar'; | ||
@@ -13,6 +12,36 @@ import Localization from './localization'; | ||
import Rules from './rules'; | ||
import Transform from './transform'; | ||
import { VersionInfo } from './types'; | ||
/** A package manager */ | ||
export declare type PkgManager = 'npm' | 'yarn' | null; | ||
/** Exports configuration */ | ||
export interface Exports { | ||
[id: string]: string; | ||
} | ||
/** Imports configuration */ | ||
export interface Imports { | ||
[pkgName: string]: ImportsConfig; | ||
} | ||
export interface ImportsConfig { | ||
provider: string; | ||
version: string; | ||
} | ||
/** Minimal package.json structure description */ | ||
export interface PkgJson { | ||
name: string; | ||
version: string; | ||
description?: string; | ||
main?: string; | ||
portlet?: { | ||
[property: string]: string | boolean; | ||
}; | ||
dependencies?: { | ||
[pkgName: string]: string; | ||
}; | ||
devDependencies?: { | ||
[pkgName: string]: string; | ||
}; | ||
peerDependencies?: { | ||
[pkgName: string]: string; | ||
}; | ||
} | ||
/** | ||
@@ -22,3 +51,2 @@ * Describes a standard JS Toolkit project. | ||
export declare class Project { | ||
copy: Copy; | ||
jar: Jar; | ||
@@ -29,3 +57,2 @@ l10n: Localization; | ||
rules: Rules; | ||
transform: Transform; | ||
/** | ||
@@ -36,2 +63,21 @@ * @param projectDirPath project's path in native format | ||
/** | ||
* Get module paths to export to the outside world making them available | ||
* through the AMD loader. | ||
* | ||
* @remarks | ||
* Note that the usual CommonJS syntax is used to differentiate local | ||
* modules from dependency (node_modules) modules. | ||
* | ||
* For example: | ||
* | ||
* - Local module: './src/my-api' | ||
* - Dependency module: 'lodash/trimEnd' | ||
*/ | ||
get exports(): Exports; | ||
get imports(): Imports; | ||
/** | ||
* Get user's webpack configuration. | ||
*/ | ||
get webpackConfiguration(): webpack.Configuration; | ||
/** | ||
* Get directories inside the project containing source files starting with | ||
@@ -61,3 +107,3 @@ * `./` (so that they can be safely path.joined) | ||
*/ | ||
get pkgJson(): object; | ||
get pkgJson(): PkgJson; | ||
/** | ||
@@ -90,3 +136,3 @@ * Return the package manager that the project is using or null if it cannot | ||
*/ | ||
require(moduleName: string): any; | ||
require(moduleName: string): unknown; | ||
/** | ||
@@ -98,3 +144,3 @@ * Resolves a module in the context of the project (as opposed to the | ||
*/ | ||
resolve(moduleName: string): any; | ||
resolve(moduleName: string): string; | ||
/** | ||
@@ -121,3 +167,3 @@ * Set program arguments so that some of them can be parsed as if they were | ||
*/ | ||
toolRequire(moduleName: string): any; | ||
toolRequire(moduleName: string): unknown; | ||
/** | ||
@@ -135,4 +181,4 @@ * Resolves a tool module in the context of the project (as opposed to the | ||
*/ | ||
toolResolve(moduleName: string): any; | ||
_loadNpmbundlerrc(): void; | ||
toolResolve(moduleName: string): string; | ||
_loadConfiguration(): void; | ||
_loadPkgJson(): void; | ||
@@ -143,3 +189,3 @@ /** Project relative path to build directory */ | ||
private _configFile; | ||
private _npmbundlerrc; | ||
private _configuration; | ||
private _pkgJson; | ||
@@ -153,2 +199,8 @@ private _pkgManager; | ||
private _toolsDir; | ||
/** Modules to export to the outside world */ | ||
private _exports; | ||
/** Modules to import from the outside world */ | ||
private _imports; | ||
/** User's webpack configuration */ | ||
private _webpackConfiguration; | ||
private _versionsInfo; | ||
@@ -155,0 +207,0 @@ } |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -14,3 +13,2 @@ */ | ||
const fs_1 = __importDefault(require("fs")); | ||
const merge_1 = __importDefault(require("merge")); | ||
const path_1 = __importDefault(require("path")); | ||
@@ -20,4 +18,4 @@ const read_json_sync_1 = __importDefault(require("read-json-sync")); | ||
const file_path_1 = __importDefault(require("../file-path")); | ||
const format_1 = require("../format"); | ||
const modules_1 = require("../modules"); | ||
const copy_1 = __importDefault(require("./copy")); | ||
const jar_1 = __importDefault(require("./jar")); | ||
@@ -28,3 +26,2 @@ const localization_1 = __importDefault(require("./localization")); | ||
const rules_1 = __importDefault(require("./rules")); | ||
const transform_1 = __importDefault(require("./transform")); | ||
/** | ||
@@ -41,2 +38,64 @@ * Describes a standard JS Toolkit project. | ||
/** | ||
* Get module paths to export to the outside world making them available | ||
* through the AMD loader. | ||
* | ||
* @remarks | ||
* Note that the usual CommonJS syntax is used to differentiate local | ||
* modules from dependency (node_modules) modules. | ||
* | ||
* For example: | ||
* | ||
* - Local module: './src/my-api' | ||
* - Dependency module: 'lodash/trimEnd' | ||
*/ | ||
get exports() { | ||
if (this._exports === undefined) { | ||
this._exports = dot_prop_1.default.get(this._configuration, 'exports', {}); | ||
// Export package.json's main entry (if present) automatically | ||
if (!this._exports['main']) { | ||
let main = this._pkgJson.main; | ||
if (main) { | ||
if (main.startsWith('/')) { | ||
main = `.${main}`; | ||
} | ||
else if (!main.startsWith('.')) { | ||
main = `./${main}`; | ||
} | ||
this._exports['main'] = main; | ||
} | ||
else if (fs_1.default.existsSync('./index.js')) { | ||
this._exports['main'] = './index.js'; | ||
} | ||
} | ||
} | ||
return this._exports; | ||
} | ||
get imports() { | ||
if (this._imports === undefined) { | ||
this._imports = {}; | ||
const imports = dot_prop_1.default.get(this._configuration, 'imports', {}); | ||
Object.entries(imports).forEach(([provider, config]) => { | ||
Object.entries(config).forEach(([pkgName, version]) => { | ||
if (pkgName === '/') { | ||
pkgName = provider; | ||
} | ||
this._imports[pkgName] = { | ||
provider, | ||
version, | ||
}; | ||
}); | ||
}, {}); | ||
} | ||
return this._imports; | ||
} | ||
/** | ||
* Get user's webpack configuration. | ||
*/ | ||
get webpackConfiguration() { | ||
if (this._webpackConfiguration === undefined) { | ||
this._webpackConfiguration = dot_prop_1.default.get(this._configuration, 'webpack', {}); | ||
} | ||
return this._webpackConfiguration; | ||
} | ||
/** | ||
* Get directories inside the project containing source files starting with | ||
@@ -48,3 +107,3 @@ * `./` (so that they can be safely path.joined) | ||
this._sources = dot_prop_1.default | ||
.get(this._npmbundlerrc, 'sources', []) | ||
.get(this._configuration, 'sources', []) | ||
.map(source => source.startsWith('./') ? source : `./${source}`) | ||
@@ -61,5 +120,3 @@ .map(source => new file_path_1.default(source, { posix: true })); | ||
if (this._buildDir === undefined) { | ||
let dir = dot_prop_1.default.get(this._npmbundlerrc, 'output', this.jar.supported | ||
? './build' | ||
: './build/resources/main/META-INF/resources'); | ||
let dir = dot_prop_1.default.get(this._configuration, 'output', './build'); | ||
if (!dir.startsWith('./')) { | ||
@@ -82,5 +139,6 @@ dir = `./${dir}`; | ||
get globalConfig() { | ||
const { _npmbundlerrc } = this; | ||
return dot_prop_1.default.get(_npmbundlerrc, 'config', {}); | ||
const { _configuration } = this; | ||
return dot_prop_1.default.get(_configuration, 'config', {}); | ||
} | ||
// TODO: rename to `configuration` | ||
/** | ||
@@ -90,3 +148,3 @@ * Get project's parsed .npmbundlerrc file | ||
get npmbundlerrc() { | ||
return this._npmbundlerrc; | ||
return this._configuration; | ||
} | ||
@@ -151,4 +209,5 @@ /** | ||
let map = new Map(); | ||
const putInMap = packageName => { | ||
const putInMap = (packageName) => { | ||
const pkgJsonPath = this.toolResolve(`${packageName}/package.json`); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const pkgJson = require(pkgJsonPath); | ||
@@ -164,8 +223,7 @@ map.set(pkgJson.name, { | ||
// Get preset version | ||
const { _npmbundlerrc } = this; | ||
const preset = _npmbundlerrc['preset']; | ||
const { _configuration } = this; | ||
const preset = _configuration['preset']; | ||
if (preset) { | ||
putInMap(modules_1.splitModuleName(preset).pkgName); | ||
} | ||
map = new Map([...map, ...this.transform.versionsInfo]); | ||
map = new Map([...map, ...this.rules.versionsInfo]); | ||
@@ -185,7 +243,7 @@ this._versionsInfo = map; | ||
*/ | ||
loadFrom(projectPath, configFilePath = '.npmbundlerrc') { | ||
loadFrom(projectPath, configFilePath = 'liferay-npm-bundler.config.js') { | ||
// First reset everything | ||
this._buildDir = undefined; | ||
this._configFile = undefined; | ||
this._npmbundlerrc = undefined; | ||
this._configuration = undefined; | ||
this._pkgJson = undefined; | ||
@@ -204,5 +262,4 @@ this._pkgManager = undefined; | ||
this._loadPkgJson(); | ||
this._loadNpmbundlerrc(); | ||
this._loadConfiguration(); | ||
// Initialize subdomains | ||
this.copy = new copy_1.default(this); | ||
this.jar = new jar_1.default(this); | ||
@@ -213,3 +270,2 @@ this.l10n = new localization_1.default(this); | ||
this.rules = new rules_1.default(this); | ||
this.transform = new transform_1.default(this); | ||
} | ||
@@ -241,3 +297,3 @@ /** | ||
set argv(argv) { | ||
const { _npmbundlerrc } = this; | ||
const { _configuration } = this; | ||
if (argv.config) { | ||
@@ -247,6 +303,6 @@ this.loadFrom('.', argv.config); | ||
if (argv['create-jar']) { | ||
_npmbundlerrc['create-jar'] = true; | ||
_configuration['create-jar'] = true; | ||
} | ||
if (argv['dump-report']) { | ||
_npmbundlerrc['dump-report'] = true; | ||
_configuration['dump-report'] = true; | ||
} | ||
@@ -269,2 +325,3 @@ } | ||
} | ||
// TODO: this is not needed any more as presets have been removed | ||
/** | ||
@@ -292,31 +349,12 @@ * Resolves a tool module in the context of the project (as opposed to the | ||
} | ||
_loadNpmbundlerrc() { | ||
const npmbundlerrcPath = this._configFile.asNative; | ||
const config = fs_1.default.existsSync(npmbundlerrcPath) | ||
? read_json_sync_1.default(npmbundlerrcPath) | ||
_loadConfiguration() { | ||
const { _configFile } = this; | ||
const configDir = _configFile.dirname(); | ||
if (fs_1.default.existsSync(configDir.join('.npmbundlerrc').asNative)) { | ||
format_1.print(format_1.warn `There is a {.npmbundlerrc} file in {${configDir.basename()}}: it will be ignored`, format_1.info `Consider migrating the project to bundler 3.x or removing it if is a leftover`); | ||
} | ||
const configFilePath = _configFile.asNative; | ||
this._configuration = fs_1.default.existsSync(configFilePath) | ||
? require(configFilePath) | ||
: {}; | ||
// Apply preset if necessary | ||
let presetFilePath; | ||
if (config.preset === undefined) { | ||
presetFilePath = require.resolve('liferay-npm-bundler-preset-standard'); | ||
this._toolsDir = new file_path_1.default(path_1.default.dirname(require.resolve('liferay-npm-bundler-preset-standard/package.json'))); | ||
} | ||
else if (config.preset === '' || config.preset === false) { | ||
// don't load preset | ||
} | ||
else { | ||
presetFilePath = resolve_1.default.sync(config.preset, { | ||
basedir: this.dir.asNative, | ||
}); | ||
const { pkgName } = modules_1.splitModuleName(config.preset); | ||
const presetPkgJsonFilePath = resolve_1.default.sync(`${pkgName}/package.json`, { | ||
basedir: this.dir.asNative, | ||
}); | ||
this._toolsDir = new file_path_1.default(path_1.default.dirname(presetPkgJsonFilePath)); | ||
} | ||
if (presetFilePath) { | ||
const originalConfig = Object.assign({}, config); | ||
Object.assign(config, merge_1.default.recursive(read_json_sync_1.default(presetFilePath), originalConfig)); | ||
} | ||
this._npmbundlerrc = config; | ||
} | ||
@@ -323,0 +361,0 @@ _loadPkgJson() { |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
import { Project } from '.'; | ||
import FilePath from '../file-path'; | ||
import { Project } from '.'; | ||
/** | ||
@@ -21,3 +20,3 @@ * Reflects JAR file configuration of JS Toolkit projects. | ||
*/ | ||
get customManifestHeaders(): object; | ||
get customManifestHeaders(): object | undefined; | ||
/** | ||
@@ -27,16 +26,20 @@ * Get output directory for JAR file relative to `project.dir` and starting | ||
*/ | ||
get outputDir(): FilePath; | ||
get outputDir(): FilePath | undefined; | ||
/** | ||
* Get filename of output JAR file | ||
*/ | ||
get outputFilename(): string; | ||
get outputFilename(): string | undefined; | ||
/** | ||
* Whether or not to add a manifest header in JAR file to make the JS | ||
* extender process this bundle. | ||
* @return can be a boolean, a string forcing an extender version number or | ||
* 'any' to leave version unbounded | ||
* | ||
* @return | ||
* can be a boolean, a string forcing an extender version number or 'any' to | ||
* leave version unbounded | ||
*/ | ||
get requireJsExtender(): boolean | string | 'any'; | ||
get requireJsExtender(): boolean | string | 'any' | undefined; | ||
get supported(): boolean; | ||
get webContextPath(): string; | ||
get webContextPath(): string | undefined; | ||
_getBndWebContextPath(): string; | ||
_getNpmbundlerrcContextPath(): string; | ||
private _customManifestHeaders; | ||
@@ -43,0 +46,0 @@ private _outputDir; |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -12,4 +11,6 @@ */ | ||
const dot_prop_1 = __importDefault(require("dot-prop")); | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
const read_json_sync_1 = __importDefault(require("read-json-sync")); | ||
const file_path_1 = __importDefault(require("../file-path")); | ||
const format_1 = require("../format"); | ||
const util_1 = require("./util"); | ||
@@ -28,2 +29,5 @@ /** | ||
get configurationFile() { | ||
if (!this.supported) { | ||
return undefined; | ||
} | ||
const { _project } = this; | ||
@@ -40,2 +44,5 @@ const absPath = util_1.getFeaturesFilePath(_project, 'create-jar.features.configuration', 'features/configuration.json'); | ||
get customManifestHeaders() { | ||
if (!this.supported) { | ||
return undefined; | ||
} | ||
const { npmbundlerrc } = this._project; | ||
@@ -57,6 +64,9 @@ if (this._customManifestHeaders === undefined) { | ||
get outputDir() { | ||
if (!this.supported) { | ||
return undefined; | ||
} | ||
const { _project } = this; | ||
const { npmbundlerrc } = _project; | ||
if (this._outputDir === undefined) { | ||
let outputDirPosixPath = dot_prop_1.default.get(npmbundlerrc, 'create-jar.output-dir', this.supported ? _project.buildDir.asPosix : undefined); | ||
let outputDirPosixPath = dot_prop_1.default.get(npmbundlerrc, 'create-jar.output-dir', _project.buildDir.asPosix); | ||
if (outputDirPosixPath !== undefined) { | ||
@@ -77,7 +87,8 @@ if (!outputDirPosixPath.startsWith('./')) { | ||
get outputFilename() { | ||
if (!this.supported) { | ||
return undefined; | ||
} | ||
const { npmbundlerrc, pkgJson } = this._project; | ||
if (this._outputFilename === undefined) { | ||
this._outputFilename = dot_prop_1.default.get(npmbundlerrc, 'create-jar.output-filename', this.supported | ||
? pkgJson['name'] + '-' + pkgJson['version'] + '.jar' | ||
: undefined); | ||
this._outputFilename = dot_prop_1.default.get(npmbundlerrc, 'create-jar.output-filename', pkgJson.name + '-' + pkgJson.version + '.jar'); | ||
} | ||
@@ -89,27 +100,64 @@ return this._outputFilename; | ||
* extender process this bundle. | ||
* @return can be a boolean, a string forcing an extender version number or | ||
* 'any' to leave version unbounded | ||
* | ||
* @return | ||
* can be a boolean, a string forcing an extender version number or 'any' to | ||
* leave version unbounded | ||
*/ | ||
get requireJsExtender() { | ||
const { npmbundlerrc } = this._project; | ||
return dot_prop_1.default.get(npmbundlerrc, 'create-jar.features.js-extender', | ||
// TODO: deprecated 'auto-deploy-portlet', remove for the next major version | ||
dot_prop_1.default.get(npmbundlerrc, 'create-jar.auto-deploy-portlet', true)); | ||
if (!this.supported) { | ||
return undefined; | ||
} | ||
const { npmbundlerrc, pkgJson } = this._project; | ||
return dot_prop_1.default.get(npmbundlerrc, 'create-jar.features.js-extender', !!pkgJson.portlet); | ||
} | ||
get supported() { | ||
const { npmbundlerrc } = this._project; | ||
return !!dot_prop_1.default.get(npmbundlerrc, 'create-jar', false); | ||
return !!dot_prop_1.default.get(npmbundlerrc, 'create-jar', true); | ||
} | ||
get webContextPath() { | ||
const { npmbundlerrc, pkgJson } = this._project; | ||
if (!this.supported) { | ||
return undefined; | ||
} | ||
if (!this._webContextPath) { | ||
this._webContextPath = dot_prop_1.default.get(npmbundlerrc, 'create-jar.features.web-context', | ||
// TODO: deprecated 'web-context-path', remove for the next major version | ||
dot_prop_1.default.get(npmbundlerrc, 'create-jar.web-context-path', | ||
// TODO: deprecated 'osgi.Web-ContextPath', remove for the next major version | ||
dot_prop_1.default.get(pkgJson, 'osgi.Web-ContextPath', `/${pkgJson['name']}-${pkgJson['version']}`))); | ||
const { pkgJson } = this._project; | ||
const bndWebContextPath = this._getBndWebContextPath(); | ||
const npmbundlerrcContextPath = this._getNpmbundlerrcContextPath(); | ||
if (bndWebContextPath && npmbundlerrcContextPath) { | ||
format_1.print(format_1.warn ` | ||
Configured web context paths in .npmbundlerrc and bnd.bnd are different: using | ||
the one in .npmbundlerrc | ||
`); | ||
this._webContextPath = npmbundlerrcContextPath; | ||
} | ||
else if (bndWebContextPath) { | ||
this._webContextPath = bndWebContextPath; | ||
} | ||
else if (npmbundlerrcContextPath) { | ||
this._webContextPath = npmbundlerrcContextPath; | ||
} | ||
else { | ||
this._webContextPath = `/${pkgJson.name}-${pkgJson.version}`; | ||
} | ||
} | ||
return this._webContextPath; | ||
} | ||
_getBndWebContextPath() { | ||
const { dir } = this._project; | ||
const bndFile = dir.join('bnd.bnd'); | ||
if (fs_extra_1.default.existsSync(bndFile.asNative)) { | ||
const bnd = fs_extra_1.default.readFileSync(bndFile.asNative).toString(); | ||
const lines = bnd.split('\n'); | ||
const webContextPathLine = lines.find(line => line.startsWith('Web-ContextPath:')); | ||
if (webContextPathLine !== undefined) { | ||
return webContextPathLine.substring(16).trim(); | ||
} | ||
} | ||
return undefined; | ||
} | ||
_getNpmbundlerrcContextPath() { | ||
const { npmbundlerrc } = this._project; | ||
return dot_prop_1.default.get(npmbundlerrc, 'create-jar.features.web-context', undefined); | ||
} | ||
} | ||
exports.default = Jar; |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
import { Project } from '.'; | ||
import FilePath from '../file-path'; | ||
import { Project } from '.'; | ||
/** StringsMaps indexed by locale */ | ||
@@ -9,0 +8,0 @@ export interface LocaleStringsMap { |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -6,0 +5,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -17,2 +16,6 @@ */ | ||
/** | ||
* Whether or not to dump detailed information about what the tool is doing | ||
*/ | ||
get logLevel(): 'off' | 'error' | 'warn' | 'info' | 'debug'; | ||
/** | ||
* Get maximum number of files to process in parallel in any parallelizable | ||
@@ -23,14 +26,6 @@ * operation. | ||
/** | ||
* Whether or not to track usage | ||
*/ | ||
get noTracking(): boolean; | ||
/** | ||
* Get the path to the report file or undefined if no report is configured. | ||
*/ | ||
get reportFile(): FilePath | undefined; | ||
/** | ||
* Whether or not to dump detailed information about what the tool is doing | ||
*/ | ||
get verbose(): boolean; | ||
private readonly _project; | ||
} |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -12,4 +11,2 @@ */ | ||
const dot_prop_1 = __importDefault(require("dot-prop")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = __importDefault(require("path")); | ||
/** | ||
@@ -27,2 +24,9 @@ * Reflects miscellaneous project configuration values. | ||
/** | ||
* Whether or not to dump detailed information about what the tool is doing | ||
*/ | ||
get logLevel() { | ||
const { npmbundlerrc } = this._project; | ||
return dot_prop_1.default.get(npmbundlerrc, 'log-level', 'warn'); | ||
} | ||
/** | ||
* Get maximum number of files to process in parallel in any parallelizable | ||
@@ -47,26 +51,2 @@ * operation. | ||
/** | ||
* Whether or not to track usage | ||
*/ | ||
get noTracking() { | ||
const { _project } = this; | ||
const { npmbundlerrc } = _project; | ||
if (!dot_prop_1.default.has(npmbundlerrc, 'no-tracking')) { | ||
if (dot_prop_1.default.has(process, 'env.LIFERAY_NPM_BUNDLER_NO_TRACKING')) { | ||
dot_prop_1.default.set(npmbundlerrc, 'no-tracking', true); | ||
} | ||
} | ||
if (!dot_prop_1.default.has(npmbundlerrc, 'no-tracking')) { | ||
let dir = _project.dir.asNative; | ||
while (!fs_1.default.existsSync(path_1.default.join(dir, '.liferay-npm-bundler-no-tracking')) && | ||
path_1.default.resolve(dir, '..') !== dir) { | ||
dir = path_1.default.resolve(dir, '..'); | ||
} | ||
if (fs_1.default.existsSync(path_1.default.join(dir, '.liferay-npm-bundler-no-tracking'))) { | ||
dot_prop_1.default.set(npmbundlerrc, 'no-tracking', true); | ||
} | ||
} | ||
// Disable tracking by default | ||
return dot_prop_1.default.get(npmbundlerrc, 'no-tracking', true); | ||
} | ||
/** | ||
* Get the path to the report file or undefined if no report is configured. | ||
@@ -82,10 +62,3 @@ */ | ||
} | ||
/** | ||
* Whether or not to dump detailed information about what the tool is doing | ||
*/ | ||
get verbose() { | ||
const { npmbundlerrc } = this._project; | ||
return dot_prop_1.default.get(npmbundlerrc, 'verbose', false); | ||
} | ||
} | ||
exports.default = Misc; |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -21,4 +20,4 @@ */ | ||
get type(): ProjectType | undefined; | ||
_hasDependency(pkgName: any): any; | ||
_hasDependency(pkgName: any): boolean; | ||
private readonly _project; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var ProjectType; | ||
@@ -39,6 +38,8 @@ (function (ProjectType) { | ||
const { pkgJson } = this._project; | ||
return ((pkgJson['dependencies'] && pkgJson['dependencies'][pkgName]) || | ||
(pkgJson['devDependencies'] && pkgJson['devDependencies'][pkgName])); | ||
return ((pkgJson.dependencies && | ||
pkgJson.dependencies[pkgName] !== undefined) || | ||
(pkgJson.devDependencies && | ||
pkgJson.devDependencies[pkgName] !== undefined)); | ||
} | ||
} | ||
exports.default = Probe; |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
/// <reference types="node" /> | ||
import { Project } from '.'; | ||
import { BundlerLoaderEntryPoint, BundlerLoaderMetadata } from '../api/loaders'; | ||
import FilePath from '../file-path'; | ||
import { Project } from '.'; | ||
import { VersionInfo } from './types'; | ||
@@ -16,3 +16,3 @@ /** | ||
resolvedModule: string; | ||
exec: BundlerLoaderEntryPoint; | ||
exec: BundlerLoaderEntryPoint<string | Buffer>; | ||
options: object; | ||
@@ -63,3 +63,3 @@ metadata: BundlerLoaderMetadata; | ||
_normalizeRules(): void; | ||
_normalizeArrayOfRegExp(rule: object, fieldName: string, defaultValue: any): void; | ||
_normalizeArrayOfRegExp(rule: object, fieldName: string, defaultValue: unknown): void; | ||
_ruleApplies(rule: any, prjRelFile: FilePath): boolean; | ||
@@ -66,0 +66,0 @@ private _config; |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -65,4 +64,5 @@ */ | ||
this._versionsInfo = resolvedModules.reduce((map, resolvedModule) => { | ||
const { pkgName, modulePath } = modules_1.splitModuleName(resolvedModule); | ||
const { modulePath, pkgName } = modules_1.splitModuleName(resolvedModule); | ||
const pkgJsonPath = _project.toolResolve(`${pkgName}/package.json`); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const pkgJson = require(pkgJsonPath); | ||
@@ -69,0 +69,0 @@ map.set(resolvedModule, { |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
import { Project } from '.'; | ||
import PkgDesc from '../pkg-desc'; | ||
import { Project } from '.'; | ||
import { BundlerPluginDescriptor } from './types'; | ||
@@ -9,0 +8,0 @@ /** |
"use strict"; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -23,3 +22,3 @@ */ | ||
function getFeaturesFilePath(project, featuresKeyPath, defaultPrjRelPosixPath) { | ||
const { npmbundlerrc, dir: projectDir } = project; | ||
const { dir: projectDir, npmbundlerrc } = project; | ||
const prjRelPosixPath = dot_prop_1.default.get(npmbundlerrc, featuresKeyPath); | ||
@@ -107,4 +106,4 @@ if (prjRelPosixPath !== undefined) { | ||
: `liferay-npm-bundler-plugin-${pluginName}`); | ||
if (pluginModule.default !== undefined) { | ||
pluginModule = pluginModule.default; | ||
if (pluginModule['default'] !== undefined) { | ||
pluginModule = pluginModule['default']; | ||
} | ||
@@ -111,0 +110,0 @@ return { |
{ | ||
"name": "liferay-npm-build-tools-common", | ||
"version": "2.18.2", | ||
"version": "3.0.0-snapshot.6ec1bd1", | ||
"description": "Utility library for Liferay NPM Build Tools.", | ||
@@ -8,15 +8,14 @@ "scripts": { | ||
"build": "tsc && yarn copyfiles", | ||
"prepublish": "yarn build" | ||
"release:snapshot": "node ../../scripts/release-snapshot.js" | ||
}, | ||
"dependencies": { | ||
"chalk": "^2.4.2", | ||
"clone": "^2.1.2", | ||
"dot-prop": "^5.0.1", | ||
"escape-string-regexp": "^2.0.0", | ||
"liferay-npm-bundler-preset-standard": "2.18.2", | ||
"merge": "^1.2.1", | ||
"fs-extra": "^8.1.0", | ||
"properties": "^1.2.1", | ||
"read-json-sync": "^2.0.1", | ||
"resolve": "^1.8.1" | ||
}, | ||
"gitHead": "d21e1ed25b73fbb0e4cc6e0db1db414c4c8774e8" | ||
} | ||
"resolve": "^1.8.1", | ||
"webpack": "^4.41.6" | ||
} | ||
} |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -9,3 +8,3 @@ */ | ||
import { loadAliases } from '../alias'; | ||
import {loadAliases} from '../alias'; | ||
import FilePath from '../file-path'; | ||
@@ -111,3 +110,3 @@ | ||
expect(aliases['toString']).toBeUndefined(); | ||
}) | ||
}); | ||
}); |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -8,6 +7,6 @@ */ | ||
import fs from 'fs'; | ||
import PkgDesc from 'liferay-npm-build-tools-common/lib/pkg-desc'; | ||
import path from 'path'; | ||
import Manifest from '../manifest'; | ||
import PkgDesc from '../pkg-desc'; | ||
@@ -14,0 +13,0 @@ it('addPackage/getPackage work', () => { |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -37,3 +36,3 @@ */ | ||
const aliasesCache: { [index: string]: AliasHash } = Object.create(null); | ||
const aliasesCache: {[index: string]: AliasHash} = Object.create(null); | ||
@@ -40,0 +39,0 @@ /** |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -38,3 +37,3 @@ */ | ||
*/ | ||
encoding?: string | null; | ||
encoding?: BufferEncoding | null; | ||
} | ||
@@ -45,6 +44,6 @@ | ||
*/ | ||
export interface BundlerLoaderEntryPoint { | ||
export interface BundlerLoaderEntryPoint<T extends string | Buffer> { | ||
( | ||
/** Context of execution */ | ||
context: BundlerLoaderContext, | ||
context: BundlerLoaderContext<T>, | ||
@@ -59,5 +58,5 @@ /** Configured options for the loader */ | ||
*/ | ||
export interface BundlerLoaderContext { | ||
export interface BundlerLoaderContext<T extends string | Buffer> { | ||
/** Content of main transformed object */ | ||
content: string; | ||
content: T; | ||
@@ -64,0 +63,0 @@ /** Path to main transformed object (relative to project dir) */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
/* eslint-disable @typescript-eslint/camelcase */ | ||
import path from 'path'; | ||
@@ -28,3 +29,3 @@ | ||
interface DefaultValueFactory { | ||
(): any; | ||
(): unknown; | ||
} | ||
@@ -40,8 +41,10 @@ | ||
state: BabelState, | ||
defaultValue: any | DefaultValueFactory | ||
): any { | ||
let defaultValueFactory: DefaultValueFactory = defaultValue; | ||
defaultValue: unknown | DefaultValueFactory | ||
): unknown { | ||
let defaultValueFactory: DefaultValueFactory; | ||
if (typeof defaultValue !== 'function') { | ||
defaultValueFactory = () => defaultValue; | ||
defaultValueFactory = (() => defaultValue) as DefaultValueFactory; | ||
} else { | ||
defaultValueFactory = defaultValue as DefaultValueFactory; | ||
} | ||
@@ -72,3 +75,3 @@ | ||
*/ | ||
export function set(filePath: string, value: any): void { | ||
export function set(filePath: string, value: unknown): void { | ||
global._babel_ipc_[path.resolve(filePath)] = value; | ||
@@ -75,0 +78,0 @@ } |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -9,4 +8,4 @@ */ | ||
import FilePath from './file-path'; | ||
import project from './project'; | ||
import FilePath from './file-path'; | ||
@@ -59,3 +58,5 @@ enum FileOrigin { | ||
switch (getFileOrigin(moduleFilePath)) { | ||
const fileOrigin = getFileOrigin(moduleFilePath); | ||
switch (fileOrigin) { | ||
case FileOrigin.SOURCE_DEPENDENCY: { | ||
@@ -122,2 +123,5 @@ const absModuleFilePosixPath = new FilePath( | ||
} | ||
default: | ||
throw new Error(`Unkown FileOrigin: ${fileOrigin}`); | ||
} | ||
@@ -162,2 +166,3 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const pkgJson = require(getPackageJsonPath(moduleFilePath)); | ||
@@ -168,10 +173,2 @@ | ||
function getPackageName(modulePath: string): string { | ||
const modulePathParts = modulePath.split('/'); | ||
return modulePath.startsWith('@') | ||
? `${modulePathParts[0]}/${modulePathParts[1]}` | ||
: modulePathParts[0]; | ||
} | ||
function getFileOrigin(filePath: string): FileOrigin { | ||
@@ -178,0 +175,0 @@ const absModuleFilePosixPath = new FilePath(filePath).resolve().asPosix; |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -31,15 +30,15 @@ */ | ||
toString() { | ||
toString(): string { | ||
return this.asNative; | ||
} | ||
get asNative() { | ||
get asNative(): string { | ||
return this._nativePath; | ||
} | ||
get asPosix() { | ||
get asPosix(): string { | ||
return this._posixPath; | ||
} | ||
get asWindows() { | ||
get asWindows(): string { | ||
return this._windowsPath; | ||
@@ -46,0 +45,0 @@ } |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -27,3 +26,3 @@ */ | ||
const verbatim = (...args) => args.join(' '); | ||
const verbatim = (...args): string => args.join(' '); | ||
@@ -33,2 +32,3 @@ /** Chalk formats table */ | ||
bold: opts.noDecorations ? verbatim : chalk.bold, | ||
debug: opts.noColors ? verbatim : chalk.hex('#666'), | ||
error: opts.noColors ? verbatim : chalk.hex('#F44'), | ||
@@ -44,2 +44,23 @@ info: opts.noColors ? verbatim : chalk.hex('#888'), | ||
/** | ||
* Tagged template processor for information messages. | ||
* | ||
* Example of use: | ||
* | ||
* ```ts | ||
* info` | ||
* This is an information message with some ${argument} to show | ||
* ` | ||
* ``` | ||
* | ||
* @remarks | ||
* Error messages are prepended with a '⚙' emoji. | ||
*/ | ||
export function debug( | ||
literals: TemplateStringsArray, | ||
...values: unknown[] | ||
): string { | ||
return fmt.debug(format('⚙', literals, values)); | ||
} | ||
/** | ||
* Tagged template processor for error messages. | ||
@@ -58,3 +79,6 @@ * | ||
*/ | ||
export function error(literals, ...values) { | ||
export function error( | ||
literals: TemplateStringsArray, | ||
...values: unknown[] | ||
): string { | ||
return fmt.error(format('❌', literals, values)); | ||
@@ -77,3 +101,6 @@ } | ||
*/ | ||
export function info(literals, ...values) { | ||
export function info( | ||
literals: TemplateStringsArray, | ||
...values: unknown[] | ||
): string { | ||
return fmt.info(format('ℹ️', literals, values)); | ||
@@ -133,3 +160,6 @@ } | ||
*/ | ||
export function success(literals, ...values) { | ||
export function success( | ||
literals: TemplateStringsArray, | ||
...values: unknown[] | ||
): string { | ||
return fmt.success(format('✔️', literals, values)); | ||
@@ -152,3 +182,6 @@ } | ||
*/ | ||
export function question(literals, ...values) { | ||
export function question( | ||
literals: TemplateStringsArray, | ||
...values: unknown[] | ||
): string { | ||
return fmt.question(format('❓', literals, values)); | ||
@@ -168,3 +201,6 @@ } | ||
*/ | ||
export function title(literals, ...values) { | ||
export function title( | ||
literals: TemplateStringsArray, | ||
...values: unknown[] | ||
): string { | ||
return fmt.title(format('', literals, values)); | ||
@@ -187,3 +223,6 @@ } | ||
*/ | ||
export function warn(literals, ...values) { | ||
export function warn( | ||
literals: TemplateStringsArray, | ||
...values: unknown[] | ||
): string { | ||
return fmt.warn(format('⚠️', literals, values)); | ||
@@ -203,3 +242,7 @@ } | ||
*/ | ||
function format(emoji: string, literals: string[], values: any[]): string { | ||
function format( | ||
emoji: string, | ||
literals: TemplateStringsArray, | ||
values: unknown[] | ||
): string { | ||
let ret: string = literals[0]; | ||
@@ -206,0 +249,0 @@ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -13,3 +12,3 @@ */ | ||
export function negate<T extends string | string[]>(globs: T): T { | ||
const negate = (glob: string) => | ||
const negate = (glob: string): string => | ||
glob[0] === '!' ? glob.substring(1) : `!${glob}`; | ||
@@ -16,0 +15,0 @@ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -58,3 +57,3 @@ */ | ||
importsConfig: ImportsConfig, | ||
useSlashFormat: boolean = false | ||
useSlashFormat = false | ||
): ImportsConfig { | ||
@@ -61,0 +60,0 @@ const normalized: ImportsConfig = {}; |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -12,4 +11,4 @@ */ | ||
import FilePath from './file-path'; | ||
import PkgDesc from './pkg-desc'; | ||
import project from './project'; | ||
import PkgDesc from './pkg-desc'; | ||
@@ -33,4 +32,5 @@ export {ModuleFlags, Package}; | ||
try { | ||
this._data = JSON.parse(fs.readFileSync(filePath)); | ||
this._data = JSON.parse(fs.readFileSync(filePath).toString()); | ||
this._loadedFromFile = true; | ||
return; | ||
@@ -178,3 +178,3 @@ } catch (err) { | ||
*/ | ||
function sortObjectKeysReplacer(key, value) { | ||
function sortObjectKeysReplacer(key: string, value: unknown): unknown { | ||
if (value instanceof Object && !Array.isArray(value)) { | ||
@@ -185,2 +185,3 @@ return Object.keys(value) | ||
sorted[key] = value[key]; | ||
return sorted; | ||
@@ -187,0 +188,0 @@ }, {}); |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -23,3 +22,3 @@ */ | ||
* @param moduleName a module name | ||
* @param name name of root package | ||
* @param pkgJson package.json object of root package | ||
* @param allowOverride don't fail when trying to change the namespace | ||
@@ -30,7 +29,8 @@ * @return the namespaced module name | ||
moduleName: string, | ||
{name}: {name: string}, | ||
pkgJson: {name: string}, | ||
{allowOverride = false}: {allowOverride?: boolean} = {} | ||
): string { | ||
const name = pkgJson.name; | ||
const moduleNamespace = getNamespace(moduleName); | ||
const namespace = makeNamespace({name}); | ||
const namespace = makeNamespace(pkgJson); | ||
@@ -104,7 +104,7 @@ if (moduleNamespace != null) { | ||
* Compose the namespace of a module according to some root package name. | ||
* @param name name of root package | ||
* @param pkgJson package.json object of root package | ||
* @return the namespace for modules | ||
*/ | ||
export function makeNamespace({name}: {name: string}): string { | ||
return name + '$'; | ||
export function makeNamespace(pkgJson: {name: string}): string { | ||
return pkgJson.name + '$'; | ||
} |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -114,6 +113,6 @@ */ | ||
return { | ||
isDirectory: () => false, | ||
isFile: () => false, | ||
isDirectory: (): boolean => false, | ||
isFile: (): boolean => false, | ||
}; | ||
} | ||
} |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -29,4 +28,4 @@ */ | ||
version: string, | ||
pkgPath: string, | ||
forceRoot: boolean = false | ||
pkgPath?: string, | ||
forceRoot = false | ||
) { | ||
@@ -33,0 +32,0 @@ this._name = name; |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -13,3 +12,3 @@ */ | ||
level: 'info' | 'warn' | 'error'; | ||
things: any[]; | ||
things: unknown[]; | ||
link?: string; | ||
@@ -25,2 +24,3 @@ } | ||
this._msg.link = link; | ||
return this; | ||
@@ -63,3 +63,3 @@ } | ||
*/ | ||
info(source: string, ...things: any[]): MessageTweaker { | ||
info(source: string, ...things: unknown[]): MessageTweaker { | ||
const msg: Message = { | ||
@@ -81,3 +81,3 @@ source, | ||
*/ | ||
warn(source: string, ...things: any[]): MessageTweaker { | ||
warn(source: string, ...things: unknown[]): MessageTweaker { | ||
const msg: Message = { | ||
@@ -99,3 +99,3 @@ source, | ||
*/ | ||
error(source: string, ...things: any[]): MessageTweaker { | ||
error(source: string, ...things: unknown[]): MessageTweaker { | ||
const msg: Message = { | ||
@@ -151,3 +151,3 @@ source, | ||
toHtml(): string { | ||
return this._msgs.reduce((str, {level, source, things, link}) => { | ||
return this._msgs.reduce((str, {level, link, source, things}) => { | ||
let html = `${str}${source}:${level}: ${things.join(' ')}<br>`; | ||
@@ -154,0 +154,0 @@ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -8,6 +7,5 @@ */ | ||
import child_process from 'child_process'; | ||
import FilePath from 'liferay-npm-build-tools-common/lib/file-path'; | ||
import path from 'path'; | ||
import PkgDesc from '../../pkg-desc'; | ||
import FilePath from '../../file-path'; | ||
import {Project} from '../index'; | ||
@@ -70,39 +68,2 @@ | ||
describe('project.copy', () => { | ||
let project; | ||
beforeAll(() => { | ||
project = new Project( | ||
path.join(__dirname, '__fixtures__', 'project', 'standard') | ||
); | ||
}); | ||
it('returns exclusions for configured package@version', () => { | ||
const pkg = new PkgDesc('is-array', '1.0.1', __dirname); | ||
expect(project.copy.getExclusions(pkg)).toEqual([ | ||
'test/**/*', | ||
'Makefile', | ||
]); | ||
}); | ||
it('returns exclusions for configured package', () => { | ||
const pkg = new PkgDesc('is-object', '1.0.0', __dirname); | ||
expect(project.copy.getExclusions(pkg)).toEqual(['test/**/*']); | ||
}); | ||
it('returns exclusions for unknown package', () => { | ||
const pkg = new PkgDesc('other-package', '1.0.0', __dirname); | ||
expect(project.copy.getExclusions(pkg)).toEqual(['__tests__/**/*']); | ||
}); | ||
it('returns ["**/*"] when configured as true', () => { | ||
const pkg = new PkgDesc('is-true', '1.0.0', __dirname); | ||
expect(project.copy.getExclusions(pkg)).toEqual(['**/*']); | ||
}); | ||
}); | ||
describe('project.jar', () => { | ||
@@ -161,5 +122,10 @@ let project; | ||
describe('project.jar.requireJsExtender', () => { | ||
it('returns true when create-jar config present and features/js-extender missing', () => { | ||
it('returns true when package.json has a portlet section', () => { | ||
const project = new Project( | ||
path.join(__dirname, '__fixtures__', 'project', 'create-jar-empty') | ||
path.join( | ||
__dirname, | ||
'__fixtures__', | ||
'project', | ||
'empty-with-portlet' | ||
) | ||
); | ||
@@ -170,5 +136,5 @@ | ||
it('returns false when create-jar config present and features/js-extender false', () => { | ||
it('returns false when package.json has no portlet section', () => { | ||
const project = new Project( | ||
path.join(__dirname, '__fixtures__', 'project', 'create-jar') | ||
path.join(__dirname, '__fixtures__', 'project', 'empty') | ||
); | ||
@@ -178,2 +144,15 @@ | ||
}); | ||
it('returns undefined when create-jar is false even if package.json has a portlet section', () => { | ||
const project = new Project( | ||
path.join( | ||
__dirname, | ||
'__fixtures__', | ||
'project', | ||
'create-jar-off-with-portlet' | ||
) | ||
); | ||
expect(project.jar.requireJsExtender).toBeUndefined(); | ||
}); | ||
}); | ||
@@ -372,111 +351,2 @@ | ||
describe('project.transform', () => { | ||
let project; | ||
beforeAll(() => { | ||
project = new Project( | ||
path.join(__dirname, '__fixtures__', 'project', 'transform') | ||
); | ||
}); | ||
it('loads default "pre" plugins correctly', () => { | ||
const pkg = new PkgDesc('package-star', '1.0.0', __dirname); | ||
const plugins = project.transform.getPrePluginDescriptors(pkg); | ||
expect(plugins[0].run({}, {})).toEqual(0); | ||
expect(plugins[0].config).toEqual({}); | ||
expect(plugins[1].run({}, {})).toEqual(1); | ||
expect(plugins[1].config).toEqual('config-1'); | ||
}); | ||
it('loads default "post" plugins correctly', () => { | ||
const pkg = new PkgDesc('package-star', '1.0.0', __dirname); | ||
const plugins = project.transform.getPostPluginDescriptors(pkg); | ||
expect(plugins[0].run({}, {})).toEqual(2); | ||
expect(plugins[0].config).toEqual({}); | ||
expect(plugins[1].run({}, {})).toEqual(3); | ||
expect(plugins[1].config).toEqual('config-3'); | ||
}); | ||
it('loads per-package "pre" plugins correctly', () => { | ||
const pkg = new PkgDesc('package', '1.0.0', __dirname); | ||
const plugins = project.transform.getPrePluginDescriptors(pkg); | ||
expect(plugins[0].run({}, {})).toEqual(4); | ||
expect(plugins[0].config).toEqual({}); | ||
expect(plugins[1].run({}, {})).toEqual(5); | ||
expect(plugins[1].config).toEqual('config-5'); | ||
}); | ||
it('loads per-package "post" plugins correctly', () => { | ||
const pkg = new PkgDesc('package', '1.0.0', __dirname); | ||
const plugins = project.transform.getPostPluginDescriptors(pkg); | ||
expect(plugins[0].run({}, {})).toEqual(6); | ||
expect(plugins[0].config).toEqual({}); | ||
expect(plugins[1].run({}, {})).toEqual(7); | ||
expect(plugins[1].config).toEqual('config-7'); | ||
}); | ||
it('loads default babel config correctly', () => { | ||
const pkg = new PkgDesc('package-star', '1.0.0', __dirname); | ||
const config = project.transform.getBabelConfig(pkg); | ||
expect(config).toEqual({config: 'config-*'}); | ||
}); | ||
it('loads per-package-by-id babel config correctly', () => { | ||
const pkg = new PkgDesc('package', '1.0.0', __dirname); | ||
const config = project.transform.getBabelConfig(pkg); | ||
expect(config).toEqual({config: 'config-package@1.0.0'}); | ||
}); | ||
it('loads per-package-by-name babel config correctly', () => { | ||
const pkg = new PkgDesc('package2', '1.0.0', __dirname); | ||
const config = project.transform.getBabelConfig(pkg); | ||
expect(config).toEqual({config: 'config-package2'}); | ||
}); | ||
it('loads babel plugins correctly', () => { | ||
const pkg = new PkgDesc('package3', '1.0.0', __dirname); | ||
const pluginMocks = { | ||
raw: () => false, | ||
configured: () => false, | ||
}; | ||
jest.spyOn(project, 'toolResolve').mockImplementation( | ||
moduleName => moduleName | ||
); | ||
jest.spyOn(project, 'toolRequire').mockImplementation( | ||
moduleName => pluginMocks[moduleName] | ||
); | ||
try { | ||
const plugins = project.transform.getBabelPlugins(pkg); | ||
expect(plugins).toEqual([ | ||
pluginMocks['raw'], | ||
[pluginMocks['configured'], {the: 'config'}], | ||
]); | ||
} finally { | ||
jest.restoreAllMocks(); | ||
} | ||
}); | ||
}); | ||
describe('project.versionsInfo', () => { | ||
@@ -490,89 +360,58 @@ it('works', () => { | ||
expect(versions.size).toEqual(12); | ||
expect(versions.get('liferay-npm-bundler')).toMatchObject({ | ||
version: require('../../../package.json').version, | ||
path: path.join( | ||
'..', | ||
'..', | ||
'..', | ||
'..', | ||
'..', | ||
'..', | ||
'..', | ||
'..', | ||
'node_modules', | ||
'liferay-npm-bundler' | ||
), | ||
}); | ||
expect(versions.get('liferay-npm-build-tools-common')).toMatchObject({ | ||
version: require('../../../package.json').version, | ||
path: path.join('..', '..', '..', '..', '..', '..'), | ||
}); | ||
expect(versions.get('loader-0')).toMatchObject({ | ||
version: '1.0.0', | ||
path: path.join('node_modules', 'loader-0'), | ||
}); | ||
expect(versions.get('liferay-npm-bundler-plugin-test-0')).toMatchObject( | ||
{ | ||
version: '1.0.0', | ||
path: path.join( | ||
'node_modules', | ||
'liferay-npm-bundler-plugin-test-0' | ||
), | ||
} | ||
expect(versions).toEqual( | ||
new Map([ | ||
[ | ||
'bundler-plugins/dir/loader-0', | ||
{ | ||
version: '1.0.0', | ||
path: path.join( | ||
'node_modules', | ||
'bundler-plugins/dir/loader-0.js' | ||
), | ||
}, | ||
], | ||
[ | ||
'bundler-plugins/dir/loader-1', | ||
{ | ||
version: '1.0.0', | ||
path: path.join( | ||
'node_modules', | ||
'bundler-plugins/dir/loader-1.js' | ||
), | ||
}, | ||
], | ||
[ | ||
'liferay-npm-build-tools-common', | ||
{ | ||
version: require('../../../package.json').version, | ||
path: path.join('..', '..', '..', '..', '..', '..'), | ||
}, | ||
], | ||
[ | ||
'liferay-npm-bundler', | ||
{ | ||
version: require('../../../package.json').version, | ||
path: path.join( | ||
'..', | ||
'..', | ||
'..', | ||
'..', | ||
'..', | ||
'..', | ||
'..', | ||
'..', | ||
'node_modules', | ||
'liferay-npm-bundler' | ||
), | ||
}, | ||
], | ||
[ | ||
'loader-0', | ||
{ | ||
version: '1.0.0', | ||
path: path.join('node_modules', 'loader-0'), | ||
}, | ||
], | ||
]) | ||
); | ||
expect(versions.get('bundler-plugins/dir/plugin-0')).toMatchObject({ | ||
version: '1.0.0', | ||
path: path.join('node_modules', 'bundler-plugins/dir/plugin-0.js'), | ||
}); | ||
expect(versions.get('liferay-npm-bundler-plugin-test-1')).toMatchObject( | ||
{ | ||
version: '1.0.0', | ||
path: path.join( | ||
'node_modules', | ||
'liferay-npm-bundler-plugin-test-1' | ||
), | ||
} | ||
); | ||
expect(versions.get('bundler-plugins/dir/plugin-1')).toMatchObject({ | ||
version: '1.0.0', | ||
path: path.join('node_modules', 'bundler-plugins/dir/plugin-1.js'), | ||
}); | ||
expect(versions.get('babel-plugin-test-0')).toMatchObject({ | ||
version: '1.0.0', | ||
path: path.join('node_modules', 'babel-plugin-test-0'), | ||
}); | ||
expect(versions.get('babel-plugins/dir/plugin-0')).toMatchObject({ | ||
version: '1.0.0', | ||
path: path.join('node_modules', 'babel-plugins/dir/plugin-0.js'), | ||
}); | ||
expect(versions.get('babel-plugins/dir/plugin-1')).toMatchObject({ | ||
version: '1.0.0', | ||
path: path.join('node_modules', 'babel-plugins/dir/plugin-1.js'), | ||
}); | ||
expect(versions.get('loader-0')).toMatchObject({ | ||
version: '1.0.0', | ||
path: path.join('node_modules', 'loader-0'), | ||
}); | ||
expect(versions.get('bundler-plugins/dir/loader-0')).toMatchObject({ | ||
version: '1.0.0', | ||
path: path.join('node_modules', 'bundler-plugins/dir/loader-0.js'), | ||
}); | ||
expect(versions.get('bundler-plugins/dir/loader-1')).toMatchObject({ | ||
version: '1.0.0', | ||
path: path.join('node_modules', 'bundler-plugins/dir/loader-1.js'), | ||
}); | ||
}); | ||
@@ -602,60 +441,2 @@ }); | ||
describe('deprecated config', () => { | ||
describe('.npmbundlerrc', () => { | ||
it('create-jar/auto-deploy-portlet', () => { | ||
const project = new Project( | ||
path.join( | ||
__dirname, | ||
'__fixtures__', | ||
'legacy', | ||
'auto-deploy-portlet' | ||
) | ||
); | ||
expect(project.jar.requireJsExtender).toBe(false); | ||
}); | ||
it('create-jar/web-context-path', () => { | ||
const project = new Project( | ||
path.join(__dirname, '__fixtures__', 'legacy', 'context-path-1') | ||
); | ||
expect(project.jar.webContextPath).toBe('/my-portlet'); | ||
}); | ||
it('supports legacy package configurations correctly', () => { | ||
const project = new Project( | ||
path.join(__dirname, '__fixtures__', 'legacy', 'packages-cfg') | ||
); | ||
const pkg1 = new PkgDesc('package', '1.0.0', __dirname); | ||
const pkg2 = new PkgDesc('package2', '1.0.0', __dirname); | ||
const pkg3 = new PkgDesc('package3', '1.0.0', __dirname); | ||
const pkgOther = new PkgDesc('other-package', '1.0.0', __dirname); | ||
let plugins = project.transform.getPrePluginDescriptors(pkg1); | ||
expect(plugins[0].run({}, {})).toEqual(1); | ||
plugins = project.transform.getPrePluginDescriptors(pkg2); | ||
expect(plugins[0].run({}, {})).toEqual(2); | ||
plugins = project.transform.getPrePluginDescriptors(pkg3); | ||
expect(plugins[0].run({}, {})).toEqual(4); | ||
plugins = project.transform.getPrePluginDescriptors(pkgOther); | ||
expect(plugins[0].run({}, {})).toEqual(0); | ||
}); | ||
}); | ||
describe('package.json', () => { | ||
it('osgi/web-context-path', () => { | ||
const project = new Project( | ||
path.join(__dirname, '__fixtures__', 'legacy', 'context-path-2') | ||
); | ||
expect(project.jar.webContextPath).toBe('/my-portlet'); | ||
}); | ||
}); | ||
}); | ||
describe('empty project defaults', () => { | ||
@@ -670,8 +451,2 @@ let project; | ||
it('loads liferay-npm-bundler-preset-standard preset', () => { | ||
expect(project._npmbundlerrc['*']['.babelrc']['presets']).toEqual([ | ||
'liferay-standard', | ||
]); | ||
}); | ||
it('returns dir', () => { | ||
@@ -684,5 +459,3 @@ expect(project.dir.toString()).toBe( | ||
it('returns buildDir', () => { | ||
expect(project.buildDir.asPosix).toBe( | ||
'./build/resources/main/META-INF/resources' | ||
); | ||
expect(project.buildDir.asPosix).toBe('./build'); | ||
}); | ||
@@ -700,11 +473,11 @@ | ||
it('returns outputDir', () => { | ||
expect(project.jar.outputDir).toBeUndefined(); | ||
expect(project.jar.outputDir.asPosix).toBe('./build'); | ||
}); | ||
it('returns outputFilename', () => { | ||
expect(project.jar.outputFilename).toBeUndefined(); | ||
expect(project.jar.outputFilename).toBe('empty-1.0.0.jar'); | ||
}); | ||
it('returns supported', () => { | ||
expect(project.jar.supported).toBe(false); | ||
expect(project.jar.supported).toBe(true); | ||
}); | ||
@@ -744,3 +517,3 @@ | ||
describe('honors presets', () => { | ||
describe('loads things as modules (as opposed to packages)', () => { | ||
let project; | ||
@@ -750,30 +523,2 @@ | ||
project = new Project( | ||
path.join(__dirname, '__fixtures__', 'project', 'with-preset') | ||
); | ||
}); | ||
it('loads project.dir from preset', () => { | ||
expect(project.dir.asNative).toBe( | ||
path.join(__dirname, '__fixtures__', 'project', 'with-preset') | ||
); | ||
}); | ||
it('loads project.buildDir from preset', () => { | ||
expect(project.buildDir.asPosix).toBe('./preset-build'); | ||
}); | ||
it('loads project.jar.outputDir from preset', () => { | ||
expect(project.jar.outputDir.asPosix).toBe('./preset-dist'); | ||
}); | ||
it('detects JAR configuration even if only in preset', () => { | ||
expect(project.jar.supported).toBe(true); | ||
}); | ||
}); | ||
describe('loads plugins as modules (as opposed to packages)', () => { | ||
let project; | ||
beforeAll(() => { | ||
project = new Project( | ||
path.join(__dirname, '__fixtures__', 'project', 'with-module-cfg') | ||
@@ -783,6 +528,2 @@ ); | ||
it('loads preset from file in package', () => { | ||
expect(project.buildDir.asPosix).toBe('./preset-output'); | ||
}); | ||
it('loads loaders from module in package', () => { | ||
@@ -802,84 +543,2 @@ const loaders = project.rules.loadersForFile('src/index.js'); | ||
}); | ||
it('loads copy plugins from module in package', () => { | ||
const pkg = new PkgDesc( | ||
'a-package', | ||
'1.0.0', | ||
project.dir.join('node_modules', 'a-package').asNative | ||
); | ||
const pluginDescriptors = project.copy.getPluginDescriptors(pkg); | ||
expect(pluginDescriptors).toHaveLength(1); | ||
const pluginDescriptor = pluginDescriptors[0]; | ||
expect(pluginDescriptor).toMatchObject({ | ||
name: 'a-config/my-copy-plugin', | ||
config: {}, | ||
}); | ||
expect(pluginDescriptor.run()).toBe('Hi from plugin!'); | ||
}); | ||
it('loads pre plugins from module in package', () => { | ||
const pkg = new PkgDesc( | ||
'a-package', | ||
'1.0.0', | ||
project.dir.join('node_modules', 'a-package').asNative | ||
); | ||
const pluginDescriptors = project.transform.getPrePluginDescriptors( | ||
pkg | ||
); | ||
expect(pluginDescriptors).toHaveLength(1); | ||
const pluginDescriptor = pluginDescriptors[0]; | ||
expect(pluginDescriptor).toMatchObject({ | ||
name: 'a-config/my-pre-plugin', | ||
config: {}, | ||
}); | ||
expect(pluginDescriptor.run()).toBe('Hi from pre plugin!'); | ||
}); | ||
it('loads post plugins from module in package', () => { | ||
const pkg = new PkgDesc( | ||
'a-package', | ||
'1.0.0', | ||
project.dir.join('node_modules', 'a-package').asNative | ||
); | ||
const pluginDescriptors = project.transform.getPostPluginDescriptors( | ||
pkg | ||
); | ||
expect(pluginDescriptors).toHaveLength(1); | ||
const pluginDescriptor = pluginDescriptors[0]; | ||
expect(pluginDescriptor).toMatchObject({ | ||
name: 'a-config/my-post-plugin', | ||
config: {}, | ||
}); | ||
expect(pluginDescriptor.run()).toBe('Hi from post plugin!'); | ||
}); | ||
it('loads babel plugins from module in package', () => { | ||
const pkg = new PkgDesc( | ||
'a-package', | ||
'1.0.0', | ||
project.dir.join('node_modules', 'a-package').asNative | ||
); | ||
const babelPlugins = project.transform.getBabelPlugins(pkg); | ||
expect(babelPlugins).toHaveLength(2); | ||
expect(babelPlugins[0]()).toBe("Hi from preset's babel plugin!"); | ||
expect(babelPlugins[1]()).toBe('Hi from babel plugin!'); | ||
}); | ||
}); | ||
@@ -886,0 +545,0 @@ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
import child_process from 'child_process'; | ||
import childProcess from 'child_process'; | ||
import prop from 'dot-prop'; | ||
import fs from 'fs'; | ||
import merge from 'merge'; | ||
import path from 'path'; | ||
import readJsonSync from 'read-json-sync'; | ||
import resolveModule from 'resolve'; | ||
import webpack from 'webpack'; | ||
import FilePath from '../file-path'; | ||
import {info, print, warn} from '../format'; | ||
import {splitModuleName} from '../modules'; | ||
import Copy from './copy'; | ||
import Jar from './jar'; | ||
@@ -23,3 +22,2 @@ import Localization from './localization'; | ||
import Rules from './rules'; | ||
import Transform from './transform'; | ||
import {VersionInfo} from './types'; | ||
@@ -30,2 +28,37 @@ | ||
/** Exports configuration */ | ||
export interface Exports { | ||
[id: string]: string; | ||
} | ||
/** Imports configuration */ | ||
export interface Imports { | ||
[pkgName: string]: ImportsConfig; | ||
} | ||
export interface ImportsConfig { | ||
provider: string; | ||
version: string; | ||
} | ||
/** Minimal package.json structure description */ | ||
export interface PkgJson { | ||
name: string; | ||
version: string; | ||
description?: string; | ||
main?: string; | ||
portlet?: { | ||
[property: string]: string | boolean; | ||
}; | ||
dependencies?: { | ||
[pkgName: string]: string; | ||
}; | ||
devDependencies?: { | ||
[pkgName: string]: string; | ||
}; | ||
peerDependencies?: { | ||
[pkgName: string]: string; | ||
}; | ||
} | ||
/** | ||
@@ -35,3 +68,2 @@ * Describes a standard JS Toolkit project. | ||
export class Project { | ||
copy: Copy; | ||
jar: Jar; | ||
@@ -42,3 +74,2 @@ l10n: Localization; | ||
rules: Rules; | ||
transform: Transform; | ||
@@ -53,2 +84,83 @@ /** | ||
/** | ||
* Get module paths to export to the outside world making them available | ||
* through the AMD loader. | ||
* | ||
* @remarks | ||
* Note that the usual CommonJS syntax is used to differentiate local | ||
* modules from dependency (node_modules) modules. | ||
* | ||
* For example: | ||
* | ||
* - Local module: './src/my-api' | ||
* - Dependency module: 'lodash/trimEnd' | ||
*/ | ||
get exports(): Exports { | ||
if (this._exports === undefined) { | ||
this._exports = prop.get(this._configuration, 'exports', {}); | ||
// Export package.json's main entry (if present) automatically | ||
if (!this._exports['main']) { | ||
let main = this._pkgJson.main; | ||
if (main) { | ||
if (main.startsWith('/')) { | ||
main = `.${main}`; | ||
} else if (!main.startsWith('.')) { | ||
main = `./${main}`; | ||
} | ||
this._exports['main'] = main; | ||
} else if (fs.existsSync('./index.js')) { | ||
this._exports['main'] = './index.js'; | ||
} | ||
} | ||
} | ||
return this._exports; | ||
} | ||
get imports(): Imports { | ||
if (this._imports === undefined) { | ||
this._imports = {}; | ||
const imports = prop.get(this._configuration, 'imports', {}); | ||
Object.entries(imports).forEach( | ||
([provider, config]: [string, string]) => { | ||
Object.entries(config).forEach( | ||
([pkgName, version]: [string, string]) => { | ||
if (pkgName === '/') { | ||
pkgName = provider; | ||
} | ||
this._imports[pkgName] = { | ||
provider, | ||
version, | ||
}; | ||
} | ||
); | ||
}, | ||
{} as Imports | ||
); | ||
} | ||
return this._imports; | ||
} | ||
/** | ||
* Get user's webpack configuration. | ||
*/ | ||
get webpackConfiguration(): webpack.Configuration { | ||
if (this._webpackConfiguration === undefined) { | ||
this._webpackConfiguration = prop.get( | ||
this._configuration, | ||
'webpack', | ||
{} | ||
); | ||
} | ||
return this._webpackConfiguration; | ||
} | ||
/** | ||
* Get directories inside the project containing source files starting with | ||
@@ -60,3 +172,3 @@ * `./` (so that they can be safely path.joined) | ||
this._sources = prop | ||
.get(this._npmbundlerrc, 'sources', []) | ||
.get(this._configuration, 'sources', []) | ||
.map(source => | ||
@@ -77,9 +189,3 @@ source.startsWith('./') ? source : `./${source}` | ||
if (this._buildDir === undefined) { | ||
let dir = prop.get( | ||
this._npmbundlerrc, | ||
'output', | ||
this.jar.supported | ||
? './build' | ||
: './build/resources/main/META-INF/resources' | ||
); | ||
let dir = prop.get(this._configuration, 'output', './build'); | ||
@@ -107,7 +213,8 @@ if (!dir.startsWith('./')) { | ||
get globalConfig(): object { | ||
const {_npmbundlerrc} = this; | ||
const {_configuration} = this; | ||
return prop.get(_npmbundlerrc, 'config', {}); | ||
return prop.get(_configuration, 'config', {}); | ||
} | ||
// TODO: rename to `configuration` | ||
/** | ||
@@ -117,3 +224,3 @@ * Get project's parsed .npmbundlerrc file | ||
get npmbundlerrc(): object { | ||
return this._npmbundlerrc; | ||
return this._configuration; | ||
} | ||
@@ -124,3 +231,3 @@ | ||
*/ | ||
get pkgJson(): object { | ||
get pkgJson(): PkgJson { | ||
return this._pkgJson; | ||
@@ -154,7 +261,7 @@ } | ||
let yarnPresent = | ||
child_process.spawnSync('yarn', ['--version'], { | ||
childProcess.spawnSync('yarn', ['--version'], { | ||
shell: true, | ||
}).error === undefined; | ||
let npmPresent = | ||
child_process.spawnSync('npm', ['--version'], { | ||
childProcess.spawnSync('npm', ['--version'], { | ||
shell: true, | ||
@@ -193,6 +300,7 @@ }).error === undefined; | ||
const putInMap = packageName => { | ||
const putInMap = (packageName): void => { | ||
const pkgJsonPath = this.toolResolve( | ||
`${packageName}/package.json` | ||
); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const pkgJson = require(pkgJsonPath); | ||
@@ -214,4 +322,4 @@ | ||
// Get preset version | ||
const {_npmbundlerrc} = this; | ||
const preset = _npmbundlerrc['preset']; | ||
const {_configuration} = this; | ||
const preset = _configuration['preset']; | ||
@@ -222,3 +330,2 @@ if (preset) { | ||
map = new Map([...map, ...this.transform.versionsInfo]); | ||
map = new Map([...map, ...this.rules.versionsInfo]); | ||
@@ -243,3 +350,3 @@ | ||
projectPath: string, | ||
configFilePath: string = '.npmbundlerrc' | ||
configFilePath = 'liferay-npm-bundler.config.js' | ||
): void { | ||
@@ -249,3 +356,3 @@ // First reset everything | ||
this._configFile = undefined; | ||
this._npmbundlerrc = undefined; | ||
this._configuration = undefined; | ||
this._pkgJson = undefined; | ||
@@ -268,6 +375,5 @@ this._pkgManager = undefined; | ||
this._loadPkgJson(); | ||
this._loadNpmbundlerrc(); | ||
this._loadConfiguration(); | ||
// Initialize subdomains | ||
this.copy = new Copy(this); | ||
this.jar = new Jar(this); | ||
@@ -278,3 +384,2 @@ this.l10n = new Localization(this); | ||
this.rules = new Rules(this); | ||
this.transform = new Transform(this); | ||
} | ||
@@ -288,3 +393,3 @@ | ||
*/ | ||
require(moduleName: string): any { | ||
require(moduleName: string): unknown { | ||
return require(this.resolve(moduleName)); | ||
@@ -299,3 +404,3 @@ } | ||
*/ | ||
resolve(moduleName: string): any { | ||
resolve(moduleName: string): string { | ||
return resolveModule.sync(moduleName, { | ||
@@ -315,3 +420,3 @@ basedir: this.dir.asNative, | ||
}) { | ||
const {_npmbundlerrc} = this; | ||
const {_configuration} = this; | ||
@@ -323,7 +428,7 @@ if (argv.config) { | ||
if (argv['create-jar']) { | ||
_npmbundlerrc['create-jar'] = true; | ||
_configuration['create-jar'] = true; | ||
} | ||
if (argv['dump-report']) { | ||
_npmbundlerrc['dump-report'] = true; | ||
_configuration['dump-report'] = true; | ||
} | ||
@@ -344,6 +449,7 @@ } | ||
*/ | ||
toolRequire(moduleName: string): any { | ||
toolRequire(moduleName: string): unknown { | ||
return require(this.toolResolve(moduleName)); | ||
} | ||
// TODO: this is not needed any more as presets have been removed | ||
/** | ||
@@ -361,3 +467,3 @@ * Resolves a tool module in the context of the project (as opposed to the | ||
*/ | ||
toolResolve(moduleName: string): any { | ||
toolResolve(moduleName: string): string { | ||
try { | ||
@@ -372,53 +478,18 @@ return resolveModule.sync(moduleName, { | ||
_loadNpmbundlerrc(): void { | ||
const npmbundlerrcPath = this._configFile.asNative; | ||
_loadConfiguration(): void { | ||
const {_configFile} = this; | ||
const configDir = _configFile.dirname(); | ||
const config = fs.existsSync(npmbundlerrcPath) | ||
? readJsonSync(npmbundlerrcPath) | ||
: {}; | ||
// Apply preset if necessary | ||
let presetFilePath; | ||
if (config.preset === undefined) { | ||
presetFilePath = require.resolve( | ||
'liferay-npm-bundler-preset-standard' | ||
if (fs.existsSync(configDir.join('.npmbundlerrc').asNative)) { | ||
print( | ||
warn`There is a {.npmbundlerrc} file in {${configDir.basename()}}: it will be ignored`, | ||
info`Consider migrating the project to bundler 3.x or removing it if is a leftover` | ||
); | ||
this._toolsDir = new FilePath( | ||
path.dirname( | ||
require.resolve( | ||
'liferay-npm-bundler-preset-standard/package.json' | ||
) | ||
) | ||
); | ||
} else if (config.preset === '' || config.preset === false) { | ||
// don't load preset | ||
} else { | ||
presetFilePath = resolveModule.sync(config.preset, { | ||
basedir: this.dir.asNative, | ||
}); | ||
const {pkgName} = splitModuleName(config.preset); | ||
const presetPkgJsonFilePath = resolveModule.sync( | ||
`${pkgName}/package.json`, | ||
{ | ||
basedir: this.dir.asNative, | ||
} | ||
); | ||
this._toolsDir = new FilePath(path.dirname(presetPkgJsonFilePath)); | ||
} | ||
if (presetFilePath) { | ||
const originalConfig = Object.assign({}, config); | ||
const configFilePath = _configFile.asNative; | ||
Object.assign( | ||
config, | ||
merge.recursive(readJsonSync(presetFilePath), originalConfig) | ||
); | ||
} | ||
this._npmbundlerrc = config; | ||
this._configuration = fs.existsSync(configFilePath) | ||
? require(configFilePath) | ||
: {}; | ||
} | ||
@@ -440,4 +511,4 @@ | ||
private _npmbundlerrc: object; | ||
private _pkgJson: object; | ||
private _configuration: object; | ||
private _pkgJson: PkgJson; | ||
private _pkgManager: PkgManager; | ||
@@ -454,2 +525,11 @@ | ||
/** Modules to export to the outside world */ | ||
private _exports: Exports; | ||
/** Modules to import from the outside world */ | ||
private _imports: Imports; | ||
/** User's webpack configuration */ | ||
private _webpackConfiguration: webpack.Configuration; | ||
private _versionsInfo: Map<string, VersionInfo>; | ||
@@ -456,0 +536,0 @@ } |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
import {Project} from '.'; | ||
import prop from 'dot-prop'; | ||
import fs from 'fs'; | ||
import fs from 'fs-extra'; | ||
import readJsonSync from 'read-json-sync'; | ||
import FilePath from '../file-path'; | ||
import {Project} from '.'; | ||
import {print, warn} from '../format'; | ||
import {getFeaturesFilePath} from './util'; | ||
@@ -28,2 +28,6 @@ | ||
get configurationFile(): FilePath | undefined { | ||
if (!this.supported) { | ||
return undefined; | ||
} | ||
const {_project} = this; | ||
@@ -47,3 +51,7 @@ | ||
*/ | ||
get customManifestHeaders(): object { | ||
get customManifestHeaders(): object | undefined { | ||
if (!this.supported) { | ||
return undefined; | ||
} | ||
const {npmbundlerrc} = this._project; | ||
@@ -81,3 +89,7 @@ | ||
*/ | ||
get outputDir(): FilePath { | ||
get outputDir(): FilePath | undefined { | ||
if (!this.supported) { | ||
return undefined; | ||
} | ||
const {_project} = this; | ||
@@ -90,3 +102,3 @@ const {npmbundlerrc} = _project; | ||
'create-jar.output-dir', | ||
this.supported ? _project.buildDir.asPosix : undefined | ||
_project.buildDir.asPosix | ||
); | ||
@@ -111,3 +123,7 @@ | ||
*/ | ||
get outputFilename(): string { | ||
get outputFilename(): string | undefined { | ||
if (!this.supported) { | ||
return undefined; | ||
} | ||
const {npmbundlerrc, pkgJson} = this._project; | ||
@@ -119,5 +135,3 @@ | ||
'create-jar.output-filename', | ||
this.supported | ||
? pkgJson['name'] + '-' + pkgJson['version'] + '.jar' | ||
: undefined | ||
pkgJson.name + '-' + pkgJson.version + '.jar' | ||
); | ||
@@ -132,13 +146,18 @@ } | ||
* extender process this bundle. | ||
* @return can be a boolean, a string forcing an extender version number or | ||
* 'any' to leave version unbounded | ||
* | ||
* @return | ||
* can be a boolean, a string forcing an extender version number or 'any' to | ||
* leave version unbounded | ||
*/ | ||
get requireJsExtender(): boolean | string | 'any' { | ||
const {npmbundlerrc} = this._project; | ||
get requireJsExtender(): boolean | string | 'any' | undefined { | ||
if (!this.supported) { | ||
return undefined; | ||
} | ||
const {npmbundlerrc, pkgJson} = this._project; | ||
return prop.get( | ||
npmbundlerrc, | ||
'create-jar.features.js-extender', | ||
// TODO: deprecated 'auto-deploy-portlet', remove for the next major version | ||
prop.get(npmbundlerrc, 'create-jar.auto-deploy-portlet', true) | ||
!!pkgJson.portlet | ||
); | ||
@@ -150,24 +169,32 @@ } | ||
return !!prop.get(npmbundlerrc, 'create-jar', false); | ||
return !!prop.get(npmbundlerrc, 'create-jar', true); | ||
} | ||
get webContextPath(): string { | ||
const {npmbundlerrc, pkgJson} = this._project; | ||
get webContextPath(): string | undefined { | ||
if (!this.supported) { | ||
return undefined; | ||
} | ||
if (!this._webContextPath) { | ||
this._webContextPath = prop.get( | ||
npmbundlerrc, | ||
'create-jar.features.web-context', | ||
// TODO: deprecated 'web-context-path', remove for the next major version | ||
prop.get( | ||
npmbundlerrc, | ||
'create-jar.web-context-path', | ||
// TODO: deprecated 'osgi.Web-ContextPath', remove for the next major version | ||
prop.get( | ||
pkgJson, | ||
'osgi.Web-ContextPath', | ||
`/${pkgJson['name']}-${pkgJson['version']}` | ||
) | ||
) | ||
); | ||
const {pkgJson} = this._project; | ||
const bndWebContextPath = this._getBndWebContextPath(); | ||
const npmbundlerrcContextPath = this._getNpmbundlerrcContextPath(); | ||
if (bndWebContextPath && npmbundlerrcContextPath) { | ||
print( | ||
warn` | ||
Configured web context paths in .npmbundlerrc and bnd.bnd are different: using | ||
the one in .npmbundlerrc | ||
` | ||
); | ||
this._webContextPath = npmbundlerrcContextPath; | ||
} else if (bndWebContextPath) { | ||
this._webContextPath = bndWebContextPath; | ||
} else if (npmbundlerrcContextPath) { | ||
this._webContextPath = npmbundlerrcContextPath; | ||
} else { | ||
this._webContextPath = `/${pkgJson.name}-${pkgJson.version}`; | ||
} | ||
} | ||
@@ -178,2 +205,33 @@ | ||
_getBndWebContextPath(): string { | ||
const {dir} = this._project; | ||
const bndFile = dir.join('bnd.bnd'); | ||
if (fs.existsSync(bndFile.asNative)) { | ||
const bnd = fs.readFileSync(bndFile.asNative).toString(); | ||
const lines = bnd.split('\n'); | ||
const webContextPathLine = lines.find(line => | ||
line.startsWith('Web-ContextPath:') | ||
); | ||
if (webContextPathLine !== undefined) { | ||
return webContextPathLine.substring(16).trim(); | ||
} | ||
} | ||
return undefined; | ||
} | ||
_getNpmbundlerrcContextPath(): string { | ||
const {npmbundlerrc} = this._project; | ||
return prop.get( | ||
npmbundlerrc, | ||
'create-jar.features.web-context', | ||
undefined | ||
); | ||
} | ||
private _customManifestHeaders: object; | ||
@@ -180,0 +238,0 @@ private _outputDir: FilePath; |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
import {Project} from '.'; | ||
import fs from 'fs'; | ||
@@ -12,3 +12,2 @@ import path from 'path'; | ||
import FilePath from '../file-path'; | ||
import {Project} from '.'; | ||
import {getFeaturesFilePath} from './util'; | ||
@@ -15,0 +14,0 @@ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
import {Project} from '.'; | ||
import prop from 'dot-prop'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import {Project} from '.'; | ||
import FilePath from '../file-path'; | ||
@@ -27,5 +24,15 @@ | ||
/** | ||
* Whether or not to dump detailed information about what the tool is doing | ||
*/ | ||
get logLevel(): 'off' | 'error' | 'warn' | 'info' | 'debug' { | ||
const {npmbundlerrc} = this._project; | ||
return prop.get(npmbundlerrc, 'log-level', 'warn'); | ||
} | ||
/** | ||
* Get maximum number of files to process in parallel in any parallelizable | ||
* operation. | ||
*/ | ||
get maxParallelFiles(): number { | ||
@@ -49,42 +56,5 @@ const {npmbundlerrc} = this._project; | ||
/** | ||
* Whether or not to track usage | ||
* Get the path to the report file or undefined if no report is configured. | ||
*/ | ||
get noTracking(): boolean { | ||
const {_project} = this; | ||
const {npmbundlerrc} = _project; | ||
if (!prop.has(npmbundlerrc, 'no-tracking')) { | ||
if (prop.has(process, 'env.LIFERAY_NPM_BUNDLER_NO_TRACKING')) { | ||
prop.set(npmbundlerrc, 'no-tracking', true); | ||
} | ||
} | ||
if (!prop.has(npmbundlerrc, 'no-tracking')) { | ||
let dir = _project.dir.asNative; | ||
while ( | ||
!fs.existsSync( | ||
path.join(dir, '.liferay-npm-bundler-no-tracking') | ||
) && | ||
path.resolve(dir, '..') !== dir | ||
) { | ||
dir = path.resolve(dir, '..'); | ||
} | ||
if ( | ||
fs.existsSync( | ||
path.join(dir, '.liferay-npm-bundler-no-tracking') | ||
) | ||
) { | ||
prop.set(npmbundlerrc, 'no-tracking', true); | ||
} | ||
} | ||
// Disable tracking by default | ||
return prop.get(npmbundlerrc, 'no-tracking', true); | ||
} | ||
/** | ||
* Get the path to the report file or undefined if no report is configured. | ||
*/ | ||
get reportFile(): FilePath | undefined { | ||
@@ -101,12 +71,3 @@ const {_project} = this; | ||
/** | ||
* Whether or not to dump detailed information about what the tool is doing | ||
*/ | ||
get verbose(): boolean { | ||
const {npmbundlerrc} = this._project; | ||
return prop.get(npmbundlerrc, 'verbose', false); | ||
} | ||
private readonly _project: Project; | ||
} |
@@ -1,9 +0,8 @@ | ||
import {Project} from '.'; | ||
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
import {Project} from '.'; | ||
export enum ProjectType { | ||
@@ -43,8 +42,10 @@ CREATE_REACT_APP = 'create-react-app', | ||
_hasDependency(pkgName) { | ||
_hasDependency(pkgName): boolean { | ||
const {pkgJson} = this._project; | ||
return ( | ||
(pkgJson['dependencies'] && pkgJson['dependencies'][pkgName]) || | ||
(pkgJson['devDependencies'] && pkgJson['devDependencies'][pkgName]) | ||
(pkgJson.dependencies && | ||
pkgJson.dependencies[pkgName] !== undefined) || | ||
(pkgJson.devDependencies && | ||
pkgJson.devDependencies[pkgName] !== undefined) | ||
); | ||
@@ -51,0 +52,0 @@ } |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
import {Project} from '.'; | ||
import clone from 'clone'; | ||
@@ -13,3 +13,2 @@ import path from 'path'; | ||
import {splitModuleName} from '../modules'; | ||
import {Project} from '.'; | ||
import {VersionInfo} from './types'; | ||
@@ -23,3 +22,3 @@ | ||
resolvedModule: string; | ||
exec: BundlerLoaderEntryPoint; | ||
exec: BundlerLoaderEntryPoint<string | Buffer>; | ||
options: object; | ||
@@ -106,3 +105,3 @@ metadata: BundlerLoaderMetadata; | ||
(map: Map<string, VersionInfo>, resolvedModule) => { | ||
const {pkgName, modulePath} = splitModuleName( | ||
const {modulePath, pkgName} = splitModuleName( | ||
resolvedModule | ||
@@ -113,2 +112,3 @@ ); | ||
); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const pkgJson = require(pkgJsonPath); | ||
@@ -193,17 +193,21 @@ | ||
rule['use'] = rule['use'].map((use: any) => { | ||
if (typeof use === 'string') { | ||
use = { | ||
loader: use, | ||
}; | ||
} | ||
rule['use'] = rule['use'].map( | ||
( | ||
use: string | BundlerLoaderDescriptor | ||
): BundlerLoaderDescriptor => { | ||
if (typeof use === 'string') { | ||
use = { | ||
loader: use, | ||
} as BundlerLoaderDescriptor; | ||
} | ||
if (use.options === undefined) { | ||
use.options = {}; | ||
} | ||
if (use.options === undefined) { | ||
use.options = {}; | ||
} | ||
use = this._instantiateLoader(use); | ||
use = this._instantiateLoader(use); | ||
return use; | ||
}); | ||
return use; | ||
} | ||
); | ||
}); | ||
@@ -215,3 +219,3 @@ } | ||
fieldName: string, | ||
defaultValue: any | ||
defaultValue: unknown | ||
): void { | ||
@@ -218,0 +222,0 @@ if (rule[fieldName] === undefined) { |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
@@ -5,0 +4,0 @@ */ |
/** | ||
* © 2017 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
import {Project} from '.'; | ||
import prop from 'dot-prop'; | ||
@@ -13,3 +13,2 @@ import fs from 'fs'; | ||
import PkgDesc from '../pkg-desc'; | ||
import {Project} from '.'; | ||
import {BundlerPluginDescriptor} from './types'; | ||
@@ -29,3 +28,3 @@ | ||
): string | undefined { | ||
const {npmbundlerrc, dir: projectDir} = project; | ||
const {dir: projectDir, npmbundlerrc} = project; | ||
@@ -138,4 +137,4 @@ const prjRelPosixPath: string = prop.get(npmbundlerrc, featuresKeyPath); | ||
if (pluginModule.default !== undefined) { | ||
pluginModule = pluginModule.default; | ||
if (pluginModule['default'] !== undefined) { | ||
pluginModule = pluginModule['default']; | ||
} | ||
@@ -142,0 +141,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
2
271199
143
8680
2
15
+ Addedclone@^2.1.2
+ Addedfs-extra@^8.1.0
+ Addedwebpack@^4.41.6
+ Added@webassemblyjs/ast@1.9.0(transitive)
+ Added@webassemblyjs/floating-point-hex-parser@1.9.0(transitive)
+ Added@webassemblyjs/helper-api-error@1.9.0(transitive)
+ Added@webassemblyjs/helper-buffer@1.9.0(transitive)
+ Added@webassemblyjs/helper-code-frame@1.9.0(transitive)
+ Added@webassemblyjs/helper-fsm@1.9.0(transitive)
+ Added@webassemblyjs/helper-module-context@1.9.0(transitive)
+ Added@webassemblyjs/helper-wasm-bytecode@1.9.0(transitive)
+ Added@webassemblyjs/helper-wasm-section@1.9.0(transitive)
+ Added@webassemblyjs/ieee754@1.9.0(transitive)
+ Added@webassemblyjs/leb128@1.9.0(transitive)
+ Added@webassemblyjs/utf8@1.9.0(transitive)
+ Added@webassemblyjs/wasm-edit@1.9.0(transitive)
+ Added@webassemblyjs/wasm-gen@1.9.0(transitive)
+ Added@webassemblyjs/wasm-opt@1.9.0(transitive)
+ Added@webassemblyjs/wasm-parser@1.9.0(transitive)
+ Added@webassemblyjs/wast-parser@1.9.0(transitive)
+ Added@webassemblyjs/wast-printer@1.9.0(transitive)
+ Added@xtuc/ieee754@1.2.0(transitive)
+ Added@xtuc/long@4.2.2(transitive)
+ Addedacorn@6.4.2(transitive)
+ Addedajv@6.12.6(transitive)
+ Addedajv-errors@1.0.1(transitive)
+ Addedajv-keywords@3.5.2(transitive)
+ Addedanymatch@2.0.03.1.3(transitive)
+ Addedaproba@1.2.0(transitive)
+ Addedarr-diff@4.0.0(transitive)
+ Addedarr-flatten@1.1.0(transitive)
+ Addedarr-union@3.1.0(transitive)
+ Addedarray-unique@0.3.2(transitive)
+ Addedasn1.js@4.10.1(transitive)
+ Addedassert@1.5.1(transitive)
+ Addedassign-symbols@1.0.0(transitive)
+ Addedasync-each@1.0.6(transitive)
+ Addedatob@2.1.2(transitive)
+ Addedbase@0.11.2(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbig.js@5.2.2(transitive)
+ Addedbinary-extensions@1.13.12.3.0(transitive)
+ Addedbindings@1.5.0(transitive)
+ Addedbluebird@3.7.2(transitive)
+ Addedbn.js@4.12.15.2.1(transitive)
+ Addedbraces@2.3.2(transitive)
+ Addedbrorand@1.1.0(transitive)
+ Addedbrowserify-aes@1.2.0(transitive)
+ Addedbrowserify-cipher@1.0.1(transitive)
+ Addedbrowserify-des@1.0.2(transitive)
+ Addedbrowserify-rsa@4.1.1(transitive)
+ Addedbrowserify-sign@4.2.3(transitive)
+ Addedbrowserify-zlib@0.2.0(transitive)
+ Addedbuffer@4.9.2(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedbuffer-xor@1.0.3(transitive)
+ Addedbuiltin-status-codes@3.0.0(transitive)
+ Addedcacache@12.0.4(transitive)
+ Addedcache-base@1.0.1(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedchokidar@2.1.83.6.0(transitive)
+ Addedchownr@1.1.4(transitive)
+ Addedchrome-trace-event@1.0.4(transitive)
+ Addedcipher-base@1.0.4(transitive)
+ Addedclass-utils@0.3.6(transitive)
+ Addedclone@2.1.2(transitive)
+ Addedcollection-visit@1.0.0(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcommondir@1.0.1(transitive)
+ Addedcomponent-emitter@1.3.1(transitive)
+ Addedconcat-stream@1.6.2(transitive)
+ Addedconsole-browserify@1.2.0(transitive)
+ Addedconstants-browserify@1.0.0(transitive)
+ Addedcopy-concurrently@1.0.5(transitive)
+ Addedcopy-descriptor@0.1.1(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedcreate-ecdh@4.0.4(transitive)
+ Addedcreate-hash@1.2.0(transitive)
+ Addedcreate-hmac@1.1.7(transitive)
+ Addedcrypto-browserify@3.12.1(transitive)
+ Addedcyclist@1.0.2(transitive)
+ Addeddecode-uri-component@0.2.2(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddefine-property@0.2.51.0.02.0.2(transitive)
+ Addeddes.js@1.1.0(transitive)
+ Addeddiffie-hellman@5.0.3(transitive)
+ Addeddomain-browser@1.2.0(transitive)
+ Addedduplexify@3.7.1(transitive)
+ Addedelliptic@6.6.1(transitive)
+ Addedemojis-list@3.0.0(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedenhanced-resolve@4.5.0(transitive)
+ Addederrno@0.1.8(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedeslint-scope@4.0.3(transitive)
+ Addedesrecurse@4.3.0(transitive)
+ Addedestraverse@4.3.05.3.0(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedevp_bytestokey@1.0.3(transitive)
+ Addedexpand-brackets@2.1.4(transitive)
+ Addedextend-shallow@2.0.13.0.2(transitive)
+ Addedextglob@2.0.4(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedfiggy-pudding@3.5.2(transitive)
+ Addedfile-uri-to-path@1.0.0(transitive)
+ Addedfill-range@4.0.0(transitive)
+ Addedfind-cache-dir@2.1.0(transitive)
+ Addedfind-up@3.0.0(transitive)
+ Addedflush-write-stream@1.1.1(transitive)
+ Addedfor-in@1.0.2(transitive)
+ Addedfragment-cache@0.2.1(transitive)
+ Addedfrom2@2.3.0(transitive)
+ Addedfs-write-stream-atomic@1.0.10(transitive)
+ Addedfsevents@1.2.132.3.3(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedget-value@2.0.6(transitive)
+ Addedglob-parent@3.1.0(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-value@0.3.11.0.0(transitive)
+ Addedhas-values@0.1.41.0.0(transitive)
+ Addedhash-base@3.0.4(transitive)
+ Addedhash.js@1.1.7(transitive)
+ Addedhmac-drbg@1.0.1(transitive)
+ Addedhttps-browserify@1.0.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addediferr@0.1.5(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedinfer-owner@1.0.4(transitive)
+ Addedinherits@2.0.3(transitive)
+ Addedis-accessor-descriptor@1.0.1(transitive)
+ Addedis-binary-path@1.0.12.1.0(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedis-data-descriptor@1.0.1(transitive)
+ Addedis-descriptor@0.1.71.0.3(transitive)
+ Addedis-extendable@0.1.11.0.1(transitive)
+ Addedis-glob@3.1.0(transitive)
+ Addedis-number@3.0.0(transitive)
+ Addedis-plain-object@2.0.4(transitive)
+ Addedis-windows@1.0.2(transitive)
+ Addedis-wsl@1.1.0(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisobject@2.1.03.0.1(transitive)
+ Addedjson-parse-better-errors@1.0.2(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson5@1.0.2(transitive)
+ Addedkind-of@3.2.24.0.06.0.3(transitive)
+ Addedloader-runner@2.4.0(transitive)
+ Addedloader-utils@1.4.2(transitive)
+ Addedlocate-path@3.0.0(transitive)
+ Addedlru-cache@5.1.1(transitive)
+ Addedmake-dir@2.1.0(transitive)
+ Addedmap-cache@0.2.2(transitive)
+ Addedmap-visit@1.0.0(transitive)
+ Addedmd5.js@1.3.5(transitive)
+ Addedmemory-fs@0.4.10.5.0(transitive)
+ Addedmicromatch@3.1.10(transitive)
+ Addedmiller-rabin@4.0.1(transitive)
+ Addedminimalistic-assert@1.0.1(transitive)
+ Addedminimalistic-crypto-utils@1.0.1(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmississippi@3.0.0(transitive)
+ Addedmixin-deep@1.3.2(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedmove-concurrently@1.0.1(transitive)
+ Addednan@2.22.0(transitive)
+ Addednanomatch@1.2.13(transitive)
+ Addedneo-async@2.6.2(transitive)
+ Addednode-libs-browser@2.2.1(transitive)
+ Addednormalize-path@2.1.13.0.0(transitive)
+ Addedobject-copy@0.1.0(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject-visit@1.0.1(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedobject.pick@1.3.0(transitive)
+ Addedos-browserify@0.3.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@3.0.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpako@1.0.11(transitive)
+ Addedparallel-transform@1.2.0(transitive)
+ Addedparse-asn1@5.1.7(transitive)
+ Addedpascalcase@0.1.1(transitive)
+ Addedpath-browserify@0.0.1(transitive)
+ Addedpath-dirname@1.0.2(transitive)
+ Addedpath-exists@3.0.0(transitive)
+ Addedpbkdf2@3.1.2(transitive)
+ Addedpify@4.0.1(transitive)
+ Addedpkg-dir@3.0.0(transitive)
+ Addedposix-character-classes@0.1.1(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedpromise-inflight@1.0.1(transitive)
+ Addedprr@1.0.1(transitive)
+ Addedpublic-encrypt@4.0.3(transitive)
+ Addedpump@2.0.13.0.2(transitive)
+ Addedpumpify@1.5.1(transitive)
+ Addedpunycode@1.4.12.3.1(transitive)
+ Addedqs@6.13.0(transitive)
+ Addedquerystring-es3@0.2.1(transitive)
+ Addedrandombytes@2.1.0(transitive)
+ Addedrandomfill@1.0.4(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedreaddirp@2.2.13.6.0(transitive)
+ Addedregex-not@1.0.2(transitive)
+ Addedremove-trailing-separator@1.1.0(transitive)
+ Addedrepeat-element@1.1.4(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedresolve-url@0.2.1(transitive)
+ Addedret@0.1.15(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedripemd160@2.0.2(transitive)
+ Addedrun-queue@1.0.3(transitive)
+ Addedsafe-buffer@5.1.25.2.1(transitive)
+ Addedsafe-regex@1.1.0(transitive)
+ Addedschema-utils@1.0.0(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedserialize-javascript@4.0.0(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-value@2.0.1(transitive)
+ Addedsetimmediate@1.0.5(transitive)
+ Addedsha.js@2.4.11(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedsnapdragon@0.8.2(transitive)
+ Addedsnapdragon-node@2.1.1(transitive)
+ Addedsnapdragon-util@3.0.1(transitive)
+ Addedsource-list-map@2.0.1(transitive)
+ Addedsource-map@0.5.70.6.1(transitive)
+ Addedsource-map-resolve@0.5.3(transitive)
+ Addedsource-map-support@0.5.21(transitive)
+ Addedsource-map-url@0.4.1(transitive)
+ Addedsplit-string@3.1.0(transitive)
+ Addedssri@6.0.2(transitive)
+ Addedstatic-extend@0.1.2(transitive)
+ Addedstream-browserify@2.0.2(transitive)
+ Addedstream-each@1.2.3(transitive)
+ Addedstream-http@2.8.3(transitive)
+ Addedstream-shift@1.0.3(transitive)
+ Addedstring_decoder@1.1.11.3.0(transitive)
+ Addedtapable@1.1.3(transitive)
+ Addedterser@4.8.1(transitive)
+ Addedterser-webpack-plugin@1.4.6(transitive)
+ Addedthrough2@2.0.5(transitive)
+ Addedtimers-browserify@2.0.12(transitive)
+ Addedto-arraybuffer@1.0.1(transitive)
+ Addedto-object-path@0.3.0(transitive)
+ Addedto-regex@3.0.2(transitive)
+ Addedto-regex-range@2.1.1(transitive)
+ Addedtty-browserify@0.0.0(transitive)
+ Addedtypedarray@0.0.6(transitive)
+ Addedunion-value@1.0.1(transitive)
+ Addedunique-filename@1.1.1(transitive)
+ Addedunique-slug@2.0.2(transitive)
+ Addedunset-value@1.0.0(transitive)
+ Addedupath@1.2.0(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedurix@0.1.0(transitive)
+ Addedurl@0.11.4(transitive)
+ Addeduse@3.1.1(transitive)
+ Addedutil@0.10.40.11.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedvm-browserify@1.1.2(transitive)
+ Addedwatchpack@1.7.5(transitive)
+ Addedwatchpack-chokidar2@2.0.1(transitive)
+ Addedwebpack@4.47.0(transitive)
+ Addedwebpack-sources@1.4.3(transitive)
+ Addedworker-farm@1.7.0(transitive)
+ Addedxtend@4.0.2(transitive)
+ Addedy18n@4.0.3(transitive)
+ Addedyallist@3.1.1(transitive)
- Removedescape-string-regexp@^2.0.0
- Removedmerge@^1.2.1
- Removed@nodelib/fs.scandir@2.1.5(transitive)
- Removed@nodelib/fs.stat@2.0.5(transitive)
- Removed@nodelib/fs.walk@1.2.8(transitive)
- Removed@types/glob@7.2.0(transitive)
- Removed@types/minimatch@5.1.2(transitive)
- Removed@types/node@22.9.0(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedarray-union@2.1.0(transitive)
- Removedbabel-code-frame@6.26.0(transitive)
- Removedbabel-helper-evaluate-path@0.5.0(transitive)
- Removedbabel-helper-mark-eval-scopes@0.4.3(transitive)
- Removedbabel-helper-remove-or-void@0.4.3(transitive)
- Removedbabel-messages@6.23.0(transitive)
- Removedbabel-plugin-add-module-metadata@2.18.2(transitive)
- Removedbabel-plugin-alias-modules@2.18.2(transitive)
- Removedbabel-plugin-minify-dead-code-elimination@0.5.1(transitive)
- Removedbabel-plugin-name-amd-modules@2.18.2(transitive)
- Removedbabel-plugin-namespace-amd-define@2.18.2(transitive)
- Removedbabel-plugin-namespace-modules@2.18.2(transitive)
- Removedbabel-plugin-normalize-requires@2.18.2(transitive)
- Removedbabel-plugin-transform-node-env-inline@0.4.3(transitive)
- Removedbabel-plugin-wrap-modules-amd@2.18.2(transitive)
- Removedbabel-preset-liferay-standard@2.18.2(transitive)
- Removedbabel-runtime@6.26.0(transitive)
- Removedbabel-template@6.26.0(transitive)
- Removedbabel-traverse@6.26.0(transitive)
- Removedbabel-types@6.26.0(transitive)
- Removedbabylon@6.18.0(transitive)
- Removedchalk@1.1.3(transitive)
- Removedcore-js@2.6.12(transitive)
- Removeddir-glob@3.0.1(transitive)
- Removedescape-string-regexp@2.0.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedfast-glob@3.3.2(transitive)
- Removedfastq@1.17.1(transitive)
- Removedglobals@9.18.0(transitive)
- Removedglobby@10.0.2(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedignore@5.3.2(transitive)
- Removedinvariant@2.2.4(transitive)
- Removedjs-tokens@3.0.2(transitive)
- Removedliferay-npm-bundler-plugin-exclude-imports@2.18.2(transitive)
- Removedliferay-npm-bundler-plugin-inject-imports-dependencies@2.18.2(transitive)
- Removedliferay-npm-bundler-plugin-inject-peer-dependencies@2.18.2(transitive)
- Removedliferay-npm-bundler-plugin-namespace-packages@2.18.2(transitive)
- Removedliferay-npm-bundler-plugin-replace-browser-modules@2.18.2(transitive)
- Removedliferay-npm-bundler-plugin-resolve-linked-dependencies@2.18.2(transitive)
- Removedliferay-npm-bundler-preset-standard@2.18.2(transitive)
- Removedlodash@4.17.21(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedmerge@1.2.1(transitive)
- Removedmerge2@1.4.1(transitive)
- Removedmicromatch@4.0.8(transitive)
- Removedpath-type@4.0.0(transitive)
- Removedqueue-microtask@1.2.3(transitive)
- Removedregenerator-runtime@0.11.1(transitive)
- Removedreusify@1.0.4(transitive)
- Removedrun-parallel@1.2.0(transitive)
- Removedsemver@6.3.1(transitive)
- Removedslash@3.0.0(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedto-fast-properties@1.0.3(transitive)
- Removedundici-types@6.19.8(transitive)