Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rspack/core

Package Overview
Dependencies
Maintainers
0
Versions
1104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rspack/core - npm Package Compare versions

Comparing version 0.7.5-canary-08f2925-20240618102814 to 0.7.5-canary-0d03907-20240624125011

dist/RspackError.d.ts

4

dist/builtin-loader/swc/index.d.ts

@@ -1,3 +0,1 @@

export type { EmotionOptions } from "./emotion";
export { resolveEmotion } from "./emotion";
export { resolvePluginImport } from "./pluginImport";

@@ -9,4 +7,2 @@ export type { PluginImportOptions } from "./pluginImport";

export type { PreactOptions } from "./preact";
export type { RelayOptions } from "./relay";
export { resolveRelay } from "./relay";
export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig } from "./types";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveRelay = exports.resolvePreact = exports.resolveReact = exports.resolvePluginImport = exports.resolveEmotion = void 0;
var emotion_1 = require("./emotion");
Object.defineProperty(exports, "resolveEmotion", { enumerable: true, get: function () { return emotion_1.resolveEmotion; } });
exports.resolvePreact = exports.resolveReact = exports.resolvePluginImport = void 0;
var pluginImport_1 = require("./pluginImport");

@@ -12,3 +10,1 @@ Object.defineProperty(exports, "resolvePluginImport", { enumerable: true, get: function () { return pluginImport_1.resolvePluginImport; } });

Object.defineProperty(exports, "resolvePreact", { enumerable: true, get: function () { return preact_1.resolvePreact; } });
var relay_1 = require("./relay");
Object.defineProperty(exports, "resolveRelay", { enumerable: true, get: function () { return relay_1.resolveRelay; } });
type RawPreactOptions = {
library?: string;
};
type PreactOptions = RawPreactOptions | boolean | undefined;
declare function resolvePreact(preact: PreactOptions): RawPreactOptions | undefined;
export { resolvePreact };
export type { PreactOptions };
export type PreactOptions = RawPreactOptions | boolean | undefined;
export declare function resolvePreact(preact: PreactOptions): RawPreactOptions | undefined;
export {};

@@ -5,18 +5,5 @@ /**

*/
import type { EmotionOptions } from "./emotion";
import type { PluginImportOptions } from "./pluginImport";
import type { PreactOptions } from "./preact";
import type { ReactOptions } from "./react";
import type { RelayOptions } from "./relay";
export type StyledComponentsOptions = {
displayName?: boolean;
ssr?: boolean;
fileName?: boolean;
meaninglessFileNames?: string[];
namespace?: string;
topLevelImportPaths?: string[];
transpileTemplateLiterals?: boolean;
minify?: boolean;
pure?: boolean;
cssProps?: boolean;
};
export type JscTarget = "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "esnext";

@@ -458,7 +445,5 @@ export type SwcLoaderParserConfig = SwcLoaderTsParserConfig | SwcLoaderEsParserConfig;

rspackExperiments?: {
relay?: RelayOptions;
emotion?: EmotionOptions;
import?: PluginImportOptions;
styledComponents?: StyledComponentsOptions;
preact?: PreactOptions;
};
};

@@ -6,4 +6,4 @@ import type { RawCssExtractPluginOption } from "@rspack/binding";

export interface CssExtractRspackPluginOptions {
filename?: string;
chunkFilename?: string;
filename?: RawCssExtractPluginOption["filename"];
chunkFilename?: RawCssExtractPluginOption["chunkFilename"];
ignoreOrder?: boolean;

@@ -10,0 +10,0 @@ insert?: string | ((linkTag: HTMLLinkElement) => void);

@@ -1,10 +0,16 @@

import { BuiltinPluginName } from "@rspack/binding";
export declare const JavascriptModulesPlugin: {
new (): {
name: BuiltinPluginName;
_options: void;
affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
raw(): import("@rspack/binding").BuiltinPlugin;
apply(compiler: import("../Compiler").Compiler): void;
};
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
import { Compilation } from "../Compilation";
import * as liteTapable from "../lite-tapable";
import { RspackBuiltinPlugin } from "./base";
import Hash = require("../util/hash");
import { Chunk } from "../Chunk";
export type CompilationHooks = {
chunkHash: liteTapable.SyncHook<[Chunk, Hash]>;
};
export declare class JavascriptModulesPlugin extends RspackBuiltinPlugin {
name: BuiltinPluginName;
affectedHooks: "compilation";
constructor();
raw(): BuiltinPlugin;
static getCompilationHooks(compilation: Compilation): CompilationHooks;
}
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.JavascriptModulesPlugin = void 0;
const binding_1 = require("@rspack/binding");
const Compilation_1 = require("../Compilation");
const liteTapable = __importStar(require("../lite-tapable"));
const base_1 = require("./base");
exports.JavascriptModulesPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.JavascriptModulesPlugin, () => { }, "compilation");
const compilationHooksMap = new WeakMap();
class JavascriptModulesPlugin extends base_1.RspackBuiltinPlugin {
constructor() {
super();
this.name = binding_1.BuiltinPluginName.JavascriptModulesPlugin;
this.affectedHooks = "compilation";
}
raw() {
return (0, base_1.createBuiltinPlugin)(this.name, undefined);
}
static getCompilationHooks(compilation) {
if (!(compilation instanceof Compilation_1.Compilation)) {
throw new TypeError("The 'compilation' argument must be an instance of Compilation");
}
let hooks = compilationHooksMap.get(compilation);
if (hooks === undefined) {
hooks = {
chunkHash: new liteTapable.SyncHook(["chunk", "hash"])
};
compilationHooksMap.set(compilation, hooks);
}
return hooks;
}
}
exports.JavascriptModulesPlugin = JavascriptModulesPlugin;

@@ -6,15 +6,15 @@ import { type JsChunk, type JsCompilation } from "@rspack/binding";

#private;
name?: string;
id?: string;
ids: Array<string>;
idNameHints: Array<string>;
filenameTemplate?: string;
cssFilenameTemplate?: string;
files: Array<string>;
runtime: Array<string>;
hash?: string;
contentHash: Record<string, string>;
renderedHash?: string;
chunkReasons: Array<string>;
auxiliaryFiles: Array<string>;
name?: Readonly<string>;
id?: Readonly<string>;
ids: ReadonlyArray<string>;
idNameHints: ReadonlyArray<string>;
filenameTemplate?: Readonly<string>;
cssFilenameTemplate?: Readonly<string>;
files: ReadonlySet<string>;
runtime: ReadonlySet<string>;
hash?: Readonly<string>;
contentHash: Readonly<Record<string, string>>;
renderedHash?: Readonly<string>;
chunkReason?: Readonly<string>;
auxiliaryFiles: ReadonlySet<string>;
static __from_binding(chunk: JsChunk, compilation: Compilation): Chunk;

@@ -30,3 +30,8 @@ static __from_binding(chunk: JsChunk, compilation: JsCompilation): Chunk;

getAllReferencedChunks(): Iterable<Chunk>;
__internal_innerUkey(): number;
/**
* Note: This is not a webpack public API, maybe removed in future.
*
* @internal
*/
__internal__innerUkey(): number;
}

