@prosopo/procaptcha-bundle 0.1.13
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/.env.development +21 -0
- package/.env.rococo +25 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.html +11 -0
- package/dist/index.html.gz +0 -0
- package/dist/index.js +86 -0
- package/dist/index.js.map +1 -0
- package/dist/procaptcha_bundle.main.bundle.js +18675 -0
- package/dist/procaptcha_bundle.main.bundle.js.gz +0 -0
- package/package.json +77 -0
- package/tsconfig.webpack.json +14 -0
- package/webpack.config.js +230 -0
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@prosopo/procaptcha-bundle",
|
|
3
|
+
"version": "0.1.13",
|
|
4
|
+
"author": "PROSOPO LIMITED <info@prosopo.io>",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"source": "./src/index.ts",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"clean": "tsc --build --clean",
|
|
11
|
+
"build": "tsc --build --verbose",
|
|
12
|
+
"start": "webpack serve --mode development",
|
|
13
|
+
"build:webpack:prod": "webpack --mode production",
|
|
14
|
+
"build:webpack:prod:copy": "webpack --mode production && cp dist/procaptcha_bundle.main.bundle.js ../../demos/client-bundle-example/src",
|
|
15
|
+
"build:webpack:dev": "webpack --mode development",
|
|
16
|
+
"build:webpack:dev:copy": "webpack --mode development && cp dist/procaptcha_bundle.main.bundle.js ../../demos/client-bundle-example/src",
|
|
17
|
+
"lint": "npx eslint .",
|
|
18
|
+
"lint:fix": "npx eslint . --fix"
|
|
19
|
+
},
|
|
20
|
+
"browserslist": [
|
|
21
|
+
"> 0.5%, last 2 versions, not dead"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@prosopo/common": "^0.1.13",
|
|
25
|
+
"@prosopo/procaptcha-react": "^0.1.13"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/prosopo/captcha.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/prosopo/captcha/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/prosopo/captcha#readme",
|
|
35
|
+
"description": "",
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"registry": "https://registry.npmjs.org"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@babel/core": "^7.21.5",
|
|
41
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
42
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
43
|
+
"@babel/preset-env": "^7.21.5",
|
|
44
|
+
"@babel/preset-react": "^7.18.6",
|
|
45
|
+
"@babel/preset-typescript": "^7.21.5",
|
|
46
|
+
"@rollup/plugin-babel": "^6.0.3",
|
|
47
|
+
"@rollup/plugin-commonjs": "^24.1.0",
|
|
48
|
+
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
49
|
+
"@types/react": "^18.2.7",
|
|
50
|
+
"@types/react-dom": "^18.2.4",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^5.59.5",
|
|
52
|
+
"@typescript-eslint/parser": "^5.30.7",
|
|
53
|
+
"babel-loader": "^9.1.2",
|
|
54
|
+
"babel-plugin-lodash": "^3.3.4",
|
|
55
|
+
"compression-webpack-plugin": "^10.0.0",
|
|
56
|
+
"css-loader": "^6.7.3",
|
|
57
|
+
"dotenv-webpack": "^8.0.1",
|
|
58
|
+
"eslint": "^8.40.0",
|
|
59
|
+
"eslint-config-prettier": "^8.5.0",
|
|
60
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
61
|
+
"eslint-plugin-unused-imports": "^2.0.0",
|
|
62
|
+
"eslint-webpack-plugin": "^4.0.1",
|
|
63
|
+
"html-webpack-plugin": "^5.5.1",
|
|
64
|
+
"mini-css-extract-plugin": "^2.7.5",
|
|
65
|
+
"parcel": "^2.8.3",
|
|
66
|
+
"react": "^18.2.0",
|
|
67
|
+
"react-dom": "^18.2.0",
|
|
68
|
+
"style-loader": "^3.3.2",
|
|
69
|
+
"terser-webpack-plugin": "^5.3.7",
|
|
70
|
+
"typescript": "^4.7.4",
|
|
71
|
+
"webpack": "^5.82.0",
|
|
72
|
+
"webpack-bundle-analyzer": "^4.8.0",
|
|
73
|
+
"webpack-dev-server": "^4.13.3",
|
|
74
|
+
"webpack-json-access-optimizer": "^1.1.0",
|
|
75
|
+
"webpack-cli": "^5.1.1"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
2
|
+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
|
3
|
+
const CompressionPlugin = require('compression-webpack-plugin')
|
|
4
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
5
|
+
const webpack = require('webpack')
|
|
6
|
+
const TerserPlugin = require('terser-webpack-plugin')
|
|
7
|
+
const path = require('path')
|
|
8
|
+
const { JsonAccessOptimizer } = require('webpack-json-access-optimizer')
|
|
9
|
+
const { ProvidePlugin } = require('webpack')
|
|
10
|
+
const { loadEnv } = require('@prosopo/cli')
|
|
11
|
+
const { logger } = require('@prosopo/common')
|
|
12
|
+
const log = logger(`Info`, `webpack.config.js`)
|
|
13
|
+
const moduleDirs = [
|
|
14
|
+
path.resolve(__dirname, 'node_modules'),
|
|
15
|
+
path.resolve(__dirname, '../../node_modules'),
|
|
16
|
+
path.resolve(__dirname, '../api/node_modules'),
|
|
17
|
+
path.resolve(__dirname, '../common/node_modules'),
|
|
18
|
+
path.resolve(__dirname, '../procaptcha/node_modules'),
|
|
19
|
+
path.resolve(__dirname, '../procaptcha-react/node_modules'),
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
const allowList = [
|
|
23
|
+
'@emotion/cache',
|
|
24
|
+
'@emotion/react',
|
|
25
|
+
'@emotion/serialize',
|
|
26
|
+
'@emotion/styled',
|
|
27
|
+
'@emotion/styled-engine',
|
|
28
|
+
'@mui/base',
|
|
29
|
+
'@mui/material',
|
|
30
|
+
'@mui/private-theming',
|
|
31
|
+
'@mui/react-transition-group',
|
|
32
|
+
'@mui/styled-engine',
|
|
33
|
+
'@mui/styles',
|
|
34
|
+
'@mui/system',
|
|
35
|
+
'@mui/types',
|
|
36
|
+
'@mui/utils',
|
|
37
|
+
'@polkadot/api',
|
|
38
|
+
'@polkadot/api-augment',
|
|
39
|
+
'@polkadot/api-base',
|
|
40
|
+
'@polkadot/api-contract',
|
|
41
|
+
'@polkadot/api-derive',
|
|
42
|
+
'@polkadot/bn.js',
|
|
43
|
+
'@polkadot/connect',
|
|
44
|
+
'@polkadot/dist',
|
|
45
|
+
'@polkadot/icons-material',
|
|
46
|
+
'@polkadot/keyring',
|
|
47
|
+
'@polkadot/lib',
|
|
48
|
+
'@polkadot/rpc-augment',
|
|
49
|
+
'@polkadot/rpc-core',
|
|
50
|
+
'@polkadot/rpc-provider',
|
|
51
|
+
'@polkadot/ss58-registry',
|
|
52
|
+
'@polkadot/types',
|
|
53
|
+
'@polkadot/types-augment',
|
|
54
|
+
'@polkadot/types-codec',
|
|
55
|
+
'@polkadot/types-create',
|
|
56
|
+
'@polkadot/util',
|
|
57
|
+
'@polkadot/util-crypto',
|
|
58
|
+
'@polkadot/wasm-bridge',
|
|
59
|
+
'@polkadot/wasm-crypto',
|
|
60
|
+
'@polkadot/wasm-crypto-init',
|
|
61
|
+
'@polkadot/x-bigint',
|
|
62
|
+
'@popperjs/base',
|
|
63
|
+
'@popperjs/core',
|
|
64
|
+
'@substrate/connect',
|
|
65
|
+
'@substrate/networks',
|
|
66
|
+
'@substrate/rpc-provider',
|
|
67
|
+
'@types/express-serve-static-core',
|
|
68
|
+
'@types/material',
|
|
69
|
+
'@types/qs',
|
|
70
|
+
'@types/range-parser',
|
|
71
|
+
'@types/react',
|
|
72
|
+
'@types/react-dom',
|
|
73
|
+
'@types/scheduler',
|
|
74
|
+
'@types/send',
|
|
75
|
+
'@types/types',
|
|
76
|
+
'@types/util',
|
|
77
|
+
'axios',
|
|
78
|
+
'clsx',
|
|
79
|
+
'consola/extension-inject',
|
|
80
|
+
'csstype',
|
|
81
|
+
'i18next',
|
|
82
|
+
'i18next-http-middleware',
|
|
83
|
+
'react',
|
|
84
|
+
'react-dom',
|
|
85
|
+
'react-i18next/mime',
|
|
86
|
+
'rxjs/dist',
|
|
87
|
+
'rxjs/types',
|
|
88
|
+
'tslib',
|
|
89
|
+
'zod',
|
|
90
|
+
]
|
|
91
|
+
// Create a regex that captures packages that are NOT in the allow list
|
|
92
|
+
const externalsRegex = `(?!${allowList.map((item) => item.replace('/', '\\/')).join('|')})`
|
|
93
|
+
log.info('externalsRegex', externalsRegex)
|
|
94
|
+
|
|
95
|
+
loadEnv()
|
|
96
|
+
|
|
97
|
+
module.exports = (env, argv) => {
|
|
98
|
+
const isProduction = argv.mode === 'production'
|
|
99
|
+
const libraryName = 'procaptcha_bundle'
|
|
100
|
+
return {
|
|
101
|
+
resolve: {
|
|
102
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
103
|
+
modules: moduleDirs,
|
|
104
|
+
fullySpecified: false,
|
|
105
|
+
},
|
|
106
|
+
entry: './src/index.tsx',
|
|
107
|
+
output: {
|
|
108
|
+
filename: `${libraryName}.[name].bundle.js`,
|
|
109
|
+
path: path.resolve(__dirname, 'dist'),
|
|
110
|
+
library: libraryName,
|
|
111
|
+
chunkFilename: `${libraryName}.[name].bundle.js`,
|
|
112
|
+
},
|
|
113
|
+
module: {
|
|
114
|
+
rules: [
|
|
115
|
+
{
|
|
116
|
+
include: /node_modules/,
|
|
117
|
+
test: /\.css$/,
|
|
118
|
+
resolve: {
|
|
119
|
+
fullySpecified: false,
|
|
120
|
+
},
|
|
121
|
+
sideEffects: true,
|
|
122
|
+
use: [
|
|
123
|
+
MiniCssExtractPlugin.loader,
|
|
124
|
+
{
|
|
125
|
+
loader: require.resolve('css-loader'),
|
|
126
|
+
options: {
|
|
127
|
+
url: false,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
//exclude: /(node_modules)/,
|
|
134
|
+
test: /\.(ts|tsx)$/,
|
|
135
|
+
resolve: {
|
|
136
|
+
fullySpecified: false,
|
|
137
|
+
},
|
|
138
|
+
use: [
|
|
139
|
+
{
|
|
140
|
+
loader: require.resolve('ts-loader'),
|
|
141
|
+
options: {
|
|
142
|
+
configFile: 'tsconfig.webpack.json',
|
|
143
|
+
transpileOnly: true,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
test: /locale\.json$/, // match JSON files to optimize
|
|
150
|
+
loader: 'webpack-json-access-optimizer',
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
plugins: [
|
|
156
|
+
new HtmlWebpackPlugin({
|
|
157
|
+
template: './src/index.html',
|
|
158
|
+
}),
|
|
159
|
+
//new BundleAnalyzerPlugin(),
|
|
160
|
+
new webpack.DefinePlugin({
|
|
161
|
+
'process.env.NODE_ENV': JSON.stringify(isProduction ? 'production' : 'development'),
|
|
162
|
+
'process.env.PROTOCOL_CONTRACT_ADDRESS': JSON.stringify(process.env.PROTOCOL_CONTRACT_ADDRESS),
|
|
163
|
+
'process.env.SUBSTRATE_NODE_URL': JSON.stringify(process.env.SUBSTRATE_NODE_URL),
|
|
164
|
+
'process.env.DEFAULT_ENVIRONMENT': JSON.stringify(process.env.DEFAULT_ENVIRONMENT),
|
|
165
|
+
'process.env.PROSOPO_SITE_KEY': JSON.stringify(process.env.PROSOPO_SITE_KEY),
|
|
166
|
+
}),
|
|
167
|
+
// new webpack.optimize.SplitChunksPlugin(),
|
|
168
|
+
new CompressionPlugin(),
|
|
169
|
+
new MiniCssExtractPlugin({
|
|
170
|
+
filename: 'extr.[contenthash].css',
|
|
171
|
+
}),
|
|
172
|
+
new ProvidePlugin({
|
|
173
|
+
$t: './$tProvider',
|
|
174
|
+
}),
|
|
175
|
+
new JsonAccessOptimizer({
|
|
176
|
+
accessorFunctionName: '$t', // i18n function name
|
|
177
|
+
}),
|
|
178
|
+
{
|
|
179
|
+
apply: (compiler) => {
|
|
180
|
+
compiler.hooks.done.tap('DonePlugin', (stats) => {
|
|
181
|
+
log.info('Compile is done !')
|
|
182
|
+
setTimeout(() => {
|
|
183
|
+
process.exit(0)
|
|
184
|
+
})
|
|
185
|
+
})
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
optimization: {
|
|
190
|
+
// chunkIds: 'deterministic',
|
|
191
|
+
// runtimeChunk: 'single',
|
|
192
|
+
// splitChunks: {
|
|
193
|
+
// cacheGroups: [
|
|
194
|
+
// // all other modules
|
|
195
|
+
// ['modu', /[\\/]node_modules[\\/]/],
|
|
196
|
+
// ].reduce(
|
|
197
|
+
// (result, [name, test], index) => ({
|
|
198
|
+
// ...result,
|
|
199
|
+
// [`cacheGroup${index}`]: {
|
|
200
|
+
// chunks: 'initial',
|
|
201
|
+
// enforce: true,
|
|
202
|
+
// maxSize: 1_500_000,
|
|
203
|
+
// minSize: 0,
|
|
204
|
+
// name,
|
|
205
|
+
// priority: -1 * index,
|
|
206
|
+
// test,
|
|
207
|
+
// },
|
|
208
|
+
// }),
|
|
209
|
+
// {}
|
|
210
|
+
// ),
|
|
211
|
+
// },
|
|
212
|
+
noEmitOnErrors: true,
|
|
213
|
+
minimize: isProduction,
|
|
214
|
+
minimizer: isProduction
|
|
215
|
+
? [
|
|
216
|
+
new TerserPlugin({
|
|
217
|
+
terserOptions: {
|
|
218
|
+
compress: {
|
|
219
|
+
drop_console: true,
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
}),
|
|
223
|
+
]
|
|
224
|
+
: undefined,
|
|
225
|
+
usedExports: true,
|
|
226
|
+
},
|
|
227
|
+
externalsPresets: { node: false }, // do not set this to true, it will break the build
|
|
228
|
+
externals: isProduction ? [externalsRegex] : undefined,
|
|
229
|
+
}
|
|
230
|
+
}
|