micro-storage
Advanced tools
Comparing version 0.0.8 to 0.0.9
/*! | ||
* @ProjectName micro-storage | ||
* @Version 0.0.8 | ||
* @Version 0.0.9 | ||
* @Author lixinliang(https://github.com/lixinliang) | ||
* @Update 2016-09-25 1:12:27 pm | ||
* @Update 2016-09-29 8:37:57 pm | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microStorage=t():e.microStorage=t()}(this,function(){return function(e){function t(r){if(o[r])return o[r].exports;var n=o[r]={exports:{},id:r,loaded:!1};return e[r].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t){"use strict";function o(e){function t(t,o){if(0!=arguments.length){if(1==arguments.length){var n=JSON.parse(localStorage.getItem(e+"."+t));return n?n.$:n}return localStorage.setItem(e+"."+t,JSON.stringify({$:o})),r[e][t]="",localStorage.setItem("micro-storage",JSON.stringify(r)),o}}return r[e]=r[e]||{},localStorage.setItem("micro-storage",JSON.stringify(r)),t.remove=function(t){localStorage.removeItem(e+"."+t),delete r[e][t],localStorage.setItem("micro-storage",JSON.stringify(r))},t.list=function(){return Object.keys(r[e])},t.clear=function(){var e=this;this.list().forEach(function(t){e.remove(t)})},t}o.version="0.0.8";var r=JSON.parse(localStorage.getItem("micro-storage"))||{};e.exports=o}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microStorage=t():e.microStorage=t()}(this,function(){return function(e){function t(r){if(o[r])return o[r].exports;var n=o[r]={exports:{},id:r,loaded:!1};return e[r].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t){"use strict";function o(e){function t(t,o){if(0!=arguments.length){if(1==arguments.length){var i=JSON.parse(localStorage.getItem(e+"."+t));return i?i.$:i}return localStorage.setItem(e+"."+t,JSON.stringify({$:o})),n[e][t]="",localStorage.setItem(r,JSON.stringify(n)),o}}return n[e]=n[e]||{},localStorage.setItem(r,JSON.stringify(n)),t.remove=function(t){localStorage.removeItem(e+"."+t),delete n[e][t],localStorage.setItem(r,JSON.stringify(n))},t.list=function(){return Object.keys(n[e])},t.clear=function(){var e=this;this.list().forEach(function(t){e.remove(t)})},t}o.version="0.0.9";var r="micro-storage",n=JSON.parse(localStorage.getItem(r))||{};e.exports=o}])}); |
{ | ||
"name": "micro-storage", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "(<1kb) A lite localStorage plugin with namespace.", | ||
"main": "dist/micro-storage.min.js", | ||
"scripts": { | ||
"dev": "node ./webpack/node.dev.js", | ||
"build": "node ./webpack/node.build.js" | ||
"dev": "node ./webpack/webpack.node.js -dev", | ||
"build": "node ./webpack/webpack.node.js -build" | ||
}, | ||
@@ -44,3 +44,3 @@ "repository": { | ||
"inline-source": "^5.0.0", | ||
"jquery": "^3.0.0", | ||
"inquirer": "^1.1.3", | ||
"minifycss-loader": "^0.2.0", | ||
@@ -54,3 +54,2 @@ "moment": "~2.8.3", | ||
"url-loader": "^0.5.7", | ||
"vue": "^1.0.24", | ||
"vue-hot-reload-api": "^1.3.2", | ||
@@ -60,3 +59,2 @@ "vue-html-loader": "^1.2.2", | ||
"vue-style-loader": "^1.0.0", | ||
"vue-touch": "^1.1.0", | ||
"webpack": "^1.13.1", | ||
@@ -63,0 +61,0 @@ "webpack-dev-server": "^1.14.1" |
@@ -0,8 +1,15 @@ | ||
/** | ||
* @webpack | ||
* @library microStorage | ||
* @libraryTarget umd | ||
*/ | ||
microStorage.version = '@VERSION'; | ||
let list = JSON.parse(localStorage.getItem('@NAME')) || {}; | ||
let packageName = '@NAME'; | ||
let list = JSON.parse(localStorage.getItem(packageName)) || {}; | ||
/** | ||
* A lite localStorage plugin with namespace | ||
* @param {String} namespace namespace | ||
* @param {String} namespace namespace | ||
* @return {Function} function | ||
@@ -13,8 +20,8 @@ */ | ||
list[namespace] = list[namespace] || {}; | ||
localStorage.setItem('@NAME', JSON.stringify(list)); | ||
localStorage.setItem(packageName, JSON.stringify(list)); | ||
/** | ||
* Get or set value from storage | ||
* @param {String} name key | ||
* @param {AnyType} value value | ||
* @param {String} name key | ||
* @param {AnyType} value value | ||
* @return {AnyType} value | ||
@@ -32,3 +39,3 @@ */ | ||
list[namespace][name] = ''; | ||
localStorage.setItem('@NAME', JSON.stringify(list)); | ||
localStorage.setItem(packageName, JSON.stringify(list)); | ||
return value; | ||
@@ -39,3 +46,3 @@ }; | ||
* Remove value from storage | ||
* @param {String} name key | ||
* @param {String} name key | ||
*/ | ||
@@ -45,3 +52,3 @@ storage.remove = function ( name ) { | ||
delete list[namespace][name]; | ||
localStorage.setItem('@NAME', JSON.stringify(list)); | ||
localStorage.setItem(packageName, JSON.stringify(list)); | ||
}; | ||
@@ -48,0 +55,0 @@ |
@@ -6,6 +6,9 @@ 'use strict'; | ||
let webpack = require('webpack'); | ||
let PackageInfo = require('./package-info.js'); | ||
let packageJson = require('../package.json'); | ||
let extractTextPlugin = require('extract-text-webpack-plugin'); | ||
let Profile = require('./webpack.profile.js'); | ||
let ExtractText = require('extract-text-webpack-plugin'); | ||
const alias = {}; | ||
const entry = require('./webpack.entry.json'); | ||
const packageJson = require('../package.json'); | ||
const banner = | ||
@@ -17,16 +20,14 @@ `@ProjectName ${ packageJson.name } | ||
let entry = {}; | ||
let alias = {}; | ||
const imageSize = 10240; | ||
entry[packageJson.name] = require('./entry.js')[packageJson.name]; | ||
module.exports = { | ||
entry : entry, | ||
entry, | ||
output : { | ||
path : './dist/', | ||
filename : '[name].min.js', | ||
library : packageJson.name.replace(/-./g, ( match ) => match[1].toUpperCase()), | ||
libraryTarget : 'umd', | ||
path : './dist/js/', | ||
filename : '[name].js', | ||
}, | ||
extensions: ['.vue', '.js', '.json', '.scss', '.html'], | ||
extensions : ['.vue', '.js', '.json', '.scss', '.html'], | ||
resolve : { | ||
alias, | ||
}, | ||
module : { | ||
@@ -44,11 +45,11 @@ loaders : [ | ||
test : /\.(png|jpg|gif|svg)$/, | ||
loader : 'url?limit=10240&name=../img/[name].[ext]?[hash]', | ||
loader : `url?limit=${ imageSize }&name=../img/[name].[ext]?[hash]`, | ||
}, | ||
{ | ||
test : /\.css$/, | ||
loader : extractTextPlugin.extract('style', 'css'), | ||
loader : ExtractText.extract('style', 'css'), | ||
}, | ||
{ | ||
test : /\.scss$/, | ||
loader : extractTextPlugin.extract('style', 'css?localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass'), | ||
loader : ExtractText.extract('style', 'css?localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass'), | ||
}, | ||
@@ -61,2 +62,3 @@ { | ||
presets : ['es2015', 'stage-0'], | ||
// plugins : ['transform-remove-strict-mode'], | ||
// plugins: ['transform-runtime'], | ||
@@ -68,19 +70,42 @@ }, | ||
plugins : [ | ||
new webpack.BannerPlugin(banner), | ||
new ExtractText('../css/[name].css'), | ||
new webpack.Profile(), | ||
new webpack.DefinePlugin({ | ||
'process.env': { | ||
NODE_ENV : '"production"', | ||
}, | ||
}), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress : { | ||
warnings : false | ||
warnings : false, | ||
}, | ||
output : { | ||
comments : false, | ||
}, | ||
}), | ||
new PackageInfo({ | ||
'@NAME' : packageJson.name, | ||
'@VERSION' : packageJson.version, | ||
}), | ||
new webpack.BannerPlugin(banner), | ||
], | ||
vue : { | ||
loaders : { | ||
sass : extractTextPlugin.extract('style', 'css!autoprefixer?browsers=last 2 version!sass?indentedSyntax'), | ||
scss : extractTextPlugin.extract('style', 'css!autoprefixer?browsers=last 2 version!sass'), | ||
sass : ExtractText.extract('style', 'css!autoprefixer?browsers=last 2 version!sass?indentedSyntax'), | ||
scss : ExtractText.extract('style', 'css!autoprefixer?browsers=last 2 version!sass'), | ||
} | ||
}, | ||
}; | ||
if (process.argv[process.argv.length-1] == '--build=js') { | ||
let output = { | ||
path : './dist/', | ||
filename : '[name].min.js', | ||
}; | ||
module.exports.plugins.shift(); | ||
let loaders = module.exports.module.loaders; | ||
loaders[3].loaders = ['css', 'autoprefixer']; | ||
loaders[4].loaders = ['css', 'autoprefixer', 'sass']; | ||
loaders[3].loader = loaders[4].loader = void 0; | ||
process.argv.slice(-3).slice(0, 2).forEach(( argument ) => { | ||
let result = argument.trim().replace('--', '').split('='); | ||
output[result[0]] = result[1]; | ||
}); | ||
module.exports.output = output; | ||
} |
@@ -5,10 +5,12 @@ 'use strict'; | ||
let webpack = require('webpack'); | ||
let extractTextPlugin = require('extract-text-webpack-plugin'); | ||
let ExtractText = require('extract-text-webpack-plugin'); | ||
let entry = require('./entry.js'); | ||
let alias = {}; | ||
const alias = {}; | ||
const entry = require('./webpack.entry.json'); | ||
const imageSize = 10240; | ||
module.exports = { | ||
devtool : '#source-map', | ||
entry : entry, | ||
entry, | ||
output : { | ||
@@ -34,11 +36,11 @@ filename : 'js/[name].js', | ||
test : /\.(png|jpg|gif|svg)$/, | ||
loader : 'url?limit=10240&name=../image/[name].[ext]?[hash]', | ||
loader : `url?limit=${ imageSize }&name=../img/[name].[ext]?[hash]`, | ||
}, | ||
{ | ||
test : /\.css$/, | ||
loader : extractTextPlugin.extract('style', 'css'), | ||
loader : ExtractText.extract('style', 'css'), | ||
}, | ||
{ | ||
test : /\.scss$/, | ||
loader : extractTextPlugin.extract('style', 'css?localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass'), | ||
loader : ExtractText.extract('style', 'css?localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass'), | ||
}, | ||
@@ -51,2 +53,3 @@ { | ||
presets : ['es2015', 'stage-0'], | ||
// plugins : ['transform-remove-strict-mode'], | ||
// plugins: ['transform-runtime'], | ||
@@ -58,10 +61,10 @@ }, | ||
plugins : [ | ||
new extractTextPlugin('css/[name].css'), | ||
new ExtractText('css/[name].css'), | ||
], | ||
vue : { | ||
loaders : { | ||
sass : extractTextPlugin.extract('style', 'css!autoprefixer?browsers=last 2 version!sass?indentedSyntax'), | ||
scss : extractTextPlugin.extract('style', 'css!autoprefixer?browsers=last 2 version!sass'), | ||
sass : ExtractText.extract('style', 'css!autoprefixer?browsers=last 2 version!sass?indentedSyntax'), | ||
scss : ExtractText.extract('style', 'css!autoprefixer?browsers=last 2 version!sass'), | ||
}, | ||
}, | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22872
28
540
3
13
1