@ephox/bolt
Advanced tools
Comparing version 1.8.1 to 1.8.2
@@ -97,5 +97,6 @@ (function (scope) { | ||
[ | ||
ephox.bolt.kernel.fp.array | ||
], | ||
function () { | ||
function (ar) { | ||
var dirname = function (file) { | ||
@@ -113,5 +114,19 @@ var normalized = file.replace(/\\/g, '/'); | ||
var normalize = function (file) { | ||
var parts = file.split('/'); | ||
var outParts = []; | ||
ar.each(parts, function (part) { | ||
if (part === '.') return; | ||
else if (part === '..') outParts.pop(); | ||
else outParts.push(part); | ||
}); | ||
return outParts.join('/'); | ||
}; | ||
return { | ||
basename: basename, | ||
dirname: dirname | ||
dirname: dirname, | ||
normalize: normalize | ||
}; | ||
@@ -306,9 +321,17 @@ } | ||
function (error, bouncing, path, xhr) { | ||
var cache = { }; | ||
var read = function (relativeto, file, done, acc) { | ||
var accumulated = acc || { sources: [], types: [], configs: [] }; | ||
var accumulated = acc || { sources: [], types: [], configs: [] }; | ||
var base = path.dirname(relativeto); | ||
var absolute = base + '/' + file; | ||
xhr.request(absolute, function (payload) { | ||
bouncing.evaluate(absolute, payload, done, read, accumulated); | ||
}, error.die); | ||
var normalizedPath = path.normalize(absolute); | ||
if (cache.hasOwnProperty(normalizedPath)) bouncing.evaluate(absolute, cache[normalizedPath], done, read, accumulated); | ||
else { | ||
xhr.request(absolute, function (payload) { | ||
cache[normalizedPath] = payload; | ||
bouncing.evaluate(absolute, payload, done, read, accumulated); | ||
}, error.die); | ||
} | ||
}; | ||
@@ -315,0 +338,0 @@ |
@@ -301,2 +301,16 @@ (function (scope) { | ||
var throwsError = function (f, expected, message) { | ||
var token = {}; | ||
try { | ||
f(); | ||
throw token; | ||
} catch (e) { | ||
if (e === token) | ||
throw new Error(message); | ||
if (expected !== undefined) | ||
eq(expected, e.message, message); | ||
} | ||
} | ||
var succeeds = function (f, message) { | ||
@@ -328,2 +342,3 @@ try { | ||
throws: throws, | ||
throwsError: throwsError, | ||
succeeds: succeeds, | ||
@@ -498,3 +513,3 @@ fail: fail, | ||
// This is a list of commonly used variables in DOM tests that are transferred. It is expected to expand over time. | ||
const variables = [ | ||
var variables = [ | ||
"document", | ||
@@ -501,0 +516,0 @@ "window", |
{ | ||
"name": "@ephox/bolt", | ||
"version": "1.8.1", | ||
"version": "1.8.2", | ||
"description": "Bolt, AMD-like module system for JavaScript", | ||
@@ -22,3 +22,6 @@ "bin": { | ||
"author": "Ephox", | ||
"license": "BSD-3-Clause" | ||
"license": "BSD-3-Clause", | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
104287
3326