From e51d7b08775ee0cd324d4e78ffc3d52b2136b1dd Mon Sep 17 00:00:00 2001 From: Dimitris Marlagkoutsos Date: Tue, 21 Jan 2025 20:59:21 +0100 Subject: [PATCH] chore(swingset-liveslots): export TypeScript definitions --- packages/swingset-liveslots/package.json | 6 +++++- packages/swingset-liveslots/src/index.js | 3 --- packages/swingset-liveslots/src/ts-types.ts | 6 ++++++ packages/swingset-liveslots/src/types-index.d.ts | 4 ---- packages/swingset-liveslots/src/types-index.js | 2 -- packages/swingset-liveslots/src/types.js | 4 ---- packages/swingset-liveslots/tsconfig.build.json | 10 ++++++++++ packages/swingset-liveslots/tsconfig.json | 2 ++ 8 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 packages/swingset-liveslots/src/ts-types.ts delete mode 100644 packages/swingset-liveslots/src/types-index.d.ts delete mode 100644 packages/swingset-liveslots/src/types-index.js create mode 100644 packages/swingset-liveslots/tsconfig.build.json diff --git a/packages/swingset-liveslots/package.json b/packages/swingset-liveslots/package.json index badc6db6845..0665b8bc093 100644 --- a/packages/swingset-liveslots/package.json +++ b/packages/swingset-liveslots/package.json @@ -4,6 +4,7 @@ "description": "SwingSet ocap support layer", "type": "module", "main": "src/index.js", + "types": "src/ts-types.d.ts", "engines": { "node": "^18.12 || ^20.9" }, @@ -14,7 +15,9 @@ "lint-fix": "yarn lint:eslint --fix", "lint": "run-s --continue-on-error lint:*", "lint:types": "tsc", - "lint:eslint": "eslint ." + "lint:eslint": "eslint .", + "prepack": "tsc --build tsconfig.build.json", + "postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'" }, "dependencies": { "@endo/errors": "^1.2.8", @@ -38,6 +41,7 @@ "files": [ "src/**/*.js", "src/**/*.d.ts", + "src/**/*.map", "test/**/*.js", "tools", "exported.js" diff --git a/packages/swingset-liveslots/src/index.js b/packages/swingset-liveslots/src/index.js index 50ca0ac4108..0745ce4a30d 100644 --- a/packages/swingset-liveslots/src/index.js +++ b/packages/swingset-liveslots/src/index.js @@ -1,6 +1,5 @@ /// -/* eslint-disable import/export -- types files have no named runtime exports */ export { makeLiveSlots, makeMarshaller } from './liveslots.js'; export { @@ -10,5 +9,3 @@ export { insistVatSyscallObject, insistVatSyscallResult, } from './message.js'; - -export * from './types-index.js'; diff --git a/packages/swingset-liveslots/src/ts-types.ts b/packages/swingset-liveslots/src/ts-types.ts new file mode 100644 index 00000000000..66635f0b1fd --- /dev/null +++ b/packages/swingset-liveslots/src/ts-types.ts @@ -0,0 +1,6 @@ +export * from './index.js'; + +// Export any additional type this package provides +// eslint-disable-next-line import/export +export type * from './types.js'; +export type * from './vatDataTypes.ts'; diff --git a/packages/swingset-liveslots/src/types-index.d.ts b/packages/swingset-liveslots/src/types-index.d.ts deleted file mode 100644 index b68d7f728b1..00000000000 --- a/packages/swingset-liveslots/src/types-index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Export all the types this package provides -// eslint-disable-next-line import/export -export type * from './types.js'; -export type * from './vatDataTypes.js'; diff --git a/packages/swingset-liveslots/src/types-index.js b/packages/swingset-liveslots/src/types-index.js deleted file mode 100644 index d382eb5feaf..00000000000 --- a/packages/swingset-liveslots/src/types-index.js +++ /dev/null @@ -1,2 +0,0 @@ -// Empty JS file to correspond with its .d.ts twin -export {}; diff --git a/packages/swingset-liveslots/src/types.js b/packages/swingset-liveslots/src/types.js index 05856154136..779a1a66868 100644 --- a/packages/swingset-liveslots/src/types.js +++ b/packages/swingset-liveslots/src/types.js @@ -1,10 +1,6 @@ // Ensure this is a module. export {}; -/** - * @callback makeLiveSlots - */ - /** * The MeterControl object gives liveslots a mechanism to disable metering for certain GC-sensitive * regions of code. Only the XS worker can actually do metering, but we track the enabled/disabled diff --git a/packages/swingset-liveslots/tsconfig.build.json b/packages/swingset-liveslots/tsconfig.build.json new file mode 100644 index 00000000000..3bf07ead8ba --- /dev/null +++ b/packages/swingset-liveslots/tsconfig.build.json @@ -0,0 +1,10 @@ +{ + "extends": [ + "./tsconfig.json", + "../../tsconfig-build-options.json" + ], + "exclude": [ + "./tools", + "./test" + ] +} diff --git a/packages/swingset-liveslots/tsconfig.json b/packages/swingset-liveslots/tsconfig.json index e5bc0d46912..ee3d2083582 100644 --- a/packages/swingset-liveslots/tsconfig.json +++ b/packages/swingset-liveslots/tsconfig.json @@ -5,6 +5,8 @@ "*.js", "scripts/**/*.js", "src/**/*.js", + "src/**/*.ts", + "src/**/*.d.ts", "test/**/*.js", "tools/**/*.js", ],