From b09016d6b0968533e96728592a5c8780db0e4593 Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Wed, 10 May 2023 21:41:59 -0500 Subject: [PATCH] fix: add Scanner as named export --- packages/abbreviation/src/tokenizer/index.ts | 2 +- packages/css-abbreviation/src/tokenizer/index.ts | 2 +- packages/scanner/.gitignore | 5 ----- packages/scanner/package.json | 12 ++++++------ packages/scanner/rollup.config.js | 4 ++-- packages/scanner/src/scanner.ts | 4 +++- 6 files changed, 13 insertions(+), 16 deletions(-) delete mode 100644 packages/scanner/.gitignore diff --git a/packages/abbreviation/src/tokenizer/index.ts b/packages/abbreviation/src/tokenizer/index.ts index 339cbe45..5e2e17d2 100644 --- a/packages/abbreviation/src/tokenizer/index.ts +++ b/packages/abbreviation/src/tokenizer/index.ts @@ -1,4 +1,4 @@ -import Scanner, { isSpace, isQuote, isNumber, isAlpha, isAlphaNumericWord, isUmlaut } from '@emmetio/scanner'; +import { Scanner, isSpace, isQuote, isNumber, isAlpha, isAlphaNumericWord, isUmlaut } from '@emmetio/scanner'; import type { Literal, WhiteSpace, Quote, Bracket, BracketType, OperatorType, Operator, RepeaterPlaceholder, Repeater, Field, RepeaterNumber, AllTokens } from './tokens.js'; import { Chars, escaped } from './utils.js'; diff --git a/packages/css-abbreviation/src/tokenizer/index.ts b/packages/css-abbreviation/src/tokenizer/index.ts index d7bb0c96..45afd4df 100644 --- a/packages/css-abbreviation/src/tokenizer/index.ts +++ b/packages/css-abbreviation/src/tokenizer/index.ts @@ -1,4 +1,4 @@ -import { default as Scanner, isAlphaWord, isAlpha, isNumber, isAlphaNumericWord, isSpace, isQuote } from '@emmetio/scanner'; +import { Scanner, isAlphaWord, isAlpha, isNumber, isAlphaNumericWord, isSpace, isQuote } from '@emmetio/scanner'; import { OperatorType } from './tokens.js'; import type { AllTokens, Literal, NumberValue, ColorValue, WhiteSpace, Operator, Bracket, StringValue, Field, CustomProperty } from './tokens.js'; import { Chars } from './utils.js'; diff --git a/packages/scanner/.gitignore b/packages/scanner/.gitignore deleted file mode 100644 index 0d406896..00000000 --- a/packages/scanner/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/scanner.js -/scanner.es.js -/scanner.cjs -/*.d.ts -/*.map diff --git a/packages/scanner/package.json b/packages/scanner/package.json index 4688978b..81ded131 100644 --- a/packages/scanner/package.json +++ b/packages/scanner/package.json @@ -2,18 +2,18 @@ "name": "@emmetio/scanner", "version": "1.0.4", "description": "Scans given text character-by-character", - "main": "./scanner.cjs", - "module": "./scanner.js", - "types": "./scanner.d.ts", + "main": "./dist/scanner.cjs", + "module": "./dist/scanner.js", + "types": "./dist/scanner.d.ts", "type": "module", "exports": { - "import": "./scanner.js", - "require": "./scanner.cjs" + "import": "./dist/scanner.js", + "require": "./dist/scanner.cjs" }, "scripts": { "test": "mocha", "build": "rollup -c", - "clean": "rimraf ./scanner.* ./*.d.ts", + "clean": "rimraf ./dist", "prepublishOnly": "npm run clean && npm run build && npm test" }, "repository": { diff --git a/packages/scanner/rollup.config.js b/packages/scanner/rollup.config.js index 0558b789..5d1970d0 100644 --- a/packages/scanner/rollup.config.js +++ b/packages/scanner/rollup.config.js @@ -7,10 +7,10 @@ export default { format: 'cjs', exports: 'named', sourcemap: true, - file: './scanner.cjs' + file: './dist/scanner.cjs' }, { format: 'es', sourcemap: true, - file: './scanner.js' + file: './dist/scanner.js' }] }; diff --git a/packages/scanner/src/scanner.ts b/packages/scanner/src/scanner.ts index d08b7bd3..3b14809d 100644 --- a/packages/scanner/src/scanner.ts +++ b/packages/scanner/src/scanner.ts @@ -5,7 +5,7 @@ type MatchFn = (ch: number) => boolean; /** * A streaming, character code-based string reader */ -export default class Scanner { +export class Scanner { /** Current string */ string: string; @@ -129,3 +129,5 @@ export class ScannerError extends Error { this.string = str; } } + +export default Scanner;