@0001-labs/idv1 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/package.json +8 -9
  2. package/src/shapes.ts +5 -2
package/package.json CHANGED
@@ -1,28 +1,27 @@
1
1
  {
2
2
  "name": "@0001-labs/idv1",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Short codes whose shape says what they name: accounts, products, lists and items, how many there can be, and the scannable code that carries them; and, under advanced, a code for every event.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/0001-labs/IDv1.git"
9
9
  },
10
- "type": "module",
11
- "exports": {
12
- ".": "./src/index.ts",
13
- "./advanced": "./src/advanced.ts"
14
- },
15
10
  "files": [
16
11
  "src/",
17
12
  "README.md",
18
13
  "LICENSE"
19
14
  ],
15
+ "type": "module",
16
+ "exports": {
17
+ ".": "./src/index.ts",
18
+ "./advanced": "./src/advanced.ts"
19
+ },
20
20
  "devDependencies": {
21
21
  "@types/node": "^22.13.1",
22
22
  "typescript": "^6.0.3",
23
- "vite": "npm:@voidzero-dev/vite-plus-core@0.2.8",
24
- "vite-plus": "0.2.8",
25
- "vitest": "4.1.10"
23
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
24
+ "vite-plus": "1.3.0"
26
25
  },
27
26
  "devEngines": {
28
27
  "packageManager": {
package/src/shapes.ts CHANGED
@@ -117,10 +117,13 @@ export const RESERVED_ACCOUNT_EMAILS = {
117
117
  /** Codes a role once had, still never drawn for anyone else: the onboarding test account was On4713 before On0001. */
118
118
  export const FORMER_RESERVED_ACCOUNT_CODES = ['On4713'] as const
119
119
 
120
- const RESERVED = new Set([...Object.values(RESERVED_ACCOUNT_CODES), ...FORMER_RESERVED_ACCOUNT_CODES].map(code => code.toLowerCase()))
120
+ // Built on first use rather than when the module loads, so a page that only reads codes leaves the
121
+ // reserved ones out of its bundle: a bundler keeps a top-level `new Set(…)` in case it has side effects.
122
+ let reserved: Set<string> | undefined
121
123
 
122
124
  /** Whether a code, in any of its capitals, is kept for a person or role, now or before. */
123
- export const isReservedAccountCode = (code: string): boolean => RESERVED.has(code.toLowerCase())
125
+ export const isReservedAccountCode = (code: string): boolean =>
126
+ (reserved ??= new Set([...Object.values(RESERVED_ACCOUNT_CODES), ...FORMER_RESERVED_ACCOUNT_CODES].map(kept => kept.toLowerCase()))).has(code.toLowerCase())
124
127
 
125
128
  /** The code kept for an email, else null: a product gives it before drawing one. */
126
129
  export function reservedAccountCode(email: string | null | undefined): string | null {