@mainnet-cash/bcmr 2.7.23

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/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./Bcmr.js";
2
+ export * from "./bcmr-v2.schema.js";
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./tsconfig",
3
+ "compilerOptions": {},
4
+ "include": ["src/**/*.ts"],
5
+ "exclude": ["node_modules/**", "dist/**", "src/**/*test.ts"]
6
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "skipLibCheck": true,
6
+ "esModuleInterop": true,
7
+ "allowSyntheticDefaultImports": true,
8
+ "strict": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "downlevelIteration": true,
11
+ "composite": true,
12
+ "module": "esnext",
13
+ "target": "esnext",
14
+ "outDir": "./dist/module",
15
+ "moduleResolution": "node",
16
+ "resolveJsonModule": true,
17
+ "lib": ["es2020", "es2020.bigint", "dom"],
18
+ "typeRoots": [
19
+ "node_modules/@types",
20
+ "../../node_modules/@types",
21
+ "./src/types"
22
+ ]
23
+ },
24
+ "include": ["src/**/*.ts"],
25
+ "exclude": ["node_modules/**", "src/**/*test.ts"],
26
+ "references": [
27
+ {
28
+ "path": "../mainnet-js/"
29
+ }
30
+ ],
31
+ "compileOnSave": false
32
+ }
@@ -0,0 +1,109 @@
1
+ const { merge } = require("webpack-merge");
2
+ const packageJson = require("./package.json");
3
+ const HtmlWebpackPlugin = require("html-webpack-plugin");
4
+ const InjectBodyPlugin = require("inject-body-webpack-plugin").default;
5
+ const __basedir = require("path").resolve(__dirname, "../../");
6
+ const fs = require("fs");
7
+
8
+ fs.mkdirSync(__basedir + "/jest/playwright/bcmr", {
9
+ recursive: true,
10
+ });
11
+ fs.copyFileSync(
12
+ __basedir + "/jest/playwright/mainnet.js",
13
+ __basedir + "/jest/playwright/bcmr/mainnet.js"
14
+ );
15
+
16
+ const baseConfig = {
17
+ mode: "development",
18
+ module: {
19
+ rules: [
20
+ {
21
+ test: /\.tsx?$/,
22
+ use: [
23
+ {
24
+ loader: "ts-loader",
25
+ options: {
26
+ configFile: "tsconfig.browser.json",
27
+ },
28
+ },
29
+ ],
30
+ exclude: [/node_modules/],
31
+ },
32
+ ],
33
+ },
34
+ resolve: {
35
+ extensions: [".ts", ".tsx", ".js", ".wasm"],
36
+ extensionAlias: {
37
+ ".js": [".ts", ".js"],
38
+ },
39
+ },
40
+ optimization: {
41
+ minimize: false,
42
+ mangleWasmImports: true,
43
+ usedExports: true,
44
+ },
45
+ experiments: { topLevelAwait: true },
46
+ };
47
+
48
+ const prodConfig = {
49
+ mode: "production",
50
+ optimization: {
51
+ minimize: true,
52
+ },
53
+ };
54
+
55
+ const browserConfig = {
56
+ target: "web",
57
+ entry: {
58
+ BCMR: {
59
+ import: "./src/index.ts",
60
+ library: {
61
+ name: "__bcmrPromise",
62
+ type: "global",
63
+ },
64
+ },
65
+ },
66
+ output: {
67
+ filename: `[name]-${packageJson.version}.js`,
68
+ path: __dirname + "/dist",
69
+ crossOriginLoading: "anonymous",
70
+ libraryTarget: "umd",
71
+ },
72
+ plugins: [
73
+ //new BundleAnalyzerPlugin(),
74
+ new HtmlWebpackPlugin({
75
+ title: "The Empty Mainnet App",
76
+ }),
77
+ new InjectBodyPlugin({
78
+ content: `<script defer src="mainnet.js"></script><script>document.addEventListener("DOMContentLoaded", async (event) => Object.assign(globalThis, await __mainnetPromise, await __bcmrPromise))</script>`,
79
+ }),
80
+ ],
81
+ resolve: {
82
+ alias: {
83
+ crypto: false,
84
+ child_process: false,
85
+ },
86
+ fallback: {},
87
+ },
88
+ };
89
+
90
+ const browserTestDiff = {
91
+ output: {
92
+ filename: "[name].js",
93
+ path: __basedir + "/jest/playwright/bcmr/",
94
+ },
95
+ };
96
+
97
+ const browserTestConfig = merge(browserConfig, browserTestDiff);
98
+
99
+ let config = baseConfig;
100
+
101
+ if (process.env.NODE_ENV == "production") {
102
+ console.log("Running webpack in production mode");
103
+ config = merge(baseConfig, prodConfig);
104
+ }
105
+
106
+ // Join configurations with the base configuration
107
+ module.exports = [browserConfig, browserTestConfig].map((c) =>
108
+ merge(config, c)
109
+ );