MCPcopy
hub / github.com/tailwindlabs/tailwindcss / toSource

Function toSource

packages/@tailwindcss-postcss/src/ast.ts:26–48  ·  view source on GitHub ↗
(loc: SourceLocation | undefined)

Source from the content-addressed store, hash-verified

24 root.source = source
25
26 function toSource(loc: SourceLocation | undefined): postcss.Source | undefined {
27 // Use the fallback if this node has no location info in the AST
28 if (!loc) return
29 if (!loc[0]) return
30
31 let table = lineTables.get(loc[0])
32 let start = table.find(loc[1])
33 let end = table.find(loc[2])
34
35 return {
36 input: inputMap.get(loc[0]),
37 start: {
38 line: start.line,
39 column: start.column + 1,
40 offset: loc[1],
41 },
42 end: {
43 line: end.line,
44 column: end.column + 1,
45 offset: loc[2],
46 },
47 }
48 }
49
50 function updateSource(astNode: postcss.ChildNode, loc: SourceLocation | undefined) {
51 let source = toSource(loc)

Callers 2

updateSourceFunction · 0.85
transformFunction · 0.85

Calls 2

findMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected