Skip to content

Commit 362c6ab

Browse files
committed
[forgive] Various fixes to prepare for internal sync
Fixes a few small things: - Update imports to reference root babel-plugin-react-compiler rather than from `[...]/src/...` - Remove unused cosmiconfig options parsing for now - Update type exports in babel-plugin-react-compiler accordingly
1 parent 031595d commit 362c6ab

File tree

9 files changed

+15
-123
lines changed

9 files changed

+15
-123
lines changed

compiler/packages/babel-plugin-react-compiler/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ export {
2929
ProgramContext,
3030
tryFindDirectiveEnablingMemoization as findDirectiveEnablingMemoization,
3131
findDirectiveDisablingMemoization,
32+
defaultOptions,
3233
type CompilerPipelineValue,
3334
type Logger,
3435
type LoggerEvent,
3536
type PluginOptions,
37+
type AutoDepsDecorationsEvent,
38+
type CompileSuccessEvent,
3639
} from './Entrypoint';
3740
export {
3841
Effect,

compiler/packages/react-forgive/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@
3636
},
3737
"scripts": {
3838
"build": "yarn run compile",
39+
"build:compiler": "yarn workspace babel-plugin-react-compiler build --dts",
3940
"compile": "rimraf dist && concurrently -n server,client \"scripts/build.mjs -t server\" \"scripts/build.mjs -t client\"",
4041
"dev": "yarn run package && yarn run install-ext",
4142
"install-ext": "code --install-extension react-forgive-0.0.0.vsix",
4243
"lint": "echo 'no tests'",
4344
"package": "rm -f react-forgive-0.0.0.vsix && vsce package --yarn",
4445
"postinstall": "cd client && yarn install && cd ../server && yarn install && cd ..",
4546
"pretest": "yarn run compile && yarn run lint",
46-
"test": "vscode-test",
47+
"test": "yarn build:compiler && vscode-test",
4748
"vscode:prepublish": "yarn run compile",
4849
"watch": "scripts/build.mjs --watch"
4950
},

compiler/packages/react-forgive/server/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"@babel/parser": "^7.26.0",
1919
"@babel/plugin-syntax-typescript": "^7.25.9",
2020
"@babel/types": "^7.26.0",
21-
"cosmiconfig": "^9.0.0",
2221
"prettier": "^3.3.3",
2322
"vscode-languageserver": "^9.0.1",
2423
"vscode-languageserver-textdocument": "^1.0.12"

compiler/packages/react-forgive/server/src/compiler/compat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import {SourceLocation} from 'babel-plugin-react-compiler/src';
8+
import {type SourceLocation} from 'babel-plugin-react-compiler';
99
import {type Range} from 'vscode-languageserver';
1010

1111
export function babelLocationToRange(loc: SourceLocation): Range | null {

compiler/packages/react-forgive/server/src/compiler/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type * as BabelCore from '@babel/core';
99
import {parseAsync, transformFromAstAsync} from '@babel/core';
1010
import BabelPluginReactCompiler, {
1111
type PluginOptions,
12-
} from 'babel-plugin-react-compiler/src';
12+
} from 'babel-plugin-react-compiler';
1313
import * as babelParser from 'prettier/plugins/babel.js';
1414
import estreeParser from 'prettier/plugins/estree';
1515
import * as typescriptParser from 'prettier/plugins/typescript';

compiler/packages/react-forgive/server/src/compiler/options.ts

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

