Skip to content

Commit 8f5f1fb

Browse files
author
RoFlection Bot
committed
update luau polyfill (#70)
1 parent 758dab3 commit 8f5f1fb

File tree

5 files changed

+12
-16
lines changed

5 files changed

+12
-16
lines changed

rotriever.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ authors = [
77
content_root = "src"
88

99
[dependencies]
10-
LuauPolyfill = "github.com/roblox/luau-polyfill@0.3.4"
10+
LuauPolyfill = "github.com/roblox/luau-polyfill@1.0.0"
1111
LuauRegExp = "github.com/Roblox/luau-regexp@0.2.0"
12-
Chalk = "github.com/roblox/chalk-lua@0.1.3"
12+
Chalk = "github.com/roblox/chalk-lua@0.2.0"
1313
Promise = "github.com/evaera/roblox-lua-promise@4.0.0"
1414
JestGetType = "github.com/roblox/jest-roblox@3.0.0-alpha"
1515
PrettyFormat = "github.com/roblox/jest-roblox@3.0.0-alpha"
1616
RobloxShared = "github.com/roblox/jest-roblox@3.0.0-alpha"
1717
JestGlobals = "github.com/roblox/jest-roblox@3.0.0-alpha"
1818

1919
[dev_dependencies]
20-
Jest = "github.com/roblox/jest-roblox@3.0.0-alpha"
20+
Jest = "github.com/roblox/jest-roblox@3.0.0-alpha"

src/get-node-test-id.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ local function getNodeTestId(instance): string?
2424
elseif #withTestIdTag > 1 then
2525
error("Instance has multiple TestId tags set")
2626
end
27-
local escaped = string.gsub(getConfig().testIdAttribute .. "=", "[\\%.%*%+\\%-%?%^%${}%(%)|%[%]]", "%%" .. "%1")
28-
local splitted = String.split(withTestIdTag[1], escaped)[2]
27+
local splitted = String.split(withTestIdTag[1], getConfig().testIdAttribute .. "=")[2]
2928
return splitted
3029
end
3130

src/get-queries-for-element.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ local defaultQueries = require(script.Parent.queries)
2121
* @param {Object} initialValue for reducer
2222
* @returns {FuncMap} returns object of functions bound to container
2323
]]
24-
local function getQueriesForElement(element: Instance, queries_: any?, initialValue_: Object?)
24+
local function getQueriesForElement(element: Instance, queries_: Object?, initialValue_: Object?)
2525
local queries = (if queries_ == nil then defaultQueries else queries_) :: Object
2626

2727
local initialValue = (if initialValue_ == nil then {} else initialValue_) :: Object
2828

29-
return Array.reduce(Object.keys(queries), function(helpers, key: string)
29+
return Array.reduce(Object.keys(queries), function(helpers: Object, key: string)
3030
local fn = queries[key]
3131
helpers[key] = function(...)
3232
return fn(element, ...)
3333
end
3434
return helpers
35-
end, initialValue)
35+
end, initialValue) :: Object
3636
end
3737
exports.getQueriesForElement = getQueriesForElement
3838

src/jsHelpers/babel-code-frame.lua

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ end
7171
--[[*
7272
* RegExp to test for newlines in terminal.
7373
]]
74-
local NEWLINE = { "\r\n", "[\n\r\2028\2029]" }
74+
local NEWLINE = { "\r\n", "\n", "\r", "\2028", "\2029" }
7575
-- ROBLOX deviation END
7676

7777
--[[*
@@ -169,11 +169,7 @@ local function codeFrameColumns(rawLines: string, loc: NodeLocation, opts_: Opti
169169
local frame = Array.join(
170170
Array.map(
171171
Array.slice(
172-
-- ROBLOX deviation start: String.split does not have a limit argument, so we return an array slice
173-
(function()
174-
local ref = String.split(highlightedLines, NEWLINE)
175-
return table.pack(table.unpack(ref, 1, end_))
176-
end)(),
172+
String.split(highlightedLines, NEWLINE, end_),
177173
start,
178174
end_ + 1 -- ROBLOX comment: Array slice last is exclusive
179175
),
@@ -200,7 +196,7 @@ local function codeFrameColumns(rawLines: string, loc: NodeLocation, opts_: Opti
200196
maybeHighlight(defs.marker, "^"):rep(numberOfMarkers),
201197
}, "")
202198
if lastMarkerLine and Boolean.toJSBoolean(opts.message) then
203-
-- ROBLOX FIXME Luau: casing should not be required, already checked it's a string
199+
-- ROBLOX FIXME Luau: casting should not be required, already checked it's a string
204200
markerLine ..= " " .. maybeHighlight(defs.message, opts.message :: string)
205201
end
206202
end

src/screen.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ local Array = LuauPolyfill.Array
66
local Object = LuauPolyfill.Object
77
local console = LuauPolyfill.console
88
type Array<T> = LuauPolyfill.Array<T>
9+
type Object = LuauPolyfill.Object
910

1011
local document = require(script.Parent.jsHelpers.document)
1112
local TypeError = require(script.Parent.jsHelpers.typeError)
@@ -96,6 +97,6 @@ local screen = if typeof(document)
9697
)
9798
end
9899
return helpers
99-
end, initialValue)
100+
end, initialValue) :: Object
100101
exports.screen = screen
101102
return exports

0 commit comments

Comments
 (0)