-
Notifications
You must be signed in to change notification settings - Fork 50
feat: Add individual bundler packages #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7ff8b4b
8f6cd5d
82ac6d9
7d5edeb
29f896e
41ccb42
2657f78
6c16bef
7ec92a2
940cf19
c610bd6
c78183b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "presets": ["@babel/env", "@babel/typescript"] | ||
| } | ||
| 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, | ||
| }, | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| dist |
| 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. |
| 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Totally optional:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| 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" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import resolve from "@rollup/plugin-node-resolve"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Totally optional: |
||
| 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, | ||
| }, | ||
| ], | ||
| }; | ||
| 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"; |
| 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 | ||
| } | ||
| } |
| 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"); | ||
| }); |
| 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"] | ||
| } | ||
| } |
| 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" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "presets": ["@babel/env", "@babel/typescript"] | ||
| } |
| 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, | ||
| }, | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| dist | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
There was a problem hiding this comment.
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?