You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.1 KiB

  1. // Generated by CoffeeScript 1.6.3
  2. var Backbone, DocPad, createInstance, createMiddlewareInstance, pathUtil, queryEngine, _ref;
  3. pathUtil = require('path');
  4. _ref = require(__dirname + '/lib/docpad'), DocPad = _ref.DocPad, queryEngine = _ref.queryEngine, Backbone = _ref.Backbone, createInstance = _ref.createInstance, createMiddlewareInstance = _ref.createMiddlewareInstance;
  5. module.exports = {
  6. DocPad: DocPad,
  7. queryEngine: queryEngine,
  8. Backbone: Backbone,
  9. createInstance: createInstance,
  10. createMiddlewareInstance: createMiddlewareInstance,
  11. require: function(relativePath) {
  12. var absolutePath, err;
  13. absolutePath = pathUtil.normalize(pathUtil.join(__dirname, relativePath));
  14. if (absolutePath.replace(__dirname, '') === absolutePath) {
  15. throw new Error("docpad.require is limited to local docpad files only: " + relativePath);
  16. }
  17. try {
  18. require.resolve(absolutePath);
  19. } catch (_error) {
  20. err = _error;
  21. absolutePath = pathUtil.join(__dirname, 'lib', relativePath);
  22. require.resolve(absolutePath);
  23. }
  24. return require(absolutePath);
  25. }
  26. };