From 82df764a221f654b61916c0abe3427f1acf2a2b1 Mon Sep 17 00:00:00 2001 From: Marius Stefan Bethge Date: Sun, 1 May 2016 17:26:39 +0200 Subject: [PATCH] Build: Replace Esperanto with Rollup Fixes gh-268 Closes gh-284 --- Gruntfile.js | 22 +++++++++------------- package.json | 4 ++-- src/capture.js | 2 +- src/dispatcher.js | 4 ++-- src/installer.js | 2 +- src/mouse.js | 2 +- src/ms.js | 2 +- src/platform-events.js | 10 +++++----- src/pointerevents.js | 16 ++++++++-------- src/touch.js | 8 ++++---- 10 files changed, 34 insertions(+), 38 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 2197a431..5e2fb9b7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -116,30 +116,26 @@ module.exports = function(grunt) { }); grunt.registerTask('build', function() { - var esperanto = require('esperanto'); + var rollup = require('rollup'); var done = this.async(); grunt.log.write('Building PEP...'); - esperanto.bundle({ - base: 'src', - entry: 'pointerevents.js' + rollup.rollup({ + entry: 'src/pointerevents.js' }).then(function(bundle) { - var umd = bundle.toUmd({ - name: 'PointerEventsPolyfill' - - // sourceMap: true, - // sourceMapFile: 'dist/pep.js' + var result = bundle.generate({ + moduleName: 'PointerEventsPolyfill', + format: 'umd', + banner: header }); - grunt.file.write('dist/pep.js', header + umd.code); - - // grunt.file.write('dist/pep.js.map', umd.map.toString()); + grunt.file.write('dist/pep.js', result.code); }).then( function() { grunt.log.ok(); done(); }, function(error) { - grunt.log.error(); + grunt.log.error(error); done(error); } ); diff --git a/package.json b/package.json index eaa8ccd2..48f3a590 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "atob": "^1.1.2", "bluebird": "^2.9.30", "chai-spies": "^0.5.1", - "esperanto": "^0.6.6", "fs-extra": "^0.19.0", "glob": "^5.0.10", "grunt": "~0.4.1", @@ -34,7 +33,8 @@ "grunt-selenium-standalone": "1.0.1", "intern": "2.2.2", "lodash": "^3.9.3", - "request": "^2.58.0" + "request": "^2.58.0", + "rollup": "^0.26.1" }, "web-platform-tests": { "repo": "w3c/web-platform-tests#c98d1ff0ea91ba1aa9a15e8ea2d70d8ede1fdc0e", diff --git a/src/capture.js b/src/capture.js index 6ef6bcc1..014d1cd8 100644 --- a/src/capture.js +++ b/src/capture.js @@ -1,4 +1,4 @@ -import dispatcher from 'dispatcher'; +import dispatcher from './dispatcher'; var n = window.navigator; var s, r; diff --git a/src/dispatcher.js b/src/dispatcher.js index ec97e6e7..b6ee689c 100644 --- a/src/dispatcher.js +++ b/src/dispatcher.js @@ -1,5 +1,5 @@ -import PointerEvent from 'PointerEvent'; -import PointerMap from 'pointermap'; +import PointerEvent from './PointerEvent'; +import PointerMap from './pointermap'; var CLONE_PROPS = [ diff --git a/src/installer.js b/src/installer.js index d1f70b59..f295fc97 100644 --- a/src/installer.js +++ b/src/installer.js @@ -5,7 +5,7 @@ * All nodes that wish to generate Pointer Events must have the attribute * `touch-action` set to `none`. */ -import targeting from 'targeting'; +import targeting from './targeting'; var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach); var map = Array.prototype.map.call.bind(Array.prototype.map); diff --git a/src/mouse.js b/src/mouse.js index c576bca8..112c5dc7 100644 --- a/src/mouse.js +++ b/src/mouse.js @@ -1,4 +1,4 @@ -import dispatcher from 'dispatcher'; +import dispatcher from './dispatcher'; var pointermap = dispatcher.pointermap; diff --git a/src/ms.js b/src/ms.js index 84c25a68..ce51e4b6 100644 --- a/src/ms.js +++ b/src/ms.js @@ -1,4 +1,4 @@ -import dispatcher from 'dispatcher'; +import dispatcher from './dispatcher'; var pointermap = dispatcher.pointermap; var HAS_BITMAP_TYPE = window.MSPointerEvent && diff --git a/src/platform-events.js b/src/platform-events.js index 6c166b29..5d78e70b 100644 --- a/src/platform-events.js +++ b/src/platform-events.js @@ -1,8 +1,8 @@ -import PointerEvent from 'PointerEvent'; -import dispatcher from 'dispatcher'; -import mouseEvents from 'mouse'; -import touchEvents from 'touch'; -import msEvents from 'ms'; +import PointerEvent from './PointerEvent'; +import dispatcher from './dispatcher'; +import mouseEvents from './mouse'; +import touchEvents from './touch'; +import msEvents from './ms'; export function applyPolyfill() { diff --git a/src/pointerevents.js b/src/pointerevents.js index 31967898..940e6ddc 100644 --- a/src/pointerevents.js +++ b/src/pointerevents.js @@ -1,11 +1,11 @@ -import dispatcher from 'dispatcher'; -import PointerMap from 'pointermap'; -import Installer from 'installer'; -import targeting from 'targeting'; -import PointerEvent from 'PointerEvent'; -import { applyAttributeStyles } from 'touch-action'; -import { applyPolyfill as applyPointerEventPolyfill } from 'platform-events'; -import { applyPolyfill as applyCapturePolyfill } from 'capture'; +import dispatcher from './dispatcher'; +import PointerMap from './pointermap'; +import Installer from './installer'; +import targeting from './targeting'; +import PointerEvent from './PointerEvent'; +import { applyAttributeStyles } from './touch-action'; +import { applyPolyfill as applyPointerEventPolyfill } from './platform-events'; +import { applyPolyfill as applyCapturePolyfill } from './capture'; applyAttributeStyles(); applyPointerEventPolyfill(); diff --git a/src/touch.js b/src/touch.js index e3b6dcde..90fa92fe 100644 --- a/src/touch.js +++ b/src/touch.js @@ -1,7 +1,7 @@ -import targeting from 'targeting'; -import dispatcher from 'dispatcher'; -import Installer from 'installer'; -import mouseEvents from 'mouse'; +import targeting from './targeting'; +import dispatcher from './dispatcher'; +import Installer from './installer'; +import mouseEvents from './mouse'; var captureInfo = dispatcher.captureInfo; var findTarget = targeting.findTarget.bind(targeting);