Merge pull request #451 from github/releases

New releases
This commit is contained in:
Hendrik van Antwerpen 2024-07-10 16:54:18 +02:00 коммит произвёл GitHub
Родитель 20a255447e a68b92dde2
Коммит d7665d18b7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
33 изменённых файлов: 109 добавлений и 158 удалений

Просмотреть файл

@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.4.0 -- 2024-07-09
### Added
- Add rules for the `condition` node that was missing.
### Removed
- The `FILE_PATH_VAR` constant has been replaced in favor of `tree_sitter_stack_graphs::FILE_PATH_VAR`.
## v0.3.0 -- 2024-03-06
The `tree-sitter-stack-graphs` is updated to `v0.8`.

Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "tree-sitter-stack-graphs-java"
version = "0.3.0"
version = "0.4.0"
description = "Stack graphs for the Java programming language"
homepage = "https://github.com/github/stack-graphs/tree/main/languages/tree-sitter-stack-graphs-java"
@ -41,8 +41,8 @@ cli = ["anyhow", "clap", "tree-sitter-stack-graphs/cli"]
anyhow = { version = "1.0", optional = true }
clap = { version = "4", features = ["derive"], optional = true }
tree-sitter-java = { version = "=0.20.2" }
tree-sitter-stack-graphs = { version = "0.8", path = "../../tree-sitter-stack-graphs" }
tree-sitter-stack-graphs = { path = "../../tree-sitter-stack-graphs" }
[dev-dependencies]
anyhow = { version = "1.0" }
tree-sitter-stack-graphs = { version = "0.8", path = "../../tree-sitter-stack-graphs", features = ["cli"] }
tree-sitter-stack-graphs = { path = "../../tree-sitter-stack-graphs", features = ["cli"] }

Просмотреть файл

@ -13,7 +13,7 @@ To use this library, add the following to your `Cargo.toml`:
```toml
[dependencies]
tree-sitter-stack-graphs-java = "0.3"
tree-sitter-stack-graphs-java = "0.4"
```
Check out our [documentation](https://docs.rs/tree-sitter-stack-graphs-java/*/) for more details on how to use this library.

Просмотреть файл

@ -14,8 +14,6 @@ pub const STACK_GRAPHS_BUILTINS_PATH: &str = "src/builtins.java";
/// The stack graphs builtins source for this language.
pub const STACK_GRAPHS_BUILTINS_SOURCE: &str = include_str!("../src/builtins.java");
/// The name of the file path global variable
pub const FILE_PATH_VAR: &str = "FILE_PATH";
/// The name of the project name global variable
pub const PROJECT_NAME_VAR: &str = "PROJECT_NAME";

Просмотреть файл

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.2.0 -- 2024-07-09
### Removed
- The `FILE_PATH_VAR` constant has been replaced in favor of `tree_sitter_stack_graphs::FILE_PATH_VAR`.
## v0.1.0 -- 2024-03-06
Initial release.

Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "tree-sitter-stack-graphs-javascript"
version = "0.1.0"
version = "0.2.0"
description = "Stack graphs definition for JavaScript using tree-sitter-javascript"
readme = "README.md"
keywords = ["tree-sitter", "stack-graphs", "javascript"]
@ -30,11 +30,11 @@ anyhow = { version = "1.0", optional = true }
clap = { version = "4", optional = true }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
stack-graphs = { version = "0.13", path = "../../stack-graphs" }
stack-graphs = { path = "../../stack-graphs" }
tree-sitter-graph = "0.11.2"
tree-sitter-javascript = "=0.20.4"
tree-sitter-stack-graphs = { version = "0.8", path = "../../tree-sitter-stack-graphs" }
tree-sitter-stack-graphs = { path = "../../tree-sitter-stack-graphs" }
[dev-dependencies]
anyhow = "1.0"
tree-sitter-stack-graphs = { version = "0.8", path = "../../tree-sitter-stack-graphs", features = ["cli"] }
tree-sitter-stack-graphs = { path = "../../tree-sitter-stack-graphs", features = ["cli"] }

Просмотреть файл

@ -13,7 +13,7 @@ To use this library, add the following to your `Cargo.toml`:
```toml
[dependencies]
tree-sitter-stack-graphs-javascript = "0.1"
tree-sitter-stack-graphs-javascript = "0.2"
```
Check out our [documentation](https://docs.rs/tree-sitter-stack-graphs-javascript/*/) for more details on how to use this library.

Просмотреть файл

@ -26,8 +26,7 @@ pub const STACK_GRAPHS_BUILTINS_PATH: &str = "src/builtins.js";
/// The stack graphs builtins source for this language.
pub const STACK_GRAPHS_BUILTINS_SOURCE: &str = include_str!("../src/builtins.js");
/// The name of the file path global variable.
pub const FILE_PATH_VAR: &str = "FILE_PATH";
/// The name of the project name global variable
pub const PROJECT_NAME_VAR: &str = "PROJECT_NAME";
pub fn language_configuration(cancellation_flag: &dyn CancellationFlag) -> LanguageConfiguration {

Просмотреть файл

@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.2.0 -- 2024-07-09
### Added
- Added support for root paths. This fixes import problems when indexing using absolute directory paths.
### Fixed
- Fixed crash for lambdas with parameters.
- Fixed crash for nested functions definitions.
### Removed
- The `FILE_PATH_VAR` constant has been replaced in favor of `tree_sitter_stack_graphs::FILE_PATH_VAR`.
## v0.1.0 -- 2024-03-06
Initial release.

Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "tree-sitter-stack-graphs-python"
version = "0.1.0"
version = "0.2.0"
description = "Stack graphs definition for Python using tree-sitter-python"
readme = "README.md"
keywords = ["tree-sitter", "stack-graphs", "python"]
@ -30,9 +30,9 @@ cli = ["anyhow", "clap", "tree-sitter-stack-graphs/cli"]
[dependencies]
anyhow = { version = "1.0", optional = true }
clap = { version = "4", optional = true, features = ["derive"] }
tree-sitter-stack-graphs = { version = "0.8", path = "../../tree-sitter-stack-graphs" }
tree-sitter-stack-graphs = { path = "../../tree-sitter-stack-graphs" }
tree-sitter-python = "=0.20.4"
[dev-dependencies]
anyhow = "1.0"
tree-sitter-stack-graphs = { version = "0.8", path = "../../tree-sitter-stack-graphs", features = ["cli"] }
tree-sitter-stack-graphs = { path = "../../tree-sitter-stack-graphs", features = ["cli"] }

Просмотреть файл

Просмотреть файл

@ -13,7 +13,7 @@ To use this library, add the following to your `Cargo.toml`:
```toml
[dependencies]
tree-sitter-stack-graphs-python = "0.1"
tree-sitter-stack-graphs-python = "0.2"
```
Check out our [documentation](https://docs.rs/tree-sitter-stack-graphs-python/*/) for more details on how to use this library.

Просмотреть файл

@ -21,9 +21,6 @@ pub const STACK_GRAPHS_BUILTINS_PATH: &str = "src/builtins.py";
/// The stack graphs builtins source for this language.
pub const STACK_GRAPHS_BUILTINS_SOURCE: &str = include_str!("../src/builtins.py");
/// The name of the file path global variable.
pub const FILE_PATH_VAR: &str = "FILE_PATH";
pub fn language_configuration(cancellation_flag: &dyn CancellationFlag) -> LanguageConfiguration {
try_language_configuration(cancellation_flag).unwrap_or_else(|err| panic!("{}", err))
}

Просмотреть файл

@ -5,11 +5,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.3.0 -- unreleased
## v0.3.0 -- 2024-07-09
### Added
- Support for TSX. A new language configuration for TSX is available, and TSX is enabled in the CLI next to TypeScript.
- Support for TSX. A new language configuration for TSX is available with `{try_,}language_configuration_tsx`. TSX is enabled in the CLI next to TypeScript.
### Fixed
- Imports are more robust to the presence of file extensions in the import name.
### Changed
- The functions `{try_,}language_configuration` have been renamed to `{try_,}language_configuration_typescript`.
### Removed
- The `FILE_PATH_VAR` constant has been replaced in favor of `tree_sitter_stack_graphs::FILE_PATH_VAR`.
## v0.2.0 -- 2024-03-06

Просмотреть файл

@ -32,14 +32,14 @@ clap = { version = "4", optional = true }
glob = "0.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
stack-graphs = { version = "0.13", path = "../../stack-graphs" }
tree-sitter-stack-graphs = { version = "0.8", path = "../../tree-sitter-stack-graphs" }
stack-graphs = { path = "../../stack-graphs" }
tree-sitter-stack-graphs = { path = "../../tree-sitter-stack-graphs" }
tree-sitter-typescript = "=0.20.2"
tsconfig = "0.1.0"
[dev-dependencies]
anyhow = { version = "1.0" }
tree-sitter-stack-graphs = { version = "0.8", path = "../../tree-sitter-stack-graphs", features = ["cli"] }
tree-sitter-stack-graphs = { path = "../../tree-sitter-stack-graphs", features = ["cli"] }
[build-dependencies]
anyhow = { version = "1.0" }

Просмотреть файл

@ -13,7 +13,7 @@ To use this library, add the following to your `Cargo.toml`:
```toml
[dependencies]
tree-sitter-stack-graphs-typescript = "0.2"
tree-sitter-stack-graphs-typescript = "0.3"
```
Check out our [documentation](https://docs.rs/tree-sitter-stack-graphs-typescript/*/) for more details on how to use this library.

Просмотреть файл

@ -31,8 +31,6 @@ pub const STACK_GRAPHS_BUILTINS_PATH: &str = "src/builtins.ts";
/// The stack graphs builtins source for this language
pub const STACK_GRAPHS_BUILTINS_SOURCE: &str = include_str!("../src/builtins.ts");
/// The name of the file path global variable
pub const FILE_PATH_VAR: &str = "FILE_PATH";
/// The name of the project name global variable
pub const PROJECT_NAME_VAR: &str = "PROJECT_NAME";

Просмотреть файл

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.14.0 -- 2024-07-09
### Changed
- The method `StackGraph::add_from_graph` returns the handles of the newly added files.
## v0.13.0 -- 2024-03-06
### Added

Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "stack-graphs"
version = "0.13.0"
version = "0.14.0"
description = "Name binding for arbitrary programming languages"
homepage = "https://github.com/github/stack-graphs/tree/main/stack-graphs"
repository = "https://github.com/github/stack-graphs/"

Просмотреть файл

@ -9,7 +9,7 @@ To use this library, add the following to your `Cargo.toml`:
``` toml
[dependencies]
stack-graphs = "0.13"
stack-graphs = "0.14"
```
Check out our [documentation](https://docs.rs/stack-graphs/) for more details on

Просмотреть файл

@ -5,18 +5,29 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.8.2 -- unreleased
## v0.9.0 -- 2024-07-09
### Library
- New crate-level constants `FILE_PATH_VAR` and `ROOT_PATH_VAR` standardize the TSG global variable names to use for the file and root path.
- The file path variable will only use the filename set in the stack graph if no value was explicitly set.
### CLI
#### Added
- Tests run faster for languages with builtins sources by caching the partial paths for the builtins.
- Indexing will set a value for the root path variable that is passed to TSG. The value is based on the directory that was provided on the command line.
#### Changed
- Failure to index a file will not abort indexing anymore, but simply mark the file as failed, as we already do for files with parse errors.
#### Removed
- The NPM distribution has been removed.
## v0.8.1 -- 2024-03-06
The `stack-graphs` dependency was updated to `v0.13` to fix the build problems of the `v0.8.0` release.

Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "tree-sitter-stack-graphs"
version = "0.8.2"
version = "0.9.0"
description = "Create stack graphs using tree-sitter parsers"
homepage = "https://github.com/github/stack-graphs/tree/main/tree-sitter-stack-graphs"
repository = "https://github.com/github/stack-graphs/"
@ -69,7 +69,7 @@ regex = "1"
rust-ini = "0.18"
serde_json = { version="1.0", optional=true }
sha1 = { version="0.10", optional=true }
stack-graphs = { version="0.13", path="../stack-graphs" }
stack-graphs = { path="../stack-graphs" }
thiserror = "1.0"
time = { version = "0.3", optional = true }
tokio = { version = "1.26", optional = true, features = ["io-std", "rt", "rt-multi-thread"] }

Просмотреть файл

@ -14,7 +14,7 @@ To use this library, add the following to your `Cargo.toml`:
```toml
[dependencies]
tree-sitter-stack-graphs = "0.8"
tree-sitter-stack-graphs = "0.9"
```
Check out our [documentation](https://docs.rs/tree-sitter-stack-graphs/*/) for more details on how to use this library.

4
tree-sitter-stack-graphs/npm/.gitignore поставляемый
Просмотреть файл

@ -1,4 +0,0 @@
/.crates.toml
/.crates2.json
/bin/
/package-lock.json

Просмотреть файл

@ -1,13 +0,0 @@
# tree-sitter-stack-graphs
This package provides a convenient way to install the [tree-sitter-stack-graphs](https://crates.io/crates/tree-sitter-stack-graphs) CLI in an NPM project.
Add it as a dev dependency to an existing project using:
npm i -D tree-sitter-stack-graphs
It is also possible to invoke it directly using:
npx tree-sitter-stack-graphs
See the tree-sitter-stack-graphs [documentation](https://crates.io/crates/tree-sitter-stack-graphs) for details on usage.

Просмотреть файл

@ -1,15 +0,0 @@
#!/usr/bin/env node
const spawn = require("child_process").spawn;
const path = require("path");
const tssg = process.platform === "win32"
? "tree-sitter-stack-graphs.exe"
: "tree-sitter-stack-graphs";
spawn(
path.join(__dirname, "bin", tssg), process.argv.slice(2),
{
"stdio": "inherit"
},
).on('close', process.exit);

Просмотреть файл

@ -1,30 +0,0 @@
#!/usr/bin/env node
const child_process = require("child_process");
const packageJSON = require("./package.json");
const cargo = process.platform === "win32"
? "cargo.exe"
: "cargo";
try {
child_process.execSync(cargo);
} catch (error) {
console.error(error.message);
console.error("Failed to execute Cargo. Cargo needs to be available to install this package!");
process.exit(1);
}
child_process.spawn(
cargo, [
"install",
"--quiet",
"--root", ".",
"--version", "^"+packageJSON.version,
"--features", "cli",
packageJSON.name,
],
{
"stdio": "inherit"
},
).on('close', process.exit);

Просмотреть файл

@ -1,26 +0,0 @@
{
"name": "tree-sitter-stack-graphs",
"version": "0.7.0",
"description": "Create stack graphs using tree-sitter parsers",
"homepage": "https://github.com/github/stack-graphs/tree/main/tree-sitter-stack-graphs",
"repository": {
"type": "git",
"url": "https://github.com/github/stack-graphs.git"
},
"keywords": [
"tree-sitter",
"stack-graphs"
],
"license": "MIT OR Apache-2.0",
"author": "GitHub <opensource+stack-graphs@github.com>",
"contributors": [
"Douglas Creager <dcreager@dcreager.net>",
"Hendrik van Antwerpen <hendrikvanantwerpen@github.com>"
],
"bin": {
"tree-sitter-stack-graphs": "./cli.js"
},
"scripts": {
"install": "node install.js"
}
}

Просмотреть файл

@ -770,9 +770,6 @@ impl ProjectSettings<'_> {
/// The stack graphs builtins source for this language.
pub const STACK_GRAPHS_BUILTINS_SOURCE: &str = include_str!("../src/builtins.{}");
/// The name of the file path global variable.
pub const FILE_PATH_VAR: &str = "FILE_PATH";
pub fn language_configuration(cancellation_flag: &dyn CancellationFlag) -> LanguageConfiguration {{
try_language_configuration(cancellation_flag).unwrap_or_else(|err| panic!("{{}}", err))
}}

Просмотреть файл

@ -320,14 +320,12 @@ impl TestArgs {
test_fragment.add_globals_to(&mut globals);
if globals.get(&FILE_PATH_VAR.into()).is_none() {
globals
.add(
FILE_PATH_VAR.into(),
test_fragment.path.to_str().unwrap().into(),
)
.expect("failed to add file path variable");
}
globals
.add(
FILE_PATH_VAR.into(),
test_fragment.path.to_str().unwrap().into(),
)
.unwrap_or_default();
lc.sgl.build_stack_graph_into(
&mut test.graph,

Просмотреть файл

@ -440,7 +440,7 @@ pub const ROOT_NODE_VAR: &'static str = "ROOT_NODE";
/// Name of the variable used to pass the jump-to-scope node.
pub const JUMP_TO_SCOPE_NODE_VAR: &'static str = "JUMP_TO_SCOPE_NODE";
/// Name of the variable used to pass the file path.
/// If a root path is given, it should be a descendant the root path.
/// If a root path is given, it should be a descendant of the root path.
pub const FILE_PATH_VAR: &'static str = "FILE_PATH";
/// Name of the variable used to pass the root path.
/// If given, should be an ancestor of the file path.
@ -643,12 +643,10 @@ impl<'a> Builder<'a> {
let mut globals = Variables::nested(globals);
if globals.get(&ROOT_NODE_VAR.into()).is_none() {
let root_node = self.inject_node(NodeID::root());
globals
.add(ROOT_NODE_VAR.into(), root_node.into())
.expect("Failed to set ROOT_NODE");
}
let root_node = self.inject_node(NodeID::root());
globals
.add(ROOT_NODE_VAR.into(), root_node.into())
.unwrap_or_default();
let jump_to_scope_node = self.inject_node(NodeID::jump_to());
globals

Просмотреть файл

@ -83,11 +83,9 @@ impl LanguageConfiguration {
Loader::load_globals_from_config_str(builtins_config, &mut builtins_globals)?;
}
if builtins_globals.get(&FILE_PATH_VAR.into()).is_none() {
builtins_globals
.add(FILE_PATH_VAR.into(), BUILTINS_FILENAME.into())
.expect("failed to add file path variable");
}
builtins_globals
.add(FILE_PATH_VAR.into(), BUILTINS_FILENAME.into())
.unwrap_or_default();
let file = builtins.add_file(BUILTINS_FILENAME).unwrap();
sgl.build_stack_graph_into(
@ -342,11 +340,9 @@ impl Loader {
Self::load_globals_from_config_str(&config, &mut globals)?;
if globals.get(&FILE_PATH_VAR.into()).is_none() {
globals
.add(FILE_PATH_VAR.into(), BUILTINS_FILENAME.into())
.expect("failed to add file path variable");
}
globals
.add(FILE_PATH_VAR.into(), BUILTINS_FILENAME.into())
.unwrap_or_default();
sgl.build_stack_graph_into(graph, file, &source, &globals, cancellation_flag)
.map_err(|err| LoadError::Builtins {

Просмотреть файл

@ -102,14 +102,12 @@ fn check_test(
fragments.add_globals_to(&mut globals);
if globals.get(&FILE_PATH_VAR.into()).is_none() {
globals
.add(
FILE_PATH_VAR.into(),
fragments.path.to_str().unwrap().into(),
)
.expect("failed to add file path variable");
}
globals
.add(
FILE_PATH_VAR.into(),
fragments.path.to_str().unwrap().into(),
)
.unwrap_or_default();
build_stack_graph_into(
&mut test.graph,