Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/AbstractMethodError.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import WebpackError from "./WebpackError";
/**
* Error for abstract method
* @example
* class FooClass {
* abstractMethod() {
* throw new AbstractMethodError(); // error message: Abstract method FooClass.abstractMethod. Must be overridden.
* }
* }
*
*/
export declare class AbstractMethodError extends WebpackError {
constructor();
}

65
node_modules/@rspack/core/dist/lib/Cache.d.ts generated vendored Normal file
View File

@@ -0,0 +1,65 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/Cache.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } from "@rspack/lite-tapable";
import type { WebpackError } from "./WebpackError";
export interface Etag {
toString(): string;
}
export type CallbackCache<T> = (err?: WebpackError | null, result?: T) => void;
type GotHandler<T = any> = (result: T | null, callback: (error: Error | null) => void) => void;
export declare class Cache {
static STAGE_DISK: number;
static STAGE_MEMORY: number;
static STAGE_DEFAULT: number;
static STAGE_NETWORK: number;
hooks: {
get: AsyncSeriesBailHook<[string, Etag | null, GotHandler[]], any>;
store: AsyncParallelHook<[string, Etag | null, any]>;
storeBuildDependencies: AsyncParallelHook<[Iterable<string>]>;
beginIdle: SyncHook<[]>;
endIdle: AsyncParallelHook<[]>;
shutdown: AsyncParallelHook<[]>;
};
constructor();
/**
* @param identifier the cache identifier
* @param etag the etag
* @param callback signals when the value is retrieved
* @returns
*/
get<T>(identifier: string, etag: Etag | null, callback: CallbackCache<T>): void;
/**
* @param identifier the cache identifier
* @param etag the etag
* @param data the value to store
* @param callback signals when the value is stored
* @returns
*/
store<T>(identifier: string, etag: Etag | null, data: T, callback: CallbackCache<void>): void;
/**
* After this method has succeeded the cache can only be restored when build dependencies are
* @param dependencies list of all build dependencies
* @param callback signals when the dependencies are stored
* @returns
*/
storeBuildDependencies(dependencies: Iterable<string>, callback: CallbackCache<void>): void;
beginIdle(): void;
/**
* @param callback signals when the call finishes
* @returns
*/
endIdle(callback: CallbackCache<void>): void;
/**
* @param callback signals when the call finishes
* @returns
*/
shutdown(callback: CallbackCache<void>): void;
}
export default Cache;

139
node_modules/@rspack/core/dist/lib/CacheFacade.d.ts generated vendored Normal file
View File

