Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esbuild-plugin-clean

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-clean - npm Package Compare versions

Comparing version 0.1.1-1 to 0.1.2

2

package.json
{
"name": "esbuild-plugin-clean",
"version": "0.1.1-1",
"version": "0.1.2",
"description": "ESBuild plugin for cleaning up assets before building.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -5,2 +5,6 @@ # esbuild-plugin-clean

# esbuild-plugin-clean
ESBuild plugin for cleaning up output/assets before building.
## Usage

@@ -7,0 +11,0 @@

@@ -1,1 +0,2 @@

export * from './lib/esbuild-plugin-clean';
import clean from './lib/esbuild-plugin-clean';
export default clean;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./lib/esbuild-plugin-clean"), exports);
const esbuild_plugin_clean_1 = tslib_1.__importDefault(require("./lib/esbuild-plugin-clean"));
exports.default = esbuild_plugin_clean_1.default;
//# sourceMappingURL=index.js.map

@@ -1,48 +0,67 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const chalk_1 = tslib_1.__importDefault(require("chalk"));
const del_1 = tslib_1.__importDefault(require("del"));
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const tslib_1 = require('tslib');
const chalk_1 = tslib_1.__importDefault(require('chalk'));
const del_1 = tslib_1.__importDefault(require('del'));
exports.default = (options = {}) => {
var _a, _b, _c, _d, _e;
const patterns = (_a = options.patterns) !== null && _a !== void 0 ? _a : [];
const dryRun = (_b = options.dryRun) !== null && _b !== void 0 ? _b : false;
const delOptions = (_c = options.options) !== null && _c !== void 0 ? _c : {};
const sync = (_d = options.sync) !== null && _d !== void 0 ? _d : true;
const cleanOn = (_e = options.cleanOn) !== null && _e !== void 0 ? _e : 'start';
const logCleanFiles = (cleanFiles) => {
if (dryRun) {
console.log(chalk_1.default.blue('i'), `Clean plugin invoked in dryRun mode \n`);
}
console.log(chalk_1.default.blue('i'), `File Cleaned:\n${cleanFiles.join('\n')}`);
};
const handler = sync
? () => {
const cleanFiles = del_1.default.sync(patterns, Object.assign({ dryRun }, delOptions));
console.log('options: ', options);
var _a, _b, _c, _d, _e;
const patterns = (_a = options.patterns) !== null && _a !== void 0 ? _a : [];
const dryRun = (_b = options.dryRun) !== null && _b !== void 0 ? _b : false;
const delOptions = (_c = options.options) !== null && _c !== void 0 ? _c : {};
const sync = (_d = options.sync) !== null && _d !== void 0 ? _d : true;
const cleanOn =
(_e = options.cleanOn) !== null && _e !== void 0 ? _e : 'start';
const logCleanFiles = (cleanFiles) => {
if (dryRun) {
console.log(
chalk_1.default.blue('i'),
`Clean plugin invoked in dryRun mode`
);
}
if (cleanFiles.length) {
console.log(
chalk_1.default.blue('i'),
`File Cleaned:\n${cleanFiles.join('\n')}`
);
}
};
const handler = sync
? () => {
const cleanFiles = del_1.default.sync(
patterns,
Object.assign({ dryRun }, delOptions)
);
logCleanFiles(cleanFiles);
}
: () => {
del_1
.default(patterns, Object.assign({ dryRun }, delOptions))
.then((cleanFiles) => {
logCleanFiles(cleanFiles);
}
: () => {
del_1.default(patterns, Object.assign({ dryRun }, delOptions)).then((cleanFiles) => {
logCleanFiles(cleanFiles);
});
};
return {
name: 'esbuild:clean',
setup({ onStart: registerOnStartCallback, onEnd: registerOnEndCallback }) {
if (!patterns.length) {
return;
}
if (cleanOn === 'start' || cleanOn === 'both') {
registerOnStartCallback(() => {
handler();
});
}
if (cleanOn === 'end' || cleanOn === 'both') {
registerOnEndCallback(() => {
handler();
});
}
},
};
});
};
return {
name: 'esbuild:clean',
setup({
initialOptions,
onStart: registerOnStartCallback,
onEnd: registerOnEndCallback,
}) {
if (!patterns.length) {
return;
}
if (cleanOn === 'start' || cleanOn === 'both') {
registerOnStartCallback(() => {
handler();
});
}
if (cleanOn === 'end' || cleanOn === 'both') {
registerOnEndCallback(() => {
handler();
});
}
},
};
};
//# sourceMappingURL=esbuild-plugin-clean.js.map
//# sourceMappingURL=esbuild-plugin-clean.js.map

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