Skip to content

Commit 5fb19b5

Browse files
committed
refactor: annotate module-level allocations with /* @__PURE__ */
C07 — allow bundlers to drop unused allocating consts. Four sites: SELF_CLOSING_TAGS, UNSAFE_KEYS (new Set); useHotkey/parsing logger (useLogger call); createValidation UNSET (Symbol call). Plain object literals (BLACK, WHITE) exempt.
1 parent 860dcdd commit 5fb19b5

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/0/src/composables/createValidation/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export interface ValidationOptions extends GroupOptions {
8787
value?: MaybeRefOrGetter<unknown>
8888
}
8989

90-
const UNSET = Symbol('unset')
90+
const UNSET = /* @__PURE__ */ Symbol('unset')
9191

9292
/**
9393
* Creates a per-input validation instance.

packages/0/src/composables/useHotkey/parsing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useLogger } from '#v0/composables/useLogger'
44
// Utilities
55
import { normalizeKey } from './aliases'
66

7-
const logger = useLogger()
7+
const logger = /* @__PURE__ */ useLogger()
88

99
// Constants
1010
export const MODIFIERS = ['ctrl', 'shift', 'alt', 'meta', 'cmd'] as const

packages/0/src/constants/htmlElements.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const selfClosingTags = [
1919
* These elements cannot have children and don't need closing tags
2020
*/
2121

22-
export const SELF_CLOSING_TAGS = new Set(selfClosingTags)
22+
export const SELF_CLOSING_TAGS = /* @__PURE__ */ new Set(selfClosingTags)
2323

2424
/**
2525
* Common HTML element types for polymorphic components

packages/0/src/utilities/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ export function isNaN (item: unknown): item is number {
278278
}
279279

280280
// Keys that could lead to prototype pollution
281-
const UNSAFE_KEYS = new Set(['__proto__', 'constructor', 'prototype'])
281+
const UNSAFE_KEYS = /* @__PURE__ */ new Set(['__proto__', 'constructor', 'prototype'])
282282

283283
function isPlainObject (value: unknown): value is Record<string, unknown> {
284284
if (typeof value !== 'object' || value === null || Array.isArray(value)) return false

0 commit comments

Comments
 (0)