Compare commits

..

122 Commits

Author SHA1 Message Date
af837f5303 3.0.7 2022-03-21 08:30:09 +01:00
9145cc890c fix(core): update 2022-03-21 08:30:09 +01:00
e3fa407c1c 3.0.6 2020-08-10 21:18:50 +00:00
865e58b190 fix(core): update 2020-08-10 21:18:50 +00:00
66d00d938c 3.0.5 2020-05-14 12:57:07 +00:00
5c3e165625 fix(core): update 2020-05-14 12:57:06 +00:00
82e282a19f 3.0.4 2020-05-14 12:56:59 +00:00
16ca87923d fix(core): update 2020-05-14 12:56:58 +00:00
62676cf816 3.0.3 2018-08-08 22:35:02 +02:00
c88bb03e6c 3.0.2 2018-07-18 08:33:24 +02:00
98f9c51613 fix(dependencies): update 2018-07-18 08:33:23 +02:00
a0b237ca8c 3.0.1 2018-07-17 23:23:08 +02:00
4a7139b6f8 fix(core): update 2018-07-17 23:23:07 +02:00
48f9249313 3.0.0 2018-07-17 23:12:12 +02:00
278eda4869 BREAKING CHANGE(package): update scope and build standards 2018-07-17 23:12:12 +02:00
ce99e04b45 2.1.1 2017-04-23 20:59:33 +02:00
c0a1e0a14f update ci and docs 2017-04-23 20:59:28 +02:00
83392d18f6 2.1.0 2017-04-23 20:57:13 +02:00
270cb2533e now has better hrtMeasurement 2017-04-23 20:57:01 +02:00
fad367ca0b now has hrtime Measurement 2017-04-23 18:46:13 +02:00
836f8d18b0 2.0.38 2017-03-26 22:04:39 +02:00
ce269ae337 update npmextra.json 2017-03-26 22:04:32 +02:00
727d26fae4 2.0.37 2017-03-26 22:02:21 +02:00
0f2b71ebc3 add new ci 2017-03-26 22:02:18 +02:00
638c1a8c8c now testing properly 2017-03-26 22:01:33 +02:00
c54644949e 2.0.36 2017-02-17 18:57:06 +01:00
53c26d4634 clean up and update deps 2017-02-17 18:56:58 +01:00
e3b1ec0633 improve README 2017-02-03 15:15:36 +01:00
1892bd6df1 2.0.35 2016-09-19 20:50:09 +02:00
20bdf70686 Update description 2016-09-19 20:50:01 +02:00
7787330d63 2.0.34 2016-09-19 20:48:23 +02:00
67c3efdd59 improve README 2016-09-19 20:48:11 +02:00
7655ba749a 2.0.33 2016-09-19 00:44:12 +02:00
0a089b6f10 removed unnecessary import 2016-09-19 00:43:58 +02:00
29bf694db6 2.0.32 2016-09-19 00:34:50 +02:00
019d8deadd update 2016-09-19 00:34:45 +02:00
bfef45cab3 update 2016-09-19 00:34:38 +02:00
eddc64b891 2.0.31 2016-09-18 23:45:00 +02:00
e47df19015 fix 2016-09-18 23:44:56 +02:00
af96ab531b add bithoundrc 2016-09-18 23:22:55 +02:00
b96206e8f7 2.0.30 2016-09-18 23:13:03 +02:00
f96bfc0875 improve README 2016-09-18 23:12:58 +02:00
62f3dbabda 2.0.29 2016-09-18 23:11:34 +02:00
5486e268ed prevent segmentation fault error by directly communicating with process 2016-09-18 23:11:26 +02:00
6d61043379 2.0.28 2016-09-15 14:59:33 +02:00
ac92f355d4 now passing required loading time through promise 2016-09-15 14:59:22 +02:00
140bfb4f5e 2.0.27 2016-09-15 14:46:02 +02:00
4ed87cac7e now adhering to standardjs 2016-09-15 14:45:58 +02:00
d2182a6d0f 2.0.26 2016-08-21 17:29:46 +02:00
b7e48313e1 improve typings 2016-08-21 17:29:38 +02:00
9f8e30526f 2.0.25 2016-08-20 09:09:07 +02:00
8dd5c97f3b finally fixed Segmentation error caused by readline in child process 2016-08-20 09:09:03 +02:00
58b6a9a328 2.0.24 2016-08-20 08:42:42 +02:00
1c4020824d switch from process.hrtime() to Date.now() 2016-08-20 08:42:39 +02:00
521e5740e5 2.0.23 2016-08-20 08:29:25 +02:00
ce76702d53 make it even more foolproof 2016-08-20 08:29:18 +02:00
4590c8f64e 2.0.22 2016-08-20 08:06:47 +02:00
ab7155f198 fix 2016-08-20 08:06:41 +02:00
feba451f90 2.0.21 2016-08-20 07:51:41 +02:00
1ba1b0447b fixed CI console output 2016-08-20 07:51:04 +02:00
e4db3ba7ee 2.0.20 2016-08-20 07:46:42 +02:00
da209ecc06 2.0.19 2016-08-20 07:42:04 +02:00
e010b01c42 fixed error 2016-08-20 07:41:56 +02:00
225c46a788 2.0.18 2016-08-20 07:32:48 +02:00
7883f1cb7d add npmextra.json 2016-08-20 07:32:44 +02:00
394dd88a1d 2.0.17 2016-08-20 07:29:30 +02:00
1d8fee1506 fixed small error 2016-08-20 07:29:27 +02:00
88d5409c40 2.0.16 2016-08-20 07:15:55 +02:00
b8c9508d21 try catch for execution time 2016-08-20 07:15:52 +02:00
59f97c3254 2.0.15 2016-08-20 07:12:24 +02:00
0491493b2e fixed typo 2016-08-20 07:12:19 +02:00
aca45165f8 2.0.14 2016-08-20 07:04:03 +02:00
569c597f8b improved early and added loading time 2016-08-20 07:03:49 +02:00
5f17ea48ed 2.0.13 2016-06-12 00:42:24 +02:00
6a9cdd297a fix 2016-06-12 00:42:04 +02:00
0a363b441c 2.0.12 2016-06-12 00:38:17 +02:00
3af6edd5e6 move new line to main process 2016-06-12 00:38:11 +02:00
9a26f1367d 2.0.11 2016-06-12 00:30:14 +02:00
15dd17e7a7 now inserting new line 2016-06-12 00:30:10 +02:00
3b704dbde5 2.0.10 2016-06-12 00:12:46 +02:00
48aeb16dfd fix some readline closing issue 2016-06-12 00:12:40 +02:00
b40d8452ec 2.0.9 2016-06-11 23:53:55 +02:00
d8281f098a fix promise for CI 2016-06-11 23:53:48 +02:00
3ffee9d0d6 2.0.8 2016-06-11 23:47:57 +02:00
03dfdda812 now removing readline correcctly 2016-06-11 23:47:52 +02:00
24cce5d9b2 2.0.7 2016-06-10 06:08:06 +02:00
295e568097 now preventing async readline clutter 2016-06-10 06:08:03 +02:00
846bcf66db 2.0.6 2016-06-10 05:59:24 +02:00
fc7d7fd27f now clearing correctly 2016-06-10 05:59:21 +02:00
9829c7bb1e 2.0.5 2016-06-10 05:43:39 +02:00
6827999cf8 fix another issue 2016-06-10 05:43:27 +02:00
b318fa2076 2.0.4 2016-06-10 05:36:09 +02:00
0c751e1bca fix CI issue 2016-06-10 05:36:06 +02:00
cb489552f2 2.0.3 2016-06-10 05:21:47 +02:00
addd66091f fix gitlab ci base image 2016-06-10 05:21:44 +02:00
c2f8199f0b 2.0.2 2016-06-10 05:18:07 +02:00
5e5696cce1 now paying respect to commandline 2016-06-10 05:18:03 +02:00
44d9782487 update project to use gitlab-ci 2016-05-30 05:58:56 +02:00
41592a4d2f 2.0.1 2016-05-23 05:17:07 +02:00
23367249ec update REAMDE 2016-05-23 05:17:02 +02:00
b415bf4ee7 2.0.0 2016-05-23 05:16:05 +02:00
86b6a6c3c4 update README 2016-05-23 05:15:58 +02:00
ffbfc29628 1.0.12 2016-05-23 05:11:10 +02:00
9c6e452801 another small fix 2016-05-23 05:11:03 +02:00
96c421e96e 1.0.11 2016-05-23 05:02:58 +02:00
84af99ba80 fixed CI detection in child process 2016-05-23 05:02:49 +02:00
6bb20dbc7b 1.0.10 2016-05-23 04:58:02 +02:00
66a7fc2afe small log fix 2016-05-23 04:57:41 +02:00
a42faf36d2 1.0.9 2016-05-23 04:51:50 +02:00
6db7cc0e14 fix path 2016-05-23 04:51:45 +02:00
102d384de5 1.0.8 2016-05-23 04:40:09 +02:00
1ceae01a49 now forking a seperate process to work when node is busy 2016-05-23 04:40:04 +02:00
7f4adbfe9f 1.0.7 2016-05-22 01:00:18 +02:00
eb72e2dccc add typings tag to package.json 2016-05-22 00:59:12 +02:00
839c80f5dd 1.0.6 2016-05-22 00:50:08 +02:00
e7e96972ad add npmts.json 2016-05-22 00:49:54 +02:00
799c2a58ca 1.0.5 2016-05-22 00:43:59 +02:00
1955dadba3 small fix 2016-05-22 00:43:54 +02:00
c14fadadf7 1.0.4 2016-05-22 00:38:28 +02:00
3f1a05d3e0 now working with CI 2016-05-22 00:38:14 +02:00
5908dc8b6f 1.0.3 2016-05-21 20:35:17 +02:00
d7ecf8e320 add travis 2016-05-21 20:35:14 +02:00
19 changed files with 18847 additions and 161 deletions

