How to use the liferay-npm-build-tools-common/lib/namespace.addNamespace 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-modules / src / index.js View on Github external
if (!t.isIdentifier(callee, {name: 'define'})) {
				return;
			}

			const {arguments: args} = expression;

			const {dependencies: depsIndex, name: nameIndex} = getDefineIndices(
				t,
				args
			);

			// Namespace module name
			if (namespaces.module && nameIndex !== undefined) {
				const moduleName = args[nameIndex].value;

				args[nameIndex].value = ns.addNamespace(
					moduleName,
					namespaces.module
				);

				state.namesCount++;
			}

			// Namespace dependencies
			if (depsIndex !== undefined) {
				const deps = args[depsIndex].elements;

				deps.forEach((dep, i) => {
					const {value: moduleName} = dep;

					if (
						!t.isStringLiteral(dep) ||
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler-plugin-namespace-packages / src / index.js View on Github external
Object.keys(pkgJson.dependencies).forEach(pkgName => {
		const namespacedPkgName = ns.addNamespace(pkgName, rootPkgJson);
		const version = pkgJson.dependencies[pkgName];

		pkgJson.dependencies[namespacedPkgName] = version;

		delete pkgJson.dependencies[pkgName];
	});
github liferay / liferay-js-toolkit / packages / babel-plugin-namespace-modules / src / index.js View on Github external
function addDependencyNamespace(moduleName, namespacePkg, unrolledImports) {
	const {pkgName, scope} = mod.splitModuleName(moduleName);
	const fullPkgName = mod.joinModuleName(scope, pkgName);
	const pkg = unrolledImports[fullPkgName] || namespacePkg;

	return pkg.name === '' ? moduleName : ns.addNamespace(moduleName, pkg);
}
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler-plugin-namespace-packages / src / index.js View on Github external
export default function({log, pkg, rootPkgJson}, {pkgJson}) {
	if (!pkg.isRoot) {
		pkgJson.name = ns.addNamespace(pkgJson.name, rootPkgJson);

		log.info('namespace-packages', 'Namespaced package');
	}

	pkgJson.dependencies = pkgJson.dependencies || {};

	Object.keys(pkgJson.dependencies).forEach(pkgName => {
		const namespacedPkgName = ns.addNamespace(pkgName, rootPkgJson);
		const version = pkgJson.dependencies[pkgName];

		pkgJson.dependencies[namespacedPkgName] = version;

		delete pkgJson.dependencies[pkgName];
	});

	log.info(
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler-plugin-inject-imports-dependencies / src / index.js View on Github external
Object.keys(imports[namespace]).forEach(pkgName => {
			const localName = ns.addNamespace(pkgName, rootPkgJson);

			const importVersion = imports[namespace][pkgName];
			const importName =
				namespace === ''
					? pkgName
					: ns.addNamespace(pkgName, {name: namespace});

			pkgJson.dependencies[importName] = importVersion;

			if (
				pkgJson.dependencies[localName] !== undefined &&
				pkgJson.dependencies[localName] !== importVersion
			) {
				log.info(
					'inject-imports-dependencies',
					'Injected dependency',
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler-plugin-inject-imports-dependencies / src / index.js View on Github external
Object.keys(imports[namespace]).forEach(pkgName => {
			const localName = ns.addNamespace(pkgName, rootPkgJson);

			const importVersion = imports[namespace][pkgName];
			const importName =
				namespace === ''
					? pkgName
					: ns.addNamespace(pkgName, {name: namespace});

			pkgJson.dependencies[importName] = importVersion;

			if (
				pkgJson.dependencies[localName] !== undefined &&
				pkgJson.dependencies[localName] !== importVersion
			) {
				log.info(
					'inject-imports-dependencies',
					'Injected dependency',
					`${importName}@${importVersion}`,
					'(however, note that the same dependency in package.json',
					'has different constraints:',
					`${localName}@${pkgJson.dependencies[localName]})`
				);
			} else {