Skip to content
This repository was archived by the owner on Sep 17, 2022. It is now read-only.

Commit 14404d2

Browse files
committed
Allow to mix syntaxes
1 parent 5756661 commit 14404d2

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

__tests__/__snapshots__/external.spec.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function __vue2_injectStyles (context) {
2727
}
2828
}
2929
30-
__component__.options.fluent = { en: en_ftl, da: da_ftl };
30+
__component__.options.fluent = { 'en': en_ftl, 'da': da_ftl };
3131
__component__.options.__file = \\"fixtures/components/external.vue\\"
3232
/* hot reload */
3333
import __VUE_HMR_RUNTIME__ from \\"/@id/__x00__/vite/vueHotReload\\"
@@ -62,7 +62,7 @@ function _sfc_render(_ctx, _cache) {
6262
}
6363
6464
65-
_sfc_main.fluent = { en: en_ftl, da: da_ftl };
65+
_sfc_main.fluent = { 'en': en_ftl, 'da': da_ftl };
6666
_sfc_main.__hmrId = \\"4c0553ad\\"
6767
typeof __VUE_HMR_RUNTIME__ !== 'undefined' && __VUE_HMR_RUNTIME__.createRecord(_sfc_main.__hmrId, _sfc_main)
6868
import.meta.hot.accept(({ default: updated, _rerender_only }) => {
@@ -85,7 +85,7 @@ import { render } from \\"/fixtures/components/external.vue?vue&type=template&id
8585
8686
8787
script.render = render
88-
script.fluent = { en: en_ftl, da: da_ftl };
88+
script.fluent = { 'en': en_ftl, 'da': da_ftl };
8989
script.__file = \\"__tests__/fixtures/components/external.vue\\"
9090
export default script"
9191
`;
@@ -116,7 +116,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
116116
}
117117
118118
119-
_sfc_main.fluent = { en: en_ftl, da: da_ftl };
119+
_sfc_main.fluent = { 'en': en_ftl, 'da': da_ftl };
120120
_sfc_main.__hmrId = \\"f4d31108\\"
121121
typeof __VUE_HMR_RUNTIME__ !== 'undefined' && __VUE_HMR_RUNTIME__.createRecord(_sfc_main.__hmrId, _sfc_main)
122122
import.meta.hot.accept(({ default: updated, _rerender_only }) => {

src/index.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,7 @@ export default new FluentResource(${JSON.stringify(ftl)})
8383
}
8484
},
8585
async transform(code, id) {
86-
if (!id.includes(`vue&type=${blockType}`) && external == null)
87-
return
88-
89-
if (external != null && !id.endsWith('.vue'))
90-
return
91-
92-
if (external != null) {
86+
if (id.endsWith('.vue') && external != null) {
9387
const relativePath = relative(external.baseDir, id)
9488

9589
const magic = new MagicString(code, { filename: id })
@@ -105,7 +99,8 @@ export default new FluentResource(${JSON.stringify(ftl)})
10599
map: magic.generateMap({ hires: true }),
106100
}
107101
}
108-
else {
102+
103+
if (id.includes(`vue&type=${blockType}`)) {
109104
// Custom block support
110105

111106
// vite-plugin-vue2 pads SFC file sections with newlines - trim those

0 commit comments

Comments
 (0)