Linux vps-61133.fhnet.fr 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
Apache/2.4.25 (Debian)
Server IP : 93.113.207.21 & Your IP : 216.73.216.112
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
html_old /
pigeon /
node_modules /
stylus /
lib /
Delete
Unzip
Name
Size
Permission
Date
Action
convert
[ DIR ]
drwxr-xr-x
2022-06-27 18:41
functions
[ DIR ]
drwxr-xr-x
2022-06-27 18:41
nodes
[ DIR ]
drwxr-xr-x
2022-06-27 18:41
stack
[ DIR ]
drwxr-xr-x
2022-06-27 18:41
visitor
[ DIR ]
drwxr-xr-x
2022-06-27 18:41
colors.js
4.41
KB
-rw-r--r--
2012-10-23 18:12
errors.js
952
B
-rw-r--r--
2012-10-23 18:12
lexer.js
16.04
KB
-rw-r--r--
2012-11-20 21:56
middleware.js
5.69
KB
-rw-r--r--
2012-10-23 18:12
parser.js
33.51
KB
-rw-r--r--
2013-02-12 17:36
renderer.js
3.66
KB
-rw-r--r--
2013-01-03 17:17
stylus.js
1.64
KB
-rw-r--r--
2012-11-24 19:10
token.js
892
B
-rw-r--r--
2012-10-23 18:12
units.js
576
B
-rw-r--r--
2012-10-23 18:20
utils.js
6.35
KB
-rw-r--r--
2013-02-28 00:21
Save
Rename
/*! * Stylus - middleware * Copyright(c) 2010 LearnBoost <dev@learnboost.com> * MIT Licensed */ /** * Module dependencies. */ var stylus = require('./stylus') , fs = require('fs') , url = require('url') , basename = require('path').basename , dirname = require('path').dirname , mkdirp = require('mkdirp') , join = require('path').join , debug = require('debug')('stylus:middleware'); /** * Import map. */ var imports = {}; /** * Return Connect middleware with the given `options`. * * Options: * * `force` Always re-compile * `src` Source directory used to find .styl files * `dest` Destination directory used to output .css files * when undefined defaults to `src`. * `compile` Custom compile function, accepting the arguments * `(str, path)`. * `compress` Whether the output .css files should be compressed * `firebug` Emits debug infos in the generated css that can * be used by the FireStylus Firebug plugin * `linenos` Emits comments in the generated css indicating * the corresponding stylus line * * Examples: * * Here we set up the custom compile function so that we may * set the `compress` option, or define additional functions. * * By default the compile function simply sets the `filename` * and renders the CSS. * * function compile(str, path) { * return stylus(str) * .set('filename', path) * .set('compress', true); * } * * Pass the middleware to Connect, grabbing .styl files from this directory * and saving .css files to _./public_. Also supplying our custom `compile` function. * * Following that we have a `static()` layer setup to serve the .css * files generated by Stylus. * * var app = connect(); * * app.middleware({ * src: __dirname * , dest: __dirname + '/public' * , compile: compile * }) * * app.use(connect.static(__dirname + '/public')); * * @param {Object} options * @return {Function} * @api public */ module.exports = function(options){ options = options || {}; // Accept src/dest dir if ('string' == typeof options) { options = { src: options }; } // Force compilation var force = options.force; // Source dir required var src = options.src; if (!src) throw new Error('stylus.middleware() requires "src" directory'); // Default dest dir to source var dest = options.dest ? options.dest : src; // Default compile callback options.compile = options.compile || function(str, path){ return stylus(str) .set('filename', path) .set('compress', options.compress) .set('firebug', options.firebug) .set('linenos', options.linenos); }; // Middleware return function stylus(req, res, next){ if ('GET' != req.method && 'HEAD' != req.method) return next(); var path = url.parse(req.url).pathname; if (/\.css$/.test(path)) { var cssPath = join(dest, path) , stylusPath = join(src, path.replace('.css', '.styl')); // Ignore ENOENT to fall through as 404 function error(err) { next('ENOENT' == err.code ? null : err); } // Force if (force) return compile(); // Compile to cssPath function compile() { debug('read %s', cssPath); fs.readFile(stylusPath, 'utf8', function(err, str){ if (err) return error(err); var style = options.compile(str, stylusPath); var paths = style.options._imports = []; delete imports[stylusPath]; style.render(function(err, css){ if (err) return next(err); debug('render %s', stylusPath); imports[stylusPath] = paths; mkdirp(dirname(cssPath), 0700, function(err){ if (err) return error(err); fs.writeFile(cssPath, css, 'utf8', next); }); }); }); } // Re-compile on server restart, disregarding // mtimes since we need to map imports if (!imports[stylusPath]) return compile(); // Compare mtimes fs.stat(stylusPath, function(err, stylusStats){ if (err) return error(err); fs.stat(cssPath, function(err, cssStats){ // CSS has not been compiled, compile it! if (err) { if ('ENOENT' == err.code) { debug('not found %s', cssPath); compile(); } else { next(err); } } else { // Source has changed, compile it if (stylusStats.mtime > cssStats.mtime) { debug('modified %s', cssPath); compile(); // Already compiled, check imports } else { checkImports(stylusPath, function(changed){ if (debug && changed.length) { changed.forEach(function(path) { debug('modified import %s', path); }); } changed.length ? compile() : next(); }); } } }); }); } else { next(); } } }; /** * Check `path`'s imports to see if they have been altered. * * @param {String} path * @param {Function} fn * @api private */ function checkImports(path, fn) { var nodes = imports[path]; if (!nodes) return fn(); if (!nodes.length) return fn(); var pending = nodes.length , changed = []; nodes.forEach(function(imported){ fs.stat(imported.path, function(err, stat){ // error or newer mtime if (err || !imported.mtime || stat.mtime > imported.mtime) { changed.push(imported.path); } --pending || fn(changed); }); }); }