Commit 324120b5 authored by Medicean's avatar Medicean

(Update node_modules) Bump mark

parent 0cf02634
{ {
"env": { "root": true,
"browser": false,
"node": true, "extends": "@ljharb",
"amd": false,
"mocha": false,
"jasmine": false
},
"rules": { "rules": {
"accessor-pairs": [2, { getWithoutSet: false, setWithoutGet: true }], "complexity": [2, 20],
"array-bracket-spacing": [2, "never", { "eqeqeq": [2, "allow-null"],
"singleValue": false, "func-name-matching": [1],
"objectsInArrays": false,
"arraysInArrays": false
}],
"block-scoped-var": [0],
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
"camelcase": [2],
"comma-dangle": [2, "never"],
"comma-spacing": [2],
"comma-style": [2, "last"],
"complexity": [2, 15],
"computed-property-spacing": [2, "never"],
"consistent-return": [2],
"consistent-this": [0, "that"],
"constructor-super": [2],
"curly": [2, "all"],
"default-case": [2],
"dot-notation": [2, { "allowKeywords": true }],
"eol-last": [2],
"eqeqeq": [2],
"func-names": [0],
"func-style": [2, "expression"],
"generator-star-spacing": [2, { "before": false, "after": true }],
"global-strict": [0, "never"],
"guard-for-in": [0],
"handle-callback-err": [0],
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
"linebreak-style": [2, "unix"],
"lines-around-comment": [2, {
"beforeBlockComment": false,
"afterBlockComment": false,
"beforeLineComment": false,
"beforeLineComment": false,
"allowBlockStart": true,
"allowBlockEnd": true
}],
"quotes": [2, "single", "avoid-escape"],
"max-depth": [1, 4], "max-depth": [1, 4],
"max-len": [0, 80, 4], "max-statements": [2, 26],
"max-nested-callbacks": [2, 2], "no-extra-parens": [1],
"max-params": [2, 2], "no-magic-numbers": [0],
"max-statements": [2, 21], "no-restricted-syntax": [2, "BreakStatement", "ContinueStatement", "DebuggerStatement", "LabeledStatement", "WithStatement"],
"new-parens": [2], "sort-keys": [0],
"new-cap": [2],
"newline-after-var": [0],
"no-alert": [2],
"no-array-constructor": [2],
"no-bitwise": [0],
"no-caller": [2],
"no-catch-shadow": [2],
"no-cond-assign": [2],
"no-console": [2],
"no-constant-condition": [2],
"no-continue": [2],
"no-control-regex": [2],
"no-debugger": [2],
"no-delete-var": [2],
"no-div-regex": [0],
"no-dupe-args": [2],
"no-dupe-keys": [2],
"no-duplicate-case": [2],
"no-else-return": [0],
"no-empty": [2],
"no-empty-character-class": [2],
"no-empty-label": [2],
"no-eq-null": [0],
"no-eval": [2],
"no-ex-assign": [2],
"no-extend-native": [2],
"no-extra-bind": [2],
"no-extra-boolean-cast": [2],
"no-extra-parens": [0],
"no-extra-semi": [2],
"no-fallthrough": [2],
"no-floating-decimal": [2],
"no-func-assign": [2],
"no-implied-eval": [2],
"no-inline-comments": [0],
"no-inner-declarations": [2, "functions"],
"no-invalid-regexp": [2],
"no-irregular-whitespace": [2],
"no-iterator": [2],
"no-label-var": [2],
"no-labels": [2],
"no-lone-blocks": [2],
"no-lonely-if": [2],
"no-loop-func": [2],
"no-mixed-requires": [0, false],
"no-mixed-spaces-and-tabs": [2, false],
"no-multi-spaces": [2],
"no-multi-str": [2],
"no-multiple-empty-lines": [2, {"max": 1}],
"no-native-reassign": [2],
"no-negated-in-lhs": [2],
"no-nested-ternary": [0],
"no-new": [2],
"no-new-func": [2],
"no-new-object": [2],
"no-new-require": [0],
"no-new-wrappers": [2],
"no-obj-calls": [2],
"no-octal": [2],
"no-octal-escape": [2],
"no-param-reassign": [2],
"no-path-concat": [0],
"no-plusplus": [0],
"no-process-env": [0],
"no-process-exit": [2],
"no-proto": [2],
"no-redeclare": [2],
"no-regex-spaces": [2],
"no-reserved-keys": [2],
"no-restricted-modules": [0],
"no-return-assign": [2, "always"],
"no-script-url": [2],
"no-self-compare": [0],
"no-sequences": [2],
"no-shadow": [2],
"no-shadow-restricted-names": [2],
"no-space-before-semi": [2],
"no-spaced-func": [2],
"no-sparse-arrays": [2],
"no-sync": [0],
"no-ternary": [0],
"no-this-before-super": [2],
"no-throw-literal": [2],
"no-trailing-spaces": [2, { "skipBlankLines": false }],
"no-undef": [2],
"no-undef-init": [2],
"no-undefined": [0],
"no-underscore-dangle": [2],
"no-unexpected-multiline": [2],
"no-unneeded-ternary": [2],
"no-unreachable": [2],
"no-unused-expressions": [2],
"no-unused-vars": [2, { "vars": "all", "args": "after-used" }],
"no-use-before-define": [2],
"no-void": [0],
"no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],
"no-with": [2],
"no-wrap-func": [2],
"object-curly-spacing": [2, "always"],
"object-shorthand": [2, "never"],
"one-var": [0],
"operator-assignment": [0, "always"],
"operator-linebreak": [2, "none"],
"padded-blocks": [0],
"prefer-const": [0],
"quote-props": [0],
"radix": [0],
"semi": [2],
"semi-spacing": [2, { "before": false, "after": true }],
"sort-vars": [0],
"space-after-keywords": [2, "always"],
"space-before-function-paren": [2, { "anonymous": "always", "named": "never" }],
"space-before-blocks": [0, "always"],
"space-in-brackets": [0, "never", {
"singleValue": true,
"arraysInArrays": false,
"arraysInObjects": false,
"objectsInArrays": true,
"objectsInObjects": true,
"propertyName": false
}],
"space-in-parens": [2, "never"],
"space-infix-ops": [2],
"space-return-throw-case": [2],
"space-unary-ops": [2, { "words": true, "nonwords": false }],
"spaced-comment": [2, "always"],
"spaced-line-comment": [0, "always"],
"strict": [2, "global"],
"use-isnan": [2],
"valid-jsdoc": [0],
"valid-typeof": [2],
"vars-on-top": [0],
"wrap-iife": [2],
"wrap-regex": [2],
"yoda": [2, "never", { "exceptRange": true, "onlyEquality": false }]
} }
} }
{ {
"es3": true,
"additionalRules": [], "additionalRules": [],
"requireSemicolons": true, "requireSemicolons": true,
...@@ -7,12 +9,29 @@ ...@@ -7,12 +9,29 @@
"disallowIdentifierNames": [], "disallowIdentifierNames": [],
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], "requireCurlyBraces": {
"allExcept": [],
"keywords": ["if", "else", "for", "while", "do", "try", "catch"]
},
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"],
"disallowSpaceAfterKeywords": [], "disallowSpaceAfterKeywords": [],
"disallowSpaceBeforeComma": true,
"disallowSpaceAfterComma": false,
"disallowSpaceBeforeSemicolon": true,
"disallowNodeTypes": [
"DebuggerStatement",
"LabeledStatement",
"SwitchCase",
"SwitchStatement",
"WithStatement"
],
"requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] },
"requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true },
"requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true },
"disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true },
...@@ -25,7 +44,7 @@ ...@@ -25,7 +44,7 @@
"disallowSpacesInsideArrayBrackets": true, "disallowSpacesInsideArrayBrackets": true,
"disallowQuotedKeysInObjects": "allButReserved", "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] },
"disallowSpaceAfterObjectKeys": true, "disallowSpaceAfterObjectKeys": true,
...@@ -60,7 +79,7 @@ ...@@ -60,7 +79,7 @@
"disallowMultipleLineStrings": true, "disallowMultipleLineStrings": true,
"requireDotNotation": true, "requireDotNotation": { "allExcept": ["keywords"] },
"requireParenthesesAroundIIFE": true, "requireParenthesesAroundIIFE": true,
...@@ -99,6 +118,58 @@ ...@@ -99,6 +118,58 @@
"maximum": 6 "maximum": 6
}, },
"requirePaddingNewLinesAfterUseStrict": true "requirePaddingNewLinesAfterUseStrict": true,
"disallowArrowFunctions": true,
"disallowMultiLineTernary": true,
"validateOrderInObjectKeys": false,
"disallowIdenticalDestructuringNames": true,
"disallowNestedTernaries": { "maxLevel": 1 },
"requireSpaceAfterComma": { "allExcept": ["trailing"] },
"requireAlignedMultilineParams": false,
"requireSpacesInGenerator": {
"afterStar": true
},
"disallowSpacesInGenerator": {
"beforeStar": true
},
"disallowVar": false,
"requireArrayDestructuring": false,
"requireEnhancedObjectLiterals": false,
"requireObjectDestructuring": false,
"requireEarlyReturn": false,
"requireCapitalizedConstructorsNew": {
"allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"]
},
"requireImportAlphabetized": false,
"requireSpaceBeforeObjectValues": true,
"requireSpaceBeforeDestructuredValues": true,
"disallowSpacesInsideTemplateStringPlaceholders": true,
"disallowArrayDestructuringReturn": false,
"requireNewlineBeforeSingleStatementsInIf": false,
"disallowUnusedVariables": true,
"requireSpacesInsideImportedObjectBraces": true,
"requireUseStrict": true
} }
test
\ No newline at end of file
language: node_js language: node_js
os:
- linux
node_js: node_js:
- "iojs-v2.3" - "10.7"
- "iojs-v2.2" - "9.11"
- "iojs-v2.1" - "8.11"
- "iojs-v2.0" - "7.10"
- "6.14"
- "5.12"
- "4.9"
- "iojs-v3.3"
- "iojs-v2.5"
- "iojs-v1.8" - "iojs-v1.8"
- "iojs-v1.7"
- "iojs-v1.6"
- "iojs-v1.5"
- "iojs-v1.4"
- "iojs-v1.3"
- "iojs-v1.2"
- "iojs-v1.1"
- "iojs-v1.0"
- "0.12" - "0.12"
- "0.11"
- "0.10" - "0.10"
- "0.9"
- "0.8" - "0.8"
- "0.6"
- "0.4"
before_install: before_install:
- '[ "${TRAVIS_NODE_VERSION}" = "0.6" ] || npm install -g npm@1.4.28 && npm install -g npm' - 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac'
- 'nvm install-latest-npm'
install:
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;'
script:
- 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi'
- 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi'
- 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi'
- 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi'
sudo: false sudo: false
env:
- TEST=true
matrix: matrix:
fast_finish: true fast_finish: true
allow_failures: include:
- node_js: "lts/*"
env: PRETEST=true
- node_js: "lts/*"
env: POSTTEST=true
- node_js: "4"
env: COVERAGE=true
- node_js: "10.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "10.5"
env: TEST=true ALLOW_FAILURE=true
- node_js: "10.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "10.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "10.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "10.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "10.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "9.10"
env: TEST=true ALLOW_FAILURE=true
- node_js: "9.9"
env: TEST=true ALLOW_FAILURE=true
- node_js: "9.8"
env: TEST=true ALLOW_FAILURE=true
- node_js: "9.7"
env: TEST=true ALLOW_FAILURE=true
- node_js: "9.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "9.5"
env: TEST=true ALLOW_FAILURE=true
- node_js: "9.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "9.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "9.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "9.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "9.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "8.10"
env: TEST=true ALLOW_FAILURE=true
- node_js: "8.9"
env: TEST=true ALLOW_FAILURE=true
- node_js: "8.8"
env: TEST=true ALLOW_FAILURE=true
- node_js: "8.7"
env: TEST=true ALLOW_FAILURE=true
- node_js: "8.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "8.5"
env: TEST=true ALLOW_FAILURE=true
- node_js: "8.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "8.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "8.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "8.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "8.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.9"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.8"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.7"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.5"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.13"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.12"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.11"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.10"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.9"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.8"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.7"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.5"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.11"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.10"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.9"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.8"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.7"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.5"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.8"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.7"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.5"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v3.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v3.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v3.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v2.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v2.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v2.2" - node_js: "iojs-v2.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v2.1" - node_js: "iojs-v2.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v2.0" - node_js: "iojs-v2.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.7" - node_js: "iojs-v1.7"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.6" - node_js: "iojs-v1.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.5" - node_js: "iojs-v1.5"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.4" - node_js: "iojs-v1.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.3" - node_js: "iojs-v1.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.2" - node_js: "iojs-v1.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.1" - node_js: "iojs-v1.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.0" - node_js: "iojs-v1.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "0.11" - node_js: "0.11"
env: TEST=true ALLOW_FAILURE=true
- node_js: "0.9" - node_js: "0.9"
- node_js: "0.8" env: TEST=true ALLOW_FAILURE=true
- node_js: "0.6" - node_js: "0.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "0.4" - node_js: "0.4"
env: TEST=true ALLOW_FAILURE=true
allow_failures:
- os: osx
- env: TEST=true ALLOW_FAILURE=true
3.0.2 / 2018-07-19
==================
* [Fix] Prevent merging `__proto__` property (#48)
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`
* [Tests] up to `node` `v10.7`, `v9.11`, `v8.11`, `v7.10`, `v6.14`, `v4.9`; use `nvm install-latest-npm`
3.0.1 / 2017-04-27
==================
* [Fix] deep extending should work with a non-object (#46)
* [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config`
* [Tests] up to `node` `v7.9`, `v6.10`, `v4.8`; improve matrix
* [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG.
* [Docs] Add example to readme (#34)
3.0.0 / 2015-07-01 3.0.0 / 2015-07-01
================== ==================
* [Possible breaking change] Use global "strict" directive (#32) * [Possible breaking change] Use global "strict" directive (#32)
......
...@@ -6,6 +6,18 @@ ...@@ -6,6 +6,18 @@
`node-extend` is a port of the classic extend() method from jQuery. It behaves as you expect. It is simple, tried and true. `node-extend` is a port of the classic extend() method from jQuery. It behaves as you expect. It is simple, tried and true.
Notes:
* Since Node.js >= 4,
[`Object.assign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
now offers the same functionality natively (but without the "deep copy" option).
See [ECMAScript 2015 (ES6) in Node.js](https://nodejs.org/en/docs/es6).
* Some native implementations of `Object.assign` in both Node.js and many
browsers (since NPM modules are for the browser too) may not be fully
spec-compliant.
Check [`object.assign`](https://www.npmjs.com/package/object.assign) module for
a compliant candidate.
## Installation ## Installation
This package is available on [npm][npm-url] as: `extend` This package is available on [npm][npm-url] as: `extend`
...@@ -20,6 +32,13 @@ npm install extend ...@@ -20,6 +32,13 @@ npm install extend
*Extend one object with one or more others, returning the modified object.* *Extend one object with one or more others, returning the modified object.*
**Example:**
``` js
var extend = require('extend');
extend(targetObject, object1, object2);
```
Keep in mind that the target object will be modified, and will be returned from extend(). Keep in mind that the target object will be modified, and will be returned from extend().
If a boolean true is specified as the first argument, extend performs a deep copy, recursively copying any objects it finds. Otherwise, the copy will share structure with the original object(s). If a boolean true is specified as the first argument, extend performs a deep copy, recursively copying any objects it finds. Otherwise, the copy will share structure with the original object(s).
...@@ -54,7 +73,7 @@ Ported to Node.js by [Stefan Thomas][github-justmoon] with contributions by [Jon ...@@ -54,7 +73,7 @@ Ported to Node.js by [Stefan Thomas][github-justmoon] with contributions by [Jon
[github-justmoon]: https://github.com/justmoon [github-justmoon]: https://github.com/justmoon
[github-insin]: https://github.com/insin [github-insin]: https://github.com/insin
[github-ljharb]: https://github.com/ljharb [github-ljharb]: https://github.com/ljharb
[npm-version-png]: http://vb.teelaun.ch/justmoon/node-extend.svg [npm-version-png]: http://versionbadg.es/justmoon/node-extend.svg
[deps-svg]: https://david-dm.org/justmoon/node-extend.svg [deps-svg]: https://david-dm.org/justmoon/node-extend.svg
[deps-url]: https://david-dm.org/justmoon/node-extend [deps-url]: https://david-dm.org/justmoon/node-extend
[dev-deps-svg]: https://david-dm.org/justmoon/node-extend/dev-status.svg [dev-deps-svg]: https://david-dm.org/justmoon/node-extend/dev-status.svg
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
var hasOwn = Object.prototype.hasOwnProperty; var hasOwn = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString; var toStr = Object.prototype.toString;
var defineProperty = Object.defineProperty;
var gOPD = Object.getOwnPropertyDescriptor;
var isArray = function isArray(arr) { var isArray = function isArray(arr) {
if (typeof Array.isArray === 'function') { if (typeof Array.isArray === 'function') {
...@@ -26,17 +28,46 @@ var isPlainObject = function isPlainObject(obj) { ...@@ -26,17 +28,46 @@ var isPlainObject = function isPlainObject(obj) {
// Own properties are enumerated firstly, so to speed up, // Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own. // if last one is own, then all properties are own.
var key; var key;
for (key in obj) {/**/} for (key in obj) { /**/ }
return typeof key === 'undefined' || hasOwn.call(obj, key); return typeof key === 'undefined' || hasOwn.call(obj, key);
}; };
// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
var setProperty = function setProperty(target, options) {
if (defineProperty && options.name === '__proto__') {
defineProperty(target, options.name, {
enumerable: true,
configurable: true,
value: options.newValue,
writable: true
});
} else {
target[options.name] = options.newValue;
}
};
// Return undefined instead of __proto__ if '__proto__' is not an own property
var getProperty = function getProperty(obj, name) {
if (name === '__proto__') {
if (!hasOwn.call(obj, name)) {
return void 0;
} else if (gOPD) {
// In early versions of node, obj['__proto__'] is buggy when obj has
// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
return gOPD(obj, name).value;
}
}
return obj[name];
};
module.exports = function extend() { module.exports = function extend() {
var options, name, src, copy, copyIsArray, clone, var options, name, src, copy, copyIsArray, clone;
target = arguments[0], var target = arguments[0];
i = 1, var i = 1;
length = arguments.length, var length = arguments.length;
deep = false; var deep = false;
// Handle a deep copy situation // Handle a deep copy situation
if (typeof target === 'boolean') { if (typeof target === 'boolean') {
...@@ -44,7 +75,8 @@ module.exports = function extend() { ...@@ -44,7 +75,8 @@ module.exports = function extend() {
target = arguments[1] || {}; target = arguments[1] || {};
// skip the boolean and the target // skip the boolean and the target
i = 2; i = 2;
} else if ((typeof target !== 'object' && typeof target !== 'function') || target == null) { }
if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
target = {}; target = {};
} }
...@@ -54,8 +86,8 @@ module.exports = function extend() { ...@@ -54,8 +86,8 @@ module.exports = function extend() {
if (options != null) { if (options != null) {
// Extend the base object // Extend the base object
for (name in options) { for (name in options) {
src = target[name]; src = getProperty(target, name);
copy = options[name]; copy = getProperty(options, name);
// Prevent never-ending loop // Prevent never-ending loop
if (target !== copy) { if (target !== copy) {
...@@ -69,11 +101,11 @@ module.exports = function extend() { ...@@ -69,11 +101,11 @@ module.exports = function extend() {
} }
// Never move original objects, clone them // Never move original objects, clone them
target[name] = extend(deep, clone, copy); setProperty(target, { name: name, newValue: extend(deep, clone, copy) });
// Don't bring in undefined values // Don't bring in undefined values
} else if (typeof copy !== 'undefined') { } else if (typeof copy !== 'undefined') {
target[name] = copy; setProperty(target, { name: name, newValue: copy });
} }
} }
} }
...@@ -83,4 +115,3 @@ module.exports = function extend() { ...@@ -83,4 +115,3 @@ module.exports = function extend() {
// Return the modified object // Return the modified object
return target; return target;
}; };
{ {
"_args": [ "_from": "extend@3.0.2",
[ "_id": "extend@3.0.2",
"extend@3.0.0", "_inBundle": false,
"/Volumes/AntSword-dev/git/antSword/node_modules/superagent" "_integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
]
],
"_from": "extend@3.0.0",
"_id": "extend@3.0.0",
"_inCache": true,
"_installable": true,
"_location": "/extend", "_location": "/extend",
"_nodeVersion": "2.3.1",
"_npmUser": {
"email": "ljharb@gmail.com",
"name": "ljharb"
},
"_npmVersion": "2.11.3",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version",
"registry": true,
"raw": "extend@3.0.2",
"name": "extend", "name": "extend",
"raw": "extend@3.0.0", "escapedName": "extend",
"rawSpec": "3.0.0", "rawSpec": "3.0.2",
"scope": null, "saveSpec": null,
"spec": "3.0.0", "fetchSpec": "3.0.2"
"type": "version"
}, },
"_requiredBy": [ "_requiredBy": [
"/agent-base",
"/get-uri", "/get-uri",
"/http-proxy-agent",
"/https-proxy-agent",
"/pac-proxy-agent",
"/proxy-agent",
"/socks-proxy-agent",
"/superagent" "/superagent"
], ],
"_resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz", "_resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
"_shasum": "5a474353b9f3353ddd8176dfd37b91c83a46f1d4", "_shasum": "f8b1136b4071fbd8eb140aff858b1019ec2915fa",
"_shrinkwrap": null, "_spec": "extend@3.0.2",
"_spec": "extend@3.0.0", "_where": "/Users/medicean/tools/antSword/node_modules/superagent",
"_where": "/Volumes/AntSword-dev/git/antSword/node_modules/superagent",
"author": { "author": {
"email": "justmoon@members.fsf.org",
"name": "Stefan Thomas", "name": "Stefan Thomas",
"email": "justmoon@members.fsf.org",
"url": "http://www.justmoon.net" "url": "http://www.justmoon.net"
}, },
"bugs": { "bugs": {
"url": "https://github.com/justmoon/node-extend/issues" "url": "https://github.com/justmoon/node-extend/issues"
}, },
"bundleDependencies": false,
"contributors": [ "contributors": [
{ {
"name": "Jordan Harband", "name": "Jordan Harband",
...@@ -55,19 +39,15 @@ ...@@ -55,19 +39,15 @@
} }
], ],
"dependencies": {}, "dependencies": {},
"deprecated": false,
"description": "Port of jQuery.extend for node.js and the browser", "description": "Port of jQuery.extend for node.js and the browser",
"devDependencies": { "devDependencies": {
"@ljharb/eslint-config": "^12.2.1",
"covert": "^1.1.0", "covert": "^1.1.0",
"eslint": "^0.24.0", "eslint": "^4.19.1",
"jscs": "^1.13.1", "jscs": "^3.0.7",
"tape": "^4.0.0" "tape": "^4.9.1"
},
"directories": {},
"dist": {
"shasum": "5a474353b9f3353ddd8176dfd37b91c83a46f1d4",
"tarball": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz"
}, },
"gitHead": "148e7270cab2e9413af2cd0cab147070d755ed6d",
"homepage": "https://github.com/justmoon/node-extend#readme", "homepage": "https://github.com/justmoon/node-extend#readme",
"keywords": [ "keywords": [
"extend", "extend",
...@@ -76,19 +56,7 @@ ...@@ -76,19 +56,7 @@
], ],
"license": "MIT", "license": "MIT",
"main": "index", "main": "index",
"maintainers": [
{
"email": "justmoon@members.fsf.org",
"name": "justmoon"
},
{
"email": "ljharb@gmail.com",
"name": "ljharb"
}
],
"name": "extend", "name": "extend",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/justmoon/node-extend.git" "url": "git+https://github.com/justmoon/node-extend.git"
...@@ -99,7 +67,10 @@ ...@@ -99,7 +67,10 @@
"eslint": "eslint *.js */*.js", "eslint": "eslint *.js */*.js",
"jscs": "jscs *.js */*.js", "jscs": "jscs *.js */*.js",
"lint": "npm run jscs && npm run eslint", "lint": "npm run jscs && npm run eslint",
"test": "npm run lint && node test/index.js && npm run coverage-quiet" "posttest": "npm run coverage-quiet",
"pretest": "npm run lint",
"test": "npm run tests-only",
"tests-only": "node test"
}, },
"version": "3.0.0" "version": "3.0.2"
} }
sudo: false
language: node_js
node_js:
- "4"
- "5"
- "6"
- "7"
- "8"
install:
- PATH="`npm bin`:`npm bin -g`:$PATH"
# Install dependencies and build
- npm install
script:
# Output useful info for debugging
- node --version
- npm --version
# Run tests
- npm test
...@@ -103,7 +103,7 @@ The `options` argument may either be a string URI of the proxy server to use, or ...@@ -103,7 +103,7 @@ The `options` argument may either be a string URI of the proxy server to use, or
* `host` - String - Proxy host to connect to (may use `hostname` as well). Required. * `host` - String - Proxy host to connect to (may use `hostname` as well). Required.
* `port` - Number - Proxy port to connect to. Required. * `port` - Number - Proxy port to connect to. Required.
* `secureProxy` - Boolean - If `true`, then use TLS to connect to the proxy. Defaults to `false`. * `protocol` - String - If `https:`, then use TLS to connect to the proxy.
* `headers` - Object - Additional HTTP headers to be sent on the HTTP CONNECT method. * `headers` - Object - Additional HTTP headers to be sent on the HTTP CONNECT method.
* Any other options given are passed to the `net.connect()`/`tls.connect()` functions. * Any other options given are passed to the `net.connect()`/`tls.connect()` functions.
......
This diff is collapsed.
{
"env": {
"browser": true,
"node": true
},
"globals": {
"chrome": true
},
"rules": {
"no-console": 0,
"no-empty": [1, { "allowEmptyCatch": true }]
},
"extends": "eslint:recommended"
}
support
test
examples
example
*.sock
dist
yarn.lock
coverage
bower.json
sudo: false
language: node_js
node_js:
- "4"
- "6"
- "8"
install:
- make install
script:
- make lint
- make test
matrix:
include:
- node_js: '8'
env: BROWSER=1
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
# BIN directory
BIN := $(THIS_DIR)/node_modules/.bin
# Path
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash
# applications
NODE ?= $(shell which node)
YARN ?= $(shell which yarn)
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
BROWSERIFY ?= $(NODE) $(BIN)/browserify
install: node_modules
browser: dist/debug.js
node_modules: package.json
@NODE_ENV= $(PKG) install
@touch node_modules
dist/debug.js: src/*.js node_modules
@mkdir -p dist
@$(BROWSERIFY) \
--standalone debug \
. > dist/debug.js
lint:
@eslint *.js src/*.js
test-node:
@istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
@cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
test-browser:
@$(MAKE) browser
@karma start --single-run
test-all:
@concurrently \
"make test-node" \
"make test-browser"
test:
@if [ "x$(BROWSER)" = "x" ]; then \
$(MAKE) test-node; \
else \
$(MAKE) test-browser; \
fi
clean:
rimraf dist coverage
.PHONY: browser install clean lint test test-all test-node test-browser
...@@ -70,7 +70,9 @@ Here are some examples: ...@@ -70,7 +70,9 @@ Here are some examples:
<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png"> <img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png"> <img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
#### Windows note #### Windows command prompt notes
##### CMD
On Windows the environment variable is set using the `set` command. On Windows the environment variable is set using the `set` command.
...@@ -78,14 +80,32 @@ On Windows the environment variable is set using the `set` command. ...@@ -78,14 +80,32 @@ On Windows the environment variable is set using the `set` command.
set DEBUG=*,-not_this set DEBUG=*,-not_this
``` ```
Note that PowerShell uses different syntax to set environment variables. Example:
```cmd
set DEBUG=* & node app.js
```
##### PowerShell (VS Code default)
PowerShell uses different syntax to set environment variables.
```cmd ```cmd
$env:DEBUG = "*,-not_this" $env:DEBUG = "*,-not_this"
``` ```
Example:
```cmd
$env:DEBUG='app';node app.js
```
Then, run the program to be debugged as usual. Then, run the program to be debugged as usual.
npm script example:
```js
"windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
```
## Namespace Colors ## Namespace Colors
...@@ -248,6 +268,55 @@ error('now goes to stdout via console.info'); ...@@ -248,6 +268,55 @@ error('now goes to stdout via console.info');
log('still goes to stdout, but via console.info now'); log('still goes to stdout, but via console.info now');
``` ```
## Extend
You can simply extend debugger
```js
const log = require('debug')('auth');
//creates new debug instance with extended namespace
const logSign = log.extend('sign');
const logLogin = log.extend('login');
log('hello'); // auth hello
logSign('hello'); //auth:sign hello
logLogin('hello'); //auth:login hello
```
## Set dynamically
You can also enable debug dynamically by calling the `enable()` method :
```js
let debug = require('debug');
console.log(1, debug.enabled('test'));
debug.enable('test');
console.log(2, debug.enabled('test'));
debug.disable();
console.log(3, debug.enabled('test'));
```
print :
```
1 false
2 true
3 false
```
Usage :
`enable(namespaces)`
`namespaces` can include modes separated by a colon and wildcards.
Note that calling `enable()` completely overrides previously set DEBUG variable :
```
$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
=> false
```
## Checking whether a debug target is enabled ## Checking whether a debug target is enabled
After you've created a debug instance, you can determine whether or not it is After you've created a debug instance, you can determine whether or not it is
......
// Karma configuration
// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai', 'sinon'],
// list of files / patterns to load in the browser
files: [
'dist/debug.js',
'test/*spec.js'
],
// list of files to exclude
exclude: [
'src/node.js'
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}
{ {
"_from": "debug@^3.1.0", "_from": "debug@^3.1.0",
"_id": "debug@3.1.0", "_id": "debug@3.2.6",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", "_integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
"_location": "/https-proxy-agent/debug", "_location": "/https-proxy-agent/debug",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
"_requiredBy": [ "_requiredBy": [
"/https-proxy-agent" "/https-proxy-agent"
], ],
"_resolved": "http://registry.npm.taobao.org/debug/download/debug-3.1.0.tgz", "_resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
"_shasum": "5bb5a0672628b64149566ba16819e61518c67261", "_shasum": "e83d17de16d8a7efb7717edbe5fb10135eee629b",
"_spec": "debug@^3.1.0", "_spec": "debug@^3.1.0",
"_where": "/Users/medicean/workspace/antSword/node_modules/https-proxy-agent", "_where": "/Users/medicean/tools/antSword/node_modules/https-proxy-agent",
"author": { "author": {
"name": "TJ Holowaychuk", "name": "TJ Holowaychuk",
"email": "tj@vision-media.ca" "email": "tj@vision-media.ca"
...@@ -43,28 +43,35 @@ ...@@ -43,28 +43,35 @@
} }
], ],
"dependencies": { "dependencies": {
"ms": "2.0.0" "ms": "^2.1.1"
}, },
"deprecated": false, "deprecated": false,
"description": "small debugging utility", "description": "small debugging utility",
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"browserify": "14.4.0", "browserify": "14.4.0",
"chai": "^3.5.0", "chai": "^3.5.0",
"concurrently": "^3.1.0", "concurrently": "^3.1.0",
"coveralls": "^2.11.15", "coveralls": "^3.0.2",
"eslint": "^3.12.1",
"istanbul": "^0.4.5", "istanbul": "^0.4.5",
"karma": "^1.3.0", "karma": "^3.0.0",
"karma-chai": "^0.1.0", "karma-chai": "^0.1.0",
"karma-mocha": "^1.3.0", "karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2", "karma-phantomjs-launcher": "^1.0.2",
"karma-sinon": "^1.0.5", "mocha": "^5.2.0",
"mocha": "^3.2.0",
"mocha-lcov-reporter": "^1.2.0", "mocha-lcov-reporter": "^1.2.0",
"rimraf": "^2.5.4", "rimraf": "^2.5.4",
"sinon": "^1.17.6", "xo": "^0.23.0"
"sinon-chai": "^2.8.0"
}, },
"files": [
"src",
"node.js",
"dist/debug.js",
"LICENSE",
"README.md"
],
"homepage": "https://github.com/visionmedia/debug#readme", "homepage": "https://github.com/visionmedia/debug#readme",
"keywords": [ "keywords": [
"debug", "debug",
...@@ -78,5 +85,6 @@ ...@@ -78,5 +85,6 @@
"type": "git", "type": "git",
"url": "git://github.com/visionmedia/debug.git" "url": "git://github.com/visionmedia/debug.git"
}, },
"version": "3.1.0" "unpkg": "./dist/debug.js",
"version": "3.2.6"
} }
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/* eslint-env browser */
/** /**
* This is the web browser implementation of `debug()`. * This is the web browser implementation of `debug()`.
*
* Expose `debug()` as the module.
*/ */
exports = module.exports = require('./debug');
exports.log = log; exports.log = log;
exports.formatArgs = formatArgs; exports.formatArgs = formatArgs;
exports.save = save; exports.save = save;
exports.load = load; exports.load = load;
exports.useColors = useColors; exports.useColors = useColors;
exports.storage = 'undefined' != typeof chrome exports.storage = localstorage();
&& 'undefined' != typeof chrome.storage
? chrome.storage.local
: localstorage();
/** /**
* Colors. * Colors.
*/ */
exports.colors = [ exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
'#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC',
'#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF',
'#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC',
'#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF',
'#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC',
'#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033',
'#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366',
'#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933',
'#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC',
'#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF',
'#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'
];
/** /**
* Currently only WebKit-based Web Inspectors, Firefox >= v31, * Currently only WebKit-based Web Inspectors, Firefox >= v31,
* and the Firebug extension (any Firefox version) are known * and the Firebug extension (any Firefox version) are known
...@@ -40,84 +25,65 @@ exports.colors = [ ...@@ -40,84 +25,65 @@ exports.colors = [
* *
* TODO: add a `localStorage` variable to explicitly enable/disable colors * TODO: add a `localStorage` variable to explicitly enable/disable colors
*/ */
// eslint-disable-next-line complexity
function useColors() { function useColors() {
// NB: In an Electron preload script, document will be defined but not fully // NB: In an Electron preload script, document will be defined but not fully
// initialized. Since we know we're in Chrome, we'll just detect this case // initialized. Since we know we're in Chrome, we'll just detect this case
// explicitly // explicitly
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
return true; return true;
} } // Internet Explorer and Edge do not support colors.
// Internet Explorer and Edge do not support colors.
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
return false; return false;
} } // Is webkit? http://stackoverflow.com/a/16459606/376773
// is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
// is firebug? http://stackoverflow.com/a/398120/376773
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
// is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
// double check webkit in userAgent just in case we are in a worker
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
}
/**
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
*/
exports.formatters.j = function(v) {
try {
return JSON.stringify(v);
} catch (err) {
return '[UnexpectedJSONParseError]: ' + err.message;
}
};
return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
}
/** /**
* Colorize log arguments if enabled. * Colorize log arguments if enabled.
* *
* @api public * @api public
*/ */
function formatArgs(args) {
var useColors = this.useColors;
args[0] = (useColors ? '%c' : '') function formatArgs(args) {
+ this.namespace args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
+ (useColors ? ' %c' : ' ')
+ args[0]
+ (useColors ? '%c ' : ' ')
+ '+' + exports.humanize(this.diff);
if (!useColors) return; if (!this.useColors) {
return;
}
var c = 'color: ' + this.color; var c = 'color: ' + this.color;
args.splice(1, 0, c, 'color: inherit') args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
// the final "%c" is somewhat tricky, because there could be other
// arguments passed either before or after the %c, so we need to // arguments passed either before or after the %c, so we need to
// figure out the correct index to insert the CSS into // figure out the correct index to insert the CSS into
var index = 0; var index = 0;
var lastC = 0; var lastC = 0;
args[0].replace(/%[a-zA-Z%]/g, function(match) { args[0].replace(/%[a-zA-Z%]/g, function (match) {
if ('%%' === match) return; if (match === '%%') {
return;
}
index++; index++;
if ('%c' === match) {
// we only are interested in the *last* %c if (match === '%c') {
// We only are interested in the *last* %c
// (the user may have provided their own) // (the user may have provided their own)
lastC = index; lastC = index;
} }
}); });
args.splice(lastC, 0, c); args.splice(lastC, 0, c);
} }
/** /**
* Invokes `console.log()` when available. * Invokes `console.log()` when available.
* No-op when `console.log` is not a "function". * No-op when `console.log` is not a "function".
...@@ -125,14 +91,14 @@ function formatArgs(args) { ...@@ -125,14 +91,14 @@ function formatArgs(args) {
* @api public * @api public
*/ */
function log() { function log() {
// this hackery is required for IE8/9, where var _console;
// This hackery is required for IE8/9, where
// the `console.log` function doesn't have 'apply' // the `console.log` function doesn't have 'apply'
return 'object' === typeof console return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
&& console.log
&& Function.prototype.apply.call(console.log, console, arguments);
} }
/** /**
* Save `namespaces`. * Save `namespaces`.
* *
...@@ -140,16 +106,18 @@ function log() { ...@@ -140,16 +106,18 @@ function log() {
* @api private * @api private
*/ */
function save(namespaces) { function save(namespaces) {
try { try {
if (null == namespaces) { if (namespaces) {
exports.storage.removeItem('debug'); exports.storage.setItem('debug', namespaces);
} else { } else {
exports.storage.debug = namespaces; exports.storage.removeItem('debug');
} }
} catch(e) {} } catch (error) {// Swallow
// XXX (@Qix-) should we be logging these?
}
} }
/** /**
* Load `namespaces`. * Load `namespaces`.
* *
...@@ -157,26 +125,23 @@ function save(namespaces) { ...@@ -157,26 +125,23 @@ function save(namespaces) {
* @api private * @api private
*/ */
function load() { function load() {
var r; var r;
try {
r = exports.storage.debug;
} catch(e) {}
try {
r = exports.storage.getItem('debug');
} catch (error) {} // Swallow
// XXX (@Qix-) should we be logging these?
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
if (!r && typeof process !== 'undefined' && 'env' in process) { if (!r && typeof process !== 'undefined' && 'env' in process) {
r = process.env.DEBUG; r = process.env.DEBUG;
} }
return r; return r;
} }
/**
* Enable namespaces listed in `localStorage.debug` initially.
*/
exports.enable(load());
/** /**
* Localstorage attempts to return the localstorage. * Localstorage attempts to return the localstorage.
* *
...@@ -188,8 +153,28 @@ exports.enable(load()); ...@@ -188,8 +153,28 @@ exports.enable(load());
* @api private * @api private
*/ */
function localstorage() { function localstorage() {
try { try {
return window.localStorage; // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
} catch (e) {} // The Browser also has localStorage in the global context.
return localStorage;
} catch (error) {// Swallow
// XXX (@Qix-) should we be logging these?
}
} }
module.exports = require('./common')(exports);
var formatters = module.exports.formatters;
/**
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
*/
formatters.j = function (v) {
try {
return JSON.stringify(v);
} catch (error) {
return '[UnexpectedJSONParseError]: ' + error.message;
}
};
/**
* This is the common logic for both the Node.js and web browser
* implementations of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
exports.coerce = coerce;
exports.disable = disable;
exports.enable = enable;
exports.enabled = enabled;
exports.humanize = require('ms');
/**
* Active `debug` instances.
*/
exports.instances = [];
/**
* The currently active debug mode names, and names to skip.
*/
exports.names = [];
exports.skips = [];
/**
* Map of special "%n" handling functions, for the debug "format" argument.
*
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
*/
exports.formatters = {};
/**
* Select a color.
* @param {String} namespace
* @return {Number}
* @api private
*/
function selectColor(namespace) {
var hash = 0, i;
for (i in namespace) {
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
hash |= 0; // Convert to 32bit integer
}
return exports.colors[Math.abs(hash) % exports.colors.length];
}
/**
* Create a debugger with the given `namespace`.
*
* @param {String} namespace
* @return {Function}
* @api public
*/
function createDebug(namespace) {
var prevTime;
function debug() {
// disabled?
if (!debug.enabled) return;
var self = debug;
// set `diff` timestamp
var curr = +new Date();
var ms = curr - (prevTime || curr);
self.diff = ms;
self.prev = prevTime;
self.curr = curr;
prevTime = curr;
// turn the `arguments` into a proper Array
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}
args[0] = exports.coerce(args[0]);
if ('string' !== typeof args[0]) {
// anything else let's inspect with %O
args.unshift('%O');
}
// apply any `formatters` transformations
var index = 0;
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
// if we encounter an escaped % then don't increase the array index
if (match === '%%') return match;
index++;
var formatter = exports.formatters[format];
if ('function' === typeof formatter) {
var val = args[index];
match = formatter.call(self, val);
// now we need to remove `args[index]` since it's inlined in the `format`
args.splice(index, 1);
index--;
}
return match;
});
// apply env-specific formatting (colors, etc.)
exports.formatArgs.call(self, args);
var logFn = debug.log || exports.log || console.log.bind(console);
logFn.apply(self, args);
}
debug.namespace = namespace;
debug.enabled = exports.enabled(namespace);
debug.useColors = exports.useColors();
debug.color = selectColor(namespace);
debug.destroy = destroy;
// env-specific initialization logic for debug instances
if ('function' === typeof exports.init) {
exports.init(debug);
}
exports.instances.push(debug);
return debug;
}
function destroy () {
var index = exports.instances.indexOf(this);
if (index !== -1) {
exports.instances.splice(index, 1);
return true;
} else {
return false;
}
}
/**
* Enables a debug mode by namespaces. This can include modes
* separated by a colon and wildcards.
*
* @param {String} namespaces
* @api public
*/
function enable(namespaces) {
exports.save(namespaces);
exports.names = [];
exports.skips = [];
var i;
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
var len = split.length;
for (i = 0; i < len; i++) {
if (!split[i]) continue; // ignore empty strings
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
} else {
exports.names.push(new RegExp('^' + namespaces + '$'));
}
}
for (i = 0; i < exports.instances.length; i++) {
var instance = exports.instances[i];
instance.enabled = exports.enabled(instance.namespace);
}
}
/**
* Disable debug output.
*
* @api public
*/
function disable() {
exports.enable('');
}
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
function enabled(name) {
if (name[name.length - 1] === '*') {
return true;
}
var i, len;
for (i = 0, len = exports.skips.length; i < len; i++) {
if (exports.skips[i].test(name)) {
return false;
}
}
for (i = 0, len = exports.names.length; i < len; i++) {
if (exports.names[i].test(name)) {
return true;
}
}
return false;
}
/**
* Coerce `val`.
*
* @param {Mixed} val
* @return {Mixed}
* @api private
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}
"use strict";
/** /**
* Detect Electron renderer process, which is node, but we should * Detect Electron renderer / nwjs process, which is node, but we should
* treat as a browser. * treat as a browser.
*/ */
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
if (typeof process === 'undefined' || process.type === 'renderer') {
module.exports = require('./browser.js'); module.exports = require('./browser.js');
} else { } else {
module.exports = require('./node.js'); module.exports = require('./node.js');
} }
"use strict";
/** /**
* Module dependencies. * Module dependencies.
*/ */
var tty = require('tty'); var tty = require('tty');
var util = require('util');
var util = require('util');
/** /**
* This is the Node.js implementation of `debug()`. * This is the Node.js implementation of `debug()`.
*
* Expose `debug()` as the module.
*/ */
exports = module.exports = require('./debug');
exports.init = init; exports.init = init;
exports.log = log; exports.log = log;
exports.formatArgs = formatArgs; exports.formatArgs = formatArgs;
exports.save = save; exports.save = save;
exports.load = load; exports.load = load;
exports.useColors = useColors; exports.useColors = useColors;
/** /**
* Colors. * Colors.
*/ */
exports.colors = [ 6, 2, 3, 4, 5, 1 ]; exports.colors = [6, 2, 3, 4, 5, 1];
try { try {
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
// eslint-disable-next-line import/no-extraneous-dependencies
var supportsColor = require('supports-color'); var supportsColor = require('supports-color');
if (supportsColor && supportsColor.level >= 2) {
exports.colors = [ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221];
69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134,
135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204,
205, 206, 207, 208, 209, 214, 215, 220, 221
];
} }
} catch (err) { } catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be.
// swallow - we only care if `supports-color` is available; it doesn't have to be.
}
/** /**
* Build up the default `inspectOpts` object from the environment variables. * Build up the default `inspectOpts` object from the environment variables.
...@@ -46,74 +39,54 @@ try { ...@@ -46,74 +39,54 @@ try {
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
*/ */
exports.inspectOpts = Object.keys(process.env).filter(function (key) { exports.inspectOpts = Object.keys(process.env).filter(function (key) {
return /^debug_/i.test(key); return /^debug_/i.test(key);
}).reduce(function (obj, key) { }).reduce(function (obj, key) {
// camel-case // Camel-case
var prop = key var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) {
.substring(6) return k.toUpperCase();
.toLowerCase() }); // Coerce string value into JS value
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
// coerce string value into JS value
var val = process.env[key]; var val = process.env[key];
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
else if (/^(no|off|false|disabled)$/i.test(val)) val = false; if (/^(yes|on|true|enabled)$/i.test(val)) {
else if (val === 'null') val = null; val = true;
else val = Number(val); } else if (/^(no|off|false|disabled)$/i.test(val)) {
val = false;
} else if (val === 'null') {
val = null;
} else {
val = Number(val);
}
obj[prop] = val; obj[prop] = val;
return obj; return obj;
}, {}); }, {});
/** /**
* Is stdout a TTY? Colored output is enabled when `true`. * Is stdout a TTY? Colored output is enabled when `true`.
*/ */
function useColors() { function useColors() {
return 'colors' in exports.inspectOpts return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
? Boolean(exports.inspectOpts.colors)
: tty.isatty(process.stderr.fd);
} }
/**
* Map %o to `util.inspect()`, all on a single line.
*/
exports.formatters.o = function(v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts)
.split('\n').map(function(str) {
return str.trim()
}).join(' ');
};
/**
* Map %o to `util.inspect()`, allowing multiple lines if needed.
*/
exports.formatters.O = function(v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts);
};
/** /**
* Adds ANSI color escape codes if enabled. * Adds ANSI color escape codes if enabled.
* *
* @api public * @api public
*/ */
function formatArgs(args) { function formatArgs(args) {
var name = this.namespace; var name = this.namespace,
var useColors = this.useColors; useColors = this.useColors;
if (useColors) { if (useColors) {
var c = this.color; var c = this.color;
var colorCode = '\u001b[3' + (c < 8 ? c : '8;5;' + c); var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c);
var prefix = ' ' + colorCode + ';1m' + name + ' ' + '\u001b[0m'; var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m");
args[0] = prefix + args[0].split('\n').join('\n' + prefix); args[0] = prefix + args[0].split('\n').join('\n' + prefix);
args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m");
} else { } else {
args[0] = getDate() + name + ' ' + args[0]; args[0] = getDate() + name + ' ' + args[0];
} }
...@@ -122,19 +95,18 @@ function formatArgs(args) { ...@@ -122,19 +95,18 @@ function formatArgs(args) {
function getDate() { function getDate() {
if (exports.inspectOpts.hideDate) { if (exports.inspectOpts.hideDate) {
return ''; return '';
} else {
return new Date().toISOString() + ' ';
} }
}
return new Date().toISOString() + ' ';
}
/** /**
* Invokes `util.format()` with the specified arguments and writes to stderr. * Invokes `util.format()` with the specified arguments and writes to stderr.
*/ */
function log() { function log() {
return process.stderr.write(util.format.apply(util, arguments) + '\n'); return process.stderr.write(util.format.apply(util, arguments) + '\n');
} }
/** /**
* Save `namespaces`. * Save `namespaces`.
* *
...@@ -142,16 +114,16 @@ function log() { ...@@ -142,16 +114,16 @@ function log() {
* @api private * @api private
*/ */
function save(namespaces) { function save(namespaces) {
if (null == namespaces) { if (namespaces) {
process.env.DEBUG = namespaces;
} else {
// If you set a process.env field to null or undefined, it gets cast to the // If you set a process.env field to null or undefined, it gets cast to the
// string 'null' or 'undefined'. Just delete instead. // string 'null' or 'undefined'. Just delete instead.
delete process.env.DEBUG; delete process.env.DEBUG;
} else {
process.env.DEBUG = namespaces;
} }
} }
/** /**
* Load `namespaces`. * Load `namespaces`.
* *
...@@ -159,10 +131,10 @@ function save(namespaces) { ...@@ -159,10 +131,10 @@ function save(namespaces) {
* @api private * @api private
*/ */
function load() { function load() {
return process.env.DEBUG; return process.env.DEBUG;
} }
/** /**
* Init logic for `debug` instances. * Init logic for `debug` instances.
* *
...@@ -170,17 +142,33 @@ function load() { ...@@ -170,17 +142,33 @@ function load() {
* differently for a particular `debug` instance. * differently for a particular `debug` instance.
*/ */
function init (debug) {
debug.inspectOpts = {};
function init(debug) {
debug.inspectOpts = {};
var keys = Object.keys(exports.inspectOpts); var keys = Object.keys(exports.inspectOpts);
for (var i = 0; i < keys.length; i++) { for (var i = 0; i < keys.length; i++) {
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
} }
} }
module.exports = require('./common')(exports);
var formatters = module.exports.formatters;
/**
* Map %o to `util.inspect()`, all on a single line.
*/
formatters.o = function (v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts).replace(/\s*\n\s*/g, ' ');
};
/** /**
* Enable namespaces listed in `process.env.DEBUG` initially. * Map %O to `util.inspect()`, allowing multiple lines if needed.
*/ */
exports.enable(load());
formatters.O = function (v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts);
};
{ {
"_from": "https-proxy-agent@^2.2.1", "_from": "https-proxy-agent@2.2.4",
"_id": "https-proxy-agent@2.2.1", "_id": "https-proxy-agent@2.2.4",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-UVUpcPoE1yPgTFbQQXjD+SWSu8A=", "_integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==",
"_location": "/https-proxy-agent", "_location": "/https-proxy-agent",
"_phantomChildren": { "_phantomChildren": {
"ms": "2.0.0" "es6-promisify": "5.0.0"
}, },
"_requested": { "_requested": {
"type": "range", "type": "version",
"registry": true, "registry": true,
"raw": "https-proxy-agent@^2.2.1", "raw": "https-proxy-agent@2.2.4",
"name": "https-proxy-agent", "name": "https-proxy-agent",
"escapedName": "https-proxy-agent", "escapedName": "https-proxy-agent",
"rawSpec": "^2.2.1", "rawSpec": "2.2.4",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "^2.2.1" "fetchSpec": "2.2.4"
}, },
"_requiredBy": [ "_requiredBy": [
"/pac-proxy-agent", "/pac-proxy-agent",
"/proxy-agent" "/proxy-agent"
], ],
"_resolved": "http://registry.npm.taobao.org/https-proxy-agent/download/https-proxy-agent-2.2.1.tgz", "_resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz",
"_shasum": "51552970fa04d723e04c56d04178c3f92592bbc0", "_shasum": "4ee7a737abd92678a293d9b34a1af4d0d08c787b",
"_spec": "https-proxy-agent@^2.2.1", "_spec": "https-proxy-agent@2.2.4",
"_where": "/Users/medicean/workspace/antSword/node_modules/proxy-agent", "_where": "/Users/medicean/tools/antSword/node_modules/pac-proxy-agent",
"author": { "author": {
"name": "Nathan Rajlich", "name": "Nathan Rajlich",
"email": "nathan@tootallnate.net", "email": "nathan@tootallnate.net",
...@@ -35,14 +35,14 @@ ...@@ -35,14 +35,14 @@
}, },
"bundleDependencies": false, "bundleDependencies": false,
"dependencies": { "dependencies": {
"agent-base": "^4.1.0", "agent-base": "^4.3.0",
"debug": "^3.1.0" "debug": "^3.1.0"
}, },
"deprecated": false, "deprecated": false,
"description": "An HTTP(s) proxy `http.Agent` implementation for HTTPS", "description": "An HTTP(s) proxy `http.Agent` implementation for HTTPS",
"devDependencies": { "devDependencies": {
"mocha": "^3.4.2", "mocha": "^6.2.0",
"proxy": "^0.2.4" "proxy": "1"
}, },
"engines": { "engines": {
"node": ">= 4.5.0" "node": ">= 4.5.0"
...@@ -64,5 +64,6 @@ ...@@ -64,5 +64,6 @@
"scripts": { "scripts": {
"test": "mocha --reporter spec" "test": "mocha --reporter spec"
}, },
"version": "2.2.1" "types": "./index.d.ts",
"version": "2.2.4"
} }
-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQCzURxIqzer0ACAbX/lHdsn4Gd9PLKrf7EeDYfIdV0HZKPD8WDr
bBx2/fBu0OW2sjnzv/SVZbJ0DAuPE/p0+eT0qb2qC10iz9iTD7ribd7gxhirVb8y
b3fBjXsxc8V8p4Ny1LcvNSqCjwUbJqdRogfoJeTiqPM58z5sNzuv5iq7iwIDAQAB
AoGAPMQy4olrP0UotlzlJ36bowLP70ffgHCwU+/f4NWs5fF78c3du0oSx1w820Dd
Z7E0JF8bgnlJJTxjumPZz0RUCugrEHBKJmzEz3cxF5E3+7NvteZcjKn9D67RrM5x
1/uSZ9cqKE9cYvY4fSuHx18diyZ4axR/wB1Pea2utjjDM+ECQQDb9ZbmmaWMiRpQ
5Up+loxP7BZNPsEVsm+DVJmEFbaFgGfncWBqSIqnPNjMwTwj0OigTwCAEGPkfRVW
T0pbYWCxAkEA0LK7SCTwzyDmhASUalk0x+3uCAA6ryFdwJf/wd8TRAvVOmkTEldX
uJ7ldLvfrONYO3v56uKTU/SoNdZYzKtO+wJAX2KM4ctXYy5BXztPpr2acz4qHa1N
Bh+vBAC34fOYhyQ76r3b1btHhWZ5jbFuZwm9F2erC94Ps5IaoqcX07DSwQJAPKGw
h2U0EPkd/3zVIZCJJQya+vgWFIs9EZcXVtvYXQyTBkVApTN66MhBIYjzkub5205J
bVQmOV37AKklY1DhwQJAA1wos0cYxro02edzatxd0DIR2r4qqOqLkw6BhYHhq6HJ
ZvIcQkHqdSXzdETFc01I1znDGGIrJHcnvKWgBPoEUg==
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIIB1TCCAT4CCQDV5mPlzm9+izANBgkqhkiG9w0BAQUFADAvMS0wKwYDVQQDEyQ3
NTI3YmQ3Ny1hYjNlLTQ3NGItYWNlNy1lZWQ2MDUzOTMxZTcwHhcNMTUwNzA2MjI0
NTA3WhcNMjUwNzAzMjI0NTA3WjAvMS0wKwYDVQQDEyQ3NTI3YmQ3Ny1hYjNlLTQ3
NGItYWNlNy1lZWQ2MDUzOTMxZTcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
ALNRHEirN6vQAIBtf+Ud2yfgZ308sqt/sR4Nh8h1XQdko8PxYOtsHHb98G7Q5bay
OfO/9JVlsnQMC48T+nT55PSpvaoLXSLP2JMPuuJt3uDGGKtVvzJvd8GNezFzxXyn
g3LUty81KoKPBRsmp1GiB+gl5OKo8znzPmw3O6/mKruLAgMBAAEwDQYJKoZIhvcN
AQEFBQADgYEACzoHUF8UV2Z6541Q2wKEA0UFUzmUjf/E1XwBO+1P15ZZ64uw34B4
1RwMPtAo9RY/PmICTWtNxWGxkzwb2JtDWtnxVER/lF8k2XcXPE76fxTHJF/BKk9J
QU8OTD1dd9gHCBviQB9TqntRZ5X7axjtuWjb2umY+owBYzAHZkp1HKI=
-----END CERTIFICATE-----
This diff is collapsed.
...@@ -39,7 +39,7 @@ Also read about: ...@@ -39,7 +39,7 @@ Also read about:
## Usage ## Usage
### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML by default 🚨 ### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML. Please use a sanitize library, like [DOMPurify](https://github.com/cure53/DOMPurify) (recommended), [sanitize-html](https://github.com/apostrophecms/sanitize-html) or [insane](https://github.com/bevacqua/insane) on the output HTML! 🚨
**CLI** **CLI**
......
...@@ -194,7 +194,7 @@ function camelize(text) { ...@@ -194,7 +194,7 @@ function camelize(text) {
function handleError(err) { function handleError(err) {
if (err.code === 'ENOENT') { if (err.code === 'ENOENT') {
console.error(`marked: output to ${err.path}: No such directory`); console.error('marked: output to ' + err.path + ': No such directory');
return process.exit(1); return process.exit(1);
} }
throw err; throw err;
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ marked \- a javascript markdown parser ...@@ -8,7 +8,7 @@ marked \- a javascript markdown parser
.B marked .B marked
[\-o \fI<output>\fP] [\-i \fI<input>\fP] [\-\-help] [\-o \fI<output>\fP] [\-i \fI<input>\fP] [\-\-help]
[\-\-tokens] [\-\-pedantic] [\-\-gfm] [\-\-tokens] [\-\-pedantic] [\-\-gfm]
[\-\-breaks] [\-\-tables] [\-\-sanitize] [\-\-breaks] [\-\-sanitize]
[\-\-smart\-lists] [\-\-lang\-prefix \fI<prefix>\fP] [\-\-smart\-lists] [\-\-lang\-prefix \fI<prefix>\fP]
[\-\-no\-etc...] [\-\-silent] [\fIfilename\fP] [\-\-no\-etc...] [\-\-silent] [\fIfilename\fP]
...@@ -72,9 +72,6 @@ Enable github flavored markdown. ...@@ -72,9 +72,6 @@ Enable github flavored markdown.
.BI \-\-breaks .BI \-\-breaks
Enable GFM line breaks. Only works with the gfm option. Enable GFM line breaks. Only works with the gfm option.
.TP .TP
.BI \-\-tables
Enable GFM tables. Only works with the gfm option.
.TP
.BI \-\-sanitize .BI \-\-sanitize
Sanitize output. Ignore any HTML input. Sanitize output. Ignore any HTML input.
.TP .TP
......
...@@ -4,10 +4,10 @@ NAME ...@@ -4,10 +4,10 @@ NAME
marked - a javascript markdown parser marked - a javascript markdown parser
SYNOPSIS SYNOPSIS
marked [-o <output>] [-i <input>] [--help] [--tokens] marked [-o <output>] [-i <input>] [--help] [--tokens] [--pedantic]
[--pedantic] [--gfm] [--breaks] [--tables] [--sanitize] [--gfm] [--breaks] [--sanitize] [--smart-lists] [--lang-prefix <pre-
[--smart-lists] [--lang-prefix <prefix>] [--no-etc...] [--silent] fix>] [--no-etc...] [--silent] [filename]
[filename]
DESCRIPTION DESCRIPTION
marked is a full-featured javascript markdown parser, built for speed. marked is a full-featured javascript markdown parser, built for speed.
...@@ -56,9 +56,6 @@ OPTIONS ...@@ -56,9 +56,6 @@ OPTIONS
--breaks --breaks
Enable GFM line breaks. Only works with the gfm option. Enable GFM line breaks. Only works with the gfm option.
--tables
Enable GFM tables. Only works with the gfm option.
--sanitize --sanitize
Sanitize output. Ignore any HTML input. Sanitize output. Ignore any HTML input.
......
This diff is collapsed.
{ {
"_from": "marked", "_from": "marked@^0.7.0",
"_id": "marked@0.6.2", "_id": "marked@0.7.0",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-xXS+i1Rai0hkFFbKHb4ON7bczBo=", "_integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==",
"_location": "/marked", "_location": "/marked",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "tag", "type": "range",
"registry": true, "registry": true,
"raw": "marked", "raw": "marked@^0.7.0",
"name": "marked", "name": "marked",
"escapedName": "marked", "escapedName": "marked",
"rawSpec": "", "rawSpec": "^0.7.0",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "latest" "fetchSpec": "^0.7.0"
}, },
"_requiredBy": [ "_requiredBy": [
"#USER",
"/" "/"
], ],
"_resolved": "https://registry.npm.taobao.org/marked/download/marked-0.6.2.tgz", "_resolved": "https://registry.npmjs.org/marked/-/marked-0.7.0.tgz",
"_shasum": "c574be8b545a8b48641456ca1dbe0e37b6dccc1a", "_shasum": "b64201f051d271b1edc10a04d1ae9b74bb8e5c0e",
"_spec": "marked", "_spec": "marked@^0.7.0",
"_where": "/Users/medicean/workspace/antSword", "_where": "/Users/medicean/tools/antSword",
"author": { "author": {
"name": "Christopher Jeffrey" "name": "Christopher Jeffrey"
}, },
"bin": { "bin": {
"marked": "./bin/marked" "marked": "bin/marked"
}, },
"bugs": { "bugs": {
"url": "http://github.com/markedjs/marked/issues" "url": "http://github.com/markedjs/marked/issues"
...@@ -37,20 +36,21 @@ ...@@ -37,20 +36,21 @@
"description": "A markdown parser built for speed", "description": "A markdown parser built for speed",
"devDependencies": { "devDependencies": {
"@markedjs/html-differ": "^2.0.1", "@markedjs/html-differ": "^2.0.1",
"cheerio": "^1.0.0-rc.3",
"commonmark": "0.x", "commonmark": "0.x",
"eslint": "^5.15.1", "eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0", "eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.16.0", "eslint-plugin-import": "^2.17.2",
"eslint-plugin-node": "^8.0.1", "eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1", "eslint-plugin-promise": "^4.1.1",
"eslint-plugin-standard": "^4.0.0", "eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vuln-regex-detector": "^1.0.4", "eslint-plugin-vuln-regex-detector": "^1.0.4",
"front-matter": "^3.0.1", "front-matter": "^3.0.2",
"glob-to-regexp": "^0.4.0", "jasmine": "^3.4.0",
"jasmine": "^3.3.1",
"markdown": "0.x", "markdown": "0.x",
"markdown-it": "8.x", "markdown-it": "8.x",
"uglify-js": "^3.4.9" "node-fetch": "^2.3.0",
"uglify-js": "^3.5.8"
}, },
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
...@@ -78,25 +78,22 @@ ...@@ -78,25 +78,22 @@
"url": "git://github.com/markedjs/marked.git" "url": "git://github.com/markedjs/marked.git"
}, },
"scripts": { "scripts": {
"bench": "node test --bench", "bench": "node test/bench.js",
"build": "uglifyjs lib/marked.js -cm --comments /Copyright/ -o marked.min.js", "build": "uglifyjs lib/marked.js -cm --comments /Copyright/ -o marked.min.js",
"lint": "eslint --fix bin/marked .", "lint": "eslint --fix bin/marked .",
"preversion": "npm run build && (git diff --quiet || git commit -am 'minify')", "preversion": "npm run build && (git diff --quiet || git commit -am 'minify')",
"test": "jasmine --config=jasmine.json", "test": "jasmine --config=jasmine.json",
"test:cm": "npm test -- test/specs/commonmark/**/*-spec.js",
"test:gfm": "npm test -- test/specs/gfm/**/*-spec.js",
"test:lint": "eslint bin/marked .", "test:lint": "eslint bin/marked .",
"test:marked": "npm test -- test/specs/marked/**/*-spec.js",
"test:node4": "npx node@4 ./node_modules/jasmine/bin/jasmine.js --config=jasmine.json", "test:node4": "npx node@4 ./node_modules/jasmine/bin/jasmine.js --config=jasmine.json",
"test:old": "node test",
"test:redos": "eslint --plugin vuln-regex-detector --rule '\"vuln-regex-detector/no-vuln-regex\": 2' lib/marked.js", "test:redos": "eslint --plugin vuln-regex-detector --rule '\"vuln-regex-detector/no-vuln-regex\": 2' lib/marked.js",
"test:specs": "npm test -- test/specs/**/*-spec.js", "test:specs": "npm test -- test/specs/**/*-spec.js",
"test:unit": "npm test -- test/unit/**/*-spec.js" "test:unit": "npm test -- test/unit/**/*-spec.js",
"test:update": "node test/update-specs.js"
}, },
"tags": [ "tags": [
"markdown", "markdown",
"markup", "markup",
"html" "html"
], ],
"version": "0.6.2" "version": "0.7.0"
} }
language: node_js
node_js:
- "0.8"
- "0.10"
- "0.12"
- "iojs"
before_install:
- npm install -g npm@~1.4.6
var mkdirp = require('mkdirp');
mkdirp('/tmp/foo/bar/baz', function (err) {
if (err) console.error(err)
else console.log('pow!')
});
...@@ -17,7 +17,7 @@ function mkdirP (p, opts, f, made) { ...@@ -17,7 +17,7 @@ function mkdirP (p, opts, f, made) {
var xfs = opts.fs || fs; var xfs = opts.fs || fs;
if (mode === undefined) { if (mode === undefined) {
mode = _0777 & (~process.umask()); mode = _0777
} }
if (!made) made = null; if (!made) made = null;
...@@ -31,6 +31,7 @@ function mkdirP (p, opts, f, made) { ...@@ -31,6 +31,7 @@ function mkdirP (p, opts, f, made) {
} }
switch (er.code) { switch (er.code) {
case 'ENOENT': case 'ENOENT':
if (path.dirname(p) === p) return cb(er);
mkdirP(path.dirname(p), opts, function (er, made) { mkdirP(path.dirname(p), opts, function (er, made) {
if (er) cb(er, made); if (er) cb(er, made);
else mkdirP(p, opts, cb, made); else mkdirP(p, opts, cb, made);
...@@ -61,7 +62,7 @@ mkdirP.sync = function sync (p, opts, made) { ...@@ -61,7 +62,7 @@ mkdirP.sync = function sync (p, opts, made) {
var xfs = opts.fs || fs; var xfs = opts.fs || fs;
if (mode === undefined) { if (mode === undefined) {
mode = _0777 & (~process.umask()); mode = _0777
} }
if (!made) made = null; if (!made) made = null;
......
{ {
"_from": "mkdirp@0.5.1", "_from": "mkdirp@0.5.5",
"_id": "mkdirp@0.5.1", "_id": "mkdirp@0.5.5",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "_integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"_location": "/mkdirp", "_location": "/mkdirp",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "version",
"registry": true, "registry": true,
"raw": "mkdirp@0.5.1", "raw": "mkdirp@0.5.5",
"name": "mkdirp", "name": "mkdirp",
"escapedName": "mkdirp", "escapedName": "mkdirp",
"rawSpec": "0.5.1", "rawSpec": "0.5.5",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "0.5.1" "fetchSpec": "0.5.5"
}, },
"_requiredBy": [ "_requiredBy": [
"/extract-zip" "/tar"
], ],
"_resolved": "http://registry.npm.taobao.org/mkdirp/download/mkdirp-0.5.1.tgz", "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"_shasum": "30057438eac6cf7f8c4767f38648d6697d75c903", "_shasum": "d91cefd62d1436ca0f41620e251288d420099def",
"_spec": "mkdirp@0.5.1", "_spec": "mkdirp@0.5.5",
"_where": "/Users/medicean/workspace/antSword/node_modules/extract-zip", "_where": "/Users/medicean/tools/antSword/node_modules/tar",
"author": { "author": {
"name": "James Halliday", "name": "James Halliday",
"email": "mail@substack.net", "email": "mail@substack.net",
...@@ -35,14 +35,18 @@ ...@@ -35,14 +35,18 @@
}, },
"bundleDependencies": false, "bundleDependencies": false,
"dependencies": { "dependencies": {
"minimist": "0.0.8" "minimist": "^1.2.5"
}, },
"deprecated": false, "deprecated": false,
"description": "Recursively mkdir, like `mkdir -p`", "description": "Recursively mkdir, like `mkdir -p`",
"devDependencies": { "devDependencies": {
"mock-fs": "2 >=2.7.0", "mock-fs": "^3.7.0",
"tap": "1" "tap": "^5.4.2"
}, },
"files": [
"bin",
"index.js"
],
"homepage": "https://github.com/substack/node-mkdirp#readme", "homepage": "https://github.com/substack/node-mkdirp#readme",
"keywords": [ "keywords": [
"mkdir", "mkdir",
...@@ -51,6 +55,9 @@ ...@@ -51,6 +55,9 @@
"license": "MIT", "license": "MIT",
"main": "index.js", "main": "index.js",
"name": "mkdirp", "name": "mkdirp",
"publishConfig": {
"tag": "legacy"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/substack/node-mkdirp.git" "url": "git+https://github.com/substack/node-mkdirp.git"
...@@ -58,5 +65,5 @@ ...@@ -58,5 +65,5 @@
"scripts": { "scripts": {
"test": "tap test/*.js" "test": "tap test/*.js"
}, },
"version": "0.5.1" "version": "0.5.5"
} }
...@@ -37,7 +37,7 @@ Create a new directory and any necessary subdirectories at `dir` with octal ...@@ -37,7 +37,7 @@ Create a new directory and any necessary subdirectories at `dir` with octal
permission string `opts.mode`. If `opts` is a non-object, it will be treated as permission string `opts.mode`. If `opts` is a non-object, it will be treated as
the `opts.mode`. the `opts.mode`.
If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. If `opts.mode` isn't specified, it defaults to `0777`.
`cb(err, made)` fires with the error or the first directory `made` `cb(err, made)` fires with the error or the first directory `made`
that had to be created, if any. that had to be created, if any.
...@@ -52,7 +52,7 @@ Synchronously create a new directory and any necessary subdirectories at `dir` ...@@ -52,7 +52,7 @@ Synchronously create a new directory and any necessary subdirectories at `dir`
with octal permission string `opts.mode`. If `opts` is a non-object, it will be with octal permission string `opts.mode`. If `opts` is a non-object, it will be
treated as the `opts.mode`. treated as the `opts.mode`.
If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. If `opts.mode` isn't specified, it defaults to `0777`.
Returns the first directory that had to be created, if any. Returns the first directory that had to be created, if any.
......
var mkdirp = require('../').mkdirp;
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
var _0744 = parseInt('0744', 8);
var ps = [ '', 'tmp' ];
for (var i = 0; i < 25; i++) {
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
ps.push(dir);
}
var file = ps.join('/');
test('chmod-pre', function (t) {
var mode = _0744
mkdirp(file, mode, function (er) {
t.ifError(er, 'should not error');
fs.stat(file, function (er, stat) {
t.ifError(er, 'should exist');
t.ok(stat && stat.isDirectory(), 'should be directory');
t.equal(stat && stat.mode & _0777, mode, 'should be 0744');
t.end();
});
});
});
test('chmod', function (t) {
var mode = _0755
mkdirp(file, mode, function (er) {
t.ifError(er, 'should not error');
fs.stat(file, function (er, stat) {
t.ifError(er, 'should exist');
t.ok(stat && stat.isDirectory(), 'should be directory');
t.end();
});
});
});
var mkdirp = require('../').mkdirp;
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
var _0755 = parseInt('0755', 8);
var ps = [ '', 'tmp' ];
for (var i = 0; i < 25; i++) {
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
ps.push(dir);
}
var file = ps.join('/');
// a file in the way
var itw = ps.slice(0, 3).join('/');
test('clobber-pre', function (t) {
console.error("about to write to "+itw)
fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.');
fs.stat(itw, function (er, stat) {
t.ifError(er)
t.ok(stat && stat.isFile(), 'should be file')
t.end()
})
})
test('clobber', function (t) {
t.plan(2);
mkdirp(file, _0755, function (err) {
t.ok(err);
t.equal(err.code, 'ENOTDIR');
t.end();
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('woo', function (t) {
t.plan(5);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
mkdirp(file, _0755, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
})
})
});
});
var mkdirp = require('../');
var path = require('path');
var test = require('tap').test;
var mockfs = require('mock-fs');
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('opts.fs', function (t) {
t.plan(5);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/beep/boop/' + [x,y,z].join('/');
var xfs = mockfs.fs();
mkdirp(file, { fs: xfs, mode: _0755 }, function (err) {
t.ifError(err);
xfs.exists(file, function (ex) {
t.ok(ex, 'created file');
xfs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});
});
var mkdirp = require('../');
var path = require('path');
var test = require('tap').test;
var mockfs = require('mock-fs');
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('opts.fs sync', function (t) {
t.plan(4);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/beep/boop/' + [x,y,z].join('/');
var xfs = mockfs.fs();
mkdirp.sync(file, { fs: xfs, mode: _0755 });
xfs.exists(file, function (ex) {
t.ok(ex, 'created file');
xfs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('async perm', function (t) {
t.plan(5);
var file = '/tmp/' + (Math.random() * (1<<30)).toString(16);
mkdirp(file, _0755, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
})
})
});
});
test('async root perm', function (t) {
mkdirp('/tmp', _0755, function (err) {
if (err) t.fail(err);
t.end();
});
t.end();
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('sync perm', function (t) {
t.plan(4);
var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json';
mkdirp.sync(file, _0755);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});
test('sync root perm', function (t) {
t.plan(3);
var file = '/tmp';
mkdirp.sync(file, _0755);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.ok(stat.isDirectory(), 'target not a directory');
})
});
});
var mkdirp = require('../').mkdirp;
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('race', function (t) {
t.plan(10);
var ps = [ '', 'tmp' ];
for (var i = 0; i < 25; i++) {
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
ps.push(dir);
}
var file = ps.join('/');
var res = 2;
mk(file);
mk(file);
function mk (file, cb) {
mkdirp(file, _0755, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
})
});
}
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('rel', function (t) {
t.plan(5);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var cwd = process.cwd();
process.chdir('/tmp');
var file = [x,y,z].join('/');
mkdirp(file, _0755, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
process.chdir(cwd);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
})
})
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
test('return value', function (t) {
t.plan(4);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
// should return the first dir created.
// By this point, it would be profoundly surprising if /tmp didn't
// already exist, since every other test makes things in there.
mkdirp(file, function (err, made) {
t.ifError(err);
t.equal(made, '/tmp/' + x);
mkdirp(file, function (err, made) {
t.ifError(err);
t.equal(made, null);
});
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
test('return value', function (t) {
t.plan(2);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
// should return the first dir created.
// By this point, it would be profoundly surprising if /tmp didn't
// already exist, since every other test makes things in there.
// Note that this will throw on failure, which will fail the test.
var made = mkdirp.sync(file);
t.equal(made, '/tmp/' + x);
// making the same file again should have no effect.
made = mkdirp.sync(file);
t.equal(made, null);
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
var _0755 = parseInt('0755', 8);
test('root', function (t) {
// '/' on unix, 'c:/' on windows.
var file = path.resolve('/');
mkdirp(file, _0755, function (err) {
if (err) throw err
fs.stat(file, function (er, stat) {
if (er) throw er
t.ok(stat.isDirectory(), 'target is a directory');
t.end();
})
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('sync', function (t) {
t.plan(4);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
try {
mkdirp.sync(file, _0755);
} catch (err) {
t.fail(err);
return t.end();
}
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('implicit mode from umask', function (t) {
t.plan(5);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
mkdirp(file, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0777 & (~process.umask()));
t.ok(stat.isDirectory(), 'target not a directory');
});
})
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('umask sync modes', function (t) {
t.plan(4);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
try {
mkdirp.sync(file);
} catch (err) {
t.fail(err);
return t.end();
}
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, (_0777 & (~process.umask())));
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});
language: node_js
node_js:
- "0.8"
- "0.10"
- "0.12"
- "iojs"
before_install:
- npm install -g npm@~1.4.6
var mkdirp = require('mkdirp');
mkdirp('/tmp/foo/bar/baz', function (err) {
if (err) console.error(err)
else console.log('pow!')
});
...@@ -17,7 +17,7 @@ function mkdirP (p, opts, f, made) { ...@@ -17,7 +17,7 @@ function mkdirP (p, opts, f, made) {
var xfs = opts.fs || fs; var xfs = opts.fs || fs;
if (mode === undefined) { if (mode === undefined) {
mode = _0777 & (~process.umask()); mode = _0777
} }
if (!made) made = null; if (!made) made = null;
...@@ -31,6 +31,7 @@ function mkdirP (p, opts, f, made) { ...@@ -31,6 +31,7 @@ function mkdirP (p, opts, f, made) {
} }
switch (er.code) { switch (er.code) {
case 'ENOENT': case 'ENOENT':
if (path.dirname(p) === p) return cb(er);
mkdirP(path.dirname(p), opts, function (er, made) { mkdirP(path.dirname(p), opts, function (er, made) {
if (er) cb(er, made); if (er) cb(er, made);
else mkdirP(p, opts, cb, made); else mkdirP(p, opts, cb, made);
...@@ -61,7 +62,7 @@ mkdirP.sync = function sync (p, opts, made) { ...@@ -61,7 +62,7 @@ mkdirP.sync = function sync (p, opts, made) {
var xfs = opts.fs || fs; var xfs = opts.fs || fs;
if (mode === undefined) { if (mode === undefined) {
mode = _0777 & (~process.umask()); mode = _0777
} }
if (!made) made = null; if (!made) made = null;
......
{ {
"_args": [ "_from": "mkdirp@0.5.5",
[ "_id": "mkdirp@0.5.5",
"mkdirp@~0.5.1", "_inBundle": false,
"/Volumes/AntSword-dev/git/antSword/node_modules/nedb" "_integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
]
],
"_from": "mkdirp@>=0.5.1 <0.6.0",
"_id": "mkdirp@0.5.1",
"_inCache": true,
"_installable": true,
"_location": "/nedb/mkdirp", "_location": "/nedb/mkdirp",
"_nodeVersion": "2.0.0",
"_npmUser": {
"email": "substack@gmail.com",
"name": "substack"
},
"_npmVersion": "2.9.0",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version",
"registry": true,
"raw": "mkdirp@0.5.5",
"name": "mkdirp", "name": "mkdirp",
"raw": "mkdirp@~0.5.1", "escapedName": "mkdirp",
"rawSpec": "~0.5.1", "rawSpec": "0.5.5",
"scope": null, "saveSpec": null,
"spec": ">=0.5.1 <0.6.0", "fetchSpec": "0.5.5"
"type": "range"
}, },
"_requiredBy": [ "_requiredBy": [
"/nedb" "/nedb"
], ],
"_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"_shasum": "30057438eac6cf7f8c4767f38648d6697d75c903", "_shasum": "d91cefd62d1436ca0f41620e251288d420099def",
"_shrinkwrap": null, "_spec": "mkdirp@0.5.5",
"_spec": "mkdirp@~0.5.1", "_where": "/Users/medicean/tools/antSword/node_modules/nedb",
"_where": "/Volumes/AntSword-dev/git/antSword/node_modules/nedb",
"author": { "author": {
"email": "mail@substack.net",
"name": "James Halliday", "name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net" "url": "http://substack.net"
}, },
"bin": { "bin": {
...@@ -44,20 +33,20 @@ ...@@ -44,20 +33,20 @@
"bugs": { "bugs": {
"url": "https://github.com/substack/node-mkdirp/issues" "url": "https://github.com/substack/node-mkdirp/issues"
}, },
"bundleDependencies": false,
"dependencies": { "dependencies": {
"minimist": "0.0.8" "minimist": "^1.2.5"
}, },
"deprecated": false,
"description": "Recursively mkdir, like `mkdir -p`", "description": "Recursively mkdir, like `mkdir -p`",
"devDependencies": { "devDependencies": {
"mock-fs": "2 >=2.7.0", "mock-fs": "^3.7.0",
"tap": "1" "tap": "^5.4.2"
}, },
"directories": {}, "files": [
"dist": { "bin",
"shasum": "30057438eac6cf7f8c4767f38648d6697d75c903", "index.js"
"tarball": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz" ],
},
"gitHead": "d4eff0f06093aed4f387e88e9fc301cb76beedc7",
"homepage": "https://github.com/substack/node-mkdirp#readme", "homepage": "https://github.com/substack/node-mkdirp#readme",
"keywords": [ "keywords": [
"mkdir", "mkdir",
...@@ -65,15 +54,10 @@ ...@@ -65,15 +54,10 @@
], ],
"license": "MIT", "license": "MIT",
"main": "index.js", "main": "index.js",
"maintainers": [
{
"email": "mail@substack.net",
"name": "substack"
}
],
"name": "mkdirp", "name": "mkdirp",
"optionalDependencies": {}, "publishConfig": {
"readme": "ERROR: No README data found!", "tag": "legacy"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/substack/node-mkdirp.git" "url": "git+https://github.com/substack/node-mkdirp.git"
...@@ -81,5 +65,5 @@ ...@@ -81,5 +65,5 @@
"scripts": { "scripts": {
"test": "tap test/*.js" "test": "tap test/*.js"
}, },
"version": "0.5.1" "version": "0.5.5"
} }
...@@ -37,7 +37,7 @@ Create a new directory and any necessary subdirectories at `dir` with octal ...@@ -37,7 +37,7 @@ Create a new directory and any necessary subdirectories at `dir` with octal
permission string `opts.mode`. If `opts` is a non-object, it will be treated as permission string `opts.mode`. If `opts` is a non-object, it will be treated as
the `opts.mode`. the `opts.mode`.
If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. If `opts.mode` isn't specified, it defaults to `0777`.
`cb(err, made)` fires with the error or the first directory `made` `cb(err, made)` fires with the error or the first directory `made`
that had to be created, if any. that had to be created, if any.
...@@ -52,7 +52,7 @@ Synchronously create a new directory and any necessary subdirectories at `dir` ...@@ -52,7 +52,7 @@ Synchronously create a new directory and any necessary subdirectories at `dir`
with octal permission string `opts.mode`. If `opts` is a non-object, it will be with octal permission string `opts.mode`. If `opts` is a non-object, it will be
treated as the `opts.mode`. treated as the `opts.mode`.
If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. If `opts.mode` isn't specified, it defaults to `0777`.
Returns the first directory that had to be created, if any. Returns the first directory that had to be created, if any.
......
var mkdirp = require('../').mkdirp;
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
var _0744 = parseInt('0744', 8);
var ps = [ '', 'tmp' ];
for (var i = 0; i < 25; i++) {
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
ps.push(dir);
}
var file = ps.join('/');
test('chmod-pre', function (t) {
var mode = _0744
mkdirp(file, mode, function (er) {
t.ifError(er, 'should not error');
fs.stat(file, function (er, stat) {
t.ifError(er, 'should exist');
t.ok(stat && stat.isDirectory(), 'should be directory');
t.equal(stat && stat.mode & _0777, mode, 'should be 0744');
t.end();
});
});
});
test('chmod', function (t) {
var mode = _0755
mkdirp(file, mode, function (er) {
t.ifError(er, 'should not error');
fs.stat(file, function (er, stat) {
t.ifError(er, 'should exist');
t.ok(stat && stat.isDirectory(), 'should be directory');
t.end();
});
});
});
var mkdirp = require('../').mkdirp;
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
var _0755 = parseInt('0755', 8);
var ps = [ '', 'tmp' ];
for (var i = 0; i < 25; i++) {
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
ps.push(dir);
}
var file = ps.join('/');
// a file in the way
var itw = ps.slice(0, 3).join('/');
test('clobber-pre', function (t) {
console.error("about to write to "+itw)
fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.');
fs.stat(itw, function (er, stat) {
t.ifError(er)
t.ok(stat && stat.isFile(), 'should be file')
t.end()
})
})
test('clobber', function (t) {
t.plan(2);
mkdirp(file, _0755, function (err) {
t.ok(err);
t.equal(err.code, 'ENOTDIR');
t.end();
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('woo', function (t) {
t.plan(5);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
mkdirp(file, _0755, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
})
})
});
});
var mkdirp = require('../');
var path = require('path');
var test = require('tap').test;
var mockfs = require('mock-fs');
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('opts.fs', function (t) {
t.plan(5);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/beep/boop/' + [x,y,z].join('/');
var xfs = mockfs.fs();
mkdirp(file, { fs: xfs, mode: _0755 }, function (err) {
t.ifError(err);
xfs.exists(file, function (ex) {
t.ok(ex, 'created file');
xfs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});
});
var mkdirp = require('../');
var path = require('path');
var test = require('tap').test;
var mockfs = require('mock-fs');
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('opts.fs sync', function (t) {
t.plan(4);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/beep/boop/' + [x,y,z].join('/');
var xfs = mockfs.fs();
mkdirp.sync(file, { fs: xfs, mode: _0755 });
xfs.exists(file, function (ex) {
t.ok(ex, 'created file');
xfs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('async perm', function (t) {
t.plan(5);
var file = '/tmp/' + (Math.random() * (1<<30)).toString(16);
mkdirp(file, _0755, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
})
})
});
});
test('async root perm', function (t) {
mkdirp('/tmp', _0755, function (err) {
if (err) t.fail(err);
t.end();
});
t.end();
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('sync perm', function (t) {
t.plan(4);
var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json';
mkdirp.sync(file, _0755);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});
test('sync root perm', function (t) {
t.plan(3);
var file = '/tmp';
mkdirp.sync(file, _0755);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.ok(stat.isDirectory(), 'target not a directory');
})
});
});
var mkdirp = require('../').mkdirp;
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('race', function (t) {
t.plan(10);
var ps = [ '', 'tmp' ];
for (var i = 0; i < 25; i++) {
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
ps.push(dir);
}
var file = ps.join('/');
var res = 2;
mk(file);
mk(file);
function mk (file, cb) {
mkdirp(file, _0755, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
})
});
}
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('rel', function (t) {
t.plan(5);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var cwd = process.cwd();
process.chdir('/tmp');
var file = [x,y,z].join('/');
mkdirp(file, _0755, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
process.chdir(cwd);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
})
})
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
test('return value', function (t) {
t.plan(4);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
// should return the first dir created.
// By this point, it would be profoundly surprising if /tmp didn't
// already exist, since every other test makes things in there.
mkdirp(file, function (err, made) {
t.ifError(err);
t.equal(made, '/tmp/' + x);
mkdirp(file, function (err, made) {
t.ifError(err);
t.equal(made, null);
});
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
test('return value', function (t) {
t.plan(2);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
// should return the first dir created.
// By this point, it would be profoundly surprising if /tmp didn't
// already exist, since every other test makes things in there.
// Note that this will throw on failure, which will fail the test.
var made = mkdirp.sync(file);
t.equal(made, '/tmp/' + x);
// making the same file again should have no effect.
made = mkdirp.sync(file);
t.equal(made, null);
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
var _0755 = parseInt('0755', 8);
test('root', function (t) {
// '/' on unix, 'c:/' on windows.
var file = path.resolve('/');
mkdirp(file, _0755, function (err) {
if (err) throw err
fs.stat(file, function (er, stat) {
if (er) throw er
t.ok(stat.isDirectory(), 'target is a directory');
t.end();
})
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('sync', function (t) {
t.plan(4);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
try {
mkdirp.sync(file, _0755);
} catch (err) {
t.fail(err);
return t.end();
}
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0755);
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('implicit mode from umask', function (t) {
t.plan(5);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
mkdirp(file, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0777 & (~process.umask()));
t.ok(stat.isDirectory(), 'target not a directory');
});
})
});
});
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('umask sync modes', function (t) {
t.plan(4);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
try {
mkdirp.sync(file);
} catch (err) {
t.fail(err);
return t.end();
}
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, (_0777 & (~process.umask())));
t.ok(stat.isDirectory(), 'target not a directory');
});
});
});
...@@ -238,9 +238,9 @@ ...@@ -238,9 +238,9 @@
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs="
}, },
"extend": { "extend": {
"version": "3.0.0", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
"integrity": "sha1-WkdDU7nzNT3dgXbf03uRyDpG8dQ=" "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
}, },
"extract-zip": { "extract-zip": {
"version": "1.6.7", "version": "1.6.7",
...@@ -251,6 +251,16 @@ ...@@ -251,6 +251,16 @@
"debug": "2.6.9", "debug": "2.6.9",
"mkdirp": "0.5.1", "mkdirp": "0.5.1",
"yauzl": "2.4.1" "yauzl": "2.4.1"
},
"dependencies": {
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"requires": {
"minimist": "0.0.8"
}
}
} }
}, },
"falafel": { "falafel": {
...@@ -400,21 +410,34 @@ ...@@ -400,21 +410,34 @@
} }
}, },
"https-proxy-agent": { "https-proxy-agent": {
"version": "2.2.1", "version": "2.2.4",
"resolved": "http://registry.npm.taobao.org/https-proxy-agent/download/https-proxy-agent-2.2.1.tgz", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz",
"integrity": "sha1-UVUpcPoE1yPgTFbQQXjD+SWSu8A=", "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==",
"requires": { "requires": {
"agent-base": "^4.1.0", "agent-base": "^4.3.0",
"debug": "^3.1.0" "debug": "^3.1.0"
}, },
"dependencies": { "dependencies": {
"agent-base": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz",
"integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==",
"requires": {
"es6-promisify": "^5.0.0"
}
},
"debug": { "debug": {
"version": "3.1.0", "version": "3.2.6",
"resolved": "http://registry.npm.taobao.org/debug/download/debug-3.1.0.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
"integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
"requires": { "requires": {
"ms": "2.0.0" "ms": "^2.1.1"
} }
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
} }
} }
}, },
...@@ -512,9 +535,9 @@ ...@@ -512,9 +535,9 @@
} }
}, },
"marked": { "marked": {
"version": "0.6.2", "version": "0.7.0",
"resolved": "https://registry.npm.taobao.org/marked/download/marked-0.6.2.tgz", "resolved": "https://registry.npmjs.org/marked/-/marked-0.7.0.tgz",
"integrity": "sha1-xXS+i1Rai0hkFFbKHb4ON7bczBo=" "integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg=="
}, },
"methods": { "methods": {
"version": "1.1.2", "version": "1.1.2",
...@@ -569,11 +592,18 @@ ...@@ -569,11 +592,18 @@
} }
}, },
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.5",
"resolved": "http://registry.npm.taobao.org/mkdirp/download/mkdirp-0.5.1.tgz", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "^1.2.5"
},
"dependencies": {
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
}
} }
}, },
"ms": { "ms": {
...@@ -594,11 +624,18 @@ ...@@ -594,11 +624,18 @@
}, },
"dependencies": { "dependencies": {
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "^1.2.5"
},
"dependencies": {
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
}
} }
} }
} }
...@@ -1021,4 +1058,4 @@ ...@@ -1021,4 +1058,4 @@
} }
} }
} }
} }
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"geoips": "0.0.1", "geoips": "0.0.1",
"iconv-lite": "^0.4.23", "iconv-lite": "^0.4.23",
"jschardet": "^1.6.0", "jschardet": "^1.6.0",
"marked": "^0.6.2", "marked": "^0.7.0",
"nedb": "^1.5.1", "nedb": "^1.5.1",
"node-rsa": "^1.0.5", "node-rsa": "^1.0.5",
"superagent": "^3.8.3", "superagent": "^3.8.3",
...@@ -38,4 +38,4 @@ ...@@ -38,4 +38,4 @@
"url": "https://github.com/AntSwordProject/AntSword/issues" "url": "https://github.com/AntSwordProject/AntSword/issues"
}, },
"homepage": "https://github.com/AntSwordProject/AntSword/" "homepage": "https://github.com/AntSwordProject/AntSword/"
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment