@rspack/plugin-react-refresh 1.0.0-alpha.5 → 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
@@ -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);
@@ -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.5",
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.5",
34
- "@rspack/plugin-react-refresh": "1.0.0-alpha.5"
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
  }