Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
|
ce9c8542a9 | |
|
328a7ca6d5 | |
|
33429266f3 | |
|
542ebfc496 | |
|
3f8361af05 |
|
@ -4,13 +4,11 @@
|
|||
* @date 2018-08-04 01:00:06
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
require('es.shim')
|
||||
const fs = require('iofs')
|
||||
const path = require('path')
|
||||
const chokidar = require('chokidar')
|
||||
const uglify = require('uglify-es')
|
||||
const { minify } = require('terser')
|
||||
const chalk = require('chalk')
|
||||
const config = require('./package.json')
|
||||
const log = console.log
|
||||
|
@ -137,8 +135,11 @@ function packAndCompress() {
|
|||
*/
|
||||
log('正在打包 anot.js...')
|
||||
let normalVerPack = Buffer.concat([PAD_START, normalVer, PAD_END]).toString()
|
||||
fs.echo(comment() + uglify.minify(normalVerPack).code, './dist/anot.js')
|
||||
log(chalk.green('anot.js 打包压缩完成!'))
|
||||
|
||||
minify(normalVerPack, { sourceMap: false }).then(res => {
|
||||
fs.echo(comment() + res.code, './dist/anot.js')
|
||||
log(chalk.green('anot.js 打包压缩完成!'))
|
||||
})
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------
|
||||
|
@ -148,11 +149,10 @@ function packAndCompress() {
|
|||
log('正在打包 anot.touch.js...')
|
||||
let touchVerPack = Buffer.concat([PAD_START, touchVer, PAD_END]).toString()
|
||||
|
||||
fs.echo(
|
||||
comment({ touch: true }) + uglify.minify(touchVerPack).code,
|
||||
'./dist/anot.touch.js'
|
||||
)
|
||||
log(chalk.green('anot.touch.js 打包压缩完成!'))
|
||||
minify(touchVerPack, { sourceMap: false }).then(res => {
|
||||
fs.echo(comment({ touch: true }) + res.code, './dist/anot.touch.js')
|
||||
log(chalk.green('anot.touch.js 打包压缩完成!'))
|
||||
})
|
||||
}
|
||||
|
||||
let args = process.argv.slice(2)
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
"devDependencies": {
|
||||
"chalk": "^2.4.1",
|
||||
"chokidar": "^2.0.4",
|
||||
"es.shim": "^1.1.2",
|
||||
"iofs": "^1.1.0",
|
||||
"uglify-es": "^3.3.9"
|
||||
"es.shim": "^2.0.1",
|
||||
"iofs": "^1.5.2",
|
||||
"terser": "^5.0.0"
|
||||
},
|
||||
"repository": "https://github.com/yutent/anot.js.git",
|
||||
"author": "yutent",
|
||||
|
|
|
@ -85,10 +85,7 @@ Anot.PropsTypes.isBoolean = function() {
|
|||
/*判定是否是一个朴素的javascript对象(Object),不是DOM对象,不是BOM对象,不是自定义类的实例*/
|
||||
Anot.isPlainObject = function(obj) {
|
||||
// 简单的 typeof obj === "object"检测,会致使用isPlainObject(window)在opera下通不过
|
||||
return (
|
||||
serialize.call(obj) === '[object Object]' &&
|
||||
Object.getPrototypeOf(obj) === oproto
|
||||
)
|
||||
return serialize.call(obj) === '[object Object]' && Object.getPrototypeOf(obj) === oproto
|
||||
}
|
||||
|
||||
let VMODELS = (Anot.vmodels = {}) //所有vmodel都储存在这里
|
||||
|
@ -168,11 +165,7 @@ Anot.mix = Anot.fn.mix = function() {
|
|||
if (target === copy) {
|
||||
continue
|
||||
}
|
||||
if (
|
||||
deep &&
|
||||
copy &&
|
||||
(Anot.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))
|
||||
) {
|
||||
if (deep && copy && (Anot.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
|
||||
if (copyIsArray) {
|
||||
copyIsArray = false
|
||||
clone = src && Array.isArray(src) ? src : []
|
||||
|
@ -278,11 +271,11 @@ Anot.mix({
|
|||
t = t.trim()
|
||||
let hook = hooks[t]
|
||||
if (typeof hook === 'object') {
|
||||
t = hook.type || type
|
||||
phase = hook.phase || !!phase
|
||||
t = hook.type || t
|
||||
phase = hook.phase || phase
|
||||
fn = hook.fix ? hook.fix(el, fn) : fn
|
||||
}
|
||||
el.addEventListener(t, fn, phase)
|
||||
el.addEventListener(t, fn, !!phase)
|
||||
})
|
||||
return fn
|
||||
},
|
||||
|
@ -295,10 +288,10 @@ Anot.mix({
|
|||
t = t.trim()
|
||||
let hook = hooks[t]
|
||||
if (typeof hook === 'object') {
|
||||
t = hook.type || type
|
||||
phase = hook.phase || !!phase
|
||||
t = hook.type || t
|
||||
phase = hook.phase || phase
|
||||
}
|
||||
el.removeEventListener(t, fn, phase)
|
||||
el.removeEventListener(t, fn, !!phase)
|
||||
})
|
||||
},
|
||||
/*读写删除元素节点的样式*/
|
||||
|
@ -466,7 +459,6 @@ Anot.mix({
|
|||
},
|
||||
//获取url的参数
|
||||
search: function(key) {
|
||||
key += ''
|
||||
let uri = location.search
|
||||
|
||||
if (!uri) {
|
||||
|
|
Reference in New Issue