@markuplint/astro-parser 4.4.0 → 4.5.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.
Files changed (2) hide show
  1. package/lib/parser.js +9 -11
  2. package/package.json +5 -5
package/lib/parser.js CHANGED
@@ -125,12 +125,17 @@ class AstroParser extends Parser {
125
125
  visitElement(token,
126
126
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
127
127
  childNodes) {
128
- const parsedNodes = this.parseCodeFragment(token);
128
+ const parsedNodes = this.parseCodeFragment(token, {
129
+ // https://docs.astro.build/en/basics/astro-syntax/#fragments
130
+ namelessFragment: true,
131
+ });
129
132
  const startTagNode = parsedNodes.at(0);
130
133
  if (!startTagNode || startTagNode.type !== 'starttag') {
131
134
  throw new ParserError('Not found start tag', startTagNode ?? token);
132
135
  }
133
136
  return super.visitElement(startTagNode, childNodes, {
137
+ // https://docs.astro.build/en/basics/astro-syntax/#fragments
138
+ namelessFragment: true,
134
139
  overwriteProps: {
135
140
  namespace: this.state.scopeNS,
136
141
  },
@@ -158,16 +163,9 @@ class AstroParser extends Parser {
158
163
  visitAttr(token) {
159
164
  const attr = super.visitAttr(token, {
160
165
  quoteSet: [
161
- { start: '"', end: '"' },
162
- { start: "'", end: "'" },
163
- { start: '{', end: '}' },
164
- ],
165
- quoteInValueChars: [
166
- { start: '"', end: '"' },
167
- { start: "'", end: "'" },
168
- { start: '`', end: '`' },
169
- { start: '{', end: '}' },
170
- { start: '${', end: '}' },
166
+ { start: '"', end: '"', type: 'string' },
167
+ { start: "'", end: "'", type: 'string' },
168
+ { start: '{', end: '}', type: 'script' },
171
169
  ],
172
170
  startState:
173
171
  // is shorthand attribute
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/astro-parser",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "description": "astro parser for markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@markuplint/ml-ast": "4.2.0",
25
- "@markuplint/parser-utils": "4.4.0",
26
- "astro-eslint-parser": "0.16.3"
25
+ "@markuplint/parser-utils": "4.5.0",
26
+ "astro-eslint-parser": "0.17.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@astrojs/compiler": "2.7.0"
29
+ "@astrojs/compiler": "2.7.1"
30
30
  },
31
- "gitHead": "ad3db077e96bea0666c9105b250f895263907a87"
31
+ "gitHead": "d5c8786b0dbbd82cdd89018dd57941d62bbe8d06"
32
32
  }