@rushstack/webpack4-localization-plugin 0.18.107 → 0.18.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json CHANGED
@@ -1,6 +1,47 @@
1
1
  {
2
2
  "name": "@rushstack/webpack4-localization-plugin",
3
3
  "entries": [
4
+ {
5
+ "version": "0.18.109",
6
+ "tag": "@rushstack/webpack4-localization-plugin_v0.18.109",
7
+ "date": "Fri, 01 Aug 2025 00:12:48 GMT",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "comment": "Upgrades the minimatch dependency from ~3.0.3 to 10.0.3 across the entire Rush monorepo to address a Regular Expression Denial of Service (ReDoS) vulnerability in the underlying brace-expansion dependency."
12
+ }
13
+ ],
14
+ "dependency": [
15
+ {
16
+ "comment": "Updating dependency \"@rushstack/localization-utilities\" to `0.13.18`"
17
+ },
18
+ {
19
+ "comment": "Updating dependency \"@rushstack/heft\" to `0.74.2`"
20
+ }
21
+ ]
22
+ }
23
+ },
24
+ {
25
+ "version": "0.18.108",
26
+ "tag": "@rushstack/webpack4-localization-plugin_v0.18.108",
27
+ "date": "Wed, 23 Jul 2025 20:55:57 GMT",
28
+ "comments": {
29
+ "dependency": [
30
+ {
31
+ "comment": "Updating dependency \"@rushstack/localization-utilities\" to `0.13.17`"
32
+ },
33
+ {
34
+ "comment": "Updating dependency \"@rushstack/node-core-library\" to `5.14.0`"
35
+ },
36
+ {
37
+ "comment": "Updating dependency \"@rushstack/terminal\" to `0.15.4`"
38
+ },
39
+ {
40
+ "comment": "Updating dependency \"@rushstack/heft\" to `0.74.1`"
41
+ }
42
+ ]
43
+ }
44
+ },
4
45
  {
5
46
  "version": "0.18.107",
6
47
  "tag": "@rushstack/webpack4-localization-plugin_v0.18.107",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Change Log - @rushstack/webpack4-localization-plugin
2
2
 
3
- This log was last generated on Sat, 21 Jun 2025 00:13:15 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 01 Aug 2025 00:12:48 GMT and should not be manually modified.
4
+
5
+ ## 0.18.109
6
+ Fri, 01 Aug 2025 00:12:48 GMT
7
+
8
+ ### Patches
9
+
10
+ - Upgrades the minimatch dependency from ~3.0.3 to 10.0.3 across the entire Rush monorepo to address a Regular Expression Denial of Service (ReDoS) vulnerability in the underlying brace-expansion dependency.
11
+
12
+ ## 0.18.108
13
+ Wed, 23 Jul 2025 20:55:57 GMT
14
+
15
+ _Version update only_
4
16
 
5
17
  ## 0.18.107
6
18
  Sat, 21 Jun 2025 00:13:15 GMT
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.8"
8
+ "packageVersion": "7.52.9"
9
9
  }
10
10
  ]
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AssetProcessor.d.ts","sourceRoot":"","sources":["../src/AssetProcessor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAIxC,OAAO,KAAK,EAAE,kBAAkB,EAA0C,MAAM,sBAAsB,CAAC;AAgDvG,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wBAAwB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,KAAK,OAAO,CAAC;CACzE;AAED,MAAM,WAAW,gCAAiC,SAAQ,wBAAwB;CAAG;AAErF,MAAM,WAAW,6BAA8B,SAAQ,wBAAwB;IAC7E,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,6B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BAA8B,SAAQ,wBAAwB;IAC7E,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,6BAA6B,EAAE,OAAO,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,IAAI,MAAM,CAAC;IACf,MAAM,IAAI,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,iBAAiB,EAAE,MAG/B,CAAC;AAEF,qBAAa,cAAc;WACX,qBAAqB,CACjC,OAAO,EAAE,6BAA6B,GACrC,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC;WA2DrB,wBAAwB,CAAC,OAAO,EAAE,gCAAgC,GAAG,mBAAmB;IAiDtG,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAiFpC,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAmDvC,OAAO,CAAC,MAAM,CAAC,oCAAoC;IAwFnD,OAAO,CAAC,MAAM,CAAC,iBAAiB;CAsDjC"}
@@ -163,7 +163,6 @@ class AssetProcessor {
163
163
  let lastIndex = 0;
164
164
  let regexResult;
165
165
  while ((regexResult = exports.PLACEHOLDER_REGEX.exec(source))) {
166
- // eslint-disable-line no-cond-assign
167
166
  const staticElement = {
168
167
  kind: 'static',
169
168
  staticString: source.substring(lastIndex, regexResult.index)
@@ -1 +1 @@
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,OA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AC,GAAG,CAAC,CAAC;YACrC,CAAC;YAED,OAAO,CAAC,MAAc,EAAE,YAAgC,EAAE,EAAE;gBAC1D,IAAI,CAAC,MAAM,EAAE,CAAC;oBACZ,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;gBAC1C,CAAC;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;QACJ,CAAC;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
+ {"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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SAAS,CAAC,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CACzE,YAAY,CACb,IAAI,YAAY,IAAI,CAAC;YACxB,CAAC,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAjYD,wCAiYC","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 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"]}
@@ -34,12 +34,9 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  return result;
35
35
  };
36
36
  })();
