Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Syed Aman committed Mar 3, 2024
0 parents commit 253a28d
Show file tree
Hide file tree
Showing 47 changed files with 5,314 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/NodeLite.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 102 additions & 0 deletions .idea/editor.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
cmake_minimum_required(VERSION 3.28)
project(NodeLite)

set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# Include directories for NodeLite core and external libraries
include_directories(${PROJECT_SOURCE_DIR}/include)
link_directories(${PROJECT_SOURCE_DIR}/lib)

# Source files for the main NodeLite executable
set(SOURCE_FILES
main.cpp
# Add other source files here
)

# Define the NodeLite executable
add_executable(NodeLite ${SOURCE_FILES})

# Link with external libraries, if any (e.g., V8, libuv)
# target_link_libraries(NodeLite libv8.a libuv.a)

enable_testing()

function(add_nodelite_test test_file)
get_filename_component(test_name ${test_file} NAME_WE)
add_test(NAME ${test_name}
COMMAND NodeLite ${PROJECT_SOURCE_DIR}/tests/${test_file})

endfunction(add_nodelite_test)

add_nodelite_test(http_tests.js)
add_nodelite_test(module_loading_tests.js)
add_nodelite_tests(async_io_tests.js)
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# NodeLite

NodeLite is an ultra-lightweight, highly modular Node.js-like runtime environment designed for building scalable server-side applications using JavaScript. It is intended for environments where memory and processing power are at a premium, or for educational purposes to understand the internals of server-side JavaScript execution. NodeLite aims to provide the core functionalities of Node.js with a focus on simplicity, modularity, and extensibility.

## Getting Started

To start using NodeLite, ensure you have the following prerequisites installed:

- Git
- C++ compiler (GCC or Clang)
- Python 3.x (for build scripts)
- CMake

Clone the repository:

```bash
git clone https://yourrepository.com/NodeLite.git
cd NodeLite
```

Compile and build the project:

```bash
make build
```

To run a simple JavaScript file:

```bash
./nodelite yourscript.js
```

## Development

NodeLite is in early development stages and contributors are welcome. The project structure is designed to be modular, allowing for components to be easily added, modified, or replaced. The core components of NodeLite include:

- **libuv-lite**: A minimalistic version of libuv, focusing on the essential event loop and asynchronous I/O operations.
- **v8-lite**: A stripped-down version of the V8 engine for executing JavaScript. This will prioritize memory efficiency and modularity.
- **http-lite**: A lightweight implementation of the HTTP/HTTPS protocols, supporting basic server functionality.

### Building a Simple HTTP Server

```javascript
const http = require('http-lite');

const server = http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
});

server.listen(8080, () => {
console.log('Server running at http://127.0.0.1:8080/');
});
```

### Extending NodeLite

To add a new module to NodeLite, follow these steps:

1. Create a new directory under `src/modules`.
2. Implement your module in C++ or JavaScript, adhering to the NodeLite module interface.
3. Add your module to the build system and documentation.

### Contribution Guidelines

Contributions to NodeLite are highly encouraged. Please follow these guidelines:

- Write clear, maintainable code.
- Provide comprehensive documentation for new features or modules.
- Submit pull requests with detailed descriptions of changes.
- Ensure your code passes all tests before submitting.

## Further Reading

- "Design Patterns: Elements of Reusable Object-Oriented Software" by Erich Gamma et al. – For understanding architectural patterns used.
- "Understanding ECMAScript 6" by Nicholas C. Zakas – For insights into the core JavaScript concepts used in NodeLite.
- "Node.js Design Patterns" by Mario Casciaro – For comparative analysis with Node.js and understanding of design choices.

NodeLite is a platform for exploration, learning, and innovation. It is an ongoing project where the boundaries of what's possible with server-side JavaScript are continuously being tested and expanded.
Empty file.
Empty file.
Empty file.
Empty file.
Loading

0 comments on commit 253a28d

Please sign in to comment.