From 05a7972ba001e8898a1b753666e5fe5fd3c6e10c Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Tue, 18 Sep 2018 18:33:01 +0100 Subject: [PATCH 1/5] Update gen-closure-declarations to 0.5.0 This fixes the externs generation for our modules --- externs/closure-types.js | 107 ++++++++++++++++++++++++++------------- package-lock.json | 88 ++++++++++++-------------------- package.json | 2 +- 3 files changed, 105 insertions(+), 92 deletions(-) diff --git a/externs/closure-types.js b/externs/closure-types.js index bc57da9291..69c1810c6e 100644 --- a/externs/closure-types.js +++ b/externs/closure-types.js @@ -16,6 +16,7 @@ */ function Polymer_PropertiesChanged(){} /** +* @override * @param {string} property Name of the property * @param {boolean=} readOnly When true, no setter is created; the protected `_setProperty` function must be used to set the property @@ -23,41 +24,50 @@ function Polymer_PropertiesChanged(){} */ Polymer_PropertiesChanged.prototype._createPropertyAccessor = function(property, readOnly){}; /** +* @override * @param {string} property Name of the property +* @return {void} */ Polymer_PropertiesChanged.prototype._addPropertyToAttributeMap = function(property){}; /** +* @override * @param {string} property Name of the property * @param {boolean=} readOnly When true, no setter is created * @return {void} */ Polymer_PropertiesChanged.prototype._definePropertyAccessor = function(property, readOnly){}; /** +* @override * @return {void} */ Polymer_PropertiesChanged.prototype.ready = function(){}; /** +* @override * @return {void} */ Polymer_PropertiesChanged.prototype._initializeProperties = function(){}; /** +* @override * @param {Object} props Bag of property values that were overwritten when creating property accessors. * @return {void} */ Polymer_PropertiesChanged.prototype._initializeInstanceProperties = function(props){}; /** +* @override * @param {string} property Name of the property * @param {*} value Value to set * @return {void} */ Polymer_PropertiesChanged.prototype._setProperty = function(property, value){}; /** +* @override * @param {string} property Name of property * @return {*} */ Polymer_PropertiesChanged.prototype._getProperty = function(property){}; /** +* @override * @param {string} property Name of the property * @param {*} value Value to set * @param {boolean=} ext Not used here; affordance for closure @@ -65,36 +75,42 @@ Polymer_PropertiesChanged.prototype._getProperty = function(property){}; */ Polymer_PropertiesChanged.prototype._setPendingProperty = function(property, value, ext){}; /** +* @override * @return {void} */ Polymer_PropertiesChanged.prototype._invalidateProperties = function(){}; /** +* @override * @return {void} */ Polymer_PropertiesChanged.prototype._enableProperties = function(){}; /** +* @override * @return {void} */ Polymer_PropertiesChanged.prototype._flushProperties = function(){}; /** +* @override * @param {!Object} currentProps Bag of all current accessor values -* @param {!Object} changedProps Bag of properties changed since the last +* @param {?Object} changedProps Bag of properties changed since the last call to `_propertiesChanged` -* @param {!Object} oldProps Bag of previous values for each property +* @param {?Object} oldProps Bag of previous values for each property in `changedProps` * @return {boolean} */ Polymer_PropertiesChanged.prototype._shouldPropertiesChange = function(currentProps, changedProps, oldProps){}; /** +* @override * @param {!Object} currentProps Bag of all current accessor values -* @param {!Object} changedProps Bag of properties changed since the last +* @param {?Object} changedProps Bag of properties changed since the last call to `_propertiesChanged` -* @param {!Object} oldProps Bag of previous values for each property +* @param {?Object} oldProps Bag of previous values for each property in `changedProps` * @return {void} */ Polymer_PropertiesChanged.prototype._propertiesChanged = function(currentProps, changedProps, oldProps){}; /** +* @override * @param {string} property Property name * @param {*} value New property value * @param {*} old Previous property value @@ -102,14 +118,16 @@ Polymer_PropertiesChanged.prototype._propertiesChanged = function(currentProps, */ Polymer_PropertiesChanged.prototype._shouldPropertyChange = function(property, value, old){}; /** +* @override * @param {string} name Name of attribute that changed * @param {?string} old Old attribute value * @param {?string} value New attribute value -* @param {?string} namespace Namespace of the attribute +* @param {?string} namespace Attribute namespace. * @return {void} */ Polymer_PropertiesChanged.prototype.attributeChangedCallback = function(name, old, value, namespace){}; /** +* @override * @param {string} attribute Name of attribute to deserialize. * @param {?string} value of the attribute. * @param {*=} type type to deserialize to, defaults to the value @@ -118,6 +136,7 @@ returned from `typeForProperty` */ Polymer_PropertiesChanged.prototype._attributeToProperty = function(attribute, value, type){}; /** +* @override * @param {string} property Property name to reflect. * @param {string=} attribute Attribute name to reflect to. * @param {*=} value Property value to refect. @@ -125,6 +144,7 @@ Polymer_PropertiesChanged.prototype._attributeToProperty = function(attribute, v */ Polymer_PropertiesChanged.prototype._propertyToAttribute = function(property, attribute, value){}; /** +* @override * @param {Element} node Element to set attribute to. * @param {*} value Value to serialize. * @param {string} attribute Attribute name to serialize to. @@ -132,11 +152,13 @@ Polymer_PropertiesChanged.prototype._propertyToAttribute = function(property, at */ Polymer_PropertiesChanged.prototype._valueToNodeAttribute = function(node, value, attribute){}; /** +* @override * @param {*} value Property value to serialize. * @return {(string | undefined)} */ Polymer_PropertiesChanged.prototype._serializeValue = function(value){}; /** +* @override * @param {?string} value Value to deserialize. * @param {*=} type Type to deserialize the string to. * @return {*} @@ -154,6 +176,7 @@ Polymer_PropertiesChanged.createProperties = function(props){}; Polymer_PropertiesChanged.attributeNameForProperty = function(property){}; /** * @param {string} name Name of property +* @return {void} */ Polymer_PropertiesChanged.typeForProperty = function(name){}; /** @@ -225,12 +248,14 @@ Polymer_PropertyAccessors.createPropertiesForAttributes = function(){}; */ function Polymer_TemplateStamp(){} /** +* @override * @param {!HTMLTemplateElement} template Template to stamp * @return {!StampedTemplate} */ Polymer_TemplateStamp.prototype._stampTemplate = function(template){}; /** -* @param {!Node} node Node to add listener on +* @override +* @param {!EventTarget} node Node to add listener on * @param {string} eventName Name of event * @param {string} methodName Name of method * @param {*=} context Context the method will be called on (defaults @@ -239,14 +264,16 @@ Polymer_TemplateStamp.prototype._stampTemplate = function(template){}; */ Polymer_TemplateStamp.prototype._addMethodEventListenerToNode = function(node, eventName, methodName, context){}; /** -* @param {!Node} node Node to add event listener to +* @override +* @param {!EventTarget} node Node to add event listener to * @param {string} eventName Name of event * @param {function (!Event): void} handler Listener function to add * @return {void} */ Polymer_TemplateStamp.prototype._addEventListenerToNode = function(node, eventName, handler){}; /** -* @param {!Node} node Node to remove event listener from +* @override +* @param {!EventTarget} node Node to remove event listener from * @param {string} eventName Name of event * @param {function (!Event): void} handler Listener function to remove * @return {void} @@ -260,9 +287,9 @@ Polymer_TemplateStamp.prototype._removeEventListenerFromNode = function(node, ev */ Polymer_TemplateStamp._parseTemplate = function(template, outerTemplateInfo){}; /** -* @param {*} template -* @param {*} templateInfo -* @param {*} nodeInfo +* @param {*} template +* @param {*} templateInfo +* @param {*} nodeInfo */ Polymer_TemplateStamp._parseTemplateContent = function(template, templateInfo, nodeInfo){}; /** @@ -371,6 +398,9 @@ Polymer_PropertyEffects.prototype.__readOnly; /** @type {!TemplateInfo} */ Polymer_PropertyEffects.prototype.__templateInfo; +/** @type {undefined} */ +Polymer_PropertyEffects.prototype.PROPERTY_EFFECT_TYPES; + /** * @override * @param {!HTMLTemplateElement} template Template to stamp @@ -419,9 +449,9 @@ Polymer_PropertyEffects.prototype._invalidateProperties = function(){}; Polymer_PropertyEffects.prototype._flushProperties = function(){}; /** * @param {!Object} currentProps Bag of all current accessor values -* @param {!Object} changedProps Bag of properties changed since the last +* @param {?Object} changedProps Bag of properties changed since the last call to `_propertiesChanged` -* @param {!Object} oldProps Bag of previous values for each property +* @param {?Object} oldProps Bag of previous values for each property in `changedProps` * @return {void} */ @@ -760,7 +790,7 @@ Polymer_PropertyEffects._addTemplatePropertyEffect = function(templateInfo, prop */ Polymer_PropertyEffects._parseBindings = function(text, templateInfo){}; /** -* @param {Element} inst Element that should be used as scope for +* @param {this} inst Element that should be used as scope for binding dependencies * @param {BindingPart} part Binding part metadata * @param {string} path Property/path that triggered this effect @@ -781,10 +811,12 @@ function Polymer_PropertiesMixin(){} */ Polymer_PropertiesMixin.prototype._initializeProperties = function(){}; /** +* @override * @return {void} */ Polymer_PropertiesMixin.prototype.connectedCallback = function(){}; /** +* @override * @return {void} */ Polymer_PropertiesMixin.prototype.disconnectedCallback = function(){}; @@ -798,7 +830,7 @@ Polymer_PropertiesMixin.typeForProperty = function(name){}; */ Polymer_PropertiesMixin.finalize = function(){}; /** -* @return {undefined} +* @return {void} */ Polymer_PropertiesMixin._finalizeClass = function(){}; /** @@ -901,14 +933,16 @@ Polymer_ElementMixin._finalizeTemplate = function(is){}; */ function Polymer_GestureEventListeners(){} /** -* @param {!Node} node Node to add event listener to +* @override +* @param {!EventTarget} node Node to add event listener to * @param {string} eventName Name of event * @param {function (!Event): void} handler Listener function to add * @return {void} */ Polymer_GestureEventListeners.prototype._addEventListenerToNode = function(node, eventName, handler){}; /** -* @param {!Node} node Node to remove event listener from +* @override +* @param {!EventTarget} node Node to remove event listener from * @param {string} eventName Name of event * @param {function (!Event): void} handler Listener function to remove * @return {void} @@ -958,6 +992,9 @@ Polymer_LegacyElementMixin.prototype.__boundListeners; /** @type {Object.} */ Polymer_LegacyElementMixin.prototype._debouncers; +/** @type {undefined} */ +Polymer_LegacyElementMixin.prototype.domHost; + /** * @override * @return {void} @@ -973,7 +1010,7 @@ Polymer_LegacyElementMixin.prototype._initializeProperties = function(){}; * @param {string} name Name of attribute. * @param {?string} old Old value of attribute. * @param {?string} value Current value of attribute. -* @param {?string} namespace Namespace of the attribute +* @param {?string} namespace Attribute namespace. * @return {void} */ Polymer_LegacyElementMixin.prototype.attributeChangedCallback = function(name, old, value, namespace){}; @@ -1089,7 +1126,7 @@ Polymer_LegacyElementMixin.prototype.listen = function(node, eventName, methodNa * @param {Element} node Element to remove event listener from. * @param {string} eventName Name of event to stop listening to. * @param {string} methodName Name of handler method on `this` to not call - anymore. + anymore. * @return {void} */ Polymer_LegacyElementMixin.prototype.unlisten = function(node, eventName, methodName){}; @@ -1174,7 +1211,7 @@ Polymer_LegacyElementMixin.prototype.getComputedStyleValue = function(property){ * @param {string} jobName String to identify the debounce job. * @param {function (): void} callback Function that is called (with `this` context) when the wait time elapses. -* @param {number=} wait Optional wait time in milliseconds (ms) after the +* @param {number} wait Optional wait time in milliseconds (ms) after the last signal that must elapse before invoking `callback` * @return {!Object} */ @@ -1216,17 +1253,6 @@ Polymer_LegacyElementMixin.prototype.cancelAsync = function(handle){}; */ Polymer_LegacyElementMixin.prototype.create = function(tag, props){}; /** -* @param {string} href URL to document to load. -* @param {?function (!Event): void=} onload Callback to notify when an import successfully - loaded. -* @param {?function (!ErrorEvent): void=} onerror Callback to notify when an import - unsuccessfully loaded. -* @param {boolean=} optAsync True if the import should be loaded `async`. - Defaults to `false`. -* @return {!HTMLLinkElement} -*/ -Polymer_LegacyElementMixin.prototype.importHref = function(href, onload, onerror, optAsync){}; -/** * @param {string} selector Selector to test. * @param {!Element=} node Element to test the selector against. * @return {boolean} @@ -1313,7 +1339,7 @@ Polymer_MutableData.prototype._shouldPropertyChange = function(property, value, * @interface */ function Polymer_OptionalMutableData(){} -/** @type {boolean} */ +/** @type {boolean | null | undefined} */ Polymer_OptionalMutableData.prototype.mutableData; /** @@ -1328,10 +1354,10 @@ Polymer_OptionalMutableData.prototype._shouldPropertyChange = function(property, * @extends {Polymer_ElementMixin} */ function Polymer_ArraySelectorMixin(){} -/** @type {Array} */ +/** @type {Array | null | undefined} */ Polymer_ArraySelectorMixin.prototype.items; -/** @type {boolean} */ +/** @type {boolean | null | undefined} */ Polymer_ArraySelectorMixin.prototype.multi; /** @type {?(Object | Array.)} */ @@ -1340,7 +1366,7 @@ Polymer_ArraySelectorMixin.prototype.selected; /** @type {?Object} */ Polymer_ArraySelectorMixin.prototype.selectedItem; -/** @type {boolean} */ +/** @type {boolean | null | undefined} */ Polymer_ArraySelectorMixin.prototype.toggle; /** @@ -1395,21 +1421,30 @@ Polymer_StrictBindingParser._parseBindings = function(text, templateInfo){}; function Polymer_DisableUpgradeMixin(){} /** * @override +* @return {void} */ Polymer_DisableUpgradeMixin.prototype._initializeProperties = function(){}; /** * @override +* @return {void} */ Polymer_DisableUpgradeMixin.prototype._enableProperties = function(){}; /** * @override +* @return {void} */ -Polymer_DisableUpgradeMixin.prototype.attributeChangedCallback = function(name, old, value){}; +Polymer_DisableUpgradeMixin.prototype.attributeChangedCallback = function(name, old, value, namespace){}; /** * @override +* @return {void} */ Polymer_DisableUpgradeMixin.prototype.connectedCallback = function(){}; /** * @override +* @return {void} */ Polymer_DisableUpgradeMixin.prototype.disconnectedCallback = function(){}; +/** +* @interface +*/ +function Polymer_LegacyDataMixin(){} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 6dd8408ecf..7e1d7c761f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1028,13 +1028,13 @@ "dev": true }, "@polymer/gen-closure-declarations": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@polymer/gen-closure-declarations/-/gen-closure-declarations-0.4.0.tgz", - "integrity": "sha512-gRDYxL/2nko1dJDIS+l+nc7BBzIz4x5LF+X+fskXcoiH+2A4PdCBeQXbCSpq9Dne5iig6MIr7GaK+Z3Y+5STCA==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@polymer/gen-closure-declarations/-/gen-closure-declarations-0.5.0.tgz", + "integrity": "sha512-wZiwqhgKZcOzsraHzAZfdUs7FCszjG0lvMJ7GuDn6Wa77c7naQT8tx5KWtnGm5WC9WRc/XYg+fhqIjI+RVZJqg==", "dev": true, "requires": { - "escodegen": "^1.9.0", - "polymer-analyzer": "^2.3.0" + "escodegen": "^1.11.0", + "polymer-analyzer": "^3.1.2" } }, "@polymer/gen-typescript-declarations": { @@ -1541,21 +1541,6 @@ "integrity": "sha1-uZny2fe0PKvgoaLzm8IDvH3K2p0=", "dev": true }, - "@types/escodegen": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/@types/escodegen/-/escodegen-0.0.2.tgz", - "integrity": "sha1-fOpBqyQukQ6xD2WuGK66RZ1ms18=", - "dev": true - }, - "@types/estraverse": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/@types/estraverse/-/estraverse-0.0.6.tgz", - "integrity": "sha1-Zp9833KreX5hJfjQD+0z1M8wwiE=", - "dev": true, - "requires": { - "@types/estree": "*" - } - }, "@types/estree": { "version": "0.0.37", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.37.tgz", @@ -7556,55 +7541,48 @@ } }, "polymer-analyzer": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/polymer-analyzer/-/polymer-analyzer-2.7.0.tgz", - "integrity": "sha512-yD5FYQ8thX/2vHTaEgTtCs/NSG3ko4VlEb0IjM/PFsu03lHNHnpadC1NGwKyvI9vOjcFhnw4mDEVW0lbxLo8Eg==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/polymer-analyzer/-/polymer-analyzer-3.1.2.tgz", + "integrity": "sha512-qAGdrrI9fknJurrMMG/vx4CioOdxr0WeQB0CNcB7jZhIuophJn5igqXti9JwTLVBAEIB17DJnsce5A4xFQDryQ==", "dev": true, "requires": { + "@babel/generator": "^7.0.0-beta.42", + "@babel/traverse": "^7.0.0-beta.42", + "@babel/types": "^7.0.0-beta.42", + "@types/babel-generator": "^6.25.1", + "@types/babel-traverse": "^6.25.2", + "@types/babel-types": "^6.25.1", + "@types/babylon": "^6.16.2", "@types/chai-subset": "^1.3.0", "@types/chalk": "^0.4.30", "@types/clone": "^0.1.30", "@types/cssbeautify": "^0.3.1", "@types/doctrine": "^0.0.1", - "@types/escodegen": "^0.0.2", - "@types/estraverse": "^0.0.6", - "@types/estree": "^0.0.37", - "@types/node": "^6.0.0", + "@types/is-windows": "^0.2.0", + "@types/minimatch": "^3.0.1", "@types/parse5": "^2.2.34", + "@types/path-is-inside": "^1.0.0", + "@types/resolve": "0.0.6", + "@types/whatwg-url": "^6.4.0", + "babylon": "^7.0.0-beta.42", + "cancel-token": "^0.1.1", "chalk": "^1.1.3", "clone": "^2.0.0", "cssbeautify": "^0.3.1", - "doctrine": "^2.0.0", - "dom5": "^2.1.0", - "escodegen": "^1.7.0", - "espree": "^3.1.7", - "estraverse": "^4.2.0", + "doctrine": "^2.0.2", + "dom5": "^3.0.0", + "indent": "0.0.2", + "is-windows": "^1.0.2", "jsonschema": "^1.1.0", - "parse5": "^2.2.1", + "minimatch": "^3.0.4", + "parse5": "^4.0.0", + "path-is-inside": "^1.0.2", + "resolve": "^1.5.0", "shady-css-parser": "^0.1.0", "stable": "^0.1.6", - "strip-indent": "^2.0.0" - }, - "dependencies": { - "dom5": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/dom5/-/dom5-2.3.0.tgz", - "integrity": "sha1-+CBJdb0NrLvltYqKk//B/tD/zSo=", - "dev": true, - "requires": { - "@types/clone": "^0.1.29", - "@types/node": "^6.0.0", - "@types/parse5": "^2.2.32", - "clone": "^2.1.0", - "parse5": "^2.2.2" - } - }, - "parse5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-2.2.3.tgz", - "integrity": "sha1-DE/EHBAAxea5PUiwP4CDg3g06fY=", - "dev": true - } + "strip-indent": "^2.0.0", + "vscode-uri": "^1.0.1", + "whatwg-url": "^6.4.0" } }, "polymer-build": { diff --git a/package.json b/package.json index a7955aeb9c..1cb04a91b5 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "test": "test" }, "devDependencies": { - "@polymer/gen-closure-declarations": "^0.4.0", + "@polymer/gen-closure-declarations": "^0.5.0", "@polymer/gen-typescript-declarations": "^1.5.0", "@polymer/iron-component-page": "^3.0.0-pre.12", "@polymer/test-fixture": "^3.0.0-pre.12", From 777b5c7aebc7fabc602a47df934d784e1f29b325 Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Tue, 18 Sep 2018 18:37:10 +0100 Subject: [PATCH 2/5] Generate closure types before publishing --- externs/.gitignore | 1 + externs/polymer-externs.js | 183 ------------------------------------- package.json | 2 +- 3 files changed, 2 insertions(+), 184 deletions(-) delete mode 100644 externs/polymer-externs.js diff --git a/externs/.gitignore b/externs/.gitignore index 33522114ba..6233b5b960 100644 --- a/externs/.gitignore +++ b/externs/.gitignore @@ -2,3 +2,4 @@ # * !.gitignore !.npmignore +closure-types.js diff --git a/externs/polymer-externs.js b/externs/polymer-externs.js deleted file mode 100644 index 7c0ede16aa..0000000000 --- a/externs/polymer-externs.js +++ /dev/null @@ -1,183 +0,0 @@ -/** - * @fileoverview Externs for Polymer Pass and external Polymer API - * @externs - * - * @license - * Copyright (c) 2017 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 - */ - -/* eslint-disable */ - -/** - * @typedef {{ - * type: !Function, - * value: (* | undefined), - * readOnly: (boolean | undefined), - * computed: (string | undefined), - * reflectToAttribute: (boolean | undefined), - * notify: (boolean | undefined), - * observer: (string | function(this:?, ?, ?) | undefined) - * }} - */ -let PolymerElementPropertiesMeta; - -/** - * @typedef {Object} - */ -let PolymerElementProperties; - -/** @record */ -let PolymerInit = function() {}; -/** @type {string} */ -PolymerInit.prototype.is; -/** @type {(string | undefined)} */ -PolymerInit.prototype.extends; -/** @type {(!PolymerElementProperties | undefined)} */ -PolymerInit.prototype.properties; -/** @type {(!Array | undefined)} */ -PolymerInit.prototype.observers; -/** @type {(!HTMLTemplateElement | string | undefined)} */ -PolymerInit.prototype.template; -/** @type {(!Object | undefined)} */ -PolymerInit.prototype.hostAttributes; -/** @type {(!Object | undefined)} */ -PolymerInit.prototype.listeners; - -let PolymerElementConstructor = function () {}; -/** @type {(string | undefined)} */ -PolymerElementConstructor.is; -/** @type {(string | undefined)} */ -PolymerElementConstructor.extends; -/** @type {(!PolymerElementProperties | undefined)} */ -PolymerElementConstructor.properties; -/** @type {(!Array | undefined)} */ -PolymerElementConstructor.observers; -/** @type {(!HTMLTemplateElement | string | undefined)} */ -PolymerElementConstructor.template; - -/** @interface */ -let PropertiesMixinConstructor = function () {}; -/** @type {(!PolymerElementProperties | undefined)} */ -PropertiesMixinConstructor.prototype.properties; -/** @return {void} */ -PropertiesMixinConstructor.prototype.finalize = function() {}; - -/** - * @param {!PolymerInit} init - * @return {!function(new:HTMLElement)} - */ -function Polymer(init){} - -/** - * @type {(function(*,string,string,Node):*)|undefined} - */ -Polymer.sanitizeDOMValue; - -/** - * @param {string} string - * @param {Object} obj - * @return {string} - */ -function JSCompiler_renameProperty(string, obj) {} - -/** @record */ -function PolymerTelemetry() {} -/** @type {number} */ -PolymerTelemetry.instanceCount; -/** @type {Array} */ -PolymerTelemetry.registrations; -/** @type {function(HTMLElement)} */ -PolymerTelemetry._regLog; -/** @type {function(HTMLElement)} */ -PolymerTelemetry.register; -/** @type {function(HTMLElement)} */ -PolymerTelemetry.dumpRegistrations; - -/** @type {PolymerTelemetry} */ -Polymer.telemetry; - -/** @type {string} */ -Polymer.version; - -// nb. This is explicitly 'var', as Closure Compiler checks that this is the case. -/** - * @constructor - * @extends {HTMLElement} - * @implements {Polymer_LegacyElementMixin} - */ -var PolymerElement = function() {}; - -/** - * On create callback. - * @override - */ -PolymerElement.prototype.created = function() {}; -/** - * On ready callback. - * @override - */ -PolymerElement.prototype.ready = function() {}; -/** On registered callback. */ -PolymerElement.prototype.registered = function() {}; -/** - * On attached to the DOM callback. - * @override - */ -PolymerElement.prototype.attached = function() {}; -/** - * On detached from the DOM callback. - * @override - */ -PolymerElement.prototype.detached = function() {}; - -/** - * @typedef {{ - * index: number, - * removed: !Array, - * addedCount: number, - * object: !Array, - * type: string, - * }} - */ -var PolymerSplice; -/** - * @typedef {{ - * indexSplices: ?Array, - * }} - */ -var PolymerSpliceChange; - -/** - * The type of the object received by an observer function when deep - * sub-property observation is enabled. See: - * https://www.polymer-project.org/2.0/docs/devguide/observers#deep-observation - * - * @typedef {{ - * path: string, - * value: (?Object|undefined), - * base: (?Object|undefined) - * }} - */ -var PolymerDeepPropertyChange; - -/** - * Event object for events dispatched by children of a dom-repeat template. - * @see https://www.polymer-project.org/2.0/docs/devguide/templates#handling-events - * @extends {Event} - * @constructor - * @template T - */ -let DomRepeatEvent = function() {}; - -/** - * @type {{ - * index: number, - * item: T - * }} - */ -DomRepeatEvent.prototype.model; diff --git a/package.json b/package.json index 1cb04a91b5..794542180f 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "test": "npm run lint && polymer test --npm --module-resolution=node", "serve": "polymer serve --npm --module-resolution=node", "lint": "gulp lint", - "generate-types": "gen-typescript-declarations --outDir . --deleteExisting --verify", + "generate-types": "gen-typescript-declarations --outDir . --deleteExisting --verify && gulp generate-externs", "regen-package-lock": "rm -rf node_modules package-lock.json; npm install", "prepack": "npm run generate-types" }, From 18ba3bdedc2a901f0abc62739363b0864d903f6e Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Tue, 18 Sep 2018 18:41:48 +0100 Subject: [PATCH 3/5] Actually remove closure-types.js from git --- externs/closure-types.js | 1450 -------------------------------------- 1 file changed, 1450 deletions(-) delete mode 100644 externs/closure-types.js diff --git a/externs/closure-types.js b/externs/closure-types.js deleted file mode 100644 index 69c1810c6e..0000000000 --- a/externs/closure-types.js +++ /dev/null @@ -1,1450 +0,0 @@ -/** - * @fileoverview Generated typings for Polymer mixins - * @externs - * - * @license - * Copyright (c) 2017 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 - */ -/* eslint-disable */ -/** -* @interface -*/ -function Polymer_PropertiesChanged(){} -/** -* @override -* @param {string} property Name of the property -* @param {boolean=} readOnly When true, no setter is created; the - protected `_setProperty` function must be used to set the property -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._createPropertyAccessor = function(property, readOnly){}; -/** -* @override -* @param {string} property Name of the property -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._addPropertyToAttributeMap = function(property){}; -/** -* @override -* @param {string} property Name of the property -* @param {boolean=} readOnly When true, no setter is created -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._definePropertyAccessor = function(property, readOnly){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertiesChanged.prototype.ready = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._initializeProperties = function(){}; -/** -* @override -* @param {Object} props Bag of property values that were overwritten - when creating property accessors. -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._initializeInstanceProperties = function(props){}; -/** -* @override -* @param {string} property Name of the property -* @param {*} value Value to set -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._setProperty = function(property, value){}; -/** -* @override -* @param {string} property Name of property -* @return {*} -*/ -Polymer_PropertiesChanged.prototype._getProperty = function(property){}; -/** -* @override -* @param {string} property Name of the property -* @param {*} value Value to set -* @param {boolean=} ext Not used here; affordance for closure -* @return {boolean} -*/ -Polymer_PropertiesChanged.prototype._setPendingProperty = function(property, value, ext){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._invalidateProperties = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._enableProperties = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._flushProperties = function(){}; -/** -* @override -* @param {!Object} currentProps Bag of all current accessor values -* @param {?Object} changedProps Bag of properties changed since the last - call to `_propertiesChanged` -* @param {?Object} oldProps Bag of previous values for each property - in `changedProps` -* @return {boolean} -*/ -Polymer_PropertiesChanged.prototype._shouldPropertiesChange = function(currentProps, changedProps, oldProps){}; -/** -* @override -* @param {!Object} currentProps Bag of all current accessor values -* @param {?Object} changedProps Bag of properties changed since the last - call to `_propertiesChanged` -* @param {?Object} oldProps Bag of previous values for each property - in `changedProps` -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._propertiesChanged = function(currentProps, changedProps, oldProps){}; -/** -* @override -* @param {string} property Property name -* @param {*} value New property value -* @param {*} old Previous property value -* @return {boolean} -*/ -Polymer_PropertiesChanged.prototype._shouldPropertyChange = function(property, value, old){}; -/** -* @override -* @param {string} name Name of attribute that changed -* @param {?string} old Old attribute value -* @param {?string} value New attribute value -* @param {?string} namespace Attribute namespace. -* @return {void} -*/ -Polymer_PropertiesChanged.prototype.attributeChangedCallback = function(name, old, value, namespace){}; -/** -* @override -* @param {string} attribute Name of attribute to deserialize. -* @param {?string} value of the attribute. -* @param {*=} type type to deserialize to, defaults to the value -returned from `typeForProperty` -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._attributeToProperty = function(attribute, value, type){}; -/** -* @override -* @param {string} property Property name to reflect. -* @param {string=} attribute Attribute name to reflect to. -* @param {*=} value Property value to refect. -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._propertyToAttribute = function(property, attribute, value){}; -/** -* @override -* @param {Element} node Element to set attribute to. -* @param {*} value Value to serialize. -* @param {string} attribute Attribute name to serialize to. -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._valueToNodeAttribute = function(node, value, attribute){}; -/** -* @override -* @param {*} value Property value to serialize. -* @return {(string | undefined)} -*/ -Polymer_PropertiesChanged.prototype._serializeValue = function(value){}; -/** -* @override -* @param {?string} value Value to deserialize. -* @param {*=} type Type to deserialize the string to. -* @return {*} -*/ -Polymer_PropertiesChanged.prototype._deserializeValue = function(value, type){}; -/** -* @param {!Object} props Object whose keys are names of accessors. -* @return {void} -*/ -Polymer_PropertiesChanged.createProperties = function(props){}; -/** -* @param {string} property Property to convert -* @return {string} -*/ -Polymer_PropertiesChanged.attributeNameForProperty = function(property){}; -/** -* @param {string} name Name of property -* @return {void} -*/ -Polymer_PropertiesChanged.typeForProperty = function(name){}; -/** -* @interface -* @extends {Polymer_PropertiesChanged} -*/ -function Polymer_PropertyAccessors(){} -/** -* @param {string} property Name of the property -* @param {boolean=} readOnly When true, no setter is created - -When calling on a prototype, any overwritten values are saved in -`__dataProto`, and it is up to the subclasser to decide how/when -to set those properties back into the accessor. When calling on an -instance, the overwritten value is set via `_setPendingProperty`, -and the user should call `_invalidateProperties` or `_flushProperties` -for the values to take effect. -* @return {void} -*/ -Polymer_PropertyAccessors.prototype._definePropertyAccessor = function(property, readOnly){}; -/** -* @return {void} -*/ -Polymer_PropertyAccessors.prototype._initializeProperties = function(){}; -/** -* @param {*} value Property value to serialize. -* @return {(string | undefined)} -*/ -Polymer_PropertyAccessors.prototype._serializeValue = function(value){}; -/** -* @param {?string} value Attribute value to deserialize. -* @param {*=} type Type to deserialize the string to. -* @return {*} -*/ -Polymer_PropertyAccessors.prototype._deserializeValue = function(value, type){}; -/** -* @param {Object} props Bag of property values that were overwritten - when creating property accessors. -* @return {void} -*/ -Polymer_PropertyAccessors.prototype._initializeProtoProperties = function(props){}; -/** -* @param {string} attribute Name of attribute to ensure is set. -* @param {string} value of the attribute. -* @return {void} -*/ -Polymer_PropertyAccessors.prototype._ensureAttribute = function(attribute, value){}; -/** -* @param {string} property Property name -* @return {boolean} -*/ -Polymer_PropertyAccessors.prototype._hasAccessor = function(property){}; -/** -* @param {string} prop Property name -* @return {boolean} -*/ -Polymer_PropertyAccessors.prototype._isPropertyPending = function(prop){}; -/** -* @param {string} property Property to convert -* @return {string} -*/ -Polymer_PropertyAccessors.attributeNameForProperty = function(property){}; -/** -* @return {void} -*/ -Polymer_PropertyAccessors.createPropertiesForAttributes = function(){}; -/** -* @interface -*/ -function Polymer_TemplateStamp(){} -/** -* @override -* @param {!HTMLTemplateElement} template Template to stamp -* @return {!StampedTemplate} -*/ -Polymer_TemplateStamp.prototype._stampTemplate = function(template){}; -/** -* @override -* @param {!EventTarget} node Node to add listener on -* @param {string} eventName Name of event -* @param {string} methodName Name of method -* @param {*=} context Context the method will be called on (defaults - to `node`) -* @return {Function} -*/ -Polymer_TemplateStamp.prototype._addMethodEventListenerToNode = function(node, eventName, methodName, context){}; -/** -* @override -* @param {!EventTarget} node Node to add event listener to -* @param {string} eventName Name of event -* @param {function (!Event): void} handler Listener function to add -* @return {void} -*/ -Polymer_TemplateStamp.prototype._addEventListenerToNode = function(node, eventName, handler){}; -/** -* @override -* @param {!EventTarget} node Node to remove event listener from -* @param {string} eventName Name of event -* @param {function (!Event): void} handler Listener function to remove -* @return {void} -*/ -Polymer_TemplateStamp.prototype._removeEventListenerFromNode = function(node, eventName, handler){}; -/** -* @param {!HTMLTemplateElement} template Template to parse -* @param {TemplateInfo=} outerTemplateInfo Template metadata from the outer - template, for parsing nested templates -* @return {!TemplateInfo} -*/ -Polymer_TemplateStamp._parseTemplate = function(template, outerTemplateInfo){}; -/** -* @param {*} template -* @param {*} templateInfo -* @param {*} nodeInfo -*/ -Polymer_TemplateStamp._parseTemplateContent = function(template, templateInfo, nodeInfo){}; -/** -* @param {Node} node Node to parse -* @param {!TemplateInfo} templateInfo Template metadata for current template -* @param {!NodeInfo} nodeInfo Node metadata for current template. -* @return {boolean} -*/ -Polymer_TemplateStamp._parseTemplateNode = function(node, templateInfo, nodeInfo){}; -/** -* @param {Node} root Root node whose `childNodes` will be parsed -* @param {!TemplateInfo} templateInfo Template metadata for current template -* @param {!NodeInfo} nodeInfo Node metadata for current template. -* @return {void} -*/ -Polymer_TemplateStamp._parseTemplateChildNodes = function(root, templateInfo, nodeInfo){}; -/** -* @param {HTMLTemplateElement} node Node to parse (a