@jsenv/plugin-preact 1.2.2 → 1.2.4
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/plugin-preact",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@babel/plugin-transform-react-jsx": "7.19.0",
|
|
29
29
|
"@babel/plugin-transform-react-jsx-development": "7.18.6",
|
|
30
30
|
"@jsenv/ast": "1.4.4",
|
|
31
|
-
"@jsenv/sourcemap": "1.0.
|
|
31
|
+
"@jsenv/sourcemap": "1.0.7",
|
|
32
32
|
"@jsenv/url-meta": "7.0.0",
|
|
33
33
|
"@prefresh/babel-plugin": "0.4.4",
|
|
34
34
|
"@prefresh/core": "1.4.1",
|
|
@@ -53,7 +53,7 @@ export const jsenvPluginPreact = ({
|
|
|
53
53
|
name: "jsenv:preact",
|
|
54
54
|
appliesDuring: "*",
|
|
55
55
|
resolveUrl: {
|
|
56
|
-
|
|
56
|
+
js_import: (reference, context) => {
|
|
57
57
|
if (
|
|
58
58
|
reference.specifier === "react" ||
|
|
59
59
|
reference.specifier === "react-dom"
|
|
@@ -69,14 +69,14 @@ export const jsenvPluginPreact = ({
|
|
|
69
69
|
if (!preactDevtools) {
|
|
70
70
|
return null
|
|
71
71
|
}
|
|
72
|
-
if (context.
|
|
72
|
+
if (context.build && preactDevtools !== "dev_and_build") {
|
|
73
73
|
return null
|
|
74
74
|
}
|
|
75
75
|
const htmlAst = parseHtmlString(urlInfo.content)
|
|
76
76
|
const [preactDevtoolsReference] = context.referenceUtils.inject({
|
|
77
|
-
type: "
|
|
77
|
+
type: "js_import",
|
|
78
78
|
expectedType: "js_module",
|
|
79
|
-
specifier: context.
|
|
79
|
+
specifier: context.dev ? "preact/debug" : "preact/devtools",
|
|
80
80
|
})
|
|
81
81
|
injectScriptNodeAsEarlyAsPossible(
|
|
82
82
|
htmlAst,
|
|
@@ -98,12 +98,12 @@ import ${preactDevtoolsReference.generatedSpecifier}
|
|
|
98
98
|
associations,
|
|
99
99
|
})
|
|
100
100
|
const jsxEnabled = urlMeta.jsxTranspilation
|
|
101
|
-
const refreshEnabled = context.
|
|
101
|
+
const refreshEnabled = context.dev
|
|
102
102
|
? urlMeta.refreshInstrumentation &&
|
|
103
103
|
!urlInfo.content.includes("import.meta.hot.decline()")
|
|
104
104
|
: false
|
|
105
105
|
const hookNamesEnabled =
|
|
106
|
-
context.
|
|
106
|
+
context.dev &&
|
|
107
107
|
urlMeta.hookNamesInstrumentation &&
|
|
108
108
|
(urlInfo.content.includes("useState") ||
|
|
109
109
|
urlInfo.content.includes("useReducer") ||
|
|
@@ -114,7 +114,7 @@ import ${preactDevtoolsReference.generatedSpecifier}
|
|
|
114
114
|
...(jsxEnabled
|
|
115
115
|
? [
|
|
116
116
|
[
|
|
117
|
-
context.
|
|
117
|
+
context.dev
|
|
118
118
|
? "@babel/plugin-transform-react-jsx-development"
|
|
119
119
|
: "@babel/plugin-transform-react-jsx",
|
|
120
120
|
{
|
|
@@ -149,7 +149,7 @@ import ${preactDevtoolsReference.generatedSpecifier}
|
|
|
149
149
|
while (index > -1) {
|
|
150
150
|
const specifier = importSpecifier.slice(1, -1)
|
|
151
151
|
const [injectedReference] = context.referenceUtils.inject({
|
|
152
|
-
type: "
|
|
152
|
+
type: "js_import",
|
|
153
153
|
expectedType: "js_module",
|
|
154
154
|
specifier,
|
|
155
155
|
})
|
|
@@ -168,7 +168,7 @@ import ${preactDevtoolsReference.generatedSpecifier}
|
|
|
168
168
|
if (hasReg || hasSig) {
|
|
169
169
|
const [preactRefreshClientReference] =
|
|
170
170
|
context.referenceUtils.inject({
|
|
171
|
-
type: "
|
|
171
|
+
type: "js_import",
|
|
172
172
|
expectedType: "js_module",
|
|
173
173
|
specifier: "@jsenv/plugin-preact/src/client/preact_refresh.js",
|
|
174
174
|
})
|