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

craco-alias

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

craco-alias - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

plugin/helpers/escape-string-for-regexp.js

2

package.json
{
"name": "craco-alias",
"version": "2.1.0",
"version": "2.1.1",
"description": "A craco plugin for automatic aliases generation",

@@ -5,0 +5,0 @@ "main": "plugin/index.js",

const path = require('path')
const escapeStringForRegExp = require('./helpers/escape-string-for-regexp')

@@ -6,4 +7,5 @@ const getModuleNameMapper = ({ aliases }) => {

for (let aliasName in aliases) {
const aliasPath = aliases[aliasName]
for (let unescapedAliasName in aliases) {
const aliasName = escapeStringForRegExp(unescapedAliasName)
const aliasPath = aliases[unescapedAliasName]

@@ -10,0 +12,0 @@ const isFile = path.extname(aliasPath).length > 0

@@ -18,2 +18,17 @@ const generateModuleNameMapper = require('./generate-module-name-mapper')

})
test('should correctly generate moduleNameMapper when alias name have special RegExp characters', () => {
const moduleNameMapper = generateModuleNameMapper({
aliases: {
'$file': '/some/absolute/path/to/file.js',
'$dir': '/some/absolute/path/to/dir'
}
})
expect(moduleNameMapper).toEqual({
'^\\$file$': '/some/absolute/path/to/file.js',
'^\\$dir$': '/some/absolute/path/to/dir',
'^\\$dir/(.*)$': '/some/absolute/path/to/dir/$1'
})
})
})
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