Skip to content

Commit b37633a

Browse files
committed
Remove unused files
1 parent 8ec5972 commit b37633a

9 files changed

Lines changed: 80 additions & 278 deletions

File tree

debug-bundle-node.mjs

Lines changed: 0 additions & 76 deletions
This file was deleted.

debug-bundle.mjs

Lines changed: 0 additions & 61 deletions
This file was deleted.

feature/asi.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,30 @@ const INCOMPLETE = /[\+\-\*\/\%\&\|\^\~\?\:\,\=\<\>\(\{]$/
1212
export function asi(src, { keepNewlines = false } = {}) {
1313
const lines = src.split('\n')
1414
const result = []
15-
15+
1616
for (let i = 0; i < lines.length; i++) {
1717
const line = lines[i].trim()
18-
19-
// Skip empty lines
18+
19+
// Skip empty lines
2020
if (!line) {
2121
if (keepNewlines) result.push(lines[i])
2222
continue
2323
}
24-
24+
2525
// Skip comment lines
2626
if (line.startsWith('//') || line.startsWith('/*')) {
2727
if (keepNewlines) result.push(lines[i])
2828
continue
2929
}
30-
30+
3131
result.push(lines[i])
32-
32+
3333
// Already ends with semicolon, opening brace, comma, or closing brace - no insert
3434
if (line.endsWith(';') || line.endsWith('{') || line.endsWith(',') || line.endsWith('}')) continue
35-
35+
3636
// Line is incomplete (ends with operator/opening paren) - no insert
3737
if (INCOMPLETE.test(line)) continue
38-
38+
3939
// Find next non-empty, non-comment line
4040
let nextLine = ''
4141
for (let j = i + 1; j < lines.length; j++) {
@@ -45,18 +45,18 @@ export function asi(src, { keepNewlines = false } = {}) {
4545
break
4646
}
4747
}
48-
48+
4949
// Next line starts with continuation token - no insert
5050
const nextToken = nextLine.match(/^[^\s\w]*|^\w+/)?.[0] || ''
5151
if (nextLine && CONT_STARTS.test(nextToken)) continue
52-
52+
5353
// If this is NOT the last code line, add semicolon
5454
// (Don't add trailing semicolon - it makes result undefined)
5555
if (nextLine) {
5656
result[result.length - 1] = result[result.length - 1] + ';'
5757
}
5858
}
59-
59+
6060
// Join with space instead of newline for parser compatibility
6161
return result.join(keepNewlines ? '\n' : ' ')
6262
}

feature/unit.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/**
22
* Unit suffixes: 5px, 10rem, 2s, 500ms
3-
*
3+
*
44
* AST:
55
* 5px → ['px', [,5]]
66
* 2.5s → ['s', [,2.5]]
7-
*
7+
*
88
* Units are postfix operators — idiomatic to subscript's design.
99
* Inspired by piezo: https://github.com/dy/piezo
10-
*
10+
*
1111
* Usage:
1212
* import { unit } from 'subscript/feature/unit.js'
1313
* unit('px', 'em', 'rem', 's', 'ms')
@@ -31,23 +31,23 @@ export const unit = (...names) => names.forEach(name => {
3131
const wrapHandler = (charCode) => {
3232
const original = lookup[charCode]
3333
if (!original) return
34-
34+
3535
lookup[charCode] = (a, prec) => {
3636
const result = original(a, prec)
3737
if (!result) return result
38-
38+
3939
// Only numeric literals (not identifiers)
4040
if (!Array.isArray(result) || result[0] !== undefined) return result
41-
41+
4242
// Try to consume unit suffix
4343
const startIdx = P.idx
4444
const u = next(c => parse.id(c) && !(c >= 48 && c <= 57))
45-
45+
4646
if (u && units.has(u)) return [u, result]
47-
47+
4848
// Not a unit - backtrack
4949
if (u) P.idx = startIdx
50-
50+
5151
return result
5252
}
5353
}

repl.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@
167167
/* Header links */
168168
.header-link { color: var(--muted); text-decoration: none; opacity: 0.5; font-size: 1.125rem; line-height: 1; transition: opacity .15s, color .15s; }
169169
.header-link:hover { opacity: 1; color: var(--accent); }
170+
.logo-link { color: var(--accent); text-decoration: none; transition: filter .15s; }
171+
.logo-link:hover { filter: brightness(1.15); }
170172

171173
/* Error highlight in editor */
172174
.editor.has-error #input { background: linear-gradient(transparent var(--err-line-top), rgba(248,81,73,.1) var(--err-line-top), rgba(248,81,73,.1) var(--err-line-bot), transparent var(--err-line-bot)); }
@@ -178,14 +180,25 @@
178180

179181
/* Dependency indicator */
180182
.feat-dep { font-size: 0.625rem; color: var(--muted); opacity: 0.7; margin-left: 0.25rem; }
183+
184+
/* Mobile view */
185+
@media (max-width: 768px) {
186+
body { flex-direction: column; }
187+
.wrap { flex-direction: column; }
188+
main { margin-right: 0; }
189+
main.sidebar-collapsed { margin-right: 0; }
190+
.sidebar { position: relative; width: 100%; height: auto; right: auto; top: auto; }
191+
.sidebar.collapsed { width: 100%; height: 0; }
192+
.feat-tip { display: none !important; }
193+
}
181194
</style>
182195
</head>
183196
<body>
184197
<a href="https://github.com/krishnized/license" class="header-link" style="position: absolute; bottom: 1rem; right: 1rem;" target="_blank" rel="noopener" title="krishnized license"></a>
185198
<div class="wrap">
186199
<main>
187200
<header>
188-
<h1><span>subscript</span> repl</h1>
201+
<h1><a href="https://github.com/dy/subscript" class="logo-link" target="_blank" rel="noopener" title="GitHub">subscript</a> repl</h1>
189202
<a href="https://github.com/dy/subscript" class="header-link" target="_blank" rel="noopener" title="github"></a>
190203
<button class="toggle-sidebar" id="toggleSidebar">
191204
<span>Features</span>

test-minify.mjs

Lines changed: 0 additions & 46 deletions
This file was deleted.

test-terser.mjs

Lines changed: 0 additions & 28 deletions
This file was deleted.

test/asi.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ import { parse, compile } from '../subscript.js'
3535

3636
t('asi: parse integration', () => {
3737
const asiParse = withASI(parse)
38-
38+
3939
const run = (src) => {
4040
const tree = asiParse(src)
4141
return compile(tree)({})
4242
}
43-
43+
4444
is(run('a = 1\nb = 2\na + b'), 3)
4545
is(run('x = 5\ny = x * 2\ny'), 10)
4646
is(run('sum = 0\nfor (i = 1; i <= 3; i++) sum = sum + i\nsum'), 6)

0 commit comments

Comments
 (0)