Skip to content

Commit 814988b

Browse files
committed
fix: deprecated Legacy API mode
1 parent cea7cb4 commit 814988b

File tree

9 files changed

+520
-429
lines changed

9 files changed

+520
-429
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"@types/minimist": "^1.2.5",
8989
"@types/node": "^22.5.3",
9090
"@types/rc": "^1.2.4",
91-
"@vitest/coverage-v8": "^2.0.0",
91+
"@vitest/coverage-v8": "^2.1.5",
9292
"api-docs-gen": "^0.4.0",
9393
"benchmark": "^2.1.4",
9494
"brotli": "^1.3.2",
@@ -145,7 +145,7 @@
145145
"typescript": "^5.5.3",
146146
"typescript-eslint": "^8.4.0",
147147
"vitepress": "1.5.0",
148-
"vitest": "^2.0.4",
148+
"vitest": "^2.1.5",
149149
"vue": "3.5.12",
150150
"vue-i18n": "workspace:*"
151151
},
@@ -177,7 +177,7 @@
177177
"pnpm": {
178178
"overrides": {
179179
"vue": "3.5.12",
180-
"vite": "^5.1.2"
180+
"vite": "^5.4.11"
181181
}
182182
}
183183
}

packages/size-check-petite-vue-i18n/src/main.ts

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,69 @@ import { createApp } from 'vue'
22
import { createI18n } from 'vue-i18n'
33
import App from './App.vue'
44

5+
const ast = {
6+
type: 0,
7+
start: 0,
8+
end: 6,
9+
loc: {
10+
start: {
11+
line: 1,
12+
column: 1,
13+
offset: 0
14+
},
15+
end: {
16+
line: 1,
17+
column: 7,
18+
offset: 6
19+
},
20+
source: 'hello!'
21+
},
22+
body: {
23+
type: 2,
24+
start: 0,
25+
end: 6,
26+
loc: {
27+
start: {
28+
line: 1,
29+
column: 1,
30+
offset: 0
31+
},
32+
end: {
33+
line: 1,
34+
column: 7,
35+
offset: 6
36+
}
37+
},
38+
items: [
39+
{
40+
type: 3,
41+
start: 0,
42+
end: 6,
43+
loc: {
44+
start: {
45+
line: 1,
46+
column: 1,
47+
offset: 0
48+
},
49+
end: {
50+
line: 1,
51+
column: 7,
52+
offset: 6
53+
}
54+
},
55+
value: 'hello!'
56+
}
57+
],
58+
static: 'hello!'
59+
},
60+
cacheKey: '{"l":"en","k":"hello","s":"hello!"}'
61+
}
62+
563
const i18n = createI18n({
664
locale: 'en',
765
messages: {
866
en: {
9-
hello: 'hello!'
67+
hello: ast
1068
}
1169
}
1270
})

packages/vue-i18n-core/src/composer.ts

Lines changed: 85 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,118 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
import { ref, computed, getCurrentInstance, watch, shallowRef } from 'vue'
32
import {
4-
warn,
5-
isArray,
6-
isFunction,
7-
isNumber,
8-
isString,
9-
isRegExp,
10-
isBoolean,
11-
isPlainObject,
12-
isObject,
13-
assign,
14-
inBrowser,
15-
deepCopy,
16-
hasOwn
17-
} from '@intlify/shared'
18-
import {
19-
isTranslateFallbackWarn,
20-
isTranslateMissingWarn,
21-
createCoreContext,
3+
DEFAULT_LOCALE,
224
MISSING_RESOLVE_VALUE,
23-
updateFallbackLocale,
24-
translate,
25-
parseTranslateArgs,
26-
datetime,
27-
parseDateTimeArgs,
5+
MessageFunction,
6+
NOT_REOSLVED,
287
clearDateTimeFormat,
29-
number,
30-
parseNumberArgs,
318
clearNumberFormat,
9+
createCoreContext,
10+
datetime,
3211
fallbackWithLocaleChain,
33-
NOT_REOSLVED,
34-
MessageFunction,
35-
setAdditionalMeta,
3612
getFallbackContext,
37-
setFallbackContext,
38-
DEFAULT_LOCALE,
3913
isMessageAST,
40-
isMessageFunction
14+
isMessageFunction,
15+
isTranslateFallbackWarn,
16+
isTranslateMissingWarn,
17+
number,
18+
parseDateTimeArgs,
19+
parseNumberArgs,
20+
parseTranslateArgs,
21+
setAdditionalMeta,
22+
setFallbackContext,
23+
translate,
24+
updateFallbackLocale
4125
} from '@intlify/core-base'
42-
import { I18nWarnCodes, getWarnMessage } from './warnings'
26+
import {
27+
assign,
28+
deepCopy,
29+
hasOwn,
30+
inBrowser,
31+
isArray,
32+
isBoolean,
33+
isFunction,
34+
isNumber,
35+
isObject,
36+
isPlainObject,
37+
isRegExp,
38+
isString,
39+
warn
40+
} from '@intlify/shared'
41+
import { computed, getCurrentInstance, ref, shallowRef, watch } from 'vue'
4342
import { I18nErrorCodes, createI18nError } from './errors'
43+
import { VERSION } from './misc'
4444
import {
45-
TranslateVNodeSymbol,
4645
DatetimePartsSymbol,
47-
NumberPartsSymbol,
48-
EnableEmitter,
4946
DisableEmitter,
47+
EnableEmitter,
48+
InejctWithOptionSymbol,
49+
NumberPartsSymbol,
5050
SetPluralRulesSymbol,
51-
InejctWithOptionSymbol
51+
TranslateVNodeSymbol
5252
} from './symbols'
5353
import {
54-
getLocaleMessages,
55-
getComponentOptions,
5654
createTextNode,
55+
getComponentOptions,
56+
getLocaleMessages,
5757
handleFlatJson
5858
} from './utils'
59-
import { VERSION } from './misc'
59+
import { I18nWarnCodes, getWarnMessage } from './warnings'
6060

