Skip to content

Commit 2fdb57d

Browse files
author
Andy Haynes
committed
fix: keep near-api-js as commonjs, remove bundling
1 parent 9b86356 commit 2fdb57d

7 files changed

+338
-503
lines changed

packages/near-api-js/browser-exports.js

-1
This file was deleted.

packages/near-api-js/esbuild.inject.js

-2
This file was deleted.

packages/near-api-js/jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default {
1+
module.exports = {
22
preset: 'ts-jest',
33
testEnvironment: 'node',
44
collectCoverage: true

packages/near-api-js/package.json

+18-41
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
"url": "git+https://github.com/near/near-api-js.git"
88
},
99
"homepage": "https://github.com/near/near-api-js",
10-
"main": "lib/esm/index.js",
11-
"browser": "lib/commonjs/browser-index.cjs",
12-
"types": "lib/esm/index.d.ts",
13-
"type": "module",
10+
"main": "lib/index.js",
11+
"browser": "lib/browser-index.js",
12+
"types": "lib/index.d.ts",
1413
"dependencies": {
1514
"@near-js/accounts": "workspace:*",
1615
"@near-js/crypto": "workspace:*",
@@ -23,67 +22,45 @@
2322
"@near-js/types": "workspace:*",
2423
"@near-js/utils": "workspace:*",
2524
"@near-js/wallet-account": "workspace:*",
25+
"@noble/curves": "1.2.0",
2626
"borsh": "1.0.0",
2727
"depd": "2.0.0",
2828
"http-errors": "1.7.2",
29-
"near-abi": "0.1.1"
29+
"near-abi": "0.1.1",
30+
"node-fetch": "2.6.7"
3031
},
3132
"devDependencies": {
3233
"@types/http-errors": "1.6.1",
33-
"@types/node": "20.0.0",
34+
"@types/node": "18.11.18",
3435
"bs58": "4.0.0",
35-
"buffer": "6.0.3",
36-
"build": "workspace:*",
37-
"bundlewatch": "0.3.1",
3836
"concurrently": "7.3.0",
39-
"esbuild": "0.23.0",
4037
"in-publish": "2.0.0",
4138
"jest": "29.7.0",
42-
"localstorage-memory": "1.0.3",
4339
"near-hello": "0.5.1",
4440
"near-workspaces": "3.5.0",
45-
"process": "^0.11.10",
46-
"rimraf": "6.0.1",
41+
"rimraf": "^6.0.1",
4742
"semver": "7.1.1",
48-
"ts-jest": "29.1.5",
49-
"tsconfig": "workspace:*",
50-
"util": "^0.12.5"
43+
"ts-jest": "29.1.5"
5144
},
5245
"keywords": [],
5346
"license": "(MIT AND Apache-2.0)",
5447
"scripts": {
55-
"dist": "pnpm bundle:all",
56-
"bundle:all": "pnpm bundle && pnpm bundle:minified",
57-
"bundle": "esbuild browser-exports.js --bundle --outfile=dist/near-api-js.js --define:global=window --inject:esbuild.inject.js",
58-
"bundle:minified": "esbuild browser-exports.js --bundle --minify --outfile=dist/near-api-js.min.js --define:global=window --inject:esbuild.inject.js",
59-
"compile:esm": "tsc -p ./tsconfig.json",
60-
"compile:cjs": "tsc -p ./tsconfig.cjs.json && cjsify ./lib/commonjs",
48+
"compile": "tsc -p ./tsconfig.json",
6149
"dev": "pnpm compile -w",
62-
"build": "pnpm compile:esm && pnpm compile:cjs && pnpm dist",
63-
"test": "jest --passWithNoTests",
50+
"build": "pnpm compile",
51+
"test": "jest test --passWithNoTests",
6452
"lint": "concurrently \"pnpm:lint:*(!fix) --no-error-on-unmatched-pattern\"",
6553
"lint:src": "eslint --ext .ts src",
54+
"lint:fix": "concurrently \"pnpm:lint:*:fix\"",
55+
"lint:src:fix": "eslint --ext .ts --fix src",
56+
"lint:test:fix": "eslint --ext .js --fix test",
6657
"prefuzz": "pnpm build",
6758
"fuzz": "jsfuzz test/fuzz/borsh-roundtrip.js test/fuzz/corpus/",
68-
"clean": "pnpm rimraf lib",
69-
"bundlewatch": "bundlewatch"
70-
},
71-
"bundlewatch": {
72-
"files": [
73-
{
74-
"path": "dist/near-api-js.min.js",
75-
"maxSize": "150kB"
76-
}
77-
]
59+
"clean": "pnpm rimraf lib"
7860
},
7961
"files": [
8062
"lib",
81-
"dist",
82-
"browser-exports.js"
63+
"dist"
8364
],
84-
"author": "NEAR Inc",
85-
"exports": {
86-
"require": "./lib/commonjs/index.cjs",
87-
"import": "./lib/esm/index.js"
88-
}
65+
"author": "NEAR Inc"
8966
}

packages/near-api-js/tsconfig.cjs.json

-11
This file was deleted.

packages/near-api-js/tsconfig.json

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
{
2-
"extends": "tsconfig/esm.json",
32
"compilerOptions": {
3+
"esModuleInterop": true,
44
"lib": [
5-
"es2022",
5+
"es2020",
6+
"esnext",
67
"dom"
78
],
8-
"outDir": "./lib/esm"
9+
"module": "commonjs",
10+
"target": "es2020",
11+
"moduleResolution": "node",
12+
"alwaysStrict": true,
13+
"outDir": "./lib",
14+
"declaration": true,
15+
"preserveSymlinks": false,
16+
"preserveWatchOutput": true,
17+
"pretty": false,
18+
"forceConsistentCasingInFileNames": true,
19+
"noFallthroughCasesInSwitch": true,
20+
"noImplicitAny": false,
21+
"noImplicitReturns": true,
22+
"noUnusedLocals": true,
23+
"experimentalDecorators": true,
24+
"resolveJsonModule": true,
925
},
1026
"files": [
1127
"src/index.ts",
28+
"src/browser-index.ts",
1229
],
1330
}

0 commit comments

Comments
 (0)