Skip to content

Commit

Permalink
more dep cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhiPrasad committed Jun 26, 2024
1 parent 749a829 commit a21bf7d
Show file tree
Hide file tree
Showing 8 changed files with 444 additions and 4,110 deletions.
3 changes: 2 additions & 1 deletion dev-packages/bundle-analyzer-scenarios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

This repository contains a set of scenarios to check the SDK against webpack bundle analyzer.

You can run the scenarios by running `yarn analyze` and selecting the scenario you want to run.
You can run the scenarios by running `yarn analyze --scenario SCENARIO_NAME`. To view all avaliable scenarios, run
`yarn analyze --list`.

If you want to have more granular analysis of modules, you can build the SDK packages with with `preserveModules` set to
`true`. You can do this via the `SENTRY_BUILD_PRESERVE_MODULES`.
Expand Down
7 changes: 3 additions & 4 deletions dev-packages/bundle-analyzer-scenarios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
"license": "MIT",
"private": true,
"dependencies": {
"html-webpack-plugin": "^5.5.0",
"inquirer": "^8.2.0",
"webpack": "^5.76.0",
"webpack-bundle-analyzer": "^4.5.0"
"html-webpack-plugin": "^5.6.0",
"webpack": "^5.92.1",
"webpack-bundle-analyzer": "^4.10.2"
},
"scripts": {
"analyze": "node webpack.cjs"
Expand Down
35 changes: 20 additions & 15 deletions dev-packages/bundle-analyzer-scenarios/webpack.cjs
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
const path = require('path');
const { promises } = require('fs');
const path = require('node:path');
const { promises } = require('node:fs');
const { parseArgs } = require('node:util');

const inquirer = require('inquirer');
const webpack = require('webpack');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const HtmlWebpackPlugin = require('html-webpack-plugin');

async function init() {
const scenarios = await getScenariosFromDirectories();

const answers = await inquirer.prompt([
{
type: 'rawlist',
name: 'scenario',
message: 'Which scenario you want to run?',
choices: scenarios,
pageSize: scenarios.length,
loop: false,
},
]);
const { values } = parseArgs({
args: process.argv.slice(2),
options: { scenario: { type: 'string', short: 's' }, list: { type: 'boolean', short: 'l' } },
});

if (values.list) {
console.log('Available scenarios:', scenarios);
process.exit(0);
}

if (!scenarios.some(scenario => scenario === values.scenario)) {
console.error('Invalid scenario:', values.scenario);
console.error('Available scenarios:', scenarios);
process.exit(1);
}

console.log(`Bundling scenario: ${answers.scenario}`);
console.log(`Bundling scenario: ${values.scenario}`);

await runWebpack(answers.scenario);
await runWebpack(values.scenario);
}

async function runWebpack(scenario) {
Expand Down
19 changes: 0 additions & 19 deletions dev-packages/rollup-utils/plugins/npmPlugins.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
* Sucrase plugin docs: https://github.com/rollup/plugins/tree/master/packages/sucrase
*/

import * as fs from 'fs';
import * as path from 'path';

import { codecovRollupPlugin } from '@codecov/rollup-plugin';
import json from '@rollup/plugin-json';
import replace from '@rollup/plugin-replace';
import cleanup from 'rollup-plugin-cleanup';
Expand Down Expand Up @@ -160,19 +156,4 @@ export function makeRrwebBuildPlugin({ excludeShadowDom, excludeIframe } = {}) {
});
}

/**
* Plugin that uploads bundle analysis to codecov.
*
* @param type The type of bundle being uploaded.
* @param prefix The prefix for the codecov bundle name. Defaults to 'npm'.
*/
export function makeCodeCovPlugin() {
const packageJson = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' }));
return codecovRollupPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: packageJson.name,
uploadToken: process.env.CODECOV_TOKEN,
});
}

export { makeExtractPolyfillsPlugin } from './extractPolyfillsPlugin.mjs';
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,15 @@
"vitest": "^1.6.0",
"yalc": "^1.0.0-pre.53"
},
"//_resolutions_comment": [
"Because new versions of strip-ansi, string-width, and wrap-ansi are ESM only packages,",
"we need to resolve them to the CommonJS versions.",
"This is a temporary solution until we can upgrade to a version of lerna that supports ESM packages"
],
"resolutions": {
"gauge/strip-ansi": "6.0.1"
"gauge/strip-ansi": "6.0.1",
"wide-align/string-width": "4.2.3",
"cliui/wrap-ansi": "7.0.0"
},
"version": "0.0.0",
"name": "sentry-javascript",
Expand Down
4 changes: 2 additions & 2 deletions packages/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
"@sentry/types": "8.12.0",
"@sentry/utils": "8.12.0",
"@sentry/vite-plugin": "2.20.1",
"magic-string": "0.30.7",
"magic-string": "0.30.10",
"magicast": "0.2.8",
"sorcery": "0.11.0"
},
"devDependencies": {
"@babel/types": "7.20.7",
"@babel/types": "7.24.7",
"@sveltejs/kit": "^2.0.2",
"svelte": "^4.2.8",
"vite": "^5.0.10"
Expand Down
1 change: 0 additions & 1 deletion packages/sveltekit/src/vite/autoInstrument.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as fs from 'fs';
import * as path from 'path';
/* eslint-disable @sentry-internal/sdk/no-optional-chaining */
import type { ExportNamedDeclaration } from '@babel/types';
import { parseModule } from 'magicast';
import type { Plugin } from 'vite';
Expand Down
Loading

0 comments on commit a21bf7d

Please sign in to comment.