Procházet zdrojové kódy

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

Manfred Kroehnert před 11 roky
rodič
revize
f17dcf50d9
1 změnil soubory, kde provedl 23 přidání a 22 odebrání
  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.