22
.gitignore vendored
View File

@ -1,4 +1,20 @@
node_modules/ .nogit/
docs/
# artifacts
coverage/ coverage/
ts/typings/ public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom

125
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,125 @@
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: '$CI_BUILD_STAGE'
stages:
- security
- test
- release
- metadata
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
audit:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high
tags:
- docker
# ====================
# test stage
# ====================
testStable:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- lossless
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

29
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

View File

@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2016 Push.Rocks Copyright (c) 2016 Lossless GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,12 +0,0 @@
# early
nice module loading animation for modules that need a little starting time.
> **note: this package is NOT READY YET**
```typscript
import * as early from "early";
early.start();
// do your loading stuff
early.stop();
```

2
dist/index.d.ts vendored
View File

@ -1,2 +0,0 @@
export declare let start: (moduleNameArg: string, loaderLengthArg?: number) => void;
export declare let stop: () => void;

51
dist/index.js vendored
View File

@ -1,51 +0,0 @@
"use strict";
/// <reference path="./typings/index.d.ts" />
var colors = require("colors");
var readline = require("readline");
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
var moduleName;
var loaderLength;
var frameCounter = 0;
var makeFrame = function () {
var resultString = "["
+ "/".green.repeat(frameCounter)
+ " ".repeat(loaderLength - frameCounter)
+ "]"
+ " starting "
+ moduleName.cyan;
if (frameCounter == loaderLength) {
frameCounter = 0;
}
else {
frameCounter++;
}
return resultString;
};
var abort = true;
var logEarly = function () {
rl.write(null, { ctrl: true, name: 'u' });
rl.write(makeFrame());
setTimeout(function () {
if (!abort) {
logEarly();
}
}, 200);
};
// exports
exports.start = function (moduleNameArg, loaderLengthArg) {
if (loaderLengthArg === void 0) { loaderLengthArg = 10; }
abort = false;
moduleName = moduleNameArg;
loaderLength = loaderLengthArg;
logEarly();
};
exports.stop = function () {
abort = true;
rl.write(null, { ctrl: true, name: 'u' });
rl.close();
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSw2Q0FBNkM7QUFDN0MsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0FBQy9CLElBQUksUUFBUSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQztBQUVuQyxJQUFNLEVBQUUsR0FBRyxRQUFRLENBQUMsZUFBZSxDQUFDO0lBQ2xDLEtBQUssRUFBRSxPQUFPLENBQUMsS0FBSztJQUNwQixNQUFNLEVBQUUsT0FBTyxDQUFDLE1BQU07Q0FDdkIsQ0FBQyxDQUFDO0FBRUgsSUFBSSxVQUFpQixDQUFDO0FBQ3RCLElBQUksWUFBbUIsQ0FBQztBQUN4QixJQUFJLFlBQVksR0FBVSxDQUFDLENBQUM7QUFFNUIsSUFBSSxTQUFTLEdBQUc7SUFDWixJQUFJLFlBQVksR0FBVSxHQUFHO1VBQ3ZCLEdBQUcsQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLFlBQVksQ0FBQztVQUM5QixHQUFHLENBQUMsTUFBTSxDQUFDLFlBQVksR0FBRyxZQUFZLENBQUM7VUFDdkMsR0FBRztVQUNILFlBQVk7VUFDWixVQUFVLENBQUMsSUFBSSxDQUFDO0lBRXRCLEVBQUUsQ0FBQSxDQUFDLFlBQVksSUFBSSxZQUFZLENBQUMsQ0FBQSxDQUFDO1FBQzdCLFlBQVksR0FBRyxD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ydWU7XHJcbmxldCBsb2dFYXJseSA9ICgpID0+IHtcclxuICAgIHJsLndyaXRlKG51bGwsIHtjdHJsOiB0cnVlLCBuYW1lOiAndSd9KTtcclxuICAgIHJsLndyaXRlKG1ha2VGcmFtZSgpKTtcclxuICAgIHNldFRpbWVvdXQoZnVuY3Rpb24oKXtcclxuICAgICAgICBpZighYWJvcnQpe1xyXG4gICAgICAgICAgICBsb2dFYXJseSgpO1xyXG4gICAgICAgIH1cclxuICAgIH0sMjAwKTtcclxufTtcclxuXHJcblxyXG4vLyBleHBvcnRzXHJcbmV4cG9ydCBsZXQgc3RhcnQgPSBmdW5jdGlvbihtb2R1bGVOYW1lQXJnOnN0cmluZyxsb2FkZXJMZW5ndGhBcmc6bnVtYmVyID0gMTApe1xyXG4gICAgYWJvcnQgPSBmYWxzZTtcclxuICAgIG1vZHVsZU5hbWUgPSBtb2R1bGVOYW1lQXJnO1xyXG4gICAgbG9hZGVyTGVuZ3RoID0gbG9hZGVyTGVuZ3RoQXJnO1xyXG4gICAgbG9nRWFybHkoKTtcclxufTtcclxuXHJcbmV4cG9ydCBsZXQgc3RvcCA9IGZ1bmN0aW9uKCl7XHJcbiAgICBhYm9ydCA9IHRydWU7XHJcbiAgICBybC53cml0ZShudWxsLCB7Y3RybDogdHJ1ZSwgbmFtZTogJ3UnfSk7XHJcbiAgICBybC5jbG9zZSgpO1xyXG59O1xyXG5cclxuIl19

17
npmextra.json Normal file
View File

@ -0,0 +1,17 @@
{
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "early",
"shortDescription": "minimal and fast loading plugin for startup time measuring",
"npmPackagename": "@pushrocks/early",
"license": "MIT"
}
}
}