@@ -13,3 +13,3 @@ "use strict";

};
var _Chunk_inner, _Chunk_inner_compilation;
var _Chunk_inner, _Chunk_innerCompilation;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -30,5 +30,5 @@ exports.Chunk = void 0;

_Chunk_inner.set(this, void 0);
_Chunk_inner_compilation.set(this, void 0);
_Chunk_innerCompilation.set(this, void 0);
__classPrivateFieldSet(this, _Chunk_inner, chunk, "f");
__classPrivateFieldSet(this, _Chunk_inner_compilation, compilation, "f");
__classPrivateFieldSet(this, _Chunk_innerCompilation, compilation, "f");
this.name = chunk.name;

@@ -40,23 +40,23 @@ this.id = chunk.id;

this.cssFilenameTemplate = chunk.cssFilenameTemplate;
this.files = chunk.files;
this.runtime = chunk.runtime;
this.files = new Set(chunk.files);
this.runtime = new Set(chunk.runtime);
this.hash = chunk.hash;
this.contentHash = chunk.contentHash;
this.renderedHash = chunk.renderedHash;
this.chunkReasons = chunk.chunkReasons;
this.auxiliaryFiles = chunk.auxiliaryFiles;
this.chunkReason = chunk.chunkReason;
this.auxiliaryFiles = new Set(chunk.auxiliaryFiles);
}
isOnlyInitial() {
return (0, binding_1.__chunk_inner_is_only_initial)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f"));
return (0, binding_1.__chunk_inner_is_only_initial)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"));
}
canBeInitial() {
return (0, binding_1.__chunk_inner_can_be_initial)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f"));
return (0, binding_1.__chunk_inner_can_be_initial)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"));
}
hasRuntime() {
return (0, binding_1.__chunk_inner_has_runtime)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f"));
return (0, binding_1.__chunk_inner_has_runtime)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"));
}
get groupsIterable() {
const chunk_groups = __classPrivateFieldGet(this, _Chunk_inner, "f").__inner_groups.map(ukey => {
const cg = (0, binding_1.__chunk_group_inner_get_chunk_group)(ukey, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f"));
return ChunkGroup_1.ChunkGroup.__from_binding(cg, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f"));
const cg = (0, binding_1.__chunk_group_inner_get_chunk_group)(ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"));
return ChunkGroup_1.ChunkGroup.__from_binding(cg, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"));
});

@@ -67,11 +67,16 @@ chunk_groups.sort(comparators_1.compareChunkGroupsByIndex);

getAllAsyncChunks() {
return new Set((0, binding_1.__chunk_inner_get_all_async_chunks)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f")).map(c => Chunk.__from_binding(c, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f"))));
return new Set((0, binding_1.__chunk_inner_get_all_async_chunks)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f")).map(c => Chunk.__from_binding(c, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"))));
}
getAllInitialChunks() {
return new Set((0, binding_1.__chunk_inner_get_all_initial_chunks)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f")).map(c => Chunk.__from_binding(c, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f"))));
return new Set((0, binding_1.__chunk_inner_get_all_initial_chunks)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f")).map(c => Chunk.__from_binding(c, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"))));
}
getAllReferencedChunks() {
return new Set((0, binding_1.__chunk_inner_get_all_referenced_chunks)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f")).map(c => Chunk.__from_binding(c, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f"))));
return new Set((0, binding_1.__chunk_inner_get_all_referenced_chunks)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f")).map(c => Chunk.__from_binding(c, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"))));
}
__internal_innerUkey() {
/**
* Note: This is not a webpack public API, maybe removed in future.
*
* @internal
*/
__internal__innerUkey() {
return __classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey;

@@ -81,2 +86,2 @@ }

exports.Chunk = Chunk;
_Chunk_inner = new WeakMap(), _Chunk_inner_compilation = new WeakMap();
_Chunk_inner = new WeakMap(), _Chunk_innerCompilation = new WeakMap();

@@ -7,3 +7,3 @@ import { Chunk } from "./Chunk";

constructor(compilation: Compilation);
getChunkModules(chunk: Chunk): Module[];
getChunkModules(chunk: Chunk): Readonly<Module[]>;
getChunkModulesIterable(chunk: Chunk): Iterable<Module>;

@@ -10,0 +10,0 @@ getChunkEntryModulesIterable(chunk: Chunk): Iterable<Module>;

@@ -12,17 +12,17 @@ "use strict";

getChunkModules(chunk) {
return (0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal_innerUkey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation));
return (0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal__innerUkey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation));
}
getChunkModulesIterable(chunk) {
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal_innerUkey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal__innerUkey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
}
getChunkEntryModulesIterable(chunk) {
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_modules)(chunk.__internal_innerUkey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_modules)(chunk.__internal__innerUkey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
}
getChunkEntryDependentChunksIterable(chunk) {
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_dependent_chunks_iterable)(chunk.__internal_innerUkey(), this.compilation.__internal_getInner()).map(c => Chunk_1.Chunk.__from_binding(c, this.compilation.__internal_getInner())));
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_dependent_chunks_iterable)(chunk.__internal__innerUkey(), this.compilation.__internal_getInner()).map(c => Chunk_1.Chunk.__from_binding(c, this.compilation.__internal_getInner())));
}
getChunkModulesIterableBySourceType(chunk, sourceType) {
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules_iterable_by_source_type)(chunk.__internal_innerUkey(), sourceType, this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules_iterable_by_source_type)(chunk.__internal__innerUkey(), sourceType, this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
}
}
exports.ChunkGraph = ChunkGraph;

