Gathering detailed insights and metrics for @cichol/alias-mapper
Gathering detailed insights and metrics for @cichol/alias-mapper
Gathering detailed insights and metrics for @cichol/alias-mapper
Gathering detailed insights and metrics for @cichol/alias-mapper
The centralized repository of npm packages for personal projects.
npm install @cichol/alias-mapper
Typescript
Module System
Min. Node Version
Node Version
NPM Version
51.7
Supply Chain
88.5
Quality
85.7
Maintenance
100
Vulnerability
98.9
License
TypeScript (54.6%)
JavaScript (45.04%)
Shell (0.35%)
Total Downloads
3,397
Last Day
1
Last Week
4
Last Month
92
Last Year
2,360
MIT License
196 Commits
1 Forks
1 Watchers
2 Branches
1 Contributors
Updated on May 05, 2025
Minified
Minified + Gzipped
Latest Version
5.1.0
Package Id
@cichol/alias-mapper@5.1.0
Unpacked Size
50.15 kB
Size
14.38 kB
File Count
6
NPM Version
11.3.0
Node Version
20.19.1
Published on
May 05, 2025
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-50%
4
Compared to previous week
Last Month
21.1%
92
Compared to previous month
Last Year
807.7%
2,360
Compared to previous year
4
2
@cichol/alias-mapper
A resolver in order to shorten deeply nested relative path expression.
In monorepo structure or complex directory hierarchy, we used to exhausted by deeply nested import expression. (e.g. import ... from '../../../../package.json'
in packages/frontend/components/button/index.jsx
)
babel-plugin-module-resolver
babel-plugin-root-import
~
is allowed, but ~~
is not)
eslint-import-resolver-babel-plugin-root-import
babel-plugin-root-import@^5
. but latest version of babel-plugin-root-import@6
is released.babel-plugin-hash-resolve
eslint-plugin-import
. (e.g. import/no-unresolved
, import/extensions
)1$ npm install --save-dev @cichol/alias-mapper
If import ... from '(frontend)/application'
expression in backend/server.js
file. that will be transformed like const ... = require('../frontend/releases/application')
.
1{ 2 "plugins": [ 3 [ 4 "module:@cichol/alias-mapper", 5 { 6 "rootDirs": [ 7 "sources" 8 ], 9 "aliases" { 10 "models": "sources/backend/models" 11 } 12 } 13 ] 14 ] 15}
Write or append above codes into your Babel configuration file. (e.g. babel.config.js
, .babelrc(.js(on)?)?
)
Babel integration has to match to output directories. (e.g. dist
, out
, build
, ...)
If you want to integrate with ESLint, you have to ensure eslint-plugin-import
installed. and then, set resolver to your configuration file.
1{ 2 "settings": { 3 "import/resolver": { 4 "@cichol/alias-mapper": { 5 "rootDirs": [ 6 "sources" 7 ], 8 "aliases" { 9 "models": "sources/backend/models" 10 } 11 } 12 } 13 } 14}
Write or append above codes into your ESLint configuration file. (e.g. .eslintrc(.js(on)?|.ya?ml)?
)
ESLint integration has to match to source directories. (e.g. src
, ...)
In Visual Studio Code, all JavaScript files are analyzed by internal TypeScript language handler. so, you can just write jsconfig.json
file or tsconfig.json
for TypeScript project.
1{ 2 "compilerOptions": { 3 "baseUrl": ".", 4 "paths": { 5 "(frontend)/*": "sources/frontend/*", 6 "(backend)/*": "sources/backend/*", 7 "(models)/*": "sources/backend/models/*" 8 } 9 }, 10 "include": ["sources"] 11}
Visual Studio Code integration has to wrap alias name with parentheses and match to source directories.
After the integration process, you can write code with aliased scopes. an alias name has to wrapped by parentheses for avoiding name collision with existing modules by indirect deep dependencies.
Before
1- import logger from '../../../../common/logger';
After
1+ import logger from '(common)/logger';
No vulnerabilities found.
No security vulnerabilities found.