@jsenv/plugin-react 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-react",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,7 +27,7 @@
27
27
  "@babel/plugin-transform-react-jsx": "7.19.0",
28
28
  "@babel/plugin-transform-react-jsx-development": "7.18.6",
29
29
  "@jsenv/ast": "1.3.2",
30
- "@jsenv/plugin-commonjs": "1.0.4",
30
+ "@jsenv/plugin-commonjs": "1.0.5",
31
31
  "@jsenv/sourcemap": "1.0.5",
32
32
  "@jsenv/url-meta": "7.0.0",
33
33
  "react-refresh": "0.14.0"
@@ -11,8 +11,8 @@ import { jsenvPluginReactRefreshPreamble } from "./jsenv_plugin_react_refresh_pr
11
11
 
12
12
  export const jsenvPluginReact = ({
13
13
  asJsModuleLogLevel,
14
- jsx = true,
15
- refresh = false,
14
+ jsxTranspilation = true,
15
+ refreshInstrumentation = false,
16
16
  } = {}) => {
17
17
  return [
18
18
  jsenvPluginCommonJs({
@@ -27,31 +27,34 @@ export const jsenvPluginReact = ({
27
27
  },
28
28
  }),
29
29
  jsenvPluginReactRefreshPreamble(),
30
- jsenvPluginJsxAndRefresh({ jsx, refresh }),
30
+ jsenvPluginJsxAndRefresh({ jsxTranspilation, refreshInstrumentation }),
31
31
  ]
32
32
  }
33
33
 
34
- const jsenvPluginJsxAndRefresh = ({ jsx, refresh }) => {
35
- if (jsx === true) {
36
- jsx = {
34
+ const jsenvPluginJsxAndRefresh = ({
35
+ jsxTranspilation,
36
+ refreshInstrumentation,
37
+ }) => {
38
+ if (jsxTranspilation === true) {
39
+ jsxTranspilation = {
37
40
  "./**/*.jsx": true,
38
41
  "./**/*.tsx": true,
39
42
  }
40
- } else if (jsx === false) {
41
- jsx = {}
43
+ } else if (jsxTranspilation === false) {
44
+ jsxTranspilation = {}
42
45
  }
43
- if (refresh === true) {
44
- refresh = {
46
+ if (refreshInstrumentation === true) {
47
+ refreshInstrumentation = {
45
48
  "./**/*.jsx": true,
46
49
  "./**/*.tsx": true,
47
50
  }
48
- } else if (refresh === false) {
49
- refresh = {}
51
+ } else if (refreshInstrumentation === false) {
52
+ refreshInstrumentation = {}
50
53
  }
51
54
  const associations = URL_META.resolveAssociations(
52
55
  {
53
- jsx,
54
- refresh,
56
+ jsxTranspilation,
57
+ refreshInstrumentation,
55
58
  },
56
59
  "file://",
57
60
  )
@@ -65,9 +68,9 @@ const jsenvPluginJsxAndRefresh = ({ jsx, refresh }) => {
65
68
  url: urlInfo.url,
66
69
  associations,
67
70
  })
68
- const jsxEnabled = urlMeta.jsx
71
+ const jsxEnabled = urlMeta.jsxTranspilation
69
72
  const refreshEnabled = context.scenarios.dev
70
- ? urlMeta.refresh &&
73
+ ? urlMeta.refreshInstrumentation &&
71
74
  !urlInfo.content.includes("import.meta.hot.decline()")
72
75
  : false
73
76
  const babelPlugins = [