stdlib: relocate modules under library/
- examples/modules/ -> library/modules/ (top-level, no more symlink hacks in consumer projects) - compiler discovers stdlib via _NSGetExecutablePath / readlink /proc/self/exe; searches dev layout (../../library), install layout (../library), and alongside-binary fallback - SX_STDLIB_PATH env var overrides for tests / dev convenience - SX_DEBUG_STDLIB env var dumps the discovery results - build.zig installs library/ alongside the binary - Compilation gains stdlib_paths field threaded through resolveImports - 50 tests pass; consumer projects can now build from any cwd
This commit is contained in:
@@ -184,7 +184,7 @@ pub const DocumentStore = struct {
|
||||
for (root.data.root.decls) |decl| {
|
||||
if (decl.data != .import_decl) continue;
|
||||
const imp = decl.data.import_decl;
|
||||
const resolved_path = try sx.imports.resolveImportPath(self.allocator, self.io, base_dir, imp.path, self.rootPathOpt());
|
||||
const resolved_path = try sx.imports.resolveImportPath(self.allocator, self.io, base_dir, imp.path, self.rootPathOpt(), &.{});
|
||||
try import_list.append(self.allocator, .{
|
||||
.ns = imp.name,
|
||||
.path = resolved_path,
|
||||
|
||||
@@ -271,7 +271,7 @@ pub const Server = struct {
|
||||
if (findImportPathAtOffset(doc.source, offset)) |import_path| {
|
||||
const base_dir = sx.imports.dirName(file_path);
|
||||
const rp: ?[]const u8 = if (self.root_path.len > 0) self.root_path else null;
|
||||
const resolved = try sx.imports.resolveImportPath(self.allocator, self.io, base_dir, import_path, rp);
|
||||
const resolved = try sx.imports.resolveImportPath(self.allocator, self.io, base_dir, import_path, rp, &.{});
|
||||
|
||||
// For directory imports, try to read as file first
|
||||
if (std.Io.Dir.readFileAlloc(.cwd(), self.io, resolved, self.allocator, .limited(10 * 1024 * 1024))) |_| {
|
||||
|
||||
Reference in New Issue
Block a user