Skip to content

Commit

Permalink
Merge 809be4d into 6f3fbb9
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp committed Jan 22, 2018
2 parents 6f3fbb9 + 809be4d commit bbef578
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 11 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
BROWSERIFY=node_modules/.bin/browserify
ROLLUP=node_modules/.bin/rollup
INFOLOG := \033[34m ▸\033[0m

page.js: index.js
@echo "$(INFOLOG) Building page.js.."
@$(BROWSERIFY) index.js --standalone page -o page.js
@$(ROLLUP) -c rollup.config.js

watch:
find index.js | entr make page.js
.PHONY: watch

clean:
@rm page.js
.PHONY: clean
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
*/

module.exports = page;
module.exports.default = page;
module.exports.Context = Context;
module.exports.Route = Route;
module.exports.sameOrigin = sameOrigin;
page.default = page;
page.Context = Context;
page.Route = Route;
page.sameOrigin = sameOrigin;

/**
* Short-cuts for global-object checks
Expand All @@ -25,6 +25,7 @@
var hasDocument = ('undefined' !== typeof document);
var hasWindow = ('undefined' !== typeof window);
var hasHistory = ('undefined' !== typeof history);
var hasProcess = typeof process !== 'undefined';

/**
* Detect click event
Expand Down Expand Up @@ -601,8 +602,7 @@
/**
* Handle "click" events.
*/
/* jshint -W054 */
var hasProcess = new Function('return typeof process')() !== 'undefined';

/* jshint +W054 */
function onclick(e) {
if (1 !== which(e)) return;
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@
"test": "jshint index.js test/tests.js && mocha test/tests.js",
"serve": "serve test",
"test-cov": "jscoverage index.js index-cov.js; PAGE_COV=1 mocha test/tests.js -R html-cov > coverage.html",
"prepublish": "npm run make",
"make": "browserify index.js --standalone page -o page.js"
"make": "rollup -c rollup.config.js"
},
"dependencies": {
"path-to-regexp": "~1.2.1"
},
"devDependencies": {
"browserify": "^6.3.2",
"chai": "^1.10.0",
"coveralls": "^2.11.2",
"engine-dependencies": "^0.2.0",
Expand All @@ -35,6 +33,9 @@
"jshint": "^2.5.10",
"mocha": "^2.0.1",
"mocha-lcov-reporter": "0.0.1",
"rollup": "^0.54.1",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-node-resolve": "^3.0.2",
"serve": "*",
"should": "*"
},
Expand Down
20 changes: 20 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';

export default {
input: 'index.js',
output: {
file: 'page.js',
format: 'umd',
name: 'page'
},
plugins: [
nodeResolve({
jsnext: true,
main: true
}),
commonjs({
include: ['node_modules/**', '**']
})
]
};

0 comments on commit bbef578

Please sign in to comment.