@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/.swc/plugins/v7_linux_x86_64_8.0.0/{56a0f7fb061d61376d4869defce6d038d74ad1f9b0f2b61fdfe71a1a1497f2c1 → 80ac9638148796f6f7a9e2260253111b693c068ee3c254c1786630caca2e9df4} +0 -0
- package/CHANGELOG.md +6 -0
- package/README.md +6 -0
- package/__tests__/wasm.test.ts +26 -0
- package/package.json +4 -4
- package/swc_plugin_formatjs.wasm +0 -0
|
Binary file
|
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
package/__tests__/wasm.test.ts
CHANGED
|
@@ -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
|
|
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-
|
|
24
|
-
"build:debug": "cargo build -p swc_plugin_formatjs --target wasm32-
|
|
25
|
-
"test": "
|
|
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
|
}
|
package/swc_plugin_formatjs.wasm
CHANGED
|
Binary file
|