@peachy/plugin-react 0.0.10 → 0.0.12

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.mjs CHANGED
@@ -3,8 +3,7 @@ import { exactRegex, prefixRegex } from "rolldown/filter";
3
3
  import { readFileSync } from "fs";
4
4
  import remapping from "@ampproject/remapping";
5
5
  import MagicString from "magic-string";
6
- import { transform } from "rolldown/experimental";
7
-
6
+ import { transform } from "rolldown/utils";
8
7
  //#region src/entrypoint.ts
9
8
  function addHmrEntrypoint(input) {
10
9
  const PREFIX = "\0virtual:hmr-wrapper:";
@@ -43,7 +42,6 @@ function createHmrEntrypointPlugin() {
43
42
  }
44
43
  };
45
44
  }
46
-
47
45
  //#endregion
48
46
  //#region src/runtime.ts
49
47
  function hmrRuntimePlugin(port) {
@@ -64,7 +62,6 @@ function hmrRuntimePlugin(port) {
64
62
  }
65
63
  };
66
64
  }
67
-
68
65
  //#endregion
69
66
  //#region src/wrapper.ts
70
67
  function reactRefreshWrapperPlugin() {
@@ -87,12 +84,7 @@ function reactRefreshWrapperPlugin() {
87
84
  },
88
85
  sourcemap: true
89
86
  });
90
- for (const error of errors) this.error({
91
- frame: error.codeframe,
92
- message: error.message,
93
- cause: error.helpMessage,
94
- stack: ""
95
- });
87
+ for (const error of errors) this.error(error);
96
88
  const hmrId = JSON.stringify(id);
97
89
  const s = new MagicString(transformed);
98
90
  s.prepend(prefix.replaceAll("$hmrId$", hmrId));
@@ -109,7 +101,6 @@ function reactRefreshWrapperPlugin() {
109
101
  }
110
102
  };
111
103
  }
112
-
113
104
  //#endregion
114
105
  //#region src/index.ts
115
106
  function reactHMRPlugin(port) {
@@ -119,6 +110,5 @@ function reactHMRPlugin(port) {
119
110
  hmrRuntimePlugin(port)
120
111
  ];
121
112
  }
122
-
123
113
  //#endregion
124
- export { reactHMRPlugin };
114
+ export { reactHMRPlugin };
@@ -43,9 +43,7 @@ if (!globalThis.__hmr__) {
43
43
 
44
44
  connection.connect("message", async (_, _type, event) => {
45
45
  const decoder = new TextDecoder();
46
- const payload = JSON.parse(
47
- decoder.decode(event.toArray()),
48
- ) as HMRMessage;
46
+ const payload = JSON.parse(decoder.decode(event.toArray())) as HMRMessage;
49
47
 
50
48
  switch (payload?.type) {
51
49
  case "reload":
@@ -60,12 +58,9 @@ if (!globalThis.__hmr__) {
60
58
  for (const update of payload.updates) {
61
59
  if (globalThis.__hmr__.contexts[update.id]) {
62
60
  try {
63
- const module = await import(
64
- "file://" + update.url + "?t=" + Date.now()
65
- );
61
+ const module = await import("file://" + update.url + "?t=" + Date.now());
66
62
 
67
- const accepted =
68
- globalThis.__hmr__.contexts[update.id].emit(module);
63
+ const accepted = globalThis.__hmr__.contexts[update.id].emit(module);
69
64
 
70
65
  if (accepted) {
71
66
  console.info("[HMR] Update accepted by", update.id);
@@ -7,9 +7,7 @@ if (import.meta) {
7
7
  }
8
8
 
9
9
  var NO_FAST_REFRESH =
10
- !globalThis.$RefreshReg$ ||
11
- !globalThis.$RefreshSig$ ||
12
- !globalThis.$RefreshRuntime$;
10
+ !globalThis.$RefreshReg$ || !globalThis.$RefreshSig$ || !globalThis.$RefreshRuntime$;
13
11
  if (NO_FAST_REFRESH) {
14
12
  console.warn(
15
13
  "[HMR]: React Refresh is not enabled. Please ensure that you have installed the necessary dependencies and enabled the plugin in your webpack configuration.",
@@ -21,10 +19,10 @@ if (NO_FAST_REFRESH) {
21
19
  const fullId = $hmrId$ + "#" + id;
22
20
  globalThis.$RefreshRuntime$.register(type, fullId);
23
21
  };
24
- globalThis.$RefreshSig$ =
25
- globalThis.$RefreshRuntime$.createSignatureFunctionForTransform;
22
+ globalThis.$RefreshSig$ = globalThis.$RefreshRuntime$.createSignatureFunctionForTransform;
26
23
  }
27
24
 
25
+ /* oxlint-disable no-unused-expressions */
28
26
  $sourceCode$;
29
27
 
30
28
  if (!NO_FAST_REFRESH) {
package/package.json CHANGED
@@ -1,29 +1,30 @@
1
1
  {
2
2
  "name": "@peachy/plugin-react",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "HMR for react",
5
- "type": "module",
6
- "main": "./dist/index.mjs",
7
5
  "keywords": [],
8
- "author": "Angelo Verlain <hey@vixalien.com>",
9
6
  "license": "MIT",
10
- "devDependencies": {
11
- "@types/node": "^25.2.2",
12
- "rolldown": "1.0.0-rc.3",
13
- "tsdown": "0.20.3",
14
- "typescript": "^5.9.3"
15
- },
7
+ "author": "Angelo Verlain <hey@vixalien.com>",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "type": "module",
12
+ "main": "./dist/index.mjs",
16
13
  "dependencies": {
17
14
  "@ampproject/remapping": "^2.3.0",
18
15
  "magic-string": "^0.30.21",
19
16
  "react-refresh": "^0.18.0"
20
17
  },
18
+ "devDependencies": {
19
+ "@types/node": "^25.3.5",
20
+ "rolldown": "1.0.0-rc.7",
21
+ "tsdown": "0.21.0",
22
+ "typescript": "^5.9.3",
23
+ "@peachy/internal-utilities": "0.0.0"
24
+ },
21
25
  "peerDependencies": {
22
26
  "rolldown": "1.0.0-beta.58"
23
27
  },
24
- "files": [
25
- "dist"
26
- ],
27
28
  "scripts": {
28
29
  "build": "tsdown src/index.ts --dts && mkdir -p dist/templates && cp src/templates/* dist/templates"
29
30
  },