From b227837b0c1396fd163f826ed9e55bb3a4ee42c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Thu, 9 Oct 2014 18:35:31 -0700 Subject: [PATCH] Ship merge to npm People may have a bad time if they're depending on these but we can delay that a little bit. Unless they're using directly and not polyfilling Object.assign. --- grunt/config/jsx.js | 6 ++++++ src/vendor/README.md | 1 + src/vendor_deprecated/README.md | 3 +++ src/{vendor => vendor_deprecated}/core/copyProperties.js | 7 +++++++ src/{vendor => vendor_deprecated}/core/merge.js | 7 +++++++ src/{vendor => vendor_deprecated}/core/mergeInto.js | 7 +++++++ 6 files changed, 31 insertions(+) create mode 100644 src/vendor/README.md create mode 100644 src/vendor_deprecated/README.md rename src/{vendor => vendor_deprecated}/core/copyProperties.js (84%) rename src/{vendor => vendor_deprecated}/core/merge.js (76%) rename src/{vendor => vendor_deprecated}/core/mergeInto.js (63%) diff --git a/grunt/config/jsx.js b/grunt/config/jsx.js index acafefb4af4be..f5b3bc699004c 100644 --- a/grunt/config/jsx.js +++ b/grunt/config/jsx.js @@ -8,6 +8,12 @@ var rootIDs = [ "ReactWithAddons" ]; +// TODO: stop packaging these libraries +rootIDs = rootIDs.concat([ + "merge", + "mergeInto", + "copyProperties" +]); var normal = { rootIDs: rootIDs, diff --git a/src/vendor/README.md b/src/vendor/README.md new file mode 100644 index 0000000000000..624820d343f13 --- /dev/null +++ b/src/vendor/README.md @@ -0,0 +1 @@ +The files in this directory are not related to React's core functionality. They are shared utility modules that are also used in other parts of Facebook's front-end. Changes to these files need more consideration than changes to React itself. diff --git a/src/vendor_deprecated/README.md b/src/vendor_deprecated/README.md new file mode 100644 index 0000000000000..9bdf4bc16bdc5 --- /dev/null +++ b/src/vendor_deprecated/README.md @@ -0,0 +1,3 @@ +The files in this directory are modified from their original implementation. At some point the files here were included in the React package shipped to npm and used by other projects. + +We removed all uses of these files inside React itself but would like to provide a sane deprecation notice for other consumers. We made no promises about the files here; they were always "use at your own risk". diff --git a/src/vendor/core/copyProperties.js b/src/vendor_deprecated/core/copyProperties.js similarity index 84% rename from src/vendor/core/copyProperties.js rename to src/vendor_deprecated/core/copyProperties.js index 37c1767ecafdb..e5d6a09e6c681 100644 --- a/src/vendor/core/copyProperties.js +++ b/src/vendor_deprecated/core/copyProperties.js @@ -45,3 +45,10 @@ function copyProperties(obj, a, b, c, d, e, f) { } module.exports = copyProperties; + +// deprecation notice +console.warn( + 'react/lib/copyProperties has been deprecated and will be removed in the ' + + 'next version of React. All uses can be replaced with ' + + 'Object.assign(obj, a, b, ...) or _.extend(obj, a, b, ...).' +); diff --git a/src/vendor/core/merge.js b/src/vendor_deprecated/core/merge.js similarity index 76% rename from src/vendor/core/merge.js rename to src/vendor_deprecated/core/merge.js index 609ba7e8d443f..389b335bb91d9 100644 --- a/src/vendor/core/merge.js +++ b/src/vendor_deprecated/core/merge.js @@ -23,3 +23,10 @@ var merge = function(one, two) { }; module.exports = merge; + +// deprecation notice +console.warn( + 'react/lib/merge has been deprecated and will be removed in the ' + + 'next version of React. All uses can be replaced with ' + + 'Object.assign({}, a, b) or _.extend({}, a, b).' +); diff --git a/src/vendor/core/mergeInto.js b/src/vendor_deprecated/core/mergeInto.js similarity index 63% rename from src/vendor/core/mergeInto.js rename to src/vendor_deprecated/core/mergeInto.js index 472099ab6668b..7bf424aacec79 100644 --- a/src/vendor/core/mergeInto.js +++ b/src/vendor_deprecated/core/mergeInto.js @@ -13,3 +13,10 @@ "use strict"; module.exports = Object.assign; + +// deprecation notice +console.warn( + 'react/lib/mergeInto has been deprecated and will be removed in the ' + + 'next version of React. All uses can be replaced with ' + + 'Object.assign(a, b, c, ...) or _.extend(a, b, c, ...).' +);