Skip to content

Commit 28ef521

Browse files
committed
fix: export lite module for petite-vue-i18n
1 parent f3aefb6 commit 28ef521

File tree

19 files changed

+360
-202
lines changed

19 files changed

+360
-202
lines changed

eslint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ export default [
9595
'shim.d.ts',
9696
'.eslintcache',
9797
'.eslintrc.cjs',
98+
'packages/*/vite.config.ts',
9899
'packages/*/index.js',
100+
'packages/vue-i18n-core/petite.js',
99101
'docsgen.config.js',
100102
'scripts/api/*.js'
101103
]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"bench:simple-jit-aot": "node --expose-gc ./benchmark/simple-jit-aot.mjs",
2525
"build": "tsx ./scripts/build.ts",
2626
"build:explorer": "pnpm --filter @intlify/message-format-explorer build",
27+
"build:rolldown": "tsx ./scripts/build-rolldown.ts",
2728
"build:size": "pnpm build && run-p build:size-*",
2829
"build:size-core": "pnpm --filter @intlify/size-check-core build",
2930
"build:size-petite-vue-i18n": "pnpm --filter @intlify/size-check-petite-vue-i18n build",
@@ -74,7 +75,6 @@
7475
"preview:size-vue-i18n": "pnpm --filter @intlify/size-check-vue-i18n preview",
7576
"release": "bumpp package.json packages/**/package.json --commit \"release: v\" --push --tag",
7677
"size": "tsx ./scripts/build.ts --size && tsx ./scripts/size.ts",
77-
"build:rolldown": "tsx ./scripts/build-rolldown.ts",
7878
"size:report": "tsx ./scripts/report-size.ts",
7979
"test": "run-s lint test:cover check-install test:e2e",
8080
"test:cover": "pnpm test:unit --coverage",

packages/petite-vue-i18n/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"dependencies": {
3838
"@intlify/core-base": "workspace:*",
3939
"@intlify/shared": "workspace:*",
40+
"@intlify/vue-i18n-core": "workspace:*",
4041
"@vue/devtools-api": "^6.5.0"
4142
},
4243
"devDependencies": {

packages/petite-vue-i18n/src/index.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
setDevToolsHook
55
} from '@intlify/core-base'
66
import { getGlobalThis } from '@intlify/shared'
7-
import { initDev, initFeatureFlags } from '../../vue-i18n-core/src/misc'
7+
import { initDev, initFeatureFlags } from '@intlify/vue-i18n-core/petite'
88

