Skip to content

Commit

Permalink
BREAKING CHANGE: drop '@intlify/vite-plugin-vue-i18n/messages' virtua…
Browse files Browse the repository at this point in the history
…l module ID (#334)
  • Loading branch information
kazupon authored Dec 20, 2023
1 parent 976fa56 commit fb25805
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
14 changes: 1 addition & 13 deletions packages/unplugin-vue-i18n/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ import type { PluginOptions } from './types'
import type { CodeGenOptions, DevEnv } from '@intlify/bundle-utils'

const INTLIFY_BUNDLE_IMPORT_ID = '@intlify/unplugin-vue-i18n/messages'
const INTLIFY_BUNDLE_IMPORT_DEPRECTED_ID =
'@intlify/vite-plugin-vue-i18n/messages'
const VIRTUAL_PREFIX = '\0'

const debug = createDebug('unplugin-vue-i18n')
Expand Down Expand Up @@ -491,13 +489,6 @@ export const unplugin = createUnplugin<PluginOptions>((options = {}, meta) => {

resolveId(id: string, importer: string) {
debug('resolveId', id, importer)
if (id === INTLIFY_BUNDLE_IMPORT_DEPRECTED_ID) {
warn(
`deprected '${INTLIFY_BUNDLE_IMPORT_DEPRECTED_ID}', you should switch to '${INTLIFY_BUNDLE_IMPORT_ID}'`
)
return asVirtualId(id, meta.framework)
}

if (id === INTLIFY_BUNDLE_IMPORT_ID) {
return asVirtualId(id, meta.framework)
}
Expand All @@ -508,9 +499,7 @@ export const unplugin = createUnplugin<PluginOptions>((options = {}, meta) => {
debug('load', id)
const { query } = parseVueRequest(id)
if (
[INTLIFY_BUNDLE_IMPORT_DEPRECTED_ID, INTLIFY_BUNDLE_IMPORT_ID].includes(
getVirtualId(id, meta.framework)
) &&
INTLIFY_BUNDLE_IMPORT_ID === getVirtualId(id, meta.framework) &&
include
) {
let resourcePaths = [] as string[]
Expand Down Expand Up @@ -552,7 +541,6 @@ export const unplugin = createUnplugin<PluginOptions>((options = {}, meta) => {
return (
filename.endsWith('vue') ||
filename.endsWith(INTLIFY_BUNDLE_IMPORT_ID) ||
filename.endsWith(INTLIFY_BUNDLE_IMPORT_DEPRECTED_ID) ||
(/\.(json5?|ya?ml)$/.test(filename) && filter(filename))
)
}
Expand Down
5 changes: 0 additions & 5 deletions packages/unplugin-vue-i18n/test/vite/bundle-import.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import { createMessageContext } from '@intlify/core-base'
testcase: 'import',
input: './fixtures/bundle-messages.ts',
fixture: '@intlify/unplugin-vue-i18n/messages'
},
{
testcase: 'deprected import id',
input: './fixtures/bundle-messages-deprecated.ts',
fixture: '@intlify/vite-plugin-vue-i18n/messages'
}
].forEach(({ testcase, input, fixture }) => {
test(testcase, async () => {
Expand Down

0 comments on commit fb25805

Please sign in to comment.