@wgb5445/aptos-intent-npm 0.1.11 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
package/dist/main.d.mts CHANGED
@@ -1,5 +1,3 @@
1
- export { Buffer } from 'buffer';
2
-
3
1
  /* tslint:disable */
4
2
  /* eslint-disable */
5
3
  /**
package/dist/main.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- export { Buffer } from 'buffer';
2
-
3
1
  /* tslint:disable */
4
2
  /* eslint-disable */
5
3
  /**
package/main.mts CHANGED
@@ -2,5 +2,4 @@
2
2
  import * as wasmModule from '../pkg/aptos_dynamic_transaction_composer_bg.wasm';
3
3
  export * from "../pkg/aptos_dynamic_transaction_composer.js";
4
4
  const wasm = new WebAssembly.Module(new Uint8Array(wasmModule.default));
5
- import { Buffer } from 'buffer';
6
- export { wasm, Buffer };
5
+ export { wasm };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "Aptos Labs <opensource@aptoslabs.com>"
5
5
  ],
6
6
  "description": "Generating Move Script from intent",
7
- "version": "0.1.11",
7
+ "version": "0.1.13",
8
8
  "license": "Apache-2.0",
9
9
  "repository": {
10
10
  "type": "git",
@@ -36,7 +36,7 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "buffer": "^6.0.3"
39
+ "esbuild": "^0.24.0"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "npx tsup"
package/tsup.config.ts CHANGED
@@ -1,5 +1,28 @@
1
1
  import { defineConfig } from 'tsup'
2
+ import { Plugin } from 'esbuild'
3
+ import { Buffer } from 'buffer'
4
+ import fs from 'fs'
5
+ import path from 'path'
2
6
 
7
+ export function wasmLoader():Plugin {
8
+ return {
9
+ name: 'wasm-loader',
10
+ setup(build) {
11
+ build.onLoad({ filter: /\.wasm$/ }, async (args) => {
12
+ const wasmPath = path.resolve(args.path);
13
+ const wasmBuffer = await fs.promises.readFile(wasmPath);
14
+ const contents = `
15
+ const wasm = [${new Uint8Array(wasmBuffer).toString()}];
16
+ export default wasm;
17
+ `;
18
+ return {
19
+ contents,
20
+ loader: 'js',
21
+ };
22
+ });
23
+ },
24
+ };
25
+ }
3
26
  export default defineConfig({
4
27
  entry: ['main.mts'],
5
28
  splitting: false,
@@ -9,9 +32,7 @@ export default defineConfig({
9
32
  resolve: true,
10
33
  },
11
34
  format: ['cjs', 'esm'],
12
- loader: {
13
- '.wasm': 'binary',
14
- },
35
+ esbuildPlugins: [wasmLoader()],
15
36
  esbuildOptions(options, context) {
16
37
  if (context.format === 'cjs') {
17
38
  options.outdir = 'dist/cjs'