@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @swc/plugin-formatjs
2
2
 
3
+ ## 3.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 1abaa28: fix(formatjs): Sort description objects before serialization
8
+
3
9
  ## 3.2.0
4
10
 
5
11
  ### Minor Changes
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swc/plugin-formatjs",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "FormatJS SWC plugin",
5
5
  "main": "swc_plugin_formatjs.wasm",
6
6
  "homepage": "https://swc.rs",
Binary file