Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"@types/minimist": "^1.2.5",
"@types/node": "^22.5.3",
"@types/rc": "^1.2.4",
"@vitest/coverage-v8": "^2.0.0",
"@vitest/coverage-v8": "^2.1.5",
"api-docs-gen": "^0.4.0",
"benchmark": "^2.1.4",
"brotli": "^1.3.2",
Expand Down Expand Up @@ -145,7 +145,7 @@
"typescript": "^5.5.3",
"typescript-eslint": "^8.4.0",
"vitepress": "1.5.0",
"vitest": "^2.0.4",
"vitest": "^2.1.5",
"vue": "3.5.12",
"vue-i18n": "workspace:*"
},
Expand Down Expand Up @@ -177,7 +177,7 @@
"pnpm": {
"overrides": {
"vue": "3.5.12",
"vite": "^5.1.2"
"vite": "^5.4.11"
}
}
}
60 changes: 59 additions & 1 deletion packages/size-check-petite-vue-i18n/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,69 @@ import { createApp } from 'vue'
import { createI18n } from 'vue-i18n'
import App from './App.vue'

const ast = {
type: 0,
start: 0,
end: 6,
loc: {
start: {
line: 1,
column: 1,
offset: 0
},
end: {
line: 1,
column: 7,
offset: 6
},
source: 'hello!'
},
body: {
type: 2,
start: 0,
end: 6,
loc: {
start: {
line: 1,
column: 1,
offset: 0
},
end: {
line: 1,
column: 7,
offset: 6
}
},
items: [
{
type: 3,
start: 0,
end: 6,
loc: {
start: {
line: 1,
column: 1,
offset: 0
},
end: {
line: 1,
column: 7,
offset: 6
}
},
value: 'hello!'
}
],
static: 'hello!'
},
cacheKey: '{"l":"en","k":"hello","s":"hello!"}'
}

const i18n = createI18n({
locale: 'en',
messages: {
en: {
hello: 'hello!'
hello: ast
}
}
})
Expand Down
176 changes: 85 additions & 91 deletions packages/vue-i18n-core/src/composer.ts
Original file line number Diff line number Diff line change
@@ -1,118 +1,118 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { ref, computed, getCurrentInstance, watch, shallowRef } from 'vue'
import {
warn,
isArray,
isFunction,
isNumber,
isString,
isRegExp,
isBoolean,
isPlainObject,
isObject,
assign,
inBrowser,
deepCopy,
hasOwn
} from '@intlify/shared'
import {
isTranslateFallbackWarn,
isTranslateMissingWarn,
createCoreContext,
DEFAULT_LOCALE,
MISSING_RESOLVE_VALUE,
updateFallbackLocale,
translate,
parseTranslateArgs,
datetime,
parseDateTimeArgs,
MessageFunction,
NOT_REOSLVED,
clearDateTimeFormat,
number,
parseNumberArgs,
clearNumberFormat,
createCoreContext,
datetime,
fallbackWithLocaleChain,
NOT_REOSLVED,
MessageFunction,
setAdditionalMeta,
getFallbackContext,
setFallbackContext,
DEFAULT_LOCALE,
isMessageAST,
isMessageFunction
isMessageFunction,
isTranslateFallbackWarn,
isTranslateMissingWarn,
number,
parseDateTimeArgs,
parseNumberArgs,
parseTranslateArgs,
setAdditionalMeta,
setFallbackContext,
translate,
updateFallbackLocale
} from '@intlify/core-base'
import { I18nWarnCodes, getWarnMessage } from './warnings'
import {
assign,
deepCopy,
hasOwn,
inBrowser,
isArray,
isBoolean,
isFunction,
isNumber,
isObject,
isPlainObject,
isRegExp,
isString,
warn
} from '@intlify/shared'
import { computed, getCurrentInstance, ref, shallowRef, watch } from 'vue'
import { I18nErrorCodes, createI18nError } from './errors'
import { VERSION } from './misc'
import {
TranslateVNodeSymbol,
DatetimePartsSymbol,
NumberPartsSymbol,
EnableEmitter,
DisableEmitter,
EnableEmitter,
InejctWithOptionSymbol,
NumberPartsSymbol,
SetPluralRulesSymbol,
InejctWithOptionSymbol
TranslateVNodeSymbol
} from './symbols'
import {
getLocaleMessages,
getComponentOptions,
createTextNode,
getComponentOptions,
getLocaleMessages,
handleFlatJson
} from './utils'
import { VERSION } from './misc'
import { I18nWarnCodes, getWarnMessage } from './warnings'

