This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build: Use ES6 modules and remove use of script loading for full build
- Loading branch information
1 parent
cfc6263
commit 361b4a2
Showing
26 changed files
with
1,284 additions
and
1,312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
build/ | ||
node_modules | ||
pointerevents.min.js | ||
pointerevents.min.js.map | ||
pointerevents.dev.js | ||
/dist/ | ||
/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,67 @@ | ||
module.exports = function(grunt) { | ||
grunt.loadNpmTasks('grunt-contrib-concat'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-karma'); | ||
|
||
var sourceFiles = grunt.file.readJSON('build.json'); | ||
grunt.initConfig({ | ||
concat: { | ||
pointerevents: { | ||
options: { | ||
stripBanners: true, | ||
banner: grunt.file.read('LICENSE.txt') | ||
}, | ||
nonull: true, | ||
src: sourceFiles, | ||
dest: 'pointerevents.dev.js' | ||
} | ||
}, | ||
uglify: { | ||
pointerevents: { | ||
options: { | ||
// sourceMap: 'pointerevents.min.js.map', | ||
banner: grunt.file.read('LICENSE.txt') | ||
}, | ||
nonull: true, | ||
dest: 'pointerevents.min.js', | ||
src: sourceFiles | ||
} | ||
}, | ||
karma: { | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-karma'); | ||
|
||
var version = require('./package').version; | ||
var header = | ||
'/*!\n' + | ||
' * PEP v' + version + ' | https://github.com/jquery/PEP\n' + | ||
' * Copyright jQuery Foundation and other contributors | http://jquery.org/license\n'+ | ||
' */\n'; | ||
|
||
grunt.initConfig({ | ||
uglify: { | ||
pointerevents: { | ||
options: { | ||
configFile: 'karma.conf.js', | ||
keepalive: true | ||
preserveComments: 'some' | ||
}, | ||
pointerevents: { | ||
}, | ||
buildbot: { | ||
reporters: 'crbot', | ||
logLevel: 'OFF' | ||
} | ||
nonull: true, | ||
dest: 'dist/PEP.min.js', | ||
src: 'dist/PEP.js' | ||
} | ||
}); | ||
}, | ||
karma: { | ||
options: { | ||
configFile: 'karma.conf.js', | ||
keepalive: true | ||
}, | ||
pointerevents: { | ||
}, | ||
buildbot: { | ||
reporters: 'crbot', | ||
logLevel: 'OFF' | ||
} | ||
} | ||
}); | ||
|
||
grunt.registerTask('build', function() { | ||
var esperanto = require('esperanto'); | ||
var done = this.async(); | ||
|
||
grunt.log.write('Building PEP...'); | ||
esperanto.bundle({ | ||
base: 'src', | ||
entry: '../pointerevents.js' | ||
}).then(function (bundle) { | ||
var umd = bundle.toUmd({ | ||
name: 'PointerEventsPolyfill' | ||
}); | ||
grunt.file.write('dist/PEP.js', header + umd.code); | ||
}).then( | ||
function() { | ||
grunt.log.ok(); | ||
done(); | ||
}, | ||
function(error) { | ||
grunt.log.error(); | ||
done(error); | ||
} | ||
); | ||
}); | ||
|
||
grunt.registerTask('default', ['build', 'uglify']); | ||
grunt.registerTask('test', ['override-chrome-launcher', 'karma:pointerevents']); | ||
grunt.registerTask('test-buildbot', ['override-chrome-launcher', 'karma:buildbot']); | ||
|
||
grunt.registerTask('default', ['concat', 'uglify']); | ||
grunt.registerTask('test', ['override-chrome-launcher', 'karma:pointerevents']); | ||
grunt.registerTask('test-buildbot', ['override-chrome-launcher', 'karma:buildbot']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
{ | ||
"name": "PEP", | ||
"main": "pointerevents.js", | ||
"main": "dist/PEP.js", | ||
"homepage": "https://github.com/jquery/PEP", | ||
"authors": [ | ||
"jQuery Foundation and other contributors" | ||
], | ||
"description": "PointerEvents Polyfill: a unified event system for the web platform", | ||
"description": "Polyfill of the PointerEvents W3C spec", | ||
"keywords": [ | ||
"PointerEvents" | ||
], | ||
"license": "MIT", | ||
"private": true, | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,20 @@ | ||
/*! | ||
* Copyright jQuery Foundation and other contributors | ||
* Released under the MIT license. | ||
* http://jquery.org/license | ||
*/ | ||
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'; | ||
|
||
(function() { | ||
var thisFile = 'pointerevents.js'; | ||
var scopeName = 'PointerEventsPolyfill'; | ||
var modules = [ | ||
'src/boot.js', | ||
'src/touch-action.js', | ||
'src/PointerEvent.js', | ||
'src/pointermap.js', | ||
'src/dispatcher.js', | ||
'src/installer.js', | ||
'src/mouse.js', | ||
'src/touch.js', | ||
'src/ms.js', | ||
'src/platform-events.js', | ||
'src/capture.js' | ||
]; | ||
applyAttributeStyles(); | ||
applyPointerEventPolyfill(); | ||
applyCapturePolyfill(); | ||
|
||
window[scopeName] = { | ||
entryPointName: thisFile, | ||
modules: modules | ||
}; | ||
|
||
var script = document.querySelector('script[src $= "' + thisFile + '"]'); | ||
var src = script.attributes.src.value; | ||
var basePath = src.slice(0, src.indexOf(thisFile)); | ||
|
||
modules.forEach(function( module ) { | ||
document.write('<script src="' + basePath + module + '"></script>'); | ||
}); | ||
|
||
})(); | ||
export default { | ||
dispatcher: dispatcher, | ||
Installer: Installer, | ||
PointerEvent: PointerEvent, | ||
PointerMap: PointerMap, | ||
targetFinding: targeting | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.