37
- var __importDefault = (this && this.__importDefault) || function (mod) {
38
- return (mod && mod.__esModule) ? mod : { "default": mod };
39
- };
40
37
  Object.defineProperty(exports, "__esModule", { value: true });
41
38
  exports.WebpackConfigurationUpdater = void 0;
42
- const minimatch_1 = __importDefault(require("minimatch"));
39
+ const minimatch_1 = require("minimatch");
43
40
  const path = __importStar(require("path"));
44
41
  const node_core_library_1 = require("@rushstack/node-core-library");
45
42
  const Constants_1 = require("./utilities/Constants");
@@ -105,7 +102,7 @@ class WebpackConfigurationUpdater {
105
102
  const rules = globsToIgnore && globsToIgnore.length > 0
106
103
  ? {
107
104
  include: Constants_1.Constants.RESOURCE_FILE_NAME_REGEXP,
108
- exclude: (filePath) => globsToIgnore.some((glob) => (0, minimatch_1.default)(filePath, glob))
105
+ exclude: (filePath) => globsToIgnore.some((glob) => (0, minimatch_1.minimatch)(filePath, glob))
109
106
  }
110
107
  : Constants_1.Constants.RESOURCE_FILE_NAME_REGEXP;
111
108
  WebpackConfigurationUpdater._addRulesToConfiguration(configuration, [
@@ -1 +1 @@
1
- {"version":3,"file":"WebpackConfigurationUp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S,CAAC,mCAAmC,CAC9C,CAAC;QACJ,CAAC;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
+ {"version":3,"file":"WebpackConfigurationUpdater.js","sourceRoot":"","sources":["../src/WebpackConfigurationUpdater.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,yCAAsC;AACtC,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,CAAC,CAAC;QAEnF,2BAA2B,CAAC,uCAAuC,CAAC,OAAO,CAAC,CAAC;QAE7E,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AAE,CAAC;QAClC,CAAC;QAED,aAAa,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,CAAC;YAC1B,aAAa,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,2BAA2B;QACxD,CAAC;QAED,IAAI,aAAa,CAAC,MAAM,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;YACzD,aAAa,CAAC,MAAM,CAAC,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CACrF,gBAAgB,EAChB,qBAAS,CAAC,mCAAmC,CAC9C,CAAC;QACJ,CAAC;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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/webpack4-localization-plugin",
3
- "version": "0.18.107",
3
+ "version": "0.18.109",
4
4
  "description": "This plugin facilitates localization with Webpack.",
5
5
  "main": "lib/index.js",
6
6
  "typings": "dist/webpack4-localization-plugin.d.ts",
@@ -30,20 +30,20 @@
30
30
  "dependencies": {
31
31
  "@types/tapable": "1.0.6",
32
32
  "loader-utils": "1.4.2",
33
- "minimatch": "~3.0.3",
34
- "@rushstack/localization-utilities": "0.13.16",
35
- "@rushstack/terminal": "0.15.3",
36
- "@rushstack/node-core-library": "5.13.1"
33
+ "minimatch": "10.0.3",
34
+ "@rushstack/localization-utilities": "0.13.18",
35
+ "@rushstack/terminal": "0.15.4",
36
+ "@rushstack/node-core-library": "5.14.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@rushstack/set-webpack-public-path-plugin": "^4.1.16",
40
40
  "@types/loader-utils": "1.1.3",
41
- "@types/minimatch": "3.0.5",
42
41
  "@types/node": "20.17.19",
43
42
  "@types/webpack": "4.41.32",
43
+ "eslint": "~9.25.1",
44
44
  "webpack": "~4.47.0",
45
- "@rushstack/heft": "0.74.0",
46
- "local-node-rig": "1.0.0"
45
+ "local-node-rig": "1.0.0",
46
+ "@rushstack/heft": "0.74.2"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "heft build --clean",