PHP 8.2.30
Preview: source-maps.js Size: 1.07 KB
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/@emotion/babel-plugin/src/utils/source-maps.js

import { SourceMapGenerator } from 'source-map'
import convert from 'convert-source-map'

function getGeneratorOpts(file) {
  return file.opts.generatorOpts ? file.opts.generatorOpts : file.opts
}

export function makeSourceMapGenerator(file) {
  const generatorOpts = getGeneratorOpts(file)
  const filename = generatorOpts.sourceFileName
  const generator = new SourceMapGenerator({
    file: filename,
    sourceRoot: generatorOpts.sourceRoot
  })

  generator.setSourceContent(filename, file.code)
  return generator
}

export function getSourceMap(
  offset /*: {
    line: number,
    column: number
  } */,
  state
) /*: string */ {
  const generator = makeSourceMapGenerator(state.file)
  const generatorOpts = getGeneratorOpts(state.file)
  if (
    generatorOpts.sourceFileName &&
    generatorOpts.sourceFileName !== 'unknown'
  ) {
    generator.addMapping({
      generated: {
        line: 1,
        column: 0
      },
      source: generatorOpts.sourceFileName,
      original: offset
    })
    return convert.fromObject(generator).toComment({ multiline: true })
  }
  return ''
}

Directory Contents

Dirs: 0 × Files: 13

Name Size Perms Modified Actions
750 B lrw-r--r-- 2026-02-28 00:26:46
Edit Download
373 B lrw-r--r-- 2026-02-28 00:27:12
Edit Download
2.79 KB lrw-r--r-- 2026-02-28 00:28:00
Edit Download
1.49 KB lrw-r--r-- 2026-02-28 00:28:06
Edit Download
537 B lrw-r--r-- 2026-02-28 00:28:12
Edit Download
4.62 KB lrw-r--r-- 2026-02-28 00:28:18
Edit Download
3.91 KB lrw-r--r-- 2026-02-28 00:28:22
Edit Download
1.26 KB lrw-r--r-- 2026-02-28 00:28:24
Edit Download
1.07 KB lrw-r--r-- 2026-02-28 00:28:26
Edit Download
1.90 KB lrw-r--r-- 2026-02-28 00:28:28
Edit Download
4.21 KB lrw-r--r-- 2026-02-28 00:28:30
Edit Download
1.65 KB lrw-r--r-- 2026-02-28 00:28:32
Edit Download
2.28 KB lrw-r--r-- 2026-02-28 00:28:32
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).