@rspack/core
Advanced tools
Comparing version 0.7.5-canary-08f2925-20240618102814 to 0.7.5-canary-129960e-20240620181737
@@ -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: ReadonlyArray<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" /> | ||
/** | ||
@@ -29,3 +28,3 @@ * The following code is modified based on | ||
import { type AssetInfo } from "./util/AssetInfo"; | ||
import MergeCaller from "./util/MergeCaller"; | ||
import Hash = require("./util/hash"); | ||
export { type AssetInfo } from "./util/AssetInfo"; | ||
@@ -106,3 +105,3 @@ export type Assets = Record<string, Source>; | ||
#private; | ||
hooks: { | ||
hooks: Readonly<{ | ||
processAssets: liteTapable.AsyncSeriesHook<Assets>; | ||
@@ -124,2 +123,3 @@ afterProcessAssets: liteTapable.SyncHook<Assets>; | ||
finishModules: liteTapable.AsyncSeriesHook<[Iterable<Module>], void>; | ||
chunkHash: liteTapable.SyncHook<[Chunk, Hash], void>; | ||
chunkAsset: liteTapable.SyncHook<[Chunk, string], void>; | ||
@@ -147,3 +147,3 @@ processWarnings: tapable.SyncWaterfallHook<[Error[]]>; | ||
afterSeal: liteTapable.AsyncSeriesHook<[], void>; | ||
}; | ||
}>; | ||
name?: string; | ||
@@ -165,9 +165,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>; | ||
/** | ||
@@ -181,4 +176,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>; | ||
/** | ||
@@ -189,3 +184,3 @@ * Get the named chunks. | ||
*/ | ||
get namedChunks(): Map<string, Readonly<Chunk>>; | ||
get namedChunks(): ReadonlyMap<string, Readonly<Chunk>>; | ||
/** | ||
@@ -270,3 +265,2 @@ * Note: This is not a webpack public API, maybe removed in future. | ||
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; | ||
@@ -273,0 +267,0 @@ /** |
@@ -39,3 +39,3 @@ "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 }); | ||
@@ -50,3 +50,2 @@ exports.Compilation = void 0; | ||
const Module_1 = require("./Module"); | ||
const NormalModule_1 = require("./NormalModule"); | ||
const Stats_1 = require("./Stats"); | ||
@@ -82,3 +81,3 @@ const Logger_1 = require("./logging/Logger"); | ||
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) => { | ||
@@ -97,3 +96,3 @@ __classPrivateFieldGet(compilation, _Compilation_inner, "f").rebuildModule(args.map(item => item[0]), function (err, modules) { | ||
}, 10); | ||
})(this); | ||
})(this)); | ||
__classPrivateFieldSet(this, _Compilation_inner, inner, "f"); | ||
@@ -152,2 +151,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"]), | ||
@@ -180,5 +180,2 @@ processWarnings: new tapable.SyncWaterfallHook(["warnings"]), | ||
} | ||
get currentNormalModuleHooks() { | ||
return NormalModule_1.NormalModule.getCompilationHooks(this); | ||
} | ||
get hash() { | ||
@@ -206,11 +203,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())); | ||
} | ||
@@ -629,3 +621,3 @@ /** | ||
rebuildModule(m, f) { | ||
this._rebuildModuleCaller.push([m.identifier(), f]); | ||
__classPrivateFieldGet(this, _Compilation_rebuildModuleCaller, "f").push([m.identifier(), f]); | ||
} | ||
@@ -715,3 +707,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({}, { | ||
@@ -718,0 +710,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) | ||
@@ -106,0 +109,0 @@ }; |
@@ -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); |
@@ -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(), | ||
@@ -256,0 +256,0 @@ exportsFields: zod_1.z.array(zod_1.z.string()).optional(), |
@@ -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,7 +35,7 @@ import { JsCodegenerationResult, JsCodegenerationResults, JsCreateData, JsModule } from "@rspack/binding"; | ||
#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>; | ||
/** | ||
@@ -42,0 +42,0 @@ * Records the dynamically added fields for Module on the JavaScript side. |
@@ -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; |
@@ -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-129960e-20240620181737", | ||
"webpackVersion": "5.75.0", | ||
@@ -77,4 +77,4 @@ "license": "MIT", | ||
"zod-validation-error": "1.3.1", | ||
"@rspack/core": "0.7.5-canary-08f2925-20240618102814", | ||
"@rspack/plugin-minify": "^0.7.5-canary-08f2925-20240618102814" | ||
"@rspack/core": "0.7.5-canary-129960e-20240620181737", | ||
"@rspack/plugin-minify": "^0.7.5-canary-129960e-20240620181737" | ||
}, | ||
@@ -86,3 +86,3 @@ "dependencies": { | ||
"webpack-sources": "3.2.3", | ||
"@rspack/binding": "0.7.5-canary-08f2925-20240618102814" | ||
"@rspack/binding": "0.7.5-canary-129960e-20240620181737" | ||
}, | ||
@@ -89,0 +89,0 @@ "peerDependencies": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2592771
66372
384
+ Added@rspack/binding@0.7.5-canary-129960e-20240620181737(transitive)
+ Added@rspack/binding-darwin-arm64@0.7.5-canary-129960e-20240620181737(transitive)
+ Added@rspack/binding-darwin-x64@0.7.5-canary-129960e-20240620181737(transitive)
+ Added@rspack/binding-linux-arm64-gnu@0.7.5-canary-129960e-20240620181737(transitive)
+ Added@rspack/binding-linux-arm64-musl@0.7.5-canary-129960e-20240620181737(transitive)
+ Added@rspack/binding-linux-x64-gnu@0.7.5-canary-129960e-20240620181737(transitive)
+ Added@rspack/binding-linux-x64-musl@0.7.5-canary-129960e-20240620181737(transitive)
+ Added@rspack/binding-win32-arm64-msvc@0.7.5-canary-129960e-20240620181737(transitive)
+ Added@rspack/binding-win32-ia32-msvc@0.7.5-canary-129960e-20240620181737(transitive)
+ Added@rspack/binding-win32-x64-msvc@0.7.5-canary-129960e-20240620181737(transitive)
- Removed@rspack/binding@0.7.5-canary-08f2925-20240618102814(transitive)
- Removed@rspack/binding-darwin-arm64@0.7.5-canary-08f2925-20240618102814(transitive)
- Removed@rspack/binding-darwin-x64@0.7.5-canary-08f2925-20240618102814(transitive)
- Removed@rspack/binding-linux-arm64-gnu@0.7.5-canary-08f2925-20240618102814(transitive)
- Removed@rspack/binding-linux-arm64-musl@0.7.5-canary-08f2925-20240618102814(transitive)
- Removed@rspack/binding-linux-x64-gnu@0.7.5-canary-08f2925-20240618102814(transitive)
- Removed@rspack/binding-linux-x64-musl@0.7.5-canary-08f2925-20240618102814(transitive)
- Removed@rspack/binding-win32-arm64-msvc@0.7.5-canary-08f2925-20240618102814(transitive)
- Removed@rspack/binding-win32-ia32-msvc@0.7.5-canary-08f2925-20240618102814(transitive)
- Removed@rspack/binding-win32-x64-msvc@0.7.5-canary-08f2925-20240618102814(transitive)