Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: recursive readdirSync for NodeJS < 20.1.0 #5645

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions ace-modes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,34 @@ declare module "ace-code/src/mode/behaviour" {
export const Behaviour: new () => import(".").Ace.Behaviour;
}

declare module "ace-code/src/mode/behaviour/css" {
export const CssBehaviour: new () => import(".").Ace.Behaviour;
}

declare module "ace-code/src/mode/behaviour/cstyle" {
export const CstyleBehaviour: new () => import(".").Ace.Behaviour;
}

declare module "ace-code/src/mode/behaviour/html" {
export const HtmlBehaviour: new () => import(".").Ace.Behaviour;
}

declare module "ace-code/src/mode/behaviour/javascript" {
export const JavaScriptBehaviour: new () => import(".").Ace.Behaviour;
}

declare module "ace-code/src/mode/behaviour/liquid" {
export const LiquidBehaviour: new () => import(".").Ace.Behaviour;
}

declare module "ace-code/src/mode/behaviour/xml" {
export const XmlBehaviour: new () => import(".").Ace.Behaviour;
}

declare module "ace-code/src/mode/behaviour/xquery" {
export const XQueryBehaviour: new () => import(".").Ace.Behaviour;
}

declare module "ace-code/src/mode/bibtex_highlight_rules" {
export const BibTeXHighlightRules: new () => import(".").Ace.HighlightRules;
}
Expand Down Expand Up @@ -392,6 +420,110 @@ declare module "ace-code/src/mode/flix" {
export const Mode: new () => import(".").Ace.SyntaxMode;
}

declare module "ace-code/src/mode/folding/asciidoc" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/c9search" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/coffee" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/csharp" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/cstyle" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/diff" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/drools" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/fold_mode" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/haskell_cabal" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/html" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/ini" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/java" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/javascript" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/latex" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/lua" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/markdown" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/mixed" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/php" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/pythonic" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/ruby" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/sql" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/sqlserver" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/vbscript" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/velocity" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/xml" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/folding/yaml" {
export const FoldMode: new () => import(".").Ace.Folding;
}

declare module "ace-code/src/mode/forth_highlight_rules" {
export const ForthHighlightRules: new () => import(".").Ace.HighlightRules;
}
Expand Down
23 changes: 21 additions & 2 deletions tool/modes-declaration-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,28 @@ function generateModuleDeclarations(dirPath) {
});
}

function getAllFiles(dirPath) {
let files = [];

const entries = fs.readdirSync(dirPath);

entries.sort().forEach(entry => {
const fullPath = path.join(dirPath, entry);
const stat = fs.statSync(fullPath);

if (stat.isDirectory()) {
files = files.concat(getAllFiles(fullPath));
}
else if (stat.isFile()) {
files.push(fullPath);
}
});

return files;
}

function createProgram(dirPath) {
const fileNames = fs.readdirSync(dirPath, {recursive: true}).map(file => path.join(dirPath, file)).filter(
file => /\.js$/.test(file) && !/test\.js$/.test(file));
const fileNames = getAllFiles(dirPath).filter(file => /\.js$/.test(file) && !/test\.js$/.test(file));

const program = ts.createProgram(fileNames, {
target: ts.ScriptTarget.ES5,
Expand Down
Loading