@prosopo/config 0.2.13 → 0.2.15
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/dist/dependencies.d.ts +0 -37
- package/dist/dependencies.d.ts.map +1 -1
- package/dist/dependencies.js +0 -62
- package/dist/dependencies.js.map +1 -1
- package/dist/polkadot/bytes.d.ts +4 -0
- package/dist/polkadot/bytes.d.ts.map +1 -0
- package/dist/polkadot/bytes.js +4 -0
- package/dist/polkadot/bytes.js.map +1 -0
- package/dist/polkadot/exclude.d.ts +0 -1
- package/dist/polkadot/exclude.d.ts.map +1 -1
- package/dist/polkadot/exclude.js +114 -19
- package/dist/polkadot/exclude.js.map +1 -1
- package/dist/polkadot/index.d.ts +1 -1
- package/dist/polkadot/index.d.ts.map +1 -1
- package/dist/polkadot/index.js +1 -1
- package/dist/polkadot/index.js.map +1 -1
- package/dist/polkadot/mockApiDerive.d.ts +3 -0
- package/dist/polkadot/mockApiDerive.d.ts.map +1 -0
- package/dist/polkadot/mockApiDerive.js +2 -0
- package/dist/polkadot/mockApiDerive.js.map +1 -0
- package/dist/polkadot/mockInterface.d.ts +5 -0
- package/dist/polkadot/mockInterface.d.ts.map +1 -0
- package/dist/polkadot/mockInterface.js +2 -0
- package/dist/polkadot/mockInterface.js.map +1 -0
- package/dist/polkadot/mockSubstrateGenesis.d.ts +30 -0
- package/dist/polkadot/mockSubstrateGenesis.d.ts.map +1 -0
- package/dist/polkadot/mockSubstrateGenesis.js +47 -0
- package/dist/polkadot/mockSubstrateGenesis.js.map +1 -0
- package/dist/polkadot/{mock.d.ts → mockUpgrade.d.ts} +3 -1
- package/dist/polkadot/mockUpgrade.d.ts.map +1 -0
- package/dist/polkadot/{mock.js → mockUpgrade.js} +3 -1
- package/dist/polkadot/mockUpgrade.js.map +1 -0
- package/dist/provider/test.js +1 -1
- package/dist/provider/test.js.map +1 -1
- package/dist/tests/paths.test.js +0 -13
- package/dist/tests/paths.test.js.map +1 -1
- package/dist/vite/vite-plugin-close-and-copy.d.ts +0 -4
- package/dist/vite/vite-plugin-close-and-copy.d.ts.map +1 -1
- package/dist/vite/vite-plugin-close-and-copy.js +0 -4
- package/dist/vite/vite-plugin-close-and-copy.js.map +1 -1
- package/dist/vite/vite-plugin-fix-absolute-imports.js +0 -1
- package/dist/vite/vite-plugin-fix-absolute-imports.js.map +1 -1
- package/dist/vite/vite-plugin-sourcemap-exclude.js +0 -2
- package/dist/vite/vite-plugin-sourcemap-exclude.js.map +1 -1
- package/dist/vite/vite.backend.config.d.ts.map +1 -1
- package/dist/vite/vite.backend.config.js +12 -25
- package/dist/vite/vite.backend.config.js.map +1 -1
- package/dist/vite/vite.commonjs.config.d.ts.map +1 -1
- package/dist/vite/vite.commonjs.config.js +5 -3
- package/dist/vite/vite.commonjs.config.js.map +1 -1
- package/dist/vite/vite.frontend.config.d.ts.map +1 -1
- package/dist/vite/vite.frontend.config.js +44 -41
- package/dist/vite/vite.frontend.config.js.map +1 -1
- package/dist/vite/vite.test.config.d.ts.map +1 -1
- package/dist/vite/vite.test.config.js +11 -2
- package/dist/vite/vite.test.config.js.map +1 -1
- package/package.json +9 -8
- package/src/dependencies.ts +1 -1
- package/src/polkadot/bytes.ts +14 -0
- package/src/polkadot/exclude.ts +141 -19
- package/src/polkadot/index.ts +1 -1
- package/src/polkadot/mockApiDerive.ts +1 -0
- package/src/polkadot/mockInterface.ts +1 -0
- package/src/polkadot/mockSubstrateGenesis.ts +46 -0
- package/src/polkadot/{mock.ts → mockUpgrade.ts} +2 -0
- package/src/provider/test.ts +1 -1
- package/src/vite/vite.backend.config.ts +16 -4
- package/src/vite/vite.commonjs.config.ts +8 -0
- package/src/vite/vite.frontend.config.ts +50 -21
- package/src/vite/vite.test.config.ts +12 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/polkadot/mock.d.ts.map +0 -1
- package/dist/polkadot/mock.js.map +0 -1
|
@@ -6,12 +6,13 @@ import { builtinModules } from 'module'
|
|
|
6
6
|
import { filterDependencies, getDependencies } from '../dependencies.js'
|
|
7
7
|
import { getAliases } from '../polkadot/index.js'
|
|
8
8
|
import { getLogger } from '@prosopo/common'
|
|
9
|
-
import {
|
|
10
|
-
import { viteCommonjs } from '@originjs/vite-plugin-commonjs'
|
|
9
|
+
import { visualizer } from 'rollup-plugin-visualizer'
|
|
11
10
|
import { default as viteReact } from '@vitejs/plugin-react'
|
|
12
11
|
import { wasm } from '@rollup/plugin-wasm'
|
|
13
12
|
import css from 'rollup-plugin-import-css'
|
|
13
|
+
import nodeResolve from '@rollup/plugin-node-resolve'
|
|
14
14
|
import path from 'path'
|
|
15
|
+
import typescript from '@rollup/plugin-typescript'
|
|
15
16
|
import viteTsconfigPaths from 'vite-tsconfig-paths'
|
|
16
17
|
const logger = getLogger(`Info`, `vite.config.js`)
|
|
17
18
|
|
|
@@ -39,10 +40,11 @@ export default async function (
|
|
|
39
40
|
'process.env.WS_NO_BUFFER_UTIL': JSON.stringify('true'),
|
|
40
41
|
'process.env.WS_NO_UTF_8_VALIDATE': JSON.stringify('true'),
|
|
41
42
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
|
42
|
-
'process.env.
|
|
43
|
-
'process.env.
|
|
44
|
-
'process.env.
|
|
45
|
-
'process.env.
|
|
43
|
+
'process.env.PROSOPO_SUBSTRATE_ENDPOINT': JSON.stringify(process.env.PROSOPO_SUBSTRATE_ENDPOINT),
|
|
44
|
+
'process.env.PROSOPO_DEFAULT_ENVIRONMENT': JSON.stringify(process.env.PROSOPO_DEFAULT_ENVIRONMENT),
|
|
45
|
+
'process.env.PROSOPO_DEFAULT_NETWORK': JSON.stringify(process.env.PROSOPO_DEFAULT_NETWORK),
|
|
46
|
+
'process.env.PROSOPO_SERVER_URL': JSON.stringify(process.env.PROSOPO_SERVER_URL),
|
|
47
|
+
'process.env.PROSOPO_CONTRACT_ADDRESS': JSON.stringify(process.env.PROSOPO_CONTRACT_ADDRESS),
|
|
46
48
|
// only needed if bundling with a site key
|
|
47
49
|
'process.env.PROSOPO_SITE_KEY': JSON.stringify(process.env.PROSOPO_SITE_KEY),
|
|
48
50
|
}
|
|
@@ -62,35 +64,40 @@ export default async function (
|
|
|
62
64
|
...external,
|
|
63
65
|
...optionalPeerDependencies,
|
|
64
66
|
]
|
|
65
|
-
logger.
|
|
66
|
-
const alias =
|
|
67
|
+
logger.debug(`Bundling. ${JSON.stringify(internal.slice(0, 10), null, 2)}... ${internal.length} deps`)
|
|
68
|
+
const alias = getAliases(dir)
|
|
67
69
|
|
|
68
70
|
// Required to print RegExp in console (e.g. alias keys)
|
|
69
71
|
const proto = RegExp.prototype as any
|
|
70
72
|
proto['toJSON'] = RegExp.prototype.toString
|
|
71
|
-
logger.
|
|
73
|
+
logger.debug(`aliases ${JSON.stringify(alias, null, 2)}`)
|
|
72
74
|
|
|
73
75
|
// drop console logs if in production mode
|
|
74
76
|
const drop: Drop[] | undefined = mode === 'production' ? ['console', 'debugger'] : undefined
|
|
75
77
|
|
|
78
|
+
logger.info('Bundle name', bundleName)
|
|
76
79
|
return {
|
|
80
|
+
ssr: {
|
|
81
|
+
target: 'webworker',
|
|
82
|
+
},
|
|
77
83
|
server: {
|
|
78
84
|
host: '127.0.0.1',
|
|
79
85
|
},
|
|
80
86
|
mode: mode || 'development',
|
|
81
87
|
optimizeDeps: {
|
|
82
|
-
include: ['linked-dep', 'esm-dep > cjs-dep', 'node_modules'],
|
|
83
|
-
|
|
88
|
+
include: ['linked-dep', 'esm-dep > cjs-dep', 'node_modules'],
|
|
89
|
+
force: true,
|
|
84
90
|
},
|
|
85
91
|
esbuild: {
|
|
86
92
|
platform: 'browser',
|
|
87
93
|
target: ['es2020', 'chrome60', 'edge18', 'firefox60', 'node12', 'safari11'],
|
|
88
94
|
drop,
|
|
95
|
+
legalComments: 'none',
|
|
89
96
|
},
|
|
90
97
|
define,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
resolve: {
|
|
99
|
+
alias,
|
|
100
|
+
},
|
|
94
101
|
|
|
95
102
|
build: {
|
|
96
103
|
outDir: path.resolve(dir, 'dist/bundle'),
|
|
@@ -99,20 +106,31 @@ export default async function (
|
|
|
99
106
|
lib: {
|
|
100
107
|
entry: path.resolve(dir, entry),
|
|
101
108
|
name: bundleName,
|
|
109
|
+
// sets the bundle to an Instantly Invoked Function Expression (IIFE)
|
|
102
110
|
fileName: `${bundleName}.bundle.js`,
|
|
103
|
-
// sets the bundle to an instantly invoked function expression (IIFE)
|
|
104
111
|
formats: ['iife'],
|
|
105
112
|
},
|
|
106
113
|
modulePreload: { polyfill: true },
|
|
107
114
|
commonjsOptions: {
|
|
108
115
|
exclude: ['mongodb/*'],
|
|
109
116
|
transformMixedEsModules: true,
|
|
117
|
+
strictRequires: 'debug',
|
|
110
118
|
},
|
|
111
119
|
|
|
112
120
|
rollupOptions: {
|
|
113
|
-
treeshake:
|
|
121
|
+
treeshake: {
|
|
122
|
+
annotations: false,
|
|
123
|
+
propertyReadSideEffects: false,
|
|
124
|
+
tryCatchDeoptimization: false,
|
|
125
|
+
moduleSideEffects: 'no-external', //true,
|
|
126
|
+
preset: 'smallest',
|
|
127
|
+
manualPureFunctions: ['createWasmFn', 'unzlibSync', 'withWasm', 'isReady', 'initBridge', 'twox'],
|
|
128
|
+
unknownGlobalSideEffects: false,
|
|
129
|
+
},
|
|
130
|
+
experimentalLogSideEffects: false,
|
|
114
131
|
external: allExternal,
|
|
115
132
|
watch: false,
|
|
133
|
+
|
|
116
134
|
output: {
|
|
117
135
|
dir: path.resolve(dir, 'dist/bundle'),
|
|
118
136
|
entryFileNames: `${bundleName}.bundle.js`,
|
|
@@ -121,19 +139,31 @@ export default async function (
|
|
|
121
139
|
plugins: [
|
|
122
140
|
css(),
|
|
123
141
|
wasm(),
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
143
|
+
// @ts-ignore
|
|
124
144
|
nodeResolve({
|
|
125
145
|
browser: true,
|
|
126
146
|
preferBuiltins: false,
|
|
127
147
|
rootDir: path.resolve(dir, '../../'),
|
|
128
148
|
dedupe: ['react', 'react-dom'],
|
|
149
|
+
modulesOnly: true,
|
|
150
|
+
}),
|
|
151
|
+
visualizer({
|
|
152
|
+
open: true,
|
|
153
|
+
template: 'treemap', //'list',
|
|
154
|
+
gzipSize: true,
|
|
155
|
+
brotliSize: true,
|
|
129
156
|
}),
|
|
130
157
|
// I think we can use this plugin to build all packages instead of relying on the tsc step that's
|
|
131
158
|
// currently a precursor in package.json. However, it fails for the following reason:
|
|
132
159
|
// https://github.com/rollup/plugins/issues/243
|
|
133
|
-
// typescript
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
|
|
160
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
161
|
+
// @ts-ignore
|
|
162
|
+
typescript({
|
|
163
|
+
tsconfig: path.resolve('./tsconfig.json'),
|
|
164
|
+
compilerOptions: { rootDir: path.resolve('./src') },
|
|
165
|
+
outDir: path.resolve(dir, 'dist/bundle'),
|
|
166
|
+
}),
|
|
137
167
|
],
|
|
138
168
|
},
|
|
139
169
|
},
|
|
@@ -142,7 +172,6 @@ export default async function (
|
|
|
142
172
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
143
173
|
// @ts-ignore
|
|
144
174
|
viteReact(),
|
|
145
|
-
viteCommonjs(),
|
|
146
175
|
// Closes the bundler and copies the bundle to the client-bundle-example project unless we're in serve
|
|
147
176
|
// mode, in which case we don't want to close the bundler because it will close the server
|
|
148
177
|
command !== 'serve' ? VitePluginCloseAndCopy(copyOptions) : undefined,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineConfig } from 'vitest/config'
|
|
2
|
+
import VitePluginCloseAndCopy from './vite-plugin-close-and-copy.js'
|
|
2
3
|
import VitePluginSourcemapExclude from './vite-plugin-sourcemap-exclude.js'
|
|
3
4
|
|
|
4
5
|
export default function () {
|
|
@@ -15,15 +16,24 @@ export default function () {
|
|
|
15
16
|
},
|
|
16
17
|
},
|
|
17
18
|
test: {
|
|
19
|
+
watch: false,
|
|
20
|
+
//reporters: ['basic', 'hanging-process'], https://github.com/vitest-dev/vitest/issues/4415
|
|
18
21
|
include: ['../../packages/*/src/**/*.test.ts', '../../contracts/*/src/**/*.test.ts'],
|
|
19
22
|
exclude: ['../../demos/**/*'], // '../!packages/**/*'],
|
|
20
23
|
singleThread: true,
|
|
21
|
-
watchExclude: [
|
|
24
|
+
watchExclude: [
|
|
25
|
+
'**/node_modules/**',
|
|
26
|
+
'**/dist/**',
|
|
27
|
+
'**/demos/**',
|
|
28
|
+
'../../packages/*/dist/**',
|
|
29
|
+
'../../packages/datasets-fs/src/tests/data/**',
|
|
30
|
+
],
|
|
22
31
|
logHeapUsage: true,
|
|
23
32
|
coverage: {
|
|
24
33
|
enabled: true,
|
|
25
34
|
},
|
|
35
|
+
useAtomics: true,
|
|
26
36
|
},
|
|
27
|
-
plugins: [VitePluginSourcemapExclude({ excludeNodeModules: true })],
|
|
37
|
+
plugins: [VitePluginSourcemapExclude({ excludeNodeModules: true }), VitePluginCloseAndCopy()],
|
|
28
38
|
})
|
|
29
39
|
}
|