@astrojs/compiler 0.2.13 → 0.2.16-rc.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,19 @@
1
1
  # @astrojs/compiler
2
2
 
3
+ ## 0.2.15
4
+
5
+ ### Patch Changes
6
+
7
+ - 8fbae5e: Bugfix: fix component detection bug in parser
8
+ - 37b5b6e: Bugfix: wait to release processStyle() until after fn call
9
+
10
+ ## 0.2.14
11
+
12
+ ### Patch Changes
13
+
14
+ - f59c886: Bugfix: allow for detection of void tags (e.g. <img>)
15
+ - 4c8d14a: Fixes textContent containing a forward slash
16
+
3
17
  ## 0.2.13
4
18
 
5
19
  ### 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.13",
4
+ "version": "0.2.16-rc.1",
5
5
  "scripts": {
6
6
  "build": "tsc -p ."
7
7
  },
package/deno/README.md DELETED
@@ -1,5 +0,0 @@
1
- # astro_compiler
2
-
3
- Experimental WASM compiler for Astro.
4
-
5
- This barely works, so probably don't use this package!
@@ -1,65 +0,0 @@
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
- let value = 'world';
13
- ---
14
-
15
- <style lang="scss" define:vars={{ a: 0 }}>
16
- div {
17
- color: red;
18
- }
19
- </style>
20
-
21
- <div>Hello world!</div>
22
-
23
- <div>Ahhh</div>
24
-
25
- <style lang="scss">
26
- div {
27
- color: green;
28
- }
29
- </style>
30
- `,
31
- {
32
- sourcemap: true,
33
- // HOLY CRAP THIS ACTUALLY WORKS!
34
- preprocessStyle: async (value, attrs) => {
35
- let x = i++;
36
- if (!attrs.lang) {
37
- return null;
38
- }
39
- // console.log(`Starting to preprocess style ${x} as ${attrs.lang}`);
40
- // await sleep(3000);
41
- // console.log(`Finished preprocessing ${x}`);
42
- return { code: value.replace('color', 'background') };
43
- },
44
- }
45
- );
46
- // console.log(result);
47
-
48
- // test
49
- if (!result.code.includes('background:red')) {
50
- throw new Error(`Styles didn’t transform as expected. Expected "background:red" to be present.`);
51
- }
52
-
53
- if (!result.code.includes('background:green')) {
54
- throw new Error(`Styles didn’t transform as expected. Expected "background:green" to be present.`);
55
- }
56
-
57
- // const start = performance.now()
58
- // const html = await compile(template);
59
- // const end = performance.now()
60
-
61
- // console.log('Compiled in ' + (start - end).toFixed(1) + 'ms');
62
- // console.log(html);
63
- }
64
-
65
- await run();
@@ -1,29 +0,0 @@
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 DELETED
@@ -1,2 +0,0 @@
1
- import './basic.test.mjs';
2
- import './output.test.mjs';
@@ -1,41 +0,0 @@
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();
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "ES2020",
5
- "moduleResolution": "node",
6
- "strict": true,
7
- "declaration": true,
8
- "noImplicitOverride": true,
9
- "noUnusedLocals": true,
10
- "esModuleInterop": true
11
- },
12
- "include": ["browser", "node", "shared"],
13
- "exclude": ["node_modules"]
14
- }