Your IP : 216.73.216.86


Current Path : /home/emeraadmin/public_html/4d695/
Upload File :
Current File : /home/emeraadmin/public_html/4d695/resolver.tar

cup.coffee000064400000000001151701470560006501 0ustar00
quux/foo/index.js000064400000000024151701470560010000 0ustar00module.exports = 1;
symlinked/package/package.json000064400000000030151701470570012424 0ustar00{
    "main": "bar.js"
}symlinked/package/bar.js000064400000000030151701470570011240 0ustar00module.exports = 'bar';
symlinked/_/symlink_target/.gitkeep000064400000000000151701470570013443 0ustar00symlinked/_/node_modules/foo.js000064400000000000151701470570012554 0ustar00dot_slash_main/package.json000064400000000025151701470570012022 0ustar00{
    "main": "./"
}
dot_slash_main/index.js000064400000000024151701470570011200 0ustar00module.exports = 1;
mug.js000064400000000000151701470570005667 0ustar00multirepo/package.json000064400000000603151701470570011060 0ustar00{
  "name": "ljharb-monorepo-symlink-test",
  "private": true,
  "version": "0.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "postinstall": "lerna bootstrap",
    "test": "node packages/package-a"
  },
  "author": "",
  "license": "MIT",
  "dependencies": {
    "jquery": "^3.3.1",
    "resolve": "../../../"
  },
  "devDependencies": {
    "lerna": "^3.4.3"
  }
}
multirepo/packages/package-b/package.json000064400000000431151701470570014447 0ustar00{
  "name": "@my-scope/package-b",
  "private": true,
  "version": "0.0.0",
  "description": "",
  "license": "MIT",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: run tests from root\" && exit 1"
  },
  "dependencies": {
    "@my-scope/package-a": "^0.0.0"
  }
}
multirepo/packages/package-b/index.js000064400000000000151701470570013616 0ustar00multirepo/packages/package-a/package.json000064400000000431151701470570014446 0ustar00{
  "name": "@my-scope/package-a",
  "version": "0.0.0",
  "private": true,
  "description": "",
  "license": "MIT",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: run tests from root\" && exit 1"
  },
  "dependencies": {
    "@my-scope/package-b": "^0.0.0"
  }
}
multirepo/packages/package-a/index.js000064400000002447151701470570013636 0ustar00'use strict';

var assert = require('assert');
var path = require('path');
var resolve = require('resolve');

var basedir = __dirname + '/node_modules/@my-scope/package-b';

var expected = path.join(__dirname, '../../node_modules/jquery/dist/jquery.js');

/*
 * preserveSymlinks === false
 * will search NPM package from
 * - packages/package-b/node_modules
 * - packages/node_modules
 * - node_modules
 */
assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: false }), expected);
assert.equal(resolve.sync('../../node_modules/jquery', { basedir: basedir, preserveSymlinks: false }), expected);

/*
 * preserveSymlinks === true
 * will search NPM package from
 * - packages/package-a/node_modules/@my-scope/packages/package-b/node_modules
 * - packages/package-a/node_modules/@my-scope/packages/node_modules
 * - packages/package-a/node_modules/@my-scope/node_modules
 * - packages/package-a/node_modules/node_modules
 * - packages/package-a/node_modules
 * - packages/node_modules
 * - node_modules
 */
assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: true }), expected);
assert.equal(resolve.sync('../../../../../node_modules/jquery', { basedir: basedir, preserveSymlinks: true }), expected);

console.log(' * all monorepo paths successfully resolved through symlinks');
multirepo/lerna.json000064400000000077151701470570010573 0ustar00{
  "packages": [
    "packages/*"
  ],
  "version": "0.0.0"
}
other_path/lib/other-lib.js000064400000000000151701470570011667 0ustar00other_path/root.js000064400000000000151701470570010217 0ustar00browser_field/package.json000064400000000077151701470570011673 0ustar00{
  "name": "browser_field",
  "main": "a",
  "browser": "b"
}
browser_field/b.js000064400000000000151701470570010146 0ustar00browser_field/a.js000064400000000000151701470570010145 0ustar00dot_main/package.json000064400000000024151701470570010627 0ustar00{
    "main": "."
}
dot_main/index.js000064400000000024151701470570010006 0ustar00module.exports = 1;
without_basedir/main.js000064400000000157151701470570011234 0ustar00var resolve = require('../../../');

module.exports = function (t, cb) {
    resolve('mymodule', null, cb);
};
false_main/package.json000064400000000052151701470570011134 0ustar00{
	"name": "false_main",
	"main": false
}
false_main/index.js000064400000000000151701470570010304 0ustar00mug.coffee000064400000000000151701470570006502 0ustar00same_names/foo/index.js000064400000000024151701470570011107 0ustar00module.exports = 1;
same_names/foo.js000064400000000025151701470570010001 0ustar00module.exports = 42;
incorrect_main/package.json000064400000000033151701470570012031 0ustar00{
    "main": "wrong.js"
}
incorrect_main/index.js000064400000000164151701470570011215 0ustar00// this is the actual main file 'index.js', not 'wrong.js' like the package.json would indicate
module.exports = 1;
nested_symlinks/mylib/package.json000064400000000403151701470570013365 0ustar00{
  "name": "mylib",
  "version": "0.0.0",
  "description": "",
  "private": true,
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "buffer": "*"
  }
}
nested_symlinks/mylib/async.js000064400000001532151701470570012556 0ustar00var a = require.resolve('buffer/').replace(process.cwd(), '$CWD');
var b;
var c;

var test = function test() {
    console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false'));
    console.log(b, ': preserveSymlinks true');
    console.log(c, ': preserveSymlinks false');

    if (a !== b && a !== c) {
        throw 'async: no match';
    }
    console.log('async: success! a matched either b or c\n');
};

require('resolve')('buffer/', { preserveSymlinks: true }, function (err, result) {
    if (err) { throw err; }
    b = result.replace(process.cwd(), '$CWD');
    if (b && c) { test(); }
});
require('resolve')('buffer/', { preserveSymlinks: false }, function (err, result) {
    if (err) { throw err; }
    c = result.replace(process.cwd(), '$CWD');
    if (b && c) { test(); }
});

nested_symlinks/mylib/sync.js000064400000001136151701470570012415 0ustar00var a = require.resolve('buffer/').replace(process.cwd(), '$CWD');
var b = require('resolve').sync('buffer/', { preserveSymlinks: true }).replace(process.cwd(), '$CWD');
var c = require('resolve').sync('buffer/', { preserveSymlinks: false }).replace(process.cwd(), '$CWD');

console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false'));
console.log(b, ': preserveSymlinks true');
console.log(c, ': preserveSymlinks false');

if (a !== b && a !== c) {
    throw 'sync: no match';
}
console.log('sync: success! a matched either b or c\n');
baz/package.json000064400000000055151701470570007615 0ustar00{
    "name": "baz",
    "main": "quux.js"
}
baz/quux.js000064400000000024151701470570006663 0ustar00module.exports = 1;
baz/doom.js000064400000000000151701470570006611 0ustar00foo.js000064400000000024151701470570005670 0ustar00module.exports = 1;
invalid_main/package.json000064400000000135151701470570011472 0ustar00{
  "name": "invalid_main",
  "main": [
    "why is this a thing",
    "srsly omg wtf"
  ]
}