@aptos-labs/script-composer-pack 0.1.0 → 0.2.0-0

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/main.mts CHANGED
@@ -1,7 +1,7 @@
1
- // @ts-ignore
2
- import * as wasm from './node_modules/@aptos-labs/aptos-dynamic-transaction-composer/aptos_dynamic_transaction_composer_bg.wasm';
3
- export * from "./node_modules/@aptos-labs/aptos-dynamic-transaction-composer/aptos_dynamic_transaction_composer.js";
4
- import { unzlibSync } from "fflate/browser"
5
- import { Buffer } from "buffer"
6
- const wasmModule = new WebAssembly.Module(unzlibSync(Buffer.from(wasm.default, 'base64')));
1
+ // @ts-ignore
2
+ import * as wasm from './node_modules/@aptos-labs/aptos-dynamic-transaction-composer/aptos_dynamic_transaction_composer_bg.wasm';
3
+ export * from "./node_modules/@aptos-labs/aptos-dynamic-transaction-composer/aptos_dynamic_transaction_composer.js";
4
+ import { unzlibSync } from "fflate/browser"
5
+ import { Buffer } from "buffer"
6
+ const wasmModule = new WebAssembly.Module(unzlibSync(Buffer.from(wasm.default, 'base64')));
7
7
  export { wasmModule };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "Aptos Labs <opensource@aptoslabs.com>"
5
5
  ],
6
6
  "description": "Generating Move Script from composer",
7
- "version": "0.1.0",
7
+ "version": "0.2.0-0",
8
8
  "license": "Apache-2.0",
9
9
  "repository": {
10
10
  "type": "git",
@@ -47,8 +47,8 @@
47
47
  }
48
48
  },
49
49
  "peerDependencies": {
50
- "@aptos-labs/ts-sdk": "<4.0.0",
51
- "@aptos-labs/aptos-dynamic-transaction-composer": "0.1.4-0"
50
+ "@aptos-labs/ts-sdk": "^3.0.0 || ^4.0.0 || ^5.0.0",
51
+ "@aptos-labs/aptos-dynamic-transaction-composer": "0.1.4-1"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "npx tsup",
package/tsconfig.json CHANGED
@@ -1,11 +1,11 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2020",
4
- "module": "NodeNext",
5
- "moduleResolution": "nodenext",
6
- "esModuleInterop": true,
7
- "forceConsistentCasingInFileNames": true,
8
- "strict": true,
9
- "skipLibCheck": true
10
- }
11
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2020",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "nodenext",
6
+ "esModuleInterop": true,
7
+ "forceConsistentCasingInFileNames": true,
8
+ "strict": true,
9
+ "skipLibCheck": true
10
+ }
11
+ }
package/tsup.config.ts CHANGED
@@ -1,66 +1,66 @@
1
- import { defineConfig } from 'tsup'
2
- import { Plugin } from 'esbuild'
3
- import fs from 'fs'
4
- import path from 'path'
5
- import * as fflate from 'fflate' ;
6
- import { Buffer } from "buffer";
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 wasm = Buffer.from(fflate.zlibSync(wasmBuffer, { level: 9 }));
15
- const contents = `
16
- export default "${wasm.toString('base64')}";
17
- `;
18
- return {
19
- contents,
20
- loader: 'js',
21
- };
22
- });
23
- },
24
- };
25
- }
26
- export function removeURLCodePlugin():Plugin {
27
- return {
28
- name: 'remove-specific-code',
29
- setup(build) {
30
- build.onLoad({ filter: /\.js$/ }, async (args) => {
31
-
32
- const source = await fs.promises.readFile(args.path, 'utf8');
33
-
34
- const regex = /if \(typeof module_or_path === 'undefined'\) {\s*module_or_path = new URL\('aptos_dynamic_transaction_composer_bg\.wasm', import\.meta\.url\);\s*}/g;
35
-
36
- const newSource = source.replace(regex, '');
37
-
38
- return {
39
- contents: newSource,
40
- loader: 'js',
41
- };
42
- });
43
- },
44
- };
45
- }
46
-
47
- export default defineConfig({
48
- entry: ['main.mts'],
49
- splitting: false,
50
- clean: true,
51
- dts: {
52
- entry: 'main.mts',
53
- resolve: true,
54
- },
55
- format: ['cjs', 'esm'],
56
- treeshake: true,
57
- // minify: true,
58
- esbuildPlugins: [wasmLoader(), removeURLCodePlugin()],
59
- esbuildOptions(options, context) {
60
- if (context.format === 'cjs') {
61
- options.outdir = 'dist/cjs'
62
- } else if (context.format === 'esm') {
63
- options.outdir = 'dist/esm'
64
- }
65
- }
1
+ import { defineConfig } from 'tsup'
2
+ import { Plugin } from 'esbuild'
3
+ import fs from 'fs'
4
+ import path from 'path'
5
+ import * as fflate from 'fflate' ;
6
+ import { Buffer } from "buffer";
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 wasm = Buffer.from(fflate.zlibSync(wasmBuffer, { level: 9 }));
15
+ const contents = `
16
+ export default "${wasm.toString('base64')}";
17
+ `;
18
+ return {
19
+ contents,
20
+ loader: 'js',
21
+ };
22
+ });
23
+ },
24
+ };
25
+ }
26
+ export function removeURLCodePlugin():Plugin {
27
+ return {
28
+ name: 'remove-specific-code',
29
+ setup(build) {
30
+ build.onLoad({ filter: /\.js$/ }, async (args) => {
31
+
32
+ const source = await fs.promises.readFile(args.path, 'utf8');
33
+
34
+ const regex = /if \(typeof module_or_path === 'undefined'\) {\s*module_or_path = new URL\('aptos_dynamic_transaction_composer_bg\.wasm', import\.meta\.url\);\s*}/g;
35
+
36
+ const newSource = source.replace(regex, '');
37
+
38
+ return {
39
+ contents: newSource,
40
+ loader: 'js',
41
+ };
42
+ });
43
+ },
44
+ };
45
+ }
46
+
47
+ export default defineConfig({
48
+ entry: ['main.mts'],
49
+ splitting: false,
50
+ clean: true,
51
+ dts: {
52
+ entry: 'main.mts',
53
+ resolve: true,
54
+ },
55
+ format: ['cjs', 'esm'],
56
+ treeshake: true,
57
+ // minify: true,
58
+ esbuildPlugins: [wasmLoader(), removeURLCodePlugin()],
59
+ esbuildOptions(options, context) {
60
+ if (context.format === 'cjs') {
61
+ options.outdir = 'dist/cjs'
62
+ } else if (context.format === 'esm') {
63
+ options.outdir = 'dist/esm'
64
+ }
65
+ }
66
66
  })