Skip to content

Refactor: remove LiveScript #2

@belusky

Description

@belusky

Refactor: LiveScript → Modern JavaScript (lib/ and test/)

Summary

This issue tracks the removal of all LiveScript compilation artifacts from lib/ and test/, replacing them with clean, modern JavaScript. The grasp source was originally written in LiveScript (.ls) and compiled; this refactor will make the compiled output the canonical source.

No functional changes are intended. All 253 existing tests must continue to pass.

Completed Phases

Phase Description Status
0 Compile test/*.ls files to test/*.js (JS baseline)
1 Verify all tests pass before any refactoring begins
2 Refactor lib/text.js (remove IIFEs, var→const/let)
3 Refactor lib/format.js (remove IIFEs, var→const/let, replace compose$)
4 Refactor lib/options.js (remove IIFEs, var→const/let)
5 Refactor lib/help.js (remove IIFEs, var→const/let, replace repeatString$)
6 Refactor lib/replace.js (remove IIFEs, var→const/let, replace in$, slice$)
7 Refactor lib/index.js (remove IIFEs, var→const/let, replace curry$, slice$, toString$)
8 Refactor test/_helpers.js (modernize StdIn/FileSystem classes)
9 Refactor all test/*.js files (remove IIFEs, var→const/let)
10 Update package.json (remove livescript, update engines, update scripts)
11 Delete Makefile
12 Full test suite verification (253 tests pass)
14 Replace prelude-ls with native JS (lib/utils.js, replace all imports)
16 lib/index.js - fix ref$ leak, convert var→let, move declarations to point of use
17 test/_helpers.js - replace LS class boilerplate with ES6 class syntax
18 bin/grasp - var→const, modernize style
19 lib/replace.js - replace C-style for loops, IIFE closures, pre-declared vars
20 lib/format.js - inline compose helper; lib/text.js - arrow function
21 Full test suite verification (253 tests pass)

Plan (Remaining)

Phase Description Status
13 (optional) Replace async library
15 (optional) Migrate to ESM

What will intentionally remain unchanged

Item Reason Future phase
async library stdin EventEmitter path makes conversion non-trivial Phase 13
require()/module.exports CJS works fine; ESM migration is a separate concern Phase 15

Files affected

lib/text.js, lib/format.js, lib/options.js, lib/help.js, lib/replace.js, lib/index.js, bin/grasp, test/_helpers.js, test/*.js (19 test files), package.json, Makefile (deleted)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions