@discord/intl-loader-core 0.12.0 → 0.13.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discord/intl-loader-core",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
4
4
  "license": "MIT",
5
5
  "description": "Core utilities for writing loaders and transformers using @discord/intl",
6
6
  "author": "Jon Egeland",
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "chokidar": "^3.6.0",
30
30
  "debug": "^4.3.6",
31
- "@discord/intl-message-database": "0.12.0"
31
+ "@discord/intl-message-database": "0.13.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/debug": "^4.1.12",
package/src/processing.js CHANGED
@@ -231,27 +231,18 @@ function precompileFileForLocale(sourcePath, locale, outputFile, options = {}) {
231
231
  * replaced by `.d.ts`. For example, a file like `SomeMessages.Other.messages.js` would become
232
232
  * `SomeMessages.Other.messages.d.ts`.
233
233
  *
234
- * If `allowNullability` is set, the generated types for variables within messages will allow
235
- * `null` and `undefined` for most value types, as well as looser restrictions on typing, such as
236
- * allowing `string | number` for number variables.
237
- *
238
234
  * Returns `true` if the types were successfully generated, or `false` otherwise, such as if the
239
235
  * source file is not already in the database.
240
236
  *
241
237
  * @param {string} sourcePath
242
238
  * @param {string=} outputFile
243
- * @param {boolean=} allowNullability
244
239
  * @returns {boolean}
245
240
  */
246
- function generateTypeDefinitions(sourcePath, outputFile, allowNullability = false) {
241
+ function generateTypeDefinitions(sourcePath, outputFile) {
247
242
  const paths = database.getAllSourceFilePaths();
248
243
  if (!paths.includes(sourcePath)) return false;
249
244
 
250
- database.generateTypes(
251
- sourcePath,
252
- outputFile ?? sourcePath.replace(/\.[^.]+$/, '.d.ts'),
253
- allowNullability,
254
- );
245
+ database.generateTypes(sourcePath, outputFile ?? sourcePath.replace(/\.[^.]+$/, '.d.ts'));
255
246
  return true;
256
247
  }
257
248
 
package/src/watcher.js CHANGED
@@ -99,15 +99,12 @@ async function watchMessagesFiles(
99
99
  * Watch the file system for any changes to message files and regenerate their types.
100
100
  *
101
101
  * @param {BasicWatcher} watcher
102
- * @param {{
103
- * allowNullability?: boolean
104
- * }} options
105
102
  */
106
- async function generateMessageTypes(watcher, { allowNullability }) {
103
+ async function generateMessageTypes(watcher) {
107
104
  watcher.on('all', (_, filePath) => {
108
105
  if (!isMessageDefinitionsFile(filePath)) return;
109
106
  debug(`Regenerating types for ${filePath}`);
110
- generateTypeDefinitions(filePath, undefined, allowNullability);
107
+ generateTypeDefinitions(filePath, undefined);
111
108
  });
112
109
  }
113
110
 
@@ -57,19 +57,14 @@ export function processAllMessagesFiles(files: import("../types").IntlMessagesFi
57
57
  * replaced by `.d.ts`. For example, a file like `SomeMessages.Other.messages.js` would become
58
58
  * `SomeMessages.Other.messages.d.ts`.
59
59
  *
60
- * If `allowNullability` is set, the generated types for variables within messages will allow
61
- * `null` and `undefined` for most value types, as well as looser restrictions on typing, such as
62
- * allowing `string | number` for number variables.
63
- *
64
60
  * Returns `true` if the types were successfully generated, or `false` otherwise, such as if the
65
61
  * source file is not already in the database.
66
62
  *
67
63
  * @param {string} sourcePath
68
64
  * @param {string=} outputFile
69
- * @param {boolean=} allowNullability
70
65
  * @returns {boolean}
71
66
  */
72
- export function generateTypeDefinitions(sourcePath: string, outputFile?: string | undefined, allowNullability?: boolean | undefined): boolean;
67
+ export function generateTypeDefinitions(sourcePath: string, outputFile?: string | undefined): boolean;
73
68
  /**
74
69
  * Precompile the messages defined in the given `sourcePath` using the value of the translation for
75
70
  * that message in the given `locale`. `format` specifies which serialization format the result
@@ -45,11 +45,6 @@ export function precompileMessageDefinitionsFiles(watcher: BasicWatcher, { asset
45
45
  * Watch the file system for any changes to message files and regenerate their types.
46
46
  *
47
47
  * @param {BasicWatcher} watcher
48
- * @param {{
49
- * allowNullability?: boolean
50
- * }} options
51
48
  */
52
- export function generateMessageTypes(watcher: BasicWatcher, { allowNullability }: {
53
- allowNullability?: boolean;
54
- }): Promise<void>;
49
+ export function generateMessageTypes(watcher: BasicWatcher): Promise<void>;
55
50
  export const ALWAYS_IGNORE_PATTERNS: string[];