Desplegando App

This commit is contained in:
2022-02-25 13:15:51 -05:00
parent 7e6467e75d
commit f12b75b26d
1182 changed files with 166158 additions and 1 deletions

21
node_modules/module-alias/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2018, Nick Gavrilov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

159
node_modules/module-alias/README.md generated vendored Normal file
View File

@@ -0,0 +1,159 @@
# module-alias
[![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
Create aliases of directories and register custom module paths in NodeJS like a boss!
No more shit-coding paths in Node like so:
```js
require('../../../../some/very/deep/module')
```
Enough of this madness!
Just create an alias and do it the right way:
```js
var module = require('@deep/module')
// Or ES6
import module from '@deep/module'
```
It also allows you to register directories that will act just like `node_modules` but with your own private modules, so that you can access them directly:
```js
require('my_private_module');
// Or ES6
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.
## Install
```
npm i --save module-alias
```
## Usage
Add your custom configuration to your `package.json` (in your application's root)
```js
// Aliases
"_moduleAliases": {
"@root" : ".", // Application's root
"@deep" : "src/some/very/deep/directory/or/file",
"@my_module" : "lib/some-file.js",
"something" : "src/foo", // Or without @. Actually, it could be any string
}
// Custom module directories, just like `node_modules` but with your private modules (optional)
"_moduleDirectories": ["node_modules_custom"],
```
Then add this line at the very main file of your app, before any code
```js
require('module-alias/register')
```
**And you're all set!** Now you can do stuff like:
```js
require('something')
const module = require('@root/some-module')
const veryDeepModule = require('@deep/my-module')
const customModule = require('my_private_module') // module from `node_modules_custom` directory
// Or ES6
import 'something'
import module from '@root/some-module'
import veryDeepModule from '@deep/my-module'
import customModule from 'my_private_module' // module from `node_modules_custom` directory
```
## Advanced usage
If you don't want to modify your `package.json` or you just prefer to set it all up programmatically, then the following methods are available for you:
* `addAlias('alias', 'target_path')` - register a single alias
* `addAliases({ 'alias': 'target_path', ... }) ` - register multiple aliases
* `addPath(path)` - Register custom modules directory (like node_modules, but with your own modules)
_Examples:_
```js
const moduleAlias = require('module-alias')
//
// Register alias
//
moduleAlias.addAlias('@client', __dirname + '/src/client')
// Or multiple aliases
moduleAlias.addAliases({
'@root' : __dirname,
'@client': __dirname + '/src/client',
...
})
// Custom handler function (starting from v2.1)
moduleAlias.addAlias('@src', (fromPath, request, alias) => {
// fromPath - Full path of the file from which `require` was called
// request - The path (first argument) that was passed into `require`
// alias - The same alias that was passed as first argument to `addAlias` (`@src` in this case)
// Return any custom target path for the `@src` alias depending on arguments
if (fromPath.startsWith(__dirname + '/others')) return __dirname + '/others'
return __dirname + '/src'
})
//
// Register custom modules directory
//
moduleAlias.addPath(__dirname + '/node_modules_custom')
moduleAlias.addPath(__dirname + '/src')
//
// Import settings from a specific package.json
//
moduleAlias(__dirname + '/package.json')
// Or let module-alias to figure where your package.json is
// located. By default it will look in the same directory
// where you have your node_modules (application's root)
moduleAlias()
```
## Usage with WebPack
Luckily, WebPack has a built in support for aliases and custom modules directories so it's easy to make it work on the client side as well!
```js
// webpack.config.js
const npm_package = require('./package.json')
module.exports = {
entry: { ... },
resolve: {
root: __dirname,
alias: npm_package._moduleAliases || {},
modules: npm_package._moduleDirectories || [] // eg: ["node_modules", "node_modules_custom", "src"]
}
}
```
## 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.
[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.

224
node_modules/module-alias/index.js generated vendored Normal file
View File

@@ -0,0 +1,224 @@
'use strict'
var BuiltinModule = require('module')
// Guard against poorly mocked module constructors
var Module = module.constructor.length > 1
? module.constructor
: BuiltinModule
var nodePath = require('path')
var modulePaths = []
var moduleAliases = {}
var moduleAliasNames = []
var oldNodeModulePaths = Module._nodeModulePaths
Module._nodeModulePaths = function (from) {
var paths = oldNodeModulePaths.call(this, from)
// Only include the module path for top-level modules
// that were not installed:
if (from.indexOf('node_modules') === -1) {
paths = modulePaths.concat(paths)
}
return paths
}
var oldResolveFilename = Module._resolveFilename
Module._resolveFilename = function (request, parentModule, isMain, options) {
for (var i = moduleAliasNames.length; i-- > 0;) {
var alias = moduleAliasNames[i]
if (isPathMatchesAlias(request, alias)) {
var aliasTarget = moduleAliases[alias]
// Custom function handler
if (typeof moduleAliases[alias] === 'function') {
var fromPath = parentModule.filename
aliasTarget = moduleAliases[alias](fromPath, request, alias)
if (!aliasTarget || typeof aliasTarget !== 'string') {
throw new Error('[module-alias] Expecting custom handler function to return path.')
}
}
request = nodePath.join(aliasTarget, request.substr(alias.length))
// Only use the first match
break
}
}
return oldResolveFilename.call(this, request, parentModule, isMain, options)
}
function isPathMatchesAlias (path, alias) {
// Matching /^alias(\/|$)/
if (path.indexOf(alias) === 0) {
if (path.length === alias.length) return true
if (path[alias.length] === '/') return true
}
return false
}
function addPathHelper (path, targetArray) {
path = nodePath.normalize(path)
if (targetArray && targetArray.indexOf(path) === -1) {
targetArray.unshift(path)
}
}
function removePathHelper (path, targetArray) {
if (targetArray) {
var index = targetArray.indexOf(path)
if (index !== -1) {
targetArray.splice(index, 1)
}
}
}
function addPath (path) {
var parent
path = nodePath.normalize(path)
if (modulePaths.indexOf(path) === -1) {
modulePaths.push(path)
// Enable the search path for the current top-level module
var mainModule = getMainModule()
if (mainModule) {
addPathHelper(path, mainModule.paths)
}
parent = module.parent
// Also modify the paths of the module that was used to load the
// app-module-paths module and all of it's parents
while (parent && parent !== mainModule) {
addPathHelper(path, parent.paths)
parent = parent.parent
}
}
}
function addAliases (aliases) {
for (var alias in aliases) {
addAlias(alias, aliases[alias])
}
}
function addAlias (alias, target) {
moduleAliases[alias] = target
// Cost of sorting is lower here than during resolution
moduleAliasNames = Object.keys(moduleAliases)
moduleAliasNames.sort()
}
/**
* Reset any changes maded (resets all registered aliases
* and custom module directories)
* The function is undocumented and for testing purposes only
*/
function reset () {
var mainModule = getMainModule()
// Reset all changes in paths caused by addPath function
modulePaths.forEach(function (path) {
if (mainModule) {
removePathHelper(path, mainModule.paths)
}
// Delete from require.cache if the module has been required before.
// This is required for node >= 11
Object.getOwnPropertyNames(require.cache).forEach(function (name) {
if (name.indexOf(path) !== -1) {
delete require.cache[name]
}
})
var parent = module.parent
while (parent && parent !== mainModule) {
removePathHelper(path, parent.paths)
parent = parent.parent
}
})
modulePaths = []
moduleAliases = {}
moduleAliasNames = []
}
/**
* Import aliases from package.json
* @param {object} options
*/
function init (options) {
if (typeof options === 'string') {
options = { base: options }
}
options = options || {}
var candidatePackagePaths
if (options.base) {
candidatePackagePaths = [nodePath.resolve(options.base.replace(/\/package\.json$/, ''))]
} else {
// There is probably 99% chance that the project root directory in located
// above the node_modules directory,
// Or that package.json is in the node process' current working directory (when
// running a package manager script, e.g. `yarn start` / `npm run start`)
candidatePackagePaths = [nodePath.join(__dirname, '../..'), process.cwd()]
}
var npmPackage
var base
for (var i in candidatePackagePaths) {
try {
base = candidatePackagePaths[i]
npmPackage = require(nodePath.join(base, 'package.json'))
break
} catch (e) {
// noop
}
}
if (typeof npmPackage !== 'object') {
var pathString = candidatePackagePaths.join(',\n')
throw new Error('Unable to find package.json in any of:\n[' + pathString + ']')
}
//
// Import aliases
//
var aliases = npmPackage._moduleAliases || {}
for (var alias in aliases) {
if (aliases[alias][0] !== '/') {
aliases[alias] = nodePath.join(base, aliases[alias])
}
}
addAliases(aliases)
//
// Register custom module directories (like node_modules)
//
if (npmPackage._moduleDirectories instanceof Array) {
npmPackage._moduleDirectories.forEach(function (dir) {
if (dir === 'node_modules') return
var modulePath = nodePath.join(base, dir)
addPath(modulePath)
})
}
}
function getMainModule () {
return require.main._simulateRepl ? undefined : require.main
}
module.exports = init
module.exports.addPath = addPath
module.exports.addAlias = addAlias
module.exports.addAliases = addAliases
module.exports.isPathMatchesAlias = isPathMatchesAlias
module.exports.reset = reset

76
node_modules/module-alias/package.json generated vendored Normal file
View File

@@ -0,0 +1,76 @@
{
"_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",
"author": {
"name": "Nick Gavrilov",
"email": "artnikpro@gmail.com"
},
"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",
"node",
"path",
"resolve"
],
"license": "MIT",
"main": "index.js",
"name": "module-alias",
"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"
},
"version": "2.2.2"
}

1
node_modules/module-alias/register.js generated vendored Normal file
View File

@@ -0,0 +1 @@
require('.')()