Skip to content

Maintenance: type exports in Parameters & Idempotency pkgs are incorrect #2284

Closed
@webdeveric

Description

@webdeveric

Expected Behaviour

The exports should be valid for the Node.js runtime and point to files that exist and are the correct file type.

Current Behaviour

Some packages have slightly incorrect exports.

For example, packages/idempotency/package.json currently has an import and require pointing to a .d.ts file. This should be a .js file.

There are also issues in packages/parameters/package.json (same as above) and packages/jmespath/package.json (missing files)

Code snippet

These should be .js files.

"./types": {
"import": "./lib/esm/types/index.d.ts",
"require": "./lib/cjs/types/index.d.ts"
}

"./ssm/types": {
"import": "./lib/esm/types/SSMProvider.d.ts",
"require": "./lib/cjs/types/SSMProvider.d.ts"
},

The files referenced here do not exist.

"./envelopes": {
"import": "./lib/esm/envelopes.js",
"require": "./lib/cjs/envelopes.js"
},

Steps to Reproduce

I recently released https://www.npmjs.com/package/validate-package-exports to help validate packages I publish to make sure I don't miss anything. Since I use Powertools, I thought I'd use it as a demo package while developing the tool.

To validate all packages, run this in the root of the repo.

find ./packages/ -maxdepth 2 -name package.json -exec npx validate-package-exports -p {} -vs \;

If you want to validate one at a time, use this:

npx validate-package-exports  --check --verify --package [PATH-TO-PACKAGE.JSON]

Possible Solution

Update */types exports to look like this.

"./types": {
  "require": {
    "types": "./lib/cjs/types/index.d.ts",
    "default": "./lib/cjs/types/index.js"
  },
  "import": {
    "types": "./lib/esm/types/index.d.ts",
    "default": "./lib/esm/types/index.js"
  }
}

Powertools for AWS Lambda (TypeScript) version

latest

AWS Lambda function runtime

20.x

Packaging format used

npm

Execution logs

No response

Metadata

Metadata

Assignees

Labels

completedThis item is complete and has been merged/shippedenhancementPRs that introduce minor changes, usually to existing featuresidempotencyThis item relates to the Idempotency UtilityparametersThis item relates to the Parameters Utility

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions