<commit_before>const fs = require('graceful-fs');

//import {selectorRegExpFactory, Bootloader, BootloaderConfig} from '@angular/universal';
import { NgModuleMetadataType, NgModule } from '@angular/core';
import { platformDynamicNode, NodeModule } from '@angular/universal';


export interface UniversalConfig {
    UniversalConfiguration : {
        preboot ?: {};
        originUrl ?: string;
        requestUrl ?: string;
        document ?: string;
    };
}

// TODO: Create better Typedef with things inside withConfig?
export type ExpressEngineConfig = NgModuleMetadataType & UniversalConfig;


// WORK IN PROGRESS
res.render('./index.html', {
    imports : [],
    providers : [],
    bootstrap : [],
    declarations : [],

    schemas : [],
    entryComponents : [],
    exports : [],

    UniversalConfiguration : {
        originUrl: 'http://localhost:3000',
        baseUrl: '/',
        requestUrl: '/',
        preboot: {
          appRoot: ['app'],
          uglify: true
        },
    }
});

let cache : Object = {};


export function expressEngine(filePath: string, options?: ExpressEngineConfig, done?: Function) {

    options = options || <ExpressEngineConfig>{};

    // read file on disk
    try {

        if (cache[filePath]) {
        return readContent(cache[filePath]);
        }
        fs.readFile(filePath, (err, content) => {
        if (err) {
            disposeExpressPlatform();
            return done(err);
        }
        cache[filePath] = content;
        return readContent(content);
        });
<commit_msg>WIP expressEngine - comment res.render example<commit_after>const fs = require('graceful-fs');

// import {selectorRegExpFactory, Bootloader, BootloaderConfig} from '@angular/universal';
import { NgModuleMetadataType, NgModule } from '@angular/core';
import { platformDynamicNode, NodeModule } from '@angular/universal';


export interface UniversalConfig {
    UniversalConfiguration : {
        preboot ?: {};
        originUrl ?: string;
        requestUrl ?: string;
        document ?: string;
    };
}

// TODO: Create better Typedef with things inside withConfig?
export type ExpressEngineConfig = NgModuleMetadataType & UniversalConfig;


// WORK IN PROGRESS 
// basic idea on how to use ?

// res.render('./index.html', {
//     imports : [],
//     providers : [],
//     bootstrap : [],
//     declarations : [],

//     schemas : [],
//     entryComponents : [],
//     exports : [],

//     UniversalConfiguration : {
//         originUrl: 'http://localhost:3000',
//         baseUrl: '/',
//         requestUrl: '/',
//         preboot: {
//           appRoot: ['app'],
//           uglify: true
//         },
//     }
// });

let cache : Object = {};


export function expressEngine(filePath: string, options?: ExpressEngineConfig, done?: Function) {

    options = options || <ExpressEngineConfig>{};

    // read file on disk
    try {

        if (cache[filePath]) {
        return readContent(cache[filePath]);
        }
        fs.readFile(filePath, (err, content) => {
        if (err) {
            disposeExpressPlatform();
            return done(err);
        }
        cache[filePath] = content;
        return readContent(content);
        });

{'fraction_non_alphanumeric': 0.1393544382371198, 'fraction_numerical': 0.002482929857231533, 'mean_word_length': 2.40337909186906, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5090239', 'n_tokens_mistral': 893, 'n_tokens_neox': 866, 'n_words': 208}