@rspack/plugin-react-refresh 1.0.0-alpha.4 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,14 +2,14 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
- const path_1 = __importDefault(require("path"));
5
+ const node_path_1 = __importDefault(require("node:path"));
6
6
  const options_1 = require("./options");
7
7
  const getAdditionalEntries_1 = require("./utils/getAdditionalEntries");
8
8
  const getSocketIntegration_1 = __importDefault(require("./utils/getSocketIntegration"));
9
9
  const reactRefreshPath = require.resolve("../client/reactRefresh.js");
10
10
  const reactRefreshEntryPath = require.resolve("../client/reactRefreshEntry.js");
11
11
  const refreshUtilsPath = require.resolve("../client/refreshUtils.js");
12
- const refreshRuntimeDirPath = path_1.default.dirname(require.resolve("react-refresh", {
12
+ const refreshRuntimeDirPath = node_path_1.default.dirname(require.resolve("react-refresh", {
13
13
  paths: [reactRefreshPath]
14
14
  }));
15
15
  const runtimePaths = [
@@ -42,16 +42,16 @@ class ReactRefreshRspackPlugin {
42
42
  devServer: compiler.options.devServer,
43
43
  options: this.options
44
44
  });
45
- addEntries.prependEntries.forEach(entry => {
45
+ for (const entry of addEntries.prependEntries) {
46
46
  new compiler.webpack.EntryPlugin(compiler.context, entry, {
47
47
  name: undefined
48
48
  }).apply(compiler);
49
- });
50
- addEntries.overlayEntries.forEach(entry => {
49
+ }
50
+ for (const entry of addEntries.overlayEntries) {
51
51
  new compiler.webpack.EntryPlugin(compiler.context, entry, {
52
52
  name: undefined
53
53
  }).apply(compiler);
54
- });
54
+ }
55
55
  new compiler.webpack.ProvidePlugin({
56
56
  $ReactRefreshRuntime$: reactRefreshPath
57
57
  }).apply(compiler);
@@ -86,7 +86,7 @@ class ReactRefreshRspackPlugin {
86
86
  }
87
87
  new compiler.webpack.DefinePlugin(definedModules).apply(compiler);
88
88
  new compiler.webpack.ProvidePlugin(providedModules).apply(compiler);
89
- const refreshPath = path_1.default.dirname(require.resolve("react-refresh"));
89
+ const refreshPath = node_path_1.default.dirname(require.resolve("react-refresh"));
90
90
  compiler.options.resolve.alias = {
91
91
  "react-refresh": refreshPath,
92
92
  ...compiler.options.resolve.alias
@@ -11,14 +11,12 @@ function getCurrentScriptSource() {
11
11
  return;
12
12
  return document.currentScript.getAttribute("src");
13
13
  }
14
- else {
15
- // Fallback to getting all scripts running in the document,
16
- // and finding the last one injected.
17
- const scriptElementsWithSrc = Array.prototype.filter.call(document.scripts || [], elem => elem.getAttribute("src"));
18
- if (!scriptElementsWithSrc.length)
19
- return;
20
- const currentScript = scriptElementsWithSrc[scriptElementsWithSrc.length - 1];
21
- return currentScript.getAttribute("src");
22
- }
14
+ // Fallback to getting all scripts running in the document,
15
+ // and finding the last one injected.
16
+ const scriptElementsWithSrc = Array.prototype.filter.call(document.scripts || [], elem => elem.getAttribute("src"));
17
+ if (!scriptElementsWithSrc.length)
18
+ return;
19
+ const currentScript = scriptElementsWithSrc[scriptElementsWithSrc.length - 1];
20
+ return currentScript.getAttribute("src");
23
21
  }
24
22
  exports.default = getCurrentScriptSource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/plugin-react-refresh",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-beta.0",
4
4
  "license": "MIT",
5
5
  "description": "React refresh plugin for rspack",
6
6
  "main": "dist/index.js",
@@ -29,9 +29,10 @@
29
29
  "directory": "packages/rspack-plugin-react-refresh"
30
30
  },
31
31
  "devDependencies": {
32
- "react-refresh": "0.14.0",
33
- "@rspack/core": "1.0.0-alpha.4",
34
- "@rspack/plugin-react-refresh": "1.0.0-alpha.4"
32
+ "react-refresh": "^0.14.0",
33
+ "typescript": "5.0.2",
34
+ "@rspack/core": "1.0.0-beta.0",
35
+ "@rspack/plugin-react-refresh": "1.0.0-beta.0"
35
36
  },
36
37
  "dependencies": {
37
38
  "error-stack-parser": "^2.0.6",
@@ -55,7 +56,7 @@
55
56
  "scripts": {
56
57
  "build": "tsc -b ./tsconfig.build.json",
57
58
  "dev": "tsc -b -w",
58
- "test": "jest --runInBand --colors",
59
+ "test": "jest --colors",
59
60
  "api-extractor": "api-extractor run --verbose",
60
61
  "api-extractor:ci": "api-extractor run --verbose || diff temp/api.md etc/api.md"
61
62
  }