function()

in src/main.ts [86:118]


		function (this: ThroughStream, file: FileWithSourceMap) {
			if (!file.isBuffer()) {
				this.emit('error', `Failed to read file: ${file.relative}`);
				return;
			}

			let result = processFile(file.contents.toString('utf8'), undefined, undefined);
			if (result.errors && result.errors.length > 0) {
				result.errors.forEach(error => console.error(`${file.relative}${error}`));
				this.emit('error', `Failed to rewrite file: ${file.path}`);
				return;
			}

			// emit the input file as-is
			this.queue(file);

			// emit nls meta data if available
			if (result.bundle) {
				let ext = path.extname(file.path);
				let filePath = file.path.substr(0, file.path.length - ext.length);
				this.queue(new File({
					base: file.base,
					path: filePath + NLS_JSON,
					contents: new Buffer(JSON.stringify(result.bundle.messages, null, '\t'), 'utf8')
				}));
				let metaDataContent: SingleMetaDataFile = Object.assign({}, result.bundle, { filePath: removePathPrefix(filePath, file.base) });
				this.queue(new File({
					base: file.base,
					path: filePath + NLS_METADATA_JSON,
					contents: new Buffer(JSON.stringify(metaDataContent, null, '\t'), 'utf8')
				}));
			}
		}