18433
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,18 @@
{ {
"name": "early", "name": "@pushrocks/early",
"version": "1.0.2", "version": "3.0.7",
"description": "nice module loading animation for modules that need a little starting time.", "private": false,
"main": "dist/index.js", "description": "minimal and fast loading plugin for startup time measuring",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
"scripts": { "scripts": {
"test": "(npmts)" "test": "(tstest test/)",
"build": "(tsbuild --web)"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/pushrocks/early.git" "url": "git+https://gitlab.com/pushrocks/early.git"
}, },
"keywords": [ "keywords": [
"preloader" "preloader"
@ -16,13 +20,33 @@
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https://github.com/pushrocks/early/issues" "url": "https://gitlab.com/pushrocks/early/issues"
}, },
"homepage": "https://github.com/pushrocks/early#readme", "homepage": "https://gitlab.com/pushrocks/early#readme",
"devDependencies": { "devDependencies": {
"npmts": "^5.1.9" "@gitzone/tsrun": "^1.2.31",
"@gitzone/tstest": "^1.0.69",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/tapbundle": "^5.0.2"
}, },
"dependencies": { "dependencies": {
"colors": "^1.1.2" "@gitzone/tsbuild": "^2.1.60",
} "@pushrocks/consolecolor": "^2.0.1",
"@pushrocks/smartpromise": "^3.1.7"
},
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
} }

