@swc/plugin-formatjs 3.0.1 → 3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @swc/plugin-formatjs
2
2
 
3
+ ## 3.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - af2e35d: Add support for sha1 hash_type in idInterpolationPattern
8
+
3
9
  ## 3.0.1
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -4,6 +4,12 @@ FormatJS SWC plugin, maintained by SWC team.
4
4
 
5
5
  # @swc/plugin-formatjs
6
6
 
7
+ ## 3.1.0
8
+
9
+ ### Minor Changes
10
+
11
+ - af2e35d: Add support for sha1 hash_type in idInterpolationPattern
12
+
7
13
  ## 3.0.1
8
14
 
9
15
  ### 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.0",
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"
26
26
  }
27
27
  }
Binary file