Skip to content

Commit

Permalink
Add ESM wrapper to avoid dual package hazard (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm authored Oct 6, 2023
1 parent 59d56dc commit 45e28e9
Show file tree
Hide file tree
Showing 20 changed files with 215 additions and 156 deletions.
62 changes: 31 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 9 additions & 13 deletions packages/connect-express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,22 @@
"url": "https://github.com/connectrpc/connect-es.git",
"directory": "packages/connect-express"
},
"sideEffects": false,
"scripts": {
"clean": "rm -rf ./dist/cjs/* ./dist/esm/*",
"build": "npm run build:cjs && npm run build:esm",
"clean": "rm -rf ./dist/*",
"build": "npm run build:cjs && npm run build:esm && npm run build:proxy",
"build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm",
"build:proxy": "node ../../scripts/gen-esm-proxy.mjs .",
"attw": "attw --pack"
},
"main": "./dist/cjs/index.js",
"type": "module",
"sideEffects": false,
"main": "./dist/cjs/index.js",
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
"module": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"import": "./dist/proxy/index.js"
}
},
"engines": {
Expand All @@ -36,7 +32,7 @@
"@types/express": "^4.17.18"
},
"peerDependencies": {
"@bufbuild/protobuf": "^1.2.1",
"@bufbuild/protobuf": "^1.3.3",
"@connectrpc/connect": "1.1.1",
"@connectrpc/connect-node": "1.1.1"
},
Expand Down
22 changes: 9 additions & 13 deletions packages/connect-fastify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,29 @@
"url": "https://github.com/connectrpc/connect-es.git",
"directory": "packages/connect-fastify"
},
"sideEffects": false,
"scripts": {
"clean": "rm -rf ./dist/cjs/* ./dist/esm/*",
"build": "npm run build:cjs && npm run build:esm",
"clean": "rm -rf ./dist/*",
"build": "npm run build:cjs && npm run build:esm && npm run build:proxy",
"build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm",
"build:proxy": "node ../../scripts/gen-esm-proxy.mjs .",
"attw": "attw --pack"
},
"main": "./dist/cjs/index.js",
"type": "module",
"sideEffects": false,
"main": "./dist/cjs/index.js",
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
"module": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"import": "./dist/proxy/index.js"
}
},
"engines": {
"node": ">=16.0.0"
},
"peerDependencies": {
"@bufbuild/protobuf": "^1.2.1",
"@bufbuild/protobuf": "^1.3.3",
"fastify": "^4.22.1",
"@connectrpc/connect": "1.1.1",
"@connectrpc/connect-node": "1.1.1"
Expand Down
22 changes: 9 additions & 13 deletions packages/connect-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,29 @@
"url": "https://github.com/connectrpc/connect-es.git",
"directory": "packages/connect-next"
},
"sideEffects": false,
"scripts": {
"clean": "rm -rf ./dist/cjs/* ./dist/esm/*",
"build": "npm run build:cjs && npm run build:esm",
"clean": "rm -rf ./dist/*",
"build": "npm run build:cjs && npm run build:esm && npm run build:proxy",
"build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm",
"build:proxy": "node ../../scripts/gen-esm-proxy.mjs .",
"attw": "attw --pack"
},
"main": "./dist/cjs/index.js",
"type": "module",
"sideEffects": false,
"main": "./dist/cjs/index.js",
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
"module": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"import": "./dist/proxy/index.js"
}
},
"engines": {
"node": ">=16.0.0"
},
"peerDependencies": {
"@bufbuild/protobuf": "^1.2.1",
"@bufbuild/protobuf": "^1.3.3",
"next": "^13.2.4",
"@connectrpc/connect": "1.1.1",
"@connectrpc/connect-node": "1.1.1"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/connect-node-test/src/gen/server/v1/server_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 10 additions & 14 deletions packages/connect-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,21 @@
"directory": "packages/connect-node"
},
"scripts": {
"clean": "rm -rf ./dist/cjs/* ./dist/esm/*",
"build": "npm run build:cjs && npm run build:esm",
"clean": "rm -rf ./dist/*",
"build": "npm run build:cjs && npm run build:esm && npm run build:proxy",
"build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm",
"jasmine": "jasmine --config=jasmine.json",
"attw": "attw --pack"
"build:proxy": "node ../../scripts/gen-esm-proxy.mjs .",
"attw": "attw --pack",
"jasmine": "jasmine --config=jasmine.json"
},
"main": "./dist/cjs/index.js",
"type": "module",
"main": "./dist/cjs/index.js",
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
"module": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"import": "./dist/proxy/index.js"
}
},
"engines": {
Expand All @@ -36,7 +32,7 @@
"undici": "^5.25.4"
},
"peerDependencies": {
"@bufbuild/protobuf": "^1.2.1",
"@bufbuild/protobuf": "^1.3.3",
"@connectrpc/connect": "1.1.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-web-bench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"@connectrpc/connect-web": "1.1.1",
"@bufbuild/protobuf": "^1.3.1",
"@bufbuild/protobuf": "^1.3.3",
"@bufbuild/protoc-gen-es": "^1.3.1",
"brotli": "^1.3.3",
"esbuild": "^0.16.12",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 45e28e9

Please sign in to comment.