@@ -7,9 +7,19 @@ import { type JsChunkGroup, type JsCompilation } from "@rspack/binding";

protected constructor(inner: JsChunkGroup, compilation: JsCompilation);
getFiles(): string[];
getParents(): ChunkGroup[];
get chunks(): Chunk[];
get index(): number | undefined;
get name(): string | undefined;
__internal_innerUkey(): number;
__internal_innerCompilation(): JsCompilation;
getFiles(): ReadonlyArray<string>;
getParents(): ReadonlyArray<ChunkGroup>;
get chunks(): ReadonlyArray<Chunk>;
get index(): Readonly<number | undefined>;
get name(): Readonly<string | undefined>;
/**
* Note: This is not a webpack public API, maybe removed in future.
*
* @internal
*/
__internal__innerUkey(): number;
/**
* Note: This is not a webpack public API, maybe removed in future.
*
* @internal
*/
__internal__innerCompilation(): JsCompilation;
}

@@ -52,6 +52,16 @@ "use strict";

}
__internal_innerUkey() {
/**
* Note: This is not a webpack public API, maybe removed in future.
*
* @internal
*/
__internal__innerUkey() {
return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").__inner_ukey;
}
__internal_innerCompilation() {
/**
* Note: This is not a webpack public API, maybe removed in future.
*
* @internal
*/
__internal__innerCompilation() {
return __classPrivateFieldGet(this, _ChunkGroup_innerCompilation, "f");

@@ -58,0 +68,0 @@ }

@@ -1,2 +0,1 @@

/// <reference types="node" />
/**

@@ -11,3 +10,4 @@ * The following code is modified based on

*/
import type { ExternalObject, JsCompilation, JsModule, JsPathData, JsRuntimeModule, JsStatsError, JsStatsWarning } from "@rspack/binding";
import type * as binding from "@rspack/binding";
import { type ExternalObject, type JsCompilation, type JsModule, type JsPathData, type JsRuntimeModule } from "@rspack/binding";
import * as tapable from "tapable";

@@ -30,3 +30,4 @@ import { Source } from "webpack-sources";

import { type AssetInfo } from "./util/AssetInfo";
import MergeCaller from "./util/MergeCaller";
import Hash = require("./util/hash");
import { RspackError } from "./RspackError";
export { type AssetInfo } from "./util/AssetInfo";

@@ -107,3 +108,3 @@ export type Assets = Record<string, Source>;

#private;
hooks: {
hooks: Readonly<{
processAssets: liteTapable.AsyncSeriesHook<Assets>;

@@ -125,2 +126,3 @@ afterProcessAssets: liteTapable.SyncHook<Assets>;

finishModules: liteTapable.AsyncSeriesHook<[Iterable<Module>], void>;
chunkHash: liteTapable.SyncHook<[Chunk, Hash], void>;
chunkAsset: liteTapable.SyncHook<[Chunk, string], void>;

@@ -148,3 +150,3 @@ processWarnings: tapable.SyncWaterfallHook<[Error[]]>;

afterSeal: liteTapable.AsyncSeriesHook<[], void>;
};
}>;
name?: string;

@@ -166,9 +168,4 @@ startTime?: number;

constructor(compiler: Compiler, inner: JsCompilation);
get currentNormalModuleHooks(): {
loader: tapable.SyncHook<[import("./config").LoaderContext<{}>], void, tapable.UnsetAdditionalOptions>;
readResourceForScheme: any;
readResource: tapable.HookMap<tapable.AsyncSeriesBailHook<[import("./config").LoaderContext<{}>], string | Buffer, tapable.UnsetAdditionalOptions>>;
};
get hash(): string | null;
get fullHash(): string | null;
get hash(): Readonly<string | null>;
get fullHash(): Readonly<string | null>;
/**

@@ -182,4 +179,4 @@ * Get a map of all assets.

get entrypoints(): ReadonlyMap<string, Entrypoint>;
get modules(): Module[];
get chunks(): Chunk[];
get modules(): ReadonlySet<Module>;
get chunks(): ReadonlySet<Chunk>;
/**

@@ -190,3 +187,3 @@ * Get the named chunks.

*/
get namedChunks(): Map<string, Readonly<Chunk>>;
get namedChunks(): ReadonlyMap<string, Readonly<Chunk>>;
/**

@@ -231,3 +228,3 @@ * Note: This is not a webpack public API, maybe removed in future.

*/
__internal__pushDiagnostic(severity: "error" | "warning", title: string, message: string): void;
__internal__pushDiagnostic(diagnostic: binding.JsDiagnostic): void;
/**

@@ -239,8 +236,8 @@ * Note: This is not a webpack public API, maybe removed in future.

__internal__pushNativeDiagnostics(diagnostics: ExternalObject<"Diagnostic[]">): void;
get errors(): JsStatsError[];
get warnings(): JsStatsWarning[];
get errors(): RspackError[];
get warnings(): RspackError[];
getPath(filename: Filename, data?: PathData): string;
getPathWithInfo(filename: Filename, data?: PathData): import("@rspack/binding").PathWithInfo;
getPathWithInfo(filename: Filename, data?: PathData): binding.PathWithInfo;
getAssetPath(filename: Filename, data?: PathData): string;
getAssetPathWithInfo(filename: Filename, data?: PathData): import("@rspack/binding").PathWithInfo;
getAssetPathWithInfo(filename: Filename, data?: PathData): binding.PathWithInfo;
getLogger(name: string | (() => string)): Logger;

@@ -273,3 +270,2 @@ fileDependencies: {

createChildCompiler(name: string, outputOptions: OutputNormalized, plugins: RspackPluginInstance[]): Compiler;
_rebuildModuleCaller: MergeCaller<[string, (err: Error, m: Module) => void]>;
rebuildModule(m: Module, f: (err: Error, m: Module) => void): void;

@@ -333,3 +329,3 @@ /**

*/
__internal_getInner(): JsCompilation;
__internal_getInner(): binding.JsCompilation;
seal(): void;

@@ -336,0 +332,0 @@ unseal(): void;

@@ -39,5 +39,6 @@ "use strict";

};
var _Compilation_instances, _Compilation_inner, _Compilation_cachedAssets, _Compilation_customModules, _Compilation_createCachedAssets;
var _Compilation_instances, _Compilation_inner, _Compilation_cachedAssets, _Compilation_customModules, _Compilation_createCachedAssets, _Compilation_rebuildModuleCaller;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Compilation = void 0;
const binding_1 = require("@rspack/binding");
const tapable = __importStar(require("tapable"));

@@ -50,3 +51,2 @@ const liteTapable = __importStar(require("./lite-tapable"));

const Module_1 = require("./Module");
const NormalModule_1 = require("./NormalModule");
const Stats_1 = require("./Stats");

@@ -56,3 +56,2 @@ const Logger_1 = require("./logging/Logger");

const StatsPrinter_1 = require("./stats/StatsPrinter");
const util_1 = require("./util");
const AssetInfo_1 = require("./util/AssetInfo");

@@ -63,2 +62,3 @@ const MergeCaller_1 = __importDefault(require("./util/MergeCaller"));

const source_1 = require("./util/source");
const RspackError_1 = require("./RspackError");
class Compilation {

@@ -84,3 +84,3 @@ constructor(compiler, inner) {

this.buildDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getBuildDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addBuildDependencies(d));
this._rebuildModuleCaller = (function (compilation) {
_Compilation_rebuildModuleCaller.set(this, (function (compilation) {
return new MergeCaller_1.default((args) => {

@@ -99,3 +99,3 @@ __classPrivateFieldGet(compilation, _Compilation_inner, "f").rebuildModule(args.map(item => item[0]), function (err, modules) {

}, 10);
})(this);
})(this));
__classPrivateFieldSet(this, _Compilation_inner, inner, "f");

@@ -154,2 +154,3 @@ __classPrivateFieldSet(this, _Compilation_cachedAssets, __classPrivateFieldGet(this, _Compilation_instances, "m", _Compilation_createCachedAssets).call(this), "f");

finishModules: new liteTapable.AsyncSeriesHook(["modules"]),
chunkHash: new liteTapable.SyncHook(["chunk", "hash"]),
chunkAsset: new liteTapable.SyncHook(["chunk", "filename"]),

@@ -182,5 +183,2 @@ processWarnings: new tapable.SyncWaterfallHook(["warnings"]),

}
get currentNormalModuleHooks() {
return NormalModule_1.NormalModule.getCompilationHooks(this);
}
get hash() {

@@ -208,11 +206,6 @@ return __classPrivateFieldGet(this, _Compilation_inner, "f").hash;

get modules() {
return (0, memoize_1.memoizeValue)(() => {
return this.__internal__getModules().map(item => Module_1.Module.__from_binding(item, this));
});
return (0, memoize_1.memoizeValue)(() => new Set(this.__internal__getModules().map(item => Module_1.Module.__from_binding(item, this))));
}
// FIXME: Webpack returns a `Set`
get chunks() {
return (0, memoize_1.memoizeValue)(() => {
return this.__internal__getChunks();
});
return (0, memoize_1.memoizeValue)(() => new Set(this.__internal__getChunks()));
}

@@ -359,4 +352,4 @@ /**

*/
__internal__pushDiagnostic(severity, title, message) {
__classPrivateFieldGet(this, _Compilation_inner, "f").pushDiagnostic(severity, title, message);
__internal__pushDiagnostic(diagnostic) {
__classPrivateFieldGet(this, _Compilation_inner, "f").pushDiagnostic(diagnostic);
}

@@ -373,3 +366,3 @@ /**

const inner = __classPrivateFieldGet(this, _Compilation_inner, "f");
const errors = inner.getStats().getErrors();
const errors = inner.getErrors();
const proxyMethod = [

@@ -381,3 +374,3 @@ {

const error = errs[i];
inner.pushDiagnostic("error", error instanceof Error ? error.name : "Error", (0, util_1.concatErrorMsgAndStack)(error));
inner.pushDiagnostic(RspackError_1.JsDiagnostic.__to_binding(error, binding_1.JsRspackSeverity.Error));
}

@@ -405,7 +398,3 @@ return Reflect.apply(target, thisArg, errs);

const errList = errs.map(error => {
return {
severity: "error",
title: error instanceof Error ? error.name : "Error",
message: (0, util_1.concatErrorMsgAndStack)(error)
};
return RspackError_1.JsDiagnostic.__to_binding(error, binding_1.JsRspackSeverity.Error);
});

@@ -420,7 +409,3 @@ inner.spliceDiagnostic(0, 0, errList);

const errList = errors.map(error => {
return {
severity: "error",
title: error instanceof Error ? error.name : "Error",
message: (0, util_1.concatErrorMsgAndStack)(error)
};
return RspackError_1.JsDiagnostic.__to_binding(error, binding_1.JsRspackSeverity.Error);
});

@@ -447,3 +432,3 @@ inner.spliceDiagnostic(startIdx, startIdx + delCount, errList);

const processWarningsHook = this.hooks.processWarnings;
const warnings = inner.getStats().getWarnings();
const warnings = inner.getWarnings();
const proxyMethod = [

@@ -456,3 +441,3 @@ {

const warn = warns[i];
inner.pushDiagnostic("warning", warn instanceof Error ? warn.name : "Warning", (0, util_1.concatErrorMsgAndStack)(warn));
inner.pushDiagnostic(RspackError_1.JsDiagnostic.__to_binding(warn, binding_1.JsRspackSeverity.Warn));
}

@@ -481,7 +466,3 @@ return Reflect.apply(target, thisArg, warns);

const warnList = warns.map(warn => {
return {
severity: "warning",
title: warn instanceof Error ? warn.name : "Warning",
message: (0, util_1.concatErrorMsgAndStack)(warn)
};
return RspackError_1.JsDiagnostic.__to_binding(warn, binding_1.JsRspackSeverity.Warn);
});

@@ -497,7 +478,3 @@ inner.spliceDiagnostic(0, 0, warnList);

const warnList = warns.map(warn => {
return {
severity: "warning",
title: warn instanceof Error ? warn.name : "Warning",
message: (0, util_1.concatErrorMsgAndStack)(warn)
};
return RspackError_1.JsDiagnostic.__to_binding(warn, binding_1.JsRspackSeverity.Warn);
});

@@ -640,3 +617,3 @@ inner.spliceDiagnostic(startIdx, startIdx + delCount, warnList);

rebuildModule(m, f) {
this._rebuildModuleCaller.push([m.identifier(), f]);
__classPrivateFieldGet(this, _Compilation_rebuildModuleCaller, "f").push([m.identifier(), f]);
}

@@ -726,3 +703,3 @@ /**

}
_Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_customModules = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
_Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_customModules = new WeakMap(), _Compilation_rebuildModuleCaller = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
return new Proxy({}, {

@@ -729,0 +706,0 @@ get: (_, property) => {

@@ -80,2 +80,3 @@ "use strict";

const bindingVersionCheck_1 = require("./util/bindingVersionCheck");
const createHash_1 = require("./util/createHash");
const identifier_1 = require("./util/identifier");

@@ -655,6 +656,14 @@ class Compiler {

registerCompilationFinishModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationFinishModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.finishModules, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f").modules)),
registerCompilationOptimizeModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.optimizeModules, queried => () => queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f").modules)),
registerCompilationAfterOptimizeModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterOptimizeModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.afterOptimizeModules, queried => () => queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f").modules)),
registerCompilationOptimizeModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.optimizeModules, queried => () => queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f").modules.values())),
registerCompilationAfterOptimizeModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterOptimizeModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.afterOptimizeModules, queried => () => {
queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f").modules.values());
}),
registerCompilationOptimizeTreeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeTree, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.optimizeTree, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f").chunks, __classPrivateFieldGet(this, _Compiler_compilation, "f").modules)),
registerCompilationOptimizeChunkModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeChunkModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.optimizeChunkModules, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f").chunks, __classPrivateFieldGet(this, _Compiler_compilation, "f").modules)),
registerCompilationChunkHashTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationChunkHash, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.chunkHash, queried => (chunk) => {
const hash = (0, createHash_1.createHash)(this.options.output.hashFunction);
queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), hash);
const digestResult = hash.digest(this.options.output.hashDigest);
return Buffer.from(digestResult);
}),
registerCompilationChunkAssetTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationChunkAsset, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.chunkAsset, queried => ({ chunk, filename }) => queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), filename)),

@@ -733,2 +742,9 @@ registerCompilationProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationProcessAssets, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.processAssets, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f").assets)),

return result;
}),
registerJavascriptModulesChunkHashTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.JavascriptModulesChunkHash, () => builtin_plugin_1.JavascriptModulesPlugin.getCompilationHooks(__classPrivateFieldGet(this, _Compiler_compilation, "f"))
.chunkHash, queried => (chunk) => {
const hash = (0, createHash_1.createHash)(this.options.output.hashFunction);
queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), hash);
const digestResult = hash.digest(this.options.output.hashDigest);
return Buffer.from(digestResult);
})

@@ -735,0 +751,0 @@ }, "f");

@@ -88,5 +88,14 @@ "use strict";

}
function getRawTsConfig(tsConfig) {
(0, assert_1.default)(typeof tsConfig !== "string", "should resolve string tsConfig in normalization");
if (tsConfig === undefined)
return tsConfig;
const { configFile, references } = tsConfig;
return {
configFile,
referencesType: references == "auto" ? "auto" : references ? "manual" : "disabled",
references: references == "auto" ? undefined : references
};
}
function getRawResolve(resolve) {
let references = resolve.tsConfig?.references;
let tsconfigConfigFile = resolve.tsConfigPath ?? resolve.tsConfig?.configFile;
return {

@@ -97,9 +106,3 @@ ...resolve,

extensionAlias: getRawExtensionAlias(resolve.extensionAlias),
tsconfig: tsconfigConfigFile
? {
configFile: tsconfigConfigFile,
referencesType: references == "auto" ? "auto" : references ? "manual" : "disabled",
references: references == "auto" ? undefined : references
}
: undefined,
tsconfig: getRawTsConfig(resolve.tsConfig),
byDependency: getRawResolveByDependency(resolve.byDependency)

@@ -469,5 +472,15 @@ };

: parser.reexportExportsPresence,
strictExportPresence: parser.strictExportPresence ?? false
strictExportPresence: parser.strictExportPresence ?? false,
worker: getRawJavascriptParserOptionsWorker(parser.worker)
};
}
function getRawJavascriptParserOptionsWorker(worker) {
const DEFAULT_SYNTAX = [
"Worker",
"SharedWorker",
// "navigator.serviceWorker.register()",
"Worker from worker_threads"
];
return (worker === false ? [] : Array.isArray(worker) ? worker : ["..."]).flatMap(item => (item === "..." ? DEFAULT_SYNTAX : item));
}
function getRawAssetParserOptions(parser) {

@@ -474,0 +487,0 @@ return {

@@ -19,16 +19,5 @@ "use strict";

let expr = o.rspackExperiments;
const contextPath = options.context;
const production = options.mode === "production" || !options.mode;
if (expr.emotion) {
expr.emotion = (0, builtin_loader_1.resolveEmotion)(expr.emotion, production);
}
if (expr.relay) {
expr.relay = (0, builtin_loader_1.resolveRelay)(expr.relay, contextPath);
}
if (expr.import || expr.pluginImport) {
expr.import = (0, builtin_loader_1.resolvePluginImport)(expr.import || expr.pluginImport);
}
if (expr.react) {
expr.react = (0, builtin_loader_1.resolveReact)(expr.react);
}
if (expr.preact) {

@@ -35,0 +24,0 @@ expr.preact = (0, builtin_loader_1.resolvePreact)(expr.preact);

@@ -158,2 +158,3 @@ "use strict";

D(parserOptions, "strictExportPresence", fallback?.strictExportPresence ?? false);
D(parserOptions, "worker", fallback?.worker ?? ["..."]);
};

@@ -160,0 +161,0 @@ const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }) => {

@@ -126,6 +126,16 @@ "use strict";

resolve: nestedConfig(config.resolve, resolve => ({
...resolve
...resolve,
tsConfig: optionalNestedConfig(resolve.tsConfig, tsConfig => {
return typeof tsConfig === "string"
? { configFile: tsConfig }
: tsConfig;
})
})),
resolveLoader: nestedConfig(config.resolveLoader, resolve => ({
...resolve
...resolve,
tsConfig: optionalNestedConfig(resolve.tsConfig, tsConfig => {
return typeof tsConfig === "string"
? { configFile: tsConfig }
: tsConfig;
})
})),

@@ -132,0 +142,0 @@ module: nestedConfig(config.module, module => ({

@@ -233,6 +233,7 @@ "use strict";

.or(zod_1.z.array(zod_1.z.string().or(zod_1.z.literal(false)))));
const resolveTsconfig = zod_1.z.strictObject({
configFile: zod_1.z.string(),
const resolveTsConfigFile = zod_1.z.string();
const resolveTsConfig = resolveTsConfigFile.or(zod_1.z.strictObject({
configFile: resolveTsConfigFile,
references: zod_1.z.array(zod_1.z.string()).or(zod_1.z.literal("auto")).optional()
});
}));
const baseResolveOptions = zod_1.z.strictObject({

@@ -252,4 +253,3 @@ alias: resolveAlias.optional(),

descriptionFiles: zod_1.z.array(zod_1.z.string()).optional(),
tsConfigPath: zod_1.z.string().optional(),
tsConfig: resolveTsconfig.optional(),
tsConfig: resolveTsConfig.optional(),
fullySpecified: zod_1.z.boolean().optional(),

@@ -350,2 +350,3 @@ exportsFields: zod_1.z.array(zod_1.z.string()).optional(),

const strictExportPresence = zod_1.z.boolean();
const worker = zod_1.z.array(zod_1.z.string()).or(zod_1.z.boolean());
const javascriptParserOptions = zod_1.z.strictObject({

@@ -361,3 +362,4 @@ dynamicImportMode: dynamicImportMode.optional(),

reexportExportsPresence: reexportExportsPresence.optional(),
strictExportPresence: strictExportPresence.optional()
strictExportPresence: strictExportPresence.optional(),
worker: worker.optional()
});

@@ -364,0 +366,0 @@ const parserOptionsByModuleTypeKnown = zod_1.z.strictObject({

@@ -7,3 +7,3 @@ import { type JsChunkGroup, type JsCompilation } from "@rspack/binding";

protected constructor(inner: JsChunkGroup, compilation: JsCompilation);
getRuntimeChunk(): Chunk | null;
getRuntimeChunk(): Readonly<Chunk | null>;
}

@@ -15,5 +15,5 @@ "use strict";

getRuntimeChunk() {
const c = (0, binding_1.__entrypoint_inner_get_runtime_chunk)(this.__internal_innerUkey(), this.__internal_innerCompilation());
const c = (0, binding_1.__entrypoint_inner_get_runtime_chunk)(this.__internal__innerUkey(), this.__internal__innerCompilation());
if (c)
return Chunk_1.Chunk.__from_binding(c, this.__internal_innerCompilation());
return Chunk_1.Chunk.__from_binding(c, this.__internal__innerCompilation());
return null;

@@ -20,0 +20,0 @@ }

@@ -90,5 +90,6 @@ declare const rspackVersion: any, webpackVersion: any;

export declare const wasm: Wasm;
import { EnableChunkLoadingPlugin } from "./builtin-plugin";
import { EnableChunkLoadingPlugin, JavascriptModulesPlugin } from "./builtin-plugin";
interface JavaScript {
EnableChunkLoadingPlugin: typeof EnableChunkLoadingPlugin;
JavascriptModulesPlugin: typeof JavascriptModulesPlugin;
}

@@ -95,0 +96,0 @@ export declare const javascript: JavaScript;

@@ -120,3 +120,6 @@ "use strict";

const builtin_plugin_15 = require("./builtin-plugin");
exports.javascript = { EnableChunkLoadingPlugin: builtin_plugin_15.EnableChunkLoadingPlugin };
exports.javascript = {
EnableChunkLoadingPlugin: builtin_plugin_15.EnableChunkLoadingPlugin,
JavascriptModulesPlugin: builtin_plugin_15.JavascriptModulesPlugin
};
const builtin_plugin_16 = require("./builtin-plugin");

@@ -123,0 +126,0 @@ exports.webworker = { WebWorkerTemplatePlugin: builtin_plugin_16.WebWorkerTemplatePlugin };

@@ -35,2 +35,3 @@ "use strict";

const NormalModule_1 = require("../NormalModule");
const RspackError_1 = require("../RspackError");
const adapterRuleUse_1 = require("../config/adapterRuleUse");

@@ -521,10 +522,30 @@ const util_2 = require("../util");

loaderContext.emitError = function emitError(error) {
const title = "Module Error";
const message = error instanceof Error ? (0, util_2.concatErrorMsgAndStack)(error) : error;
compiler._lastCompilation.__internal__pushDiagnostic("error", title, `${message}\n(from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`);
if (!(error instanceof Error)) {
error = new RspackError_1.NonErrorEmittedError(error);
}
let hasStack = !!error.stack;
error.name = "ModuleError";
error.message = `${error.message} (from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`;
hasStack && Error.captureStackTrace(error);
error = (0, util_2.concatErrorMsgAndStack)(error);
error.moduleIdentifier = this._module.identifier();
compiler._lastCompilation.__internal__pushDiagnostic({
error,
severity: binding_1.JsRspackSeverity.Error
});
};
loaderContext.emitWarning = function emitWarning(warning) {
const title = "Module Warning";
const message = warning instanceof Error ? (0, util_2.concatErrorMsgAndStack)(warning) : warning;
compiler._lastCompilation.__internal__pushDiagnostic("warning", title, `${message}\n(from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`);
if (!(warning instanceof Error)) {
warning = new RspackError_1.NonErrorEmittedError(warning);
}
let hasStack = !!warning.stack;
warning.name = "ModuleWarning";
warning.message = `${warning.message} (from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`;
hasStack && Error.captureStackTrace(warning);
warning = (0, util_2.concatErrorMsgAndStack)(warning);
warning.moduleIdentifier = this._module.identifier();
compiler._lastCompilation.__internal__pushDiagnostic({
error: warning,
severity: binding_1.JsRspackSeverity.Warn
});
};

@@ -531,0 +552,0 @@ loaderContext.emitFile = function emitFile(name, content, sourceMap, assetInfo) {

@@ -1,2 +0,2 @@

import { JsCodegenerationResult, JsCodegenerationResults, JsCreateData, JsModule } from "@rspack/binding";
import { JsCodegenerationResult, JsCodegenerationResults, JsCreateData, JsFactoryMeta, JsModule } from "@rspack/binding";
import { Source } from "webpack-sources";

@@ -35,7 +35,8 @@ import { Compilation } from "./Compilation";

#private;
context?: string;
resource?: string;
request?: string;
userRequest?: string;
rawRequest?: string;
context?: Readonly<string>;
resource?: Readonly<string>;
request?: Readonly<string>;
userRequest?: Readonly<string>;
rawRequest?: Readonly<string>;
factoryMeta?: Readonly<JsFactoryMeta>;
/**

@@ -42,0 +43,0 @@ * Records the dynamically added fields for Module on the JavaScript side.

@@ -30,2 +30,3 @@ "use strict";

this.rawRequest = module.rawRequest;
this.factoryMeta = module.factoryMeta;
const customModule = compilation?.__internal__getCustomModule(module.moduleIdentifier);

@@ -32,0 +33,0 @@ this.buildInfo = customModule?.buildInfo || {};

@@ -6,3 +6,2 @@ /// <reference types="node" />

export declare class NormalModule {
constructor();
static getCompilationHooks(compilation: Compilation): {

@@ -9,0 +8,0 @@ loader: SyncHook<[LoaderContext<{}>], void, import("tapable").UnsetAdditionalOptions>;

@@ -49,6 +49,3 @@ "use strict";

};
// Actually it is just a NormalModule proxy, used for hooks api alignment
// Maybe we can 1:1 align to webpack NormalModule once we found a better way to reduce communicate overhead between rust and js
class NormalModule {
constructor() { }
static getCompilationHooks(compilation) {

@@ -62,5 +59,2 @@ if (!(compilation instanceof Compilation_1.Compilation)) {

loader: new tapable_1.SyncHook(["loaderContext"]),
// beforeLoaders: new SyncHook(["loaders", "module", "loaderContext"]),
// beforeParse: new SyncHook(["module"]),
// beforeSnapshot: new SyncHook(["module"]),
// TODO webpack 6 deprecate

@@ -76,3 +70,2 @@ readResourceForScheme: new tapable_1.HookMap(scheme => {

readResource: new tapable_1.HookMap(() => new tapable_1.AsyncSeriesBailHook(["loaderContext"]))
// needBuild: new AsyncSeriesBailHook(["module", "context"])
};

@@ -79,0 +72,0 @@ compilationHooksMap.set(compilation, hooks);

@@ -31,17 +31,5 @@ "use strict";

this.hooks = {
// /** @type {AsyncSeriesBailHook<[ResolveData], Module | false | void>} */
// resolve: new AsyncSeriesBailHook(["resolveData"]),
// /** @type {HookMap<AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>>} */
resolveForScheme: new liteTapable.HookMap(() => new liteTapable.AsyncSeriesBailHook(["resourceData"])),
// /** @type {HookMap<AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>>} */
// resolveInScheme: new HookMap(
// () => new AsyncSeriesBailHook(["resourceData", "resolveData"])
// ),
// /** @type {AsyncSeriesBailHook<[ResolveData], Module>} */
// factorize: new AsyncSeriesBailHook(["resolveData"]),
// /** @type {AsyncSeriesBailHook<[ResolveData], false | void>} */
beforeResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
// /** @type {AsyncSeriesBailHook<[ResolveData], false | void>} */
afterResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
// /** @type {AsyncSeriesBailHook<[ResolveData["createData"], ResolveData], Module | void>} */
createModule: new liteTapable.AsyncSeriesBailHook([

@@ -51,12 +39,2 @@ "createData",

])
// /** @type {SyncWaterfallHook<[Module, ResolveData["createData"], ResolveData], Module>} */
// module: new SyncWaterfallHook(["module", "createData", "resolveData"]),
// createParser: new HookMap(() => new SyncBailHook(["parserOptions"])),
// parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])),
// createGenerator: new HookMap(
// () => new SyncBailHook(["generatorOptions"])
// ),
// generator: new HookMap(
// () => new SyncHook(["generator", "generatorOptions"])
// )
};

@@ -63,0 +41,0 @@ }

@@ -1,2 +0,2 @@

import { Compilation } from ".";
import { Compilation } from "./Compilation";
import { StatsOptions, StatsValue } from "./config";

@@ -9,3 +9,3 @@ import type { StatsCompilation } from "./stats/statsFactoryUtils";

constructor(compilation: Compilation);
get hash(): string | null;
get hash(): Readonly<string | null>;
hasErrors(): boolean;

@@ -12,0 +12,0 @@ hasWarnings(): boolean;

@@ -280,3 +280,3 @@ "use strict";

}
}
},
// "compilation.modules": MODULES_SORTER,

