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

@rspack/core

Package Overview
Dependencies
Maintainers
1
Versions
1108
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.2-canary-a1e014e-20240605042614 to 0.7.2-canary-c0c0fd3-20240607004432

dist/stats/DefaultStatsPresetPlugin.d.ts

2

dist/builtin-plugin/SplitChunksPlugin.js

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

else {
return name(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation));
return name(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation), getChunks(ctx.chunks), ctx.cacheGroupKey);
}

@@ -40,0 +40,0 @@ };

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

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

@@ -26,7 +26,8 @@ import { Source } from "webpack-sources";

import { NormalModuleFactory } from "./NormalModuleFactory";
import { Stats } from "./Stats";
import { Stats, StatsAsset, StatsError, StatsModule } from "./Stats";
import { StatsFactory } from "./stats/StatsFactory";
import { StatsPrinter } from "./stats/StatsPrinter";
import { type AssetInfo } from "./util/AssetInfo";
import MergeCaller from "./util/MergeCaller";
export type AssetInfo = Partial<JsAssetInfo> & Record<string, any>;
export { type AssetInfo } from "./util/AssetInfo";
export type Assets = Record<string, Source>;

@@ -36,3 +37,3 @@ export interface Asset {

source: Source;
info: JsAssetInfo;
info: AssetInfo;
}

@@ -65,3 +66,42 @@ export type PathData = JsPathData;

}
type CreateStatsOptionsContext = KnownCreateStatsOptionsContext & Record<string, any>;
export interface KnownNormalizedStatsOptions {
context: string;
chunksSort: string;
modulesSort: string;
chunkModulesSort: string;
nestedModulesSort: string;
assetsSort: string;
ids: boolean;
cachedAssets: boolean;
groupAssetsByEmitStatus: boolean;
groupAssetsByPath: boolean;
groupAssetsByExtension: boolean;
assetsSpace: number;
excludeAssets: ((value: string, asset: StatsAsset) => boolean)[];
excludeModules: ((name: string, module: StatsModule, type: "module" | "chunk" | "root-of-chunk" | "nested") => boolean)[];
warningsFilter: ((warning: StatsError, textValue: string) => boolean)[];
cachedModules: boolean;
orphanModules: boolean;
dependentModules: boolean;
runtimeModules: boolean;
groupModulesByCacheStatus: boolean;
groupModulesByLayer: boolean;
groupModulesByAttributes: boolean;
groupModulesByPath: boolean;
groupModulesByExtension: boolean;
groupModulesByType: boolean;
entrypoints: boolean | "auto";
chunkGroups: boolean;
chunkGroupAuxiliary: boolean;
chunkGroupChildren: boolean;
chunkGroupMaxAssets: number;
modulesSpace: number;
chunkModulesSpace: number;
nestedModulesSpace: number;
logging: false | "none" | "error" | "warn" | "info" | "log" | "verbose";
loggingDebug: ((value: string) => boolean)[];
loggingTrace: boolean;
}
export type CreateStatsOptionsContext = KnownCreateStatsOptionsContext & Record<string, any>;
export type NormalizedStatsOptions = KnownNormalizedStatsOptions & Omit<StatsOptions, keyof KnownNormalizedStatsOptions> & Record<string, any>;
export declare class Compilation {

@@ -90,2 +130,7 @@ #private;

stillValidModule: liteTapable.SyncHook<[Module], void>;
statsPreset: tapable.HookMap<tapable.SyncHook<[Partial<StatsOptions>, CreateStatsOptionsContext], void>>;
statsNormalize: tapable.SyncHook<[
Partial<StatsOptions>,
CreateStatsOptionsContext
], void>;
statsFactory: tapable.SyncHook<[StatsFactory, StatsOptions], void>;

@@ -154,3 +199,3 @@ statsPrinter: tapable.SyncHook<[StatsPrinter, StatsOptions], void>;

getCache(name: string): import("./lib/CacheFacade");
createStatsOptions(optionsOrPreset: StatsValue | undefined, context?: CreateStatsOptionsContext): StatsOptions;
createStatsOptions(optionsOrPreset: StatsValue | undefined, context?: CreateStatsOptionsContext): NormalizedStatsOptions;
createStatsFactory(options: StatsOptions): StatsFactory;

@@ -298,2 +343,1 @@ createStatsPrinter(options: StatsOptions): StatsPrinter;

}
export {};

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

