chayns-api 2.1.9-0 → 2.1.10
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/.babelrc +31 -31
- package/.eslintrc +17 -17
- package/.github/workflows/deploy_docs.yml +28 -28
- package/.github/workflows/publish.yml +21 -21
- package/LICENSE +21 -21
- package/README.md +67 -67
- package/dist/cjs/types/IChaynsReact.js +1 -0
- package/dist/cjs/util/deviceHelper.js +2 -0
- package/dist/esm/types/IChaynsReact.js +1 -0
- package/dist/esm/util/deviceHelper.js +2 -0
- package/dist/types/types/IChaynsReact.d.ts +2 -1
- package/package.json +81 -81
- package/toolkit.config.js +20 -20
- package/tsconfig.json +56 -56
package/.babelrc
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"esm": {
|
|
4
|
-
"presets": [
|
|
5
|
-
[
|
|
6
|
-
"@babel/preset-env",
|
|
7
|
-
{
|
|
8
|
-
"targets": ">0.5%, not dead, not op_mini all, chrome 71",
|
|
9
|
-
"modules": false
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"@babel/preset-react",
|
|
13
|
-
"@babel/preset-typescript"
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"cjs": {
|
|
17
|
-
"presets": [
|
|
18
|
-
[
|
|
19
|
-
"@babel/preset-env",
|
|
20
|
-
{
|
|
21
|
-
"targets": { "node": 12 },
|
|
22
|
-
"modules": "commonjs"
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
"@babel/preset-react",
|
|
26
|
-
"@babel/preset-typescript"
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"comments": false
|
|
31
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"esm": {
|
|
4
|
+
"presets": [
|
|
5
|
+
[
|
|
6
|
+
"@babel/preset-env",
|
|
7
|
+
{
|
|
8
|
+
"targets": ">0.5%, not dead, not op_mini all, chrome 71",
|
|
9
|
+
"modules": false
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"@babel/preset-react",
|
|
13
|
+
"@babel/preset-typescript"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"cjs": {
|
|
17
|
+
"presets": [
|
|
18
|
+
[
|
|
19
|
+
"@babel/preset-env",
|
|
20
|
+
{
|
|
21
|
+
"targets": { "node": 12 },
|
|
22
|
+
"modules": "commonjs"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"@babel/preset-react",
|
|
26
|
+
"@babel/preset-typescript"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"comments": false
|
|
31
|
+
}
|
package/.eslintrc
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@chayns-toolkit",
|
|
3
|
-
"rules": {
|
|
4
|
-
"no-void": "off",
|
|
5
|
-
"react/function-component-definition": [
|
|
6
|
-
"error",
|
|
7
|
-
{
|
|
8
|
-
"namedComponents": "arrow-function",
|
|
9
|
-
"unnamedComponents": "arrow-function"
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"@typescript-eslint/require-await": "off",
|
|
13
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
14
|
-
"class-methods-use-this": "off",
|
|
15
|
-
"react/jsx-props-no-spreading": "off"
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "@chayns-toolkit",
|
|
3
|
+
"rules": {
|
|
4
|
+
"no-void": "off",
|
|
5
|
+
"react/function-component-definition": [
|
|
6
|
+
"error",
|
|
7
|
+
{
|
|
8
|
+
"namedComponents": "arrow-function",
|
|
9
|
+
"unnamedComponents": "arrow-function"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"@typescript-eslint/require-await": "off",
|
|
13
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
14
|
+
"class-methods-use-this": "off",
|
|
15
|
+
"react/jsx-props-no-spreading": "off"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
name: Deploy Docs to GitHub Pages
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
paths:
|
|
6
|
-
- "website/**"
|
|
7
|
-
workflow_dispatch:
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
deploy:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- name: Checkout repo
|
|
14
|
-
uses: actions/checkout@v2
|
|
15
|
-
|
|
16
|
-
- name: Use Node 20
|
|
17
|
-
uses: actions/setup-node@v1
|
|
18
|
-
with:
|
|
19
|
-
node-version: 20
|
|
20
|
-
|
|
21
|
-
- name: Build
|
|
22
|
-
run: npm run build-docs
|
|
23
|
-
|
|
24
|
-
- name: Deploy to GitHub Pages
|
|
25
|
-
uses: peaceiris/actions-gh-pages@v3
|
|
26
|
-
with:
|
|
27
|
-
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
28
|
-
publish_dir: ./website/build
|
|
1
|
+
name: Deploy Docs to GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
paths:
|
|
6
|
+
- "website/**"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
deploy:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout repo
|
|
14
|
+
uses: actions/checkout@v2
|
|
15
|
+
|
|
16
|
+
- name: Use Node 20
|
|
17
|
+
uses: actions/setup-node@v1
|
|
18
|
+
with:
|
|
19
|
+
node-version: 20
|
|
20
|
+
|
|
21
|
+
- name: Build
|
|
22
|
+
run: npm run build-docs
|
|
23
|
+
|
|
24
|
+
- name: Deploy to GitHub Pages
|
|
25
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
26
|
+
with:
|
|
27
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
28
|
+
publish_dir: ./website/build
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
name: Publish to NPM
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
push:
|
|
6
|
-
tags:
|
|
7
|
-
- 'v*'
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v2
|
|
14
|
-
- uses: actions/setup-node@v1
|
|
15
|
-
with:
|
|
16
|
-
node-version: '14.21.1'
|
|
17
|
-
registry-url: https://registry.npmjs.org/
|
|
18
|
-
- run: npm install
|
|
19
|
-
- run: npm publish
|
|
20
|
-
env:
|
|
21
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
1
|
+
name: Publish to NPM
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
tags:
|
|
7
|
+
- 'v*'
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v2
|
|
14
|
+
- uses: actions/setup-node@v1
|
|
15
|
+
with:
|
|
16
|
+
node-version: '14.21.1'
|
|
17
|
+
registry-url: https://registry.npmjs.org/
|
|
18
|
+
- run: npm install
|
|
19
|
+
- run: npm publish
|
|
20
|
+
env:
|
|
21
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Tobit.Software
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Tobit.Software
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
# [chayns react api](https://github.com/TobitSoftware/chayns-api) · []() []() []()
|
|
2
|
-
|
|
3
|
-
The chayns-api provides information and useful functions to your page. The information and functions are provided by react hooks and normal functions.
|
|
4
|
-
A list of all functions and hooks can be found [here](https://tobitsoftware.github.io/chayns-api/docs).
|
|
5
|
-
|
|
6
|
-
## Installation
|
|
7
|
-
|
|
8
|
-
It is recommended to setup your new chayns page with the [create-chayns-app](https://github.com/TobitSoftware/create-chayns-app).
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Migrate old project
|
|
12
|
-
1. Install chayns-api package
|
|
13
|
-
```sh
|
|
14
|
-
# NPM
|
|
15
|
-
$ npm install chayns-api
|
|
16
|
-
|
|
17
|
-
# Yarn
|
|
18
|
-
$ yarn add chayns-api
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
2. Wrap your App component with the "ChaynsProvider" component. In all components which are under the ChaynsProvider you can use hooks and chayns functions.
|
|
22
|
-
```jsx
|
|
23
|
-
<ChaynsProvider>
|
|
24
|
-
<App/>
|
|
25
|
-
</ChaynsProvider>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Example
|
|
29
|
-
|
|
30
|
-
```jsx
|
|
31
|
-
import { useUser } from 'chayns-api';
|
|
32
|
-
|
|
33
|
-
const FirstName = () => {
|
|
34
|
-
const user = useUser();
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<div>{user?.firstName}</div>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Migrate v1 to v2
|
|
43
|
-
|
|
44
|
-
When updating to chayns-api@2 you should also update chayns-toolkit to 3.0.1 or higher (check migration guide [here](https://github.com/TobitSoftware/chayns-toolkit/tree/main?tab=readme-ov-file#-migration-v2-to-v3)).
|
|
45
|
-
|
|
46
|
-
Check urls referencing **remoteEntry.js**. The filename has been changed to **v2.remoteEntry.js**.
|
|
47
|
-
|
|
48
|
-
When your application uses ChaynsHost with module-type you might have to add a call of **initModuleFederationSharing** as early as possible in your application (e.g. index/bootstrap). Unless your application is already embedded as module somewhere else (e.g. in a dialog).
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
initModuleFederationSharing({ name: 'project_name' });
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
## Getting started
|
|
56
|
-
|
|
57
|
-
More information to setup chayns-api can be found in the [documentation](https://tobitsoftware.github.io/chayns-api/docs).
|
|
58
|
-
|
|
59
|
-
## Troubleshooting
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
Can't resolve 'react-dom/client'
|
|
63
|
-
```
|
|
64
|
-
A warning like above can be shown when you are still using react 17.
|
|
65
|
-
This can be ignored because the react 17 api is used as fallback instead.
|
|
66
|
-
|
|
67
|
-
## License
|
|
1
|
+
# [chayns react api](https://github.com/TobitSoftware/chayns-api) · []() []() []()
|
|
2
|
+
|
|
3
|
+
The chayns-api provides information and useful functions to your page. The information and functions are provided by react hooks and normal functions.
|
|
4
|
+
A list of all functions and hooks can be found [here](https://tobitsoftware.github.io/chayns-api/docs).
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
It is recommended to setup your new chayns page with the [create-chayns-app](https://github.com/TobitSoftware/create-chayns-app).
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Migrate old project
|
|
12
|
+
1. Install chayns-api package
|
|
13
|
+
```sh
|
|
14
|
+
# NPM
|
|
15
|
+
$ npm install chayns-api
|
|
16
|
+
|
|
17
|
+
# Yarn
|
|
18
|
+
$ yarn add chayns-api
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Wrap your App component with the "ChaynsProvider" component. In all components which are under the ChaynsProvider you can use hooks and chayns functions.
|
|
22
|
+
```jsx
|
|
23
|
+
<ChaynsProvider>
|
|
24
|
+
<App/>
|
|
25
|
+
</ChaynsProvider>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
|
|
30
|
+
```jsx
|
|
31
|
+
import { useUser } from 'chayns-api';
|
|
32
|
+
|
|
33
|
+
const FirstName = () => {
|
|
34
|
+
const user = useUser();
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div>{user?.firstName}</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Migrate v1 to v2
|
|
43
|
+
|
|
44
|
+
When updating to chayns-api@2 you should also update chayns-toolkit to 3.0.1 or higher (check migration guide [here](https://github.com/TobitSoftware/chayns-toolkit/tree/main?tab=readme-ov-file#-migration-v2-to-v3)).
|
|
45
|
+
|
|
46
|
+
Check urls referencing **remoteEntry.js**. The filename has been changed to **v2.remoteEntry.js**.
|
|
47
|
+
|
|
48
|
+
When your application uses ChaynsHost with module-type you might have to add a call of **initModuleFederationSharing** as early as possible in your application (e.g. index/bootstrap). Unless your application is already embedded as module somewhere else (e.g. in a dialog).
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
initModuleFederationSharing({ name: 'project_name' });
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## Getting started
|
|
56
|
+
|
|
57
|
+
More information to setup chayns-api can be found in the [documentation](https://tobitsoftware.github.io/chayns-api/docs).
|
|
58
|
+
|
|
59
|
+
## Troubleshooting
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
Can't resolve 'react-dom/client'
|
|
63
|
+
```
|
|
64
|
+
A warning like above can be shown when you are still using react 17.
|
|
65
|
+
This can be ignored because the react 17 api is used as fallback instead.
|
|
66
|
+
|
|
67
|
+
## License
|
|
@@ -242,6 +242,7 @@ let AppName = exports.AppName = function (AppName) {
|
|
|
242
242
|
AppName[AppName["TobitChat"] = 6] = "TobitChat";
|
|
243
243
|
AppName[AppName["Sidekick"] = 7] = "Sidekick";
|
|
244
244
|
AppName[AppName["Team"] = 8] = "Team";
|
|
245
|
+
AppName[AppName["CityApp"] = 9] = "CityApp";
|
|
245
246
|
return AppName;
|
|
246
247
|
}({});
|
|
247
248
|
let BrowserName = exports.BrowserName = function (BrowserName) {
|
|
@@ -20,6 +20,8 @@ const getDeviceInfo = (userAgent, acceptHeader, {
|
|
|
20
20
|
appName = _IChaynsReact.AppName.Sidekick;
|
|
21
21
|
} else if (/\steam\/\d+/i.test(userAgent)) {
|
|
22
22
|
appName = _IChaynsReact.AppName.Team;
|
|
23
|
+
} else if (/\scityApp\/\d+/i.test(userAgent)) {
|
|
24
|
+
appName = _IChaynsReact.AppName.CityApp;
|
|
23
25
|
} else if ((match === null || match === void 0 || (_match$groups = match.groups) === null || _match$groups === void 0 ? void 0 : _match$groups.siteId) === '60021-08989') {
|
|
24
26
|
appName = _IChaynsReact.AppName.Chayns;
|
|
25
27
|
} else if ((match === null || match === void 0 || (_match$groups2 = match.groups) === null || _match$groups2 === void 0 ? void 0 : _match$groups2.siteId) === '77892-10814') {
|
|
@@ -236,6 +236,7 @@ export let AppName = function (AppName) {
|
|
|
236
236
|
AppName[AppName["TobitChat"] = 6] = "TobitChat";
|
|
237
237
|
AppName[AppName["Sidekick"] = 7] = "Sidekick";
|
|
238
238
|
AppName[AppName["Team"] = 8] = "Team";
|
|
239
|
+
AppName[AppName["CityApp"] = 9] = "CityApp";
|
|
239
240
|
return AppName;
|
|
240
241
|
}({});
|
|
241
242
|
export let BrowserName = function (BrowserName) {
|
|
@@ -15,6 +15,8 @@ const getDeviceInfo = function (userAgent, acceptHeader) {
|
|
|
15
15
|
appName = AppName.Sidekick;
|
|
16
16
|
} else if (/\steam\/\d+/i.test(userAgent)) {
|
|
17
17
|
appName = AppName.Team;
|
|
18
|
+
} else if (/\scityApp\/\d+/i.test(userAgent)) {
|
|
19
|
+
appName = AppName.CityApp;
|
|
18
20
|
} else if ((match === null || match === void 0 || (_match$groups = match.groups) === null || _match$groups === void 0 ? void 0 : _match$groups.siteId) === '60021-08989') {
|
|
19
21
|
appName = AppName.Chayns;
|
|
20
22
|
} else if ((match === null || match === void 0 || (_match$groups2 = match.groups) === null || _match$groups2 === void 0 ? void 0 : _match$groups2.siteId) === '77892-10814') {
|
package/package.json
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "chayns-api",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "new chayns api",
|
|
5
|
-
"main": "dist/cjs/index.js",
|
|
6
|
-
"module": "dist/esm/index.js",
|
|
7
|
-
"types": "dist/types/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"require": "./dist/cjs/index.js",
|
|
11
|
-
"import": "./dist/esm/index.js",
|
|
12
|
-
"types": "./dist/types/index.d.ts"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"keywords": [
|
|
16
|
-
"chayns",
|
|
17
|
-
"chayns-toolkit",
|
|
18
|
-
"react"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"start": "npm run dev",
|
|
22
|
-
"build:umd": "chayns-toolkit build",
|
|
23
|
-
"build:cjs": "cross-env NODE_ENV=cjs babel src --out-dir dist/cjs --extensions=.ts,.tsx",
|
|
24
|
-
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --extensions=.ts,.tsx",
|
|
25
|
-
"build-docs": "npm i && cd website && npm i && npm run build",
|
|
26
|
-
"build:typescript": "tsc",
|
|
27
|
-
"watch:cjs": "npm run build:cjs -- --watch",
|
|
28
|
-
"watch:esm": "npm run build:esm -- --watch",
|
|
29
|
-
"watch:typescript": "tsc -w",
|
|
30
|
-
"watch": "concurrently \"npm run watch:cjs\" \"npm run watch:esm\" \"npm run watch:typescript\"",
|
|
31
|
-
"dev": "npm link && npm run watch",
|
|
32
|
-
"format": "prettier . --write",
|
|
33
|
-
"lint": "eslint src",
|
|
34
|
-
"prepublishOnly": "npm run build:cjs && npm run build:esm && npm run build:typescript",
|
|
35
|
-
"preversion": "npm run build:typescript -- --noEmit"
|
|
36
|
-
},
|
|
37
|
-
"prettier": {
|
|
38
|
-
"proseWrap": "always",
|
|
39
|
-
"singleQuote": true,
|
|
40
|
-
"tabWidth": 4
|
|
41
|
-
},
|
|
42
|
-
"eslintConfig": {
|
|
43
|
-
"extends": "@chayns-toolkit"
|
|
44
|
-
},
|
|
45
|
-
"dependencies": {
|
|
46
|
-
"@module-federation/enhanced": "^0.8.9",
|
|
47
|
-
"comlink": "4.3.1",
|
|
48
|
-
"htmlescape": "^1.1.1",
|
|
49
|
-
"lodash.throttle": "^4.1.1",
|
|
50
|
-
"ua-parser-js": "^1.0.40",
|
|
51
|
-
"use-sync-external-store": "^1.4.0"
|
|
52
|
-
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@babel/cli": "^7.26.4",
|
|
55
|
-
"@babel/core": "^7.26.0",
|
|
56
|
-
"@babel/preset-env": "^7.26.0",
|
|
57
|
-
"@babel/preset-react": "^7.26.3",
|
|
58
|
-
"@babel/preset-typescript": "^7.26.0",
|
|
59
|
-
"@chayns-toolkit/eslint-config": "^2.0.0",
|
|
60
|
-
"@types/htmlescape": "^1.1.3",
|
|
61
|
-
"@types/lodash.throttle": "^4.1.9",
|
|
62
|
-
"@types/prop-types": "^15.7.12",
|
|
63
|
-
"@types/react": "^18.2.78",
|
|
64
|
-
"@types/react-dom": "^18.2.25",
|
|
65
|
-
"@types/ua-parser-js": "^0.7.39",
|
|
66
|
-
"@types/use-sync-external-store": "^0.0.6",
|
|
67
|
-
"@typescript-eslint/parser": "^7.6.0",
|
|
68
|
-
"chayns-toolkit": "^2.0.13",
|
|
69
|
-
"concurrently": "^9.1.2",
|
|
70
|
-
"cross-env": "^7.0.3",
|
|
71
|
-
"prettier": "^3.4.2",
|
|
72
|
-
"prettier-plugin-packagejson": "^2.5.8",
|
|
73
|
-
"react": "^18.3.1",
|
|
74
|
-
"react-dom": "^18.3.1",
|
|
75
|
-
"typescript": "^5.7.3"
|
|
76
|
-
},
|
|
77
|
-
"peerDependencies": {
|
|
78
|
-
"react": "^16.8 || ^17.0.1 || ^18.0.0 || ^19.0.0",
|
|
79
|
-
"react-dom": "^16.8 || ^17.0.1 || ^18.0.0 || ^19.0.0"
|
|
80
|
-
}
|
|
81
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "chayns-api",
|
|
3
|
+
"version": "2.1.10",
|
|
4
|
+
"description": "new chayns api",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"require": "./dist/cjs/index.js",
|
|
11
|
+
"import": "./dist/esm/index.js",
|
|
12
|
+
"types": "./dist/types/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"chayns",
|
|
17
|
+
"chayns-toolkit",
|
|
18
|
+
"react"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"start": "npm run dev",
|
|
22
|
+
"build:umd": "chayns-toolkit build",
|
|
23
|
+
"build:cjs": "cross-env NODE_ENV=cjs babel src --out-dir dist/cjs --extensions=.ts,.tsx",
|
|
24
|
+
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --extensions=.ts,.tsx",
|
|
25
|
+
"build-docs": "npm i && cd website && npm i && npm run build",
|
|
26
|
+
"build:typescript": "tsc",
|
|
27
|
+
"watch:cjs": "npm run build:cjs -- --watch",
|
|
28
|
+
"watch:esm": "npm run build:esm -- --watch",
|
|
29
|
+
"watch:typescript": "tsc -w",
|
|
30
|
+
"watch": "concurrently \"npm run watch:cjs\" \"npm run watch:esm\" \"npm run watch:typescript\"",
|
|
31
|
+
"dev": "npm link && npm run watch",
|
|
32
|
+
"format": "prettier . --write",
|
|
33
|
+
"lint": "eslint src",
|
|
34
|
+
"prepublishOnly": "npm run build:cjs && npm run build:esm && npm run build:typescript",
|
|
35
|
+
"preversion": "npm run build:typescript -- --noEmit"
|
|
36
|
+
},
|
|
37
|
+
"prettier": {
|
|
38
|
+
"proseWrap": "always",
|
|
39
|
+
"singleQuote": true,
|
|
40
|
+
"tabWidth": 4
|
|
41
|
+
},
|
|
42
|
+
"eslintConfig": {
|
|
43
|
+
"extends": "@chayns-toolkit"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@module-federation/enhanced": "^0.8.9",
|
|
47
|
+
"comlink": "4.3.1",
|
|
48
|
+
"htmlescape": "^1.1.1",
|
|
49
|
+
"lodash.throttle": "^4.1.1",
|
|
50
|
+
"ua-parser-js": "^1.0.40",
|
|
51
|
+
"use-sync-external-store": "^1.4.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@babel/cli": "^7.26.4",
|
|
55
|
+
"@babel/core": "^7.26.0",
|
|
56
|
+
"@babel/preset-env": "^7.26.0",
|
|
57
|
+
"@babel/preset-react": "^7.26.3",
|
|
58
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
59
|
+
"@chayns-toolkit/eslint-config": "^2.0.0",
|
|
60
|
+
"@types/htmlescape": "^1.1.3",
|
|
61
|
+
"@types/lodash.throttle": "^4.1.9",
|
|
62
|
+
"@types/prop-types": "^15.7.12",
|
|
63
|
+
"@types/react": "^18.2.78",
|
|
64
|
+
"@types/react-dom": "^18.2.25",
|
|
65
|
+
"@types/ua-parser-js": "^0.7.39",
|
|
66
|
+
"@types/use-sync-external-store": "^0.0.6",
|
|
67
|
+
"@typescript-eslint/parser": "^7.6.0",
|
|
68
|
+
"chayns-toolkit": "^2.0.13",
|
|
69
|
+
"concurrently": "^9.1.2",
|
|
70
|
+
"cross-env": "^7.0.3",
|
|
71
|
+
"prettier": "^3.4.2",
|
|
72
|
+
"prettier-plugin-packagejson": "^2.5.8",
|
|
73
|
+
"react": "^18.3.1",
|
|
74
|
+
"react-dom": "^18.3.1",
|
|
75
|
+
"typescript": "^5.7.3"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"react": "^16.8 || ^17.0.1 || ^18.0.0 || ^19.0.0",
|
|
79
|
+
"react-dom": "^16.8 || ^17.0.1 || ^18.0.0 || ^19.0.0"
|
|
80
|
+
}
|
|
81
|
+
}
|
package/toolkit.config.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
development: {
|
|
5
|
-
host: "0.0.0.0",
|
|
6
|
-
port: 8081,
|
|
7
|
-
},
|
|
8
|
-
output: {
|
|
9
|
-
singleBundle: true,
|
|
10
|
-
filename: 'chayns-api.js',
|
|
11
|
-
path: path.resolve(__dirname, 'dist'),
|
|
12
|
-
},
|
|
13
|
-
webpack(config) {
|
|
14
|
-
config.output.library = {
|
|
15
|
-
name: 'ChaynsApi',
|
|
16
|
-
type: 'umd',
|
|
17
|
-
}
|
|
18
|
-
return config;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
development: {
|
|
5
|
+
host: "0.0.0.0",
|
|
6
|
+
port: 8081,
|
|
7
|
+
},
|
|
8
|
+
output: {
|
|
9
|
+
singleBundle: true,
|
|
10
|
+
filename: 'chayns-api.js',
|
|
11
|
+
path: path.resolve(__dirname, 'dist'),
|
|
12
|
+
},
|
|
13
|
+
webpack(config) {
|
|
14
|
+
config.output.library = {
|
|
15
|
+
name: 'ChaynsApi',
|
|
16
|
+
type: 'umd',
|
|
17
|
+
}
|
|
18
|
+
return config;
|
|
19
|
+
}
|
|
20
|
+
};
|
package/tsconfig.json
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Basic Options */
|
|
4
|
-
"target": "ES2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
|
|
5
|
-
"module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
|
6
|
-
// "lib": [], /* Specify library files to be included in the compilation: */
|
|
7
|
-
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
8
|
-
// "checkJs": true, /* Report errors in .js files. */
|
|
9
|
-
"jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
10
|
-
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
11
|
-
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
12
|
-
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
13
|
-
"outDir": "dist/types", /* Redirect output structure to the directory. */
|
|
14
|
-
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
15
|
-
// "removeComments": true, /* Do not emit comments to output. */
|
|
16
|
-
"noEmit": false, /* Do not emit outputs. */
|
|
17
|
-
"emitDeclarationOnly": true,
|
|
18
|
-
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
19
|
-
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
20
|
-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
21
|
-
"skipLibCheck": true,
|
|
22
|
-
|
|
23
|
-
/* Strict Type-Checking Options */
|
|
24
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
25
|
-
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
26
|
-
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
27
|
-
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
28
|
-
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
29
|
-
|
|
30
|
-
/* Additional Checks */
|
|
31
|
-
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
32
|
-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
33
|
-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
34
|
-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
35
|
-
|
|
36
|
-
/* Module Resolution Options */
|
|
37
|
-
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
38
|
-
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
39
|
-
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
40
|
-
"rootDirs": ["./src"], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
41
|
-
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
42
|
-
// "types": [], /* Type declaration files to be included in compilation. */
|
|
43
|
-
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
44
|
-
|
|
45
|
-
/* Source Map Options */
|
|
46
|
-
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
47
|
-
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
48
|
-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
49
|
-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
50
|
-
|
|
51
|
-
/* Experimental Options */
|
|
52
|
-
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
53
|
-
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
54
|
-
},
|
|
55
|
-
"exclude": ["node_modules", "**/*.spec.ts", "**/*.spec.tsx", "dist"]
|
|
56
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Basic Options */
|
|
4
|
+
"target": "ES2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
|
|
5
|
+
"module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
|
6
|
+
// "lib": [], /* Specify library files to be included in the compilation: */
|
|
7
|
+
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
8
|
+
// "checkJs": true, /* Report errors in .js files. */
|
|
9
|
+
"jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
10
|
+
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
11
|
+
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
12
|
+
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
13
|
+
"outDir": "dist/types", /* Redirect output structure to the directory. */
|
|
14
|
+
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
15
|
+
// "removeComments": true, /* Do not emit comments to output. */
|
|
16
|
+
"noEmit": false, /* Do not emit outputs. */
|
|
17
|
+
"emitDeclarationOnly": true,
|
|
18
|
+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
19
|
+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
20
|
+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
21
|
+
"skipLibCheck": true,
|
|
22
|
+
|
|
23
|
+
/* Strict Type-Checking Options */
|
|
24
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
25
|
+
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
26
|
+
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
27
|
+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
28
|
+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
29
|
+
|
|
30
|
+
/* Additional Checks */
|
|
31
|
+
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
32
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
33
|
+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
34
|
+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
35
|
+
|
|
36
|
+
/* Module Resolution Options */
|
|
37
|
+
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
38
|
+
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
39
|
+
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
40
|
+
"rootDirs": ["./src"], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
41
|
+
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
42
|
+
// "types": [], /* Type declaration files to be included in compilation. */
|
|
43
|
+
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
44
|
+
|
|
45
|
+
/* Source Map Options */
|
|
46
|
+
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
47
|
+
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
48
|
+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
49
|
+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
50
|
+
|
|
51
|
+
/* Experimental Options */
|
|
52
|
+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
53
|
+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
54
|
+
},
|
|
55
|
+
"exclude": ["node_modules", "**/*.spec.ts", "**/*.spec.tsx", "dist"]
|
|
56
|
+
}
|