99
if (__ESM_BUNDLER__ && !__TEST__) {
1010
initFeatureFlags()
@@ -47,10 +47,13 @@ export type {
4747
RemovedIndexResources,
4848
TranslateOptions
4949
} from '@intlify/core-base'
50+
export { createI18n, useI18n, VERSION } from '@intlify/vue-i18n-core/petite'
5051
export type {
5152
Composer,
53+
ComposerAdditionalOptions,
5254
ComposerCustom,
5355
ComposerDateTimeFormatting,
56+
ComposerExtender,
5457
ComposerNumberFormatting,
5558
ComposerOptions,
5659
ComposerResolveLocaleMessageTranslation,
@@ -63,21 +66,19 @@ export type {
6366
DefineDateTimeFormat,
6467
DefineLocaleMessage,
6568
DefineNumberFormat,
66-
MissingHandler,
67-
VueMessageType
68-
} from '../../vue-i18n-core/src/composer'
69-
export { createI18n, useI18n } from '../../vue-i18n-core/src/i18n'
70-
export type {
71-
ComposerAdditionalOptions,
72-
ComposerExtender,
69+
Disposer,
7370
ExportedGlobalComposer,
7471
I18n,
7572
I18nAdditionalOptions,
7673
I18nMode,
7774
I18nOptions,
75+
I18nPluginOptions,
7876
I18nScope,
79-
UseI18nOptions
80-
} from '../../vue-i18n-core/src/i18n'
77+
MissingHandler,
78+
UseI18nOptions,
79+
VueMessageType
80+
} from '@intlify/vue-i18n-core/petite'
81+
8182
export type {
8283
Choice,
8384
DateTimeFormatResult,
@@ -93,10 +94,7 @@ export type {
9394
VueI18nResolveLocaleMessageTranslation,
9495
VueI18nTranslation,
9596
WarnHtmlInMessageLevel
96-
} from '../../vue-i18n-core/src/legacy'
97-
export type { I18nPluginOptions } from '../../vue-i18n-core/src/plugin'
98-
export { VERSION } from './../../vue-i18n-core/src/misc'
99-
export type { Disposer } from './../../vue-i18n-core/src/types'
97+
} from '@intlify/vue-i18n-core/petite'
10098

10199
export type {
102100
IsEmptyObject,

packages/petite-vue-i18n/src/runtime.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
setDevToolsHook
55
} from '@intlify/core-base'
66
import { getGlobalThis } from '@intlify/shared'
7-
import { initDev, initFeatureFlags } from '../../vue-i18n-core/src/misc'
7+
import { initDev, initFeatureFlags } from '@intlify/vue-i18n-core/petite'
88

99
if (__ESM_BUNDLER__ && !__TEST__) {
1010
initFeatureFlags()
@@ -46,56 +46,51 @@ export type {
4646
RemovedIndexResources,
4747
TranslateOptions
4848
} from '@intlify/core-base'
49+
export { createI18n, useI18n, VERSION } from '@intlify/vue-i18n-core/petite'
4950
export type {
51+
Choice,
5052
Composer,
53+
ComposerAdditionalOptions,
5154
ComposerCustom,
5255
ComposerDateTimeFormatting,
56+
ComposerExtender,
5357
ComposerNumberFormatting,
5458
ComposerOptions,
5559
ComposerResolveLocaleMessageTranslation,
5660
ComposerTranslation,
5761
CustomBlock,
5862
CustomBlocks,
63+
DateTimeFormatResult,
5964
DefaultDateTimeFormatSchema,
6065
DefaultLocaleMessageSchema,
6166
DefaultNumberFormatSchema,
6267
DefineDateTimeFormat,
6368
DefineLocaleMessage,
6469
DefineNumberFormat,
65-
MissingHandler,
66-
VueMessageType
67-
} from '../../vue-i18n-core/src/composer'
68-
export { createI18n, useI18n } from '../../vue-i18n-core/src/i18n'
69-
export type {
70-
ComposerAdditionalOptions,
71-
ComposerExtender,
70+
Disposer,
7271
ExportedGlobalComposer,
7372
I18n,
7473
I18nAdditionalOptions,
7574
I18nMode,
7675
I18nOptions,
76+
I18nPluginOptions,
7777
I18nScope,
78-
UseI18nOptions
79-
} from '../../vue-i18n-core/src/i18n'
80-
export type {
81-
Choice,
82-
DateTimeFormatResult,
8378
LocaleMessageObject,
79+
MissingHandler,
8480
NumberFormatResult,
8581
PluralizationRulesMap,
8682
TranslateResult,
83+
UseI18nOptions,
8784
VueI18n,
8885
VueI18nDateTimeFormatting,
8986
VueI18nExtender,
9087
VueI18nNumberFormatting,
9188
VueI18nOptions,
9289
VueI18nResolveLocaleMessageTranslation,
9390
VueI18nTranslation,
91+
VueMessageType,
9492
WarnHtmlInMessageLevel
95-
} from '../../vue-i18n-core/src/legacy'
96-
export type { I18nPluginOptions } from '../../vue-i18n-core/src/plugin'
97-
export { VERSION } from './../../vue-i18n-core/src/misc'
98-
export type { Disposer } from './../../vue-i18n-core/src/types'
93+
} from '@intlify/vue-i18n-core/petite'
9994

10095
export type {
10196
IsEmptyObject,

packages/petite-vue-i18n/src/vue.d.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
import type { NamedValue, JsonPaths } from '@intlify/core-base'
21
import type {
3-
TranslateOptions,
2+
IsEmptyObject,
43
IsNever,
5-
IsEmptyObject
4+
NamedValue,
5+
TranslateOptions
66
} from '@intlify/core-base'
7-
import type { CustomBlocks } from '../../vue-i18n-core/src/composer'
87
import type {
8+
CustomBlocks,
99
DefineLocaleMessage,
10-
RemovedIndexResources
11-
} from '../../vue-i18n-core/src/composer'
12-
import type {
10+
ExportedGlobalComposer,
11+
RemovedIndexResources,
12+
TranslateResult,
1313
VueI18n,
14-
VueI18nOptions,
15-
TranslateResult
16-
} from '../../vue-i18n-core/src/legacy'
17-
import type { ExportedGlobalComposer } from '../../vue-i18n-core/src/i18n'
14+
VueI18nOptions
15+
} from '@intlify/vue-i18n-core/petite'
1816

1917
// --- THE CONTENT BELOW THIS LINE WILL BE APPENDED TO DTS FILE IN DIST DIRECTORY --- //
18+
19+
import type { JsonPaths } from '@intlify/core-base'
20+
2021
declare module 'vue' {
2122
/**
2223
* Component Custom Options for Vue I18n
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../api-extractor.json",
3+
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/petite.d.ts",
4+
"dtsRollup": {
5+
"publicTrimmedFilePath": "./dist/petite-vue-i18n-core.d.ts"
6+
}
7+
}

packages/vue-i18n-core/package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
},
6060
"exports": {
6161
".": {
62+
"types": "./dist/vue-i18n-core.d.ts",
6263
"import": "./dist/vue-i18n-core.mjs",
6364
"browser": "./dist/vue-i18n-core.esm-browser.js",
6465
"node": {
@@ -74,6 +75,23 @@
7475
}
7576
}
7677
},
78+
"./petite": {
79+
"types": "./dist/petite-vue-i18n-core.d.ts",
80+
"import": "./dist/petite-vue-i18n-core.mjs",
81+
"browser": "./dist/petite-vue-i18n-core.esm-browser.js",
82+
"node": {
83+
"import": {
84+
"production": "./petite-dist/vue-i18n-core.prod.cjs",
85+
"development": "./petite-dist/vue-i18n-core.mjs",
86+
"default": "./dist/petite-vue-i18n-core.mjs"
87+
},
88+
"require": {
89+
"production": "./dist/petite-vue-i18n-core.prod.cjs",
90+
"development": "./dist/petite-vue-i18n-core.cjs",
91+
"default": "./petite.js"
92+
}
93+
}
94+
},
7795
"./dist/*": "./dist/*",
7896
"./package.json": "./package.json"
7997
},

packages/vue-i18n-core/petite.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict'
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./dist/petite-vue-i18n-core.prod.cjs')
5+
} else {
6+
module.exports = require('./dist/petite-vue-i18n-core.cjs')
7+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export type {
9797
VueI18nTranslation,
9898
WarnHtmlInMessageLevel
9999
} from './legacy'
100-
export { VERSION } from './misc'
100+
export { initDev, initFeatureFlags, VERSION } from './misc'
101101
export type { I18nPluginOptions } from './plugin'
102102
export type { Disposer } from './types'
103103

0 commit comments

Comments
 (0)