How to use the liferay-npm-build-tools-common/lib/babel-ipc.get 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 / babel-plugin-namespace-amd-define / src / index.js View on Github external
exit(path, state) {
					// We must traverse the AST again because the third party
					// transform-es2015-modules-amd emits its define() call after
					// Program exit :-(
					firstDefineNamespaced = false;
					extraNamespaceCount = 0;

					path.traverse(namespaceVisitor, {opts: state.opts});

					if (extraNamespaceCount > 0) {
						const {log} = babelIpc.get(state, () => ({
							log: new PluginLogger(),
						}));

						if (firstDefineNamespaced) {
							log.info(
								'namespace-amd-define',
								'Namespaced first AMD define in file'
							);
						}

						if (extraNamespaceCount) {
							log.warn(
								'namespace-amd-define',
								'Found',
								extraNamespaceCount,
								'define() calls inside the module definition',
github liferay / liferay-js-toolkit / packages / babel-plugin-namespace-modules / src / index.js View on Github external
exit(path, state) {
					// We must traverse the AST again because the
					// transform-es2015-modules-amd plugin emits its define()
					// call after exiting Program node :-(
					path.traverse(amdDefineVisitor, state);

					// Dump final report statistics
					if (
						state.namesCount > 0 ||
						state.depsCount > 0 ||
						state.requiresCount > 0
					) {
						const {log} = babelIpc.get(state, () => ({
							log: new PluginLogger(),
						}));

						log.info(
							'namespace-modules',
							'Namespaced',
							state.namesCount,
							'define() names,',
							state.depsCount,
							'define() dependencies,',
							'and',
							state.requiresCount,
							'require() names'
						);
					}
				},
github liferay / liferay-js-toolkit / packages / babel-plugin-normalize-requires / src / index.js View on Github external
exit(path, state) {
					if (state.normalizeCount) {
						const {log} = babelIpc.get(state, () => ({
							log: new PluginLogger(),
						}));

						log.info(
							'normalize-requires',
							'Normalized',
							state.normalizeCount,
							'requires'
						);
					}
				},
			},
github liferay / liferay-js-toolkit / packages / babel-plugin-name-amd-modules / src / index.js View on Github external
enter(path, state) {
					const {log} = babelIpc.get(state, () => ({
						log: new PluginLogger(),
					}));

					state.log = log;
				},
				exit(path, state) {
github liferay / liferay-js-toolkit / packages / babel-plugin-add-module-metadata / src / index.js View on Github external
if (state.esModuleFlagAdded) {
		return;
	}

	const {filename} = state.file.opts;
	const pkgDir = babelUtil.getPackageDir(filename);
	const pkgJson = readJsonSync(npath.join(pkgDir, 'package.json'));

	const {rootPkgJson} = babelIpc.get(state);

	const pkgId =
		pkgJson.name === rootPkgJson.name
			? '/'
			: `${pkgJson.name}@${pkgJson.version}`;

	const {manifest} = babelIpc.get(state);

	manifest.addModuleFlags(pkgId, npath.relative(pkgDir, filename), {
		esModule: true,
	});

	state.esModuleFlagAdded = true;

	const {log} = babelIpc.get(state, () => ({
		log: new PluginLogger(),
	}));

	log.info('add-module-metadata', "Added 'esModule' flag");
}
github liferay / liferay-js-toolkit / packages / babel-plugin-add-module-metadata / src / index.js View on Github external
const {rootPkgJson} = babelIpc.get(state);

	const pkgId =
		pkgJson.name === rootPkgJson.name
			? '/'
			: `${pkgJson.name}@${pkgJson.version}`;

	const {manifest} = babelIpc.get(state);

	manifest.addModuleFlags(pkgId, npath.relative(pkgDir, filename), {
		esModule: true,
	});

	state.esModuleFlagAdded = true;

	const {log} = babelIpc.get(state, () => ({
		log: new PluginLogger(),
	}));

	log.info('add-module-metadata', "Added 'esModule' flag");
}
github liferay / liferay-js-toolkit / packages / babel-plugin-wrap-modules-amd / src / index.js View on Github external
Identifier(path, state) {
			const {node} = path;
			const {dependencies} = state;
			const {log} = babelIpc.get(state, () => ({
				log: new PluginLogger(),
			}));

			if (node.name === 'require') {
				const parent = path.parent;

				if (
					path.scope.hasBinding('require') &&
					!state['webpackWarnIssued']
				) {
					state['webpackWarnIssued'] = true;

					log.warn(
						'wrap-modules-amd',
						`Module looks like a webpack bundle, local require() ` +
							`calls will be ignored`
github liferay / liferay-js-toolkit / packages / babel-plugin-alias-modules / src / index.ts View on Github external
constructor(state) {
		const babelIpcObject: BabelIpcObject = babelIpc.get(state, {});

		this._aliasFields = getAliasFields(
			babelIpcObject.globalConfig,
			state.opts
		);
		this._absFile = new FilePath(state.file.opts.filename);
		this._log = babelIpcObject.log;

		this._absRootDir = new FilePath(
			this._absFile.asNative.startsWith(absBuildDirPath)
				? absBuildDirPath
				: absPrjDirPath
		);

		state.visitor = this;
	}