diff --git a/CHANGELOG.md b/CHANGELOG.md index 98c4194..ac7d64f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Breaking Changes +- Globals for the `fs`, `net`, `process`, `stdio`, and `task` builtins have been removed, and the `require("@lune/...")` syntax is now the only way to access builtin libraries. If you have previously been using a global such as `fs` directly, you will now need to put `local fs = require("@lune/fs")` at the top of the file instead. + - Migrated several functions in the `roblox` builtin to new, more flexible APIs: - `readPlaceFile -> deserializePlace` diff --git a/packages/lib/src/importer/mod.rs b/packages/lib/src/importer/mod.rs index cb561b7..a244bab 100644 --- a/packages/lib/src/importer/mod.rs +++ b/packages/lib/src/importer/mod.rs @@ -5,8 +5,6 @@ mod require_waker; use crate::builtins::{self, top_level}; -const BUILTINS_AS_GLOBALS: &[&str] = &["fs", "net", "process", "stdio", "task"]; - pub fn create(lua: &'static Lua, args: Vec) -> LuaResult<()> { // Create all builtins let builtins = vec![ @@ -20,14 +18,6 @@ pub fn create(lua: &'static Lua, args: Vec) -> LuaResult<()> { ("roblox", builtins::roblox::create(lua)?), ]; - // TODO: Remove this when we have proper LSP support for custom - // require types and no longer need to have builtins as globals - let lua_globals = lua.globals(); - for name in BUILTINS_AS_GLOBALS { - let builtin = builtins.iter().find(|(gname, _)| gname == name).unwrap(); - lua_globals.set(*name, builtin.1.clone())?; - } - // Create our importer (require) with builtins let require_fn = require::create(lua, builtins)?; @@ -42,6 +32,7 @@ pub fn create(lua: &'static Lua, args: Vec) -> LuaResult<()> { ]; // Set top-level globals + let lua_globals = lua.globals(); for (name, global) in globals { lua_globals.set(name, global)?; }