const util_1 = require("./util");
const AssetInfo_1 = require("./util/AssetInfo");
const fake_1 = require("./util/fake");

@@ -152,2 +153,4 @@ const memoize_1 = require("./util/memoize");

stillValidModule: new liteTapable.SyncHook(["module"]),
statsPreset: new tapable.HookMap(() => new tapable.SyncHook(["options", "context"])),
statsNormalize: new tapable.SyncHook(["options", "context"]),
statsFactory: new tapable.SyncHook(["statsFactory", "options"]),

@@ -243,45 +246,25 @@ statsPrinter: new tapable.SyncHook(["statsPrinter", "options"]),

createStatsOptions(optionsOrPreset, context = {}) {
optionsOrPreset = (0, Stats_1.normalizeStatsPreset)(optionsOrPreset);
let options = {};
if (typeof optionsOrPreset === "boolean" ||
typeof optionsOrPreset === "string") {
optionsOrPreset = { preset: optionsOrPreset };
}
if (typeof optionsOrPreset === "object" && optionsOrPreset !== null) {
options = Object.assign({}, optionsOrPreset);
// We use this method of shallow cloning this object to include
// properties in the prototype chain
const options = {};
for (const key in optionsOrPreset) {
options[key] =
optionsOrPreset[key];
}
if (options.preset !== undefined) {
this.hooks.statsPreset.for(options.preset).call(options, context);
}
this.hooks.statsNormalize.call(options, context);
return options;
}
const all = options.all;
const optionOrLocalFallback = (v, def) => v !== undefined ? v : all !== undefined ? all : def;
options.assets = optionOrLocalFallback(options.assets, true);
options.chunks = optionOrLocalFallback(options.chunks, !context.forToString);
options.chunkModules = optionOrLocalFallback(options.chunkModules, !context.forToString);
options.chunkRelations = optionOrLocalFallback(options.chunkRelations, !context.forToString);
options.modules = optionOrLocalFallback(options.modules, true);
options.runtimeModules = optionOrLocalFallback(options.runtimeModules, !context.forToString);
options.reasons = optionOrLocalFallback(options.reasons, !context.forToString);
options.usedExports = optionOrLocalFallback(options.usedExports, !context.forToString);
options.optimizationBailout = optionOrLocalFallback(options.optimizationBailout, !context.forToString);
options.providedExports = optionOrLocalFallback(options.providedExports, !context.forToString);
options.entrypoints = optionOrLocalFallback(options.entrypoints, true);
options.chunkGroups = optionOrLocalFallback(options.chunkGroups, !context.forToString);
options.errors = optionOrLocalFallback(options.errors, true);
options.errorsCount = optionOrLocalFallback(options.errorsCount, true);
options.warnings = optionOrLocalFallback(options.warnings, true);
options.warningsCount = optionOrLocalFallback(options.warningsCount, true);
options.hash = optionOrLocalFallback(options.hash, true);
options.version = optionOrLocalFallback(options.version, true);
options.publicPath = optionOrLocalFallback(options.publicPath, true);
options.outputPath = optionOrLocalFallback(options.outputPath, !context.forToString);
options.timings = optionOrLocalFallback(options.timings, true);
options.builtAt = optionOrLocalFallback(options.builtAt, !context.forToString);
options.moduleAssets = optionOrLocalFallback(options.moduleAssets, true);
options.nestedModules = optionOrLocalFallback(options.nestedModules, !context.forToString);
options.source = optionOrLocalFallback(options.source, false);
options.logging = optionOrLocalFallback(options.logging, context.forToString ? "info" : true);
options.loggingTrace = optionOrLocalFallback(options.loggingTrace, !context.forToString);
options.loggingDebug = []
.concat((0, Stats_1.optionsOrFallback)(options.loggingDebug, []) || [])
.map(Stats_1.normalizeFilter);
options.modulesSpace =
options.modulesSpace || (context.forToString ? 15 : Infinity);
options.ids = optionOrLocalFallback(options.ids, !context.forToString);
options.children = optionOrLocalFallback(options.children, !context.forToString);
options.orphanModules = optionOrLocalFallback(options.orphanModules, context.forToString ? false : true);
return options;
else {
const options = {};
this.hooks.statsNormalize.call(options, context);
return options;
}
}