import type {
ComponentInternalInstance,
VNode,
VNodeArrayChildren,
WritableComputedRef,
ComputedRef
} from 'vue'
import type {
Path,
MessageResolver,
MessageCompiler,
CoreContext,
CoreInternalContext,
CoreMissingHandler,
CoreMissingType,
DateTimeFormat,
DateTimeFormats as DateTimeFormatsType,
DateTimeOptions,
FallbackLocale,
FallbackLocales,
GeneratedLocale,
IsEmptyObject,
IsNever,
JsonPaths,
LinkedModifiers,
PluralizationRules,
NamedValue,
MessageFunctions,
MessageProcessor,
MessageType,
Locale,
LocaleMessageValue,
LocaleMessage,
LocaleMessages,
CoreContext,
CoreMissingHandler,
LocaleMessageDictionary,
PostTranslationHandler,
FallbackLocale,
CoreInternalContext,
TranslateOptions,
DateTimeOptions,
NumberOptions,
DateTimeFormats as DateTimeFormatsType,
NumberFormats as NumberFormatsType,
DateTimeFormat,
NumberFormat,
LocaleMessageValue,
LocaleMessages,
LocaleParams,
MessageCompiler,
MessageFunctions,
MessageProcessor,
MessageResolver,
MessageType,
MetaInfo,
PickupLocales,
PickupKeys,
NamedValue,
NumberFormat,
NumberFormats as NumberFormatsType,
NumberOptions,
Path,
PickupFormatKeys,
FallbackLocales,
SchemaParams,
LocaleParams,
ResourceValue,
ResourcePath,
ResourceNode,
PickupFormatPathKeys,
PickupKeys,
PickupLocales,
PluralizationRules,
PostTranslationHandler,
RemoveIndexSignature,
RemovedIndexResources,
IsNever,
IsEmptyObject,
CoreMissingType,
JsonPaths,
TranslationsPaths,
GeneratedLocale
ResourceNode,
ResourcePath,
ResourceValue,
SchemaParams,
TranslateOptions,
TranslationsPaths
} from '@intlify/core-base'
import type { VueDevToolsEmitter } from '@intlify/devtools-types'
import type {
ComponentInternalInstance,
ComputedRef,
VNode,
VNodeArrayChildren,
WritableComputedRef
} from 'vue'

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

Expand Down Expand Up @@ -1889,10 +1889,7 @@ export function createComposer<
> = Options['numberFormats'] extends Record<string, any>
? Options['numberFormats']
: {}
>(
options: Options,
VueI18nLegacy?: any
): Composer<Messages, DateTimeFormats, NumberFormats>
>(options: Options): Composer<Messages, DateTimeFormats, NumberFormats>

export function createComposer<
Schema extends object = DefaultLocaleMessageSchema,
Expand All @@ -1919,10 +1916,7 @@ export function createComposer<
> extends Record<string, any>
? NonNullable<Options['numberFormats']>
: {}
>(
options: Options,
VueI18nLegacy?: any
): Composer<Messages, DateTimeFormats, NumberFormats>
>(options: Options): Composer<Messages, DateTimeFormats, NumberFormats>

/**
* Create composer interface factory
Expand Down
Loading
Loading