npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fernforestgames/godot-resource-parser

v0.1.3

Published

Parser for Godot 4 .tscn and .tres files

Readme

Godot Resource Parser NPM Version

A TypeScript/JavaScript library for parsing Godot 4's .tscn (scene) and .tres (resource) files.

Features

  • Zero dependencies: custom lexer and recursive descent parser implementation
  • 🎯 Fully typed: comprehensive type definitions for all Godot structures
  • 🔧 Complete Godot 4 support: parses all Godot value types (Vector2/3/4, Color, Transform2D/3D, etc.)
  • 🚀 CLI tool included: parses stdin or a file into a JSON AST
  • 📦 Type guards: runtime type checking utilities

Installation

npm install @fernforestgames/godot-resource-parser

Quick Start

Parsing Files

import { parse, parseScene, parseResource } from '@fernforestgames/godot-resource-parser';
import * as fs from 'fs';

// Auto-detect file type (scene or resource)
const content = fs.readFileSync('scene.tscn', 'utf8');
const parsed = parse(content);

// Parse scene file (.tscn)
const scene = parseScene(content);
console.log(scene.nodes); // Access scene nodes
console.log(scene.connections); // Access signal connections

// Parse resource file (.tres)
const resourceContent = fs.readFileSync('material.tres', 'utf8');
const resource = parseResource(resourceContent);
console.log(resource.resource?.properties); // Access resource properties

Type Guards

import { isGodotScene, isVector3, isColor } from '@fernforestgames/godot-resource-parser';

const result = parse(content);

if (isGodotScene(result)) {
  // TypeScript knows this is a GodotScene
  result.nodes.forEach(node => {
    console.log(node.name, node.type);
  });
}

// Check value types
const position = node.properties.position;
if (isVector3(position)) {
  console.log(`Position: ${position.x}, ${position.y}, ${position.z}`);
}

CLI Usage

The package includes a command-line tool for parsing Godot files into an AST. You can run it using npx or install it globally:

# Parse a file
npx @fernforestgames/godot-resource-parser scene.tscn > output.json

# Parse from stdin
cat scene.tscn | godot-resource-parser > output.json

API Reference

// Auto-detects and parses either a scene or resource file.
parse(content: string): ParsedGodotFile;

// Parses a Godot scene file (`.tscn`). Throws error if file is not a scene.
parseScene(content: string): GodotScene;

// Parses a Godot resource file (`.tres`). Throws error if file is not a resource.
parseResource(content: string): GodotResource;

Type Definitions

interface GodotScene {
  header: GdSceneHeader
  extResources: ExtResource[]
  subResources: SubResource[]
  nodes: Node[]
  connections: Connection[]
  editables: Editable[]
}

interface Node {
  name: string
  type: string
  parent?: string
  instance?: ExtResourceRef
  owner?: string
  index?: number
  groups?: string[]
  properties: Record<string, GodotValue>
}

interface Connection {
  signal: string
  from: string
  to: string
  callable?: string
  method?: string  // Legacy support
  flags?: number
  binds?: GodotValue[]
  unbinds?: number
}

interface GodotResource {
  header: GdResourceHeader
  extResources: ExtResource[]
  subResources: SubResource[]
  resource?: ResourceSection
}

interface ResourceSection {
  properties: Record<string, GodotValue>
}

Type Guards

// File type guards
isGodotScene(value): value is GodotScene
isGodotResource(value): value is GodotResource

// Value type guards
isVector2(value): value is Vector2
isVector3(value): value is Vector3
isColor(value): value is Color
isExtResourceRef(value): value is ExtResourceRef
isSubResourceRef(value): value is SubResourceRef

License

Released under the MIT License. See the LICENSE file for details.