Skip to content

Commit

Permalink
Merge branch 'develop' into cl/annotations-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
c298lee authored Feb 21, 2025
2 parents 7c52b22 + 08569e6 commit 766e036
Show file tree
Hide file tree
Showing 46 changed files with 702 additions and 441 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -713,10 +713,6 @@ jobs:
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Build `libpq`
run: yarn libpq:build
working-directory: dev-packages/node-integration-tests

- name: Overwrite typescript version
if: matrix.typescript == '3.8'
run: node ./scripts/use-ts-3_8.js
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
test-results
node_modules

# Output
.output
.vercel
.netlify
.wrangler
/.svelte-kit
/build

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@sentry:registry=http://127.0.0.1:4873
@sentry-internal:registry=http://127.0.0.1:4873
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# sv

Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```bash
# create a new project in the current directory
npx sv create

# create a new project in my-app
npx sv create my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

To create a production version of your app:

```bash
npm run build
```

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "sveltekit-cloudflare-pages",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "wrangler pages dev ./.svelte-kit/cloudflare --port 4173",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test:e2e": "playwright test",
"test": "pnpm run test:e2e",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm run test:e2e"
},
"dependencies": {
"@sentry/sveltekit": "latest || *"
},
"devDependencies": {
"@playwright/test": "^1.45.3",
"@sveltejs/adapter-cloudflare": "^5.0.3",
"@sveltejs/kit": "^2.17.2",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"svelte": "^5.20.2",
"svelte-check": "^4.1.4",
"typescript": "^5.0.0",
"vite": "^6.1.1",
"wrangler": "3.105.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from '@playwright/test';

export default defineConfig({
webServer: {
command: 'pnpm run build && pnpm run preview',
port: 4173,
},

testDir: 'tests',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}

export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { env } from '$env/dynamic/public';
import * as Sentry from '@sentry/sveltekit';

Sentry.init({
dsn: env.PUBLIC_E2E_TEST_DSN,
});

export const handleError = Sentry.handleErrorWithSentry();
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { E2E_TEST_DSN } from '$env/static/private';
import { handleErrorWithSentry, initCloudflareSentryHandle, sentryHandle } from '@sentry/sveltekit';
import { sequence } from '@sveltejs/kit/hooks';

export const handleError = handleErrorWithSentry();

export const handle = sequence(
initCloudflareSentryHandle({
dsn: E2E_TEST_DSN,
tracesSampleRate: 1.0,
}),
sentryHandle(),
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { PageServerLoad } from './$types';

export const load: PageServerLoad = async function load() {
return {
message: 'From server load function.',
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script lang="ts">
let { data } = $props();
</script>

<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>

<a href="/prerender-test">prerender test</a>

<p>{data.message}</p>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import adapter from '@sveltejs/adapter-cloudflare';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://svelte.dev/docs/kit/integrations
// for more information about preprocessors
preprocess: vitePreprocess(),

kit: {
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
adapter: adapter(),
prerender: {
handleHttpError: 'ignore',
},
},
};

export default config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { expect, test } from '@playwright/test';

test('home page has expected h1', async ({ page }) => {
await page.goto('/');
await expect(page.locator('h1')).toBeVisible();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { sentrySvelteKit } from '@sentry/sveltekit';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [sentrySvelteKit({ autoUploadSourceMaps: false }), sveltekit()],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
compatibility_date = "2024-12-17"
compatibility_flags = ["nodejs_compat"]
4 changes: 1 addition & 3 deletions dev-packages/node-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"build:types": "tsc -p tsconfig.types.json",
"clean": "rimraf -g **/node_modules && run-p clean:script",
"clean:script": "node scripts/clean.js",
"libpq:build": "npm rebuild libpq",
"express-v5-install": "cd suites/express-v5 && yarn --no-lockfile",
"lint": "eslint . --format stylish",
"fix": "eslint . --format stylish --fix",
Expand Down Expand Up @@ -63,8 +62,7 @@
"nock": "^13.5.5",
"node-cron": "^3.0.3",
"node-schedule": "^2.1.1",
"pg": "^8.13.1",
"pg-native": "3.2.0",
"pg": "^8.7.3",
"proxy": "^2.1.1",
"redis-4": "npm:redis@^4.6.14",
"reflect-metadata": "0.2.1",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,54 +53,4 @@ describe('postgres auto instrumentation', () => {
.expect({ transaction: EXPECTED_TRANSACTION })
.start(done);
});

test('should auto-instrument `pg-native` package', done => {
const EXPECTED_TRANSACTION = {
transaction: 'Test Transaction',
spans: expect.arrayContaining([
expect.objectContaining({
data: expect.objectContaining({
'db.system': 'postgresql',
'db.name': 'tests',
'sentry.origin': 'manual',
'sentry.op': 'db',
}),
description: 'pg.connect',
op: 'db',
status: 'ok',
}),
expect.objectContaining({
data: expect.objectContaining({
'db.system': 'postgresql',
'db.name': 'tests',
'db.statement': 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)',
'sentry.origin': 'auto.db.otel.postgres',
'sentry.op': 'db',
}),
description: 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)',
op: 'db',
status: 'ok',
origin: 'auto.db.otel.postgres',
}),
expect.objectContaining({
data: expect.objectContaining({
'db.system': 'postgresql',
'db.name': 'tests',
'db.statement': 'SELECT * FROM "NativeUser"',
'sentry.origin': 'auto.db.otel.postgres',
'sentry.op': 'db',
}),
description: 'SELECT * FROM "NativeUser"',
op: 'db',
status: 'ok',
origin: 'auto.db.otel.postgres',
}),
]),
};

createRunner(__dirname, 'scenario-native.js')
.withDockerCompose({ workingDirectory: [__dirname], readyMatches: ['port 5432'] })
.expect({ transaction: EXPECTED_TRANSACTION })
.start(done);
});
});
5 changes: 5 additions & 0 deletions packages/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
"./package.json": "./package.json",
".": {
"types": "./build/types/index.types.d.ts",
"worker": {
"import": "./build/esm/index.worker.js",
"require": "./build/cjs/index.worker.js"
},
"browser": {
"import": "./build/esm/index.client.js",
"require": "./build/cjs/index.client.js"
Expand All @@ -38,6 +42,7 @@
}
},
"dependencies": {
"@sentry/cloudflare": "9.1.0",
"@sentry/core": "9.1.0",
"@sentry/node": "9.1.0",
"@sentry/opentelemetry": "9.1.0",
Expand Down
Loading

0 comments on commit 766e036

Please sign in to comment.