@rushstack/webpack5-localization-plugin 0.1.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.
Files changed (65) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +209 -0
  3. package/dist/tsdoc-metadata.json +11 -0
  4. package/dist/webpack5-localization-plugin.d.ts +274 -0
  5. package/lib/AssetProcessor.d.ts +26 -0
  6. package/lib/AssetProcessor.d.ts.map +1 -0
  7. package/lib/AssetProcessor.js +243 -0
  8. package/lib/AssetProcessor.js.map +1 -0
  9. package/lib/LocalizationPlugin.d.ts +79 -0
  10. package/lib/LocalizationPlugin.d.ts.map +1 -0
  11. package/lib/LocalizationPlugin.js +586 -0
  12. package/lib/LocalizationPlugin.js.map +1 -0
  13. package/lib/index.d.ts +4 -0
  14. package/lib/index.d.ts.map +1 -0
  15. package/lib/index.js +8 -0
  16. package/lib/index.js.map +1 -0
  17. package/lib/interfaces.d.ts +173 -0
  18. package/lib/interfaces.d.ts.map +1 -0
  19. package/lib/interfaces.js +5 -0
  20. package/lib/interfaces.js.map +1 -0
  21. package/lib/loaders/IResxLoaderOptions.d.ts +12 -0
  22. package/lib/loaders/IResxLoaderOptions.d.ts.map +1 -0
  23. package/lib/loaders/IResxLoaderOptions.js +5 -0
  24. package/lib/loaders/IResxLoaderOptions.js.map +1 -0
  25. package/lib/loaders/LoaderFactory.d.ts +6 -0
  26. package/lib/loaders/LoaderFactory.d.ts.map +1 -0
  27. package/lib/loaders/LoaderFactory.js +28 -0
  28. package/lib/loaders/LoaderFactory.js.map +1 -0
  29. package/lib/loaders/default-locale-loader.d.ts +8 -0
  30. package/lib/loaders/default-locale-loader.d.ts.map +1 -0
  31. package/lib/loaders/default-locale-loader.js +26 -0
  32. package/lib/loaders/default-locale-loader.js.map +1 -0
  33. package/lib/loaders/loc-loader.d.ts +15 -0
  34. package/lib/loaders/loc-loader.d.ts.map +1 -0
  35. package/lib/loaders/loc-loader.js +23 -0
  36. package/lib/loaders/loc-loader.js.map +1 -0
  37. package/lib/loaders/locjson-loader.d.ts +5 -0
  38. package/lib/loaders/locjson-loader.d.ts.map +1 -0
  39. package/lib/loaders/locjson-loader.js +14 -0
  40. package/lib/loaders/locjson-loader.js.map +1 -0
  41. package/lib/loaders/resjson-loader.d.ts +5 -0
  42. package/lib/loaders/resjson-loader.d.ts.map +1 -0
  43. package/lib/loaders/resjson-loader.js +14 -0
  44. package/lib/loaders/resjson-loader.js.map +1 -0
  45. package/lib/loaders/resx-loader.d.ts +5 -0
  46. package/lib/loaders/resx-loader.d.ts.map +1 -0
  47. package/lib/loaders/resx-loader.js +21 -0
  48. package/lib/loaders/resx-loader.js.map +1 -0
  49. package/lib/utilities/Constants.d.ts +12 -0
  50. package/lib/utilities/Constants.d.ts.map +1 -0
  51. package/lib/utilities/Constants.js +17 -0
  52. package/lib/utilities/Constants.js.map +1 -0
  53. package/lib/utilities/EntityMarker.d.ts +9 -0
  54. package/lib/utilities/EntityMarker.d.ts.map +1 -0
  55. package/lib/utilities/EntityMarker.js +21 -0
  56. package/lib/utilities/EntityMarker.js.map +1 -0
  57. package/lib/utilities/LoaderTerminalProvider.d.ts +6 -0
  58. package/lib/utilities/LoaderTerminalProvider.d.ts.map +1 -0
  59. package/lib/utilities/LoaderTerminalProvider.js +28 -0
  60. package/lib/utilities/LoaderTerminalProvider.js.map +1 -0
  61. package/lib/webpackInterfaces.d.ts +13 -0
  62. package/lib/webpackInterfaces.d.ts.map +1 -0
  63. package/lib/webpackInterfaces.js +5 -0
  64. package/lib/webpackInterfaces.js.map +1 -0
  65. package/package.json +35 -0
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ @rushstack/webpack5-localization-plugin
2
+
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+
5
+ MIT License
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ "Software"), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,209 @@
1
+ # @rushstack/webpack5-localization-plugin
2
+
3
+ ## Installation
4
+
5
+ `npm install @rushstack/webpack5-localization-plugin --save-dev`
6
+
7
+ ## Overview
8
+
9
+ This Webpack plugin produces bundles that have multiple locales' variants of strings embedded. It also
10
+ has out-of-box support for RESX files in addition to JSON strings files (with the extensions `.loc.json` or `.resjson`).
11
+
12
+ The loaders can also be chained with other loaders that convert the content to one of the known formats.
13
+
14
+ # Plugin
15
+
16
+ To use the plugin, add it to the `plugins` array of your Webpack config, and specify one or more loaders. For example:
17
+
18
+ ```JavaScript
19
+ import { LocalizationPlugin } from '@rushstack/webpack5-localization-plugin';
20
+
21
+ {
22
+ plugins: [
23
+ new LocalizationPlugin( /* options */ )
24
+ ],
25
+ module: {
26
+ rules: [{
27
+ test: /\.resjson$/,
28
+ use: {
29
+ // All loaders are available in `@rushstack/webpack5-localization-plugin/lib/loaders/`
30
+ // Loaders for specific formats: `resjson-loader`, `locjson-loader`, `resx-loader`
31
+ // Loader that switches on file extension: `loc-loader`
32
+ // Loader that switches on file extension and skips localization: `default-locale-loader`
33
+ loader: require.resolve('@rushstack/webpack5-localization-plugin/lib/loaders/resjson-loader')
34
+ },
35
+ // Can be one of `javascript/esm`, `javascript/dynamic`, or `json`
36
+ // `javascript/esm` will produce the smallest bundle sizes, while `json` will produce faster code for large string tables
37
+ type: 'javascript/esm',
38
+ sideEffects: false
39
+ }]
40
+ }
41
+ }
42
+ ```
43
+
44
+ ***A note about the dev server:*** When Webpack is being run by the Webpack dev server, this plugin pipes
45
+ the strings in the loc files in the source (the `.loc.json` and the `.resx` files) to the output without
46
+ any translations.
47
+
48
+ ## Options
49
+
50
+ ### `localizedData = { }`
51
+
52
+ #### `localizedData.defaultLocale = { }`
53
+
54
+ This option has a required property (`localeName`), to specify the name of the locale used in the
55
+ `.resx` and `.loc.json` files in the source.
56
+
57
+ ##### `localizedData.defaultLocale.fillMissingTranslationStrings = true | false`
58
+
59
+ If this option is set to `true`, strings that are missing from `localizedData.translatedStrings` will be
60
+ provided by the default locale (the strings in the `.resx` and `.loc.json` files in the source). If
61
+ this option is unset or set to `false`, an error will be emitted if a string is missing from
62
+ `localizedData.translatedStrings`.
63
+
64
+ #### `localizedData.translatedStrings = { }`
65
+
66
+ This option is used to specify the localization data to be used in the build. This object has the following
67
+ structure:
68
+
69
+ - Locale name
70
+ - Compilation context-relative or absolute localization file path
71
+ - Translated strings
72
+
73
+ For example:
74
+
75
+ ```JavaScript
76
+ translatedStrings: {
77
+ "en-us": {
78
+ "./src/strings1.loc.json": {
79
+ "string1": "the first string"
80
+ }
81
+ },
82
+ "es-es": {
83
+ "./src/strings1.loc.json": {
84
+ "string1": "la primera cadena"
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ Alternatively, instead of directly specifying the translations, a path to a translated resource file can be
91
+ specified. For example:
92
+
93
+ ```JavaScript
94
+ translatedStrings: {
95
+ "en-us": {
96
+ "./src/strings1.loc.json": "./localization/en-us/strings1.loc.json"
97
+ },
98
+ "es-es": {
99
+ "./src/strings1.loc.json": "./localization/es-es/strings1.loc.json"
100
+ }
101
+ }
102
+ ```
103
+
104
+ #### `localizedData.resolveMissingTranslatedStrings = (locales: string[], filePath: string, context: LoaderContext<{}>) => { ... }`
105
+
106
+ This optional option can be used to resolve translated data that is missing from data that is provided
107
+ in the `localizedData.translatedStrings` option. Set this option with a function expecting two parameters:
108
+ the first, an array of locale names, and second, a fully-qualified path to the localized file in source. The
109
+ function should synchronously or asynchronously (as a promise) return an object (or map) with locale names as keys and localized
110
+ data as values. The localized data value should be one of:
111
+
112
+ - a string: The absolute path to the translated data in `.resx`, `.loc.json`, or `.resjson` format
113
+ - an object: An object containing the translated data
114
+ - a map: A map containing the translated data
115
+
116
+ Note that these values are the same as the values that can be specified for translations for a localized
117
+ resource in `localizedData.translatedStrings`.
118
+
119
+ If the function returns data that is missing locales or individual strings, the plugin will fall back to the
120
+ default locale if `localizedData.defaultLocale.fillMissingTranslationStrings` is set to `true`. If
121
+ `localizedData.defaultLocale.fillMissingTranslationStrings` is set to `false`, an error will result.
122
+
123
+ #### `localizedData.passthroughLocale = { }`
124
+
125
+ This option is used to specify how and if a passthrough locale should be generated. A passthrough locale
126
+ is a generated locale in which each string's value is its name. This is useful for debugging and for identifying
127
+ cases where a locale is missing.
128
+
129
+ This option takes two optional properties:
130
+
131
+ ##### `localizedData.passthroughLocale.usePassthroughLocale = true | false`
132
+
133
+ If `passthroughLocale.usePassthroughLocale` is set to `true`, a passthrough locale will be included in the output.
134
+ By default, the passthrough locale's name is "passthrough."
135
+
136
+ ##### `localizedData.passthroughLocale.passthroughLocaleName = '...'`
137
+
138
+ If `passthroughLocale.usePassthroughLocale` is set to `true`, the "passthrough" locale name can be overridden
139
+ by setting a value on `passthroughLocale.passthroughLocaleName`.
140
+
141
+ #### `localizedData.pseudolocales = { }`
142
+
143
+ This option allows pseudolocales to be generated from the strings in the default locale. This option takes
144
+ an option with pseudolocales as keys and options for the
145
+ [pseudolocale package](https://www.npmjs.com/package/pseudolocale) as values.
146
+
147
+ ### `noStringsLocaleName = '...'`
148
+
149
+ The value to replace the `[locale]` token with for chunks without localized strings. Defaults to "none"
150
+
151
+ ### `runtimeLocaleExpression = '...'`
152
+
153
+ A chunk of raw ECMAScript to inject into the webpack runtime to resolve the current locale at execution time. Allows
154
+ multiple locales to share the same runtime chunk if it does not directly contain localized strings.
155
+
156
+ ### `localizationStats = { }`
157
+
158
+ #### `localizationStats.dropPath = '...'`
159
+
160
+ This option is used to designate a path at which a JSON file describing the localized assets produced should be
161
+ written. If this property is omitted, the stats file won't be written.
162
+
163
+ The file has the following format:
164
+
165
+ ```JSON
166
+ {
167
+ "entrypoints": {
168
+ "<BUNDLE NAME>": {
169
+ "localizedAssets": {
170
+ "<LOCALE NAME>": "<ASSET NAME>",
171
+ "<LOCALE NAME>": "<ASSET NAME>"
172
+ }
173
+ },
174
+ "<BUNDLE NAME>": {
175
+ "localizedAssets": {
176
+ "<LOCALE NAME>": "<ASSET NAME>",
177
+ "<LOCALE NAME>": "<ASSET NAME>"
178
+ }
179
+ }
180
+ },
181
+ "namedChunkGroups": {
182
+ "<CHUNK NAME>": {
183
+ "localizedAssets": {
184
+ "<LOCALE NAME>": "<ASSET NAME>",
185
+ "<LOCALE NAME>": "<ASSET NAME>"
186
+ }
187
+ },
188
+ "<CHUNK NAME>": {
189
+ "localizedAssets": {
190
+ "<LOCALE NAME>": "<ASSET NAME>",
191
+ "<LOCALE NAME>": "<ASSET NAME>"
192
+ }
193
+ }
194
+ }
195
+ }
196
+
197
+ ```
198
+
199
+ #### `localizationStats.callback = (stats) => { ... }`
200
+
201
+ This option is used to specify a callback to be called with the stats data that would be dropped at
202
+ [`localizationStats.dropPath`](#localizationStats.DropPath--) after compilation completes.
203
+
204
+ ## Links
205
+
206
+ - [CHANGELOG.md](https://github.com/microsoft/rushstack/blob/main/webpack/localization-plugin/CHANGELOG.md) - Find
207
+ out what's new in the latest version
208
+
209
+ `@rushstack/webpack5-localization-plugin` is part of the [Rush Stack](https://rushstack.io/) family of projects.
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.25.2"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,274 @@
1
+ import type { Chunk } from 'webpack';
2
+ import type { Compiler } from 'webpack';
3
+ import { ILocalizationFile } from '@rushstack/localization-utilities';
4
+ import type { IPseudolocaleOptions } from '@rushstack/localization-utilities';
5
+ import type { LoaderContext } from 'webpack';
6
+ import type { WebpackPluginInstance } from 'webpack';
7
+
8
+ /**
9
+ * @public
10
+ */
11
+ export declare interface IDefaultLocaleOptions {
12
+ /**
13
+ * This required property specifies the name of the locale used in the
14
+ * `.resx`, `.loc.json`, and `.resjson` files in the source
15
+ */
16
+ localeName: string;
17
+ /**
18
+ * If this option is set to `true`, strings that are missing from
19
+ * `localizedData.translatedStrings` will be provided by the default locale
20
+ */
21
+ fillMissingTranslationStrings?: boolean;
22
+ }
23
+
24
+ /**
25
+ * @public
26
+ */
27
+ export declare interface ILocaleData {
28
+ [locFilePath: string]: ILocaleFileData;
29
+ }
30
+
31
+ /**
32
+ * @public
33
+ */
34
+ export declare interface ILocaleElementMap {
35
+ [locale: string]: string;
36
+ }
37
+
38
+ /**
39
+ * @public
40
+ * Accepted formats:
41
+ * - A string containing the path to the translations in .resjson format (keys mapped directly to values)
42
+ * - An object mapping keys directly to values
43
+ * - A map mapping keys directly to values
44
+ */
45
+ export declare type ILocaleFileData = string | ILocaleFileObject | ReadonlyMap<string, string>;
46
+
47
+ /**
48
+ * @public
49
+ */
50
+ export declare interface ILocaleFileObject {
51
+ [stringName: string]: string;
52
+ }
53
+
54
+ /**
55
+ * The options for localization.
56
+ *
57
+ * @public
58
+ */
59
+ export declare interface ILocalizationPluginOptions {
60
+ /**
61
+ * Localization data.
62
+ */
63
+ localizedData: ILocalizedData;
64
+ /**
65
+ * This option is used to specify `.resx`, `.resx.json`, and `.loc.json` files that should not be processed by
66
+ * this plugin.
67
+ */
68
+ globsToIgnore?: string[];
69
+ /**
70
+ * The value to replace the [locale] token with for chunks without localized strings. Defaults to "none"
71
+ */
72
+ noStringsLocaleName?: string;
73
+ /**
74
+ * A chunk of javascript to use to get the current locale at runtime. If specified, allows the runtime chunk
75
+ * to be non-localized even if it has async localized chunks, as long as it does not directly contain strings.
76
+ */
77
+ runtimeLocaleExpression?: string;
78
+ /**
79
+ * Options for how localization stats data should be produced.
80
+ */
81
+ localizationStats?: ILocalizationStatsOptions;
82
+ }
83
+
84
+ /**
85
+ * @public
86
+ */
87
+ export declare interface ILocalizationStats {
88
+ entrypoints: {
89
+ [name: string]: ILocalizationStatsEntrypoint;
90
+ };
91
+ namedChunkGroups: {
92
+ [name: string]: ILocalizationStatsChunkGroup;
93
+ };
94
+ }
95
+
96
+ /**
97
+ * @public
98
+ */
99
+ export declare interface ILocalizationStatsChunkGroup {
100
+ localizedAssets: ILocaleElementMap;
101
+ }
102
+
103
+ /**
104
+ * @public
105
+ */
106
+ export declare interface ILocalizationStatsEntrypoint {
107
+ localizedAssets: ILocaleElementMap;
108
+ }
109
+
110
+ /**
111
+ * Options for how localization stats data should be produced.
112
+ *
113
+ * @public
114
+ */
115
+ export declare interface ILocalizationStatsOptions {
116
+ /**
117
+ * This option is used to designate a path at which a JSON file describing the localized
118
+ * assets produced should be written.
119
+ */
120
+ dropPath?: string;
121
+ /**
122
+ * This option is used to specify a callback to be called with the stats data that would be
123
+ * dropped at `localizationStats.dropPath` after compilation completes.
124
+ */
125
+ callback?: (stats: ILocalizationStats) => void;
126
+ }
127
+
128
+ /**
129
+ * @public
130
+ */
131
+ export declare interface ILocalizedData {
132
+ /**
133
+ * Options for the locale used in the source localized data files.
134
+ */
135
+ defaultLocale: IDefaultLocaleOptions;
136
+ /**
137
+ * Use this parameter to specify the translated data.
138
+ */
139
+ translatedStrings: ILocalizedStrings;
140
+ /**
141
+ * Use this parameter to specify a function used to load translations missing from
142
+ * the {@link ILocalizedData.translatedStrings} parameter.
143
+ */
144
+ resolveMissingTranslatedStrings?: (locales: string[], localizedFileKey: string, loaderContext: LoaderContext<{}>) => Promise<IResolvedMissingTranslations> | IResolvedMissingTranslations;
145
+ /**
146
+ * Options around including a passthrough locale.
147
+ */
148
+ passthroughLocale?: IPassthroughLocaleOptions;
149
+ /**
150
+ * Options for pseudo-localization.
151
+ */
152
+ pseudolocales?: IPseudolocalesOptions;
153
+ }
154
+
155
+ /**
156
+ * @public
157
+ */
158
+ export declare interface ILocalizedStrings {
159
+ [locale: string]: ILocaleData;
160
+ }
161
+
162
+ /**
163
+ * @public
164
+ */
165
+ export declare interface ILocalizedWebpackChunk extends Chunk {
166
+ localizedFiles?: {
167
+ [locale: string]: string;
168
+ };
169
+ }
170
+
171
+ /**
172
+ * Options for the passthrough locale.
173
+ *
174
+ * @public
175
+ */
176
+ export declare interface IPassthroughLocaleOptions {
177
+ /**
178
+ * If this is set to `true`, a passthrough locale will be included in the output
179
+ */
180
+ usePassthroughLocale?: boolean;
181
+ /**
182
+ * If {@link IPassthroughLocaleOptions.usePassthroughLocale} is set, use this name for the passthrough locale.
183
+ * Defaults to "passthrough"
184
+ */
185
+ passthroughLocaleName?: string;
186
+ }
187
+
188
+ /**
189
+ * Options for generated pseudolocales.
190
+ *
191
+ * @public
192
+ */
193
+ export declare interface IPseudolocalesOptions {
194
+ [pseudoLocaleName: string]: IPseudolocaleOptions;
195
+ }
196
+
197
+ /**
198
+ * @public
199
+ */
200
+ export declare type IResolvedMissingTranslations = ReadonlyMap<string, ILocaleFileData>;
201
+
202
+ /**
203
+ * @public
204
+ */
205
+ export declare interface _IStringPlaceholder {
206
+ /**
207
+ * The literal string that will be injected for later replacement.
208
+ */
209
+ value: string;
210
+ /**
211
+ * The identifier for this particular placeholder, for lookup.
212
+ */
213
+ suffix: string;
214
+ /**
215
+ * The values of this string in each output locale.
216
+ */
217
+ valuesByLocale: Map<string, string>;
218
+ /**
219
+ * The key used to identify the source file containing the string.
220
+ */
221
+ locFilePath: string;
222
+ /**
223
+ * The identifier of the string within its original source file.
224
+ */
225
+ stringName: string;
226
+ }
227
+
228
+ /**
229
+ * This plugin facilitates localization in webpack.
230
+ *
231
+ * @public
232
+ */
233
+ export declare class LocalizationPlugin implements WebpackPluginInstance {
234
+ private readonly _stringKeys;
235
+ private readonly _options;
236
+ private readonly _resolvedTranslatedStringsFromOptions;
237
+ private _stringPlaceholderCounter;
238
+ private readonly _stringPlaceholderMap;
239
+ private _passthroughLocaleName;
240
+ private _defaultLocale;
241
+ private _noStringsLocaleName;
242
+ private _fillMissingTranslationStrings;
243
+ private readonly _pseudolocalizers;
244
+ /**
245
+ * The outermost map's keys are the locale names.
246
+ * The middle map's keys are the resolved, file names.
247
+ * The innermost map's keys are the string identifiers and its values are the string values.
248
+ */
249
+ private _resolvedLocalizedStrings;
250
+ constructor(options: ILocalizationPluginOptions);
251
+ /**
252
+ * Apply this plugin to the specified webpack compiler.
253
+ */
254
+ apply(compiler: Compiler): void;
255
+ /**
256
+ * @public
257
+ *
258
+ * @returns An object mapping the string keys to placeholders
259
+ */
260
+ addDefaultLocFileAsync(context: LoaderContext<{}>, localizedFileKey: string, localizedResourceData: ILocalizationFile): Promise<Record<string, string>>;
261
+ /**
262
+ * @public
263
+ */
264
+ getPlaceholder(localizedFileKey: string, stringName: string): _IStringPlaceholder | undefined;
265
+ /**
266
+ * @internal
267
+ */
268
+ getDataForSerialNumber(serialNumber: string): _IStringPlaceholder | undefined;
269
+ private _addLocFileAndGetPlaceholders;
270
+ private _addTranslations;
271
+ private _initializeAndValidateOptions;
272
+ }
273
+
274
+ export { }
@@ -0,0 +1,26 @@
1
+ import type { Asset, Chunk, Compilation, sources } from 'webpack';
2
+ import type { LocalizationPlugin } from './LocalizationPlugin';
3
+ export interface IProcessAssetOptionsBase {
4
+ plugin: LocalizationPlugin;
5
+ compilation: Compilation;
6
+ chunk: Chunk;
7
+ asset: Asset;
8
+ }
9
+ export interface IProcessNonLocalizedAssetOptions extends IProcessAssetOptionsBase {
10
+ fileName: string;
11
+ noStringsLocaleName: string;
12
+ }
13
+ export interface IProcessLocalizedAssetOptions extends IProcessAssetOptionsBase {
14
+ locales: Set<string>;
15
+ fillMissingTranslationStrings: boolean;
16
+ defaultLocale: string;
17
+ filenameTemplate: Parameters<typeof Compilation.prototype.getAssetPath>[0];
18
+ }
19
+ export interface IProcessAssetResult {
20
+ filename: string;
21
+ asset: sources.Source;
22
+ }
23
+ export declare const PLACEHOLDER_REGEX: RegExp;
24
+ export declare function processLocalizedAsset(options: IProcessLocalizedAssetOptions): Record<string, string>;
25
+ export declare function processNonLocalizedAsset(options: IProcessNonLocalizedAssetOptions): void;
26
+ //# sourceMappingURL=AssetProcessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetProcessor.d.ts","sourceRoot":"","sources":["../src/AssetProcessor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAa,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAG7E,OAAO,KAAK,EAAE,kBAAkB,EAAsB,MAAM,sBAAsB,CAAC;AAoCnF,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,WAAW,gCAAiC,SAAQ,wBAAwB;IAChF,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,6BAA8B,SAAQ,wBAAwB;IAC7E,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,6BAA6B,EAAE,OAAO,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC5E;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,iBAAiB,EAAE,MAG/B,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,6BAA6B,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmEpG;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,gCAAgC,GAAG,IAAI,CAqCxF"}