Skip to content

Commit a63564d

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/concept-npm-requests
2 parents 45e986a + 737eb13 commit a63564d

7 files changed

Lines changed: 1053 additions & 1081 deletions

File tree

.nuxtrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
setups.@nuxt/test-utils="3.23.0"
1+
setups.@nuxt/test-utils="4.0.0"

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
"dependencies": {
2222
"better-sqlite3": "12.5.0",
2323
"docus": "5.4.4",
24-
"nuxt": "4.3.0"
24+
"nuxt": "4.3.1"
2525
}
2626
}

lunaria/prepare-json-files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async function mergeLocale(locale: LocaleObject): Promise<void> {
8888

8989
await fs.writeFile(
9090
path.resolve(`${destFolder}/${locale.code}.json`),
91-
JSON.stringify(source, null, 2),
91+
`${JSON.stringify(source, null, 2)}\n`,
9292
'utf-8',
9393
)
9494
}

nuxt.config.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,6 @@ import { isCI, provider } from 'std-env'
44

55
export default defineNuxtConfig({
66
modules: [
7-
// Workaround for Nuxt 4.3.0 regression: https://github.com/nuxt/nuxt/issues/34140
8-
// shared-imports.d.ts pulls in app composables during type-checking of shared context,
9-
// but the shared context doesn't have access to auto-import globals.
10-
// TODO: Remove when Nuxt fixes this upstream
11-
function (_, nuxt) {
12-
nuxt.hook('prepare:types', ({ sharedReferences }) => {
13-
const idx = sharedReferences.findIndex(
14-
ref => 'path' in ref && ref.path.endsWith('shared-imports.d.ts'),
15-
)
16-
if (idx !== -1) {
17-
sharedReferences.splice(idx, 1)
18-
}
19-
})
20-
},
217
'@unocss/nuxt',
228
'@nuxtjs/html-validator',
239
'@nuxt/scripts',

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@
6161
"@nuxt/a11y": "1.0.0-alpha.1",
6262
"@nuxt/fonts": "0.13.0",
6363
"@nuxt/scripts": "0.13.2",
64-
"@nuxt/test-utils": "https://pkg.pr.new/@nuxt/test-utils@1499a48",
64+
"@nuxt/test-utils": "4.0.0",
6565
"@nuxtjs/color-mode": "4.0.0",
6666
"@nuxtjs/html-validator": "2.1.0",
67-
"@nuxtjs/i18n": "10.2.1",
67+
"@nuxtjs/i18n": "10.2.3",
6868
"@shikijs/langs": "3.21.0",
6969
"@shikijs/themes": "3.21.0",
7070
"@unocss/nuxt": "66.6.0",
@@ -83,7 +83,7 @@
8383
"gray-matter": "4.0.3",
8484
"marked": "17.0.1",
8585
"module-replacements": "2.11.0",
86-
"nuxt": "4.3.0",
86+
"nuxt": "4.3.1",
8787
"nuxt-og-image": "5.1.13",
8888
"ofetch": "1.5.1",
8989
"ohash": "2.0.11",

pnpm-lock.yaml

Lines changed: 1026 additions & 1058 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/compare-translations.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,25 @@ const logSection = (
209209
}
210210

211211
const processLocale = async (
212+
singleLocale: boolean,
212213
localeFile: string,
213214
referenceContent: NestedObject,
214215
fix = false,
215216
): Promise<SyncStats> => {
216217
const filePath = join(LOCALES_DIRECTORY, localeFile)
217218
const localeInfo = checkJsonName(filePath)
219+
220+
// prevent updating wrong locale file:
221+
// - language locale files at countries allowed: e.g. es.json
222+
// - country locale file forbidden: e.g. es-ES.json
223+
// - target locale file forbidden: e.g. es-419.json
224+
if (fix && localeInfo.mergeLocale && singleLocale) {
225+
console.error(
226+
`${COLORS.red}Error: Locale "${localeInfo.locale}" cannot be fixed, fix the ${localeInfo.lang} locale instead!${COLORS.reset}`,
227+
)
228+
process.exit(1)
229+
}
230+
218231
const targetContent = await loadJson(localeInfo)
219232

220233
const stats: SyncStats = {
@@ -226,7 +239,7 @@ const processLocale = async (
226239
const newContent = syncLocaleData(referenceContent, targetContent, stats, fix)
227240

228241
// Write if there are removals (always) or we are in fix mode
229-
if (stats.extra.length > 0 || fix) {
242+
if (!localeInfo.mergeLocale && (stats.extra.length > 0 || fix)) {
230243
writeFileSync(filePath, JSON.stringify(newContent, null, 2) + '\n', 'utf-8')
231244
}
232245

@@ -246,7 +259,12 @@ const runSingleLocale = async (
246259
process.exit(1)
247260
}
248261

249-
const { missing, extra, referenceKeys } = await processLocale(localeFile, referenceContent, fix)
262+
const { missing, extra, referenceKeys } = await processLocale(
263+
true,
264+
localeFile,
265+
referenceContent,
266+
fix,
267+
)
250268

251269
console.log(
252270
`${COLORS.cyan}=== Missing keys for ${localeFile}${fix ? ' (with --fix)' : ''} ===${COLORS.reset}`,
@@ -286,7 +304,7 @@ const runAllLocales = async (referenceContent: NestedObject, fix = false): Promi
286304
let totalAdded = 0
287305

288306
for (const localeFile of localeFiles) {
289-
const stats = await processLocale(localeFile, referenceContent, fix)
307+
const stats = await processLocale(false, localeFile, referenceContent, fix)
290308
results.push({
291309
file: localeFile,
292310
...stats,

0 commit comments

Comments
 (0)