From 5a878391fdf4b92dfe38c771f86da5403c9f97a2 Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Wed, 15 Jun 2022 17:07:52 -0700 Subject: [PATCH 1/6] make `@sentry/types` a runtime dependency --- packages/remix/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/remix/package.json b/packages/remix/package.json index 475d1cc81b09..755f0e9a33ee 100644 --- a/packages/remix/package.json +++ b/packages/remix/package.json @@ -21,12 +21,12 @@ "@sentry/node": "7.1.1", "@sentry/react": "7.1.1", "@sentry/tracing": "7.1.1", + "@sentry/types": "7.1.1", "@sentry/utils": "7.1.1", "@sentry/webpack-plugin": "1.18.9", "tslib": "^1.9.3" }, "devDependencies": { - "@sentry/types": "7.1.1", "@types/webpack": "^4.41.31", "@remix-run/node": "^1.4.3", "@remix-run/react": "^1.4.3" From 1b28589e008050896404428676742d29a14d8a31 Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Wed, 15 Jun 2022 17:08:11 -0700 Subject: [PATCH 2/6] update scripts to match other packages --- packages/remix/package.json | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/remix/package.json b/packages/remix/package.json index 755f0e9a33ee..fca18914a0a0 100644 --- a/packages/remix/package.json +++ b/packages/remix/package.json @@ -43,22 +43,20 @@ } }, "scripts": { - "build": "run-p build:rollup", + "build": "run-p build:rollup build:types", "build:dev": "run-s build", - "build:esm": "tsc -p tsconfig.esm.json", "build:rollup": "rollup -c rollup.npm.config.js", "build:types": "tsc -p tsconfig.types.json", - "build:watch": "run-p build:esm:watch", + "build:watch": "run-p build:rollup:watch build:types:watch", "build:dev:watch": "run-s build:watch", - "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:rollup:watch": "rollup -c rollup.npm.config.js --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build", - "clean": "rimraf build coverage", + "circularDepCheck": "madge --circular src/index.ts", + "clean": "rimraf build coverage sentry-remix-*.tgz", "fix": "run-s fix:eslint fix:prettier", "fix:eslint": "eslint . --format stylish --fix", "fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"", - "link:yarn": "yarn link", "lint": "run-s lint:prettier lint:eslint", "lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish", "lint:prettier": "prettier --check \"{src,test,scripts}/**/*.ts\"", From 0cc69e5e113cce4b2ff3d2d3783316bc28d0fff2 Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Wed, 15 Jun 2022 17:08:25 -0700 Subject: [PATCH 3/6] delete obsolete tsconfig --- packages/remix/tsconfig.esm.json | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 packages/remix/tsconfig.esm.json diff --git a/packages/remix/tsconfig.esm.json b/packages/remix/tsconfig.esm.json deleted file mode 100644 index 0b86c52918cc..000000000000 --- a/packages/remix/tsconfig.esm.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.json", - - "compilerOptions": { - "module": "es6", - "outDir": "build/esm" - } -} From 26caf5b5e813ff13b626fab9f3451948bf1ca10f Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Wed, 15 Jun 2022 18:24:01 -0700 Subject: [PATCH 4/6] fix debug flag --- packages/remix/src/flags.ts | 18 ------------------ packages/remix/src/performance/client.tsx | 4 +--- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 packages/remix/src/flags.ts diff --git a/packages/remix/src/flags.ts b/packages/remix/src/flags.ts deleted file mode 100644 index fb99adbc2aa7..000000000000 --- a/packages/remix/src/flags.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking - * for users. - * - * Debug flags need to be declared in each package individually and must not be imported across package boundaries, - * because some build tools have trouble tree-shaking imported guards. - * - * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder. - * - * Debug flag files will contain "magic strings" like `__SENTRY_DEBUG__` that may get replaced with actual values during - * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not - * replaced. - */ - -declare const __SENTRY_DEBUG__: boolean; - -/** Flag that is true for debug builds, false otherwise. */ -export const IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__; diff --git a/packages/remix/src/performance/client.tsx b/packages/remix/src/performance/client.tsx index a55d4fec54a4..911f911e5a92 100644 --- a/packages/remix/src/performance/client.tsx +++ b/packages/remix/src/performance/client.tsx @@ -2,8 +2,6 @@ import { Transaction, TransactionContext } from '@sentry/types'; import { getGlobalObject, logger } from '@sentry/utils'; import * as React from 'react'; -import { IS_DEBUG_BUILD } from '../flags'; - const DEFAULT_TAGS = { 'routing.instrumentation': 'remix-router', } as const; @@ -85,7 +83,7 @@ export function remixRouterInstrumentation(useEffect: UseEffect, useLocation: Us export function withSentryRouteTracing

, R extends React.FC

>(OrigApp: R): R { // Early return when any of the required functions is not available. if (!_useEffect || !_useLocation || !_useMatches || !_customStartTransaction) { - IS_DEBUG_BUILD && logger.warn('Remix SDK was unable to wrap your root because of one or more missing parameters.'); + __DEBUG_BUILD__ && logger.warn('Remix SDK was unable to wrap your root because of one or more missing parameters.'); // @ts-ignore Setting more specific React Component typing for `R` generic above // will break advanced type inference done by react router params From dddc25712d61214fec3dfe9bde2e78acfb6cf5bd Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Wed, 15 Jun 2022 18:26:52 -0700 Subject: [PATCH 5/6] remove obsolete flag from `yarn test` --- packages/remix/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/remix/package.json b/packages/remix/package.json index fca18914a0a0..43d9ca5f9918 100644 --- a/packages/remix/package.json +++ b/packages/remix/package.json @@ -61,7 +61,7 @@ "lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish", "lint:prettier": "prettier --check \"{src,test,scripts}/**/*.ts\"", "test": "run-s test:unit", - "test:unit": "jest --passWithNoTests", + "test:unit": "jest", "test:watch": "jest --watch" }, "volta": { From 5e0316c70061ecd8a295c743aab77ffc19c5ce09 Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Wed, 15 Jun 2022 18:33:45 -0700 Subject: [PATCH 6/6] add tsconfig to test folder --- packages/remix/test/tsconfig.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 packages/remix/test/tsconfig.json diff --git a/packages/remix/test/tsconfig.json b/packages/remix/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/packages/remix/test/tsconfig.json @@ -0,0 +1,8 @@ +// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as +// it's purely a placeholder to satisfy VSCode. + +{ + "extends": "../tsconfig.test.json", + + "include": ["./**/*"] +}