@@ -287,3 +287,13 @@ // "chunk.rootModules": MODULES_SORTER,

// not support module.reasons (missing Module.identifier())
// not support chunk.origins (missing compilation.chunkGraph)
"chunk.origins": {
_: comparators => {
comparators.push(
// compareSelect(
// origin =>
// origin.module ? chunkGraph.getModuleId(origin.module) : undefined,
// compareIds
// ),
(0, comparators_1.compareSelect)((origin) => origin.loc, compareIds), (0, comparators_1.compareSelect)((origin) => origin.request, compareIds));
}
}
};

@@ -713,2 +723,6 @@ const SIMPLE_EXTRACTORS = {

object.childrenByOrder = chunk.childrenByOrder;
object.runtime = chunk.runtime;
object.sizes = Object.fromEntries(chunk.sizes.map(({ sourceType, size }) => [sourceType, size]));
object.reason = chunk.reason;
object.rendered = chunk.rendered;
},

@@ -726,2 +740,5 @@ ids: (object, chunk) => {

object.modules = factory.create(`${type}.modules`, chunk.modules, context);
},
chunkOrigins: (object, chunk, context, options, factory) => {
object.origins = chunk.origins;
}

@@ -728,0 +745,0 @@ }

@@ -360,3 +360,3 @@ "use strict";

