-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fake chalk in browser builds in order to support IE10 (#4367)
* Add a fake chalk in order to work in older browsers Closes #4074 * Make fake chalk private * fix import * Normalize ansi-styles version * Remove yarn.lock from npmignore * Move fake chalk into expect package
- Loading branch information
Showing
7 changed files
with
61 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
'use strict'; | ||
|
||
const fakeChalk = require.requireActual('../fake_chalk'); | ||
|
||
describe('Fake Chalk', () => { | ||
it('returns input when invoked', () => { | ||
expect(fakeChalk.red('yo')).toEqual('yo'); | ||
}); | ||
|
||
it('supports chaining', () => { | ||
expect(fakeChalk.red.blue('yo')).toEqual('yo'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright (c) 2014, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* @flow | ||
*/ | ||
|
||
import ansiStyles from 'ansi-styles'; | ||
|
||
const returnInput = str => str; | ||
|
||
const allColorsAsFunc = Object.keys(ansiStyles) | ||
.map(style => ({[style]: returnInput})) | ||
.reduce((acc, cur) => Object.assign(acc, cur)); | ||
|
||
Object.keys(allColorsAsFunc) | ||
.map(color => allColorsAsFunc[color]) | ||
.forEach(style => { | ||
Object.assign(style, allColorsAsFunc); | ||
Object.assign(returnInput, style); | ||
}); | ||
|
||
module.exports = allColorsAsFunc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters