diff --git a/.codeclimate.yml b/.codeclimate.yml
index 321f96c..09eefc8 100644
--- a/.codeclimate.yml
+++ b/.codeclimate.yml
@@ -1,6 +1,7 @@
-engines:
+version: "2"
+plugins:
eslint:
enabled: true
- channel: "eslint-3"
-exclude_paths:
+exclude_patterns:
- "docs/"
+- "test/"
diff --git a/.eslintrc.js b/.eslintrc.js
index 02c4bd6..43ed1a1 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -3,6 +3,9 @@ module.exports = {
"es6": true,
"node": true
},
+ "plugins": [
+ "mocha"
+ ],
"extends": "eslint:recommended",
"rules": {
"indent": [
@@ -20,6 +23,7 @@ module.exports = {
"semi": [
"error",
"always"
- ]
+ ],
+ "no-extra-boolean-cast": 0
}
};
diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
new file mode 100644
index 0000000..dbced9a
--- /dev/null
+++ b/.github/workflows/node.js.yml
@@ -0,0 +1,32 @@
+# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
+# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
+
+name: Node.js CI
+
+on:
+ push:
+ branches: [ "master" ]
+ pull_request:
+ branches: [ "master" ]
+
+jobs:
+ build:
+
+ strategy:
+ matrix:
+ node-version: [14.x, 16.x, 18.x, 20.x]
+ os: [ubuntu-latest, windows-latest]
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
+
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v3
+ with:
+ node-version: ${{ matrix.node-version }}
+ cache: 'npm'
+ - run: npm ci
+ # - run: npm run build --if-present
+ - run: npm test
diff --git a/.gitignore b/.gitignore
index 275d710..014f812 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,10 @@
node_modules/
+coverage/
+.env
.idea/
+.tool-versions
.*.swp
+.changelog
+CHANGELOG.new.md
+CHANGELOG.add.md
+CHANGELOG.new.md.tmp
diff --git a/.istanbul.yml b/.istanbul.yml
new file mode 100644
index 0000000..5ea2bdd
--- /dev/null
+++ b/.istanbul.yml
@@ -0,0 +1,6 @@
+check:
+ global:
+ statements: 100
+ lines: 100
+ branches: 100
+ functions: 100
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 60527cb..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,35 +0,0 @@
-language: node_js
-node_js:
- - "0.6"
- - "0.8"
- - "0.10"
- - "0.12"
- - "4.0"
- - "4.1"
- - "4.2"
- - "4.3"
- - "4.4"
- - "5.0"
- - "5.1"
- - "5.2"
- - "5.3"
- - "5.4"
- - "5.5"
- - "5.6"
- - "5.7"
- - "5.8"
- - "5.9"
- - "5.10"
- - "5.11"
- - "6.0"
- - "6.1"
- - "7"
- - "node"
-sudo: false
-cache:
- directories:
- - node_modules
-before_install:
- # Update Node.js modules
- - "test ! -d node_modules || npm prune"
- - "test ! -d node_modules || npm rebuild"
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..0cdbc6b
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,304 @@
+
+
+## v0.2.2 (2024-02-28)
+
+#### :bug: Bug Fix
+* [#278](https://github.com/raszi/node-tmp/pull/278) Closes [#268](https://github.com/raszi/node-tmp/issues/268): Revert "fix #246: remove any double quotes or single quotes… ([@mbargiel](https://github.com/mbargiel))
+
+#### :memo: Documentation
+* [#279](https://github.com/raszi/node-tmp/pull/279) Closes [#266](https://github.com/raszi/node-tmp/issues/266): move paragraph on graceful cleanup to the head of the documentation ([@silkentrance](https://github.com/silkentrance))
+
+#### Committers: 5
+- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
+- Dave Nicolson ([@dnicolson](https://github.com/dnicolson))
+- KARASZI István ([@raszi](https://github.com/raszi))
+- Maxime Bargiel ([@mbargiel](https://github.com/mbargiel))
+- [@robertoaceves](https://github.com/robertoaceves)
+
+
+## v0.2.1 (2020-04-28)
+
+#### :rocket: Enhancement
+* [#252](https://github.com/raszi/node-tmp/pull/252) Closes [#250](https://github.com/raszi/node-tmp/issues/250): introduce tmpdir option for overriding the system tmp dir ([@silkentrance](https://github.com/silkentrance))
+
+#### :house: Internal
+* [#253](https://github.com/raszi/node-tmp/pull/253) Closes [#191](https://github.com/raszi/node-tmp/issues/191): generate changelog from pull requests using lerna-changelog ([@silkentrance](https://github.com/silkentrance))
+
+#### Committers: 1
+- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
+
+
+## v0.2.0 (2020-04-25)
+
+#### :rocket: Enhancement
+* [#234](https://github.com/raszi/node-tmp/pull/234) feat: stabilize tmp for v0.2.0 release ([@silkentrance](https://github.com/silkentrance))
+
+#### :bug: Bug Fix
+* [#231](https://github.com/raszi/node-tmp/pull/231) Closes [#230](https://github.com/raszi/node-tmp/issues/230): regression after fix for #197 ([@silkentrance](https://github.com/silkentrance))
+* [#220](https://github.com/raszi/node-tmp/pull/220) Closes [#197](https://github.com/raszi/node-tmp/issues/197): return sync callback when using the sync interface, otherwise return the async callback ([@silkentrance](https://github.com/silkentrance))
+* [#193](https://github.com/raszi/node-tmp/pull/193) Closes [#192](https://github.com/raszi/node-tmp/issues/192): tmp must not exit the process on its own ([@silkentrance](https://github.com/silkentrance))
+
+#### :memo: Documentation
+* [#221](https://github.com/raszi/node-tmp/pull/221) Gh 206 document name option ([@silkentrance](https://github.com/silkentrance))
+
+#### :house: Internal
+* [#226](https://github.com/raszi/node-tmp/pull/226) Closes [#212](https://github.com/raszi/node-tmp/issues/212): enable direct name option test ([@silkentrance](https://github.com/silkentrance))
+* [#225](https://github.com/raszi/node-tmp/pull/225) Closes [#211](https://github.com/raszi/node-tmp/issues/211): existing tests must clean up after themselves ([@silkentrance](https://github.com/silkentrance))
+* [#224](https://github.com/raszi/node-tmp/pull/224) Closes [#217](https://github.com/raszi/node-tmp/issues/217): name tests must use tmpName ([@silkentrance](https://github.com/silkentrance))
+* [#223](https://github.com/raszi/node-tmp/pull/223) Closes [#214](https://github.com/raszi/node-tmp/issues/214): refactor tests and lib ([@silkentrance](https://github.com/silkentrance))
+* [#198](https://github.com/raszi/node-tmp/pull/198) Update dependencies to latest versions ([@matsev](https://github.com/matsev))
+
+#### Committers: 2
+- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
+- Mattias Severson ([@matsev](https://github.com/matsev))
+
+
+## v0.1.0 (2019-03-20)
+
+#### :rocket: Enhancement
+* [#177](https://github.com/raszi/node-tmp/pull/177) fix: fail early if there is no tmp dir specified ([@silkentrance](https://github.com/silkentrance))
+* [#159](https://github.com/raszi/node-tmp/pull/159) Closes [#121](https://github.com/raszi/node-tmp/issues/121) ([@silkentrance](https://github.com/silkentrance))
+* [#161](https://github.com/raszi/node-tmp/pull/161) Closes [#155](https://github.com/raszi/node-tmp/issues/155) ([@silkentrance](https://github.com/silkentrance))
+* [#166](https://github.com/raszi/node-tmp/pull/166) fix: avoid relying on Node’s internals ([@addaleax](https://github.com/addaleax))
+* [#144](https://github.com/raszi/node-tmp/pull/144) prepend opts.dir || tmpDir to template if no path is given ([@silkentrance](https://github.com/silkentrance))
+
+#### :bug: Bug Fix
+* [#183](https://github.com/raszi/node-tmp/pull/183) Closes [#182](https://github.com/raszi/node-tmp/issues/182) fileSync takes empty string postfix option ([@gutte](https://github.com/gutte))
+* [#130](https://github.com/raszi/node-tmp/pull/130) Closes [#129](https://github.com/raszi/node-tmp/issues/129) install process listeners safely ([@silkentrance](https://github.com/silkentrance))
+
+#### :memo: Documentation
+* [#188](https://github.com/raszi/node-tmp/pull/188) HOTCloses [#187](https://github.com/raszi/node-tmp/issues/187): restore behaviour for #182 ([@silkentrance](https://github.com/silkentrance))
+* [#180](https://github.com/raszi/node-tmp/pull/180) fix gh-179: template no longer accepts arbitrary paths ([@silkentrance](https://github.com/silkentrance))
+* [#175](https://github.com/raszi/node-tmp/pull/175) docs: add `unsafeCleanup` option to jsdoc ([@kerimdzhanov](https://github.com/kerimdzhanov))
+* [#151](https://github.com/raszi/node-tmp/pull/151) docs: fix link to tmp-promise ([@silkentrance](https://github.com/silkentrance))
+
+#### :house: Internal
+* [#184](https://github.com/raszi/node-tmp/pull/184) test: add missing tests for #182 ([@silkentrance](https://github.com/silkentrance))
+* [#171](https://github.com/raszi/node-tmp/pull/171) chore: drop old NodeJS support ([@poppinlp](https://github.com/poppinlp))
+* [#170](https://github.com/raszi/node-tmp/pull/170) chore: update dependencies ([@raszi](https://github.com/raszi))
+* [#165](https://github.com/raszi/node-tmp/pull/165) test: add missing tests ([@raszi](https://github.com/raszi))
+* [#163](https://github.com/raszi/node-tmp/pull/163) chore: add lint npm task ([@raszi](https://github.com/raszi))
+* [#107](https://github.com/raszi/node-tmp/pull/107) chore: add coverage report ([@raszi](https://github.com/raszi))
+* [#141](https://github.com/raszi/node-tmp/pull/141) test: refactor tests for mocha ([@silkentrance](https://github.com/silkentrance))
+* [#154](https://github.com/raszi/node-tmp/pull/154) chore: change Travis configuration ([@raszi](https://github.com/raszi))
+* [#152](https://github.com/raszi/node-tmp/pull/152) fix: drop Node v0.6.0 ([@raszi](https://github.com/raszi))
+
+#### Committers: 6
+- Anna Henningsen ([@addaleax](https://github.com/addaleax))
+- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
+- Dan Kerimdzhanov ([@kerimdzhanov](https://github.com/kerimdzhanov))
+- Gustav Klingstedt ([@gutte](https://github.com/gutte))
+- KARASZI István ([@raszi](https://github.com/raszi))
+- PoppinL ([@poppinlp](https://github.com/poppinlp))
+
+
+## v0.0.33 (2017-08-12)
+
+#### :rocket: Enhancement
+* [#147](https://github.com/raszi/node-tmp/pull/147) fix: with name option try at most once to get a unique tmp name ([@silkentrance](https://github.com/silkentrance))
+
+#### :bug: Bug Fix
+* [#149](https://github.com/raszi/node-tmp/pull/149) fix(fileSync): must honor detachDescriptor and discardDescriptor options ([@silkentrance](https://github.com/silkentrance))
+* [#119](https://github.com/raszi/node-tmp/pull/119) Closes [#115](https://github.com/raszi/node-tmp/issues/115) ([@silkentrance](https://github.com/silkentrance))
+
+#### :memo: Documentation
+* [#128](https://github.com/raszi/node-tmp/pull/128) Closes [#127](https://github.com/raszi/node-tmp/issues/127) add reference to tmp-promise ([@silkentrance](https://github.com/silkentrance))
+
+#### :house: Internal
+* [#135](https://github.com/raszi/node-tmp/pull/135) Closes [#133](https://github.com/raszi/node-tmp/issues/133), #134 ([@silkentrance](https://github.com/silkentrance))
+* [#123](https://github.com/raszi/node-tmp/pull/123) docs: update tmp.js MIT license header to 2017 ([@madnight](https://github.com/madnight))
+* [#122](https://github.com/raszi/node-tmp/pull/122) chore: add issue template ([@silkentrance](https://github.com/silkentrance))
+
+#### Committers: 2
+- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
+- Fabian Beuke ([@madnight](https://github.com/madnight))
+
+
+## v0.0.32 (2017-03-24)
+
+#### :memo: Documentation
+* [#106](https://github.com/raszi/node-tmp/pull/106) doc: add proper JSDoc documentation ([@raszi](https://github.com/raszi))
+
+#### :house: Internal
+* [#111](https://github.com/raszi/node-tmp/pull/111) test: add Windows tests ([@binki](https://github.com/binki))
+* [#110](https://github.com/raszi/node-tmp/pull/110) chore: add AppVeyor ([@binki](https://github.com/binki))
+* [#105](https://github.com/raszi/node-tmp/pull/105) chore: use const where possible ([@raszi](https://github.com/raszi))
+* [#104](https://github.com/raszi/node-tmp/pull/104) style: fix various style issues ([@raszi](https://github.com/raszi))
+
+#### Committers: 2
+- KARASZI István ([@raszi](https://github.com/raszi))
+- Nathan Phillip Brink ([@binki](https://github.com/binki))
+
+
+## v0.0.31 (2016-11-21)
+
+#### :rocket: Enhancement
+* [#99](https://github.com/raszi/node-tmp/pull/99) feat: add next callback functionality ([@silkentrance](https://github.com/silkentrance))
+* [#94](https://github.com/raszi/node-tmp/pull/94) feat: add options to control descriptor management ([@pabigot](https://github.com/pabigot))
+
+#### :house: Internal
+* [#101](https://github.com/raszi/node-tmp/pull/101) fix: Include files in the package.json ([@raszi](https://github.com/raszi))
+
+#### Committers: 3
+- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
+- KARASZI István ([@raszi](https://github.com/raszi))
+- Peter A. Bigot ([@pabigot](https://github.com/pabigot))
+
+
+## v0.0.30 (2016-11-01)
+
+#### :bug: Bug Fix
+* [#96](https://github.com/raszi/node-tmp/pull/96) fix: constants for Node 6 ([@jnj16180340](https://github.com/jnj16180340))
+* [#98](https://github.com/raszi/node-tmp/pull/98) fix: garbage collector ([@Ari-H](https://github.com/Ari-H))
+
+#### Committers: 2
+- Nate Johnson ([@jnj16180340](https://github.com/jnj16180340))
+- [@Ari-H](https://github.com/Ari-H)
+
+
+## v0.0.29 (2016-09-18)
+
+#### :rocket: Enhancement
+* [#87](https://github.com/raszi/node-tmp/pull/87) fix: replace calls to deprecated fs API functions ([@OlliV](https://github.com/OlliV))
+
+#### :bug: Bug Fix
+* [#70](https://github.com/raszi/node-tmp/pull/70) fix: prune `_removeObjects` correctly ([@joliss](https://github.com/joliss))
+* [#71](https://github.com/raszi/node-tmp/pull/71) Fix typo ([@gcampax](https://github.com/gcampax))
+
+#### :memo: Documentation
+* [#77](https://github.com/raszi/node-tmp/pull/77) docs: change mkstemps to mkstemp ([@thefourtheye](https://github.com/thefourtheye))
+
+#### :house: Internal
+* [#92](https://github.com/raszi/node-tmp/pull/92) chore: add Travis CI support for Node 6 ([@amilajack](https://github.com/amilajack))
+* [#79](https://github.com/raszi/node-tmp/pull/79) fix: remove unneeded require statement ([@whmountains](https://github.com/whmountains))
+
+#### Committers: 6
+- Amila Welihinda ([@amilajack](https://github.com/amilajack))
+- Caleb Whiting ([@whmountains](https://github.com/whmountains))
+- Giovanni Campagna ([@gcampax](https://github.com/gcampax))
+- Jo Liss ([@joliss](https://github.com/joliss))
+- Olli Vanhoja ([@OlliV](https://github.com/OlliV))
+- Sakthipriyan Vairamani ([@thefourtheye](https://github.com/thefourtheye))
+
+
+## v0.0.28 (2015-09-27)
+
+#### :bug: Bug Fix
+* [#63](https://github.com/raszi/node-tmp/pull/63) fix: delete for _rmdirRecursiveSync ([@voltrevo](https://github.com/voltrevo))
+
+#### :memo: Documentation
+* [#64](https://github.com/raszi/node-tmp/pull/64) docs: fix typo in the README ([@JTKnox91](https://github.com/JTKnox91))
+
+#### :house: Internal
+* [#67](https://github.com/raszi/node-tmp/pull/67) test: add node v4.0 v4.1 to travis config ([@raszi](https://github.com/raszi))
+* [#66](https://github.com/raszi/node-tmp/pull/66) chore(deps): update deps ([@raszi](https://github.com/raszi))
+
+#### Committers: 3
+- Andrew Morris ([@voltrevo](https://github.com/voltrevo))
+- John T. Knox ([@JTKnox91](https://github.com/JTKnox91))
+- KARASZI István ([@raszi](https://github.com/raszi))
+
+
+## v0.0.27 (2015-08-15)
+
+#### :bug: Bug Fix
+* [#60](https://github.com/raszi/node-tmp/pull/60) fix: unlinking when the file has been already removed ([@silkentrance](https://github.com/silkentrance))
+
+#### :memo: Documentation
+* [#55](https://github.com/raszi/node-tmp/pull/55) docs(README): update README ([@raszi](https://github.com/raszi))
+
+#### :house: Internal
+* [#56](https://github.com/raszi/node-tmp/pull/56) style(jshint): fix JSHint error ([@raszi](https://github.com/raszi))
+* [#53](https://github.com/raszi/node-tmp/pull/53) chore: update license attribute ([@pdehaan](https://github.com/pdehaan))
+
+#### Committers: 3
+- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
+- KARASZI István ([@raszi](https://github.com/raszi))
+- Peter deHaan ([@pdehaan](https://github.com/pdehaan))
+
+
+## v0.0.26 (2015-05-12)
+
+#### :rocket: Enhancement
+* [#40](https://github.com/raszi/node-tmp/pull/40) Fix for #39 ([@silkentrance](https://github.com/silkentrance))
+* [#42](https://github.com/raszi/node-tmp/pull/42) Fix for #17 ([@silkentrance](https://github.com/silkentrance))
+* [#41](https://github.com/raszi/node-tmp/pull/41) Fix for #37 ([@silkentrance](https://github.com/silkentrance))
+* [#32](https://github.com/raszi/node-tmp/pull/32) add ability to customize file/dir names ([@shime](https://github.com/shime))
+* [#29](https://github.com/raszi/node-tmp/pull/29) tmp.file have responsibility to close file, not only unlink file ([@vhain](https://github.com/vhain))
+
+#### :bug: Bug Fix
+* [#51](https://github.com/raszi/node-tmp/pull/51) fix(windows): fix tempDir on windows ([@raszi](https://github.com/raszi))
+* [#49](https://github.com/raszi/node-tmp/pull/49) remove object from _removeObjects if cleanup fn is called Closes [#48](https://github.com/raszi/node-tmp/issues/48) ([@bmeck](https://github.com/bmeck))
+
+#### :memo: Documentation
+* [#45](https://github.com/raszi/node-tmp/pull/45) Fix for #44 ([@silkentrance](https://github.com/silkentrance))
+
+#### :house: Internal
+* [#34](https://github.com/raszi/node-tmp/pull/34) Create LICENSE ([@ScottWeinstein](https://github.com/ScottWeinstein))
+
+#### Committers: 6
+- Bradley Farias ([@bmeck](https://github.com/bmeck))
+- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
+- Hrvoje Šimić ([@shime](https://github.com/shime))
+- Juwan Yoo ([@vhain](https://github.com/vhain))
+- KARASZI István ([@raszi](https://github.com/raszi))
+- Scott Weinstein ([@ScottWeinstein](https://github.com/ScottWeinstein))
+
+
+## v0.0.24 (2014-07-11)
+
+#### :rocket: Enhancement
+* [#25](https://github.com/raszi/node-tmp/pull/25) Added removeCallback passing ([@foxel](https://github.com/foxel))
+
+#### Committers: 1
+- Andrey Kupreychik ([@foxel](https://github.com/foxel))
+
+
+## v0.0.23 (2013-12-03)
+
+#### :rocket: Enhancement
+* [#21](https://github.com/raszi/node-tmp/pull/21) If we are not on node 0.8, don't register an uncaughtException handler ([@wibblymat](https://github.com/wibblymat))
+
+#### Committers: 1
+- Mat Scales ([@wibblymat](https://github.com/wibblymat))
+
+
+## v0.0.22 (2013-11-29)
+
+#### :rocket: Enhancement
+* [#19](https://github.com/raszi/node-tmp/pull/19) Rethrow only on node v0.8. ([@mcollina](https://github.com/mcollina))
+
+#### Committers: 1
+- Matteo Collina ([@mcollina](https://github.com/mcollina))
+
+
+## v0.0.21 (2013-08-07)
+
+#### :bug: Bug Fix
+* [#16](https://github.com/raszi/node-tmp/pull/16) Fix bug where we delete contents of symlinks ([@lightsofapollo](https://github.com/lightsofapollo))
+
+#### Committers: 1
+- James Lal ([@lightsofapollo](https://github.com/lightsofapollo))
+
+
+## v0.0.17 (2013-04-09)
+
+#### :rocket: Enhancement
+* [#9](https://github.com/raszi/node-tmp/pull/9) add recursive remove option ([@oscar-broman](https://github.com/oscar-broman))
+
+#### Committers: 1
+- [@oscar-broman](https://github.com/oscar-broman)
+
+
+## v0.0.14 (2012-08-26)
+
+#### :rocket: Enhancement
+* [#5](https://github.com/raszi/node-tmp/pull/5) Export _getTmpName for temporary file name creation ([@joscha](https://github.com/joscha))
+
+#### Committers: 1
+- Joscha Feth ([@joscha](https://github.com/joscha))
+
+
+## Previous Releases < v0.0.14
+
+- no information available
diff --git a/README.md b/README.md
index 810b048..976ac9b 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
A simple temporary file and directory creator for [node.js.][1]
-[](https://travis-ci.org/raszi/node-tmp)
-[](https://david-dm.org/raszi/node-tmp)
+[](https://github.com/raszi/node-tmp/actions/workflows/node.js.yml)
+[](https://libraries.io/github/raszi/node-tmp)
[](https://badge.fury.io/js/tmp)
[](https://raszi.github.io/node-tmp/)
[](https://snyk.io/test/npm/tmp)
@@ -15,14 +15,71 @@ in a [node.js][1] environment.
Tmp offers both an asynchronous and a synchronous API. For all API calls, all
the parameters are optional. There also exists a promisified version of the
-API, see (5) under references below.
+API, see [tmp-promise][5].
Tmp uses crypto for determining random file names, or, when using templates,
a six letter random identifier. And just in case that you do not have that much
entropy left on your system, Tmp will fall back to pseudo random numbers.
You can set whether you want to remove the temporary file on process exit or
-not, and the destination directory can also be set.
+not.
+
+If you do not want to store your temporary directories and files in the
+standard OS temporary directory, then you are free to override that as well.
+
+## An Important Note on Previously Undocumented Breaking Changes
+
+All breaking changes that had been introduced, i.e.
+
+- tmpdir must be located under the system defined tmpdir root.
+- Spaces being collapsed into single spaces
+- Removal of all single and double quote characters
+
+have been reverted in v0.2.2 and tmp should now behave as it did before the
+introduction of these breaking changes.
+
+Other breaking changes, i.e.
+
+- template must be relative to tmpdir
+- name must be relative to tmpdir
+- dir option must be relative to tmpdir
+
+are still in place.
+
+In order to override the system's tmpdir, you will have to use the newly
+introduced tmpdir option.
+
+## An Important Note on Compatibility
+
+See the [CHANGELOG](./CHANGELOG.md) for more information.
+
+### Version 0.2.3
+
+- Node version <= 14.4 has been dropped.
+- rimraf has been dropped from the dependencies
+
+### Version 0.2.2
+
+Since version 0.2.2, all support for node version <= 14 has been dropped.
+
+### Version 0.1.0
+
+Since version 0.1.0, all support for node versions < 0.10.0 has been dropped.
+
+Most importantly, any support for earlier versions of node-tmp was also dropped.
+
+If you still require node versions < 0.10.0, then you must limit your node-tmp
+dependency to versions below 0.1.0.
+
+### Version 0.0.33
+
+Since version 0.0.33, all support for node versions < 0.8 has been dropped.
+
+If you still require node version 0.8, then you must limit your node-tmp
+dependency to version 0.0.33.
+
+For node versions < 0.8 you must limit your node-tmp dependency to
+versions < 0.0.33.
## How to install
@@ -34,12 +91,24 @@ npm install tmp
Please also check [API docs][4].
+## Graceful cleanup
+
+If graceful cleanup is set, tmp will remove all controlled temporary objects on process exit, otherwise the temporary objects will remain in place, waiting to be cleaned up on system restart or otherwise scheduled temporary object removal.
+
+To enforce this, you can call the `setGracefulCleanup()` method:
+
+```javascript
+const tmp = require('tmp');
+
+tmp.setGracefulCleanup();
+```
+
### Asynchronous file creation
Simple temporary file creation, the file will be closed and unlinked on process exit.
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
tmp.file(function _tempFileCreated(err, path, fd, cleanupCallback) {
if (err) throw err;
@@ -59,9 +128,9 @@ tmp.file(function _tempFileCreated(err, path, fd, cleanupCallback) {
A synchronous version of the above.
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
-var tmpobj = tmp.fileSync();
+const tmpobj = tmp.fileSync();
console.log('File: ', tmpobj.name);
console.log('Filedescriptor: ', tmpobj.fd);
@@ -82,7 +151,7 @@ Simple temporary directory creation, it will be removed on process exit.
If the directory still contains items on process exit, then it won't be removed.
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
tmp.dir(function _tempDirCreated(err, path, cleanupCallback) {
if (err) throw err;
@@ -102,9 +171,9 @@ you can pass the `unsafeCleanup` option when creating it.
A synchronous version of the above.
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
-var tmpobj = tmp.dirSync();
+const tmpobj = tmp.dirSync();
console.log('Dir: ', tmpobj.name);
// Manual cleanup
tmpobj.removeCallback();
@@ -120,7 +189,7 @@ It is possible with this library to generate a unique filename in the specified
directory.
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
tmp.tmpName(function _tempNameGenerated(err, path) {
if (err) throw err;
@@ -134,9 +203,9 @@ tmp.tmpName(function _tempNameGenerated(err, path) {
A synchronous version of the above.
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
-var name = tmp.tmpNameSync();
+const name = tmp.tmpNameSync();
console.log('Created temporary filename: ', name);
```
@@ -147,9 +216,9 @@ console.log('Created temporary filename: ', name);
Creates a file with mode `0644`, prefix will be `prefix-` and postfix will be `.txt`.
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
-tmp.file({ mode: 0644, prefix: 'prefix-', postfix: '.txt' }, function _tempFileCreated(err, path, fd) {
+tmp.file({ mode: 0o644, prefix: 'prefix-', postfix: '.txt' }, function _tempFileCreated(err, path, fd) {
if (err) throw err;
console.log('File: ', path);
@@ -162,9 +231,9 @@ tmp.file({ mode: 0644, prefix: 'prefix-', postfix: '.txt' }, function _tempFileC
A synchronous version of the above.
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
-var tmpobj = tmp.fileSync({ mode: 0644, prefix: 'prefix-', postfix: '.txt' });
+const tmpobj = tmp.fileSync({ mode: 0o644, prefix: 'prefix-', postfix: '.txt' });
console.log('File: ', tmpobj.name);
console.log('Filedescriptor: ', tmpobj.fd);
```
@@ -186,7 +255,7 @@ descriptor. Two options control how the descriptor is managed:
longer needed.
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
tmp.file({ discardDescriptor: true }, function _tempFileCreated(err, path, fd, cleanupCallback) {
if (err) throw err;
@@ -196,7 +265,7 @@ tmp.file({ discardDescriptor: true }, function _tempFileCreated(err, path, fd, c
```
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
tmp.file({ detachDescriptor: true }, function _tempFileCreated(err, path, fd, cleanupCallback) {
if (err) throw err;
@@ -213,9 +282,9 @@ tmp.file({ detachDescriptor: true }, function _tempFileCreated(err, path, fd, cl
Creates a directory with mode `0755`, prefix will be `myTmpDir_`.
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
-tmp.dir({ mode: 0750, prefix: 'myTmpDir_' }, function _tempDirCreated(err, path) {
+tmp.dir({ mode: 0o750, prefix: 'myTmpDir_' }, function _tempDirCreated(err, path) {
if (err) throw err;
console.log('Dir: ', path);
@@ -227,9 +296,9 @@ tmp.dir({ mode: 0750, prefix: 'myTmpDir_' }, function _tempDirCreated(err, path)
Again, a synchronous version of the above.
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
-var tmpobj = tmp.dirSync({ mode: 0750, prefix: 'myTmpDir_' });
+const tmpobj = tmp.dirSync({ mode: 0750, prefix: 'myTmpDir_' });
console.log('Dir: ', tmpobj.name);
```
@@ -237,10 +306,14 @@ console.log('Dir: ', tmpobj.name);
Creates a new temporary directory with mode `0700` and filename like `/tmp/tmp-nk2J1u`.
+IMPORTANT NOTE: template no longer accepts a path. Use the dir option instead if you
+require tmp to create your temporary filesystem object in a different place than the
+default `tmp.tmpdir`.
+
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
-tmp.dir({ template: '/tmp/tmp-XXXXXX' }, function _tempDirCreated(err, path) {
+tmp.dir({ template: 'tmp-XXXXXX' }, function _tempDirCreated(err, path) {
if (err) throw err;
console.log('Dir: ', path);
@@ -252,20 +325,25 @@ tmp.dir({ template: '/tmp/tmp-XXXXXX' }, function _tempDirCreated(err, path) {
This will behave similarly to the asynchronous version.
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
-var tmpobj = tmp.dirSync({ template: '/tmp/tmp-XXXXXX' });
+const tmpobj = tmp.dirSync({ template: 'tmp-XXXXXX' });
console.log('Dir: ', tmpobj.name);
```
### Asynchronous filename generation
-The `tmpName()` function accepts the `prefix`, `postfix`, `dir`, etc. parameters also:
+Using `tmpName()` you can create temporary file names asynchronously.
+The function accepts all standard options, e.g. `prefix`, `postfix`, `dir`, and so on.
+
+You can also leave out the options altogether and just call the function with a callback as first parameter.
```javascript
-var tmp = require('tmp');
+const tmp = require('tmp');
+
+const options = {};
-tmp.tmpName({ template: '/tmp/tmp-XXXXXX' }, function _tempNameGenerated(err, path) {
+tmp.tmpName(options, function _tempNameGenerated(err, path) {
if (err) throw err;
console.log('Created temporary filename: ', path);
@@ -275,37 +353,36 @@ tmp.tmpName({ template: '/tmp/tmp-XXXXXX' }, function _tempNameGenerated(err, pa
### Synchronous filename generation
The `tmpNameSync()` function works similarly to `tmpName()`.
+Again, you can leave out the options altogether and just invoke the function without any parameters.
```javascript
-var tmp = require('tmp');
-var tmpname = tmp.tmpNameSync({ template: '/tmp/tmp-XXXXXX' });
+const tmp = require('tmp');
+const options = {};
+const tmpname = tmp.tmpNameSync(options);
console.log('Created temporary filename: ', tmpname);
```
-## Graceful cleanup
-
-One may want to cleanup the temporary files even when an uncaught exception
-occurs. To enforce this, you can call the `setGracefulCleanup()` method:
-
-```javascript
-var tmp = require('tmp');
-
-tmp.setGracefulCleanup();
-```
-
## Options
All options are optional :)
- * `mode`: the file mode to create with, it fallbacks to `0600` on file creation and `0700` on directory creation
- * `prefix`: the optional prefix, fallbacks to `tmp-` if not provided
- * `postfix`: the optional postfix, fallbacks to `.tmp` on file creation
- * `template`: [`mkstemp`][3] like filename template, no default
- * `dir`: the optional temporary directory, fallbacks to system default (guesses from environment)
+ * `name`: a fixed name that overrides random name generation, the name must be relative and must not contain path segments
+ * `mode`: the file mode to create with, falls back to `0o600` on file creation and `0o700` on directory creation
+ * `prefix`: the optional prefix, defaults to `tmp`
+ * `postfix`: the optional postfix
+ * `template`: [`mkstemp`][3] like filename template, no default, must include `XXXXXX` once for random name generation, e.g.
+ 'foo-bar-XXXXXX'.
+ * `dir`: the optional temporary directory that must be relative to the system's default temporary directory.
+ absolute paths are fine as long as they point to a location under the system's default temporary directory.
+ Any directories along the so specified path must exist, otherwise a ENOENT error will be thrown upon access,
+ as tmp will not check the availability of the path, nor will it establish the requested path for you.
+ * `tmpdir`: allows you to override the system's root tmp directory
* `tries`: how many times should the function try to get a unique filename before giving up, default `3`
- * `keep`: signals that the temporary file or directory should not be deleted on exit, default is `false`, means delete
- * Please keep in mind that it is recommended in this case to call the provided `cleanupCallback` function manually.
+ * `keep`: signals that the temporary file or directory should not be deleted on exit, default is `false`
+ * In order to clean up, you will have to call the provided `cleanupCallback` function manually.
* `unsafeCleanup`: recursively removes the created temporary directory, even when it's not empty. default is `false`
+ * `detachDescriptor`: detaches the file descriptor, caller is responsible for closing the file, tmp will no longer try closing the file during garbage collection
+ * `discardDescriptor`: discards the file descriptor (closes file, fd is -1), tmp will no longer try closing the file during garbage collection
[1]: http://nodejs.org/
[2]: https://www.npmjs.com/browse/depended/tmp
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index c774a77..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-# https://www.appveyor.com/docs/lang/nodejs-iojs/
-
-environment:
- matrix:
- - nodejs_version: "4"
- - nodejs_version: "5"
- - nodejs_version: "6"
- - nodejs_version: "7"
-
-install:
- - ps: Install-Product node $env:nodejs_version
- - npm install
-
-test_script:
- - node --version
- - npm --version
- - npm test
-
-build: off
diff --git a/docs/global.html b/docs/global.html
index 820fcd7..22766d4 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -87,42 +87,6 @@
Sets the graceful cleanup.
-Also removes the created files and directories when an uncaught exception occurs.
+If graceful cleanup is set, tmp will remove all controlled temporary objects on process exit, otherwise the
+temporary objects will remain in place, waiting to be cleaned up on system restart or otherwise scheduled temporary
+object removals.
Tmp offers both an asynchronous and a synchronous API. For all API calls, all
-the parameters are optional.
+the parameters are optional. There also exists a promisified version of the
+API, see tmp-promise.
Tmp uses crypto for determining random file names, or, when using templates,
a six letter random identifier. And just in case that you do not have that much
entropy left on your system, Tmp will fall back to pseudo random numbers.
You can set whether you want to remove the temporary file on process exit or
-not, and the destination directory can also be set.
-
How to install
npm install tmp
Usage
Asynchronous file creation
Simple temporary file creation, the file will be closed and unlinked on process exit.
-
var tmp = require('tmp');
+not.
+
If you do not want to store your temporary directories and files in the
+standard OS temporary directory, then you are free to override that as well.
+
An Important Note on Previously Undocumented Breaking Changes
+
All breaking changes that had been introduced, i.e.
+
+
tmpdir must be located under the system defined tmpdir root.
+
Spaces being collapsed into single spaces
+
Removal of all single and double quote characters
+
+
have been reverted in v0.2.2 and tmp should now behave as it did before the
+introduction of these breaking changes.
+
Other breaking changes, i.e.
+
+
template must be relative to tmpdir
+
name must be relative to tmpdir
+
dir option must be relative to tmpdir
+
+
are still in place.
+
In order to override the system's tmpdir, you will have to use the newly
+introduced tmpdir option.
If graceful cleanup is set, tmp will remove all controlled temporary objects on process exit, otherwise the temporary objects will remain in place, waiting to be cleaned up on system restart or otherwise scheduled temporary object removal.
+
To enforce this, you can call the setGracefulCleanup() method:
Simple temporary file creation, the file will be closed and unlinked on process exit.
+
const tmp = require('tmp');
tmp.file(function _tempFileCreated(err, path, fd, cleanupCallback) {
if (err) throw err;
- console.log("File: ", path);
- console.log("Filedescriptor: ", fd);
-
+ console.log('File: ', path);
+ console.log('Filedescriptor: ', fd);
+
// If we don't need the file anymore we could manually call the cleanupCallback
// But that is not necessary if we didn't pass the keep option because the library
// will clean after itself.
cleanupCallback();
-});
const tmp = require('tmp');
+
+const tmpobj = tmp.fileSync();
+console.log('File: ', tmpobj.name);
+console.log('Filedescriptor: ', tmpobj.fd);
+
// If we don't need the file anymore we could manually call the removeCallback
// But that is not necessary if we didn't pass the keep option because the library
// will clean after itself.
-tmpobj.removeCallback();
Note that this might throw an exception if either the maximum limit of retries
+tmpobj.removeCallback();
+
+
Note that this might throw an exception if either the maximum limit of retries
for creating a temporary name fails, or, in case that you do not have the permission
to write to the directory where the temporary file should be created in.
-
Asynchronous directory creation
Simple temporary directory creation, it will be removed on process exit.
+
Asynchronous directory creation
+
Simple temporary directory creation, it will be removed on process exit.
If the directory still contains items on process exit, then it won't be removed.
Note that this might throw an exception if either the maximum limit of retries
+tmpobj.removeCallback();
+
+
Note that this might throw an exception if either the maximum limit of retries
for creating a temporary name fails, or, in case that you do not have the permission
to write to the directory where the temporary directory should be created in.
-
Asynchronous filename generation
It is possible with this library to generate a unique filename in the specified
+
Asynchronous filename generation
+
It is possible with this library to generate a unique filename in the specified
directory.
As a side effect of creating a unique file tmp gets a file descriptor that is
+ console.log('File: ', path);
+ console.log('Filedescriptor: ', fd);
+});
+
As a side effect of creating a unique file tmp gets a file descriptor that is
returned to the user as the fd parameter. The descriptor may be used by the
application and is closed when the removeCallback is invoked.
In some use cases the application does not need the descriptor, needs to close it
@@ -143,13 +220,15 @@
Asynchronous filename generation
It is possible with this library to
parameter, but it is the application's responsibility to close it when it is no
longer needed.
-
var tmp = require('tmp');
+
const tmp = require('tmp');
tmp.file({ discardDescriptor: true }, function _tempFileCreated(err, path, fd, cleanupCallback) {
if (err) throw err;
// fd will be undefined, allowing application to use fs.createReadStream(path)
// without holding an unused descriptor open.
-});
It is possible with this library to
// Application can store data through fd here; the space used will automatically
// be reclaimed by the operating system when the descriptor is closed or program
// terminates.
-});
Asynchronous directory creation
Creates a directory with mode 0755, prefix will be myTmpDir_.
-
var tmp = require('tmp');
+});
+
+
Asynchronous directory creation
+
Creates a directory with mode 0755, prefix will be myTmpDir_.
Creates a new temporary directory with mode 0700 and filename like /tmp/tmp-nk2J1u.
+
IMPORTANT NOTE: template no longer accepts a path. Use the dir option instead if you
+require tmp to create your temporary filesystem object in a different place than the
+default tmp.tmpdir.
The tmpNameSync() function works similarly to tmpName().
+Again, you can leave out the options altogether and just invoke the function without any parameters.
mode: the file mode to create with, it fallbacks to 0600 on file creation and 0700 on directory creation
-
prefix: the optional prefix, fallbacks to tmp- if not provided
-
postfix: the optional postfix, fallbacks to .tmp on file creation
-
template: mkstemp like filename template, no default
-
dir: the optional temporary directory, fallbacks to system default (guesses from environment)
+
name: a fixed name that overrides random name generation, the name must be relative and must not contain path segments
+
mode: the file mode to create with, falls back to 0o600 on file creation and 0o700 on directory creation
+
prefix: the optional prefix, defaults to tmp
+
postfix: the optional postfix
+
template: mkstemp like filename template, no default, must include XXXXXX once for random name generation, e.g.
+'foo-bar-XXXXXX'.
+
dir: the optional temporary directory that must be relative to the system's default temporary directory.
+absolute paths are fine as long as they point to a location under the system's default temporary directory.
+Any directories along the so specified path must exist, otherwise a ENOENT error will be thrown upon access,
+as tmp will not check the availability of the path, nor will it establish the requested path for you.
+
tmpdir: allows you to override the system's root tmp directory
tries: how many times should the function try to get a unique filename before giving up, default 3
-
keep: signals that the temporary file or directory should not be deleted on exit, default is false, means delete
-
Please keep in mind that it is recommended in this case to call the provided cleanupCallback function manually.
+
keep: signals that the temporary file or directory should not be deleted on exit, default is false
+
+
In order to clean up, you will have to call the provided cleanupCallback function manually.
unsafeCleanup: recursively removes the created temporary directory, even when it's not empty. default is false
+
detachDescriptor: detaches the file descriptor, caller is responsible for closing the file, tmp will no longer try closing the file during garbage collection
+
discardDescriptor: discards the file descriptor (closes file, fd is -1), tmp will no longer try closing the file during garbage collection
@@ -218,13 +332,13 @@
Asynchronous filename generation
It is possible with this library to
diff --git a/docs/scripts/linenumber.js b/docs/scripts/linenumber.js
index 8d52f7e..4354785 100644
--- a/docs/scripts/linenumber.js
+++ b/docs/scripts/linenumber.js
@@ -1,12 +1,12 @@
/*global document */
-(function() {
- var source = document.getElementsByClassName('prettyprint source linenums');
- var i = 0;
- var lineNumber = 0;
- var lineId;
- var lines;
- var totalLines;
- var anchorHash;
+(() => {
+ const source = document.getElementsByClassName('prettyprint source linenums');
+ let i = 0;
+ let lineNumber = 0;
+ let lineId;
+ let lines;
+ let totalLines;
+ let anchorHash;
if (source && source[0]) {
anchorHash = document.location.hash.substring(1);
@@ -15,7 +15,7 @@
for (; i < totalLines; i++) {
lineNumber++;
- lineId = 'line' + lineNumber;
+ lineId = `line${lineNumber}`;
lines[i].id = lineId;
if (lineId === anchorHash) {
lines[i].className += ' selected';
diff --git a/docs/styles/jsdoc-default.css b/docs/styles/jsdoc-default.css
index ede1919..7d1729d 100644
--- a/docs/styles/jsdoc-default.css
+++ b/docs/styles/jsdoc-default.css
@@ -78,6 +78,10 @@ article dl {
margin-bottom: 40px;
}
+article img {
+ max-width: 100%;
+}
+
section
{
display: block;
@@ -218,8 +222,8 @@ thead tr
th { border-right: 1px solid #aaa; }
tr > th:last-child { border-right: 1px solid #ddd; }
-.ancestors { color: #999; }
-.ancestors a
+.ancestors, .attribs { color: #999; }
+.ancestors a, .attribs a
{
color: #999 !important;
text-decoration: none;
@@ -269,7 +273,7 @@ tr > th:last-child { border-right: 1px solid #ddd; }
margin: 0;
}
-.prettyprint
+.source
{
border: 1px solid #ddd;
width: 80%;
@@ -280,7 +284,7 @@ tr > th:last-child { border-right: 1px solid #ddd; }
width: inherit;
}
-.prettyprint code
+.source code
{
font-size: 100%;
line-height: 18px;
diff --git a/docs/tmp.js.html b/docs/tmp.js.html
index 7203f53..1e4eb63 100644
--- a/docs/tmp.js.html
+++ b/docs/tmp.js.html
@@ -29,7 +29,7 @@
* Module dependencies.
*/
const fs = require('fs');
+const os = require('os');
const path = require('path');
const crypto = require('crypto');
-const osTmpDir = require('os-tmpdir');
-const _c = process.binding('constants');
+const _c = { fs: fs.constants, os: os.constants };
/*
* The working inner variables.
*/
const
- /**
- * The temporary directory.
- * @type {string}
- */
- tmpDir = osTmpDir(),
-
// the random characters to choose from
RANDOM_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
@@ -62,106 +56,44 @@
Source: tmp.js
CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR),
+ // constants are off on the windows platform and will not match the actual errno codes
+ IS_WIN32 = os.platform() === 'win32',
EBADF = _c.EBADF || _c.os.errno.EBADF,
ENOENT = _c.ENOENT || _c.os.errno.ENOENT,
- DIR_MODE = 448 /* 0o700 */,
- FILE_MODE = 384 /* 0o600 */,
-
- // this will hold the objects need to be removed on exit
- _removeObjects = [];
-
-var
- _gracefulCleanup = false,
- _uncaughtException = false;
-
-/**
- * Random name generator based on crypto.
- * Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript
- *
- * @param {number} howMany
- * @returns {string} the generated random name
- * @private
- */
-function _randomChars(howMany) {
- var
- value = [],
- rnd = null;
+ DIR_MODE = 0o700 /* 448 */,
+ FILE_MODE = 0o600 /* 384 */,
- // make sure that we do not fail because we ran out of entropy
- try {
- rnd = crypto.randomBytes(howMany);
- } catch (e) {
- rnd = crypto.pseudoRandomBytes(howMany);
- }
+ EXIT = 'exit',
- for (var i = 0; i < howMany; i++) {
- value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);
- }
+ // this will hold the objects need to be removed on exit
+ _removeObjects = [],
- return value.join('');
-}
+ // API change in fs.rmdirSync leads to error when passing in a second parameter, e.g. the callback
+ FN_RMDIR_SYNC = fs.rmdirSync.bind(fs);
-/**
- * Checks whether the `obj` parameter is defined or not.
- *
- * @param {Object} obj
- * @returns {boolean} true if the object is undefined
- * @private
- */
-function _isUndefined(obj) {
- return typeof obj === 'undefined';
-}
+let
+ _gracefulCleanup = false;
/**
- * Parses the function arguments.
- *
- * This function helps to have optional arguments.
+ * Recursively remove a directory and its contents.
*
- * @param {(Options|Function)} options
+ * @param {string} dirPath path of directory to remove
* @param {Function} callback
- * @returns {Array} parsed arguments
* @private
*/
-function _parseArguments(options, callback) {
- if (typeof options == 'function') {
- var
- tmp = options,
- options = callback || {},
- callback = tmp;
- } else if (typeof options == 'undefined') {
- options = {};
- }
-
- return [options, callback];
+function rimraf(dirPath, callback) {
+ return fs.rm(dirPath, { recursive: true }, callback);
}
/**
- * Generates a new temporary name.
+ * Recursively remove a directory and its contents, synchronously.
*
- * @param {Object} opts
- * @returns {string} the new random name according to opts
+ * @param {string} dirPath path of directory to remove
* @private
*/
-function _generateTmpName(opts) {
- if (opts.name) {
- return path.join(opts.dir || tmpDir, opts.name);
- }
-
- // mkstemps like template
- if (opts.template) {
- return opts.template.replace(TEMPLATE_PATTERN, _randomChars(6));
- }
-
- // prefix and postfix
- const name = [
- opts.prefix || 'tmp-',
- process.pid,
- _randomChars(12),
- opts.postfix || ''
- ].join('');
-
- return path.join(opts.dir || tmpDir, name);
+function FN_RIMRAF_SYNC(dirPath) {
+ return fs.rmSync(dirPath, { recursive: true });
}
/**
@@ -171,31 +103,37 @@
Source: tmp.js
* @param {?tmpNameCallback} callback the callback function
*/
function tmpName(options, callback) {
- var
+ const
args = _parseArguments(options, callback),
opts = args[0],
- cb = args[1],
- tries = opts.tries || DEFAULT_TRIES;
-
- if (isNaN(tries) || tries < 0)
- return cb(new Error('Invalid tries'));
+ cb = args[1];
- if (opts.template && !opts.template.match(TEMPLATE_PATTERN))
- return cb(new Error('Invalid template provided'));
+ try {
+ _assertAndSanitizeOptions(opts);
+ } catch (err) {
+ return cb(err);
+ }
+ let tries = opts.tries;
(function _getUniqueName() {
- const name = _generateTmpName(opts);
+ try {
+ const name = _generateTmpName(opts);
- // check whether the path exists then retry if needed
- fs.stat(name, function (err) {
- if (!err) {
- if (tries-- > 0) return _getUniqueName();
+ // check whether the path exists then retry if needed
+ fs.stat(name, function (err) {
+ /* istanbul ignore else */
+ if (!err) {
+ /* istanbul ignore else */
+ if (tries-- > 0) return _getUniqueName();
- return cb(new Error('Could not get a unique tmp filename, max tries reached ' + name));
- }
+ return cb(new Error('Could not get a unique tmp filename, max tries reached ' + name));
+ }
- cb(null, name);
- });
+ cb(null, name);
+ });
+ } catch (err) {
+ cb(err);
+ }
}());
}
@@ -207,17 +145,13 @@
Source: tmp.js
* @throws {Error} if the options are invalid or could not generate a filename
*/
function tmpNameSync(options) {
- var
+ const
args = _parseArguments(options),
- opts = args[0],
- tries = opts.tries || DEFAULT_TRIES;
-
- if (isNaN(tries) || tries < 0)
- throw new Error('Invalid tries');
+ opts = args[0];
- if (opts.template && !opts.template.match(TEMPLATE_PATTERN))
- throw new Error('Invalid template provided');
+ _assertAndSanitizeOptions(opts);
+ let tries = opts.tries;
do {
const name = _generateTmpName(opts);
try {
@@ -233,46 +167,36 @@
Source: tmp.js
/**
* Creates and opens a temporary file.
*
- * @param {(Options|fileCallback)} options the config options or the callback function
+ * @param {(Options|null|undefined|fileCallback)} options the config options or the callback function or null or undefined
* @param {?fileCallback} callback
*/
function file(options, callback) {
- var
+ const
args = _parseArguments(options, callback),
opts = args[0],
cb = args[1];
- opts.postfix = (_isUndefined(opts.postfix)) ? '.tmp' : opts.postfix;
-
// gets a temporary filename
tmpName(opts, function _tmpNameCreated(err, name) {
+ /* istanbul ignore else */
if (err) return cb(err);
// create and open the file
fs.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err, fd) {
+ /* istanbu ignore else */
if (err) return cb(err);
if (opts.discardDescriptor) {
- return fs.close(fd, function _discardCallback(err) {
- if (err) {
- // Low probability, and the file exists, so this could be
- // ignored. If it isn't we certainly need to unlink the
- // file, and if that fails too its error is more
- // important.
- try {
- fs.unlinkSync(name);
- } catch (e) {
- err = e;
- }
- return cb(err);
- }
- cb(null, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts));
+ return fs.close(fd, function _discardCallback(possibleErr) {
+ // the chance of getting an error on close here is rather low and might occur in the most edgiest cases only
+ return cb(possibleErr, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts, false));
});
+ } else {
+ // detachDescriptor passes the descriptor whereas discardDescriptor closes it, either way, we no longer care
+ // about the descriptor
+ const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
+ cb(null, name, fd, _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts, false));
}
- if (opts.detachDescriptor) {
- return cb(null, name, fd, _prepareTmpFileRemoveCallback(name, -1, opts));
- }
- cb(null, name, fd, _prepareTmpFileRemoveCallback(name, fd, opts));
});
});
}
@@ -285,59 +209,26 @@
Source: tmp.js
* @throws {Error} if cannot create a file
*/
function fileSync(options) {
- var
+ const
args = _parseArguments(options),
opts = args[0];
- opts.postfix = opts.postfix || '.tmp';
-
+ const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
const name = tmpNameSync(opts);
- const fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
+ var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
+ /* istanbul ignore else */
+ if (opts.discardDescriptor) {
+ fs.closeSync(fd);
+ fd = undefined;
+ }
return {
name: name,
fd: fd,
- removeCallback: _prepareTmpFileRemoveCallback(name, fd, opts)
+ removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts, true)
};
}
-/**
- * Removes files and folders in a directory recursively.
- *
- * @param {string} root
- * @private
- */
-function _rmdirRecursiveSync(root) {
- const dirs = [root];
-
- do {
- var
- dir = dirs.pop(),
- deferred = false,
- files = fs.readdirSync(dir);
-
- for (var i = 0, length = files.length; i < length; i++) {
- var
- file = path.join(dir, files[i]),
- stat = fs.lstatSync(file); // lstat so we don't recurse into symlinked directories
-
- if (stat.isDirectory()) {
- if (!deferred) {
- deferred = true;
- dirs.push(dir);
- }
- dirs.push(file);
- } else {
- fs.unlinkSync(file);
- }
- }
-
- if (!deferred) {
- fs.rmdirSync(dir);
- }
- } while (dirs.length !== 0);
-}
-
/**
* Creates a temporary directory.
*
@@ -345,20 +236,22 @@
Source: tmp.js
* @param {?dirCallback} callback
*/
function dir(options, callback) {
- var
+ const
args = _parseArguments(options, callback),
opts = args[0],
cb = args[1];
// gets a temporary filename
tmpName(opts, function _tmpNameCreated(err, name) {
+ /* istanbul ignore else */
if (err) return cb(err);
// create the directory
fs.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err) {
+ /* istanbul ignore else */
if (err) return cb(err);
- cb(null, name, _prepareTmpDirRemoveCallback(name, opts));
+ cb(null, name, _prepareTmpDirRemoveCallback(name, opts, false));
});
});
}
@@ -371,7 +264,7 @@
Source: tmp.js
* @throws {Error} if it cannot create a directory
*/
function dirSync(options) {
- var
+ const
args = _parseArguments(options),
opts = args[0];
@@ -380,87 +273,138 @@
Source: tmp.js
return {
name: name,
- removeCallback: _prepareTmpDirRemoveCallback(name, opts)
+ removeCallback: _prepareTmpDirRemoveCallback(name, opts, true)
};
}
/**
- * Prepares the callback for removal of the temporary file.
+ * Removes files asynchronously.
*
- * @param {string} name the path of the file
- * @param {number} fd file descriptor
- * @param {Object} opts
- * @returns {fileCallback}
+ * @param {Object} fdPath
+ * @param {Function} next
+ * @private
+ */
+function _removeFileAsync(fdPath, next) {
+ const _handler = function (err) {
+ if (err && !_isENOENT(err)) {
+ // reraise any unanticipated error
+ return next(err);
+ }
+ next();
+ };
+
+ if (0 <= fdPath[0])
+ fs.close(fdPath[0], function () {
+ fs.unlink(fdPath[1], _handler);
+ });
+ else fs.unlink(fdPath[1], _handler);
+}
+
+/**
+ * Removes files synchronously.
+ *
+ * @param {Object} fdPath
* @private
*/
-function _prepareTmpFileRemoveCallback(name, fd, opts) {
- const removeCallback = _prepareRemoveCallback(function _removeCallback(fdPath) {
+function _removeFileSync(fdPath) {
+ let rethrownException = null;
+ try {
+ if (0 <= fdPath[0]) fs.closeSync(fdPath[0]);
+ } catch (e) {
+ // reraise any unanticipated error
+ if (!_isEBADF(e) && !_isENOENT(e)) throw e;
+ } finally {
try {
- if (0 <= fdPath[0]) {
- fs.closeSync(fdPath[0]);
- }
+ fs.unlinkSync(fdPath[1]);
}
catch (e) {
- // under some node/windows related circumstances, a temporary file
- // may have not be created as expected or the file was already closed
- // by the user, in which case we will simply ignore the error
- if (e.errno != -EBADF && e.errno != -ENOENT) {
- // reraise any unanticipated error
- throw e;
- }
+ // reraise any unanticipated error
+ if (!_isENOENT(e)) rethrownException = e;
}
- fs.unlinkSync(fdPath[1]);
- }, [fd, name]);
-
- if (!opts.keep) {
- _removeObjects.unshift(removeCallback);
}
+ if (rethrownException !== null) {
+ throw rethrownException;
+ }
+}
+
+/**
+ * Prepares the callback for removal of the temporary file.
+ *
+ * Returns either a sync callback or a async callback depending on whether
+ * fileSync or file was called, which is expressed by the sync parameter.
+ *
+ * @param {string} name the path of the file
+ * @param {number} fd file descriptor
+ * @param {Object} opts
+ * @param {boolean} sync
+ * @returns {fileCallback | fileCallbackSync}
+ * @private
+ */
+function _prepareTmpFileRemoveCallback(name, fd, opts, sync) {
+ const removeCallbackSync = _prepareRemoveCallback(_removeFileSync, [fd, name], sync);
+ const removeCallback = _prepareRemoveCallback(_removeFileAsync, [fd, name], sync, removeCallbackSync);
- return removeCallback;
+ if (!opts.keep) _removeObjects.unshift(removeCallbackSync);
+
+ return sync ? removeCallbackSync : removeCallback;
}
/**
* Prepares the callback for removal of the temporary directory.
*
+ * Returns either a sync callback or a async callback depending on whether
+ * tmpFileSync or tmpFile was called, which is expressed by the sync parameter.
+ *
* @param {string} name
* @param {Object} opts
+ * @param {boolean} sync
* @returns {Function} the callback
* @private
*/
-function _prepareTmpDirRemoveCallback(name, opts) {
- const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs.rmdirSync.bind(fs);
- const removeCallback = _prepareRemoveCallback(removeFunction, name);
-
- if (!opts.keep) {
- _removeObjects.unshift(removeCallback);
- }
-
- return removeCallback;
+function _prepareTmpDirRemoveCallback(name, opts, sync) {
+ const removeFunction = opts.unsafeCleanup ? rimraf : fs.rmdir.bind(fs);
+ const removeFunctionSync = opts.unsafeCleanup ? FN_RIMRAF_SYNC : FN_RMDIR_SYNC;
+ const removeCallbackSync = _prepareRemoveCallback(removeFunctionSync, name, sync);
+ const removeCallback = _prepareRemoveCallback(removeFunction, name, sync, removeCallbackSync);
+ if (!opts.keep) _removeObjects.unshift(removeCallbackSync);
+
+ return sync ? removeCallbackSync : removeCallback;
}
/**
* Creates a guarded function wrapping the removeFunction call.
*
+ * The cleanup callback is save to be called multiple times.
+ * Subsequent invocations will be ignored.
+ *
* @param {Function} removeFunction
- * @param {Object} arg
- * @returns {Function}
+ * @param {string} fileOrDirName
+ * @param {boolean} sync
+ * @param {cleanupCallbackSync?} cleanupCallbackSync
+ * @returns {cleanupCallback | cleanupCallbackSync}
* @private
*/
-function _prepareRemoveCallback(removeFunction, arg) {
- var called = false;
+function _prepareRemoveCallback(removeFunction, fileOrDirName, sync, cleanupCallbackSync) {
+ let called = false;
+ // if sync is true, the next parameter will be ignored
return function _cleanupCallback(next) {
+
+ /* istanbul ignore else */
if (!called) {
- const index = _removeObjects.indexOf(_cleanupCallback);
- if (index >= 0) {
- _removeObjects.splice(index, 1);
- }
+ // remove cleanupCallback from cache
+ const toRemove = cleanupCallbackSync || _cleanupCallback;
+ const index = _removeObjects.indexOf(toRemove);
+ /* istanbul ignore else */
+ if (index >= 0) _removeObjects.splice(index, 1);
called = true;
- removeFunction(arg);
+ if (sync || removeFunction === FN_RMDIR_SYNC || removeFunction === FN_RIMRAF_SYNC) {
+ return removeFunction(fileOrDirName);
+ } else {
+ return removeFunction(fileOrDirName, next || function() {});
+ }
}
-
- if (next) next(null);
};
}
@@ -470,64 +414,315 @@
Source: tmp.js
* @private
*/
function _garbageCollector() {
- if (_uncaughtException && !_gracefulCleanup) {
- return;
- }
+ /* istanbul ignore else */
+ if (!_gracefulCleanup) return;
// the function being called removes itself from _removeObjects,
// loop until _removeObjects is empty
while (_removeObjects.length) {
try {
- _removeObjects[0].call(null);
+ _removeObjects[0]();
} catch (e) {
// already removed?
}
}
}
+/**
+ * Random name generator based on crypto.
+ * Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript
+ *
+ * @param {number} howMany
+ * @returns {string} the generated random name
+ * @private
+ */
+function _randomChars(howMany) {
+ let
+ value = [],
+ rnd = null;
+
+ // make sure that we do not fail because we ran out of entropy
+ try {
+ rnd = crypto.randomBytes(howMany);
+ } catch (e) {
+ rnd = crypto.pseudoRandomBytes(howMany);
+ }
+
+ for (var i = 0; i < howMany; i++) {
+ value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);
+ }
+
+ return value.join('');
+}
+
+/**
+ * Helper which determines whether a string s is blank, that is undefined, or empty or null.
+ *
+ * @private
+ * @param {string} s
+ * @returns {Boolean} true whether the string s is blank, false otherwise
+ */
+function _isBlank(s) {
+ return s === null || _isUndefined(s) || !s.trim();
+}
+
+/**
+ * Checks whether the `obj` parameter is defined or not.
+ *
+ * @param {Object} obj
+ * @returns {boolean} true if the object is undefined
+ * @private
+ */
+function _isUndefined(obj) {
+ return typeof obj === 'undefined';
+}
+
+/**
+ * Parses the function arguments.
+ *
+ * This function helps to have optional arguments.
+ *
+ * @param {(Options|null|undefined|Function)} options
+ * @param {?Function} callback
+ * @returns {Array} parsed arguments
+ * @private
+ */
+function _parseArguments(options, callback) {
+ /* istanbul ignore else */
+ if (typeof options === 'function') {
+ return [{}, options];
+ }
+
+ /* istanbul ignore else */
+ if (_isUndefined(options)) {
+ return [{}, callback];
+ }
+
+ // copy options so we do not leak the changes we make internally
+ const actualOptions = {};
+ for (const key of Object.getOwnPropertyNames(options)) {
+ actualOptions[key] = options[key];
+ }
+
+ return [actualOptions, callback];
+}
+
+/**
+ * Generates a new temporary name.
+ *
+ * @param {Object} opts
+ * @returns {string} the new random name according to opts
+ * @private
+ */
+function _generateTmpName(opts) {
+
+ const tmpDir = opts.tmpdir;
+
+ /* istanbul ignore else */
+ if (!_isUndefined(opts.name))
+ return path.join(tmpDir, opts.dir, opts.name);
+
+ /* istanbul ignore else */
+ if (!_isUndefined(opts.template))
+ return path.join(tmpDir, opts.dir, opts.template).replace(TEMPLATE_PATTERN, _randomChars(6));
+
+ // prefix and postfix
+ const name = [
+ opts.prefix ? opts.prefix : 'tmp',
+ '-',
+ process.pid,
+ '-',
+ _randomChars(12),
+ opts.postfix ? '-' + opts.postfix : ''
+ ].join('');
+
+ return path.join(tmpDir, opts.dir, name);
+}
+
+/**
+ * Asserts whether the specified options are valid, also sanitizes options and provides sane defaults for missing
+ * options.
+ *
+ * @param {Options} options
+ * @private
+ */
+function _assertAndSanitizeOptions(options) {
+
+ options.tmpdir = _getTmpDir(options);
+
+ const tmpDir = options.tmpdir;
+
+ /* istanbul ignore else */
+ if (!_isUndefined(options.name))
+ _assertIsRelative(options.name, 'name', tmpDir);
+ /* istanbul ignore else */
+ if (!_isUndefined(options.dir))
+ _assertIsRelative(options.dir, 'dir', tmpDir);
+ /* istanbul ignore else */
+ if (!_isUndefined(options.template)) {
+ _assertIsRelative(options.template, 'template', tmpDir);
+ if (!options.template.match(TEMPLATE_PATTERN))
+ throw new Error(`Invalid template, found "${options.template}".`);
+ }
+ /* istanbul ignore else */
+ if (!_isUndefined(options.tries) && isNaN(options.tries) || options.tries < 0)
+ throw new Error(`Invalid tries, found "${options.tries}".`);
+
+ // if a name was specified we will try once
+ options.tries = _isUndefined(options.name) ? options.tries || DEFAULT_TRIES : 1;
+ options.keep = !!options.keep;
+ options.detachDescriptor = !!options.detachDescriptor;
+ options.discardDescriptor = !!options.discardDescriptor;
+ options.unsafeCleanup = !!options.unsafeCleanup;
+
+ // sanitize dir, also keep (multiple) blanks if the user, purportedly sane, requests us to
+ options.dir = _isUndefined(options.dir) ? '' : path.relative(tmpDir, _resolvePath(options.dir, tmpDir));
+ options.template = _isUndefined(options.template) ? undefined : path.relative(tmpDir, _resolvePath(options.template, tmpDir));
+ // sanitize further if template is relative to options.dir
+ options.template = _isBlank(options.template) ? undefined : path.relative(options.dir, options.template);
+
+ // for completeness' sake only, also keep (multiple) blanks if the user, purportedly sane, requests us to
+ options.name = _isUndefined(options.name) ? undefined : options.name;
+ options.prefix = _isUndefined(options.prefix) ? '' : options.prefix;
+ options.postfix = _isUndefined(options.postfix) ? '' : options.postfix;
+}
+
+/**
+ * Resolve the specified path name in respect to tmpDir.
+ *
+ * The specified name might include relative path components, e.g. ../
+ * so we need to resolve in order to be sure that is is located inside tmpDir
+ *
+ * @param name
+ * @param tmpDir
+ * @returns {string}
+ * @private
+ */
+function _resolvePath(name, tmpDir) {
+ if (name.startsWith(tmpDir)) {
+ return path.resolve(name);
+ } else {
+ return path.resolve(path.join(tmpDir, name));
+ }
+}
+
+/**
+ * Asserts whether specified name is relative to the specified tmpDir.
+ *
+ * @param {string} name
+ * @param {string} option
+ * @param {string} tmpDir
+ * @throws {Error}
+ * @private
+ */
+function _assertIsRelative(name, option, tmpDir) {
+ if (option === 'name') {
+ // assert that name is not absolute and does not contain a path
+ if (path.isAbsolute(name))
+ throw new Error(`${option} option must not contain an absolute path, found "${name}".`);
+ // must not fail on valid .<name> or ..<name> or similar such constructs
+ let basename = path.basename(name);
+ if (basename === '..' || basename === '.' || basename !== name)
+ throw new Error(`${option} option must not contain a path, found "${name}".`);
+ }
+ else { // if (option === 'dir' || option === 'template') {
+ // assert that dir or template are relative to tmpDir
+ if (path.isAbsolute(name) && !name.startsWith(tmpDir)) {
+ throw new Error(`${option} option must be relative to "${tmpDir}", found "${name}".`);
+ }
+ let resolvedPath = _resolvePath(name, tmpDir);
+ if (!resolvedPath.startsWith(tmpDir))
+ throw new Error(`${option} option must be relative to "${tmpDir}", found "${resolvedPath}".`);
+ }
+}
+
+/**
+ * Helper for testing against EBADF to compensate changes made to Node 7.x under Windows.
+ *
+ * @private
+ */
+function _isEBADF(error) {
+ return _isExpectedError(error, -EBADF, 'EBADF');
+}
+
+/**
+ * Helper for testing against ENOENT to compensate changes made to Node 7.x under Windows.
+ *
+ * @private
+ */
+function _isENOENT(error) {
+ return _isExpectedError(error, -ENOENT, 'ENOENT');
+}
+
+/**
+ * Helper to determine whether the expected error code matches the actual code and errno,
+ * which will differ between the supported node versions.
+ *
+ * - Node >= 7.0:
+ * error.code {string}
+ * error.errno {number} any numerical value will be negated
+ *
+ * CAVEAT
+ *
+ * On windows, the errno for EBADF is -4083 but os.constants.errno.EBADF is different and we must assume that ENOENT
+ * is no different here.
+ *
+ * @param {SystemError} error
+ * @param {number} errno
+ * @param {string} code
+ * @private
+ */
+function _isExpectedError(error, errno, code) {
+ return IS_WIN32 ? error.code === code : error.code === code && error.errno === errno;
+}
+
/**
* Sets the graceful cleanup.
*
- * Also removes the created files and directories when an uncaught exception occurs.
+ * If graceful cleanup is set, tmp will remove all controlled temporary objects on process exit, otherwise the
+ * temporary objects will remain in place, waiting to be cleaned up on system restart or otherwise scheduled temporary
+ * object removals.
*/
function setGracefulCleanup() {
_gracefulCleanup = true;
}
-const version = process.versions.node.split('.').map(function (value) {
- return parseInt(value, 10);
-});
-
-if (version[0] === 0 && (version[1] < 9 || version[1] === 9 && version[2] < 5)) {
- process.addListener('uncaughtException', function _uncaughtExceptionThrown(err) {
- _uncaughtException = true;
- _garbageCollector();
-
- throw err;
- });
+/**
+ * Returns the currently configured tmp dir from os.tmpdir().
+ *
+ * @private
+ * @param {?Options} options
+ * @returns {string} the currently configured tmp dir
+ */
+function _getTmpDir(options) {
+ return path.resolve(options && options.tmpdir || os.tmpdir());
}
-process.addListener('exit', function _exit(code) {
- if (code) _uncaughtException = true;
- _garbageCollector();
-});
+// Install process exit listener
+process.addListener(EXIT, _garbageCollector);
/**
* Configuration options.
*
* @typedef {Object} Options
+ * @property {?boolean} keep the temporary object (file or dir) will not be garbage collected
* @property {?number} tries the number of tries before give up the name generation
+ * @property (?int) mode the access mode, defaults are 0o700 for directories and 0o600 for files
* @property {?string} template the "mkstemp" like filename template
- * @property {?string} name fix name
- * @property {?string} dir the tmp directory to use
+ * @property {?string} name fixed name relative to tmpdir or the specified dir option
+ * @property {?string} dir tmp directory relative to the root tmp directory in use
* @property {?string} prefix prefix for the generated name
* @property {?string} postfix postfix for the generated name
+ * @property {?string} tmpdir the root tmp directory which overrides the os tmpdir
+ * @property {?boolean} unsafeCleanup recursively removes the created temporary directory, even when it's not empty
+ * @property {?boolean} detachDescriptor detaches the file descriptor, caller is responsible for closing the file, tmp will no longer try closing the file during garbage collection
+ * @property {?boolean} discardDescriptor discards the file descriptor (closes file, fd is -1), tmp will no longer try closing the file during garbage collection
*/
/**
* @typedef {Object} FileSyncObject
* @property {string} name the name of the file
- * @property {string} fd the file descriptor
+ * @property {string} fd the file descriptor or -1 if the fd has been discarded
* @property {fileCallback} removeCallback the callback function to remove the file
*/
@@ -547,10 +742,18 @@
Source: tmp.js
* @callback fileCallback
* @param {?Error} err the error object if anything goes wrong
* @param {string} name the temporary file name
- * @param {number} fd the file descriptor
+ * @param {number} fd the file descriptor or -1 if the fd had been discarded
* @param {cleanupCallback} fn the cleanup callback function
*/
+/**
+ * @callback fileCallbackSync
+ * @param {?Error} err the error object if anything goes wrong
+ * @param {string} name the temporary file name
+ * @param {number} fd the file descriptor or -1 if the fd had been discarded
+ * @param {cleanupCallbackSync} fn the cleanup callback function
+ */
+
/**
* @callback dirCallback
* @param {?Error} err the error object if anything goes wrong
@@ -558,11 +761,24 @@
Source: tmp.js
* @param {cleanupCallback} fn the cleanup callback function
*/
+/**
+ * @callback dirCallbackSync
+ * @param {?Error} err the error object if anything goes wrong
+ * @param {string} name the temporary file name
+ * @param {cleanupCallbackSync} fn the cleanup callback function
+ */
+
/**
* Removes the temporary created file or directory.
*
* @callback cleanupCallback
- * @param {simpleCallback} [next] function to call after entry was removed
+ * @param {simpleCallback} [next] function to call whenever the tmp object needs to be removed
+ */
+
+/**
+ * Removes the temporary created file or directory.
+ *
+ * @callback cleanupCallbackSync
*/
/**
@@ -573,7 +789,16 @@
Source: tmp.js
*/
// exporting all the needed methods
-module.exports.tmpdir = tmpDir;
+
+// evaluate _getTmpDir() lazily, mainly for simplifying testing but it also will
+// allow users to reconfigure the temporary directory
+Object.defineProperty(module.exports, 'tmpdir', {
+ enumerable: true,
+ configurable: false,
+ get: function () {
+ return _getTmpDir();
+ }
+});
module.exports.dir = dir;
module.exports.dirSync = dirSync;
@@ -595,13 +820,13 @@
Source: tmp.js
diff --git a/lib/tmp.js b/lib/tmp.js
index 41b83db..162dca1 100644
--- a/lib/tmp.js
+++ b/lib/tmp.js
@@ -10,129 +10,52 @@
* Module dependencies.
*/
const fs = require('fs');
+const os = require('os');
const path = require('path');
const crypto = require('crypto');
-const osTmpDir = require('os-tmpdir');
-const _c = process.binding('constants');
+const _c = { fs: fs.constants, os: os.constants };
/*
* The working inner variables.
*/
-const
- /**
- * The temporary directory.
- * @type {string}
- */
- tmpDir = osTmpDir(),
-
- // the random characters to choose from
+const // the random characters to choose from
RANDOM_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
-
TEMPLATE_PATTERN = /XXXXXX/,
-
DEFAULT_TRIES = 3,
-
CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR),
-
+ // constants are off on the windows platform and will not match the actual errno codes
+ IS_WIN32 = os.platform() === 'win32',
EBADF = _c.EBADF || _c.os.errno.EBADF,
ENOENT = _c.ENOENT || _c.os.errno.ENOENT,
-
- DIR_MODE = 448 /* 0o700 */,
- FILE_MODE = 384 /* 0o600 */,
-
+ DIR_MODE = 0o700 /* 448 */,
+ FILE_MODE = 0o600 /* 384 */,
+ EXIT = 'exit',
// this will hold the objects need to be removed on exit
- _removeObjects = [];
+ _removeObjects = [],
+ // API change in fs.rmdirSync leads to error when passing in a second parameter, e.g. the callback
+ FN_RMDIR_SYNC = fs.rmdirSync.bind(fs);
-var
- _gracefulCleanup = false,
- _uncaughtException = false;
+let _gracefulCleanup = false;
/**
- * Random name generator based on crypto.
- * Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript
- *
- * @param {number} howMany
- * @returns {string} the generated random name
- * @private
- */
-function _randomChars(howMany) {
- var
- value = [],
- rnd = null;
-
- // make sure that we do not fail because we ran out of entropy
- try {
- rnd = crypto.randomBytes(howMany);
- } catch (e) {
- rnd = crypto.pseudoRandomBytes(howMany);
- }
-
- for (var i = 0; i < howMany; i++) {
- value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);
- }
-
- return value.join('');
-}
-
-/**
- * Checks whether the `obj` parameter is defined or not.
- *
- * @param {Object} obj
- * @returns {boolean} true if the object is undefined
- * @private
- */
-function _isUndefined(obj) {
- return typeof obj === 'undefined';
-}
-
-/**
- * Parses the function arguments.
+ * Recursively remove a directory and its contents.
*
- * This function helps to have optional arguments.
- *
- * @param {(Options|Function)} options
+ * @param {string} dirPath path of directory to remove
* @param {Function} callback
- * @returns {Array} parsed arguments
* @private
*/
-function _parseArguments(options, callback) {
- if (typeof options == 'function') {
- return [callback || {}, options];
- }
-
- if (_isUndefined(options)) {
- return [{}, callback];
- }
-
- return [options, callback];
+function rimraf(dirPath, callback) {
+ return fs.rm(dirPath, { recursive: true }, callback);
}
/**
- * Generates a new temporary name.
+ * Recursively remove a directory and its contents, synchronously.
*
- * @param {Object} opts
- * @returns {string} the new random name according to opts
+ * @param {string} dirPath path of directory to remove
* @private
*/
-function _generateTmpName(opts) {
- if (opts.name) {
- return path.join(opts.dir || tmpDir, opts.name);
- }
-
- // mkstemps like template
- if (opts.template) {
- return opts.template.replace(TEMPLATE_PATTERN, _randomChars(6));
- }
-
- // prefix and postfix
- const name = [
- opts.prefix || 'tmp-',
- process.pid,
- _randomChars(12),
- opts.postfix || ''
- ].join('');
-
- return path.join(opts.dir || tmpDir, name);
+function FN_RIMRAF_SYNC(dirPath) {
+ return fs.rmSync(dirPath, { recursive: true });
}
/**
@@ -142,32 +65,35 @@ function _generateTmpName(opts) {
* @param {?tmpNameCallback} callback the callback function
*/
function tmpName(options, callback) {
- var
- args = _parseArguments(options, callback),
+ const args = _parseArguments(options, callback),
opts = args[0],
- cb = args[1],
- tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;
+ cb = args[1];
- if (isNaN(tries) || tries < 0)
- return cb(new Error('Invalid tries'));
+ _assertAndSanitizeOptions(opts, function (err, sanitizedOptions) {
+ if (err) return cb(err);
- if (opts.template && !opts.template.match(TEMPLATE_PATTERN))
- return cb(new Error('Invalid template provided'));
+ let tries = sanitizedOptions.tries;
+ (function _getUniqueName() {
+ try {
+ const name = _generateTmpName(sanitizedOptions);
- (function _getUniqueName() {
- const name = _generateTmpName(opts);
+ // check whether the path exists then retry if needed
+ fs.stat(name, function (err) {
+ /* istanbul ignore else */
+ if (!err) {
+ /* istanbul ignore else */
+ if (tries-- > 0) return _getUniqueName();
- // check whether the path exists then retry if needed
- fs.stat(name, function (err) {
- if (!err) {
- if (tries-- > 0) return _getUniqueName();
+ return cb(new Error('Could not get a unique tmp filename, max tries reached ' + name));
+ }
- return cb(new Error('Could not get a unique tmp filename, max tries reached ' + name));
+ cb(null, name);
+ });
+ } catch (err) {
+ cb(err);
}
-
- cb(null, name);
- });
- }());
+ })();
+ });
}
/**
@@ -178,19 +104,14 @@ function tmpName(options, callback) {
* @throws {Error} if the options are invalid or could not generate a filename
*/
function tmpNameSync(options) {
- var
- args = _parseArguments(options),
- opts = args[0],
- tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;
-
- if (isNaN(tries) || tries < 0)
- throw new Error('Invalid tries');
+ const args = _parseArguments(options),
+ opts = args[0];
- if (opts.template && !opts.template.match(TEMPLATE_PATTERN))
- throw new Error('Invalid template provided');
+ const sanitizedOptions = _assertAndSanitizeOptionsSync(opts);
+ let tries = sanitizedOptions.tries;
do {
- const name = _generateTmpName(opts);
+ const name = _generateTmpName(sanitizedOptions);
try {
fs.statSync(name);
} catch (e) {
@@ -204,48 +125,35 @@ function tmpNameSync(options) {
/**
* Creates and opens a temporary file.
*
- * @param {(Options|fileCallback)} options the config options or the callback function
+ * @param {(Options|null|undefined|fileCallback)} options the config options or the callback function or null or undefined
* @param {?fileCallback} callback
*/
function file(options, callback) {
- var
- args = _parseArguments(options, callback),
+ const args = _parseArguments(options, callback),
opts = args[0],
cb = args[1];
- opts.postfix = (_isUndefined(opts.postfix)) ? '.tmp' : opts.postfix;
-
// gets a temporary filename
tmpName(opts, function _tmpNameCreated(err, name) {
+ /* istanbul ignore else */
if (err) return cb(err);
// create and open the file
fs.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err, fd) {
+ /* istanbu ignore else */
if (err) return cb(err);
if (opts.discardDescriptor) {
- return fs.close(fd, function _discardCallback(err) {
- if (err) {
- // Low probability, and the file exists, so this could be
- // ignored. If it isn't we certainly need to unlink the
- // file, and if that fails too its error is more
- // important.
- try {
- fs.unlinkSync(name);
- } catch (e) {
- if (!isENOENT(e)) {
- err = e;
- }
- }
- return cb(err);
- }
- cb(null, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts));
+ return fs.close(fd, function _discardCallback(possibleErr) {
+ // the chance of getting an error on close here is rather low and might occur in the most edgiest cases only
+ return cb(possibleErr, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts, false));
});
+ } else {
+ // detachDescriptor passes the descriptor whereas discardDescriptor closes it, either way, we no longer care
+ // about the descriptor
+ const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
+ cb(null, name, fd, _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts, false));
}
- if (opts.detachDescriptor) {
- return cb(null, name, fd, _prepareTmpFileRemoveCallback(name, -1, opts));
- }
- cb(null, name, fd, _prepareTmpFileRemoveCallback(name, fd, opts));
});
});
}
@@ -258,64 +166,25 @@ function file(options, callback) {
* @throws {Error} if cannot create a file
*/
function fileSync(options) {
- var
- args = _parseArguments(options),
+ const args = _parseArguments(options),
opts = args[0];
- opts.postfix = opts.postfix || '.tmp';
-
const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
const name = tmpNameSync(opts);
- var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
+ let fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
+ /* istanbul ignore else */
if (opts.discardDescriptor) {
- fs.closeSync(fd);
+ fs.closeSync(fd);
fd = undefined;
}
return {
name: name,
fd: fd,
- removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts)
+ removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts, true)
};
}
-/**
- * Removes files and folders in a directory recursively.
- *
- * @param {string} root
- * @private
- */
-function _rmdirRecursiveSync(root) {
- const dirs = [root];
-
- do {
- var
- dir = dirs.pop(),
- deferred = false,
- files = fs.readdirSync(dir);
-
- for (var i = 0, length = files.length; i < length; i++) {
- var
- file = path.join(dir, files[i]),
- stat = fs.lstatSync(file); // lstat so we don't recurse into symlinked directories
-
- if (stat.isDirectory()) {
- if (!deferred) {
- deferred = true;
- dirs.push(dir);
- }
- dirs.push(file);
- } else {
- fs.unlinkSync(file);
- }
- }
-
- if (!deferred) {
- fs.rmdirSync(dir);
- }
- } while (dirs.length !== 0);
-}
-
/**
* Creates a temporary directory.
*
@@ -323,20 +192,21 @@ function _rmdirRecursiveSync(root) {
* @param {?dirCallback} callback
*/
function dir(options, callback) {
- var
- args = _parseArguments(options, callback),
+ const args = _parseArguments(options, callback),
opts = args[0],
cb = args[1];
// gets a temporary filename
tmpName(opts, function _tmpNameCreated(err, name) {
+ /* istanbul ignore else */
if (err) return cb(err);
// create the directory
fs.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err) {
+ /* istanbul ignore else */
if (err) return cb(err);
- cb(null, name, _prepareTmpDirRemoveCallback(name, opts));
+ cb(null, name, _prepareTmpDirRemoveCallback(name, opts, false));
});
});
}
@@ -349,8 +219,7 @@ function dir(options, callback) {
* @throws {Error} if it cannot create a directory
*/
function dirSync(options) {
- var
- args = _parseArguments(options),
+ const args = _parseArguments(options),
opts = args[0];
const name = tmpNameSync(opts);
@@ -358,95 +227,136 @@ function dirSync(options) {
return {
name: name,
- removeCallback: _prepareTmpDirRemoveCallback(name, opts)
+ removeCallback: _prepareTmpDirRemoveCallback(name, opts, true)
};
}
/**
- * Prepares the callback for removal of the temporary file.
+ * Removes files asynchronously.
*
- * @param {string} name the path of the file
- * @param {number} fd file descriptor
- * @param {Object} opts
- * @returns {fileCallback}
+ * @param {Object} fdPath
+ * @param {Function} next
* @private
*/
-function _prepareTmpFileRemoveCallback(name, fd, opts) {
- const removeCallback = _prepareRemoveCallback(function _removeCallback(fdPath) {
- try {
- if (0 <= fdPath[0]) {
- fs.closeSync(fdPath[0]);
- }
- }
- catch (e) {
- // under some node/windows related circumstances, a temporary file
- // may have not be created as expected or the file was already closed
- // by the user, in which case we will simply ignore the error
- if (!isEBADF(e) && !isENOENT(e)) {
- // reraise any unanticipated error
- throw e;
- }
+function _removeFileAsync(fdPath, next) {
+ const _handler = function (err) {
+ if (err && !_isENOENT(err)) {
+ // reraise any unanticipated error
+ return next(err);
}
+ next();
+ };
+
+ if (0 <= fdPath[0])
+ fs.close(fdPath[0], function () {
+ fs.unlink(fdPath[1], _handler);
+ });
+ else fs.unlink(fdPath[1], _handler);
+}
+
+/**
+ * Removes files synchronously.
+ *
+ * @param {Object} fdPath
+ * @private
+ */
+function _removeFileSync(fdPath) {
+ let rethrownException = null;
+ try {
+ if (0 <= fdPath[0]) fs.closeSync(fdPath[0]);
+ } catch (e) {
+ // reraise any unanticipated error
+ if (!_isEBADF(e) && !_isENOENT(e)) throw e;
+ } finally {
try {
fs.unlinkSync(fdPath[1]);
+ } catch (e) {
+ // reraise any unanticipated error
+ if (!_isENOENT(e)) rethrownException = e;
}
- catch (e) {
- if (!isENOENT(e)) {
- // reraise any unanticipated error
- throw e;
- }
- }
- }, [fd, name]);
-
- if (!opts.keep) {
- _removeObjects.unshift(removeCallback);
}
+ if (rethrownException !== null) {
+ throw rethrownException;
+ }
+}
- return removeCallback;
+/**
+ * Prepares the callback for removal of the temporary file.
+ *
+ * Returns either a sync callback or a async callback depending on whether
+ * fileSync or file was called, which is expressed by the sync parameter.
+ *
+ * @param {string} name the path of the file
+ * @param {number} fd file descriptor
+ * @param {Object} opts
+ * @param {boolean} sync
+ * @returns {fileCallback | fileCallbackSync}
+ * @private
+ */
+function _prepareTmpFileRemoveCallback(name, fd, opts, sync) {
+ const removeCallbackSync = _prepareRemoveCallback(_removeFileSync, [fd, name], sync);
+ const removeCallback = _prepareRemoveCallback(_removeFileAsync, [fd, name], sync, removeCallbackSync);
+
+ if (!opts.keep) _removeObjects.unshift(removeCallbackSync);
+
+ return sync ? removeCallbackSync : removeCallback;
}
/**
* Prepares the callback for removal of the temporary directory.
*
+ * Returns either a sync callback or a async callback depending on whether
+ * tmpFileSync or tmpFile was called, which is expressed by the sync parameter.
+ *
* @param {string} name
* @param {Object} opts
+ * @param {boolean} sync
* @returns {Function} the callback
* @private
*/
-function _prepareTmpDirRemoveCallback(name, opts) {
- const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs.rmdirSync.bind(fs);
- const removeCallback = _prepareRemoveCallback(removeFunction, name);
-
- if (!opts.keep) {
- _removeObjects.unshift(removeCallback);
- }
-
- return removeCallback;
+function _prepareTmpDirRemoveCallback(name, opts, sync) {
+ const removeFunction = opts.unsafeCleanup ? rimraf : fs.rmdir.bind(fs);
+ const removeFunctionSync = opts.unsafeCleanup ? FN_RIMRAF_SYNC : FN_RMDIR_SYNC;
+ const removeCallbackSync = _prepareRemoveCallback(removeFunctionSync, name, sync);
+ const removeCallback = _prepareRemoveCallback(removeFunction, name, sync, removeCallbackSync);
+ if (!opts.keep) _removeObjects.unshift(removeCallbackSync);
+
+ return sync ? removeCallbackSync : removeCallback;
}
/**
* Creates a guarded function wrapping the removeFunction call.
*
+ * The cleanup callback is save to be called multiple times.
+ * Subsequent invocations will be ignored.
+ *
* @param {Function} removeFunction
- * @param {Object} arg
- * @returns {Function}
+ * @param {string} fileOrDirName
+ * @param {boolean} sync
+ * @param {cleanupCallbackSync?} cleanupCallbackSync
+ * @returns {cleanupCallback | cleanupCallbackSync}
* @private
*/
-function _prepareRemoveCallback(removeFunction, arg) {
- var called = false;
+function _prepareRemoveCallback(removeFunction, fileOrDirName, sync, cleanupCallbackSync) {
+ let called = false;
+ // if sync is true, the next parameter will be ignored
return function _cleanupCallback(next) {
+ /* istanbul ignore else */
if (!called) {
- const index = _removeObjects.indexOf(_cleanupCallback);
- if (index >= 0) {
- _removeObjects.splice(index, 1);
- }
+ // remove cleanupCallback from cache
+ const toRemove = cleanupCallbackSync || _cleanupCallback;
+ const index = _removeObjects.indexOf(toRemove);
+ /* istanbul ignore else */
+ if (index >= 0) _removeObjects.splice(index, 1);
called = true;
- removeFunction(arg);
+ if (sync || removeFunction === FN_RMDIR_SYNC || removeFunction === FN_RIMRAF_SYNC) {
+ return removeFunction(fileOrDirName);
+ } else {
+ return removeFunction(fileOrDirName, next || function () {});
+ }
}
-
- if (next) next(null);
};
}
@@ -456,33 +366,315 @@ function _prepareRemoveCallback(removeFunction, arg) {
* @private
*/
function _garbageCollector() {
- if (_uncaughtException && !_gracefulCleanup) {
- return;
- }
+ /* istanbul ignore else */
+ if (!_gracefulCleanup) return;
// the function being called removes itself from _removeObjects,
// loop until _removeObjects is empty
while (_removeObjects.length) {
try {
- _removeObjects[0].call(null);
+ _removeObjects[0]();
} catch (e) {
// already removed?
}
}
}
+/**
+ * Random name generator based on crypto.
+ * Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript
+ *
+ * @param {number} howMany
+ * @returns {string} the generated random name
+ * @private
+ */
+function _randomChars(howMany) {
+ let value = [],
+ rnd = null;
+
+ // make sure that we do not fail because we ran out of entropy
+ try {
+ rnd = crypto.randomBytes(howMany);
+ } catch (e) {
+ rnd = crypto.pseudoRandomBytes(howMany);
+ }
+
+ for (let i = 0; i < howMany; i++) {
+ value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);
+ }
+
+ return value.join('');
+}
+
+/**
+ * Checks whether the `obj` parameter is defined or not.
+ *
+ * @param {Object} obj
+ * @returns {boolean} true if the object is undefined
+ * @private
+ */
+function _isUndefined(obj) {
+ return typeof obj === 'undefined';
+}
+
+/**
+ * Parses the function arguments.
+ *
+ * This function helps to have optional arguments.
+ *
+ * @param {(Options|null|undefined|Function)} options
+ * @param {?Function} callback
+ * @returns {Array} parsed arguments
+ * @private
+ */
+function _parseArguments(options, callback) {
+ /* istanbul ignore else */
+ if (typeof options === 'function') {
+ return [{}, options];
+ }
+
+ /* istanbul ignore else */
+ if (_isUndefined(options)) {
+ return [{}, callback];
+ }
+
+ // copy options so we do not leak the changes we make internally
+ const actualOptions = {};
+ for (const key of Object.getOwnPropertyNames(options)) {
+ actualOptions[key] = options[key];
+ }
+
+ return [actualOptions, callback];
+}
+
+/**
+ * Resolve the specified path name in respect to tmpDir.
+ *
+ * The specified name might include relative path components, e.g. ../
+ * so we need to resolve in order to be sure that is is located inside tmpDir
+ *
+ * @private
+ */
+function _resolvePath(name, tmpDir, cb) {
+ const pathToResolve = path.isAbsolute(name) ? name : path.join(tmpDir, name);
+
+ fs.stat(pathToResolve, function (err) {
+ if (err) {
+ fs.realpath(path.dirname(pathToResolve), function (err, parentDir) {
+ if (err) return cb(err);
+
+ cb(null, path.join(parentDir, path.basename(pathToResolve)));
+ });
+ } else {
+ fs.realpath(path, cb);
+ }
+ });
+}
+
+/**
+ * Resolve the specified path name in respect to tmpDir.
+ *
+ * The specified name might include relative path components, e.g. ../
+ * so we need to resolve in order to be sure that is is located inside tmpDir
+ *
+ * @private
+ */
+function _resolvePathSync(name, tmpDir) {
+ const pathToResolve = path.isAbsolute(name) ? name : path.join(tmpDir, name);
+
+ try {
+ fs.statSync(pathToResolve);
+ return fs.realpathSync(pathToResolve);
+ } catch (_err) {
+ const parentDir = fs.realpathSync(path.dirname(pathToResolve));
+
+ return path.join(parentDir, path.basename(pathToResolve));
+ }
+}
+
+/**
+ * Generates a new temporary name.
+ *
+ * @param {Object} opts
+ * @returns {string} the new random name according to opts
+ * @private
+ */
+function _generateTmpName(opts) {
+ const tmpDir = opts.tmpdir;
+
+ /* istanbul ignore else */
+ if (!_isUndefined(opts.name)) {
+ return path.join(tmpDir, opts.dir, opts.name);
+ }
+
+ /* istanbul ignore else */
+ if (!_isUndefined(opts.template)) {
+ return path.join(tmpDir, opts.dir, opts.template).replace(TEMPLATE_PATTERN, _randomChars(6));
+ }
+
+ // prefix and postfix
+ const name = [
+ opts.prefix ? opts.prefix : 'tmp',
+ '-',
+ process.pid,
+ '-',
+ _randomChars(12),
+ opts.postfix ? '-' + opts.postfix : ''
+ ].join('');
+
+ return path.join(tmpDir, opts.dir, name);
+}
+
+/**
+ * Asserts and sanitizes the basic options.
+ *
+ * @private
+ */
+function _assertOptionsBase(options) {
+ if (!_isUndefined(options.name)) {
+ const name = options.name;
+
+ // assert that name is not absolute and does not contain a path
+ if (path.isAbsolute(name)) throw new Error(`name option must not contain an absolute path, found "${name}".`);
+
+ // must not fail on valid . or .. or similar such constructs
+ const basename = path.basename(name);
+ if (basename === '..' || basename === '.' || basename !== name)
+ throw new Error(`name option must not contain a path, found "${name}".`);
+ }
+
+ /* istanbul ignore else */
+ if (!_isUndefined(options.template) && !options.template.match(TEMPLATE_PATTERN)) {
+ throw new Error(`Invalid template, found "${options.template}".`);
+ }
+
+ /* istanbul ignore else */
+ if ((!_isUndefined(options.tries) && isNaN(options.tries)) || options.tries < 0) {
+ throw new Error(`Invalid tries, found "${options.tries}".`);
+ }
+
+ // if a name was specified we will try once
+ options.tries = _isUndefined(options.name) ? options.tries || DEFAULT_TRIES : 1;
+ options.keep = !!options.keep;
+ options.detachDescriptor = !!options.detachDescriptor;
+ options.discardDescriptor = !!options.discardDescriptor;
+ options.unsafeCleanup = !!options.unsafeCleanup;
+
+ // for completeness' sake only, also keep (multiple) blanks if the user, purportedly sane, requests us to
+ options.prefix = _isUndefined(options.prefix) ? '' : options.prefix;
+ options.postfix = _isUndefined(options.postfix) ? '' : options.postfix;
+}
+
+/**
+ * Gets the relative directory to tmpDir.
+ *
+ * @private
+ */
+function _getRelativePath(option, name, tmpDir, cb) {
+ if (_isUndefined(name)) return cb(null);
+
+ _resolvePath(name, tmpDir, function (err, resolvedPath) {
+ if (err) return cb(err);
+
+ const relativePath = path.relative(tmpDir, resolvedPath);
+
+ if (!resolvedPath.startsWith(tmpDir)) {
+ return cb(new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`));
+ }
+
+ cb(null, relativePath);
+ });
+}
+
+/**
+ * Gets the relative path to tmpDir.
+ *
+ * @private
+ */
+function _getRelativePathSync(option, name, tmpDir) {
+ if (_isUndefined(name)) return;
+
+ const resolvedPath = _resolvePathSync(name, tmpDir);
+ const relativePath = path.relative(tmpDir, resolvedPath);
+
+ if (!resolvedPath.startsWith(tmpDir)) {
+ throw new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`);
+ }
+
+ return relativePath;
+}
+
+/**
+ * Asserts whether the specified options are valid, also sanitizes options and provides sane defaults for missing
+ * options.
+ *
+ * @private
+ */
+function _assertAndSanitizeOptions(options, cb) {
+ _getTmpDir(options, function (err, tmpDir) {
+ if (err) return cb(err);
+
+ options.tmpdir = tmpDir;
+
+ try {
+ _assertOptionsBase(options, tmpDir);
+ } catch (err) {
+ return cb(err);
+ }
+
+ // sanitize dir, also keep (multiple) blanks if the user, purportedly sane, requests us to
+ _getRelativePath('dir', options.dir, tmpDir, function (err, dir) {
+ if (err) return cb(err);
+
+ options.dir = _isUndefined(dir) ? '' : dir;
+
+ // sanitize further if template is relative to options.dir
+ _getRelativePath('template', options.template, tmpDir, function (err, template) {
+ if (err) return cb(err);
+
+ options.template = template;
+
+ cb(null, options);
+ });
+ });
+ });
+}
+
+/**
+ * Asserts whether the specified options are valid, also sanitizes options and provides sane defaults for missing
+ * options.
+ *
+ * @private
+ */
+function _assertAndSanitizeOptionsSync(options) {
+ const tmpDir = (options.tmpdir = _getTmpDirSync(options));
+
+ _assertOptionsBase(options, tmpDir);
+
+ const dir = _getRelativePathSync('dir', options.dir, tmpDir);
+ options.dir = _isUndefined(dir) ? '' : dir;
+
+ options.template = _getRelativePathSync('template', options.template, tmpDir);
+
+ return options;
+}
+
/**
* Helper for testing against EBADF to compensate changes made to Node 7.x under Windows.
+ *
+ * @private
*/
-function isEBADF(error) {
- return isExpectedError(error, -EBADF, 'EBADF');
+function _isEBADF(error) {
+ return _isExpectedError(error, -EBADF, 'EBADF');
}
/**
* Helper for testing against ENOENT to compensate changes made to Node 7.x under Windows.
+ *
+ * @private
*/
-function isENOENT(error) {
- return isExpectedError(error, -ENOENT, 'ENOENT');
+function _isENOENT(error) {
+ return _isExpectedError(error, -ENOENT, 'ENOENT');
}
/**
@@ -490,68 +682,77 @@ function isENOENT(error) {
* which will differ between the supported node versions.
*
* - Node >= 7.0:
- * error.code {String}
- * error.errno {String|Number} any numerical value will be negated
+ * error.code {string}
+ * error.errno {number} any numerical value will be negated
*
- * - Node >= 6.0 < 7.0:
- * error.code {String}
- * error.errno {Number} negated
+ * CAVEAT
*
- * - Node >= 4.0 < 6.0: introduces SystemError
- * error.code {String}
- * error.errno {Number} negated
+ * On windows, the errno for EBADF is -4083 but os.constants.errno.EBADF is different and we must assume that ENOENT
+ * is no different here.
*
- * - Node >= 0.10 < 4.0:
- * error.code {Number} negated
- * error.errno n/a
+ * @param {SystemError} error
+ * @param {number} errno
+ * @param {string} code
+ * @private
*/
-function isExpectedError(error, code, errno) {
- return error.code == code || error.code == errno;
+function _isExpectedError(error, errno, code) {
+ return IS_WIN32 ? error.code === code : error.code === code && error.errno === errno;
}
/**
* Sets the graceful cleanup.
*
- * Also removes the created files and directories when an uncaught exception occurs.
+ * If graceful cleanup is set, tmp will remove all controlled temporary objects on process exit, otherwise the
+ * temporary objects will remain in place, waiting to be cleaned up on system restart or otherwise scheduled temporary
+ * object removals.
*/
function setGracefulCleanup() {
_gracefulCleanup = true;
}
-const version = process.versions.node.split('.').map(function (value) {
- return parseInt(value, 10);
-});
-
-if (version[0] === 0 && (version[1] < 9 || version[1] === 9 && version[2] < 5)) {
- process.addListener('uncaughtException', function _uncaughtExceptionThrown(err) {
- _uncaughtException = true;
- _garbageCollector();
+/**
+ * Returns the currently configured tmp dir from os.tmpdir().
+ *
+ * @private
+ */
+function _getTmpDir(options, cb) {
+ return fs.realpath((options && options.tmpdir) || os.tmpdir(), cb);
+}
- throw err;
- });
+/**
+ * Returns the currently configured tmp dir from os.tmpdir().
+ *
+ * @private
+ */
+function _getTmpDirSync(options) {
+ return fs.realpathSync((options && options.tmpdir) || os.tmpdir());
}
-process.addListener('exit', function _exit(code) {
- if (code) _uncaughtException = true;
- _garbageCollector();
-});
+// Install process exit listener
+process.addListener(EXIT, _garbageCollector);
/**
* Configuration options.
*
* @typedef {Object} Options
+ * @property {?boolean} keep the temporary object (file or dir) will not be garbage collected
* @property {?number} tries the number of tries before give up the name generation
+ * @property (?int) mode the access mode, defaults are 0o700 for directories and 0o600 for files
* @property {?string} template the "mkstemp" like filename template
- * @property {?string} name fix name
- * @property {?string} dir the tmp directory to use
+ * @property {?string} name fixed name relative to tmpdir or the specified dir option
+ * @property {?string} dir tmp directory relative to the root tmp directory in use
* @property {?string} prefix prefix for the generated name
* @property {?string} postfix postfix for the generated name
+ * @property {?string} tmpdir the root tmp directory which overrides the os tmpdir
+ * @property {?boolean} unsafeCleanup recursively removes the created temporary directory, even when it's not empty
+ * @property {?boolean} detachDescriptor detaches the file descriptor, caller is responsible for closing the file, tmp will no longer try closing the file during garbage collection
+ * @property {?boolean} discardDescriptor discards the file descriptor (closes file, fd is -1), tmp will no longer try closing the file during garbage collection
*/
/**
* @typedef {Object} FileSyncObject
* @property {string} name the name of the file
- * @property {string} fd the file descriptor
+ * @property {string} fd the file descriptor or -1 if the fd has been discarded
* @property {fileCallback} removeCallback the callback function to remove the file
*/
@@ -571,10 +772,18 @@ process.addListener('exit', function _exit(code) {
* @callback fileCallback
* @param {?Error} err the error object if anything goes wrong
* @param {string} name the temporary file name
- * @param {number} fd the file descriptor
+ * @param {number} fd the file descriptor or -1 if the fd had been discarded
* @param {cleanupCallback} fn the cleanup callback function
*/
+/**
+ * @callback fileCallbackSync
+ * @param {?Error} err the error object if anything goes wrong
+ * @param {string} name the temporary file name
+ * @param {number} fd the file descriptor or -1 if the fd had been discarded
+ * @param {cleanupCallbackSync} fn the cleanup callback function
+ */
+
/**
* @callback dirCallback
* @param {?Error} err the error object if anything goes wrong
@@ -582,11 +791,24 @@ process.addListener('exit', function _exit(code) {
* @param {cleanupCallback} fn the cleanup callback function
*/
+/**
+ * @callback dirCallbackSync
+ * @param {?Error} err the error object if anything goes wrong
+ * @param {string} name the temporary file name
+ * @param {cleanupCallbackSync} fn the cleanup callback function
+ */
+
/**
* Removes the temporary created file or directory.
*
* @callback cleanupCallback
- * @param {simpleCallback} [next] function to call after entry was removed
+ * @param {simpleCallback} [next] function to call whenever the tmp object needs to be removed
+ */
+
+/**
+ * Removes the temporary created file or directory.
+ *
+ * @callback cleanupCallbackSync
*/
/**
@@ -597,7 +819,16 @@ process.addListener('exit', function _exit(code) {
*/
// exporting all the needed methods
-module.exports.tmpdir = tmpDir;
+
+// evaluate _getTmpDir() lazily, mainly for simplifying testing but it also will
+// allow users to reconfigure the temporary directory
+Object.defineProperty(module.exports, 'tmpdir', {
+ enumerable: true,
+ configurable: false,
+ get: function () {
+ return _getTmpDirSync();
+ }
+});
module.exports.dir = dir;
module.exports.dirSync = dirSync;
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..33f1fc6
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,2785 @@
+{
+ "name": "tmp",
+ "version": "0.2.4",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.23.5",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz",
+ "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.23.4",
+ "chalk": "^2.4.2"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.22.20",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz",
+ "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==",
+ "dev": true
+ },
+ "@babel/highlight": {
+ "version": "7.23.4",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz",
+ "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.22.20",
+ "chalk": "^2.4.2",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "abbrev": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz",
+ "integrity": "sha512-LEyx4aLEC3x6T0UguF6YILf+ntvmOaWsVfENmIW0E9H09vKlLDGelMjjSm0jkDHALj8A8quZ/HapKNigzwge+Q==",
+ "dev": true
+ },
+ "acorn": {
+ "version": "7.4.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
+ "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
+ "dev": true
+ },
+ "acorn-jsx": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
+ "dev": true
+ },
+ "agent-base": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz",
+ "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==",
+ "dev": true
+ },
+ "agentkeepalive": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz",
+ "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==",
+ "dev": true,
+ "requires": {
+ "humanize-ms": "^1.2.1"
+ }
+ },
+ "aggregate-error": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz",
+ "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==",
+ "dev": true,
+ "requires": {
+ "clean-stack": "^2.0.0",
+ "indent-string": "^4.0.0"
+ }
+ },
+ "ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "requires": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "amdefine": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
+ "integrity": "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==",
+ "dev": true,
+ "optional": true
+ },
+ "ansi-colors": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
+ "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
+ "dev": true
+ },
+ "ansi-escapes": {
+ "version": "4.3.2",
+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz",
+ "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==",
+ "dev": true,
+ "requires": {
+ "type-fest": "^0.21.3"
+ },
+ "dependencies": {
+ "type-fest": {
+ "version": "0.21.3",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
+ "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
+ "dev": true
+ }
+ }
+ },
+ "ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "any-promise": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
+ "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==",
+ "dev": true
+ },
+ "anymatch": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
+ "dev": true,
+ "requires": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ }
+ },
+ "aproba": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
+ "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
+ "dev": true
+ },
+ "argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "dev": true,
+ "requires": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
+ "astral-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz",
+ "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==",
+ "dev": true
+ },
+ "async": {
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
+ "integrity": "sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w==",
+ "dev": true
+ },
+ "balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true
+ },
+ "binary-extensions": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
+ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
+ "dev": true
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dev": true,
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "braces": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
+ "dev": true,
+ "requires": {
+ "fill-range": "^7.1.1"
+ },
+ "dependencies": {
+ "fill-range": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+ "dev": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ }
+ }
+ },
+ "browser-stdout": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
+ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
+ "dev": true
+ },
+ "cacache": {
+ "version": "14.0.0",
+ "resolved": "https://registry.npmjs.org/cacache/-/cacache-14.0.0.tgz",
+ "integrity": "sha512-+Nr/BnA/tjAUXza9gH8F+FSP+1HvWqCKt4c95dQr4EDVJVafbzmPZpLKCkLYexs6vSd2B/1TOXrAoNnqVPfvRA==",
+ "dev": true,
+ "requires": {
+ "chownr": "^1.1.2",
+ "figgy-pudding": "^3.5.1",
+ "fs-minipass": "^2.0.0",
+ "glob": "^7.1.4",
+ "graceful-fs": "^4.2.2",
+ "infer-owner": "^1.0.4",
+ "lru-cache": "^5.1.1",
+ "minipass": "^3.0.0",
+ "minipass-collect": "^1.0.2",
+ "minipass-flush": "^1.0.5",
+ "minipass-pipeline": "^1.2.2",
+ "mkdirp": "^1.0.3",
+ "move-concurrently": "^1.0.1",
+ "p-map": "^3.0.0",
+ "promise-inflight": "^1.0.1",
+ "rimraf": "^2.7.1",
+ "ssri": "^7.0.0",
+ "tar": "^6.0.0",
+ "unique-filename": "^1.1.1"
+ },
+ "dependencies": {
+ "mkdirp": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
+ "dev": true
+ },
+ "rimraf": {
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
+ "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ }
+ }
+ },
+ "callsites": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
+ "dev": true
+ },
+ "camelcase": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
+ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
+ "dev": true
+ },
+ "chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ }
+ },
+ "chardet": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",
+ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
+ "dev": true
+ },
+ "chokidar": {
+ "version": "3.5.3",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
+ "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
+ "dev": true,
+ "requires": {
+ "anymatch": "~3.1.2",
+ "braces": "~3.0.2",
+ "fsevents": "~2.3.2",
+ "glob-parent": "~5.1.2",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.6.0"
+ }
+ },
+ "chownr": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
+ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
+ "dev": true
+ },
+ "clean-stack": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
+ "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==",
+ "dev": true
+ },
+ "cli-cursor": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",
+ "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
+ "dev": true,
+ "requires": {
+ "restore-cursor": "^3.1.0"
+ }
+ },
+ "cli-highlight": {
+ "version": "2.1.11",
+ "resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-2.1.11.tgz",
+ "integrity": "sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==",
+ "dev": true,
+ "requires": {
+ "chalk": "^4.0.0",
+ "highlight.js": "^10.7.1",
+ "mz": "^2.4.0",
+ "parse5": "^5.1.1",
+ "parse5-htmlparser2-tree-adapter": "^6.0.0",
+ "yargs": "^16.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ },
+ "yargs": {
+ "version": "16.2.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
+ "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
+ "dev": true,
+ "requires": {
+ "cliui": "^7.0.2",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.0",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^20.2.2"
+ }
+ }
+ }
+ },
+ "cli-width": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz",
+ "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==",
+ "dev": true
+ },
+ "cliui": {
+ "version": "7.0.4",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
+ "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
+ "dev": true,
+ "requires": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0",
+ "wrap-ansi": "^7.0.0"
+ },
+ "dependencies": {
+ "strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^5.0.1"
+ }
+ }
+ }
+ },
+ "color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dev": true,
+ "requires": {
+ "color-name": "1.1.3"
+ }
+ },
+ "color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
+ "dev": true
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
+ "dev": true
+ },
+ "copy-concurrently": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",
+ "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==",
+ "dev": true,
+ "requires": {
+ "aproba": "^1.1.1",
+ "fs-write-stream-atomic": "^1.0.8",
+ "iferr": "^0.1.5",
+ "mkdirp": "^0.5.1",
+ "rimraf": "^2.5.4",
+ "run-queue": "^1.0.0"
+ }
+ },
+ "core-util-is": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
+ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
+ "dev": true
+ },
+ "cross-spawn": {
+ "version": "6.0.5",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
+ "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+ "dev": true,
+ "requires": {
+ "nice-try": "^1.0.4",
+ "path-key": "^2.0.1",
+ "semver": "^5.5.0",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.7.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",
+ "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==",
+ "dev": true
+ }
+ }
+ },
+ "debug": {
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
+ "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
+ "dev": true,
+ "requires": {
+ "ms": "2.1.2"
+ }
+ },
+ "decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
+ "dev": true
+ },
+ "deep-is": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
+ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
+ "dev": true
+ },
+ "diff": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
+ "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==",
+ "dev": true
+ },
+ "doctrine": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
+ "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
+ "dev": true,
+ "requires": {
+ "esutils": "^2.0.2"
+ }
+ },
+ "emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
+ "encoding": {
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
+ "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "iconv-lite": "^0.6.2"
+ },
+ "dependencies": {
+ "iconv-lite": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
+ "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ }
+ }
+ }
+ },
+ "end-of-stream": {
+ "version": "1.4.4",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
+ "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
+ "dev": true,
+ "requires": {
+ "once": "^1.4.0"
+ }
+ },
+ "err-code": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz",
+ "integrity": "sha512-CJAN+O0/yA1CKfRn9SXOGctSpEM7DCon/r/5r2eXFMY2zCCJBasFhcM5I+1kh3Ap11FsQCX+vGHceNPvpWKhoA==",
+ "dev": true
+ },
+ "es6-promise": {
+ "version": "4.2.8",
+ "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
+ "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",
+ "dev": true
+ },
+ "es6-promisify": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
+ "integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==",
+ "dev": true,
+ "requires": {
+ "es6-promise": "^4.0.3"
+ }
+ },
+ "escalade": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz",
+ "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==",
+ "dev": true
+ },
+ "escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
+ "dev": true
+ },
+ "escodegen": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz",
+ "integrity": "sha512-yhi5S+mNTOuRvyW4gWlg5W1byMaQGWWSYHXsuFZ7GBo7tpyOwi2EdzMP/QWxh9hwkD2m+wDVHJsxhRIj+v/b/A==",
+ "dev": true,
+ "requires": {
+ "esprima": "^2.7.1",
+ "estraverse": "^1.9.1",
+ "esutils": "^2.0.2",
+ "optionator": "^0.8.1",
+ "source-map": "~0.2.0"
+ },
+ "dependencies": {
+ "esprima": {
+ "version": "2.7.3",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz",
+ "integrity": "sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A==",
+ "dev": true
+ },
+ "estraverse": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz",
+ "integrity": "sha512-25w1fMXQrGdoquWnScXZGckOv+Wes+JDnuN/+7ex3SauFRS72r2lFDec0EKPt2YD1wUJ/IrfEex+9yp4hfSOJA==",
+ "dev": true
+ }
+ }
+ },
+ "eslint": {
+ "version": "6.8.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz",
+ "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "ajv": "^6.10.0",
+ "chalk": "^2.1.0",
+ "cross-spawn": "^6.0.5",
+ "debug": "^4.0.1",
+ "doctrine": "^3.0.0",
+ "eslint-scope": "^5.0.0",
+ "eslint-utils": "^1.4.3",
+ "eslint-visitor-keys": "^1.1.0",
+ "espree": "^6.1.2",
+ "esquery": "^1.0.1",
+ "esutils": "^2.0.2",
+ "file-entry-cache": "^5.0.1",
+ "functional-red-black-tree": "^1.0.1",
+ "glob-parent": "^5.0.0",
+ "globals": "^12.1.0",
+ "ignore": "^4.0.6",
+ "import-fresh": "^3.0.0",
+ "imurmurhash": "^0.1.4",
+ "inquirer": "^7.0.0",
+ "is-glob": "^4.0.0",
+ "js-yaml": "^3.13.1",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "levn": "^0.3.0",
+ "lodash": "^4.17.14",
+ "minimatch": "^3.0.4",
+ "mkdirp": "^0.5.1",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.8.3",
+ "progress": "^2.0.0",
+ "regexpp": "^2.0.1",
+ "semver": "^6.1.2",
+ "strip-ansi": "^5.2.0",
+ "strip-json-comments": "^3.0.1",
+ "table": "^5.2.3",
+ "text-table": "^0.2.0",
+ "v8-compile-cache": "^2.0.3"
+ }
+ },
+ "eslint-plugin-mocha": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-6.3.0.tgz",
+ "integrity": "sha512-Cd2roo8caAyG21oKaaNTj7cqeYRWW1I2B5SfpKRp0Ip1gkfwoR1Ow0IGlPWnNjzywdF4n+kHL8/9vM6zCJUxdg==",
+ "dev": true,
+ "requires": {
+ "eslint-utils": "^2.0.0",
+ "ramda": "^0.27.0"
+ },
+ "dependencies": {
+ "eslint-utils": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
+ "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
+ "dev": true,
+ "requires": {
+ "eslint-visitor-keys": "^1.1.0"
+ }
+ }
+ }
+ },
+ "eslint-scope": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
+ "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
+ "dev": true,
+ "requires": {
+ "esrecurse": "^4.3.0",
+ "estraverse": "^4.1.1"
+ }
+ },
+ "eslint-utils": {
+ "version": "1.4.3",
+ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz",
+ "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==",
+ "dev": true,
+ "requires": {
+ "eslint-visitor-keys": "^1.1.0"
+ }
+ },
+ "eslint-visitor-keys": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
+ "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
+ "dev": true
+ },
+ "espree": {
+ "version": "6.2.1",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz",
+ "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==",
+ "dev": true,
+ "requires": {
+ "acorn": "^7.1.1",
+ "acorn-jsx": "^5.2.0",
+ "eslint-visitor-keys": "^1.1.0"
+ }
+ },
+ "esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+ "dev": true
+ },
+ "esquery": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",
+ "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==",
+ "dev": true,
+ "requires": {
+ "estraverse": "^5.1.0"
+ },
+ "dependencies": {
+ "estraverse": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
+ "dev": true
+ }
+ }
+ },
+ "esrecurse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
+ "dev": true,
+ "requires": {
+ "estraverse": "^5.2.0"
+ },
+ "dependencies": {
+ "estraverse": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
+ "dev": true
+ }
+ }
+ },
+ "estraverse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
+ "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
+ "dev": true
+ },
+ "esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "dev": true
+ },
+ "execa": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
+ "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
+ "dev": true,
+ "requires": {
+ "cross-spawn": "^6.0.0",
+ "get-stream": "^4.0.0",
+ "is-stream": "^1.1.0",
+ "npm-run-path": "^2.0.0",
+ "p-finally": "^1.0.0",
+ "signal-exit": "^3.0.0",
+ "strip-eof": "^1.0.0"
+ }
+ },
+ "external-editor": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz",
+ "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==",
+ "dev": true,
+ "requires": {
+ "chardet": "^0.7.0",
+ "iconv-lite": "^0.4.24",
+ "tmp": "^0.0.33"
+ }
+ },
+ "fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "dev": true
+ },
+ "fast-json-stable-stringify": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
+ "dev": true
+ },
+ "fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
+ "dev": true
+ },
+ "figgy-pudding": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz",
+ "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==",
+ "dev": true
+ },
+ "figures": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
+ "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==",
+ "dev": true,
+ "requires": {
+ "escape-string-regexp": "^1.0.5"
+ }
+ },
+ "file-entry-cache": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz",
+ "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==",
+ "dev": true,
+ "requires": {
+ "flat-cache": "^2.0.1"
+ }
+ },
+ "find-up": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
+ "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^3.0.0"
+ }
+ },
+ "flat": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
+ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",
+ "dev": true
+ },
+ "flat-cache": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz",
+ "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==",
+ "dev": true,
+ "requires": {
+ "flatted": "^2.0.0",
+ "rimraf": "2.6.3",
+ "write": "1.0.3"
+ }
+ },
+ "flatted": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz",
+ "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==",
+ "dev": true
+ },
+ "fs-minipass": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
+ "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
+ "dev": true,
+ "requires": {
+ "minipass": "^3.0.0"
+ }
+ },
+ "fs-write-stream-atomic": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz",
+ "integrity": "sha512-gehEzmPn2nAwr39eay+x3X34Ra+M2QlVUTLhkXPjWdeO8RF9kszk116avgBJM3ZyNHgHXBNx+VmPaFC36k0PzA==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "iferr": "^0.1.5",
+ "imurmurhash": "^0.1.4",
+ "readable-stream": "1 || 2"
+ }
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
+ "dev": true
+ },
+ "fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "optional": true
+ },
+ "functional-red-black-tree": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
+ "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==",
+ "dev": true
+ },
+ "get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true
+ },
+ "get-stream": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
+ "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
+ "dev": true,
+ "requires": {
+ "pump": "^3.0.0"
+ }
+ },
+ "glob": {
+ "version": "7.2.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
+ "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.1.1",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "dev": true,
+ "requires": {
+ "is-glob": "^4.0.1"
+ }
+ },
+ "globals": {
+ "version": "12.4.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz",
+ "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==",
+ "dev": true,
+ "requires": {
+ "type-fest": "^0.8.1"
+ }
+ },
+ "graceful-fs": {
+ "version": "4.2.11",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
+ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
+ "dev": true
+ },
+ "handlebars": {
+ "version": "4.7.8",
+ "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz",
+ "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.5",
+ "neo-async": "^2.6.2",
+ "source-map": "^0.6.1",
+ "uglify-js": "^3.1.4",
+ "wordwrap": "^1.0.0"
+ },
+ "dependencies": {
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ }
+ }
+ },
+ "has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
+ "dev": true
+ },
+ "he": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
+ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
+ "dev": true
+ },
+ "highlight.js": {
+ "version": "10.7.3",
+ "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz",
+ "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==",
+ "dev": true
+ },
+ "http-cache-semantics": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
+ "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==",
+ "dev": true
+ },
+ "http-proxy-agent": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-3.0.0.tgz",
+ "integrity": "sha512-uGuJaBWQWDQCJI5ip0d/VTYZW0nRrlLWXA4A7P1jrsa+f77rW2yXz315oBt6zGCF6l8C2tlMxY7ffULCj+5FhA==",
+ "dev": true,
+ "requires": {
+ "agent-base": "5",
+ "debug": "4"
+ }
+ },
+ "https-proxy-agent": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz",
+ "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==",
+ "dev": true,
+ "requires": {
+ "agent-base": "5",
+ "debug": "4"
+ }
+ },
+ "humanize-ms": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
+ "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",
+ "dev": true,
+ "requires": {
+ "ms": "^2.0.0"
+ }
+ },
+ "iconv-lite": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "dev": true,
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ }
+ },
+ "iferr": {
+ "version": "0.1.5",
+ "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz",
+ "integrity": "sha512-DUNFN5j7Tln0D+TxzloUjKB+CtVu6myn0JEFak6dG18mNt9YkQ6lzGCdafwofISZ1lLF3xRHJ98VKy9ynkcFaA==",
+ "dev": true
+ },
+ "ignore": {
+ "version": "4.0.6",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
+ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
+ "dev": true
+ },
+ "import-fresh": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
+ "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
+ "dev": true,
+ "requires": {
+ "parent-module": "^1.0.0",
+ "resolve-from": "^4.0.0"
+ }
+ },
+ "imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
+ "dev": true
+ },
+ "indent-string": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
+ "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
+ "dev": true
+ },
+ "infer-owner": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz",
+ "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==",
+ "dev": true
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
+ "dev": true,
+ "requires": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true
+ },
+ "inquirer": {
+ "version": "7.3.3",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz",
+ "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==",
+ "dev": true,
+ "requires": {
+ "ansi-escapes": "^4.2.1",
+ "chalk": "^4.1.0",
+ "cli-cursor": "^3.1.0",
+ "cli-width": "^3.0.0",
+ "external-editor": "^3.0.3",
+ "figures": "^3.0.0",
+ "lodash": "^4.17.19",
+ "mute-stream": "0.0.8",
+ "run-async": "^2.4.0",
+ "rxjs": "^6.6.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0",
+ "through": "^2.3.6"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^5.0.1"
+ }
+ },
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "ip": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
+ "integrity": "sha512-rBtCAQAJm8A110nbwn6YdveUnuZH3WrC36IwkRXxDnq53JvXA2NVQvB7IHyKomxK1MJ4VDNw3UtFDdXQ+AvLYA==",
+ "dev": true
+ },
+ "is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "dev": true,
+ "requires": {
+ "binary-extensions": "^2.0.0"
+ }
+ },
+ "is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true
+ },
+ "is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "dev": true,
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ },
+ "is-lambda": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz",
+ "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==",
+ "dev": true
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true
+ },
+ "is-plain-obj": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
+ "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",
+ "dev": true
+ },
+ "is-stream": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
+ "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==",
+ "dev": true
+ },
+ "is-unicode-supported": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
+ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
+ "dev": true
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
+ "dev": true
+ },
+ "isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
+ "dev": true
+ },
+ "istanbul": {
+ "version": "0.4.5",
+ "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz",
+ "integrity": "sha512-nMtdn4hvK0HjUlzr1DrKSUY8ychprt8dzHOgY2KXsIhHu5PuQQEOTM27gV9Xblyon7aUH/TSFIjRHEODF/FRPg==",
+ "dev": true,
+ "requires": {
+ "abbrev": "1.0.x",
+ "async": "1.x",
+ "escodegen": "1.8.x",
+ "esprima": "2.7.x",
+ "glob": "^5.0.15",
+ "handlebars": "^4.0.1",
+ "js-yaml": "3.x",
+ "mkdirp": "0.5.x",
+ "nopt": "3.x",
+ "once": "1.x",
+ "resolve": "1.1.x",
+ "supports-color": "^3.1.0",
+ "which": "^1.1.1",
+ "wordwrap": "^1.0.0"
+ },
+ "dependencies": {
+ "esprima": {
+ "version": "2.7.3",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz",
+ "integrity": "sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A==",
+ "dev": true
+ },
+ "glob": {
+ "version": "5.0.15",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz",
+ "integrity": "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA==",
+ "dev": true,
+ "requires": {
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "2 || 3",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "has-flag": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz",
+ "integrity": "sha512-DyYHfIYwAJmjAjSSPKANxI8bFY9YtFrgkAfinBojQ8YJTOuOuav64tMUJv584SES4xl74PmuaevIyaLESHdTAA==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "3.2.3",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz",
+ "integrity": "sha512-Jds2VIYDrlp5ui7t8abHN2bjAu4LV/q4N2KivFPpGH0lrka0BMq/33AmECUXlKPcHigkNaqfXRENFju+rlcy+A==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^1.0.0"
+ }
+ }
+ }
+ },
+ "js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+ "dev": true
+ },
+ "js-yaml": {
+ "version": "3.14.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
+ "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
+ "dev": true,
+ "requires": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ }
+ },
+ "json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true
+ },
+ "json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",
+ "dev": true
+ },
+ "lerna-changelog": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/lerna-changelog/-/lerna-changelog-1.0.1.tgz",
+ "integrity": "sha512-E7ewsfQknBmQcUspCqd5b8Hbbp5SX768y6vEiIdXXui9pPhZS1WlrKtiAUPs0CeGd8Pv4gtIC/h3wSWIZuvqaA==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.1",
+ "cli-highlight": "^2.1.4",
+ "execa": "^1.0.0",
+ "make-fetch-happen": "^7.1.1",
+ "normalize-git-url": "^3.0.2",
+ "p-map": "^3.0.0",
+ "progress": "^2.0.0",
+ "yargs": "^13.0.0"
+ }
+ },
+ "levn": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
+ "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2"
+ }
+ },
+ "locate-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
+ "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
+ "dev": true,
+ "requires": {
+ "p-locate": "^3.0.0",
+ "path-exists": "^3.0.0"
+ }
+ },
+ "lodash": {
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
+ "dev": true
+ },
+ "log-symbols": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
+ "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
+ "dev": true,
+ "requires": {
+ "chalk": "^4.1.0",
+ "is-unicode-supported": "^0.1.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "lru-cache": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
+ "dev": true,
+ "requires": {
+ "yallist": "^3.0.2"
+ },
+ "dependencies": {
+ "yallist": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
+ "dev": true
+ }
+ }
+ },
+ "make-fetch-happen": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-7.1.1.tgz",
+ "integrity": "sha512-7fNjiOXNZhNGQzG5P15nU97aZQtzPU2GVgVd7pnqnl5gnpLzMAD8bAe5YG4iW2s0PTqaZy9xGv4Wfqe872kRNQ==",
+ "dev": true,
+ "requires": {
+ "agentkeepalive": "^4.1.0",
+ "cacache": "^14.0.0",
+ "http-cache-semantics": "^4.0.3",
+ "http-proxy-agent": "^3.0.0",
+ "https-proxy-agent": "^4.0.0",
+ "is-lambda": "^1.0.1",
+ "lru-cache": "^5.1.1",
+ "minipass": "^3.0.0",
+ "minipass-collect": "^1.0.2",
+ "minipass-fetch": "^1.1.2",
+ "minipass-flush": "^1.0.5",
+ "minipass-pipeline": "^1.2.2",
+ "promise-retry": "^1.1.1",
+ "socks-proxy-agent": "^4.0.0",
+ "ssri": "^7.0.1"
+ }
+ },
+ "mimic-fn": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
+ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
+ "dev": true
+ },
+ "minimatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+ "dev": true,
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
+ "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
+ "dev": true
+ },
+ "minipass": {
+ "version": "3.3.6",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+ "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
+ "dev": true,
+ "requires": {
+ "yallist": "^4.0.0"
+ }
+ },
+ "minipass-collect": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz",
+ "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==",
+ "dev": true,
+ "requires": {
+ "minipass": "^3.0.0"
+ }
+ },
+ "minipass-fetch": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.4.1.tgz",
+ "integrity": "sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==",
+ "dev": true,
+ "requires": {
+ "encoding": "^0.1.12",
+ "minipass": "^3.1.0",
+ "minipass-sized": "^1.0.3",
+ "minizlib": "^2.0.0"
+ }
+ },
+ "minipass-flush": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz",
+ "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==",
+ "dev": true,
+ "requires": {
+ "minipass": "^3.0.0"
+ }
+ },
+ "minipass-pipeline": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz",
+ "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==",
+ "dev": true,
+ "requires": {
+ "minipass": "^3.0.0"
+ }
+ },
+ "minipass-sized": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz",
+ "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==",
+ "dev": true,
+ "requires": {
+ "minipass": "^3.0.0"
+ }
+ },
+ "minizlib": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
+ "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
+ "dev": true,
+ "requires": {
+ "minipass": "^3.0.0",
+ "yallist": "^4.0.0"
+ }
+ },
+ "mkdirp": {
+ "version": "0.5.6",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
+ "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.6"
+ }
+ },
+ "mocha": {
+ "version": "10.3.0",
+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.3.0.tgz",
+ "integrity": "sha512-uF2XJs+7xSLsrmIvn37i/wnc91nw7XjOQB8ccyx5aEgdnohr7n+rEiZP23WkCYHjilR6+EboEnbq/ZQDz4LSbg==",
+ "dev": true,
+ "requires": {
+ "ansi-colors": "4.1.1",
+ "browser-stdout": "1.3.1",
+ "chokidar": "3.5.3",
+ "debug": "4.3.4",
+ "diff": "5.0.0",
+ "escape-string-regexp": "4.0.0",
+ "find-up": "5.0.0",
+ "glob": "8.1.0",
+ "he": "1.2.0",
+ "js-yaml": "4.1.0",
+ "log-symbols": "4.1.0",
+ "minimatch": "5.0.1",
+ "ms": "2.1.3",
+ "serialize-javascript": "6.0.0",
+ "strip-json-comments": "3.1.1",
+ "supports-color": "8.1.1",
+ "workerpool": "6.2.1",
+ "yargs": "16.2.0",
+ "yargs-parser": "20.2.4",
+ "yargs-unparser": "2.0.0"
+ },
+ "dependencies": {
+ "argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true
+ },
+ "brace-expansion": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
+ "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
+ "dev": true,
+ "requires": {
+ "balanced-match": "^1.0.0"
+ }
+ },
+ "escape-string-regexp": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "dev": true
+ },
+ "find-up": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^6.0.0",
+ "path-exists": "^4.0.0"
+ }
+ },
+ "glob": {
+ "version": "8.1.0",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
+ "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^5.0.1",
+ "once": "^1.3.0"
+ }
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "js-yaml": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "dev": true,
+ "requires": {
+ "argparse": "^2.0.1"
+ }
+ },
+ "locate-path": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
+ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+ "dev": true,
+ "requires": {
+ "p-locate": "^5.0.0"
+ }
+ },
+ "minimatch": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
+ "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
+ "dev": true,
+ "requires": {
+ "brace-expansion": "^2.0.1"
+ }
+ },
+ "ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true
+ },
+ "p-limit": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+ "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+ "dev": true,
+ "requires": {
+ "yocto-queue": "^0.1.0"
+ }
+ },
+ "p-locate": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
+ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^3.0.2"
+ }
+ },
+ "path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "8.1.1",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
+ "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ },
+ "yargs": {
+ "version": "16.2.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
+ "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
+ "dev": true,
+ "requires": {
+ "cliui": "^7.0.2",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.0",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^20.2.2"
+ }
+ },
+ "yargs-parser": {
+ "version": "20.2.4",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz",
+ "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==",
+ "dev": true
+ }
+ }
+ },
+ "move-concurrently": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
+ "integrity": "sha512-hdrFxZOycD/g6A6SoI2bB5NA/5NEqD0569+S47WZhPvm46sD50ZHdYaFmnua5lndde9rCHGjmfK7Z8BuCt/PcQ==",
+ "dev": true,
+ "requires": {
+ "aproba": "^1.1.1",
+ "copy-concurrently": "^1.0.0",
+ "fs-write-stream-atomic": "^1.0.8",
+ "mkdirp": "^0.5.1",
+ "rimraf": "^2.5.4",
+ "run-queue": "^1.0.3"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ },
+ "mute-stream": {
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
+ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
+ "dev": true
+ },
+ "mz": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
+ "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==",
+ "dev": true,
+ "requires": {
+ "any-promise": "^1.0.0",
+ "object-assign": "^4.0.1",
+ "thenify-all": "^1.0.0"
+ }
+ },
+ "natural-compare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
+ "dev": true
+ },
+ "neo-async": {
+ "version": "2.6.2",
+ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
+ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
+ "dev": true
+ },
+ "nice-try": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
+ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
+ "dev": true
+ },
+ "nopt": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
+ "integrity": "sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg==",
+ "dev": true,
+ "requires": {
+ "abbrev": "1"
+ }
+ },
+ "normalize-git-url": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/normalize-git-url/-/normalize-git-url-3.0.2.tgz",
+ "integrity": "sha512-UEmKT33ssKLLoLCsFJ4Si4fmNQsedNwivXpuNTR4V1I97jU9WZlicTV1xn5QAG5itE5B3Z9zhl8OItP6wIGkRA==",
+ "dev": true
+ },
+ "normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true
+ },
+ "npm-run-path": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
+ "integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==",
+ "dev": true,
+ "requires": {
+ "path-key": "^2.0.0"
+ }
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "dev": true
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
+ "dev": true,
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "onetime": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
+ "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
+ "dev": true,
+ "requires": {
+ "mimic-fn": "^2.1.0"
+ }
+ },
+ "optionator": {
+ "version": "0.8.3",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
+ "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==",
+ "dev": true,
+ "requires": {
+ "deep-is": "~0.1.3",
+ "fast-levenshtein": "~2.0.6",
+ "levn": "~0.3.0",
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2",
+ "word-wrap": "~1.2.3"
+ }
+ },
+ "os-tmpdir": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
+ "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==",
+ "dev": true
+ },
+ "p-finally": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
+ "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==",
+ "dev": true
+ },
+ "p-limit": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
+ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
+ "dev": true,
+ "requires": {
+ "p-try": "^2.0.0"
+ }
+ },
+ "p-locate": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
+ "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^2.0.0"
+ }
+ },
+ "p-map": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz",
+ "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==",
+ "dev": true,
+ "requires": {
+ "aggregate-error": "^3.0.0"
+ }
+ },
+ "p-try": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
+ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
+ "dev": true
+ },
+ "parent-module": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
+ "dev": true,
+ "requires": {
+ "callsites": "^3.0.0"
+ }
+ },
+ "parse5": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz",
+ "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==",
+ "dev": true
+ },
+ "parse5-htmlparser2-tree-adapter": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz",
+ "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==",
+ "dev": true,
+ "requires": {
+ "parse5": "^6.0.1"
+ },
+ "dependencies": {
+ "parse5": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
+ "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==",
+ "dev": true
+ }
+ }
+ },
+ "path-exists": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
+ "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==",
+ "dev": true
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
+ "dev": true
+ },
+ "path-key": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
+ "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==",
+ "dev": true
+ },
+ "picomatch": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
+ "dev": true
+ },
+ "prelude-ls": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
+ "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==",
+ "dev": true
+ },
+ "process-nextick-args": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
+ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
+ "dev": true
+ },
+ "progress": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
+ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
+ "dev": true
+ },
+ "promise-inflight": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz",
+ "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==",
+ "dev": true
+ },
+ "promise-retry": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-1.1.1.tgz",
+ "integrity": "sha512-StEy2osPr28o17bIW776GtwO6+Q+M9zPiZkYfosciUUMYqjhU/ffwRAH0zN2+uvGyUsn8/YICIHRzLbPacpZGw==",
+ "dev": true,
+ "requires": {
+ "err-code": "^1.0.0",
+ "retry": "^0.10.0"
+ }
+ },
+ "pump": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
+ "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
+ "dev": true,
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
+ "punycode": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
+ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
+ "dev": true
+ },
+ "ramda": {
+ "version": "0.27.2",
+ "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.2.tgz",
+ "integrity": "sha512-SbiLPU40JuJniHexQSAgad32hfwd+DRUdwF2PlVuI5RZD0/vahUco7R8vD86J/tcEKKF9vZrUVwgtmGCqlCKyA==",
+ "dev": true
+ },
+ "randombytes": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
+ "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "^5.1.0"
+ }
+ },
+ "readable-stream": {
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
+ "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
+ "dev": true,
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ },
+ "readdirp": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "dev": true,
+ "requires": {
+ "picomatch": "^2.2.1"
+ }
+ },
+ "regexpp": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz",
+ "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==",
+ "dev": true
+ },
+ "require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
+ "dev": true
+ },
+ "require-main-filename": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
+ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
+ "dev": true
+ },
+ "resolve": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
+ "integrity": "sha512-9znBF0vBcaSN3W2j7wKvdERPwqTxSpCq+if5C0WoTCyV9n24rua28jeuQ2pL/HOf+yUe/Mef+H/5p60K0Id3bg==",
+ "dev": true
+ },
+ "resolve-from": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
+ "dev": true
+ },
+ "restore-cursor": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",
+ "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
+ "dev": true,
+ "requires": {
+ "onetime": "^5.1.0",
+ "signal-exit": "^3.0.2"
+ }
+ },
+ "retry": {
+ "version": "0.10.1",
+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz",
+ "integrity": "sha512-ZXUSQYTHdl3uS7IuCehYfMzKyIDBNoAuUblvy5oGO5UJSUTmStUUVPXbA9Qxd173Bgre53yCQczQuHgRWAdvJQ==",
+ "dev": true
+ },
+ "rimraf": {
+ "version": "2.6.3",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
+ "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "run-async": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz",
+ "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==",
+ "dev": true
+ },
+ "run-queue": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz",
+ "integrity": "sha512-ntymy489o0/QQplUDnpYAYUsO50K9SBrIVaKCWDOJzYJts0f9WH9RFJkyagebkw5+y1oi00R7ynNW/d12GBumg==",
+ "dev": true,
+ "requires": {
+ "aproba": "^1.1.1"
+ }
+ },
+ "rxjs": {
+ "version": "6.6.7",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
+ "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
+ "dev": true,
+ "requires": {
+ "tslib": "^1.9.0"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
+ "dev": true
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "dev": true
+ },
+ "semver": {
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
+ "dev": true
+ },
+ "serialize-javascript": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz",
+ "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==",
+ "dev": true,
+ "requires": {
+ "randombytes": "^2.1.0"
+ }
+ },
+ "set-blocking": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
+ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
+ "dev": true
+ },
+ "shebang-command": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
+ "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==",
+ "dev": true,
+ "requires": {
+ "shebang-regex": "^1.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
+ "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==",
+ "dev": true
+ },
+ "signal-exit": {
+ "version": "3.0.7",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
+ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
+ "dev": true
+ },
+ "slice-ansi": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz",
+ "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.0",
+ "astral-regex": "^1.0.0",
+ "is-fullwidth-code-point": "^2.0.0"
+ },
+ "dependencies": {
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==",
+ "dev": true
+ }
+ }
+ },
+ "smart-buffer": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
+ "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
+ "dev": true
+ },
+ "socks": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/socks/-/socks-2.3.3.tgz",
+ "integrity": "sha512-o5t52PCNtVdiOvzMry7wU4aOqYWL0PeCXRWBEiJow4/i/wr+wpsJQ9awEu1EonLIqsfGd5qSgDdxEOvCdmBEpA==",
+ "dev": true,
+ "requires": {
+ "ip": "1.1.5",
+ "smart-buffer": "^4.1.0"
+ }
+ },
+ "socks-proxy-agent": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-4.0.2.tgz",
+ "integrity": "sha512-NT6syHhI9LmuEMSK6Kd2V7gNv5KFZoLE7V5udWmn0de+3Mkj3UMA/AJPLyeNUVmElCurSHtUdM3ETpR3z770Wg==",
+ "dev": true,
+ "requires": {
+ "agent-base": "~4.2.1",
+ "socks": "~2.3.2"
+ },
+ "dependencies": {
+ "agent-base": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz",
+ "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==",
+ "dev": true,
+ "requires": {
+ "es6-promisify": "^5.0.0"
+ }
+ }
+ }
+ },
+ "source-map": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz",
+ "integrity": "sha512-CBdZ2oa/BHhS4xj5DlhjWNHcan57/5YuvfdLf17iVmIpd9KRm+DFLmC6nBNj+6Ua7Kt3TmOjDpQT1aTYOQtoUA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "amdefine": ">=0.0.4"
+ }
+ },
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
+ "dev": true
+ },
+ "ssri": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/ssri/-/ssri-7.1.1.tgz",
+ "integrity": "sha512-w+daCzXN89PseTL99MkA+fxJEcU3wfaE/ah0i0lnOlpG1CYLJ2ZjzEry68YBKfLs4JfoTShrTEsJkAZuNZ/stw==",
+ "dev": true,
+ "requires": {
+ "figgy-pudding": "^3.5.1",
+ "minipass": "^3.1.1"
+ }
+ },
+ "string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "dependencies": {
+ "strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^5.0.1"
+ }
+ }
+ }
+ },
+ "string_decoder": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
+ "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==",
+ "dev": true
+ }
+ }
+ },
+ "strip-eof": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
+ "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==",
+ "dev": true
+ },
+ "strip-json-comments": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
+ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ },
+ "table": {
+ "version": "5.4.6",
+ "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz",
+ "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==",
+ "dev": true,
+ "requires": {
+ "ajv": "^6.10.2",
+ "lodash": "^4.17.14",
+ "slice-ansi": "^2.1.0",
+ "string-width": "^3.0.0"
+ },
+ "dependencies": {
+ "emoji-regex": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
+ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==",
+ "dev": true
+ },
+ "string-width": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^7.0.1",
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^5.1.0"
+ }
+ }
+ }
+ },
+ "tar": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz",
+ "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==",
+ "dev": true,
+ "requires": {
+ "chownr": "^2.0.0",
+ "fs-minipass": "^2.0.0",
+ "minipass": "^5.0.0",
+ "minizlib": "^2.1.1",
+ "mkdirp": "^1.0.3",
+ "yallist": "^4.0.0"
+ },
+ "dependencies": {
+ "chownr": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
+ "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",
+ "dev": true
+ },
+ "minipass": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
+ "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
+ "dev": true
+ },
+ "mkdirp": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
+ "dev": true
+ }
+ }
+ },
+ "text-table": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
+ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==",
+ "dev": true
+ },
+ "thenify": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
+ "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",
+ "dev": true,
+ "requires": {
+ "any-promise": "^1.0.0"
+ }
+ },
+ "thenify-all": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz",
+ "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==",
+ "dev": true,
+ "requires": {
+ "thenify": ">= 3.1.0 < 4"
+ }
+ },
+ "through": {
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
+ "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==",
+ "dev": true
+ },
+ "tmp": {
+ "version": "0.0.33",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
+ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
+ "dev": true,
+ "requires": {
+ "os-tmpdir": "~1.0.2"
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ },
+ "tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
+ "dev": true
+ },
+ "type-check": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
+ "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "~1.1.2"
+ }
+ },
+ "type-fest": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
+ "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
+ "dev": true
+ },
+ "uglify-js": {
+ "version": "3.17.4",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz",
+ "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==",
+ "dev": true,
+ "optional": true
+ },
+ "unique-filename": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz",
+ "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==",
+ "dev": true,
+ "requires": {
+ "unique-slug": "^2.0.0"
+ }
+ },
+ "unique-slug": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz",
+ "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==",
+ "dev": true,
+ "requires": {
+ "imurmurhash": "^0.1.4"
+ }
+ },
+ "uri-js": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
+ "dev": true,
+ "requires": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
+ "dev": true
+ },
+ "v8-compile-cache": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.4.0.tgz",
+ "integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==",
+ "dev": true
+ },
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ },
+ "which-module": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",
+ "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",
+ "dev": true
+ },
+ "word-wrap": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
+ "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",
+ "dev": true
+ },
+ "wordwrap": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
+ "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==",
+ "dev": true
+ },
+ "workerpool": {
+ "version": "6.2.1",
+ "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz",
+ "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==",
+ "dev": true
+ },
+ "wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^5.0.1"
+ }
+ }
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
+ "dev": true
+ },
+ "write": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz",
+ "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==",
+ "dev": true,
+ "requires": {
+ "mkdirp": "^0.5.1"
+ }
+ },
+ "y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "dev": true
+ },
+ "yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true
+ },
+ "yargs": {
+ "version": "13.3.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
+ "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
+ "dev": true,
+ "requires": {
+ "cliui": "^5.0.0",
+ "find-up": "^3.0.0",
+ "get-caller-file": "^2.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^2.0.0",
+ "set-blocking": "^2.0.0",
+ "string-width": "^3.0.0",
+ "which-module": "^2.0.0",
+ "y18n": "^4.0.0",
+ "yargs-parser": "^13.1.2"
+ },
+ "dependencies": {
+ "cliui": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
+ "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
+ "dev": true,
+ "requires": {
+ "string-width": "^3.1.0",
+ "strip-ansi": "^5.2.0",
+ "wrap-ansi": "^5.1.0"
+ }
+ },
+ "emoji-regex": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
+ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==",
+ "dev": true
+ },
+ "string-width": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^7.0.1",
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^5.1.0"
+ }
+ },
+ "wrap-ansi": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
+ "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.0",
+ "string-width": "^3.0.0",
+ "strip-ansi": "^5.0.0"
+ }
+ },
+ "y18n": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
+ "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
+ "dev": true
+ },
+ "yargs-parser": {
+ "version": "13.1.2",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
+ "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ }
+ }
+ },
+ "yargs-parser": {
+ "version": "20.2.9",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
+ "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
+ "dev": true
+ },
+ "yargs-unparser": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz",
+ "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^6.0.0",
+ "decamelize": "^4.0.0",
+ "flat": "^5.0.2",
+ "is-plain-obj": "^2.1.0"
+ },
+ "dependencies": {
+ "camelcase": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
+ "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
+ "dev": true
+ },
+ "decamelize": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
+ "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",
+ "dev": true
+ }
+ }
+ },
+ "yocto-queue": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
+ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+ "dev": true
+ }
+ }
+}
diff --git a/package.json b/package.json
index e8aaf3b..64d1471 100644
--- a/package.json
+++ b/package.json
@@ -1,38 +1,44 @@
{
"name": "tmp",
- "version": "0.0.33",
+ "version": "0.2.4",
"description": "Temporary file and directory creator",
- "author": "KARASZI István (http://raszi.hu/)",
- "keywords": [
- "temporary",
- "tmp",
- "temp",
- "tempdir",
- "tempfile",
- "tmpdir",
- "tmpfile"
- ],
+ "author": "KARASZI István ",
+ "contributors": ["Carsten Klein (https://github.com/silkentrance)"],
+ "keywords": ["temporary", "tmp", "temp", "tempdir", "tempfile", "tmpdir", "tmpfile"],
"license": "MIT",
- "repository": "raszi/node-tmp",
+ "repository": "https://github.com/raszi/node-tmp.git",
"homepage": "http://github.com/raszi/node-tmp",
"bugs": {
"url": "http://github.com/raszi/node-tmp/issues"
},
"engines": {
- "node": ">=0.6.0"
- },
- "dependencies": {
- "os-tmpdir": "~1.0.2"
+ "node": ">=14.14"
},
+ "dependencies": {},
"devDependencies": {
- "vows": "~0.7.0"
+ "eslint": "^6.3.0",
+ "eslint-plugin-mocha": "^6.1.1",
+ "istanbul": "^0.4.5",
+ "lerna-changelog": "^1.0.1",
+ "mocha": "^10.2.0"
},
"main": "lib/tmp.js",
- "files": [
- "lib/"
- ],
+ "files": ["lib/"],
+ "changelog": {
+ "labels": {
+ "breaking": ":boom: Breaking Change",
+ "enhancement": ":rocket: Enhancement",
+ "bug": ":bug: Bug Fix",
+ "documentation": ":memo: Documentation",
+ "internal": ":house: Internal"
+ },
+ "cacheDir": ".changelog"
+ },
"scripts": {
- "test": "vows test/*-test.js",
+ "changelog": "lerna-changelog",
+ "lint": "eslint lib --env mocha test",
+ "clean": "rm -Rf ./coverage",
+ "test": "npm run clean && istanbul cover ./node_modules/mocha/bin/_mocha --report none --print none --dir ./coverage/json -u exports -R test/*-test.js && istanbul report --root ./coverage/json html && istanbul report text-summary",
"doc": "jsdoc -c .jsdoc.json"
}
}
diff --git a/scripts/prepare-changelog.sh b/scripts/prepare-changelog.sh
new file mode 100755
index 0000000..6de7c8d
--- /dev/null
+++ b/scripts/prepare-changelog.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+CMD=$(basename "${0}")
+
+if [ ${#} -ne 1 ]; then
+ echo "usage: ${CMD} "
+ exit 1
+fi
+
+FROM=${1}
+
+npm run changelog -- --from ${FROM} | grep -v "^>" > CHANGELOG.add.md \
+ && cat CHANGELOG.add.md CHANGELOG.md > CHANGELOG.new.md.tmp \
+ && (
+ lines=$(cat CHANGELOG.new.md.tmp | wc -l)
+ tail -n $(expr $lines - 1) CHANGELOG.new.md.tmp > CHANGELOG.new.md
+ ) \
+ && rm CHANGELOG.add.md CHANGELOG.new.md.tmp \
+ && (
+ echo "CHANGELOG.new.md was created and is ready for review"
+ echo "Simply move CHANGELOG.new.md to CHANGELOG.md when you are done and commit the new changelog"
+ echo "mv CHANGELOG.new.md CHANGELOG.md"
+ )
diff --git a/test/GHSA-52f5-9888-hmc6-test.js b/test/GHSA-52f5-9888-hmc6-test.js
new file mode 100644
index 0000000..91e4d79
--- /dev/null
+++ b/test/GHSA-52f5-9888-hmc6-test.js
@@ -0,0 +1,122 @@
+const assert = require('assert');
+const tmp = require('../lib/tmp');
+const fs = require('fs');
+const os = require('os');
+const { join } = require('path');
+const { randomBytes } = require('crypto');
+
+function getRandomChars() {
+ return randomBytes(10).toString('hex');
+}
+
+function getRandomPath(dir) {
+ return join(dir, getRandomChars());
+}
+
+describe('GHSA-52f5-9888-hmc6', function () {
+ const realTmpdir = os.tmpdir();
+ const restricted = getRandomPath(realTmpdir);
+ const tmpdir = getRandomPath(realTmpdir);
+ const evilSymlinkPath = getRandomPath(tmpdir);
+
+ before(function () {
+ fs.mkdirSync(restricted);
+ fs.mkdirSync(tmpdir);
+ fs.symlinkSync(restricted, evilSymlinkPath);
+ });
+
+ after(function () {
+ fs.rmSync(restricted, { recursive: true });
+ fs.rmSync(tmpdir, { recursive: true });
+ });
+
+ describe('#fileSync with `dir`', function () {
+ it('should not allow dirs outside of dir', function (done) {
+ assert.throws(function () {
+ tmp.fileSync({ tmpdir: tmpdir, dir: evilSymlinkPath });
+ }, new RegExp('^Error: dir option must be relative to'));
+
+ done();
+ });
+ });
+
+ describe('#fileSync with `template`', function () {
+ it('should not allow dirs outside of dir', function (done) {
+ assert.throws(function () {
+ tmp.fileSync({ tmpdir: tmpdir, template: join(evilSymlinkPath, 'XXXXXX') });
+ }, new RegExp('^Error: template option must be relative to'));
+
+ done();
+ });
+ });
+
+ describe('#file with `dir`', function () {
+ it('should not allow dirs outside of dir', function (done) {
+ tmp.file({ tmpdir: tmpdir, dir: evilSymlinkPath }, function (err, file) {
+ assert.ok(err instanceof Error, 'should have failed');
+ assert.ifError(file);
+
+ done();
+ });
+ });
+ });
+
+ describe('#file with `template`', function () {
+ it('should not allow dirs outside of dir', function (done) {
+ tmp.file({ tmpdir: tmpdir, template: join(evilSymlinkPath, 'XXXXXX') }, function (err, file) {
+ assert.ok(err instanceof Error, 'should have failed');
+ assert.ifError(file, 'should be null');
+
+ done();
+ });
+ });
+ });
+
+ describe('#dirSync with `dir`', function () {
+ it('should not allow dirs outside of dir', function (done) {
+ assert.throws(function () {
+ tmp.dirSync({
+ tmpdir: tmpdir,
+ dir: evilSymlinkPath
+ });
+ }, new RegExp('^Error: dir option must be relative to'));
+
+ done();
+ });
+ });
+
+ describe('#dirSync with `template`', function () {
+ it('should not allow dirs outside of dir', function (done) {
+ assert.throws(function () {
+ tmp.dirSync({
+ tmpdir: tmpdir,
+ template: join(evilSymlinkPath, 'XXXXXX')
+ });
+ }, new RegExp('^Error: template option must be relative to'));
+
+ done();
+ });
+ });
+
+ describe('#dir with `dir`', function () {
+ it('should not allow dirs outside of dir', function (done) {
+ tmp.dir({ tmpdir: tmpdir, dir: evilSymlinkPath }, function (err, dir) {
+ assert.ok(err instanceof Error, 'should have failed');
+ assert.ifError(dir);
+
+ done();
+ });
+ });
+ });
+
+ describe('#dir with `template`', function () {
+ it('should not allow dirs outside of dir', function (done) {
+ tmp.dir({ tmpdir: tmpdir, template: join(evilSymlinkPath, 'XXXXXX') }, function (err, dir) {
+ assert.ok(err instanceof Error, 'should have failed');
+ assert.ifError(dir, 'should be null');
+
+ done();
+ });
+ });
+ });
+});
diff --git a/test/assertions.js b/test/assertions.js
new file mode 100644
index 0000000..170f409
--- /dev/null
+++ b/test/assertions.js
@@ -0,0 +1,73 @@
+/* eslint-disable no-octal */
+
+var
+ assert = require('assert'),
+ fs = require('fs'),
+ path = require('path'),
+ existsSync = fs.existsSync || path.existsSync;
+
+
+module.exports.assertName = function assertName(name, expected) {
+ assert.ok(typeof name == 'string');
+ if (expected) {
+ assert.equal(path.basename(name), expected, 'should be the expected name');
+ } else {
+ assert.ok(name.length > 0, 'an empty string is not a valid name');
+ }
+};
+
+
+module.exports.assertMode = function assertMode(name, mode) {
+ var stat = fs.statSync(name);
+
+ // mode values do not work properly on Windows. Ignore “group” and
+ // “other” bits then. Ignore execute bit on that platform because it
+ // doesn’t exist—even for directories.
+ if (process.platform === 'win32') {
+ assert.equal(stat.mode & 0o600, mode & 0o600);
+ } else {
+ assert.equal(stat.mode & 0o777, mode);
+ }
+};
+
+
+module.exports.assertDir = function assertDir(name, dir) {
+ assert.equal(name.slice(0, dir.length), dir, 'should have the expected dir as the leading path');
+};
+
+
+module.exports.assertPrefix = function assertPrefix(name, prefix) {
+ assert.equal(path.basename(name).slice(0, prefix.length), prefix, 'should have the provided prefix');
+};
+
+
+module.exports.assertPostfix = function assertPostfix(name, postfix) {
+ assert.equal(name.slice(name.length - postfix.length, name.length), postfix, 'should have the provided postfix');
+};
+
+
+module.exports.assertProperResult = function assertProperResult(result, withfd) {
+ assert.ok(result);
+ assert.ok(result.name, 'should have a name');
+ if (withfd) assert.ok(result.fd, 'should have an fd');
+ else assert.strictEqual(result.fd, undefined, 'should not have a file descriptor (fd)');
+ assert.ok(typeof result.removeCallback == 'function', 'should have a removeCallback');
+};
+
+
+module.exports.assertExists = function assertExists(name, isfile) {
+ assert.ok(existsSync(name), name + ' should exist');
+ var stat = fs.statSync(name);
+ if (isfile) assert.ok(stat.isFile(), name + ' should be a file');
+ else assert.ok(stat.isDirectory(), name + ' should be a directory');
+};
+
+
+module.exports.assertDoesNotExist = function assertDoesNotExist(name) {
+ assert.ok(!existsSync(name), name + ' should not exist');
+};
+
+module.exports.assertDoesNotStartWith = function assertDoesNotStartWith(s, prefix, msg) {
+ if (s.indexOf(prefix) == 0) assert.fail(msg || s);
+};
+
diff --git a/test/base.js b/test/base.js
deleted file mode 100644
index b136756..0000000
--- a/test/base.js
+++ /dev/null
@@ -1,227 +0,0 @@
-var
- assert = require('assert'),
- path = require('path'),
- spawn = require('child_process').spawn,
- tmp = require('../lib/tmp');
-
-// make sure that we do not test spam the global tmp
-tmp.TMP_DIR = './tmp';
-
-function _bufferConcat(buffers) {
- if (Buffer.concat) {
- return Buffer.concat.apply(this, arguments);
- } else {
- return new Buffer(buffers.reduce(function (acc, buf) {
- for (var i = 0; i < buf.length; i++) {
- acc.push(buf[i]);
- }
- return acc;
- }, []));
- }
-}
-
-function _spawnTestWithError(testFile, params, cb) {
- _spawnTest(true, testFile, params, cb);
-}
-
-function _spawnTestWithoutError(testFile, params, cb) {
- _spawnTest(false, testFile, params, cb);
-}
-
-function _spawnTest(passError, testFile, params, cb) {
- var
- node_path = process.argv[0],
- command_args = [ path.join(__dirname, testFile) ].concat(params),
- stdoutBufs = [],
- stderrBufs = [],
- child,
- done = false,
- stderrDone = false,
- stdoutDone = false;
-
- // spawn doesn’t have the quoting problems that exec does,
- // especially when going for Windows portability.
- child = spawn(node_path, command_args);
- child.stdin.end();
- // Cannot use 'close' event because not on node-0.6.
- function _close() {
- var
- stderr = _bufferConcat(stderrBufs),
- stdout = _bufferConcat(stdoutBufs);
- if (stderrDone && stdoutDone && !done) {
- done = true;
- if (passError) {
- if (stderr.length > 0) {
- return cb(stderr.toString());
- }
- }
- return cb(null, _bufferConcat(stdoutBufs).toString());
- }
- }
- if (passError) {
- child.on('error', function _spawnError(err) {
- if (!done) {
- done = true;
- cb(err);
- }
- });
- }
- child.stdout.on('data', function _stdoutData(data) {
- stdoutBufs.push(data);
- }).on('close', function _stdoutEnd() {
- stdoutDone = true;
- _close();
- });
- child.stderr.on('data', function _stderrData(data) {
- stderrBufs.push(data);
- }).on('close', function _stderrEnd() {
- stderrDone = true;
- _close();
- });
-}
-
-function _testStat(stat, mode) {
- // getuid() and getgid() do not exist on Windows.
- if (process.getuid) {
- assert.equal(stat.uid, process.getuid(), 'should have the same UID');
- }
- if (process.getgid) {
- assert.equal(stat.gid, process.getgid(), 'should have the same GUID');
- }
- // mode values do not work properly on Windows. Ignore “group” and
- // “other” bits then. Ignore execute bit on that platform because it
- // doesn’t exist—even for directories.
- if (process.platform == 'win32') {
- assert.equal(stat.mode & 0666600, mode & 0666600);
- } else {
- assert.equal(stat.mode, mode);
- }
-}
-
-function _testPrefix(prefix) {
- return function _testPrefixGenerated(err, name) {
- assert.equal(path.basename(name).slice(0, prefix.length), prefix, 'should have the provided prefix');
- };
-}
-
-function _testPrefixSync(prefix) {
- return function _testPrefixGeneratedSync(result) {
- if (result instanceof Error) {
- throw result;
- }
- _testPrefix(prefix)(null, result.name, result.fd);
- };
-}
-
-function _testPostfix(postfix) {
- return function _testPostfixGenerated(err, name) {
- assert.equal(name.slice(name.length - postfix.length, name.length), postfix, 'should have the provided postfix');
- };
-}
-
-function _testPostfixSync(postfix) {
- return function _testPostfixGeneratedSync(result) {
- if (result instanceof Error) {
- throw result;
- }
- _testPostfix(postfix)(null, result.name, result.fd);
- };
-}
-
-function _testKeep(type, keep, cb) {
- _spawnTestWithError('keep.js', [ type, keep ], cb);
-}
-
-function _testKeepSync(type, keep, cb) {
- _spawnTestWithError('keep-sync.js', [ type, keep ], cb);
-}
-
-function _testGraceful(type, graceful, cb) {
- _spawnTestWithoutError('graceful.js', [ type, graceful ], cb);
-}
-
-function _testGracefulSync(type, graceful, cb) {
- _spawnTestWithoutError('graceful-sync.js', [ type, graceful ], cb);
-}
-
-function _assertNoDescriptor(err, name, fd) {
- assert.strictEqual(fd, undefined);
-}
-
-function _assertNoDescriptorSync(result) {
- assert.strictEqual(result.fd, undefined);
-}
-
-function _assertName(err, name) {
- assert.isString(name);
- assert.isNotZero(name.length, 'an empty string is not a valid name');
-}
-
-function _assertNameSync(result) {
- if (result instanceof Error) {
- throw result;
- }
- var name = typeof(result) == 'string' ? result : result.name;
- _assertName(null, name);
-}
-
-function _testName(expected){
- return function _testNameGenerated(err, name) {
- assert.equal(expected, name, 'should have the provided name');
- };
-}
-
-function _testNameSync(expected){
- return function _testNameGeneratedSync(result) {
- if (result instanceof Error) {
- throw result;
- }
- _testName(expected)(null, result.name, result.fd);
- };
-}
-
-function _testUnsafeCleanup(unsafe, cb) {
- _spawnTestWithoutError('unsafe.js', [ 'dir', unsafe ], cb);
-}
-
-function _testIssue62(cb) {
- _spawnTestWithoutError('issue62.js', [], cb);
-}
-
-function _testUnsafeCleanupSync(unsafe, cb) {
- _spawnTestWithoutError('unsafe-sync.js', [ 'dir', unsafe ], cb);
-}
-
-function _testIssue62Sync(cb) {
- _spawnTestWithoutError('issue62-sync.js', [], cb);
-}
-
-function _testIssue115File(cb) {
- _spawnTestWithError('issue115-file.js', [], cb);
-}
-
-function _testIssue115FileSync(cb) {
- _spawnTestWithError('issue115-file-sync.js', [], cb);
-}
-
-module.exports.testStat = _testStat;
-module.exports.testPrefix = _testPrefix;
-module.exports.testPrefixSync = _testPrefixSync;
-module.exports.testPostfix = _testPostfix;
-module.exports.testPostfixSync = _testPostfixSync;
-module.exports.testKeep = _testKeep;
-module.exports.testKeepSync = _testKeepSync;
-module.exports.testGraceful = _testGraceful;
-module.exports.testGracefulSync = _testGracefulSync;
-module.exports.assertName = _assertName;
-module.exports.assertNameSync = _assertNameSync;
-module.exports.assertNoDescriptor = _assertNoDescriptor;
-module.exports.assertNoDescriptorSync = _assertNoDescriptorSync;
-module.exports.testName = _testName;
-module.exports.testNameSync = _testNameSync;
-module.exports.testUnsafeCleanup = _testUnsafeCleanup;
-module.exports.testIssue62 = _testIssue62;
-module.exports.testIssue115File = _testIssue115File;
-module.exports.testIssue115FileSync = _testIssue115FileSync;
-module.exports.testUnsafeCleanupSync = _testUnsafeCleanupSync;
-module.exports.testIssue62Sync = _testIssue62Sync;
diff --git a/test/child-process.js b/test/child-process.js
new file mode 100644
index 0000000..2c6769f
--- /dev/null
+++ b/test/child-process.js
@@ -0,0 +1,103 @@
+// vim: expandtab:ts=2:sw=2
+
+var
+ fs = require('fs'),
+ path = require('path'),
+ exists = fs.exists || path.exists,
+ spawn = require('child_process').spawn;
+
+const ISTANBUL_PATH = path.join(__dirname, '..', 'node_modules', 'istanbul', 'lib', 'cli.js');
+
+module.exports.genericChildProcess = _spawnProcess('spawn-generic.js');
+module.exports.childProcess = _spawnProcess('spawn-custom.js');
+
+function _spawnProcess(spawnFile) {
+ return function (testCase, configFile, cb, signal) {
+ const
+ configFilePath = path.join(__dirname, 'outband', configFile),
+ commandArgs = [path.join(__dirname, spawnFile), configFilePath];
+
+ exists(configFilePath, function (configExists) {
+ if (configExists) return _doSpawn(commandArgs, cb, signal);
+
+ cb(new Error('ENOENT: configFile ' + configFilePath + ' does not exist'));
+ });
+ };
+}
+
+function _doSpawn(commandArgs, cb, signal) {
+ const
+ node_path = process.argv[0],
+ stdoutBufs = [],
+ stderrBufs = [];
+ let
+ child,
+ done = false,
+ stderrDone = false,
+ stdoutDone = false;
+
+ if (process.env.running_under_istanbul) {
+ commandArgs = [
+ ISTANBUL_PATH, 'cover', '--report' , 'none', '--print', 'none',
+ '--dir', path.join('coverage', 'json'), '--include-pid',
+ commandArgs[0], '--', commandArgs[1]
+ ];
+ }
+
+ // spawn doesn’t have the quoting problems that exec does,
+ // especially when going for Windows portability.
+ child = spawn(node_path, commandArgs);
+ child.stdin.end();
+
+ function _close() {
+ // prevent race conditions
+ if (stderrDone && stdoutDone && !done) {
+ const
+ stderr = _bufferConcat(stderrBufs).toString(),
+ stdout = _bufferConcat(stdoutBufs).toString();
+ done = true;
+ cb(null, stderr, stdout);
+ }
+ }
+
+ child.on('error', function _spawnError(err) {
+ if (!done) {
+ done = true;
+ cb(err);
+ }
+ });
+
+ child.stdout.on('data', function _stdoutData(data) {
+ stdoutBufs.push(data);
+ }).on('close', function _stdoutEnd() {
+ stdoutDone = true;
+ _close();
+ });
+
+ child.stderr.on('data', function _stderrData(data) {
+ stderrBufs.push(data);
+ }).on('close', function _stderrEnd() {
+ stderrDone = true;
+ _close();
+ });
+
+ if (signal) {
+ setTimeout(function () {
+ // SIGINT does not work on node <8.12.0
+ child.kill(signal);
+ }, 1000);
+ }
+}
+
+function _bufferConcat(buffers) {
+ if (Buffer.concat) {
+ return Buffer.concat.apply(this, arguments);
+ }
+
+ return new Buffer(buffers.reduce(function (acc, buf) {
+ for (let i = 0; i < buf.length; i++) {
+ acc.push(buf[i]);
+ }
+ return acc;
+ }, []));
+}
diff --git a/test/dir-sync-test.js b/test/dir-sync-test.js
index 24d5f40..90d90c9 100644
--- a/test/dir-sync-test.js
+++ b/test/dir-sync-test.js
@@ -1,232 +1,158 @@
/* eslint-disable no-octal */
+// vim: expandtab:ts=2:sw=2
var
- vows = require('vows'),
assert = require('assert'),
+ fs = require('fs'),
+ path = require('path'),
+ inbandStandardTests = require('./inband-standard'),
+ childProcess = require('./child-process').genericChildProcess,
+ assertions = require('./assertions'),
+ tmp = require('../lib/tmp');
+
+
+// make sure that everything gets cleaned up
+tmp.setGracefulCleanup();
+
+describe('tmp', function () {
+ describe('#dirSync()', function () {
+ describe('when running inband standard tests', function () {
+ inbandStandardTests(false, function before() {
+ this.topic = tmp.dirSync(this.opts);
+ }, true);
+
+ describe('with invalid tries', function () {
+ it('should result in an error on negative tries', function () {
+ try {
+ tmp.dirSync({ tries: -1 });
+ assert.fail('should have failed');
+ } catch (err) {
+ assert.ok(err instanceof Error);
+ }
+ });
+
+ it('should result in an error on non numeric tries', function () {
+ try {
+ tmp.dirSync({ tries: 'nan' });
+ assert.fail('should have failed');
+ } catch (err) {
+ assert.ok(err instanceof Error);
+ }
+ });
+
+ });
+ });
+
+ describe('when running issue specific inband tests', function () {
+ });
+
+ describe('when running standard outband tests', function () {
+ it('on graceful cleanup', function (done) {
+ childProcess(this, 'graceful-dir-sync.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (!stderr) return done(new Error('stderr expected'));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('on non graceful cleanup', function (done) {
+ childProcess(this, 'non-graceful-dir-sync.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (!stderr) return done(new Error('stderr expected'));
+ try {
+ assertions.assertExists(stdout);
+ fs.rmSync(stdout, { recursive: true });
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('on keep', function (done) {
+ childProcess(this, 'keep-dir-sync.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertExists(stdout);
+ fs.rmSync(stdout, { recursive: true });
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('on unlink (keep == false)', function (done) {
+ childProcess(this, 'unlink-dir-sync.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('on unsafe cleanup', function (done) {
+ childProcess(this, 'unsafe-sync.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('on non unsafe cleanup', function (done) {
+ childProcess(this, 'non-unsafe-sync.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertExists(stdout);
+ assertions.assertExists(path.join(stdout, 'should-be-removed.file'), true);
+ if (process.platform == 'win32') {
+ assertions.assertExists(path.join(stdout, 'symlinkme-target'), true);
+ } else {
+ assertions.assertExists(path.join(stdout, 'symlinkme-target'));
+ }
+ fs.rmSync(stdout, { recursive: true });
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+ });
+
+ describe('when running issue specific outband tests', function () {
+ it('on issue #62', function (done) {
+ childProcess(this, 'issue62-sync.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+ });
+ });
+});
- path = require('path'),
- fs = require('fs'),
- existsSync = fs.existsSync || path.existsSync,
-
- tmp = require('../lib/tmp.js'),
- Test = require('./base.js');
-
-
-function _testDir(mode) {
- return function _testDirGenerated(result) {
- assert.ok(existsSync(result.name), 'should exist');
-
- var stat = fs.statSync(result.name);
- assert.ok(stat.isDirectory(), 'should be a directory');
-
- Test.testStat(stat, mode);
- };
-}
-
-vows.describe('Synchronous directory creation').addBatch({
- 'when using without parameters': {
- topic: function () {
- return tmp.dirSync();
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should be a directory': _testDir(040700),
- 'should have the default prefix': Test.testPrefixSync('tmp-')
- },
-
- 'when using with prefix': {
- topic: function () {
- return tmp.dirSync({ prefix: 'something' });
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should be a directory': _testDir(040700),
- 'should have the provided prefix': Test.testPrefixSync('something')
- },
-
- 'when using with postfix': {
- topic: function () {
- return tmp.dirSync({ postfix: '.txt' });
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should be a directory': _testDir(040700),
- 'should have the provided postfix': Test.testPostfixSync('.txt')
- },
-
- 'when using template': {
- topic: function () {
- return tmp.dirSync({ template: path.join(tmp.tmpdir, 'clike-XXXXXX-postfix') });
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should be a directory': _testDir(040700),
- 'should have the provided prefix': Test.testPrefixSync('clike-'),
- 'should have the provided postfix': Test.testPostfixSync('-postfix')
- },
-
- 'when using name': {
- topic: function () {
- return tmp.dirSync({ name: 'using-name' });
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should have the provided name': Test.testNameSync(path.join(tmp.tmpdir, 'using-name')),
- 'should be a directory': function (result) {
- _testDir(040700)(result);
- result.removeCallback();
- assert.ok(!existsSync(result.name), 'Directory should be removed');
- }
- },
-
- 'when using multiple options': {
- topic: function () {
- return tmp.dirSync({ prefix: 'foo', postfix: 'bar', mode: 0750 });
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should be a directory': _testDir(040750),
- 'should have the provided prefix': Test.testPrefixSync('foo'),
- 'should have the provided postfix': Test.testPostfixSync('bar')
- },
-
- 'when using multiple options and mode': {
- topic: function () {
- return tmp.dirSync({ prefix: 'complicated', postfix: 'options', mode: 0755 });
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should be a directory': _testDir(040755),
- 'should have the provided prefix': Test.testPrefixSync('complicated'),
- 'should have the provided postfix': Test.testPostfixSync('options')
- },
-
- 'no tries': {
- topic: function () {
- try {
- return tmp.dirSync({ tries: -1 });
- }
- catch (e) {
- return e;
- }
- },
-
- 'should return with an error': function (topic) {
- assert.instanceOf(topic, Error);
- }
- },
-
- 'keep testing': {
- topic: function () {
- Test.testKeepSync('dir', '1', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a dir': function (err, name) {
- _testDir(040700)({ name: name });
- fs.rmdirSync(name);
- }
- },
-
- 'unlink testing': {
- topic: function () {
- Test.testKeepSync('dir', '0', this.callback);
- },
-
- 'should not return with error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'Directory should be removed');
- }
- },
-
- 'non graceful testing': {
- topic: function () {
- Test.testGracefulSync('dir', '0', this.callback);
- },
-
- 'should not return with error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a dir': function (err, name) {
- _testDir(040700)({ name: name });
- fs.rmdirSync(name);
- }
- },
-
- 'graceful testing': {
- topic: function () {
- Test.testGracefulSync('dir', '1', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'Directory should be removed');
- }
- },
-
- 'unsafeCleanup === true': {
- topic: function () {
- Test.testUnsafeCleanupSync('1', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'Directory should be removed');
- },
- 'should remove symlinked dir': function(err, name) {
- assert.ok(
- !existsSync(name + '/symlinkme-target'),
- 'should remove target'
- );
- },
- 'should not remove contents of symlink dir': function() {
- assert.ok(
- existsSync(__dirname + '/symlinkme/file.js'),
- 'should not remove symlinked directory\'s content'
- );
- }
- },
-
- 'unsafeCleanup === true with issue62 structure': {
- topic: function () {
- Test.testIssue62Sync(this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'Directory should be removed');
- }
- },
-
- 'unsafeCleanup === false': {
- topic: function () {
- Test.testUnsafeCleanupSync('0', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a directory': function (err, name) {
- _testDir(040700)({name:name});
- // make sure that everything gets cleaned up
- fs.unlinkSync(path.join(name, 'should-be-removed.file'));
- fs.unlinkSync(path.join(name, 'symlinkme-target'));
- fs.rmdirSync(name);
- }
- },
-
- 'remove callback': {
- topic: function () {
- return tmp.dirSync();
- },
-
- 'should return with a name': Test.assertNameSync,
- 'removeCallback should remove directory': function (result) {
- result.removeCallback();
- assert.ok(!existsSync(result.name), 'Directory should be removed');
- }
- }
-}).exportTo(module);
diff --git a/test/dir-test.js b/test/dir-test.js
index d128fe9..4bd2b52 100644
--- a/test/dir-test.js
+++ b/test/dir-test.js
@@ -1,227 +1,166 @@
/* eslint-disable no-octal */
+// vim: expandtab:ts=2:sw=2
var
- vows = require('vows'),
assert = require('assert'),
+ fs = require('fs'),
+ path = require('path'),
+ inbandStandardTests = require('./inband-standard'),
+ childProcess = require('./child-process').genericChildProcess,
+ assertions = require('./assertions'),
+ tmp = require('../lib/tmp');
+
+
+// make sure that everything gets cleaned up
+tmp.setGracefulCleanup();
+
+
+describe('tmp', function () {
+ describe('#dir()', function () {
+ describe('when running inband standard tests', function () {
+ inbandStandardTests(false, function before(done) {
+ var that = this;
+ tmp.dir(this.opts, function (err, name, removeCallback) {
+ if (err) return done(err);
+ that.topic = { name: name, removeCallback: removeCallback };
+ done();
+ });
+ });
+
+ describe('with invalid tries', function () {
+ it('should result in an error on negative tries', function (done) {
+ tmp.dir({ tries: -1 }, function (err) {
+ try {
+ assert.ok(err instanceof Error, 'should have failed');
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('should result in an error on non numeric tries', function (done) {
+ tmp.dir({ tries: 'nan' }, function (err) {
+ try {
+ assert.ok(err instanceof Error, 'should have failed');
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+ });
+ });
+
+ describe('when running issue specific inband tests', function () {
+ });
+
+ describe('when running standard outband tests', function () {
+ it('on graceful cleanup', function (done) {
+ childProcess(this, 'graceful-dir.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (!stderr) return done(new Error('stderr expected'));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ //fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('on non graceful cleanup', function (done) {
+ childProcess(this, 'non-graceful-dir.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (!stderr) return done(new Error('stderr expected'));
+ try {
+ assertions.assertExists(stdout);
+ fs.rmSync(stdout, { recursive: true });
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('on keep', function (done) {
+ childProcess(this, 'keep-dir.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertExists(stdout);
+ fs.rmSync(stdout, { recursive: true });
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('on unlink (keep == false)', function (done) {
+ childProcess(this, 'unlink-dir.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('on unsafe cleanup', function (done) {
+ childProcess(this, 'unsafe.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('on non unsafe cleanup', function (done) {
+ childProcess(this, 'non-unsafe.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertExists(stdout);
+ assertions.assertExists(path.join(stdout, 'should-be-removed.file'), true);
+ if (process.platform == 'win32')
+ assertions.assertExists(path.join(stdout, 'symlinkme-target'), true);
+ else
+ assertions.assertExists(path.join(stdout, 'symlinkme-target'));
+ fs.rmSync(stdout, { recursive: true });
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+ });
+
+ describe('when running issue specific outband tests', function () {
+ it('on issue #62', function (done) {
+ childProcess(this, 'issue62.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+ });
+ });
+});
- path = require('path'),
- fs = require('fs'),
- existsSync = fs.existsSync || path.existsSync,
-
- tmp = require('../lib/tmp.js'),
- Test = require('./base.js');
-
-
-function _testDir(mode) {
- return function _testDirGenerated(err, name) {
- assert.ok(existsSync(name), 'should exist');
-
- var stat = fs.statSync(name);
- assert.ok(stat.isDirectory(), 'should be a directory');
-
- Test.testStat(stat, mode);
- };
-}
-
-vows.describe('Directory creation').addBatch({
- 'when using without parameters': {
- topic: function () {
- tmp.dir(this.callback);
- },
-
- 'should be a directory': _testDir(040700),
- 'should have the default prefix': Test.testPrefix('tmp-')
- },
-
- 'when using with prefix': {
- topic: function () {
- tmp.dir({ prefix: 'something' }, this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a directory': _testDir(040700),
- 'should have the provided prefix': Test.testPrefix('something')
- },
-
- 'when using with postfix': {
- topic: function () {
- tmp.dir({ postfix: '.txt' }, this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a directory': _testDir(040700),
- 'should have the provided postfix': Test.testPostfix('.txt')
- },
-
- 'when using template': {
- topic: function () {
- tmp.dir({ template: path.join(tmp.tmpdir, 'clike-XXXXXX-postfix') }, this.callback);
- },
-
- 'should not return with error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a directory': _testDir(040700),
- 'should have the provided prefix': Test.testPrefix('clike-'),
- 'should have the provided postfix': Test.testPostfix('-postfix')
- },
-
- 'when using name': {
- topic: function () {
- tmp.dir({ name: 'using-name' }, this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a directory': _testDir(040700),
- 'should have the provided name': Test.testName(path.join(tmp.tmpdir, 'using-name'))
- },
-
- 'when using multiple options': {
- topic: function () {
- tmp.dir({ prefix: 'foo', postfix: 'bar', mode: 0750 }, this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a directory': _testDir(040750),
- 'should have the provided prefix': Test.testPrefix('foo'),
- 'should have the provided postfix': Test.testPostfix('bar')
- },
-
- 'when using multiple options and mode': {
- topic: function () {
- tmp.dir({ prefix: 'complicated', postfix: 'options', mode: 0755 }, this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a directory': _testDir(040755),
- 'should have the provided prefix': Test.testPrefix('complicated'),
- 'should have the provided postfix': Test.testPostfix('options')
- },
-
- 'no tries': {
- topic: function () {
- tmp.dir({ tries: -1 }, this.callback);
- },
-
- 'should return with an error': assert.isObject
- },
-
- 'keep testing': {
- topic: function () {
- Test.testKeep('dir', '1', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a dir': function (err, name) {
- _testDir(040700)(err, name);
- fs.rmdirSync(name);
- }
- },
-
- 'unlink testing': {
- topic: function () {
- Test.testKeep('dir', '0', this.callback);
- },
-
- 'should not return with error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'Directory should be removed');
- }
- },
-
- 'non graceful testing': {
- topic: function () {
- Test.testGraceful('dir', '0', this.callback);
- },
-
- 'should not return with error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a dir': function (err, name) {
- _testDir(040700)(err, name);
- fs.rmdirSync(name);
- }
- },
-
- 'graceful testing': {
- topic: function () {
- Test.testGraceful('dir', '1', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'Directory should be removed');
- }
- },
-
- 'unsafeCleanup === true': {
- topic: function () {
- Test.testUnsafeCleanup('1', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'Directory should be removed');
- },
- 'should remove symlinked dir': function(err, name) {
- assert.ok(
- !existsSync(name + '/symlinkme-target'),
- 'should remove target'
- );
- },
- 'should not remove contents of symlink dir': function() {
- assert.ok(
- existsSync(__dirname + '/symlinkme/file.js'),
- 'should not remove symlinked directory\'s content'
- );
- }
- },
-
- 'unsafeCleanup === true with issue62 structure': {
- topic: function () {
- Test.testIssue62(this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'Directory should be removed');
- }
- },
-
- 'unsafeCleanup === false': {
- topic: function () {
- Test.testUnsafeCleanup('0', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a directory': function (err, name) {
- _testDir(040700)(err, name);
- // make sure that everything gets cleaned up
- fs.unlinkSync(path.join(name, 'should-be-removed.file'));
- fs.unlinkSync(path.join(name, 'symlinkme-target'));
- fs.rmdirSync(name);
- }
- },
-
- 'remove callback': {
- topic: function () {
- tmp.dir(this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'removeCallback should remove directory': function (_err, name, removeCallback) {
- removeCallback();
- assert.ok(!existsSync(name), 'Directory should be removed');
- }
- }
-}).exportTo(module);
diff --git a/test/file-sync-test.js b/test/file-sync-test.js
index bd3414a..f395b25 100644
--- a/test/file-sync-test.js
+++ b/test/file-sync-test.js
@@ -1,242 +1,139 @@
/* eslint-disable no-octal */
+// vim: expandtab:ts=2:sw=2
var
- vows = require('vows'),
assert = require('assert'),
-
- path = require('path'),
- fs = require('fs'),
- existsSync = fs.existsSync || path.existsSync,
-
- tmp = require('../lib/tmp.js'),
- Test = require('./base.js');
-
-
-function _testFile(mode, fdTest) {
- return function _testFileGenerated(result) {
- assert.ok(existsSync(result.name), 'should exist');
-
- var stat = fs.statSync(result.name);
- assert.equal(stat.size, 0, 'should have zero size');
- assert.ok(stat.isFile(), 'should be a file');
-
- Test.testStat(stat, mode);
-
- // check with fstat as well (fd checking)
- if (fdTest) {
- var fstat = fs.fstatSync(result.fd);
- assert.deepEqual(fstat, stat, 'fstat results should be the same');
-
- var data = new Buffer('something');
- assert.equal(fs.writeSync(result.fd, data, 0, data.length, 0), data.length, 'should be writable');
- assert.ok(!fs.closeSync(result.fd), 'should not return with error');
- }
- };
-}
-
-function _testFileNoDescriptor(mode) {
- return function _testFileNoDescriptor(result) {
- assert.ok(existsSync(result.name), 'should exist');
-
- var stat = fs.statSync(result.name);
- assert.equal(stat.size, 0, 'should have zero size');
- assert.ok(stat.isFile(), 'should be a file');
-
- Test.testStat(stat, mode);
-
- assert.strictEqual(result.fd, undefined);
- };
-}
-
-function _testFileAfterDetachRemove(mode) {
- return function _testFileAfterDetachRemove(result) {
- assert.ok(!existsSync(result.name), 'File should be removed');
-
- var fstat = fs.fstatSync(result.fd);
- assert.equal(fstat.size, 0, 'should have zero size');
- assert.ok(fstat.isFile(), 'should be a file');
- Test.testStat(fstat, mode);
-
- var data = new Buffer('something');
- assert.equal(fs.writeSync(result.fd, data, 0, data.length, 0), data.length, 'should be writable');
- assert.ok(!fs.closeSync(result.fd), 'should not return with error');
- };
-}
-
-vows.describe('Synchronous file creation').addBatch({
- 'when using without parameters': {
- topic: function () {
- return tmp.fileSync();
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should be a file': _testFile(0100600, true),
- 'should have the default prefix': Test.testPrefixSync('tmp-'),
- 'should have the default postfix': Test.testPostfixSync('.tmp')
- },
-
- 'when using with prefix': {
- topic: function () {
- return tmp.fileSync({ prefix: 'something' });
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should be a file': _testFile(0100600, true),
- 'should have the provided prefix': Test.testPrefixSync('something')
- },
-
- 'when using with postfix': {
- topic: function () {
- return tmp.fileSync({ postfix: '.txt' });
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should be a file': _testFile(0100600, true),
- 'should have the provided postfix': Test.testPostfixSync('.txt')
- },
-
- 'when using template': {
- topic: function () {
- return tmp.fileSync({ template: path.join(tmp.tmpdir, 'clike-XXXXXX-postfix') });
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should be a file': _testFile(0100600, true),
- 'should have the provided prefix': Test.testPrefixSync('clike-'),
- 'should have the provided postfix': Test.testPostfixSync('-postfix')
- },
-
- 'when using name': {
- topic: function () {
- return tmp.fileSync({ name: 'using-name-sync.tmp' });
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should have the provided name': Test.testNameSync(path.join(tmp.tmpdir, 'using-name-sync.tmp')),
- 'should be a file': function (result) {
- _testFile(0100600, true);
- fs.unlinkSync(result.name);
- }
- },
-
- 'when using multiple options': {
- topic: function () {
- return tmp.fileSync({ prefix: 'foo', postfix: 'bar', mode: 0640 });
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should be a file': _testFile(0100640, true),
- 'should have the provided prefix': Test.testPrefixSync('foo'),
- 'should have the provided postfix': Test.testPostfixSync('bar')
- },
-
- 'when using multiple options and mode': {
- topic: function () {
- return tmp.fileSync({ prefix: 'complicated', postfix: 'options', mode: 0644 });
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should be a file': _testFile(0100644, true),
- 'should have the provided prefix': Test.testPrefixSync('complicated'),
- 'should have the provided postfix': Test.testPostfixSync('options')
- },
-
- 'no tries': {
- topic: function () {
- try {
- return tmp.fileSync({ tries: -1 });
- }
- catch (e) {
- return e;
- }
- },
-
- 'should return with an error': function (topic) {
- assert.instanceOf(topic, Error);
- }
- },
-
- 'keep testing': {
- topic: function () {
- Test.testKeepSync('file', '1', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a file': function (err, name) {
- _testFile(0100600, false)({name:name});
- fs.unlinkSync(name);
- }
- },
-
- 'unlink testing': {
- topic: function () {
- Test.testKeepSync('file', '0', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'File should be removed');
- }
- },
-
- 'non graceful testing': {
- topic: function () {
- Test.testGracefulSync('file', '0', this.callback);
- },
-
- 'should not return with error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a file': function (err, name) {
- _testFile(0100600, false)({name:name});
- fs.unlinkSync(name);
- }
- },
-
- 'graceful testing': {
- topic: function () {
- Test.testGracefulSync('file', '1', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'File should be removed');
- }
- },
-
- 'remove callback': {
- topic: function () {
- return tmp.fileSync();
- },
-
- 'should return with a name': Test.assertNameSync,
- 'removeCallback should remove file': function (result) {
- result.removeCallback();
- assert.ok(!existsSync(result.name), 'File should be removed');
- }
- },
-
- 'when using discardDescriptor': {
- topic: function () {
- return tmp.fileSync({ discardDescriptor: true });
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should not return with a descriptor': Test.assertNoDescriptorSync,
- 'should be a file': _testFileNoDescriptor(0100600),
- },
-
- 'when using detachDescriptor': {
- topic: function () {
- var result = tmp.fileSync({ detachDescriptor: true });
- result.removeCallback();
- return result;
- },
-
- 'should return with a name': Test.assertNameSync,
- 'should have working descriptor after removeCallback': _testFileAfterDetachRemove(0100600),
- }
-
-}).exportTo(module);
+ fs = require('fs'),
+ inbandStandardTests = require('./inband-standard'),
+ assertions = require('./assertions'),
+ childProcess = require('./child-process').genericChildProcess,
+ tmp = require('../lib/tmp');
+
+
+// make sure that everything gets cleaned up
+tmp.setGracefulCleanup();
+
+
+describe('tmp', function () {
+ describe('#fileSync()', function () {
+ describe('when running inband standard tests', function () {
+ inbandStandardTests(true, function before() {
+ this.topic = tmp.fileSync(this.opts);
+ }, true);
+
+ describe('with invalid tries', function () {
+ it('should result in an error on negative tries', function () {
+ try {
+ tmp.fileSync({ tries: -1 });
+ assert.fail('should have failed');
+ } catch (err) {
+ assert.ok(err instanceof Error);
+ }
+ });
+
+ it('should result in an error on non numeric tries', function () {
+ try {
+ tmp.fileSync({ tries: 'nan' });
+ assert.fail('should have failed');
+ } catch (err) {
+ assert.ok(err instanceof Error);
+ }
+ });
+ });
+ });
+
+ describe('when running issue specific inband tests', function () {
+ it('on issue #182: should not replace empty postfix with ".tmp"', function () {
+ const tmpobj = tmp.fileSync({ postfix: '' });
+ assert.ok(!tmpobj.name.endsWith('.tmp'));
+ });
+ });
+
+ describe('when running standard outband tests', function () {
+ it('on graceful', function (done) {
+ childProcess(this, 'graceful-file-sync.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (!stderr) return done(new Error('stderr expected'));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('on non graceful', function (done) {
+ childProcess(this, 'non-graceful-file-sync.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (!stderr) return done(new Error('stderr expected'));
+ try {
+ assertions.assertExists(stdout, true);
+ fs.rmSync(stdout, { recursive: true });
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('on keep', function (done) {
+ childProcess(this, 'keep-file-sync.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertExists(stdout, true);
+ fs.rmSync(stdout, { recursive: true });
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('on unlink (keep == false)', function (done) {
+ childProcess(this, 'unlink-file-sync.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+ });
+
+ describe('when running issue specific outband tests', function () {
+ it('on issue #115', function (done) {
+ childProcess(this, 'issue115-sync.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+ it('on issue #115', function (done) {
+ childProcess(this, 'issue115-sync.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+ });
+ });
+});
diff --git a/test/file-test.js b/test/file-test.js
index a7ee1ab..c9feeef 100644
--- a/test/file-test.js
+++ b/test/file-test.js
@@ -1,271 +1,142 @@
/* eslint-disable no-octal */
+// vim: expandtab:ts=2:sw=2
var
- vows = require('vows'),
assert = require('assert'),
+ fs = require('fs'),
+ inbandStandardTests = require('./inband-standard'),
+ assertions = require('./assertions'),
+ childProcess = require('./child-process').genericChildProcess,
+ tmp = require('../lib/tmp');
- path = require('path'),
- fs = require('fs'),
- existsSync = fs.existsSync || path.existsSync,
- tmp = require('../lib/tmp.js'),
- Test = require('./base.js');
+// make sure that everything gets cleaned up
+tmp.setGracefulCleanup();
+describe('tmp', function () {
+ describe('#file()', function () {
+ describe('when running inband standard tests', function () {
-function _testFile(mode, fdTest) {
- return function _testFileGenerated(err, name, fd) {
- assert.ok(existsSync(name), 'should exist');
+ inbandStandardTests(true, function before(done) {
+ var that = this;
- var stat = fs.statSync(name);
- assert.equal(stat.size, 0, 'should have zero size');
- assert.ok(stat.isFile(), 'should be a file');
-
- Test.testStat(stat, mode);
-
- // check with fstat as well (fd checking)
- if (fdTest) {
- var fstat = fs.fstatSync(fd);
- assert.deepEqual(fstat, stat, 'fstat results should be the same');
-
- var data = new Buffer('something');
- assert.equal(fs.writeSync(fd, data, 0, data.length, 0), data.length, 'should be writable');
- assert.ok(!fs.closeSync(fd), 'should not return with error');
- }
- };
-}
-
-function _testFileNoDescriptor(mode) {
- return function _testFileNoDescriptor(err, name, fd) {
- assert.ok(existsSync(name), 'should exist');
-
- var stat = fs.statSync(name);
- assert.equal(stat.size, 0, 'should have zero size');
- assert.ok(stat.isFile(), 'should be a file');
-
- Test.testStat(stat, mode);
-
- assert.strictEqual(fd, undefined);
- };
-}
-
-function _testFileAfterDetachRemove(mode) {
- return function _testFileAfterDetachRemove(err, name, fd) {
- assert.ok(!existsSync(name), 'File should be removed');
-
- var fstat = fs.fstatSync(fd);
- assert.equal(fstat.size, 0, 'should have zero size');
- assert.ok(fstat.isFile(), 'should be a file');
- Test.testStat(fstat, mode);
-
- var data = new Buffer('something');
- assert.equal(fs.writeSync(fd, data, 0, data.length, 0), data.length, 'should be writable');
- assert.ok(!fs.closeSync(fd), 'should not return with error');
- };
-}
-
-vows.describe('File creation').addBatch({
- 'when using without parameters': {
- topic: function () {
- tmp.file(this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a file': _testFile(0100600, true),
- 'should have the default prefix': Test.testPrefix('tmp-'),
- 'should have the default postfix': Test.testPostfix('.tmp')
- },
-
- 'when using with prefix': {
- topic: function () {
- tmp.file({ prefix: 'something' }, this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a file': _testFile(0100600, true),
- 'should have the provided prefix': Test.testPrefix('something')
- },
-
- 'when using with postfix': {
- topic: function () {
- tmp.file({ postfix: '.txt' }, this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a file': _testFile(0100600, true),
- 'should have the provided postfix': Test.testPostfix('.txt')
- },
-
- 'when using template': {
- topic: function () {
- tmp.file({ template: path.join(tmp.tmpdir, 'clike-XXXXXX-postfix') }, this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a file': _testFile(0100600, true),
- 'should have the provided prefix': Test.testPrefix('clike-'),
- 'should have the provided postfix': Test.testPostfix('-postfix')
- },
-
- 'when using name': {
- topic: function () {
- tmp.file({ name: 'using-name.tmp' }, this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should have the provided name': Test.testName(path.join(tmp.tmpdir, 'using-name.tmp')),
- 'should be a file': function (err, name) {
- _testFile(0100600, true);
- fs.unlinkSync(name);
- }
- },
-
- 'when using discardDescriptor': {
- topic: function () {
- tmp.file({ discardDescriptor: true }, this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not return with a descriptor': Test.assertNoDescriptor,
- 'should be a file': _testFileNoDescriptor(0100600),
- },
-
- 'when using detachDescriptor': {
- topic: function () {
- var cb = this.callback;
- tmp.file({ detachDescriptor: true }, function (err, name, fd, removeCallback) {
- removeCallback();
- return cb(err, name, fd);
+ tmp.file(this.opts, function (err, name, fd, removeCallback) {
+ if (err) return done(err);
+ that.topic = { name: name, fd: fd, removeCallback: removeCallback };
+ done();
+ });
});
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should have working descriptor after removeCallback': _testFileAfterDetachRemove(0100600),
- },
- 'when using multiple options': {
- topic: function () {
- tmp.file({ prefix: 'foo', postfix: 'bar', mode: 0640 }, this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a file': _testFile(0100640, true),
- 'should have the provided prefix': Test.testPrefix('foo'),
- 'should have the provided postfix': Test.testPostfix('bar')
- },
-
- 'when using multiple options and mode': {
- topic: function () {
- tmp.file({ prefix: 'complicated', postfix: 'options', mode: 0644 }, this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a file': _testFile(0100644, true),
- 'should have the provided prefix': Test.testPrefix('complicated'),
- 'should have the provided postfix': Test.testPostfix('options')
- },
-
- 'no tries': {
- topic: function () {
- tmp.file({ tries: -1 }, this.callback);
- },
-
- 'should not be created': assert.isObject
- },
-
- 'keep testing': {
- topic: function () {
- Test.testKeep('file', '1', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a file': function (err, name) {
- _testFile(0100600, false)(err, name, null);
- fs.unlinkSync(name);
- }
- },
-
- 'unlink testing': {
- topic: function () {
- Test.testKeep('file', '0', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'File should be removed');
- }
- },
-
- 'non graceful testing': {
- topic: function () {
- Test.testGraceful('file', '0', this.callback);
- },
-
- 'should not return with error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should be a file': function (err, name) {
- _testFile(0100600, false)(err, name, null);
- fs.unlinkSync(name);
- }
- },
-
- 'graceful testing': {
- topic: function () {
- Test.testGraceful('file', '1', this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'File should be removed');
- }
- },
-
- 'remove callback': {
- topic: function () {
- tmp.file(this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'removeCallback should remove file': function (_err, name, _fd, removeCallback) {
- removeCallback();
- assert.ok(!existsSync(name), 'File should be removed');
- }
- },
-
- 'issue115 async: user deleted tmp file prior to cleanup': {
- topic: function () {
- Test.testIssue115File(this.callback);
- },
-
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'File should be removed');
- }
- },
+ describe('with invalid tries', function () {
+ it('should result in an error on negative tries', function (done) {
+ tmp.file({ tries: -1 }, function (err) {
+ try {
+ assert.ok(err instanceof Error, 'should have failed');
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('should result in an error on non numeric tries', function (done) {
+ tmp.file({ tries: 'nan' }, function (err) {
+ try {
+ assert.ok(err instanceof Error, 'should have failed');
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+ });
+ });
+
+ describe('when running issue specific inband tests', function () {
+ it('on issue #182: should not replace empty postfix with ".tmp"', function (done) {
+ tmp.file({ postfix: '' }, function (err, path) {
+ try {
+ assert.ok(!path.endsWith('.tmp'));
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+ });
+
+ describe('when running standard outband tests', function () {
+ it('on graceful', function (done) {
+ childProcess(this, 'graceful-file.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (!stderr) return done(new Error('stderr expected'));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
- 'issue115 sync: user deleted tmp file prior to cleanup': {
- topic: function () {
- Test.testIssue115FileSync(this.callback);
- },
+ it('on non graceful', function (done) {
+ childProcess(this, 'non-graceful-file.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (!stderr) return done(new Error('stderr expected'));
+ try {
+ assertions.assertExists(stdout, true);
+ fs.rmSync(stdout, { recursive: true });
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
- 'should not return with an error': assert.isNull,
- 'should return with a name': Test.assertName,
- 'should not exist': function (err, name) {
- assert.ok(!existsSync(name), 'File should be removed');
- }
- },
+ it('on keep', function (done) {
+ childProcess(this, 'keep-file.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertExists(stdout, true);
+ fs.rmSync(stdout, { recursive: true });
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
-}).exportTo(module);
+ it('on unlink (keep == false)', function (done) {
+ childProcess(this, 'unlink-file.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+ });
+
+ describe('when running issue specific outband tests', function () {
+ it('on issue #115', function (done) {
+ childProcess(this, 'issue115.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ if (stderr) return done(new Error(stderr));
+ try {
+ assertions.assertDoesNotExist(stdout);
+ } catch (err) {
+ fs.rmSync(stdout, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ });
+ });
+ });
+});
\ No newline at end of file
diff --git a/test/graceful-sync.js b/test/graceful-sync.js
deleted file mode 100644
index 37766ff..0000000
--- a/test/graceful-sync.js
+++ /dev/null
@@ -1,20 +0,0 @@
-var
- tmp = require('../lib/tmp'),
- spawn = require('./spawn-sync');
-
-var graceful = spawn.arg;
-
-if (graceful) {
- tmp.setGracefulCleanup();
-}
-
-try {
- var result = spawn.tmpFunction();
- spawn.out(result.name, function () {
- throw new Error('Thrown on purpose');
- });
-}
-catch (e) {
- spawn.err(e, spawn.exit);
-}
-
diff --git a/test/graceful.js b/test/graceful.js
deleted file mode 100644
index dbe554e..0000000
--- a/test/graceful.js
+++ /dev/null
@@ -1,15 +0,0 @@
-var
- tmp = require('../lib/tmp'),
- spawn = require('./spawn');
-
-var graceful = spawn.arg;
-
-if (graceful) {
- tmp.setGracefulCleanup();
-}
-
-spawn.tmpFunction(function (err, name) {
- spawn.out(name, function () {
- throw new Error('Thrown on purpose');
- });
-});
diff --git a/test/inband-standard.js b/test/inband-standard.js
new file mode 100644
index 0000000..3b5e5d5
--- /dev/null
+++ b/test/inband-standard.js
@@ -0,0 +1,111 @@
+/* eslint-disable no-octal */
+// vim: expandtab:ts=2:sw=2
+
+var
+ fs = require('fs'),
+ path = require('path'),
+ assertions = require('./assertions'),
+ tmp = require('../lib/tmp');
+
+module.exports = function inbandStandard(isFile, beforeHook, sync = false) {
+ var testMode = isFile ? 0o600 : 0o700;
+ describe('without any parameters', inbandStandardTests({ mode: testMode, prefix: 'tmp-' }, null, isFile, beforeHook, sync));
+ describe('with prefix', inbandStandardTests({ mode: testMode, prefix: 'tmp-' }, { prefix: 'tmp-something' }, isFile, beforeHook, sync));
+ describe('with postfix', inbandStandardTests({ mode: testMode, prefix: 'tmp-' }, { postfix: '.txt' }, isFile, beforeHook, sync));
+ describe('with template and no leading path', inbandStandardTests({ mode: testMode, prefix: 'tmp-clike-', postfix: '-postfix' }, { template: 'tmp-clike-XXXXXX-postfix' }, isFile, beforeHook, sync));
+ describe('with template and leading path', inbandStandardTests({ mode: testMode, prefix: 'tmp-clike-', postfix: '-postfix' }, { template: path.join(tmp.tmpdir, 'tmp-clike-XXXXXX-postfix')}, isFile, beforeHook, sync));
+ describe('with name', inbandStandardTests({ mode: testMode }, { name: 'tmp-using-name' }, isFile, beforeHook, sync));
+ describe('with mode', inbandStandardTests(null, { mode: 0o755 }, isFile, beforeHook, sync));
+ describe('with multiple options', inbandStandardTests(null, { prefix: 'tmp-multiple', postfix: 'bar', mode: 0o750 }, isFile, beforeHook, sync));
+ describe('with tmpdir option', inbandStandardTests(null, { tmpdir: path.join(tmp.tmpdir, 'tmp-external'), mode: 0o750 }, isFile, beforeHook, sync));
+ if (isFile) {
+ describe('with discardDescriptor', inbandStandardTests(null, { mode: testMode, discardDescriptor: true }, isFile, beforeHook, sync));
+ describe('with detachDescriptor', inbandStandardTests(null, { mode: testMode, detachDescriptor: true }, isFile, beforeHook, sync));
+ }
+};
+
+
+function inbandStandardTests(testOpts, opts, isFile, beforeHook, sync = false) {
+ return function () {
+ opts = opts || {};
+ testOpts = testOpts || {};
+
+ // topic reference will be created by the beforeHook
+ const topic = { topic: null, opts: opts };
+
+ // hack for tmpdir option, otherwise the whole test shebang would have to be refactored
+ if (opts.tmpdir) {
+ if (!fs.existsSync(opts.tmpdir)) {
+ // let tmp cleanup the dir on process exit, also we do not care if it is left over
+ tmp.dirSync({name: path.relative(tmp.tmpdir, opts.tmpdir), unsafeCleanup: true});
+ }
+ }
+
+ // bind everything to topic so we avoid global
+ before(beforeHook.bind(topic));
+
+ it('should return a proper result', function () {
+ assertions.assertProperResult(this.topic, isFile && !opts.discardDescriptor);
+ }.bind(topic));
+
+ it('temporary ' + (isFile ? 'file' : 'directory') + ' should exist', function () {
+ assertions.assertExists(this.topic.name, isFile);
+ }.bind(topic));
+
+ it('temporary ' + (isFile ? 'file' : 'directory') + ' should have the expected mode', function () {
+ assertions.assertMode(this.topic.name, testOpts.mode || opts.mode);
+ }.bind(topic));
+
+ if(testOpts.prefix || opts.prefix) {
+ it('should have the expected prefix', function () {
+ assertions.assertPrefix(this.topic.name, testOpts.prefix || opts.prefix);
+ }.bind(topic));
+ }
+
+ if (opts.postfix || testOpts.postfix) {
+ it('should have the expected postfix', function () {
+ assertions.assertPostfix(this.topic.name, testOpts.postfix || opts.postfix);
+ }.bind(topic));
+ }
+
+ it('should have been created in the expected directory', function () {
+ assertions.assertDir(this.topic.name, testOpts.dir || opts.dir || opts.tmpdir || tmp.tmpdir);
+ }.bind(topic));
+
+ if (opts.name) {
+ it('should have the expected name', function () {
+ assertions.assertName(this.topic.name, opts.name);
+ }.bind(topic));
+ }
+
+ if (sync) {
+ it('should have a working removeCallback', function () {
+ try {
+ this.topic.removeCallback();
+ } catch (err) {
+ // important: remove file or dir unconditionally
+ try {
+ fs.rmSync(this.topic.name, { recursive: true });
+ } catch (_ignored) {
+ // ignore
+ }
+ throw err;
+ }
+ }.bind(topic));
+ } else {
+ it('should have a working removeCallback', function (done) {
+ const self = this;
+ this.topic.removeCallback(function (err) {
+ if (err) return done(err);
+ try {
+ assertions.assertDoesNotExist(self.topic.name);
+ } catch (err) {
+ fs.rmSync(self.topic.name, { recursive: true });
+ return done(err);
+ }
+ done();
+ });
+ }.bind(topic));
+ }
+ };
+}
diff --git a/test/issue115-file-sync.js b/test/issue115-file-sync.js
deleted file mode 100644
index 35e84c9..0000000
--- a/test/issue115-file-sync.js
+++ /dev/null
@@ -1,25 +0,0 @@
-var
- fs = require('fs'),
- join = require('path').join,
- tmp = require('../lib/tmp'),
- spawn = require('./spawn');
-
-spawn.tmpFunction({ unsafeCleanup: true }, function (err, name) {
- if (err) {
- spawn.err(err, spawn.exit);
- return;
- }
-
- try {
- // creates a tmp file and then closes the file descriptor as per issue 115
- // https://github.com/raszi/node-tmp/issues/115
-
- tmpobj = tmp.fileSync();
- fs.closeSync(tmpobj.fd);
- tmpobj.removeCallback();
- spawn.out(tmpobj.name, spawn.exit);
- } catch (e) {
- spawn.err(e.toString() + ' with code: ' + e.code + ' and errno: ' + e.errno, spawn.exit);
- }
-});
-
diff --git a/test/issue115-file.js b/test/issue115-file.js
deleted file mode 100644
index 8c5db8d..0000000
--- a/test/issue115-file.js
+++ /dev/null
@@ -1,26 +0,0 @@
-var
- fs = require('fs'),
- join = require('path').join,
- tmp = require('../lib/tmp'),
- spawn = require('./spawn');
-
-spawn.tmpFunction({ unsafeCleanup: true }, function (err, name) {
- if (err) {
- spawn.err(err, spawn.exit);
- return;
- }
-
- try {
- // creates a tmp file and then closes the file descriptor it as per issue 115
- // https://github.com/raszi/node-tmp/issues/115
-
- tmp.file(function (err, name, fd, callback) {
- fs.closeSync(fd);
- callback();
- spawn.out(name, spawn.exit);
- });
- } catch (e) {
- spawn.err(e.toString() + ' with code: ' + e.code + ' and errno: ' + e.errno, spawn.exit);
- }
-});
-
diff --git a/test/issue121-test.js b/test/issue121-test.js
new file mode 100644
index 0000000..dc98089
--- /dev/null
+++ b/test/issue121-test.js
@@ -0,0 +1,39 @@
+/* eslint-disable no-octal */
+// vim: expandtab:ts=2:sw=2
+
+const
+ assertions = require('./assertions'),
+ childProcess = require('./child-process').childProcess,
+ os = require('os'),
+ testCases = [
+ 'SIGINT',
+ 'SIGTERM'
+ ];
+
+// skip tests on win32
+const isWindows = os.platform() === 'win32';
+const tfunc = isWindows ? xit : it;
+
+describe('tmp', function () {
+ describe('issue121 - clean up on terminating signals', function () {
+ for (let tc of testCases) {
+ tfunc('for signal ' + tc, function (done) {
+ // increase timeout so that the child process may terminate in time
+ this.timeout(5000);
+ issue121Tests(tc)(done);
+ });
+ }
+ });
+});
+
+function issue121Tests(signal) {
+ return function (done) {
+ childProcess(this, 'issue121.json', function (err, stderr, stdout) {
+ if (err) return done(err);
+ else if (stderr) return done(new Error(stderr));
+
+ assertions.assertDoesNotExist(stdout);
+ done();
+ }, signal);
+ };
+}
diff --git a/test/issue62-sync.js b/test/issue62-sync.js
deleted file mode 100644
index 94840c6..0000000
--- a/test/issue62-sync.js
+++ /dev/null
@@ -1,27 +0,0 @@
-
-var
- fs = require('fs'),
- join = require('path').join,
- spawn = require('./spawn-sync');
-
-try {
- var result = spawn.tmpFunction({ unsafeCleanup: true });
- try {
- // creates structure from issue 62
- // https://github.com/raszi/node-tmp/issues/62
-
- fs.mkdirSync(join(result.name, 'issue62'));
-
- ['foo', 'bar'].forEach(function(subdir) {
- fs.mkdirSync(join(result.name, 'issue62', subdir));
- fs.writeFileSync(join(result.name, 'issue62', subdir, 'baz.txt'), '');
- });
-
- spawn.out(result.name, spawn.exit);
- } catch (e) {
- spawn.err(e.toString(), spawn.exit);
- }
-}
-catch (e) {
- spawn.err(e, spawn.exit);
-}
diff --git a/test/issue62.js b/test/issue62.js
deleted file mode 100644
index 004e190..0000000
--- a/test/issue62.js
+++ /dev/null
@@ -1,27 +0,0 @@
-var
- fs = require('fs'),
- join = require('path').join,
- spawn = require('./spawn');
-
-spawn.tmpFunction({ unsafeCleanup: true }, function (err, name) {
- if (err) {
- spawn.err(err, spawn.exit);
- return;
- }
-
- try {
- // creates structure from issue 62
- // https://github.com/raszi/node-tmp/issues/62
-
- fs.mkdirSync(join(name, 'issue62'));
-
- ['foo', 'bar'].forEach(function(subdir) {
- fs.mkdirSync(join(name, 'issue62', subdir));
- fs.writeFileSync(join(name, 'issue62', subdir, 'baz.txt'), '');
- });
-
- spawn.out(name, spawn.exit);
- } catch (e) {
- spawn.err(e.toString(), spawn.exit);
- }
-});
diff --git a/test/keep-sync.js b/test/keep-sync.js
deleted file mode 100644
index 2498a52..0000000
--- a/test/keep-sync.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var spawn = require('./spawn-sync');
-
-var keep = spawn.arg;
-
-try {
- var result = spawn.tmpFunction({ keep: keep });
- spawn.out(result.name, spawn.exit);
-}
-catch (e) {
- spawn.err(e.toString(), spawn.exit);
-}
-
diff --git a/test/keep.js b/test/keep.js
deleted file mode 100644
index 9538605..0000000
--- a/test/keep.js
+++ /dev/null
@@ -1,11 +0,0 @@
-var spawn = require('./spawn');
-
-var keep = spawn.arg;
-
-spawn.tmpFunction({ keep: keep }, function (err, name) {
- if (err) {
- spawn.err(err, spawn.exit);
- } else {
- spawn.out(name, spawn.exit);
- }
-});
diff --git a/test/mocha.opts b/test/mocha.opts
new file mode 100644
index 0000000..671ed4a
--- /dev/null
+++ b/test/mocha.opts
@@ -0,0 +1 @@
+--file ./test/setup-sigint-listener.js
\ No newline at end of file
diff --git a/test/name-inband-standard.js b/test/name-inband-standard.js
new file mode 100644
index 0000000..17ab0e1
--- /dev/null
+++ b/test/name-inband-standard.js
@@ -0,0 +1,52 @@
+/* eslint-disable no-octal */
+// vim: expandtab:ts=2:sw=2
+
+var
+ path = require('path'),
+ assertions = require('./assertions'),
+ tmp = require('../lib/tmp');
+
+
+module.exports = function inbandStandard(beforeHook) {
+ describe('without any parameters', inbandStandardTests({ prefix: 'tmp-' }, null, beforeHook));
+ describe('with prefix', inbandStandardTests(null, { prefix: 'something' }, beforeHook));
+ describe('with postfix', inbandStandardTests(null, { postfix: '.txt' }, beforeHook));
+ describe('with template and no leading path', inbandStandardTests({ prefix: 'clike-', postfix: '-postfix' }, { template: 'clike-XXXXXX-postfix' }, beforeHook));
+ describe('with template and leading path', inbandStandardTests({ prefix: 'clike-', postfix: '-postfix' }, { template: path.join(tmp.tmpdir, 'clike-XXXXXX-postfix')}, beforeHook));
+ describe('with multiple options', inbandStandardTests(null, { prefix: 'foo', postfix: 'bar', tries: 5 }, beforeHook));
+ describe('with name', inbandStandardTests(null, { name: 'using-name' }, beforeHook));
+};
+
+
+function inbandStandardTests(testOpts, opts, beforeHook) {
+ return function () {
+ opts = opts || {};
+ testOpts = testOpts || {};
+ const topic = { topic: null, opts: opts };
+
+ // bind everything to topic so we avoid global
+ before(beforeHook.bind(topic));
+
+ it('should return a proper result', function () {
+ assertions.assertName(this.topic);
+ }.bind(topic));
+
+ if (opts.prefix || testOpts.prefix) {
+ it('should have the expected prefix', function () {
+ assertions.assertPrefix(this.topic, testOpts.prefix || opts.prefix);
+ }.bind(topic));
+ }
+
+ if (opts.postfix || testOpts.postfix) {
+ it('should have the expected postfix', function () {
+ assertions.assertPostfix(this.topic, testOpts.postfix || opts.postfix);
+ }.bind(topic));
+ }
+
+ if (opts.name) {
+ it('should have the expected name', function () {
+ assertions.assertName(this.topic, opts.name);
+ }.bind(topic));
+ }
+ };
+}
diff --git a/test/name-sync-test.js b/test/name-sync-test.js
new file mode 100644
index 0000000..bfe4d9f
--- /dev/null
+++ b/test/name-sync-test.js
@@ -0,0 +1,55 @@
+/* eslint-disable no-octal */
+// vim: expandtab:ts=2:sw=2
+
+const assert = require('assert');
+const os = require('os');
+const inbandStandardTests = require('./name-inband-standard');
+const tmp = require('../lib/tmp');
+
+describe('tmp', function () {
+ describe('#tmpNameSync()', function () {
+ describe('when running inband standard tests', function () {
+ inbandStandardTests(function before() {
+ this.topic = tmp.tmpNameSync(this.opts);
+ });
+
+ describe('with invalid tries', function () {
+ it('should result in an error on negative tries', function () {
+ try {
+ tmp.tmpNameSync({ tries: -1 });
+ assert.fail('should have failed');
+ } catch (err) {
+ assert.ok(err instanceof Error);
+ }
+ });
+ it('should result in an error on non numeric tries', function () {
+ try {
+ tmp.tmpNameSync({ tries: 'nan' });
+ assert.fail('should have failed');
+ } catch (err) {
+ assert.ok(err instanceof Error);
+ }
+ });
+ });
+ });
+
+ describe('when running issue specific inband tests', function () {
+ describe('on issue #176', function () {
+ const origfn = os.tmpdir;
+ it('must fail on invalid os.tmpdir()', function () {
+ os.tmpdir = function () {
+ return undefined;
+ };
+ try {
+ tmp.tmpNameSync();
+ assert.fail('should have failed');
+ } catch (err) {
+ assert.ok(err instanceof Error);
+ } finally {
+ os.tmpdir = origfn;
+ }
+ });
+ });
+ });
+ });
+});
diff --git a/test/name-test.js b/test/name-test.js
index e7595b7..b6b3ef7 100644
--- a/test/name-test.js
+++ b/test/name-test.js
@@ -1,84 +1,67 @@
-/* eslint-disable no-octal, no-unused-vars */
-
-var
- vows = require('vows'),
- assert = require('assert'),
-
- path = require('path'),
-
- tmp = require('../lib/tmp.js'),
- Test = require('./base.js');
-
-vows.describe('Name creation').addBatch({
- 'when using without parameters': {
- topic: function () {
- tmp.tmpName(this.callback);
- },
-
- 'should not return with error': assert.isNull,
- 'should have the default prefix': Test.testPrefix('tmp-')
- },
-
- 'when using with prefix': {
- topic: function () {
- tmp.tmpName({ prefix: 'something' }, this.callback);
- },
-
- 'should not return with error': assert.isNull,
- 'should have the provided prefix': Test.testPrefix('something')
- },
-
- 'when using with postfix': {
- topic: function () {
- tmp.tmpName({ postfix: '.txt' }, this.callback);
- },
-
- 'should not return with error': assert.isNull,
- 'should have the provided postfix': Test.testPostfix('.txt')
-
- },
-
- 'when using template': {
- topic: function () {
- tmp.tmpName({ template: path.join(tmp.tmpdir, 'clike-XXXXXX-postfix') }, this.callback);
- },
-
- 'should not return with error': assert.isNull,
- 'should have the provided prefix': Test.testPrefix('clike-'),
- 'should have the provided postfix': Test.testPostfix('-postfix'),
- 'should have template filled': function (err, name) {
- assert.isTrue(/[a-zA-Z0-9]{6}/.test(name));
- }
- },
-
- 'when using multiple options': {
- topic: function () {
- tmp.tmpName({ prefix: 'foo', postfix: 'bar', tries: 5 }, this.callback);
- },
-
- 'should not return with error': assert.isNull,
- 'should have the provided prefix': Test.testPrefix('foo'),
- 'should have the provided postfix': Test.testPostfix('bar')
- },
-
- 'no tries': {
- topic: function () {
- tmp.tmpName({ tries: -1 }, this.callback);
- },
-
- 'should fail': function (err, _name) {
- assert.isObject(err);
- }
- },
-
- 'tries not numeric': {
- topic: function () {
- tmp.tmpName({ tries: 'hello'}, this.callback);
- },
-
- 'should fail': function (err, _name) {
- assert.isObject(err);
- }
- }
-
-}).exportTo(module);
+/* eslint-disable no-octal */
+// vim: expandtab:ts=2:sw=2
+
+const assert = require('assert');
+const os = require('os');
+const inbandStandardTests = require('./name-inband-standard');
+const tmp = require('../lib/tmp');
+
+describe('tmp', function () {
+ describe('#tmpName()', function () {
+ describe('when running inband standard tests', function () {
+ inbandStandardTests(function before(done) {
+ var that = this;
+ tmp.tmpName(this.opts, function (err, name) {
+ if (err) return done(err);
+ that.topic = name;
+ done();
+ });
+ });
+
+ describe('with invalid tries', function () {
+ it('should result in an error on negative tries', function (done) {
+ tmp.tmpName({ tries: -1 }, function (err) {
+ try {
+ assert.ok(err instanceof Error, 'should have failed');
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+
+ it('should result in an error on non numeric tries', function (done) {
+ tmp.tmpName({ tries: 'nan' }, function (err) {
+ try {
+ assert.ok(err instanceof Error, 'should have failed');
+ } catch (err) {
+ return done(err);
+ }
+ done();
+ });
+ });
+ });
+ });
+
+ describe('when running issue specific inband tests', function () {
+ describe('on issue #176', function () {
+ const origfn = os.tmpdir;
+ it('must fail on invalid os.tmpdir()', function (done) {
+ os.tmpdir = function () {
+ return undefined;
+ };
+ tmp.tmpName(function (err) {
+ try {
+ assert.ok(err instanceof Error, 'should have failed');
+ } catch (err) {
+ return done(err);
+ } finally {
+ os.tmpdir = origfn;
+ }
+ done();
+ });
+ });
+ });
+ });
+ });
+});
diff --git a/test/symlinkme/file.js b/test/outband/fixtures/symlinkme/file.js
similarity index 100%
rename from test/symlinkme/file.js
rename to test/outband/fixtures/symlinkme/file.js
diff --git a/test/outband/graceful-dir-sync.json b/test/outband/graceful-dir-sync.json
new file mode 100644
index 0000000..ec20262
--- /dev/null
+++ b/test/outband/graceful-dir-sync.json
@@ -0,0 +1,7 @@
+{
+ "tc": "graceful",
+ "async": false,
+ "file": false,
+ "options": {},
+ "graceful": true
+}
diff --git a/test/outband/graceful-dir.json b/test/outband/graceful-dir.json
new file mode 100644
index 0000000..d84a2bb
--- /dev/null
+++ b/test/outband/graceful-dir.json
@@ -0,0 +1,7 @@
+{
+ "tc": "graceful",
+ "async": true,
+ "type": "dir",
+ "options": {},
+ "graceful": true
+}
diff --git a/test/outband/graceful-file-sync.json b/test/outband/graceful-file-sync.json
new file mode 100644
index 0000000..2f544dd
--- /dev/null
+++ b/test/outband/graceful-file-sync.json
@@ -0,0 +1,7 @@
+{
+ "tc": "graceful",
+ "async": false,
+ "file": true,
+ "options": {},
+ "graceful": true
+}
diff --git a/test/outband/graceful-file.json b/test/outband/graceful-file.json
new file mode 100644
index 0000000..237ccfd
--- /dev/null
+++ b/test/outband/graceful-file.json
@@ -0,0 +1,7 @@
+{
+ "tc": "graceful",
+ "async": true,
+ "file": true,
+ "options": {},
+ "graceful": true
+}
diff --git a/test/outband/graceful.js b/test/outband/graceful.js
new file mode 100644
index 0000000..f86bfd1
--- /dev/null
+++ b/test/outband/graceful.js
@@ -0,0 +1,5 @@
+module.exports = function (result) {
+ this.out(result.name, function () {
+ throw new Error('(non-)graceful cleanup testing');
+ });
+};
diff --git a/test/outband/issue115-sync.js b/test/outband/issue115-sync.js
new file mode 100644
index 0000000..43b261b
--- /dev/null
+++ b/test/outband/issue115-sync.js
@@ -0,0 +1,10 @@
+var fs = require('fs');
+
+module.exports = function (result) {
+ // creates a tmp file and then closes the file descriptor as per issue 115
+ // https://github.com/raszi/node-tmp/issues/115
+ const self = this;
+ fs.closeSync(result.fd);
+ result.removeCallback();
+ self.out(result.name, self.exit);
+};
diff --git a/test/outband/issue115-sync.json b/test/outband/issue115-sync.json
new file mode 100644
index 0000000..81a8763
--- /dev/null
+++ b/test/outband/issue115-sync.json
@@ -0,0 +1,7 @@
+{
+ "tc": "issue115-sync",
+ "async": false,
+ "file": true,
+ "options": {},
+ "graceful": false
+}
diff --git a/test/outband/issue115.js b/test/outband/issue115.js
new file mode 100644
index 0000000..dc44ccc
--- /dev/null
+++ b/test/outband/issue115.js
@@ -0,0 +1,12 @@
+var fs = require('fs');
+
+module.exports = function (result) {
+ // creates a tmp file and then closes the file descriptor as per issue 115
+ // https://github.com/raszi/node-tmp/issues/115
+ const self = this;
+ fs.closeSync(result.fd);
+ result.removeCallback(function () {
+ self.out(result.name, self.exit);
+ });
+};
+
diff --git a/test/outband/issue115.json b/test/outband/issue115.json
new file mode 100644
index 0000000..08df720
--- /dev/null
+++ b/test/outband/issue115.json
@@ -0,0 +1,7 @@
+{
+ "tc": "issue115",
+ "async": true,
+ "file": true,
+ "options": {},
+ "graceful": false
+}
diff --git a/test/outband/issue121.js b/test/outband/issue121.js
new file mode 100644
index 0000000..87f8c28
--- /dev/null
+++ b/test/outband/issue121.js
@@ -0,0 +1,25 @@
+// vim: expandtab:ts=2:sw=2
+
+const tmp = require('../../lib/tmp');
+
+process.on('SIGINT', function () {
+ process.exit(0);
+});
+
+process.on('SIGTERM', function () {
+ process.exit(0);
+});
+
+// https://github.com/raszi/node-tmp/issues/121
+module.exports = function () {
+
+ tmp.setGracefulCleanup();
+
+ const result = tmp.dirSync({ unsafeCleanup: true });
+
+ this.out(result.name, function () { });
+
+ setTimeout(function () {
+ throw new Error('ran into timeout');
+ }, 10000);
+};
diff --git a/test/outband/issue121.json b/test/outband/issue121.json
new file mode 100644
index 0000000..2210135
--- /dev/null
+++ b/test/outband/issue121.json
@@ -0,0 +1,4 @@
+{
+ "graceful": true,
+ "tc": "issue121"
+}
diff --git a/test/outband/issue62-sync.json b/test/outband/issue62-sync.json
new file mode 100644
index 0000000..c4a7118
--- /dev/null
+++ b/test/outband/issue62-sync.json
@@ -0,0 +1,7 @@
+{
+ "tc": "issue62",
+ "async": false,
+ "file": false,
+ "options": { "unsafeCleanup":true },
+ "graceful": true
+}
diff --git a/test/outband/issue62.js b/test/outband/issue62.js
new file mode 100644
index 0000000..3dffd60
--- /dev/null
+++ b/test/outband/issue62.js
@@ -0,0 +1,16 @@
+var fs = require('fs');
+var join = require('path').join;
+
+module.exports = function (result) {
+ // creates structure from issue 62
+ // https://github.com/raszi/node-tmp/issues/62
+
+ fs.mkdirSync(join(result.name, 'issue62'));
+
+ ['foo', 'bar'].forEach(function(subdir) {
+ fs.mkdirSync(join(result.name, 'issue62', subdir));
+ fs.writeFileSync(join(result.name, 'issue62', subdir, 'baz.txt'), '');
+ });
+
+ this.out(result.name, this.exit);
+};
diff --git a/test/outband/issue62.json b/test/outband/issue62.json
new file mode 100644
index 0000000..457bd5e
--- /dev/null
+++ b/test/outband/issue62.json
@@ -0,0 +1,7 @@
+{
+ "tc": "issue62",
+ "async": true,
+ "file": false,
+ "options": { "unsafeCleanup":true },
+ "graceful": true
+}
diff --git a/test/outband/keep-dir-sync.json b/test/outband/keep-dir-sync.json
new file mode 100644
index 0000000..8652926
--- /dev/null
+++ b/test/outband/keep-dir-sync.json
@@ -0,0 +1,7 @@
+{
+ "tc": "keep",
+ "async": false,
+ "file": false,
+ "options": { "keep":true },
+ "graceful": false
+}
diff --git a/test/outband/keep-dir.json b/test/outband/keep-dir.json
new file mode 100644
index 0000000..a59f391
--- /dev/null
+++ b/test/outband/keep-dir.json
@@ -0,0 +1,7 @@
+{
+ "tc": "keep",
+ "async": true,
+ "file": false,
+ "options": { "keep":true },
+ "graceful": false
+}
diff --git a/test/outband/keep-file-sync.json b/test/outband/keep-file-sync.json
new file mode 100644
index 0000000..a57b40d
--- /dev/null
+++ b/test/outband/keep-file-sync.json
@@ -0,0 +1,7 @@
+{
+ "tc": "keep",
+ "async": false,
+ "file": true,
+ "options": { "keep":true },
+ "graceful": false
+}
diff --git a/test/outband/keep-file.json b/test/outband/keep-file.json
new file mode 100644
index 0000000..7487c43
--- /dev/null
+++ b/test/outband/keep-file.json
@@ -0,0 +1,7 @@
+{
+ "tc": "keep",
+ "async": true,
+ "file": true,
+ "options": { "keep":true },
+ "graceful": false
+}
diff --git a/test/outband/keep.js b/test/outband/keep.js
new file mode 100644
index 0000000..75dccea
--- /dev/null
+++ b/test/outband/keep.js
@@ -0,0 +1,3 @@
+module.exports = function (result) {
+ this.out(result.name);
+};
diff --git a/test/outband/non-graceful-dir-sync.json b/test/outband/non-graceful-dir-sync.json
new file mode 100644
index 0000000..af73d76
--- /dev/null
+++ b/test/outband/non-graceful-dir-sync.json
@@ -0,0 +1,7 @@
+{
+ "tc": "graceful",
+ "async": false,
+ "file": false,
+ "options": {},
+ "graceful": false
+}
diff --git a/test/outband/non-graceful-dir.json b/test/outband/non-graceful-dir.json
new file mode 100644
index 0000000..76edaa6
--- /dev/null
+++ b/test/outband/non-graceful-dir.json
@@ -0,0 +1,7 @@
+{
+ "tc": "graceful",
+ "async": true,
+ "file": false,
+ "options": {},
+ "graceful": false
+}
diff --git a/test/outband/non-graceful-file-sync.json b/test/outband/non-graceful-file-sync.json
new file mode 100644
index 0000000..089de4c
--- /dev/null
+++ b/test/outband/non-graceful-file-sync.json
@@ -0,0 +1,7 @@
+{
+ "tc": "graceful",
+ "async": false,
+ "file": true,
+ "options": {},
+ "graceful": false
+}
diff --git a/test/outband/non-graceful-file.json b/test/outband/non-graceful-file.json
new file mode 100644
index 0000000..a14e360
--- /dev/null
+++ b/test/outband/non-graceful-file.json
@@ -0,0 +1,7 @@
+{
+ "tc": "graceful",
+ "async": true,
+ "file": true,
+ "options": {},
+ "graceful": false
+}
diff --git a/test/outband/non-unsafe-sync.json b/test/outband/non-unsafe-sync.json
new file mode 100644
index 0000000..49fdfb9
--- /dev/null
+++ b/test/outband/non-unsafe-sync.json
@@ -0,0 +1,7 @@
+{
+ "tc": "unsafe",
+ "async": false,
+ "file": false,
+ "options": { "unsafeCleanup":false },
+ "graceful": false
+}
diff --git a/test/outband/non-unsafe.json b/test/outband/non-unsafe.json
new file mode 100644
index 0000000..1bc95ec
--- /dev/null
+++ b/test/outband/non-unsafe.json
@@ -0,0 +1,7 @@
+{
+ "tc": "unsafe",
+ "async": true,
+ "file": false,
+ "options": { "unsafeCleanup":false },
+ "graceful": false
+}
diff --git a/test/outband/unlink-dir-sync.json b/test/outband/unlink-dir-sync.json
new file mode 100644
index 0000000..1b0cf47
--- /dev/null
+++ b/test/outband/unlink-dir-sync.json
@@ -0,0 +1,7 @@
+{
+ "tc": "unlink",
+ "async": false,
+ "file": false,
+ "options": { "keep":false },
+ "graceful": false
+}
diff --git a/test/outband/unlink-dir.json b/test/outband/unlink-dir.json
new file mode 100644
index 0000000..07a4e7b
--- /dev/null
+++ b/test/outband/unlink-dir.json
@@ -0,0 +1,7 @@
+{
+ "tc": "unlink",
+ "async": true,
+ "file": false,
+ "options": { "keep":false },
+ "graceful": false
+}
diff --git a/test/outband/unlink-file-sync.json b/test/outband/unlink-file-sync.json
new file mode 100644
index 0000000..accec95
--- /dev/null
+++ b/test/outband/unlink-file-sync.json
@@ -0,0 +1,7 @@
+{
+ "tc": "unlink",
+ "async": false,
+ "file": true,
+ "options": { "keep":false },
+ "graceful": false
+}
diff --git a/test/outband/unlink-file.json b/test/outband/unlink-file.json
new file mode 100644
index 0000000..52ab534
--- /dev/null
+++ b/test/outband/unlink-file.json
@@ -0,0 +1,7 @@
+{
+ "tc": "unlink",
+ "async": true,
+ "file": true,
+ "options": { "keep":false },
+ "graceful": false
+}
diff --git a/test/outband/unlink.js b/test/outband/unlink.js
new file mode 100644
index 0000000..ad44fb6
--- /dev/null
+++ b/test/outband/unlink.js
@@ -0,0 +1,13 @@
+const fs = require('fs');
+
+module.exports = function (result) {
+ const stat = fs.statSync(result.name);
+ if (stat.isFile()) {
+ // TODO must also close the file, otherwise the file will be closed during garbage collection, which we do not want
+ // TODO #241 get rid of the open file descriptor
+ fs.unlinkSync(result.name);
+ } else {
+ fs.rmdirSync(result.name);
+ }
+ this.out(result.name);
+};
diff --git a/test/outband/unsafe-sync.json b/test/outband/unsafe-sync.json
new file mode 100644
index 0000000..566009d
--- /dev/null
+++ b/test/outband/unsafe-sync.json
@@ -0,0 +1,7 @@
+{
+ "tc": "unsafe",
+ "async": false,
+ "file": false,
+ "options": { "unsafeCleanup":true },
+ "graceful": true
+}
diff --git a/test/outband/unsafe.js b/test/outband/unsafe.js
new file mode 100644
index 0000000..0f544de
--- /dev/null
+++ b/test/outband/unsafe.js
@@ -0,0 +1,25 @@
+var
+ fs = require('fs'),
+ join = require('path').join;
+
+module.exports = function (result) {
+ // file that should be removed
+ var fd = fs.openSync(join(result.name, 'should-be-removed.file'), 'w');
+ fs.closeSync(fd);
+
+ // in tree source
+ var symlinkSource = join(__dirname, 'fixtures', 'symlinkme');
+ // testing target
+ var symlinkTarget = join(result.name, 'symlinkme-target');
+
+ // symlink that should be removed but the contents should be preserved.
+ // Skip on Windows because symlinks require elevated privileges (instead just
+ // create the file)
+ if (process.platform === 'win32') {
+ fs.writeFileSync(symlinkTarget, '');
+ } else {
+ fs.symlinkSync(symlinkSource, symlinkTarget, 'dir');
+ }
+
+ this.out(result.name);
+};
diff --git a/test/outband/unsafe.json b/test/outband/unsafe.json
new file mode 100644
index 0000000..b9d73a8
--- /dev/null
+++ b/test/outband/unsafe.json
@@ -0,0 +1,7 @@
+{
+ "tc": "unsafe",
+ "async": true,
+ "file": false,
+ "options": { "unsafeCleanup":true },
+ "graceful": true
+}
diff --git a/test/setup-sigint-listener.js b/test/setup-sigint-listener.js
new file mode 100644
index 0000000..5d8a228
--- /dev/null
+++ b/test/setup-sigint-listener.js
@@ -0,0 +1,2 @@
+// make sure that all garbage gets collected on SIGINT
+process.on('SIGINT', process.exit);
diff --git a/test/spawn-custom.js b/test/spawn-custom.js
new file mode 100644
index 0000000..f833f07
--- /dev/null
+++ b/test/spawn-custom.js
@@ -0,0 +1,13 @@
+// vim: expandtab:ts=2:sw=2
+
+var
+ path = require('path'),
+ readJsonConfig = require('./util').readJsonConfig,
+ spawn = require('./spawn');
+
+var config = readJsonConfig(process.argv[2]);
+spawn.graceful = !!config.graceful;
+
+// import the test case function and execute it
+var fn = require(path.join(__dirname, 'outband', config.tc));
+fn.apply(spawn);
diff --git a/test/spawn-generic.js b/test/spawn-generic.js
new file mode 100644
index 0000000..f433f6d
--- /dev/null
+++ b/test/spawn-generic.js
@@ -0,0 +1,39 @@
+// vim: expandtab:ts=2:sw=2
+
+var
+ path = require('path'),
+ readJsonConfig = require('./util').readJsonConfig,
+ spawn = require('./spawn'),
+ tmp = require('../lib/tmp');
+
+var config = readJsonConfig(process.argv[2]);
+spawn.graceful = !!config.graceful;
+
+var fnUnderTest = null;
+
+if (config.async) fnUnderTest = (config.file) ? tmp.file : tmp.dir;
+else fnUnderTest = (config.file) ? tmp.fileSync : tmp.dirSync;
+
+// make sure that we have a SIGINT handler so CTRL-C the test suite
+// will not leave anything behing
+process.on('SIGINT', process.exit);
+
+// do we test against tmp doing a graceful cleanup?
+if (config.graceful) tmp.setGracefulCleanup();
+
+// import the test case function and execute it
+var fn = require(path.join(__dirname, 'outband', config.tc));
+if (config.async)
+ fnUnderTest(config.options, function (err, name, fdOrCallback, cb) {
+ if (err) spawn.err(err);
+ else {
+ var result = null;
+ if (config.file) result = { name: name, fd: fdOrCallback, removeCallback: cb };
+ else result = { name: name, removeCallback: fdOrCallback };
+ fn.apply(spawn, [result, tmp]);
+ }
+ });
+else {
+ fn.apply(spawn, [fnUnderTest(config.options), tmp]);
+}
+
diff --git a/test/spawn-sync.js b/test/spawn-sync.js
deleted file mode 100644
index fe8b5b6..0000000
--- a/test/spawn-sync.js
+++ /dev/null
@@ -1,30 +0,0 @@
-var tmp = require('../lib/tmp');
-
-function _writeSync(stream, str, cb) {
- var flushed = stream.write(str);
- if (flushed) {
- return cb(null);
- }
-
- stream.once('drain', function _flushed() {
- cb(null);
- });
-}
-
-module.exports.out = function (str, cb) {
- _writeSync(process.stdout, str, cb);
-};
-
-module.exports.err = function (str, cb) {
- _writeSync(process.stderr, str, cb);
-};
-
-module.exports.exit = function () {
- process.exit(0);
-};
-
-var type = process.argv[2];
-module.exports.tmpFunction = (type == 'file') ? tmp.fileSync : tmp.dirSync;
-
-var arg = (process.argv[3] && parseInt(process.argv[3], 10) === 1) ? true : false;
-module.exports.arg = arg;
diff --git a/test/spawn.js b/test/spawn.js
index 329de63..3f89510 100644
--- a/test/spawn.js
+++ b/test/spawn.js
@@ -1,4 +1,4 @@
-var tmp = require('../lib/tmp');
+// vim: expandtab:ts=2:sw=2
function _writeSync(stream, str, cb) {
var flushed = stream.write(str);
@@ -11,20 +11,23 @@ function _writeSync(stream, str, cb) {
});
}
-module.exports.out = function (str, cb) {
- _writeSync(process.stdout, str, cb);
-};
-
-module.exports.err = function (str, cb) {
- _writeSync(process.stderr, str, cb);
-};
-
-module.exports.exit = function () {
- process.exit(0);
+module.exports = {
+ graceful: false,
+ out: function (str, cb) {
+ cb = cb || this.exit;
+ _writeSync(process.stdout, str, cb);
+ },
+ err: function (errOrStr, cb) {
+ cb = cb || this.exit;
+ if (!this.graceful) _writeSync(process.stderr, (errOrStr instanceof Error) ? errOrStr.toString() : errOrStr, cb);
+ else cb();
+ },
+ fail: function (errOrStr, cb) {
+ cb = cb || this.exit;
+ _writeSync(process.stderr, (errOrStr instanceof Error) ? errOrStr.toString() : errOrStr, cb);
+ },
+ exit: function (code) {
+ process.exit(code || 0);
+ }
};
-var type = process.argv[2];
-module.exports.tmpFunction = (type == 'file') ? tmp.file : tmp.dir;
-
-var arg = (process.argv[3] && parseInt(process.argv[3], 10) === 1) ? true : false;
-module.exports.arg = arg;
diff --git a/test/template-sync-test.js b/test/template-sync-test.js
new file mode 100644
index 0000000..0a96054
--- /dev/null
+++ b/test/template-sync-test.js
@@ -0,0 +1,28 @@
+/* eslint-disable no-octal */
+// vim: expandtab:ts=2:sw=2
+
+const
+ assert = require('assert'),
+ tmp = require('../lib/tmp');
+
+describe('tmp', function () {
+ describe('dirSync()', function () {
+ it('with invalid template', function () {
+ try {
+ tmp.dirSync({template:'invalid'});
+ } catch (err) {
+ assert.equal(err.message, 'Invalid template, found "invalid".', 'should have thrown the expected error');
+ }
+ });
+ });
+
+ describe('fileSync()', function () {
+ it('with invalid template', function () {
+ try {
+ tmp.fileSync({template:'invalid'});
+ } catch (err) {
+ assert.equal(err.message, 'Invalid template, found "invalid".', 'should have thrown the expected error');
+ }
+ });
+ });
+});
diff --git a/test/template-test.js b/test/template-test.js
new file mode 100644
index 0000000..ed31f7e
--- /dev/null
+++ b/test/template-test.js
@@ -0,0 +1,36 @@
+/* eslint-disable no-octal */
+// vim: expandtab:ts=2:sw=2
+
+const
+ assert = require('assert'),
+ tmp = require('../lib/tmp');
+
+describe('tmp', function () {
+ describe('dir()', function () {
+ it('with invalid template', function (done) {
+ tmp.dir({template:'invalid'}, function (err) {
+ if (!err) return done(new Error('err expected'));
+ try {
+ assert.equal(err.message, 'Invalid template, found "invalid".', 'should have thrown the expected error');
+ } catch (err2) {
+ return done(err2);
+ }
+ done();
+ });
+ });
+ });
+
+ describe('file()', function () {
+ it('with invalid template', function (done) {
+ tmp.file({template:'invalid'}, function (err) {
+ if (!err) return done(new Error('err expected'));
+ try {
+ assert.equal(err.message, 'Invalid template, found "invalid".', 'should have thrown the expected error');
+ } catch (err2) {
+ return done(err2);
+ }
+ done();
+ });
+ });
+ });
+});
diff --git a/test/unsafe-sync.js b/test/unsafe-sync.js
deleted file mode 100644
index 97b684d..0000000
--- a/test/unsafe-sync.js
+++ /dev/null
@@ -1,36 +0,0 @@
-var
- fs = require('fs'),
- join = require('path').join,
- spawn = require('./spawn-sync');
-
-var unsafe = spawn.arg;
-
-try {
- var result = spawn.tmpFunction({ unsafeCleanup: unsafe });
- try {
- // file that should be removed
- var fd = fs.openSync(join(result.name, 'should-be-removed.file'), 'w');
- fs.closeSync(fd);
-
- // in tree source
- var symlinkSource = join(__dirname, 'symlinkme');
- // testing target
- var symlinkTarget = join(result.name, 'symlinkme-target');
-
- // symlink that should be removed but the contents should be preserved.
- // Skip on Windows because symlinks require elevated privileges (instead just
- // create the file so that tdir-sync-test.js can unlink it).
- if (process.platform == 'win32') {
- fs.writeFileSync(symlinkTarget);
- } else {
- fs.symlinkSync(symlinkSource, symlinkTarget, 'dir');
- }
-
- spawn.out(result.name, spawn.exit);
- } catch (e) {
- spawn.err(e.toString(), spawn.exit);
- }
-}
-catch (e) {
- spawn.err(e.toString(), spawn.exit);
-}
diff --git a/test/unsafe.js b/test/unsafe.js
deleted file mode 100644
index 7e829c8..0000000
--- a/test/unsafe.js
+++ /dev/null
@@ -1,36 +0,0 @@
-var
- fs = require('fs'),
- join = require('path').join,
- spawn = require('./spawn');
-
-var unsafe = spawn.arg;
-spawn.tmpFunction({ unsafeCleanup: unsafe }, function (err, name) {
- if (err) {
- spawn.err(err, spawn.exit);
- return;
- }
-
- try {
- // file that should be removed
- var fd = fs.openSync(join(name, 'should-be-removed.file'), 'w');
- fs.closeSync(fd);
-
- // in tree source
- var symlinkSource = join(__dirname, 'symlinkme');
- // testing target
- var symlinkTarget = join(name, 'symlinkme-target');
-
- // symlink that should be removed but the contents should be preserved.
- // Skip on Windows because symlinks require elevated privileges (instead just
- // create the file so that tdir-sync-test.js can unlink it).
- if (process.platform == 'win32') {
- fs.writeFileSync(symlinkTarget);
- } else {
- fs.symlinkSync(symlinkSource, symlinkTarget, 'dir');
- }
-
- spawn.out(name, spawn.exit);
- } catch (e) {
- spawn.err(e.toString(), spawn.exit);
- }
-});
diff --git a/test/util.js b/test/util.js
new file mode 100644
index 0000000..478148c
--- /dev/null
+++ b/test/util.js
@@ -0,0 +1,9 @@
+// vim: expandtab:ts=2:sw=2
+
+var
+ fs = require('fs');
+
+module.exports.readJsonConfig = function readJsonConfig(path) {
+ var contents = fs.readFileSync(path);
+ return JSON.parse(contents);
+};