MCPcopy
hub / github.com/vitejs/vite / limitFlattenIdLength

Function limitFlattenIdLength

packages/vite/src/node/utils.ts:91–99  ·  view source on GitHub ↗
(
  id: string,
  limit: number = FLATTEN_ID_MAX_FILE_LENGTH,
)

Source from the content-addressed store, hash-verified

89const FLATTEN_ID_MAX_FILE_LENGTH = 170
90
91const limitFlattenIdLength = (
92 id: string,
93 limit: number = FLATTEN_ID_MAX_FILE_LENGTH,
94): string => {
95 if (id.length <= limit) {
96 return id
97 }
98 return id.slice(0, limit - (FLATTEN_ID_HASH_LENGTH + 1)) + '_' + getHash(id)
99}
100
101export const normalizeId = (id: string): string =>
102 id.replace(replaceNestedIdRE, ' > ')

Callers 1

flattenIdFunction · 0.85

Calls 1

getHashFunction · 0.85

Tested by

no test coverage detected