@@ -0,0 +1,139 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/CacheFacade.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import type { Cache, CallbackCache, Etag } from "./Cache";
import type { HashableObject, HashConstructor } from "./cache/getLazyHashedEtag";
import type WebpackError from "./WebpackError";
type CallbackNormalErrorCache<T> = (err?: WebpackError | null, result?: T) => void;
declare abstract class BaseCache {
abstract get<T>(callback: CallbackCache<T>): void;
abstract getPromise<T>(): Promise<T | undefined>;
abstract store<T>(data: T, callback: CallbackCache<void>): void;
abstract storePromise<T>(data: T): Promise<void>;
}
export declare class ItemCacheFacade implements BaseCache {
_cache: Cache;
_name: string;
_etag: Etag | null;
/**
* @param cache the root cache
* @param name the child cache item name
* @param etag the etag
* @returns
*/
constructor(cache: Cache, name: string, etag: Etag | null);
/**
* @param callback signals when the value is retrieved
* @returns
*/
get<T>(callback: CallbackCache<T>): void;
/**
* @returns promise with the data
*/
getPromise<T>(): Promise<T | undefined>;
/**
* @param data the value to store
* @param callback signals when the value is stored
* @returns
*/
store<T>(data: T, callback: CallbackCache<void>): void;
/**
* @param data the value to store
* @returns promise signals when the value is stored
*/
storePromise<T>(data: T): Promise<void>;
/**
* @param computer function to compute the value if not cached
* @param callback signals when the value is retrieved
* @returns
*/
provide<T>(computer: (callback: CallbackNormalErrorCache<T>) => void, callback: CallbackNormalErrorCache<T>): void;
/**
* @param computer function to compute the value if not cached
* @returns promise with the data
*/
providePromise<T>(computer: () => Promise<T> | T): Promise<T>;
}
export declare class CacheFacade {
_name: string;
_cache: Cache;
_hashFunction: string | HashConstructor;
/**
* @param cache the root cache
* @param name the child cache name
* @param hashFunction the hash function to use
*/
constructor(cache: Cache, name: string, hashFunction: string | HashConstructor);
/**
* @param name the child cache name#
* @returns child cache
*/
getChildCache(name: string): CacheFacade;
/**
* @param identifier the cache identifier
* @param etag the etag
* @returns item cache
*/
getItemCache(identifier: string, etag: Etag | null): ItemCacheFacade;
/**
* @param obj an hashable object
* @returns an etag that is lazy hashed
*/
getLazyHashedEtag(obj: HashableObject): Etag;
/**
* @param a an etag
* @param b another etag
* @returns an etag that represents both
*/
mergeEtags(a: Etag, b: Etag): Etag;
/**
* @param identifier the cache identifier
* @param etag the etag
* @param callback signals when the value is retrieved
* @returns
*/
get<T>(identifier: string, etag: Etag | null, callback: CallbackCache<T>): void;
/**
* @param identifier the cache identifier
* @param etag the etag
* @returns promise with the data
*/
getPromise<T>(identifier: string, etag: Etag | null): Promise<T | undefined>;
/**
* @param identifier the cache identifier
* @param etag the etag
* @param data the value to store
* @param callback signals when the value is stored
* @returns
*/
store<T>(identifier: string, etag: Etag | null, data: T, callback: CallbackCache<void>): void;
/**
* @param identifier the cache identifier
* @param etag the etag
* @param data the value to store
* @returns promise signals when the value is stored
*/
storePromise<T>(identifier: string, etag: Etag | null, data: T): Promise<void>;
/**
* @param identifier the cache identifier
* @param etag the etag
* @param computer function to compute the value if not cached
* @param callback signals when the value is retrieved
* @returns
*/
provide<T>(identifier: string, etag: Etag | null, computer: (callback: CallbackNormalErrorCache<T>) => void, callback: CallbackNormalErrorCache<T>): void;
/**
* @param identifier the cache identifier
* @param etag the etag
* @param computer function to compute the value if not cached
* @returns promise with the data
*/
providePromise<T>(identifier: string, etag: Etag | null, computer: () => Promise<T> | T): Promise<{} | T | null>;
}
export default CacheFacade;

42
node_modules/@rspack/core/dist/lib/DllPlugin.d.ts generated vendored Normal file
View File

@@ -0,0 +1,42 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3bb53f36a5b8fc6bc1bd976ed7af161bd80/lib/DllPlugin.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import type { Compiler } from "../Compiler";
export type DllPluginOptions = {
/**
* Context of requests in the manifest file (defaults to the webpack context).
*/
context?: string;
/**
* If true, only entry points will be exposed.
* @default true
*/
entryOnly?: boolean;
/**
* If true, manifest json file (output) will be formatted.
*/
format?: boolean;
/**
* Name of the exposed dll function (external name, use value of 'output.library').
*/
name?: string;
/**
* Absolute path to the manifest json file (output).
*/
path: string;
/**
* Type of the dll bundle (external type, use value of 'output.libraryTarget').
*/
type?: string;
};
export declare class DllPlugin {
private options;
constructor(options: DllPluginOptions);
apply(compiler: Compiler): void;
}

View File

