Skip to content

Commit 1722561

Browse files
committed
feat: Initial browserify shim
1 parent 9702a10 commit 1722561

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

browser-shim.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
exports.path = '';
4+
5+
exports.resolve = function(pathToModule) {
6+
return exports.path + pathToModule;
7+
};
8+
9+
exports.require = function(pathToModule) {
10+
return require(exports.resolve(pathToModule));
11+
};
12+
13+
exports.toString = function() {
14+
return exports.path;
15+
};
16+
17+
exports.setPath = function(explicitlySetPath) {
18+
exports.path = explicitlySetPath;
19+
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.3.0",
44
"description": "Determine an app's root path from anywhere inside the app",
55
"main": "index.js",
6+
"browser": "browser-shim.js",
67
"scripts": {
78
"test": "node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
89
"test-only": "mocha -R spec"

0 commit comments

Comments
 (0)