nexl-engine/nexl-source-utils.js
function resolveIncludeDirectives(text, fileItem) {
	var result = [];

	// parse source code with esprima
	try {
		var srcParsed = esprima.parse(text);
	} catch (e) {
		logger.error(buildErrMsg(fileItem.ancestor, 'Failed to parse a [%s] JavaScript file. Reason : [%s]', fileItem.filePath, e));
		throw buildShortErrMsg(fileItem.ancestor, 'Failed to parse a [%s] JavaScript file. Reason : [%s]', path.basename(fileItem.filePath), e)
	}

	// iterating over and looking for include directives
	for (var key in srcParsed.body) {
		var item = srcParsed.body[key];

		// resolve include directive from dom item
		var includeDirective = resolveIncludeDirectiveDom(item);
		if (includeDirective != null) {
			result.push(includeDirective);
		}
	}

	return result;
}
function resolveIncludeDirectives(text, fileItem) {
	var result = [];

	// parse source code with esprima
	try {
		var srcParsed = esprima.parse(text);
	} catch (e) {
		logger.error(buildErrMsg(fileItem.ancestor, 'Failed to parse a [%s] JavaScript file. Reason : [%s]', fileItem.filePath, e));
		throw buildShortErrMsg(fileItem.ancestor, 'Failed to parse a [%s] JavaScript file. Reason : [%s]', path.basename(fileItem.filePath), e)
	}

	// iterating over and looking for include directives
	for (var key in srcParsed.body) {
		var item = srcParsed.body[key];

		// resolve include directive from dom item
		var includeDirective = resolveIncludeDirectiveDom(item);
		if (includeDirective != null) {
			result.push(includeDirective);
		}
	}

	return result;
}
function resolveIncludeDirectives ( text , fileItem ) { var result = [ ] ; // parse source code with esprima try { var srcParsed = esprima . parse ( text ) ; } catch ( e ) { logger . error ( buildErrMsg ( fileItem . ancestor , 'Failed to parse a [%s] JavaScript file. Reason : [%s]' , fileItem . filePath , e ) ) ; throw buildShortErrMsg ( fileItem . ancestor , 'Failed to parse a [%s] JavaScript file. Reason : [%s]' , path . basename ( fileItem . filePath ) , e ) } // iterating over and looking for include directives for ( var key in srcParsed . body ) { var item = srcParsed . body [ key ] ; // resolve include directive from dom item var includeDirective = resolveIncludeDirectiveDom ( item ) ; if ( includeDirective != null ) { result . push ( includeDirective ) ; } } return result ; }
parses JavaScript provided as text and resolves nexl include directives ( like "@import ../../src.js"; )
parses JavaScript provided as text and resolves nexl include directives ( like