Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "nx/presets/npm.json",
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"npmScope": "sentry",
"affected": {
"defaultBase": "main"
},
Expand All @@ -14,6 +13,9 @@
}
},
"targetDefaults": {
"build": {
"dependsOn": ["^build"]
},
"lint": {
"dependsOn": ["^build", "build"]
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@sentry/unplugin-root",
"name": "@sentry/sentry-unplugin-root",
"version": "0.0.0",
"description": "Root of the sentry unplugin monorepo.",
"repository": "git@github.com:lforst/sentry-unplugin.git",
Expand Down
3 changes: 3 additions & 0 deletions packages/esbuild-plugin/.babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/env", "@babel/typescript"]
}
Comment on lines +1 to +3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally optional:
I think the values here are the same for all projects, right? Can we extract this file into one package?

20 changes: 20 additions & 0 deletions packages/esbuild-plugin/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const jestPackageJson = require("jest/package.json");

/** @type {import('eslint').ESLint.Options} */
module.exports = {
root: true,
extends: ["@sentry-internal/eslint-config/jest", "@sentry-internal/eslint-config/base"],
ignorePatterns: [".eslintrc.js", "dist", "jest.config.js", "rollup.config.js"],
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./src/tsconfig.json", "./test/tsconfig.json"],
},
env: {
node: true,
},
settings: {
jest: {
version: jestPackageJson.version,
},
},
};
1 change: 1 addition & 0 deletions packages/esbuild-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
29 changes: 29 additions & 0 deletions packages/esbuild-plugin/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# MIT License

Copyright (c) 2022, Sentry
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

- Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6 changes: 6 additions & 0 deletions packages/esbuild-plugin/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
testEnvironment: "node",
transform: {
"^.+\\.(t|j)sx?$": ["@swc/jest"],
},
};
Comment on lines +1 to +6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally optional:
Any change, we can also extract this to a central package?
We might wanna add a "dev-utils" package (I know this sounds oddly familiar....)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we notice that having stuff duplicated becomes a problem we can extract this. I usually don't like drying things too early. Same goes for other comments.

61 changes: 61 additions & 0 deletions packages/esbuild-plugin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "@sentry/esbuild-plugin",
"version": "0.0.1",
"description": "Official Sentry esbuild plugin",
"repository": "git://github.com/getsentry/sentry-unplugin.git",
"homepage": "https://github.com/getsentry/sentry-unplugin/tree/main/packages/esbuild-plugin",
"author": "Sentry",
"license": "MIT",
"keywords": [
"Sentry",
"esbuild",
"bundler",
"plugin"
],
"publishConfig": {
"access": "public"
},
"files": [
"dist"
],
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"scripts": {
"build": "rimraf ./out && run-p build:rollup build:types",
"build:watch": "run-p build:rollup:watch build:types:watch",
"build:rollup": "rollup --config rollup.config.js",
"build:rollup:watch": "rollup --config rollup.config.js --watch --no-watch.clearScreen",
"build:types": "tsc --project types.tsconfig.json",
"build:types:watch": "tsc --project types.tsconfig.json --watch --preserveWatchOutput",
"check:types": "run-p check:types:src check:types:test",
"check:types:src": "tsc --project ./src/tsconfig.json --noEmit",
"check:types:test": "tsc --project ./test/tsconfig.json --noEmit",
"test": "jest",
"lint": "eslint ./src ./test"
},
"dependencies": {
"@sentry/sentry-unplugin": "0.0.1"
},
"devDependencies": {
"@babel/core": "7.18.5",
"@babel/preset-env": "7.18.2",
"@babel/preset-typescript": "7.17.12",
"@rollup/plugin-babel": "5.3.1",
"@rollup/plugin-commonjs": "22.0.1",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "13.3.0",
"@swc/core": "^1.2.205",
"@swc/jest": "^0.2.21",
"@types/jest": "^28.1.3",
"@types/node": "^18.6.3",
"@sentry-internal/eslint-config": "*",
"@sentry-internal/sentry-unplugin-tsconfig": "*",
"eslint": "^8.18.0",
"jest": "^28.1.1",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"rollup": "2.75.7",
"typescript": "^4.7.4"
}
}
35 changes: 35 additions & 0 deletions packages/esbuild-plugin/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import resolve from "@rollup/plugin-node-resolve";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally optional:
Might also be a candidate for a centralized config?

