Skip to content

Commit

Permalink
refactor: Optimize for readability & use JSDoc (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
xeho91 authored Jul 3, 2024
1 parent 0f7c6c0 commit c590779
Show file tree
Hide file tree
Showing 93 changed files with 3,670 additions and 4,821 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# `svelte-ast-print`

![NPM Version](https://img.shields.io/npm/v/svelte-ast-print?style=for-the-badge&logo=npm)
![JSR Version](https://img.shields.io/jsr/v/%40xeho91/svelte-ast-print?style=for-the-badge&logo=jsr)

Print **Svelte AST** nodes as a string.\
A.k.a. [`parse`] in reverse.
Expand All @@ -15,7 +16,8 @@ This is what you need to create [codemods] - e.g. for migration between Svelte v

This package depends on:

- [`esrap`] for printing [ESTree] specification-compliant AST nodes
1 [`esrap`] for printing [ESTree] specification-compliant AST nodes
2 [`zimmerframe`] for walking on the AST nodes

## Limitations

Expand Down Expand Up @@ -143,6 +145,7 @@ This project is licensed under the [MIT License](./LICENSE.md).

<!-- links -->
[`esrap`]: https://github.com/rich-harris/esrap
[`zimmerframe`]: https://github.com/rich-harris/zimmerframe
[ESTree]: https://github.com/estree/estree
[codemods]: https://codemod.com/blog/what-are-codemods#ill-find-replace-whats-the-issue-hint-a-lot
[`parse`]: https://svelte.dev/docs/svelte-compiler#parse
11 changes: 11 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://jsr.io/schema/config-file.v1.json",
"name": "@xeho91/svelte-ast-print",
"version": "0.2.0-next.0",
"exports": {
".": "./src/mod.js"
},
"publish": {
"include": ["src/", "README.md"]
}
}
2 changes: 1 addition & 1 deletion lefthook.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#:schema https://json.schemastore.org/lefthook.json

[pre-commit.commands]
biome = { glob = "*.{ts,json,jsonc}", run = "pnpm biome check --no-errors-on-unmatched --files-ignore-unknown=true {staged_files}" }
biome = { glob = "*.{js,ts,json,jsonc}", run = "pnpm biome check --no-errors-on-unmatched --files-ignore-unknown=true {staged_files}" }
markdownlint = { glob = "*.md", run = "pnpm markdownlint-cli2 {staged_files}" }
typos = { glob = "*", run = "typos --verbose" }
vitest = { glob = "**/src/*.test.{ts}", run = "pnpm vitest related --run" }
34 changes: 18 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package",
"name": "svelte-ast-print",
"version": "0.0.1-next.0",
"version": "0.2.0-next.0",
"type": "module",
"description": "Print Svelte AST nodes as a string. Aka parse in reverse.",
"keywords": ["svelte", "ast", "print"],
Expand Down Expand Up @@ -33,34 +33,37 @@
"engines": {
"node": ">=20"
},
"files": ["dist/"],
"files": ["src/"],
"imports": {
"#test/*": {
"development": "./test/*.ts"
"#tests/*": {
"development": "./tests/*.ts"
},
"#*": {
"development": "./src/*.ts",
"default": "./dist/*.js"
"development": "./src/*.js",
"default": "./src/*.js"
},
"#types": {
"development": "./src/types.d.ts",
"default": "./src/types.d.ts"
}
},
"exports": {
".": "./dist/mod.js",
"./*": "./dist/*.js",
".": {
"types": "./src/types.d.ts",
"default": "./src/mod.js"
},
"./package.json": "./package.json"
},
"packageManager": "pnpm@9.5.0-beta.0+sha256.bd91cddc9b205c94b5bf0380cec8fc8e4b1dde7b8c5191732f3d4e73848e860e",
"scripts": {
"build": "pnpm run \"/^build:.*/\" ",
"build:doc": "typedoc",
"build:pkg": "tsup",
"clean": "pnpm run \"/^clean:.*/\"; del \"./**/node_modules\" ",
"clean:build": "del \"./.tsup\" \"./dist\" ",
"clean:cache": "del \"./node_modules/.cache\" ",
"clean:doc": "del \"./docs\" ",
"clean:test": "del \"./coverage\" ",
"dev": "pnpm run \"/^dev:.*/\" ",
"dev:doc": "typedoc --watch",
"dev:pkg": "tsup --watch",
"dev:test": "pnpm vitest watch --passWithNoTests --ui",
"fix": "pnpm run \"/^fix:.*/\" ",
"fix:format": "biome format . --verbose --write",
Expand All @@ -73,24 +76,23 @@
"lint:md": "markdownlint-cli2 \"**/*.md\" \"#**/node_modules\" ",
"lint:ts": "tsc --noEmit",
"lint:typos": "typos --verbose",
"release": "pnpm run build:pkg && auto shipit",
"release": "pnpm auto shipit",
"serve:doc": "serve \"./docs\" ",
"test": "vitest run . --passWithNoTests"
},
"dependencies": {
"esrap": "1.2.2"
"esrap": "1.2.2",
"zimmerframe": "1.1.2"
},
"devDependencies": {
"@total-typescript/ts-reset": "0.5.1",
"@total-typescript/tsconfig": "1.0.4",
"@types/estree": "1.0.5",
"@types/node": "20.14.9",
"dedent": "1.5.3",
"svelte": "5.0.0-next.169",
"tsup": "8.1.0",
"type-fest": "4.20.1",
"typescript": "5.5.3",
"zimmerframe": "1.1.2"
"typescript": "5.5.3"
},
"peerDependencies": {
"svelte": "^5.0.0-next.169 || ^5.0.0"
Expand Down
9 changes: 3 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c590779

Please sign in to comment.