MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / makeUniqueLocal

Function makeUniqueLocal

packages/vite/hmr/helpers/ast-normalizer.ts:119–131  ·  view source on GitHub ↗
(base: string)

Source from the content-addressed store, hash-verified

117 }
118 };
119 const makeUniqueLocal = (base: string) => {
120 let name = base;
121 if (!isValidLocal(name)) {
122 name = `__ns_${name.replace(/[^A-Za-z0-9_$]+/g, '_') || 'id'}`;
123 }
124 let i = 1;
125 let cand = name;
126 while (declared.has(cand)) {
127 cand = `${name}_${i++}`;
128 }
129 declared.add(cand);
130 return cand;
131 };
132 if (isRt || isCore) {
133 let named = (path.node.specifiers || []).filter((s) => t.isImportSpecifier(s)) as t.ImportSpecifier[];
134 if (isRt && named.length) {

Callers

nothing calls this directly

Calls 3

isValidLocalFunction · 0.85
replaceMethod · 0.80
addMethod · 0.65

Tested by

no test coverage detected