@astrojs/compiler 0.2.6 → 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 +19 -0
- package/astro.wasm +0 -0
- package/package.json +1 -1
- package/{test.js → test/basic.test.mjs} +4 -2
- package/test/output.test.mjs +29 -0
- package/test/test.mjs +2 -0
- package/test/visible.test.mjs +41 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
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
|
+
|
|
9
|
+
## 0.2.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 3ea8d8c: Fix for string interpolation within titles
|
|
14
|
+
- ef7cb1e: Fixes bug with textContent containing apostrophe character
|
|
15
|
+
|
|
16
|
+
## 0.2.8
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- b2d5564: Fixes wasm build
|
|
21
|
+
|
|
3
22
|
## 0.2.6
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/astro.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
|
|
3
|
+
import { transform } from '@astrojs/compiler';
|
|
4
|
+
|
|
3
5
|
const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
|
|
4
6
|
|
|
5
7
|
async function run() {
|
|
6
|
-
|
|
8
|
+
|
|
7
9
|
let i = 0;
|
|
8
10
|
const result = await transform(
|
|
9
11
|
`---
|
|
@@ -60,4 +62,4 @@ div {
|
|
|
60
62
|
// console.log(html);
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
run();
|
|
65
|
+
await run();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { transform } from '@astrojs/compiler';
|
|
3
|
+
|
|
4
|
+
const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
|
|
5
|
+
|
|
6
|
+
async function run() {
|
|
7
|
+
let i = 0;
|
|
8
|
+
const result = await transform(
|
|
9
|
+
`<div xmlns:happy="https://example.com/schemas/happy">
|
|
10
|
+
<img src="jolly.avif" happy:smile="sweet"/>
|
|
11
|
+
</div>
|
|
12
|
+
`,
|
|
13
|
+
{
|
|
14
|
+
site: undefined,
|
|
15
|
+
sourcefile: '/Users/matthew/dev/astro/packages/astro/test/fixtures/astro-attrs/src/pages/namespaced.astro',
|
|
16
|
+
sourcemap: 'both',
|
|
17
|
+
internalURL: 'astro/internal',
|
|
18
|
+
preprocessStyle: async (value, attrs) => {
|
|
19
|
+
return null;
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
if(result.code[0] === '\x00') {
|
|
25
|
+
throw new Error('Corrupt output');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
await run().catch(err => { console.error(err); process.exit(1); });
|
package/test/test.mjs
ADDED
|
@@ -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();
|