Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@rushstack/localization-plugin

Package Overview
Dependencies
Maintainers
2
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/localization-plugin - npm Package Compare versions

Comparing version
0.6.55
to
0.6.56
+8
-1
CHANGELOG.md
# Change Log - @rushstack/localization-plugin
This log was last generated on Wed, 22 Sep 2021 03:27:12 GMT and should not be manually modified.
This log was last generated on Thu, 23 Sep 2021 00:10:41 GMT and should not be manually modified.
## 0.6.56
Thu, 23 Sep 2021 00:10:41 GMT
### Patches
- Upgrade the `@types/node` dependency to version to version 12.
## 0.6.55

@@ -6,0 +13,0 @@ Wed, 22 Sep 2021 03:27:12 GMT

+1
-1

@@ -19,3 +19,3 @@ "use strict";

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -22,0 +22,0 @@ return result;

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.TypingsGenerator = exports._LocFileParser = exports.LocalizationPlugin = void 0;
var LocalizationPlugin_1 = require("./LocalizationPlugin");

@@ -7,0 +8,0 @@ Object.defineProperty(exports, "LocalizationPlugin", { enumerable: true, get: function () { return LocalizationPlugin_1.LocalizationPlugin; } });

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAE3D,2DAAqG;AAA5F,wHAAA,kBAAkB,OAAA;AAuB3B,2DAGmC;AAFjC,+GAAA,aAAa,OAAkB;AAMjC,qEAGmC;AADjC,2HAAA,uBAAuB,OAAoB","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nexport { LocalizationPlugin, IStringPlaceholder as _IStringPlaceholder } from './LocalizationPlugin';\r\n\r\nexport {\r\n IDefaultLocaleOptions,\r\n ILocaleData,\r\n ILocaleElementMap,\r\n ILocaleFileData,\r\n ILocalizationFile as _ILocalizationFile,\r\n ILocalizationPluginOptions,\r\n ILocalizationStats,\r\n ILocalizationStatsChunkGroup,\r\n ILocalizationStatsEntrypoint,\r\n ILocalizationStatsOptions,\r\n ILocalizedData,\r\n ILocalizedString as _ILocalizedString,\r\n ILocalizedStrings,\r\n IPassthroughLocaleOptions,\r\n IPseudolocaleOptions,\r\n IPseudolocalesOptions,\r\n IResolvedMissingTranslations,\r\n ITypingsGenerationOptions\r\n} from './interfaces';\r\n\r\nexport {\r\n LocFileParser as _LocFileParser,\r\n IParseLocFileOptions as _IParseLocFileOptions\r\n} from './utilities/LocFileParser';\r\n\r\nexport { ILocalizedWebpackChunk } from './webpackInterfaces';\r\n\r\nexport {\r\n ITypingsGeneratorOptions,\r\n LocFileTypingsGenerator as TypingsGenerator\r\n} from './LocFileTypingsGenerator';\r\n"]}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,2DAAqG;AAA5F,wHAAA,kBAAkB,OAAA;AAuB3B,2DAGmC;AAFjC,+GAAA,aAAa,OAAkB;AAMjC,qEAGmC;AADjC,2HAAA,uBAAuB,OAAoB","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nexport { LocalizationPlugin, IStringPlaceholder as _IStringPlaceholder } from './LocalizationPlugin';\r\n\r\nexport {\r\n IDefaultLocaleOptions,\r\n ILocaleData,\r\n ILocaleElementMap,\r\n ILocaleFileData,\r\n ILocalizationFile as _ILocalizationFile,\r\n ILocalizationPluginOptions,\r\n ILocalizationStats,\r\n ILocalizationStatsChunkGroup,\r\n ILocalizationStatsEntrypoint,\r\n ILocalizationStatsOptions,\r\n ILocalizedData,\r\n ILocalizedString as _ILocalizedString,\r\n ILocalizedStrings,\r\n IPassthroughLocaleOptions,\r\n IPseudolocaleOptions,\r\n IPseudolocalesOptions,\r\n IResolvedMissingTranslations,\r\n ITypingsGenerationOptions\r\n} from './interfaces';\r\n\r\nexport {\r\n LocFileParser as _LocFileParser,\r\n IParseLocFileOptions as _IParseLocFileOptions\r\n} from './utilities/LocFileParser';\r\n\r\nexport { ILocalizedWebpackChunk } from './webpackInterfaces';\r\n\r\nexport {\r\n ITypingsGeneratorOptions,\r\n LocFileTypingsGenerator as TypingsGenerator\r\n} from './LocFileTypingsGenerator';\r\n"]}

@@ -9,3 +9,3 @@ "use strict";

