Socket
Socket
Sign inDemoInstall

@flareapp/flare-webpack-plugin-sourcemap

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flareapp/flare-webpack-plugin-sourcemap - npm Package Compare versions

Comparing version 0.0.11 to 1.0.0

dist/mix.js

23

dist/index.js

@@ -27,5 +27,2 @@ (function (factory) {

var _this = this;
if (!this.verifyOptions(compiler)) {
return;
}
new webpack_1.DefinePlugin({

@@ -36,2 +33,5 @@ FLARE_JS_KEY: JSON.stringify(this.key),

var plugin = function (compilation) {
if (!_this.verifyOptions(compiler, compilation)) {
return Promise.reject();
}
util_1.flareLog('Uploading sourcemaps to Flare');

@@ -43,7 +43,3 @@ return _this.sendSourcemaps(compilation)

.catch(function (error) {
var errorMessage = 'Something went wrong while uploading sourcemaps to Flare. ' +
'Additional information may have been outputted above.';
compilation.errors.push("@flareapp/flare-webpack-plugin-sourcemap: " + error);
compilation.errors.push("@flareapp/flare-webpack-plugin-sourcemap: " + errorMessage);
util_1.flareLog(errorMessage);
compilation.warnings.push("@flareapp/flare-webpack-plugin-sourcemap: " + error);
});

@@ -59,5 +55,5 @@ };

};
FlareWebpackPluginSourcemap.prototype.verifyOptions = function (compiler) {
FlareWebpackPluginSourcemap.prototype.verifyOptions = function (compiler, compilation) {
if (!this.key) {
util_1.flareLog('No Flare project key was provided, not uploading sourcemaps to Flare.', true);
compilation.warnings.push('No Flare project key was provided, not uploading sourcemaps to Flare.', true);
return false;

@@ -69,2 +65,6 @@ }

}
if (compiler.options.watch) {
util_1.flareLog('Running webpack in watch mode, not uploading sourcemaps to Flare.');
return false;
}
return true;

@@ -77,4 +77,3 @@ };

if (!sourcemaps.length) {
util_1.flareLog("No sourcemap files were found. Make sure sourcemaps are being generated by adding this line to your webpack config: `devtool: 'hidden-source-map'`!", true);
return reject();
return reject('No sourcemap files were found. Make sure sourcemaps are being generated by adding this line to your webpack config: devtool: "hidden-source-map"');
}

@@ -81,0 +80,0 @@ Promise.all(sourcemaps.map(function (sourcemap) { return _this.uploadSourcemap(sourcemap); }))

{
"name": "@flareapp/flare-webpack-plugin-sourcemap",
"version": "0.0.11",
"version": "1.0.0",
"main": "dist",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -12,3 +12,2 @@ import { Compiler, DefinePlugin, compilation } from 'webpack';

versionId: string;
collectGitInformation: boolean;
};

@@ -26,3 +25,2 @@

versionId: PluginOptions['versionId'];
collectGitInformation: PluginOptions['collectGitInformation'];

@@ -34,3 +32,2 @@ constructor({

versionId = uuidv4(),
collectGitInformation = false,
}: PluginOptions) {

@@ -41,10 +38,5 @@ this.key = key;

this.versionId = versionId;
this.collectGitInformation = collectGitInformation;
}
apply(compiler: Compiler) {
if (!this.verifyOptions(compiler)) {
return;
}
new DefinePlugin({

@@ -56,2 +48,6 @@ FLARE_JS_KEY: JSON.stringify(this.key),

const plugin = (compilation: compilation.Compilation) => {
if (!this.verifyOptions(compiler, compilation)) {
return Promise.reject();
}
flareLog('Uploading sourcemaps to Flare');

@@ -63,11 +59,4 @@

})
.catch(error => {
const errorMessage =
'Something went wrong while uploading sourcemaps to Flare. ' +
'Additional information may have been outputted above.';
compilation.errors.push(`@flareapp/flare-webpack-plugin-sourcemap: ${error}`);
compilation.errors.push(`@flareapp/flare-webpack-plugin-sourcemap: ${errorMessage}`);
flareLog(errorMessage);
.catch((error: string) => {
compilation.warnings.push(`@flareapp/flare-webpack-plugin-sourcemap: ${error}`);
});

@@ -86,5 +75,5 @@ };

verifyOptions(compiler: Compiler): boolean {
verifyOptions(compiler: Compiler, compilation: compilation.Compilation): boolean {
if (!this.key) {
flareLog('No Flare project key was provided, not uploading sourcemaps to Flare.', true);
compilation.warnings.push('No Flare project key was provided, not uploading sourcemaps to Flare.', true);
return false;

@@ -98,2 +87,7 @@ }

if (compiler.options.watch) {
flareLog('Running webpack in watch mode, not uploading sourcemaps to Flare.');
return false;
}
return true;

@@ -107,8 +101,5 @@ }

if (!sourcemaps.length) {
flareLog(
"No sourcemap files were found. Make sure sourcemaps are being generated by adding this line to your webpack config: `devtool: 'hidden-source-map'`!",
true
return reject(
'No sourcemap files were found. Make sure sourcemaps are being generated by adding this line to your webpack config: devtool: "hidden-source-map"'
);
return reject();
}

@@ -118,7 +109,3 @@

.then(() => resolve())
.catch(error => {
flareLog(error, true);
return reject(error);
});
.catch((error: Error) => reject(error.message));
});

@@ -125,0 +112,0 @@ }

@@ -1,29 +0,1 @@

import { execSync } from 'child_process';
type GitInfo = {
hash: string;
message: string;
tag: string;
remote: string;
isDirty: boolean;
};
function clCommand(command: string) {
try {
return execSync(command, { cwd: __dirname, encoding: 'utf8' }).replace('\n', '');
} catch (error) {
return '';
}
}
export function getGitInfo(path: string): GitInfo {
return <GitInfo>{
hash: clCommand(`git -C ${path} log --pretty=format:'%H' -n 1`),
message: clCommand(`git -C ${path} log --pretty=format:'%s' -n 1`),
tag: clCommand(`git -C ${path} describe --tags --abbrev=0`),
remote: clCommand(`git -C ${path} config --get remote.origin.url`),
isDirty: !!clCommand(`git -C ${path} status -s`),
};
}
export function flareLog(message: string, isError: boolean = false) {

@@ -30,0 +2,0 @@ const formattedMessage = '@flareapp/flare-webpack-plugin-sourcemap: ' + message;

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