-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7023814
Showing
16 changed files
with
6,494 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: ['plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'prettier', 'prettier/@typescript-eslint'], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Auto detect | ||
* text=auto | ||
|
||
##### Linux | ||
*.sh text eol=lf | ||
*.so binary | ||
|
||
# Script | ||
*.bash text eol=lf | ||
*.bat text eol=crlf | ||
*.cmd text eol=crlf | ||
*.sh text eol=lf | ||
|
||
# Front-end file | ||
*.css text | ||
*.htm text diff=html | ||
*.html text diff=html | ||
|
||
# Json Format | ||
*.json text | ||
|
||
# Typescript/Javascirpt | ||
*.js text | ||
*.ts text | ||
|
||
# C/C++ | ||
*.c text | ||
*.cc text | ||
*.cxx text | ||
*.cpp text | ||
*.c++ text | ||
*.hpp text | ||
*.h text | ||
*.h++ text | ||
*.hh text | ||
*.slo binary | ||
*.lo binary | ||
*.o binary | ||
*.obj binary | ||
*.gch binary | ||
*.pch binary | ||
*.so binary | ||
*.dylib binary | ||
*.dll binary | ||
*.lai binary | ||
*.la binary | ||
*.a binary | ||
*.lib binary | ||
*.exe binary | ||
*.out binary | ||
*.app binary | ||
|
||
# Docker | ||
*.dockerignore text | ||
Dockerfile text | ||
|
||
# Documentation | ||
*.md text | ||
license text | ||
LICENSE text | ||
*README* text | ||
|
||
# Linters | ||
.eslintrc.js text | ||
|
||
# Configs | ||
*.cnf text | ||
*.conf text | ||
*.config text | ||
.editorconfig text | ||
.env text | ||
.gitattributes text | ||
.gitconfig text | ||
.prettierrc text | ||
*.yaml text | ||
*.yml text | ||
Makefile text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Mac files | ||
.DS_Store | ||
|
||
# Data | ||
sample/ | ||
|
||
# Test | ||
test.js | ||
|
||
# Environment | ||
*.env | ||
*.*.env | ||
|
||
# build file | ||
dist/ | ||
build/ | ||
|
||
# IDE | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
src/ | ||
.env | ||
.eslintrc.js | ||
.prettierrc | ||
tsconfig.json | ||
.nodemon.json | ||
test/ | ||
reports/ | ||
.editorconfig | ||
.gitattributes | ||
scripts/ | ||
docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"printWidth": 1000, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"bracketSpacing": true, | ||
"arrowParens": "always" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include "greeting.h" | ||
|
||
std::string helloWorld(std:: string name) { | ||
return "Hello" + name + "World!"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include <string> | ||
std::string helloWorld( std::string name ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef HEAPINFO_H | ||
#define HEAPINFO_H | ||
|
||
#include <iostream> | ||
#include <napi.h> | ||
|
||
|
||
|
||
#ifdef __APPLE__ | ||
#include <unordered_map> | ||
#define unordered_map std::unordered_map | ||
#endif | ||
|
||
using namespace std; | ||
|
||
namespace hif | ||
{ | ||
class HEAP { | ||
public: | ||
struct HeapInfo | ||
{ | ||
size_t totalHeapSize; | ||
size_t totalHeapExecutableSize; | ||
size_t totalPhysicalSize; | ||
size_t usedHeapSize; | ||
size_t heapSizeLimit; | ||
size_t totalAvailableSize; | ||
size_t mallocedMemory; | ||
size_t peakMallocedMemory; | ||
size_t numberOfNativeContexts; | ||
size_t numberOfDetachedContexts; | ||
}; | ||
|
||
struct HeapData | ||
{ | ||
HeapInfo* before; | ||
HeapInfo* after; | ||
uint64_t gcStartTime; | ||
uint64_t gcEndTime; | ||
int gctype; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <napi.h> | ||
#include <string> | ||
#include "greeting.h" | ||
|
||
Napi::String greet(const Napi::CallbackInfo& info) { | ||
Napi::Env env = info.Env(); | ||
|
||
std::string result = helloWorld("lib"); | ||
|
||
return Napi::String::New(env, result); | ||
} | ||
|
||
Napi::Object Init(Napi::Env env, Napi::Object exports) { | ||
exports.Set( | ||
Napi::String::New(env, "greet"), | ||
Napi::Function::New(env, greet) | ||
); | ||
|
||
return exports; | ||
} | ||
|
||
NODE_API_MODULE(dijkstra, Init) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "dijkstra", | ||
"include_dirs" : [ | ||
"addons", | ||
"<!@(node -p \"require('node-addon-api').include\")" | ||
], | ||
"sources": [ | ||
"./addons/greeting.cpp", | ||
"./addons/index.cpp" | ||
], | ||
"cflags" : [ | ||
"-std=c++11" | ||
], | ||
"cflags!" : [ | ||
"-fno-exceptions" | ||
], | ||
"cflags_cc!": [ | ||
"-fno-rtti", | ||
"-fno-exceptions" | ||
], | ||
"ldflags" : [ | ||
"-Wl,-rpath,'$$ORIGIN'" | ||
], | ||
"xcode_settings": { | ||
"OTHER_CFLAGS": [ | ||
"-std=c++11", | ||
"-stdlib=libc++" | ||
], | ||
"GCC_ENABLE_CPP_EXCEPTIONS": "YES", | ||
"MACOSX_DEPLOYMENT_TARGET": "10.9" | ||
}, | ||
"configurations": { | ||
"Debug": { | ||
"cflags": ["--coverage"], | ||
"ldflags": ["--coverage"] | ||
}, | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var module; | ||
|
||
if (process.env.DEBUG) { | ||
module = require('./build/Debug/module.node'); | ||
} else { | ||
module = require('./build/Release/module.node'); | ||
} | ||
|
||
module.exports = module; |
Oops, something went wrong.