@swc/plugin-formatjs 3.0.1 → 3.1.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,17 @@
1
1
  # @swc/plugin-formatjs
2
2
 
3
+ ## 3.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - cb94b92: Update swc_core to v21.0.1
8
+
9
+ ## 3.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - af2e35d: Add support for sha1 hash_type in idInterpolationPattern
14
+
3
15
  ## 3.0.1
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -4,6 +4,18 @@ FormatJS SWC plugin, maintained by SWC team.
4
4
 
5
5
  # @swc/plugin-formatjs
6
6
 
7
+ ## 3.1.1
8
+
9
+ ### Patch Changes
10
+
11
+ - cb94b92: Update swc_core to v21.0.1
12
+
13
+ ## 3.1.0
14
+
15
+ ### Minor Changes
16
+
17
+ - af2e35d: Add support for sha1 hash_type in idInterpolationPattern
18
+
7
19
  ## 3.0.1
8
20
 
9
21
  ### Patch Changes
@@ -178,4 +178,30 @@ describe("formatjs swc plugin", () => {
178
178
  expect(output).toMatch(/defaultMessage: "Hello, \{name\}!"/);
179
179
  expect(output).not.toMatch(/description/);
180
180
  });
181
+
182
+ it("should be able to use sha1 and sha512 hashing in interpolation", async () => {
183
+ const input = `
184
+ import { FormattedMessage } from 'react-intl';
185
+
186
+ export function Greeting() {
187
+ return (
188
+ <FormattedMessage
189
+ defaultMessage="Hello!"
190
+ description="Greeting message"
191
+ />
192
+ );
193
+ }
194
+ `;
195
+
196
+ const sha1output = await transformCode(input, {
197
+ idInterpolationPattern: "[sha1:contenthash:base64:6]",
198
+ });
199
+ const sha512output = await transformCode(input, {
200
+ idInterpolationPattern: "[sha512:contenthash:base64:6]",
201
+ });
202
+
203
+ expect(sha1output).toMatch(/id: "[a-zA-Z0-9]{6}"/);
204
+ expect(sha512output).toMatch(/id: "[a-zA-Z0-9]{6}"/);
205
+ expect(sha1output).not.toMatch(sha512output);
206
+ });
181
207
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swc/plugin-formatjs",
3
- "version": "3.0.1",
3
+ "version": "3.1.1",
4
4
  "description": "FormatJS SWC plugin",
5
5
  "main": "swc_plugin_formatjs.wasm",
6
6
  "homepage": "https://swc.rs",
@@ -20,8 +20,8 @@
20
20
  "@swc/counter": "^0.1.3"
21
21
  },
22
22
  "scripts": {
23
- "build": "cargo build --release -p swc_plugin_formatjs --target wasm32-wasi && cp ../../target/wasm32-wasi/release/swc_plugin_formatjs.wasm .",
24
- "build:debug": "cargo build -p swc_plugin_formatjs --target wasm32-wasi && cp ../../target/wasm32-wasi/debug/swc_plugin_formatjs.wasm .",
25
- "test": "npm run build:debug && vitest run"
23
+ "build": "cargo build --release -p swc_plugin_formatjs --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/release/swc_plugin_formatjs.wasm .",
24
+ "build:debug": "cargo build -p swc_plugin_formatjs --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/debug/swc_plugin_formatjs.wasm .",
25
+ "test": "pnpm run build:debug && vitest run --testTimeout=0"
26
26
  }
27
27
  }
Binary file