@markuplint/alpine-parser 4.6.22 → 4.6.23

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
@@ -3,13 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [4.6.22](https://github.com/markuplint/markuplint/compare/@markuplint/alpine-parser@4.6.21...@markuplint/alpine-parser@4.6.22) (2025-11-05)
6
+ ## [4.6.23](https://github.com/markuplint/markuplint/compare/@markuplint/alpine-parser@4.6.22...@markuplint/alpine-parser@4.6.23) (2026-02-10)
7
7
 
8
8
  **Note:** Version bump only for package @markuplint/alpine-parser
9
9
 
10
+ ## [4.6.22](https://github.com/markuplint/markuplint/compare/@markuplint/alpine-parser@4.6.21...@markuplint/alpine-parser@4.6.22) (2025-11-05)
10
11
 
11
-
12
-
12
+ **Note:** Version bump only for package @markuplint/alpine-parser
13
13
 
14
14
  ## [4.6.21](https://github.com/markuplint/markuplint/compare/@markuplint/alpine-parser@4.6.20...@markuplint/alpine-parser@4.6.21) (2025-08-24)
15
15
 
package/lib/index.d.ts CHANGED
@@ -1 +1,7 @@
1
+ /**
2
+ * @module @markuplint/alpine-parser
3
+ * Markuplint parser plugin for Alpine.js templates. Extends the standard HTML parser
4
+ * to recognize Alpine.js directives (e.g., x-data, x-bind, x-on) and treat them
5
+ * appropriately during linting.
6
+ */
1
7
  export { parser } from './parser.js';
package/lib/index.js CHANGED
@@ -1 +1,7 @@
1
+ /**
2
+ * @module @markuplint/alpine-parser
3
+ * Markuplint parser plugin for Alpine.js templates. Extends the standard HTML parser
4
+ * to recognize Alpine.js directives (e.g., x-data, x-bind, x-on) and treat them
5
+ * appropriately during linting.
6
+ */
1
7
  export { parser } from './parser.js';
package/lib/parser.d.ts CHANGED
@@ -1,11 +1,34 @@
1
1
  import type { Token } from '@markuplint/parser-utils';
2
2
  import { HtmlParser } from '@markuplint/html-parser';
3
+ /**
4
+ * Parser for Alpine.js templates that extends the standard HTML parser.
5
+ *
6
+ * Recognizes Alpine.js directives such as `x-data`, `x-bind`, `x-on`, and
7
+ * `x-transition`, and classifies them as either directives (opaque to linting)
8
+ * or attribute bindings (with potential standard attribute names for validation).
9
+ */
3
10
  declare class AlpineParser extends HtmlParser {
11
+ /**
12
+ * Visits an attribute token and applies Alpine.js-specific classification.
13
+ *
14
+ * Determines whether the attribute is an Alpine.js directive, a dynamic
15
+ * binding (e.g., `:class`, `x-bind:href`), or an event listener shorthand
16
+ * (e.g., `@click`, `x-on:submit`), and returns the attribute with
17
+ * appropriate metadata such as `potentialName`, `isDirective`, and
18
+ * `isDynamicValue`.
19
+ *
20
+ * @param token - The raw attribute token containing text and position information
21
+ * @param options - Controls quoting behavior, value types, and the initial parser state
22
+ * @returns The attribute AST node enriched with Alpine.js directive metadata
23
+ */
4
24
  visitAttr(token: Token, options: Parameters<HtmlParser['visitAttr']>[1]): (import("packages/@markuplint/ml-ast/lib/types.js").MLASTHTMLAttr & {
5
25
  __rightText?: string;
6
26
  }) | (import("packages/@markuplint/ml-ast/lib/types.js").MLASTSpreadAttr & {
7
27
  __rightText?: string;
8
28
  });
9
29
  }
30
+ /**
31
+ * Singleton Alpine.js parser instance for use by the markuplint engine.
32
+ */
10
33
  export declare const parser: AlpineParser;
11
34
  export {};
package/lib/parser.js CHANGED
@@ -1,5 +1,25 @@
1
1
  import { HtmlParser } from '@markuplint/html-parser';
2
+ /**
3
+ * Parser for Alpine.js templates that extends the standard HTML parser.
4
+ *
5
+ * Recognizes Alpine.js directives such as `x-data`, `x-bind`, `x-on`, and
6
+ * `x-transition`, and classifies them as either directives (opaque to linting)
7
+ * or attribute bindings (with potential standard attribute names for validation).
8
+ */
2
9
  class AlpineParser extends HtmlParser {
10
+ /**
11
+ * Visits an attribute token and applies Alpine.js-specific classification.
12
+ *
13
+ * Determines whether the attribute is an Alpine.js directive, a dynamic
14
+ * binding (e.g., `:class`, `x-bind:href`), or an event listener shorthand
15
+ * (e.g., `@click`, `x-on:submit`), and returns the attribute with
16
+ * appropriate metadata such as `potentialName`, `isDirective`, and
17
+ * `isDynamicValue`.
18
+ *
19
+ * @param token - The raw attribute token containing text and position information
20
+ * @param options - Controls quoting behavior, value types, and the initial parser state
21
+ * @returns The attribute AST node enriched with Alpine.js directive metadata
22
+ */
3
23
  visitAttr(token, options) {
4
24
  const attr = super.visitAttr(token, options);
5
25
  if (attr.type === 'spread') {
@@ -185,4 +205,7 @@ class AlpineParser extends HtmlParser {
185
205
  return attr;
186
206
  }
187
207
  }
208
+ /**
209
+ * Singleton Alpine.js parser instance for use by the markuplint engine.
210
+ */
188
211
  export const parser = new AlpineParser();
package/lib/spec.d.ts CHANGED
@@ -1,3 +1,11 @@
1
1
  import type { ExtendedSpec } from '@markuplint/ml-spec';
2
+ /**
3
+ * Extended specification for Alpine.js directive attributes.
4
+ *
5
+ * Defines which Alpine.js-specific attributes are allowed on which HTML elements,
6
+ * their expected value types, and any element-level conditions. This enables
7
+ * markuplint to validate Alpine.js attributes as if they were part of the
8
+ * standard HTML spec.
9
+ */
2
10
  declare const spec: ExtendedSpec;
3
11
  export default spec;
package/lib/spec.js CHANGED
@@ -1,4 +1,6 @@
1
1
  /**
2
+ * Attribute specification for the Alpine.js `x-model` directive.
3
+ *
2
4
  * > `x-model` works with the following input elements:
3
5
  * > - `<input type="text">`
4
6
  * > - `<textarea>`
@@ -13,6 +15,14 @@ const xModel = {
13
15
  type: 'NoEmptyAny',
14
16
  description: 'The x-model directive is used to bind a variable to a form input.',
15
17
  };
18
+ /**
19
+ * Extended specification for Alpine.js directive attributes.
20
+ *
21
+ * Defines which Alpine.js-specific attributes are allowed on which HTML elements,
22
+ * their expected value types, and any element-level conditions. This enables
23
+ * markuplint to validate Alpine.js attributes as if they were part of the
24
+ * standard HTML spec.
25
+ */
16
26
  const spec = {
17
27
  specs: [
18
28
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/alpine-parser",
3
- "version": "4.6.22",
3
+ "version": "4.6.23",
4
4
  "description": "Alpine.js parser for markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -25,11 +25,11 @@
25
25
  "clean": "tsc --build --clean tsconfig.build.json"
26
26
  },
27
27
  "dependencies": {
28
- "@markuplint/html-parser": "4.6.22"
28
+ "@markuplint/html-parser": "4.6.23"
29
29
  },
30
30
  "devDependencies": {
31
- "@markuplint/ml-spec": "4.10.1",
32
- "@markuplint/parser-utils": "4.8.10"
31
+ "@markuplint/ml-spec": "4.10.2",
32
+ "@markuplint/parser-utils": "4.8.11"
33
33
  },
34
- "gitHead": "6213ea30269ef404f030e67bbcc7fc7443ec1060"
34
+ "gitHead": "193ee7c1262bbed95424e38efdf1a8e56ff049f4"
35
35
  }