@diplodoc/client 0.0.1

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 ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@diplodoc/client",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "build": "webpack",
8
+ "prepublish": "npm run build"
9
+ },
10
+ "author": "",
11
+ "license": "ISC",
12
+ "exports": {
13
+ ".": {
14
+ "node": "./build/app.server.js",
15
+ "default": "./build/app.client.js"
16
+ },
17
+ "./includer": {
18
+ "node": "./includer/index.js"
19
+ },
20
+ "./runtime": {
21
+ "production": "./runtime/index.min.js",
22
+ "development": "./runtime/index.js",
23
+ "default": "./runtime/index.min.js"
24
+ },
25
+ "./runtime/styles": {
26
+ "production": "./runtime/index.min.css",
27
+ "development": "./runtime/index.css",
28
+ "default": "./runtime/index.min.css"
29
+ }
30
+ },
31
+ "dependencies": {
32
+ "@diplodoc/mermaid-extension": "0.0.4",
33
+ "@diplodoc/openapi-extension": "^1.0.19",
34
+ "@doc-tools/components": "^2.8.0",
35
+ "@doc-tools/transform": "^3.0.2",
36
+ "@gravity-ui/uikit": "^4.14.0",
37
+ "react": "^18.2.0",
38
+ "react-dom": "^18.2.0",
39
+ "url": "^0.11.0",
40
+ "webpack-bundle-analyzer": "^4.8.0"
41
+ },
42
+ "devDependencies": {
43
+ "@babel/core": "^7.22.1",
44
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
45
+ "@babel/plugin-syntax-top-level-await": "^7.14.5",
46
+ "@babel/plugin-transform-runtime": "^7.22.4",
47
+ "@babel/preset-env": "^7.22.4",
48
+ "@babel/preset-react": "^7.22.3",
49
+ "@babel/preset-typescript": "^7.21.5",
50
+ "@babel/runtime": "^7.22.3",
51
+ "@types/react": "^18.2.7",
52
+ "@types/react-dom": "^18.2.4",
53
+ "@typescript-eslint/eslint-plugin": "^5.59.8",
54
+ "@typescript-eslint/parser": "^5.59.8",
55
+ "babel-eslint": "^10.1.0",
56
+ "babel-loader": "^9.1.2",
57
+ "css-loader": "^6.8.1",
58
+ "eslint": "^8.41.0",
59
+ "eslint-plugin-react": "^7.32.2",
60
+ "eslint-plugin-react-hooks": "^4.6.0",
61
+ "eslint-plugin-security": "^1.7.1",
62
+ "husky": "^8.0.3",
63
+ "lint-staged": "^13.2.2",
64
+ "mini-css-extract-plugin": "^2.7.6",
65
+ "node-sass": "^9.0.0",
66
+ "prop-types": "^15.8.1",
67
+ "react-svg-loader": "^3.0.3",
68
+ "sass-loader": "^13.3.1",
69
+ "style-loader": "^3.3.3",
70
+ "typescript": "^5.0.4",
71
+ "webpack": "^5.84.1",
72
+ "webpack-cli": "^5.1.1"
73
+ }
74
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "esnext",
4
+ "esModuleInterop": true,
5
+ "pretty": true,
6
+ "newLine": "lf",
7
+ "stripInternal": true,
8
+ "strict": true,
9
+ "noImplicitReturns": true,
10
+ "noUnusedLocals": true,
11
+ "noUnusedParameters": true,
12
+ "noFallthroughCasesInSwitch": true,
13
+ "noEmitOnError": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "skipLibCheck": true,
16
+ "experimentalDecorators": true,
17
+ "allowJs": true,
18
+ "target": "es2020",
19
+ "moduleResolution": "node",
20
+ "declaration": false,
21
+ "outDir": "build",
22
+ "jsx": "react",
23
+ "baseUrl": ".",
24
+ "paths": {
25
+ "*": ["./src/app/*"]
26
+ }
27
+ },
28
+ "include": ["src"],
29
+ "exclude": ["node_modules"],
30
+ "types": ["node"],
31
+ "ts-node": {
32
+ "compilerOptions": {
33
+ "module": "CommonJS"
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,91 @@
1
+ const {resolve} = require('path');
2
+ const {DefinePlugin} = require('webpack');
3
+ // const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer');
4
+
5
+ function config({isServer}) {
6
+ return {
7
+ mode: 'development',
8
+ target: isServer ? 'node' : 'web',
9
+ devtool: 'inline-source-map',
10
+ entry: './src/index.tsx',
11
+ externals: isServer ? {
12
+ 'react': 'react',
13
+ 'react-dom': 'react-dom',
14
+ } : {},
15
+ output: {
16
+ path: resolve(__dirname, 'build'),
17
+ filename: isServer ? 'app.server.js' : 'app.client.js',
18
+ libraryTarget: 'commonjs2'
19
+ },
20
+ resolve: {
21
+ alias: isServer ? {} : {
22
+ react: require.resolve('react'),
23
+ },
24
+ extensions: ['.tsx', '.ts', '.js', '.scss'],
25
+ },
26
+ plugins: [
27
+ new DefinePlugin({
28
+ 'process.env': {
29
+ BROWSER: !isServer
30
+ }
31
+ }),
32
+ // new BundleAnalyzerPlugin({
33
+ // analyzerMode: 'static',
34
+ // openAnalyzer: false,
35
+ // reportFilename: (isServer ? 'server-' : 'client-') + 'stats.html',
36
+ // })
37
+ ],
38
+ module: {
39
+ rules: [
40
+ {
41
+ test: /\.[tj]sx?$/,
42
+ use: ['babel-loader'],
43
+ include: [
44
+ resolve(__dirname, 'src'),
45
+ require.resolve('@diplodoc/mermaid-extension'),
46
+ ],
47
+ }, {
48
+ test: /\.s?css$/,
49
+ use: [
50
+ {
51
+ loader: 'style-loader',
52
+ options: {
53
+ insert: function insertBeforeAt(element) {
54
+ /* eslint-env browser */
55
+ const parent = document.querySelector('head');
56
+ const target = document.querySelector('#custom-style');
57
+
58
+ const lastInsertedElement =
59
+ window._lastElementInsertedByStyleLoader;
60
+
61
+ if (!lastInsertedElement) {
62
+ parent.insertBefore(element, target);
63
+ } else if (lastInsertedElement.nextSibling) {
64
+ parent.insertBefore(
65
+ element,
66
+ lastInsertedElement.nextSibling,
67
+ );
68
+ } else {
69
+ parent.appendChild(element);
70
+ }
71
+
72
+ window._lastElementInsertedByStyleLoader = element;
73
+ },
74
+ },
75
+ },
76
+ {loader: 'css-loader'},
77
+ {loader: 'sass-loader'},
78
+ ],
79
+ }, {
80
+ test: /\.svg$/,
81
+ loader: 'react-svg-loader',
82
+ },
83
+ ],
84
+ },
85
+ };
86
+ }
87
+
88
+ module.exports = [
89
+ config({ isServer: false }),
90
+ config({ isServer: true }),
91
+ ];