[Pkg-javascript-commits] [node-yarnpkg] 01/13: New upstream version 0.18.1

Paolo Greppi paolog-guest at moszumanska.debian.org
Sat Dec 24 14:36:18 UTC 2016


This is an automated email from the git hooks/post-receive script.

paolog-guest pushed a commit to branch master
in repository node-yarnpkg.

commit 5100d0b31b318c8b8d447ab21f9b2022080f7abd
Author: Paolo Greppi <paolo.greppi at libpf.com>
Date:   Sat Dec 24 12:59:44 2016 +0000

    New upstream version 0.18.1
---
 __tests__/commands/_helpers.js                     |   5 +++
 __tests__/commands/cache.js                        |   3 ++
 __tests__/commands/install/integration.js          |  43 ++++++++++++++-------
 .../package.json                                   |   6 +++
 .../optional-failing/install.js                    |   1 +
 .../optional-failing/package.json                  |   7 ++++
 .../package.json                                   |   5 +++
 .../optional-failing/install.js                    |   1 +
 .../optional-failing/package.json                  |  10 +++++
 .../package.json                                   |   5 +++
 .../sub-dep/install.js                             |   1 +
 .../sub-dep/package.json                           |   7 ++++
 .../GET/registry.npmjs.org/babel-code-frame.bin    | Bin 5016 -> 4291 bytes
 .../GET/registry.npmjs.org/babel-core.bin          | Bin 38204 -> 25802 bytes
 .../GET/registry.npmjs.org/babel-generator.bin     | Bin 8866 -> 7278 bytes
 .../GET/registry.npmjs.org/babel-register.bin      | Bin 3986 -> 3545 bytes
 .../GET/registry.npmjs.org/babel-runtime.bin       | Bin 15045 -> 12391 bytes
 .../GET/registry.npmjs.org/babel-traverse.bin      | Bin 6925 -> 5893 bytes
 .../GET/registry.npmjs.org/babel-types.bin         | Bin 6537 -> 5649 bytes
 .../GET/registry.npmjs.org/regenerator-runtime.bin | Bin 1651 -> 2189 bytes
 .../GET/registry.yarnpkg.com/babel-core.bin        | Bin 456510 -> 25844 bytes
 .../GET/registry.yarnpkg.com/babel-generator.bin   | Bin 86877 -> 7349 bytes
 .../GET/registry.yarnpkg.com/babel-register.bin    | Bin 29867 -> 3722 bytes
 .../GET/registry.yarnpkg.com/babel-runtime.bin     | Bin 145571 -> 12565 bytes
 .../GET/registry.yarnpkg.com/babel-traverse.bin    | Bin 62116 -> 5961 bytes
 .../GET/registry.yarnpkg.com/babel-types.bin       | Bin 59227 -> 5722 bytes
 .../registry.yarnpkg.com/regenerator-runtime.bin   | Bin 7588 -> 2365 bytes
 __tests__/package-hoister.js                       |   2 +-
 package.json                                       |   2 +-
 src/package-hoister.js                             |  23 ++++++-----
 30 files changed, 95 insertions(+), 26 deletions(-)

