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

@rspack/plugin-react-refresh

Package Overview
Dependencies
Maintainers
2
Versions
558
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rspack/plugin-react-refresh - npm Package Compare versions

Comparing version 1.0.0-alpha.0 to 1.0.0-alpha.1

client/errorOverlayEntry.js

4

dist/index.d.ts
import type { Compiler } from "@rspack/core";
import { type PluginOptions } from "./options";
import { type NormalizedPluginOptions, type PluginOptions } from "./options";
export type { PluginOptions };

@@ -10,3 +10,3 @@ /**

declare class ReactRefreshRspackPlugin {
options: PluginOptions;
options: NormalizedPluginOptions;
static deprecated_runtimePaths: string[];

@@ -13,0 +13,0 @@ constructor(options?: PluginOptions);

@@ -7,2 +7,4 @@ "use strict";

const options_1 = require("./options");
const getAdditionalEntries_1 = require("./utils/getAdditionalEntries");
const getSocketIntegration_1 = __importDefault(require("./utils/getSocketIntegration"));
const reactRefreshPath = require.resolve("../client/reactRefresh.js");

@@ -40,5 +42,16 @@ const reactRefreshEntryPath = require.resolve("../client/reactRefreshEntry.js");

}
new compiler.webpack.EntryPlugin(compiler.context, reactRefreshEntryPath, {
name: undefined
}).apply(compiler);
const addEntries = (0, getAdditionalEntries_1.getAdditionalEntries)({
devServer: compiler.options.devServer,
options: this.options
});
addEntries.prependEntries.forEach(entry => {
new compiler.webpack.EntryPlugin(compiler.context, entry, {
name: undefined
}).apply(compiler);
});
addEntries.overlayEntries.forEach(entry => {
new compiler.webpack.EntryPlugin(compiler.context, entry, {
name: undefined
}).apply(compiler);
});
new compiler.webpack.ProvidePlugin({

@@ -60,3 +73,20 @@ $ReactRefreshRuntime$: reactRefreshPath

};
const providedModules = {
__react_refresh_utils__: refreshUtilsPath
};
if (this.options.overlay === false) {
// Stub errorOverlay module so their calls can be erased
definedModules.__react_refresh_error_overlay__ = false;
definedModules.__react_refresh_socket__ = false;
}
else {
if (this.options.overlay.module) {
providedModules.__react_refresh_error_overlay__ = require.resolve(this.options.overlay.module);
}
if (this.options.overlay.sockIntegration) {
providedModules.__react_refresh_socket__ = (0, getSocketIntegration_1.default)(this.options.overlay.sockIntegration);
}
}
new compiler.webpack.DefinePlugin(definedModules).apply(compiler);
new compiler.webpack.ProvidePlugin(providedModules).apply(compiler);
const refreshPath = path_1.default.dirname(require.resolve("react-refresh"));

@@ -63,0 +93,0 @@ compiler.options.resolve.alias = {

@@ -0,1 +1,11 @@

import type { IntegrationType } from "./utils/getSocketIntegration";
interface OverlayOptions {
entry: string;
module: string;
sockIntegration: IntegrationType;
sockHost?: string;
sockPath?: string;
sockPort?: string;
sockProtocol?: string;
}
export type PluginOptions = {

@@ -6,3 +16,8 @@ include?: string | RegExp | (string | RegExp)[] | null;

forceEnable?: boolean;
overlay?: boolean | OverlayOptions;
};
export declare function normalizeOptions(options: PluginOptions): PluginOptions;
export interface NormalizedPluginOptions extends Required<PluginOptions> {
overlay: false | OverlayOptions;
}
export declare function normalizeOptions(options: PluginOptions): NormalizedPluginOptions;
export {};

@@ -12,2 +12,20 @@ "use strict";

};
const normalizeOverlay = (options) => {
const defaultOverlay = {
entry: require.resolve("../client/errorOverlayEntry.js"),
module: require.resolve("../client/overlay/index.js"),
sockIntegration: "wds"
};
if (!options) {
return false;
}
if (typeof options === "undefined" || options === true) {
return defaultOverlay;
}
options.entry = options.entry ?? defaultOverlay.entry;
options.module = options.module ?? defaultOverlay.module;
options.sockIntegration =
options.sockIntegration ?? defaultOverlay.sockIntegration;
return options;
};
function normalizeOptions(options) {

@@ -18,4 +36,5 @@ d(options, "exclude", /node_modules/i);

d(options, "forceEnable", false);
options.overlay = normalizeOverlay(options.overlay);
return options;
}
exports.normalizeOptions = normalizeOptions;
{
"name": "@rspack/plugin-react-refresh",
"version": "1.0.0-alpha.0",
"version": "1.0.0-alpha.1",
"license": "MIT",

@@ -33,5 +33,9 @@ "description": "React refresh plugin for rspack",

"react-refresh": "0.14.0",
"@rspack/core": "1.0.0-alpha.0",
"@rspack/plugin-react-refresh": "1.0.0-alpha.0"
"@rspack/core": "1.0.0-alpha.1",
"@rspack/plugin-react-refresh": "1.0.0-alpha.1"
},
"dependencies": {
"html-entities": "^2.1.0",
"error-stack-parser": "^2.0.6"
},
"peerDependencies": {

@@ -38,0 +42,0 @@ "react-refresh": ">=0.10.0 <1.0.0"

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