@reactunity/scripts 0.14.0 → 0.14.2

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/README.md CHANGED
@@ -27,11 +27,14 @@ Environment variables of CRA can be used with React Unity. However, there are so
27
27
  - `GENERATE_SOURCEMAP` - `false` by default.
28
28
  - `FAST_REFRESH` - This can be set to `false` to disable `react-refresh` if you are having problems with hot reload
29
29
  - `IMAGE_INLINE_SIZE_LIMIT` - `0` by default. Because non-inlined images will be faster in Unity. However, if users still want to inline images, they should increase this limit.
30
+ - `JSX_IMPORT_SOURCE` - Can be used to allow some custom JSX transformations. For example, set this variable to `@emotion/react` for Emotion.
30
31
 
31
32
  Environment variables can also be defined by having `.env`, `.env.local`, `.env.<development|production>` in project folder.
32
33
 
33
34
  Custom environment variables are also possible as in [CRA](https://create-react-app.dev/docs/adding-custom-environment-variables).
34
35
 
36
+ `.babelrc` can be used to modify some Babel options.
37
+
35
38
  ## Multiple Entry Points
36
39
 
37
40
  In addition to `src/index` file, there can be other entry points. Every file under `src/entry/` folder will be detected and configured as an entry point. For example, if there is a file `src/entry/menu.tsx`, Webpack will detect that and create an entrypoint named `menu` with output `menu.js` in addition to the default entrypoint `index.js`.
@@ -0,0 +1,19 @@
1
+ const babelPresetReact = require('@babel/preset-react').default;
2
+ const babelPresetReactApp = require('babel-preset-react-app');
3
+
4
+ // Extend babel-preset-react-app to accept custom jsxImportSource. This is required for things like @emotion/react
5
+
6
+ module.exports = function (api, opts) {
7
+ const original = babelPresetReactApp(api, opts);
8
+ const jsxImportSource = process.env.JSX_IMPORT_SOURCE;
9
+
10
+ if (jsxImportSource) {
11
+ const preset = original.presets.find(x => x[0] === babelPresetReact);
12
+
13
+ if (preset && preset[1]) {
14
+ preset[1].importSource = jsxImportSource;
15
+ }
16
+ }
17
+
18
+ return original;
19
+ };
@@ -26,12 +26,12 @@ const hasJsxRuntime = (() => {
26
26
  module.exports = babelJest.createTransformer({
27
27
  presets: [
28
28
  [
29
- require.resolve('babel-preset-react-app'),
29
+ require.resolve('../babel-preset-extended'),
30
30
  {
31
31
  runtime: hasJsxRuntime ? 'automatic' : 'classic',
32
32
  },
33
33
  ],
34
34
  ],
35
- babelrc: false,
36
- configFile: false,
35
+ babelrc: true,
36
+ configFile: true,
37
37
  });
@@ -325,6 +325,9 @@ const baseConfigFactory = function (webpackEnv) {
325
325
  // Allows replacing react-dom with @reactunity/renderer to support some functionality like `unstable_batchedUpdates`
326
326
  'react-dom': '@reactunity/renderer',
327
327
 
328
+ // Replaces react-unity-webgl with @reactunity/renderer/webgl-compat to support its functionality
329
+ 'react-unity-webgl': '@reactunity/renderer/webgl-compat',
330
+
328
331
  ...(modules.webpackAliases || {}),
329
332
  },
330
333
  plugins: [
@@ -408,15 +411,17 @@ const baseConfigFactory = function (webpackEnv) {
408
411
  ),
409
412
  presets: [
410
413
  [
411
- require.resolve('babel-preset-react-app'),
414
+ require.resolve('./babel-preset-extended'),
412
415
  {
413
416
  runtime: modules.hasJsxRuntime ? 'automatic' : 'classic',
417
+ flow: false,
418
+ typescript: true,
414
419
  },
415
420
  ],
416
- ],
421
+ ].filter(Boolean),
417
422
  // @remove-on-eject-begin
418
- babelrc: false,
419
- configFile: false,
423
+ babelrc: true,
424
+ configFile: true,
420
425
  // Make sure we have a unique cache identifier, erring on the
421
426
  // side of caution.
422
427
  // We remove this when the user ejects because the default
@@ -455,8 +460,8 @@ const baseConfigFactory = function (webpackEnv) {
455
460
  exclude: /@babel(?:\/|\\{1,2})runtime/,
456
461
  loader: require.resolve('babel-loader'),
457
462
  options: {
458
- babelrc: false,
459
- configFile: false,
463
+ babelrc: true,
464
+ configFile: true,
460
465
  compact: false,
461
466
  presets: [
462
467
  [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactunity/scripts",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "description": "Configuration and scripts for React Unity.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,16 +43,17 @@
43
43
  ]
44
44
  }
45
45
  },
46
+ "tsconfig": "./tsconfig.json",
46
47
  "dependencies": {
47
48
  "@babel/core": "^7.20.12",
48
49
  "@babel/eslint-parser": "^7.19.1",
49
50
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
50
51
  "@svgr/webpack": "^6.5.1",
51
- "@types/react": "^18.0.26",
52
+ "@types/react": "^18.0.28",
52
53
  "@types/webpack-env": "^1.18.0",
53
- "@typescript-eslint/eslint-plugin": "^5.48.1",
54
- "@typescript-eslint/parser": "^5.48.1",
55
- "babel-jest": "^29.3.1",
54
+ "@typescript-eslint/eslint-plugin": "^5.52.0",
55
+ "@typescript-eslint/parser": "^5.52.0",
56
+ "babel-jest": "^29.4.3",
56
57
  "babel-loader": "^9.1.2",
57
58
  "babel-plugin-named-asset-import": "^0.3.8",
58
59
  "babel-preset-react-app": "^10.0.1",
@@ -63,19 +64,19 @@
63
64
  "css-loader": "^6.7.3",
64
65
  "dotenv": "^16.0.3",
65
66
  "dotenv-expand": "^10.0.0",
66
- "eslint": "^8.32.0",
67
- "eslint-plugin-import": "^2.27.4",
67
+ "eslint": "^8.34.0",
68
+ "eslint-plugin-import": "^2.27.5",
68
69
  "eslint-plugin-jest": "^27.2.1",
69
- "eslint-plugin-react": "^7.32.0",
70
+ "eslint-plugin-react": "^7.32.2",
70
71
  "eslint-plugin-react-hooks": "^4.6.0",
71
- "eslint-plugin-testing-library": "^5.9.1",
72
- "eslint-webpack-plugin": "^3.2.0",
72
+ "eslint-plugin-testing-library": "^5.10.2",
73
+ "eslint-webpack-plugin": "^4.0.0",
73
74
  "file-loader": "^6.2.0",
74
75
  "fs-extra": "^11.1.0",
75
76
  "identity-obj-proxy": "^3.0.0",
76
- "jest": "^29.3.1",
77
- "jest-resolve": "^29.3.1",
78
- "jest-watch-typeahead": "^2.2.1",
77
+ "jest": "^29.4.3",
78
+ "jest-resolve": "^29.4.3",
79
+ "jest-watch-typeahead": "^2.2.2",
79
80
  "mini-css-extract-plugin": "^2.7.2",
80
81
  "null-loader": "^4.0.1",
81
82
  "postcss": "^8.4.21",
@@ -87,12 +88,12 @@
87
88
  "react-refresh": "^0.14.0",
88
89
  "resolve": "^1.22.1",
89
90
  "resolve-url-loader": "^5.0.0",
90
- "sass": "^1.57.1",
91
+ "sass": "^1.58.2",
91
92
  "sass-loader": "^13.2.0",
92
93
  "semver": "^7.3.8",
93
94
  "source-map-loader": "^4.0.1",
94
95
  "style-loader": "^3.3.1",
95
- "tailwindcss": "^3.2.4",
96
+ "tailwindcss": "^3.2.7",
96
97
  "terser-webpack-plugin": "^5.3.6",
97
98
  "url-loader": "^4.1.1",
98
99
  "webpack": "^5.75.0",
@@ -100,7 +101,7 @@
100
101
  "webpack-manifest-plugin": "^5.0.0"
101
102
  },
102
103
  "devDependencies": {
103
- "typescript": "^4.9.4"
104
+ "typescript": "^4.9.5"
104
105
  },
105
106
  "optionalDependencies": {
106
107
  "fsevents": "^2.3.2"
@@ -109,7 +110,7 @@
109
110
  "@reactunity/previewer": "*",
110
111
  "@reactunity/renderer": "^0.14.0",
111
112
  "react": "^18.0.0",
112
- "typescript": "^4.9.4"
113
+ "typescript": "^4.9.5"
113
114
  },
114
115
  "peerDependenciesMeta": {
115
116
  "@reactunity/previewer": {