Skip to content

Commit

Permalink
filename validation + fqn parser
Browse files Browse the repository at this point in the history
  • Loading branch information
ivojawer committed Jun 21, 2024
1 parent 58d632d commit 9395d41
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export const Import: Parser<ImportNode> = node(ImportNode)(() =>

export const name: Parser<Name> = lazy('identifier', () => regex(/[^\W\d]\w*/))

export const packageName: Parser<Name> = regex(/\W[\W-]*/)
export const packageName: Parser<Name> = lazy('package identifier', () => regex(/[^\W\d][\w-]*/))

export const FullyQualifiedReference: Parser<ReferenceNode<any>> = node(ReferenceNode)(() =>
obj({ name: packageName.or(name).sepBy1(key('.')).tieWith('.') })
Expand Down
2 changes: 1 addition & 1 deletion src/validator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ sourceMapForNodeName)

export const shouldNotUseSpecialCharactersInName = error<Package>(node =>
!node.fileName ||
node.fileName.match(/([A-Za-z.\-_/\d])/g)!.length === node.fileName.length
node.fileName.match(/([A-Za-z._/\d])/g)!.length === node.fileName.length
&& node.fileName.match(/\./g)!.length === 1
, valuesForFileName,
sourceMapForNodeName)
Expand Down
2 changes: 1 addition & 1 deletion src/wre/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,4 @@ const game: Natives = {
},
}

export default game
export default game

0 comments on commit 9395d41

Please sign in to comment.