Skip to content

Commit 1ec4c49

Browse files
s1gr1dandreiborza
andauthored
feat(nitro-utils): Export Rollup Plugin wrapServerEntryWithDynamicImport (#14559)
Adding just the nitro-utils package without making changes in the Nuxt package. Derived from #14176 --------- Co-authored-by: Andrei Borza <[email protected]> Co-authored-by: Andrei <[email protected]>
1 parent 9c55aa0 commit 1ec4c49

17 files changed

+756
-0
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"packages/integration-shims",
6868
"packages/nestjs",
6969
"packages/nextjs",
70+
"packages/nitro-utils",
7071
"packages/node",
7172
"packages/nuxt",
7273
"packages/opentelemetry",

packages/nitro-utils/.eslintrc.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
extends: ['../../.eslintrc.js'],
3+
env: {
4+
node: true,
5+
},
6+
overrides: [
7+
{
8+
files: ['src/**'],
9+
rules: {
10+
'@sentry-internal/sdk/no-optional-chaining': 'off',
11+
},
12+
},
13+
{
14+
files: ['src/metrics/**'],
15+
rules: {
16+
'@typescript-eslint/explicit-function-return-type': 'off',
17+
'@typescript-eslint/no-non-null-assertion': 'off',
18+
},
19+
},
20+
],
21+
};

packages/nitro-utils/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020-2024 Functional Software, Inc. dba Sentry
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9+
of the Software, and to permit persons to whom the Software is furnished to do
10+
so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

packages/nitro-utils/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<p align="center">
2+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3+
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
4+
</a>
5+
</p>
6+
7+
# Sentry Utilities for Nitro-based SDKs
8+
9+
## Links
10+
11+
- [Official SDK Docs](https://docs.sentry.io/quickstart/)
12+
- [TypeDoc](http://getsentry.github.io/sentry-node/)
13+
14+
## General
15+
16+
Common utilities used by Sentry SDKs that use Nitro on the server-side.
17+
18+
Note: This package is only meant to be used internally, and as such is not part of our public API contract and does not
19+
follow semver.

packages/nitro-utils/package.json

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"name": "@sentry-internal/nitro-utils",
3+
"version": "8.42.0",
4+
"description": "Utilities for all Sentry SDKs with Nitro on the server-side",
5+
"repository": "git://github.com/getsentry/sentry-javascript.git",
6+
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/nitro-utils",
7+
"author": "Sentry",
8+
"license": "MIT",
9+
"engines": {
10+
"node": ">=16.20"
11+
},
12+
"files": [
13+
"/build"
14+
],
15+
"main": "build/cjs/index.js",
16+
"module": "build/esm/index.js",
17+
"types": "build/types/index.d.ts",
18+
"exports": {
19+
"./package.json": "./package.json",
20+
".": {
21+
"import": {
22+
"types": "./build/types/index.d.ts",
23+
"default": "./build/esm/index.js"
24+
},
25+
"require": {
26+
"types": "./build/types/index.d.ts",
27+
"default": "./build/cjs/index.js"
28+
}
29+
}
30+
},
31+
"typesVersions": {
32+
"<4.9": {
33+
"build/types/index.d.ts": [
34+
"build/types-ts3.8/index.d.ts"
35+
]
36+
}
37+
},
38+
"publishConfig": {
39+
"access": "public"
40+
},
41+
"dependencies": {
42+
"@sentry/core": "8.42.0"
43+
},
44+
"devDependencies": {
45+
"rollup": "^4.24.4"
46+
},
47+
"scripts": {
48+
"build": "run-p build:transpile build:types",
49+
"build:dev": "yarn build",
50+
"build:transpile": "rollup -c rollup.npm.config.mjs",
51+
"build:types": "run-s build:types:core build:types:downlevel",
52+
"build:types:core": "tsc -p tsconfig.types.json",
53+
"build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8",
54+
"build:watch": "run-p build:transpile:watch build:types:watch",
55+
"build:dev:watch": "run-p build:transpile:watch build:types:watch",
56+
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
57+
"build:types:watch": "tsc -p tsconfig.types.json --watch",
58+
"build:tarball": "npm pack",
59+
"clean": "rimraf build coverage sentry-internal-nitro-utils-*.tgz",
60+
"fix": "eslint . --format stylish --fix",
61+
"lint": "eslint . --format stylish",
62+
"test": "yarn test:unit",
63+
"test:unit": "vitest run",
64+
"test:watch": "vitest --watch",
65+
"yalc:publish": "yalc publish --push --sig"
66+
},
67+
"volta": {
68+
"extends": "../../package.json"
69+
},
70+
"sideEffects": false
71+
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils';
2+
3+
export default makeNPMConfigVariants(
4+
makeBaseNPMConfig({
5+
packageSpecificConfig: {
6+
output: {
7+
// set exports to 'named' or 'auto' so that rollup doesn't warn
8+
exports: 'named',
9+
// set preserveModules to true because we don't want to bundle everything into one file.
10+
preserveModules:
11+
process.env.SENTRY_BUILD_PRESERVE_MODULES === undefined
12+
? true
13+
: Boolean(process.env.SENTRY_BUILD_PRESERVE_MODULES),
14+
},
15+
},
16+
}),
17+
);

packages/nitro-utils/src/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export {
2+
wrapServerEntryWithDynamicImport,
3+
type WrapServerEntryPluginOptions,
4+
} from './rollupPlugins/wrapServerEntryWithDynamicImport';

0 commit comments

Comments
 (0)