compiler/packages/react-forgive/server/src/index.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ import {
2020
TextDocumentSyncKind,
2121
} from 'vscode-languageserver/node';
2222
import {compile, lastResult} from './compiler';
23-
import {type PluginOptions} from 'babel-plugin-react-compiler/src';
24-
import {resolveReactConfig} from './compiler/options';
2523
import {
2624
type CompileSuccessEvent,
2725
type LoggerEvent,
26+
type PluginOptions,
2827
defaultOptions,
29-
} from 'babel-plugin-react-compiler/src/Entrypoint/Options';
28+
} from 'babel-plugin-react-compiler';
3029
import {babelLocationToRange, getRangeFirstCharacter} from './compiler/compat';
3130
import {
3231
type AutoDepsDecorationsLSPEvent,
@@ -64,8 +63,7 @@ type CodeActionLSPEvent = {
6463
};
6564

6665
connection.onInitialize((_params: InitializeParams) => {
67-
// TODO(@poteto) get config fr
68-
compilerOptions = resolveReactConfig('.') ?? defaultOptions;
66+
compilerOptions = defaultOptions;
6967
compilerOptions = {
7068
...compilerOptions,
7169
environment: {
@@ -76,21 +74,21 @@ connection.onInitialize((_params: InitializeParams) => {
7674
importSpecifierName: 'useEffect',
7775
source: 'react',
7876
},
79-
numRequiredArgs: 1,
77+
autodepsIndex: 1,
8078
},
8179
{
8280
function: {
8381
importSpecifierName: 'useSpecialEffect',
8482
source: 'shared-runtime',
8583
},
86-
numRequiredArgs: 2,
84+
autodepsIndex: 2,
8785
},
8886
{
8987
function: {
9088
importSpecifierName: 'default',
9189
source: 'useEffectWrapper',
9290
},
93-
numRequiredArgs: 1,
91+
autodepsIndex: 1,
9492
},
9593
],
9694
},

compiler/packages/react-forgive/server/src/requests/autodepsdecorations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import {type AutoDepsDecorationsEvent} from 'babel-plugin-react-compiler/src/Entrypoint';
8+
import {type AutoDepsDecorationsEvent} from 'babel-plugin-react-compiler';
99
import {type Position} from 'vscode-languageserver-textdocument';
1010
import {RequestType} from 'vscode-languageserver/node';
1111
import {type Range, sourceLocationToRange} from '../utils/range';

compiler/packages/react-forgive/server/yarn.lock

Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@jridgewell/gen-mapping" "^0.3.5"
1111
"@jridgewell/trace-mapping" "^0.3.24"
1212

13-
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.25.9", "@babel/code-frame@^7.26.0", "@babel/code-frame@^7.26.2":
13+
"@babel/code-frame@^7.25.9", "@babel/code-frame@^7.26.0", "@babel/code-frame@^7.26.2":
1414
version "7.26.2"
1515
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85"
1616
integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==
@@ -188,11 +188,6 @@
188188
"@jridgewell/resolve-uri" "^3.1.0"
189189
"@jridgewell/sourcemap-codec" "^1.4.14"
190190

191-
argparse@^2.0.1:
192-
version "2.0.1"
193-
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
194-
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
195-
196191
browserslist@^4.24.0:
197192
version "4.24.3"
198193
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.3.tgz#5fc2725ca8fb3c1432e13dac278c7cc103e026d2"
@@ -203,11 +198,6 @@ browserslist@^4.24.0:
203198
node-releases "^2.0.19"
204199
update-browserslist-db "^1.1.1"
205200

206-
callsites@^3.0.0:
207-
version "3.1.0"
208-
resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
209-
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
210-
211201
caniuse-lite@^1.0.30001688:
212202
version "1.0.30001690"
213203
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001690.tgz#f2d15e3aaf8e18f76b2b8c1481abde063b8104c8"
@@ -218,16 +208,6 @@ convert-source-map@^2.0.0:
218208
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a"
219209
integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==
220210

221-
cosmiconfig@^9.0.0:
222-
version "9.0.0"
223-
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-9.0.0.tgz#34c3fc58287b915f3ae905ab6dc3de258b55ad9d"
224-
integrity sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==
225-
dependencies:
226-
env-paths "^2.2.1"
227-
import-fresh "^3.3.0"
228-
js-yaml "^4.1.0"
229-
parse-json "^5.2.0"
230-
231211
debug@^4.1.0, debug@^4.3.1:
232212
version "4.4.0"
233213
resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a"
@@ -240,18 +220,6 @@ electron-to-chromium@^1.5.73:
240220
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.74.tgz#cb886b504a6467e4c00bea3317edb38393c53413"
241221
integrity sha512-ck3//9RC+6oss/1Bh9tiAVFy5vfSKbRHAFh7Z3/eTRkEqJeWgymloShB17Vg3Z4nmDNp35vAd1BZ6CMW4Wt6Iw==
242222

243-
env-paths@^2.2.1:
244-
version "2.2.1"
245-
resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2"
246-
integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==
247-
248-
error-ex@^1.3.1:
249-
version "1.3.2"
250-
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
251-
integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==
252-
dependencies:
253-
is-arrayish "^0.2.1"
254-
255223
escalade@^3.2.0:
256224
version "3.2.0"
257225
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5"
@@ -267,51 +235,21 @@ globals@^11.1.0:
267235
resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e"
268236
integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==
269237

270-
import-fresh@^3.3.0:
271-
version "3.3.0"
272-
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b"
273-
integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==
274-
dependencies:
275-
parent-module "^1.0.0"
276-
resolve-from "^4.0.0"
277-
278-
is-arrayish@^0.2.1:
279-
version "0.2.1"
280-
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
281-
integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==
282-
283238
js-tokens@^4.0.0:
284239
version "4.0.0"
285240
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
286241
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
287242

288-
js-yaml@^4.1.0:
289-
version "4.1.0"
290-
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
291-
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
292-
dependencies:
293-
argparse "^2.0.1"
294-
295243
jsesc@^3.0.2:
296244
version "3.1.0"
297245
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.1.0.tgz#74d335a234f67ed19907fdadfac7ccf9d409825d"
298246
integrity sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==
299247

300-
json-parse-even-better-errors@^2.3.0:
301-
version "2.3.1"
302-
resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d"
303-
integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==
304-
305248
json5@^2.2.3:
306249
version "2.2.3"
307250
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
308251
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
309252

310-
lines-and-columns@^1.1.6:
311-
version "1.2.4"
312-
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
313-
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
314-
315253
lru-cache@^5.1.1:
316254
version "5.1.1"
317255
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920"
@@ -329,23 +267,6 @@ node-releases@^2.0.19:
329267
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.19.tgz#9e445a52950951ec4d177d843af370b411caf314"
330268
integrity sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==
331269

332-
parent-module@^1.0.0:
333-
version "1.0.1"
334-
resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"
335-
integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==
336-
dependencies:
337-
callsites "^3.0.0"
338-
339-
parse-json@^5.2.0:
340-
version "5.2.0"
341-
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd"
342-
integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==
343-
dependencies:
344-
"@babel/code-frame" "^7.0.0"
345-
error-ex "^1.3.1"
346-
json-parse-even-better-errors "^2.3.0"
347-
lines-and-columns "^1.1.6"
348-
349270
picocolors@^1.0.0, picocolors@^1.1.0:
350271
version "1.1.1"
351272
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
@@ -356,11 +277,6 @@ prettier@^3.3.3:
356277
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.4.2.tgz#a5ce1fb522a588bf2b78ca44c6e6fe5aa5a2b13f"
357278
integrity sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==
358279

359-
resolve-from@^4.0.0:
360-
version "4.0.0"
361-
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
362-
integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==
363-
364280
semver@^6.3.1:
365281
version "6.3.1"
366282
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"

0 commit comments

Comments
 (0)