UnENVerse 0.84.0
Local-first desktop secrets manager — TypeScript frontend
Loading...
Searching...
No Matches
bundle-import.ts File Reference

Functions

function readQuoted (source:string)
 if (q &&/^\s *(?:#.*)?$/.test(q.rest))
else if (/^[-+]?(?:0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+) $/.test(source))
else if (/^[-+]?\d+$/.test(source))
else if (/^[-+]?(?:\d+\.\d *|\.\d+|\d+)(?:[eE][-+]?\d+)?$/.test(source))
else if (source==='True'||source==='False')
 Parses an expression.
 if (taken.has(name))
 for (const [from, { to, n }] of rewrites) warnings.push(`$
function convertFString (body:string, bound:Map< string, string >,)
 {name} holes only.
 for (let i=0;i< body.length;i++)

Variables

import type { ValueKind } from './types'
 Import a Python config module as bundle-local variables (Phase 24.1).
export interface ImportedVar
value __pad0__
kind __pad1__
 __pad2__
 Safe to print: a prefix, a colour, a title, a link with no credential in it.
export interface BundleImport
warnings __pad3__
const IDENT = /^[A-Za-z_]\w*$/
 null
let value
let kind = 'string'
let extraWarning = ''
let unread = false
const q = readQuoted(source)
 else
imported as source text
 __pad4__
let key = name
const isPub = !unread && isPublic(name, kind, value, publicKeys)
later reference$ {n === 1 ? '' : 's'} to ${from} now ${n === 1 ? 'uses' : 'use'} ${to}`
later return { vars, warnings }
const rewrote
const string [] = []

Function Documentation

◆ readQuoted()

function readQuoted ( source:string)

◆ if() [1/6]

if ( q &&/^\s *?:#.*)?$/.test(q.rest)

◆ if() [2/6]

else if ( /^?(?:0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+) $/.test(source)[-+])

◆ if() [3/6]

else if ( /^?\d+$/. test(source)[-+])

◆ if() [4/6]

else if ( /^?(?:\d+\.\d *|\.\d+|\d+)(?:[eE][-+]?\d+)?$/.test(source)[-+])

◆ if() [5/6]

if ( pos ! pos ! = =toks.length)
new

Parses an expression.

Throws with a readable message on malformed input.

◆ if() [6/6]

if ( taken. hasname)

◆ for() [1/2]

for ( const of rewrites[from, { to, n }])

◆ convertFString()

function convertFString ( body:string,
bound:Map< string, string > )

{name} holes only.

Returns null when anything else is inside braces.

◆ for() [2/2]

for ( )

Variable Documentation

◆ type

import type { ValueKind } from './types'

Import a Python config module as bundle-local variables (Phase 24.1).

Reads the assignment subset only: string and f-string literals, ints (decimal, hex, binary, octal), floats, True/False/None. Nothing is executed. Any other right-hand side is imported as its source text with a warning naming the line, never dropped.

Rules that exist because the alternative is a silent wrong value:

  • A name assigned twice keeps the first under its own name and imports the second as name_2; every f-string written after the second assignment is rewritten to {name_2}, because that is the value Python bound at that point. All three facts are reported. "Last one wins" would hand the line between the two assignments the wrong key.
  • A snowflake-sized id stays a string end to end (large_id); a JS number would round it.
  • An f-string becomes a template over {name} holes. An f-string that holds anything but plain names ({x!r}, {x:>5}, {a + b}) cannot be a template, so it is kept as a string and reported.

Twin of vault_core::bundle_import, pinned by tests/fixtures/parity/bundle-import.json.

◆ ImportedVar

export interface ImportedVar
Initial value:
{
key: string
let key
Definition bundle-import.ts:260

◆ __pad0__

value __pad0__

◆ __pad1__

kind __pad1__

◆ __pad2__

__pad2__

Safe to print: a prefix, a colour, a title, a link with no credential in it.

Set only when the importer is sure; everything else stays masked (redaction is fail-closed). Absent, not false, when not public.

◆ BundleImport

export interface BundleImport
Initial value:
{
export interface ImportedVar
Definition bundle-import.ts:29
return vars
Definition import-export.ts:133

◆ __pad3__

warnings __pad3__

◆ IDENT

const IDENT = /^[A-Za-z_]\w*$/

◆ null

return null

◆ value

let value

◆ kind

kind = 'string'

◆ extraWarning

extraWarning = ''

◆ unread

unread = false

◆ q

const q = readQuoted(source)

◆ else

else
Initial value:
{
let value
Definition bundle-import.ts:197
let source
Definition generators.ts:38

◆ text

imported as source text

◆ __pad4__

__pad4__

◆ key

let key = name

◆ isPub

const isPub = !unread && isPublic(name, kind, value, publicKeys)

◆ reference$

later reference$ {n === 1 ? '' : 's'} to ${from} now ${n === 1 ? 'uses' : 'use'} ${to}`

◆ return

return { vars, warnings }

◆ rewrote

const rewrote

◆ string

const string[] = []