@swc/plugin-formatjs 3.2.0 → 3.2.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.md +6 -0
- package/__tests__/wasm.test.ts +33 -0
- package/package.json +1 -1
- package/swc_plugin_formatjs.wasm +0 -0
package/CHANGELOG.md
CHANGED
package/__tests__/wasm.test.ts
CHANGED
|
@@ -225,6 +225,39 @@ describe("formatjs swc plugin", () => {
|
|
|
225
225
|
expect(output).toMatch(/id: "zL\/jyT\"/);
|
|
226
226
|
});
|
|
227
227
|
|
|
228
|
+
it("should generate same id even if order of keys is different in two description objects with same keys", async () => {
|
|
229
|
+
const input = `
|
|
230
|
+
import { FormattedMessage } from 'react-intl';
|
|
231
|
+
|
|
232
|
+
export function Greeting() {
|
|
233
|
+
return (
|
|
234
|
+
<FormattedMessage
|
|
235
|
+
defaultMessage="Hello!"
|
|
236
|
+
description={{ text: "Greeting message", image: "https://example.com/image.png" }}
|
|
237
|
+
/>
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
`;
|
|
241
|
+
|
|
242
|
+
const input2 = `
|
|
243
|
+
import { FormattedMessage } from 'react-intl';
|
|
244
|
+
|
|
245
|
+
export function Greeting() {
|
|
246
|
+
return (
|
|
247
|
+
<FormattedMessage
|
|
248
|
+
defaultMessage="Hello!"
|
|
249
|
+
description={{ image: "https://example.com/image.png", text: "Greeting message" }}
|
|
250
|
+
/>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
`;
|
|
254
|
+
|
|
255
|
+
const output = await transformCode(input);
|
|
256
|
+
const output2 = await transformCode(input2);
|
|
257
|
+
|
|
258
|
+
expect(output).toMatch(output2);
|
|
259
|
+
});
|
|
260
|
+
|
|
228
261
|
it("should be able to use different encodings in interpolation", async () => {
|
|
229
262
|
const input = `
|
|
230
263
|
import { FormattedMessage } from 'react-intl';
|
package/package.json
CHANGED
package/swc_plugin_formatjs.wasm
CHANGED
|
Binary file
|