Skip to content

Commit 1869a58

Browse files
committed
refractor(core): named exports
1 parent b2d8928 commit 1869a58

File tree

5 files changed

+4
-8
lines changed

5 files changed

+4
-8
lines changed

lexer/lexer.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ import { Token } from "../types.ts";
66

77
let debug = dbg("lex");
88

9-
export default lex;
10-
119
/**
1210
* Convert a CSS string into an array of lexical tokens.
1311
*
1412
* @param {String} css CSS
1513
* @returns {Array} lexical tokens
1614
*/
17-
function lex(css: string): Token[] {
15+
export function lex(css: string): Token[] {
1816
var start = 0; // Debug timer start.
1917

2018
var buffer = ""; // Character accumulator

lexer/mod.ts

Whitespace-only changes.

parser/mod.ts

Whitespace-only changes.

parser/parser.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ var TIMER = false; // `true` to time calls to `parse()` and print the results.
44
import dbg from "../debug.js";
55
let debug = dbg("parse");
66

7-
import lex from "../lexer/lexer.ts";
7+
import { lex } from "../lexer/lexer.ts";
88
import { AST, Token } from "../types.ts";
99

10-
export default parse;
11-
1210
var _comments: boolean; // Whether comments are allowed.
1311
var _depth: number; // Current block nesting depth.
1412
var _position: any; // Whether to include line/column position.
@@ -22,7 +20,7 @@ var _tokens: Token[]; // Array of lexical tokens.
2220
* @param {Boolean} [options.comments=false] allow comment nodes in the AST
2321
* @returns {Object} `stringify`-able AST
2422
*/
25-
function parse(css: string | any[], options: any): AST {
23+
export function parse(css: string | any[], options: any): AST {
2624
var start = 0; // Debug timer start.
2725

2826
options || (options = {});

test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import parse from "./parser/parser.ts";
1+
import {parse} from "./parser/parser.ts";
22

33
var ast = parse("p { color: black; }");
44
console.log(ast);

0 commit comments

Comments
 (0)