Skip to content

Commit 934d438

Browse files
committed
chore(astro): Add @sentry/astro package
1 parent 945d873 commit 934d438

15 files changed

+2455
-16
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@
3434
"yalc:publish": "lerna run yalc:publish"
3535
},
3636
"volta": {
37-
"node": "16.19.0",
37+
"node": "18.17.0",
3838
"yarn": "1.22.19"
3939
},
4040
"workspaces": [
4141
"packages/angular",
4242
"packages/angular-ivy",
43+
"packages/astro",
4344
"packages/browser",
4445
"packages/browser-integration-tests",
4546
"packages/bun",

packages/astro/.eslintrc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
node: true,
5+
},
6+
extends: ['../../.eslintrc.js'],
7+
overrides: [
8+
{
9+
files: ['vite.config.ts'],
10+
parserOptions: {
11+
project: ['tsconfig.test.json'],
12+
},
13+
},
14+
],
15+
};

packages/astro/LICENSE

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

packages/astro/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
# Official Sentry SDK for Astro
8+
9+
[![npm version](https://img.shields.io/npm/v/@sentry/astro.svg)](https://www.npmjs.com/package/@sentry/astro)
10+
[![npm dm](https://img.shields.io/npm/dm/@sentry/astro.svg)](https://www.npmjs.com/package/@sentry/astro)
11+
[![npm dt](https://img.shields.io/npm/dt/@sentry/astro.svg)](https://www.npmjs.com/package/@sentry/astro)
12+
13+
<!--
14+
TODO: Add links once we have official docs
15+
## Links
16+
17+
- [Official SDK Docs](https://docs.sentry.io/platforms/javascript/guides/astro/)
18+
-->
19+
20+
## Experimental Note
21+
22+
This SDK is experimental and in Alpha state. Breaking changes can occurr at any time.
23+
If you have feedback or encounter any bugs, feel free to [open an issue](https://github.com/getsentry/sentry-javascript/issues/new/choose).
24+
25+
## General
26+
27+
This package is a wrapper around `@sentry/node` for the server and `@sentry/browser` for the client side.
28+
29+
## Installation and Setup
30+
31+
TODO

packages/astro/package.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "@sentry/astro",
3+
"version": "7.73.0",
4+
"description": "Official Sentry SDK for Astro",
5+
"repository": "git://github.com/getsentry/sentry-javascript.git",
6+
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/astro",
7+
"author": "Sentry",
8+
"license": "MIT",
9+
"engines": {
10+
"node": ">=18.14.1"
11+
},
12+
"main": "build/cjs/index.server.js",
13+
"module": "build/esm/index.server.js",
14+
"browser": "build/esm/index.client.js",
15+
"types": "build/types/index.types.d.ts",
16+
"private": true,
17+
"publishConfig": {
18+
"access": "restricted"
19+
},
20+
"peerDependencies": {
21+
"astro": "1.x"
22+
},
23+
"devDependencies": {
24+
"astro": "^3.2.3",
25+
"rollup": "^3.20.2",
26+
"vite": "4.0.5"
27+
},
28+
"scripts": {
29+
"build": "run-p build:transpile build:types",
30+
"build:dev": "yarn build",
31+
"build:transpile": "rollup -c rollup.npm.config.js --bundleConfigAsCjs",
32+
"build:types": "tsc -p tsconfig.types.json",
33+
"build:watch": "run-p build:transpile:watch build:types:watch",
34+
"build:dev:watch": "yarn build:watch",
35+
"build:transpile:watch": "rollup -c rollup.npm.config.js --bundleConfigAsCjs --watch",
36+
"build:types:watch": "tsc -p tsconfig.types.json --watch",
37+
"build:tarball": "ts-node ../../scripts/prepack.ts && npm pack ./build",
38+
"circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts",
39+
"clean": "rimraf build coverage sentry-astro-*.tgz",
40+
"fix": "run-s fix:eslint fix:prettier",
41+
"fix:eslint": "eslint . --format stylish --fix",
42+
"fix:prettier": "prettier --write \"{src,test,scripts}/**/**.ts\"",
43+
"lint": "run-s lint:prettier lint:eslint",
44+
"lint:eslint": "eslint . --format stylish",
45+
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
46+
"test": "yarn test:unit",
47+
"test:unit": "vitest run",
48+
"test:watch": "vitest --watch",
49+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
50+
},
51+
"volta": {
52+
"extends": "../../package.json"
53+
}
54+
}

packages/astro/rollup.npm.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index.js';
2+
3+
export default makeNPMConfigVariants(
4+
makeBaseNPMConfig({
5+
entrypoints: ['src/index.server.ts', 'src/index.client.ts'],
6+
packageSpecificConfig: {
7+
output: {
8+
dynamicImportInCjs: true,
9+
},
10+
},
11+
}),
12+
);

packages/astro/src/index.client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const client = true;

packages/astro/src/index.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const server = true;

packages/astro/src/index.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type Placeholder = true;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
describe('placeholder', () => {
2+
it('holds a place', () => {
3+
expect(true).toBe(true);
4+
});
5+
});

packages/astro/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
4+
"include": ["src/**/*"],
5+
6+
"compilerOptions": {
7+
// package-specific options
8+
}
9+
}

packages/astro/tsconfig.test.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
4+
"include": ["test/**/*", "vite.config.ts"],
5+
6+
"compilerOptions": {
7+
// should include all types from `./tsconfig.json` plus types for all test frameworks used
8+
"types": ["node", "vitest/globals"]
9+
}
10+
}

packages/astro/tsconfig.types.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
4+
"compilerOptions": {
5+
"declaration": true,
6+
"declarationMap": true,
7+
"emitDeclarationOnly": true,
8+
"outDir": "build/types"
9+
}
10+
}

packages/astro/vite.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { UserConfig } from 'vitest';
2+
3+
import baseConfig from '../../vite/vite.config';
4+
5+
export default {
6+
...baseConfig,
7+
test: {
8+
// test exists, no idea why TS doesn't recognize it
9+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
10+
...(baseConfig as UserConfig & { test: any }).test,
11+
environment: 'jsdom',
12+
},
13+
};

0 commit comments

Comments
 (0)