@@ -0,0 +1,119 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3bb53f36a5b8fc6bc1bd976ed7af161bd80/lib/DllReferencePlugin.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import type { JsBuildMeta } from "@rspack/binding";
import type { Compiler } from "../Compiler";
export type DllReferencePluginOptions = {
/**
* Context of requests in the manifest (or content property) as absolute path.
*/
context?: string;
/**
* Extensions used to resolve modules in the dll bundle (only used when using 'scope').
*/
extensions?: string[];
/**
* An object containing content and name or a string to the absolute path of the JSON manifest to be loaded upon compilation.
*/
manifest: string | DllReferencePluginOptionsManifest;
/**
* The name where the dll is exposed (external name, defaults to manifest.name).
*/
name?: string;
/**
* Prefix which is used for accessing the content of the dll.
*/
scope?: string;
/**
* How the dll is exposed (libraryTarget, defaults to manifest.type).
*/
sourceType?: DllReferencePluginOptionsSourceType;
/**
* The way how the export of the dll bundle is used.
*/
type?: "require" | "object";
} | {
/**
* The mappings from request to module info.
*/
content: DllReferencePluginOptionsContent;
/**
* Context of requests in the manifest (or content property) as absolute path.
*/
context?: string;
/**
* Extensions used to resolve modules in the dll bundle (only used when using 'scope').
*/
extensions?: string[];
/**
* The name where the dll is exposed (external name).
*/
name: string;
/**
* Prefix which is used for accessing the content of the dll.
*/
scope?: string;
/**
* How the dll is exposed (libraryTarget).
*/
sourceType?: DllReferencePluginOptionsSourceType;
/**
* The way how the export of the dll bundle is used.
*/
type?: "require" | "object";
};
/**
* The type how the dll is exposed (external type).
*/
export type DllReferencePluginOptionsSourceType = "var" | "assign" | "this" | "window" | "global" | "commonjs" | "commonjs2" | "commonjs-module" | "amd" | "amd-require" | "umd" | "umd2" | "jsonp" | "system";
/**
* An object containing content, name and type.
*/
export interface DllReferencePluginOptionsManifest {
/**
* The mappings from request to module info.
*/
content: DllReferencePluginOptionsContent;
/**
* The name where the dll is exposed (external name).
*/
name?: string;
/**
* The type how the dll is exposed (external type).
*/
type?: DllReferencePluginOptionsSourceType;
}
/**
* The mappings from request to module info.
*/
export interface DllReferencePluginOptionsContent {
/**
* Module info.
*/
[k: string]: {
/**
* Meta information about the module.
*/
buildMeta?: JsBuildMeta;
/**
* Information about the provided exports of the module.
*/
exports?: string[] | true;
/**
* Module ID.
*/
id?: string | number;
};
}
export declare class DllReferencePlugin {
private options;
private errors;
constructor(options: DllReferencePluginOptions);
apply(compiler: Compiler): void;
}

View File

@@ -0,0 +1,33 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/EntryOptionPlugin.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import type { Compiler, EntryDescriptionNormalized, EntryNormalized } from "..";
import type { EntryOptions } from "../builtin-plugin";
export declare class EntryOptionPlugin {
/**
* @param compiler the compiler instance one is tapping into
* @returns
*/
apply(compiler: Compiler): void;
/**
* @param compiler the compiler
* @param context context directory
* @param entry request
* @returns
*/
static applyEntryOption(compiler: Compiler, context: string, entry: EntryNormalized): void;
/**
* @param compiler the compiler
* @param name entry name
* @param desc entry description
* @returns options for the entry
*/
static entryDescriptionToOptions(compiler: Compiler, name: string, desc: EntryDescriptionNormalized): EntryOptions;
}
export default EntryOptionPlugin;

View File

@@ -0,0 +1,22 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/EnvironmentPlugin.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import type { Compiler } from "../Compiler";
declare class EnvironmentPlugin {
keys: string[];
defaultValues: Record<string, string | undefined | null>;
constructor(...keys: string[] | [Record<string, string | undefined | null> | string | string[]]);
/**
* Apply the plugin
* @param compiler the compiler instance
* @returns
*/
apply(compiler: Compiler): void;
}
export { EnvironmentPlugin };

View File

@@ -0,0 +1,40 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/HookWebpackError.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import type { Callback } from "@rspack/lite-tapable";
import WebpackError from "./WebpackError";
export declare class HookWebpackError extends WebpackError {
hook: string;
error: Error;
/**
* Creates an instance of HookWebpackError.
* @param error inner error
* @param hook name of hook
*/
constructor(error: Error, hook: string);
}
export default HookWebpackError;
/**
* @param error an error
* @param hook name of the hook
* @returns a webpack error
*/
export declare const makeWebpackError: (error: Error, hook: string) => WebpackError;
/**
* @param callback webpack error callback
* @param hook name of hook
* @returns generic callback
*/
export declare const makeWebpackErrorCallback: <T>(callback: (error?: WebpackError | null, result?: T) => void, hook: string) => Callback<Error, T>;
/**
* @param fn function which will be wrapping in try catch
* @param hook name of hook
* @returns the result
*/
export declare const tryRunOrWebpackError: <T>(fn: () => T, hook: string) => T;

View File

@@ -0,0 +1,25 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/IgnoreWarningsPlugin.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import type { Compiler, IgnoreWarningsNormalized, RspackPluginInstance } from "..";
declare class IgnoreWarningsPlugin implements RspackPluginInstance {
_ignorePattern: IgnoreWarningsNormalized;
name: string;
/**
* @param ignoreWarnings conditions to ignore warnings
*/
constructor(ignorePattern: IgnoreWarningsNormalized);
/**
* Apply the plugin
* @param compiler the compiler instance
* @returns
*/
apply(compiler: Compiler): void;
}
export default IgnoreWarningsPlugin;

View File

