Skip to content

Commit

Permalink
feat(nitro-utils): Export Rollup Plugin `wrapServerEntryWithDynamicIm…
Browse files Browse the repository at this point in the history
…port` (#14559)

Adding just the nitro-utils package without making changes in the Nuxt
package.

Derived from #14176

---------

Co-authored-by: Andrei Borza <andrei.borza@sentry.io>
Co-authored-by: Andrei <168741329+andreiborza@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 4, 2024
1 parent 9c55aa0 commit 1ec4c49
Show file tree
Hide file tree
Showing 17 changed files with 756 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"packages/integration-shims",
"packages/nestjs",
"packages/nextjs",
"packages/nitro-utils",
"packages/node",
"packages/nuxt",
"packages/opentelemetry",
Expand Down
21 changes: 21 additions & 0 deletions packages/nitro-utils/.eslintrc.js
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',
},
},
],
};
21 changes: 21 additions & 0 deletions packages/nitro-utils/LICENSE
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.
19 changes: 19 additions & 0 deletions packages/nitro-utils/README.md
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.
71 changes: 71 additions & 0 deletions packages/nitro-utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"name": "@sentry-internal/nitro-utils",
"version": "8.42.0",
"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/core": "8.42.0"
},
"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
}
17 changes: 17 additions & 0 deletions packages/nitro-utils/rollup.npm.config.mjs
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({
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),
},
},
}),
);
4 changes: 4 additions & 0 deletions packages/nitro-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export {
wrapServerEntryWithDynamicImport,
type WrapServerEntryPluginOptions,
} from './rollupPlugins/wrapServerEntryWithDynamicImport';
Loading

0 comments on commit 1ec4c49

Please sign in to comment.