@jsenv/plugin-preact 0.3.9 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/plugin-preact",
3
- "version": "0.3.9",
3
+ "version": "1.0.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,7 +27,7 @@
27
27
  "babel-plugin-transform-hook-names": "1.0.2",
28
28
  "@babel/plugin-transform-react-jsx": "7.19.0",
29
29
  "@babel/plugin-transform-react-jsx-development": "7.18.6",
30
- "@jsenv/ast": "1.3.1",
30
+ "@jsenv/ast": "1.3.2",
31
31
  "@jsenv/sourcemap": "1.0.5",
32
32
  "@jsenv/url-meta": "7.0.0",
33
33
  "@prefresh/babel-plugin": "0.4.3",
@@ -39,8 +39,8 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@jsenv/core": "../../",
42
- "preact": "10.11.0",
43
- "react-redux": "8.0.2",
42
+ "preact": "10.11.1",
43
+ "react-redux": "8.0.4",
44
44
  "redux": "4.2.0"
45
45
  }
46
46
  }
@@ -14,27 +14,37 @@ import {
14
14
  } from "@jsenv/ast"
15
15
 
16
16
  export const jsenvPluginPreact = ({
17
- jsxInclude = {
18
- "./**/*.jsx": true,
19
- "./**/*.tsx": true,
20
- },
21
- refreshInclude = {
22
- "./**/*.jsx": true,
23
- "./**/*.tsx": true,
24
- },
25
- hookNamesInclude = {
26
- "./**/*": true,
27
- },
17
+ jsx = true,
18
+ refresh = false,
19
+ inferHookNames = true,
28
20
  preactDevtoolsDuringBuild = false,
29
21
  } = {}) => {
30
- if (!refreshInclude) {
31
- refreshInclude = {}
22
+ if (jsx === true) {
23
+ jsx = {
24
+ "./**/*.jsx": true,
25
+ "./**/*.tsx": true,
26
+ }
27
+ } else if (jsx === false) {
28
+ jsx = {}
29
+ }
30
+ if (refresh === true) {
31
+ refresh = {
32
+ "./**/*.jsx": true,
33
+ "./**/*.tsx": true,
34
+ }
35
+ } else if (refresh === false) {
36
+ refresh = {}
37
+ }
38
+ if (inferHookNames === true) {
39
+ inferHookNames = { "./**": true }
40
+ } else {
41
+ inferHookNames = {}
32
42
  }
33
43
  const associations = URL_META.resolveAssociations(
34
44
  {
35
- jsx: jsxInclude,
36
- refresh: refreshInclude,
37
- hookNames: hookNamesInclude,
45
+ jsx,
46
+ refresh,
47
+ inferHookNames,
38
48
  },
39
49
  "file://",
40
50
  )
@@ -91,7 +101,7 @@ import ${preactDevtoolsReference.generatedSpecifier}
91
101
  : false
92
102
  const hookNamesEnabled =
93
103
  context.scenarios.dev &&
94
- urlMeta.hookNames &&
104
+ urlMeta.inferHookNames &&
95
105
  (urlInfo.content.includes("useState") ||
96
106
  urlInfo.content.includes("useReducer") ||
97
107
  urlInfo.content.includes("useRef") ||