anim-event
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -1,2 +0,2 @@ | ||
/*! AnimEvent v1.0.3 (c) anseki https://github.com/anseki/anim-event */ | ||
/*! AnimEvent v1.0.4 (c) anseki https://github.com/anseki/anim-event */ | ||
var AnimEvent=function(n){function e(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return n[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var t={};return e.m=n,e.c=t,e.i=function(n){return n},e.d=function(n,t,o){e.o(n,t)||Object.defineProperty(n,t,{configurable:!1,enumerable:!0,get:o})},e.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,"a",t),t},e.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},e.p="",e(e.s=0)}([function(n,e,t){"use strict";function o(){var n=void 0,e=void 0;w&&(c.call(window,w),w=null),a.forEach(function(e){e.event&&(e.listener(e.event),e.event=null,n=!0)}),n?(d=Date.now(),e=!0):Date.now()-d<u&&(e=!0),e&&(w=l.call(window,o))}function i(n){var e=-1;return a.some(function(t,o){return t.listener===n&&(e=o,!0)}),e}Object.defineProperty(e,"__esModule",{value:!0});var r=1e3/60,u=500,a=[],l=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(n){return setTimeout(n,r)},c=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||function(n){return clearTimeout(n)},w=void 0,d=Date.now(),m={add:function(n){var e=void 0;return i(n)===-1?(a.push(e={listener:n}),function(n){e.event=n,w||o()}):null},remove:function(n){var e=void 0;(e=i(n))>-1&&(a.splice(e,1),!a.length&&w&&(c.call(window,w),w=null))}};e.default=m,n.exports=e.default}]); |
{ | ||
"name": "anim-event", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Event Manager for Animation", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
{ | ||
"name": "anim-event", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"title": "AnimEvent", | ||
@@ -21,8 +21,9 @@ "description": "Event Manager for Animation", | ||
"devDependencies": { | ||
"babel-core": "^6.23.1", | ||
"babel-loader": "^6.4.0", | ||
"babel-core": "^6.24.0", | ||
"babel-loader": "^7.0.0-beta.1", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-preset-es2015": "^6.22.0", | ||
"cross-env": "^3.2.3", | ||
"skeleton-loader": "1.0.2", | ||
"babel-preset-es2015": "^6.24.0", | ||
"cross-env": "^3.2.4", | ||
"pre-proc": "^0.2.4", | ||
"pre-proc-loader": "^1.0.3", | ||
"webpack": "^2.2.1" | ||
@@ -29,0 +30,0 @@ }, |
@@ -5,3 +5,7 @@ /* eslint-env node, es6 */ | ||
const webpack = require('webpack'), | ||
const | ||
BASE_NAME = 'anim-event', | ||
OBJECT_NAME = 'AnimEvent', | ||
webpack = require('webpack'), | ||
path = require('path'), | ||
@@ -13,10 +17,6 @@ PKG = require('./package'), | ||
SRC_PATH = path.resolve(__dirname, 'src'), | ||
ENTRY_PATH = path.resolve(SRC_PATH, 'anim-event.js'), | ||
ENTRY_PATH = path.resolve(SRC_PATH, `${BASE_NAME}.js`), | ||
BUILD_PATH = BUILD ? __dirname : path.resolve(__dirname, 'test'), | ||
BUILD_FILE = 'anim-event' + (BUILD ? '.min.js' : '.js'), | ||
BUILD_FILE = `${BASE_NAME}${BUILD ? '.min.js' : '.js'}`, | ||
IMPORTED_PACKAGES_PATH = [ | ||
].map(packageName => require.resolve(packageName) // Get package root path | ||
.replace(new RegExp(`^(.*[/\\\\]node_modules[/\\\\]${packageName}[/\\\\]).*$`), '$1')), | ||
BABEL_RULE = { | ||
@@ -30,23 +30,2 @@ loader: 'babel-loader', | ||
/** | ||
* @param {(string|string[])} tag - A tag or an array of tags that are removed. | ||
* @param {string} content - A content that is processed. | ||
* @param {string} srcPath - A full path to the source file. | ||
* @param {(string|RegExp|Array)} pathTest - The content is changed when any test passed. | ||
* A string which must be at the start of it, a RegExp which tests it or an array of these. | ||
* @returns {string} - A content that might have been changed. | ||
*/ | ||
function preProc(tag, content, srcPath, pathTest) { | ||
if (srcPath && pathTest && | ||
!(Array.isArray(pathTest) ? pathTest : [pathTest]).some(test => | ||
test instanceof RegExp ? test.test(srcPath) : srcPath.indexOf(test) === 0)) { | ||
return content; | ||
} | ||
content = content ? content + '' : ''; | ||
return (Array.isArray(tag) ? tag : [tag]).reduce((content, tag) => content | ||
.replace(new RegExp(`[^\\n]*\\[${tag}/\\][^\\n]*\\n?`, 'g'), '') | ||
.replace(new RegExp(`/\\*\\s*\\[${tag}\\]\\s*\\*/[\\s\\S]*?/\\*\\s*\\[/${tag}\\]\\s*\\*/`, 'g'), '') | ||
.replace(new RegExp(`[^\\n]*\\[${tag}\\][\\s\\S]*?\\[/${tag}\\][^\\n]*\\n?`, 'g'), ''), content); | ||
} | ||
module.exports = { | ||
@@ -57,3 +36,3 @@ entry: ENTRY_PATH, | ||
filename: BUILD_FILE, | ||
library: 'AnimEvent', | ||
library: OBJECT_NAME, | ||
libraryTarget: 'var' | ||
@@ -65,17 +44,9 @@ }, | ||
test: /\.js$/, | ||
exclude: absPath => !IMPORTED_PACKAGES_PATH.find(packagePath => absPath.indexOf(packagePath) === 0) && | ||
absPath.split(path.sep).includes('node_modules'), | ||
use: [ | ||
BABEL_RULE, | ||
{ | ||
loader: 'skeleton-loader', | ||
options: { | ||
procedure: function(content) { | ||
return BUILD ? | ||
preProc('DEBUG', content, this.resourcePath, IMPORTED_PACKAGES_PATH.concat(SRC_PATH)) : | ||
content; | ||
} | ||
} | ||
} | ||
] | ||
BUILD ? { | ||
loader: 'pre-proc-loader', | ||
options: {removeTag: {tag: 'DEBUG', pathTest: SRC_PATH}} | ||
} : null | ||
].filter(loader => !!loader) | ||
} | ||
@@ -82,0 +53,0 @@ ] |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
1
26104
8
383