diff --git a/__tests__/commands/_helpers.js b/__tests__/commands/_helpers.js
index 6691d2e..8a4e4ba 100644
--- a/__tests__/commands/_helpers.js
+++ b/__tests__/commands/_helpers.js
@@ -106,6 +106,11 @@ export async function run<T, R>(
   await fs.mkdirp(path.join(cwd, '.yarn-cache'));
   await fs.mkdirp(path.join(cwd, 'node_modules'));
 
+  // make sure the cache folder been created in temp folder
+  if (flags.cacheFolder) {
+    flags.cacheFolder = path.join(cwd, flags.cacheFolder);
+  }
+
   try {
     const config = new Config(reporter);
     await config.init({
diff --git a/__tests__/commands/cache.js b/__tests__/commands/cache.js
index 17ee603..27ed74a 100644
--- a/__tests__/commands/cache.js
+++ b/__tests__/commands/cache.js
@@ -6,6 +6,8 @@ import * as configCmd from '../../src/cli/commands/config.js';
 import {run as buildRun} from './_helpers.js';
 import * as fs from '../../src/util/fs.js';
 
+const path = require('path');
+
 jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
 
 const runConfig = buildRun.bind(
@@ -13,6 +15,7 @@ const runConfig = buildRun.bind(
   reporters.ConsoleReporter,
   '',
   (args, flags, config, reporter): CLIFunctionReturn => {
+    config.registries.yarn.homeConfigLoc = path.join(config.cwd, '.yarnrc');
     return configCmd.run(config, reporter, flags, args);
   },
 );
diff --git a/__tests__/commands/install/integration.js b/__tests__/commands/install/integration.js
index e95a122..d140669 100644
--- a/__tests__/commands/install/integration.js
+++ b/__tests__/commands/install/integration.js
@@ -638,20 +638,6 @@ test.concurrent('install uses OS line endings when lockfile doesn\'t exist', asy
     });
 });
 
-// sync test because we need to get all the requests to confirm their validity
-test('install a scoped module from authed private registry', (): Promise<void> => {
-  return runInstall({noLockfile: true}, 'install-from-authed-private-registry', async (config) => {
-    const authedRequests = request.__getAuthedRequests();
-    assert.equal(authedRequests[0].url, 'https://registry.yarnpkg.com/@types%2flodash');
-    assert.equal(authedRequests[0].headers.authorization, 'Bearer abc123');
-    assert.equal(authedRequests[1].url, 'https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.37.tgz');
-    assert.equal(authedRequests[1].headers.authorization, 'Bearer abc123');
-    assert.equal(
-      (await fs.readFile(path.join(config.cwd, 'node_modules', '@types', 'lodash', 'index.d.ts'))).split('\n')[0],
-      '// Type definitions for Lo-Dash 4.14',
-    );
-  });
-});
 
 test.concurrent('install a module with incompatible optional dependency should skip dependency',
   (): Promise<void> => {
@@ -666,3 +652,32 @@ test.concurrent('install a module with incompatible optional dependency should s
       assert.ok(!(await fs.exists(path.join(config.cwd, 'node_modules', 'dep-a'))));
     });
   });
+
+// this tests for a problem occuring due to optional dependency incompatible with os, in this case fsevents
+// this would fail on os's incompatible with fsevents, which is everything except osx.
+if (process.platform !== 'darwin') {
+  test.concurrent('install incompatible optional dependency should still install shared child dependencies',
+    (): Promise<void> => {
+      return runInstall({}, 'install-should-not-skip-required-shared-deps', async (config) => {
+        assert.ok(await fs.exists(path.join(config.cwd, 'node_modules', 'deep-extend')));
+        assert.ok(await fs.exists(path.join(config.cwd, 'node_modules', 'ini')));
+        assert.ok(await fs.exists(path.join(config.cwd, 'node_modules', 'strip-json-comments')));
+      });
+    });
+}
+
+// Covers current behavior, issue opened whether this should be changed https://github.com/yarnpkg/yarn/issues/2274
+test.concurrent('optional dependency that fails to build should still be installed',
+  (): Promise<void> => {
+    return runInstall({}, 'should-install-failing-optional-deps', async (config) => {
+      assert.ok(await fs.exists(path.join(config.cwd, 'node_modules', 'optional-failing')));
+    });
+  });
+
+test.concurrent('a subdependency of an optional dependency that fails should be installed',
+  (): Promise<void> => {
+    return runInstall({}, 'should-install-failing-optional-sub-deps', async (config) => {
+      assert.ok(await fs.exists(path.join(config.cwd, 'node_modules', 'optional-failing')));
+      assert.ok(await fs.exists(path.join(config.cwd, 'node_modules', 'sub-dep')));
+    });
+  });
diff --git a/__tests__/fixtures/install/install-should-not-skip-required-shared-deps/package.json b/__tests__/fixtures/install/install-should-not-skip-required-shared-deps/package.json
new file mode 100644
index 0000000..7c68351
--- /dev/null
+++ b/__tests__/fixtures/install/install-should-not-skip-required-shared-deps/package.json
@@ -0,0 +1,6 @@
+{
+  "dependencies": {
+    "babel-cli": "6.18.0",
+    "gulp-imagemin": "3.1.1"
+  }
+}
diff --git a/__tests__/fixtures/install/should-install-failing-optional-deps/optional-failing/install.js b/__tests__/fixtures/install/should-install-failing-optional-deps/optional-failing/install.js
new file mode 100644
index 0000000..6cee2e1
--- /dev/null
+++ b/__tests__/fixtures/install/should-install-failing-optional-deps/optional-failing/install.js
@@ -0,0 +1 @@
+process.exit(1);
diff --git a/__tests__/fixtures/install/should-install-failing-optional-deps/optional-failing/package.json b/__tests__/fixtures/install/should-install-failing-optional-deps/optional-failing/package.json
new file mode 100644
index 0000000..a73170d
--- /dev/null
+++ b/__tests__/fixtures/install/should-install-failing-optional-deps/optional-failing/package.json
@@ -0,0 +1,7 @@
+{
+  "name": "optional-failing",
+  "version": "0.0.0",
+  "scripts": {
+    "install": "node install.js"
+  }
+}
diff --git a/__tests__/fixtures/install/should-install-failing-optional-deps/package.json b/__tests__/fixtures/install/should-install-failing-optional-deps/package.json
new file mode 100644
index 0000000..7fefc6d
--- /dev/null
+++ b/__tests__/fixtures/install/should-install-failing-optional-deps/package.json
@@ -0,0 +1,5 @@
+{
+  "optionalDependencies": {
+    "optional-failing": "file:optional-failing"
+  }
+}
diff --git a/__tests__/fixtures/install/should-install-failing-optional-sub-deps/optional-failing/install.js b/__tests__/fixtures/install/should-install-failing-optional-sub-deps/optional-failing/install.js
new file mode 100644
index 0000000..6cee2e1
--- /dev/null
+++ b/__tests__/fixtures/install/should-install-failing-optional-sub-deps/optional-failing/install.js
@@ -0,0 +1 @@
+process.exit(1);
diff --git a/__tests__/fixtures/install/should-install-failing-optional-sub-deps/optional-failing/package.json b/__tests__/fixtures/install/should-install-failing-optional-sub-deps/optional-failing/package.json
new file mode 100644
index 0000000..2a6dddc
--- /dev/null
+++ b/__tests__/fixtures/install/should-install-failing-optional-sub-deps/optional-failing/package.json
@@ -0,0 +1,10 @@
+{
+  "name": "optional-failing",
+  "version": "0.0.0",
+  "scripts": {
+    "install": "node install.js"
+  },
+  "dependencies": {
+    "sub-dep": "file:../sub-dep"
+  }
+}
diff --git a/__tests__/fixtures/install/should-install-failing-optional-sub-deps/package.json b/__tests__/fixtures/install/should-install-failing-optional-sub-deps/package.json
new file mode 100644
index 0000000..7fefc6d
--- /dev/null
+++ b/__tests__/fixtures/install/should-install-failing-optional-sub-deps/package.json
@@ -0,0 +1,5 @@
+{
+  "optionalDependencies": {
+    "optional-failing": "file:optional-failing"
+  }
+}
diff --git a/__tests__/fixtures/install/should-install-failing-optional-sub-deps/sub-dep/install.js b/__tests__/fixtures/install/should-install-failing-optional-sub-deps/sub-dep/install.js
new file mode 100644
index 0000000..dcbbff6
--- /dev/null
+++ b/__tests__/fixtures/install/should-install-failing-optional-sub-deps/sub-dep/install.js
@@ -0,0 +1 @@
+process.exit(0);
diff --git a/__tests__/fixtures/install/should-install-failing-optional-sub-deps/sub-dep/package.json b/__tests__/fixtures/install/should-install-failing-optional-sub-deps/sub-dep/package.json
new file mode 100644
index 0000000..776fc1b
--- /dev/null
+++ b/__tests__/fixtures/install/should-install-failing-optional-sub-deps/sub-dep/package.json
@@ -0,0 +1,7 @@
+{
+  "name": "sub-dep",
+  "version": "0.0.0",
+  "scripts": {
+    "install": "node install.js"
+  }
+}
diff --git a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-code-frame.bin b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-code-frame.bin
index 7497f14..c5bd4a3 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-code-frame.bin and b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-code-frame.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-core.bin b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-core.bin
index 360554a..827b6bb 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-core.bin and b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-core.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-generator.bin b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-generator.bin
index 76e9c07..b13f081 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-generator.bin and b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-generator.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-register.bin b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-register.bin
index 455df4f..86c6669 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-register.bin and b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-register.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-runtime.bin b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-runtime.bin
index 5b6041e..38be4e3 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-runtime.bin and b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-runtime.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-traverse.bin b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-traverse.bin
index 863103c..d899796 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-traverse.bin and b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-traverse.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-types.bin b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-types.bin
index 49df8bf..1781237 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-types.bin and b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/babel-types.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/regenerator-runtime.bin b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/regenerator-runtime.bin
index 1ff3100..27d2640 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.npmjs.org/regenerator-runtime.bin and b/__tests__/fixtures/request-cache/GET/registry.npmjs.org/regenerator-runtime.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-core.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-core.bin
index 5ec15e5..776f81d 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-core.bin and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-core.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-generator.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-generator.bin
index 7b17308..7f16fa1 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-generator.bin and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-generator.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-register.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-register.bin
index 580f4e2..9c3243f 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-register.bin and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-register.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-runtime.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-runtime.bin
index 6dd44b4..ff6b872 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-runtime.bin and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-runtime.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-traverse.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-traverse.bin
index 2069765..96be5fc 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-traverse.bin and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-traverse.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-types.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-types.bin
index fd83ba0..e4517ca 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-types.bin and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/babel-types.bin differ
diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/regenerator-runtime.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/regenerator-runtime.bin
index 1e287cd..b1f22e5 100644
Binary files a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/regenerator-runtime.bin and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/regenerator-runtime.bin differ
diff --git a/__tests__/package-hoister.js b/__tests__/package-hoister.js
index 1454673..54fdebe 100644
--- a/__tests__/package-hoister.js
+++ b/__tests__/package-hoister.js
@@ -28,7 +28,7 @@ test('Produces valid destination paths for scoped modules', () => {
     _reference: (({}: any): PackageReference),
   }: any): Manifest);
 