@@ -0,0 +1,28 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/LoaderOptionsPlugin.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import type { Compiler } from "../Compiler";
import type { MatchObject } from "./ModuleFilenameHelpers";
type LoaderOptionsPluginOptions = MatchObject & {
[key: string]: unknown;
};
export declare class LoaderOptionsPlugin {
options: LoaderOptionsPluginOptions;
/**
* @param options options object
*/
constructor(options?: LoaderOptionsPluginOptions);
/**
* Apply the plugin
* @param compiler the compiler instance
* @returns
*/
apply(compiler: Compiler): void;
}
export {};

View File

@@ -0,0 +1,24 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/LoaderTargetPlugin.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import type { Compiler } from "../Compiler";
import type { Target } from "../config";
export declare class LoaderTargetPlugin {
readonly target: Target;
/**
* @param target the target
*/
constructor(target: Target);
/**
* Apply the plugin
* @param compiler the compiler instance
* @returns
*/
apply(compiler: Compiler): void;
}

View File

@@ -0,0 +1,53 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/ModuleFilenameHelpers.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
type Matcher = string | RegExp | (string | RegExp)[];
/**
* Returns a function that returns the string with the token replaced with the replacement
* @example
* ```js
* const test = asRegExp("test");
* test.test("test"); // true
*
* const test2 = asRegExp(/test/);
* test2.test("test"); // true
* ```
*/
export declare const asRegExp: (test: string | RegExp) => RegExp;
export declare const matchPart: (str: string, test: Matcher) => boolean;
export interface MatchObject {
test?: Matcher;
include?: Matcher;
exclude?: Matcher;
}
/**
* Tests if a string matches a match object. The match object can have the following properties:
* - `test`: a RegExp or an array of RegExp
* - `include`: a RegExp or an array of RegExp
* - `exclude`: a RegExp or an array of RegExp
*
* The `test` property is tested first, then `include` and then `exclude`.
*
* @example
* ```js
* ModuleFilenameHelpers.matchObject({ test: "foo.js" }, "foo.js"); // true
* ModuleFilenameHelpers.matchObject({ test: /^foo/ }, "foo.js"); // true
* ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "foo.js"); // true
* ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "baz.js"); // false
* ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "foo.js"); // true
* ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "bar.js"); // false
* ModuleFilenameHelpers.matchObject({ include: /^foo/ }, "foo.js"); // true
* ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "foo.js"); // true
* ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "baz.js"); // false
* ModuleFilenameHelpers.matchObject({ exclude: "foo.js" }, "foo.js"); // false
* ModuleFilenameHelpers.matchObject({ exclude: [/^foo/, "bar"] }, "foo.js"); // false
* ```
*/
export declare const matchObject: (obj: MatchObject, str: string) => boolean;
export {};

21
node_modules/@rspack/core/dist/lib/WebpackError.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/WebpackError.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import type { DependencyLocation } from "@rspack/binding";
import type { Chunk } from "../Chunk";
import type { Module } from "../Module";
export declare class WebpackError extends Error {
loc?: DependencyLocation;
file?: string;
chunk?: Chunk;
module?: null | Module;
details?: string;
hideStack?: boolean;
}
export default WebpackError;

View File

@@ -0,0 +1,5 @@
import type { Compiler } from "../../Compiler";
export default class MemoryCachePlugin {
static PLUGIN_NAME: string;
apply(compiler: Compiler): void;
}

View File

@@ -0,0 +1,35 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/cache/getLazyHashedEtag.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import type Hash from "../../util/hash";
export type HashConstructor = typeof Hash;
export interface HashableObject {
updateHash(hash: Hash): void;
}
declare class LazyHashedEtag {
_obj: HashableObject;
_hash?: string;
_hashFunction: string | HashConstructor;
/**
* @param obj object with updateHash method
* @param hashFunction the hash function to use
*/
constructor(obj: HashableObject, hashFunction?: string | HashConstructor);
/**
* @returns hash of object
*/
toString(): string;
}
/**
* @param obj object with updateHash method
* @param ashFunction the hash function to use
* @returns etag
*/
export declare const getter: (obj: HashableObject, hashFunction?: string | HashConstructor) => LazyHashedEtag;
export default getter;

View File

@@ -0,0 +1,17 @@
/**
* The following code is modified based on
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/cache/mergeEtags.js
*
* MIT Licensed
* Author Tobias Koppers @sokra
* Copyright (c) JS Foundation and other contributors
* https://github.com/webpack/webpack/blob/main/LICENSE
*/
import type { Etag } from "../Cache";
/**
* @param first first
* @param second second
* @returns result
*/
export declare const mergeEtags: (first: Etag, second: Etag) => Etag;
export default mergeEtags;