Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@rushstack/webpack-plugin-utilities
Advanced tools
This plugin sets the webpack public path at runtime.
npm install @rushstack/webpack-plugin-utilities --save
This is a collection of utilities for writing webpack plugins
import { VersionDetection } from "@rushstack/webpack-plugin-utilities"
class MyExampleWebpackPlugin {
constructor() {
this.pluginName = "MyExampleWebpackPlugin"
}
apply(compiler) {
if (VersionDetection.isWebpack3OrEarlier(compiler)) {
throw new Error(`This plugin does not support webpack 3 or below.`)
}
const isWebpack4 = VersionDetection.isWebpack4(compiler);
if (isWebpack4) {
compiler.hooks.compilation.tap(this.pluginName, (compilation) => {
// ....
});
} else {
compiler.hooks.compilation.tap(this.pluginName, (compilation) => {
// ...
});
}
}
}
getTestingWebpackCompiler
import { getTestingWebpackCompiler } from "@rushstack/webpack-plugin-utilities"
describe("MyPlugin", () => {
it("should run", async () => {
const stats = await getTestingWebpackCompiler("./src/index.ts");
expect(stats).toBeDefined();
});
});
getTestingWebpackCompiler
with additional configurationIf you want to pass in additional configuration to the webpack compiler, you can pass it in as the second parameter to getTestingWebpackCompiler
.
import { getTestingWebpackCompiler } from "@rushstack/webpack-plugin-utilities"
describe("MyPlugin", () => {
it("should run", async () => {
const stats = await getTestingWebpackCompiler("./src/index.ts", {
mode: "production",
});
expect(stats).toBeDefined();
});
});
getTestingWebpackCompiler
with virtual filesystemIf you want to be able to read, analyze, access the files written to the memory filesystem,
you can pass in a memory filesystem instance to the memFs
parameter.
import { getTestingWebpackCompiler } from "@rushstack/webpack-plugin-utilities"
import { createFsFromVolume, Volume, IFs } from "memfs"
import path from "path"
describe("MyPlugin", () => {
it("should run", async () => {
const virtualFileSystem: IFs = createFsFromVolume(new Volume());
const stats = await getTestingWebpackCompiler(
`./src/index.ts`,
{},
virtualFileSystem
);
expect(stats).toBeDefined();
expect(virtualFileSystem.existsSync(path.join(__dirname, "dist", "index.js"))).toBe(true);
});
});
@rushstack/webpack-plugin-utilities
is part of the Rush Stack family of projects.
FAQs
This plugin sets the webpack public path at runtime.
The npm package @rushstack/webpack-plugin-utilities receives a total of 9,318 weekly downloads. As such, @rushstack/webpack-plugin-utilities popularity was classified as popular.
We found that @rushstack/webpack-plugin-utilities demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.