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-beta.2 to 1.0.0-beta.3

7

dist/index.d.ts
import type { Compiler } from "@rspack/core";
import { type NormalizedPluginOptions, type PluginOptions } from "./options";
import type { NormalizedPluginOptions, PluginOptions } from "./options";
export type { PluginOptions };
/**
* @typedef {Object} Options
* @property {(string | RegExp | (string | RegExp)[] | null)=} include included resourcePath for loader
* @property {(string | RegExp | (string | RegExp)[] | null)=} exclude excluded resourcePath for loader
*/
declare class ReactRefreshRspackPlugin {

@@ -10,0 +5,0 @@ options: NormalizedPluginOptions;

9

dist/index.js

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

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

@@ -22,7 +22,2 @@ const reactRefreshEntryPath = require.resolve("../client/reactRefreshEntry.js");

];
/**
* @typedef {Object} Options
* @property {(string | RegExp | (string | RegExp)[] | null)=} include included resourcePath for loader
* @property {(string | RegExp | (string | RegExp)[] | null)=} exclude excluded resourcePath for loader
*/
class ReactRefreshRspackPlugin {

@@ -86,3 +81,3 @@ constructor(options = {}) {

if (this.options.overlay.sockIntegration) {
providedModules.__react_refresh_socket__ = (0, getSocketIntegration_1.default)(this.options.overlay.sockIntegration);
providedModules.__react_refresh_socket__ = (0, getSocketIntegration_1.getSocketIntegration)(this.options.overlay.sockIntegration);
}

@@ -89,0 +84,0 @@ }

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

export default function getCurrentScriptSource(): any;
export default function getCurrentScriptSource(): string | null | undefined;

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

const getCurrentScriptSource_1 = __importDefault(require("./getCurrentScriptSource"));
function getSocketUrlParts(resourceQuery, metadata) {
if (typeof metadata === "undefined") {
metadata = {};
}
/** @type {SocketUrlParts} */
function getSocketUrlParts(resourceQuery, metadata = {}) {
const urlParts = {};

@@ -20,3 +16,2 @@ // If the resource query is available,

searchParams.forEach((value, key) => {
// @ts-expect-error -- ignore
parsedQuery[key] = value;

@@ -23,0 +18,0 @@ });

@@ -5,6 +5,6 @@ import type { SocketUrlParts } from "./getSocketUrlParts";

* Create a valid URL from parsed URL parts.
* @param {import('./getSocketUrlParts').SocketUrlParts} urlParts The parsed URL parts.
* @param {import('./getWDSMetadata').WDSMetaObj} [metadata] The parsed WDS metadata object.
* @returns {string} The generated URL.
* @param urlParts The parsed URL parts.
* @param metadata The parsed WDS metadata object.
* @returns The generated URL.
*/
export default function urlFromParts(urlParts: SocketUrlParts, metadata: WDSMetaObj): string;
export default function urlFromParts(urlParts: SocketUrlParts, metadata?: WDSMetaObj): string;

@@ -5,10 +5,7 @@ "use strict";

* Create a valid URL from parsed URL parts.
* @param {import('./getSocketUrlParts').SocketUrlParts} urlParts The parsed URL parts.
* @param {import('./getWDSMetadata').WDSMetaObj} [metadata] The parsed WDS metadata object.
* @returns {string} The generated URL.
* @param urlParts The parsed URL parts.
* @param metadata The parsed WDS metadata object.
* @returns The generated URL.
*/
function urlFromParts(urlParts, metadata) {
if (typeof metadata === "undefined") {
metadata = {};
}
function urlFromParts(urlParts, metadata = {}) {
let fullProtocol = "http:";

@@ -15,0 +12,0 @@ if (urlParts.protocol) {

@@ -5,2 +5,13 @@ export interface WDSMetaObj {

}
export default function getWDSMetadata(SocketClient: any): WDSMetaObj;
declare class WebSocketClient {
client: WebSocket;
constructor(url: string);
onOpen(f: (...args: any[]) => void): void;
onClose(f: (...args: any[]) => void): void;
onMessage(f: (...args: any[]) => void): void;
}
export interface SocketClient {
new (url: string): WebSocketClient;
}
export default function getWDSMetadata(SocketClient: SocketClient): WDSMetaObj;
export {};

@@ -0,10 +1,13 @@

import type { SocketClient } from "./utils/getWDSMetadata";
declare global {
var __webpack_dev_server_client__: any;
var __webpack_dev_server_client__: SocketClient | {
default: SocketClient;
};
}
/**
* Initializes a socket server for HMR for webpack-dev-server.
* @param {function(*): void} messageHandler A handler to consume Webpack compilation messages.
* @param {string} [resourceQuery] Webpack's `__resourceQuery` string.
* @returns {void}
* @param messageHandler A handler to consume Webpack compilation messages.
* @param resourceQuery Webpack's `__resourceQuery` string.
* @returns
*/
export declare function init(messageHandler: (...args: any[]) => void, resourceQuery: string): void;

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

* The following code is modified based on
* https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/f1c8b9a44198449093ca95f85af5df97925e1cfc/sockets/WPSSocket.js
* https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/f1c8b9a44198449093ca95f85af5df97925e1cfc/sockets/WDSSocket.js
*

@@ -22,16 +22,18 @@ * MIT Licensed

* Initializes a socket server for HMR for webpack-dev-server.
* @param {function(*): void} messageHandler A handler to consume Webpack compilation messages.
* @param {string} [resourceQuery] Webpack's `__resourceQuery` string.
* @returns {void}
* @param messageHandler A handler to consume Webpack compilation messages.
* @param resourceQuery Webpack's `__resourceQuery` string.
* @returns
*/
function init(messageHandler, resourceQuery) {
if (typeof __webpack_dev_server_client__ !== "undefined") {
let SocketClient = __webpack_dev_server_client__;
if (typeof __webpack_dev_server_client__.default !== "undefined") {
let SocketClient;
if ("default" in __webpack_dev_server_client__) {
SocketClient = __webpack_dev_server_client__.default;
}
else {
SocketClient = __webpack_dev_server_client__;
}
const wdsMeta = (0, getWDSMetadata_1.default)(SocketClient);
const urlParts = (0, getSocketUrlParts_1.default)(resourceQuery, wdsMeta);
const connection = new SocketClient((0, getUrlFromParts_1.default)(urlParts, wdsMeta));
// @ts-expect-error -- ignore
connection.onMessage(function onSocketMessage(data) {

@@ -38,0 +40,0 @@ const message = JSON.parse(data);

export type IntegrationType = "wds";
export default function getSocketIntegration(integrationType: IntegrationType): string;
export declare function getSocketIntegration(integrationType: IntegrationType): string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSocketIntegration = void 0;
function getSocketIntegration(integrationType) {

@@ -17,2 +18,2 @@ let resolvedSocketIntegration;

}
exports.default = getSocketIntegration;
exports.getSocketIntegration = getSocketIntegration;
{
"name": "@rspack/plugin-react-refresh",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"license": "MIT",

@@ -34,4 +34,4 @@ "description": "React refresh plugin for rspack",

"typescript": "5.0.2",
"@rspack/core": "1.0.0-beta.2",
"@rspack/plugin-react-refresh": "1.0.0-beta.2"
"@rspack/core": "1.0.0-beta.3",
"@rspack/plugin-react-refresh": "1.0.0-beta.3"
},

@@ -38,0 +38,0 @@ "dependencies": {

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