From 52697c71676356c7b2aac898721839c99ec3444d Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Fri, 4 Nov 2016 18:25:00 -0400 Subject: [PATCH] Cache getProdPackageNames optimistically. --- tools/isobuild/meteor-npm.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/isobuild/meteor-npm.js b/tools/isobuild/meteor-npm.js index 71451e0a1c2..90bd3ef0284 100644 --- a/tools/isobuild/meteor-npm.js +++ b/tools/isobuild/meteor-npm.js @@ -22,6 +22,7 @@ import { convert as convertColonsInPath } from "../utils/colon-converter.js"; +import { wrap as wrapOptimistic } from "optimism"; import { dirtyNodeModulesDirectory, optimisticLStat, @@ -133,7 +134,7 @@ meteorNpm.updateDependencies = function (packageName, // Returns a flattened dictionary of npm package names used in production, // or false if there is no package.json file in the parent directory. -export function getProdPackageNames(nodeModulesDir) { +export const getProdPackageNames = wrapOptimistic(nodeModulesDir => { const names = Object.create(null); const dirs = Object.create(null); const nodeModulesDirStack = []; @@ -208,7 +209,7 @@ export function getProdPackageNames(nodeModulesDir) { // Concretely, this means your app needs to have a package.json file if // you want any npm packages to be excluded in production. return walk(files.pathDirname(nodeModulesDir)) && names; -} +}); const lastRebuildJSONFilename = ".meteor-last-rebuild-version.json";