Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ast-grep for openSUSE:Factory checked in at 2024-07-24 15:31:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ast-grep (Old) and /work/SRC/openSUSE:Factory/.ast-grep.new.1869 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ast-grep" Wed Jul 24 15:31:42 2024 rev:31 rq:1189217 version:0.25.3+0 Changes: -------- --- /work/SRC/openSUSE:Factory/ast-grep/ast-grep.changes 2024-07-22 17:15:31.835339644 +0200 +++ /work/SRC/openSUSE:Factory/.ast-grep.new.1869/ast-grep.changes 2024-07-25 12:16:03.255171799 +0200 @@ -1,0 +2,9 @@ +Tue Jul 23 09:36:26 UTC 2024 - Michael Vetter <mvetter@suse.com> + +- Update to 0.25.3: + * feat: support custom language injection #1309 + * feat: register embedded language 416e28e + * fix(deps): update dependency @babel/core to v7.24.9 8c5dd00 + * fix(deps): update dependency @swc/core to v1.7.0 61f6a14 + +------------------------------------------------------------------- Old: ---- ast-grep-0.25.2+0.tar.zst New: ---- ast-grep-0.25.3+0.tar.zst ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ast-grep.spec ++++++ --- /var/tmp/diff_new_pack.KHCr2U/_old 2024-07-25 12:16:04.591222132 +0200 +++ /var/tmp/diff_new_pack.KHCr2U/_new 2024-07-25 12:16:04.591222132 +0200 @@ -17,7 +17,7 @@ Name: ast-grep -Version: 0.25.2+0 +Version: 0.25.3+0 Release: 0 Summary: A CLI tool for code structural search, lint and rewriting License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.KHCr2U/_old 2024-07-25 12:16:04.639223940 +0200 +++ /var/tmp/diff_new_pack.KHCr2U/_new 2024-07-25 12:16:04.651224392 +0200 @@ -3,7 +3,7 @@ <param name="url">https://github.com/ast-grep/ast-grep.git</param> <param name="versionformat">@PARENT_TAG@+@TAG_OFFSET@</param> <param name="scm">git</param> - <param name="revision">0.25.2</param> + <param name="revision">0.25.3</param> <param name="match-tag">*</param> <param name="versionrewrite-pattern">v(\d+\.\d+\.\d+)</param> <param name="versionrewrite-replacement">\1</param> ++++++ ast-grep-0.25.2+0.tar.zst -> ast-grep-0.25.3+0.tar.zst ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/.github/workflows/coverage.yaml new/ast-grep-0.25.3+0/.github/workflows/coverage.yaml --- old/ast-grep-0.25.2+0/.github/workflows/coverage.yaml 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/.github/workflows/coverage.yaml 2024-07-23 07:38:52.000000000 +0200 @@ -18,7 +18,7 @@ - name: Checkout repository uses: actions/checkout@v4 with: - submodules : true + submodules: true - name: Generate code coverage run: | cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out xml @@ -36,10 +36,6 @@ uses: actions/checkout@v4 with: submodules: true - - name: Install rust toolchain - uses: actions-rs/toolchain@v1 - with: - components: rustfmt, clippy - name: Cache uses: actions/cache@v4 with: @@ -52,4 +48,4 @@ - name: Format run: cargo fmt --all -- --check - name: Lint - run: cargo clippy --all-targets --all-features --release --locked -- -D clippy::all \ No newline at end of file + run: cargo clippy --all-targets --all-features --workspace --release --locked -- -D clippy::all \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/.github/workflows/pypi.yml new/ast-grep-0.25.3+0/.github/workflows/pypi.yml --- old/ast-grep-0.25.2+0/.github/workflows/pypi.yml 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/.github/workflows/pypi.yml 2024-07-23 07:38:52.000000000 +0200 @@ -40,7 +40,6 @@ args: --out dist - name: "Test sdist" run: | - rustup default $(cat rust-toolchain) pip install dist/${{ env.PACKAGE_NAME }}-*.tar.gz --force-reinstall sg --help - name: "Upload sdist" @@ -181,7 +180,7 @@ - macos-x86_64 - windows - linux - # - linux-cross I would want to support linux-cross but it is too hard for me to compile c projects for tree-sitter-languages + # - linux-cross I would want to support linux-cross but it is too hard for me to compile c projects for tree-sitter-languages # If you don't set release flag, it's a dry run (no uploads). if: "startsWith(github.event.ref, 'refs/tags') || inputs.need_release" environment: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/CHANGELOG.md new/ast-grep-0.25.3+0/CHANGELOG.md --- old/ast-grep-0.25.2+0/CHANGELOG.md 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/CHANGELOG.md 2024-07-23 07:38:52.000000000 +0200 @@ -4,8 +4,17 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [0.25.3](https://github.com/ast-grep/ast-grep/compare/0.25.2...0.25.3) + +- feat: support custom language injection [`#1309`](https://github.com/ast-grep/ast-grep/issues/1309) +- feat: register embedded language [`416e28e`](https://github.com/ast-grep/ast-grep/commit/416e28ee9f2b2e7857aa0c613d8e5ec9...) +- fix(deps): update dependency @babel/core to v7.24.9 [`8c5dd00`](https://github.com/ast-grep/ast-grep/commit/8c5dd00de4fc7633ddad27aa4627fb85...) +- fix(deps): update dependency @swc/core to v1.7.0 [`61f6a14`](https://github.com/ast-grep/ast-grep/commit/61f6a14d96438a93e77ddc0bd5f8a3f5...) + #### [0.25.2](https://github.com/ast-grep/ast-grep/compare/0.25.1...0.25.2) +> 18 July 2024 + - fix: only present code action when there are truly fixable diagnostic [`#1327`](https://github.com/ast-grep/ast-grep/issues/1327) - refactor: move some function out of lsp [`1e6b477`](https://github.com/ast-grep/ast-grep/commit/1e6b47720911d77435461437f9f9888f...) - fix: use fix in data for fix all command [`d358d45`](https://github.com/ast-grep/ast-grep/commit/d358d454811b45d08be071a79edb0831...) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/Cargo.lock new/ast-grep-0.25.3+0/Cargo.lock --- old/ast-grep-0.25.2+0/Cargo.lock 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/Cargo.lock 2024-07-23 07:38:52.000000000 +0200 @@ -113,7 +113,7 @@ [[package]] name = "ast-grep" -version = "0.25.2" +version = "0.25.3" dependencies = [ "ansi_term", "anyhow", @@ -145,7 +145,7 @@ [[package]] name = "ast-grep-config" -version = "0.25.2" +version = "0.25.3" dependencies = [ "anyhow", "ast-grep-core", @@ -161,7 +161,7 @@ [[package]] name = "ast-grep-core" -version = "0.25.2" +version = "0.25.3" dependencies = [ "bit-set", "regex", @@ -172,7 +172,7 @@ [[package]] name = "ast-grep-dynamic" -version = "0.25.2" +version = "0.25.3" dependencies = [ "ast-grep-core", "ignore", @@ -184,7 +184,7 @@ [[package]] name = "ast-grep-language" -version = "0.25.2" +version = "0.25.3" dependencies = [ "ast-grep-core", "ignore", @@ -215,7 +215,7 @@ [[package]] name = "ast-grep-lsp" -version = "0.25.2" +version = "0.25.3" dependencies = [ "ast-grep-config", "ast-grep-core", @@ -229,7 +229,7 @@ [[package]] name = "ast-grep-napi" -version = "0.25.2" +version = "0.25.3" dependencies = [ "ast-grep-config", "ast-grep-core", @@ -248,7 +248,7 @@ [[package]] name = "ast-grep-py" -version = "0.25.2" +version = "0.25.3" dependencies = [ "anyhow", "ast-grep-config", @@ -314,7 +314,7 @@ [[package]] name = "benches" -version = "0.25.2" +version = "0.25.3" dependencies = [ "ast-grep-config", "ast-grep-core", @@ -324,18 +324,18 @@ [[package]] name = "bit-set" -version = "0.6.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0481a0e032742109b1133a095184ee93d88f3dc9e0d28a5d033dc77a073f44f" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c54ff287cfc0a34f38a6b832ea1bd8e448a330b3e40a50859e6488bee07f22" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitflags" @@ -963,9 +963,9 @@ [[package]] name = "libloading" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", "windows-targets 0.48.5", @@ -1066,9 +1066,9 @@ [[package]] name = "napi-derive" -version = "2.16.8" +version = "2.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eafd2b920906ea5b1f5f1f9d1eff9cc74e4ff8124dca41b501c1413079589187" +checksum = "87c3b5d4ab13e20a4bb9d3a1e2f3d4e77eee4a205d0f810abfd226b971dc6ce5" dependencies = [ "cfg-if", "convert_case", @@ -1080,9 +1080,9 @@ [[package]] name = "napi-derive-backend" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b370b784440c65eb9001d839012eb912ee43e3a2d0361e2c30c13052372c39fe" +checksum = "96de436a6ab93265beef838f8333c8345438f059df6081fe0ad0b8648ee0c524" dependencies = [ "convert_case", "once_cell", @@ -1672,18 +1672,18 @@ [[package]] name = "thiserror" -version = "1.0.62" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.62" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", @@ -1727,9 +1727,9 @@ [[package]] name = "tokio" -version = "1.38.0" +version = "1.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +checksum = "eb2caba9f80616f438e09748d5acda951967e1ea58508ef53d9c6402485a46df" dependencies = [ "backtrace", "bytes", @@ -1758,9 +1758,9 @@ [[package]] name = "toml_edit" -version = "0.22.15" +version = "0.22.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59a3a72298453f564e2b111fa896f8d07fabb36f51f06d7e875fc5e0b5a3ef1" +checksum = "278f3d518e152219c994ce877758516bca5e118eaed6996192a774fb9fbf0788" dependencies = [ "indexmap", "toml_datetime", @@ -1900,9 +1900,9 @@ [[package]] name = "tree-sitter-cpp" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537b7e0f0d8c89b8dd6f4d195814da94832f20720c09016c2a3ac3dc3c437993" +checksum = "1d509a22a992790d38f2c291961ff8a1ff016c437c7ec6befc9220b8eec8918c" dependencies = [ "cc", "tree-sitter", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/Cargo.toml new/ast-grep-0.25.3+0/Cargo.toml --- old/ast-grep-0.25.2+0/Cargo.toml 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/Cargo.toml 2024-07-23 07:38:52.000000000 +0200 @@ -11,7 +11,7 @@ lto = true [workspace.package] -version = "0.25.2" +version = "0.25.3" authors = ["Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>"] edition = "2021" license = "MIT" @@ -22,13 +22,13 @@ readme = "README.md" [workspace.dependencies] -ast-grep-core = { path = "crates/core", version = "0.25.2" } -ast-grep-config = { path = "crates/config", version = "0.25.2" } -ast-grep-dynamic = { path = "crates/dynamic", version = "0.25.2" } -ast-grep-language = { path = "crates/language", version = "0.25.2" } -ast-grep-lsp = { path = "crates/lsp", version = "0.25.2" } +ast-grep-core = { path = "crates/core", version = "0.25.3" } +ast-grep-config = { path = "crates/config", version = "0.25.3" } +ast-grep-dynamic = { path = "crates/dynamic", version = "0.25.3" } +ast-grep-language = { path = "crates/language", version = "0.25.3" } +ast-grep-lsp = { path = "crates/lsp", version = "0.25.3" } -bit-set = { version = "0.6.0" } +bit-set = { version = "0.8.0" } ignore = { version = "0.4.22" } regex = { version = "1.10.4" } serde = { version = "1.0.200", features = ["derive"] } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/benches/package.json new/ast-grep-0.25.3+0/benches/package.json --- old/ast-grep-0.25.2+0/benches/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/benches/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -12,10 +12,10 @@ "license": "ISC", "dependencies": { "@ast-grep/napi": "link:../crates/napi", - "@babel/core": "7.24.8", + "@babel/core": "7.24.9", "@babel/plugin-syntax-typescript": "7.24.7", "@oxidation-compiler/napi": "0.2.0", - "@swc/core": "1.6.13", + "@swc/core": "1.7.0", "benny": "3.7.1", "tree-sitter": "0.20.6", "tree-sitter-typescript": "0.21.2", @@ -23,7 +23,7 @@ }, "devDependencies": { "@types/babel__core": "7.20.5", - "@types/node": "20.14.10", + "@types/node": "20.14.11", "prettier": "3.3.3", "ts-node": "10.9.2" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/benches/pnpm-lock.yaml new/ast-grep-0.25.3+0/benches/pnpm-lock.yaml --- old/ast-grep-0.25.2+0/benches/pnpm-lock.yaml 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/benches/pnpm-lock.yaml 2024-07-23 07:38:52.000000000 +0200 @@ -9,17 +9,17 @@ specifier: link:../crates/napi version: link:../crates/napi '@babel/core': - specifier: 7.24.8 - version: 7.24.8 + specifier: 7.24.9 + version: 7.24.9 '@babel/plugin-syntax-typescript': specifier: 7.24.7 - version: 7.24.7(@babel/core@7.24.8) + version: 7.24.7(@babel/core@7.24.9) '@oxidation-compiler/napi': specifier: 0.2.0 version: 0.2.0 '@swc/core': - specifier: 1.6.13 - version: 1.6.13 + specifier: 1.7.0 + version: 1.7.0 benny: specifier: 3.7.1 version: 3.7.1 @@ -38,14 +38,14 @@ specifier: 7.20.5 version: 7.20.5 '@types/node': - specifier: 20.14.10 - version: 20.14.10 + specifier: 20.14.11 + version: 20.14.11 prettier: specifier: 3.3.3 version: 3.3.3 ts-node: specifier: 10.9.2 - version: 10.9.2(@swc/core@1.6.13)(@types/node@20.14.10)(typescript@5.5.3) + version: 10.9.2(@swc/core@1.7.0)(@types/node@20.14.11)(typescript@5.5.3) packages: @@ -91,7 +91,7 @@ engines: {node: '>=6.9.0'} dependencies: '@babel/highlight': 7.24.7 - picocolors: 1.0.0 + picocolors: 1.0.1 dev: false /@babel/compat-data@7.24.8: @@ -99,20 +99,20 @@ engines: {node: '>=6.9.0'} dev: false - /@babel/core@7.24.8: - resolution: {integrity: sha512-6AWcmZC/MZCO0yKys4uhg5NlxL0ESF3K6IAaoQ+xSXvPyPyxNWRafP+GDbI88Oh68O7QkJgmEtedWPM9U0pZNg==} + /@babel/core@7.24.9: + resolution: {integrity: sha512-5e3FI4Q3M3Pbr21+5xJwCv6ZT6KmGkI0vw3Tozy5ODAQFTIWe37iT8Cr7Ice2Ntb+M3iSKCEWMB1MBgKrW3whg==} engines: {node: '>=6.9.0'} dependencies: '@ampproject/remapping': 2.2.1 '@babel/code-frame': 7.24.7 - '@babel/generator': 7.24.8 + '@babel/generator': 7.24.10 '@babel/helper-compilation-targets': 7.24.8 - '@babel/helper-module-transforms': 7.24.8(@babel/core@7.24.8) + '@babel/helper-module-transforms': 7.24.9(@babel/core@7.24.9) '@babel/helpers': 7.24.8 '@babel/parser': 7.24.8 '@babel/template': 7.24.7 '@babel/traverse': 7.24.8 - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 convert-source-map: 2.0.0 debug: 4.3.4 gensync: 1.0.0-beta.2 @@ -122,11 +122,11 @@ - supports-color dev: false - /@babel/generator@7.24.8: - resolution: {integrity: sha512-47DG+6F5SzOi0uEvK4wMShmn5yY0mVjVJoWTphdY2B4Rx9wHgjK7Yhtr0ru6nE+sn0v38mzrWOlah0p/YlHHOQ==} + /@babel/generator@7.24.10: + resolution: {integrity: sha512-o9HBZL1G2129luEUlG1hB4N/nlYNWHnpwlND9eOMclRqqu1YDy2sSYVCFUZwl8I1Gxh+QSRrP2vD7EpUmFVXxg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 jsesc: 2.5.2 @@ -147,7 +147,7 @@ resolution: {integrity: sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 dev: false /@babel/helper-function-name@7.24.7: @@ -155,14 +155,14 @@ engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.24.7 - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 dev: false /@babel/helper-hoist-variables@7.24.7: resolution: {integrity: sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 dev: false /@babel/helper-module-imports@7.24.7: @@ -170,18 +170,18 @@ engines: {node: '>=6.9.0'} dependencies: '@babel/traverse': 7.24.8 - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 transitivePeerDependencies: - supports-color dev: false - /@babel/helper-module-transforms@7.24.8(@babel/core@7.24.8): - resolution: {integrity: sha512-m4vWKVqvkVAWLXfHCCfff2luJj86U+J0/x+0N3ArG/tP0Fq7zky2dYwMbtPmkc/oulkkbjdL3uWzuoBwQ8R00Q==} + /@babel/helper-module-transforms@7.24.9(@babel/core@7.24.9): + resolution: {integrity: sha512-oYbh+rtFKj/HwBQkFlUzvcybzklmVdVV3UU+mN7n2t/q3yGHbuVdNxyFvSBO1tfvjyArpHNcWMAzsSPdyI46hw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.24.8 + '@babel/core': 7.24.9 '@babel/helper-environment-visitor': 7.24.7 '@babel/helper-module-imports': 7.24.7 '@babel/helper-simple-access': 7.24.7 @@ -201,7 +201,7 @@ engines: {node: '>=6.9.0'} dependencies: '@babel/traverse': 7.24.8 - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 transitivePeerDependencies: - supports-color dev: false @@ -210,18 +210,12 @@ resolution: {integrity: sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 dev: false - /@babel/helper-string-parser@7.24.7: - resolution: {integrity: sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg==} - engines: {node: '>=6.9.0'} - dev: true - /@babel/helper-string-parser@7.24.8: resolution: {integrity: sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==} engines: {node: '>=6.9.0'} - dev: false /@babel/helper-validator-identifier@7.24.7: resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==} @@ -237,7 +231,7 @@ engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.24.7 - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 dev: false /@babel/highlight@7.24.7: @@ -247,7 +241,7 @@ '@babel/helper-validator-identifier': 7.24.7 chalk: 2.4.2 js-tokens: 4.0.0 - picocolors: 1.0.0 + picocolors: 1.0.1 dev: false /@babel/parser@7.23.3: @@ -255,15 +249,7 @@ engines: {node: '>=6.0.0'} hasBin: true dependencies: - '@babel/types': 7.24.7 - dev: true - - /@babel/parser@7.24.7: - resolution: {integrity: sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==} - engines: {node: '>=6.0.0'} - hasBin: true - dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.24.8 dev: true /@babel/parser@7.24.8: @@ -271,16 +257,15 @@ engines: {node: '>=6.0.0'} hasBin: true dependencies: - '@babel/types': 7.24.8 - dev: false + '@babel/types': 7.24.9 - /@babel/plugin-syntax-typescript@7.24.7(@babel/core@7.24.8): + /@babel/plugin-syntax-typescript@7.24.7(@babel/core@7.24.9): resolution: {integrity: sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.8 + '@babel/core': 7.24.9 '@babel/helper-plugin-utils': 7.24.7 dev: false @@ -290,7 +275,7 @@ dependencies: '@babel/code-frame': 7.24.7 '@babel/parser': 7.24.8 - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 dev: false /@babel/traverse@7.24.8: @@ -298,13 +283,13 @@ engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.24.7 - '@babel/generator': 7.24.8 + '@babel/generator': 7.24.10 '@babel/helper-environment-visitor': 7.24.7 '@babel/helper-function-name': 7.24.7 '@babel/helper-hoist-variables': 7.24.7 '@babel/helper-split-export-declaration': 7.24.7 '@babel/parser': 7.24.8 - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 debug: 4.3.4 globals: 11.12.0 transitivePeerDependencies: @@ -315,28 +300,27 @@ resolution: {integrity: sha512-OZnvoH2l8PK5eUvEcUyCt/sXgr/h+UWpVuBbOljwcrAgUl6lpchoQ++PHGyQy1AtYnVA6CEq3y5xeEI10brpXw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/helper-string-parser': 7.24.7 + '@babel/helper-string-parser': 7.24.8 '@babel/helper-validator-identifier': 7.24.7 to-fast-properties: 2.0.0 dev: true - /@babel/types@7.24.7: - resolution: {integrity: sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==} + /@babel/types@7.24.8: + resolution: {integrity: sha512-SkSBEHwwJRU52QEVZBmMBnE5Ux2/6WU1grdYyOhpbCNxbmJrDuDCphBzKZSO3taf0zztp+qkWlymE5tVL5l0TA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/helper-string-parser': 7.24.7 + '@babel/helper-string-parser': 7.24.8 '@babel/helper-validator-identifier': 7.24.7 to-fast-properties: 2.0.0 dev: true - /@babel/types@7.24.8: - resolution: {integrity: sha512-SkSBEHwwJRU52QEVZBmMBnE5Ux2/6WU1grdYyOhpbCNxbmJrDuDCphBzKZSO3taf0zztp+qkWlymE5tVL5l0TA==} + /@babel/types@7.24.9: + resolution: {integrity: sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-string-parser': 7.24.8 '@babel/helper-validator-identifier': 7.24.7 to-fast-properties: 2.0.0 - dev: false /@cspotcode/source-map-support@0.8.1: resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} @@ -439,88 +423,88 @@ '@oxidation-compiler/napi-win32-x64-msvc': 0.2.0 dev: false - /@swc/core-darwin-arm64@1.6.13: - resolution: {integrity: sha512-SOF4buAis72K22BGJ3N8y88mLNfxLNprTuJUpzikyMGrvkuBFNcxYtMhmomO0XHsgLDzOJ+hWzcgjRNzjMsUcQ==} + /@swc/core-darwin-arm64@1.7.0: + resolution: {integrity: sha512-2ylhM7f0HwUwLrFYZAe/dse8PCbPsYcJS3Dt7Q8NT3PUn7vy6QOMxNcOPPuDrnmaXqQQO3oxdmRapguTxaat9g==} engines: {node: '>=10'} cpu: [arm64] os: [darwin] requiresBuild: true optional: true - /@swc/core-darwin-x64@1.6.13: - resolution: {integrity: sha512-AW8akFSC+tmPE6YQQvK9S2A1B8pjnXEINg+gGgw0KRUUXunvu1/OEOeC5L2Co1wAwhD7bhnaefi06Qi9AiwOag==} + /@swc/core-darwin-x64@1.7.0: + resolution: {integrity: sha512-SgVnN4gT1Rb9YfTkp4FCUITqSs7Yj0uB2SUciu5CV3HuGvS5YXCUzh+KrwpLFtx8NIgivISKcNnb41mJi98X8Q==} engines: {node: '>=10'} cpu: [x64] os: [darwin] requiresBuild: true optional: true - /@swc/core-linux-arm-gnueabihf@1.6.13: - resolution: {integrity: sha512-f4gxxvDXVUm2HLYXRd311mSrmbpQF2MZ4Ja6XCQz1hWAxXdhRl1gpnZ+LH/xIfGSwQChrtLLVrkxdYUCVuIjFg==} + /@swc/core-linux-arm-gnueabihf@1.7.0: + resolution: {integrity: sha512-+Z9Dayart1iKJQEJJ9N/KS4z5EdXJE3WPFikY0jonKTo4Dd8RuyVz5yLvqcIMeVdz/SwximATaL6iJXw7hZS9A==} engines: {node: '>=10'} cpu: [arm] os: [linux] requiresBuild: true optional: true - /@swc/core-linux-arm64-gnu@1.6.13: - resolution: {integrity: sha512-Nf/eoW2CbG8s+9JoLtjl9FByBXyQ5cjdBsA4efO7Zw4p+YSuXDgc8HRPC+E2+ns0praDpKNZtLvDtmF2lL+2Gg==} + /@swc/core-linux-arm64-gnu@1.7.0: + resolution: {integrity: sha512-UnLrCiZ1EI4shznJn0xP6DLgsXUSwtfsdgHhGYCrvbgVBBve3S9iFgVFEB3SPl7Q/TdowNbrN4zHU0oChfiNfw==} engines: {node: '>=10'} cpu: [arm64] os: [linux] requiresBuild: true optional: true - /@swc/core-linux-arm64-musl@1.6.13: - resolution: {integrity: sha512-2OysYSYtdw79prJYuKIiux/Gj0iaGEbpS2QZWCIY4X9sGoETJ5iMg+lY+YCrIxdkkNYd7OhIbXdYFyGs/w5LDg==} + /@swc/core-linux-arm64-musl@1.7.0: + resolution: {integrity: sha512-H724UANA+ptsfwKRr9mnaDa9cb5fw0oFysiGKTgb3DMYcgk3Od0jMTnXVPFSVpo7FlmyxeC9K8ueUPBOoOK6XA==} engines: {node: '>=10'} cpu: [arm64] os: [linux] requiresBuild: true optional: true - /@swc/core-linux-x64-gnu@1.6.13: - resolution: {integrity: sha512-PkR4CZYJNk5hcd2+tMWBpnisnmYsUzazI1O5X7VkIGFcGePTqJ/bWlfUIVVExWxvAI33PQFzLbzmN5scyIUyGQ==} + /@swc/core-linux-x64-gnu@1.7.0: + resolution: {integrity: sha512-SY3HA0K0Dpqt1HIfMLGpwL4hd4UaL2xHP5oZXPlRQPhUDZrbb4PbI3ZJnh66c63eL4ZR8EJ+HRFI0Alx5p69Zw==} engines: {node: '>=10'} cpu: [x64] os: [linux] requiresBuild: true optional: true - /@swc/core-linux-x64-musl@1.6.13: - resolution: {integrity: sha512-OdsY7wryTxCKwGQcwW9jwWg3cxaHBkTTHi91+5nm7hFPpmZMz1HivJrWAMwVE7iXFw+M4l6ugB/wCvpYrUAAjA==} + /@swc/core-linux-x64-musl@1.7.0: + resolution: {integrity: sha512-cEJ2ebtV1v/5Ilb55E05J6F5SrHKQWzUttIhR5Mkayyo+yvPslcpByuFC3D+J7X1ebziTOBpWuMpUdjLfh3SMQ==} engines: {node: '>=10'} cpu: [x64] os: [linux] requiresBuild: true optional: true - /@swc/core-win32-arm64-msvc@1.6.13: - resolution: {integrity: sha512-ap6uNmYjwk9M/+bFEuWRNl3hq4VqgQ/Lk+ID/F5WGqczNr0L7vEf+pOsRAn0F6EV+o/nyb3ePt8rLhE/wjHpPg==} + /@swc/core-win32-arm64-msvc@1.7.0: + resolution: {integrity: sha512-ecQOOmzEssz+m0pR4xDYCGuvn3E/l0nQ3tk5jp1NA1lsAy4bMV0YbYCHjptYvWL/UjhIerIp3IlCJ8x5DodSog==} engines: {node: '>=10'} cpu: [arm64] os: [win32] requiresBuild: true optional: true - /@swc/core-win32-ia32-msvc@1.6.13: - resolution: {integrity: sha512-IJ8KH4yIUHTnS/U1jwQmtbfQals7zWPG0a9hbEfIr4zI0yKzjd83lmtS09lm2Q24QBWOCFGEEbuZxR4tIlvfzA==} + /@swc/core-win32-ia32-msvc@1.7.0: + resolution: {integrity: sha512-gz81seZkRn3zMnVOc7L5k6F4vQC82gIxmHiL+GedK+A37XI/X26AASU3zxvORnqQbwQYXQ+AEVckxBmFlz3v2g==} engines: {node: '>=10'} cpu: [ia32] os: [win32] requiresBuild: true optional: true - /@swc/core-win32-x64-msvc@1.6.13: - resolution: {integrity: sha512-f6/sx6LMuEnbuxtiSL/EkR0Y6qUHFw1XVrh6rwzKXptTipUdOY+nXpKoh+1UsBm/r7H0/5DtOdrn3q5ZHbFZjQ==} + /@swc/core-win32-x64-msvc@1.7.0: + resolution: {integrity: sha512-b5Fd1xEOw9uqBpj2lqsaR4Iq9UhiL84hNDcEsi6DQA7Y1l85waQAslTbS0E4/pJ1PISAs0jW0zIGLco1eaWBOg==} engines: {node: '>=10'} cpu: [x64] os: [win32] requiresBuild: true optional: true - /@swc/core@1.6.13: - resolution: {integrity: sha512-eailUYex6fkfaQTev4Oa3mwn0/e3mQU4H8y1WPuImYQESOQDtVrowwUGDSc19evpBbHpKtwM+hw8nLlhIsF+Tw==} + /@swc/core@1.7.0: + resolution: {integrity: sha512-d4vMzH6ICllDwlPuhset2h8gu/USHdbyfJim+2hQEdxC0UONtfpmu38XBgNqRjStrji1Q5M10jfeUZL3cu1i8g==} engines: {node: '>=10'} requiresBuild: true peerDependencies: @@ -532,16 +516,16 @@ '@swc/counter': 0.1.3 '@swc/types': 0.1.9 optionalDependencies: - '@swc/core-darwin-arm64': 1.6.13 - '@swc/core-darwin-x64': 1.6.13 - '@swc/core-linux-arm-gnueabihf': 1.6.13 - '@swc/core-linux-arm64-gnu': 1.6.13 - '@swc/core-linux-arm64-musl': 1.6.13 - '@swc/core-linux-x64-gnu': 1.6.13 - '@swc/core-linux-x64-musl': 1.6.13 - '@swc/core-win32-arm64-msvc': 1.6.13 - '@swc/core-win32-ia32-msvc': 1.6.13 - '@swc/core-win32-x64-msvc': 1.6.13 + '@swc/core-darwin-arm64': 1.7.0 + '@swc/core-darwin-x64': 1.7.0 + '@swc/core-linux-arm-gnueabihf': 1.7.0 + '@swc/core-linux-arm64-gnu': 1.7.0 + '@swc/core-linux-arm64-musl': 1.7.0 + '@swc/core-linux-x64-gnu': 1.7.0 + '@swc/core-linux-x64-musl': 1.7.0 + '@swc/core-win32-arm64-msvc': 1.7.0 + '@swc/core-win32-ia32-msvc': 1.7.0 + '@swc/core-win32-x64-msvc': 1.7.0 /@swc/counter@0.1.3: resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} @@ -580,24 +564,24 @@ /@types/babel__generator@7.6.7: resolution: {integrity: sha512-6Sfsq+EaaLrw4RmdFWE9Onp63TOUue71AWb4Gpa6JxzgTYtimbM086WnYTy2U67AofR++QKCo08ZP6pwx8YFHQ==} dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.24.8 dev: true /@types/babel__template@7.4.4: resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} dependencies: - '@babel/parser': 7.24.7 - '@babel/types': 7.24.7 + '@babel/parser': 7.24.8 + '@babel/types': 7.24.8 dev: true /@types/babel__traverse@7.20.4: resolution: {integrity: sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==} dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.24.8 dev: true - /@types/node@20.14.10: - resolution: {integrity: sha512-MdiXf+nDuMvY0gJKxyfZ7/6UFsETO7mGKF54MVD/ekJS6HdFtpZFBgrh6Pseu64XTb2MLyFPlbW6hj8HYRQNOQ==} + /@types/node@20.14.11: + resolution: {integrity: sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA==} dependencies: undici-types: 5.26.5 dev: true @@ -1027,10 +1011,6 @@ mimic-fn: 2.1.0 dev: false - /picocolors@1.0.0: - resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} - dev: false - /picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} dev: false @@ -1221,7 +1201,7 @@ prebuild-install: 7.1.1 dev: false - /ts-node@10.9.2(@swc/core@1.6.13)(@types/node@20.14.10)(typescript@5.5.3): + /ts-node@10.9.2(@swc/core@1.7.0)(@types/node@20.14.11)(typescript@5.5.3): resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true peerDependencies: @@ -1236,12 +1216,12 @@ optional: true dependencies: '@cspotcode/source-map-support': 0.8.1 - '@swc/core': 1.6.13 + '@swc/core': 1.7.0 '@tsconfig/node10': 1.0.9 '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.14.10 + '@types/node': 20.14.11 acorn: 8.10.0 acorn-walk: 8.2.0 arg: 4.1.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/benches/src/sg_benchmark.rs new/ast-grep-0.25.3+0/benches/src/sg_benchmark.rs --- old/ast-grep-0.25.2+0/benches/src/sg_benchmark.rs 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/benches/src/sg_benchmark.rs 2024-07-23 07:38:52.000000000 +0200 @@ -14,7 +14,7 @@ } fn find_pattern<M: Matcher<SupportLang>>(sg: &AstGrep<StrDoc<SupportLang>>, pattern: &M) { - sg.root().find_all(pattern).for_each(|n| drop(n)); + sg.root().find_all(pattern).for_each(drop); } fn get_sg(path: &str) -> AstGrep<StrDoc<SupportLang>> { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/cli/src/config.rs new/ast-grep-0.25.3+0/crates/cli/src/config.rs --- old/ast-grep-0.25.2+0/crates/cli/src/config.rs 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/cli/src/config.rs 2024-07-23 07:38:52.000000000 +0200 @@ -1,5 +1,5 @@ use crate::error::ErrorContext as EC; -use crate::lang::{CustomLang, LanguageGlobs, SgLang}; +use crate::lang::{CustomLang, LanguageGlobs, SerializableInjection, SgLang}; use anyhow::{Context, Result}; use ast_grep_config::{ @@ -49,6 +49,9 @@ /// additional file globs for languages #[serde(skip_serializing_if = "Option::is_none")] pub language_globs: Option<LanguageGlobs>, + /// injection config for embedded languages + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub language_injections: Vec<SerializableInjection>, } pub fn find_rules( @@ -81,6 +84,7 @@ if let Some(globs) = sg_config.language_globs { SgLang::register_globs(globs)?; } + SgLang::register_injections(sg_config.language_injections)?; Ok(()) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/cli/src/error.rs new/ast-grep-0.25.3+0/crates/cli/src/error.rs --- old/ast-grep-0.25.2+0/crates/cli/src/error.rs 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/cli/src/error.rs 2024-07-23 07:38:52.000000000 +0200 @@ -32,6 +32,7 @@ InvalidGlobalUtils, GlobPattern, UnrecognizableLanguage(String), + LangInjection, // Run ParsePattern, LanguageNotSpecified, @@ -71,7 +72,7 @@ ReadConfiguration | ReadRule(_) | WalkRuleDir(_) | WriteFile(_) => 5, StdInIsNotInteractive => 6, ParseTest(_) | ParseRule(_) | ParseConfiguration | GlobPattern | ParsePattern - | InvalidGlobalUtils => 8, + | InvalidGlobalUtils | LangInjection => 8, CannotInferShell => 10, ProjectAlreadyExist | FileAlreadyExist(_) => 17, InsufficientCLIArgument(_) => 22, @@ -147,6 +148,11 @@ "The pattern in files/ignore is not a valid glob. Please refer to doc and fix the error.", CONFIG_GUIDE, ), + LangInjection => Self::new( + "Cannot parse languageInjections in config", + "The rule in languageInjections is not valid. Please refer to doc and fix the error.", + CONFIG_GUIDE, + ), InvalidGlobalUtils => Self::new( "Error occurs when parsing global utility rules", "Please check the YAML rules inside the rule directory", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/cli/src/lang/injection.rs new/ast-grep-0.25.3+0/crates/cli/src/lang/injection.rs --- old/ast-grep-0.25.2+0/crates/cli/src/lang/injection.rs 1970-01-01 01:00:00.000000000 +0100 +++ new/ast-grep-0.25.3+0/crates/cli/src/lang/injection.rs 2024-07-23 07:38:52.000000000 +0200 @@ -0,0 +1,244 @@ +use super::SgLang; +use crate::error::ErrorContext as EC; +use ast_grep_config::{DeserializeEnv, RuleCore, SerializableRuleCore}; +use ast_grep_core::{ + language::{TSPoint, TSRange}, + Doc, Language, Node, StrDoc, +}; + +use anyhow::{Context, Result}; +use serde::{Deserialize, Serialize}; + +use std::collections::{HashMap, HashSet}; +use std::ptr::{addr_of, addr_of_mut}; +use std::str::FromStr; + +// NB, you should not use SgLang in the (de_serialize interface +// since Injected is used before lang registration in sgconfig.yml +#[derive(Serialize, Deserialize, Clone)] +#[serde(untagged)] +pub enum Injected { + Static(String), + Dynamic(Vec<String>), +} + +#[derive(Serialize, Deserialize, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SerializableInjection { + #[serde(flatten)] + core: SerializableRuleCore, + /// The host language, e.g. html, contains other languages + host_language: String, + /// Injected language according to the rule + /// It accepts either a string like js for single static language. + /// or an array of string like [js, ts] for dynamic language detection. + injected: Injected, +} + +struct Injection { + host: SgLang, + rules: Vec<(RuleCore<SgLang>, Option<String>)>, + injectable: HashSet<String>, +} + +impl Injection { + fn new(lang: SgLang) -> Self { + Self { + host: lang, + rules: vec![], + injectable: Default::default(), + } + } +} + +pub unsafe fn register_injetables(injections: Vec<SerializableInjection>) -> Result<()> { + let mut injectable = HashMap::new(); + for injection in injections { + register_injetable(injection, &mut injectable)?; + } + merge_default_injecatable(&mut injectable); + *addr_of_mut!(LANG_INJECTIONS) = injectable.into_values().collect(); + let injects = unsafe { &*addr_of!(LANG_INJECTIONS) as &'static Vec<Injection> }; + *addr_of_mut!(INJECTABLE_LANGS) = injects + .iter() + .map(|inj| { + ( + inj.host, + inj.injectable.iter().map(|s| s.as_str()).collect(), + ) + }) + .collect(); + Ok(()) +} + +fn merge_default_injecatable(ret: &mut HashMap<SgLang, Injection>) { + for (lang, injection) in ret { + let langs = match lang { + SgLang::Builtin(b) => b.injectable_languages(), + SgLang::Custom(c) => c.injectable_languages(), + }; + let Some(langs) = langs else { + continue; + }; + injection + .injectable + .extend(langs.iter().map(|s| s.to_string())); + } +} + +fn register_injetable( + injection: SerializableInjection, + injectable: &mut HashMap<SgLang, Injection>, +) -> Result<()> { + let lang = SgLang::from_str(&injection.host_language)?; + let env = DeserializeEnv::new(lang); + let rule = injection.core.get_matcher(env).context(EC::LangInjection)?; + let default_lang = match &injection.injected { + Injected::Static(s) => Some(s.clone()), + Injected::Dynamic(_) => None, + }; + let entry = injectable + .entry(lang) + .or_insert_with(|| Injection::new(lang)); + match injection.injected { + Injected::Static(s) => { + entry.injectable.insert(s); + } + Injected::Dynamic(v) => entry.injectable.extend(v), + } + entry.rules.push((rule, default_lang)); + Ok(()) +} + +static mut LANG_INJECTIONS: Vec<Injection> = vec![]; +static mut INJECTABLE_LANGS: Vec<(SgLang, Vec<&'static str>)> = vec![]; + +pub fn injectable_languages(lang: SgLang) -> Option<&'static [&'static str]> { + // NB: custom injection and builtin injections are resolved in INJECTABLE_LANGS + let injections = + unsafe { &*addr_of!(INJECTABLE_LANGS) as &'static Vec<(SgLang, Vec<&'static str>)> }; + let Some(injection) = injections.iter().find(|i| i.0 == lang) else { + return match lang { + SgLang::Builtin(b) => b.injectable_languages(), + SgLang::Custom(c) => c.injectable_languages(), + }; + }; + Some(&injection.1) +} + +pub fn extract_injections<D: Doc>(root: Node<D>) -> HashMap<String, Vec<TSRange>> { + // NB Only works in the CLI crate because we only has Node<SgLang> + let root: Node<StrDoc<SgLang>> = unsafe { std::mem::transmute(root) }; + let mut ret = match root.lang() { + SgLang::Custom(c) => c.extract_injections(root.clone()), + SgLang::Builtin(b) => b.extract_injections(root.clone()), + }; + let injections = unsafe { &*addr_of!(LANG_INJECTIONS) }; + extract_custom_inject(injections, root, &mut ret); + ret +} + +fn extract_custom_inject( + injections: &[Injection], + root: Node<StrDoc<SgLang>>, + ret: &mut HashMap<String, Vec<TSRange>>, +) { + let Some(rules) = injections.iter().find(|n| n.host == *root.lang()) else { + return; + }; + for (rule, default_lang) in &rules.rules { + for m in root.find_all(rule) { + let env = m.get_env(); + let Some(region) = env.get_match("CONTENT") else { + continue; + }; + let Some(lang) = env + .get_match("LANG") + .map(|n| n.text().to_string()) + .or_else(|| default_lang.clone()) + else { + continue; + }; + let range = node_to_range(region); + ret.entry(lang).or_default().push(range); + } + } +} + +fn node_to_range<D: Doc>(node: &Node<D>) -> TSRange { + let r = node.range(); + let start = node.start_pos(); + let sp = TSPoint::new(start.0 as u32, start.1 as u32); + let end = node.end_pos(); + let ep = TSPoint::new(end.0 as u32, end.1 as u32); + TSRange::new(r.start as u32, r.end as u32, &sp, &ep) +} + +#[cfg(test)] +mod test { + use super::*; + use ast_grep_config::from_str; + use ast_grep_language::SupportLang; + const DYNAMIC: &str = " +hostLanguage: js +rule: + pattern: styled.$LANG`$CONTENT` +injected: [css]"; + const STATIC: &str = " +hostLanguage: js +rule: + pattern: styled`$CONTENT` +injected: css"; + #[test] + fn test_deserialize() { + let inj: SerializableInjection = from_str(STATIC).expect("should ok"); + assert!(matches!(inj.injected, Injected::Static(_))); + let inj: SerializableInjection = from_str(DYNAMIC).expect("should ok"); + assert!(matches!(inj.injected, Injected::Dynamic(_))); + } + + const BAD: &str = " +hostLanguage: HTML +rule: + kind: not_exist +injected: [js, ts, tsx]"; + + #[test] + fn test_bad_inject() { + let mut map = HashMap::new(); + let inj: SerializableInjection = from_str(BAD).expect("should ok"); + let ret = register_injetable(inj, &mut map); + assert!(ret.is_err()); + let ec = ret.unwrap_err().downcast::<EC>().expect("should ok"); + assert!(matches!(ec, EC::LangInjection)); + } + + #[test] + fn test_good_injection() { + let mut map = HashMap::new(); + let inj: SerializableInjection = from_str(STATIC).expect("should ok"); + let ret = register_injetable(inj, &mut map); + assert!(ret.is_ok()); + let inj: SerializableInjection = from_str(DYNAMIC).expect("should ok"); + let ret = register_injetable(inj, &mut map); + assert!(ret.is_ok()); + assert_eq!(map.len(), 1); + let injections: Vec<_> = map.into_values().collect(); + let mut ret = HashMap::new(); + let sg = + SgLang::from(SupportLang::JavaScript).ast_grep("const a = styled`.btn { margin: 0; }`"); + let root = sg.root(); + extract_custom_inject(&injections, root, &mut ret); + assert_eq!(ret.len(), 1); + assert_eq!(ret["css"].len(), 1); + assert!(!ret.contains_key("js")); + ret.clear(); + let sg = + SgLang::from(SupportLang::JavaScript).ast_grep("const a = styled.css`.btn { margin: 0; }`"); + let root = sg.root(); + extract_custom_inject(&injections, root, &mut ret); + assert_eq!(ret.len(), 1); + assert_eq!(ret["css"].len(), 1); + assert!(!ret.contains_key("js")); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/cli/src/lang.rs new/ast-grep-0.25.3+0/crates/cli/src/lang.rs --- old/ast-grep-0.25.2+0/crates/cli/src/lang.rs 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/cli/src/lang.rs 2024-07-23 07:38:52.000000000 +0200 @@ -1,4 +1,5 @@ mod custom_lang; +mod injection; mod lang_globs; use anyhow::Result; @@ -18,9 +19,10 @@ use std::str::FromStr; pub use custom_lang::CustomLang; +pub use injection::SerializableInjection; pub use lang_globs::LanguageGlobs; -#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)] #[serde(untagged)] pub enum SgLang { // inlined support lang expando char @@ -51,6 +53,10 @@ Ok(()) } + pub fn register_injections(injections: Vec<SerializableInjection>) -> Result<()> { + unsafe { injection::register_injetables(injections) } + } + pub fn all_langs() -> Vec<Self> { let builtin = SupportLang::all_langs().iter().copied().map(Self::Builtin); let customs = DynamicLang::all_langs().into_iter().map(Self::Custom); @@ -180,17 +186,11 @@ } fn injectable_languages(&self) -> Option<&'static [&'static str]> { - match self { - Builtin(b) => b.injectable_languages(), - Custom(c) => c.injectable_languages(), - } + injection::injectable_languages(*self) } fn extract_injections<D: Doc>(&self, root: Node<D>) -> HashMap<String, Vec<TSRange>> { - match self { - Builtin(b) => b.extract_injections(root), - Custom(c) => c.extract_injections(root), - } + injection::extract_injections(root) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/cli/src/new.rs new/ast-grep-0.25.3+0/crates/cli/src/new.rs --- old/ast-grep-0.25.2+0/crates/cli/src/new.rs 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/cli/src/new.rs 2024-07-23 07:38:52.000000000 +0200 @@ -212,8 +212,9 @@ rule_dirs: vec![rule_dirs], test_configs: test_dirs.map(|t| vec![t]), util_dirs: utils.map(|u| vec![u]), - custom_languages: None, // advanced feature, skip now - language_globs: None, // advanced feature, skip now + custom_languages: None, // advanced feature, skip now + language_globs: None, // advanced feature, skip now + language_injections: vec![], // advanced feature }; let config_path = arg.base_dir.join("sgconfig.yml"); let f = File::create(config_path)?; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/dynamic/src/lib.rs new/ast-grep-0.25.3+0/crates/dynamic/src/lib.rs --- old/ast-grep-0.25.2+0/crates/dynamic/src/lib.rs 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/dynamic/src/lib.rs 2024-07-23 07:38:52.000000000 +0200 @@ -16,7 +16,7 @@ type LangIndex = u32; /// Represents a tree-sitter language loaded as dynamic lib. -#[derive(Copy, Clone, PartialEq, Eq)] +#[derive(Copy, Clone, PartialEq, Eq, Hash)] pub struct DynamicLang { index: LangIndex, // inline expando char since it is used frequently diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/napi/npm/darwin-arm64/package.json new/ast-grep-0.25.3+0/crates/napi/npm/darwin-arm64/package.json --- old/ast-grep-0.25.2+0/crates/napi/npm/darwin-arm64/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/napi/npm/darwin-arm64/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-darwin-arm64", - "version": "0.25.2", + "version": "0.25.3", "os": [ "darwin" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/napi/npm/darwin-x64/package.json new/ast-grep-0.25.3+0/crates/napi/npm/darwin-x64/package.json --- old/ast-grep-0.25.2+0/crates/napi/npm/darwin-x64/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/napi/npm/darwin-x64/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-darwin-x64", - "version": "0.25.2", + "version": "0.25.3", "os": [ "darwin" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/napi/npm/linux-arm64-gnu/package.json new/ast-grep-0.25.3+0/crates/napi/npm/linux-arm64-gnu/package.json --- old/ast-grep-0.25.2+0/crates/napi/npm/linux-arm64-gnu/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/napi/npm/linux-arm64-gnu/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-linux-arm64-gnu", - "version": "0.25.2", + "version": "0.25.3", "os": [ "linux" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/napi/npm/linux-arm64-musl/package.json new/ast-grep-0.25.3+0/crates/napi/npm/linux-arm64-musl/package.json --- old/ast-grep-0.25.2+0/crates/napi/npm/linux-arm64-musl/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/napi/npm/linux-arm64-musl/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-linux-arm64-musl", - "version": "0.25.2", + "version": "0.25.3", "os": [ "linux" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/napi/npm/linux-x64-gnu/package.json new/ast-grep-0.25.3+0/crates/napi/npm/linux-x64-gnu/package.json --- old/ast-grep-0.25.2+0/crates/napi/npm/linux-x64-gnu/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/napi/npm/linux-x64-gnu/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-linux-x64-gnu", - "version": "0.25.2", + "version": "0.25.3", "os": [ "linux" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/napi/npm/linux-x64-musl/package.json new/ast-grep-0.25.3+0/crates/napi/npm/linux-x64-musl/package.json --- old/ast-grep-0.25.2+0/crates/napi/npm/linux-x64-musl/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/napi/npm/linux-x64-musl/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-linux-x64-musl", - "version": "0.25.2", + "version": "0.25.3", "os": [ "linux" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/napi/npm/win32-arm64-msvc/package.json new/ast-grep-0.25.3+0/crates/napi/npm/win32-arm64-msvc/package.json --- old/ast-grep-0.25.2+0/crates/napi/npm/win32-arm64-msvc/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/napi/npm/win32-arm64-msvc/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-win32-arm64-msvc", - "version": "0.25.2", + "version": "0.25.3", "os": [ "win32" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/napi/npm/win32-ia32-msvc/package.json new/ast-grep-0.25.3+0/crates/napi/npm/win32-ia32-msvc/package.json --- old/ast-grep-0.25.2+0/crates/napi/npm/win32-ia32-msvc/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/napi/npm/win32-ia32-msvc/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-win32-ia32-msvc", - "version": "0.25.2", + "version": "0.25.3", "os": [ "win32" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/napi/npm/win32-x64-msvc/package.json new/ast-grep-0.25.3+0/crates/napi/npm/win32-x64-msvc/package.json --- old/ast-grep-0.25.2+0/crates/napi/npm/win32-x64-msvc/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/napi/npm/win32-x64-msvc/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-win32-x64-msvc", - "version": "0.25.2", + "version": "0.25.3", "os": [ "win32" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/napi/package.json new/ast-grep-0.25.3+0/crates/napi/package.json --- old/ast-grep-0.25.2+0/crates/napi/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/napi/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi", - "version": "0.25.2", + "version": "0.25.3", "description": "Search and Rewrite code at large scale using precise AST pattern", "homepage": "https://ast-grep.github.io", "main": "index.js", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/crates/pyo3/pyproject.toml new/ast-grep-0.25.3+0/crates/pyo3/pyproject.toml --- old/ast-grep-0.25.2+0/crates/pyo3/pyproject.toml 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/crates/pyo3/pyproject.toml 2024-07-23 07:38:52.000000000 +0200 @@ -5,7 +5,7 @@ [project] name = "ast-grep-py" requires-python = ">=3.8" -version = "0.25.2" +version = "0.25.3" description = "Structural Search and Rewrite code at large scale using precise AST pattern." authors = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }] maintainers = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/npm/package.json new/ast-grep-0.25.3+0/npm/package.json --- old/ast-grep-0.25.2+0/npm/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/npm/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli", - "version": "0.25.2", + "version": "0.25.3", "publishConfig": { "access": "public" }, @@ -29,13 +29,13 @@ "postinstall": "node postinstall.js" }, "optionalDependencies": { - "@ast-grep/cli-win32-arm64-msvc": "0.25.2", - "@ast-grep/cli-win32-ia32-msvc": "0.25.2", - "@ast-grep/cli-win32-x64-msvc": "0.25.2", - "@ast-grep/cli-darwin-arm64": "0.25.2", - "@ast-grep/cli-darwin-x64": "0.25.2", - "@ast-grep/cli-linux-arm64-gnu": "0.25.2", - "@ast-grep/cli-linux-x64-gnu": "0.25.2" + "@ast-grep/cli-win32-arm64-msvc": "0.25.3", + "@ast-grep/cli-win32-ia32-msvc": "0.25.3", + "@ast-grep/cli-win32-x64-msvc": "0.25.3", + "@ast-grep/cli-darwin-arm64": "0.25.3", + "@ast-grep/cli-darwin-x64": "0.25.3", + "@ast-grep/cli-linux-arm64-gnu": "0.25.3", + "@ast-grep/cli-linux-x64-gnu": "0.25.3" }, "bin": { "sg": "sg", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/npm/platforms/darwin-arm64/package.json new/ast-grep-0.25.3+0/npm/platforms/darwin-arm64/package.json --- old/ast-grep-0.25.2+0/npm/platforms/darwin-arm64/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/npm/platforms/darwin-arm64/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-darwin-arm64", - "version": "0.25.2", + "version": "0.25.3", "os": [ "darwin" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/npm/platforms/darwin-x64/package.json new/ast-grep-0.25.3+0/npm/platforms/darwin-x64/package.json --- old/ast-grep-0.25.2+0/npm/platforms/darwin-x64/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/npm/platforms/darwin-x64/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-darwin-x64", - "version": "0.25.2", + "version": "0.25.3", "os": [ "darwin" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/npm/platforms/linux-arm64-gnu/package.json new/ast-grep-0.25.3+0/npm/platforms/linux-arm64-gnu/package.json --- old/ast-grep-0.25.2+0/npm/platforms/linux-arm64-gnu/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/npm/platforms/linux-arm64-gnu/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-linux-arm64-gnu", - "version": "0.25.2", + "version": "0.25.3", "os": [ "linux" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/npm/platforms/linux-x64-gnu/package.json new/ast-grep-0.25.3+0/npm/platforms/linux-x64-gnu/package.json --- old/ast-grep-0.25.2+0/npm/platforms/linux-x64-gnu/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/npm/platforms/linux-x64-gnu/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-linux-x64-gnu", - "version": "0.25.2", + "version": "0.25.3", "os": [ "linux" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/npm/platforms/win32-arm64-msvc/package.json new/ast-grep-0.25.3+0/npm/platforms/win32-arm64-msvc/package.json --- old/ast-grep-0.25.2+0/npm/platforms/win32-arm64-msvc/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/npm/platforms/win32-arm64-msvc/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-win32-arm64-msvc", - "version": "0.25.2", + "version": "0.25.3", "os": [ "win32" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/npm/platforms/win32-ia32-msvc/package.json new/ast-grep-0.25.3+0/npm/platforms/win32-ia32-msvc/package.json --- old/ast-grep-0.25.2+0/npm/platforms/win32-ia32-msvc/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/npm/platforms/win32-ia32-msvc/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-win32-ia32-msvc", - "version": "0.25.2", + "version": "0.25.3", "os": [ "win32" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/npm/platforms/win32-x64-msvc/package.json new/ast-grep-0.25.3+0/npm/platforms/win32-x64-msvc/package.json --- old/ast-grep-0.25.2+0/npm/platforms/win32-x64-msvc/package.json 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/npm/platforms/win32-x64-msvc/package.json 2024-07-23 07:38:52.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-win32-x64-msvc", - "version": "0.25.2", + "version": "0.25.3", "os": [ "win32" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/pyproject.toml new/ast-grep-0.25.3+0/pyproject.toml --- old/ast-grep-0.25.2+0/pyproject.toml 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/pyproject.toml 2024-07-23 07:38:52.000000000 +0200 @@ -4,7 +4,7 @@ [project] name = "ast-grep-cli" -version = "0.25.2" +version = "0.25.3" description = "Structural Search and Rewrite code at large scale using precise AST pattern." authors = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }] maintainers = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/rust-toolchain new/ast-grep-0.25.3+0/rust-toolchain --- old/ast-grep-0.25.2+0/rust-toolchain 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/rust-toolchain 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -stable diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/rust-toolchain.toml new/ast-grep-0.25.3+0/rust-toolchain.toml --- old/ast-grep-0.25.2+0/rust-toolchain.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/ast-grep-0.25.3+0/rust-toolchain.toml 2024-07-23 07:38:52.000000000 +0200 @@ -0,0 +1,3 @@ +[toolchain] +channel = "stable" +components = ["rustfmt", "clippy"] \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.2+0/xtask/src/main.rs new/ast-grep-0.25.3+0/xtask/src/main.rs --- old/ast-grep-0.25.2+0/xtask/src/main.rs 2024-07-19 07:06:05.000000000 +0200 +++ new/ast-grep-0.25.3+0/xtask/src/main.rs 2024-07-23 07:38:52.000000000 +0200 @@ -14,7 +14,7 @@ fn get_task() -> Result<Task> { let message = "argument is missing. Example usage: \ncargo xtask 0.1.3\ncargo xtask schema"; - let arg = args().skip(1).next().context(message)?; + let arg = args().nth(1).context(message)?; if arg == "schema" { Ok(Task::Schema) } else { @@ -32,9 +32,9 @@ fn release_new_version(version: &str) -> Result<()> { check_git_status()?; schema::generate_schema()?; - bump_version(&version)?; + bump_version(version)?; update_and_commit_changelog()?; - commit_and_tag(&version)?; + commit_and_tag(version)?; Ok(()) } @@ -45,7 +45,7 @@ .stdout(Stdio::piped()) .spawn()? .wait_with_output()?; - if git.stdout.len() > 0 { + if !git.stdout.is_empty() { bail!("The git working directory has uncommitted changes. Please commit or abandon them before release!") } else { Ok(()) @@ -53,10 +53,10 @@ } fn bump_version(version: &str) -> Result<()> { - update_npm(&version)?; - update_napi(&version)?; - update_python(&version)?; - update_crates(&version)?; + update_npm(version)?; + update_napi(version)?; + update_python(version)?; + update_crates(version)?; update_cargo_lock()?; Ok(()) } @@ -140,7 +140,7 @@ // update pypi pyproject.toml and pyo3 bindings for path in ["pyproject.toml", "crates/pyo3/pyproject.toml"] { let pyproject = Path::new(path); - let mut toml: DocumentMut = read_to_string(&pyproject)?.parse()?; + let mut toml: DocumentMut = read_to_string(pyproject)?.parse()?; toml["project"]["version"] = to_toml(version); fs::write(pyproject, toml.to_string())?; } ++++++ vendor.tar.zst ++++++ /work/SRC/openSUSE:Factory/ast-grep/vendor.tar.zst /work/SRC/openSUSE:Factory/.ast-grep.new.1869/vendor.tar.zst differ: char 408883, line 1633