feat(package): expose subpath exports for lighter consumer imports
Closes #237.
The problem
The default import { SquareClient } from 'square' entry transitively loads every API resource client, every Fern-generated type module, and the ~1,300 runtime serialization schemas under serialization/types/. On boot-sensitive workloads (serverless cold starts, autoscaling instances) the total dominates startup time — the issue reporter measured ~600 ms just from require('square') on an M3 MacBook Air, with serialization/index.js alone accounting for 12 % of the boot path.
The SDK's surface is already split across small directories at the package root after prepack copies dist/. over (./api/, ./serialization/, ./Client.js, ./environments.js, ./errors/), but the exports map only publishes . and ./legacy, so consumers who want to opt out can't reach the internal modules through a supported path.
The change
Add subpath entries — each with a types mapping so TypeScript's nodenext / bundler resolvers find the declarations — that let consumers import only the slice they need:
// Just the type definitions for a single resource — no runtime schemas loaded.
import type { Payment } from 'square/api/types/Payment';
// Just one resource client.
import { PaymentsClient } from 'square/api/resources/payments';
// Just the runtime serialization for a single model.
import { Payment as PaymentSchema } from 'square/serialization/types/Payment';
// Just the SDK entry-point class and constants.
import { SquareClient } from 'square/Client';
import { SquareEnvironment } from 'square/environments';
The default import { SquareClient } from 'square' entry is unchanged and remains the recommended import for typical usage — the new entries are strictly additive, no existing call site changes shape.
README gets a short ### Subpath imports subsection under ## Usage pointing at the new import paths and the cold-start motivation, so the next person reading the docs after a wiz / lighthouse / cold-start profile knows the supported escape hatch.
What this doesn't do
This doesn't make the default square entry itself faster — the eager re-exports in src/index.ts and the Fern-generated cascade still pull in everything. That looks like a separate (and bigger) discussion about how the generator structures the umbrella module; happy to follow up there if there's appetite.