Closes#858.
If a project is named `default.project.json`, it acts as an `init` file
and gains the name of the folder it's inside of. If it is named
something other than `default.project.json`, it gains the name of the
file with `.project.json` trimmed off. So e.g. `foo.project.json`
becomes `foo`.
Resolves#667
This PR:
- Introduces a new field in the project file: `scriptType` which has the
default value of `Class` (in parity with previous versions), but can
also be `RunContext`.
- This is then passed to `InstanceContext` from the `Project` struct.
- This then changes the RunContext in the lua `snapshot_middleware`
---------
Co-authored-by: Micah <dekkonot@rocketmail.com>
* Support implicit values for primitive attributes
This commit adds support for strings, numbers, and booleans to be implicitly typed in attribute maps, reducing the redundancy of needing to specify their types.
I also quietly adjusted one of the tests to use a more stable class/property pair. Since SourceAssetId is locked to Roblox, it could potentially disappear at any time.
* Apply formatting.
* Address feedback
* Backwards compatible format usage.
* Axe UnresolvedValueMap in favor of $attributes
Attributes can be defined directly on instances, with support for unambiguous types.
* Adjust test.
* to_string() -> into()
* Made attribute test more concise.
* small cleanup
* Update src/resolution.rs
* Update src/resolution.rs
* Update src/resolution.rs
* Update src/resolution.rs
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* Add PathNode with optional fields to project. This allows a path to be defined either as `"$path": "src"` or `"$path": { "optional": "src" }`
* Make $path truly optional
* Prevent rojo from erroring if no project node is resolved
* Use match instead of if-statement
* Add end-to-end tests (credit to MobiusCraftFlip for initial scenario)
* Pass option with ref inside instead of reference to option
* Empty commit to restart GitHub Actions
* Simplify build test
* Minimize serve test: it fails
* Simplify serve test even more
* Ignore failing serve test
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* Mostly mechanical port bits
* Almost there
* It builds again!
* Turn on all the code again
* Tests compiling but not passing
* Stub work for value resolution
* Implement resolution minus enums and derived properties
* Implement property descriptor resolution
* Update referent snapshots
* Update unions test project
Using a place file instead of a model yields better
error messages in Roblox Studio.
* Add easy shortcut to testing with local rbx-dom
* Update rbx-dom
* Add enum resolution
* Update init.meta.json to use UnresolvedValue
* Expand value resolution support, add test
* Filter SharedString values from web API
* Add 'property' builder method to InstanceSnapshot
* Change InstanceSnapshot/InstanceBuilder boundary
* Fix remove_file crash
* rustfmt
* Update to latest rbx_dom_lua
* Update dependencies, including rbx_dom_weak
* Update to latest rbx-dom
* Update dependencies
* Update rbx-dom, fixing more bugs
* Remove experimental warning on binary place builds
* Remove unused imports
* infer service names
* Update project code and add support for StarterPlayer
* Store parent_class in InstigatingSource
* Update snapshots
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* Stub implementation
* Flesh out feature and add tests. Other snapshots currently failing.
* Blacklist .meta.json in JSON handler
* Write to correct property (Source) instead of Value
* Update changelog
* Add Glob wrapper type with better serialization
* Introduce PathIgnoreRule struct
* Implement equality for Glob type
* Add PathIgnoreRule to InstanceContext
* Implement glob ignores in directory middleware
* Fix up filters
* Use Iterator::all instead of loop
* Add project-level configuration for glob ignores
* Add test project for glob ignores
* Wire up project file and snapshots to make glob ignores work
* Better codepaths for adding ignore rules with empty iterators
* Add test for globs inherited from parent projects
* Add test details, support glob ignores in nested projects
* Add feature flag for globs
* Switch to use ExactSizeIterator instead of size_hint
* Remove glob visitor
* Rewrite project file to have relative paths and drop SourceProject
* Redo project error types
* Tidy up and document Project type
* Strip out init command