|
| 1 | +/* template */ |
| 2 | +var render = function() { |
| 3 | + var _vm = this |
| 4 | + var _h = _vm.$createElement |
| 5 | + var _c = _vm._self._c || _h |
| 6 | + return _c("h1", { staticStyle: { color: "red" }, attrs: { id: "test" } }, [ |
| 7 | + _vm._v("Hello " + _vm._s(_vm.name) + "!") |
| 8 | + ]) |
| 9 | +} |
| 10 | +var staticRenderFns = [] |
| 11 | +render._withStripped = true |
| 12 | + |
| 13 | +const __vue_render__ = typeof render !== 'undefined' ? { render, staticRenderFns } : {} |
| 14 | +/* style */ |
| 15 | +const __vue_inject_styles__ = 0 ? function (context) { |
| 16 | + |
| 17 | +} : undefined |
| 18 | +/* script */ |
| 19 | +// |
| 20 | +// |
| 21 | +// |
| 22 | +// |
| 23 | + |
| 24 | +const __vue_script__ = { |
| 25 | + data () { |
| 26 | + return { name: 'John Doe' } |
| 27 | + } |
| 28 | +} |
| 29 | + |
| 30 | +/* scoped */ |
| 31 | +const __vue_scope_id__ = false ? e(scopeId) : undefined |
| 32 | +/* functional template */ |
| 33 | +const __vue_is_functional_template__ = false |
| 34 | +/* component normalizer */ |
| 35 | +function __vue_normalize__(template, inject, script, scope, functional) { |
| 36 | + const component = script || {} |
| 37 | + |
| 38 | + if (!false) { |
| 39 | + component.__file = "/Users/300005163/Workspace/OpenSource/vuejs/vue-component-compiler/test/fixtures/basic.vue" |
| 40 | + } |
| 41 | + |
| 42 | + if (!component.render) { |
| 43 | + component.render = template.render |
| 44 | + component.staticRenderFns = template.staticRenderFns |
| 45 | + component._compiled = true |
| 46 | + |
| 47 | + if (functional) component.functional = true |
| 48 | + } |
| 49 | + |
| 50 | + component.scopeId = scope |
| 51 | + |
| 52 | + if (0) { |
| 53 | + const call_inject = function(context) { |
| 54 | + // 2.3 injection |
| 55 | + context = |
| 56 | + context || // cached call |
| 57 | + (this.$vnode && this.$vnode.ssrContext) || // stateful |
| 58 | + (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional |
| 59 | + // 2.2 with runInNewContext: true |
| 60 | + if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { |
| 61 | + context = __VUE_SSR_CONTEXT__ |
| 62 | + } |
| 63 | + inject(function(id, style) { |
| 64 | + let css = style.code |
| 65 | + if (style.map) { |
| 66 | + // https://developer.chrome.com/devtools/docs/javascript-debugging |
| 67 | + // this makes source maps inside style tags work properly in Chrome |
| 68 | + css += ' |
| 69 | +/*# sourceURL=' + style.map.sources[0] + ' */' |
| 70 | + // http://stackoverflow.com/a/26603875 |
| 71 | + css += |
| 72 | + ' |
| 73 | +/*# sourceMappingURL=data:application/json;base64,' + |
| 74 | + window.btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + |
| 75 | + ' */' |
| 76 | + } |
| 77 | + if (false) { |
| 78 | + if (!context.hasOwnProperty('styles')) { |
| 79 | + function renderStyles (styles) { |
| 80 | + let css = '' |
| 81 | + for (const key in styles) { |
| 82 | + const it = styles[key] |
| 83 | + css += |
| 84 | + '<style data-vue-ssr-id="' + it.ids.join(' ') + '"' + |
| 85 | + (it.media ? ' media="' + it.media + '"' : '') + |
| 86 | + '>' + |
| 87 | + it.code + |
| 88 | + '</style>' |
| 89 | + } |
| 90 | + return css |
| 91 | + } |
| 92 | + Object.defineProperty(context, 'styles', { |
| 93 | + enumerable: true, |
| 94 | + get: () => renderStyles(context._styles) |
| 95 | + }) |
| 96 | + // expose renderStyles for vue-server-renderer (vuejs/#6353) |
| 97 | + context._renderStyles = renderStyles |
| 98 | + } |
| 99 | + const styles = context._styles || (context._styles = {}) |
| 100 | + const groupId = false ? style.media || 'default' : id |
| 101 | + const target = styles[groupId] |
| 102 | + if (target) { |
| 103 | + if (target.ids.indexOf(id) < 0) { |
| 104 | + target.ids.push(id) |
| 105 | + target.code += '\n' + style.code |
| 106 | + } |
| 107 | + } else { |
| 108 | + styles[groupId] = { |
| 109 | + ids: [id], |
| 110 | + style: style.code, |
| 111 | + media: style.media |
| 112 | + } |
| 113 | + } |
| 114 | + } else { |
| 115 | + const head = document.head || document.getElementsByTagName('head')[0] |
| 116 | + const isOldIE = typeof navigator !== 'undefined' && /msie [6-9]/.test(navigator.userAgent.toLowerCase()) |
| 117 | + const styleElement = document.querySelector('style[data-vue-ssr-id~="' + id + '"]') |
| 118 | + if (styleElement) { |
| 119 | + // SSR styles are present. |
| 120 | + return |
| 121 | + } |
| 122 | + |
| 123 | + if (isOldIE) { |
| 124 | + const indexKey = '__vue_style_singleton_counter__' |
| 125 | + const textKey = '__vue_style_text__' |
| 126 | + window[indexKey] = window[indexKey] || 0 |
| 127 | + const styles = window[textKey] = window[textKey] || [] |
| 128 | + const index = ++window[indexKey] |
| 129 | + let styleElement = document.querySelector('style[data-vue-style-singleton=' + (style.media || '""') + ']') |
| 130 | + if (!styleElement) { |
| 131 | + styleElement = document.createElement('style') |
| 132 | + styleElement.setAttribute('data-vue-style-singleton', style.media || '') |
| 133 | + styleElement.type = 'text/css' |
| 134 | + head.appendChild(style) |
| 135 | + } |
| 136 | + if (styleElement.styleSheet) { |
| 137 | + styles[index] = css |
| 138 | + styleElement.styleSheet.cssText = style.filter(Boolean).join('\n') |
| 139 | + } else { |
| 140 | + const cssNode = document.createTextNode(css) |
| 141 | + const childNodes = styleElement.childNodes |
| 142 | + if (childNodes[index]) styleElement.removeChild(childNodes[index]) |
| 143 | + if (childNodes.length) { |
| 144 | + styleElement.insertBefore(cssNode, childNodes[index]) |
| 145 | + } else { |
| 146 | + styleElement.appendChild(cssNode) |
| 147 | + } |
| 148 | + } |
| 149 | + } else { |
| 150 | + const styleElement = document.createElement('style') |
| 151 | + styleElement.type = 'text/css' |
| 152 | + styleElement.setAttribute('media', style.media) |
| 153 | + head.appendChild(styleElement) |
| 154 | + if (style.styleSheet) { |
| 155 | + styleElement.styleSheet.cssText = css |
| 156 | + } else { |
| 157 | + styleElement.appendChild(document.createTextNode(css)) |
| 158 | + } |
| 159 | + } |
| 160 | + } |
| 161 | + }) |
| 162 | + if (context && context._registeredComponents) { |
| 163 | + context._registeredComponents.add(scope) |
| 164 | + } |
| 165 | + } |
| 166 | + if (false) { |
| 167 | + component._ssrRegister = call_inject |
| 168 | + } |
| 169 | + if (component.functional) { |
| 170 | + const render = component.render |
| 171 | + component.render = function renderWithInjection (h, ctx) { |
| 172 | + call_inject.call(this, ctx) |
| 173 | + |
| 174 | + return render(h, ctx) |
| 175 | + } |
| 176 | + } else { |
| 177 | + const name = 'beforeCreate' |
| 178 | + component[name] = component[name] ? [].concat(component[name], call_inject) : [] |
| 179 | + } |
| 180 | + } |
| 181 | + |
| 182 | + return component |
| 183 | +} |
| 184 | + |
| 185 | +export default __vue_normalize__( |
| 186 | +__vue_render__, |
| 187 | +__vue_inject_styles__, |
| 188 | +__vue_script__, |
| 189 | +__vue_scope_id__, |
| 190 | +__vue_is_functional_template__ |
| 191 | +) |
0 commit comments