summaryrefslogtreecommitdiff
path: root/test/fixtures/packages
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2017-11-09 13:26:46 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2017-11-15 12:00:25 +0100
commitfdbb6dd042a560fc5d3b3ad682a13ddf506128e6 (patch)
tree9ff1cc45bc3f3e69f35d0a8826a40fddfcda1f93 /test/fixtures/packages
parent1132ea743449f63d6b1dd09f82ec3bb6f3f402f0 (diff)
downloadandroid-node-v8-fdbb6dd042a560fc5d3b3ad682a13ddf506128e6.tar.gz
android-node-v8-fdbb6dd042a560fc5d3b3ad682a13ddf506128e6.tar.bz2
android-node-v8-fdbb6dd042a560fc5d3b3ad682a13ddf506128e6.zip
module: speed up package.json parsing
If the package.json does not contain the string '"main"', skip parsing it to JSON. Note that this changes the behavior of the module loader in the presence of package.json files that don't contain legal JSON. Such files used to throw an exception but now they are simply ignored unless they contain a "main" property. To me, that seems like a good trade-off: I observe a 25% reduction in start-up time on a medium-sized application[0]. [0] https://github.com/strongloop/sls-sample-app PR-URL: https://github.com/nodejs/node/pull/15767 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/fixtures/packages')
-rw-r--r--test/fixtures/packages/invalid/index.js1
-rw-r--r--test/fixtures/packages/invalid/package.json1
2 files changed, 0 insertions, 2 deletions
diff --git a/test/fixtures/packages/invalid/index.js b/test/fixtures/packages/invalid/index.js
deleted file mode 100644
index 014fa39dc3..0000000000
--- a/test/fixtures/packages/invalid/index.js
+++ /dev/null
@@ -1 +0,0 @@
-exports.ok = 'ok';
diff --git a/test/fixtures/packages/invalid/package.json b/test/fixtures/packages/invalid/package.json
deleted file mode 100644
index 004e1e2032..0000000000
--- a/test/fixtures/packages/invalid/package.json
+++ /dev/null
@@ -1 +0,0 @@
-{,}