mjml-parser-xml
Advanced tools
Comparing version 4.5.1 to 4.6.0
@@ -95,4 +95,8 @@ 'use strict'; | ||
filePath = _options$filePath === undefined ? '.' : _options$filePath, | ||
_options$actualPath = options.actualPath, | ||
actualPath = _options$actualPath === undefined ? '.' : _options$actualPath, | ||
_options$ignoreInclud = options.ignoreIncludes, | ||
ignoreIncludes = _options$ignoreInclud === undefined ? false : _options$ignoreInclud; | ||
ignoreIncludes = _options$ignoreInclud === undefined ? false : _options$ignoreInclud, | ||
_options$preprocessor = options.preprocessors, | ||
preprocessors = _options$preprocessor === undefined ? [] : _options$preprocessor; | ||
@@ -106,4 +110,13 @@ | ||
var cwd = filePath ? _path2.default.dirname(filePath) : process.cwd(); | ||
var cwd = process.cwd(); | ||
if (filePath) { | ||
try { | ||
var isDir = _fs2.default.lstatSync(filePath).isDirectory(); | ||
cwd = isDir ? filePath : _path2.default.dirname(filePath); | ||
} catch (e) { | ||
throw new Error('Specified filePath does not exist'); | ||
} | ||
} | ||
var mjml = null; | ||
@@ -134,3 +147,3 @@ var cur = null; | ||
file: file, | ||
absoluteFilePath: _path2.default.resolve(cwd, filePath), | ||
absoluteFilePath: _path2.default.resolve(cwd, actualPath), | ||
parent: cur, | ||
@@ -153,3 +166,4 @@ tagName: 'mj-raw', | ||
var partialMjml = MJMLParser(content, (0, _extends3.default)({}, options, { | ||
filePath: partialPath | ||
filePath: partialPath, | ||
actualPath: partialPath | ||
}), [].concat((0, _toConsumableArray3.default)(cur.includedIn), [{ | ||
@@ -184,4 +198,4 @@ file: cur.absoluteFilePath, | ||
mjml.children.push({ | ||
file: filePath, | ||
absoluteFilePath: _path2.default.resolve(cwd, filePath), | ||
file: actualPath, | ||
absoluteFilePath: _path2.default.resolve(cwd, actualPath), | ||
parent: mjml, | ||
@@ -239,4 +253,4 @@ tagName: 'mj-head', | ||
var newNode = { | ||
file: filePath, | ||
absoluteFilePath: _path2.default.resolve(cwd, filePath), | ||
file: actualPath, | ||
absoluteFilePath: _path2.default.resolve(cwd, actualPath), | ||
line: line, | ||
@@ -312,2 +326,5 @@ includedIn: includedIn, | ||
// Apply preprocessors to raw xml | ||
xml = (0, _flow2.default)(preprocessors)(xml); | ||
parser.write(xml); | ||
@@ -314,0 +331,0 @@ parser.end(); |
{ | ||
"name": "mjml-parser-xml", | ||
"description": "mjml-parser-xml", | ||
"version": "4.5.1", | ||
"version": "4.6.0", | ||
"main": "lib/index.js", | ||
@@ -28,6 +28,6 @@ "repository": { | ||
"cross-env": "^5.2.0", | ||
"mjml": "4.5.1", | ||
"mjml-core": "4.5.1" | ||
"mjml": "4.6.0", | ||
"mjml-core": "4.6.0" | ||
}, | ||
"gitHead": "8fee6b676a0e2084177fcf8c1095dc52e12517c0" | ||
"gitHead": "6bfd02a89a9105885b542b630360edbb75fdb080" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26429
407