craco-alias
Advanced tools
Comparing version 2.1.0 to 2.1.1
{ | ||
"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' | ||
}) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30084
29
731