@astrojs/compiler 0.12.0-next.7 → 0.12.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,43 @@
1
1
  # @astrojs/compiler
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c6dd41d: Do not render implicit tags created during the parsing process
8
+ - c6dd41d: Remove "as" option, treats all documents as fragments that generate no implicit tags
9
+ - c6dd41d: Add `parse` function which generates an AST
10
+ - c6dd41d: Adds support for `Astro.self` (as accepted in the [Recursive Components RFC](https://github.com/withastro/rfcs/blob/main/active-rfcs/0000-recursive-components.md)).
11
+
12
+ ### Patch Changes
13
+
14
+ - c6dd41d: Add `fragment` node types to AST definitions, expose Fragment helper to utils
15
+ - c6dd41d: Adds metadata on client:only components
16
+ - c6dd41d: Expose AST types via `@astrojs/compiler/types`
17
+ - c6dd41d: Export `./types` rather than `./types.d.ts`
18
+ - c6dd41d: Fix edge case with Fragment parsing in head, add `fragment` node to AST output
19
+ - c6dd41d: Fix <slot> behavior inside of head
20
+ - c6dd41d: Improve head injection behavior
21
+ - ef0b4b3: Move `typescript` dependency to development dependencies, as it is not needed in the package runtime.
22
+ - c6dd41d: Update exposed types
23
+ - c6dd41d: Remove usage of `escapeHTML` util
24
+ - c6dd41d: Export all types from shared types
25
+ - c6dd41d: Fix `head` behavior and a bug related to ParseFragment
26
+ - c6dd41d: Adds a warning when using an expression with a hoisted script
27
+
28
+ ## 0.12.0-next.9
29
+
30
+ ### Patch Changes
31
+
32
+ - 95ec808: Fix <slot> behavior inside of head
33
+ - 95ec808: Remove usage of `escapeHTML` util
34
+
35
+ ## 0.12.0-next.8
36
+
37
+ ### Patch Changes
38
+
39
+ - 4497628: Improve head injection behavior
40
+
3
41
  ## 0.12.0-next.7
4
42
 
5
43
  ### Patch Changes
package/astro.wasm CHANGED
Binary file
@@ -1,4 +1,4 @@
1
- import { Node, ParentNode, RootNode, ElementNode, CustomElementNode, ComponentNode, LiteralNode, ExpressionNode, TextNode, CommentNode, DoctypeNode, FrontmatterNode } from '../shared/ast';
1
+ import { Node, ParentNode, RootNode, ElementNode, CustomElementNode, ComponentNode, FragmentNode, LiteralNode, ExpressionNode, TextNode, CommentNode, DoctypeNode, FrontmatterNode } from '../shared/ast';
2
2
  export interface Visitor {
3
3
  (node: Node, parent?: ParentNode, index?: number): void | Promise<void>;
4
4
  }
@@ -11,6 +11,7 @@ export declare const is: {
11
11
  element: (node: Node) => node is ElementNode;
12
12
  customElement: (node: Node) => node is CustomElementNode;
13
13
  component: (node: Node) => node is ComponentNode;
14
+ fragment: (node: Node) => node is FragmentNode;
14
15
  expression: (node: Node) => node is ExpressionNode;
15
16
  text: (node: Node) => node is TextNode;
16
17
  doctype: (node: Node) => node is DoctypeNode;
package/browser/utils.js CHANGED
@@ -9,7 +9,7 @@ export const is = {
9
9
  return typeof node.value === 'string';
10
10
  },
11
11
  tag(node) {
12
- return node.type === 'element' || node.type === 'custom-element' || node.type === 'component';
12
+ return node.type === 'element' || node.type === 'custom-element' || node.type === 'component' || node.type === 'fragment';
13
13
  },
14
14
  whitespace(node) {
15
15
  return node.type === 'text' && node.value.trim().length === 0;
@@ -18,6 +18,7 @@ export const is = {
18
18
  element: guard('element'),
19
19
  customElement: guard('custom-element'),
20
20
  component: guard('component'),
21
+ fragment: guard('fragment'),
21
22
  expression: guard('expression'),
22
23
  text: guard('text'),
23
24
  doctype: guard('doctype'),
package/node/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Node, ParentNode, RootNode, ElementNode, CustomElementNode, ComponentNode, LiteralNode, ExpressionNode, TextNode, CommentNode, DoctypeNode, FrontmatterNode } from '../shared/ast';
1
+ import { Node, ParentNode, RootNode, ElementNode, CustomElementNode, ComponentNode, FragmentNode, LiteralNode, ExpressionNode, TextNode, CommentNode, DoctypeNode, FrontmatterNode } from '../shared/ast';
2
2
  export interface Visitor {
3
3
  (node: Node, parent?: ParentNode, index?: number): void | Promise<void>;
4
4
  }
@@ -11,6 +11,7 @@ export declare const is: {
11
11
  element: (node: Node) => node is ElementNode;
12
12
  customElement: (node: Node) => node is CustomElementNode;
13
13
  component: (node: Node) => node is ComponentNode;
14
+ fragment: (node: Node) => node is FragmentNode;
14
15
  expression: (node: Node) => node is ExpressionNode;
15
16
  text: (node: Node) => node is TextNode;
16
17
  doctype: (node: Node) => node is DoctypeNode;
package/node/utils.js CHANGED
@@ -9,7 +9,7 @@ export const is = {
9
9
  return typeof node.value === 'string';
10
10
  },
11
11
  tag(node) {
12
- return node.type === 'element' || node.type === 'custom-element' || node.type === 'component';
12
+ return node.type === 'element' || node.type === 'custom-element' || node.type === 'component' || node.type === 'fragment';
13
13
  },
14
14
  whitespace(node) {
15
15
  return node.type === 'text' && node.value.trim().length === 0;
@@ -18,6 +18,7 @@ export const is = {
18
18
  element: guard('element'),
19
19
  customElement: guard('custom-element'),
20
20
  component: guard('component'),
21
+ fragment: guard('fragment'),
21
22
  expression: guard('expression'),
22
23
  text: guard('text'),
23
24
  doctype: guard('doctype'),
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "module",
6
6
  "bugs": "https://github.com/withastro/compiler/issues",
7
7
  "homepage": "https://astro.build",
8
- "version": "0.12.0-next.7",
8
+ "version": "0.12.0",
9
9
  "scripts": {
10
10
  "build": "tsc -p ."
11
11
  },
@@ -30,10 +30,13 @@
30
30
  "./types": "./types.d.ts"
31
31
  },
32
32
  "dependencies": {
33
- "typescript": "^4.3.5"
33
+ "tsm": "^2.2.1",
34
+ "uvu": "^0.5.3"
34
35
  },
35
36
  "devDependencies": {
36
- "@types/node": "^16.4.12"
37
+ "@types/node": "^16.4.12",
38
+ "@types/sass": "^1.43.1",
39
+ "typescript": "^4.4.3"
37
40
  },
38
41
  "volta": {
39
42
  "node": "16.6.2"
package/shared/ast.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export declare type ParentNode = RootNode | ElementNode | ComponentNode | CustomElementNode | ExpressionNode;
2
- export declare type Node = RootNode | ElementNode | ComponentNode | CustomElementNode | ExpressionNode | TextNode | FrontmatterNode | DoctypeNode | CommentNode;
1
+ export declare type ParentNode = RootNode | ElementNode | ComponentNode | CustomElementNode | FragmentNode | ExpressionNode;
2
+ export declare type Node = RootNode | ElementNode | ComponentNode | CustomElementNode | FragmentNode | ExpressionNode | TextNode | FrontmatterNode | DoctypeNode | CommentNode;
3
3
  export interface Position {
4
4
  start: Point;
5
5
  end?: Point;
@@ -17,7 +17,7 @@ export interface BaseNode {
17
17
  position?: Position;
18
18
  }
19
19
  export interface ParentLikeNode extends BaseNode {
20
- type: 'element' | 'component' | 'custom-element' | 'expression' | 'root';
20
+ type: 'element' | 'component' | 'custom-element' | 'fragment' | 'expression' | 'root';
21
21
  children: Node[];
22
22
  }
23
23
  export interface LiteralNode extends BaseNode {
@@ -45,6 +45,12 @@ export interface ElementNode extends ParentLikeNode {
45
45
  attributes: AttributeNode[];
46
46
  directives: DirectiveNode[];
47
47
  }
48
+ export interface FragmentNode extends ParentLikeNode {
49
+ type: 'fragment';
50
+ name: string;
51
+ attributes: AttributeNode[];
52
+ directives: DirectiveNode[];
53
+ }
48
54
  export interface ComponentNode extends ParentLikeNode {
49
55
  type: 'component';
50
56
  name: string;