@wtfalch/email 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
- import 'server-only';
2
1
  import type { Instance } from './instance.js';
3
2
  export interface Applied {
4
3
  /** For the audit row's `targetType`. */
@@ -1,4 +1,3 @@
1
- import 'server-only';
2
1
  import { MailWriteRefused, newAccount, withAlias, withoutAlias, withoutAppPassword, } from './writes.js';
3
2
  /**
4
3
  * The four writes `/email` makes, each as one round trip against the mail
File without changes
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * What a browser bundle gets instead of the administration client.
4
+ *
5
+ * This entry reaches a mail server with an administrator credential that, on
6
+ * Stalwart 0.16, cannot be scoped and is as powerful as the whole account. It
7
+ * must never end up in something a browser downloads.
8
+ *
9
+ * **Why the `browser` condition and not `server-only`.** `server-only` throws
10
+ * in any environment without React's `react-server` condition, which includes
11
+ * plain Node — and this entry exists partly so a provisioning CLI can use it,
12
+ * so that guard broke the legitimate caller while blocking the illegitimate
13
+ * one. The `browser` condition in the exports map is the tool that tells them
14
+ * apart: a bundler targeting a browser resolves here, while Node and a React
15
+ * Server Components build resolve the real module.
16
+ *
17
+ * It throws at import rather than exporting stubs, so the failure is at build
18
+ * or first load with a sentence saying what to do, not a runtime mystery
19
+ * about a client that never answers.
20
+ */
21
+ throw new Error('@wtfalch/email/postmaster is server-side only: it holds an administrator credential for a mail server and must not be bundled for a browser. Call it from a Server Component, a Server Action, a route handler or a Node script, and render the results with @wtfalch/email/postmaster/react.');
@@ -1,12 +1,3 @@
1
- /**
2
- * `server-only`, and it is load-bearing rather than decorative. This module
3
- * reaches a mail server with an administrator credential that, on Stalwart
4
- * 0.16, cannot be scoped and is as powerful as the whole account. Nothing
5
- * about living in its own entry stops a client component importing it —
6
- * bundlers follow imports, not entry names — so the guard that actually
7
- * fails such a build is this line.
8
- */
9
- import 'server-only';
10
1
  /**
11
2
  * Administer a Stalwart mail server over its JMAP management API: the
12
3
  * domain, the mailboxes, their aliases, their app passwords and their
@@ -1,12 +1,3 @@
1
- /**
2
- * `server-only`, and it is load-bearing rather than decorative. This module
3
- * reaches a mail server with an administrator credential that, on Stalwart
4
- * 0.16, cannot be scoped and is as powerful as the whole account. Nothing
5
- * about living in its own entry stops a client component importing it —
6
- * bundlers follow imports, not entry names — so the guard that actually
7
- * fails such a build is this line.
8
- */
9
- import 'server-only';
10
1
  /**
11
2
  * Administer a Stalwart mail server over its JMAP management API: the
12
3
  * domain, the mailboxes, their aliases, their app passwords and their
@@ -1,4 +1,3 @@
1
- import 'server-only';
2
1
  import { StalwartClient } from './client.js';
3
2
  /**
4
3
  * A mail instance and the credential this program acts on it with.
@@ -1,4 +1,3 @@
1
- import 'server-only';
2
1
  import { StalwartClient, authFor } from './client.js';
3
2
  /**
4
3
  * An instance from a URL and one opaque secret, with the scheme chosen from
@@ -1,4 +1,3 @@
1
- import 'server-only';
2
1
  import type { Instance } from './instance.js';
3
2
  import { type Overview, type Person } from './overview.js';
4
3
  /**
@@ -1,4 +1,3 @@
1
- import 'server-only';
2
1
  import { resolveMx } from 'node:dns/promises';
3
2
  import { overview, } from './overview.js';
4
3
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/email",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "The wtfalch estate: reading a mailbox over JMAP, and administering the Stalwart server it lives on. Two entries with no code in common.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -23,6 +23,7 @@
23
23
  },
24
24
  "./mailbox/mail.css": "./dist/mailbox/mail.css",
25
25
  "./postmaster": {
26
+ "browser": "./dist/postmaster/browser-refusal.js",
26
27
  "types": "./dist/postmaster/index.d.ts",
27
28
  "default": "./dist/postmaster/index.js"
28
29
  },
@@ -64,10 +65,6 @@
64
65
  "typescript": "^5.9.0",
65
66
  "vitest": "^4.1.6"
66
67
  },
67
- "dependencies": {
68
- "jmap-jam": "^0.13.6",
69
- "server-only": "^0.0.1"
70
- },
71
68
  "sideEffects": false,
72
69
  "publishConfig": {
73
70
  "access": "public"
@@ -82,6 +79,9 @@
82
79
  "stalwart",
83
80
  "rfc8621"
84
81
  ],
82
+ "dependencies": {
83
+ "jmap-jam": "^0.13.6"
84
+ },
85
85
  "scripts": {
86
86
  "build": "rm -rf dist && tsc -p tsconfig.build.json && cp src/mailbox/react/mail.css dist/mailbox/mail.css",
87
87
  "typecheck": "tsc --noEmit",