@jsenv/plugin-preact 1.7.26 → 1.7.28
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/package.json +4 -4
- package/src/jsenv_plugin_preact.js +15 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/plugin-preact",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.28",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/jsenv/core",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"@babel/plugin-transform-react-jsx": "7.27.1",
|
|
23
23
|
"@babel/plugin-transform-react-jsx-development": "7.27.1",
|
|
24
24
|
"@babel/plugin-transform-react-jsx-source": "7.27.1",
|
|
25
|
-
"@jsenv/ast": "6.7.
|
|
26
|
-
"@jsenv/sourcemap": "1.3.
|
|
25
|
+
"@jsenv/ast": "6.7.17",
|
|
26
|
+
"@jsenv/sourcemap": "1.3.13",
|
|
27
27
|
"@jsenv/url-meta": "8.5.7",
|
|
28
28
|
"@prefresh/babel-plugin": "0.5.2",
|
|
29
|
-
"@prefresh/core": "1.5.
|
|
29
|
+
"@prefresh/core": "1.5.9",
|
|
30
30
|
"@prefresh/utils": "1.2.1",
|
|
31
31
|
"babel-plugin-transform-hook-names": "1.0.2"
|
|
32
32
|
},
|
|
@@ -193,17 +193,26 @@ export const jsenvPluginPreact = ({
|
|
|
193
193
|
expectedType: "js_module",
|
|
194
194
|
specifier: "@jsenv/plugin-preact/src/client/preact_refresh.js",
|
|
195
195
|
});
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
if (code.includes("__preact_refresh__")) {
|
|
197
|
+
// should never happen
|
|
198
|
+
// (was hapnning due to how dev server was generating file names in SPA mode causing inline content
|
|
199
|
+
// to be cooked twice)
|
|
200
|
+
console.warn(
|
|
201
|
+
`Cannot inject preact refresh code in ${urlInfo.url} because it already contains __preact_refresh__ variable.`,
|
|
202
|
+
);
|
|
203
|
+
} else {
|
|
204
|
+
const prelude = `import { installPreactRefresh } from ${
|
|
205
|
+
preactRefreshClientReference.generatedSpecifier
|
|
206
|
+
};
|
|
199
207
|
const __preact_refresh__ = installPreactRefresh(${JSON.stringify(urlInfo.url)});
|
|
200
208
|
`;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
209
|
+
code = `${prelude.replace(/\n/g, "")}${code}`;
|
|
210
|
+
if (hasReg) {
|
|
211
|
+
code = `${code}
|
|
204
212
|
|
|
205
213
|
__preact_refresh__.end();
|
|
206
214
|
import.meta.hot.accept(__preact_refresh__.acceptCallback);`;
|
|
215
|
+
}
|
|
207
216
|
}
|
|
208
217
|
}
|
|
209
218
|
}
|