@jsenv/plugin-preact 1.0.0 → 1.1.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": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,37 +14,37 @@ import {
14
14
  } from "@jsenv/ast"
15
15
 
16
16
  export const jsenvPluginPreact = ({
17
- jsx = true,
18
- refresh = false,
19
- inferHookNames = true,
17
+ jsxTranspilation = true,
18
+ refreshInstrumentation = false,
19
+ hookNamesInstrumentation = true,
20
20
  preactDevtoolsDuringBuild = false,
21
21
  } = {}) => {
22
- if (jsx === true) {
23
- jsx = {
22
+ if (jsxTranspilation === true) {
23
+ jsxTranspilation = {
24
24
  "./**/*.jsx": true,
25
25
  "./**/*.tsx": true,
26
26
  }
27
- } else if (jsx === false) {
28
- jsx = {}
27
+ } else if (jsxTranspilation === false) {
28
+ jsxTranspilation = {}
29
29
  }
30
- if (refresh === true) {
31
- refresh = {
30
+ if (refreshInstrumentation === true) {
31
+ refreshInstrumentation = {
32
32
  "./**/*.jsx": true,
33
33
  "./**/*.tsx": true,
34
34
  }
35
- } else if (refresh === false) {
36
- refresh = {}
35
+ } else if (refreshInstrumentation === false) {
36
+ refreshInstrumentation = {}
37
37
  }
38
- if (inferHookNames === true) {
39
- inferHookNames = { "./**": true }
38
+ if (hookNamesInstrumentation === true) {
39
+ hookNamesInstrumentation = { "./**": true }
40
40
  } else {
41
- inferHookNames = {}
41
+ hookNamesInstrumentation = {}
42
42
  }
43
43
  const associations = URL_META.resolveAssociations(
44
44
  {
45
- jsx,
46
- refresh,
47
- inferHookNames,
45
+ jsxTranspilation,
46
+ refreshInstrumentation,
47
+ hookNamesInstrumentation,
48
48
  },
49
49
  "file://",
50
50
  )
@@ -94,14 +94,14 @@ import ${preactDevtoolsReference.generatedSpecifier}
94
94
  url: urlInfo.url,
95
95
  associations,
96
96
  })
97
- const jsxEnabled = urlMeta.jsx
97
+ const jsxEnabled = urlMeta.jsxTranspilation
98
98
  const refreshEnabled = context.scenarios.dev
99
- ? urlMeta.refresh &&
99
+ ? urlMeta.refreshInstrumentation &&
100
100
  !urlInfo.content.includes("import.meta.hot.decline()")
101
101
  : false
102
102
  const hookNamesEnabled =
103
103
  context.scenarios.dev &&
104
- urlMeta.inferHookNames &&
104
+ urlMeta.hookNamesInstrumentation &&
105
105
  (urlInfo.content.includes("useState") ||
106
106
  urlInfo.content.includes("useReducer") ||
107
107
  urlInfo.content.includes("useRef") ||