appos 0.3.5-0 → 0.3.7-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/main.mjs +3 -3
- package/dist/bin/youch-handler-D7REmh8Z.mjs +2 -0
- package/dist/exports/api/adapter-C2mMJKvG.mjs +1504 -0
- package/dist/exports/api/{auth-schema.mjs → auth-schema-CON4yFFY.mjs} +2 -3
- package/dist/exports/api/bun-sqlite-dialect-CPpPZa23.mjs +155 -0
- package/dist/exports/{cli/_virtual/rolldown_runtime.mjs → api/chunk-CyXqrcp_.mjs} +14 -1
- package/dist/exports/api/conditions-DjBAWfiK.mjs +116 -0
- package/dist/exports/api/dialect-CUUD24Ge.mjs +72 -0
- package/dist/exports/api/env-CwT3zhez.mjs +1 -0
- package/dist/exports/api/esm-_hkVMulx.mjs +15816 -0
- package/dist/exports/api/event-BHFSE6hY.mjs +20983 -0
- package/dist/exports/api/extract-blob-metadata-BMgUEPcW.mjs +4 -0
- package/dist/exports/api/extract-blob-metadata-_9RUEwoU.mjs +9818 -0
- package/dist/exports/api/generate-image-variant-DOIzj1wJ.mjs +4 -0
- package/dist/exports/api/generate-image-variant-DxOPoGAk.mjs +118 -0
- package/dist/exports/api/generate-preview-CvTFuq58.mjs +160 -0
- package/dist/exports/api/generate-preview-Dk3coswZ.mjs +4 -0
- package/dist/exports/api/index.d.mts +7347 -20
- package/dist/exports/api/index.mjs +146856 -18
- package/dist/exports/api/kysely-adapter-CmP2TbkS.mjs +296 -0
- package/dist/exports/api/memory-adapter-BzhRhLFK.mjs +212 -0
- package/dist/exports/api/node-sqlite-dialect-Bl5suBxl.mjs +155 -0
- package/dist/exports/api/orm-CMqufD21.mjs +153690 -0
- package/dist/exports/api/orm-DXqYuKvB.d.mts +11 -0
- package/dist/exports/api/orm.d.mts +2 -11
- package/dist/exports/api/orm.mjs +4 -42
- package/dist/exports/api/pdf-YxB2Hm1p.mjs +25822 -0
- package/dist/exports/api/purge-attachment-Cf6KH2Jv.mjs +34 -0
- package/dist/exports/api/purge-attachment-DIuil7ps.mjs +4 -0
- package/dist/exports/{cli/api/workflows/purge-audit-logs.mjs → api/purge-audit-logs-z6j_Pu47.mjs} +3 -3
- package/dist/exports/{cli/api/workflows/purge-unattached-blobs.mjs → api/purge-unattached-blobs-B0TfY5Hk.mjs} +1 -1
- package/dist/exports/api/react-BYhV5bYt.mjs +1131 -0
- package/dist/exports/api/server.node-DyVrQ6cz.mjs +19298 -0
- package/dist/exports/api/table-6bTIEqON.mjs +2636 -0
- package/dist/exports/api/{workflows/track-db-changes.mjs → track-db-changes-BysaV6nN.mjs} +14 -14
- package/dist/exports/api/{workflow.mjs → workflow-BuSWHcX-.mjs} +121 -10
- package/dist/exports/api/workflows/auth-schema-BFve3hgZ.mjs +2813 -0
- package/dist/exports/api/workflows/{_virtual/rolldown_runtime.mjs → chunk-B36mNPO4.mjs} +5 -1
- package/dist/exports/api/workflows/extract-blob-metadata-BcWKvY2K.mjs +9818 -0
- package/dist/exports/{cli/api/workflows/generate-image-variant.mjs → api/workflows/generate-image-variant-BAFvL_zV.mjs} +20 -20
- package/dist/exports/{cli/api/workflows/generate-preview.mjs → api/workflows/generate-preview-BjlIVYYp.mjs} +6 -6
- package/dist/exports/api/workflows/index.d.mts +2011 -1
- package/dist/exports/api/workflows/index.mjs +2 -1
- package/dist/exports/api/workflows/pdf-DUB8zyIc.mjs +25822 -0
- package/dist/exports/{cli/api/workflows/purge-attachment.mjs → api/workflows/purge-attachment-k_sdxTPY.mjs} +3 -3
- package/dist/exports/api/workflows/{purge-audit-logs.mjs → purge-audit-logs-zCyWj4Mw.mjs} +12 -3
- package/dist/exports/api/workflows/{purge-unattached-blobs.mjs → purge-unattached-blobs-CdsuFAeW.mjs} +1 -1
- package/dist/exports/api/workflows/track-db-changes-CiKaI9gT.mjs +20943 -0
- package/dist/exports/api/workflows/track-db-changes-DEWQYryO.mjs +4 -0
- package/dist/exports/{cli/api/workflow.mjs → api/workflows/workflow-BjM2xCa6.mjs} +23 -3
- package/dist/exports/api/workflows/zod-Br0enFWK.mjs +12333 -0
- package/dist/exports/api/zod-CdrJdBtV.mjs +12571 -0
- package/dist/exports/cli/auth-schema-CNuOqPi-.mjs +2813 -0
- package/dist/exports/{api/_virtual/rolldown_runtime.mjs → cli/chunk-B36mNPO4.mjs} +5 -1
- package/dist/exports/cli/extract-blob-metadata-CV1Ke90d.mjs +9818 -0
- package/dist/exports/{api/workflows/generate-image-variant.mjs → cli/generate-image-variant-CM1BrVvZ.mjs} +20 -20
- package/dist/exports/{api/workflows/generate-preview.mjs → cli/generate-preview-DdHQ3ukz.mjs} +6 -6
- package/dist/exports/cli/index.d.mts +2142 -2
- package/dist/exports/cli/index.mjs +41 -1
- package/dist/exports/cli/pdf-CLUPEIdT.mjs +25822 -0
- package/dist/exports/{api/workflows/purge-attachment.mjs → cli/purge-attachment-Dc_J74dG.mjs} +3 -3
- package/dist/exports/cli/purge-audit-logs-DFhWh-Bx.mjs +56 -0
- package/dist/exports/cli/purge-unattached-blobs-C1MRlM_2.mjs +46 -0
- package/dist/exports/cli/track-db-changes-CfneOF2_.mjs +20943 -0
- package/dist/exports/{api/workflows/api/workflow.mjs → cli/workflow-DSbbXBMt.mjs} +23 -3
- package/dist/exports/cli/zod-7q0_Mtnn.mjs +12333 -0
- package/dist/exports/tests/api.d.mts +7354 -5
- package/dist/exports/tests/api.mjs +79 -1
- package/dist/exports/tests/auth-schema-B_qHPoa4.mjs +1 -0
- package/dist/exports/tests/chunk-Cii4FAhs.mjs +1 -0
- package/dist/exports/tests/conditions-BeWxRN_Z.mjs +1 -0
- package/dist/exports/tests/constants-D_m07gCJ.mjs +1 -0
- package/dist/exports/tests/dist-Cx2HEBOB.mjs +296 -0
- package/dist/exports/tests/dist-DnACOvNW.mjs +7 -0
- package/dist/exports/tests/extract-blob-metadata-6xQrarjB.mjs +169 -0
- package/dist/exports/tests/generate-image-variant-KQITLmCx.mjs +1 -0
- package/dist/exports/tests/generate-preview-YnujQo5I.mjs +1 -0
- package/dist/exports/tests/mock-BvoS23fi.mjs +1 -0
- package/dist/exports/tests/mock.mjs +1 -1
- package/dist/exports/tests/pdf-lZ-as2o7.mjs +13 -0
- package/dist/exports/tests/purge-attachment-DTSmCl-z.mjs +1 -0
- package/dist/exports/tests/purge-audit-logs-D0_UUhN2.mjs +1 -0
- package/dist/exports/tests/purge-unattached-blobs-IENmSB8K.mjs +1 -0
- package/dist/exports/tests/react.mjs +6 -1
- package/dist/exports/tests/setup.d.mts +1 -1
- package/dist/exports/tests/setup.mjs +34 -1
- package/dist/exports/tests/table-CmPSf_pE.mjs +1 -0
- package/dist/exports/tests/track-db-changes-Td9Q3DLd.mjs +1 -0
- package/dist/exports/tests/{api/workflow.mjs → workflow-BWRWyC83.mjs} +1 -1
- package/dist/exports/tests/youch-handler-efUxKCCs.mjs +1 -0
- package/dist/exports/tests/zod-CkJO9qpV.mjs +23 -0
- package/dist/exports/vendors/date.js +13236 -1
- package/dist/exports/vendors/toolkit.js +2206 -1
- package/dist/exports/vendors/zod.js +12344 -1
- package/dist/exports/vite/index.d.mts +1 -1
- package/dist/exports/vite/index.mjs +26 -1
- package/dist/exports/vite/lib-B0s0q6aX.mjs +382 -0
- package/dist/exports/vite/lib-BkrbWMaV.mjs +1 -0
- package/dist/exports/web/browser-ponyfill-DxTJMXNq.js +443 -0
- package/dist/exports/web/chunk-DksrlJLg.js +49 -0
- package/dist/exports/web/index.d.ts +2546 -2
- package/dist/exports/web/index.js +9295 -6
- package/dist/exports/web/plugin-DqTFWG7p.js +250 -0
- package/package.json +1 -7
- package/dist/bin/youch-handler-DrYdbUhe.mjs +0 -2
- package/dist/exports/api/app-context.d.mts +0 -115
- package/dist/exports/api/app-context.mjs +0 -24
- package/dist/exports/api/auth-schema.d.mts +0 -4248
- package/dist/exports/api/auth.d.mts +0 -402
- package/dist/exports/api/auth.mjs +0 -188
- package/dist/exports/api/cache.d.mts +0 -44
- package/dist/exports/api/cache.mjs +0 -28
- package/dist/exports/api/config.d.mts +0 -28
- package/dist/exports/api/config.mjs +0 -72
- package/dist/exports/api/constants.mjs +0 -92
- package/dist/exports/api/container.d.mts +0 -210
- package/dist/exports/api/container.mjs +0 -49
- package/dist/exports/api/database.d.mts +0 -101
- package/dist/exports/api/database.mjs +0 -219
- package/dist/exports/api/event.d.mts +0 -235
- package/dist/exports/api/event.mjs +0 -236
- package/dist/exports/api/i18n.d.mts +0 -34
- package/dist/exports/api/i18n.mjs +0 -45
- package/dist/exports/api/instrumentation.d.mts +0 -7
- package/dist/exports/api/instrumentation.mjs +0 -40
- package/dist/exports/api/logger.d.mts +0 -21
- package/dist/exports/api/logger.mjs +0 -26
- package/dist/exports/api/mailer.d.mts +0 -70
- package/dist/exports/api/mailer.mjs +0 -37
- package/dist/exports/api/middleware/request-logger.d.mts +0 -24
- package/dist/exports/api/middleware.d.mts +0 -39
- package/dist/exports/api/middleware.mjs +0 -73
- package/dist/exports/api/openapi.d.mts +0 -271
- package/dist/exports/api/openapi.mjs +0 -507
- package/dist/exports/api/otel.d.mts +0 -40
- package/dist/exports/api/otel.mjs +0 -56
- package/dist/exports/api/redis.d.mts +0 -34
- package/dist/exports/api/redis.mjs +0 -41
- package/dist/exports/api/storage-schema.d.mts +0 -707
- package/dist/exports/api/storage-schema.mjs +0 -72
- package/dist/exports/api/storage.d.mts +0 -506
- package/dist/exports/api/storage.mjs +0 -833
- package/dist/exports/api/web/auth.mjs +0 -17
- package/dist/exports/api/workflow.d.mts +0 -250
- package/dist/exports/api/workflows/api/auth-schema.mjs +0 -373
- package/dist/exports/api/workflows/api/auth.d.mts +0 -379
- package/dist/exports/api/workflows/api/cache.d.mts +0 -44
- package/dist/exports/api/workflows/api/config.d.mts +0 -18
- package/dist/exports/api/workflows/api/container.d.mts +0 -167
- package/dist/exports/api/workflows/api/database.d.mts +0 -47
- package/dist/exports/api/workflows/api/event.d.mts +0 -68
- package/dist/exports/api/workflows/api/event.mjs +0 -126
- package/dist/exports/api/workflows/api/logger.d.mts +0 -21
- package/dist/exports/api/workflows/api/mailer.d.mts +0 -70
- package/dist/exports/api/workflows/api/orm.d.mts +0 -13
- package/dist/exports/api/workflows/api/redis.mjs +0 -3
- package/dist/exports/api/workflows/api/storage-schema.d.mts +0 -699
- package/dist/exports/api/workflows/api/storage.d.mts +0 -396
- package/dist/exports/api/workflows/api/workflow.d.mts +0 -24
- package/dist/exports/api/workflows/constants.mjs +0 -23
- package/dist/exports/api/workflows/extract-blob-metadata.mjs +0 -132
- package/dist/exports/api/workflows/generate-image-variant.d.mts +0 -63
- package/dist/exports/api/workflows/track-db-changes.d.mts +0 -72
- package/dist/exports/cli/api/auth-schema.mjs +0 -373
- package/dist/exports/cli/api/auth.d.mts +0 -379
- package/dist/exports/cli/api/cache.d.mts +0 -44
- package/dist/exports/cli/api/config.d.mts +0 -18
- package/dist/exports/cli/api/container.d.mts +0 -167
- package/dist/exports/cli/api/database.d.mts +0 -47
- package/dist/exports/cli/api/event.d.mts +0 -68
- package/dist/exports/cli/api/event.mjs +0 -126
- package/dist/exports/cli/api/logger.d.mts +0 -21
- package/dist/exports/cli/api/mailer.d.mts +0 -70
- package/dist/exports/cli/api/orm.d.mts +0 -13
- package/dist/exports/cli/api/redis.mjs +0 -3
- package/dist/exports/cli/api/storage-schema.d.mts +0 -699
- package/dist/exports/cli/api/storage.d.mts +0 -396
- package/dist/exports/cli/api/workflow.d.mts +0 -2
- package/dist/exports/cli/api/workflows/extract-blob-metadata.mjs +0 -132
- package/dist/exports/cli/api/workflows/generate-image-variant.d.mts +0 -63
- package/dist/exports/cli/api/workflows/track-db-changes.mjs +0 -110
- package/dist/exports/cli/command.d.mts +0 -56
- package/dist/exports/cli/command.mjs +0 -43
- package/dist/exports/cli/constants.mjs +0 -23
- package/dist/exports/cli/context.d.mts +0 -170
- package/dist/exports/devtools/index.d.ts +0 -3
- package/dist/exports/devtools/index.js +0 -4
- package/dist/exports/tests/_virtual/rolldown_runtime.mjs +0 -1
- package/dist/exports/tests/api/app-context.d.mts +0 -115
- package/dist/exports/tests/api/app-context.mjs +0 -1
- package/dist/exports/tests/api/auth-schema.d.mts +0 -4248
- package/dist/exports/tests/api/auth-schema.mjs +0 -1
- package/dist/exports/tests/api/auth.d.mts +0 -402
- package/dist/exports/tests/api/cache.d.mts +0 -44
- package/dist/exports/tests/api/config.d.mts +0 -28
- package/dist/exports/tests/api/container.d.mts +0 -210
- package/dist/exports/tests/api/database.d.mts +0 -101
- package/dist/exports/tests/api/database.mjs +0 -1
- package/dist/exports/tests/api/event.d.mts +0 -235
- package/dist/exports/tests/api/event.mjs +0 -1
- package/dist/exports/tests/api/i18n.d.mts +0 -34
- package/dist/exports/tests/api/index.d.mts +0 -26
- package/dist/exports/tests/api/logger.d.mts +0 -21
- package/dist/exports/tests/api/mailer.d.mts +0 -70
- package/dist/exports/tests/api/middleware/error-handler.mjs +0 -1
- package/dist/exports/tests/api/middleware/health.mjs +0 -1
- package/dist/exports/tests/api/middleware/i18n.mjs +0 -1
- package/dist/exports/tests/api/middleware/request-logger.d.mts +0 -24
- package/dist/exports/tests/api/middleware/request-logger.mjs +0 -1
- package/dist/exports/tests/api/middleware/shutdown.mjs +0 -1
- package/dist/exports/tests/api/middleware/timeout.mjs +0 -1
- package/dist/exports/tests/api/middleware/youch-handler.mjs +0 -1
- package/dist/exports/tests/api/middleware.d.mts +0 -39
- package/dist/exports/tests/api/middleware.mjs +0 -1
- package/dist/exports/tests/api/openapi.d.mts +0 -271
- package/dist/exports/tests/api/openapi.mjs +0 -1
- package/dist/exports/tests/api/orm.d.mts +0 -13
- package/dist/exports/tests/api/otel.d.mts +0 -40
- package/dist/exports/tests/api/redis.d.mts +0 -34
- package/dist/exports/tests/api/redis.mjs +0 -1
- package/dist/exports/tests/api/server.mjs +0 -1
- package/dist/exports/tests/api/storage-schema.d.mts +0 -707
- package/dist/exports/tests/api/storage.d.mts +0 -506
- package/dist/exports/tests/api/workflow.d.mts +0 -250
- package/dist/exports/tests/api/workflows/extract-blob-metadata.mjs +0 -1
- package/dist/exports/tests/api/workflows/generate-image-variant.d.mts +0 -63
- package/dist/exports/tests/api/workflows/generate-image-variant.mjs +0 -1
- package/dist/exports/tests/api/workflows/generate-preview.mjs +0 -1
- package/dist/exports/tests/api/workflows/purge-attachment.mjs +0 -1
- package/dist/exports/tests/api/workflows/purge-audit-logs.mjs +0 -1
- package/dist/exports/tests/api/workflows/purge-unattached-blobs.mjs +0 -1
- package/dist/exports/tests/api/workflows/track-db-changes.mjs +0 -1
- package/dist/exports/tests/constants.mjs +0 -1
- package/dist/exports/tests/instrumentation.d.mts +0 -7
- package/dist/exports/tests/instrumentation.mjs +0 -1
- package/dist/exports/web/api/auth.d.ts +0 -125
- package/dist/exports/web/api/database.d.ts +0 -4
- package/dist/exports/web/api/logger.d.ts +0 -1
- package/dist/exports/web/auth.d.ts +0 -2388
- package/dist/exports/web/auth.js +0 -75
- package/dist/exports/web/i18n.d.ts +0 -42
- package/dist/exports/web/i18n.js +0 -45
package/dist/exports/web/auth.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { passkeyClient } from "@better-auth/passkey/client";
|
|
2
|
-
import { ssoClient } from "@better-auth/sso/client";
|
|
3
|
-
import { adminClient, anonymousClient, apiKeyClient, emailOTPClient, magicLinkClient, multiSessionClient, phoneNumberClient, twoFactorClient, usernameClient } from "better-auth/client/plugins";
|
|
4
|
-
import { createAuthClient } from "better-auth/react";
|
|
5
|
-
|
|
6
|
-
//#region src/web/auth.ts
|
|
7
|
-
/**
|
|
8
|
-
* Default base path for auth routes.
|
|
9
|
-
*/
|
|
10
|
-
const AUTH_BASE_PATH = "/auth";
|
|
11
|
-
/**
|
|
12
|
-
* Default base URL (empty - same origin).
|
|
13
|
-
*/
|
|
14
|
-
const AUTH_BASE_URL = "";
|
|
15
|
-
/**
|
|
16
|
-
* Derives features from config at runtime.
|
|
17
|
-
* Uses presence-based detection - if key exists, feature is enabled.
|
|
18
|
-
*/
|
|
19
|
-
function defineAuthFeatures(config) {
|
|
20
|
-
return {
|
|
21
|
-
emailPassword: config.methods?.emailPassword !== void 0,
|
|
22
|
-
magicLink: config.methods?.magicLink !== void 0,
|
|
23
|
-
passkey: config.methods?.passkey !== void 0,
|
|
24
|
-
phoneOtp: config.methods?.phoneOtp !== void 0,
|
|
25
|
-
emailOtp: config.methods?.emailOtp !== void 0,
|
|
26
|
-
oauth: {
|
|
27
|
-
google: config.oauth?.google === true,
|
|
28
|
-
github: config.oauth?.github === true,
|
|
29
|
-
apple: config.oauth?.apple === true,
|
|
30
|
-
facebook: config.oauth?.facebook === true
|
|
31
|
-
},
|
|
32
|
-
twoFactor: {
|
|
33
|
-
enabled: config.plugins?.twoFactor !== void 0,
|
|
34
|
-
totp: config.plugins?.twoFactor?.totp !== void 0,
|
|
35
|
-
otp: config.plugins?.twoFactor?.otp === true,
|
|
36
|
-
backupCodes: config.plugins?.twoFactor?.backupCodes !== void 0
|
|
37
|
-
},
|
|
38
|
-
multiSession: config.plugins?.multiSession !== void 0,
|
|
39
|
-
username: config.plugins?.username !== void 0,
|
|
40
|
-
anonymous: config.plugins?.anonymous !== void 0,
|
|
41
|
-
sso: config.plugins?.sso !== void 0
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Constructs Better Auth client from neutral config.
|
|
46
|
-
* Returns both client instance and derived features.
|
|
47
|
-
*/
|
|
48
|
-
function defineAuthClient(opts) {
|
|
49
|
-
const { config, baseURL, plugins: pluginOpts } = opts;
|
|
50
|
-
const plugins = [];
|
|
51
|
-
if (config.plugins?.admin) plugins.push(adminClient({
|
|
52
|
-
ac: config.plugins.admin.ac,
|
|
53
|
-
roles: config.plugins.admin.roles
|
|
54
|
-
}));
|
|
55
|
-
if (config.plugins?.apiKey) plugins.push(apiKeyClient());
|
|
56
|
-
if (config.plugins?.twoFactor) plugins.push(twoFactorClient({ onTwoFactorRedirect: pluginOpts?.twoFactor?.onTwoFactorRedirect }));
|
|
57
|
-
if (config.methods?.passkey) plugins.push(passkeyClient());
|
|
58
|
-
if (config.methods?.magicLink) plugins.push(magicLinkClient());
|
|
59
|
-
if (config.methods?.phoneOtp) plugins.push(phoneNumberClient());
|
|
60
|
-
if (config.methods?.emailOtp) plugins.push(emailOTPClient());
|
|
61
|
-
if (config.plugins?.username) plugins.push(usernameClient());
|
|
62
|
-
if (config.plugins?.anonymous) plugins.push(anonymousClient());
|
|
63
|
-
if (config.plugins?.multiSession) plugins.push(multiSessionClient());
|
|
64
|
-
if (config.plugins?.sso) plugins.push(ssoClient({ domainVerification: config.plugins.sso.domainVerification ? { enabled: true } : void 0 }));
|
|
65
|
-
return {
|
|
66
|
-
client: createAuthClient({
|
|
67
|
-
baseURL: (baseURL ?? config.baseURL ?? AUTH_BASE_URL) || void 0,
|
|
68
|
-
plugins
|
|
69
|
-
}),
|
|
70
|
-
features: defineAuthFeatures(config)
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
//#endregion
|
|
75
|
-
export { AUTH_BASE_PATH, AUTH_BASE_URL, defineAuthClient, defineAuthFeatures };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as i18next0 from "i18next";
|
|
2
|
-
import { InitOptions } from "i18next";
|
|
3
|
-
|
|
4
|
-
//#region src/web/i18n.d.ts
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* i18n initialization options extending i18next's InitOptions.
|
|
8
|
-
* Used for both server and client initialization.
|
|
9
|
-
*/
|
|
10
|
-
interface I18nInitOptions extends InitOptions {}
|
|
11
|
-
/**
|
|
12
|
-
* Type-safe default options for i18n.
|
|
13
|
-
* Apps should spread these and override as needed.
|
|
14
|
-
*/
|
|
15
|
-
declare const defaultI18nOptions: {
|
|
16
|
-
readonly fallbackLng: "en";
|
|
17
|
-
readonly supportedLngs: readonly ["en"];
|
|
18
|
-
readonly defaultNS: "translation";
|
|
19
|
-
readonly ns: readonly ["translation"];
|
|
20
|
-
readonly interpolation: {
|
|
21
|
-
readonly escapeValue: false;
|
|
22
|
-
};
|
|
23
|
-
readonly react: {
|
|
24
|
-
readonly useSuspense: false;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Client-specific i18n options.
|
|
29
|
-
*/
|
|
30
|
-
interface I18nClientOptions extends I18nInitOptions {
|
|
31
|
-
/** Path to load translations from (default: "/locales/{{lng}}/{{ns}}.json") */
|
|
32
|
-
loadPath?: string;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Initializes i18next for browser/SPA with HTTP backend.
|
|
36
|
-
*
|
|
37
|
-
* @param opts - Client i18n options including loadPath for translation files.
|
|
38
|
-
* @returns A promise that resolves to the initialized i18next instance.
|
|
39
|
-
*/
|
|
40
|
-
declare function defineI18nClient(opts: I18nClientOptions): Promise<i18next0.i18n>;
|
|
41
|
-
//#endregion
|
|
42
|
-
export { I18nClientOptions, I18nInitOptions, defaultI18nOptions, defineI18nClient };
|
package/dist/exports/web/i18n.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import i18n from "i18next";
|
|
2
|
-
import { initReactI18next } from "react-i18next";
|
|
3
|
-
import LanguageDetector from "i18next-browser-languagedetector";
|
|
4
|
-
import HttpBackend from "i18next-http-backend";
|
|
5
|
-
|
|
6
|
-
//#region src/web/i18n.ts
|
|
7
|
-
/**
|
|
8
|
-
* Type-safe default options for i18n.
|
|
9
|
-
* Apps should spread these and override as needed.
|
|
10
|
-
*/
|
|
11
|
-
const defaultI18nOptions = {
|
|
12
|
-
fallbackLng: "en",
|
|
13
|
-
supportedLngs: ["en"],
|
|
14
|
-
defaultNS: "translation",
|
|
15
|
-
ns: ["translation"],
|
|
16
|
-
interpolation: { escapeValue: false },
|
|
17
|
-
react: { useSuspense: false }
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Initializes i18next for browser/SPA with HTTP backend.
|
|
21
|
-
*
|
|
22
|
-
* @param opts - Client i18n options including loadPath for translation files.
|
|
23
|
-
* @returns A promise that resolves to the initialized i18next instance.
|
|
24
|
-
*/
|
|
25
|
-
async function defineI18nClient(opts) {
|
|
26
|
-
const { loadPath = "/locales/{{lng}}/{{ns}}.json", ...initOpts } = opts;
|
|
27
|
-
const instance = i18n.use(HttpBackend).use(LanguageDetector).use(initReactI18next);
|
|
28
|
-
if (import.meta.env.MODE !== "production") {
|
|
29
|
-
const { HMRPlugin } = await import("i18next-hmr/plugin");
|
|
30
|
-
instance.use(new HMRPlugin({ vite: { client: true } }));
|
|
31
|
-
}
|
|
32
|
-
await instance.init({
|
|
33
|
-
...initOpts,
|
|
34
|
-
react: {
|
|
35
|
-
bindI18n: "loaded languageChanged",
|
|
36
|
-
bindI18nStore: "added",
|
|
37
|
-
useSuspense: true
|
|
38
|
-
},
|
|
39
|
-
backend: { loadPath }
|
|
40
|
-
});
|
|
41
|
-
return instance;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
export { defaultI18nOptions, defineI18nClient };
|