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

fenix-ui-bridge

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fenix-ui-bridge - npm Package Compare versions

Comparing version 1.0.0-beta.6 to 1.0.0-beta.7

dev/index.template.html

3

dist/fenix-ui-bridge.min.js

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

!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("jquery"),require("underscore"),require("q"),require("loglevel"),require("object-hash"),require("amplify-store"));else if("function"==typeof define&&define.amd)define(["jquery","underscore","q","loglevel","object-hash","amplify-store"],t);else{var r="object"==typeof exports?t(require("jquery"),require("underscore"),require("q"),require("loglevel"),require("object-hash"),require("amplify-store")):t(e.jquery,e.underscore,e.q,e.loglevel,e["object-hash"],e["amplify-store"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,function(e,t,r,n,i,o){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){var n,i;n=[r(2),r(3),r(4),r(5),r(6),r(7),r(8)],i=function(e,t,r,n,i,o,s){"use strict";function a(t){function r(e){return e.charAt(0).toUpperCase()+e.slice(1)}var n=t||{};this.cache_db={},this.environment=n.environment||"production",this.ENVIR=this.environment.toUpperCase(),this.USE_CACHE=n.cache,this.SERVICE_PROVIDER=e["serviceProvider"+r(this.ENVIR.toLowerCase())],this.SERVICE_PROVIDER||alert(this.environment+" is not a valid FENIX environment: [develop, production]")}return a.prototype.find=function(r){var i=t.extend(!0,{type:"find",environment:this.ENVIR},r),o=this._getCacheItem(i),s=this;if(this.USE_CACHE&&o)return n.promise(function(e){return e(o)});var a=r.SERVICE_PROVIDER||this.SERVICE_PROVIDER,c=r.findService||e.findService,u=r.body;return n(t.ajax({url:a+c+this._parseQueryParams(r.params),type:r.type||"POST",contentType:r.dataType||"application/json",data:JSON.stringify(u),dataType:r.dataType||"json"})).then(function(e){return s._setCacheItem(i,e),n.promise(function(e,t,r){return e(s._getCacheItem(i))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype.getEnumeration=function(r){var i=t.extend(!0,{type:"enumeration",environment:this.ENVIR},r),o=this._getCacheItem(i),s=this;if(this.USE_CACHE&&o)return n.promise(function(e){return e(o)});var a=r.serviceProvider||this.SERVICE_PROVIDER,c=r.enumerationService||e.enumerationService;return n(t.ajax({url:a+c+r.uid,type:r.type||"GET",dataType:r.dataType||"json"})).then(function(e){return s._setCacheItem(i,e),n.promise(function(e,t,r){return e(s._getCacheItem(i))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype.getCodeList=function(r){var i=t.extend(!0,{type:"codelist",environment:this.ENVIR},r),o=this._getCacheItem(i),s=this;if(this.USE_CACHE&&o)return n.promise(function(e){return e(o)});var a=r.serviceProvider||this.SERVICE_PROVIDER,c=r.codeListService||e.codelistService,u=r.body;return n(t.ajax({url:a+c+this._parseQueryParams(r.params),type:r.type||"POST",dataType:r.dataType||"json",contentType:r.contentType||"application/json",data:JSON.stringify(u)})).then(function(e){return s._setCacheItem(i,e),n.promise(function(e,t,r){return e(s._getCacheItem(i))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype.getResource=function(r){var i=t.extend(!0,{type:"resource",environment:this.ENVIR},r),o=this._getCacheItem(i),s=this;if(this.USE_CACHE&&o)return n.promise(function(e){return e(o)});var a=r.serviceProvider||this.SERVICE_PROVIDER,c=r.processesService||e.resourcesService,u=a+c+this._parseUidAndVersion(r,!0)+this._parseQueryParams(r.params);return n(t.ajax({url:u,type:r.type||"GET",contentType:r.contentType||"application/json",data:JSON.stringify(r.body)})).then(function(e){return s._setCacheItem(i,e),n.promise(function(e,t,r){return e(s._getCacheItem(i))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype.getProcessedResource=function(r){var i=t.extend(!0,{type:"process",environment:this.ENVIR},r),o=this._getCacheItem(i),s=this;if(this.USE_CACHE&&o)return n.promise(function(e){return e(o)});var a=r.serviceProvider||this.SERVICE_PROVIDER,c=r.processesService||e.processesService,u=r.hasOwnProperty("uid"),p=a+c+(u?this._parseUidAndVersion(r,!1):"")+this._parseQueryParams(r.params);return n(t.ajax({url:p,type:r.type||"POST",dataType:r.dataType||"json",contentType:r.contentType||"application/json",data:JSON.stringify(r.body)})).then(function(e){return s._setCacheItem(i,e),n.promise(function(e,t,r){return e(s._getCacheItem(i))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype.getMetadata=function(r){var i=t.extend(!0,{type:"metadata",environment:this.ENVIR},r),o=this._getCacheItem(i),s=this;if(this.USE_CACHE&&o)return n.promise(function(e){return e(o)});var a=r.serviceProvider||this.SERVICE_PROVIDER,c=r.metadataService||e.metadataService;return n(t.ajax({url:a+c+this._parseUidAndVersion(r,!0)+this._parseQueryParams(r.params),type:r.type||"GET",dataType:r.dataType||"json"})).then(function(e){return s._setCacheItem(i,e),n.promise(function(e,t,r){return e(s._getCacheItem(i))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype["export"]=function(r,i){var o=i&&i.serviceProvider||this.SERVICE_PROVIDER,s=o+e.exportService;return n(t.ajax({url:s,type:"POST",contentType:"application/json",data:JSON.stringify(r)})).then(function(e){var t={data:e,url:s};return n.promise(function(e,r,n){return e(t)})},function(e){return n.promise(function(t,r,n){return t(e)})})},a.prototype.getMDSD=function(r){var i=r||{},o=t.extend(!0,{type:"mdsd",environment:this.ENVIR},i),s=this._getCacheItem(o),a=this;if(this.USE_CACHE&&s)return n.promise(function(e){return e(s)});var c=i.serviceProvider||this.SERVICE_PROVIDER,u=i.mdsdService||e.mdsdService,p=c+u+this._parseQueryParams(i.params);return n(t.ajax({url:p,type:i.type||"GET",dataType:i.dataType||"json"})).then(function(e){return a._setCacheItem(o,e),n.promise(function(e,t,r){return e(a._getCacheItem(o))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype.all=function(e){return n.all(e)},a.prototype.getCacheKey=function(e){return this._getCacheKey(e)},a.prototype._parseQueryParams=function(e){if(!e)return"";var t="?";return r.each(e,function(e,r){t+=r+"="+e+"&"}),t.substring(0,t.length-1)},a.prototype._parseUidAndVersion=function(e,t){var r="",n=!1;return e.uid||i.warn("Impossible to find uid"),r=r.concat(e.uid),e.version&&(r=r.concat("/").concat(e.version),n=!0),t===!0&&n!==!0?"uid/"+r:r},a.prototype._setCacheItem=function(e,t){var r=this.getCacheKey(e);try{s.sessionStorage(r,t)}catch(n){this.cache_db[r]=t}return this._getCacheItem(r)},a.prototype._getCacheItem=function(e){var t=this.getCacheKey(e),r=s.sessionStorage(t);return r?r:this.cache_db[t]},a.prototype._getCacheKey=function(e){var t=o(e);return t},a}.apply(t,n),!(void 0!==i&&(e.exports=i))},function(e,t,r){var n;n=function(){"use strict";var e="//fenix.fao.org/",t="//fenixservices.fao.org/";return{serviceProviderProduction:t+"d3s/",serviceProviderDevelop:e+"d3s_dev/",exportService:"/fenix/export",findService:"msd/resources/find",codelistService:"msd/codes/filter",enumerationService:"msd/choices/",processesService:"processes/",metadataService:"msd/resources/metadata/",resourcesService:"msd/resources/",mdsdService:"mdsd/",cache:!0}}.call(t,r,t,e),!(void 0!==n&&(e.exports=n))},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t){e.exports=i},function(e,t){e.exports=o}])});
define(["jquery","underscore","q","loglevel","object-hash","amplify-store"],function(e,t,r,n,i,o){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){var n,i;n=[r(2),r(3),r(4),r(5),r(6),r(7),r(8)],i=function(e,t,r,n,i,o,s){"use strict";function a(t){function r(e){return e.charAt(0).toUpperCase()+e.slice(1)}var n=t||{};this.cache_db={},this.environment=n.environment||"production",this.ENVIR=this.environment.toUpperCase(),this.USE_CACHE=n.cache,this.SERVICE_PROVIDER=e["serviceProvider"+r(this.ENVIR.toLowerCase())],this.SERVICE_PROVIDER||alert(this.environment+" is not a valid FENIX environment: [develop, production]")}return a.prototype.find=function(i){var o=r.extend({type:"find",environment:this.ENVIR},i),s=this._getCacheItem(o),a=this;if(this.USE_CACHE&&s)return n.promise(function(e){return e(s)});var c=i.SERVICE_PROVIDER||this.SERVICE_PROVIDER,u=i.findService||e.findService,p=i.body;return n(t.ajax({url:c+u+this._parseQueryParams(i.params),type:i.type||"POST",contentType:i.dataType||"application/json",data:JSON.stringify(p),dataType:i.dataType||"json"})).then(function(e){return a._setCacheItem(o,e?e:null),n.promise(function(e,t,r){return e(a._getCacheItem(o))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype.getEnumeration=function(i){var o=r.extend({type:"enumeration",environment:this.ENVIR},i),s=this._getCacheItem(o),a=this;if(this.USE_CACHE&&s)return n.promise(function(e){return e(s)});var c=i.serviceProvider||this.SERVICE_PROVIDER,u=i.enumerationService||e.enumerationService;return n(t.ajax({url:c+u+i.uid,type:i.type||"GET",dataType:i.dataType||"json"})).then(function(e){return a._setCacheItem(o,e?e:null),n.promise(function(e,t,r){return e(a._getCacheItem(o))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype.getCodeList=function(i){var o=r.extend({type:"codelist",environment:this.ENVIR},i),s=this._getCacheItem(o),a=this;if(this.USE_CACHE&&s)return n.promise(function(e){return e(s)});var c=i.serviceProvider||this.SERVICE_PROVIDER,u=i.codeListService||e.codelistService,p=i.body;return n(t.ajax({url:c+u+this._parseQueryParams(i.params),type:i.type||"POST",dataType:i.dataType||"json",contentType:i.contentType||"application/json",data:JSON.stringify(p)})).then(function(e){return a._setCacheItem(o,e?e:null),n.promise(function(e,t,r){return e(a._getCacheItem(o))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype.getResource=function(i){var o=r.extend({type:"resource",environment:this.ENVIR},i),s=this._getCacheItem(o),a=this;if(this.USE_CACHE&&s)return n.promise(function(e){return e(s)});var c=i.serviceProvider||this.SERVICE_PROVIDER,u=i.processesService||e.resourcesService,p=c+u+this._parseUidAndVersion(i,!0)+this._parseQueryParams(i.params);return n(t.ajax({url:p,type:i.type||"GET",contentType:i.contentType||"application/json",data:JSON.stringify(i.body)})).then(function(e){return a._setCacheItem(o,e?e:null),n.promise(function(e,t,r){return e(a._getCacheItem(o))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype.getProcessedResource=function(i){var o=r.extend({type:"process",environment:this.ENVIR},i),s=this._getCacheItem(o),a=this;if(this.USE_CACHE&&s)return n.promise(function(e){return e(s)});var c=i.serviceProvider||this.SERVICE_PROVIDER,u=i.processesService||e.processesService,p=i.hasOwnProperty("uid"),h=c+u+(p?this._parseUidAndVersion(i,!1):"")+this._parseQueryParams(i.params);return n(t.ajax({url:h,type:i.type||"POST",dataType:i.dataType||"json",contentType:i.contentType||"application/json",data:JSON.stringify(i.body)})).then(function(e){return a._setCacheItem(o,e?e:null),n.promise(function(e,t,r){return e(a._getCacheItem(o))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype.getMetadata=function(i){var o=r.extend({type:"metadata",environment:this.ENVIR},i),s=this._getCacheItem(o),a=this;if(this.USE_CACHE&&s)return n.promise(function(e){return e(s)});var c=i.serviceProvider||this.SERVICE_PROVIDER,u=i.metadataService||e.metadataService;return n(t.ajax({url:c+u+this._parseUidAndVersion(i,!0)+this._parseQueryParams(i.params),type:i.type||"GET",dataType:i.dataType||"json"})).then(function(e){return a._setCacheItem(o,e?e:null),n.promise(function(e,t,r){return e(a._getCacheItem(o))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype["export"]=function(r,i){var o=i&&i.serviceProvider||this.SERVICE_PROVIDER,s=o+e.exportService;return n(t.ajax({url:s,type:"POST",contentType:"application/json",data:JSON.stringify(r)})).then(function(e){var t={data:e,url:s};return n.promise(function(e,r,n){return e(t)})},function(e){return n.promise(function(t,r,n){return t(e)})})},a.prototype.getMDSD=function(i){var o=i||{},s=r.extend({type:"mdsd",environment:this.ENVIR},o),a=this._getCacheItem(s),c=this;if(this.USE_CACHE&&a)return n.promise(function(e){return e(a)});var u=o.serviceProvider||this.SERVICE_PROVIDER,p=o.mdsdService||e.mdsdService,h=u+p+this._parseQueryParams(o.params);return n(t.ajax({url:h,type:o.type||"GET",dataType:o.dataType||"json"})).then(function(e){return c._setCacheItem(s,e?e:null),n.promise(function(e,t,r){return e(c._getCacheItem(s))})},function(e){return n.promise(function(t,r,n){return r(e)})})},a.prototype.all=function(e){return n.all(e)},a.prototype.getCacheKey=function(e){return this._getCacheKey(e)},a.prototype._parseQueryParams=function(e){if(!e)return"";var t="?";return r.each(e,function(e,r){t+=r+"="+e+"&"}),t.substring(0,t.length-1)},a.prototype._parseUidAndVersion=function(e,t){var r="",n=!1;return e.uid||i.warn("Impossible to find uid"),r=r.concat(e.uid),e.version&&(r=r.concat("/").concat(e.version),n=!0),t===!0&&n!==!0?"uid/"+r:r},a.prototype._setCacheItem=function(e,t){var r=this.getCacheKey(e);try{s.sessionStorage(r,t)}catch(n){this.cache_db[r]=t}return this._getCacheItem(r)},a.prototype._getCacheItem=function(e){var t=this.getCacheKey(e),r=s.sessionStorage(t);return r?r:this.cache_db[t]},a.prototype._getCacheKey=function(e){var t=o(e);return t},a}.apply(t,n),!(void 0!==i&&(e.exports=i))},function(e,t,r){var n;n=function(){"use strict";var e="//fenix.fao.org/",t="//fenixservices.fao.org/";return{serviceProviderProduction:t+"d3s/",serviceProviderDevelop:e+"d3s_dev/",exportService:"/fenix/export",findService:"msd/resources/find",codelistService:"msd/codes/filter",enumerationService:"msd/choices/",processesService:"processes/",metadataService:"msd/resources/metadata/",resourcesService:"msd/resources/",mdsdService:"mdsd/",cache:!0}}.call(t,r,t,e),!(void 0!==n&&(e.exports=n))},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t){e.exports=i},function(e,t){e.exports=o}])});
//# sourceMappingURL=fenix-ui-bridge.min.js.map
{
"name": "fenix-ui-bridge",
"version": "1.0.0-beta.6",
"version": "1.0.0-beta.7",
"description": "FENIX connector that implements the FENIX communication protocol v2.0",

@@ -11,3 +11,4 @@ "main": "dist/fenix-ui-bridge.min.js",

"scripts": {
"test": "mocha test/specs.js -w",
"test": "mocha test/specs.js -w -r mock-local-storage",
"dev": "NODE_ENV=develop webpack-dev-server --display-error-details --progress --color --content-base dev --inline --hot",
"build": "NODE_ENV=production webpack",

@@ -39,7 +40,14 @@ "build:develop": "NODE_ENV=develop webpack"

"devDependencies": {
"bootstrap": "^3.3.7",
"chai": "3.5.0",
"clean-webpack-plugin": "0.1.10",
"clean-webpack-plugin": "^0.1.10",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"html-webpack-plugin": "^2.24.1",
"jshint": "2.9.3",
"jshint-loader": "0.8.3",
"mocha": "3.0.2",
"mock-local-storage": "^1.0.2",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"webpack": "1.13.2",

@@ -46,0 +54,0 @@ "webpack-dev-server": "1.14.1"

@@ -35,3 +35,3 @@ if (typeof define !== 'function') {

var key = $.extend(true, {
var key = _.extend({
type: "find",

@@ -62,3 +62,3 @@ environment: this.ENVIR

self._setCacheItem(key, data);
self._setCacheItem(key, data ? data : null);

@@ -80,3 +80,3 @@ return Q.promise(function (resolve, reject, notify) {

var key = $.extend(true, {
var key = _.extend({
type: "enumeration",

@@ -103,3 +103,3 @@ environment: this.ENVIR

self._setCacheItem(key, data);
self._setCacheItem(key, data ? data : null);

@@ -121,3 +121,3 @@ return Q.promise(function (resolve, reject, notify) {

var key = $.extend(true, {
var key = _.extend({
type: "codelist",

@@ -147,3 +147,3 @@ environment: this.ENVIR

self._setCacheItem(key, data);
self._setCacheItem(key, data ? data : null);

@@ -166,3 +166,3 @@ return Q.promise(function (resolve, reject, notify) {

var key = $.extend(true, {
var key = _.extend({
type: "resource",

@@ -191,3 +191,3 @@ environment: this.ENVIR

self._setCacheItem(key, data);
self._setCacheItem(key, data ? data : null);

@@ -209,3 +209,3 @@ return Q.promise(function (resolve, reject, notify) {

var key = $.extend(true, {
var key = _.extend({
type: "process",

@@ -236,3 +236,3 @@ environment: this.ENVIR

self._setCacheItem(key, data);
self._setCacheItem(key, data ? data : null);

@@ -254,3 +254,3 @@ return Q.promise(function (resolve, reject, notify) {

var key = $.extend(true, {
var key = _.extend({
type: "metadata",

@@ -277,3 +277,3 @@ environment: this.ENVIR

self._setCacheItem(key, data);
self._setCacheItem(key, data ? data : null);

@@ -322,3 +322,3 @@ return Q.promise(function (resolve, reject, notify) {

var obj = opts || {},
key = $.extend(true, {
key = _.extend({
type: "mdsd",

@@ -346,3 +346,3 @@ environment: this.ENVIR

self._setCacheItem(key, data);
self._setCacheItem(key, data ? data : null);

@@ -349,0 +349,0 @@ return Q.promise(function (resolve, reject, notify) {

/*global describe, it, require*/
var expect = require("chai").expect;
var Bridge = require("../src/js/index");
var expect = require("chai").expect,
Bridge = require("../src/js/index");
describe("Bridge", function () {
afterEach(function () {
localStorage.clear();
});
var bridge = new Bridge({
cache : false,
environment : "develop"
cache: false,
environment: "develop"
});

@@ -15,2 +25,16 @@

});
it("find", function (done) {
bridge.find({
body: {
"meContent.resourceRepresentationType": {"enumeration": ["dataset"]},
"dsd.contextSystem": {"enumeration": ["cstat_ago"]}
},
params: {"full":true,"order":"meMaintenance.seUpdate.updateDate:desc"}
}).then(function(data) {
expect(data).to.be.not.null;
done()
});
});
});

@@ -1,94 +0,159 @@

NODE_ENV = process.env.NODE_ENV;
var distFolderPath = "dist",
demoFolderPath = "demo",
devFolderPath = "dev",
webpack = require('webpack'),
packageJson = require("./package.json"),
HtmlWebpackPlugin = require('html-webpack-plugin'),
CleanWebpackPlugin = require('clean-webpack-plugin'),
Path = require('path'),
production = NODE_ENV === "production",
plugins = [
new CleanWebpackPlugin([distFolderPath], {
//root: '/full/project/path',
//verbose: true,
//dry: false
}),
],
entry = {},
dependecies = Object.keys(packageJson.dependencies),
nodeModulesDir = Path.resolve(__dirname, '../node_modules');
dependencies = Object.keys(packageJson.dependencies);
// plugins included only in production environment
if (production) {
module.exports = {
plugins = plugins.concat([
//clean dist folder before build
// uglify
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
},
output: {
comments: false,
},
}),
]);
}
debug: isProduction(false, true),
entry["app"] = ["src/js/index.js"];
devtool: isProduction('source-map', 'eval'),
module.exports = {
debug: !production, //switch loader to debug mode
devtool: production ? false : 'eval', //source map generation
entry: entry,
output: {
path: Path.join(__dirname, distFolderPath),
filename: production ? packageJson.name + '.min.js' : packageJson.name + ".js", //add min
libraryTarget : 'umd'
},
entry: getEntry(),
output: getOutput(),
resolve: {
root: Path.resolve(__dirname),
alias: {
handlebars: 'handlebars/dist/handlebars.min.js'
jquery: Path.join(__dirname, 'node_modules/jquery/dist/jquery') //needed by eonasdan-bootstrap-datetimepicker
}
},
externals : dependecies,
externals: isProduction(dependencies, undefined),
module: {
//jshint
preLoaders: [
//jshint
{
test: /\.js$/, // include .js files
exclude: [nodeModulesDir], // exclude any and all files in the node_modules folder
loader: "jshint-loader"
}
],
loaders: [
{test: /\.css$/, loader: "style-loader!css-loader"},
{test: /\.hbs$/, loader: "handlebars-loader"},
{test: /\.png$/, loader: "url-loader?limit=100000"},
{test: /\.jpg$/, loader: "file-loader?name=[name].[ext]&limit=100000"},
{test: /\.svg/, loader: "file-loader?name=[name].[ext]&limit=100000"},
{test: /\.gif/, loader: "file-loader?name=[name].[ext]&limit=100000"},
//Bootstrap loader
{test: /bootstrap\/js\//, loader: 'imports?jQuery=jquery'},
{test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&minetype=application/font-woff"},
{test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&minetype=application/font-woff"},
{test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&minetype=application/octet-stream"},
{test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file"}
]
},
plugins: plugins.concat([
// define global scoped variable, force JSON.stringify()
new webpack.DefinePlugin({
__DEVELOPMENT__: !production,
VERSION: JSON.stringify(packageJson.version)
}),
]),
plugins: clearArray([
new webpack.ProvidePlugin({$: "jquery", jQuery: "jquery"}),
isProduction(new CleanWebpackPlugin([distFolderPath]), undefined),
isProduction(new webpack.optimize.UglifyJsPlugin({
compress: {warnings: false},
output: {comments: false}
})),
isDevelop(new HtmlWebpackPlugin({
inject: "body",
template: devFolderPath + "/index.template.html"
}))
])
};
// more options in the optional jshint object
jshint: {
// any jshint option http://www.jshint.com/docs/options/
// i. e.
camelcase: true,
function getEntry() {
// jshint errors are displayed by default as warnings
// set emitErrors to true to display them as errors
emitErrors: false,
var entry = {};
// jshint to not interrupt the compilation
// if you want any file with jshint errors to fail
// set failOnHint to true
failOnHint: false,
switch (getEnvironment()) {
// custom reporter function
reporter: function (errors) {
}
case "demo" :
entry["app"] = ["demo/src/js/demo.js"];
break;
case "develop" :
entry["app"] = ["dev/src/js/dev.js"];
break;
default :
entry["app"] = ["./src/js/index.js"];
}
};
return entry;
}
function getOutput() {
var output;
switch (getEnvironment()) {
case "demo" :
output = {
path: Path.join(__dirname, demoFolderPath),
filename: "index.js"
};
break;
case "production" :
output = {
path: Path.join(__dirname, distFolderPath),
filename: packageJson.name + '.min.js',
chunkFilename: 'chunk-[id].' + packageJson.name + '.min.js',
libraryTarget: 'amd'
};
break;
case "develop" :
output = {
path: Path.join(__dirname, devFolderPath),
//publicPath: "/dev/",
filename: "index.js"
};
break;
default :
output = {
path: Path.join(__dirname, distFolderPath),
filename: "index.js"
};
break;
}
return output;
}
// utils
function clearArray(array) {
var result = [];
array.forEach(function (s) {
s ? result.push(s) : null;
});
return result;
}
function isProduction(valid, invalid) {
return isEnvironment('production') ? valid : invalid;
}
function isDevelop(valid, invalid) {
return isEnvironment('develop') ? valid : invalid;
}
function isTest(valid, invalid) {
return isEnvironment('develop') ? valid : invalid;
}
function isDemo(valid, invalid) {
return isEnvironment('demo') ? valid : invalid;
}
function isEnvironment(env) {
return getEnvironment() === env;
}
function getEnvironment() {
return process.env.NODE_ENV;
}
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