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.2 to 0.1.3

2

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

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

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const esbuild_plugin_clean_1 = tslib_1.__importDefault(require("./lib/esbuild-plugin-clean"));
const esbuild_plugin_clean_1 = __importDefault(require("./lib/esbuild-plugin-clean"));
exports.default = esbuild_plugin_clean_1.default;
//# sourceMappingURL=index.js.map

@@ -1,67 +0,51 @@

'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";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const chalk_1 = __importDefault(require("chalk"));
const del_1 = __importDefault(require("del"));
exports.default = (options = {}) => {
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) => {
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);
});
};
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();
});
}
},
};
}
: () => {
del_1.default(patterns, Object.assign({ dryRun }, delOptions)).then((cleanFiles) => {
logCleanFiles(cleanFiles);
});
};
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
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