Skip to content

Commit

Permalink
feat(remix): support remix v2 (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
justindsmith authored Sep 19, 2023
1 parent a8a8bb9 commit 65314bf
Show file tree
Hide file tree
Showing 6 changed files with 695 additions and 303 deletions.
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
"lerna": "^3.22.1",
"prettier": "2.3.2"
},
"workspaces": [
"packages/*"
]
"workspaces": {
"packages": [
"packages/*"
],
"nohoist": [
"**/mocha",
"**/ts-node"
]
}
}
2 changes: 1 addition & 1 deletion packages/instrumentation-remix/.tav.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'@remix-run/server-runtime':
versions: ">=1.1.0 < 2"
versions: ">=1.1.0"
commands:
- yarn test
2 changes: 1 addition & 1 deletion packages/instrumentation-remix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ npm install --save opentelemetry-instrumentation-remix
```

## Supported Versions
- `^1.1.0`
- `1.1.0 - 2.x`

### Cloudflare Worker Warning
This instrumentation does NOT support Cloudflare Workers. For more details follow [opentelemetry-js issue #1214](https://github.com/open-telemetry/opentelemetry-js/issues/1214).
Expand Down
13 changes: 7 additions & 6 deletions packages/instrumentation-remix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,20 @@
"devDependencies": {
"@opentelemetry/api": "1.1.0",
"@opentelemetry/core": "1.3.1",
"@remix-run/node": "1.19.1",
"@remix-run/router": "1.7.2",
"@remix-run/server-runtime": "1.19.1",
"@remix-run/node": "2.0.0",
"@remix-run/router": "1.9.0",
"@remix-run/server-runtime": "2.0.0",
"@types/lodash": "^4.14.168",
"@types/mocha": "^8.2.2",
"@types/node": "^20.6.2",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.11",
"@types/semver": "^7.3.9",
"@types/sinon": "^9.0.11",
"expect": "^26.6.2",
"history": "5.3.0",
"lodash": "^4.17.21",
"mocha": "^8.4.0",
"mocha": "^10.2.0",
"opentelemetry-instrumentation-mocha": "0.0.7-alpha.1",
"opentelemetry-instrumentation-testing-utils": "^0.27.0",
"react": "^18.2.0",
Expand All @@ -65,8 +66,8 @@
"semver": "^7.3.5",
"sinon": "^9.2.4",
"test-all-versions": "^5.0.1",
"ts-node": "^10.4.0",
"typescript": "4.5.4"
"ts-node": "^10.9.1",
"typescript": "5.1.6"
},
"mocha": {
"extension": [
Expand Down
7 changes: 4 additions & 3 deletions packages/instrumentation-remix/src/instrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ export class RemixInstrumentation extends InstrumentationBase {
protected init() {
const remixRunServerRuntimeModule = new InstrumentationNodeModuleDefinition<typeof remixRunServerRuntime>(
"@remix-run/server-runtime",
["1.*"],
[">=1.*"],
(moduleExports: typeof remixRunServerRuntime) => {
console.log("createRequestHandler:", moduleExports.createRequestHandler);
// createRequestHandler
if (isWrapped(moduleExports["createRequestHandler"])) {
this._unwrap(moduleExports, "createRequestHandler");
Expand All @@ -81,7 +82,7 @@ export class RemixInstrumentation extends InstrumentationBase {
typeof remixRunServerRuntimeRouteMatching
>(
"@remix-run/server-runtime/dist/routeMatching",
["1.6.2 - 1.x"],
["1.6.2 - 2.x"],
(moduleExports: typeof remixRunServerRuntimeRouteMatching) => {
// createRequestHandler
if (isWrapped(moduleExports["matchServerRoutes"])) {
Expand Down Expand Up @@ -225,7 +226,7 @@ export class RemixInstrumentation extends InstrumentationBase {
*/
const remixRunServerRuntimeDataModule = new InstrumentationNodeModuleDefinition<typeof remixRunServerRuntimeData>(
"@remix-run/server-runtime/dist/data",
["1.8.0 - 1.x"],
["1.8.0 - 2.x"],
(moduleExports: typeof remixRunServerRuntimeData) => {
// callRouteLoader
if (isWrapped(moduleExports["callRouteLoaderRR"])) {
Expand Down
Loading

0 comments on commit 65314bf

Please sign in to comment.