@discord/intl-message-database 0.4.0 → 0.4.2

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.
Files changed (2) hide show
  1. package/index.d.ts +26 -3
  2. package/package.json +10 -10
package/index.d.ts CHANGED
@@ -15,11 +15,14 @@ export declare class IntlMessagesDatabase {
15
15
  * map is the hashed name and the value is the original.
16
16
  */
17
17
  getSourceFileKeyMap(filePath: string): Record<string, string>
18
- getMessage(key: string): unknown
18
+ getMessage(key: string): IntlMessage
19
19
  generateTypes(sourceFilePath: string, outputFilePath: string, allowNullability?: boolean | undefined | null): void
20
- precompile(sourcePath: string, locale: string, outputPath: string, format?: IntlCompiledMessageFormat | undefined | null): void
21
- precompileToBuffer(sourcePath: string, locale: string, format?: IntlCompiledMessageFormat | undefined | null): Buffer
20
+ precompile(filePath: string, locale: string, outputPath: string, format?: IntlCompiledMessageFormat | undefined | null): void
21
+ precompileToBuffer(filePath: string, locale: string, format?: IntlCompiledMessageFormat | undefined | null): Buffer
22
22
  validateMessages(): Array<IntlDiagnostic>
23
+ exportTranslations(fileExtension?: string | undefined | null): Array<string>
24
+ /** Return something specific */
25
+ getSourceFileMessageValues(filePath: string): Record<string, IntlMessageValue | undefined>
23
26
  }
24
27
 
25
28
  export declare function hashMessageKey(key: string): string
@@ -38,6 +41,19 @@ export interface IntlDiagnostic {
38
41
  help?: string
39
42
  }
40
43
 
44
+ export interface IntlMessage {
45
+ /** Original, plain text name of the message given in its definition. */
46
+ key: string
47
+ /** Hashed version of the key, used everywhere for minification and obfuscation. */
48
+ hashedKey: string
49
+ /** Map of all translations for this message, including the default. */
50
+ translations: Record<string, IntlMessageValue>
51
+ /** The source definition information for this message (locale and location). */
52
+ sourceLocale?: string
53
+ /** Meta information about how to handle and process this message. */
54
+ meta: IntlMessageMeta
55
+ }
56
+
41
57
  export interface IntlMessageMeta {
42
58
  secret: boolean
43
59
  translate: boolean
@@ -45,6 +61,13 @@ export interface IntlMessageMeta {
45
61
  translationsPath: string
46
62
  }
47
63
 
64
+ export interface IntlMessageValue {
65
+ raw: string
66
+ parsed: object
67
+ variables: object
68
+ filePosition: object
69
+ }
70
+
48
71
  export interface IntlSourceFile {
49
72
  type: string
50
73
  file: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discord/intl-message-database",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "license": "MIT",
5
5
  "description": "Rust-based Node extension module for parsing, extracting, and managing messages and translations across a project.",
6
6
  "author": "Jon Egeland",
@@ -15,15 +15,15 @@
15
15
  "url": "https://github.com/discord/discord-intl"
16
16
  },
17
17
  "optionalDependencies": {
18
- "@discord/intl-message-database-darwin-arm64": "0.4.0",
19
- "@discord/intl-message-database-darwin-x64": "0.4.0",
20
- "@discord/intl-message-database-linux-arm64-musl": "0.4.0",
21
- "@discord/intl-message-database-linux-x64-gnu": "0.4.0",
22
- "@discord/intl-message-database-linux-x64-musl": "0.4.0",
23
- "@discord/intl-message-database-linux-arm64-gnu": "0.4.0",
24
- "@discord/intl-message-database-win32-arm64-msvc": "0.4.0",
25
- "@discord/intl-message-database-win32-x64-msvc": "0.4.0",
26
- "@discord/intl-message-database-win32-ia32-msvc": "0.4.0"
18
+ "@discord/intl-message-database-darwin-x64": "0.4.2",
19
+ "@discord/intl-message-database-linux-arm64-gnu": "0.4.2",
20
+ "@discord/intl-message-database-linux-arm64-musl": "0.4.2",
21
+ "@discord/intl-message-database-linux-x64-gnu": "0.4.2",
22
+ "@discord/intl-message-database-darwin-arm64": "0.4.2",
23
+ "@discord/intl-message-database-linux-x64-musl": "0.4.2",
24
+ "@discord/intl-message-database-win32-ia32-msvc": "0.4.2",
25
+ "@discord/intl-message-database-win32-arm64-msvc": "0.4.2",
26
+ "@discord/intl-message-database-win32-x64-msvc": "0.4.2"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@napi-rs/cli": "^2.18.3"