@rushstack/webpack4-localization-plugin 0.19.14 → 0.20.1
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 +52 -0
- package/CHANGELOG.md +15 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib-esm/AssetProcessor.js +277 -0
- package/lib-esm/AssetProcessor.js.map +1 -0
- package/lib-esm/LocalizationPlugin.js +580 -0
- package/lib-esm/LocalizationPlugin.js.map +1 -0
- package/lib-esm/WebpackConfigurationUpdater.js +106 -0
- package/lib-esm/WebpackConfigurationUpdater.js.map +1 -0
- package/lib-esm/index.js +4 -0
- package/lib-esm/index.js.map +1 -0
- package/lib-esm/interfaces.js +4 -0
- package/lib-esm/interfaces.js.map +1 -0
- package/lib-esm/loaders/InPlaceLocFileLoader.js +20 -0
- package/lib-esm/loaders/InPlaceLocFileLoader.js.map +1 -0
- package/lib-esm/loaders/LoaderFactory.js +14 -0
- package/lib-esm/loaders/LoaderFactory.js.map +1 -0
- package/lib-esm/loaders/LocLoader.js +38 -0
- package/lib-esm/loaders/LocLoader.js.map +1 -0
- package/lib-esm/utilities/Constants.js +17 -0
- package/lib-esm/utilities/Constants.js.map +1 -0
- package/lib-esm/utilities/EntityMarker.js +15 -0
- package/lib-esm/utilities/EntityMarker.js.map +1 -0
- package/lib-esm/utilities/LoaderTerminalProvider.js +24 -0
- package/lib-esm/utilities/LoaderTerminalProvider.js.map +1 -0
- package/lib-esm/webpackInterfaces.js +4 -0
- package/lib-esm/webpackInterfaces.js.map +1 -0
- package/package.json +31 -7
- /package/{lib → lib-commonjs}/AssetProcessor.js +0 -0
- /package/{lib → lib-commonjs}/AssetProcessor.js.map +0 -0
- /package/{lib → lib-commonjs}/LocalizationPlugin.js +0 -0
- /package/{lib → lib-commonjs}/LocalizationPlugin.js.map +0 -0
- /package/{lib → lib-commonjs}/WebpackConfigurationUpdater.js +0 -0
- /package/{lib → lib-commonjs}/WebpackConfigurationUpdater.js.map +0 -0
- /package/{lib → lib-commonjs}/index.js +0 -0
- /package/{lib → lib-commonjs}/index.js.map +0 -0
- /package/{lib → lib-commonjs}/interfaces.js +0 -0
- /package/{lib → lib-commonjs}/interfaces.js.map +0 -0
- /package/{lib → lib-commonjs}/loaders/InPlaceLocFileLoader.js +0 -0
- /package/{lib → lib-commonjs}/loaders/InPlaceLocFileLoader.js.map +0 -0
- /package/{lib → lib-commonjs}/loaders/LoaderFactory.js +0 -0
- /package/{lib → lib-commonjs}/loaders/LoaderFactory.js.map +0 -0
- /package/{lib → lib-commonjs}/loaders/LocLoader.js +0 -0
- /package/{lib → lib-commonjs}/loaders/LocLoader.js.map +0 -0
- /package/{lib → lib-commonjs}/utilities/Constants.js +0 -0
- /package/{lib → lib-commonjs}/utilities/Constants.js.map +0 -0
- /package/{lib → lib-commonjs}/utilities/EntityMarker.js +0 -0
- /package/{lib → lib-commonjs}/utilities/EntityMarker.js.map +0 -0
- /package/{lib → lib-commonjs}/utilities/LoaderTerminalProvider.js +0 -0
- /package/{lib → lib-commonjs}/utilities/LoaderTerminalProvider.js.map +0 -0
- /package/{lib → lib-commonjs}/webpackInterfaces.js +0 -0
- /package/{lib → lib-commonjs}/webpackInterfaces.js.map +0 -0
- /package/{lib → lib-dts}/AssetProcessor.d.ts +0 -0
- /package/{lib → lib-dts}/AssetProcessor.d.ts.map +0 -0
- /package/{lib → lib-dts}/LocalizationPlugin.d.ts +0 -0
- /package/{lib → lib-dts}/LocalizationPlugin.d.ts.map +0 -0
- /package/{lib → lib-dts}/WebpackConfigurationUpdater.d.ts +0 -0
- /package/{lib → lib-dts}/WebpackConfigurationUpdater.d.ts.map +0 -0
- /package/{lib → lib-dts}/index.d.ts +0 -0
- /package/{lib → lib-dts}/index.d.ts.map +0 -0
- /package/{lib → lib-dts}/interfaces.d.ts +0 -0
- /package/{lib → lib-dts}/interfaces.d.ts.map +0 -0
- /package/{lib → lib-dts}/loaders/InPlaceLocFileLoader.d.ts +0 -0
- /package/{lib → lib-dts}/loaders/InPlaceLocFileLoader.d.ts.map +0 -0
- /package/{lib → lib-dts}/loaders/LoaderFactory.d.ts +0 -0
- /package/{lib → lib-dts}/loaders/LoaderFactory.d.ts.map +0 -0
- /package/{lib → lib-dts}/loaders/LocLoader.d.ts +0 -0
- /package/{lib → lib-dts}/loaders/LocLoader.d.ts.map +0 -0
- /package/{lib → lib-dts}/utilities/Constants.d.ts +0 -0
- /package/{lib → lib-dts}/utilities/Constants.d.ts.map +0 -0
- /package/{lib → lib-dts}/utilities/EntityMarker.d.ts +0 -0
- /package/{lib → lib-dts}/utilities/EntityMarker.d.ts.map +0 -0
- /package/{lib → lib-dts}/utilities/LoaderTerminalProvider.d.ts +0 -0
- /package/{lib → lib-dts}/utilities/LoaderTerminalProvider.d.ts.map +0 -0
- /package/{lib → lib-dts}/webpackInterfaces.d.ts +0 -0
- /package/{lib → lib-dts}/webpackInterfaces.d.ts.map +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalizationPlugin.js","sourceRoot":"","sources":["../src/LocalizationPlugin.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEjF,OAAO,EACL,kBAAkB,EAElB,YAAY,EACZ,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAEL,2BAA2B,EAC5B,MAAM,+BAA+B,CAAC;AAUvC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAyC,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAuD5G,MAAM,WAAW,GAAW,cAAc,CAAC;A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/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,CAAC;YACjE,WAAW,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC;QAC/C,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport * as Webpack from 'webpack';\nimport type * as Tapable from 'tapable';\n\nimport { JsonFile, FileSystem, NewlineKind } from '@rushstack/node-core-library';\nimport type { ITerminal } from '@rushstack/terminal';\nimport {\n getPseudolocalizer,\n type ILocalizationFile,\n parseLocFile,\n TypingsGenerator\n} from '@rushstack/localization-utilities';\n\nimport { Constants } from './utilities/Constants';\nimport {\n type IWebpackConfigurationUpdaterOptions,\n WebpackConfigurationUpdater\n} from './WebpackConfigurationUpdater';\nimport type {\n ILocalizationPluginOptions,\n ILocalizationStats,\n ILocaleFileData,\n ILocaleElementMap,\n ILocalizedStrings,\n IResolvedMissingTranslations\n} from './interfaces';\nimport type { ILocalizedWebpackChunk } from './webpackInterfaces';\nimport { EntityMarker } from './utilities/EntityMarker';\nimport { type IAsset, type IProcessAssetResult, AssetProcessor, PLACEHOLDER_REGEX } from './AssetProcessor';\n\n/**\n * @internal\n */\nexport interface IStringPlaceholder {\n value: string;\n suffix: string;\n}\n\n/**\n * @internal\n */\nexport interface IAddDefaultLocFileResult {\n /**\n * A list of paths to translation files that were loaded\n */\n additionalLoadedFilePaths: string[];\n\n errors: Error[];\n}\n\ninterface IExtendedMainTemplate {\n hooks: {\n assetPath: Tapable.SyncHook<string, IAssetPathOptions>;\n };\n}\n\ninterface IExtendedConfiguration extends Webpack.compilation.Compilation {\n options: Webpack.Configuration;\n}\n\ninterface IExtendedChunkGroup extends Webpack.compilation.ChunkGroup {\n getChildren(): Webpack.compilation.Chunk[];\n}\n\ninterface IExtendedChunk extends Webpack.compilation.Chunk {\n filenameTemplate: string;\n}\n\ninterface IAssetPathOptions {\n chunk: Webpack.compilation.Chunk;\n contentHashType: string;\n filename: string;\n}\n\n/**\n * @internal\n */\nexport interface IStringSerialNumberData {\n values: ILocaleElementMap;\n locFilePath: string;\n stringName: string;\n}\n\nconst PLUGIN_NAME: string = 'localization';\n\n/**\n * This plugin facilitates localization in webpack.\n *\n * @public\n */\nexport class LocalizationPlugin implements Webpack.Plugin {\n /**\n * @internal\n */\n public stringKeys: Map<string, IStringPlaceholder> = new Map<string, IStringPlaceholder>();\n\n private _options: ILocalizationPluginOptions;\n private _resolvedTranslatedStringsFromOptions!: ILocalizedStrings;\n private _globsToIgnore: string[] | undefined;\n private _stringPlaceholderCounter: number = 0;\n private _stringPlaceholderMap: Map<string, IStringSerialNumberData> = new Map<\n string,\n IStringSerialNumberData\n >();\n private _locales: Set<string> = new Set<string>();\n private _passthroughLocaleName!: string;\n private _defaultLocale!: string;\n private _noStringsLocaleName!: string;\n private _fillMissingTranslationStrings!: boolean;\n private _pseudolocalizers: Map<string, (str: string) => string> = new Map<\n string,\n (str: string) => string\n >();\n private _resxNewlineNormalization: NewlineKind | undefined;\n private _ignoreMissingResxComments: boolean | undefined;\n\n /**\n * The outermost map's keys are the locale names.\n * The middle map's keys are the resolved, file names.\n * The innermost map's keys are the string identifiers and its values are the string values.\n */\n private _resolvedLocalizedStrings: Map<string, Map<string, Map<string, string>>> = new Map<\n string,\n Map<string, Map<string, string>>\n >();\n\n public constructor(options: ILocalizationPluginOptions) {\n if (options.filesToIgnore) {\n throw new Error('The filesToIgnore option is no longer supported. Please use globsToIgnore instead.');\n }\n\n if (options.typingsOptions?.ignoreString) {\n throw new Error(\n 'The typingsOptions.ignoreString option is no longer supported. Please use the ignoreString ' +\n 'option directly on the constructor options object instead.'\n );\n }\n\n this._options = options;\n }\n\n public apply(compiler: Webpack.Compiler): void {\n const isWebpack4: boolean = !!compiler.hooks;\n\n if (!isWebpack4) {\n throw new Error(`The ${LocalizationPlugin.name} plugin requires Webpack 4`);\n }\n\n if (this._options.typingsOptions && compiler.context) {\n if (\n this._options.typingsOptions.generatedTsFolder &&\n !path.isAbsolute(this._options.typingsOptions.generatedTsFolder)\n ) {\n this._options.typingsOptions.generatedTsFolder = path.resolve(\n compiler.context,\n this._options.typingsOptions.generatedTsFolder\n );\n }\n\n if (\n this._options.typingsOptions.sourceRoot &&\n !path.isAbsolute(this._options.typingsOptions.sourceRoot)\n ) {\n this._options.typingsOptions.sourceRoot = path.resolve(\n compiler.context,\n this._options.typingsOptions.sourceRoot\n );\n }\n\n const secondaryGeneratedTsFolders: string[] | undefined =\n this._options.typingsOptions.secondaryGeneratedTsFolders;\n if (secondaryGeneratedTsFolders) {\n for (let i: number = 0; i < secondaryGeneratedTsFolders.length; i++) {\n const secondaryGeneratedTsFolder: string = secondaryGeneratedTsFolders[i];\n if (!path.isAbsolute(secondaryGeneratedTsFolder)) {\n secondaryGeneratedTsFolders[i] = path.resolve(compiler.context, secondaryGeneratedTsFolder);\n }\n }\n }\n }\n\n // https://github.com/webpack/webpack-dev-server/pull/1929/files#diff-15fb51940da53816af13330d8ce69b4eR66\n const isWebpackDevServer: boolean = process.env.WEBPACK_DEV_SERVER === 'true';\n\n const { errors, warnings } = this._initializeAndValidateOptions(compiler.options, isWebpackDevServer);\n\n let typingsPreprocessor: TypingsGenerator | undefined;\n if (this._options.typingsOptions) {\n typingsPreprocessor = new TypingsGenerator({\n srcFolder: this._options.typingsOptions.sourceRoot || compiler.context,\n generatedTsFolder: this._options.typingsOptions.generatedTsFolder,\n secondaryGeneratedTsFolders: this._options.typingsOptions.secondaryGeneratedTsFolders,\n exportAsDefault: this._options.typingsOptions.exportAsDefault,\n globsToIgnore: this._options.globsToIgnore,\n ignoreString: this._options.ignoreString,\n processComment: this._options.typingsOptions.processComment\n });\n } else {\n typingsPreprocessor = undefined;\n }\n\n const webpackConfigurationUpdaterOptions: IWebpackConfigurationUpdaterOptions = {\n pluginInstance: this,\n configuration: compiler.options,\n globsToIgnore: this._globsToIgnore,\n localeNameOrPlaceholder: Constants.LOCALE_NAME_PLACEHOLDER,\n resxNewlineNormalization: this._resxNewlineNormalization,\n ignoreMissingResxComments: this._ignoreMissingResxComments,\n ignoreString: this._options.ignoreString\n };\n\n if (errors.length > 0 || warnings.length > 0) {\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation: Webpack.compilation.Compilation) => {\n compilation.errors.push(...errors);\n compilation.warnings.push(...warnings);\n });\n\n if (errors.length > 0) {\n // If there are any errors, just pass through the resources in source and don't do any\n // additional configuration\n WebpackConfigurationUpdater.amendWebpackConfigurationForInPlaceLocFiles(\n webpackConfigurationUpdaterOptions\n );\n return;\n }\n }\n\n if (isWebpackDevServer) {\n if (typingsPreprocessor) {\n compiler.hooks.afterEnvironment.tap(PLUGIN_NAME, () => typingsPreprocessor!.runWatcherAsync());\n\n if (!compiler.options.plugins) {\n compiler.options.plugins = [];\n }\n\n compiler.options.plugins.push(\n new Webpack.WatchIgnorePlugin([this._options.typingsOptions!.generatedTsFolder])\n );\n }\n\n WebpackConfigurationUpdater.amendWebpackConfigurationForInPlaceLocFiles(\n webpackConfigurationUpdaterOptions\n );\n } else {\n if (typingsPreprocessor) {\n compiler.hooks.beforeRun.tapPromise(\n PLUGIN_NAME,\n async () => await typingsPreprocessor!.generateTypingsAsync()\n );\n }\n\n WebpackConfigurationUpdater.amendWebpackConfigurationForMultiLocale(webpackConfigurationUpdaterOptions);\n\n if (errors.length === 0) {\n compiler.hooks.thisCompilation.tap(\n PLUGIN_NAME,\n (untypedCompilation: Webpack.compilation.Compilation) => {\n const compilation: IExtendedConfiguration = untypedCompilation as IExtendedConfiguration;\n (compilation.mainTemplate as unknown as IExtendedMainTemplate).hooks.assetPath.tap(\n PLUGIN_NAME,\n (assetPath: string, options: IAssetPathOptions) => {\n if (\n options.contentHashType === 'javascript' &&\n assetPath.match(Constants.LOCALE_FILENAME_TOKEN_REGEX)\n ) {\n // Does this look like an async chunk URL generator?\n if (typeof options.chunk.id === 'string' && (options.chunk.id as string).match(/^\\\" \\+/)) {\n return assetPath.replace(\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\n `\" + ${Constants.JSONP_PLACEHOLDER} + \"`\n );\n } else {\n return assetPath.replace(\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\n Constants.LOCALE_NAME_PLACEHOLDER\n );\n }\n } else if (assetPath.match(Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX)) {\n // Replace the placeholder with the [locale] token for sourcemaps\n const deLocalizedFilename: string = options.filename.replace(\n PLACEHOLDER_REGEX,\n Constants.LOCALE_FILENAME_TOKEN\n );\n return assetPath.replace(\n Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX,\n deLocalizedFilename\n );\n } else {\n return assetPath;\n }\n }\n );\n\n compilation.hooks.optimizeChunks.tap(\n PLUGIN_NAME,\n (\n untypedChunks: Webpack.compilation.Chunk[],\n untypedChunkGroups: Webpack.compilation.ChunkGroup[]\n ) => {\n const chunks: IExtendedChunk[] = untypedChunks as IExtendedChunk[];\n const chunkGroups: IExtendedChunkGroup[] = untypedChunkGroups as IExtendedChunkGroup[];\n\n let chunksHaveAnyChildren: boolean = false;\n for (const chunkGroup of chunkGroups) {\n const children: Webpack.compilation.Chunk[] = chunkGroup.getChildren();\n if (children.length > 0) {\n chunksHaveAnyChildren = true;\n break;\n }\n }\n\n if (\n chunksHaveAnyChildren &&\n (!compilation.options.output ||\n !compilation.options.output.chunkFilename ||\n compilation.options.output.chunkFilename.indexOf(Constants.LOCALE_FILENAME_TOKEN) === -1)\n ) {\n compilation.errors.push(\n new Error(\n 'The configuration.output.chunkFilename property must be provided and must include ' +\n `the ${Constants.LOCALE_FILENAME_TOKEN} placeholder`\n )\n );\n\n return;\n }\n\n for (const chunk of chunks) {\n // See if the chunk contains any localized modules or loads any localized chunks\n const localizedChunk: boolean = this._chunkHasLocalizedModules(chunk);\n\n // Change the chunk's name to include either the locale name or the locale name for chunks without strings\n const replacementValue: string = localizedChunk\n ? Constants.LOCALE_NAME_PLACEHOLDER\n : this._noStringsLocaleName;\n if (chunk.hasRuntime()) {\n chunk.filenameTemplate = (compilation.options.output!.filename as string).replace(\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\n replacementValue\n );\n } else {\n chunk.filenameTemplate = compilation.options.output!.chunkFilename!.replace(\n Constants.LOCALE_FILENAME_TOKEN_REGEX,\n replacementValue\n );\n }\n }\n }\n );\n }\n );\n\n compiler.hooks.emit.tap(PLUGIN_NAME, (compilation: Webpack.compilation.Compilation) => {\n const localizationStats: ILocalizationStats = {\n entrypoints: {},\n namedChunkGroups: {}\n };\n\n const alreadyProcessedAssets: Set<string> = new Set<string>();\n const hotUpdateRegex: RegExp = /\\.hot-update\\.js$/;\n\n for (const untypedChunk of compilation.chunks) {\n const chunk: ILocalizedWebpackChunk = untypedChunk;\n const chunkFilesSet: Set<string> = new Set(chunk.files);\n function processChunkJsFile(callback: (chunkFilename: string) => void): void {\n let alreadyProcessedAFileInThisChunk: boolean = false;\n for (const chunkFilename of chunk.files) {\n if (\n chunkFilename.endsWith('.js') && // Ensure this is a JS file\n !hotUpdateRegex.test(chunkFilename) && // Ensure this is not a webpack hot update\n !alreadyProcessedAssets.has(chunkFilename) // Ensure this isn't a vendor chunk we've already processed\n ) {\n if (alreadyProcessedAFileInThisChunk) {\n throw new Error(\n `Found more than one JS file in chunk \"${chunk.name}\". This is not expected.`\n );\n }\n\n alreadyProcessedAFileInThisChunk = true;\n alreadyProcessedAssets.add(chunkFilename);\n callback(chunkFilename);\n }\n }\n }\n\n if (this._chunkHasLocalizedModules(chunk)) {\n processChunkJsFile((chunkFilename) => {\n if (chunkFilename.indexOf(Constants.LOCALE_NAME_PLACEHOLDER) === -1) {\n throw new Error(\n `Asset ${chunkFilename} is expected to be localized, but is missing a locale placeholder`\n );\n }\n\n const asset: IAsset = compilation.assets[chunkFilename];\n\n const resultingAssets: Map<string, IProcessAssetResult> =\n AssetProcessor.processLocalizedAsset({\n plugin: this,\n compilation,\n assetName: chunkFilename,\n asset,\n chunk,\n chunkHasLocalizedModules: this._chunkHasLocalizedModules.bind(this),\n locales: this._locales,\n noStringsLocaleName: this._noStringsLocaleName,\n fillMissingTranslationStrings: this._fillMissingTranslationStrings,\n defaultLocale: this._defaultLocale\n });\n\n // Delete the existing asset because it's been renamed\n delete compilation.assets[chunkFilename];\n chunkFilesSet.delete(chunkFilename);\n\n const localizedChunkAssets: ILocaleElementMap = {};\n for (const [locale, newAsset] of resultingAssets) {\n compilation.assets[newAsset.filename] = newAsset.asset;\n localizedChunkAssets[locale] = newAsset.filename;\n chunkFilesSet.add(newAsset.filename);\n }\n\n if (chunk.hasRuntime()) {\n // This is an entrypoint\n localizationStats.entrypoints[chunk.name] = {\n localizedAssets: localizedChunkAssets\n };\n } else {\n // This is a secondary chunk\n if (chunk.name) {\n localizationStats.namedChunkGroups[chunk.name] = {\n localizedAssets: localizedChunkAssets\n };\n }\n }\n\n chunk.localizedFiles = localizedChunkAssets;\n });\n } else {\n processChunkJsFile((chunkFilename) => {\n const asset: IAsset = compilation.assets[chunkFilename];\n\n const resultingAsset: IProcessAssetResult = AssetProcessor.processNonLocalizedAsset({\n plugin: this,\n compilation,\n assetName: chunkFilename,\n asset,\n chunk,\n noStringsLocaleName: this._noStringsLocaleName,\n chunkHasLocalizedModules: this._chunkHasLocalizedModules.bind(this)\n });\n\n // Delete the existing asset because it's been renamed\n delete compilation.assets[chunkFilename];\n chunkFilesSet.delete(chunkFilename);\n\n compilation.assets[resultingAsset.filename] = resultingAsset.asset;\n chunkFilesSet.add(resultingAsset.filename);\n });\n }\n\n chunk.files = Array.from(chunkFilesSet);\n }\n\n if (this._options.localizationStats) {\n if (this._options.localizationStats.dropPath) {\n const resolvedLocalizationStatsDropPath: string = path.resolve(\n compiler.outputPath,\n this._options.localizationStats.dropPath\n );\n JsonFile.save(localizationStats, resolvedLocalizationStatsDropPath, {\n ensureFolderExists: true\n });\n }\n\n if (this._options.localizationStats.callback) {\n try {\n this._options.localizationStats.callback(localizationStats);\n } catch (e) {\n /* swallow errors from the callback */\n }\n }\n }\n });\n }\n }\n }\n\n /**\n * @internal\n *\n * @returns\n */\n public addDefaultLocFile(\n terminal: ITerminal,\n localizedResourcePath: string,\n localizedResourceData: ILocalizationFile\n ): IAddDefaultLocFileResult {\n const additionalLoadedFilePaths: string[] = [];\n const errors: Error[] = [];\n\n const locFileData: ILocaleFileData = this._convertLocalizationFileToLocData(localizedResourceData);\n this._addLocFile(this._defaultLocale, localizedResourcePath, locFileData);\n\n const normalizeLocalizedData: (localizedData: ILocaleFileData | string) => ILocaleFileData = (\n localizedData\n ) => {\n if (typeof localizedData === 'string') {\n additionalLoadedFilePaths.push(localizedData);\n const localizationFile: ILocalizationFile = parseLocFile({\n filePath: localizedData,\n content: FileSystem.readFile(localizedData),\n terminal: terminal,\n resxNewlineNormalization: this._resxNewlineNormalization,\n ignoreMissingResxComments: this._ignoreMissingResxComments\n });\n\n return this._convertLocalizationFileToLocData(localizationFile);\n } else {\n return localizedData;\n }\n };\n\n const missingLocales: string[] = [];\n for (const [translatedLocaleName, translatedStrings] of Object.entries(\n this._resolvedTranslatedStringsFromOptions\n )) {\n const translatedLocFileFromOptions: ILocaleFileData | string | undefined =\n translatedStrings[localizedResourcePath];\n if (!translatedLocFileFromOptions) {\n missingLocales.push(translatedLocaleName);\n } else {\n const translatedLocFileData: ILocaleFileData = normalizeLocalizedData(translatedLocFileFromOptions);\n this._addLocFile(translatedLocaleName, localizedResourcePath, translatedLocFileData);\n }\n }\n\n if (missingLocales.length > 0 && this._options.localizedData.resolveMissingTranslatedStrings) {\n let resolvedTranslatedData: IResolvedMissingTranslations | undefined = undefined;\n try {\n resolvedTranslatedData = this._options.localizedData.resolveMissingTranslatedStrings(\n missingLocales,\n localizedResourcePath\n );\n } catch (e) {\n errors.push(e as Error);\n }\n\n if (resolvedTranslatedData) {\n for (const [resolvedLocaleName, resolvedLocaleData] of Object.entries(resolvedTranslatedData)) {\n if (resolvedLocaleData) {\n const translatedLocFileData: ILocaleFileData = normalizeLocalizedData(resolvedLocaleData);\n this._addLocFile(resolvedLocaleName, localizedResourcePath, translatedLocFileData);\n }\n }\n }\n }\n\n this._pseudolocalizers.forEach((pseudolocalizer: (str: string) => string, pseudolocaleName: string) => {\n const pseudolocFileData: ILocaleFileData = {};\n\n for (const [stringName, stringValue] of Object.entries(locFileData)) {\n pseudolocFileData[stringName] = pseudolocalizer(stringValue);\n }\n\n this._addLocFile(pseudolocaleName, localizedResourcePath, pseudolocFileData);\n });\n\n return { additionalLoadedFilePaths, errors };\n }\n\n /**\n * @internal\n */\n public getDataForSerialNumber(serialNumber: string): IStringSerialNumberData | undefined {\n return this._stringPlaceholderMap.get(serialNumber);\n }\n\n private _addLocFile(\n localeName: string,\n localizedFilePath: string,\n localizedFileData: ILocaleFileData\n ): void {\n const filesMap: Map<string, Map<string, string>> = this._resolvedLocalizedStrings.get(localeName)!;\n\n const stringsMap: Map<string, string> = new Map<string, string>();\n filesMap.set(localizedFilePath, stringsMap);\n\n for (const [stringName, stringValue] of Object.entries(localizedFileData)) {\n const stringKey: string = `${localizedFilePath}?${stringName}`;\n if (!this.stringKeys.has(stringKey)) {\n const placeholder: IStringPlaceholder = this._getPlaceholderString();\n this.stringKeys.set(stringKey, placeholder);\n }\n\n const placeholder: IStringPlaceholder = this.stringKeys.get(stringKey)!;\n if (!this._stringPlaceholderMap.has(placeholder.suffix)) {\n this._stringPlaceholderMap.set(placeholder.suffix, {\n values: {\n [this._passthroughLocaleName]: stringName\n },\n locFilePath: localizedFilePath,\n stringName: stringName\n });\n }\n\n this._stringPlaceholderMap.get(placeholder.suffix)!.values[localeName] = stringValue;\n\n stringsMap.set(stringName, stringValue);\n }\n }\n\n private _initializeAndValidateOptions(\n configuration: Webpack.Configuration,\n isWebpackDevServer: boolean\n ): { errors: Error[]; warnings: Error[] } {\n const errors: Error[] = [];\n const warnings: Error[] = [];\n\n function ensureValidLocaleName(localeName: string): boolean {\n const LOCALE_NAME_REGEX: RegExp = /[a-z-]/i;\n if (!localeName.match(LOCALE_NAME_REGEX)) {\n errors.push(\n new Error(`Invalid locale name: ${localeName}. Locale names may only contain letters and hyphens.`)\n );\n return false;\n } else {\n return true;\n }\n }\n\n // START configuration\n if (\n !configuration.output ||\n !configuration.output.filename ||\n typeof configuration.output.filename !== 'string' ||\n configuration.output.filename.indexOf(Constants.LOCALE_FILENAME_TOKEN) === -1\n ) {\n errors.push(\n new Error(\n 'The configuration.output.filename property must be provided, must be a string, and must include ' +\n `the ${Constants.LOCALE_FILENAME_TOKEN} placeholder`\n )\n );\n }\n // END configuration\n\n // START misc options\n // eslint-disable-next-line no-lone-blocks\n {\n this._globsToIgnore = this._options.globsToIgnore;\n }\n // END misc options\n\n // START options.localizedData\n if (this._options.localizedData) {\n this._ignoreMissingResxComments = this._options.localizedData.ignoreMissingResxComments;\n\n // START options.localizedData.passthroughLocale\n if (this._options.localizedData.passthroughLocale) {\n const { usePassthroughLocale, passthroughLocaleName = 'passthrough' } =\n this._options.localizedData.passthroughLocale;\n if (usePassthroughLocale) {\n this._passthroughLocaleName = passthroughLocaleName;\n this._locales.add(passthroughLocaleName);\n }\n }\n // END options.localizedData.passthroughLocale\n\n // START options.localizedData.translatedStrings\n const { translatedStrings } = this._options.localizedData;\n this._resolvedTranslatedStringsFromOptions = {};\n if (translatedStrings) {\n for (const [localeName, locale] of Object.entries(translatedStrings)) {\n if (this._locales.has(localeName)) {\n errors.push(\n Error(\n `The locale \"${localeName}\" appears multiple times. ` +\n 'There may be multiple instances with different casing.'\n )\n );\n return { errors, warnings };\n }\n\n if (!ensureValidLocaleName(localeName)) {\n return { errors, warnings };\n }\n\n this._locales.add(localeName);\n this._resolvedLocalizedStrings.set(localeName, new Map<string, Map<string, string>>());\n this._resolvedTranslatedStringsFromOptions[localeName] = {};\n\n const locFilePathsInLocale: Set<string> = new Set<string>();\n\n for (const [locFilePath, locFileDataFromOptions] of Object.entries(locale)) {\n if (locale.hasOwnProperty(locFilePath)) {\n const normalizedLocFilePath: string = path.resolve(configuration.context!, locFilePath);\n\n if (locFilePathsInLocale.has(normalizedLocFilePath)) {\n errors.push(\n new Error(\n `The localization file path \"${locFilePath}\" appears multiple times in locale ${localeName}. ` +\n 'There may be multiple instances with different casing.'\n )\n );\n return { errors, warnings };\n }\n\n locFilePathsInLocale.add(normalizedLocFilePath);\n\n const normalizedLocFileDataFromOptions: string | ILocaleFileData =\n typeof locFileDataFromOptions === 'string'\n ? path.resolve(configuration.context!, locFileDataFromOptions)\n : locFileDataFromOptions;\n\n this._resolvedTranslatedStringsFromOptions[localeName][normalizedLocFilePath] =\n normalizedLocFileDataFromOptions;\n }\n }\n }\n }\n // END options.localizedData.translatedStrings\n\n // START options.localizedData.defaultLocale\n if (this._options.localizedData.defaultLocale) {\n const { localeName, fillMissingTranslationStrings } = this._options.localizedData.defaultLocale;\n if (this._options.localizedData.defaultLocale.localeName) {\n if (this._locales.has(localeName)) {\n errors.push(new Error('The default locale is also specified in the translated strings.'));\n return { errors, warnings };\n } else if (!ensureValidLocaleName(localeName)) {\n return { errors, warnings };\n }\n\n this._locales.add(localeName);\n this._resolvedLocalizedStrings.set(localeName, new Map<string, Map<string, string>>());\n this._defaultLocale = localeName;\n this._fillMissingTranslationStrings = !!fillMissingTranslationStrings;\n } else {\n errors.push(new Error('Missing default locale name'));\n return { errors, warnings };\n }\n } else {\n errors.push(new Error('Missing default locale options.'));\n return { errors, warnings };\n }\n // END options.localizedData.defaultLocale\n\n // START options.localizedData.pseudoLocales\n if (this._options.localizedData.pseudolocales) {\n for (const [pseudolocaleName, pseudoLocaleOpts] of Object.entries(\n this._options.localizedData.pseudolocales\n )) {\n if (this._defaultLocale === pseudolocaleName) {\n errors.push(\n new Error(`A pseudolocale (${pseudolocaleName}) name is also the default locale name.`)\n );\n return { errors, warnings };\n }\n\n if (this._locales.has(pseudolocaleName)) {\n errors.push(\n new Error(\n `A pseudolocale (${pseudolocaleName}) name is also specified in the translated strings.`\n )\n );\n return { errors, warnings };\n }\n\n this._pseudolocalizers.set(pseudolocaleName, getPseudolocalizer(pseudoLocaleOpts));\n this._locales.add(pseudolocaleName);\n this._resolvedLocalizedStrings.set(pseudolocaleName, new Map<string, Map<string, string>>());\n }\n }\n // END options.localizedData.pseudoLocales\n\n // START options.localizedData.normalizeResxNewlines\n if (this._options.localizedData.normalizeResxNewlines) {\n switch (this._options.localizedData.normalizeResxNewlines) {\n case 'crlf': {\n this._resxNewlineNormalization = NewlineKind.CrLf;\n break;\n }\n\n case 'lf': {\n this._resxNewlineNormalization = NewlineKind.Lf;\n break;\n }\n\n default: {\n errors.push(\n new Error(\n `Unexpected value \"${this._options.localizedData.normalizeResxNewlines}\" for option ` +\n '\"localizedData.normalizeResxNewlines\"'\n )\n );\n break;\n }\n }\n }\n // END options.localizedData.normalizeResxNewlines\n } else if (!isWebpackDevServer) {\n throw new Error('Localized data must be provided unless webpack dev server is running.');\n }\n // END options.localizedData\n\n // START options.noStringsLocaleName\n if (\n this._options.noStringsLocaleName === undefined ||\n this._options.noStringsLocaleName === null ||\n !ensureValidLocaleName(this._options.noStringsLocaleName)\n ) {\n this._noStringsLocaleName = 'none';\n } else {\n this._noStringsLocaleName = this._options.noStringsLocaleName;\n }\n // END options.noStringsLocaleName\n\n return { errors, warnings };\n }\n\n private _getPlaceholderString(): IStringPlaceholder {\n const suffix: string = (this._stringPlaceholderCounter++).toString();\n return {\n value: `${Constants.STRING_PLACEHOLDER_PREFIX}_\\\\_${Constants.STRING_PLACEHOLDER_LABEL}_${suffix}`,\n suffix: suffix\n };\n }\n\n private _chunkHasLocalizedModules(chunk: Webpack.compilation.Chunk): boolean {\n let chunkHasAnyLocModules: boolean | undefined = EntityMarker.getMark(chunk);\n if (chunkHasAnyLocModules === undefined) {\n chunkHasAnyLocModules = false;\n for (const module of chunk.getModules()) {\n if (EntityMarker.getMark(module)) {\n chunkHasAnyLocModules = true;\n break;\n }\n }\n\n // If this chunk doesn't directly contain any localized resources, it still\n // needs to be localized if it's an entrypoint chunk (i.e. - it has a runtime)\n // and it loads localized async chunks.\n // In that case, the generated chunk URL generation code needs to contain\n // the locale name.\n if (!chunkHasAnyLocModules && chunk.hasRuntime()) {\n for (const asyncChunk of chunk.getAllAsyncChunks()) {\n if (this._chunkHasLocalizedModules(asyncChunk)) {\n chunkHasAnyLocModules = true;\n break;\n }\n }\n }\n\n EntityMarker.markEntity(chunk, chunkHasAnyLocModules);\n }\n\n return chunkHasAnyLocModules;\n }\n\n private _convertLocalizationFileToLocData(locFile: ILocalizationFile): ILocaleFileData {\n const locFileData: ILocaleFileData = {};\n for (const [stringName, locFileEntry] of Object.entries(locFile)) {\n locFileData[stringName] = locFileEntry.value;\n }\n\n return locFileData;\n }\n}\n"]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { minimatch } from 'minimatch';
|
|
5
|
+
import { Text } from '@rushstack/node-core-library';
|
|
6
|
+
import { Constants } from './utilities/Constants';
|
|
7
|
+
const FILE_TOKEN_REGEX = new RegExp(Text.escapeRegExp('[file]'));
|
|
8
|
+
export class WebpackConfigurationUpdater {
|
|
9
|
+
static amendWebpackConfigurationForMultiLocale(options) {
|
|
10
|
+
const loader = path.resolve(__dirname, 'loaders', 'LocLoader.js');
|
|
11
|
+
const loaderOptions = {
|
|
12
|
+
pluginInstance: options.pluginInstance,
|
|
13
|
+
resxNewlineNormalization: options.resxNewlineNormalization,
|
|
14
|
+
ignoreMissingResxComments: options.ignoreMissingResxComments,
|
|
15
|
+
ignoreString: options.ignoreString
|
|
16
|
+
};
|
|
17
|
+
WebpackConfigurationUpdater._addLoadersForLocFiles(options, loader, loaderOptions);
|
|
18
|
+
WebpackConfigurationUpdater._tryUpdateLocaleTokenInPublicPathPlugin(options);
|
|
19
|
+
WebpackConfigurationUpdater._tryUpdateSourceMapFilename(options.configuration);
|
|
20
|
+
}
|
|
21
|
+
static amendWebpackConfigurationForInPlaceLocFiles(options) {
|
|
22
|
+
const loader = path.resolve(__dirname, 'loaders', 'InPlaceLocFileLoader.js');
|
|
23
|
+
const loaderOptions = {
|
|
24
|
+
resxNewlineNormalization: options.resxNewlineNormalization,
|
|
25
|
+
ignoreMissingResxComments: options.ignoreMissingResxComments,
|
|
26
|
+
ignoreString: options.ignoreString
|
|
27
|
+
};
|
|
28
|
+
WebpackConfigurationUpdater._addRulesToConfiguration(options.configuration, [
|
|
29
|
+
{
|
|
30
|
+
test: Constants.RESOURCE_FILE_NAME_REGEXP,
|
|
31
|
+
use: [
|
|
32
|
+
{
|
|
33
|
+
loader: loader,
|
|
34
|
+
options: loaderOptions
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
type: 'json',
|
|
38
|
+
sideEffects: false
|
|
39
|
+
}
|
|
40
|
+
]);
|
|
41
|
+
}
|
|
42
|
+
static _tryUpdateLocaleTokenInPublicPathPlugin(options) {
|
|
43
|
+
let setPublicPathPlugin;
|
|
44
|
+
try {
|
|
45
|
+
const pluginPackage = require('@rushstack/set-webpack-public-path-plugin');
|
|
46
|
+
setPublicPathPlugin = pluginPackage.SetPublicPathPlugin;
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
// public path plugin isn't present - ignore
|
|
50
|
+
}
|
|
51
|
+
if (setPublicPathPlugin && options.configuration.plugins) {
|
|
52
|
+
for (const plugin of options.configuration.plugins) {
|
|
53
|
+
if (plugin instanceof setPublicPathPlugin) {
|
|
54
|
+
if (plugin.options &&
|
|
55
|
+
plugin.options.scriptName &&
|
|
56
|
+
plugin.options.scriptName.isTokenized &&
|
|
57
|
+
plugin.options.scriptName.name) {
|
|
58
|
+
plugin.options.scriptName.name = plugin.options.scriptName.name.replace(/\[locale\]/g, options.localeNameOrPlaceholder);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static _addLoadersForLocFiles(options, loader, loaderOptions) {
|
|
65
|
+
const { globsToIgnore, configuration } = options;
|
|
66
|
+
const rules = globsToIgnore && globsToIgnore.length > 0
|
|
67
|
+
? {
|
|
68
|
+
include: Constants.RESOURCE_FILE_NAME_REGEXP,
|
|
69
|
+
exclude: (filePath) => globsToIgnore.some((glob) => minimatch(filePath, glob))
|
|
70
|
+
}
|
|
71
|
+
: Constants.RESOURCE_FILE_NAME_REGEXP;
|
|
72
|
+
WebpackConfigurationUpdater._addRulesToConfiguration(configuration, [
|
|
73
|
+
{
|
|
74
|
+
test: rules,
|
|
75
|
+
use: [
|
|
76
|
+
{
|
|
77
|
+
loader: loader,
|
|
78
|
+
options: loaderOptions
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
type: 'json',
|
|
82
|
+
sideEffects: false
|
|
83
|
+
}
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
86
|
+
static _addRulesToConfiguration(configuration, rules) {
|
|
87
|
+
if (!configuration.module) {
|
|
88
|
+
configuration.module = {
|
|
89
|
+
rules: []
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (!configuration.module.rules) {
|
|
93
|
+
configuration.module.rules = [];
|
|
94
|
+
}
|
|
95
|
+
configuration.module.rules.push(...rules);
|
|
96
|
+
}
|
|
97
|
+
static _tryUpdateSourceMapFilename(configuration) {
|
|
98
|
+
if (!configuration.output) {
|
|
99
|
+
configuration.output = {}; // This should never happen
|
|
100
|
+
}
|
|
101
|
+
if (configuration.output.sourceMapFilename !== undefined) {
|
|
102
|
+
configuration.output.sourceMapFilename = configuration.output.sourceMapFilename.replace(FILE_TOKEN_REGEX, Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=WebpackConfigurationUpdater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebpackConfigurationUpdater.js","sourceRoot":"","sources":["../src/WebpackConfigurationUpdater.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC,OAAO,EAAoB,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAGtE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAelD,MAAM,gBAAgB,GAAW,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEzE,MAAM,OAAO,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,2BAA2B,CAAC,2BAA2B,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACjF,CAAC;IAEM,MAAM,CAAC,2CAA2C,CACvD,OAA4C;QAE5C,MAAM,MAAM,GAAW,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,yBAAyB,CAAC,CAAC;QACrF,MAA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M,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,SAAS,CAAC,mCAAmC,CAC9C,CAAC;QACJ,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport { minimatch } from 'minimatch';\nimport type * as Webpack from 'webpack';\n\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/lib-esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,EAAE,kBAAkB,EAAkD,MAAM,sBAAsB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport { LocalizationPlugin, type IStringPlaceholder as _IStringPlaceholder } from './LocalizationPlugin';\n\nexport type {\n IDefaultLocaleOptions,\n ILocaleData,\n ILocaleElementMap,\n ILocaleFileData,\n ILocalizationPluginOptions,\n ILocalizationStats,\n ILocalizationStatsChunkGroup,\n ILocalizationStatsEntrypoint,\n ILocalizationStatsOptions,\n ILocalizedData,\n ILocalizedStrings,\n IPassthroughLocaleOptions,\n IPseudolocalesOptions,\n IResolvedMissingTranslations,\n ITypingsGenerationOptions\n} from './interfaces';\n\nexport type { ILocalizedWebpackChunk } from './webpackInterfaces';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { IgnoreStringFunction, IPseudolocaleOptions } from '@rushstack/localization-utilities';\n\n/**\n * Options for the passthrough locale.\n *\n * @public\n */\nexport interface IPassthroughLocaleOptions {\n /**\n * If this is set to `true`, a passthrough locale will be included in the output\n */\n usePassthroughLocale?: boolean;\n\n /**\n * If {@link IPassthroughLocaleOptions.usePassthroughLocale} is set, use this name for the passthrough locale.\n * Defaults to \"passthrough\"\n */\n passthroughLocaleName?: string;\n}\n\n/**\n * Options for typing generation.\n *\n * @public\n */\nexport interface ITypingsGenerationOptions {\n /**\n * This property specifies the folder in which `.d.ts` files for loc files should be dropped.\n */\n generatedTsFolder: string;\n\n /**\n * Optional additional folders into which `.d.ts` files for loc files should be dropped.\n */\n secondaryGeneratedTsFolders?: string[];\n\n /**\n * This optional property overrides the compiler context for discovery of localization files\n * for which typings should be generated.\n */\n sourceRoot?: string;\n\n /**\n * If this option is set to `true`, loc modules typings will be exported wrapped in a `default` property.\n */\n exportAsDefault?: boolean;\n\n /**\n * @deprecated\n * Use {@link ILocalizationPluginOptions.ignoreString} instead.\n *\n * @internalRemarks\n * TODO: Remove when version 1.0.0 is released.\n */\n ignoreString?: (resxFilePath: string, stringName: string) => boolean;\n\n /**\n * Optionally, provide a function that will process string comments. The returned value will become the\n * TSDoc comment for the string in the typings.\n */\n processComment?: (\n comment: string | undefined,\n resxFilePath: string,\n stringName: string\n ) => string | undefined;\n}\n\n/**\n * @public\n */\nexport interface IDefaultLocaleOptions {\n /**\n * This required property specifies the name of the locale used in the\n * `.resx`, `.loc.json`, and `.resjson` files in the source\n */\n localeName: string;\n\n /**\n * If this option is set to `true`, strings that are missing from\n * `localizedData.translatedStrings` will be provided by the default locale\n */\n fillMissingTranslationStrings?: boolean;\n}\n\n/**\n * Options for generated pseudolocales.\n *\n * @public\n */\nexport interface IPseudolocalesOptions {\n [pseudoLocaleName: string]: IPseudolocaleOptions;\n}\n\n/**\n * @public\n */\nexport interface ILocalizedData {\n /**\n * Options for the locale used in the source localized data files.\n */\n defaultLocale: IDefaultLocaleOptions;\n\n /**\n * Use this parameter to specify the translated data.\n */\n translatedStrings: ILocalizedStrings;\n\n /**\n * Use this parameter to specify a function used to load translations missing from\n * the {@link ILocalizedData.translatedStrings} parameter.\n */\n resolveMissingTranslatedStrings?: (locales: string[], filePath: string) => IResolvedMissingTranslations;\n\n /**\n * Options around including a passthrough locale.\n */\n passthroughLocale?: IPassthroughLocaleOptions;\n\n /**\n * Options for pseudo-localization.\n */\n pseudolocales?: IPseudolocalesOptions;\n\n /**\n * Normalize newlines in RESX files to either CRLF (Windows-style) or LF ('nix style)\n */\n normalizeResxNewlines?: 'lf' | 'crlf';\n\n /**\n * If set to true, do not warn on missing RESX `<data>` element comments.\n */\n ignoreMissingResxComments?: boolean;\n}\n\n/**\n * Options for how localization stats data should be produced.\n *\n * @public\n */\nexport interface ILocalizationStatsOptions {\n /**\n * This option is used to designate a path at which a JSON file describing the localized\n * assets produced should be written.\n */\n dropPath?: string;\n\n /**\n * This option is used to specify a callback to be called with the stats data that would be\n * dropped at `localizationStats.dropPath` after compilation completes.\n */\n callback?: (stats: ILocalizationStats) => void;\n}\n\n/**\n * The options for localization.\n *\n * @public\n */\nexport interface ILocalizationPluginOptions {\n /**\n * Localization data.\n */\n localizedData: ILocalizedData;\n\n /**\n * This option is used to specify `.resx`, `.resx.json`, and `.loc.json` files that should not be processed by\n * this plugin.\n */\n globsToIgnore?: string[];\n\n /**\n * The value to replace the [locale] token with for chunks without localized strings. Defaults to \"none\"\n */\n noStringsLocaleName?: string;\n\n /**\n * Options for how localization stats data should be produced.\n */\n localizationStats?: ILocalizationStatsOptions;\n\n /**\n * This option is used to specify how and if TypeScript typings should be generated for loc files.\n */\n typingsOptions?: ITypingsGenerationOptions;\n\n /**\n * Optionally, provide a function that will be called for each string. If the function returns `true`\n * the string will not be included.\n */\n ignoreString?: IgnoreStringFunction;\n\n /**\n * @deprecated\n * Use {@link ILocalizationPluginOptions.globsToIgnore} instead.\n *\n * @internalRemarks\n * TODO: Remove when version 1.0.0 is released.\n */\n filesToIgnore?: string[];\n}\n\n/**\n * @public\n */\nexport interface ILocaleFileData {\n [stringName: string]: string;\n}\n\n/**\n * @public\n */\nexport interface IResolvedMissingTranslations {\n [localeName: string]: string | ILocaleFileData;\n}\n\n/**\n * @public\n */\nexport interface ILocaleData {\n [locFilePath: string]: string | ILocaleFileData;\n}\n\n/**\n * @public\n */\nexport interface ILocalizedStrings {\n [locale: string]: ILocaleData;\n}\n\n/**\n * @public\n */\nexport interface ILocaleElementMap {\n [locale: string]: string;\n}\n\n/**\n * @public\n */\nexport interface ILocalizationStatsEntrypoint {\n localizedAssets: ILocaleElementMap;\n}\n\n/**\n * @public\n */\nexport interface ILocalizationStatsChunkGroup {\n localizedAssets: ILocaleElementMap;\n}\n\n/**\n * @public\n */\nexport interface ILocalizationStats {\n entrypoints: { [name: string]: ILocalizationStatsEntrypoint };\n namedChunkGroups: { [name: string]: ILocalizationStatsChunkGroup };\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { Terminal } from '@rushstack/terminal';
|
|
4
|
+
import { parseLocFile } from '@rushstack/localization-utilities';
|
|
5
|
+
import { loaderFactory } from './LoaderFactory';
|
|
6
|
+
import { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';
|
|
7
|
+
export default loaderFactory(function (locFilePath, content, options) {
|
|
8
|
+
const locFileData = parseLocFile({
|
|
9
|
+
...options,
|
|
10
|
+
content,
|
|
11
|
+
filePath: locFilePath,
|
|
12
|
+
terminal: new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(this))
|
|
13
|
+
});
|
|
14
|
+
const resultObject = {};
|
|
15
|
+
for (const [stringName, stringValue] of Object.entries(locFileData)) {
|
|
16
|
+
resultObject[stringName] = stringValue.value;
|
|
17
|
+
}
|
|
18
|
+
return resultObject;
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=InPlaceLocFileLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InPlaceLocFileLoader.js","sourceRoot":"","sources":["../../src/loaders/InPlaceLocFileLoader.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAI3D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAA0B,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEzF,OAAO,EAAE,aAAa,EAA2B,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,eAAe,aAAa,CAAC,UAE3B,WAAmB,EACnB,OAAe,EACf,OAA2B;IAE3B,MAAM,WAAW,GAAsB,YAAY,CAAC;QAClD,GAAG,OAAO;QACV,OAAO;QACP,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,IAAI,QAAQ,CAAC,sBAAsB,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC;KAClF,CAAC,CAAC;IACH,MAAM,YAAY,GAAqC,EAAE,CAAC;IAC1D,KAAK,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QACpE,YAAY,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC;IAC/C,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { loader } from 'webpack';\n\nimport { Terminal } from '@rushstack/terminal';\nimport { type ILocalizationFile, parseLocFile } from '@rushstack/localization-utilities';\n\nimport { loaderFactory, type IBaseLoaderOptions } from './LoaderFactory';\nimport { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';\n\nexport default loaderFactory(function (\n this: loader.LoaderContext,\n locFilePath: string,\n content: string,\n options: IBaseLoaderOptions\n) {\n const locFileData: ILocalizationFile = parseLocFile({\n ...options,\n content,\n filePath: locFilePath,\n terminal: new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(this))\n });\n const resultObject: { [stringName: string]: string } = {};\n for (const [stringName, stringValue] of Object.entries(locFileData)) {\n resultObject[stringName] = stringValue.value;\n }\n\n return resultObject;\n});\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import * as loaderUtils from 'loader-utils';
|
|
4
|
+
export function loaderFactory(innerLoader) {
|
|
5
|
+
return function (content) {
|
|
6
|
+
const options = loaderUtils.getOptions(this);
|
|
7
|
+
if (typeof content !== 'string') {
|
|
8
|
+
content = content.toString();
|
|
9
|
+
}
|
|
10
|
+
const resultObject = innerLoader.call(this, this.resourcePath, content, options);
|
|
11
|
+
return JSON.stringify(resultObject);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=LoaderFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoaderFactory.js","sourceRoot":"","sources":["../../src/loaders/LoaderFactory.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAG3D,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAe5C,MAAM,UAAU,aAAa,CAC3B,WAAuF;IAEvF,OAAO,UAAsC,OAAwB;QACnE,MAAM,OAAO,GAAa,WAAW,CAAC,UAAU,CAAC,IAAI,CAAa,CAAC;QACnE,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC/B,CAAC;QAED,MAAM,YAAY,GAAkB,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAChG,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { loader } from 'webpack';\nimport * as loaderUtils from 'loader-utils';\n\nimport type { NewlineKind } from '@rushstack/node-core-library';\nimport type { IgnoreStringFunction } from '@rushstack/localization-utilities';\n\nexport interface IBaseLoaderOptions {\n resxNewlineNormalization: NewlineKind | undefined;\n ignoreMissingResxComments: boolean | undefined;\n ignoreString: IgnoreStringFunction | undefined;\n}\n\nexport interface ILoaderResult {\n [stringName: string]: string;\n}\n\nexport function loaderFactory<TOptions extends IBaseLoaderOptions>(\n innerLoader: (locFilePath: string, content: string, options: TOptions) => ILoaderResult\n): loader.Loader {\n return function (this: loader.LoaderContext, content: string | Buffer): string {\n const options: TOptions = loaderUtils.getOptions(this) as TOptions;\n if (typeof content !== 'string') {\n content = content.toString();\n }\n\n const resultObject: ILoaderResult = innerLoader.call(this, this.resourcePath, content, options);\n return JSON.stringify(resultObject);\n };\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { Terminal } from '@rushstack/terminal';
|
|
4
|
+
import { parseLocFile } from '@rushstack/localization-utilities';
|
|
5
|
+
import { loaderFactory } from './LoaderFactory';
|
|
6
|
+
import { EntityMarker } from '../utilities/EntityMarker';
|
|
7
|
+
import { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';
|
|
8
|
+
export default loaderFactory(function (locFilePath, content, options) {
|
|
9
|
+
const { pluginInstance } = options;
|
|
10
|
+
const terminal = new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(this));
|
|
11
|
+
const locFileData = parseLocFile({
|
|
12
|
+
...options,
|
|
13
|
+
content,
|
|
14
|
+
terminal,
|
|
15
|
+
filePath: locFilePath
|
|
16
|
+
});
|
|
17
|
+
const { additionalLoadedFilePaths, errors } = pluginInstance.addDefaultLocFile(terminal, locFilePath, locFileData);
|
|
18
|
+
for (const additionalFile of additionalLoadedFilePaths) {
|
|
19
|
+
this.dependency(additionalFile);
|
|
20
|
+
}
|
|
21
|
+
for (const error of errors) {
|
|
22
|
+
this.emitError(error);
|
|
23
|
+
}
|
|
24
|
+
const resultObject = {};
|
|
25
|
+
// eslint-disable-next-line guard-for-in
|
|
26
|
+
for (const stringName in locFileData) {
|
|
27
|
+
const stringKey = `${locFilePath}?${stringName}`;
|
|
28
|
+
if (pluginInstance.stringKeys.has(stringKey)) {
|
|
29
|
+
resultObject[stringName] = pluginInstance.stringKeys.get(stringKey).value;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
throw new Error(`Unexpected - missing placeholder for string key "${stringKey}"`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
EntityMarker.markEntity(this._module, true);
|
|
36
|
+
return resultObject;
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=LocLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocLoader.js","sourceRoot":"","sources":["../../src/loaders/LocLoader.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAI3D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAA0B,YAAY,EAAE,MAAM,mCAAmC,CAAC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G,CAAC,CAAC;QACpF,CAAC;IACH,CAAC;IAED,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAE5C,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { loader } from 'webpack';\n\nimport { Terminal } from '@rushstack/terminal';\nimport { type ILocalizationFile, parseLocFile } from '@rushstack/localization-utilities';\n\nimport type { LocalizationPlugin } from '../LocalizationPlugin';\nimport { loaderFactory, type IBaseLoaderOptions } from './LoaderFactory';\nimport { EntityMarker } from '../utilities/EntityMarker';\nimport { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';\n\nexport interface ILocLoaderOptions extends IBaseLoaderOptions {\n pluginInstance: LocalizationPlugin;\n}\n\nexport default loaderFactory(function (\n this: loader.LoaderContext,\n locFilePath: string,\n content: string,\n options: ILocLoaderOptions\n) {\n const { pluginInstance } = options;\n const terminal: Terminal = new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(this));\n const locFileData: ILocalizationFile = parseLocFile({\n ...options,\n content,\n terminal,\n filePath: locFilePath\n });\n const { additionalLoadedFilePaths, errors } = pluginInstance.addDefaultLocFile(\n terminal,\n locFilePath,\n locFileData\n );\n for (const additionalFile of additionalLoadedFilePaths) {\n this.dependency(additionalFile);\n }\n\n for (const error of errors) {\n this.emitError(error);\n }\n\n const resultObject: { [stringName: string]: string } = {};\n // eslint-disable-next-line guard-for-in\n for (const stringName in locFileData) {\n const stringKey: string = `${locFilePath}?${stringName}`;\n if (pluginInstance.stringKeys.has(stringKey)) {\n resultObject[stringName] = pluginInstance.stringKeys.get(stringKey)!.value;\n } else {\n throw new Error(`Unexpected - missing placeholder for string key \"${stringKey}\"`);\n }\n }\n\n EntityMarker.markEntity(this._module, true);\n\n return resultObject;\n});\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { Text } from '@rushstack/node-core-library';
|
|
4
|
+
export class Constants {
|
|
5
|
+
}
|
|
6
|
+
Constants.LOCALE_FILENAME_TOKEN = '[locale]';
|
|
7
|
+
Constants.LOCALE_FILENAME_TOKEN_REGEX = new RegExp(Text.escapeRegExp(Constants.LOCALE_FILENAME_TOKEN), 'gi');
|
|
8
|
+
Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN = '[no-locale-file]';
|
|
9
|
+
Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX = new RegExp(Text.escapeRegExp(Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN), 'gi');
|
|
10
|
+
Constants.STRING_PLACEHOLDER_PREFIX = '_LOCALIZED_STRING_f12dy0i7_n4bo_dqwj_39gf_sasqehjmihz9';
|
|
11
|
+
Constants.RESOURCE_FILE_NAME_REGEXP = /\.(resx|resx\.json|loc\.json|resjson)$/i;
|
|
12
|
+
Constants.STRING_PLACEHOLDER_LABEL = 'A';
|
|
13
|
+
Constants.LOCALE_NAME_PLACEHOLDER_LABEL = 'B';
|
|
14
|
+
Constants.JSONP_PLACEHOLDER_LABEL = 'C';
|
|
15
|
+
Constants.LOCALE_NAME_PLACEHOLDER = `${Constants.STRING_PLACEHOLDER_PREFIX}__${Constants.LOCALE_NAME_PLACEHOLDER_LABEL}_0`;
|
|
16
|
+
Constants.JSONP_PLACEHOLDER = `${Constants.STRING_PLACEHOLDER_PREFIX}__${Constants.JSONP_PLACEHOLDER_LABEL}+chunkId+_0`;
|
|
17
|
+
//# sourceMappingURL=Constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/utilities/Constants.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAEpD,MAAM,OAAO,SAAS;;AACN,+BAAqB,GAAW,UAAU,CAAC;AAC3C,qCAA2B,GAAW,IAAI,MAAM,CAC5D,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,qBAAqB,CAAC,EAClD,IAAI,CACL,CAAC;AACY,6CAAmC,GAAW,kBAAkB,CAAC;AACjE,mDAAyC,GAAW,IAAI,MAAM,CAC1E,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,mCAAmC,CAAC,EAChE,IAAI,CACL,CAAC;AACY,mCAAyB,GAAW,wDAAwD,CAAC;AAE7F,mCAAyB,GAAW,yCAAyC,CAAC;AAE9E,kCAAwB,GAAW,GAAG,CAAC;AACvC,uCAA6B,GAAW,GAAG,CAAC;AAC5C,iCAAuB,GAAW,GAAG,CAAC;AAEtC,iCAAuB,GAAW,GAAG,SAAS,CAAC,yBAAyB,KAAK,SAAS,CAAC,6BAA6B,IAAI,CAAC;AACzH,2BAAiB,GAAW,GAAG,SAAS,CAAC,yBAAyB,KAAK,SAAS,CAAC,uBAAuB,aAAa,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { Text } from '@rushstack/node-core-library';\n\nexport class Constants {\n public static LOCALE_FILENAME_TOKEN: string = '[locale]';\n public static LOCALE_FILENAME_TOKEN_REGEX: RegExp = new RegExp(\n Text.escapeRegExp(Constants.LOCALE_FILENAME_TOKEN),\n 'gi'\n );\n public static NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN: string = '[no-locale-file]';\n public static NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN_REGEX: RegExp = new RegExp(\n Text.escapeRegExp(Constants.NO_LOCALE_SOURCE_MAP_FILENAME_TOKEN),\n 'gi'\n );\n public static STRING_PLACEHOLDER_PREFIX: string = '_LOCALIZED_STRING_f12dy0i7_n4bo_dqwj_39gf_sasqehjmihz9';\n\n public static RESOURCE_FILE_NAME_REGEXP: RegExp = /\\.(resx|resx\\.json|loc\\.json|resjson)$/i;\n\n public static STRING_PLACEHOLDER_LABEL: string = 'A';\n public static LOCALE_NAME_PLACEHOLDER_LABEL: string = 'B';\n public static JSONP_PLACEHOLDER_LABEL: string = 'C';\n\n public static LOCALE_NAME_PLACEHOLDER: string = `${Constants.STRING_PLACEHOLDER_PREFIX}__${Constants.LOCALE_NAME_PLACEHOLDER_LABEL}_0`;\n public static JSONP_PLACEHOLDER: string = `${Constants.STRING_PLACEHOLDER_PREFIX}__${Constants.JSONP_PLACEHOLDER_LABEL}+chunkId+_0`;\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
const LABEL = Symbol('loc-plugin-marked');
|
|
4
|
+
/**
|
|
5
|
+
* Use the functions on this class to mark webpack entities that contain localized resources.
|
|
6
|
+
*/
|
|
7
|
+
export class EntityMarker {
|
|
8
|
+
static markEntity(module, value) {
|
|
9
|
+
module[LABEL] = value;
|
|
10
|
+
}
|
|
11
|
+
static getMark(module) {
|
|
12
|
+
return module[LABEL];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=EntityMarker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityMarker.js","sourceRoot":"","sources":["../../src/utilities/EntityMarker.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,MAAM,KAAK,GAAkB,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAMzD;;GAEG;AACH,MAAM,OAAO,YAAY;IAChB,MAAM,CAAC,UAAU,CAAU,MAAe,EAAE,KAAc;QAC9D,MAA+B,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IAClD,CAAC;IAEM,MAAM,CAAC,OAAO,CAAU,MAAe;QAC5C,OAAQ,MAA+B,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nconst LABEL: unique symbol = Symbol('loc-plugin-marked');\n\nexport interface IMarkable {\n [LABEL]: boolean;\n}\n\n/**\n * Use the functions on this class to mark webpack entities that contain localized resources.\n */\nexport class EntityMarker {\n public static markEntity<TModule>(module: TModule, value: boolean): void {\n (module as unknown as IMarkable)[LABEL] = value;\n }\n\n public static getMark<TModule>(module: TModule): boolean | undefined {\n return (module as unknown as IMarkable)[LABEL];\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { TerminalProviderSeverity } from '@rushstack/terminal';
|
|
4
|
+
export class LoaderTerminalProvider {
|
|
5
|
+
static getTerminalProviderForLoader(loaderContext) {
|
|
6
|
+
return {
|
|
7
|
+
supportsColor: false,
|
|
8
|
+
eolCharacter: '\n',
|
|
9
|
+
write: (data, severity) => {
|
|
10
|
+
switch (severity) {
|
|
11
|
+
case TerminalProviderSeverity.error: {
|
|
12
|
+
loaderContext.emitError(new Error(data));
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
case TerminalProviderSeverity.warning: {
|
|
16
|
+
loaderContext.emitWarning(new Error(data));
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=LoaderTerminalProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoaderTerminalProvider.js","sourceRoot":"","sources":["../../src/utilities/LoaderTerminalProvider.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAI3D,OAAO,EAA0B,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEvF,MAAM,OAAO,sBAAsB;IAC1B,MAAM,CAAC,4BAA4B,CAAC,aAA2C;QACpF,OAAO;YACL,aAAa,EAAE,KAAK;YACpB,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE,CAAC,IAAY,EAAE,QAAkC,EAAE,EAAE;gBAC1D,QAAQ,QAAQ,EAAE,CAAC;oBACjB,KAAK,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC;wBACpC,aAAa,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;wBACzC,MAAM;oBACR,CAAC;oBAED,KAAK,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC;wBACtC,aAAa,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;wBAC3C,MAAM;oBACR,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF","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 { type ITerminalProvider, TerminalProviderSeverity } from '@rushstack/terminal';\n\nexport class LoaderTerminalProvider {\n public static getTerminalProviderForLoader(loaderContext: webpack.loader.LoaderContext): ITerminalProvider {\n return {\n supportsColor: false,\n eolCharacter: '\\n',\n write: (data: string, severity: TerminalProviderSeverity) => {\n switch (severity) {\n case TerminalProviderSeverity.error: {\n loaderContext.emitError(new Error(data));\n break;\n }\n\n case TerminalProviderSeverity.warning: {\n loaderContext.emitWarning(new Error(data));\n break;\n }\n }\n }\n };\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpackInterfaces.js","sourceRoot":"","sources":["../src/webpackInterfaces.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type * as webpack from 'webpack';\n\n/**\n * @public\n */\nexport interface ILocalizedWebpackChunk extends webpack.compilation.Chunk {\n localizedFiles?: { [locale: string]: string };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/webpack4-localization-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "This plugin facilitates localization with Webpack.",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"
|
|
5
|
+
"main": "./lib-commonjs/index.js",
|
|
6
|
+
"module": "./lib-esm/index.js",
|
|
7
|
+
"types": "./dist/webpack4-localization-plugin.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/webpack4-localization-plugin.d.ts",
|
|
11
|
+
"node": "./lib-commonjs/index.js",
|
|
12
|
+
"import": "./lib-esm/index.js",
|
|
13
|
+
"require": "./lib-commonjs/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./lib/*": {
|
|
16
|
+
"types": "./lib-dts/*.d.ts",
|
|
17
|
+
"node": "./lib-commonjs/*.js",
|
|
18
|
+
"import": "./lib-esm/*.js",
|
|
19
|
+
"require": "./lib-commonjs/*.js"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"typesVersions": {
|
|
24
|
+
"*": {
|
|
25
|
+
"lib/*": [
|
|
26
|
+
"lib-dts/*"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
7
30
|
"license": "MIT",
|
|
8
31
|
"repository": {
|
|
9
32
|
"type": "git",
|
|
@@ -31,9 +54,9 @@
|
|
|
31
54
|
"@types/tapable": "1.0.6",
|
|
32
55
|
"loader-utils": "1.4.2",
|
|
33
56
|
"minimatch": "10.1.2",
|
|
34
|
-
"@rushstack/
|
|
35
|
-
"@rushstack/
|
|
36
|
-
"@rushstack/
|
|
57
|
+
"@rushstack/localization-utilities": "0.15.1",
|
|
58
|
+
"@rushstack/terminal": "0.22.1",
|
|
59
|
+
"@rushstack/node-core-library": "5.20.1"
|
|
37
60
|
},
|
|
38
61
|
"devDependencies": {
|
|
39
62
|
"@rushstack/set-webpack-public-path-plugin": "^4.1.16",
|
|
@@ -42,9 +65,10 @@
|
|
|
42
65
|
"@types/webpack": "4.41.32",
|
|
43
66
|
"eslint": "~9.37.0",
|
|
44
67
|
"webpack": "~4.47.0",
|
|
45
|
-
"@rushstack/heft": "1.1
|
|
68
|
+
"@rushstack/heft": "1.2.1",
|
|
46
69
|
"local-node-rig": "1.0.0"
|
|
47
70
|
},
|
|
71
|
+
"sideEffects": false,
|
|
48
72
|
"scripts": {
|
|
49
73
|
"build": "heft build --clean",
|
|
50
74
|
"_phase:build": "heft run --only build -- --clean"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|