polfan-server-js-client 0.1.99941 → 0.2.0

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/package.json CHANGED
@@ -1,18 +1,27 @@
1
1
  {
2
2
  "name": "polfan-server-js-client",
3
- "version": "0.1.99941",
3
+ "version": "0.2.0",
4
4
  "description": "JavaScript client library for handling communication with Polfan chat server.",
5
5
  "author": "Jarosław Żak",
6
6
  "license": "MIT",
7
- "main": "build/index.js",
7
+ "main": "build/index.cjs.js",
8
+ "browser": "build/index.umd.js",
8
9
  "types": "build/types/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "require": "./build/index.cjs.js",
13
+ "import": "./build/index.esm.js",
14
+ "browser": "./build/index.umd.js",
15
+ "default": "./build/index.esm.js"
16
+ }
17
+ },
9
18
  "scripts": {
10
19
  "start": "webpack serve --config webpack.config.demo.js",
11
- "build": "webpack && tsc",
12
- "build:demo": "webpack --config webpack.config.demo.js",
20
+ "build": "npm run build:node && npm run build:browser && tsc",
21
+ "build:node": "webpack --config webpack.config.node.js",
22
+ "build:browser": "webpack --config webpack.config.browser.js",
13
23
  "test": "jest",
14
24
  "coverage": "npm run test -- --coverage",
15
- "prepare": "npm run build",
16
25
  "trypublish": "npm publish || true"
17
26
  },