51
readme.md Normal file
View File

@ -0,0 +1,51 @@
# @pushrocks/early
minimal and fast loading plugin for startup time measuring
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/early)
* [gitlab.com (source)](https://gitlab.com/pushrocks/early)
* [github.com (source mirror)](https://github.com/pushrocks/early)
* [docs (typedoc)](https://pushrocks.gitlab.io/early/)
## Status for master
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/early/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/early/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/early)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/early)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/early)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/early)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/early)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage
Use TypeScript for best in class instellisense.
```javascript
// Put the following at the start of your module
import * as early from 'early';
early.start('myModuleName');
/*
do your loading stuff
*/
early.stop().then((loadingTime: number) => {
// loadingTime in milliseconds
}); // stop "early" when your module is ready
```
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
For further information read the linked docs at the top of this readme.
> MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

0
test/test.d.ts vendored
View File

View File

@ -1,15 +0,0 @@
"use strict";
/// <reference path="../ts/typings/index.d.ts" />
var early = require("../dist/index.js");
describe("early", function () {
it(".start()", function (done) {
this.timeout(10000);
early.start("early");
setTimeout(done, 5000);
});
it(".stop()", function () {
early.stop();
});
});
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLGlEQUFpRDtBQUNqRCxJQUFPLEtBQUssV0FBVyxrQkFBa0IsQ0FBQyxDQUFDO0FBRTNDLFFBQVEsQ0FBQyxPQUFPLEVBQUM7SUFDYixFQUFFLENBQUMsVUFBVSxFQUFDLFVBQVMsSUFBSTtRQUN2QixJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBQ3BCLEtBQUssQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDckIsVUFBVSxDQUFDLElBQUksRUFBQyxJQUFJLENBQUMsQ0FBQztJQUMxQixDQUFDLENBQUMsQ0FBQztJQUNILEVBQUUsQ0FBQyxTQUFTLEVBQUM7UUFDVCxLQUFLLENBQUMsSUFBSSxFQUFFLENBQUM7SUFDakIsQ0FBQyxDQUFDLENBQUE7QUFDTixDQUFDLENBQUMsQ0FBQSIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvaW5kZXguZC50c1wiIC8+XHJcbmltcG9ydCBlYXJseSA9IHJlcXVpcmUoXCIuLi9kaXN0L2luZGV4LmpzXCIpO1xyXG5cclxuZGVzY3JpYmUoXCJlYXJseVwiLGZ1bmN0aW9uKCl7XHJcbiAgICBpdChcIi5zdGFydCgpXCIsZnVuY3Rpb24oZG9uZSl7XHJcbiAgICAgICAgdGhpcy50aW1lb3V0KDEwMDAwKTtcclxuICAgICAgICBlYXJseS5zdGFydChcImVhcmx5XCIpO1xyXG4gICAgICAgIHNldFRpbWVvdXQoZG9uZSw1MDAwKTtcclxuICAgIH0pO1xyXG4gICAgaXQoXCIuc3RvcCgpXCIsZnVuY3Rpb24oKXtcclxuICAgICAgICBlYXJseS5zdG9wKCk7XHJcbiAgICB9KVxyXG59KSJdfQ==

