MCPcopy Create free account
hub / github.com/Silentely/eSIM-Tools / fallbackNodeSyntaxCheck

Function fallbackNodeSyntaxCheck

scripts/pre-commit-check.js:127–143  ·  view source on GitHub ↗
(relPath, content)

Source from the content-addressed store, hash-verified

125}
126
127function fallbackNodeSyntaxCheck(relPath, content) {
128 const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'esim-precommit-'));
129 const ext = path.extname(relPath).toLowerCase() || '.js';
130 const tempFile = path.join(tempDir, `check${ext}`);
131
132 try {
133 fs.writeFileSync(tempFile, content, 'utf8');
134 const result = spawnSync(process.execPath, ['--check', tempFile], {
135 encoding: 'utf8'
136 });
137 if (result.status !== 0) {
138 throw new Error((result.stderr || result.stdout || '').trim());
139 }
140 } finally {
141 fs.rmSync(tempDir, { recursive: true, force: true });
142 }
143}
144
145function checkJavaScriptSyntax(relPath, content) {
146 if (esbuild) {

Callers 1

checkJavaScriptSyntaxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected