From 615cbb925f3a57f00d6bfeab881ad47f77a7e4c7 Mon Sep 17 00:00:00 2001 From: ossdev07 Date: Mon, 24 Sep 2018 15:53:42 +0530 Subject: [PATCH 01/34] debug: Replaced phantomJS by chrome Added script in package.json for running Test-suite Signed-off-by: ossdev07 --- karma.conf.js | 8 +++++++- package.json | 7 +++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index e503df20..8a4d88c6 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -47,7 +47,13 @@ module.exports = function (config) { // Start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ['PhantomJS'], + browsers: ['HeadlessChrome'], + customLaunchers: { + HeadlessChrome: { + base: 'ChromeHeadless', + flags: ['--no-sandbox',], + }, + }, // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits diff --git a/package.json b/package.json index 0477a691..a2dc7f31 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,9 @@ "dependencies": { "ms": "^2.1.1" }, + "scripts": { + "test": "mocha" + }, "devDependencies": { "@babel/cli": "^7.0.0", "@babel/core": "^7.0.0", @@ -48,10 +51,10 @@ "concurrently": "^3.1.0", "coveralls": "^3.0.2", "istanbul": "^0.4.5", - "karma": "^3.0.0", + "karma": "^2.0.0", "karma-chai": "^0.1.0", "karma-mocha": "^1.3.0", - "karma-phantomjs-launcher": "^1.0.2", + "karma-chrome-launcher": "^2.2.0", "mocha": "^5.2.0", "mocha-lcov-reporter": "^1.2.0", "rimraf": "^2.5.4", From 4fe746a44692a9fe55d24a3c0ff5e4f340519d90 Mon Sep 17 00:00:00 2001 From: ossdev07 <39188636+ossdev07@users.noreply.github.com> Date: Mon, 24 Sep 2018 16:15:28 +0530 Subject: [PATCH 02/34] Update karma.conf.js --- karma.conf.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index 8a4d88c6..c8033d79 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -48,12 +48,12 @@ module.exports = function (config) { // Start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: ['HeadlessChrome'], - customLaunchers: { - HeadlessChrome: { - base: 'ChromeHeadless', - flags: ['--no-sandbox',], - }, - }, + customLaunchers: { + HeadlessChrome: { + base: 'ChromeHeadless', + flags: ['--no-sandbox',], + }, + }, // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits From 61c94841a0cc48f33a8b5ac5f973ee75d74b7996 Mon Sep 17 00:00:00 2001 From: ossdev07 <39188636+ossdev07@users.noreply.github.com> Date: Mon, 24 Sep 2018 16:26:46 +0530 Subject: [PATCH 03/34] Update karma.conf.js --- karma.conf.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index c8033d79..fef8bf4c 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -48,12 +48,12 @@ module.exports = function (config) { // Start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: ['HeadlessChrome'], - customLaunchers: { - HeadlessChrome: { - base: 'ChromeHeadless', - flags: ['--no-sandbox',], - }, - }, + customLaunchers: { + HeadlessChrome: { + base: 'ChromeHeadless', + flags: ['--no-sandbox' ], + } + }, // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits From 7ea4076fd684df6ace0cb4eba64d17a3b711ba3a Mon Sep 17 00:00:00 2001 From: ossdev07 <39188636+ossdev07@users.noreply.github.com> Date: Mon, 24 Sep 2018 16:31:03 +0530 Subject: [PATCH 04/34] Update karma.conf.js --- karma.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/karma.conf.js b/karma.conf.js index fef8bf4c..38f34571 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -51,7 +51,7 @@ module.exports = function (config) { customLaunchers: { HeadlessChrome: { base: 'ChromeHeadless', - flags: ['--no-sandbox' ], + flags: ['--no-sandbox'] } }, From dab648abd54abf3f0cc8862d7ba9628f616cf3fe Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Wed, 10 Oct 2018 01:03:02 -0600 Subject: [PATCH 05/34] remove second (shadow) scripts block --- package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.json b/package.json index a2dc7f31..2e14fcbe 100644 --- a/package.json +++ b/package.json @@ -39,9 +39,6 @@ "dependencies": { "ms": "^2.1.1" }, - "scripts": { - "test": "mocha" - }, "devDependencies": { "@babel/cli": "^7.0.0", "@babel/core": "^7.0.0", From 5fadf4544d32531a91519299f6850620c6a0221e Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Thu, 11 Oct 2018 05:56:04 -0600 Subject: [PATCH 06/34] deprecate CHANGELOG.md --- CHANGELOG.md | 397 +-------------------------------------------------- 1 file changed, 3 insertions(+), 394 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 820d21e3..97162b9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,395 +1,4 @@ +CHANGELOG.md has been deprecated moved to the Github releases pages. It will be removed in the future. -3.1.0 / 2017-09-26 -================== - - * Add `DEBUG_HIDE_DATE` env var (#486) - * Remove ReDoS regexp in %o formatter (#504) - * Remove "component" from package.json - * Remove `component.json` - * Ignore package-lock.json - * Examples: fix colors printout - * Fix: browser detection - * Fix: spelling mistake (#496, @EdwardBetts) - -3.0.1 / 2017-08-24 -================== - - * Fix: Disable colors in Edge and Internet Explorer (#489) - -3.0.0 / 2017-08-08 -================== - - * Breaking: Remove DEBUG_FD (#406) - * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) - * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) - * Addition: document `enabled` flag (#465) - * Addition: add 256 colors mode (#481) - * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) - * Update: component: update "ms" to v2.0.0 - * Update: separate the Node and Browser tests in Travis-CI - * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots - * Update: separate Node.js and web browser examples for organization - * Update: update "browserify" to v14.4.0 - * Fix: fix Readme typo (#473) - -2.6.9 / 2017-09-22 -================== - - * remove ReDoS regexp in %o formatter (#504) - -2.6.8 / 2017-05-18 -================== - - * Fix: Check for undefined on browser globals (#462, @marbemac) - -2.6.7 / 2017-05-16 -================== - - * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) - * Fix: Inline extend function in node implementation (#452, @dougwilson) - * Docs: Fix typo (#455, @msasad) - -2.6.5 / 2017-04-27 -================== - - * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) - * Misc: clean up browser reference checks (#447, @thebigredgeek) - * Misc: add npm-debug.log to .gitignore (@thebigredgeek) - - -2.6.4 / 2017-04-20 -================== - - * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) - * Chore: ignore bower.json in npm installations. (#437, @joaovieira) - * Misc: update "ms" to v0.7.3 (@tootallnate) - -2.6.3 / 2017-03-13 -================== - - * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) - * Docs: Changelog fix (@thebigredgeek) - -2.6.2 / 2017-03-10 -================== - - * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) - * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) - * Docs: Add Slackin invite badge (@tootallnate) - -2.6.1 / 2017-02-10 -================== - - * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error - * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) - * Fix: IE8 "Expected identifier" error (#414, @vgoma) - * Fix: Namespaces would not disable once enabled (#409, @musikov) - -2.6.0 / 2016-12-28 -================== - - * Fix: added better null pointer checks for browser useColors (@thebigredgeek) - * Improvement: removed explicit `window.debug` export (#404, @tootallnate) - * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) - -2.5.2 / 2016-12-25 -================== - - * Fix: reference error on window within webworkers (#393, @KlausTrainer) - * Docs: fixed README typo (#391, @lurch) - * Docs: added notice about v3 api discussion (@thebigredgeek) - -2.5.1 / 2016-12-20 -================== - - * Fix: babel-core compatibility - -2.5.0 / 2016-12-20 -================== - - * Fix: wrong reference in bower file (@thebigredgeek) - * Fix: webworker compatibility (@thebigredgeek) - * Fix: output formatting issue (#388, @kribblo) - * Fix: babel-loader compatibility (#383, @escwald) - * Misc: removed built asset from repo and publications (@thebigredgeek) - * Misc: moved source files to /src (#378, @yamikuronue) - * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) - * Test: coveralls integration (#378, @yamikuronue) - * Docs: simplified language in the opening paragraph (#373, @yamikuronue) - -2.4.5 / 2016-12-17 -================== - - * Fix: `navigator` undefined in Rhino (#376, @jochenberger) - * Fix: custom log function (#379, @hsiliev) - * Improvement: bit of cleanup + linting fixes (@thebigredgeek) - * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) - * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) - -2.4.4 / 2016-12-14 -================== - - * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) - -2.4.3 / 2016-12-14 -================== - - * Fix: navigation.userAgent error for react native (#364, @escwald) - -2.4.2 / 2016-12-14 -================== - - * Fix: browser colors (#367, @tootallnate) - * Misc: travis ci integration (@thebigredgeek) - * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) - -2.4.1 / 2016-12-13 -================== - - * Fix: typo that broke the package (#356) - -2.4.0 / 2016-12-13 -================== - - * Fix: bower.json references unbuilt src entry point (#342, @justmatt) - * Fix: revert "handle regex special characters" (@tootallnate) - * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) - * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) - * Improvement: allow colors in workers (#335, @botverse) - * Improvement: use same color for same namespace. (#338, @lchenay) - -2.3.3 / 2016-11-09 -================== - - * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) - * Fix: Returning `localStorage` saved values (#331, Levi Thomason) - * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) - -2.3.2 / 2016-11-09 -================== - - * Fix: be super-safe in index.js as well (@TooTallNate) - * Fix: should check whether process exists (Tom Newby) - -2.3.1 / 2016-11-09 -================== - - * Fix: Added electron compatibility (#324, @paulcbetts) - * Improvement: Added performance optimizations (@tootallnate) - * Readme: Corrected PowerShell environment variable example (#252, @gimre) - * Misc: Removed yarn lock file from source control (#321, @fengmk2) - -2.3.0 / 2016-11-07 -================== - - * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) - * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) - * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) - * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) - * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) - * Package: Update "ms" to 0.7.2 (#315, @DevSide) - * Package: removed superfluous version property from bower.json (#207 @kkirsche) - * Readme: fix USE_COLORS to DEBUG_COLORS - * Readme: Doc fixes for format string sugar (#269, @mlucool) - * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) - * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) - * Readme: better docs for browser support (#224, @matthewmueller) - * Tooling: Added yarn integration for development (#317, @thebigredgeek) - * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) - * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) - * Misc: Updated contributors (@thebigredgeek) - -2.2.0 / 2015-05-09 -================== - - * package: update "ms" to v0.7.1 (#202, @dougwilson) - * README: add logging to file example (#193, @DanielOchoa) - * README: fixed a typo (#191, @amir-s) - * browser: expose `storage` (#190, @stephenmathieson) - * Makefile: add a `distclean` target (#189, @stephenmathieson) - -2.1.3 / 2015-03-13 -================== - - * Updated stdout/stderr example (#186) - * Updated example/stdout.js to match debug current behaviour - * Renamed example/stderr.js to stdout.js - * Update Readme.md (#184) - * replace high intensity foreground color for bold (#182, #183) - -2.1.2 / 2015-03-01 -================== - - * dist: recompile - * update "ms" to v0.7.0 - * package: update "browserify" to v9.0.3 - * component: fix "ms.js" repo location - * changed bower package name - * updated documentation about using debug in a browser - * fix: security error on safari (#167, #168, @yields) - -2.1.1 / 2014-12-29 -================== - - * browser: use `typeof` to check for `console` existence - * browser: check for `console.log` truthiness (fix IE 8/9) - * browser: add support for Chrome apps - * Readme: added Windows usage remarks - * Add `bower.json` to properly support bower install - -2.1.0 / 2014-10-15 -================== - - * node: implement `DEBUG_FD` env variable support - * package: update "browserify" to v6.1.0 - * package: add "license" field to package.json (#135, @panuhorsmalahti) - -2.0.0 / 2014-09-01 -================== - - * package: update "browserify" to v5.11.0 - * node: use stderr rather than stdout for logging (#29, @stephenmathieson) - -1.0.4 / 2014-07-15 -================== - - * dist: recompile - * example: remove `console.info()` log usage - * example: add "Content-Type" UTF-8 header to browser example - * browser: place %c marker after the space character - * browser: reset the "content" color via `color: inherit` - * browser: add colors support for Firefox >= v31 - * debug: prefer an instance `log()` function over the global one (#119) - * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) - -1.0.3 / 2014-07-09 -================== - - * Add support for multiple wildcards in namespaces (#122, @seegno) - * browser: fix lint - -1.0.2 / 2014-06-10 -================== - - * browser: update color palette (#113, @gscottolson) - * common: make console logging function configurable (#108, @timoxley) - * node: fix %o colors on old node <= 0.8.x - * Makefile: find node path using shell/which (#109, @timoxley) - -1.0.1 / 2014-06-06 -================== - - * browser: use `removeItem()` to clear localStorage - * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) - * package: add "contributors" section - * node: fix comment typo - * README: list authors - -1.0.0 / 2014-06-04 -================== - - * make ms diff be global, not be scope - * debug: ignore empty strings in enable() - * node: make DEBUG_COLORS able to disable coloring - * *: export the `colors` array - * npmignore: don't publish the `dist` dir - * Makefile: refactor to use browserify - * package: add "browserify" as a dev dependency - * Readme: add Web Inspector Colors section - * node: reset terminal color for the debug content - * node: map "%o" to `util.inspect()` - * browser: map "%j" to `JSON.stringify()` - * debug: add custom "formatters" - * debug: use "ms" module for humanizing the diff - * Readme: add "bash" syntax highlighting - * browser: add Firebug color support - * browser: add colors for WebKit browsers - * node: apply log to `console` - * rewrite: abstract common logic for Node & browsers - * add .jshintrc file - -0.8.1 / 2014-04-14 -================== - - * package: re-add the "component" section - -0.8.0 / 2014-03-30 -================== - - * add `enable()` method for nodejs. Closes #27 - * change from stderr to stdout - * remove unnecessary index.js file - -0.7.4 / 2013-11-13 -================== - - * remove "browserify" key from package.json (fixes something in browserify) - -0.7.3 / 2013-10-30 -================== - - * fix: catch localStorage security error when cookies are blocked (Chrome) - * add debug(err) support. Closes #46 - * add .browser prop to package.json. Closes #42 - -0.7.2 / 2013-02-06 -================== - - * fix package.json - * fix: Mobile Safari (private mode) is broken with debug - * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript - -0.7.1 / 2013-02-05 -================== - - * add repository URL to package.json - * add DEBUG_COLORED to force colored output - * add browserify support - * fix component. Closes #24 - -0.7.0 / 2012-05-04 -================== - - * Added .component to package.json - * Added debug.component.js build - -0.6.0 / 2012-03-16 -================== - - * Added support for "-" prefix in DEBUG [Vinay Pulim] - * Added `.enabled` flag to the node version [TooTallNate] - -0.5.0 / 2012-02-02 -================== - - * Added: humanize diffs. Closes #8 - * Added `debug.disable()` to the CS variant - * Removed padding. Closes #10 - * Fixed: persist client-side variant again. Closes #9 - -0.4.0 / 2012-02-01 -================== - - * Added browser variant support for older browsers [TooTallNate] - * Added `debug.enable('project:*')` to browser variant [TooTallNate] - * Added padding to diff (moved it to the right) - -0.3.0 / 2012-01-26 -================== - - * Added millisecond diff when isatty, otherwise UTC string - -0.2.0 / 2012-01-22 -================== - - * Added wildcard support - -0.1.0 / 2011-12-02 -================== - - * Added: remove colors unless stderr isatty [TooTallNate] - -0.0.1 / 2010-01-03 -================== - - * Initial release +Please see https://github.com/visionmedia/debug/releases for all changelogs and information pertaining +to new releases. From 010fd0d92faeed1bd7e822f3780175e4f57fa2db Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Wed, 19 Dec 2018 01:43:40 +0100 Subject: [PATCH 07/34] remove changelog --- CHANGELOG.md | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 97162b9e..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,4 +0,0 @@ -CHANGELOG.md has been deprecated moved to the Github releases pages. It will be removed in the future. - -Please see https://github.com/visionmedia/debug/releases for all changelogs and information pertaining -to new releases. From dfd5ffa8b6cd52056651964360749a1873149eff Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Wed, 19 Dec 2018 01:46:00 +0100 Subject: [PATCH 08/34] remove bower.json (closes #602) --- bower.json | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 bower.json diff --git a/bower.json b/bower.json deleted file mode 100644 index 027804ce..00000000 --- a/bower.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "visionmedia-debug", - "main": "./src/browser.js", - "homepage": "https://github.com/visionmedia/debug", - "authors": [ - "TJ Holowaychuk ", - "Nathan Rajlich (http://n8.io)", - "Andrew Rhyne " - ], - "description": "visionmedia-debug", - "moduleType": [ - "amd", - "es6", - "globals", - "node" - ], - "keywords": [ - "visionmedia", - "debug" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ] -} From dc5c34f9d8fc9c08ee5b275b4f0c51b9f984a98f Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Wed, 19 Dec 2018 02:05:38 +0100 Subject: [PATCH 09/34] remove .eslintrc --- .eslintrc | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 .eslintrc diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 146371ed..00000000 --- a/.eslintrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "env": { - "browser": true, - "node": true - }, - "globals": { - "chrome": true - }, - "rules": { - "no-console": 0, - "no-empty": [1, { "allowEmptyCatch": true }] - }, - "extends": "eslint:recommended" -} From fe49015965c0f29f943df20f29445b4310b3ce0a Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Wed, 19 Dec 2018 02:29:30 +0100 Subject: [PATCH 10/34] remove .coveralls.yml --- .coveralls.yml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .coveralls.yml diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index 20a70685..00000000 --- a/.coveralls.yml +++ /dev/null @@ -1 +0,0 @@ -repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve From ad551e2b61022107cee85a66819cd4d2b962038a Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Wed, 19 Dec 2018 02:45:52 +0100 Subject: [PATCH 11/34] add Josh Junon to contributors --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2e14fcbe..3464bd8a 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "author": "TJ Holowaychuk ", "contributors": [ "Nathan Rajlich (http://n8.io)", - "Andrew Rhyne " + "Andrew Rhyne ", + "Josh Junon " ], "license": "MIT", "scripts": { From 0e94034efb1e88b88a06ca3862d8d2cc2f2ed5d0 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Wed, 19 Dec 2018 02:41:45 +0100 Subject: [PATCH 12/34] update development dependencies --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 3464bd8a..9e35a1b2 100644 --- a/package.json +++ b/package.json @@ -44,12 +44,12 @@ "@babel/cli": "^7.0.0", "@babel/core": "^7.0.0", "@babel/preset-env": "^7.0.0", - "browserify": "14.4.0", - "chai": "^3.5.0", - "concurrently": "^3.1.0", + "browserify": "16.2.3", + "chai": "^4.2.0", + "concurrently": "^4.1.0", "coveralls": "^3.0.2", "istanbul": "^0.4.5", - "karma": "^2.0.0", + "karma": "^3.1.4", "karma-chai": "^0.1.0", "karma-mocha": "^1.3.0", "karma-chrome-launcher": "^2.2.0", From 94583b652a58e58102074ce5ab99e17972db1c4f Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Wed, 19 Dec 2018 04:03:39 +0100 Subject: [PATCH 13/34] remove build system (closes #652) --- .babelrc | 13 ------------- .travis.yml | 1 + karma.conf.js | 43 +++++++++++++++++------------------------- package.json | 25 ++++++------------------- test.js | 52 +++++++++++++++++++++------------------------------ 5 files changed, 45 insertions(+), 89 deletions(-) delete mode 100644 .babelrc diff --git a/.babelrc b/.babelrc deleted file mode 100644 index b2799de4..00000000 --- a/.babelrc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "targets": { - "chrome": "58", - "ie": "8" - } - } - ] - ] -} diff --git a/.travis.yml b/.travis.yml index 24682db3..c020bf98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ node_js: - "6" - "8" - "10" + - "11" install: - npm install diff --git a/karma.conf.js b/karma.conf.js index 38f34571..6e835858 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,32 +1,16 @@ -// 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'], + frameworks: ['browserify', 'mocha'], // List of files / patterns to load in the browser files: [ - 'dist/debug.js', - 'dist/test.js' + 'src/browser.js', + 'src/common.js', + 'test.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 @@ -40,10 +24,7 @@ module.exports = function (config) { // 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, + logLevel: config.LOG_DEBUG, // Start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher @@ -55,12 +36,22 @@ module.exports = function (config) { } }, + preprocessors: { + // *Sigh* what a glob, folks! + '{{!(node_modules),*.js},!(node_modules)/**/*.js}': ['browserify'] + }, + + browserify: { + debug: true, + transform: ['brfs'] + }, + // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits - singleRun: false, + singleRun: true, // Concurrency level // how many browser should be started simultaneous - concurrency: Infinity + concurrency: 1 }); }; diff --git a/package.json b/package.json index 9e35a1b2..c26c4a16 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ ], "files": [ "src", - "dist/debug.js", "LICENSE", "README.md" ], @@ -28,37 +27,25 @@ "lint": "xo", "test": "npm run test:node && npm run test:browser", "test:node": "istanbul cover _mocha -- test.js", - "posttest:node": "cat ./coverage/lcov.info | coveralls", - "pretest:browser": "npm run build", "test:browser": "karma start --single-run", - "prebuild:debug": "mkdir -p dist && browserify --standalone debug -o dist/debug.es6.js .", - "build:debug": "babel -o dist/debug.js dist/debug.es6.js > dist/debug.js", - "build:test": "babel -d dist test.js", - "build": "npm run build:debug && npm run build:test", - "clean": "rimraf dist coverage" + "posttest:node": "cat ./coverage/lcov.info | coveralls" }, "dependencies": { "ms": "^2.1.1" }, "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "browserify": "16.2.3", - "chai": "^4.2.0", - "concurrently": "^4.1.0", + "brfs": "^2.0.1", + "browserify": "^16.2.3", "coveralls": "^3.0.2", "istanbul": "^0.4.5", "karma": "^3.1.4", - "karma-chai": "^0.1.0", - "karma-mocha": "^1.3.0", + "karma-browserify": "^6.0.0", "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", "mocha": "^5.2.0", "mocha-lcov-reporter": "^1.2.0", - "rimraf": "^2.5.4", "xo": "^0.23.0" }, "main": "./src/index.js", - "browser": "./src/browser.js", - "unpkg": "./dist/debug.js" + "browser": "./src/browser.js" } diff --git a/test.js b/test.js index 888f9bd8..460f9759 100644 --- a/test.js +++ b/test.js @@ -1,17 +1,7 @@ /* eslint-env mocha */ -'use strict'; -let chai; - -let expect; - -let debug; - -if (typeof module !== 'undefined') { - chai = require('chai'); - expect = chai.expect; - debug = require('./src'); -} +const assert = require('assert'); +const debug = require('./src'); describe('debug', () => { it('passes a basic sanity check', () => { @@ -19,7 +9,7 @@ describe('debug', () => { log.enabled = true; log.log = () => {}; - expect(() => log('hello world')).to.not.throw(); + assert.doesNotThrow(() => log('hello world')); }); it('allows namespaces to be a non-string value', () => { @@ -27,16 +17,16 @@ describe('debug', () => { log.enabled = true; log.log = () => {}; - expect(() => debug.enable(true)).to.not.throw(); + assert.doesNotThrow(() => debug.enable(true)); }); it('honors global debug namespace enable calls', () => { - expect(debug('test:12345').enabled).to.equal(false); - expect(debug('test:67890').enabled).to.equal(false); + assert.deepStrictEqual(debug('test:12345').enabled, false); + assert.deepStrictEqual(debug('test:67890').enabled, false); debug.enable('test:12345'); - expect(debug('test:12345').enabled).to.equal(true); - expect(debug('test:67890').enabled).to.equal(false); + assert.deepStrictEqual(debug('test:12345').enabled, true); + assert.deepStrictEqual(debug('test:67890').enabled, false); }); it('uses custom log function', () => { @@ -50,7 +40,7 @@ describe('debug', () => { log('using custom log function again'); log('%O', 12345); - expect(messages.length).to.equal(3); + assert.deepStrictEqual(messages.length, 3); }); describe('extend namespace', () => { @@ -60,7 +50,7 @@ describe('debug', () => { log.log = () => {}; const logBar = log.extend('bar'); - expect(logBar.namespace).to.be.equal('foo:bar'); + assert.deepStrictEqual(logBar.namespace, 'foo:bar'); }); it('should extend namespace with custom delimiter', () => { @@ -69,7 +59,7 @@ describe('debug', () => { log.log = () => {}; const logBar = log.extend('bar', '--'); - expect(logBar.namespace).to.be.equal('foo--bar'); + assert.deepStrictEqual(logBar.namespace, 'foo--bar'); }); it('should extend namespace with empty delimiter', () => { @@ -78,7 +68,7 @@ describe('debug', () => { log.log = () => {}; const logBar = log.extend('bar', ''); - expect(logBar.namespace).to.be.equal('foobar'); + assert.deepStrictEqual(logBar.namespace, 'foobar'); }); }); @@ -86,27 +76,27 @@ describe('debug', () => { it('handle names, skips, and wildcards', () => { debug.enable('test,abc*,-abc'); const namespaces = debug.disable(); - expect(namespaces).to.equal('test,abc*,-abc'); + assert.deepStrictEqual(namespaces, 'test,abc*,-abc'); }); it('handles empty', () => { debug.enable(''); const namespaces = debug.disable(); - expect(namespaces).to.equal(''); - expect(debug.names).to.deep.equal([]); - expect(debug.skips).to.deep.equal([]); + assert.deepStrictEqual(namespaces, ''); + assert.deepStrictEqual(debug.names, []); + assert.deepStrictEqual(debug.skips, []); }); it('handles all', () => { debug.enable('*'); const namespaces = debug.disable(); - expect(namespaces).to.equal('*'); + assert.deepStrictEqual(namespaces, '*'); }); it('handles skip all', () => { debug.enable('-*'); const namespaces = debug.disable(); - expect(namespaces).to.equal('-*'); + assert.deepStrictEqual(namespaces, '-*'); }); it('names+skips same with new string', () => { @@ -114,10 +104,10 @@ describe('debug', () => { const oldNames = [...debug.names]; const oldSkips = [...debug.skips]; const namespaces = debug.disable(); - expect(namespaces).to.equal('test,abc*,-abc'); + assert.deepStrictEqual(namespaces, 'test,abc*,-abc'); debug.enable(namespaces); - expect(oldNames.map(String)).to.deep.equal(debug.names.map(String)); - expect(oldSkips.map(String)).to.deep.equal(debug.skips.map(String)); + assert.deepStrictEqual(oldNames.map(String), debug.names.map(String)); + assert.deepStrictEqual(oldSkips.map(String), debug.skips.map(String)); }); }); }); From c0127b18a0b7670bf931072a25ddc82e84116659 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Wed, 19 Dec 2018 04:26:28 +0100 Subject: [PATCH 14/34] remove examples folder (closes #650) --- examples/browser/colors.html | 28 ---------------------------- examples/node/app.js | 20 -------------------- examples/node/colors.js | 8 -------- examples/node/stdout.js | 18 ------------------ examples/node/wildcards.js | 10 ---------- examples/node/worker.js | 27 --------------------------- 6 files changed, 111 deletions(-) delete mode 100644 examples/browser/colors.html delete mode 100644 examples/node/app.js delete mode 100644 examples/node/colors.js delete mode 100644 examples/node/stdout.js delete mode 100644 examples/node/wildcards.js delete mode 100644 examples/node/worker.js diff --git a/examples/browser/colors.html b/examples/browser/colors.html deleted file mode 100644 index ce969072..00000000 --- a/examples/browser/colors.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - debug() - - - - - - - Open your - Web Inspector - to see the debug output - - diff --git a/examples/node/app.js b/examples/node/app.js deleted file mode 100644 index 08d3f257..00000000 --- a/examples/node/app.js +++ /dev/null @@ -1,20 +0,0 @@ -const http = require('http'); - -const debug = require('../..')('http'); - -const name = 'My App'; - -// Fake app - -debug('booting %o', name); - -http.createServer((req, res) => { - debug(req.method + ' ' + req.url); - res.end('hello\n'); -}).listen(3000, () => { - debug('listening'); -}); - -// Fake worker of some kind -// eslint-disable-next-line import/no-unassigned-import -require('./worker'); diff --git a/examples/node/colors.js b/examples/node/colors.js deleted file mode 100644 index 9cbfa1f9..00000000 --- a/examples/node/colors.js +++ /dev/null @@ -1,8 +0,0 @@ -const debug = require('../..'); - -debug.enable('*'); - -for (let i = 0; i < debug.colors.length; i++) { - const d = debug('example:' + i); - d('The color is %o', d.color); -} diff --git a/examples/node/stdout.js b/examples/node/stdout.js deleted file mode 100644 index 17558da0..00000000 --- a/examples/node/stdout.js +++ /dev/null @@ -1,18 +0,0 @@ -const debug = require('../..'); - -const error = debug('app:error'); - -// By default stderr is used -error('goes to stderr!'); - -const log = debug('app:log'); -// Set this namespace to log via console.log -log.log = console.log.bind(console); // Don't forget to bind to console! -log('goes to stdout'); -error('still goes to stderr!'); - -// Set all output to go via console.info -// overrides all per-namespace log settings -debug.log = console.info.bind(console); -error('now goes to stdout via console.info'); -log('still goes to stdout, but via console.info now'); diff --git a/examples/node/wildcards.js b/examples/node/wildcards.js deleted file mode 100644 index 2cedc2d8..00000000 --- a/examples/node/wildcards.js +++ /dev/null @@ -1,10 +0,0 @@ - -const debug = { - foo: require('../..')('test:foo'), - bar: require('../..')('test:bar'), - baz: require('../..')('test:baz') -}; - -debug.foo('foo'); -debug.bar('bar'); -debug.baz('baz'); diff --git a/examples/node/worker.js b/examples/node/worker.js deleted file mode 100644 index 6f483a66..00000000 --- a/examples/node/worker.js +++ /dev/null @@ -1,27 +0,0 @@ - -// DEBUG=* node example/worker -// DEBUG=worker:* node example/worker -// DEBUG=worker:a node example/worker -// DEBUG=worker:b node example/worker - -const a = require('../..')('worker:a'); - -const b = require('../..')('worker:b'); - -function work() { - a('doing lots of uninteresting work'); - setTimeout(work, Math.random() * 1000); -} - -work(); - -function workb() { - b('doing some work'); - setTimeout(workb, Math.random() * 2000); -} - -workb(); - -setTimeout(() => { - b(new Error('fail')); -}, 5000); From 5528572f9a96b9202e77e565eb641ba8c74aec40 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Wed, 19 Dec 2018 04:41:05 +0100 Subject: [PATCH 15/34] use console.debug() in browser when available (closes #600) also removes a branch for each logging call, slightly improving performance in the browser. --- src/browser.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/browser.js b/src/browser.js index 5f34c0d0..ac3f7e13 100644 --- a/src/browser.js +++ b/src/browser.js @@ -4,7 +4,6 @@ * This is the web browser implementation of `debug()`. */ -exports.log = log; exports.formatArgs = formatArgs; exports.save = save; exports.load = load; @@ -170,18 +169,14 @@ function formatArgs(args) { } /** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. * * @api public */ -function log(...args) { - // This hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return typeof console === 'object' && - console.log && - console.log(...args); -} +exports.log = console.debug || console.log || (() => {}); /** * Save `namespaces`. From 825d35a2da0a9fa115baffea2f07d22b876332fc Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Wed, 19 Dec 2018 04:56:06 +0100 Subject: [PATCH 16/34] copy custom logger to namespace extension (fixes #646) --- src/common.js | 4 +++- test.js | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/common.js b/src/common.js index 0b6d0b64..2f82b8dc 100644 --- a/src/common.js +++ b/src/common.js @@ -143,7 +143,9 @@ function setup(env) { } function extend(namespace, delimiter) { - return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; } /** diff --git a/test.js b/test.js index 460f9759..f61e079b 100644 --- a/test.js +++ b/test.js @@ -70,6 +70,14 @@ describe('debug', () => { const logBar = log.extend('bar', ''); assert.deepStrictEqual(logBar.namespace, 'foobar'); }); + + it('should keep the log function between extensions', () => { + const log = debug('foo'); + log.log = () => {}; + + const logBar = log.extend('bar'); + assert.deepStrictEqual(log.log, logBar.log); + }); }); describe('rebuild namespaces string (disable)', () => { From 982c12c926699221c6769b50a8ead9d50f8807c4 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Sat, 22 Dec 2018 03:14:57 -0500 Subject: [PATCH 17/34] test: only run coveralls on travis s/posttest:node/coverage Explicitly call coverage only from CI. This will stop the test suite from failing on a system not configured to authenticate with circle-ci --- .travis.yml | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c020bf98..40103cfc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,3 +14,4 @@ install: script: - npm run lint - npm test + - npm run test:coverage diff --git a/package.json b/package.json index c26c4a16..643af019 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "test": "npm run test:node && npm run test:browser", "test:node": "istanbul cover _mocha -- test.js", "test:browser": "karma start --single-run", - "posttest:node": "cat ./coverage/lcov.info | coveralls" + "test:coverage": "cat ./coverage/lcov.info | coveralls" }, "dependencies": { "ms": "^2.1.1" From 976f8d2afc5e2a815225ff6eca2e02f4ef0462ee Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Thu, 10 Jan 2019 16:51:53 +0100 Subject: [PATCH 18/34] add issue and pull request templates --- .github/ISSUE_TEMPLATE.md | 17 +++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..baaeb283 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,17 @@ + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..c43a8c82 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,17 @@ + From 5c7c61dc0df0db4eb5de25707d8cd1b9be1add4f Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Thu, 10 Jan 2019 16:53:31 +0100 Subject: [PATCH 19/34] fix links in issue templates --- .github/ISSUE_TEMPLATE.md | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index baaeb283..3c5c9a92 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -12,6 +12,6 @@ target the browsers that make sense for your project. For more information, please see: -https://github.com/visionmedia/debug/pull/672 +https://github.com/sindresorhus/ama/issues/446#issuecomment-281014491 --> diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c43a8c82..af3da470 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -12,6 +12,6 @@ target the browsers that make sense for your project. For more information, please see: -https://github.com/visionmedia/debug/pull/672 +https://github.com/sindresorhus/ama/issues/446#issuecomment-281014491 --> From 608fca962b34e2bda841db9a4416bab6b4a62803 Mon Sep 17 00:00:00 2001 From: Qix Date: Wed, 13 Nov 2019 11:27:24 +0100 Subject: [PATCH 20/34] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 3c5c9a92..58858535 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -14,4 +14,15 @@ your project. For more information, please see: https://github.com/sindresorhus/ama/issues/446#issuecomment-281014491 +Please keep in mind that `debug` is downloaded, +installed, transpiled and used millions of times +*per day*. If you have an error with `debug`, it's +most likely your own configuration (e.g. with Babel, +Webpack, etc). + +Unless you post ample evidence you have tried +to fix this yourself, it will most likely +be determined that your issue is localized +to your project - not `debug`. + --> From 3f4d7247c0f57085c3d8450593b22ecd7ef73886 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Tue, 7 Jan 2020 20:38:20 -0500 Subject: [PATCH 21/34] Add "engines" to `package.json` (#680) --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 643af019..5e9d45e2 100644 --- a/package.json +++ b/package.json @@ -47,5 +47,8 @@ "xo": "^0.23.0" }, "main": "./src/index.js", - "browser": "./src/browser.js" + "browser": "./src/browser.js", + "engines": { + "node": ">=6.0" + } } From 4acdeedd4b532f0b5a86b35019e0bc9f081d04b4 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Sun, 12 Jan 2020 20:29:28 +0100 Subject: [PATCH 22/34] run linter inside of test script --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5e9d45e2..85b6f1d6 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "license": "MIT", "scripts": { "lint": "xo", - "test": "npm run test:node && npm run test:browser", + "test": "npm run test:node && npm run test:browser && npm run lint", "test:node": "istanbul cover _mocha -- test.js", "test:browser": "karma start --single-run", "test:coverage": "cat ./coverage/lcov.info | coveralls" @@ -49,6 +49,6 @@ "main": "./src/index.js", "browser": "./src/browser.js", "engines": { - "node": ">=6.0" + "node": ">=6.0" } } From 0c1d5180ff9559b506c8b431b24842bed0e8a5e2 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Sun, 12 Jan 2020 20:31:27 +0100 Subject: [PATCH 23/34] remove dead code and fix lowercase comment (for linter) --- src/common.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/common.js b/src/common.js index 2f82b8dc..32b4fd62 100644 --- a/src/common.js +++ b/src/common.js @@ -120,10 +120,8 @@ function setup(env) { debug.color = selectColor(namespace); debug.destroy = destroy; debug.extend = extend; - // Debug.formatArgs = formatArgs; - // debug.rawLog = rawLog; - // env-specific initialization logic for debug instances + // Env-specific initialization logic for debug instances if (typeof createDebug.init === 'function') { createDebug.init(debug); } From 6b07f9e50a528b6b47256d876f7e77374c337333 Mon Sep 17 00:00:00 2001 From: Milan Skuhra Date: Sun, 23 Feb 2020 20:07:49 +0100 Subject: [PATCH 24/34] Fixes: Unable to take control over selectColor #747 --- src/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.js b/src/common.js index 32b4fd62..da7eada6 100644 --- a/src/common.js +++ b/src/common.js @@ -117,7 +117,7 @@ function setup(env) { debug.namespace = namespace; debug.enabled = createDebug.enabled(namespace); debug.useColors = createDebug.useColors(); - debug.color = selectColor(namespace); + debug.color = createDebug.selectColor(namespace); debug.destroy = destroy; debug.extend = extend; From db306db99e7822d355724698990d335927563210 Mon Sep 17 00:00:00 2001 From: Douglas Wilson Date: Fri, 27 Mar 2020 12:28:00 -0400 Subject: [PATCH 25/34] Update and pin ms to 2.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 85b6f1d6..b20770f2 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "test:coverage": "cat ./coverage/lcov.info | coveralls" }, "dependencies": { - "ms": "^2.1.1" + "ms": "2.1.2" }, "devDependencies": { "brfs": "^2.0.1", From 09914af00e4c1479db9aa160bc51cb8c7e063ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Wed, 16 Oct 2019 16:55:00 +0200 Subject: [PATCH 26/34] Marks supports-color as an *optional* peer dependency --- package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package.json b/package.json index b20770f2..f9dd28e7 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,11 @@ "mocha-lcov-reporter": "^1.2.0", "xo": "^0.23.0" }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, "main": "./src/index.js", "browser": "./src/browser.js", "engines": { From 80ef62a3af4df95250d77d64edfc3d0e1667e7e8 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Tue, 19 May 2020 11:36:58 +0200 Subject: [PATCH 27/34] 4.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f9dd28e7..c270ca0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "debug", - "version": "4.1.0", + "version": "4.2.0", "repository": { "type": "git", "url": "git://github.com/visionmedia/debug.git" From 22e13fe07e21f32888201aa40833599fd10a4fbb Mon Sep 17 00:00:00 2001 From: "Bruce A. MacNaughton" Date: Mon, 6 Apr 2020 13:37:14 -0700 Subject: [PATCH 28/34] fix quoted percent sign --- src/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.js b/src/common.js index da7eada6..a7eeb0b1 100644 --- a/src/common.js +++ b/src/common.js @@ -92,7 +92,7 @@ function setup(env) { args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { // If we encounter an escaped % then don't increase the array index if (match === '%%') { - return match; + return '%'; } index++; const formatter = createDebug.formatters[format]; From 27152cad248df54217a14c072e7be1cd16da5f6d Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Sun, 12 Jan 2020 20:10:16 +0100 Subject: [PATCH 29/34] add test for enable/disable of existing instances --- test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test.js b/test.js index f61e079b..a1d6f633 100644 --- a/test.js +++ b/test.js @@ -117,5 +117,24 @@ describe('debug', () => { assert.deepStrictEqual(oldNames.map(String), debug.names.map(String)); assert.deepStrictEqual(oldSkips.map(String), debug.skips.map(String)); }); + + it('handles re-enabling existing instances', () => { + debug.disable('*'); + const inst = debug('foo'); + const messages = []; + inst.log = msg => messages.push(msg.replace(/^[^@]*@([^@]+)@.*$/, '$1')); + + inst('@test@'); + assert.deepStrictEqual(messages, []); + debug.enable('foo'); + assert.deepStrictEqual(messages, []); + inst('@test2@'); + assert.deepStrictEqual(messages, ['test2']); + inst('@test3@'); + assert.deepStrictEqual(messages, ['test2', 'test3']); + debug.disable('*'); + inst('@test4@'); + assert.deepStrictEqual(messages, ['test2', 'test3']); + }); }); }); From 72e7f864bd75fc8353e4dd450de96d9104ba9f35 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Sun, 12 Jan 2020 20:14:48 +0100 Subject: [PATCH 30/34] fix memory leak within debug instance --- src/common.js | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/src/common.js b/src/common.js index a7eeb0b1..9d7e4dce 100644 --- a/src/common.js +++ b/src/common.js @@ -17,11 +17,6 @@ function setup(env) { createDebug[key] = env[key]; }); - /** - * Active `debug` instances. - */ - createDebug.instances = []; - /** * The currently active debug mode names, and names to skip. */ @@ -63,6 +58,7 @@ function setup(env) { */ function createDebug(namespace) { let prevTime; + let enableOverride = null; function debug(...args) { // Disabled? @@ -115,31 +111,27 @@ function setup(env) { } debug.namespace = namespace; - debug.enabled = createDebug.enabled(namespace); debug.useColors = createDebug.useColors(); debug.color = createDebug.selectColor(namespace); - debug.destroy = destroy; debug.extend = extend; + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride, + set: v => { + enableOverride = v; + } + }); + // Env-specific initialization logic for debug instances if (typeof createDebug.init === 'function') { createDebug.init(debug); } - createDebug.instances.push(debug); - return debug; } - function destroy() { - const index = createDebug.instances.indexOf(this); - if (index !== -1) { - createDebug.instances.splice(index, 1); - return true; - } - return false; - } - function extend(namespace, delimiter) { const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); newDebug.log = this.log; @@ -177,11 +169,6 @@ function setup(env) { createDebug.names.push(new RegExp('^' + namespaces + '$')); } } - - for (i = 0; i < createDebug.instances.length; i++) { - const instance = createDebug.instances[i]; - instance.enabled = createDebug.enabled(instance.namespace); - } } /** From e2d3bc9e428bdd45adb8d6e7f8ab543bee54d9a6 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Sun, 12 Jan 2020 20:25:37 +0100 Subject: [PATCH 31/34] add deprecation notice for debug.destroy() --- src/browser.js | 10 ++++++++++ src/common.js | 10 ++++++++++ src/node.js | 4 ++++ 3 files changed, 24 insertions(+) diff --git a/src/browser.js b/src/browser.js index ac3f7e13..cd0fc35d 100644 --- a/src/browser.js +++ b/src/browser.js @@ -9,6 +9,16 @@ exports.save = save; exports.load = load; exports.useColors = useColors; exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); /** * Colors. diff --git a/src/common.js b/src/common.js index 9d7e4dce..392a8e00 100644 --- a/src/common.js +++ b/src/common.js @@ -12,6 +12,7 @@ function setup(env) { createDebug.enable = enable; createDebug.enabled = enabled; createDebug.humanize = require('ms'); + createDebug.destroy = destroy; Object.keys(env).forEach(key => { createDebug[key] = env[key]; @@ -114,6 +115,7 @@ function setup(env) { debug.useColors = createDebug.useColors(); debug.color = createDebug.selectColor(namespace); debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. Object.defineProperty(debug, 'enabled', { enumerable: true, @@ -243,6 +245,14 @@ function setup(env) { return val; } + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + createDebug.enable(createDebug.load()); return createDebug; diff --git a/src/node.js b/src/node.js index 5e1f1541..12a11f40 100644 --- a/src/node.js +++ b/src/node.js @@ -15,6 +15,10 @@ exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); /** * Colors. From 3f56313c1e4a0d59c1054fb9b10026b6903bfba7 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Sat, 19 Sep 2020 10:35:28 +0200 Subject: [PATCH 32/34] 4.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c270ca0e..c4e19aa1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "debug", - "version": "4.2.0", + "version": "4.3.0", "repository": { "type": "git", "url": "git://github.com/visionmedia/debug.git" From b6d12fdbc63b483e5c969da33ea6adc09946b5ac Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Thu, 19 Nov 2020 12:31:16 +0100 Subject: [PATCH 33/34] fix regression --- src/node.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node.js b/src/node.js index 12a11f40..79bc085c 100644 --- a/src/node.js +++ b/src/node.js @@ -248,7 +248,9 @@ const {formatters} = module.exports; formatters.o = function (v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts) - .replace(/\s*\n\s*/g, ' '); + .split('\n') + .map(str => str.trim()) + .join(' '); }; /** From 0d3d66b0eb47c5d34e1a940e8a204446fdd832cd Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Thu, 19 Nov 2020 13:15:13 +0100 Subject: [PATCH 34/34] 4.3.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c4e19aa1..da809d2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "debug", - "version": "4.3.0", + "version": "4.3.1", "repository": { "type": "git", "url": "git://github.com/visionmedia/debug.git"