const LoaderTerminalProvider_1 = require("../utilities/LoaderTerminalProvider");
exports.default = LoaderFactory_1.loaderFactory(function (locFilePath, content, options) {
exports.default = (0, LoaderFactory_1.loaderFactory)(function (locFilePath, content, options) {
const locFileData = LocFileParser_1.LocFileParser.parseLocFile({

@@ -12,0 +12,0 @@ content,

@@ -1,1 +0,1 @@

{"version":3,"file":"InPlaceLocFileLoader.js","sourceRoot":"","sources":["../../src/loaders/InPlaceLocFileLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAG3D,oEAAwD;AAGxD,8DAA2D;AAC3D,mDAAoE;AACpE,gFAA6E;AAE7E,kBAAe,6BAAa,CAAC,UAE3B,WAAmB,EACnB,OAAe,EACf,OAA2B;IAE3B,MAAM,WAAW,GAAsB,6BAAa,CAAC,YAAY,CAAC;QAChE,OAAO;QACP,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,IAAI,4BAAQ,CAAC,+CAAsB,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC;QACjF,wBAAwB,EAAE,OAAO,CAAC,wBAAwB;KAC3D,CAAC,CAAC;IACH,MAAM,YAAY,GAAqC,EAAE,CAAC;IAC1D,KAAK,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QACnE,YAAY,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC;KAC9C;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { loader } from 'webpack';\r\nimport { Terminal } from '@rushstack/node-core-library';\r\n\r\nimport { ILocalizationFile } from '../interfaces';\r\nimport { LocFileParser } from '../utilities/LocFileParser';\r\nimport { loaderFactory, IBaseLoaderOptions } from './LoaderFactory';\r\nimport { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';\r\n\r\nexport default loaderFactory(function (\r\n this: loader.LoaderContext,\r\n locFilePath: string,\r\n content: string,\r\n options: IBaseLoaderOptions\r\n) {\r\n const locFileData: ILocalizationFile = LocFileParser.parseLocFile({\r\n content,\r\n filePath: locFilePath,\r\n terminal: new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(this)),\r\n resxNewlineNormalization: options.resxNewlineNormalization\r\n });\r\n const resultObject: { [stringName: string]: string } = {};\r\n for (const [stringName, stringValue] of Object.entries(locFileData)) {\r\n resultObject[stringName] = stringValue.value;\r\n }\r\n\r\n return resultObject;\r\n});\r\n"]}
{"version":3,"file":"InPlaceLocFileLoader.js","sourceRoot":"","sources":["../../src/loaders/InPlaceLocFileLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAG3D,oEAAwD;AAGxD,8DAA2D;AAC3D,mDAAoE;AACpE,gFAA6E;AAE7E,kBAAe,IAAA,6BAAa,EAAC,UAE3B,WAAmB,EACnB,OAAe,EACf,OAA2B;IAE3B,MAAM,WAAW,GAAsB,6BAAa,CAAC,YAAY,CAAC;QAChE,OAAO;QACP,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,IAAI,4BAAQ,CAAC,+CAAsB,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC;QACjF,wBAAwB,EAAE,OAAO,CAAC,wBAAwB;KAC3D,CAAC,CAAC;IACH,MAAM,YAAY,GAAqC,EAAE,CAAC;IAC1D,KAAK,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QACnE,YAAY,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC;KAC9C;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { loader } from 'webpack';\r\nimport { Terminal } from '@rushstack/node-core-library';\r\n\r\nimport { ILocalizationFile } from '../interfaces';\r\nimport { LocFileParser } from '../utilities/LocFileParser';\r\nimport { loaderFactory, IBaseLoaderOptions } from './LoaderFactory';\r\nimport { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';\r\n\r\nexport default loaderFactory(function (\r\n this: loader.LoaderContext,\r\n locFilePath: string,\r\n content: string,\r\n options: IBaseLoaderOptions\r\n) {\r\n const locFileData: ILocalizationFile = LocFileParser.parseLocFile({\r\n content,\r\n filePath: locFilePath,\r\n terminal: new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(this)),\r\n resxNewlineNormalization: options.resxNewlineNormalization\r\n });\r\n const resultObject: { [stringName: string]: string } = {};\r\n for (const [stringName, stringValue] of Object.entries(locFileData)) {\r\n resultObject[stringName] = stringValue.value;\r\n }\r\n\r\n return resultObject;\r\n});\r\n"]}

@@ -19,3 +19,3 @@ "use strict";

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -22,0 +22,0 @@ return result;

@@ -10,3 +10,3 @@ "use strict";

const LoaderTerminalProvider_1 = require("../utilities/LoaderTerminalProvider");
exports.default = LoaderFactory_1.loaderFactory(function (locFilePath, content, options) {
exports.default = (0, LoaderFactory_1.loaderFactory)(function (locFilePath, content, options) {
const { pluginInstance } = options;

@@ -13,0 +13,0 @@ const terminal = new node_core_library_1.Terminal(LoaderTerminalProvider_1.LoaderTerminalProvider.getTerminalProviderForLoader(this));

@@ -1,1 +0,1 @@

{"version":3,"file":"LocLoader.js","sourceRoot":"","sources":["../../src/loaders/LocLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAG3D,oEAAwD;AAIxD,8DAA2D;AAC3D,mDAAoE;AACpE,4DAAyD;AACzD,gFAA6E;AAM7E,kBAAe,6BAAa,CAAC,UAE3B,WAAmB,EACnB,OAAe,EACf,OAA0B;IAE1B,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IACnC,MAAM,QAAQ,GAAa,IAAI,4BAAQ,CAAC,+CAAsB,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC;IACnG,MAAM,WAAW,GAAsB,6BAAa,CAAC,YAAY,CAAC;QAChE,OAAO;QACP,QAAQ;QACR,QAAQ,EAAE,WAAW;QACrB,wBAAwB,EAAE,OAAO,CAAC,wBAAwB;KAC3D,CAAC,CAAC;IACH,MAAM,EAAE,yBAAyB,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,iBAAiB,CAC5E,QAAQ,EACR,WAAW,EACX,WAAW,CACZ,CAAC;IACF,KAAK,MAAM,cAAc,IAAI,yBAAyB,EAAE;QACtD,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;KACjC;IAED,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC1B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;KACvB;IAED,MAAM,YAAY,GAAqC,EAAE,CAAC;IAC1D,wCAAwC;IACxC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;QACpC,MAAM,SAAS,GAAW,GAAG,WAAW,IAAI,UAAU,EAAE,CAAC;QACzD,IAAI,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YAC5C,YAAY,CAAC,UAAU,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC,KAAK,CAAC;SAC5E;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,oDAAoD,SAAS,GAAG,CAAC,CAAC;SACnF;KACF;IAED,2BAAY,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAE5C,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { loader } from 'webpack';\r\nimport { Terminal } from '@rushstack/node-core-library';\r\n\r\nimport { LocalizationPlugin } from '../LocalizationPlugin';\r\nimport { ILocalizationFile } from '../interfaces';\r\nimport { LocFileParser } from '../utilities/LocFileParser';\r\nimport { loaderFactory, IBaseLoaderOptions } from './LoaderFactory';\r\nimport { EntityMarker } from '../utilities/EntityMarker';\r\nimport { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';\r\n\r\nexport interface ILocLoaderOptions extends IBaseLoaderOptions {\r\n pluginInstance: LocalizationPlugin;\r\n}\r\n\r\nexport default loaderFactory(function (\r\n this: loader.LoaderContext,\r\n locFilePath: string,\r\n content: string,\r\n options: ILocLoaderOptions\r\n) {\r\n const { pluginInstance } = options;\r\n const terminal: Terminal = new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(this));\r\n const locFileData: ILocalizationFile = LocFileParser.parseLocFile({\r\n content,\r\n terminal,\r\n filePath: locFilePath,\r\n resxNewlineNormalization: options.resxNewlineNormalization\r\n });\r\n const { additionalLoadedFilePaths, errors } = pluginInstance.addDefaultLocFile(\r\n terminal,\r\n locFilePath,\r\n locFileData\r\n );\r\n for (const additionalFile of additionalLoadedFilePaths) {\r\n this.dependency(additionalFile);\r\n }\r\n\r\n for (const error of errors) {\r\n this.emitError(error);\r\n }\r\n\r\n const resultObject: { [stringName: string]: string } = {};\r\n // eslint-disable-next-line guard-for-in\r\n for (const stringName in locFileData) {\r\n const stringKey: string = `${locFilePath}?${stringName}`;\r\n if (pluginInstance.stringKeys.has(stringKey)) {\r\n resultObject[stringName] = pluginInstance.stringKeys.get(stringKey)!.value;\r\n } else {\r\n throw new Error(`Unexpected - missing placeholder for string key \"${stringKey}\"`);\r\n }\r\n }\r\n\r\n EntityMarker.markEntity(this._module, true);\r\n\r\n return resultObject;\r\n});\r\n"]}
{"version":3,"file":"LocLoader.js","sourceRoot":"","sources":["../../src/loaders/LocLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAG3D,oEAAwD;AAIxD,8DAA2D;AAC3D,mDAAoE;AACpE,4DAAyD;AACzD,gFAA6E;AAM7E,kBAAe,IAAA,6BAAa,EAAC,UAE3B,WAAmB,EACnB,OAAe,EACf,OAA0B;IAE1B,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IACnC,MAAM,QAAQ,GAAa,IAAI,4BAAQ,CAAC,+CAAsB,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC;IACnG,MAAM,WAAW,GAAsB,6BAAa,CAAC,YAAY,CAAC;QAChE,OAAO;QACP,QAAQ;QACR,QAAQ,EAAE,WAAW;QACrB,wBAAwB,EAAE,OAAO,CAAC,wBAAwB;KAC3D,CAAC,CAAC;IACH,MAAM,EAAE,yBAAyB,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,iBAAiB,CAC5E,QAAQ,EACR,WAAW,EACX,WAAW,CACZ,CAAC;IACF,KAAK,MAAM,cAAc,IAAI,yBAAyB,EAAE;QACtD,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;KACjC;IAED,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC1B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;KACvB;IAED,MAAM,YAAY,GAAqC,EAAE,CAAC;IAC1D,wCAAwC;IACxC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;QACpC,MAAM,SAAS,GAAW,GAAG,WAAW,IAAI,UAAU,EAAE,CAAC;QACzD,IAAI,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YAC5C,YAAY,CAAC,UAAU,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC,KAAK,CAAC;SAC5E;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,oDAAoD,SAAS,GAAG,CAAC,CAAC;SACnF;KACF;IAED,2BAAY,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAE5C,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { loader } from 'webpack';\r\nimport { Terminal } from '@rushstack/node-core-library';\r\n\r\nimport { LocalizationPlugin } from '../LocalizationPlugin';\r\nimport { ILocalizationFile } from '../interfaces';\r\nimport { LocFileParser } from '../utilities/LocFileParser';\r\nimport { loaderFactory, IBaseLoaderOptions } from './LoaderFactory';\r\nimport { EntityMarker } from '../utilities/EntityMarker';\r\nimport { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';\r\n\r\nexport interface ILocLoaderOptions extends IBaseLoaderOptions {\r\n pluginInstance: LocalizationPlugin;\r\n}\r\n\r\nexport default loaderFactory(function (\r\n this: loader.LoaderContext,\r\n locFilePath: string,\r\n content: string,\r\n options: ILocLoaderOptions\r\n) {\r\n const { pluginInstance } = options;\r\n const terminal: Terminal = new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(this));\r\n const locFileData: ILocalizationFile = LocFileParser.parseLocFile({\r\n content,\r\n terminal,\r\n filePath: locFilePath,\r\n resxNewlineNormalization: options.resxNewlineNormalization\r\n });\r\n const { additionalLoadedFilePaths, errors } = pluginInstance.addDefaultLocFile(\r\n terminal,\r\n locFilePath,\r\n locFileData\r\n );\r\n for (const additionalFile of additionalLoadedFilePaths) {\r\n this.dependency(additionalFile);\r\n }\r\n\r\n for (const error of errors) {\r\n this.emitError(error);\r\n }\r\n\r\n const resultObject: { [stringName: string]: string } = {};\r\n // eslint-disable-next-line guard-for-in\r\n for (const stringName in locFileData) {\r\n const stringKey: string = `${locFilePath}?${stringName}`;\r\n if (pluginInstance.stringKeys.has(stringKey)) {\r\n resultObject[stringName] = pluginInstance.stringKeys.get(stringKey)!.value;\r\n } else {\r\n throw new Error(`Unexpected - missing placeholder for string key \"${stringKey}\"`);\r\n }\r\n }\r\n\r\n EntityMarker.markEntity(this._module, true);\r\n\r\n return resultObject;\r\n});\r\n"]}

@@ -19,3 +19,3 @@ "use strict";

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -22,0 +22,0 @@ return result;

@@ -1,1 +0,1 @@

{"version":3,"file":"LocalizationPlugin.js","sourceRoot":"","sources":["../src/LocalizationPlugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;AAE3D,oEAA2F;AAC3F,iDAAmC;AACnC,2CAA6B;AAG7B,qDAAkD;AAClD,+EAGuC;AAWvC,uEAAoE;AACpE,6DAA0D;AAC1D,2DAAwD;AACxD,qDAAkG;AAClG,6DAA0D;AAuD1D,MAAM,WAAW,GAAW,cAAc,CAAC;AAE3C;;;;GAIG;AACH,MAAa,kBAAkB;IAmC7B,YAAmB,OAAm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;YACzE,mBAAmB;YACnB,IAAI,CAAC,qBAAqB,IAAI,KAAK,CAAC,UAAU,EAAE,EAAE;gBAChD,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,iBAAiB,EAAE,EAAE;oBAClD,IAAI,IAAI,CAAC,yBAAyB,CAAC,UAAU,CAAC,EAAE;wBAC9C,qBAAqB,GAAG,IAAI,CAAC;wBAC7B,MAAM;qBACP;iBACF;aACF;YAED,2BAAY,CAAC,UAAU,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAAC;SACvD;QAED,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IAEO,iCAAiC,CAAC,OAA0B;QAClE,MAAM,WAAW,GAAoB,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAChE,WAAW,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC;SAC9C;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AA/uBD,gDA+uBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { JsonFile, FileSystem, Terminal, NewlineKind } from '@rushstack/node-core-library';\r\nimport * as Webpack from 'webpack';\r\nimport * as path from 'path';\r\nimport * as Tapable from 'tapable';\r\n\r\nimport { Constants } from './utilities/Constants';\r\nimport {\r\n IWebpackConfigurationUpdaterOptions,\r\n WebpackConfigurationUpdater\r\n} from './WebpackConfigurationUpdater';\r\nimport {\r\n ILocalizationPluginOptions,\r\n ILocalizationStats,\r\n ILocaleFileData,\r\n ILocalizationFile,\r\n ILocaleElementMap,\r\n ILocalizedStrings,\r\n IResolvedMissingTranslations\r\n} from './interfaces';\r\nimport { ILocalizedWebpackChunk } from './webpackInterfaces';\r\nimport { LocFileTypingsGenerator } from './LocFileTypingsGenerator';\r\nimport { Pseudolocalization } from './Pseudolocalization';\r\nimport { EntityMarker } from './utilities/EntityMarker';\r\nimport { IAsset, IProcessAssetResult, AssetProcessor, PLACEHOLDER_REGEX } from './AssetProcessor';\r\nimport { LocFileParser } from './utilities/LocFileParser';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface IStringPlaceholder {\r\n value: string;\r\n suffix: string;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface IAddDefaultLocFileResult {\r\n /**\r\n * A list of paths to translation files that were loaded\r\n */\r\n additionalLoadedFilePaths: string[];\r\n\r\n errors: Error[];\r\n}\r\n\r\ninterface IExtendedMainTemplate {\r\n hooks: {\r\n assetPath: Tapable.SyncHook<string, IAssetPathOptions>;\r\n };\r\n}\r\n\r\ninterface IExtendedConfiguration extends Webpack.compilation.Compilation {\r\n options: Webpack.Configuration;\r\n}\r\n\r\ninterface IExtendedChunkGroup extends Webpack.compilation.ChunkGroup {\r\n getChildren(): Webpack.compilation.Chunk[];\r\n}\r\n\r\ninterface IExtendedChunk extends Webpack.compilation.Chunk {\r\n filenameTemplate: string;\r\n}\r\n\r\ninterface IAssetPathOptions {\r\n chunk: Webpack.compilation.Chunk;\r\n contentHashType: string;\r\n filename: string;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface IStringSerialNumberData {\r\n values: ILocaleElementMap;\r\n locFilePath: string;\r\n stringName: string;\r\n}\r\n\r\nconst PLUGIN_NAME: string = 'localization';\r\n\r\n/**\r\n * This plugin facilitates localization in webpack.\r\n *\r\n * @public\r\n */\r\nexport class LocalizationPlugin implements Webpack.Plugin {\r\n /**\r\n * @internal\r\n */\r\n public stringKeys: Map<string, IStringPlaceholder> = new Map<string, IStringPlaceholder>();\r\n\r\n private _options: ILocalizationPluginOptions;\r\n private _resolvedTranslatedStringsFromOptions!: ILocalizedStrings;\r\n private _filesToIgnore: Set<string> = new Set<string>();\r\n private _stringPlaceholderCounter: number = 0;\r\n private _stringPlaceholderMap: Map<string, IStringSerialNumberData> = new Map<\r\n string,\r\n IStringSerialNumberData\r\n >();\r\n private _locales: Set<string> = new Set<string>();\r\n private _passthroughLocaleName!: string;\r\n private _defaultLocale!: string;\r\n private _noStringsLocaleName!: string;\r\n private _fillMissingTranslationStrings!: boolean;\r\n private _pseudolocalizers: Map<string, (str: string) => string> = new Map<\r\n string,\r\n (str: string) => string\r\n >();\r\n private _resxNewlineNormalization: NewlineKind | undefined;\r\n\r\n /**\r\n * The outermost map's keys are the locale names.\r\n * The middle map's keys are the resolved, file names.\r\n * The innermost map's keys are the string identifiers and its values are the string values.\r\n */\r\n private _resolvedLocalizedStrings: Map<string, Map<string, Map<string, string>>> = new Map<\r\n string,\r\n Map<string, Map<string, string>>\r\n >();\r\n\r\n public constructor(options: ILocalizationPluginOptions) {\r\n this._options = options;\r\n }\r\n\r\n public apply(compiler: Webpack.Compiler): void {\r\n const isWebpack4: boolean = !!compiler.hooks;\r\n\r\n if (!isWebpack4) {\r\n throw new Error(`The ${LocalizationPlugin.name} plugin requires Webpack 4`);\r\n }\r\n\r\n if (this._options.typingsOptions && compiler.context) {\r\n if (\r\n this._options.typingsOptions.generatedTsFolder &&\r\n !path.isAbsolute(this._options.typingsOptions.generatedTsFolder)\r\n ) {\r\n this._options.typingsOptions.generatedTsFolder = path.resolve(\r\n compiler.context,\r\n this._options.typingsOptions.generatedTsFolder\r\n );\r\n }\r\n\r\n if (\r\n this._options.typingsOptions.sourceRoot &&\r\n !path.isAbsolute(this._options.typingsOptions.sourceRoot)\r\n ) {\r\n this._options.typingsOptions.sourceRoot = path.resolve(\r\n compiler.context,\r\n this._options.typingsOptions.sourceRoot\r\n );\r\n }\r\n }\r\n\r\n // https://github.com/webpack/webpack-dev-server/pull/1929/files#diff-15fb51940da53816af13330d8ce69b4eR66\r\n const isWebpackDevServer: boolean = process.env.WEBPACK_DEV_SERVER === 'true';\r\n\r\n const { errors, warnings } = this._initializeAndValidateOptions(compiler.options, isWebpackDevServer);\r\n\r\n let typingsPreprocessor: LocFileTypingsGenerator | undefined;\r\n if (this._options.typingsOptions) {\r\n typingsPreprocessor = new LocFileTypingsGenerator({\r\n srcFolder: this._options.typingsOptions.sourceRoot || compiler.context,\r\n generatedTsFolder: this._options.typingsOptions.generatedTsFolder,\r\n exportAsDefault: this._options.typingsOptions.exportAsDefault,\r\n filesToIgnore: this._options.filesToIgnore\r\n });\r\n } else {\r\n typingsPreprocessor = undefined;\r\n }\r\n\r\n const webpackConfigurationUpdaterOptions: IWebpackConfigurationUpdaterOptions = {\r\n pluginInstance: this,\r\n configuration: compiler.options,\r\n filesToIgnore: this._filesToIgnore,\r\n localeNameOrPlaceholder: Constants.LOCALE_NAME_PLACEHOLDER,\r\n resxNewlineNormalization: this._resxNewlineNormalization\r\n };\r\n\r\n if (errors.length > 0 || warnings.length > 0) {\r\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation: Webpack.compilation.Compilation) => {\r\n compilation.errors.push(...errors);\r\n compilation.warnings.push(...warnings);\r\n });\r\n\r\n if (errors.length > 0) {\r\n // If there are any errors, just pass through the resources in source and don't do any\r\n // additional configuration\r\n WebpackConfigurationUpdater.amendWebpackConfigurationForInPlaceLocFiles(\r\n webpackConfigurationUpdaterOptions\r\n );\r\n return;\r\n }\r\n }\r\n\r\n if (isWebpackDevServer) {\r\n if (typingsPreprocessor) {\r\n compiler.hooks.afterEnvironment.tap(PLUGIN_NAME, () => typingsPreprocessor!.runWatcherAsync());\r\n\r\n if (!compiler.options.plugins) {\r\n compiler.options.plugins = [];\r\n }\r\n\r\n compiler.options.plugins.push(\r\n new Webpack.WatchIgnorePlugin([this._options.typingsOptions!.generatedTsFolder])\r\n );\r\n }\r\n\r\n WebpackConfigurationUpdater.amendWebpackConfigurationForInPlaceLocFiles(\r\n webpackConfigurationUpdaterOptions\r\n );\r\n } else {\r\n if (typingsPreprocessor) {\r\n compiler.hooks.beforeRun.tapPromise(\r\n PLUGIN_NAME,\r\n async () => await typingsPreprocessor!.generateTypingsAsync()\r\n );\r\n }\r\n\r\n WebpackConfigurationUpdater.amendWebpackConfigurationForMultiLocale(webpackConfigurationUpdaterOptions);\r\n\r\n if (errors.length === 0) {\r\n compiler.hooks.thisCompilation.tap(\r\n PLUGIN_NAME,\r\n (untypedCompilation: Webpack.compilation.Compilation) => {\r\n const compilation: IExtendedConfiguration = untypedCompilation as IExtendedConfiguration;\r\n (compilation.mainTemplate as unknown as IExtendedMainTemplate).hooks.assetPath.tap(\r\n PLUGIN_NAME,\r\n (assetPath: string, options: IAssetPathOptions) => {\r\n if (\r\n options.contentHashType === 'javascript' &&\r\n assetPath.match(Constants.LOCALE_FILENAME_TOKEN_REGEX)\r\n ) {\r\n // Does this look like an async chunk URL generator?\r\n if (typeof options.chunk.id === 'string' && (options.chunk.id as string).match(/^\\\" \\+/)) {\r\n return assetPath.replace(\r\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\r\n `\" + ${Constants.JSONP_PLACEHOLDER} + \"`\r\n );\r\n } else {\r\n return assetPath.replace(\r\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\r\n Constants.LOCALE_NAME_PLACEHOLDER\r\n );\r\n }\r\n } else if (assetPath.match(Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX)) {\r\n // Replace the placeholder with the [locale] token for sourcemaps\r\n const deLocalizedFilename: string = options.filename.replace(\r\n PLACEHOLDER_REGEX,\r\n Constants.LOCALE_FILENAME_TOKEN\r\n );\r\n return assetPath.replace(\r\n Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX,\r\n deLocalizedFilename\r\n );\r\n } else {\r\n return assetPath;\r\n }\r\n }\r\n );\r\n\r\n compilation.hooks.optimizeChunks.tap(\r\n PLUGIN_NAME,\r\n (\r\n untypedChunks: Webpack.compilation.Chunk[],\r\n untypedChunkGroups: Webpack.compilation.ChunkGroup[]\r\n ) => {\r\n const chunks: IExtendedChunk[] = untypedChunks as IExtendedChunk[];\r\n const chunkGroups: IExtendedChunkGroup[] = untypedChunkGroups as IExtendedChunkGroup[];\r\n\r\n let chunksHaveAnyChildren: boolean = false;\r\n for (const chunkGroup of chunkGroups) {\r\n const children: Webpack.compilation.Chunk[] = chunkGroup.getChildren();\r\n if (children.length > 0) {\r\n chunksHaveAnyChildren = true;\r\n break;\r\n }\r\n }\r\n\r\n if (\r\n chunksHaveAnyChildren &&\r\n (!compilation.options.output ||\r\n !compilation.options.output.chunkFilename ||\r\n compilation.options.output.chunkFilename.indexOf(Constants.LOCALE_FILENAME_TOKEN) === -1)\r\n ) {\r\n compilation.errors.push(\r\n new Error(\r\n 'The configuration.output.chunkFilename property must be provided and must include ' +\r\n `the ${Constants.LOCALE_FILENAME_TOKEN} placeholder`\r\n )\r\n );\r\n\r\n return;\r\n }\r\n\r\n for (const chunk of chunks) {\r\n // See if the chunk contains any localized modules or loads any localized chunks\r\n const localizedChunk: boolean = this._chunkHasLocalizedModules(chunk);\r\n\r\n // Change the chunk's name to include either the locale name or the locale name for chunks without strings\r\n const replacementValue: string = localizedChunk\r\n ? Constants.LOCALE_NAME_PLACEHOLDER\r\n : this._noStringsLocaleName;\r\n if (chunk.hasRuntime()) {\r\n chunk.filenameTemplate = (compilation.options.output!.filename as string).replace(\r\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\r\n replacementValue\r\n );\r\n } else {\r\n chunk.filenameTemplate = compilation.options.output!.chunkFilename!.replace(\r\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\r\n replacementValue\r\n );\r\n }\r\n }\r\n }\r\n );\r\n }\r\n );\r\n\r\n compiler.hooks.emit.tap(PLUGIN_NAME, (compilation: Webpack.compilation.Compilation) => {\r\n const localizationStats: ILocalizationStats = {\r\n entrypoints: {},\r\n namedChunkGroups: {}\r\n };\r\n\r\n const alreadyProcessedAssets: Set<string> = new Set<string>();\r\n const hotUpdateRegex: RegExp = /\\.hot-update\\.js$/;\r\n\r\n for (const untypedChunk of compilation.chunks) {\r\n const chunk: ILocalizedWebpackChunk = untypedChunk;\r\n const chunkFilesSet: Set<string> = new Set(chunk.files);\r\n function processChunkJsFile(callback: (chunkFilename: string) => void): void {\r\n let alreadyProcessedAFileInThisChunk: boolean = false;\r\n for (const chunkFilename of chunk.files) {\r\n if (\r\n chunkFilename.endsWith('.js') && // Ensure this is a JS file\r\n !hotUpdateRegex.test(chunkFilename) && // Ensure this is not a webpack hot update\r\n !alreadyProcessedAssets.has(chunkFilename) // Ensure this isn't a vendor chunk we've already processed\r\n ) {\r\n if (alreadyProcessedAFileInThisChunk) {\r\n throw new Error(\r\n `Found more than one JS file in chunk \"${chunk.name}\". This is not expected.`\r\n );\r\n }\r\n\r\n alreadyProcessedAFileInThisChunk = true;\r\n alreadyProcessedAssets.add(chunkFilename);\r\n callback(chunkFilename);\r\n }\r\n }\r\n }\r\n\r\n if (this._chunkHasLocalizedModules(chunk)) {\r\n processChunkJsFile((chunkFilename) => {\r\n if (chunkFilename.indexOf(Constants.LOCALE_NAME_PLACEHOLDER) === -1) {\r\n throw new Error(\r\n `Asset ${chunkFilename} is expected to be localized, but is missing a locale placeholder`\r\n );\r\n }\r\n\r\n const asset: IAsset = compilation.assets[chunkFilename];\r\n\r\n const resultingAssets: Map<string, IProcessAssetResult> =\r\n AssetProcessor.processLocalizedAsset({\r\n plugin: this,\r\n compilation,\r\n assetName: chunkFilename,\r\n asset,\r\n chunk,\r\n chunkHasLocalizedModules: this._chunkHasLocalizedModules.bind(this),\r\n locales: this._locales,\r\n noStringsLocaleName: this._noStringsLocaleName,\r\n fillMissingTranslationStrings: this._fillMissingTranslationStrings,\r\n defaultLocale: this._defaultLocale\r\n });\r\n\r\n // Delete the existing asset because it's been renamed\r\n delete compilation.assets[chunkFilename];\r\n chunkFilesSet.delete(chunkFilename);\r\n\r\n const localizedChunkAssets: ILocaleElementMap = {};\r\n for (const [locale, newAsset] of resultingAssets) {\r\n compilation.assets[newAsset.filename] = newAsset.asset;\r\n localizedChunkAssets[locale] = newAsset.filename;\r\n chunkFilesSet.add(newAsset.filename);\r\n }\r\n\r\n if (chunk.hasRuntime()) {\r\n // This is an entrypoint\r\n localizationStats.entrypoints[chunk.name] = {\r\n localizedAssets: localizedChunkAssets\r\n };\r\n } else {\r\n // This is a secondary chunk\r\n if (chunk.name) {\r\n localizationStats.namedChunkGroups[chunk.name] = {\r\n localizedAssets: localizedChunkAssets\r\n };\r\n }\r\n }\r\n\r\n chunk.localizedFiles = localizedChunkAssets;\r\n });\r\n } else {\r\n processChunkJsFile((chunkFilename) => {\r\n const asset: IAsset = compilation.assets[chunkFilename];\r\n\r\n const resultingAsset: IProcessAssetResult = AssetProcessor.processNonLocalizedAsset({\r\n plugin: this,\r\n compilation,\r\n assetName: chunkFilename,\r\n asset,\r\n chunk,\r\n noStringsLocaleName: this._noStringsLocaleName,\r\n chunkHasLocalizedModules: this._chunkHasLocalizedModules.bind(this)\r\n });\r\n\r\n // Delete the existing asset because it's been renamed\r\n delete compilation.assets[chunkFilename];\r\n chunkFilesSet.delete(chunkFilename);\r\n\r\n compilation.assets[resultingAsset.filename] = resultingAsset.asset;\r\n chunkFilesSet.add(resultingAsset.filename);\r\n });\r\n }\r\n\r\n chunk.files = Array.from(chunkFilesSet);\r\n }\r\n\r\n if (this._options.localizationStats) {\r\n if (this._options.localizationStats.dropPath) {\r\n const resolvedLocalizationStatsDropPath: string = path.resolve(\r\n compiler.outputPath,\r\n this._options.localizationStats.dropPath\r\n );\r\n JsonFile.save(localizationStats, resolvedLocalizationStatsDropPath, {\r\n ensureFolderExists: true\r\n });\r\n }\r\n\r\n if (this._options.localizationStats.callback) {\r\n try {\r\n this._options.localizationStats.callback(localizationStats);\r\n } catch (e) {\r\n /* swallow errors from the callback */\r\n }\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n *\r\n * @returns\r\n */\r\n public addDefaultLocFile(\r\n terminal: Terminal,\r\n localizedResourcePath: string,\r\n localizedResourceData: ILocalizationFile\r\n ): IAddDefaultLocFileResult {\r\n const additionalLoadedFilePaths: string[] = [];\r\n const errors: Error[] = [];\r\n\r\n const locFileData: ILocaleFileData = this._convertLocalizationFileToLocData(localizedResourceData);\r\n this._addLocFile(this._defaultLocale, localizedResourcePath, locFileData);\r\n\r\n const normalizeLocalizedData: (localizedData: ILocaleFileData | string) => ILocaleFileData = (\r\n localizedData\r\n ) => {\r\n if (typeof localizedData === 'string') {\r\n additionalLoadedFilePaths.push(localizedData);\r\n const localizationFile: ILocalizationFile = LocFileParser.parseLocFile({\r\n filePath: localizedData,\r\n content: FileSystem.readFile(localizedData),\r\n terminal: terminal,\r\n resxNewlineNormalization: this._resxNewlineNormalization\r\n });\r\n\r\n return this._convertLocalizationFileToLocData(localizationFile);\r\n } else {\r\n return localizedData;\r\n }\r\n };\r\n\r\n const missingLocales: string[] = [];\r\n for (const [translatedLocaleName, translatedStrings] of Object.entries(\r\n this._resolvedTranslatedStringsFromOptions\r\n )) {\r\n const translatedLocFileFromOptions: ILocaleFileData | string | undefined =\r\n translatedStrings[localizedResourcePath];\r\n if (!translatedLocFileFromOptions) {\r\n missingLocales.push(translatedLocaleName);\r\n } else {\r\n const translatedLocFileData: ILocaleFileData = normalizeLocalizedData(translatedLocFileFromOptions);\r\n this._addLocFile(translatedLocaleName, localizedResourcePath, translatedLocFileData);\r\n }\r\n }\r\n\r\n if (missingLocales.length > 0 && this._options.localizedData.resolveMissingTranslatedStrings) {\r\n let resolvedTranslatedData: IResolvedMissingTranslations | undefined = undefined;\r\n try {\r\n resolvedTranslatedData = this._options.localizedData.resolveMissingTranslatedStrings(\r\n missingLocales,\r\n localizedResourcePath\r\n );\r\n } catch (e) {\r\n errors.push(e);\r\n }\r\n\r\n if (resolvedTranslatedData) {\r\n for (const [resolvedLocaleName, resolvedLocaleData] of Object.entries(resolvedTranslatedData)) {\r\n if (resolvedLocaleData) {\r\n const translatedLocFileData: ILocaleFileData = normalizeLocalizedData(resolvedLocaleData);\r\n this._addLocFile(resolvedLocaleName, localizedResourcePath, translatedLocFileData);\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._pseudolocalizers.forEach((pseudolocalizer: (str: string) => string, pseudolocaleName: string) => {\r\n const pseudolocFileData: ILocaleFileData = {};\r\n\r\n for (const [stringName, stringValue] of Object.entries(locFileData)) {\r\n pseudolocFileData[stringName] = pseudolocalizer(stringValue);\r\n }\r\n\r\n this._addLocFile(pseudolocaleName, localizedResourcePath, pseudolocFileData);\r\n });\r\n\r\n return { additionalLoadedFilePaths, errors };\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public getDataForSerialNumber(serialNumber: string): IStringSerialNumberData | undefined {\r\n return this._stringPlaceholderMap.get(serialNumber);\r\n }\r\n\r\n private _addLocFile(\r\n localeName: string,\r\n localizedFilePath: string,\r\n localizedFileData: ILocaleFileData\r\n ): void {\r\n const filesMap: Map<string, Map<string, string>> = this._resolvedLocalizedStrings.get(localeName)!;\r\n\r\n const stringsMap: Map<string, string> = new Map<string, string>();\r\n filesMap.set(localizedFilePath, stringsMap);\r\n\r\n for (const [stringName, stringValue] of Object.entries(localizedFileData)) {\r\n const stringKey: string = `${localizedFilePath}?${stringName}`;\r\n if (!this.stringKeys.has(stringKey)) {\r\n const placeholder: IStringPlaceholder = this._getPlaceholderString();\r\n this.stringKeys.set(stringKey, placeholder);\r\n }\r\n\r\n const placeholder: IStringPlaceholder = this.stringKeys.get(stringKey)!;\r\n if (!this._stringPlaceholderMap.has(placeholder.suffix)) {\r\n this._stringPlaceholderMap.set(placeholder.suffix, {\r\n values: {\r\n [this._passthroughLocaleName]: stringName\r\n },\r\n locFilePath: localizedFilePath,\r\n stringName: stringName\r\n });\r\n }\r\n\r\n this._stringPlaceholderMap.get(placeholder.suffix)!.values[localeName] = stringValue;\r\n\r\n stringsMap.set(stringName, stringValue);\r\n }\r\n }\r\n\r\n private _initializeAndValidateOptions(\r\n configuration: Webpack.Configuration,\r\n isWebpackDevServer: boolean\r\n ): { errors: Error[]; warnings: Error[] } {\r\n const errors: Error[] = [];\r\n const warnings: Error[] = [];\r\n\r\n function ensureValidLocaleName(localeName: string): boolean {\r\n const LOCALE_NAME_REGEX: RegExp = /[a-z-]/i;\r\n if (!localeName.match(LOCALE_NAME_REGEX)) {\r\n errors.push(\r\n new Error(`Invalid locale name: ${localeName}. Locale names may only contain letters and hyphens.`)\r\n );\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n }\r\n\r\n // START configuration\r\n if (\r\n !configuration.output ||\r\n !configuration.output.filename ||\r\n typeof configuration.output.filename !== 'string' ||\r\n configuration.output.filename.indexOf(Constants.LOCALE_FILENAME_TOKEN) === -1\r\n ) {\r\n errors.push(\r\n new Error(\r\n 'The configuration.output.filename property must be provided, must be a string, and must include ' +\r\n `the ${Constants.LOCALE_FILENAME_TOKEN} placeholder`\r\n )\r\n );\r\n }\r\n // END configuration\r\n\r\n // START options.filesToIgnore\r\n // eslint-disable-next-line no-lone-blocks\r\n {\r\n for (const filePath of this._options.filesToIgnore || []) {\r\n const normalizedFilePath: string = path.resolve(configuration.context!, filePath);\r\n this._filesToIgnore.add(normalizedFilePath);\r\n }\r\n }\r\n // END options.filesToIgnore\r\n\r\n // START options.localizedData\r\n if (this._options.localizedData) {\r\n // START options.localizedData.passthroughLocale\r\n if (this._options.localizedData.passthroughLocale) {\r\n const { usePassthroughLocale, passthroughLocaleName = 'passthrough' } =\r\n this._options.localizedData.passthroughLocale;\r\n if (usePassthroughLocale) {\r\n this._passthroughLocaleName = passthroughLocaleName;\r\n this._locales.add(passthroughLocaleName);\r\n }\r\n }\r\n // END options.localizedData.passthroughLocale\r\n\r\n // START options.localizedData.translatedStrings\r\n const { translatedStrings } = this._options.localizedData;\r\n this._resolvedTranslatedStringsFromOptions = {};\r\n if (translatedStrings) {\r\n for (const [localeName, locale] of Object.entries(translatedStrings)) {\r\n if (this._locales.has(localeName)) {\r\n errors.push(\r\n Error(\r\n `The locale \"${localeName}\" appears multiple times. ` +\r\n 'There may be multiple instances with different casing.'\r\n )\r\n );\r\n return { errors, warnings };\r\n }\r\n\r\n if (!ensureValidLocaleName(localeName)) {\r\n return { errors, warnings };\r\n }\r\n\r\n this._locales.add(localeName);\r\n this._resolvedLocalizedStrings.set(localeName, new Map<string, Map<string, string>>());\r\n this._resolvedTranslatedStringsFromOptions[localeName] = {};\r\n\r\n const locFilePathsInLocale: Set<string> = new Set<string>();\r\n\r\n for (const [locFilePath, locFileDataFromOptions] of Object.entries(locale)) {\r\n if (locale.hasOwnProperty(locFilePath)) {\r\n const normalizedLocFilePath: string = path.resolve(configuration.context!, locFilePath);\r\n\r\n if (locFilePathsInLocale.has(normalizedLocFilePath)) {\r\n errors.push(\r\n new Error(\r\n `The localization file path \"${locFilePath}\" appears multiple times in locale ${localeName}. ` +\r\n 'There may be multiple instances with different casing.'\r\n )\r\n );\r\n return { errors, warnings };\r\n }\r\n\r\n locFilePathsInLocale.add(normalizedLocFilePath);\r\n\r\n const normalizedLocFileDataFromOptions: string | ILocaleFileData =\r\n typeof locFileDataFromOptions === 'string'\r\n ? path.resolve(configuration.context!, locFileDataFromOptions)\r\n : locFileDataFromOptions;\r\n\r\n this._resolvedTranslatedStringsFromOptions[localeName][normalizedLocFilePath] =\r\n normalizedLocFileDataFromOptions;\r\n }\r\n }\r\n }\r\n }\r\n // END options.localizedData.translatedStrings\r\n\r\n // START options.localizedData.defaultLocale\r\n if (this._options.localizedData.defaultLocale) {\r\n const { localeName, fillMissingTranslationStrings } = this._options.localizedData.defaultLocale;\r\n if (this._options.localizedData.defaultLocale.localeName) {\r\n if (this._locales.has(localeName)) {\r\n errors.push(new Error('The default locale is also specified in the translated strings.'));\r\n return { errors, warnings };\r\n } else if (!ensureValidLocaleName(localeName)) {\r\n return { errors, warnings };\r\n }\r\n\r\n this._locales.add(localeName);\r\n this._resolvedLocalizedStrings.set(localeName, new Map<string, Map<string, string>>());\r\n this._defaultLocale = localeName;\r\n this._fillMissingTranslationStrings = !!fillMissingTranslationStrings;\r\n } else {\r\n errors.push(new Error('Missing default locale name'));\r\n return { errors, warnings };\r\n }\r\n } else {\r\n errors.push(new Error('Missing default locale options.'));\r\n return { errors, warnings };\r\n }\r\n // END options.localizedData.defaultLocale\r\n\r\n // START options.localizedData.pseudoLocales\r\n if (this._options.localizedData.pseudolocales) {\r\n for (const [pseudolocaleName, pseudoLocaleOpts] of Object.entries(\r\n this._options.localizedData.pseudolocales\r\n )) {\r\n if (this._defaultLocale === pseudolocaleName) {\r\n errors.push(\r\n new Error(`A pseudolocale (${pseudolocaleName}) name is also the default locale name.`)\r\n );\r\n return { errors, warnings };\r\n }\r\n\r\n if (this._locales.has(pseudolocaleName)) {\r\n errors.push(\r\n new Error(\r\n `A pseudolocale (${pseudolocaleName}) name is also specified in the translated strings.`\r\n )\r\n );\r\n return { errors, warnings };\r\n }\r\n\r\n this._pseudolocalizers.set(\r\n pseudolocaleName,\r\n Pseudolocalization.getPseudolocalizer(pseudoLocaleOpts)\r\n );\r\n this._locales.add(pseudolocaleName);\r\n this._resolvedLocalizedStrings.set(pseudolocaleName, new Map<string, Map<string, string>>());\r\n }\r\n }\r\n // END options.localizedData.pseudoLocales\r\n\r\n // START options.localizedData.normalizeResxNewlines\r\n if (this._options.localizedData.normalizeResxNewlines) {\r\n switch (this._options.localizedData.normalizeResxNewlines) {\r\n case 'crlf': {\r\n this._resxNewlineNormalization = NewlineKind.CrLf;\r\n break;\r\n }\r\n\r\n case 'lf': {\r\n this._resxNewlineNormalization = NewlineKind.Lf;\r\n break;\r\n }\r\n\r\n default: {\r\n errors.push(\r\n new Error(\r\n `Unexpected value \"${this._options.localizedData.normalizeResxNewlines}\" for option ` +\r\n '\"localizedData.normalizeResxNewlines\"'\r\n )\r\n );\r\n break;\r\n }\r\n }\r\n }\r\n // END options.localizedData.normalizeResxNewlines\r\n } else if (!isWebpackDevServer) {\r\n throw new Error('Localized data must be provided unless webpack dev server is running.');\r\n }\r\n // END options.localizedData\r\n\r\n // START options.noStringsLocaleName\r\n if (\r\n this._options.noStringsLocaleName === undefined ||\r\n this._options.noStringsLocaleName === null ||\r\n !ensureValidLocaleName(this._options.noStringsLocaleName)\r\n ) {\r\n this._noStringsLocaleName = 'none';\r\n } else {\r\n this._noStringsLocaleName = this._options.noStringsLocaleName;\r\n }\r\n // END options.noStringsLocaleName\r\n\r\n return { errors, warnings };\r\n }\r\n\r\n private _getPlaceholderString(): IStringPlaceholder {\r\n const suffix: string = (this._stringPlaceholderCounter++).toString();\r\n return {\r\n value: `${Constants.STRING_PLACEHOLDER_PREFIX}_\\\\_${Constants.STRING_PLACEHOLDER_LABEL}_${suffix}`,\r\n suffix: suffix\r\n };\r\n }\r\n\r\n private _chunkHasLocalizedModules(chunk: Webpack.compilation.Chunk): boolean {\r\n let chunkHasAnyLocModules: boolean | undefined = EntityMarker.getMark(chunk);\r\n if (chunkHasAnyLocModules === undefined) {\r\n chunkHasAnyLocModules = false;\r\n for (const module of chunk.getModules()) {\r\n if (EntityMarker.getMark(module)) {\r\n chunkHasAnyLocModules = true;\r\n break;\r\n }\r\n }\r\n\r\n // If this chunk doesn't directly contain any localized resources, it still\r\n // needs to be localized if it's an entrypoint chunk (i.e. - it has a runtime)\r\n // and it loads localized async chunks.\r\n // In that case, the generated chunk URL generation code needs to contain\r\n // the locale name.\r\n if (!chunkHasAnyLocModules && chunk.hasRuntime()) {\r\n for (const asyncChunk of chunk.getAllAsyncChunks()) {\r\n if (this._chunkHasLocalizedModules(asyncChunk)) {\r\n chunkHasAnyLocModules = true;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n EntityMarker.markEntity(chunk, chunkHasAnyLocModules);\r\n }\r\n\r\n return chunkHasAnyLocModules;\r\n }\r\n\r\n private _convertLocalizationFileToLocData(locFile: ILocalizationFile): ILocaleFileData {\r\n const locFileData: ILocaleFileData = {};\r\n for (const [stringName, locFileEntry] of Object.entries(locFile)) {\r\n locFileData[stringName] = locFileEntry.value;\r\n }\r\n\r\n return locFileData;\r\n }\r\n}\r\n"]}
{"version":3,"file":"LocalizationPlugin.js","sourceRoot":"","sources":["../src/LocalizationPlugin.ts"],"names":[],"mappings":";AAAA,4FA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AAqB,KAAK,SAAS,EAAE;YACvC,qBAAqB,GAAG,KAAK,CAAC;YAC9B,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,UAAU,EAAE,EAAE;gBACvC,IAAI,2BAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;oBAChC,qBAAqB,GAAG,IAAI,CAAC;oBAC7B,MAAM;iBACP;aACF;YAED,2EAA2E;YAC3E,8EAA8E;YAC9E,uCAAuC;YACvC,yEAAyE;YACzE,mBAAmB;YACnB,IAAI,CAAC,qBAAqB,IAAI,KAAK,CAAC,UAAU,EAAE,EAAE;gBAChD,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,iBAAiB,EAAE,EAAE;oBAClD,IAAI,IAAI,CAAC,yBAAyB,CAAC,UAAU,CAAC,EAAE;wBAC9C,qBAAqB,GAAG,IAAI,CAAC;wBAC7B,MAAM;qBACP;iBACF;aACF;YAED,2BAAY,CAAC,UAAU,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAAC;SACvD;QAED,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IAEO,iCAAiC,CAAC,OAA0B;QAClE,MAAM,WAAW,GAAoB,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAChE,WAAW,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC;SAC9C;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AA/uBD,gDA+uBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { JsonFile, FileSystem, Terminal, NewlineKind } from '@rushstack/node-core-library';\r\nimport * as Webpack from 'webpack';\r\nimport * as path from 'path';\r\nimport * as Tapable from 'tapable';\r\n\r\nimport { Constants } from './utilities/Constants';\r\nimport {\r\n IWebpackConfigurationUpdaterOptions,\r\n WebpackConfigurationUpdater\r\n} from './WebpackConfigurationUpdater';\r\nimport {\r\n ILocalizationPluginOptions,\r\n ILocalizationStats,\r\n ILocaleFileData,\r\n ILocalizationFile,\r\n ILocaleElementMap,\r\n ILocalizedStrings,\r\n IResolvedMissingTranslations\r\n} from './interfaces';\r\nimport { ILocalizedWebpackChunk } from './webpackInterfaces';\r\nimport { LocFileTypingsGenerator } from './LocFileTypingsGenerator';\r\nimport { Pseudolocalization } from './Pseudolocalization';\r\nimport { EntityMarker } from './utilities/EntityMarker';\r\nimport { IAsset, IProcessAssetResult, AssetProcessor, PLACEHOLDER_REGEX } from './AssetProcessor';\r\nimport { LocFileParser } from './utilities/LocFileParser';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface IStringPlaceholder {\r\n value: string;\r\n suffix: string;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface IAddDefaultLocFileResult {\r\n /**\r\n * A list of paths to translation files that were loaded\r\n */\r\n additionalLoadedFilePaths: string[];\r\n\r\n errors: Error[];\r\n}\r\n\r\ninterface IExtendedMainTemplate {\r\n hooks: {\r\n assetPath: Tapable.SyncHook<string, IAssetPathOptions>;\r\n };\r\n}\r\n\r\ninterface IExtendedConfiguration extends Webpack.compilation.Compilation {\r\n options: Webpack.Configuration;\r\n}\r\n\r\ninterface IExtendedChunkGroup extends Webpack.compilation.ChunkGroup {\r\n getChildren(): Webpack.compilation.Chunk[];\r\n}\r\n\r\ninterface IExtendedChunk extends Webpack.compilation.Chunk {\r\n filenameTemplate: string;\r\n}\r\n\r\ninterface IAssetPathOptions {\r\n chunk: Webpack.compilation.Chunk;\r\n contentHashType: string;\r\n filename: string;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface IStringSerialNumberData {\r\n values: ILocaleElementMap;\r\n locFilePath: string;\r\n stringName: string;\r\n}\r\n\r\nconst PLUGIN_NAME: string = 'localization';\r\n\r\n/**\r\n * This plugin facilitates localization in webpack.\r\n *\r\n * @public\r\n */\r\nexport class LocalizationPlugin implements Webpack.Plugin {\r\n /**\r\n * @internal\r\n */\r\n public stringKeys: Map<string, IStringPlaceholder> = new Map<string, IStringPlaceholder>();\r\n\r\n private _options: ILocalizationPluginOptions;\r\n private _resolvedTranslatedStringsFromOptions!: ILocalizedStrings;\r\n private _filesToIgnore: Set<string> = new Set<string>();\r\n private _stringPlaceholderCounter: number = 0;\r\n private _stringPlaceholderMap: Map<string, IStringSerialNumberData> = new Map<\r\n string,\r\n IStringSerialNumberData\r\n >();\r\n private _locales: Set<string> = new Set<string>();\r\n private _passthroughLocaleName!: string;\r\n private _defaultLocale!: string;\r\n private _noStringsLocaleName!: string;\r\n private _fillMissingTranslationStrings!: boolean;\r\n private _pseudolocalizers: Map<string, (str: string) => string> = new Map<\r\n string,\r\n (str: string) => string\r\n >();\r\n private _resxNewlineNormalization: NewlineKind | undefined;\r\n\r\n /**\r\n * The outermost map's keys are the locale names.\r\n * The middle map's keys are the resolved, file names.\r\n * The innermost map's keys are the string identifiers and its values are the string values.\r\n */\r\n private _resolvedLocalizedStrings: Map<string, Map<string, Map<string, string>>> = new Map<\r\n string,\r\n Map<string, Map<string, string>>\r\n >();\r\n\r\n public constructor(options: ILocalizationPluginOptions) {\r\n this._options = options;\r\n }\r\n\r\n public apply(compiler: Webpack.Compiler): void {\r\n const isWebpack4: boolean = !!compiler.hooks;\r\n\r\n if (!isWebpack4) {\r\n throw new Error(`The ${LocalizationPlugin.name} plugin requires Webpack 4`);\r\n }\r\n\r\n if (this._options.typingsOptions && compiler.context) {\r\n if (\r\n this._options.typingsOptions.generatedTsFolder &&\r\n !path.isAbsolute(this._options.typingsOptions.generatedTsFolder)\r\n ) {\r\n this._options.typingsOptions.generatedTsFolder = path.resolve(\r\n compiler.context,\r\n this._options.typingsOptions.generatedTsFolder\r\n );\r\n }\r\n\r\n if (\r\n this._options.typingsOptions.sourceRoot &&\r\n !path.isAbsolute(this._options.typingsOptions.sourceRoot)\r\n ) {\r\n this._options.typingsOptions.sourceRoot = path.resolve(\r\n compiler.context,\r\n this._options.typingsOptions.sourceRoot\r\n );\r\n }\r\n }\r\n\r\n // https://github.com/webpack/webpack-dev-server/pull/1929/files#diff-15fb51940da53816af13330d8ce69b4eR66\r\n const isWebpackDevServer: boolean = process.env.WEBPACK_DEV_SERVER === 'true';\r\n\r\n const { errors, warnings } = this._initializeAndValidateOptions(compiler.options, isWebpackDevServer);\r\n\r\n let typingsPreprocessor: LocFileTypingsGenerator | undefined;\r\n if (this._options.typingsOptions) {\r\n typingsPreprocessor = new LocFileTypingsGenerator({\r\n srcFolder: this._options.typingsOptions.sourceRoot || compiler.context,\r\n generatedTsFolder: this._options.typingsOptions.generatedTsFolder,\r\n exportAsDefault: this._options.typingsOptions.exportAsDefault,\r\n filesToIgnore: this._options.filesToIgnore\r\n });\r\n } else {\r\n typingsPreprocessor = undefined;\r\n }\r\n\r\n const webpackConfigurationUpdaterOptions: IWebpackConfigurationUpdaterOptions = {\r\n pluginInstance: this,\r\n configuration: compiler.options,\r\n filesToIgnore: this._filesToIgnore,\r\n localeNameOrPlaceholder: Constants.LOCALE_NAME_PLACEHOLDER,\r\n resxNewlineNormalization: this._resxNewlineNormalization\r\n };\r\n\r\n if (errors.length > 0 || warnings.length > 0) {\r\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation: Webpack.compilation.Compilation) => {\r\n compilation.errors.push(...errors);\r\n compilation.warnings.push(...warnings);\r\n });\r\n\r\n if (errors.length > 0) {\r\n // If there are any errors, just pass through the resources in source and don't do any\r\n // additional configuration\r\n WebpackConfigurationUpdater.amendWebpackConfigurationForInPlaceLocFiles(\r\n webpackConfigurationUpdaterOptions\r\n );\r\n return;\r\n }\r\n }\r\n\r\n if (isWebpackDevServer) {\r\n if (typingsPreprocessor) {\r\n compiler.hooks.afterEnvironment.tap(PLUGIN_NAME, () => typingsPreprocessor!.runWatcherAsync());\r\n\r\n if (!compiler.options.plugins) {\r\n compiler.options.plugins = [];\r\n }\r\n\r\n compiler.options.plugins.push(\r\n new Webpack.WatchIgnorePlugin([this._options.typingsOptions!.generatedTsFolder])\r\n );\r\n }\r\n\r\n WebpackConfigurationUpdater.amendWebpackConfigurationForInPlaceLocFiles(\r\n webpackConfigurationUpdaterOptions\r\n );\r\n } else {\r\n if (typingsPreprocessor) {\r\n compiler.hooks.beforeRun.tapPromise(\r\n PLUGIN_NAME,\r\n async () => await typingsPreprocessor!.generateTypingsAsync()\r\n );\r\n }\r\n\r\n WebpackConfigurationUpdater.amendWebpackConfigurationForMultiLocale(webpackConfigurationUpdaterOptions);\r\n\r\n if (errors.length === 0) {\r\n compiler.hooks.thisCompilation.tap(\r\n PLUGIN_NAME,\r\n (untypedCompilation: Webpack.compilation.Compilation) => {\r\n const compilation: IExtendedConfiguration = untypedCompilation as IExtendedConfiguration;\r\n (compilation.mainTemplate as unknown as IExtendedMainTemplate).hooks.assetPath.tap(\r\n PLUGIN_NAME,\r\n (assetPath: string, options: IAssetPathOptions) => {\r\n if (\r\n options.contentHashType === 'javascript' &&\r\n assetPath.match(Constants.LOCALE_FILENAME_TOKEN_REGEX)\r\n ) {\r\n // Does this look like an async chunk URL generator?\r\n if (typeof options.chunk.id === 'string' && (options.chunk.id as string).match(/^\\\" \\+/)) {\r\n return assetPath.replace(\r\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\r\n `\" + ${Constants.JSONP_PLACEHOLDER} + \"`\r\n );\r\n } else {\r\n return assetPath.replace(\r\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\r\n Constants.LOCALE_NAME_PLACEHOLDER\r\n );\r\n }\r\n } else if (assetPath.match(Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX)) {\r\n // Replace the placeholder with the [locale] token for sourcemaps\r\n const deLocalizedFilename: string = options.filename.replace(\r\n PLACEHOLDER_REGEX,\r\n Constants.LOCALE_FILENAME_TOKEN\r\n );\r\n return assetPath.replace(\r\n Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX,\r\n deLocalizedFilename\r\n );\r\n } else {\r\n return assetPath;\r\n }\r\n }\r\n );\r\n\r\n compilation.hooks.optimizeChunks.tap(\r\n PLUGIN_NAME,\r\n (\r\n untypedChunks: Webpack.compilation.Chunk[],\r\n untypedChunkGroups: Webpack.compilation.ChunkGroup[]\r\n ) => {\r\n const chunks: IExtendedChunk[] = untypedChunks as IExtendedChunk[];\r\n const chunkGroups: IExtendedChunkGroup[] = untypedChunkGroups as IExtendedChunkGroup[];\r\n\r\n let chunksHaveAnyChildren: boolean = false;\r\n for (const chunkGroup of chunkGroups) {\r\n const children: Webpack.compilation.Chunk[] = chunkGroup.getChildren();\r\n if (children.length > 0) {\r\n chunksHaveAnyChildren = true;\r\n break;\r\n }\r\n }\r\n\r\n if (\r\n chunksHaveAnyChildren &&\r\n (!compilation.options.output ||\r\n !compilation.options.output.chunkFilename ||\r\n compilation.options.output.chunkFilename.indexOf(Constants.LOCALE_FILENAME_TOKEN) === -1)\r\n ) {\r\n compilation.errors.push(\r\n new Error(\r\n 'The configuration.output.chunkFilename property must be provided and must include ' +\r\n `the ${Constants.LOCALE_FILENAME_TOKEN} placeholder`\r\n )\r\n );\r\n\r\n return;\r\n }\r\n\r\n for (const chunk of chunks) {\r\n // See if the chunk contains any localized modules or loads any localized chunks\r\n const localizedChunk: boolean = this._chunkHasLocalizedModules(chunk);\r\n\r\n // Change the chunk's name to include either the locale name or the locale name for chunks without strings\r\n const replacementValue: string = localizedChunk\r\n ? Constants.LOCALE_NAME_PLACEHOLDER\r\n : this._noStringsLocaleName;\r\n if (chunk.hasRuntime()) {\r\n chunk.filenameTemplate = (compilation.options.output!.filename as string).replace(\r\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\r\n replacementValue\r\n );\r\n } else {\r\n chunk.filenameTemplate = compilation.options.output!.chunkFilename!.replace(\r\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\r\n replacementValue\r\n );\r\n }\r\n }\r\n }\r\n );\r\n }\r\n );\r\n\r\n compiler.hooks.emit.tap(PLUGIN_NAME, (compilation: Webpack.compilation.Compilation) => {\r\n const localizationStats: ILocalizationStats = {\r\n entrypoints: {},\r\n namedChunkGroups: {}\r\n };\r\n\r\n const alreadyProcessedAssets: Set<string> = new Set<string>();\r\n const hotUpdateRegex: RegExp = /\\.hot-update\\.js$/;\r\n\r\n for (const untypedChunk of compilation.chunks) {\r\n const chunk: ILocalizedWebpackChunk = untypedChunk;\r\n const chunkFilesSet: Set<string> = new Set(chunk.files);\r\n function processChunkJsFile(callback: (chunkFilename: string) => void): void {\r\n let alreadyProcessedAFileInThisChunk: boolean = false;\r\n for (const chunkFilename of chunk.files) {\r\n if (\r\n chunkFilename.endsWith('.js') && // Ensure this is a JS file\r\n !hotUpdateRegex.test(chunkFilename) && // Ensure this is not a webpack hot update\r\n !alreadyProcessedAssets.has(chunkFilename) // Ensure this isn't a vendor chunk we've already processed\r\n ) {\r\n if (alreadyProcessedAFileInThisChunk) {\r\n throw new Error(\r\n `Found more than one JS file in chunk \"${chunk.name}\". This is not expected.`\r\n );\r\n }\r\n\r\n alreadyProcessedAFileInThisChunk = true;\r\n alreadyProcessedAssets.add(chunkFilename);\r\n callback(chunkFilename);\r\n }\r\n }\r\n }\r\n\r\n if (this._chunkHasLocalizedModules(chunk)) {\r\n processChunkJsFile((chunkFilename) => {\r\n if (chunkFilename.indexOf(Constants.LOCALE_NAME_PLACEHOLDER) === -1) {\r\n throw new Error(\r\n `Asset ${chunkFilename} is expected to be localized, but is missing a locale placeholder`\r\n );\r\n }\r\n\r\n const asset: IAsset = compilation.assets[chunkFilename];\r\n\r\n const resultingAssets: Map<string, IProcessAssetResult> =\r\n AssetProcessor.processLocalizedAsset({\r\n plugin: this,\r\n compilation,\r\n assetName: chunkFilename,\r\n asset,\r\n chunk,\r\n chunkHasLocalizedModules: this._chunkHasLocalizedModules.bind(this),\r\n locales: this._locales,\r\n noStringsLocaleName: this._noStringsLocaleName,\r\n fillMissingTranslationStrings: this._fillMissingTranslationStrings,\r\n defaultLocale: this._defaultLocale\r\n });\r\n\r\n // Delete the existing asset because it's been renamed\r\n delete compilation.assets[chunkFilename];\r\n chunkFilesSet.delete(chunkFilename);\r\n\r\n const localizedChunkAssets: ILocaleElementMap = {};\r\n for (const [locale, newAsset] of resultingAssets) {\r\n compilation.assets[newAsset.filename] = newAsset.asset;\r\n localizedChunkAssets[locale] = newAsset.filename;\r\n chunkFilesSet.add(newAsset.filename);\r\n }\r\n\r\n if (chunk.hasRuntime()) {\r\n // This is an entrypoint\r\n localizationStats.entrypoints[chunk.name] = {\r\n localizedAssets: localizedChunkAssets\r\n };\r\n } else {\r\n // This is a secondary chunk\r\n if (chunk.name) {\r\n localizationStats.namedChunkGroups[chunk.name] = {\r\n localizedAssets: localizedChunkAssets\r\n };\r\n }\r\n }\r\n\r\n chunk.localizedFiles = localizedChunkAssets;\r\n });\r\n } else {\r\n processChunkJsFile((chunkFilename) => {\r\n const asset: IAsset = compilation.assets[chunkFilename];\r\n\r\n const resultingAsset: IProcessAssetResult = AssetProcessor.processNonLocalizedAsset({\r\n plugin: this,\r\n compilation,\r\n assetName: chunkFilename,\r\n asset,\r\n chunk,\r\n noStringsLocaleName: this._noStringsLocaleName,\r\n chunkHasLocalizedModules: this._chunkHasLocalizedModules.bind(this)\r\n });\r\n\r\n // Delete the existing asset because it's been renamed\r\n delete compilation.assets[chunkFilename];\r\n chunkFilesSet.delete(chunkFilename);\r\n\r\n compilation.assets[resultingAsset.filename] = resultingAsset.asset;\r\n chunkFilesSet.add(resultingAsset.filename);\r\n });\r\n }\r\n\r\n chunk.files = Array.from(chunkFilesSet);\r\n }\r\n\r\n if (this._options.localizationStats) {\r\n if (this._options.localizationStats.dropPath) {\r\n const resolvedLocalizationStatsDropPath: string = path.resolve(\r\n compiler.outputPath,\r\n this._options.localizationStats.dropPath\r\n );\r\n JsonFile.save(localizationStats, resolvedLocalizationStatsDropPath, {\r\n ensureFolderExists: true\r\n });\r\n }\r\n\r\n if (this._options.localizationStats.callback) {\r\n try {\r\n this._options.localizationStats.callback(localizationStats);\r\n } catch (e) {\r\n /* swallow errors from the callback */\r\n }\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n *\r\n * @returns\r\n */\r\n public addDefaultLocFile(\r\n terminal: Terminal,\r\n localizedResourcePath: string,\r\n localizedResourceData: ILocalizationFile\r\n ): IAddDefaultLocFileResult {\r\n const additionalLoadedFilePaths: string[] = [];\r\n const errors: Error[] = [];\r\n\r\n const locFileData: ILocaleFileData = this._convertLocalizationFileToLocData(localizedResourceData);\r\n this._addLocFile(this._defaultLocale, localizedResourcePath, locFileData);\r\n\r\n const normalizeLocalizedData: (localizedData: ILocaleFileData | string) => ILocaleFileData = (\r\n localizedData\r\n ) => {\r\n if (typeof localizedData === 'string') {\r\n additionalLoadedFilePaths.push(localizedData);\r\n const localizationFile: ILocalizationFile = LocFileParser.parseLocFile({\r\n filePath: localizedData,\r\n content: FileSystem.readFile(localizedData),\r\n terminal: terminal,\r\n resxNewlineNormalization: this._resxNewlineNormalization\r\n });\r\n\r\n return this._convertLocalizationFileToLocData(localizationFile);\r\n } else {\r\n return localizedData;\r\n }\r\n };\r\n\r\n const missingLocales: string[] = [];\r\n for (const [translatedLocaleName, translatedStrings] of Object.entries(\r\n this._resolvedTranslatedStringsFromOptions\r\n )) {\r\n const translatedLocFileFromOptions: ILocaleFileData | string | undefined =\r\n translatedStrings[localizedResourcePath];\r\n if (!translatedLocFileFromOptions) {\r\n missingLocales.push(translatedLocaleName);\r\n } else {\r\n const translatedLocFileData: ILocaleFileData = normalizeLocalizedData(translatedLocFileFromOptions);\r\n this._addLocFile(translatedLocaleName, localizedResourcePath, translatedLocFileData);\r\n }\r\n }\r\n\r\n if (missingLocales.length > 0 && this._options.localizedData.resolveMissingTranslatedStrings) {\r\n let resolvedTranslatedData: IResolvedMissingTranslations | undefined = undefined;\r\n try {\r\n resolvedTranslatedData = this._options.localizedData.resolveMissingTranslatedStrings(\r\n missingLocales,\r\n localizedResourcePath\r\n );\r\n } catch (e) {\r\n errors.push(e as Error);\r\n }\r\n\r\n if (resolvedTranslatedData) {\r\n for (const [resolvedLocaleName, resolvedLocaleData] of Object.entries(resolvedTranslatedData)) {\r\n if (resolvedLocaleData) {\r\n const translatedLocFileData: ILocaleFileData = normalizeLocalizedData(resolvedLocaleData);\r\n this._addLocFile(resolvedLocaleName, localizedResourcePath, translatedLocFileData);\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._pseudolocalizers.forEach((pseudolocalizer: (str: string) => string, pseudolocaleName: string) => {\r\n const pseudolocFileData: ILocaleFileData = {};\r\n\r\n for (const [stringName, stringValue] of Object.entries(locFileData)) {\r\n pseudolocFileData[stringName] = pseudolocalizer(stringValue);\r\n }\r\n\r\n this._addLocFile(pseudolocaleName, localizedResourcePath, pseudolocFileData);\r\n });\r\n\r\n return { additionalLoadedFilePaths, errors };\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public getDataForSerialNumber(serialNumber: string): IStringSerialNumberData | undefined {\r\n return this._stringPlaceholderMap.get(serialNumber);\r\n }\r\n\r\n private _addLocFile(\r\n localeName: string,\r\n localizedFilePath: string,\r\n localizedFileData: ILocaleFileData\r\n ): void {\r\n const filesMap: Map<string, Map<string, string>> = this._resolvedLocalizedStrings.get(localeName)!;\r\n\r\n const stringsMap: Map<string, string> = new Map<string, string>();\r\n filesMap.set(localizedFilePath, stringsMap);\r\n\r\n for (const [stringName, stringValue] of Object.entries(localizedFileData)) {\r\n const stringKey: string = `${localizedFilePath}?${stringName}`;\r\n if (!this.stringKeys.has(stringKey)) {\r\n const placeholder: IStringPlaceholder = this._getPlaceholderString();\r\n this.stringKeys.set(stringKey, placeholder);\r\n }\r\n\r\n const placeholder: IStringPlaceholder = this.stringKeys.get(stringKey)!;\r\n if (!this._stringPlaceholderMap.has(placeholder.suffix)) {\r\n this._stringPlaceholderMap.set(placeholder.suffix, {\r\n values: {\r\n [this._passthroughLocaleName]: stringName\r\n },\r\n locFilePath: localizedFilePath,\r\n stringName: stringName\r\n });\r\n }\r\n\r\n this._stringPlaceholderMap.get(placeholder.suffix)!.values[localeName] = stringValue;\r\n\r\n stringsMap.set(stringName, stringValue);\r\n }\r\n }\r\n\r\n private _initializeAndValidateOptions(\r\n configuration: Webpack.Configuration,\r\n isWebpackDevServer: boolean\r\n ): { errors: Error[]; warnings: Error[] } {\r\n const errors: Error[] = [];\r\n const warnings: Error[] = [];\r\n\r\n function ensureValidLocaleName(localeName: string): boolean {\r\n const LOCALE_NAME_REGEX: RegExp = /[a-z-]/i;\r\n if (!localeName.match(LOCALE_NAME_REGEX)) {\r\n errors.push(\r\n new Error(`Invalid locale name: ${localeName}. Locale names may only contain letters and hyphens.`)\r\n );\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n }\r\n\r\n // START configuration\r\n if (\r\n !configuration.output ||\r\n !configuration.output.filename ||\r\n typeof configuration.output.filename !== 'string' ||\r\n configuration.output.filename.indexOf(Constants.LOCALE_FILENAME_TOKEN) === -1\r\n ) {\r\n errors.push(\r\n new Error(\r\n 'The configuration.output.filename property must be provided, must be a string, and must include ' +\r\n `the ${Constants.LOCALE_FILENAME_TOKEN} placeholder`\r\n )\r\n );\r\n }\r\n // END configuration\r\n\r\n // START options.filesToIgnore\r\n // eslint-disable-next-line no-lone-blocks\r\n {\r\n for (const filePath of this._options.filesToIgnore || []) {\r\n const normalizedFilePath: string = path.resolve(configuration.context!, filePath);\r\n this._filesToIgnore.add(normalizedFilePath);\r\n }\r\n }\r\n // END options.filesToIgnore\r\n\r\n // START options.localizedData\r\n if (this._options.localizedData) {\r\n // START options.localizedData.passthroughLocale\r\n if (this._options.localizedData.passthroughLocale) {\r\n const { usePassthroughLocale, passthroughLocaleName = 'passthrough' } =\r\n this._options.localizedData.passthroughLocale;\r\n if (usePassthroughLocale) {\r\n this._passthroughLocaleName = passthroughLocaleName;\r\n this._locales.add(passthroughLocaleName);\r\n }\r\n }\r\n // END options.localizedData.passthroughLocale\r\n\r\n // START options.localizedData.translatedStrings\r\n const { translatedStrings } = this._options.localizedData;\r\n this._resolvedTranslatedStringsFromOptions = {};\r\n if (translatedStrings) {\r\n for (const [localeName, locale] of Object.entries(translatedStrings)) {\r\n if (this._locales.has(localeName)) {\r\n errors.push(\r\n Error(\r\n `The locale \"${localeName}\" appears multiple times. ` +\r\n 'There may be multiple instances with different casing.'\r\n )\r\n );\r\n return { errors, warnings };\r\n }\r\n\r\n if (!ensureValidLocaleName(localeName)) {\r\n return { errors, warnings };\r\n }\r\n\r\n this._locales.add(localeName);\r\n this._resolvedLocalizedStrings.set(localeName, new Map<string, Map<string, string>>());\r\n this._resolvedTranslatedStringsFromOptions[localeName] = {};\r\n\r\n const locFilePathsInLocale: Set<string> = new Set<string>();\r\n\r\n for (const [locFilePath, locFileDataFromOptions] of Object.entries(locale)) {\r\n if (locale.hasOwnProperty(locFilePath)) {\r\n const normalizedLocFilePath: string = path.resolve(configuration.context!, locFilePath);\r\n\r\n if (locFilePathsInLocale.has(normalizedLocFilePath)) {\r\n errors.push(\r\n new Error(\r\n `The localization file path \"${locFilePath}\" appears multiple times in locale ${localeName}. ` +\r\n 'There may be multiple instances with different casing.'\r\n )\r\n );\r\n return { errors, warnings };\r\n }\r\n\r\n locFilePathsInLocale.add(normalizedLocFilePath);\r\n\r\n const normalizedLocFileDataFromOptions: string | ILocaleFileData =\r\n typeof locFileDataFromOptions === 'string'\r\n ? path.resolve(configuration.context!, locFileDataFromOptions)\r\n : locFileDataFromOptions;\r\n\r\n this._resolvedTranslatedStringsFromOptions[localeName][normalizedLocFilePath] =\r\n normalizedLocFileDataFromOptions;\r\n }\r\n }\r\n }\r\n }\r\n // END options.localizedData.translatedStrings\r\n\r\n // START options.localizedData.defaultLocale\r\n if (this._options.localizedData.defaultLocale) {\r\n const { localeName, fillMissingTranslationStrings } = this._options.localizedData.defaultLocale;\r\n if (this._options.localizedData.defaultLocale.localeName) {\r\n if (this._locales.has(localeName)) {\r\n errors.push(new Error('The default locale is also specified in the translated strings.'));\r\n return { errors, warnings };\r\n } else if (!ensureValidLocaleName(localeName)) {\r\n return { errors, warnings };\r\n }\r\n\r\n this._locales.add(localeName);\r\n this._resolvedLocalizedStrings.set(localeName, new Map<string, Map<string, string>>());\r\n this._defaultLocale = localeName;\r\n this._fillMissingTranslationStrings = !!fillMissingTranslationStrings;\r\n } else {\r\n errors.push(new Error('Missing default locale name'));\r\n return { errors, warnings };\r\n }\r\n } else {\r\n errors.push(new Error('Missing default locale options.'));\r\n return { errors, warnings };\r\n }\r\n // END options.localizedData.defaultLocale\r\n\r\n // START options.localizedData.pseudoLocales\r\n if (this._options.localizedData.pseudolocales) {\r\n for (const [pseudolocaleName, pseudoLocaleOpts] of Object.entries(\r\n this._options.localizedData.pseudolocales\r\n )) {\r\n if (this._defaultLocale === pseudolocaleName) {\r\n errors.push(\r\n new Error(`A pseudolocale (${pseudolocaleName}) name is also the default locale name.`)\r\n );\r\n return { errors, warnings };\r\n }\r\n\r\n if (this._locales.has(pseudolocaleName)) {\r\n errors.push(\r\n new Error(\r\n `A pseudolocale (${pseudolocaleName}) name is also specified in the translated strings.`\r\n )\r\n );\r\n return { errors, warnings };\r\n }\r\n\r\n this._pseudolocalizers.set(\r\n pseudolocaleName,\r\n Pseudolocalization.getPseudolocalizer(pseudoLocaleOpts)\r\n );\r\n this._locales.add(pseudolocaleName);\r\n this._resolvedLocalizedStrings.set(pseudolocaleName, new Map<string, Map<string, string>>());\r\n }\r\n }\r\n // END options.localizedData.pseudoLocales\r\n\r\n // START options.localizedData.normalizeResxNewlines\r\n if (this._options.localizedData.normalizeResxNewlines) {\r\n switch (this._options.localizedData.normalizeResxNewlines) {\r\n case 'crlf': {\r\n this._resxNewlineNormalization = NewlineKind.CrLf;\r\n break;\r\n }\r\n\r\n case 'lf': {\r\n this._resxNewlineNormalization = NewlineKind.Lf;\r\n break;\r\n }\r\n\r\n default: {\r\n errors.push(\r\n new Error(\r\n `Unexpected value \"${this._options.localizedData.normalizeResxNewlines}\" for option ` +\r\n '\"localizedData.normalizeResxNewlines\"'\r\n )\r\n );\r\n break;\r\n }\r\n }\r\n }\r\n // END options.localizedData.normalizeResxNewlines\r\n } else if (!isWebpackDevServer) {\r\n throw new Error('Localized data must be provided unless webpack dev server is running.');\r\n }\r\n // END options.localizedData\r\n\r\n // START options.noStringsLocaleName\r\n if (\r\n this._options.noStringsLocaleName === undefined ||\r\n this._options.noStringsLocaleName === null ||\r\n !ensureValidLocaleName(this._options.noStringsLocaleName)\r\n ) {\r\n this._noStringsLocaleName = 'none';\r\n } else {\r\n this._noStringsLocaleName = this._options.noStringsLocaleName;\r\n }\r\n // END options.noStringsLocaleName\r\n\r\n return { errors, warnings };\r\n }\r\n\r\n private _getPlaceholderString(): IStringPlaceholder {\r\n const suffix: string = (this._stringPlaceholderCounter++).toString();\r\n return {\r\n value: `${Constants.STRING_PLACEHOLDER_PREFIX}_\\\\_${Constants.STRING_PLACEHOLDER_LABEL}_${suffix}`,\r\n suffix: suffix\r\n };\r\n }\r\n\r\n private _chunkHasLocalizedModules(chunk: Webpack.compilation.Chunk): boolean {\r\n let chunkHasAnyLocModules: boolean | undefined = EntityMarker.getMark(chunk);\r\n if (chunkHasAnyLocModules === undefined) {\r\n chunkHasAnyLocModules = false;\r\n for (const module of chunk.getModules()) {\r\n if (EntityMarker.getMark(module)) {\r\n chunkHasAnyLocModules = true;\r\n break;\r\n }\r\n }\r\n\r\n // If this chunk doesn't directly contain any localized resources, it still\r\n // needs to be localized if it's an entrypoint chunk (i.e. - it has a runtime)\r\n // and it loads localized async chunks.\r\n // In that case, the generated chunk URL generation code needs to contain\r\n // the locale name.\r\n if (!chunkHasAnyLocModules && chunk.hasRuntime()) {\r\n for (const asyncChunk of chunk.getAllAsyncChunks()) {\r\n if (this._chunkHasLocalizedModules(asyncChunk)) {\r\n chunkHasAnyLocModules = true;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n EntityMarker.markEntity(chunk, chunkHasAnyLocModules);\r\n }\r\n\r\n return chunkHasAnyLocModules;\r\n }\r\n\r\n private _convertLocalizationFileToLocData(locFile: ILocalizationFile): ILocaleFileData {\r\n const locFileData: ILocaleFileData = {};\r\n for (const [stringName, locFileEntry] of Object.entries(locFile)) {\r\n locFileData[stringName] = locFileEntry.value;\r\n }\r\n\r\n return locFileData;\r\n }\r\n}\r\n"]}

@@ -13,3 +13,3 @@ "use strict";

// pseudolocale maintains static state, so we need to load it as isolated modules
decache_1.default('pseudolocale');
(0, decache_1.default)('pseudolocale');
const pseudolocale = require('pseudolocale'); // eslint-disable-line

@@ -16,0 +16,0 @@ pseudolocale.option = Object.assign(Object.assign({}, pseudolocale.option), options);

@@ -1,1 +0,1 @@

{"version":3,"file":"Pseudolocalization.js","sourceRoot":"","sources":["../src/Pseudolocalization.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,sDAA8B;AAI9B,MAAa,kBAAkB;IACtB,MAAM,CAAC,kBAAkB,CAAC,OAA6B;QAC5D,iFAAiF;QACjF,iBAAO,CAAC,cAAc,CAAC,CAAC;QACxB,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,sBAAsB;QAEpE,YAAY,CAAC,MAAM,mCACd,YAAY,CAAC,MAAM,GACnB,OAAO,CACX,CAAC;QACF,OAAO,YAAY,CAAC,GAAG,CAAC;IAC1B,CAAC;CACF;AAZD,gDAYC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport decache from 'decache';\r\n\r\nimport { IPseudolocaleOptions } from './interfaces';\r\n\r\nexport class Pseudolocalization {\r\n public static getPseudolocalizer(options: IPseudolocaleOptions): (str: string) => string {\r\n // pseudolocale maintains static state, so we need to load it as isolated modules\r\n decache('pseudolocale');\r\n const pseudolocale = require('pseudolocale'); // eslint-disable-line\r\n\r\n pseudolocale.option = {\r\n ...pseudolocale.option,\r\n ...options\r\n };\r\n return pseudolocale.str;\r\n }\r\n}\r\n"]}
{"version":3,"file":"Pseudolocalization.js","sourceRoot":"","sources":["../src/Pseudolocalization.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,sDAA8B;AAI9B,MAAa,kBAAkB;IACtB,MAAM,CAAC,kBAAkB,CAAC,OAA6B;QAC5D,iFAAiF;QACjF,IAAA,iBAAO,EAAC,cAAc,CAAC,CAAC;QACxB,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,sBAAsB;QAEpE,YAAY,CAAC,MAAM,mCACd,YAAY,CAAC,MAAM,GACnB,OAAO,CACX,CAAC;QACF,OAAO,YAAY,CAAC,GAAG,CAAC;IAC1B,CAAC;CACF;AAZD,gDAYC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport decache from 'decache';\r\n\r\nimport { IPseudolocaleOptions } from './interfaces';\r\n\r\nexport class Pseudolocalization {\r\n public static getPseudolocalizer(options: IPseudolocaleOptions): (str: string) => string {\r\n // pseudolocale maintains static state, so we need to load it as isolated modules\r\n decache('pseudolocale');\r\n const pseudolocale = require('pseudolocale'); // eslint-disable-line\r\n\r\n pseudolocale.option = {\r\n ...pseudolocale.option,\r\n ...options\r\n };\r\n return pseudolocale.str;\r\n }\r\n}\r\n"]}

@@ -19,3 +19,3 @@ "use strict";

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -22,0 +22,0 @@ return result;

@@ -19,3 +19,3 @@ "use strict";

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -22,0 +22,0 @@ return result;

{
"name": "@rushstack/localization-plugin",
"version": "0.6.55",
"version": "0.6.56",
"description": "This plugin facilitates localization with Webpack.",

@@ -13,3 +13,3 @@ "main": "lib/index.js",

"peerDependencies": {
"@rushstack/set-webpack-public-path-plugin": "^3.2.75",
"@rushstack/set-webpack-public-path-plugin": "^3.2.76",
"@types/webpack": "^4.39.0",

@@ -27,5 +27,5 @@ "webpack": "^4.31.0"

"dependencies": {
"@rushstack/node-core-library": "3.40.2",
"@rushstack/typings-generator": "0.3.11",
"@types/node": "10.17.13",
"@rushstack/node-core-library": "3.40.3",
"@rushstack/typings-generator": "0.3.12",
"@types/node": "12.20.24",
"@types/tapable": "1.0.6",

@@ -39,6 +39,6 @@ "decache": "~4.5.1",

"devDependencies": {
"@rushstack/eslint-config": "2.4.0",
"@rushstack/heft": "0.39.0",
"@rushstack/heft-node-rig": "1.2.15",
"@rushstack/set-webpack-public-path-plugin": "3.2.75",
"@rushstack/eslint-config": "2.4.1",
"@rushstack/heft": "0.39.1",
"@rushstack/heft-node-rig": "1.2.16",
"@rushstack/set-webpack-public-path-plugin": "3.2.76",
"@types/loader-utils": "1.1.3",

@@ -45,0 +45,0 @@ "@types/lodash": "4.14.116",

Sorry, the diff of this file is too big to display