Initial commit
This commit is contained in:
710
node_modules/config/History.md
generated
vendored
Normal file
710
node_modules/config/History.md
generated
vendored
Normal file
@@ -0,0 +1,710 @@
|
||||
Beyond 3.3.7
|
||||
============
|
||||
We've moved this content to [Github Releases](https://github.com/node-config/node-config/releases).
|
||||
|
||||
Future release notes are managed there.
|
||||
|
||||
3.3.7 / 2022-01-11
|
||||
==================
|
||||
|
||||
* No new changes. 3.3.6 was not published to NPM in versioning mix-up.
|
||||
* Release notes are moving to Github Releases page going forward.
|
||||
|
||||
3.3.6 / 2021-03-08
|
||||
==================
|
||||
|
||||
* Added publishConfig element to package.json to prevent publishing to the wrong repository - @lorenwest
|
||||
|
||||
3.3.5 / 2021-03-05
|
||||
==================
|
||||
|
||||
* FIX [#628](https://github.com/node-config/node-config/issues/628) Uncaught ReferenceError: node_env_var_name is not defined @prnake
|
||||
|
||||
3.3.4 / 2021-02-26
|
||||
==================
|
||||
|
||||
* FIX #517 0 loadFileConfigs incorrectly adds to getConfigSources @NguyenMatthieu
|
||||
|
||||
3.3.3 / 2020-11-26
|
||||
==================
|
||||
|
||||
* FIX #460 - Strict mode warning refer to appropriate env variable @iCodeOkay
|
||||
* Use Buffer.alloc and Buffer.from instead of contrsuctor @Fcmam5
|
||||
* Add support for experimental .cjs modules @lenkan
|
||||
|
||||
|
||||
3.3.2 / 2020-09-24
|
||||
==================
|
||||
|
||||
* Fixed issue with Buffers in config throwing error in util.makeImmutable (#608) - Michal Wadas
|
||||
* Added boolean and numeric types to custom environment variables - Ankur Narkhede @ankurnarkhede
|
||||
|
||||
3.3.1 / 2020-03-25
|
||||
==================
|
||||
|
||||
* Fix security vulnerability in json5 dependency - @twkel
|
||||
|
||||
3.3.0 / 2020-02-26
|
||||
==================
|
||||
|
||||
* Allow all defined values in `substituteDeep` - @fostyfost
|
||||
|
||||
3.2.6 / 2020-02-21
|
||||
==================
|
||||
|
||||
* Updated copyright date ranges
|
||||
|
||||
3.2.5 / 2020-01-16
|
||||
==================
|
||||
|
||||
* Fixed issue with getCustomEnvVars and multiple config dirs #585 - @dekelev
|
||||
|
||||
3.2.4 / 2019-10-25
|
||||
==================
|
||||
|
||||
* Improved error handling of env variables value parse - @leonardovillela
|
||||
|
||||
3.2.3 / 2019-10-03
|
||||
==================
|
||||
|
||||
* Fixed strict mode warning #460 - @fedulovivan
|
||||
|
||||
3.2.2 / 2019-07-20
|
||||
==================
|
||||
|
||||
* Fixed delimiter bug in configDirs to match O/S delimiter - @iMoses
|
||||
|
||||
3.2.1 / 2019-07-18
|
||||
==================
|
||||
|
||||
* Fixed TypeError: obj.toString is not a function - @leosuncin
|
||||
|
||||
3.2.0 / 2019-07-11
|
||||
==================
|
||||
|
||||
* Asynchronous configs - @iMoses
|
||||
* Multiple config directories - @iMoses
|
||||
* Improved parser support - @iMoses
|
||||
|
||||
3.1.0 / 2019-04-07
|
||||
==================
|
||||
|
||||
* Support of module.exports syntax for TS config files @keenondrums
|
||||
|
||||
3.0.1 / 2018-12-16
|
||||
==================
|
||||
|
||||
* Fixed bug where dot notation extended own key @exogen
|
||||
|
||||
3.0.0 / 2018-11-20
|
||||
==================
|
||||
|
||||
* Ensure config array items and objects are sealed @fgheorghe
|
||||
- This required a major version bump in case someone
|
||||
- relied on the ability to mutate non-sealed data.
|
||||
|
||||
|
||||
2.0.2 / 2018-08-28
|
||||
==================
|
||||
|
||||
* Added dot notation to setModuleDefaults - bertho-zero
|
||||
* Updated copyright year - JemiloII
|
||||
|
||||
2.0.1 / 2018-07-26
|
||||
==================
|
||||
|
||||
* Removed deprecated code - jpwilliams
|
||||
|
||||
2.0.0 / 2018-07-26
|
||||
==================
|
||||
|
||||
Potential for backward incompatibility requiring a major version bump.
|
||||
|
||||
Safe to upgrade to major version 2 if you're using a recent NodeJS version
|
||||
and you're not trying to mutate config arrays.
|
||||
|
||||
* Added array immutability - jacobemerick
|
||||
* Removed Node V.4 support
|
||||
|
||||
1.31.0 / 2018-05-22
|
||||
===================
|
||||
|
||||
* Load new coffeescript module instead of coffee-script - bastbijl
|
||||
|
||||
1.30.0 / 2018-02-26
|
||||
===================
|
||||
|
||||
* Support for nested raw() in javascript configurations - patrickpilch
|
||||
|
||||
1.29.4 / 2018-02-03
|
||||
===================
|
||||
|
||||
* Re-publish - last changes didn't make it to npm
|
||||
|
||||
1.29.3 / 2018-02-03
|
||||
===================
|
||||
|
||||
* Added soft dependencies so transpilers don't include everything - gewentao
|
||||
|
||||
1.29.2 / 2018-01-12
|
||||
===================
|
||||
|
||||
* Patch, and added a test to ts-node - electroma
|
||||
|
||||
1.29.1 / 2018-01-07
|
||||
===================
|
||||
|
||||
* Prevent re-registration of ts-node - electroma
|
||||
* Fixed bug in contributor table tool - lorenwest
|
||||
|
||||
1.29.0 / 2017-12-26
|
||||
===================
|
||||
|
||||
* Update docs for JavaScript-formatted config files and link them from the README - markstos
|
||||
* Fixed 'hostname' value selection when there is no environment variable for that - wmangelardo
|
||||
|
||||
|
||||
1.28.1 / 2017-11-09
|
||||
===================
|
||||
|
||||
* add nodejs9 to travisci - jfelege
|
||||
|
||||
1.28.0 / 2017-11-07
|
||||
===================
|
||||
|
||||
* allow overrides of `NODE_ENV` with `NODE_CONFIG_ENV` - jfelege
|
||||
|
||||
1.27.0 / 2017-10-17
|
||||
===================
|
||||
|
||||
* Add method to output plain JS object - willsoto
|
||||
* Updated Node versions in Travis CI - lorenwest
|
||||
|
||||
1.26.2 / 2017-08-11
|
||||
===================
|
||||
|
||||
* Update supported nodejs platforms - jfelege
|
||||
|
||||
1.26.1 / 2017-05-03
|
||||
===================
|
||||
|
||||
* Fix: failed while merging from RegExp @XadillaX
|
||||
* Chore: reduce package size. @evilebottnawi
|
||||
|
||||
1.26.0 / 2017-03-30
|
||||
===================
|
||||
|
||||
* Added tests for extendDeep @IvanVergiliev
|
||||
* Added TypeScript support @cypherq
|
||||
* Update config.js with correctly cased type def @ScionOfBytes
|
||||
|
||||
1.25.1 / 2017-02-01
|
||||
===================
|
||||
|
||||
* Fixed undefined CONFIG_SKIP_GITCRYPT variable @lorenwest
|
||||
|
||||
1.25.0 / 2017-01-31
|
||||
===================
|
||||
|
||||
* Add support for configuration files stored with git-crypt @cunneen
|
||||
|
||||
1.24.0 / 2016-11-02
|
||||
===================
|
||||
|
||||
* Prevent accidental publish to private repository
|
||||
|
||||
1.23.0 / 2016-11-02
|
||||
===================
|
||||
|
||||
* Re-publishing because npmjs didn't see 1.22
|
||||
|
||||
1.22.0 / 2016-10-25
|
||||
===================
|
||||
|
||||
* original/previous value for deferredConfig @simon-scherzinger
|
||||
* util.loadFileConfigs: support optional source dir @wmertens
|
||||
* Adding raw wrapper to prevent object modification in config @patrickpilch
|
||||
|
||||
1.21.0 / 2016-06-01
|
||||
===================
|
||||
|
||||
* Added XML configuration @tusharmath
|
||||
|
||||
1.20.4 / 2016-05-23
|
||||
===================
|
||||
|
||||
* Fixed a regression with extending prototype methods @tahoemph
|
||||
|
||||
1.20.3 / 2016-05-18
|
||||
===================
|
||||
|
||||
* Fixed a regression with 1.20.2 @kgoerlitz
|
||||
* Added test to prevent this in the future @kgoerlitz
|
||||
|
||||
1.20.2 / 2016-05-17
|
||||
===================
|
||||
|
||||
* node v6 compatiblity: remove deprecated __lookupGetter__ use - @thetalecrafter
|
||||
* node v6 compatiblity: handle different SyntaxError format - @pwwolf
|
||||
|
||||
1.20.1 / 2016-04-08
|
||||
===================
|
||||
|
||||
* Simplify truthiness check - @markstos
|
||||
* Remove errant console.log - @markstos
|
||||
|
||||
1.20.0 / 2016-04-06
|
||||
===================
|
||||
|
||||
* Typo fix @jchip
|
||||
* Handle null sub-object @wmertens
|
||||
* Bug fix for NODE_CONFIG_STRICT_MODE check @markstos
|
||||
* Ran node security check on 4/6/2016 with the following output
|
||||
|
||||
$ nsp check
|
||||
(+) No known vulnerabilities found
|
||||
|
||||
1.19.0 / 2016-01-08
|
||||
===================
|
||||
|
||||
* Resolve defered values in predictable order for consistent results.
|
||||
Fixes #265 @elliotttf @markstos
|
||||
|
||||
1.18.0 / 2015-11-17
|
||||
===================
|
||||
|
||||
* More robust handling of JSON @elliotttf
|
||||
|
||||
1.17.1 / 2015-11-17
|
||||
===================
|
||||
|
||||
* Patch release for regex bugfix
|
||||
|
||||
1.17.0 / 2015-11-17
|
||||
===================
|
||||
|
||||
* Update warning about missing configuration files to mention how to disable the warning #245 @markstos
|
||||
* Upgrade to run CI with travis containers @lorenwest
|
||||
* Fixed bug with comments and inline json @elliotttf
|
||||
|
||||
1.16.0 / 2015-09-03
|
||||
===================
|
||||
|
||||
* Change == to === to tighten equality tests #242 @wgpsutherland
|
||||
* Fix attachProtoDeep for setModuleDefaults #243 @benkroeger
|
||||
|
||||
1.15.0 / 2015-07-30
|
||||
===================
|
||||
|
||||
* Added full hostname in addition to first segment @vicary
|
||||
|
||||
1.14.0 / 2015-06-02
|
||||
===================
|
||||
|
||||
* Added JSON parsing to custom environment variables @leachiM2k
|
||||
* Handle unicode BOM characters @johndkane
|
||||
|
||||
1.13.0 / 2015-05-05
|
||||
===================
|
||||
|
||||
* Updated CSON library @dsimidzija
|
||||
|
||||
1.12.0 / 2015-02-19
|
||||
===================
|
||||
|
||||
* Better date merging @axelhzf
|
||||
|
||||
1.11.0 / 2015-01-14
|
||||
===================
|
||||
|
||||
* Added Hjson support @laktak
|
||||
|
||||
1.10.0 / 2015-01-06
|
||||
===================
|
||||
|
||||
* Added TOML support (@jasonhansel)
|
||||
* Another year - changed copyright messages for 2015
|
||||
* Updated contributors list
|
||||
* New Strict Mode added in 1.9.0 is now documented. (@markstos)
|
||||
* has() now returns false when given an undefined or null key to look up. Previously it threw an exception. (@markstos)
|
||||
* When get() is given an undefined or null key to look up, it now throws a more helpful diagnostic (@robludwig, @markstos)
|
||||
|
||||
1.9.0 / 2014-12-08
|
||||
==================
|
||||
|
||||
* New strictness checks have been added to ensure the expected configuration has been loaded. Warnings are now thrown in these cases. If NODE_CONFIG_STRICT_MODE is set, exceptions are thrown instead. (@markstos)
|
||||
* There must be an explicit config file matching `NODE_ENV` if `NODE_ENV` is set.
|
||||
* There must be an explicit config file matching `NODE_APP_INSTANCE` if `NODE_APP_INSTANCE` is set
|
||||
* `NODE_ENV` must not match 'default' or 'local' to avoid ambiguity.
|
||||
|
||||
* Added .iced extension support (@arthanzel)
|
||||
|
||||
* Highlight `config.has()` in the README. Use it to check to if a value exists, since `config.get()`
|
||||
throws exceptions on undefined values. (@markstos)
|
||||
|
||||
* API Change: getConfigSources() now starts to return data on config files that are valid-but-empty. (@markstos)
|
||||
|
||||
1.8.1 / 2014-11-14
|
||||
==================
|
||||
|
||||
* Simplify syntax for defer() functions. The 'this' value in the functions is now bound
|
||||
to the main configuration object, so it doesn't have to be passed into the function. (@markstos)
|
||||
* new defer sub-module introduced in 1.8.0 can now be accessed by require('config/defer')
|
||||
For usage, see: https://github.com/node-config/node-config/wiki/Configuration-Files#javascript-module---js
|
||||
* Add test coverage for array merging cases. (@markstos)
|
||||
* Bump dependency on cson package to 1.6.1 (@markstos)
|
||||
|
||||
1.8.0 / 2014-11-13
|
||||
==================
|
||||
|
||||
* Added deferred function for evaluating configs after load (@markstos)
|
||||
For details, see: https://github.com/node-config/node-config/wiki/Configuration-Files#javascript-module---js
|
||||
* Bumped js-yaml dependency (@markstos)
|
||||
|
||||
1.7.0 / 2014-10-30
|
||||
==================
|
||||
|
||||
* Added variable substitution in .properties files (@ncuillery)
|
||||
|
||||
1.6.0 / 2014-10-22
|
||||
==================
|
||||
|
||||
* Added support for property accessors in configs (@jaylynch)
|
||||
|
||||
1.5.0 / 2014-10-20
|
||||
==================
|
||||
|
||||
* Added support for .json5 config files (@bertrandom)
|
||||
|
||||
1.4.0 / 2014-10-16
|
||||
==================
|
||||
|
||||
* Added support for .properties config files (@superoven)
|
||||
|
||||
1.3.0 / 2014-10-15
|
||||
==================
|
||||
|
||||
* Added support for CSON configuration files (@superoven)
|
||||
|
||||
1.2.4 / 2014-10-10
|
||||
==================
|
||||
|
||||
* Repaired the 1.2.3 fix to work both before and after the first get()
|
||||
|
||||
1.2.3 / 2014-10-03
|
||||
==================
|
||||
|
||||
* Changed test suite to verify a bug in util.setModuleDefaults()
|
||||
* Fixed util.setModuleDefaults() to work after a get() (and pass the new test)
|
||||
|
||||
1.2.2 / 2014-10-03
|
||||
==================
|
||||
|
||||
* Added support for regexp and date configurations (@diversario)
|
||||
|
||||
1.2.1 / 2014-09-23
|
||||
==================
|
||||
|
||||
* Wrote test to prove setModuleDefaults() was broken in 1.2.0
|
||||
* Fixed setModuleDefaults() to not rely on immutable configs
|
||||
|
||||
1.2.0 / 2014-09-15
|
||||
==================
|
||||
|
||||
* Feature release
|
||||
* Delaying immutability until after first get() - for external configs
|
||||
* Allowing immutability override with $ALLOW_CONFIG_MUTATIONS=Y
|
||||
|
||||
|
||||
1.1.1 / 2014-09-03
|
||||
==================
|
||||
|
||||
* @th507 - Update support for Coffee-script >=1.7.0
|
||||
|
||||
1.1.0 / 2014-09-03
|
||||
==================
|
||||
|
||||
* Feature release
|
||||
* @bradboro - Custom environment variables
|
||||
* @supersheep - Catch error when requiring visionmedia yaml module
|
||||
|
||||
1.0.2 / 2014-07-30
|
||||
===================
|
||||
|
||||
* @bradobro - Fixed a variable from leaking into global
|
||||
* @tilfin - Removed un-necessary YAML comment filtering for js-yaml
|
||||
|
||||
1.0.1 / 2014-07-25
|
||||
===================
|
||||
|
||||
* Removed test directory from npm install
|
||||
|
||||
1.0.0 / 2014-07-23
|
||||
===================
|
||||
|
||||
* Major revision. Upgrade notes:
|
||||
https://github.com/node-config/node-config/wiki/Upgrading-From-Config-0.x
|
||||
* Update to semver versioning
|
||||
* Change load ordering
|
||||
from hostname.EXT --> deployment.EXT
|
||||
to deployment.EXT --> hostname.EXT
|
||||
* Allow makeImmutable to accept an array of attributes
|
||||
* Allow makeImmutable to accept no attrs, making all attributes immutable
|
||||
* Allow recursion in makeImmutable, if an attribute is an object
|
||||
* Change node-config behavior to make all configurations immutable
|
||||
* Removed getOriginalConfig as no longer necessary post-immutable
|
||||
* Removed runtime.json file writing and monitoring
|
||||
* Removed previously deprecated $CONFIG_* environment configurations
|
||||
* Deprecated the attribute watch functionality
|
||||
* Added error output if no configurations found
|
||||
* Exposed config loading for alternate configurations
|
||||
* Added config.get() and config.has() methods & tests
|
||||
* Removed reliance on global.NODE_CONFIG so older versions can work with 1.x
|
||||
* Fix empty YAML file causing crash with latest js-yaml
|
||||
* Added SUPPRESS_NO_CONFIG_WARNING for better sub-module support
|
||||
* Moved all documentation [to the wiki](https://github.com/node-config/node-config/wiki).
|
||||
|
||||
0.4.37 / 2014-07-22
|
||||
===================
|
||||
|
||||
* Fix empty YAML file causing crash with latest js-yaml
|
||||
|
||||
0.4.36 / 2014-05-27
|
||||
===================
|
||||
|
||||
* Not writing runtime.json if not used
|
||||
|
||||
0.4.35 / 2014-01-16
|
||||
===================
|
||||
|
||||
* NODE_CONFIG_DIR can now contain a relative path for .js and .coffee configurations
|
||||
|
||||
0.4.34 / 2014-01-06
|
||||
===================
|
||||
|
||||
* Updated copyright year
|
||||
|
||||
0.4.33 / 2013-10-25
|
||||
===================
|
||||
|
||||
* Assure writes to runtime.json are atomic
|
||||
|
||||
0.4.32 / 2013-10-24
|
||||
===================
|
||||
|
||||
* Don't freak out if running without a config directory
|
||||
* Don't be so chatty if runtime.json doesn't exist
|
||||
|
||||
0.4.31 / 2013-10-18
|
||||
===================
|
||||
|
||||
* Changed getConfigSources to copy array vs. object
|
||||
|
||||
0.4.30 / 2013-09-12
|
||||
===================
|
||||
|
||||
* More consistent array extension
|
||||
* No longer requiring a config directory
|
||||
* Not erroneously writing runtime.json
|
||||
* Exposing the original configuration sources
|
||||
* Added --NODE_CONFIG={json} command line overrides
|
||||
* Added $NODE_CONFIG={json} environment variable overrides
|
||||
* Consistent handling of environment variables and command line parameters
|
||||
* Reached 100 regression tests
|
||||
|
||||
0.4.29 / 2013-08-07
|
||||
===================
|
||||
|
||||
* Added flag for disabling the write of runtime.json
|
||||
|
||||
0.4.28 / 2013-07-31
|
||||
===================
|
||||
|
||||
* Eliminated a totally annoying install warning in newer versions of NPM
|
||||
|
||||
0.4.27 / 2013-06-18
|
||||
===================
|
||||
|
||||
* Fixed a bug preventing double underscores in config environment variables
|
||||
|
||||
0.4.26 / 2013-06-10
|
||||
===================
|
||||
|
||||
* Re-watch file on rename (allows editing runtime.json with vi)
|
||||
* Allow runtime.json file watch disable via NODE_CONFIG_DISABLE_FILE_WATCH=Y
|
||||
* Change no yaml parser error message to suggest using js-yaml
|
||||
* Changed default clone depth from 6 to 20 to allow for deeper configurations
|
||||
|
||||
0.4.25 / 2013-05-24
|
||||
===================
|
||||
|
||||
* Dont fail if config directory doesnt exist
|
||||
|
||||
0.4.24 / 2013-04-13
|
||||
===================
|
||||
|
||||
* Added resetRuntime() to reset the runtime.json file
|
||||
* Updated docs to reflect the new public method
|
||||
|
||||
0.4.23 / 2013-04-13
|
||||
===================
|
||||
|
||||
* Multiple application instance support via $NODE_APP_INSTANCE
|
||||
* Multi-app testing & documentation
|
||||
|
||||
0.4.22 / 2013-03-29
|
||||
===================
|
||||
|
||||
* Added configuration $CONFIG_* environment variables
|
||||
* Added $CONFIG_* documentation and tests
|
||||
* Added NodeJS 0.10 integration test
|
||||
|
||||
0.4.21 / 2013-03-06
|
||||
===================
|
||||
|
||||
* Triggering file.watch when an editor saves a file - rename vs. change
|
||||
* Installed Travis-CI continuous integration testing framework
|
||||
|
||||
0.4.20 / 2013-02-21
|
||||
===================
|
||||
|
||||
* Merged _diffDeep fix
|
||||
|
||||
0.4.19 / 2013-02-21
|
||||
===================
|
||||
|
||||
* Added discovery of .yml in addition to .yaml for YAML configs (w/doc)
|
||||
* Added testing of .yml file discovery
|
||||
* Removed licensing inconsistencies
|
||||
|
||||
0.4.18 / 2012-10-30
|
||||
===================
|
||||
|
||||
* Moved coffee-script and js-yaml from optionalDependencies back to
|
||||
devDependencies to trim the install size for those not needing
|
||||
these packages.
|
||||
* Promoted $HOSTNAME and $HOST above OS.hostname()
|
||||
|
||||
0.4.17 / 2012-09-26
|
||||
===================
|
||||
|
||||
* Allow the location of runtime.json to be picked up from the environment
|
||||
* Added documentation for the NODE_CONFIG_RUNTIME_JSON environment variable
|
||||
* package.json cleanup - created optionalDependencies and devDependencies
|
||||
|
||||
0.4.16 / 2012-08-09
|
||||
===================
|
||||
|
||||
* Allowing a zero interval in watchForConfigFileChanges() to disable file watching.
|
||||
* Fixed a comparator bug in _equalsDeep()
|
||||
* Added a test to confirm deep extending array functionality
|
||||
|
||||
0.4.15 / 2012-06-04
|
||||
===================
|
||||
|
||||
* Placed YAML and Coffee-Script libraries back into the download. Still lazy loading into memory.
|
||||
|
||||
0.4.14 / 2012-06-01
|
||||
===================
|
||||
|
||||
* Added the local.EXT and local-deployment.EXT configs.
|
||||
* Removed unnecessary debug output
|
||||
* Added retry logic on file parse to reduce read/write collisions
|
||||
* Added support for a better YAML parser
|
||||
* Fixed problems with null configuration values
|
||||
|
||||
0.4.13 / 2012-04-25
|
||||
===================
|
||||
|
||||
* Assuring the runtime.json file exists. Undocumented fs.watch() requirement.
|
||||
|
||||
0.4.12 / 2012-04-25
|
||||
===================
|
||||
|
||||
* Removed all external dependencies
|
||||
* Lazy loading of yaml and coffee-script only if these file types are used
|
||||
* Added new style file watching if available (retaining pre 6.0 compatibility)
|
||||
* Windows compatibility - file watching changes were required
|
||||
|
||||
0.4.11 / 2012-02-15
|
||||
===================
|
||||
|
||||
* Automatically watching runtime.json for changes
|
||||
* Fixed a date comparison bug during file watching
|
||||
* Changed require('sys') to require('util')
|
||||
|
||||
0.4.10 / 2012-01-18
|
||||
===================
|
||||
|
||||
* Made sure the CONFIG object is a shared singleton
|
||||
* Added NODE_CONFIG_DIR environment variable to point to a different directory
|
||||
* Added tests and documentation for the above
|
||||
|
||||
0.4.9 / 2012-01-06
|
||||
==================
|
||||
|
||||
* Added coffee-script file type support with extension .coffee
|
||||
* Added an example coffee-script configuration file
|
||||
* Added coffee-script module dependency
|
||||
* Added a test for coffee-script configuration files
|
||||
* Documented coffee-script support, regenerated documentation
|
||||
|
||||
0.4.8 / 2011-12-20
|
||||
==================
|
||||
|
||||
* Fixed a bug where changes to module default configs weren't persisted
|
||||
* Added a test to validate the bugfix
|
||||
|
||||
0.4.7 / 2011-12-16
|
||||
==================
|
||||
|
||||
* Created the makeHidden method to hide a property of an object
|
||||
* Added a value argument to makeImmutable for creating new properties
|
||||
* Fixed setModuleDefaults to hide injected prototype methods
|
||||
* Added documentation and unit tests
|
||||
|
||||
0.4.6 / 2011-11-29
|
||||
==================
|
||||
|
||||
* Updated vows from 0.5.8 to 0.5.13
|
||||
|
||||
0.4.5 / 2011-11-16
|
||||
==================
|
||||
|
||||
* Updated YAML dependency from "0.1.x" to ">=0.2.2"
|
||||
* Added stripping of comment-only and whitespace-only lines in YAML files for backward compatibility
|
||||
* Added more tests for YAML edge cases
|
||||
* Added a homepage link in package.json to the online documentation
|
||||
* Added History.md
|
||||
|
||||
0.4.4 / 2011-11-08
|
||||
==================
|
||||
|
||||
* Removed deprecated modules from package.json
|
||||
|
||||
0.4.3 / 2011-08-02
|
||||
==================
|
||||
|
||||
* Made watchForConfigFileChanges public
|
||||
|
||||
0.4.2 / 2011-07-11
|
||||
==================
|
||||
|
||||
* Added comment stripping from JSON configuration files
|
||||
|
||||
0.4.1 / 2011-07-07
|
||||
==================
|
||||
|
||||
* Added more tests
|
||||
* Return the module config in setModuleDefaults
|
||||
|
||||
0.4.0 / 2011-07-06
|
||||
==================
|
||||
|
||||
* Update to version 0.4.0
|
||||
|
||||
* Online documentation
|
||||
* Runtime configuration changes
|
||||
* Configuration value watching
|
||||
* Multi-instance node deployments
|
||||
* Better module developer support
|
||||
19
node_modules/config/LICENSE
generated
vendored
Normal file
19
node_modules/config/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// Copyright 2010-2022, Loren West and other contributors
|
||||
|
||||
// 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.
|
||||
176
node_modules/config/README.md
generated
vendored
Normal file
176
node_modules/config/README.md
generated
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
Configure your Node.js Applications
|
||||
===================================
|
||||
|
||||
[](https://nodei.co/npm/config/)
|
||||
[](https://travis-ci.org/lorenwest/node-config)
|
||||
[release notes](https://github.com/node-config/node-config/blob/master/History.md)
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Node-config organizes hierarchical configurations for your app deployments.
|
||||
|
||||
It lets you define a set of default parameters,
|
||||
and extend them for different deployment environments (development, qa,
|
||||
staging, production, etc.).
|
||||
|
||||
Configurations are stored in [configuration files](https://github.com/node-config/node-config/wiki/Configuration-Files) within your application, and can be overridden and extended by [environment variables](https://github.com/lorenwest/node-config/wiki/Environment-Variables),
|
||||
[command line parameters](https://github.com/node-config/node-config/wiki/Command-Line-Overrides), or [external sources](https://github.com/lorenwest/node-config/wiki/Configuring-from-an-External-Source).
|
||||
|
||||
This gives your application a consistent configuration interface shared among a
|
||||
[growing list of npm modules](https://www.npmjs.org/browse/depended/config) also using node-config.
|
||||
|
||||
Project Guidelines
|
||||
------------------
|
||||
|
||||
* *Simple* - Get started fast
|
||||
* *Powerful* - For multi-node enterprise deployment
|
||||
* *Flexible* - Supporting multiple config file formats
|
||||
* *Lightweight* - Small file and memory footprint
|
||||
* *Predictable* - Well tested foundation for module and app developers
|
||||
|
||||
Quick Start
|
||||
---------------
|
||||
The following examples are in JSON format, but configurations can be in other [file formats](https://github.com/node-config/node-config/wiki/Configuration-Files#file-formats).
|
||||
|
||||
**Install in your app directory, and edit the default config file.**
|
||||
|
||||
```shell
|
||||
$ npm install config
|
||||
$ mkdir config
|
||||
$ vi config/default.json
|
||||
```
|
||||
```js
|
||||
{
|
||||
// Customer module configs
|
||||
"Customer": {
|
||||
"dbConfig": {
|
||||
"host": "localhost",
|
||||
"port": 5984,
|
||||
"dbName": "customers"
|
||||
},
|
||||
"credit": {
|
||||
"initialLimit": 100,
|
||||
// Set low for development
|
||||
"initialDays": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Edit config overrides for production deployment:**
|
||||
|
||||
```shell
|
||||
$ vi config/production.json
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Customer": {
|
||||
"dbConfig": {
|
||||
"host": "prod-db-server"
|
||||
},
|
||||
"credit": {
|
||||
"initialDays": 30
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Use configs in your code:**
|
||||
|
||||
```js
|
||||
const config = require('config');
|
||||
//...
|
||||
const dbConfig = config.get('Customer.dbConfig');
|
||||
db.connect(dbConfig, ...);
|
||||
|
||||
if (config.has('optionalFeature.detail')) {
|
||||
const detail = config.get('optionalFeature.detail');
|
||||
//...
|
||||
}
|
||||
```
|
||||
|
||||
`config.get()` will throw an exception for undefined keys to help catch typos and missing values.
|
||||
Use `config.has()` to test if a configuration value is defined.
|
||||
|
||||
**Start your app server:**
|
||||
|
||||
```shell
|
||||
$ export NODE_ENV=production
|
||||
$ node my-app.js
|
||||
```
|
||||
|
||||
Running in this configuration, the `port` and `dbName` elements of `dbConfig`
|
||||
will come from the `default.json` file, and the `host` element will
|
||||
come from the `production.json` override file.
|
||||
|
||||
Articles
|
||||
--------
|
||||
|
||||
* [Configuration Files](https://github.com/node-config/node-config/wiki/Configuration-Files)
|
||||
* [Special features for JavaScript configuration files](https://github.com/node-config/node-config/wiki/Special-features-for-JavaScript-configuration-files)
|
||||
* [Common Usage](https://github.com/node-config/node-config/wiki/Common-Usage)
|
||||
* [Environment Variables](https://github.com/node-config/node-config/wiki/Environment-Variables)
|
||||
* [Reserved Words](https://github.com/node-config/node-config/wiki/Reserved-Words)
|
||||
* [Command Line Overrides](https://github.com/node-config/node-config/wiki/Command-Line-Overrides)
|
||||
* [Multiple Node Instances](https://github.com/node-config/node-config/wiki/Multiple-Node-Instances)
|
||||
* [Sub-Module Configuration](https://github.com/node-config/node-config/wiki/Sub-Module-Configuration)
|
||||
* [Configuring from a DB / External Source](https://github.com/node-config/node-config/wiki/Configuring-from-an-External-Source)
|
||||
* [Securing Production Config Files](https://github.com/node-config/node-config/wiki/Securing-Production-Config-Files)
|
||||
* [External Configuration Management Tools](https://github.com/node-config/node-config/wiki/External-Configuration-Management-Tools)
|
||||
* [Examining Configuration Sources](https://github.com/node-config/node-config/wiki/Examining-Configuration-Sources)
|
||||
* [Using Config Utilities](https://github.com/node-config/node-config/wiki/Using-Config-Utilities)
|
||||
* [Upgrading from Config 0.x](https://github.com/node-config/node-config/wiki/Upgrading-From-Config-0.x)
|
||||
* [Webpack usage](https://github.com/node-config/node-config/wiki/Webpack-Usage)
|
||||
|
||||
Further Information
|
||||
---------------------
|
||||
If you still don't see what you are looking for, here are some more resources to check:
|
||||
|
||||
* The [wiki may have more pages](https://github.com/node-config/node-config/wiki) which are not directly linked from here.
|
||||
* Review [questions tagged with node-config](https://stackexchange.com/filters/207096/node-config) on StackExchange. These are monitored by `node-config` contributors.
|
||||
* [Search the issue tracker](https://github.com/node-config/node-config/issues). Hundreds of issues have already been discussed and resolved there.
|
||||
|
||||
Contributors
|
||||
------------
|
||||
<table id="contributors"><tr><td><img src=https://avatars.githubusercontent.com/u/373538?v=4><a href="https://github.com/lorenwest">lorenwest</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/25829?v=4><a href="https://github.com/markstos">markstos</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/1083065?v=4><a href="https://github.com/iMoses">iMoses</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/447151?v=4><a href="https://github.com/elliotttf">elliotttf</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/8839447?v=4><a href="https://github.com/jfelege">jfelege</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/66902?v=4><a href="https://github.com/leachiM2k">leachiM2k</a></td>
|
||||
</tr><tr><td><img src=https://avatars.githubusercontent.com/u/791137?v=4><a href="https://github.com/josx">josx</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/133277?v=4><a href="https://github.com/enyo">enyo</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/4307697?v=4><a href="https://github.com/leosuncin">leosuncin</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/1077378?v=4><a href="https://github.com/arthanzel">arthanzel</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/1656140?v=4><a href="https://github.com/eheikes">eheikes</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/138707?v=4><a href="https://github.com/th507">th507</a></td>
|
||||
</tr><tr><td><img src=https://avatars.githubusercontent.com/u/506460?v=4><a href="https://github.com/Osterjour">Osterjour</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/1751645?v=4><a href="https://github.com/cunneen">cunneen</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/842998?v=4><a href="https://github.com/nsabovic">nsabovic</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/5138570?v=4><a href="https://github.com/BadgerBadgerBadgerBadger">BadgerBadgerBadgerBadger</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/2529835?v=4><a href="https://github.com/simon-scherzinger">simon-scherzinger</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/8650543?v=4><a href="https://github.com/leonardovillela">leonardovillela</a></td>
|
||||
</tr><tr><td><img src=https://avatars.githubusercontent.com/u/175627?v=4><a href="https://github.com/axelhzf">axelhzf</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/7782055?v=4><a href="https://github.com/benkroeger">benkroeger</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/1872824?v=4><a href="https://github.com/fgheorghe">fgheorghe</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/1443067?v=4><a href="https://github.com/IvanVergiliev">IvanVergiliev</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/1736957?v=4><a href="https://github.com/jpwilliams">jpwilliams</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/1246875?v=4><a href="https://github.com/jaylynch">jaylynch</a></td>
|
||||
</tr><tr><td><img src=https://avatars.githubusercontent.com/u/145742?v=4><a href="https://github.com/jberrisch">jberrisch</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/9355665?v=4><a href="https://github.com/kgoerlitz">kgoerlitz</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/8525267?v=4><a href="https://github.com/bertho-zero">bertho-zero</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/6686044?v=4><a href="https://github.com/NguyenMatthieu">NguyenMatthieu</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/1918551?v=4><a href="https://github.com/nitzan-shaked">nitzan-shaked</a></td>
|
||||
<td><img src=https://avatars.githubusercontent.com/u/3058150?v=4><a href="https://github.com/robertrossmann">robertrossmann</a></td>
|
||||
</tr></table>
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
May be freely distributed under the [MIT license](https://raw.githubusercontent.com/node-config/node-config/master/LICENSE).
|
||||
|
||||
Copyright (c) 2010-2022 Loren West
|
||||
[and other contributors](https://github.com/node-config/node-config/graphs/contributors)
|
||||
|
||||
70
node_modules/config/async.js
generated
vendored
Normal file
70
node_modules/config/async.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
var asyncSymbol = Symbol('asyncSymbol');
|
||||
var deferConfig = require('./defer').deferConfig;
|
||||
|
||||
/**
|
||||
* @param promiseOrFunc the promise will determine a property's value once resolved
|
||||
* can also be a function to defer which resolves to a promise
|
||||
* @returns {Promise} a marked promise to be resolve later using `resolveAsyncConfigs`
|
||||
*/
|
||||
function asyncConfig(promiseOrFunc) {
|
||||
if (typeof promiseOrFunc === 'function') { // also acts as deferConfig
|
||||
return deferConfig(function (config, original) {
|
||||
var release;
|
||||
function registerRelease(resolve) { release = resolve; }
|
||||
function callFunc() { return promiseOrFunc.call(config, config, original); }
|
||||
var promise = asyncConfig(new Promise(registerRelease).then(callFunc));
|
||||
promise.release = release;
|
||||
return promise;
|
||||
});
|
||||
}
|
||||
var promise = promiseOrFunc;
|
||||
promise.async = asyncSymbol;
|
||||
promise.prepare = function(config, prop, property) {
|
||||
if (promise.release) {
|
||||
promise.release();
|
||||
}
|
||||
return function() {
|
||||
return promise.then(function(value) {
|
||||
Object.defineProperty(prop, property, {value: value});
|
||||
});
|
||||
};
|
||||
};
|
||||
return promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not use `config.get` before executing this method, it will freeze the config object
|
||||
* @param config the main config object, returned from require('config')
|
||||
* @returns {Promise<config>} once all promises are resolved, return the original config object
|
||||
*/
|
||||
function resolveAsyncConfigs(config) {
|
||||
var promises = [];
|
||||
var resolvers = [];
|
||||
(function iterate(prop) {
|
||||
var propsToSort = [];
|
||||
for (var property in prop) {
|
||||
if (Object.hasOwnProperty.call(prop, property) && prop[property] != null) {
|
||||
propsToSort.push(property);
|
||||
}
|
||||
}
|
||||
propsToSort.sort().forEach(function(property) {
|
||||
if (prop[property].constructor === Object) {
|
||||
iterate(prop[property]);
|
||||
}
|
||||
else if (prop[property].constructor === Array) {
|
||||
prop[property].forEach(iterate);
|
||||
}
|
||||
else if (prop[property] && prop[property].async === asyncSymbol) {
|
||||
resolvers.push(prop[property].prepare(config, prop, property));
|
||||
promises.push(prop[property]);
|
||||
}
|
||||
});
|
||||
})(config);
|
||||
return Promise.all(promises).then(function() {
|
||||
resolvers.forEach(function(resolve) { resolve(); });
|
||||
return config;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.asyncConfig = asyncConfig;
|
||||
module.exports.resolveAsyncConfigs = resolveAsyncConfigs;
|
||||
23
node_modules/config/defer.js
generated
vendored
Normal file
23
node_modules/config/defer.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
// Create a deferredConfig prototype so that we can check for it when reviewing the configs later.
|
||||
function DeferredConfig() {}
|
||||
DeferredConfig.prototype.prepare = function() {};
|
||||
DeferredConfig.prototype.resolve = function() {};
|
||||
|
||||
// Accept a function that we'll use to resolve this value later and return a 'deferred' configuration value to resolve it later.
|
||||
function deferConfig(func) {
|
||||
var obj = Object.create(DeferredConfig.prototype);
|
||||
obj.prepare = function(config, prop, property) {
|
||||
var original = prop[property]._original;
|
||||
obj.resolve = function() {
|
||||
var value = func.call(config, config, original);
|
||||
Object.defineProperty(prop, property, {value: value});
|
||||
return value;
|
||||
};
|
||||
Object.defineProperty(prop, property, {get: function() { return obj.resolve(); }});
|
||||
return obj;
|
||||
};
|
||||
return obj;
|
||||
}
|
||||
|
||||
module.exports.deferConfig = deferConfig;
|
||||
module.exports.DeferredConfig = DeferredConfig;
|
||||
1521
node_modules/config/lib/config.js
generated
vendored
Normal file
1521
node_modules/config/lib/config.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
52
node_modules/config/package.json
generated
vendored
Normal file
52
node_modules/config/package.json
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "config",
|
||||
"version": "3.3.9",
|
||||
"main": "./lib/config.js",
|
||||
"description": "Configuration control for production node deployments",
|
||||
"author": "Loren West <open_source@lorenwest.com>",
|
||||
"homepage": "http://github.com/node-config/node-config.git",
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"keywords": [
|
||||
"conf",
|
||||
"config",
|
||||
"configuration",
|
||||
"node-config",
|
||||
"config-node",
|
||||
"env",
|
||||
"environment"
|
||||
],
|
||||
"directories": {
|
||||
"lib": "./lib"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"json5": "^2.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^7.0.8",
|
||||
"coffeescript": "2.2.4",
|
||||
"cson": "^3.0.1",
|
||||
"hjson": "^1.2.0",
|
||||
"js-yaml": "^3.2.2",
|
||||
"properties": "~1.2.1",
|
||||
"semver": "5.3.0",
|
||||
"toml": "^2.0.6",
|
||||
"ts-node": "^3.3.0",
|
||||
"typescript": "^2.4.2",
|
||||
"underscore": "^1.8.3",
|
||||
"vows": ">=0.8.1",
|
||||
"x2js": "^2.0.1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/node-config/node-config.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "./node_modules/vows/bin/vows test/*.js --spec"
|
||||
}
|
||||
}
|
||||
368
node_modules/config/parser.js
generated
vendored
Normal file
368
node_modules/config/parser.js
generated
vendored
Normal file
@@ -0,0 +1,368 @@
|
||||
// External libraries are lazy-loaded only if these file types exist.
|
||||
const util = require("util");
|
||||
var Yaml = null,
|
||||
VisionmediaYaml = null,
|
||||
Coffee = null,
|
||||
Iced = null,
|
||||
CSON = null,
|
||||
PPARSER = null,
|
||||
JSON5 = null,
|
||||
TOML = null,
|
||||
HJSON = null,
|
||||
XML = null;
|
||||
|
||||
// Define soft dependencies so transpilers don't include everything
|
||||
var COFFEE_2_DEP = 'coffeescript',
|
||||
COFFEE_DEP = 'coffee-script',
|
||||
ICED_DEP = 'iced-coffee-script',
|
||||
JS_YAML_DEP = 'js-yaml',
|
||||
YAML_DEP = 'yaml',
|
||||
JSON5_DEP = 'json5',
|
||||
HJSON_DEP = 'hjson',
|
||||
TOML_DEP = 'toml',
|
||||
CSON_DEP = 'cson',
|
||||
PPARSER_DEP = 'properties',
|
||||
XML_DEP = 'x2js',
|
||||
TS_DEP = 'ts-node';
|
||||
|
||||
var Parser = module.exports;
|
||||
|
||||
Parser.parse = function(filename, content) {
|
||||
var parserName = filename.substr(filename.lastIndexOf('.') +1); // file extension
|
||||
if (typeof definitions[parserName] === 'function') {
|
||||
return definitions[parserName](filename, content);
|
||||
}
|
||||
// TODO: decide what to do in case of a missing parser
|
||||
};
|
||||
|
||||
Parser.xmlParser = function(filename, content) {
|
||||
if (!XML) {
|
||||
XML = require(XML_DEP);
|
||||
}
|
||||
var x2js = new XML();
|
||||
var configObject = x2js.xml2js(content);
|
||||
var rootKeys = Object.keys(configObject);
|
||||
if(rootKeys.length === 1) {
|
||||
return configObject[rootKeys[0]];
|
||||
}
|
||||
return configObject;
|
||||
};
|
||||
|
||||
Parser.jsParser = function(filename, content) {
|
||||
var configObject = require(filename);
|
||||
|
||||
if (configObject.__esModule && util.isObject(configObject.default)) {
|
||||
return configObject.default
|
||||
}
|
||||
return configObject;
|
||||
};
|
||||
|
||||
Parser.tsParser = function(filename, content) {
|
||||
if (!require.extensions['.ts']) {
|
||||
require(TS_DEP).register({
|
||||
lazy: true,
|
||||
transpileOnly: true,
|
||||
compilerOptions: {
|
||||
allowJs: true,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Imports config if it is exported via module.exports = ...
|
||||
// See https://github.com/node-config/node-config/issues/524
|
||||
var configObject = require(filename);
|
||||
|
||||
// Because of ES6 modules usage, `default` is treated as named export (like any other)
|
||||
// Therefore config is a value of `default` key.
|
||||
if (configObject.default) {
|
||||
return configObject.default
|
||||
}
|
||||
return configObject;
|
||||
};
|
||||
|
||||
Parser.coffeeParser = function(filename, content) {
|
||||
// .coffee files can be loaded with either coffee-script or iced-coffee-script.
|
||||
// Prefer iced-coffee-script, if it exists.
|
||||
// Lazy load the appropriate extension
|
||||
if (!Coffee) {
|
||||
Coffee = {};
|
||||
|
||||
// The following enables iced-coffee-script on .coffee files, if iced-coffee-script is available.
|
||||
// This is commented as per a decision on a pull request.
|
||||
//try {
|
||||
// Coffee = require('iced-coffee-script');
|
||||
//}
|
||||
//catch (e) {
|
||||
// Coffee = require('coffee-script');
|
||||
//}
|
||||
try {
|
||||
// Try to load coffeescript
|
||||
Coffee = require(COFFEE_2_DEP);
|
||||
}
|
||||
catch (e) {
|
||||
// If it doesn't exist, try to load it using the deprecated module name
|
||||
Coffee = require(COFFEE_DEP);
|
||||
}
|
||||
// coffee-script >= 1.7.0 requires explicit registration for require() to work
|
||||
if (Coffee.register) {
|
||||
Coffee.register();
|
||||
}
|
||||
}
|
||||
// Use the built-in parser for .coffee files with coffee-script
|
||||
return require(filename);
|
||||
};
|
||||
|
||||
Parser.icedParser = function(filename, content) {
|
||||
Iced = require(ICED_DEP);
|
||||
|
||||
// coffee-script >= 1.7.0 requires explicit registration for require() to work
|
||||
if (Iced.register) {
|
||||
Iced.register();
|
||||
}
|
||||
};
|
||||
|
||||
Parser.yamlParser = function(filename, content) {
|
||||
if (!Yaml && !VisionmediaYaml) {
|
||||
// Lazy loading
|
||||
try {
|
||||
// Try to load the better js-yaml module
|
||||
Yaml = require(JS_YAML_DEP);
|
||||
}
|
||||
catch (e) {
|
||||
try {
|
||||
// If it doesn't exist, load the fallback visionmedia yaml module.
|
||||
VisionmediaYaml = require(YAML_DEP);
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
}
|
||||
if (Yaml) {
|
||||
return Yaml.load(content);
|
||||
}
|
||||
else if (VisionmediaYaml) {
|
||||
// The yaml library doesn't like strings that have newlines but don't
|
||||
// end in a newline: https://github.com/visionmedia/js-yaml/issues/issue/13
|
||||
content += '\n';
|
||||
if (typeof VisionmediaYaml.eval === 'function') {
|
||||
return VisionmediaYaml.eval(Parser.stripYamlComments(content));
|
||||
}
|
||||
return VisionmediaYaml.parse(Parser.stripYamlComments(content));
|
||||
}
|
||||
else {
|
||||
console.error('No YAML parser loaded. Suggest adding js-yaml dependency to your package.json file.')
|
||||
}
|
||||
};
|
||||
|
||||
Parser.jsonParser = function(filename, content) {
|
||||
try {
|
||||
return JSON.parse(content);
|
||||
}
|
||||
catch (e) {
|
||||
// All JS Style comments will begin with /, so all JSON parse errors that
|
||||
// encountered a syntax error will complain about this character.
|
||||
if (e.name !== 'SyntaxError' || e.message.indexOf('Unexpected token /') !== 0) {
|
||||
throw e;
|
||||
}
|
||||
if (!JSON5) {
|
||||
JSON5 = require(JSON5_DEP);
|
||||
}
|
||||
return JSON5.parse(content);
|
||||
}
|
||||
};
|
||||
|
||||
Parser.json5Parser = function(filename, content) {
|
||||
if (!JSON5) {
|
||||
JSON5 = require(JSON5_DEP);
|
||||
}
|
||||
return JSON5.parse(content);
|
||||
};
|
||||
|
||||
Parser.hjsonParser = function(filename, content) {
|
||||
if (!HJSON) {
|
||||
HJSON = require(HJSON_DEP);
|
||||
}
|
||||
return HJSON.parse(content);
|
||||
};
|
||||
|
||||
Parser.tomlParser = function(filename, content) {
|
||||
if(!TOML) {
|
||||
TOML = require(TOML_DEP);
|
||||
}
|
||||
return TOML.parse(content);
|
||||
};
|
||||
|
||||
Parser.csonParser = function(filename, content) {
|
||||
if (!CSON) {
|
||||
CSON = require(CSON_DEP);
|
||||
}
|
||||
// Allow comments in CSON files
|
||||
if (typeof CSON.parseSync === 'function') {
|
||||
return CSON.parseSync(Parser.stripComments(content));
|
||||
}
|
||||
return CSON.parse(Parser.stripComments(content));
|
||||
};
|
||||
|
||||
Parser.propertiesParser = function(filename, content) {
|
||||
if (!PPARSER) {
|
||||
PPARSER = require(PPARSER_DEP);
|
||||
}
|
||||
return PPARSER.parse(content, { namespaces: true, variables: true, sections: true });
|
||||
};
|
||||
|
||||
/**
|
||||
* Strip all Javascript type comments from the string.
|
||||
*
|
||||
* The string is usually a file loaded from the O/S, containing
|
||||
* newlines and javascript type comments.
|
||||
*
|
||||
* Thanks to James Padolsey, and all who contributed to this implementation.
|
||||
* http://james.padolsey.com/javascript/javascript-comment-removal-revisted/
|
||||
*
|
||||
* @protected
|
||||
* @method stripComments
|
||||
* @param fileStr {string} The string to strip comments from
|
||||
* @param stringRegex {RegExp} Optional regular expression to match strings that
|
||||
* make up the config file
|
||||
* @return {string} The string with comments stripped.
|
||||
*/
|
||||
Parser.stripComments = function(fileStr, stringRegex) {
|
||||
stringRegex = stringRegex || /(['"])(\\\1|.)+?\1/g;
|
||||
|
||||
var uid = '_' + +new Date(),
|
||||
primitives = [],
|
||||
primIndex = 0;
|
||||
|
||||
return (
|
||||
fileStr
|
||||
|
||||
/* Remove strings */
|
||||
.replace(stringRegex, function(match){
|
||||
primitives[primIndex] = match;
|
||||
return (uid + '') + primIndex++;
|
||||
})
|
||||
|
||||
/* Remove Regexes */
|
||||
.replace(/([^\/])(\/(?!\*|\/)(\\\/|.)+?\/[gim]{0,3})/g, function(match, $1, $2){
|
||||
primitives[primIndex] = $2;
|
||||
return $1 + (uid + '') + primIndex++;
|
||||
})
|
||||
|
||||
/*
|
||||
- Remove single-line comments that contain would-be multi-line delimiters
|
||||
E.g. // Comment /* <--
|
||||
- Remove multi-line comments that contain would be single-line delimiters
|
||||
E.g. /* // <--
|
||||
*/
|
||||
.replace(/\/\/.*?\/?\*.+?(?=\n|\r|$)|\/\*[\s\S]*?\/\/[\s\S]*?\*\//g, '')
|
||||
|
||||
/*
|
||||
Remove single and multi-line comments,
|
||||
no consideration of inner-contents
|
||||
*/
|
||||
.replace(/\/\/.+?(?=\n|\r|$)|\/\*[\s\S]+?\*\//g, '')
|
||||
|
||||
/*
|
||||
Remove multi-line comments that have a replaced ending (string/regex)
|
||||
Greedy, so no inner strings/regexes will stop it.
|
||||
*/
|
||||
.replace(RegExp('\\/\\*[\\s\\S]+' + uid + '\\d+', 'g'), '')
|
||||
|
||||
/* Bring back strings & regexes */
|
||||
.replace(RegExp(uid + '(\\d+)', 'g'), function(match, n){
|
||||
return primitives[n];
|
||||
})
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Strip YAML comments from the string
|
||||
*
|
||||
* The 2.0 yaml parser doesn't allow comment-only or blank lines. Strip them.
|
||||
*
|
||||
* @protected
|
||||
* @method stripYamlComments
|
||||
* @param fileStr {string} The string to strip comments from
|
||||
* @return {string} The string with comments stripped.
|
||||
*/
|
||||
Parser.stripYamlComments = function(fileStr) {
|
||||
// First replace removes comment-only lines
|
||||
// Second replace removes blank lines
|
||||
return fileStr.replace(/^\s*#.*/mg,'').replace(/^\s*[\n|\r]+/mg,'');
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses the environment variable to the boolean equivalent.
|
||||
* Defaults to false
|
||||
*
|
||||
* @param {String} content - Environment variable value
|
||||
* @return {boolean} - Boolean value fo the passed variable value
|
||||
*/
|
||||
Parser.booleanParser = function(filename, content) {
|
||||
return content === 'true';
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses the environment variable to the number equivalent.
|
||||
* Defaults to undefined
|
||||
*
|
||||
* @param {String} content - Environment variable value
|
||||
* @return {Number} - Number value fo the passed variable value
|
||||
*/
|
||||
Parser.numberParser = function(filename, content) {
|
||||
const numberValue = Number(content);
|
||||
return Number.isNaN(numberValue) ? undefined : numberValue;
|
||||
};
|
||||
|
||||
var order = ['js', 'cjs', 'ts', 'json', 'json5', 'hjson', 'toml', 'coffee', 'iced', 'yaml', 'yml', 'cson', 'properties', 'xml',
|
||||
'boolean', 'number'];
|
||||
var definitions = {
|
||||
cjs: Parser.jsParser,
|
||||
coffee: Parser.coffeeParser,
|
||||
cson: Parser.csonParser,
|
||||
hjson: Parser.hjsonParser,
|
||||
iced: Parser.icedParser,
|
||||
js: Parser.jsParser,
|
||||
json: Parser.jsonParser,
|
||||
json5: Parser.json5Parser,
|
||||
properties: Parser.propertiesParser,
|
||||
toml: Parser.tomlParser,
|
||||
ts: Parser.tsParser,
|
||||
xml: Parser.xmlParser,
|
||||
yaml: Parser.yamlParser,
|
||||
yml: Parser.yamlParser,
|
||||
boolean: Parser.booleanParser,
|
||||
number: Parser.numberParser
|
||||
};
|
||||
|
||||
Parser.getParser = function(name) {
|
||||
return definitions[name];
|
||||
};
|
||||
|
||||
Parser.setParser = function(name, parser) {
|
||||
definitions[name] = parser;
|
||||
if (order.indexOf(name) === -1) {
|
||||
order.push(name);
|
||||
}
|
||||
};
|
||||
|
||||
Parser.getFilesOrder = function(name) {
|
||||
if (name) {
|
||||
return order.indexOf(name);
|
||||
}
|
||||
return order;
|
||||
};
|
||||
|
||||
Parser.setFilesOrder = function(name, newIndex) {
|
||||
if (Array.isArray(name)) {
|
||||
return order = name;
|
||||
}
|
||||
if (typeof newIndex === 'number') {
|
||||
var index = order.indexOf(name);
|
||||
order.splice(newIndex, 0, name);
|
||||
if (index > -1) {
|
||||
order.splice(index >= newIndex ? index +1 : index, 1);
|
||||
}
|
||||
}
|
||||
return order;
|
||||
};
|
||||
15
node_modules/config/raw.js
generated
vendored
Normal file
15
node_modules/config/raw.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* This is meant to wrap configuration objects that should be left as is,
|
||||
* meaning that the object or its prototype will not be modified in any way
|
||||
*/
|
||||
function RawConfig () {
|
||||
}
|
||||
|
||||
function raw(rawObj) {
|
||||
var obj = Object.create(RawConfig.prototype);
|
||||
obj.resolve = function () { return rawObj; }
|
||||
return obj;
|
||||
}
|
||||
|
||||
module.exports.RawConfig = RawConfig;
|
||||
module.exports.raw = raw;
|
||||
Reference in New Issue
Block a user