18
27
  "devDependencies": {
@@ -22,6 +31,7 @@
22
31
  "@babel/plugin-transform-typescript": "^7.20.2",
23
32
  "@babel/polyfill": "^7.12.1",
24
33
  "@babel/preset-env": "^7.20.2",
34
+ "@babel/preset-typescript": "^7.27.1",
25
35
  "@types/jest": "^29.2.5",
26
36
  "@typescript-eslint/eslint-plugin": "^4.33.0",
27
37
  "@typescript-eslint/parser": "^4.33.0",
package/src/index.ts CHANGED
@@ -17,9 +17,12 @@ export {
17
17
  IndexedObjectCollection, ObservableIndexedObjectCollection,
18
18
  Permissions, PermissionDefinition, Layer,
19
19
  WebSocketChatClient, WebApiChatClient,
20
- AuthClient, MyAccountInterface, TokenInterface,
21
- FilesClient, File,
20
+ AuthClient,
21
+ FilesClient,
22
22
  extractUserFromMember,
23
23
  };
24
24
 
25
- export type {ChatTypes};
25
+ export type {
26
+ ChatTypes,
27
+ MyAccountInterface, TokenInterface, File,
28
+ };
@@ -0,0 +1,59 @@
1
+ const path = require('path');
2
+ const TerserPlugin = require('terser-webpack-plugin');
3
+ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
4
+
5
+ module.exports = {
6
+ mode: "production",
7
+ devtool: 'source-map',
8
+ entry: './src/index.ts',
9
+ target: 'web',
10
+ output: {
11
+ filename: 'index.umd.js',
12
+ path: path.resolve(__dirname, 'build'),
13
+ library: "PservClient",
14
+ libraryTarget: 'umd',
15
+ globalObject: 'this',
16
+ clean: false
17
+ },
18
+ optimization: {
19
+ minimize: true,
20
+ minimizer: [
21
+ new TerserPlugin({ extractComments: false }),
22
+ ],
23
+ },
24
+ module: {
25
+ rules: [
26
+ {
27
+ test: /\.(m|j|t)s$/,
28
+ exclude: /(node_modules|bower_components)/,
29
+ use: {
30
+ loader: 'babel-loader',
31
+ options: {
32
+ presets: [
33
+ ['@babel/preset-env', { targets: { esmodules: true } }],
34
+ '@babel/preset-typescript'
35
+ ],
36
+ plugins: [
37
+
38
+ ]
39
+ }
40
+ }
41
+ },
42
+ {
43
+ test: /\.(sa|sc|c)ss$/,
44
+ use: [
45
+ MiniCssExtractPlugin.loader,
46
+ { loader: "css-loader", options: { sourceMap: true } },
47
+ ],
48
+ }
49
+ ]
50
+ },
51
+ plugins: [
52
+ new MiniCssExtractPlugin({
53
+ filename: 'index.css',
54
+ }),
55
+ ],
56
+ resolve: {
57
+ extensions: ['.ts', '.js', '.json']
58
+ }
59
+ };
@@ -0,0 +1,47 @@
1
+ const path = require('path');
2
+ const TerserPlugin = require('terser-webpack-plugin');
3
+
4
+ module.exports = {
5
+ mode: "production",
6
+ devtool: 'source-map',
7
+ entry: './src/index.ts',
8
+ target: 'node',
9
+ output: {
10
+ filename: 'index.cjs.js',
11
+ path: path.resolve(__dirname, 'build'),
12
+ libraryTarget: 'commonjs2',
13
+ clean: false
14
+ },
15
+ optimization: {
16
+ minimize: false,
17
+ minimizer: [
18
+ new TerserPlugin({ extractComments: false }),
19
+ ],
20
+ },
21
+ module: {
22
+ rules: [
23
+ {
24
+ test: /\.(m|j|t)s$/,
25
+ exclude: /(node_modules|bower_components)/,
26
+ use: {
27
+ loader: 'babel-loader',
28
+ options: {
29
+ presets: [
30
+ ['@babel/preset-env', { targets: { node: 'current' } }],
31
+ '@babel/preset-typescript'
32
+ ],
33
+ plugins: [
34
+
35
+ ]
36
+ }
37
+ }
38
+ },
39
+ ]
40
+ },
41
+ resolve: {
42
+ extensions: ['.ts', '.js', '.json']
43
+ },
44
+ externals: [
45
+
46
+ ]
47
+ };
@@ -1,47 +0,0 @@
1
- const MiniCssExtractPlugin = require("mini-css-extract-plugin");
2
- const HtmlWebpackPlugin = require('html-webpack-plugin');
3
-
4
- module.exports = {
5
- mode: "development",
6
- devtool: 'cheap-module-source-map',
7
- entry: './src/demo/index.ts',
8
- output: {
9
- filename: 'index.js'
10
- },
11
- optimization: {
12
- minimize: false,
13
- },
14
- devServer: {
15
- open: true,
16
- hot: true,
17
- host: "localhost",
18
- port: 9000
19
- },
20
- module: {
21
- rules: [
22
- {
23
- test: /\.(m|j|t)s$/,
24
- exclude: /(node_modules|bower_components)/,
25
- use: {
26
- loader: 'babel-loader'
27
- }
28
- },
29
- {
30
- test: /\.(sa|sc|c)ss$/,
31
- use: [
32
- MiniCssExtractPlugin.loader,
33
- { loader: "css-loader", options: { sourceMap: true } },
34
- ],
35
- }
36
- ]
37
- },
38
- plugins: [
39
- new MiniCssExtractPlugin({
40
- filename: 'css/index.css'
41
- }),
42
- new HtmlWebpackPlugin(),
43
- ],
44
- resolve: {
45
- extensions: ['.ts', '.js', '.json']
46
- }
47
- };
package/webpack.config.js DELETED
@@ -1,69 +0,0 @@
1
- const path = require('path');
2
- const TerserPlugin = require('terser-webpack-plugin');
3
- const getPackageJson = require('./scripts/getPackageJson');
4
- const MiniCssExtractPlugin = require("mini-css-extract-plugin");
5
-
6
- // const {
7
- // version,
8
- // name,
9
- // license,
10
- // repository,
11
- // author,
12
- // } = getPackageJson('version', 'name', 'license', 'repository', 'author');
13
-
14
- // const banner = `
15
- // ${name} v${version}
16
- // ${repository.url}
17
- //
18
- // Copyright (c) ${author.replace(/ *<[^)]*> */g, " ")} and project contributors.
19
- //
20
- // This source code is licensed under the ${license} license found in the
21
- // LICENSE file in the root directory of this source tree.
22
- // `;
23
-
24
- module.exports = {
25
- mode: "production",
26
- devtool: 'source-map',
27
- entry: './src/index.ts',
28
- output: {
29
- filename: 'index.js',
30
- path: path.resolve(__dirname, 'build'),
31
- library: "PServ",
32
- libraryTarget: 'umd',
33
- clean: true
34
- },
35
- optimization: {
36
- minimize: false,
37
- minimizer: [
38
- new TerserPlugin({ extractComments: false }),
39
- //new CssMinimizerPlugin()
40
- ],
41
- },
42
- module: {
43
- rules: [
44
- {
45
- test: /\.(m|j|t)s$/,
46
- exclude: /(node_modules|bower_components)/,
47
- use: {
48
- loader: 'babel-loader'
49
- }
50
- },
51
- {
52
- test: /\.(sa|sc|c)ss$/,
53
- use: [
54
- MiniCssExtractPlugin.loader,
55
- { loader: "css-loader", options: { sourceMap: true } },
56
- ],
57
- }
58
- ]
59
- },
60
- plugins: [
61
- // new MiniCssExtractPlugin({
62
- // filename: 'css/index.css'
63
- // }),
64
- // new webpack.BannerPlugin(banner)
65
- ],
66
- resolve: {
67
- extensions: ['.ts', '.js', '.json']
68
- }
69
- };