mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 02:42:48 +00:00
updated bunch of file paths and changed the way posts are loaded
This commit is contained in:
22
node_modules/constantinople/.gitattributes
generated
vendored
Normal file
22
node_modules/constantinople/.gitattributes
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
||||
13
node_modules/constantinople/.npmignore
generated
vendored
Normal file
13
node_modules/constantinople/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
pids
|
||||
logs
|
||||
results
|
||||
npm-debug.log
|
||||
node_modules
|
||||
3
node_modules/constantinople/.travis.yml
generated
vendored
Normal file
3
node_modules/constantinople/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
19
node_modules/constantinople/LICENSE
generated
vendored
Normal file
19
node_modules/constantinople/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2013 Forbes Lindesay
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
42
node_modules/constantinople/README.md
generated
vendored
Normal file
42
node_modules/constantinople/README.md
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# constantinople
|
||||
|
||||
Determine whether a JavaScript expression evaluates to a constant (using acorn). Here it is assumed to be safe to underestimate how constant something is.
|
||||
|
||||
[](https://travis-ci.org/ForbesLindesay/constantinople)
|
||||
[](https://gemnasium.com/ForbesLindesay/constantinople)
|
||||
[](https://www.npmjs.org/package/constantinople)
|
||||
|
||||
## Installation
|
||||
|
||||
npm install constantinople
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isConstant = require('constantinople')
|
||||
|
||||
if (isConstant('"foo" + 5')) {
|
||||
console.dir(isConstant.toConstant('"foo" + 5'))
|
||||
}
|
||||
if (isConstant('Math.floor(10.5)', {Math: Math})) {
|
||||
console.dir(isConstant.toConstant('Math.floor(10.5)', {Math: Math}))
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### isConstant(src, [constants])
|
||||
|
||||
Returns `true` if `src` evaluates to a constant, `false` otherwise. It will also return `false` if there is a syntax error, which makes it safe to use on potentially ES6 code.
|
||||
|
||||
Constants is an object mapping strings to values, where those values should be treated as constants. Note that this makes it a pretty bad idea to have `Math` in there if the user might make use of `Math.random` and a pretty bad idea to have `Date` in there.
|
||||
|
||||
### toConstant(src, [constants])
|
||||
|
||||
Returns the value resulting from evaluating `src`. This method throws an error if the expression is not constant. e.g. `toConstant("Math.random()")` would throw an error.
|
||||
|
||||
Constants is an object mapping strings to values, where those values should be treated as constants. Note that this makes it a pretty bad idea to have `Math` in there if the user might make use of `Math.random` and a pretty bad idea to have `Date` in there.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
100
node_modules/constantinople/index.js
generated
vendored
Normal file
100
node_modules/constantinople/index.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
'use strict'
|
||||
|
||||
var acorn = require('acorn');
|
||||
var walk = require('acorn/dist/walk');
|
||||
|
||||
var lastSRC = '(null)';
|
||||
var lastRes = true;
|
||||
var lastConstants = undefined;
|
||||
|
||||
var STATEMENT_WHITE_LIST = {
|
||||
'EmptyStatement': true,
|
||||
'ExpressionStatement': true,
|
||||
};
|
||||
var EXPRESSION_WHITE_LIST = {
|
||||
'ParenthesizedExpression': true,
|
||||
'ArrayExpression': true,
|
||||
'ObjectExpression': true,
|
||||
'SequenceExpression': true,
|
||||
'TemplateLiteral': true,
|
||||
'UnaryExpression': true,
|
||||
'BinaryExpression': true,
|
||||
'LogicalExpression': true,
|
||||
'ConditionalExpression': true,
|
||||
'Identifier': true,
|
||||
'Literal': true,
|
||||
'ComprehensionExpression': true,
|
||||
'TaggedTemplateExpression': true,
|
||||
'MemberExpression': true,
|
||||
'CallExpression': true,
|
||||
'NewExpression': true,
|
||||
};
|
||||
module.exports = isConstant;
|
||||
function isConstant(src, constants) {
|
||||
src = '(' + src + ')';
|
||||
if (lastSRC === src && lastConstants === constants) return lastRes;
|
||||
lastSRC = src;
|
||||
lastConstants = constants;
|
||||
if (!isExpression(src)) return lastRes = false;
|
||||
var ast;
|
||||
try {
|
||||
ast = acorn.parse(src, {
|
||||
ecmaVersion: 6,
|
||||
allowReturnOutsideFunction: true,
|
||||
allowImportExportEverywhere: true,
|
||||
allowHashBang: true
|
||||
});
|
||||
} catch (ex) {
|
||||
return lastRes = false;
|
||||
}
|
||||
var isConstant = true;
|
||||
walk.simple(ast, {
|
||||
Statement: function (node) {
|
||||
if (isConstant) {
|
||||
if (STATEMENT_WHITE_LIST[node.type] !== true) {
|
||||
isConstant = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
Expression: function (node) {
|
||||
if (isConstant) {
|
||||
if (EXPRESSION_WHITE_LIST[node.type] !== true) {
|
||||
isConstant = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
MemberExpression: function (node) {
|
||||
if (isConstant) {
|
||||
if (node.computed) isConstant = false;
|
||||
else if (node.property.name[0] === '_') isConstant = false;
|
||||
}
|
||||
},
|
||||
Identifier: function (node) {
|
||||
if (isConstant) {
|
||||
if (!constants || !(node.name in constants)) {
|
||||
isConstant = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
return lastRes = isConstant;
|
||||
}
|
||||
isConstant.isConstant = isConstant;
|
||||
|
||||
isConstant.toConstant = toConstant;
|
||||
function toConstant(src, constants) {
|
||||
if (!isConstant(src, constants)) throw new Error(JSON.stringify(src) + ' is not constant.');
|
||||
return Function(Object.keys(constants || {}).join(','), 'return (' + src + ')').apply(null, Object.keys(constants || {}).map(function (key) {
|
||||
return constants[key];
|
||||
}));
|
||||
}
|
||||
|
||||
function isExpression(src) {
|
||||
try {
|
||||
eval('throw "STOP"; (function () { return (' + src + '); })()');
|
||||
return false;
|
||||
}
|
||||
catch (err) {
|
||||
return err === 'STOP';
|
||||
}
|
||||
}
|
||||
75
node_modules/constantinople/package.json
generated
vendored
Normal file
75
node_modules/constantinople/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"constantinople@~3.0.1",
|
||||
"/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/jade"
|
||||
]
|
||||
],
|
||||
"_from": "constantinople@>=3.0.1 <3.1.0",
|
||||
"_id": "constantinople@3.0.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/constantinople",
|
||||
"_nodeVersion": "1.6.2",
|
||||
"_npmUser": {
|
||||
"email": "forbes@lindesay.co.uk",
|
||||
"name": "forbeslindesay"
|
||||
},
|
||||
"_npmVersion": "2.7.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "constantinople",
|
||||
"raw": "constantinople@~3.0.1",
|
||||
"rawSpec": "~3.0.1",
|
||||
"scope": null,
|
||||
"spec": ">=3.0.1 <3.1.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jade"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/constantinople/-/constantinople-3.0.2.tgz",
|
||||
"_shasum": "4b945d9937907bcd98ee575122c3817516544141",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "constantinople@~3.0.1",
|
||||
"_where": "/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/jade",
|
||||
"author": {
|
||||
"name": "ForbesLindesay"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ForbesLindesay/constantinople/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": "^2.1.0"
|
||||
},
|
||||
"description": "Determine whether a JavaScript expression evaluates to a constant (using UglifyJS)",
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "4b945d9937907bcd98ee575122c3817516544141",
|
||||
"tarball": "http://registry.npmjs.org/constantinople/-/constantinople-3.0.2.tgz"
|
||||
},
|
||||
"gitHead": "8947fdfb41428b1c8f5df1645f38bc0af34d7f21",
|
||||
"homepage": "https://github.com/ForbesLindesay/constantinople",
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "forbeslindesay",
|
||||
"email": "forbes@lindesay.co.uk"
|
||||
}
|
||||
],
|
||||
"name": "constantinople",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ForbesLindesay/constantinople.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha -R spec"
|
||||
},
|
||||
"version": "3.0.2"
|
||||
}
|
||||
71
node_modules/constantinople/test/index.js
generated
vendored
Normal file
71
node_modules/constantinople/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
'use strict'
|
||||
|
||||
var assert = require('assert')
|
||||
var constaninople = require('../')
|
||||
|
||||
describe('isConstant(src)', function () {
|
||||
it('handles "[5 + 3 + 10]"', function () {
|
||||
assert(constaninople.isConstant('[5 + 3 + 10]') === true)
|
||||
})
|
||||
it('handles "/[a-z]/.test(\'a\')"', function () {
|
||||
assert(constaninople.isConstant('/[a-z]/.test(\'a\')') === true)
|
||||
})
|
||||
it('handles "{\'class\': [(\'data\')]}"', function () {
|
||||
assert(constaninople.isConstant('{\'class\': [(\'data\')]}') === true)
|
||||
})
|
||||
it('handles "Math.random()"', function () {
|
||||
assert(constaninople.isConstant('Math.random()') === false)
|
||||
})
|
||||
it('handles "Math.random("', function () {
|
||||
assert(constaninople.isConstant('Math.random(') === false)
|
||||
})
|
||||
it('handles "Math.floor(10.5)" with {Math: Math} as constants', function () {
|
||||
assert(constaninople.isConstant('Math.floor(10.5)', {Math: Math}) === true)
|
||||
})
|
||||
it('handles "this.myVar"', function () {
|
||||
assert(constaninople.isConstant('this.myVar') === false)
|
||||
})
|
||||
it('handles "(function () { while (true); return 10; }())"', function () {
|
||||
assert(constaninople.isConstant('(function () { while (true); return 10; }())') === false)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
describe('toConstant(src)', function () {
|
||||
it('handles "[5 + 3 + 10]"', function () {
|
||||
assert.deepEqual(constaninople.toConstant('[5 + 3 + 10]'), [5 + 3 + 10])
|
||||
})
|
||||
it('handles "/[a-z]/.test(\'a\')"', function () {
|
||||
assert(constaninople.toConstant('/[a-z]/.test(\'a\')') === true)
|
||||
})
|
||||
it('handles "{\'class\': [(\'data\')]}"', function () {
|
||||
assert.deepEqual(constaninople.toConstant('{\'class\': [(\'data\')]}'), {'class': ['data']})
|
||||
})
|
||||
it('handles "Math.random()"', function () {
|
||||
try {
|
||||
constaninople.toConstant('Math.random()')
|
||||
} catch (ex) {
|
||||
return
|
||||
}
|
||||
assert(false, 'Math.random() should result in an error')
|
||||
})
|
||||
it('handles "Math.random("', function () {
|
||||
try {
|
||||
constaninople.toConstant('Math.random(')
|
||||
} catch (ex) {
|
||||
return
|
||||
}
|
||||
assert(false, 'Math.random( should result in an error')
|
||||
})
|
||||
it('handles "Math.floor(10.5)" with {Math: Math} as constants', function () {
|
||||
assert(constaninople.toConstant('Math.floor(10.5)', {Math: Math}) === 10)
|
||||
})
|
||||
it('handles "(function () { while (true); return 10; }())"', function () {
|
||||
try {
|
||||
constaninople.toConstant('(function () { while (true); return 10; }())')
|
||||
} catch (ex) {
|
||||
return
|
||||
}
|
||||
assert(false, '(function () { while (true); return 10; }()) should result in an error')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user