// chunkInitial ? formatFlag("initial") : undefined,
// "error.file": (file, { bold }) => bold(file),
"error.file": (file, { bold }) => bold(file),
"error.moduleName": (moduleName, { bold }) => {

@@ -367,3 +367,3 @@ return moduleName.includes("!")

},
// "error.loc": (loc, { green }) => green(loc),
"error.loc": (loc, { green }) => green(loc),
"error.message": (message, { bold, formatError }) => message.includes("\u001b[") ? message : bold(formatError(message)),

@@ -370,0 +370,0 @@ // "error.details": (details, { formatError }) => formatError(details),

@@ -6,3 +6,5 @@ import * as binding from "@rspack/binding";

export type KnownStatsChunkGroup = binding.JsStatsChunkGroup;
export type KnownStatsChunk = binding.JsStatsChunk;
export type KnownStatsChunk = Omit<binding.JsStatsChunk, "sizes"> & {
sizes: Record<string, number>;
};
export type StatsChunkGroup = binding.JsStatsChunkGroup & Record<string, any>;

@@ -99,3 +101,3 @@ export type KnownStatsAsset = binding.JsStatsAsset;

moduleReason: ExtractorsByOption<binding.JsStatsModuleReason, StatsModuleReason>;
chunk: ExtractorsByOption<StatsChunk, KnownStatsChunk>;
chunk: ExtractorsByOption<binding.JsStatsChunk, KnownStatsChunk>;
};

