@@ -16,8 +16,7 @@ function render(_ctx, _cache) {
16
16
function block0 (Component) {
17
17
const target = Component .options || Component ;
18
18
target .fluent = target .fluent || {};
19
- target .fluent [' en' ] = new bundle .FluentResource (\`
20
- # Simple things are simple.
19
+ target .fluent [' en' ] = new bundle .FluentResource (\` # Simple things are simple.
21
20
hello-user = Hello, { $userName } !
22
21
23
22
# Complex things are possible.
@@ -29,8 +28,7 @@ shared-photos =
29
28
[male ] his stream
30
29
[female ] her stream
31
30
* [other ] their stream
32
- } .
33
- \` );
31
+ } .\` );
34
32
}
35
33
36
34
const script = { } ;
@@ -61,8 +59,7 @@ function render(_ctx, _cache) {
61
59
function block0 (Component) {
62
60
const target = Component .options || Component ;
63
61
target .fluent = target .fluent || {};
64
- target .fluent [' en' ] = new bundle .FluentResource (\`
65
- # Simple things are simple.
62
+ target .fluent [' en' ] = new bundle .FluentResource (\` # Simple things are simple.
66
63
hello-user = Hello, { $userName } !
67
64
68
65
# Complex things are possible.
@@ -74,8 +71,7 @@ shared-photos =
74
71
[male ] his stream
75
72
[female ] her stream
76
73
* [other ] their stream
77
- } .
78
- \` );
74
+ } .\` );
79
75
}
80
76
81
77
const script = { } ;
@@ -87,3 +83,150 @@ script.__file = \\"__tests__/fixtures/test.vue\\";
87
83
module.exports = script;
88
84
"
89
85
` ;
86
+
87
+ exports [` rollup plugin > works with vue 2 1` ] = `
88
+ "'use strict';
89
+
90
+ var bundle = require('@fluent/bundle');
91
+
92
+ var render = function () { var _vm = this ;var _h = _vm .$createElement ;var _c = _vm ._self ._c || _h ;return _c (' div' ,[_c (' div' ,[_vm ._v (_vm ._s (_vm .$t (' hello-user' , { userName: _vm .userName })))]),_c (' div' ,[_vm ._v (_vm ._s (_vm .$t (' shared-photos' , { userName: _vm .userName , photoCount: _vm .photoCount , userGender: _vm .userGender })))])])} ;
93
+ var staticRenderFns = [];
94
+ render._withStripped = true;
95
+
96
+ function normalizeComponent (
97
+ scriptExports,
98
+ render,
99
+ staticRenderFns,
100
+ functionalTemplate,
101
+ injectStyles,
102
+ scopeId,
103
+ moduleIdentifier, /* server only */
104
+ shadowMode /* vue-cli only */
105
+ ) {
106
+ // Vue.extend constructor export interop
107
+ var options = typeof scriptExports === ' function'
108
+ ? scriptExports .options
109
+ : scriptExports ;
110
+
111
+ // render functions
112
+ if (render ) {
113
+ options.render = render;
114
+ options.staticRenderFns = staticRenderFns;
115
+ options._compiled = true;
116
+ }
117
+
118
+ // functional template
119
+ if (functionalTemplate ) {
120
+ options.functional = true;
121
+ }
122
+
123
+ // scopedId
124
+ if (scopeId ) {
125
+ options._scopeId = 'data-v-' + scopeId;
126
+ }
127
+
128
+ var hook ;
129
+ if (moduleIdentifier ) { // server build
130
+ hook = function (context ) {
131
+ // 2.3 injection
132
+ context =
133
+ context || // cached call
134
+ (this .$vnode && this .$vnode .ssrContext ) || // stateful
135
+ (this .parent && this .parent .$vnode && this .parent .$vnode .ssrContext ); // functional
136
+ // 2.2 with runInNewContext: true
137
+ if (! context && typeof __VUE_SSR_CONTEXT__ !== ' undefined' ) {
138
+ context = __VUE_SSR_CONTEXT__ ;
139
+ }
140
+ // inject component styles
141
+ if (injectStyles ) {
142
+ injectStyles .call (this , context );
143
+ }
144
+ // register component module identifier for async chunk inferrence
145
+ if (context && context ._registeredComponents ) {
146
+ context ._registeredComponents .add (moduleIdentifier );
147
+ }
148
+ };
149
+ // used by ssr in case component is cached and beforeCreate
150
+ // never gets called
151
+ options._ssrRegister = hook;
152
+ } else if (injectStyles ) {
153
+ hook = shadowMode
154
+ ? function () {
155
+ injectStyles .call (
156
+ this ,
157
+ (options .functional ? this .parent : this ).$root .$options .shadowRoot
158
+ );
159
+ }
160
+ : injectStyles;
161
+ }
162
+
163
+ if (hook ) {
164
+ if (options .functional ) {
165
+ // for template-only hot-reload because in that case the render fn doesn't
166
+ // go through the normalizer
167
+ options ._injectStyles = hook ;
168
+ // register for functional component in vue file
169
+ var originalRender = options .render ;
170
+ options .render = function renderWithStyleInjection (h , context ) {
171
+ hook .call (context );
172
+ return originalRender (h , context )
173
+ };
174
+ } else {
175
+ // inject component registration as beforeCreate hook
176
+ var existing = options.beforeCreate;
177
+ options.beforeCreate = existing
178
+ ? [].concat(existing , hook )
179
+ : [hook];
180
+ }
181
+ }
182
+
183
+ return {
184
+ exports : scriptExports ,
185
+ options : options
186
+ }
187
+ }
188
+
189
+ function block0 (Component) {
190
+ const target = Component .options || Component ;
191
+ target .fluent = target .fluent || {};
192
+ target .fluent [' en' ] = new bundle .FluentResource (\` # Simple things are simple.
193
+ hello-user = Hello, { $userName } !
194
+
195
+ # Complex things are possible.
196
+ shared-photos =
197
+ { $userName } { $photoCount - >
198
+ [one ] added one photo
199
+ * [other ] added {$photoCount } new photos
200
+ } to { $userGender - >
201
+ [male ] his stream
202
+ [female ] her stream
203
+ * [other ] their stream
204
+ } .\` );
205
+ }
206
+
207
+ const __vue2_script = { } ;
208
+ const __cssModules = { } ;
209
+ var __component__ = /*#__PURE__*/normalizeComponent(
210
+ __vue2_script,
211
+ render,
212
+ staticRenderFns,
213
+ false,
214
+ __vue2_injectStyles,
215
+ null,
216
+ null,
217
+ null
218
+ );
219
+
220
+ function __vue2_injectStyles (context) {
221
+ for (let o in __cssModules ){
222
+ this[o] = __cssModules[o];
223
+ }
224
+ }
225
+ if (typeof block0 === 'function') block0(__component__);
226
+
227
+ __component__.options.__file = \\ "__tests__/fixtures/test.vue\\ ";
228
+ var test = /*#__PURE__*/(function () { return __component__ .exports } )();
229
+
230
+ module.exports = test;
231
+ "
232
+ ` ;
0 commit comments