|
1 | 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
2 | 2 |
|
| 3 | +exports[`SFC analyze <script> bindings > auto name inference > basic 1`] = ` |
| 4 | +"const a = 1 |
| 5 | +export default { |
| 6 | + __name: 'FooBar', |
| 7 | + setup(__props, { expose: __expose }) { |
| 8 | + __expose(); |
| 9 | +
|
| 10 | +return { a } |
| 11 | +} |
| 12 | +
|
| 13 | +}" |
| 14 | +`; |
| 15 | +
|
| 16 | +exports[`SFC analyze <script> bindings > auto name inference > do not overwrite manual name (call) 1`] = ` |
| 17 | +"import { defineComponent } from 'vue' |
| 18 | + const __default__ = defineComponent({ |
| 19 | + name: 'Baz' |
| 20 | + }) |
| 21 | + |
| 22 | +export default /*#__PURE__*/Object.assign(__default__, { |
| 23 | + setup(__props, { expose: __expose }) { |
| 24 | + __expose(); |
| 25 | +const a = 1 |
| 26 | +return { a, defineComponent } |
| 27 | +} |
| 28 | +
|
| 29 | +})" |
| 30 | +`; |
| 31 | +
|
| 32 | +exports[`SFC analyze <script> bindings > auto name inference > do not overwrite manual name (object) 1`] = ` |
| 33 | +"const __default__ = { |
| 34 | + name: 'Baz' |
| 35 | + } |
| 36 | + |
| 37 | +export default /*#__PURE__*/Object.assign(__default__, { |
| 38 | + setup(__props, { expose: __expose }) { |
| 39 | + __expose(); |
| 40 | +const a = 1 |
| 41 | +return { a } |
| 42 | +} |
| 43 | +
|
| 44 | +})" |
| 45 | +`; |
| 46 | +
|
3 | 47 | exports[`SFC compile <script setup> > <script> and <script setup> co-usage > export call expression as default 1`] = `
|
4 | 48 | "function fn() {
|
5 | 49 | return \\"hello, world\\";
|
@@ -1281,3 +1325,102 @@ return { D, C, B, Foo }
|
1281 | 1325 |
|
1282 | 1326 | })"
|
1283 | 1327 | `;
|
| 1328 | +
|
| 1329 | +exports[`SFC genDefaultAs > <script setup> only 1`] = ` |
| 1330 | +"const a = 1 |
| 1331 | + |
| 1332 | +const _sfc_ = { |
| 1333 | + setup(__props, { expose: __expose }) { |
| 1334 | + __expose(); |
| 1335 | +
|
| 1336 | + |
| 1337 | +return { a } |
| 1338 | +} |
| 1339 | +
|
| 1340 | +}" |
| 1341 | +`; |
| 1342 | +
|
| 1343 | +exports[`SFC genDefaultAs > <script setup> only w/ ts 1`] = ` |
| 1344 | +"import { defineComponent as _defineComponent } from 'vue' |
| 1345 | +const a = 1 |
| 1346 | + |
| 1347 | +const _sfc_ = /*#__PURE__*/_defineComponent({ |
| 1348 | + setup(__props, { expose: __expose }) { |
| 1349 | + __expose(); |
| 1350 | +
|
| 1351 | + |
| 1352 | +return { a } |
| 1353 | +} |
| 1354 | +
|
| 1355 | +})" |
| 1356 | +`; |
| 1357 | +
|
| 1358 | +exports[`SFC genDefaultAs > <script> + <script setup> 1`] = ` |
| 1359 | +"const __default__ = {} |
| 1360 | + |
| 1361 | +const _sfc_ = /*#__PURE__*/Object.assign(__default__, { |
| 1362 | + setup(__props, { expose: __expose }) { |
| 1363 | + __expose(); |
| 1364 | +
|
| 1365 | + const a = 1 |
| 1366 | + |
| 1367 | +return { a } |
| 1368 | +} |
| 1369 | +
|
| 1370 | +})" |
| 1371 | +`; |
| 1372 | +
|
| 1373 | +exports[`SFC genDefaultAs > <script> + <script setup> 2`] = ` |
| 1374 | +"const __default__ = {} |
| 1375 | + |
| 1376 | +const _sfc_ = /*#__PURE__*/Object.assign(__default__, { |
| 1377 | + setup(__props, { expose: __expose }) { |
| 1378 | + __expose(); |
| 1379 | +
|
| 1380 | + const a = 1 |
| 1381 | + |
| 1382 | +return { a } |
| 1383 | +} |
| 1384 | +
|
| 1385 | +})" |
| 1386 | +`; |
| 1387 | +
|
| 1388 | +exports[`SFC genDefaultAs > <script> + <script setup> w/ ts 1`] = ` |
| 1389 | +"import { defineComponent as _defineComponent } from 'vue' |
| 1390 | +
|
| 1391 | + const __default__ = {} |
| 1392 | + |
| 1393 | +const _sfc_ = /*#__PURE__*/_defineComponent({ |
| 1394 | + ...__default__, |
| 1395 | + setup(__props, { expose: __expose }) { |
| 1396 | + __expose(); |
| 1397 | +
|
| 1398 | + const a = 1 |
| 1399 | + |
| 1400 | +return { a } |
| 1401 | +} |
| 1402 | +
|
| 1403 | +})" |
| 1404 | +`; |
| 1405 | +
|
| 1406 | +exports[`SFC genDefaultAs > normal <script> only 1`] = ` |
| 1407 | +" |
| 1408 | + const _sfc_ = {} |
| 1409 | + " |
| 1410 | +`; |
| 1411 | +
|
| 1412 | +exports[`SFC genDefaultAs > normal <script> w/ cssVars 1`] = ` |
| 1413 | +" |
| 1414 | + const _sfc_ = {} |
| 1415 | + |
| 1416 | +import { useCssVars as _useCssVars } from 'vue' |
| 1417 | +const __injectCSSVars__ = () => { |
| 1418 | +_useCssVars(_ctx => ({ |
| 1419 | + \\"xxxxxxxx-x\\": (_ctx.x) |
| 1420 | +}))} |
| 1421 | +const __setup__ = _sfc_.setup |
| 1422 | +_sfc_.setup = __setup__ |
| 1423 | + ? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) } |
| 1424 | + : __injectCSSVars__ |
| 1425 | +" |
| 1426 | +`; |
0 commit comments