Skip to content

Commit f140600

Browse files
authored
fix: Work around solid refresh bugs (#7613)
* update solid-refresh and babel-standalone * force update @babel/types by messing with yarn.lock * disable refresh babel plugins/presets for node_modules * chore: delete old babel version * undo babel upgrade * update babel-types * class properties explicit
1 parent 521cf45 commit f140600

File tree

9 files changed

+126385
-123299
lines changed

9 files changed

+126385
-123299
lines changed

packages/app/src/sandbox/eval/presets/create-react-app/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import base64Transpiler from '../../transpilers/base64';
2626
export const BASE_REACT_BABEL_PLUGINS = [
2727
'transform-flow-strip-types',
2828
['proposal-decorators', { legacy: true }],
29+
['proposal-class-properties', { loose: true }],
2930
'@babel/plugin-transform-react-jsx-source',
3031
'babel-plugin-macros',
3132
[

packages/app/src/sandbox/eval/presets/solid/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function initialize() {
3434
const deps = { ...originalDeps };
3535

3636
if (!deps['solid-refresh']) {
37-
deps['solid-refresh'] = '^0.4.0';
37+
deps['solid-refresh'] = '^0.5.2';
3838
}
3939

4040
if (!deps['babel-preset-solid']) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const BABEL7_VERSION = '7.20.13';
1+
export const BABEL7_VERSION = '7.21.8';

packages/app/src/sandbox/eval/transpilers/babel/worker/babel-worker.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ async function installPlugin(opts, count = 0) {
292292
evaluatedPlugin = evaluatedFromPath.default || evaluatedFromPath;
293293
} catch (err) {
294294
if (count > 5) {
295+
console.error('Compiling babel plugin ' + name + ' went wrong, got:');
295296
throw err;
296297
}
297298

@@ -367,6 +368,7 @@ async function installPreset(opts, count = 0) {
367368
evaluatedPreset = evaluatedFromPath.default || evaluatedFromPath;
368369
} catch (err) {
369370
if (count > 5) {
371+
console.error('Compiling babel preset ' + name + ' went wrong, got:');
370372
throw err;
371373
}
372374

@@ -499,6 +501,17 @@ function getCustomConfig(
499501
async function compile(opts: any) {
500502
const { code, config, path, isV7, loaderContextId } = opts;
501503

504+
if (path.includes('node_modules')) {
505+
const filterRefreshPlugins = p => {
506+
return typeof p === 'string'
507+
? !p.includes('refresh')
508+
: !p[0].includes('refresh');
509+
};
510+
511+
config.plugins = config.plugins.filter(filterRefreshPlugins);
512+
config.presets = config.presets.filter(filterRefreshPlugins);
513+
}
514+
502515
try {
503516
let result;
504517
try {

packages/app/static/js/babel.7.20.13.js

Lines changed: 0 additions & 123277 deletions
This file was deleted.

packages/app/static/js/babel.7.20.13.min.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/app/static/js/babel.7.21.8.js

Lines changed: 126338 additions & 0 deletions
Large diffs are not rendered by default.

packages/app/static/js/babel.7.21.8.min.js

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

yarn.lock

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,11 @@
454454
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.9.tgz#6654d171b2024f6d8ee151bf2509699919131d48"
455455
integrity sha512-pQYxPY0UP6IHISRitNe8bsijHex4TWZXi2HwKVsjPiltzlhse2znVcm9Ace510VT1kxIHjGJCZZQBX2gJDbo0g==
456456

457+
"@babel/helper-validator-identifier@^7.19.1":
458+
version "7.19.1"
459+
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2"
460+
integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==
461+
457462
"@babel/helper-validator-option@^7.14.5":
458463
version "7.14.5"
459464
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz#6e72a1fff18d5dfcb878e1e62f1a021c4b72d5a3"
@@ -1371,6 +1376,11 @@
13711376
lodash "^4.17.13"
13721377
to-fast-properties "^2.0.0"
13731378

1379+
"@babel/helper-string-parser@^7.21.5":
1380+
version "7.21.5"
1381+
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.21.5.tgz#2b3eea65443c6bdc31c22d037c65f6d323b6b2bd"
1382+
integrity sha512-5pTUx3hAJaZIdW99sJ6ZUUgWq/Y+Hja7TowEnLNMm1VivRgZQL3vpBY3qUACVsvw+yQU6+YgfBVmcbLaZtrA1w==
1383+
13741384
"@babel/types@^7.0.0", "@babel/types@^7.0.0-beta.49", "@babel/types@^7.1.6", "@babel/types@^7.10.1", "@babel/types@^7.10.3", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0", "@babel/types@^7.9.5", "@babel/types@^7.9.6":
13751385
version "7.11.5"
13761386
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.11.5.tgz#d9de577d01252d77c6800cee039ee64faf75662d"
@@ -1381,11 +1391,12 @@
13811391
to-fast-properties "^2.0.0"
13821392

13831393
"@babel/types@^7.12.6", "@babel/types@^7.15.4":
1384-
version "7.15.4"
1385-
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.4.tgz#74eeb86dbd6748d2741396557b9860e57fce0a0d"
1386-
integrity sha512-0f1HJFuGmmbrKTCZtbm3cU+b/AqdEYk5toj5iQur58xkVMlS0JWaKxTBSmCXd47uiN7vbcozAupm6Mvs80GNhw==
1394+
version "7.21.5"
1395+
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.21.5.tgz#18dfbd47c39d3904d5db3d3dc2cc80bedb60e5b6"
1396+
integrity sha512-m4AfNvVF2mVC/F7fDEdH2El3HzUg9It/XsCxZiOTTA3m3qYfcSVSbTfM6Q9xG+hYDniZssYhlXKKUMD5m8tF4Q==
13871397
dependencies:
1388-
"@babel/helper-validator-identifier" "^7.14.9"
1398+
"@babel/helper-string-parser" "^7.21.5"
1399+
"@babel/helper-validator-identifier" "^7.19.1"
13891400
to-fast-properties "^2.0.0"
13901401

13911402
"@bcoe/v8-coverage@^0.2.3":
@@ -33003,4 +33014,4 @@ zoom-level@^1.2.4:
3300333014
zustand@^3.6.9:
3300433015
version "3.7.2"
3300533016
resolved "https://registry.yarnpkg.com/zustand/-/zustand-3.7.2.tgz#7b44c4f4a5bfd7a8296a3957b13e1c346f42514d"
33006-
integrity sha512-PIJDIZKtokhof+9+60cpockVOq05sJzHCriyvaLBmEJixseQ1a5Kdov6fWZfWOu5SK9c+FhH1jU0tntLxRJYMA==
33017+
integrity sha512-PIJDIZKtokhof+9+60cpockVOq05sJzHCriyvaLBmEJixseQ1a5Kdov6fWZfWOu5SK9c+FhH1jU0tntLxRJYMA==

0 commit comments

Comments
 (0)