| 474 | * start with `<`, script-based files don't. |
| 475 | */ |
| 476 | export function isBareScriptCfml(source: string): boolean { |
| 477 | let i = 0; |
| 478 | const len = source.length; |
| 479 | while (i < len) { |
| 480 | const ch = source[i]; |
| 481 | if (ch === ' ' || ch === '\t' || ch === '\n' || ch === '\r' || ch === '\uFEFF') { |
| 482 | i++; |
| 483 | } else if (ch === '/' && source[i + 1] === '/') { |
| 484 | const nl = source.indexOf('\n', i); |
| 485 | i = nl === -1 ? len : nl + 1; |
| 486 | } else if (ch === '/' && source[i + 1] === '*') { |
| 487 | const end = source.indexOf('*/', i + 2); |
| 488 | i = end === -1 ? len : end + 2; |
| 489 | } else { |
| 490 | return ch !== '<'; |
| 491 | } |
| 492 | } |
| 493 | return true; // empty/whitespace-only file — treat as script (no-op extraction either way) |
| 494 | } |