2
0
Преглед на файлове

amberc.js: readFiles() comes before compile()

Manfred Kroehnert преди 10 години
родител
ревизия
f17dcf50d9
променени са 1 файла, в които са добавени 23 реда и са изтрити 22 реда
  1. 23 22
      cli/support/amberc.js

+ 23 - 22
cli/support/amberc.js

@@ -382,6 +382,29 @@ function create_compiler(configuration) {
 };
 
 
+/**
+ * Read the content of all files into memory.
+ * Returns a Promise.all() object.
+ */
+function readFiles(configuration) {
+	return Promise.all(
+		configuration.compile.map(function(stFile) {
+			return new Promise(function(resolve, reject) {
+				if (/\.st/.test(stFile)) {
+					console.ambercLog('Importing: ' + stFile);
+					fs.readFile(stFile, 'utf8', function(err, data) {
+						if (!err)
+							resolve(data);
+						else
+							reject(Error('Could not import: ' + stFile));
+					});
+				}
+			});
+		})
+	);
+};
+
+
 /**
  * Compile all given .st files by importing them.
  * Captures the configuration object in a closure and returns a function that
@@ -414,28 +437,6 @@ function compile(configuration) {
 	};
 };
 
-/**
- * Read the content of all files into memory.
- * Returns a Promise.all() object.
- */
-function readFiles(configuration) {
-	return Promise.all(
-		configuration.compile.map(function(stFile) {
-			return new Promise(function(resolve, reject) {
-				if (/\.st/.test(stFile)) {
-					console.ambercLog('Importing: ' + stFile);
-					fs.readFile(stFile, 'utf8', function(err, data) {
-						if (!err)
-							resolve(data);
-						else
-							reject(Error('Could not import: ' + stFile));
-					});
-				}
-			});
-		})
-	);
-};
-
 
 /**
  * Export compiled categories to JavaScript files.