Skip to content

Commit bf3b963

Browse files
committed
Merge remote-tracking branch 'oxc/main' into copilot/add-clear-loaded-plugin-function
2 parents b998634 + 8810bd5 commit bf3b963

File tree

416 files changed

+23224
-20394
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

416 files changed

+23224
-20394
lines changed

.git-blame-ignore-revs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ ad2835f11b28e28ecec635842c62b407d9149331
1515

1616
# chore(rust): run `cargo fmt --all -- crates/**/*.rs`
1717
217997bd7c5fec9edc6dabcb668ab664f9c31857
18+
19+
# chore(infra): dogfooding oxfmt (#14979)
20+
a8e5181ab73e3cee5904af3acc6c5927def9d500
21+
22+
# style(all): apply oxfmt default options (#16091)
23+
523a30a0164932029e977090d441041fff13c735

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Cargo.lock
88
pnpm-lock.yaml
99

1010
/apps/oxlint @camc314
11+
/apps/oxlint/src-js @camc314 @overlookmotel
1112

1213
/crates/oxc_allocator @overlookmotel
1314
/crates/oxc_data_structures @overlookmotel

.github/SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Security Policy
22

3-
## Supported Versions
3+
Please refer to https://oxc.rs/docs/contribute/security.html for our established security practices.
44

55
## Reporting a Vulnerability
66

