Added Required logic if not found, and added better update logic

This commit is contained in:
2026-09-19 22:07:07 +02:00
parent 45c988c989
commit dcd1bf25e7
14 changed files with 661 additions and 735 deletions
+12 -4
View File
@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import { LuaFile, BlockType, CodeBlock, RequireBlock, ReturnBlock, FunctionBlock, TableBlock } from './CodeBlocks';
import { CompilationError } from './CompilationError';
import { CompilationError, CompilationErrorType } from './CompilationError';
export interface ScriptCompilerOptions {
sourcePath: string,
@@ -70,7 +70,8 @@ export class ScriptCompiler {
this.options.onError?.({
filePath: fullPath,
line: 0,
message: `Duplicate file key detected: ${key}. This can happen if two files have different capitalization. Lua is case sensitive, but the compiler treats file keys as case insensitive.`
message: `Duplicate file key detected: ${key}. This can happen if two files have different capitalization. Lua is case sensitive, but the compiler treats file keys as case insensitive.`,
type: CompilationErrorType.Semantic
});
continue;
}
@@ -305,7 +306,8 @@ class Writer {
this.onError({
filePath: file.fullPath,
line: 0,
message: `Circular dependency detected: ${cycle.map(x => x.split('.').pop()).join(' -> ')}`
message: `Circular dependency detected: ${cycle.map(x => x.split('.').pop()).join(' -> ')}`,
type: CompilationErrorType.DependencyCircular
});
}
return true;
@@ -348,7 +350,13 @@ class Writer {
line: dep.requiredAtLine,
charStart: dep.charStart,
charEnd: dep.charEnd,
message: `Missing dependency: ${dep.fileKey}`
message: `Missing dependency: ${dep.fileKey}`,
type: CompilationErrorType.DependencyNotFound,
metaData: new Map(
[
["dependency", dep.fileKey],
]
)
});
}
}