Make LessLoader flow properly, sorry about that

This commit is contained in:
Caleb James DeLisle
2018-07-18 16:22:44 +02:00
parent a181c09a68
commit 5527949c70

View File

@@ -8,7 +8,7 @@ define([
'/bower_components/nthen/index.js' '/bower_components/nthen/index.js'
], function (Config, nThen) { /*::});module.exports = (function() { ], function (Config, nThen) { /*::});module.exports = (function() {
const Config = (undefined:any); const Config = (undefined:any);
const nThen = require('/bower_components/nthen/index.js'); const nThen = (undefined:any);
*/ */
var module = { exports: {} }; var module = { exports: {} };
@@ -141,17 +141,16 @@ define([
var loadSubmodulesAndInject = function (css, url, cb, stack) { var loadSubmodulesAndInject = function (css, url, cb, stack) {
inject(css, url); inject(css, url);
var nt = nThen; nThen(function (w) {
nt = nt(function (w) {
css.replace(/\-\-LessLoader_require\:\s*"([^"]*)"\s*;/g, function (all, u) { css.replace(/\-\-LessLoader_require\:\s*"([^"]*)"\s*;/g, function (all, u) {
u = u.replace(/\?.*$/, ''); u = u.replace(/\?.*$/, '');
module.exports.load(u, w(), stack); module.exports.load(u, w(), stack);
return '';
}); });
}).nThen; }).nThen(function () { cb(); });
nt(function () { cb(); });
}; };
module.exports.load = function (url /*:string*/, cb /*:()=>void*/, stack /*:?Array*/) { module.exports.load = function (url /*:string*/, cb /*:()=>void*/, stack /*:?Array<string>*/) {
var btime = stack ? null : +new Date(); var btime = stack ? null : +new Date();
stack = stack || []; stack = stack || [];
if (stack.indexOf(url) > -1) { return void cb(); } if (stack.indexOf(url) > -1) { return void cb(); }