Skip to content

Commit 8e8a8da

Browse files
sampottscursoragent
andcommitted
refactor(packages): use flat default-export locale re-exports
Replace locales/en/index.ts with flat en.ts in html and react, fix react package export paths to *.d.ts, and add explicit react tsdown locale entries ahead of the locale-packs PR. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d940d16 commit 8e8a8da

7 files changed

Lines changed: 23 additions & 8 deletions

File tree

packages/html/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
"build:watch": "tsdown --watch ./src --no-clean",
144144
"dev": "pnpm run build:watch",
145145
"test": "vitest run",
146-
"clean": "rimraf --glob dist cdn docs types '*.tsbuildinfo'",
146+
"clean": "rimraf --glob dist cdn docs types '*.tsbuildinfo' 'src/i18n/**/*.d.ts' 'src/i18n/**/*.d.ts.map'",
147147
"prepack": "node --import tsx ../../site/scripts/copy-package-docs.ts html"
148148
},
149149
"dependencies": {
File renamed without changes.

packages/html/src/i18n/locales/en/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/html/tsdown.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const createConfig = (mode: PackageBuildMode): UserConfig => ({
3939
entry: {
4040
index: 'src/index.ts',
4141
'i18n/index': 'src/i18n/index.ts',
42-
'i18n/locales/en': 'src/i18n/locales/en/index.ts',
42+
'i18n/locales/en': 'src/i18n/locales/en.ts',
4343
...iconEntries,
4444
...defineEntries,
4545
...presetEntries,

packages/react/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@
100100
"default": "./dist/default/i18n/index.js"
101101
},
102102
"./i18n/locales/*": {
103-
"types": "./dist/dev/i18n/locales/*/index.d.ts",
104-
"development": "./dist/dev/i18n/locales/*/index.js",
105-
"default": "./dist/default/i18n/locales/*/index.js"
103+
"types": "./dist/dev/i18n/locales/*.d.ts",
104+
"development": "./dist/dev/i18n/locales/*.js",
105+
"default": "./dist/default/i18n/locales/*.js"
106106
}
107107
},
108108
"scripts": {
@@ -111,7 +111,7 @@
111111
"dev": "pnpm build:watch",
112112
"test": "vitest run",
113113
"test:watch": "vitest",
114-
"clean": "rimraf --glob dist docs types '*.tsbuildinfo'",
114+
"clean": "rimraf --glob dist docs types '*.tsbuildinfo' 'src/i18n/**/*.d.ts' 'src/i18n/**/*.d.ts.map'",
115115
"prepack": "node --import tsx ../../site/scripts/copy-package-docs.ts react"
116116
},
117117
"peerDependencies": {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from '@videojs/core/i18n/locales/en';

packages/react/tsdown.config.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { globSync } from 'node:fs';
12
import { dirname, resolve } from 'node:path';
23
import { fileURLToPath } from 'node:url';
34
import type { UserConfig } from 'tsdown';
@@ -7,9 +8,23 @@ import { type PackageBuildMode, packageBuildConfig, packageBuildModes } from '..
78

89
const skinsDir = resolve(dirname(fileURLToPath(import.meta.url)), '../skins/src');
910

11+
const indexEntries = Object.fromEntries(
12+
globSync('src/**/index.{ts,tsx}').map((file) => {
13+
const key = file.replace('src/', '').replace(/\.tsx?$/, '');
14+
return [key, file];
15+
})
16+
);
17+
18+
const i18nLocaleEntries = {
19+
'i18n/locales/en': 'src/i18n/locales/en.ts',
20+
};
21+
1022
const createConfig = (mode: PackageBuildMode): UserConfig => ({
1123
...packageBuildConfig(mode, 'browser'),
12-
entry: 'src/**/index.{ts,tsx}',
24+
entry: {
25+
...indexEntries,
26+
...i18nLocaleEntries,
27+
},
1328
noExternal: [/^@videojs\/skins/],
1429
alias: {
1530
'@': new URL('./src', import.meta.url).pathname,

0 commit comments

Comments
 (0)