@@ -102,0 +104,0 @@ export declare const uniqueArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>) => I[];

/// <reference types="node" />
import type { JsStatsError } from "@rspack/binding";
import type { JsRspackError, JsStatsError } from "@rspack/binding";
import { LoaderObject } from "../loader-runner";

@@ -13,3 +13,3 @@ export declare function mapValues(record: Record<string, string>, fn: (key: string) => string): {

export declare function isJsStatsError(err: any): err is JsStatsError;
export declare function concatErrorMsgAndStack(err: Error | JsStatsError | string): string;
export declare function concatErrorMsgAndStack(err: Error | JsRspackError | string): JsRspackError;
export declare function indent(str: string, prefix: string): string;

@@ -16,0 +16,0 @@ export declare function stringifyLoaderObject(o: LoaderObject): string;

@@ -64,8 +64,9 @@ "use strict";

if (typeof err === "string") {
return err;
return new Error(err);
}
if ("stack" in err) {
return err.stack || err.message;
err.message = err.stack || err.message;
return err;
}
return err.message;
return err;
}

@@ -72,0 +73,0 @@ exports.concatErrorMsgAndStack = concatErrorMsgAndStack;

@@ -40,3 +40,7 @@ "use strict";

get(_, property) {
return getValue()[property];
let res = getValue()[property];
if (typeof res === "function") {
res = res.bind(getValue());
}
return res;
},

@@ -43,0 +47,0 @@ set(_, property, newValue) {

{
"name": "@rspack/core",
"version": "0.7.5-canary-08f2925-20240618102814",
"version": "0.7.5-canary-0d03907-20240624125011",
"webpackVersion": "5.75.0",

@@ -9,2 +9,6 @@ "license": "MIT",

"types": "./dist/index.d.ts",
"publishConfig": {
"access": "public",
"provenance": true
},
"exports": {

@@ -78,4 +82,4 @@ ".": {

"zod-validation-error": "1.3.1",
"@rspack/core": "0.7.5-canary-08f2925-20240618102814",
"@rspack/plugin-minify": "^0.7.5-canary-08f2925-20240618102814"
"@rspack/plugin-minify": "^0.7.5-canary-0d03907-20240624125011",
"@rspack/core": "0.7.5-canary-0d03907-20240624125011"
},

@@ -87,3 +91,3 @@ "dependencies": {

"webpack-sources": "3.2.3",
"@rspack/binding": "0.7.5-canary-08f2925-20240618102814"
"@rspack/binding": "0.7.5-canary-0d03907-20240624125011"
},

@@ -90,0 +94,0 @@ "peerDependencies": {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc