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
103
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.10
to
0.6.11
+6
-1
CHANGELOG.md
# Change Log - @rushstack/localization-plugin
This log was last generated on Mon, 03 May 2021 15:10:28 GMT and should not be manually modified.
This log was last generated on Tue, 11 May 2021 22:19:17 GMT and should not be manually modified.
## 0.6.11
Tue, 11 May 2021 22:19:17 GMT
_Version update only_
## 0.6.10

@@ -6,0 +11,0 @@ Mon, 03 May 2021 15:10:28 GMT

+1
-1

@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.

"packageName": "@microsoft/api-extractor",
"packageVersion": "7.15.0"
"packageVersion": "7.15.1"
}
]
}

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

{"version":3,"file":"AssetProcessor.d.ts","sourceRoot":"","sources":["../../../src/AssetProcessor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAKnC,OAAO,EAAE,kBAAkB,EAA0C,MAAM,sBAAsB,CAAC;AAgDlG,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wBAAwB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,KAAK,OAAO,CAAC;CACzE;AAED,MAAM,WAAW,gCAAiC,SAAQ,wBAAwB;CAAG;AAErF,MAAM,WAAW,6BAA8B,SAAQ,wBAAwB;IAC7E,OAA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,wBAAwB,CAAC,UAAU,CAAC,EAAE;gBACxC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;aAC7B;iBAAM;gBACL,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;aAChC;SACF;QAED,IAAI,cAAc,CAAC,IAAI,KAAK,CAAC,EAAE;YAC7B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;SAClD;aAAM,IAAI,iBAAiB,CAAC,IAAI,KAAK,CAAC,EAAE;YACvC,OAAO,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;SACnD;aAAM;YACL,sGAAsG;YACtG,yGAAyG;YACzG,UAAU;YACV,EAAE;YACF,2GAA2G;YAC3G,oDAAoD;YACpD,MAAM,YAAY,GAAkC,EAAE,CAAC;YACvD,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE;gBAC1C,YAAY,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;aACjC;YAED,KAAK,MAAM,gBAAgB,IAAI,iBAAiB,EAAE;gBAChD,YAAY,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;aACpC;YAED,OAAO,CAAC,MAAc,EAAE,YAAgC,EAAE,EAAE;gBAC1D,IAAI,CAAC,MAAM,EAAE;oBACX,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;iBACzC;gBAED,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CACzE,YAAY,CACb,IAAI,YAAY,IAAI,CAAC;YACxB,CAAC,CAAC;SACH;IACH,CAAC;CACF;AAhYD,wCAgYC","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 * as Webpack from 'webpack';\r\nimport * as lodash from 'lodash';\r\n\r\nimport { Constants } from './utilities/Constants';\r\nimport { ILocaleElementMap } from './interfaces';\r\nimport { LocalizationPlugin, IStringSerialNumberData as IStringData } from './LocalizationPlugin';\r\n\r\ninterface IReconstructionElement {\r\n kind: 'static' | 'localized' | 'dynamic';\r\n}\r\n\r\ninterface IStaticReconstructionElement extends IReconstructionElement {\r\n kind: 'static';\r\n staticString: string;\r\n}\r\n\r\ninterface ILocalizedReconstructionElement extends IReconstructionElement {\r\n kind: 'localized';\r\n values: ILocaleElementMap;\r\n size: number;\r\n stringName: string;\r\n escapedBackslash: string;\r\n locFilePath: string;\r\n}\r\n\r\ninterface IDynamicReconstructionElement extends IReconstructionElement {\r\n kind: 'dynamic';\r\n valueFn: (locale: string, token: string | undefined) => string;\r\n size: number;\r\n escapedBackslash: string;\r\n token?: string;\r\n}\r\n\r\ninterface IParseResult {\r\n issues: string[];\r\n reconstructionSeries: IReconstructionElement[];\r\n}\r\n\r\ninterface IReconstructedString {\r\n source: string;\r\n size: number;\r\n}\r\n\r\ninterface ILocalizedReconstructionResult {\r\n result: Map<string, IReconstructedString>;\r\n issues: string[];\r\n}\r\n\r\ninterface INonLocalizedReconstructionResult {\r\n result: IReconstructedString;\r\n issues: string[];\r\n}\r\n\r\nexport interface IProcessAssetOptionsBase {\r\n plugin: LocalizationPlugin;\r\n compilation: Webpack.compilation.Compilation;\r\n assetName: string;\r\n asset: IAsset;\r\n chunk: Webpack.compilation.Chunk;\r\n noStringsLocaleName: string;\r\n chunkHasLocalizedModules: (chunk: Webpack.compilation.Chunk) => boolean;\r\n}\r\n\r\nexport interface IProcessNonLocalizedAssetOptions extends IProcessAssetOptionsBase {}\r\n\r\nexport interface IProcessLocalizedAssetOptions extends IProcessAssetOptionsBase {\r\n locales: Set<string>;\r\n fillMissingTranslationStrings: boolean;\r\n defaultLocale: string;\r\n}\r\n\r\nexport interface IAsset {\r\n size(): number;\r\n source(): string;\r\n}\r\n\r\nexport interface IProcessAssetResult {\r\n filename: string;\r\n asset: IAsset;\r\n}\r\n\r\nexport const PLACEHOLDER_REGEX: RegExp = new RegExp(\r\n `${Constants.STRING_PLACEHOLDER_PREFIX}_(\\\\\\\\*)_([A-C])(\\\\+[^+]+\\\\+)?_(\\\\d+)`,\r\n 'g'\r\n);\r\n\r\nexport class AssetProcessor {\r\n public static processLocalizedAsset(\r\n options: IProcessLocalizedAssetOptions\r\n ): Map<string, IProcessAssetResult> {\r\n const assetSource: string = options.asset.source();\r\n\r\n const parsedAsset: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\r\n options.plugin,\r\n assetSource,\r\n this._getJsonpFunction(options.chunk, options.chunkHasLocalizedModules, options.noStringsLocaleName)\r\n );\r\n const reconstructedAsset: ILocalizedReconstructionResult = AssetProcessor._reconstructLocalized(\r\n parsedAsset.reconstructionSeries,\r\n options.locales,\r\n options.fillMissingTranslationStrings,\r\n options.defaultLocale,\r\n options.asset.size()\r\n );\r\n\r\n const parsedAssetName: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\r\n options.plugin,\r\n options.assetName,\r\n () => {\r\n throw new Error('unsupported');\r\n }\r\n );\r\n const reconstructedAssetName: ILocalizedReconstructionResult = AssetProcessor._reconstructLocalized(\r\n parsedAssetName.reconstructionSeries,\r\n options.locales,\r\n options.fillMissingTranslationStrings,\r\n options.defaultLocale,\r\n options.assetName.length\r\n );\r\n\r\n const result: Map<string, IProcessAssetResult> = new Map<string, IProcessAssetResult>();\r\n for (const [locale, { source, size }] of reconstructedAsset.result) {\r\n const newAsset: IAsset = lodash.clone(options.asset);\r\n newAsset.source = () => source;\r\n newAsset.size = () => size;\r\n\r\n result.set(locale, {\r\n filename: reconstructedAssetName.result.get(locale)!.source,\r\n asset: newAsset\r\n });\r\n }\r\n\r\n const issues: string[] = [\r\n ...parsedAsset.issues,\r\n ...reconstructedAsset.issues,\r\n ...parsedAssetName.issues,\r\n ...reconstructedAssetName.issues\r\n ];\r\n\r\n if (issues.length > 0) {\r\n options.compilation.errors.push(\r\n Error(`localization:\\n${issues.map((issue) => ` ${issue}`).join('\\n')}`)\r\n );\r\n }\r\n\r\n return result;\r\n }\r\n\r\n public static processNonLocalizedAsset(options: IProcessNonLocalizedAssetOptions): IProcessAssetResult {\r\n const assetSource: string = options.asset.source();\r\n\r\n const parsedAsset: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\r\n options.plugin,\r\n assetSource,\r\n this._getJsonpFunction(options.chunk, options.chunkHasLocalizedModules, options.noStringsLocaleName)\r\n );\r\n const reconstructedAsset: INonLocalizedReconstructionResult = AssetProcessor._reconstructNonLocalized(\r\n parsedAsset.reconstructionSeries,\r\n options.asset.size(),\r\n options.noStringsLocaleName\r\n );\r\n\r\n const parsedAssetName: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\r\n options.plugin,\r\n options.assetName,\r\n () => {\r\n throw new Error('unsupported');\r\n }\r\n );\r\n const reconstructedAssetName: INonLocalizedReconstructionResult = AssetProcessor._reconstructNonLocalized(\r\n parsedAssetName.reconstructionSeries,\r\n options.assetName.length,\r\n options.noStringsLocaleName\r\n );\r\n\r\n const issues: string[] = [\r\n ...parsedAsset.issues,\r\n ...reconstructedAsset.issues,\r\n ...parsedAssetName.issues,\r\n ...reconstructedAssetName.issues\r\n ];\r\n\r\n if (issues.length > 0) {\r\n options.compilation.errors.push(\r\n Error(`localization:\\n${issues.map((issue) => ` ${issue}`).join('\\n')}`)\r\n );\r\n }\r\n\r\n const newAsset: IAsset = lodash.clone(options.asset);\r\n newAsset.source = () => reconstructedAsset.result.source;\r\n newAsset.size = () => reconstructedAsset.result.size;\r\n return {\r\n filename: reconstructedAssetName.result.source,\r\n asset: newAsset\r\n };\r\n }\r\n\r\n private static _reconstructLocalized(\r\n reconstructionSeries: IReconstructionElement[],\r\n locales: Set<string>,\r\n fillMissingTranslationStrings: boolean,\r\n defaultLocale: string,\r\n initialSize: number\r\n ): ILocalizedReconstructionResult {\r\n const localizedResults: Map<string, IReconstructedString> = new Map<string, IReconstructedString>();\r\n const issues: string[] = [];\r\n\r\n for (const locale of locales) {\r\n const reconstruction: string[] = [];\r\n\r\n let sizeDiff: number = 0;\r\n for (const element of reconstructionSeries) {\r\n switch (element.kind) {\r\n case 'static': {\r\n reconstruction.push((element as IStaticReconstructionElement).staticString);\r\n break;\r\n }\r\n\r\n case 'localized': {\r\n const localizedElement: ILocalizedReconstructionElement = element as ILocalizedReconstructionElement;\r\n let newValue: string | undefined = localizedElement.values[locale];\r\n if (!newValue) {\r\n if (fillMissingTranslationStrings) {\r\n newValue = localizedElement.values[defaultLocale];\r\n } else {\r\n issues.push(\r\n `The string \"${localizedElement.stringName}\" in \"${localizedElement.locFilePath}\" is missing in ` +\r\n `the locale ${locale}`\r\n );\r\n\r\n newValue = '-- MISSING STRING --';\r\n }\r\n }\r\n\r\n const escapedBackslash: string = localizedElement.escapedBackslash || '\\\\';\r\n\r\n // Replace backslashes with the properly escaped backslash\r\n newValue = newValue.replace(/\\\\/g, escapedBackslash);\r\n\r\n // @todo: look into using JSON.parse(...) to get the escaping characters\r\n const escapingCharacterSequence: string = escapedBackslash.substr(escapedBackslash.length / 2);\r\n\r\n // Ensure the the quotemark, apostrophe, tab, and newline characters are properly escaped\r\n newValue = newValue.replace(/\\r/g, `${escapingCharacterSequence}r`);\r\n newValue = newValue.replace(/\\n/g, `${escapingCharacterSequence}n`);\r\n newValue = newValue.replace(/\\t/g, `${escapingCharacterSequence}t`);\r\n newValue = newValue.replace(/\\\"/g, `${escapingCharacterSequence}u0022`);\r\n newValue = newValue.replace(/\\'/g, `${escapingCharacterSequence}u0027`);\r\n\r\n reconstruction.push(newValue);\r\n sizeDiff += newValue.length - localizedElement.size;\r\n break;\r\n }\r\n\r\n case 'dynamic': {\r\n const dynamicElement: IDynamicReconstructionElement = element as IDynamicReconstructionElement;\r\n const newValue: string = dynamicElement.valueFn(locale, dynamicElement.token);\r\n reconstruction.push(newValue);\r\n sizeDiff += newValue.length - dynamicElement.size;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const newAssetSource: string = reconstruction.join('');\r\n localizedResults.set(locale, {\r\n source: newAssetSource,\r\n size: initialSize + sizeDiff\r\n });\r\n }\r\n\r\n return {\r\n issues,\r\n result: localizedResults\r\n };\r\n }\r\n\r\n private static _reconstructNonLocalized(\r\n reconstructionSeries: IReconstructionElement[],\r\n initialSize: number,\r\n noStringsLocaleName: string\r\n ): INonLocalizedReconstructionResult {\r\n const issues: string[] = [];\r\n\r\n const reconstruction: string[] = [];\r\n\r\n let sizeDiff: number = 0;\r\n for (const element of reconstructionSeries) {\r\n switch (element.kind) {\r\n case 'static': {\r\n reconstruction.push((element as IStaticReconstructionElement).staticString);\r\n break;\r\n }\r\n\r\n case 'localized': {\r\n const localizedElement: ILocalizedReconstructionElement = element as ILocalizedReconstructionElement;\r\n issues.push(\r\n `The string \"${localizedElement.stringName}\" in \"${localizedElement.locFilePath}\" appeared in an asset ` +\r\n 'that is not expected to contain localized resources.'\r\n );\r\n\r\n const newValue: string = '-- NOT EXPECTED TO BE LOCALIZED --';\r\n reconstruction.push(newValue);\r\n sizeDiff += newValue.length - localizedElement.size;\r\n break;\r\n }\r\n\r\n case 'dynamic': {\r\n const dynamicElement: IDynamicReconstructionElement = element as IDynamicReconstructionElement;\r\n const newValue: string = dynamicElement.valueFn(noStringsLocaleName, dynamicElement.token);\r\n reconstruction.push(newValue);\r\n sizeDiff += newValue.length - dynamicElement.size;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const newAssetSource: string = reconstruction.join('');\r\n return {\r\n issues,\r\n result: {\r\n source: newAssetSource,\r\n size: initialSize + sizeDiff\r\n }\r\n };\r\n }\r\n\r\n private static _parseStringToReconstructionSequence(\r\n plugin: LocalizationPlugin,\r\n source: string,\r\n jsonpFunction: (locale: string, chunkIdToken: string | undefined) => string\r\n ): IParseResult {\r\n const issues: string[] = [];\r\n const reconstructionSeries: IReconstructionElement[] = [];\r\n\r\n let lastIndex: number = 0;\r\n let regexResult: RegExpExecArray | null;\r\n while ((regexResult = PLACEHOLDER_REGEX.exec(source))) {\r\n // eslint-disable-line no-cond-assign\r\n const staticElement: IStaticReconstructionElement = {\r\n kind: 'static',\r\n staticString: source.substring(lastIndex, regexResult.index)\r\n };\r\n reconstructionSeries.push(staticElement);\r\n\r\n const [placeholder, escapedBackslash, elementLabel, token, placeholderSerialNumber] = regexResult;\r\n\r\n let localizedReconstructionElement: IReconstructionElement;\r\n switch (elementLabel) {\r\n case Constants.STRING_PLACEHOLDER_LABEL: {\r\n const stringData: IStringData | undefined = plugin.getDataForSerialNumber(placeholderSerialNumber);\r\n if (!stringData) {\r\n issues.push(`Missing placeholder ${placeholder}`);\r\n const brokenLocalizedElement: IStaticReconstructionElement = {\r\n kind: 'static',\r\n staticString: placeholder\r\n };\r\n localizedReconstructionElement = brokenLocalizedElement;\r\n } else {\r\n const localizedElement: ILocalizedReconstructionElement = {\r\n kind: 'localized',\r\n values: stringData.values,\r\n size: placeholder.length,\r\n locFilePath: stringData.locFilePath,\r\n escapedBackslash: escapedBackslash,\r\n stringName: stringData.stringName\r\n };\r\n localizedReconstructionElement = localizedElement;\r\n }\r\n break;\r\n }\r\n\r\n case Constants.LOCALE_NAME_PLACEHOLDER_LABEL: {\r\n const dynamicElement: IDynamicReconstructionElement = {\r\n kind: 'dynamic',\r\n valueFn: (locale: string) => locale,\r\n size: placeholder.length,\r\n escapedBackslash: escapedBackslash\r\n };\r\n localizedReconstructionElement = dynamicElement;\r\n break;\r\n }\r\n\r\n case Constants.JSONP_PLACEHOLDER_LABEL: {\r\n const dynamicElement: IDynamicReconstructionElement = {\r\n kind: 'dynamic',\r\n valueFn: jsonpFunction,\r\n size: placeholder.length,\r\n escapedBackslash: escapedBackslash,\r\n token: token.substring(1, token.length - 1)\r\n };\r\n localizedReconstructionElement = dynamicElement;\r\n break;\r\n }\r\n\r\n default: {\r\n throw new Error(`Unexpected label ${elementLabel}`);\r\n }\r\n }\r\n\r\n reconstructionSeries.push(localizedReconstructionElement);\r\n lastIndex = regexResult.index + placeholder.length;\r\n }\r\n\r\n const lastElement: IStaticReconstructionElement = {\r\n kind: 'static',\r\n staticString: source.substr(lastIndex)\r\n };\r\n reconstructionSeries.push(lastElement);\r\n\r\n return {\r\n issues,\r\n reconstructionSeries\r\n };\r\n }\r\n\r\n private static _getJsonpFunction(\r\n chunk: Webpack.compilation.Chunk,\r\n chunkHasLocalizedModules: (chunk: Webpack.compilation.Chunk) => boolean,\r\n noStringsLocaleName: string\r\n ): (locale: string, chunkIdToken: string | undefined) => string {\r\n const idsWithStrings: Set<number | string> = new Set<number | string>();\r\n const idsWithoutStrings: Set<number | string> = new Set<number | string>();\r\n\r\n const asyncChunks: Set<Webpack.compilation.Chunk> = chunk.getAllAsyncChunks();\r\n for (const asyncChunk of asyncChunks) {\r\n const chunkId: number | string | null = asyncChunk.id;\r\n\r\n if (chunkId === null || chunkId === undefined) {\r\n throw new Error(`Chunk \"${asyncChunk.name}\"'s ID is null or undefined.`);\r\n }\r\n\r\n if (chunkHasLocalizedModules(asyncChunk)) {\r\n idsWithStrings.add(chunkId);\r\n } else {\r\n idsWithoutStrings.add(chunkId);\r\n }\r\n }\r\n\r\n if (idsWithStrings.size === 0) {\r\n return () => JSON.stringify(noStringsLocaleName);\r\n } else if (idsWithoutStrings.size === 0) {\r\n return (locale: string) => JSON.stringify(locale);\r\n } else {\r\n // Generate an array [<locale>, <nostrings locale>] and an object that is used as an indexer into that\r\n // object that maps chunk IDs to 0s for chunks with localized strings and 1s for chunks without localized\r\n // strings\r\n //\r\n // This can be improved in the future. We can maybe sort the chunks such that the chunks below a certain ID\r\n // number are localized and the those above are not.\r\n const chunkMapping: { [chunkId: string]: number } = {};\r\n for (const idWithStrings of idsWithStrings) {\r\n chunkMapping[idWithStrings] = 0;\r\n }\r\n\r\n for (const idWithoutStrings of idsWithoutStrings) {\r\n chunkMapping[idWithoutStrings] = 1;\r\n }\r\n\r\n return (locale: string, chunkIdToken: string | undefined) => {\r\n if (!locale) {\r\n throw new Error('Missing locale name.');\r\n }\r\n\r\n return `(${JSON.stringify([locale, noStringsLocaleName])})[${JSON.stringify(\r\n chunkMapping\r\n )}[${chunkIdToken}]]`;\r\n };\r\n }\r\n }\r\n}\r\n"]}
{"version":3,"file":"AssetProcessor.js","sourceRoot":"","sources":["../src/AssetProcessor.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;AAG3D,+CAAiC;AAEjC,qDAAkD;AA8ErC,QAAA,iBAAiB,GAAW,IAAI,MAAM,CACjD,GAAG,qBAAS,CAAC,yBAAyB,uCAAuC,EAC7E,GAAG,CACJ,CAAC;AAEF,MAAa,cAAc;IAClB,MAAM,CAAC,qBAAqB,CACjC,OAAsC;QAEtC,MAAM,WAAW,GAAW,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAEnD,MAAM,WAAW,GAAiB,cAAc,CAAC,oCAAoC,CACnF,OAAO,CAAC,MAAM,EACd,WAAW,EACX,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,wBAAwB,EAAE,OAAO,CAAC,mBAAmB,CAAC,CACrG,CAAC;QACF,MAAM,kBAAkB,GAAmC,cAAc,CAAC,qBAAqB,CAC7F,WAAW,CAAC,oBAAoB,EAChC,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,6BAA6B,EACrC,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CACrB,CAAC;QAEF,MAAM,eAAe,GAAiB,cAAc,CAAC,oCAAoC,CACvF,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,SAAS,EACjB,GAAG,EAAE;YACH,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QACjC,CAAC,CACF,CAAC;QACF,MAAM,sBAAsB,GAAmC,cAAc,CAAC,qBAAqB,CACjG,eAAe,CAAC,oBAAoB,EACpC,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,6BAA6B,EACrC,OAAO,CAAC,aAAa,EAC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ACjC;YAED,KAAK,MAAM,gBAAgB,IAAI,iBAAiB,EAAE;gBAChD,YAAY,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;aACpC;YAED,OAAO,CAAC,MAAc,EAAE,YAAgC,EAAE,EAAE;gBAC1D,IAAI,CAAC,MAAM,EAAE;oBACX,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;iBACzC;gBAED,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CACzE,YAAY,CACb,IAAI,YAAY,IAAI,CAAC;YACxB,CAAC,CAAC;SACH;IACH,CAAC;CACF;AAhYD,wCAgYC","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 * as Webpack from 'webpack';\r\nimport * as lodash from 'lodash';\r\n\r\nimport { Constants } from './utilities/Constants';\r\nimport { ILocaleElementMap } from './interfaces';\r\nimport { LocalizationPlugin, IStringSerialNumberData as IStringData } from './LocalizationPlugin';\r\n\r\ninterface IReconstructionElement {\r\n kind: 'static' | 'localized' | 'dynamic';\r\n}\r\n\r\ninterface IStaticReconstructionElement extends IReconstructionElement {\r\n kind: 'static';\r\n staticString: string;\r\n}\r\n\r\ninterface ILocalizedReconstructionElement extends IReconstructionElement {\r\n kind: 'localized';\r\n values: ILocaleElementMap;\r\n size: number;\r\n stringName: string;\r\n escapedBackslash: string;\r\n locFilePath: string;\r\n}\r\n\r\ninterface IDynamicReconstructionElement extends IReconstructionElement {\r\n kind: 'dynamic';\r\n valueFn: (locale: string, token: string | undefined) => string;\r\n size: number;\r\n escapedBackslash: string;\r\n token?: string;\r\n}\r\n\r\ninterface IParseResult {\r\n issues: string[];\r\n reconstructionSeries: IReconstructionElement[];\r\n}\r\n\r\ninterface IReconstructedString {\r\n source: string;\r\n size: number;\r\n}\r\n\r\ninterface ILocalizedReconstructionResult {\r\n result: Map<string, IReconstructedString>;\r\n issues: string[];\r\n}\r\n\r\ninterface INonLocalizedReconstructionResult {\r\n result: IReconstructedString;\r\n issues: string[];\r\n}\r\n\r\nexport interface IProcessAssetOptionsBase {\r\n plugin: LocalizationPlugin;\r\n compilation: Webpack.compilation.Compilation;\r\n assetName: string;\r\n asset: IAsset;\r\n chunk: Webpack.compilation.Chunk;\r\n noStringsLocaleName: string;\r\n chunkHasLocalizedModules: (chunk: Webpack.compilation.Chunk) => boolean;\r\n}\r\n\r\nexport interface IProcessNonLocalizedAssetOptions extends IProcessAssetOptionsBase {}\r\n\r\nexport interface IProcessLocalizedAssetOptions extends IProcessAssetOptionsBase {\r\n locales: Set<string>;\r\n fillMissingTranslationStrings: boolean;\r\n defaultLocale: string;\r\n}\r\n\r\nexport interface IAsset {\r\n size(): number;\r\n source(): string;\r\n}\r\n\r\nexport interface IProcessAssetResult {\r\n filename: string;\r\n asset: IAsset;\r\n}\r\n\r\nexport const PLACEHOLDER_REGEX: RegExp = new RegExp(\r\n `${Constants.STRING_PLACEHOLDER_PREFIX}_(\\\\\\\\*)_([A-C])(\\\\+[^+]+\\\\+)?_(\\\\d+)`,\r\n 'g'\r\n);\r\n\r\nexport class AssetProcessor {\r\n public static processLocalizedAsset(\r\n options: IProcessLocalizedAssetOptions\r\n ): Map<string, IProcessAssetResult> {\r\n const assetSource: string = options.asset.source();\r\n\r\n const parsedAsset: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\r\n options.plugin,\r\n assetSource,\r\n this._getJsonpFunction(options.chunk, options.chunkHasLocalizedModules, options.noStringsLocaleName)\r\n );\r\n const reconstructedAsset: ILocalizedReconstructionResult = AssetProcessor._reconstructLocalized(\r\n parsedAsset.reconstructionSeries,\r\n options.locales,\r\n options.fillMissingTranslationStrings,\r\n options.defaultLocale,\r\n options.asset.size()\r\n );\r\n\r\n const parsedAssetName: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\r\n options.plugin,\r\n options.assetName,\r\n () => {\r\n throw new Error('unsupported');\r\n }\r\n );\r\n const reconstructedAssetName: ILocalizedReconstructionResult = AssetProcessor._reconstructLocalized(\r\n parsedAssetName.reconstructionSeries,\r\n options.locales,\r\n options.fillMissingTranslationStrings,\r\n options.defaultLocale,\r\n options.assetName.length\r\n );\r\n\r\n const result: Map<string, IProcessAssetResult> = new Map<string, IProcessAssetResult>();\r\n for (const [locale, { source, size }] of reconstructedAsset.result) {\r\n const newAsset: IAsset = lodash.clone(options.asset);\r\n newAsset.source = () => source;\r\n newAsset.size = () => size;\r\n\r\n result.set(locale, {\r\n filename: reconstructedAssetName.result.get(locale)!.source,\r\n asset: newAsset\r\n });\r\n }\r\n\r\n const issues: string[] = [\r\n ...parsedAsset.issues,\r\n ...reconstructedAsset.issues,\r\n ...parsedAssetName.issues,\r\n ...reconstructedAssetName.issues\r\n ];\r\n\r\n if (issues.length > 0) {\r\n options.compilation.errors.push(\r\n Error(`localization:\\n${issues.map((issue) => ` ${issue}`).join('\\n')}`)\r\n );\r\n }\r\n\r\n return result;\r\n }\r\n\r\n public static processNonLocalizedAsset(options: IProcessNonLocalizedAssetOptions): IProcessAssetResult {\r\n const assetSource: string = options.asset.source();\r\n\r\n const parsedAsset: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\r\n options.plugin,\r\n assetSource,\r\n this._getJsonpFunction(options.chunk, options.chunkHasLocalizedModules, options.noStringsLocaleName)\r\n );\r\n const reconstructedAsset: INonLocalizedReconstructionResult = AssetProcessor._reconstructNonLocalized(\r\n parsedAsset.reconstructionSeries,\r\n options.asset.size(),\r\n options.noStringsLocaleName\r\n );\r\n\r\n const parsedAssetName: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\r\n options.plugin,\r\n options.assetName,\r\n () => {\r\n throw new Error('unsupported');\r\n }\r\n );\r\n const reconstructedAssetName: INonLocalizedReconstructionResult = AssetProcessor._reconstructNonLocalized(\r\n parsedAssetName.reconstructionSeries,\r\n options.assetName.length,\r\n options.noStringsLocaleName\r\n );\r\n\r\n const issues: string[] = [\r\n ...parsedAsset.issues,\r\n ...reconstructedAsset.issues,\r\n ...parsedAssetName.issues,\r\n ...reconstructedAssetName.issues\r\n ];\r\n\r\n if (issues.length > 0) {\r\n options.compilation.errors.push(\r\n Error(`localization:\\n${issues.map((issue) => ` ${issue}`).join('\\n')}`)\r\n );\r\n }\r\n\r\n const newAsset: IAsset = lodash.clone(options.asset);\r\n newAsset.source = () => reconstructedAsset.result.source;\r\n newAsset.size = () => reconstructedAsset.result.size;\r\n return {\r\n filename: reconstructedAssetName.result.source,\r\n asset: newAsset\r\n };\r\n }\r\n\r\n private static _reconstructLocalized(\r\n reconstructionSeries: IReconstructionElement[],\r\n locales: Set<string>,\r\n fillMissingTranslationStrings: boolean,\r\n defaultLocale: string,\r\n initialSize: number\r\n ): ILocalizedReconstructionResult {\r\n const localizedResults: Map<string, IReconstructedString> = new Map<string, IReconstructedString>();\r\n const issues: string[] = [];\r\n\r\n for (const locale of locales) {\r\n const reconstruction: string[] = [];\r\n\r\n let sizeDiff: number = 0;\r\n for (const element of reconstructionSeries) {\r\n switch (element.kind) {\r\n case 'static': {\r\n reconstruction.push((element as IStaticReconstructionElement).staticString);\r\n break;\r\n }\r\n\r\n case 'localized': {\r\n const localizedElement: ILocalizedReconstructionElement = element as ILocalizedReconstructionElement;\r\n let newValue: string | undefined = localizedElement.values[locale];\r\n if (!newValue) {\r\n if (fillMissingTranslationStrings) {\r\n newValue = localizedElement.values[defaultLocale];\r\n } else {\r\n issues.push(\r\n `The string \"${localizedElement.stringName}\" in \"${localizedElement.locFilePath}\" is missing in ` +\r\n `the locale ${locale}`\r\n );\r\n\r\n newValue = '-- MISSING STRING --';\r\n }\r\n }\r\n\r\n const escapedBackslash: string = localizedElement.escapedBackslash || '\\\\';\r\n\r\n // Replace backslashes with the properly escaped backslash\r\n newValue = newValue.replace(/\\\\/g, escapedBackslash);\r\n\r\n // @todo: look into using JSON.parse(...) to get the escaping characters\r\n const escapingCharacterSequence: string = escapedBackslash.substr(escapedBackslash.length / 2);\r\n\r\n // Ensure the the quotemark, apostrophe, tab, and newline characters are properly escaped\r\n newValue = newValue.replace(/\\r/g, `${escapingCharacterSequence}r`);\r\n newValue = newValue.replace(/\\n/g, `${escapingCharacterSequence}n`);\r\n newValue = newValue.replace(/\\t/g, `${escapingCharacterSequence}t`);\r\n newValue = newValue.replace(/\\\"/g, `${escapingCharacterSequence}u0022`);\r\n newValue = newValue.replace(/\\'/g, `${escapingCharacterSequence}u0027`);\r\n\r\n reconstruction.push(newValue);\r\n sizeDiff += newValue.length - localizedElement.size;\r\n break;\r\n }\r\n\r\n case 'dynamic': {\r\n const dynamicElement: IDynamicReconstructionElement = element as IDynamicReconstructionElement;\r\n const newValue: string = dynamicElement.valueFn(locale, dynamicElement.token);\r\n reconstruction.push(newValue);\r\n sizeDiff += newValue.length - dynamicElement.size;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const newAssetSource: string = reconstruction.join('');\r\n localizedResults.set(locale, {\r\n source: newAssetSource,\r\n size: initialSize + sizeDiff\r\n });\r\n }\r\n\r\n return {\r\n issues,\r\n result: localizedResults\r\n };\r\n }\r\n\r\n private static _reconstructNonLocalized(\r\n reconstructionSeries: IReconstructionElement[],\r\n initialSize: number,\r\n noStringsLocaleName: string\r\n ): INonLocalizedReconstructionResult {\r\n const issues: string[] = [];\r\n\r\n const reconstruction: string[] = [];\r\n\r\n let sizeDiff: number = 0;\r\n for (const element of reconstructionSeries) {\r\n switch (element.kind) {\r\n case 'static': {\r\n reconstruction.push((element as IStaticReconstructionElement).staticString);\r\n break;\r\n }\r\n\r\n case 'localized': {\r\n const localizedElement: ILocalizedReconstructionElement = element as ILocalizedReconstructionElement;\r\n issues.push(\r\n `The string \"${localizedElement.stringName}\" in \"${localizedElement.locFilePath}\" appeared in an asset ` +\r\n 'that is not expected to contain localized resources.'\r\n );\r\n\r\n const newValue: string = '-- NOT EXPECTED TO BE LOCALIZED --';\r\n reconstruction.push(newValue);\r\n sizeDiff += newValue.length - localizedElement.size;\r\n break;\r\n }\r\n\r\n case 'dynamic': {\r\n const dynamicElement: IDynamicReconstructionElement = element as IDynamicReconstructionElement;\r\n const newValue: string = dynamicElement.valueFn(noStringsLocaleName, dynamicElement.token);\r\n reconstruction.push(newValue);\r\n sizeDiff += newValue.length - dynamicElement.size;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const newAssetSource: string = reconstruction.join('');\r\n return {\r\n issues,\r\n result: {\r\n source: newAssetSource,\r\n size: initialSize + sizeDiff\r\n }\r\n };\r\n }\r\n\r\n private static _parseStringToReconstructionSequence(\r\n plugin: LocalizationPlugin,\r\n source: string,\r\n jsonpFunction: (locale: string, chunkIdToken: string | undefined) => string\r\n ): IParseResult {\r\n const issues: string[] = [];\r\n const reconstructionSeries: IReconstructionElement[] = [];\r\n\r\n let lastIndex: number = 0;\r\n let regexResult: RegExpExecArray | null;\r\n while ((regexResult = PLACEHOLDER_REGEX.exec(source))) {\r\n // eslint-disable-line no-cond-assign\r\n const staticElement: IStaticReconstructionElement = {\r\n kind: 'static',\r\n staticString: source.substring(lastIndex, regexResult.index)\r\n };\r\n reconstructionSeries.push(staticElement);\r\n\r\n const [placeholder, escapedBackslash, elementLabel, token, placeholderSerialNumber] = regexResult;\r\n\r\n let localizedReconstructionElement: IReconstructionElement;\r\n switch (elementLabel) {\r\n case Constants.STRING_PLACEHOLDER_LABEL: {\r\n const stringData: IStringData | undefined = plugin.getDataForSerialNumber(placeholderSerialNumber);\r\n if (!stringData) {\r\n issues.push(`Missing placeholder ${placeholder}`);\r\n const brokenLocalizedElement: IStaticReconstructionElement = {\r\n kind: 'static',\r\n staticString: placeholder\r\n };\r\n localizedReconstructionElement = brokenLocalizedElement;\r\n } else {\r\n const localizedElement: ILocalizedReconstructionElement = {\r\n kind: 'localized',\r\n values: stringData.values,\r\n size: placeholder.length,\r\n locFilePath: stringData.locFilePath,\r\n escapedBackslash: escapedBackslash,\r\n stringName: stringData.stringName\r\n };\r\n localizedReconstructionElement = localizedElement;\r\n }\r\n break;\r\n }\r\n\r\n case Constants.LOCALE_NAME_PLACEHOLDER_LABEL: {\r\n const dynamicElement: IDynamicReconstructionElement = {\r\n kind: 'dynamic',\r\n valueFn: (locale: string) => locale,\r\n size: placeholder.length,\r\n escapedBackslash: escapedBackslash\r\n };\r\n localizedReconstructionElement = dynamicElement;\r\n break;\r\n }\r\n\r\n case Constants.JSONP_PLACEHOLDER_LABEL: {\r\n const dynamicElement: IDynamicReconstructionElement = {\r\n kind: 'dynamic',\r\n valueFn: jsonpFunction,\r\n size: placeholder.length,\r\n escapedBackslash: escapedBackslash,\r\n token: token.substring(1, token.length - 1)\r\n };\r\n localizedReconstructionElement = dynamicElement;\r\n break;\r\n }\r\n\r\n default: {\r\n throw new Error(`Unexpected label ${elementLabel}`);\r\n }\r\n }\r\n\r\n reconstructionSeries.push(localizedReconstructionElement);\r\n lastIndex = regexResult.index + placeholder.length;\r\n }\r\n\r\n const lastElement: IStaticReconstructionElement = {\r\n kind: 'static',\r\n staticString: source.substr(lastIndex)\r\n };\r\n reconstructionSeries.push(lastElement);\r\n\r\n return {\r\n issues,\r\n reconstructionSeries\r\n };\r\n }\r\n\r\n private static _getJsonpFunction(\r\n chunk: Webpack.compilation.Chunk,\r\n chunkHasLocalizedModules: (chunk: Webpack.compilation.Chunk) => boolean,\r\n noStringsLocaleName: string\r\n ): (locale: string, chunkIdToken: string | undefined) => string {\r\n const idsWithStrings: Set<number | string> = new Set<number | string>();\r\n const idsWithoutStrings: Set<number | string> = new Set<number | string>();\r\n\r\n const asyncChunks: Set<Webpack.compilation.Chunk> = chunk.getAllAsyncChunks();\r\n for (const asyncChunk of asyncChunks) {\r\n const chunkId: number | string | null = asyncChunk.id;\r\n\r\n if (chunkId === null || chunkId === undefined) {\r\n throw new Error(`Chunk \"${asyncChunk.name}\"'s ID is null or undefined.`);\r\n }\r\n\r\n if (chunkHasLocalizedModules(asyncChunk)) {\r\n idsWithStrings.add(chunkId);\r\n } else {\r\n idsWithoutStrings.add(chunkId);\r\n }\r\n }\r\n\r\n if (idsWithStrings.size === 0) {\r\n return () => JSON.stringify(noStringsLocaleName);\r\n } else if (idsWithoutStrings.size === 0) {\r\n return (locale: string) => JSON.stringify(locale);\r\n } else {\r\n // Generate an array [<locale>, <nostrings locale>] and an object that is used as an indexer into that\r\n // object that maps chunk IDs to 0s for chunks with localized strings and 1s for chunks without localized\r\n // strings\r\n //\r\n // This can be improved in the future. We can maybe sort the chunks such that the chunks below a certain ID\r\n // number are localized and the those above are not.\r\n const chunkMapping: { [chunkId: string]: number } = {};\r\n for (const idWithStrings of idsWithStrings) {\r\n chunkMapping[idWithStrings] = 0;\r\n }\r\n\r\n for (const idWithoutStrings of idsWithoutStrings) {\r\n chunkMapping[idWithoutStrings] = 1;\r\n }\r\n\r\n return (locale: string, chunkIdToken: string | undefined) => {\r\n if (!locale) {\r\n throw new Error('Missing locale name.');\r\n }\r\n\r\n return `(${JSON.stringify([locale, noStringsLocaleName])})[${JSON.stringify(\r\n chunkMapping\r\n )}[${chunkIdToken}]]`;\r\n };\r\n }\r\n }\r\n}\r\n"]}

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

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAErG,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,iBAAiB,IAAI,kBAAkB,EACvC,0BAA0B,EAC1B,kBAAkB,EAClB,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,EACzB,cAAc,EACd,gBAAgB,IAAI,iBAAiB,EACrC,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,aAAa,IAAI,cAAc,EAC/B,oBAAoB,IAAI,qBAAqB,EAC9C,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EACL,wBAAwB,EACxB,uBAAuB,IAAI,gBAAgB,EAC5C,MAAM,2BAA2B,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAErG,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,iBAAiB,IAAI,kBAAkB,EACvC,0BAA0B,EAC1B,kBAAkB,EAClB,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,EACzB,cAAc,EACd,gBAAgB,IAAI,iBAAiB,EACrC,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,aAAa,IAAI,cAAc,EAC/B,oBAAoB,IAAI,qBAAqB,EAC9C,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EACL,wBAAwB,EACxB,uBAAuB,IAAI,gBAAgB,EAC5C,MAAM,2BAA2B,CAAC"}

