Skip to content

Commit ca82f76

Browse files
authored
feat!(unplugin-vue-i18n):support vue-i18n v12 (#436)
* support v12: mjs to js * support v12: remove legacy * support v12: update docs * support v12: remove bridge * support v12: remove bridge * support v12: revert rollup-plugin, vite-plugin and loader * support v12: add doc note * support v12: note to caution * revert sourcemap
1 parent 7c9a4ea commit ca82f76

File tree

10 files changed

+4
-22
lines changed

10 files changed

+4
-22
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
coverage
22
node_modules
3-
packages/rollup-plugin-vue-i18n/examples/legacy/index.js
43
packages/rollup-plugin-vue-i18n/examples/global/index.js
54
packages/rollup-plugin-vue-i18n/examples/composition/index.js
65
packages/vite-plugin-vue-i18n/examples/dist

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ packages/**/examples/dist
77
packages/**/CHANGELOG.md
88
packages/rollup-plugin-vue-i18n/examples/composition/index.js
99
packages/rollup-plugin-vue-i18n/examples/global/index.js
10-
packages/rollup-plugin-vue-i18n/examples/legacy/index.js

examples/vite/src/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import App from './App.vue'
44
import messages from '@intlify/unplugin-vue-i18n/messages'
55

66
const i18n = createI18n({
7-
legacy: false,
87
locale: 'ja',
98
messages
109
})

examples/webpack/src/main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import ja from './locales/ja.json'
66
import en from './locales/en.yaml'
77

88
const i18n = createI18n({
9-
legacy: false,
109
locale: 'ja',
1110
messages: {
1211
en,

packages/bundle-utils/src/codegen.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ export interface SourceLocationable {
4444
*/
4545
export interface CodeGenOptions {
4646
type?: 'plain' | 'sfc' | 'bare'
47-
legacy?: boolean
48-
bridge?: boolean
4947
exportESM?: boolean
5048
onlyLocales?: string[]
5149
source?: string

packages/unplugin-vue-i18n/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,9 @@ If do you will use this option, you need to enable `jitCompilation` option.
439439

440440
For more details, See [here](https://vue-i18n.intlify.dev/guide/advanced/optimization.html#reduce-bundle-size-with-feature-build-flags)
441441

442+
> [!CAUTION]
443+
> This option will be removed in v7
444+
442445
### `fullInstall`
443446

444447
- **Type:** `boolean`

packages/unplugin-vue-i18n/src/core/options.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ export function resolveOptions(options: PluginOptions) {
4040

4141
const dropMessageCompiler = !!options.dropMessageCompiler
4242

43-
// prettier-ignore
44-
const compositionOnly = moduleType === 'vue-i18n'
45-
? isBoolean(options.compositionOnly)
46-
? options.compositionOnly
47-
: true
48-
: true
49-
5043
// prettier-ignore
5144
const fullInstall = moduleType === 'vue-i18n'
5245
? isBoolean(options.fullInstall)
@@ -90,7 +83,6 @@ export function resolveOptions(options: PluginOptions) {
9083
globalSFCScope,
9184
runtimeOnly,
9285
dropMessageCompiler,
93-
compositionOnly,
9486
fullInstall,
9587
ssrBuild,
9688
allowDynamic,

packages/unplugin-vue-i18n/src/core/resource.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export function resourcePlugin(
5555
globalSFCScope,
5656
runtimeOnly,
5757
dropMessageCompiler,
58-
compositionOnly,
5958
fullInstall,
6059
ssrBuild,
6160
strictMessage,
@@ -68,7 +67,7 @@ export function resourcePlugin(
6867
const filter = createFilter(include, exclude)
6968
const getVueI18nAliasPath = ({ ssr = false, runtimeOnly = false }) => {
7069
return `${module}/dist/${module}${runtimeOnly ? '.runtime' : ''}.${
71-
!ssr ? 'esm-bundler.js' /* '.mjs' */ : 'node.mjs'
70+
!ssr ? 'esm-bundler.js' : 'node.js'
7271
}`
7372
}
7473
let isProduction = false
@@ -100,7 +99,6 @@ export function resourcePlugin(
10099
config() {
101100
const defineConfig = {
102101
define: {
103-
__VUE_I18N_LEGACY_API__: !compositionOnly,
104102
__VUE_I18N_FULL_INSTALL__: fullInstall,
105103
__INTLIFY_DROP_MESSAGE_COMPILER__: dropMessageCompiler,
106104
__VUE_I18N_PROD_DEVTOOLS__: false
@@ -269,12 +267,10 @@ export function resourcePlugin(
269267
if (webpack) {
270268
compiler.options.plugins!.push(
271269
new webpack.DefinePlugin({
272-
__VUE_I18N_LEGACY_API__: JSON.stringify(compositionOnly),
273270
__VUE_I18N_FULL_INSTALL__: JSON.stringify(fullInstall),
274271
__INTLIFY_PROD_DEVTOOLS__: 'false'
275272
})
276273
)
277-
debug(`set __VUE_I18N_LEGACY_API__ is '${compositionOnly}'`)
278274
debug(`set __VUE_I18N_FULL_INSTALL__ is '${fullInstall}'`)
279275
} else {
280276
debug('ignore vue-i18n feature flags with webpack.DefinePlugin')

packages/unplugin-vue-i18n/src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export interface PluginOptions {
88
module?: VueI18nModule
99
dropMessageCompiler?: boolean
1010
runtimeOnly?: boolean
11-
compositionOnly?: boolean
1211
ssr?: boolean
1312
fullInstall?: boolean
1413
forceStringify?: boolean

packages/unplugin-vue-i18n/test/utils.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,6 @@ export async function bundleAndRun(
173173
? options.globalSFCScope
174174
: undefined
175175
options.sourcemap = isBoolean(options.sourcemap) || false
176-
options.bridge = isBoolean(options.bridge) || false
177-
options.legacy = isBoolean(options.legacy) || false
178176
options.vueVersion = isString(options.vueVersion)
179177
? options.vueVersion
180178
: 'v2.6'

0 commit comments

Comments
 (0)