@rushstack/webpack4-localization-plugin 0.14.6 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/webpack4-localization-plugin.d.ts +4 -0
- package/lib/LocalizationPlugin.d.ts.map +1 -1
- package/lib/LocalizationPlugin.js +10 -0
- package/lib/LocalizationPlugin.js.map +1 -1
- package/lib/interfaces.d.ts +4 -0
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/package.json +7 -7
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -249,6 +249,10 @@ export declare interface ITypingsGenerationOptions {
|
|
|
249
249
|
* This property specifies the folder in which `.d.ts` files for loc files should be dropped.
|
|
250
250
|
*/
|
|
251
251
|
generatedTsFolder: string;
|
|
252
|
+
/**
|
|
253
|
+
* Optional additional folders into which `.d.ts` files for loc files should be dropped.
|
|
254
|
+
*/
|
|
255
|
+
secondaryGeneratedTsFolders?: string[];
|
|
252
256
|
/**
|
|
253
257
|
* This optional property overrides the compiler context for discovery of localization files
|
|
254
258
|
* for which typings should be generated.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizationPlugin.d.ts","sourceRoot":"","sources":["../src/LocalizationPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwB,SAAS,EAAe,MAAM,8BAA8B,CAAC;AAC5F,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAEL,iBAAiB,EAGlB,MAAM,mCAAmC,CAAC;AAO3C,OAAO,EACL,0BAA0B,EAG1B,iBAAiB,EAGlB,MAAM,cAAc,CAAC;AAKtB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,yBAAyB,EAAE,MA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AAE,MAAM,GAAG,uBAAuB,GAAG,SAAS;IAIxF,OAAO,CAAC,WAAW;IAkCnB,OAAO,CAAC,6BAA6B;IAiNrC,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,yBAAyB;IA+BjC,OAAO,CAAC,iCAAiC;CAQ1C"}
|
|
@@ -80,6 +80,15 @@ class LocalizationPlugin {
|
|
|
80
80
|
!path.isAbsolute(this._options.typingsOptions.sourceRoot)) {
|
|
81
81
|
this._options.typingsOptions.sourceRoot = path.resolve(compiler.context, this._options.typingsOptions.sourceRoot);
|
|
82
82
|
}
|
|
83
|
+
const secondaryGeneratedTsFolders = this._options.typingsOptions.secondaryGeneratedTsFolders;
|
|
84
|
+
if (secondaryGeneratedTsFolders) {
|
|
85
|
+
for (let i = 0; i < secondaryGeneratedTsFolders.length; i++) {
|
|
86
|
+
const secondaryGeneratedTsFolder = secondaryGeneratedTsFolders[i];
|
|
87
|
+
if (!path.isAbsolute(secondaryGeneratedTsFolder)) {
|
|
88
|
+
secondaryGeneratedTsFolders[i] = path.resolve(compiler.context, secondaryGeneratedTsFolder);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
83
92
|
}
|
|
84
93
|
// https://github.com/webpack/webpack-dev-server/pull/1929/files#diff-15fb51940da53816af13330d8ce69b4eR66
|
|
85
94
|
const isWebpackDevServer = process.env.WEBPACK_DEV_SERVER === 'true';
|
|
@@ -89,6 +98,7 @@ class LocalizationPlugin {
|
|
|
89
98
|
typingsPreprocessor = new localization_utilities_1.TypingsGenerator({
|
|
90
99
|
srcFolder: this._options.typingsOptions.sourceRoot || compiler.context,
|
|
91
100
|
generatedTsFolder: this._options.typingsOptions.generatedTsFolder,
|
|
101
|
+
secondaryGeneratedTsFolders: this._options.typingsOptions.secondaryGeneratedTsFolders,
|
|
92
102
|
exportAsDefault: this._options.typingsOptions.exportAsDefault,
|
|
93
103
|
globsToIgnore: this._options.globsToIgnore,
|
|
94
104
|
ignoreString: this._options.ignore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AM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAChE,WAAW,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC;SAC9C;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AA5vBD,gDA4vBC","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\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 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,oEAA4F;AAC5F,iDAAmC;AACnC,2CAA6B;AAE7B,8EAK2C;AAE3C,qDAAkD;AAClD,+EAGuC;AAUvC,2DAAwD;AACxD,qDAAkG;AAuDlG,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,EAAU,CAAC;QAK1C,sBAAiB,GAAyC,IAAI,GAAG,EAGtE,CAAC;QAIJ;;;;WAIG;QACK,8BAAyB,GAAkD,IAAI,GAAG,EAGvF,CAAC;QAGF,IAAI,OAAO,CAAC,aAAa,EAAE;YACzB,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAC;SACvG;QAED,IAAI,MAAA,OAAO,CAAC,cAAc,0CAAE,YAAY,EAAE;YACxC,MAAM,IAAI,KAAK,CACb,6FAA6F;gBAC3F,4DAA4D,CAC/D,CAAC;SACH;QAED,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,QAA0B;QACrC,MAAM,UAAU,GAAY,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAE7C,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,OAAO,kBAAkB,CAAC,IAAI,4BAA4B,CAAC,CAAC;SAC7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AqB,GAAG,IAAI,CAAC;oBAC7B,MAAM;iBACP;aACF;YAED,2EAA2E;YAC3E,8EAA8E;YAC9E,uCAAuC;YACvC,yEAAyE;YACzE,mBAAmB;YACnB,IAAI,CAAC,qBAAqB,IAAI,KAAK,CAAC,UAAU,EAAE,EAAE;gBAChD,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,iBAAiB,EAAE,EAAE;oBAClD,IAAI,IAAI,CAAC,yBAAyB,CAAC,UAAU,CAAC,EAAE;wBAC9C,qBAAqB,GAAG,IAAI,CAAC;wBAC7B,MAAM;qBACP;iBACF;aACF;YAED,2BAAY,CAAC,UAAU,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAAC;SACvD;QAED,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IAEO,iCAAiC,CAAC,OAA0B;QAClE,MAAM,WAAW,GAAoB,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAChE,WAAW,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC;SAC9C;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;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"]}
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ export interface ITypingsGenerationOptions {
|
|
|
25
25
|
* This property specifies the folder in which `.d.ts` files for loc files should be dropped.
|
|
26
26
|
*/
|
|
27
27
|
generatedTsFolder: string;
|
|
28
|
+
/**
|
|
29
|
+
* Optional additional folders into which `.d.ts` files for loc files should be dropped.
|
|
30
|
+
*/
|
|
31
|
+
secondaryGeneratedTsFolders?: string[];
|
|
28
32
|
/**
|
|
29
33
|
* This optional property overrides the compiler context for discovery of localization files
|
|
30
34
|
* for which typings should be generated.
|
package/lib/interfaces.d.ts.map
CHANGED
|
@@ -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,CAAC;IAE/B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;IAErE;;;OAGG;IACH,cAAc,CAAC,EAAE,CACf,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,KACf,MAAM,GAAG,SAAS,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,CAAC,gBAAgB,EAAE,MAAM,GAAG,oBAAoB,CAAC;CAClD;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B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aces.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 * 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 { 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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/webpack4-localization-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
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/localization-plugin-4"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@rushstack/set-webpack-public-path-plugin": "^3.3.
|
|
14
|
+
"@rushstack/set-webpack-public-path-plugin": "^3.3.44",
|
|
15
15
|
"@types/webpack": "^4.39.0",
|
|
16
16
|
"webpack": "^4.31.0"
|
|
17
17
|
},
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@rushstack/localization-utilities": "0.
|
|
28
|
-
"@rushstack/node-core-library": "3.
|
|
27
|
+
"@rushstack/localization-utilities": "0.8.0",
|
|
28
|
+
"@rushstack/node-core-library": "3.46.0",
|
|
29
29
|
"@types/node": "12.20.24",
|
|
30
30
|
"@types/tapable": "1.0.6",
|
|
31
31
|
"loader-utils": "~1.1.0",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@rushstack/eslint-config": "2.6.1",
|
|
37
|
-
"@rushstack/heft": "0.45.
|
|
38
|
-
"@rushstack/heft-node-rig": "1.9.
|
|
39
|
-
"@rushstack/set-webpack-public-path-plugin": "3.3.
|
|
37
|
+
"@rushstack/heft": "0.45.11",
|
|
38
|
+
"@rushstack/heft-node-rig": "1.9.12",
|
|
39
|
+
"@rushstack/set-webpack-public-path-plugin": "3.3.44",
|
|
40
40
|
"@types/loader-utils": "1.1.3",
|
|
41
41
|
"@types/lodash": "4.14.116",
|
|
42
42
|
"@types/minimatch": "3.0.5",
|