Socket
Socket
Sign inDemoInstall

@sentry/bundler-plugin-core

Package Overview
Dependencies
Maintainers
12
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/bundler-plugin-core - npm Package Compare versions

Comparing version 0.0.1-alpha.0 to 0.1.0

dist/types/options-mapping.d.ts

13

dist/types/sentry/logger.d.ts
import { Hub } from "@sentry/node";
interface LoggerOptions {
silent?: boolean;
silent: boolean;
debug: boolean;
hub: Hub;
prefix: string;
}
export declare function createLogger(options: LoggerOptions): {
info(message: string): void;
warn(message: string): void;
error(message: string): void;
export declare type Logger = {
info(message: string, ...params: unknown[]): void;
warn(message: string, ...params: unknown[]): void;
error(message: string, ...params: unknown[]): void;
debug(message: string, ...params: unknown[]): void;
};
export declare function createLogger(options: LoggerOptions): Logger;
export {};

@@ -1,7 +0,8 @@

import { Options, BuildContext } from "../types";
export declare function createNewRelease(release: string, options: Options, ctx: BuildContext): Promise<string>;
export declare function uploadSourceMaps(release: string, options: Options, ctx: BuildContext): Promise<string>;
export declare function finalizeRelease(release: string, options: Options, ctx: BuildContext): Promise<string>;
export declare function cleanArtifacts(release: string, options: Options, ctx: BuildContext): Promise<string>;
export declare function setCommits(ctx: BuildContext): Promise<string>;
export declare function addDeploy(ctx: BuildContext): Promise<string>;
import { InternalOptions } from "../options-mapping";
import { BuildContext } from "../types";
export declare function createNewRelease(options: InternalOptions, ctx: BuildContext): Promise<void>;
export declare function cleanArtifacts(options: InternalOptions, ctx: BuildContext): Promise<void>;
export declare function uploadSourceMaps(options: InternalOptions, ctx: BuildContext): Promise<void>;
export declare function setCommits(options: InternalOptions, ctx: BuildContext): Promise<void>;
export declare function finalizeRelease(options: InternalOptions, ctx: BuildContext): Promise<void>;
export declare function addDeploy(options: InternalOptions, ctx: BuildContext): Promise<void>;

@@ -1,6 +0,6 @@

import { Hub, NodeClient } from "@sentry/node";
import { Span } from "@sentry/tracing";
import { AxiosError } from "axios";
import { Hub, NodeClient, Span } from "@sentry/node";
import { InternalOptions } from "../options-mapping";
import { BuildContext } from "../types";
export declare function makeSentryClient(dsn: string, telemetryEnabled: boolean, org?: string): {
import { SentryCLILike } from "./cli";
export declare function makeSentryClient(dsn: string, telemetryEnabled: boolean): {
client: NodeClient;

@@ -13,2 +13,11 @@ hub: Hub;

export declare function addSpanToTransaction(ctx: BuildContext, op?: string, description?: string): Span | undefined;
export declare function captureMinimalError(error: unknown | Error | AxiosError, hub: Hub): void;
export declare function captureMinimalError(error: unknown | Error, hub: Hub): void;
export declare function addPluginOptionTags(options: InternalOptions, hub: Hub): void;
/**
* Makes a call to SentryCLI to get the Sentry server URL the CLI uses.
*
* We need to check and decide to use telemetry based on the CLI's respone to this call
* because only at this time we checked a possibly existing .sentryclirc file. This file
* could point to another URL than the default URL.
*/
export declare function turnOffTelemetryForSelfHostedSentry(cli: SentryCLILike, hub: Hub): Promise<void>;

@@ -1,13 +0,56 @@

import { Hub } from "@sentry/hub";
import { Hub } from "@sentry/core";
import { Span } from "@sentry/tracing";
import { SentryCLILike } from "./sentry/cli";
import { createLogger } from "./sentry/logger";
export declare type Options = {
/**
* The main options object holding all plugin options available to users
*/
export declare type Options = Omit<IncludeEntry, "paths"> & {
/**
* The slug of the Sentry organization associated with the app.
*
* This value can also be specified via the `SENTRY_ORG` environment variable.
*/
org?: string;
/**
* The slug of the Sentry project associated with the app.
*
* This value can also be specified via the `SENTRY_PROJECT` environment variable.
*/
project?: string;
/**
* The authentication token to use for all communication with Sentry.
* Can be obtained from https://sentry.io/settings/account/api/auth-tokens/.
* Required scopes: project:releases (and org:read if setCommits option is used).
*
* This value can also be specified via the `SENTRY_AUTH_TOKEN` environment variable.
*/
authToken?: string;
/**
* The base URL of your Sentry instance. Use this if you are using a self-hosted
* or Sentry instance other than sentry.io.
*
* This value can also be set via the `SENTRY_URL` environment variable.
*
* Defaults to https://sentry.io/, which is the correct value for SaaS customers.
*/
url?: string;
/**
* Unique identifier for the release.
*
* This value can also be specified via the `SENTRY_RELEASE` environment variable.
*
* Defaults to the output of the sentry-cli releases propose-version command,
* which automatically detects values for Cordova, Heroku, AWS CodeBuild, CircleCI,
* Xcode, and Gradle, and otherwise uses the git `HEAD`'s commit SHA. (the latter
* requires access to git CLI and for the root directory to be a valid repository).
*/
release?: string;
/**
* Filter for bundle entry points that should contain the provided release. By default, the release will be injected
* into all entry points.
* Unique identifier for the distribution, used to further segment your release.
* Usually your build number.
*/
dist?: string;
/**
* Filter for bundle entry points that should contain the provided release.
*

@@ -18,10 +61,62 @@ * This option takes a string, a regular expression, or an array containing strings, regular expressions, or both.

* option require a full match with the absolute path of the bundle.
*
* By default, the release will be injected into all entry points.
*/
entries?: (string | RegExp)[] | RegExp | string | ((filePath: string) => boolean);
/**
* Determines if the Sentry release record should be automatically finalized
* (meaning a date_released timestamp is added) after artifact upload.
*
* Defaults to `true`.
*/
finalize?: boolean;
include: string;
ext?: string[];
customHeaders?: Record<string, string>;
/**
* One or more paths that Sentry CLI should scan recursively for sources.
* It will upload all .map files and match associated .js files. Other file
* types can be uploaded by using the `ext` option.
* Each path can be given as a string or an object with path-specific options
*
* This is a required field.
*/
include: string | IncludeEntry | Array<string | IncludeEntry>;
/**
* Version control system remote name.
*
* This value can also be specified via the `SENTRY_VSC_REMOTE` environment variable.
*
* Defaults to 'origin'.
*/
vcsRemote?: string;
/**
* A header added to every outgoing network request.
* The format should be `header-key: header-value`.
*
* This value can also be specified via the `CUSTOM_HEADER` environment variable.
*/
customHeader?: string;
/**
* Attempts a dry run (useful for dev environments), making release creation
* a no-op.
*
* Defaults to `false`, but may be automatically set to `true` in development environments
* by some framework integrations (Next.JS, possibly others).
*/
dryRun?: boolean;
/**
* Print useful debug information.
*
* Defaults to `false`.
*/
debug?: boolean;
/**
* Suppresses all logs.
*
* Defaults to `false`.
*/
silent?: boolean;
/**
* Remove all the artifacts in the release before the upload.
*
* Defaults to `false`.
*/
cleanArtifacts?: boolean;

@@ -31,3 +126,5 @@ /**

*
* By default, the plugin will simply throw an error, thereby stopping the bundling process. If an `errorHandler` callback is provided, compilation will continue, unless an error is thrown in the provided callback.
* By default, the plugin will simply throw an error, thereby stopping the bundling process.
* If an `errorHandler` callback is provided, compilation will continue, unless an error is
* thrown in the provided callback.
*

@@ -44,2 +141,10 @@ * To allow compilation to continue but still emit a warning, set this option to the following:

/**
* Associates the release with its commits in Sentry.
*/
setCommits?: SetCommitsOptions;
/**
* Adds deployment information to the release in Sentry.
*/
deploy?: DeployOptions;
/**
* If set to true, internal plugin errors and performance data will be sent to Sentry.

@@ -52,6 +157,174 @@ *

*
* Defaults to true
* Defaults to `true`.
*/
telemetry?: boolean;
/**
* Path to Sentry CLI config properties, as described in
* https://docs.sentry.io/product/cli/configuration/#configuration-file.
*
* By default, the config file is looked for upwards from the current path, and
* defaults from ~/.sentryclirc are always loaded
*/
configFile?: string;
/**
* If set to true, the plugin will inject an additional `SENTRY_RELEASES` variable that
* maps from `{org}@{project}` to the `release` value. This might be helpful for webpack
* module federation or micro frontend setups.
*
* Defaults to `false`.
*/
injectReleasesMap?: boolean;
};
export declare type IncludeEntry = {
/**
* One or more paths to scan for files to upload.
*/
paths: string[];
/**
* One or more paths to ignore during upload.
* Overrides entries in ignoreFile file.
*
* Defaults to `['node_modules']` if neither `ignoreFile` nor `ignore` is set.
*/
ignore?: string | string[];
/**
* Path to a file containing list of files/directories to ignore.
*
* Can point to `.gitignore` or anything with the same format.
*/
ignoreFile?: string;
/**
* Array of file extensions of files to be collected for the file upload.
*
* By default the following file extensions are processed: js, map, jsbundle and bundle.
*/
ext?: string[];
/**
* URL prefix to add to the beginning of all filenames.
* Defaults to '~/' but you might want to set this to the full URL.
*
* This is also useful if your files are stored in a sub folder. eg: url-prefix '~/static/js'.
*/
urlPrefix?: string;
/**
* URL suffix to add to the end of all filenames.
* Useful for appending query parameters.
*/
urlSuffix?: string;
/**
* When paired with the `rewrite` option, this will remove a prefix from filename references inside of
* sourcemaps. For instance you can use this to remove a path that is build machine specific.
* Note that this will NOT change the names of uploaded files.
*/
stripPrefix?: string[];
/**
* When paired with the `rewrite` option, this will add `~` to the `stripPrefix` array.
*
* Defaults to `false`.
*/
stripCommonPrefix?: boolean;
/**
* Determines whether sentry-cli should attempt to link minified files with their corresponding maps.
* By default, it will match files and maps based on name, and add a Sourcemap header to each minified file
* for which it finds a map. Can be disabled if all minified files contain sourceMappingURL.
*
* Defaults to true.
*/
sourceMapReference?: boolean;
/**
* Enables rewriting of matching source maps so that indexed maps are flattened and missing sources
* are inlined if possible.
*
* Defaults to true
*/
rewrite?: boolean;
/**
* When `true`, attempts source map validation before upload if rewriting is not enabled.
* It will spot a variety of issues with source maps and cancel the upload if any are found.
*
* Defaults to `false` as this can cause false positives.
*/
validate?: boolean;
};
declare type SetCommitsOptions = (AutoSetCommitsOptions | ManualSetCommitsOptions) & {
/**
* The commit before the beginning of this release (in other words,
* the last commit of the previous release).
*
* Defaults to the last commit of the previous release in Sentry.
*
* If there was no previous release, the last 10 commits will be used.
*/
previousCommit?: string;
/**
* If the flag is to `true` and the previous release commit was not found
* in the repository, the plugin creates a release with the default commits
* count instead of failing the command.
*
* Defaults to `false`.
*/
ignoreMissing?: boolean;
/**
* If this flag is set, the setCommits step will not fail and just exit
* silently if no new commits for a given release have been found.
*
* Defaults to `false`.
*/
ignoreEmpty?: boolean;
};
declare type AutoSetCommitsOptions = {
/**
* Automatically sets `commit` and `previousCommit`. Sets `commit` to `HEAD`
* and `previousCommit` as described in the option's documentation.
*
* If you set this to `true`, manually specified `commit` and `previousCommit`
* options will be overridden. It is best to not specify them at all if you
* set this option to `true`.
*/
auto: true;
repo?: undefined;
commit?: undefined;
};
declare type ManualSetCommitsOptions = {
auto?: false | undefined;
/**
* The full repo name as defined in Sentry.
*
* Required if the `auto` option is not set to `true`.
*/
repo: string;
/**
* The current (last) commit in the release.
*
* Required if the `auto` option is not set to `true`.
*/
commit: string;
};
declare type DeployOptions = {
/**
* Environment for this release. Values that make sense here would
* be `production` or `staging`.
*/
env: string;
/**
* Deployment start time in Unix timestamp (in seconds) or ISO 8601 format.
*/
started?: number | string;
/**
* Deployment finish time in Unix timestamp (in seconds) or ISO 8601 format.
*/
finished?: number | string;
/**
* Deployment duration (in seconds). Can be used instead of started and finished.
*/
time?: number;
/**
* Human readable name for the deployment.
*/
name?: string;
/**
* URL that points to the deployment.
*/
url?: string;
};
/**

@@ -65,2 +338,4 @@ * Holds data for internal purposes

logger: ReturnType<typeof createLogger>;
cli: SentryCLILike;
};
export {};
{
"name": "@sentry/bundler-plugin-core",
"version": "0.0.1-alpha.0",
"version": "0.1.0",
"description": "Sentry Bundler Plugin Core",
"repository": "git://github.com/getsentry/sentry-unplugin.git",
"homepage": "https://github.com/getsentry/sentry-unplugin",
"repository": "git://github.com/getsentry/sentry-javascript-bundler-plugins.git",
"homepage": "https://github.com/getsentry/sentry-javascript-bundler-plugins/tree/main/packages/bundler-plugin-core",
"author": "Sentry",

@@ -29,12 +29,16 @@ "license": "MIT",

"check:types:test": "tsc --project ./test/tsconfig.json --noEmit",
"clean": "run-s clean:build",
"clean:all": "run-p clean clean:deps",
"clean:build": "rimraf ./dist *.tgz",
"clean:deps": "rimraf node_modules",
"test": "jest",
"lint": "eslint ./src ./test"
"lint": "eslint ./src ./test",
"fix": "eslint ./src ./test --format stylish --fix"
},
"dependencies": {
"@sentry/node": "^7.11.1",
"@sentry/tracing": "^7.11.1",
"axios": "^0.27.2",
"form-data": "^4.0.0",
"@sentry/cli": "^1.74.6",
"@sentry/node": "^7.19.0",
"@sentry/tracing": "^7.19.0",
"magic-string": "0.26.2",
"unplugin": "0.9.4"
"unplugin": "0.10.1"
},

@@ -50,4 +54,4 @@ "devDependencies": {

"@rollup/plugin-replace": "^4.0.0",
"@sentry-internal/eslint-config": "0.0.1-alpha.0",
"@sentry-internal/sentry-bundler-plugin-tsconfig": "0.0.1-alpha.0",
"@sentry-internal/eslint-config": "0.1.0",
"@sentry-internal/sentry-bundler-plugin-tsconfig": "0.1.0",
"@swc/core": "^1.2.205",

@@ -59,7 +63,12 @@ "@swc/jest": "^0.2.21",

"jest": "^28.1.1",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"rollup": "2.75.7",
"typescript": "^4.7.4"
},
"volta": {
"extends": "../../package.json"
},
"engines": {
"node": ">= 10"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc