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

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

export interface ImportedVar
 Import a Python config module as bundle-local variables (Phase 24.1).
 
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 = ''
 
const q = readQuoted(source)
 
 else
 
imported as source text
 
 __pad4__
 
let key = name
 
const isPub = 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

◆ ImportedVar

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

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.

◆ __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
Import a Python config module as bundle-local variables (Phase 24.1).
Definition bundle-import.ts:27
return vars
Definition import-export.ts:122

◆ __pad3__

warnings __pad3__

◆ IDENT

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

◆ null

return null

◆ value

let value

◆ kind

kind = 'string'

◆ extraWarning

extraWarning = ''

◆ q

const q = readQuoted(source)

◆ else

else
Initial value:
{
let value
Definition bundle-import.ts:195
let source
Definition generators.ts:32

◆ text

imported as source text

◆ __pad4__

__pad4__

◆ key

let key = name

◆ isPub

const isPub = 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[] = []