tnp-core 19.0.20 → 19.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -20
- package/browser/README.md +24 -24
- package/browser/fesm2022/tnp-core.mjs +107 -25
- package/browser/fesm2022/tnp-core.mjs.map +1 -1
- package/browser/lib/helpers.d.ts +9 -2
- package/browser/package.json +1 -1
- package/cli.backend.js +2 -2
- package/cli.backend.js.map +1 -1
- package/client/README.md +24 -24
- package/client/fesm2022/tnp-core.mjs +107 -25
- package/client/fesm2022/tnp-core.mjs.map +1 -1
- package/client/lib/helpers.d.ts +9 -2
- package/client/package.json +1 -1
- package/index.js.map +1 -1
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/command-exists.js.map +1 -1
- package/lib/core-cli.js.map +1 -1
- package/lib/core-config.js.map +1 -1
- package/lib/core-imports.js.map +1 -1
- package/lib/core-models.js.map +1 -1
- package/lib/framework-name.js.map +1 -1
- package/lib/helpers-isomorphic.js.map +1 -1
- package/lib/helpers-messages.js.map +1 -1
- package/lib/helpers.d.ts +8 -2
- package/lib/helpers.js +93 -9
- package/lib/helpers.js.map +1 -1
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/node-chalk-mock.js +2 -2
- package/lib/node-chalk-mock.js.map +1 -1
- package/lib/node-path-mock.js +2 -2
- package/lib/node-path-mock.js.map +1 -1
- package/lib/progress-data.js.map +1 -1
- package/lib/public-api.js.map +1 -1
- package/lib/required-global-npm-packages.js.map +1 -1
- package/lib/utils.js.map +1 -1
- package/migrations/index.js.map +1 -1
- package/migrations/migrations_index._auto-generated_.js.map +1 -1
- package/package.json +1 -1
- package/tmp-environment.json +3 -3
- package/websql/README.md +24 -24
- package/websql/fesm2022/tnp-core.mjs +107 -25
- package/websql/fesm2022/tnp-core.mjs.map +1 -1
- package/websql/lib/helpers.d.ts +9 -2
- package/websql/package.json +1 -1
- package/lib/required.d.ts +0 -44
- package/lib/required.js +0 -76
- package/lib/required.js.map +0 -1
package/README.md
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
# taon-core ( tnp-core )
|
2
|
-
|
3
|
-
- Part of [taon.dev](https://github.com/darekf77/taon)
|
4
|
-
- JavasScript/Typescript most essential helpers
|
5
|
-
- Basic taon releated helpers
|
6
|
-
- Purpose:
|
7
|
-
+ lightweight most essential helpers library
|
8
|
-
+ crossplatform helpers for NodeJs/Browser
|
9
|
-
|
10
|
-
|
11
|
-
## Usage
|
12
|
-
- in taon isomorphic libs/apps or any NodeJS apps/libs:
|
13
|
-
```ts
|
14
|
-
import { Helpers } from 'tnp-core';
|
15
|
-
```
|
16
|
-
|
17
|
-
- in any frontend browser apps (except taon libs/apps)
|
18
|
-
```ts
|
19
|
-
import { Helpers } from 'tnp-core/browser';
|
20
|
-
```
|
1
|
+
# taon-core ( tnp-core )
|
2
|
+
|
3
|
+
- Part of [taon.dev](https://github.com/darekf77/taon)
|
4
|
+
- JavasScript/Typescript most essential helpers
|
5
|
+
- Basic taon releated helpers
|
6
|
+
- Purpose:
|
7
|
+
+ lightweight most essential helpers library
|
8
|
+
+ crossplatform helpers for NodeJs/Browser
|
9
|
+
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
- in taon isomorphic libs/apps or any NodeJS apps/libs:
|
13
|
+
```ts
|
14
|
+
import { Helpers } from 'tnp-core';
|
15
|
+
```
|
16
|
+
|
17
|
+
- in any frontend browser apps (except taon libs/apps)
|
18
|
+
```ts
|
19
|
+
import { Helpers } from 'tnp-core/browser';
|
20
|
+
```
|
package/browser/README.md
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
# MyLib
|
2
|
-
|
3
|
-
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
|
4
|
-
|
5
|
-
## Code scaffolding
|
6
|
-
|
7
|
-
Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
|
8
|
-
> Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
|
9
|
-
|
10
|
-
## Build
|
11
|
-
|
12
|
-
Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
|
13
|
-
|
14
|
-
## Publishing
|
15
|
-
|
16
|
-
After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
|
17
|
-
|
18
|
-
## Running unit tests
|
19
|
-
|
20
|
-
Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
21
|
-
|
22
|
-
## Further help
|
23
|
-
|
24
|
-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
1
|
+
# MyLib
|
2
|
+
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
|
4
|
+
|
5
|
+
## Code scaffolding
|
6
|
+
|
7
|
+
Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
|
8
|
+
> Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
|
9
|
+
|
10
|
+
## Build
|
11
|
+
|
12
|
+
Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
|
13
|
+
|
14
|
+
## Publishing
|
15
|
+
|
16
|
+
After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
|
17
|
+
|
18
|
+
## Running unit tests
|
19
|
+
|
20
|
+
Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
21
|
+
|
22
|
+
## Further help
|
23
|
+
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
@@ -9,8 +9,8 @@ import * as dateformat from 'dateformat';
|
|
9
9
|
export { dateformat };
|
10
10
|
import * as json5 from 'json5';
|
11
11
|
export { json5 };
|
12
|
+
import { Blob } from 'buffer';
|
12
13
|
import { Subject } from 'rxjs';
|
13
|
-
import { Blob as Blob$1 } from 'buffer';
|
14
14
|
import axios from 'axios';
|
15
15
|
|
16
16
|
let isBrowser = false;
|
@@ -1255,7 +1255,7 @@ var Utils;
|
|
1255
1255
|
*/
|
1256
1256
|
async function arrayBufferToBlob(buffer, contentType) {
|
1257
1257
|
// @ts-ignore
|
1258
|
-
return new Blob
|
1258
|
+
return new Blob([buffer], { type: contentType });
|
1259
1259
|
}
|
1260
1260
|
binary.arrayBufferToBlob = arrayBufferToBlob;
|
1261
1261
|
//#endregion
|
@@ -1329,7 +1329,7 @@ var Utils;
|
|
1329
1329
|
}
|
1330
1330
|
byteArrays[sliceIndex] = new Uint8Array(bytes);
|
1331
1331
|
}
|
1332
|
-
return new Blob
|
1332
|
+
return new Blob(byteArrays, { type: content_type });
|
1333
1333
|
}
|
1334
1334
|
binary.base64toBlob = base64toBlob;
|
1335
1335
|
//#endregion
|
@@ -1438,7 +1438,7 @@ var Utils;
|
|
1438
1438
|
//#endregion
|
1439
1439
|
//#region binay utils / file to blob
|
1440
1440
|
async function fileToBlob(file) {
|
1441
|
-
return new Blob
|
1441
|
+
return new Blob([new Uint8Array(await file.arrayBuffer())], {
|
1442
1442
|
type: file.type,
|
1443
1443
|
});
|
1444
1444
|
}
|
@@ -1490,7 +1490,7 @@ var Utils;
|
|
1490
1490
|
//#endregion
|
1491
1491
|
//#region binay utils / text to blob
|
1492
1492
|
async function textToBlob(text, type = 'text/plain') {
|
1493
|
-
const blob = new Blob
|
1493
|
+
const blob = new Blob([text], { type });
|
1494
1494
|
return blob;
|
1495
1495
|
}
|
1496
1496
|
binary.textToBlob = textToBlob;
|
@@ -1506,7 +1506,7 @@ var Utils;
|
|
1506
1506
|
// console.log({ path })
|
1507
1507
|
const ext = path.extname(fileRelativePathOrName);
|
1508
1508
|
const type = CoreModels.mimeTypes[ext];
|
1509
|
-
const blob = new Blob
|
1509
|
+
const blob = new Blob([text], { type });
|
1510
1510
|
const file = await blobToFile(blob, fileRelativePathOrName);
|
1511
1511
|
// console.log({
|
1512
1512
|
// ext,
|
@@ -1525,7 +1525,7 @@ var Utils;
|
|
1525
1525
|
//#endregion
|
1526
1526
|
//#region binay utils / json to blob
|
1527
1527
|
async function jsonToBlob(jsonObj) {
|
1528
|
-
const blob = new Blob
|
1528
|
+
const blob = new Blob([JSON.stringify(jsonObj, null, 2)], {
|
1529
1529
|
type: 'application/json',
|
1530
1530
|
});
|
1531
1531
|
return blob;
|
@@ -3737,24 +3737,6 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
3737
3737
|
}
|
3738
3738
|
|
3739
3739
|
//#region import
|
3740
|
-
/* */
|
3741
|
-
/* */
|
3742
|
-
/* */
|
3743
|
-
/* */
|
3744
|
-
/* */
|
3745
|
-
/* */
|
3746
|
-
/* */
|
3747
|
-
/* */
|
3748
|
-
/* */
|
3749
|
-
/* */
|
3750
|
-
/* */
|
3751
|
-
/* */
|
3752
|
-
/* */
|
3753
|
-
/* */
|
3754
|
-
/* */
|
3755
|
-
/* */
|
3756
|
-
/* */
|
3757
|
-
//#region @browser
|
3758
3740
|
const encoding = 'utf8';
|
3759
3741
|
/* */
|
3760
3742
|
/* */
|
@@ -3844,6 +3826,7 @@ class HelpersCore extends HelpersMessages {
|
|
3844
3826
|
* get electron browser ipc renderer
|
3845
3827
|
*/
|
3846
3828
|
get ipcRenderer() {
|
3829
|
+
// typeof ipcRenderer
|
3847
3830
|
/* */
|
3848
3831
|
/* */
|
3849
3832
|
//#region @browser
|
@@ -3861,6 +3844,7 @@ class HelpersCore extends HelpersMessages {
|
|
3861
3844
|
* get electron web frame
|
3862
3845
|
*/
|
3863
3846
|
get webFrame() {
|
3847
|
+
// typeof webFrame
|
3864
3848
|
//typeof webFrame
|
3865
3849
|
/* */
|
3866
3850
|
/* */
|
@@ -4063,6 +4047,104 @@ class HelpersCore extends HelpersMessages {
|
|
4063
4047
|
}
|
4064
4048
|
//#endregion
|
4065
4049
|
//#region methods / remove file or folder
|
4050
|
+
removeSymlinks(dirPath, options) {
|
4051
|
+
/* */
|
4052
|
+
/* */
|
4053
|
+
/* */
|
4054
|
+
/* */
|
4055
|
+
/* */
|
4056
|
+
/* */
|
4057
|
+
/* */
|
4058
|
+
/* */
|
4059
|
+
/* */
|
4060
|
+
/* */
|
4061
|
+
/* */
|
4062
|
+
/* */
|
4063
|
+
/* */
|
4064
|
+
/* */
|
4065
|
+
/* */
|
4066
|
+
/* */
|
4067
|
+
/* */
|
4068
|
+
/* */
|
4069
|
+
/* */
|
4070
|
+
/* */
|
4071
|
+
/* */
|
4072
|
+
/* */
|
4073
|
+
/* */
|
4074
|
+
/* */
|
4075
|
+
/* */
|
4076
|
+
/* */
|
4077
|
+
/* */
|
4078
|
+
/* */
|
4079
|
+
/* */
|
4080
|
+
/* */
|
4081
|
+
/* */
|
4082
|
+
/* */
|
4083
|
+
/* */
|
4084
|
+
/* */
|
4085
|
+
/* */
|
4086
|
+
/* */
|
4087
|
+
/* */
|
4088
|
+
/* */
|
4089
|
+
/* */
|
4090
|
+
/* */
|
4091
|
+
/* */
|
4092
|
+
/* */
|
4093
|
+
/* */
|
4094
|
+
/* */
|
4095
|
+
/* */
|
4096
|
+
/* */
|
4097
|
+
/* */
|
4098
|
+
/* */
|
4099
|
+
/* */
|
4100
|
+
/* */
|
4101
|
+
/* */
|
4102
|
+
/* */
|
4103
|
+
/* */
|
4104
|
+
/* */
|
4105
|
+
/* */
|
4106
|
+
/* */
|
4107
|
+
/* */
|
4108
|
+
/* */
|
4109
|
+
/* */
|
4110
|
+
/* */
|
4111
|
+
/* */
|
4112
|
+
return (void 0);
|
4113
|
+
}
|
4114
|
+
// /**
|
4115
|
+
// * TODO replacement for remove/rimraf.sync
|
4116
|
+
// * save remove file or folder
|
4117
|
+
// */
|
4118
|
+
// safeRemove(
|
4119
|
+
// targetPath: string,
|
4120
|
+
// options?: {
|
4121
|
+
// // usePattern?: boolean;
|
4122
|
+
// },
|
4123
|
+
// ): void {
|
4124
|
+
// targetPath = crossPlatformPath(targetPath);
|
4125
|
+
// try {
|
4126
|
+
// const stats = fse.lstatSync(targetPath);
|
4127
|
+
// if (stats.isSymbolicLink()) {
|
4128
|
+
// // Remove the symlink without following it
|
4129
|
+
// fse.unlinkSync(targetPath);
|
4130
|
+
// } else if (stats.isDirectory()) {
|
4131
|
+
// // Recursively remove directory contents
|
4132
|
+
// const entries = fse.readdirSync(targetPath);
|
4133
|
+
// for (const entry of entries) {
|
4134
|
+
// this.safeRemove(crossPlatformPath([targetPath, entry]), options);
|
4135
|
+
// }
|
4136
|
+
// fse.rmdirSync(targetPath);
|
4137
|
+
// } else {
|
4138
|
+
// // Remove file
|
4139
|
+
// fse.unlinkSync(targetPath);
|
4140
|
+
// }
|
4141
|
+
// } catch (err) {
|
4142
|
+
// console.error(`Error removing ${targetPath}:`, err);
|
4143
|
+
// }
|
4144
|
+
// }
|
4145
|
+
/**
|
4146
|
+
* @deprecated use safeRemove
|
4147
|
+
*/
|
4066
4148
|
remove(fileOrFolderPathOrPatter, exactFolder = false) {
|
4067
4149
|
/* */
|
4068
4150
|
/* */
|