Compare commits

...

2 Commits

Author SHA1 Message Date
AJ ONeal 68e4de75bf 0.12.1 2020-11-08 20:49:01 -07:00
AJ ONeal bd548f16da bugfix Promise 2020-11-08 20:48:56 -07:00
7 changed files with 16 additions and 19 deletions

View File

@ -242,7 +242,7 @@ JavaScript module (or make requests to an API service that renders them for you)
```javascript
var slim = exports.slimjs || require("slimjs");
function render(contentstr /*, desi*/) {
return PromiseA.resolve(slim(contentstr));
return Promise.resolve(slim(contentstr));
}
Desirae.registerRenderer(".slim", render);

View File

@ -5,7 +5,7 @@
function create(Desi) {
// Chrome, Firefox, and even MSIE11+ all support crypto
var crypto = window.crypto || window.msCrypto,
PromiseA = window.Promise,
Promise = window.Promise,
algos;
// convenience mappings for common digest algorithms
@ -111,7 +111,7 @@
function request() {}
request.get = function (url /*, query*/) {
// Return a new promise.
return new PromiseA(function (resolve, reject) {
return new Promise(function (resolve, reject) {
// Do the usual XHR stuff
var req = new XMLHttpRequest();
req.onload = function () {
@ -139,7 +139,7 @@
};
request.post = function (url /*, query*/, body) {
// Return a new promise.
return new PromiseA(function (resolve, reject) {
return new Promise(function (resolve, reject) {
// Do the usual XHR stuff
var req = new XMLHttpRequest();
req.onload = function () {

View File

@ -1,7 +1,5 @@
"use strict";
var PromiseA = require("bluebird").Promise,
fs = PromiseA.promisifyAll(require("fs"));
function create(Desi, options) {
var fsapi = Desi.fsapi;
options.blogdir = options.blogdir || options.working_path;

View File

@ -10,7 +10,7 @@ var safeResolve = require("../utils").safeResolve;
var sha1sum = function (str) {
return require("secret-utils").hashsum("sha1", str);
};
var fsExtra = PromiseA.promisifyAll(require("fs.extra"));
var copyAll = require("util").promisify(require("fs.extra").copy);
//, tmpdir = require('os').tmpdir()
function strip(prefix, pathname) {
@ -48,7 +48,7 @@ function walkDir(parent, sub, opts) {
return true;
}
return new PromiseA(function (resolve) {
return new Promise(function (resolve) {
var walker = walk.walk(trueRoot);
walker.on("nodeError", function (filepath, stat, next) {
//stats.forEach(function (stat) {
@ -76,7 +76,7 @@ function walkDir(parent, sub, opts) {
var file;
if (!filter(stat.name)) {
return PromiseA.resolve();
return Promise.resolve();
}
file = {
@ -93,7 +93,7 @@ function walkDir(parent, sub, opts) {
files.push(file);
if (!(opts.sha1sum || opts.content)) {
return PromiseA.resolve();
return Promise.resolve();
}
// TODO stream sha1 (for assets)
@ -208,7 +208,7 @@ function copyfs(blogdir, files) {
//, filename = path.basename(dest)
dirpaths[pathname] = true;
return PromiseA.resolve();
return Promise.resolve();
})
.then(function () {
// TODO is it better to do this lazy-like or as a batch?
@ -224,7 +224,7 @@ function copyfs(blogdir, files) {
// TODO allow delete?
return forEachAsync(sources, function (source) {
return fsExtra
.copyAsync(
.copyAll(
safeResolve(blogdir, source),
safeResolve(blogdir, files[source]),
{ replace: true }
@ -276,7 +276,7 @@ function putfs(blogdir, files, options) {
dirpaths[pathname] = true;
return PromiseA.resolve();
return Promise.resolve();
})
.then(function () {
// TODO is it better to do this lazy-like or as a batch?

View File

@ -2,13 +2,12 @@
(function (exports) {
"use strict";
var PromiseA = exports.Promise || require("bluebird").Promise;
function renderMd(contentstr /*, desi*/) {
var markitdown = (exports.markdownit || require("markdown-it"))({
html: true,
linkify: true,
});
return PromiseA.resolve(
return Promise.resolve(
markitdown.render(contentstr)
//.replace('"', '"')
//.replace(''', "'")
@ -18,7 +17,7 @@
function renderNoop(contentstr /*, desi*/) {
// hmmm... that was easy
return PromiseA.resolve(contentstr);
return Promise.resolve(contentstr);
}
function renderJade(contentstr, desi, options) {
@ -30,7 +29,7 @@
var jade = exports.jade || require("jade"),
fn = jade.compile(contentstr, options),
html = fn(desi);
return PromiseA.resolve(html);
return Promise.resolve(html);
}
exports.DesiraeRenderMarkdown = renderMd.DesiraeRenderMarkdown = renderMd;

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "desirae",
"version": "0.12.0",
"version": "0.12.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "desirae",
"version": "0.12.0",
"version": "0.12.1",
"description": "An in-browser static blog library and static site generator. Similar to Jekyll, Octopress, Nanoc, etc",
"main": "desirae.js",
"scripts": {