Skip to content

Commit 0adba61

Browse files
authored
Merge branch 'main' into build/eslint-engines
2 parents 2deead2 + 56c7d10 commit 0adba61

File tree

77 files changed

+3609
-1396
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3609
-1396
lines changed

Diff for: .github/workflows/compiler_typescript.yml

+3
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,7 @@ jobs:
9393
path: "**/node_modules"
9494
key: compiler-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/**/yarn.lock') }}
9595
- run: yarn install --frozen-lockfile
96+
- run: xvfb-run -a yarn workspace ${{ matrix.workspace_name }} test
97+
if: runner.os == 'Linux' && matrix.workspace_name == 'react-forgive'
9698
- run: yarn workspace ${{ matrix.workspace_name }} test
99+
if: runner.os != 'Linux' && matrix.workspace_name != 'react-forgive'
+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: (Runtime) Publish Releases from NPM Manual
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_to_promote:
7+
required: true
8+
description: Current npm version (non-experimental) to promote
9+
type: string
10+
version_to_publish:
11+
required: true
12+
description: Version to publish for the specified packages
13+
type: string
14+
only_packages:
15+
description: Packages to publish (space separated)
16+
type: string
17+
skip_packages:
18+
description: Packages to NOT publish (space separated)
19+
type: string
20+
tags:
21+
description: NPM tags (space separated)
22+
type: string
23+
default: untagged
24+
dry:
25+
required: true
26+
description: Dry run instead of publish?
27+
type: boolean
28+
default: true
29+
force_notify:
30+
description: Force a Discord notification?
31+
type: boolean
32+
default: false
33+
34+
env:
35+
TZ: /usr/share/zoneinfo/America/Los_Angeles
36+
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
37+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
38+
GH_TOKEN: ${{ github.token }}
39+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
41+
jobs:
42+
notify:
43+
if: ${{ inputs.force_notify || inputs.dry == false || inputs.dry == 'false' }}
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Discord Webhook Action
47+
uses: tsickert/[email protected]
48+
with:
49+
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
50+
embed-author-name: ${{ github.event.sender.login }}
51+
embed-author-url: ${{ github.event.sender.html_url }}
52+
embed-author-icon-url: ${{ github.event.sender.avatar_url }}
53+
embed-title: "⚠️ Publishing release from NPM${{ (inputs.dry && ' (dry run)') || '' }}"
54+
embed-description: |
55+
```json
56+
${{ toJson(inputs) }}
57+
```
58+
embed-url: https://github.com/facebook/react/actions/runs/${{ github.run_id }}
59+
60+
publish:
61+
name: Publish releases
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@v4
65+
- uses: actions/setup-node@v4
66+
with:
67+
node-version-file: '.nvmrc'
68+
cache: yarn
69+
cache-dependency-path: yarn.lock
70+
- name: Restore cached node_modules
71+
uses: actions/cache@v4
72+
id: node_modules
73+
with:
74+
path: "**/node_modules"
75+
key: runtime-release-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }}
76+
- name: Ensure clean build directory
77+
run: rm -rf build
78+
- run: yarn install --frozen-lockfile
79+
- run: yarn install --frozen-lockfile
80+
working-directory: scripts/release
81+
- run: cp ./scripts/release/ci-npmrc ~/.npmrc
82+
- if: '${{ inputs.only_packages }}'
83+
name: 'Prepare ${{ inputs.only_packages }} from NPM'
84+
run: |
85+
scripts/release/prepare-release-from-npm.js \
86+
--ci \
87+
--skipTests \
88+
--version=${{ inputs.version_to_promote }} \
89+
--publishVersion=${{ inputs.version_to_publish }} \
90+
--onlyPackages=${{ inputs.only_packages }}
91+
- if: '${{ inputs.skip_packages }}'
92+
name: 'Prepare all packages EXCEPT ${{ inputs.skip_packages }} from NPM'
93+
run: |
94+
scripts/release/prepare-release-from-npm.js \
95+
--ci \
96+
--skipTests \
97+
--version=${{ inputs.version_to_promote }} \
98+
--publishVersion=${{ inputs.version_to_publish }} \
99+
--skipPackages=${{ inputs.skip_packages }}
100+
- name: Check prepared files
101+
run: ls -R build/node_modules
102+
- if: '${{ inputs.only_packages }}'
103+
name: 'Publish ${{ inputs.only_packages }}'
104+
run: |
105+
scripts/release/publish.js \
106+
--ci \
107+
--tags=${{ inputs.tags }} \
108+
--publishVersion=${{ inputs.version_to_publish }} \
109+
--onlyPackages=${{ inputs.only_packages }} ${{ (inputs.dry && '') || '\'}}
110+
${{ inputs.dry && '--dry'}}
111+
- if: '${{ inputs.skip_packages }}'
112+
name: 'Publish all packages EXCEPT ${{ inputs.skip_packages }}'
113+
run: |
114+
scripts/release/publish.js \
115+
--ci \
116+
--tags=${{ inputs.tags }} \
117+
--publishVersion=${{ inputs.version_to_publish }} \
118+
--skipPackages=${{ inputs.skip_packages }} ${{ (inputs.dry && '') || '\'}}
119+
${{ inputs.dry && '--dry'}}
120+
- name: Archive released package for debugging
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: build
124+
path: |
125+
./build/node_modules

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ packages/react-devtools-fusebox/dist
3737
packages/react-devtools-inline/dist
3838
packages/react-devtools-shell/dist
3939
packages/react-devtools-timeline/dist
40+

Diff for: compiler/.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ dist
2121
.spr.yml
2222
testfilter.txt
2323

24-
bundle-oss.sh
24+
bundle-oss.sh
25+
26+
# forgive
27+
*.vsix
28+
.vscode-test

Diff for: compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Options.ts

+42-35
Original file line numberDiff line numberDiff line change
@@ -176,41 +176,48 @@ export type CompilationMode = z.infer<typeof CompilationModeSchema>;
176176
* babel or other unhandled exceptions).
177177
*/
178178
export type LoggerEvent =
179-
| {
180-
kind: 'CompileError';
181-
fnLoc: t.SourceLocation | null;
182-
detail: CompilerErrorDetailOptions;
183-
}
184-
| {
185-
kind: 'CompileDiagnostic';
186-
fnLoc: t.SourceLocation | null;
187-
detail: Omit<Omit<CompilerErrorDetailOptions, 'severity'>, 'suggestions'>;
188-
}
189-
| {
190-
kind: 'CompileSkip';
191-
fnLoc: t.SourceLocation | null;
192-
reason: string;
193-
loc: t.SourceLocation | null;
194-
}
195-
| {
196-
kind: 'CompileSuccess';
197-
fnLoc: t.SourceLocation | null;
198-
fnName: string | null;
199-
memoSlots: number;
200-
memoBlocks: number;
201-
memoValues: number;
202-
prunedMemoBlocks: number;
203-
prunedMemoValues: number;
204-
}
205-
| {
206-
kind: 'PipelineError';
207-
fnLoc: t.SourceLocation | null;
208-
data: string;
209-
}
210-
| {
211-
kind: 'Timing';
212-
measurement: PerformanceMeasure;
213-
};
179+
| CompileSuccessEvent
180+
| CompileErrorEvent
181+
| CompileDiagnosticEvent
182+
| CompileSkipEvent
183+
| PipelineErrorEvent
184+
| TimingEvent;
185+
186+
export type CompileErrorEvent = {
187+
kind: 'CompileError';
188+
fnLoc: t.SourceLocation | null;
189+
detail: CompilerErrorDetailOptions;
190+
};
191+
export type CompileDiagnosticEvent = {
192+
kind: 'CompileDiagnostic';
193+
fnLoc: t.SourceLocation | null;
194+
detail: Omit<Omit<CompilerErrorDetailOptions, 'severity'>, 'suggestions'>;
195+
};
196+
export type CompileSuccessEvent = {
197+
kind: 'CompileSuccess';
198+
fnLoc: t.SourceLocation | null;
199+
fnName: string | null;
200+
memoSlots: number;
201+
memoBlocks: number;
202+
memoValues: number;
203+
prunedMemoBlocks: number;
204+
prunedMemoValues: number;
205+
};
206+
export type CompileSkipEvent = {
207+
kind: 'CompileSkip';
208+
fnLoc: t.SourceLocation | null;
209+
reason: string;
210+
loc: t.SourceLocation | null;
211+
};
212+
export type PipelineErrorEvent = {
213+
kind: 'PipelineError';
214+
fnLoc: t.SourceLocation | null;
215+
data: string;
216+
};
217+
export type TimingEvent = {
218+
kind: 'Timing';
219+
measurement: PerformanceMeasure;
220+
};
214221

215222
export type Logger = {
216223
logEvent: (filename: string | null, event: LoggerEvent) => void;

Diff for: compiler/packages/react-forgive/.vscode-test.mjs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import {defineConfig} from '@vscode/test-cli';
2+
3+
export default defineConfig({files: 'dist/test/**/*.test.js'});

Diff for: compiler/packages/react-forgive/.vscodeignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/node_modules
2+
client
3+
server
4+
scripts
5+
.vscode-test.mjs

Diff for: compiler/packages/react-forgive/.yarnrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ignore-engines true

Diff for: compiler/packages/react-forgive/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Meta Platforms, Inc. and affiliates.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Diff for: compiler/packages/react-forgive/client/package.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"private": "true",
3+
"name": "react-forgive-client",
4+
"version": "0.0.0",
5+
"description": "Experimental LSP client",
6+
"license": "MIT",
7+
"scripts": {
8+
"build": "echo 'no build'",
9+
"test": "echo 'no tests'"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/facebook/react.git",
14+
"directory": "compiler/packages/react-forgive"
15+
},
16+
"dependencies": {
17+
"vscode-languageclient": "^9.0.1"
18+
},
19+
"devDependencies": {
20+
"@types/vscode": "^1.95.0"
21+
}
22+
}
+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import * as path from 'path';
2+
import {ExtensionContext, window as Window} from 'vscode';
3+
4+
import {
5+
LanguageClient,
6+
LanguageClientOptions,
7+
ServerOptions,
8+
TransportKind,
9+
} from 'vscode-languageclient/node';
10+
11+
let client: LanguageClient;
12+
13+
export function activate(context: ExtensionContext) {
14+
const serverModule = context.asAbsolutePath(path.join('dist', 'server.js'));
15+
16+
// If the extension is launched in debug mode then the debug server options are used
17+
// Otherwise the run options are used
18+
const serverOptions: ServerOptions = {
19+
run: {
20+
module: serverModule,
21+
transport: TransportKind.ipc,
22+
},
23+
debug: {
24+
module: serverModule,
25+
transport: TransportKind.ipc,
26+
},
27+
};
28+
29+
const clientOptions: LanguageClientOptions = {
30+
documentSelector: [
31+
{scheme: 'file', language: 'javascriptreact'},
32+
{scheme: 'file', language: 'typescriptreact'},
33+
],
34+
progressOnInitialization: true,
35+
};
36+
37+
// Create the language client and start the client.
38+
try {
39+
client = new LanguageClient(
40+
'react-forgive',
41+
'React Analyzer',
42+
serverOptions,
43+
clientOptions,
44+
);
45+
} catch {
46+
Window.showErrorMessage(
47+
`React Analyzer couldn't be started. See the output channel for details.`,
48+
);
49+
return;
50+
}
51+
52+
client.registerProposedFeatures();
53+
client.start();
54+
}
55+
56+
export function deactivate(): Thenable<void> | undefined {
57+
if (client !== undefined) {
58+
return client.stop();
59+
}
60+
}

0 commit comments

Comments
 (0)