@discord/intl-message-database 0.21.1 → 0.22.0-rc.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 (3) hide show
  1. package/index.d.ts +29 -16
  2. package/index.js +2 -0
  3. package/package.json +11 -11
package/index.d.ts CHANGED
@@ -4,12 +4,12 @@ export declare class IntlMessagesDatabase {
4
4
  constructor()
5
5
  findAllMessagesFiles(directories: Array<string>, defaultDefinitionLocale: string): Array<IntlMessagesFileDescriptor>
6
6
  filterAllMessagesFiles(files: Array<string>, defaultDefinitionLocale: string): Array<IntlMessagesFileDescriptor>
7
- processAllMessagesFiles(directories: Array<IntlMessagesFileDescriptor>): IntlMultiProcessingResult
8
- processDefinitionsFile(filePath: string, locale?: string | undefined | null): string
9
- processDefinitionsFileContent(filePath: string, content: string, locale?: string | undefined | null): string
10
- processAllTranslationFiles(localeMap: Record<string, string>): IntlMultiProcessingResult
11
- processTranslationFile(filePath: string, locale: string): string
12
- processTranslationFileContent(filePath: string, locale: string, content: string): string
7
+ processAllMessagesFiles(directories: Array<IntlMessagesFileDescriptor>, strategy: IntlDatabaseInsertStrategy): Array<IntlSourceFileInsertionData>
8
+ processDefinitionsFile(filePath: string, locale: string | undefined | null, strategy: IntlDatabaseInsertStrategy): IntlSourceFileInsertionData
9
+ processDefinitionsFileContent(filePath: string, content: string, locale: string | undefined | null, strategy: IntlDatabaseInsertStrategy): IntlSourceFileInsertionData
10
+ processAllTranslationFiles(localeMap: Record<string, string>, strategy: IntlDatabaseInsertStrategy): Array<IntlSourceFileInsertionData>
11
+ processTranslationFile(filePath: string, locale: string, strategy: IntlDatabaseInsertStrategy): IntlSourceFileInsertionData
12
+ processTranslationFileContent(filePath: string, locale: string, content: string, strategy: IntlDatabaseInsertStrategy): IntlSourceFileInsertionData
13
13
  getKnownLocales(): Array<string>
14
14
  getSourceFile(filePath: string): IntlSourceFile
15
15
  getAllSourceFilePaths(): Array<string>
@@ -41,6 +41,12 @@ export declare const enum IntlCompiledMessageFormat {
41
41
  KeylessJson = 1
42
42
  }
43
43
 
44
+ export declare const enum IntlDatabaseInsertStrategy {
45
+ Create = 0,
46
+ Update = 1,
47
+ Replace = 2
48
+ }
49
+
44
50
  export interface IntlDiagnostic {
45
51
  name: string
46
52
  key: string
@@ -89,16 +95,6 @@ export interface IntlMessageValue {
89
95
  filePosition: object
90
96
  }
91
97
 
92
- export interface IntlMultiProcessingFailure {
93
- file: string
94
- error: string
95
- }
96
-
97
- export interface IntlMultiProcessingResult {
98
- processed: Array<string>
99
- failed: Array<IntlMultiProcessingFailure>
100
- }
101
-
102
98
  export interface IntlSourceFile {
103
99
  type: string
104
100
  file: string
@@ -107,6 +103,23 @@ export interface IntlSourceFile {
107
103
  meta: IntlSourceFileMeta
108
104
  }
109
105
 
106
+ export interface IntlSourceFileError {
107
+ name: string
108
+ key?: string
109
+ locale?: string
110
+ file?: string
111
+ line?: number
112
+ col?: number
113
+ message: string
114
+ }
115
+
116
+ export interface IntlSourceFileInsertionData {
117
+ fileKey: string
118
+ insertedCount: number
119
+ removedCount: number
120
+ errors: Array<IntlSourceFileError>
121
+ }
122
+
110
123
  export interface IntlSourceFileMeta {
111
124
  description: string
112
125
  secret: boolean
package/index.js CHANGED
@@ -78,6 +78,7 @@ const {
78
78
  isMessageTranslationsFile,
79
79
  IntlMessagesDatabase,
80
80
  IntlCompiledMessageFormat,
81
+ IntlDatabaseInsertStrategy,
81
82
  } = nativeBinding;
82
83
 
83
84
  module.exports = {
@@ -86,4 +87,5 @@ module.exports = {
86
87
  isMessageTranslationsFile,
87
88
  IntlMessagesDatabase,
88
89
  IntlCompiledMessageFormat,
90
+ IntlDatabaseInsertStrategy,
89
91
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discord/intl-message-database",
3
- "version": "0.21.1",
3
+ "version": "0.22.0-rc.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,19 +15,19 @@
15
15
  "url": "https://github.com/discord/discord-intl"
16
16
  },
17
17
  "optionalDependencies": {
18
- "@discord/intl-message-database-darwin-arm64": "0.21.1",
19
- "@discord/intl-message-database-linux-arm64-gnu": "0.21.1",
20
- "@discord/intl-message-database-linux-arm64-musl": "0.21.1",
21
- "@discord/intl-message-database-linux-x64-gnu": "0.21.1",
22
- "@discord/intl-message-database-darwin-x64": "0.21.1",
23
- "@discord/intl-message-database-linux-x64-musl": "0.21.1",
24
- "@discord/intl-message-database-win32-arm64-msvc": "0.21.1",
25
- "@discord/intl-message-database-win32-ia32-msvc": "0.21.1",
26
- "@discord/intl-message-database-win32-x64-msvc": "0.21.1"
18
+ "@discord/intl-message-database-darwin-arm64": "0.22.0-rc.1",
19
+ "@discord/intl-message-database-linux-arm64-gnu": "0.22.0-rc.1",
20
+ "@discord/intl-message-database-linux-arm64-musl": "0.22.0-rc.1",
21
+ "@discord/intl-message-database-darwin-x64": "0.22.0-rc.1",
22
+ "@discord/intl-message-database-linux-x64-gnu": "0.22.0-rc.1",
23
+ "@discord/intl-message-database-linux-x64-musl": "0.22.0-rc.1",
24
+ "@discord/intl-message-database-win32-arm64-msvc": "0.22.0-rc.1",
25
+ "@discord/intl-message-database-win32-ia32-msvc": "0.22.0-rc.1",
26
+ "@discord/intl-message-database-win32-x64-msvc": "0.22.0-rc.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@napi-rs/cli": "^2.18.3",
30
- "@discord/intl-ast": "0.21.1"
30
+ "@discord/intl-ast": "0.22.0-rc.1"
31
31
  },
32
32
  "engines": {
33
33
  "node": ">= 10"