@rushstack/webpack5-localization-plugin 0.1.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/LICENSE +24 -0
- package/README.md +209 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/webpack5-localization-plugin.d.ts +274 -0
- package/lib/AssetProcessor.d.ts +26 -0
- package/lib/AssetProcessor.d.ts.map +1 -0
- package/lib/AssetProcessor.js +243 -0
- package/lib/AssetProcessor.js.map +1 -0
- package/lib/LocalizationPlugin.d.ts +79 -0
- package/lib/LocalizationPlugin.d.ts.map +1 -0
- package/lib/LocalizationPlugin.js +586 -0
- package/lib/LocalizationPlugin.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -0
- package/lib/interfaces.d.ts +173 -0
- package/lib/interfaces.d.ts.map +1 -0
- package/lib/interfaces.js +5 -0
- package/lib/interfaces.js.map +1 -0
- package/lib/loaders/IResxLoaderOptions.d.ts +12 -0
- package/lib/loaders/IResxLoaderOptions.d.ts.map +1 -0
- package/lib/loaders/IResxLoaderOptions.js +5 -0
- package/lib/loaders/IResxLoaderOptions.js.map +1 -0
- package/lib/loaders/LoaderFactory.d.ts +6 -0
- package/lib/loaders/LoaderFactory.d.ts.map +1 -0
- package/lib/loaders/LoaderFactory.js +28 -0
- package/lib/loaders/LoaderFactory.js.map +1 -0
- package/lib/loaders/default-locale-loader.d.ts +8 -0
- package/lib/loaders/default-locale-loader.d.ts.map +1 -0
- package/lib/loaders/default-locale-loader.js +26 -0
- package/lib/loaders/default-locale-loader.js.map +1 -0
- package/lib/loaders/loc-loader.d.ts +15 -0
- package/lib/loaders/loc-loader.d.ts.map +1 -0
- package/lib/loaders/loc-loader.js +23 -0
- package/lib/loaders/loc-loader.js.map +1 -0
- package/lib/loaders/locjson-loader.d.ts +5 -0
- package/lib/loaders/locjson-loader.d.ts.map +1 -0
- package/lib/loaders/locjson-loader.js +14 -0
- package/lib/loaders/locjson-loader.js.map +1 -0
- package/lib/loaders/resjson-loader.d.ts +5 -0
- package/lib/loaders/resjson-loader.d.ts.map +1 -0
- package/lib/loaders/resjson-loader.js +14 -0
- package/lib/loaders/resjson-loader.js.map +1 -0
- package/lib/loaders/resx-loader.d.ts +5 -0
- package/lib/loaders/resx-loader.d.ts.map +1 -0
- package/lib/loaders/resx-loader.js +21 -0
- package/lib/loaders/resx-loader.js.map +1 -0
- package/lib/utilities/Constants.d.ts +12 -0
- package/lib/utilities/Constants.d.ts.map +1 -0
- package/lib/utilities/Constants.js +17 -0
- package/lib/utilities/Constants.js.map +1 -0
- package/lib/utilities/EntityMarker.d.ts +9 -0
- package/lib/utilities/EntityMarker.d.ts.map +1 -0
- package/lib/utilities/EntityMarker.js +21 -0
- package/lib/utilities/EntityMarker.js.map +1 -0
- package/lib/utilities/LoaderTerminalProvider.d.ts +6 -0
- package/lib/utilities/LoaderTerminalProvider.d.ts.map +1 -0
- package/lib/utilities/LoaderTerminalProvider.js +28 -0
- package/lib/utilities/LoaderTerminalProvider.js.map +1 -0
- package/lib/webpackInterfaces.d.ts +13 -0
- package/lib/webpackInterfaces.d.ts.map +1 -0
- package/lib/webpackInterfaces.js +5 -0
- package/lib/webpackInterfaces.js.map +1 -0
- package/package.json +35 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"LocalizationPlugin.js","sourceRoot":"","sources":["../src/LocalizationPlugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAe7B,8EAAwG;AAExG,iEAAmD;AASnD,2DAA+D;AAC/D,qDAAmF;AA4BnF,MAAM,WAAW,GAAmB,cAAc,CAAC;AAEnD,MAAM,iBAAiB,GAA0C,IAAI,OAAO,EAAE,CAAC;AAE/E;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,QAA8B;IAC9D,MAAM,QAAQ,G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CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,gBAAgB,GAAsB,IAAA,qCAAY,EAAC;YACvD,QAAQ,EAAE,aAAa;YACvB,OAAO;SACR,CAAC,CAAC;QAEH,OAAO,gCAAgC,CAAC,gBAAgB,CAAC,CAAC;KAC3D;SAAM;QACL,OAAO,aAAa,YAAY,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;KAC9F;AACH,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 * as path from 'path';\n\nimport type {\n Asset,\n Chunk,\n ChunkGraph,\n Compilation,\n Compiler,\n LoaderContext,\n Module,\n runtime,\n WebpackError,\n WebpackPluginInstance\n} from 'webpack';\n\nimport { getPseudolocalizer, ILocalizationFile, parseResJson } from '@rushstack/localization-utilities';\n\nimport * as Constants from './utilities/Constants';\nimport type {\n ILocalizationPluginOptions,\n ILocalizationStats,\n ILocaleFileData,\n ILocaleFileObject,\n IResolvedMissingTranslations\n} from './interfaces';\nimport type { IAssetPathOptions } from './webpackInterfaces';\nimport { markEntity, getMark } from './utilities/EntityMarker';\nimport { processLocalizedAsset, processNonLocalizedAsset } from './AssetProcessor';\n\n/**\n * @public\n */\nexport interface IStringPlaceholder {\n /**\n * The literal string that will be injected for later replacement.\n */\n value: string;\n /**\n * The identifier for this particular placeholder, for lookup.\n */\n suffix: string;\n /**\n * The values of this string in each output locale.\n */\n valuesByLocale: Map<string, string>;\n /**\n * The key used to identify the source file containing the string.\n */\n locFilePath: string;\n /**\n * The identifier of the string within its original source file.\n */\n stringName: string;\n}\n\nconst PLUGIN_NAME: 'localization' = 'localization';\n\nconst pluginForCompiler: WeakMap<Compiler, LocalizationPlugin> = new WeakMap();\n\n/**\n * Gets the instance of the LocalizationPlugin bound to the specified webpack compiler.\n * Used by loaders.\n */\nexport function getPluginInstance(compiler: Compiler | undefined): LocalizationPlugin {\n const instance: LocalizationPlugin | undefined = compiler && pluginForCompiler.get(compiler);\n if (!instance) {\n throw new Error(`Could not find a LocalizationPlugin instance for the current webpack compiler!`);\n }\n return instance;\n}\n\n/**\n * This plugin facilitates localization in webpack.\n *\n * @public\n */\nexport class LocalizationPlugin implements WebpackPluginInstance {\n private readonly _stringKeys: Map<string, IStringPlaceholder> = new Map();\n\n private readonly _options: ILocalizationPluginOptions;\n private readonly _resolvedTranslatedStringsFromOptions: Map<\n string,\n Map<string, ILocaleFileObject | string | ReadonlyMap<string, string>>\n > = new Map();\n private _stringPlaceholderCounter: number = 0;\n private readonly _stringPlaceholderMap: Map<string, IStringPlaceholder> = new Map();\n private _passthroughLocaleName!: string;\n private _defaultLocale!: string;\n private _noStringsLocaleName!: string;\n private _fillMissingTranslationStrings!: boolean;\n private readonly _pseudolocalizers: Map<string, (str: string) => string> = new Map();\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\n public constructor(options: ILocalizationPluginOptions) {\n this._options = options;\n }\n\n /**\n * Apply this plugin to the specified webpack compiler.\n */\n public apply(compiler: Compiler): void {\n pluginForCompiler.set(compiler, this);\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, isWebpackDevServer);\n\n if (errors.length > 0 || warnings.length > 0) {\n compiler.hooks.compilation.tap(PLUGIN_NAME, (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 return;\n }\n }\n\n const {\n WebpackError,\n runtime: { GetChunkFilenameRuntimeModule }\n } = compiler.webpack;\n\n // Side-channel for async chunk URL generator chunk, since the actual chunk is completely inaccessible\n // from the assetPath hook below when invoked to build the async URL generator\n let chunkWithAsyncURLGenerator: Chunk | undefined;\n\n const originalGenerate: typeof GetChunkFilenameRuntimeModule.prototype.generate =\n GetChunkFilenameRuntimeModule.prototype.generate;\n GetChunkFilenameRuntimeModule.prototype.generate = function (\n this: runtime.GetChunkFilenameRuntimeModule\n ) {\n // `originalGenerate` will invoke `getAssetPath` to produce the async URL generator\n // Need to know the identity of the containing chunk to correctly produce the asset path expression\n chunkWithAsyncURLGenerator = this.chunk;\n const result: string = originalGenerate.call(this);\n // Unset after the call finishes because we are no longer generating async URL generators\n chunkWithAsyncURLGenerator = undefined;\n return result;\n };\n\n const asyncGeneratorTest: RegExp = /^\\\" \\+/;\n\n const { runtimeLocaleExpression } = this._options;\n\n compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation: Compilation) => {\n compilation.hooks.assetPath.tap(\n PLUGIN_NAME,\n (assetPath: string, options: IAssetPathOptions): string => {\n const { chunkGraph } = compilation;\n\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.match(asyncGeneratorTest)) {\n const chunkIdsWithStrings: Set<number | string> = new Set<number | string>();\n const chunkIdsWithoutStrings: Set<number | string> = new Set<number | string>();\n\n if (!chunkWithAsyncURLGenerator) {\n compilation.errors.push(\n new WebpackError(`No active chunk while constructing async chunk URL generator!`)\n );\n return assetPath;\n }\n\n const asyncChunks: Set<Chunk> = chunkWithAsyncURLGenerator!.getAllAsyncChunks();\n for (const asyncChunk of asyncChunks) {\n const chunkId: number | string | null = asyncChunk.id;\n\n if (chunkId === null || chunkId === undefined) {\n throw new Error(`Chunk \"${asyncChunk.name}\"'s ID is null or undefined.`);\n }\n\n if (_chunkHasLocalizedModules(chunkGraph, asyncChunk, runtimeLocaleExpression)) {\n chunkIdsWithStrings.add(chunkId);\n } else {\n chunkIdsWithoutStrings.add(chunkId);\n }\n }\n\n return assetPath.replace(Constants.LOCALE_FILENAME_TOKEN_REGEX, () => {\n // Use a replacer function so that we don't need to escape anything in the return value\n\n // If the runtime chunk is itself localized, forcibly match the locale of the runtime chunk\n // Otherwise prefer the runtime expression if specified\n const localeExpression: string =\n (!_chunkHasLocalizedModules(\n chunkGraph,\n chunkWithAsyncURLGenerator!,\n runtimeLocaleExpression\n ) &&\n runtimeLocaleExpression) ||\n Constants.JSONP_PLACEHOLDER;\n\n if (chunkIdsWithStrings.size === 0) {\n return this._noStringsLocaleName;\n } else if (chunkIdsWithoutStrings.size === 0) {\n return `\" + ${localeExpression} + \"`;\n } else {\n // Generate an object that is used to select between <locale> and <nostrings locale> for each chunk ID\n // Method: pick the smaller set of (localized, non-localized) and map that to 1 (a truthy value)\n // All other IDs map to `undefined` (a falsy value), so we then use the ternary operator to select\n // the appropriate token\n //\n // This can be improved in the future. We can maybe sort the chunks such that the chunks below a certain ID\n // number are localized and the those above are not.\n const chunkMapping: { [chunkId: string]: 1 } = {};\n // Use the map with the fewest values to shorten the expression\n const isLocalizedSmaller: boolean = chunkIdsWithStrings.size <= chunkIdsWithoutStrings.size;\n // These are the ids for which the expression should evaluate to a truthy value\n const smallerSet: Set<number | string> = isLocalizedSmaller\n ? chunkIdsWithStrings\n : chunkIdsWithoutStrings;\n for (const id of smallerSet) {\n chunkMapping[id] = 1;\n }\n\n const noLocaleExpression: string = JSON.stringify(this._noStringsLocaleName);\n\n return `\" + (${JSON.stringify(chunkMapping)}[chunkId]?${\n isLocalizedSmaller ? localeExpression : noLocaleExpression\n }:${isLocalizedSmaller ? noLocaleExpression : localeExpression}) + \"`;\n }\n });\n } else {\n let locale: string | undefined = options.locale;\n if (!locale) {\n const isLocalized: boolean = _chunkHasLocalizedModules(\n chunkGraph,\n options.chunk as Chunk,\n runtimeLocaleExpression\n );\n // Ensure that the initial name maps to a file that should exist in the final output\n locale = isLocalized ? this._defaultLocale : this._noStringsLocaleName;\n }\n return assetPath.replace(Constants.LOCALE_FILENAME_TOKEN_REGEX, locale);\n }\n } else {\n return assetPath;\n }\n }\n );\n\n const { outputOptions } = compilation;\n\n // For compatibility with minifiers, need to generate the additional assets after the optimize process runs\n compilation.hooks.processAssets.tapPromise(\n {\n name: PLUGIN_NAME,\n // Generating derived assets, but explicitly want to create them *after* asset optimization\n stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE - 1\n },\n async (): Promise<void> => {\n const locales: Set<string> = new Set(this._resolvedLocalizedStrings.keys());\n\n const { chunkGraph, chunks } = compilation;\n\n const filesByChunkName: Map<string, Record<string, string>> = new Map();\n const localizedEntryPointNames: string[] = [];\n const localizedChunkNames: string[] = [];\n\n const { localizationStats: statsOptions } = this._options;\n\n for (const chunk of chunks) {\n const isLocalized: boolean = _chunkHasLocalizedModules(\n chunkGraph,\n chunk,\n runtimeLocaleExpression\n );\n\n const template: Parameters<typeof Compilation.prototype.getAssetPath>[0] =\n chunk.filenameTemplate ||\n (chunk.hasRuntime() ? outputOptions.filename : outputOptions.chunkFilename)!;\n\n const defaultAssetName: string = compilation.getPath(template, {\n chunk,\n contentHashType: 'javascript'\n // Without locale this should return the name of the default asset\n });\n\n const asset: Asset | undefined = compilation.getAsset(defaultAssetName);\n if (!asset) {\n compilation.errors.push(new WebpackError(`Missing expected chunk asset ${defaultAssetName}`));\n continue;\n }\n\n if (isLocalized) {\n const localizedAssets: Record<string, string> = processLocalizedAsset({\n // Global values\n plugin: this,\n compilation,\n locales,\n defaultLocale: this._defaultLocale,\n fillMissingTranslationStrings: this._fillMissingTranslationStrings,\n // Chunk-specific values\n chunk,\n asset,\n filenameTemplate: template\n });\n\n if (statsOptions) {\n if (chunk.name) {\n filesByChunkName.set(chunk.name, localizedAssets);\n (chunk.hasRuntime() ? localizedEntryPointNames : localizedChunkNames).push(chunk.name);\n }\n }\n } else {\n processNonLocalizedAsset({\n // Global values\n plugin: this,\n compilation,\n noStringsLocaleName: this._noStringsLocaleName,\n // Chunk-specific values\n chunk,\n asset,\n fileName: defaultAssetName\n });\n }\n }\n\n // Since the stats generation doesn't depend on content, do it immediately\n if (statsOptions) {\n const localizationStats: ILocalizationStats = {\n entrypoints: {},\n namedChunkGroups: {}\n };\n\n // Sort in lexicographic order to ensure stable output\n localizedChunkNames.sort();\n for (const chunkName of localizedChunkNames) {\n localizationStats.namedChunkGroups[chunkName] = {\n localizedAssets: filesByChunkName.get(chunkName)!\n };\n }\n\n // Sort in lexicographic order to ensure stable output\n localizedEntryPointNames.sort();\n for (const chunkName of localizedEntryPointNames) {\n localizationStats.entrypoints[chunkName] = {\n localizedAssets: filesByChunkName.get(chunkName)!\n };\n }\n\n const { dropPath, callback } = statsOptions;\n\n if (dropPath) {\n compilation.emitAsset(\n dropPath,\n new compiler.webpack.sources.RawSource(JSON.stringify(localizationStats))\n );\n }\n\n if (callback) {\n try {\n callback(localizationStats);\n } catch (e) {\n /* swallow errors from the callback */\n }\n }\n }\n }\n );\n });\n }\n\n /**\n * @public\n *\n * @returns An object mapping the string keys to placeholders\n */\n public async addDefaultLocFileAsync(\n context: LoaderContext<{}>,\n localizedFileKey: string,\n localizedResourceData: ILocalizationFile\n ): Promise<Record<string, string>> {\n const locFileData: ReadonlyMap<string, string> = convertLocalizationFileToLocData(localizedResourceData);\n const resultObject: Record<string, string> = this._addLocFileAndGetPlaceholders(\n this._defaultLocale,\n localizedFileKey,\n locFileData\n );\n\n const missingLocales: string[] = [];\n for (const [translatedLocaleName, translatedStrings] of this._resolvedTranslatedStringsFromOptions) {\n const translatedLocFileFromOptions: ILocaleFileData | undefined =\n translatedStrings.get(localizedFileKey);\n\n if (!translatedLocFileFromOptions) {\n missingLocales.push(translatedLocaleName);\n } else {\n const translatedLocFileData: ReadonlyMap<string, string> = await normalizeLocalizedData(\n context,\n translatedLocFileFromOptions\n );\n this._addTranslations(translatedLocaleName, localizedFileKey, translatedLocFileData);\n }\n }\n\n const { resolveMissingTranslatedStrings } = this._options.localizedData;\n\n if (missingLocales.length > 0 && resolveMissingTranslatedStrings) {\n let resolvedTranslatedData: IResolvedMissingTranslations | undefined = undefined;\n try {\n resolvedTranslatedData = await resolveMissingTranslatedStrings(\n missingLocales,\n localizedFileKey,\n context\n );\n } catch (e) {\n context.emitError(e);\n }\n\n if (resolvedTranslatedData) {\n const iterable: Iterable<[string, ILocaleFileData]> =\n resolvedTranslatedData instanceof Map\n ? resolvedTranslatedData.entries()\n : Object.entries(resolvedTranslatedData);\n for (const [resolvedLocaleName, resolvedLocaleData] of iterable) {\n if (resolvedLocaleData) {\n const translatedLocFileData: ReadonlyMap<string, string> = await normalizeLocalizedData(\n context,\n resolvedLocaleData\n );\n this._addTranslations(resolvedLocaleName, localizedFileKey, translatedLocFileData);\n }\n }\n }\n }\n\n for (const [pseudolocaleName, pseudolocalizer] of this._pseudolocalizers) {\n const pseudolocFileData: Map<string, string> = new Map();\n\n for (const [stringName, stringValue] of locFileData) {\n pseudolocFileData.set(stringName, pseudolocalizer(stringValue));\n }\n\n this._addTranslations(pseudolocaleName, localizedFileKey, pseudolocFileData);\n }\n\n markEntity(context._module!, true);\n\n return resultObject;\n }\n\n /**\n * @public\n */\n public getPlaceholder(localizedFileKey: string, stringName: string): IStringPlaceholder | undefined {\n const stringKey: string = `${localizedFileKey}?${stringName}`;\n return this._stringKeys.get(stringKey);\n }\n\n /**\n * @internal\n */\n public getDataForSerialNumber(serialNumber: string): IStringPlaceholder | undefined {\n return this._stringPlaceholderMap.get(serialNumber);\n }\n\n private _addLocFileAndGetPlaceholders(\n localeName: string,\n localizedFileKey: string,\n localizedFileData: ReadonlyMap<string, string>\n ): Record<string, string> {\n const filesMap: Map<string, ReadonlyMap<string, string>> = this._resolvedLocalizedStrings.get(\n localeName\n )!;\n\n filesMap.set(localizedFileKey, localizedFileData);\n\n const resultObject: Record<string, string> = {};\n for (const [stringName, stringValue] of localizedFileData) {\n const stringKey: string = `${localizedFileKey}?${stringName}`;\n let placeholder: IStringPlaceholder | undefined = this._stringKeys.get(stringKey);\n if (!placeholder) {\n // TODO: This may need to be a deterministic identifier to support watch / incremental compilation\n const suffix: string = `${this._stringPlaceholderCounter++}`;\n\n const values: Map<string, string> = new Map();\n values.set(this._passthroughLocaleName, stringName);\n\n placeholder = {\n value: `${Constants.STRING_PLACEHOLDER_PREFIX}_\\\\_${Constants.STRING_PLACEHOLDER_LABEL}_${suffix}`,\n suffix,\n valuesByLocale: values,\n locFilePath: localizedFileKey,\n stringName\n };\n\n this._stringKeys.set(stringKey, placeholder);\n this._stringPlaceholderMap.set(suffix, placeholder);\n }\n\n resultObject[stringName] = placeholder.value;\n\n placeholder.valuesByLocale.set(localeName, stringValue);\n }\n\n return resultObject;\n }\n\n private _addTranslations(\n localeName: string,\n localizedFileKey: string,\n localizedFileData: ReadonlyMap<string, string>\n ): void {\n for (const [stringName, stringValue] of localizedFileData) {\n const stringKey: string = `${localizedFileKey}?${stringName}`;\n const placeholder: IStringPlaceholder | undefined = this._stringKeys.get(stringKey);\n if (placeholder) {\n placeholder.valuesByLocale.set(localeName, stringValue);\n }\n }\n }\n\n private _initializeAndValidateOptions(\n compiler: Compiler,\n isWebpackDevServer: boolean\n ): { errors: WebpackError[]; warnings: WebpackError[] } {\n const errors: WebpackError[] = [];\n const warnings: WebpackError[] = [];\n\n const { WebpackError } = compiler.webpack;\n const { options: configuration } = compiler;\n\n const LOCALE_NAME_REGEX: RegExp = /[a-z-]/i;\n function ensureValidLocaleName(localeName: string): boolean {\n if (!localeName.match(LOCALE_NAME_REGEX)) {\n errors.push(\n new WebpackError(\n `Invalid locale name: ${localeName}. Locale names may only contain letters and hyphens.`\n )\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 WebpackError(\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 // START options.localizedData\n const { localizedData } = this._options;\n if (localizedData) {\n // START options.localizedData.passthroughLocale\n const { passthroughLocale } = localizedData;\n if (passthroughLocale) {\n const { usePassthroughLocale, passthroughLocaleName = 'passthrough' } = passthroughLocale;\n if (usePassthroughLocale) {\n this._passthroughLocaleName = passthroughLocaleName;\n this._resolvedLocalizedStrings.set(passthroughLocaleName, new Map());\n }\n }\n // END options.localizedData.passthroughLocale\n\n // START options.localizedData.translatedStrings\n const { translatedStrings } = localizedData;\n this._resolvedTranslatedStringsFromOptions.clear();\n if (translatedStrings) {\n for (const [localeName, locale] of Object.entries(translatedStrings)) {\n if (this._resolvedLocalizedStrings.has(localeName)) {\n errors.push(\n new WebpackError(\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._resolvedLocalizedStrings.set(localeName, new Map());\n const resolvedFromOptionsForLocale: Map<string, ILocaleFileData> = new Map();\n this._resolvedTranslatedStringsFromOptions.set(localeName, resolvedFromOptionsForLocale);\n\n for (const [locFilePath, locFileDataFromOptions] of Object.entries(locale)) {\n const normalizedLocFilePath: string = path.resolve(configuration.context!, locFilePath);\n\n if (resolvedFromOptionsForLocale.has(normalizedLocFilePath)) {\n errors.push(\n new WebpackError(\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 const normalizedLocFileDataFromOptions: ILocaleFileData =\n typeof locFileDataFromOptions === 'string'\n ? path.resolve(configuration.context!, locFileDataFromOptions)\n : locFileDataFromOptions;\n\n resolvedFromOptionsForLocale.set(normalizedLocFilePath, normalizedLocFileDataFromOptions);\n }\n }\n }\n // END options.localizedData.translatedStrings\n\n // START options.localizedData.defaultLocale\n const { defaultLocale } = localizedData;\n if (defaultLocale) {\n const { localeName, fillMissingTranslationStrings } = defaultLocale;\n if (localeName) {\n if (this._resolvedLocalizedStrings.has(localeName)) {\n errors.push(new WebpackError('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._resolvedLocalizedStrings.set(localeName, new Map());\n this._defaultLocale = localeName;\n this._fillMissingTranslationStrings = !!fillMissingTranslationStrings;\n } else {\n errors.push(new WebpackError('Missing default locale name'));\n return { errors, warnings };\n }\n } else {\n errors.push(new WebpackError('Missing default locale options.'));\n return { errors, warnings };\n }\n // END options.localizedData.defaultLocale\n\n // START options.localizedData.pseudoLocales\n const { pseudolocales } = localizedData;\n if (pseudolocales) {\n for (const [pseudolocaleName, pseudoLocaleOpts] of Object.entries(pseudolocales)) {\n if (this._defaultLocale === pseudolocaleName) {\n errors.push(\n new WebpackError(`A pseudolocale (${pseudolocaleName}) name is also the default locale name.`)\n );\n return { errors, warnings };\n }\n\n if (this._resolvedLocalizedStrings.has(pseudolocaleName)) {\n errors.push(\n new WebpackError(\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._resolvedLocalizedStrings.set(pseudolocaleName, new Map<string, Map<string, string>>());\n }\n }\n // END options.localizedData.pseudoLocales\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 const { noStringsLocaleName } = this._options;\n if (\n noStringsLocaleName === undefined ||\n noStringsLocaleName === null ||\n !ensureValidLocaleName(noStringsLocaleName)\n ) {\n this._noStringsLocaleName = 'none';\n } else {\n this._noStringsLocaleName = noStringsLocaleName;\n }\n // END options.noStringsLocaleName\n\n return { errors, warnings };\n }\n}\n\nfunction _chunkHasLocalizedModules(\n chunkGraph: ChunkGraph,\n chunk: Chunk,\n runtimeLocaleExpression: string | undefined\n): boolean {\n let chunkHasAnyLocModules: boolean | undefined = getMark(chunk);\n if (chunkHasAnyLocModules === undefined) {\n chunkHasAnyLocModules = false;\n const candidateModules: Iterable<Module> | undefined = chunkGraph.getChunkModulesIterableBySourceType(\n chunk,\n 'javascript'\n );\n if (candidateModules) {\n outer: for (const module of candidateModules) {\n const moduleMark: boolean | undefined = getMark(module);\n if (moduleMark) {\n chunkHasAnyLocModules = true;\n break;\n } else if (moduleMark === false) {\n continue;\n }\n\n // Is this a concatenated module?\n const { _modules: modules } = module as { _modules?: Iterable<Module> };\n if (modules) {\n for (const nestedModule of modules) {\n if (getMark(nestedModule)) {\n markEntity(module, true);\n chunkHasAnyLocModules = true;\n break outer;\n }\n }\n markEntity(module, false);\n }\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 && !runtimeLocaleExpression && chunk.hasRuntime()) {\n for (const asyncChunk of chunk.getAllAsyncChunks()) {\n if (_chunkHasLocalizedModules(chunkGraph, asyncChunk, runtimeLocaleExpression)) {\n chunkHasAnyLocModules = true;\n break;\n }\n }\n }\n\n markEntity(chunk, chunkHasAnyLocModules);\n }\n\n return chunkHasAnyLocModules;\n}\n\nfunction convertLocalizationFileToLocData(locFile: ILocalizationFile): ReadonlyMap<string, string> {\n const locFileData: Map<string, string> = new Map();\n for (const [stringName, locFileEntry] of Object.entries(locFile)) {\n locFileData.set(stringName, locFileEntry.value);\n }\n\n return locFileData;\n}\n\nasync function normalizeLocalizedData(\n context: LoaderContext<{}>,\n localizedData: ILocaleFileData\n): Promise<ReadonlyMap<string, string>> {\n if (typeof localizedData === 'string') {\n // The value is the path to a file. Add it as a file dependency\n context.addDependency(localizedData);\n const content: string = await new Promise((resolve, reject) => {\n // Use context.fs so that the plugin is compatible with overriding compiler.inputFileSystem\n context.fs.readFile(localizedData, (err, data) => {\n if (err) {\n return reject(err);\n } else if (!data) {\n return reject(new Error(`No data in ${localizedData}`));\n }\n resolve(data.toString());\n });\n });\n\n const localizationFile: ILocalizationFile = parseResJson({\n filePath: localizedData,\n content\n });\n\n return convertLocalizationFileToLocData(localizationFile);\n } else {\n return localizedData instanceof Map ? localizedData : new Map(Object.entries(localizedData));\n }\n}\n"]}
|
package/lib/index.d.ts
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
export { LocalizationPlugin, IStringPlaceholder as _IStringPlaceholder } from './LocalizationPlugin';
|
2
|
+
export { IDefaultLocaleOptions, ILocaleData, ILocaleElementMap, ILocaleFileData, ILocaleFileObject, ILocalizationPluginOptions, ILocalizationStats, ILocalizationStatsChunkGroup, ILocalizationStatsEntrypoint, ILocalizationStatsOptions, ILocalizedData, ILocalizedStrings, IPassthroughLocaleOptions, IPseudolocalesOptions, IResolvedMissingTranslations } from './interfaces';
|
3
|
+
export { ILocalizedWebpackChunk } from './webpackInterfaces';
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAErG,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,0BAA0B,EAC1B,kBAAkB,EAClB,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,EACzB,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,4BAA4B,EAC7B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/lib/index.js
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
3
|
+
// See LICENSE in the project root for license information.
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
exports.LocalizationPlugin = void 0;
|
6
|
+
var LocalizationPlugin_1 = require("./LocalizationPlugin");
|
7
|
+
Object.defineProperty(exports, "LocalizationPlugin", { enumerable: true, get: function () { return LocalizationPlugin_1.LocalizationPlugin; } });
|
8
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,2DAAqG;AAA5F,wHAAA,kBAAkB,OAAA","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, IStringPlaceholder as _IStringPlaceholder } from './LocalizationPlugin';\n\nexport {\n IDefaultLocaleOptions,\n ILocaleData,\n ILocaleElementMap,\n ILocaleFileData,\n ILocaleFileObject,\n ILocalizationPluginOptions,\n ILocalizationStats,\n ILocalizationStatsChunkGroup,\n ILocalizationStatsEntrypoint,\n ILocalizationStatsOptions,\n ILocalizedData,\n ILocalizedStrings,\n IPassthroughLocaleOptions,\n IPseudolocalesOptions,\n IResolvedMissingTranslations\n} from './interfaces';\n\nexport { ILocalizedWebpackChunk } from './webpackInterfaces';\n"]}
|
@@ -0,0 +1,173 @@
|
|
1
|
+
import type { LoaderContext } from 'webpack';
|
2
|
+
import type { IPseudolocaleOptions } from '@rushstack/localization-utilities';
|
3
|
+
/**
|
4
|
+
* Options for the passthrough locale.
|
5
|
+
*
|
6
|
+
* @public
|
7
|
+
*/
|
8
|
+
export interface IPassthroughLocaleOptions {
|
9
|
+
/**
|
10
|
+
* If this is set to `true`, a passthrough locale will be included in the output
|
11
|
+
*/
|
12
|
+
usePassthroughLocale?: boolean;
|
13
|
+
/**
|
14
|
+
* If {@link IPassthroughLocaleOptions.usePassthroughLocale} is set, use this name for the passthrough locale.
|
15
|
+
* Defaults to "passthrough"
|
16
|
+
*/
|
17
|
+
passthroughLocaleName?: string;
|
18
|
+
}
|
19
|
+
/**
|
20
|
+
* @public
|
21
|
+
*/
|
22
|
+
export interface IDefaultLocaleOptions {
|
23
|
+
/**
|
24
|
+
* This required property specifies the name of the locale used in the
|
25
|
+
* `.resx`, `.loc.json`, and `.resjson` files in the source
|
26
|
+
*/
|
27
|
+
localeName: string;
|
28
|
+
/**
|
29
|
+
* If this option is set to `true`, strings that are missing from
|
30
|
+
* `localizedData.translatedStrings` will be provided by the default locale
|
31
|
+
*/
|
32
|
+
fillMissingTranslationStrings?: boolean;
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* Options for generated pseudolocales.
|
36
|
+
*
|
37
|
+
* @public
|
38
|
+
*/
|
39
|
+
export interface IPseudolocalesOptions {
|
40
|
+
[pseudoLocaleName: string]: IPseudolocaleOptions;
|
41
|
+
}
|
42
|
+
/**
|
43
|
+
* @public
|
44
|
+
*/
|
45
|
+
export interface ILocalizedData {
|
46
|
+
/**
|
47
|
+
* Options for the locale used in the source localized data files.
|
48
|
+
*/
|
49
|
+
defaultLocale: IDefaultLocaleOptions;
|
50
|
+
/**
|
51
|
+
* Use this parameter to specify the translated data.
|
52
|
+
*/
|
53
|
+
translatedStrings: ILocalizedStrings;
|
54
|
+
/**
|
55
|
+
* Use this parameter to specify a function used to load translations missing from
|
56
|
+
* the {@link ILocalizedData.translatedStrings} parameter.
|
57
|
+
*/
|
58
|
+
resolveMissingTranslatedStrings?: (locales: string[], localizedFileKey: string, loaderContext: LoaderContext<{}>) => Promise<IResolvedMissingTranslations> | IResolvedMissingTranslations;
|
59
|
+
/**
|
60
|
+
* Options around including a passthrough locale.
|
61
|
+
*/
|
62
|
+
passthroughLocale?: IPassthroughLocaleOptions;
|
63
|
+
/**
|
64
|
+
* Options for pseudo-localization.
|
65
|
+
*/
|
66
|
+
pseudolocales?: IPseudolocalesOptions;
|
67
|
+
}
|
68
|
+
/**
|
69
|
+
* Options for how localization stats data should be produced.
|
70
|
+
*
|
71
|
+
* @public
|
72
|
+
*/
|
73
|
+
export interface ILocalizationStatsOptions {
|
74
|
+
/**
|
75
|
+
* This option is used to designate a path at which a JSON file describing the localized
|
76
|
+
* assets produced should be written.
|
77
|
+
*/
|
78
|
+
dropPath?: string;
|
79
|
+
/**
|
80
|
+
* This option is used to specify a callback to be called with the stats data that would be
|
81
|
+
* dropped at `localizationStats.dropPath` after compilation completes.
|
82
|
+
*/
|
83
|
+
callback?: (stats: ILocalizationStats) => void;
|
84
|
+
}
|
85
|
+
/**
|
86
|
+
* The options for localization.
|
87
|
+
*
|
88
|
+
* @public
|
89
|
+
*/
|
90
|
+
export interface ILocalizationPluginOptions {
|
91
|
+
/**
|
92
|
+
* Localization data.
|
93
|
+
*/
|
94
|
+
localizedData: ILocalizedData;
|
95
|
+
/**
|
96
|
+
* This option is used to specify `.resx`, `.resx.json`, and `.loc.json` files that should not be processed by
|
97
|
+
* this plugin.
|
98
|
+
*/
|
99
|
+
globsToIgnore?: string[];
|
100
|
+
/**
|
101
|
+
* The value to replace the [locale] token with for chunks without localized strings. Defaults to "none"
|
102
|
+
*/
|
103
|
+
noStringsLocaleName?: string;
|
104
|
+
/**
|
105
|
+
* A chunk of javascript to use to get the current locale at runtime. If specified, allows the runtime chunk
|
106
|
+
* to be non-localized even if it has async localized chunks, as long as it does not directly contain strings.
|
107
|
+
*/
|
108
|
+
runtimeLocaleExpression?: string;
|
109
|
+
/**
|
110
|
+
* Options for how localization stats data should be produced.
|
111
|
+
*/
|
112
|
+
localizationStats?: ILocalizationStatsOptions;
|
113
|
+
}
|
114
|
+
/**
|
115
|
+
* @public
|
116
|
+
*/
|
117
|
+
export interface ILocaleFileObject {
|
118
|
+
[stringName: string]: string;
|
119
|
+
}
|
120
|
+
/**
|
121
|
+
* @public
|
122
|
+
* Accepted formats:
|
123
|
+
* - A string containing the path to the translations in .resjson format (keys mapped directly to values)
|
124
|
+
* - An object mapping keys directly to values
|
125
|
+
* - A map mapping keys directly to values
|
126
|
+
*/
|
127
|
+
export declare type ILocaleFileData = string | ILocaleFileObject | ReadonlyMap<string, string>;
|
128
|
+
/**
|
129
|
+
* @public
|
130
|
+
*/
|
131
|
+
export declare type IResolvedMissingTranslations = ReadonlyMap<string, ILocaleFileData>;
|
132
|
+
/**
|
133
|
+
* @public
|
134
|
+
*/
|
135
|
+
export interface ILocaleData {
|
136
|
+
[locFilePath: string]: ILocaleFileData;
|
137
|
+
}
|
138
|
+
/**
|
139
|
+
* @public
|
140
|
+
*/
|
141
|
+
export interface ILocalizedStrings {
|
142
|
+
[locale: string]: ILocaleData;
|
143
|
+
}
|
144
|
+
/**
|
145
|
+
* @public
|
146
|
+
*/
|
147
|
+
export interface ILocaleElementMap {
|
148
|
+
[locale: string]: string;
|
149
|
+
}
|
150
|
+
/**
|
151
|
+
* @public
|
152
|
+
*/
|
153
|
+
export interface ILocalizationStatsEntrypoint {
|
154
|
+
localizedAssets: ILocaleElementMap;
|
155
|
+
}
|
156
|
+
/**
|
157
|
+
* @public
|
158
|
+
*/
|
159
|
+
export interface ILocalizationStatsChunkGroup {
|
160
|
+
localizedAssets: ILocaleElementMap;
|
161
|
+
}
|
162
|
+
/**
|
163
|
+
* @public
|
164
|
+
*/
|
165
|
+
export interface ILocalizationStats {
|
166
|
+
entrypoints: {
|
167
|
+
[name: string]: ILocalizationStatsEntrypoint;
|
168
|
+
};
|
169
|
+
namedChunkGroups: {
|
170
|
+
[name: string]: ILocalizationStatsChunkGroup;
|
171
|
+
};
|
172
|
+
}
|
173
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAG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MAAM,EAAE,CAAC;IAEzB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAEjC;;OAEG;IACH,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,oBAAY,eAAe,GAAG,MAAM,GAAG,iBAAiB,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEvF;;GAEG;AACH,oBAAY,4BAA4B,GAAG,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,eAAe,EAAE,iBAAiB,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,eAAe,EAAE,iBAAiB,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,4BAA4B,CAAA;KAAE,CAAC;IAC9D,gBAAgB,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,4BAA4B,CAAA;KAAE,CAAC;CACpE"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
3
|
+
// See LICENSE in the project root for license information.
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
//# sourceMappingURL=interfaces.js.map
|
@@ -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 { LoaderContext } from 'webpack';\nimport type { 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 * @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?: (\n locales: string[],\n localizedFileKey: string,\n loaderContext: LoaderContext<{}>\n ) => Promise<IResolvedMissingTranslations> | 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/**\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 * A chunk of javascript to use to get the current locale at runtime. If specified, allows the runtime chunk\n * to be non-localized even if it has async localized chunks, as long as it does not directly contain strings.\n */\n runtimeLocaleExpression?: string;\n\n /**\n * Options for how localization stats data should be produced.\n */\n localizationStats?: ILocalizationStatsOptions;\n}\n\n/**\n * @public\n */\nexport interface ILocaleFileObject {\n [stringName: string]: string;\n}\n\n/**\n * @public\n * Accepted formats:\n * - A string containing the path to the translations in .resjson format (keys mapped directly to values)\n * - An object mapping keys directly to values\n * - A map mapping keys directly to values\n */\nexport type ILocaleFileData = string | ILocaleFileObject | ReadonlyMap<string, string>;\n\n/**\n * @public\n */\nexport type IResolvedMissingTranslations = ReadonlyMap<string, ILocaleFileData>;\n\n/**\n * @public\n */\nexport interface ILocaleData {\n [locFilePath: 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,12 @@
|
|
1
|
+
import type { IParseResxOptionsBase } from '@rushstack/localization-utilities';
|
2
|
+
import type { IBaseLocLoaderOptions } from './LoaderFactory';
|
3
|
+
/**
|
4
|
+
* @public
|
5
|
+
*/
|
6
|
+
export declare type IResxLoaderOptions = Omit<IParseResxOptionsBase, 'terminal'>;
|
7
|
+
/**
|
8
|
+
* @public
|
9
|
+
*/
|
10
|
+
export interface IResxLocLoaderOptions extends IResxLoaderOptions, IBaseLocLoaderOptions {
|
11
|
+
}
|
12
|
+
//# sourceMappingURL=IResxLoaderOptions.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"IResxLoaderOptions.d.ts","sourceRoot":"","sources":["../../src/loaders/IResxLoaderOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D;;GAEG;AACH,oBAAY,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB,EAAE,qBAAqB;CAAG"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
3
|
+
// See LICENSE in the project root for license information.
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
//# sourceMappingURL=IResxLoaderOptions.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"IResxLoaderOptions.js","sourceRoot":"","sources":["../../src/loaders/IResxLoaderOptions.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 { IParseResxOptionsBase } from '@rushstack/localization-utilities';\nimport type { IBaseLocLoaderOptions } from './LoaderFactory';\n\n/**\n * @public\n */\nexport type IResxLoaderOptions = Omit<IParseResxOptionsBase, 'terminal'>;\n\n/**\n * @public\n */\nexport interface IResxLocLoaderOptions extends IResxLoaderOptions, IBaseLocLoaderOptions {}\n"]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import type { LoaderContext, LoaderDefinitionFunction } from 'webpack';
|
2
|
+
import type { ILocalizationFile } from '@rushstack/localization-utilities';
|
3
|
+
export interface IBaseLocLoaderOptions {
|
4
|
+
}
|
5
|
+
export declare function createLoader<T extends IBaseLocLoaderOptions>(parseFile: (content: string, filePath: string, context: LoaderContext<T>) => ILocalizationFile): LoaderDefinitionFunction<T>;
|
6
|
+
//# sourceMappingURL=LoaderFactory.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"LoaderFactory.d.ts","sourceRoot":"","sources":["../../src/loaders/LoaderFactory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAI3E,MAAM,WAAW,qBAAqB;CAErC;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,qBAAqB,EAC1D,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,iBAAiB,GAC7F,wBAAwB,CAAC,CAAC,CAAC,CAgC7B"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
3
|
+
// See LICENSE in the project root for license information.
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
exports.createLoader = void 0;
|
6
|
+
const LocalizationPlugin_1 = require("../LocalizationPlugin");
|
7
|
+
function createLoader(parseFile) {
|
8
|
+
const loader = async function (content) {
|
9
|
+
const locFilePath = this.resourcePath;
|
10
|
+
const pluginInstance = (0, LocalizationPlugin_1.getPluginInstance)(this._compiler);
|
11
|
+
const locFileData = parseFile(content, locFilePath, this);
|
12
|
+
const strings = await pluginInstance.addDefaultLocFileAsync(this, locFilePath, locFileData);
|
13
|
+
const { type } = this._module;
|
14
|
+
switch (type) {
|
15
|
+
case 'json':
|
16
|
+
return JSON.stringify(strings);
|
17
|
+
case 'javascript/auto':
|
18
|
+
case 'javascript/esm':
|
19
|
+
return `const strings = ${JSON.stringify(strings)};\nexport default strings;`;
|
20
|
+
default:
|
21
|
+
this.emitError(new Error(`Unexpected localized module type ${type} for module ${this.resourcePath}`));
|
22
|
+
return '';
|
23
|
+
}
|
24
|
+
};
|
25
|
+
return loader;
|
26
|
+
}
|
27
|
+
exports.createLoader = createLoader;
|
28
|
+
//# 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;;;AAM3D,8DAA8E;AAM9E,SAAgB,YAAY,CAC1B,SAA8F;IAE9F,MAAM,MAAM,GAAgC,KAAK,WAE/C,OAAe;QAEf,MAAM,WAAW,GAAW,IAAI,CAAC,YAAY,CAAC;QAE9C,MAAM,cAAc,GAAuB,IAAA,sCAAiB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE7E,MAAM,WAAW,GAAsB,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;QAE7E,MAAM,OAAO,GAA2B,MAAM,cAAc,CAAC,sBAAsB,CACjF,IAAI,EACJ,WAAW,EACX,WAAW,CACZ,CAAC;QAEF,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,OAAQ,CAAC;QAE/B,QAAQ,IAAI,EAAE;YACZ,KAAK,MAAM;gBACT,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YACjC,KAAK,iBAAiB,CAAC;YACvB,KAAK,gBAAgB;gBACnB,OAAO,mBAAmB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,4BAA4B,CAAC;YAChF;gBACE,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,oCAAoC,IAAI,eAAe,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;gBACtG,OAAO,EAAE,CAAC;SACb;IACH,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAlCD,oCAkCC","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 { LoaderContext, LoaderDefinitionFunction } from 'webpack';\n\nimport type { ILocalizationFile } from '@rushstack/localization-utilities';\n\nimport { getPluginInstance, LocalizationPlugin } from '../LocalizationPlugin';\n\nexport interface IBaseLocLoaderOptions {\n // Nothing\n}\n\nexport function createLoader<T extends IBaseLocLoaderOptions>(\n parseFile: (content: string, filePath: string, context: LoaderContext<T>) => ILocalizationFile\n): LoaderDefinitionFunction<T> {\n const loader: LoaderDefinitionFunction<T> = async function (\n this: LoaderContext<T>,\n content: string\n ): Promise<string> {\n const locFilePath: string = this.resourcePath;\n\n const pluginInstance: LocalizationPlugin = getPluginInstance(this._compiler);\n\n const locFileData: ILocalizationFile = parseFile(content, locFilePath, this);\n\n const strings: Record<string, string> = await pluginInstance.addDefaultLocFileAsync(\n this,\n locFilePath,\n locFileData\n );\n\n const { type } = this._module!;\n\n switch (type) {\n case 'json':\n return JSON.stringify(strings);\n case 'javascript/auto':\n case 'javascript/esm':\n return `const strings = ${JSON.stringify(strings)};\\nexport default strings;`;\n default:\n this.emitError(new Error(`Unexpected localized module type ${type} for module ${this.resourcePath}`));\n return '';\n }\n };\n\n return loader;\n}\n"]}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { LoaderDefinitionFunction } from 'webpack';
|
2
|
+
import type { IResxLoaderOptions } from './IResxLoaderOptions';
|
3
|
+
/**
|
4
|
+
* This loader passes through the raw untranslated strings and may be used without a LocalizationPlugin instance.
|
5
|
+
*/
|
6
|
+
declare const loader: LoaderDefinitionFunction<IResxLoaderOptions>;
|
7
|
+
export default loader;
|
8
|
+
//# sourceMappingURL=default-locale-loader.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"default-locale-loader.d.ts","sourceRoot":"","sources":["../../src/loaders/default-locale-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAIvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG/D;;GAEG;AACH,QAAA,MAAM,MAAM,EAAE,wBAAwB,CAAC,kBAAkB,CAmBxD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
3
|
+
// See LICENSE in the project root for license information.
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
const node_core_library_1 = require("@rushstack/node-core-library");
|
6
|
+
const localization_utilities_1 = require("@rushstack/localization-utilities");
|
7
|
+
const LoaderTerminalProvider_1 = require("../utilities/LoaderTerminalProvider");
|
8
|
+
/**
|
9
|
+
* This loader passes through the raw untranslated strings and may be used without a LocalizationPlugin instance.
|
10
|
+
*/
|
11
|
+
const loader = function (content) {
|
12
|
+
const options = this.getOptions();
|
13
|
+
const locFileData = (0, localization_utilities_1.parseLocFile)({
|
14
|
+
...options,
|
15
|
+
content,
|
16
|
+
filePath: this.resourcePath,
|
17
|
+
terminal: new node_core_library_1.Terminal(LoaderTerminalProvider_1.LoaderTerminalProvider.getTerminalProviderForLoader(this))
|
18
|
+
});
|
19
|
+
const resultObject = {};
|
20
|
+
for (const [stringName, stringValue] of Object.entries(locFileData)) {
|
21
|
+
resultObject[stringName] = stringValue.value;
|
22
|
+
}
|
23
|
+
return JSON.stringify(resultObject);
|
24
|
+
};
|
25
|
+
exports.default = loader;
|
26
|
+
//# sourceMappingURL=default-locale-loader.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"default-locale-loader.js","sourceRoot":"","sources":["../../src/loaders/default-locale-loader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAG3D,oEAAwD;AACxD,8EAAoF;AAGpF,gFAA6E;AAE7E;;GAEG;AACH,MAAM,MAAM,GAAiD,UAE3D,OAAe;IAEf,MAAM,OAAO,GAAuB,IAAI,CAAC,UAAU,EAAE,CAAC;IAEtD,MAAM,WAAW,GAAsB,IAAA,qCAAY,EAAC;QAClD,GAAG,OAAO;QACV,OAAO;QACP,QAAQ,EAAE,IAAI,CAAC,YAAY;QAC3B,QAAQ,EAAE,IAAI,4BAAQ,CAAC,+CAAsB,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC;KAClF,CAAC,CAAC;IAEH,MAAM,YAAY,GAAqC,EAAE,CAAC;IAC1D,KAAK,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QACnE,YAAY,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC;KAC9C;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,kBAAe,MAAM,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 { LoaderContext, LoaderDefinitionFunction } from 'webpack';\nimport { Terminal } from '@rushstack/node-core-library';\nimport { ILocalizationFile, parseLocFile } from '@rushstack/localization-utilities';\n\nimport type { IResxLoaderOptions } from './IResxLoaderOptions';\nimport { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';\n\n/**\n * This loader passes through the raw untranslated strings and may be used without a LocalizationPlugin instance.\n */\nconst loader: LoaderDefinitionFunction<IResxLoaderOptions> = function (\n this: LoaderContext<IResxLoaderOptions>,\n content: string\n): string {\n const options: IResxLoaderOptions = this.getOptions();\n\n const locFileData: ILocalizationFile = parseLocFile({\n ...options,\n content,\n filePath: this.resourcePath,\n terminal: new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(this))\n });\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 JSON.stringify(resultObject);\n};\n\nexport default loader;\n"]}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { LoaderDefinitionFunction } from 'webpack';
|
2
|
+
import { NewlineKind } from '@rushstack/node-core-library';
|
3
|
+
import type { LocalizationPlugin } from '../LocalizationPlugin';
|
4
|
+
import { IBaseLocLoaderOptions } from './LoaderFactory';
|
5
|
+
export interface ILocLoaderOptions extends IBaseLocLoaderOptions {
|
6
|
+
pluginInstance: LocalizationPlugin;
|
7
|
+
resxNewlineNormalization: NewlineKind | undefined;
|
8
|
+
ignoreMissingResxComments: boolean | undefined;
|
9
|
+
}
|
10
|
+
/**
|
11
|
+
* General purpose loader that dispatches based on file extension.
|
12
|
+
*/
|
13
|
+
declare const loader: LoaderDefinitionFunction<ILocLoaderOptions>;
|
14
|
+
export default loader;
|
15
|
+
//# sourceMappingURL=loc-loader.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"loc-loader.d.ts","sourceRoot":"","sources":["../../src/loaders/loc-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEvE,OAAO,EAAY,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAgB,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGtE,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D,cAAc,EAAE,kBAAkB,CAAC;IACnC,wBAAwB,EAAE,WAAW,GAAG,SAAS,CAAC;IAClD,yBAAyB,EAAE,OAAO,GAAG,SAAS,CAAC;CAChD;AAED;;GAEG;AACH,QAAA,MAAM,MAAM,EAAE,wBAAwB,CAAC,iBAAiB,CAYvD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
3
|
+
// See LICENSE in the project root for license information.
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
const node_core_library_1 = require("@rushstack/node-core-library");
|
6
|
+
const localization_utilities_1 = require("@rushstack/localization-utilities");
|
7
|
+
const LoaderFactory_1 = require("./LoaderFactory");
|
8
|
+
const LoaderTerminalProvider_1 = require("../utilities/LoaderTerminalProvider");
|
9
|
+
/**
|
10
|
+
* General purpose loader that dispatches based on file extension.
|
11
|
+
*/
|
12
|
+
const loader = (0, LoaderFactory_1.createLoader)((content, filePath, context) => {
|
13
|
+
const options = context.getOptions();
|
14
|
+
const terminal = new node_core_library_1.Terminal(LoaderTerminalProvider_1.LoaderTerminalProvider.getTerminalProviderForLoader(context));
|
15
|
+
return (0, localization_utilities_1.parseLocFile)({
|
16
|
+
...options,
|
17
|
+
terminal,
|
18
|
+
content,
|
19
|
+
filePath
|
20
|
+
});
|
21
|
+
});
|
22
|
+
exports.default = loader;
|
23
|
+
//# sourceMappingURL=loc-loader.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"loc-loader.js","sourceRoot":"","sources":["../../src/loaders/loc-loader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAI3D,oEAAqE;AACrE,8EAAiE;AAGjE,mDAAsE;AACtE,gFAA6E;AAQ7E;;GAEG;AACH,MAAM,MAAM,GAAgD,IAAA,4BAAY,EACtE,CAAC,OAAe,EAAE,QAAgB,EAAE,OAAyC,EAAE,EAAE;IAC/E,MAAM,OAAO,GAAsB,OAAO,CAAC,UAAU,EAAE,CAAC;IACxD,MAAM,QAAQ,GAAa,IAAI,4BAAQ,CAAC,+CAAsB,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC,CAAC;IAEtG,OAAO,IAAA,qCAAY,EAAC;QAClB,GAAG,OAAO;QACV,QAAQ;QACR,OAAO;QACP,QAAQ;KACT,CAAC,CAAC;AACL,CAAC,CACF,CAAC;AAEF,kBAAe,MAAM,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 { LoaderContext, LoaderDefinitionFunction } from 'webpack';\n\nimport { Terminal, NewlineKind } from '@rushstack/node-core-library';\nimport { parseLocFile } from '@rushstack/localization-utilities';\n\nimport type { LocalizationPlugin } from '../LocalizationPlugin';\nimport { createLoader, IBaseLocLoaderOptions } from './LoaderFactory';\nimport { LoaderTerminalProvider } from '../utilities/LoaderTerminalProvider';\n\nexport interface ILocLoaderOptions extends IBaseLocLoaderOptions {\n pluginInstance: LocalizationPlugin;\n resxNewlineNormalization: NewlineKind | undefined;\n ignoreMissingResxComments: boolean | undefined;\n}\n\n/**\n * General purpose loader that dispatches based on file extension.\n */\nconst loader: LoaderDefinitionFunction<ILocLoaderOptions> = createLoader(\n (content: string, filePath: string, context: LoaderContext<ILocLoaderOptions>) => {\n const options: ILocLoaderOptions = context.getOptions();\n const terminal: Terminal = new Terminal(LoaderTerminalProvider.getTerminalProviderForLoader(context));\n\n return parseLocFile({\n ...options,\n terminal,\n content,\n filePath\n });\n }\n);\n\nexport default loader;\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"locjson-loader.d.ts","sourceRoot":"","sources":["../../src/loaders/locjson-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAGvE,OAAO,EAAgB,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAEtE,QAAA,MAAM,MAAM,EAAE,wBAAwB,CAAC,qBAAqB,CAO3D,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
3
|
+
// See LICENSE in the project root for license information.
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
const localization_utilities_1 = require("@rushstack/localization-utilities");
|
6
|
+
const LoaderFactory_1 = require("./LoaderFactory");
|
7
|
+
const loader = (0, LoaderFactory_1.createLoader)((content, filePath, context) => {
|
8
|
+
return (0, localization_utilities_1.parseLocJson)({
|
9
|
+
content,
|
10
|
+
filePath
|
11
|
+
});
|
12
|
+
});
|
13
|
+
exports.default = loader;
|
14
|
+
//# sourceMappingURL=locjson-loader.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"locjson-loader.js","sourceRoot":"","sources":["../../src/loaders/locjson-loader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAG3D,8EAAiE;AAEjE,mDAAsE;AAEtE,MAAM,MAAM,GAAoD,IAAA,4BAAY,EAC1E,CAAC,OAAe,EAAE,QAAgB,EAAE,OAA6C,EAAE,EAAE;IACnF,OAAO,IAAA,qCAAY,EAAC;QAClB,OAAO;QACP,QAAQ;KACT,CAAC,CAAC;AACL,CAAC,CACF,CAAC;AAEF,kBAAe,MAAM,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 { LoaderContext, LoaderDefinitionFunction } from 'webpack';\nimport { parseLocJson } from '@rushstack/localization-utilities';\n\nimport { createLoader, IBaseLocLoaderOptions } from './LoaderFactory';\n\nconst loader: LoaderDefinitionFunction<IBaseLocLoaderOptions> = createLoader(\n (content: string, filePath: string, context: LoaderContext<IBaseLocLoaderOptions>) => {\n return parseLocJson({\n content,\n filePath\n });\n }\n);\n\nexport default loader;\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resjson-loader.d.ts","sourceRoot":"","sources":["../../src/loaders/resjson-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAGvE,OAAO,EAAgB,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAEtE,QAAA,MAAM,MAAM,EAAE,wBAAwB,CAAC,qBAAqB,CAO3D,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
3
|
+
// See LICENSE in the project root for license information.
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
const localization_utilities_1 = require("@rushstack/localization-utilities");
|
6
|
+
const LoaderFactory_1 = require("./LoaderFactory");
|
7
|
+
const loader = (0, LoaderFactory_1.createLoader)((content, filePath, context) => {
|
8
|
+
return (0, localization_utilities_1.parseResJson)({
|
9
|
+
content,
|
10
|
+
filePath
|
11
|
+
});
|
12
|
+
});
|
13
|
+
exports.default = loader;
|
14
|
+
//# sourceMappingURL=resjson-loader.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resjson-loader.js","sourceRoot":"","sources":["../../src/loaders/resjson-loader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAG3D,8EAAiE;AAEjE,mDAAsE;AAEtE,MAAM,MAAM,GAAoD,IAAA,4BAAY,EAC1E,CAAC,OAAe,EAAE,QAAgB,EAAE,OAA6C,EAAE,EAAE;IACnF,OAAO,IAAA,qCAAY,EAAC;QAClB,OAAO;QACP,QAAQ;KACT,CAAC,CAAC;AACL,CAAC,CACF,CAAC;AAEF,kBAAe,MAAM,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 { LoaderContext, LoaderDefinitionFunction } from 'webpack';\nimport { parseResJson } from '@rushstack/localization-utilities';\n\nimport { createLoader, IBaseLocLoaderOptions } from './LoaderFactory';\n\nconst loader: LoaderDefinitionFunction<IBaseLocLoaderOptions> = createLoader(\n (content: string, filePath: string, context: LoaderContext<IBaseLocLoaderOptions>) => {\n return parseResJson({\n content,\n filePath\n });\n }\n);\n\nexport default loader;\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resx-loader.d.ts","sourceRoot":"","sources":["../../src/loaders/resx-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAGvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAKlE,QAAA,MAAM,MAAM,EAAE,wBAAwB,CAAC,qBAAqB,CAa3D,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
3
|
+
// See LICENSE in the project root for license information.
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
const node_core_library_1 = require("@rushstack/node-core-library");
|
6
|
+
const localization_utilities_1 = require("@rushstack/localization-utilities");
|
7
|
+
const LoaderFactory_1 = require("./LoaderFactory");
|
8
|
+
const LoaderTerminalProvider_1 = require("../utilities/LoaderTerminalProvider");
|
9
|
+
const loader = (0, LoaderFactory_1.createLoader)((content, filePath, context) => {
|
10
|
+
const options = context.getOptions();
|
11
|
+
const terminal = new node_core_library_1.Terminal(LoaderTerminalProvider_1.LoaderTerminalProvider.getTerminalProviderForLoader(context));
|
12
|
+
return (0, localization_utilities_1.parseResx)({
|
13
|
+
content,
|
14
|
+
filePath,
|
15
|
+
terminal,
|
16
|
+
resxNewlineNormalization: options.resxNewlineNormalization,
|
17
|
+
ignoreMissingResxComments: !options.ignoreMissingResxComments
|
18
|
+
});
|
19
|
+
});
|
20
|
+
exports.default = loader;
|
21
|
+
//# sourceMappingURL=resx-loader.js.map
|