From d60ac14fd0cb4d14c90a224dcfd0ce397789de89 Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Mon, 31 Oct 2016 11:34:35 -0700 Subject: [PATCH] extract-dependencies.js: fix out-of-date comment Summary: We actually use the AST, not regexes. Fix comment. Reviewed By: davidaurelio Differential Revision: D4104797 fbshipit-source-id: e37d168bd541d9d222667d0d168aa6b6099c1275 --- .../src/JSTransformer/worker/extract-dependencies.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/react-packager/src/JSTransformer/worker/extract-dependencies.js b/react-packager/src/JSTransformer/worker/extract-dependencies.js index 4e1bfb39..93da240f 100644 --- a/react-packager/src/JSTransformer/worker/extract-dependencies.js +++ b/react-packager/src/JSTransformer/worker/extract-dependencies.js @@ -13,13 +13,8 @@ const babylon = require('babylon'); /** * Extracts dependencies (module IDs imported with the `require` function) from - * a string containing code. - * The function is regular expression based for speed reasons. - * - * The code is traversed twice: - * 1. An array of ranges is built, where indexes 0-1, 2-3, 4-5, etc. are code, - * and indexes 1-2, 3-4, 5-6, etc. are string literals and comments. - * 2. require calls are extracted with a regular expression. + * a string containing code. This walks the full AST for correctness (versus + * using, for example, regular expressions, that would be faster but inexact.) * * The result of the dependency extraction is an de-duplicated array of * dependencies, and an array of offsets to the string literals with module IDs.