@@ -316,4 +299,4 @@ createStatsFactory(options) {

: typeof assetInfoUpdateOrFunction === "function"
? jsAssetInfo => (0, util_1.toJsAssetInfo)(assetInfoUpdateOrFunction(jsAssetInfo))
: (0, util_1.toJsAssetInfo)(assetInfoUpdateOrFunction));
? jsAssetInfo => AssetInfo_1.JsAssetInfo.__to_binding(assetInfoUpdateOrFunction(jsAssetInfo))
: AssetInfo_1.JsAssetInfo.__to_binding(assetInfoUpdateOrFunction));
}

@@ -328,3 +311,3 @@ /**

emitAsset(filename, source, assetInfo) {
__classPrivateFieldGet(this, _Compilation_inner, "f").emitAsset(filename, source_1.JsSource.__to_binding(source), (0, util_1.toJsAssetInfo)(assetInfo));
__classPrivateFieldGet(this, _Compilation_inner, "f").emitAsset(filename, source_1.JsSource.__to_binding(source), AssetInfo_1.JsAssetInfo.__to_binding(assetInfo));
}

@@ -343,4 +326,9 @@ deleteAsset(filename) {

return assets.map(asset => {
return Object.defineProperty(asset, "source", {
get: () => this.__internal__getAssetSource(asset.name)
return Object.defineProperties(asset, {
info: {
value: AssetInfo_1.JsAssetInfo.__from_binding(asset.info)
},
source: {
get: () => this.__internal__getAssetSource(asset.name)
}
});

@@ -354,4 +342,9 @@ });

}
return Object.defineProperty(asset, "source", {
get: () => this.__internal__getAssetSource(asset.name)
return Object.defineProperties(asset, {
info: {
value: AssetInfo_1.JsAssetInfo.__from_binding(asset.info)
},
source: {
get: () => this.__internal__getAssetSource(asset.name)
}
});

@@ -358,0 +351,0 @@ }

@@ -611,3 +611,4 @@ "use strict";

preset: zod_1.z
.enum(["normal", "none", "verbose", "errors-only", "errors-warnings"])
.boolean()
.or(zod_1.z.enum(["normal", "none", "verbose", "errors-only", "errors-warnings"]))
.optional(),

@@ -617,3 +618,3 @@ assets: zod_1.z.boolean().optional(),

modules: zod_1.z.boolean().optional(),
entrypoints: zod_1.z.boolean().optional(),
entrypoints: zod_1.z.boolean().or(zod_1.z.literal("auto")).optional(),
chunkGroups: zod_1.z.boolean().optional(),

@@ -636,3 +637,2 @@ warnings: zod_1.z.boolean().optional(),

moduleAssets: zod_1.z.boolean().optional(),
modulesSpace: zod_1.z.number().optional(),
nestedModules: zod_1.z.boolean().optional(),

@@ -651,3 +651,57 @@ source: zod_1.z.boolean().optional(),

optimizationBailout: zod_1.z.boolean().optional(),
orphanModules: zod_1.z.boolean().optional()
groupModulesByType: zod_1.z.boolean().optional(),
groupModulesByCacheStatus: zod_1.z.boolean().optional(),
groupModulesByLayer: zod_1.z.boolean().optional(),
groupModulesByAttributes: zod_1.z.boolean().optional(),
groupModulesByPath: zod_1.z.boolean().optional(),
groupModulesByExtension: zod_1.z.boolean().optional(),
modulesSpace: zod_1.z.number().optional(),
chunkModulesSpace: zod_1.z.number().optional(),
nestedModulesSpace: zod_1.z.number().optional(),
relatedAssets: zod_1.z.boolean().optional(),
groupAssetsByEmitStatus: zod_1.z.boolean().optional(),
groupAssetsByInfo: zod_1.z.boolean().optional(),
groupAssetsByPath: zod_1.z.boolean().optional(),
groupAssetsByExtension: zod_1.z.boolean().optional(),
groupAssetsByChunk: zod_1.z.boolean().optional(),
assetsSpace: zod_1.z.number().optional(),
orphanModules: zod_1.z.boolean().optional(),
excludeModules: zod_1.z
.array(zod_1.z
.string()
.or(zod_1.z.instanceof(RegExp))
.or(zod_1.z.function(zod_1.z.tuple([zod_1.z.string(), zod_1.z.any(), zod_1.z.any()]), zod_1.z.boolean())))
.or(zod_1.z.string())
.or(zod_1.z.instanceof(RegExp))
.or(zod_1.z.function(zod_1.z.tuple([zod_1.z.string(), zod_1.z.any(), zod_1.z.any()]), zod_1.z.boolean()))
.or(zod_1.z.boolean())
.optional(),
excludeAssets: zod_1.z
.array(zod_1.z
.string()
.or(zod_1.z.instanceof(RegExp))
.or(zod_1.z.function(zod_1.z.tuple([zod_1.z.string(), zod_1.z.any()]), zod_1.z.boolean())))
.or(zod_1.z.string())
.or(zod_1.z.instanceof(RegExp))
.or(zod_1.z.function(zod_1.z.tuple([zod_1.z.string(), zod_1.z.any()]), zod_1.z.boolean()))
.optional(),
modulesSort: zod_1.z.string().optional(),
chunkModulesSort: zod_1.z.string().optional(),
nestedModulesSort: zod_1.z.string().optional(),
chunksSort: zod_1.z.string().optional(),
assetsSort: zod_1.z.string().optional(),
performance: zod_1.z.boolean().optional(),
env: zod_1.z.boolean().optional(),
chunkGroupAuxiliary: zod_1.z.boolean().optional(),
chunkGroupChildren: zod_1.z.boolean().optional(),
chunkGroupMaxAssets: zod_1.z.number().optional(),
dependentModules: zod_1.z.boolean().optional(),
chunkOrigins: zod_1.z.boolean().optional(),
runtime: zod_1.z.boolean().optional(),
depth: zod_1.z.boolean().optional(),
reasonsSpace: zod_1.z.number().optional(),
groupReasonsByOrigin: zod_1.z.boolean().optional(),
errorDetails: zod_1.z.boolean().optional(),
errorStack: zod_1.z.boolean().optional(),
moduleTrace: zod_1.z.boolean().optional()
});

@@ -654,0 +708,0 @@ const statsValue = zod_1.z

@@ -222,2 +222,5 @@ "use strict";

}
if (res.cacheable === false) {
this.cacheable(false);
}
assetFilenames.push(...res.assets);

@@ -248,2 +251,5 @@ resolve(compiler.__internal__getModuleExecutionResult(res.id));

}
if (res.cacheable === false) {
this.cacheable(false);
}
assetFilenames.push(...res.assets);

@@ -250,0 +256,0 @@ callback(undefined, compiler.__internal__getModuleExecutionResult(res.id));

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

const DefaultStatsFactoryPlugin_1 = require("./stats/DefaultStatsFactoryPlugin");
const DefaultStatsPresetPlugin_1 = require("./stats/DefaultStatsPresetPlugin");
const DefaultStatsPrinterPlugin_1 = require("./stats/DefaultStatsPrinterPlugin");

@@ -258,2 +259,3 @@ const assertNotNil_1 = require("./util/assertNotNil");

new DefaultStatsFactoryPlugin_1.DefaultStatsFactoryPlugin().apply(compiler);
new DefaultStatsPresetPlugin_1.DefaultStatsPresetPlugin().apply(compiler);
new DefaultStatsPrinterPlugin_1.DefaultStatsPrinterPlugin().apply(compiler);

@@ -260,0 +262,0 @@ if (options.ignoreWarnings && options.ignoreWarnings.length > 0) {

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

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

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

export declare function normalizeStatsPreset(options?: StatsValue): StatsOptions;
export declare const normalizeFilter: (item: FilterItemTypes) => (args_0: string, ...args_1: unknown[]) => boolean;
export declare const optionsOrFallback: (...args: any) => any;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.optionsOrFallback = exports.normalizeFilter = exports.normalizeStatsPreset = exports.Stats = void 0;
exports.normalizeStatsPreset = exports.Stats = void 0;
class Stats {

@@ -139,26 +139,1 @@ constructor(compilation) {

}
const normalizeFilter = (item) => {
if (typeof item === "string") {
const regExp = new RegExp(`[\\\\/]${item.replace(
// eslint-disable-next-line no-useless-escape
/[-[\]{}()*+?.\\^$|]/g, "\\$&")}([\\\\/]|$|!|\\?)`);
return (ident) => regExp.test(ident);
}
if (item && typeof item === "object" && typeof item.test === "function") {
return (ident) => item.test(ident);
}
if (typeof item === "function") {
return item;
}
if (typeof item === "boolean") {
return () => item;
}
throw new Error(`unreachable: typeof ${item} should be one of string | RegExp | ((value: string) => boolean)`);
};
exports.normalizeFilter = normalizeFilter;
const optionsOrFallback = (...args) => {
let optionValues = [];
optionValues.push(...args);
return optionValues.find(optionValue => optionValue !== undefined);
};
exports.optionsOrFallback = optionsOrFallback;
import * as binding from "@rspack/binding";
import type { Compilation } from "../Compilation";
import type { StatsOptions } from "../config";
import type { Compilation, NormalizedStatsOptions } from "../Compilation";
import { type Comparator } from "../util/comparators";

@@ -100,6 +99,2 @@ import type { StatsFactory, StatsFactoryContext } from "./StatsFactory";

};
type KnownNormalizedStatsOptions = {
context: string;
};
export type NormalizedStatsOptions = KnownNormalizedStatsOptions & Omit<StatsOptions, keyof KnownNormalizedStatsOptions> & Record<string, any>;
export declare const uniqueArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>) => I[];

@@ -106,0 +101,0 @@ export declare const uniqueOrderedArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>, comparator: Comparator) => I[];

/// <reference types="node" />
import type { JsAssetInfo, JsStatsError } from "@rspack/binding";
import { AssetInfo } from "../Compilation";
import type { JsStatsError } from "@rspack/binding";
import { LoaderObject } from "../config/adapterRuleUse";

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

export declare function asArray<T>(item: T): T[];
export declare function toJsAssetInfo(info?: AssetInfo): JsAssetInfo;
export declare const deprecatedWarn: (content: string, enable?: boolean) => void;
export declare const unsupported: (name: string, issue?: string) => never;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unsupported = exports.deprecatedWarn = exports.toJsAssetInfo = exports.asArray = exports.stringifyLoaderObject = exports.indent = exports.concatErrorMsgAndStack = exports.isJsStatsError = exports.isPromiseLike = exports.serializeObject = exports.toObject = exports.toBuffer = exports.isNil = exports.mapValues = void 0;
exports.unsupported = exports.deprecatedWarn = exports.asArray = exports.stringifyLoaderObject = exports.indent = exports.concatErrorMsgAndStack = exports.isJsStatsError = exports.isPromiseLike = exports.serializeObject = exports.toObject = exports.toBuffer = exports.isNil = exports.mapValues = void 0;
function mapValues(record, fn) {

@@ -85,15 +85,2 @@ return Object.fromEntries(Object.entries(record).map(([key, value]) => [key, fn(value)]));

exports.asArray = asArray;
function toJsAssetInfo(info) {
return {
immutable: false,
minimized: false,
development: false,
hotModuleReplacement: false,
related: {},
chunkHash: [],
contentHash: [],
...info
};
}
exports.toJsAssetInfo = toJsAssetInfo;
const getDeprecationStatus = () => {

@@ -100,0 +87,0 @@ const defaultEnableDeprecatedWarning = true;

{
"name": "@rspack/core",
"version": "0.7.2-canary-a1e014e-20240605042614",
"version": "0.7.2-canary-c0c0fd3-20240607004432",
"webpackVersion": "5.75.0",

@@ -75,4 +75,4 @@ "license": "MIT",

"zod-validation-error": "1.3.1",
"@rspack/core": "0.7.2-canary-a1e014e-20240605042614",
"@rspack/plugin-minify": "^0.7.2-canary-a1e014e-20240605042614"
"@rspack/core": "0.7.2-canary-c0c0fd3-20240607004432",
"@rspack/plugin-minify": "^0.7.2-canary-c0c0fd3-20240607004432"
},

@@ -84,3 +84,3 @@ "dependencies": {

"webpack-sources": "3.2.3",
"@rspack/binding": "0.7.2-canary-a1e014e-20240605042614"
"@rspack/binding": "0.7.2-canary-c0c0fd3-20240607004432"
},

@@ -87,0 +87,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