@prosopo/config 0.3.39 → 0.3.40
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/cjs/dependencies.cjs +149 -0
- package/dist/cjs/index.cjs +72 -0
- package/dist/cjs/polkadot/exclude.cjs +150 -0
- package/dist/cjs/polkadot/index.cjs +4 -0
- package/dist/cjs/projectInfo.cjs +89 -0
- package/dist/cjs/provider/index.cjs +4 -0
- package/dist/cjs/provider/test.cjs +35 -0
- package/dist/cjs/vite/index.cjs +16 -0
- package/dist/cjs/vite/vite-plugin-close-and-copy.cjs +40 -0
- package/dist/cjs/vite/vite-plugin-fix-absolute-imports.cjs +23 -0
- package/dist/cjs/vite/vite-plugin-sourcemap-exclude.cjs +17 -0
- package/dist/cjs/vite/vite.backend.config.cjs +94 -0
- package/dist/cjs/vite/vite.commonjs.config.cjs +52 -0
- package/dist/cjs/vite/vite.frontend.config.cjs +162 -0
- package/dist/cjs/vite/vite.test.config.cjs +39 -0
- package/dist/cjs/webpack/index.cjs +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/polkadot/exclude.d.ts +1 -1
- package/dist/polkadot/exclude.d.ts.map +1 -1
- package/dist/polkadot/exclude.js +11 -6
- package/dist/polkadot/exclude.js.map +1 -1
- package/dist/vite/vite.frontend.config.d.ts +1 -1
- package/dist/vite/vite.frontend.config.d.ts.map +1 -1
- package/dist/vite/vite.frontend.config.js +2 -2
- package/dist/vite/vite.frontend.config.js.map +1 -1
- package/dist/webpack/index.d.ts +2 -0
- package/dist/webpack/index.d.ts.map +1 -0
- package/dist/webpack/index.js +2 -0
- package/dist/webpack/index.js.map +1 -0
- package/package.json +44 -11
- package/vite.cjs.config.ts +19 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const glob = require("glob");
|
|
4
|
+
const common = require("@prosopo/common");
|
|
5
|
+
const util$1 = require("@prosopo/util");
|
|
6
|
+
const child_process = require("child_process");
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
const path = require("path");
|
|
9
|
+
const util = require("util");
|
|
10
|
+
const logger = common.getLogger(`Info`, `config.dependencies.js`);
|
|
11
|
+
const exec = util.promisify(child_process.exec);
|
|
12
|
+
const tsConfigRegex = /\/[A-Za-z.]*\.json$/;
|
|
13
|
+
const peerDepsRegex = /UNMET\sOPTIONAL\sDEPENDENCY\s+(@*[\w\-/.]+)@/;
|
|
14
|
+
const depsRegex = /\s+(@*[\w\-/.]+)@/;
|
|
15
|
+
async function getPackageDir(packageName) {
|
|
16
|
+
let pkg = packageName;
|
|
17
|
+
if (packageName && !packageName.startsWith("@prosopo/")) {
|
|
18
|
+
pkg = `@prosopo/${packageName}`;
|
|
19
|
+
}
|
|
20
|
+
const pkgCommand = `npm list ${pkg} -ap`;
|
|
21
|
+
logger.info(`Running command ${pkgCommand}`);
|
|
22
|
+
const { stdout: packageDir, stderr } = await exec(pkgCommand);
|
|
23
|
+
if (stderr) {
|
|
24
|
+
throw new common.ProsopoEnvError("CONFIG.INVALID_PACKAGE_DIR", { context: { stderr } });
|
|
25
|
+
}
|
|
26
|
+
return packageDir.trim() || path.resolve();
|
|
27
|
+
}
|
|
28
|
+
function getReferenceTsConfigPath(initialTsConfigPath, reference) {
|
|
29
|
+
let refTSConfigPath = path.resolve(initialTsConfigPath.replace(tsConfigRegex, ""), reference.path);
|
|
30
|
+
if (!refTSConfigPath.endsWith(".json")) {
|
|
31
|
+
refTSConfigPath = path.resolve(refTSConfigPath, "tsconfig.json");
|
|
32
|
+
}
|
|
33
|
+
return refTSConfigPath;
|
|
34
|
+
}
|
|
35
|
+
function getTsConfigs(tsConfigPath, ignorePatterns = [], tsConfigPaths = [], includeInitialTsConfig = true) {
|
|
36
|
+
let tsConfigs = [...tsConfigPaths];
|
|
37
|
+
const references = JSON.parse(fs.readFileSync(tsConfigPath).toString()).references;
|
|
38
|
+
if (!tsConfigs.includes(tsConfigPath)) {
|
|
39
|
+
const ignore = ignorePatterns && ignorePatterns.length > 0 ? new RegExp(`${ignorePatterns.join("|")}`) : void 0;
|
|
40
|
+
if (includeInitialTsConfig) {
|
|
41
|
+
tsConfigs.push(tsConfigPath);
|
|
42
|
+
}
|
|
43
|
+
const filteredReferences = references.filter(
|
|
44
|
+
(reference) => ignore ? !ignore.test(reference.path) : false
|
|
45
|
+
);
|
|
46
|
+
for (const reference of filteredReferences) {
|
|
47
|
+
const refTSConfigPath = getReferenceTsConfigPath(tsConfigPath, reference);
|
|
48
|
+
const newTsConfigs = getTsConfigs(refTSConfigPath, ignorePatterns, tsConfigs);
|
|
49
|
+
if (newTsConfigs.length > 0) {
|
|
50
|
+
const distinctTsConfigPaths = new Set(tsConfigs.concat(newTsConfigs));
|
|
51
|
+
tsConfigs = [...distinctTsConfigPaths];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return tsConfigs;
|
|
56
|
+
}
|
|
57
|
+
async function getExternalsFromReferences(tsConfigPath, ignorePatterns = []) {
|
|
58
|
+
const tsConfigPaths = getTsConfigs(tsConfigPath, ignorePatterns, [], false);
|
|
59
|
+
logger.debug("tsConfigPaths", tsConfigPaths);
|
|
60
|
+
const promises = [];
|
|
61
|
+
for (const refTsConfigPath of tsConfigPaths) {
|
|
62
|
+
const packageJsonPath = path.resolve(refTsConfigPath.replace(tsConfigRegex, ""), "package.json");
|
|
63
|
+
promises.push(
|
|
64
|
+
new Promise((resolve, reject) => {
|
|
65
|
+
fs.stat(packageJsonPath, (err) => {
|
|
66
|
+
if (err) {
|
|
67
|
+
reject(err);
|
|
68
|
+
}
|
|
69
|
+
fs.readFile(new URL(packageJsonPath, module), function(err2, buffer) {
|
|
70
|
+
if (err2) {
|
|
71
|
+
reject(err2);
|
|
72
|
+
} else {
|
|
73
|
+
const packageJson = JSON.parse(buffer.toString());
|
|
74
|
+
const pkg = packageJson.name;
|
|
75
|
+
resolve(pkg);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
const externals = await Promise.all(promises);
|
|
83
|
+
logger.debug("externals", externals);
|
|
84
|
+
return externals;
|
|
85
|
+
}
|
|
86
|
+
async function getDependencies(packageName, production) {
|
|
87
|
+
let cmd = production ? "npm ls -a --omit=dev" : "npm ls -a";
|
|
88
|
+
if (packageName) {
|
|
89
|
+
const packageDir = await getPackageDir(packageName);
|
|
90
|
+
cmd = `cd ${packageDir.trim()} && ${cmd}`;
|
|
91
|
+
logger.info(`Running command ${cmd} in ${packageDir}`);
|
|
92
|
+
}
|
|
93
|
+
const { stdout, stderr } = await exec(cmd);
|
|
94
|
+
if (stderr) {
|
|
95
|
+
throw new common.ProsopoEnvError("CONFIG.INVALID_PACKAGE_DIR", { context: { stderr } });
|
|
96
|
+
}
|
|
97
|
+
const deps = [];
|
|
98
|
+
const peerDeps = [];
|
|
99
|
+
stdout.split("\n").forEach((line) => {
|
|
100
|
+
if (line.includes("UNMET OPTIONAL DEPENDENCY")) {
|
|
101
|
+
const parts = line.match(peerDepsRegex);
|
|
102
|
+
if (parts && parts.length > 1) {
|
|
103
|
+
peerDeps.push(util$1.at(parts, 1));
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
const parts = line.match(depsRegex);
|
|
107
|
+
if (parts && parts.length > 1) {
|
|
108
|
+
deps.push(util$1.at(parts, 1));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return {
|
|
113
|
+
dependencies: deps.filter((x, i) => i === deps.indexOf(x)),
|
|
114
|
+
optionalPeerDependencies: peerDeps.filter((x, i) => i === peerDeps.indexOf(x))
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function filterDependencies(deps, filters) {
|
|
118
|
+
const depsDeduped = deps.filter((x, i) => i === deps.indexOf(x));
|
|
119
|
+
const depsWithLength = depsDeduped.filter((dep) => dep.length > 0).sort();
|
|
120
|
+
const exclude = new RegExp(`${filters.join("|")}`);
|
|
121
|
+
const internal = [];
|
|
122
|
+
const external = [];
|
|
123
|
+
for (const dep of depsWithLength) {
|
|
124
|
+
if (exclude.test(dep)) {
|
|
125
|
+
external.push(dep);
|
|
126
|
+
} else {
|
|
127
|
+
internal.push(dep);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return { internal, external };
|
|
131
|
+
}
|
|
132
|
+
function getFilesInDirs(startDir, includePatterns = [], excludePatterns = []) {
|
|
133
|
+
const files = [];
|
|
134
|
+
logger.info(`getFilesInDirs: ${startDir} excluding ${includePatterns} including ${excludePatterns}`);
|
|
135
|
+
const ignorePatterns = excludePatterns.map((pattern) => `${startDir}/**/${pattern}`);
|
|
136
|
+
includePatterns.forEach((searchPattern) => {
|
|
137
|
+
const globPattern = `${startDir}/**/${searchPattern}${searchPattern.indexOf(".") > -1 ? "" : "/*"}`;
|
|
138
|
+
const globResult = new glob.Glob(globPattern, { recursive: true, ignore: ignorePatterns }).walkSync();
|
|
139
|
+
for (const filePath of globResult) {
|
|
140
|
+
files.push(filePath);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
return files;
|
|
144
|
+
}
|
|
145
|
+
exports.filterDependencies = filterDependencies;
|
|
146
|
+
exports.getDependencies = getDependencies;
|
|
147
|
+
exports.getExternalsFromReferences = getExternalsFromReferences;
|
|
148
|
+
exports.getFilesInDirs = getFilesInDirs;
|
|
149
|
+
exports.getTsConfigs = getTsConfigs;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("./vite/index.cjs");
|
|
4
|
+
const dependencies = require("./dependencies.cjs");
|
|
5
|
+
require("./polkadot/index.cjs");
|
|
6
|
+
require("./provider/index.cjs");
|
|
7
|
+
const projectInfo = require("./projectInfo.cjs");
|
|
8
|
+
require("./webpack/index.cjs");
|
|
9
|
+
const vitePluginCloseAndCopy = require("./vite/vite-plugin-close-and-copy.cjs");
|
|
10
|
+
const vite_test_config = require("./vite/vite.test.config.cjs");
|
|
11
|
+
const vitePluginSourcemapExclude = require("./vite/vite-plugin-sourcemap-exclude.cjs");
|
|
12
|
+
const vite_frontend_config = require("./vite/vite.frontend.config.cjs");
|
|
13
|
+
const vite_backend_config = require("./vite/vite.backend.config.cjs");
|
|
14
|
+
const vitePluginFixAbsoluteImports = require("./vite/vite-plugin-fix-absolute-imports.cjs");
|
|
15
|
+
const vite_commonjs_config = require("./vite/vite.commonjs.config.cjs");
|
|
16
|
+
const exclude = require("./polkadot/exclude.cjs");
|
|
17
|
+
const test = require("./provider/test.cjs");
|
|
18
|
+
exports.filterDependencies = dependencies.filterDependencies;
|
|
19
|
+
exports.getDependencies = dependencies.getDependencies;
|
|
20
|
+
exports.getExternalsFromReferences = dependencies.getExternalsFromReferences;
|
|
21
|
+
exports.getFilesInDirs = dependencies.getFilesInDirs;
|
|
22
|
+
exports.getTsConfigs = dependencies.getTsConfigs;
|
|
23
|
+
exports.getAccountPkgDir = projectInfo.getAccountPkgDir;
|
|
24
|
+
exports.getApiPkgDir = projectInfo.getApiPkgDir;
|
|
25
|
+
exports.getCacheDir = projectInfo.getCacheDir;
|
|
26
|
+
exports.getCliPkgDir = projectInfo.getCliPkgDir;
|
|
27
|
+
exports.getClientBundleExampleDir = projectInfo.getClientBundleExampleDir;
|
|
28
|
+
exports.getClientExampleDir = projectInfo.getClientExampleDir;
|
|
29
|
+
exports.getClientExampleServerDir = projectInfo.getClientExampleServerDir;
|
|
30
|
+
exports.getCommonPkgDir = projectInfo.getCommonPkgDir;
|
|
31
|
+
exports.getConfigPkgDir = projectInfo.getConfigPkgDir;
|
|
32
|
+
exports.getContractDir = projectInfo.getContractDir;
|
|
33
|
+
exports.getContractNames = projectInfo.getContractNames;
|
|
34
|
+
exports.getContractsDir = projectInfo.getContractsDir;
|
|
35
|
+
exports.getDappExampleDir = projectInfo.getDappExampleDir;
|
|
36
|
+
exports.getDatabasePkgDir = projectInfo.getDatabasePkgDir;
|
|
37
|
+
exports.getDatasetsFsPkgDir = projectInfo.getDatasetsFsPkgDir;
|
|
38
|
+
exports.getDatasetsPkgDir = projectInfo.getDatasetsPkgDir;
|
|
39
|
+
exports.getDemosDir = projectInfo.getDemosDir;
|
|
40
|
+
exports.getDevDir = projectInfo.getDevDir;
|
|
41
|
+
exports.getEnvPkgDir = projectInfo.getEnvPkgDir;
|
|
42
|
+
exports.getFileServerPkgDir = projectInfo.getFileServerPkgDir;
|
|
43
|
+
exports.getNodeModulesDir = projectInfo.getNodeModulesDir;
|
|
44
|
+
exports.getPackagesDir = projectInfo.getPackagesDir;
|
|
45
|
+
exports.getProcaptchaBundlePkgDir = projectInfo.getProcaptchaBundlePkgDir;
|
|
46
|
+
exports.getProcaptchaPkgDir = projectInfo.getProcaptchaPkgDir;
|
|
47
|
+
exports.getProcaptchaPoWPkgDir = projectInfo.getProcaptchaPoWPkgDir;
|
|
48
|
+
exports.getProcaptchaReactPkgDir = projectInfo.getProcaptchaReactPkgDir;
|
|
49
|
+
exports.getProtocolCliDir = projectInfo.getProtocolCliDir;
|
|
50
|
+
exports.getProtocolContractsDir = projectInfo.getProtocolContractsDir;
|
|
51
|
+
exports.getProtocolDir = projectInfo.getProtocolDir;
|
|
52
|
+
exports.getProtocolDistDir = projectInfo.getProtocolDistDir;
|
|
53
|
+
exports.getProviderPkgDir = projectInfo.getProviderPkgDir;
|
|
54
|
+
exports.getRootDir = projectInfo.getRootDir;
|
|
55
|
+
exports.getScriptsPkgDir = projectInfo.getScriptsPkgDir;
|
|
56
|
+
exports.getServerPkgDir = projectInfo.getServerPkgDir;
|
|
57
|
+
exports.getTestResultsDir = projectInfo.getTestResultsDir;
|
|
58
|
+
exports.getTxPkgDir = projectInfo.getTxPkgDir;
|
|
59
|
+
exports.getTypesDatabasePkgDir = projectInfo.getTypesDatabasePkgDir;
|
|
60
|
+
exports.getTypesEnvPkgDir = projectInfo.getTypesEnvPkgDir;
|
|
61
|
+
exports.getTypesPkgDir = projectInfo.getTypesPkgDir;
|
|
62
|
+
exports.getUtilPkgDir = projectInfo.getUtilPkgDir;
|
|
63
|
+
exports.getWebComponentsPkgDir = projectInfo.getWebComponentsPkgDir;
|
|
64
|
+
exports.VitePluginCloseAndCopy = vitePluginCloseAndCopy;
|
|
65
|
+
exports.ViteTestConfig = vite_test_config;
|
|
66
|
+
exports.VitePluginSourceMapExclude = vitePluginSourcemapExclude;
|
|
67
|
+
exports.ViteFrontendConfig = vite_frontend_config;
|
|
68
|
+
exports.ViteBackendConfig = vite_backend_config;
|
|
69
|
+
exports.VitePluginFixAbsoluteImports = vitePluginFixAbsoluteImports;
|
|
70
|
+
exports.ViteCommonJSConfig = vite_commonjs_config;
|
|
71
|
+
exports.getAliases = exclude.getAliases;
|
|
72
|
+
exports.getTestConfig = test;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const common = require("@prosopo/common");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const POLKADOT_INTERFACES = [
|
|
7
|
+
"./assetConversion/definitions.js",
|
|
8
|
+
"./assets/definitions.js",
|
|
9
|
+
"./attestations/definitions.js",
|
|
10
|
+
"./aura/definitions.js",
|
|
11
|
+
"./author/definitions.js",
|
|
12
|
+
"./authorship/definitions.js",
|
|
13
|
+
"./babe/definitions.js",
|
|
14
|
+
// './balances/definitions.js',
|
|
15
|
+
"./beefy/definitions.js",
|
|
16
|
+
"./benchmark/definitions.js",
|
|
17
|
+
"./blockbuilder/definitions.js",
|
|
18
|
+
"./bridges/definitions.js",
|
|
19
|
+
// './chain/definitions.js',
|
|
20
|
+
"./childstate/definitions.js",
|
|
21
|
+
"./claims/definitions.js",
|
|
22
|
+
"./collective/definitions.js",
|
|
23
|
+
"./consensus/definitions.js",
|
|
24
|
+
// './contracts/definitions.js',
|
|
25
|
+
// './contractsAbi/definitions.js',
|
|
26
|
+
"./crowdloan/definitions.js",
|
|
27
|
+
"./cumulus/definitions.js",
|
|
28
|
+
"./democracy/definitions.js",
|
|
29
|
+
"./dev/definitions.js",
|
|
30
|
+
"./discovery/definitions.js",
|
|
31
|
+
"./elections/definitions.js",
|
|
32
|
+
"./engine/definitions.js",
|
|
33
|
+
"./eth/definitions.js",
|
|
34
|
+
"./evm/definitions.js",
|
|
35
|
+
// './extrinsics/definitions.js',
|
|
36
|
+
"./finality/definitions.js",
|
|
37
|
+
"./fungibles/definitions.js",
|
|
38
|
+
"./genericAsset/definitions.js",
|
|
39
|
+
"./gilt/definitions.js",
|
|
40
|
+
"./grandpa/definitions.js",
|
|
41
|
+
"./identity/definitions.js",
|
|
42
|
+
"./imOnline/definitions.js",
|
|
43
|
+
"./lottery/definitions.js",
|
|
44
|
+
//'./metadata/definitions.js',
|
|
45
|
+
"./mmr/definitions.js",
|
|
46
|
+
"./nfts/definitions.js",
|
|
47
|
+
"./nimbus/definitions.js",
|
|
48
|
+
"./nompools/definitions.js",
|
|
49
|
+
"./offchain/definitions.js",
|
|
50
|
+
"./offences/definitions.js",
|
|
51
|
+
"./ormlOracle/definitions.js",
|
|
52
|
+
"./ormlTokens/definitions.js",
|
|
53
|
+
"./parachains/definitions.js",
|
|
54
|
+
"./payment/definitions.js",
|
|
55
|
+
"./poll/definitions.js",
|
|
56
|
+
"./pow/definitions.js",
|
|
57
|
+
"./proxy/definitions.js",
|
|
58
|
+
"./purchase/definitions.js",
|
|
59
|
+
"./recovery/definitions.js",
|
|
60
|
+
// './rpc/definitions.js',
|
|
61
|
+
// './runtime/definitions.js',
|
|
62
|
+
//'./scaleInfo/definitions.js',
|
|
63
|
+
"./scheduler/definitions.js",
|
|
64
|
+
"./session/definitions.js",
|
|
65
|
+
"./society/definitions.js",
|
|
66
|
+
"./staking/definitions.js",
|
|
67
|
+
//'./state/definitions.js',
|
|
68
|
+
"./support/definitions.js",
|
|
69
|
+
"./syncstate/definitions.js",
|
|
70
|
+
// './system/definitions.js',
|
|
71
|
+
"./treasury/definitions.js",
|
|
72
|
+
"./txpayment/definitions.js",
|
|
73
|
+
"./txqueue/definitions.js",
|
|
74
|
+
"./uniques/definitions.js",
|
|
75
|
+
//'./utility/definitions.js',
|
|
76
|
+
"./vesting/definitions.js",
|
|
77
|
+
"./xcm/definitions.js"
|
|
78
|
+
];
|
|
79
|
+
const POLKADOT_UPGRADES = [
|
|
80
|
+
"./centrifuge-chain.js",
|
|
81
|
+
"./kusama.js",
|
|
82
|
+
"./node.js",
|
|
83
|
+
"./node-template.js",
|
|
84
|
+
"./polkadot.js",
|
|
85
|
+
"./shell.js",
|
|
86
|
+
"./statemint.js",
|
|
87
|
+
"./westend.js"
|
|
88
|
+
];
|
|
89
|
+
const API_DERIVE = [
|
|
90
|
+
//'./accounts/index.js',
|
|
91
|
+
"./alliance/index.js",
|
|
92
|
+
"./bagsList/index.js",
|
|
93
|
+
//'./balances/index.js',
|
|
94
|
+
"./bounties/index.js",
|
|
95
|
+
//'./chain/index.js',
|
|
96
|
+
//'./contracts/index.js',
|
|
97
|
+
"./council/index.js",
|
|
98
|
+
"./crowdloan/index.js",
|
|
99
|
+
"./democracy/index.js",
|
|
100
|
+
"./elections/index.js",
|
|
101
|
+
"./imOnline/index.js",
|
|
102
|
+
"./membership/index.js",
|
|
103
|
+
"./parachains/index.js",
|
|
104
|
+
"./session/index.js",
|
|
105
|
+
"./society/index.js",
|
|
106
|
+
"./staking/index.js",
|
|
107
|
+
"./technicalCommittee/index.js",
|
|
108
|
+
"./treasury/index.js"
|
|
109
|
+
//'./tx/index.js',
|
|
110
|
+
];
|
|
111
|
+
const KNOWN_SUBSTRATE_CHAINS = ["./genesis.js"];
|
|
112
|
+
const WASM_BYTES = ["./bytes.js", "./cjs/bytes.js"];
|
|
113
|
+
const log = common.getLogger(`Info`, `config.polkadot.exclude.js`);
|
|
114
|
+
function getAliases(nodeModulesDir) {
|
|
115
|
+
const alias = [];
|
|
116
|
+
if (!fs.existsSync(path.resolve(nodeModulesDir, "./node_modules"))) {
|
|
117
|
+
log.error(`node_modules not found in ${nodeModulesDir}`);
|
|
118
|
+
return alias;
|
|
119
|
+
}
|
|
120
|
+
const mockUpgrade = path.resolve(nodeModulesDir, "./node_modules/@prosopo/config/dist/polkadot/mockUpgrade.js");
|
|
121
|
+
const mockInterface = path.resolve(nodeModulesDir, "./node_modules/@prosopo/config/dist/polkadot/mockInterface.js");
|
|
122
|
+
const mockSubstrate = path.resolve(
|
|
123
|
+
nodeModulesDir,
|
|
124
|
+
"./node_modules/@prosopo/config/dist/polkadot/mockSubstrateGenesis.js"
|
|
125
|
+
);
|
|
126
|
+
const mockAPIDerive = path.resolve(nodeModulesDir, "./node_modules/@prosopo/config/dist/polkadot/mockApiDerive.js");
|
|
127
|
+
const slimmedWASM = path.resolve(nodeModulesDir, "./node_modules/@prosopo/config/dist/polkadot/bytes.js");
|
|
128
|
+
POLKADOT_UPGRADES.forEach((file) => {
|
|
129
|
+
log.debug(`resolving ${file} to ${mockUpgrade.split("/").slice(-1)}`);
|
|
130
|
+
alias.push({ find: file, replacement: mockUpgrade });
|
|
131
|
+
});
|
|
132
|
+
POLKADOT_INTERFACES.forEach((file) => {
|
|
133
|
+
log.debug(`resolving ${file} to ${mockUpgrade.split("/").slice(-1)}`);
|
|
134
|
+
alias.push({ find: file, replacement: mockInterface });
|
|
135
|
+
});
|
|
136
|
+
KNOWN_SUBSTRATE_CHAINS.forEach((file) => {
|
|
137
|
+
log.debug(`resolving ${file} to ${mockUpgrade.split("/").slice(-1)}`);
|
|
138
|
+
alias.push({ find: file, replacement: mockSubstrate });
|
|
139
|
+
});
|
|
140
|
+
WASM_BYTES.forEach((file) => {
|
|
141
|
+
log.debug(`resolving ${file} to ${mockUpgrade.split("/").slice(-1)}`);
|
|
142
|
+
alias.push({ find: file, replacement: slimmedWASM });
|
|
143
|
+
});
|
|
144
|
+
API_DERIVE.forEach((file) => {
|
|
145
|
+
log.debug(`resolving ${file} to ${mockUpgrade.split("/").slice(-1)}`);
|
|
146
|
+
alias.push({ find: file, replacement: mockAPIDerive });
|
|
147
|
+
});
|
|
148
|
+
return alias;
|
|
149
|
+
}
|
|
150
|
+
exports.getAliases = getAliases;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const getContractNames = () => {
|
|
5
|
+
return fs.readdirSync(getProtocolContractsDir()).filter((name) => {
|
|
6
|
+
return fs.statSync(`${getProtocolContractsDir()}/${name}`).isDirectory();
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
const getRootDir = () => new URL("../../..", module).pathname.slice(0, -1);
|
|
10
|
+
const getCacheDir = () => `${getRootDir()}/.cache`;
|
|
11
|
+
const getTestResultsDir = () => `${getCacheDir()}/test-results`;
|
|
12
|
+
const getDevDir = () => `${getRootDir()}/dev`;
|
|
13
|
+
const getDemosDir = () => `${getRootDir()}/demos`;
|
|
14
|
+
const getContractDir = () => `${getRootDir()}/packages/contract`;
|
|
15
|
+
const getProtocolDir = () => `${getRootDir()}/protocol`;
|
|
16
|
+
const getPackagesDir = () => `${getRootDir()}/packages`;
|
|
17
|
+
const getNodeModulesDir = () => `${getRootDir()}/node_modules`;
|
|
18
|
+
const getConfigPkgDir = () => `${getDevDir()}/config`;
|
|
19
|
+
const getScriptsPkgDir = () => `${getDevDir()}/scripts`;
|
|
20
|
+
const getProtocolCliDir = () => `${getProtocolDir()}/dist/cli`;
|
|
21
|
+
const getProtocolDistDir = () => `${getProtocolDir()}/target/ink`;
|
|
22
|
+
const getClientExampleDir = () => `${getDemosDir()}/client-example`;
|
|
23
|
+
const getClientExampleServerDir = () => `${getDemosDir()}/client-example-server`;
|
|
24
|
+
const getClientBundleExampleDir = () => `${getDemosDir()}/client-bundle-example`;
|
|
25
|
+
const getDappExampleDir = () => `${getDemosDir()}/dapp-example`;
|
|
26
|
+
const getCommonPkgDir = () => `${getPackagesDir()}/common`;
|
|
27
|
+
const getAccountPkgDir = () => `${getPackagesDir()}/account`;
|
|
28
|
+
const getApiPkgDir = () => `${getPackagesDir()}/api`;
|
|
29
|
+
const getCliPkgDir = () => `${getPackagesDir()}/cli`;
|
|
30
|
+
const getUtilPkgDir = () => `${getPackagesDir()}/util`;
|
|
31
|
+
const getDatabasePkgDir = () => `${getPackagesDir()}/database`;
|
|
32
|
+
const getDatasetsPkgDir = () => `${getPackagesDir()}/datasets`;
|
|
33
|
+
const getDatasetsFsPkgDir = () => `${getPackagesDir()}/datasets-fs`;
|
|
34
|
+
const getEnvPkgDir = () => `${getPackagesDir()}/env`;
|
|
35
|
+
const getFileServerPkgDir = () => `${getPackagesDir()}/file-server`;
|
|
36
|
+
const getProcaptchaPkgDir = () => `${getPackagesDir()}/procaptcha`;
|
|
37
|
+
const getProcaptchaReactPkgDir = () => `${getPackagesDir()}/procaptcha-react`;
|
|
38
|
+
const getProcaptchaBundlePkgDir = () => `${getPackagesDir()}/procaptcha-bundle`;
|
|
39
|
+
const getProcaptchaPoWPkgDir = () => `${getPackagesDir()}/procaptcha-pow`;
|
|
40
|
+
const getProviderPkgDir = () => `${getPackagesDir()}/provider`;
|
|
41
|
+
const getServerPkgDir = () => `${getPackagesDir()}/server`;
|
|
42
|
+
const getTypesDatabasePkgDir = () => `${getPackagesDir()}/types-database`;
|
|
43
|
+
const getTypesEnvPkgDir = () => `${getPackagesDir()}/types-env`;
|
|
44
|
+
const getTypesPkgDir = () => `${getPackagesDir()}/types`;
|
|
45
|
+
const getTxPkgDir = () => `${getPackagesDir()}/tx`;
|
|
46
|
+
const getWebComponentsPkgDir = () => `${getPackagesDir()}/web-components`;
|
|
47
|
+
const getContractsDir = () => `${getRootDir()}/contracts`;
|
|
48
|
+
const getProtocolContractsDir = () => `${getProtocolDir()}/contracts`;
|
|
49
|
+
exports.getAccountPkgDir = getAccountPkgDir;
|
|
50
|
+
exports.getApiPkgDir = getApiPkgDir;
|
|
51
|
+
exports.getCacheDir = getCacheDir;
|
|
52
|
+
exports.getCliPkgDir = getCliPkgDir;
|
|
53
|
+
exports.getClientBundleExampleDir = getClientBundleExampleDir;
|
|
54
|
+
exports.getClientExampleDir = getClientExampleDir;
|
|
55
|
+
exports.getClientExampleServerDir = getClientExampleServerDir;
|
|
56
|
+
exports.getCommonPkgDir = getCommonPkgDir;
|
|
57
|
+
exports.getConfigPkgDir = getConfigPkgDir;
|
|
58
|
+
exports.getContractDir = getContractDir;
|
|
59
|
+
exports.getContractNames = getContractNames;
|
|
60
|
+
exports.getContractsDir = getContractsDir;
|
|
61
|
+
exports.getDappExampleDir = getDappExampleDir;
|
|
62
|
+
exports.getDatabasePkgDir = getDatabasePkgDir;
|
|
63
|
+
exports.getDatasetsFsPkgDir = getDatasetsFsPkgDir;
|
|
64
|
+
exports.getDatasetsPkgDir = getDatasetsPkgDir;
|
|
65
|
+
exports.getDemosDir = getDemosDir;
|
|
66
|
+
exports.getDevDir = getDevDir;
|
|
67
|
+
exports.getEnvPkgDir = getEnvPkgDir;
|
|
68
|
+
exports.getFileServerPkgDir = getFileServerPkgDir;
|
|
69
|
+
exports.getNodeModulesDir = getNodeModulesDir;
|
|
70
|
+
exports.getPackagesDir = getPackagesDir;
|
|
71
|
+
exports.getProcaptchaBundlePkgDir = getProcaptchaBundlePkgDir;
|
|
72
|
+
exports.getProcaptchaPkgDir = getProcaptchaPkgDir;
|
|
73
|
+
exports.getProcaptchaPoWPkgDir = getProcaptchaPoWPkgDir;
|
|
74
|
+
exports.getProcaptchaReactPkgDir = getProcaptchaReactPkgDir;
|
|
75
|
+
exports.getProtocolCliDir = getProtocolCliDir;
|
|
76
|
+
exports.getProtocolContractsDir = getProtocolContractsDir;
|
|
77
|
+
exports.getProtocolDir = getProtocolDir;
|
|
78
|
+
exports.getProtocolDistDir = getProtocolDistDir;
|
|
79
|
+
exports.getProviderPkgDir = getProviderPkgDir;
|
|
80
|
+
exports.getRootDir = getRootDir;
|
|
81
|
+
exports.getScriptsPkgDir = getScriptsPkgDir;
|
|
82
|
+
exports.getServerPkgDir = getServerPkgDir;
|
|
83
|
+
exports.getTestResultsDir = getTestResultsDir;
|
|
84
|
+
exports.getTxPkgDir = getTxPkgDir;
|
|
85
|
+
exports.getTypesDatabasePkgDir = getTypesDatabasePkgDir;
|
|
86
|
+
exports.getTypesEnvPkgDir = getTypesEnvPkgDir;
|
|
87
|
+
exports.getTypesPkgDir = getTypesPkgDir;
|
|
88
|
+
exports.getUtilPkgDir = getUtilPkgDir;
|
|
89
|
+
exports.getWebComponentsPkgDir = getWebComponentsPkgDir;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const types = require("@prosopo/types");
|
|
3
|
+
const common = require("@prosopo/common");
|
|
4
|
+
const logLevel = common.getLogLevel();
|
|
5
|
+
function getTestConfig() {
|
|
6
|
+
return types.ProsopoConfigSchema.parse({
|
|
7
|
+
logLevel,
|
|
8
|
+
defaultEnvironment: types.EnvironmentTypesSchema.Values.development,
|
|
9
|
+
defaultNetwork: types.NetworkNamesSchema.Values.development,
|
|
10
|
+
account: {
|
|
11
|
+
password: "",
|
|
12
|
+
address: ""
|
|
13
|
+
},
|
|
14
|
+
database: {
|
|
15
|
+
development: { type: types.DatabaseTypes.enum.mongoMemory, endpoint: "", dbname: "prosopo_test", authSource: "" }
|
|
16
|
+
},
|
|
17
|
+
server: {
|
|
18
|
+
baseURL: "http://localhost",
|
|
19
|
+
port: 9229,
|
|
20
|
+
fileServePaths: "[]"
|
|
21
|
+
},
|
|
22
|
+
networks: {
|
|
23
|
+
development: {
|
|
24
|
+
endpoint: "ws://localhost:9944",
|
|
25
|
+
contract: {
|
|
26
|
+
address: process.env.PROSOPO_CONTRACT_ADDRESS || "",
|
|
27
|
+
name: "prosopo"
|
|
28
|
+
},
|
|
29
|
+
pairType: types.NetworkPairTypeSchema.parse("sr25519"),
|
|
30
|
+
ss58Format: 42
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
module.exports = getTestConfig;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const vitePluginCloseAndCopy = require("./vite-plugin-close-and-copy.cjs");
|
|
4
|
+
const vite_test_config = require("./vite.test.config.cjs");
|
|
5
|
+
const vitePluginSourcemapExclude = require("./vite-plugin-sourcemap-exclude.cjs");
|
|
6
|
+
const vite_frontend_config = require("./vite.frontend.config.cjs");
|
|
7
|
+
const vite_backend_config = require("./vite.backend.config.cjs");
|
|
8
|
+
const vitePluginFixAbsoluteImports = require("./vite-plugin-fix-absolute-imports.cjs");
|
|
9
|
+
const vite_commonjs_config = require("./vite.commonjs.config.cjs");
|
|
10
|
+
exports.VitePluginCloseAndCopy = vitePluginCloseAndCopy;
|
|
11
|
+
exports.ViteTestConfig = vite_test_config;
|
|
12
|
+
exports.VitePluginSourceMapExclude = vitePluginSourcemapExclude;
|
|
13
|
+
exports.ViteFrontendConfig = vite_frontend_config;
|
|
14
|
+
exports.ViteBackendConfig = vite_backend_config;
|
|
15
|
+
exports.VitePluginFixAbsoluteImports = vitePluginFixAbsoluteImports;
|
|
16
|
+
exports.ViteCommonJSConfig = vite_commonjs_config;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const common = require("@prosopo/common");
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const log = common.getLogger(`Info`, `config.vite.vite-plugin-close.js`);
|
|
6
|
+
function VitePluginCloseAndCopy(options) {
|
|
7
|
+
const __dirname = path.resolve();
|
|
8
|
+
return {
|
|
9
|
+
name: "close-plugin",
|
|
10
|
+
// required, will show up in warnings and errors
|
|
11
|
+
buildStart() {
|
|
12
|
+
log.info("Bundle build started");
|
|
13
|
+
},
|
|
14
|
+
buildEnd(error) {
|
|
15
|
+
log.info("Build end");
|
|
16
|
+
if (error) {
|
|
17
|
+
console.log(error);
|
|
18
|
+
log.error(error);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
closeBundle() {
|
|
22
|
+
if (options) {
|
|
23
|
+
options.destDir.forEach((destDir) => {
|
|
24
|
+
clearOutputDirJS(__dirname, destDir);
|
|
25
|
+
log.info(`Bundle cleared from ${options.destDir}`);
|
|
26
|
+
copyBundle(__dirname, options.srcDir, destDir);
|
|
27
|
+
log.info(`Bundle copied to ${options.destDir}`);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
log.info("Bundle closed");
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const clearOutputDirJS = (__dirname, destDir) => fs.readdirSync(path.resolve(__dirname, destDir)).filter((file) => file.endsWith("js")).map((file) => {
|
|
35
|
+
fs.rmSync(path.resolve(__dirname, destDir, file));
|
|
36
|
+
});
|
|
37
|
+
const copyBundle = (__dirname, srcDir, destDir) => fs.readdirSync(path.resolve(__dirname, srcDir)).filter((file) => file.endsWith("js")).map((file) => {
|
|
38
|
+
fs.copyFileSync(path.resolve(__dirname, srcDir, file), path.resolve(__dirname, destDir, file));
|
|
39
|
+
});
|
|
40
|
+
module.exports = VitePluginCloseAndCopy;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const module$1 = require("module");
|
|
3
|
+
function VitePluginFixAbsoluteImports() {
|
|
4
|
+
return {
|
|
5
|
+
name: "fix-absolute-imports",
|
|
6
|
+
transform(code, id) {
|
|
7
|
+
for (const module2 of module$1.builtinModules) {
|
|
8
|
+
const moduleImportRegex = new RegExp(`from "(${module2}(/.*)*/.*.js)";`, "g");
|
|
9
|
+
const matches = code.match(moduleImportRegex);
|
|
10
|
+
if (matches) {
|
|
11
|
+
for (const match of matches) {
|
|
12
|
+
code = code.replace(match, `from "${module2}";`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
code
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
enforce: "post"
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
module.exports = VitePluginFixAbsoluteImports;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function VitePluginSourcemapExclude(opts) {
|
|
3
|
+
return {
|
|
4
|
+
name: "sourcemap-exclude",
|
|
5
|
+
transform(code, id) {
|
|
6
|
+
if (opts?.excludeNodeModules && id.includes("node_modules")) {
|
|
7
|
+
return {
|
|
8
|
+
code,
|
|
9
|
+
// https://github.com/rollup/rollup/blob/master/docs/plugin-development/index.md#source-code-transformations
|
|
10
|
+
map: { mappings: "" }
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
module.exports = VitePluginSourcemapExclude;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const vitePluginCloseAndCopy = require("./vite-plugin-close-and-copy.cjs");
|
|
3
|
+
const module$1 = require("module");
|
|
4
|
+
const dependencies = require("../dependencies.cjs");
|
|
5
|
+
const common = require("@prosopo/common");
|
|
6
|
+
const nodeResolve = require("@rollup/plugin-node-resolve");
|
|
7
|
+
const pluginWasm = require("@rollup/plugin-wasm");
|
|
8
|
+
const vitePluginFixAbsoluteImports = require("./vite-plugin-fix-absolute-imports.cjs");
|
|
9
|
+
const css = require("rollup-plugin-import-css");
|
|
10
|
+
const path = require("path");
|
|
11
|
+
const logger = common.getLogger(`Info`, `vite.backend.config.js`);
|
|
12
|
+
async function vite_backend_config(packageName, packageVersion, bundleName, packageDir, entry, command, mode, optionalBaseDir = "../..") {
|
|
13
|
+
const isProduction = mode === "production";
|
|
14
|
+
const { dependencies: deps, optionalPeerDependencies } = await dependencies.getDependencies(packageName, true);
|
|
15
|
+
const outDir = path.resolve(packageDir, "dist/bundle");
|
|
16
|
+
const { external, internal } = dependencies.filterDependencies(deps, ["aws", "webpack", "vite", "eslint"]);
|
|
17
|
+
const allExternal = [
|
|
18
|
+
...module$1.builtinModules,
|
|
19
|
+
...module$1.builtinModules.map((m) => `node:${m}`),
|
|
20
|
+
...external,
|
|
21
|
+
...optionalPeerDependencies
|
|
22
|
+
];
|
|
23
|
+
logger.info(`Bundling. ${JSON.stringify(internal.slice(0, 10), null, 2)}... ${internal.length} deps`);
|
|
24
|
+
const define = {
|
|
25
|
+
"process.env.WS_NO_BUFFER_UTIL": "true",
|
|
26
|
+
"process.env.WS_NO_UTF_8_VALIDATE": "true",
|
|
27
|
+
"process.env.PROSOPO_PACKAGE_VERSION": JSON.stringify(packageVersion),
|
|
28
|
+
...process.env.PROSOPO_DEFAULT_ENVIRONMENT && {
|
|
29
|
+
"process.env.PROSOPO_DEFAULT_ENVIRONMENT": JSON.stringify(process.env.PROSOPO_DEFAULT_ENVIRONMENT)
|
|
30
|
+
},
|
|
31
|
+
...process.env.PROSOPO_DEFAULT_NETWORK && {
|
|
32
|
+
"process.env.PROSOPO_DEFAULT_NETWORK": JSON.stringify(process.env.PROSOPO_DEFAULT_NETWORK)
|
|
33
|
+
},
|
|
34
|
+
...process.env.PROSOPO_SUBSTRATE_ENDPOINT && {
|
|
35
|
+
"process.env.PROSOPO_SUBSTRATE_ENDPOINT": JSON.stringify(process.env.PROSOPO_SUBSTRATE_ENDPOINT)
|
|
36
|
+
},
|
|
37
|
+
...process.env.PROSOPO_CONTRACT_ADDRESS && {
|
|
38
|
+
"process.env.PROSOPO_CONTRACT_ADDRESS": JSON.stringify(process.env.PROSOPO_CONTRACT_ADDRESS)
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
logger.info(`Defined vars ${JSON.stringify(define, null, 2)}`);
|
|
42
|
+
const entryAbsolute = path.resolve(packageDir, entry);
|
|
43
|
+
const drop = mode === "production" ? ["console", "debugger"] : void 0;
|
|
44
|
+
return {
|
|
45
|
+
ssr: {
|
|
46
|
+
noExternal: internal,
|
|
47
|
+
external: allExternal
|
|
48
|
+
},
|
|
49
|
+
optimizeDeps: {
|
|
50
|
+
include: ["linked-dep", "node_modules"],
|
|
51
|
+
esbuildOptions: {
|
|
52
|
+
loader: {
|
|
53
|
+
".node": "file"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
esbuild: {
|
|
58
|
+
platform: "node",
|
|
59
|
+
target: "node18",
|
|
60
|
+
drop,
|
|
61
|
+
legalComments: "none"
|
|
62
|
+
},
|
|
63
|
+
define,
|
|
64
|
+
build: {
|
|
65
|
+
outDir,
|
|
66
|
+
minify: isProduction,
|
|
67
|
+
ssr: true,
|
|
68
|
+
target: "node18",
|
|
69
|
+
lib: {
|
|
70
|
+
entry: entryAbsolute,
|
|
71
|
+
name: bundleName,
|
|
72
|
+
fileName: `${bundleName}.[name].bundle.js`,
|
|
73
|
+
formats: ["es"]
|
|
74
|
+
},
|
|
75
|
+
modulePreload: { polyfill: false },
|
|
76
|
+
rollupOptions: {
|
|
77
|
+
treeshake: "smallest",
|
|
78
|
+
external: allExternal,
|
|
79
|
+
watch: false,
|
|
80
|
+
output: {
|
|
81
|
+
entryFileNames: `${bundleName}.[name].bundle.js`
|
|
82
|
+
},
|
|
83
|
+
plugins: [css(), pluginWasm.wasm(), nodeResolve.nodeResolve()]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
plugins: [
|
|
87
|
+
// plugin to replace stuff like import blah from string_encoder/lib/string_encoder.js with import blah from string_encoder
|
|
88
|
+
vitePluginFixAbsoluteImports(),
|
|
89
|
+
// plugin to close the bundle after build if not in serve mode
|
|
90
|
+
command !== "serve" ? vitePluginCloseAndCopy() : void 0
|
|
91
|
+
]
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
module.exports = vite_backend_config;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const vite = require("vite");
|
|
3
|
+
const module$1 = require("module");
|
|
4
|
+
const dependencies = require("../dependencies.cjs");
|
|
5
|
+
const common = require("@prosopo/common");
|
|
6
|
+
const noBundlePlugin = require("vite-plugin-no-bundle");
|
|
7
|
+
const vitePluginCloseAndCopy = require("./vite-plugin-close-and-copy.cjs");
|
|
8
|
+
const path = require("path");
|
|
9
|
+
const replace = require("@rollup/plugin-replace");
|
|
10
|
+
const viteTsconfigPaths = require("vite-tsconfig-paths");
|
|
11
|
+
const log = common.getLogger(`Info`, `vite.commonjs.config.ts`);
|
|
12
|
+
async function vite_commonjs_config(name, tsConfigPath, entry) {
|
|
13
|
+
log.info(`ViteCommonJSConfig: ${name}`);
|
|
14
|
+
const projectExternal = await dependencies.getExternalsFromReferences(tsConfigPath, [/dev/]);
|
|
15
|
+
const allExternal = [...module$1.builtinModules, ...module$1.builtinModules.map((m) => `node:${m}`), ...projectExternal];
|
|
16
|
+
return vite.defineConfig({
|
|
17
|
+
ssr: { external: allExternal },
|
|
18
|
+
plugins: [
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
replace({
|
|
22
|
+
"module": "module"
|
|
23
|
+
// Replaces ESM checks with CommonJS equivalent
|
|
24
|
+
}),
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
noBundlePlugin({
|
|
28
|
+
root: "src",
|
|
29
|
+
copy: "**/*.css"
|
|
30
|
+
}),
|
|
31
|
+
viteTsconfigPaths({ projects: [path.resolve(tsConfigPath)] }),
|
|
32
|
+
vitePluginCloseAndCopy()
|
|
33
|
+
],
|
|
34
|
+
build: {
|
|
35
|
+
emptyOutDir: true,
|
|
36
|
+
ssr: true,
|
|
37
|
+
target: "node18",
|
|
38
|
+
outDir: "dist/cjs",
|
|
39
|
+
lib: {
|
|
40
|
+
name,
|
|
41
|
+
formats: ["cjs"],
|
|
42
|
+
entry: entry || "src/index.ts"
|
|
43
|
+
// required
|
|
44
|
+
},
|
|
45
|
+
rollupOptions: {
|
|
46
|
+
treeshake: false,
|
|
47
|
+
external: allExternal
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
module.exports = vite_commonjs_config;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
require("./index.cjs");
|
|
3
|
+
const module$1 = require("module");
|
|
4
|
+
const dependencies = require("../dependencies.cjs");
|
|
5
|
+
require("../polkadot/index.cjs");
|
|
6
|
+
const common = require("@prosopo/common");
|
|
7
|
+
const rollupPluginVisualizer = require("rollup-plugin-visualizer");
|
|
8
|
+
const viteReact = require("@vitejs/plugin-react");
|
|
9
|
+
const pluginWasm = require("@rollup/plugin-wasm");
|
|
10
|
+
const css = require("rollup-plugin-import-css");
|
|
11
|
+
const nodeResolve = require("@rollup/plugin-node-resolve");
|
|
12
|
+
const path = require("path");
|
|
13
|
+
const typescript = require("@rollup/plugin-typescript");
|
|
14
|
+
const viteTsconfigPaths = require("vite-tsconfig-paths");
|
|
15
|
+
const exclude = require("../polkadot/exclude.cjs");
|
|
16
|
+
const vitePluginCloseAndCopy = require("./vite-plugin-close-and-copy.cjs");
|
|
17
|
+
const logger = common.getLogger(`Info`, `vite.config.js`);
|
|
18
|
+
async function vite_frontend_config(packageName, bundleName, dir, entry, command, mode, copyOptions, tsConfigPaths, workspaceRoot) {
|
|
19
|
+
logger.info(`Running at ${dir} in ${mode} mode`);
|
|
20
|
+
const isProduction = mode === "production";
|
|
21
|
+
process.env.NODE_ENV = `${mode}`;
|
|
22
|
+
logger.info(`NODE_ENV: ${process.env.NODE_ENV}`);
|
|
23
|
+
const define = {
|
|
24
|
+
// used to stop websockets package from breaking
|
|
25
|
+
"process.env.WS_NO_BUFFER_UTIL": JSON.stringify("true"),
|
|
26
|
+
"process.env.WS_NO_UTF_8_VALIDATE": JSON.stringify("true"),
|
|
27
|
+
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
|
|
28
|
+
"process.env.PROSOPO_SUBSTRATE_ENDPOINT": JSON.stringify(process.env.PROSOPO_SUBSTRATE_ENDPOINT),
|
|
29
|
+
"process.env.PROSOPO_DEFAULT_ENVIRONMENT": JSON.stringify(process.env.PROSOPO_DEFAULT_ENVIRONMENT),
|
|
30
|
+
"process.env.PROSOPO_DEFAULT_NETWORK": JSON.stringify(process.env.PROSOPO_DEFAULT_NETWORK),
|
|
31
|
+
"process.env.PROSOPO_SERVER_URL": JSON.stringify(process.env.PROSOPO_SERVER_URL),
|
|
32
|
+
"process.env._DEV_ONLY_WATCH_EVENTS": JSON.stringify(process.env._DEV_ONLY_WATCH_EVENTS),
|
|
33
|
+
"process.env.PROSOPO_MONGO_EVENTS_URI": JSON.stringify(process.env.PROSOPO_MONGO_EVENTS_URI),
|
|
34
|
+
"process.env.PROSOPO_CONTRACT_ADDRESS": JSON.stringify(process.env.PROSOPO_CONTRACT_ADDRESS),
|
|
35
|
+
"process.env.PROSOPO_PACKAGE_VERSION": JSON.stringify(process.env.PROSOPO_PACKAGE_VERSION),
|
|
36
|
+
// only needed if bundling with a site key
|
|
37
|
+
"process.env.PROSOPO_SITE_KEY": JSON.stringify(process.env.PROSOPO_SITE_KEY)
|
|
38
|
+
};
|
|
39
|
+
logger.info(`Env vars: ${JSON.stringify(define, null, 4)}`);
|
|
40
|
+
const { dependencies: deps, optionalPeerDependencies } = await dependencies.getDependencies(packageName, isProduction);
|
|
41
|
+
const { external, internal } = dependencies.filterDependencies(deps, ["pm2", "nodejs-polars", "aws", "webpack", "vite"]);
|
|
42
|
+
const allExternal = [
|
|
43
|
+
...module$1.builtinModules,
|
|
44
|
+
...module$1.builtinModules.map((m) => `node:${m}`),
|
|
45
|
+
...external,
|
|
46
|
+
...optionalPeerDependencies
|
|
47
|
+
];
|
|
48
|
+
logger.debug(`Bundling. ${JSON.stringify(internal.slice(0, 10), null, 2)}... ${internal.length} deps`);
|
|
49
|
+
const alias = exclude.getAliases(workspaceRoot || dir);
|
|
50
|
+
const proto = RegExp.prototype;
|
|
51
|
+
proto["toJSON"] = RegExp.prototype.toString;
|
|
52
|
+
logger.debug(`aliases ${JSON.stringify(alias, null, 2)}`);
|
|
53
|
+
let drop;
|
|
54
|
+
let pure = [];
|
|
55
|
+
if (isProduction) {
|
|
56
|
+
drop = ["debugger"];
|
|
57
|
+
pure = ["console.log", "console.warn", "console.info", "console.debug"];
|
|
58
|
+
}
|
|
59
|
+
logger.info("Bundle name", bundleName);
|
|
60
|
+
return {
|
|
61
|
+
ssr: {
|
|
62
|
+
target: "webworker"
|
|
63
|
+
},
|
|
64
|
+
server: {
|
|
65
|
+
host: "127.0.0.1"
|
|
66
|
+
},
|
|
67
|
+
mode: mode || "development",
|
|
68
|
+
optimizeDeps: {
|
|
69
|
+
include: ["linked-dep", "esm-dep > cjs-dep", "node_modules"],
|
|
70
|
+
force: true
|
|
71
|
+
},
|
|
72
|
+
esbuild: {
|
|
73
|
+
platform: "browser",
|
|
74
|
+
target: ["es2020", "chrome60", "edge18", "firefox60", "node12", "safari11"],
|
|
75
|
+
drop,
|
|
76
|
+
pure,
|
|
77
|
+
legalComments: "none"
|
|
78
|
+
},
|
|
79
|
+
define,
|
|
80
|
+
resolve: {
|
|
81
|
+
alias
|
|
82
|
+
},
|
|
83
|
+
build: {
|
|
84
|
+
outDir: path.resolve(dir, "dist/bundle"),
|
|
85
|
+
minify: isProduction,
|
|
86
|
+
ssr: false,
|
|
87
|
+
lib: {
|
|
88
|
+
entry: path.resolve(dir, entry),
|
|
89
|
+
name: bundleName,
|
|
90
|
+
fileName: `${bundleName}.bundle.js`,
|
|
91
|
+
formats: ["es"]
|
|
92
|
+
},
|
|
93
|
+
modulePreload: { polyfill: true },
|
|
94
|
+
commonjsOptions: {
|
|
95
|
+
exclude: ["mongodb/*"],
|
|
96
|
+
transformMixedEsModules: true,
|
|
97
|
+
strictRequires: "debug"
|
|
98
|
+
},
|
|
99
|
+
rollupOptions: {
|
|
100
|
+
treeshake: {
|
|
101
|
+
annotations: false,
|
|
102
|
+
propertyReadSideEffects: false,
|
|
103
|
+
tryCatchDeoptimization: false,
|
|
104
|
+
moduleSideEffects: "no-external",
|
|
105
|
+
//true,
|
|
106
|
+
preset: "smallest",
|
|
107
|
+
manualPureFunctions: ["createWasmFn", "unzlibSync", "withWasm", "isReady", "initBridge", "twox"],
|
|
108
|
+
unknownGlobalSideEffects: false
|
|
109
|
+
},
|
|
110
|
+
experimentalLogSideEffects: false,
|
|
111
|
+
external: allExternal,
|
|
112
|
+
watch: false,
|
|
113
|
+
output: {
|
|
114
|
+
dir: path.resolve(dir, "dist/bundle"),
|
|
115
|
+
entryFileNames: `${bundleName}.bundle.js`
|
|
116
|
+
},
|
|
117
|
+
plugins: [
|
|
118
|
+
css(),
|
|
119
|
+
pluginWasm.wasm(),
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
nodeResolve({
|
|
123
|
+
browser: true,
|
|
124
|
+
preferBuiltins: false,
|
|
125
|
+
rootDir: path.resolve(dir, "../../"),
|
|
126
|
+
dedupe: ["react", "react-dom"],
|
|
127
|
+
modulesOnly: true
|
|
128
|
+
}),
|
|
129
|
+
rollupPluginVisualizer.visualizer({
|
|
130
|
+
open: true,
|
|
131
|
+
template: "treemap",
|
|
132
|
+
//'list',
|
|
133
|
+
gzipSize: true,
|
|
134
|
+
brotliSize: true
|
|
135
|
+
}),
|
|
136
|
+
// I think we can use this plugin to build all packages instead of relying on the tsc step that's
|
|
137
|
+
// currently a precursor in package.json. However, it fails for the following reason:
|
|
138
|
+
// https://github.com/rollup/plugins/issues/243
|
|
139
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
140
|
+
// @ts-ignore
|
|
141
|
+
typescript({
|
|
142
|
+
tsconfig: path.resolve("./tsconfig.json"),
|
|
143
|
+
compilerOptions: { rootDir: path.resolve("./src") },
|
|
144
|
+
outDir: path.resolve(dir, "dist/bundle")
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
plugins: [
|
|
150
|
+
// Not sure if we need this plugin or not, it works without it
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
152
|
+
// @ts-ignore
|
|
153
|
+
viteReact(),
|
|
154
|
+
// Closes the bundler and copies the bundle to the client-bundle-example project unless we're in serve
|
|
155
|
+
// mode, in which case we don't want to close the bundler because it will close the server
|
|
156
|
+
command !== "serve" ? vitePluginCloseAndCopy(copyOptions) : void 0,
|
|
157
|
+
// Means we can specify index.tsx instead of index.jsx in the index.html file
|
|
158
|
+
viteTsconfigPaths({ projects: tsConfigPaths })
|
|
159
|
+
]
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
module.exports = vite_frontend_config;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const config = require("vitest/config");
|
|
3
|
+
const vitePluginCloseAndCopy = require("./vite-plugin-close-and-copy.cjs");
|
|
4
|
+
const vitePluginSourcemapExclude = require("./vite-plugin-sourcemap-exclude.cjs");
|
|
5
|
+
function vite_test_config() {
|
|
6
|
+
return config.defineConfig({
|
|
7
|
+
build: {
|
|
8
|
+
minify: false,
|
|
9
|
+
sourcemap: false,
|
|
10
|
+
rollupOptions: {
|
|
11
|
+
maxParallelFileOps: 1,
|
|
12
|
+
cache: false,
|
|
13
|
+
output: {
|
|
14
|
+
sourcemap: false
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
test: {
|
|
19
|
+
//root: getRootDir(),
|
|
20
|
+
reporters: ["basic"],
|
|
21
|
+
include: ["src/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
|
|
22
|
+
watch: false,
|
|
23
|
+
watchExclude: ["**/node_modules/**", "**/dist/**"],
|
|
24
|
+
logHeapUsage: true,
|
|
25
|
+
coverage: {
|
|
26
|
+
enabled: true,
|
|
27
|
+
include: ["packages/*/src/**"]
|
|
28
|
+
},
|
|
29
|
+
typecheck: {
|
|
30
|
+
enabled: true
|
|
31
|
+
},
|
|
32
|
+
pool: "forks",
|
|
33
|
+
// forks is slower than 'threads' but more compatible with low-level libs (e.g. bcrypt)
|
|
34
|
+
testTimeout: 1e4
|
|
35
|
+
},
|
|
36
|
+
plugins: [vitePluginSourcemapExclude({ excludeNodeModules: true }), vitePluginCloseAndCopy()]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
module.exports = vite_test_config;
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exclude.d.ts","sourceRoot":"","sources":["../../src/polkadot/exclude.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"exclude.d.ts","sourceRoot":"","sources":["../../src/polkadot/exclude.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAwH5B,wBAAgB,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,KAAK,EAAE,CAyC1D"}
|
package/dist/polkadot/exclude.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getLogger } from '@prosopo/common';
|
|
2
|
+
import fs from 'fs';
|
|
2
3
|
import path from 'path';
|
|
3
4
|
const POLKADOT_INTERFACES = [
|
|
4
5
|
'./assetConversion/definitions.js',
|
|
@@ -91,13 +92,17 @@ const API_DERIVE = [
|
|
|
91
92
|
const KNOWN_SUBSTRATE_CHAINS = ['./genesis.js'];
|
|
92
93
|
const WASM_BYTES = ['./bytes.js', './cjs/bytes.js'];
|
|
93
94
|
const log = getLogger(`Info`, `config.polkadot.exclude.js`);
|
|
94
|
-
export function getAliases(
|
|
95
|
+
export function getAliases(nodeModulesDir) {
|
|
95
96
|
const alias = [];
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const
|
|
97
|
+
if (!fs.existsSync(path.resolve(nodeModulesDir, './node_modules'))) {
|
|
98
|
+
log.error(`node_modules not found in ${nodeModulesDir}`);
|
|
99
|
+
return alias;
|
|
100
|
+
}
|
|
101
|
+
const mockUpgrade = path.resolve(nodeModulesDir, './node_modules/@prosopo/config/dist/polkadot/mockUpgrade.js');
|
|
102
|
+
const mockInterface = path.resolve(nodeModulesDir, './node_modules/@prosopo/config/dist/polkadot/mockInterface.js');
|
|
103
|
+
const mockSubstrate = path.resolve(nodeModulesDir, './node_modules/@prosopo/config/dist/polkadot/mockSubstrateGenesis.js');
|
|
104
|
+
const mockAPIDerive = path.resolve(nodeModulesDir, './node_modules/@prosopo/config/dist/polkadot/mockApiDerive.js');
|
|
105
|
+
const slimmedWASM = path.resolve(nodeModulesDir, './node_modules/@prosopo/config/dist/polkadot/bytes.js');
|
|
101
106
|
POLKADOT_UPGRADES.forEach((file) => {
|
|
102
107
|
log.debug(`resolving ${file} to ${mockUpgrade.split('/').slice(-1)}`);
|
|
103
108
|
alias.push({ find: file, replacement: mockUpgrade });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exclude.js","sourceRoot":"","sources":["../../src/polkadot/exclude.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,IAAI,MAAM,MAAM,CAAA;AAGvB,MAAM,mBAAmB,GAAG;IACxB,kCAAkC;IAClC,yBAAyB;IACzB,+BAA+B;IAC/B,uBAAuB;IACvB,yBAAyB;IACzB,6BAA6B;IAC7B,uBAAuB;IAEvB,wBAAwB;IACxB,4BAA4B;IAC5B,+BAA+B;IAC/B,0BAA0B;IAE1B,6BAA6B;IAC7B,yBAAyB;IACzB,6BAA6B;IAC7B,4BAA4B;IAG5B,4BAA4B;IAC5B,0BAA0B;IAC1B,4BAA4B;IAC5B,sBAAsB;IACtB,4BAA4B;IAC5B,4BAA4B;IAC5B,yBAAyB;IACzB,sBAAsB;IACtB,sBAAsB;IAEtB,2BAA2B;IAC3B,4BAA4B;IAC5B,+BAA+B;IAC/B,uBAAuB;IACvB,0BAA0B;IAC1B,2BAA2B;IAC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AAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAA;IAC1D,CAAC,CAAC,CAAA;IAEF,OAAO,KAAK,CAAA;AAChB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ClosePluginOptions } from './vite-plugin-close-and-copy.js';
|
|
2
2
|
import { UserConfig } from 'vite';
|
|
3
|
-
export default function (packageName: string, bundleName: string, dir: string, entry: string, command?: string, mode?: string, copyOptions?: ClosePluginOptions, tsConfigPaths?: string[]): Promise<UserConfig>;
|
|
3
|
+
export default function (packageName: string, bundleName: string, dir: string, entry: string, command?: string, mode?: string, copyOptions?: ClosePluginOptions, tsConfigPaths?: string[], workspaceRoot?: string): Promise<UserConfig>;
|
|
4
4
|
//# sourceMappingURL=vite.frontend.config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.frontend.config.d.ts","sourceRoot":"","sources":["../../src/vite/vite.frontend.config.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAgBjC,yBACI,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,kBAAkB,EAChC,aAAa,CAAC,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"vite.frontend.config.d.ts","sourceRoot":"","sources":["../../src/vite/vite.frontend.config.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAgBjC,yBACI,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,kBAAkB,EAChC,aAAa,CAAC,EAAE,MAAM,EAAE,EACxB,aAAa,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,UAAU,CAAC,CAkKrB"}
|
|
@@ -12,7 +12,7 @@ import path from 'path';
|
|
|
12
12
|
import typescript from '@rollup/plugin-typescript';
|
|
13
13
|
import viteTsconfigPaths from 'vite-tsconfig-paths';
|
|
14
14
|
const logger = getLogger(`Info`, `vite.config.js`);
|
|
15
|
-
export default async function (packageName, bundleName, dir, entry, command, mode, copyOptions, tsConfigPaths) {
|
|
15
|
+
export default async function (packageName, bundleName, dir, entry, command, mode, copyOptions, tsConfigPaths, workspaceRoot) {
|
|
16
16
|
logger.info(`Running at ${dir} in ${mode} mode`);
|
|
17
17
|
const isProduction = mode === 'production';
|
|
18
18
|
process.env.NODE_ENV = `${mode}`;
|
|
@@ -41,7 +41,7 @@ export default async function (packageName, bundleName, dir, entry, command, mod
|
|
|
41
41
|
...optionalPeerDependencies,
|
|
42
42
|
];
|
|
43
43
|
logger.debug(`Bundling. ${JSON.stringify(internal.slice(0, 10), null, 2)}... ${internal.length} deps`);
|
|
44
|
-
const alias = getAliases(dir);
|
|
44
|
+
const alias = getAliases(workspaceRoot || dir);
|
|
45
45
|
const proto = RegExp.prototype;
|
|
46
46
|
proto['toJSON'] = RegExp.prototype.toString;
|
|
47
47
|
logger.debug(`aliases ${JSON.stringify(alias, null, 2)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.frontend.config.js","sourceRoot":"","sources":["../../src/vite/vite.frontend.config.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,kBAAkB,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AAQ,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC;wBACzC,eAAe,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;wBACnD,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,aAAa,CAAC;qBAC3C,CAAC;iBACL;aACJ;SACJ;QACD,OAAO,EAAE;YAIL,SAAS,EAAE;YAGX,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS;YAErE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;SACjD;KACJ,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webpack/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/webpack/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/config",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.40",
|
|
4
4
|
"description": "Prosopo config library",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/cjs/index.cjs"
|
|
11
|
+
},
|
|
12
|
+
"./webpack": {
|
|
13
|
+
"import": "./dist/webpack/index.js",
|
|
14
|
+
"require": "./dist/webpack/cjs/index.cjs"
|
|
15
|
+
},
|
|
16
|
+
"./webpack/webpack.config": {
|
|
17
|
+
"import": "./dist/webpack/webpack.config.js",
|
|
18
|
+
"require": "./dist/cjs/webpack/webpack.config.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
7
21
|
"scripts": {
|
|
8
22
|
"test": "echo \"No test specified\"",
|
|
9
23
|
"clean": "tsc --build --clean",
|
|
10
24
|
"build": "tsc --build --verbose",
|
|
11
|
-
"
|
|
25
|
+
"build:cjs": "vite build --config vite.cjs.config.ts",
|
|
26
|
+
"eslint": "npx eslint . --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
|
|
12
27
|
"eslint:fix": "npm run eslint -- --fix",
|
|
13
28
|
"prettier": "npx prettier . --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
|
|
14
29
|
"prettier:fix": "npm run prettier -- --write",
|
|
@@ -22,10 +37,15 @@
|
|
|
22
37
|
"author": "Prosopo Limited",
|
|
23
38
|
"license": "Apache-2.0",
|
|
24
39
|
"dependencies": {
|
|
40
|
+
"@babel/core": "^7.24.5",
|
|
41
|
+
"@babel/plugin-proposal-import-attributes-to-assertions": "^7.24.1",
|
|
42
|
+
"@babel/plugin-syntax-import-attributes": "^7.24.1",
|
|
43
|
+
"@babel/plugin-transform-runtime": "^7.24.3",
|
|
44
|
+
"@babel/preset-env": "^7.24.5",
|
|
25
45
|
"@polkadot/dev": "^0.76.11",
|
|
26
|
-
"@prosopo/common": "0.3.
|
|
27
|
-
"@prosopo/types": "0.3.
|
|
28
|
-
"@prosopo/util": "0.3.
|
|
46
|
+
"@prosopo/common": "0.3.40",
|
|
47
|
+
"@prosopo/types": "0.3.40",
|
|
48
|
+
"@prosopo/util": "0.3.40",
|
|
29
49
|
"@rollup/plugin-alias": "^5.1.0",
|
|
30
50
|
"@rollup/plugin-babel": "^6.0.4",
|
|
31
51
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
@@ -36,30 +56,43 @@
|
|
|
36
56
|
"@rollup/plugin-replace": "^5.0.5",
|
|
37
57
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
38
58
|
"@rollup/plugin-wasm": "^6.2.2",
|
|
39
|
-
"@types/react": "^18.
|
|
40
|
-
"@types/react-dom": "^18.
|
|
59
|
+
"@types/react": "^18.3.1",
|
|
60
|
+
"@types/react-dom": "^18.3.0",
|
|
41
61
|
"@types/uuid": "^9.0.8",
|
|
42
62
|
"@typescript-eslint/eslint-plugin": "^5.59.5",
|
|
43
63
|
"@typescript-eslint/parser": "^5.30.7",
|
|
44
|
-
"
|
|
64
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
65
|
+
"babel-loader": "^9.1.3",
|
|
66
|
+
"esbuild": "^0.20.2",
|
|
45
67
|
"eslint": "^8.40.0",
|
|
46
68
|
"eslint-config-prettier": "^8.5.0",
|
|
47
69
|
"eslint-plugin-prettier": "^4.2.1",
|
|
48
70
|
"eslint-plugin-unused-imports": "^2.0.0",
|
|
49
71
|
"glob": "^10.0.0",
|
|
72
|
+
"html-webpack-plugin": "^5.6.0",
|
|
73
|
+
"mini-css-extract-plugin": "^2.9.0",
|
|
74
|
+
"node-polyfill-webpack-plugin": "^3.0.0",
|
|
50
75
|
"path-scurry": "^1.10.0",
|
|
51
|
-
"react": "^18.
|
|
52
|
-
"react-dom": "^18.
|
|
76
|
+
"react": "^18.3.1",
|
|
77
|
+
"react-dom": "^18.3.1",
|
|
53
78
|
"regenerator-runtime": "^0.14.0",
|
|
54
79
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
55
80
|
"rollup-plugin-import-css": "^3.5.0",
|
|
81
|
+
"string-replace-loader": "^3.1.0",
|
|
82
|
+
"terser-webpack-plugin": "^5.3.10",
|
|
56
83
|
"tsconfig-paths": "^4.2.0",
|
|
57
84
|
"vite": "^5.1.7",
|
|
58
85
|
"vite-bundle-visualizer": "^1.0.1",
|
|
59
86
|
"vite-plugin-no-bundle": "^3.0.0",
|
|
60
|
-
"vite-tsconfig-paths": "^4.3.1"
|
|
87
|
+
"vite-tsconfig-paths": "^4.3.1",
|
|
88
|
+
"webpack": "^5.91.0",
|
|
89
|
+
"webpack-cli": "^5.1.4",
|
|
90
|
+
"webpack-dev-server": "^5.0.4"
|
|
61
91
|
},
|
|
62
92
|
"devDependencies": {
|
|
93
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
94
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
95
|
+
"@babel/preset-typescript": "^7.24.1",
|
|
63
96
|
"tslib": "2.6.2",
|
|
64
97
|
"typescript": "5.1.6"
|
|
65
98
|
},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright 2021-2024 Prosopo (UK) Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
import { ViteCommonJSConfig } from './src/vite/index.js'
|
|
15
|
+
import path from 'path'
|
|
16
|
+
|
|
17
|
+
export default function () {
|
|
18
|
+
return ViteCommonJSConfig('config', path.resolve('./tsconfig.cjs.json'), 'src/index.ts')
|
|
19
|
+
}
|