mapscreenr
Advanced tools
Comparing version
{ | ||
"editor.tabSize": 4, | ||
"editor.trimAutoWhitespace": true, | ||
"files.exclude": { | ||
"**/*.d.ts": true, | ||
"**/*.js.map": true, | ||
"**/*.js": { "when": "$(basename).ts" }, | ||
"**/*?.js": { "when": "$(basename).tsx" } | ||
}, | ||
"tslint.alwaysShowRuleFailuresAsWarnings": true, | ||
@@ -5,0 +11,0 @@ "tslint.autoFixOnSave": true, |
@@ -1,185 +0,1 @@ | ||
define(function() { return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { | ||
/******/ configurable: false, | ||
/******/ enumerable: true, | ||
/******/ get: getter | ||
/******/ }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
/******/ __webpack_require__.n = function(module) { | ||
/******/ var getter = module && module.__esModule ? | ||
/******/ function getDefault() { return module['default']; } : | ||
/******/ function getModuleExports() { return module; }; | ||
/******/ __webpack_require__.d(getter, 'a', getter); | ||
/******/ return getter; | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* A flexible container for map attributes and viewport. | ||
*/ | ||
var MapScreenr = /** @class */ (function () { | ||
/** | ||
* Initializes a new instance of the MapScreenr class. | ||
* | ||
* @param settings Settings to be used for initialization. | ||
*/ | ||
function MapScreenr(settings) { | ||
/** | ||
* Assorted known variables, keyed by name. | ||
*/ | ||
this.variables = {}; | ||
if (settings.variables !== undefined) { | ||
for (var name_1 in settings.variables) { | ||
if ({}.hasOwnProperty.call(settings.variables, name_1)) { | ||
this.variables[name_1] = settings.variables[name_1]; | ||
} | ||
} | ||
} | ||
this.height = settings.height; | ||
this.width = settings.width; | ||
this.variableFunctions = settings.variableFunctions === undefined | ||
? {} | ||
: settings.variableFunctions; | ||
} | ||
/** | ||
* Completely clears the MapScreenr for use in a new Area. Positioning is | ||
* reset to (0,0) and user-configured variables are recalculated. | ||
*/ | ||
MapScreenr.prototype.clearScreen = function () { | ||
this.left = 0; | ||
this.top = 0; | ||
this.right = this.width; | ||
this.bottom = this.height; | ||
this.setMiddleX(); | ||
this.setMiddleY(); | ||
this.setVariables(); | ||
}; | ||
/** | ||
* Computes middleX as the midpoint between left and right. | ||
*/ | ||
MapScreenr.prototype.setMiddleX = function () { | ||
this.middleX = (this.left + this.right) / 2; | ||
}; | ||
/** | ||
* Computes middleY as the midpoint between top and bottom. | ||
*/ | ||
MapScreenr.prototype.setMiddleY = function () { | ||
this.middleY = (this.top + this.bottom) / 2; | ||
}; | ||
/** | ||
* Recalculates all variables. | ||
*/ | ||
MapScreenr.prototype.setVariables = function () { | ||
for (var i in this.variableFunctions) { | ||
this.setVariable(i); | ||
} | ||
}; | ||
/** | ||
* Recalculates a variable by passing variableArgs to its Function. | ||
* | ||
* @param name The name of the variable to recalculate. | ||
* @param value A new value for the variable instead of its Function's result. | ||
* @returns The new value of the variable. | ||
*/ | ||
MapScreenr.prototype.setVariable = function (name, value) { | ||
this.variables[name] = arguments.length === 1 | ||
? this.variableFunctions[name]() | ||
: value; | ||
}; | ||
/** | ||
* Shifts the MapScreenr horizontally and vertically via shiftX and shiftY. | ||
* | ||
* @param dx How far to scroll horizontally. | ||
* @param dy How far to scroll vertically. | ||
*/ | ||
MapScreenr.prototype.shift = function (dx, dy) { | ||
if (dx !== 0) { | ||
this.shiftX(dx); | ||
} | ||
if (dy !== 0) { | ||
this.shiftY(dy); | ||
} | ||
}; | ||
/** | ||
* Shifts the MapScreenr horizontally by changing left and right by the dx. | ||
* | ||
* @param dx How far to scroll horizontally. | ||
*/ | ||
MapScreenr.prototype.shiftX = function (dx) { | ||
this.left += dx; | ||
this.right += dx; | ||
}; | ||
/** | ||
* Shifts the MapScreenr vertically by changing top and bottom by the dy. | ||
* | ||
* @param dy How far to scroll vertically. | ||
*/ | ||
MapScreenr.prototype.shiftY = function (dy) { | ||
this.top += dy; | ||
this.bottom += dy; | ||
}; | ||
return MapScreenr; | ||
}()); | ||
exports.MapScreenr = MapScreenr; | ||
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), | ||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
/***/ }) | ||
/******/ ])});; | ||
define(function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){var r,n;r=[i,e,i(1)],void 0===(n=function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}(i)}.apply(e,r))||(t.exports=n)},function(t,e,i){var r;void 0===(r=function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){if(this.variables={},void 0!==t.variables)for(var e in t.variables)({}).hasOwnProperty.call(t.variables,e)&&(this.variables[e]=t.variables[e]);this.height=t.height,this.width=t.width,this.variableFunctions=void 0===t.variableFunctions?{}:t.variableFunctions}return t.prototype.clearScreen=function(){this.left=0,this.top=0,this.right=this.width,this.bottom=this.height,this.setMiddleX(),this.setMiddleY(),this.setVariables()},t.prototype.setMiddleX=function(){this.middleX=(this.left+this.right)/2},t.prototype.setMiddleY=function(){this.middleY=(this.top+this.bottom)/2},t.prototype.setVariables=function(){for(var t in this.variableFunctions)this.setVariable(t)},t.prototype.setVariable=function(t,e){this.variables[t]=1===arguments.length?this.variableFunctions[t]():e},t.prototype.shift=function(t,e){0!==t&&this.shiftX(t),0!==e&&this.shiftY(e)},t.prototype.shiftX=function(t){this.left+=t,this.right+=t},t.prototype.shiftY=function(t){this.top+=t,this.bottom+=t},t}();e.MapScreenr=i}.apply(e,[i,e]))||(t.exports=r)}])}); |
@@ -13,22 +13,29 @@ { | ||
"devDependencies": { | ||
"@types/chai": "^4.0.4", | ||
"@types/lolex": "^1.5.32", | ||
"@types/mocha": "^2.2.44", | ||
"@types/sinon": "^4.0.0", | ||
"@types/sinon-chai": "^2.7.29", | ||
"chai": "^4.1.2", | ||
"glob": "^7.1.2", | ||
"lolex": "^2.3.0", | ||
"mocha": "^4.0.1", | ||
"mocha-headless-chrome": "^1.7.1", | ||
"requirejs": "^2.3.5", | ||
"@types/chai": "^4.1.7", | ||
"@types/lodash": "^4.14.123", | ||
"@types/lolex": "^3.1.1", | ||
"@types/mocha": "^5.2.6", | ||
"@types/sinon": "^7.0.11", | ||
"@types/sinon-chai": "^3.2.2", | ||
"chai": "^4.2.0", | ||
"concurrently": "^4.1.0", | ||
"glob": "^7.1.3", | ||
"istanbul": "^0.4.5", | ||
"lolex": "^3.1.0", | ||
"mkdirp": "^0.5.1", | ||
"mocha": "^6.1.3", | ||
"mocha-headless-chrome": "^2.0.2", | ||
"npm-check-updates": "^3.1.7", | ||
"requirejs": "^2.3.6", | ||
"run-for-every-file": "^1.1.0", | ||
"shenanigans-manager": "^0.2.5", | ||
"sinon": "^4.1.2", | ||
"sinon-chai": "^2.14.0", | ||
"tslint": "5.8.0", | ||
"tsutils": "^2.14.0", | ||
"typedoc": "^0.9.0", | ||
"typescript": "^2.6.2", | ||
"webpack": "^3.10.0" | ||
"shenanigans-manager": "^0.2.36", | ||
"sinon": "^7.3.1", | ||
"sinon-chai": "^3.3.0", | ||
"tslint": "5.15.0", | ||
"tsutils": "^3.10.0", | ||
"typedoc": "^0.14.2", | ||
"typescript": "^3.4.3", | ||
"watch": "^1.0.2", | ||
"webpack": "^4.30.0", | ||
"webpack-cli": "^3.3.0" | ||
}, | ||
@@ -47,5 +54,7 @@ "license": "MIT", | ||
"init": "npm install && npm run setup && npm run verify", | ||
"setup": "npm run setup:copy && npm run setup:package && npm run setup:readme", | ||
"ncu": "ncu -u", | ||
"setup": "npm run setup:dirs && npm run setup:copy && npm run setup:package && npm run setup:readme", | ||
"setup:copy": "npm run setup:copy:default", | ||
"setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/default/\" --file \"**/*\" --run \"mustache package.json {{src-file}} {{file}}\" --dest \".\" --only-files", | ||
"setup:dirs": "shenanigans-manager ensure-dirs-exist", | ||
"setup:package": "shenanigans-manager hydrate-package-json", | ||
@@ -55,12 +64,20 @@ "setup:readme": "shenanigans-manager hydrate-readme", | ||
"src:tsc": "tsc -p .", | ||
"src:tslint": "tslint -c tslint.json -e ./node_modules/**/*.ts* -p tsconfig.json -t stylish", | ||
"src:tslint": "tslint -c tslint.json -p tsconfig.json -t stylish", | ||
"src:tslint:fix": "tslint -c tslint.json --fix -p tsconfig.json -t stylish", | ||
"test": "npm run test:setup && npm run test:run", | ||
"test:coverage": "npm run test:coverage:generate-html && npm run test:coverage:instrument && npm run test:coverage:run && npm run test:coverage:report", | ||
"test:coverage:generate-html": "shenanigans-manager generate-test-html --source instrumented", | ||
"test:coverage:instrument": "istanbul instrument src -o instrumented", | ||
"test:coverage:report": "istanbul report html", | ||
"test:coverage:run": "mocha-headless-chrome --coverage coverage.json --file test/index.instrumented.html", | ||
"test:run": "mocha-headless-chrome --file test/index.html", | ||
"test:setup": "npm run test:setup:copy && npm run test:setup:html && npm run test:setup:tsc", | ||
"test:setup": "npm run test:setup:dir && npm run test:setup:copy && npm run test:setup:html && npm run test:setup:tsc", | ||
"test:setup:copy": "npm run test:setup:copy:default", | ||
"test:setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/test/\" --file \"**/*\" --run \"mustache package.json {{src-file}} ./test/{{file}}\" --dest \".\" --only-files", | ||
"test:setup:dir": "mkdirp test", | ||
"test:setup:html": "shenanigans-manager generate-test-html", | ||
"test:setup:tsc": "tsc -p test", | ||
"verify": "npm run src && npm run test && npm run dist && npm run docs", | ||
"watch": "tsc -p . -w" | ||
"verify": "npm run src && npm run test && npm run dist", | ||
"verify:coverage": "npm run src && npm run test:setup && npm run test:coverage && npm run dist", | ||
"watch": "concurrently \"tsc -p . -w\" --raw \"chokidar src/**/*.test.t* --command \"\"npm run test:setup:html\"\" --silent\" --raw" | ||
}, | ||
@@ -71,3 +88,3 @@ "shenanigans": { | ||
"types": "./src/index.d.ts", | ||
"version": "0.7.2" | ||
"version": "0.7.3" | ||
} |
@@ -1,3 +0,4 @@ | ||
<!-- {{Top}} --> | ||
<!-- Top --> | ||
# MapScreenr | ||
[](https://greenkeeper.io/) | ||
[](https://travis-ci.org/FullScreenShenanigans/MapScreenr) | ||
@@ -7,10 +8,13 @@ [](http://badge.fury.io/js/mapscreenr) | ||
A flexible container for map attributes and viewport. | ||
<!-- {{/Top}} --> | ||
<!-- /Top --> | ||
<!-- {{Development}} --> | ||
<!-- Development --> | ||
## Development | ||
After [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo/): | ||
``` | ||
git clone https://github.com/FullScreenShenanigans/MapScreenr | ||
git clone https://github.com/<your-name-here>/MapScreenr | ||
cd MapScreenr | ||
npm install | ||
npm run setup | ||
@@ -33,3 +37,3 @@ npm run verify | ||
### Running Tests | ||
#### Running Tests | ||
@@ -40,6 +44,9 @@ ```shell | ||
Test files are alongside source files under `src/` and named `*.test.ts?`. | ||
Whenever you add, remove, or rename a `*.test.ts?` file under `src/`, re-run `npm run test:setup` to regenerate the list of static test files in `test/index.html`. | ||
Tests are written in [Mocha](https://github.com/mochajs/mocha) and [Chai](https://github.com/chaijs/chai). | ||
Their files are written using alongside source files under `src/` and named `*.test.ts?`. | ||
Whenever you add, remove, or rename a `*.test.t*` file under `src/`, `watch` will re-run `npm run test:setup` to regenerate the list of static test files in `test/index.html`. | ||
You can open that file in a browser to debug through the tests. | ||
`npm run test` will run that setup and execute tests using [Puppeteer](https://github.com/GoogleChrome/puppeteer). | ||
<!-- {{/Development}} --> | ||
<!-- Maps --> | ||
<!-- /Maps --> | ||
<!-- /Development --> |
@@ -5,12 +5,17 @@ { | ||
"experimentalDecorators": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"jsx": "react", | ||
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"], | ||
"lib": ["dom", "es2015"], | ||
"module": "amd", | ||
"moduleResolution": "node", | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"pretty": true, | ||
"strictNullChecks": true, | ||
"strict": true, | ||
"strictFunctionTypes": false, | ||
"strictPropertyInitialization": false, | ||
"target": "es5" | ||
@@ -17,0 +22,0 @@ }, |
{ | ||
"extends": "./node_modules/shenanigans-manager/setup/tslint.json", | ||
"linterOptions": { | ||
"exclude": [ | ||
"./node_modules/**/*" | ||
] | ||
}, | ||
"rules": { | ||
@@ -4,0 +9,0 @@ "no-any": false |
@@ -10,8 +10,4 @@ const glob = require("glob"); | ||
{ | ||
entry: `./src/${package.shenanigans.name}.js`, | ||
entry: `./src/index.js`, | ||
name: package.shenanigans.name, | ||
sources: [ | ||
"./**/*.js", | ||
"!./**/*.test.js", | ||
] | ||
} | ||
@@ -45,6 +41,6 @@ ] | ||
// multiple entries? | ||
module.exports = { | ||
entry, // IDictionary<string> | ||
entry, | ||
externals, | ||
mode: "production", | ||
output: { | ||
@@ -54,3 +50,6 @@ filename: "[name].js", | ||
path: path.join(__dirname, "dist"), | ||
}, | ||
performance: { | ||
hints: false | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
2
-33.33%50
16.28%1
-66.67%25130
-94.84%27
35%19
-47.22%453
-78.34%