@formatjs/cli 6.16.7 → 6.16.8
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/bin/formatjs +6 -1
- package/bin/formatjs.map +1 -1
- package/package.json +1 -1
package/bin/formatjs
CHANGED
|
@@ -162922,6 +162922,11 @@ function interpolateName(loaderContext, name, options) {
|
|
|
162922
162922
|
if (typeof loaderContext.options === "object" && typeof loaderContext.options.customInterpolateName === "function") url = loaderContext.options.customInterpolateName.call(loaderContext, url, name, options);
|
|
162923
162923
|
return url;
|
|
162924
162924
|
}
|
|
162925
|
+
const TRIM_UNICODE_WHITE_SPACE_RE = /^\p{White_Space}+|\p{White_Space}+$/gu;
|
|
162926
|
+
const UNICODE_WHITE_SPACE_RE = /\p{White_Space}+/gu;
|
|
162927
|
+
function normalizeMessageWhitespace(message) {
|
|
162928
|
+
return message.replace(TRIM_UNICODE_WHITE_SPACE_RE, "").replace(UNICODE_WHITE_SPACE_RE, " ");
|
|
162929
|
+
}
|
|
162925
162930
|
const stringify$1 = import_json_stable_stringify.default || import_json_stable_stringify;
|
|
162926
162931
|
const MESSAGE_DESC_KEYS = [
|
|
162927
162932
|
"id",
|
|
@@ -163157,7 +163162,7 @@ function extractMessageDescriptor(ts, node, { overrideIdFn, extractSourceLocatio
|
|
|
163157
163162
|
});
|
|
163158
163163
|
if (extractionError) return;
|
|
163159
163164
|
if (!msg.defaultMessage && !msg.id) return;
|
|
163160
|
-
if (msg.defaultMessage && !preserveWhitespace) msg.defaultMessage = msg.defaultMessage
|
|
163165
|
+
if (msg.defaultMessage && !preserveWhitespace) msg.defaultMessage = normalizeMessageWhitespace(msg.defaultMessage);
|
|
163161
163166
|
if (flatten && msg.defaultMessage) try {
|
|
163162
163167
|
msg.defaultMessage = printAST(hoistSelectors(parse(msg.defaultMessage)));
|
|
163163
163168
|
} catch (e) {
|