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

gulp-defeatureify

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-defeatureify

Remove specially flagged feature blocks and debug statements from Javascript using defeatureify [Experimental]

  • 0.1.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

gulp-defeatureify Build Status NPM version

Remove specially flagged feature blocks and debug statements from JavaScript as part of your Gulp build process

Information

Packagegulp-defeatureify
Node Version>= 0.9.0
Gulp Version3.x

defeatureify is used in the ember-dev package to enable or remove features and strip debug statements during the Ember.js build process.

This simple plugin exposes defeatureify as a Gulp plugin so you can use this same process in your own project. (Your project does not need to be an Ember.js application in order to use this plugin.)

Usage

Install

npm install gulp-defeatureify --save-dev

API

defeatureify(options)

options.enableStripDebug

Type: Boolean Default: false

Enables stripping the debug statements specified in options.debugStatements.

options.debugStatements

Type: Array Default: []

An array of strings containing debug statements to remove. Does not use options.namespace.

Example:

debugStatements: ['App.debugMessage']
options.emberDebugStatements

Type: Boolean Default: false

Adds the following default Ember debug statements to options.debugStatements:

debugStatements: [
  'Ember.warn',
  'Ember.assert',
  'Ember.deprecate',
  'Ember.debug',
  'Ember.Logger.info'
]
options.features

Type: Object Default: {}

An object containing feature names to enable or disable. Features with a value true will be enabled, otherwise they will be removed from the source.

Example:

features: {
  'some-cool-feature': true,
  'ember-metal-run-bind': true,
  'with-controller': true,
  'query-params-new': false,
  'string-humanize': false
}
options.namespace

Type: String Default: 'Ember'

The namespace to look for the features in.

Usage Examples

Gulpfile
var defeatureify = require('gulp-defeatureify');

var statements = ["Ember.warn", "Ember.assert", "Ember.deprecate", "Ember.debug", "Ember.Logger.info"];

gulp.task('scripts', function() {
  gulp.src(['./app/*.js')
    .pipe(defeatureify({
      debugStatements: statements,
      enableStripDebug: true
    }))
    .pipe(gulp.dest('./dist/'))
});
Stripping Debug Statements

In this example, various Ember debug statements are configured to be stripped from the source file:

App.IndexRoute = Ember.Route.extend({
  model: function() {
    Ember.warn('This is a debug statement that will be removed by defeatureify');
    return ['red', 'yellow', 'blue'];
  }
});

The generated result will be:

App.IndexRoute = Ember.Route.extend({
  model: function() {
    return ['red', 'yellow', 'blue'];
  }
});

See also

License

The MIT License (MIT)

Copyright (c) 2014 Jason Sandmeyer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

FAQs

Package last updated on 16 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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