How to use the liferay-npm-build-tools-common/lib/project.transform function in liferay-npm-build-tools-common

To help you get started, we’ve selected a few liferay-npm-build-tools-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / steps / transform.js View on Github external
function babelifyPackage(destPkg) {
	// Make a copy of the package's Babel configuration
	const babelConfig = clone(project.transform.getBabelConfig(destPkg));

	// Tune babel config
	babelConfig.babelrc = false;
	babelConfig.compact = false;
	babelConfig.only = '**/*';
	if (babelConfig.sourceMaps === undefined) {
		babelConfig.sourceMaps = true;
	}

	// Report a copy of the package's Babel configuration before loading plugins
	report.packageProcessBabelConfig(destPkg, clone(babelConfig));

	// Intercept presets and plugins to load them from here
	babelConfig.plugins = project.transform.getBabelPlugins(destPkg);
	babelConfig.presets = [];
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / steps / transform.js View on Github external
// Make a copy of the package's Babel configuration
	const babelConfig = clone(project.transform.getBabelConfig(destPkg));

	// Tune babel config
	babelConfig.babelrc = false;
	babelConfig.compact = false;
	babelConfig.only = '**/*';
	if (babelConfig.sourceMaps === undefined) {
		babelConfig.sourceMaps = true;
	}

	// Report a copy of the package's Babel configuration before loading plugins
	report.packageProcessBabelConfig(destPkg, clone(babelConfig));

	// Intercept presets and plugins to load them from here
	babelConfig.plugins = project.transform.getBabelPlugins(destPkg);
	babelConfig.presets = [];

	// Determine file globs
	const globs = ['**/*.js', '!node_modules/**/*'];

	if (destPkg.isRoot) {
		globs.push(...gl.negate(project.transform.babelIgnores));
	}

	// Run babel through files
	const prjRelPaths = findFiles(
		project.dir.asNative,
		gl.prefix(`${project.dir.asPosix}/${destPkg.dir.asPosix}/`, globs)
	);

	log.debug(
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / steps / transform.js View on Github external
return new Promise((resolve, reject) => {
		try {
			const state = runPlugins(
				phase === 'pre'
					? project.transform.getPrePluginDescriptors(destPkg)
					: project.transform.getPostPluginDescriptors(destPkg),
				srcPkg,
				destPkg,
				{
					pkgJson: readJsonSync(
						destPkg.dir.join('package.json').asNative
					),
				},
				(plugin, log) => {
					report.packageProcessBundlerPlugin(
						phase,
						destPkg,
						plugin,
						log
					);

					if (log.errorsPresent) {
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / steps / transform.js View on Github external
return new Promise((resolve, reject) => {
		try {
			const state = runPlugins(
				phase === 'pre'
					? project.transform.getPrePluginDescriptors(destPkg)
					: project.transform.getPostPluginDescriptors(destPkg),
				srcPkg,
				destPkg,
				{
					pkgJson: readJsonSync(
						destPkg.dir.join('package.json').asNative
					),
				},
				(plugin, log) => {
					report.packageProcessBundlerPlugin(
						phase,
						destPkg,
						plugin,
						log
					);