History

Import plugin-authoring symbols from sdk/core in file-secrets and keychain

Rhys Sullivan committed 2 months ago

Commit 607a1df1 parent 10e16a57 files · +31 −7Browse files

Unified · Split

7 files
  1. .changeset/fix-plugin-sdk-root-imports.md +6 −0
  2. packages/plugins/file-secrets/src/index.ts +1 −1
  3. packages/plugins/file-secrets/src/promise.ts +2 −2
  4. packages/plugins/keychain/src/index.ts +1 −1
  5. packages/plugins/keychain/src/promise.ts +2 −2
  6. packages/plugins/keychain/src/provider.ts +1 −1
  7. scripts/smoke-test-packed.ts +18 −0
.changeset/fix-plugin-sdk-root-imports.md+6−0
@@ -0,0 +1,6 @@
1---
2"@executor-js/plugin-file-secrets": patch
3"@executor-js/plugin-keychain": patch
4---
5
6Import plugin-authoring symbols from `@executor-js/sdk/core` instead of the package root. The published root is the Promise surface and does not export `StorageError`, `definePlugin`, `PluginCtx`, or `Plugin`, so both packages failed to load when installed from npm.
packages/plugins/file-secrets/src/index.ts+1−1
@@ -9,7 +9,7 @@ import { · 8 unmodified lines
9 ProviderKey,9 ProviderKey,
10 StorageError,10 StorageError,
11 type CredentialProvider,11 type CredentialProvider,
12} from "@executor-js/sdk";12} from "@executor-js/sdk/core";
13 13
14// ---------------------------------------------------------------------------14// ---------------------------------------------------------------------------
15// Auth file location15// Auth file location
packages/plugins/file-secrets/src/promise.ts+2−2
@@ -1,4 +1,4 @@
1import { type Plugin } from "@executor-js/sdk";1import { type Plugin } from "@executor-js/sdk/core";
2 2
3import {3import {
4 fileSecretsPlugin as fileSecretsPluginEffect,4 fileSecretsPlugin as fileSecretsPluginEffect,
@@ -9,7 +9,7 @@ import { · 4 unmodified lines
9export type { FileSecretsPluginConfig } from "./index";9export type { FileSecretsPluginConfig } from "./index";
10 10
11// Explicit return type so the emitted dist/promise.d.ts references11// Explicit return type so the emitted dist/promise.d.ts references
12// `import("@executor-js/sdk").Plugin` rather than the Promise-surface12// `import("@executor-js/sdk/core").Plugin` rather than the Promise-surface
13// root specifier (which doesn't re-export Plugin).13// root specifier (which doesn't re-export Plugin).
14export const fileSecretsPlugin = (14export const fileSecretsPlugin = (
15 config?: FileSecretsPluginConfig,15 config?: FileSecretsPluginConfig,
packages/plugins/keychain/src/index.ts+1−1
@@ -1,6 +1,6 @@
1import { Effect } from "effect";1import { Effect } from "effect";
2 2
3import { definePlugin, type CredentialProvider, type PluginCtx } from "@executor-js/sdk";3import { definePlugin, type CredentialProvider, type PluginCtx } from "@executor-js/sdk/core";
4 4
5import {5import {
6 deletePassword,6 deletePassword,
packages/plugins/keychain/src/promise.ts+2−2
@@ -1,4 +1,4 @@
1import { type Plugin } from "@executor-js/sdk";1import { type Plugin } from "@executor-js/sdk/core";
2 2
3import {3import {
4 keychainPlugin as keychainPluginEffect,4 keychainPlugin as keychainPluginEffect,
@@ -9,7 +9,7 @@ import { · 4 unmodified lines
9export type { KeychainPluginConfig } from "./index";9export type { KeychainPluginConfig } from "./index";
10 10
11// Explicit return type so the emitted dist/promise.d.ts references11// Explicit return type so the emitted dist/promise.d.ts references
12// `import("@executor-js/sdk").Plugin` rather than the Promise-surface12// `import("@executor-js/sdk/core").Plugin` rather than the Promise-surface
13// root specifier (which doesn't re-export Plugin).13// root specifier (which doesn't re-export Plugin).
14export const keychainPlugin = (14export const keychainPlugin = (
15 config?: KeychainPluginConfig,15 config?: KeychainPluginConfig,
packages/plugins/keychain/src/provider.ts+1−1
@@ -5,7 +5,7 @@ import { · 4 unmodified lines
5 ProviderKey,5 ProviderKey,
6 type CredentialProvider,6 type CredentialProvider,
7 type ProviderItemId,7 type ProviderItemId,
8} from "@executor-js/sdk";8} from "@executor-js/sdk/core";
9 9
10import type { KeychainError } from "./errors";10import type { KeychainError } from "./errors";
11import { getPassword, setPassword, deletePassword } from "./keyring";11import { getPassword, setPassword, deletePassword } from "./keyring";
scripts/smoke-test-packed.ts+18−0
@@ -78,6 +78,13 @@ type SmokeFailure = { · 77 unmodified lines
78 78
79const PRIVATE_PACKAGE_RE = /Cannot find package '(@executor-js\/[^']+)'/;79const PRIVATE_PACKAGE_RE = /Cannot find package '(@executor-js\/[^']+)'/;
80 80
81// `import { X } from "@executor-js/sdk"` where the published entry doesn't
82// export `X` — the packed bundle references a symbol that only exists on a
83// different subpath (or in the dev-time workspace view). This is a bundle
84// bug, never a missing-peer environment issue, so it's a hard failure.
85const MISSING_EXPORT_RE =
86 /The requested module '([^']+)' does not provide an export named '([^']+)'/;
87
81const firstMeaningfulLine = (stderr: string): string => {88const firstMeaningfulLine = (stderr: string): string => {
82 const lines = stderr89 const lines = stderr
83 .split("\n")90 .split("\n")
@@ -182,6 +189,17 @@ const smokeTestPackage = async ( · 98 unmodified lines
182 console.log(` FAIL ${spec} — references private '${offending}'`);189 console.log(` FAIL ${spec} — references private '${offending}'`);
183 continue;190 continue;
184 }191 }
192 const missingExportMatch = stderr.match(MISSING_EXPORT_RE);
193 if (missingExportMatch) {
194 const [, module, symbol] = missingExportMatch;
195 failures.push({
196 pkg: pkg.name,
197 subpath,
198 reason: `published '${module}' does not export '${symbol}'`,
199 });
200 console.log(` FAIL ${spec} — '${module}' does not export '${symbol}'`);
201 continue;
202 }
185 const peerMatch =203 const peerMatch =
186 stderr.match(/Cannot find package '([^']+)'/) ??204 stderr.match(/Cannot find package '([^']+)'/) ??
187 stderr.match(/Cannot find module '([^']+)'/);205 stderr.match(/Cannot find module '([^']+)'/);