Skip to content

Commit

Permalink
umd panic
Browse files Browse the repository at this point in the history
  • Loading branch information
eddow committed May 14, 2024
1 parent 043f08b commit a5adfef
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 23 deletions.
35 changes: 33 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "omni18n",
"version": "1.1.2",
"version": "1.1.3",
"description": "",
"main": "dist/index.js",
"module": "dist/index.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
"type": "module",
"scripts": {
Expand Down Expand Up @@ -40,6 +40,7 @@
"prettier": "^3.2.5",
"rollup": "^4.16.4",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-typescript": "^1.0.1",
"rollup-plugin-typescript2": "^0.36.0",
"ts-jest": "^29.1.2",
"tslib": "^2.6.2",
Expand Down
56 changes: 39 additions & 17 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,43 @@ import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from 'rollup-plugin-typescript2'

export default {
input: './src/index.ts',
output: {
file: 'dist/index.js',
format: 'cjs'
export default [
{
input: './src/index.ts',
output: {
file: 'dist/index.js',
sourcemap: true,
format: 'cjs'
},
external: ['hjson'],
plugins: [
resolve(),
commonjs(),
typescript({
tsconfigOverride: {
include: ['./src'],
exclude: ['./node_modules']
}
})
]
},
external: ['hjson'],
plugins: [
resolve(),
commonjs(),
typescript({
tsconfigOverride: {
include: ['./src'],
exclude: ['./node_modules']
}
})
]
}
{
input: './src/index.ts',
output: {
file: 'dist/index.esm.js',
sourcemap: true,
format: 'esm'
},
external: ['hjson'],
plugins: [
resolve(),
commonjs(),
typescript({
tsconfigOverride: {
include: ['./src'],
exclude: ['./node_modules']
}
})
]
}
]
4 changes: 2 additions & 2 deletions src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function localeTree(locale: Locale) {
}

// Remove duplicates while keeping the order
function removeDup(arr: string[]) {
function removeDuplicates(arr: string[]) {
const done = new Set<string>()
return arr.filter((k) => !done.has(k) && done.add(k))
}
Expand All @@ -40,7 +40,7 @@ export default class I18nServer<KeyInfos extends {} = {}, TextInfos extends {} =
private list(locales: Locale[], zone: Zone): Promise<RawDictionary> {
const [primary, ...fallbacks] = locales
return this.db.list(
removeDup([...localeTree(primary), '', ...fallbacks.map(localeTree).flat()]),
removeDuplicates([...localeTree(primary), '', ...fallbacks.map(localeTree).flat()]),
zone
)
}
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"moduleResolution": "Node",
"target": "es2015",
"module": "ESNext",
"outDir": "./dist",
Expand Down

0 comments on commit a5adfef

Please sign in to comment.