Skip to content

Commit

Permalink
feat: introduce using support (#67)
Browse files Browse the repository at this point in the history
* feat: introduce `using` support

* fix: use same babel versions

* ts fix
  • Loading branch information
danilowoz authored May 14, 2024
1 parent e236687 commit 4577e19
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 7 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
},
"browserslist": "> 2.5%, not ie 11, not dead, not op_mini all",
"dependencies": {
"@babel/standalone": "7.18.4",
"@babel/plugin-proposal-explicit-resource-management": "7.24.1",
"@babel/standalone": "7.24.1",
"@msgpack/msgpack": "^2.8.0",
"@swc/helpers": "^0.3.8",
"@types/babel__standalone": "7.1.4",
Expand Down
5 changes: 4 additions & 1 deletion src/bundler/presets/react/ReactPreset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export class ReactPreset extends Preset {
},
],
],
plugins: [['react-refresh/babel', { skipEnvCheck: true }]],
plugins: [
['react-refresh/babel', { skipEnvCheck: true }],
'@babel/plugin-proposal-explicit-resource-management',
],
},
],
['react-refresh-transformer', {}],
Expand Down
7 changes: 7 additions & 0 deletions src/bundler/transforms/babel/babel-plugin-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ const BABEL_PLUGIN_LOADERS: Map<string, LoaderFn> = new Map([
return import('solid-refresh/babel');
},
],
[
'@babel/plugin-proposal-explicit-resource-management',
() => {
// @ts-ignore
return import('@babel/plugin-proposal-explicit-resource-management');
},
],
]);

function load(key: string, loader: LoaderFn): Promise<any> {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class SandpackInstance {
initResizeEvent() {
const resizePolling = () => {
if (this.resizePollingTimer) {
clearInterval(this.resizePollingTimer);
clearInterval(this.resizePollingTimer as NodeJS.Timeout);
}

this.resizePollingTimer = setInterval(this.sendResizeEvent, 300);
Expand Down
28 changes: 24 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz#dd7ee3735e8a313b9f7b05a773d892e88e6d7295"
integrity sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==

"@babel/helper-plugin-utils@^7.24.0":
version "7.24.0"
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz#945681931a52f15ce879fd5b86ce2dae6d3d7f2a"
integrity sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w==

"@babel/helper-remap-async-to-generator@^7.18.9", "@babel/helper-remap-async-to-generator@^7.22.5":
version "7.22.20"
resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.22.20.tgz#7b68e1cb4fa964d2996fd063723fb48eca8498e0"
Expand Down Expand Up @@ -321,6 +326,14 @@
"@babel/helper-plugin-utils" "^7.18.6"
"@babel/plugin-syntax-dynamic-import" "^7.8.3"

"@babel/[email protected]":
version "7.24.1"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-explicit-resource-management/-/plugin-proposal-explicit-resource-management-7.24.1.tgz#89f0b1c3b50a413a455cf9d8a51572796830de60"
integrity sha512-EKo54CzU3YvAhL4al3BCjBFHauc7dVpwNliedc/MIxoTfm/XREkEST5b8yw/my+2I+Oy7gBowkfLbIrDS/qvOg==
dependencies:
"@babel/helper-plugin-utils" "^7.24.0"
"@babel/plugin-syntax-explicit-resource-management" "^7.24.1"

"@babel/plugin-proposal-export-namespace-from@^7.17.12":
version "7.18.9"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.18.9.tgz#5f7313ab348cdb19d590145f9247540e94761203"
Expand Down Expand Up @@ -450,6 +463,13 @@
dependencies:
"@babel/helper-plugin-utils" "^7.8.0"

"@babel/plugin-syntax-explicit-resource-management@^7.24.1":
version "7.24.1"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-explicit-resource-management/-/plugin-syntax-explicit-resource-management-7.24.1.tgz#b5b0c37e2fc110a613ae31a56bfe5e3ffa76eded"
integrity sha512-WqeBqPTaJ32uBc9X7vvq2EXO9UMPb3BQAKi2TgreCcnr1gDaGzqz7MgazFi/USulU5H/tz33C+rJl0SghlpN/A==
dependencies:
"@babel/helper-plugin-utils" "^7.24.0"

"@babel/plugin-syntax-export-namespace-from@^7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz#028964a9ba80dbc094c915c487ad7c4e7a66465a"
Expand Down Expand Up @@ -912,10 +932,10 @@
dependencies:
regenerator-runtime "^0.14.0"

"@babel/standalone@7.18.4":
version "7.18.4"
resolved "https://registry.yarnpkg.com/@babel/standalone/-/standalone-7.18.4.tgz#2a30c7e9a97227399929011dfe19f9f155c59e80"
integrity sha512-3dDouWyjdS8sJTm6hf8KkJq7fr9ORWMlWGNcMV/Uz2rNnoI6uu8wJGhZ7E65J+x6v8ta9yPbzkUT2YBFcWUbWg==
"@babel/standalone@7.24.1":
version "7.24.1"
resolved "https://registry.yarnpkg.com/@babel/standalone/-/standalone-7.24.1.tgz#1ab88b65c8080049f239fdd4b0fd17b3f9a1bf16"
integrity sha512-B7Xi9J/nknWGsBUwaC2Xd+tT/BgSL+ZQJ4Y6ksN77w36IKZteVkWBs2jq1EiPReiBD4K0mEGqTKXNT/ndUqxnQ==

"@babel/template@^7.22.15", "@babel/template@^7.22.5", "@babel/template@^7.3.3":
version "7.22.15"
Expand Down

0 comments on commit 4577e19

Please sign in to comment.