* Make sure component options get converted to actual * constructors. * * @param {Object} options
(options)
| 1786 | */ |
| 1787 | |
| 1788 | function guardComponents(options) { |
| 1789 | if (options.components) { |
| 1790 | var components = options.components = guardArrayAssets(options.components); |
| 1791 | var ids = Object.keys(components); |
| 1792 | var def; |
| 1793 | if ('development' !== 'production') { |
| 1794 | var map = options._componentNameMap = {}; |
| 1795 | } |
| 1796 | for (var i = 0, l = ids.length; i < l; i++) { |
| 1797 | var key = ids[i]; |
| 1798 | if (commonTagRE.test(key) || reservedTagRE.test(key)) { |
| 1799 | 'development' !== 'production' && warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + key); |
| 1800 | continue; |
| 1801 | } |
| 1802 | // record a all lowercase <-> kebab-case mapping for |
| 1803 | // possible custom element case error warning |
| 1804 | if ('development' !== 'production') { |
| 1805 | map[key.replace(/-/g, '').toLowerCase()] = hyphenate(key); |
| 1806 | } |
| 1807 | def = components[key]; |
| 1808 | if (isPlainObject(def)) { |
| 1809 | components[key] = Vue.extend(def); |
| 1810 | } |
| 1811 | } |
| 1812 | } |
| 1813 | } |
| 1814 | |
| 1815 | /** |
| 1816 | * Ensure all props option syntax are normalized into the |
no test coverage detected