@rushstack/webpack4-localization-plugin 0.18.3 → 0.18.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.37.0"
8
+ "packageVersion": "7.37.1"
9
9
  }
10
10
  ]
11
11
  }
@@ -1,6 +1,6 @@
1
- import { IgnoreStringFunction } from '@rushstack/localization-utilities';
1
+ import type { IgnoreStringFunction } from '@rushstack/localization-utilities';
2
2
  import { ILocalizationFile } from '@rushstack/localization-utilities';
3
- import { IPseudolocaleOptions } from '@rushstack/localization-utilities';
3
+ import type { IPseudolocaleOptions } from '@rushstack/localization-utilities';
4
4
  import { ITerminal } from '@rushstack/node-core-library';
5
5
  import * as Webpack from 'webpack';
6
6
 
@@ -1,5 +1,5 @@
1
- import * as Webpack from 'webpack';
2
- import { LocalizationPlugin } from './LocalizationPlugin';
1
+ import type * as Webpack from 'webpack';
2
+ import type { LocalizationPlugin } from './LocalizationPlugin';
3
3
  export interface IProcessAssetOptionsBase {
4
4
  plugin: LocalizationPlugin;
5
5
  compilation: Webpack.compilation.Compilation;
@@ -1 +1 @@
1
- {"version":3,"file":"AssetProcessor.d.ts","sourceRoot":"","sources":["../src/AssetProcessor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAInC,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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poration. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as Webpack from 'webpack';\n\nimport { Constants } from './utilities/Constants';\nimport { ILocaleElementMap } from './interfaces';\nimport { LocalizationPlugin, IStringSerialNumberData as IStringData } from './LocalizationPlugin';\n\ninterface IReconstructionElement {\n kind: 'static' | 'localized' | 'dynamic';\n}\n\ninterface IStaticReconstructionElement extends IReconstructionElement {\n kind: 'static';\n staticString: string;\n}\n\ninterface ILocalizedReconstructionElement extends IReconstructionElement {\n kind: 'localized';\n values: ILocaleElementMap;\n size: number;\n stringName: string;\n escapedBackslash: string;\n locFilePath: string;\n}\n\ninterface IDynamicReconstructionElement extends IReconstructionElement {\n kind: 'dynamic';\n valueFn: (locale: string, token: string | undefined) => string;\n size: number;\n escapedBackslash: string;\n token?: string;\n}\n\ninterface IParseResult {\n issues: string[];\n reconstructionSeries: IReconstructionElement[];\n}\n\ninterface IReconstructedString {\n source: string;\n size: number;\n}\n\ninterface ILocalizedReconstructionResult {\n result: Map<string, IReconstructedString>;\n issues: string[];\n}\n\ninterface INonLocalizedReconstructionResult {\n result: IReconstructedString;\n issues: string[];\n}\n\nexport interface IProcessAssetOptionsBase {\n plugin: LocalizationPlugin;\n compilation: Webpack.compilation.Compilation;\n assetName: string;\n asset: IAsset;\n chunk: Webpack.compilation.Chunk;\n noStringsLocaleName: string;\n chunkHasLocalizedModules: (chunk: Webpack.compilation.Chunk) => boolean;\n}\n\nexport interface IProcessNonLocalizedAssetOptions extends IProcessAssetOptionsBase {}\n\nexport interface IProcessLocalizedAssetOptions extends IProcessAssetOptionsBase {\n locales: Set<string>;\n fillMissingTranslationStrings: boolean;\n defaultLocale: string;\n}\n\nexport interface IAsset {\n size(): number;\n source(): string;\n}\n\nexport interface IProcessAssetResult {\n filename: string;\n asset: IAsset;\n}\n\nexport const PLACEHOLDER_REGEX: RegExp = new RegExp(\n `${Constants.STRING_PLACEHOLDER_PREFIX}_(\\\\\\\\*)_([A-C])(\\\\+[^+]+\\\\+)?_(\\\\d+)`,\n 'g'\n);\n\nexport class AssetProcessor {\n public static processLocalizedAsset(\n options: IProcessLocalizedAssetOptions\n ): Map<string, IProcessAssetResult> {\n const assetSource: string = options.asset.source();\n\n const parsedAsset: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\n options.plugin,\n assetSource,\n this._getJsonpFunction(options.chunk, options.chunkHasLocalizedModules, options.noStringsLocaleName)\n );\n const reconstructedAsset: ILocalizedReconstructionResult = AssetProcessor._reconstructLocalized(\n parsedAsset.reconstructionSeries,\n options.locales,\n options.fillMissingTranslationStrings,\n options.defaultLocale,\n options.asset.size()\n );\n\n const parsedAssetName: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\n options.plugin,\n options.assetName,\n () => {\n throw new Error('unsupported');\n }\n );\n const reconstructedAssetName: ILocalizedReconstructionResult = AssetProcessor._reconstructLocalized(\n parsedAssetName.reconstructionSeries,\n options.locales,\n options.fillMissingTranslationStrings,\n options.defaultLocale,\n options.assetName.length\n );\n\n const result: Map<string, IProcessAssetResult> = new Map<string, IProcessAssetResult>();\n for (const [locale, { source, size }] of reconstructedAsset.result) {\n const newAsset: IAsset = { ...options.asset };\n newAsset.source = () => source;\n newAsset.size = () => size;\n\n result.set(locale, {\n filename: reconstructedAssetName.result.get(locale)!.source,\n asset: newAsset\n });\n }\n\n const issues: string[] = [\n ...parsedAsset.issues,\n ...reconstructedAsset.issues,\n ...parsedAssetName.issues,\n ...reconstructedAssetName.issues\n ];\n\n if (issues.length > 0) {\n options.compilation.errors.push(\n Error(`localization:\\n${issues.map((issue) => ` ${issue}`).join('\\n')}`)\n );\n }\n\n return result;\n }\n\n public static processNonLocalizedAsset(options: IProcessNonLocalizedAssetOptions): IProcessAssetResult {\n const assetSource: string = options.asset.source();\n\n const parsedAsset: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\n options.plugin,\n assetSource,\n this._getJsonpFunction(options.chunk, options.chunkHasLocalizedModules, options.noStringsLocaleName)\n );\n const reconstructedAsset: INonLocalizedReconstructionResult = AssetProcessor._reconstructNonLocalized(\n parsedAsset.reconstructionSeries,\n options.asset.size(),\n options.noStringsLocaleName\n );\n\n const parsedAssetName: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\n options.plugin,\n options.assetName,\n () => {\n throw new Error('unsupported');\n }\n );\n const reconstructedAssetName: INonLocalizedReconstructionResult = AssetProcessor._reconstructNonLocalized(\n parsedAssetName.reconstructionSeries,\n options.assetName.length,\n options.noStringsLocaleName\n );\n\n const issues: string[] = [\n ...parsedAsset.issues,\n ...reconstructedAsset.issues,\n ...parsedAssetName.issues,\n ...reconstructedAssetName.issues\n ];\n\n if (issues.length > 0) {\n options.compilation.errors.push(\n Error(`localization:\\n${issues.map((issue) => ` ${issue}`).join('\\n')}`)\n );\n }\n\n const newAsset: IAsset = { ...options.asset };\n newAsset.source = () => reconstructedAsset.result.source;\n newAsset.size = () => reconstructedAsset.result.size;\n return {\n filename: reconstructedAssetName.result.source,\n asset: newAsset\n };\n }\n\n private static _reconstructLocalized(\n reconstructionSeries: IReconstructionElement[],\n locales: Set<string>,\n fillMissingTranslationStrings: boolean,\n defaultLocale: string,\n initialSize: number\n ): ILocalizedReconstructionResult {\n const localizedResults: Map<string, IReconstructedString> = new Map<string, IReconstructedString>();\n const issues: string[] = [];\n\n for (const locale of locales) {\n const reconstruction: string[] = [];\n\n let sizeDiff: number = 0;\n for (const element of reconstructionSeries) {\n switch (element.kind) {\n case 'static': {\n reconstruction.push((element as IStaticReconstructionElement).staticString);\n break;\n }\n\n case 'localized': {\n const localizedElement: ILocalizedReconstructionElement =\n element as ILocalizedReconstructionElement;\n let newValue: string | undefined = localizedElement.values[locale];\n if (!newValue) {\n if (fillMissingTranslationStrings) {\n newValue = localizedElement.values[defaultLocale];\n } else {\n issues.push(\n `The string \"${localizedElement.stringName}\" in \"${localizedElement.locFilePath}\" is missing in ` +\n `the locale ${locale}`\n );\n\n newValue = '-- MISSING STRING --';\n }\n }\n\n const escapedBackslash: string = localizedElement.escapedBackslash || '\\\\';\n\n // Replace backslashes with the properly escaped backslash\n newValue = newValue.replace(/\\\\/g, escapedBackslash);\n\n // @todo: look into using JSON.parse(...) to get the escaping characters\n const escapingCharacterSequence: string = escapedBackslash.substr(escapedBackslash.length / 2);\n\n // Ensure the the quotemark, apostrophe, tab, and newline characters are properly escaped\n newValue = newValue.replace(/\\r/g, `${escapingCharacterSequence}r`);\n newValue = newValue.replace(/\\n/g, `${escapingCharacterSequence}n`);\n newValue = newValue.replace(/\\t/g, `${escapingCharacterSequence}t`);\n newValue = newValue.replace(/\\\"/g, `${escapingCharacterSequence}u0022`);\n newValue = newValue.replace(/\\'/g, `${escapingCharacterSequence}u0027`);\n\n reconstruction.push(newValue);\n sizeDiff += newValue.length - localizedElement.size;\n break;\n }\n\n case 'dynamic': {\n const dynamicElement: IDynamicReconstructionElement = element as IDynamicReconstructionElement;\n const newValue: string = dynamicElement.valueFn(locale, dynamicElement.token);\n reconstruction.push(newValue);\n sizeDiff += newValue.length - dynamicElement.size;\n break;\n }\n }\n }\n\n const newAssetSource: string = reconstruction.join('');\n localizedResults.set(locale, {\n source: newAssetSource,\n size: initialSize + sizeDiff\n });\n }\n\n return {\n issues,\n result: localizedResults\n };\n }\n\n private static _reconstructNonLocalized(\n reconstructionSeries: IReconstructionElement[],\n initialSize: number,\n noStringsLocaleName: string\n ): INonLocalizedReconstructionResult {\n const issues: string[] = [];\n\n const reconstruction: string[] = [];\n\n let sizeDiff: number = 0;\n for (const element of reconstructionSeries) {\n switch (element.kind) {\n case 'static': {\n reconstruction.push((element as IStaticReconstructionElement).staticString);\n break;\n }\n\n case 'localized': {\n const localizedElement: ILocalizedReconstructionElement =\n element as ILocalizedReconstructionElement;\n issues.push(\n `The string \"${localizedElement.stringName}\" in \"${localizedElement.locFilePath}\" appeared in an asset ` +\n 'that is not expected to contain localized resources.'\n );\n\n const newValue: string = '-- NOT EXPECTED TO BE LOCALIZED --';\n reconstruction.push(newValue);\n sizeDiff += newValue.length - localizedElement.size;\n break;\n }\n\n case 'dynamic': {\n const dynamicElement: IDynamicReconstructionElement = element as IDynamicReconstructionElement;\n const newValue: string = dynamicElement.valueFn(noStringsLocaleName, dynamicElement.token);\n reconstruction.push(newValue);\n sizeDiff += newValue.length - dynamicElement.size;\n break;\n }\n }\n }\n\n const newAssetSource: string = reconstruction.join('');\n return {\n issues,\n result: {\n source: newAssetSource,\n size: initialSize + sizeDiff\n }\n };\n }\n\n private static _parseStringToReconstructionSequence(\n plugin: LocalizationPlugin,\n source: string,\n jsonpFunction: (locale: string, chunkIdToken: string | undefined) => string\n ): IParseResult {\n const issues: string[] = [];\n const reconstructionSeries: IReconstructionElement[] = [];\n\n let lastIndex: number = 0;\n let regexResult: RegExpExecArray | null;\n while ((regexResult = PLACEHOLDER_REGEX.exec(source))) {\n // eslint-disable-line no-cond-assign\n const staticElement: IStaticReconstructionElement = {\n kind: 'static',\n staticString: source.substring(lastIndex, regexResult.index)\n };\n reconstructionSeries.push(staticElement);\n\n const [placeholder, escapedBackslash, elementLabel, token, placeholderSerialNumber] = regexResult;\n\n let localizedReconstructionElement: IReconstructionElement;\n switch (elementLabel) {\n case Constants.STRING_PLACEHOLDER_LABEL: {\n const stringData: IStringData | undefined = plugin.getDataForSerialNumber(placeholderSerialNumber);\n if (!stringData) {\n issues.push(`Missing placeholder ${placeholder}`);\n const brokenLocalizedElement: IStaticReconstructionElement = {\n kind: 'static',\n staticString: placeholder\n };\n localizedReconstructionElement = brokenLocalizedElement;\n } else {\n const localizedElement: ILocalizedReconstructionElement = {\n kind: 'localized',\n values: stringData.values,\n size: placeholder.length,\n locFilePath: stringData.locFilePath,\n escapedBackslash: escapedBackslash,\n stringName: stringData.stringName\n };\n localizedReconstructionElement = localizedElement;\n }\n break;\n }\n\n case Constants.LOCALE_NAME_PLACEHOLDER_LABEL: {\n const dynamicElement: IDynamicReconstructionElement = {\n kind: 'dynamic',\n valueFn: (locale: string) => locale,\n size: placeholder.length,\n escapedBackslash: escapedBackslash\n };\n localizedReconstructionElement = dynamicElement;\n break;\n }\n\n case Constants.JSONP_PLACEHOLDER_LABEL: {\n const dynamicElement: IDynamicReconstructionElement = {\n kind: 'dynamic',\n valueFn: jsonpFunction,\n size: placeholder.length,\n escapedBackslash: escapedBackslash,\n token: token.substring(1, token.length - 1)\n };\n localizedReconstructionElement = dynamicElement;\n break;\n }\n\n default: {\n throw new Error(`Unexpected label ${elementLabel}`);\n }\n }\n\n reconstructionSeries.push(localizedReconstructionElement);\n lastIndex = regexResult.index + placeholder.length;\n }\n\n const lastElement: IStaticReconstructionElement = {\n kind: 'static',\n staticString: source.substr(lastIndex)\n };\n reconstructionSeries.push(lastElement);\n\n return {\n issues,\n reconstructionSeries\n };\n }\n\n private static _getJsonpFunction(\n chunk: Webpack.compilation.Chunk,\n chunkHasLocalizedModules: (chunk: Webpack.compilation.Chunk) => boolean,\n noStringsLocaleName: string\n ): (locale: string, chunkIdToken: string | undefined) => string {\n const idsWithStrings: Set<number | string> = new Set<number | string>();\n const idsWithoutStrings: Set<number | string> = new Set<number | string>();\n\n const asyncChunks: Set<Webpack.compilation.Chunk> = chunk.getAllAsyncChunks();\n for (const asyncChunk of asyncChunks) {\n const chunkId: number | string | null = asyncChunk.id;\n\n if (chunkId === null || chunkId === undefined) {\n throw new Error(`Chunk \"${asyncChunk.name}\"'s ID is null or undefined.`);\n }\n\n if (chunkHasLocalizedModules(asyncChunk)) {\n idsWithStrings.add(chunkId);\n } else {\n idsWithoutStrings.add(chunkId);\n }\n }\n\n if (idsWithStrings.size === 0) {\n return () => JSON.stringify(noStringsLocaleName);\n } else if (idsWithoutStrings.size === 0) {\n return (locale: string) => JSON.stringify(locale);\n } else {\n // Generate an array [<locale>, <nostrings locale>] and an object that is used as an indexer into that\n // object that maps chunk IDs to 0s for chunks with localized strings and 1s for chunks without localized\n // strings\n //\n // This can be improved in the future. We can maybe sort the chunks such that the chunks below a certain ID\n // number are localized and the those above are not.\n const chunkMapping: { [chunkId: string]: number } = {};\n for (const idWithStrings of idsWithStrings) {\n chunkMapping[idWithStrings] = 0;\n }\n\n for (const idWithoutStrings of idsWithoutStrings) {\n chunkMapping[idWithoutStrings] = 1;\n }\n\n return (locale: string, chunkIdToken: string | undefined) => {\n if (!locale) {\n throw new Error('Missing locale name.');\n }\n\n return `(${JSON.stringify([locale, noStringsLocaleName])})[${JSON.stringify(\n chunkMapping\n )}[${chunkIdToken}]]`;\n };\n }\n }\n}\n"]}
1
+ {"version":3,"file":"AssetProcessor.js","sourceRoot":"","sources":["../src/AssetProcessor.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,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;QAC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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;AAlYD,wCAkYC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type * as Webpack from 'webpack';\n\nimport { Constants } from './utilities/Constants';\nimport type { ILocaleElementMap } from './interfaces';\nimport type { LocalizationPlugin, IStringSerialNumberData as IStringData } from './LocalizationPlugin';\n\ninterface IReconstructionElement {\n kind: 'static' | 'localized' | 'dynamic';\n}\n\ninterface IStaticReconstructionElement extends IReconstructionElement {\n kind: 'static';\n staticString: string;\n}\n\ninterface ILocalizedReconstructionElement extends IReconstructionElement {\n kind: 'localized';\n values: ILocaleElementMap;\n size: number;\n stringName: string;\n escapedBackslash: string;\n locFilePath: string;\n}\n\ninterface IDynamicReconstructionElement extends IReconstructionElement {\n kind: 'dynamic';\n valueFn: (locale: string, token: string | undefined) => string;\n size: number;\n escapedBackslash: string;\n token?: string;\n}\n\ninterface IParseResult {\n issues: string[];\n reconstructionSeries: IReconstructionElement[];\n}\n\ninterface IReconstructedString {\n source: string;\n size: number;\n}\n\ninterface ILocalizedReconstructionResult {\n result: Map<string, IReconstructedString>;\n issues: string[];\n}\n\ninterface INonLocalizedReconstructionResult {\n result: IReconstructedString;\n issues: string[];\n}\n\nexport interface IProcessAssetOptionsBase {\n plugin: LocalizationPlugin;\n compilation: Webpack.compilation.Compilation;\n assetName: string;\n asset: IAsset;\n chunk: Webpack.compilation.Chunk;\n noStringsLocaleName: string;\n chunkHasLocalizedModules: (chunk: Webpack.compilation.Chunk) => boolean;\n}\n\nexport interface IProcessNonLocalizedAssetOptions extends IProcessAssetOptionsBase {}\n\nexport interface IProcessLocalizedAssetOptions extends IProcessAssetOptionsBase {\n locales: Set<string>;\n fillMissingTranslationStrings: boolean;\n defaultLocale: string;\n}\n\nexport interface IAsset {\n size(): number;\n source(): string;\n}\n\nexport interface IProcessAssetResult {\n filename: string;\n asset: IAsset;\n}\n\nexport const PLACEHOLDER_REGEX: RegExp = new RegExp(\n `${Constants.STRING_PLACEHOLDER_PREFIX}_(\\\\\\\\*)_([A-C])(\\\\+[^+]+\\\\+)?_(\\\\d+)`,\n 'g'\n);\n\nexport class AssetProcessor {\n public static processLocalizedAsset(\n options: IProcessLocalizedAssetOptions\n ): Map<string, IProcessAssetResult> {\n const assetSource: string = options.asset.source();\n\n const parsedAsset: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\n options.plugin,\n assetSource,\n this._getJsonpFunction(options.chunk, options.chunkHasLocalizedModules, options.noStringsLocaleName)\n );\n const reconstructedAsset: ILocalizedReconstructionResult = AssetProcessor._reconstructLocalized(\n parsedAsset.reconstructionSeries,\n options.locales,\n options.fillMissingTranslationStrings,\n options.defaultLocale,\n options.asset.size()\n );\n\n const parsedAssetName: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\n options.plugin,\n options.assetName,\n () => {\n throw new Error('unsupported');\n }\n );\n const reconstructedAssetName: ILocalizedReconstructionResult = AssetProcessor._reconstructLocalized(\n parsedAssetName.reconstructionSeries,\n options.locales,\n options.fillMissingTranslationStrings,\n options.defaultLocale,\n options.assetName.length\n );\n\n const result: Map<string, IProcessAssetResult> = new Map<string, IProcessAssetResult>();\n for (const [locale, { source, size }] of reconstructedAsset.result) {\n const newAsset: IAsset = { ...options.asset };\n newAsset.source = () => source;\n newAsset.size = () => size;\n\n result.set(locale, {\n filename: reconstructedAssetName.result.get(locale)!.source,\n asset: newAsset\n });\n }\n\n const issues: string[] = [\n ...parsedAsset.issues,\n ...reconstructedAsset.issues,\n ...parsedAssetName.issues,\n ...reconstructedAssetName.issues\n ];\n\n if (issues.length > 0) {\n options.compilation.errors.push(\n Error(`localization:\\n${issues.map((issue) => ` ${issue}`).join('\\n')}`)\n );\n }\n\n return result;\n }\n\n public static processNonLocalizedAsset(options: IProcessNonLocalizedAssetOptions): IProcessAssetResult {\n const assetSource: string = options.asset.source();\n\n const parsedAsset: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\n options.plugin,\n assetSource,\n this._getJsonpFunction(options.chunk, options.chunkHasLocalizedModules, options.noStringsLocaleName)\n );\n const reconstructedAsset: INonLocalizedReconstructionResult = AssetProcessor._reconstructNonLocalized(\n parsedAsset.reconstructionSeries,\n options.asset.size(),\n options.noStringsLocaleName\n );\n\n const parsedAssetName: IParseResult = AssetProcessor._parseStringToReconstructionSequence(\n options.plugin,\n options.assetName,\n () => {\n throw new Error('unsupported');\n }\n );\n const reconstructedAssetName: INonLocalizedReconstructionResult = AssetProcessor._reconstructNonLocalized(\n parsedAssetName.reconstructionSeries,\n options.assetName.length,\n options.noStringsLocaleName\n );\n\n const issues: string[] = [\n ...parsedAsset.issues,\n ...reconstructedAsset.issues,\n ...parsedAssetName.issues,\n ...reconstructedAssetName.issues\n ];\n\n if (issues.length > 0) {\n options.compilation.errors.push(\n Error(`localization:\\n${issues.map((issue) => ` ${issue}`).join('\\n')}`)\n );\n }\n\n const newAsset: IAsset = { ...options.asset };\n newAsset.source = () => reconstructedAsset.result.source;\n newAsset.size = () => reconstructedAsset.result.size;\n return {\n filename: reconstructedAssetName.result.source,\n asset: newAsset\n };\n }\n\n private static _reconstructLocalized(\n reconstructionSeries: IReconstructionElement[],\n locales: Set<string>,\n fillMissingTranslationStrings: boolean,\n defaultLocale: string,\n initialSize: number\n ): ILocalizedReconstructionResult {\n const localizedResults: Map<string, IReconstructedString> = new Map<string, IReconstructedString>();\n const issues: string[] = [];\n\n for (const locale of locales) {\n const reconstruction: string[] = [];\n\n let sizeDiff: number = 0;\n for (const element of reconstructionSeries) {\n switch (element.kind) {\n case 'static': {\n reconstruction.push((element as IStaticReconstructionElement).staticString);\n break;\n }\n\n case 'localized': {\n const localizedElement: ILocalizedReconstructionElement =\n element as ILocalizedReconstructionElement;\n let newValue: string | undefined = localizedElement.values[locale];\n if (!newValue) {\n if (fillMissingTranslationStrings) {\n newValue = localizedElement.values[defaultLocale];\n } else {\n issues.push(\n `The string \"${localizedElement.stringName}\" in \"${localizedElement.locFilePath}\" is missing in ` +\n `the locale ${locale}`\n );\n\n newValue = '-- MISSING STRING --';\n }\n }\n\n const escapedBackslash: string = localizedElement.escapedBackslash || '\\\\';\n\n // Replace backslashes with the properly escaped backslash\n newValue = newValue.replace(/\\\\/g, escapedBackslash);\n\n // @todo: look into using JSON.parse(...) to get the escaping characters\n const escapingCharacterSequence: string = escapedBackslash.substr(escapedBackslash.length / 2);\n\n // Ensure the the quotemark, apostrophe, tab, and newline characters are properly escaped\n newValue = newValue.replace(/\\r/g, `${escapingCharacterSequence}r`);\n newValue = newValue.replace(/\\n/g, `${escapingCharacterSequence}n`);\n newValue = newValue.replace(/\\t/g, `${escapingCharacterSequence}t`);\n newValue = newValue.replace(/\\\"/g, `${escapingCharacterSequence}u0022`);\n newValue = newValue.replace(/\\'/g, `${escapingCharacterSequence}u0027`);\n\n reconstruction.push(newValue);\n sizeDiff += newValue.length - localizedElement.size;\n break;\n }\n\n case 'dynamic': {\n const dynamicElement: IDynamicReconstructionElement = element as IDynamicReconstructionElement;\n const newValue: string = dynamicElement.valueFn(locale, dynamicElement.token);\n reconstruction.push(newValue);\n sizeDiff += newValue.length - dynamicElement.size;\n break;\n }\n }\n }\n\n const newAssetSource: string = reconstruction.join('');\n localizedResults.set(locale, {\n source: newAssetSource,\n size: initialSize + sizeDiff\n });\n }\n\n return {\n issues,\n result: localizedResults\n };\n }\n\n private static _reconstructNonLocalized(\n reconstructionSeries: IReconstructionElement[],\n initialSize: number,\n noStringsLocaleName: string\n ): INonLocalizedReconstructionResult {\n const issues: string[] = [];\n\n const reconstruction: string[] = [];\n\n let sizeDiff: number = 0;\n for (const element of reconstructionSeries) {\n switch (element.kind) {\n case 'static': {\n reconstruction.push((element as IStaticReconstructionElement).staticString);\n break;\n }\n\n case 'localized': {\n const localizedElement: ILocalizedReconstructionElement =\n element as ILocalizedReconstructionElement;\n issues.push(\n `The string \"${localizedElement.stringName}\" in \"${localizedElement.locFilePath}\" appeared in an asset ` +\n 'that is not expected to contain localized resources.'\n );\n\n const newValue: string = '-- NOT EXPECTED TO BE LOCALIZED --';\n reconstruction.push(newValue);\n sizeDiff += newValue.length - localizedElement.size;\n break;\n }\n\n case 'dynamic': {\n const dynamicElement: IDynamicReconstructionElement = element as IDynamicReconstructionElement;\n const newValue: string = dynamicElement.valueFn(noStringsLocaleName, dynamicElement.token);\n reconstruction.push(newValue);\n sizeDiff += newValue.length - dynamicElement.size;\n break;\n }\n }\n }\n\n const newAssetSource: string = reconstruction.join('');\n return {\n issues,\n result: {\n source: newAssetSource,\n size: initialSize + sizeDiff\n }\n };\n }\n\n private static _parseStringToReconstructionSequence(\n plugin: LocalizationPlugin,\n source: string,\n jsonpFunction: (locale: string, chunkIdToken: string | undefined) => string\n ): IParseResult {\n const issues: string[] = [];\n const reconstructionSeries: IReconstructionElement[] = [];\n\n let lastIndex: number = 0;\n let regexResult: RegExpExecArray | null;\n while ((regexResult = PLACEHOLDER_REGEX.exec(source))) {\n // eslint-disable-line no-cond-assign\n const staticElement: IStaticReconstructionElement = {\n kind: 'static',\n staticString: source.substring(lastIndex, regexResult.index)\n };\n reconstructionSeries.push(staticElement);\n\n const [placeholder, escapedBackslash, elementLabel, token, placeholderSerialNumber] = regexResult;\n\n let localizedReconstructionElement: IReconstructionElement;\n switch (elementLabel) {\n case Constants.STRING_PLACEHOLDER_LABEL: {\n const stringData: IStringData | undefined = plugin.getDataForSerialNumber(placeholderSerialNumber);\n if (!stringData) {\n issues.push(`Missing placeholder ${placeholder}`);\n const brokenLocalizedElement: IStaticReconstructionElement = {\n kind: 'static',\n staticString: placeholder\n };\n localizedReconstructionElement = brokenLocalizedElement;\n } else {\n const localizedElement: ILocalizedReconstructionElement = {\n kind: 'localized',\n values: stringData.values,\n size: placeholder.length,\n locFilePath: stringData.locFilePath,\n escapedBackslash: escapedBackslash,\n stringName: stringData.stringName\n };\n localizedReconstructionElement = localizedElement;\n }\n break;\n }\n\n case Constants.LOCALE_NAME_PLACEHOLDER_LABEL: {\n const dynamicElement: IDynamicReconstructionElement = {\n kind: 'dynamic',\n valueFn: (locale: string) => locale,\n size: placeholder.length,\n escapedBackslash: escapedBackslash\n };\n localizedReconstructionElement = dynamicElement;\n break;\n }\n\n case Constants.JSONP_PLACEHOLDER_LABEL: {\n const dynamicElement: IDynamicReconstructionElement = {\n kind: 'dynamic',\n valueFn: jsonpFunction,\n size: placeholder.length,\n escapedBackslash: escapedBackslash,\n token: token.substring(1, token.length - 1)\n };\n localizedReconstructionElement = dynamicElement;\n break;\n }\n\n default: {\n throw new Error(`Unexpected label ${elementLabel}`);\n }\n }\n\n reconstructionSeries.push(localizedReconstructionElement);\n lastIndex = regexResult.index + placeholder.length;\n }\n\n const lastElement: IStaticReconstructionElement = {\n kind: 'static',\n staticString: source.substr(lastIndex)\n };\n reconstructionSeries.push(lastElement);\n\n return {\n issues,\n reconstructionSeries\n };\n }\n\n private static _getJsonpFunction(\n chunk: Webpack.compilation.Chunk,\n chunkHasLocalizedModules: (chunk: Webpack.compilation.Chunk) => boolean,\n noStringsLocaleName: string\n ): (locale: string, chunkIdToken: string | undefined) => string {\n const idsWithStrings: Set<number | string> = new Set<number | string>();\n const idsWithoutStrings: Set<number | string> = new Set<number | string>();\n\n const asyncChunks: Set<Webpack.compilation.Chunk> = chunk.getAllAsyncChunks();\n for (const asyncChunk of asyncChunks) {\n const chunkId: number | string | null = asyncChunk.id;\n\n if (chunkId === null || chunkId === undefined) {\n throw new Error(`Chunk \"${asyncChunk.name}\"'s ID is null or undefined.`);\n }\n\n if (chunkHasLocalizedModules(asyncChunk)) {\n idsWithStrings.add(chunkId);\n } else {\n idsWithoutStrings.add(chunkId);\n }\n }\n\n if (idsWithStrings.size === 0) {\n return () => JSON.stringify(noStringsLocaleName);\n } else if (idsWithoutStrings.size === 0) {\n return (locale: string) => JSON.stringify(locale);\n } else {\n // Generate an array [<locale>, <nostrings locale>] and an object that is used as an indexer into that\n // object that maps chunk IDs to 0s for chunks with localized strings and 1s for chunks without localized\n // strings\n //\n // This can be improved in the future. We can maybe sort the chunks such that the chunks below a certain ID\n // number are localized and the those above are not.\n const chunkMapping: { [chunkId: string]: number } = {};\n for (const idWithStrings of idsWithStrings) {\n chunkMapping[idWithStrings] = 0;\n }\n\n for (const idWithoutStrings of idsWithoutStrings) {\n chunkMapping[idWithoutStrings] = 1;\n }\n\n return (locale: string, chunkIdToken: string | undefined) => {\n if (!locale) {\n throw new Error('Missing locale name.');\n }\n\n return `(${JSON.stringify([locale, noStringsLocaleName])})[${JSON.stringify(\n chunkMapping\n )}[${chunkIdToken}]]`;\n };\n }\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { ITerminal } from '@rushstack/node-core-library';
1
+ import { type ITerminal } from '@rushstack/node-core-library';
2
2
  import * as Webpack from 'webpack';
3
- import { ILocalizationFile } from '@rushstack/localization-utilities';
4
- import { ILocalizationPluginOptions, ILocaleElementMap } from './interfaces';
3
+ import { type ILocalizationFile } from '@rushstack/localization-utilities';
4
+ import type { ILocalizationPluginOptions, ILocaleElementMap } from './interfaces';
5
5
  /**
6
6
  * @internal
7
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"LocalizationPlugin.d.ts","sourceRoot":"","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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;AAxwBD,gDAwwBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { JsonFile, FileSystem, ITerminal, NewlineKind } from '@rushstack/node-core-library';\nimport * as Webpack from 'webpack';\nimport * as path from 'path';\nimport * as Tapable from 'tapable';\nimport {\n getPseudolocalizer,\n ILocalizationFile,\n parseLocFile,\n TypingsGenerator\n} from '@rushstack/localization-utilities';\n\nimport { Constants } from './utilities/Constants';\nimport {\n IWebpackConfigurationUpdaterOptions,\n WebpackConfigurationUpdater\n} from './WebpackConfigurationUpdater';\nimport {\n ILocalizationPluginOptions,\n ILocalizationStats,\n ILocaleFileData,\n ILocaleElementMap,\n ILocalizedStrings,\n IResolvedMissingTranslations\n} from './interfaces';\nimport { ILocalizedWebpackChunk } from './webpackInterfaces';\nimport { EntityMarker } from './utilities/EntityMarker';\nimport { IAsset, IProcessAssetResult, AssetProcessor, PLACEHOLDER_REGEX } from './AssetProcessor';\n\n/**\n * @internal\n */\nexport interface IStringPlaceholder {\n value: string;\n suffix: string;\n}\n\n/**\n * @internal\n */\nexport interface IAddDefaultLocFileResult {\n /**\n * A list of paths to translation files that were loaded\n */\n additionalLoadedFilePaths: string[];\n\n errors: Error[];\n}\n\ninterface IExtendedMainTemplate {\n hooks: {\n assetPath: Tapable.SyncHook<string, IAssetPathOptions>;\n };\n}\n\ninterface IExtendedConfiguration extends Webpack.compilation.Compilation {\n options: Webpack.Configuration;\n}\n\ninterface IExtendedChunkGroup extends Webpack.compilation.ChunkGroup {\n getChildren(): Webpack.compilation.Chunk[];\n}\n\ninterface IExtendedChunk extends Webpack.compilation.Chunk {\n filenameTemplate: string;\n}\n\ninterface IAssetPathOptions {\n chunk: Webpack.compilation.Chunk;\n contentHashType: string;\n filename: string;\n}\n\n/**\n * @internal\n */\nexport interface IStringSerialNumberData {\n values: ILocaleElementMap;\n locFilePath: string;\n stringName: string;\n}\n\nconst PLUGIN_NAME: string = 'localization';\n\n/**\n * This plugin facilitates localization in webpack.\n *\n * @public\n */\nexport class LocalizationPlugin implements Webpack.Plugin {\n /**\n * @internal\n */\n public stringKeys: Map<string, IStringPlaceholder> = new Map<string, IStringPlaceholder>();\n\n private _options: ILocalizationPluginOptions;\n private _resolvedTranslatedStringsFromOptions!: ILocalizedStrings;\n private _globsToIgnore: string[] | undefined;\n private _stringPlaceholderCounter: number = 0;\n private _stringPlaceholderMap: Map<string, IStringSerialNumberData> = new Map<\n string,\n IStringSerialNumberData\n >();\n private _locales: Set<string> = new Set<string>();\n private _passthroughLocaleName!: string;\n private _defaultLocale!: string;\n private _noStringsLocaleName!: string;\n private _fillMissingTranslationStrings!: boolean;\n private _pseudolocalizers: Map<string, (str: string) => string> = new Map<\n string,\n (str: string) => string\n >();\n private _resxNewlineNormalization: NewlineKind | undefined;\n private _ignoreMissingResxComments: boolean | undefined;\n\n /**\n * The outermost map's keys are the locale names.\n * The middle map's keys are the resolved, file names.\n * The innermost map's keys are the string identifiers and its values are the string values.\n */\n private _resolvedLocalizedStrings: Map<string, Map<string, Map<string, string>>> = new Map<\n string,\n Map<string, Map<string, string>>\n >();\n\n public constructor(options: ILocalizationPluginOptions) {\n if (options.filesToIgnore) {\n throw new Error('The filesToIgnore option is no longer supported. Please use globsToIgnore instead.');\n }\n\n if (options.typingsOptions?.ignoreString) {\n throw new Error(\n 'The typingsOptions.ignoreString option is no longer supported. Please use the ignoreString ' +\n 'option directly on the constructor options object instead.'\n );\n }\n\n this._options = options;\n }\n\n public apply(compiler: Webpack.Compiler): void {\n const isWebpack4: boolean = !!compiler.hooks;\n\n if (!isWebpack4) {\n throw new Error(`The ${LocalizationPlugin.name} plugin requires Webpack 4`);\n }\n\n if (this._options.typingsOptions && compiler.context) {\n if (\n this._options.typingsOptions.generatedTsFolder &&\n !path.isAbsolute(this._options.typingsOptions.generatedTsFolder)\n ) {\n this._options.typingsOptions.generatedTsFolder = path.resolve(\n compiler.context,\n this._options.typingsOptions.generatedTsFolder\n );\n }\n\n if (\n this._options.typingsOptions.sourceRoot &&\n !path.isAbsolute(this._options.typingsOptions.sourceRoot)\n ) {\n this._options.typingsOptions.sourceRoot = path.resolve(\n compiler.context,\n this._options.typingsOptions.sourceRoot\n );\n }\n\n const secondaryGeneratedTsFolders: string[] | undefined =\n this._options.typingsOptions.secondaryGeneratedTsFolders;\n if (secondaryGeneratedTsFolders) {\n for (let i: number = 0; i < secondaryGeneratedTsFolders.length; i++) {\n const secondaryGeneratedTsFolder: string = secondaryGeneratedTsFolders[i];\n if (!path.isAbsolute(secondaryGeneratedTsFolder)) {\n secondaryGeneratedTsFolders[i] = path.resolve(compiler.context, secondaryGeneratedTsFolder);\n }\n }\n }\n }\n\n // https://github.com/webpack/webpack-dev-server/pull/1929/files#diff-15fb51940da53816af13330d8ce69b4eR66\n const isWebpackDevServer: boolean = process.env.WEBPACK_DEV_SERVER === 'true';\n\n const { errors, warnings } = this._initializeAndValidateOptions(compiler.options, isWebpackDevServer);\n\n let typingsPreprocessor: TypingsGenerator | undefined;\n if (this._options.typingsOptions) {\n typingsPreprocessor = new TypingsGenerator({\n srcFolder: this._options.typingsOptions.sourceRoot || compiler.context,\n generatedTsFolder: this._options.typingsOptions.generatedTsFolder,\n secondaryGeneratedTsFolders: this._options.typingsOptions.secondaryGeneratedTsFolders,\n exportAsDefault: this._options.typingsOptions.exportAsDefault,\n globsToIgnore: this._options.globsToIgnore,\n ignoreString: this._options.ignoreString,\n processComment: this._options.typingsOptions.processComment\n });\n } else {\n typingsPreprocessor = undefined;\n }\n\n const webpackConfigurationUpdaterOptions: IWebpackConfigurationUpdaterOptions = {\n pluginInstance: this,\n configuration: compiler.options,\n globsToIgnore: this._globsToIgnore,\n localeNameOrPlaceholder: Constants.LOCALE_NAME_PLACEHOLDER,\n resxNewlineNormalization: this._resxNewlineNormalization,\n ignoreMissingResxComments: this._ignoreMissingResxComments,\n ignoreString: this._options.ignoreString\n };\n\n if (errors.length > 0 || warnings.length > 0) {\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation: Webpack.compilation.Compilation) => {\n compilation.errors.push(...errors);\n compilation.warnings.push(...warnings);\n });\n\n if (errors.length > 0) {\n // If there are any errors, just pass through the resources in source and don't do any\n // additional configuration\n WebpackConfigurationUpdater.amendWebpackConfigurationForInPlaceLocFiles(\n webpackConfigurationUpdaterOptions\n );\n return;\n }\n }\n\n if (isWebpackDevServer) {\n if (typingsPreprocessor) {\n compiler.hooks.afterEnvironment.tap(PLUGIN_NAME, () => typingsPreprocessor!.runWatcherAsync());\n\n if (!compiler.options.plugins) {\n compiler.options.plugins = [];\n }\n\n compiler.options.plugins.push(\n new Webpack.WatchIgnorePlugin([this._options.typingsOptions!.generatedTsFolder])\n );\n }\n\n WebpackConfigurationUpdater.amendWebpackConfigurationForInPlaceLocFiles(\n webpackConfigurationUpdaterOptions\n );\n } else {\n if (typingsPreprocessor) {\n compiler.hooks.beforeRun.tapPromise(\n PLUGIN_NAME,\n async () => await typingsPreprocessor!.generateTypingsAsync()\n );\n }\n\n WebpackConfigurationUpdater.amendWebpackConfigurationForMultiLocale(webpackConfigurationUpdaterOptions);\n\n if (errors.length === 0) {\n compiler.hooks.thisCompilation.tap(\n PLUGIN_NAME,\n (untypedCompilation: Webpack.compilation.Compilation) => {\n const compilation: IExtendedConfiguration = untypedCompilation as IExtendedConfiguration;\n (compilation.mainTemplate as unknown as IExtendedMainTemplate).hooks.assetPath.tap(\n PLUGIN_NAME,\n (assetPath: string, options: IAssetPathOptions) => {\n if (\n options.contentHashType === 'javascript' &&\n assetPath.match(Constants.LOCALE_FILENAME_TOKEN_REGEX)\n ) {\n // Does this look like an async chunk URL generator?\n if (typeof options.chunk.id === 'string' && (options.chunk.id as string).match(/^\\\" \\+/)) {\n return assetPath.replace(\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\n `\" + ${Constants.JSONP_PLACEHOLDER} + \"`\n );\n } else {\n return assetPath.replace(\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\n Constants.LOCALE_NAME_PLACEHOLDER\n );\n }\n } else if (assetPath.match(Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX)) {\n // Replace the placeholder with the [locale] token for sourcemaps\n const deLocalizedFilename: string = options.filename.replace(\n PLACEHOLDER_REGEX,\n Constants.LOCALE_FILENAME_TOKEN\n );\n return assetPath.replace(\n Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX,\n deLocalizedFilename\n );\n } else {\n return assetPath;\n }\n }\n );\n\n compilation.hooks.optimizeChunks.tap(\n PLUGIN_NAME,\n (\n untypedChunks: Webpack.compilation.Chunk[],\n untypedChunkGroups: Webpack.compilation.ChunkGroup[]\n ) => {\n const chunks: IExtendedChunk[] = untypedChunks as IExtendedChunk[];\n const chunkGroups: IExtendedChunkGroup[] = untypedChunkGroups as IExtendedChunkGroup[];\n\n let chunksHaveAnyChildren: boolean = false;\n for (const chunkGroup of chunkGroups) {\n const children: Webpack.compilation.Chunk[] = chunkGroup.getChildren();\n if (children.length > 0) {\n chunksHaveAnyChildren = true;\n break;\n }\n }\n\n if (\n chunksHaveAnyChildren &&\n (!compilation.options.output ||\n !compilation.options.output.chunkFilename ||\n compilation.options.output.chunkFilename.indexOf(Constants.LOCALE_FILENAME_TOKEN) === -1)\n ) {\n compilation.errors.push(\n new Error(\n 'The configuration.output.chunkFilename property must be provided and must include ' +\n `the ${Constants.LOCALE_FILENAME_TOKEN} placeholder`\n )\n );\n\n return;\n }\n\n for (const chunk of chunks) {\n // See if the chunk contains any localized modules or loads any localized chunks\n const localizedChunk: boolean = this._chunkHasLocalizedModules(chunk);\n\n // Change the chunk's name to include either the locale name or the locale name for chunks without strings\n const replacementValue: string = localizedChunk\n ? Constants.LOCALE_NAME_PLACEHOLDER\n : this._noStringsLocaleName;\n if (chunk.hasRuntime()) {\n chunk.filenameTemplate = (compilation.options.output!.filename as string).replace(\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\n replacementValue\n );\n } else {\n chunk.filenameTemplate = compilation.options.output!.chunkFilename!.replace(\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\n replacementValue\n );\n }\n }\n }\n );\n }\n );\n\n compiler.hooks.emit.tap(PLUGIN_NAME, (compilation: Webpack.compilation.Compilation) => {\n const localizationStats: ILocalizationStats = {\n entrypoints: {},\n namedChunkGroups: {}\n };\n\n const alreadyProcessedAssets: Set<string> = new Set<string>();\n const hotUpdateRegex: RegExp = /\\.hot-update\\.js$/;\n\n for (const untypedChunk of compilation.chunks) {\n const chunk: ILocalizedWebpackChunk = untypedChunk;\n const chunkFilesSet: Set<string> = new Set(chunk.files);\n function processChunkJsFile(callback: (chunkFilename: string) => void): void {\n let alreadyProcessedAFileInThisChunk: boolean = false;\n for (const chunkFilename of chunk.files) {\n if (\n chunkFilename.endsWith('.js') && // Ensure this is a JS file\n !hotUpdateRegex.test(chunkFilename) && // Ensure this is not a webpack hot update\n !alreadyProcessedAssets.has(chunkFilename) // Ensure this isn't a vendor chunk we've already processed\n ) {\n if (alreadyProcessedAFileInThisChunk) {\n throw new Error(\n `Found more than one JS file in chunk \"${chunk.name}\". This is not expected.`\n );\n }\n\n alreadyProcessedAFileInThisChunk = true;\n alreadyProcessedAssets.add(chunkFilename);\n callback(chunkFilename);\n }\n }\n }\n\n if (this._chunkHasLocalizedModules(chunk)) {\n processChunkJsFile((chunkFilename) => {\n if (chunkFilename.indexOf(Constants.LOCALE_NAME_PLACEHOLDER) === -1) {\n throw new Error(\n `Asset ${chunkFilename} is expected to be localized, but is missing a locale placeholder`\n );\n }\n\n const asset: IAsset = compilation.assets[chunkFilename];\n\n const resultingAssets: Map<string, IProcessAssetResult> =\n AssetProcessor.processLocalizedAsset({\n plugin: this,\n compilation,\n assetName: chunkFilename,\n asset,\n chunk,\n chunkHasLocalizedModules: this._chunkHasLocalizedModules.bind(this),\n locales: this._locales,\n noStringsLocaleName: this._noStringsLocaleName,\n fillMissingTranslationStrings: this._fillMissingTranslationStrings,\n defaultLocale: this._defaultLocale\n });\n\n // Delete the existing asset because it's been renamed\n delete compilation.assets[chunkFilename];\n chunkFilesSet.delete(chunkFilename);\n\n const localizedChunkAssets: ILocaleElementMap = {};\n for (const [locale, newAsset] of resultingAssets) {\n compilation.assets[newAsset.filename] = newAsset.asset;\n localizedChunkAssets[locale] = newAsset.filename;\n chunkFilesSet.add(newAsset.filename);\n }\n\n if (chunk.hasRuntime()) {\n // This is an entrypoint\n localizationStats.entrypoints[chunk.name] = {\n localizedAssets: localizedChunkAssets\n };\n } else {\n // This is a secondary chunk\n if (chunk.name) {\n localizationStats.namedChunkGroups[chunk.name] = {\n localizedAssets: localizedChunkAssets\n };\n }\n }\n\n chunk.localizedFiles = localizedChunkAssets;\n });\n } else {\n processChunkJsFile((chunkFilename) => {\n const asset: IAsset = compilation.assets[chunkFilename];\n\n const resultingAsset: IProcessAssetResult = AssetProcessor.processNonLocalizedAsset({\n plugin: this,\n compilation,\n assetName: chunkFilename,\n asset,\n chunk,\n noStringsLocaleName: this._noStringsLocaleName,\n chunkHasLocalizedModules: this._chunkHasLocalizedModules.bind(this)\n });\n\n // Delete the existing asset because it's been renamed\n delete compilation.assets[chunkFilename];\n chunkFilesSet.delete(chunkFilename);\n\n compilation.assets[resultingAsset.filename] = resultingAsset.asset;\n chunkFilesSet.add(resultingAsset.filename);\n });\n }\n\n chunk.files = Array.from(chunkFilesSet);\n }\n\n if (this._options.localizationStats) {\n if (this._options.localizationStats.dropPath) {\n const resolvedLocalizationStatsDropPath: string = path.resolve(\n compiler.outputPath,\n this._options.localizationStats.dropPath\n );\n JsonFile.save(localizationStats, resolvedLocalizationStatsDropPath, {\n ensureFolderExists: true\n });\n }\n\n if (this._options.localizationStats.callback) {\n try {\n this._options.localizationStats.callback(localizationStats);\n } catch (e) {\n /* swallow errors from the callback */\n }\n }\n }\n });\n }\n }\n }\n\n /**\n * @internal\n *\n * @returns\n */\n public addDefaultLocFile(\n terminal: ITerminal,\n localizedResourcePath: string,\n localizedResourceData: ILocalizationFile\n ): IAddDefaultLocFileResult {\n const additionalLoadedFilePaths: string[] = [];\n const errors: Error[] = [];\n\n const locFileData: ILocaleFileData = this._convertLocalizationFileToLocData(localizedResourceData);\n this._addLocFile(this._defaultLocale, localizedResourcePath, locFileData);\n\n const normalizeLocalizedData: (localizedData: ILocaleFileData | string) => ILocaleFileData = (\n localizedData\n ) => {\n if (typeof localizedData === 'string') {\n additionalLoadedFilePaths.push(localizedData);\n const localizationFile: ILocalizationFile = parseLocFile({\n filePath: localizedData,\n content: FileSystem.readFile(localizedData),\n terminal: terminal,\n resxNewlineNormalization: this._resxNewlineNormalization,\n ignoreMissingResxComments: this._ignoreMissingResxComments\n });\n\n return this._convertLocalizationFileToLocData(localizationFile);\n } else {\n return localizedData;\n }\n };\n\n const missingLocales: string[] = [];\n for (const [translatedLocaleName, translatedStrings] of Object.entries(\n this._resolvedTranslatedStringsFromOptions\n )) {\n const translatedLocFileFromOptions: ILocaleFileData | string | undefined =\n translatedStrings[localizedResourcePath];\n if (!translatedLocFileFromOptions) {\n missingLocales.push(translatedLocaleName);\n } else {\n const translatedLocFileData: ILocaleFileData = normalizeLocalizedData(translatedLocFileFromOptions);\n this._addLocFile(translatedLocaleName, localizedResourcePath, translatedLocFileData);\n }\n }\n\n if (missingLocales.length > 0 && this._options.localizedData.resolveMissingTranslatedStrings) {\n let resolvedTranslatedData: IResolvedMissingTranslations | undefined = undefined;\n try {\n resolvedTranslatedData = this._options.localizedData.resolveMissingTranslatedStrings(\n missingLocales,\n localizedResourcePath\n );\n } catch (e) {\n errors.push(e as Error);\n }\n\n if (resolvedTranslatedData) {\n for (const [resolvedLocaleName, resolvedLocaleData] of Object.entries(resolvedTranslatedData)) {\n if (resolvedLocaleData) {\n const translatedLocFileData: ILocaleFileData = normalizeLocalizedData(resolvedLocaleData);\n this._addLocFile(resolvedLocaleName, localizedResourcePath, translatedLocFileData);\n }\n }\n }\n }\n\n this._pseudolocalizers.forEach((pseudolocalizer: (str: string) => string, pseudolocaleName: string) => {\n const pseudolocFileData: ILocaleFileData = {};\n\n for (const [stringName, stringValue] of Object.entries(locFileData)) {\n pseudolocFileData[stringName] = pseudolocalizer(stringValue);\n }\n\n this._addLocFile(pseudolocaleName, localizedResourcePath, pseudolocFileData);\n });\n\n return { additionalLoadedFilePaths, errors };\n }\n\n /**\n * @internal\n */\n public getDataForSerialNumber(serialNumber: string): IStringSerialNumberData | undefined {\n return this._stringPlaceholderMap.get(serialNumber);\n }\n\n private _addLocFile(\n localeName: string,\n localizedFilePath: string,\n localizedFileData: ILocaleFileData\n ): void {\n const filesMap: Map<string, Map<string, string>> = this._resolvedLocalizedStrings.get(localeName)!;\n\n const stringsMap: Map<string, string> = new Map<string, string>();\n filesMap.set(localizedFilePath, stringsMap);\n\n for (const [stringName, stringValue] of Object.entries(localizedFileData)) {\n const stringKey: string = `${localizedFilePath}?${stringName}`;\n if (!this.stringKeys.has(stringKey)) {\n const placeholder: IStringPlaceholder = this._getPlaceholderString();\n this.stringKeys.set(stringKey, placeholder);\n }\n\n const placeholder: IStringPlaceholder = this.stringKeys.get(stringKey)!;\n if (!this._stringPlaceholderMap.has(placeholder.suffix)) {\n this._stringPlaceholderMap.set(placeholder.suffix, {\n values: {\n [this._passthroughLocaleName]: stringName\n },\n locFilePath: localizedFilePath,\n stringName: stringName\n });\n }\n\n this._stringPlaceholderMap.get(placeholder.suffix)!.values[localeName] = stringValue;\n\n stringsMap.set(stringName, stringValue);\n }\n }\n\n private _initializeAndValidateOptions(\n configuration: Webpack.Configuration,\n isWebpackDevServer: boolean\n ): { errors: Error[]; warnings: Error[] } {\n const errors: Error[] = [];\n const warnings: Error[] = [];\n\n function ensureValidLocaleName(localeName: string): boolean {\n const LOCALE_NAME_REGEX: RegExp = /[a-z-]/i;\n if (!localeName.match(LOCALE_NAME_REGEX)) {\n errors.push(\n new Error(`Invalid locale name: ${localeName}. Locale names may only contain letters and hyphens.`)\n );\n return false;\n } else {\n return true;\n }\n }\n\n // START configuration\n if (\n !configuration.output ||\n !configuration.output.filename ||\n typeof configuration.output.filename !== 'string' ||\n configuration.output.filename.indexOf(Constants.LOCALE_FILENAME_TOKEN) === -1\n ) {\n errors.push(\n new Error(\n 'The configuration.output.filename property must be provided, must be a string, and must include ' +\n `the ${Constants.LOCALE_FILENAME_TOKEN} placeholder`\n )\n );\n }\n // END configuration\n\n // START misc options\n // eslint-disable-next-line no-lone-blocks\n {\n this._globsToIgnore = this._options.globsToIgnore;\n }\n // END misc options\n\n // START options.localizedData\n if (this._options.localizedData) {\n this._ignoreMissingResxComments = this._options.localizedData.ignoreMissingResxComments;\n\n // START options.localizedData.passthroughLocale\n if (this._options.localizedData.passthroughLocale) {\n const { usePassthroughLocale, passthroughLocaleName = 'passthrough' } =\n this._options.localizedData.passthroughLocale;\n if (usePassthroughLocale) {\n this._passthroughLocaleName = passthroughLocaleName;\n this._locales.add(passthroughLocaleName);\n }\n }\n // END options.localizedData.passthroughLocale\n\n // START options.localizedData.translatedStrings\n const { translatedStrings } = this._options.localizedData;\n this._resolvedTranslatedStringsFromOptions = {};\n if (translatedStrings) {\n for (const [localeName, locale] of Object.entries(translatedStrings)) {\n if (this._locales.has(localeName)) {\n errors.push(\n Error(\n `The locale \"${localeName}\" appears multiple times. ` +\n 'There may be multiple instances with different casing.'\n )\n );\n return { errors, warnings };\n }\n\n if (!ensureValidLocaleName(localeName)) {\n return { errors, warnings };\n }\n\n this._locales.add(localeName);\n this._resolvedLocalizedStrings.set(localeName, new Map<string, Map<string, string>>());\n this._resolvedTranslatedStringsFromOptions[localeName] = {};\n\n const locFilePathsInLocale: Set<string> = new Set<string>();\n\n for (const [locFilePath, locFileDataFromOptions] of Object.entries(locale)) {\n if (locale.hasOwnProperty(locFilePath)) {\n const normalizedLocFilePath: string = path.resolve(configuration.context!, locFilePath);\n\n if (locFilePathsInLocale.has(normalizedLocFilePath)) {\n errors.push(\n new Error(\n `The localization file path \"${locFilePath}\" appears multiple times in locale ${localeName}. ` +\n 'There may be multiple instances with different casing.'\n )\n );\n return { errors, warnings };\n }\n\n locFilePathsInLocale.add(normalizedLocFilePath);\n\n const normalizedLocFileDataFromOptions: string | ILocaleFileData =\n typeof locFileDataFromOptions === 'string'\n ? path.resolve(configuration.context!, locFileDataFromOptions)\n : locFileDataFromOptions;\n\n this._resolvedTranslatedStringsFromOptions[localeName][normalizedLocFilePath] =\n normalizedLocFileDataFromOptions;\n }\n }\n }\n }\n // END options.localizedData.translatedStrings\n\n // START options.localizedData.defaultLocale\n if (this._options.localizedData.defaultLocale) {\n const { localeName, fillMissingTranslationStrings } = this._options.localizedData.defaultLocale;\n if (this._options.localizedData.defaultLocale.localeName) {\n if (this._locales.has(localeName)) {\n errors.push(new Error('The default locale is also specified in the translated strings.'));\n return { errors, warnings };\n } else if (!ensureValidLocaleName(localeName)) {\n return { errors, warnings };\n }\n\n this._locales.add(localeName);\n this._resolvedLocalizedStrings.set(localeName, new Map<string, Map<string, string>>());\n this._defaultLocale = localeName;\n this._fillMissingTranslationStrings = !!fillMissingTranslationStrings;\n } else {\n errors.push(new Error('Missing default locale name'));\n return { errors, warnings };\n }\n } else {\n errors.push(new Error('Missing default locale options.'));\n return { errors, warnings };\n }\n // END options.localizedData.defaultLocale\n\n // START options.localizedData.pseudoLocales\n if (this._options.localizedData.pseudolocales) {\n for (const [pseudolocaleName, pseudoLocaleOpts] of Object.entries(\n this._options.localizedData.pseudolocales\n )) {\n if (this._defaultLocale === pseudolocaleName) {\n errors.push(\n new Error(`A pseudolocale (${pseudolocaleName}) name is also the default locale name.`)\n );\n return { errors, warnings };\n }\n\n if (this._locales.has(pseudolocaleName)) {\n errors.push(\n new Error(\n `A pseudolocale (${pseudolocaleName}) name is also specified in the translated strings.`\n )\n );\n return { errors, warnings };\n }\n\n this._pseudolocalizers.set(pseudolocaleName, getPseudolocalizer(pseudoLocaleOpts));\n this._locales.add(pseudolocaleName);\n this._resolvedLocalizedStrings.set(pseudolocaleName, new Map<string, Map<string, string>>());\n }\n }\n // END options.localizedData.pseudoLocales\n\n // START options.localizedData.normalizeResxNewlines\n if (this._options.localizedData.normalizeResxNewlines) {\n switch (this._options.localizedData.normalizeResxNewlines) {\n case 'crlf': {\n this._resxNewlineNormalization = NewlineKind.CrLf;\n break;\n }\n\n case 'lf': {\n this._resxNewlineNormalization = NewlineKind.Lf;\n break;\n }\n\n default: {\n errors.push(\n new Error(\n `Unexpected value \"${this._options.localizedData.normalizeResxNewlines}\" for option ` +\n '\"localizedData.normalizeResxNewlines\"'\n )\n );\n break;\n }\n }\n }\n // END options.localizedData.normalizeResxNewlines\n } else if (!isWebpackDevServer) {\n throw new Error('Localized data must be provided unless webpack dev server is running.');\n }\n // END options.localizedData\n\n // START options.noStringsLocaleName\n if (\n this._options.noStringsLocaleName === undefined ||\n this._options.noStringsLocaleName === null ||\n !ensureValidLocaleName(this._options.noStringsLocaleName)\n ) {\n this._noStringsLocaleName = 'none';\n } else {\n this._noStringsLocaleName = this._options.noStringsLocaleName;\n }\n // END options.noStringsLocaleName\n\n return { errors, warnings };\n }\n\n private _getPlaceholderString(): IStringPlaceholder {\n const suffix: string = (this._stringPlaceholderCounter++).toString();\n return {\n value: `${Constants.STRING_PLACEHOLDER_PREFIX}_\\\\_${Constants.STRING_PLACEHOLDER_LABEL}_${suffix}`,\n suffix: suffix\n };\n }\n\n private _chunkHasLocalizedModules(chunk: Webpack.compilation.Chunk): boolean {\n let chunkHasAnyLocModules: boolean | undefined = EntityMarker.getMark(chunk);\n if (chunkHasAnyLocModules === undefined) {\n chunkHasAnyLocModules = false;\n for (const module of chunk.getModules()) {\n if (EntityMarker.getMark(module)) {\n chunkHasAnyLocModules = true;\n break;\n }\n }\n\n // If this chunk doesn't directly contain any localized resources, it still\n // needs to be localized if it's an entrypoint chunk (i.e. - it has a runtime)\n // and it loads localized async chunks.\n // In that case, the generated chunk URL generation code needs to contain\n // the locale name.\n if (!chunkHasAnyLocModules && chunk.hasRuntime()) {\n for (const asyncChunk of chunk.getAllAsyncChunks()) {\n if (this._chunkHasLocalizedModules(asyncChunk)) {\n chunkHasAnyLocModules = true;\n break;\n }\n }\n }\n\n EntityMarker.markEntity(chunk, chunkHasAnyLocModules);\n }\n\n return chunkHasAnyLocModules;\n }\n\n private _convertLocalizationFileToLocData(locFile: ILocalizationFile): ILocaleFileData {\n const locFileData: ILocaleFileData = {};\n for (const [stringName, locFileEntry] of Object.entries(locFile)) {\n locFileData[stringName] = locFileEntry.value;\n }\n\n return locFileData;\n }\n}\n"]}
1
+ {"version":3,"file":"LocalizationPlugin.js","sourceRoot":"","sources":["../src/LocalizationPlugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,oEAAiG;AACjG,iDAAmC;AACnC,2CAA6B;AAE7B,8EAK2C;AAE3C,qDAAkD;AAClD,+EAGuC;AAUvC,2DAAwD;AACxD,qDAA4G;AAuD5G,MAAM,WAAW,GAAW,cAAc,CAAC;AAE3C;;;;GAIG;AACH,MAAa,kBAAkB;IAoC7B,YAAmB,OAAmC;;QAnCtD;;WAEG;QACI,eAAU,GAAoC,IAAI,GAAG,EAA8B,CAAC;QAKnF,8BAAyB,GAAW,CAAC,CAAC;QACtC,0BAAqB,GAAyC,IAAI,GAAG,EAG1E,CAAC;QACI,aAAQ,GAAgB,IAAI,GAAG,EAA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YAChE,WAAW,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC;SAC9C;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AAxwBD,gDAwwBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { JsonFile, FileSystem, type ITerminal, NewlineKind } from '@rushstack/node-core-library';\nimport * as Webpack from 'webpack';\nimport * as path from 'path';\nimport type * as Tapable from 'tapable';\nimport {\n getPseudolocalizer,\n type ILocalizationFile,\n parseLocFile,\n TypingsGenerator\n} from '@rushstack/localization-utilities';\n\nimport { Constants } from './utilities/Constants';\nimport {\n type IWebpackConfigurationUpdaterOptions,\n WebpackConfigurationUpdater\n} from './WebpackConfigurationUpdater';\nimport type {\n ILocalizationPluginOptions,\n ILocalizationStats,\n ILocaleFileData,\n ILocaleElementMap,\n ILocalizedStrings,\n IResolvedMissingTranslations\n} from './interfaces';\nimport type { ILocalizedWebpackChunk } from './webpackInterfaces';\nimport { EntityMarker } from './utilities/EntityMarker';\nimport { type IAsset, type IProcessAssetResult, AssetProcessor, PLACEHOLDER_REGEX } from './AssetProcessor';\n\n/**\n * @internal\n */\nexport interface IStringPlaceholder {\n value: string;\n suffix: string;\n}\n\n/**\n * @internal\n */\nexport interface IAddDefaultLocFileResult {\n /**\n * A list of paths to translation files that were loaded\n */\n additionalLoadedFilePaths: string[];\n\n errors: Error[];\n}\n\ninterface IExtendedMainTemplate {\n hooks: {\n assetPath: Tapable.SyncHook<string, IAssetPathOptions>;\n };\n}\n\ninterface IExtendedConfiguration extends Webpack.compilation.Compilation {\n options: Webpack.Configuration;\n}\n\ninterface IExtendedChunkGroup extends Webpack.compilation.ChunkGroup {\n getChildren(): Webpack.compilation.Chunk[];\n}\n\ninterface IExtendedChunk extends Webpack.compilation.Chunk {\n filenameTemplate: string;\n}\n\ninterface IAssetPathOptions {\n chunk: Webpack.compilation.Chunk;\n contentHashType: string;\n filename: string;\n}\n\n/**\n * @internal\n */\nexport interface IStringSerialNumberData {\n values: ILocaleElementMap;\n locFilePath: string;\n stringName: string;\n}\n\nconst PLUGIN_NAME: string = 'localization';\n\n/**\n * This plugin facilitates localization in webpack.\n *\n * @public\n */\nexport class LocalizationPlugin implements Webpack.Plugin {\n /**\n * @internal\n */\n public stringKeys: Map<string, IStringPlaceholder> = new Map<string, IStringPlaceholder>();\n\n private _options: ILocalizationPluginOptions;\n private _resolvedTranslatedStringsFromOptions!: ILocalizedStrings;\n private _globsToIgnore: string[] | undefined;\n private _stringPlaceholderCounter: number = 0;\n private _stringPlaceholderMap: Map<string, IStringSerialNumberData> = new Map<\n string,\n IStringSerialNumberData\n >();\n private _locales: Set<string> = new Set<string>();\n private _passthroughLocaleName!: string;\n private _defaultLocale!: string;\n private _noStringsLocaleName!: string;\n private _fillMissingTranslationStrings!: boolean;\n private _pseudolocalizers: Map<string, (str: string) => string> = new Map<\n string,\n (str: string) => string\n >();\n private _resxNewlineNormalization: NewlineKind | undefined;\n private _ignoreMissingResxComments: boolean | undefined;\n\n /**\n * The outermost map's keys are the locale names.\n * The middle map's keys are the resolved, file names.\n * The innermost map's keys are the string identifiers and its values are the string values.\n */\n private _resolvedLocalizedStrings: Map<string, Map<string, Map<string, string>>> = new Map<\n string,\n Map<string, Map<string, string>>\n >();\n\n public constructor(options: ILocalizationPluginOptions) {\n if (options.filesToIgnore) {\n throw new Error('The filesToIgnore option is no longer supported. Please use globsToIgnore instead.');\n }\n\n if (options.typingsOptions?.ignoreString) {\n throw new Error(\n 'The typingsOptions.ignoreString option is no longer supported. Please use the ignoreString ' +\n 'option directly on the constructor options object instead.'\n );\n }\n\n this._options = options;\n }\n\n public apply(compiler: Webpack.Compiler): void {\n const isWebpack4: boolean = !!compiler.hooks;\n\n if (!isWebpack4) {\n throw new Error(`The ${LocalizationPlugin.name} plugin requires Webpack 4`);\n }\n\n if (this._options.typingsOptions && compiler.context) {\n if (\n this._options.typingsOptions.generatedTsFolder &&\n !path.isAbsolute(this._options.typingsOptions.generatedTsFolder)\n ) {\n this._options.typingsOptions.generatedTsFolder = path.resolve(\n compiler.context,\n this._options.typingsOptions.generatedTsFolder\n );\n }\n\n if (\n this._options.typingsOptions.sourceRoot &&\n !path.isAbsolute(this._options.typingsOptions.sourceRoot)\n ) {\n this._options.typingsOptions.sourceRoot = path.resolve(\n compiler.context,\n this._options.typingsOptions.sourceRoot\n );\n }\n\n const secondaryGeneratedTsFolders: string[] | undefined =\n this._options.typingsOptions.secondaryGeneratedTsFolders;\n if (secondaryGeneratedTsFolders) {\n for (let i: number = 0; i < secondaryGeneratedTsFolders.length; i++) {\n const secondaryGeneratedTsFolder: string = secondaryGeneratedTsFolders[i];\n if (!path.isAbsolute(secondaryGeneratedTsFolder)) {\n secondaryGeneratedTsFolders[i] = path.resolve(compiler.context, secondaryGeneratedTsFolder);\n }\n }\n }\n }\n\n // https://github.com/webpack/webpack-dev-server/pull/1929/files#diff-15fb51940da53816af13330d8ce69b4eR66\n const isWebpackDevServer: boolean = process.env.WEBPACK_DEV_SERVER === 'true';\n\n const { errors, warnings } = this._initializeAndValidateOptions(compiler.options, isWebpackDevServer);\n\n let typingsPreprocessor: TypingsGenerator | undefined;\n if (this._options.typingsOptions) {\n typingsPreprocessor = new TypingsGenerator({\n srcFolder: this._options.typingsOptions.sourceRoot || compiler.context,\n generatedTsFolder: this._options.typingsOptions.generatedTsFolder,\n secondaryGeneratedTsFolders: this._options.typingsOptions.secondaryGeneratedTsFolders,\n exportAsDefault: this._options.typingsOptions.exportAsDefault,\n globsToIgnore: this._options.globsToIgnore,\n ignoreString: this._options.ignoreString,\n processComment: this._options.typingsOptions.processComment\n });\n } else {\n typingsPreprocessor = undefined;\n }\n\n const webpackConfigurationUpdaterOptions: IWebpackConfigurationUpdaterOptions = {\n pluginInstance: this,\n configuration: compiler.options,\n globsToIgnore: this._globsToIgnore,\n localeNameOrPlaceholder: Constants.LOCALE_NAME_PLACEHOLDER,\n resxNewlineNormalization: this._resxNewlineNormalization,\n ignoreMissingResxComments: this._ignoreMissingResxComments,\n ignoreString: this._options.ignoreString\n };\n\n if (errors.length > 0 || warnings.length > 0) {\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation: Webpack.compilation.Compilation) => {\n compilation.errors.push(...errors);\n compilation.warnings.push(...warnings);\n });\n\n if (errors.length > 0) {\n // If there are any errors, just pass through the resources in source and don't do any\n // additional configuration\n WebpackConfigurationUpdater.amendWebpackConfigurationForInPlaceLocFiles(\n webpackConfigurationUpdaterOptions\n );\n return;\n }\n }\n\n if (isWebpackDevServer) {\n if (typingsPreprocessor) {\n compiler.hooks.afterEnvironment.tap(PLUGIN_NAME, () => typingsPreprocessor!.runWatcherAsync());\n\n if (!compiler.options.plugins) {\n compiler.options.plugins = [];\n }\n\n compiler.options.plugins.push(\n new Webpack.WatchIgnorePlugin([this._options.typingsOptions!.generatedTsFolder])\n );\n }\n\n WebpackConfigurationUpdater.amendWebpackConfigurationForInPlaceLocFiles(\n webpackConfigurationUpdaterOptions\n );\n } else {\n if (typingsPreprocessor) {\n compiler.hooks.beforeRun.tapPromise(\n PLUGIN_NAME,\n async () => await typingsPreprocessor!.generateTypingsAsync()\n );\n }\n\n WebpackConfigurationUpdater.amendWebpackConfigurationForMultiLocale(webpackConfigurationUpdaterOptions);\n\n if (errors.length === 0) {\n compiler.hooks.thisCompilation.tap(\n PLUGIN_NAME,\n (untypedCompilation: Webpack.compilation.Compilation) => {\n const compilation: IExtendedConfiguration = untypedCompilation as IExtendedConfiguration;\n (compilation.mainTemplate as unknown as IExtendedMainTemplate).hooks.assetPath.tap(\n PLUGIN_NAME,\n (assetPath: string, options: IAssetPathOptions) => {\n if (\n options.contentHashType === 'javascript' &&\n assetPath.match(Constants.LOCALE_FILENAME_TOKEN_REGEX)\n ) {\n // Does this look like an async chunk URL generator?\n if (typeof options.chunk.id === 'string' && (options.chunk.id as string).match(/^\\\" \\+/)) {\n return assetPath.replace(\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\n `\" + ${Constants.JSONP_PLACEHOLDER} + \"`\n );\n } else {\n return assetPath.replace(\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\n Constants.LOCALE_NAME_PLACEHOLDER\n );\n }\n } else if (assetPath.match(Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX)) {\n // Replace the placeholder with the [locale] token for sourcemaps\n const deLocalizedFilename: string = options.filename.replace(\n PLACEHOLDER_REGEX,\n Constants.LOCALE_FILENAME_TOKEN\n );\n return assetPath.replace(\n Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX,\n deLocalizedFilename\n );\n } else {\n return assetPath;\n }\n }\n );\n\n compilation.hooks.optimizeChunks.tap(\n PLUGIN_NAME,\n (\n untypedChunks: Webpack.compilation.Chunk[],\n untypedChunkGroups: Webpack.compilation.ChunkGroup[]\n ) => {\n const chunks: IExtendedChunk[] = untypedChunks as IExtendedChunk[];\n const chunkGroups: IExtendedChunkGroup[] = untypedChunkGroups as IExtendedChunkGroup[];\n\n let chunksHaveAnyChildren: boolean = false;\n for (const chunkGroup of chunkGroups) {\n const children: Webpack.compilation.Chunk[] = chunkGroup.getChildren();\n if (children.length > 0) {\n chunksHaveAnyChildren = true;\n break;\n }\n }\n\n if (\n chunksHaveAnyChildren &&\n (!compilation.options.output ||\n !compilation.options.output.chunkFilename ||\n compilation.options.output.chunkFilename.indexOf(Constants.LOCALE_FILENAME_TOKEN) === -1)\n ) {\n compilation.errors.push(\n new Error(\n 'The configuration.output.chunkFilename property must be provided and must include ' +\n `the ${Constants.LOCALE_FILENAME_TOKEN} placeholder`\n )\n );\n\n return;\n }\n\n for (const chunk of chunks) {\n // See if the chunk contains any localized modules or loads any localized chunks\n const localizedChunk: boolean = this._chunkHasLocalizedModules(chunk);\n\n // Change the chunk's name to include either the locale name or the locale name for chunks without strings\n const replacementValue: string = localizedChunk\n ? Constants.LOCALE_NAME_PLACEHOLDER\n : this._noStringsLocaleName;\n if (chunk.hasRuntime()) {\n chunk.filenameTemplate = (compilation.options.output!.filename as string).replace(\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\n replacementValue\n );\n } else {\n chunk.filenameTemplate = compilation.options.output!.chunkFilename!.replace(\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\n replacementValue\n );\n }\n }\n }\n );\n }\n );\n\n compiler.hooks.emit.tap(PLUGIN_NAME, (compilation: Webpack.compilation.Compilation) => {\n const localizationStats: ILocalizationStats = {\n entrypoints: {},\n namedChunkGroups: {}\n };\n\n const alreadyProcessedAssets: Set<string> = new Set<string>();\n const hotUpdateRegex: RegExp = /\\.hot-update\\.js$/;\n\n for (const untypedChunk of compilation.chunks) {\n const chunk: ILocalizedWebpackChunk = untypedChunk;\n const chunkFilesSet: Set<string> = new Set(chunk.files);\n function processChunkJsFile(callback: (chunkFilename: string) => void): void {\n let alreadyProcessedAFileInThisChunk: boolean = false;\n for (const chunkFilename of chunk.files) {\n if (\n chunkFilename.endsWith('.js') && // Ensure this is a JS file\n !hotUpdateRegex.test(chunkFilename) && // Ensure this is not a webpack hot update\n !alreadyProcessedAssets.has(chunkFilename) // Ensure this isn't a vendor chunk we've already processed\n ) {\n if (alreadyProcessedAFileInThisChunk) {\n throw new Error(\n `Found more than one JS file in chunk \"${chunk.name}\". This is not expected.`\n );\n }\n\n alreadyProcessedAFileInThisChunk = true;\n alreadyProcessedAssets.add(chunkFilename);\n callback(chunkFilename);\n }\n }\n }\n\n if (this._chunkHasLocalizedModules(chunk)) {\n processChunkJsFile((chunkFilename) => {\n if (chunkFilename.indexOf(Constants.LOCALE_NAME_PLACEHOLDER) === -1) {\n throw new Error(\n `Asset ${chunkFilename} is expected to be localized, but is missing a locale placeholder`\n );\n }\n\n const asset: IAsset = compilation.assets[chunkFilename];\n\n const resultingAssets: Map<string, IProcessAssetResult> =\n AssetProcessor.processLocalizedAsset({\n plugin: this,\n compilation,\n assetName: chunkFilename,\n asset,\n chunk,\n chunkHasLocalizedModules: this._chunkHasLocalizedModules.bind(this),\n locales: this._locales,\n noStringsLocaleName: this._noStringsLocaleName,\n fillMissingTranslationStrings: this._fillMissingTranslationStrings,\n defaultLocale: this._defaultLocale\n });\n\n // Delete the existing asset because it's been renamed\n delete compilation.assets[chunkFilename];\n chunkFilesSet.delete(chunkFilename);\n\n const localizedChunkAssets: ILocaleElementMap = {};\n for (const [locale, newAsset] of resultingAssets) {\n compilation.assets[newAsset.filename] = newAsset.asset;\n localizedChunkAssets[locale] = newAsset.filename;\n chunkFilesSet.add(newAsset.filename);\n }\n\n if (chunk.hasRuntime()) {\n // This is an entrypoint\n localizationStats.entrypoints[chunk.name] = {\n localizedAssets: localizedChunkAssets\n };\n } else {\n // This is a secondary chunk\n if (chunk.name) {\n localizationStats.namedChunkGroups[chunk.name] = {\n localizedAssets: localizedChunkAssets\n };\n }\n }\n\n chunk.localizedFiles = localizedChunkAssets;\n });\n } else {\n processChunkJsFile((chunkFilename) => {\n const asset: IAsset = compilation.assets[chunkFilename];\n\n const resultingAsset: IProcessAssetResult = AssetProcessor.processNonLocalizedAsset({\n plugin: this,\n compilation,\n assetName: chunkFilename,\n asset,\n chunk,\n noStringsLocaleName: this._noStringsLocaleName,\n chunkHasLocalizedModules: this._chunkHasLocalizedModules.bind(this)\n });\n\n // Delete the existing asset because it's been renamed\n delete compilation.assets[chunkFilename];\n chunkFilesSet.delete(chunkFilename);\n\n compilation.assets[resultingAsset.filename] = resultingAsset.asset;\n chunkFilesSet.add(resultingAsset.filename);\n });\n }\n\n chunk.files = Array.from(chunkFilesSet);\n }\n\n if (this._options.localizationStats) {\n if (this._options.localizationStats.dropPath) {\n const resolvedLocalizationStatsDropPath: string = path.resolve(\n compiler.outputPath,\n this._options.localizationStats.dropPath\n );\n JsonFile.save(localizationStats, resolvedLocalizationStatsDropPath, {\n ensureFolderExists: true\n });\n }\n\n if (this._options.localizationStats.callback) {\n try {\n this._options.localizationStats.callback(localizationStats);\n } catch (e) {\n /* swallow errors from the callback */\n }\n }\n }\n });\n }\n }\n }\n\n /**\n * @internal\n *\n * @returns\n */\n public addDefaultLocFile(\n terminal: ITerminal,\n localizedResourcePath: string,\n localizedResourceData: ILocalizationFile\n ): IAddDefaultLocFileResult {\n const additionalLoadedFilePaths: string[] = [];\n const errors: Error[] = [];\n\n const locFileData: ILocaleFileData = this._convertLocalizationFileToLocData(localizedResourceData);\n this._addLocFile(this._defaultLocale, localizedResourcePath, locFileData);\n\n const normalizeLocalizedData: (localizedData: ILocaleFileData | string) => ILocaleFileData = (\n localizedData\n ) => {\n if (typeof localizedData === 'string') {\n additionalLoadedFilePaths.push(localizedData);\n const localizationFile: ILocalizationFile = parseLocFile({\n filePath: localizedData,\n content: FileSystem.readFile(localizedData),\n terminal: terminal,\n resxNewlineNormalization: this._resxNewlineNormalization,\n ignoreMissingResxComments: this._ignoreMissingResxComments\n });\n\n return this._convertLocalizationFileToLocData(localizationFile);\n } else {\n return localizedData;\n }\n };\n\n const missingLocales: string[] = [];\n for (const [translatedLocaleName, translatedStrings] of Object.entries(\n this._resolvedTranslatedStringsFromOptions\n )) {\n const translatedLocFileFromOptions: ILocaleFileData | string | undefined =\n translatedStrings[localizedResourcePath];\n if (!translatedLocFileFromOptions) {\n missingLocales.push(translatedLocaleName);\n } else {\n const translatedLocFileData: ILocaleFileData = normalizeLocalizedData(translatedLocFileFromOptions);\n this._addLocFile(translatedLocaleName, localizedResourcePath, translatedLocFileData);\n }\n }\n\n if (missingLocales.length > 0 && this._options.localizedData.resolveMissingTranslatedStrings) {\n let resolvedTranslatedData: IResolvedMissingTranslations | undefined = undefined;\n try {\n resolvedTranslatedData = this._options.localizedData.resolveMissingTranslatedStrings(\n missingLocales,\n localizedResourcePath\n );\n } catch (e) {\n errors.push(e as Error);\n }\n\n if (resolvedTranslatedData) {\n for (const [resolvedLocaleName, resolvedLocaleData] of Object.entries(resolvedTranslatedData)) {\n if (resolvedLocaleData) {\n const translatedLocFileData: ILocaleFileData = normalizeLocalizedData(resolvedLocaleData);\n this._addLocFile(resolvedLocaleName, localizedResourcePath, translatedLocFileData);\n }\n }\n }\n }\n\n this._pseudolocalizers.forEach((pseudolocalizer: (str: string) => string, pseudolocaleName: string) => {\n const pseudolocFileData: ILocaleFileData = {};\n\n for (const [stringName, stringValue] of Object.entries(locFileData)) {\n pseudolocFileData[stringName] = pseudolocalizer(stringValue);\n }\n\n this._addLocFile(pseudolocaleName, localizedResourcePath, pseudolocFileData);\n });\n\n return { additionalLoadedFilePaths, errors };\n }\n\n /**\n * @internal\n */\n public getDataForSerialNumber(serialNumber: string): IStringSerialNumberData | undefined {\n return this._stringPlaceholderMap.get(serialNumber);\n }\n\n private _addLocFile(\n localeName: string,\n localizedFilePath: string,\n localizedFileData: ILocaleFileData\n ): void {\n const filesMap: Map<string, Map<string, string>> = this._resolvedLocalizedStrings.get(localeName)!;\n\n const stringsMap: Map<string, string> = new Map<string, string>();\n filesMap.set(localizedFilePath, stringsMap);\n\n for (const [stringName, stringValue] of Object.entries(localizedFileData)) {\n const stringKey: string = `${localizedFilePath}?${stringName}`;\n if (!this.stringKeys.has(stringKey)) {\n const placeholder: IStringPlaceholder = this._getPlaceholderString();\n this.stringKeys.set(stringKey, placeholder);\n }\n\n const placeholder: IStringPlaceholder = this.stringKeys.get(stringKey)!;\n if (!this._stringPlaceholderMap.has(placeholder.suffix)) {\n this._stringPlaceholderMap.set(placeholder.suffix, {\n values: {\n [this._passthroughLocaleName]: stringName\n },\n locFilePath: localizedFilePath,\n stringName: stringName\n });\n }\n\n this._stringPlaceholderMap.get(placeholder.suffix)!.values[localeName] = stringValue;\n\n stringsMap.set(stringName, stringValue);\n }\n }\n\n private _initializeAndValidateOptions(\n configuration: Webpack.Configuration,\n isWebpackDevServer: boolean\n ): { errors: Error[]; warnings: Error[] } {\n const errors: Error[] = [];\n const warnings: Error[] = [];\n\n function ensureValidLocaleName(localeName: string): boolean {\n const LOCALE_NAME_REGEX: RegExp = /[a-z-]/i;\n if (!localeName.match(LOCALE_NAME_REGEX)) {\n errors.push(\n new Error(`Invalid locale name: ${localeName}. Locale names may only contain letters and hyphens.`)\n );\n return false;\n } else {\n return true;\n }\n }\n\n // START configuration\n if (\n !configuration.output ||\n !configuration.output.filename ||\n typeof configuration.output.filename !== 'string' ||\n configuration.output.filename.indexOf(Constants.LOCALE_FILENAME_TOKEN) === -1\n ) {\n errors.push(\n new Error(\n 'The configuration.output.filename property must be provided, must be a string, and must include ' +\n `the ${Constants.LOCALE_FILENAME_TOKEN} placeholder`\n )\n );\n }\n // END configuration\n\n // START misc options\n // eslint-disable-next-line no-lone-blocks\n {\n this._globsToIgnore = this._options.globsToIgnore;\n }\n // END misc options\n\n // START options.localizedData\n if (this._options.localizedData) {\n this._ignoreMissingResxComments = this._options.localizedData.ignoreMissingResxComments;\n\n // START options.localizedData.passthroughLocale\n if (this._options.localizedData.passthroughLocale) {\n const { usePassthroughLocale, passthroughLocaleName = 'passthrough' } =\n this._options.localizedData.passthroughLocale;\n if (usePassthroughLocale) {\n this._passthroughLocaleName = passthroughLocaleName;\n this._locales.add(passthroughLocaleName);\n }\n }\n // END options.localizedData.passthroughLocale\n\n // START options.localizedData.translatedStrings\n const { translatedStrings } = this._options.localizedData;\n this._resolvedTranslatedStringsFromOptions = {};\n if (translatedStrings) {\n for (const [localeName, locale] of Object.entries(translatedStrings)) {\n if (this._locales.has(localeName)) {\n errors.push(\n Error(\n `The locale \"${localeName}\" appears multiple times. ` +\n 'There may be multiple instances with different casing.'\n )\n );\n return { errors, warnings };\n }\n\n if (!ensureValidLocaleName(localeName)) {\n return { errors, warnings };\n }\n\n this._locales.add(localeName);\n this._resolvedLocalizedStrings.set(localeName, new Map<string, Map<string, string>>());\n this._resolvedTranslatedStringsFromOptions[localeName] = {};\n\n const locFilePathsInLocale: Set<string> = new Set<string>();\n\n for (const [locFilePath, locFileDataFromOptions] of Object.entries(locale)) {\n if (locale.hasOwnProperty(locFilePath)) {\n const normalizedLocFilePath: string = path.resolve(configuration.context!, locFilePath);\n\n if (locFilePathsInLocale.has(normalizedLocFilePath)) {\n errors.push(\n new Error(\n `The localization file path \"${locFilePath}\" appears multiple times in locale ${localeName}. ` +\n 'There may be multiple instances with different casing.'\n )\n );\n return { errors, warnings };\n }\n\n locFilePathsInLocale.add(normalizedLocFilePath);\n\n const normalizedLocFileDataFromOptions: string | ILocaleFileData =\n typeof locFileDataFromOptions === 'string'\n ? path.resolve(configuration.context!, locFileDataFromOptions)\n : locFileDataFromOptions;\n\n this._resolvedTranslatedStringsFromOptions[localeName][normalizedLocFilePath] =\n normalizedLocFileDataFromOptions;\n }\n }\n }\n }\n // END options.localizedData.translatedStrings\n\n // START options.localizedData.defaultLocale\n if (this._options.localizedData.defaultLocale) {\n const { localeName, fillMissingTranslationStrings } = this._options.localizedData.defaultLocale;\n if (this._options.localizedData.defaultLocale.localeName) {\n if (this._locales.has(localeName)) {\n errors.push(new Error('The default locale is also specified in the translated strings.'));\n return { errors, warnings };\n } else if (!ensureValidLocaleName(localeName)) {\n return { errors, warnings };\n }\n\n this._locales.add(localeName);\n this._resolvedLocalizedStrings.set(localeName, new Map<string, Map<string, string>>());\n this._defaultLocale = localeName;\n this._fillMissingTranslationStrings = !!fillMissingTranslationStrings;\n } else {\n errors.push(new Error('Missing default locale name'));\n return { errors, warnings };\n }\n } else {\n errors.push(new Error('Missing default locale options.'));\n return { errors, warnings };\n }\n // END options.localizedData.defaultLocale\n\n // START options.localizedData.pseudoLocales\n if (this._options.localizedData.pseudolocales) {\n for (const [pseudolocaleName, pseudoLocaleOpts] of Object.entries(\n this._options.localizedData.pseudolocales\n )) {\n if (this._defaultLocale === pseudolocaleName) {\n errors.push(\n new Error(`A pseudolocale (${pseudolocaleName}) name is also the default locale name.`)\n );\n return { errors, warnings };\n }\n\n if (this._locales.has(pseudolocaleName)) {\n errors.push(\n new Error(\n `A pseudolocale (${pseudolocaleName}) name is also specified in the translated strings.`\n )\n );\n return { errors, warnings };\n }\n\n this._pseudolocalizers.set(pseudolocaleName, getPseudolocalizer(pseudoLocaleOpts));\n this._locales.add(pseudolocaleName);\n this._resolvedLocalizedStrings.set(pseudolocaleName, new Map<string, Map<string, string>>());\n }\n }\n // END options.localizedData.pseudoLocales\n\n // START options.localizedData.normalizeResxNewlines\n if (this._options.localizedData.normalizeResxNewlines) {\n switch (this._options.localizedData.normalizeResxNewlines) {\n case 'crlf': {\n this._resxNewlineNormalization = NewlineKind.CrLf;\n break;\n }\n\n case 'lf': {\n this._resxNewlineNormalization = NewlineKind.Lf;\n break;\n }\n\n default: {\n errors.push(\n new Error(\n `Unexpected value \"${this._options.localizedData.normalizeResxNewlines}\" for option ` +\n '\"localizedData.normalizeResxNewlines\"'\n )\n );\n break;\n }\n }\n }\n // END options.localizedData.normalizeResxNewlines\n } else if (!isWebpackDevServer) {\n throw new Error('Localized data must be provided unless webpack dev server is running.');\n }\n // END options.localizedData\n\n // START options.noStringsLocaleName\n if (\n this._options.noStringsLocaleName === undefined ||\n this._options.noStringsLocaleName === null ||\n !ensureValidLocaleName(this._options.noStringsLocaleName)\n ) {\n this._noStringsLocaleName = 'none';\n } else {\n this._noStringsLocaleName = this._options.noStringsLocaleName;\n }\n // END options.noStringsLocaleName\n\n return { errors, warnings };\n }\n\n private _getPlaceholderString(): IStringPlaceholder {\n const suffix: string = (this._stringPlaceholderCounter++).toString();\n return {\n value: `${Constants.STRING_PLACEHOLDER_PREFIX}_\\\\_${Constants.STRING_PLACEHOLDER_LABEL}_${suffix}`,\n suffix: suffix\n };\n }\n\n private _chunkHasLocalizedModules(chunk: Webpack.compilation.Chunk): boolean {\n let chunkHasAnyLocModules: boolean | undefined = EntityMarker.getMark(chunk);\n if (chunkHasAnyLocModules === undefined) {\n chunkHasAnyLocModules = false;\n for (const module of chunk.getModules()) {\n if (EntityMarker.getMark(module)) {\n chunkHasAnyLocModules = true;\n break;\n }\n }\n\n // If this chunk doesn't directly contain any localized resources, it still\n // needs to be localized if it's an entrypoint chunk (i.e. - it has a runtime)\n // and it loads localized async chunks.\n // In that case, the generated chunk URL generation code needs to contain\n // the locale name.\n if (!chunkHasAnyLocModules && chunk.hasRuntime()) {\n for (const asyncChunk of chunk.getAllAsyncChunks()) {\n if (this._chunkHasLocalizedModules(asyncChunk)) {\n chunkHasAnyLocModules = true;\n break;\n }\n }\n }\n\n EntityMarker.markEntity(chunk, chunkHasAnyLocModules);\n }\n\n return chunkHasAnyLocModules;\n }\n\n private _convertLocalizationFileToLocData(locFile: ILocalizationFile): ILocaleFileData {\n const locFileData: ILocaleFileData = {};\n for (const [stringName, locFileEntry] of Object.entries(locFile)) {\n locFileData[stringName] = locFileEntry.value;\n }\n\n return locFileData;\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
- import * as Webpack from 'webpack';
2
- import { NewlineKind } from '@rushstack/node-core-library';
3
- import { IgnoreStringFunction } from '@rushstack/localization-utilities';
4
- import { LocalizationPlugin } from './LocalizationPlugin';
1
+ import type * as Webpack from 'webpack';
2
+ import { type NewlineKind } from '@rushstack/node-core-library';
3
+ import type { IgnoreStringFunction } from '@rushstack/localization-utilities';
4
+ import type { LocalizationPlugin } from './LocalizationPlugin';
5
5
  export interface IWebpackConfigurationUpdaterOptions {
6
6
  pluginInstance: LocalizationPlugin;
7
7
  configuration: Webpack.Configuration;
@@ -1 +1 @@
1
- {"version":3,"file":"WebpackConfigurationUpdater.d.ts","sourceRoot":"","sources":["../src/WebpackConfigurationUpdater.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAQ,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAGzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI1D,MAAM,WAAW,mCAAmC;IAClD,cAAc,EAAE,kBAAkB,CAAC;IACnC,aAAa,EAAE,OAAO,CAAC,aAAa,CAAC;IACrC,aAAa,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACp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AAM,CAAC,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CACrF,gBAAgB,EAChB,qBAAS,CAAC,mCAAmC,CAC9C,CAAC;SACH;IACH,CAAC;CACF;AAhID,kEAgIC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport minimatch from 'minimatch';\nimport * as path from 'path';\nimport * as Webpack from 'webpack';\nimport * as SetPublicPathPluginPackageType from '@rushstack/set-webpack-public-path-plugin';\nimport { NewlineKind, Text } from '@rushstack/node-core-library';\nimport { IgnoreStringFunction } from '@rushstack/localization-utilities';\n\nimport { Constants } from './utilities/Constants';\nimport { LocalizationPlugin } from './LocalizationPlugin';\nimport { ILocLoaderOptions } from './loaders/LocLoader';\nimport { IBaseLoaderOptions } from './loaders/LoaderFactory';\n\nexport interface IWebpackConfigurationUpdaterOptions {\n pluginInstance: LocalizationPlugin;\n configuration: Webpack.Configuration;\n globsToIgnore: string[] | undefined;\n localeNameOrPlaceholder: string;\n resxNewlineNormalization: NewlineKind | undefined;\n ignoreMissingResxComments: boolean | undefined;\n ignoreString: IgnoreStringFunction | undefined;\n}\n\nconst FILE_TOKEN_REGEX: RegExp = new RegExp(Text.escapeRegExp('[file]'));\n\nexport class WebpackConfigurationUpdater {\n public static amendWebpackConfigurationForMultiLocale(options: IWebpackConfigurationUpdaterOptions): void {\n const loader: string = path.resolve(__dirname, 'loaders', 'LocLoader.js');\n const loaderOptions: ILocLoaderOptions = {\n pluginInstance: options.pluginInstance,\n resxNewlineNormalization: options.resxNewlineNormalization,\n ignoreMissingResxComments: options.ignoreMissingResxComments,\n ignoreString: options.ignoreString\n };\n\n WebpackConfigurationUpdater._addLoadersForLocFiles(options, loader, loaderOptions);\n\n WebpackConfigurationUpdater._tryUpdateLocaleTokenInPublicPathPlugin(options);\n\n WebpackConfigurationUpdater._tryUpdateSourceMapFilename(options.configuration);\n }\n\n public static amendWebpackConfigurationForInPlaceLocFiles(\n options: IWebpackConfigurationUpdaterOptions\n ): void {\n const loader: string = path.resolve(__dirname, 'loaders', 'InPlaceLocFileLoader.js');\n const loaderOptions: IBaseLoaderOptions = {\n resxNewlineNormalization: options.resxNewlineNormalization,\n ignoreMissingResxComments: options.ignoreMissingResxComments,\n ignoreString: options.ignoreString\n };\n\n WebpackConfigurationUpdater._addRulesToConfiguration(options.configuration, [\n {\n test: Constants.RESOURCE_FILE_NAME_REGEXP,\n use: [\n {\n loader: loader,\n options: loaderOptions\n }\n ],\n type: 'json',\n sideEffects: false\n }\n ]);\n }\n\n private static _tryUpdateLocaleTokenInPublicPathPlugin(options: IWebpackConfigurationUpdaterOptions): void {\n let setPublicPathPlugin: typeof SetPublicPathPluginPackageType.SetPublicPathPlugin | undefined;\n try {\n const pluginPackage: typeof SetPublicPathPluginPackageType = require('@rushstack/set-webpack-public-path-plugin');\n setPublicPathPlugin = pluginPackage.SetPublicPathPlugin;\n } catch (e) {\n // public path plugin isn't present - ignore\n }\n\n if (setPublicPathPlugin && options.configuration.plugins) {\n for (const plugin of options.configuration.plugins) {\n if (plugin instanceof setPublicPathPlugin) {\n if (\n plugin.options &&\n plugin.options.scriptName &&\n plugin.options.scriptName.isTokenized &&\n plugin.options.scriptName.name\n ) {\n plugin.options.scriptName.name = plugin.options.scriptName.name.replace(\n /\\[locale\\]/g,\n options.localeNameOrPlaceholder\n );\n }\n }\n }\n }\n }\n\n private static _addLoadersForLocFiles(\n options: IWebpackConfigurationUpdaterOptions,\n loader: string,\n loaderOptions: IBaseLoaderOptions\n ): void {\n const { globsToIgnore, configuration } = options;\n const rules: Webpack.RuleSetCondition =\n globsToIgnore && globsToIgnore.length > 0\n ? {\n include: Constants.RESOURCE_FILE_NAME_REGEXP,\n exclude: (filePath: string): boolean =>\n globsToIgnore.some((glob: string): boolean => minimatch(filePath, glob))\n }\n : Constants.RESOURCE_FILE_NAME_REGEXP;\n WebpackConfigurationUpdater._addRulesToConfiguration(configuration, [\n {\n test: rules,\n use: [\n {\n loader: loader,\n options: loaderOptions\n }\n ],\n type: 'json',\n sideEffects: false\n }\n ]);\n }\n\n private static _addRulesToConfiguration(\n configuration: Webpack.Configuration,\n rules: Webpack.RuleSetRule[]\n ): void {\n if (!configuration.module) {\n configuration.module = {\n rules: []\n };\n }\n\n if (!configuration.module.rules) {\n configuration.module.rules = [];\n }\n\n configuration.module.rules.push(...rules);\n }\n\n private static _tryUpdateSourceMapFilename(configuration: Webpack.Configuration): void {\n if (!configuration.output) {\n configuration.output = {}; // This should never happen\n }\n\n if (configuration.output.sourceMapFilename !== undefined) {\n configuration.output.sourceMapFilename = configuration.output.sourceMapFilename.replace(\n FILE_TOKEN_REGEX,\n Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN\n );\n }\n }\n}\n"]}
1
+ {"version":3,"file":"WebpackConfigurationUpdater.js","sourceRoot":"","sources":["../src/WebpackConfigurationUpdater.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,0DAAkC;AAClC,2CAA6B;AAG7B,oEAAsE;AAGtE,qDAAkD;AAelD,MAAM,gBAAgB,GAAW,IAAI,MAAM,CAAC,wBAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEzE,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;YAC1D,yBAAyB,EAAE,OAAO,CAAC,yBAAyB;YAC5D,YAAY,EAAE,OAAO,CAAC,YAAY;SACnC,CAAC;QAEF,2BAA2B,CAAC,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CA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Aa,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;IAC5C,CAAC;IAEO,MAAM,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;AAhID,kEAgIC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport minimatch from 'minimatch';\nimport * as path from 'path';\nimport type * as Webpack from 'webpack';\nimport type * as SetPublicPathPluginPackageType from '@rushstack/set-webpack-public-path-plugin';\nimport { type NewlineKind, Text } from '@rushstack/node-core-library';\nimport type { IgnoreStringFunction } from '@rushstack/localization-utilities';\n\nimport { Constants } from './utilities/Constants';\nimport type { LocalizationPlugin } from './LocalizationPlugin';\nimport type { ILocLoaderOptions } from './loaders/LocLoader';\nimport type { IBaseLoaderOptions } from './loaders/LoaderFactory';\n\nexport interface IWebpackConfigurationUpdaterOptions {\n pluginInstance: LocalizationPlugin;\n configuration: Webpack.Configuration;\n globsToIgnore: string[] | undefined;\n localeNameOrPlaceholder: string;\n resxNewlineNormalization: NewlineKind | undefined;\n ignoreMissingResxComments: boolean | undefined;\n ignoreString: IgnoreStringFunction | undefined;\n}\n\nconst FILE_TOKEN_REGEX: RegExp = new RegExp(Text.escapeRegExp('[file]'));\n\nexport class WebpackConfigurationUpdater {\n public static amendWebpackConfigurationForMultiLocale(options: IWebpackConfigurationUpdaterOptions): void {\n const loader: string = path.resolve(__dirname, 'loaders', 'LocLoader.js');\n const loaderOptions: ILocLoaderOptions = {\n pluginInstance: options.pluginInstance,\n resxNewlineNormalization: options.resxNewlineNormalization,\n ignoreMissingResxComments: options.ignoreMissingResxComments,\n ignoreString: options.ignoreString\n };\n\n WebpackConfigurationUpdater._addLoadersForLocFiles(options, loader, loaderOptions);\n\n WebpackConfigurationUpdater._tryUpdateLocaleTokenInPublicPathPlugin(options);\n\n WebpackConfigurationUpdater._tryUpdateSourceMapFilename(options.configuration);\n }\n\n public static amendWebpackConfigurationForInPlaceLocFiles(\n options: IWebpackConfigurationUpdaterOptions\n ): void {\n const loader: string = path.resolve(__dirname, 'loaders', 'InPlaceLocFileLoader.js');\n const loaderOptions: IBaseLoaderOptions = {\n resxNewlineNormalization: options.resxNewlineNormalization,\n ignoreMissingResxComments: options.ignoreMissingResxComments,\n ignoreString: options.ignoreString\n };\n\n WebpackConfigurationUpdater._addRulesToConfiguration(options.configuration, [\n {\n test: Constants.RESOURCE_FILE_NAME_REGEXP,\n use: [\n {\n loader: loader,\n options: loaderOptions\n }\n ],\n type: 'json',\n sideEffects: false\n }\n ]);\n }\n\n private static _tryUpdateLocaleTokenInPublicPathPlugin(options: IWebpackConfigurationUpdaterOptions): void {\n let setPublicPathPlugin: typeof SetPublicPathPluginPackageType.SetPublicPathPlugin | undefined;\n try {\n const pluginPackage: typeof SetPublicPathPluginPackageType = require('@rushstack/set-webpack-public-path-plugin');\n setPublicPathPlugin = pluginPackage.SetPublicPathPlugin;\n } catch (e) {\n // public path plugin isn't present - ignore\n }\n\n if (setPublicPathPlugin && options.configuration.plugins) {\n for (const plugin of options.configuration.plugins) {\n if (plugin instanceof setPublicPathPlugin) {\n if (\n plugin.options &&\n plugin.options.scriptName &&\n plugin.options.scriptName.isTokenized &&\n plugin.options.scriptName.name\n ) {\n plugin.options.scriptName.name = plugin.options.scriptName.name.replace(\n /\\[locale\\]/g,\n options.localeNameOrPlaceholder\n );\n }\n }\n }\n }\n }\n\n private static _addLoadersForLocFiles(\n options: IWebpackConfigurationUpdaterOptions,\n loader: string,\n loaderOptions: IBaseLoaderOptions\n ): void {\n const { globsToIgnore, configuration } = options;\n const rules: Webpack.RuleSetCondition =\n globsToIgnore && globsToIgnore.length > 0\n ? {\n include: Constants.RESOURCE_FILE_NAME_REGEXP,\n exclude: (filePath: string): boolean =>\n globsToIgnore.some((glob: string): boolean => minimatch(filePath, glob))\n }\n : Constants.RESOURCE_FILE_NAME_REGEXP;\n WebpackConfigurationUpdater._addRulesToConfiguration(configuration, [\n {\n test: rules,\n use: [\n {\n loader: loader,\n options: loaderOptions\n }\n ],\n type: 'json',\n sideEffects: false\n }\n ]);\n }\n\n private static _addRulesToConfiguration(\n configuration: Webpack.Configuration,\n rules: Webpack.RuleSetRule[]\n ): void {\n if (!configuration.module) {\n configuration.module = {\n rules: []\n };\n }\n\n if (!configuration.module.rules) {\n configuration.module.rules = [];\n }\n\n configuration.module.rules.push(...rules);\n }\n\n private static _tryUpdateSourceMapFilename(configuration: Webpack.Configuration): void {\n if (!configuration.output) {\n configuration.output = {}; // This should never happen\n }\n\n if (configuration.output.sourceMapFilename !== undefined) {\n configuration.output.sourceMapFilename = configuration.output.sourceMapFilename.replace(\n FILE_TOKEN_REGEX,\n Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN\n );\n }\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { IgnoreStringFunction, IPseudolocaleOptions } from '@rushstack/localization-utilities';
1
+ import type { IgnoreStringFunction, IPseudolocaleOptions } from '@rushstack/localization-utilities';
2
2
  /**
3
3
  * Options for the passthrough locale.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAE/F;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,C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EG;AACH,MAAM,WAAW,4BAA4B;IAC3C,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,eAAe,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,eAAe,CAAC;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,eAAe,EAAE,iBAAiB,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,eAAe,EAAE,iBAAiB,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,4BAA4B,CAAA;KAAE,CAAC;IAC9D,gBAAgB,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,4BAA4B,CAAA;KAAE,CAAC;CACpE"}
@@ -1 +1 @@
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.\n// See LICENSE in the project root for license information.\n\nimport { IgnoreStringFunction, IPseudolocaleOptions } from '@rushstack/localization-utilities';\n\n/**\n * Options for the passthrough locale.\n *\n * @public\n */\nexport interface IPassthroughLocaleOptions {\n /**\n * If this is set to `true`, a passthrough locale will be included in the output\n */\n usePassthroughLocale?: boolean;\n\n /**\n * If {@link IPassthroughLocaleOptions.usePassthroughLocale} is set, use this name for the passthrough locale.\n * Defaults to \"passthrough\"\n */\n passthroughLocaleName?: string;\n}\n\n/**\n * Options for typing generation.\n *\n * @public\n */\nexport interface ITypingsGenerationOptions {\n /**\n * This property specifies the folder in which `.d.ts` files for loc files should be dropped.\n */\n generatedTsFolder: string;\n\n /**\n * Optional additional folders into which `.d.ts` files for loc files should be dropped.\n */\n secondaryGeneratedTsFolders?: string[];\n\n /**\n * This optional property overrides the compiler context for discovery of localization files\n * for which typings should be generated.\n */\n sourceRoot?: string;\n\n /**\n * If this option is set to `true`, loc modules typings will be exported wrapped in a `default` property.\n */\n exportAsDefault?: boolean;\n\n /**\n * @deprecated\n * Use {@link ILocalizationPluginOptions.ignoreString} instead.\n *\n * @internalRemarks\n * TODO: Remove when version 1.0.0 is released.\n */\n ignoreString?: (resxFilePath: string, stringName: string) => boolean;\n\n /**\n * Optionally, provide a function that will process string comments. The returned value will become the\n * TSDoc comment for the string in the typings.\n */\n processComment?: (\n comment: string | undefined,\n resxFilePath: string,\n stringName: string\n ) => string | undefined;\n}\n\n/**\n * @public\n */\nexport interface IDefaultLocaleOptions {\n /**\n * This required property specifies the name of the locale used in the\n * `.resx`, `.loc.json`, and `.resjson` files in the source\n */\n localeName: string;\n\n /**\n * If this option is set to `true`, strings that are missing from\n * `localizedData.translatedStrings` will be provided by the default locale\n */\n fillMissingTranslationStrings?: boolean;\n}\n\n/**\n * Options for generated pseudolocales.\n *\n * @public\n */\nexport interface IPseudolocalesOptions {\n [pseudoLocaleName: string]: IPseudolocaleOptions;\n}\n\n/**\n * @public\n */\nexport interface ILocalizedData {\n /**\n * Options for the locale used in the source localized data files.\n */\n defaultLocale: IDefaultLocaleOptions;\n\n /**\n * Use this parameter to specify the translated data.\n */\n translatedStrings: ILocalizedStrings;\n\n /**\n * Use this parameter to specify a function used to load translations missing from\n * the {@link ILocalizedData.translatedStrings} parameter.\n */\n resolveMissingTranslatedStrings?: (locales: string[], filePath: string) => IResolvedMissingTranslations;\n\n /**\n * Options around including a passthrough locale.\n */\n passthroughLocale?: IPassthroughLocaleOptions;\n\n /**\n * Options for pseudo-localization.\n */\n pseudolocales?: IPseudolocalesOptions;\n\n /**\n * Normalize newlines in RESX files to either CRLF (Windows-style) or LF ('nix style)\n */\n normalizeResxNewlines?: 'lf' | 'crlf';\n\n /**\n * If set to true, do not warn on missing RESX `<data>` element comments.\n */\n ignoreMissingResxComments?: boolean;\n}\n\n/**\n * Options for how localization stats data should be produced.\n *\n * @public\n */\nexport interface ILocalizationStatsOptions {\n /**\n * This option is used to designate a path at which a JSON file describing the localized\n * assets produced should be written.\n */\n dropPath?: string;\n\n /**\n * This option is used to specify a callback to be called with the stats data that would be\n * dropped at `localizationStats.dropPath` after compilation completes.\n */\n callback?: (stats: ILocalizationStats) => void;\n}\n\n/**\n * The options for localization.\n *\n * @public\n */\nexport interface ILocalizationPluginOptions {\n /**\n * Localization data.\n */\n localizedData: ILocalizedData;\n\n /**\n * This option is used to specify `.resx`, `.resx.json`, and `.loc.json` files that should not be processed by\n * this plugin.\n */\n globsToIgnore?: string[];\n\n /**\n * The value to replace the [locale] token with for chunks without localized strings. Defaults to \"none\"\n */\n noStringsLocaleName?: string;\n\n /**\n * Options for how localization stats data should be produced.\n */\n localizationStats?: ILocalizationStatsOptions;\n\n /**\n * This option is used to specify how and if TypeScript typings should be generated for loc files.\n */\n typingsOptions?: ITypingsGenerationOptions;\n\n /**\n * Optionally, provide a function that will be called for each string. If the function returns `true`\n * the string will not be included.\n */\n ignoreString?: IgnoreStringFunction;\n\n /**\n * @deprecated\n * Use {@link ILocalizationPluginOptions.globsToIgnore} instead.\n *\n * @internalRemarks\n * TODO: Remove when version 1.0.0 is released.\n */\n filesToIgnore?: string[];\n}\n\n/**\n * @public\n */\nexport interface ILocaleFileData {\n [stringName: string]: string;\n}\n\n/**\n * @public\n */\nexport interface IResolvedMissingTranslations {\n [localeName: string]: string | ILocaleFileData;\n}\n\n/**\n * @public\n */\nexport interface ILocaleData {\n [locFilePath: string]: string | ILocaleFileData;\n}\n\n/**\n * @public\n */\nexport interface ILocalizedStrings {\n [locale: string]: ILocaleData;\n}\n\n/**\n * @public\n */\nexport interface ILocaleElementMap {\n [locale: string]: string;\n}\n\n/**\n * @public\n */\nexport interface ILocalizationStatsEntrypoint {\n localizedAssets: ILocaleElementMap;\n}\n\n/**\n * @public\n */\nexport interface ILocalizationStatsChunkGroup {\n localizedAssets: ILocaleElementMap;\n}\n\n/**\n * @public\n */\nexport interface ILocalizationStats {\n entrypoints: { [name: string]: ILocalizationStatsEntrypoint };\n namedChunkGroups: { [name: string]: ILocalizationStatsChunkGroup };\n}\n"]}
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.\n// See LICENSE in the project root for license information.\n\nimport type { IgnoreStringFunction, IPseudolocaleOptions } from '@rushstack/localization-utilities';\n\n/**\n * Options for the passthrough locale.\n *\n * @public\n */\nexport interface IPassthroughLocaleOptions {\n /**\n * If this is set to `true`, a passthrough locale will be included in the output\n */\n usePassthroughLocale?: boolean;\n\n /**\n * If {@link IPassthroughLocaleOptions.usePassthroughLocale} is set, use this name for the passthrough locale.\n * Defaults to \"passthrough\"\n */\n passthroughLocaleName?: string;\n}\n\n/**\n * Options for typing generation.\n *\n * @public\n */\nexport interface ITypingsGenerationOptions {\n /**\n * This property specifies the folder in which `.d.ts` files for loc files should be dropped.\n */\n generatedTsFolder: string;\n\n /**\n * Optional additional folders into which `.d.ts` files for loc files should be dropped.\n */\n secondaryGeneratedTsFolders?: string[];\n\n /**\n * This optional property overrides the compiler context for discovery of localization files\n * for which typings should be generated.\n */\n sourceRoot?: string;\n\n /**\n * If this option is set to `true`, loc modules typings will be exported wrapped in a `default` property.\n */\n exportAsDefault?: boolean;\n\n /**\n * @deprecated\n * Use {@link ILocalizationPluginOptions.ignoreString} instead.\n *\n * @internalRemarks\n * TODO: Remove when version 1.0.0 is released.\n */\n ignoreString?: (resxFilePath: string, stringName: string) => boolean;\n\n /**\n * Optionally, provide a function that will process string comments. The returned value will become the\n * TSDoc comment for the string in the typings.\n */\n processComment?: (\n comment: string | undefined,\n resxFilePath: string,\n stringName: string\n ) => string | undefined;\n}\n\n/**\n * @public\n */\nexport interface IDefaultLocaleOptions {\n /**\n * This required property specifies the name of the locale used in the\n * `.resx`, `.loc.json`, and `.resjson` files in the source\n */\n localeName: string;\n\n /**\n * If this option is set to `true`, strings that are missing from\n * `localizedData.translatedStrings` will be provided by the default locale\n */\n fillMissingTranslationStrings?: boolean;\n}\n\n/**\n * Options for generated pseudolocales.\n *\n * @public\n */\nexport interface IPseudolocalesOptions {\n [pseudoLocaleName: string]: IPseudolocaleOptions;\n}\n\n/**\n * @public\n */\nexport interface ILocalizedData {\n /**\n * Options for the locale used in the source localized data files.\n */\n defaultLocale: IDefaultLocaleOptions;\n\n /**\n * Use this parameter to specify the translated data.\n */\n translatedStrings: ILocalizedStrings;\n\n /**\n * Use this parameter to specify a function used to load translations missing from\n * the {@link ILocalizedData.translatedStrings} parameter.\n */\n resolveMissingTranslatedStrings?: (locales: string[], filePath: string) => IResolvedMissingTranslations;\n\n /**\n * Options around including a passthrough locale.\n */\n passthroughLocale?: IPassthroughLocaleOptions;\n\n /**\n * Options for pseudo-localization.\n */\n pseudolocales?: IPseudolocalesOptions;\n\n /**\n * Normalize newlines in RESX files to either CRLF (Windows-style) or LF ('nix style)\n */\n normalizeResxNewlines?: 'lf' | 'crlf';\n\n /**\n * If set to true, do not warn on missing RESX `<data>` element comments.\n */\n ignoreMissingResxComments?: boolean;\n}\n\n/**\n * Options for how localization stats data should be produced.\n *\n * @public\n */\nexport interface ILocalizationStatsOptions {\n /**\n * This option is used to designate a path at which a JSON file describing the localized\n * assets produced should be written.\n */\n dropPath?: string;\n\n /**\n * This option is used to specify a callback to be called with the stats data that would be\n * dropped at `localizationStats.dropPath` after compilation completes.\n */\n callback?: (stats: ILocalizationStats) => void;\n}\n\n/**\n * The options for localization.\n *\n * @public\n */\nexport interface ILocalizationPluginOptions {\n /**\n * Localization data.\n */\n localizedData: ILocalizedData;\n\n /**\n * This option is used to specify `.resx`, `.resx.json`, and `.loc.json` files that should not be processed by\n * this plugin.\n */\n globsToIgnore?: string[];\n\n /**\n * The value to replace the [locale] token with for chunks without localized strings. Defaults to \"none\"\n */\n noStringsLocaleName?: string;\n\n /**\n * Options for how localization stats data should be produced.\n */\n localizationStats?: ILocalizationStatsOptions;\n\n /**\n * This option is used to specify how and if TypeScript typings should be generated for loc files.\n */\n typingsOptions?: ITypingsGenerationOptions;\n\n /**\n * Optionally, provide a function that will be called for each string. If the function returns `true`\n * the string will not be included.\n */\n ignoreString?: IgnoreStringFunction;\n\n /**\n * @deprecated\n * Use {@link ILocalizationPluginOptions.globsToIgnore} instead.\n *\n * @internalRemarks\n * TODO: Remove when version 1.0.0 is released.\n */\n filesToIgnore?: string[];\n}\n\n/**\n * @public\n */\nexport interface ILocaleFileData {\n [stringName: string]: string;\n}\n\n/**\n * @public\n */\nexport interface IResolvedMissingTranslations {\n [localeName: string]: string | ILocaleFileData;\n}\n\n/**\n * @public\n */\nexport interface ILocaleData {\n [locFilePath: string]: string | ILocaleFileData;\n}\n\n/**\n * @public\n */\nexport interface ILocalizedStrings {\n [locale: string]: ILocaleData;\n}\n\n/**\n * @public\n */\nexport interface ILocaleElementMap {\n [locale: string]: string;\n}\n\n/**\n * @public\n */\nexport interface ILocalizationStatsEntrypoint {\n localizedAssets: ILocaleElementMap;\n}\n\n/**\n * @public\n */\nexport interface ILocalizationStatsChunkGroup {\n localizedAssets: ILocaleElementMap;\n}\n\n/**\n * @public\n */\nexport interface ILocalizationStats {\n entrypoints: { [name: string]: ILocalizationStatsEntrypoint };\n namedChunkGroups: { [name: string]: ILocalizationStatsChunkGroup };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { loader } from 'webpack';
1
+ import type { loader } from 'webpack';
2
2
  declare const _default: loader.Loader;
3
3
  export default _default;
4
4
  //# sourceMappingURL=InPlaceLocFileLoader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InPlaceLocFileLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/InPlaceLocFileLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;;AAOjC,wBAkBG"}
1
+ {"version":3,"file":"InPlaceLocFileLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/InPlaceLocFileLoader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;;AAOtC,wBAkBG"}
@@ -1 +1 @@
1
- {"version":3,"file":"InPlaceLocFileLoader.js","sourceRoot":"","sources":["../../src/loaders/InPlaceLocFileLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAG3D,oEAAwD;AACxD,8EAAoF;AAEpF,mDAAoE;AACpE,gFAA6E;AAE7E,kBAAe,IAAA,6BAAa,EAAC,UAE3B,WAAmB,EACnB,OAAe,EACf,OAA2B;IAE3B,MAAM,WAAW,GAAsB,IAAA,qCAAY,kCAC9C,OAAO,KACV,OAAO,EACP,QAAQ,EAAE,WAAW,EACrB,QAAQ,EAAE,IAAI,4BAAQ,CAAC,+CAAsB,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC,IACjF,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.\n// See LICENSE in the project root for license information.\n\nimport { loader } from 'webpack';\nimport { Terminal } from '@rushstack/node-core-library';\nimport { ILocalizationFile, parseLocFile } from '@rushstack/localization-utilities';\n\nimport { loaderFactory, IBaseLoaderOptions } from './LoaderFactory';\nimport { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';\n\nexport default loaderFactory(function (\n this: loader.LoaderContext,\n locFilePath: string,\n content: string,\n options: IBaseLoaderOptions\n) {\n const locFileData: ILocalizationFile = parseLocFile({\n ...options,\n content,\n filePath: locFilePath,\n terminal: new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(this))\n });\n const resultObject: { [stringName: string]: string } = {};\n for (const [stringName, stringValue] of Object.entries(locFileData)) {\n resultObject[stringName] = stringValue.value;\n }\n\n return resultObject;\n});\n"]}
1
+ {"version":3,"file":"InPlaceLocFileLoader.js","sourceRoot":"","sources":["../../src/loaders/InPlaceLocFileLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAG3D,oEAAwD;AACxD,8EAAyF;AAEzF,mDAAyE;AACzE,gFAA6E;AAE7E,kBAAe,IAAA,6BAAa,EAAC,UAE3B,WAAmB,EACnB,OAAe,EACf,OAA2B;IAE3B,MAAM,WAAW,GAAsB,IAAA,qCAAY,kCAC9C,OAAO,KACV,OAAO,EACP,QAAQ,EAAE,WAAW,EACrB,QAAQ,EAAE,IAAI,4BAAQ,CAAC,+CAAsB,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC,IACjF,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.\n// See LICENSE in the project root for license information.\n\nimport type { loader } from 'webpack';\nimport { Terminal } from '@rushstack/node-core-library';\nimport { type ILocalizationFile, parseLocFile } from '@rushstack/localization-utilities';\n\nimport { loaderFactory, type IBaseLoaderOptions } from './LoaderFactory';\nimport { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';\n\nexport default loaderFactory(function (\n this: loader.LoaderContext,\n locFilePath: string,\n content: string,\n options: IBaseLoaderOptions\n) {\n const locFileData: ILocalizationFile = parseLocFile({\n ...options,\n content,\n filePath: locFilePath,\n terminal: new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(this))\n });\n const resultObject: { [stringName: string]: string } = {};\n for (const [stringName, stringValue] of Object.entries(locFileData)) {\n resultObject[stringName] = stringValue.value;\n }\n\n return resultObject;\n});\n"]}
@@ -1,5 +1,5 @@
1
- import { loader } from 'webpack';
2
- import { NewlineKind } from '@rushstack/node-core-library';
1
+ import type { loader } from 'webpack';
2
+ import type { NewlineKind } from '@rushstack/node-core-library';
3
3
  import type { IgnoreStringFunction } from '@rushstack/localization-utilities';
4
4
  export interface IBaseLoaderOptions {
5
5
  resxNewlineNormalization: NewlineKind | undefined;
@@ -1 +1 @@
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;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,MAAM,WAAW,kBAAkB;IACjC,wBAAwB,EAAE,WAAW,GAAG,SAAS,CAAC;IAClD,yBAAyB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/C,YAAY,EAAE,oBAAoB,GAAG,SAAS,CAAC;CAChD;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
+ {"version":3,"file":"LoaderFactory.d.ts","sourceRoot":"","sources":["../../src/loaders/LoaderFactory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,MAAM,WAAW,kBAAkB;IACjC,wBAAwB,EAAE,WAAW,GAAG,SAAS,CAAC;IAClD,yBAAyB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/C,YAAY,EAAE,oBAAoB,GAAG,SAAS,CAAC;CAChD;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 @@
1
- {"version":3,"file":"LoaderFactory.js","sourceRoot":"","sources":["../../src/loaders/LoaderFactory.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAG3D,0DAA4C;AAc5C,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.\n// See LICENSE in the project root for license information.\n\nimport { loader } from 'webpack';\nimport * as loaderUtils from 'loader-utils';\nimport { NewlineKind } from '@rushstack/node-core-library';\nimport type { IgnoreStringFunction } from '@rushstack/localization-utilities';\n\nexport interface IBaseLoaderOptions {\n resxNewlineNormalization: NewlineKind | undefined;\n ignoreMissingResxComments: boolean | undefined;\n ignoreString: IgnoreStringFunction | undefined;\n}\n\nexport interface ILoaderResult {\n [stringName: string]: string;\n}\n\nexport function loaderFactory<TOptions extends IBaseLoaderOptions>(\n innerLoader: (locFilePath: string, content: string, options: TOptions) => ILoaderResult\n): loader.Loader {\n return function (this: loader.LoaderContext, content: string | Buffer): string {\n const options: TOptions = loaderUtils.getOptions(this) as TOptions;\n if (typeof content !== 'string') {\n content = content.toString();\n }\n\n const resultObject: ILoaderResult = innerLoader.call(this, this.resourcePath, content, options);\n return JSON.stringify(resultObject);\n };\n}\n"]}
1
+ {"version":3,"file":"LoaderFactory.js","sourceRoot":"","sources":["../../src/loaders/LoaderFactory.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAG3D,0DAA4C;AAc5C,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.\n// See LICENSE in the project root for license information.\n\nimport type { loader } from 'webpack';\nimport * as loaderUtils from 'loader-utils';\nimport type { NewlineKind } from '@rushstack/node-core-library';\nimport type { IgnoreStringFunction } from '@rushstack/localization-utilities';\n\nexport interface IBaseLoaderOptions {\n resxNewlineNormalization: NewlineKind | undefined;\n ignoreMissingResxComments: boolean | undefined;\n ignoreString: IgnoreStringFunction | undefined;\n}\n\nexport interface ILoaderResult {\n [stringName: string]: string;\n}\n\nexport function loaderFactory<TOptions extends IBaseLoaderOptions>(\n innerLoader: (locFilePath: string, content: string, options: TOptions) => ILoaderResult\n): loader.Loader {\n return function (this: loader.LoaderContext, content: string | Buffer): string {\n const options: TOptions = loaderUtils.getOptions(this) as TOptions;\n if (typeof content !== 'string') {\n content = content.toString();\n }\n\n const resultObject: ILoaderResult = innerLoader.call(this, this.resourcePath, content, options);\n return JSON.stringify(resultObject);\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { loader } from 'webpack';
2
- import { LocalizationPlugin } from '../LocalizationPlugin';
3
- import { IBaseLoaderOptions } from './LoaderFactory';
1
+ import type { loader } from 'webpack';
2
+ import type { LocalizationPlugin } from '../LocalizationPlugin';
3
+ import { type IBaseLoaderOptions } from './LoaderFactory';
4
4
  export interface ILocLoaderOptions extends IBaseLoaderOptions {
5
5
  pluginInstance: LocalizationPlugin;
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LocLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/LocLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAIjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAiB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIpE,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,cAAc,EAAE,kBAAkB,CAAC;CACpC;;AAED,wBAyCG"}
1
+ {"version":3,"file":"LocLoader.d.ts","sourceRoot":"","sources":["../../src/loaders/LocLoader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAItC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIzE,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,cAAc,EAAE,kBAAkB,CAAC;CACpC;;AAED,wBAyCG"}
@@ -1 +1 @@
1
- {"version":3,"file":"LocLoader.js","sourceRoot":"","sources":["../../src/loaders/LocLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAG3D,oEAAwD;AACxD,8EAAoF;AAGpF,mDAAoE;AACpE,4DAAyD;AACzD,gFAA6E;AAM7E,kBAAe,IAAA,6BAAa,EAAC,UAE3B,WAAmB,EACnB,OAAe,EACf,OAA0B;IAE1B,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IACnC,MAAM,QAAQ,GAAa,IAAI,4BAAQ,CAAC,+CAAsB,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC;IACnG,MAAM,WAAW,GAAsB,IAAA,qCAAY,kCAC9C,OAAO,KACV,OAAO;QACP,QAAQ,EACR,QAAQ,EAAE,WAAW,IACrB,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.\n// See LICENSE in the project root for license information.\n\nimport { loader } from 'webpack';\nimport { Terminal } from '@rushstack/node-core-library';\nimport { ILocalizationFile, parseLocFile } from '@rushstack/localization-utilities';\n\nimport { LocalizationPlugin } from '../LocalizationPlugin';\nimport { loaderFactory, IBaseLoaderOptions } from './LoaderFactory';\nimport { EntityMarker } from '../utilities/EntityMarker';\nimport { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';\n\nexport interface ILocLoaderOptions extends IBaseLoaderOptions {\n pluginInstance: LocalizationPlugin;\n}\n\nexport default loaderFactory(function (\n this: loader.LoaderContext,\n locFilePath: string,\n content: string,\n options: ILocLoaderOptions\n) {\n const { pluginInstance } = options;\n const terminal: Terminal = new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(this));\n const locFileData: ILocalizationFile = parseLocFile({\n ...options,\n content,\n terminal,\n filePath: locFilePath\n });\n const { additionalLoadedFilePaths, errors } = pluginInstance.addDefaultLocFile(\n terminal,\n locFilePath,\n locFileData\n );\n for (const additionalFile of additionalLoadedFilePaths) {\n this.dependency(additionalFile);\n }\n\n for (const error of errors) {\n this.emitError(error);\n }\n\n const resultObject: { [stringName: string]: string } = {};\n // eslint-disable-next-line guard-for-in\n for (const stringName in locFileData) {\n const stringKey: string = `${locFilePath}?${stringName}`;\n if (pluginInstance.stringKeys.has(stringKey)) {\n resultObject[stringName] = pluginInstance.stringKeys.get(stringKey)!.value;\n } else {\n throw new Error(`Unexpected - missing placeholder for string key \"${stringKey}\"`);\n }\n }\n\n EntityMarker.markEntity(this._module, true);\n\n return resultObject;\n});\n"]}
1
+ {"version":3,"file":"LocLoader.js","sourceRoot":"","sources":["../../src/loaders/LocLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAG3D,oEAAwD;AACxD,8EAAyF;AAGzF,mDAAyE;AACzE,4DAAyD;AACzD,gFAA6E;AAM7E,kBAAe,IAAA,6BAAa,EAAC,UAE3B,WAAmB,EACnB,OAAe,EACf,OAA0B;IAE1B,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IACnC,MAAM,QAAQ,GAAa,IAAI,4BAAQ,CAAC,+CAAsB,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC;IACnG,MAAM,WAAW,GAAsB,IAAA,qCAAY,kCAC9C,OAAO,KACV,OAAO;QACP,QAAQ,EACR,QAAQ,EAAE,WAAW,IACrB,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.\n// See LICENSE in the project root for license information.\n\nimport type { loader } from 'webpack';\nimport { Terminal } from '@rushstack/node-core-library';\nimport { type ILocalizationFile, parseLocFile } from '@rushstack/localization-utilities';\n\nimport type { LocalizationPlugin } from '../LocalizationPlugin';\nimport { loaderFactory, type IBaseLoaderOptions } from './LoaderFactory';\nimport { EntityMarker } from '../utilities/EntityMarker';\nimport { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';\n\nexport interface ILocLoaderOptions extends IBaseLoaderOptions {\n pluginInstance: LocalizationPlugin;\n}\n\nexport default loaderFactory(function (\n this: loader.LoaderContext,\n locFilePath: string,\n content: string,\n options: ILocLoaderOptions\n) {\n const { pluginInstance } = options;\n const terminal: Terminal = new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(this));\n const locFileData: ILocalizationFile = parseLocFile({\n ...options,\n content,\n terminal,\n filePath: locFilePath\n });\n const { additionalLoadedFilePaths, errors } = pluginInstance.addDefaultLocFile(\n terminal,\n locFilePath,\n locFileData\n );\n for (const additionalFile of additionalLoadedFilePaths) {\n this.dependency(additionalFile);\n }\n\n for (const error of errors) {\n this.emitError(error);\n }\n\n const resultObject: { [stringName: string]: string } = {};\n // eslint-disable-next-line guard-for-in\n for (const stringName in locFileData) {\n const stringKey: string = `${locFilePath}?${stringName}`;\n if (pluginInstance.stringKeys.has(stringKey)) {\n resultObject[stringName] = pluginInstance.stringKeys.get(stringKey)!.value;\n } else {\n throw new Error(`Unexpected - missing placeholder for string key \"${stringKey}\"`);\n }\n }\n\n EntityMarker.markEntity(this._module, true);\n\n return resultObject;\n});\n"]}
@@ -1,5 +1,5 @@
1
- import * as webpack from 'webpack';
2
- import { ITerminalProvider } from '@rushstack/node-core-library';
1
+ import type * as webpack from 'webpack';
2
+ import { type ITerminalProvider } from '@rushstack/node-core-library';
3
3
  export declare class LoaderTerminalProvider {
4
4
  static getTerminalProviderForLoader(loaderContext: webpack.loader.LoaderContext): ITerminalProvider;
5
5
  }
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"LoaderTerminalProvider.d.ts","sourceRoot":"","sources":["../../src/utilities/LoaderTerminalProvider.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,KAAK,iBAAiB,EAA4B,MAAM,8BAA8B,CAAC;AAEhG,qBAAa,sBAAsB;WACnB,4BAA4B,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,GAAG,iBAAiB;CAmB3G"}
@@ -1 +1 @@
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.\n// See LICENSE in the project root for license information.\n\nimport * as webpack from 'webpack';\nimport { ITerminalProvider, TerminalProviderSeverity } from '@rushstack/node-core-library';\n\nexport class LoaderTerminalProvider {\n public static getTerminalProviderForLoader(loaderContext: webpack.loader.LoaderContext): ITerminalProvider {\n return {\n supportsColor: false,\n eolCharacter: '\\n',\n write: (data: string, severity: TerminalProviderSeverity) => {\n switch (severity) {\n case TerminalProviderSeverity.error: {\n loaderContext.emitError(new Error(data));\n break;\n }\n\n case TerminalProviderSeverity.warning: {\n loaderContext.emitWarning(new Error(data));\n break;\n }\n }\n }\n };\n }\n}\n"]}
1
+ {"version":3,"file":"LoaderTerminalProvider.js","sourceRoot":"","sources":["../../src/utilities/LoaderTerminalProvider.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,oEAAgG;AAEhG,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.\n// See LICENSE in the project root for license information.\n\nimport type * as webpack from 'webpack';\nimport { type ITerminalProvider, TerminalProviderSeverity } from '@rushstack/node-core-library';\n\nexport class LoaderTerminalProvider {\n public static getTerminalProviderForLoader(loaderContext: webpack.loader.LoaderContext): ITerminalProvider {\n return {\n supportsColor: false,\n eolCharacter: '\\n',\n write: (data: string, severity: TerminalProviderSeverity) => {\n switch (severity) {\n case TerminalProviderSeverity.error: {\n loaderContext.emitError(new Error(data));\n break;\n }\n\n case TerminalProviderSeverity.warning: {\n loaderContext.emitWarning(new Error(data));\n break;\n }\n }\n }\n };\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import * as webpack from 'webpack';
1
+ import type * as webpack from 'webpack';
2
2
  /**
3
3
  * @public
4
4
  */
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"webpackInterfaces.d.ts","sourceRoot":"","sources":["../src/webpackInterfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAExC;;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 @@
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.\n// See LICENSE in the project root for license information.\n\nimport * as webpack from 'webpack';\n\n/**\n * @public\n */\nexport interface ILocalizedWebpackChunk extends webpack.compilation.Chunk {\n localizedFiles?: { [locale: string]: string };\n}\n"]}
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.\n// See LICENSE in the project root for license information.\n\nimport type * as webpack from 'webpack';\n\n/**\n * @public\n */\nexport interface ILocalizedWebpackChunk extends webpack.compilation.Chunk {\n localizedFiles?: { [locale: string]: string };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/webpack4-localization-plugin",
3
- "version": "0.18.3",
3
+ "version": "0.18.5",
4
4
  "description": "This plugin facilitates localization with Webpack.",
5
5
  "main": "lib/index.js",
6
6
  "typings": "dist/webpack4-localization-plugin.d.ts",
@@ -11,7 +11,7 @@
11
11
  "directory": "webpack/webpack4-localization-plugin"
12
12
  },
13
13
  "peerDependencies": {
14
- "@rushstack/set-webpack-public-path-plugin": "^4.1.3",
14
+ "@rushstack/set-webpack-public-path-plugin": "^4.1.5",
15
15
  "@types/webpack": "^4.39.0",
16
16
  "webpack": "^4.31.0",
17
17
  "@types/node": "*"
@@ -31,8 +31,8 @@
31
31
  "@types/tapable": "1.0.6",
32
32
  "loader-utils": "1.4.2",
33
33
  "minimatch": "~3.0.3",
34
- "@rushstack/localization-utilities": "0.9.3",
35
- "@rushstack/node-core-library": "3.60.0"
34
+ "@rushstack/localization-utilities": "0.9.5",
35
+ "@rushstack/node-core-library": "3.60.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/loader-utils": "1.1.3",
@@ -40,10 +40,9 @@
40
40
  "@types/node": "18.17.15",
41
41
  "@types/webpack": "4.41.32",
42
42
  "webpack": "~4.47.0",
43
- "@rushstack/eslint-config": "3.3.4",
44
- "@rushstack/heft": "0.61.1",
43
+ "@rushstack/heft": "0.61.3",
45
44
  "local-node-rig": "1.0.0",
46
- "@rushstack/set-webpack-public-path-plugin": "4.1.3"
45
+ "@rushstack/set-webpack-public-path-plugin": "4.1.5"
47
46
  },
48
47
  "scripts": {
49
48
  "build": "heft build --clean",