@@ -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"]}

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

{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/interfaces.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,E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AM,GAAG,4BAA4B,CAAA;KAAE,CAAC;CACpE"}

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

{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/interfaces.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","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\n/**\r\n * Options for the passthrough locale.\r\n *\r\n * @public\r\n */\r\nexport interface IPassthroughLocaleOptions {\r\n /**\r\n * If this is set to `true`, a passthrough locale will be included in the output\r\n */\r\n usePassthroughLocale?: boolean;\r\n\r\n /**\r\n * If {@link IPassthroughLocaleOptions.usePassthroughLocale} is set, use this name for the passthrough locale.\r\n * Defaults to \"passthrough\"\r\n */\r\n passthroughLocaleName?: string;\r\n}\r\n\r\n/**\r\n * Options for typing generation.\r\n *\r\n * @public\r\n */\r\nexport interface ITypingsGenerationOptions {\r\n /**\r\n * This property specifies the folder in which `.d.ts` files for loc files should be dropped.\r\n */\r\n generatedTsFolder: string;\r\n\r\n /**\r\n * This optional property overrides the compiler context for discovery of localization files\r\n * for which typings should be generated.\r\n */\r\n sourceRoot?: string;\r\n\r\n /**\r\n * If this option is set to `true`, loc modules typings will be exported wrapped in a `default` property.\r\n */\r\n exportAsDefault?: boolean;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface IDefaultLocaleOptions {\r\n /**\r\n * This required property specifies the name of the locale used in the\r\n * `.resx` and `.loc.json` files in the source\r\n */\r\n localeName: string;\r\n\r\n /**\r\n * If this option is set to `true`, strings that are missing from\r\n * `localizedData.translatedStrings` will be provided by the default locale\r\n */\r\n fillMissingTranslationStrings?: boolean;\r\n}\r\n\r\n/**\r\n * Options for the pseudolocale library.\r\n *\r\n * @internalRemarks\r\n * Eventually this should be replaced with DefinitelyTyped types.\r\n *\r\n * @public\r\n */\r\nexport interface IPseudolocaleOptions {\r\n prepend?: string;\r\n append?: string;\r\n delimiter?: string;\r\n startDelimiter?: string;\r\n endDelimiter?: string;\r\n extend?: number;\r\n override?: string;\r\n}\r\n\r\n/**\r\n * Options for generated pseudolocales.\r\n *\r\n * @public\r\n */\r\nexport interface IPseudolocalesOptions {\r\n [pseudoLocaleName: string]: IPseudolocaleOptions;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocalizedData {\r\n /**\r\n * Options for the locale used in the source localized data files.\r\n */\r\n defaultLocale: IDefaultLocaleOptions;\r\n\r\n /**\r\n * Use this parameter to specify the translated data.\r\n */\r\n translatedStrings: ILocalizedStrings;\r\n\r\n /**\r\n * Use this parameter to specify a function used to load translations missing from\r\n * the {@link ILocalizedData.translatedStrings} parameter.\r\n */\r\n resolveMissingTranslatedStrings?: (locales: string[], filePath: string) => IResolvedMissingTranslations;\r\n\r\n /**\r\n * Options around including a passthrough locale.\r\n */\r\n passthroughLocale?: IPassthroughLocaleOptions;\r\n\r\n /**\r\n * Options for pseudo-localization.\r\n */\r\n pseudolocales?: IPseudolocalesOptions;\r\n\r\n /**\r\n * Normalize newlines in RESX files to either CRLF (Windows-style) or LF ('nix style)\r\n */\r\n normalizeResxNewlines?: 'lf' | 'crlf';\r\n}\r\n\r\n/**\r\n * Options for how localization stats data should be produced.\r\n *\r\n * @public\r\n */\r\nexport interface ILocalizationStatsOptions {\r\n /**\r\n * This option is used to designate a path at which a JSON file describing the localized\r\n * assets produced should be written.\r\n */\r\n dropPath?: string;\r\n\r\n /**\r\n * This option is used to specify a callback to be called with the stats data that would be\r\n * dropped at `localizationStats.dropPath` after compilation completes.\r\n */\r\n callback?: (stats: ILocalizationStats) => void;\r\n}\r\n\r\n/**\r\n * The options for localization.\r\n *\r\n * @public\r\n */\r\nexport interface ILocalizationPluginOptions {\r\n /**\r\n * Localization data.\r\n */\r\n localizedData: ILocalizedData;\r\n\r\n /**\r\n * This option is used to specify `.resx` and `.loc.json` files that should not be processed by this plugin.\r\n */\r\n filesToIgnore?: string[];\r\n\r\n /**\r\n * The value to replace the [locale] token with for chunks without localized strings. Defaults to \"none\"\r\n */\r\n noStringsLocaleName?: string;\r\n\r\n /**\r\n * Options for how localization stats data should be produced.\r\n */\r\n localizationStats?: ILocalizationStatsOptions;\r\n\r\n /**\r\n * This option is used to specify how and if TypeScript typings should be generated for loc files.\r\n */\r\n typingsOptions?: ITypingsGenerationOptions;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface ILocalizationFile {\r\n [stringName: string]: ILocalizedString;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface ILocalizedString {\r\n value: string;\r\n comment?: string;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocaleFileData {\r\n [stringName: string]: string;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface IResolvedMissingTranslations {\r\n [localeName: string]: string | ILocaleFileData;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocaleData {\r\n [locFilePath: string]: string | ILocaleFileData;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocalizedStrings {\r\n [locale: string]: ILocaleData;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocaleElementMap {\r\n [locale: string]: string;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocalizationStatsEntrypoint {\r\n localizedAssets: ILocaleElementMap;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocalizationStatsChunkGroup {\r\n localizedAssets: ILocaleElementMap;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocalizationStats {\r\n entrypoints: { [name: string]: ILocalizationStatsEntrypoint };\r\n namedChunkGroups: { [name: string]: ILocalizationStatsChunkGroup };\r\n}\r\n"]}
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","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\n/**\r\n * Options for the passthrough locale.\r\n *\r\n * @public\r\n */\r\nexport interface IPassthroughLocaleOptions {\r\n /**\r\n * If this is set to `true`, a passthrough locale will be included in the output\r\n */\r\n usePassthroughLocale?: boolean;\r\n\r\n /**\r\n * If {@link IPassthroughLocaleOptions.usePassthroughLocale} is set, use this name for the passthrough locale.\r\n * Defaults to \"passthrough\"\r\n */\r\n passthroughLocaleName?: string;\r\n}\r\n\r\n/**\r\n * Options for typing generation.\r\n *\r\n * @public\r\n */\r\nexport interface ITypingsGenerationOptions {\r\n /**\r\n * This property specifies the folder in which `.d.ts` files for loc files should be dropped.\r\n */\r\n generatedTsFolder: string;\r\n\r\n /**\r\n * This optional property overrides the compiler context for discovery of localization files\r\n * for which typings should be generated.\r\n */\r\n sourceRoot?: string;\r\n\r\n /**\r\n * If this option is set to `true`, loc modules typings will be exported wrapped in a `default` property.\r\n */\r\n exportAsDefault?: boolean;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface IDefaultLocaleOptions {\r\n /**\r\n * This required property specifies the name of the locale used in the\r\n * `.resx` and `.loc.json` files in the source\r\n */\r\n localeName: string;\r\n\r\n /**\r\n * If this option is set to `true`, strings that are missing from\r\n * `localizedData.translatedStrings` will be provided by the default locale\r\n */\r\n fillMissingTranslationStrings?: boolean;\r\n}\r\n\r\n/**\r\n * Options for the pseudolocale library.\r\n *\r\n * @internalRemarks\r\n * Eventually this should be replaced with DefinitelyTyped types.\r\n *\r\n * @public\r\n */\r\nexport interface IPseudolocaleOptions {\r\n prepend?: string;\r\n append?: string;\r\n delimiter?: string;\r\n startDelimiter?: string;\r\n endDelimiter?: string;\r\n extend?: number;\r\n override?: string;\r\n}\r\n\r\n/**\r\n * Options for generated pseudolocales.\r\n *\r\n * @public\r\n */\r\nexport interface IPseudolocalesOptions {\r\n [pseudoLocaleName: string]: IPseudolocaleOptions;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocalizedData {\r\n /**\r\n * Options for the locale used in the source localized data files.\r\n */\r\n defaultLocale: IDefaultLocaleOptions;\r\n\r\n /**\r\n * Use this parameter to specify the translated data.\r\n */\r\n translatedStrings: ILocalizedStrings;\r\n\r\n /**\r\n * Use this parameter to specify a function used to load translations missing from\r\n * the {@link ILocalizedData.translatedStrings} parameter.\r\n */\r\n resolveMissingTranslatedStrings?: (locales: string[], filePath: string) => IResolvedMissingTranslations;\r\n\r\n /**\r\n * Options around including a passthrough locale.\r\n */\r\n passthroughLocale?: IPassthroughLocaleOptions;\r\n\r\n /**\r\n * Options for pseudo-localization.\r\n */\r\n pseudolocales?: IPseudolocalesOptions;\r\n\r\n /**\r\n * Normalize newlines in RESX files to either CRLF (Windows-style) or LF ('nix style)\r\n */\r\n normalizeResxNewlines?: 'lf' | 'crlf';\r\n}\r\n\r\n/**\r\n * Options for how localization stats data should be produced.\r\n *\r\n * @public\r\n */\r\nexport interface ILocalizationStatsOptions {\r\n /**\r\n * This option is used to designate a path at which a JSON file describing the localized\r\n * assets produced should be written.\r\n */\r\n dropPath?: string;\r\n\r\n /**\r\n * This option is used to specify a callback to be called with the stats data that would be\r\n * dropped at `localizationStats.dropPath` after compilation completes.\r\n */\r\n callback?: (stats: ILocalizationStats) => void;\r\n}\r\n\r\n/**\r\n * The options for localization.\r\n *\r\n * @public\r\n */\r\nexport interface ILocalizationPluginOptions {\r\n /**\r\n * Localization data.\r\n */\r\n localizedData: ILocalizedData;\r\n\r\n /**\r\n * This option is used to specify `.resx` and `.loc.json` files that should not be processed by this plugin.\r\n */\r\n filesToIgnore?: string[];\r\n\r\n /**\r\n * The value to replace the [locale] token with for chunks without localized strings. Defaults to \"none\"\r\n */\r\n noStringsLocaleName?: string;\r\n\r\n /**\r\n * Options for how localization stats data should be produced.\r\n */\r\n localizationStats?: ILocalizationStatsOptions;\r\n\r\n /**\r\n * This option is used to specify how and if TypeScript typings should be generated for loc files.\r\n */\r\n typingsOptions?: ITypingsGenerationOptions;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface ILocalizationFile {\r\n [stringName: string]: ILocalizedString;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface ILocalizedString {\r\n value: string;\r\n comment?: string;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocaleFileData {\r\n [stringName: string]: string;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface IResolvedMissingTranslations {\r\n [localeName: string]: string | ILocaleFileData;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocaleData {\r\n [locFilePath: string]: string | ILocaleFileData;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocalizedStrings {\r\n [locale: string]: ILocaleData;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocaleElementMap {\r\n [locale: string]: string;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocalizationStatsEntrypoint {\r\n localizedAssets: ILocaleElementMap;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocalizationStatsChunkGroup {\r\n localizedAssets: ILocaleElementMap;\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocalizationStats {\r\n entrypoints: { [name: string]: ILocalizationStatsEntrypoint };\r\n namedChunkGroups: { [name: string]: ILocalizationStatsChunkGroup };\r\n}\r\n"]}

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

{"version":3,"file":"InPlaceLocFileLoader.d.ts","sourceRoot":"","sources":["../../../../src/loaders/InPlaceLocFileLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;;AAQjC,wBAkBG"}
{"version":3,"file":"InPlaceLocFileLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/InPlaceLocFileLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;;AAQjC,wBAkBG"}

@@ -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,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"]}

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

{"version":3,"file":"LoaderFactory.d.ts","sourceRoot":"","sources":["../../../../src/loaders/LoaderFactory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,MAAM,WAAW,kBAAkB;IACjC,wBAAwB,EAAE,WAAW,GAAG,SAAS,CAAC;CACnD;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,QAAQ,SAAS,kBAAkB,EAC/D,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,KAAK,aAAa,GACtF,MAAM,CAAC,MAAM,CAUf"}
{"version":3,"file":"LoaderFactory.d.ts","sourceRoot":"","sources":["../../src/loaders/LoaderFactory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,MAAM,WAAW,kBAAkB;IACjC,wBAAwB,EAAE,WAAW,GAAG,SAAS,CAAC;CACnD;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,QAAQ,SAAS,kBAAkB,EAC/D,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,KAAK,aAAa,GACtF,MAAM,CAAC,MAAM,CAUf"}

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

{"version":3,"file":"LoaderFactory.js","sourceRoot":"","sources":["../../../../src/loaders/LoaderFactory.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;AAG3D,0DAA4C;AAW5C,SAAgB,aAAa,CAC3B,WAAuF;IAEvF,OAAO,UAAsC,OAAwB;QACnE,MAAM,OAAO,GAAa,WAAW,CAAC,UAAU,CAAC,IAAI,CAAa,CAAC;QACnE,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YAC/B,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;SAC9B;QAED,MAAM,YAAY,GAAkB,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAChG,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC;AAZD,sCAYC","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 * as loaderUtils from 'loader-utils';\r\nimport { NewlineKind } from '@rushstack/node-core-library';\r\n\r\nexport interface IBaseLoaderOptions {\r\n resxNewlineNormalization: NewlineKind | undefined;\r\n}\r\n\r\nexport interface ILoaderResult {\r\n [stringName: string]: string;\r\n}\r\n\r\nexport function loaderFactory<TOptions extends IBaseLoaderOptions>(\r\n innerLoader: (locFilePath: string, content: string, options: TOptions) => ILoaderResult\r\n): loader.Loader {\r\n return function (this: loader.LoaderContext, content: string | Buffer): string {\r\n const options: TOptions = loaderUtils.getOptions(this) as TOptions;\r\n if (typeof content !== 'string') {\r\n content = content.toString();\r\n }\r\n\r\n const resultObject: ILoaderResult = innerLoader.call(this, this.resourcePath, content, options);\r\n return JSON.stringify(resultObject);\r\n };\r\n}\r\n"]}
{"version":3,"file":"LoaderFactory.js","sourceRoot":"","sources":["../../src/loaders/LoaderFactory.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;AAG3D,0DAA4C;AAW5C,SAAgB,aAAa,CAC3B,WAAuF;IAEvF,OAAO,UAAsC,OAAwB;QACnE,MAAM,OAAO,GAAa,WAAW,CAAC,UAAU,CAAC,IAAI,CAAa,CAAC;QACnE,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YAC/B,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;SAC9B;QAED,MAAM,YAAY,GAAkB,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAChG,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC;AAZD,sCAYC","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 * as loaderUtils from 'loader-utils';\r\nimport { NewlineKind } from '@rushstack/node-core-library';\r\n\r\nexport interface IBaseLoaderOptions {\r\n resxNewlineNormalization: NewlineKind | undefined;\r\n}\r\n\r\nexport interface ILoaderResult {\r\n [stringName: string]: string;\r\n}\r\n\r\nexport function loaderFactory<TOptions extends IBaseLoaderOptions>(\r\n innerLoader: (locFilePath: string, content: string, options: TOptions) => ILoaderResult\r\n): loader.Loader {\r\n return function (this: loader.LoaderContext, content: string | Buffer): string {\r\n const options: TOptions = loaderUtils.getOptions(this) as TOptions;\r\n if (typeof content !== 'string') {\r\n content = content.toString();\r\n }\r\n\r\n const resultObject: ILoaderResult = innerLoader.call(this, this.resourcePath, content, options);\r\n return JSON.stringify(resultObject);\r\n };\r\n}\r\n"]}

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

{"version":3,"file":"LocLoader.d.ts","sourceRoot":"","sources":["../../../../src/loaders/LocLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAiB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIpE,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,cAAc,EAAE,kBAAkB,CAAC;CACpC;;AAED,wBAyCG"}
{"version":3,"file":"LocLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/LocLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAiB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIpE,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,cAAc,EAAE,kBAAkB,CAAC;CACpC;;AAED,wBAyCG"}

@@ -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,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"]}

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

{"version":3,"file":"LocalizationPlugin.d.ts","sourceRoot":"","sources":["../../../src/LocalizationPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwB,QAAQ,EAAe,MAAM,8BAA8B,CAAC;AAC3F,O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AAC,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;AApvBD,gDAovBC","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<\r\n string,\r\n 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 {\r\n usePassthroughLocale,\r\n 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][\r\n 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,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;AAE3D,oEAA2F;AAC3F,iDAAmC;AACnC,2CAA6B;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,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;AApvBD,gDAovBC","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<\r\n string,\r\n 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 {\r\n usePassthroughLocale,\r\n 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][\r\n 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"]}

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

{"version":3,"file":"LocFileTypingsGenerator.d.ts","sourceRoot":"","sources":["../../../src/LocFileTypingsGenerator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAsB,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAKrE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,wBAAwB,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACpD;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,4BAA4B;gBACpD,OAAO,EAAE,wBAAwB;CA0BrD"}
{"version":3,"file":"LocFileTypingsGenerator.d.ts","sourceRoot":"","sources":["../src/LocFileTypingsGenerator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAsB,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAKrE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,wBAAwB,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACpD;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,4BAA4B;gBACpD,OAAO,EAAE,wBAAwB;CA0BrD"}

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

{"version":3,"file":"LocFileTypingsGenerator.js","sourceRoot":"","sources":["../../../src/LocFileTypingsGenerator.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAgG;AAIhG,6DAA0D;AAc1D;;;;GAIG;AACH,MAAa,uBAAwB,SAAQ,gDAA4B;IACvE,YAAmB,OAAiC;QAClD,KAAK,iCACA,OAAO,KACV,cAAc,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,EACtC,uBAAuB,EAAE,CAAC,YAAoB,EAAE,QAAgB,EAAE,EAAE;gBAClE,MAAM,WAAW,GAAsB,6BAAa,CAAC,YAAY,CAAC;oBAChE,QAAQ,EAAE,QAAQ;oBAClB,OAAO,EAAE,YAAY;oBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAS;oBACjC,wBAAwB,EAAE,OAAO,CAAC,wBAAwB;iBAC3D,CAAC,CAAC;gBAEH,MAAM,OAAO,GAAyB,EAAE,CAAC;gBAEzC,wCAAwC;gBACxC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;oBACpC,OAAO,CAAC,IAAI,CAAC;wBACX,UAAU,EAAE,UAAU;wBACtB,OAAO,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,OAAO;qBACzC,CAAC,CAAC;iBACJ;gBAED,OAAO,EAAE,OAAO,EAAE,CAAC;YACrB,CAAC,IACD,CAAC;IACL,CAAC;CACF;AA3BD,0DA2BC","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 { StringValuesTypingsGenerator, IStringValueTyping } from '@rushstack/typings-generator';\r\nimport { Terminal, NewlineKind } from '@rushstack/node-core-library';\r\n\r\nimport { ILocalizationFile } from './interfaces';\r\nimport { LocFileParser } from './utilities/LocFileParser';\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ITypingsGeneratorOptions {\r\n srcFolder: string;\r\n generatedTsFolder: string;\r\n terminal?: Terminal;\r\n exportAsDefault?: boolean;\r\n filesToIgnore?: string[];\r\n resxNewlineNormalization?: NewlineKind | undefined;\r\n}\r\n\r\n/**\r\n * This is a simple tool that generates .d.ts files for .loc.json and .resx files.\r\n *\r\n * @public\r\n */\r\nexport class LocFileTypingsGenerator extends StringValuesTypingsGenerator {\r\n public constructor(options: ITypingsGeneratorOptions) {\r\n super({\r\n ...options,\r\n fileExtensions: ['.resx', '.loc.json'],\r\n parseAndGenerateTypings: (fileContents: string, filePath: string) => {\r\n const locFileData: ILocalizationFile = LocFileParser.parseLocFile({\r\n filePath: filePath,\r\n content: fileContents,\r\n terminal: this._options.terminal!,\r\n resxNewlineNormalization: options.resxNewlineNormalization\r\n });\r\n\r\n const typings: IStringValueTyping[] = [];\r\n\r\n // eslint-disable-next-line guard-for-in\r\n for (const stringName in locFileData) {\r\n typings.push({\r\n exportName: stringName,\r\n comment: locFileData[stringName].comment\r\n });\r\n }\r\n\r\n return { typings };\r\n }\r\n });\r\n }\r\n}\r\n"]}
{"version":3,"file":"LocFileTypingsGenerator.js","sourceRoot":"","sources":["../src/LocFileTypingsGenerator.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAgG;AAIhG,6DAA0D;AAc1D;;;;GAIG;AACH,MAAa,uBAAwB,SAAQ,gDAA4B;IACvE,YAAmB,OAAiC;QAClD,KAAK,iCACA,OAAO,KACV,cAAc,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,EACtC,uBAAuB,EAAE,CAAC,YAAoB,EAAE,QAAgB,EAAE,EAAE;gBAClE,MAAM,WAAW,GAAsB,6BAAa,CAAC,YAAY,CAAC;oBAChE,QAAQ,EAAE,QAAQ;oBAClB,OAAO,EAAE,YAAY;oBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAS;oBACjC,wBAAwB,EAAE,OAAO,CAAC,wBAAwB;iBAC3D,CAAC,CAAC;gBAEH,MAAM,OAAO,GAAyB,EAAE,CAAC;gBAEzC,wCAAwC;gBACxC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;oBACpC,OAAO,CAAC,IAAI,CAAC;wBACX,UAAU,EAAE,UAAU;wBACtB,OAAO,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,OAAO;qBACzC,CAAC,CAAC;iBACJ;gBAED,OAAO,EAAE,OAAO,EAAE,CAAC;YACrB,CAAC,IACD,CAAC;IACL,CAAC;CACF;AA3BD,0DA2BC","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 { StringValuesTypingsGenerator, IStringValueTyping } from '@rushstack/typings-generator';\r\nimport { Terminal, NewlineKind } from '@rushstack/node-core-library';\r\n\r\nimport { ILocalizationFile } from './interfaces';\r\nimport { LocFileParser } from './utilities/LocFileParser';\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ITypingsGeneratorOptions {\r\n srcFolder: string;\r\n generatedTsFolder: string;\r\n terminal?: Terminal;\r\n exportAsDefault?: boolean;\r\n filesToIgnore?: string[];\r\n resxNewlineNormalization?: NewlineKind | undefined;\r\n}\r\n\r\n/**\r\n * This is a simple tool that generates .d.ts files for .loc.json and .resx files.\r\n *\r\n * @public\r\n */\r\nexport class LocFileTypingsGenerator extends StringValuesTypingsGenerator {\r\n public constructor(options: ITypingsGeneratorOptions) {\r\n super({\r\n ...options,\r\n fileExtensions: ['.resx', '.loc.json'],\r\n parseAndGenerateTypings: (fileContents: string, filePath: string) => {\r\n const locFileData: ILocalizationFile = LocFileParser.parseLocFile({\r\n filePath: filePath,\r\n content: fileContents,\r\n terminal: this._options.terminal!,\r\n resxNewlineNormalization: options.resxNewlineNormalization\r\n });\r\n\r\n const typings: IStringValueTyping[] = [];\r\n\r\n // eslint-disable-next-line guard-for-in\r\n for (const stringName in locFileData) {\r\n typings.push({\r\n exportName: stringName,\r\n comment: locFileData[stringName].comment\r\n });\r\n }\r\n\r\n return { typings };\r\n }\r\n });\r\n }\r\n}\r\n"]}

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

{"version":3,"file":"Pseudolocalization.d.ts","sourceRoot":"","sources":["../../../src/Pseudolocalization.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,qBAAa,kBAAkB;WACf,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM;CAWzF"}
{"version":3,"file":"Pseudolocalization.d.ts","sourceRoot":"","sources":["../src/Pseudolocalization.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,qBAAa,kBAAkB;WACf,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM;CAWzF"}

@@ -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,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"]}

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

{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../../src/utilities/Constants.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,qBAAa,SA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AE,MAAM,CAA6F;CACrI"}

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

{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../../src/utilities/Constants.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAA0D;AAC1D,+CAAiC;AAEjC,MAAa,SAAS;;AAAtB,8BA2BC;AA1Be,yBAAe,GAAe,8BAAU,CAAC,QAAQ,CAC7D,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAChE,CAAC;AAEY,+BAAqB,GAAW,UAAU,CAAC;AAC3C,qCAA2B,GAAW,IAAI,MAAM,CAC5D,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,qBAAqB,CAAC,EACpD,IAAI,CACL,CAAC;AACY,6CAAmC,GAAW,kBAAkB,CAAC;AACjE,mDAAyC,GAAW,IAAI,MAAM,CAC1E,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,mCAAmC,CAAC,EAClE,IAAI,CACL,CAAC;AACY,mCAAyB,GAAW,wDAAwD,CAAC;AAE7F,oBAAU,GAAW,UAAU,CAAC;AAChC,wBAAc,GAAW,eAAe,CAAC;AACzC,gCAAsB,GAAW,sBAAsB,CAAC;AAExD,kCAAwB,GAAW,GAAG,CAAC;AACvC,uCAA6B,GAAW,GAAG,CAAC;AAC5C,iCAAuB,GAAW,GAAG,CAAC;AAEtC,iCAAuB,GAAW,GAAG,SAAS,CAAC,yBAAyB,KAAK,SAAS,CAAC,6BAA6B,IAAI,CAAC;AACzH,2BAAiB,GAAW,GAAG,SAAS,CAAC,yBAAyB,KAAK,SAAS,CAAC,uBAAuB,aAAa,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 * as path from 'path';\r\nimport { JsonSchema } from '@rushstack/node-core-library';\r\nimport * as lodash from 'lodash';\r\n\r\nexport class Constants {\r\n public static LOC_JSON_SCHEMA: JsonSchema = JsonSchema.fromFile(\r\n path.resolve(__dirname, '..', 'schemas', 'locJson.schema.json')\r\n );\r\n\r\n public static LOCALE_FILENAME_TOKEN: string = '[locale]';\r\n public static LOCALE_FILENAME_TOKEN_REGEX: RegExp = new RegExp(\r\n lodash.escapeRegExp(Constants.LOCALE_FILENAME_TOKEN),\r\n 'gi'\r\n );\r\n public static NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN: string = '[no-locale-file]';\r\n public static NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX: RegExp = new RegExp(\r\n lodash.escapeRegExp(Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN),\r\n 'gi'\r\n );\r\n public static STRING_PLACEHOLDER_PREFIX: string = '_LOCALIZED_STRING_f12dy0i7_n4bo_dqwj_39gf_sasqehjmihz9';\r\n\r\n public static RESX_REGEX: RegExp = /\\.resx$/i;\r\n public static LOC_JSON_REGEX: RegExp = /\\.loc\\.json$/i;\r\n public static RESX_OR_LOC_JSON_REGEX: RegExp = /\\.(resx|loc\\.json)$/i;\r\n\r\n public static STRING_PLACEHOLDER_LABEL: string = 'A';\r\n public static LOCALE_NAME_PLACEHOLDER_LABEL: string = 'B';\r\n public static JSONP_PLACEHOLDER_LABEL: string = 'C';\r\n\r\n public static LOCALE_NAME_PLACEHOLDER: string = `${Constants.STRING_PLACEHOLDER_PREFIX}__${Constants.LOCALE_NAME_PLACEHOLDER_LABEL}_0`;\r\n public static JSONP_PLACEHOLDER: string = `${Constants.STRING_PLACEHOLDER_PREFIX}__${Constants.JSONP_PLACEHOLDER_LABEL}+chunkId+_0`;\r\n}\r\n"]}
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/utilities/Constants.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAA0D;AAC1D,+CAAiC;AAEjC,MAAa,SAAS;;AAAtB,8BA2BC;AA1Be,yBAAe,GAAe,8BAAU,CAAC,QAAQ,CAC7D,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAChE,CAAC;AAEY,+BAAqB,GAAW,UAAU,CAAC;AAC3C,qCAA2B,GAAW,IAAI,MAAM,CAC5D,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,qBAAqB,CAAC,EACpD,IAAI,CACL,CAAC;AACY,6CAAmC,GAAW,kBAAkB,CAAC;AACjE,mDAAyC,GAAW,IAAI,MAAM,CAC1E,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,mCAAmC,CAAC,EAClE,IAAI,CACL,CAAC;AACY,mCAAyB,GAAW,wDAAwD,CAAC;AAE7F,oBAAU,GAAW,UAAU,CAAC;AAChC,wBAAc,GAAW,eAAe,CAAC;AACzC,gCAAsB,GAAW,sBAAsB,CAAC;AAExD,kCAAwB,GAAW,GAAG,CAAC;AACvC,uCAA6B,GAAW,GAAG,CAAC;AAC5C,iCAAuB,GAAW,GAAG,CAAC;AAEtC,iCAAuB,GAAW,GAAG,SAAS,CAAC,yBAAyB,KAAK,SAAS,CAAC,6BAA6B,IAAI,CAAC;AACzH,2BAAiB,GAAW,GAAG,SAAS,CAAC,yBAAyB,KAAK,SAAS,CAAC,uBAAuB,aAAa,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 * as path from 'path';\r\nimport { JsonSchema } from '@rushstack/node-core-library';\r\nimport * as lodash from 'lodash';\r\n\r\nexport class Constants {\r\n public static LOC_JSON_SCHEMA: JsonSchema = JsonSchema.fromFile(\r\n path.resolve(__dirname, '..', 'schemas', 'locJson.schema.json')\r\n );\r\n\r\n public static LOCALE_FILENAME_TOKEN: string = '[locale]';\r\n public static LOCALE_FILENAME_TOKEN_REGEX: RegExp = new RegExp(\r\n lodash.escapeRegExp(Constants.LOCALE_FILENAME_TOKEN),\r\n 'gi'\r\n );\r\n public static NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN: string = '[no-locale-file]';\r\n public static NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX: RegExp = new RegExp(\r\n lodash.escapeRegExp(Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN),\r\n 'gi'\r\n );\r\n public static STRING_PLACEHOLDER_PREFIX: string = '_LOCALIZED_STRING_f12dy0i7_n4bo_dqwj_39gf_sasqehjmihz9';\r\n\r\n public static RESX_REGEX: RegExp = /\\.resx$/i;\r\n public static LOC_JSON_REGEX: RegExp = /\\.loc\\.json$/i;\r\n public static RESX_OR_LOC_JSON_REGEX: RegExp = /\\.(resx|loc\\.json)$/i;\r\n\r\n public static STRING_PLACEHOLDER_LABEL: string = 'A';\r\n public static LOCALE_NAME_PLACEHOLDER_LABEL: string = 'B';\r\n public static JSONP_PLACEHOLDER_LABEL: string = 'C';\r\n\r\n public static LOCALE_NAME_PLACEHOLDER: string = `${Constants.STRING_PLACEHOLDER_PREFIX}__${Constants.LOCALE_NAME_PLACEHOLDER_LABEL}_0`;\r\n public static JSONP_PLACEHOLDER: string = `${Constants.STRING_PLACEHOLDER_PREFIX}__${Constants.JSONP_PLACEHOLDER_LABEL}+chunkId+_0`;\r\n}\r\n"]}

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

{"version":3,"file":"EntityMarker.d.ts","sourceRoot":"","sources":["../../../../src/utilities/EntityMarker.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,KAAK,EAAE,OAAO,MAAoC,CAAC;AAEzD,MAAM,WAAW,SAAS;IACxB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,YAAY;WACT,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;WAI1D,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;CAGrE"}
{"version":3,"file":"EntityMarker.d.ts","sourceRoot":"","sources":["../../src/utilities/EntityMarker.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,KAAK,EAAE,OAAO,MAAoC,CAAC;AAEzD,MAAM,WAAW,SAAS;IACxB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,YAAY;WACT,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;WAI1D,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;CAGrE"}

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

{"version":3,"file":"EntityMarker.js","sourceRoot":"","sources":["../../../../src/utilities/EntityMarker.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,MAAM,KAAK,GAAkB,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAMzD;;GAEG;AACH,MAAa,YAAY;IAChB,MAAM,CAAC,UAAU,CAAU,MAAe,EAAE,KAAc;QAC7D,MAAgC,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IACpD,CAAC;IAEM,MAAM,CAAC,OAAO,CAAU,MAAe;QAC5C,OAAS,MAAgC,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;CACF;AARD,oCAQC","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\nconst LABEL: unique symbol = Symbol('loc-plugin-marked');\r\n\r\nexport interface IMarkable {\r\n [LABEL]: boolean;\r\n}\r\n\r\n/**\r\n * Use the functions on this class to mark webpack entities that contain localized resources.\r\n */\r\nexport class EntityMarker {\r\n public static markEntity<TModule>(module: TModule, value: boolean): void {\r\n ((module as unknown) as IMarkable)[LABEL] = value;\r\n }\r\n\r\n public static getMark<TModule>(module: TModule): boolean | undefined {\r\n return ((module as unknown) as IMarkable)[LABEL];\r\n }\r\n}\r\n"]}
{"version":3,"file":"EntityMarker.js","sourceRoot":"","sources":["../../src/utilities/EntityMarker.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,MAAM,KAAK,GAAkB,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAMzD;;GAEG;AACH,MAAa,YAAY;IAChB,MAAM,CAAC,UAAU,CAAU,MAAe,EAAE,KAAc;QAC7D,MAAgC,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IACpD,CAAC;IAEM,MAAM,CAAC,OAAO,CAAU,MAAe;QAC5C,OAAS,MAAgC,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;CACF;AARD,oCAQC","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\nconst LABEL: unique symbol = Symbol('loc-plugin-marked');\r\n\r\nexport interface IMarkable {\r\n [LABEL]: boolean;\r\n}\r\n\r\n/**\r\n * Use the functions on this class to mark webpack entities that contain localized resources.\r\n */\r\nexport class EntityMarker {\r\n public static markEntity<TModule>(module: TModule, value: boolean): void {\r\n ((module as unknown) as IMarkable)[LABEL] = value;\r\n }\r\n\r\n public static getMark<TModule>(module: TModule): boolean | undefined {\r\n return ((module as unknown) as IMarkable)[LABEL];\r\n }\r\n}\r\n"]}

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

{"version":3,"file":"LoaderTerminalProvider.d.ts","sourceRoot":"","sources":["../../../../src/utilities/LoaderTerminalProvider.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAA4B,MAAM,8BAA8B,CAAC;AAE3F,qBAAa,sBAAsB;WACnB,4BAA4B,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,GAAG,iBAAiB;CAmB3G"}
{"version":3,"file":"LoaderTerminalProvider.d.ts","sourceRoot":"","sources":["../../src/utilities/LoaderTerminalProvider.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAA4B,MAAM,8BAA8B,CAAC;AAE3F,qBAAa,sBAAsB;WACnB,4BAA4B,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,GAAG,iBAAiB;CAmB3G"}

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

{"version":3,"file":"LoaderTerminalProvider.js","sourceRoot":"","sources":["../../../../src/utilities/LoaderTerminalProvider.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,oEAA2F;AAE3F,MAAa,sBAAsB;IAC1B,MAAM,CAAC,4BAA4B,CAAC,aAA2C;QACpF,OAAO;YACL,aAAa,EAAE,KAAK;YACpB,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE,CAAC,IAAY,EAAE,QAAkC,EAAE,EAAE;gBAC1D,QAAQ,QAAQ,EAAE;oBAChB,KAAK,4CAAwB,CAAC,KAAK,CAAC,CAAC;wBACnC,aAAa,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;wBACzC,MAAM;qBACP;oBAED,KAAK,4CAAwB,CAAC,OAAO,CAAC,CAAC;wBACrC,aAAa,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;wBAC3C,MAAM;qBACP;iBACF;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF;AApBD,wDAoBC","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 * as webpack from 'webpack';\r\nimport { ITerminalProvider, TerminalProviderSeverity } from '@rushstack/node-core-library';\r\n\r\nexport class LoaderTerminalProvider {\r\n public static getTerminalProviderForLoader(loaderContext: webpack.loader.LoaderContext): ITerminalProvider {\r\n return {\r\n supportsColor: false,\r\n eolCharacter: '\\n',\r\n write: (data: string, severity: TerminalProviderSeverity) => {\r\n switch (severity) {\r\n case TerminalProviderSeverity.error: {\r\n loaderContext.emitError(new Error(data));\r\n break;\r\n }\r\n\r\n case TerminalProviderSeverity.warning: {\r\n loaderContext.emitWarning(new Error(data));\r\n break;\r\n }\r\n }\r\n }\r\n };\r\n }\r\n}\r\n"]}
{"version":3,"file":"LoaderTerminalProvider.js","sourceRoot":"","sources":["../../src/utilities/LoaderTerminalProvider.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,oEAA2F;AAE3F,MAAa,sBAAsB;IAC1B,MAAM,CAAC,4BAA4B,CAAC,aAA2C;QACpF,OAAO;YACL,aAAa,EAAE,KAAK;YACpB,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE,CAAC,IAAY,EAAE,QAAkC,EAAE,EAAE;gBAC1D,QAAQ,QAAQ,EAAE;oBAChB,KAAK,4CAAwB,CAAC,KAAK,CAAC,CAAC;wBACnC,aAAa,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;wBACzC,MAAM;qBACP;oBAED,KAAK,4CAAwB,CAAC,OAAO,CAAC,CAAC;wBACrC,aAAa,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;wBAC3C,MAAM;qBACP;iBACF;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF;AApBD,wDAoBC","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 * as webpack from 'webpack';\r\nimport { ITerminalProvider, TerminalProviderSeverity } from '@rushstack/node-core-library';\r\n\r\nexport class LoaderTerminalProvider {\r\n public static getTerminalProviderForLoader(loaderContext: webpack.loader.LoaderContext): ITerminalProvider {\r\n return {\r\n supportsColor: false,\r\n eolCharacter: '\\n',\r\n write: (data: string, severity: TerminalProviderSeverity) => {\r\n switch (severity) {\r\n case TerminalProviderSeverity.error: {\r\n loaderContext.emitError(new Error(data));\r\n break;\r\n }\r\n\r\n case TerminalProviderSeverity.warning: {\r\n loaderContext.emitWarning(new Error(data));\r\n break;\r\n }\r\n }\r\n }\r\n };\r\n }\r\n}\r\n"]}

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

{"version":3,"file":"LocFileParser.d.ts","sourceRoot":"","sources":["../../../../src/utilities/LocFileParser.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAY,MAAM,8BAA8B,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIlD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB,EAAE,WAAW,GAAG,SAAS,CAAC;CACnD;AASD;;GAEG;AACH,qBAAa,aAAa;WACV,YAAY,CAAC,OAAO,EAAE,oBAAoB,GAAG,iBAAiB;CA4B7E"}
{"version":3,"file":"LocFileParser.d.ts","sourceRoot":"","sources":["../../src/utilities/LocFileParser.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAY,MAAM,8BAA8B,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIlD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB,EAAE,WAAW,GAAG,SAAS,CAAC;CACnD;AASD;;GAEG;AACH,qBAAa,aAAa;WACV,YAAY,CAAC,OAAO,EAAE,oBAAoB,GAAG,iBAAiB;CA4B7E"}

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

{"version":3,"file":"LocFileParser.js","sourceRoot":"","sources":["../../../../src/utilities/LocFileParser.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F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,UAAU,CAAC;IACpB,CAAC;CACF;AA7BD,sCA6BC","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 { Terminal, NewlineKind, JsonFile } from '@rushstack/node-core-library';\r\n\r\nimport { ILocalizationFile } from '../interfaces';\r\nimport { ResxReader } from './ResxReader';\r\nimport { Constants } from './Constants';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface IParseLocFileOptions {\r\n terminal: Terminal;\r\n filePath: string;\r\n content: string;\r\n resxNewlineNormalization: NewlineKind | undefined;\r\n}\r\n\r\ninterface IParseCacheEntry {\r\n content: string;\r\n parsedFile: ILocalizationFile;\r\n}\r\n\r\nconst parseCache: Map<string, IParseCacheEntry> = new Map<string, IParseCacheEntry>();\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class LocFileParser {\r\n public static parseLocFile(options: IParseLocFileOptions): ILocalizationFile {\r\n const fileCacheKey: string = `${options.filePath}?${options.resxNewlineNormalization || 'none'}`;\r\n if (parseCache.has(fileCacheKey)) {\r\n const entry: IParseCacheEntry = parseCache.get(fileCacheKey)!;\r\n if (entry.content === options.content) {\r\n return entry.parsedFile;\r\n }\r\n }\r\n\r\n let parsedFile: ILocalizationFile;\r\n if (/\\.resx$/i.test(options.filePath)) {\r\n parsedFile = ResxReader.readResxAsLocFile(options.content, {\r\n terminal: options.terminal,\r\n resxFilePath: options.filePath,\r\n newlineNormalization: options.resxNewlineNormalization\r\n });\r\n } else {\r\n parsedFile = JsonFile.parseString(options.content);\r\n try {\r\n Constants.LOC_JSON_SCHEMA.validateObject(parsedFile, options.filePath);\r\n } catch (e) {\r\n options.terminal.writeError(`The loc file is invalid. Error: ${e}`);\r\n }\r\n }\r\n\r\n parseCache.set(fileCacheKey, { content: options.content, parsedFile });\r\n return parsedFile;\r\n }\r\n}\r\n"]}
{"version":3,"file":"LocFileParser.js","sourceRoot":"","sources":["../../src/utilities/LocFileParser.ts"],"names":[],"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AE,CAAC,CAAC;QACvE,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AA7BD,sCA6BC","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 { Terminal, NewlineKind, JsonFile } from '@rushstack/node-core-library';\r\n\r\nimport { ILocalizationFile } from '../interfaces';\r\nimport { ResxReader } from './ResxReader';\r\nimport { Constants } from './Constants';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface IParseLocFileOptions {\r\n terminal: Terminal;\r\n filePath: string;\r\n content: string;\r\n resxNewlineNormalization: NewlineKind | undefined;\r\n}\r\n\r\ninterface IParseCacheEntry {\r\n content: string;\r\n parsedFile: ILocalizationFile;\r\n}\r\n\r\nconst parseCache: Map<string, IParseCacheEntry> = new Map<string, IParseCacheEntry>();\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class LocFileParser {\r\n public static parseLocFile(options: IParseLocFileOptions): ILocalizationFile {\r\n const fileCacheKey: string = `${options.filePath}?${options.resxNewlineNormalization || 'none'}`;\r\n if (parseCache.has(fileCacheKey)) {\r\n const entry: IParseCacheEntry = parseCache.get(fileCacheKey)!;\r\n if (entry.content === options.content) {\r\n return entry.parsedFile;\r\n }\r\n }\r\n\r\n let parsedFile: ILocalizationFile;\r\n if (/\\.resx$/i.test(options.filePath)) {\r\n parsedFile = ResxReader.readResxAsLocFile(options.content, {\r\n terminal: options.terminal,\r\n resxFilePath: options.filePath,\r\n newlineNormalization: options.resxNewlineNormalization\r\n });\r\n } else {\r\n parsedFile = JsonFile.parseString(options.content);\r\n try {\r\n Constants.LOC_JSON_SCHEMA.validateObject(parsedFile, options.filePath);\r\n } catch (e) {\r\n options.terminal.writeError(`The loc file is invalid. Error: ${e}`);\r\n }\r\n }\r\n\r\n parseCache.set(fileCacheKey, { content: options.content, parsedFile });\r\n return parsedFile;\r\n }\r\n}\r\n"]}

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

{"version":3,"file":"ResxReader.d.ts","sourceRoot":"","sources":["../../../../src/utilities/ResxReader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,QAAQ,EAAQ,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGvF,OAAO,EAAoB,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIpE,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,oBAAoB,EAAE,WAAW,GAAG,SAAS,CAAC;CAC/C;AAgBD,qBAAa,UAAU;WACP,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,GAAG,iBAAiB;WAKrE,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,iBAAiB;IAsBrG,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAqFzC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAwF/B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAuC/B,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAiBpC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAiBtC,OAAO,CAAC,MAAM,CAAC,gBAAgB;CAkBhC"}
{"version":3,"file":"ResxReader.d.ts","sourceRoot":"","sources":["../../src/utilities/ResxReader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,QAAQ,EAAQ,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGvF,OAAO,EAAoB,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIpE,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,oBAAoB,EAAE,WAAW,GAAG,SAAS,CAAC;CAC/C;AAgBD,qBAAa,UAAU;WACP,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,GAAG,iBAAiB;WAKrE,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,iBAAiB;IAsBrG,OAAO,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ensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { FileSystem, Terminal, Text, NewlineKind } from '@rushstack/node-core-library';\r\nimport { XmlDocument, XmlElement } from 'xmldoc';\r\n\r\nimport { ILocalizedString, ILocalizationFile } from '../interfaces';\r\n\r\nconst STRING_NAME_RESX: RegExp = /^[A-z_$][A-z0-9_$]*$/;\r\n\r\nexport interface IResxReaderOptions {\r\n resxFilePath: string;\r\n terminal: Terminal;\r\n newlineNormalization: NewlineKind | undefined;\r\n}\r\n\r\ninterface ILoggingFunctions {\r\n logError: (message: string) => void;\r\n logWarning: (message: string) => void;\r\n logFileError: (message: string, filePath: string, line?: number, position?: number) => void;\r\n logFileWarning: (message: string, filePath: string, line?: number, position?: number) => void;\r\n}\r\n\r\ninterface IResxReaderOptionsInternal {\r\n resxFilePath: string;\r\n resxContents: string;\r\n loggingFunctions: ILoggingFunctions;\r\n newlineNormalization: NewlineKind | undefined;\r\n}\r\n\r\nexport class ResxReader {\r\n public static readResxFileAsLocFile(options: IResxReaderOptions): ILocalizationFile {\r\n const resxContents: string = FileSystem.readFile(options.resxFilePath);\r\n return ResxReader.readResxAsLocFile(resxContents, options);\r\n }\r\n\r\n public static readResxAsLocFile(resxContents: string, options: IResxReaderOptions): ILocalizationFile {\r\n const writeError: (message: string) => void = options.terminal.writeErrorLine.bind(options.terminal);\r\n const writeWarning: (message: string) => void = options.terminal.writeWarningLine.bind(options.terminal);\r\n const loggingFunctions: ILoggingFunctions = {\r\n logError: (message: string) => writeError(message),\r\n logWarning: (message: string) => writeWarning(message),\r\n logFileError: (message: string, filePath: string, line?: number, position?: number) => {\r\n ResxReader._logWithLocation(writeError, message, filePath, line, position);\r\n },\r\n logFileWarning: (message: string, filePath: string, line?: number, position?: number) => {\r\n ResxReader._logWithLocation(writeWarning, message, filePath, line, position);\r\n }\r\n };\r\n\r\n return this._readResxAsLocFileInternal({\r\n resxFilePath: options.resxFilePath,\r\n resxContents,\r\n loggingFunctions,\r\n newlineNormalization: options.newlineNormalization\r\n });\r\n }\r\n\r\n private static _readResxAsLocFileInternal(options: IResxReaderOptionsInternal): ILocalizationFile {\r\n const xmlDocument: XmlDocument = new XmlDocument(options.resxContents);\r\n\r\n if (xmlDocument.name !== 'root') {\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n `Expected RESX to have a \"root\" element, found \"${xmlDocument.name}\"`,\r\n xmlDocument\r\n );\r\n }\r\n\r\n const locFile: ILocalizationFile = {};\r\n\r\n for (const childNode of xmlDocument.children) {\r\n switch (childNode.type) {\r\n case 'element': {\r\n switch (childNode.name) {\r\n case 'data': {\r\n const stringName: string = childNode.attr.name;\r\n if (!stringName) {\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n 'Unexpected missing or empty string name',\r\n childNode\r\n );\r\n } else if (!STRING_NAME_RESX.test(stringName)) {\r\n ResxReader._logErrorWithLocation(options, `Invalid string name \"${stringName}\"`, childNode);\r\n } else {\r\n if (locFile.hasOwnProperty(stringName)) {\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n `Duplicate string value \"${stringName}\"`,\r\n childNode\r\n );\r\n }\r\n\r\n const locString: ILocalizedString | undefined = ResxReader._readDataElement(\r\n options,\r\n childNode\r\n );\r\n\r\n if (locString) {\r\n locFile[stringName] = locString;\r\n }\r\n }\r\n\r\n break;\r\n }\r\n\r\n // Other allowed elements\r\n case 'xsd:schema':\r\n case 'resheader':\r\n break;\r\n\r\n default:\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n `Unexpected RESX element ${childNode.name}`,\r\n childNode\r\n );\r\n }\r\n\r\n break;\r\n }\r\n\r\n case 'text': {\r\n if (childNode.text.trim() !== '') {\r\n ResxReader._logErrorWithLocation(options, 'Found unexpected non-empty text node in RESX');\r\n }\r\n\r\n break;\r\n }\r\n\r\n case 'comment':\r\n break;\r\n\r\n default:\r\n ResxReader._logErrorWithLocation(options, `Unexpected ${childNode.type} child in RESX`);\r\n break;\r\n }\r\n }\r\n\r\n return locFile;\r\n }\r\n\r\n private static _readDataElement(\r\n options: IResxReaderOptionsInternal,\r\n dataElement: XmlElement\r\n ): ILocalizedString | undefined {\r\n let foundCommentElement: boolean = false;\r\n let foundValueElement: boolean = false;\r\n let comment: string | undefined = undefined;\r\n let value: string | undefined = undefined;\r\n\r\n for (const childNode of dataElement.children) {\r\n switch (childNode.type) {\r\n case 'element': {\r\n switch (childNode.name) {\r\n case 'value': {\r\n if (foundValueElement) {\r\n ResxReader._logErrorWithLocation(options, 'Duplicate <value> element found', childNode);\r\n } else {\r\n foundValueElement = true;\r\n value = ResxReader._readTextElement(options, childNode);\r\n if (value && options.newlineNormalization) {\r\n value = Text.convertTo(value, options.newlineNormalization);\r\n }\r\n }\r\n\r\n break;\r\n }\r\n\r\n case 'comment': {\r\n if (foundCommentElement) {\r\n ResxReader._logErrorWithLocation(options, 'Duplicate <comment> element found', childNode);\r\n } else {\r\n foundCommentElement = true;\r\n comment = ResxReader._readTextElement(options, childNode);\r\n }\r\n\r\n break;\r\n }\r\n\r\n default:\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n `Unexpected RESX element ${childNode.name}`,\r\n childNode\r\n );\r\n break;\r\n }\r\n\r\n break;\r\n }\r\n\r\n case 'text': {\r\n if (childNode.text.trim() !== '') {\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n 'Found unexpected non-empty text node in RESX <data> element',\r\n dataElement\r\n );\r\n }\r\n\r\n break;\r\n }\r\n\r\n case 'comment':\r\n break;\r\n\r\n default:\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n `Unexpected ${childNode.type} child in RESX <data> element`,\r\n dataElement\r\n );\r\n }\r\n }\r\n\r\n if (!foundValueElement) {\r\n ResxReader._logErrorWithLocation(options, 'Missing string value in <data> element', dataElement);\r\n } else {\r\n if (comment === undefined) {\r\n ResxReader._logWarningWithLocation(options, 'Missing string comment in <data> element', dataElement);\r\n }\r\n\r\n return {\r\n value: value || '',\r\n comment\r\n };\r\n }\r\n }\r\n\r\n private static _readTextElement(\r\n options: IResxReaderOptionsInternal,\r\n element: XmlElement\r\n ): string | undefined {\r\n let foundText: string | undefined = undefined;\r\n\r\n for (const childNode of element.children) {\r\n switch (childNode.type) {\r\n case 'cdata':\r\n case 'text': {\r\n if (foundText !== undefined) {\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n 'More than one child node found containing text content',\r\n element\r\n );\r\n break;\r\n }\r\n\r\n foundText = childNode.type === 'text' ? childNode.text : childNode.cdata;\r\n break;\r\n }\r\n\r\n case 'comment':\r\n break;\r\n\r\n case 'element':\r\n ResxReader._logErrorWithLocation(options, `Unexpected element`, childNode);\r\n break;\r\n\r\n default:\r\n ResxReader._logErrorWithLocation(options, `Unexpected ${element.type} child`, element);\r\n break;\r\n }\r\n }\r\n\r\n return foundText;\r\n }\r\n\r\n private static _logErrorWithLocation(\r\n options: IResxReaderOptionsInternal,\r\n message: string,\r\n element?: XmlElement | XmlDocument\r\n ): void {\r\n if (element) {\r\n options.loggingFunctions.logFileError(\r\n message,\r\n options.resxFilePath,\r\n element.line + 1,\r\n element.column + 1\r\n );\r\n } else {\r\n options.loggingFunctions.logFileError(message, options.resxFilePath);\r\n }\r\n }\r\n\r\n private static _logWarningWithLocation(\r\n options: IResxReaderOptionsInternal,\r\n message: string,\r\n element?: XmlElement | XmlDocument\r\n ): void {\r\n if (element) {\r\n options.loggingFunctions.logFileWarning(\r\n message,\r\n options.resxFilePath,\r\n element.line + 1,\r\n element.column + 1\r\n );\r\n } else {\r\n options.loggingFunctions.logFileWarning(message, options.resxFilePath);\r\n }\r\n }\r\n\r\n private static _logWithLocation(\r\n loggingFn: (message: string) => void,\r\n message: string,\r\n filePath: string,\r\n line?: number,\r\n position?: number\r\n ): void {\r\n let location: string;\r\n if (position !== undefined) {\r\n location = `${filePath}(${line},${position})`;\r\n } else if (line !== undefined) {\r\n location = `${filePath}(${line})`;\r\n } else {\r\n location = filePath;\r\n }\r\n\r\n loggingFn(`${location}: ${message}`);\r\n }\r\n}\r\n"]}
{"version":3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OAAO,CAAC,gBAAgB,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;SACtE;IACH,CAAC;IAEO,MAAM,CAAC,uBAAuB,CACpC,OAAmC,EACnC,OAAe,EACf,OAAkC;QAElC,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,gBAAgB,CAAC,cAAc,CACrC,OAAO,EACP,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,IAAI,GAAG,CAAC,EAChB,OAAO,CAAC,MAAM,GAAG,CAAC,CACnB,CAAC;SACH;aAAM;YACL,OAAO,CAAC,gBAAgB,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;SACxE;IACH,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAC7B,SAAoC,EACpC,OAAe,EACf,QAAgB,EAChB,IAAa,EACb,QAAiB;QAEjB,IAAI,QAAgB,CAAC;QACrB,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,QAAQ,GAAG,GAAG,QAAQ,IAAI,IAAI,IAAI,QAAQ,GAAG,CAAC;SAC/C;aAAM,IAAI,IAAI,KAAK,SAAS,EAAE;YAC7B,QAAQ,GAAG,GAAG,QAAQ,IAAI,IAAI,GAAG,CAAC;SACnC;aAAM;YACL,QAAQ,GAAG,QAAQ,CAAC;SACrB;QAED,SAAS,CAAC,GAAG,QAAQ,KAAK,OAAO,EAAE,CAAC,CAAC;IACvC,CAAC;CACF;AApSD,gCAoSC","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 { FileSystem, Terminal, Text, NewlineKind } from '@rushstack/node-core-library';\r\nimport { XmlDocument, XmlElement } from 'xmldoc';\r\n\r\nimport { ILocalizedString, ILocalizationFile } from '../interfaces';\r\n\r\nconst STRING_NAME_RESX: RegExp = /^[A-z_$][A-z0-9_$]*$/;\r\n\r\nexport interface IResxReaderOptions {\r\n resxFilePath: string;\r\n terminal: Terminal;\r\n newlineNormalization: NewlineKind | undefined;\r\n}\r\n\r\ninterface ILoggingFunctions {\r\n logError: (message: string) => void;\r\n logWarning: (message: string) => void;\r\n logFileError: (message: string, filePath: string, line?: number, position?: number) => void;\r\n logFileWarning: (message: string, filePath: string, line?: number, position?: number) => void;\r\n}\r\n\r\ninterface IResxReaderOptionsInternal {\r\n resxFilePath: string;\r\n resxContents: string;\r\n loggingFunctions: ILoggingFunctions;\r\n newlineNormalization: NewlineKind | undefined;\r\n}\r\n\r\nexport class ResxReader {\r\n public static readResxFileAsLocFile(options: IResxReaderOptions): ILocalizationFile {\r\n const resxContents: string = FileSystem.readFile(options.resxFilePath);\r\n return ResxReader.readResxAsLocFile(resxContents, options);\r\n }\r\n\r\n public static readResxAsLocFile(resxContents: string, options: IResxReaderOptions): ILocalizationFile {\r\n const writeError: (message: string) => void = options.terminal.writeErrorLine.bind(options.terminal);\r\n const writeWarning: (message: string) => void = options.terminal.writeWarningLine.bind(options.terminal);\r\n const loggingFunctions: ILoggingFunctions = {\r\n logError: (message: string) => writeError(message),\r\n logWarning: (message: string) => writeWarning(message),\r\n logFileError: (message: string, filePath: string, line?: number, position?: number) => {\r\n ResxReader._logWithLocation(writeError, message, filePath, line, position);\r\n },\r\n logFileWarning: (message: string, filePath: string, line?: number, position?: number) => {\r\n ResxReader._logWithLocation(writeWarning, message, filePath, line, position);\r\n }\r\n };\r\n\r\n return this._readResxAsLocFileInternal({\r\n resxFilePath: options.resxFilePath,\r\n resxContents,\r\n loggingFunctions,\r\n newlineNormalization: options.newlineNormalization\r\n });\r\n }\r\n\r\n private static _readResxAsLocFileInternal(options: IResxReaderOptionsInternal): ILocalizationFile {\r\n const xmlDocument: XmlDocument = new XmlDocument(options.resxContents);\r\n\r\n if (xmlDocument.name !== 'root') {\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n `Expected RESX to have a \"root\" element, found \"${xmlDocument.name}\"`,\r\n xmlDocument\r\n );\r\n }\r\n\r\n const locFile: ILocalizationFile = {};\r\n\r\n for (const childNode of xmlDocument.children) {\r\n switch (childNode.type) {\r\n case 'element': {\r\n switch (childNode.name) {\r\n case 'data': {\r\n const stringName: string = childNode.attr.name;\r\n if (!stringName) {\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n 'Unexpected missing or empty string name',\r\n childNode\r\n );\r\n } else if (!STRING_NAME_RESX.test(stringName)) {\r\n ResxReader._logErrorWithLocation(options, `Invalid string name \"${stringName}\"`, childNode);\r\n } else {\r\n if (locFile.hasOwnProperty(stringName)) {\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n `Duplicate string value \"${stringName}\"`,\r\n childNode\r\n );\r\n }\r\n\r\n const locString: ILocalizedString | undefined = ResxReader._readDataElement(\r\n options,\r\n childNode\r\n );\r\n\r\n if (locString) {\r\n locFile[stringName] = locString;\r\n }\r\n }\r\n\r\n break;\r\n }\r\n\r\n // Other allowed elements\r\n case 'xsd:schema':\r\n case 'resheader':\r\n break;\r\n\r\n default:\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n `Unexpected RESX element ${childNode.name}`,\r\n childNode\r\n );\r\n }\r\n\r\n break;\r\n }\r\n\r\n case 'text': {\r\n if (childNode.text.trim() !== '') {\r\n ResxReader._logErrorWithLocation(options, 'Found unexpected non-empty text node in RESX');\r\n }\r\n\r\n break;\r\n }\r\n\r\n case 'comment':\r\n break;\r\n\r\n default:\r\n ResxReader._logErrorWithLocation(options, `Unexpected ${childNode.type} child in RESX`);\r\n break;\r\n }\r\n }\r\n\r\n return locFile;\r\n }\r\n\r\n private static _readDataElement(\r\n options: IResxReaderOptionsInternal,\r\n dataElement: XmlElement\r\n ): ILocalizedString | undefined {\r\n let foundCommentElement: boolean = false;\r\n let foundValueElement: boolean = false;\r\n let comment: string | undefined = undefined;\r\n let value: string | undefined = undefined;\r\n\r\n for (const childNode of dataElement.children) {\r\n switch (childNode.type) {\r\n case 'element': {\r\n switch (childNode.name) {\r\n case 'value': {\r\n if (foundValueElement) {\r\n ResxReader._logErrorWithLocation(options, 'Duplicate <value> element found', childNode);\r\n } else {\r\n foundValueElement = true;\r\n value = ResxReader._readTextElement(options, childNode);\r\n if (value && options.newlineNormalization) {\r\n value = Text.convertTo(value, options.newlineNormalization);\r\n }\r\n }\r\n\r\n break;\r\n }\r\n\r\n case 'comment': {\r\n if (foundCommentElement) {\r\n ResxReader._logErrorWithLocation(options, 'Duplicate <comment> element found', childNode);\r\n } else {\r\n foundCommentElement = true;\r\n comment = ResxReader._readTextElement(options, childNode);\r\n }\r\n\r\n break;\r\n }\r\n\r\n default:\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n `Unexpected RESX element ${childNode.name}`,\r\n childNode\r\n );\r\n break;\r\n }\r\n\r\n break;\r\n }\r\n\r\n case 'text': {\r\n if (childNode.text.trim() !== '') {\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n 'Found unexpected non-empty text node in RESX <data> element',\r\n dataElement\r\n );\r\n }\r\n\r\n break;\r\n }\r\n\r\n case 'comment':\r\n break;\r\n\r\n default:\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n `Unexpected ${childNode.type} child in RESX <data> element`,\r\n dataElement\r\n );\r\n }\r\n }\r\n\r\n if (!foundValueElement) {\r\n ResxReader._logErrorWithLocation(options, 'Missing string value in <data> element', dataElement);\r\n } else {\r\n if (comment === undefined) {\r\n ResxReader._logWarningWithLocation(options, 'Missing string comment in <data> element', dataElement);\r\n }\r\n\r\n return {\r\n value: value || '',\r\n comment\r\n };\r\n }\r\n }\r\n\r\n private static _readTextElement(\r\n options: IResxReaderOptionsInternal,\r\n element: XmlElement\r\n ): string | undefined {\r\n let foundText: string | undefined = undefined;\r\n\r\n for (const childNode of element.children) {\r\n switch (childNode.type) {\r\n case 'cdata':\r\n case 'text': {\r\n if (foundText !== undefined) {\r\n ResxReader._logErrorWithLocation(\r\n options,\r\n 'More than one child node found containing text content',\r\n element\r\n );\r\n break;\r\n }\r\n\r\n foundText = childNode.type === 'text' ? childNode.text : childNode.cdata;\r\n break;\r\n }\r\n\r\n case 'comment':\r\n break;\r\n\r\n case 'element':\r\n ResxReader._logErrorWithLocation(options, `Unexpected element`, childNode);\r\n break;\r\n\r\n default:\r\n ResxReader._logErrorWithLocation(options, `Unexpected ${element.type} child`, element);\r\n break;\r\n }\r\n }\r\n\r\n return foundText;\r\n }\r\n\r\n private static _logErrorWithLocation(\r\n options: IResxReaderOptionsInternal,\r\n message: string,\r\n element?: XmlElement | XmlDocument\r\n ): void {\r\n if (element) {\r\n options.loggingFunctions.logFileError(\r\n message,\r\n options.resxFilePath,\r\n element.line + 1,\r\n element.column + 1\r\n );\r\n } else {\r\n options.loggingFunctions.logFileError(message, options.resxFilePath);\r\n }\r\n }\r\n\r\n private static _logWarningWithLocation(\r\n options: IResxReaderOptionsInternal,\r\n message: string,\r\n element?: XmlElement | XmlDocument\r\n ): void {\r\n if (element) {\r\n options.loggingFunctions.logFileWarning(\r\n message,\r\n options.resxFilePath,\r\n element.line + 1,\r\n element.column + 1\r\n );\r\n } else {\r\n options.loggingFunctions.logFileWarning(message, options.resxFilePath);\r\n }\r\n }\r\n\r\n private static _logWithLocation(\r\n loggingFn: (message: string) => void,\r\n message: string,\r\n filePath: string,\r\n line?: number,\r\n position?: number\r\n ): void {\r\n let location: string;\r\n if (position !== undefined) {\r\n location = `${filePath}(${line},${position})`;\r\n } else if (line !== undefined) {\r\n location = `${filePath}(${line})`;\r\n } else {\r\n location = filePath;\r\n }\r\n\r\n loggingFn(`${location}: ${message}`);\r\n }\r\n}\r\n"]}

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

{"version":3,"file":"WebpackConfigurationUpdater.d.ts","sourceRoot":"","sources":["../../../src/WebpackConfigurationUpdater.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI1D,MAAM,WAA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All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport * as path from 'path';\r\nimport * as Webpack from 'webpack';\r\nimport * as SetPublicPathPluginPackageType from '@rushstack/set-webpack-public-path-plugin';\r\nimport { NewlineKind } from '@rushstack/node-core-library';\r\nimport * as lodash from 'lodash';\r\n\r\nimport { Constants } from './utilities/Constants';\r\nimport { LocalizationPlugin } from './LocalizationPlugin';\r\nimport { ILocLoaderOptions } from './loaders/LocLoader';\r\nimport { IBaseLoaderOptions } from './loaders/LoaderFactory';\r\n\r\nexport interface IWebpackConfigurationUpdaterOptions {\r\n pluginInstance: LocalizationPlugin;\r\n configuration: Webpack.Configuration;\r\n filesToIgnore: Set<string>;\r\n localeNameOrPlaceholder: string;\r\n resxNewlineNormalization: NewlineKind | undefined;\r\n}\r\n\r\nconst FILE_TOKEN_REGEX: RegExp = new RegExp(lodash.escapeRegExp('[file]'));\r\n\r\nexport class WebpackConfigurationUpdater {\r\n public static amendWebpackConfigurationForMultiLocale(options: IWebpackConfigurationUpdaterOptions): void {\r\n const loader: string = path.resolve(__dirname, 'loaders', 'LocLoader.js');\r\n const loaderOptions: ILocLoaderOptions = {\r\n pluginInstance: options.pluginInstance,\r\n resxNewlineNormalization: options.resxNewlineNormalization\r\n };\r\n\r\n WebpackConfigurationUpdater._addLoadersForLocFiles(options, loader, loaderOptions);\r\n\r\n WebpackConfigurationUpdater._tryUpdateLocaleTokenInPublicPathPlugin(options);\r\n\r\n WebpackConfigurationUpdater._tryUpdateSourceMapFilename(options.configuration);\r\n }\r\n\r\n public static amendWebpackConfigurationForInPlaceLocFiles(\r\n options: IWebpackConfigurationUpdaterOptions\r\n ): void {\r\n const loader: string = path.resolve(__dirname, 'loaders', 'InPlaceLocFileLoader.js');\r\n const loaderOptions: IBaseLoaderOptions = {\r\n resxNewlineNormalization: options.resxNewlineNormalization\r\n };\r\n\r\n WebpackConfigurationUpdater._addRulesToConfiguration(options.configuration, [\r\n {\r\n test: Constants.LOC_JSON_REGEX,\r\n use: [\r\n {\r\n loader: loader,\r\n options: loaderOptions\r\n }\r\n ]\r\n },\r\n {\r\n test: Constants.RESX_REGEX,\r\n use: [\r\n {\r\n loader: loader,\r\n options: loaderOptions\r\n }\r\n ],\r\n type: 'json'\r\n }\r\n ]);\r\n }\r\n\r\n private static _tryUpdateLocaleTokenInPublicPathPlugin(options: IWebpackConfigurationUpdaterOptions): void {\r\n let setPublicPathPlugin: typeof SetPublicPathPluginPackageType.SetPublicPathPlugin | undefined;\r\n try {\r\n const pluginPackage: typeof SetPublicPathPluginPackageType = require('@rushstack/set-webpack-public-path-plugin');\r\n setPublicPathPlugin = pluginPackage.SetPublicPathPlugin;\r\n } catch (e) {\r\n // public path plugin isn't present - ignore\r\n }\r\n\r\n if (setPublicPathPlugin && options.configuration.plugins) {\r\n for (const plugin of options.configuration.plugins) {\r\n if (plugin instanceof setPublicPathPlugin) {\r\n if (\r\n plugin.options &&\r\n plugin.options.scriptName &&\r\n plugin.options.scriptName.isTokenized &&\r\n plugin.options.scriptName.name\r\n ) {\r\n plugin.options.scriptName.name = plugin.options.scriptName.name.replace(\r\n /\\[locale\\]/g,\r\n options.localeNameOrPlaceholder\r\n );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static _addLoadersForLocFiles(\r\n options: IWebpackConfigurationUpdaterOptions,\r\n loader: string,\r\n loaderOptions: IBaseLoaderOptions\r\n ): void {\r\n WebpackConfigurationUpdater._addRulesToConfiguration(options.configuration, [\r\n {\r\n test: {\r\n and: [(filePath: string) => !options.filesToIgnore.has(filePath), Constants.LOC_JSON_REGEX]\r\n },\r\n use: [\r\n {\r\n loader: loader,\r\n options: loaderOptions\r\n }\r\n ]\r\n },\r\n {\r\n test: {\r\n and: [(filePath: string) => !options.filesToIgnore.has(filePath), Constants.RESX_REGEX]\r\n },\r\n use: [\r\n {\r\n loader: loader,\r\n options: loaderOptions\r\n }\r\n ],\r\n type: 'json'\r\n }\r\n ]);\r\n }\r\n\r\n private static _addRulesToConfiguration(\r\n configuration: Webpack.Configuration,\r\n rules: Webpack.RuleSetRule[]\r\n ): void {\r\n if (!configuration.module) {\r\n configuration.module = {\r\n rules: []\r\n };\r\n }\r\n\r\n if (!configuration.module.rules) {\r\n configuration.module.rules = [];\r\n }\r\n\r\n configuration.module.rules.push(...rules);\r\n }\r\n\r\n private static _tryUpdateSourceMapFilename(configuration: Webpack.Configuration): void {\r\n if (!configuration.output) {\r\n configuration.output = {}; // This should never happen\r\n }\r\n\r\n if (configuration.output.sourceMapFilename !== undefined) {\r\n configuration.output.sourceMapFilename = configuration.output.sourceMapFilename.replace(\r\n FILE_TOKEN_REGEX,\r\n Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN\r\n );\r\n }\r\n }\r\n}\r\n"]}
{"version":3,"file":"WebpackConfigurationUpdater.js","sourceRoot":"","sources":["../src/WebpackConfigurationUpdater.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAI7B,+CAAiC;AAEjC,qDAAkD;AAalD,MAAM,gBAAgB,GAAW,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE3E,MAAa,2BAA2B;IAC/B,MAAM,CAAC,uCAAuC,CAAC,OAA4C;QAChG,MAAM,MAAM,GAAW,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QAC1E,MAAM,aAAa,GAAsB;YACvC,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,wBAAwB,EAAE,OAAO,CAAC,wBAAwB;SAC3D,CAAC;QAEF,2BAA2B,CAAC,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;QAEnF,2BAA2B,CAAC,uCAAuC,CAAC,OAAO,CAAC,CAAC;QAE7E,2BAA2B,CAAC,2BAA2B,CAAC,OAAO,CAAC,aAAa,CAAC,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AM,CAAC,2BAA2B,CAAC,aAAoC;QAC7E,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;YACzB,aAAa,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,2BAA2B;SACvD;QAED,IAAI,aAAa,CAAC,MAAM,CAAC,iBAAiB,KAAK,SAAS,EAAE;YACxD,aAAa,CAAC,MAAM,CAAC,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CACrF,gBAAgB,EAChB,qBAAS,CAAC,mCAAmC,CAC9C,CAAC;SACH;IACH,CAAC;CACF;AAvID,kEAuIC","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 * as path from 'path';\r\nimport * as Webpack from 'webpack';\r\nimport * as SetPublicPathPluginPackageType from '@rushstack/set-webpack-public-path-plugin';\r\nimport { NewlineKind } from '@rushstack/node-core-library';\r\nimport * as lodash from 'lodash';\r\n\r\nimport { Constants } from './utilities/Constants';\r\nimport { LocalizationPlugin } from './LocalizationPlugin';\r\nimport { ILocLoaderOptions } from './loaders/LocLoader';\r\nimport { IBaseLoaderOptions } from './loaders/LoaderFactory';\r\n\r\nexport interface IWebpackConfigurationUpdaterOptions {\r\n pluginInstance: LocalizationPlugin;\r\n configuration: Webpack.Configuration;\r\n filesToIgnore: Set<string>;\r\n localeNameOrPlaceholder: string;\r\n resxNewlineNormalization: NewlineKind | undefined;\r\n}\r\n\r\nconst FILE_TOKEN_REGEX: RegExp = new RegExp(lodash.escapeRegExp('[file]'));\r\n\r\nexport class WebpackConfigurationUpdater {\r\n public static amendWebpackConfigurationForMultiLocale(options: IWebpackConfigurationUpdaterOptions): void {\r\n const loader: string = path.resolve(__dirname, 'loaders', 'LocLoader.js');\r\n const loaderOptions: ILocLoaderOptions = {\r\n pluginInstance: options.pluginInstance,\r\n resxNewlineNormalization: options.resxNewlineNormalization\r\n };\r\n\r\n WebpackConfigurationUpdater._addLoadersForLocFiles(options, loader, loaderOptions);\r\n\r\n WebpackConfigurationUpdater._tryUpdateLocaleTokenInPublicPathPlugin(options);\r\n\r\n WebpackConfigurationUpdater._tryUpdateSourceMapFilename(options.configuration);\r\n }\r\n\r\n public static amendWebpackConfigurationForInPlaceLocFiles(\r\n options: IWebpackConfigurationUpdaterOptions\r\n ): void {\r\n const loader: string = path.resolve(__dirname, 'loaders', 'InPlaceLocFileLoader.js');\r\n const loaderOptions: IBaseLoaderOptions = {\r\n resxNewlineNormalization: options.resxNewlineNormalization\r\n };\r\n\r\n WebpackConfigurationUpdater._addRulesToConfiguration(options.configuration, [\r\n {\r\n test: Constants.LOC_JSON_REGEX,\r\n use: [\r\n {\r\n loader: loader,\r\n options: loaderOptions\r\n }\r\n ]\r\n },\r\n {\r\n test: Constants.RESX_REGEX,\r\n use: [\r\n {\r\n loader: loader,\r\n options: loaderOptions\r\n }\r\n ],\r\n type: 'json'\r\n }\r\n ]);\r\n }\r\n\r\n private static _tryUpdateLocaleTokenInPublicPathPlugin(options: IWebpackConfigurationUpdaterOptions): void {\r\n let setPublicPathPlugin: typeof SetPublicPathPluginPackageType.SetPublicPathPlugin | undefined;\r\n try {\r\n const pluginPackage: typeof SetPublicPathPluginPackageType = require('@rushstack/set-webpack-public-path-plugin');\r\n setPublicPathPlugin = pluginPackage.SetPublicPathPlugin;\r\n } catch (e) {\r\n // public path plugin isn't present - ignore\r\n }\r\n\r\n if (setPublicPathPlugin && options.configuration.plugins) {\r\n for (const plugin of options.configuration.plugins) {\r\n if (plugin instanceof setPublicPathPlugin) {\r\n if (\r\n plugin.options &&\r\n plugin.options.scriptName &&\r\n plugin.options.scriptName.isTokenized &&\r\n plugin.options.scriptName.name\r\n ) {\r\n plugin.options.scriptName.name = plugin.options.scriptName.name.replace(\r\n /\\[locale\\]/g,\r\n options.localeNameOrPlaceholder\r\n );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static _addLoadersForLocFiles(\r\n options: IWebpackConfigurationUpdaterOptions,\r\n loader: string,\r\n loaderOptions: IBaseLoaderOptions\r\n ): void {\r\n WebpackConfigurationUpdater._addRulesToConfiguration(options.configuration, [\r\n {\r\n test: {\r\n and: [(filePath: string) => !options.filesToIgnore.has(filePath), Constants.LOC_JSON_REGEX]\r\n },\r\n use: [\r\n {\r\n loader: loader,\r\n options: loaderOptions\r\n }\r\n ]\r\n },\r\n {\r\n test: {\r\n and: [(filePath: string) => !options.filesToIgnore.has(filePath), Constants.RESX_REGEX]\r\n },\r\n use: [\r\n {\r\n loader: loader,\r\n options: loaderOptions\r\n }\r\n ],\r\n type: 'json'\r\n }\r\n ]);\r\n }\r\n\r\n private static _addRulesToConfiguration(\r\n configuration: Webpack.Configuration,\r\n rules: Webpack.RuleSetRule[]\r\n ): void {\r\n if (!configuration.module) {\r\n configuration.module = {\r\n rules: []\r\n };\r\n }\r\n\r\n if (!configuration.module.rules) {\r\n configuration.module.rules = [];\r\n }\r\n\r\n configuration.module.rules.push(...rules);\r\n }\r\n\r\n private static _tryUpdateSourceMapFilename(configuration: Webpack.Configuration): void {\r\n if (!configuration.output) {\r\n configuration.output = {}; // This should never happen\r\n }\r\n\r\n if (configuration.output.sourceMapFilename !== undefined) {\r\n configuration.output.sourceMapFilename = configuration.output.sourceMapFilename.replace(\r\n FILE_TOKEN_REGEX,\r\n Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN\r\n );\r\n }\r\n }\r\n}\r\n"]}

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

{"version":3,"file":"webpackInterfaces.d.ts","sourceRoot":"","sources":["../../../src/webpackInterfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,OAAO,CAAC,WAAW,CAAC,KAAK;IACvE,cAAc,CAAC,EAAE;QAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC/C"}
{"version":3,"file":"webpackInterfaces.d.ts","sourceRoot":"","sources":["../src/webpackInterfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,OAAO,CAAC,WAAW,CAAC,KAAK;IACvE,cAAc,CAAC,EAAE;QAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC/C"}

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

{"version":3,"file":"webpackInterfaces.js","sourceRoot":"","sources":["../../../src/webpackInterfaces.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","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 * as webpack from 'webpack';\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocalizedWebpackChunk extends webpack.compilation.Chunk {\r\n localizedFiles?: { [locale: string]: string };\r\n}\r\n"]}
{"version":3,"file":"webpackInterfaces.js","sourceRoot":"","sources":["../src/webpackInterfaces.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","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 * as webpack from 'webpack';\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface ILocalizedWebpackChunk extends webpack.compilation.Chunk {\r\n localizedFiles?: { [locale: string]: string };\r\n}\r\n"]}
{
"name": "@rushstack/localization-plugin",
"version": "0.6.10",
"version": "0.6.11",
"description": "This plugin facilitates localization with Webpack.",

@@ -12,7 +12,4 @@ "main": "lib/index.js",

},
"scripts": {
"build": "heft build --clean"
},
"peerDependencies": {
"@rushstack/set-webpack-public-path-plugin": "^3.2.30",
"@rushstack/set-webpack-public-path-plugin": "^3.2.31",
"@types/webpack": "^4.39.0",

@@ -42,5 +39,5 @@ "webpack": "^4.31.0"

"@rushstack/eslint-config": "2.3.4",
"@rushstack/heft": "0.30.2",
"@rushstack/heft-node-rig": "1.0.18",
"@rushstack/set-webpack-public-path-plugin": "3.2.30",
"@rushstack/heft": "0.30.3",
"@rushstack/heft-node-rig": "1.0.19",
"@rushstack/set-webpack-public-path-plugin": "3.2.31",
"@types/loader-utils": "1.1.3",

@@ -51,3 +48,6 @@ "@types/lodash": "4.14.116",

"webpack": "~4.44.2"
},
"scripts": {
"build": "heft build --clean"
}
}

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