-  const info = new HoistManifest(key, parts, pkg, '', false);
+  const info = new HoistManifest(key, parts, pkg, '', () => false);
 
   const tree = new Map([
     ['@scoped/dep', info],
diff --git a/package.json b/package.json
index 9b596d5..968ab2b 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "yarn",
   "installationMethod": "unknown",
-  "version": "0.18.0",
+  "version": "0.18.1",
   "license": "BSD-2-Clause",
   "preferGlobal": true,
   "dependencies": {
diff --git a/src/package-hoister.js b/src/package-hoister.js
index f205ce8..58845a2 100644
--- a/src/package-hoister.js
+++ b/src/package-hoister.js
@@ -13,8 +13,8 @@ type Parts = Array<string>;
 let historyCounter = 0;
 
 export class HoistManifest {
-  constructor(key: string, parts: Parts, pkg: Manifest, loc: string, isIgnored: boolean) {
-    this.ignore = isIgnored;
+  constructor(key: string, parts: Parts, pkg: Manifest, loc: string, isIgnored: () => boolean) {
+    this.isIgnored = isIgnored;
     this.loc = loc;
     this.pkg = pkg;
 
@@ -27,7 +27,7 @@ export class HoistManifest {
     this.addHistory(`Start position = ${key}`);
   }
 
-  ignore: boolean;
+  isIgnored: () => boolean;
   pkg: Manifest;
   loc: string;
   parts: Parts;
@@ -130,13 +130,17 @@ export default class PackageHoister {
 
     //
     let parentParts: Parts = [];
-    let isIgnored = ref.ignore;
+    let isIgnored = () => ref.ignore;
 
     if (parent) {
       if (!this.tree.get(parent.key)) {
         return null;
       }
-      isIgnored = isIgnored || parent.ignore;
+      // non ignored dependencies inherit parent's ignored status
+      // parent may transition from ignored to non ignored when hoisted if it is used in another non ignored branch
+      if (!isIgnored() && parent.isIgnored()) {
+        isIgnored = () => !!parent && parent.isIgnored();
+      }
       parentParts = parent.parts;
     }
 
@@ -181,9 +185,9 @@ export default class PackageHoister {
       const existing = this.tree.get(checkKey);
       if (existing) {
         if (existing.loc === info.loc) {
-          // deduping an unignored reference to an ignored one
-          if (existing.ignore && !info.ignore) {
-            existing.ignore = false;
+          // switch to non ignored if earlier deduped version was ignored
+          if (existing.isIgnored() && !info.isIgnored()) {
+            existing.isIgnored = info.isIgnored;
           }
 
           existing.addHistory(`Deduped ${fullKey} to this item`);
@@ -277,7 +281,6 @@ export default class PackageHoister {
     // remove this item from the `tree` map so we can ignore it
     this.tree.delete(key);
 
-    //
     const {parts, duplicate} = this.getNewParts(key, info, rawParts.slice());
     const newKey = this.implodeKey(parts);
     const oldKey = key;
@@ -389,7 +392,7 @@ export default class PackageHoister {
       const ref = info.pkg._reference;
       invariant(ref, 'expected reference');
 
-      if (info.ignore) {
+      if (info.isIgnored()) {
         info.addHistory('Deleted as this module was ignored');
       } else {
         visibleFlatTree.push([loc, info]);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-yarnpkg.git



More information about the Pkg-javascript-commits mailing list