Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
721ca13
chore(package): update mocha to version 4.0.1 (#34)
benjamn Nov 16, 2017
9b45cf0
chore(package): update reify to version 0.12.3 (#35)
benjamn Nov 16, 2017
29bab8a
Reverse order of isObject conjunction clauses.
benjamn Sep 11, 2017
be2cd97
Remove unnecessary conditional.
benjamn Sep 11, 2017
1c80ac7
Use a stricter version of Object.prototype.hasOwnProperty.
benjamn Sep 13, 2017
8733c68
Add a package-lock.json file for reproducible installs.
benjamn Nov 16, 2017
b8e62ae
Batch multiple calls to module.prefetch into one install.fetch call.
benjamn Nov 16, 2017
668ff6b
Bump NPM version to 0.10.2 in preparation for publishing.
benjamn Nov 16, 2017
7f90133
Run Travis CI tests in Node 8 and 9, too.
benjamn Nov 16, 2017
d16b781
chore(package): update mocha to version 5.0.0 (#38)
greenkeeper[bot] Jan 22, 2018
f18d028
chore(package): update docco to version 0.8.0 (#37)
greenkeeper[bot] Jan 22, 2018
3d34a1f
chore(package): update reify to version 0.13.7 (#39)
benjamn Jan 22, 2018
3f5df34
Update package-lock.json.
benjamn Jan 22, 2018
3d58d21
Switch to using docs/ directory on master for GitHub pages.
benjamn Jan 22, 2018
d8142eb
Fall back to index.js when package.json "main" module missing.
benjamn Jan 22, 2018
71283e4
Use method shorthand syntax in README.md examples.
benjamn Jan 22, 2018
bead9d3
Bump NPM version to 0.10.3 in preparation for publishing.
benjamn Jan 22, 2018
05e461f
Add docs/ directory to .npmignore.
benjamn Jan 22, 2018
6412f4a
Bump NPM version to 0.10.4 in preparation for publishing.
benjamn Jan 22, 2018
69a15ac
chore(package): update reify to version 0.14.2 (#41)
benjamn Mar 23, 2018
64d06b0
Update package-lock.json.
benjamn Mar 23, 2018
f69158f
Remove support for calling Module.prototype.useNode.
benjamn Mar 23, 2018
24b72f8
Bump NPM version to 0.11.0 in preparation for publishing.
benjamn Mar 23, 2018
e36fc03
chore(package): update reify to version 0.15.0 (#42)
greenkeeper[bot] Mar 23, 2018
84046cb
chore(package): update reify to version 0.16.1 (#45)
benjamn May 25, 2018
49edd2c
Update reify to latest version.
benjamn Jun 8, 2018
c24cefb
Update package-lock.json.
benjamn Jun 8, 2018
59b1fb5
Run Travis CI tests in Node 10, too.
benjamn Jun 8, 2018
c417044
Try file extensions when resolving index.* modules.
benjamn Jun 25, 2018
d52429b
Bump npm version to 0.11.1 in preparation for publishing.
benjamn Jun 25, 2018
a630b5c
Implement Module.prototype.require.
benjamn Jun 25, 2018
325b3ba
Bump npm version to 0.11.2 in preparation for publishing.
benjamn Jun 25, 2018
7a9abec
Remove options.wrapRequire.
benjamn Jun 25, 2018
c8529be
Remove options.onInstall.
benjamn Jun 25, 2018
1836fc4
Remove options.override.
benjamn Jun 25, 2018
49679ee
Simplify calling makeInstaller in tests.
benjamn Jun 25, 2018
00d958e
Merge pull request #46 from benjamn/remove-unused-options
benjamn Jun 25, 2018
1acc918
Bump npm version to 0.12.0 in preparation for publishing.
benjamn Jun 25, 2018
561c21a
Remove deprecated options from README.md.
benjamn Jun 26, 2018
d7e7df8
Mention makeInstaller(options).Module in README.md.
benjamn Jun 26, 2018
0c1897d
Bump npm version to 0.12.1 in preparation for publishing.
benjamn Jun 26, 2018
31013c3
Regenerate docs.
benjamn Jun 26, 2018
002133f
chore(package): update reify to version 0.17.2
greenkeeper[bot] Aug 1, 2018
5ff7642
Update package-lock.json.
benjamn Aug 1, 2018
780df3e
Switch from module.watch to module.link.
benjamn Aug 1, 2018
49fb867
Merge pull request #48 from benjamn/greenkeeper/reify-0.17.2
benjamn Aug 1, 2018
8e420c4
Greenkeeper/reify 0.18.1 (#52)
benjamn Oct 13, 2018
146bb3b
Enable retrying dynamic imports after failure.
Gariest Sep 25, 2018
d33b133
Reset file.pending for all fetched files.
benjamn Oct 13, 2018
3509cc9
Tolerate install.fetch throwing instead of merely rejecting.
benjamn Oct 13, 2018
ed1a803
Add a test of retrying dynamic imports after failure.
benjamn Oct 13, 2018
635fd0c
Merge pull request #50 from Gariest/DynamicImportOfflineBugFixv2
benjamn Oct 13, 2018
95756fa
Switch from uglify-js to terser.
benjamn Oct 13, 2018
d2c369d
Update package-lock.json.
benjamn Oct 13, 2018
d173487
Bump npm version to 0.12.2 in preparation for publishing.
benjamn Oct 13, 2018
fefe375
Regenerate docs.
benjamn Oct 13, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules
/test
/docs
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
language: node_js
sudo: false
node_js:
- "10"
- "9"
- "8"
- "7"
- "6"
- "5"
Expand Down
45 changes: 30 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,21 @@ var install = require("install").makeInstaller({
// identifiers if they do not exactly match an installed module.
extensions: [".js", ".json"],

// If defined, the options.onInstall function will be called any time
// new modules are installed.
onInstall,

// If defined, the options.override function will be called before
// looking up any top-level package identifiers in node_modules
// directories. It can return either a string to provide an alternate
// package identifier or a non-string value to prevent the lookup from
// proceeding.
override,

// If defined, the options.fallback function will be called when no
// installed module is found for a required module identifier. Often
// options.fallback will be implemented in terms of the native Node
// require function, which has the ability to load binary modules.
fallback
fallback,

// Boolean flag indicating whether the installed code will be running in
// a web browser.
browser,

// List of fields to look for in package.json files to determine the
// main entry module of the package. The first field listed here whose
// value is a string will be used to resolve the entry module. Defaults
// to just ["main"], or ["browser", "main"] if options.browser is true.
mainFields: ["browser", "main"],
});
```

Expand All @@ -54,7 +53,7 @@ objects and functions to the `install` function:

```js
var require = install({
"main.js": function (require, exports, module) {
"main.js"(require, exports, module) {
// On the client, the "assert" module should be install-ed just like
// any other module. On the server, since "assert" is a built-in Node
// module, it may make sense to let the options.fallback function
Expand All @@ -76,13 +75,13 @@ var require = install({
// If package.json is not defined, a module called "index.js" will
// be used as the main entry point for the package. Otherwise the
// exports.main property will identify the entry point.
"package.json": function (require, exports, module) {
"package.json"(require, exports, module) {
exports.name = "package";
exports.version = "0.1.0";
exports.main = "entry.js";
},

"entry.js": function (require, exports, module) {
"entry.js"(require, exports, module) {
exports.name = module.id;
}
}
Expand All @@ -104,5 +103,21 @@ function. If you're using the `install` package in a CommonJS environment
like Node, be careful that you don't overwrite the `require` function
provided by that system.

If you need to change the behavior of the `module` object that each module
function receives as its third parameter, the shared `Module` constructor
is exposed as a property of the `install` function returned by the
`makeInstaller` factory:

```js
var install = makeInstaller(options);
var proto = install.Module.prototype;

// Wrap all Module.prototype.require calls with some sort of logging.
proto.require = wrapWithLogging(proto.require);

// Add a new method available to all modules via module.newMethod(...).
proto.newMethod = function () {...};
```

Many more examples of how to use the `install` package can be found in the
[tests](https://github.com/benjamn/install/blob/master/test/run.js).
Loading