diff --git a/.eslintrc.yaml b/.eslintrc.yaml index d8442ff3a18c44..5e025301fe8a62 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -13,39 +13,39 @@ parserOptions: rules: # Possible Errors # http://eslint.org/docs/rules/#possible-errors - no-control-regex: 2 - no-debugger: 2 - no-dupe-args: 2 - no-dupe-keys: 2 - no-duplicate-case: 2 - no-empty-character-class: 2 - no-ex-assign: 2 - no-extra-boolean-cast: 2 - no-extra-parens: [2, functions] - no-extra-semi: 2 - no-func-assign: 2 - no-invalid-regexp: 2 - no-irregular-whitespace: 2 - no-obj-calls: 2 - no-template-curly-in-string: 2 - no-unexpected-multiline: 2 - no-unreachable: 2 - no-unsafe-negation: 2 - use-isnan: 2 - valid-typeof: 2 + no-control-regex: error + no-debugger: error + no-dupe-args: error + no-dupe-keys: error + no-duplicate-case: error + no-empty-character-class: error + no-ex-assign: error + no-extra-boolean-cast: error + no-extra-parens: [error, functions] + no-extra-semi: error + no-func-assign: error + no-invalid-regexp: error + no-irregular-whitespace: error + no-obj-calls: error + no-template-curly-in-string: error + no-unexpected-multiline: error + no-unreachable: error + no-unsafe-negation: error + use-isnan: error + valid-typeof: error # Best Practices # http://eslint.org/docs/rules/#best-practices - dot-location: [2, property] - eqeqeq: [2, smart] - no-fallthrough: 2 - no-global-assign: 2 - no-multi-spaces: [2, {ignoreEOLComments: true}] - no-octal: 2 - no-proto: 2 - no-redeclare: 2 + dot-location: [error, property] + eqeqeq: [error, smart] + no-fallthrough: error + no-global-assign: error + no-multi-spaces: [error, {ignoreEOLComments: true}] + no-octal: error + no-proto: error + no-redeclare: error no-restricted-properties: - - 2 + - error - object: assert property: deepEqual message: Use assert.deepStrictEqual(). @@ -59,68 +59,71 @@ rules: message: __defineGetter__ is deprecated. - property: __defineSetter__ message: __defineSetter__ is deprecated. - no-self-assign: 2 - no-throw-literal: 2 - no-unused-labels: 2 - no-useless-call: 2 - no-useless-concat: 2 - no-useless-escape: 2 - no-useless-return: 2 - no-void: 2 - no-with: 2 + no-self-assign: error + no-throw-literal: error + no-unused-labels: error + no-useless-call: error + no-useless-concat: error + no-useless-escape: error + no-useless-return: error + no-void: error + no-with: error # Strict Mode # http://eslint.org/docs/rules/#strict-mode - strict: [2, global] + strict: [error, global] # Variables # http://eslint.org/docs/rules/#variables - no-delete-var: 2 - no-undef: 2 - no-unused-vars: [2, {args: none}] + no-delete-var: error + no-undef: error + no-unused-vars: [error, {args: none}] + no-use-before-define: [error, {classes: true, + functions: false, + variables: false}] # Node.js and CommonJS # http://eslint.org/docs/rules/#nodejs-and-commonjs - no-mixed-requires: 2 - no-new-require: 2 - no-path-concat: 2 - no-restricted-modules: [2, sys] + no-mixed-requires: error + no-new-require: error + no-path-concat: error + no-restricted-modules: [error, sys] # Stylistic Issues # http://eslint.org/docs/rules/#stylistic-issues - block-spacing: 2 - brace-style: [2, 1tbs, {allowSingleLine: true}] - comma-dangle: [2, only-multiline] - comma-spacing: 2 - comma-style: 2 - computed-property-spacing: 2 - eol-last: 2 - func-call-spacing: 2 - func-name-matching: 2 - func-style: [2, declaration, {allowArrowFunctions: true}] - # indent: [2, 2, {ArrayExpression: first, + block-spacing: error + brace-style: [error, 1tbs, {allowSingleLine: true}] + comma-dangle: [error, only-multiline] + comma-spacing: error + comma-style: error + computed-property-spacing: error + eol-last: error + func-call-spacing: error + func-name-matching: error + func-style: [error, declaration, {allowArrowFunctions: true}] + # indent: [error, 2, {ArrayExpression: first, # CallExpression: {arguments: first}, # FunctionDeclaration: {parameters: first}, # FunctionExpression: {parameters: first}, # MemberExpression: off, # ObjectExpression: first, # SwitchCase: 1}] - indent-legacy: [2, 2, {ArrayExpression: first, + indent-legacy: [error, 2, {ArrayExpression: first, CallExpression: {arguments: first}, MemberExpression: 1, ObjectExpression: first, SwitchCase: 1}] - key-spacing: [2, {mode: minimum}] - keyword-spacing: 2 - linebreak-style: [2, unix] - max-len: [2, {code: 80, + key-spacing: [error, {mode: minimum}] + keyword-spacing: error + linebreak-style: [error, unix] + max-len: [error, {code: 80, ignoreRegExpLiterals: true, ignoreUrls: true, tabWidth: 2}] - new-parens: 2 - no-mixed-spaces-and-tabs: 2 - no-multiple-empty-lines: [2, {max: 2, maxEOF: 0, maxBOF: 0}] - no-restricted-syntax: [2, { + new-parens: error + no-mixed-spaces-and-tabs: error + no-multiple-empty-lines: [error, {max: 2, maxEOF: 0, maxBOF: 0}] + no-restricted-syntax: [error, { selector: "CallExpression[callee.name='setTimeout'][arguments.length<2]", message: "setTimeout() must be invoked with at least two arguments." }, { @@ -130,43 +133,42 @@ rules: selector: "ThrowStatement > CallExpression[callee.name=/Error$/]", message: "Use new keyword when throwing an Error." }] - no-tabs: 2 - no-trailing-spaces: 2 - one-var-declaration-per-line: 2 - operator-linebreak: [2, after] - quotes: [2, single, avoid-escape] - semi: 2 - semi-spacing: 2 - space-before-blocks: [2, always] - space-before-function-paren: [2, { + no-tabs: error + no-trailing-spaces: error + one-var-declaration-per-line: error + operator-linebreak: [error, after] + quotes: [error, single, avoid-escape] + semi: error + semi-spacing: error + space-before-blocks: [error, always] + space-before-function-paren: [error, { "anonymous": "never", "named": "never", "asyncArrow": "always" }] - space-in-parens: [2, never] - space-infix-ops: 2 - space-unary-ops: 2 - unicode-bom: 2 + space-in-parens: [error, never] + space-infix-ops: error + space-unary-ops: error + unicode-bom: error # ECMAScript 6 # http://eslint.org/docs/rules/#ecmascript-6 - arrow-parens: [2, always] - arrow-spacing: [2, {before: true, after: true}] - constructor-super: 2 - no-class-assign: 2 - no-confusing-arrow: 2 - no-const-assign: 2 - no-dupe-class-members: 2 - no-new-symbol: 2 - no-this-before-super: 2 - prefer-const: [2, {ignoreReadBeforeAssign: true}] - rest-spread-spacing: 2 - template-curly-spacing: 2 + arrow-parens: [error, always] + arrow-spacing: [error, {before: true, after: true}] + constructor-super: error + no-class-assign: error + no-confusing-arrow: error + no-const-assign: error + no-dupe-class-members: error + no-new-symbol: error + no-this-before-super: error + prefer-const: [error, {ignoreReadBeforeAssign: true}] + rest-spread-spacing: error + template-curly-spacing: error # Custom rules in tools/eslint-rules - align-multiline-assignment: 2 - assert-throws-arguments: [2, { requireTwo: true }] - no-unescaped-regexp-dot: 2 + assert-throws-arguments: [error, { requireTwo: true }] + no-unescaped-regexp-dot: error # Global scoped method and vars globals: diff --git a/BUILDING.md b/BUILDING.md index 9c1fb6899911c4..47630ddf150216 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -65,7 +65,7 @@ Depending on host platform, the selection of toolchains may vary. #### Unix -* GCC 4.8.5 or newer +* GCC 4.9.4 or newer * Clang 3.4.2 or newer #### Windows @@ -80,8 +80,8 @@ Depending on host platform, the selection of toolchains may vary. Prerequisites: -* `gcc` and `g++` 4.8.5 or newer, or -* `clang` and `clang++` 3.4.2 or newer +* `gcc` and `g++` 4.9.4 or newer, or +* `clang` and `clang++` 3.4.2 or newer (macOS: latest Xcode Command Line Tools) * Python 2.6 or 2.7 * GNU Make 3.81 or newer diff --git a/CHANGELOG.md b/CHANGELOG.md index d3a4ad8bccf4e4..4caef61079be79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,8 @@ release. -8.1.4
+8.2.0
+8.1.4
8.1.3
8.1.2
8.1.1
diff --git a/Makefile b/Makefile index 3154baad447998..01716fc7317e82 100644 --- a/Makefile +++ b/Makefile @@ -433,13 +433,15 @@ test-async-hooks: ifneq ("","$(wildcard deps/v8/tools/run-tests.py)") -test-v8: v8 test-hash-seed +test-v8: v8 # note: performs full test unless QUICKCHECK is specified deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \ --mode=$(BUILDTYPE_LOWER) $(V8_TEST_OPTIONS) $(QUICKCHECK_ARG) \ --no-presubmit \ --shell-dir=$(PWD)/deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) \ $(TAP_V8) + @echo Testing hash seed + $(MAKE) test-hash-seed test-v8-intl: v8 # note: performs full test unless QUICKCHECK is specified diff --git a/README.md b/README.md index 1c93a5f2ede66e..04f5a746bfd61a 100644 --- a/README.md +++ b/README.md @@ -81,12 +81,13 @@ The Node.js project maintains multiple types of releases: ordered codenames, beginning with v4 Argon. LTS releases are less frequent and will attempt to maintain consistent major and minor version numbers, only incrementing patch version numbers. There are no breaking changes or - feature additions, except in some special circumstances. More information - can be found in the [LTS README](https://github.com/nodejs/LTS/). + feature additions, except in some special circumstances. * **Nightly**: Versions of code in this repository on the current Current branch, automatically built every 24-hours where changes exist. Use with caution. +More information can be found in the [LTS README](https://github.com/nodejs/LTS/). + ## Download Binaries, installers, and source tarballs are available at @@ -241,6 +242,8 @@ more information about the governance of the Node.js project, see * [abouthiroppy](https://github.com/abouthiroppy) - **Yuta Hiroto** <hello@about-hiroppy.com> (he/him) +* [addaleax](https://github.com/addaleax) - +**Anna Henningsen** <anna@addaleax.net> (she/her) * [ak239](https://github.com/ak239) - **Aleksei Koziatinskii** <ak239spb@gmail.com> * [andrasq](https://github.com/andrasq) - @@ -257,12 +260,20 @@ more information about the governance of the Node.js project, see **Benjamin Gruenbaum** <benjamingr@gmail.com> * [bmeck](https://github.com/bmeck) - **Bradley Farias** <bradley.meck@gmail.com> +* [bnoordhuis](https://github.com/bnoordhuis) - +**Ben Noordhuis** <info@bnoordhuis.nl> * [brendanashworth](https://github.com/brendanashworth) - **Brendan Ashworth** <brendan.ashworth@me.com> * [bzoz](https://github.com/bzoz) - **Bartosz Sosnowski** <bartosz@janeasystems.com> * [calvinmetcalf](https://github.com/calvinmetcalf) - **Calvin Metcalf** <calvin.metcalf@gmail.com> +* [ChALkeR](https://github.com/ChALkeR) - +**Сковорода Никита Андреевич** <chalkerx@gmail.com> (he/him) +* [chrisdickinson](https://github.com/chrisdickinson) - +**Chris Dickinson** <christopher.s.dickinson@gmail.com> +* [cjihrig](https://github.com/cjihrig) - +**Colin Ihrig** <cjihrig@gmail.com> * [claudiorodriguez](https://github.com/claudiorodriguez) - **Claudio Rodriguez** <cjrodr@yahoo.com> * [danbev](https://github.com/danbev) - @@ -277,22 +288,36 @@ more information about the governance of the Node.js project, see **Alexander Makarenko** <estliberitas@gmail.com> * [eugeneo](https://github.com/eugeneo) - **Eugene Ostroukhov** <eostroukhov@google.com> +* [evanlucas](https://github.com/evanlucas) - +**Evan Lucas** <evanlucas@me.com> (he/him) +* [fhinkel](https://github.com/fhinkel) - +**Franziska Hinkelmann** <franziska.hinkelmann@gmail.com> * [firedfox](https://github.com/firedfox) - **Daniel Wang** <wangyang0123@gmail.com> +* [Fishrock123](https://github.com/Fishrock123) - +**Jeremiah Senkpiel** <fishrock123@rocketmail.com> * [geek](https://github.com/geek) - **Wyatt Preul** <wpreul@gmail.com> * [gibfahn](https://github.com/gibfahn) - **Gibson Fahnestock** <gibfahn@gmail.com> (he/him) +* [gireeshpunathil](https://github.com/gireeshpunathil) - +**Gireesh Punathil** <gpunathi@in.ibm.com> (he/him) * [iarna](https://github.com/iarna) - **Rebecca Turner** <me@re-becca.org> * [imran-iq](https://github.com/imran-iq) - **Imran Iqbal** <imran@imraniqbal.org> * [imyller](https://github.com/imyller) - **Ilkka Myller** <ilkka.myller@nodefield.com> +* [indutny](https://github.com/indutny) - +**Fedor Indutny** <fedor.indutny@gmail.com> +* [isaacs](https://github.com/isaacs) - +**Isaac Z. Schlueter** <i@izs.me> * [italoacasas](https://github.com/italoacasas) - **Italo A. Casas** <me@italoacasas.com> (he/him) * [JacksonTian](https://github.com/JacksonTian) - **Jackson Tian** <shyvo1987@gmail.com> +* [jasnell](https://github.com/jasnell) - +**James M Snell** <jasnell@gmail.com> (he/him) * [jasongin](https://github.com/jasongin) - **Jason Ginchereau** <jasongin@microsoft.com> * [jbergstroem](https://github.com/jbergstroem) - @@ -305,6 +330,8 @@ more information about the governance of the Node.js project, see **João Reis** <reis@janeasystems.com> * [joshgav](https://github.com/joshgav) - **Josh Gavant** <josh.gavant@outlook.com> +* [joyeecheung](https://github.com/joyeecheung) - +**Joyee Cheung** <joyeec9h3@gmail.com> (she/her) * [julianduque](https://github.com/julianduque) - **Julian Duque** <julianduquej@gmail.com> (he/him) * [JungMinu](https://github.com/JungMinu) - @@ -321,22 +348,38 @@ more information about the governance of the Node.js project, see **Aleksey Smolenchuk** <lxe@lxe.co> * [matthewloring](https://github.com/matthewloring) - **Matthew Loring** <mattloring@google.com> +* [mcollina](https://github.com/mcollina) - +**Matteo Collina** <matteo.collina@gmail.com> (he/him) +* [mhdawson](https://github.com/mhdawson) - +**Michael Dawson** <michael_dawson@ca.ibm.com> (he/him) * [micnic](https://github.com/micnic) - **Nicu Micleușanu** <micnic90@gmail.com> (he/him) * [mikeal](https://github.com/mikeal) - **Mikeal Rogers** <mikeal.rogers@gmail.com> +* [misterdjules](https://github.com/misterdjules) - +**Julien Gilli** <jgilli@nodejs.org> * [monsanto](https://github.com/monsanto) - **Christopher Monsanto** <chris@monsan.to> +* [mscdex](https://github.com/mscdex) - +**Brian White** <mscdex@mscdex.net> +* [MylesBorins](https://github.com/MylesBorins) - +**Myles Borins** <myles.borins@gmail.com> (he/him) * [not-an-aardvark](https://github.com/not-an-aardvark) - **Teddy Katz** <teddy.katz@gmail.com> +* [ofrobots](https://github.com/ofrobots) - +**Ali Ijaz Sheikh** <ofrobots@google.com> * [Olegas](https://github.com/Olegas) - **Oleg Elifantiev** <oleg@elifantiev.ru> +* [orangemocha](https://github.com/orangemocha) - +**Alexis Campailla** <orangemocha@nodejs.org> * [othiym23](https://github.com/othiym23) - **Forrest L Norvell** <ogd@aoaioxxysz.net> (he/him) * [petkaantonov](https://github.com/petkaantonov) - **Petka Antonov** <petka_antonov@hotmail.com> * [phillipj](https://github.com/phillipj) - **Phillip Johnsen** <johphi@gmail.com> +* [piscisaureus](https://github.com/piscisaureus) - +**Bert Belder** <bertbelder@gmail.com> * [pmq20](https://github.com/pmq20) - **Minqi Pan** <pmq2001@gmail.com> * [princejwesley](https://github.com/princejwesley) - @@ -359,6 +402,8 @@ more information about the governance of the Node.js project, see **Ron Korving** <ron@ronkorving.nl> * [RReverser](https://github.com/RReverser) - **Ingvar Stepanyan** <me@rreverser.com> +* [rvagg](https://github.com/rvagg) - +**Rod Vagg** <rod@vagg.org> * [saghul](https://github.com/saghul) - **Saúl Ibarra Corretgé** <saghul@gmail.com> * [sam-github](https://github.com/sam-github) - @@ -367,14 +412,20 @@ more information about the governance of the Node.js project, see **Santiago Gimeno** <santiago.gimeno@gmail.com> * [seishun](https://github.com/seishun) - **Nikolai Vavilov** <vvnicholas@gmail.com> +* [shigeki](https://github.com/shigeki) - +**Shigeki Ohtsu** <ohtsu@ohtsu.org> (he/him) * [silverwind](https://github.com/silverwind) - **Roman Reiss** <me@silverwind.io> * [srl295](https://github.com/srl295) - **Steven R Loomis** <srloomis@us.ibm.com> * [stefanmb](https://github.com/stefanmb) - **Stefan Budeanu** <stefan@budeanu.com> +* [targos](https://github.com/targos) - +**Michaël Zasso** <targos@protonmail.com> (he/him) * [tellnes](https://github.com/tellnes) - **Christian Tellnes** <christian@tellnes.no> +* [thefourtheye](https://github.com/thefourtheye) - +**Sakthipriyan Vairamani** <thechargingvolcano@gmail.com> (he/him) * [thekemkid](https://github.com/thekemkid) - **Glen Keane** <glenkeane.94@gmail.com> (he/him) * [thlorenz](https://github.com/thlorenz) - @@ -383,6 +434,10 @@ more information about the governance of the Node.js project, see **Timothy Gu** <timothygu99@gmail.com> (he/him) * [tniessen](https://github.com/tniessen) - **Tobias Nießen** <tniessen@tnie.de> +* [trevnorris](https://github.com/trevnorris) - +**Trevor Norris** <trev.norris@gmail.com> +* [Trott](https://github.com/Trott) - +**Rich Trott** <rtrott@gmail.com> (he/him) * [tunniclm](https://github.com/tunniclm) - **Mike Tunnicliffe** <m.j.tunnicliffe@gmail.com> * [vkurchatkin](https://github.com/vkurchatkin) - @@ -398,9 +453,8 @@ more information about the governance of the Node.js project, see * [yosuke-furukawa](https://github.com/yosuke-furukawa) - **Yosuke Furukawa** <yosuke.furukawa@gmail.com> -Collaborators (which includes CTC members) follow the -[COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in maintaining the Node.js -project. +Collaborators follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in +maintaining the Node.js project. ### Release Team diff --git a/benchmark/.eslintrc.yaml b/benchmark/.eslintrc.yaml new file mode 100644 index 00000000000000..beaaea041fc7f5 --- /dev/null +++ b/benchmark/.eslintrc.yaml @@ -0,0 +1,13 @@ +## Benchmarks-specific linter rules + +rules: + # Stylistic Issues + # http://eslint.org/docs/rules/#stylistic-issues + indent: [error, 2, {ArrayExpression: first, + CallExpression: {arguments: first}, + FunctionDeclaration: {parameters: first}, + FunctionExpression: {parameters: first}, + MemberExpression: off, + ObjectExpression: first, + SwitchCase: 1}] + indent-legacy: off diff --git a/benchmark/_benchmark_progress.js b/benchmark/_benchmark_progress.js index 5e2ae4ab11dc75..0c5cc10bf8d536 100644 --- a/benchmark/_benchmark_progress.js +++ b/benchmark/_benchmark_progress.js @@ -87,8 +87,8 @@ class BenchmarkProgress { const runsPerFile = this.runsPerFile; const completedFiles = Math.floor(completedRuns / runsPerFile); const scheduledFiles = this.benchmarks.length; - const completedRunsForFile = finished ? runsPerFile : - completedRuns % runsPerFile; + const completedRunsForFile = + finished ? runsPerFile : completedRuns % runsPerFile; const completedConfig = this.completedConfig; const scheduledConfig = this.scheduledConfig; @@ -101,12 +101,11 @@ class BenchmarkProgress { const percent = pad(Math.floor(completedRate * 100), 3, ' '); const caption = finished ? 'Done\n' : this.currentFile; - return `[${getTime(diff)}|% ${ - percent}| ${ - fraction(completedFiles, scheduledFiles)} files | ${ - fraction(completedRunsForFile, runsPerFile)} runs | ${ - fraction(completedConfig, scheduledConfig)} configs]: ${ - caption} `; + return `[${getTime(diff)}|% ${percent}| ` + + `${fraction(completedFiles, scheduledFiles)} files | ` + + `${fraction(completedRunsForFile, runsPerFile)} runs | ` + + `${fraction(completedConfig, scheduledConfig)} configs]: ` + + `${caption} `; } updateProgress(finished) { diff --git a/benchmark/_http-benchmarkers.js b/benchmark/_http-benchmarkers.js index bdc35308a704db..3f17f05f831170 100644 --- a/benchmark/_http-benchmarkers.js +++ b/benchmark/_http-benchmarkers.js @@ -13,9 +13,8 @@ exports.PORT = process.env.PORT || 12346; class AutocannonBenchmarker { constructor() { this.name = 'autocannon'; - this.executable = process.platform === 'win32' ? - 'autocannon.cmd' : - 'autocannon'; + this.executable = + process.platform === 'win32' ? 'autocannon.cmd' : 'autocannon'; const result = child_process.spawnSync(this.executable, ['-h']); this.present = !(result.error && result.error.code === 'ENOENT'); } @@ -136,19 +135,19 @@ exports.run = function(options, callback) { benchmarker: exports.default_http_benchmarker }, options); if (!options.benchmarker) { - callback(new Error(`Could not locate required http benchmarker. See ${ - requirementsURL} for further instructions.`)); + callback(new Error('Could not locate required http benchmarker. See ' + + `${requirementsURL} for further instructions.`)); return; } const benchmarker = benchmarkers[options.benchmarker]; if (!benchmarker) { - callback(new Error(`Requested benchmarker '${ - options.benchmarker}' is not supported`)); + callback(new Error(`Requested benchmarker '${options.benchmarker}' ` + + 'is not supported')); return; } if (!benchmarker.present) { - callback(new Error(`Requested benchmarker '${ - options.benchmarker}' is not installed`)); + callback(new Error(`Requested benchmarker '${options.benchmarker}' ` + + 'is not installed')); return; } diff --git a/benchmark/buffers/buffer-compare-offset.js b/benchmark/buffers/buffer-compare-offset.js index fd8c96dbce0158..96719abfbe5618 100644 --- a/benchmark/buffers/buffer-compare-offset.js +++ b/benchmark/buffers/buffer-compare-offset.js @@ -26,8 +26,8 @@ function compareUsingOffset(b0, b1, len, iter) { function main(conf) { const iter = (conf.millions >>> 0) * 1e6; const size = (conf.size >>> 0); - const method = conf.method === 'slice' ? - compareUsingSlice : compareUsingOffset; + const method = + conf.method === 'slice' ? compareUsingSlice : compareUsingOffset; method(Buffer.alloc(size, 'a'), Buffer.alloc(size, 'b'), size >> 1, diff --git a/benchmark/buffers/buffer-iterate.js b/benchmark/buffers/buffer-iterate.js index fb8abc1aee1c63..7c2044422245c4 100644 --- a/benchmark/buffers/buffer-iterate.js +++ b/benchmark/buffers/buffer-iterate.js @@ -29,9 +29,11 @@ function main(conf) { function benchFor(buffer, n) { bench.start(); - for (var k = 0; k < n; k++) - for (var i = 0; i < buffer.length; i++) + for (var k = 0; k < n; k++) { + for (var i = 0; i < buffer.length; i++) { assert(buffer[i] === 0); + } + } bench.end(n); } @@ -39,10 +41,11 @@ function benchFor(buffer, n) { function benchForOf(buffer, n) { bench.start(); - for (var k = 0; k < n; k++) - for (var b of buffer) + for (var k = 0; k < n; k++) { + for (var b of buffer) { assert(b === 0); - + } + } bench.end(n); } diff --git a/benchmark/child_process/child-process-read-ipc.js b/benchmark/child_process/child-process-read-ipc.js index 30dead18032f98..e6fb9b19c202dc 100644 --- a/benchmark/child_process/child-process-read-ipc.js +++ b/benchmark/child_process/child-process-read-ipc.js @@ -26,7 +26,7 @@ if (process.argv[2] === 'child') { const options = { 'stdio': ['ignore', 1, 2, 'ipc'] }; const child = spawn(process.argv[0], - [process.argv[1], 'child', len], options); + [process.argv[1], 'child', len], options); var bytes = 0; child.on('message', function(msg) { diff --git a/benchmark/compare.js b/benchmark/compare.js index aa6ddb72c0d054..6b51a70eb9a41b 100644 --- a/benchmark/compare.js +++ b/benchmark/compare.js @@ -20,10 +20,7 @@ const cli = CLI(`usage: ./node compare.js [options] [--] ... --filter pattern string to filter benchmark scripts --set variable=value set benchmark variable (can be repeated) --no-progress don't show benchmark progress indicator -`, { - arrayArgs: ['set'], - boolArgs: ['no-progress'] -}); +`, { arrayArgs: ['set'], boolArgs: ['no-progress'] }); if (!cli.optional.new || !cli.optional.old) { cli.abort(cli.usage); @@ -85,8 +82,8 @@ if (showProgress) { // Escape quotes (") for correct csv formatting conf = conf.replace(/"/g, '""'); - console.log(`"${job.binary}", "${job.filename}", "${conf}", ${ - data.rate}, ${data.time}`); + console.log(`"${job.binary}", "${job.filename}", "${conf}", ` + + `${data.rate}, ${data.time}`); if (showProgress) { // One item in the subqueue has been completed. progress.completeConfig(data); diff --git a/benchmark/dgram/array-vs-concat.js b/benchmark/dgram/array-vs-concat.js index 8b1d34d0e746a4..681abd6afa13e0 100644 --- a/benchmark/dgram/array-vs-concat.js +++ b/benchmark/dgram/array-vs-concat.js @@ -46,17 +46,19 @@ function server() { var onsend = type === 'concat' ? onsendConcat : onsendMulti; function onsendConcat() { - if (sent++ % num === 0) + if (sent++ % num === 0) { for (var i = 0; i < num; i++) { socket.send(Buffer.concat(chunk), PORT, '127.0.0.1', onsend); } + } } function onsendMulti() { - if (sent++ % num === 0) + if (sent++ % num === 0) { for (var i = 0; i < num; i++) { socket.send(chunk, PORT, '127.0.0.1', onsend); } + } } socket.on('listening', function() { diff --git a/benchmark/dgram/multi-buffer.js b/benchmark/dgram/multi-buffer.js index 3277547119c35e..6a7fc9bfaf83ee 100644 --- a/benchmark/dgram/multi-buffer.js +++ b/benchmark/dgram/multi-buffer.js @@ -45,9 +45,11 @@ function server() { var socket = dgram.createSocket('udp4'); function onsend() { - if (sent++ % num === 0) - for (var i = 0; i < num; i++) + if (sent++ % num === 0) { + for (var i = 0; i < num; i++) { socket.send(chunk, PORT, '127.0.0.1', onsend); + } + } } socket.on('listening', function() { diff --git a/benchmark/dgram/offset-length.js b/benchmark/dgram/offset-length.js index 5b7762b21e70e1..b897707ded5e58 100644 --- a/benchmark/dgram/offset-length.js +++ b/benchmark/dgram/offset-length.js @@ -37,9 +37,11 @@ function server() { var socket = dgram.createSocket('udp4'); function onsend() { - if (sent++ % num === 0) - for (var i = 0; i < num; i++) + if (sent++ % num === 0) { + for (var i = 0; i < num; i++) { socket.send(chunk, 0, chunk.length, PORT, '127.0.0.1', onsend); + } + } } socket.on('listening', function() { diff --git a/benchmark/dgram/single-buffer.js b/benchmark/dgram/single-buffer.js index e01b60b4297c1d..8b81d7fbfc0794 100644 --- a/benchmark/dgram/single-buffer.js +++ b/benchmark/dgram/single-buffer.js @@ -37,9 +37,11 @@ function server() { var socket = dgram.createSocket('udp4'); function onsend() { - if (sent++ % num === 0) - for (var i = 0; i < num; i++) + if (sent++ % num === 0) { + for (var i = 0; i < num; i++) { socket.send(chunk, PORT, '127.0.0.1', onsend); + } + } } socket.on('listening', function() { diff --git a/benchmark/events/ee-add-remove.js b/benchmark/events/ee-add-remove.js index 99d85367cb8d6f..1140a81649f9a6 100644 --- a/benchmark/events/ee-add-remove.js +++ b/benchmark/events/ee-add-remove.js @@ -16,10 +16,13 @@ function main(conf) { bench.start(); for (var i = 0; i < n; i += 1) { - for (k = listeners.length; --k >= 0; /* empty */) - ee.on('dummy', listeners[k]); - for (k = listeners.length; --k >= 0; /* empty */) - ee.removeListener('dummy', listeners[k]); + var dummy = (i % 2 === 0) ? 'dummy0' : 'dummy1'; + for (k = listeners.length; --k >= 0; /* empty */) { + ee.on(dummy, listeners[k]); + } + for (k = listeners.length; --k >= 0; /* empty */) { + ee.removeListener(dummy, listeners[k]); + } } bench.end(n); } diff --git a/benchmark/events/ee-listener-count-on-prototype.js b/benchmark/events/ee-listener-count-on-prototype.js index dfe7e27cd09144..269fd5a493ee34 100644 --- a/benchmark/events/ee-listener-count-on-prototype.js +++ b/benchmark/events/ee-listener-count-on-prototype.js @@ -9,12 +9,15 @@ function main(conf) { var ee = new EventEmitter(); - for (var k = 0; k < 10; k += 1) - ee.on('dummy', function() {}); + for (var k = 0; k < 5; k += 1) { + ee.on('dummy0', function() {}); + ee.on('dummy1', function() {}); + } bench.start(); for (var i = 0; i < n; i += 1) { - ee.listenerCount('dummy'); + var dummy = (i % 2 === 0) ? 'dummy0' : 'dummy1'; + ee.listenerCount(dummy); } bench.end(n); } diff --git a/benchmark/events/ee-listeners-many.js b/benchmark/events/ee-listeners-many.js index 063732e1facb4b..09e533de32bf9a 100644 --- a/benchmark/events/ee-listeners-many.js +++ b/benchmark/events/ee-listeners-many.js @@ -10,12 +10,15 @@ function main(conf) { var ee = new EventEmitter(); ee.setMaxListeners(101); - for (var k = 0; k < 100; k += 1) - ee.on('dummy', function() {}); + for (var k = 0; k < 50; k += 1) { + ee.on('dummy0', function() {}); + ee.on('dummy1', function() {}); + } bench.start(); for (var i = 0; i < n; i += 1) { - ee.listeners('dummy'); + var dummy = (i % 2 === 0) ? 'dummy0' : 'dummy1'; + ee.listeners(dummy); } bench.end(n); } diff --git a/benchmark/events/ee-listeners.js b/benchmark/events/ee-listeners.js index e91ca5078f5f98..56c0e85dad41a4 100644 --- a/benchmark/events/ee-listeners.js +++ b/benchmark/events/ee-listeners.js @@ -9,12 +9,15 @@ function main(conf) { var ee = new EventEmitter(); - for (var k = 0; k < 10; k += 1) - ee.on('dummy', function() {}); + for (var k = 0; k < 5; k += 1) { + ee.on('dummy0', function() {}); + ee.on('dummy1', function() {}); + } bench.start(); for (var i = 0; i < n; i += 1) { - ee.listeners('dummy'); + var dummy = (i % 2 === 0) ? 'dummy0' : 'dummy1'; + ee.listeners(dummy); } bench.end(n); } diff --git a/benchmark/events/ee-once.js b/benchmark/events/ee-once.js index 29ea562c406549..56f7fb9e7c3a9e 100644 --- a/benchmark/events/ee-once.js +++ b/benchmark/events/ee-once.js @@ -13,8 +13,9 @@ function main(conf) { bench.start(); for (var i = 0; i < n; i += 1) { - ee.once('dummy', listener); - ee.emit('dummy'); + var dummy = (i % 2 === 0) ? 'dummy0' : 'dummy1'; + ee.once(dummy, listener); + ee.emit(dummy); } bench.end(n); } diff --git a/benchmark/fixtures/simple-http-server.js b/benchmark/fixtures/simple-http-server.js index 1dda98e9f2d9c1..854d249ac803e0 100644 --- a/benchmark/fixtures/simple-http-server.js +++ b/benchmark/fixtures/simple-http-server.js @@ -27,13 +27,14 @@ module.exports = http.createServer(function(req, res) { dom.add(res); } - // URL format: //// + // URL format: /////chunkedEnc var params = req.url.split('/'); var command = params[1]; var body = ''; var arg = params[2]; var n_chunks = parseInt(params[3], 10); var resHow = (params.length >= 5 ? params[4] : 'normal'); + var chunkedEnc = (params.length >= 6 && params[5] === 'false' ? false : true); var status = 200; var n, i; @@ -95,48 +96,43 @@ module.exports = http.createServer(function(req, res) { // example: http://localhost:port/bytes/512/4 // sends a 512 byte body in 4 chunks of 128 bytes - if (n_chunks > 0) { - switch (resHow) { - case 'setHeader': - res.statusCode = status; - res.setHeader('Content-Type', 'text/plain'); + var len = body.length; + switch (resHow) { + case 'setHeader': + res.statusCode = status; + res.setHeader('Content-Type', 'text/plain'); + if (chunkedEnc) res.setHeader('Transfer-Encoding', 'chunked'); - break; - case 'setHeaderWH': - res.setHeader('Content-Type', 'text/plain'); + else + res.setHeader('Content-Length', len.toString()); + break; + case 'setHeaderWH': + res.setHeader('Content-Type', 'text/plain'); + if (chunkedEnc) res.writeHead(status, { 'Transfer-Encoding': 'chunked' }); - break; - default: + else + res.writeHead(status, { 'Content-Length': len.toString() }); + break; + default: + if (chunkedEnc) { res.writeHead(status, { 'Content-Type': 'text/plain', 'Transfer-Encoding': 'chunked' }); - } - // send body in chunks - var len = body.length; + } else { + res.writeHead(status, { + 'Content-Type': 'text/plain', + 'Content-Length': len.toString() + }); + } + } + // send body in chunks + if (n_chunks > 1) { var step = Math.floor(len / n_chunks) || 1; - - for (i = 0, n = (n_chunks - 1); i < n; ++i) { + for (i = 0, n = (n_chunks - 1); i < n; ++i) res.write(body.slice(i * step, i * step + step)); - } res.end(body.slice((n_chunks - 1) * step)); } else { - switch (resHow) { - case 'setHeader': - res.statusCode = status; - res.setHeader('Content-Type', 'text/plain'); - res.setHeader('Content-Length', body.length.toString()); - break; - case 'setHeaderWH': - res.setHeader('Content-Type', 'text/plain'); - res.writeHead(status, { 'Content-Length': body.length.toString() }); - break; - default: - res.writeHead(status, { - 'Content-Type': 'text/plain', - 'Content-Length': body.length.toString() - }); - } res.end(body); } }); diff --git a/benchmark/http/_chunky_http_client.js b/benchmark/http/_chunky_http_client.js index e9ba435f11c454..d7c4e193c8c3c9 100644 --- a/benchmark/http/_chunky_http_client.js +++ b/benchmark/http/_chunky_http_client.js @@ -3,7 +3,6 @@ // test HTTP throughput in fragmented header case var common = require('../common.js'); var net = require('net'); -var test = require('../../test/common'); var bench = common.createBenchmark(main, { len: [1, 4, 8, 16, 32, 64, 128], @@ -56,7 +55,7 @@ function main(conf) { var mult = 17; var add = 11; var count = 0; - var PIPE = test.PIPE; + var PIPE = process.env.PIPE_NAME; var socket = net.connect(PIPE, function() { bench.start(); WriteHTTPHeaders(socket, 1, len); diff --git a/benchmark/http/http_server_for_chunky_client.js b/benchmark/http/http_server_for_chunky_client.js index 04d5a2c4a02530..cc632c02ec4222 100644 --- a/benchmark/http/http_server_for_chunky_client.js +++ b/benchmark/http/http_server_for_chunky_client.js @@ -1,24 +1,22 @@ 'use strict'; var assert = require('assert'); -var path = require('path'); var http = require('http'); var fs = require('fs'); -var fork = require('child_process').fork; +var { fork } = require('child_process'); var common = require('../common.js'); -var test = require('../../test/common'); -var pep = `${path.dirname(process.argv[1])}/_chunky_http_client.js`; -var PIPE = test.PIPE; +const { PIPE, tmpDir } = require('../../test/common'); +process.env.PIPE_NAME = PIPE; try { - fs.accessSync(test.tmpDir, fs.F_OK); + fs.accessSync(tmpDir, fs.F_OK); } catch (e) { - fs.mkdirSync(test.tmpDir); + fs.mkdirSync(tmpDir); } var server; try { - fs.unlinkSync(PIPE); + fs.unlinkSync(process.env.PIPE_NAME); } catch (e) { /* ignore */ } server = http.createServer(function(req, res) { @@ -33,10 +31,12 @@ server = http.createServer(function(req, res) { server.on('error', function(err) { throw new Error(`server error: ${err}`); }); - server.listen(PIPE); -var child = fork(pep, process.argv.slice(2)); +const child = fork( + `${__dirname}/_chunky_http_client.js`, + process.argv.slice(2) +); child.on('message', common.sendResult); child.on('close', function(code) { server.close(); diff --git a/benchmark/http/simple.js b/benchmark/http/simple.js index 81b7cb5afb2614..6dc69a2d8f6e85 100644 --- a/benchmark/http/simple.js +++ b/benchmark/http/simple.js @@ -6,8 +6,9 @@ var bench = common.createBenchmark(main, { // unicode confuses ab on os x. type: ['bytes', 'buffer'], len: [4, 1024, 102400], - chunks: [0, 1, 4], // chunks=0 means 'no chunked encoding'. + chunks: [1, 4], c: [50, 500], + chunkedEnc: ['true', 'false'], res: ['normal', 'setHeader', 'setHeaderWH'] }); @@ -16,7 +17,8 @@ function main(conf) { var server = require('../fixtures/simple-http-server.js') .listen(process.env.PORT || common.PORT) .on('listening', function() { - var path = `/${conf.type}/${conf.len}/${conf.chunks}/${conf.res}`; + var path = + `/${conf.type}/${conf.len}/${conf.chunks}/${conf.res}/${conf.chunkedEnc}`; bench.http({ path: path, diff --git a/benchmark/process/next-tick-depth-args.js b/benchmark/process/next-tick-depth-args.js index 066b4837856f60..06bea4676b3615 100644 --- a/benchmark/process/next-tick-depth-args.js +++ b/benchmark/process/next-tick-depth-args.js @@ -2,7 +2,7 @@ var common = require('../common.js'); var bench = common.createBenchmark(main, { - millions: [2] + millions: [12] }); process.maxTickDepth = Infinity; diff --git a/benchmark/process/next-tick-depth.js b/benchmark/process/next-tick-depth.js index bc513d338d6d8c..824b7a8b69df86 100644 --- a/benchmark/process/next-tick-depth.js +++ b/benchmark/process/next-tick-depth.js @@ -1,7 +1,7 @@ 'use strict'; var common = require('../common.js'); var bench = common.createBenchmark(main, { - millions: [2] + millions: [12] }); process.maxTickDepth = Infinity; diff --git a/benchmark/run.js b/benchmark/run.js index 2b263a1a6cb573..af2bd4d5c2bcec 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -11,9 +11,7 @@ const cli = CLI(`usage: ./node run.js [options] [--] ... --filter pattern string to filter benchmark scripts --set variable=value set benchmark variable (can be repeated) --format [simple|csv] optional value that specifies the output format -`, { - arrayArgs: ['set'] -}); +`, { arrayArgs: ['set'] }); const benchmarks = cli.benchmarks(); if (benchmarks.length === 0) { diff --git a/benchmark/scatter.js b/benchmark/scatter.js index 306d06132f3254..70c3e25bb9f2ad 100644 --- a/benchmark/scatter.js +++ b/benchmark/scatter.js @@ -13,9 +13,7 @@ const cli = CLI(`usage: ./node scatter.js [options] [--] --runs 30 number of samples --set variable=value set benchmark variable (can be repeated) -`, { - arrayArgs: ['set'] -}); +`, { arrayArgs: ['set'] }); if (cli.items.length !== 1) { cli.abort(cli.usage); diff --git a/benchmark/streams/transform-creation.js b/benchmark/streams/transform-creation.js new file mode 100644 index 00000000000000..0bc383d9aad876 --- /dev/null +++ b/benchmark/streams/transform-creation.js @@ -0,0 +1,23 @@ +'use strict'; +var common = require('../common.js'); +var Transform = require('stream').Transform; +var inherits = require('util').inherits; + +var bench = common.createBenchmark(main, { + n: [1e6] +}); + +function MyTransform() { + Transform.call(this); +} +inherits(MyTransform, Transform); +MyTransform.prototype._transform = function() {}; + +function main(conf) { + var n = +conf.n; + + bench.start(); + for (var i = 0; i < n; ++i) + new MyTransform(); + bench.end(n); +} diff --git a/benchmark/url/url-searchparams-iteration.js b/benchmark/url/url-searchparams-iteration.js index 833271ef306309..89919af7255184 100644 --- a/benchmark/url/url-searchparams-iteration.js +++ b/benchmark/url/url-searchparams-iteration.js @@ -32,11 +32,12 @@ function iterator(n) { const noDead = []; bench.start(); - for (var i = 0; i < n; i += 1) + for (var i = 0; i < n; i += 1) { for (var pair of params) { noDead[0] = pair[0]; noDead[1] = pair[1]; } + } bench.end(n); assert.strictEqual(noDead[0], 'three'); diff --git a/benchmark/util/inspect-proxy.js b/benchmark/util/inspect-proxy.js index 92d5a9a47d6dcb..805c520e28745c 100644 --- a/benchmark/util/inspect-proxy.js +++ b/benchmark/util/inspect-proxy.js @@ -9,7 +9,7 @@ const bench = common.createBenchmark(main, { }); function twoDifferentProxies(n) { - // This one should be slower between we're looking up multiple proxies. + // This one should be slower because we're looking up multiple proxies. const proxyA = new Proxy({}, {get: () => {}}); const proxyB = new Proxy({}, {get: () => {}}); bench.start(); diff --git a/configure b/configure index 4fd97f25894448..9a0855b49ad2e0 100755 --- a/configure +++ b/configure @@ -288,6 +288,11 @@ parser.add_option('--enable-d8', dest='enable_d8', help=optparse.SUPPRESS_HELP) # Unsupported, undocumented. +parser.add_option('--enable-trace-maps', + action='store_true', + dest='trace_maps', + help='Enable the --trace-maps flag in V8 (use at your own risk)') + parser.add_option('--v8-options', action='store', dest='v8_options', @@ -956,6 +961,7 @@ def configure_v8(o): o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables. o['variables']['v8_promise_internal_field_count'] = 1 # Add internal field to promises for async hooks. o['variables']['v8_use_snapshot'] = b(options.with_snapshot) + o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0 o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform) o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8) o['variables']['force_dynamic_crt'] = 1 if options.shared else 0 @@ -979,12 +985,18 @@ def configure_openssl(o): o['variables']['openssl_fips'] = options.openssl_fips fips_dir = os.path.join(root_dir, 'deps', 'openssl', 'fips') fips_ld = os.path.abspath(os.path.join(fips_dir, 'fipsld')) + # LINK is for Makefiles, LD/LDXX is for ninja o['make_fips_settings'] = [ ['LINK', fips_ld + ' <(openssl_fips)/bin/fipsld'], + ['LD', fips_ld + ' <(openssl_fips)/bin/fipsld'], + ['LDXX', fips_ld + ' <(openssl_fips)/bin/fipsld'], ] else: o['variables']['openssl_fips'] = '' - + try: + os.remove('config_fips.gypi') + except OSError: + pass if options.without_ssl: def without_ssl_error(option): @@ -1281,7 +1293,6 @@ def configure_intl(o): 'stubdata': 'stubdata', 'common': 'common', 'i18n': 'i18n', - 'io': 'io', 'tools': 'tools/toolutil', 'genccode': 'tools/genccode', 'genrb': 'tools/genrb', diff --git a/deps/icu-small/source/io/io.rc b/deps/icu-small/source/io/io.rc deleted file mode 100644 index 94db3ebd0f4a62..00000000000000 --- a/deps/icu-small/source/io/io.rc +++ /dev/null @@ -1,109 +0,0 @@ -// Do not edit with Microsoft Developer Studio Resource Editor. -// It will permanently substitute version numbers that are intended to be -// picked up by the pre-processor during each build. -// Copyright (C) 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -// Copyright (c) 2001-2010 International Business Machines -// Corporation and others. All Rights Reserved. -// -#include "../common/msvcres.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// - -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1252) - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "../../common/msvcres.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include \0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// -#define STR(s) #s -#define CommaVersionString(a, b, c, d) STR(a) ", " STR(b) ", " STR(c) ", " STR(d) "\0" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM, U_ICU_VERSION_PATCHLEVEL_NUM, U_ICU_VERSION_BUILDLEVEL_NUM - PRODUCTVERSION U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM, U_ICU_VERSION_PATCHLEVEL_NUM, U_ICU_VERSION_BUILDLEVEL_NUM - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "00000000" - BEGIN - VALUE "Comments", ICU_WEBSITE "\0" - VALUE "CompanyName", ICU_COMPANY "\0" - VALUE "FileDescription", ICU_PRODUCT_PREFIX " I/O DLL\0" - VALUE "FileVersion", CommaVersionString(U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM, U_ICU_VERSION_PATCHLEVEL_NUM, U_ICU_VERSION_BUILDLEVEL_NUM) - VALUE "LegalCopyright", U_COPYRIGHT_STRING "\0" -#ifdef _DEBUG - VALUE "OriginalFilename", "icuio" U_ICU_VERSION_SHORT "d.dll\0" -#else - VALUE "OriginalFilename", "icuio" U_ICU_VERSION_SHORT ".dll\0" -#endif - VALUE "PrivateBuild", "\0" - VALUE "ProductName", ICU_PRODUCT "\0" - VALUE "ProductVersion", CommaVersionString(U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM, U_ICU_VERSION_PATCHLEVEL_NUM, U_ICU_VERSION_BUILDLEVEL_NUM) - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x000, 0000 - END -END - -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED diff --git a/deps/icu-small/source/io/locbund.cpp b/deps/icu-small/source/io/locbund.cpp deleted file mode 100644 index f15788ee195599..00000000000000 --- a/deps/icu-small/source/io/locbund.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -******************************************************************************* -* -* Copyright (C) 1998-2014, International Business Machines -* Corporation and others. All Rights Reserved. -* -******************************************************************************* -* -* File locbund.cpp -* -* Modification History: -* -* Date Name Description -* 11/18/98 stephen Creation. -* 12/10/1999 bobbyr(at)optiosoftware.com Fix for memory leak + string allocation bugs -******************************************************************************* -*/ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION - -#include "locbund.h" - -#include "cmemory.h" -#include "cstring.h" -#include "ucln_io.h" -#include "mutex.h" -#include "umutex.h" -#include "unicode/ustring.h" -#include "unicode/uloc.h" - -static UNumberFormat *gPosixNumberFormat[ULOCALEBUNDLE_NUMBERFORMAT_COUNT]; - -U_CDECL_BEGIN -static UBool U_CALLCONV locbund_cleanup(void) { - int32_t style; - for (style = 0; style < ULOCALEBUNDLE_NUMBERFORMAT_COUNT; style++) { - unum_close(gPosixNumberFormat[style]); - gPosixNumberFormat[style] = NULL; - } - return TRUE; -} -U_CDECL_END - -static UMutex gLock = U_MUTEX_INITIALIZER; -static inline UNumberFormat * copyInvariantFormatter(ULocaleBundle *result, UNumberFormatStyle style) { - U_NAMESPACE_USE - Mutex lock(&gLock); - if (result->fNumberFormat[style-1] == NULL) { - if (gPosixNumberFormat[style-1] == NULL) { - UErrorCode status = U_ZERO_ERROR; - UNumberFormat *formatAlias = unum_open(style, NULL, 0, "en_US_POSIX", NULL, &status); - if (U_SUCCESS(status)) { - gPosixNumberFormat[style-1] = formatAlias; - ucln_io_registerCleanup(UCLN_IO_LOCBUND, locbund_cleanup); - } - } - /* Copy the needed formatter. */ - if (gPosixNumberFormat[style-1] != NULL) { - UErrorCode status = U_ZERO_ERROR; - result->fNumberFormat[style-1] = unum_clone(gPosixNumberFormat[style-1], &status); - } - } - return result->fNumberFormat[style-1]; -} - -U_CAPI ULocaleBundle * -u_locbund_init(ULocaleBundle *result, const char *loc) -{ - int32_t len; - - if(result == 0) - return 0; - - if (loc == NULL) { - loc = uloc_getDefault(); - } - - uprv_memset(result, 0, sizeof(ULocaleBundle)); - - len = (int32_t)strlen(loc); - result->fLocale = (char*) uprv_malloc(len + 1); - if(result->fLocale == 0) { - return 0; - } - - uprv_strcpy(result->fLocale, loc); - - result->isInvariantLocale = uprv_strcmp(result->fLocale, "en_US_POSIX") == 0; - - return result; -} - -/*U_CAPI ULocaleBundle * -u_locbund_new(const char *loc) -{ - ULocaleBundle *result = (ULocaleBundle*) uprv_malloc(sizeof(ULocaleBundle)); - return u_locbund_init(result, loc); -} - -U_CAPI ULocaleBundle * -u_locbund_clone(const ULocaleBundle *bundle) -{ - ULocaleBundle *result = (ULocaleBundle*)uprv_malloc(sizeof(ULocaleBundle)); - UErrorCode status = U_ZERO_ERROR; - int32_t styleIdx; - - if(result == 0) - return 0; - - result->fLocale = (char*) uprv_malloc(strlen(bundle->fLocale) + 1); - if(result->fLocale == 0) { - uprv_free(result); - return 0; - } - - strcpy(result->fLocale, bundle->fLocale ); - - for (styleIdx = 0; styleIdx < ULOCALEBUNDLE_NUMBERFORMAT_COUNT; styleIdx++) { - status = U_ZERO_ERROR; - if (result->fNumberFormat[styleIdx]) { - result->fNumberFormat[styleIdx] = unum_clone(bundle->fNumberFormat[styleIdx], &status); - if (U_FAILURE(status)) { - result->fNumberFormat[styleIdx] = NULL; - } - } - else { - result->fNumberFormat[styleIdx] = NULL; - } - } - result->fDateFormat = (bundle->fDateFormat == 0 ? 0 : - udat_clone(bundle->fDateFormat, &status)); - result->fTimeFormat = (bundle->fTimeFormat == 0 ? 0 : - udat_clone(bundle->fTimeFormat, &status)); - - return result; -}*/ - -U_CAPI void -u_locbund_close(ULocaleBundle *bundle) -{ - int32_t styleIdx; - - uprv_free(bundle->fLocale); - - for (styleIdx = 0; styleIdx < ULOCALEBUNDLE_NUMBERFORMAT_COUNT; styleIdx++) { - if (bundle->fNumberFormat[styleIdx]) { - unum_close(bundle->fNumberFormat[styleIdx]); - } - } - - uprv_memset(bundle, 0, sizeof(ULocaleBundle)); -/* uprv_free(bundle);*/ -} - -U_CAPI UNumberFormat * -u_locbund_getNumberFormat(ULocaleBundle *bundle, UNumberFormatStyle style) -{ - UNumberFormat *formatAlias = NULL; - if (style > UNUM_IGNORE) { - formatAlias = bundle->fNumberFormat[style-1]; - if (formatAlias == NULL) { - if (bundle->isInvariantLocale) { - formatAlias = copyInvariantFormatter(bundle, style); - } - else { - UErrorCode status = U_ZERO_ERROR; - formatAlias = unum_open(style, NULL, 0, bundle->fLocale, NULL, &status); - if (U_FAILURE(status)) { - unum_close(formatAlias); - formatAlias = NULL; - } - else { - bundle->fNumberFormat[style-1] = formatAlias; - } - } - } - } - return formatAlias; -} - -#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/io/locbund.h b/deps/icu-small/source/io/locbund.h deleted file mode 100644 index 5879e28f0154dc..00000000000000 --- a/deps/icu-small/source/io/locbund.h +++ /dev/null @@ -1,82 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -******************************************************************************* -* -* Copyright (C) 1998-2011, International Business Machines -* Corporation and others. All Rights Reserved. -* -******************************************************************************* -* -* File locbund.h -* -* Modification History: -* -* Date Name Description -* 10/16/98 stephen Creation. -* 02/25/99 stephen Modified for new C API. -******************************************************************************* -*/ - -#ifndef LOCBUND_H -#define LOCBUND_H - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING - -#include "unicode/unum.h" - -#define ULOCALEBUNDLE_NUMBERFORMAT_COUNT ((int32_t)UNUM_SPELLOUT) - -typedef struct ULocaleBundle { - char *fLocale; - - UNumberFormat *fNumberFormat[ULOCALEBUNDLE_NUMBERFORMAT_COUNT]; - UBool isInvariantLocale; -} ULocaleBundle; - - -/** - * Initialize a ULocaleBundle, initializing all formatters to 0. - * @param result A ULocaleBundle to initialize. - * @param loc The locale of the ULocaleBundle. - * @return A pointer to a ULocaleBundle, or 0 if loc was invalid. - */ -U_CAPI ULocaleBundle * -u_locbund_init(ULocaleBundle *result, const char *loc); - -/** - * Create a new ULocaleBundle, initializing all formatters to 0. - * @param loc The locale of the ULocaleBundle. - * @return A pointer to a ULocaleBundle, or 0 if loc was invalid. - */ -/*U_CAPI ULocaleBundle * -u_locbund_new(const char *loc);*/ - -/** - * Create a deep copy of this ULocaleBundle; - * @param bundle The ULocaleBundle to clone. - * @return A new ULocaleBundle. - */ -/*U_CAPI ULocaleBundle * -u_locbund_clone(const ULocaleBundle *bundle);*/ - -/** - * Delete the specified ULocaleBundle, freeing all associated memory. - * @param bundle The ULocaleBundle to delete - */ -U_CAPI void -u_locbund_close(ULocaleBundle *bundle); - -/** - * Get the NumberFormat used to format and parse numbers in a ULocaleBundle. - * @param bundle The ULocaleBundle to use - * @return A pointer to the NumberFormat used for number formatting and parsing. - */ -U_CAPI UNumberFormat * -u_locbund_getNumberFormat(ULocaleBundle *bundle, UNumberFormatStyle style); - -#endif /* #if !UCONFIG_NO_FORMATTING */ - -#endif diff --git a/deps/icu-small/source/io/sprintf.cpp b/deps/icu-small/source/io/sprintf.cpp deleted file mode 100644 index 20b9e52a217fe7..00000000000000 --- a/deps/icu-small/source/io/sprintf.cpp +++ /dev/null @@ -1,261 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* -* Copyright (C) 2001-2014, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* File sprintf.c -* -* Modification History: -* -* Date Name Description -* 02/08/2001 george Creation. Copied from uprintf.c -* 03/27/2002 Mark Schneckloth Many fixes regarding alignment, null termination -* (mschneckloth@atomz.com) and other various problems. -* 08/07/2003 george Reunify printf implementations -******************************************************************************* -*/ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION - -#include "unicode/ustdio.h" -#include "unicode/ustring.h" -#include "unicode/putil.h" - -#include "uprintf.h" -#include "locbund.h" - -#include "cmemory.h" -#include - -/* u_minstrncpy copies the minimum number of code units of (count or output->available) */ -static int32_t -u_sprintf_write(void *context, - const UChar *str, - int32_t count) -{ - u_localized_print_string *output = (u_localized_print_string *)context; - int32_t size = ufmt_min(count, output->available); - - u_strncpy(output->str + (output->len - output->available), str, size); - output->available -= size; - return size; -} - -static int32_t -u_sprintf_pad_and_justify(void *context, - const u_printf_spec_info *info, - const UChar *result, - int32_t resultLen) -{ - u_localized_print_string *output = (u_localized_print_string *)context; - int32_t written = 0; - int32_t lengthOfResult = resultLen; - - resultLen = ufmt_min(resultLen, output->available); - - /* pad and justify, if needed */ - if(info->fWidth != -1 && resultLen < info->fWidth) { - int32_t paddingLeft = info->fWidth - resultLen; - int32_t outputPos = output->len - output->available; - - if (paddingLeft + resultLen > output->available) { - paddingLeft = output->available - resultLen; - if (paddingLeft < 0) { - paddingLeft = 0; - } - /* paddingLeft = output->available - resultLen;*/ - } - written += paddingLeft; - - /* left justify */ - if(info->fLeft) { - written += u_sprintf_write(output, result, resultLen); - u_memset(&output->str[outputPos + resultLen], info->fPadChar, paddingLeft); - output->available -= paddingLeft; - } - /* right justify */ - else { - u_memset(&output->str[outputPos], info->fPadChar, paddingLeft); - output->available -= paddingLeft; - written += u_sprintf_write(output, result, resultLen); - } - } - /* just write the formatted output */ - else { - written = u_sprintf_write(output, result, resultLen); - } - - if (written >= 0 && lengthOfResult > written) { - return lengthOfResult; - } - - return written; -} - -U_CAPI int32_t U_EXPORT2 -u_sprintf(UChar *buffer, - const char *patternSpecification, - ... ) -{ - va_list ap; - int32_t written; - - va_start(ap, patternSpecification); - written = u_vsnprintf(buffer, INT32_MAX, patternSpecification, ap); - va_end(ap); - - return written; -} - -U_CAPI int32_t U_EXPORT2 -u_sprintf_u(UChar *buffer, - const UChar *patternSpecification, - ... ) -{ - va_list ap; - int32_t written; - - va_start(ap, patternSpecification); - written = u_vsnprintf_u(buffer, INT32_MAX, patternSpecification, ap); - va_end(ap); - - return written; -} - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_vsprintf(UChar *buffer, - const char *patternSpecification, - va_list ap) -{ - return u_vsnprintf(buffer, INT32_MAX, patternSpecification, ap); -} - -U_CAPI int32_t U_EXPORT2 -u_snprintf(UChar *buffer, - int32_t count, - const char *patternSpecification, - ... ) -{ - va_list ap; - int32_t written; - - va_start(ap, patternSpecification); - written = u_vsnprintf(buffer, count, patternSpecification, ap); - va_end(ap); - - return written; -} - -U_CAPI int32_t U_EXPORT2 -u_snprintf_u(UChar *buffer, - int32_t count, - const UChar *patternSpecification, - ... ) -{ - va_list ap; - int32_t written; - - va_start(ap, patternSpecification); - written = u_vsnprintf_u(buffer, count, patternSpecification, ap); - va_end(ap); - - return written; -} - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_vsnprintf(UChar *buffer, - int32_t count, - const char *patternSpecification, - va_list ap) -{ - int32_t written; - UChar *pattern; - UChar patBuffer[UFMT_DEFAULT_BUFFER_SIZE]; - int32_t size = (int32_t)strlen(patternSpecification) + 1; - - /* convert from the default codepage to Unicode */ - if (size >= (int32_t)MAX_UCHAR_BUFFER_SIZE(patBuffer)) { - pattern = (UChar *)uprv_malloc(size * sizeof(UChar)); - if(pattern == 0) { - return 0; - } - } - else { - pattern = patBuffer; - } - u_charsToUChars(patternSpecification, pattern, size); - - /* do the work */ - written = u_vsnprintf_u(buffer, count, pattern, ap); - - /* clean up */ - if (pattern != patBuffer) { - uprv_free(pattern); - } - - return written; -} - -U_CAPI int32_t U_EXPORT2 -u_vsprintf_u(UChar *buffer, - const UChar *patternSpecification, - va_list ap) -{ - return u_vsnprintf_u(buffer, INT32_MAX, patternSpecification, ap); -} - -static const u_printf_stream_handler g_sprintf_stream_handler = { - u_sprintf_write, - u_sprintf_pad_and_justify -}; - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_vsnprintf_u(UChar *buffer, - int32_t count, - const UChar *patternSpecification, - va_list ap) -{ - int32_t written = 0; /* haven't written anything yet */ - int32_t result = 0; /* test the return value of u_printf_parse */ - - u_localized_print_string outStr; - - if (count < 0) { - count = INT32_MAX; - } - - outStr.str = buffer; - outStr.len = count; - outStr.available = count; - - if(u_locbund_init(&outStr.fBundle, "en_US_POSIX") == 0) { - return 0; - } - - /* parse and print the whole format string */ - result = u_printf_parse(&g_sprintf_stream_handler, patternSpecification, &outStr, &outStr, &outStr.fBundle, &written, ap); - - /* Terminate the buffer, if there's room. */ - if (outStr.available > 0) { - buffer[outStr.len - outStr.available] = 0x0000; - } - - /* Release the cloned bundle, if we cloned it. */ - u_locbund_close(&outStr.fBundle); - - /* parsing error */ - if (result < 0) { - return result; - } - /* return # of UChars written */ - return written; -} - -#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/io/sscanf.cpp b/deps/icu-small/source/io/sscanf.cpp deleted file mode 100644 index 5409ebb7162ca6..00000000000000 --- a/deps/icu-small/source/io/sscanf.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* -* Copyright (C) 2000-2014, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* File sscanf.c -* -* Modification History: -* -* Date Name Description -* 02/08/00 george Creation. Copied from uscanf.c -****************************************************************************** -*/ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION - -#include "unicode/putil.h" -#include "unicode/ustdio.h" -#include "unicode/ustring.h" -#include "uscanf.h" -#include "ufile.h" -#include "ufmt_cmn.h" - -#include "cmemory.h" -#include "cstring.h" - - -U_CAPI int32_t U_EXPORT2 -u_sscanf(const UChar *buffer, - const char *patternSpecification, - ... ) -{ - va_list ap; - int32_t converted; - - va_start(ap, patternSpecification); - converted = u_vsscanf(buffer, patternSpecification, ap); - va_end(ap); - - return converted; -} - -U_CAPI int32_t U_EXPORT2 -u_sscanf_u(const UChar *buffer, - const UChar *patternSpecification, - ... ) -{ - va_list ap; - int32_t converted; - - va_start(ap, patternSpecification); - converted = u_vsscanf_u(buffer, patternSpecification, ap); - va_end(ap); - - return converted; -} - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_vsscanf(const UChar *buffer, - const char *patternSpecification, - va_list ap) -{ - int32_t converted; - UChar *pattern; - UChar patBuffer[UFMT_DEFAULT_BUFFER_SIZE]; - int32_t size = (int32_t)uprv_strlen(patternSpecification) + 1; - - /* convert from the default codepage to Unicode */ - if (size >= (int32_t)MAX_UCHAR_BUFFER_SIZE(patBuffer)) { - pattern = (UChar *)uprv_malloc(size * sizeof(UChar)); - if(pattern == 0) { - return 0; - } - } - else { - pattern = patBuffer; - } - u_charsToUChars(patternSpecification, pattern, size); - - /* do the work */ - converted = u_vsscanf_u(buffer, pattern, ap); - - /* clean up */ - if (pattern != patBuffer) { - uprv_free(pattern); - } - - return converted; -} - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_vsscanf_u(const UChar *buffer, - const UChar *patternSpecification, - va_list ap) -{ - int32_t converted; - UFILE inStr; - - inStr.fConverter = NULL; - inStr.fFile = NULL; - inStr.fOwnFile = FALSE; -#if !UCONFIG_NO_TRANSLITERATION - inStr.fTranslit = NULL; -#endif - inStr.fUCBuffer[0] = 0; - inStr.str.fBuffer = (UChar *)buffer; - inStr.str.fPos = (UChar *)buffer; - inStr.str.fLimit = buffer + u_strlen(buffer); - - if(u_locbund_init(&inStr.str.fBundle, "en_US_POSIX") == 0) { - return 0; - } - - converted = u_scanf_parse(&inStr, patternSpecification, ap); - - u_locbund_close(&inStr.str.fBundle); - - /* return # of items converted */ - return converted; -} - -#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/io/ucln_io.cpp b/deps/icu-small/source/io/ucln_io.cpp deleted file mode 100644 index 388abbb4e955be..00000000000000 --- a/deps/icu-small/source/io/ucln_io.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* * -* Copyright (C) 2001-2014, International Business Machines * -* Corporation and others. All Rights Reserved. * -* * -****************************************************************************** -* file name: ucln_io.cpp -* encoding: UTF-8 -* tab size: 8 (not used) -* indentation:4 -* -* created on: 2006August11 -* created by: George Rhoten -*/ - -#include "mutex.h" -#include "ucln.h" -#include "ucln_io.h" -#include "uassert.h" - -#ifndef U_IO_IMPLEMENTATION -#error U_IO_IMPLEMENTATION not set - must be set for all ICU source files in io/ - see http://userguide.icu-project.org/howtouseicu -#endif - - -/** Auto-client */ -#define UCLN_TYPE UCLN_IO -#include "ucln_imp.h" - -/* Leave this copyright notice here! It needs to go somewhere in this library. */ -static const char copyright[] = U_COPYRIGHT_STRING; - -static cleanupFunc *gCleanupFunctions[UCLN_IO_COUNT]; - -static UBool U_CALLCONV io_cleanup(void) -{ - int32_t libType = UCLN_IO_START; - - (void)copyright; // Suppress unused variable warning. - while (++libType header unless __STRICT_ANSI__ is defined. -// __GNUC__ is set by both gcc and clang. -#undef __STRICT_ANSI__ -#endif - -#include "locmap.h" -#include "unicode/ustdio.h" - -#if !UCONFIG_NO_CONVERSION - -#include - -#include "ufile.h" -#include "unicode/uloc.h" -#include "unicode/ures.h" -#include "unicode/ucnv.h" -#include "unicode/ustring.h" -#include "cstring.h" -#include "cmemory.h" - -#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(fileno) -/* Windows likes to rename Unix-like functions */ -#define fileno _fileno -#endif - -static UFILE* -finit_owner(FILE *f, - const char *locale, - const char *codepage, - UBool takeOwnership - ) -{ - UErrorCode status = U_ZERO_ERROR; - UFILE *result; - if(f == NULL) { - return 0; - } - result = (UFILE*) uprv_malloc(sizeof(UFILE)); - if(result == NULL) { - return 0; - } - - uprv_memset(result, 0, sizeof(UFILE)); - result->fFileno = fileno(f); - result->fFile = f; - - result->str.fBuffer = result->fUCBuffer; - result->str.fPos = result->fUCBuffer; - result->str.fLimit = result->fUCBuffer; - -#if !UCONFIG_NO_FORMATTING - /* if locale is 0, use the default */ - if(u_locbund_init(&result->str.fBundle, locale) == 0) { - /* DO NOT FCLOSE HERE! */ - uprv_free(result); - return 0; - } -#endif - - /* If the codepage is not "" use the ucnv_open default behavior */ - if(codepage == NULL || *codepage != '\0') { - result->fConverter = ucnv_open(codepage, &status); - } - /* else result->fConverter is already memset'd to NULL. */ - - if(U_SUCCESS(status)) { - result->fOwnFile = takeOwnership; - } - else { -#if !UCONFIG_NO_FORMATTING - u_locbund_close(&result->str.fBundle); -#endif - /* DO NOT fclose here!!!!!! */ - uprv_free(result); - result = NULL; - } - - return result; -} - -U_CAPI UFILE* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_finit(FILE *f, - const char *locale, - const char *codepage) -{ - return finit_owner(f, locale, codepage, FALSE); -} - -U_CAPI UFILE* U_EXPORT2 -u_fadopt(FILE *f, - const char *locale, - const char *codepage) -{ - return finit_owner(f, locale, codepage, TRUE); -} - -U_CAPI UFILE* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fopen(const char *filename, - const char *perm, - const char *locale, - const char *codepage) -{ - UFILE *result; - FILE *systemFile = fopen(filename, perm); - if(systemFile == 0) { - return 0; - } - - result = finit_owner(systemFile, locale, codepage, TRUE); - - if (!result) { - /* Something bad happened. - Maybe the converter couldn't be opened. */ - fclose(systemFile); - } - - return result; /* not a file leak */ -} - -U_CAPI UFILE* U_EXPORT2 -u_fopen_u(const UChar *filename, - const char *perm, - const char *locale, - const char *codepage) -{ - UFILE *result; - char buffer[256]; - - u_austrcpy(buffer, filename); - - result = u_fopen(buffer, perm, locale, codepage); -#if U_PLATFORM_USES_ONLY_WIN32_API - /* Try Windows API _wfopen if the above fails. */ - if (!result) { - // TODO: test this code path, including wperm. - wchar_t wperm[40] = {}; - size_t retVal; - mbstowcs_s(&retVal, wperm, perm, _TRUNCATE); - FILE *systemFile = _wfopen((const wchar_t *)filename, wperm); - if (systemFile) { - result = finit_owner(systemFile, locale, codepage, TRUE); - } - if (!result) { - /* Something bad happened. - Maybe the converter couldn't be opened. */ - fclose(systemFile); - } - } -#endif - return result; /* not a file leak */ -} - -U_CAPI UFILE* U_EXPORT2 -u_fstropen(UChar *stringBuf, - int32_t capacity, - const char *locale) -{ - UFILE *result; - - if (capacity < 0) { - return NULL; - } - - result = (UFILE*) uprv_malloc(sizeof(UFILE)); - /* Null pointer test */ - if (result == NULL) { - return NULL; /* Just get out. */ - } - uprv_memset(result, 0, sizeof(UFILE)); - result->str.fBuffer = stringBuf; - result->str.fPos = stringBuf; - result->str.fLimit = stringBuf+capacity; - -#if !UCONFIG_NO_FORMATTING - /* if locale is 0, use the default */ - if(u_locbund_init(&result->str.fBundle, locale) == 0) { - /* DO NOT FCLOSE HERE! */ - uprv_free(result); - return 0; - } -#endif - - return result; -} - -U_CAPI UBool U_EXPORT2 -u_feof(UFILE *f) -{ - UBool endOfBuffer; - if (f == NULL) { - return TRUE; - } - endOfBuffer = (UBool)(f->str.fPos >= f->str.fLimit); - if (f->fFile != NULL) { - return endOfBuffer && feof(f->fFile); - } - return endOfBuffer; -} - -U_CAPI void U_EXPORT2 -u_fflush(UFILE *file) -{ - ufile_flush_translit(file); - ufile_flush_io(file); - if (file->fFile) { - fflush(file->fFile); - } - else if (file->str.fPos < file->str.fLimit) { - *(file->str.fPos++) = 0; - } - /* TODO: flush input */ -} - -U_CAPI void -u_frewind(UFILE *file) -{ - u_fflush(file); - ucnv_reset(file->fConverter); - if (file->fFile) { - rewind(file->fFile); - file->str.fLimit = file->fUCBuffer; - file->str.fPos = file->fUCBuffer; - } - else { - file->str.fPos = file->str.fBuffer; - } -} - -U_CAPI void U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fclose(UFILE *file) -{ - if (file) { - u_fflush(file); - ufile_close_translit(file); - - if(file->fOwnFile) - fclose(file->fFile); - -#if !UCONFIG_NO_FORMATTING - u_locbund_close(&file->str.fBundle); -#endif - - ucnv_close(file->fConverter); - uprv_free(file); - } -} - -U_CAPI FILE* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fgetfile( UFILE *f) -{ - return f->fFile; -} - -#if !UCONFIG_NO_FORMATTING - -U_CAPI const char* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fgetlocale( UFILE *file) -{ - return file->str.fBundle.fLocale; -} - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fsetlocale(UFILE *file, - const char *locale) -{ - u_locbund_close(&file->str.fBundle); - - return u_locbund_init(&file->str.fBundle, locale) == 0 ? -1 : 0; -} - -#endif - -U_CAPI const char* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fgetcodepage(UFILE *file) -{ - UErrorCode status = U_ZERO_ERROR; - const char *codepage = NULL; - - if (file->fConverter) { - codepage = ucnv_getName(file->fConverter, &status); - if(U_FAILURE(status)) - return 0; - } - return codepage; -} - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fsetcodepage( const char *codepage, - UFILE *file) -{ - UErrorCode status = U_ZERO_ERROR; - int32_t retVal = -1; - - /* We use the normal default codepage for this system, and not the one for the locale. */ - if ((file->str.fPos == file->str.fBuffer) && (file->str.fLimit == file->str.fBuffer)) { - ucnv_close(file->fConverter); - file->fConverter = ucnv_open(codepage, &status); - if(U_SUCCESS(status)) { - retVal = 0; - } - } - return retVal; -} - - -U_CAPI UConverter * U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fgetConverter(UFILE *file) -{ - return file->fConverter; -} -#if !UCONFIG_NO_FORMATTING -U_CAPI const UNumberFormat* U_EXPORT2 u_fgetNumberFormat(UFILE *file) -{ - return u_locbund_getNumberFormat(&file->str.fBundle, UNUM_DECIMAL); -} -#endif - -#endif diff --git a/deps/icu-small/source/io/ufile.h b/deps/icu-small/source/io/ufile.h deleted file mode 100644 index ed897275437fb0..00000000000000 --- a/deps/icu-small/source/io/ufile.h +++ /dev/null @@ -1,140 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* - ******************************************************************************* - * - * Copyright (C) 1998-2014, International Business Machines - * Corporation and others. All Rights Reserved. - * - ******************************************************************************* - * - * File ufile.h - * - * Modification History: - * - * Date Name Description - * 12/01/98 stephen Creation. - * 03/12/99 stephen Modified for new C API. - ******************************************************************************* - */ - -#ifndef UFILE_H -#define UFILE_H - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_CONVERSION - -#include - -#include "unicode/ucnv.h" -#include "unicode/utrans.h" -#include "locbund.h" - -/* The buffer size for fromUnicode calls */ -#define UFILE_CHARBUFFER_SIZE 1024 - -/* The buffer size for toUnicode calls */ -#define UFILE_UCHARBUFFER_SIZE 1024 - -/* A UFILE */ - -#if !UCONFIG_NO_TRANSLITERATION - -typedef struct { - UChar *buffer; /* Beginning of buffer */ - int32_t capacity; /* Capacity of buffer */ - int32_t pos; /* Beginning of untranslitted data */ - int32_t length; /* Length *from beginning of buffer* of untranslitted data */ - UTransliterator *translit; -} UFILETranslitBuffer; - -#endif - -typedef struct u_localized_string { - UChar *fPos; /* current pos in fUCBuffer */ - const UChar *fLimit; /* data limit in fUCBuffer */ - UChar *fBuffer; /* Place to write the string */ - -#if !UCONFIG_NO_FORMATTING - ULocaleBundle fBundle; /* formatters */ -#endif -} u_localized_string; - -struct UFILE { -#if !UCONFIG_NO_TRANSLITERATION - UFILETranslitBuffer *fTranslit; -#endif - - FILE *fFile; /* the actual filesystem interface */ - - UConverter *fConverter; /* for codeset conversion */ - - u_localized_string str; /* struct to handle strings for number formatting */ - - UChar fUCBuffer[UFILE_UCHARBUFFER_SIZE];/* buffer used for toUnicode */ - - UBool fOwnFile; /* TRUE if fFile should be closed */ - - int32_t fFileno; /* File number. Useful to determine if it's stdin. */ -}; - -/** - * Like u_file_write but takes a flush parameter - */ -U_CFUNC int32_t U_EXPORT2 -u_file_write_flush( const UChar *chars, - int32_t count, - UFILE *f, - UBool flushIO, - UBool flushTranslit); - -/** - * Fill a UFILE's buffer with converted codepage data. - * @param f The UFILE containing the buffer to fill. - */ -void -ufile_fill_uchar_buffer(UFILE *f); - -/** - * Get one code unit and detect whether the end of file has been reached. - * @param f The UFILE containing the characters. - * @param ch The read in character - * @return TRUE if the character is valid, or FALSE when EOF has been detected - */ -U_CFUNC UBool U_EXPORT2 -ufile_getch(UFILE *f, UChar *ch); - -/** - * Get one character and detect whether the end of file has been reached. - * @param f The UFILE containing the characters. - * @param ch The read in character - * @return TRUE if the character is valid, or FALSE when EOF has been detected - */ -U_CFUNC UBool U_EXPORT2 -ufile_getch32(UFILE *f, UChar32 *ch); - -/** - * Close out the transliterator and flush any data therein. - * @param f flu - */ -void -ufile_close_translit(UFILE *f); - -/** - * Flush the buffer in the transliterator - * @param f UFile to flush - */ -void -ufile_flush_translit(UFILE *f); - -/** - * Flush the IO buffer - * @param f UFile to flush - */ -void -ufile_flush_io(UFILE *f); - - -#endif -#endif diff --git a/deps/icu-small/source/io/ufmt_cmn.cpp b/deps/icu-small/source/io/ufmt_cmn.cpp deleted file mode 100644 index 760d2711bd624c..00000000000000 --- a/deps/icu-small/source/io/ufmt_cmn.cpp +++ /dev/null @@ -1,259 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* -* Copyright (C) 1998-2014, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* File ufmt_cmn.c -* -* Modification History: -* -* Date Name Description -* 12/02/98 stephen Creation. -* 03/12/99 stephen Modified for new C API. -* 03/15/99 stephen Added defaultCPToUnicode, unicodeToDefaultCP -* 07/19/99 stephen Fixed bug in defaultCPToUnicode -****************************************************************************** -*/ - -#include "cstring.h" -#include "cmemory.h" -#include "ufmt_cmn.h" -#include "unicode/uchar.h" -#include "unicode/ucnv.h" -#include "ustr_cnv.h" - -#if !UCONFIG_NO_CONVERSION - - -#define DIGIT_0 0x0030 -#define DIGIT_9 0x0039 -#define LOWERCASE_A 0x0061 -#define UPPERCASE_A 0x0041 -#define LOWERCASE_Z 0x007A -#define UPPERCASE_Z 0x005A - -int -ufmt_digitvalue(UChar c) -{ - if( ((c>=DIGIT_0)&&(c<=DIGIT_9)) || - ((c>=LOWERCASE_A)&&(c<=LOWERCASE_Z)) || - ((c>=UPPERCASE_A)&&(c<=UPPERCASE_Z)) ) - { - return c - DIGIT_0 - (c >= 0x0041 ? (c >= 0x0061 ? 39 : 7) : 0); - } - else - { - return -1; - } -} - -UBool -ufmt_isdigit(UChar c, - int32_t radix) -{ - int digitVal = ufmt_digitvalue(c); - - return (UBool)(digitVal < radix && digitVal >= 0); -} - -#define TO_UC_DIGIT(a) a <= 9 ? (DIGIT_0 + a) : (0x0037 + a) -#define TO_LC_DIGIT(a) a <= 9 ? (DIGIT_0 + a) : (0x0057 + a) - -void -ufmt_64tou(UChar *buffer, - int32_t *len, - uint64_t value, - uint8_t radix, - UBool uselower, - int32_t minDigits) -{ - int32_t length = 0; - uint32_t digit; - UChar *left, *right, temp; - - do { - digit = (uint32_t)(value % radix); - value = value / radix; - buffer[length++] = (UChar)(uselower ? TO_LC_DIGIT(digit) - : TO_UC_DIGIT(digit)); - } while(value); - - /* pad with zeroes to make it minDigits long */ - if(minDigits != -1 && length < minDigits) { - while(length < minDigits && length < *len) - buffer[length++] = DIGIT_0; /*zero padding */ - } - - /* reverse the buffer */ - left = buffer; - right = buffer + length; - while(left < --right) { - temp = *left; - *left++ = *right; - *right = temp; - } - - *len = length; -} - -void -ufmt_ptou(UChar *buffer, - int32_t *len, - void *value, - UBool uselower) -{ - int32_t i; - int32_t length = 0; - uint8_t *ptrIdx = (uint8_t *)&value; - -#if U_IS_BIG_ENDIAN - for (i = 0; i < (int32_t)sizeof(void *); i++) -#else - for (i = (int32_t)sizeof(void *)-1; i >= 0 ; i--) -#endif - { - uint8_t byteVal = ptrIdx[i]; - uint16_t firstNibble = (uint16_t)(byteVal>>4); - uint16_t secondNibble = (uint16_t)(byteVal&0xF); - if (uselower) { - buffer[length++]=TO_LC_DIGIT(firstNibble); - buffer[length++]=TO_LC_DIGIT(secondNibble); - } - else { - buffer[length++]=TO_UC_DIGIT(firstNibble); - buffer[length++]=TO_UC_DIGIT(secondNibble); - } - } - - *len = length; -} - -int64_t -ufmt_uto64(const UChar *buffer, - int32_t *len, - int8_t radix) -{ - const UChar *limit; - int32_t count; - int64_t result; - - - /* intialize parameters */ - limit = buffer + *len; - count = 0; - result = 0; - - /* iterate through buffer */ - while(ufmt_isdigit(*buffer, radix) && buffer < limit) { - - /* read the next digit */ - result *= radix; - result += ufmt_digitvalue(*buffer++); - - /* increment our count */ - ++count; - } - - *len = count; - return result; -} - -#define NIBBLE_PER_BYTE 2 -void * -ufmt_utop(const UChar *buffer, - int32_t *len) -{ - int32_t count, resultIdx, incVal, offset; - /* This union allows the pointer to be written as an array. */ - union { - void *ptr; - uint8_t bytes[sizeof(void*)]; - } result; - - /* intialize variables */ - count = 0; - offset = 0; - result.ptr = NULL; - - /* Skip the leading zeros */ - while(buffer[count] == DIGIT_0 || u_isspace(buffer[count])) { - count++; - offset++; - } - - /* iterate through buffer, stop when you hit the end */ - while(ufmt_isdigit(buffer[count], 16) && count < *len) { - /* increment the count consumed */ - ++count; - } - - /* detect overflow */ - if (count - offset > (int32_t)(sizeof(void*)*NIBBLE_PER_BYTE)) { - offset = count - (int32_t)(sizeof(void*)*NIBBLE_PER_BYTE); - } - - /* Initialize the direction of the input */ -#if U_IS_BIG_ENDIAN - incVal = -1; - resultIdx = (int32_t)(sizeof(void*) - 1); -#else - incVal = 1; - resultIdx = 0; -#endif - /* Write how much was consumed. */ - *len = count; - while(--count >= offset) { - /* Get the first nibble of the byte */ - uint8_t byte = (uint8_t)ufmt_digitvalue(buffer[count]); - - if (count > offset) { - /* Get the second nibble of the byte when available */ - byte = (uint8_t)(byte + (ufmt_digitvalue(buffer[--count]) << 4)); - } - /* Write the byte into the array */ - result.bytes[resultIdx] = byte; - resultIdx += incVal; - } - - return result.ptr; -} - -UChar* -ufmt_defaultCPToUnicode(const char *s, int32_t sSize, - UChar *target, int32_t tSize) -{ - UChar *alias; - UErrorCode status = U_ZERO_ERROR; - UConverter *defConverter = u_getDefaultConverter(&status); - - if(U_FAILURE(status) || defConverter == 0) - return 0; - - if(sSize <= 0) { - sSize = uprv_strlen(s) + 1; - } - - /* perform the conversion in one swoop */ - if(target != 0) { - - alias = target; - ucnv_toUnicode(defConverter, &alias, alias + tSize, &s, s + sSize - 1, - NULL, TRUE, &status); - - - /* add the null terminator */ - *alias = 0x0000; - } - - u_releaseDefaultConverter(defConverter); - - return target; -} - - -#endif diff --git a/deps/icu-small/source/io/ufmt_cmn.h b/deps/icu-small/source/io/ufmt_cmn.h deleted file mode 100644 index d9cfd6a5f332b6..00000000000000 --- a/deps/icu-small/source/io/ufmt_cmn.h +++ /dev/null @@ -1,161 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* -* Copyright (C) 1998-2011, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* File ufmt_cmn.h -* -* Modification History: -* -* Date Name Description -* 12/02/98 stephen Creation. -* 03/12/99 stephen Modified for new C API. -* 03/15/99 stephen Added defaultCPToUnicode, unicodeToDefaultCP -****************************************************************************** -*/ - -#ifndef UFMT_CMN_H -#define UFMT_CMN_H - -#include "unicode/utypes.h" -#include "unicode/utf16.h" - -#define UFMT_DEFAULT_BUFFER_SIZE 128 -#define MAX_UCHAR_BUFFER_SIZE(buffer) ((int32_t)(sizeof(buffer)/(U16_MAX_LENGTH*sizeof(UChar)))) -#define MAX_UCHAR_BUFFER_NEEDED(strLen) ((strLen+1)*U16_MAX_LENGTH*sizeof(UChar)) - -/** - * Enum representing the possible argument types for uprintf/uscanf - */ -typedef enum ufmt_type_info { - ufmt_empty = 0, - ufmt_simple_percent, /* %% do nothing */ - ufmt_count, /* special flag for count */ - ufmt_int, /* int */ - ufmt_char, /* int, cast to char */ - ufmt_string, /* char* */ - ufmt_pointer, /* void* */ - ufmt_float, /* float */ - ufmt_double, /* double */ - ufmt_uchar, /* int, cast to UChar */ - ufmt_ustring /* UChar* */ - /*ufmt_wchar,*/ /* wchar_t */ - /*ufmt_wstring,*/ /* wchar_t* */ - /*ufmt_date,*/ /* Date */ - /*ufmt_last*/ -} ufmt_type_info; - -/** - * Union representing a uprintf/uscanf argument - */ -typedef union ufmt_args { - int64_t int64Value; /* int, UChar */ - float floatValue; /* float */ - double doubleValue; /* double */ - void *ptrValue; /* any pointer - void*, char*, wchar_t*, UChar* */ - /*wchar_t wcharValue;*/ /* wchar_t */ /* TODO: Should wchar_t be used? */ - /*UDate dateValue;*/ /* Date */ -} ufmt_args; - -/** - * Macro for determining the minimum of two numbers. - * @param a An integer - * @param b An integer - * @return a if a < b, b otherwise - */ -#define ufmt_min(a,b) ((a) < (b) ? (a) : (b)) - -/** - * Convert a UChar in hex radix to an integer value. - * @param c The UChar to convert. - * @return The integer value of c. - */ -int -ufmt_digitvalue(UChar c); - -/** - * Determine if a UChar is a digit for a specified radix. - * @param c The UChar to check. - * @param radix The desired radix. - * @return TRUE if c is a digit in radix, FALSE otherwise. - */ -UBool -ufmt_isdigit(UChar c, - int32_t radix); - -/** - * Convert an int64_t to a UChar* in a specified radix - * @param buffer The target buffer - * @param len On input, the size of buffer. On output, - * the number of UChars written to buffer. - * @param value The value to be converted - * @param radix The desired radix - * @param uselower TRUE means lower case will be used, FALSE means upper case - * @param minDigits The minimum number of digits for for the formatted number, - * which will be padded with zeroes. -1 means do not pad. - */ -void -ufmt_64tou(UChar *buffer, - int32_t *len, - uint64_t value, - uint8_t radix, - UBool uselower, - int32_t minDigits); - -/** - * It's like ufmt_64tou, but with a pointer. - * This functions avoids size constraints of 64-bit types. - * Pointers can be at 32-128 bits in size. - */ -void -ufmt_ptou(UChar *buffer, - int32_t *len, - void *value, - UBool uselower); - -/** - * Convert a UChar* in a specified radix to an int64_t. - * @param buffer The target buffer - * @param len On input, the size of buffer. On output, - * the number of UChars read from buffer. - * @param radix The desired radix - * @return The numeric value. - */ -int64_t -ufmt_uto64(const UChar *buffer, - int32_t *len, - int8_t radix); - -/** - * Convert a UChar* in a specified radix to a pointer, - * @param buffer The target buffer - * @param len On input, the size of buffer. On output, - * the number of UChars read from buffer. - * @param radix The desired radix - * @return The pointer value. - */ -void * -ufmt_utop(const UChar *buffer, - int32_t *len); - -/** - * Convert a string from the default codepage to Unicode. - * @param s The string to convert, in the default codepage. - * @param sSize The size of s to convert. - * @param target The buffer to convert to. - * @param tSize The size of target - * @return A pointer to a newly allocated converted version of s, or 0 - * on error. - */ -UChar* -ufmt_defaultCPToUnicode(const char *s, int32_t sSize, - UChar *target, int32_t tSize); - - - -#endif diff --git a/deps/icu-small/source/io/unicode/ustdio.h b/deps/icu-small/source/io/unicode/ustdio.h deleted file mode 100644 index 565b5b3fc57f49..00000000000000 --- a/deps/icu-small/source/io/unicode/ustdio.h +++ /dev/null @@ -1,1016 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* -* Copyright (C) 1998-2015, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* File ustdio.h -* -* Modification History: -* -* Date Name Description -* 10/16/98 stephen Creation. -* 11/06/98 stephen Modified per code review. -* 03/12/99 stephen Modified for new C API. -* 07/19/99 stephen Minor doc update. -* 02/01/01 george Added sprintf & sscanf with all of its variants -****************************************************************************** -*/ - -#ifndef USTDIO_H -#define USTDIO_H - -#include -#include - -#include "unicode/utypes.h" -#include "unicode/ucnv.h" -#include "unicode/utrans.h" -#include "unicode/localpointer.h" -#include "unicode/unum.h" - -#if !UCONFIG_NO_CONVERSION - -/* - TODO - The following is a small list as to what is currently wrong/suggestions for - ustdio. - - * Make sure that * in the scanf format specification works for all formats. - * Each UFILE takes up at least 2KB. - Look into adding setvbuf() for configurable buffers. - * This library does buffering. The OS should do this for us already. Check on - this, and remove it from this library, if this is the case. Double buffering - wastes a lot of time and space. - * Test stdin and stdout with the u_f* functions - * Testing should be done for reading and writing multi-byte encodings, - and make sure that a character that is contained across buffer boundries - works even for incomplete characters. - * Make sure that the last character is flushed when the file/string is closed. - * snprintf should follow the C99 standard for the return value, which is - return the number of characters (excluding the trailing '\0') - which would have been written to the destination string regardless - of available space. This is like pre-flighting. - * Everything that uses %s should do what operator>> does for UnicodeString. - It should convert one byte at a time, and once a character is - converted then check to see if it's whitespace or in the scanset. - If it's whitespace or in the scanset, put all the bytes back (do nothing - for sprintf/sscanf). - * If bad string data is encountered, make sure that the function fails - without memory leaks and the unconvertable characters are valid - substitution or are escaped characters. - * u_fungetc() can't unget a character when it's at the beginning of the - internal conversion buffer. For example, read the buffer size # of - characters, and then ungetc to get the previous character that was - at the end of the last buffer. - * u_fflush() and u_fclose should return an int32_t like C99 functions. - 0 is returned if the operation was successful and EOF otherwise. - * u_fsettransliterator does not support U_READ side of transliteration. - * The format specifier should limit the size of a format or honor it in - order to prevent buffer overruns. (e.g. %256.256d). - * u_fread and u_fwrite don't exist. They're needed for reading and writing - data structures without any conversion. - * u_file_read and u_file_write are used for writing strings. u_fgets and - u_fputs or u_fread and u_fwrite should be used to do this. - * The width parameter for all scanf formats, including scanset, needs - better testing. This prevents buffer overflows. - * Figure out what is suppose to happen when a codepage is changed midstream. - Maybe a flush or a rewind are good enough. - * Make sure that a UFile opened with "rw" can be used after using - u_fflush with a u_frewind. - * scanf(%i) should detect what type of number to use. - * Add more testing of the alternate format, %# - * Look at newline handling of fputs/puts - * Think more about codeunit/codepoint error handling/support in %S,%s,%C,%c,%[] - * Complete the file documentation with proper doxygen formatting. - See http://oss.software.ibm.com/pipermail/icu/2003-July/005647.html -*/ - -/** - * \file - * \brief C API: Unicode stdio-like API - * - *

Unicode stdio-like C API

- * - *

This API provides an stdio-like API wrapper around ICU's other - * formatting and parsing APIs. It is meant to ease the transition of adding - * Unicode support to a preexisting applications using stdio. The following - * is a small list of noticable differences between stdio and ICU I/O's - * ustdio implementation.

- * - *
    - *
  • Locale specific formatting and parsing is only done with file IO.
  • - *
  • u_fstropen can be used to simulate file IO with strings. - * This is similar to the iostream API, and it allows locale specific - * formatting and parsing to be used.
  • - *
  • This API provides uniform formatting and parsing behavior between - * platforms (unlike the standard stdio implementations found on various - * platforms).
  • - *
  • This API is better suited for text data handling than binary data - * handling when compared to the typical stdio implementation.
  • - *
  • You can specify a Transliterator while using the file IO.
  • - *
  • You can specify a file's codepage separately from the default - * system codepage.
  • - *
- * - *

Formatting and Parsing Specification

- * - * General printf format:
- * %[format modifier][width][.precision][type modifier][format] - * - * General scanf format:
- * %[*][format modifier][width][type modifier][format] - * - - - - - - - - - - - - - - - - - - - - - -
formatdefault
printf
type
default
scanf
type
description
%EdoublefloatScientific with an uppercase exponent
%edoublefloatScientific with a lowercase exponent
%GdoublefloatUse %E or %f for best format
%gdoublefloatUse %e or %f for best format
%fdoublefloatSimple floating point without the exponent
%Xint32_tint32_tustdio special uppercase hex radix formatting
%xint32_tint32_tustdio special lowercase hex radix formatting
%dint32_tint32_tDecimal format
%iint32_tint32_tSame as %d
%nint32_tint32_tcount (write the number of UTF-16 codeunits read/written)
%oint32_tint32_tustdio special octal radix formatting
%uuint32_tuint32_tDecimal format
%pvoid *void *Prints the pointer value
%schar *char *Use default converter or specified converter from fopen
%ccharcharUse default converter or specified converter from fopen
-When width is specified for scanf, this acts like a non-NULL-terminated char * string.
-By default, only one char is written.
%SUChar *UChar *Null terminated UTF-16 string
%CUCharUChar16-bit Unicode code unit
-When width is specified for scanf, this acts like a non-NULL-terminated UChar * string
-By default, only one codepoint is written.
%[] UChar *Null terminated UTF-16 string which contains the filtered set of characters specified by the UnicodeSet
%%  Show a percent sign
- -Format modifiers - - - - - - - - - - - - - - - - - - - - - - -
modifierformatstypecomments
%h%d, %i, %o, %xint16_tshort format
%h%uuint16_tshort format
%hcchar(Unimplemented) Use invariant converter
%hschar *(Unimplemented) Use invariant converter
%hCchar(Unimplemented) 8-bit Unicode code unit
%hSchar *(Unimplemented) Null terminated UTF-8 string
%l%d, %i, %o, %xint32_tlong format (no effect)
%l%uuint32_tlong format (no effect)
%lcN/A(Unimplemented) Reserved for future implementation
%lsN/A(Unimplemented) Reserved for future implementation
%lCUChar32(Unimplemented) 32-bit Unicode code unit
%lSUChar32 *(Unimplemented) Null terminated UTF-32 string
%ll%d, %i, %o, %xint64_tlong long format
%ll%uuint64_t(Unimplemented) long long format
%-allN/ALeft justify
%+%d, %i, %o, %x, %e, %f, %g, %E, %GN/AAlways show the plus or minus sign. Needs data for plus sign.
% %d, %i, %o, %x, %e, %f, %g, %E, %GN/AInstead of a "+" output a blank character for positive numbers.
%#%d, %i, %o, %x, %e, %f, %g, %E, %GN/APrecede octal value with 0, hex with 0x and show the - decimal point for floats.
%nallN/AWidth of input/output. num is an actual number from 0 to - some large number.
%.n%e, %f, %g, %E, %F, %GN/ASignificant digits precision. num is an actual number from - 0 to some large number.
If * is used in printf, then the precision is passed in as an argument before the number to be formatted.
- -printf modifier -%* int32_t Next argument after this one specifies the width - -scanf modifier -%* N/A This field is scanned, but not stored - -

If you are using this C API instead of the ustream.h API for C++, -you can use one of the following u_fprintf examples to display a UnicodeString.

- -

-    UFILE *out = u_finit(stdout, NULL, NULL);
-    UnicodeString string1("string 1");
-    UnicodeString string2("string 2");
-    u_fprintf(out, "%S\n", string1.getTerminatedBuffer());
-    u_fprintf(out, "%.*S\n", string2.length(), string2.getBuffer());
-    u_fclose(out);
-
- - */ - - -/** - * When an end of file is encountered, this value can be returned. - * @see u_fgetc - * @stable 3.0 - */ -#define U_EOF 0xFFFF - -/** Forward declaration of a Unicode-aware file @stable 3.0 */ -typedef struct UFILE UFILE; - -/** - * Enum for which direction of stream a transliterator applies to. - * @see u_fsettransliterator - * @stable ICU 3.0 - */ -typedef enum { - U_READ = 1, - U_WRITE = 2, - U_READWRITE =3 /* == (U_READ | U_WRITE) */ -} UFileDirection; - -/** - * Open a UFILE. - * A UFILE is a wrapper around a FILE* that is locale and codepage aware. - * That is, data written to a UFILE will be formatted using the conventions - * specified by that UFILE's Locale; this data will be in the character set - * specified by that UFILE's codepage. - * @param filename The name of the file to open. - * @param perm The read/write permission for the UFILE; one of "r", "w", "rw" - * @param locale The locale whose conventions will be used to format - * and parse output. If this parameter is NULL, the default locale will - * be used. - * @param codepage The codepage in which data will be written to and - * read from the file. If this paramter is NULL the system default codepage - * will be used. - * @return A new UFILE, or NULL if an error occurred. - * @stable ICU 3.0 - */ -U_STABLE UFILE* U_EXPORT2 -u_fopen(const char *filename, - const char *perm, - const char *locale, - const char *codepage); - -/** - * Open a UFILE with a UChar* filename - * A UFILE is a wrapper around a FILE* that is locale and codepage aware. - * That is, data written to a UFILE will be formatted using the conventions - * specified by that UFILE's Locale; this data will be in the character set - * specified by that UFILE's codepage. - * @param filename The name of the file to open. - * @param perm The read/write permission for the UFILE; one of "r", "w", "rw" - * @param locale The locale whose conventions will be used to format - * and parse output. If this parameter is NULL, the default locale will - * be used. - * @param codepage The codepage in which data will be written to and - * read from the file. If this paramter is NULL the system default codepage - * will be used. - * @return A new UFILE, or NULL if an error occurred. - * @stable ICU 54 - */ -U_STABLE UFILE* U_EXPORT2 -u_fopen_u(const UChar *filename, - const char *perm, - const char *locale, - const char *codepage); - -/** - * Open a UFILE on top of an existing FILE* stream. The FILE* stream - * ownership remains with the caller. To have the UFILE take over - * ownership and responsibility for the FILE* stream, use the - * function u_fadopt. - * @param f The FILE* to which this UFILE will attach and use. - * @param locale The locale whose conventions will be used to format - * and parse output. If this parameter is NULL, the default locale will - * be used. - * @param codepage The codepage in which data will be written to and - * read from the file. If this paramter is NULL, data will be written and - * read using the default codepage for locale, unless locale - * is NULL, in which case the system default codepage will be used. - * @return A new UFILE, or NULL if an error occurred. - * @stable ICU 3.0 - */ -U_STABLE UFILE* U_EXPORT2 -u_finit(FILE *f, - const char *locale, - const char *codepage); - -/** - * Open a UFILE on top of an existing FILE* stream. The FILE* stream - * ownership is transferred to the new UFILE. It will be closed when the - * UFILE is closed. - * @param f The FILE* which this UFILE will take ownership of. - * @param locale The locale whose conventions will be used to format - * and parse output. If this parameter is NULL, the default locale will - * be used. - * @param codepage The codepage in which data will be written to and - * read from the file. If this paramter is NULL, data will be written and - * read using the default codepage for locale, unless locale - * is NULL, in which case the system default codepage will be used. - * @return A new UFILE, or NULL if an error occurred. If an error occurs - * the ownership of the FILE* stream remains with the caller. - * @stable ICU 4.4 - */ -U_STABLE UFILE* U_EXPORT2 -u_fadopt(FILE *f, - const char *locale, - const char *codepage); - -/** - * Create a UFILE that can be used for localized formatting or parsing. - * The u_sprintf and u_sscanf functions do not read or write numbers for a - * specific locale. The ustdio.h file functions can be used on this UFILE. - * The string is usable once u_fclose or u_fflush has been called on the - * returned UFILE. - * @param stringBuf The string used for reading or writing. - * @param capacity The number of code units available for use in stringBuf - * @param locale The locale whose conventions will be used to format - * and parse output. If this parameter is NULL, the default locale will - * be used. - * @return A new UFILE, or NULL if an error occurred. - * @stable ICU 3.0 - */ -U_STABLE UFILE* U_EXPORT2 -u_fstropen(UChar *stringBuf, - int32_t capacity, - const char *locale); - -/** - * Close a UFILE. Implies u_fflush first. - * @param file The UFILE to close. - * @stable ICU 3.0 - * @see u_fflush - */ -U_STABLE void U_EXPORT2 -u_fclose(UFILE *file); - -#if U_SHOW_CPLUSPLUS_API - -U_NAMESPACE_BEGIN - -/** - * \class LocalUFILEPointer - * "Smart pointer" class, closes a UFILE via u_fclose(). - * For most methods see the LocalPointerBase base class. - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 4.4 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUFILEPointer, UFILE, u_fclose); - -U_NAMESPACE_END - -#endif - -/** - * Tests if the UFILE is at the end of the file stream. - * @param f The UFILE from which to read. - * @return Returns TRUE after the first read operation that attempts to - * read past the end of the file. It returns FALSE if the current position is - * not end of file. - * @stable ICU 3.0 -*/ -U_STABLE UBool U_EXPORT2 -u_feof(UFILE *f); - -/** - * Flush output of a UFILE. Implies a flush of - * converter/transliterator state. (That is, a logical break is - * made in the output stream - for example if a different type of - * output is desired.) The underlying OS level file is also flushed. - * Note that for a stateful encoding, the converter may write additional - * bytes to return the stream to default state. - * @param file The UFILE to flush. - * @stable ICU 3.0 - */ -U_STABLE void U_EXPORT2 -u_fflush(UFILE *file); - -/** - * Rewind the file pointer to the beginning of the file. - * @param file The UFILE to rewind. - * @stable ICU 3.0 - */ -U_STABLE void -u_frewind(UFILE *file); - -/** - * Get the FILE* associated with a UFILE. - * @param f The UFILE - * @return A FILE*, owned by the UFILE. (The FILE must not be modified or closed) - * @stable ICU 3.0 - */ -U_STABLE FILE* U_EXPORT2 -u_fgetfile(UFILE *f); - -#if !UCONFIG_NO_FORMATTING - -/** - * Get the locale whose conventions are used to format and parse output. - * This is the same locale passed in the preceding call tou_fsetlocale - * or u_fopen. - * @param file The UFILE to set. - * @return The locale whose conventions are used to format and parse output. - * @stable ICU 3.0 - */ -U_STABLE const char* U_EXPORT2 -u_fgetlocale(UFILE *file); - -/** - * Set the locale whose conventions will be used to format and parse output. - * @param locale The locale whose conventions will be used to format - * and parse output. - * @param file The UFILE to query. - * @return NULL if successful, otherwise a negative number. - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_fsetlocale(UFILE *file, - const char *locale); - -#endif - -/** - * Get the codepage in which data is written to and read from the UFILE. - * This is the same codepage passed in the preceding call to - * u_fsetcodepage or u_fopen. - * @param file The UFILE to query. - * @return The codepage in which data is written to and read from the UFILE, - * or NULL if an error occurred. - * @stable ICU 3.0 - */ -U_STABLE const char* U_EXPORT2 -u_fgetcodepage(UFILE *file); - -/** - * Set the codepage in which data will be written to and read from the UFILE. - * All Unicode data written to the UFILE will be converted to this codepage - * before it is written to the underlying FILE*. It it generally a bad idea to - * mix codepages within a file. This should only be called right - * after opening the UFile, or after calling u_frewind. - * @param codepage The codepage in which data will be written to - * and read from the file. For example "latin-1" or "ibm-943". - * A value of NULL means the default codepage for the UFILE's current - * locale will be used. - * @param file The UFILE to set. - * @return 0 if successful, otherwise a negative number. - * @see u_frewind - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_fsetcodepage(const char *codepage, - UFILE *file); - - -/** - * Returns an alias to the converter being used for this file. - * @param f The UFILE to get the value from - * @return alias to the converter (The converter must not be modified or closed) - * @stable ICU 3.0 - */ -U_STABLE UConverter* U_EXPORT2 u_fgetConverter(UFILE *f); - -#if !UCONFIG_NO_FORMATTING -/** - * Returns an alias to the number formatter being used for this file. - * @param f The UFILE to get the value from - * @return alias to the number formatter (The formatter must not be modified or closed) - * @stable ICU 51 -*/ - U_STABLE const UNumberFormat* U_EXPORT2 u_fgetNumberFormat(UFILE *f); - -/* Output functions */ - -/** - * Write formatted data to stdout. - * @param patternSpecification A pattern specifying how u_printf will - * interpret the variable arguments received and format the data. - * @return The number of Unicode characters written to stdout - * @stable ICU 49 - */ -U_STABLE int32_t U_EXPORT2 -u_printf(const char *patternSpecification, - ... ); - -/** - * Write formatted data to a UFILE. - * @param f The UFILE to which to write. - * @param patternSpecification A pattern specifying how u_fprintf will - * interpret the variable arguments received and format the data. - * @return The number of Unicode characters written to f. - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_fprintf(UFILE *f, - const char *patternSpecification, - ... ); - -/** - * Write formatted data to a UFILE. - * This is identical to u_fprintf, except that it will - * not call va_start and va_end. - * @param f The UFILE to which to write. - * @param patternSpecification A pattern specifying how u_fprintf will - * interpret the variable arguments received and format the data. - * @param ap The argument list to use. - * @return The number of Unicode characters written to f. - * @see u_fprintf - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_vfprintf(UFILE *f, - const char *patternSpecification, - va_list ap); - -/** - * Write formatted data to stdout. - * @param patternSpecification A pattern specifying how u_printf_u will - * interpret the variable arguments received and format the data. - * @return The number of Unicode characters written to stdout - * @stable ICU 49 - */ -U_STABLE int32_t U_EXPORT2 -u_printf_u(const UChar *patternSpecification, - ... ); - -/** - * Get a UFILE for stdout. - * @return UFILE that writes to stdout - * @stable ICU 49 - */ -U_STABLE UFILE * U_EXPORT2 -u_get_stdout(void); - -/** - * Write formatted data to a UFILE. - * @param f The UFILE to which to write. - * @param patternSpecification A pattern specifying how u_fprintf will - * interpret the variable arguments received and format the data. - * @return The number of Unicode characters written to f. - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_fprintf_u(UFILE *f, - const UChar *patternSpecification, - ... ); - -/** - * Write formatted data to a UFILE. - * This is identical to u_fprintf_u, except that it will - * not call va_start and va_end. - * @param f The UFILE to which to write. - * @param patternSpecification A pattern specifying how u_fprintf will - * interpret the variable arguments received and format the data. - * @param ap The argument list to use. - * @return The number of Unicode characters written to f. - * @see u_fprintf_u - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_vfprintf_u(UFILE *f, - const UChar *patternSpecification, - va_list ap); -#endif -/** - * Write a Unicode to a UFILE. The null (U+0000) terminated UChar* - * s will be written to f, excluding the NULL terminator. - * A newline will be added to f. - * @param s The UChar* to write. - * @param f The UFILE to which to write. - * @return A non-negative number if successful, EOF otherwise. - * @see u_file_write - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_fputs(const UChar *s, - UFILE *f); - -/** - * Write a UChar to a UFILE. - * @param uc The UChar to write. - * @param f The UFILE to which to write. - * @return The character written if successful, EOF otherwise. - * @stable ICU 3.0 - */ -U_STABLE UChar32 U_EXPORT2 -u_fputc(UChar32 uc, - UFILE *f); - -/** - * Write Unicode to a UFILE. - * The ustring passed in will be converted to the UFILE's underlying - * codepage before it is written. - * @param ustring A pointer to the Unicode data to write. - * @param count The number of Unicode characters to write - * @param f The UFILE to which to write. - * @return The number of Unicode characters written. - * @see u_fputs - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_file_write(const UChar *ustring, - int32_t count, - UFILE *f); - - -/* Input functions */ -#if !UCONFIG_NO_FORMATTING - -/** - * Read formatted data from a UFILE. - * @param f The UFILE from which to read. - * @param patternSpecification A pattern specifying how u_fscanf will - * interpret the variable arguments received and parse the data. - * @return The number of items successfully converted and assigned, or EOF - * if an error occurred. - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_fscanf(UFILE *f, - const char *patternSpecification, - ... ); - -/** - * Read formatted data from a UFILE. - * This is identical to u_fscanf, except that it will - * not call va_start and va_end. - * @param f The UFILE from which to read. - * @param patternSpecification A pattern specifying how u_fscanf will - * interpret the variable arguments received and parse the data. - * @param ap The argument list to use. - * @return The number of items successfully converted and assigned, or EOF - * if an error occurred. - * @see u_fscanf - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_vfscanf(UFILE *f, - const char *patternSpecification, - va_list ap); - -/** - * Read formatted data from a UFILE. - * @param f The UFILE from which to read. - * @param patternSpecification A pattern specifying how u_fscanf will - * interpret the variable arguments received and parse the data. - * @return The number of items successfully converted and assigned, or EOF - * if an error occurred. - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_fscanf_u(UFILE *f, - const UChar *patternSpecification, - ... ); - -/** - * Read formatted data from a UFILE. - * This is identical to u_fscanf_u, except that it will - * not call va_start and va_end. - * @param f The UFILE from which to read. - * @param patternSpecification A pattern specifying how u_fscanf will - * interpret the variable arguments received and parse the data. - * @param ap The argument list to use. - * @return The number of items successfully converted and assigned, or EOF - * if an error occurred. - * @see u_fscanf_u - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_vfscanf_u(UFILE *f, - const UChar *patternSpecification, - va_list ap); -#endif - -/** - * Read one line of text into a UChar* string from a UFILE. The newline - * at the end of the line is read into the string. The string is always - * null terminated - * @param f The UFILE from which to read. - * @param n The maximum number of characters - 1 to read. - * @param s The UChar* to receive the read data. Characters will be - * stored successively in s until a newline or EOF is - * reached. A null character (U+0000) will be appended to s. - * @return A pointer to s, or NULL if no characters were available. - * @stable ICU 3.0 - */ -U_STABLE UChar* U_EXPORT2 -u_fgets(UChar *s, - int32_t n, - UFILE *f); - -/** - * Read a UChar from a UFILE. It is recommended that u_fgetcx - * used instead for proper parsing functions, but sometimes reading - * code units is needed instead of codepoints. - * - * @param f The UFILE from which to read. - * @return The UChar value read, or U+FFFF if no character was available. - * @stable ICU 3.0 - */ -U_STABLE UChar U_EXPORT2 -u_fgetc(UFILE *f); - -/** - * Read a UChar32 from a UFILE. - * - * @param f The UFILE from which to read. - * @return The UChar32 value read, or U_EOF if no character was - * available, or U+FFFFFFFF if an ill-formed character was - * encountered. - * @see u_unescape() - * @stable ICU 3.0 - */ -U_STABLE UChar32 U_EXPORT2 -u_fgetcx(UFILE *f); - -/** - * Unget a UChar from a UFILE. - * If this function is not the first to operate on f after a call - * to u_fgetc, the results are undefined. - * If this function is passed a character that was not recieved from the - * previous u_fgetc or u_fgetcx call, the results are undefined. - * @param c The UChar to put back on the stream. - * @param f The UFILE to receive c. - * @return The UChar32 value put back if successful, U_EOF otherwise. - * @stable ICU 3.0 - */ -U_STABLE UChar32 U_EXPORT2 -u_fungetc(UChar32 c, - UFILE *f); - -/** - * Read Unicode from a UFILE. - * Bytes will be converted from the UFILE's underlying codepage, with - * subsequent conversion to Unicode. The data will not be NULL terminated. - * @param chars A pointer to receive the Unicode data. - * @param count The number of Unicode characters to read. - * @param f The UFILE from which to read. - * @return The number of Unicode characters read. - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_file_read(UChar *chars, - int32_t count, - UFILE *f); - -#if !UCONFIG_NO_TRANSLITERATION - -/** - * Set a transliterator on the UFILE. The transliterator will be owned by the - * UFILE. - * @param file The UFILE to set transliteration on - * @param adopt The UTransliterator to set. Can be NULL, which will - * mean that no transliteration is used. - * @param direction either U_READ, U_WRITE, or U_READWRITE - sets - * which direction the transliterator is to be applied to. If - * U_READWRITE, the "Read" transliteration will be in the inverse - * direction. - * @param status ICU error code. - * @return The previously set transliterator, owned by the - * caller. If U_READWRITE is specified, only the WRITE transliterator - * is returned. In most cases, the caller should call utrans_close() - * on the result of this function. - * @stable ICU 3.0 - */ -U_STABLE UTransliterator* U_EXPORT2 -u_fsettransliterator(UFILE *file, UFileDirection direction, - UTransliterator *adopt, UErrorCode *status); - -#endif - - -/* Output string functions */ -#if !UCONFIG_NO_FORMATTING - - -/** - * Write formatted data to a Unicode string. - * - * @param buffer The Unicode String to which to write. - * @param patternSpecification A pattern specifying how u_sprintf will - * interpret the variable arguments received and format the data. - * @return The number of Unicode code units written to buffer. This - * does not include the terminating null character. - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_sprintf(UChar *buffer, - const char *patternSpecification, - ... ); - -/** - * Write formatted data to a Unicode string. When the number of code units - * required to store the data exceeds count, then count code - * units of data are stored in buffer and a negative value is - * returned. When the number of code units required to store the data equals - * count, the string is not null terminated and count is - * returned. - * - * @param buffer The Unicode String to which to write. - * @param count The number of code units to read. - * @param patternSpecification A pattern specifying how u_sprintf will - * interpret the variable arguments received and format the data. - * @return The number of Unicode characters that would have been written to - * buffer had count been sufficiently large. This does not include - * the terminating null character. - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_snprintf(UChar *buffer, - int32_t count, - const char *patternSpecification, - ... ); - -/** - * Write formatted data to a Unicode string. - * This is identical to u_sprintf, except that it will - * not call va_start and va_end. - * - * @param buffer The Unicode string to which to write. - * @param patternSpecification A pattern specifying how u_sprintf will - * interpret the variable arguments received and format the data. - * @param ap The argument list to use. - * @return The number of Unicode characters written to buffer. - * @see u_sprintf - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_vsprintf(UChar *buffer, - const char *patternSpecification, - va_list ap); - -/** - * Write formatted data to a Unicode string. - * This is identical to u_snprintf, except that it will - * not call va_start and va_end.

- * When the number of code units required to store the data exceeds - * count, then count code units of data are stored in - * buffer and a negative value is returned. When the number of code - * units required to store the data equals count, the string is not - * null terminated and count is returned. - * - * @param buffer The Unicode string to which to write. - * @param count The number of code units to read. - * @param patternSpecification A pattern specifying how u_sprintf will - * interpret the variable arguments received and format the data. - * @param ap The argument list to use. - * @return The number of Unicode characters that would have been written to - * buffer had count been sufficiently large. - * @see u_sprintf - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_vsnprintf(UChar *buffer, - int32_t count, - const char *patternSpecification, - va_list ap); - -/** - * Write formatted data to a Unicode string. - * - * @param buffer The Unicode string to which to write. - * @param patternSpecification A pattern specifying how u_sprintf will - * interpret the variable arguments received and format the data. - * @return The number of Unicode characters written to buffer. - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_sprintf_u(UChar *buffer, - const UChar *patternSpecification, - ... ); - -/** - * Write formatted data to a Unicode string. When the number of code units - * required to store the data exceeds count, then count code - * units of data are stored in buffer and a negative value is - * returned. When the number of code units required to store the data equals - * count, the string is not null terminated and count is - * returned. - * - * @param buffer The Unicode string to which to write. - * @param count The number of code units to read. - * @param patternSpecification A pattern specifying how u_sprintf will - * interpret the variable arguments received and format the data. - * @return The number of Unicode characters that would have been written to - * buffer had count been sufficiently large. - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_snprintf_u(UChar *buffer, - int32_t count, - const UChar *patternSpecification, - ... ); - -/** - * Write formatted data to a Unicode string. - * This is identical to u_sprintf_u, except that it will - * not call va_start and va_end. - * - * @param buffer The Unicode string to which to write. - * @param patternSpecification A pattern specifying how u_sprintf will - * interpret the variable arguments received and format the data. - * @param ap The argument list to use. - * @return The number of Unicode characters written to f. - * @see u_sprintf_u - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_vsprintf_u(UChar *buffer, - const UChar *patternSpecification, - va_list ap); - -/** - * Write formatted data to a Unicode string. - * This is identical to u_snprintf_u, except that it will - * not call va_start and va_end. - * When the number of code units required to store the data exceeds - * count, then count code units of data are stored in - * buffer and a negative value is returned. When the number of code - * units required to store the data equals count, the string is not - * null terminated and count is returned. - * - * @param buffer The Unicode string to which to write. - * @param count The number of code units to read. - * @param patternSpecification A pattern specifying how u_sprintf will - * interpret the variable arguments received and format the data. - * @param ap The argument list to use. - * @return The number of Unicode characters that would have been written to - * f had count been sufficiently large. - * @see u_sprintf_u - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_vsnprintf_u(UChar *buffer, - int32_t count, - const UChar *patternSpecification, - va_list ap); - -/* Input string functions */ - -/** - * Read formatted data from a Unicode string. - * - * @param buffer The Unicode string from which to read. - * @param patternSpecification A pattern specifying how u_sscanf will - * interpret the variable arguments received and parse the data. - * @return The number of items successfully converted and assigned, or EOF - * if an error occurred. - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_sscanf(const UChar *buffer, - const char *patternSpecification, - ... ); - -/** - * Read formatted data from a Unicode string. - * This is identical to u_sscanf, except that it will - * not call va_start and va_end. - * - * @param buffer The Unicode string from which to read. - * @param patternSpecification A pattern specifying how u_sscanf will - * interpret the variable arguments received and parse the data. - * @param ap The argument list to use. - * @return The number of items successfully converted and assigned, or EOF - * if an error occurred. - * @see u_sscanf - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_vsscanf(const UChar *buffer, - const char *patternSpecification, - va_list ap); - -/** - * Read formatted data from a Unicode string. - * - * @param buffer The Unicode string from which to read. - * @param patternSpecification A pattern specifying how u_sscanf will - * interpret the variable arguments received and parse the data. - * @return The number of items successfully converted and assigned, or EOF - * if an error occurred. - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_sscanf_u(const UChar *buffer, - const UChar *patternSpecification, - ... ); - -/** - * Read formatted data from a Unicode string. - * This is identical to u_sscanf_u, except that it will - * not call va_start and va_end. - * - * @param buffer The Unicode string from which to read. - * @param patternSpecification A pattern specifying how u_sscanf will - * interpret the variable arguments received and parse the data. - * @param ap The argument list to use. - * @return The number of items successfully converted and assigned, or EOF - * if an error occurred. - * @see u_sscanf_u - * @stable ICU 3.0 - */ -U_STABLE int32_t U_EXPORT2 -u_vsscanf_u(const UChar *buffer, - const UChar *patternSpecification, - va_list ap); - - -#endif -#endif -#endif diff --git a/deps/icu-small/source/io/unicode/ustream.h b/deps/icu-small/source/io/unicode/ustream.h deleted file mode 100644 index df1506ebfb2552..00000000000000 --- a/deps/icu-small/source/io/unicode/ustream.h +++ /dev/null @@ -1,70 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -********************************************************************** -* Copyright (C) 2001-2014 International Business Machines -* Corporation and others. All Rights Reserved. -********************************************************************** -* FILE NAME : ustream.h -* -* Modification History: -* -* Date Name Description -* 06/25/2001 grhoten Move iostream from unistr.h -****************************************************************************** -*/ - -#ifndef USTREAM_H -#define USTREAM_H - -#include "unicode/unistr.h" - -#if !UCONFIG_NO_CONVERSION // not available without conversion - -/** - * \file - * \brief C++ API: Unicode iostream like API - * - * At this time, this API is very limited. It contains - * operator<< and operator>> for UnicodeString manipulation with the - * C++ I/O stream API. - */ - -#if defined(__GLIBCXX__) -namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364 -#endif - -#if U_IOSTREAM_SOURCE >= 199711 -#if (__GNUC__ == 2) -#include -#else -#include -#include -#endif - -U_NAMESPACE_BEGIN - -/** - * Write the contents of a UnicodeString to a C++ ostream. This functions writes - * the characters in a UnicodeString to an ostream. The UChars in the - * UnicodeString are converted to the char based ostream with the default - * converter. - * @stable 3.0 - */ -U_IO_API std::ostream & U_EXPORT2 operator<<(std::ostream& stream, const UnicodeString& s); - -/** - * Write the contents from a C++ istream to a UnicodeString. The UChars in the - * UnicodeString are converted from the char based istream with the default - * converter. - * @stable 3.0 - */ -U_IO_API std::istream & U_EXPORT2 operator>>(std::istream& stream, UnicodeString& s); -U_NAMESPACE_END - -#endif - -/* No operator for UChar because it can conflict with wchar_t */ - -#endif -#endif diff --git a/deps/icu-small/source/io/uprintf.cpp b/deps/icu-small/source/io/uprintf.cpp deleted file mode 100644 index 316c794498fba6..00000000000000 --- a/deps/icu-small/source/io/uprintf.cpp +++ /dev/null @@ -1,218 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* -* Copyright (C) 1998-2014, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* File uprintf.cpp -* -* Modification History: -* -* Date Name Description -* 11/19/98 stephen Creation. -* 03/12/99 stephen Modified for new C API. -* Added conversion from default codepage. -* 08/07/2003 george Reunify printf implementations -****************************************************************************** -*/ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION - -#include "unicode/ustdio.h" -#include "unicode/ustring.h" -#include "unicode/unum.h" -#include "unicode/udat.h" -#include "unicode/putil.h" - -#include "cmemory.h" -#include "locbund.h" -#include "mutex.h" -#include "uassert.h" -#include "uprintf.h" -#include "ufile.h" -#include "ucln_io.h" - -U_NAMESPACE_USE - -static UFILE *gStdOut = NULL; -static UInitOnce gStdOutInitOnce = U_INITONCE_INITIALIZER; - -static UBool U_CALLCONV uprintf_cleanup(void) -{ - if (gStdOut != NULL) { - u_fclose(gStdOut); - gStdOut = NULL; - } - gStdOutInitOnce.reset(); - return TRUE; -} - -static void U_CALLCONV u_stdout_init() { - U_ASSERT(gStdOut == NULL); - gStdOut = u_finit(stdout, NULL, NULL); - ucln_io_registerCleanup(UCLN_IO_PRINTF, &uprintf_cleanup); -} - -U_CAPI UFILE * U_EXPORT2 -u_get_stdout() -{ - umtx_initOnce(gStdOutInitOnce, &u_stdout_init); - return gStdOut; -} - -static int32_t U_EXPORT2 -u_printf_write(void *context, - const UChar *str, - int32_t count) -{ - return u_file_write(str, count, (UFILE *)context); -} - -static int32_t -u_printf_pad_and_justify(void *context, - const u_printf_spec_info *info, - const UChar *result, - int32_t resultLen) -{ - UFILE *output = (UFILE *)context; - int32_t written, i; - - /* pad and justify, if needed */ - if(info->fWidth != -1 && resultLen < info->fWidth) { - /* left justify */ - if(info->fLeft) { - written = u_file_write(result, resultLen, output); - for(i = 0; i < info->fWidth - resultLen; ++i) { - written += u_file_write(&info->fPadChar, 1, output); - } - } - /* right justify */ - else { - written = 0; - for(i = 0; i < info->fWidth - resultLen; ++i) { - written += u_file_write(&info->fPadChar, 1, output); - } - written += u_file_write(result, resultLen, output); - } - } - /* just write the formatted output */ - else { - written = u_file_write(result, resultLen, output); - } - - return written; -} - -U_CAPI int32_t U_EXPORT2 -u_fprintf( UFILE *f, - const char *patternSpecification, - ... ) -{ - va_list ap; - int32_t count; - - va_start(ap, patternSpecification); - count = u_vfprintf(f, patternSpecification, ap); - va_end(ap); - - return count; -} - -U_CAPI int32_t U_EXPORT2 -u_printf(const char *patternSpecification, - ...) -{ - va_list ap; - int32_t count; - va_start(ap, patternSpecification); - count = u_vfprintf(u_get_stdout(), patternSpecification, ap); - va_end(ap); - return count; -} - -U_CAPI int32_t U_EXPORT2 -u_fprintf_u( UFILE *f, - const UChar *patternSpecification, - ... ) -{ - va_list ap; - int32_t count; - - va_start(ap, patternSpecification); - count = u_vfprintf_u(f, patternSpecification, ap); - va_end(ap); - - return count; -} - -U_CAPI int32_t U_EXPORT2 -u_printf_u(const UChar *patternSpecification, - ...) -{ - va_list ap; - int32_t count; - va_start(ap, patternSpecification); - count = u_vfprintf_u(u_get_stdout(), patternSpecification, ap); - va_end(ap); - return count; -} - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_vfprintf( UFILE *f, - const char *patternSpecification, - va_list ap) -{ - int32_t count; - UChar *pattern; - UChar buffer[UFMT_DEFAULT_BUFFER_SIZE]; - size_t size = strlen(patternSpecification) + 1; - - /* convert from the default codepage to Unicode */ - if (size >= MAX_UCHAR_BUFFER_SIZE(buffer)) { - pattern = (UChar *)uprv_malloc(size * sizeof(UChar)); - if(pattern == 0) { - return 0; - } - } - else { - pattern = buffer; - } - u_charsToUChars(patternSpecification, pattern, size); - - /* do the work */ - count = u_vfprintf_u(f, pattern, ap); - - /* clean up */ - if (pattern != buffer) { - uprv_free(pattern); - } - - return count; -} - -static const u_printf_stream_handler g_stream_handler = { - u_printf_write, - u_printf_pad_and_justify -}; - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_vfprintf_u( UFILE *f, - const UChar *patternSpecification, - va_list ap) -{ - int32_t written = 0; /* haven't written anything yet */ - - /* parse and print the whole format string */ - u_printf_parse(&g_stream_handler, patternSpecification, f, NULL, &f->str.fBundle, &written, ap); - - /* return # of UChars written */ - return written; -} - -#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/io/uprintf.h b/deps/icu-small/source/io/uprintf.h deleted file mode 100644 index 0fd6066e5623af..00000000000000 --- a/deps/icu-small/source/io/uprintf.h +++ /dev/null @@ -1,103 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* -* Copyright (C) 1998-2006, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* File uprintf.h -* -* Modification History: -* -* Date Name Description -* 11/19/98 stephen Creation. -* 03/12/99 stephen Modified for new C API. -****************************************************************************** -*/ - -#ifndef UPRINTF_H -#define UPRINTF_H - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING - -#include "unicode/ustdio.h" -#include "ufmt_cmn.h" -#include "locbund.h" - -/** - * Struct encapsulating a single uprintf format specification. - */ -typedef struct u_printf_spec_info { - int32_t fPrecision; /* Precision */ - int32_t fWidth; /* Width */ - - UChar fOrigSpec; /* Conversion specification */ - UChar fSpec; /* Conversion specification */ - UChar fPadChar; /* Padding character */ - - UBool fAlt; /* # flag */ - UBool fSpace; /* Space flag */ - UBool fLeft; /* - flag */ - UBool fShowSign; /* + flag */ - UBool fZero; /* 0 flag */ - - UBool fIsLongDouble; /* L flag */ - UBool fIsShort; /* h flag */ - UBool fIsLong; /* l flag */ - UBool fIsLongLong; /* ll flag */ -} u_printf_spec_info; - -typedef int32_t U_EXPORT2 -u_printf_write_stream(void *context, - const UChar *str, - int32_t count); - -typedef int32_t U_EXPORT2 -u_printf_pad_and_justify_stream(void *context, - const u_printf_spec_info *info, - const UChar *result, - int32_t resultLen); - -typedef struct u_printf_stream_handler { - u_printf_write_stream *write; - u_printf_pad_and_justify_stream *pad_and_justify; -} u_printf_stream_handler; - -/* Used by sprintf */ -typedef struct u_localized_print_string { - UChar *str; /* Place to write the string */ - int32_t available;/* Number of codeunits available to write to */ - int32_t len; /* Maximum number of code units that can be written to output */ - - ULocaleBundle fBundle; /* formatters */ -} u_localized_print_string; - -#define UP_PERCENT 0x0025 - -/** - * Parse a single u_printf format string. - * @param fmt A pointer to a '%' character in a u_printf format specification. - * @param spec A pointer to a u_printf_spec to receive the parsed - * format specifier. - * @param locStringContext If present, will make sure that it will only write - * to the buffer when space is available. It's done this way because - * va_list sometimes can't be passed by pointer. - * @return The number of characters contained in this specifier. - */ -U_CFUNC int32_t -u_printf_parse(const u_printf_stream_handler *streamHandler, - const UChar *fmt, - void *context, - u_localized_print_string *locStringContext, - ULocaleBundle *formatBundle, - int32_t *written, - va_list ap); - -#endif /* #if !UCONFIG_NO_FORMATTING */ - -#endif diff --git a/deps/icu-small/source/io/uprntf_p.cpp b/deps/icu-small/source/io/uprntf_p.cpp deleted file mode 100644 index ecf2e67235b1cc..00000000000000 --- a/deps/icu-small/source/io/uprntf_p.cpp +++ /dev/null @@ -1,1606 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* -* Copyright (C) 1998-2016, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* File uprntf_p.c -* -* Modification History: -* -* Date Name Description -* 11/23/98 stephen Creation. -* 03/12/99 stephen Modified for new C API. -* 08/07/2003 george Reunify printf implementations -****************************************************************************** -*/ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION - -#include "unicode/ustring.h" -#include "unicode/utf16.h" -#include "uprintf.h" -#include "ufmt_cmn.h" -#include "cmemory.h" -#include "putilimp.h" - -/* ANSI style formatting */ -/* Use US-ASCII characters only for formatting */ - -/* % */ -#define UFMT_SIMPLE_PERCENT {ufmt_simple_percent, u_printf_simple_percent_handler} -/* s */ -#define UFMT_STRING {ufmt_string, u_printf_string_handler} -/* c */ -#define UFMT_CHAR {ufmt_char, u_printf_char_handler} -/* d, i */ -#define UFMT_INT {ufmt_int, u_printf_integer_handler} -/* u */ -#define UFMT_UINT {ufmt_int, u_printf_uinteger_handler} -/* o */ -#define UFMT_OCTAL {ufmt_int, u_printf_octal_handler} -/* x, X */ -#define UFMT_HEX {ufmt_int, u_printf_hex_handler} -/* f */ -#define UFMT_DOUBLE {ufmt_double, u_printf_double_handler} -/* e, E */ -#define UFMT_SCIENTIFIC {ufmt_double, u_printf_scientific_handler} -/* g, G */ -#define UFMT_SCIDBL {ufmt_double, u_printf_scidbl_handler} -/* n */ -#define UFMT_COUNT {ufmt_count, u_printf_count_handler} - -/* non-ANSI extensions */ -/* Use US-ASCII characters only for formatting */ - -/* p */ -#define UFMT_POINTER {ufmt_pointer, u_printf_pointer_handler} -/* V */ -#define UFMT_SPELLOUT {ufmt_double, u_printf_spellout_handler} -/* P */ -#define UFMT_PERCENT {ufmt_double, u_printf_percent_handler} -/* C K is old format */ -#define UFMT_UCHAR {ufmt_uchar, u_printf_uchar_handler} -/* S U is old format */ -#define UFMT_USTRING {ufmt_ustring, u_printf_ustring_handler} - - -#define UFMT_EMPTY {ufmt_empty, NULL} - -/** - * A u_printf handler function. - * A u_printf handler is responsible for handling a single u_printf - * format specification, for example 'd' or 's'. - * @param stream The UFILE to which to write output. - * @param info A pointer to a u_printf_spec_info struct containing - * information on the format specification. - * @param args A pointer to the argument data - * @return The number of Unicode characters written to stream. - */ -typedef int32_t U_EXPORT2 -u_printf_handler(const u_printf_stream_handler *handler, - - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args); - -typedef struct u_printf_info { - ufmt_type_info info; - u_printf_handler *handler; -} u_printf_info; - -/** - * Struct encapsulating a single uprintf format specification. - */ -typedef struct u_printf_spec { - u_printf_spec_info fInfo; /* Information on this spec */ - int32_t fWidthPos; /* Position of width in arg list */ - int32_t fPrecisionPos; /* Position of precision in arg list */ - int32_t fArgPos; /* Position of data in arg list */ -} u_printf_spec; - -#define UPRINTF_NUM_FMT_HANDLERS 108 - -/* We do not use handlers for 0-0x1f */ -#define UPRINTF_BASE_FMT_HANDLERS 0x20 - -/* buffer size for formatting */ -#define UPRINTF_BUFFER_SIZE 1024 -#define UPRINTF_SYMBOL_BUFFER_SIZE 8 - -static const UChar gNullStr[] = {0x28, 0x6E, 0x75, 0x6C, 0x6C, 0x29, 0}; /* "(null)" */ -static const UChar gSpaceStr[] = {0x20, 0}; /* " " */ - -/* Sets the sign of a format based on u_printf_spec_info */ -/* TODO: Is setting the prefix symbol to a positive sign a good idea in all locales? */ -static void -u_printf_set_sign(UNumberFormat *format, - const u_printf_spec_info *info, - UChar *prefixBuffer, - int32_t *prefixBufLen, - UErrorCode *status) -{ - if(info->fShowSign) { - *prefixBufLen = unum_getTextAttribute(format, - UNUM_POSITIVE_PREFIX, - prefixBuffer, - *prefixBufLen, - status); - if (info->fSpace) { - /* Setting UNUM_PLUS_SIGN_SYMBOL affects the exponent too. */ - /* unum_setSymbol(format, UNUM_PLUS_SIGN_SYMBOL, gSpaceStr, 1, &status); */ - unum_setTextAttribute(format, UNUM_POSITIVE_PREFIX, gSpaceStr, 1, status); - } - else { - UChar plusSymbol[UPRINTF_SYMBOL_BUFFER_SIZE]; - int32_t symbolLen; - - symbolLen = unum_getSymbol(format, - UNUM_PLUS_SIGN_SYMBOL, - plusSymbol, - UPRV_LENGTHOF(plusSymbol), - status); - unum_setTextAttribute(format, - UNUM_POSITIVE_PREFIX, - plusSymbol, - symbolLen, - status); - } - } - else { - *prefixBufLen = 0; - } -} - -static void -u_printf_reset_sign(UNumberFormat *format, - const u_printf_spec_info *info, - UChar *prefixBuffer, - int32_t *prefixBufLen, - UErrorCode *status) -{ - if(info->fShowSign) { - unum_setTextAttribute(format, - UNUM_POSITIVE_PREFIX, - prefixBuffer, - *prefixBufLen, - status); - } -} - - -/* handle a '%' */ -static int32_t -u_printf_simple_percent_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - (void)formatBundle; - (void)info; - (void)args; - static const UChar PERCENT[] = { UP_PERCENT }; - - /* put a single '%' onto the output */ - return handler->write(context, PERCENT, 1); -} - -/* handle 's' */ -static int32_t -u_printf_string_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - (void)formatBundle; - UChar *s; - UChar buffer[UFMT_DEFAULT_BUFFER_SIZE]; - int32_t len, written; - int32_t argSize; - const char *arg = (const char*)(args[0].ptrValue); - - /* convert from the default codepage to Unicode */ - if (arg) { - argSize = (int32_t)strlen(arg) + 1; - if (argSize >= MAX_UCHAR_BUFFER_SIZE(buffer)) { - s = ufmt_defaultCPToUnicode(arg, argSize, - (UChar *)uprv_malloc(MAX_UCHAR_BUFFER_NEEDED(argSize)), - MAX_UCHAR_BUFFER_NEEDED(argSize)); - if(s == NULL) { - return 0; - } - } - else { - s = ufmt_defaultCPToUnicode(arg, argSize, buffer, - UPRV_LENGTHOF(buffer)); - } - } - else { - s = (UChar *)gNullStr; - } - len = u_strlen(s); - - /* width = minimum # of characters to write */ - /* precision = maximum # of characters to write */ - if (info->fPrecision != -1 && info->fPrecision < len) { - len = info->fPrecision; - } - - written = handler->pad_and_justify(context, info, s, len); - - /* clean up */ - if (gNullStr != s && buffer != s) { - uprv_free(s); - } - - return written; -} - -static int32_t -u_printf_char_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - (void)formatBundle; - UChar s[U16_MAX_LENGTH+1]; - int32_t len = 1, written; - unsigned char arg = (unsigned char)(args[0].int64Value); - - /* convert from default codepage to Unicode */ - ufmt_defaultCPToUnicode((const char *)&arg, 2, s, UPRV_LENGTHOF(s)); - - /* Remember that this may be an MBCS character */ - if (arg != 0) { - len = u_strlen(s); - } - - /* width = minimum # of characters to write */ - /* precision = maximum # of characters to write */ - /* precision is ignored when handling a char */ - - written = handler->pad_and_justify(context, info, s, len); - - return written; -} - -static int32_t -u_printf_double_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - double num = (double) (args[0].doubleValue); - UNumberFormat *format; - UChar result[UPRINTF_BUFFER_SIZE]; - UChar prefixBuffer[UPRINTF_BUFFER_SIZE]; - int32_t prefixBufferLen = sizeof(prefixBuffer); - int32_t minDecimalDigits; - int32_t maxDecimalDigits; - int32_t resultLen; - UErrorCode status = U_ZERO_ERROR; - - prefixBuffer[0] = 0; - - /* mask off any necessary bits */ - /* if(! info->fIsLongDouble) - num &= DBL_MAX;*/ - - /* get the formatter */ - format = u_locbund_getNumberFormat(formatBundle, UNUM_DECIMAL); - - /* handle error */ - if(format == 0) - return 0; - - /* save the formatter's state */ - minDecimalDigits = unum_getAttribute(format, UNUM_MIN_FRACTION_DIGITS); - maxDecimalDigits = unum_getAttribute(format, UNUM_MAX_FRACTION_DIGITS); - - /* set the appropriate flags and number of decimal digits on the formatter */ - if(info->fPrecision != -1) { - /* set the # of decimal digits */ - unum_setAttribute(format, UNUM_FRACTION_DIGITS, info->fPrecision); - } - else if(info->fAlt) { - /* '#' means always show decimal point */ - /* copy of printf behavior on Solaris - '#' shows 6 digits */ - unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6); - } - else { - /* # of decimal digits is 6 if precision not specified regardless of locale */ - unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6); - } - - /* set whether to show the sign */ - if (info->fShowSign) { - u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status); - } - - /* format the number */ - resultLen = unum_formatDouble(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status); - - if (U_FAILURE(status)) { - resultLen = 0; - } - - /* restore the number format */ - /* TODO: Is this needed? */ - unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, minDecimalDigits); - unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, maxDecimalDigits); - - if (info->fShowSign) { - /* Reset back to original value regardless of what the error was */ - UErrorCode localStatus = U_ZERO_ERROR; - u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus); - } - - return handler->pad_and_justify(context, info, result, resultLen); -} - -/* HSYS */ -static int32_t -u_printf_integer_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - int64_t num = args[0].int64Value; - UNumberFormat *format; - UChar result[UPRINTF_BUFFER_SIZE]; - UChar prefixBuffer[UPRINTF_BUFFER_SIZE]; - int32_t prefixBufferLen = sizeof(prefixBuffer); - int32_t minDigits = -1; - int32_t resultLen; - UErrorCode status = U_ZERO_ERROR; - - prefixBuffer[0] = 0; - - /* mask off any necessary bits */ - if (info->fIsShort) - num = (int16_t)num; - else if (!info->fIsLongLong) - num = (int32_t)num; - - /* get the formatter */ - format = u_locbund_getNumberFormat(formatBundle, UNUM_DECIMAL); - - /* handle error */ - if(format == 0) - return 0; - - /* set the appropriate flags on the formatter */ - - /* set the minimum integer digits */ - if(info->fPrecision != -1) { - /* set the minimum # of digits */ - minDigits = unum_getAttribute(format, UNUM_MIN_INTEGER_DIGITS); - unum_setAttribute(format, UNUM_MIN_INTEGER_DIGITS, info->fPrecision); - } - - /* set whether to show the sign */ - if(info->fShowSign) { - u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status); - } - - /* format the number */ - resultLen = unum_formatInt64(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status); - - if (U_FAILURE(status)) { - resultLen = 0; - } - - /* restore the number format */ - if (minDigits != -1) { - unum_setAttribute(format, UNUM_MIN_INTEGER_DIGITS, minDigits); - } - - if (info->fShowSign) { - /* Reset back to original value regardless of what the error was */ - UErrorCode localStatus = U_ZERO_ERROR; - u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus); - } - - return handler->pad_and_justify(context, info, result, resultLen); -} - -static int32_t -u_printf_hex_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - (void)formatBundle; - int64_t num = args[0].int64Value; - UChar result[UPRINTF_BUFFER_SIZE]; - int32_t len = UPRINTF_BUFFER_SIZE; - - - /* mask off any necessary bits */ - if (info->fIsShort) - num &= UINT16_MAX; - else if (!info->fIsLongLong) - num &= UINT32_MAX; - - /* format the number, preserving the minimum # of digits */ - ufmt_64tou(result, &len, num, 16, - (UBool)(info->fSpec == 0x0078), - (info->fPrecision == -1 && info->fZero) ? info->fWidth : info->fPrecision); - - /* convert to alt form, if desired */ - if(num != 0 && info->fAlt && len < UPRINTF_BUFFER_SIZE - 2) { - /* shift the formatted string right by 2 chars */ - memmove(result + 2, result, len * sizeof(UChar)); - result[0] = 0x0030; - result[1] = info->fSpec; - len += 2; - } - - return handler->pad_and_justify(context, info, result, len); -} - -static int32_t -u_printf_octal_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - (void)formatBundle; - int64_t num = args[0].int64Value; - UChar result[UPRINTF_BUFFER_SIZE]; - int32_t len = UPRINTF_BUFFER_SIZE; - - - /* mask off any necessary bits */ - if (info->fIsShort) - num &= UINT16_MAX; - else if (!info->fIsLongLong) - num &= UINT32_MAX; - - /* format the number, preserving the minimum # of digits */ - ufmt_64tou(result, &len, num, 8, - FALSE, /* doesn't matter for octal */ - info->fPrecision == -1 && info->fZero ? info->fWidth : info->fPrecision); - - /* convert to alt form, if desired */ - if(info->fAlt && result[0] != 0x0030 && len < UPRINTF_BUFFER_SIZE - 1) { - /* shift the formatted string right by 1 char */ - memmove(result + 1, result, len * sizeof(UChar)); - result[0] = 0x0030; - len += 1; - } - - return handler->pad_and_justify(context, info, result, len); -} - -static int32_t -u_printf_uinteger_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - int64_t num = args[0].int64Value; - UNumberFormat *format; - UChar result[UPRINTF_BUFFER_SIZE]; - int32_t minDigits = -1; - int32_t resultLen; - UErrorCode status = U_ZERO_ERROR; - - /* TODO: Fix this once uint64_t can be formatted. */ - if (info->fIsShort) - num &= UINT16_MAX; - else if (!info->fIsLongLong) - num &= UINT32_MAX; - - /* get the formatter */ - format = u_locbund_getNumberFormat(formatBundle, UNUM_DECIMAL); - - /* handle error */ - if(format == 0) - return 0; - - /* set the appropriate flags on the formatter */ - - /* set the minimum integer digits */ - if(info->fPrecision != -1) { - /* set the minimum # of digits */ - minDigits = unum_getAttribute(format, UNUM_MIN_INTEGER_DIGITS); - unum_setAttribute(format, UNUM_MIN_INTEGER_DIGITS, info->fPrecision); - } - - /* To mirror other stdio implementations, we ignore the sign argument */ - - /* format the number */ - resultLen = unum_formatInt64(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status); - - if (U_FAILURE(status)) { - resultLen = 0; - } - - /* restore the number format */ - if (minDigits != -1) { - unum_setAttribute(format, UNUM_MIN_INTEGER_DIGITS, minDigits); - } - - return handler->pad_and_justify(context, info, result, resultLen); -} - -static int32_t -u_printf_pointer_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - (void)formatBundle; - UChar result[UPRINTF_BUFFER_SIZE]; - int32_t len = UPRINTF_BUFFER_SIZE; - - /* format the pointer in hex */ - ufmt_ptou(result, &len, args[0].ptrValue, TRUE/*, info->fPrecision*/); - - return handler->pad_and_justify(context, info, result, len); -} - -static int32_t -u_printf_scientific_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - double num = (double) (args[0].doubleValue); - UNumberFormat *format; - UChar result[UPRINTF_BUFFER_SIZE]; - UChar prefixBuffer[UPRINTF_BUFFER_SIZE]; - int32_t prefixBufferLen = sizeof(prefixBuffer); - int32_t minDecimalDigits; - int32_t maxDecimalDigits; - UErrorCode status = U_ZERO_ERROR; - UChar srcExpBuf[UPRINTF_SYMBOL_BUFFER_SIZE]; - int32_t srcLen, expLen; - int32_t resultLen; - UChar expBuf[UPRINTF_SYMBOL_BUFFER_SIZE]; - - prefixBuffer[0] = 0; - - /* mask off any necessary bits */ - /* if(! info->fIsLongDouble) - num &= DBL_MAX;*/ - - /* get the formatter */ - format = u_locbund_getNumberFormat(formatBundle, UNUM_SCIENTIFIC); - - /* handle error */ - if(format == 0) - return 0; - - /* set the appropriate flags on the formatter */ - - srcLen = unum_getSymbol(format, - UNUM_EXPONENTIAL_SYMBOL, - srcExpBuf, - sizeof(srcExpBuf), - &status); - - /* Upper/lower case the e */ - if (info->fSpec == (UChar)0x65 /* e */) { - expLen = u_strToLower(expBuf, (int32_t)sizeof(expBuf), - srcExpBuf, srcLen, - formatBundle->fLocale, - &status); - } - else { - expLen = u_strToUpper(expBuf, (int32_t)sizeof(expBuf), - srcExpBuf, srcLen, - formatBundle->fLocale, - &status); - } - - unum_setSymbol(format, - UNUM_EXPONENTIAL_SYMBOL, - expBuf, - expLen, - &status); - - /* save the formatter's state */ - minDecimalDigits = unum_getAttribute(format, UNUM_MIN_FRACTION_DIGITS); - maxDecimalDigits = unum_getAttribute(format, UNUM_MAX_FRACTION_DIGITS); - - /* set the appropriate flags and number of decimal digits on the formatter */ - if(info->fPrecision != -1) { - /* set the # of decimal digits */ - if (info->fOrigSpec == (UChar)0x65 /* e */ || info->fOrigSpec == (UChar)0x45 /* E */) { - unum_setAttribute(format, UNUM_FRACTION_DIGITS, info->fPrecision); - } - else { - unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, 1); - unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, info->fPrecision); - } - } - else if(info->fAlt) { - /* '#' means always show decimal point */ - /* copy of printf behavior on Solaris - '#' shows 6 digits */ - unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6); - } - else { - /* # of decimal digits is 6 if precision not specified */ - unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6); - } - - /* set whether to show the sign */ - if (info->fShowSign) { - u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status); - } - - /* format the number */ - resultLen = unum_formatDouble(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status); - - if (U_FAILURE(status)) { - resultLen = 0; - } - - /* restore the number format */ - /* TODO: Is this needed? */ - unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, minDecimalDigits); - unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, maxDecimalDigits); - - /* Since we're the only one using the scientific - format, we don't need to save the old exponent value. */ - /*unum_setSymbol(format, - UNUM_EXPONENTIAL_SYMBOL, - srcExpBuf, - srcLen, - &status);*/ - - if (info->fShowSign) { - /* Reset back to original value regardless of what the error was */ - UErrorCode localStatus = U_ZERO_ERROR; - u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus); - } - - return handler->pad_and_justify(context, info, result, resultLen); -} - -static int32_t -u_printf_percent_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - double num = (double) (args[0].doubleValue); - UNumberFormat *format; - UChar result[UPRINTF_BUFFER_SIZE]; - UChar prefixBuffer[UPRINTF_BUFFER_SIZE]; - int32_t prefixBufferLen = sizeof(prefixBuffer); - int32_t minDecimalDigits; - int32_t maxDecimalDigits; - int32_t resultLen; - UErrorCode status = U_ZERO_ERROR; - - prefixBuffer[0] = 0; - - /* mask off any necessary bits */ - /* if(! info->fIsLongDouble) - num &= DBL_MAX;*/ - - /* get the formatter */ - format = u_locbund_getNumberFormat(formatBundle, UNUM_PERCENT); - - /* handle error */ - if(format == 0) - return 0; - - /* save the formatter's state */ - minDecimalDigits = unum_getAttribute(format, UNUM_MIN_FRACTION_DIGITS); - maxDecimalDigits = unum_getAttribute(format, UNUM_MAX_FRACTION_DIGITS); - - /* set the appropriate flags and number of decimal digits on the formatter */ - if(info->fPrecision != -1) { - /* set the # of decimal digits */ - unum_setAttribute(format, UNUM_FRACTION_DIGITS, info->fPrecision); - } - else if(info->fAlt) { - /* '#' means always show decimal point */ - /* copy of printf behavior on Solaris - '#' shows 6 digits */ - unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6); - } - else { - /* # of decimal digits is 6 if precision not specified */ - unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6); - } - - /* set whether to show the sign */ - if (info->fShowSign) { - u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status); - } - - /* format the number */ - resultLen = unum_formatDouble(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status); - - if (U_FAILURE(status)) { - resultLen = 0; - } - - /* restore the number format */ - /* TODO: Is this needed? */ - unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, minDecimalDigits); - unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, maxDecimalDigits); - - if (info->fShowSign) { - /* Reset back to original value regardless of what the error was */ - UErrorCode localStatus = U_ZERO_ERROR; - u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus); - } - - return handler->pad_and_justify(context, info, result, resultLen); -} - -static int32_t -u_printf_ustring_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - (void)formatBundle; - int32_t len, written; - const UChar *arg = (const UChar*)(args[0].ptrValue); - - /* allocate enough space for the buffer */ - if (arg == NULL) { - arg = gNullStr; - } - len = u_strlen(arg); - - /* width = minimum # of characters to write */ - /* precision = maximum # of characters to write */ - if (info->fPrecision != -1 && info->fPrecision < len) { - len = info->fPrecision; - } - - /* determine if the string should be padded */ - written = handler->pad_and_justify(context, info, arg, len); - - return written; -} - -static int32_t -u_printf_uchar_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - (void)formatBundle; - int32_t written = 0; - UChar arg = (UChar)(args[0].int64Value); - - /* width = minimum # of characters to write */ - /* precision = maximum # of characters to write */ - /* precision is ignored when handling a uchar */ - - /* determine if the string should be padded */ - written = handler->pad_and_justify(context, info, &arg, 1); - - return written; -} - -static int32_t -u_printf_scidbl_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - u_printf_spec_info scidbl_info; - double num = args[0].doubleValue; - int32_t retVal; - UNumberFormat *format; - int32_t maxSigDecimalDigits, significantDigits; - - memcpy(&scidbl_info, info, sizeof(u_printf_spec_info)); - - /* determine whether to use 'd', 'e' or 'f' notation */ - if (scidbl_info.fPrecision == -1 && num == uprv_trunc(num)) - { - /* use 'f' notation */ - scidbl_info.fSpec = 0x0066; - scidbl_info.fPrecision = 0; - /* call the double handler */ - retVal = u_printf_double_handler(handler, context, formatBundle, &scidbl_info, args); - } - else if(num < 0.0001 || (scidbl_info.fPrecision < 1 && 1000000.0 <= num) - || (scidbl_info.fPrecision != -1 && num > uprv_pow10(scidbl_info.fPrecision))) - { - /* use 'e' or 'E' notation */ - scidbl_info.fSpec = scidbl_info.fSpec - 2; - if (scidbl_info.fPrecision == -1) { - scidbl_info.fPrecision = 5; - } - /* call the scientific handler */ - retVal = u_printf_scientific_handler(handler, context, formatBundle, &scidbl_info, args); - } - else { - format = u_locbund_getNumberFormat(formatBundle, UNUM_DECIMAL); - /* Check for null pointer */ - if (format == NULL) { - return 0; - } - maxSigDecimalDigits = unum_getAttribute(format, UNUM_MAX_SIGNIFICANT_DIGITS); - significantDigits = scidbl_info.fPrecision; - - /* use 'f' notation */ - scidbl_info.fSpec = 0x0066; - if (significantDigits == -1) { - significantDigits = 6; - } - unum_setAttribute(format, UNUM_SIGNIFICANT_DIGITS_USED, TRUE); - unum_setAttribute(format, UNUM_MAX_SIGNIFICANT_DIGITS, significantDigits); - /* call the double handler */ - retVal = u_printf_double_handler(handler, context, formatBundle, &scidbl_info, args); - unum_setAttribute(format, UNUM_MAX_SIGNIFICANT_DIGITS, maxSigDecimalDigits); - unum_setAttribute(format, UNUM_SIGNIFICANT_DIGITS_USED, FALSE); - } - return retVal; -} - -static int32_t -u_printf_count_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - (void)handler; - (void)context; - (void)formatBundle; - int32_t *count = (int32_t*)(args[0].ptrValue); - - /* in the special case of count, the u_printf_spec_info's width */ - /* will contain the # of chars written thus far */ - *count = info->fWidth; - - return 0; -} - -static int32_t -u_printf_spellout_handler(const u_printf_stream_handler *handler, - void *context, - ULocaleBundle *formatBundle, - const u_printf_spec_info *info, - const ufmt_args *args) -{ - double num = (double) (args[0].doubleValue); - UNumberFormat *format; - UChar result[UPRINTF_BUFFER_SIZE]; - UChar prefixBuffer[UPRINTF_BUFFER_SIZE]; - int32_t prefixBufferLen = sizeof(prefixBuffer); - int32_t minDecimalDigits; - int32_t maxDecimalDigits; - int32_t resultLen; - UErrorCode status = U_ZERO_ERROR; - - prefixBuffer[0] = 0; - - /* mask off any necessary bits */ - /* if(! info->fIsLongDouble) - num &= DBL_MAX;*/ - - /* get the formatter */ - format = u_locbund_getNumberFormat(formatBundle, UNUM_SPELLOUT); - - /* handle error */ - if(format == 0) - return 0; - - /* save the formatter's state */ - minDecimalDigits = unum_getAttribute(format, UNUM_MIN_FRACTION_DIGITS); - maxDecimalDigits = unum_getAttribute(format, UNUM_MAX_FRACTION_DIGITS); - - /* set the appropriate flags and number of decimal digits on the formatter */ - if(info->fPrecision != -1) { - /* set the # of decimal digits */ - unum_setAttribute(format, UNUM_FRACTION_DIGITS, info->fPrecision); - } - else if(info->fAlt) { - /* '#' means always show decimal point */ - /* copy of printf behavior on Solaris - '#' shows 6 digits */ - unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6); - } - else { - /* # of decimal digits is 6 if precision not specified */ - unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6); - } - - /* set whether to show the sign */ - if (info->fShowSign) { - u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status); - } - - /* format the number */ - resultLen = unum_formatDouble(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status); - - if (U_FAILURE(status)) { - resultLen = 0; - } - - /* restore the number format */ - /* TODO: Is this needed? */ - unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, minDecimalDigits); - unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, maxDecimalDigits); - - if (info->fShowSign) { - /* Reset back to original value regardless of what the error was */ - UErrorCode localStatus = U_ZERO_ERROR; - u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus); - } - - return handler->pad_and_justify(context, info, result, resultLen); -} - -/* Use US-ASCII characters only for formatting. Most codepages have - characters 20-7F from Unicode. Using any other codepage specific - characters will make it very difficult to format the string on - non-Unicode machines */ -static const u_printf_info g_u_printf_infos[UPRINTF_NUM_FMT_HANDLERS] = { -/* 0x20 */ - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_SIMPLE_PERCENT,UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - -/* 0x30 */ - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - -/* 0x40 */ - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_UCHAR, - UFMT_EMPTY, UFMT_SCIENTIFIC, UFMT_EMPTY, UFMT_SCIDBL, -#ifdef U_USE_OBSOLETE_IO_FORMATTING - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_UCHAR/*deprecated*/, -#else - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, -#endif - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - -/* 0x50 */ - UFMT_PERCENT, UFMT_EMPTY, UFMT_EMPTY, UFMT_USTRING, -#ifdef U_USE_OBSOLETE_IO_FORMATTING - UFMT_EMPTY, UFMT_USTRING/*deprecated*/,UFMT_SPELLOUT, UFMT_EMPTY, -#else - UFMT_EMPTY, UFMT_EMPTY, UFMT_SPELLOUT, UFMT_EMPTY, -#endif - UFMT_HEX, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - -/* 0x60 */ - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_CHAR, - UFMT_INT, UFMT_SCIENTIFIC, UFMT_DOUBLE, UFMT_SCIDBL, - UFMT_EMPTY, UFMT_INT, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_COUNT, UFMT_OCTAL, - -/* 0x70 */ - UFMT_POINTER, UFMT_EMPTY, UFMT_EMPTY, UFMT_STRING, - UFMT_EMPTY, UFMT_UINT, UFMT_EMPTY, UFMT_EMPTY, - UFMT_HEX, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, -}; - -/* flag characters for uprintf */ -#define FLAG_MINUS 0x002D -#define FLAG_PLUS 0x002B -#define FLAG_SPACE 0x0020 -#define FLAG_POUND 0x0023 -#define FLAG_ZERO 0x0030 -#define FLAG_PAREN 0x0028 - -#define ISFLAG(s) (s) == FLAG_MINUS || \ - (s) == FLAG_PLUS || \ - (s) == FLAG_SPACE || \ - (s) == FLAG_POUND || \ - (s) == FLAG_ZERO || \ - (s) == FLAG_PAREN - -/* special characters for uprintf */ -#define SPEC_ASTERISK 0x002A -#define SPEC_DOLLARSIGN 0x0024 -#define SPEC_PERIOD 0x002E -#define SPEC_PERCENT 0x0025 - -/* unicode digits */ -#define DIGIT_ZERO 0x0030 -#define DIGIT_ONE 0x0031 -#define DIGIT_TWO 0x0032 -#define DIGIT_THREE 0x0033 -#define DIGIT_FOUR 0x0034 -#define DIGIT_FIVE 0x0035 -#define DIGIT_SIX 0x0036 -#define DIGIT_SEVEN 0x0037 -#define DIGIT_EIGHT 0x0038 -#define DIGIT_NINE 0x0039 - -#define ISDIGIT(s) (s) == DIGIT_ZERO || \ - (s) == DIGIT_ONE || \ - (s) == DIGIT_TWO || \ - (s) == DIGIT_THREE || \ - (s) == DIGIT_FOUR || \ - (s) == DIGIT_FIVE || \ - (s) == DIGIT_SIX || \ - (s) == DIGIT_SEVEN || \ - (s) == DIGIT_EIGHT || \ - (s) == DIGIT_NINE - -/* u_printf modifiers */ -#define MOD_H 0x0068 -#define MOD_LOWERL 0x006C -#define MOD_L 0x004C - -#define ISMOD(s) (s) == MOD_H || \ - (s) == MOD_LOWERL || \ - (s) == MOD_L -/* Returns an array of the parsed argument type given in the format string. */ -static ufmt_args* parseArguments(const UChar *alias, va_list ap, UErrorCode *status) { - ufmt_args *arglist = NULL; - ufmt_type_info *typelist = NULL; - UBool *islonglong = NULL; - int32_t size = 0; - int32_t pos = 0; - UChar type; - uint16_t handlerNum; - const UChar *aliasStart = alias; - - /* get maximum number of arguments */ - for(;;) { - /* find % */ - while(*alias != UP_PERCENT && *alias != 0x0000) { - alias++; - } - - if(*alias == 0x0000) { - break; - } - - alias++; - - /* handle the pos number */ - if(ISDIGIT(*alias)) { - - /* handle positional parameters */ - if(ISDIGIT(*alias)) { - pos = (int) (*alias++ - DIGIT_ZERO); - - while(ISDIGIT(*alias)) { - pos *= 10; - pos += (int) (*alias++ - DIGIT_ZERO); - } - } - - /* if there is no '$', don't read anything */ - if(*alias != SPEC_DOLLARSIGN) { - return NULL; - } - } else { - return NULL; - } - - if (pos > size) { - size = pos; - } - } - - /* create the parsed argument list */ - typelist = (ufmt_type_info*)uprv_malloc(sizeof(ufmt_type_info) * size); - islonglong = (UBool*)uprv_malloc(sizeof(UBool) * size); - arglist = (ufmt_args*)uprv_malloc(sizeof(ufmt_args) * size); - - /* If malloc failed, return NULL */ - if (!typelist || !islonglong || !arglist) { - if (typelist) { - uprv_free(typelist); - } - - if (islonglong) { - uprv_free(islonglong); - } - - if (arglist) { - uprv_free(arglist); - } - - *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } - - /* reset alias back to the beginning */ - alias = aliasStart; - - for(;;) { - /* find % */ - while(*alias != UP_PERCENT && *alias != 0x0000) { - alias++; - } - - if(*alias == 0x0000) { - break; - } - - alias++; - - /* handle positional parameters */ - if(ISDIGIT(*alias)) { - pos = (int) (*alias++ - DIGIT_ZERO); - - while(ISDIGIT(*alias)) { - pos *= 10; - pos += (int) (*alias++ - DIGIT_ZERO); - } - } - /* offset position by 1 */ - pos--; - - /* skip over everything except for the type */ - while (ISMOD(*alias) || ISFLAG(*alias) || ISDIGIT(*alias) || - *alias == SPEC_ASTERISK || *alias == SPEC_PERIOD || *alias == SPEC_DOLLARSIGN) { - islonglong[pos] = FALSE; - if (ISMOD(*alias)) { - alias++; - if (*alias == MOD_LOWERL) { - islonglong[pos] = TRUE; - } - } - alias++; - } - type = *alias; - - /* store the argument type in the correct position of the parsed argument list */ - handlerNum = (uint16_t)(type - UPRINTF_BASE_FMT_HANDLERS); - if (handlerNum < UPRINTF_NUM_FMT_HANDLERS) { - typelist[pos] = g_u_printf_infos[ handlerNum ].info; - } else { - typelist[pos] = ufmt_empty; - } - } - - /* store argument in arglist */ - for (pos = 0; pos < size; pos++) { - switch (typelist[pos]) { - case ufmt_string: - case ufmt_ustring: - case ufmt_pointer: - arglist[pos].ptrValue = va_arg(ap, void*); - break; - case ufmt_char: - case ufmt_uchar: - case ufmt_int: - if (islonglong[pos]) { - arglist[pos].int64Value = va_arg(ap, int64_t); - } - else { - arglist[pos].int64Value = va_arg(ap, int32_t); - } - break; - case ufmt_float: - arglist[pos].floatValue = (float) va_arg(ap, double); - break; - case ufmt_double: - arglist[pos].doubleValue = va_arg(ap, double); - break; - default: - /* else args is ignored */ - arglist[pos].ptrValue = NULL; - break; - } - } - - uprv_free(typelist); - uprv_free(islonglong); - - return arglist; -} - -/* We parse the argument list in Unicode */ -U_CFUNC int32_t -u_printf_parse(const u_printf_stream_handler *streamHandler, - const UChar *fmt, - void *context, - u_localized_print_string *locStringContext, - ULocaleBundle *formatBundle, - int32_t *written, - va_list ap) -{ - uint16_t handlerNum; - ufmt_args args; - ufmt_type_info argType; - u_printf_handler *handler; - u_printf_spec spec; - u_printf_spec_info *info = &(spec.fInfo); - - const UChar *alias = fmt; - const UChar *backup; - const UChar *lastAlias; - const UChar *orgAlias = fmt; - /* parsed argument list */ - ufmt_args *arglist = NULL; /* initialized it to avoid compiler warnings */ - UErrorCode status = U_ZERO_ERROR; - if (!locStringContext || locStringContext->available >= 0) { - /* get the parsed list of argument types */ - arglist = parseArguments(orgAlias, ap, &status); - - /* Return error if parsing failed. */ - if (U_FAILURE(status)) { - return -1; - } - } - - /* iterate through the pattern */ - while(!locStringContext || locStringContext->available >= 0) { - - /* find the next '%' */ - lastAlias = alias; - while(*alias != UP_PERCENT && *alias != 0x0000) { - alias++; - } - - /* write any characters before the '%' */ - if(alias > lastAlias) { - *written += (streamHandler->write)(context, lastAlias, (int32_t)(alias - lastAlias)); - } - - /* break if at end of string */ - if(*alias == 0x0000) { - break; - } - - /* initialize spec to default values */ - spec.fWidthPos = -1; - spec.fPrecisionPos = -1; - spec.fArgPos = -1; - - uprv_memset(info, 0, sizeof(*info)); - info->fPrecision = -1; - info->fWidth = -1; - info->fPadChar = 0x0020; - - /* skip over the initial '%' */ - alias++; - - /* Check for positional argument */ - if(ISDIGIT(*alias)) { - - /* Save the current position */ - backup = alias; - - /* handle positional parameters */ - if(ISDIGIT(*alias)) { - spec.fArgPos = (int) (*alias++ - DIGIT_ZERO); - - while(ISDIGIT(*alias)) { - spec.fArgPos *= 10; - spec.fArgPos += (int) (*alias++ - DIGIT_ZERO); - } - } - - /* if there is no '$', don't read anything */ - if(*alias != SPEC_DOLLARSIGN) { - spec.fArgPos = -1; - alias = backup; - } - /* munge the '$' */ - else - alias++; - } - - /* Get any format flags */ - while(ISFLAG(*alias)) { - switch(*alias++) { - - /* left justify */ - case FLAG_MINUS: - info->fLeft = TRUE; - break; - - /* always show sign */ - case FLAG_PLUS: - info->fShowSign = TRUE; - break; - - /* use space if no sign present */ - case FLAG_SPACE: - info->fShowSign = TRUE; - info->fSpace = TRUE; - break; - - /* use alternate form */ - case FLAG_POUND: - info->fAlt = TRUE; - break; - - /* pad with leading zeroes */ - case FLAG_ZERO: - info->fZero = TRUE; - info->fPadChar = 0x0030; - break; - - /* pad character specified */ - case FLAG_PAREN: - - /* TODO test that all four are numbers */ - /* first four characters are hex values for pad char */ - info->fPadChar = (UChar)ufmt_digitvalue(*alias++); - info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*alias++)); - info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*alias++)); - info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*alias++)); - - /* final character is ignored */ - alias++; - - break; - } - } - - /* Get the width */ - - /* width is specified out of line */ - if(*alias == SPEC_ASTERISK) { - - info->fWidth = -2; - - /* Skip the '*' */ - alias++; - - /* Save the current position */ - backup = alias; - - /* handle positional parameters */ - if(ISDIGIT(*alias)) { - spec.fWidthPos = (int) (*alias++ - DIGIT_ZERO); - - while(ISDIGIT(*alias)) { - spec.fWidthPos *= 10; - spec.fWidthPos += (int) (*alias++ - DIGIT_ZERO); - } - } - - /* if there is no '$', don't read anything */ - if(*alias != SPEC_DOLLARSIGN) { - spec.fWidthPos = -1; - alias = backup; - } - /* munge the '$' */ - else - alias++; - } - /* read the width, if present */ - else if(ISDIGIT(*alias)){ - info->fWidth = (int) (*alias++ - DIGIT_ZERO); - - while(ISDIGIT(*alias)) { - info->fWidth *= 10; - info->fWidth += (int) (*alias++ - DIGIT_ZERO); - } - } - - /* Get the precision */ - - if(*alias == SPEC_PERIOD) { - - /* eat up the '.' */ - alias++; - - /* precision is specified out of line */ - if(*alias == SPEC_ASTERISK) { - - info->fPrecision = -2; - - /* Skip the '*' */ - alias++; - - /* save the current position */ - backup = alias; - - /* handle positional parameters */ - if(ISDIGIT(*alias)) { - spec.fPrecisionPos = (int) (*alias++ - DIGIT_ZERO); - - while(ISDIGIT(*alias)) { - spec.fPrecisionPos *= 10; - spec.fPrecisionPos += (int) (*alias++ - DIGIT_ZERO); - } - - /* if there is no '$', don't read anything */ - if(*alias != SPEC_DOLLARSIGN) { - spec.fPrecisionPos = -1; - alias = backup; - } - else { - /* munge the '$' */ - alias++; - } - } - } - /* read the precision */ - else if(ISDIGIT(*alias)){ - info->fPrecision = (int) (*alias++ - DIGIT_ZERO); - - while(ISDIGIT(*alias)) { - info->fPrecision *= 10; - info->fPrecision += (int) (*alias++ - DIGIT_ZERO); - } - } - } - - /* Get any modifiers */ - if(ISMOD(*alias)) { - switch(*alias++) { - - /* short */ - case MOD_H: - info->fIsShort = TRUE; - break; - - /* long or long long */ - case MOD_LOWERL: - if(*alias == MOD_LOWERL) { - info->fIsLongLong = TRUE; - /* skip over the next 'l' */ - alias++; - } - else - info->fIsLong = TRUE; - break; - - /* long double */ - case MOD_L: - info->fIsLongDouble = TRUE; - break; - } - } - - /* finally, get the specifier letter */ - info->fSpec = *alias++; - info->fOrigSpec = info->fSpec; - - /* fill in the precision and width, if specified out of line */ - - /* width specified out of line */ - if(spec.fInfo.fWidth == -2) { - if(spec.fWidthPos == -1) { - /* read the width from the argument list */ - info->fWidth = va_arg(ap, int32_t); - } - /* else handle positional parameter */ - - /* if it's negative, take the absolute value and set left alignment */ - if(info->fWidth < 0) { - info->fWidth *= -1; /* Make positive */ - info->fLeft = TRUE; - } - } - - /* precision specified out of line */ - if(info->fPrecision == -2) { - if(spec.fPrecisionPos == -1) { - /* read the precision from the argument list */ - info->fPrecision = va_arg(ap, int32_t); - } - /* else handle positional parameter */ - - /* if it's negative, set it to zero */ - if(info->fPrecision < 0) - info->fPrecision = 0; - } - - handlerNum = (uint16_t)(info->fSpec - UPRINTF_BASE_FMT_HANDLERS); - if (handlerNum < UPRINTF_NUM_FMT_HANDLERS) { - /* query the info function for argument information */ - argType = g_u_printf_infos[ handlerNum ].info; - - /* goto the correct argument on arg_list if position is specified */ - if (spec.fArgPos > 0) { - /* offset position by 1 */ - spec.fArgPos--; - switch(argType) { - case ufmt_count: - /* set the spec's width to the # of chars written */ - info->fWidth = *written; - /* fall through to set the pointer */ - U_FALLTHROUGH; - case ufmt_string: - case ufmt_ustring: - case ufmt_pointer: - args.ptrValue = arglist[spec.fArgPos].ptrValue; - break; - case ufmt_char: - case ufmt_uchar: - case ufmt_int: - args.int64Value = arglist[spec.fArgPos].int64Value; - break; - case ufmt_float: - args.floatValue = arglist[spec.fArgPos].floatValue; - break; - case ufmt_double: - args.doubleValue = arglist[spec.fArgPos].doubleValue; - break; - default: - /* else args is ignored */ - args.ptrValue = NULL; - break; - } - } else { /* no positional argument specified */ - switch(argType) { - case ufmt_count: - /* set the spec's width to the # of chars written */ - info->fWidth = *written; - /* fall through to set the pointer */ - U_FALLTHROUGH; - case ufmt_string: - case ufmt_ustring: - case ufmt_pointer: - args.ptrValue = va_arg(ap, void*); - break; - case ufmt_char: - case ufmt_uchar: - case ufmt_int: - if (info->fIsLongLong) { - args.int64Value = va_arg(ap, int64_t); - } - else { - args.int64Value = va_arg(ap, int32_t); - } - break; - case ufmt_float: - args.floatValue = (float) va_arg(ap, double); - break; - case ufmt_double: - args.doubleValue = va_arg(ap, double); - break; - default: - /* else args is ignored */ - args.ptrValue = NULL; - break; - } - } - - /* call the handler function */ - handler = g_u_printf_infos[ handlerNum ].handler; - if(handler != 0) { - *written += (*handler)(streamHandler, context, formatBundle, info, &args); - } - else { - /* just echo unknown tags */ - *written += (streamHandler->write)(context, fmt, (int32_t)(alias - lastAlias)); - } - } - else { - /* just echo unknown tags */ - *written += (streamHandler->write)(context, fmt, (int32_t)(alias - lastAlias)); - } - } - /* delete parsed argument list */ - if (arglist != NULL) { - uprv_free(arglist); - } - /* return # of characters in this format that have been parsed. */ - return (int32_t)(alias - fmt); -} - -#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/io/uscanf.cpp b/deps/icu-small/source/io/uscanf.cpp deleted file mode 100644 index 0febd213985bda..00000000000000 --- a/deps/icu-small/source/io/uscanf.cpp +++ /dev/null @@ -1,107 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* -* Copyright (C) 1998-2014, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* File uscanf.c -* -* Modification History: -* -* Date Name Description -* 12/02/98 stephen Creation. -* 03/13/99 stephen Modified for new C API. -****************************************************************************** -*/ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION - -#include "unicode/putil.h" -#include "unicode/ustdio.h" -#include "unicode/ustring.h" -#include "uscanf.h" -#include "ufile.h" -#include "ufmt_cmn.h" - -#include "cmemory.h" -#include "cstring.h" - - -U_CAPI int32_t U_EXPORT2 -u_fscanf(UFILE *f, - const char *patternSpecification, - ... ) -{ - va_list ap; - int32_t converted; - - va_start(ap, patternSpecification); - converted = u_vfscanf(f, patternSpecification, ap); - va_end(ap); - - return converted; -} - -U_CAPI int32_t U_EXPORT2 -u_fscanf_u(UFILE *f, - const UChar *patternSpecification, - ... ) -{ - va_list ap; - int32_t converted; - - va_start(ap, patternSpecification); - converted = u_vfscanf_u(f, patternSpecification, ap); - va_end(ap); - - return converted; -} - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_vfscanf(UFILE *f, - const char *patternSpecification, - va_list ap) -{ - int32_t converted; - UChar *pattern; - UChar patBuffer[UFMT_DEFAULT_BUFFER_SIZE]; - int32_t size = (int32_t)uprv_strlen(patternSpecification) + 1; - - /* convert from the default codepage to Unicode */ - if (size >= MAX_UCHAR_BUFFER_SIZE(patBuffer)) { - pattern = (UChar *)uprv_malloc(size * sizeof(UChar)); - if(pattern == 0) { - return 0; - } - } - else { - pattern = patBuffer; - } - u_charsToUChars(patternSpecification, pattern, size); - - /* do the work */ - converted = u_vfscanf_u(f, pattern, ap); - - /* clean up */ - if (pattern != patBuffer) { - uprv_free(pattern); - } - - return converted; -} - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_vfscanf_u(UFILE *f, - const UChar *patternSpecification, - va_list ap) -{ - return u_scanf_parse(f, patternSpecification, ap); -} - -#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/io/uscanf.h b/deps/icu-small/source/io/uscanf.h deleted file mode 100644 index 760691cb0a20aa..00000000000000 --- a/deps/icu-small/source/io/uscanf.h +++ /dev/null @@ -1,37 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* -* Copyright (C) 1998-2014, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* File uscanf.h -* -* Modification History: -* -* Date Name Description -* 12/02/98 stephen Creation. -* 03/13/99 stephen Modified for new C API. -****************************************************************************** -*/ - -#ifndef USCANF_H -#define USCANF_H - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION - -#include "unicode/ustdio.h" - -U_CFUNC int32_t -u_scanf_parse(UFILE *f, - const UChar *patternSpecification, - va_list ap); - -#endif /* #if !UCONFIG_NO_FORMATTING */ - -#endif diff --git a/deps/icu-small/source/io/uscanf_p.cpp b/deps/icu-small/source/io/uscanf_p.cpp deleted file mode 100644 index c08949d7299934..00000000000000 --- a/deps/icu-small/source/io/uscanf_p.cpp +++ /dev/null @@ -1,1450 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -******************************************************************************* -* -* Copyright (C) 1998-2016, International Business Machines -* Corporation and others. All Rights Reserved. -* -******************************************************************************* -* -* File uscnnf_p.c -* -* Modification History: -* -* Date Name Description -* 12/02/98 stephen Creation. -* 03/13/99 stephen Modified for new C API. -******************************************************************************* -*/ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION - -#include "unicode/uchar.h" -#include "unicode/ustring.h" -#include "unicode/unum.h" -#include "unicode/udat.h" -#include "unicode/uset.h" -#include "uscanf.h" -#include "ufmt_cmn.h" -#include "ufile.h" -#include "locbund.h" - -#include "cmemory.h" -#include "ustr_cnv.h" - -/* flag characters for u_scanf */ -#define FLAG_ASTERISK 0x002A -#define FLAG_PAREN 0x0028 - -#define ISFLAG(s) (s) == FLAG_ASTERISK || \ - (s) == FLAG_PAREN - -/* special characters for u_scanf */ -#define SPEC_DOLLARSIGN 0x0024 - -/* unicode digits */ -#define DIGIT_ZERO 0x0030 -#define DIGIT_ONE 0x0031 -#define DIGIT_TWO 0x0032 -#define DIGIT_THREE 0x0033 -#define DIGIT_FOUR 0x0034 -#define DIGIT_FIVE 0x0035 -#define DIGIT_SIX 0x0036 -#define DIGIT_SEVEN 0x0037 -#define DIGIT_EIGHT 0x0038 -#define DIGIT_NINE 0x0039 - -#define ISDIGIT(s) (s) == DIGIT_ZERO || \ - (s) == DIGIT_ONE || \ - (s) == DIGIT_TWO || \ - (s) == DIGIT_THREE || \ - (s) == DIGIT_FOUR || \ - (s) == DIGIT_FIVE || \ - (s) == DIGIT_SIX || \ - (s) == DIGIT_SEVEN || \ - (s) == DIGIT_EIGHT || \ - (s) == DIGIT_NINE - -/* u_scanf modifiers */ -#define MOD_H 0x0068 -#define MOD_LOWERL 0x006C -#define MOD_L 0x004C - -#define ISMOD(s) (s) == MOD_H || \ - (s) == MOD_LOWERL || \ - (s) == MOD_L - -/** - * Struct encapsulating a single uscanf format specification. - */ -typedef struct u_scanf_spec_info { - int32_t fWidth; /* Width */ - - UChar fSpec; /* Format specification */ - - UChar fPadChar; /* Padding character */ - - UBool fSkipArg; /* TRUE if arg should be skipped */ - UBool fIsLongDouble; /* L flag */ - UBool fIsShort; /* h flag */ - UBool fIsLong; /* l flag */ - UBool fIsLongLong; /* ll flag */ - UBool fIsString; /* TRUE if this is a NULL-terminated string. */ -} u_scanf_spec_info; - - -/** - * Struct encapsulating a single u_scanf format specification. - */ -typedef struct u_scanf_spec { - u_scanf_spec_info fInfo; /* Information on this spec */ - int32_t fArgPos; /* Position of data in arg list */ -} u_scanf_spec; - -/** - * Parse a single u_scanf format specifier in Unicode. - * @param fmt A pointer to a '%' character in a u_scanf format specification. - * @param spec A pointer to a u_scanf_spec to receive the parsed - * format specifier. - * @return The number of characters contained in this specifier. - */ -static int32_t -u_scanf_parse_spec (const UChar *fmt, - u_scanf_spec *spec) -{ - const UChar *s = fmt; - const UChar *backup; - u_scanf_spec_info *info = &(spec->fInfo); - - /* initialize spec to default values */ - spec->fArgPos = -1; - - info->fWidth = -1; - info->fSpec = 0x0000; - info->fPadChar = 0x0020; - info->fSkipArg = FALSE; - info->fIsLongDouble = FALSE; - info->fIsShort = FALSE; - info->fIsLong = FALSE; - info->fIsLongLong = FALSE; - info->fIsString = TRUE; - - - /* skip over the initial '%' */ - s++; - - /* Check for positional argument */ - if(ISDIGIT(*s)) { - - /* Save the current position */ - backup = s; - - /* handle positional parameters */ - if(ISDIGIT(*s)) { - spec->fArgPos = (int) (*s++ - DIGIT_ZERO); - - while(ISDIGIT(*s)) { - spec->fArgPos *= 10; - spec->fArgPos += (int) (*s++ - DIGIT_ZERO); - } - } - - /* if there is no '$', don't read anything */ - if(*s != SPEC_DOLLARSIGN) { - spec->fArgPos = -1; - s = backup; - } - /* munge the '$' */ - else - s++; - } - - /* Get any format flags */ - while(ISFLAG(*s)) { - switch(*s++) { - - /* skip argument */ - case FLAG_ASTERISK: - info->fSkipArg = TRUE; - break; - - /* pad character specified */ - case FLAG_PAREN: - - /* first four characters are hex values for pad char */ - info->fPadChar = (UChar)ufmt_digitvalue(*s++); - info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*s++)); - info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*s++)); - info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*s++)); - - /* final character is ignored */ - s++; - - break; - } - } - - /* Get the width */ - if(ISDIGIT(*s)){ - info->fWidth = (int) (*s++ - DIGIT_ZERO); - - while(ISDIGIT(*s)) { - info->fWidth *= 10; - info->fWidth += (int) (*s++ - DIGIT_ZERO); - } - } - - /* Get any modifiers */ - if(ISMOD(*s)) { - switch(*s++) { - - /* short */ - case MOD_H: - info->fIsShort = TRUE; - break; - - /* long or long long */ - case MOD_LOWERL: - if(*s == MOD_LOWERL) { - info->fIsLongLong = TRUE; - /* skip over the next 'l' */ - s++; - } - else - info->fIsLong = TRUE; - break; - - /* long double */ - case MOD_L: - info->fIsLongDouble = TRUE; - break; - } - } - - /* finally, get the specifier letter */ - info->fSpec = *s++; - - /* return # of characters in this specifier */ - return (int32_t)(s - fmt); -} - -#define UP_PERCENT 0x0025 - - -/* ANSI style formatting */ -/* Use US-ASCII characters only for formatting */ - -/* % */ -#define UFMT_SIMPLE_PERCENT {ufmt_simple_percent, u_scanf_simple_percent_handler} -/* s */ -#define UFMT_STRING {ufmt_string, u_scanf_string_handler} -/* c */ -#define UFMT_CHAR {ufmt_string, u_scanf_char_handler} -/* d, i */ -#define UFMT_INT {ufmt_int, u_scanf_integer_handler} -/* u */ -#define UFMT_UINT {ufmt_int, u_scanf_uinteger_handler} -/* o */ -#define UFMT_OCTAL {ufmt_int, u_scanf_octal_handler} -/* x, X */ -#define UFMT_HEX {ufmt_int, u_scanf_hex_handler} -/* f */ -#define UFMT_DOUBLE {ufmt_double, u_scanf_double_handler} -/* e, E */ -#define UFMT_SCIENTIFIC {ufmt_double, u_scanf_scientific_handler} -/* g, G */ -#define UFMT_SCIDBL {ufmt_double, u_scanf_scidbl_handler} -/* n */ -#define UFMT_COUNT {ufmt_count, u_scanf_count_handler} -/* [ */ -#define UFMT_SCANSET {ufmt_string, u_scanf_scanset_handler} - -/* non-ANSI extensions */ -/* Use US-ASCII characters only for formatting */ - -/* p */ -#define UFMT_POINTER {ufmt_pointer, u_scanf_pointer_handler} -/* V */ -#define UFMT_SPELLOUT {ufmt_double, u_scanf_spellout_handler} -/* P */ -#define UFMT_PERCENT {ufmt_double, u_scanf_percent_handler} -/* C K is old format */ -#define UFMT_UCHAR {ufmt_uchar, u_scanf_uchar_handler} -/* S U is old format */ -#define UFMT_USTRING {ufmt_ustring, u_scanf_ustring_handler} - - -#define UFMT_EMPTY {ufmt_empty, NULL} - -/** - * A u_scanf handler function. - * A u_scanf handler is responsible for handling a single u_scanf - * format specification, for example 'd' or 's'. - * @param stream The UFILE to which to write output. - * @param info A pointer to a u_scanf_spec_info struct containing - * information on the format specification. - * @param args A pointer to the argument data - * @param fmt A pointer to the first character in the format string - * following the spec. - * @param fmtConsumed On output, set to the number of characters consumed - * in fmt. Do nothing, if the argument isn't variable width. - * @param argConverted The number of arguments converted and assigned, or -1 if an - * error occurred. - * @return The number of code points consumed during reading. - */ -typedef int32_t (*u_scanf_handler) (UFILE *stream, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted); - -typedef struct u_scanf_info { - ufmt_type_info info; - u_scanf_handler handler; -} u_scanf_info; - -#define USCANF_NUM_FMT_HANDLERS 108 -#define USCANF_SYMBOL_BUFFER_SIZE 8 - -/* We do not use handlers for 0-0x1f */ -#define USCANF_BASE_FMT_HANDLERS 0x20 - - -static int32_t -u_scanf_skip_leading_ws(UFILE *input, - UChar pad) -{ - UChar c; - int32_t count = 0; - UBool isNotEOF; - - /* skip all leading ws in the input */ - while( (isNotEOF = ufile_getch(input, &c)) && (c == pad || u_isWhitespace(c)) ) - { - count++; - } - - /* put the final character back on the input */ - if(isNotEOF) - u_fungetc(c, input); - - return count; -} - -/* TODO: Is always skipping the prefix symbol as a positive sign a good idea in all locales? */ -static int32_t -u_scanf_skip_leading_positive_sign(UFILE *input, - UNumberFormat *format, - UErrorCode *status) -{ - UChar c; - int32_t count = 0; - UBool isNotEOF; - UChar plusSymbol[USCANF_SYMBOL_BUFFER_SIZE]; - int32_t symbolLen; - UErrorCode localStatus = U_ZERO_ERROR; - - if (U_SUCCESS(*status)) { - symbolLen = unum_getSymbol(format, - UNUM_PLUS_SIGN_SYMBOL, - plusSymbol, - UPRV_LENGTHOF(plusSymbol), - &localStatus); - - if (U_SUCCESS(localStatus)) { - /* skip all leading ws in the input */ - while( (isNotEOF = ufile_getch(input, &c)) && (count < symbolLen && c == plusSymbol[count]) ) - { - count++; - } - - /* put the final character back on the input */ - if(isNotEOF) { - u_fungetc(c, input); - } - } - } - - return count; -} - -static int32_t -u_scanf_simple_percent_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - (void)info; - (void)args; - (void)fmt; - (void)fmtConsumed; - - /* make sure the next character in the input is a percent */ - *argConverted = 0; - if(u_fgetc(input) != 0x0025) { - *argConverted = -1; - } - return 1; -} - -static int32_t -u_scanf_count_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - (void)input; - (void)fmt; - (void)fmtConsumed; - - /* in the special case of count, the u_scanf_spec_info's width */ - /* will contain the # of items converted thus far */ - if (!info->fSkipArg) { - if (info->fIsShort) - *(int16_t*)(args[0].ptrValue) = (int16_t)(UINT16_MAX & info->fWidth); - else if (info->fIsLongLong) - *(int64_t*)(args[0].ptrValue) = info->fWidth; - else - *(int32_t*)(args[0].ptrValue) = (int32_t)(UINT32_MAX & info->fWidth); - } - *argConverted = 0; - - /* we converted 0 args */ - return 0; -} - -static int32_t -u_scanf_double_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - (void)fmt; - (void)fmtConsumed; - - int32_t len; - double num; - UNumberFormat *format; - int32_t parsePos = 0; - int32_t skipped; - UErrorCode status = U_ZERO_ERROR; - - - /* skip all ws in the input */ - skipped = u_scanf_skip_leading_ws(input, info->fPadChar); - - /* fill the input's internal buffer */ - ufile_fill_uchar_buffer(input); - - /* determine the size of the input's buffer */ - len = (int32_t)(input->str.fLimit - input->str.fPos); - - /* truncate to the width, if specified */ - if(info->fWidth != -1) - len = ufmt_min(len, info->fWidth); - - /* get the formatter */ - format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_DECIMAL); - - /* handle error */ - if(format == 0) - return 0; - - /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */ - skipped += u_scanf_skip_leading_positive_sign(input, format, &status); - - /* parse the number */ - num = unum_parseDouble(format, input->str.fPos, len, &parsePos, &status); - - if (!info->fSkipArg) { - if (info->fIsLong) - *(double*)(args[0].ptrValue) = num; - else if (info->fIsLongDouble) - *(long double*)(args[0].ptrValue) = num; - else - *(float*)(args[0].ptrValue) = (float)num; - } - - /* mask off any necessary bits */ - /* if(! info->fIsLong_double) - num &= DBL_MAX;*/ - - /* update the input's position to reflect consumed data */ - input->str.fPos += parsePos; - - /* we converted 1 arg */ - *argConverted = !info->fSkipArg; - return parsePos + skipped; -} - -#define UPRINTF_SYMBOL_BUFFER_SIZE 8 - -static int32_t -u_scanf_scientific_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - (void)fmt; - (void)fmtConsumed; - - int32_t len; - double num; - UNumberFormat *format; - int32_t parsePos = 0; - int32_t skipped; - UErrorCode status = U_ZERO_ERROR; - UChar srcExpBuf[UPRINTF_SYMBOL_BUFFER_SIZE]; - int32_t srcLen, expLen; - UChar expBuf[UPRINTF_SYMBOL_BUFFER_SIZE]; - - - /* skip all ws in the input */ - skipped = u_scanf_skip_leading_ws(input, info->fPadChar); - - /* fill the input's internal buffer */ - ufile_fill_uchar_buffer(input); - - /* determine the size of the input's buffer */ - len = (int32_t)(input->str.fLimit - input->str.fPos); - - /* truncate to the width, if specified */ - if(info->fWidth != -1) - len = ufmt_min(len, info->fWidth); - - /* get the formatter */ - format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_SCIENTIFIC); - - /* handle error */ - if(format == 0) - return 0; - - /* set the appropriate flags on the formatter */ - - srcLen = unum_getSymbol(format, - UNUM_EXPONENTIAL_SYMBOL, - srcExpBuf, - sizeof(srcExpBuf), - &status); - - /* Upper/lower case the e */ - if (info->fSpec == (UChar)0x65 /* e */) { - expLen = u_strToLower(expBuf, (int32_t)sizeof(expBuf), - srcExpBuf, srcLen, - input->str.fBundle.fLocale, - &status); - } - else { - expLen = u_strToUpper(expBuf, (int32_t)sizeof(expBuf), - srcExpBuf, srcLen, - input->str.fBundle.fLocale, - &status); - } - - unum_setSymbol(format, - UNUM_EXPONENTIAL_SYMBOL, - expBuf, - expLen, - &status); - - - - - /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */ - skipped += u_scanf_skip_leading_positive_sign(input, format, &status); - - /* parse the number */ - num = unum_parseDouble(format, input->str.fPos, len, &parsePos, &status); - - if (!info->fSkipArg) { - if (info->fIsLong) - *(double*)(args[0].ptrValue) = num; - else if (info->fIsLongDouble) - *(long double*)(args[0].ptrValue) = num; - else - *(float*)(args[0].ptrValue) = (float)num; - } - - /* mask off any necessary bits */ - /* if(! info->fIsLong_double) - num &= DBL_MAX;*/ - - /* update the input's position to reflect consumed data */ - input->str.fPos += parsePos; - - /* we converted 1 arg */ - *argConverted = !info->fSkipArg; - return parsePos + skipped; -} - -static int32_t -u_scanf_scidbl_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - (void)fmt; - (void)fmtConsumed; - - int32_t len; - double num; - UNumberFormat *scientificFormat, *genericFormat; - /*int32_t scientificResult, genericResult;*/ - double scientificResult, genericResult; - int32_t scientificParsePos = 0, genericParsePos = 0, parsePos = 0; - int32_t skipped; - UErrorCode scientificStatus = U_ZERO_ERROR; - UErrorCode genericStatus = U_ZERO_ERROR; - - - /* since we can't determine by scanning the characters whether */ - /* a number was formatted in the 'f' or 'g' styles, parse the */ - /* string with both formatters, and assume whichever one */ - /* parsed the most is the correct formatter to use */ - - - /* skip all ws in the input */ - skipped = u_scanf_skip_leading_ws(input, info->fPadChar); - - /* fill the input's internal buffer */ - ufile_fill_uchar_buffer(input); - - /* determine the size of the input's buffer */ - len = (int32_t)(input->str.fLimit - input->str.fPos); - - /* truncate to the width, if specified */ - if(info->fWidth != -1) - len = ufmt_min(len, info->fWidth); - - /* get the formatters */ - scientificFormat = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_SCIENTIFIC); - genericFormat = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_DECIMAL); - - /* handle error */ - if(scientificFormat == 0 || genericFormat == 0) - return 0; - - /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */ - skipped += u_scanf_skip_leading_positive_sign(input, genericFormat, &genericStatus); - - /* parse the number using each format*/ - - scientificResult = unum_parseDouble(scientificFormat, input->str.fPos, len, - &scientificParsePos, &scientificStatus); - - genericResult = unum_parseDouble(genericFormat, input->str.fPos, len, - &genericParsePos, &genericStatus); - - /* determine which parse made it farther */ - if(scientificParsePos > genericParsePos) { - /* stash the result in num */ - num = scientificResult; - /* update the input's position to reflect consumed data */ - parsePos += scientificParsePos; - } - else { - /* stash the result in num */ - num = genericResult; - /* update the input's position to reflect consumed data */ - parsePos += genericParsePos; - } - input->str.fPos += parsePos; - - if (!info->fSkipArg) { - if (info->fIsLong) - *(double*)(args[0].ptrValue) = num; - else if (info->fIsLongDouble) - *(long double*)(args[0].ptrValue) = num; - else - *(float*)(args[0].ptrValue) = (float)num; - } - - /* mask off any necessary bits */ - /* if(! info->fIsLong_double) - num &= DBL_MAX;*/ - - /* we converted 1 arg */ - *argConverted = !info->fSkipArg; - return parsePos + skipped; -} - -static int32_t -u_scanf_integer_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - (void)fmt; - (void)fmtConsumed; - - int32_t len; - void *num = (void*) (args[0].ptrValue); - UNumberFormat *format; - int32_t parsePos = 0; - int32_t skipped; - UErrorCode status = U_ZERO_ERROR; - int64_t result; - - - /* skip all ws in the input */ - skipped = u_scanf_skip_leading_ws(input, info->fPadChar); - - /* fill the input's internal buffer */ - ufile_fill_uchar_buffer(input); - - /* determine the size of the input's buffer */ - len = (int32_t)(input->str.fLimit - input->str.fPos); - - /* truncate to the width, if specified */ - if(info->fWidth != -1) - len = ufmt_min(len, info->fWidth); - - /* get the formatter */ - format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_DECIMAL); - - /* handle error */ - if(format == 0) - return 0; - - /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */ - skipped += u_scanf_skip_leading_positive_sign(input, format, &status); - - /* parse the number */ - result = unum_parseInt64(format, input->str.fPos, len, &parsePos, &status); - - /* mask off any necessary bits */ - if (!info->fSkipArg) { - if (info->fIsShort) - *(int16_t*)num = (int16_t)(UINT16_MAX & result); - else if (info->fIsLongLong) - *(int64_t*)num = result; - else - *(int32_t*)num = (int32_t)(UINT32_MAX & result); - } - - /* update the input's position to reflect consumed data */ - input->str.fPos += parsePos; - - /* we converted 1 arg */ - *argConverted = !info->fSkipArg; - return parsePos + skipped; -} - -static int32_t -u_scanf_uinteger_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - /* TODO Fix this when Numberformat handles uint64_t */ - return u_scanf_integer_handler(input, info, args, fmt, fmtConsumed, argConverted); -} - -static int32_t -u_scanf_percent_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - (void)fmt; - (void)fmtConsumed; - - int32_t len; - double num; - UNumberFormat *format; - int32_t parsePos = 0; - UErrorCode status = U_ZERO_ERROR; - - - /* skip all ws in the input */ - u_scanf_skip_leading_ws(input, info->fPadChar); - - /* fill the input's internal buffer */ - ufile_fill_uchar_buffer(input); - - /* determine the size of the input's buffer */ - len = (int32_t)(input->str.fLimit - input->str.fPos); - - /* truncate to the width, if specified */ - if(info->fWidth != -1) - len = ufmt_min(len, info->fWidth); - - /* get the formatter */ - format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_PERCENT); - - /* handle error */ - if(format == 0) - return 0; - - /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */ - u_scanf_skip_leading_positive_sign(input, format, &status); - - /* parse the number */ - num = unum_parseDouble(format, input->str.fPos, len, &parsePos, &status); - - if (!info->fSkipArg) { - *(double*)(args[0].ptrValue) = num; - } - - /* mask off any necessary bits */ - /* if(! info->fIsLong_double) - num &= DBL_MAX;*/ - - /* update the input's position to reflect consumed data */ - input->str.fPos += parsePos; - - /* we converted 1 arg */ - *argConverted = !info->fSkipArg; - return parsePos; -} - -static int32_t -u_scanf_string_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - (void)fmt; - (void)fmtConsumed; - - const UChar *source; - UConverter *conv; - char *arg = (char*)(args[0].ptrValue); - char *alias = arg; - char *limit; - UErrorCode status = U_ZERO_ERROR; - int32_t count; - int32_t skipped = 0; - UChar c; - UBool isNotEOF = FALSE; - - /* skip all ws in the input */ - if (info->fIsString) { - skipped = u_scanf_skip_leading_ws(input, info->fPadChar); - } - - /* get the string one character at a time, truncating to the width */ - count = 0; - - /* open the default converter */ - conv = u_getDefaultConverter(&status); - - if(U_FAILURE(status)) - return -1; - - while( (info->fWidth == -1 || count < info->fWidth) - && (isNotEOF = ufile_getch(input, &c)) - && (!info->fIsString || (c != info->fPadChar && !u_isWhitespace(c)))) - { - - if (!info->fSkipArg) { - /* put the character from the input onto the target */ - source = &c; - /* Since we do this one character at a time, do it this way. */ - if (info->fWidth > 0) { - limit = alias + info->fWidth - count; - } - else { - limit = alias + ucnv_getMaxCharSize(conv); - } - - /* convert the character to the default codepage */ - ucnv_fromUnicode(conv, &alias, limit, &source, source + 1, - NULL, TRUE, &status); - - if(U_FAILURE(status)) { - /* clean up */ - u_releaseDefaultConverter(conv); - return -1; - } - } - - /* increment the count */ - ++count; - } - - /* put the final character we read back on the input */ - if (!info->fSkipArg) { - if ((info->fWidth == -1 || count < info->fWidth) && isNotEOF) - u_fungetc(c, input); - - /* add the terminator */ - if (info->fIsString) { - *alias = 0x00; - } - } - - /* clean up */ - u_releaseDefaultConverter(conv); - - /* we converted 1 arg */ - *argConverted = !info->fSkipArg; - return count + skipped; -} - -static int32_t -u_scanf_char_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - if (info->fWidth < 0) { - info->fWidth = 1; - } - info->fIsString = FALSE; - return u_scanf_string_handler(input, info, args, fmt, fmtConsumed, argConverted); -} - -static int32_t -u_scanf_ustring_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - (void)fmt; - (void)fmtConsumed; - - UChar *arg = (UChar*)(args[0].ptrValue); - UChar *alias = arg; - int32_t count; - int32_t skipped = 0; - UChar c; - UBool isNotEOF = FALSE; - - /* skip all ws in the input */ - if (info->fIsString) { - skipped = u_scanf_skip_leading_ws(input, info->fPadChar); - } - - /* get the string one character at a time, truncating to the width */ - count = 0; - - while( (info->fWidth == -1 || count < info->fWidth) - && (isNotEOF = ufile_getch(input, &c)) - && (!info->fIsString || (c != info->fPadChar && !u_isWhitespace(c)))) - { - - /* put the character from the input onto the target */ - if (!info->fSkipArg) { - *alias++ = c; - } - - /* increment the count */ - ++count; - } - - /* put the final character we read back on the input */ - if (!info->fSkipArg) { - if((info->fWidth == -1 || count < info->fWidth) && isNotEOF) { - u_fungetc(c, input); - } - - /* add the terminator */ - if (info->fIsString) { - *alias = 0x0000; - } - } - - /* we converted 1 arg */ - *argConverted = !info->fSkipArg; - return count + skipped; -} - -static int32_t -u_scanf_uchar_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - if (info->fWidth < 0) { - info->fWidth = 1; - } - info->fIsString = FALSE; - return u_scanf_ustring_handler(input, info, args, fmt, fmtConsumed, argConverted); -} - -static int32_t -u_scanf_spellout_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - (void)fmt; - (void)fmtConsumed; - - int32_t len; - double num; - UNumberFormat *format; - int32_t parsePos = 0; - int32_t skipped; - UErrorCode status = U_ZERO_ERROR; - - - /* skip all ws in the input */ - skipped = u_scanf_skip_leading_ws(input, info->fPadChar); - - /* fill the input's internal buffer */ - ufile_fill_uchar_buffer(input); - - /* determine the size of the input's buffer */ - len = (int32_t)(input->str.fLimit - input->str.fPos); - - /* truncate to the width, if specified */ - if(info->fWidth != -1) - len = ufmt_min(len, info->fWidth); - - /* get the formatter */ - format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_SPELLOUT); - - /* handle error */ - if(format == 0) - return 0; - - /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */ - /* This is not applicable to RBNF. */ - /*skipped += u_scanf_skip_leading_positive_sign(input, format, &status);*/ - - /* parse the number */ - num = unum_parseDouble(format, input->str.fPos, len, &parsePos, &status); - - if (!info->fSkipArg) { - *(double*)(args[0].ptrValue) = num; - } - - /* mask off any necessary bits */ - /* if(! info->fIsLong_double) - num &= DBL_MAX;*/ - - /* update the input's position to reflect consumed data */ - input->str.fPos += parsePos; - - /* we converted 1 arg */ - *argConverted = !info->fSkipArg; - return parsePos + skipped; -} - -static int32_t -u_scanf_hex_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - (void)fmt; - (void)fmtConsumed; - - int32_t len; - int32_t skipped; - void *num = (void*) (args[0].ptrValue); - int64_t result; - - /* skip all ws in the input */ - skipped = u_scanf_skip_leading_ws(input, info->fPadChar); - - /* fill the input's internal buffer */ - ufile_fill_uchar_buffer(input); - - /* determine the size of the input's buffer */ - len = (int32_t)(input->str.fLimit - input->str.fPos); - - /* truncate to the width, if specified */ - if(info->fWidth != -1) - len = ufmt_min(len, info->fWidth); - - /* check for alternate form */ - if( *(input->str.fPos) == 0x0030 && - (*(input->str.fPos + 1) == 0x0078 || *(input->str.fPos + 1) == 0x0058) ) { - - /* skip the '0' and 'x' or 'X' if present */ - input->str.fPos += 2; - len -= 2; - } - - /* parse the number */ - result = ufmt_uto64(input->str.fPos, &len, 16); - - /* update the input's position to reflect consumed data */ - input->str.fPos += len; - - /* mask off any necessary bits */ - if (!info->fSkipArg) { - if (info->fIsShort) - *(int16_t*)num = (int16_t)(UINT16_MAX & result); - else if (info->fIsLongLong) - *(int64_t*)num = result; - else - *(int32_t*)num = (int32_t)(UINT32_MAX & result); - } - - /* we converted 1 arg */ - *argConverted = !info->fSkipArg; - return len + skipped; -} - -static int32_t -u_scanf_octal_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - (void)fmt; - (void)fmtConsumed; - - int32_t len; - int32_t skipped; - void *num = (void*) (args[0].ptrValue); - int64_t result; - - /* skip all ws in the input */ - skipped = u_scanf_skip_leading_ws(input, info->fPadChar); - - /* fill the input's internal buffer */ - ufile_fill_uchar_buffer(input); - - /* determine the size of the input's buffer */ - len = (int32_t)(input->str.fLimit - input->str.fPos); - - /* truncate to the width, if specified */ - if(info->fWidth != -1) - len = ufmt_min(len, info->fWidth); - - /* parse the number */ - result = ufmt_uto64(input->str.fPos, &len, 8); - - /* update the input's position to reflect consumed data */ - input->str.fPos += len; - - /* mask off any necessary bits */ - if (!info->fSkipArg) { - if (info->fIsShort) - *(int16_t*)num = (int16_t)(UINT16_MAX & result); - else if (info->fIsLongLong) - *(int64_t*)num = result; - else - *(int32_t*)num = (int32_t)(UINT32_MAX & result); - } - - /* we converted 1 arg */ - *argConverted = !info->fSkipArg; - return len + skipped; -} - -static int32_t -u_scanf_pointer_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - (void)fmt; - (void)fmtConsumed; - - int32_t len; - int32_t skipped; - void *result; - void **p = (void**)(args[0].ptrValue); - - - /* skip all ws in the input */ - skipped = u_scanf_skip_leading_ws(input, info->fPadChar); - - /* fill the input's internal buffer */ - ufile_fill_uchar_buffer(input); - - /* determine the size of the input's buffer */ - len = (int32_t)(input->str.fLimit - input->str.fPos); - - /* truncate to the width, if specified */ - if(info->fWidth != -1) { - len = ufmt_min(len, info->fWidth); - } - - /* Make sure that we don't consume too much */ - if (len > (int32_t)(sizeof(void*)*2)) { - len = (int32_t)(sizeof(void*)*2); - } - - /* parse the pointer - assign to temporary value */ - result = ufmt_utop(input->str.fPos, &len); - - if (!info->fSkipArg) { - *p = result; - } - - /* update the input's position to reflect consumed data */ - input->str.fPos += len; - - /* we converted 1 arg */ - *argConverted = !info->fSkipArg; - return len + skipped; -} - -static int32_t -u_scanf_scanset_handler(UFILE *input, - u_scanf_spec_info *info, - ufmt_args *args, - const UChar *fmt, - int32_t *fmtConsumed, - int32_t *argConverted) -{ - USet *scanset; - UErrorCode status = U_ZERO_ERROR; - int32_t chLeft = INT32_MAX; - UChar32 c; - UChar *alias = (UChar*) (args[0].ptrValue); - UBool isNotEOF = FALSE; - UBool readCharacter = FALSE; - - /* Create an empty set */ - scanset = uset_open(0, -1); - - /* Back up one to get the [ */ - fmt--; - - /* truncate to the width, if specified and alias the target */ - if(info->fWidth >= 0) { - chLeft = info->fWidth; - } - - /* parse the scanset from the fmt string */ - *fmtConsumed = uset_applyPattern(scanset, fmt, -1, 0, &status); - - /* verify that the parse was successful */ - if (U_SUCCESS(status)) { - c=0; - - /* grab characters one at a time and make sure they are in the scanset */ - while(chLeft > 0) { - if ((isNotEOF = ufile_getch32(input, &c)) && uset_contains(scanset, c)) { - readCharacter = TRUE; - if (!info->fSkipArg) { - int32_t idx = 0; - UBool isError = FALSE; - - U16_APPEND(alias, idx, chLeft, c, isError); - if (isError) { - break; - } - alias += idx; - } - chLeft -= (1 + U_IS_SUPPLEMENTARY(c)); - } - else { - /* if the character's not in the scanset, break out */ - break; - } - } - - /* put the final character we read back on the input */ - if(isNotEOF && chLeft > 0) { - u_fungetc(c, input); - } - } - - uset_close(scanset); - - /* if we didn't match at least 1 character, fail */ - if(!readCharacter) - return -1; - /* otherwise, add the terminator */ - else if (!info->fSkipArg) { - *alias = 0x00; - } - - /* we converted 1 arg */ - *argConverted = !info->fSkipArg; - return (info->fWidth >= 0 ? info->fWidth : INT32_MAX) - chLeft; -} - -/* Use US-ASCII characters only for formatting. Most codepages have - characters 20-7F from Unicode. Using any other codepage specific - characters will make it very difficult to format the string on - non-Unicode machines */ -static const u_scanf_info g_u_scanf_infos[USCANF_NUM_FMT_HANDLERS] = { -/* 0x20 */ - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_SIMPLE_PERCENT,UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - -/* 0x30 */ - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - -/* 0x40 */ - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_UCHAR, - UFMT_EMPTY, UFMT_SCIENTIFIC, UFMT_EMPTY, UFMT_SCIDBL, -#ifdef U_USE_OBSOLETE_IO_FORMATTING - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_UCHAR/*deprecated*/, -#else - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, -#endif - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - -/* 0x50 */ - UFMT_PERCENT, UFMT_EMPTY, UFMT_EMPTY, UFMT_USTRING, -#ifdef U_USE_OBSOLETE_IO_FORMATTING - UFMT_EMPTY, UFMT_USTRING/*deprecated*/,UFMT_SPELLOUT, UFMT_EMPTY, -#else - UFMT_EMPTY, UFMT_EMPTY, UFMT_SPELLOUT, UFMT_EMPTY, -#endif - UFMT_HEX, UFMT_EMPTY, UFMT_EMPTY, UFMT_SCANSET, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - -/* 0x60 */ - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_CHAR, - UFMT_INT, UFMT_SCIENTIFIC, UFMT_DOUBLE, UFMT_SCIDBL, - UFMT_EMPTY, UFMT_INT, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_COUNT, UFMT_OCTAL, - -/* 0x70 */ - UFMT_POINTER, UFMT_EMPTY, UFMT_EMPTY, UFMT_STRING, - UFMT_EMPTY, UFMT_UINT, UFMT_EMPTY, UFMT_EMPTY, - UFMT_HEX, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, - UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, -}; - -U_CFUNC int32_t -u_scanf_parse(UFILE *f, - const UChar *patternSpecification, - va_list ap) -{ - const UChar *alias; - int32_t count, converted, argConsumed, cpConsumed; - uint16_t handlerNum; - - ufmt_args args; - u_scanf_spec spec; - ufmt_type_info info; - u_scanf_handler handler; - - /* alias the pattern */ - alias = patternSpecification; - - /* haven't converted anything yet */ - argConsumed = 0; - converted = 0; - cpConsumed = 0; - - /* iterate through the pattern */ - for(;;) { - - /* match any characters up to the next '%' */ - while(*alias != UP_PERCENT && *alias != 0x0000 && u_fgetc(f) == *alias) { - alias++; - } - - /* if we aren't at a '%', or if we're at end of string, break*/ - if(*alias != UP_PERCENT || *alias == 0x0000) - break; - - /* parse the specifier */ - count = u_scanf_parse_spec(alias, &spec); - - /* update the pointer in pattern */ - alias += count; - - handlerNum = (uint16_t)(spec.fInfo.fSpec - USCANF_BASE_FMT_HANDLERS); - if (handlerNum < USCANF_NUM_FMT_HANDLERS) { - /* skip the argument, if necessary */ - /* query the info function for argument information */ - info = g_u_scanf_infos[ handlerNum ].info; - if (info != ufmt_count && u_feof(f)) { - break; - } - else if(spec.fInfo.fSkipArg) { - args.ptrValue = NULL; - } - else { - switch(info) { - case ufmt_count: - /* set the spec's width to the # of items converted */ - spec.fInfo.fWidth = cpConsumed; - U_FALLTHROUGH; - case ufmt_char: - case ufmt_uchar: - case ufmt_int: - case ufmt_string: - case ufmt_ustring: - case ufmt_pointer: - case ufmt_float: - case ufmt_double: - args.ptrValue = va_arg(ap, void*); - break; - - default: - /* else args is ignored */ - args.ptrValue = NULL; - break; - } - } - - /* call the handler function */ - handler = g_u_scanf_infos[ handlerNum ].handler; - if(handler != 0) { - - /* reset count to 1 so that += for alias works. */ - count = 1; - - cpConsumed += (*handler)(f, &spec.fInfo, &args, alias, &count, &argConsumed); - - /* if the handler encountered an error condition, break */ - if(argConsumed < 0) { - converted = -1; - break; - } - - /* add to the # of items converted */ - converted += argConsumed; - - /* update the pointer in pattern */ - alias += count-1; - } - /* else do nothing */ - } - /* else do nothing */ - - /* just ignore unknown tags */ - } - - /* return # of items converted */ - return converted; -} - -#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/io/ustdio.cpp b/deps/icu-small/source/io/ustdio.cpp deleted file mode 100644 index 790a097980b1af..00000000000000 --- a/deps/icu-small/source/io/ustdio.cpp +++ /dev/null @@ -1,732 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* - ****************************************************************************** - * - * Copyright (C) 1998-2016, International Business Machines - * Corporation and others. All Rights Reserved. - * - ****************************************************************************** - * - * File ustdio.c - * - * Modification History: - * - * Date Name Description - * 11/18/98 stephen Creation. - * 03/12/99 stephen Modified for new C API. - * 07/19/99 stephen Fixed read() and gets() - ****************************************************************************** - */ - -#include "unicode/ustdio.h" - -#if !UCONFIG_NO_CONVERSION - -#include "unicode/putil.h" -#include "cmemory.h" -#include "cstring.h" -#include "ufile.h" -#include "ufmt_cmn.h" -#include "unicode/ucnv.h" -#include "unicode/ustring.h" - -#include - -#define DELIM_LF 0x000A -#define DELIM_VT 0x000B -#define DELIM_FF 0x000C -#define DELIM_CR 0x000D -#define DELIM_NEL 0x0085 -#define DELIM_LS 0x2028 -#define DELIM_PS 0x2029 - -/* TODO: is this correct for all codepages? Should we just use \n and let the converter handle it? */ -#if U_PLATFORM_USES_ONLY_WIN32_API -static const UChar DELIMITERS [] = { DELIM_CR, DELIM_LF, 0x0000 }; -static const uint32_t DELIMITERS_LEN = 2; -/* TODO: Default newline writing should be detected based upon the converter being used. */ -#else -static const UChar DELIMITERS [] = { DELIM_LF, 0x0000 }; -static const uint32_t DELIMITERS_LEN = 1; -#endif - -#define IS_FIRST_STRING_DELIMITER(c1) \ - (UBool)((DELIM_LF <= (c1) && (c1) <= DELIM_CR) \ - || (c1) == DELIM_NEL \ - || (c1) == DELIM_LS \ - || (c1) == DELIM_PS) -#define CAN_HAVE_COMBINED_STRING_DELIMITER(c1) (UBool)((c1) == DELIM_CR) -#define IS_COMBINED_STRING_DELIMITER(c1, c2) \ - (UBool)((c1) == DELIM_CR && (c2) == DELIM_LF) - - -#if !UCONFIG_NO_TRANSLITERATION - -U_CAPI UTransliterator* U_EXPORT2 -u_fsettransliterator(UFILE *file, UFileDirection direction, - UTransliterator *adopt, UErrorCode *status) -{ - UTransliterator *old = NULL; - - if(U_FAILURE(*status)) - { - return adopt; - } - - if(!file) - { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return adopt; - } - - if(direction & U_READ) - { - /** TODO: implement */ - *status = U_UNSUPPORTED_ERROR; - return adopt; - } - - if(adopt == NULL) /* they are clearing it */ - { - if(file->fTranslit != NULL) - { - /* TODO: Check side */ - old = file->fTranslit->translit; - uprv_free(file->fTranslit->buffer); - file->fTranslit->buffer=NULL; - uprv_free(file->fTranslit); - file->fTranslit=NULL; - } - } - else - { - if(file->fTranslit == NULL) - { - file->fTranslit = (UFILETranslitBuffer*) uprv_malloc(sizeof(UFILETranslitBuffer)); - if(!file->fTranslit) - { - *status = U_MEMORY_ALLOCATION_ERROR; - return adopt; - } - file->fTranslit->capacity = 0; - file->fTranslit->length = 0; - file->fTranslit->pos = 0; - file->fTranslit->buffer = NULL; - } - else - { - old = file->fTranslit->translit; - ufile_flush_translit(file); - } - - file->fTranslit->translit = adopt; - } - - return old; -} - -static const UChar * u_file_translit(UFILE *f, const UChar *src, int32_t *count, UBool flush) -{ - int32_t newlen; - int32_t junkCount = 0; - int32_t textLength; - int32_t textLimit; - UTransPosition pos; - UErrorCode status = U_ZERO_ERROR; - - if(count == NULL) - { - count = &junkCount; - } - - if ((!f)||(!f->fTranslit)||(!f->fTranslit->translit)) - { - /* fast path */ - return src; - } - - /* First: slide over everything */ - if(f->fTranslit->length > f->fTranslit->pos) - { - memmove(f->fTranslit->buffer, f->fTranslit->buffer + f->fTranslit->pos, - (f->fTranslit->length - f->fTranslit->pos)*sizeof(UChar)); - } - f->fTranslit->length -= f->fTranslit->pos; /* always */ - f->fTranslit->pos = 0; - - /* Calculate new buffer size needed */ - newlen = (*count + f->fTranslit->length) * 4; - - if(newlen > f->fTranslit->capacity) - { - if(f->fTranslit->buffer == NULL) - { - f->fTranslit->buffer = (UChar*)uprv_malloc(newlen * sizeof(UChar)); - } - else - { - f->fTranslit->buffer = (UChar*)uprv_realloc(f->fTranslit->buffer, newlen * sizeof(UChar)); - } - /* Check for malloc/realloc failure. */ - if (f->fTranslit->buffer == NULL) { - return NULL; - } - f->fTranslit->capacity = newlen; - } - - /* Now, copy any data over */ - u_strncpy(f->fTranslit->buffer + f->fTranslit->length, - src, - *count); - f->fTranslit->length += *count; - - /* Now, translit in place as much as we can */ - if(flush == FALSE) - { - textLength = f->fTranslit->length; - pos.contextStart = 0; - pos.contextLimit = textLength; - pos.start = 0; - pos.limit = textLength; - - utrans_transIncrementalUChars(f->fTranslit->translit, - f->fTranslit->buffer, /* because we shifted */ - &textLength, - f->fTranslit->capacity, - &pos, - &status); - - /* now: start/limit point to the transliterated text */ - /* Transliterated is [buffer..pos.start) */ - *count = pos.start; - f->fTranslit->pos = pos.start; - f->fTranslit->length = pos.limit; - - return f->fTranslit->buffer; - } - else - { - textLength = f->fTranslit->length; - textLimit = f->fTranslit->length; - - utrans_transUChars(f->fTranslit->translit, - f->fTranslit->buffer, - &textLength, - f->fTranslit->capacity, - 0, - &textLimit, - &status); - - /* out: converted len */ - *count = textLimit; - - /* Set pointers to 0 */ - f->fTranslit->pos = 0; - f->fTranslit->length = 0; - - return f->fTranslit->buffer; - } -} - -#endif - -void -ufile_flush_translit(UFILE *f) -{ -#if !UCONFIG_NO_TRANSLITERATION - if((!f)||(!f->fTranslit)) - return; -#endif - - u_file_write_flush(NULL, 0, f, FALSE, TRUE); -} - - -void -ufile_flush_io(UFILE *f) -{ - if((!f) || (!f->fFile)) { - return; /* skip if no file */ - } - - u_file_write_flush(NULL, 0, f, TRUE, FALSE); -} - - -void -ufile_close_translit(UFILE *f) -{ -#if !UCONFIG_NO_TRANSLITERATION - if((!f)||(!f->fTranslit)) - return; -#endif - - ufile_flush_translit(f); - -#if !UCONFIG_NO_TRANSLITERATION - if(f->fTranslit->translit) - utrans_close(f->fTranslit->translit); - - if(f->fTranslit->buffer) - { - uprv_free(f->fTranslit->buffer); - } - - uprv_free(f->fTranslit); - f->fTranslit = NULL; -#endif -} - - -/* Input/output */ - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fputs(const UChar *s, - UFILE *f) -{ - int32_t count = u_file_write(s, u_strlen(s), f); - count += u_file_write(DELIMITERS, DELIMITERS_LEN, f); - return count; -} - -U_CAPI UChar32 U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fputc(UChar32 uc, - UFILE *f) -{ - UChar buf[2]; - int32_t idx = 0; - UBool isError = FALSE; - - U16_APPEND(buf, idx, UPRV_LENGTHOF(buf), uc, isError); - if (isError) { - return U_EOF; - } - return u_file_write(buf, idx, f) == idx ? uc : U_EOF; -} - - -U_CFUNC int32_t U_EXPORT2 -u_file_write_flush(const UChar *chars, - int32_t count, - UFILE *f, - UBool flushIO, - UBool flushTranslit) -{ - /* Set up conversion parameters */ - UErrorCode status = U_ZERO_ERROR; - const UChar *mySource = chars; - const UChar *mySourceBegin; - const UChar *mySourceEnd; - char charBuffer[UFILE_CHARBUFFER_SIZE]; - char *myTarget = charBuffer; - int32_t written = 0; - int32_t numConverted = 0; - - if (count < 0) { - count = u_strlen(chars); - } - -#if !UCONFIG_NO_TRANSLITERATION - if((f->fTranslit) && (f->fTranslit->translit)) - { - /* Do the transliteration */ - mySource = u_file_translit(f, chars, &count, flushTranslit); - } -#endif - - /* Write to a string. */ - if (!f->fFile) { - int32_t charsLeft = (int32_t)(f->str.fLimit - f->str.fPos); - if (flushIO && charsLeft > count) { - count++; - } - written = ufmt_min(count, charsLeft); - u_strncpy(f->str.fPos, mySource, written); - f->str.fPos += written; - return written; - } - - mySourceEnd = mySource + count; - - /* Perform the conversion in a loop */ - do { - mySourceBegin = mySource; /* beginning location for this loop */ - status = U_ZERO_ERROR; - if(f->fConverter != NULL) { /* We have a valid converter */ - ucnv_fromUnicode(f->fConverter, - &myTarget, - charBuffer + UFILE_CHARBUFFER_SIZE, - &mySource, - mySourceEnd, - NULL, - flushIO, - &status); - } else { /*weiv: do the invariant conversion */ - int32_t convertChars = (int32_t) (mySourceEnd - mySource); - if (convertChars > UFILE_CHARBUFFER_SIZE) { - convertChars = UFILE_CHARBUFFER_SIZE; - status = U_BUFFER_OVERFLOW_ERROR; - } - u_UCharsToChars(mySource, myTarget, convertChars); - mySource += convertChars; - myTarget += convertChars; - } - numConverted = (int32_t)(myTarget - charBuffer); - - if (numConverted > 0) { - /* write the converted bytes */ - fwrite(charBuffer, - sizeof(char), - numConverted, - f->fFile); - - written += (int32_t) (mySource - mySourceBegin); - } - myTarget = charBuffer; - } - while(status == U_BUFFER_OVERFLOW_ERROR); - - /* return # of chars written */ - return written; -} - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_file_write( const UChar *chars, - int32_t count, - UFILE *f) -{ - return u_file_write_flush(chars,count,f,FALSE,FALSE); -} - - -/* private function used for buffering input */ -void -ufile_fill_uchar_buffer(UFILE *f) -{ - UErrorCode status; - const char *mySource; - const char *mySourceEnd; - UChar *myTarget; - int32_t bufferSize; - int32_t maxCPBytes; - int32_t bytesRead; - int32_t availLength; - int32_t dataSize; - char charBuffer[UFILE_CHARBUFFER_SIZE]; - u_localized_string *str; - - if (f->fFile == NULL) { - /* There is nothing to do. It's a string. */ - return; - } - - str = &f->str; - dataSize = (int32_t)(str->fLimit - str->fPos); - if (f->fFileno == 0 && dataSize > 0) { - /* Don't read from stdin too many times. There is still some data. */ - return; - } - - /* shift the buffer if it isn't empty */ - if(dataSize != 0) { - u_memmove(f->fUCBuffer, str->fPos, dataSize); /* not accessing beyond memory */ - } - - - /* record how much buffer space is available */ - availLength = UFILE_UCHARBUFFER_SIZE - dataSize; - - /* Determine the # of codepage bytes needed to fill our UChar buffer */ - /* weiv: if converter is NULL, we use invariant converter with charwidth = 1)*/ - maxCPBytes = availLength / (f->fConverter!=NULL?(2*ucnv_getMinCharSize(f->fConverter)):1); - - /* Read in the data to convert */ - if (f->fFileno == 0) { - /* Special case. Read from stdin one line at a time. */ - char *retStr = fgets(charBuffer, ufmt_min(maxCPBytes, UFILE_CHARBUFFER_SIZE), f->fFile); - bytesRead = (int32_t)(retStr ? uprv_strlen(charBuffer) : 0); - } - else { - /* A normal file */ - bytesRead = (int32_t)fread(charBuffer, - sizeof(char), - ufmt_min(maxCPBytes, UFILE_CHARBUFFER_SIZE), - f->fFile); - } - - /* Set up conversion parameters */ - status = U_ZERO_ERROR; - mySource = charBuffer; - mySourceEnd = charBuffer + bytesRead; - myTarget = f->fUCBuffer + dataSize; - bufferSize = UFILE_UCHARBUFFER_SIZE; - - if(f->fConverter != NULL) { /* We have a valid converter */ - /* Perform the conversion */ - ucnv_toUnicode(f->fConverter, - &myTarget, - f->fUCBuffer + bufferSize, - &mySource, - mySourceEnd, - NULL, - (UBool)(feof(f->fFile) != 0), - &status); - - } else { /*weiv: do the invariant conversion */ - u_charsToUChars(mySource, myTarget, bytesRead); - myTarget += bytesRead; - } - - /* update the pointers into our array */ - str->fPos = str->fBuffer; - str->fLimit = myTarget; -} - -U_CAPI UChar* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fgets(UChar *s, - int32_t n, - UFILE *f) -{ - int32_t dataSize; - int32_t count; - UChar *alias; - const UChar *limit; - UChar *sItr; - UChar currDelim = 0; - u_localized_string *str; - - if (n <= 0) { - /* Caller screwed up. We need to write the null terminatior. */ - return NULL; - } - - /* fill the buffer if needed */ - str = &f->str; - if (str->fPos >= str->fLimit) { - ufile_fill_uchar_buffer(f); - } - - /* subtract 1 from n to compensate for the terminator */ - --n; - - /* determine the amount of data in the buffer */ - dataSize = (int32_t)(str->fLimit - str->fPos); - - /* if 0 characters were left, return 0 */ - if (dataSize == 0) - return NULL; - - /* otherwise, iteratively fill the buffer and copy */ - count = 0; - sItr = s; - currDelim = 0; - while (dataSize > 0 && count < n) { - alias = str->fPos; - - /* Find how much to copy */ - if (dataSize < (n - count)) { - limit = str->fLimit; - } - else { - limit = alias + (n - count); - } - - if (!currDelim) { - /* Copy UChars until we find the first occurrence of a delimiter character */ - while (alias < limit && !IS_FIRST_STRING_DELIMITER(*alias)) { - count++; - *(sItr++) = *(alias++); - } - /* Preserve the newline */ - if (alias < limit && IS_FIRST_STRING_DELIMITER(*alias)) { - if (CAN_HAVE_COMBINED_STRING_DELIMITER(*alias)) { - currDelim = *alias; - } - else { - currDelim = 1; /* This isn't a newline, but it's used to say - that we should break later. We've checked all - possible newline combinations even across buffer - boundaries. */ - } - count++; - *(sItr++) = *(alias++); - } - } - /* If we have a CRLF combination, preserve that too. */ - if (alias < limit) { - if (currDelim && IS_COMBINED_STRING_DELIMITER(currDelim, *alias)) { - count++; - *(sItr++) = *(alias++); - } - currDelim = 1; /* This isn't a newline, but it's used to say - that we should break later. We've checked all - possible newline combinations even across buffer - boundaries. */ - } - - /* update the current buffer position */ - str->fPos = alias; - - /* if we found a delimiter */ - if (currDelim == 1) { - /* break out */ - break; - } - - /* refill the buffer */ - ufile_fill_uchar_buffer(f); - - /* determine the amount of data in the buffer */ - dataSize = (int32_t)(str->fLimit - str->fPos); - } - - /* add the terminator and return s */ - *sItr = 0x0000; - return s; -} - -U_CFUNC UBool U_EXPORT2 -ufile_getch(UFILE *f, UChar *ch) -{ - UBool isValidChar = FALSE; - - *ch = U_EOF; - /* if we have an available character in the buffer, return it */ - if(f->str.fPos < f->str.fLimit){ - *ch = *(f->str.fPos)++; - isValidChar = TRUE; - } - else { - /* otherwise, fill the buffer and return the next character */ - if(f->str.fPos >= f->str.fLimit) { - ufile_fill_uchar_buffer(f); - } - if(f->str.fPos < f->str.fLimit) { - *ch = *(f->str.fPos)++; - isValidChar = TRUE; - } - } - return isValidChar; -} - -U_CAPI UChar U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fgetc(UFILE *f) -{ - UChar ch; - ufile_getch(f, &ch); - return ch; -} - -U_CFUNC UBool U_EXPORT2 -ufile_getch32(UFILE *f, UChar32 *c32) -{ - UBool isValidChar = FALSE; - u_localized_string *str; - - *c32 = U_EOF; - - /* Fill the buffer if it is empty */ - str = &f->str; - if (f && str->fPos + 1 >= str->fLimit) { - ufile_fill_uchar_buffer(f); - } - - /* Get the next character in the buffer */ - if (str->fPos < str->fLimit) { - *c32 = *(str->fPos)++; - if (U_IS_LEAD(*c32)) { - if (str->fPos < str->fLimit) { - UChar c16 = *(str->fPos)++; - *c32 = U16_GET_SUPPLEMENTARY(*c32, c16); - isValidChar = TRUE; - } - else { - *c32 = U_EOF; - } - } - else { - isValidChar = TRUE; - } - } - - return isValidChar; -} - -U_CAPI UChar32 U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fgetcx(UFILE *f) -{ - UChar32 ch; - ufile_getch32(f, &ch); - return ch; -} - -U_CAPI UChar32 U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_fungetc(UChar32 ch, - UFILE *f) -{ - u_localized_string *str; - - str = &f->str; - - /* if we're at the beginning of the buffer, sorry! */ - if (str->fPos == str->fBuffer - || (U_IS_LEAD(ch) && (str->fPos - 1) == str->fBuffer)) - { - ch = U_EOF; - } - else { - /* otherwise, put the character back */ - /* Remember, read them back on in the reverse order. */ - if (U_IS_LEAD(ch)) { - if (*--(str->fPos) != U16_TRAIL(ch) - || *--(str->fPos) != U16_LEAD(ch)) - { - ch = U_EOF; - } - } - else if (*--(str->fPos) != ch) { - ch = U_EOF; - } - } - return ch; -} - -U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */ -u_file_read( UChar *chars, - int32_t count, - UFILE *f) -{ - int32_t dataSize; - int32_t read = 0; - u_localized_string *str = &f->str; - - do { - - /* determine the amount of data in the buffer */ - dataSize = (int32_t)(str->fLimit - str->fPos); - if (dataSize <= 0) { - /* fill the buffer */ - ufile_fill_uchar_buffer(f); - dataSize = (int32_t)(str->fLimit - str->fPos); - } - - /* Make sure that we don't read too much */ - if (dataSize > (count - read)) { - dataSize = count - read; - } - - /* copy the current data in the buffer */ - memcpy(chars + read, str->fPos, dataSize * sizeof(UChar)); - - /* update number of items read */ - read += dataSize; - - /* update the current buffer position */ - str->fPos += dataSize; - } - while (dataSize != 0 && read < count); - - return read; -} -#endif diff --git a/deps/icu-small/source/io/ustream.cpp b/deps/icu-small/source/io/ustream.cpp deleted file mode 100644 index a537d14383fc4f..00000000000000 --- a/deps/icu-small/source/io/ustream.cpp +++ /dev/null @@ -1,173 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -********************************************************************** -* Copyright (C) 2001-2016, International Business Machines -* Corporation and others. All Rights Reserved. -********************************************************************** -* FILE NAME : ustream.cpp -* -* Modification History: -* -* Date Name Description -* 06/25/2001 grhoten Move iostream from unistr.h to here -****************************************************************************** -*/ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_CONVERSION - -#include "unicode/uobject.h" -#include "unicode/ustream.h" -#include "unicode/ucnv.h" -#include "unicode/uchar.h" -#include "unicode/utf16.h" -#include "ustr_cnv.h" -#include "cmemory.h" -#include - -// console IO - -#if U_IOSTREAM_SOURCE >= 199711 - -#define STD_NAMESPACE std:: - -#define STD_OSTREAM STD_NAMESPACE ostream -#define STD_ISTREAM STD_NAMESPACE istream - -U_NAMESPACE_BEGIN - -U_IO_API STD_OSTREAM & U_EXPORT2 -operator<<(STD_OSTREAM& stream, const UnicodeString& str) -{ - if(str.length() > 0) { - char buffer[200]; - UConverter *converter; - UErrorCode errorCode = U_ZERO_ERROR; - - // use the default converter to convert chunks of text - converter = u_getDefaultConverter(&errorCode); - if(U_SUCCESS(errorCode)) { - const UChar *us = str.getBuffer(); - const UChar *uLimit = us + str.length(); - char *s, *sLimit = buffer + (sizeof(buffer) - 1); - do { - errorCode = U_ZERO_ERROR; - s = buffer; - ucnv_fromUnicode(converter, &s, sLimit, &us, uLimit, 0, FALSE, &errorCode); - *s = 0; - - // write this chunk - if(s > buffer) { - stream << buffer; - } - } while(errorCode == U_BUFFER_OVERFLOW_ERROR); - u_releaseDefaultConverter(converter); - } - } - -/* stream.flush();*/ - return stream; -} - -U_IO_API STD_ISTREAM & U_EXPORT2 -operator>>(STD_ISTREAM& stream, UnicodeString& str) -{ - // This is like ICU status checking. - if (stream.fail()) { - return stream; - } - - /* ipfx should eat whitespace when ios::skipws is set */ - UChar uBuffer[16]; - char buffer[16]; - int32_t idx = 0; - UConverter *converter; - UErrorCode errorCode = U_ZERO_ERROR; - - // use the default converter to convert chunks of text - converter = u_getDefaultConverter(&errorCode); - if(U_SUCCESS(errorCode)) { - UChar *us = uBuffer; - const UChar *uLimit = uBuffer + UPRV_LENGTHOF(uBuffer); - const char *s, *sLimit; - char ch; - UChar ch32; - UBool initialWhitespace = TRUE; - UBool continueReading = TRUE; - - /* We need to consume one byte at a time to see what is considered whitespace. */ - while (continueReading) { - ch = stream.get(); - if (stream.eof()) { - // The EOF is only set after the get() of an unavailable byte. - if (!initialWhitespace) { - stream.clear(stream.eofbit); - } - continueReading = FALSE; - } - sLimit = &ch + (int)continueReading; - us = uBuffer; - s = &ch; - errorCode = U_ZERO_ERROR; - /* - Since we aren't guaranteed to see the state before this call, - this code won't work on stateful encodings like ISO-2022 or an EBCDIC stateful encoding. - We flush on the last byte to ensure that we output truncated multibyte characters. - */ - ucnv_toUnicode(converter, &us, uLimit, &s, sLimit, 0, !continueReading, &errorCode); - if(U_FAILURE(errorCode)) { - /* Something really bad happened. setstate() isn't always an available API */ - stream.clear(stream.failbit); - goto STOP_READING; - } - /* Was the character consumed? */ - if (us != uBuffer) { - /* Reminder: ibm-1390 & JISX0213 can output 2 Unicode code points */ - int32_t uBuffSize = us-uBuffer; - int32_t uBuffIdx = 0; - while (uBuffIdx < uBuffSize) { - U16_NEXT(uBuffer, uBuffIdx, uBuffSize, ch32); - if (u_isWhitespace(ch32)) { - if (!initialWhitespace) { - buffer[idx++] = ch; - while (idx > 0) { - stream.putback(buffer[--idx]); - } - goto STOP_READING; - } - /* else skip intialWhitespace */ - } - else { - if (initialWhitespace) { - /* - When initialWhitespace is TRUE, we haven't appended any - character yet. This is where we truncate the string, - to avoid modifying the string before we know if we can - actually read from the stream. - */ - str.truncate(0); - initialWhitespace = FALSE; - } - str.append(ch32); - } - } - idx = 0; - } - else { - buffer[idx++] = ch; - } - } -STOP_READING: - u_releaseDefaultConverter(converter); - } - -/* stream.flush();*/ - return stream; -} - -U_NAMESPACE_END - -#endif -#endif diff --git a/deps/npm/.github/CODEOWNERS b/deps/npm/.github/CODEOWNERS new file mode 100644 index 00000000000000..ef8743136d8a1c --- /dev/null +++ b/deps/npm/.github/CODEOWNERS @@ -0,0 +1 @@ +* @npm/cli-team diff --git a/deps/npm/.travis.yml b/deps/npm/.travis.yml index 95255d8d8072bb..e63df7e47bf3e3 100644 --- a/deps/npm/.travis.yml +++ b/deps/npm/.travis.yml @@ -22,6 +22,9 @@ matrix: # then master - node_js: "8" env: DEPLOY_VERSION=testing + script: + - "standard" + - "node . run tap -- \"test/tap/*.js\" \"test/broken-under-nyc/*.js\"" before_install: # required by test/tap/registry.js - "mkdir -p /var/run/couchdb" @@ -29,25 +32,8 @@ notifications: slack: npm-inc:kRqQjto7YbINqHPb1X6nS3g8 cache: directories: - - $HOME/.npm - - html/doc - - man - - node_modules/.bin - node_modules/.cache - - node_modules/deep-equal - - node_modules/marked - - node_modules/marked-man - - node_modules/npm-registry-couchapp - - node_modules/npm-registry-mock - - node_modules/require-inject - - node_modules/sprintf-js - - node_modules/standard - - node_modules/tacks - - node_modules/tap install: - - "node . rebuild --depth=0" - - "node . install --ignore-scripts" - - "node . prune" - - "make -j4 doc" + - "node . install" script: - "node . run tap -- \"test/tap/*.js\" \"test/broken-under-nyc/*.js\"" diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index 7357c4a1bd5bdd..07f44ab1c17379 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -475,3 +475,31 @@ Jason Wohlgemuth Ryan Graham Hirse Colin Rotherham +Aki +Emily Marigold Klassen +Ramana Venkata +kierendixon +Rácz Tibor Zoltán +Guangcong Luo +Steven +Jan Pilzer +Leonard Martin +Teddy Katz +Simon Legg +Kin Lum +dax +Jože Mlakar +happylynx +Dominic Watson +Enrico Weigelt, metux IT consult +Brian Beck +Ramana Venkata +mmkal +Andrew Schmadel +AJ Jordan +Mark Banner +Richard Simko +Sanketh Katta +Tim Needham +leonardo rojas +Mark Peter Fejes diff --git a/deps/npm/BROKEN.org b/deps/npm/BROKEN.org deleted file mode 100644 index 65b1db9a1de612..00000000000000 --- a/deps/npm/BROKEN.org +++ /dev/null @@ -1,37 +0,0 @@ -* Broken test files - * add-remote-git-get-resolved.js (needs porting to pacote) - * bugs.js (I think because opts.fullMetadata) - * builtin-config.js (freezes) - * check-cpu-reqs.js (uhhh? it's not checking?) - * check-engine-reqs.js (same?) - * check-os-reqs.js (same?) - * doctor.js (needs rewrite) - * full-warning-messages.js - * get.js - * git-npmignore.js - * git-races.js - * github-shortcut.js - * ignore-shrinkwrap.js - * install-shrinkwrapped-git.js - * install-with-dev-dep-duplicate.js - * legacy-npm-self-install.js (one check failed) - * ls-depth-cli.js - * outdated-local.js - * outdated-notarget.js - * outdated-private.js - * peer-deps-invalid.js - * peer-deps-toplevel.js - * peer-deps-without-package-json.js - * repo.js - * retry-on-stale-cache.js - * scope-header.js - * shrinkwrap-default-arg-ver.js - * shrinkwrap-local-dependency.js - * shrinkwrap-optional-dependency.js - * shrinkwrap-optional-property.js - * shrinkwrap-prod-dependency.js - * shrinkwrap-shared-dev-dependency.js - * splat-with-only-prerelease-to-latest.js - * url-dependencies.js - * verify-no-lifecycle-on-repo.js - * network/legacy-shrinkwrap.js diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index 03b7e29d91e869..0571c17272e891 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,3 +1,497 @@ +## v5.3.0 (2017-07-12): + +As mentioned before, we're continuing to do relatively rapid, smaller releases +as we keep working on stomping out `npm@5` issues! We've made a lot of progress +since 5.0 already, and this release is no exception. + +### FEATURES + +* [`1e3a46944`](https://github.com/npm/npm/commit/1e3a469448b5db8376e6f64022c4c0c78cdb1686) + [#17616](https://github.com/npm/npm/pull/17616) + Add `--link` filter option to `npm ls`. + ([@richardsimko](https://github.com/richardsimko)) +* [`33df0aaa`](https://github.com/npm/npm/commit/33df0aaaa7271dac982b86f2701d10152c4177c8) + `libnpx@9.2.0`: + * 4 new languages - Czech, Italian, Turkish, and Chinese (Traditional)! This means npx is available in 14 different languages! + * New --node-arg option lets you pass CLI arguments directly to node when the target binary is found to be a Node.js script. + ([@zkat](https://github.com/zkat)) + +### BUGFIXES + +* [`33df0aaa`](https://github.com/npm/npm/commit/33df0aaaa7271dac982b86f2701d10152c4177c8) + `libnpx@9.2.0`: + * npx should now work on (most) Windows installs. A couple of issues remain. + * Prevent auto-fallback from going into an infinite loop when npx disappears. + * `npx npx npx npx npx npx npx npx` works again. + * `update-notifier` will no longer run for the npx bundled with npm. + * `npx ` in a subdirectory of your project should be able to find your `node_modules/.bin` now. Oops + ([@zkat](https://github.com/zkat)) +* [`8e979bf80`](https://github.com/npm/npm/commit/8e979bf80fb93233f19db003f08443e26cfc5e64) + Revert change where npm stopped flattening modules that required peerDeps. + This caused problems because folks were using peer deps to indicate that the + target of the peer dep needed to be able to require the dependency and had + been relying on the fact that peer deps didn't change the shape of the tree + (as of npm@3). + The fix that will actually work for people is for a peer dep to insist on + never being installed deeper than the the thing it relies on. At the moment + this is tricky because the thing the peer dep relies on may not yet have + been added to the tree, so we don't know where it is. + ([@iarna](https://github.com/iarna)) +* [`7f28a77f3`](https://github.com/npm/npm/commit/7f28a77f33ef501065f22e8d5e8cffee3195dccd) + [#17733](https://github.com/npm/npm/pull/17733) + Split remove and unbuild actions into two to get uninstall lifecycles and the + removal of transitive symlinks during uninstallation to run in the right + order. + ([@iarna](https://github.com/iarna)) +* [`637f2548f`](https://github.com/npm/npm/commit/637f2548facae011eebf5e5c38bfe56a6c2db9fa) + [#17748](https://github.com/npm/npm/pull/17748) + When rolling back use symlink project-relative path, fixing some issues with + `fs-vacuum` getting confused while removing symlinked things. + ([@iarna](https://github.com/iarna)) +* [`f153b5b22`](https://github.com/npm/npm/commit/f153b5b22f647d4d403f5b8cecd2ce63ac75b07c) + [#17706](https://github.com/npm/npm/pull/17706) + Use semver to compare node versions in npm doctor instead of plain `>` + comparison. + ([@leo-shopify](https://github.com/leo-shopify)) +* [`542f7561`](https://github.com/npm/npm/commit/542f7561d173eca40eb8d838a16a0ed582fef989) + [#17742](https://github.com/npm/npm/pull/17742) + Fix issue where `npm version` would sometimes not commit package-locks. + ([@markpeterfejes](https://github.com/markpeterfejes)) +* [`51a9e63d`](https://github.com/npm/npm/commit/51a9e63d31cb5ac52259dcf1c364004286072426) + [#17777](https://github.com/npm/npm/pull/17777) + Fix bug exposed by other bugfixes where the wrong package would be removed. + ([@iarna](https://github.com/iarna)) + +### DOCUMENTATION + +Have we mentioned we really like documentation patches? Keep sending them in! +Small patches are just fine, and they're a great way to get started contributing +to npm! + +* [`fb42d55a9`](https://github.com/npm/npm/commit/fb42d55a9a97afa5ab7db38b3b99088cf68684ea) + [#17728](https://github.com/npm/npm/pull/17728) + Document semver git urls in package.json docs. + ([@sankethkatta](https://github.com/sankethkatta)) +* [`f398c700f`](https://github.com/npm/npm/commit/f398c700fb0f2f3665ebf45995a910ad16cd8d05) + [#17684](https://github.com/npm/npm/pull/17684) + Tweak heading hierarchy in package.json docs. + ([@sonicdoe](https://github.com/sonicdoe)) +* [`d5ad65e50`](https://github.com/npm/npm/commit/d5ad65e50a573cdf9df4155225e869cd6c88ca5e) + [#17691](https://github.com/npm/npm/pull/17691) + Explicitly document `--no-save` flag for uninstall. + ([@timneedham](https://github.com/timneedham)) + +## v5.2.0 (2017-07-05): + +It's only been a couple of days but we've got some bug fixes we wanted to +get out to you all. We also believe that +[`npx`](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) is ready to be bundled +with npm, which we're really excited about! + +### npx!!! + +npx is a tool intended to help round out the experience of using packages +from the npm registry — the same way npm makes it super easy to install and +manage dependencies hosted on the registry, npx is meant to make it easy to +use CLI tools and other executables hosted on the registry. It greatly +simplifies a number of things that, until now, required a bit of ceremony to +do with plain npm. + +![](https://cdn-images-1.medium.com/max/1600/1*OlIRsvVO5aK7ja9HmwXz_Q.gif) + +[@zkat](https://github.com/zkat) has a [great introduction post to npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) +that I highly recommend you give a read + +* [`fb040bee0`](https://github.com/npm/npm/commit/fb040bee0710759c60e45bf8fa2a3b8ddcf4212a) + [#17685](https://github.com/npm/npm/pull/17685) + Bundle npx with npm itself. + ([@zkat](https://github.com/zkat)) + +### BUG FIXES + +* [`9fe905c39`](https://github.com/npm/npm/commit/9fe905c399d07a3c00c7b22035ddb6b7762731e6) + [#17652](https://github.com/npm/npm/pull/17652) + Fix max callstack exceeded loops with trees with circular links. + ([@iarna](https://github.com/iarna)) +* [`c0a289b1b`](https://github.com/npm/npm/commit/c0a289b1ba6b99652c43a955b23acbf1de0b56ae) + [#17606](https://github.com/npm/npm/pull/17606) + Make sure that when write package.json and package-lock.json we always use unix path separators. + ([@Standard8](https://github.com/Standard8)) +* [`1658b79ca`](https://github.com/npm/npm/commit/1658b79cad89ccece5ae5ce3c2f691d44b933116) + [#17654](https://github.com/npm/npm/pull/17654) + Make `npm outdated` show results for globals again. Previously it never thought they were out of date. + ([@iarna](https://github.com/iarna)) +* [`06c154fd6`](https://github.com/npm/npm/commit/06c154fd653d18725d2e760ba825d43cdd807420) + [#17678](https://github.com/npm/npm/pull/17678) + Stop flattening modules that have peer dependencies. We're making this + change to support scenarios where the module requiring a peer dependency + is flattened but the peer dependency itself is not, due to conflicts. In + those cases the module requiring the peer dep can't be flattened past the + location its peer dep was placed in. This initial fix is naive, never + flattening peer deps, and we can look into doing something more + sophisticated later on. + ([@iarna](https://github.com/iarna)) +* [`88aafee8b`](https://github.com/npm/npm/commit/88aafee8b5b232b7eeb5690279a098d056575791) + [#17677](https://github.com/npm/npm/pull/17677) + There was an issue where updating a flattened dependency would sometimes + unflatten it. This only happened when the dependency had dependencies + that in turn required the original dependency. + ([@iarna](https://github.com/iarna)) +* [`b58ec8eab`](https://github.com/npm/npm/commit/b58ec8eab3b4141e7f1b8b42d8cc24f716a804d8) + [#17626](https://github.com/npm/npm/pull/17626) + Integrators who were building their own copies of npm ran into issues because + `make install` and https://npmjs.com/install.sh weren't aware that + `npm install` creates links now when given a directory to work on. This does not impact folks + installing npm with `npm install -g npm`. + ([@iarna](https://github.com/iarna)) + +### DOC FIXES + +* [`10bef735e`](https://github.com/npm/npm/commit/10bef735e825acc8278827d34df415dfcd8c67d4) + [#17645](https://github.com/npm/npm/pull/17645) + Fix some github issue links in the 5.1.0 changelog + ([@schmod](https://github.com/schmod)) +* [`85fa9dcb2`](https://github.com/npm/npm/commit/85fa9dcb2f0b4f51b515358e0184ec82a5845227) + [#17634](https://github.com/npm/npm/pull/17634) + Fix typo in package-lock docs. + ([@sonicdoe](https://github.com/sonicdoe)) +* [`688699bef`](https://github.com/npm/npm/commit/688699befc2d147288c69a9405fb8354ecaebe36) + [#17628](https://github.com/npm/npm/pull/17628) + Recommend that folks looking for support join us on https://package.community/ or message + [@npm_support](https://twitter.com/npm_support) on Twitter. + ([@strugee](https://github.com/strugee)) + + +## v5.1.0 (2017-07-05): + +Hey y'all~ + +We've got some goodies for you here, including `npm@5`'s first semver-minor +release! This version includes a huge number of fixes, particularly for some of +the critical bugs users were running into after upgrading npm. You should +overall see a much more stable experience, and we're going to continue hacking +on fixes for the time being. Semver-major releases, specially for tools like +npm, are bound to cause some instability, and getting `npm@5` stable is the CLI +team's top priority for now! + +Not that bugfixes are the only things that landed, either: between improvements +that fell out of the bugfixes, and some really cool work by community members +like [@mikesherov](https://github.com/mikesherov), `npm@5.1.0` is **_twice as +fast_** as `npm@5.0.0` in some benchmarks. We're not stopping there, either: you +can expect a steady stream of speed improvements over the course of the year. +It's not _top_ priority, but we'll keep doing what we can to make sure npm saves +its users as much time as possible. + +Hang on to your seats. At **100 commits**, this release is a bit of a doozy. 😎 + +### FEATURES + +Semver-minor releases, of course, mean that there's a new feature somewhere, +right? Here's what's bumping that number for us this time: + +* [`a09c1a69d`](https://github.com/npm/npm/commit/a09c1a69df05b753464cc1272cdccc6af0f4da5a) + [#16687](https://github.com/npm/npm/pull/16687) + Allow customizing the shell used to execute `run-script`s. + ([@mmkal](https://github.com/mmkal)) +* [`4f45ba222`](https://github.com/npm/npm/commit/4f45ba222e2ac6dbe6d696cb7a8e678bbda7c839) [`a48958598`](https://github.com/npm/npm/commit/a489585985540deed4edc03418636c9e97aa9e40) [`901bef0e1`](https://github.com/npm/npm/commit/901bef0e1ea806fc08d8d58744a9f813b6c020ab) + [#17508](https://github.com/npm/npm/pull/17508) + Add a new `requires` field to `package-lock.json` with information about the + _logical_ dependency tree. This includes references to the specific version + each package is intended to see, and can be used for many things, such as + [converting `package-lock.json` to other lockfile + formats](https://twitter.com/maybekatz/status/880578566907248640), various + optimizations, and verifying correctness of a package tree. + ([@iarna](https://github.com/iarna)) +* [`47e8fc8eb`](https://github.com/npm/npm/commit/47e8fc8eb9b5faccef9e03ab991cf37458c16249) + [#17508](https://github.com/npm/npm/pull/17508) + Make `npm ls` take package locks (and shrinkwraps) into account. This means + `npm ls` can now be used to see [which dependencies are + missing](https://twitter.com/maybekatz/status/880446509547794437), so long as + a package lock has been previously generated with it in. + ([@iarna](https://github.com/iarna)) +* [`f0075e7ca`](https://github.com/npm/npm/commit/f0075e7caa3e151424a254d7809ae4489ed8df90) + [#17508](https://github.com/npm/npm/pull/17508) + Take `package.json` changes into account when running installs -- if you + remove or add a dependency to `package.json` manually, npm will now pick that + up and update your tree and package lock accordingly. + ([@iarna](https://github.com/iarna)) +* [`83a5455aa`](https://github.com/npm/npm/commit/83a5455aac3c5cc2511ab504923b652b13bd66a0) + [#17205](https://github.com/npm/npm/pull/17205) + Add `npm udpate` as an alias for `npm update`, for symmetry with + `install`/`isntall`. + ([@gdassori](https://github.com/gdassori)) +* [`57225d394`](https://github.com/npm/npm/commit/57225d394b6174eb0be48393d8e18da0991f67b6) + [#17120](https://github.com/npm/npm/pull/17120) + npm will no longer warn about `preferGlobal`, and the option is now + deprecated. + ([@zkat](https://github.com/zkat)) +* [`82df7bb16`](https://github.com/npm/npm/commit/82df7bb16fc29c47a024db4a8c393e55f883744b) + [#17351](https://github.com/npm/npm/pull/17351) + As some of you may already know `npm build` doesn't do what a lot of people + expect: It's mainly an npm plumbing command, and is part of the more familiar + `npm rebuild` command. That said, a lot of users assume that this is the way + to run an npm `run-script` named `build`, which is an incredibly common script + name to use. To clarify things for users, and encourage them to use `npm run + build` instead, npm will now warn if `npm build` is run without any arguments. + ([@lennym](https://github.com/lennym)) + +### PERFORMANCE + +* [`59f86ef90`](https://github.com/npm/npm/commit/59f86ef90a58d8dc925c9613f1c96e68bee5ec7b) [`43be9d222`](https://github.com/npm/npm/commit/43be9d2222b23ebb0a427ed91824ae217e6d077a) [`e906cdd98`](https://github.com/npm/npm/commit/e906cdd980b4722e66618ce295c682b9a8ffaf8f) + [#16633](https://github.com/npm/npm/pull/16633) + npm now parallelizes tarball extraction across multiple child process workers. + This can significantly speed up installations, specially when installing from + cache, and will improve with number of processors. + ([@zkat](https://github.com/zkat)) +* [`e0849878d`](https://github.com/npm/npm/commit/e0849878dd248de8988c2ef3fc941054625712ca) + [#17441](https://github.com/npm/npm/pull/17441) + Avoid building environment for empty lifecycle scripts. This change alone + accounted for as much as a 15% speed boost for npm installations by outright + skipping entire steps of the installer when not needed. + ([@mikesherov](https://github.com/mikesherov)) +* [`265c2544c`](https://github.com/npm/npm/commit/265c2544c8ded10854909243482e6437ed03c261) + [npm/hosted-git-info#24](https://github.com/npm/hosted-git-info/pull/24) + `hosted-git-info@2.5.0`: Add caching to `fromURL`, which gets called many, + many times by the installer. This improved installation performance by around + 10% on realistic application repositories. + ([@mikesherov](https://github.com/mikesherov)) +* [`901d26cb`](https://github.com/npm/npm/commit/901d26cb656e7e773d9a38ef4eac9263b95e07c8) + [npm/read-package-json#20](https://github.com/npm/read-package-json/pull/70) + `read-package-json@2.0.9`: Speed up installs by as much as 20% by + reintroducing a previously-removed cache and making it actually be correct + this time around. + ([@mikesherov](https://github.com/mikesherov)) +* [`44e37045d`](https://github.com/npm/npm/commit/44e37045d77bc40adf339b423d42bf5e9b4d4d91) + Eliminate `Bluebird.promisifyAll` from our codebase. + ([@iarna](https://github.com/iarna)) +* [`3b4681b53`](https://github.com/npm/npm/commit/3b4681b53db7757985223932072875d099694677) + [#17508](https://github.com/npm/npm/pull/17508) + Stop calling `addBundle` on locked deps, speeding up the + `package-lock.json`-based fast path. + ([@iarna](https://github.com/iarna)) + +### BUGFIXES + +* [#17508](https://github.com/npm/npm/pull/17508) + This is a big PR that fixes a variety of issues when installing from package + locks. If you were previously having issues with missing dependencies or + unwanted removals, this might have fixed it: + * It introduces a new `package-lock.json` field, called `requires`, which tracks which modules a given module requires. + * It fixes [#16839](https://github.com/npm/npm/issues/16839) which was caused by not having this information available, particularly when git dependencies were involved. + * It fixes [#16866](https://github.com/npm/npm/issues/16866), allowing the `package.json` to trump the `package-lock.json`. + * `npm ls` now loads the shrinkwrap, which opens the door to showing a full tree of dependencies even when nothing is yet installed. (It doesn't do that yet though.) + ([@iarna](https://github.com/iarna)) +* [`656544c31`](https://github.com/npm/npm/commit/656544c31cdef3cef64fc10c24f03a8ae2685e35) [`d21ab57c3`](https://github.com/npm/npm/commit/d21ab57c3ef4f01d41fb6c2103debe884a17dc22) + [#16637](https://github.com/npm/npm/pull/16637) + Fix some cases where `npm prune` was leaving some dependencies unpruned if + to-be-pruned dependencies depended on them. + ([@exogen](https://github.com/exogen)) +* [`394436b09`](https://github.com/npm/npm/commit/394436b098dcca2d252061f95c4eeb92c4a7027c) + [#17552](https://github.com/npm/npm/pull/17552) + Make `refresh-package-json` re-verify the package platform. This fixes an + issue most notably experienced by Windows users using `create-react-app` where + `fsevents` would not short-circuit and cause a crash during its + otherwise-skipped native build phase. + ([@zkat](https://github.com/zkat)) +* [`9e5a94354`](https://github.com/npm/npm/commit/9e5a943547b29c8d022192afd9398b3a136a7e5a) + [#17590](https://github.com/npm/npm/pull/17590) + Fix an issue where `npm@5` would crash when trying to remove packages + installed with `npm@<5`. + ([@iarna](https://github.com/iarna)) +* [`c3b586aaf`](https://github.com/npm/npm/commit/c3b586aafa9eabac572eb6e2b8a7266536dbc65b) + [#17141](https://github.com/npm/npm/issues/17141) + Don't update the package.json when modifying packages that don't go there. + This was previously causing `package.json` to get a `"false": {}` field added. + ([@iarna](https://github.com/iarna)) +* [`d04a23de2`](https://github.com/npm/npm/commit/d04a23de21dd9991b32029d839b71e10e07b400d) [`4a5b360d5`](https://github.com/npm/npm/commit/4a5b360d561f565703024085da0927ccafe8793e) [`d9e53db48`](https://github.com/npm/npm/commit/d9e53db48ca227b21bb67df48c9b3580cb390e9e) + `pacote@2.7.38`: + * [zkat/pacote#102](https://github.com/zkat/pacote/pull/102) Fix issue with tar extraction and special characters. + * Enable loose semver parsing in some missing corner cases. + ([@colinrotherham](https://github.com/colinrotherham), [@zkat](https://github.com/zkat), [@mcibique](https://github.com/mcibique)) +* [`e2f815f87`](https://github.com/npm/npm/commit/e2f815f87676b7c50b896e939cee15a01aa976e4) + [#17104](https://github.com/npm/npm/pull/17104) + Write an empty str and wait for flush to exit to reduce issues with npm + exiting before all output is complete when it's a child process. + ([@zkat](https://github.com/zkat)) +* [`835fcec60`](https://github.com/npm/npm/commit/835fcec601204971083aa3a281c3a9da6061a7c2) + [#17060](https://github.com/npm/npm/pull/17060) + Make git repos with prepare scripts always install with both dev and prod + flags. + ([@intellix](https://github.com/intellix)) +* [`f1dc8a175`](https://github.com/npm/npm/commit/f1dc8a175eed56f1ed23bd5773e5e10beaf6cb31) + [#16879](https://github.com/npm/npm/pull/16879) + Fix support for `always-auth` and `_auth`. They are now both available in both + unscoped and registry-scoped configurations. + ([@jozemlakar](https://github.com/jozemlakar)) +* [`ddd8a1ca2`](https://github.com/npm/npm/commit/ddd8a1ca2fa3377199af74ede9d0c1a406d19793) + Serialize package specs to prevent `[object Object]` showing up in logs during + extraction. + ([@zkat](https://github.com/zkat)) +* [`99ef3b52c`](https://github.com/npm/npm/commit/99ef3b52caa7507e87a4257e622f8964b1c1f5f3) + [#17505](https://github.com/npm/npm/pull/17505) + Stop trying to commit updated `npm-shrinkwrap.json` and `package-lock.json` if + they're `.gitignore`d. + ([@zkat](https://github.com/zkat)) +* [`58be2ec59`](https://github.com/npm/npm/commit/58be2ec596dfb0353ad2570e6750e408339f1478) + Make sure uid and gid are getting correctly set even when they're `0`. This + should fix some Docker-related issues with bad permissions/broken ownership. + ([@rgrove](https://github.com/rgrove)) + ([@zkat](https://github.com/zkat)) +* [`9d1e3b6fa`](https://github.com/npm/npm/commit/9d1e3b6fa01bb563d76018ee153259d9507658cf) + [#17506](https://github.com/npm/npm/pull/17506) + Skip writing package.json and locks if on-disk version is identical to the new + one. + ([@zkat](https://github.com/zkat)) +* [`3fc6477a8`](https://github.com/npm/npm/commit/3fc6477a89773786e6c43ef43a23e5cdc662ff8e) + [#17592](https://github.com/npm/npm/pull/17592) + Fix an issue where `npm install -g .` on a package with no `name` field would + cause the entire global `node_modules` directory to be replaced with a symlink + to `$CWD`. lol. + ([@iarna](https://github.com/iarna)) +* [`06ba0a14a`](https://github.com/npm/npm/commit/06ba0a14a6c1c8cdcc8c062b68c8c63041b0cec0) + [#17591](https://github.com/npm/npm/pull/17591) + Fix spurious removal reporting: if you tried to remove something that didn't + actually exist, npm would tell you it removed 1 package even though there was + nothing to do. + ([@iarna](https://github.com/iarna)) +* [`20ff05f8`](https://github.com/npm/npm/commit/20ff05f8fe0ad8c36e1323d30b63b4d2ff7e11ef) + [#17629](https://github.com/npm/npm/pull/17629) + When removing a link, keep dependencies installed inside of it instead of + removing them, if the link is outside the scope of the current project. This + fixes an issue where removing globally-linked packages would remove all their + dependencies in the source directory, as well as some ergonomic issues when + using links in other situations. + ([@iarna](https://github.com/iarna)) + +### DOCS + +* [`fd5fab595`](https://github.com/npm/npm/commit/fd5fab5955a20a9bb8c0e77092ada1435f73a8d2) + [#16441](https://github.com/npm/npm/pull/16441) + Add spec for `npm-shrinkwrap.json` and `package-lock.json` from RFC. + ([@iarna](https://github.com/iarna)) +* [`9589c1ccb`](https://github.com/npm/npm/commit/9589c1ccb3f794abaaa48c2a647ada311dd881ef) + [#17451](https://github.com/npm/npm/pull/17451) + Fix typo in changelog. + ([@watilde](https://github.com/watilde)) +* [`f8e76d856`](https://github.com/npm/npm/commit/f8e76d8566ae1965e57d348df74edad0643b66a6) + [#17370](https://github.com/npm/npm/pull/17370) + Correct the default prefix config path for Windows operating systems in the + documentation for npm folders. + ([@kierendixon](https://github.com/kierendixon)) +* [`d0f3b5a12`](https://github.com/npm/npm/commit/d0f3b5a127718b0347c6622a2b9c28341c530d36) + [#17369](https://github.com/npm/npm/pull/17369) + Fix `npm-config` reference to `userconfig` & `globalconfig` environment + variables. + ([@racztiborzoltan](https://github.com/racztiborzoltan)) +* [`87629880a`](https://github.com/npm/npm/commit/87629880a71baec352c1b5345bc29268d6212467) + [#17336](https://github.com/npm/npm/pull/17336) + Remove note in docs about `prepublish` being entirely removed. + ([@Hirse](https://github.com/Hirse)) +* [`a1058afd9`](https://github.com/npm/npm/commit/a1058afd9a7a569bd0ac65b86eadd4fe077a7221) + [#17169](https://github.com/npm/npm/pull/17169) + Document `--no-package-lock` flag. + ([@leggsimon](https://github.com/leggsimon)) +* [`32fc6e41a`](https://github.com/npm/npm/commit/32fc6e41a2ce4dbcd5ce1e5f291e2e2efc779d48) + [#17250](https://github.com/npm/npm/pull/17250) + Fix a typo in the shrinkwrap docs. + ([@Zarel](https://github.com/Zarel)) +* [`f19bd3c8c`](https://github.com/npm/npm/commit/f19bd3c8cbd37c8a99487d6b5035282580ac3e9d) + [#17249](https://github.com/npm/npm/pull/17249) + Fix a package-lock.json cross-reference link. + ([@not-an-aardvark](https://github.com/not-an-aardvark)) +* [`153245edc`](https://github.com/npm/npm/commit/153245edc4845db670ada5e95ef384561706a751) + [#17075](https://github.com/npm/npm/pull/17075/files) + Fix a typo in `npm-config` docs. + ([@KennethKinLum](https://github.com/KennethKinLum)) +* [`c9b534a14`](https://github.com/npm/npm/commit/c9b534a148818d1a97787c0dfdba5f64ce3618a6) + [#17074](https://github.com/npm/npm/pull/17074) + Clarify config documention with multiple boolean flags. + ([@KennethKinLum](https://github.com/KennethKinLum)) +* [`e111b0a40`](https://github.com/npm/npm/commit/e111b0a40c4bc6691d7b8d67ddce5419e67bfd27) + [#16768](https://github.com/npm/npm/pull/16768) + Document the `-l` option to `npm config list`. + ([@happylynx](https://github.com/happylynx)) +* [`5a803ebad`](https://github.com/npm/npm/commit/5a803ebadd61229bca3d64fb3ef1981729b2548e) + [#16548](https://github.com/npm/npm/pull/16548) + Fix permissions for documentation files. Some of them had `+x` set. (???) + ([@metux](https://github.com/metux)) +* [`d57d4f48c`](https://github.com/npm/npm/commit/d57d4f48c6cd00fdf1e694eb49e9358071d8e105) + [#17319](https://github.com/npm/npm/pull/17319) + Document that the `--silent` option for `npm run-script` can be used to + suppress `npm ERR!` output on errors. + ([@styfle](https://github.com/styfle)) + +### MISC + +Not all contributions need to be visible features, docs, or bugfixes! It's super +helpful when community members go over our code and help clean it up, too! + +* [`9e5b76140`](https://github.com/npm/npm/commit/9e5b76140ffdb7dcd12aa402793644213fb8c5d7) + [#17411](https://github.com/npm/npm/pull/17411) + Convert all callback-style `move` usage to use Promises. + ([@vramana](https://github.com/vramana)) +* [`0711c08f7`](https://github.com/npm/npm/commit/0711c08f779ac641ec42ecc96f604c8861008b28) + [#17394](https://github.com/npm/npm/pull/17394) + Remove unused argument in `deepSortObject`. + ([@vramana](https://github.com/vramana)) +* [`7d650048c`](https://github.com/npm/npm/commit/7d650048c8ed5faa0486492f1eeb698e7383e32f) + [#17563](https://github.com/npm/npm/pull/17563) + Refactor some code to use `Object.assign`. + ([@vramana](https://github.com/vramana)) +* [`993f673f0`](https://github.com/npm/npm/commit/993f673f056aea5f602ea04b1e697b027c267a2d) + [#17600](https://github.com/npm/npm/pull/17600) + Remove an old comment. + ([@vramana](https://github.com/vramana)) + +## v5.0.4 (2017-06-13): + +Hey y'all. This is another minor patch release with a variety of little fixes +we've been accumulating~ + +* [`f0a37ace9`](https://github.com/npm/npm/commit/f0a37ace9ab7879cab20f2b0fcd7840bfc305feb) + Fix `npm doctor` when hitting registries without `ping`. + ([@zkat](https://github.com/zkat)) +* [`64f0105e8`](https://github.com/npm/npm/commit/64f0105e81352b42b72900d83b437b90afc6d9ce) + Fix invalid format error when setting cache-related headers. + ([@zkat](https://github.com/zkat)) +* [`d2969c80e`](https://github.com/npm/npm/commit/d2969c80e4178faebf0f7c4cab6eb610dd953cc6) + Fix spurious `EINTEGRITY` issue. + ([@zkat](https://github.com/zkat)) +* [`800cb2b4e`](https://github.com/npm/npm/commit/800cb2b4e2d0bd00b5c9082a896f2110e907eb0b) + [#17076](https://github.com/npm/npm/pull/17076) + Use legacy `from` field to improve upgrade experience from legacy shrinkwraps + and installs. + ([@zkat](https://github.com/zkat)) +* [`4100d47ea`](https://github.com/npm/npm/commit/4100d47ea58b4966c02604f71350b5316108df6a) + [#17007](https://github.com/npm/npm/pull/17007) + Restore loose semver parsing to match older npm behavior when running into + invalid semver ranges in dependencies. + ([@zkat](https://github.com/zkat)) +* [`35316cce2`](https://github.com/npm/npm/commit/35316cce2ca2d8eb94161ec7fe7e8f7bec7b3aa7) + [#17005](https://github.com/npm/npm/pull/17005) + Emulate npm@4's behavior of simply marking the peerDep as invalid, instead of + crashing. + ([@zkat](https://github.com/zkat)) +* [`e7e8ee5c5`](https://github.com/npm/npm/commit/e7e8ee5c57c7238655677e118a8809b652019f53) + [#16937](https://github.com/npm/npm/pull/16937) + Workaround for separate bug where `requested` was somehow null. + ([@forivall](https://github.com/forivall)) +* [`2d9629bb2`](https://github.com/npm/npm/commit/2d9629bb2043cff47eaad2654a64d2cef5725356) + Better logging output for git errors. + ([@zkat](https://github.com/zkat)) +* [`2235aea73`](https://github.com/npm/npm/commit/2235aea73569fb9711a06fa6344ef31247177dcd) + More scp-url fixes: parsing only worked correctly when a committish was + present. + ([@zkat](https://github.com/zkat)) +* [`80c33cf5e`](https://github.com/npm/npm/commit/80c33cf5e6ef207450949764de41ea96538c636e) + Standardize package permissions on tarball extraction, instead of using perms + from the tarball. This matches previous npm behavior and fixes a number of + incompatibilities in the wild. + ([@zkat](https://github.com/zkat)) +* [`2b1e40efb`](https://github.com/npm/npm/commit/2b1e40efba0b3d1004259efa4275cf42144e3ce3) + Limit shallow cloning to hosts which are known to support it. + ([@zkat](https://github.com/zkat)) + ## v5.0.3 (2017-06-05) Happy Monday, y'all! We've got another npm release for you with the fruits of diff --git a/deps/npm/Makefile b/deps/npm/Makefile index 7b69df98fe1831..53ab16a29063c2 100644 --- a/deps/npm/Makefile +++ b/deps/npm/Makefile @@ -14,7 +14,8 @@ html_docdeps = html/dochead.html \ cli_mandocs = $(shell find doc/cli -name '*.md' \ |sed 's|.md|.1|g' \ |sed 's|doc/cli/|man/man1/|g' ) \ - man/man1/npm-README.1 + man/man1/npm-README.1 \ + man/man1/npx.1 files_mandocs = $(shell find doc/files -name '*.md' \ |sed 's|.md|.5|g' \ @@ -56,7 +57,7 @@ latest: node bin/npm-cli.js install -g -f npm ${NPMOPTS} install: all - node bin/npm-cli.js install -g -f ${NPMOPTS} + node bin/npm-cli.js install -g -f ${NPMOPTS} $(shell node bin/npm-cli.js pack | tail -1) # backwards compat dev: install @@ -96,6 +97,9 @@ man/man1/%.1: doc/cli/%.md scripts/doc-build.sh package.json @[ -d man/man1 ] || mkdir -p man/man1 scripts/doc-build.sh $< $@ +man/man1/npx.1: node_modules/libnpx/libnpx.1 + cat $< | sed s/libnpx/npx/ > $@ + man/man5/npm-json.5: man/man5/package.json.5 cp $< $@ diff --git a/deps/npm/README.md b/deps/npm/README.md index 3a96074afb4f09..ce79f41ec2b13b 100644 --- a/deps/npm/README.md +++ b/deps/npm/README.md @@ -158,8 +158,9 @@ When you find issues, please report them: Be sure to include *all* of the output from the npm command that didn't work as expected. The `npm-debug.log` file is also helpful to provide. -You can also look for isaacs in #node.js on irc://irc.freenode.net. She -will no doubt tell you to put the output in a gist or email. +You can also find npm people in `#npm` on https://package.community/ or +[on Twitter](https://twitter.com/npm_support). Whoever responds will no +doubt tell you to put the output in a gist or email. ## SEE ALSO diff --git a/deps/npm/TODO.org b/deps/npm/TODO.org deleted file mode 100644 index 9ccceba595ff8a..00000000000000 --- a/deps/npm/TODO.org +++ /dev/null @@ -1,86 +0,0 @@ -* Finished - * [COMPLETED] npm: remove packageIntegrity - * [COMPLETED] npm: fix lifecycle stuff - * pack: - * pre-: immediately before tarball contents are packed. Need to re-read package.json immediately after - * pack: No pack lifecycle - * post-: immediately after tarball reaches its final destination (not immediately after packaging) - * prepare: `npm install`, immediately before `postinstall`, and immediately before `prepack`, never if `--prod`, after prepublish, before prepublishOnly - * prepublish: alias for `prepare` - * prepublishOnly: ONLY on `npm publish` (never on `npm pack`), runs before prepack (which takes care of re-reading package.json), re-reads package.json immediately after - * [COMPLETED] pacote: fix always-auth bug - * [COMPLETED] pacote: figure out why cache is being written as root - * [COMPLETED] npm: make `npm update` save files as the right type - * [COMPLETED] npm: update docs with npm5 changes - * [COMPLETED] npm: don't write "problems" into package-lock - * [COMPLETED] npm: add `created-with`, `shrinkwrap-version`, and `package-integrity` - * [COMPLETED] npm: warn on incompatible package-lock version - * [COMPLETED] npm: warn if both shrinkwrap and package-lock are there - * [COMPLETED] npm: fix git-prepare - * [COMPLETED] npm: fix auth failure for locked scoped deps - * [COMPLETED] npm: send the user-agent through to pacote - * [COMPLETED] npm: get https://github.com/npm/write-file-atomic/pull/23 merged - * [COMPLETED] npm: get https://github.com/npm/fstream-npm/pull/27 merged - * [COMPLETED] npm: if local deps exist w/o needed metadata, fetch it - * [COMPLETED] Run `prepare` during git tarball packing phase - * [COMPLETED] npm: put npm cache clear behind --force - * [COMPLETED] npm: package-lock.json - * lib/install/read-shrinkwrap.js - * lib/shrinkwrap.js - * lib/install/save.js (?) - * lib/utils/tar.js (add autoignore) - * fstream-npm (add autoignore) - * lib/version.js - * [COMPLETED] npm: --save by default - * [COMPLETED] npm: make sure `npm i ` defaults to package.json - * it only happens for command line arguments - * getAllMetadata - * Apparently, I did this way back when and totally forgot. lol. - * [COMPLETED] make-fetch-happen: make sure other options npm used are implemented - * look at the comment at the bottom of pacote.js - * [COMPLETED] make-fetch-happen: support strictSSL option - * [COMPLETED] Write npm@5 speeds presentation for Friday - * [COMPLETED] pacote: support `opts.fullMetadata` for `pkg.manifest` - * [COMPLETED] npm: fix invalid package: null error - * [COMPLETED] make-fetch-happen: case-insensitive http_proxy/proxy/https_proxy - * [COMPLETED] cacache: integrate cacache@8 into npm/pacote/mfh - * [COMPLETED] make-fetch-happen: literally vendor in node-fetch. sigh. - * basically, the whole tarball situation prevents shrinkwrap. sux :< - * note: solved this by forking node-fetch into node-fetch-npm - * [COMPLETED] pacote: http auth and alwaysAuth - * https://github.com/zkat/pacote/issues/77 - * [COMPLETED] make-fetch-happen: NO_PROXY support - * https://github.com/zkat/make-fetch-happen/issues/17 - * [COMPLETED] npm: calculate sri with ssri and add it to dist.integrity - * [COMPLETED] pacote: refactor handler API - * maybe use Protoduck? - * [COMPLETED] npm: nag Ryan about when sha512 is happening - * He says it's delayed 😭 - * I can still start sending integrity in the publish - * [COMPLETED] npm: fix bundle replacement issues (see: npm i nyc warning spam) - * need fromBundle attribute on shrinkwrap and pass it through. the sw.version && sw.integrity-based fake node needs to have this there. -* Backlog - * [TODO] make-fetch-happen: integrity failures are being thrown - * [TODO] write-file-atomic: review https://github.com/npm/write-file-atomic/pull/22 - * [TODO] pacote: write tests for git handlers - * https://github.com/zkat/pacote/issues/70 - * [TODO] pacote: offline feature support for git deps - * [TODO] npm: get logging working during the recalculateMetadata spam - * [TODO] pacote: opts.extraHeaders - * https://github.com/zkat/pacote/issues/79 - * [TODO] pacote: ECONNRESET recovery - * https://github.com/zkat/pacote/issues/8 - * [TODO] pacote: skip node_modules extraction for non-bundleDeps - * https://github.com/zkat/pacote/issues/49 - * [TODO] pacote: write tests for file/directory handlers - * [TODO] npm: `npm publish --dry-run` -> https://npm.im/pkgfiles ? - * Rebecca says yea - * [TODO] make-fetch-happen: write tests for agent pooling/proxy - * https://github.com/zkat/make-fetch-happen/issues/16 - * [TODO] make-fetch-happen: retry notification - * https://github.com/zkat/make-fetch-happen/issues/21 - * [TODO] npm: more informative logging when building git deps -* Needed for npm@5 -* Active - * [TODO] npm: figure out https://github.com/npm/npm/issues/16665 - * [TODO] npm: first-run notice about npm5 still having known issues diff --git a/deps/npm/bin/npx b/deps/npm/bin/npx new file mode 100644 index 00000000000000..a49c608bab89ba --- /dev/null +++ b/deps/npm/bin/npx @@ -0,0 +1,34 @@ +#!/bin/sh +(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix + +basedir=`dirname "$0"` + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +NODE_EXE="$basedir/node.exe" +if ! [ -x "$NODE_EXE" ]; then + NODE_EXE=node +fi + +NPX_CLI_JS="$basedir/node_modules/npm/bin/npx-cli.js" + +case `uname` in + *MINGW*) + NPM_PREFIX=`"$NODE_EXE" "$NPX_CLI_JS" prefix -g` + NPM_PREFIX_NPX_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npx-cli.js" + if [ -f "$NPM_PREFIX_NPX_CLI_JS" ]; then + NPX_CLI_JS="$NPM_PREFIX_NPX_CLI_JS" + fi + ;; + *CYGWIN*) + NPM_PREFIX=`"$NODE_EXE" "$NPX_CLI_JS" prefix -g` + NPM_PREFIX_NPX_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npx-cli.js" + if [ -f "$NPM_PREFIX_NPX_CLI_JS" ]; then + NPX_CLI_JS="$NPM_PREFIX_NPX_CLI_JS" + fi + ;; +esac + +"$NODE_EXE" "$NPX_CLI_JS" "$@" diff --git a/deps/npm/bin/npx-cli.js b/deps/npm/bin/npx-cli.js new file mode 100755 index 00000000000000..f4043650599d77 --- /dev/null +++ b/deps/npm/bin/npx-cli.js @@ -0,0 +1,8 @@ +#!/usr/bin/env node + +const npx = require('libnpx') +const path = require('path') + +const NPM_PATH = path.join(__dirname, 'npm-cli.js') + +npx(npx.parseArgs(process.argv, NPM_PATH)) diff --git a/deps/npm/bin/npx.cmd b/deps/npm/bin/npx.cmd new file mode 100644 index 00000000000000..02fcbd9ffc2325 --- /dev/null +++ b/deps/npm/bin/npx.cmd @@ -0,0 +1,19 @@ +:: Created by npm, please don't edit manually. +@ECHO OFF + +SETLOCAL + +SET "NODE_EXE=%~dp0\node.exe" +IF NOT EXIST "%NODE_EXE%" ( + SET "NODE_EXE=node" +) + +SET "NPX_CLI_JS=%~dp0\node_modules\npm\bin\npx-cli.js" +FOR /F "delims=" %%F IN ('CALL "%NODE_EXE%" "%NPX_CLI_JS%" prefix -g') DO ( + SET "NPM_PREFIX_NPX_CLI_JS=%%F\node_modules\npm\bin\npx-cli.js" +) +IF EXIST "%NPM_PREFIX_NPX_CLI_JS%" ( + SET "NPX_CLI_JS=%NPM_PREFIX_NPX_CLI_JS%" +) + +"%NODE_EXE%" "%NPX_CLI_JS%" %* diff --git a/deps/npm/doc/cli/npm-config.md b/deps/npm/doc/cli/npm-config.md index 5aecb2c3acbb97..aad9e0dffea90d 100644 --- a/deps/npm/doc/cli/npm-config.md +++ b/deps/npm/doc/cli/npm-config.md @@ -6,7 +6,7 @@ npm-config(1) -- Manage the npm configuration files npm config set [-g|--global] npm config get npm config delete - npm config list + npm config list [-l] npm config edit npm get npm set [-g|--global] @@ -48,7 +48,7 @@ Echo the config value to stdout. npm config list -Show all the config settings. +Show all the config settings. Use `-l` to also show defaults. ### delete diff --git a/deps/npm/doc/cli/npm-install.md b/deps/npm/doc/cli/npm-install.md index 44cb68792bfff7..74e5e04bca4fd6 100644 --- a/deps/npm/doc/cli/npm-install.md +++ b/deps/npm/doc/cli/npm-install.md @@ -343,6 +343,9 @@ being installed. The `--no-shrinkwrap` argument, which will ignore an available package lock or shrinkwrap file and use the package.json instead. +The `--no-package-lock` argument will prevent npm from creating a +`package-lock.json` file. + The `--nodedir=/path/to/node/source` argument will allow npm to find the node source code so that npm can compile native modules. diff --git a/deps/npm/doc/cli/npm-ls.md b/deps/npm/doc/cli/npm-ls.md index 65e8366d467ec2..e665a735c3237e 100644 --- a/deps/npm/doc/cli/npm-ls.md +++ b/deps/npm/doc/cli/npm-ls.md @@ -91,6 +91,13 @@ When "dev" or "development", is an alias to `dev`. When "prod" or "production", is an alias to `production`. +### link + +* Type: Boolean +* Default: false + +Display only dependencies which are linked + ## SEE ALSO * npm-config(1) diff --git a/deps/npm/doc/cli/npm-run-script.md b/deps/npm/doc/cli/npm-run-script.md index f1389c21c623fd..b79d58fb01952c 100644 --- a/deps/npm/doc/cli/npm-run-script.md +++ b/deps/npm/doc/cli/npm-run-script.md @@ -3,7 +3,7 @@ npm-run-script(1) -- Run arbitrary package scripts ## SYNOPSIS - npm run-script [-- ...] + npm run-script [--silent] [-- ...] alias: npm run @@ -50,6 +50,8 @@ not found in the `PATH`. If you try to run a script without having a `node_modules` directory and it fails, you will be given a warning to run `npm install`, just in case you've forgotten. +You can use the `--silent` flag to prevent showing `npm ERR!` output on error. + ## SEE ALSO * npm-scripts(7) diff --git a/deps/npm/doc/cli/npm-uninstall.md b/deps/npm/doc/cli/npm-uninstall.md index e870b23d5ce5c5..38302b20d61fcd 100644 --- a/deps/npm/doc/cli/npm-uninstall.md +++ b/deps/npm/doc/cli/npm-uninstall.md @@ -3,7 +3,7 @@ npm-uninstall(1) -- Remove a package ## SYNOPSIS - npm uninstall [<@scope>/][@]... [-S|--save|-D|--save-dev|-O|--save-optional] + npm uninstall [<@scope>/][@]... [-S|--save|-D|--save-dev|-O|--save-optional|--no-save] aliases: remove, rm, r, un, unlink @@ -28,6 +28,8 @@ the package version in your main package.json: * `-O, --save-optional`: Package will be removed from your `optionalDependencies`. +* `--no-save`: Package will not be removed from your `package.json` file. + Further, if you have an `npm-shrinkwrap.json` then it will be updated as well. @@ -39,6 +41,7 @@ Examples: npm uninstall @myorg/privatepackage --save npm uninstall node-tap --save-dev npm uninstall dtrace-provider --save-optional + npm uninstall lodash --no-save ## SEE ALSO diff --git a/deps/npm/doc/files/npm-folders.md b/deps/npm/doc/files/npm-folders.md index 62ecebc27a3166..74c78834435f92 100644 --- a/deps/npm/doc/files/npm-folders.md +++ b/deps/npm/doc/files/npm-folders.md @@ -20,10 +20,9 @@ This document will tell you what it puts where. ### prefix Configuration The `prefix` config defaults to the location where node is installed. -On most systems, this is `/usr/local`. On windows, this is the exact -location of the node.exe binary. On Unix systems, it's one level up, -since node is typically installed at `{prefix}/bin/node` rather than -`{prefix}/node.exe`. +On most systems, this is `/usr/local`. On Windows, it's `%AppData%\npm`. +On Unix systems, it's one level up, since node is typically installed at +`{prefix}/bin/node` rather than `{prefix}/node.exe`. When the `global` flag is set, npm installs things into this prefix. When it is not set, it uses the root of the current package, or the diff --git a/deps/npm/doc/files/npm-shrinkwrap.json.md b/deps/npm/doc/files/npm-shrinkwrap.json.md index 8256398e86b1a8..541a1f5a6d7656 100644 --- a/deps/npm/doc/files/npm-shrinkwrap.json.md +++ b/deps/npm/doc/files/npm-shrinkwrap.json.md @@ -5,7 +5,7 @@ npm-shrinkwrap.json(5) -- A publishable lockfile `npm-shrinkwrap.json` is a file created by npm-shrinkwrap(1). It is identical to `package-lock.json`, with one major caveat: Unlike `package-lock.json`, -`npm-shrinwkrap.json` may be included when publishing a package. +`npm-shrinkwrap.json` may be included when publishing a package. The recommended use-case for `npm-shrinkwrap.json` is applications deployed through the publishing process on the registry: for example, daemons and @@ -13,7 +13,7 @@ command-line tools intended as global installs or `devDependencies`. It's strongly discouraged for library authors to publish this file, since that would prevent end users from having control over transitive dependency updates. -Additionally, if both `package-lock.json` and `npm-shrinwkrap.json` are present +Additionally, if both `package-lock.json` and `npm-shrinkwrap.json` are present in a package root, `package-lock.json` will be ignored in favor of this file. For full details and description of the `npm-shrinkwrap.json` file format, refer diff --git a/deps/npm/doc/files/package-lock.json.md b/deps/npm/doc/files/package-lock.json.md index f6dde3649237b0..4c134fc229ecb1 100644 --- a/deps/npm/doc/files/package-lock.json.md +++ b/deps/npm/doc/files/package-lock.json.md @@ -127,6 +127,6 @@ The dependencies of this dependency, exactly as at the top level. ## SEE ALSO * npm-shrinkwrap(1) -* package-lock.json(5) +* npm-shrinkwrap.json(5) * package.json(5) * npm-install(1) diff --git a/deps/npm/doc/files/package.json.md b/deps/npm/doc/files/package.json.md index 1a06ff794b6784..1b2b04fe2f97c6 100644 --- a/deps/npm/doc/files/package.json.md +++ b/deps/npm/doc/files/package.json.md @@ -451,18 +451,28 @@ install time. ### Git URLs as Dependencies -Git urls can be of the form: +Git urls are of the form: - git://github.com/user/project.git#commit-ish - git+ssh://user@hostname:project.git#commit-ish - git+ssh://user@hostname/project.git#commit-ish - git+http://user@hostname/project/blah.git#commit-ish - git+https://user@hostname/project/blah.git#commit-ish + ://[[:]@][:][:][/][# | #semver:] -The `commit-ish` can be any tag, sha, or branch which can be supplied as -an argument to `git checkout`. The default is `master`. +`` is one of `git`, `git+ssh`, `git+http`, `git+https`, or +`git+file`. -## GitHub URLs +If `#` is provided, it will be used to clone exactly that +commit. If the commit-ish has the format `#semver:`, `` can +be any valid semver range or exact version, and npm will look for any tags +or refs matching that range in the remote repository, much as it would for a +registry dependency. If neither `#` or `#semver:` is +specified, then `master` is used. + +Examples: + + git+ssh://git@github.com:npm/npm.git#v1.0.27 + git+ssh://git@github.com:npm/npm#semver:^5.0 + git+https://isaacs@github.com/npm/npm.git + git://github.com/npm/npm.git#v1.0.27 + +### GitHub URLs As of version 1.1.65, you can refer to GitHub urls as just "foo": "user/foo-project". Just as with git URLs, a `commit-ish` suffix can be @@ -478,7 +488,7 @@ included. For example: } } -## Local Paths +### Local Paths As of version 2.0.0 you can provide a path to a local directory that contains a package. Local paths can be saved using `npm install -S` or @@ -700,12 +710,11 @@ The host architecture is determined by `process.arch` ## preferGlobal -If your package is primarily a command-line application that should be -installed globally, then set this value to `true` to provide a warning -if it is installed locally. +**DEPRECATED** -It doesn't actually prevent users from installing it locally, but it -does help prevent some confusion if it doesn't work as expected. +This option used to trigger an npm warning, but it will no longer warn. It is +purely there for informational purposes. It is now recommended that you install +any binaries as local devDependencies wherever possible. ## private diff --git a/deps/npm/doc/misc/npm-config.md b/deps/npm/doc/misc/npm-config.md index 6fee98a90c7f9a..dd0993d6bb7958 100644 --- a/deps/npm/doc/misc/npm-config.md +++ b/deps/npm/doc/misc/npm-config.md @@ -9,8 +9,14 @@ npm gets its configuration values from the following sources, sorted by priority Putting `--foo bar` on the command line sets the `foo` configuration parameter to `"bar"`. A `--` argument tells the cli parser to stop -reading flags. A `--flag` parameter that is at the *end* of the -command will be given the value of `true`. +reading flags. Using `--flag` without specifying any value will set +the value to `true`. + +Example: `--flag1 --flag2` will set both configuration parameters +to `true`, while `--flag1 --flag2 bar` will set `flag1` to `true`, +and `flag2` to `bar`. Finally, `--flag1 --flag2 -- bar` will set +both configuration parameters to `true`, and the `bar` is taken +as a command argument. ### Environment Variables @@ -21,7 +27,7 @@ configuration parameter to `bar`. Any environment configurations that are not given a value will be given the value of `true`. Config values are case-insensitive, so `NPM_CONFIG_FOO=bar` will work the same. However, please note that inside [npm-scripts](/misc/scripts) -npm will set it's own environment variables and Node will prefer +npm will set its own environment variables and Node will prefer those lowercase versions over any uppercase ones that you might set. For details see [this issue](https://github.com/npm/npm/issues/14528). @@ -31,9 +37,9 @@ The four relevant files are: * per-project configuration file (`/path/to/my/project/.npmrc`) * per-user configuration file (defaults to `$HOME/.npmrc`; configurable via CLI - option `--userconfig` or environment variable `$NPM_CONF_USERCONFIG`) + option `--userconfig` or environment variable `$NPM_CONFIG_USERCONFIG`) * global configuration file (defaults to `$PREFIX/etc/npmrc`; configurable via - CLI option `--globalconfig` or environment variable `$NPM_CONF_GLOBALCONFIG`) + CLI option `--globalconfig` or environment variable `$NPM_CONFIG_GLOBALCONFIG`) * npm's built-in configuration file (`/path/to/npm/npmrc`) See npmrc(5) for more details. @@ -883,6 +889,13 @@ in to a private registry for the first time: will cause `@organization` to be mapped to the registry for future installation of packages specified according to the pattern `@organization/package`. +### script-shell + +* Default: `null` +* Type: path + +The shell to use for scripts run with the `npm run` command. + ### scripts-prepend-node-path * Default: "warn-only" diff --git a/deps/npm/doc/misc/npm-scripts.md b/deps/npm/doc/misc/npm-scripts.md index 0e9c3bc6e76816..9cdf588397c3ed 100644 --- a/deps/npm/doc/misc/npm-scripts.md +++ b/deps/npm/doc/misc/npm-scripts.md @@ -70,11 +70,6 @@ allow users to avoid the confusing behavior of existing npm versions and only run on `npm publish` (for instance, running the tests one last time to ensure they're in good shape). -**IMPORTANT:** As of `npm@5`, `prepublish` will _only_ be run for `npm -publish`. This will make its behavior identical to `prepublishOnly`, so -`npm@6` or later may drop support for the use of `prepublishOnly`, and then -maybe we can all forget this embarrassing thing ever happened. - See for a much lengthier justification, with further reading, for this change. diff --git a/deps/npm/doc/spec/package-lock.md b/deps/npm/doc/spec/package-lock.md new file mode 100644 index 00000000000000..e7a714113946d4 --- /dev/null +++ b/deps/npm/doc/spec/package-lock.md @@ -0,0 +1,276 @@ +# package-lock and npm-shrinkwrap + +`npm` can have one of two different lock files: + +* `package-lock.json`, which is ordinarily always present and is never published. +* `npm-shrinkwrap.json`, which is created with `npm shrinkwrap` and usually published. + +You can only have one of them and in the event that you have both, +`npm-shrinkwrap.json` takes precedence. The files are exactly the same +format and in fact all the `npm shrinkwrap` command does is rename your +`package-lock.json`. + +Through the rest of this document we will refer to the package-lock and +`package-lock.json` but everything also applies to `npm-shrinkwrap.json`. + +## File Format + +### name + +The name of the package this is a package-lock for. This must match what's in `package.json`. + +### version + +The version of the package this is a package-lock for. This must match what's in `package.json`. + +### lockfileVersion *(new)* + +An integer version, starting at `1` with the version number of this document +whose semantics were used when generating this `package-lock.json`. + +### preserveSymlinks *(new)* + +Indicates that the install was done with the environment variable +`NODE_PRESERVE_SYMLINKS` enabled. The installer should insist that the value of this +property match that environment variable. + +### dependencies + +These are the modules installed in the `node_modules`. Some of these are +dependencies some of these are transitive dependencies (that is, +dependencies of our dependencies). + +This is a mapping of package name to dependency object. Dependency objects have the +following properties: + +#### version *(changed)* + +This is a specifier that uniquely identifies this package and should be +usable in fetching a new copy of it. + +* bundled dependencies: Regardless of source, this is a version number that is purely for informational purposes. +* registry sources: This is a version number. (eg, `1.2.3`) +* git sources: This is a git specifier with resolved committish. (eg, `git+https://example.com/foo/bar#115311855adb0789a0466714ed48a1499ffea97e`) +* http tarball sources: This is the URL of the tarball. (eg, `https://example.com/example-1.3.0.tgz`) +* local tarball sources: This is the file URL of the tarball. (eg `file:///opt/storage/example-1.3.0.tgz`) +* local link sources: This is the file URL of the link. (eg `file:libs/our-module`) + +#### integrity *(new)* + +This is a [Standard Subresource +Integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/) for +this resource. + +* For bundled dependencies this is not included, regardless of source. +* For registry sources, this is the `integrity` that the registry provided, or if one wasn't provided the SHA1 in `shasum`. +* For git sources this is the specific commit hash we cloned from. +* For remote tarball sources this is an integrity based on a SHA512 of + the file. +* For local tarball sources: This is an integrity field based on the SHA512 of the file. + +#### resolved + +* For bundled dependencies this is not included, regardless of source. +* For registry sources this is path of the tarball relative to the registry + URL. If the tarball URL isn't on the same server as the registry URL then + this is a complete URL. + +#### link *(new)* + +If this module was symlinked in development but had semver in the +`package.json` then this is the relative path of that link. + +Discussion of the semantics of this will go in the symlinks RFC. + +Implementation note: To be implemented post npm@5. + +#### bundled *(new)* + +If true, this is the bundled dependency and will be installed by the parent +module. When installing, this module will be extracted from the parent +module during the extract phase, not installed as a separate dependency. + +#### dev + +If true then this dependency is either a development dependency ONLY of the +top level module or a transitive dependency of one. This is false for +dependencies that are both a development dependency of the top level and a +transitive dependency of a non-development dependency of the top level. + +#### optional + +If true then this dependency is either an optional dependency ONLY of the +top level module or a transitive dependency of one. This is false for +dependencies that are both an optional dependency of the top level and a +transitive dependency of a non-optional dependency of the top level. + +All optional dependencies should be included even if they're uninstallable +on the current platform. + +#### from *(deprecated)* + +This is a record of what specifier was used to originally install this +package. This should not be included in new `package-lock.json` files. + +#### requires + +This is a mapping of module name to version. This is a list of everything +this module requires, regardless of where it will be installed. The version +should match via normal matching rules a dependency either in our +`dependencies` or in a level higher than us. + +#### dependencies + +Exactly like `dependencies` at the top level, this is a list of modules to +install in the `node_modules` of this module. + +## Generating + +### `npm init` + +If neither a `package-lock.json` nor an `npm-shrinkwrap.json` exist then +`npm init` will create a `package-lock.json`. This is functionally +equivalent to running `npm shrinkwrap` after the current init completes and +renaming the result to `package-lock.json`. + +### `npm install --save` + +If either an `npm-shrinkwrap.json` or a `package-lock.json` exists then it +will be updated. + +If neither exist then a `package-lock.json` should be generated. + +If a `package.json` does not exist, it should be generated. The generated +`package.json` should be empty, as in: + +``` +{ + "dependencies": { + } +} +``` + +If the user wants to get a default package name/version added they can run `npm init`. + +### `npm shrinkwrap` + +If a `package-lock.json` exists, rename it to `npm-shrinkwrap.json`. +Refresh the data from the installer's ideal tree. + +The top level `name` and `version` come from the `package.json`. It is an +error if either are missing or invalid. + +#### dependencies.dev + +This is `true` if this dependency is ONLY installed to fulfill either a top +level development dependency, or one of its transitive dependencies. + +Given: +``` +B (Dev) → C +``` + +Then both B and C would be `dev: true`. + +Given: +``` +A → B → C +B (Dev) -> C +``` + +Then all dependencies would be `dev: false`. + +#### dependencies.optional + +This is `true` if this dependency is ONLY ever either an optional dependency +or a transitive dependency of optional dependencies. + +Given: +``` +A (Opt) → B → C +``` + +Then all three of A, B and C would be flagged as optional. + +Given: +``` +A (Opt) → B → C +D → C +``` + +Then A and B would be flagged as optional, but C would not be. + +Given: +``` +A (Opt) → B → C +D → A +``` + +Then none would be flagged as optional. + +## Installing + +If the `packageIntegrity` in the `package-lock.json` differs from the one +computed from the `package.json` then places where the `package.json` is +incompatible with the `package-lock.json` a new module should be installed. +That is, while the `package-lock.json` ordinarily defines the state of your +project, if your `package.json` is edited independently it will take +precedence. + +The `package-lock.json` describes the exact tree that `npm` should create. +Any deviation between the `package.json` and the shrinkwrap/lock should +result in a warning be issued. This includes: + +* Modules in `package.json` but missing from the `package-lock.json` +* Modules in the `package-lock.json` but missing from the `package.json`. +* Modules in `package.json` whose specifiers don't match the version in `package-lock.json`. + +Warn if the `lockfileVersion` in the `package-lock.json` is for a different +major version than we implement. + +Module resolution from package-lock data works as such: + +* If install was run with `--resolve-links` and a dependency has a `link` + property then a symlink is made using that. If the version of the + destination can not be matched to the package-lock and/or the package.json + then a warning will be issued. + +* Otherwise, if a `integrity` is available then we try to install it from the cache using it. + +If `integrity` is unavailable or we are unable to locate a module from the `integrity` then: + +* If `lockfileVersion` is set: + * Install using the value of `version` and validate the result against the + `integrity`. +* Otherwise, try these in turn and validate the result against the `integrity`: + * `resolved`, then `from`, then `version. + * `from` can be either `package@specifier` or just `specifier`. + +Regardless of how the module is installed the metadata in the installed +module should be identical to what it would have been if the module were +installed w/o a package-lock. + +## Implied Changes To Other Commands + +### `npm rm --save` + +Currently if you ask to remove a package that's both a direct and a +transitive dependency, we'll remove the package from `node_modules` even if +this results in a broken tree. This was chosen at the time because we felt +that users would expect `npm rm pkgname` to be equivalent of +`rm -rf node_modules/pkgname`. + +As you are no longer going to be allowed to put your `node_modules` in a +state that's not a valid package-lock, this means this behavior is no longer +valid. Instead we should follow normal rules, removing it from the +dependencies for the top level but only removing the module on disk if +nothing requires it any more. + +## Additional fields / Adding new fields + +Installers should ignore any field they aren't aware of. It's not an error +to have additional properities in the package-lock or lock file. + +Installers that want to add new fields should either have one added via RFC +in the npm issue tracker and an accompanying documentation PR, or should prefix +it with the name of their project. diff --git a/deps/npm/html/doc/README.html b/deps/npm/html/doc/README.html index 6668429083910b..437c78dc8ecaeb 100644 --- a/deps/npm/html/doc/README.html +++ b/deps/npm/html/doc/README.html @@ -106,8 +106,9 @@

BUGS

Be sure to include all of the output from the npm command that didn't work as expected. The npm-debug.log file is also helpful to provide.

-

You can also look for isaacs in #node.js on irc://irc.freenode.net. She -will no doubt tell you to put the output in a gist or email.

+

You can also find npm people in #npm on https://package.community/ or +on Twitter. Whoever responds will no +doubt tell you to put the output in a gist or email.

SEE ALSO

  • npm(1)
  • @@ -126,5 +127,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-access.html b/deps/npm/html/doc/cli/npm-access.html index 4fcfc87ccda4ea..4824196bf5932b 100644 --- a/deps/npm/html/doc/cli/npm-access.html +++ b/deps/npm/html/doc/cli/npm-access.html @@ -84,5 +84,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-adduser.html b/deps/npm/html/doc/cli/npm-adduser.html index 905c01acb0d24d..8297188343be97 100644 --- a/deps/npm/html/doc/cli/npm-adduser.html +++ b/deps/npm/html/doc/cli/npm-adduser.html @@ -81,5 +81,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-bin.html b/deps/npm/html/doc/cli/npm-bin.html index 131dff4dd2da70..5baf48529c5114 100644 --- a/deps/npm/html/doc/cli/npm-bin.html +++ b/deps/npm/html/doc/cli/npm-bin.html @@ -35,5 +35,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-bugs.html b/deps/npm/html/doc/cli/npm-bugs.html index e73b582a191f75..65001a407e21f5 100644 --- a/deps/npm/html/doc/cli/npm-bugs.html +++ b/deps/npm/html/doc/cli/npm-bugs.html @@ -55,5 +55,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-build.html b/deps/npm/html/doc/cli/npm-build.html index 99f846f55f2a91..33d0c896c245b4 100644 --- a/deps/npm/html/doc/cli/npm-build.html +++ b/deps/npm/html/doc/cli/npm-build.html @@ -40,5 +40,5 @@

    DESCRIPTION

           - + diff --git a/deps/npm/html/doc/cli/npm-bundle.html b/deps/npm/html/doc/cli/npm-bundle.html index 3898c9c0a8465f..1860157fb8c786 100644 --- a/deps/npm/html/doc/cli/npm-bundle.html +++ b/deps/npm/html/doc/cli/npm-bundle.html @@ -31,5 +31,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-cache.html b/deps/npm/html/doc/cli/npm-cache.html index ff6f6cb556f5a5..de1e4ce51cfc63 100644 --- a/deps/npm/html/doc/cli/npm-cache.html +++ b/deps/npm/html/doc/cli/npm-cache.html @@ -89,5 +89,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-completion.html b/deps/npm/html/doc/cli/npm-completion.html index 9322d0a096cd77..da720731c49a5b 100644 --- a/deps/npm/html/doc/cli/npm-completion.html +++ b/deps/npm/html/doc/cli/npm-completion.html @@ -43,5 +43,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-config.html b/deps/npm/html/doc/cli/npm-config.html index 6d1f6fcc20809b..5eb01b9e7c7aaf 100644 --- a/deps/npm/html/doc/cli/npm-config.html +++ b/deps/npm/html/doc/cli/npm-config.html @@ -14,7 +14,7 @@

    SYNOPSIS

    npm config set <key> <value> [-g|--global]
     npm config get <key>
     npm config delete <key>
    -npm config list
    +npm config list [-l]
     npm config edit
     npm get <key>
     npm set <key> <value> [-g|--global]
    @@ -39,7 +39,7 @@ 

    get

    Echo the config value to stdout.

    list

    npm config list
    -

    Show all the config settings.

    +

    Show all the config settings. Use -l to also show defaults.

    delete

    npm config delete key
     

    Deletes the key from all configuration files.

    @@ -67,5 +67,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-dedupe.html b/deps/npm/html/doc/cli/npm-dedupe.html index 21c85e73b8def2..169c47cb43c693 100644 --- a/deps/npm/html/doc/cli/npm-dedupe.html +++ b/deps/npm/html/doc/cli/npm-dedupe.html @@ -61,5 +61,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-deprecate.html b/deps/npm/html/doc/cli/npm-deprecate.html index 5b3e33d42288cb..c8c0e450649a7b 100644 --- a/deps/npm/html/doc/cli/npm-deprecate.html +++ b/deps/npm/html/doc/cli/npm-deprecate.html @@ -38,5 +38,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-dist-tag.html b/deps/npm/html/doc/cli/npm-dist-tag.html index 1325853d76517f..ec1697d29bb8e9 100644 --- a/deps/npm/html/doc/cli/npm-dist-tag.html +++ b/deps/npm/html/doc/cli/npm-dist-tag.html @@ -86,5 +86,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-docs.html b/deps/npm/html/doc/cli/npm-docs.html index 7100b563c5faa2..1aaae98cef3943 100644 --- a/deps/npm/html/doc/cli/npm-docs.html +++ b/deps/npm/html/doc/cli/npm-docs.html @@ -56,5 +56,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-doctor.html b/deps/npm/html/doc/cli/npm-doctor.html index 41125d789078c4..28408c8eaa5431 100644 --- a/deps/npm/html/doc/cli/npm-doctor.html +++ b/deps/npm/html/doc/cli/npm-doctor.html @@ -103,4 +103,4 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-edit.html b/deps/npm/html/doc/cli/npm-edit.html index b4291160b65839..8de2342143700e 100644 --- a/deps/npm/html/doc/cli/npm-edit.html +++ b/deps/npm/html/doc/cli/npm-edit.html @@ -49,5 +49,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-explore.html b/deps/npm/html/doc/cli/npm-explore.html index 1e5208e496f0bc..83586c58eb2895 100644 --- a/deps/npm/html/doc/cli/npm-explore.html +++ b/deps/npm/html/doc/cli/npm-explore.html @@ -49,5 +49,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-help-search.html b/deps/npm/html/doc/cli/npm-help-search.html index 528e70cbab6e7f..aa5c99f21ac290 100644 --- a/deps/npm/html/doc/cli/npm-help-search.html +++ b/deps/npm/html/doc/cli/npm-help-search.html @@ -45,5 +45,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-help.html b/deps/npm/html/doc/cli/npm-help.html index 5f2a04a159dc2d..bf82b1b6b0496b 100644 --- a/deps/npm/html/doc/cli/npm-help.html +++ b/deps/npm/html/doc/cli/npm-help.html @@ -50,5 +50,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-init.html b/deps/npm/html/doc/cli/npm-init.html index 215fdb40a9e70a..9a1853ad6410b3 100644 --- a/deps/npm/html/doc/cli/npm-init.html +++ b/deps/npm/html/doc/cli/npm-init.html @@ -48,5 +48,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-install-test.html b/deps/npm/html/doc/cli/npm-install-test.html index 83325a82891158..210c21b60f168c 100644 --- a/deps/npm/html/doc/cli/npm-install-test.html +++ b/deps/npm/html/doc/cli/npm-install-test.html @@ -42,5 +42,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-install.html b/deps/npm/html/doc/cli/npm-install.html index b41029e7c99afc..227ad01d2f55e5 100644 --- a/deps/npm/html/doc/cli/npm-install.html +++ b/deps/npm/html/doc/cli/npm-install.html @@ -278,6 +278,8 @@

    SYNOPSIS

    being installed.

    The --no-shrinkwrap argument, which will ignore an available package lock or shrinkwrap file and use the package.json instead.

    +

    The --no-package-lock argument will prevent npm from creating a +package-lock.json file.

    The --nodedir=/path/to/node/source argument will allow npm to find the node source code so that npm can compile native modules.

    The --only={prod[uction]|dev[elopment]} argument will cause either only @@ -365,5 +367,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-link.html b/deps/npm/html/doc/cli/npm-link.html index 54b41d91dcbedf..ed797754f1a740 100644 --- a/deps/npm/html/doc/cli/npm-link.html +++ b/deps/npm/html/doc/cli/npm-link.html @@ -74,5 +74,5 @@

    SYNOPSIS

           - + diff --git a/deps/npm/html/doc/cli/npm-logout.html b/deps/npm/html/doc/cli/npm-logout.html index d3a544534ebaa6..123cf6e6ae942f 100644 --- a/deps/npm/html/doc/cli/npm-logout.html +++ b/deps/npm/html/doc/cli/npm-logout.html @@ -51,5 +51,5 @@

    scope

           - + diff --git a/deps/npm/html/doc/cli/npm-ls.html b/deps/npm/html/doc/cli/npm-ls.html index 500ca033e576ed..7f58b006ef7370 100644 --- a/deps/npm/html/doc/cli/npm-ls.html +++ b/deps/npm/html/doc/cli/npm-ls.html @@ -21,7 +21,7 @@

    SYNOPSIS

    limit the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm's source tree will show:

    -
    npm@5.0.3 /path/to/npm
    +
    npm@5.3.0 /path/to/npm
     └─┬ init-package-json@0.0.4
       └── promzard@0.1.5
     

    It will print out extraneous, missing, and invalid packages.

    @@ -80,6 +80,12 @@

    only

When "dev" or "development", is an alias to dev.

When "prod" or "production", is an alias to production.

+ +
    +
  • Type: Boolean
  • +
  • Default: false
  • +
+

Display only dependencies which are linked

SEE ALSO

  • npm-config(1)
  • @@ -104,5 +110,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-outdated.html b/deps/npm/html/doc/cli/npm-outdated.html index 1c862a8ba7a7e1..b25aaec3d3af19 100644 --- a/deps/npm/html/doc/cli/npm-outdated.html +++ b/deps/npm/html/doc/cli/npm-outdated.html @@ -116,5 +116,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-owner.html b/deps/npm/html/doc/cli/npm-owner.html index e4cc4d7de89d11..7b9980c67c50b4 100644 --- a/deps/npm/html/doc/cli/npm-owner.html +++ b/deps/npm/html/doc/cli/npm-owner.html @@ -51,5 +51,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-pack.html b/deps/npm/html/doc/cli/npm-pack.html index 25982014e3593a..2d66916d8b96df 100644 --- a/deps/npm/html/doc/cli/npm-pack.html +++ b/deps/npm/html/doc/cli/npm-pack.html @@ -41,5 +41,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-ping.html b/deps/npm/html/doc/cli/npm-ping.html index 666ba97c7cefd6..68a5e8574983f4 100644 --- a/deps/npm/html/doc/cli/npm-ping.html +++ b/deps/npm/html/doc/cli/npm-ping.html @@ -32,5 +32,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-prefix.html b/deps/npm/html/doc/cli/npm-prefix.html index 30c3172493f57b..2560340d5e16f7 100644 --- a/deps/npm/html/doc/cli/npm-prefix.html +++ b/deps/npm/html/doc/cli/npm-prefix.html @@ -38,5 +38,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-prune.html b/deps/npm/html/doc/cli/npm-prune.html index 52b2ba78e4ee4e..a7073a9e022a9a 100644 --- a/deps/npm/html/doc/cli/npm-prune.html +++ b/deps/npm/html/doc/cli/npm-prune.html @@ -40,5 +40,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-publish.html b/deps/npm/html/doc/cli/npm-publish.html index 3fca992169342d..2d3b1d1db8bc55 100644 --- a/deps/npm/html/doc/cli/npm-publish.html +++ b/deps/npm/html/doc/cli/npm-publish.html @@ -79,5 +79,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-rebuild.html b/deps/npm/html/doc/cli/npm-rebuild.html index 7ec9923cb8bb63..bc8ee7877132e3 100644 --- a/deps/npm/html/doc/cli/npm-rebuild.html +++ b/deps/npm/html/doc/cli/npm-rebuild.html @@ -35,5 +35,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-repo.html b/deps/npm/html/doc/cli/npm-repo.html index 38990dc8e96f3b..e2ef9ee958a673 100644 --- a/deps/npm/html/doc/cli/npm-repo.html +++ b/deps/npm/html/doc/cli/npm-repo.html @@ -41,5 +41,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-restart.html b/deps/npm/html/doc/cli/npm-restart.html index 6847b24387ce83..a6648c5716ac74 100644 --- a/deps/npm/html/doc/cli/npm-restart.html +++ b/deps/npm/html/doc/cli/npm-restart.html @@ -53,5 +53,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-root.html b/deps/npm/html/doc/cli/npm-root.html index af03619a5d683c..94b59687abf668 100644 --- a/deps/npm/html/doc/cli/npm-root.html +++ b/deps/npm/html/doc/cli/npm-root.html @@ -35,5 +35,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-run-script.html b/deps/npm/html/doc/cli/npm-run-script.html index 2f61d63aece01e..037ad1a64c233d 100644 --- a/deps/npm/html/doc/cli/npm-run-script.html +++ b/deps/npm/html/doc/cli/npm-run-script.html @@ -11,7 +11,7 @@

    npm-run-script

    Run arbitrary package scripts

    SYNOPSIS

    -
    npm run-script <command> [-- <args>...]
    +
    npm run-script <command> [--silent] [-- <args>...]
     
     alias: npm run
     

    DESCRIPTION

    @@ -46,6 +46,7 @@

    SYNOPSIS

    not found in the PATH.

    If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run npm install, just in case you've forgotten.

    +

    You can use the --silent flag to prevent showing npm ERR! output on error.

    SEE ALSO

    • npm-scripts(7)
    • @@ -66,5 +67,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-search.html b/deps/npm/html/doc/cli/npm-search.html index cc95846328a2e4..e136612e961c6b 100644 --- a/deps/npm/html/doc/cli/npm-search.html +++ b/deps/npm/html/doc/cli/npm-search.html @@ -109,5 +109,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-shrinkwrap.html b/deps/npm/html/doc/cli/npm-shrinkwrap.html index 44388546d8a2c4..c68795a33fa9e6 100644 --- a/deps/npm/html/doc/cli/npm-shrinkwrap.html +++ b/deps/npm/html/doc/cli/npm-shrinkwrap.html @@ -41,5 +41,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-star.html b/deps/npm/html/doc/cli/npm-star.html index aacae893619a59..7f16258c099b58 100644 --- a/deps/npm/html/doc/cli/npm-star.html +++ b/deps/npm/html/doc/cli/npm-star.html @@ -36,5 +36,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-stars.html b/deps/npm/html/doc/cli/npm-stars.html index 8252aa8f21ae80..cac0603d220e27 100644 --- a/deps/npm/html/doc/cli/npm-stars.html +++ b/deps/npm/html/doc/cli/npm-stars.html @@ -36,5 +36,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-start.html b/deps/npm/html/doc/cli/npm-start.html index 8c8dd3bb39d16e..03226273786ae5 100644 --- a/deps/npm/html/doc/cli/npm-start.html +++ b/deps/npm/html/doc/cli/npm-start.html @@ -39,5 +39,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-stop.html b/deps/npm/html/doc/cli/npm-stop.html index b55a285de775fa..ac2e46f74a9746 100644 --- a/deps/npm/html/doc/cli/npm-stop.html +++ b/deps/npm/html/doc/cli/npm-stop.html @@ -34,5 +34,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-team.html b/deps/npm/html/doc/cli/npm-team.html index 8bf5fdea1ed99b..a80d86c3ada61f 100644 --- a/deps/npm/html/doc/cli/npm-team.html +++ b/deps/npm/html/doc/cli/npm-team.html @@ -67,5 +67,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-test.html b/deps/npm/html/doc/cli/npm-test.html index e099df218cb603..ecbbc74b9ac819 100644 --- a/deps/npm/html/doc/cli/npm-test.html +++ b/deps/npm/html/doc/cli/npm-test.html @@ -36,5 +36,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-uninstall.html b/deps/npm/html/doc/cli/npm-uninstall.html index 37bb0bd71f771d..5e60ae30385139 100644 --- a/deps/npm/html/doc/cli/npm-uninstall.html +++ b/deps/npm/html/doc/cli/npm-uninstall.html @@ -11,7 +11,7 @@

      npm-uninstall

      Remove a package

      SYNOPSIS

      -
      npm uninstall [<@scope>/]<pkg>[@<version>]... [-S|--save|-D|--save-dev|-O|--save-optional]
      +
      npm uninstall [<@scope>/]<pkg>[@<version>]... [-S|--save|-D|--save-dev|-O|--save-optional|--no-save]
       
       aliases: remove, rm, r, un, unlink
       

      DESCRIPTION

      @@ -30,6 +30,8 @@

      SYNOPSIS

    • -O, --save-optional: Package will be removed from your optionalDependencies.

    • +
    • --no-save: Package will not be removed from your package.json file.

      +

    Further, if you have an npm-shrinkwrap.json then it will be updated as well.

    @@ -39,6 +41,7 @@

    SYNOPSIS

    npm uninstall @myorg/privatepackage --save npm uninstall node-tap --save-dev npm uninstall dtrace-provider --save-optional +npm uninstall lodash --no-save

    SEE ALSO

    • npm-prune(1)
    • @@ -60,5 +63,5 @@

      SYNOPSIS

             - + diff --git a/deps/npm/html/doc/cli/npm-unpublish.html b/deps/npm/html/doc/cli/npm-unpublish.html index 36d0d328616187..220efe599a5fe3 100644 --- a/deps/npm/html/doc/cli/npm-unpublish.html +++ b/deps/npm/html/doc/cli/npm-unpublish.html @@ -51,5 +51,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-update.html b/deps/npm/html/doc/cli/npm-update.html index 197aa41870f128..471db2baba31c6 100644 --- a/deps/npm/html/doc/cli/npm-update.html +++ b/deps/npm/html/doc/cli/npm-update.html @@ -118,5 +118,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-version.html b/deps/npm/html/doc/cli/npm-version.html index bc29ed75ac1b90..e821d71fc6779a 100644 --- a/deps/npm/html/doc/cli/npm-version.html +++ b/deps/npm/html/doc/cli/npm-version.html @@ -114,5 +114,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-view.html b/deps/npm/html/doc/cli/npm-view.html index 70bf31e435975a..9d30ff9031912a 100644 --- a/deps/npm/html/doc/cli/npm-view.html +++ b/deps/npm/html/doc/cli/npm-view.html @@ -86,5 +86,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-whoami.html b/deps/npm/html/doc/cli/npm-whoami.html index 8f84bc8ab62e5b..9c8b91e4d57243 100644 --- a/deps/npm/html/doc/cli/npm-whoami.html +++ b/deps/npm/html/doc/cli/npm-whoami.html @@ -33,5 +33,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm.html b/deps/npm/html/doc/cli/npm.html index 4e4d97b2350736..06414eebab5d37 100644 --- a/deps/npm/html/doc/cli/npm.html +++ b/deps/npm/html/doc/cli/npm.html @@ -13,7 +13,7 @@

      npm

      javascript package manager

      SYNOPSIS

      npm <command> [args]
       

      VERSION

      -

      5.0.3

      +

      5.3.0

      DESCRIPTION

      npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency @@ -126,7 +126,7 @@

      AUTHOR

      Isaac Z. Schlueter :: isaacs :: @izs :: -i@izs.me

      +i@izs.me

      SEE ALSO

      • npm-help(1)
      • @@ -150,5 +150,5 @@

        SEE ALSO

               - + diff --git a/deps/npm/html/doc/files/npm-folders.html b/deps/npm/html/doc/files/npm-folders.html index 300df680e1afb2..915750606cecda 100644 --- a/deps/npm/html/doc/files/npm-folders.html +++ b/deps/npm/html/doc/files/npm-folders.html @@ -25,10 +25,9 @@

        tl;dr

      prefix Configuration

      The prefix config defaults to the location where node is installed. -On most systems, this is /usr/local. On windows, this is the exact -location of the node.exe binary. On Unix systems, it's one level up, -since node is typically installed at {prefix}/bin/node rather than -{prefix}/node.exe.

      +On most systems, this is /usr/local. On Windows, it's %AppData%\npm. +On Unix systems, it's one level up, since node is typically installed at +{prefix}/bin/node rather than {prefix}/node.exe.

      When the global flag is set, npm installs things into this prefix. When it is not set, it uses the root of the current package, or the current working directory if not in a package already.

      @@ -182,5 +181,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/files/npm-global.html b/deps/npm/html/doc/files/npm-global.html index 300df680e1afb2..915750606cecda 100644 --- a/deps/npm/html/doc/files/npm-global.html +++ b/deps/npm/html/doc/files/npm-global.html @@ -25,10 +25,9 @@

      tl;dr

    prefix Configuration

    The prefix config defaults to the location where node is installed. -On most systems, this is /usr/local. On windows, this is the exact -location of the node.exe binary. On Unix systems, it's one level up, -since node is typically installed at {prefix}/bin/node rather than -{prefix}/node.exe.

    +On most systems, this is /usr/local. On Windows, it's %AppData%\npm. +On Unix systems, it's one level up, since node is typically installed at +{prefix}/bin/node rather than {prefix}/node.exe.

    When the global flag is set, npm installs things into this prefix. When it is not set, it uses the root of the current package, or the current working directory if not in a package already.

    @@ -182,5 +181,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npm-json.html b/deps/npm/html/doc/files/npm-json.html index e0f2df86f29360..6374cc5a7d7882 100644 --- a/deps/npm/html/doc/files/npm-json.html +++ b/deps/npm/html/doc/files/npm-json.html @@ -342,15 +342,22 @@

    dependencies

    This tarball will be downloaded and installed locally to your package at install time.

    Git URLs as Dependencies

    -

    Git urls can be of the form:

    -
    git://github.com/user/project.git#commit-ish
    -git+ssh://user@hostname:project.git#commit-ish
    -git+ssh://user@hostname/project.git#commit-ish
    -git+http://user@hostname/project/blah.git#commit-ish
    -git+https://user@hostname/project/blah.git#commit-ish
    -

    The commit-ish can be any tag, sha, or branch which can be supplied as -an argument to git checkout. The default is master.

    -

    GitHub URLs

    +

    Git urls are of the form:

    +
    <protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish> | #semver:<semver>]
    +

    <protocol> is one of git, git+ssh, git+http, git+https, or +git+file.

    +

    If #<commit-ish> is provided, it will be used to clone exactly that +commit. If the commit-ish has the format #semver:<semver>, <semver> can +be any valid semver range or exact version, and npm will look for any tags +or refs matching that range in the remote repository, much as it would for a +registry dependency. If neither #<commit-ish> or #semver:<semver> is +specified, then master is used.

    +

    Examples:

    +
    git+ssh://git@github.com:npm/npm.git#v1.0.27
    +git+ssh://git@github.com:npm/npm#semver:^5.0
    +git+https://isaacs@github.com/npm/npm.git
    +git://github.com/npm/npm.git#v1.0.27
    +

    GitHub URLs

    As of version 1.1.65, you can refer to GitHub urls as just "foo": "user/foo-project". Just as with git URLs, a commit-ish suffix can be included. For example:

    @@ -363,7 +370,7 @@

    GitHub URLs

    "module": "user/repo#feature\/branch" } } -

    Local Paths

    +

    Local Paths

    As of version 2.0.0 you can provide a path to a local directory that contains a package. Local paths can be saved using npm install -S or npm install --save, using any of these forms:

    @@ -523,11 +530,10 @@

    cpu

    "cpu" : [ "!arm", "!mips" ]
     

    The host architecture is determined by process.arch

    preferGlobal

    -

    If your package is primarily a command-line application that should be -installed globally, then set this value to true to provide a warning -if it is installed locally.

    -

    It doesn't actually prevent users from installing it locally, but it -does help prevent some confusion if it doesn't work as expected.

    +

    DEPRECATED

    +

    This option used to trigger an npm warning, but it will no longer warn. It is +purely there for informational purposes. It is now recommended that you install +any binaries as local devDependencies wherever possible.

    private

    If you set "private": true in your package.json, then npm will refuse to publish it.

    @@ -587,5 +593,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npm-package-locks.html b/deps/npm/html/doc/files/npm-package-locks.html index 56bf73fbf86e6a..21029d3a9dd74c 100644 --- a/deps/npm/html/doc/files/npm-package-locks.html +++ b/deps/npm/html/doc/files/npm-package-locks.html @@ -145,4 +145,4 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npm-shrinkwrap.json.html b/deps/npm/html/doc/files/npm-shrinkwrap.json.html index 1437a6807ee6f6..9fdb543984ed7c 100644 --- a/deps/npm/html/doc/files/npm-shrinkwrap.json.html +++ b/deps/npm/html/doc/files/npm-shrinkwrap.json.html @@ -13,13 +13,13 @@

    npm-shrinkwrap.json

    DESCRIPTION

    npm-shrinkwrap.json is a file created by npm-shrinkwrap(1). It is identical to package-lock.json, with one major caveat: Unlike package-lock.json, -npm-shrinwkrap.json may be included when publishing a package.

    +npm-shrinkwrap.json may be included when publishing a package.

    The recommended use-case for npm-shrinkwrap.json is applications deployed through the publishing process on the registry: for example, daemons and command-line tools intended as global installs or devDependencies. It's strongly discouraged for library authors to publish this file, since that would prevent end users from having control over transitive dependency updates.

    -

    Additionally, if both package-lock.json and npm-shrinwkrap.json are present +

    Additionally, if both package-lock.json and npm-shrinkwrap.json are present in a package root, package-lock.json will be ignored in favor of this file.

    For full details and description of the npm-shrinkwrap.json file format, refer to the manual page for package-lock.json(5).

    @@ -42,4 +42,4 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npmrc.html b/deps/npm/html/doc/files/npmrc.html index 9dd6e18b10c0e6..8fe8746efbc1b0 100644 --- a/deps/npm/html/doc/files/npmrc.html +++ b/deps/npm/html/doc/files/npmrc.html @@ -85,5 +85,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/package-lock.json.html b/deps/npm/html/doc/files/package-lock.json.html index ea9439e8418ee2..3290c365da78e6 100644 --- a/deps/npm/html/doc/files/package-lock.json.html +++ b/deps/npm/html/doc/files/package-lock.json.html @@ -108,7 +108,7 @@

    dependencies

    SEE ALSO

    @@ -124,4 +124,4 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/package.json.html b/deps/npm/html/doc/files/package.json.html index e0f2df86f29360..6374cc5a7d7882 100644 --- a/deps/npm/html/doc/files/package.json.html +++ b/deps/npm/html/doc/files/package.json.html @@ -342,15 +342,22 @@

    dependencies

    This tarball will be downloaded and installed locally to your package at install time.

    Git URLs as Dependencies

    -

    Git urls can be of the form:

    -
    git://github.com/user/project.git#commit-ish
    -git+ssh://user@hostname:project.git#commit-ish
    -git+ssh://user@hostname/project.git#commit-ish
    -git+http://user@hostname/project/blah.git#commit-ish
    -git+https://user@hostname/project/blah.git#commit-ish
    -

    The commit-ish can be any tag, sha, or branch which can be supplied as -an argument to git checkout. The default is master.

    -

    GitHub URLs

    +

    Git urls are of the form:

    +
    <protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish> | #semver:<semver>]
    +

    <protocol> is one of git, git+ssh, git+http, git+https, or +git+file.

    +

    If #<commit-ish> is provided, it will be used to clone exactly that +commit. If the commit-ish has the format #semver:<semver>, <semver> can +be any valid semver range or exact version, and npm will look for any tags +or refs matching that range in the remote repository, much as it would for a +registry dependency. If neither #<commit-ish> or #semver:<semver> is +specified, then master is used.

    +

    Examples:

    +
    git+ssh://git@github.com:npm/npm.git#v1.0.27
    +git+ssh://git@github.com:npm/npm#semver:^5.0
    +git+https://isaacs@github.com/npm/npm.git
    +git://github.com/npm/npm.git#v1.0.27
    +

    GitHub URLs

    As of version 1.1.65, you can refer to GitHub urls as just "foo": "user/foo-project". Just as with git URLs, a commit-ish suffix can be included. For example:

    @@ -363,7 +370,7 @@

    GitHub URLs

    "module": "user/repo#feature\/branch" } } -

    Local Paths

    +

    Local Paths

    As of version 2.0.0 you can provide a path to a local directory that contains a package. Local paths can be saved using npm install -S or npm install --save, using any of these forms:

    @@ -523,11 +530,10 @@

    cpu

    "cpu" : [ "!arm", "!mips" ]
     

    The host architecture is determined by process.arch

    preferGlobal

    -

    If your package is primarily a command-line application that should be -installed globally, then set this value to true to provide a warning -if it is installed locally.

    -

    It doesn't actually prevent users from installing it locally, but it -does help prevent some confusion if it doesn't work as expected.

    +

    DEPRECATED

    +

    This option used to trigger an npm warning, but it will no longer warn. It is +purely there for informational purposes. It is now recommended that you install +any binaries as local devDependencies wherever possible.

    private

    If you set "private": true in your package.json, then npm will refuse to publish it.

    @@ -587,5 +593,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/index.html b/deps/npm/html/doc/index.html index 9e300e85bf23b6..5976e6cf5a09d8 100644 --- a/deps/npm/html/doc/index.html +++ b/deps/npm/html/doc/index.html @@ -168,5 +168,5 @@

    semver(7)

           - + diff --git a/deps/npm/html/doc/misc/npm-coding-style.html b/deps/npm/html/doc/misc/npm-coding-style.html index 081d89f4945cff..4c038f9d1cce37 100644 --- a/deps/npm/html/doc/misc/npm-coding-style.html +++ b/deps/npm/html/doc/misc/npm-coding-style.html @@ -153,5 +153,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-config.html b/deps/npm/html/doc/misc/npm-config.html index c6fc5cad3cb289..68548cb08efcd2 100644 --- a/deps/npm/html/doc/misc/npm-config.html +++ b/deps/npm/html/doc/misc/npm-config.html @@ -15,8 +15,13 @@

    DESCRIPTION

    Command Line Flags

    Putting --foo bar on the command line sets the foo configuration parameter to "bar". A -- argument tells the cli parser to stop -reading flags. A --flag parameter that is at the end of the -command will be given the value of true.

    +reading flags. Using --flag without specifying any value will set +the value to true.

    +

    Example: --flag1 --flag2 will set both configuration parameters +to true, while --flag1 --flag2 bar will set flag1 to true, +and flag2 to bar. Finally, --flag1 --flag2 -- bar will set +both configuration parameters to true, and the bar is taken +as a command argument.

    Environment Variables

    Any environment variables that start with npm_config_ will be interpreted as a configuration parameter. For example, putting @@ -25,7 +30,7 @@

    Environment Variables

    are not given a value will be given the value of true. Config values are case-insensitive, so NPM_CONFIG_FOO=bar will work the same. However, please note that inside npm-scripts -npm will set it's own environment variables and Node will prefer +npm will set its own environment variables and Node will prefer those lowercase versions over any uppercase ones that you might set. For details see this issue.

    npmrc Files

    @@ -33,9 +38,9 @@

    npmrc Files

    • per-project configuration file (/path/to/my/project/.npmrc)
    • per-user configuration file (defaults to $HOME/.npmrc; configurable via CLI -option --userconfig or environment variable $NPM_CONF_USERCONFIG)
    • +option --userconfig or environment variable $NPM_CONFIG_USERCONFIG)
    • global configuration file (defaults to $PREFIX/etc/npmrc; configurable via -CLI option --globalconfig or environment variable $NPM_CONF_GLOBALCONFIG)
    • +CLI option --globalconfig or environment variable $NPM_CONFIG_GLOBALCONFIG)
    • npm's built-in configuration file (/path/to/npm/npmrc)

    See npmrc(5) for more details.

    @@ -756,6 +761,12 @@

    scope

    npm login --scope=@organization --registry=registry.organization.com, which will cause @organization to be mapped to the registry for future installation of packages specified according to the pattern @organization/package.

    +

    script-shell

    +
      +
    • Default: null
    • +
    • Type: path
    • +
    +

    The shell to use for scripts run with the npm run command.

    scripts-prepend-node-path

    • Default: "warn-only"
    • @@ -981,5 +992,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/misc/npm-developers.html b/deps/npm/html/doc/misc/npm-developers.html index 7d27bd2bc19724..39cc446723e976 100644 --- a/deps/npm/html/doc/misc/npm-developers.html +++ b/deps/npm/html/doc/misc/npm-developers.html @@ -194,5 +194,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/misc/npm-disputes.html b/deps/npm/html/doc/misc/npm-disputes.html index 351539c60b87a7..c586bb9253ef1f 100644 --- a/deps/npm/html/doc/misc/npm-disputes.html +++ b/deps/npm/html/doc/misc/npm-disputes.html @@ -20,7 +20,7 @@

      npm-disputes

      Handling Module

      TL;DR

      1. Get the author email with npm owner ls <pkgname>
      2. -
      3. Email the author, CC support@npmjs.com
      4. +
      5. Email the author, CC support@npmjs.com
      6. After a few weeks, if there's no resolution, we'll sort it out.

      Don't squat on package names. Publish code or move out of the way.

      @@ -55,12 +55,12 @@

      DESCRIPTION

    • Alice emails Yusuf, explaining the situation as respectfully as possible, and what she would like to do with the module name. She adds the npm support -staff support@npmjs.com to the CC list of the email. Mention in the email +staff support@npmjs.com to the CC list of the email. Mention in the email that Yusuf can run npm owner add alice foo to add Alice as an owner of the foo package.
    • After a reasonable amount of time, if Yusuf has not responded, or if Yusuf and Alice can't come to any sort of resolution, email support -support@npmjs.com and we'll sort it out. ("Reasonable" is usually at least +support@npmjs.com and we'll sort it out. ("Reasonable" is usually at least 4 weeks.)
    • REASONING

      @@ -96,12 +96,12 @@

      EXCEPTIONS

      Code of Conduct such as hateful language, pornographic content, or harassment. -

      If you see bad behavior like this, please report it to abuse@npmjs.com right +

      If you see bad behavior like this, please report it to abuse@npmjs.com right away. You are never expected to resolve abusive behavior on your own. We are here to help.

      TRADEMARKS

      If you think another npm publisher is infringing your trademark, such as by -using a confusingly similar package name, email abuse@npmjs.com with a link to +using a confusingly similar package name, email abuse@npmjs.com with a link to the package or user account on https://npmjs.com. Attach a copy of your trademark registration certificate.

      If we see that the package's publisher is intentionally misleading others by @@ -134,5 +134,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/misc/npm-index.html b/deps/npm/html/doc/misc/npm-index.html index 4888d872841e05..96d9dbfc4dea70 100644 --- a/deps/npm/html/doc/misc/npm-index.html +++ b/deps/npm/html/doc/misc/npm-index.html @@ -168,5 +168,5 @@

      semver(7)

             - + diff --git a/deps/npm/html/doc/misc/npm-orgs.html b/deps/npm/html/doc/misc/npm-orgs.html index f3aab6e8517a29..cdd7d2c354a037 100644 --- a/deps/npm/html/doc/misc/npm-orgs.html +++ b/deps/npm/html/doc/misc/npm-orgs.html @@ -86,5 +86,5 @@

      Team Admins create teams

             - + diff --git a/deps/npm/html/doc/misc/npm-registry.html b/deps/npm/html/doc/misc/npm-registry.html index 7c6445b4cf4a18..6fd2e728ac949c 100644 --- a/deps/npm/html/doc/misc/npm-registry.html +++ b/deps/npm/html/doc/misc/npm-registry.html @@ -90,5 +90,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/misc/npm-scope.html b/deps/npm/html/doc/misc/npm-scope.html index 98595501fad131..484e6c1c33e470 100644 --- a/deps/npm/html/doc/misc/npm-scope.html +++ b/deps/npm/html/doc/misc/npm-scope.html @@ -99,5 +99,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/misc/npm-scripts.html b/deps/npm/html/doc/misc/npm-scripts.html index ea3ecc321d8145..46a126d8f64cd4 100644 --- a/deps/npm/html/doc/misc/npm-scripts.html +++ b/deps/npm/html/doc/misc/npm-scripts.html @@ -74,10 +74,6 @@

      DEPRECATION NOTE

      allow users to avoid the confusing behavior of existing npm versions and only run on npm publish (for instance, running the tests one last time to ensure they're in good shape).

      -

      IMPORTANT: As of npm@5, prepublish will only be run for npm -publish. This will make its behavior identical to prepublishOnly, so -npm@6 or later may drop support for the use of prepublishOnly, and then -maybe we can all forget this embarrassing thing ever happened.

      See https://github.com/npm/npm/issues/10074 for a much lengthier justification, with further reading, for this change.

      USE CASES

      @@ -243,5 +239,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/misc/removing-npm.html b/deps/npm/html/doc/misc/removing-npm.html index 98404d073c88ad..2bfd2a513ca8a2 100644 --- a/deps/npm/html/doc/misc/removing-npm.html +++ b/deps/npm/html/doc/misc/removing-npm.html @@ -57,5 +57,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/misc/semver.html b/deps/npm/html/doc/misc/semver.html index 44c208b217d82c..e97c70afcbf730 100644 --- a/deps/npm/html/doc/misc/semver.html +++ b/deps/npm/html/doc/misc/semver.html @@ -325,5 +325,5 @@

      Ranges

             - + diff --git a/deps/npm/lib/build.js b/deps/npm/lib/build.js index c2acc0066235e2..44ac40a00708b5 100644 --- a/deps/npm/lib/build.js +++ b/deps/npm/lib/build.js @@ -43,14 +43,23 @@ function build (args, global, didPre, didRB, cb) { global = npm.config.get('global') } - // it'd be nice to asyncMap these, but actually, doing them - // in parallel generally munges up the output from node-waf - var builder = build_(global, didPre, didRB) - chain(args.map(function (arg) { - return function (cb) { - builder(arg, cb) - } - }), cb) + if (!args.length) { + readJson(path.resolve(npm.localPrefix, 'package.json'), function (er, pkg) { + if (!args.length && pkg && pkg.scripts && pkg.scripts.build) { + log.warn('build', '`npm build` called with no arguments. Did you mean to `npm run-script build`?') + } + cb() + }) + } else { + // it'd be nice to asyncMap these, but actually, doing them + // in parallel generally munges up the output from node-waf + var builder = build_(global, didPre, didRB) + chain(args.map(function (arg) { + return function (cb) { + builder(arg, cb) + } + }), cb) + } } function build_ (global, didPre, didRB) { @@ -108,44 +117,15 @@ var linkStuff = build.linkStuff = function (pkg, folder, global, didRB, cb) { if (gnm) log.silly('linkStuff', packageId(pkg), 'is installed into a global node_modules') if (gtop) log.silly('linkStuff', packageId(pkg), 'is installed into the top-level global node_modules') - shouldWarn(pkg, folder, global, function () { - asyncMap( - [linkBins, linkMans, !didRB && rebuildBundles], - function (fn, cb) { - if (!fn) return cb() - log.verbose(fn.name, packageId(pkg)) - fn(pkg, folder, parent, gtop, cb) - }, - cb - ) - }) -} - -function shouldWarn (pkg, folder, global, cb) { - var parent = path.dirname(folder) - var top = parent === npm.dir - var cwd = npm.localPrefix - - readJson(path.resolve(cwd, 'package.json'), function (er, topPkg) { - if (er) return cb(er) - - var linkedPkg = path.basename(cwd) - var currentPkg = path.basename(folder) - - // current searched package is the linked package on first call - if (linkedPkg !== currentPkg) { - // don't generate a warning if it's listed in dependencies - if (Object.keys(topPkg.dependencies || {}) - .concat(Object.keys(topPkg.devDependencies || {})) - .indexOf(currentPkg) === -1) { - if (top && pkg.preferGlobal && !global) { - log.warn('prefer global', packageId(pkg) + ' should be installed with -g') - } - } - } - - cb() - }) + asyncMap( + [linkBins, linkMans, !didRB && rebuildBundles], + function (fn, cb) { + if (!fn) return cb() + log.verbose(fn.name, packageId(pkg)) + fn(pkg, folder, parent, gtop, cb) + }, + cb + ) } function rebuildBundles (pkg, folder, parent, gtop, cb) { diff --git a/deps/npm/lib/config/cmd-list.js b/deps/npm/lib/config/cmd-list.js index c54d105247f224..f2d5fab17dfeea 100644 --- a/deps/npm/lib/config/cmd-list.js +++ b/deps/npm/lib/config/cmd-list.js @@ -1,5 +1,3 @@ -var extend = Object.assign || require('util')._extend - // short names for common things var shorthands = { 'un': 'uninstall', @@ -29,6 +27,7 @@ var affordances = { 'apihelp': 'help', 'find-dupes': 'dedupe', 'upgrade': 'update', + 'udpate': 'update', 'login': 'adduser', 'add-user': 'adduser', 'author': 'owner', @@ -41,7 +40,8 @@ var affordances = { 'unlink': 'uninstall', 'remove': 'uninstall', 'rm': 'uninstall', - 'r': 'uninstall' + 'r': 'uninstall', + 'rum': 'run-script' } // these are filenames in . @@ -110,7 +110,7 @@ var plumbing = [ 'substack', 'visnup' ] -module.exports.aliases = extend(extend({}, shorthands), affordances) +module.exports.aliases = Object.assign({}, shorthands, affordances) module.exports.shorthands = shorthands module.exports.affordances = affordances module.exports.cmdList = cmdList diff --git a/deps/npm/lib/config/defaults.js b/deps/npm/lib/config/defaults.js index da019ac4d6d196..93bac84a6108f9 100644 --- a/deps/npm/lib/config/defaults.js +++ b/deps/npm/lib/config/defaults.js @@ -203,6 +203,7 @@ Object.defineProperty(exports, 'defaults', {get: function () { 'save-prefix': '^', 'save-prod': false, scope: '', + 'script-shell': null, 'scripts-prepend-node-path': 'warn-only', searchopts: '', searchexclude: null, @@ -326,6 +327,7 @@ exports.types = { 'save-prefix': String, 'save-prod': Boolean, scope: String, + 'script-shell': [null, String], 'scripts-prepend-node-path': [false, true, 'auto', 'warn-only'], searchopts: String, searchexclude: [null, String], diff --git a/deps/npm/lib/config/get-credentials-by-uri.js b/deps/npm/lib/config/get-credentials-by-uri.js index 19779c41372cf4..d04f6137de9ba1 100644 --- a/deps/npm/lib/config/get-credentials-by-uri.js +++ b/deps/npm/lib/config/get-credentials-by-uri.js @@ -36,8 +36,6 @@ function getCredentialsByURI (uri) { // Handle the old-style _auth= style for the default // registry, if set. - // - // XXX(isaacs): Remove when npm 1.4 is no longer relevant var authDef = this.get('_auth') var userDef = this.get('username') var passDef = this.get('_password') diff --git a/deps/npm/lib/config/pacote.js b/deps/npm/lib/config/pacote.js index 2d2dda59fa3ee2..ec43178c7727dd 100644 --- a/deps/npm/lib/config/pacote.js +++ b/deps/npm/lib/config/pacote.js @@ -47,40 +47,63 @@ function pacoteOpts (moreOpts) { }, scope: npm.config.get('scope'), strictSSL: npm.config.get('strict-ssl'), - userAgent: npm.config.get('user-agent') + userAgent: npm.config.get('user-agent'), + + dmode: npm.modes.exec, + fmode: npm.modes.file, + umask: npm.modes.umask } - if (ownerStats.uid || ownerStats.gid) { + if (ownerStats.uid != null || ownerStats.gid != null) { Object.assign(opts, ownerStats) } npm.config.keys.forEach(function (k) { - const authMatch = k[0] === '/' && k.match( - /(.*):(_authToken|username|_password|password|email|always-auth)$/ + const authMatchGlobal = k.match( + /^(_authToken|username|_password|password|email|always-auth|_auth)$/ + ) + const authMatchScoped = k[0] === '/' && k.match( + /(.*):(_authToken|username|_password|password|email|always-auth|_auth)$/ ) - if (authMatch) { - const nerfDart = authMatch[1] - const key = authMatch[2] - const val = npm.config.get(k) + + // if it matches scoped it will also match global + if (authMatchGlobal || authMatchScoped) { + let nerfDart = null + let key = null + let val = null + if (!opts.auth) { opts.auth = {} } - if (!opts.auth[nerfDart]) { - opts.auth[nerfDart] = { - alwaysAuth: !!npm.config.get('always-auth') + + if (authMatchScoped) { + nerfDart = authMatchScoped[1] + key = authMatchScoped[2] + val = npm.config.get(k) + if (!opts.auth[nerfDart]) { + opts.auth[nerfDart] = { + alwaysAuth: !!npm.config.get('always-auth') + } } + } else { + key = authMatchGlobal[1] + val = npm.config.get(k) + opts.auth.alwaysAuth = !!npm.config.get('always-auth') } + + const auth = authMatchScoped ? opts.auth[nerfDart] : opts.auth if (key === '_authToken') { - opts.auth[nerfDart].token = val + auth.token = val } else if (key.match(/password$/i)) { - opts.auth[nerfDart].password = + auth.password = // the config file stores password auth already-encoded. pacote expects // the actual username/password pair. Buffer.from(val, 'base64').toString('utf8') } else if (key === 'always-auth') { - opts.auth[nerfDart].alwaysAuth = val === 'false' ? false : !!val + auth.alwaysAuth = val === 'false' ? false : !!val } else { - opts.auth[nerfDart][key] = val + auth[key] = val } } + if (k[0] === '@') { if (!opts.scopeTargets) { opts.scopeTargets = {} } opts.scopeTargets[k.replace(/:registry$/, '')] = npm.config.get(k) diff --git a/deps/npm/lib/dedupe.js b/deps/npm/lib/dedupe.js index ded309c21ac7e5..71e60619c4f1b7 100644 --- a/deps/npm/lib/dedupe.js +++ b/deps/npm/lib/dedupe.js @@ -112,12 +112,12 @@ function moveRemainingChildren (node, diff) { } function remove (child, diff, done) { - remove_(child, diff, {}, done) + remove_(child, diff, new Set(), done) } function remove_ (child, diff, seen, done) { - if (seen[child.path]) return done() - seen[child.path] = true + if (seen.has(child)) return done() + seen.add(child) diff.push(['remove', child]) child.parent.children = without(child.parent.children, child) asyncMap(child.children, function (child, next) { @@ -126,13 +126,13 @@ function remove_ (child, diff, seen, done) { } function hoistChildren (tree, diff, next) { - hoistChildren_(tree, diff, {}, next) + hoistChildren_(tree, diff, new Set(), next) } function hoistChildren_ (tree, diff, seen, next) { validate('OAOF', arguments) - if (seen[tree.path]) return next() - seen[tree.path] = true + if (seen.has(tree)) return next() + seen.add(tree) asyncMap(tree.children, function (child, done) { if (!tree.parent) return hoistChildren_(child, diff, seen, done) var better = findRequirement(tree.parent, moduleName(child), getRequested(child) || npa(packageId(child))) diff --git a/deps/npm/lib/doctor/check-ping.js b/deps/npm/lib/doctor/check-ping.js index 29a25c2fb7cce1..e7e82902a7165c 100644 --- a/deps/npm/lib/doctor/check-ping.js +++ b/deps/npm/lib/doctor/check-ping.js @@ -4,9 +4,7 @@ var ping = require('../ping.js') function checkPing (cb) { var tracker = log.newItem('checkPing', 1) tracker.info('checkPing', 'Pinging registry') - ping({}, true, function (err, pong, data, res) { - if (err) { return cb(err) } - tracker.finish() + ping({}, true, (_err, pong, data, res) => { cb(null, [res.statusCode, res.statusMessage]) }) } diff --git a/deps/npm/lib/doctor/get-latest-nodejs-version.js b/deps/npm/lib/doctor/get-latest-nodejs-version.js index a21229692fb30f..1586b087a0bff3 100644 --- a/deps/npm/lib/doctor/get-latest-nodejs-version.js +++ b/deps/npm/lib/doctor/get-latest-nodejs-version.js @@ -1,10 +1,11 @@ var log = require('npmlog') var request = require('request') +var semver = require('semver') function getLatestNodejsVersion (url, cb) { var tracker = log.newItem('getLatestNodejsVersion', 1) tracker.info('getLatestNodejsVersion', 'Getting Node.js release information') - var version = '' + var version = 'v0.0.0' url = url || 'https://nodejs.org/dist/index.json' request(url, function (e, res, index) { tracker.finish() @@ -14,7 +15,7 @@ function getLatestNodejsVersion (url, cb) { } try { JSON.parse(index).forEach(function (item) { - if (item.lts && item.version > version) version = item.version + if (item.lts && semver.gt(item.version, version)) version = item.version }) cb(null, version) } catch (e) { diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js index 67dcf98b70d797..029f806f835b45 100644 --- a/deps/npm/lib/install.js +++ b/deps/npm/lib/install.js @@ -208,7 +208,6 @@ function Installer (where, dryrun, args) { // the only exist when the tree does not match the lockfile // this is fine when doing full tree installs/updates but not ok when modifying only // a few deps via `npm install` or `npm uninstall`. - this.fakeChildren = true this.currentTree = null this.idealTree = null this.differences = [] @@ -296,6 +295,7 @@ Installer.prototype.run = function (_cb) { // this is necessary as we don't fill in `dependencies` and `devDependencies` in deps loaded from shrinkwrap // until after we extract them [this, (next) => { computeMetadata(this.idealTree); next() }], + [this, this.pruneIdealTree], [this, this.saveToDependencies]) } } @@ -324,7 +324,6 @@ Installer.prototype.run = function (_cb) { Installer.prototype.loadArgMetadata = function (next) { getAllMetadata(this.args, this.currentTree, process.cwd(), iferr(next, (args) => { this.args = args - if (args.length) this.fakeChildren = false next() })) } @@ -371,12 +370,16 @@ Installer.prototype.normalizeCurrentTree = function (cb) { } } } + computeMetadata(this.currentTree) return cb() - function normalizeTree (tree) { + function normalizeTree (tree, seen) { + if (!seen) seen = new Set() + if (seen.has(tree)) return + seen.add(tree) createNode(tree) tree.location = flatNameFromTree(tree) - tree.children.forEach(normalizeTree) + tree.children.forEach((child) => normalizeTree(child, seen)) } } @@ -402,8 +405,12 @@ Installer.prototype.loadIdealTree = function (cb) { } Installer.prototype.pruneIdealTree = function (cb) { + if (!this.idealTree) return cb() + // if our lock file didn't have the requires field and there + // are any fake children then forgo pruning until we have more info. + if (!this.idealTree.hasRequiresFromLock && this.idealTree.children.some((n) => n.fakeChild)) return cb() var toPrune = this.idealTree.children - .filter((n) => !n.fakeChild && isExtraneous(n)) + .filter(isExtraneous) .map((n) => ({name: moduleName(n)})) return removeExtraneous(toPrune, this.idealTree, cb) } @@ -417,14 +424,14 @@ Installer.prototype.loadAllDepsIntoIdealTree = function (cb) { var installNewModules = !!this.args.length var steps = [] - const depsToPreload = Object.assign({}, - this.dev ? this.idealTree.package.devDependencies : {}, - this.prod ? this.idealTree.package.dependencies : {} - ) if (installNewModules) { steps.push([validateArgs, this.idealTree, this.args]) steps.push([loadRequestedDeps, this.args, this.idealTree, saveDeps, cg.newGroup('loadRequestedDeps')]) } else { + const depsToPreload = Object.assign({}, + this.dev ? this.idealTree.package.devDependencies : {}, + this.prod ? this.idealTree.package.dependencies : {} + ) if (this.prod || this.dev) { steps.push( [prefetchDeps, this.idealTree, depsToPreload, cg.newGroup('prefetchDeps')]) @@ -513,7 +520,8 @@ Installer.prototype.executeActions = function (cb) { [lock, node_modules, '.staging'], [rimraf, staging], [doParallelActions, 'extract', staging, todo, cg.newGroup('extract', 100)], - [doReverseSerialActions, 'remove', staging, todo, cg.newGroup('remove')], + [doReverseSerialActions, 'unbuild', staging, todo, cg.newGroup('unbuild')], + [doSerialActions, 'remove', staging, todo, cg.newGroup('remove')], [doSerialActions, 'move', staging, todo, cg.newGroup('move')], [doSerialActions, 'finalize', staging, todo, cg.newGroup('finalize')], [doParallelActions, 'refresh-package-json', staging, todo, cg.newGroup('refresh-package-json')], @@ -675,7 +683,7 @@ function isLink (child) { Installer.prototype.loadShrinkwrap = function (cb) { validate('F', arguments) log.silly('install', 'loadShrinkwrap') - readShrinkwrap.andInflate(this.idealTree, {fakeChildren: this.fakeChildren}, cb) + readShrinkwrap.andInflate(this.idealTree, cb) } Installer.prototype.getInstalledModules = function () { @@ -713,7 +721,16 @@ Installer.prototype.printInstalled = function (cb) { validate('F', arguments) if (this.failing) return cb() log.silly('install', 'printInstalled') - const diffs = this.differences.concat((this.idealTree.removedChildren || []).map((r) => ['remove', r])) + const diffs = this.differences + if (!this.idealTree.error && this.idealTree.removedChildren) { + const deps = this.currentTree.package.dependencies || {} + const dev = this.currentTree.package.devDependencies || {} + this.idealTree.removedChildren.forEach((r) => { + if (diffs.some((d) => d[0] === 'remove' && d[1].path === r.path)) return + if (!deps[moduleName(r)] && !dev[moduleName(r)]) return + diffs.push(['remove', r]) + }) + } if (npm.config.get('json')) { return this.printInstalledForJSON(diffs, cb) } else if (npm.config.get('parseable')) { @@ -874,15 +891,15 @@ Installer.prototype.debugTree = function (name, treeName, cb) { Installer.prototype.prettify = function (tree) { validate('O', arguments) - var seen = {} + var seen = new Set() function byName (aa, bb) { return packageId(aa).localeCompare(packageId(bb)) } function expandTree (tree) { - seen[tree.path] = true + seen.add(tree) return { label: packageId(tree), - nodes: tree.children.filter((tree) => { return !seen[tree.path] && !tree.removed && !tree.failed }).sort(byName).map(expandTree) + nodes: tree.children.filter((tree) => { return !seen.has(tree) && !tree.removed && !tree.failed }).sort(byName).map(expandTree) } } return archy(expandTree(tree), '', { unicode: npm.config.get('unicode') }) diff --git a/deps/npm/lib/install/action/extract-worker.js b/deps/npm/lib/install/action/extract-worker.js new file mode 100644 index 00000000000000..24508c780495eb --- /dev/null +++ b/deps/npm/lib/install/action/extract-worker.js @@ -0,0 +1,18 @@ +'use strict' + +const BB = require('bluebird') + +const extract = require('pacote/extract') +const npmlog = require('npmlog') + +module.exports = (args, cb) => { + const parsed = typeof args === 'string' ? JSON.parse(args) : args + const spec = parsed[0] + const extractTo = parsed[1] + const opts = parsed[2] + if (!opts.log && opts.loglevel) { + opts.log = npmlog + opts.log.level = opts.loglevel + } + BB.resolve(extract(spec, extractTo, opts)).nodeify(cb) +} diff --git a/deps/npm/lib/install/action/extract.js b/deps/npm/lib/install/action/extract.js index 437d7e57f78ffa..5534e8b28a3fcd 100644 --- a/deps/npm/lib/install/action/extract.js +++ b/deps/npm/lib/install/action/extract.js @@ -2,19 +2,36 @@ const BB = require('bluebird') -const fs = BB.promisifyAll(require('graceful-fs')) +const stat = BB.promisify(require('graceful-fs').stat) const gentlyRm = BB.promisify(require('../../utils/gently-rm.js')) const log = require('npmlog') const mkdirp = BB.promisify(require('mkdirp')) const moduleName = require('../../utils/module-name.js') const moduleStagingPath = require('../module-staging-path.js') -const move = BB.promisify(require('../../utils/move.js')) +const move = require('../../utils/move.js') const npa = require('npm-package-arg') +const npm = require('../../npm.js') const packageId = require('../../utils/package-id.js') -const pacote = require('pacote') let pacoteOpts const path = require('path') +const localWorker = require('./extract-worker.js') +const workerFarm = require('worker-farm') +const WORKER_PATH = require.resolve('./extract-worker.js') +let workers + +extract.init = () => { + workers = workerFarm({ + maxConcurrentCallsPerWorker: npm.limit.fetch, + maxRetries: 1 + }, WORKER_PATH) + return BB.resolve() +} +extract.teardown = () => { + workerFarm.end(workers) + workers = null + return BB.resolve() +} module.exports = extract function extract (staging, pkg, log) { log.silly('extract', packageId(pkg)) @@ -25,14 +42,34 @@ function extract (staging, pkg, log) { const opts = pacoteOpts({ integrity: pkg.package._integrity }) - return pacote.extract( + const args = [ pkg.package._resolved ? npa.resolve(pkg.package.name, pkg.package._resolved) : pkg.package._requested, extractTo, opts - ).then(() => { - if (pkg.package.bundleDependencies) { + ] + return BB.fromNode((cb) => { + let launcher = localWorker + let msg = args + const spec = typeof args[0] === 'string' ? npa(args[0]) : args[0] + args[0] = spec.raw + if (spec.registry || spec.type === 'remote') { + // We can't serialize these options + opts.loglevel = opts.log.level + opts.log = null + opts.dirPacker = null + // workers will run things in parallel! + launcher = workers + try { + msg = JSON.stringify(msg) + } catch (e) { + return cb(e) + } + } + launcher(msg, cb) + }).then(() => { + if (pkg.package.bundleDependencies || anyBundled(pkg)) { return readBundled(pkg, staging, extractTo) } }).then(() => { @@ -40,8 +77,14 @@ function extract (staging, pkg, log) { }) } +function anyBundled (top, pkg) { + if (!pkg) pkg = top + return pkg.children.some((child) => child.fromBundle === top || anyBundled(top, child)) +} + function readBundled (pkg, staging, extractTo) { return BB.map(pkg.children, (child) => { + if (!child.fromBundle) return if (child.error) { throw child.error } else { @@ -84,7 +127,7 @@ function finishModule (bundler, child, stageTo, stageFrom) { return move(stageFrom, stageTo) }) } else { - return fs.statAsync(stageFrom).then(() => { + return stat(stageFrom).then(() => { const bundlerId = packageId(bundler) if (!getTree(bundler).warnings.some((w) => { return w.code === 'EBUNDLEOVERRIDE' diff --git a/deps/npm/lib/install/action/finalize.js b/deps/npm/lib/install/action/finalize.js index ded2350dff7155..a50ec8a6bdbfc8 100644 --- a/deps/npm/lib/install/action/finalize.js +++ b/deps/npm/lib/install/action/finalize.js @@ -91,5 +91,5 @@ module.exports = function (staging, pkg, log) { module.exports.rollback = function (top, staging, pkg, next) { const requested = pkg.package._requested || getRequested(pkg) if (requested && requested.type === 'directory') return next() - gentlyRm(pkg.realpath, false, top, next) + gentlyRm(pkg.path, false, top, next) } diff --git a/deps/npm/lib/install/action/move.js b/deps/npm/lib/install/action/move.js index 07649c355693ab..bc9bf6a883edea 100644 --- a/deps/npm/lib/install/action/move.js +++ b/deps/npm/lib/install/action/move.js @@ -46,7 +46,7 @@ function moveModuleOnly (from, to, log, done) { log.silly('move', 'move existing destination node_modules away', toModules) - move(toModules, tempToModules, removeDestination(done)) + move(toModules, tempToModules).then(removeDestination(done), removeDestination(done)) function removeDestination (next) { return function (er) { @@ -62,7 +62,7 @@ function moveModuleOnly (from, to, log, done) { function moveToModulesBack (next) { return function () { log.silly('move', 'move existing destination node_modules back', toModules) - move(tempToModules, toModules, iferr(done, next)) + move(tempToModules, toModules).then(next, done) } } @@ -76,14 +76,14 @@ function moveModuleOnly (from, to, log, done) { function moveNodeModules (next) { return function () { log.silly('move', 'move source node_modules away', fromModules) - move(fromModules, tempFromModules, iferr(doMove(next), doMove(moveNodeModulesBack(next)))) + move(fromModules, tempFromModules).then(doMove(moveNodeModulesBack(next)), doMove(next)) } } function doMove (next) { return function () { log.silly('move', 'move module dir to final dest', from, to) - move(from, to, iferr(done, next)) + move(from, to).then(next, done) } } @@ -91,7 +91,7 @@ function moveModuleOnly (from, to, log, done) { return function () { mkdirp(from, iferr(done, function () { log.silly('move', 'put source node_modules back', fromModules) - move(tempFromModules, fromModules, iferr(done, next)) + move(tempFromModules, fromModules).then(next, done) })) } } diff --git a/deps/npm/lib/install/action/refresh-package-json.js b/deps/npm/lib/install/action/refresh-package-json.js index 6910803451048b..42f80121006d33 100644 --- a/deps/npm/lib/install/action/refresh-package-json.js +++ b/deps/npm/lib/install/action/refresh-package-json.js @@ -1,16 +1,20 @@ 'use strict' -const path = require('path') + const Bluebird = require('bluebird') + +const checkPlatform = Bluebird.promisify(require('npm-install-checks').checkPlatform) +const getRequested = require('../get-requested.js') +const npm = require('../../npm.js') +const path = require('path') const readJson = Bluebird.promisify(require('read-package-json')) const updatePackageJson = Bluebird.promisify(require('../update-package-json')) -const getRequested = require('../get-requested.js') module.exports = function (staging, pkg, log) { log.silly('refresh-package-json', pkg.realpath) return readJson(path.join(pkg.path, 'package.json'), false).then((metadata) => { Object.keys(pkg.package).forEach(function (key) { - if (!isEmpty(pkg.package[key])) { + if (key !== 'dependencies' && !isEmpty(pkg.package[key])) { metadata[key] = pkg.package[key] } }) @@ -22,7 +26,10 @@ module.exports = function (staging, pkg, log) { delete metadata.readmeFilename pkg.package = metadata + pkg.fakeChild = false }).catch(() => 'ignore').then(() => { + return checkPlatform(pkg.package, npm.config.get('force')) + }).then(() => { const requested = pkg.package._requested || getRequested(pkg) if (requested.type !== 'directory') { return updatePackageJson(pkg, pkg.path) diff --git a/deps/npm/lib/install/action/remove.js b/deps/npm/lib/install/action/remove.js index 9fe77c35e05f8a..a852d10c5fd84f 100644 --- a/deps/npm/lib/install/action/remove.js +++ b/deps/npm/lib/install/action/remove.js @@ -7,6 +7,8 @@ var mkdirp = require('mkdirp') var npm = require('../../npm.js') var andIgnoreErrors = require('../and-ignore-errors.js') var move = require('../../utils/move.js') +var isInside = require('path-is-inside') +var vacuum = require('fs-vacuum') // This is weird because we want to remove the module but not it's node_modules folder // allowing for this allows us to not worry about the order of operations @@ -20,18 +22,20 @@ module.exports = function (staging, pkg, log, next) { } function removeLink (pkg, next) { - npm.commands.unbuild(pkg.path, true, next) + var base = isInside(pkg.path, npm.prefix) ? npm.prefix : pkg.path + rimraf(pkg.path, (err) => { + if (err) return next(err) + vacuum(pkg.path, {base: base}, next) + }) } function removeDir (pkg, log, next) { var modpath = path.join(path.dirname(pkg.path), '.' + path.basename(pkg.path) + '.MODULES') - move(path.join(pkg.path, 'node_modules'), modpath, unbuildPackage) + move(path.join(pkg.path, 'node_modules'), modpath).then(unbuildPackage, unbuildPackage) function unbuildPackage (moveEr) { - npm.commands.unbuild(pkg.path, true, function () { - rimraf(pkg.path, moveEr ? andRemoveEmptyParents(pkg.path) : moveModulesBack) - }) + rimraf(pkg.path, moveEr ? andRemoveEmptyParents(pkg.path) : moveModulesBack) } function andRemoveEmptyParents (path) { @@ -58,7 +62,7 @@ function removeDir (pkg, log, next) { var to = path.join(pkg.path, 'node_modules', file) // we ignore errors here, because they can legitimately happen, for instance, // bundled modules will be in both node_modules folders - move(from, to, andIgnoreErrors(done)) + move(from, to).then(andIgnoreErrors(done), andIgnoreErrors(done)) }, cleanup) } diff --git a/deps/npm/lib/install/action/unbuild.js b/deps/npm/lib/install/action/unbuild.js new file mode 100644 index 00000000000000..ce20df75d39d70 --- /dev/null +++ b/deps/npm/lib/install/action/unbuild.js @@ -0,0 +1,16 @@ +'use strict' +var Bluebird = require('bluebird') +var lifecycle = Bluebird.promisify(require('../../utils/lifecycle.js')) +var packageId = require('../../utils/package-id.js') +var rmStuff = Bluebird.promisify(require('../../unbuild.js').rmStuff) + +module.exports = function (staging, pkg, log) { + log.silly('unbuild', packageId(pkg)) + return lifecycle(pkg.package, 'preuninstall', pkg.path, false, true).then(() => { + return lifecycle(pkg.package, 'uninstall', pkg.path, false, true) + }).then(() => { + return rmStuff(pkg.package, pkg.path) + }).then(() => { + return lifecycle(pkg.package, 'postuninstall', pkg.path, false, true) + }) +} diff --git a/deps/npm/lib/install/actions.js b/deps/npm/lib/install/actions.js index 912985e2c74aeb..028d932373f1f6 100644 --- a/deps/npm/lib/install/actions.js +++ b/deps/npm/lib/install/actions.js @@ -21,6 +21,7 @@ actions.postinstall = require('./action/postinstall.js') actions.prepare = require('./action/prepare.js') actions.finalize = require('./action/finalize.js') actions.remove = require('./action/remove.js') +actions.unbuild = require('./action/unbuild.js') actions.move = require('./action/move.js') actions['global-install'] = require('./action/global-install.js') actions['global-link'] = require('./action/global-link.js') @@ -64,6 +65,8 @@ Object.keys(actions).forEach(function (actionName) { }) }) } + actions[actionName].init = action.init || (() => BB.resolve()) + actions[actionName].teardown = action.teardown || (() => BB.resolve()) }) exports.actions = actions @@ -106,7 +109,10 @@ function handleOptionalDepErrors (pkg, err) { exports.doOne = doOne function doOne (cmd, staging, pkg, log, next) { validate('SSOOF', arguments) - execAction(prepareAction([cmd, pkg], staging, log)).then(() => next(), next) + const prepped = prepareAction([cmd, pkg], staging, log) + return withInit(actions[cmd], () => { + return execAction(prepped) + }).nodeify(next) } exports.doParallel = doParallel @@ -120,8 +126,11 @@ function doParallel (type, staging, actionsToRun, log, next) { }, []) log.silly('doParallel', type + ' ' + actionsToRun.length) time(log) - BB.map(acts, execAction, { - concurrency: npm.limit.action + if (!acts.length) { return next() } + return withInit(actions[type], () => { + return BB.map(acts, execAction, { + concurrency: npm.limit.action + }) }).nodeify((err) => { log.finish() timeEnd(log) @@ -140,7 +149,7 @@ exports.doReverseSerial = doReverseSerial function doReverseSerial (type, staging, actionsToRun, log, next) { validate('SSAOF', arguments) log.silly('doReverseSerial', '%s %d', type, actionsToRun.length) - runSerial(type, staging, actionsToRun.reverse(), log, next) + runSerial(type, staging, [].concat(actionsToRun).reverse(), log, next) } function runSerial (type, staging, actionsToRun, log, next) { @@ -151,7 +160,10 @@ function runSerial (type, staging, actionsToRun, log, next) { return acc }, []) time(log) - BB.each(acts, execAction).nodeify((err) => { + if (!acts.length) { return next() } + return withInit(actions[type], () => { + return BB.each(acts, execAction) + }).nodeify((err) => { log.finish() timeEnd(log) next(err) @@ -165,6 +177,13 @@ function timeEnd (log) { process.emit('timeEnd', 'action:' + log.name) } +function withInit (action, body) { + return BB.using( + action.init().disposer(() => action.teardown()), + body + ) +} + function prepareAction (action, staging, log) { validate('ASO', arguments) validate('SO', action) diff --git a/deps/npm/lib/install/decompose-actions.js b/deps/npm/lib/install/decompose-actions.js index 1d954f5cab78bf..57dc7cd6874647 100644 --- a/deps/npm/lib/install/decompose-actions.js +++ b/deps/npm/lib/install/decompose-actions.js @@ -19,6 +19,8 @@ module.exports = function (differences, decomposed, next) { moveSteps(decomposed, pkg, done) break case 'remove': + removeSteps(decomposed, pkg, done) + break default: defaultSteps(decomposed, cmd, pkg, done) } @@ -44,8 +46,15 @@ function addSteps (decomposed, pkg, done) { } function updateSteps (decomposed, pkg, done) { + removeSteps(decomposed, pkg.oldPkg, () => { + addSteps(decomposed, pkg, done) + }) +} + +function removeSteps (decomposed, pkg, done) { + decomposed.push(['unbuild', pkg]) decomposed.push(['remove', pkg]) - addSteps(decomposed, pkg, done) + done() } function moveSteps (decomposed, pkg, done) { diff --git a/deps/npm/lib/install/deps.js b/deps/npm/lib/install/deps.js index c0fe905d4ba01a..d7a2c27c1cfb1c 100644 --- a/deps/npm/lib/install/deps.js +++ b/deps/npm/lib/install/deps.js @@ -30,6 +30,8 @@ var isDevDep = require('./is-dev-dep.js') var isProdDep = require('./is-prod-dep.js') var reportOptionalFailure = require('./report-optional-failure.js') var getSaveType = require('./save.js').getSaveType +var unixFormatPath = require('../utils/unix-format-path.js') +var isExtraneous = require('./is-extraneous.js') // The export functions in this module mutate a dependency tree, adding // items to them. @@ -37,9 +39,7 @@ var getSaveType = require('./save.js').getSaveType var registryTypes = { range: true, version: true } function doesChildVersionMatch (child, requested, requestor) { - // we always consider deps provided by a shrinkwrap as "correct" or else - // we'll subvert them if they're intentionally "invalid" - if (child.parent === requestor && child.fromShrinkwrap) return true + if (child.fromShrinkwrap && !child.hasRequiresFromLock) return true // ranges of * ALWAYS count as a match, because when downloading we allow // prereleases to match * if there are ONLY prereleases if (requested.type === 'range' && requested.fetchSpec === '*') return true @@ -51,13 +51,9 @@ function doesChildVersionMatch (child, requested, requestor) { if (!registryTypes[requested.type]) { var childReq = child.package._requested - if (!childReq && child.package._from) { - childReq = npa.resolve(moduleName(child), child.package._from.replace(new RegExp('^' + moduleName(child) + '@'), '')) - } if (childReq) { if (childReq.rawSpec === requested.rawSpec) return true if (childReq.type === requested.type && childReq.saveSpec === requested.saveSpec) return true - if (childReq.type === requested.type && childReq.spec === requested.saveSpec) return true } // If _requested didn't exist OR if it didn't match then we'll try using // _from. We pass it through npa to normalize the specifier. @@ -67,14 +63,14 @@ function doesChildVersionMatch (child, requested, requestor) { // really came from the same sources. // You'll see this scenario happen with at least tags and git dependencies. if (child.package._from) { - var fromReq = npa(child.package._from) + var fromReq = npa.resolve(moduleName(child), child.package._from.replace(new RegExp('^' + moduleName(child) + '@'), '')) if (fromReq.rawSpec === requested.rawSpec) return true if (fromReq.type === requested.type && fromReq.saveSpec && fromReq.saveSpec === requested.saveSpec) return true } return false } try { - return semver.satisfies(child.package.version, requested.fetchSpec) + return semver.satisfies(child.package.version, requested.fetchSpec, true) } catch (e) { return false } @@ -86,9 +82,9 @@ function childDependencySpecifier (tree, name, spec) { exports.computeMetadata = computeMetadata function computeMetadata (tree, seen) { - if (!seen) seen = {} - if (!tree || seen[tree.path]) return - seen[tree.path] = true + if (!seen) seen = new Set() + if (!tree || seen.has(tree)) return + seen.add(tree) if (tree.parent == null) { resetMetadata(tree) tree.isTop = true @@ -110,8 +106,10 @@ function computeMetadata (tree, seen) { } const deps = tree.package.dependencies || {} + const reqs = tree.swRequires || {} for (let name of Object.keys(deps)) { if (findChild(name, deps[name])) continue + if (findChild(name, reqs[name])) continue tree.missingDeps[name] = deps[name] } if (tree.isTop) { @@ -175,7 +173,9 @@ function removeObsoleteDep (child, log) { var requires = child.requires || [] requires.forEach(function (requirement) { requirement.requiredBy = requirement.requiredBy.filter(function (reqBy) { return reqBy !== child }) - if (requirement.requiredBy.length === 0) removeObsoleteDep(requirement, log) + // we don't just check requirement.requires because that doesn't account + // for circular deps. isExtraneous does. + if (isExtraneous(requirement)) removeObsoleteDep(requirement, log) }) } @@ -258,11 +258,16 @@ exports.loadRequestedDeps = function (args, tree, saveToDependencies, log, next) }, andForEachChild(loadDeps, andFinishTracker(log, next))) } +function isNotEmpty (value) { + return value != null && value !== '' +} + module.exports.computeVersionSpec = computeVersionSpec function computeVersionSpec (tree, child) { validate('OO', arguments) var requested - if (child.package._requested) { + var childReq = child.package._requested + if (childReq && (isNotEmpty(childReq.saveSpec) || (isNotEmpty(childReq.rawSpec) && isNotEmpty(childReq.fetchSpec)))) { requested = child.package._requested } else if (child.package._from) { requested = npa(child.package._from) @@ -279,9 +284,9 @@ function computeVersionSpec (tree, child) { } return rangeDescriptor + version } else if (requested.type === 'directory' || requested.type === 'file') { - return 'file:' + path.relative(tree.path, requested.fetchSpec) + return 'file:' + unixFormatPath(path.relative(tree.path, requested.fetchSpec)) } else { - return requested.saveSpec + return requested.saveSpec || requested.rawSpec } } @@ -412,7 +417,7 @@ exports.prefetchDeps = prefetchDeps function prefetchDeps (tree, deps, log, next) { validate('OOOF', arguments) var skipOptional = !npm.config.get('optional') - var seen = {} + var seen = new Set() const finished = andFinishTracker(log, next) const fpm = BB.promisify(fetchPackageMetadata) resolveBranchDeps(tree.package, deps).then( @@ -425,7 +430,7 @@ function prefetchDeps (tree, deps, log, next) { return npa.resolve(dep, deps[dep]) }).filter((dep) => { return dep.registry && - !seen[dep.toString()] && + !seen.has(dep.toString()) && !findRequirement(tree, dep.name, dep) }) if (skipOptional) { @@ -433,7 +438,7 @@ function prefetchDeps (tree, deps, log, next) { allDependencies = allDependencies.filter((dep) => !optDeps[dep.name]) } return BB.map(allDependencies, (dep) => { - seen[dep.toString()] = true + seen.add(dep.toString()) return fpm(dep, '', {tracker: log.newItem('fetchMetadata')}).then( (pkg) => { return pkg && pkg.dependencies && resolveBranchDeps(pkg, pkg.dependencies) @@ -468,11 +473,6 @@ function loadDeps (tree, log, next) { exports.loadDevDeps = function (tree, log, next) { validate('OOF', arguments) if (!tree.package.devDependencies) return andFinishTracker.now(log, next) - // if any of our prexisting children are from a shrinkwrap then we skip - // loading dev deps as the shrinkwrap will already have provided them for us. - if (tree.children.some(function (child) { return child.shrinkwrapDev })) { - return andFinishTracker.now(log, next) - } asyncMap(Object.keys(tree.package.devDependencies), function (dep, done) { // things defined as both dev dependencies and regular dependencies are treated // as the former @@ -484,11 +484,11 @@ exports.loadDevDeps = function (tree, log, next) { } var loadExtraneous = exports.loadExtraneous = function (tree, log, next) { - var seen = {} + var seen = new Set() function loadExtraneous (tree) { - if (seen[tree.path]) return - seen[tree.path] = true + if (seen.has(tree)) return + seen.add(tree) for (var child of tree.children) { if (child.loaded) continue resolveWithExistingModule(child, tree) @@ -516,10 +516,14 @@ function addDependency (name, versionSpec, tree, log, done) { var next = andAddParentToErrors(tree, done) try { var req = childDependencySpecifier(tree, name, versionSpec) + if (tree.swRequires && tree.swRequires[name]) { + var swReq = childDependencySpecifier(tree, name, tree.swRequires[name]) + } } catch (err) { return done(err) } var child = findRequirement(tree, name, req) + if (!child && swReq) child = findRequirement(tree, name, swReq) if (child) { resolveWithExistingModule(child, tree) if (child.package._shrinkwrap === undefined) { @@ -612,7 +616,7 @@ function resolveWithNewModule (pkg, tree, log, next) { } if (pkg._shrinkwrap && pkg._shrinkwrap.dependencies) { - return inflateShrinkwrap(child, pkg._shrinkwrap.dependencies, function (er) { + return inflateShrinkwrap(child, pkg._shrinkwrap, function (er) { next(er, child, log) }) } @@ -625,19 +629,22 @@ var validatePeerDeps = exports.validatePeerDeps = function (tree, onInvalid) { if (!tree.package.peerDependencies) return Object.keys(tree.package.peerDependencies).forEach(function (pkgname) { var version = tree.package.peerDependencies[pkgname] - var match = findRequirement(tree.parent || tree, pkgname, npa.resolve(pkgname, version)) + try { + var spec = npa.resolve(pkgname, version) + } catch (e) {} + var match = spec && findRequirement(tree.parent || tree, pkgname, spec) if (!match) onInvalid(tree, pkgname, version) }) } exports.validateAllPeerDeps = function (tree, onInvalid) { - validateAllPeerDeps(tree, onInvalid, {}) + validateAllPeerDeps(tree, onInvalid, new Set()) } function validateAllPeerDeps (tree, onInvalid, seen) { validate('OFO', arguments) - if (seen[tree.path]) return - seen[tree.path] = true + if (seen.has(tree)) return + seen.add(tree) validatePeerDeps(tree, onInvalid) tree.children.forEach(function (child) { validateAllPeerDeps(child, onInvalid, seen) }) } @@ -668,6 +675,7 @@ var findRequirement = exports.findRequirement = function (tree, name, requested, return null } if (tree.isTop) return null + if (!preserveSymlinks() && /^[.][.][\\/]/.test(path.relative(tree.parent.realpath, tree.realpath))) return null return findRequirement(tree.parent, name, requested, requestor) } diff --git a/deps/npm/lib/install/diff-trees.js b/deps/npm/lib/install/diff-trees.js index 67fe72d04471c0..ac4f421a5012b1 100644 --- a/deps/npm/lib/install/diff-trees.js +++ b/deps/npm/lib/install/diff-trees.js @@ -1,7 +1,11 @@ 'use strict' +var npm = require('../npm.js') var validate = require('aproba') var npa = require('npm-package-arg') var flattenTree = require('./flatten-tree.js') +var isOnlyDev = require('./is-only-dev.js') +var log = require('npmlog') +var path = require('path') function nonRegistrySource (pkg) { validate('O', arguments) @@ -119,6 +123,8 @@ var diffTrees = module.exports._diffTrees = function (oldTree, newTree) { Object.keys(flatOldTree).forEach(function (flatname) { if (flatNewTree[flatname]) return var pkg = flatOldTree[flatname] + if (pkg.isInLink && /^[.][.][/\\]/.test(path.relative(newTree.realpath, pkg.realpath))) return + toRemove[flatname] = pkg var pkgunique = getUniqueId(pkg.package) if (!toRemoveByUniqueId[pkgunique]) toRemoveByUniqueId[pkgunique] = [] @@ -146,9 +152,21 @@ var diffTrees = module.exports._diffTrees = function (oldTree, newTree) { }) Object .keys(toRemove) - .map(function (path) { return toRemove[path] }) - .forEach(function (pkg) { - setAction(differences, 'remove', pkg) + .map((path) => toRemove[path]) + .forEach((pkg) => setAction(differences, 'remove', pkg)) + + const includeDev = npm.config.get('dev') || + (!/^prod(uction)?$/.test(npm.config.get('only')) && !npm.config.get('production')) || + /^dev(elopment)?$/.test(npm.config.get('only')) || + /^dev(elopment)?$/.test(npm.config.get('also')) + const includeProd = !/^dev(elopment)?$/.test(npm.config.get('only')) + if (!includeProd || !includeDev) { + log.silly('diff-trees', 'filtering actions:', 'includeDev', includeDev, 'includeProd', includeProd) + differences = differences.filter((diff) => { + const pkg = diff[1] + const pkgIsOnlyDev = isOnlyDev(pkg) + return (!includeProd && pkgIsOnlyDev) || (includeDev && pkgIsOnlyDev) || (includeProd && !pkgIsOnlyDev) }) + } return differences } diff --git a/deps/npm/lib/install/flatten-tree.js b/deps/npm/lib/install/flatten-tree.js index b6ceb30f2fd916..56282b771da43a 100644 --- a/deps/npm/lib/install/flatten-tree.js +++ b/deps/npm/lib/install/flatten-tree.js @@ -8,19 +8,19 @@ module.exports.flatNameFromTree = flatNameFromTree function flattenTree (tree) { validate('O', arguments) - var seen = {} + var seen = new Set() var flat = {} var todo = [[tree, '/']] while (todo.length) { var next = todo.shift() var pkg = next[0] - seen[pkg.path] = true + seen.add(pkg) var path = next[1] flat[path] = pkg if (path !== '/') path += '/' for (var ii = 0; ii < pkg.children.length; ++ii) { var child = pkg.children[ii] - if (!seen[child.path]) { + if (!seen.has(child)) { todo.push([child, flatName(path, child)]) } } diff --git a/deps/npm/lib/install/inflate-shrinkwrap.js b/deps/npm/lib/install/inflate-shrinkwrap.js index 7ad966ea0a90e8..48be93d0952e72 100644 --- a/deps/npm/lib/install/inflate-shrinkwrap.js +++ b/deps/npm/lib/install/inflate-shrinkwrap.js @@ -14,7 +14,7 @@ const realizeShrinkwrapSpecifier = require('./realize-shrinkwrap-specifier.js') const validate = require('aproba') const path = require('path') -module.exports = function (tree, swdeps, opts, finishInflating) { +module.exports = function (tree, sw, opts, finishInflating) { if (!fetchPackageMetadata) { fetchPackageMetadata = BB.promisify(require('../fetch-package-metadata.js')) addBundled = BB.promisify(fetchPackageMetadata.addBundled) @@ -26,36 +26,32 @@ module.exports = function (tree, swdeps, opts, finishInflating) { if (!npm.config.get('shrinkwrap') || !npm.config.get('package-lock')) { return finishInflating() } - tree.loaded = true - return inflateShrinkwrap(tree.path, tree, swdeps, opts).then( + tree.loaded = false + tree.hasRequiresFromLock = sw.requires + return inflateShrinkwrap(tree.path, tree, sw.dependencies, opts).then( () => finishInflating(), finishInflating ) } function inflateShrinkwrap (topPath, tree, swdeps, opts) { - validate('SOO|SOOO', arguments) + if (!swdeps) return Promise.resolve() if (!opts) opts = {} const onDisk = {} tree.children.forEach((child) => { onDisk[moduleName(child)] = child }) - const dev = npm.config.get('dev') || (!/^prod(uction)?$/.test(npm.config.get('only')) && !npm.config.get('production')) || /^dev(elopment)?$/.test(npm.config.get('only')) - const prod = !/^dev(elopment)?$/.test(npm.config.get('only')) tree.children = [] return BB.each(Object.keys(swdeps), (name) => { const sw = swdeps[name] - if ( - (!prod && !sw.dev) || - (!dev && sw.dev) - ) { return null } const dependencies = sw.dependencies || {} const requested = realizeShrinkwrapSpecifier(name, sw, topPath) return inflatableChild( onDisk[name], name, topPath, tree, sw, requested, opts ).then((child) => { + child.hasRequiresFromLock = tree.hasRequiresFromLock return inflateShrinkwrap(topPath, child, dependencies) }) }) @@ -74,11 +70,13 @@ function inflatableChild (onDiskChild, name, topPath, tree, sw, requested, opts) if (onDiskChild && childIsEquivalent(sw, requested, onDiskChild)) { // The version on disk matches the shrinkwrap entry. if (!onDiskChild.fromShrinkwrap) onDiskChild.fromShrinkwrap = true - if (sw.dev) onDiskChild.shrinkwrapDev = true onDiskChild.package._requested = requested onDiskChild.package._spec = requested.rawSpec onDiskChild.package._where = topPath - onDiskChild.fromBundle = sw.bundled ? tree.fromBundle || tree : null + onDiskChild.package._optional = sw.optional + onDiskChild.package._development = sw.dev + onDiskChild.package._inBundle = sw.bundled + onDiskChild.fromBundle = (sw.bundled || onDiskChild.package._inBundle) ? tree.fromBundle || tree : null if (!onDiskChild.package._args) onDiskChild.package._args = [] onDiskChild.package._args.push([String(requested), topPath]) // non-npm registries can and will return unnormalized data, plus @@ -86,9 +84,10 @@ function inflatableChild (onDiskChild, name, topPath, tree, sw, requested, opts) // normalization rules. This ensures we get package data in a consistent, // stable format. normalizePackageDataNoErrors(onDiskChild.package) + onDiskChild.swRequires = sw.requires tree.children.push(onDiskChild) return BB.resolve(onDiskChild) - } else if (opts.fakeChildren !== false && sw.version && sw.integrity) { + } else if ((sw.version && sw.integrity) || sw.bundled) { // The shrinkwrap entry has an integrity field. We can fake a pkg to get // the installer to do a content-address fetch from the cache, if possible. return BB.resolve(makeFakeChild(name, topPath, tree, sw, requested)) @@ -105,43 +104,43 @@ function makeFakeChild (name, topPath, tree, sw, requested) { const pkg = { name: name, version: sw.version, + _id: name + '@' + sw.version, _resolved: adaptResolved(requested, sw.resolved), _requested: requested, _optional: sw.optional, + _development: sw.dev, + _inBundle: sw.bundled, _integrity: sw.integrity, _from: from, _spec: requested.rawSpec, _where: topPath, - _args: [[requested.toString(), topPath]] + _args: [[requested.toString(), topPath]], + dependencies: sw.requires } - let bundleAdded = BB.resolve() - if (Object.keys(sw.dependencies || {}).some((d) => { - return sw.dependencies[d].bundled - })) { - pkg.bundleDependencies = [] - bundleAdded = addBundled(pkg) - } - return bundleAdded.then(() => { - const child = createChild({ - package: pkg, - loaded: true, - parent: tree, - children: pkg._bundled || [], - fromShrinkwrap: true, - fakeChild: sw, - fromBundle: sw.bundled ? tree.fromBundle || tree : null, - path: childPath(tree.path, pkg), - realpath: childPath(tree.realpath, pkg), - location: tree.location + '/' + pkg.name, - isInLink: tree.isLink - }) - tree.children.push(child) - if (pkg._bundled) { - delete pkg._bundled - inflateBundled(child, child, child.children) + + if (!sw.bundled) { + const bundleDependencies = Object.keys(sw.dependencies || {}).filter((d) => sw.dependencies[d].bundled) + if (bundleDependencies.length === 0) { + pkg.bundleDependencies = bundleDependencies } - return child + } + const child = createChild({ + package: pkg, + loaded: true, + parent: tree, + children: [], + fromShrinkwrap: true, + fakeChild: sw, + fromBundle: sw.bundled ? tree.fromBundle || tree : null, + path: childPath(tree.path, pkg), + realpath: childPath(tree.realpath, pkg), + location: tree.location + '/' + pkg.name, + isLink: requested.type === 'directory', + isInLink: tree.isLink, + swRequires: sw.requires }) + tree.children.push(child) + return child } function adaptResolved (requested, resolved) { @@ -162,25 +161,27 @@ function adaptResolved (requested, resolved) { } function fetchChild (topPath, tree, sw, requested) { - const from = sw.from || requested.raw - const optional = sw.optional return fetchPackageMetadata(requested, topPath).then((pkg) => { - pkg._from = from - pkg._optional = optional + pkg._from = sw.from || requested.raw + pkg._optional = sw.optional + pkg._development = sw.dev + pkg._inBundle = false return addBundled(pkg).then(() => pkg) }).then((pkg) => { var isLink = pkg._requested.type === 'directory' const child = createChild({ package: pkg, - loaded: true, + loaded: false, parent: tree, fromShrinkwrap: requested, path: childPath(tree.path, pkg), realpath: isLink ? requested.fetchSpec : childPath(tree.realpath, pkg), children: pkg._bundled || [], location: tree.location + '/' + pkg.name, + fromBundle: null, isLink: isLink, - isInLink: tree.isLink + isInLink: tree.isLink, + swRequires: sw.requires }) tree.children.push(child) if (pkg._bundled) { diff --git a/deps/npm/lib/install/is-only-dev.js b/deps/npm/lib/install/is-only-dev.js new file mode 100644 index 00000000000000..ef41e8ad1a2659 --- /dev/null +++ b/deps/npm/lib/install/is-only-dev.js @@ -0,0 +1,35 @@ +'use strict' +module.exports = isOnlyDev + +const moduleName = require('../utils/module-name.js') +const isDevDep = require('./is-dev-dep.js') +const isProdDep = require('./is-prod-dep.js') + +// Returns true if the module `node` is only required direcctly as a dev +// dependency of the top level or transitively _from_ top level dev +// dependencies. +// Dual mode modules (that are both dev AND prod) should return false. +function isOnlyDev (node, seen) { + if (!seen) seen = new Set() + return node.requiredBy.length && node.requiredBy.every(andIsOnlyDev(moduleName(node), seen)) +} + +// There is a known limitation with this implementation: If a dependency is +// ONLY required by cycles that are detached from the top level then it will +// ultimately return true. +// +// This is ok though: We don't allow shrinkwraps with extraneous deps and +// these situation is caught by the extraneous checker before we get here. +function andIsOnlyDev (name, seen) { + return function (req) { + const isDev = isDevDep(req, name) + const isProd = isProdDep(req, name) + if (req.isTop) { + return isDev && !isProd + } else { + if (seen.has(req)) return true + seen.add(req) + return isOnlyDev(req, seen) + } + } +} diff --git a/deps/npm/lib/install/is-only-optional.js b/deps/npm/lib/install/is-only-optional.js new file mode 100644 index 00000000000000..7366e9abe1b326 --- /dev/null +++ b/deps/npm/lib/install/is-only-optional.js @@ -0,0 +1,18 @@ +'use strict' +module.exports = isOptional + +const isOptDep = require('./is-opt-dep.js') + +function isOptional (node, seen) { + if (!seen) seen = new Set() + // If a node is not required by anything, then we've reached + // the top level package. + if (seen.has(node) || node.requiredBy.length === 0) { + return false + } + seen.add(node) + + return node.requiredBy.every(function (req) { + return isOptDep(req, node.package.name) || isOptional(req, seen) + }) +} diff --git a/deps/npm/lib/install/mutate-into-logical-tree.js b/deps/npm/lib/install/mutate-into-logical-tree.js index 018745cc5ffa49..0979afc7814385 100644 --- a/deps/npm/lib/install/mutate-into-logical-tree.js +++ b/deps/npm/lib/install/mutate-into-logical-tree.js @@ -70,18 +70,23 @@ module.exports.asReadInstalled = function (tree) { } function translateTree (tree) { - return translateTree_(tree, {}) + return translateTree_(tree, new Set()) } function translateTree_ (tree, seen) { var pkg = tree.package - if (seen[tree.path]) return pkg - seen[tree.path] = pkg + if (seen.has(tree)) return pkg + seen.add(tree) if (pkg._dependencies) return pkg pkg._dependencies = pkg.dependencies pkg.dependencies = {} tree.children.forEach(function (child) { - pkg.dependencies[moduleName(child)] = translateTree_(child, seen) + const dep = pkg.dependencies[moduleName(child)] = translateTree_(child, seen) + if (child.fakeChild) { + dep.missing = true + dep.optional = child.package._optional + dep.requiredBy = child.package._spec + } }) function markMissing (name, requiredBy) { diff --git a/deps/npm/lib/install/node.js b/deps/npm/lib/install/node.js index b1b01fa8b9eb6a..18138078a2e662 100644 --- a/deps/npm/lib/install/node.js +++ b/deps/npm/lib/install/node.js @@ -27,6 +27,9 @@ var defaultTemplate = { function isLink (node) { return node && node.isLink } +function isInLink (node) { + return node && (node.isInLink || node.isLink) +} var create = exports.create = function (node, template, isNotTop) { if (!template) template = defaultTemplate @@ -41,16 +44,9 @@ var create = exports.create = function (node, template, isNotTop) { if (!isNotTop) { // isLink is true for the symlink and everything inside it. // by contrast, isInLink is true for only the things inside a link - if (node.isLink == null && isLink(node.parent)) { - node.isLink = true - node.isInLink = true - } else if (node.isLink == null) { - node.isLink = false - node.isInLink = false - } - if (node.fromBundle == null && node.package) { - node.fromBundle = node.package._inBundle - } else if (node.fromBundle == null) { + if (node.isLink == null) node.isLink = isLink(node.parent) + if (node.isInLink == null) node.isInLink = isInLink(node.parent) + if (node.fromBundle == null) { node.fromBundle = false } } @@ -58,12 +54,12 @@ var create = exports.create = function (node, template, isNotTop) { } exports.reset = function (node) { - reset(node, {}) + reset(node, new Set()) } function reset (node, seen) { - if (seen[node.path]) return - seen[node.path] = true + if (seen.has(node)) return + seen.add(node) var child = create(node) // FIXME: cleaning up after read-package-json's mess =( diff --git a/deps/npm/lib/install/read-shrinkwrap.js b/deps/npm/lib/install/read-shrinkwrap.js index de398fb40b878d..45e883caa2f5e2 100644 --- a/deps/npm/lib/install/read-shrinkwrap.js +++ b/deps/npm/lib/install/read-shrinkwrap.js @@ -47,14 +47,10 @@ function maybeReadFile (name, child) { ).catch({code: 'ENOENT'}, () => null) } -module.exports.andInflate = function (child, opts, next) { - if (arguments.length === 2) { - next = opts - opts = {} - } +module.exports.andInflate = function (child, next) { readShrinkwrap(child, iferr(next, function () { if (child.package._shrinkwrap) { - return inflateShrinkwrap(child, child.package._shrinkwrap.dependencies || {}, opts, next) + return inflateShrinkwrap(child, child.package._shrinkwrap || {}, next) } else { return next() } diff --git a/deps/npm/lib/install/realize-shrinkwrap-specifier.js b/deps/npm/lib/install/realize-shrinkwrap-specifier.js index 91030bfa826fe2..ac700278fff9fa 100644 --- a/deps/npm/lib/install/realize-shrinkwrap-specifier.js +++ b/deps/npm/lib/install/realize-shrinkwrap-specifier.js @@ -5,14 +5,17 @@ module.exports = function (name, sw, where) { try { if (sw.version && sw.integrity) { return npa.resolve(name, sw.version, where) + } else if (sw.from) { + const spec = npa(sw.from, where) + if (spec.registry && sw.version) { + return npa.resolve(name, sw.version, where) + } else if (!sw.resolved) { + return spec + } } if (sw.resolved) { return npa.resolve(name, sw.resolved, where) } - if (sw.from) { - var spec = npa(sw.from, where) - if (!spec.registry) return spec - } } catch (_) { } return npa.resolve(name, sw.version, where) } diff --git a/deps/npm/lib/install/save.js b/deps/npm/lib/install/save.js index 56a4a892ad4ee3..e1a94fcff7a6ad 100644 --- a/deps/npm/lib/install/save.js +++ b/deps/npm/lib/install/save.js @@ -1,11 +1,9 @@ 'use strict' -const BB = require('bluebird') - const createShrinkwrap = require('../shrinkwrap.js').createShrinkwrap const deepSortObject = require('../utils/deep-sort-object.js') const detectIndent = require('detect-indent') -const fs = BB.promisifyAll(require('graceful-fs')) +const fs = require('graceful-fs') const iferr = require('iferr') const log = require('npmlog') const moduleName = require('../utils/module-name.js') @@ -77,8 +75,8 @@ function savePackageJson (tree, next) { var toSave = getThingsToSave(tree) var toRemove = getThingsToRemove(tree) var savingTo = {} - toSave.forEach(function (pkg) { savingTo[pkg.save] = true }) - toRemove.forEach(function (pkg) { savingTo[pkg.save] = true }) + toSave.forEach(function (pkg) { if (pkg.save) savingTo[pkg.save] = true }) + toRemove.forEach(function (pkg) { if (pkg.save) savingTo[pkg.save] = true }) Object.keys(savingTo).forEach(function (save) { if (!tree.package[save]) tree.package[save] = {} @@ -87,7 +85,7 @@ function savePackageJson (tree, next) { log.verbose('saving', toSave) const types = ['dependencies', 'devDependencies', 'optionalDependencies'] toSave.forEach(function (pkg) { - tree.package[pkg.save][pkg.name] = pkg.spec + if (pkg.save) tree.package[pkg.save][pkg.name] = pkg.spec const movedFrom = [] for (let saveType of types) { if ( @@ -109,7 +107,7 @@ function savePackageJson (tree, next) { }) toRemove.forEach(function (pkg) { - delete tree.package[pkg.save][pkg.name] + if (pkg.save) delete tree.package[pkg.save][pkg.name] if (saveBundle) { bundle = without(bundle, pkg.name) } @@ -123,7 +121,12 @@ function savePackageJson (tree, next) { } var json = JSON.stringify(tree.package, null, indent) + '\n' - writeFileAtomic(saveTarget, json, next) + if (json === packagejson) { + log.verbose('shrinkwrap', 'skipping write for package.json because there were no changes.') + next() + } else { + writeFileAtomic(saveTarget, json, next) + } })) } diff --git a/deps/npm/lib/install/validate-args.js b/deps/npm/lib/install/validate-args.js index c30bf8695b0ce1..65b660417a4caa 100644 --- a/deps/npm/lib/install/validate-args.js +++ b/deps/npm/lib/install/validate-args.js @@ -14,12 +14,23 @@ module.exports = function (idealTree, args, next) { asyncMap(args, function (pkg, done) { chain([ + [hasMinimumFields, pkg], [checkSelf, idealTree, pkg, force], [isInstallable, pkg] ], done) }, next) } +function hasMinimumFields (pkg, cb) { + if (pkg.name === '' || pkg.name == null) { + return cb(new Error(`Can't install ${pkg._resolved}: Missing package name`)) + } else if (pkg.version === '' || pkg.version == null) { + return cb(new Error(`Can't install ${pkg._resolved}: Missing package version`)) + } else { + return cb() + } +} + function getWarnings (pkg) { while (pkg.parent) pkg = pkg.parent if (!pkg.warnings) pkg.warnings = [] diff --git a/deps/npm/lib/ls.js b/deps/npm/lib/ls.js index 3e2f2ce8fadef8..2e3db79c3be7d0 100644 --- a/deps/npm/lib/ls.js +++ b/deps/npm/lib/ls.js @@ -13,12 +13,11 @@ var archy = require('archy') var semver = require('semver') var color = require('ansicolors') var npa = require('npm-package-arg') -var iferr = require('iferr') var sortedObject = require('sorted-object') -var extend = Object.assign || require('util')._extend var npm = require('./npm.js') var mutateIntoLogicalTree = require('./install/mutate-into-logical-tree.js') var computeMetadata = require('./install/deps.js').computeMetadata +var readShrinkwrap = require('./install/read-shrinkwrap.js') var packageId = require('./utils/package-id.js') var usage = require('./utils/usage') var output = require('./utils/output.js') @@ -36,15 +35,13 @@ function ls (args, silent, cb) { silent = false } var dir = path.resolve(npm.dir, '..') - readPackageTree(dir, andComputeMetadata(iferr(cb, function (physicalTree) { - lsFromTree(dir, physicalTree, args, silent, cb) - }))) -} - -function andComputeMetadata (next) { - return function (er, tree) { - next(null, computeMetadata(tree || {})) - } + readPackageTree(dir, function (_, physicalTree) { + if (!physicalTree) physicalTree = {package: {}, path: dir} + physicalTree.isTop = true + readShrinkwrap.andInflate(physicalTree, function () { + lsFromTree(dir, computeMetadata(physicalTree), args, silent, cb) + }) + }) } function inList (list, value) { @@ -81,6 +78,8 @@ var lsFromTree = ls.fromTree = function (dir, physicalTree, args, silent, cb) { pruneNestedExtraneous(data) filterByEnv(data) + filterByLink(data) + var unlooped = filterFound(unloop(data), args) var lite = getLite(unlooped) @@ -90,13 +89,13 @@ var lsFromTree = ls.fromTree = function (dir, physicalTree, args, silent, cb) { var json = npm.config.get('json') var out if (json) { - var seen = [] + var seen = new Set() var d = long ? unlooped : lite // the raw data can be circular out = JSON.stringify(d, function (k, o) { if (typeof o === 'object') { - if (inList(seen, o)) return '[Circular]' - seen.push(o) + if (seen.has(o)) return '[Circular]' + seen.add(o) } return o }, 2) @@ -149,6 +148,19 @@ function filterByEnv (data) { data.dependencies = dependencies } +function filterByLink (data) { + if (npm.config.get('link')) { + var dependencies = {} + Object.keys(data.dependencies).forEach(function (name) { + var dependency = data.dependencies[name] + if (dependency.link) { + dependencies[name] = dependency + } + }) + data.dependencies = dependencies + } +} + function alphasort (a, b) { a = a.toLowerCase() b = b.toLowerCase() @@ -224,7 +236,11 @@ function getLite (data, noname, depth) { ', required by ' + packageId(data) lite.problems.push(p) - return [d, { required: dep.requiredBy, missing: true }] + if (dep.dependencies) { + return [d, getLite(dep, true)] + } else { + return [d, { required: dep.requiredBy, missing: true }] + } } else if (dep.peerMissing) { lite.problems = lite.problems || [] dep.peerMissing.forEach(function (missing) { @@ -254,22 +270,22 @@ function getLite (data, noname, depth) { function unloop (root) { var queue = [root] - var seen = {} - seen[root.path] = true + var seen = new Set() + seen.add(root) while (queue.length) { var current = queue.shift() var deps = current.dependencies = current.dependencies || {} Object.keys(deps).forEach(function (d) { var dep = deps[d] - if (dep.missing) return - if (dep.path && seen[dep.path]) { - dep = deps[d] = extend({}, dep) + if (dep.missing && !dep.dependencies) return + if (dep.path && seen.has(dep)) { + dep = deps[d] = Object.assign({}, dep) dep.dependencies = {} dep._deduped = path.relative(root.path, dep.path).replace(/node_modules\//g, '') return } - seen[dep.path] = true + seen.add(dep) queue.push(dep) }) } @@ -353,11 +369,26 @@ function makeArchy_ (data, long, dir, depth, parent, d) { unmet = color.bgBlack(color.red(unmet)) } } - data = unmet + ' ' + d + '@' + data.requiredBy + var label = data._id || (d + '@' + data.requiredBy) + if (data._found === 'explicit' && data._id) { + if (npm.color) { + label = color.bgBlack(color.yellow(label.trim())) + ' ' + } else { + label = label.trim() + ' ' + } + } + return { + label: unmet + ' ' + label, + nodes: Object.keys(data.dependencies || {}) + .sort(alphasort).filter(function (d) { + return !isCruft(data.dependencies[d]) + }).map(function (d) { + return makeArchy_(sortedObject(data.dependencies[d]), long, dir, depth + 1, data, d) + }) + } } else { - data = d + '@' + data.requiredBy + return {label: d + '@' + data.requiredBy} } - return data } var out = {} diff --git a/deps/npm/lib/outdated.js b/deps/npm/lib/outdated.js index 7d5cfba86e7d37..f2fb2df79a3cca 100644 --- a/deps/npm/lib/outdated.js +++ b/deps/npm/lib/outdated.js @@ -38,21 +38,19 @@ var long = npm.config.get('long') var mapToRegistry = require('./utils/map-to-registry.js') var isExtraneous = require('./install/is-extraneous.js') var computeMetadata = require('./install/deps.js').computeMetadata +var computeVersionSpec = require('./install/deps.js').computeVersionSpec var moduleName = require('./utils/module-name.js') var output = require('./utils/output.js') var ansiTrim = require('./utils/ansi-trim') -function uniqName (item) { - return item[0].path + '|' + item[1] + '|' + item[7] -} - function uniq (list) { + // we maintain the array because we need an array, not iterator, return + // value. var uniqed = [] - var seen = {} + var seen = new Set() list.forEach(function (item) { - var name = uniqName(item) - if (seen[name]) return - seen[name] = true + if (seen.has(item)) return + seen.add(item) uniqed.push(item) }) return uniqed @@ -204,7 +202,7 @@ function outdated_ (args, path, tree, parentHas, depth, cb) { var types = {} var pkg = tree.package - var deps = tree.children.filter(function (child) { return !isExtraneous(child) }) || [] + var deps = tree.error ? tree.children : tree.children.filter((child) => !isExtraneous(child)) deps.forEach(function (dep) { types[moduleName(dep)] = 'dependencies' @@ -291,7 +289,7 @@ function outdated_ (args, path, tree, parentHas, depth, cb) { var required = (tree.package.dependencies)[name] || (tree.package.optionalDependencies)[name] || (tree.package.devDependencies)[name] || - dep.package._requested && dep.package._requested.fetchSpec || + computeVersionSpec(tree, dep) || '*' if (!long) return shouldUpdate(args, dep, name, has, required, depth, path, cb) diff --git a/deps/npm/lib/pack.js b/deps/npm/lib/pack.js index 4552bbc498986b..ae3bb260bad02a 100644 --- a/deps/npm/lib/pack.js +++ b/deps/npm/lib/pack.js @@ -163,6 +163,8 @@ function packGitDep (manifest, dir) { const child = cp.spawn(process.env.NODE || process.execPath, [ require.main.filename, 'install', + '--dev', + '--prod', '--ignore-prepublish', '--no-progress', '--no-save' diff --git a/deps/npm/lib/prune.js b/deps/npm/lib/prune.js index 6027745383e47a..4ac8139576bd04 100644 --- a/deps/npm/lib/prune.js +++ b/deps/npm/lib/prune.js @@ -11,7 +11,7 @@ var util = require('util') var moduleName = require('./utils/module-name.js') var Installer = require('./install.js').Installer var isExtraneous = require('./install/is-extraneous.js') -var isDev = require('./install/is-dev-dep.js') +var isOnlyDev = require('./install/is-only-dev.js') var removeDeps = require('./install/deps.js').removeDeps var loadExtraneous = require('./install/deps.js').loadExtraneous var chain = require('slide').chain @@ -26,7 +26,6 @@ function prune (args, cb) { function Pruner (where, dryrun, args) { Installer.call(this, where, dryrun, args) - this.fakeChildren = false } util.inherits(Pruner, Installer) @@ -42,9 +41,7 @@ Pruner.prototype.loadAllDepsIntoIdealTree = function (cb) { function shouldPrune (child) { if (isExtraneous(child)) return true if (!excludeDev) return false - var childName = moduleName(child) - var isChildDev = function (parent) { return isDev(parent, childName) } - if (child.requiredBy.every(isChildDev)) return true + return isOnlyDev(child) } function getModuleName (child) { // wrapping because moduleName doesn't like extra args and we're called diff --git a/deps/npm/lib/rebuild.js b/deps/npm/lib/rebuild.js index 2673b1cfea66a3..bbc5e8f4811b34 100644 --- a/deps/npm/lib/rebuild.js +++ b/deps/npm/lib/rebuild.js @@ -43,10 +43,10 @@ function cleanBuild (folders, set, cb) { function filter (data, args, set, seen) { if (!set) set = {} - if (!seen) seen = {} + if (!seen) seen = new Set() if (set.hasOwnProperty(data.path)) return set - if (seen.hasOwnProperty(data.path)) return set - seen[data.path] = true + if (seen.has(data)) return set + seen.add(data) var pass if (!args.length) pass = true // rebuild everything else if (data.name && data._id) { diff --git a/deps/npm/lib/shrinkwrap.js b/deps/npm/lib/shrinkwrap.js index 428c12bba70233..a541d868fc2d02 100644 --- a/deps/npm/lib/shrinkwrap.js +++ b/deps/npm/lib/shrinkwrap.js @@ -4,13 +4,12 @@ const BB = require('bluebird') const chain = require('slide').chain const detectIndent = require('detect-indent') -const fs = BB.promisifyAll(require('graceful-fs')) +const readFile = BB.promisify(require('graceful-fs').readFile) const getRequested = require('./install/get-requested.js') const id = require('./install/deps.js') const iferr = require('iferr') -const isDevDep = require('./install/is-dev-dep.js') -const isOptDep = require('./install/is-opt-dep.js') -const isProdDep = require('./install/is-prod-dep.js') +const isOnlyOptional = require('./install/is-only-optional.js') +const isOnlyDev = require('./install/is-only-dev.js') const lifecycle = require('./utils/lifecycle.js') const log = require('npmlog') const moduleName = require('./utils/module-name.js') @@ -21,6 +20,7 @@ const readPackageTree = BB.promisify(require('read-package-tree')) const ssri = require('ssri') const validate = require('aproba') const writeFileAtomic = require('write-file-atomic') +const unixFormatPath = require('./utils/unix-format-path.js') const PKGLOCK = 'package-lock.json' const SHRINKWRAP = 'npm-shrinkwrap.json' @@ -47,7 +47,7 @@ function shrinkwrap (args, silent, cb) { { Promise: BB } ).then(() => { log.notice('', `${PKGLOCK} has been renamed to ${SHRINKWRAP}. ${SHRINKWRAP} will be used for future installations.`) - return fs.readFileAsync(path.resolve(npm.prefix, SHRINKWRAP)).then((d) => { + return readFile(path.resolve(npm.prefix, SHRINKWRAP)).then((d) => { return JSON.parse(d) }) }, (err) => { @@ -90,6 +90,7 @@ function treeToShrinkwrap (tree) { if (tree.package.name) pkginfo.name = tree.package.name if (tree.package.version) pkginfo.version = tree.package.version if (tree.children.length) { + pkginfo.requires = true shrinkwrapDeps(pkginfo.dependencies = {}, tree, tree) } return pkginfo @@ -97,34 +98,28 @@ function treeToShrinkwrap (tree) { function shrinkwrapDeps (deps, top, tree, seen) { validate('OOO', [deps, top, tree]) - if (!seen) seen = {} - if (seen[tree.path]) return - seen[tree.path] = true + if (!seen) seen = new Set() + if (seen.has(tree)) return + seen.add(tree) tree.children.sort(function (aa, bb) { return moduleName(aa).localeCompare(moduleName(bb)) }).forEach(function (child) { - var childIsOnlyDev = isOnlyDev(child) if (child.fakeChild) { deps[moduleName(child)] = child.fakeChild return } + var childIsOnlyDev = isOnlyDev(child) var pkginfo = deps[moduleName(child)] = {} - var req = child.package._requested || getRequested(child) - if (req.type === 'directory' || req.type === 'file') { - pkginfo.version = 'file:' + path.relative(top.path, child.package._resolved || req.fetchSpec) - } else if (!req.registry && !child.fromBundle) { - pkginfo.version = child.package._resolved || req.saveSpec || req.rawSpec - } else { - pkginfo.version = child.package.version - } + var requested = child.package._requested || getRequested(child) || {} + pkginfo.version = childVersion(top, child, requested) if (child.fromBundle || child.isInLink) { pkginfo.bundled = true } else { - if (req.registry) { + if (requested.registry) { pkginfo.resolved = child.package._resolved } // no integrity for git deps as integirty hashes are based on the // tarball and we can't (yet) create consistent tarballs from a stable // source. - if (req.type !== 'git') { + if (requested.type !== 'git') { pkginfo.integrity = child.package._integrity if (!pkginfo.integrity && child.package._shasum) { pkginfo.integrity = ssri.fromHex(child.package._shasum, 'sha1') @@ -132,7 +127,14 @@ function shrinkwrapDeps (deps, top, tree, seen) { } } if (childIsOnlyDev) pkginfo.dev = true - if (isOptional(child)) pkginfo.optional = true + if (isOnlyOptional(child)) pkginfo.optional = true + if (child.requires.length) { + pkginfo.requires = {} + child.requires.sort((a, b) => moduleName(a).localeCompare(moduleName(b))).forEach((required) => { + var requested = required.package._requested || getRequested(required) || {} + pkginfo.requires[moduleName(required)] = childVersion(top, required, requested) + }) + } if (child.children.length) { pkginfo.dependencies = {} shrinkwrapDeps(pkginfo.dependencies, top, child, seen) @@ -140,6 +142,16 @@ function shrinkwrapDeps (deps, top, tree, seen) { }) } +function childVersion (top, child, req) { + if (req.type === 'directory' || req.type === 'file') { + return 'file:' + unixFormatPath(path.relative(top.path, child.package._resolved || req.fetchSpec)) + } else if (!req.registry && !child.fromBundle) { + return child.package._resolved || req.saveSpec || req.rawSpec + } else { + return child.package.version + } +} + function shrinkwrap_ (dir, pkginfo, opts, cb) { save(dir, pkginfo, opts, cb) } @@ -163,14 +175,20 @@ function save (dir, pkginfo, opts, cb) { ) const updated = updateLockfileMetadata(pkginfo, pkg && pkg.data) const swdata = JSON.stringify(updated, null, info.indent) + '\n' - writeFileAtomic(info.path, swdata, (err) => { - if (err) return cb(err) - if (opts.silent) return cb(null, pkginfo) - if (!shrinkwrap && !lockfile) { - log.notice('', `created a lockfile as ${path.basename(info.path)}. You should commit this file.`) - } + if (swdata === info.raw) { + // skip writing if file is identical + log.verbose('shrinkwrap', `skipping write for ${path.basename(info.path)} because there were no changes.`) cb(null, pkginfo) - }) + } else { + writeFileAtomic(info.path, swdata, (err) => { + if (err) return cb(err) + if (opts.silent) return cb(null, pkginfo) + if (!shrinkwrap && !lockfile) { + log.notice('', `created a lockfile as ${path.basename(info.path)}. You should commit this file.`) + } + cb(null, pkginfo) + }) + } } ).then((file) => { }, cb) @@ -211,56 +229,15 @@ function updateLockfileMetadata (pkginfo, pkgJson) { function checkPackageFile (dir, name) { const file = path.resolve(dir, name) - return fs.readFileAsync( + return readFile( file, 'utf8' ).then((data) => { return { path: file, + raw: data, data: JSON.parse(data), indent: detectIndent(data).indent || 2 } }).catch({code: 'ENOENT'}, () => {}) } -// Returns true if the module `node` is only required direcctly as a dev -// dependency of the top level or transitively _from_ top level dev -// dependencies. -// Dual mode modules (that are both dev AND prod) should return false. -function isOnlyDev (node, seen) { - if (!seen) seen = {} - return node.requiredBy.length && node.requiredBy.every(andIsOnlyDev(moduleName(node), seen)) -} - -// There is a known limitation with this implementation: If a dependency is -// ONLY required by cycles that are detached from the top level then it will -// ultimately return true. -// -// This is ok though: We don't allow shrinkwraps with extraneous deps and -// these situation is caught by the extraneous checker before we get here. -function andIsOnlyDev (name, seen) { - return function (req) { - var isDev = isDevDep(req, name) - var isProd = isProdDep(req, name) - if (req.isTop) { - return isDev && !isProd - } else { - if (seen[req.path]) return true - seen[req.path] = true - return isOnlyDev(req, seen) - } - } -} - -function isOptional (node, seen) { - if (!seen) seen = {} - // If a node is not required by anything, then we've reached - // the top level package. - if (seen[node.path] || node.requiredBy.length === 0) { - return false - } - seen[node.path] = true - - return node.requiredBy.every(function (req) { - return isOptDep(req, node.package.name) || isOptional(req, seen) - }) -} diff --git a/deps/npm/lib/uninstall.js b/deps/npm/lib/uninstall.js index c181fdc4e8200e..333d3e9d69c3c9 100644 --- a/deps/npm/lib/uninstall.js +++ b/deps/npm/lib/uninstall.js @@ -52,7 +52,6 @@ class Uninstaller extends Installer { constructor (where, dryrun, args) { super(where, dryrun, args) this.remove = [] - this.fakeChildren = false } loadArgMetadata (next) { diff --git a/deps/npm/lib/utils/deep-sort-object.js b/deps/npm/lib/utils/deep-sort-object.js index a9971506997013..7499efc4bef533 100644 --- a/deps/npm/lib/utils/deep-sort-object.js +++ b/deps/npm/lib/utils/deep-sort-object.js @@ -1,16 +1,14 @@ 'use strict' var sortedObject = require('sorted-object') -module.exports = function deepSortObject (obj, sortBy) { +module.exports = function deepSortObject (obj) { if (obj == null || typeof obj !== 'object') return obj if (obj instanceof Array) { - return obj.map(function (x) { - return deepSortObject(x, sortBy) - }) + return obj.map(deepSortObject) } obj = sortedObject(obj) Object.keys(obj).forEach(function (key) { - obj[key] = deepSortObject(obj[key], sortBy) + obj[key] = deepSortObject(obj[key]) }) return obj } diff --git a/deps/npm/lib/utils/error-handler.js b/deps/npm/lib/utils/error-handler.js index b13d42e1df451f..52a675bea640ad 100644 --- a/deps/npm/lib/utils/error-handler.js +++ b/deps/npm/lib/utils/error-handler.js @@ -135,7 +135,9 @@ function exit (code, noLog) { // for whatever reason gets thrown away, instead of leaving the CLI open // // Commands that expect long-running actions should just delay `cb()` - process.exit(code) + process.stdout.write('', () => { + process.exit(code) + }) } } diff --git a/deps/npm/lib/utils/git.js b/deps/npm/lib/utils/git.js index 4d05c75b867e37..6770853dd9622a 100644 --- a/deps/npm/lib/utils/git.js +++ b/deps/npm/lib/utils/git.js @@ -1,25 +1,28 @@ -// handle some git configuration for windows +'use strict' + +const BB = require('bluebird') + +const exec = require('child_process').execFile +const spawn = require('./spawn') +const npm = require('../npm.js') +const which = require('which') +const git = npm.config.get('git') +const assert = require('assert') +const log = require('npmlog') +const noProgressTillDone = require('./no-progress-while-running.js').tillDone exports.spawn = spawnGit +exports.exec = BB.promisify(execGit) exports.chainableExec = chainableExec exports.whichAndExec = whichAndExec -var exec = require('child_process').execFile -var spawn = require('./spawn') -var npm = require('../npm.js') -var which = require('which') -var git = npm.config.get('git') -var assert = require('assert') -var log = require('npmlog') -var noProgressTillDone = require('./no-progress-while-running.js').tillDone - function prefixGitArgs () { return process.platform === 'win32' ? ['-c', 'core.longpaths=true'] : [] } function execGit (args, options, cb) { log.info('git', args) - var fullArgs = prefixGitArgs().concat(args || []) + const fullArgs = prefixGitArgs().concat(args || []) return exec(git, fullArgs, options, noProgressTillDone(cb)) } diff --git a/deps/npm/lib/utils/lifecycle.js b/deps/npm/lib/utils/lifecycle.js index f8b34d7befada4..412c1c69448a9a 100644 --- a/deps/npm/lib/utils/lifecycle.js +++ b/deps/npm/lib/utils/lifecycle.js @@ -60,6 +60,8 @@ function lifecycle (pkg, stage, wd, unsafe, failOk, cb) { delete pkg.scripts.prepublish } + if (!pkg.scripts[stage]) return cb() + validWd(wd || path.resolve(npm.dir, pkg.name), function (er, wd) { if (er) return cb(er) @@ -262,7 +264,11 @@ function runCmd_ (cmd, pkg, env, wd, stage, unsafe, uid, gid, cb_) { var sh = 'sh' var shFlag = '-c' - if (process.platform === 'win32') { + var customShell = npm.config.get('script-shell') + + if (customShell) { + sh = customShell + } else if (process.platform === 'win32') { sh = process.env.comspec || 'cmd' shFlag = '/d /s /c' conf.windowsVerbatimArguments = true diff --git a/deps/npm/lib/utils/move.js b/deps/npm/lib/utils/move.js index 242e87d37fce66..d564962c219411 100644 --- a/deps/npm/lib/utils/move.js +++ b/deps/npm/lib/utils/move.js @@ -1,19 +1,12 @@ 'use strict' module.exports = wrappedMove -var fs = require('graceful-fs') -var move = require('move-concurrently') -var Bluebird = require('bluebird') +const fs = require('graceful-fs') +const move = require('move-concurrently') +const Bluebird = require('bluebird') -function wrappedMove (from, to, cb) { - var movePromise = move(from, to, {fs: fs, Promise: Bluebird, maxConcurrency: 4}) - if (cb) { - return movePromise.then(function (value) { - cb(value) - }, function (err) { - cb(err) - }) - } else { - return movePromise - } +const options = {fs: fs, Promise: Bluebird, maxConcurrency: 4} + +function wrappedMove (from, to) { + return move(from, to, options) } diff --git a/deps/npm/lib/utils/tar.js b/deps/npm/lib/utils/tar.js index ebbee025a27540..12719e37e290ab 100644 --- a/deps/npm/lib/utils/tar.js +++ b/deps/npm/lib/utils/tar.js @@ -185,11 +185,11 @@ function pack_ (tarball, folder, tree, pkg, cb) { var pkg = tree.children.filter(nameMatch(name))[0] if (!pkg) return false var requiredBy = [].concat(pkg.requiredBy) - var seen = {} + var seen = new Set() while (requiredBy.length) { var reqPkg = requiredBy.shift() - if (seen[reqPkg.path]) continue - seen[reqPkg.path] = true + if (seen.has(reqPkg)) continue + seen.add(reqPkg) if (!reqPkg) continue if (reqPkg.parent === tree && bd.indexOf(moduleName(reqPkg)) !== -1) { return true diff --git a/deps/npm/lib/utils/unix-format-path.js b/deps/npm/lib/utils/unix-format-path.js new file mode 100644 index 00000000000000..a82cd7135cc2c9 --- /dev/null +++ b/deps/npm/lib/utils/unix-format-path.js @@ -0,0 +1,5 @@ +'use strict' + +module.exports = function (path) { + return path.replace(/\\/g, '/') +} diff --git a/deps/npm/lib/version.js b/deps/npm/lib/version.js index 42f7d2a68d2570..c52b5158a03398 100644 --- a/deps/npm/lib/version.js +++ b/deps/npm/lib/version.js @@ -4,7 +4,8 @@ const BB = require('bluebird') const assert = require('assert') const chain = require('slide').chain const detectIndent = require('detect-indent') -const fs = BB.promisifyAll(require('graceful-fs')) +const fs = require('graceful-fs') +const readFile = BB.promisify(require('graceful-fs').readFile) const git = require('./utils/git.js') const lifecycle = require('./utils/lifecycle.js') const log = require('npmlog') @@ -151,7 +152,7 @@ const SHRINKWRAP = 'npm-shrinkwrap.json' const PKGLOCK = 'package-lock.json' function readLockfile (name) { - return fs.readFileAsync( + return readFile( path.join(npm.localPrefix, name), 'utf8' ).catch({code: 'ENOENT'}, () => null) } @@ -278,26 +279,38 @@ function checkGit (localData, cb) { } function _commit (version, localData, cb) { - var packagePath = path.join(npm.localPrefix, 'package.json') - var options = { env: process.env } - var message = npm.config.get('message').replace(/%s/g, version) - var sign = npm.config.get('sign-git-tag') - var flag = sign ? '-sm' : '-am' - chain( - [ - git.chainableExec([ 'add', packagePath ], options), - localData.hasShrinkwrap && git.chainableExec([ 'add', path.join(npm.localPrefix, 'npm-shrinkwrap.json') ], options), - localData.hasPackageLock && git.chainableExec([ 'add', path.join(npm.localPrefix, 'package-lock.json') ], options), - git.chainableExec([ 'commit', '-m', message ], options), - !localData.existingTag && git.chainableExec([ - 'tag', - npm.config.get('tag-version-prefix') + version, - flag, - message + const options = { env: process.env } + const message = npm.config.get('message').replace(/%s/g, version) + const sign = npm.config.get('sign-git-tag') + const flagForTag = sign ? '-sm' : '-am' + + stagePackageFiles(localData, options).then(() => { + return git.exec([ 'commit', '-m', message ], options) + }).then(() => { + if (!localData.existingTag) { + return git.exec([ + 'tag', npm.config.get('tag-version-prefix') + version, + flagForTag, message ], options) - ], - cb - ) + } + }).nodeify(cb) +} + +function stagePackageFiles (localData, options) { + return addLocalFile('package.json', options, false).then(() => { + if (localData.hasShrinkwrap) { + return addLocalFile('npm-shrinkwrap.json', options, false) + } else if (localData.hasPackageLock) { + return addLocalFile('package-lock.json', options, false) + } + }) +} + +function addLocalFile (file, options, ignoreFailure) { + const p = git.exec(['add', path.join(npm.localPrefix, file)], options) + return ignoreFailure + ? p.catch(() => {}) + : p } function write (data, file, indent, cb) { diff --git a/deps/npm/man/man1/npm-README.1 b/deps/npm/man/man1/npm-README.1 index 0c2fbb6faa2483..7d44d1c1510c70 100644 --- a/deps/npm/man/man1/npm-README.1 +++ b/deps/npm/man/man1/npm-README.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "June 2017" "" "" +.TH "NPM" "1" "July 2017" "" "" .SH "NAME" \fBnpm\fR \- a JavaScript package manager .P @@ -162,8 +162,9 @@ https://github\.com/npm/npm/issues Be sure to include \fIall\fR of the output from the npm command that didn't work as expected\. The \fBnpm\-debug\.log\fP file is also helpful to provide\. .P -You can also look for isaacs in #node\.js on irc://irc\.freenode\.net\. She -will no doubt tell you to put the output in a gist or email\. +You can also find npm people in \fB#npm\fP on https://package\.community/ or +on Twitter \fIhttps://twitter\.com/npm_support\fR\|\. Whoever responds will no +doubt tell you to put the output in a gist or email\. .SH SEE ALSO .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1 index d2a7a9fa00d160..2f86c385448760 100644 --- a/deps/npm/man/man1/npm-access.1 +++ b/deps/npm/man/man1/npm-access.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ACCESS" "1" "June 2017" "" "" +.TH "NPM\-ACCESS" "1" "July 2017" "" "" .SH "NAME" \fBnpm-access\fR \- Set access level on published packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-adduser.1 b/deps/npm/man/man1/npm-adduser.1 index 64b037402f0d22..b90fd9ebd52583 100644 --- a/deps/npm/man/man1/npm-adduser.1 +++ b/deps/npm/man/man1/npm-adduser.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ADDUSER" "1" "June 2017" "" "" +.TH "NPM\-ADDUSER" "1" "July 2017" "" "" .SH "NAME" \fBnpm-adduser\fR \- Add a registry user account .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-bin.1 b/deps/npm/man/man1/npm-bin.1 index e6a15a467c3311..9571db127a6eb9 100644 --- a/deps/npm/man/man1/npm-bin.1 +++ b/deps/npm/man/man1/npm-bin.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BIN" "1" "June 2017" "" "" +.TH "NPM\-BIN" "1" "July 2017" "" "" .SH "NAME" \fBnpm-bin\fR \- Display npm bin folder .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index 860d5299ca0891..7126fda85fc2e9 100644 --- a/deps/npm/man/man1/npm-bugs.1 +++ b/deps/npm/man/man1/npm-bugs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUGS" "1" "June 2017" "" "" +.TH "NPM\-BUGS" "1" "July 2017" "" "" .SH "NAME" \fBnpm-bugs\fR \- Bugs for a package in a web browser maybe .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-build.1 b/deps/npm/man/man1/npm-build.1 index 322d8c069e7e7f..909ea651051a05 100644 --- a/deps/npm/man/man1/npm-build.1 +++ b/deps/npm/man/man1/npm-build.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUILD" "1" "June 2017" "" "" +.TH "NPM\-BUILD" "1" "July 2017" "" "" .SH "NAME" \fBnpm-build\fR \- Build a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-bundle.1 b/deps/npm/man/man1/npm-bundle.1 index c8d8f8686b3e2f..522dcc1a366353 100644 --- a/deps/npm/man/man1/npm-bundle.1 +++ b/deps/npm/man/man1/npm-bundle.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUNDLE" "1" "June 2017" "" "" +.TH "NPM\-BUNDLE" "1" "July 2017" "" "" .SH "NAME" \fBnpm-bundle\fR \- REMOVED .SH DESCRIPTION diff --git a/deps/npm/man/man1/npm-cache.1 b/deps/npm/man/man1/npm-cache.1 index 41d84cba055dd3..9309a00a61290d 100644 --- a/deps/npm/man/man1/npm-cache.1 +++ b/deps/npm/man/man1/npm-cache.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CACHE" "1" "June 2017" "" "" +.TH "NPM\-CACHE" "1" "July 2017" "" "" .SH "NAME" \fBnpm-cache\fR \- Manipulates packages cache .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-completion.1 b/deps/npm/man/man1/npm-completion.1 index 11b4d11b1f1df2..cd3343d7f66e19 100644 --- a/deps/npm/man/man1/npm-completion.1 +++ b/deps/npm/man/man1/npm-completion.1 @@ -1,4 +1,4 @@ -.TH "NPM\-COMPLETION" "1" "June 2017" "" "" +.TH "NPM\-COMPLETION" "1" "July 2017" "" "" .SH "NAME" \fBnpm-completion\fR \- Tab Completion for npm .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-config.1 b/deps/npm/man/man1/npm-config.1 index 265aff01c6cd01..e98d3b52be613f 100644 --- a/deps/npm/man/man1/npm-config.1 +++ b/deps/npm/man/man1/npm-config.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "1" "June 2017" "" "" +.TH "NPM\-CONFIG" "1" "July 2017" "" "" .SH "NAME" \fBnpm-config\fR \- Manage the npm configuration files .SH SYNOPSIS @@ -8,7 +8,7 @@ npm config set [\-g|\-\-global] npm config get npm config delete -npm config list +npm config list [\-l] npm config edit npm get npm set [\-g|\-\-global] @@ -59,7 +59,7 @@ npm config list .fi .RE .P -Show all the config settings\. +Show all the config settings\. Use \fB\-l\fP to also show defaults\. .SS delete .P .RS 2 diff --git a/deps/npm/man/man1/npm-dedupe.1 b/deps/npm/man/man1/npm-dedupe.1 index d0962471d801b9..ffce7a43283bb0 100644 --- a/deps/npm/man/man1/npm-dedupe.1 +++ b/deps/npm/man/man1/npm-dedupe.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEDUPE" "1" "June 2017" "" "" +.TH "NPM\-DEDUPE" "1" "July 2017" "" "" .SH "NAME" \fBnpm-dedupe\fR \- Reduce duplication .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1 index 2b26e9fc56fe18..f3f103bdf17a20 100644 --- a/deps/npm/man/man1/npm-deprecate.1 +++ b/deps/npm/man/man1/npm-deprecate.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEPRECATE" "1" "June 2017" "" "" +.TH "NPM\-DEPRECATE" "1" "July 2017" "" "" .SH "NAME" \fBnpm-deprecate\fR \- Deprecate a version of a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-dist-tag.1 b/deps/npm/man/man1/npm-dist-tag.1 index 3142da944ff0e5..3167e8e6cd7f37 100644 --- a/deps/npm/man/man1/npm-dist-tag.1 +++ b/deps/npm/man/man1/npm-dist-tag.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DIST\-TAG" "1" "June 2017" "" "" +.TH "NPM\-DIST\-TAG" "1" "July 2017" "" "" .SH "NAME" \fBnpm-dist-tag\fR \- Modify package distribution tags .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-docs.1 b/deps/npm/man/man1/npm-docs.1 index c97b912e184337..84881635a07bb4 100644 --- a/deps/npm/man/man1/npm-docs.1 +++ b/deps/npm/man/man1/npm-docs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCS" "1" "June 2017" "" "" +.TH "NPM\-DOCS" "1" "July 2017" "" "" .SH "NAME" \fBnpm-docs\fR \- Docs for a package in a web browser maybe .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-doctor.1 b/deps/npm/man/man1/npm-doctor.1 index 787b9d42198cd9..7a0b057b75f9a6 100644 --- a/deps/npm/man/man1/npm-doctor.1 +++ b/deps/npm/man/man1/npm-doctor.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCTOR" "1" "June 2017" "" "" +.TH "NPM\-DOCTOR" "1" "July 2017" "" "" .SH "NAME" \fBnpm-doctor\fR \- Check your environments .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-edit.1 b/deps/npm/man/man1/npm-edit.1 index 978a4e54f3e680..63cdeb77ca5294 100644 --- a/deps/npm/man/man1/npm-edit.1 +++ b/deps/npm/man/man1/npm-edit.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EDIT" "1" "June 2017" "" "" +.TH "NPM\-EDIT" "1" "July 2017" "" "" .SH "NAME" \fBnpm-edit\fR \- Edit an installed package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-explore.1 b/deps/npm/man/man1/npm-explore.1 index d5cf964ecb2a71..ac993ff4dd6c3d 100644 --- a/deps/npm/man/man1/npm-explore.1 +++ b/deps/npm/man/man1/npm-explore.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EXPLORE" "1" "June 2017" "" "" +.TH "NPM\-EXPLORE" "1" "July 2017" "" "" .SH "NAME" \fBnpm-explore\fR \- Browse an installed package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-help-search.1 b/deps/npm/man/man1/npm-help-search.1 index d54f316542229a..0d7971406a751e 100644 --- a/deps/npm/man/man1/npm-help-search.1 +++ b/deps/npm/man/man1/npm-help-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP\-SEARCH" "1" "June 2017" "" "" +.TH "NPM\-HELP\-SEARCH" "1" "July 2017" "" "" .SH "NAME" \fBnpm-help-search\fR \- Search npm help documentation .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-help.1 b/deps/npm/man/man1/npm-help.1 index a102985b9f240a..224d45a35d1faa 100644 --- a/deps/npm/man/man1/npm-help.1 +++ b/deps/npm/man/man1/npm-help.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP" "1" "June 2017" "" "" +.TH "NPM\-HELP" "1" "July 2017" "" "" .SH "NAME" \fBnpm-help\fR \- Get help on npm .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1 index c8ccd94b7b866d..38bf391be8e71a 100644 --- a/deps/npm/man/man1/npm-init.1 +++ b/deps/npm/man/man1/npm-init.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INIT" "1" "June 2017" "" "" +.TH "NPM\-INIT" "1" "July 2017" "" "" .SH "NAME" \fBnpm-init\fR \- Interactively create a package\.json file .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-install-test.1 b/deps/npm/man/man1/npm-install-test.1 index 3bdd4c632b95f0..af1356d6093f7c 100644 --- a/deps/npm/man/man1/npm-install-test.1 +++ b/deps/npm/man/man1/npm-install-test.1 @@ -1,4 +1,4 @@ -.TH "NPM" "" "June 2017" "" "" +.TH "NPM" "" "July 2017" "" "" .SH "NAME" \fBnpm\fR .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index e90cc4f8f40c68..b33c7e8f8ec40b 100644 --- a/deps/npm/man/man1/npm-install.1 +++ b/deps/npm/man/man1/npm-install.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL" "1" "June 2017" "" "" +.TH "NPM\-INSTALL" "1" "July 2017" "" "" .SH "NAME" \fBnpm-install\fR \- Install a package .SH SYNOPSIS @@ -393,6 +393,9 @@ being installed\. The \fB\-\-no\-shrinkwrap\fP argument, which will ignore an available package lock or shrinkwrap file and use the package\.json instead\. .P +The \fB\-\-no\-package\-lock\fP argument will prevent npm from creating a +\fBpackage\-lock\.json\fP file\. +.P The \fB\-\-nodedir=/path/to/node/source\fP argument will allow npm to find the node source code so that npm can compile native modules\. .P diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1 index b5b1d25098f32a..a1fa966c0f61c2 100644 --- a/deps/npm/man/man1/npm-link.1 +++ b/deps/npm/man/man1/npm-link.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LINK" "1" "June 2017" "" "" +.TH "NPM\-LINK" "1" "July 2017" "" "" .SH "NAME" \fBnpm-link\fR \- Symlink a package folder .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-logout.1 b/deps/npm/man/man1/npm-logout.1 index 1bb0d25ce53c70..74c22144648bfe 100644 --- a/deps/npm/man/man1/npm-logout.1 +++ b/deps/npm/man/man1/npm-logout.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LOGOUT" "1" "June 2017" "" "" +.TH "NPM\-LOGOUT" "1" "July 2017" "" "" .SH "NAME" \fBnpm-logout\fR \- Log out of the registry .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index bf339ee70ca67b..5c6744e450035d 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LS" "1" "June 2017" "" "" +.TH "NPM\-LS" "1" "July 2017" "" "" .SH "NAME" \fBnpm-ls\fR \- List installed packages .SH SYNOPSIS @@ -22,7 +22,7 @@ For example, running \fBnpm ls promzard\fP in npm's source tree will show: .P .RS 2 .nf -npm@5.0.3 /path/to/npm +npm@5.3.0 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi @@ -118,6 +118,16 @@ Type: String When "dev" or "development", is an alias to \fBdev\fP\|\. .P When "prod" or "production", is an alias to \fBproduction\fP\|\. +.SS link +.RS 0 +.IP \(bu 2 +Type: Boolean +.IP \(bu 2 +Default: false + +.RE +.P +Display only dependencies which are linked .SH SEE ALSO .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-outdated.1 b/deps/npm/man/man1/npm-outdated.1 index 992c359dcbabb9..ccd38acb170afa 100644 --- a/deps/npm/man/man1/npm-outdated.1 +++ b/deps/npm/man/man1/npm-outdated.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OUTDATED" "1" "June 2017" "" "" +.TH "NPM\-OUTDATED" "1" "July 2017" "" "" .SH "NAME" \fBnpm-outdated\fR \- Check for outdated packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-owner.1 b/deps/npm/man/man1/npm-owner.1 index 9eb713bd666d00..62be1bdcd03d61 100644 --- a/deps/npm/man/man1/npm-owner.1 +++ b/deps/npm/man/man1/npm-owner.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OWNER" "1" "June 2017" "" "" +.TH "NPM\-OWNER" "1" "July 2017" "" "" .SH "NAME" \fBnpm-owner\fR \- Manage package owners .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-pack.1 b/deps/npm/man/man1/npm-pack.1 index 634d3e84094c59..2e70602351b2ee 100644 --- a/deps/npm/man/man1/npm-pack.1 +++ b/deps/npm/man/man1/npm-pack.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PACK" "1" "June 2017" "" "" +.TH "NPM\-PACK" "1" "July 2017" "" "" .SH "NAME" \fBnpm-pack\fR \- Create a tarball from a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-ping.1 b/deps/npm/man/man1/npm-ping.1 index e14fa450d97268..33693a1a5c3942 100644 --- a/deps/npm/man/man1/npm-ping.1 +++ b/deps/npm/man/man1/npm-ping.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PING" "1" "June 2017" "" "" +.TH "NPM\-PING" "1" "July 2017" "" "" .SH "NAME" \fBnpm-ping\fR \- Ping npm registry .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-prefix.1 b/deps/npm/man/man1/npm-prefix.1 index 46d06910454ac2..27fb7e9ef49b7a 100644 --- a/deps/npm/man/man1/npm-prefix.1 +++ b/deps/npm/man/man1/npm-prefix.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PREFIX" "1" "June 2017" "" "" +.TH "NPM\-PREFIX" "1" "July 2017" "" "" .SH "NAME" \fBnpm-prefix\fR \- Display prefix .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-prune.1 b/deps/npm/man/man1/npm-prune.1 index c8051b36e8ed9d..3317b213c2a1a7 100644 --- a/deps/npm/man/man1/npm-prune.1 +++ b/deps/npm/man/man1/npm-prune.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PRUNE" "1" "June 2017" "" "" +.TH "NPM\-PRUNE" "1" "July 2017" "" "" .SH "NAME" \fBnpm-prune\fR \- Remove extraneous packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1 index 5095939be6ad8d..1529f1b2f31f13 100644 --- a/deps/npm/man/man1/npm-publish.1 +++ b/deps/npm/man/man1/npm-publish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PUBLISH" "1" "June 2017" "" "" +.TH "NPM\-PUBLISH" "1" "July 2017" "" "" .SH "NAME" \fBnpm-publish\fR \- Publish a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1 index 7cb888b260d7c0..15bcaf92d3469f 100644 --- a/deps/npm/man/man1/npm-rebuild.1 +++ b/deps/npm/man/man1/npm-rebuild.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REBUILD" "1" "June 2017" "" "" +.TH "NPM\-REBUILD" "1" "July 2017" "" "" .SH "NAME" \fBnpm-rebuild\fR \- Rebuild a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1 index cf2c9f7f5797a9..a1732297cecdde 100644 --- a/deps/npm/man/man1/npm-repo.1 +++ b/deps/npm/man/man1/npm-repo.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REPO" "1" "June 2017" "" "" +.TH "NPM\-REPO" "1" "July 2017" "" "" .SH "NAME" \fBnpm-repo\fR \- Open package repository page in the browser .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-restart.1 b/deps/npm/man/man1/npm-restart.1 index 7a0c40d0502ddb..bb78c0248283a8 100644 --- a/deps/npm/man/man1/npm-restart.1 +++ b/deps/npm/man/man1/npm-restart.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RESTART" "1" "June 2017" "" "" +.TH "NPM\-RESTART" "1" "July 2017" "" "" .SH "NAME" \fBnpm-restart\fR \- Restart a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1 index fd30fb7cac442a..bc704262e4e5c5 100644 --- a/deps/npm/man/man1/npm-root.1 +++ b/deps/npm/man/man1/npm-root.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ROOT" "1" "June 2017" "" "" +.TH "NPM\-ROOT" "1" "July 2017" "" "" .SH "NAME" \fBnpm-root\fR \- Display npm root .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1 index eaffbefc0ff5fa..6219b27a3c4f67 100644 --- a/deps/npm/man/man1/npm-run-script.1 +++ b/deps/npm/man/man1/npm-run-script.1 @@ -1,11 +1,11 @@ -.TH "NPM\-RUN\-SCRIPT" "1" "June 2017" "" "" +.TH "NPM\-RUN\-SCRIPT" "1" "July 2017" "" "" .SH "NAME" \fBnpm-run-script\fR \- Run arbitrary package scripts .SH SYNOPSIS .P .RS 2 .nf -npm run\-script [\-\- \.\.\.] +npm run\-script [\-\-silent] [\-\- \.\.\.] alias: npm run .fi @@ -60,6 +60,8 @@ not found in the \fBPATH\fP\|\. .P If you try to run a script without having a \fBnode_modules\fP directory and it fails, you will be given a warning to run \fBnpm install\fP, just in case you've forgotten\. +.P +You can use the \fB\-\-silent\fP flag to prevent showing \fBnpm ERR!\fP output on error\. .SH SEE ALSO .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1 index 89cb716d847a1a..190b75a34e44e6 100644 --- a/deps/npm/man/man1/npm-search.1 +++ b/deps/npm/man/man1/npm-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SEARCH" "1" "June 2017" "" "" +.TH "NPM\-SEARCH" "1" "July 2017" "" "" .SH "NAME" \fBnpm-search\fR \- Search for packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-shrinkwrap.1 b/deps/npm/man/man1/npm-shrinkwrap.1 index d6d12bf1676774..ad4a78d3e7d5f7 100644 --- a/deps/npm/man/man1/npm-shrinkwrap.1 +++ b/deps/npm/man/man1/npm-shrinkwrap.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP" "1" "June 2017" "" "" +.TH "NPM\-SHRINKWRAP" "1" "July 2017" "" "" .SH "NAME" \fBnpm-shrinkwrap\fR \- Lock down dependency versions for publication .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1 index a04ce7363e2d7f..b325ff0ea1e423 100644 --- a/deps/npm/man/man1/npm-star.1 +++ b/deps/npm/man/man1/npm-star.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STAR" "1" "June 2017" "" "" +.TH "NPM\-STAR" "1" "July 2017" "" "" .SH "NAME" \fBnpm-star\fR \- Mark your favorite packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-stars.1 b/deps/npm/man/man1/npm-stars.1 index face66764b542e..92e5bf7a4e6a20 100644 --- a/deps/npm/man/man1/npm-stars.1 +++ b/deps/npm/man/man1/npm-stars.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STARS" "1" "June 2017" "" "" +.TH "NPM\-STARS" "1" "July 2017" "" "" .SH "NAME" \fBnpm-stars\fR \- View packages marked as favorites .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-start.1 b/deps/npm/man/man1/npm-start.1 index 0916970e0d247d..df0e1cd65b5575 100644 --- a/deps/npm/man/man1/npm-start.1 +++ b/deps/npm/man/man1/npm-start.1 @@ -1,4 +1,4 @@ -.TH "NPM\-START" "1" "June 2017" "" "" +.TH "NPM\-START" "1" "July 2017" "" "" .SH "NAME" \fBnpm-start\fR \- Start a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-stop.1 b/deps/npm/man/man1/npm-stop.1 index 430f3c117f5c66..30f2b67fc124da 100644 --- a/deps/npm/man/man1/npm-stop.1 +++ b/deps/npm/man/man1/npm-stop.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STOP" "1" "June 2017" "" "" +.TH "NPM\-STOP" "1" "July 2017" "" "" .SH "NAME" \fBnpm-stop\fR \- Stop a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-team.1 b/deps/npm/man/man1/npm-team.1 index b38561f7114732..1d398c9fdc14d8 100644 --- a/deps/npm/man/man1/npm-team.1 +++ b/deps/npm/man/man1/npm-team.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEAM" "1" "June 2017" "" "" +.TH "NPM\-TEAM" "1" "July 2017" "" "" .SH "NAME" \fBnpm-team\fR \- Manage organization teams and team memberships .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-test.1 b/deps/npm/man/man1/npm-test.1 index ad9fc14d558fab..a17682b38ea2a7 100644 --- a/deps/npm/man/man1/npm-test.1 +++ b/deps/npm/man/man1/npm-test.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEST" "1" "June 2017" "" "" +.TH "NPM\-TEST" "1" "July 2017" "" "" .SH "NAME" \fBnpm-test\fR \- Test a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-uninstall.1 b/deps/npm/man/man1/npm-uninstall.1 index 29df8f50f4f242..0863df058d4f26 100644 --- a/deps/npm/man/man1/npm-uninstall.1 +++ b/deps/npm/man/man1/npm-uninstall.1 @@ -1,11 +1,11 @@ -.TH "NPM\-UNINSTALL" "1" "June 2017" "" "" +.TH "NPM\-UNINSTALL" "1" "July 2017" "" "" .SH "NAME" \fBnpm-uninstall\fR \- Remove a package .SH SYNOPSIS .P .RS 2 .nf -npm uninstall [<@scope>/][@]\.\.\. [\-S|\-\-save|\-D|\-\-save\-dev|\-O|\-\-save\-optional] +npm uninstall [<@scope>/][@]\.\.\. [\-S|\-\-save|\-D|\-\-save\-dev|\-O|\-\-save\-optional|\-\-no\-save] aliases: remove, rm, r, un, unlink .fi @@ -35,6 +35,8 @@ the package version in your main package\.json: \fB\-D, \-\-save\-dev\fP: Package will be removed from your \fBdevDependencies\fP\|\. .IP \(bu 2 \fB\-O, \-\-save\-optional\fP: Package will be removed from your \fBoptionalDependencies\fP\|\. +.IP \(bu 2 +\fB\-\-no\-save\fP: Package will not be removed from your \fBpackage\.json\fP file\. .RE .P @@ -51,6 +53,7 @@ npm uninstall sax \-\-save npm uninstall @myorg/privatepackage \-\-save npm uninstall node\-tap \-\-save\-dev npm uninstall dtrace\-provider \-\-save\-optional +npm uninstall lodash \-\-no\-save .fi .RE .SH SEE ALSO diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1 index c3883a59498f0a..ce7f2147679fe9 100644 --- a/deps/npm/man/man1/npm-unpublish.1 +++ b/deps/npm/man/man1/npm-unpublish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNPUBLISH" "1" "June 2017" "" "" +.TH "NPM\-UNPUBLISH" "1" "July 2017" "" "" .SH "NAME" \fBnpm-unpublish\fR \- Remove a package from the registry .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-update.1 b/deps/npm/man/man1/npm-update.1 index 14bad07f5fedd4..24b07a1fd0b68e 100644 --- a/deps/npm/man/man1/npm-update.1 +++ b/deps/npm/man/man1/npm-update.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UPDATE" "1" "June 2017" "" "" +.TH "NPM\-UPDATE" "1" "July 2017" "" "" .SH "NAME" \fBnpm-update\fR \- Update a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index ae2678a8db610a..de93869d33704c 100644 --- a/deps/npm/man/man1/npm-version.1 +++ b/deps/npm/man/man1/npm-version.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VERSION" "1" "June 2017" "" "" +.TH "NPM\-VERSION" "1" "July 2017" "" "" .SH "NAME" \fBnpm-version\fR \- Bump a package version .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1 index 0bfedd6b8b9c36..503f71a9eceab7 100644 --- a/deps/npm/man/man1/npm-view.1 +++ b/deps/npm/man/man1/npm-view.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VIEW" "1" "June 2017" "" "" +.TH "NPM\-VIEW" "1" "July 2017" "" "" .SH "NAME" \fBnpm-view\fR \- View registry info .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1 index 8fdf66c2fc5b93..180b949747a6db 100644 --- a/deps/npm/man/man1/npm-whoami.1 +++ b/deps/npm/man/man1/npm-whoami.1 @@ -1,4 +1,4 @@ -.TH "NPM\-WHOAMI" "1" "June 2017" "" "" +.TH "NPM\-WHOAMI" "1" "July 2017" "" "" .SH "NAME" \fBnpm-whoami\fR \- Display npm username .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index e3771ad9facb2f..a626190edd9608 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "June 2017" "" "" +.TH "NPM" "1" "July 2017" "" "" .SH "NAME" \fBnpm\fR \- javascript package manager .SH SYNOPSIS @@ -10,7 +10,7 @@ npm [args] .RE .SH VERSION .P -5.0.3 +5.3.0 .SH DESCRIPTION .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man1/npx.1 b/deps/npm/man/man1/npx.1 new file mode 100644 index 00000000000000..f64614d36ec028 --- /dev/null +++ b/deps/npm/man/man1/npx.1 @@ -0,0 +1,167 @@ +.TH "NPX" "1" "July 2017" "npx@9.1.0" "User Commands" +.SH "NAME" +\fBnpx\fR \- execute npm package binaries +.SH SYNOPSIS +.P +\fBnpx [options] [@version] [command\-arg]\.\.\.\fP +.P +\fBnpx [options] [\-p|\-\-package ]\.\.\. [command\-arg]\.\.\.\fP +.P +\fBnpx [options] \-c ''\fP +.P +\fBnpx \-\-shell\-auto\-fallback [shell]\fP +.SH INSTALL +.P +\fBnpm install \-g npx\fP +.SH DESCRIPTION +.P +Executes \fB\fP either from a local \fBnode_modules/\.bin\fP, or from a central cache, installing any packages needed in order for \fB\fP to run\. +.P +By default, \fBnpx\fP will check whether \fB\fP exists in \fB$PATH\fP, or in the local project binaries, and execute that\. If \fB\fP is not found, it will be installed prior to execution\. +.P +Unless a \fB\-\-package\fP option is specified, \fBnpx\fP will try to guess the name of the binary to invoke depending on the specifier provided\. All package specifiers understood by \fBnpm\fP may be used with \fBnpx\fP, including git specifiers, remote tarballs, local directories, or scoped packages\. +.P +If a full specifier is included, or if \fB\-\-package\fP is used, npx will always use a freshly\-installed, temporary version of the package\. This can also be forced with the \fB\-\-ignore\-existing\fP flag\. +.RS 0 +.IP \(bu 2 +\fB\-p, \-\-package \fP \- define the package to be installed\. This defaults to the value of \fB\fP\|\. This is only needed for packages with multiple binaries if you want to call one of the other executables, or where the binary name does not match the package name\. If this option is provided \fB\fP will be executed as\-is, without interpreting \fB@version\fP if it's there\. Multiple \fB\-\-package\fP options may be provided, and all the packages specified will be installed\. +.IP \(bu 2 +\fB\-\-no\-install\fP \- If passed to \fBnpx\fP, it will only try to run \fB\fP if it already exists in the current path or in \fB$prefix/node_modules/\.bin\fP\|\. It won't try to install missing commands\. +.IP \(bu 2 +\fB\-\-cache \fP \- set the location of the npm cache\. Defaults to npm's own cache settings\. +.IP \(bu 2 +\fB\-\-userconfig \fP \- path to the user configuration file to pass to npm\. Defaults to whatever npm's current default is\. +.IP \(bu 2 +\fB\-c \fP \- Execute \fB\fP inside an \fBnpm run\-script\fP\-like shell environment, with all the usual environment variables available\. Only the first item in \fB\fP will be automatically used as \fB\fP\|\. Any others \fImust\fR use \fB\-p\fP\|\. +.IP \(bu 2 +\fB\-\-shell \fP \- The shell to invoke the command with, if any\. +.IP \(bu 2 +\fB\-\-shell\-auto\-fallback []\fP \- Generates shell code to override your shell's "command not found" handler with one that calls \fBnpx\fP\|\. Tries to figure out your shell, or you can pass its name (either \fBbash\fP, \fBfish\fP, or \fBzsh\fP) as an option\. See below for how to install\. +.IP \(bu 2 +\fB\-\-ignore\-existing\fP \- If this flag is set, npx will not look in \fB$PATH\fP, or in the current package's \fBnode_modules/\.bin\fP for an existing version before deciding whether to install\. Binaries in those paths will still be available for execution, but will be shadowed by any packages requested by this install\. +.IP \(bu 2 +\fB\-q, \-\-quiet\fP \- Suppressed any output from npx itself (progress bars, error messages, install reports)\. Subcommand output itself will not be silenced\. +.IP \(bu 2 +\fB\-n, \-\-node\-arg\fP \- Extra node argument to supply to node when binary is a node script\. You can supply this option multiple times to add more arguments\. +.IP \(bu 2 +\fB\-v, \-\-version\fP \- Show the current npx version\. + +.RE +.SH EXAMPLES +.SS Running a project\-local bin +.P +.RS 2 +.nf +$ npm i \-D webpack +$ npx webpack \.\.\. +.fi +.RE +.SS One\-off invocation without local installation +.P +.RS 2 +.nf +$ npm rm webpack +$ npx webpack \-\- \.\.\. +$ cat package\.json +\|\.\.\.webpack not in "devDependencies"\.\.\. +.fi +.RE +.SS Invoking a command from a github repository +.P +.RS 2 +.nf +$ npx github:piuccio/cowsay +\|\.\.\.or\.\.\. +$ npx git+ssh://my\.hosted\.git:cowsay\.git#semver:^1 +\|\.\.\.etc\.\.\. +.fi +.RE +.SS Execute a full shell command using one npx call w/ multiple packages +.P +.RS 2 +.nf +$ npx \-p lolcatjs \-p cowsay \-c \\ + 'echo "$npm_package_name@$npm_package_version" | cowsay | lolcatjs' +\|\.\.\. + _____ +< your\-cool\-package@1\.2\.3 > + \-\-\-\-\- + \\ ^__^ + \\ (oo)\\_______ + (__)\\ )\\/\\ + ||\-\-\-\-w | + || || +.fi +.RE +.SS Run node binary with \-\-inspect +.P +.RS 2 +.nf +$ npx \-\-node\-arg=\-\-inspect cowsay +Debugger listening on ws://127\.0\.0\.1:9229/\.\.\.\. +.fi +.RE +.SH SHELL AUTO FALLBACK +.P +You can configure \fBnpx\fP to run as your default fallback command when you type something in the command line with an \fB@\fP but the command is not found\. This includes installing packages that were not found in the local prefix either\. +.P +For example: +.P +.RS 2 +.nf +$ npm@4 \-\-version +(stderr) npm@4 not found\. Trying with npx\.\.\. +4\.6\.1 +$ asdfasdfasf +zsh: command not found: asfdasdfasdf +.fi +.RE +.P +Currently, \fBzsh\fP, \fBbash\fP (>= 4), and \fBfish\fP are supported\. You can access these completion scripts using \fBnpx \-\-shell\-auto\-fallback \fP\|\. +.P +To install permanently, add the relevant line below to your \fB~/\.bashrc\fP, \fB~/\.zshrc\fP, \fB~/\.config/fish/config\.fish\fP, or as needed\. To install just for the shell session, simply run the line\. +.P +You can optionally pass through \fB\-\-no\-install\fP when generating the fallback to prevent it from installing packages if the command is missing\. +.SS For bash@>=4: +.P +.RS 2 +.nf +$ source <(npx \-\-shell\-auto\-fallback bash) +.fi +.RE +.SS For zsh: +.P +.RS 2 +.nf +$ source <(npx \-\-shell\-auto\-fallback zsh) +.fi +.RE +.SS For fish: +.P +.RS 2 +.nf +$ source (npx \-\-shell\-auto\-fallback fish | psub) +.fi +.RE +.SH ACKNOWLEDGEMENTS +.P +Huge thanks to Kwyn Meagher \fIhttps://blog\.kwyn\.io\fR for generously donating the package name in the main npm registry\. Previously \fBnpx\fP was used for a Tessel board Neopixels library, which can now be found under \fBnpx\-tessel\fP \fIhttps://npm\.im/npx\-tessel\fR\|\. +.SH AUTHOR +.P +Written by Kat Marchan \fIhttps://github\.com/zkat\fR\|\. +.SH REPORTING BUGS +.P +Please file any relevant issues on Github\. \fIhttps://github\.com/zkat/npx\fR +.SH LICENSE +.P +This work is released by its authors into the public domain under CC0\-1\.0\. See \fBLICENSE\.md\fP for details\. +.SH SEE ALSO +.RS 0 +.IP \(bu 2 +\fBnpm(1)\fP +.IP \(bu 2 +\fBnpm\-run\-script(1)\fP +.IP \(bu 2 +\fBnpm\-config(7)\fP + +.RE diff --git a/deps/npm/man/man5/npm-folders.5 b/deps/npm/man/man5/npm-folders.5 index 194e6bcc02d474..2442ef30567171 100644 --- a/deps/npm/man/man5/npm-folders.5 +++ b/deps/npm/man/man5/npm-folders.5 @@ -1,4 +1,4 @@ -.TH "NPM\-FOLDERS" "5" "June 2017" "" "" +.TH "NPM\-FOLDERS" "5" "July 2017" "" "" .SH "NAME" \fBnpm-folders\fR \- Folder Structures Used by npm .SH DESCRIPTION @@ -25,10 +25,9 @@ If you need both, then install it in both places, or use \fBnpm link\fP\|\. .SS prefix Configuration .P The \fBprefix\fP config defaults to the location where node is installed\. -On most systems, this is \fB/usr/local\fP\|\. On windows, this is the exact -location of the node\.exe binary\. On Unix systems, it's one level up, -since node is typically installed at \fB{prefix}/bin/node\fP rather than -\fB{prefix}/node\.exe\fP\|\. +On most systems, this is \fB/usr/local\fP\|\. On Windows, it's \fB%AppData%\\npm\fP\|\. +On Unix systems, it's one level up, since node is typically installed at +\fB{prefix}/bin/node\fP rather than \fB{prefix}/node\.exe\fP\|\. .P When the \fBglobal\fP flag is set, npm installs things into this prefix\. When it is not set, it uses the root of the current package, or the diff --git a/deps/npm/man/man5/npm-global.5 b/deps/npm/man/man5/npm-global.5 index 194e6bcc02d474..2442ef30567171 100644 --- a/deps/npm/man/man5/npm-global.5 +++ b/deps/npm/man/man5/npm-global.5 @@ -1,4 +1,4 @@ -.TH "NPM\-FOLDERS" "5" "June 2017" "" "" +.TH "NPM\-FOLDERS" "5" "July 2017" "" "" .SH "NAME" \fBnpm-folders\fR \- Folder Structures Used by npm .SH DESCRIPTION @@ -25,10 +25,9 @@ If you need both, then install it in both places, or use \fBnpm link\fP\|\. .SS prefix Configuration .P The \fBprefix\fP config defaults to the location where node is installed\. -On most systems, this is \fB/usr/local\fP\|\. On windows, this is the exact -location of the node\.exe binary\. On Unix systems, it's one level up, -since node is typically installed at \fB{prefix}/bin/node\fP rather than -\fB{prefix}/node\.exe\fP\|\. +On most systems, this is \fB/usr/local\fP\|\. On Windows, it's \fB%AppData%\\npm\fP\|\. +On Unix systems, it's one level up, since node is typically installed at +\fB{prefix}/bin/node\fP rather than \fB{prefix}/node\.exe\fP\|\. .P When the \fBglobal\fP flag is set, npm installs things into this prefix\. When it is not set, it uses the root of the current package, or the diff --git a/deps/npm/man/man5/npm-json.5 b/deps/npm/man/man5/npm-json.5 index 89eefefcf68123..df570a7e1bcee2 100644 --- a/deps/npm/man/man5/npm-json.5 +++ b/deps/npm/man/man5/npm-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "June 2017" "" "" +.TH "PACKAGE\.JSON" "5" "July 2017" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SH DESCRIPTION @@ -557,21 +557,35 @@ This tarball will be downloaded and installed locally to your package at install time\. .SS Git URLs as Dependencies .P -Git urls can be of the form: +Git urls are of the form: .P .RS 2 .nf -git://github\.com/user/project\.git#commit\-ish -git+ssh://user@hostname:project\.git#commit\-ish -git+ssh://user@hostname/project\.git#commit\-ish -git+http://user@hostname/project/blah\.git#commit\-ish -git+https://user@hostname/project/blah\.git#commit\-ish +://[[:]@][:][:][/][# | #semver:] .fi .RE .P -The \fBcommit\-ish\fP can be any tag, sha, or branch which can be supplied as -an argument to \fBgit checkout\fP\|\. The default is \fBmaster\fP\|\. -.SH GitHub URLs +\fB\fP is one of \fBgit\fP, \fBgit+ssh\fP, \fBgit+http\fP, \fBgit+https\fP, or +\fBgit+file\fP\|\. +.P +If \fB#\fP is provided, it will be used to clone exactly that +commit\. If the commit\-ish has the format \fB#semver:\fP, \fB\fP can +be any valid semver range or exact version, and npm will look for any tags +or refs matching that range in the remote repository, much as it would for a +registry dependency\. If neither \fB#\fP or \fB#semver:\fP is +specified, then \fBmaster\fP is used\. +.P +Examples: +.P +.RS 2 +.nf +git+ssh://git@github\.com:npm/npm\.git#v1\.0\.27 +git+ssh://git@github\.com:npm/npm#semver:^5\.0 +git+https://isaacs@github\.com/npm/npm\.git +git://github\.com/npm/npm\.git#v1\.0\.27 +.fi +.RE +.SS GitHub URLs .P As of version 1\.1\.65, you can refer to GitHub urls as just "foo": "user/foo\-project"\. Just as with git URLs, a \fBcommit\-ish\fP suffix can be @@ -590,7 +604,7 @@ included\. For example: } .fi .RE -.SH Local Paths +.SS Local Paths .P As of version 2\.0\.0 you can provide a path to a local directory that contains a package\. Local paths can be saved using \fBnpm install \-S\fP or @@ -854,12 +868,11 @@ Like the \fBos\fP option, you can also blacklist architectures: The host architecture is determined by \fBprocess\.arch\fP .SH preferGlobal .P -If your package is primarily a command\-line application that should be -installed globally, then set this value to \fBtrue\fP to provide a warning -if it is installed locally\. +\fBDEPRECATED\fR .P -It doesn't actually prevent users from installing it locally, but it -does help prevent some confusion if it doesn't work as expected\. +This option used to trigger an npm warning, but it will no longer warn\. It is +purely there for informational purposes\. It is now recommended that you install +any binaries as local devDependencies wherever possible\. .SH private .P If you set \fB"private": true\fP in your package\.json, then npm will refuse diff --git a/deps/npm/man/man5/npm-package-locks.5 b/deps/npm/man/man5/npm-package-locks.5 index 4d6a28519294af..df808f2e98ab83 100644 --- a/deps/npm/man/man5/npm-package-locks.5 +++ b/deps/npm/man/man5/npm-package-locks.5 @@ -1,4 +1,4 @@ -.TH "NPM\-PACKAGE\-LOCKS" "5" "June 2017" "" "" +.TH "NPM\-PACKAGE\-LOCKS" "5" "July 2017" "" "" .SH "NAME" \fBnpm-package-locks\fR \- An explanation of npm lockfiles .SH DESCRIPTION diff --git a/deps/npm/man/man5/npm-shrinkwrap.json.5 b/deps/npm/man/man5/npm-shrinkwrap.json.5 index 400e23b20adb5e..9188009c10ed5a 100644 --- a/deps/npm/man/man5/npm-shrinkwrap.json.5 +++ b/deps/npm/man/man5/npm-shrinkwrap.json.5 @@ -1,11 +1,11 @@ -.TH "NPM\-SHRINKWRAP\.JSON" "5" "June 2017" "" "" +.TH "NPM\-SHRINKWRAP\.JSON" "5" "July 2017" "" "" .SH "NAME" \fBnpm-shrinkwrap.json\fR \- A publishable lockfile .SH DESCRIPTION .P \fBnpm\-shrinkwrap\.json\fP is a file created by npm help shrinkwrap\. It is identical to \fBpackage\-lock\.json\fP, with one major caveat: Unlike \fBpackage\-lock\.json\fP, -\fBnpm\-shrinwkrap\.json\fP may be included when publishing a package\. +\fBnpm\-shrinkwrap\.json\fP may be included when publishing a package\. .P The recommended use\-case for \fBnpm\-shrinkwrap\.json\fP is applications deployed through the publishing process on the registry: for example, daemons and @@ -13,7 +13,7 @@ command\-line tools intended as global installs or \fBdevDependencies\fP\|\. It' strongly discouraged for library authors to publish this file, since that would prevent end users from having control over transitive dependency updates\. .P -Additionally, if both \fBpackage\-lock\.json\fP and \fBnpm\-shrinwkrap\.json\fP are present +Additionally, if both \fBpackage\-lock\.json\fP and \fBnpm\-shrinkwrap\.json\fP are present in a package root, \fBpackage\-lock\.json\fP will be ignored in favor of this file\. .P For full details and description of the \fBnpm\-shrinkwrap\.json\fP file format, refer diff --git a/deps/npm/man/man5/npmrc.5 b/deps/npm/man/man5/npmrc.5 index a80fdca666fe9b..4a35447e23bfe7 100644 --- a/deps/npm/man/man5/npmrc.5 +++ b/deps/npm/man/man5/npmrc.5 @@ -1,4 +1,4 @@ -.TH "NPMRC" "5" "June 2017" "" "" +.TH "NPMRC" "5" "July 2017" "" "" .SH "NAME" \fBnpmrc\fR \- The npm config files .SH DESCRIPTION diff --git a/deps/npm/man/man5/package-lock.json.5 b/deps/npm/man/man5/package-lock.json.5 index 09dc0d760040ed..4e1f7b880a33e4 100644 --- a/deps/npm/man/man5/package-lock.json.5 +++ b/deps/npm/man/man5/package-lock.json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\-LOCK\.JSON" "5" "June 2017" "" "" +.TH "PACKAGE\-LOCK\.JSON" "5" "July 2017" "" "" .SH "NAME" \fBpackage-lock.json\fR \- A manifestation of the manifest .SH DESCRIPTION @@ -135,7 +135,7 @@ The dependencies of this dependency, exactly as at the top level\. .IP \(bu 2 npm help shrinkwrap .IP \(bu 2 -npm help 5 package\-lock\.json +npm help 5 shrinkwrap\.json .IP \(bu 2 npm help 5 package\.json .IP \(bu 2 diff --git a/deps/npm/man/man5/package.json.5 b/deps/npm/man/man5/package.json.5 index 89eefefcf68123..df570a7e1bcee2 100644 --- a/deps/npm/man/man5/package.json.5 +++ b/deps/npm/man/man5/package.json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "June 2017" "" "" +.TH "PACKAGE\.JSON" "5" "July 2017" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SH DESCRIPTION @@ -557,21 +557,35 @@ This tarball will be downloaded and installed locally to your package at install time\. .SS Git URLs as Dependencies .P -Git urls can be of the form: +Git urls are of the form: .P .RS 2 .nf -git://github\.com/user/project\.git#commit\-ish -git+ssh://user@hostname:project\.git#commit\-ish -git+ssh://user@hostname/project\.git#commit\-ish -git+http://user@hostname/project/blah\.git#commit\-ish -git+https://user@hostname/project/blah\.git#commit\-ish +://[[:]@][:][:][/][# | #semver:] .fi .RE .P -The \fBcommit\-ish\fP can be any tag, sha, or branch which can be supplied as -an argument to \fBgit checkout\fP\|\. The default is \fBmaster\fP\|\. -.SH GitHub URLs +\fB\fP is one of \fBgit\fP, \fBgit+ssh\fP, \fBgit+http\fP, \fBgit+https\fP, or +\fBgit+file\fP\|\. +.P +If \fB#\fP is provided, it will be used to clone exactly that +commit\. If the commit\-ish has the format \fB#semver:\fP, \fB\fP can +be any valid semver range or exact version, and npm will look for any tags +or refs matching that range in the remote repository, much as it would for a +registry dependency\. If neither \fB#\fP or \fB#semver:\fP is +specified, then \fBmaster\fP is used\. +.P +Examples: +.P +.RS 2 +.nf +git+ssh://git@github\.com:npm/npm\.git#v1\.0\.27 +git+ssh://git@github\.com:npm/npm#semver:^5\.0 +git+https://isaacs@github\.com/npm/npm\.git +git://github\.com/npm/npm\.git#v1\.0\.27 +.fi +.RE +.SS GitHub URLs .P As of version 1\.1\.65, you can refer to GitHub urls as just "foo": "user/foo\-project"\. Just as with git URLs, a \fBcommit\-ish\fP suffix can be @@ -590,7 +604,7 @@ included\. For example: } .fi .RE -.SH Local Paths +.SS Local Paths .P As of version 2\.0\.0 you can provide a path to a local directory that contains a package\. Local paths can be saved using \fBnpm install \-S\fP or @@ -854,12 +868,11 @@ Like the \fBos\fP option, you can also blacklist architectures: The host architecture is determined by \fBprocess\.arch\fP .SH preferGlobal .P -If your package is primarily a command\-line application that should be -installed globally, then set this value to \fBtrue\fP to provide a warning -if it is installed locally\. +\fBDEPRECATED\fR .P -It doesn't actually prevent users from installing it locally, but it -does help prevent some confusion if it doesn't work as expected\. +This option used to trigger an npm warning, but it will no longer warn\. It is +purely there for informational purposes\. It is now recommended that you install +any binaries as local devDependencies wherever possible\. .SH private .P If you set \fB"private": true\fP in your package\.json, then npm will refuse diff --git a/deps/npm/man/man7/npm-coding-style.7 b/deps/npm/man/man7/npm-coding-style.7 index 6a788d870c223f..bedeace4f3a215 100644 --- a/deps/npm/man/man7/npm-coding-style.7 +++ b/deps/npm/man/man7/npm-coding-style.7 @@ -1,4 +1,4 @@ -.TH "NPM\-CODING\-STYLE" "7" "June 2017" "" "" +.TH "NPM\-CODING\-STYLE" "7" "July 2017" "" "" .SH "NAME" \fBnpm-coding-style\fR \- npm's "funny" coding style .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-config.7 b/deps/npm/man/man7/npm-config.7 index 7af1f90f7cb86a..07ab671f40625d 100644 --- a/deps/npm/man/man7/npm-config.7 +++ b/deps/npm/man/man7/npm-config.7 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "7" "June 2017" "" "" +.TH "NPM\-CONFIG" "7" "July 2017" "" "" .SH "NAME" \fBnpm-config\fR \- More than you probably want to know about npm configuration .SH DESCRIPTION @@ -8,8 +8,14 @@ npm gets its configuration values from the following sources, sorted by priority .P Putting \fB\-\-foo bar\fP on the command line sets the \fBfoo\fP configuration parameter to \fB"bar"\fP\|\. A \fB\-\-\fP argument tells the cli parser to stop -reading flags\. A \fB\-\-flag\fP parameter that is at the \fIend\fR of the -command will be given the value of \fBtrue\fP\|\. +reading flags\. Using \fB\-\-flag\fP without specifying any value will set +the value to \fBtrue\fP\|\. +.P +Example: \fB\-\-flag1 \-\-flag2\fP will set both configuration parameters +to \fBtrue\fP, while \fB\-\-flag1 \-\-flag2 bar\fP will set \fBflag1\fP to \fBtrue\fP, +and \fBflag2\fP to \fBbar\fP\|\. Finally, \fB\-\-flag1 \-\-flag2 \-\- bar\fP will set +both configuration parameters to \fBtrue\fP, and the \fBbar\fP is taken +as a command argument\. .SS Environment Variables .P Any environment variables that start with \fBnpm_config_\fP will be @@ -19,7 +25,7 @@ configuration parameter to \fBbar\fP\|\. Any environment configurations that are not given a value will be given the value of \fBtrue\fP\|\. Config values are case\-insensitive, so \fBNPM_CONFIG_FOO=bar\fP will work the same\. However, please note that inside npm\-scripts \fI/misc/scripts\fR -npm will set it's own environment variables and Node will prefer +npm will set its own environment variables and Node will prefer those lowercase versions over any uppercase ones that you might set\. For details see this issue \fIhttps://github\.com/npm/npm/issues/14528\fR\|\. .SS npmrc Files @@ -30,10 +36,10 @@ The four relevant files are: per\-project configuration file (\fB/path/to/my/project/\.npmrc\fP) .IP \(bu 2 per\-user configuration file (defaults to \fB$HOME/\.npmrc\fP; configurable via CLI -option \fB\-\-userconfig\fP or environment variable \fB$NPM_CONF_USERCONFIG\fP) +option \fB\-\-userconfig\fP or environment variable \fB$NPM_CONFIG_USERCONFIG\fP) .IP \(bu 2 global configuration file (defaults to \fB$PREFIX/etc/npmrc\fP; configurable via -CLI option \fB\-\-globalconfig\fP or environment variable \fB$NPM_CONF_GLOBALCONFIG\fP) +CLI option \fB\-\-globalconfig\fP or environment variable \fB$NPM_CONFIG_GLOBALCONFIG\fP) .IP \(bu 2 npm's built\-in configuration file (\fB/path/to/npm/npmrc\fP) @@ -1209,6 +1215,16 @@ in to a private registry for the first time: \fBnpm login \-\-scope=@organization \-\-registry=registry\.organization\.com\fP, which will cause \fB@organization\fP to be mapped to the registry for future installation of packages specified according to the pattern \fB@organization/package\fP\|\. +.SS script\-shell +.RS 0 +.IP \(bu 2 +Default: \fBnull\fP +.IP \(bu 2 +Type: path + +.RE +.P +The shell to use for scripts run with the \fBnpm run\fP command\. .SS scripts\-prepend\-node\-path .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man7/npm-developers.7 b/deps/npm/man/man7/npm-developers.7 index da88a0df013cd7..ba6a0811c98ed7 100644 --- a/deps/npm/man/man7/npm-developers.7 +++ b/deps/npm/man/man7/npm-developers.7 @@ -1,4 +1,4 @@ -.TH "NPM\-DEVELOPERS" "7" "June 2017" "" "" +.TH "NPM\-DEVELOPERS" "7" "July 2017" "" "" .SH "NAME" \fBnpm-developers\fR \- Developer Guide .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-disputes.7 b/deps/npm/man/man7/npm-disputes.7 index 8de6d02da89ac3..b7767f3a4abc2f 100644 --- a/deps/npm/man/man7/npm-disputes.7 +++ b/deps/npm/man/man7/npm-disputes.7 @@ -1,4 +1,4 @@ -.TH "NPM\-DISPUTES" "7" "June 2017" "" "" +.TH "NPM\-DISPUTES" "7" "July 2017" "" "" .SH "NAME" \fBnpm-disputes\fR \- Handling Module Name Disputes .P diff --git a/deps/npm/man/man7/npm-index.7 b/deps/npm/man/man7/npm-index.7 index 689e6b91ad96c0..7568e29882fd44 100644 --- a/deps/npm/man/man7/npm-index.7 +++ b/deps/npm/man/man7/npm-index.7 @@ -1,4 +1,4 @@ -.TH "NPM\-INDEX" "7" "June 2017" "" "" +.TH "NPM\-INDEX" "7" "July 2017" "" "" .SH "NAME" \fBnpm-index\fR \- Index of all npm documentation .SS npm help README diff --git a/deps/npm/man/man7/npm-orgs.7 b/deps/npm/man/man7/npm-orgs.7 index 4c37567e15793a..8a25d47a33d7ad 100644 --- a/deps/npm/man/man7/npm-orgs.7 +++ b/deps/npm/man/man7/npm-orgs.7 @@ -1,4 +1,4 @@ -.TH "NPM\-ORGS" "7" "June 2017" "" "" +.TH "NPM\-ORGS" "7" "July 2017" "" "" .SH "NAME" \fBnpm-orgs\fR \- Working with Teams & Orgs .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-registry.7 b/deps/npm/man/man7/npm-registry.7 index 483f36010c03ad..abd1406097515f 100644 --- a/deps/npm/man/man7/npm-registry.7 +++ b/deps/npm/man/man7/npm-registry.7 @@ -1,4 +1,4 @@ -.TH "NPM\-REGISTRY" "7" "June 2017" "" "" +.TH "NPM\-REGISTRY" "7" "July 2017" "" "" .SH "NAME" \fBnpm-registry\fR \- The JavaScript Package Registry .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-scope.7 b/deps/npm/man/man7/npm-scope.7 index 5331efae492130..fbb685c46035f0 100644 --- a/deps/npm/man/man7/npm-scope.7 +++ b/deps/npm/man/man7/npm-scope.7 @@ -1,4 +1,4 @@ -.TH "NPM\-SCOPE" "7" "June 2017" "" "" +.TH "NPM\-SCOPE" "7" "July 2017" "" "" .SH "NAME" \fBnpm-scope\fR \- Scoped packages .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-scripts.7 b/deps/npm/man/man7/npm-scripts.7 index c58a1ef9544989..e93ad1e6509fa6 100644 --- a/deps/npm/man/man7/npm-scripts.7 +++ b/deps/npm/man/man7/npm-scripts.7 @@ -1,4 +1,4 @@ -.TH "NPM\-SCRIPTS" "7" "June 2017" "" "" +.TH "NPM\-SCRIPTS" "7" "July 2017" "" "" .SH "NAME" \fBnpm-scripts\fR \- How npm handles the "scripts" field .SH DESCRIPTION @@ -89,11 +89,6 @@ allow users to avoid the confusing behavior of existing npm versions and only run on \fBnpm publish\fP (for instance, running the tests one last time to ensure they're in good shape)\. .P -\fBIMPORTANT:\fR As of \fBnpm@5\fP, \fBprepublish\fP will \fIonly\fR be run for \fBnpm -publish\fP\|\. This will make its behavior identical to \fBprepublishOnly\fP, so -\fBnpm@6\fP or later may drop support for the use of \fBprepublishOnly\fP, and then -maybe we can all forget this embarrassing thing ever happened\. -.P See https://github\.com/npm/npm/issues/10074 for a much lengthier justification, with further reading, for this change\. .SS USE CASES diff --git a/deps/npm/man/man7/removing-npm.7 b/deps/npm/man/man7/removing-npm.7 index f2bd986225fa09..1ee678b59e9344 100644 --- a/deps/npm/man/man7/removing-npm.7 +++ b/deps/npm/man/man7/removing-npm.7 @@ -1,4 +1,4 @@ -.TH "NPM\-REMOVAL" "1" "June 2017" "" "" +.TH "NPM\-REMOVAL" "1" "July 2017" "" "" .SH "NAME" \fBnpm-removal\fR \- Cleaning the Slate .SH SYNOPSIS diff --git a/deps/npm/man/man7/semver.7 b/deps/npm/man/man7/semver.7 index 88ed4a079912de..f0b22279d07f58 100644 --- a/deps/npm/man/man7/semver.7 +++ b/deps/npm/man/man7/semver.7 @@ -1,4 +1,4 @@ -.TH "SEMVER" "7" "June 2017" "" "" +.TH "SEMVER" "7" "July 2017" "" "" .SH "NAME" \fBsemver\fR \- The semantic versioner for npm .SH Usage diff --git a/deps/npm/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js b/deps/npm/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js index 26752d4a1b55ae..39910608b3db31 100644 --- a/deps/npm/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js +++ b/deps/npm/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js @@ -59,6 +59,7 @@ function Parser() { this.stringBuffer = Buffer.alloc ? Buffer.alloc(STRING_BUFFER_SIZE) : new Buffer(STRING_BUFFER_SIZE); this.stringBufferOffset = 0; this.unicode = undefined; // unicode escapes + this.highSurrogate = undefined; this.key = undefined; this.mode = undefined; @@ -217,8 +218,20 @@ proto.write = function (buffer) { if ((n >= 0x30 && n < 0x40) || (n > 0x40 && n <= 0x46) || (n > 0x60 && n <= 0x66)) { this.unicode += String.fromCharCode(n); if (this.tState++ === STRING6) { - this.appendStringBuf(Buffer(String.fromCharCode(parseInt(this.unicode, 16)))); + var intVal = parseInt(this.unicode, 16); this.unicode = undefined; + if (this.highSurrogate !== undefined && intVal >= 0xDC00 && intVal < (0xDFFF + 1)) { //<56320,57343> - lowSurrogate + this.appendStringBuf(new Buffer(String.fromCharCode(this.highSurrogate, intVal))); + this.highSurrogate = undefined; + } else if (this.highSurrogate === undefined && intVal >= 0xD800 && intVal < (0xDBFF + 1)) { //<55296,56319> - highSurrogate + this.highSurrogate = intVal; + } else { + if (this.highSurrogate !== undefined) { + this.appendStringBuf(new Buffer(String.fromCharCode(this.highSurrogate))); + this.highSurrogate = undefined; + } + this.appendStringBuf(new Buffer(String.fromCharCode(intVal))); + } this.tState = STRING1; } } else { diff --git a/deps/npm/node_modules/JSONStream/node_modules/jsonparse/package.json b/deps/npm/node_modules/JSONStream/node_modules/jsonparse/package.json index e712039daecc4e..fe0cfcd1f4a151 100644 --- a/deps/npm/node_modules/JSONStream/node_modules/jsonparse/package.json +++ b/deps/npm/node_modules/JSONStream/node_modules/jsonparse/package.json @@ -1,7 +1,8 @@ { "_from": "jsonparse@^1.2.0", - "_id": "jsonparse@1.3.0", - "_integrity": "sha1-hfwkWx2SWazGlBlguQWt9k594Og=", + "_id": "jsonparse@1.3.1", + "_inBundle": false, + "_integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", "_location": "/JSONStream/jsonparse", "_phantomChildren": {}, "_requested": { @@ -17,21 +18,18 @@ "_requiredBy": [ "/JSONStream" ], - "_resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.0.tgz", - "_shasum": "85fc245b1d9259acc6941960b905adf64e7de0e8", - "_shrinkwrap": null, + "_resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "_shasum": "3f4dae4a91fac315f71062f8521cc239f1366280", "_spec": "jsonparse@^1.2.0", - "_where": "/Users/zkat/Documents/code/npm/node_modules/JSONStream", + "_where": "/Users/rebecca/code/npm/node_modules/JSONStream", "author": { "name": "Tim Caswell", "email": "tim@creationix.com" }, - "bin": null, "bugs": { "url": "http://github.com/creationix/jsonparse/issues" }, "bundleDependencies": false, - "dependencies": {}, "deprecated": false, "description": "This is a pure-js JSON streaming parser for node.js", "devDependencies": { @@ -45,8 +43,6 @@ "license": "MIT", "main": "jsonparse.js", "name": "jsonparse", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+ssh://git@github.com/creationix/jsonparse.git" @@ -58,5 +54,5 @@ "json", "stream" ], - "version": "1.3.0" + "version": "1.3.1" } diff --git a/deps/npm/node_modules/JSONStream/node_modules/jsonparse/test/surrogate.js b/deps/npm/node_modules/JSONStream/node_modules/jsonparse/test/surrogate.js new file mode 100644 index 00000000000000..33351c73cc193b --- /dev/null +++ b/deps/npm/node_modules/JSONStream/node_modules/jsonparse/test/surrogate.js @@ -0,0 +1,25 @@ +var test = require('tape'); +var Parser = require('../'); + +test('parse surrogate pair', function (t) { + t.plan(1); + + var p = new Parser(); + p.onValue = function (value) { + t.equal(value, '😋'); + }; + + p.write('"\\uD83D\\uDE0B"'); +}); + +test('parse chunked surrogate pair', function (t) { + t.plan(1); + + var p = new Parser(); + p.onValue = function (value) { + t.equal(value, '😋'); + }; + + p.write('"\\uD83D'); + p.write('\\uDE0B"'); +}); diff --git a/deps/npm/node_modules/JSONStream/package.json b/deps/npm/node_modules/JSONStream/package.json index 7f472afd062e57..2086da717bcf41 100644 --- a/deps/npm/node_modules/JSONStream/package.json +++ b/deps/npm/node_modules/JSONStream/package.json @@ -1,6 +1,7 @@ { "_from": "JSONStream@~1.3.1", "_id": "JSONStream@1.3.1", + "_inBundle": false, "_integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=", "_location": "/JSONStream", "_phantomChildren": {}, @@ -15,13 +16,13 @@ "fetchSpec": "~1.3.1" }, "_requiredBy": [ + "#USER", "/" ], "_resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz", "_shasum": "707f761e01dae9e16f1bcf93703b78c70966579a", - "_shrinkwrap": null, "_spec": "JSONStream@~1.3.1", - "_where": "/Users/zkat/Documents/code/npm", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Dominic Tarr", "email": "dominic.tarr@gmail.com", @@ -63,7 +64,6 @@ "license": "(MIT OR Apache-2.0)", "name": "JSONStream", "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git://github.com/dominictarr/JSONStream.git" diff --git a/deps/npm/node_modules/ansi-regex/index.js b/deps/npm/node_modules/ansi-regex/index.js index b9574ed7e82013..c4aaecf5050639 100644 --- a/deps/npm/node_modules/ansi-regex/index.js +++ b/deps/npm/node_modules/ansi-regex/index.js @@ -1,4 +1,10 @@ 'use strict'; -module.exports = function () { - return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; + +module.exports = () => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))' + ].join('|'); + + return new RegExp(pattern, 'g'); }; diff --git a/deps/npm/node_modules/ansi-regex/license b/deps/npm/node_modules/ansi-regex/license index 654d0bfe943437..e7af2f77107d73 100644 --- a/deps/npm/node_modules/ansi-regex/license +++ b/deps/npm/node_modules/ansi-regex/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) -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: +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 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. +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. diff --git a/deps/npm/node_modules/ansi-regex/package.json b/deps/npm/node_modules/ansi-regex/package.json index bf854fdc32bca5..2bf2bb485f0b63 100644 --- a/deps/npm/node_modules/ansi-regex/package.json +++ b/deps/npm/node_modules/ansi-regex/package.json @@ -1,52 +1,45 @@ { - "_from": "ansi-regex@~2.1.1", - "_id": "ansi-regex@2.1.1", - "_integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "_from": "ansi-regex@latest", + "_id": "ansi-regex@3.0.0", + "_inBundle": false, + "_integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "_location": "/ansi-regex", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "tag", "registry": true, - "raw": "ansi-regex@~2.1.1", + "raw": "ansi-regex@latest", "name": "ansi-regex", "escapedName": "ansi-regex", - "rawSpec": "~2.1.1", + "rawSpec": "latest", "saveSpec": null, - "fetchSpec": "~2.1.1" + "fetchSpec": "latest" }, "_requiredBy": [ - "/", - "/npm-registry-couchapp/couchapp/nano/follow/request/har-validator/chalk/has-ansi", - "/standard/eslint/chalk/has-ansi", - "/standard/eslint/inquirer", - "/strip-ansi", - "/tap/coveralls/request/har-validator/chalk/has-ansi", - "/update-notifier/chalk/has-ansi" + "#USER", + "/" ], - "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df", - "_shrinkwrap": null, - "_spec": "ansi-regex@~2.1.1", - "_where": "/Users/zkat/Documents/code/npm", + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "_shasum": "ed0317c322064f79466c02966bddb605ab37d998", + "_spec": "ansi-regex@latest", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, - "bin": null, "bugs": { "url": "https://github.com/chalk/ansi-regex/issues" }, "bundleDependencies": false, - "dependencies": {}, "deprecated": false, "description": "Regular expression for matching ANSI escape codes", "devDependencies": { - "ava": "0.17.0", - "xo": "0.16.0" + "ava": "*", + "xo": "*" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" }, "files": [ "index.js" @@ -80,39 +73,14 @@ "pattern" ], "license": "MIT", - "maintainers": [ - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - { - "name": "Joshua Appelman", - "email": "jappelman@xebia.com", - "url": "jbnicolai.com" - }, - { - "name": "JD Ballard", - "email": "i.am.qix@gmail.com", - "url": "github.com/qix-" - } - ], "name": "ansi-regex", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/chalk/ansi-regex.git" }, "scripts": { - "test": "xo && ava --verbose", + "test": "xo && ava", "view-supported": "node fixtures/view-codes.js" }, - "version": "2.1.1", - "xo": { - "rules": { - "guard-for-in": 0, - "no-loop-func": 0 - } - } + "version": "3.0.0" } diff --git a/deps/npm/node_modules/ansi-regex/readme.md b/deps/npm/node_modules/ansi-regex/readme.md index 6a928edf0f6b08..22db1c34055556 100644 --- a/deps/npm/node_modules/ansi-regex/readme.md +++ b/deps/npm/node_modules/ansi-regex/readme.md @@ -1,12 +1,12 @@ # ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) -> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) +> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) ## Install ``` -$ npm install --save ansi-regex +$ npm install ansi-regex ``` @@ -15,25 +15,32 @@ $ npm install --save ansi-regex ```js const ansiRegex = require('ansi-regex'); -ansiRegex().test('\u001b[4mcake\u001b[0m'); +ansiRegex().test('\u001B[4mcake\u001B[0m'); //=> true ansiRegex().test('cake'); //=> false -'\u001b[4mcake\u001b[0m'.match(ansiRegex()); -//=> ['\u001b[4m', '\u001b[0m'] +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] ``` + ## FAQ ### Why do you test for codes not in the ECMA 48 standard? -Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + ## License -MIT © [Sindre Sorhus](http://sindresorhus.com) +MIT diff --git a/deps/npm/node_modules/cacache/CHANGELOG.md b/deps/npm/node_modules/cacache/CHANGELOG.md index 802257622eab58..9e8f8d6dddeb42 100644 --- a/deps/npm/node_modules/cacache/CHANGELOG.md +++ b/deps/npm/node_modules/cacache/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [9.2.9](https://github.com/zkat/cacache/compare/v9.2.8...v9.2.9) (2017-06-17) + + + ## [9.2.8](https://github.com/zkat/cacache/compare/v9.2.7...v9.2.8) (2017-06-05) diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/node_modules/semver/LICENSE b/deps/npm/node_modules/cacache/node_modules/lru-cache/LICENSE similarity index 100% rename from deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/node_modules/semver/LICENSE rename to deps/npm/node_modules/cacache/node_modules/lru-cache/LICENSE diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/README.md b/deps/npm/node_modules/cacache/node_modules/lru-cache/README.md new file mode 100644 index 00000000000000..f646c1cb8e50b1 --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/lru-cache/README.md @@ -0,0 +1,152 @@ +# lru cache + +A cache object that deletes the least-recently-used items. + +[![Build Status](https://travis-ci.org/isaacs/node-lru-cache.svg?branch=master)](https://travis-ci.org/isaacs/node-lru-cache) [![Coverage Status](https://coveralls.io/repos/isaacs/node-lru-cache/badge.svg?service=github)](https://coveralls.io/github/isaacs/node-lru-cache) + +## Installation: + +```javascript +npm install lru-cache --save +``` + +## Usage: + +```javascript +var LRU = require("lru-cache") + , options = { max: 500 + , length: function (n, key) { return n * 2 + key.length } + , dispose: function (key, n) { n.close() } + , maxAge: 1000 * 60 * 60 } + , cache = LRU(options) + , otherCache = LRU(50) // sets just the max size + +cache.set("key", "value") +cache.get("key") // "value" + +// non-string keys ARE fully supported +var someObject = {} +cache.set(someObject, 'a value') +cache.set('[object Object]', 'a different value') +assert.equal(cache.get(someObject), 'a value') + +cache.reset() // empty the cache +``` + +If you put more stuff in it, then items will fall out. + +If you try to put an oversized thing in it, then it'll fall out right +away. + +## Options + +* `max` The maximum size of the cache, checked by applying the length + function to all values in the cache. Not setting this is kind of + silly, since that's the whole purpose of this lib, but it defaults + to `Infinity`. +* `maxAge` Maximum age in ms. Items are not pro-actively pruned out + as they age, but if you try to get an item that is too old, it'll + drop it and return undefined instead of giving it to you. +* `length` Function that is used to calculate the length of stored + items. If you're storing strings or buffers, then you probably want + to do something like `function(n, key){return n.length}`. The default is + `function(){return 1}`, which is fine if you want to store `max` + like-sized things. The item is passed as the first argument, and + the key is passed as the second argumnet. +* `dispose` Function that is called on items when they are dropped + from the cache. This can be handy if you want to close file + descriptors or do other cleanup tasks when items are no longer + accessible. Called with `key, value`. It's called *before* + actually removing the item from the internal cache, so if you want + to immediately put it back in, you'll have to do that in a + `nextTick` or `setTimeout` callback or it won't do anything. +* `stale` By default, if you set a `maxAge`, it'll only actually pull + stale items out of the cache when you `get(key)`. (That is, it's + not pre-emptively doing a `setTimeout` or anything.) If you set + `stale:true`, it'll return the stale value before deleting it. If + you don't set this, then it'll return `undefined` when you try to + get a stale entry, as if it had already been deleted. +* `noDisposeOnSet` By default, if you set a `dispose()` method, then + it'll be called whenever a `set()` operation overwrites an existing + key. If you set this option, `dispose()` will only be called when a + key falls out of the cache, not when it is overwritten. + +## API + +* `set(key, value, maxAge)` +* `get(key) => value` + + Both of these will update the "recently used"-ness of the key. + They do what you think. `maxAge` is optional and overrides the + cache `maxAge` option if provided. + + If the key is not found, `get()` will return `undefined`. + + The key and val can be any value. + +* `peek(key)` + + Returns the key value (or `undefined` if not found) without + updating the "recently used"-ness of the key. + + (If you find yourself using this a lot, you *might* be using the + wrong sort of data structure, but there are some use cases where + it's handy.) + +* `del(key)` + + Deletes a key out of the cache. + +* `reset()` + + Clear the cache entirely, throwing away all values. + +* `has(key)` + + Check if a key is in the cache, without updating the recent-ness + or deleting it for being stale. + +* `forEach(function(value,key,cache), [thisp])` + + Just like `Array.prototype.forEach`. Iterates over all the keys + in the cache, in order of recent-ness. (Ie, more recently used + items are iterated over first.) + +* `rforEach(function(value,key,cache), [thisp])` + + The same as `cache.forEach(...)` but items are iterated over in + reverse order. (ie, less recently used items are iterated over + first.) + +* `keys()` + + Return an array of the keys in the cache. + +* `values()` + + Return an array of the values in the cache. + +* `length` + + Return total length of objects in cache taking into account + `length` options function. + +* `itemCount` + + Return total quantity of objects currently in cache. Note, that + `stale` (see options) items are returned as part of this item + count. + +* `dump()` + + Return an array of the cache entries ready for serialization and usage + with 'destinationCache.load(arr)`. + +* `load(cacheEntriesArray)` + + Loads another cache entries array, obtained with `sourceCache.dump()`, + into the cache. The destination cache is reset before loading new entries + +* `prune()` + + Manually iterates over the entire cache proactively pruning old entries diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/index.js b/deps/npm/node_modules/cacache/node_modules/lru-cache/index.js new file mode 100644 index 00000000000000..460462aadc9dd9 --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/lru-cache/index.js @@ -0,0 +1,467 @@ +'use strict' + +module.exports = LRUCache + +// This will be a proper iterable 'Map' in engines that support it, +// or a fakey-fake PseudoMap in older versions. +var Map = require('pseudomap') +var util = require('util') + +// A linked list to keep track of recently-used-ness +var Yallist = require('yallist') + +// use symbols if possible, otherwise just _props +var hasSymbol = typeof Symbol === 'function' +var makeSymbol +if (hasSymbol) { + makeSymbol = function (key) { + return Symbol.for(key) + } +} else { + makeSymbol = function (key) { + return '_' + key + } +} + +var MAX = makeSymbol('max') +var LENGTH = makeSymbol('length') +var LENGTH_CALCULATOR = makeSymbol('lengthCalculator') +var ALLOW_STALE = makeSymbol('allowStale') +var MAX_AGE = makeSymbol('maxAge') +var DISPOSE = makeSymbol('dispose') +var NO_DISPOSE_ON_SET = makeSymbol('noDisposeOnSet') +var LRU_LIST = makeSymbol('lruList') +var CACHE = makeSymbol('cache') + +function naiveLength () { return 1 } + +// lruList is a yallist where the head is the youngest +// item, and the tail is the oldest. the list contains the Hit +// objects as the entries. +// Each Hit object has a reference to its Yallist.Node. This +// never changes. +// +// cache is a Map (or PseudoMap) that matches the keys to +// the Yallist.Node object. +function LRUCache (options) { + if (!(this instanceof LRUCache)) { + return new LRUCache(options) + } + + if (typeof options === 'number') { + options = { max: options } + } + + if (!options) { + options = {} + } + + var max = this[MAX] = options.max + // Kind of weird to have a default max of Infinity, but oh well. + if (!max || + !(typeof max === 'number') || + max <= 0) { + this[MAX] = Infinity + } + + var lc = options.length || naiveLength + if (typeof lc !== 'function') { + lc = naiveLength + } + this[LENGTH_CALCULATOR] = lc + + this[ALLOW_STALE] = options.stale || false + this[MAX_AGE] = options.maxAge || 0 + this[DISPOSE] = options.dispose + this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false + this.reset() +} + +// resize the cache when the max changes. +Object.defineProperty(LRUCache.prototype, 'max', { + set: function (mL) { + if (!mL || !(typeof mL === 'number') || mL <= 0) { + mL = Infinity + } + this[MAX] = mL + trim(this) + }, + get: function () { + return this[MAX] + }, + enumerable: true +}) + +Object.defineProperty(LRUCache.prototype, 'allowStale', { + set: function (allowStale) { + this[ALLOW_STALE] = !!allowStale + }, + get: function () { + return this[ALLOW_STALE] + }, + enumerable: true +}) + +Object.defineProperty(LRUCache.prototype, 'maxAge', { + set: function (mA) { + if (!mA || !(typeof mA === 'number') || mA < 0) { + mA = 0 + } + this[MAX_AGE] = mA + trim(this) + }, + get: function () { + return this[MAX_AGE] + }, + enumerable: true +}) + +// resize the cache when the lengthCalculator changes. +Object.defineProperty(LRUCache.prototype, 'lengthCalculator', { + set: function (lC) { + if (typeof lC !== 'function') { + lC = naiveLength + } + if (lC !== this[LENGTH_CALCULATOR]) { + this[LENGTH_CALCULATOR] = lC + this[LENGTH] = 0 + this[LRU_LIST].forEach(function (hit) { + hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key) + this[LENGTH] += hit.length + }, this) + } + trim(this) + }, + get: function () { return this[LENGTH_CALCULATOR] }, + enumerable: true +}) + +Object.defineProperty(LRUCache.prototype, 'length', { + get: function () { return this[LENGTH] }, + enumerable: true +}) + +Object.defineProperty(LRUCache.prototype, 'itemCount', { + get: function () { return this[LRU_LIST].length }, + enumerable: true +}) + +LRUCache.prototype.rforEach = function (fn, thisp) { + thisp = thisp || this + for (var walker = this[LRU_LIST].tail; walker !== null;) { + var prev = walker.prev + forEachStep(this, fn, walker, thisp) + walker = prev + } +} + +function forEachStep (self, fn, node, thisp) { + var hit = node.value + if (isStale(self, hit)) { + del(self, node) + if (!self[ALLOW_STALE]) { + hit = undefined + } + } + if (hit) { + fn.call(thisp, hit.value, hit.key, self) + } +} + +LRUCache.prototype.forEach = function (fn, thisp) { + thisp = thisp || this + for (var walker = this[LRU_LIST].head; walker !== null;) { + var next = walker.next + forEachStep(this, fn, walker, thisp) + walker = next + } +} + +LRUCache.prototype.keys = function () { + return this[LRU_LIST].toArray().map(function (k) { + return k.key + }, this) +} + +LRUCache.prototype.values = function () { + return this[LRU_LIST].toArray().map(function (k) { + return k.value + }, this) +} + +LRUCache.prototype.reset = function () { + if (this[DISPOSE] && + this[LRU_LIST] && + this[LRU_LIST].length) { + this[LRU_LIST].forEach(function (hit) { + this[DISPOSE](hit.key, hit.value) + }, this) + } + + this[CACHE] = new Map() // hash of items by key + this[LRU_LIST] = new Yallist() // list of items in order of use recency + this[LENGTH] = 0 // length of items in the list +} + +LRUCache.prototype.dump = function () { + return this[LRU_LIST].map(function (hit) { + if (!isStale(this, hit)) { + return { + k: hit.key, + v: hit.value, + e: hit.now + (hit.maxAge || 0) + } + } + }, this).toArray().filter(function (h) { + return h + }) +} + +LRUCache.prototype.dumpLru = function () { + return this[LRU_LIST] +} + +LRUCache.prototype.inspect = function (n, opts) { + var str = 'LRUCache {' + var extras = false + + var as = this[ALLOW_STALE] + if (as) { + str += '\n allowStale: true' + extras = true + } + + var max = this[MAX] + if (max && max !== Infinity) { + if (extras) { + str += ',' + } + str += '\n max: ' + util.inspect(max, opts) + extras = true + } + + var maxAge = this[MAX_AGE] + if (maxAge) { + if (extras) { + str += ',' + } + str += '\n maxAge: ' + util.inspect(maxAge, opts) + extras = true + } + + var lc = this[LENGTH_CALCULATOR] + if (lc && lc !== naiveLength) { + if (extras) { + str += ',' + } + str += '\n length: ' + util.inspect(this[LENGTH], opts) + extras = true + } + + var didFirst = false + this[LRU_LIST].forEach(function (item) { + if (didFirst) { + str += ',\n ' + } else { + if (extras) { + str += ',\n' + } + didFirst = true + str += '\n ' + } + var key = util.inspect(item.key).split('\n').join('\n ') + var val = { value: item.value } + if (item.maxAge !== maxAge) { + val.maxAge = item.maxAge + } + if (lc !== naiveLength) { + val.length = item.length + } + if (isStale(this, item)) { + val.stale = true + } + + val = util.inspect(val, opts).split('\n').join('\n ') + str += key + ' => ' + val + }) + + if (didFirst || extras) { + str += '\n' + } + str += '}' + + return str +} + +LRUCache.prototype.set = function (key, value, maxAge) { + maxAge = maxAge || this[MAX_AGE] + + var now = maxAge ? Date.now() : 0 + var len = this[LENGTH_CALCULATOR](value, key) + + if (this[CACHE].has(key)) { + if (len > this[MAX]) { + del(this, this[CACHE].get(key)) + return false + } + + var node = this[CACHE].get(key) + var item = node.value + + // dispose of the old one before overwriting + // split out into 2 ifs for better coverage tracking + if (this[DISPOSE]) { + if (!this[NO_DISPOSE_ON_SET]) { + this[DISPOSE](key, item.value) + } + } + + item.now = now + item.maxAge = maxAge + item.value = value + this[LENGTH] += len - item.length + item.length = len + this.get(key) + trim(this) + return true + } + + var hit = new Entry(key, value, len, now, maxAge) + + // oversized objects fall out of cache automatically. + if (hit.length > this[MAX]) { + if (this[DISPOSE]) { + this[DISPOSE](key, value) + } + return false + } + + this[LENGTH] += hit.length + this[LRU_LIST].unshift(hit) + this[CACHE].set(key, this[LRU_LIST].head) + trim(this) + return true +} + +LRUCache.prototype.has = function (key) { + if (!this[CACHE].has(key)) return false + var hit = this[CACHE].get(key).value + if (isStale(this, hit)) { + return false + } + return true +} + +LRUCache.prototype.get = function (key) { + return get(this, key, true) +} + +LRUCache.prototype.peek = function (key) { + return get(this, key, false) +} + +LRUCache.prototype.pop = function () { + var node = this[LRU_LIST].tail + if (!node) return null + del(this, node) + return node.value +} + +LRUCache.prototype.del = function (key) { + del(this, this[CACHE].get(key)) +} + +LRUCache.prototype.load = function (arr) { + // reset the cache + this.reset() + + var now = Date.now() + // A previous serialized cache has the most recent items first + for (var l = arr.length - 1; l >= 0; l--) { + var hit = arr[l] + var expiresAt = hit.e || 0 + if (expiresAt === 0) { + // the item was created without expiration in a non aged cache + this.set(hit.k, hit.v) + } else { + var maxAge = expiresAt - now + // dont add already expired items + if (maxAge > 0) { + this.set(hit.k, hit.v, maxAge) + } + } + } +} + +LRUCache.prototype.prune = function () { + var self = this + this[CACHE].forEach(function (value, key) { + get(self, key, false) + }) +} + +function get (self, key, doUse) { + var node = self[CACHE].get(key) + if (node) { + var hit = node.value + if (isStale(self, hit)) { + del(self, node) + if (!self[ALLOW_STALE]) hit = undefined + } else { + if (doUse) { + self[LRU_LIST].unshiftNode(node) + } + } + if (hit) hit = hit.value + } + return hit +} + +function isStale (self, hit) { + if (!hit || (!hit.maxAge && !self[MAX_AGE])) { + return false + } + var stale = false + var diff = Date.now() - hit.now + if (hit.maxAge) { + stale = diff > hit.maxAge + } else { + stale = self[MAX_AGE] && (diff > self[MAX_AGE]) + } + return stale +} + +function trim (self) { + if (self[LENGTH] > self[MAX]) { + for (var walker = self[LRU_LIST].tail; + self[LENGTH] > self[MAX] && walker !== null;) { + // We know that we're about to delete this one, and also + // what the next least recently used key will be, so just + // go ahead and set it now. + var prev = walker.prev + del(self, walker) + walker = prev + } + } +} + +function del (self, node) { + if (node) { + var hit = node.value + if (self[DISPOSE]) { + self[DISPOSE](hit.key, hit.value) + } + self[LENGTH] -= hit.length + self[CACHE].delete(hit.key) + self[LRU_LIST].removeNode(node) + } +} + +// classy, since V8 prefers predictable objects. +function Entry (key, value, length, now, maxAge) { + this.key = key + this.value = value + this.length = length + this.now = now + this.maxAge = maxAge || 0 +} diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/node_modules/semver/LICENSE b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/LICENSE similarity index 100% rename from deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/node_modules/semver/LICENSE rename to deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/LICENSE diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/README.md b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/README.md new file mode 100644 index 00000000000000..778bf01dfaaf9f --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/README.md @@ -0,0 +1,60 @@ +# pseudomap + +A thing that is a lot like ES6 `Map`, but without iterators, for use +in environments where `for..of` syntax and `Map` are not available. + +If you need iterators, or just in general a more faithful polyfill to +ES6 Maps, check out [es6-map](http://npm.im/es6-map). + +If you are in an environment where `Map` is supported, then that will +be returned instead, unless `process.env.TEST_PSEUDOMAP` is set. + +You can use any value as keys, and any value as data. Setting again +with the identical key will overwrite the previous value. + +Internally, data is stored on an `Object.create(null)` style object. +The key is coerced to a string to generate the key on the internal +data-bag object. The original key used is stored along with the data. + +In the event of a stringified-key collision, a new key is generated by +appending an increasing number to the stringified-key until finding +either the intended key or an empty spot. + +Note that because object traversal order of plain objects is not +guaranteed to be identical to insertion order, the insertion order +guarantee of `Map.prototype.forEach` is not guaranteed in this +implementation. However, in all versions of Node.js and V8 where this +module works, `forEach` does traverse data in insertion order. + +## API + +Most of the [Map +API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map), +with the following exceptions: + +1. A `Map` object is not an iterator. +2. `values`, `keys`, and `entries` methods are not implemented, + because they return iterators. +3. The argument to the constructor can be an Array of `[key, value]` + pairs, or a `Map` or `PseudoMap` object. But, since iterators + aren't used, passing any plain-old iterator won't initialize the + map properly. + +## USAGE + +Use just like a regular ES6 Map. + +```javascript +var PseudoMap = require('pseudomap') + +// optionally provide a pseudomap, or an array of [key,value] pairs +// as the argument to initialize the map with +var myMap = new PseudoMap() + +myMap.set(1, 'number 1') +myMap.set('1', 'string 1') +var akey = {} +var bkey = {} +myMap.set(akey, { some: 'data' }) +myMap.set(bkey, { some: 'other data' }) +``` diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/map.js b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/map.js new file mode 100644 index 00000000000000..7db15994612fd9 --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/map.js @@ -0,0 +1,9 @@ +if (process.env.npm_package_name === 'pseudomap' && + process.env.npm_lifecycle_script === 'test') + process.env.TEST_PSEUDOMAP = 'true' + +if (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) { + module.exports = Map +} else { + module.exports = require('./pseudomap') +} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/package.json b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/package.json new file mode 100644 index 00000000000000..3b5bd1e0eefc3f --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/package.json @@ -0,0 +1,54 @@ +{ + "_from": "pseudomap@^1.0.2", + "_id": "pseudomap@1.0.2", + "_inBundle": false, + "_integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "_location": "/cacache/lru-cache/pseudomap", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pseudomap@^1.0.2", + "name": "pseudomap", + "escapedName": "pseudomap", + "rawSpec": "^1.0.2", + "saveSpec": null, + "fetchSpec": "^1.0.2" + }, + "_requiredBy": [ + "/cacache/lru-cache" + ], + "_resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "_shasum": "f052a28da70e618917ef0a8ac34c1ae5a68286b3", + "_spec": "pseudomap@^1.0.2", + "_where": "/Users/rebecca/code/npm/node_modules/cacache/node_modules/lru-cache", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/pseudomap/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "A thing that is a lot like ES6 `Map`, but without iterators, for use in environments where `for..of` syntax and `Map` are not available.", + "devDependencies": { + "tap": "^2.3.1" + }, + "directories": { + "test": "test" + }, + "homepage": "https://github.com/isaacs/pseudomap#readme", + "license": "ISC", + "main": "map.js", + "name": "pseudomap", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/pseudomap.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "1.0.2" +} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/pseudomap.js b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/pseudomap.js new file mode 100644 index 00000000000000..25a21d829e8b3f --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/pseudomap.js @@ -0,0 +1,113 @@ +var hasOwnProperty = Object.prototype.hasOwnProperty + +module.exports = PseudoMap + +function PseudoMap (set) { + if (!(this instanceof PseudoMap)) // whyyyyyyy + throw new TypeError("Constructor PseudoMap requires 'new'") + + this.clear() + + if (set) { + if ((set instanceof PseudoMap) || + (typeof Map === 'function' && set instanceof Map)) + set.forEach(function (value, key) { + this.set(key, value) + }, this) + else if (Array.isArray(set)) + set.forEach(function (kv) { + this.set(kv[0], kv[1]) + }, this) + else + throw new TypeError('invalid argument') + } +} + +PseudoMap.prototype.forEach = function (fn, thisp) { + thisp = thisp || this + Object.keys(this._data).forEach(function (k) { + if (k !== 'size') + fn.call(thisp, this._data[k].value, this._data[k].key) + }, this) +} + +PseudoMap.prototype.has = function (k) { + return !!find(this._data, k) +} + +PseudoMap.prototype.get = function (k) { + var res = find(this._data, k) + return res && res.value +} + +PseudoMap.prototype.set = function (k, v) { + set(this._data, k, v) +} + +PseudoMap.prototype.delete = function (k) { + var res = find(this._data, k) + if (res) { + delete this._data[res._index] + this._data.size-- + } +} + +PseudoMap.prototype.clear = function () { + var data = Object.create(null) + data.size = 0 + + Object.defineProperty(this, '_data', { + value: data, + enumerable: false, + configurable: true, + writable: false + }) +} + +Object.defineProperty(PseudoMap.prototype, 'size', { + get: function () { + return this._data.size + }, + set: function (n) {}, + enumerable: true, + configurable: true +}) + +PseudoMap.prototype.values = +PseudoMap.prototype.keys = +PseudoMap.prototype.entries = function () { + throw new Error('iterators are not implemented in this version') +} + +// Either identical, or both NaN +function same (a, b) { + return a === b || a !== a && b !== b +} + +function Entry (k, v, i) { + this.key = k + this.value = v + this._index = i +} + +function find (data, k) { + for (var i = 0, s = '_' + k, key = s; + hasOwnProperty.call(data, key); + key = s + i++) { + if (same(data[key].key, k)) + return data[key] + } +} + +function set (data, k, v) { + for (var i = 0, s = '_' + k, key = s; + hasOwnProperty.call(data, key); + key = s + i++) { + if (same(data[key].key, k)) { + data[key].value = v + return + } + } + data.size++ + data[key] = new Entry(k, v, key) +} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/test/basic.js b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/test/basic.js new file mode 100644 index 00000000000000..4378e4541e9a14 --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/test/basic.js @@ -0,0 +1,86 @@ +var t = require('tap') + +process.env.TEST_PSEUDOMAP = 'true' + +var PM = require('../') +runTests(PM) + +// if possible, verify that Map also behaves the same way +if (typeof Map === 'function') + runTests(Map) + + +function runTests (Map) { + t.throws(Map) + + var m = new Map() + + t.equal(m.size, 0) + + m.set(1, '1 string') + t.equal(m.get(1), '1 string') + t.equal(m.size, 1) + m.size = 1000 + t.equal(m.size, 1) + m.size = 0 + t.equal(m.size, 1) + + m = new Map([[1, 'number 1'], ['1', 'string 1']]) + t.equal(m.get(1), 'number 1') + t.equal(m.get('1'), 'string 1') + t.equal(m.size, 2) + + m = new Map(m) + t.equal(m.get(1), 'number 1') + t.equal(m.get('1'), 'string 1') + t.equal(m.size, 2) + + var akey = {} + var bkey = {} + m.set(akey, { some: 'data' }) + m.set(bkey, { some: 'other data' }) + t.same(m.get(akey), { some: 'data' }) + t.same(m.get(bkey), { some: 'other data' }) + t.equal(m.size, 4) + + var x = /x/ + var y = /x/ + m.set(x, 'x regex') + m.set(y, 'y regex') + t.equal(m.get(x), 'x regex') + m.set(x, 'x again') + t.equal(m.get(x), 'x again') + t.equal(m.size, 6) + + m.set(NaN, 'not a number') + t.equal(m.get(NaN), 'not a number') + m.set(NaN, 'it is a ' + typeof NaN) + t.equal(m.get(NaN), 'it is a number') + m.set('NaN', 'stringie nan') + t.equal(m.get(NaN), 'it is a number') + t.equal(m.get('NaN'), 'stringie nan') + t.equal(m.size, 8) + + m.delete(NaN) + t.equal(m.get(NaN), undefined) + t.equal(m.size, 7) + + var expect = [ + { value: 'number 1', key: 1 }, + { value: 'string 1', key: '1' }, + { value: { some: 'data' }, key: {} }, + { value: { some: 'other data' }, key: {} }, + { value: 'x again', key: /x/ }, + { value: 'y regex', key: /x/ }, + { value: 'stringie nan', key: 'NaN' } + ] + var actual = [] + + m.forEach(function (value, key) { + actual.push({ value: value, key: key }) + }) + t.same(actual, expect) + + m.clear() + t.equal(m.size, 0) +} diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/node_modules/semver/LICENSE b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/LICENSE similarity index 100% rename from deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/node_modules/semver/LICENSE rename to deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/LICENSE diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/README.md b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/README.md new file mode 100644 index 00000000000000..f5861018696688 --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/README.md @@ -0,0 +1,204 @@ +# yallist + +Yet Another Linked List + +There are many doubly-linked list implementations like it, but this +one is mine. + +For when an array would be too big, and a Map can't be iterated in +reverse order. + + +[![Build Status](https://travis-ci.org/isaacs/yallist.svg?branch=master)](https://travis-ci.org/isaacs/yallist) [![Coverage Status](https://coveralls.io/repos/isaacs/yallist/badge.svg?service=github)](https://coveralls.io/github/isaacs/yallist) + +## basic usage + +```javascript +var yallist = require('yallist') +var myList = yallist.create([1, 2, 3]) +myList.push('foo') +myList.unshift('bar') +// of course pop() and shift() are there, too +console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo'] +myList.forEach(function (k) { + // walk the list head to tail +}) +myList.forEachReverse(function (k, index, list) { + // walk the list tail to head +}) +var myDoubledList = myList.map(function (k) { + return k + k +}) +// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo'] +// mapReverse is also a thing +var myDoubledListReverse = myList.mapReverse(function (k) { + return k + k +}) // ['foofoo', 6, 4, 2, 'barbar'] + +var reduced = myList.reduce(function (set, entry) { + set += entry + return set +}, 'start') +console.log(reduced) // 'startfoo123bar' +``` + +## api + +The whole API is considered "public". + +Functions with the same name as an Array method work more or less the +same way. + +There's reverse versions of most things because that's the point. + +### Yallist + +Default export, the class that holds and manages a list. + +Call it with either a forEach-able (like an array) or a set of +arguments, to initialize the list. + +The Array-ish methods all act like you'd expect. No magic length, +though, so if you change that it won't automatically prune or add +empty spots. + +### Yallist.create(..) + +Alias for Yallist function. Some people like factories. + +#### yallist.head + +The first node in the list + +#### yallist.tail + +The last node in the list + +#### yallist.length + +The number of nodes in the list. (Change this at your peril. It is +not magic like Array length.) + +#### yallist.toArray() + +Convert the list to an array. + +#### yallist.forEach(fn, [thisp]) + +Call a function on each item in the list. + +#### yallist.forEachReverse(fn, [thisp]) + +Call a function on each item in the list, in reverse order. + +#### yallist.get(n) + +Get the data at position `n` in the list. If you use this a lot, +probably better off just using an Array. + +#### yallist.getReverse(n) + +Get the data at position `n`, counting from the tail. + +#### yallist.map(fn, thisp) + +Create a new Yallist with the result of calling the function on each +item. + +#### yallist.mapReverse(fn, thisp) + +Same as `map`, but in reverse. + +#### yallist.pop() + +Get the data from the list tail, and remove the tail from the list. + +#### yallist.push(item, ...) + +Insert one or more items to the tail of the list. + +#### yallist.reduce(fn, initialValue) + +Like Array.reduce. + +#### yallist.reduceReverse + +Like Array.reduce, but in reverse. + +#### yallist.reverse + +Reverse the list in place. + +#### yallist.shift() + +Get the data from the list head, and remove the head from the list. + +#### yallist.slice([from], [to]) + +Just like Array.slice, but returns a new Yallist. + +#### yallist.sliceReverse([from], [to]) + +Just like yallist.slice, but the result is returned in reverse. + +#### yallist.toArray() + +Create an array representation of the list. + +#### yallist.toArrayReverse() + +Create a reversed array representation of the list. + +#### yallist.unshift(item, ...) + +Insert one or more items to the head of the list. + +#### yallist.unshiftNode(node) + +Move a Node object to the front of the list. (That is, pull it out of +wherever it lives, and make it the new head.) + +If the node belongs to a different list, then that list will remove it +first. + +#### yallist.pushNode(node) + +Move a Node object to the end of the list. (That is, pull it out of +wherever it lives, and make it the new tail.) + +If the node belongs to a list already, then that list will remove it +first. + +#### yallist.removeNode(node) + +Remove a node from the list, preserving referential integrity of head +and tail and other nodes. + +Will throw an error if you try to have a list remove a node that +doesn't belong to it. + +### Yallist.Node + +The class that holds the data and is actually the list. + +Call with `var n = new Node(value, previousNode, nextNode)` + +Note that if you do direct operations on Nodes themselves, it's very +easy to get into weird states where the list is broken. Be careful :) + +#### node.next + +The next node in the list. + +#### node.prev + +The previous node in the list. + +#### node.value + +The data the node contains. + +#### node.list + +The list to which this node belongs. (Null if it does not belong to +any list.) diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/iterator.js b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/iterator.js new file mode 100644 index 00000000000000..4a15bf22c40032 --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/iterator.js @@ -0,0 +1,7 @@ +var Yallist = require('./yallist.js') + +Yallist.prototype[Symbol.iterator] = function* () { + for (let walker = this.head; walker; walker = walker.next) { + yield walker.value + } +} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/package.json b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/package.json new file mode 100644 index 00000000000000..b0fdf0d0a6fdf6 --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/package.json @@ -0,0 +1,62 @@ +{ + "_from": "yallist@^2.1.2", + "_id": "yallist@2.1.2", + "_inBundle": false, + "_integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "_location": "/cacache/lru-cache/yallist", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "yallist@^2.1.2", + "name": "yallist", + "escapedName": "yallist", + "rawSpec": "^2.1.2", + "saveSpec": null, + "fetchSpec": "^2.1.2" + }, + "_requiredBy": [ + "/cacache/lru-cache" + ], + "_resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "_shasum": "1c11f9218f076089a47dd512f93c6699a6a81d52", + "_spec": "yallist@^2.1.2", + "_where": "/Users/rebecca/code/npm/node_modules/cacache/node_modules/lru-cache", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/yallist/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Yet Another Linked List", + "devDependencies": { + "tap": "^10.3.0" + }, + "directories": { + "test": "test" + }, + "files": [ + "yallist.js", + "iterator.js" + ], + "homepage": "https://github.com/isaacs/yallist#readme", + "license": "ISC", + "main": "yallist.js", + "name": "yallist", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/yallist.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js --100" + }, + "version": "2.1.2" +} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/yallist.js b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/yallist.js new file mode 100644 index 00000000000000..518d23330b936c --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/yallist.js @@ -0,0 +1,370 @@ +module.exports = Yallist + +Yallist.Node = Node +Yallist.create = Yallist + +function Yallist (list) { + var self = this + if (!(self instanceof Yallist)) { + self = new Yallist() + } + + self.tail = null + self.head = null + self.length = 0 + + if (list && typeof list.forEach === 'function') { + list.forEach(function (item) { + self.push(item) + }) + } else if (arguments.length > 0) { + for (var i = 0, l = arguments.length; i < l; i++) { + self.push(arguments[i]) + } + } + + return self +} + +Yallist.prototype.removeNode = function (node) { + if (node.list !== this) { + throw new Error('removing node which does not belong to this list') + } + + var next = node.next + var prev = node.prev + + if (next) { + next.prev = prev + } + + if (prev) { + prev.next = next + } + + if (node === this.head) { + this.head = next + } + if (node === this.tail) { + this.tail = prev + } + + node.list.length-- + node.next = null + node.prev = null + node.list = null +} + +Yallist.prototype.unshiftNode = function (node) { + if (node === this.head) { + return + } + + if (node.list) { + node.list.removeNode(node) + } + + var head = this.head + node.list = this + node.next = head + if (head) { + head.prev = node + } + + this.head = node + if (!this.tail) { + this.tail = node + } + this.length++ +} + +Yallist.prototype.pushNode = function (node) { + if (node === this.tail) { + return + } + + if (node.list) { + node.list.removeNode(node) + } + + var tail = this.tail + node.list = this + node.prev = tail + if (tail) { + tail.next = node + } + + this.tail = node + if (!this.head) { + this.head = node + } + this.length++ +} + +Yallist.prototype.push = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + push(this, arguments[i]) + } + return this.length +} + +Yallist.prototype.unshift = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + unshift(this, arguments[i]) + } + return this.length +} + +Yallist.prototype.pop = function () { + if (!this.tail) { + return undefined + } + + var res = this.tail.value + this.tail = this.tail.prev + if (this.tail) { + this.tail.next = null + } else { + this.head = null + } + this.length-- + return res +} + +Yallist.prototype.shift = function () { + if (!this.head) { + return undefined + } + + var res = this.head.value + this.head = this.head.next + if (this.head) { + this.head.prev = null + } else { + this.tail = null + } + this.length-- + return res +} + +Yallist.prototype.forEach = function (fn, thisp) { + thisp = thisp || this + for (var walker = this.head, i = 0; walker !== null; i++) { + fn.call(thisp, walker.value, i, this) + walker = walker.next + } +} + +Yallist.prototype.forEachReverse = function (fn, thisp) { + thisp = thisp || this + for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { + fn.call(thisp, walker.value, i, this) + walker = walker.prev + } +} + +Yallist.prototype.get = function (n) { + for (var i = 0, walker = this.head; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.next + } + if (i === n && walker !== null) { + return walker.value + } +} + +Yallist.prototype.getReverse = function (n) { + for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.prev + } + if (i === n && walker !== null) { + return walker.value + } +} + +Yallist.prototype.map = function (fn, thisp) { + thisp = thisp || this + var res = new Yallist() + for (var walker = this.head; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)) + walker = walker.next + } + return res +} + +Yallist.prototype.mapReverse = function (fn, thisp) { + thisp = thisp || this + var res = new Yallist() + for (var walker = this.tail; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)) + walker = walker.prev + } + return res +} + +Yallist.prototype.reduce = function (fn, initial) { + var acc + var walker = this.head + if (arguments.length > 1) { + acc = initial + } else if (this.head) { + walker = this.head.next + acc = this.head.value + } else { + throw new TypeError('Reduce of empty list with no initial value') + } + + for (var i = 0; walker !== null; i++) { + acc = fn(acc, walker.value, i) + walker = walker.next + } + + return acc +} + +Yallist.prototype.reduceReverse = function (fn, initial) { + var acc + var walker = this.tail + if (arguments.length > 1) { + acc = initial + } else if (this.tail) { + walker = this.tail.prev + acc = this.tail.value + } else { + throw new TypeError('Reduce of empty list with no initial value') + } + + for (var i = this.length - 1; walker !== null; i--) { + acc = fn(acc, walker.value, i) + walker = walker.prev + } + + return acc +} + +Yallist.prototype.toArray = function () { + var arr = new Array(this.length) + for (var i = 0, walker = this.head; walker !== null; i++) { + arr[i] = walker.value + walker = walker.next + } + return arr +} + +Yallist.prototype.toArrayReverse = function () { + var arr = new Array(this.length) + for (var i = 0, walker = this.tail; walker !== null; i++) { + arr[i] = walker.value + walker = walker.prev + } + return arr +} + +Yallist.prototype.slice = function (from, to) { + to = to || this.length + if (to < 0) { + to += this.length + } + from = from || 0 + if (from < 0) { + from += this.length + } + var ret = new Yallist() + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0 + } + if (to > this.length) { + to = this.length + } + for (var i = 0, walker = this.head; walker !== null && i < from; i++) { + walker = walker.next + } + for (; walker !== null && i < to; i++, walker = walker.next) { + ret.push(walker.value) + } + return ret +} + +Yallist.prototype.sliceReverse = function (from, to) { + to = to || this.length + if (to < 0) { + to += this.length + } + from = from || 0 + if (from < 0) { + from += this.length + } + var ret = new Yallist() + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0 + } + if (to > this.length) { + to = this.length + } + for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { + walker = walker.prev + } + for (; walker !== null && i > from; i--, walker = walker.prev) { + ret.push(walker.value) + } + return ret +} + +Yallist.prototype.reverse = function () { + var head = this.head + var tail = this.tail + for (var walker = head; walker !== null; walker = walker.prev) { + var p = walker.prev + walker.prev = walker.next + walker.next = p + } + this.head = tail + this.tail = head + return this +} + +function push (self, item) { + self.tail = new Node(item, self.tail, null, self) + if (!self.head) { + self.head = self.tail + } + self.length++ +} + +function unshift (self, item) { + self.head = new Node(item, null, self.head, self) + if (!self.tail) { + self.tail = self.head + } + self.length++ +} + +function Node (value, prev, next, list) { + if (!(this instanceof Node)) { + return new Node(value, prev, next, list) + } + + this.list = list + this.value = value + + if (prev) { + prev.next = this + this.prev = prev + } else { + this.prev = null + } + + if (next) { + next.prev = this + this.next = next + } else { + this.next = null + } +} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/package.json b/deps/npm/node_modules/cacache/node_modules/lru-cache/package.json new file mode 100644 index 00000000000000..b0b037c12876f9 --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/lru-cache/package.json @@ -0,0 +1,68 @@ +{ + "_from": "lru-cache@^4.1.1", + "_id": "lru-cache@4.1.1", + "_inBundle": false, + "_integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "_location": "/cacache/lru-cache", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "lru-cache@^4.1.1", + "name": "lru-cache", + "escapedName": "lru-cache", + "rawSpec": "^4.1.1", + "saveSpec": null, + "fetchSpec": "^4.1.1" + }, + "_requiredBy": [ + "/cacache" + ], + "_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "_shasum": "622e32e82488b49279114a4f9ecf45e7cd6bba55", + "_spec": "lru-cache@^4.1.1", + "_where": "/Users/rebecca/code/npm/node_modules/cacache", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me" + }, + "bugs": { + "url": "https://github.com/isaacs/node-lru-cache/issues" + }, + "bundleDependencies": false, + "dependencies": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + }, + "deprecated": false, + "description": "A cache object that deletes the least-recently-used items.", + "devDependencies": { + "benchmark": "^2.1.4", + "standard": "^5.4.1", + "tap": "^10.3.3" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/isaacs/node-lru-cache#readme", + "keywords": [ + "mru", + "lru", + "cache" + ], + "license": "ISC", + "main": "index.js", + "name": "lru-cache", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-lru-cache.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "posttest": "standard test/*.js index.js", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js --100 -J" + }, + "version": "4.1.1" +} diff --git a/deps/npm/node_modules/cacache/package.json b/deps/npm/node_modules/cacache/package.json index b55c3ba6897b82..3290274a429a1d 100644 --- a/deps/npm/node_modules/cacache/package.json +++ b/deps/npm/node_modules/cacache/package.json @@ -1,19 +1,19 @@ { - "_from": "cacache@9.2.8", - "_id": "cacache@9.2.8", + "_from": "cacache@latest", + "_id": "cacache@9.2.9", "_inBundle": false, - "_integrity": "sha512-nA3gmaDPEsFWqI5eYAe35IfvW54yGJ3ns2wDopWf4iDA3fkhBNsdvnYp4NrL+L7ysMt0/isM84Mwi+b4l8/pMQ==", + "_integrity": "sha512-ghg1j5OyTJ6qsrqU++dN23QiTDxb5AZCFGsF3oB+v9v/gY+F4X8L/0gdQMEjd+8Ot3D29M2etX5PKozHRn2JQw==", "_location": "/cacache", "_phantomChildren": {}, "_requested": { - "type": "version", + "type": "tag", "registry": true, - "raw": "cacache@9.2.8", + "raw": "cacache@latest", "name": "cacache", "escapedName": "cacache", - "rawSpec": "9.2.8", + "rawSpec": "latest", "saveSpec": null, - "fetchSpec": "9.2.8" + "fetchSpec": "latest" }, "_requiredBy": [ "#USER", @@ -21,10 +21,10 @@ "/pacote", "/pacote/make-fetch-happen" ], - "_resolved": "https://registry.npmjs.org/cacache/-/cacache-9.2.8.tgz", - "_shasum": "2e38b51161a3904e3b9fb35c0869b751f7d0bcf4", - "_spec": "cacache@9.2.8", - "_where": "/Users/zkat/Documents/code/npm", + "_resolved": "https://registry.npmjs.org/cacache/-/cacache-9.2.9.tgz", + "_shasum": "f9d7ffe039851ec94c28290662afa4dd4bb9e8dd", + "_spec": "cacache@latest", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Kat Marchán", "email": "kzm@sykosomatic.org" @@ -60,13 +60,13 @@ "chownr": "^1.0.1", "glob": "^7.1.2", "graceful-fs": "^4.1.11", - "lru-cache": "^4.0.2", + "lru-cache": "^4.1.1", "mississippi": "^1.3.0", "mkdirp": "^0.5.1", "move-concurrently": "^1.0.1", "promise-inflight": "^1.0.1", "rimraf": "^2.6.1", - "ssri": "^4.1.5", + "ssri": "^4.1.6", "unique-filename": "^1.1.0", "y18n": "^3.2.1" }, @@ -75,14 +75,14 @@ "devDependencies": { "benchmark": "^2.1.4", "chalk": "^1.1.3", - "cross-env": "^5.0.0", + "cross-env": "^5.0.1", "nyc": "^11.0.2", "require-inject": "^1.4.0", "safe-buffer": "^5.1.0", "standard": "^10.0.2", - "standard-version": "^4.0.0", + "standard-version": "^4.2.0", "tacks": "^1.2.2", - "tap": "^10.3.3", + "tap": "^10.3.4", "weallbehave": "^1.2.0", "weallcontribute": "^1.0.8" }, @@ -125,5 +125,5 @@ "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" }, - "version": "9.2.8" + "version": "9.2.9" } diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/index.js b/deps/npm/node_modules/columnify/node_modules/strip-ansi/index.js new file mode 100644 index 00000000000000..099480fbfc54cb --- /dev/null +++ b/deps/npm/node_modules/columnify/node_modules/strip-ansi/index.js @@ -0,0 +1,6 @@ +'use strict'; +var ansiRegex = require('ansi-regex')(); + +module.exports = function (str) { + return typeof str === 'string' ? str.replace(ansiRegex, '') : str; +}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/ansi-align/node_modules/string-width/license b/deps/npm/node_modules/columnify/node_modules/strip-ansi/license similarity index 100% rename from deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/ansi-align/node_modules/string-width/license rename to deps/npm/node_modules/columnify/node_modules/strip-ansi/license diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/index.js b/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/index.js new file mode 100644 index 00000000000000..b9574ed7e82013 --- /dev/null +++ b/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/index.js @@ -0,0 +1,4 @@ +'use strict'; +module.exports = function () { + return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; +}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/ansi-align/node_modules/string-width/node_modules/code-point-at/license b/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/license similarity index 100% rename from deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/ansi-align/node_modules/string-width/node_modules/code-point-at/license rename to deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/license diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/package.json b/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/package.json new file mode 100644 index 00000000000000..b5fbbd7d767916 --- /dev/null +++ b/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/package.json @@ -0,0 +1,108 @@ +{ + "_from": "ansi-regex@^2.0.0", + "_id": "ansi-regex@2.1.1", + "_inBundle": false, + "_integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "_location": "/columnify/strip-ansi/ansi-regex", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ansi-regex@^2.0.0", + "name": "ansi-regex", + "escapedName": "ansi-regex", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/columnify/strip-ansi" + ], + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df", + "_spec": "ansi-regex@^2.0.0", + "_where": "/Users/rebecca/code/npm/node_modules/columnify/node_modules/strip-ansi", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/chalk/ansi-regex/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Regular expression for matching ANSI escape codes", + "devDependencies": { + "ava": "0.17.0", + "xo": "0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/chalk/ansi-regex#readme", + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "license": "MIT", + "maintainers": [ + { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + { + "name": "Joshua Appelman", + "email": "jappelman@xebia.com", + "url": "jbnicolai.com" + }, + { + "name": "JD Ballard", + "email": "i.am.qix@gmail.com", + "url": "github.com/qix-" + } + ], + "name": "ansi-regex", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/ansi-regex.git" + }, + "scripts": { + "test": "xo && ava --verbose", + "view-supported": "node fixtures/view-codes.js" + }, + "version": "2.1.1", + "xo": { + "rules": { + "guard-for-in": 0, + "no-loop-func": 0 + } + } +} diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/readme.md b/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/readme.md new file mode 100644 index 00000000000000..6a928edf0f6b08 --- /dev/null +++ b/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/readme.md @@ -0,0 +1,39 @@ +# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) + +> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install --save ansi-regex +``` + + +## Usage + +```js +const ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001b[4mcake\u001b[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001b[4mcake\u001b[0m'.match(ansiRegex()); +//=> ['\u001b[4m', '\u001b[0m'] +``` + +## FAQ + +### Why do you test for codes not in the ECMA 48 standard? + +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. + +On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/package.json b/deps/npm/node_modules/columnify/node_modules/strip-ansi/package.json new file mode 100644 index 00000000000000..2befc6de4d28bb --- /dev/null +++ b/deps/npm/node_modules/columnify/node_modules/strip-ansi/package.json @@ -0,0 +1,101 @@ +{ + "_from": "strip-ansi@^3.0.0", + "_id": "strip-ansi@3.0.1", + "_inBundle": false, + "_integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "_location": "/columnify/strip-ansi", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "strip-ansi@^3.0.0", + "name": "strip-ansi", + "escapedName": "strip-ansi", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/columnify" + ], + "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "_shasum": "6a385fb8853d952d5ff05d0e8aaf94278dc63dcf", + "_spec": "strip-ansi@^3.0.0", + "_where": "/Users/rebecca/code/npm/node_modules/columnify", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/chalk/strip-ansi/issues" + }, + "bundleDependencies": false, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "deprecated": false, + "description": "Strip ANSI escape codes", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/chalk/strip-ansi#readme", + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "license": "MIT", + "maintainers": [ + { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + { + "name": "Joshua Boy Nicolai Appelman", + "email": "joshua@jbna.nl", + "url": "jbna.nl" + }, + { + "name": "JD Ballard", + "email": "i.am.qix@gmail.com", + "url": "github.com/qix-" + } + ], + "name": "strip-ansi", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/strip-ansi.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "3.0.1" +} diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/readme.md b/deps/npm/node_modules/columnify/node_modules/strip-ansi/readme.md new file mode 100644 index 00000000000000..cb7d9ff7ee403d --- /dev/null +++ b/deps/npm/node_modules/columnify/node_modules/strip-ansi/readme.md @@ -0,0 +1,33 @@ +# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) + +> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install --save strip-ansi +``` + + +## Usage + +```js +var stripAnsi = require('strip-ansi'); + +stripAnsi('\u001b[4mcake\u001b[0m'); +//=> 'cake' +``` + + +## Related + +- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module +- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes +- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js index e8d8587020ca6c..1685a762932558 100644 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +++ b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js @@ -1,3 +1,4 @@ +'use strict'; module.exports = balanced; function balanced(a, b, str) { if (a instanceof RegExp) a = maybeMatch(a, str); diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json index a3170ed9c3c3fe..4702c7d9a4f0b7 100644 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +++ b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json @@ -1,33 +1,32 @@ { - "_from": "balanced-match@^0.4.1", - "_id": "balanced-match@0.4.2", - "_integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=", + "_from": "balanced-match@^1.0.0", + "_id": "balanced-match@1.0.0", + "_inBundle": false, + "_integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "_location": "/fstream-npm/fstream-ignore/minimatch/brace-expansion/balanced-match", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "balanced-match@^0.4.1", + "raw": "balanced-match@^1.0.0", "name": "balanced-match", "escapedName": "balanced-match", - "rawSpec": "^0.4.1", + "rawSpec": "^1.0.0", "saveSpec": null, - "fetchSpec": "^0.4.1" + "fetchSpec": "^1.0.0" }, "_requiredBy": [ "/fstream-npm/fstream-ignore/minimatch/brace-expansion" ], - "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", - "_shasum": "cb3f3e3c732dc0f01ee70b403f302e61d7709838", - "_shrinkwrap": null, - "_spec": "balanced-match@^0.4.1", - "_where": "/Users/zkat/Documents/code/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion", + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "_shasum": "89b4d199ab2bee49de164ea02b89ce462d71b767", + "_spec": "balanced-match@^1.0.0", + "_where": "/Users/rebecca/code/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion", "author": { "name": "Julian Gruber", "email": "mail@juliangruber.com", "url": "http://juliangruber.com" }, - "bin": null, "bugs": { "url": "https://github.com/juliangruber/balanced-match/issues" }, @@ -36,6 +35,7 @@ "deprecated": false, "description": "Match balanced character pairs, like \"{\" and \"}\"", "devDependencies": { + "matcha": "^0.7.0", "tape": "^4.6.0" }, "homepage": "https://github.com/juliangruber/balanced-match", @@ -49,13 +49,12 @@ "license": "MIT", "main": "index.js", "name": "balanced-match", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git://github.com/juliangruber/balanced-match.git" }, "scripts": { + "bench": "make bench", "test": "make test" }, "testling": { @@ -74,5 +73,5 @@ "android-browser/4.2..latest" ] }, - "version": "0.4.2" + "version": "1.0.0" } diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json index 71448dff902e15..7d38d063ea6021 100644 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json +++ b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json @@ -1,39 +1,38 @@ { - "_from": "brace-expansion@^1.0.0", - "_id": "brace-expansion@1.1.7", - "_integrity": "sha1-Pv/DxQ4ABTH7cg6v+A8K6O8jz1k=", + "_from": "brace-expansion@^1.1.7", + "_id": "brace-expansion@1.1.8", + "_inBundle": false, + "_integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "_location": "/fstream-npm/fstream-ignore/minimatch/brace-expansion", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "brace-expansion@^1.0.0", + "raw": "brace-expansion@^1.1.7", "name": "brace-expansion", "escapedName": "brace-expansion", - "rawSpec": "^1.0.0", + "rawSpec": "^1.1.7", "saveSpec": null, - "fetchSpec": "^1.0.0" + "fetchSpec": "^1.1.7" }, "_requiredBy": [ "/fstream-npm/fstream-ignore/minimatch" ], - "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz", - "_shasum": "3effc3c50e000531fb720eaff80f0ae8ef23cf59", - "_shrinkwrap": null, - "_spec": "brace-expansion@^1.0.0", - "_where": "/Users/zkat/Documents/code/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch", + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "_shasum": "c07b211c7c952ec1f8efd51a77ef0d1d3990a292", + "_spec": "brace-expansion@^1.1.7", + "_where": "/Users/rebecca/code/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch", "author": { "name": "Julian Gruber", "email": "mail@juliangruber.com", "url": "http://juliangruber.com" }, - "bin": null, "bugs": { "url": "https://github.com/juliangruber/brace-expansion/issues" }, "bundleDependencies": false, "dependencies": { - "balanced-match": "^0.4.1", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" }, "deprecated": false, @@ -47,8 +46,6 @@ "license": "MIT", "main": "index.js", "name": "brace-expansion", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git://github.com/juliangruber/brace-expansion.git" @@ -74,5 +71,5 @@ "android-browser/4.2..latest" ] }, - "version": "1.1.7" + "version": "1.1.8" } diff --git a/deps/npm/node_modules/fstream-npm/package.json b/deps/npm/node_modules/fstream-npm/package.json index 3aef0ce37b886a..67169501835444 100644 --- a/deps/npm/node_modules/fstream-npm/package.json +++ b/deps/npm/node_modules/fstream-npm/package.json @@ -1,5 +1,5 @@ { - "_from": "fstream-npm@latest", + "_from": "fstream-npm@~1.2.1", "_id": "fstream-npm@1.2.1", "_inBundle": false, "_integrity": "sha512-iBHpm/LmD1qw0TlHMAqVd9rwdU6M+EHRUnPkXpRi5G/Hf0FIFH+oZFryodAU2MFNfGRh/CzhUFlMKV3pdeOTDw==", @@ -9,14 +9,14 @@ "inherits": "2.0.3" }, "_requested": { - "type": "tag", + "type": "range", "registry": true, - "raw": "fstream-npm@latest", + "raw": "fstream-npm@~1.2.1", "name": "fstream-npm", "escapedName": "fstream-npm", - "rawSpec": "latest", + "rawSpec": "~1.2.1", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "~1.2.1" }, "_requiredBy": [ "#USER", @@ -24,8 +24,8 @@ ], "_resolved": "https://registry.npmjs.org/fstream-npm/-/fstream-npm-1.2.1.tgz", "_shasum": "08c4a452f789dcbac4c89a4563c902b2c862fd5b", - "_spec": "fstream-npm@latest", - "_where": "/Users/zkat/Documents/code/npm", + "_spec": "fstream-npm@~1.2.1", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", diff --git a/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js b/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js index e8d8587020ca6c..1685a762932558 100644 --- a/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +++ b/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js @@ -1,3 +1,4 @@ +'use strict'; module.exports = balanced; function balanced(a, b, str) { if (a instanceof RegExp) a = maybeMatch(a, str); diff --git a/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json b/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json index b1e0e2b28eed7a..23f4e2cc6923d4 100644 --- a/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +++ b/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json @@ -1,33 +1,32 @@ { - "_from": "balanced-match@^0.4.1", - "_id": "balanced-match@0.4.2", - "_integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=", + "_from": "balanced-match@^1.0.0", + "_id": "balanced-match@1.0.0", + "_inBundle": false, + "_integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "_location": "/glob/minimatch/brace-expansion/balanced-match", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "balanced-match@^0.4.1", + "raw": "balanced-match@^1.0.0", "name": "balanced-match", "escapedName": "balanced-match", - "rawSpec": "^0.4.1", + "rawSpec": "^1.0.0", "saveSpec": null, - "fetchSpec": "^0.4.1" + "fetchSpec": "^1.0.0" }, "_requiredBy": [ "/glob/minimatch/brace-expansion" ], - "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", - "_shasum": "cb3f3e3c732dc0f01ee70b403f302e61d7709838", - "_shrinkwrap": null, - "_spec": "balanced-match@^0.4.1", - "_where": "/Users/zkat/Documents/code/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion", + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "_shasum": "89b4d199ab2bee49de164ea02b89ce462d71b767", + "_spec": "balanced-match@^1.0.0", + "_where": "/Users/rebecca/code/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion", "author": { "name": "Julian Gruber", "email": "mail@juliangruber.com", "url": "http://juliangruber.com" }, - "bin": null, "bugs": { "url": "https://github.com/juliangruber/balanced-match/issues" }, @@ -36,6 +35,7 @@ "deprecated": false, "description": "Match balanced character pairs, like \"{\" and \"}\"", "devDependencies": { + "matcha": "^0.7.0", "tape": "^4.6.0" }, "homepage": "https://github.com/juliangruber/balanced-match", @@ -49,13 +49,12 @@ "license": "MIT", "main": "index.js", "name": "balanced-match", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git://github.com/juliangruber/balanced-match.git" }, "scripts": { + "bench": "make bench", "test": "make test" }, "testling": { @@ -74,5 +73,5 @@ "android-browser/4.2..latest" ] }, - "version": "0.4.2" + "version": "1.0.0" } diff --git a/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json b/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json index 4dce0154bc3462..e7c21ffc56f679 100644 --- a/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +++ b/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json @@ -1,39 +1,38 @@ { - "_from": "brace-expansion@^1.0.0", - "_id": "brace-expansion@1.1.7", - "_integrity": "sha1-Pv/DxQ4ABTH7cg6v+A8K6O8jz1k=", + "_from": "brace-expansion@^1.1.7", + "_id": "brace-expansion@1.1.8", + "_inBundle": false, + "_integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "_location": "/glob/minimatch/brace-expansion", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "brace-expansion@^1.0.0", + "raw": "brace-expansion@^1.1.7", "name": "brace-expansion", "escapedName": "brace-expansion", - "rawSpec": "^1.0.0", + "rawSpec": "^1.1.7", "saveSpec": null, - "fetchSpec": "^1.0.0" + "fetchSpec": "^1.1.7" }, "_requiredBy": [ "/glob/minimatch" ], - "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz", - "_shasum": "3effc3c50e000531fb720eaff80f0ae8ef23cf59", - "_shrinkwrap": null, - "_spec": "brace-expansion@^1.0.0", - "_where": "/Users/zkat/Documents/code/npm/node_modules/glob/node_modules/minimatch", + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "_shasum": "c07b211c7c952ec1f8efd51a77ef0d1d3990a292", + "_spec": "brace-expansion@^1.1.7", + "_where": "/Users/rebecca/code/npm/node_modules/glob/node_modules/minimatch", "author": { "name": "Julian Gruber", "email": "mail@juliangruber.com", "url": "http://juliangruber.com" }, - "bin": null, "bugs": { "url": "https://github.com/juliangruber/brace-expansion/issues" }, "bundleDependencies": false, "dependencies": { - "balanced-match": "^0.4.1", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" }, "deprecated": false, @@ -47,8 +46,6 @@ "license": "MIT", "main": "index.js", "name": "brace-expansion", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git://github.com/juliangruber/brace-expansion.git" @@ -74,5 +71,5 @@ "android-browser/4.2..latest" ] }, - "version": "1.1.7" + "version": "1.1.8" } diff --git a/deps/npm/node_modules/glob/package.json b/deps/npm/node_modules/glob/package.json index 82971fc8bfbac0..afa4b50f1636db 100644 --- a/deps/npm/node_modules/glob/package.json +++ b/deps/npm/node_modules/glob/package.json @@ -1,19 +1,19 @@ { - "_from": "glob@7.1.2", + "_from": "glob@~7.1.2", "_id": "glob@7.1.2", "_inBundle": false, "_integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "_location": "/glob", "_phantomChildren": {}, "_requested": { - "type": "version", + "type": "range", "registry": true, - "raw": "glob@7.1.2", + "raw": "glob@~7.1.2", "name": "glob", "escapedName": "glob", - "rawSpec": "7.1.2", + "rawSpec": "~7.1.2", "saveSpec": null, - "fetchSpec": "7.1.2" + "fetchSpec": "~7.1.2" }, "_requiredBy": [ "#USER", @@ -30,8 +30,8 @@ ], "_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", "_shasum": "c19c9df9a028702d678612384a6552404c636d15", - "_spec": "glob@7.1.2", - "_where": "/Users/zkat/Documents/code/npm", + "_spec": "glob@~7.1.2", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", diff --git a/deps/npm/node_modules/hosted-git-info/index.js b/deps/npm/node_modules/hosted-git-info/index.js index 8577ffb7678af0..9055ab1853de77 100644 --- a/deps/npm/node_modules/hosted-git-info/index.js +++ b/deps/npm/node_modules/hosted-git-info/index.js @@ -23,7 +23,19 @@ var authProtocols = { 'git+http:': true } +var cache = {} + module.exports.fromUrl = function (giturl, opts) { + var key = giturl + JSON.stringify(opts || {}) + + if (!(key in cache)) { + cache[key] = fromUrl(giturl, opts) + } + + return cache[key] +} + +function fromUrl (giturl, opts) { if (giturl == null || giturl === '') return var url = fixupUnqualifiedGist( isGitHubShorthand(giturl) ? 'github:' + giturl : giturl diff --git a/deps/npm/node_modules/hosted-git-info/package.json b/deps/npm/node_modules/hosted-git-info/package.json index b6c1b5e297d662..de691a86c0db77 100644 --- a/deps/npm/node_modules/hosted-git-info/package.json +++ b/deps/npm/node_modules/hosted-git-info/package.json @@ -1,40 +1,39 @@ { - "_from": "hosted-git-info@~2.4.2", - "_id": "hosted-git-info@2.4.2", - "_integrity": "sha1-AHa59GonBQbduq6lZJaJdGBhKmc=", + "_from": "hosted-git-info@2.5.0", + "_id": "hosted-git-info@2.5.0", + "_inBundle": false, + "_integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", "_location": "/hosted-git-info", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "hosted-git-info@~2.4.2", + "raw": "hosted-git-info@2.5.0", "name": "hosted-git-info", "escapedName": "hosted-git-info", - "rawSpec": "~2.4.2", + "rawSpec": "2.5.0", "saveSpec": null, - "fetchSpec": "~2.4.2" + "fetchSpec": "2.5.0" }, "_requiredBy": [ + "#USER", "/", "/normalize-package-data", "/npm-package-arg" ], - "_resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.4.2.tgz", - "_shasum": "0076b9f46a270506ddbaaea56496897460612a67", - "_shrinkwrap": null, - "_spec": "hosted-git-info@~2.4.2", - "_where": "/Users/zkat/Documents/code/npm", + "_resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", + "_shasum": "6d60e34b3abbc8313062c3b798ef8d901a07af3c", + "_spec": "hosted-git-info@2.5.0", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Rebecca Turner", "email": "me@re-becca.org", "url": "http://re-becca.org" }, - "bin": null, "bugs": { "url": "https://github.com/npm/hosted-git-info/issues" }, "bundleDependencies": false, - "dependencies": {}, "deprecated": false, "description": "Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab", "devDependencies": { @@ -56,8 +55,6 @@ "license": "ISC", "main": "index.js", "name": "hosted-git-info", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/npm/hosted-git-info.git" @@ -65,5 +62,5 @@ "scripts": { "test": "standard && tap -J --coverage test/*.js" }, - "version": "2.4.2" + "version": "2.5.0" } diff --git a/deps/npm/node_modules/libnpx/CHANGELOG.md b/deps/npm/node_modules/libnpx/CHANGELOG.md new file mode 100644 index 00000000000000..19a89f7c47f392 --- /dev/null +++ b/deps/npm/node_modules/libnpx/CHANGELOG.md @@ -0,0 +1,613 @@ +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + + +## [9.2.1](https://github.com/zkat/npx/compare/v9.2.0...v9.2.1) (2017-07-14) + + +### Bug Fixes + +* **windows:** fixed windows binary pathing issues ([761dfe9](https://github.com/zkat/npx/commit/761dfe9)) + + + + +# [9.2.0](https://github.com/zkat/npx/compare/v9.1.0...v9.2.0) (2017-07-14) + + +### Bug Fixes + +* **binpath:** fix calling binaries from subdirectories ([f185d0d](https://github.com/zkat/npx/commit/f185d0d)) +* **i18n:** Fix typos in french locale (#78) ([f277fc7](https://github.com/zkat/npx/commit/f277fc7)), closes [#78](https://github.com/zkat/npx/issues/78) + + +### Features + +* **i18n:** Add German translations (#79) ([c81e26d](https://github.com/zkat/npx/commit/c81e26d)) +* **i18n:** add zh_TW translation (#80) ([98288d8](https://github.com/zkat/npx/commit/98288d8)) + + + + +# [9.1.0](https://github.com/zkat/npx/compare/v9.0.7...v9.1.0) (2017-07-12) + + +### Bug Fixes + +* **call:** only npm run env if package.json exists ([370f395](https://github.com/zkat/npx/commit/370f395)) +* **i18n:** Fix grammar and spelling for de.json (#63) ([b14020f](https://github.com/zkat/npx/commit/b14020f)), closes [#63](https://github.com/zkat/npx/issues/63) +* **i18n:** wording revisions for Brazilian Portuguese (#75) ([b5dc536](https://github.com/zkat/npx/commit/b5dc536)) +* **npm:** path directly to the npm-cli.js script ([d531206](https://github.com/zkat/npx/commit/d531206)) +* **rimraf:** fix rimraf.sync is not a function issue ([d2ecba3](https://github.com/zkat/npx/commit/d2ecba3)) +* **windows:** get npx working well on Windows again (#69) ([6cfb8de](https://github.com/zkat/npx/commit/6cfb8de)), closes [#60](https://github.com/zkat/npx/issues/60) [#58](https://github.com/zkat/npx/issues/58) [#62](https://github.com/zkat/npx/issues/62) + + +### Features + +* **i18n:** add Czech translation (#76) ([8a0b3f6](https://github.com/zkat/npx/commit/8a0b3f6)) +* **i18n:** Add Turkish translation (#73) ([26e5edf](https://github.com/zkat/npx/commit/26e5edf)) +* **i18n:** Added support for Italian language (#71) ([6883e75](https://github.com/zkat/npx/commit/6883e75)) +* **i18n:** Fix Romanian translation (#70) ([fd6bbcf](https://github.com/zkat/npx/commit/fd6bbcf)), closes [#70](https://github.com/zkat/npx/issues/70) +* **node:** add --node-arg support to pass flags to node for script binaries (#77) ([65665bd](https://github.com/zkat/npx/commit/65665bd)) + + + + +## [9.0.7](https://github.com/zkat/npx/compare/v9.0.6...v9.0.7) (2017-07-11) + + +### Bug Fixes + +* **i18n:** Fix some Catalan translations (#59) ([11c8a19](https://github.com/zkat/npx/commit/11c8a19)), closes [#59](https://github.com/zkat/npx/issues/59) + + + + +## [9.0.6](https://github.com/zkat/npx/compare/v9.0.5...v9.0.6) (2017-07-11) + + +### Bug Fixes + +* **auto-fallback:** fix syntax error in bash/zsh auto-fallback ([d8b19db](https://github.com/zkat/npx/commit/d8b19db)) + + + + +## [9.0.5](https://github.com/zkat/npx/compare/v9.0.4...v9.0.5) (2017-07-11) + + +### Bug Fixes + +* **npx:** something went wrong with the 9.0.4 build and bundledeps ([75fc436](https://github.com/zkat/npx/commit/75fc436)) + + + + +## [9.0.4](https://github.com/zkat/npx/compare/v9.0.3...v9.0.4) (2017-07-11) + + +### Bug Fixes + +* **auto-fallback:** prevent infinite loop if npx disappears ([6c24e58](https://github.com/zkat/npx/commit/6c24e58)) +* **bin:** add repository and more detailed author info ([906574e](https://github.com/zkat/npx/commit/906574e)) +* **bin:** pin the npx bin's dependencies ([ae62f7a](https://github.com/zkat/npx/commit/ae62f7a)) +* **build:** make sure changelog and license are copied to bin ([4fbb599](https://github.com/zkat/npx/commit/4fbb599)) +* **deps:** stop bundling deps in libnpx itself ([c3e56e9](https://github.com/zkat/npx/commit/c3e56e9)) +* **errors:** print command not found for packages without valid binaries ([9b24359](https://github.com/zkat/npx/commit/9b24359)) +* **help:** --no-install help text was contradicting itself ([9d96f5e](https://github.com/zkat/npx/commit/9d96f5e)) +* **install:** prevent concurrent npx runs from clobbering each other ([6b35c91](https://github.com/zkat/npx/commit/6b35c91)) +* **npx:** npx npx npx npx npx npx npx npx npx works again ([875d4cd](https://github.com/zkat/npx/commit/875d4cd)) +* **updater:** dependency injection for update-notifier target ([c3027a9](https://github.com/zkat/npx/commit/c3027a9)) +* **updater:** ignore some kinds of update-notifier errors ([7631bbe](https://github.com/zkat/npx/commit/7631bbe)) + + + + +## [9.0.3](https://github.com/zkat/npx/compare/v9.0.2...v9.0.3) (2017-07-08) + + +### Bug Fixes + +* **version:** hand version to yargs directly ([e0b5eeb](https://github.com/zkat/npx/commit/e0b5eeb)) + + + + +## [9.0.2](https://github.com/zkat/npx/compare/v9.0.1...v9.0.2) (2017-07-08) + + +### Bug Fixes + +* **manpage:** fix manpage for real because files syntax is weird ([9145e2a](https://github.com/zkat/npx/commit/9145e2a)) + + + + +## [9.0.1](https://github.com/zkat/npx/compare/v9.0.0...v9.0.1) (2017-07-08) + + +### Bug Fixes + +* **man:** make sure manpage is used in npx bin ([704b94f](https://github.com/zkat/npx/commit/704b94f)) + + + + +# [9.0.0](https://github.com/zkat/npx/compare/v8.1.1...v9.0.0) (2017-07-08) + + +### Features + +* **libnpx:** libify main npx codebase ([643f58e](https://github.com/zkat/npx/commit/643f58e)) +* **npx:** create a new binary for standalone publishing ([da5a3b7](https://github.com/zkat/npx/commit/da5a3b7)) + + +### BREAKING CHANGES + +* **libnpx:** This version of npx can no longer be used as a +standalone binary. It will be available on the registry as `libnpx`, +and a separate project will take over the role of the main `npx` binary. + + + + +## [8.1.1](https://github.com/zkat/npx/compare/v8.1.0...v8.1.1) (2017-07-06) + + +### Bug Fixes + +* **deps:** bump all deps ([6ea24bf](https://github.com/zkat/npx/commit/6ea24bf)) +* **npm:** bump npm to 5.1.0 for a bunch of fixes ([18e4587](https://github.com/zkat/npx/commit/18e4587)) + + + + +# [8.1.0](https://github.com/zkat/npx/compare/v8.0.1...v8.1.0) (2017-06-27) + + +### Bug Fixes + +* **i18n:** minor tweaks to ja.json (#46) ([1ed63c2](https://github.com/zkat/npx/commit/1ed63c2)) + + +### Features + +* **i18n:** Update pt_BR.json (#51) ([d292f22](https://github.com/zkat/npx/commit/d292f22)) + + + + +## [8.0.1](https://github.com/zkat/npx/compare/v8.0.0...v8.0.1) (2017-06-27) + + +### Bug Fixes + +* **npm:** bump npm version for more bugfixes ([30711a8](https://github.com/zkat/npx/commit/30711a8)) +* **npm:** Use --parseable option to work around output quirks ([8cb75a2](https://github.com/zkat/npx/commit/8cb75a2)) + + + + +# [8.0.0](https://github.com/zkat/npx/compare/v7.0.0...v8.0.0) (2017-06-24) + + +### Features + +* **exec:** auto-guess binaries when different from pkg name ([139c434](https://github.com/zkat/npx/commit/139c434)) + + +### BREAKING CHANGES + +* **exec:** `npx ember-cli` and such things will now execute the +binary based on some guesswork, but only when using the shorthand format +for npx execution, with no `-p` option or `-c`. This might cause npx to +unintentionally execute the wrong binary if the package in question has +multiple non-matching binaries, but that should be rare. + + + + +# [7.0.0](https://github.com/zkat/npx/compare/v6.2.0...v7.0.0) (2017-06-24) + + +### Bug Fixes + +* **win32:** improve win32 situation a bit (#50) ([b7ad934](https://github.com/zkat/npx/commit/b7ad934)) + + +### Features + +* **local:** improve the behavior when calling ./local paths (#48) ([2e418d1](https://github.com/zkat/npx/commit/2e418d1)) + + +### BREAKING CHANGES + +* **local:** `npx ./something` will now execute `./something` as a +binary or script instead of trying to install it as npm would. Other behavior +related to local path deps has likewise been changed. See +[#49](https://github.com/zkat/npx/issues/49) for a detailed explanation +of all the various cases and how each of them is handled. + + + + +# [6.2.0](https://github.com/zkat/npx/compare/v6.1.0...v6.2.0) (2017-06-23) + + +### Bug Fixes + +* **child:** iron out a few crinkles and add tests ([b3b5ef6](https://github.com/zkat/npx/commit/b3b5ef6)) +* **execCmd:** only reuse the current process if no shell passed in ([e413cff](https://github.com/zkat/npx/commit/e413cff)) +* **execCmd:** use the module built-in directly ([6f741c2](https://github.com/zkat/npx/commit/6f741c2)) +* **help:** fuck it. just hard-code it ([d5d5085](https://github.com/zkat/npx/commit/d5d5085)) +* **main:** only exec if this is the main module ([9631e2a](https://github.com/zkat/npx/commit/9631e2a)) + + +### Features + +* **i18n:** Update fr.json (#44) ([ea47c4f](https://github.com/zkat/npx/commit/ea47c4f)) +* **i18n:** update the Romanian translation. (#42) ([2ed36b6](https://github.com/zkat/npx/commit/2ed36b6)) + + + + +# [6.1.0](https://github.com/zkat/npx/compare/v6.0.0...v6.1.0) (2017-06-21) + + +### Bug Fixes + +* **deps:** remove unused gauge dep ([aa40a34](https://github.com/zkat/npx/commit/aa40a34)) + + +### Features + +* **i18n:** update ru locale (#41) ([7c84dee](https://github.com/zkat/npx/commit/7c84dee)) +* **i18n:** update zh_CN (#40) ([da4ec67](https://github.com/zkat/npx/commit/da4ec67)) +* **perf:** run node-based commands in the current process ([6efcde4](https://github.com/zkat/npx/commit/6efcde4)) + + + + +# [6.0.0](https://github.com/zkat/npx/compare/v5.4.0...v6.0.0) (2017-06-20) + + +### Bug Fixes + +* **call:** stop parsing -c for commands + fix corner cases ([bd4e538](https://github.com/zkat/npx/commit/bd4e538)) +* **child:** exec does not have the information needed to correctly escape its args ([6714992](https://github.com/zkat/npx/commit/6714992)) +* **guessCmdName:** tests failed because of lazy npa ([53a0119](https://github.com/zkat/npx/commit/53a0119)) +* **i18n:** gender inclusiveness fix for french version (#37) ([04920ae](https://github.com/zkat/npx/commit/04920ae)), closes [#37](https://github.com/zkat/npx/issues/37) +* **i18n:** typo 😇 (#38) ([ede4a53](https://github.com/zkat/npx/commit/ede4a53)) +* **install:** handle JSON parsing failures ([bec2887](https://github.com/zkat/npx/commit/bec2887)) +* **output:** stop printing out Command Failed messages ([873cffe](https://github.com/zkat/npx/commit/873cffe)) +* **parseArgs:** fix booboo in fast path ([d1e5487](https://github.com/zkat/npx/commit/d1e5487)) +* **perf:** fast-path `npx foo` arg parsing ([ba4fe71](https://github.com/zkat/npx/commit/ba4fe71)) +* **perf:** remove bluebird and defer some requires for SPEED ([00fc313](https://github.com/zkat/npx/commit/00fc313)) + + +### Features + +* **i18n:** add Romanian translations. (#34) ([9e98bd0](https://github.com/zkat/npx/commit/9e98bd0)) +* **i18n:** added a few more localizable strings ([779d950](https://github.com/zkat/npx/commit/779d950)) +* **i18n:** updated ca.json ([af7a035](https://github.com/zkat/npx/commit/af7a035)) +* **i18n:** updated es.json ([414644f](https://github.com/zkat/npx/commit/414644f)) +* **i18n:** updated ja.json ([448b082](https://github.com/zkat/npx/commit/448b082)) +* **i18n:** Ze German Translation (#35) ([6f003f5](https://github.com/zkat/npx/commit/6f003f5)) +* **package:** report number of temp packages installed ([5b7fe8d](https://github.com/zkat/npx/commit/5b7fe8d)) +* **perf:** only launch update-notifier when npx installs stuff ([549d413](https://github.com/zkat/npx/commit/549d413)) +* **quiet:** added -q/--quiet to suppress output from npx itself ([16607d9](https://github.com/zkat/npx/commit/16607d9)) + + +### BREAKING CHANGES + +* **call:** `npx -c "foo"` will no longer install `foo`. Use `-p` to specicify packages to install. npx will no longer assume any particular format or escape status for `-c` strings: they will be passed directly, unparsed, and unaltered, to child_process.spawn. + + + + +# [5.4.0](https://github.com/zkat/npx/compare/v5.3.0...v5.4.0) (2017-06-17) + + +### Bug Fixes + +* **i18n:** some corrections for es.json ([4d50b71](https://github.com/zkat/npx/commit/4d50b71)) +* **i18n:** update locale files with bugfixes ([77caf82](https://github.com/zkat/npx/commit/77caf82)) +* **i18n:** Y utility was ignoring falsy entries ([f22a4d0](https://github.com/zkat/npx/commit/f22a4d0)) +* **i18n:** してください -> します ([01671af](https://github.com/zkat/npx/commit/01671af)) + + +### Features + +* **i18n:** add catalan translation ([579efa1](https://github.com/zkat/npx/commit/579efa1)) +* **i18n:** add pt-br translation (#33) ([6142551](https://github.com/zkat/npx/commit/6142551)) +* **i18n:** added largely machine-translated ja.json ([827705f](https://github.com/zkat/npx/commit/827705f)) +* **i18n:** adds russian translation (#32) ([b2619c1](https://github.com/zkat/npx/commit/b2619c1)) + + + + +# [5.3.0](https://github.com/zkat/npx/compare/v5.2.0...v5.3.0) (2017-06-13) + + +### Features + +* **i18n:** add Chinese translation (#31) ([24e1b31](https://github.com/zkat/npx/commit/24e1b31)) + + + + +# [5.2.0](https://github.com/zkat/npx/compare/v5.1.3...v5.2.0) (2017-06-12) + + +### Bug Fixes + +* **i18n:** removing extra spacing in fr.json ([002e2b8](https://github.com/zkat/npx/commit/002e2b8)) + + +### Features + +* **i18n:** add french locale (#29) ([662395b](https://github.com/zkat/npx/commit/662395b)) + + + + +## [5.1.3](https://github.com/zkat/npx/compare/v5.1.2...v5.1.3) (2017-06-12) + + +### Bug Fixes + +* **fallback:** put the Y in the wrong place lol ([d6bf8aa](https://github.com/zkat/npx/commit/d6bf8aa)) + + + + +## [5.1.2](https://github.com/zkat/npx/compare/v5.1.1...v5.1.2) (2017-06-10) + + + + +## [5.1.1](https://github.com/zkat/npx/compare/v5.1.0...v5.1.1) (2017-06-10) + + +### Bug Fixes + +* **i18n:** forgot to add locales to files ([4118d6a](https://github.com/zkat/npx/commit/4118d6a)) + + + + +# [5.1.0](https://github.com/zkat/npx/compare/v5.0.3...v5.1.0) (2017-06-10) + + +### Bug Fixes + +* **exit:** let process exit normally to finish writes ([c50a398](https://github.com/zkat/npx/commit/c50a398)) + + +### Features + +* **i18n:** added es.json ([6cf58b9](https://github.com/zkat/npx/commit/6cf58b9)) +* **i18n:** set up i18n plus baseline en.json locale ([b67bb3a](https://github.com/zkat/npx/commit/b67bb3a)) + + + + +## [5.0.3](https://github.com/zkat/npx/compare/v5.0.2...v5.0.3) (2017-06-09) + + +### Bug Fixes + +* **fallback:** exec is no ([42c1d30](https://github.com/zkat/npx/commit/42c1d30)) + + + + +## [5.0.2](https://github.com/zkat/npx/compare/v5.0.1...v5.0.2) (2017-06-09) + + +### Bug Fixes + +* **fallback:** allow fallback to local anyway ([569cf2c](https://github.com/zkat/npx/commit/569cf2c)) + + + + +## [5.0.1](https://github.com/zkat/npx/compare/v5.0.0...v5.0.1) (2017-06-09) + + + + +# [5.0.0](https://github.com/zkat/npx/compare/v4.0.3...v5.0.0) (2017-06-09) + + +### Features + +* **fallback:** by default, only fall back if you have an @ in the name ([bea08a0](https://github.com/zkat/npx/commit/bea08a0)) + + +### BREAKING CHANGES + +* **fallback:** auto-fallback will no longer fall back unless there was +an @ sign in the command. + + + + +## [4.0.3](https://github.com/zkat/npx/compare/v4.0.2...v4.0.3) (2017-06-04) + + +### Bug Fixes + +* **npm:** use --userconfig when querying for npm cache config (#28) ([21bc3bf](https://github.com/zkat/npx/commit/21bc3bf)) + + + + +## [4.0.2](https://github.com/zkat/npx/compare/v4.0.1...v4.0.2) (2017-06-04) + + +### Bug Fixes + +* **install:** get windows workin (#27) ([9472175](https://github.com/zkat/npx/commit/9472175)) + + + + +## [4.0.1](https://github.com/zkat/npx/compare/v4.0.0...v4.0.1) (2017-06-04) + + +### Bug Fixes + +* **cmd:** make sure to use our own, enriched path ([9c89c2a](https://github.com/zkat/npx/commit/9c89c2a)) +* **error:** join args with a space on Command failed error ([c2f6f18](https://github.com/zkat/npx/commit/c2f6f18)) + + + + +# [4.0.0](https://github.com/zkat/npx/compare/v3.0.0...v4.0.0) (2017-06-03) + + +### Features + +* **call:** -c now loads same env as run-script ([76ae44c](https://github.com/zkat/npx/commit/76ae44c)) +* **npm:** allow configuration of npm binary ([e5d5634](https://github.com/zkat/npx/commit/e5d5634)) +* **npm:** embed npm binary ([a2cae9d](https://github.com/zkat/npx/commit/a2cae9d)) + + +### BREAKING CHANGES + +* **call:** scripts invoked with -c will now have a bunch of +variables added to them that were not there before. +* **npm:** npx will no longer use the system npm -- it embeds its own + + + + +# [3.0.0](https://github.com/zkat/npx/compare/v2.1.0...v3.0.0) (2017-06-03) + + +### Bug Fixes + +* **args:** accept argv as arg and fix minor bugs ([46f10fe](https://github.com/zkat/npx/commit/46f10fe)) +* **deps:** explicitly add mkdirp and rimraf to devDeps ([832c75d](https://github.com/zkat/npx/commit/832c75d)) +* **docs:** misc tweaks to docs ([ed70a7b](https://github.com/zkat/npx/commit/ed70a7b)) +* **exec:** escape binaries and args to cp.exec (#18) ([55d6a11](https://github.com/zkat/npx/commit/55d6a11)) +* **fallback:** shells were sometimes ignored based on $SHELL ([07b7efc](https://github.com/zkat/npx/commit/07b7efc)) +* **get-prefix:** nudge isRootPath ([1ab31eb](https://github.com/zkat/npx/commit/1ab31eb)) +* **help:** correctly enable -h and --help ([adc2f45](https://github.com/zkat/npx/commit/adc2f45)) +* **startup:** delay loading some things to speed up startup ([6b32bf5](https://github.com/zkat/npx/commit/6b32bf5)) + + +### Features + +* **cmd:** do some heuristic guesswork on default command names (#23) ([2404420](https://github.com/zkat/npx/commit/2404420)) +* **ignore:** add --ignore-existing option (#20) ([0866a83](https://github.com/zkat/npx/commit/0866a83)) +* **install:** added --no-install option to prevent install fallbacks ([a5fbdaf](https://github.com/zkat/npx/commit/a5fbdaf)) +* **package:** multiple --package options are now accepted ([f2fa6b3](https://github.com/zkat/npx/commit/f2fa6b3)) +* **save:** remove all save-related functionality (#19) ([ab77f6c](https://github.com/zkat/npx/commit/ab77f6c)) +* **shell:** run -c strings inside a system shell (#22) ([17db461](https://github.com/zkat/npx/commit/17db461)) + + +### BREAKING CHANGES + +* **save:** npx can no longer be used to save packages locally or globally. Use an actual package manager for that, instead. + + + + +# [2.1.0](https://github.com/zkat/npx/compare/v2.0.1...v2.1.0) (2017-06-01) + + +### Features + +* **opts:** add --shell-auto-fallback (#7) ([ac9cb40](https://github.com/zkat/npx/commit/ac9cb40)) + + + + +## [2.0.1](https://github.com/zkat/npx/compare/v2.0.0...v2.0.1) (2017-05-31) + + +### Bug Fixes + +* **exec:** use command lookup joined with current PATH ([d9175e8](https://github.com/zkat/npx/commit/d9175e8)) + + + + +# [2.0.0](https://github.com/zkat/npx/compare/v1.1.1...v2.0.0) (2017-05-31) + + +### Bug Fixes + +* **npm:** manually look up npm path for Windows compat ([0fe8fbf](https://github.com/zkat/npx/commit/0fe8fbf)) + + +### Features + +* **commands:** -p and [@version](https://github.com/version) now trigger installs ([9668c83](https://github.com/zkat/npx/commit/9668c83)) + + +### BREAKING CHANGES + +* **commands:** If a command has an explicit --package option, or if the command has an @version part, any version of the command in $PATH will be ignored and a regular install will be executed. + + + + +## [1.1.1](https://github.com/zkat/npx/compare/v1.1.0...v1.1.1) (2017-05-30) + + +### Bug Fixes + +* **docs:** make sure man page gets installed ([2aadc16](https://github.com/zkat/npx/commit/2aadc16)) + + + + +# [1.1.0](https://github.com/zkat/npx/compare/v1.0.2...v1.1.0) (2017-05-30) + + +### Bug Fixes + +* **help:** update usage string for help ([0747cff](https://github.com/zkat/npx/commit/0747cff)) +* **main:** exit if no package was parsed ([cdb579d](https://github.com/zkat/npx/commit/cdb579d)) +* **opts:** allow -- to prevent further parsing ([db7a0e4](https://github.com/zkat/npx/commit/db7a0e4)) + + +### Features + +* **updates:** added update-notifier ([8dc91d4](https://github.com/zkat/npx/commit/8dc91d4)) + + + + +## [1.0.2](https://github.com/zkat/npx/compare/v1.0.1...v1.0.2) (2017-05-30) + + +### Bug Fixes + +* **pkg:** bundle deps to guarantee global install precision ([3e21217](https://github.com/zkat/npx/commit/3e21217)) + + + + +## [1.0.1](https://github.com/zkat/npx/compare/v1.0.0...v1.0.1) (2017-05-30) + + +### Bug Fixes + +* **build:** add dummy test file to let things build ([6199eb6](https://github.com/zkat/npx/commit/6199eb6)) +* **docs:** fix arg documentation in readme/manpage ([d1cf44c](https://github.com/zkat/npx/commit/d1cf44c)) +* **opts:** add --version/-v ([2633a0e](https://github.com/zkat/npx/commit/2633a0e)) + + + + +# 1.0.0 (2017-05-30) + + +### Features + +* **npx:** initial working implementation ([a83a67d](https://github.com/zkat/npx/commit/a83a67d)) diff --git a/deps/npm/node_modules/libnpx/LICENSE.md b/deps/npm/node_modules/libnpx/LICENSE.md new file mode 100644 index 00000000000000..c05cb09586fccd --- /dev/null +++ b/deps/npm/node_modules/libnpx/LICENSE.md @@ -0,0 +1,3 @@ +To the extent possible under law, maintainers for this project have waived all copyright and related or neighboring rights to this project. + +For more information on this waiver, see: https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/deps/npm/node_modules/libnpx/README.md b/deps/npm/node_modules/libnpx/README.md new file mode 100644 index 00000000000000..436bdd02402466 --- /dev/null +++ b/deps/npm/node_modules/libnpx/README.md @@ -0,0 +1,159 @@ +[![npm](https://img.shields.io/npm/v/npx.svg)](https://npm.im/npx) [![license](https://img.shields.io/npm/l/npx.svg)](https://npm.im/npx) [![Travis](https://img.shields.io/travis/zkat/npx.svg)](https://travis-ci.org/zkat/npx) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/npx?svg=true)](https://ci.appveyor.com/project/zkat/npx) [![Coverage Status](https://coveralls.io/repos/github/zkat/npx/badge.svg?branch=latest)](https://coveralls.io/github/zkat/npx?branch=latest) + +# npx(1) -- execute npm package binaries + +## SYNOPSIS + +`npx [options] [@version] [command-arg]...` + +`npx [options] [-p|--package ]... [command-arg]...` + +`npx [options] -c ''` + +`npx --shell-auto-fallback [shell]` + +## INSTALL + +`npm install -g npx` + +## DESCRIPTION + +Executes `` either from a local `node_modules/.bin`, or from a central cache, installing any packages needed in order for `` to run. + +By default, `npx` will check whether `` exists in `$PATH`, or in the local project binaries, and execute that. If `` is not found, it will be installed prior to execution. + +Unless a `--package` option is specified, `npx` will try to guess the name of the binary to invoke depending on the specifier provided. All package specifiers understood by `npm` may be used with `npx`, including git specifiers, remote tarballs, local directories, or scoped packages. + +If a full specifier is included, or if `--package` is used, npx will always use a freshly-installed, temporary version of the package. This can also be forced with the `--ignore-existing` flag. + +* `-p, --package ` - define the package to be installed. This defaults to the value of ``. This is only needed for packages with multiple binaries if you want to call one of the other executables, or where the binary name does not match the package name. If this option is provided `` will be executed as-is, without interpreting `@version` if it's there. Multiple `--package` options may be provided, and all the packages specified will be installed. + +* `--no-install` - If passed to `npx`, it will only try to run `` if it already exists in the current path or in `$prefix/node_modules/.bin`. It won't try to install missing commands. + +* `--cache ` - set the location of the npm cache. Defaults to npm's own cache settings. + +* `--userconfig ` - path to the user configuration file to pass to npm. Defaults to whatever npm's current default is. + +* `-c ` - Execute `` inside an `npm run-script`-like shell environment, with all the usual environment variables available. Only the first item in `` will be automatically used as ``. Any others _must_ use `-p`. + +* `--shell ` - The shell to invoke the command with, if any. + +* `--shell-auto-fallback []` - Generates shell code to override your shell's "command not found" handler with one that calls `npx`. Tries to figure out your shell, or you can pass its name (either `bash`, `fish`, or `zsh`) as an option. See below for how to install. + +* `--ignore-existing` - If this flag is set, npx will not look in `$PATH`, or in the current package's `node_modules/.bin` for an existing version before deciding whether to install. Binaries in those paths will still be available for execution, but will be shadowed by any packages requested by this install. + +* `-q, --quiet` - Suppressed any output from npx itself (progress bars, error messages, install reports). Subcommand output itself will not be silenced. + +* `-n, --node-arg` - Extra node argument to supply to node when binary is a node script. You can supply this option multiple times to add more arguments. + +* `-v, --version` - Show the current npx version. + +## EXAMPLES + +### Running a project-local bin + +``` +$ npm i -D webpack +$ npx webpack ... +``` + +### One-off invocation without local installation + +``` +$ npm rm webpack +$ npx webpack -- ... +$ cat package.json +...webpack not in "devDependencies"... +``` + +### Invoking a command from a github repository + +``` +$ npx github:piuccio/cowsay +...or... +$ npx git+ssh://my.hosted.git:cowsay.git#semver:^1 +...etc... +``` + +### Execute a full shell command using one npx call w/ multiple packages + +``` +$ npx -p lolcatjs -p cowsay -c \ + 'echo "$npm_package_name@$npm_package_version" | cowsay | lolcatjs' +... + _____ +< your-cool-package@1.2.3 > + ----- + \ ^__^ + \ (oo)\_______ + (__)\ )\/\ + ||----w | + || || +``` + +### Run node binary with --inspect + +``` +$ npx --node-arg=--inspect cowsay +Debugger listening on ws://127.0.0.1:9229/.... +``` + +## SHELL AUTO FALLBACK + +You can configure `npx` to run as your default fallback command when you type something in the command line with an `@` but the command is not found. This includes installing packages that were not found in the local prefix either. + +For example: + +``` +$ npm@4 --version +(stderr) npm@4 not found. Trying with npx... +4.6.1 +$ asdfasdfasf +zsh: command not found: asfdasdfasdf +``` + +Currently, `zsh`, `bash` (>= 4), and `fish` are supported. You can access these completion scripts using `npx --shell-auto-fallback `. + +To install permanently, add the relevant line below to your `~/.bashrc`, `~/.zshrc`, `~/.config/fish/config.fish`, or as needed. To install just for the shell session, simply run the line. + +You can optionally pass through `--no-install` when generating the fallback to prevent it from installing packages if the command is missing. + +### For bash@>=4: + +``` +$ source <(npx --shell-auto-fallback bash) +``` + +### For zsh: + +``` +$ source <(npx --shell-auto-fallback zsh) +``` + +### For fish: + +``` +$ source (npx --shell-auto-fallback fish | psub) +``` + +## ACKNOWLEDGEMENTS + +Huge thanks to [Kwyn Meagher](https://blog.kwyn.io) for generously donating the package name in the main npm registry. Previously `npx` was used for a Tessel board Neopixels library, which can now be found under [`npx-tessel`](https://npm.im/npx-tessel). + +## AUTHOR + +Written by [Kat Marchan](https://github.com/zkat). + +## REPORTING BUGS + +Please file any relevant issues [on Github.](https://github.com/zkat/npx) + +## LICENSE + +This work is released by its authors into the public domain under CC0-1.0. See `LICENSE.md` for details. + +## SEE ALSO + +* `npm(1)` +* `npm-run-script(1)` +* `npm-config(7)` diff --git a/deps/npm/node_modules/libnpx/auto-fallback.js b/deps/npm/node_modules/libnpx/auto-fallback.js new file mode 100644 index 00000000000000..75fb60f4c2cbe8 --- /dev/null +++ b/deps/npm/node_modules/libnpx/auto-fallback.js @@ -0,0 +1,69 @@ +'use strict' + +const Y = require('./y.js') + +function mkPosix (opts) { + return ` +command_not_found_${opts.isBash ? 'handle' : 'handler'}() { + # Do not run within a pipe + if test ! -t 1; then + >&2 echo "${Y`command not found: ${'$1'}`}" + return 127 + fi + if which npx > /dev/null; then + echo "${Y`${'$1'} not found. Trying with npx...`}" >&2 + else + return 127 + fi + if ! [[ $1 =~ @ ]]; then + npx --no-install "$@" + else + npx "$@" + fi + return $? +}` +} + +function mkFish (opts) { + return ` +function __fish_command_not_found_on_interactive --on-event fish_prompt + functions --erase __fish_command_not_found_handler + functions --erase __fish_command_not_found_setup + + function __fish_command_not_found_handler --on-event fish_command_not_found + if which npx > /dev/null + echo "${Y`${'$argv[1]'} not found. Trying with npx...`}" >&2 + else + return 127 + end + if string match -q -r @ $argv[1] + npx $argv + else + npx --no-install $argv + end + end + + functions --erase __fish_command_not_found_on_interactive +end` +} + +module.exports = autoFallback +function autoFallback (shell, fromEnv, opts) { + if (shell.includes('bash')) { + return mkPosix({isBash: true, install: opts.install}) + } + + if (shell.includes('zsh')) { + return mkPosix({isBash: false, install: opts.install}) + } + + if (shell.includes('fish')) { + return mkFish(opts) + } + + if (fromEnv) { + return autoFallback(fromEnv, null, opts) + } + + console.error(Y`Only Bash, Zsh, and Fish shells are supported :(`) +} diff --git a/deps/npm/node_modules/libnpx/child.js b/deps/npm/node_modules/libnpx/child.js new file mode 100644 index 00000000000000..1b7c4c6215bfe6 --- /dev/null +++ b/deps/npm/node_modules/libnpx/child.js @@ -0,0 +1,86 @@ +'use strict' + +const cp = require('child_process') +const path = require('path') + +module.exports.runCommand = runCommand +function runCommand (command, opts) { + const cmd = opts.call || command || opts.command + const copts = (opts.call ? [] : opts.cmdOpts) || [] + return spawn(cmd, copts, { + shell: opts.shell || !!opts.call, + stdio: opts.stdio || 'inherit' + }).catch(err => { + if (err.code === 'ENOENT') { + err = new Error( + `npx: ${ + require('./y.js')`command not found: ${path.basename(cmd)}` + }` + ) + err.exitCode = 127 + } else { + err.message = require('./y.js')`Command failed: ${cmd} ${err.message}` + } + throw err + }) +} + +module.exports.spawn = spawn +function spawn (cmd, args, opts) { + opts = opts || {} + opts.shell = opts.shell || process.platform === 'win32' + return new Promise((resolve, reject) => { + const child = cp.spawn(cmd, args, opts) + let stdout = '' + let stderr = '' + child.stdout && child.stdout.on('data', d => { stdout += d }) + child.stderr && child.stderr.on('data', d => { stderr += d }) + child.on('error', reject) + child.on('close', code => { + if (code) { + const err = new Error( + require('./y.js')`Command failed: ${cmd} ${args.join(' ')}` + ) + err.isOperational = true + err.stderr = stderr + err.exitCode = code + reject(err) + } else { + resolve({code, stdout, stderr}) + } + }) + }) +} + +module.exports.exec = exec +function exec (cmd, args, opts) { + opts = opts || {} + return new Promise((resolve, reject) => { + cp.exec(`${escapeArg(cmd, true)} ${ + args.join(' ') + }`, opts, (err, stdout) => { + if (err) { + if (typeof err.code === 'number') { + err.exitCode = err.code + } + reject(err) + } else { + resolve(stdout) + } + }) + }) +} + +module.exports.escapeArg = escapeArg +function escapeArg (str, asPath) { + return process.platform === 'win32' && asPath + ? path.normalize(str) + .split(/\\/) + .map(s => s.match(/\s+/) ? `"${s}"` : s) + .join('\\') + : process.platform === 'win32' + ? `"${str}"` + : str.match(/[^-_.~/\w]/) + ? `'${str.replace(/'/g, "'\"'\"'")}'` + : str +} diff --git a/deps/npm/node_modules/libnpx/get-prefix.js b/deps/npm/node_modules/libnpx/get-prefix.js new file mode 100644 index 00000000000000..71bedffc580c88 --- /dev/null +++ b/deps/npm/node_modules/libnpx/get-prefix.js @@ -0,0 +1,54 @@ +'use strict' + +const promisify = require('./util.js').promisify + +const path = require('path') +const statAsync = promisify(require('fs').stat) + +module.exports = getPrefix +function getPrefix (current, root) { + if (!root) { + const original = root = path.resolve(current) + while (path.basename(root) === 'node_modules') { + root = path.dirname(root) + } + if (original !== root) { + return Promise.resolve(root) + } else { + return getPrefix(root, root) + } + } + if (isRootPath(current, process.platform)) { + return Promise.resolve(root) + } else { + return Promise.all([ + fileExists(path.join(current, 'package.json')), + fileExists(path.join(current, 'node_modules')) + ]).then(args => { + const hasPkg = args[0] + const hasModules = args[1] + if (hasPkg || hasModules) { + return current + } else { + const parent = path.dirname(current) + return getPrefix(parent, root) + } + }) + } +} + +module.exports._fileExists = fileExists +function fileExists (f) { + return statAsync(f).catch(err => { + if (err.code !== 'ENOENT') { + throw err + } + }) +} + +module.exports._isRootPath = isRootPath +function isRootPath (p, platform) { + return platform === 'win32' + ? p.match(/^[a-z]+:[/\\]?$/i) + : p === '/' +} diff --git a/deps/npm/node_modules/libnpx/index.js b/deps/npm/node_modules/libnpx/index.js new file mode 100644 index 00000000000000..d42172e500c744 --- /dev/null +++ b/deps/npm/node_modules/libnpx/index.js @@ -0,0 +1,341 @@ +'use strict' + +const Buffer = require('safe-buffer').Buffer +const promisify = require('./util.js').promisify + +const child = require('./child') +const fs = require('fs') +const parseArgs = require('./parse-args.js') +const path = require('path') +const which = promisify(require('which')) + +const PATH_SEP = process.platform === 'win32' ? ';' : ':' + +module.exports = npx +module.exports.parseArgs = parseArgs +function npx (argv) { + const shell = argv['shell-auto-fallback'] + if (shell || shell === '') { + const fallback = require('./auto-fallback.js')( + shell, process.env.SHELL, argv + ) + if (fallback) { + return console.log(fallback) + } else { + process.exitCode = 1 + return + } + } + + if (!argv.call && (!argv.command || !argv.package)) { + !argv.q && console.error(Y()`\nERROR: You must supply a command.\n`) + !argv.q && parseArgs.showHelp() + process.exitCode = 1 + return + } + + const startTime = Date.now() + + // First, we look to see if we're inside an npm project, and grab its + // bin path. This is exactly the same as running `$ npm bin`. + return localBinPath(process.cwd()).then(local => { + if (local) { + // Local project paths take priority. Go ahead and prepend it. + process.env.PATH = `${local}${PATH_SEP}${process.env.PATH}` + } + return Promise.all([ + // Figuring out if a command exists, early on, lets us maybe + // short-circuit a few things later. This bit here primarily benefits + // calls like `$ npx foo`, where we might just be trying to invoke + // a single command and use whatever is already in the path. + argv.command && getExistingPath(argv.command, argv), + // The `-c` flag involves special behavior when used: in this case, + // we take a bit of extra time to pick up npm's full lifecycle script + // environment (so you can use `$npm_package_xxxxx` and company). + // Without that flag, we just use the current env. + argv.call && local && getEnv(argv) + ]).then(args => { + const existing = args[0] + const newEnv = args[1] + if (newEnv) { + // NOTE - we don't need to manipulate PATH further here, because + // npm has already done so. And even added the node-gyp path! + Object.assign(process.env, newEnv) + } + if ((!existing && !argv.call) || argv.packageRequested) { + // We only fire off the updateNotifier if we're installing things + if (argv.npxPkg) { + try { + require('update-notifier')({ + pkg: require(argv.npxPkg) + }).notify() + } catch (e) {} + } + // Some npm packages need to be installed. Let's install them! + return ensurePackages(argv.package, argv).then(results => { + if (results && results.added && results.updated && !argv.q) { + console.error(Y()`npx: installed ${ + results.added.length + results.updated.length + } in ${(Date.now() - startTime) / 1000}s`) + } + if ( + argv.command && + !existing && + !argv.packageRequested && + argv.package.length === 1 + ) { + return promisify(fs.readdir)(results.bin).then(bins => { + const cmd = new RegExp(`^${argv.command}(?:\\.cmd)?$`, 'i') + const matching = bins.find(b => b.match(cmd)) + return path.resolve(results.bin, bins[matching] || bins[0]) + }, err => { + if (err.code === 'ENOENT') { + throw new Error(Y()`command not found: ${argv.command}`) + } else { + throw err + } + }) + } else { + return existing + } + }) + } else { + // We can skip any extra installation, 'cause everything exists. + return existing + } + }).then(existing => { + return execCommand(existing, argv) + }).catch(err => { + !argv.q && console.error(err.message) + process.exitCode = err.exitCode || 1 + }) + }) +} + +module.exports._localBinPath = localBinPath +function localBinPath (cwd) { + return require('./get-prefix.js')(cwd).then(prefix => { + const pkgjson = path.join(prefix, 'package.json') + return promisify(fs.stat)(pkgjson).then( + () => path.join(prefix, 'node_modules', '.bin'), + err => { if (err.code !== 'ENOENT') throw err } + ) + }) +} + +module.exports._getEnv = getEnv +function getEnv (opts) { + const args = ['run', 'env', '--parseable'] + return findNodeScript(opts.npm, {isLocal: true}).then(npmPath => { + if (npmPath) { + args.unshift(opts.npm) + return process.argv[0] + } else { + return opts.npm + } + }).then(npmPath => { + return child.exec(npmPath, args) + }).then(require('dotenv').parse) +} + +module.exports._ensurePackages = ensurePackages +function ensurePackages (specs, opts) { + return ( + opts.cache ? Promise.resolve(opts.cache) : getNpmCache(opts) + ).then(cache => { + const prefix = path.join(cache, '_npx', process.pid.toString()) + const bins = process.platform === 'win32' + ? prefix + : path.join(prefix, 'bin') + const rimraf = require('rimraf') + process.on('exit', () => rimraf.sync(prefix)) + return promisify(rimraf)(bins).then(() => { + return installPackages(specs, prefix, opts) + }).then(info => { + // This will make temp bins _higher priority_ than even local bins. + // This is intentional, since npx assumes that if you went through + // the trouble of doing `-p`, you're rather have that one. Right? ;) + process.env.PATH = `${bins}${PATH_SEP}${process.env.PATH}` + if (!info) { info = {} } + info.prefix = prefix + info.bin = bins + return info + }) + }) +} + +module.exports._getExistingPath = getExistingPath +function getExistingPath (command, opts) { + if (opts.isLocal) { + return Promise.resolve(command) + } else if ( + opts.cmdHadVersion || opts.packageRequested || opts.ignoreExisting + ) { + return Promise.resolve(false) + } else { + return which(command).catch(err => { + if (err.code === 'ENOENT') { + if (opts.install === false) { + err.exitCode = 127 + throw err + } + } else { + throw err + } + }) + } +} + +module.exports._getNpmCache = getNpmCache +function getNpmCache (opts) { + const args = ['config', 'get', 'cache', '--parseable'] + if (opts.userconfig) { + args.push('--userconfig', child.escapeArg(opts.userconfig, true)) + } + return findNodeScript(opts.npm, {isLocal: true}).then(npmPath => { + if (npmPath) { + args.unshift(opts.npm) + return process.argv[0] + } else { + return opts.npm + } + }).then(npmPath => { + return child.exec(npmPath, args) + }).then(cache => cache.trim()) +} + +module.exports._buildArgs = buildArgs +function buildArgs (specs, prefix, opts) { + const args = ['install'].concat(specs) + args.push('--global', '--prefix', prefix) + if (opts.cache) args.push('--cache', opts.cache) + if (opts.userconfig) args.push('--userconfig', opts.userconfig) + args.push('--loglevel', 'error', '--json') + + return args +} + +module.exports._installPackages = installPackages +function installPackages (specs, prefix, opts) { + const args = buildArgs(specs, prefix, opts) + return findNodeScript(opts.npm, {isLocal: true}).then(npmPath => { + if (npmPath) { + args.unshift(opts.npm) + return process.argv[0] + } else { + return opts.npm + } + }).then(npmPath => { + return child.escapeArg(npmPath, true) + }).then(npmPath => { + return child.spawn(npmPath, args, { + stdio: [0, 'pipe', opts.q ? 'ignore' : 2] + }).then(deets => { + try { + return deets.stdout ? JSON.parse(deets.stdout) : null + } catch (e) { } + }, err => { + if (err.exitCode) { + err.message = Y()`Install for ${specs} failed with code ${err.exitCode}` + } + throw err + }) + }) +} + +module.exports._execCommand = execCommand +function execCommand (_existing, argv) { + return findNodeScript(_existing, argv).then(existing => { + if (existing && !argv.nodeArg && !argv.shell && existing !== process.argv[1]) { + const Module = require('module') + // let it take over the process. This means we can skip node startup! + if (!argv.noYargs) { + // blow away built-up yargs crud + require('yargs').reset() + } + process.argv = [ + process.argv[0], // Current node binary + existing // node script path. `runMain()` will set this as the new main + ].concat(argv.cmdOpts) // options for the cmd itself + Module.runMain() // ✨MAGIC✨. Sorry-not-sorry + } else if (!existing && argv.nodeArg && argv.nodeArg.length) { + throw new Error(Y()`ERROR: --node-arg/-n can only be used on packages with node scripts.`) + } else { + let cmd = existing + let opts = argv + if (existing && argv.nodeArg && argv.nodeArg.length) { + // If we know we're running a run script and we got a --node-arg, + // we need to fudge things a bit to get them working right. + let nargs = argv.nodeArg + if (typeof nargs === 'string') { + nargs = [nargs] + } + // It's valid for a single arg to be a string of multiple + // space-separated node args. + // Example: `$ npx -n '--inspect --harmony --debug' ...` + nargs = nargs.reduce((acc, arg) => { + return acc.concat(arg.split(/\s+/)) + }, []) + cmd = process.argv[0] + opts = Object.assign({}, argv, { + cmdOpts: nargs.concat([existing], argv.cmdOpts || []) + }) + } + return child.runCommand(cmd, opts).catch(err => { + if (err.isOperational && err.exitCode) { + // At this point, we want to treat errors from the child as if + // we were just running the command. That means no extra msg logging + process.exitCode = err.exitCode + } else { + // But if it's not just a regular child-level error, blow up normally + throw err + } + }) + } + }) +} + +module.exports._findNodeScript = findNodeScript +function findNodeScript (existing, opts) { + if (!existing) { + return Promise.resolve(false) + } else { + return promisify(fs.stat)(existing).then(stat => { + if (opts && opts.isLocal && path.extname(existing) === '.js') { + return existing + } else if (opts && opts.isLocal && stat.isDirectory()) { + // npx will execute the directory itself + try { + const pkg = require(path.resolve(existing, 'package.json')) + const target = path.resolve(existing, pkg.bin || pkg.main || 'index.js') + return findNodeScript(target, opts).then(script => { + if (script) { + return script + } else { + throw new Error(Y()`command not found: ${target}`) + } + }) + } catch (e) { + throw new Error(Y()`command not found: ${existing}`) + } + } else if (process.platform !== 'win32') { + const line = '#!/usr/bin/env node\n' + const bytecount = line.length + const buf = Buffer.alloc(bytecount) + return promisify(fs.open)(existing, 'r').then(fd => { + return promisify(fs.read)(fd, buf, 0, bytecount, 0).then(() => { + return promisify(fs.close)(fd) + }, err => { + return promisify(fs.close)(fd).then(() => { throw err }) + }) + }).then(() => { + return buf.toString('utf8') === line && existing + }) + } + }) + } +} + +function Y () { + return require('./y.js') +} diff --git a/deps/npm/node_modules/libnpx/libnpx.1 b/deps/npm/node_modules/libnpx/libnpx.1 new file mode 100644 index 00000000000000..7d9b273ef7631f --- /dev/null +++ b/deps/npm/node_modules/libnpx/libnpx.1 @@ -0,0 +1,167 @@ +.TH "NPX" "1" "July 2017" "libnpx@9.2.0" "User Commands" +.SH "NAME" +\fBnpx\fR \- execute npm package binaries +.SH SYNOPSIS +.P +\fBnpx [options] [@version] [command\-arg]\.\.\.\fP +.P +\fBnpx [options] [\-p|\-\-package ]\.\.\. [command\-arg]\.\.\.\fP +.P +\fBnpx [options] \-c ''\fP +.P +\fBnpx \-\-shell\-auto\-fallback [shell]\fP +.SH INSTALL +.P +\fBnpm install \-g npx\fP +.SH DESCRIPTION +.P +Executes \fB\fP either from a local \fBnode_modules/\.bin\fP, or from a central cache, installing any packages needed in order for \fB\fP to run\. +.P +By default, \fBnpx\fP will check whether \fB\fP exists in \fB$PATH\fP, or in the local project binaries, and execute that\. If \fB\fP is not found, it will be installed prior to execution\. +.P +Unless a \fB\-\-package\fP option is specified, \fBnpx\fP will try to guess the name of the binary to invoke depending on the specifier provided\. All package specifiers understood by \fBnpm\fP may be used with \fBnpx\fP, including git specifiers, remote tarballs, local directories, or scoped packages\. +.P +If a full specifier is included, or if \fB\-\-package\fP is used, npx will always use a freshly\-installed, temporary version of the package\. This can also be forced with the \fB\-\-ignore\-existing\fP flag\. +.RS 0 +.IP \(bu 2 +\fB\-p, \-\-package \fP \- define the package to be installed\. This defaults to the value of \fB\fP\|\. This is only needed for packages with multiple binaries if you want to call one of the other executables, or where the binary name does not match the package name\. If this option is provided \fB\fP will be executed as\-is, without interpreting \fB@version\fP if it's there\. Multiple \fB\-\-package\fP options may be provided, and all the packages specified will be installed\. +.IP \(bu 2 +\fB\-\-no\-install\fP \- If passed to \fBnpx\fP, it will only try to run \fB\fP if it already exists in the current path or in \fB$prefix/node_modules/\.bin\fP\|\. It won't try to install missing commands\. +.IP \(bu 2 +\fB\-\-cache \fP \- set the location of the npm cache\. Defaults to npm's own cache settings\. +.IP \(bu 2 +\fB\-\-userconfig \fP \- path to the user configuration file to pass to npm\. Defaults to whatever npm's current default is\. +.IP \(bu 2 +\fB\-c \fP \- Execute \fB\fP inside an \fBnpm run\-script\fP\-like shell environment, with all the usual environment variables available\. Only the first item in \fB\fP will be automatically used as \fB\fP\|\. Any others \fImust\fR use \fB\-p\fP\|\. +.IP \(bu 2 +\fB\-\-shell \fP \- The shell to invoke the command with, if any\. +.IP \(bu 2 +\fB\-\-shell\-auto\-fallback []\fP \- Generates shell code to override your shell's "command not found" handler with one that calls \fBnpx\fP\|\. Tries to figure out your shell, or you can pass its name (either \fBbash\fP, \fBfish\fP, or \fBzsh\fP) as an option\. See below for how to install\. +.IP \(bu 2 +\fB\-\-ignore\-existing\fP \- If this flag is set, npx will not look in \fB$PATH\fP, or in the current package's \fBnode_modules/\.bin\fP for an existing version before deciding whether to install\. Binaries in those paths will still be available for execution, but will be shadowed by any packages requested by this install\. +.IP \(bu 2 +\fB\-q, \-\-quiet\fP \- Suppressed any output from npx itself (progress bars, error messages, install reports)\. Subcommand output itself will not be silenced\. +.IP \(bu 2 +\fB\-n, \-\-node\-arg\fP \- Extra node argument to supply to node when binary is a node script\. You can supply this option multiple times to add more arguments\. +.IP \(bu 2 +\fB\-v, \-\-version\fP \- Show the current npx version\. + +.RE +.SH EXAMPLES +.SS Running a project\-local bin +.P +.RS 2 +.nf +$ npm i \-D webpack +$ npx webpack \.\.\. +.fi +.RE +.SS One\-off invocation without local installation +.P +.RS 2 +.nf +$ npm rm webpack +$ npx webpack \-\- \.\.\. +$ cat package\.json +\|\.\.\.webpack not in "devDependencies"\.\.\. +.fi +.RE +.SS Invoking a command from a github repository +.P +.RS 2 +.nf +$ npx github:piuccio/cowsay +\|\.\.\.or\.\.\. +$ npx git+ssh://my\.hosted\.git:cowsay\.git#semver:^1 +\|\.\.\.etc\.\.\. +.fi +.RE +.SS Execute a full shell command using one npx call w/ multiple packages +.P +.RS 2 +.nf +$ npx \-p lolcatjs \-p cowsay \-c \\ + 'echo "$npm_package_name@$npm_package_version" | cowsay | lolcatjs' +\|\.\.\. + _____ +< your\-cool\-package@1\.2\.3 > + \-\-\-\-\- + \\ ^__^ + \\ (oo)\\_______ + (__)\\ )\\/\\ + ||\-\-\-\-w | + || || +.fi +.RE +.SS Run node binary with \-\-inspect +.P +.RS 2 +.nf +$ npx \-\-node\-arg=\-\-inspect cowsay +Debugger listening on ws://127\.0\.0\.1:9229/\.\.\.\. +.fi +.RE +.SH SHELL AUTO FALLBACK +.P +You can configure \fBnpx\fP to run as your default fallback command when you type something in the command line with an \fB@\fP but the command is not found\. This includes installing packages that were not found in the local prefix either\. +.P +For example: +.P +.RS 2 +.nf +$ npm@4 \-\-version +(stderr) npm@4 not found\. Trying with npx\.\.\. +4\.6\.1 +$ asdfasdfasf +zsh: command not found: asfdasdfasdf +.fi +.RE +.P +Currently, \fBzsh\fP, \fBbash\fP (>= 4), and \fBfish\fP are supported\. You can access these completion scripts using \fBnpx \-\-shell\-auto\-fallback \fP\|\. +.P +To install permanently, add the relevant line below to your \fB~/\.bashrc\fP, \fB~/\.zshrc\fP, \fB~/\.config/fish/config\.fish\fP, or as needed\. To install just for the shell session, simply run the line\. +.P +You can optionally pass through \fB\-\-no\-install\fP when generating the fallback to prevent it from installing packages if the command is missing\. +.SS For bash@>=4: +.P +.RS 2 +.nf +$ source <(npx \-\-shell\-auto\-fallback bash) +.fi +.RE +.SS For zsh: +.P +.RS 2 +.nf +$ source <(npx \-\-shell\-auto\-fallback zsh) +.fi +.RE +.SS For fish: +.P +.RS 2 +.nf +$ source (npx \-\-shell\-auto\-fallback fish | psub) +.fi +.RE +.SH ACKNOWLEDGEMENTS +.P +Huge thanks to Kwyn Meagher \fIhttps://blog\.kwyn\.io\fR for generously donating the package name in the main npm registry\. Previously \fBnpx\fP was used for a Tessel board Neopixels library, which can now be found under \fBnpx\-tessel\fP \fIhttps://npm\.im/npx\-tessel\fR\|\. +.SH AUTHOR +.P +Written by Kat Marchan \fIhttps://github\.com/zkat\fR\|\. +.SH REPORTING BUGS +.P +Please file any relevant issues on Github\. \fIhttps://github\.com/zkat/npx\fR +.SH LICENSE +.P +This work is released by its authors into the public domain under CC0\-1\.0\. See \fBLICENSE\.md\fP for details\. +.SH SEE ALSO +.RS 0 +.IP \(bu 2 +\fBnpm(1)\fP +.IP \(bu 2 +\fBnpm\-run\-script(1)\fP +.IP \(bu 2 +\fBnpm\-config(7)\fP + +.RE diff --git a/deps/npm/node_modules/libnpx/locales/ca.json b/deps/npm/node_modules/libnpx/locales/ca.json new file mode 100644 index 00000000000000..d9faf1c08b0133 --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/ca.json @@ -0,0 +1,28 @@ +{ + "Execute binaries from npm packages.\n%s": "Executa comandes de paquets de npm.\n%s", + "Package to be installed.": "Paquet per a instal·lar.", + "Location of the npm cache.": "Ruta de la memòria cau de npm.", + "Skip installation if a package is missing.": "Salta el pas d'instal·lació si el paquet no està present.", + "Path to user npmrc.": "Ruta al npmrc de l'usuari.", + "Execute string as if inside `npm run-script`.": "Executa l'argument com si estigués dins de `npm run-script`.", + "Shell to execute the command with, if any.": "Shell amb el qual s'executarà la comanda, si hi ha algun.", + "Generate shell code to use npx as the \"command not found\" fallback.": "Genera codi de shell per utilizar npx com el replegament quan la comanda no existeix.", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "Ignora comandaments en $PATH, o en el projecte local. Això obliga a npx a fer una instal·lació temporal i usar la versió més recent de la comanda.", + "npm binary to use for internal operations.": "Comando d'npm que es farà servir per a operacions internes de npx.", + "For the full documentation, see the manual page for npx(1).": "Per documentació completa, vegeu la pàgina del manual npx(1).", + "Unable to guess a binary name from %s. Please use --package.": "No s'ha pogut endevinar el nom de la comanda usant %s. Si us plau utilitza --package.", + "\nERROR: You must supply a command.\n": "\nERROR: Has proveir una comanda.\n", + "Command failed: %s %s": "La comanda va fracasar: %s %s", + "Install for %s failed with code %s": "instal·lació de %s fracassar amb codi %s", + "%s not found. Trying with npx...": "%s no existeix. Provant-ho amb npx...", + "command not found: %s": "comanda no existeix: %s", + "options": "opcions", + "command": "comanda", + "version": "versió", + "command-arg": "argument-de-comanda", + "command-string": "text-de-comanda", + "shell": "shell", + "package": "paquet", + "npx: installed %s in %ss": "npx: instal·lat %s en %ss", + "Suppress output from npx itself. Subcommands will not be affected.": "Suprimir la sortida d' npx. Les sub-comandes no es veuran afectades." +} diff --git a/deps/npm/node_modules/libnpx/locales/cs.json b/deps/npm/node_modules/libnpx/locales/cs.json new file mode 100644 index 00000000000000..c3ecc402cf916b --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/cs.json @@ -0,0 +1,28 @@ +{ + "Execute binaries from npm packages.\n%s": "Spouštění skriptů z npm balíčků.\n%s", + "Package to be installed.": "Balíček k instalaci.", + "Location of the npm cache.": "Umístění npm keše.", + "Skip installation if a package is missing.": "Neinstalovat chybějící balíčky.", + "Path to user npmrc.": "Cesta k uživatelskému npmrc souboru.", + "Execute string as if inside `npm run-script`.": "Příkaz, který se spustí jakoby uvnitř `npm run-script`.", + "Shell to execute the command with, if any.": "Shell ke spuštění příkazu, pokud je třeba.", + "Generate shell code to use npx as the \"command not found\" fallback.": "Vygenerovat shell kód použitelný jako \"command not found\" fallback.", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "Ignorovat existující skripty v $PATH i v lokálním projektu, npx tak udělá dočasnou instalaci a použije poslední verzi balíčku.", + "npm binary to use for internal operations.": "npm použité pro interní operace.", + "For the full documentation, see the manual page for npx(1).": "Úplná dokumentace je dostupná v manuálu pro npx(1).", + "Unable to guess a binary name from %s. Please use --package.": "Nelze uhodnout jméno skriptu z %s, použijte prosím --package.", + "\nERROR: You must supply a command.\n": "\nCHYBA: Musíte zadat nějaký příkaz.\n", + "Command failed: %s %s": "Příkaz selhal: %s %s", + "Install for %s failed with code %s": "Instalace %s selhala s kódem %s", + "%s not found. Trying with npx...": "%s nenalezen. Zkouším npx...", + "command not found: %s": "příkaz nenalezen: %s", + "options": "parametry", + "command": "příkaz", + "version": "verze", + "command-arg": "argument", + "command-string": "příkaz v řetězci", + "shell": "shell", + "package": "balíček", + "npx: installed %s in %ss": "npx: nainstalováno %s za %ss", + "Suppress output from npx itself. Subcommands will not be affected.": "Potlačit výstup z npx. Spuštěné příkazy nebudou ovlivněné." +} diff --git a/deps/npm/node_modules/libnpx/locales/de.json b/deps/npm/node_modules/libnpx/locales/de.json new file mode 100644 index 00000000000000..f732607063c481 --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/de.json @@ -0,0 +1,29 @@ +{ + "Execute binaries from npm packages.\n%s": "Führt Programme aus, die von npm Paketen bereitgestellt werden.\n%s", + "Package to be installed.": "Das zu installierende Paket.", + "Location of the npm cache.": "Ort des npm Zwischenspeichers.", + "Skip installation if a package is missing.": "Überspringe die Installation, falls ein Paket fehlt.", + "Path to user npmrc.": "Pfad zu npmrc im Benutzerverzeichnis.", + "Execute string as if inside `npm run-script`.": "Führe Zeichenkette aus, als wäre sie innerhalb von `npm run-script`.", + "Shell to execute the command with, if any.": "Shell, mit der Programme ausgeführt werden soll, wenn überhaupt.", + "Generate shell code to use npx as the \"command not found\" fallback.": "Erzeuge Shellcode, um npx als Alternative zu \"Programm konnte nicht gefunden werden\" zu benutzen.", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "Ignoriere bestehende Programme innerhalb von $PATH oder im lokalen Projekt. Dies zwingt npx dazu, die neuste Version herunterzuladen und zu benutzen.", + "npm binary to use for internal operations.": "npm-Programm für die interne Benutzung.", + "For the full documentation, see the manual page for npx(1).": "In der Manpage npx(1) ist die gesamte Dokumentation einzusehen.", + "Unable to guess a binary name from %s. Please use --package.": "Der Programmname von %s kann nicht automatisch ermittelt werden. Bitte benutze --package.", + "\nERROR: You must supply a command.\n": "\nFEHLER: Du musst einen Befehl angeben.\n", + "Command failed: %s %s": "Befehl fehlgeschlagen: %s %s", + "Install for %s failed with code %s": "Die Installation von %s ist mit dem Code %s fehlgeschlagen", + "%s not found. Trying with npx...": "%s konnte nicht gefunden werden. Versuche mit npx...", + "command not found: %s": "Programm konnte nicht gefunden werden: %s", + "options": "Optionen", + "command": "Befehl", + "version": "Version", + "command-arg": "Befehlsargument", + "command-string": "Befehlszeichenkette", + "shell": "Shell", + "package": "Paket", + "npx: installed %s in %ss": "npx: Installierte %s in %ss", + "Suppress output from npx itself. Subcommands will not be affected.": "Unterdrücke Output von npx. Unterbefehle sind nicht davon betroffen.", + "Extra node argument when calling a node binary.": "Extra node Argument, wenn eine node ausführbare Binärdatei gerufen ist." +} diff --git a/deps/npm/node_modules/libnpx/locales/en.json b/deps/npm/node_modules/libnpx/locales/en.json new file mode 100644 index 00000000000000..358e343421c75a --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/en.json @@ -0,0 +1,29 @@ +{ + "Execute binaries from npm packages.\n%s": "Execute binaries from npm packages.\n%s", + "Package to be installed.": "Package to be installed.", + "Location of the npm cache.": "Location of the npm cache.", + "Skip installation if a package is missing.": "Skip installation if a package is missing.", + "Path to user npmrc.": "Path to user npmrc.", + "Execute string as if inside `npm run-script`.": "Execute string as if inside `npm run-script`.", + "Shell to execute the command with, if any.": "Shell to execute the command with, if any.", + "Generate shell code to use npx as the \"command not found\" fallback.": "Generate shell code to use npx as the \"command not found\" fallback.", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.", + "npm binary to use for internal operations.": "npm binary to use for internal operations.", + "For the full documentation, see the manual page for npx(1).": "For the full documentation, see the manual page for npx(1).", + "Unable to guess a binary name from %s. Please use --package.": "Unable to guess a binary name from %s. Please use --package.", + "\nERROR: You must supply a command.\n": "\nERROR: You must supply a command.\n", + "Command failed: %s %s": "Command failed: %s %s", + "Install for %s failed with code %s": "Install for %s failed with code %s", + "%s not found. Trying with npx...": "%s not found. Trying with npx...", + "command not found: %s": "command not found: %s", + "options": "options", + "command": "command", + "version": "version", + "command-arg": "command-arg", + "command-string": "command-string", + "shell": "shell", + "package": "package", + "npx: installed %s in %ss": "npx: installed %s in %ss", + "Suppress output from npx itself. Subcommands will not be affected.": "Suppress output from npx itself. Subcommands will not be affected.", + "Extra node argument when calling a node binary.": "Extra node argument when calling a node binary." +} \ No newline at end of file diff --git a/deps/npm/node_modules/libnpx/locales/es.json b/deps/npm/node_modules/libnpx/locales/es.json new file mode 100644 index 00000000000000..c89bceeb20b790 --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/es.json @@ -0,0 +1,28 @@ +{ + "Execute binaries from npm packages.\n%s": "Ejecuta comandos de paquetes de npm.\n%s", + "Package to be installed.": "Paquete para instalar.", + "Location of the npm cache.": "Ruta del cache de npm.", + "Skip installation if a package is missing.": "Salta el paso de instalación si el paquete no está presente.", + "Path to user npmrc.": "Ruta al npmrc del usuario.", + "Execute string as if inside `npm run-script`.": "Ejecuta el argumento como si estuviera dentro de `npm run-script`.", + "Shell to execute the command with, if any.": "Shell con el que se ejecutará el comando, si alguno.", + "Generate shell code to use npx as the \"command not found\" fallback.": "Genera código de shell para usar npx como el repliegue cuando el comando no existe.", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "Ignora comandos en $PATH, o en el proyecto local. Esto obliga a npx a hacer una instalación temporanea y usar la version más reciente del comando.", + "npm binary to use for internal operations.": "Comando de npm que se usará para operaciones internas de npx.", + "For the full documentation, see the manual page for npx(1).": "Para documentación completa, véase la pagina del manual npx(1).", + "Unable to guess a binary name from %s. Please use --package.": "No se pudo adivinar el nombre del comando usando %s. Por favor usa --package.", + "\nERROR: You must supply a command.\n": "\nERROR: Debes proveer un comando.\n", + "Command failed: %s %s": "Comando fracasó: %s %s", + "Install for %s failed with code %s": "La instalación de %s fracasó con código %s", + "%s not found. Trying with npx...": "%s no existe. Tratando con npx...", + "command not found: %s": "comando no existe: %s", + "options": "opciones", + "command": "comando", + "version": "versión", + "command-arg": "argumento-de-comando", + "command-string": "texto-de-comando", + "shell": "shell", + "package": "paquete", + "npx: installed %s in %ss": "npx: instaló %s en %ss", + "Suppress output from npx itself. Subcommands will not be affected.": "Suprimir producción de npx. Sub-comandos no serán afectados." +} diff --git a/deps/npm/node_modules/libnpx/locales/fr.json b/deps/npm/node_modules/libnpx/locales/fr.json new file mode 100644 index 00000000000000..a6ddf60e6f5401 --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/fr.json @@ -0,0 +1,28 @@ +{ + "Execute binaries from npm packages.\n%s": "Exécutez des binaires à partir de paquets de npm.\n%s", + "Package to be installed.": "Paquet à installer.", + "Location of the npm cache.": "Endroit où est situé le cache de npm.", + "Skip installation if a package is missing.": "Sauter l'installation si un paquet est manquant.", + "Path to user npmrc.": "Chemin du npmrc de l'utilisateur(-trice).", + "Execute string as if inside `npm run-script`.": "Exécuter la chaine de caractère comme avec `npm run-script`.", + "Shell to execute the command with, if any.": "Shell a utiliser pour exécuter la commande, s'il y en a un.", + "Generate shell code to use npx as the \"command not found\" fallback.": "Générer le code du shell pour utiliser npx comme solution de rechange à \"command not found\"", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "Ignorer les binaires dans le $PATH ou dans le projet local. Cela force npm à faire une installation temporaire et utiliser la dernière version.", + "npm binary to use for internal operations.": "Binaire de npm à utiliser pour les opérations internes.", + "For the full documentation, see the manual page for npx(1).": "Pour la documentation complète, regarder la page du manuel pour npx(1).", + "Unable to guess a binary name from %s. Please use --package.": "Impossible de deviner le nom du binaire de %s, utilisez --package s'il vous plaît.", + "\nERROR: You must supply a command.\n": "\nERROR: Vous devez fournir une commande.\n", + "Command failed: %s %s": "La commande a échoué: %s %s", + "Install for %s failed with code %s": "L'installation de %s a échoué avec le code %s", + "%s not found. Trying with npx...": "%s n'a pas été trouvé. Essai avec npx...", + "command not found: %s": "Commande non trouvée: %s", + "options": "options", + "command": "commande", + "version": "version", + "command-arg": "arguments-de-la-commande", + "command-string": "chaine-de-caractères-de-la-commande", + "shell": "shell", + "package": "paquet", + "npx: installed %s in %ss": "npx: %s installé(s) en %ss", + "Suppress output from npx itself. Subcommands will not be affected.": "Supprimer les sorties générées par npx. Les sous-commandes ne seront pas affectées." +} diff --git a/deps/npm/node_modules/libnpx/locales/it.json b/deps/npm/node_modules/libnpx/locales/it.json new file mode 100644 index 00000000000000..24e72b49195816 --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/it.json @@ -0,0 +1,28 @@ +{ + "Execute binaries from npm packages.\n%s": "Esegui il binario del pacchetto npm.\n%s", + "Package to be installed.": "Pacchetto da installare.", + "Location of the npm cache.": "Percorso della cache npm.", + "Skip installation if a package is missing.": "Salta l'installazione se un pacchetto non è disponibile.", + "Path to user npmrc.": "Percorso utente per npmrc.", + "Execute string as if inside `npm run-script`.": "Esegui l'argomento come se fosse all'interno di `npm run-script`.", + "Shell to execute the command with, if any.": "Shell con cui eseguire il comando, se presente.", + "Generate shell code to use npx as the \"command not found\" fallback.": "Generare un codice di shell per usare npx come ripiego quando il comando non esiste.", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "Ignora i binari esistenti in $PATH, oppure nel progetto locale. Questo forza temporaneamente npx a installare e usare l'ultima versione.", + "npm binary to use for internal operations.": "Binario npm da usare per le operazioni interne.", + "For the full documentation, see the manual page for npx(1).": "Per la documentazione completa, vedere la pagina del manuale npx(1).", + "Unable to guess a binary name from %s. Please use --package.": "Impossibile supporre il nome del binario da %s. Prego usare --package.", + "\nERROR: You must supply a command.\n": "\nERRORE: E necessario fornire un comando.\n", + "Command failed: %s %s": "Comando fallito: %s %s", + "Install for %s failed with code %s": "Installazione di %s fallita con codice %s", + "%s not found. Trying with npx...": "%s non trovato. Prova con npx...", + "command not found: %s": "comando non trovato: %s", + "options": "opzioni", + "command": "comando", + "version": "versione", + "command-arg": "argomento-del-comando", + "command-string": "stringa-di-comando", + "shell": "shell", + "package": "pacchetto", + "npx: installed %s in %ss": "npx: installato %s in %ss", + "Suppress output from npx itself. Subcommands will not be affected.": "Sopprimere l'output da npx stesso. I sottocomandi non saranno interessati." +} diff --git a/deps/npm/node_modules/libnpx/locales/ja.json b/deps/npm/node_modules/libnpx/locales/ja.json new file mode 100644 index 00000000000000..e575edabedfc1d --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/ja.json @@ -0,0 +1,28 @@ +{ + "Execute binaries from npm packages.\n%s": "npmパッケージのバイナリを実行します。", + "Package to be installed.": "インストールするパッケージ。", + "Location of the npm cache.": "npmのキャッシュへのパス。", + "Skip installation if a package is missing.": "パッケージがない場合は、インストールをスキップします。", + "Path to user npmrc.": "ユーザーのnpmrcへのパス。", + "Execute string as if inside `npm run-script`.": "「npm run-script」の内部にあるかのように文字列を実行します。", + "Shell to execute the command with, if any.": "コマンドを実行するシェル(存在する場合)。", + "Generate shell code to use npx as the \"command not found\" fallback.": "\"コマンドが見つかりません\" フォールバックとして使用するコードを生成します。", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "$PATH、または既存のローカルプロジェクトのバイナリを無視します。 これにより、npxは一時的にインストールを行い、最新バージョンを使用します。", + "npm binary to use for internal operations.": "npmのバイナリを内部操作に使用します。", + "For the full documentation, see the manual page for npx(1).": "詳しくは、npx(1)のマニュアルページを参照してください。", + "Unable to guess a binary name from %s. Please use --package.": "%sからバイナリ名を推測できません。 --packageを使用してください。", + "\nERROR: You must supply a command.\n": "\nエラー: コマンドを入力する必要があります。\n", + "Command failed: %s %s": "コマンドが失敗しました: %s %s", + "Install for %s failed with code %s": "コード%sで%sのインストールに失敗しました", + "%s not found. Trying with npx...": "%sが見つかりません。 npxで試してみて...", + "command not found: %s": "コマンドが見つかりません: %s", + "options": "オプション", + "command": "コマンド", + "version": "バージョン", + "command-arg": "コマンドの引数", + "command-string": "コマンドの文字列", + "shell": "シェル", + "package": "パッケージ", + "npx: installed %s in %ss": "npx: %s個のパッケージを%s秒でインストールしました。", + "Suppress output from npx itself. Subcommands will not be affected.": "npx自体の標準出力を抑止します。 サブコマンドは影響を受けません。" +} diff --git a/deps/npm/node_modules/libnpx/locales/pt_BR.json b/deps/npm/node_modules/libnpx/locales/pt_BR.json new file mode 100644 index 00000000000000..d61f8f58f88321 --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/pt_BR.json @@ -0,0 +1,28 @@ +{ + "Execute binaries from npm packages.\n%s": "Execute binários de pacotes npm.\n%s", + "Package to be installed.": "Pacote a ser instalado.", + "Location of the npm cache.": "Localização da cache do npm.", + "Skip installation if a package is missing.": "Pule a instalação se estiver faltando um pacote.", + "Path to user npmrc.": "Caminho para o npmrc do usuário.", + "Execute string as if inside `npm run-script`.": "Execute a string como se estivesse dentro de `npm run-script`.", + "Shell to execute the command with, if any.": "Terminal para executar o comando, se houver.", + "Generate shell code to use npx as the \"command not found\" fallback.": "Gere código de terminal para usar o npx quando o comando não existir (\"command not found\").", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "Ignora binários existentes no $PATH ou no projeto atual. Isso obriga o npx a fazer uma instalação temporária e usar a última versão.", + "npm binary to use for internal operations.": "Binário npm usado para operações internas.", + "For the full documentation, see the manual page for npx(1).": "Para a documentação completa, veja a página do manual do npx(1).", + "Unable to guess a binary name from %s. Please use --package.": "Não foi possível encontrar um binário a partir de %s. Por favor, use --package.", + "\nERROR: You must supply a command.\n": "\nERRO: Você deve fornecer um comando.\n", + "Command failed: %s %s": "Comando falhou: %s %s", + "Install for %s failed with code %s": "Instalação de %s falhou com código %s", + "%s not found. Trying with npx...": "%s não encontrado. Tentando com npx...", + "command not found: %s": "comando não encontrado: %s", + "options": "opções", + "command": "comando", + "version": "versão", + "command-arg": "argumento-do-comando", + "command-string": "string-de-comando", + "shell": "terminal", + "package": "pacote", + "npx: installed %s in %ss": "npx: %s instalado em %ss", + "Suppress output from npx itself. Subcommands will not be affected.": "Suprimir resultados de npx. Sub-comandos não serão afetados." +} diff --git a/deps/npm/node_modules/libnpx/locales/ro.json b/deps/npm/node_modules/libnpx/locales/ro.json new file mode 100644 index 00000000000000..b6c15d6af4863c --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/ro.json @@ -0,0 +1,28 @@ +{ + "Execute binaries from npm packages.\n%s": "Rulează executabilele binare din pachetele npm.\n%s", + "Package to be installed.": "Pachetul care va fi instalat.", + "Location of the npm cache.": "Locația cache-ului npm.", + "Skip installation if a package is missing.": "Sari peste instalare dacă lipsește un pachet.", + "Path to user npmrc.": "Calea către fișierul npmrc al utilizatorului.", + "Execute string as if inside `npm run-script`.": "Execută string-ul ca și cum ar fi în `npm run-script`.", + "Shell to execute the command with, if any.": "Shell-ul cu care să fie executată comandă, dacă există.", + "Generate shell code to use npx as the \"command not found\" fallback.": "Generează cod shell pentru a folosi npx drept fallback pentru \"comanda nu a fost găsită\".", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "Ignoră executabilele binare existente din $PATH, sau din proiectul local. Aceasta forțează npx să facă o instalare temporară și să folosească ultima versiune.", + "npm binary to use for internal operations.": "Executabilul binar npm care să fie folosit pentru operaţiunile interne.", + "For the full documentation, see the manual page for npx(1).": "Pentru documentația completă, vedeți pagina de manual pentru npx(1).", + "Unable to guess a binary name from %s. Please use --package.": "Imposibil de ghicit numele executabilului binar pentru %s. Vă rugăm folosiți --package.", + "\nERROR: You must supply a command.\n": "\nEROARE: Trebuie să specifici o comandă.\n", + "Command failed: %s %s": "Comanda a eșuat: %s %s", + "Install for %s failed with code %s": "Procesul de instalare pentru %s a eșuat cu codul %s", + "%s not found. Trying with npx...": "%s nu a fost găsită. Încercare cu npx...", + "command not found: %s": "comanda nu a fost găsită: %s", + "options": "opțiuni", + "command": "comandă", + "version": "versiune", + "command-arg": "comandă-argument", + "command-string": "comandă-string", + "shell": "shell", + "package": "pachet", + "npx: installed %s in %ss": "npx: instalat %s în %ss", + "Suppress output from npx itself. Subcommands will not be affected.": "Suprimă outputul de la npx însăși. Subcomenzile nu vor fi afectate." +} diff --git a/deps/npm/node_modules/libnpx/locales/ru.json b/deps/npm/node_modules/libnpx/locales/ru.json new file mode 100644 index 00000000000000..3f431373c8b08d --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/ru.json @@ -0,0 +1,29 @@ +{ + "Execute binaries from npm packages.\n%s": "Выполняйте скрипты из npm пакетов.\n%s", + "Package to be installed.": "Пакет, который будет установлен.", + "Location of the npm cache.": "Расположение npm кеша.", + "Skip installation if a package is missing.": "Пропустить установку, если пакет отсутствует.", + "Path to user npmrc.": "Передать пользователя в nprc.", + "Execute string as if inside `npm run-script`.": "Выпонить скрипт как внутри `npm run-script`.", + "Shell to execute the command with, if any.": "Shell, чтобы выполнить команду, если необходимо.", + "Generate shell code to use npx as the \"command not found\" fallback.": "Создает код для shell, чтобы использовать npx при \"command not found\".", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "Игнорирует все существующие скрипты в $PATH или локальном проекте. Что заставляет npx использовать временную установку и использовать последние версии", + "npm binary to use for internal operations.": "npm файл для использования во внутренних операциях.", + "For the full documentation, see the manual page for npx(1).": "Полная документация доступна в мануале npx(1).", + "Unable to guess a binary name from %s. Please use --package.": "Невозможно угадать команду из %s. Пожалуйста, используйте --package.", + "\nERROR: You must supply a command.\n": "\nERROR: Нужно указать команду.\n", + "Command failed: %s %s": "Ошибка: %s %s", + "Install for %s failed with code %s": "Установка %s завершилась с кодом ошибки %s", + "%s not found. Trying with npx...": "%s не найдено. Пробуем с npx...", + "command not found: %s": "команда не найдена: %s", + "options": "опции", + "command": "команда", + "version": "версия", + "command-arg": "аргумент", + "command-string": "команда-строка", + "shell": "shell", + "package": "пакет", + "npx: installed %s in %ss": "npx: установлен %s в %ss", + "Suppress output from npx itself. Subcommands will not be affected.": "Отключить вывод npx. Поведение подкоманд не будет изменено." + +} diff --git a/deps/npm/node_modules/libnpx/locales/tr.json b/deps/npm/node_modules/libnpx/locales/tr.json new file mode 100644 index 00000000000000..58ca49dbbdf88f --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/tr.json @@ -0,0 +1,28 @@ +{ + "Execute binaries from npm packages.\n%s": "npm paketlerinden program çalıştırın.\n%s", + "Package to be installed.": "Yüklenecek paketin adı.", + "Location of the npm cache.":"npm önbelleğinin yeri.", + "Skip installation if a package is missing.": "Eğer eksik paket varsa yükleme adımını atla.", + "Path to user npmrc.": "Kullanıcının npmrc dosyasının yeri.", + "Execute string as if inside `npm run-script`.": "Komutu 'npm run-script' kapsamında çalıştır.", + "Shell to execute the command with, if any.": "Komutların çalıştırılacağı shell.", + "Generate shell code to use npx as the \"command not found\" fallback.": "Komut eğer 'command not found' hatası veriyorsa, komutu npx üzerinden bir daha dene.", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "$PATH ve lokal projede tanımlanmış programları pas geçer. Bu sayede, npx yeni bir yükleme yapar ve en son versiyonu kullanır.", + "npm binary to use for internal operations.": "Bu programın çalıştırılmasında kullanılacak npm.", + "For the full documentation, see the manual page for npx(1).": "Tamamını okumak için 'man npx'.", + "Unable to guess a binary name from %s. Please use --package.": "%s için hangi npm paketi bilemedim. Lütfen --package kullanın.", + "\nERROR: You must supply a command.\n": "\nHATA: Argüman vermelisiniz.\n", + "Command failed: %s %s": "Komut çalıştırılamadı: %s %s", + "Install for %s failed with code %s": "%s yüklenirken %s kodlu bir hata oluştu. Yükleme sonlandırıldı.", + "%s not found. Trying with npx...": "%s bulunamadı. npx ile deniyorum...", + "command not found": "komut bulunamadı", + "options": "seçenekler", + "command": "komut", + "version": "versiyon", + "command-arg": "argümanlar", + "command-string": "argümanlar", + "shell": "shell", + "package": "paket", + "npx": "npx", + "Suppress output from npx itself. Subcommands will not be affected.": "npx çıktısını durdur. Alt komutlar etkilenmez." +} diff --git a/deps/npm/node_modules/libnpx/locales/zh_CN.json b/deps/npm/node_modules/libnpx/locales/zh_CN.json new file mode 100644 index 00000000000000..6cf64629f16d32 --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/zh_CN.json @@ -0,0 +1,28 @@ +{ + "Execute binaries from npm packages.\n%s": "从 npm 的可执行包执行命令\n%s", + "Package to be installed.": "包安装的路径", + "Location of the npm cache.": "npm 缓存路径", + "Skip installation if a package is missing.": "如果有包缺失,跳过安装", + "Path to user npmrc.": "当前用户的 npmrc 路径", + "Execute string as if inside `npm run-script`.": "像执行 `npm run-script` 一样执行一个字符串", + "Shell to execute the command with, if any.": "执行命令用到的解释器,可选", + "Generate shell code to use npx as the \"command not found\" fallback.": "产生“找不到命令”的错误码", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "忽略 $PATH 或工程里已有的可执行文件,这会强制使 npx 临时安装一次,并且使用其最新的版本", + "npm binary to use for internal operations.": "为了执行内部操作的 npm 可执行文件", + "For the full documentation, see the manual page for npx(1).": "可以通过 npx(1) 的手册找到完整说明文档", + "Unable to guess a binary name from %s. Please use --package.": "无法推测出可执行文件名的来源 %s,请使用 --package", + "\nERROR: You must supply a command.\n": "\n错误:您必须提供一个命令\n", + "Command failed: %s %s": "执行失败:%s %s", + "Install for %s failed with code %s": "安装 %s 失败,错误代码:%s", + "%s not found. Trying with npx...": "找不到 %s,请尝试使用 npx...", + "command not found: %s": "找不到命令:%s", + "options": "选项", + "command": "命令", + "version": "版本", + "command-arg": "命令的参数", + "command-string": "命令的字符串", + "shell": "命令行解释器", + "package": "包", + "npx: installed %s in %ss": "npx: %s 安装成功,用时 %s 秒", + "Suppress output from npx itself. Subcommands will not be affected.": "隐藏 npx 的输出,子命令不会受到影响" +} diff --git a/deps/npm/node_modules/libnpx/locales/zh_TW.json b/deps/npm/node_modules/libnpx/locales/zh_TW.json new file mode 100644 index 00000000000000..86ed27ef61ea9a --- /dev/null +++ b/deps/npm/node_modules/libnpx/locales/zh_TW.json @@ -0,0 +1,29 @@ +{ + "Execute binaries from npm packages.\n%s": "從 npm 套件的執行檔執行指令\n%s", + "Package to be installed.": "套件安装的路徑", + "Location of the npm cache.": "npm 快取路徑", + "Skip installation if a package is missing.": "當套件遺失時,略過安裝", + "Path to user npmrc.": "目前使用者的 npmrc 路徑", + "Execute string as if inside `npm run-script`.": "以 `npm run-script` 的方式執行一個字串", + "Shell to execute the command with, if any.": "執行指令所使用的殼層(Shell),選用", + "Generate shell code to use npx as the \"command not found\" fallback.": "當 npx 找不到指令時,產生殼層(Shell)指令,並執行之", + "Ignores existing binaries in $PATH, or in the local project. This forces npx to do a temporary install and use the latest version.": "將會讓 npx 忽略 $PATH 環境變數或專案內已有的執行檔,並暫時安裝及使用最新版本的執行檔", + "npm binary to use for internal operations.": "指定 npx 內部執行使用的 npm 執行檔", + "For the full documentation, see the manual page for npx(1).": "參考 npx(1) 的文件以取得完整的說明", + "Unable to guess a binary name from %s. Please use --package.": "無法從 %s 推測執行檔名稱,請使用 --package 參數", + "\nERROR: You must supply a command.\n": "\n錯誤:您必須輸入一個指令\n", + "Command failed: %s %s": "指令執行失敗:%s %s", + "Install for %s failed with code %s": "安裝 %s 失敗,錯誤代碼:%s", + "%s not found. Trying with npx...": "找不到 %s,請嘗試使用 npx...", + "command not found: %s": "找不到指令:%s", + "options": "選項", + "command": "指令", + "version": "版本", + "command-arg": "指令的參數", + "command-string": "指令字串", + "shell": "殼層(Shell)", + "package": "套件", + "npx: installed %s in %ss": "npx: %s 安裝成功,花費 %s 秒", + "Suppress output from npx itself. Subcommands will not be affected.": "隱藏 npx 的輸出,不影響子指令", + "Extra node argument when calling a node binary.": "當呼叫 node 執行檔時,提供的額外參數" +} diff --git a/deps/npm/node_modules/libnpx/node_modules/dotenv/CHANGELOG.md b/deps/npm/node_modules/libnpx/node_modules/dotenv/CHANGELOG.md new file mode 100644 index 00000000000000..2fcf56b90228da --- /dev/null +++ b/deps/npm/node_modules/libnpx/node_modules/dotenv/CHANGELOG.md @@ -0,0 +1,76 @@ +# Change Log +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](http://semver.org/). + +## [Unreleased] + +## [4.0.0] - 2016-12-23 +### Changed + +- Return Object with parsed content or error instead of false ([#165](https://github.com/motdotla/dotenv/pull/165)). + + +### Removed + +- `verbose` option removed in favor of returning result. + + +## [3.0.0] - 2016-12-20 +### Added + +- `verbose` option will log any error messages. Off by default. +- parses email addresses correctly +- allow importing config method directly in ES6 + +### Changed + +- Suppress error messages by default ([#154](https://github.com/motdotla/dotenv/pull/154)) +- Ignoring more files for NPM to make package download smaller + +### Fixed + +- False positive test due to case-sensitive variable ([#124](https://github.com/motdotla/dotenv/pull/124)) + +### Removed + +- `silent` option removed in favor of `verbose` + +## [2.0.0] - 2016-01-20 +### Added +- CHANGELOG to ["make it easier for users and contributors to see precisely what notable changes have been made between each release"](http://keepachangelog.com/). Linked to from README +- LICENSE to be more explicit about what was defined in `package.json`. Linked to from README +- Testing nodejs v4 on travis-ci +- added examples of how to use dotenv in different ways +- return parsed object on success rather than boolean true + +### Changed +- README has shorter description not referencing ruby gem since we don't have or want feature parity + +### Removed +- Variable expansion and escaping so environment variables are encouraged to be fully orthogonal + +## [1.2.0] - 2015-06-20 +### Added +- Preload hook to require dotenv without including it in your code + +### Changed +- clarified license to be "BSD-2-Clause" in `package.json` + +### Fixed +- retain spaces in string vars + +## [1.1.0] - 2015-03-31 +### Added +- Silent option to silence `console.log` when `.env` missing + +## [1.0.0] - 2015-03-13 +### Removed +- support for multiple `.env` files. should always use one `.env` file for the current environment + +[Unreleased]: https://github.com/motdotla/dotenv/compare/v4.0.0...HEAD +[4.0.0]: https://github.com/motdotla/dotenv/compare/v3.0.0...v4.0.0 +[3.0.0]: https://github.com/motdotla/dotenv/compare/v2.0.0...v3.0.0 +[2.0.0]: https://github.com/motdotla/dotenv/compare/v1.2.0...v2.0.0 +[1.2.0]: https://github.com/motdotla/dotenv/compare/v1.1.0...v1.2.0 +[1.1.0]: https://github.com/motdotla/dotenv/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/motdotla/dotenv/compare/v0.4.0...v1.0.0 diff --git a/deps/npm/node_modules/libnpx/node_modules/dotenv/LICENSE b/deps/npm/node_modules/libnpx/node_modules/dotenv/LICENSE new file mode 100644 index 00000000000000..c430ad8bd06f2c --- /dev/null +++ b/deps/npm/node_modules/libnpx/node_modules/dotenv/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2015, Scott Motte +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/deps/npm/node_modules/libnpx/node_modules/dotenv/README.md b/deps/npm/node_modules/libnpx/node_modules/dotenv/README.md new file mode 100644 index 00000000000000..90836a34b7c321 --- /dev/null +++ b/deps/npm/node_modules/libnpx/node_modules/dotenv/README.md @@ -0,0 +1,208 @@ +# dotenv + +dotenv + +Dotenv is a zero-dependency module that loads environment variables from a `.env` file into [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env). Storing configuration in the environment separate from code is based on [The Twelve-Factor App](http://12factor.net/config) methodology. + +[![BuildStatus](https://img.shields.io/travis/motdotla/dotenv/master.svg?style=flat-square)](https://travis-ci.org/motdotla/dotenv) +[![NPM version](https://img.shields.io/npm/v/dotenv.svg?style=flat-square)](https://www.npmjs.com/package/dotenv) +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) +[![Coverage Status](https://img.shields.io/coveralls/motdotla/dotenv/master.svg?style=flat-square)](https://coveralls.io/github/motdotla/dotenv?branch=coverall-intergration) + +## Install + +```bash +npm install dotenv --save +``` + +## Usage + +As early as possible in your application, require and configure dotenv. + +```javascript +require('dotenv').config() +``` + +Create a `.env` file in the root directory of your project. Add +environment-specific variables on new lines in the form of `NAME=VALUE`. +For example: + +``` +DB_HOST=localhost +DB_USER=root +DB_PASS=s1mpl3 +``` + +That's it. + +`process.env` now has the keys and values you defined in your `.env` file. + +```javascript +var db = require('db') +db.connect({ + host: process.env.DB_HOST, + username: process.env.DB_USER, + password: process.env.DB_PASS +}) +``` + +### Preload + +If you are using iojs-v1.6.0 or later, you can use the `--require` (`-r`) command line option to preload dotenv. By doing this, you do not need to require and load dotenv in your application code. + + +```bash +$ node -r dotenv/config your_script.js +``` + +The configuration options below are supported as command line arguments in the format `dotenv_config_