@discord/intl-message-database 0.3.0 → 0.4.1

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 +29 -4
  2. package/package.json +10 -10
package/index.d.ts CHANGED
@@ -15,11 +15,12 @@ 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
+ getSourceFileMessageValues(filePath: string): Record<string, IntlMessageValue | undefined>
23
24
  }
24
25
 
25
26
  export declare function hashMessageKey(key: string): string
@@ -31,7 +32,24 @@ export declare const enum IntlCompiledMessageFormat {
31
32
 
32
33
  export interface IntlDiagnostic {
33
34
  key: string
34
- diagnostics: unknown
35
+ file: string
36
+ locale: string
37
+ severity: string
38
+ description: string
39
+ help?: string
40
+ }
41
+
42
+ export interface IntlMessage {
43
+ /** Original, plain text name of the message given in its definition. */
44
+ key: string
45
+ /** Hashed version of the key, used everywhere for minification and obfuscation. */
46
+ hashedKey: string
47
+ /** Map of all translations for this message, including the default. */
48
+ translations: Record<string, IntlMessageValue>
49
+ /** The source definition information for this message (locale and location). */
50
+ sourceLocale?: string
51
+ /** Meta information about how to handle and process this message. */
52
+ meta: IntlMessageMeta
35
53
  }
36
54
 
37
55
  export interface IntlMessageMeta {
@@ -41,6 +59,13 @@ export interface IntlMessageMeta {
41
59
  translationsPath: string
42
60
  }
43
61
 
62
+ export interface IntlMessageValue {
63
+ raw: string
64
+ parsed: object
65
+ variables: object
66
+ filePosition: object
67
+ }
68
+
44
69
  export interface IntlSourceFile {
45
70
  type: string
46
71
  file: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discord/intl-message-database",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
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.3.0",
19
- "@discord/intl-message-database-darwin-x64": "0.3.0",
20
- "@discord/intl-message-database-linux-arm64-gnu": "0.3.0",
21
- "@discord/intl-message-database-linux-arm64-musl": "0.3.0",
22
- "@discord/intl-message-database-linux-x64-gnu": "0.3.0",
23
- "@discord/intl-message-database-linux-x64-musl": "0.3.0",
24
- "@discord/intl-message-database-win32-arm64-msvc": "0.3.0",
25
- "@discord/intl-message-database-win32-ia32-msvc": "0.3.0",
26
- "@discord/intl-message-database-win32-x64-msvc": "0.3.0"
18
+ "@discord/intl-message-database-darwin-arm64": "0.4.1",
19
+ "@discord/intl-message-database-darwin-x64": "0.4.1",
20
+ "@discord/intl-message-database-linux-arm64-gnu": "0.4.1",
21
+ "@discord/intl-message-database-linux-arm64-musl": "0.4.1",
22
+ "@discord/intl-message-database-linux-x64-gnu": "0.4.1",
23
+ "@discord/intl-message-database-win32-arm64-msvc": "0.4.1",
24
+ "@discord/intl-message-database-win32-ia32-msvc": "0.4.1",
25
+ "@discord/intl-message-database-linux-x64-musl": "0.4.1",
26
+ "@discord/intl-message-database-win32-x64-msvc": "0.4.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@napi-rs/cli": "^2.18.3"