Skip to content

Commit

Permalink
i18n: use esm import instead of require
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed May 12, 2024
1 parent 7f5926a commit 895f2bc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface AtomicTypes {
SharedArrayBuffer: SharedArrayBuffer
}

export type Indexable = string | number
export type Indexable = string | number | bigint
export type Comparable = string | number | boolean | bigint | Date

type FlatWrap<S, A extends 0[], P extends string> = { [K in P]?: S }
Expand Down
6 changes: 4 additions & 2 deletions packages/mongo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Binary, Dict, isNullable, makeArray, mapValues, noop, omit, pick } from
import { Driver, Eval, executeUpdate, hasSubquery, Query, RuntimeError, Selection, z } from 'minato'
import { URLSearchParams } from 'url'
import { Builder } from './builder'
import zhCN from './locales/zh-CN.yml'
import enUS from './locales/en-US.yml'

const tempKey = '__temp_minato_mongo__'

Expand Down Expand Up @@ -533,8 +535,8 @@ export namespace MongoDriver {
journal: z.boolean(),
}),
}).i18n({
'en-US': require('./locales/en-US'),
'zh-CN': require('./locales/zh-CN'),
'en-US': enUS,
'zh-CN': zhCN,
})
}

Expand Down
6 changes: 4 additions & 2 deletions packages/mysql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type { OkPacket, Pool, PoolConfig, PoolConnection } from 'mysql'
import { Driver, Eval, executeUpdate, Field, RuntimeError, Selection, z } from 'minato'
import { escapeId, isBracketed } from '@minatojs/sql-utils'
import { Compat, MySQLBuilder } from './builder'
import zhCN from './locales/zh-CN.yml'
import enUS from './locales/en-US.yml'

declare module 'mysql' {
interface UntypedFieldInfo {
Expand Down Expand Up @@ -602,8 +604,8 @@ export namespace MySQLDriver {
]) as any,
}),
]).i18n({
'en-US': require('./locales/en-US'),
'zh-CN': require('./locales/zh-CN'),
'en-US': enUS,
'zh-CN': zhCN,
})
}

Expand Down
6 changes: 4 additions & 2 deletions packages/postgres/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Binary, Dict, difference, isNullable, makeArray, pick } from 'cosmokit'
import { Driver, Eval, executeUpdate, Field, Selection, z } from 'minato'
import { isBracketed } from '@minatojs/sql-utils'
import { escapeId, formatTime, PostgresBuilder } from './builder'
import zhCN from './locales/zh-CN.yml'
import enUS from './locales/en-US.yml'

interface ColumnInfo {
table_catalog: string
Expand Down Expand Up @@ -491,8 +493,8 @@ export namespace PostgresDriver {
password: z.string().role('secret'),
database: z.string().required(),
}).i18n({
'en-US': require('./locales/en-US'),
'zh-CN': require('./locales/zh-CN'),
'en-US': enUS,
'zh-CN': zhCN,
})
}

Expand Down

0 comments on commit 895f2bc

Please sign in to comment.