UNPKG

@eas-framework/server

Version:

Node.js framework, with a lot of built in features

1,113 lines 109 kB
/// <reference types="formidable" /> /// <reference types="node" /> /// <reference types="node" /> /// <reference types="node" /> /// <reference types="node" /> /// <reference types="node" /> /// <reference types="node" /> /// <reference types="sql.js" /> declare module "@eas-framework/server/MainBuild/Types" { import type { Request as TinyhttpRequest, Response as TinyhttpResponse } from '@tinyhttp/app'; import type { Fields, Files } from 'formidable'; type AddAny = { [key: string]: any; }; export type Request = TinyhttpRequest & { fields?: Fields; files?: Files; } & AddAny; export type Response = TinyhttpResponse & AddAny; type write = (data: any) => void; type echo = (arr: string[], params: any[]) => void; type page = { write: write; writeSafe: write; setResponse: write; echo: echo; Post: AddAny | null; Query: AddAny; Session: AddAny | null; Files: Files; Cookies: AddAny; PageVar: AddAny; GlobalVar: AddAny; Request: Request; Response: Response; } & AddAny; global { let page: page; let write: write; let writeSafe: write; let setResponse: write; let echo: echo; let Post: AddAny | null; let Query: AddAny; let Session: AddAny | null; let Files: Files; let Cookies: AddAny; let PageVar: AddAny; let GlobalVar: AddAny; function include(path: string, object?: AddAny): Promise<AddAny>; function transfer(path: string, preserveForm?: boolean, object?: AddAny): Promise<AddAny>; } } declare module "@eas-framework/server/OutputInput/Console" { export function allowPrint(d: boolean): void; export const print: Console; } declare module "@eas-framework/server/OutputInput/EasyFs" { import { Dirent, Stats, promises } from 'fs'; function exists(path: string): Promise<boolean>; /** * * @param {path of the file} path * @param {filed to get from the stat object} filed * @returns the filed */ function stat(path: string, filed?: string, ignoreError?: boolean, defaultValue?: any): Promise<Stats | any>; /** * If the file exists, return true * @param {string} path - The path to the file you want to check. * @param {any} [ifTrueReturn=true] - any = true * @returns A boolean value. */ function existsFile(path: string, ifTrueReturn?: any): Promise<boolean>; /** * It creates a directory. * @param {string} path - The path to the directory you want to create. * @returns A promise. */ function mkdir(path: string): Promise<boolean>; /** * `rmdir` is a function that takes a string and returns a promise that resolves to a boolean * @param {string} path - The path to the directory to be removed. * @returns A promise. */ function rmdir(path: string): Promise<boolean>; /** * `unlink` is a function that takes a string and returns a promise that resolves to a boolean * @param {string} path - The path to the file you want to delete. * @returns A promise. */ function unlink(path: string): Promise<boolean>; /** * If the path exists, delete it * @param {string} path - The path to the file or directory to be unlinked. * @returns A boolean value. */ function unlinkIfExists(path: string): Promise<boolean>; /** * `readdir` is a function that takes a path and an options object, and returns a promise that resolves * to an array of strings * @param {string} path - The path to the directory you want to read. * @param options - { * @returns A promise that resolves to an array of strings. */ function readdir(path: string, options?: {}): Promise<string[] | Buffer[] | Dirent[]>; /** * If the path does not exist, create it * @param {string} path - The path to the directory you want to create. * @returns A boolean value indicating whether the directory was created or not. */ function mkdirIfNotExists(path: string): Promise<boolean>; /** * Write a file to the file system * @param {string} path - The path to the file you want to write to. * @param {string | NodeJS.ArrayBufferView} content - The content to write to the file. * @returns A promise. */ function writeFile(path: string, content: string | NodeJS.ArrayBufferView): Promise<boolean>; /** * `writeJsonFile` is a function that takes a path and a content and writes the content to the file at * the path * @param {string} path - The path to the file you want to write to. * @param {any} content - The content to write to the file. * @returns A boolean value. */ function writeJsonFile(path: string, content: any): Promise<boolean>; /** * `readFile` is a function that takes a path and an optional encoding and returns a promise that * resolves to the contents of the file at the given path * @param {string} path - The path to the file you want to read. * @param [encoding=utf8] - The encoding of the file. Defaults to utf8. * @returns A promise. */ function readFile(path: string, encoding?: BufferEncoding, ignoreError?: boolean): Promise<string | any>; /** * It reads a JSON file and returns the parsed JSON object. * @param {string} path - The path to the file you want to read. * @param {string} [encoding] - The encoding to use when reading the file. Defaults to utf8. * @returns A promise that resolves to an object. */ function readJsonFile(path: string, encoding?: BufferEncoding): Promise<any>; /** * If the path doesn't exist, create it * @param p - The path to the file that needs to be created. * @param [base] - The base path to the file. */ function makePathReal(p: string, base?: string): Promise<boolean>; export { Dirent }; const _default: { exists: typeof exists; existsFile: typeof existsFile; stat: typeof stat; mkdir: typeof mkdir; mkdirIfNotExists: typeof mkdirIfNotExists; writeFile: typeof writeFile; writeJsonFile: typeof writeJsonFile; readFile: typeof readFile; readJsonFile: typeof readJsonFile; rmdir: typeof rmdir; unlink: typeof unlink; unlinkIfExists: typeof unlinkIfExists; readdir: typeof readdir; makePathReal: typeof makePathReal; access(path: import("fs").PathLike, mode?: number): Promise<void>; copyFile(src: import("fs").PathLike, dest: import("fs").PathLike, mode?: number): Promise<void>; open(path: import("fs").PathLike, flags?: string | number, mode?: import("fs").Mode): Promise<promises.FileHandle>; rename(oldPath: import("fs").PathLike, newPath: import("fs").PathLike): Promise<void>; truncate(path: import("fs").PathLike, len?: number): Promise<void>; rm(path: import("fs").PathLike, options?: import("fs").RmOptions): Promise<void>; readlink(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | BufferEncoding): Promise<string>; readlink(path: import("fs").PathLike, options: import("fs").BufferEncodingOption): Promise<Buffer>; readlink(path: import("fs").PathLike, options?: string | import("fs").ObjectEncodingOptions): Promise<string | Buffer>; symlink(target: import("fs").PathLike, path: import("fs").PathLike, type?: string): Promise<void>; lstat(path: import("fs").PathLike, opts?: import("fs").StatOptions & { bigint?: false; }): Promise<Stats>; lstat(path: import("fs").PathLike, opts: import("fs").StatOptions & { bigint: true; }): Promise<import("fs").BigIntStats>; lstat(path: import("fs").PathLike, opts?: import("fs").StatOptions): Promise<Stats | import("fs").BigIntStats>; link(existingPath: import("fs").PathLike, newPath: import("fs").PathLike): Promise<void>; chmod(path: import("fs").PathLike, mode: import("fs").Mode): Promise<void>; lchmod(path: import("fs").PathLike, mode: import("fs").Mode): Promise<void>; lchown(path: import("fs").PathLike, uid: number, gid: number): Promise<void>; lutimes(path: import("fs").PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>; chown(path: import("fs").PathLike, uid: number, gid: number): Promise<void>; utimes(path: import("fs").PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>; realpath(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | BufferEncoding): Promise<string>; realpath(path: import("fs").PathLike, options: import("fs").BufferEncodingOption): Promise<Buffer>; realpath(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | BufferEncoding): Promise<string | Buffer>; mkdtemp(prefix: string, options?: import("fs").ObjectEncodingOptions | BufferEncoding): Promise<string>; mkdtemp(prefix: string, options: import("fs").BufferEncodingOption): Promise<Buffer>; mkdtemp(prefix: string, options?: import("fs").ObjectEncodingOptions | BufferEncoding): Promise<string | Buffer>; appendFile(path: import("fs").PathLike | promises.FileHandle, data: string | Uint8Array, options?: BufferEncoding | (import("fs").ObjectEncodingOptions & promises.FlagAndOpenMode)): Promise<void>; opendir(path: import("fs").PathLike, options?: import("fs").OpenDirOptions): Promise<import("fs").Dir>; watch(filename: import("fs").PathLike, options: "buffer" | (import("fs").WatchOptions & { encoding: "buffer"; })): AsyncIterable<promises.FileChangeInfo<Buffer>>; watch(filename: import("fs").PathLike, options?: BufferEncoding | import("fs").WatchOptions): AsyncIterable<promises.FileChangeInfo<string>>; watch(filename: import("fs").PathLike, options: string | import("fs").WatchOptions): AsyncIterable<promises.FileChangeInfo<Buffer>> | AsyncIterable<promises.FileChangeInfo<string>>; cp(source: string | URL, destination: string | URL, opts?: import("fs").CopyOptions): Promise<void>; constants: typeof import("fs").constants; }; export default _default; } declare module "@eas-framework/server/EasyDebug/SourceMap" { import { RawSourceMap, SourceMapGenerator } from "source-map"; export function toURLComment(map: SourceMapGenerator, isCss?: boolean): string; export function MergeSourceMap(generatedMap: RawSourceMap, originalMap: RawSourceMap): Promise<SourceMapGenerator>; } declare module "@eas-framework/server/CompileCode/BaseReader/Reader" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import workerPool from 'workerpool'; export const pool: workerPool.WorkerPool; export class BaseReader { /** * Find the end of quotation marks, skipping things like escaping: "\\"" * @return the index of end */ static findEntOfQ(text: string, qType: string): number; /** * Find char skipping data inside quotation marks * @return the index of end */ static findEndOfDef(text: string, EndType: string[] | string): number; /** * Same as 'findEndOfDef' only with option to custom 'open' and 'close' * ```js * FindEndOfBlock(`cool "}" { data } } next`, '{', '}') * ``` * it will return the 18 -> "} next" * @return the index of end */ static FindEndOfBlock(text: string, open: string, end: string): number; } export class InsertComponentBase { private printNew?; SimpleSkip: string[]; SkipSpecialTag: string[][]; constructor(printNew?: any); private printErrors; FindCloseChar(text: StringTracker, Search: string): Promise<any>; FindCloseCharHTML(text: StringTracker, Search: string): Promise<any>; } export type ParseBlocks = { name: string; start: number; end: number; }[]; export function RazorToEJS(text: string, compile?: boolean): Promise<ParseBlocks>; export function RazorToEJSMini(text: string, find: string): Promise<number[]>; export function EJSParser(text: string, start: string, end: string): Promise<ParseBlocks>; } declare module "@eas-framework/server/CompileCode/XMLHelpers/TagDataParser" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; export default class TagDataParser { private text?; valueArray: { key?: StringTracker; value: StringTracker | true; obj?: any; space: boolean; char?: string; }[]; constructor(text?: StringTracker); parser(): Promise<void>; private popItem; private getItem; popTracker(key: string): StringTracker | null | boolean; popHaveDefaultTracker<T = string>(key: string, value?: T): StringTracker | null | T; popAnyTracker<T = string>(key: string, value?: T): string | null | T; popString(key: string): string | null | boolean; getOBJ(key: string): { [key: string | number]: any; } | null; popBoolean(key: string, defaultValue?: boolean): boolean; exists(key: string): boolean; popHaveDefault<T = string>(key: string, value?: T): string | null | T; popAnyDefault<T = string>(key: string, value?: T): string | null | T; addClass(className: string): void; rebuildSpace(): StringTracker; pushValue(key: string, value: string): StringTracker; map(): { [key: string]: any; }; extends(attr: TagDataParser): void; clone(): TagDataParser; } } declare module "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import TagDataParser from "@eas-framework/server/CompileCode/XMLHelpers/TagDataParser"; export type StringNumberMap = { [key: string]: number; }; export type StringAnyMap = { [key: string]: any; }; export type StringMap = { [key: string]: string; }; export interface BuildInComponent { compiledString: StringTracker; checkComponents?: boolean; addAttributes?: TagDataParser; } export type CompileInFileFunc = (path: string, arrayType: string[], debugFromPage: string) => Promise<{ CompiledData: StringTracker; dependenceObject: any; }>; export type BuildScriptWithoutModule = (code: StringTracker) => Promise<StringTracker> | StringTracker; export type StringArrayOrObject = (string | { [key: string]: string; })[]; } declare module "@eas-framework/server/EasyDebug/SourceMapStore" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import { SourceMapGenerator, RawSourceMap } from "source-map"; import { StringMap } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; export abstract class SourceMapBasic { protected filePath: string; protected httpSource: boolean; protected relative: boolean; protected isCss: boolean; protected map: SourceMapGenerator; protected fileDirName: string; protected lineCount: number; constructor(filePath: string, httpSource?: boolean, relative?: boolean, isCss?: boolean); protected getSource(source: string): string; getRowSourceMap(): RawSourceMap; mapAsURLComment(): string; } export default class SourceMapStore extends SourceMapBasic { protected debug: boolean; metaMap: StringMap; private storeString; private actionLoad; constructor(filePath: string, debug?: boolean, isCss?: boolean, httpSource?: boolean); notEmpty(): boolean; addStringTracker(track: StringTracker, { text: text }?: { text?: string; }): void; private _addStringTracker; addText(text: string): void; private _addText; static fixURLSourceMap(map: RawSourceMap): RawSourceMap; addSourceMapWithStringTracker(fromMap: RawSourceMap, track: StringTracker, text: string): void; private _addSourceMapWithStringTracker; private buildAll; mapAsURLComment(): string; createDataWithMap(): Promise<string>; clone(): SourceMapStore; } } declare module "@eas-framework/server/EasyDebug/StringTrackerToSourceMap" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; export function outputMap(text: StringTracker, filePath: string, httpSource?: boolean, relative?: boolean): import("source-map").RawSourceMap; export function outputWithMap(text: StringTracker, filePath: string): string; } declare module "@eas-framework/server/EasyDebug/StringTracker" { export interface StringTrackerDataInfo { text?: string; info: string; line?: number; char?: number; } export interface ArrayMatch extends Array<StringTracker> { index?: number; input?: StringTracker; } export default class StringTracker { private DataArray; InfoText: string; OnLine: number; OnChar: number; /** * @param InfoText text info for all new string that are created in this object */ constructor(Info?: string | StringTrackerDataInfo, text?: string); static get emptyInfo(): StringTrackerDataInfo; setDefault(Info?: StringTrackerDataInfo): void; getDataArray(): StringTrackerDataInfo[]; /** * get the first info of the string */ get DefaultInfoText(): StringTrackerDataInfo; /** * get the last info of the string */ get DefaultInfoTextLast(): StringTrackerDataInfo; /** * get the InfoText that are setted on the first InfoText */ get StartInfo(): StringTrackerDataInfo; /** * return all the text as one string */ private get OneString(); /** * return all the text so you can check if it equal or not * use like that: myString.eq == "cool" */ get eq(): string; /** * return the info about this text (small path) */ get originalLineInfo(): string; /** * return the info about this text, with **full path** */ get lineInfo(): string; /** * length of the string */ get length(): number; /** * * @returns copy of this string object */ Clone(): StringTracker; private AddClone; /** * * @param text any thing to connect * @returns conncted string with all the text */ static concat(...text: any[]): StringTracker; /** * * @param data * @returns this string clone plus the new data connected */ ClonePlus(...data: any[]): StringTracker; /** * Add string or any data to this string * @param data can be any thing * @returns this string (not new string) */ Plus(...data: any[]): StringTracker; /** * Add strins ot other data with 'Template literals' * used like this: myStrin.$Plus `this very${coolString}!` * @param texts all the splited text * @param values all the values */ Plus$(texts: TemplateStringsArray, ...values: (StringTracker | any)[]): StringTracker; /** * * @param text string to add * @param action where to add the text * @param info info the come with the string */ private AddTextAction; /** * add text at the *end* of the string * @param text * @param info */ AddTextAfter(text: string, info?: string, line?: number, char?: number): this; /** * add text at the *end* of the string without tracking * @param text */ AddTextAfterNoTrack(text: string, info?: string): this; /** * add text at the *start* of the string * @param text * @param info */ AddTextBefore(text: string, info?: string, line?: number, char?: number): this; /** * add text at the *start* of the string * @param text */ AddTextBeforeNoTrack(text: string, info?: string): this; /** * Add Text File Tracking * @param text * @param info */ private AddFileText; /** * simple methof to cut string * @param start * @param end * @returns new cutted string */ private CutString; /** * substring-like method, more like js cutting string, if there is not parameters it complete to 0 */ substring(start: number, end?: number): StringTracker; /** * substr-like method * @param start * @param length * @returns */ substr(start: number, length?: number): StringTracker; /** * slice-like method * @param start * @param end * @returns */ slice(start: number, end?: number): StringTracker; charAt(pos: number): StringTracker; at(pos: number): StringTracker; charCodeAt(pos: number): number; codePointAt(pos: number): number; [Symbol.iterator](): Generator<StringTracker, void, unknown>; getLine(line: number, startFromOne?: boolean): StringTracker; /** * convert uft-16 length to count of chars * @param index * @returns */ private charLength; indexOf(text: string): number; lastIndexOf(text: string): number; /** * return string as unicode */ private unicodeMe; /** * the string as unicode */ get unicode(): StringTracker; search(regex: RegExp | string): number; startsWith(search: string, position?: number): boolean; endsWith(search: string, position?: number): boolean; includes(search: string, position?: number): boolean; trimStart(): StringTracker; trimLeft(): StringTracker; trimEnd(): StringTracker; trimRight(): StringTracker; trim(): StringTracker; SpaceOne(addInside?: string): StringTracker; private ActionString; toLocaleLowerCase(locales?: string | string[]): StringTracker; toLocaleUpperCase(locales?: string | string[]): StringTracker; toUpperCase(): StringTracker; toLowerCase(): StringTracker; normalize(): StringTracker; private StringIndexer; private RegexInString; split(separator: string | RegExp, limit?: number): StringTracker[]; repeat(count: number): StringTracker; static join(arr: StringTracker[]): StringTracker; private replaceWithTimes; replace(searchValue: string | RegExp, replaceValue: StringTracker | string): StringTracker; replacer(searchValue: RegExp, func: (data: ArrayMatch) => StringTracker): StringTracker; replacerAsync(searchValue: RegExp, func: (data: ArrayMatch) => Promise<StringTracker>): Promise<StringTracker>; replaceAll(searchValue: string | RegExp, replaceValue: StringTracker | string): StringTracker; matchAll(searchValue: string | RegExp): StringTracker[]; match(searchValue: string | RegExp): ArrayMatch | StringTracker[]; toString(): string; extractInfo(type?: string): string; originalPositionFor(line: number, column: number): { searchLine: StringTracker; text?: string; info: string; line?: number; char?: number; }; /** * Extract error info form error message */ debugLine({ message, text, location, line, col }: { message?: string; text?: string; location?: { line: number; column: number; lineText?: string; }; line?: number; col?: number; }): string; StringWithTack(fullSaveLocation: string): string; StringTack(fullSaveLocation: string, httpSource?: boolean, relative?: boolean): import("source-map").RawSourceMap; } } declare module "@eas-framework/server/StringMethods/Splitting" { interface globalString<T> { indexOf(string: string): number; lastIndexOf(string: string): number; startsWith(string: string): boolean; substring(start: number, end?: number): T; } export function SplitFirst<T extends globalString<T>>(type: string, string: T): T[]; export function CutTheLast(type: string, string: string): string; export function Extension<T extends globalString<T>>(string: T): T; export function trimType(type: string, string: string): string; export function substringStart<T extends globalString<T>>(start: string, string: T): T; } declare module "@eas-framework/server/RunTimeBuild/SearchFileSystem" { function getDirname(url: string): string; const SystemData: string; const frameworkShortName = "eas"; const workingDirectory: string; const getTypes: { Static: string[]; Logs: string[]; Models: string[]; Components: string[]; node_modules: string[]; readonly WWW: string[]; }; const BasicSettings: { pageTypes: { page: string; model: string; component: string; }; pageTypesArray: any[]; pageCodeFile: { page: string[]; model: string[]; component: string[]; }; pageCodeFileArray: any[]; partExtensions: string[]; ReqFileTypes: { js: string; ts: string; 'api-ts': string; 'api-js': string; }; ReqFileTypesArray: any[]; WebSiteFolder: string; readonly fullWebSitePath: string; readonly tsConfig: string; tsConfigFile(): Promise<any>; relative(fullPath: string): string; }; export function DeleteInDirectory(path: any): Promise<void>; export function smallPathToPage(smallPath: string): string; export function getTypeBySmallPath(smallPath: string): any; export { getDirname, SystemData, workingDirectory, getTypes, BasicSettings, frameworkShortName }; } declare module "@eas-framework/server/OutputInput/Logger" { export interface PreventLog { id?: string; text: string; errorName: string; type?: "warn" | "error"; } export const Settings: { PreventErrors: string[]; }; export const ClearWarning: () => number; /** * If the error is not in the PreventErrors array, print the error * @param {PreventLog} - `id` - The id of the error. */ export function createNewPrint({ id, text, type, errorName }: PreventLog): string[]; export function LogToHTML(log: string): string; type baseEventData = { date?: Date; }; export class TimeLogger<T, D extends baseEventData> { private events; eventLog: D[]; logAll: boolean; event(name: T, func: (data: D) => void): void; dispatch(name: T, data?: D): void; private simpleLog; } type eventNames = 'compile-time' | 'start-compile' | 'end-compile' | 'create-sitemap' | 'end-create-sitemap'; type eventArguments = { time?: number; file?: string; debug?: boolean; } & baseEventData; export const PageTimeLogger: TimeLogger<eventNames, eventArguments>; } declare module "@eas-framework/server/CompileCode/transform/EasyScript" { interface SplitText { text: string; type_name: string; is_skip: boolean; } export function ParseTextStream(text: string): Promise<SplitText[]>; export function EndOfDefSkipBlock(text: string, types: string[]): Promise<number>; export function EndOfBlock(text: string, types: string[]): Promise<number>; abstract class BaseEntityCode { ReplaceAll(text: string, find: string, replace: string): string; } abstract class ReBuildCodeBasic extends BaseEntityCode { ParseArray: SplitText[]; constructor(ParseArray: SplitText[]); BuildCode(): string; } export class ReBuildCodeString extends ReBuildCodeBasic { private DataCode; constructor(ParseArray: SplitText[]); get CodeBuildText(): string; set CodeBuildText(value: string); get AllInputs(): string[]; private CreateDataCode; /** * if the <||> start with a (+.) like that for example, "+.<||>", the update function will get the last "SkipText" instead getting the new one * same with a (-.) just for ignoring current value * @returns the builded code */ BuildCode(): string; } } declare module "@eas-framework/server/CompileCode/JSParser" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import { ParseBlocks } from "@eas-framework/server/CompileCode/BaseReader/Reader"; interface JSParserValues { type: 'text' | 'script' | 'no-track'; text: StringTracker; } export default class JSParser { start: string; text: StringTracker; end: string; type: string; path: string; values: JSParserValues[]; forClientSide: boolean; constructor(text: StringTracker, path: string, start?: string, end?: string, type?: string); ReplaceValues(find: string, replace: string): void; findEndOfDefGlobal(text: StringTracker): number; ScriptWithInfo(text: StringTracker): StringTracker; findScripts(values?: ParseBlocks): Promise<void>; static fixText(text: StringTracker | string): string | StringTracker; static fixTextSimpleQuotes(text: StringTracker | string): string | StringTracker; ReBuildText(): StringTracker; BuildAll(isDebug: boolean): StringTracker; static printError(message: string): string; static RunAndExport(text: StringTracker, path: string, isDebug: boolean, forClientSide?: boolean): Promise<StringTracker>; private static split2FromEnd; } export class EnableGlobalReplace { private addText; private savedBuildData; private buildCode; private path; private replacer; constructor(addText?: string); load(code: StringTracker, path: string): Promise<void>; private ExtractAndSaveCode; private ParseOutsideOfComment; StartBuild(): Promise<string>; private RestoreAsCode; RestoreCode(code: StringTracker): StringTracker; } } declare module "@eas-framework/server/OutputInput/StoreJSON" { import { StringAnyMap } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; export default class StoreJSON { private savePath; store: StringAnyMap; constructor(filePath: string, autoLoad?: boolean); loadFile(): Promise<void>; update(key: string, value: any): void; /** * If the key is in the store, return the value. If not, create a new value, store it, and return it * @param {string} key - The key to look up in the store. * @param [create] - A function that returns a string. * @returns The value of the key in the store. */ have(key: string, create?: () => string): any; clear(): void; save(): Promise<boolean>; } } declare module "@eas-framework/server/StringMethods/Id" { export default function createId(text: string, max?: number): string; export function hashString(text: string): string; } declare module "@eas-framework/server/EasyDebug/SourceMapLoad" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import { RawSourceMap } from "source-map"; export default function SourceMapToStringTracker(code: string, sourceMap: string | RawSourceMap): Promise<StringTracker>; export function backToOriginal(original: StringTracker, code: string, sourceMap: string | RawSourceMap): Promise<StringTracker>; export function backToOriginalSss(original: StringTracker, code: string, sourceMap: string | RawSourceMap, mySource: string): Promise<StringTracker>; } declare module "@eas-framework/server/CompileCode/transpiler/printMessage" { import { RawSourceMap } from 'source-map'; import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; export function parseSWCError(err: { message: string; stack: string; code: string; }, changeLocations?: (line: number, char: number, info: string) => { line: number; char: number; info: string; }, codeFile?: string): { readonly simpleMessage: string; readonly fullMessage: string; errorFile: string; errorLines: string; errorCode: string; }; export function ESBuildPrintError(err: any): { readonly simpleMessage: string; readonly fullMessage: string; errorFile: string; errorLines: string; errorCode: string; }; export function ESBuildPrintErrorSourceMap(err: any, sourceMap: RawSourceMap, sourceFile?: string): Promise<{ readonly simpleMessage: string; readonly fullMessage: string; errorFile: string; errorLines: string; errorCode: string; }>; export function ESBuildPrintErrorStringTracker(base: StringTracker, err: any, codeFile: string): { readonly simpleMessage: string; readonly fullMessage: string; errorFile: string; errorLines: string; errorCode: string; }; } declare module "@eas-framework/server/CompileCode/transpiler/settings" { import { JscConfig } from '@swc/core'; import { StringMap } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; export const esTarget = "es2022"; export function Decorators(data: JscConfig): JscConfig; export function TransformJSCVars(vars?: StringMap, simplify?: boolean): { transform: { optimizer: { simplify: boolean; globals: { vars: StringMap; }; }; }; }; export function TransformJSC(data?: JscConfig, vars?: StringMap, simplify?: boolean): JscConfig; } declare module "@eas-framework/server/ImportFiles/CustomImport/Extension/json" { export default function (path: string): Promise<any>; } declare module "@eas-framework/server/ImportFiles/CustomImport/Extension/wasm" { export default function (path: string): Promise<WebAssembly.Exports>; } declare module "@eas-framework/server/ImportFiles/CustomImport/Extension/index" { export const customTypes: string[]; export default function ImportByExtension(path: string, type: string): Promise<any>; } declare module "@eas-framework/server/CompileCode/transform/EasySyntax" { export const SyntaxSettings: { pathAliases: { [key: string]: string; }; }; export default class EasySyntax { private Build; load(code: string): Promise<void>; private changeAlias; private actionStringImport; private actionStringExport; private actionStringImportAll; private actionStringExportAll; private BuildImportType; private BuildInOneWord; private replaceWithSpace; private Define; private BuildInAsFunction; /** * export * from './path' */ private exportAnyFrom; private exportVariable; private exportBlock; BuildImports(defineData?: { [key: string]: string; }): Promise<void>; BuiltString(): string; static BuildAndExportImports(code: string, defineData?: { [key: string]: string; }): Promise<string>; } } declare module "@eas-framework/server/CompileCode/transform/Script" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import { SessionBuild } from "@eas-framework/server/CompileCode/Session"; export const TransformSettings: { globals: {}; }; export function PluginScript(text: StringTracker, isTypescript: boolean, sessionInfo: SessionBuild): Promise<StringTracker>; /** * It takes a script and transform to 'Framework' script * @param {StringTracker} text - The text to be transformed. * @param {boolean} isTypescript - Whether the file is a typescript file or not. * @param {SessionBuild} sessionInfo - SessionBuild * @returns A function that takes a StringTracker, a boolean, and a SessionBuild and returns a Promise * of a StringTracker. */ export function ScriptToEASScriptLastProcesses(text: StringTracker, isTypescript: boolean, sessionInfo: SessionBuild): Promise<StringTracker>; } declare module "@eas-framework/server/CompileCode/Session" { import SourceMapStore from "@eas-framework/server/EasyDebug/SourceMapStore"; import StoreJSON from "@eas-framework/server/OutputInput/StoreJSON"; import { StringAnyMap, StringNumberMap } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import TagDataParser from "@eas-framework/server/CompileCode/XMLHelpers/TagDataParser"; export type setDataHTMLTag = { url: string; attributes?: StringAnyMap; }; export type connectorInfo = { type: string; name: string; sendTo: string; validator: string[]; order?: string[]; notValid?: string; message?: string | boolean; responseSafe?: boolean; }; export type connectorArray = connectorInfo[]; export type cacheComponent = { [key: string]: null | { mtimeMs?: number; value?: string; }; }; export type inTagCache = { style: string[]; script: string[]; scriptModule: string[]; }; export const StaticFilesInfo: StoreJSON; export class SessionBuild { smallPath: string; fullPath: string; typeName?: string; debug?: boolean; private _safeDebug?; connectorArray: connectorArray; private scriptURLSet; private styleURLSet; private inScriptStyle; headHTML: string; cache: inTagCache; cacheComponent: cacheComponent; compileRunTimeStore: StringAnyMap; dependencies: StringNumberMap; recordNames: string[]; get safeDebug(): boolean; runtimeScript: StringTracker; sitemapBuild: StringTracker; constructor(smallPath: string, fullPath: string, typeName?: string, debug?: boolean, _safeDebug?: boolean); unshiftRuntimeScript(script: StringTracker): void; connectSitemapXML(script: StringTracker | true): void; style(url: string, attributes?: StringAnyMap): void; script(url: string, attributes?: StringAnyMap): void; record(name: string): void; dependence(smallPath: string, fullPath?: string): Promise<boolean>; addScriptStyle(type: 'script' | 'style' | 'module', smallPath?: string): SourceMapStore; addScriptStylePage(type: 'script' | 'style' | 'module', dataTag: TagDataParser, info: StringTracker): SourceMapStore; private static createName; private addHeadTags; buildHead(): Promise<string>; extends(from: SessionBuild): void; BuildScriptWithPrams(code: StringTracker): Promise<StringTracker>; } } declare module "@eas-framework/server/CompileCode/XMLHelpers/CodeInfoAndDebug" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; function ParseDebugLine(code: StringTracker, path: string): Promise<StringTracker>; function ParseDebugInfo(code: StringTracker, path: string): Promise<StringTracker>; export function AddDebugInfo(isolate: boolean, pageName: string, FullPath: string, SmallPath: string, cache?: { value?: string; }): Promise<{ allData: StringTracker; stringInfo: string; }>; export function CreateFilePathOnePath(filePath: string, inputPath: string, folder: string, pageType: string, pathType?: number): string; export interface PathTypes { SmallPathWithoutFolder?: string; SmallPath?: string; FullPath?: string; FullPathCompile?: string; } function CreateFilePath(filePath: string, smallPath: string, inputPath: string, folder: string, pageType: string): { SmallPath: string; FullPath: string; }; export { ParseDebugLine, CreateFilePath, ParseDebugInfo }; } declare module "@eas-framework/server/CompileCode/transpiler/minify" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; export function minifyJS(text: string, tracker: StringTracker): Promise<string>; } declare module "@eas-framework/server/BuildInComponents/Components/client" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import { BuildInComponent } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; import { SessionBuild } from "@eas-framework/server/CompileCode/Session"; import InsertComponent from "@eas-framework/server/CompileCode/InsertComponent"; import TagDataParser from "@eas-framework/server/CompileCode/XMLHelpers/TagDataParser"; export default function BuildCode(pathName: string, type: StringTracker, dataTag: TagDataParser, BetweenTagData: StringTracker, InsertComponent: InsertComponent, sessionInfo: SessionBuild): Promise<BuildInComponent>; } declare module "@eas-framework/server/BuildInComponents/Components/script/load-options" { import { JscConfig } from '@swc/core'; import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; export function transpilerWithOptions(BetweenTagData: StringTracker, language: string, sourceMaps: boolean, isDebug: boolean, BetweenTagDataString?: string, options?: JscConfig): Promise<{ resultCode: string; resultMap: string; }>; } declare module "@eas-framework/server/BuildInComponents/Components/script/server" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import { BuildInComponent } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; import TagDataParser from "@eas-framework/server/CompileCode/XMLHelpers/TagDataParser"; export default function BuildCode(language: string, pathName: string, type: StringTracker, dataTag: TagDataParser, BetweenTagData: StringTracker, isDebug: boolean): Promise<BuildInComponent>; } declare module "@eas-framework/server/BuildInComponents/Components/script/client" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import { BuildInComponent } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; import { SessionBuild } from "@eas-framework/server/CompileCode/Session"; import TagDataParser from "@eas-framework/server/CompileCode/XMLHelpers/TagDataParser"; export default function BuildCode(language: string, tagData: TagDataParser, BetweenTagData: StringTracker, sessionInfo: SessionBuild): Promise<BuildInComponent>; } declare module "@eas-framework/server/BuildInComponents/Components/script/index" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import { BuildInComponent } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; import { SessionBuild } from "@eas-framework/server/CompileCode/Session"; import TagDataParser from "@eas-framework/server/CompileCode/XMLHelpers/TagDataParser"; export default function BuildCode(pathName: string, type: StringTracker, dataTag: TagDataParser, BetweenTagData: StringTracker, sessionInfo: SessionBuild): Promise<BuildInComponent>; } declare module "@eas-framework/server/BuildInComponents/Components/style/sass" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import sass from 'sass'; import { RawSourceMap } from 'source-map-js'; import { SessionBuild } from "@eas-framework/server/CompileCode/Session"; export function createImporter(originalPath: string): { findFileUrl(url: string): URL; }; export function sassStyle(language: string): "compressed" | "expanded"; export function sassSyntax(language: 'sass' | 'scss' | 'css'): "scss" | "css" | "indented"; export function sassAndSource(sourceMap: RawSourceMap, source: string): void; export function getSassErrorLine({ sassStack }: { sassStack: any; }): { line: any; column: any; }; export function PrintSassError(err: any, { line, column }?: { line: any; column: any; }): void; export function PrintSassErrorTracker(err: any, track: StringTracker): void; export function compileSass(language: string, BetweenTagData: StringTracker, sessionInfo: SessionBuild, outStyle?: string, sourceMap?: boolean): Promise<{ outStyle: string; result?: undefined; compressed?: undefined; } | { result: sass.CompileResult; outStyle: string; compressed: boolean; }>; } declare module "@eas-framework/server/BuildInComponents/Components/style/server" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import { BuildInComponent } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; import { SessionBuild } from "@eas-framework/server/CompileCode/Session"; import TagDataParser from "@eas-framework/server/CompileCode/XMLHelpers/TagDataParser"; export default function BuildCode(language: string, pathName: string, type: StringTracker, dataTag: TagDataParser, BetweenTagData: StringTracker, sessionInfo: SessionBuild): Promise<BuildInComponent>; } declare module "@eas-framework/server/BuildInComponents/Components/style/client" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import { BuildInComponent } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; import { SessionBuild } from "@eas-framework/server/CompileCode/Session"; import TagDataParser from "@eas-framework/server/CompileCode/XMLHelpers/TagDataParser"; export default function BuildCode(language: string, dataTag: TagDataParser, BetweenTagData: StringTracker, sessionInfo: SessionBuild): Promise<BuildInComponent>; } declare module "@eas-framework/server/BuildInComponents/Components/style/index" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import { BuildInComponent } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; import { SessionBuild } from "@eas-framework/server/CompileCode/Session"; import TagDataParser from "@eas-framework/server/CompileCode/XMLHelpers/TagDataParser"; export default function BuildCode(pathName: string, type: StringTracker, dataTag: TagDataParser, BetweenTagData: StringTracker, sessionInfo: SessionBuild): Promise<BuildInComponent>; } declare module "@eas-framework/server/OutputInput/StoreDeps" { import { StringNumberMap } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; import StoreJSON from "@eas-framework/server/OutputInput/StoreJSON"; export const pageDeps: StoreJSON; /** * Check if any of the dependencies of the page have changed * @param {string} path - The path to the page. * @param {StringNumberMap} dependencies - A map of dependencies. The key is the path to the file, and * the value is the last modified time of the file. * @returns A boolean value. */ export function CheckDependencyChange(path: string, dependencies?: StringNumberMap): Promise<boolean>; } declare module "@eas-framework/server/BuildInComponents/Components/page" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import { BuildInComponent } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; import { SessionBuild } from "@eas-framework/server/CompileCode/Session"; import InsertComponent from "@eas-framework/server/CompileCode/InsertComponent"; import TagDataParser from "@eas-framework/server/CompileCode/XMLHelpers/TagDataParser"; export default function BuildCode(pathName: string, type: StringTracker, dataTag: TagDataParser, BetweenTagData: StringTracker, InsertComponent: InsertComponent, sessionInfo: SessionBuild): Promise<BuildInComponent>; } declare module "@eas-framework/server/BuildInComponents/Components/isolate" { import StringTracker from "@eas-framework/server/EasyDebug/StringTracker"; import { BuildInComponent } from "@eas-framework/server/CompileCode/XMLHelpers/CompileTypes"; export default function isolate(BetweenTagData: StringTracker): Promise<BuildInComponent>; } declare module "@eas-framework/server/ImportFiles/ForStatic/Svelte/preprocess" { export function preprocess(fullPath: string, smallPath: string, isDebug: boolean, savePa