MCPcopy Create free account
hub / github.com/cure53/DOMPurify / resolveTsAsJs

Function resolveTsAsJs

config/rollup.coverage.config.js:21–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19// Resolve the source's `.js` import specifiers (e.g. './tags.js') to their real
20// `.ts` files, a job the TypeScript plugin would normally do.
21const resolveTsAsJs = () => ({
22 name: 'resolve-ts-as-js',
23 resolveId(source, importer) {
24 if (importer && source.startsWith('.') && source.endsWith('.js')) {
25 const candidate = path.resolve(
26 path.dirname(importer),
27 source.slice(0, -3) + '.ts'
28 );
29 if (fs.existsSync(candidate)) {
30 return candidate;
31 }
32 }
33 return null;
34 },
35});
36
37module.exports = {
38 input: 'src/purify.ts',

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected