Skip to content

Commit 0918d44

Browse files
authored
Merge branch 'main' into 09-17-perf_oxfmt_walk_and_format_at_the_same_time
2 parents 15f8f40 + 2cead8b commit 0918d44

File tree

18 files changed

+274
-230
lines changed

18 files changed

+274
-230
lines changed

apps/oxlint/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "oxlint",
3-
"version": "0.1.0",
3+
"version": "1.16.0",
44
"bin": "dist/cli.js",
55
"type": "module",
66
"scripts": {

apps/oxlint/src-js/bindings.js

Lines changed: 50 additions & 50 deletions
Large diffs are not rendered by default.

crates/oxc_allocator/src/pool/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ impl AllocatorPool {
5555

5656
#[cfg(not(all(target_pointer_width = "64", target_endian = "little")))]
5757
{
58+
let _thread_count = thread_count; // Avoid unused vars lint warning
5859
panic!("Fixed size allocators are only supported on 64-bit little-endian platforms");
5960
}
6061
}

crates/oxc_formatter/examples/formatter.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@ fn main() -> Result<(), String> {
3434
// Parse the source code
3535
let ret = Parser::new(&allocator, &source_text, source_type)
3636
.with_options(ParseOptions {
37-
preserve_parens: false,
37+
parse_regular_expression: false,
38+
// Enable all syntax features
3839
allow_v8_intrinsics: true,
39-
..ParseOptions::default()
40+
allow_return_outside_function: true,
41+
// `oxc_formatter` expects this to be false
42+
preserve_parens: false,
4043
})
4144
.parse();
4245

napi/minify/index.js

Lines changed: 50 additions & 50 deletions
Large diffs are not rendered by default.

napi/parser/bindings.mjs

Lines changed: 50 additions & 50 deletions
Large diffs are not rendered by default.

napi/parser/example.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'node:fs';
22
import path from 'node:path';
33
import { parseArgs } from 'node:util';
4-
import { parseSync } from './index.js';
4+
import { parseSync } from './index.mjs';
55

66
// usage:
77
// node napi/parser/example.mjs test.ts

napi/parser/wrap.mjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Note: This code is repeated in `wrap.cjs`.
2-
// Any changes should be applied in that file too.
3-
41
export function wrap(result) {
52
let program, module, comments, errors;
63
return {

napi/transform/index.js

Lines changed: 50 additions & 50 deletions
Large diffs are not rendered by default.

tasks/ast_tools/src/codegen.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
use std::{
2+
env,
3+
path::{Path, PathBuf},
4+
};
5+
16
use rustc_hash::FxHashMap;
27

38
use crate::{
@@ -13,6 +18,8 @@ pub type GeneratorId = usize;
1318
/// [`Schema`] is the source of truth on types, and which generators and derives act upon.
1419
/// [`Codegen`] is the engine which runs the generators and derives.
1520
pub struct Codegen {
21+
/// Path to root of repo.
22+
root_path: PathBuf,
1623
/// Mapping from derive name to `DeriveId`
1724
derive_name_to_id: FxHashMap<&'static str, DeriveId>,
1825
/// Mapping from attribute name to ID of derive/generator which uses the attr,
@@ -23,6 +30,13 @@ pub struct Codegen {
2330
impl Codegen {
2431
/// Create new [`Codegen`].
2532
pub fn new() -> Self {
33+
// Get path to root of repo.
34+
// Use `CARGO_MANIFEST_DIR` instead of `env::current_dir` because want to be able to run this from any directory.
35+
// `CARGO_MANIFEST_DIR` is the path to `tasks/ast_tools`, so pop 2 path segments to get root of repo.
36+
let mut root_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
37+
root_path.pop();
38+
root_path.pop();
39+
2640
let mut derive_name_to_id = FxHashMap::default();
2741

2842
let mut attr_processors = FxHashMap::default();
@@ -58,7 +72,12 @@ impl Codegen {
5872
}
5973
}
6074

61-
Self { derive_name_to_id, attr_processors }
75+
Self { root_path, derive_name_to_id, attr_processors }
76+
}
77+
78+
/// Get path to root of repo.
79+
pub fn root_path(&self) -> &Path {
80+
&self.root_path
6281
}
6382

6483
/// Get a [`Derive`] by its name.

0 commit comments

Comments
 (0)