diff --git a/package-lock.json b/package-lock.json index f6a48503..e3984733 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9825,6 +9825,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/get-own-enumerable-keys/-/get-own-enumerable-keys-1.0.0.tgz", "integrity": "sha512-PKsK2FSrQCyxcGHsGrLDcK0lx+0Ke+6e8KFFozA9/fIQLhQzPaRvJFdcz7+Axg3jUH/Mq+NI4xa5u/UT2tQskA==", + "dev": true, "engines": { "node": ">=14.16" }, @@ -23065,10 +23066,8 @@ "version": "7.0.0-beta.3", "license": "MIT", "dependencies": { - "camelcase": "^8.0.0", "content-type": "^1.0.5", - "reserved2": "^0.1.5", - "stringify-object": "^5.0.0" + "reserved2": "^0.1.5" }, "devDependencies": { "@readme/oas-examples": "^5.12.0", @@ -23076,6 +23075,8 @@ "@types/content-type": "^1.1.6", "@types/stringify-object": "^4.0.3", "@vitest/coverage-v8": "^0.34.4", + "camelcase": "^8.0.0", + "stringify-object": "^5.0.0", "typescript": "^5.2.2", "vitest": "^0.34.5" }, @@ -23091,6 +23092,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz", "integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==", + "dev": true, "engines": { "node": ">=16" }, @@ -23102,6 +23104,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-3.0.0.tgz", "integrity": "sha512-IlsXEHOjtKhpN8r/tRFj2nDyTmHvcfNeu/nrRIcXE17ROeatXchkojffa1SpdqW4cr/Fj6QkEf/Gn4zf6KKvEQ==", + "dev": true, "engines": { "node": ">=12" }, @@ -23113,6 +23116,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-3.1.0.tgz", "integrity": "sha512-rbku49cWloU5bSMI+zaRaXdQHXnthP6DZ/vLnfdSKyL4zUzuWnomtOEiZZOd+ioQ+avFo/qau3KPTc7Fjy1uPA==", + "dev": true, "engines": { "node": ">=12" }, @@ -23124,6 +23128,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-5.0.0.tgz", "integrity": "sha512-zaJYxz2FtcMb4f+g60KsRNFOpVMUyuJgA51Zi5Z1DOTC3S59+OQiVOzE9GZt0x72uBGWKsQIuBKeF9iusmKFsg==", + "dev": true, "dependencies": { "get-own-enumerable-keys": "^1.0.0", "is-obj": "^3.0.0", diff --git a/packages/core/package.json b/packages/core/package.json index dbde08e4..7c9f1865 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -59,6 +59,9 @@ "oas": "^24.0.0", "remove-undefined-objects": "^5.0.0" }, + "bundledDependencies": [ + "get-stream" + ], "devDependencies": { "@api/test-utils": "file:../test-utils", "@readme/oas-examples": "^5.12.0", diff --git a/packages/core/src/lib/prepareParams.ts b/packages/core/src/lib/prepareParams.ts index 1d9cd9fb..dbb79ecf 100644 --- a/packages/core/src/lib/prepareParams.ts +++ b/packages/core/src/lib/prepareParams.ts @@ -9,8 +9,6 @@ import stream from 'node:stream'; import caseless from 'caseless'; import DatauriParser from 'datauri/parser.js'; import datauri from 'datauri/sync.js'; -// `get-stream` is included in our bundle, see `tsup.config.ts` -// eslint-disable-next-line import/no-extraneous-dependencies import { getStreamAsBuffer } from 'get-stream'; import lodashMerge from 'lodash.merge'; import removeUndefinedObjects from 'remove-undefined-objects'; diff --git a/packages/core/tsup.config.ts b/packages/core/tsup.config.ts index 3e45fdf5..ac904e72 100644 --- a/packages/core/tsup.config.ts +++ b/packages/core/tsup.config.ts @@ -11,11 +11,14 @@ export default defineConfig((options: Options) => ({ ...config, entry: ['src/errors/fetchError.ts', 'src/lib/index.ts', 'src/index.ts', 'src/types.ts'], + noExternal: [ - // `get-stream` is ESM-only and we need to build for CommonJS, - // so including it here means that its (tree-shaken!) source code - // will be included directly in our dist outputs. + // These dependencies are ESM-only but because we're building for ESM **and** CJS we can't + // treat them as external dependencies as CJS libraries can't load ESM code that uses `export`. + // `noExternal` will instead treeshake these dependencies down and include them in our compiled + // dists. 'get-stream', ], + silent: !options.watch, })); diff --git a/packages/httpsnippet-client-api/package.json b/packages/httpsnippet-client-api/package.json index d111d27a..ecc69f74 100644 --- a/packages/httpsnippet-client-api/package.json +++ b/packages/httpsnippet-client-api/package.json @@ -36,21 +36,25 @@ "node": ">=18" }, "dependencies": { - "camelcase": "^8.0.0", "content-type": "^1.0.5", - "reserved2": "^0.1.5", - "stringify-object": "^5.0.0" + "reserved2": "^0.1.5" }, "peerDependencies": { "@readme/httpsnippet": ">=8.1.2", "oas": "^24.0.0" }, + "bundledDependencies": [ + "camelcase", + "stringify-object" + ], "devDependencies": { "@readme/oas-examples": "^5.12.0", "@readme/openapi-parser": "^2.5.0", "@types/content-type": "^1.1.6", "@types/stringify-object": "^4.0.3", "@vitest/coverage-v8": "^0.34.4", + "camelcase": "^8.0.0", + "stringify-object": "^5.0.0", "typescript": "^5.2.2", "vitest": "^0.34.5" }, diff --git a/packages/httpsnippet-client-api/tsup.config.ts b/packages/httpsnippet-client-api/tsup.config.ts index 0d8d183e..3b77e424 100644 --- a/packages/httpsnippet-client-api/tsup.config.ts +++ b/packages/httpsnippet-client-api/tsup.config.ts @@ -11,5 +11,15 @@ export default defineConfig((options: Options) => ({ ...config, entry: ['src/index.ts'], + + noExternal: [ + // These dependencies are ESM-only but because we're building for ESM **and** CJS we can't + // treat them as external dependencies as CJS libraries can't load ESM code that uses `export`. + // `noExternal` will instead treeshake these dependencies down and include them in our compiled + // dists. + 'camelcase', + 'stringify-object', + ], + silent: !options.watch, }));