Skip to content
This repository was archived by the owner on Dec 28, 2024. It is now read-only.

Commit 9811ce2

Browse files
committed
updated lua pattern
1 parent c1adbfa commit 9811ce2

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Updated
11+
12+
- Updated lua pattern:
13+
- Support `require("someone's lib")`
14+
- Allow all whitespace between require and parentheses
15+
- Allow whitespace within the parentheses too
16+
1017
## [0.3.3] - 2022-02-06
1118

1219
### Added

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Luapack extracts all `require` calls statically using a lua pattern, so if you r
5858
require("test") -- works
5959
require "test" -- works
6060
require'test' -- works
61+
require("someone's lib") -- works
62+
require ( "test" ) -- works
6163
require "test" -- works
6264

6365
myrequire("test") -- also works!

luapack.yue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
require_pattern = [[require *%(?["']([^"']+)["']%)?]]
2+
require_pattern = [[require%s*(%(%s*)?(["'])([^%1]+)%1(%s*%))?]]
33

44
-- imports
55
-- !!! using an extra function here, so the require call isn't interruped by a comma

0 commit comments

Comments
 (0)