Skip to content

Commit

Permalink
react19 and CSP report styles (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
quisido authored Jun 29, 2024
1 parent d1b4350 commit 894d963
Show file tree
Hide file tree
Showing 112 changed files with 3,132 additions and 2,382 deletions.
108 changes: 108 additions & 0 deletions .yarn/patches/@sentry-react-npm-8.13.0-bd23d3c2da.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
diff --git a/build/types/reactrouter.d.ts b/build/types/reactrouter.d.ts
index be2d1cc5085ed7562aae0bf119633bb2cb3d4df0..ced4f4b27d3a5f72cd70494b29768a80fff31e28 100644
--- a/build/types/reactrouter.d.ts
+++ b/build/types/reactrouter.d.ts
@@ -1,5 +1,6 @@
import { browserTracingIntegration } from '@sentry/browser';
import type { Integration } from '@sentry/types';
+import type { ReactElement } from 'react';
import * as React from 'react';
import type { Action, Location } from './types';
type Match = {
@@ -16,7 +17,7 @@ export type RouteConfig = {
[propName: string]: unknown;
path?: string | string[];
exact?: boolean;
- component?: JSX.Element;
+ component?: ReactElement;
routes?: RouteConfig[];
};
export type MatchPath = (pathname: string, props: string | string[] | any, parent?: Match | null) => Match | null;
@@ -36,5 +37,5 @@ export declare function reactRouterV4BrowserTracingIntegration(options: Paramete
*/
export declare function reactRouterV5BrowserTracingIntegration(options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions): Integration;
export declare function withSentryRouting<P extends Record<string, any>, R extends React.ComponentType<P>>(Route: R): R;
-export {};
+export { };
//# sourceMappingURL=reactrouter.d.ts.map
\ No newline at end of file
diff --git a/build/types/types.d.ts b/build/types/types.d.ts
index df1170b124e4f2bbf560ae4cd1b44948801c770e..243a31f1e05dc03c72b1284f56787b4b4e97c070 100644
--- a/build/types/types.d.ts
+++ b/build/types/types.d.ts
@@ -1,4 +1,5 @@
/// <reference types="react" />
+import type { ReactElement } from 'react';
export type Action = 'PUSH' | 'REPLACE' | 'POP';
export type Location = {
pathname: string;
@@ -48,7 +49,7 @@ export type UseLocation = () => Location;
export type UseNavigationType = () => Action;
export type RouteObjectArrayAlias = any;
export type RouteMatchAlias = any;
-export type CreateRoutesFromChildren = (children: JSX.Element[]) => RouteObjectArrayAlias;
+export type CreateRoutesFromChildren = (children: ReactElement[]) => RouteObjectArrayAlias;
export type MatchRoutes = (routes: RouteObjectArrayAlias, location: Location, basename?: string) => RouteMatchAlias[] | null;
export type ShouldRevalidateFunction = (args: any) => boolean;
interface DataFunctionArgs {
@@ -157,5 +158,5 @@ export interface Router<TState extends RouterState = RouterState> {
subscribe(fn: RouterSubscriber<TState>): () => void;
}
export type CreateRouterFunction<TState extends RouterState = RouterState, TRouter extends Router<TState> = Router<TState>> = (routes: RouteObject[], opts?: any) => TRouter;
-export {};
+export { };
//# sourceMappingURL=types.d.ts.map
\ No newline at end of file
diff --git a/build/types-ts3.8/reactrouter.d.ts b/build/types-ts3.8/reactrouter.d.ts
index f4e04c7c27f329555cbe5f09b77942f0fe1fa4f4..6068ff13cc87b66233c4937fd99abd167697a59a 100644
--- a/build/types-ts3.8/reactrouter.d.ts
+++ b/build/types-ts3.8/reactrouter.d.ts
@@ -1,5 +1,6 @@
import { browserTracingIntegration } from '@sentry/browser';
import { Integration } from '@sentry/types';
+import type { ReactElement } from 'react';
import * as React from 'react';
import { Action, Location } from './types';
type Match = {
@@ -16,7 +17,7 @@ export type RouteConfig = {
[propName: string]: unknown;
path?: string | string[];
exact?: boolean;
- component?: JSX.Element;
+ component?: ReactElement;
routes?: RouteConfig[];
};
export type MatchPath = (pathname: string, props: string | string[] | any, parent?: Match | null) => Match | null;
@@ -36,5 +37,5 @@ export declare function reactRouterV4BrowserTracingIntegration(options: Paramete
*/
export declare function reactRouterV5BrowserTracingIntegration(options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions): Integration;
export declare function withSentryRouting<P extends Record<string, any>, R extends React.ComponentType<P>>(Route: R): R;
-export {};
+export { };
//# sourceMappingURL=reactrouter.d.ts.map
diff --git a/build/types-ts3.8/types.d.ts b/build/types-ts3.8/types.d.ts
index ef7b2dbbab2a3d8569018991e1224d3842ad6c5a..428dfe39fa7fe20d22e76c0006be8f3a0e64267d 100644
--- a/build/types-ts3.8/types.d.ts
+++ b/build/types-ts3.8/types.d.ts
@@ -1,4 +1,5 @@
/// <reference types="react" />
+import type { ReactElement } from 'react';
export type Action = 'PUSH' | 'REPLACE' | 'POP';
export type Location = {
pathname: string;
@@ -48,7 +49,7 @@ export type UseLocation = () => Location;
export type UseNavigationType = () => Action;
export type RouteObjectArrayAlias = any;
export type RouteMatchAlias = any;
-export type CreateRoutesFromChildren = (children: JSX.Element[]) => RouteObjectArrayAlias;
+export type CreateRoutesFromChildren = (children: ReactElement[]) => RouteObjectArrayAlias;
export type MatchRoutes = (routes: RouteObjectArrayAlias, location: Location, basename?: string) => RouteMatchAlias[] | null;
export type ShouldRevalidateFunction = (args: any) => boolean;
interface DataFunctionArgs {
@@ -157,5 +158,5 @@ export interface Router<TState extends RouterState = RouterState> {
subscribe(fn: RouterSubscriber<TState>): () => void;
}
export type CreateRouterFunction<TState extends RouterState = RouterState, TRouter extends Router<TState> = Router<TState>> = (routes: RouteObject[], opts?: any) => TRouter;
-export {};
+export { };
//# sourceMappingURL=types.d.ts.map
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
"@types/babel__preset-env": "^7.9.7",
"@types/eslint": "^8.56.10",
"@types/eslint__js": "^8.42.3",
"@types/node": "^20.14.4",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@types/node": "^20.14.9",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"@vitest/coverage-istanbul": "^1.6.0",
"@yarnpkg/sdks": "^3.1.3",
"babel-plugin-replace-import-extension": "^1.1.4",
Expand All @@ -82,17 +82,18 @@
"eslint": "^9.5.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.2",
"eslint-plugin-react": "^7.34.3",
"prettier": "^3.3.2",
"typescript": "^5.4.5",
"typescript-eslint": "^7.13.1",
"typescript": "~5.4.5",
"typescript-eslint": "^7.14.1",
"vitest": "^1.6.0"
},
"resolutions": {
"buildcheck@npm:~0.0.6": "patch:buildcheck@npm%3A0.0.6#~/.yarn/patches/buildcheck-npm-0.0.6-46e0f23ecf.patch",
"@sentry/types@npm:7.107.0": "patch:@sentry/types@npm%3A7.107.0#~/.yarn/patches/@sentry-types-npm-7.107.0-a994f84978.patch",
"@sentry/types@npm:6.19.7": "patch:@sentry/types@npm%3A7.107.0#~/.yarn/patches/@sentry-types-npm-7.107.0-a994f84978.patch",
"@typescript-eslint/eslint-plugin@npm:^5.45.0": "patch:@typescript-eslint/eslint-plugin@npm%3A7.7.0#~/.yarn/patches/@typescript-eslint-eslint-plugin-npm-7.7.0-de43f1e757.patch",
"@typescript-eslint/eslint-plugin@npm:7.7.0": "patch:@typescript-eslint/eslint-plugin@npm%3A7.7.0#~/.yarn/patches/@typescript-eslint-eslint-plugin-npm-7.7.0-de43f1e757.patch"
"@typescript-eslint/eslint-plugin@npm:7.7.0": "patch:@typescript-eslint/eslint-plugin@npm%3A7.7.0#~/.yarn/patches/@typescript-eslint-eslint-plugin-npm-7.7.0-de43f1e757.patch",
"@sentry/react@npm:8.13.0": "patch:@sentry/react@npm%3A8.13.0#~/.yarn/patches/@sentry-react-npm-8.13.0-bd23d3c2da.patch"
}
}
1 change: 1 addition & 0 deletions package.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="node" />
import { readFileSync, readdirSync } from 'node:fs';
import { assert, describe, expect, it } from 'vitest';
import { scripts } from './package.json';
Expand Down
9 changes: 4 additions & 5 deletions packages/authn-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@
"@microsoft/eslint-formatter-sarif": "^3.1.0",
"@quisido/eslint-config": "workspace:^",
"@quisido/vitest-config": "workspace:^",
"@types/node": "^20.14.4",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"@vitest/coverage-istanbul": "^1.6.0",
"babel-plugin-replace-import-extension": "^1.1.4",
"cjs-ts": "workspace:^",
Expand All @@ -57,8 +56,8 @@
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.3.2",
"tslib": "^2.6.3",
"typescript": "^5.4.5",
"vite": "^5.3.1",
"typescript": "~5.4.5",
"vite": "^5.3.2",
"vitest": "^1.6.0"
}
}
8 changes: 4 additions & 4 deletions packages/authn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@babel/preset-env": "^7.24.7",
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@cloudflare/workers-types": "^4.20240614.0",
"@cloudflare/workers-types": "^4.20240620.0",
"@microsoft/eslint-formatter-sarif": "^3.1.0",
"@quisido/eslint-config": "workspace:^",
"@quisido/vitest-config": "workspace:^",
Expand All @@ -61,9 +61,9 @@
"cjs-ts": "workspace:^",
"concurrently": "^8.2.2",
"eslint": "^9.5.0",
"typescript": "^5.4.5",
"vite": "^5.3.1",
"typescript": "~5.4.5",
"vite": "^5.3.2",
"vitest": "^1.6.0",
"wrangler": "^3.60.3"
"wrangler": "^3.62.0"
}
}
14 changes: 14 additions & 0 deletions packages/aws-rum-react/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import configs from '@quisido/eslint-config';
import reactCompiler from 'eslint-plugin-react-compiler';
import reactRefresh from 'eslint-plugin-react-refresh';

/** @type {readonly import('eslint').Linter.FlatConfig[]} */
export default [
...configs,

{
plugins: {
'react-compiler': reactCompiler,
'react-refresh': reactRefresh,
},

rules: {
'react-compiler/react-compiler': 'error',
'react-refresh/only-export-components': 'error',
},
},

{
files: [
'src/test/utils/describe-package-json-scripts.ts',
Expand Down
28 changes: 17 additions & 11 deletions packages/aws-rum-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,36 +42,42 @@
"@microsoft/eslint-formatter-sarif": "^3.1.0",
"@quisido/eslint-config": "workspace:^",
"@quisido/vitest-config": "workspace:^",
"@testing-library/dom": "^10.1.0",
"@testing-library/dom": "^10.2.0",
"@testing-library/react": "^16.0.0",
"@types/babel__core": "^7.20.5",
"@types/babel__preset-env": "^7.9.7",
"@types/node": "^20.14.4",
"@types/react": "^18.3.3",
"@types/react": "npm:types-react@rc",
"@types/whatwg-fetch": "^0.0.33",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/coverage-istanbul": "^1.6.0",
"aws-rum-web": "^1.18.0",
"babel-plugin-react-compiler": "0.0.0-experimental-696af53-20240625",
"babel-plugin-replace-import-extension": "^1.1.4",
"cjs-ts": "workspace:^",
"concurrently": "^8.2.2",
"eslint": "^9.5.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.2",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-compiler": "0.0.0-experimental-0998c1e-20240625",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"jsdom": "^24.1.0",
"prettier": "^3.3.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.4.5",
"react": "19.0.0-rc-e02baf6c92-20240627",
"react-dom": "19.0.0-rc-e02baf6c92-20240627",
"typescript": "~5.4.5",
"unknown2string": "workspace:^",
"vite": "^5.3.1",
"vite": "^5.3.2",
"vitest": "^1.6.0",
"whatwg-fetch": "^3.6.20"
},
"overrides": {
"@types/react": "npm:types-react@rc"
},
"peerDependencies": {
"@aws-sdk/types": ">=3.0.0",
"aws-rum-web": ">=1.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { AwsRum } from 'aws-rum-web';
import type { MutableRefObject, ReactElement, ReactNode } from 'react';
import type { ReactElement, ReactNode, RefObject } from 'react';
import { useMemo, useRef } from 'react';
import AwsRumContext from '../../contexts/aws-rum.js';
import mapRefToFunction from '../../utils/map-ref-to-function.js';
Expand Down Expand Up @@ -38,34 +38,34 @@ export default function MockAwsRumProvider({
registerDomEvents = noop,
setAwsCredentials = noop,
}: Props): ReactElement {
const addPluginRef: MutableRefObject<AwsRum['addPlugin']> = useRef(addPlugin);
const disableRef: MutableRefObject<AwsRum['disable']> = useRef(disable);
const dispatchRef: MutableRefObject<AwsRum['dispatch']> = useRef(dispatch);
const enableRef: MutableRefObject<AwsRum['enable']> = useRef(enable);
const addPluginRef: RefObject<AwsRum['addPlugin']> = useRef(addPlugin);
const disableRef: RefObject<AwsRum['disable']> = useRef(disable);
const dispatchRef: RefObject<AwsRum['dispatch']> = useRef(dispatch);
const enableRef: RefObject<AwsRum['enable']> = useRef(enable);

const addSessionAttributesRef: MutableRefObject<
const addSessionAttributesRef: RefObject<
AwsRum['addSessionAttributes']
> = useRef(addSessionAttributes);

const allowCookiesRef: MutableRefObject<AwsRum['allowCookies']> =
const allowCookiesRef: RefObject<AwsRum['allowCookies']> =
useRef(allowCookies);

const dispatchBeaconRef: MutableRefObject<AwsRum['dispatchBeacon']> =
const dispatchBeaconRef: RefObject<AwsRum['dispatchBeacon']> =
useRef(dispatchBeacon);

const registerDomEventsRef: MutableRefObject<AwsRum['registerDomEvents']> =
const registerDomEventsRef: RefObject<AwsRum['registerDomEvents']> =
useRef(registerDomEvents);

const recordErrorRef: MutableRefObject<AwsRum['recordError']> =
const recordErrorRef: RefObject<AwsRum['recordError']> =
useRef(recordError);

const recordEventRef: MutableRefObject<AwsRum['recordEvent']> =
const recordEventRef: RefObject<AwsRum['recordEvent']> =
useRef(recordEvent);

const recordPageViewRef: MutableRefObject<AwsRum['recordPageView']> =
const recordPageViewRef: RefObject<AwsRum['recordPageView']> =
useRef(recordPageView);

const setAwsCredentialsRef: MutableRefObject<AwsRum['setAwsCredentials']> =
const setAwsCredentialsRef: RefObject<AwsRum['setAwsCredentials']> =
useRef(setAwsCredentials);

addPluginRef.current = addPlugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default function describePackageJsonDevDependencies(
it('should have the expected developer dependencies', (): void => {
assert('@arethetypeswrong/cli' in devDependencies);
assert('@microsoft/eslint-formatter-sarif' in devDependencies);
assert('@types/node' in devDependencies);
assert('@vitest/coverage-istanbul' in devDependencies);
assert('concurrently' in devDependencies);
assert('eslint' in devDependencies);
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-rum-react/src/utils/map-ref-to-function.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { MutableRefObject } from 'react';
import type { RefObject } from 'react';

export default function mapRefToFunction<P extends unknown[], T>(
ref: MutableRefObject<(...args: P) => T>,
ref: RefObject<(...args: P) => T>,
): (...args: P) => T {
return function refFunction(...args: P): T {
return ref.current(...args);
Expand Down
4 changes: 3 additions & 1 deletion packages/aws-rum-react/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import CONFIG, { INLINE_CONFIG } from '@quisido/vitest-config';
import CONFIG, { INLINE_CONFIG, PLUGIN_OPTIONS } from '@quisido/vitest-config';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vitest/config';

export default defineConfig({
...CONFIG,
plugins: [...PLUGIN_OPTIONS, react()],
test: {
...INLINE_CONFIG,
environment: 'jsdom',
Expand Down
7 changes: 3 additions & 4 deletions packages/cjs-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@
"@types/babel__core": "^7.20.5",
"@types/babel__preset-env": "^7.9.7",
"@types/babel__register": "^7.17.3",
"@types/node": "^20.14.4",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"concurrently": "^8.2.2",
"eslint": "^9.5.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.3.2",
"typescript": "^5.4.5"
"typescript": "^5.5.2"
},
"peerDependencies": {
"@babel/core": "^7.24.3",
Expand Down
Loading

0 comments on commit 894d963

Please sign in to comment.