diff --git a/gulpfile.js b/gulpfile.js index 769c665..7e0f75d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -28,12 +28,12 @@ function debugify(sourceName, fileName, needsContext) { if (!fileName) fileName = sourceName; - var options = { - entry: './entrypoints/' + sourceName + '-index.js', + const options = { + entry: `./entrypoints/${sourceName}-index.js`, format: 'iife', moduleName: 'webcomponentsjs', sourceMap: true - } + }; // The es6-promise polyfill needs to set the correct context. // See https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined @@ -42,11 +42,8 @@ function debugify(sourceName, fileName, needsContext) { } return rollup(options) - .pipe(source(sourceName +'-index.js')) - .pipe(buffer()) - .pipe(sourcemaps.init({loadMaps: true})) + .pipe(source(`${sourceName}-index.js`), 'entrypoints') .pipe(rename(fileName + '.js')) - .pipe(sourcemaps.write('.')) .pipe(gulp.dest('./')) } @@ -160,36 +157,32 @@ gulp.task('refresh-bower', () => { }); }); -gulp.task('webcomponents-debug', () => { - return rollup({ - entry: './entrypoints/webcomponents-hi-sd-ce-pf-index.js', - format: 'iife', - moduleName: 'webcomponentsjs', - context: 'window' - }) - .pipe(source('webcomponents-hi-sd-ce-pf-index.js', 'entrypoints')) - .pipe(rename('webcomponents-debug.js')) - .pipe(gulp.dest('.')) -}); - gulp.task('default', (cb) => { - runseq('refresh-bower', ['webcomponents-debug', 'closure'], cb); + runseq('refresh-bower', 'closure', cb); }); -gulp.task('debug', [ +gulp.task('clean-builds', () => { + return del(['webcomponents*.js{,.map}', '!webcomponents-loader.js']); +}) + +gulp.task('debug', (cb) => { + const tasks = [ 'debugify-hi', 'debugify-hi-ce', 'debugify-hi-sd-ce', 'debugify-hi-sd-ce-pf', 'debugify-sd-ce' - ]); + ]; + runseq('clean-builds', tasks, cb); +}); gulp.task('closure', (cb) => { - runseq(...[ - 'closurify-hi', - 'closurify-hi-ce', - 'closurify-hi-sd-ce', - 'closurify-hi-sd-ce-pf', - 'closurify-sd-ce' - ], cb); + const tasks = [ + 'closurify-hi', + 'closurify-hi-ce', + 'closurify-hi-sd-ce', + 'closurify-hi-sd-ce-pf', + 'closurify-sd-ce' + ]; + runseq('clean-builds', ...tasks, cb); }); \ No newline at end of file diff --git a/webcomponents-debug.js b/webcomponents-debug.js deleted file mode 100644 index 24a2fdf..0000000 --- a/webcomponents-debug.js +++ /dev/null @@ -1,8532 +0,0 @@ -(function () { -'use strict'; - -/** - * @license - * Copyright (c) 2016 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt - */ - -(function(scope) { - - 'use strict'; - - // defaultPrevented is broken in IE. - // https://connect.microsoft.com/IE/feedback/details/790389/event-defaultprevented-returns-false-after-preventdefault-was-called - var workingDefaultPrevented = (function() { - var e = document.createEvent('Event'); - e.initEvent('foo', true, true); - e.preventDefault(); - return e.defaultPrevented; - })(); - - if (!workingDefaultPrevented) { - var origPreventDefault = Event.prototype.preventDefault; - Event.prototype.preventDefault = function() { - if (!this.cancelable) { - return; - } - - origPreventDefault.call(this); - - Object.defineProperty(this, 'defaultPrevented', { - get: function() { - return true; - }, - configurable: true - }); - }; - } - - var isIE = /Trident/.test(navigator.userAgent); - - // CustomEvent constructor shim - if (!window.CustomEvent || isIE && (typeof window.CustomEvent !== 'function')) { - window.CustomEvent = function(inType, params) { - params = params || {}; - var e = document.createEvent('CustomEvent'); - e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail); - return e; - }; - window.CustomEvent.prototype = window.Event.prototype; - } - - // Event constructor shim - if (!window.Event || isIE && (typeof window.Event !== 'function')) { - var origEvent = window.Event; - window.Event = function(inType, params) { - params = params || {}; - var e = document.createEvent('Event'); - e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable)); - return e; - }; - if (origEvent) { - for (var i in origEvent) { - window.Event[i] = origEvent[i]; - } - } - window.Event.prototype = origEvent.prototype; - } - - if (!window.MouseEvent || isIE && (typeof window.MouseEvent !== 'function')) { - var origMouseEvent = window.MouseEvent; - window.MouseEvent = function(inType, params) { - params = params || {}; - var e = document.createEvent('MouseEvent'); - e.initMouseEvent(inType, - Boolean(params.bubbles), Boolean(params.cancelable), - params.view || window, params.detail, - params.screenX, params.screenY, params.clientX, params.clientY, - params.ctrlKey, params.altKey, params.shiftKey, params.metaKey, - params.button, params.relatedTarget); - return e; - }; - if (origMouseEvent) { - for (var i in origMouseEvent) { - window.MouseEvent[i] = origMouseEvent[i]; - } - } - window.MouseEvent.prototype = origMouseEvent.prototype; - } - - // ES6 stuff - if (!Array.from) { - Array.from = function (object) { - return [].slice.call(object); - }; - } - - if (!Object.assign) { - var assign = function(target, source) { - var n$ = Object.getOwnPropertyNames(source); - for (var i=0, p; i < n$.length; i++) { - p = n$[i]; - target[p] = source[p]; - } - }; - - Object.assign = function(target, sources) { - var args = [].slice.call(arguments, 1); - for (var i=0, s; i < args.length; i++) { - s = args[i]; - if (s) { - assign(target, s); - } - } - return target; - }; - } - -})(window.WebComponents); - -/** - * @license - * Copyright (c) 2016 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt - */ - -// minimal template polyfill -(function() { - - var needsTemplate = (typeof HTMLTemplateElement === 'undefined'); - - // NOTE: Patch document.importNode to work around IE11 bug that - // casues children of a document fragment imported while - // there is a mutation observer to not have a parentNode (!?!) - // It's important that this is the first patch to `importNode` so that - // dom produced for later patches is correct. - if (/Trident/.test(navigator.userAgent)) { - (function() { - var Native_importNode = Document.prototype.importNode; - Document.prototype.importNode = function() { - var n = Native_importNode.apply(this, arguments); - // Copy all children to a new document fragment since - // this one may be broken - if (n.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { - var f = this.createDocumentFragment(); - f.appendChild(n); - return f; - } else { - return n; - } - }; - })(); - } - - // NOTE: we rely on this cloneNode not causing element upgrade. - // This means this polyfill must load before the CE polyfill and - // this would need to be re-worked if a browser supports native CE - // but not