7-
If you find any potential vulnerability, join our [discord channel](https://discord.gg/9uXCAwqQZW) and contact Boshen.
7+
If you discover a potential vulnerability, please join our [Discord channel](https://discord.gg/9uXCAwqQZW) and contact Boshen.

.github/generated/ast_changes_watch_list.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,6 @@ src:
5555
- 'napi/parser/src/generated/raw_transfer_constants.rs'
5656
- 'napi/parser/src/raw_transfer_types.rs'
5757
- 'npm/oxc-types/types.d.ts'
58+
- 'oxfmtrc.jsonc'
59+
- 'package.json'
5860
- 'tasks/ast_tools/src/**'

.github/scripts/check-conformance-changes.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
* Uses cargo tree to determine dependencies of oxc_coverage crate.
88
*/
99

10-
const { getChangedFiles } = require('./get-changed-files.js');
11-
const { getCrateDependencies } = require('./utils.js');
10+
const { getChangedFiles } = require("./get-changed-files.js");
11+
const { getCrateDependencies } = require("./utils.js");
1212

1313
/**
1414
* Get all crates that conformance tests depend on
1515
* @returns {string[]} Array of crate names
1616
*/
1717
function getCoverageDependencies() {
18-
const packages = ['oxc_coverage', 'oxc_transform_conformance', 'oxc_prettier_conformance'];
18+
const packages = ["oxc_coverage", "oxc_transform_conformance", "oxc_prettier_conformance"];
1919
const deps = getCrateDependencies(packages);
2020

2121
console.error(`Conformance dependencies (${deps.length}):`);
22-
console.error(` ${deps.join(', ')}`);
22+
console.error(` ${deps.join(", ")}`);
2323

2424
return deps;
2525
}
@@ -28,11 +28,11 @@ function getCoverageDependencies() {
2828
* Directories that should always trigger conformance tests
2929
*/
3030
const ALWAYS_RUN_PATHS = [
31-
'tasks/coverage/',
32-
'tasks/common/',
33-
'tasks/oxc_transform_conformance/',
34-
'tasks/oxc_prettier_conformance/',
35-
'pnpm-lock.yaml',
31+
"tasks/coverage/",
32+
"tasks/common/",
33+
"tasks/oxc_transform_conformance/",
34+
"tasks/oxc_prettier_conformance/",
35+
"pnpm-lock.yaml",
3636
];
3737

3838
/**
@@ -43,13 +43,13 @@ const ALWAYS_RUN_PATHS = [
4343
function shouldRunConformance(changedFiles) {
4444
// null means manual trigger or error - always run
4545
if (changedFiles === null) {
46-
console.error('No changed files list (manual trigger or error) - will run conformance');
46+
console.error("No changed files list (manual trigger or error) - will run conformance");
4747
return true;
4848
}
4949

5050
// No files changed - skip conformance
5151
if (changedFiles.length === 0) {
52-
console.error('No files changed - will skip conformance');
52+
console.error("No files changed - will skip conformance");
5353
return false;
5454
}
5555

@@ -67,7 +67,7 @@ function shouldRunConformance(changedFiles) {
6767
const dependencies = getCoverageDependencies();
6868

6969
if (dependencies.length === 0) {
70-
console.error('Warning: No dependencies found - will run conformance as fallback');
70+
console.error("Warning: No dependencies found - will run conformance as fallback");
7171
return true;
7272
}
7373

@@ -82,7 +82,7 @@ function shouldRunConformance(changedFiles) {
8282
}
8383
}
8484

85-
console.error('No files affect oxc_coverage dependencies - will skip conformance');
85+
console.error("No files affect oxc_coverage dependencies - will skip conformance");
8686
return false;
8787
}
8888

@@ -95,21 +95,23 @@ async function main() {
9595
const shouldRun = shouldRunConformance(changedFiles);
9696

9797
// Output for GitHub Actions
98-
console.log(shouldRun ? 'true' : 'false');
98+
console.log(shouldRun ? "true" : "false");
9999

100100
// Set GitHub Actions notice
101101
if (shouldRun) {
102-
console.error('::notice title=Conformance tests::Will run conformance tests');
102+
console.error("::notice title=Conformance tests::Will run conformance tests");
103103
} else {
104-
console.error('::notice title=Conformance tests::Will skip conformance tests');
104+
console.error("::notice title=Conformance tests::Will skip conformance tests");
105105
}
106106

107107
process.exit(0);
108108
} catch (error) {
109-
console.error('Error checking conformance changes:', error);
109+
console.error("Error checking conformance changes:", error);
110110
// On error, run conformance as a fallback
111-
console.log('true');
112-
console.error('::warning title=Conformance check error::Error occurred, running conformance as fallback');
111+
console.log("true");
112+
console.error(
113+
"::warning title=Conformance check error::Error occurred, running conformance as fallback",
114+
);
113115
process.exit(0);
114116
}
115117
}

.github/scripts/clone-parallel.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
set -euo pipefail
88

99
# Submodule commit SHAs - updated automatically by .github/workflows/update_submodules.yml
10-
TEST262_SHA="c125a8dc610bb0f03366d342dc2f1f41712f0caa"
11-
BABEL_SHA="c92c4919771105140015167f25f7bacac77c90d9"
12-
TYPESCRIPT_SHA="cc2610fd347127c28609b4fca6fa9d55ee5063c6"
13-
PRETTIER_SHA="d7fe2da97d575310059d2fc2f8d5de21240b65df"
14-
ACORN_TEST262_SHA="fd0b12cb7c3d427b06304481c86340083358078d"
10+
TEST262_SHA="26058a01fdbc8dad9ded0e97133190098ea8c5d8"
11+
BABEL_SHA="99dcba5e71de3bd81ce14077cfa5b6df58e9b177"
12+
TYPESCRIPT_SHA="669c25c091ad4d32298d0f33b0e4e681d46de3ea"
13+
PRETTIER_SHA="864bb7c042d9935344c155ad9292de3213e0085b"
14+
ACORN_TEST262_SHA="21042b087dead16393c4f1d60ec9042d67da6368"
1515
NODE_COMPAT_TABLE_SHA="499beb6f1daa36f10c26b85a7f3ec3b3448ded23"
1616

1717
# Default values for which submodules to clone

.github/scripts/generate-benchmark-matrix.js

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,28 @@
77
* This script determines which benchmark components need to run based on changed files.
88
*/
99

10-
const process = require('process');
11-
const { getChangedFiles } = require('./get-changed-files.js');
12-
const { getCrateDependencies } = require('./utils.js');
10+
const process = require("process");
11+
const { getChangedFiles } = require("./get-changed-files.js");
12+
const { getCrateDependencies } = require("./utils.js");
1313

1414
// All available benchmark components
15-
const ALL_COMPONENTS = ['lexer', 'parser', 'transformer', 'semantic', 'minifier', 'codegen', 'formatter', 'linter'];
15+
const ALL_COMPONENTS = [
16+
"lexer",
17+
"parser",
18+
"transformer",
19+
"semantic",
20+
"minifier",
21+
"codegen",
22+
"formatter",
23+
"linter",
24+
];
1625

1726
// Files that when changed affect all benchmarks
1827
const GLOBAL_FILES = [
19-
'Cargo.lock',
20-
'rust-toolchain.toml',
21-
'.github/workflows/benchmark.yml',
22-
'.github/scripts/generate-benchmark-matrix.js',
28+
"Cargo.lock",
29+
"rust-toolchain.toml",
30+
".github/workflows/benchmark.yml",
31+
".github/scripts/generate-benchmark-matrix.js",
2332
];
2433

2534
/**
@@ -48,10 +57,10 @@ function checkGlobalChanges(changedFiles) {
4857
* @returns {string} Feature name
4958
*/
5059
function getFeatureForComponent(component) {
51-
if (component === 'linter') {
52-
return 'linter';
60+
if (component === "linter") {
61+
return "linter";
5362
}
54-
return 'compiler';
63+
return "compiler";
5564
}
5665

5766
/**
@@ -61,7 +70,7 @@ function getFeatureForComponent(component) {
6170
*/
6271
function getComponentDependencies(component) {
6372
const feature = getFeatureForComponent(component);
64-
const deps = getCrateDependencies('oxc_benchmark', {
73+
const deps = getCrateDependencies("oxc_benchmark", {
6574
features: feature,
6675
noDefaultFeatures: true,
6776
});
@@ -86,7 +95,7 @@ function isComponentAffected(component, changedFiles) {
8695

8796
// Get component dependencies
8897
const dependencies = getComponentDependencies(component);
89-
console.error(`Component ${component} dependencies: ${dependencies.join(', ')}`);
98+
console.error(`Component ${component} dependencies: ${dependencies.join(", ")}`);
9099

91100
// Check if any dependency files changed
92101
for (const dep of dependencies) {
@@ -98,7 +107,11 @@ function isComponentAffected(component, changedFiles) {
98107
}
99108

100109
// Check benchmark and common task files
101-
if (changedFiles.some((file) => file.startsWith('tasks/benchmark/') || file.startsWith('tasks/common/'))) {
110+
if (
111+
changedFiles.some(
112+
(file) => file.startsWith("tasks/benchmark/") || file.startsWith("tasks/common/"),
113+
)
114+
) {
102115
console.error(` Component ${component} affected by benchmark/common file changes`);
103116
return true;
104117
}
@@ -123,7 +136,7 @@ async function determineAffectedComponents() {
123136

124137
// Check for global changes
125138
if (checkGlobalChanges(changedFiles)) {
126-
console.error('Global changes detected - will run all benchmarks');
139+
console.error("Global changes detected - will run all benchmarks");
127140
return ALL_COMPONENTS.map((component) => ({
128141
component,
129142
feature: getFeatureForComponent(component),
@@ -144,9 +157,11 @@ async function determineAffectedComponents() {
144157
}
145158

146159
if (affectedComponents.length === 0) {
147-
console.error('\nNo components were affected by the changes');
160+
console.error("\nNo components were affected by the changes");
148161
} else {
149-
console.error(`\nAffected components: ${affectedComponents.map((obj) => obj.component).join(', ')}`);
162+
console.error(
163+
`\nAffected components: ${affectedComponents.map((obj) => obj.component).join(", ")}`,
164+
);
150165
}
151166

152167
return affectedComponents;
@@ -165,15 +180,17 @@ async function main() {
165180

166181
// Set GitHub Actions notice
167182
if (affectedComponents.length === 0) {
168-
console.error('::notice title=No benchmarks to run::No components were affected by the changes');
183+
console.error(
184+
"::notice title=No benchmarks to run::No components were affected by the changes",
185+
);
169186
} else {
170-
const componentNames = affectedComponents.map((obj) => obj.component).join(', ');
187+
const componentNames = affectedComponents.map((obj) => obj.component).join(", ");
171188
console.error(`::notice title=Running benchmarks::Affected components: ${componentNames}`);
172189
}
173190

174191
process.exit(0);
175192
} catch (error) {
176-
console.error('Error generating benchmark matrix:', error);
193+
console.error("Error generating benchmark matrix:", error);
177194
// On error, run all benchmarks as a fallback
178195
const fallbackMatrix = ALL_COMPONENTS.map((component) => ({
179196
component,

.github/scripts/get-changed-files.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* This module provides a reusable function for detecting changed files.
88
*/
99

10-
const https = require('https');
11-
const process = require('process');
10+
const https = require("https");
11+
const process = require("process");
1212

1313
/**
1414
* Make a GitHub API request
@@ -18,33 +18,33 @@ const process = require('process');
1818
function githubApi(path) {
1919
return new Promise((resolve, reject) => {
2020
const options = {
21-
hostname: 'api.github.com',
21+
hostname: "api.github.com",
2222
path,
2323
headers: {
24-
'User-Agent': 'oxc-changed-files',
25-
Accept: 'application/vnd.github.v3+json',
24+
"User-Agent": "oxc-changed-files",
25+
Accept: "application/vnd.github.v3+json",
2626
},
2727
};
2828

2929
// Add authorization if token is available
3030
const token = process.env.GITHUB_TOKEN;
3131
if (token) {
32-
options.headers['Authorization'] = `token ${token}`;
32+
options.headers["Authorization"] = `token ${token}`;
3333
}
3434

3535
https
3636
.get(options, (res) => {
37-
let data = '';
38-
res.on('data', (chunk) => (data += chunk));
39-
res.on('end', () => {
37+
let data = "";
38+
res.on("data", (chunk) => (data += chunk));
39+
res.on("end", () => {
4040
if (res.statusCode === 200) {
4141
resolve(JSON.parse(data));
4242
} else {
4343
reject(new Error(`GitHub API error: ${res.statusCode} ${data}`));
4444
}
4545
});
4646
})
47-
.on('error', reject);
47+
.on("error", reject);
4848
});
4949
}
5050

@@ -64,15 +64,15 @@ async function getChangedFiles() {
6464
console.error(`SHA: ${sha}`);
6565
console.error(`Ref: ${ref}`);
6666

67-
if (eventName === 'workflow_dispatch') {
68-
console.error('Manual trigger - returning null (run all)');
67+
if (eventName === "workflow_dispatch") {
68+
console.error("Manual trigger - returning null (run all)");
6969
return null; // Signal to run all
7070
}
7171

7272
let files = [];
7373

7474
try {
75-
if (eventName === 'pull_request' && prNumber) {
75+
if (eventName === "pull_request" && prNumber) {
7676
// For PR, use GitHub API to get changed files
7777
console.error(`Getting changed files for PR #${prNumber}`);
7878
const prFiles = await githubApi(`/repos/${repository}/pulls/${prNumber}/files?per_page=100`);
@@ -84,13 +84,13 @@ async function getChangedFiles() {
8484
files = commit.files ? commit.files.map((f) => f.filename) : [];
8585
} else {
8686
// No valid parameters for API calls
87-
console.error('Error: Missing required environment variables for GitHub API');
88-
console.error('Returning null (run all) as fallback');
87+
console.error("Error: Missing required environment variables for GitHub API");
88+
console.error("Returning null (run all) as fallback");
8989
return null; // Signal to run all
9090
}
9191
} catch (error) {
9292
console.error(`Error getting changed files via API: ${error.message}`);
93-
console.error('Returning null (run all) as fallback');
93+
console.error("Returning null (run all) as fallback");
9494
return null; // Signal to run all
9595
}
9696

@@ -110,7 +110,7 @@ if (require.main === module) {
110110
process.exit(0);
111111
})
112112
.catch((error) => {
113-
console.error('Error:', error);
113+
console.error("Error:", error);
114114
console.log(JSON.stringify(null));
115115
process.exit(1);
116116
});

0 commit comments

Comments
 (0)