New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sentry/sveltekit

Package Overview
Dependencies
Maintainers
12
Versions
216
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/sveltekit - npm Package Compare versions

Comparing version 7.53.0 to 7.53.1

51

cjs/vite/autoInstrument.js

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

var {
_optionalChain
} = require('@sentry/utils/cjs/buildPolyfills');
const fs = require('fs');
const magicast = require('magicast');
const path = require('path');
/* eslint-disable @sentry-internal/sdk/no-optional-chaining */
const WRAPPED_MODULE_SUFFIX = '?sentry-auto-wrap';

@@ -69,20 +72,46 @@

const code = (await fs.promises.readFile(id, 'utf8')).toString();
const mod = magicast.parseModule(code);
const codeWithoutComments = code.replace(/(\/\/.*| ?\/\*[^]*?\*\/)(,?)$/gm, '');
const hasSentryContent = codeWithoutComments.includes('@sentry/sveltekit');
if (hasSentryContent) {
const program = mod.$ast.type === 'Program' && mod.$ast;
if (!program) {
// eslint-disable-next-line no-console
debug && console.log(`Skipping wrapping ${id} because it already contains Sentry code`);
debug && console.log(`Skipping wrapping ${id} because it doesn't contain valid JavaScript or TypeScript`);
return false;
}
const hasLoadDeclaration = /((const|let|var|function)\s+load\s*(=|\(|:))|as\s+load\s*(,|})/gm.test(
codeWithoutComments,
);
const hasLoadDeclaration = program.body
.filter((statement) => statement.type === 'ExportNamedDeclaration')
.find(exportDecl => {
// find `export const load = ...`
if (exportDecl.declaration && exportDecl.declaration.type === 'VariableDeclaration') {
const variableDeclarations = exportDecl.declaration.declarations;
return variableDeclarations.find(decl => decl.id.type === 'Identifier' && decl.id.name === 'load');
}
// find `export function load = ...`
if (exportDecl.declaration && exportDecl.declaration.type === 'FunctionDeclaration') {
const functionId = exportDecl.declaration.id;
return _optionalChain([functionId, 'optionalAccess', _ => _.name]) === 'load';
}
// find `export { load, somethingElse as load, somethingElse as "load" }`
if (exportDecl.specifiers) {
return exportDecl.specifiers.find(specifier => {
return (
(specifier.exported.type === 'Identifier' && specifier.exported.name === 'load') ||
(specifier.exported.type === 'StringLiteral' && specifier.exported.value === 'load')
);
});
}
return false;
});
if (!hasLoadDeclaration) {
// eslint-disable-next-line no-console
debug && console.log(`Skipping wrapping ${id} because it doesn't declare a \`load\` function`);
return false;
}
return !hasSentryContent && hasLoadDeclaration;
return true;
}

@@ -89,0 +118,0 @@

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

import { _optionalChain } from '@sentry/utils/esm/buildPolyfills';
import * as fs from 'fs';
import { parseModule } from 'magicast';
import * as path from 'path';
/* eslint-disable @sentry-internal/sdk/no-optional-chaining */
const WRAPPED_MODULE_SUFFIX = '?sentry-auto-wrap';

@@ -69,20 +69,46 @@

const code = (await fs.promises.readFile(id, 'utf8')).toString();
const mod = parseModule(code);
const codeWithoutComments = code.replace(/(\/\/.*| ?\/\*[^]*?\*\/)(,?)$/gm, '');
const hasSentryContent = codeWithoutComments.includes('@sentry/sveltekit');
if (hasSentryContent) {
const program = mod.$ast.type === 'Program' && mod.$ast;
if (!program) {
// eslint-disable-next-line no-console
debug && console.log(`Skipping wrapping ${id} because it already contains Sentry code`);
debug && console.log(`Skipping wrapping ${id} because it doesn't contain valid JavaScript or TypeScript`);
return false;
}
const hasLoadDeclaration = /((const|let|var|function)\s+load\s*(=|\(|:))|as\s+load\s*(,|})/gm.test(
codeWithoutComments,
);
const hasLoadDeclaration = program.body
.filter((statement) => statement.type === 'ExportNamedDeclaration')
.find(exportDecl => {
// find `export const load = ...`
if (exportDecl.declaration && exportDecl.declaration.type === 'VariableDeclaration') {
const variableDeclarations = exportDecl.declaration.declarations;
return variableDeclarations.find(decl => decl.id.type === 'Identifier' && decl.id.name === 'load');
}
// find `export function load = ...`
if (exportDecl.declaration && exportDecl.declaration.type === 'FunctionDeclaration') {
const functionId = exportDecl.declaration.id;
return _optionalChain([functionId, 'optionalAccess', _ => _.name]) === 'load';
}
// find `export { load, somethingElse as load, somethingElse as "load" }`
if (exportDecl.specifiers) {
return exportDecl.specifiers.find(specifier => {
return (
(specifier.exported.type === 'Identifier' && specifier.exported.name === 'load') ||
(specifier.exported.type === 'StringLiteral' && specifier.exported.value === 'load')
);
});
}
return false;
});
if (!hasLoadDeclaration) {
// eslint-disable-next-line no-console
debug && console.log(`Skipping wrapping ${id} because it doesn't declare a \`load\` function`);
return false;
}
return !hasSentryContent && hasLoadDeclaration;
return true;
}

@@ -89,0 +115,0 @@

{
"name": "@sentry/sveltekit",
"version": "7.53.0",
"version": "7.53.1",
"description": "Official Sentry SDK for SvelteKit",

@@ -23,10 +23,11 @@ "repository": "git://github.com/getsentry/sentry-javascript.git",

"dependencies": {
"@sentry-internal/tracing": "7.53.0",
"@sentry/core": "7.53.0",
"@sentry/integrations": "7.53.0",
"@sentry/node": "7.53.0",
"@sentry/svelte": "7.53.0",
"@sentry/types": "7.53.0",
"@sentry/utils": "7.53.0",
"@sentry-internal/tracing": "7.53.1",
"@sentry/core": "7.53.1",
"@sentry/integrations": "7.53.1",
"@sentry/node": "7.53.1",
"@sentry/svelte": "7.53.1",
"@sentry/types": "7.53.1",
"@sentry/utils": "7.53.1",
"@sentry/vite-plugin": "^0.6.0",
"magicast": "0.2.6",
"sorcery": "0.11.0"

@@ -33,0 +34,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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