split externs

This commit is contained in:
Daniel Freedman 2017-01-18 15:26:59 -08:00
parent d6b8b89898
commit e1ad25200c
4 changed files with 89 additions and 67 deletions

View File

@ -1,15 +1,11 @@
/**
* @fileoverview Externs for Polymer, polyfills, and missing stuff in Closure Compiler
* @fileoverview Externs to upstream to closure compiler
* @externs
* */
/* externs to upstream to closure compiler */
/**
* @record
*/
/** @record */
function CustomElement(){}
/** @type {!Array<string> | undefined} */
/** @type {!Array<string>|undefined} */
CustomElement.observedAttributes;
/** @type {function()|undefined} */
CustomElement.prototype.connectedCallback;
@ -75,61 +71,4 @@ const customElements = {
*/
whenDefined(tagName){}
}
window.customElements = customElements;
/* externs to include in webcomponents polyfills */
/**
* @constructor
* @extends {HTMLElement}
*/
function CustomStyle(){}
/**
* @param {!HTMLStyleElement} style
*/
CustomStyle.prototype.processHook = function(style){};
let HTMLImports = {
/**
* @param {function()} callback
*/
whenReady(callback){}
};
window.HTMLImports = HTMLImports;
let ShadyCSS = {
applyStyle(){},
updateStyles(){},
prepareTemplate(){},
nativeCss: false,
nativeCssApply: false,
nativeShadow: false
};
window.ShadyCSS = ShadyCSS;
let ShadyDOM = {
inUse: false,
flush(){},
observeChildren(){},
unobserveChildren(){},
patch(){}
};
window.ShadyDOM = ShadyDOM;
let WebComponents = {};
window.WebComponents = WebComponents;
/** @type {Element} */
HTMLElement.prototype._activeElement;
/**
* @param {HTMLTemplateElement} template
*/
HTMLTemplateElement.prototype.decorate = function(template){};
/**
* @param {!{is: string}} init
* @return {!CustomElement}
*/
function Polymer(init){}
window.customElements = customElements;

View File

@ -0,0 +1,10 @@
/**
* @fileoverview Externs for Polymer
* @externs
*/
/**
* @param {!{is: string}} init
* @return {!CustomElement}
*/
function Polymer(init){}

View File

@ -0,0 +1,73 @@
/**
* @fileoverview Externs for webcomponents polyfills
* @externs
*/
/**
* @constructor
* @extends {HTMLElement}
*/
function CustomStyle(){}
/**
* @param {!HTMLStyleElement} style
*/
CustomStyle.prototype.processHook = function(style){};
let HTMLImports = {
/**
* @param {function()} callback
*/
whenReady(callback){}
};
window.HTMLImports = HTMLImports;
let ShadyCSS = {
/**
* @param {!HTMLElement} element
* @param {Object=} overrides
*/
applyStyle(element, overrides){},
updateStyles(){},
/**
* @param {!HTMLTemplateElement} template
* @param {string} is
* @param {string=} extends
*/
prepareTemplate(template, is, extends){},
nativeCss: false,
nativeShadow: false
};
window.ShadyCSS = ShadyCSS;
let ShadyDOM = {
inUse: false,
flush(){},
/**
* @param {!Node} target
* @param {function(Array<MutationRecords>, MutationObserver)} callback
* @return {MutationObserver}
*/
observeChildren(target, callback){},
/**
* @param {MutationObserver} observer
*/
unobserveChildren(observer){},
/**
* @param {Node} node
*/
patch(node){}
};
window.ShadyDOM = ShadyDOM;
let WebComponents = {};
window.WebComponents = WebComponents;
/** @type {Element} */
HTMLElement.prototype._activeElement;
/**
* @param {HTMLTemplateElement} template
*/
HTMLTemplateElement.prototype.decorate = function(template){};

View File

@ -89,7 +89,7 @@ gulp.task('closure', ['clean'], () => {
warning_level: 'VERBOSE',
output_wrapper: '(function(){\n%output%\n}).call(self)',
rewrite_polyfills: false,
externs: 'externs/externs.js'
externs: ['externs/closure-upstream-externs.js', 'externs/webcomponents-externs.js', 'externs/polymer-externs.js']
});
const closurePipeline = lazypipe()