View File

@ -1,13 +1,25 @@
/// <reference path="../ts/typings/index.d.ts" /> import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import early = require("../dist/index.js"); import * as smartdelay from '@pushrocks/smartdelay';
describe("early",function(){ import * as early from '../ts/index.js'
it(".start()",function(done){
this.timeout(10000); tap.test('.start()', async () => {
early.start("early"); process.env.CLI_CALL_MODULENAME = 'early';
setTimeout(done,5000); early.start('early');
}); await smartdelay.delayFor(2000);
it(".stop()",function(){ });
early.stop();
}) tap.test('.stop()', async () => {
}) await early.stop();
});
tap.test('hrTime Measurement', async () => {
let earlyHr = new early.HrtMeasurement();
earlyHr.start();
await smartdelay.delayFor(1000);
let measuredTime = earlyHr.stop();
console.log(measuredTime);
return expect(measuredTime.milliSeconds).toBeGreaterThan(999);
});
tap.start();

View File

@ -0,0 +1,45 @@
import * as process from 'process';
/**
* easy high resolution time measurement
*/
export class HrtMeasurement {
nanoSeconds: number = null;
milliSeconds: number = null;
private _hrTimeStart = null;
private _hrTimeStopDiff = null;
private _started: boolean = false;
/**
* start the measurement
*/
start() {
this._started = true;
this._hrTimeStart = process.hrtime();
}
/**
* stop the measurement
*/
stop() {
if (this._started === false) {
console.log("Hasn't started yet");
return;
}
this._hrTimeStopDiff = process.hrtime(this._hrTimeStart);
this.nanoSeconds = this._hrTimeStopDiff[0] * 1e9 + this._hrTimeStopDiff[1];
this.milliSeconds = this.nanoSeconds / 1000000;
return this;
}
/**
* reset the measurement
*/
reset() {
this.nanoSeconds = null;
this.milliSeconds = null;
this._hrTimeStart = null;
this._hrTimeStopDiff = null;
this._started = false;
}
}