import babel from "@rollup/plugin-babel";
import packageJson from "./package.json";
import modulePackage from "module";

const input = ["src/index.ts"];

const extensions = [".ts"];

export default {
input,
external: [...Object.keys(packageJson.dependencies), ...modulePackage.builtinModules],
plugins: [
resolve({ extensions, preferBuiltins: true }),
babel({
extensions,
babelHelpers: "bundled",
include: ["src/**/*"],
}),
],
output: [
{
file: packageJson.module,
format: "esm",
exports: "named",
sourcemap: true,
},
{
file: packageJson.main,
format: "cjs",
exports: "named",
sourcemap: true,
},
],
};
2 changes: 2 additions & 0 deletions packages/esbuild-plugin/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { sentryEsbuildPlugin as default } from "@sentry/sentry-unplugin";
export type { Options } from "@sentry/sentry-unplugin";
8 changes: 8 additions & 0 deletions packages/esbuild-plugin/src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@sentry-internal/sentry-unplugin-tsconfig/base-config.json",
"include": ["./**/*", "../package.json"],
"compilerOptions": {
"esModuleInterop": true
}
}
6 changes: 6 additions & 0 deletions packages/esbuild-plugin/test/public-api.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sentryEsbuildPlugin from "../src";

test("Esbuild plugin should exist", () => {
expect(sentryEsbuildPlugin).toBeDefined();
expect(typeof sentryEsbuildPlugin).toBe("function");
});
8 changes: 8 additions & 0 deletions packages/esbuild-plugin/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../src/tsconfig.json",
"include": ["../src/**/*", "./**/*"],
"compilerOptions": {
"types": ["node", "jest"]
}
}
11 changes: 11 additions & 0 deletions packages/esbuild-plugin/types.tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./src/tsconfig.json",
"include": ["./src/**/*"],
"compilerOptions": {
"rootDir": "./src",
"declaration": true,
"emitDeclarationOnly": true,
"declarationDir": "./dist/types"
}
}
3 changes: 2 additions & 1 deletion packages/eslint-configs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "eslint-config-local",
"name": "@sentry-internal/eslint-config",
"version": "0.0.0",
"license": "MIT",
"private": true,
"peerDependencies": {
"eslint": "^8.14.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/integration-tests/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const jestPackageJson = require("jest/package.json");
/** @type {import('eslint').ESLint.Options} */
module.exports = {
root: true,
extends: ["local/jest", "local/base"],
extends: ["@sentry-internal/eslint-config/jest", "@sentry-internal/eslint-config/base"],
ignorePatterns: [".eslintrc.js", "fixtures/*/out", "jest.config.js"],
parserOptions: {
tsconfigRootDir: __dirname,
Expand Down
11 changes: 6 additions & 5 deletions packages/integration-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@sentry/integration-tests",
"version": "1.0.0",
"name": "@sentry-internal/integration-tests",
"version": "0.0.0",
"license": "MIT",
"private": true,
"scripts": {
"test": "run-s test:setup test:jest",
Expand All @@ -12,10 +13,10 @@
"dependencies": {
"@swc/jest": "^0.2.21",
"@types/jest": "^28.1.3",
"@sentry/unplugin": "*",
"@sentry/sentry-unplugin": "*",
"@types/webpack4": "npm:@types/webpack@4.41.32",
"eslint-config-local": "*",
"sentry-unplugin-tsconfigs": "*",
"@sentry-internal/eslint-config": "*",
"@sentry-internal/sentry-unplugin-tsconfig": "*",
"esbuild": "0.14.49",
"jest": "^28.1.3",
"npm-run-all": "4.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/integration-tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "sentry-unplugin-tsconfigs/base-config.json",
"extends": "@sentry-internal/sentry-unplugin-tsconfig/base-config.json",
"include": ["./**/*"],
"compilerOptions": {
"esModuleInterop": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/integration-tests/utils/create-cjs-bundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
sentryVitePlugin,
sentryWebpackPlugin,
Options,
} from "@sentry/unplugin";
} from "@sentry/sentry-unplugin";

export function createCjsBundles(
entrypoints: { [name: string]: string },
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/build-esbuild.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { sentryEsbuildPlugin } = require("@sentry/unplugin");
const { sentryEsbuildPlugin } = require("@sentry/sentry-unplugin");
const { build } = require("esbuild");
const placeHolderOptions = require("./config.json");

Expand Down
2 changes: 1 addition & 1 deletion packages/playground/build-webpack4.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
const path = require("path");
const webpack4 = require("webpack4");
const { sentryWebpackPlugin } = require("@sentry/unplugin");
const { sentryWebpackPlugin } = require("@sentry/sentry-unplugin");

const placeHolderOptions = require("./config.json");

Expand Down
2 changes: 1 addition & 1 deletion packages/playground/build-webpack5.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
const path = require("path");
const webpack5 = require("webpack");
const { sentryWebpackPlugin } = require("@sentry/unplugin");
const { sentryWebpackPlugin } = require("@sentry/sentry-unplugin");

const placeHolderOptions = require("./config.json");

Expand Down
8 changes: 3 additions & 5 deletions packages/playground/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"name": "@sentry/playground",
"version": "1.0.0",
"main": "index.js",
"author": "Luca Forstner",
"name": "@sentry-internal/unplugin-playground",
"version": "0.0.0",
"license": "MIT",
"private": true,
"scripts": {
Expand All @@ -18,7 +16,7 @@
"dependencies": {
"@sentry/integrations": "^7.11.1",
"@sentry/node": "^7.11.1",
"@sentry/unplugin": "*",
"@sentry/sentry-unplugin": "*",
"@types/express": "^4.17.13",
"@types/http-proxy": "^1.17.9",
"esbuild": "0.14.49",
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import { sentryRollupPlugin } from "@sentry/unplugin";
import { sentryRollupPlugin } from "@sentry/sentry-unplugin";
import placeHolderOptions from "./config.json";

const input = ["src/entrypoint1.js"];
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-check
import { sentryVitePlugin } from "@sentry/unplugin";
import { sentryVitePlugin } from "@sentry/sentry-unplugin";
import { defineConfig } from "vite";
import * as path from "path";
import placeHolderOptions from "./config.json";
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/vite.config.smallNodeApp.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-check
import { sentryVitePlugin } from "@sentry/unplugin";
import { sentryVitePlugin } from "@sentry/sentry-unplugin";
import { defineConfig } from "vite";
import * as path from "path";

Expand Down
3 changes: 3 additions & 0 deletions packages/rollup-plugin/.babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/env", "@babel/typescript"]
}
20 changes: 20 additions & 0 deletions packages/rollup-plugin/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const jestPackageJson = require("jest/package.json");

/** @type {import('eslint').ESLint.Options} */
module.exports = {
root: true,
extends: ["@sentry-internal/eslint-config/jest", "@sentry-internal/eslint-config/base"],
ignorePatterns: [".eslintrc.js", "dist", "jest.config.js", "rollup.config.js"],
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./src/tsconfig.json", "./test/tsconfig.json"],
},
env: {
node: true,
},
settings: {
jest: {
version: jestPackageJson.version,
},
},
};
1 change: 1 addition & 0 deletions packages/rollup-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional:
Hmmm WDYT about adding something like packages/*/dist into the root .gitignore instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More risky/opaque as to why something is "gitignored". I'll leave it for now.

Loading