micro-definition
Advanced tools
Comparing version 0.0.2 to 0.0.3
/*! | ||
* @ProjectName micro-definition | ||
* @Version 0.0.2 | ||
* @Version 0.0.3 | ||
* @Author lixinliang(https://github.com/lixinliang) | ||
* @Update 2016-09-25 3:43:09 pm | ||
* @Update 2016-09-29 8:39:12 pm | ||
*/ | ||
!function(n){function t(o){if(e[o])return e[o].exports;var r=e[o]={exports:{},id:o,loaded:!1};return n[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var e={};return t.m=n,t.c=e,t.p="",t(0)}([function(n,t){"use strict";function e(n){throw new TypeError("micro-definition: "+n)}function o(){}function r(n,t,e){var i=n.length;i?!function(){var d=function(){i--,i||e(t.apply(window,p))},l=function(n,t,e,o){var i=n.dependency,c=n.content,u=new Function("return "+c)();r(i,u,function(n){a[t]=p[e]=n,d(),o()})},p=[];n.forEach(function(n,t){if("function"==typeof u[n]&&(n=u[n].call(u)),a[n])p[t]=a[n],d();else{var e=c(n);e?l(e,n,t,o):u[n]?f[n]?f[n].push(function(){p[t]=a[n],d()}):!function(){f[n]=[];var e=document.createElement("script");e.src=u[n],e.onload=function(){document.head.removeChild(e);var o=c(n);l(o,n,t,function(){f[n].forEach(function(n){n()})})},document.head.appendChild(e)}():(p[t]=a[n]=void 0,d())}})}():e(t())}function i(n,t,i){arguments.length<2&&e("2 arguments required at least."),"string"!=typeof n?(i=t,t=n,n=null):n||e("Module id can not be empty."),t instanceof Array||(i=t,t=[]),"function"!=typeof i&&e("Module should be a function."),n?c(n,{dependency:t,timestamp:+new Date,content:i.toString()}):r(t,i,o)}var c=microStorage("micro-definition"),u={},a={},f={};i.alias=function(n){for(var t in n)u[t]=n[t]},i.version="0.0.2",i.storage=c,window.define=i}]); | ||
!function(n){function t(o){if(e[o])return e[o].exports;var r=e[o]={exports:{},id:o,loaded:!1};return n[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var e={};return t.m=n,t.c=e,t.p="",t(0)}([function(n,t){"use strict";function e(n){throw new TypeError("micro-definition: "+n)}function o(){}function r(n,t,e){var i=n.length;i?!function(){var d=function(){i--,i||e(t.apply(window,p))},l=function(n,t,e,o){var i=n.dependency,c=n.content,u=new Function("return "+c)();r(i,u,function(n){a[t]=p[e]=n,d(),o()})},p=[];n.forEach(function(n,t){if("function"==typeof u[n]&&(n=u[n].call(u)),a[n])p[t]=a[n],d();else{var e=c(n);e?l(e,n,t,o):u[n]?f[n]?f[n].push(function(){p[t]=a[n],d()}):!function(){f[n]=[];var e=document.createElement("script");e.src=u[n],e.onload=function(){document.head.removeChild(e);var o=c(n);l(o,n,t,function(){f[n].forEach(function(n){n()})})},document.head.appendChild(e)}():(p[t]=a[n]=void 0,d())}})}():e(t())}function i(n,t,i){arguments.length<2&&e("2 arguments required at least."),"string"!=typeof n?(i=t,t=n,n=null):n||e("Module id can not be empty."),t instanceof Array||(i=t,t=[]),"function"!=typeof i&&e("Module should be a function."),n?c(n,{dependency:t,timestamp:+new Date,content:i.toString()}):r(t,i,o)}var c=microStorage("micro-definition"),u={},a={},f={};i.alias=function(n){for(var t in n)u[t]=n[t]},i.version="0.0.3",i.storage=c,window.define=i}]); |
{ | ||
"name": "micro-definition", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "(<2kb) A lite module definition tool.", | ||
"main": "dist/micro-definition.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,4 +44,4 @@ "repository": { | ||
"inline-source": "^5.0.0", | ||
"jquery": "^3.0.0", | ||
"micro-storage": "0.0.8", | ||
"inquirer": "^1.1.3", | ||
"micro-storage": "0.0.9", | ||
"minifycss-loader": "^0.2.0", | ||
@@ -55,3 +55,2 @@ "moment": "~2.8.3", | ||
"url-loader": "^0.5.7", | ||
"vue": "^1.0.24", | ||
"vue-hot-reload-api": "^1.3.2", | ||
@@ -61,3 +60,2 @@ "vue-html-loader": "^1.2.2", | ||
"vue-style-loader": "^1.0.0", | ||
"vue-touch": "^1.1.0", | ||
"webpack": "^1.13.1", | ||
@@ -64,0 +62,0 @@ "webpack-dev-server": "^1.14.1" |
/** | ||
* @webpack | ||
* @library | ||
* @libraryTarget var | ||
*/ | ||
/** | ||
* Dependency microStorage @see https://www.npmjs.com/package/micro-storage | ||
@@ -13,3 +19,3 @@ * @type {Object} storage | ||
* Throw error | ||
* @param {String} message throw error | ||
* @param {String} message throw error | ||
*/ | ||
@@ -27,5 +33,5 @@ function throwError ( message ) { | ||
* Resolve the dependency of module | ||
* @param {Array} dependency dependency of module | ||
* @param {Function} method content of module | ||
* @param {Function} callback pass the return value of the method | ||
* @param {Array} dependency dependency of module | ||
* @param {Function} method content of module | ||
* @param {Function} callback pass the return value of the method | ||
*/ | ||
@@ -98,5 +104,5 @@ function resolve ( dependency, method, callback ) { | ||
* define a module by name or invoke an anonymous function and pass the dependency as arguments | ||
* @param {String} id unique name of module | ||
* @param {Array} dependency dependency of module | ||
* @param {Function} method method | ||
* @param {String} id unique name of module | ||
* @param {Array} dependency dependency of module | ||
* @param {Function} method method | ||
*/ | ||
@@ -136,3 +142,3 @@ function define ( id, dependency, method ) { | ||
* Set alias to each module | ||
* @param {Object} config module-id : module-path | ||
* @param {Object} config module-id : module-path | ||
*/ | ||
@@ -139,0 +145,0 @@ define.alias = function ( config ) { |
@@ -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,15 +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', | ||
libraryTarget : 'var', | ||
path : './dist/js/', | ||
filename : '[name].js', | ||
}, | ||
extensions: ['.vue', '.js', '.json', '.scss', '.html'], | ||
extensions : ['.vue', '.js', '.json', '.scss', '.html'], | ||
resolve : { | ||
alias, | ||
}, | ||
module : { | ||
@@ -43,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'), | ||
}, | ||
@@ -60,2 +62,3 @@ { | ||
presets : ['es2015', 'stage-0'], | ||
// plugins : ['transform-remove-strict-mode'], | ||
// plugins: ['transform-runtime'], | ||
@@ -67,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
27197
29
627
3
14
1