repo stringclasses 350
values | file_path stringlengths 29 200 | language stringclasses 2
values | file_type stringclasses 4
values | code stringlengths 2 1.01M | tokens int64 2 598k |
|---|---|---|---|---|---|
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/tests/fixtures/.luau-lint.luau | luau | .luau | -- Example .luau-lint.luau configuration file for testing
return {
rules = {
["unused-variable"] = "warn",
["undefined-global"] = "error",
},
ignorePatterns = { "*.generated.luau" },
severity = "warn",
}
| 60 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/tests/fixtures/bad_code.luau | luau | .luau | -- Modern Luau code using generalized iteration
local array = { 1, 2, 3, 4, 5 }
-- Modern Luau: Direct iteration over values (no ipairs needed)
for i, value in ipairs(array) do
print(value)
end
-- -- Modern Luau: Still direct iteration (no ipairs needed)
for index, item in ipairs(array) do
print("Processing:", item... | 303 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/tests/fixtures/before_after_example.luau | luau | .luau | -- Before and After: Luau Generalized Iteration Examples
-- ❌ BEFORE: Legacy approach with ipairs/pairs
--[[
local items = {"apple", "banana", "cherry"}
-- Old way - unnecessary ipairs wrapper
for i, item in ipairs(items) do
print(i, item)
end
-- Old way - unnecessary pairs wrapper
local settings = {theme = "d... | 485 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/tests/fixtures/good_code.luau | luau | .luau | -- Modern Luau code demonstrating efficient iteration patterns
local array = { 1, 2, 3, 4, 5 }
-- When you need numeric indices specifically, use numeric for loop
for i = 1, #array do
print("Index:", i, "Value:", array[i])
end
-- Modern Luau: Direct iteration over key-value pairs (replaces ipairs)
for i, value in ar... | 294 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/tests/fixtures/modern_code.luau | luau | .luau | -- Test file with modern Luau iteration that should pass linting
local data = { 10, 20, 30, 40, 50 }
-- Modern Luau: No ipairs needed
for i, value in data do
print("Item", i, ":", value)
end
-- Modern Luau: Dictionary iteration without pairs
local config = { debug = true, timeout = 5000 }
for key, val in config do
... | 142 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/tests/integration/old-test-runner.luau | luau | .luau | --!strict
local fs = require("@lute/fs")
local tiniest = require("@tiniest/tiniest_for_lute").configure({
snapshot_path = "./tests/__snapshots__",
save_snapshots = true,
})
-- Function to recursively find all .spec.luau files
local function findTestFiles(directory: string): { string }
local testFiles = {}
local ... | 639 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/.lune/exec.luau | luau | .luau | --> lib: Builder pattern class to spawn child processes
local stdio = require("@lune/stdio")
local process = require("@lune/process")
local Option = require("../lune_packages/option")
type Option<T> = Option.Option<T>
local CommandBuilder = {}
export type CommandBuilder = typeof(setmetatable({} :: Command... | 850 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/.lune/fmt.luau | luau | .luau | --> Run stylua to check for formatting errors
local process = require("@lune/process")
local CommandBuilder = require("./exec")
process.exit(
CommandBuilder.new("pesde")
:withArgs({ "run", "./bins/stylua" })
:withArg("--")
:withArgs(process.args)
:withStdioStrategy("forward")
:exec().code
)
| 86 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/.lune/typecheck.luau | luau | .luau | --> Run luau-lsp analysis to check for type errors
local process = require("@lune/process")
local CommandBuilder = require("./exec")
process.exit(
CommandBuilder.new("pesde")
:withArgs({ "run", "./bins/luau_lsp" })
:withArgs({ "--", "analyze" })
:withArgs({ "--settings", ".vscode/settings.json" })
:withArgs... | 141 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/bins/argon/init.luau | luau | .luau | local process = require("@lune/process")
local exitCode = require("@self/lune_packages/toolchainlib")("argon-rbx/argon", _G.PESDE_ROOT)
return process.exit(exitCode)
| 43 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/bins/asphalt/init.luau | luau | .luau | local process = require("@lune/process")
local exitCode = require("@self/lune_packages/toolchainlib")("jackTabsCode/asphalt", _G.PESDE_ROOT)
return process.exit(exitCode)
| 43 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/bins/darklua/init.luau | luau | .luau | local process = require("@lune/process")
local exitCode = require("@self/lune_packages/toolchainlib")("seaofvoices/darklua", _G.PESDE_ROOT)
return process.exit(exitCode)
| 44 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/bins/luau_lsp/init.luau | luau | .luau | local process = require("@lune/process")
local exitCode = require("@self/lune_packages/toolchainlib")("JohnnyMorganz/luau-lsp", _G.PESDE_ROOT)
return process.exit(exitCode)
| 47 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/bins/mantle/init.luau | luau | .luau | local process = require("@lune/process")
local exitCode = require("@self/lune_packages/toolchainlib")("blake-mealey/mantle", _G.PESDE_ROOT)
return process.exit(exitCode)
| 45 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/bins/rojo/init.luau | luau | .luau | local process = require("@lune/process")
local exitCode = require("@self/lune_packages/toolchainlib")("rojo-rbx/rojo", _G.PESDE_ROOT)
return process.exit(exitCode)
| 45 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/bins/selene/init.luau | luau | .luau | local process = require("@lune/process")
local exitCode = require("@self/lune_packages/toolchainlib")("Kampfkarren/selene", _G.PESDE_ROOT)
return process.exit(exitCode)
| 46 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/bins/stylua/init.luau | luau | .luau | local process = require("@lune/process")
local exitCode = require("@self/lune_packages/toolchainlib")("JohnnyMorganz/stylua", _G.PESDE_ROOT)
return process.exit(exitCode)
| 45 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/bins/zap/init.luau | luau | .luau | local process = require("@lune/process")
local exitCode = require("@self/lune_packages/toolchainlib")("red-blox/zap", _G.PESDE_ROOT)
return process.exit(exitCode)
| 43 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/toolchainlib/src/compression.luau | luau | .luau | local process = require("@lune/process")
local dirs = require("../lune_packages/dirs")
local pathfs = require("../lune_packages/pathfs")
local unzip = require("../luau_packages/unzip")
local Result = require("../lune_packages/result")
local Option = require("../lune_packages/option")
type Result<T, E> = Result.Result... | 1,048 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/toolchainlib/src/manifest.luau | luau | .luau | export type SPDXLicense =
"MIT"
| "Apache-2.0"
| "BSD-2-Clause"
| "BSD-3-Clause"
| "GPL-2.0"
| "GPL-3.0"
| "LGPL-2.1"
| "LGPL-3.0"
| "MPL-2.0"
| "ISC"
| "Unlicense"
| "WTFPL"
| "Zlib"
| "CC0-1.0"
| "CC-BY-4.0"
| "CC-BY-SA-4.0"
| "BSL-1.0"
| "EPL-2.0"
| "AGPL-3.0"
export type DependencySpecifier = ((... | 484 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/toolchainlib/src/platform/descriptor.luau | luau | .luau | local process = require("@lune/process")
local os = require("./os")
local arch = require("./arch")
local toolchain = require("./toolchain")
local result = require("./result")
local detectFromExecutable = require("./detection/executable")
local Result = require("../../lune_packages/result")
local Option = require("../... | 466 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/toolchainlib/src/platform/detection/executable.luau | luau | .luau | local process = require("@lune/process")
type Arch = process.Arch | "arm" | "x86"
export type ExecutableDescriptor = {
os: process.OS,
arch: { Arch },
}
local ENDIANNESS = {
function(x: number)
return x
end,
bit32.byteswap,
}
return function(binaryContents: buffer): ExecutableDescriptor?
-- Windows PE
do
... | 1,137 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/toolchainlib/src/platform/detection/init.luau | luau | .luau | local executable = require("@self/executable")
export type ExecutableDescriptor = executable.ExecutableDescriptor
return {
detect = require("@self/pattern"),
detectFromExecutable = executable,
}
| 39 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/toolchainlib/src/platform/detection/pattern.luau | luau | .luau | local String = require("../../utils/string")
local Option = require("../../../lune_packages/option")
type Option<T> = Option.Option<T>
local function charWordSep(char: string)
return char == " " or char == "-" or char == "_"
end
return function<T>(str: string, substrings: { [T]: { string } }, fullWords: { [T]: { st... | 246 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/toolchainlib/src/platform/result.luau | luau | .luau | local Result = require("../../lune_packages/result")
type Result<T, E> = Result.Result<T, E>
export type PlatformError = "NoPatternDetected" | "NoExecutableDetected" | "UnknownExecutableField"
export type PlatformResult<T> = Result<T, PlatformError>
return "<PlatformResult>"
| 65 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/toolchainlib/src/platform/toolchain.luau | luau | .luau | local Option = require("../../lune_packages/option")
type Option<T> = Option.Option<T>
local TOOLCHAINS: { Toolchain } = { "msvc", "gnu", "musl" }
export type Toolchain = "msvc" | "gnu" | "musl"
return {
detect = function(str: string): Option<Toolchain>
for _, toolchain: Toolchain in TOOLCHAINS do
if string.fin... | 130 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/toolchainlib/src/utils/copy.luau | luau | .luau | local function copy<T>(tab: T): T
if typeof(tab) == "table" then
local copied = {}
for k, v in tab do
copied[k] = copy(v)
end
return copied :: any
end
return tab
end
return copy
| 64 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/toolchainlib/src/utils/ext/option.luau | luau | .luau | --> Non-exhaustive set of extensions for the `Option<T>` type
local Option = require("../../../lune_packages/option")
local Result = require("../../../lune_packages/result")
local OptionExt = {}
function OptionExt.okOr<T, E>(self: Option.Option<T>, err: E): Result.Result<T, E>
return self:mapOrElse(function()
ret... | 108 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/toolchainlib/src/utils/ext/result.luau | luau | .luau | --> Non-exhaustive set of extensions for the `Result<T, E>` type
local Option = require("../../../lune_packages/option")
local Result = require("../../../lune_packages/result")
local ResultExt = {}
function ResultExt.ok<T, E>(self: Result.Result<T, E>): Option.Option<T>
return self:mapOr(Option.None, function(val: ... | 99 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/toolchainlib/src/utils/rev_table.luau | luau | .luau | return function(tab)
local len = #tab
for pos = 1, len // 2 do
tab[pos], tab[len - pos + 1] = tab[len - pos + 1], tab[pos]
end
end
| 50 |
pesde-pkg/tooling | pesde-pkg-tooling-2c980ab/toolchainlib/src/utils/sys.luau | luau | .luau | --> Non-exhaustive set of util functions for Linux systems
local process = require("@lune/process")
local ResultExt = require("./ext/result")
local fs = require("../../lune_packages/pathfs").fs
local Result = require("../../lune_packages/result")
local Option = require("../../lune_packages/option")
local sys = {}
s... | 392 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/Kebab.luau | luau | .luau | local Utils = require('./utils')
-- converts a string to kebab case ("kebab-case")
local function toKebabCase(str: string): string
return Utils.transform(str, Utils.lowercase, '-')
end
return {
toKebabCase = toKebabCase,
}
| 62 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/LowerCamel.luau | luau | .luau | local Utils = require('./utils')
-- converts a string to lower camel case ("lowerCamelCase")
local function toLowerCamelCase(str: string): string
local first = true
return Utils.transform(str, function(chars, start, end_, formatter)
if first then
first = false
Utils.lowercase(ch... | 117 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/ShoutyKebab.luau | luau | .luau | local Utils = require('./utils')
-- converts a string to shouty kebab case ("SHOUTY-KEBAB-CASE")
local function toShoutyKebabCase(str: string): string
return Utils.transform(str, Utils.uppercase, '-')
end
return {
toShoutyKebabCase = toShoutyKebabCase,
}
| 78 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/ShoutySnake.luau | luau | .luau | local Utils = require('./utils')
-- converts a string to shouty snake case ("SHOUTY_SNAKE_CASE")
local function toShoutySnakeCase(str: string): string
return Utils.transform(str, Utils.uppercase, '_')
end
return {
toShoutySnakeCase = toShoutySnakeCase,
}
| 71 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/Snake.luau | luau | .luau | local Utils = require('./utils')
-- converts a string to snake case ("snake_case_example")
local function toSnakeCase(str: string): string
return Utils.transform(str, Utils.lowercase, '_')
end
return {
toSnakeCase = toSnakeCase,
}
| 56 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/Title.luau | luau | .luau | local Utils = require('./utils')
-- converts a string to title case ("Title Case")
local function toTitleCase(str: string): string
return Utils.transform(str, Utils.capitalize, ' ')
end
return {
toTitleCase = toTitleCase,
}
| 54 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/Train.luau | luau | .luau | local Utils = require('./utils')
-- converts a string to train case ("Train-Case")
local function toTrainCase(str: string): string
return Utils.transform(str, Utils.capitalize, '-')
end
return {
toTrainCase = toTrainCase,
}
| 54 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/UpperCamel.luau | luau | .luau | local Utils = require('./utils')
-- converts a string to upper camel case ("UpperCamelCase")
local function toUpperCamelCase(str: string): string
return Utils.transform(str, Utils.capitalize, '')
end
return {
toUpperCamelCase = toUpperCamelCase,
}
| 62 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/__tests__/Heck.test.luau | luau | .luau | local jestGlobals = require('@pkg/@jsdotlua/jest-globals')
local Heck = require('..')
local expect = jestGlobals.expect
local it = jestGlobals.it
local describe = jestGlobals.describe
local testString = 'camelCase'
describe('toSnakeCase', function()
it('should convert to snake_case', function()
expect(H... | 427 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/__tests__/Kebab.test.luau | luau | .luau | local jestGlobals = require('@pkg/@jsdotlua/jest-globals')
local Kebab = require('../Kebab')
local expect = jestGlobals.expect
local it = jestGlobals.it
local function t(testName: string, input: string, expected: string)
it(`'{input}' converts to '{expected}' ({testName})`, function()
expect(Kebab.toKeba... | 449 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/__tests__/ShoutyKebab.test.luau | luau | .luau | local jestGlobals = require('@pkg/@jsdotlua/jest-globals')
local ShoutyKebab = require('../ShoutyKebab')
local expect = jestGlobals.expect
local it = jestGlobals.it
local function t(testName: string, input: string, expected: string)
it(`'{input}' converts to '{expected}' ({testName})`, function()
expect(... | 383 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/__tests__/ShoutySnake.test.luau | luau | .luau | local jestGlobals = require('@pkg/@jsdotlua/jest-globals')
local ShoutySnake = require('../ShoutySnake')
local expect = jestGlobals.expect
local it = jestGlobals.it
local function t(testName: string, input: string, expected: string)
it(`'{input}' converts to '{expected}' ({testName})`, function()
expect(... | 328 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/__tests__/Snake.test.luau | luau | .luau | local jestGlobals = require('@pkg/@jsdotlua/jest-globals')
local Snake = require('../Snake')
local expect = jestGlobals.expect
local it = jestGlobals.it
local function t(testName: string, input: string, expected: string)
it(`'{input}' converts to '{expected}' ({testName})`, function()
expect(Snake.toSnak... | 543 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/__tests__/Title.test.luau | luau | .luau | local jestGlobals = require('@pkg/@jsdotlua/jest-globals')
local Title = require('../Title')
local expect = jestGlobals.expect
local it = jestGlobals.it
local function t(testName: string, input: string, expected: string)
it(`'{input}' converts to '{expected}' ({testName})`, function()
expect(Title.toTitl... | 298 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/__tests__/Train.test.luau | luau | .luau | local jestGlobals = require('@pkg/@jsdotlua/jest-globals')
local Train = require('../Train')
local expect = jestGlobals.expect
local it = jestGlobals.it
local function t(testName: string, input: string, expected: string)
it(`'{input}' converts to '{expected}' ({testName})`, function()
expect(Train.toTrai... | 594 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/__tests__/edge-cases.test.luau | luau | .luau | local Heck = require('../init')
local jestGlobals = require('@pkg/@jsdotlua/jest-globals')
local expect = jestGlobals.expect
local it = jestGlobals.it
local describe = jestGlobals.describe
describe('Edge Cases and Unicode Handling', function()
describe('Empty and Nil Inputs', function()
it('should handle ... | 943 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/init.luau | luau | .luau | local Kebab = require('./Kebab')
local LowerCamel = require('./LowerCamel')
local ShoutyKebab = require('./ShoutyKebab')
local ShoutySnake = require('./ShoutySnake')
local Snake = require('./Snake')
local Title = require('./Title')
local Train = require('./Train')
local UpperCamel = require('./UpperCamel')
return {
... | 224 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/rust-utils/splitString.luau | luau | .luau | local function splitString(str: string, condition: (string) -> boolean): { string }
local result = {}
local currentWord = 0
for position, c in utf8.codes(str) do
local character = utf8.char(c)
if condition(character) then
table.insert(result, string.sub(str, currentWord + 1, po... | 155 |
seaofvoices/heck-luau | seaofvoices-heck-luau-9e21169/src/utils.luau | luau | .luau | local character = require('@pkg/luau-character')
local splitString = require('./rust-utils/splitString')
local isAlphaNumeric = character.isAlphaNumeric
local isLowercase = character.isLowercase
local isUppercase = character.isUppercase
local toLowercase = character.toLowercase
local toUppercase = character.toUpperca... | 1,094 |
folly-org/folly | folly-org-folly-46a5fc3/editor/core/config.luau | luau | .luau | local loaded_config = {
user = {
cursor = {
-- BLOCK, LINE
style = "LINE"
},
tab_spacing = 4,
},
}
-- replace loaded_config with the file read from disk,
-- if not found, create new file with the config above
local config = {}
local metatable = {
__index = function (t,k)
return loa... | 122 |
folly-org/folly | folly-org-folly-46a5fc3/editor/core/init.luau | luau | .luau | local util = require("util/main")
local kc = require("util/keycodes")
local config = require("config")
local font = Renderer.Font.load("./resources/JetBrainsMono-Regular.ttf")
local font2 = Renderer.Font.load("./resources/Raveo-Regular.otf")
local buf = File.read("./editor/core/init.luau"):gsub("\r", "")
local font_... | 1,446 |
folly-org/folly | folly-org-folly-46a5fc3/editor/core/main.luau | luau | .luau | return function()
print("this is core/main!")
end | 13 |
folly-org/folly | folly-org-folly-46a5fc3/editor/core/util/keycodes.luau | luau | .luau | return {
null = 0,
apostrophe = 39,
comma = 44,
minus = 45,
period = 46,
slash = 47,
zero = 48,
one = 49,
two = 50,
three = 51,
four = 52,
five = 53,
six = 54,
seven = 55,
eight = 56,
nine = 57,
semicolon = 59,
equal = 61,
a = 65,
b = 66,
... | 732 |
folly-org/folly | folly-org-folly-46a5fc3/editor/core/util/main.luau | luau | .luau | local t = {}
function t:MakeColor(r: number, g: number, b: number, a: number)
return {
red = r,
green = g,
blue = b,
alpha = a
}
end
return t | 54 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/base/any.luau | luau | .luau | const result = require("../../result")
const schema = require("../../schema")
const function anySchemaBuilder()
return schema.createSchema<<any, nil>>("any", function(value)
return result.parse.ok(value)
end)
end
return anySchemaBuilder
| 51 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/base/is.luau | luau | .luau | const issue = require("../../issue")
const result = require("../../result")
local schema = require("../../schema")
const function isSchemaBuilder<T>(typeName: string)
return schema.createSchema<<T, nil>>("is", function(value)
if typeof(value) ~= typeName then
return result.parse.err({
issue.parse.invalidType... | 103 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/base/like.luau | luau | .luau | const issue = require("../../issue")
const result = require("../../result")
local schema = require("../../schema")
const function likeSchemaBuilder<T>(typeName: string)
return schema.createSchema<<T, nil>>("is", function(value)
if type(value) ~= typeName then
return result.parse.err({
issue.parse.invalidType... | 103 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/base/literal.luau | luau | .luau | const issue = require("../../issue")
const result = require("../../result")
const schema = require("../../schema")
const function literalSchemaBuilder<T>(literal: T)
return schema.createSchema<<T, nil>>("literal", function(value)
if value ~= literal then
return result.parse.err({
issue.parse.invalidValue(`ex... | 100 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/base/meta.luau | luau | .luau | const schema = require("../../schema")
const function metaSchemaBuilder<T, S, M, NewM>(sourceSchema: schema.Schema<T, S, M>, metadata: NewM): schema.Schema<T, S, NewM>
const copiedSchema = schema.createSchema(sourceSchema.type, sourceSchema.parse, sourceSchema.shape)
copiedSchema.metadata = metadata
return copiedSc... | 84 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/base/never.luau | luau | .luau | const issue = require("../../issue")
const result = require("../../result")
const schema = require("../../schema")
const function neverSchemaBuilder()
return schema.createSchema<<never, nil>>("never", function(value)
return result.parse.err({ issue.parse.invalidType(`expected never, got {typeof(value)}`) })
end)
e... | 73 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/base/refine.luau | luau | .luau | const issue = require("../../issue")
const result = require("../../result")
const schema = require("../../schema")
type RefineResult<T> = {
ok: () -> result.ParseResultOk<T>,
err: (message: string) -> result.ParseResultErr,
}
const function refineSchemaBuilder<T, S, M>(sourceSchema: schema.Schema<T, S, M>)
return ... | 231 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/base/unknown.luau | luau | .luau | const result = require("../../result")
const schema = require("../../schema")
const function unknownSchemaBuilder()
return schema.createSchema<<unknown, nil>>("unknown", function(value)
return result.parse.ok(value)
end)
end
return unknownSchemaBuilder
| 51 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/builtins/init.luau | luau | .luau | const schema = require("../schema")
const like = require("./base/like")
const function builtinSchemaBuilder<T>(typeName: string): () -> schema.Schema<T>
return function()
return like<<T>>(typeName)
end
end
const builtins = {}
builtins.boolean = builtinSchemaBuilder<<boolean>>("boolean")
builtins.number = requir... | 217 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/builtins/number.luau | luau | .luau | const like = require("../base/like")
const refine = require("../base/refine")
type NumberOptions = {
unbounded: boolean?,
min: number?,
max: number?,
}
const function numberSchemaBuilder(options: NumberOptions?)
const options: NumberOptions = options or {}
return refine(like<<number>>("number"))(function(value,... | 188 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/builtins/string.luau | luau | .luau | const like = require("../base/like")
const refine = require("../base/refine")
type StringOptions = {
match: string?,
length: {
min: number?,
max: number?,
}?,
}
const function stringSchemaBuilder(options: StringOptions?)
const options: StringOptions = options or {}
return refine(like<<string>>("string"))(fu... | 216 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/combinators/intersect.luau | luau | .luau | const issue = require("../../issue")
const result = require("../../result")
const schema = require("../../schema")
const function intersectSchemaBuilder<T0, T0S, T0M, T1, T1S, T1M>(
sourceSchemaA: schema.Schema<T0, T0S, T0M>,
sourceSchemaB: schema.Schema<T1, T1S, T1M>
)
return schema.createSchema<<T0 & T1, { left: ... | 464 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/combinators/union.luau | luau | .luau | const issue = require("../../issue")
const result = require("../../result")
const schema = require("../../schema")
const shared = require("../../shared")
const function unionSchema<T0, T0S, T0M, T1, T1S, T1M>(sourceSchemaA: schema.Schema<T0, T0S, T0M>, sourceSchemaB: schema.Schema<T1, T1S, T1M>)
return schema.createS... | 286 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/modifiers/default.luau | luau | .luau | const schema = require("../../schema")
const optional = require("./optional")
const transform = require("./transform")
const function defaultSchemaBuilder<T, S, M>(sourceSchema: schema.Schema<T, S, M>, defaultValue: T)
return transform(optional(sourceSchema))(function(value)
if value == nil then
return defaultVa... | 83 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/modifiers/optional.luau | luau | .luau | const schema = require("../../schema")
const builtins = require("../builtins")
const union = require("../combinators/union")
const function optionalSchemaBuilder<T, S, M>(innerSchema: schema.Schema<T, S, M>)
return union(innerSchema, builtins.none())
end
return optionalSchemaBuilder
| 65 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/modifiers/transform.luau | luau | .luau | const result = require("../../result")
const schema = require("../../schema")
const function transformSchemaBuilder<T, S, M>(sourceSchema: schema.Schema<T, S, M>)
return function<R>(transformFn: (T) -> R)
return schema.createSchema<<R, schema.InnerSchema<S, M>>>("transform", function(value)
const sourceSchemaPar... | 133 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/structures/array.luau | luau | .luau | const schema = require("../../schema")
const builtins = require("../builtins")
const iterable = require("./iterable")
const function arraySchemaBuilder<T, S, M>(valueSchema: schema.Schema<T, S, M>)
return iterable(builtins.number(), valueSchema)
end
return arraySchemaBuilder
| 63 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/structures/iterable.luau | luau | .luau | const result = require("../../result")
const issue = require("../../issue")
const schema = require("../../schema")
const shared = require("../../shared")
const function iterableSchemaBuilder<K, KS, KM, T, TS, TM>(keySchema: schema.Schema<K, KS, KM>, valueSchema: schema.Schema<T, TS, TM>)
return schema.createSchema<<{... | 389 |
metamethods/typed | metamethods-typed-b6b6895/lib/builders/structures/table.luau | luau | .luau | const result = require("../../result")
const issue = require("../../issue")
const schema = require("../../schema")
const shared = require("../../shared")
type Schema<T, S, M> = schema.Schema<T, S, M>
type InnerSchema<S, M> = schema.InnerSchema<S, M>
type infer<T> = shared.infer<T>
type metadata<T> = shared.metadata... | 882 |
metamethods/typed | metamethods-typed-b6b6895/lib/init.luau | luau | .luau | local builtinSchemaBuilders = require("@self/builders/builtins")
local issue = require("@self/issue")
local result = require("@self/result")
local schema = require("@self/schema")
local shared = require("@self/shared")
local typed = {}
-- base
typed.any = require("@self/builders/base/any")
typed.unknown = require("@s... | 469 |
metamethods/typed | metamethods-typed-b6b6895/lib/issue.luau | luau | .luau | const issue = {}
export type Issue<T = any> = {
type: T,
message: string,
context: string?,
}
function issue.appendContext<T>(issue: Issue<T>, context: string): Issue<T>
if issue.context then
issue.context = `{context}; {issue.context}`
else
issue.context = context
end
return issue
end
function issue.for... | 485 |
metamethods/typed | metamethods-typed-b6b6895/lib/result.luau | luau | .luau | const issue = require("./issue")
const result = {}
result.parse = {}
export type ParseResultOk<T> = { ok: true, value: T }
export type ParseResultErr = {
ok: false,
issues: { issue.ParseIssue },
}
export type ParseResult<T> = ParseResultOk<T> | ParseResultErr
function result.parse.ok<T>(value: T): ParseResultOk... | 127 |
metamethods/typed | metamethods-typed-b6b6895/lib/schema.luau | luau | .luau | const issue = require("./issue")
const result = require("./result")
export type InnerSchema<S = nil, M = nil> = {
type: string,
shape: S,
metadata: M,
}
export type Schema<T, S = nil, M = nil> = {
type: string,
infer: T,
shape: S,
metadata: M,
parse: (value: any) -> result.ParseResult<T>,
unwrapParse: (value... | 327 |
metamethods/typed | metamethods-typed-b6b6895/lib/shared.luau | luau | .luau | export type infer<T> = index<T, "infer">
export type metadata<T> = index<T, "metadata">
export type shape<T> = index<T, "shape">
const function joinArrays<T>(...: { T }): { T }
const result = {}
for _, array in { ... } do
for _, value in array do
table.insert(result, value)
end
end
return result
end
re... | 98 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/examples/normalize.luau | luau | .luau | local pathfs = require("../src/lib")
print(pathfs.normalize("../src/./lib/../lib/normalizePath.luau"))
print(pathfs.canonicalize("./.vscode"))
| 37 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/examples/observe.luau | luau | .luau | local pathfs = require("../src/lib")
local task = require("@lune/task")
local disconnectObserver = pathfs.observeDescendantEntry(".playground/test", function(entry)
print("Hello bro", entry)
return function()
print("Oh no I didn't")
end
end)
task.wait(5)
disconnectObserver()
| 67 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/examples/serialize.luau | luau | .luau | local pathfs = require("../src/lib")
-- Example data to serialize
local config = {
name = "Example Application",
version = "1.0.0",
database = {
host = "localhost",
port = 5432,
name = "myapp"
},
features = {
"authentication",
"logging",
"caching"
},
settings = {
debug = true,
maxConnections = 1... | 540 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/examples/utilities.luau | luau | .luau | local pathfs = require("../src/lib")
local file = pathfs.FilePath.new("hi"):withFileWritten("hello")
file:writeFile("hallo")
file:removeFile()
local dir = pathfs.DirectoryPath.new("hi"):withDirWritten()
dir:removeDir()
pathfs.writeFileAll(pathfs.Path.new("a/b/c"):join(file.path), "hello2")
| 80 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/examples/watch.luau | luau | .luau | local pathfs = require("../src/lib")
pathfs.watchDirectories({
".playground/test",
".playground/test2",
}, function()
print("yolo")
end)
| 37 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/lune/test.luau | luau | .luau | local function loadTests()
require("@tests/path")()
require("@tests/fs")()
require("@tests/utilities")()
end
local function runTests()
local frktest = require("../luau_packages/frktest")
frktest.reporters.console_reporter.init()
local success = frktest.run()
if not success then
require("@lune/process").exit(... | 89 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/src/DirectoryPath.luau | luau | .luau | local luauPath = require("../luau_packages/luau_path")
local Path = luauPath.Path
local fs = require("./fs")
local types = require("./types")
local PathType = types.PathType
local AsPathType = types.AsPathType
local optionalBooleanType = types.optionalBooleanType
local arrayOfStringType = types.arrayOfStringType
local... | 1,408 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/src/FilePath.luau | luau | .luau | local luauPath = require("../luau_packages/luau_path")
local Path = luauPath.Path
local fs = require("./fs")
local types = require("./types")
local PathType = types.PathType
local AsPathType = types.AsPathType
local ContentsType = types.ContentsType
local optionalBooleanType = types.optionalBooleanType
local stringTyp... | 1,273 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/src/fs.luau | luau | .luau | local luneFileSystem = require("@lune/fs")
local gt = require("../luau_packages/greentea")
local vfs = require("./vfs")
local asPathToString = vfs.asPathToString
local types = require("./types")
local AsPathType = types.AsPathType
local booleanType = types.booleanType
local stringType = types.stringType
local Contents... | 1,755 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/src/normalizePath.luau | luau | .luau | local types = require("./types")
local luauPath = require("../luau_packages/luau_path")
local Path = luauPath.Path
type Component = types.Component
type Components = types.Components
type AsPath = luauPath.AsPath
type Path = luauPath.Path
export type PeekableComponents = typeof(setmetatable(
{} :: {
iter: Componen... | 628 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/src/vfs.luau | luau | .luau | local types = require("./types")
local AsPathType = types.AsPathType
local luauPath = require("../luau_packages/luau_path")
local Path = luauPath.Path
local process = require("@lune/process")
local normalizePath = require("./normalizePath")
type Path = luauPath.Path
type AsPath = luauPath.AsPath
--[=[
@class vfs
@p... | 364 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/tests/fs.luau | luau | .luau | local frktest = require("../luau_packages/frktest")
local test = frktest.test
local check = frktest.assert.check
local pathfs = require("../src/lib")
local fs = pathfs.fs
return function()
local test1 = "tests/test1.txt"
local test2 = "tests/test2.txt"
local test3 = "tests/test3.txt"
local test_content = "Hello, w... | 1,014 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/tests/path.luau | luau | .luau | local frktest = require("../luau_packages/frktest")
local test = frktest.test
local check = frktest.assert.check
local pathfs = require("../src/lib")
return function()
test.suite("joining paths", function()
local expectedResultPath = pathfs.Path.from("tests/test1.txt")
test.case("path and string", function()
... | 218 |
jiwonz/lune-pathfs | jiwonz-lune-pathfs-1e42484/tests/utilities.luau | luau | .luau | local frktest = require("../luau_packages/frktest")
local test = frktest.test
local check = frktest.assert.check
local pathfs = require("../src/lib")
return function()
test.suite("pathfs.script", function()
test.case("should handle script path gracefully", function()
-- Test that script() function exists and is ... | 2,856 |
tijnepema/simpoll | tijnepema-simpoll-18a99df/lib-luau/.lune/build.luau | luau | .luau | local fs = require("@lune/fs")
local logger = require("./lib/logger").new(4)
local executeCommand = require("./lib/executeCommand")
local didError = false
local function execCommandWrapper(...)
local data = executeCommand(...)
if data.stderr ~= "" then
didError = true
end
return data
end
local function recu... | 409 |
tijnepema/simpoll | tijnepema-simpoll-18a99df/lib-luau/.lune/dev.luau | luau | .luau | local fs = require("@lune/fs")
local task = require("@lune/task")
local logger = require("./lib/logger").new(4)
local fileWatcher = require("./lib/fileWatcher")
local executeCommand = require("./lib/executeCommand")
local function recursiveCopy(src, dest)
local files = fs.readDir(src)
for _, file in files do
loc... | 510 |
tijnepema/simpoll | tijnepema-simpoll-18a99df/lib-luau/.lune/install-packages.luau | luau | .luau | local fs = require("@lune/fs")
local logger = require("./lib/logger").new(4)
local executeCommand = require("./lib/executeCommand")
if fs.isDir("packages") then
fs.removeDir("packages")
end
local status = executeCommand("wally", {
"install",
}, {
stdio = "inherit"
}, true)
if not status.ok then
logger... | 318 |
tijnepema/simpoll | tijnepema-simpoll-18a99df/lib-luau/.lune/lib/executeCommand.luau | luau | .luau | local process = require("@lune/process")
local logger = require("./logger").new(4)
return function(command, args, options, ignoreErrors)
local data = process.spawn(command, args, options or {
stdio = "default",
})
if data.stderr ~= "" and not ignoreErrors then
logger:error(`Error occurred when running \"{comm... | 92 |
tijnepema/simpoll | tijnepema-simpoll-18a99df/lib-luau/.lune/lib/fileWatcher.luau | luau | .luau | local fs = require("@lune/fs")
local date = require("@lune/datetime")
local task = require("@lune/task")
type fileMap = {
path: string,
children: { fileMap | string },
}
return function(directory: string, callback: (files: { string }) -> any, onDelete: (files: { string }) -> any)
local lastModified: number = nil :... | 609 |
tijnepema/simpoll | tijnepema-simpoll-18a99df/lib-luau/.lune/lib/logger.luau | luau | .luau | local logger = {}
local terminal = require("./terminal")
local chalk = require("./chalk")
local dateTime = require("@lune/datetime")
local function padToTwo(number: number): string
return number < 10 and `0{number}` or tostring(number)
end
local function generateTimestamp(): string
local time = dateTime.now():toLo... | 494 |
pesde-pkg/scripts | pesde-pkg-scripts-ee149e2/.lune/fmt.luau | luau | .luau | --> Run stylua to check for formatting errors
local process = require("@lune/process")
local CommandBuilder = require("./lib/exec")
process.exit(
CommandBuilder.new("stylua")
:withArg(".")
:withArgs(process.args)
:withStdioStrategy("forward")
:exec().code
)
| 71 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.