From bcb37c0b6ae6c319bc99b569a2253c30c3715a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Bigio?= Date: Sun, 20 Mar 2016 17:38:33 -0700 Subject: [PATCH] inline `__accept` call so that sourcemaps work Summary:Sourcemaps on HMR where a couple of line off. The problem is that since the `__accept` call doesn't go through the sourcemaps pipeline we need to make sure that call is a single-line one. This was originally written in a single line but I incorrectly updated it on https://github.com/facebook/react-native/commit/436db67126f1e64d1889c2d084b77c98c8d63f8d. Would be great having test coverage for this. Reviewed By: davidaurelio Differential Revision: D3075164 fb-gh-sync-id: c77ea99f26bdd675f241c5d20a620eb4ddfbf701 shipit-source-id: c77ea99f26bdd675f241c5d20a620eb4ddfbf701 --- Libraries/Utilities/HMRClient.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Libraries/Utilities/HMRClient.js b/Libraries/Utilities/HMRClient.js index 14850f860ba671..03619f60c3ce27 100644 --- a/Libraries/Utilities/HMRClient.js +++ b/Libraries/Utilities/HMRClient.js @@ -96,15 +96,15 @@ Error: ${e.message}` ? global.nativeInjectHMRUpdate : eval; - // TODO: (martinb) yellow box if cannot accept module - code = ` - __accept( - ${name}, - function(global, require, module, exports) { - ${code} - }, - ${JSON.stringify(inverseDependencies)} - );`; + code = [ + `__accept(`, + `${name},`, + `function(global,require,module,exports){`, + `${code}`, + '\n},', + `${JSON.stringify(inverseDependencies)}`, + `);`, + ].join(''); injectFunction(code, sourceURLs[i]); });