Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Removed @providesModule tags and dependencies from draft-js
Browse files Browse the repository at this point in the history
Summary: Removed providesModule from all files and configured Jest to work with global module names without the providesModule tag.

Reviewed By: mjesun

Differential Revision: D7788813

fbshipit-source-id: 89a7f3dfc10fae63c74711eab80a2c840806fb67
  • Loading branch information
rubennorte authored and facebook-github-bot committed Apr 27, 2018
1 parent 7fddfcd commit ee2e9c8
Show file tree
Hide file tree
Showing 183 changed files with 76 additions and 181 deletions.
1 change: 0 additions & 1 deletion examples/draft-0-10-0/playground/src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule DraftJsPlaygroundContainer.react
* @flow
* @format
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule DraftJsPlaygroundContainer.react
* @flow
* @format
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule DraftJsRichEditorExample.react
* @flow
* @format
*/
Expand Down
1 change: 0 additions & 1 deletion examples/draft-0-10-0/universal/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule Draft
*/

'use strict';
Expand Down
1 change: 0 additions & 1 deletion examples/draft-0-10-0/universal/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule Draft
*/

'use strict';
Expand Down
1 change: 0 additions & 1 deletion examples/draft-0-10-0/universal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule Draft
*/

'use strict';
Expand Down
1 change: 0 additions & 1 deletion examples/draft-0-9-1/universal/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule Draft
*/

'use strict';
Expand Down
1 change: 0 additions & 1 deletion examples/draft-0-9-1/universal/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule Draft
*/

'use strict';
Expand Down
2 changes: 1 addition & 1 deletion meta/bundle-size-stats/Draft.js.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion meta/bundle-size-stats/Draft.min.js.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@
"transform": {
".*": "<rootDir>/scripts/jest/preprocessor.js"
},
"haste": {
"hasteImplModulePath": "<rootDir>/scripts/jest/hasteImpl.js"
},
"modulePathIgnorePatterns": [
"<rootDir>/lib/",
"<rootDir>/node_modules/"
Expand Down
71 changes: 71 additions & 0 deletions scripts/jest/hasteImpl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

'use strict';

const path = require('path');

const ROOT = path.join(__dirname, '..', '..');

const BLACKLISTED_PATTERNS/*: Array<RegExp>*/ = [
/.*\/__(mocks|tests)__\/.*/,
];

const WHITELISTED_PREFIXES/*: Array<string>*/ = [
'src'
];

const NAME_REDUCERS/*: Array<[RegExp, string]>*/ = [
// extract basename
[/^(?:.*\/)?([a-zA-Z0-9$_.-]+)$/, '$1'],
// strip .js/.js.flow suffix
[/^(.*)\.js(\.flow)?$/, '$1'],
// strip .android/.ios/.native/.web suffix
[/^(.*)\.(android|ios|native|web)$/, '$1'],
];

const haste = {
/*
* @return {string|void} hasteName for module at filePath; or undefined if
* filePath is not a haste module
*/
getHasteName(
filePath/*: string*/,
sourceCode/* : ?string*/
)/*: (string | void)*/ {
if (!isHastePath(filePath)) {
return undefined;
}

const hasteName = NAME_REDUCERS.reduce(
(name, [pattern, replacement]) => name.replace(pattern, replacement),
filePath
);

return hasteName;
},
};

function isHastePath(filePath/*: string*/)/*: bool*/ {
if (!filePath.endsWith('.js') && !filePath.endsWith('.js.flow')) {
return false;
}

if (!filePath.startsWith(ROOT)) {
return false;
}

filePath = filePath.substr(ROOT.length + 1);
if (BLACKLISTED_PATTERNS.some(pattern => pattern.test(filePath))) {
return false;
}
return WHITELISTED_PREFIXES.some(prefix => filePath.startsWith(prefix));
}

module.exports = haste;
1 change: 0 additions & 1 deletion src/Draft.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule Draft
* @format
* @flow
*/
Expand Down
1 change: 0 additions & 1 deletion src/component/base/DraftEditor.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditor.react
* @format
* @flow
* @preventMunge
Expand Down
1 change: 0 additions & 1 deletion src/component/base/DraftEditorPlaceholder.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorPlaceholder.react
* @format
* @flow
*/
Expand Down
1 change: 0 additions & 1 deletion src/component/base/DraftEditorProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorProps
* @format
* @flow
*/
Expand Down
1 change: 0 additions & 1 deletion src/component/base/DraftScrollPosition.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftScrollPosition
* @format
* @flow strict
*/
Expand Down
1 change: 0 additions & 1 deletion src/component/base/DraftTextAlignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftTextAlignment
* @format
* @flow strict
*/
Expand Down
1 change: 0 additions & 1 deletion src/component/contents/DraftEditorBlock.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorBlock.react
* @format
* @flow
*/
Expand Down
1 change: 0 additions & 1 deletion src/component/contents/DraftEditorContents-core.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorContents-core.react
* @format
* @flow
*/
Expand Down
1 change: 0 additions & 1 deletion src/component/contents/DraftEditorLeaf.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorLeaf.react
* @format
* @flow
*/
Expand Down
1 change: 0 additions & 1 deletion src/component/contents/DraftEditorTextNode.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorTextNode.react
* @format
* @flow
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorBlockNode.react
* @format
* @flow
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorContentsExperimental.react
* @format
* @flow
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorDecoratedLeaves.react
* @format
* @flow
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorNode.react
* @format
* @flow
*
Expand Down
1 change: 0 additions & 1 deletion src/component/handlers/DraftEditorModes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorModes
* @format
* @flow strict
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorCompositionHandler
* @format
* @flow
*/
Expand Down
1 change: 0 additions & 1 deletion src/component/handlers/drag/DraftEditorDragHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorDragHandler
* @format
* @flow
*/
Expand Down
1 change: 0 additions & 1 deletion src/component/handlers/edit/DraftEditorEditHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule DraftEditorEditHandler
* @format
* @flow
*/
Expand Down
1 change: 0 additions & 1 deletion src/component/handlers/edit/commands/SecondaryClipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule SecondaryClipboard
* @format
* @flow
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule keyCommandBackspaceToStartOfLine
* @format
* @flow
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule keyCommandBackspaceWord
* @format
* @flow
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule keyCommandDeleteWord
* @format
* @flow
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule keyCommandInsertNewline
* @format
* @flow
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule keyCommandMoveSelectionToEndOfBlock
* @format
* @flow
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule keyCommandMoveSelectionToStartOfBlock
* @format
* @flow
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule keyCommandPlainBackspace
* @format
* @flow
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule keyCommandPlainDelete
* @format
* @flow
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule keyCommandTransposeCharacters
* @format
* @flow
*/
Expand Down
1 change: 0 additions & 1 deletion src/component/handlers/edit/commands/keyCommandUndo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule keyCommandUndo
* @format
* @flow
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule moveSelectionBackward
* @format
* @flow
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* 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.
*
* @providesModule moveSelectionForward
* @format
* @flow
*/
Expand Down
Loading

0 comments on commit ee2e9c8

Please sign in to comment.