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
1105
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.0.0-760f8b6f15-20221110061725 to 0.0.0-8aa81b497b-20221110072134

18

dist/compiler.js

@@ -222,11 +222,4 @@ "use strict";

let stats = new stats_1.Stats(rawStats);
if (stats.hasErrors()) {
console.log(stats.toString({
all: false,
warnings: true,
errors: true,
...this.options.stats
}));
}
// TODO: log stats string should move to cli
console.log(stats.toString(this.options.stats));
console.log("build success, time cost", Date.now() - begin, "ms");

@@ -253,10 +246,3 @@ let pendingChangedFilepaths = new Set();

// TODO: log stats string should move to cli
if (stats.hasErrors()) {
console.log(stats.toString({
all: false,
warnings: true,
errors: true,
...this.options.stats
}));
}
console.log(stats.toString(this.options.stats));
isBuildFinished = true;

@@ -263,0 +249,0 @@ const hasPending = Boolean(pendingChangedFilepaths.size);

1

dist/config/index.d.ts

@@ -56,2 +56,3 @@ import type { Context, ResolvedContext } from "./context";

export { resolveWatchOption } from "./watch";
export type { StatsOptions } from "./stats";
//# sourceMappingURL=index.d.ts.map
import * as binding from "@rspack/binding";
export declare type ResolvedStatsOptions = binding.RawStatsOptions;
export interface StatsOptions {
colors?: boolean;
export interface StatsOptionsObj {
all?: boolean;
preset?: "normal" | "none" | "verbose" | "errors-only" | "errors-warnings";
assets?: boolean;
chunks?: boolean;
modules?: boolean;
entrypoints?: boolean;
warnings?: boolean;
warningsCount?: boolean;
errors?: boolean;
errorsCount?: boolean;
colors?: boolean;
}
export declare function resolveStatsOptions(options?: StatsOptions): ResolvedStatsOptions;
export declare type StatsOptions = StatsOptionsObj | boolean | string;
/**
* resolve `StatsOptions` to `binding.RawStatsOptions`.
*/
export declare function resolveStatsOptions(opts?: StatsOptions): ResolvedStatsOptions;
//# sourceMappingURL=stats.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveStatsOptions = void 0;
function resolveStatsOptions(options = {}) {
const colors = optionsOrFallback(options.colors, false);
const stats_1 = require("../stats");
/**
* resolve `StatsOptions` to `binding.RawStatsOptions`.
*/
function resolveStatsOptions(opts = {}) {
const options = (0, stats_1.normalizeStatsPreset)(opts);
const colors = (0, stats_1.optionsOrFallback)(options.colors, false);
return {
...options,
colors

@@ -11,7 +17,2 @@ };

exports.resolveStatsOptions = resolveStatsOptions;
const optionsOrFallback = (...args) => {
let optionValues = [];
optionValues.push(...args);
return optionValues.find(optionValue => optionValue !== undefined);
};
//# sourceMappingURL=stats.js.map
import * as binding from "@rspack/binding";
import { StatsOptions } from "./config/stats";
export declare type StatsCompilation = Omit<binding.StatsCompilation, "entrypoints"> & {
import { StatsOptions, StatsOptionsObj } from "./config/stats";
declare type StatsCompilationInner = Omit<binding.StatsCompilation, "entrypoints"> & {
entrypoints: Record<string, binding.StatsEntrypoint>;
};
export declare type StatsCompilation = Partial<StatsCompilationInner> & {
filteredModules?: number;
};
export declare class Stats {

@@ -10,6 +13,10 @@ #private;

hasErrors(): boolean;
toJson(options?: StatsOptions): StatsCompilation;
toString(options?: StatsOptions): string;
hasWarnings(): boolean;
toJson(opts?: StatsOptions, forToString?: boolean): StatsCompilation;
toString(opts?: StatsOptions): string;
static jsonToString(obj: any, useColors: boolean): string;
}
export declare const optionsOrFallback: (...args: any[]) => any;
export declare function normalizeStatsPreset(options?: StatsOptions): StatsOptionsObj;
export {};
//# sourceMappingURL=stats.d.ts.map

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.Stats = void 0;
const stats_1 = require("./config/stats");
exports.normalizeStatsPreset = exports.optionsOrFallback = exports.Stats = void 0;
const Logger_1 = require("./logging/Logger");

@@ -34,12 +33,54 @@ class Stats {

}
toJson(options) {
return __classPrivateFieldGet(this, _Stats_statsJson, "f");
hasWarnings() {
return __classPrivateFieldGet(this, _Stats_statsJson, "f").warningsCount > 0;
}
toString(options) {
options = (0, stats_1.resolveStatsOptions)(options);
const obj = this.toJson(options);
obj.filteredModules = obj.modules.length - 15;
obj.modules = obj.modules.slice(0, 15);
return Stats.jsonToString(obj, options.colors);
toJson(opts, forToString) {
const options = normalizeStatsPreset(opts);
const all = options.all;
const optionOrLocalFallback = (v, def) => v !== undefined ? v : all !== undefined ? all : def;
const showAssets = optionOrLocalFallback(options.assets, true);
const showChunks = optionOrLocalFallback(options.chunks, !forToString);
const showModules = optionOrLocalFallback(options.modules, true);
const showEntrypoints = optionOrLocalFallback(options.entrypoints, true);
const showErrors = optionOrLocalFallback(options.errors, true);
const showErrorsCount = optionOrLocalFallback(options.errorsCount, true);
const showWarninigs = optionOrLocalFallback(options.warnings, true);
const showWarningsCount = optionOrLocalFallback(options.warningsCount, true);
let obj = {};
if (showAssets) {
obj.assets = __classPrivateFieldGet(this, _Stats_statsJson, "f").assets;
}
if (showChunks) {
obj.chunks = __classPrivateFieldGet(this, _Stats_statsJson, "f").chunks;
}
if (showModules) {
obj.modules = __classPrivateFieldGet(this, _Stats_statsJson, "f").modules;
}
if (showEntrypoints) {
obj.entrypoints = __classPrivateFieldGet(this, _Stats_statsJson, "f").entrypoints;
}
if (showErrors) {
obj.errors = __classPrivateFieldGet(this, _Stats_statsJson, "f").errors;
}
if (showErrorsCount) {
obj.errorsCount = __classPrivateFieldGet(this, _Stats_statsJson, "f").errorsCount;
}
if (showWarninigs) {
obj.warnings = __classPrivateFieldGet(this, _Stats_statsJson, "f").warnings;
}
if (showWarningsCount) {
obj.warningsCount = __classPrivateFieldGet(this, _Stats_statsJson, "f").warningsCount;
}
if (obj.modules && forToString) {
obj.filteredModules = obj.modules.length - 15;
obj.modules = obj.modules.slice(0, 15);
}
return obj;
}
toString(opts) {
const options = normalizeStatsPreset(opts);
const useColors = (0, exports.optionsOrFallback)(options.colors, false);
const obj = this.toJson(options, true);
return Stats.jsonToString(obj, useColors);
}
static jsonToString(obj, useColors) {

@@ -781,2 +822,52 @@ var _a, _b, _c;

};
const optionsOrFallback = (...args) => {
let optionValues = [];
optionValues.push(...args);
return optionValues.find(optionValue => optionValue !== undefined);
};
exports.optionsOrFallback = optionsOrFallback;
function normalizeStatsPreset(options) {
if (typeof options === "boolean" || typeof options === "string")
return presetToOptions(options);
else if (!options)
return {};
else {
let obj = { ...presetToOptions(options.preset), ...options };
delete obj.preset;
return obj;
}
}
exports.normalizeStatsPreset = normalizeStatsPreset;
function presetToOptions(name) {
const pn = (typeof name === "string" && name.toLowerCase()) || name;
switch (pn) {
case "none":
return {
all: false
};
case "verbose":
return {
all: true
};
case "errors-only":
return {
all: false,
errors: true,
errorsCount: true
// TODO: moduleTrace: true,
// TODO: logging: "error"
};
case "errors-warnings":
return {
all: false,
errors: true,
errorsCount: true,
warnings: true,
warningsCount: true
// TODO: logging: "warn"
};
default:
return {};
}
}
//# sourceMappingURL=stats.js.map
{
"name": "@rspack/core",
"version": "0.0.0-760f8b6f15-20221110061725",
"version": "0.0.0-8aa81b497b-20221110072134",
"main": "./dist/index.js",

@@ -10,3 +10,3 @@ "types": "./dist/index.d.ts",

"devDependencies": {
"@rspack/core": "0.0.0-760f8b6f15-20221110061725",
"@rspack/core": "0.0.0-8aa81b497b-20221110072134",
"@swc/helpers": "^0.4.12",

@@ -28,6 +28,6 @@ "@types/jest": "29.0.2",

"dependencies": {
"@rspack/binding": "0.0.0-760f8b6f15-20221110061725",
"@rspack/dev-client": "0.0.0-760f8b6f15-20221110061725",
"@rspack/plugin-less": "^0.0.0-760f8b6f15-20221110061725",
"@rspack/plugin-postcss": "^0.0.0-760f8b6f15-20221110061725",
"@rspack/binding": "0.0.0-8aa81b497b-20221110072134",
"@rspack/dev-client": "0.0.0-8aa81b497b-20221110072134",
"@rspack/plugin-less": "^0.0.0-8aa81b497b-20221110072134",
"@rspack/plugin-postcss": "^0.0.0-8aa81b497b-20221110072134",
"browserslist": "^4.21.3",

@@ -34,0 +34,0 @@ "chokidar": "3.5.3",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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