@astrojs/compiler 0.2.9 → 0.2.10

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
  # @astrojs/compiler
2
2
 
3
+ ## 0.2.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 57eb728: Fixes hydrated scripts not recognized when using fragment transformation
8
+
3
9
  ## 0.2.9
4
10
 
5
11
  ### Patch Changes
package/astro.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astrojs/compiler",
3
3
  "type": "module",
4
- "version": "0.2.9",
4
+ "version": "0.2.10",
5
5
  "scripts": {
6
6
  "build": "tsc -p ."
7
7
  },
@@ -0,0 +1,41 @@
1
+ /* eslint-disable no-console */
2
+
3
+ import { transform } from '@astrojs/compiler';
4
+
5
+ const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
6
+
7
+ async function run() {
8
+
9
+ let i = 0;
10
+ const result = await transform(
11
+ `---
12
+ import ThemeToggleButton from './ThemeToggleButton.tsx';
13
+ ---
14
+ <style>
15
+ body {
16
+ background: blue;
17
+ }
18
+ </style>
19
+ <div>
20
+ <ThemeToggleButton client:visible />
21
+ </div>`,
22
+ {
23
+ sourcemap: true,
24
+ as: 'fragment',
25
+ site: undefined,
26
+ sourcefile: 'MoreMenu.astro',
27
+ sourcemap: 'both',
28
+ internalURL: 'astro/internal',
29
+ preprocessStyle: async (value, attrs) => {
30
+ return null;
31
+ },
32
+ }
33
+ );
34
+
35
+ // test
36
+ if(!result.code.includes(`{ modules: [{ module: $$module1, specifier: './ThemeToggleButton.tsx' }], hydratedComponents: [ThemeToggleButton], hoisted: [] }`)) {
37
+ throw new Error('Hydrated components not included');
38
+ }
39
+ }
40
+
41
+ await run();