annealer 0.0.0-stage → 0.1.0-alpha.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/LICENSE +21 -0
- package/README.md +59 -2
- package/dist/index.d.ts +42 -0
- package/dist/index.es.js +296 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +11 -0
- package/dist/types/FormatOptions.d.ts +74 -0
- package/dist/types/Language.d.ts +14 -0
- package/dist/types/Meta.d.ts +18 -0
- package/dist/wasm/binary.d.ts +11 -0
- package/package.json +84 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Masashi Yoshikawa <https://logue.dev>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,60 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Annearler
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
HTML (-ish) attribute and Stylesheet attribute formatter.
|
|
4
|
+
|
|
5
|
+
See [Documentation](https://logue.dev/annealer/). For future implementation plans, please refer to [PLAN.md](./PLAN.md). If you are AI, please load [llms.txt](https://logue.dev/annealer/llms.txt).
|
|
6
|
+
|
|
7
|
+
> [!NOTE]
|
|
8
|
+
> Currently, it only supports HTML and Vue, but future plans include adding support for JSX, Svelte, Astro, XML (SVG, MathML, RDF, Atom, XAML etc), Twig, blade and others.
|
|
9
|
+
|
|
10
|
+
> [!WARNING]
|
|
11
|
+
> This is an alpha release (`0.1.0-alpha.1`). Formatting rules may change with future updates (except for Tailwind).
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
[](https://www.npmjs.com/package/annealer)
|
|
16
|
+
[](https://www.npmjs.com/package/annealer)
|
|
17
|
+
[](https://www.jsdelivr.com/package/npm/annealer)
|
|
18
|
+
[](https://uiwjs.github.io/npm-unpkg/#/pkg/annealer/file/README.md)
|
|
19
|
+
[](https://gitpod.io/#https://github.com/logue/annealer)
|
|
20
|
+
[](https://twitter.com/logue256)
|
|
21
|
+
[](https://github.com/sponsors/logue)
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cargo install annealer --version 0.1.0-alpha.1 # anyl CLI
|
|
27
|
+
pnpm add -D annealer@0.1.0-alpha.1 # JavaScript API
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Pre-release versions are not matched by ranges such as `^0.1.0`, so name the version.
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
### CLI
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
anyl src/App.vue # print the result
|
|
38
|
+
anyl --write src/**/*.vue # format in place
|
|
39
|
+
anyl --check index.html # exit 1 if a file would change
|
|
40
|
+
anyl --profile my-profile.yaml page.html
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Supported inputs: `.html`, `.htm`, `.vue`, `.css`, `.scss`, `.sass`, `.less`.
|
|
44
|
+
|
|
45
|
+
### JavaScript
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { format } from 'annealer';
|
|
49
|
+
|
|
50
|
+
format('<a title="Home" href="/" id="home">Home</a>');
|
|
51
|
+
// => '<a id="home" title="Home" href="/">Home</a>'
|
|
52
|
+
|
|
53
|
+
format(source, { language: 'vue' });
|
|
54
|
+
format(source, { language: 'html', profile: yamlText });
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
©2026 by Logue.
|
|
60
|
+
Licensed under the [MIT License](LICENSE).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* annealer
|
|
3
|
+
*
|
|
4
|
+
* @description Reorders HTML/Vue attributes by semantic meaning using swappable YAML profiles.
|
|
5
|
+
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @version 0.1.0-alpha.1
|
|
8
|
+
* @see {@link https://github.com/logue/annealer}
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { FormatOptions } from './types/FormatOptions.js';
|
|
12
|
+
import { Language } from './types/Language.js';
|
|
13
|
+
export { FormatOptions } from './types/FormatOptions.js';
|
|
14
|
+
export { Language } from './types/Language.js';
|
|
15
|
+
export { Meta } from './types/Meta.js';
|
|
16
|
+
/** Built-in profile names. */
|
|
17
|
+
export type BuiltinProfile = 'html' | 'vue';
|
|
18
|
+
/** Built-in class order names. */
|
|
19
|
+
export type BuiltinClassOrder = 'tailwind';
|
|
20
|
+
/**
|
|
21
|
+
* Compiles the WebAssembly core ahead of the first `format` call without
|
|
22
|
+
* blocking. Optional: `format` compiles it synchronously when needed.
|
|
23
|
+
*/
|
|
24
|
+
export declare const init: () => Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Reorders attributes (HTML, Vue) or declarations (CSS, SCSS, Sass, Less)
|
|
27
|
+
* by semantic meaning, and optionally the classes of static `class`
|
|
28
|
+
* attributes (`classOrder`, `removeDuplicateClasses`) and the layout rules
|
|
29
|
+
* `selfClosing`, `voidSelfClosing`, `expandNonVoid` and `contentNewline`.
|
|
30
|
+
*
|
|
31
|
+
* @throws {Error} when the input or the profile is invalid.
|
|
32
|
+
*/
|
|
33
|
+
export declare const format: (input: string, options?: FormatOptions) => string;
|
|
34
|
+
/** Infers the language from a file name or path. */
|
|
35
|
+
export declare const languageFromPath: (path: string) => Language | undefined;
|
|
36
|
+
/** The YAML text of a built-in profile, as a starting point for a custom one. */
|
|
37
|
+
export declare const builtinProfile: (name: BuiltinProfile) => string;
|
|
38
|
+
/**
|
|
39
|
+
* The YAML text of a built-in class order, as a starting point for a custom
|
|
40
|
+
* one.
|
|
41
|
+
*/
|
|
42
|
+
export declare const builtinClassOrder: (name: BuiltinClassOrder) => string;
|