Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-alias-modules

Package Overview
Dependencies
Maintainers
13
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-alias-modules - npm Package Compare versions

Comparing version 2.19.3 to 2.19.4

22

lib/index.js
"use strict";
/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;

@@ -18,2 +29,3 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Visitor = void 0;
const alias_1 = require("liferay-npm-build-tools-common/lib/alias");

@@ -90,3 +102,3 @@ const babelIpc = __importStar(require("liferay-npm-build-tools-common/lib/babel-ipc"));

_resolve(requiredModuleName) {
const { _absRootDir, _absFile, _aliasFields, _log } = this;
const { _absFile, _absRootDir, _aliasFields, _log } = this;
// Fail for absolute path modules

@@ -93,0 +105,0 @@ if (requiredModuleName.startsWith('/')) {

{
"name": "babel-plugin-alias-modules",
"version": "2.19.3",
"author": "Liferay Frontend Infrastructure Team <pt-frontend-infrastructure@liferay.com>",
"dependencies": {
"liferay-npm-build-tools-common": "2.19.4"
},
"description": "A Babel plugin to rewrite aliased require() calls.",
"main": "lib/index.js",
"name": "babel-plugin-alias-modules",
"repository": {
"directory": "maintenance/projects/js-toolkit/packages/babel-plugin-alias-modules",
"type": "git",
"url": "https://github.com/liferay/liferay-frontend-projects.git"
},
"scripts": {
"build": "tsc && yarn copyfiles",
"copyfiles": "node ../../scripts/copyfiles.js",
"build": "tsc && yarn copyfiles",
"prepublish": "yarn build"
},
"dependencies": {
"liferay-npm-build-tools-common": "2.19.3"
},
"gitHead": "e64d58bad216574b5abf459929857588b3b7bfbf"
"version": "2.19.4",
"gitHead": "d341f385c91a7d50168a6ce8be978d2f03f6bedc"
}
/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import path from 'path';
import * as babelIpc from 'liferay-npm-build-tools-common/lib/babel-ipc';
import FilePath from 'liferay-npm-build-tools-common/lib/file-path';
import PluginLogger from 'liferay-npm-build-tools-common/lib/plugin-logger';
import path from 'path';

@@ -12,0 +11,0 @@ import {Visitor} from '../index';

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -8,2 +7,3 @@ */

import {
AliasToType,
AliasToValue,

@@ -13,3 +13,2 @@ getAliasFields,

loadAliases,
AliasToType,
} from 'liferay-npm-build-tools-common/lib/alias';

@@ -30,3 +29,3 @@ import {BabelIpcObject} from 'liferay-npm-build-tools-common/lib/api/plugins';

*/
export default function({types}) {
export default function ({types}) {
t = types;

@@ -117,5 +116,6 @@

_resolve(requiredModuleName: string): AliasToValue {
const {_absRootDir, _absFile, _aliasFields, _log} = this;
const {_absFile, _absRootDir, _aliasFields, _log} = this;
// Fail for absolute path modules
if (requiredModuleName.startsWith('/')) {

@@ -138,2 +138,3 @@ _log.error(

// First look in file directory (without recursion)
alias = this._getAliasForLocal(

@@ -146,2 +147,3 @@ absFileDir,

// Then, if not found, recursively from target module up
if (alias === undefined) {

@@ -199,2 +201,3 @@ const moduleDir = absFileDir.join(requiredModule.dirname());

// Try with file alias
if (

@@ -208,2 +211,3 @@ alias === undefined &&

// Try with external module aliases
if (alias === undefined) {

@@ -214,2 +218,3 @@ alias = aliases[searchRelModuleName.asPosix];

// Found: return it
if (alias !== undefined) {

@@ -220,2 +225,3 @@ return alias;

// Search finished
if (absSearchDir.is(absSearchTopDir)) {

@@ -226,2 +232,3 @@ return undefined;

// Look up in hierachy
alias = this._getAliasForLocal(

@@ -234,2 +241,3 @@ absSearchTopDir,

// Rebase to current folder
if (

@@ -267,2 +275,3 @@ alias !== undefined &&

// Found: return it
if (alias !== undefined) {

@@ -273,2 +282,3 @@ return alias;

// Search finished
if (absSearchDir.is(_absRootDir)) {

@@ -279,2 +289,3 @@ return undefined;

// Look up in hierachy
alias = this._getAliasForExternal(

@@ -286,2 +297,3 @@ absSearchDir.dirname(),

// Rebase to current folder
if (

@@ -288,0 +300,0 @@ alias !== undefined &&

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc