Actualizacion de seguridad
This commit is contained in:
64
node_modules/module-alias/README.md
generated
vendored
64
node_modules/module-alias/README.md
generated
vendored
@@ -1,6 +1,13 @@
|
||||
# module-alias
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
|
||||
If everyone who reads this would donate just $1, I would be a millionaire in 1 week! 🙃 Thank you for reaching 1M+ weekly downloads!
|
||||
|
||||
More donations means more motivation for me to make updates. Thank you so much!
|
||||
|
||||
[DONATE $1 ❤️](https://tinyurl.com/donate-module-alias)
|
||||
|
||||
---
|
||||
|
||||
Create aliases of directories and register custom module paths in NodeJS like a boss!
|
||||
|
||||
@@ -27,7 +34,7 @@ require('my_private_module');
|
||||
import module from 'my_private_module'
|
||||
```
|
||||
|
||||
**WARNING:** This module should not be used in other npm modules since it modifies the default `require` behavior! It is designed to be used for development of final projects i.e. web-sites, applications etc.
|
||||
**WARNING:** If you are going to use this package within another NPM package, please read [Using within another NPM package](#using-within-another-npm-package) first to be aware of potential caveats.
|
||||
|
||||
## Install
|
||||
|
||||
@@ -143,17 +150,64 @@ module.exports = {
|
||||
}
|
||||
```
|
||||
|
||||
More details on the [official documentation](https://webpack.js.org/configuration/resolve).
|
||||
|
||||
## Usage with Jest
|
||||
|
||||
Unfortunately, `module-alias` itself would not work from Jest due to a custom behavior of Jest's `require`. But you can use it's own aliasing mechanism instead. The configuration can be defined either in `package.json` or `jest.config.js`. The example below is for `package.json`:
|
||||
|
||||
```js
|
||||
"jest": {
|
||||
"moduleNameMapper": {
|
||||
"@root/(.*)": "<rootDir>/$1",
|
||||
"@client/(.*)": "<rootDir>/src/client/$1"
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
More details on the [official documentation](https://jestjs.io/docs/en/configuration#modulenamemapper-objectstring-string--arraystring).
|
||||
|
||||
## Using within another NPM package
|
||||
|
||||
You can use `module-alias` within another NPM package, however there are a few things to take into consideration.
|
||||
|
||||
1. As the aliases are global, you should make sure your aliases are unique, to avoid conflicts with end-user code, or with other libraries using module-alias. For example, you could prefix your aliases with '@my-lib/', and then use require('@my-lib/deep').
|
||||
2. The internal "register" mechanism may not work, you should not rely on `require('module-alias/register')` for automatic detection of `package.json` location (where you defined your aliases), as it tries to find package.json in either the current working directory of your node process, or two levels down from node_modules/module-alias. It is extremely likely that this is end-user code. So, instead, your should either register aliases manually with `moduleAlias.addAlias`, or using something like `require('module-alias')(__dirname)`.
|
||||
|
||||
Here is an [example project](https://github.com/Kehrlann/module-alias-library).
|
||||
|
||||
|
||||
## Known incompatibilities
|
||||
|
||||
This module does not play well with:
|
||||
|
||||
- Front-end JavaScript code. Module-alias is designed for server side so do not expect it to work with front-end frameworks (React, Vue, ...) as they tend to use Webpack. Use Webpack's [resolve.alias](https://webpack.js.org/configuration/resolve/#resolvealias) mechanism instead.
|
||||
- [Jest](https://jestjs.io), which discards node's module system entirely to use it's own module system, bypassing module-alias.
|
||||
- The [NCC compiler](https://github.com/zeit/ncc), as it uses WebPack under the hood without exposing properties, such as resolve.alias. It is not [something they wish to do](https://github.com/zeit/ncc/pull/460).
|
||||
|
||||
## How it works?
|
||||
|
||||
In order to register an alias it modifies the internal `Module._resolveFilename` method so that when you use `require` or `import` it first checks whether the given string starts with one of the registered aliases, if so, it replaces the alias in the string with the target path of the alias.
|
||||
|
||||
In order to register a custom modules path (`addPath`) it modifies the internal `Module._nodeModulePaths` method so that the given directory then acts like it's the `node_modules` directory.
|
||||
|
||||
## Refactor your code (for already existing projects)
|
||||
|
||||
If you are using this on an existing project, you can use [relative-to-alias](https://github.com/s-yadav/relative-to-alias) to refactor your code to start using aliases.
|
||||
|
||||
## Donate
|
||||
|
||||
If everyone who downloads module-alias would donate just $1, I would be a millionaire in 1 week!
|
||||
|
||||
I love contributing to open source, for free, but you know, sometimes, in the middle of the night, I may wan to eat.
|
||||
|
||||
There are some improvements planned for module-alias and your donations will help a lot to make it happen faster.
|
||||
|
||||
[DONATE $1 ❤️](https://tinyurl.com/donate-module-alias) and thank you so much!
|
||||
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/module-alias.svg
|
||||
[npm-url]: https://npmjs.org/package/module-alias
|
||||
[travis-image]: https://img.shields.io/travis/ilearnio/module-alias/master.svg
|
||||
[travis-url]: https://travis-ci.org/ilearnio/module-alias
|
||||
|
||||
## Refactor your code (for already existing projects)
|
||||
|
||||
If you are using this on an existing project, you can use [relative-to-alias](https://github.com/s-yadav/relative-to-alias) to refactor your code to start using aliases.
|
||||
|
||||
79
node_modules/module-alias/package.json
generated
vendored
79
node_modules/module-alias/package.json
generated
vendored
@@ -1,57 +1,21 @@
|
||||
{
|
||||
"_from": "module-alias@^2.2.2",
|
||||
"_id": "module-alias@2.2.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==",
|
||||
"_location": "/module-alias",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "module-alias@^2.2.2",
|
||||
"name": "module-alias",
|
||||
"escapedName": "module-alias",
|
||||
"rawSpec": "^2.2.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.2.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/telegraf"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.2.tgz",
|
||||
"_shasum": "151cdcecc24e25739ff0aa6e51e1c5716974c0e0",
|
||||
"_spec": "module-alias@^2.2.2",
|
||||
"_where": "/home/pablinux/Projects/Node/app_sigma/node_modules/telegraf",
|
||||
"name": "module-alias",
|
||||
"description": "Create aliases of directories and register custom module paths",
|
||||
"version": "2.2.3",
|
||||
"author": {
|
||||
"name": "Nick Gavrilov",
|
||||
"email": "artnikpro@gmail.com"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "npm run lint && npm run testonly",
|
||||
"testonly": "NODE_ENV=test mocha test/specs.js",
|
||||
"testonly-watch": "NODE_ENV=test mocha -w test/specs.js",
|
||||
"lint": "standard"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ilearnio/module-alias/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Create aliases of directories and register custom module paths",
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
"hello-world-classic": "github:ilearnio/hello-world-classic",
|
||||
"husky": "^3.0.2",
|
||||
"mocha": "^2.4.5",
|
||||
"semver": "^6.1.1",
|
||||
"standard": "^12.0.1"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"register.js",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"homepage": "https://github.com/ilearnio/module-alias",
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-push": "npm run test"
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"extend",
|
||||
"modules",
|
||||
@@ -61,16 +25,27 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "module-alias",
|
||||
"files": [
|
||||
"index.js",
|
||||
"register.js",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ilearnio/module-alias.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "standard",
|
||||
"test": "npm run lint && npm run testonly",
|
||||
"testonly": "NODE_ENV=test mocha test/specs.js",
|
||||
"testonly-watch": "NODE_ENV=test mocha -w test/specs.js"
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
"hello-world-classic": "ilearnio/hello-world-classic",
|
||||
"husky": "^3.0.2",
|
||||
"mocha": "^2.4.5",
|
||||
"semver": "^6.1.1",
|
||||
"standard": "^12.0.1"
|
||||
},
|
||||
"version": "2.2.2"
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-push": "npm run test"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user