View File

@ -1,55 +1,42 @@
/// <reference path="./typings/index.d.ts" /> import * as consolecolor from '@pushrocks/consolecolor';
let colors = require("colors"); import * as smartpromise from '@pushrocks/smartpromise';
let readline = require("readline"); import { HrtMeasurement } from './early.hrtMeasurement.js';
const rl = readline.createInterface({ export { HrtMeasurement };
input: process.stdin,
output: process.stdout
});
let moduleName:string; let doText: boolean = false;
let loaderLength:number; let moduleName: string = 'undefined module name';
let frameCounter:number = 0; let startHrt: HrtMeasurement;
let makeFrame = ():string => { if (process.argv.indexOf('-v') === -1) {
let resultString:string = "[" doText = true;
+ "/".green.repeat(frameCounter) }
+ " ".repeat(loaderLength - frameCounter)
+ "]"
+ " starting "
+ moduleName.cyan;
if(frameCounter == loaderLength){ /**
frameCounter = 0; * start the loading
} else { */
frameCounter++; export let start = function (moduleNameArg: string = '', loaderLengthArg: string = '10') {
}
return resultString;
};
let abort:boolean = true;
let logEarly = () => {
rl.write(null, {ctrl: true, name: 'u'});
rl.write(makeFrame());
setTimeout(function(){
if(!abort){
logEarly();
}
},200);
};
// exports
export let start = function(moduleNameArg:string,loaderLengthArg:number = 10){
abort = false;
moduleName = moduleNameArg; moduleName = moduleNameArg;
loaderLength = loaderLengthArg; startHrt = new HrtMeasurement();
logEarly(); startHrt.start();
if (doText && process.env.CLI_CALL_MODULENAME === moduleName) {
console.log(`**** starting ${consolecolor.coloredString(moduleNameArg, 'green')} ****`);
}
}; };
export let stop = function(){ export let stop = (): Promise<number> => {
abort = true; let done = smartpromise.defer<number>();
rl.write(null, {ctrl: true, name: 'u'}); let earlyExecutionTime = startHrt.stop().milliSeconds;
rl.close(); let earlyExecutionTimeString: string = (earlyExecutionTime / 1000).toString();
}; if (doText && process.env.CLI_CALL_MODULENAME === moduleName) {
console.log(
`OK! -> finished loading within ${consolecolor.coloredString(
earlyExecutionTimeString,
'blue'
)}`
);
}
done.resolve(earlyExecutionTime);
return done.promise;
};

View File

@ -1,6 +0,0 @@
{
"globalDependencies": {
"colors": "registry:dt/colors#0.6.0-1+20160501135139",
"node": "registry:dt/node#6.0.0+20160514165920"
}
}

7
tsconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext"
}
}