Repository: solana-labs/solana-program-library
Pull request #5741 (2023-11-07 10:41:12)

rustfmt: use entrypoint full path
This PR swaps any calls to the `entrypoint!` macro with the full path, ie: `solana_program::entrypoint!`.

This will play a role in the effort to introduce a linting standard to SPL.


buffalojoec: Current dependencies on/for this PR:
* master
  * **PR #5741** <a href="https://app.graphite.dev/github/pr/solana-labs/solana-program-library/5741" target="_blank"><img src="https://static.graphite.dev/graphite-32x32-black.png" alt="Graphite" width="10px" height="10px"/></a>  👈
    * **PR #5742** <a href="https://app.graphite.dev/github/pr/solana-labs/solana-program-library/5742" target="_blank"><img src="https://static.graphite.dev/graphite-32x32-black.png" alt="Graphite" width="10px" height="10px"/></a> 

This [stack of pull requests](https://stacking.dev/?utm_source=stack-comment) is managed by [Graphite](https://app.graphite.dev/github/pr/solana-labs/solana-program-library/5741?utm_source=stack-comment).

Patch:
diff --git a/account-compression/programs/noop/src/lib.rs b/account-compression/programs/noop/src/lib.rs
index 3b71da23e..da30b630d 100644
--- a/account-compression/programs/noop/src/lib.rs
+++ b/account-compression/programs/noop/src/lib.rs
@@ -6,10 +6,7 @@ use solana_program::{
 declare_id!("noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV");
 
 #[cfg(not(feature = "no-entrypoint"))]
-use solana_program::entrypoint;
-
-#[cfg(not(feature = "no-entrypoint"))]
-entrypoint!(noop);
+solana_program::entrypoint!(noop);
 
 pub fn noop(
     _program_id: &Pubkey,
diff --git a/associated-token-account/program/src/entrypoint.rs b/associated-token-account/program/src/entrypoint.rs
index 82641a415..8876e45b7 100644
--- a/associated-token-account/program/src/entrypoint.rs
+++ b/associated-token-account/program/src/entrypoint.rs
@@ -2,11 +2,9 @@
 
 #![cfg(not(feature = "no-entrypoint"))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/binary-option/program/src/entrypoint.rs b/binary-option/program/src/entrypoint.rs
index 3baa990ba..57a98a463 100644
--- a/binary-option/program/src/entrypoint.rs
+++ b/binary-option/program/src/entrypoint.rs
@@ -1,12 +1,10 @@
 #![cfg(all(target_os = "solana", not(feature = "no-entrypoint")))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
 use crate::processor::Processor;
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/binary-oracle-pair/program/src/entrypoint.rs b/binary-oracle-pair/program/src/entrypoint.rs
index 381135f4a..693aed651 100644
--- a/binary-oracle-pair/program/src/entrypoint.rs
+++ b/binary-oracle-pair/program/src/entrypoint.rs
@@ -4,11 +4,11 @@
 
 use crate::{error::PoolError, processor};
 use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-    program_error::PrintProgramError, pubkey::Pubkey,
+    account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+    pubkey::Pubkey,
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/examples/rust/cross-program-invocation/src/entrypoint.rs b/examples/rust/cross-program-invocation/src/entrypoint.rs
index 82641a415..8876e45b7 100644
--- a/examples/rust/cross-program-invocation/src/entrypoint.rs
+++ b/examples/rust/cross-program-invocation/src/entrypoint.rs
@@ -2,11 +2,9 @@
 
 #![cfg(not(feature = "no-entrypoint"))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/examples/rust/custom-heap/src/entrypoint.rs b/examples/rust/custom-heap/src/entrypoint.rs
index 8955e6f93..9f398acc1 100644
--- a/examples/rust/custom-heap/src/entrypoint.rs
+++ b/examples/rust/custom-heap/src/entrypoint.rs
@@ -4,7 +4,6 @@
 
 use solana_program::{
     account_info::AccountInfo,
-    entrypoint,
     entrypoint::{ProgramResult, HEAP_LENGTH, HEAP_START_ADDRESS},
     pubkey::Pubkey,
 };
@@ -44,7 +43,7 @@ unsafe impl std::alloc::GlobalAlloc for BumpAllocator {
 #[global_allocator]
 static A: BumpAllocator = BumpAllocator;
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/examples/rust/logging/src/entrypoint.rs b/examples/rust/logging/src/entrypoint.rs
index 82641a415..8876e45b7 100644
--- a/examples/rust/logging/src/entrypoint.rs
+++ b/examples/rust/logging/src/entrypoint.rs
@@ -2,11 +2,9 @@
 
 #![cfg(not(feature = "no-entrypoint"))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/examples/rust/sysvar/src/entrypoint.rs b/examples/rust/sysvar/src/entrypoint.rs
index 82641a415..8876e45b7 100644
--- a/examples/rust/sysvar/src/entrypoint.rs
+++ b/examples/rust/sysvar/src/entrypoint.rs
@@ -2,11 +2,9 @@
 
 #![cfg(not(feature = "no-entrypoint"))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/examples/rust/transfer-lamports/src/entrypoint.rs b/examples/rust/transfer-lamports/src/entrypoint.rs
index 82641a415..8876e45b7 100644
--- a/examples/rust/transfer-lamports/src/entrypoint.rs
+++ b/examples/rust/transfer-lamports/src/entrypoint.rs
@@ -2,11 +2,9 @@
 
 #![cfg(not(feature = "no-entrypoint"))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/examples/rust/transfer-tokens/src/entrypoint.rs b/examples/rust/transfer-tokens/src/entrypoint.rs
index 82641a415..8876e45b7 100644
--- a/examples/rust/transfer-tokens/src/entrypoint.rs
+++ b/examples/rust/transfer-tokens/src/entrypoint.rs
@@ -2,11 +2,9 @@
 
 #![cfg(not(feature = "no-entrypoint"))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/feature-gate/program/src/entrypoint.rs b/feature-gate/program/src/entrypoint.rs
index c261a918a..d3a0113d7 100644
--- a/feature-gate/program/src/entrypoint.rs
+++ b/feature-gate/program/src/entrypoint.rs
@@ -2,12 +2,10 @@
 
 use {
     crate::processor,
-    solana_program::{
-        account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-    },
+    solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey},
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/feature-proposal/program/src/entrypoint.rs b/feature-proposal/program/src/entrypoint.rs
index e2382fbe4..62a02f2a4 100644
--- a/feature-proposal/program/src/entrypoint.rs
+++ b/feature-proposal/program/src/entrypoint.rs
@@ -2,11 +2,9 @@
 
 #![cfg(all(target_os = "solana", not(feature = "no-entrypoint")))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/governance/addin-mock/program/src/entrypoint.rs b/governance/addin-mock/program/src/entrypoint.rs
index af9e723df..befeaa5c0 100644
--- a/governance/addin-mock/program/src/entrypoint.rs
+++ b/governance/addin-mock/program/src/entrypoint.rs
@@ -3,11 +3,11 @@
 
 use crate::{error::VoterWeightAddinError, processor};
 use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-    program_error::PrintProgramError, pubkey::Pubkey,
+    account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+    pubkey::Pubkey,
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/governance/chat/program/src/entrypoint.rs b/governance/chat/program/src/entrypoint.rs
index 92e085923..5dea31c8d 100644
--- a/governance/chat/program/src/entrypoint.rs
+++ b/governance/chat/program/src/entrypoint.rs
@@ -3,11 +3,11 @@
 
 use crate::{error::GovernanceChatError, processor};
 use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-    program_error::PrintProgramError, pubkey::Pubkey,
+    account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+    pubkey::Pubkey,
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/governance/program/src/entrypoint.rs b/governance/program/src/entrypoint.rs
index 26c75d468..5836ca26d 100644
--- a/governance/program/src/entrypoint.rs
+++ b/governance/program/src/entrypoint.rs
@@ -3,11 +3,11 @@
 
 use crate::{error::GovernanceError, processor};
 use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-    program_error::PrintProgramError, pubkey::Pubkey,
+    account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+    pubkey::Pubkey,
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/instruction-padding/program/src/entrypoint.rs b/instruction-padding/program/src/entrypoint.rs
index dd0b353e2..bb9a931af 100644
--- a/instruction-padding/program/src/entrypoint.rs
+++ b/instruction-padding/program/src/entrypoint.rs
@@ -2,11 +2,9 @@
 
 #![cfg(not(feature = "no-entrypoint"))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/libraries/math/src/entrypoint.rs b/libraries/math/src/entrypoint.rs
index 82641a415..8876e45b7 100644
--- a/libraries/math/src/entrypoint.rs
+++ b/libraries/math/src/entrypoint.rs
@@ -2,11 +2,9 @@
 
 #![cfg(not(feature = "no-entrypoint"))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/memo/program/src/entrypoint.rs b/memo/program/src/entrypoint.rs
index 82641a415..8876e45b7 100644
--- a/memo/program/src/entrypoint.rs
+++ b/memo/program/src/entrypoint.rs
@@ -2,11 +2,9 @@
 
 #![cfg(not(feature = "no-entrypoint"))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/name-service/program/src/entrypoint.rs b/name-service/program/src/entrypoint.rs
index 1e70cd1ce..5f4bac3bb 100644
--- a/name-service/program/src/entrypoint.rs
+++ b/name-service/program/src/entrypoint.rs
@@ -3,12 +3,12 @@ use {
     crate::processor::Processor,
     num_traits::FromPrimitive,
     solana_program::{
-        account_info::AccountInfo, decode_error::DecodeError, entrypoint,
-        entrypoint::ProgramResult, msg, program_error::PrintProgramError, pubkey::Pubkey,
+        account_info::AccountInfo, decode_error::DecodeError, entrypoint::ProgramResult, msg,
+        program_error::PrintProgramError, pubkey::Pubkey,
     },
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 
 pub fn process_instruction(
     program_id: &Pubkey,
diff --git a/record/program/src/entrypoint.rs b/record/program/src/entrypoint.rs
index e2382fbe4..62a02f2a4 100644
--- a/record/program/src/entrypoint.rs
+++ b/record/program/src/entrypoint.rs
@@ -2,11 +2,9 @@
 
 #![cfg(all(target_os = "solana", not(feature = "no-entrypoint")))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/single-pool/js/packages/classic/package.json b/single-pool/js/packages/classic/package.json
index d02208e68..4ea6921ce 100644
--- a/single-pool/js/packages/classic/package.json
+++ b/single-pool/js/packages/classic/package.json
@@ -1,20 +1,22 @@
 {
   "name": "@solana/single-pool-classic",
   "version": "1.0.0",
+  "main": "dist/cjs/index.js",
+  "module": "dist/mjs/index.js",
+  "exports": {
+    ".": {
+      "import": "./dist/mjs/index.js",
+      "require": "./dist/cjs/index.js"
+    }
+  },
   "scripts": {
-    "build": "pnpm tsc",
+    "build": "rm -fr dist/* && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && ./ts-fixup.sh",
     "lint": "eslint --max-warnings 0 .",
     "lint:fix": "eslint . --fix",
-    "test": "NODE_OPTIONS='--import=tsx' ava"
-  },
-  "type": "module",
-  "main": "./dist/index.js",
-  "module": "./dist/index.js",
-  "exports": {
-    "require": "./dist/index.js",
-    "import": "./dist/index.js"
+    "test": "sed -i '1s/.*/{ \"type\": \"module\",/' package.json && NODE_OPTIONS='--loader=tsx' ava ; sed -i '1s/.*/{/' package.json"
   },
   "devDependencies": {
+    "@types/node": "^20.9.0",
     "@ava/typescript": "^4.1.0",
     "@typescript-eslint/eslint-plugin": "^6.4.1",
     "ava": "^5.3.1",
@@ -32,7 +34,7 @@
   },
   "ava": {
     "extensions": {
-      "ts": "commonjs"
+      "ts": "module"
     },
     "nodeArguments": [
       "--import=tsx"
diff --git a/single-pool/js/packages/classic/src/index.ts b/single-pool/js/packages/classic/src/index.ts
index 415bdcec6..63373aca9 100644
--- a/single-pool/js/packages/classic/src/index.ts
+++ b/single-pool/js/packages/classic/src/index.ts
@@ -1,12 +1,12 @@
 import { Connection, PublicKey } from '@solana/web3.js';
 import { getVoteAccountAddressForPool as getVoteModern } from '@solana/single-pool';
 
-import { rpc } from './internal';
+import { rpc } from './internal.js';
 
-export * from './mpl_metadata';
-export * from './addresses';
-export * from './instructions';
-export * from './transactions';
+export * from './mpl_metadata.js';
+export * from './addresses.js';
+export * from './instructions.js';
+export * from './transactions.js';
 
 export async function getVoteAccountAddressForPool(connection: Connection, poolAddress: PublicKey) {
   const voteAccountModern = await getVoteModern(rpc(connection), poolAddress.toBase58());
diff --git a/single-pool/js/packages/classic/src/instructions.ts b/single-pool/js/packages/classic/src/instructions.ts
index e783a8b53..3bc443068 100644
--- a/single-pool/js/packages/classic/src/instructions.ts
+++ b/single-pool/js/packages/classic/src/instructions.ts
@@ -1,7 +1,7 @@
 import { PublicKey, TransactionInstruction } from '@solana/web3.js';
 import { SinglePoolInstruction as PoolInstructionModern } from '@solana/single-pool';
 
-import { modernInstructionToLegacy } from './internal';
+import { modernInstructionToLegacy } from './internal.js';
 
 export class SinglePoolInstruction {
   static async initializePool(voteAccount: PublicKey): Promise<TransactionInstruction> {
diff --git a/single-pool/js/packages/classic/src/transactions.ts b/single-pool/js/packages/classic/src/transactions.ts
index f422c8fa0..36e405459 100644
--- a/single-pool/js/packages/classic/src/transactions.ts
+++ b/single-pool/js/packages/classic/src/transactions.ts
@@ -1,7 +1,7 @@
 import { PublicKey, Connection } from '@solana/web3.js';
 import { SinglePoolProgram as PoolProgramModern } from '@solana/single-pool';
 
-import { paramsToModern, modernTransactionToLegacy, rpc } from './internal';
+import { paramsToModern, modernTransactionToLegacy, rpc } from './internal.js';
 
 interface DepositParams {
   connection: Connection;
diff --git a/single-pool/js/packages/classic/ts-fixup.sh b/single-pool/js/packages/classic/ts-fixup.sh
new file mode 120000
index 000000000..2b79c2628
--- /dev/null
+++ b/single-pool/js/packages/classic/ts-fixup.sh
@@ -0,0 +1,1 @@
+../../ts-fixup.sh
\ No newline at end of file
diff --git a/single-pool/js/packages/classic/tsconfig-base.json b/single-pool/js/packages/classic/tsconfig-base.json
new file mode 120000
index 000000000..8cdeff689
--- /dev/null
+++ b/single-pool/js/packages/classic/tsconfig-base.json
@@ -0,0 +1,1 @@
+../../tsconfig-base.json
\ No newline at end of file
diff --git a/single-pool/js/packages/classic/tsconfig-cjs.json b/single-pool/js/packages/classic/tsconfig-cjs.json
new file mode 120000
index 000000000..eb5b67788
--- /dev/null
+++ b/single-pool/js/packages/classic/tsconfig-cjs.json
@@ -0,0 +1,1 @@
+../../tsconfig-cjs.json
\ No newline at end of file
diff --git a/single-pool/js/packages/classic/tsconfig.json b/single-pool/js/packages/classic/tsconfig.json
deleted file mode 100644
index e2d884ce6..000000000
--- a/single-pool/js/packages/classic/tsconfig.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
-  "compilerOptions": {
-    "module": "esnext",
-    "target": "es2020",
-    "baseUrl": "./src",
-    "outDir": "dist",
-    "declaration": true,
-    "declarationDir": "dist",
-    "esModuleInterop": true,
-    "allowSyntheticDefaultImports": true,
-    "strict": true,
-    "forceConsistentCasingInFileNames": true,
-    "moduleResolution": "node",
-    "resolveJsonModule": true,
-    "isolatedModules": true,
-    "noFallthroughCasesInSwitch": true,
-    "noImplicitReturns": true,
-    "skipLibCheck": true // needed to avoid re-export errors from borsh
-  },
-  "include": ["src/**/*.ts"]
-}
diff --git a/single-pool/js/packages/classic/tsconfig.json b/single-pool/js/packages/classic/tsconfig.json
new file mode 120000
index 000000000..fd0e4743d
--- /dev/null
+++ b/single-pool/js/packages/classic/tsconfig.json
@@ -0,0 +1,1 @@
+../../tsconfig.json
\ No newline at end of file
diff --git a/single-pool/js/packages/modern/package.json b/single-pool/js/packages/modern/package.json
index 25df93800..865a3cf4a 100644
--- a/single-pool/js/packages/modern/package.json
+++ b/single-pool/js/packages/modern/package.json
@@ -1,27 +1,27 @@
 {
   "name": "@solana/single-pool",
   "version": "1.0.0",
+  "main": "dist/cjs/index.js",
+  "module": "dist/mjs/index.js",
+  "exports": {
+    ".": {
+      "import": "./dist/mjs/index.js",
+      "require": "./dist/cjs/index.js"
+    }
+  },
   "scripts": {
-    "build": "pnpm tsc",
+    "build": "rm -fr dist/* && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && ./ts-fixup.sh",
     "lint": "eslint --max-warnings 0 .",
-    "lint:fix": "eslint . --fix",
-    "test": "NODE_OPTIONS='--loader=tsx' ava"
-  },
-  "type": "module",
-  "main": "./dist/index.js",
-  "module": "./dist/index.js",
-  "exports": {
-    "require": "./dist/index.js",
-    "import": "./dist/index.js"
+    "lint:fix": "eslint . --fix"
   },
   "devDependencies": {
+    "@types/node": "^20.9.0",
     "@ava/typescript": "^4.1.0",
     "@typescript-eslint/eslint-plugin": "^6.4.1",
     "ava": "^5.3.1",
     "eslint": "^8.49.0",
     "eslint-config-prettier": "^9.0.0",
     "eslint-plugin-prettier": "^5.0.0",
-    "solana-bankrun": "^0.2.0",
     "ts-node": "^10.9.1",
     "tsx": "^3.12.7",
     "typescript": "^5.2.2"
@@ -34,7 +34,7 @@
       "ts": "module"
     },
     "nodeArguments": [
-      "--loader=tsx"
+      "--import=tsx"
     ]
   }
 }
diff --git a/single-pool/js/packages/modern/src/addresses.ts b/single-pool/js/packages/modern/src/addresses.ts
index 64ebd7ad6..7e8464e48 100644
--- a/single-pool/js/packages/modern/src/addresses.ts
+++ b/single-pool/js/packages/modern/src/addresses.ts
@@ -6,8 +6,8 @@ import {
   createAddressWithSeed,
 } from '@solana/web3.js';
 
-import { MPL_METADATA_PROGRAM_ID } from './internal';
-import { STAKE_PROGRAM_ID } from './quarantine';
+import { MPL_METADATA_PROGRAM_ID } from './internal.js';
+import { STAKE_PROGRAM_ID } from './quarantine.js';
 
 export const SINGLE_POOL_PROGRAM_ID = address('SVSPxpvHdN29nkVg9rPapPNDddN5DipNLRUFhyjFThE');
 
diff --git a/single-pool/js/packages/modern/src/index.ts b/single-pool/js/packages/modern/src/index.ts
index f8697e331..b26524a4f 100644
--- a/single-pool/js/packages/modern/src/index.ts
+++ b/single-pool/js/packages/modern/src/index.ts
@@ -1,10 +1,10 @@
 import { getAddressCodec } from '@solana/web3.js';
 
-import { PoolAddress, VoteAccountAddress } from './addresses';
+import { PoolAddress, VoteAccountAddress } from './addresses.js';
 
-export * from './addresses';
-export * from './instructions';
-export * from './transactions';
+export * from './addresses.js';
+export * from './instructions.js';
+export * from './transactions.js';
 
 export async function getVoteAccountAddressForPool(
   rpc: any, // XXX not exported: Rpc<GetAccountInfoApi>,
diff --git a/single-pool/js/packages/modern/src/instructions.ts b/single-pool/js/packages/modern/src/instructions.ts
index 3317355db..a170f4776 100644
--- a/single-pool/js/packages/modern/src/instructions.ts
+++ b/single-pool/js/packages/modern/src/instructions.ts
@@ -27,8 +27,8 @@ import {
   findPoolMintAuthorityAddress,
   findPoolStakeAuthorityAddress,
   SINGLE_POOL_PROGRAM_ID,
-} from './addresses';
-import { MPL_METADATA_PROGRAM_ID } from './internal';
+} from './addresses.js';
+import { MPL_METADATA_PROGRAM_ID } from './internal.js';
 import {
   SYSTEM_PROGRAM_ID,
   SYSVAR_RENT_ID,
@@ -39,7 +39,7 @@ import {
   TOKEN_PROGRAM_ID,
   u32,
   u64,
-} from './quarantine';
+} from './quarantine.js';
 
 type InitializePoolInstruction = IInstruction<typeof SINGLE_POOL_PROGRAM_ID> &
   IInstructionWithAccounts<
diff --git a/single-pool/js/packages/modern/src/transactions.ts b/single-pool/js/packages/modern/src/transactions.ts
index 72b6255bf..03b2842b7 100644
--- a/single-pool/js/packages/modern/src/transactions.ts
+++ b/single-pool/js/packages/modern/src/transactions.ts
@@ -16,7 +16,7 @@ import {
   findPoolMintAuthorityAddress,
   findPoolStakeAuthorityAddress,
   SINGLE_POOL_PROGRAM_ID,
-} from './addresses';
+} from './addresses.js';
 import {
   initializePoolInstruction,
   reactivatePoolStakeInstruction,
@@ -24,7 +24,7 @@ import {
   withdrawStakeInstruction,
   createTokenMetadataInstruction,
   updateTokenMetadataInstruction,
-} from './instructions';
+} from './instructions.js';
 import {
   STAKE_PROGRAM_ID,
   STAKE_ACCOUNT_SIZE,
@@ -34,7 +34,7 @@ import {
   TokenInstruction,
   StakeAuthorizationType,
   getAssociatedTokenAddress,
-} from './quarantine';
+} from './quarantine.js';
 
 interface DepositParams {
   rpc: any; // XXX Rpc<???>
diff --git a/single-pool/js/packages/modern/ts-fixup.sh b/single-pool/js/packages/modern/ts-fixup.sh
new file mode 120000
index 000000000..2b79c2628
--- /dev/null
+++ b/single-pool/js/packages/modern/ts-fixup.sh
@@ -0,0 +1,1 @@
+../../ts-fixup.sh
\ No newline at end of file
diff --git a/single-pool/js/packages/modern/tsconfig-base.json b/single-pool/js/packages/modern/tsconfig-base.json
new file mode 120000
index 000000000..8cdeff689
--- /dev/null
+++ b/single-pool/js/packages/modern/tsconfig-base.json
@@ -0,0 +1,1 @@
+../../tsconfig-base.json
\ No newline at end of file
diff --git a/single-pool/js/packages/modern/tsconfig-cjs.json b/single-pool/js/packages/modern/tsconfig-cjs.json
new file mode 120000
index 000000000..eb5b67788
--- /dev/null
+++ b/single-pool/js/packages/modern/tsconfig-cjs.json
@@ -0,0 +1,1 @@
+../../tsconfig-cjs.json
\ No newline at end of file
diff --git a/single-pool/js/packages/modern/tsconfig.json b/single-pool/js/packages/modern/tsconfig.json
deleted file mode 100644
index c3b7b616d..000000000
--- a/single-pool/js/packages/modern/tsconfig.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
-  "compilerOptions": {
-    "module": "esnext",
-    "target": "es2020",
-    "baseUrl": "./src",
-    "outDir": "dist",
-    "declaration": true,
-    "declarationDir": "dist",
-    "esModuleInterop": true,
-    "allowSyntheticDefaultImports": true,
-    "strict": true,
-    "forceConsistentCasingInFileNames": true,
-    "moduleResolution": "node",
-    "resolveJsonModule": true,
-    "isolatedModules": true,
-    "noFallthroughCasesInSwitch": true,
-    "noImplicitReturns": true,
-    "lib": ["DOM"],
-    "skipLibCheck": true // needed to avoid re-export errors from borsh
-  },
-  "include": ["src/**/*.ts"]
-}
diff --git a/single-pool/js/packages/modern/tsconfig.json b/single-pool/js/packages/modern/tsconfig.json
new file mode 120000
index 000000000..fd0e4743d
--- /dev/null
+++ b/single-pool/js/packages/modern/tsconfig.json
@@ -0,0 +1,1 @@
+../../tsconfig.json
\ No newline at end of file
diff --git a/single-pool/js/ts-fixup.sh b/single-pool/js/ts-fixup.sh
new file mode 100755
index 000000000..39177d086
--- /dev/null
+++ b/single-pool/js/ts-fixup.sh
@@ -0,0 +1,11 @@
+cat >dist/cjs/package.json <<!EOF
+{
+    "type": "commonjs"
+}
+!EOF
+
+cat >dist/mjs/package.json <<!EOF
+{
+    "type": "module"
+}
+!EOF
diff --git a/single-pool/js/tsconfig-base.json b/single-pool/js/tsconfig-base.json
new file mode 100644
index 000000000..96f4e86f6
--- /dev/null
+++ b/single-pool/js/tsconfig-base.json
@@ -0,0 +1,25 @@
+{
+    "compilerOptions": {
+        "allowJs": true,
+        "allowSyntheticDefaultImports": true,
+        "baseUrl": "src",
+        "declaration": true,
+        "esModuleInterop": true,
+        "inlineSourceMap": false,
+        "lib": ["esnext"],
+        "listEmittedFiles": false,
+        "listFiles": false,
+        "moduleResolution": "node",
+        "noFallthroughCasesInSwitch": true,
+        "pretty": true,
+        "resolveJsonModule": true,
+        "rootDir": "src",
+        "skipLibCheck": true,
+        "strict": true,
+        "traceResolution": false,
+        "types": ["node", "ava"]
+    },
+    "compileOnSave": false,
+    "exclude": ["node_modules", "dist"],
+    "include": ["src"]
+}
diff --git a/single-pool/js/tsconfig-cjs.json b/single-pool/js/tsconfig-cjs.json
new file mode 100644
index 000000000..7ce832884
--- /dev/null
+++ b/single-pool/js/tsconfig-cjs.json
@@ -0,0 +1,8 @@
+{
+    "extends": "./tsconfig-base.json",
+    "compilerOptions": {
+        "module": "commonjs",
+        "outDir": "dist/cjs",
+        "target": "es2020"
+    }
+}
diff --git a/single-pool/js/tsconfig.json b/single-pool/js/tsconfig.json
new file mode 100644
index 000000000..ee6e15af6
--- /dev/null
+++ b/single-pool/js/tsconfig.json
@@ -0,0 +1,8 @@
+{
+    "extends": "./tsconfig-base.json",
+    "compilerOptions": {
+        "module": "esnext",
+        "outDir": "dist/mjs",
+        "target": "esnext"
+    }
+}
diff --git a/single-pool/program/src/entrypoint.rs b/single-pool/program/src/entrypoint.rs
index 518892fd1..68d598e5d 100644
--- a/single-pool/program/src/entrypoint.rs
+++ b/single-pool/program/src/entrypoint.rs
@@ -5,12 +5,12 @@
 use {
     crate::{error::SinglePoolError, processor::Processor},
     solana_program::{
-        account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-        program_error::PrintProgramError, pubkey::Pubkey,
+        account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+        pubkey::Pubkey,
     },
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/stake-pool/program/src/entrypoint.rs b/stake-pool/program/src/entrypoint.rs
index a809d7f22..92e3ea5ad 100644
--- a/stake-pool/program/src/entrypoint.rs
+++ b/stake-pool/program/src/entrypoint.rs
@@ -5,12 +5,12 @@
 use {
     crate::{error::StakePoolError, processor::Processor},
     solana_program::{
-        account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-        program_error::PrintProgramError, pubkey::Pubkey,
+        account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+        pubkey::Pubkey,
     },
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/stateless-asks/program/src/entrypoint.rs b/stateless-asks/program/src/entrypoint.rs
index 3baa990ba..57a98a463 100644
--- a/stateless-asks/program/src/entrypoint.rs
+++ b/stateless-asks/program/src/entrypoint.rs
@@ -1,12 +1,10 @@
 #![cfg(all(target_os = "solana", not(feature = "no-entrypoint")))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
 use crate::processor::Processor;
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/token-collection/program/src/entrypoint.rs b/token-collection/program/src/entrypoint.rs
index 762ec7525..0336a5f1c 100644
--- a/token-collection/program/src/entrypoint.rs
+++ b/token-collection/program/src/entrypoint.rs
@@ -3,13 +3,13 @@
 use {
     crate::processor,
     solana_program::{
-        account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-        program_error::PrintProgramError, pubkey::Pubkey,
+        account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+        pubkey::Pubkey,
     },
     spl_token_group_interface::error::TokenGroupError,
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/token-group/example/src/entrypoint.rs b/token-group/example/src/entrypoint.rs
index 762ec7525..0336a5f1c 100644
--- a/token-group/example/src/entrypoint.rs
+++ b/token-group/example/src/entrypoint.rs
@@ -3,13 +3,13 @@
 use {
     crate::processor,
     solana_program::{
-        account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-        program_error::PrintProgramError, pubkey::Pubkey,
+        account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+        pubkey::Pubkey,
     },
     spl_token_group_interface::error::TokenGroupError,
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/token-lending/flash_loan_receiver/src/entrypoint.rs b/token-lending/flash_loan_receiver/src/entrypoint.rs
index 633133e19..55b8b4c2e 100644
--- a/token-lending/flash_loan_receiver/src/entrypoint.rs
+++ b/token-lending/flash_loan_receiver/src/entrypoint.rs
@@ -1,8 +1,6 @@
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/token-lending/program/src/entrypoint.rs b/token-lending/program/src/entrypoint.rs
index a1d68d8fa..beba09dfa 100644
--- a/token-lending/program/src/entrypoint.rs
+++ b/token-lending/program/src/entrypoint.rs
@@ -4,11 +4,11 @@
 
 use crate::{error::LendingError, processor};
 use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-    program_error::PrintProgramError, pubkey::Pubkey,
+    account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+    pubkey::Pubkey,
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/token-metadata/example/src/entrypoint.rs b/token-metadata/example/src/entrypoint.rs
index 9104ee3fe..accd30f2c 100644
--- a/token-metadata/example/src/entrypoint.rs
+++ b/token-metadata/example/src/entrypoint.rs
@@ -3,13 +3,13 @@
 use {
     crate::processor,
     solana_program::{
-        account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-        program_error::PrintProgramError, pubkey::Pubkey,
+        account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+        pubkey::Pubkey,
     },
     spl_token_metadata_interface::error::TokenMetadataError,
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/token-swap/program/src/entrypoint.rs b/token-swap/program/src/entrypoint.rs
index b41aa6fc3..206f51456 100644
--- a/token-swap/program/src/entrypoint.rs
+++ b/token-swap/program/src/entrypoint.rs
@@ -2,11 +2,11 @@
 
 use crate::{error::SwapError, processor::Processor};
 use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-    program_error::PrintProgramError, pubkey::Pubkey,
+    account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+    pubkey::Pubkey,
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/token-upgrade/program/src/entrypoint.rs b/token-upgrade/program/src/entrypoint.rs
index dd0b353e2..bb9a931af 100644
--- a/token-upgrade/program/src/entrypoint.rs
+++ b/token-upgrade/program/src/entrypoint.rs
@@ -2,11 +2,9 @@
 
 #![cfg(not(feature = "no-entrypoint"))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/token-wrap/program/src/entrypoint.rs b/token-wrap/program/src/entrypoint.rs
index e2382fbe4..62a02f2a4 100644
--- a/token-wrap/program/src/entrypoint.rs
+++ b/token-wrap/program/src/entrypoint.rs
@@ -2,11 +2,9 @@
 
 #![cfg(all(target_os = "solana", not(feature = "no-entrypoint")))]
 
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/token/program-2022/src/entrypoint.rs b/token/program-2022/src/entrypoint.rs
index 1e534c5ed..366ee78d0 100644
--- a/token/program-2022/src/entrypoint.rs
+++ b/token/program-2022/src/entrypoint.rs
@@ -3,12 +3,12 @@
 use {
     crate::{error::TokenError, processor::Processor},
     solana_program::{
-        account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-        program_error::PrintProgramError, pubkey::Pubkey,
+        account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+        pubkey::Pubkey,
     },
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/token/program/src/entrypoint.rs b/token/program/src/entrypoint.rs
index 53315751b..6d9ad5dab 100644
--- a/token/program/src/entrypoint.rs
+++ b/token/program/src/entrypoint.rs
@@ -2,11 +2,11 @@
 
 use crate::{error::TokenError, processor::Processor};
 use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-    program_error::PrintProgramError, pubkey::Pubkey,
+    account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+    pubkey::Pubkey,
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],
diff --git a/token/transfer-hook/example/src/entrypoint.rs b/token/transfer-hook/example/src/entrypoint.rs
index 14a2bc5b1..b20460372 100644
--- a/token/transfer-hook/example/src/entrypoint.rs
+++ b/token/transfer-hook/example/src/entrypoint.rs
@@ -3,13 +3,13 @@
 use {
     crate::processor,
     solana_program::{
-        account_info::AccountInfo, entrypoint, entrypoint::ProgramResult,
-        program_error::PrintProgramError, pubkey::Pubkey,
+        account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
+        pubkey::Pubkey,
     },
     spl_transfer_hook_interface::error::TransferHookError,
 };
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],


Test patch:
diff --git a/token-lending/program/tests/helpers/flash_loan_receiver.rs b/token-lending/program/tests/helpers/flash_loan_receiver.rs
index 21d8c615a..b5aa7ae57 100644
--- a/token-lending/program/tests/helpers/flash_loan_receiver.rs
+++ b/token-lending/program/tests/helpers/flash_loan_receiver.rs
@@ -1,6 +1,4 @@
-use solana_program::{
-    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, pubkey::Pubkey,
-};
+use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, msg, pubkey::Pubkey};
 
 use crate::helpers::flash_loan_receiver::FlashLoanReceiverError::InvalidInstruction;
 use spl_token::{
@@ -29,7 +27,7 @@ pub enum FlashLoanReceiverInstruction {
     },
 }
 
-entrypoint!(process_instruction);
+solana_program::entrypoint!(process_instruction);
 pub fn process_instruction(
     program_id: &Pubkey,
     accounts: &[AccountInfo],