-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(nitro-utils): Export Rollup Plugin wrapServerEntryWithDynamicImport
#14176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
8b1b2ec
3970390
a5d3193
413a5f6
300b091
dca73d3
eaf8845
ee036ed
31dfc08
cf78674
e4b9243
a0a480c
dcad00f
1205ade
d893bb4
8c1bbf9
199e5a6
7011146
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = { | ||
extends: ['../../.eslintrc.js'], | ||
env: { | ||
node: true, | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['src/**'], | ||
rules: { | ||
'@sentry-internal/sdk/no-optional-chaining': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['src/metrics/**'], | ||
rules: { | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
}, | ||
}, | ||
], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020-2024 Functional Software, Inc. dba Sentry | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<p align="center"> | ||
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank"> | ||
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84"> | ||
</a> | ||
</p> | ||
|
||
# Sentry Utilities for Nitro-based SDKs | ||
|
||
## Links | ||
|
||
- [Official SDK Docs](https://docs.sentry.io/quickstart/) | ||
- [TypeDoc](http://getsentry.github.io/sentry-node/) | ||
|
||
## General | ||
|
||
Common utilities used by Sentry SDKs that use Nitro on the server-side. | ||
|
||
Note: This package is only meant to be used internally, and as such is not part of our public API contract and does not | ||
follow semver. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"name": "@sentry-internal/nitro-utils", | ||
"version": "8.37.1", | ||
"description": "Utilities for all Sentry SDKs with Nitro on the server-side", | ||
"repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/nitro-utils", | ||
"author": "Sentry", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=16.20" | ||
}, | ||
"files": [ | ||
"/build" | ||
], | ||
"main": "build/cjs/index.js", | ||
"module": "build/esm/index.js", | ||
"types": "build/types/index.d.ts", | ||
"exports": { | ||
"./package.json": "./package.json", | ||
".": { | ||
"import": { | ||
"types": "./build/types/index.d.ts", | ||
"default": "./build/esm/index.js" | ||
}, | ||
"require": { | ||
"types": "./build/types/index.d.ts", | ||
"default": "./build/cjs/index.js" | ||
} | ||
} | ||
}, | ||
"typesVersions": { | ||
"<4.9": { | ||
"build/types/index.d.ts": [ | ||
"build/types-ts3.8/index.d.ts" | ||
] | ||
} | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@sentry/utils": "8.37.1" | ||
}, | ||
"devDependencies": { | ||
"rollup": "^4.24.4" | ||
}, | ||
"scripts": { | ||
"build": "run-p build:transpile build:types", | ||
"build:dev": "yarn build", | ||
"build:transpile": "rollup -c rollup.npm.config.mjs", | ||
"build:types": "run-s build:types:core build:types:downlevel", | ||
"build:types:core": "tsc -p tsconfig.types.json", | ||
"build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", | ||
"build:watch": "run-p build:transpile:watch build:types:watch", | ||
"build:dev:watch": "run-p build:transpile:watch build:types:watch", | ||
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", | ||
"build:types:watch": "tsc -p tsconfig.types.json --watch", | ||
"build:tarball": "npm pack", | ||
"clean": "rimraf build coverage sentry-internal-nitro-utils-*.tgz", | ||
"fix": "eslint . --format stylish --fix", | ||
"lint": "eslint . --format stylish", | ||
"test": "yarn test:unit", | ||
"test:unit": "vitest run", | ||
"test:watch": "vitest --watch", | ||
"yalc:publish": "yalc publish --push --sig" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
}, | ||
"sideEffects": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; | ||
|
||
export default makeNPMConfigVariants( | ||
makeBaseNPMConfig({ | ||
Comment on lines
+3
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. l: Maybe one more question: Do we need a CJS version of this or is ESM enough? If we don't need CJS, we can configure the build to only emit ESM. In this case, we should also adjust the exports in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ESM should be enough in Nitro 👍 |
||
packageSpecificConfig: { | ||
output: { | ||
// set exports to 'named' or 'auto' so that rollup doesn't warn | ||
exports: 'named', | ||
// set preserveModules to true because we don't want to bundle everything into one file. | ||
preserveModules: | ||
process.env.SENTRY_BUILD_PRESERVE_MODULES === undefined | ||
? true | ||
: Boolean(process.env.SENTRY_BUILD_PRESERVE_MODULES), | ||
}, | ||
}, | ||
}), | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { | ||
wrapServerEntryWithDynamicImport, | ||
type WrapServerEntryPluginOptions, | ||
} from './rollupPlugins/wrapServerEntryWithDynamicImport'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need
@sentry/core
here because of #14431There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yea, good catch!