Skip to content

Commit

Permalink
fix: remove acorn-import-attributes dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiosantoscode committed Sep 17, 2024
1 parent 5d66f95 commit e834e1e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 23 deletions.
12 changes: 1 addition & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"@babel/parser": "^7.16.4",
"@babel/preset-env": "^7.14.4",
"acorn": "^8.12.1",
"acorn-import-attributes": "^1.9.5",
"astravel": "^0.5.0",
"ava": "^3.15.0",
"babel-preset-minify": "^0.5.1",
Expand Down
5 changes: 1 addition & 4 deletions src/tests/astring.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import fs from 'fs'
import test from 'ava'
import path from 'path'
import { Parser } from 'acorn'
import { importAttributesOrAssertions } from 'acorn-import-attributes'
import * as parser from 'acorn'
import * as astravel from 'astravel'
import { pick } from 'lodash'

Expand All @@ -13,8 +12,6 @@ const FIXTURES_FOLDER = path.join(__dirname, 'fixtures')

const ecmaVersion = 13

const parser = Parser.extend(importAttributesOrAssertions)

const stripLocation = astravel.makeTraveler({
go(node, state) {
delete node.start
Expand Down
10 changes: 3 additions & 7 deletions src/tests/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import test from 'ava'
import fs from 'fs'
import path from 'path'
import normalizeNewline from 'normalize-newline'
import { Parser } from 'acorn'
import { importAttributes } from 'acorn-import-attributes'
import * as parser from 'acorn'
import * as astravel from 'astravel'
import glob from 'glob'

Expand Down Expand Up @@ -41,15 +40,12 @@ test('Script tests', (assert) => {
const code = normalizeNewline(fs.readFileSync(fileName, 'utf8'))
let ast
try {
ast = Parser.extend(importAttributes).parse(code, options)
ast = parser.parse(code, options)
} catch (error) {
return
}
stripLocation.go(ast)
const formattedAst = Parser.extend(importAttributes).parse(
generate(ast),
options,
)
const formattedAst = parser.parse(generate(ast), options)
stripLocation.go(formattedAst)
assert.deepEqual(formattedAst, ast, fileName)
} catch (error) {
Expand Down

0 comments on commit e834e1e

Please sign in to comment.