6161
import type {
62-
ComponentInternalInstance,
63-
VNode,
64-
VNodeArrayChildren,
65-
WritableComputedRef,
66-
ComputedRef
67-
} from 'vue'
68-
import type {
69-
Path,
70-
MessageResolver,
71-
MessageCompiler,
62+
CoreContext,
63+
CoreInternalContext,
64+
CoreMissingHandler,
65+
CoreMissingType,
66+
DateTimeFormat,
67+
DateTimeFormats as DateTimeFormatsType,
68+
DateTimeOptions,
69+
FallbackLocale,
70+
FallbackLocales,
71+
GeneratedLocale,
72+
IsEmptyObject,
73+
IsNever,
74+
JsonPaths,
7275
LinkedModifiers,
73-
PluralizationRules,
74-
NamedValue,
75-
MessageFunctions,
76-
MessageProcessor,
77-
MessageType,
7876
Locale,
79-
LocaleMessageValue,
8077
LocaleMessage,
81-
LocaleMessages,
82-
CoreContext,
83-
CoreMissingHandler,
8478
LocaleMessageDictionary,
85-
PostTranslationHandler,
86-
FallbackLocale,
87-
CoreInternalContext,
88-
TranslateOptions,
89-
DateTimeOptions,
90-
NumberOptions,
91-
DateTimeFormats as DateTimeFormatsType,
92-
NumberFormats as NumberFormatsType,
93-
DateTimeFormat,
94-
NumberFormat,
79+
LocaleMessageValue,
80+
LocaleMessages,
81+
LocaleParams,
82+
MessageCompiler,
83+
MessageFunctions,
84+
MessageProcessor,
85+
MessageResolver,
86+
MessageType,
9587
MetaInfo,
96-
PickupLocales,
97-
PickupKeys,
88+
NamedValue,
89+
NumberFormat,
90+
NumberFormats as NumberFormatsType,
91+
NumberOptions,
92+
Path,
9893
PickupFormatKeys,
99-
FallbackLocales,
100-
SchemaParams,
101-
LocaleParams,
102-
ResourceValue,
103-
ResourcePath,
104-
ResourceNode,
10594
PickupFormatPathKeys,
95+
PickupKeys,
96+
PickupLocales,
97+
PluralizationRules,
98+
PostTranslationHandler,
10699
RemoveIndexSignature,
107100
RemovedIndexResources,
108-
IsNever,
109-
IsEmptyObject,
110-
CoreMissingType,
111-
JsonPaths,
112-
TranslationsPaths,
113-
GeneratedLocale
101+
ResourceNode,
102+
ResourcePath,
103+
ResourceValue,
104+
SchemaParams,
105+
TranslateOptions,
106+
TranslationsPaths
114107
} from '@intlify/core-base'
115108
import type { VueDevToolsEmitter } from '@intlify/devtools-types'
109+
import type {
110+
ComponentInternalInstance,
111+
ComputedRef,
112+
VNode,
113+
VNodeArrayChildren,
114+
WritableComputedRef
115+
} from 'vue'
116116

117117
export { DEFAULT_LOCALE } from '@intlify/core-base'
118118

@@ -1889,10 +1889,7 @@ export function createComposer<
18891889
> = Options['numberFormats'] extends Record<string, any>
18901890
? Options['numberFormats']
18911891
: {}
1892-
>(
1893-
options: Options,
1894-
VueI18nLegacy?: any
1895-
): Composer<Messages, DateTimeFormats, NumberFormats>
1892+
>(options: Options): Composer<Messages, DateTimeFormats, NumberFormats>
18961893

18971894
export function createComposer<
18981895
Schema extends object = DefaultLocaleMessageSchema,
@@ -1919,10 +1916,7 @@ export function createComposer<
19191916
> extends Record<string, any>
19201917
? NonNullable<Options['numberFormats']>
19211918
: {}
1922-
>(
1923-
options: Options,
1924-
VueI18nLegacy?: any
1925-
): Composer<Messages, DateTimeFormats, NumberFormats>
1919+
>(options: Options): Composer<Messages, DateTimeFormats, NumberFormats>
19261920

19271921
/**
19281922
* Create composer interface factory

0 commit comments

Comments
 (0)