azul-sync 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +1 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +31 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/README.md +142 -0
- package/dist/build.d.ts +19 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +92 -0
- package/dist/build.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +397 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +26 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +105 -0
- package/dist/config.js.map +1 -0
- package/dist/fs/fileWriter.d.ts +100 -0
- package/dist/fs/fileWriter.d.ts.map +1 -0
- package/dist/fs/fileWriter.js +342 -0
- package/dist/fs/fileWriter.js.map +1 -0
- package/dist/fs/treeManager.d.ts +84 -0
- package/dist/fs/treeManager.d.ts.map +1 -0
- package/dist/fs/treeManager.js +365 -0
- package/dist/fs/treeManager.js.map +1 -0
- package/dist/fs/watcher.d.ts +39 -0
- package/dist/fs/watcher.d.ts.map +1 -0
- package/dist/fs/watcher.js +120 -0
- package/dist/fs/watcher.js.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +349 -0
- package/dist/index.js.map +1 -0
- package/dist/ipc/httpPolling.d.ts +56 -0
- package/dist/ipc/httpPolling.d.ts.map +1 -0
- package/dist/ipc/httpPolling.js +171 -0
- package/dist/ipc/httpPolling.js.map +1 -0
- package/dist/ipc/messages.d.ts +112 -0
- package/dist/ipc/messages.d.ts.map +1 -0
- package/dist/ipc/messages.js +5 -0
- package/dist/ipc/messages.js.map +1 -0
- package/dist/ipc/server.d.ts +50 -0
- package/dist/ipc/server.d.ts.map +1 -0
- package/dist/ipc/server.js +168 -0
- package/dist/ipc/server.js.map +1 -0
- package/dist/pack.d.ts +19 -0
- package/dist/pack.d.ts.map +1 -0
- package/dist/pack.js +225 -0
- package/dist/pack.js.map +1 -0
- package/dist/push.d.ts +43 -0
- package/dist/push.d.ts.map +1 -0
- package/dist/push.js +532 -0
- package/dist/push.js.map +1 -0
- package/dist/rojo.d.ts +9 -0
- package/dist/rojo.d.ts.map +1 -0
- package/dist/rojo.js +114 -0
- package/dist/rojo.js.map +1 -0
- package/dist/snapshot/rojo.d.ts +39 -0
- package/dist/snapshot/rojo.d.ts.map +1 -0
- package/dist/snapshot/rojo.js +364 -0
- package/dist/snapshot/rojo.js.map +1 -0
- package/dist/snapshot.d.ts +23 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +132 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/sourcemap/generator.d.ts +78 -0
- package/dist/sourcemap/generator.d.ts.map +1 -0
- package/dist/sourcemap/generator.js +351 -0
- package/dist/sourcemap/generator.js.map +1 -0
- package/dist/sourcemap/propertyLoader.d.ts +19 -0
- package/dist/sourcemap/propertyLoader.d.ts.map +1 -0
- package/dist/sourcemap/propertyLoader.js +131 -0
- package/dist/sourcemap/propertyLoader.js.map +1 -0
- package/dist/util/id.d.ts +9 -0
- package/dist/util/id.d.ts.map +1 -0
- package/dist/util/id.js +14 -0
- package/dist/util/id.js.map +1 -0
- package/dist/util/log.d.ts +13 -0
- package/dist/util/log.d.ts.map +1 -0
- package/dist/util/log.js +51 -0
- package/dist/util/log.js.map +1 -0
- package/docs/assets/azul-logo.pdn +0 -0
- package/docs/assets/logo-200px.png +0 -0
- package/docs/assets/logo.png +0 -0
- package/docs/assets/plugin/toolbox.png +0 -0
- package/docs/assets/synced.png +0 -0
- package/package.json +41 -0
- package/plugin/README.md +54 -0
- package/plugin/sourcemap.json +264 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/Actor/AzulSync.server.luau +905 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/AzulService.luau +1010 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/Config.luau +29 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/Enums.luau +11 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/CollapsibleTitledSection.luau +214 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/ColorPicker.luau +360 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/CustomTextButton.luau +170 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/DropdownMenu.luau +363 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/HorizontalLine.luau +43 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/ImageButtonWithText.luau +181 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledCheckbox.luau +295 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledColorInputPicker.luau +294 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledMultiChoice.luau +163 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledNumberInput.luau +312 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledRadioButton.luau +55 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledSlider.luau +151 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledTextInput.luau +222 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledToggleButton.luau +73 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/StatefulImageButton.luau +125 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/VerticalScrollingFrame.luau +100 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/VerticalSpacer.luau +35 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/VerticallyScalingListFrame.luau +107 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/GuiUtilities.luau +429 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/RbxGui.luau +4363 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/UI.luau +425 -0
- package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/WebSocketClient.luau +161 -0
- package/src/build.ts +120 -0
- package/src/cli.ts +496 -0
- package/src/config.ts +170 -0
- package/src/fs/fileWriter.ts +414 -0
- package/src/fs/treeManager.ts +458 -0
- package/src/fs/watcher.ts +142 -0
- package/src/index.ts +450 -0
- package/src/ipc/httpPolling.ts +214 -0
- package/src/ipc/messages.ts +159 -0
- package/src/ipc/server.ts +196 -0
- package/src/pack.ts +309 -0
- package/src/push.ts +726 -0
- package/src/snapshot/rojo.ts +467 -0
- package/src/snapshot.ts +161 -0
- package/src/sourcemap/generator.ts +504 -0
- package/src/sourcemap/propertyLoader.ts +195 -0
- package/src/util/id.ts +15 -0
- package/src/util/log.ts +94 -0
- package/tsconfig.json +24 -0
package/.gitattributes
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
plugin/StudioWidgets/** linguist-vendored
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: Ransomwave
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
1. Go to '...'
|
|
16
|
+
2. Click on '....'
|
|
17
|
+
3. Scroll down to '....'
|
|
18
|
+
4. See error
|
|
19
|
+
|
|
20
|
+
**Expected behavior**
|
|
21
|
+
A clear and concise description of what you expected to happen.
|
|
22
|
+
|
|
23
|
+
**Screenshots**
|
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
|
25
|
+
|
|
26
|
+
**Desktop (please complete the following information):**
|
|
27
|
+
- OS: [e.g. Windows 11]
|
|
28
|
+
- Azul Version [e.g. 1.2.0]
|
|
29
|
+
|
|
30
|
+
**Additional context**
|
|
31
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# <span><img src="./docs/assets/logo.png" alt="Azul Logo" height="30"></span> Azul
|
|
2
|
+
|
|
3
|
+
Azul is a two-way synchronization tool between Roblox Studio and your local filesystem with full Luau-LSP support, which allows code completion & type checking.
|
|
4
|
+
|
|
5
|
+
Azul allows you to use professional-grade tools like Visual Studio Code in Roblox development.
|
|
6
|
+
|
|
7
|
+
_Yes, the name is a pun on Rojo (Spanish for "red"). Azul means "blue"!_
|
|
8
|
+
|
|
9
|
+
<a href="#quick-start"><b>Quick Start</b></a> — <a href="#why-azul"><b>Why Azul</b></a> — <a href="https://github.com/Ransomwave/azul/wiki"><b>Documentation</b></a>
|
|
10
|
+
|
|
11
|
+
## Philosophy
|
|
12
|
+
|
|
13
|
+
Azul treats **Studio as the source of truth**. The local filesystem mirrors what's in Studio, not the other way around.
|
|
14
|
+
|
|
15
|
+
Azul avoids the complexity and ambiguity that can come with tools like Rojo: for example, deciding a new Script's parent class, properties, or attributes. Rather than trying to encode Studio state in extra files (e.g. `*.meta.json`), Azul lets Studio be the source of truth. This, in my opinion, leads to a much simpler and more intuitive workflow.
|
|
16
|
+
|
|
17
|
+
Azul also allows pushing local files into Studio using the `azul build` command, which creates or overwrites instances in Studio based on your local files.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- - [x] 🔄 **Bi-directional sync**: Changes in Studio update files, and file edits update Studio
|
|
22
|
+
- - [x] 🏗️ **[Build command](https://github.com/Ransomwave/azul/wiki/Getting-started#building-from-an-existing-project)**: `azul build` one-time pushes your local files into Studio (creates or overwrites, never deletes)
|
|
23
|
+
- - [x] 📦 **[Push command](https://github.com/Ransomwave/azul/wiki/Commands#azul-push)**: `azul push` selectively pushes local files. Useful when importing external libraries or using package managers (i.e Wally)
|
|
24
|
+
- - [x] 🔴 **Rojo compatibility mode**: Supports importing from Rojo projects with the `--rojo` flag.
|
|
25
|
+
- - [x] 🌳 **DataModel mirroring**: Instance hierarchy 1:1 mapped to folder structure
|
|
26
|
+
- - [x] 🎯 **No manual config / required structure**: Works out of the box with new and existing Roblox Studio projects, regardless of structure.
|
|
27
|
+
- - [x] 🗺️ **Automatic sourcemap generation**: Generates a Rojo-compatible `sourcemap.json` so tools like Luau-lsp work out of the box.
|
|
28
|
+
|
|
29
|
+
### Upcoming Features
|
|
30
|
+
|
|
31
|
+
- [ ] 🏛️ **Fully hermetic builds**: Make Azul fully serialize `Instance` properties, allowing for fully reproducible 1:1 builds.
|
|
32
|
+
|
|
33
|
+
## Why Azul?
|
|
34
|
+
|
|
35
|
+
Because Azul is as simple as it gets: Run the azul command in your project folder, connect the companion plugin in Studio & start coding.
|
|
36
|
+
|
|
37
|
+
Compatible with projects both old and new, no more extra worrying about how to “Rojo-ify” your project. Your code is literally 1:1 mapped to what’s in Studio.
|
|
38
|
+
|
|
39
|
+
### Rojo already exists, why make another tool?
|
|
40
|
+
|
|
41
|
+
While Rojo is a powerful tool, I don't believe it's always the best fit for every developer or project. Otherwise trivial tasks in Studio, like inserting a Script inside Tool or Model, suddenly become non-trivial challenges. Rojo just lacks the flexibility of Studio.
|
|
42
|
+
|
|
43
|
+
Azul is my approach to solve these issues. I built Azul for workflows similar to mine: Studio-first developers who'd rather manage their projects in the dedicated environment instead of fighting with meta files.
|
|
44
|
+
|
|
45
|
+
### Why not use the upcoming Script Sync feature?
|
|
46
|
+
|
|
47
|
+
Azul offers several advantages over the upcoming Script Sync feature:
|
|
48
|
+
|
|
49
|
+
- **Azul mirrors everything**: Script Sync can only sync specified folders and scripts, not entire projects. Azul directly mirrors the entire DataModel, meaning you don't have to worry about manually syncing specific parts of your project.
|
|
50
|
+
|
|
51
|
+
- **Building from filesystem**: Script Sync only syncs changes made in Studio to the filesystem. Azul allows you to push changes from your local files into Studio using the `azul build` command.
|
|
52
|
+
|
|
53
|
+
- **Pushing from filesystem**: Sync any code you have stored locally directly to your desired destination using `azul push`. Useful when importing external libraries (e.g. GitHub) or when using Package Managers (e.g. Wally, pesde)
|
|
54
|
+
|
|
55
|
+
- **Rojo compatibility**: Azul can import existing Rojo projects using the `--rojo` & `--rojo-project=<ProjectFile>` flags, making Azul compatible with many existing open source projects.
|
|
56
|
+
- **Generates a Rojo-compatible `sourcemap.json`**: This allows any tooling that require Rojo-style sourcemaps _(like luau-lsp, the language server)_ to work seamlessly.
|
|
57
|
+
|
|
58
|
+
- **You can use it today!**: Azul requires no commitment to a specific project structure. If you want to try out Script Sync (or any other tool) in the future, Azul won't get in your way.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Quick Start
|
|
63
|
+
|
|
64
|
+
### Auto-Install (Recommended)
|
|
65
|
+
|
|
66
|
+
1. Install Node.js from [nodejs.org](https://nodejs.org/).
|
|
67
|
+
2. Run the following command in your terminal:
|
|
68
|
+
```ps1
|
|
69
|
+
npm install -g azul
|
|
70
|
+
```
|
|
71
|
+
3. Install the Azul Companion Plugin to Roblox Studio.
|
|
72
|
+
- **Guide: [Azul Plugin: Install Instructions](/plugin/README.md)**
|
|
73
|
+
4. Create a new Folder to house your Azul project and open it in your IDE.
|
|
74
|
+
5. With the terminal in your project folder, run:
|
|
75
|
+
```
|
|
76
|
+
azul
|
|
77
|
+
```
|
|
78
|
+
6. In Roblox Studio, click on the "Connect" button in the Azul plugin.
|
|
79
|
+
7. Start coding!
|
|
80
|
+
8. _(Optional)_ For the best experience, check out the [Recommended Tools & Extensions](#recommended-tools--extensions).
|
|
81
|
+
|
|
82
|
+
### Manual Install
|
|
83
|
+
|
|
84
|
+
1. Clone this repository using Git:
|
|
85
|
+
```ps1
|
|
86
|
+
git clone https://github.com/Ransomwave/azul.git
|
|
87
|
+
```
|
|
88
|
+
2. Install Node.js from [nodejs.org](https://nodejs.org/) or by using your system's package manager:
|
|
89
|
+
```ps1
|
|
90
|
+
# Windows (using winget)
|
|
91
|
+
winget install OpenJS.NodeJS.LTS
|
|
92
|
+
# macOS (using Homebrew)
|
|
93
|
+
brew install node
|
|
94
|
+
# Linux (using apt)
|
|
95
|
+
sudo apt install nodejs npm
|
|
96
|
+
```
|
|
97
|
+
3. Install dependencies by running
|
|
98
|
+
```ps1
|
|
99
|
+
npm install
|
|
100
|
+
```
|
|
101
|
+
4. Build the project
|
|
102
|
+
```ps1
|
|
103
|
+
npm run build
|
|
104
|
+
```
|
|
105
|
+
5. Install the project globally
|
|
106
|
+
```ps1
|
|
107
|
+
npm install -g .
|
|
108
|
+
```
|
|
109
|
+
6. Install the Azul Companion Plugin to Roblox Studio.
|
|
110
|
+
- **Guide: [Azul Plugin: Install Instructions](/plugin/README.md)**
|
|
111
|
+
7. Create a new Folder to house your Azul project and open it in your IDE.
|
|
112
|
+
8. With the terminal in your project folder, run:
|
|
113
|
+
```ps1
|
|
114
|
+
azul
|
|
115
|
+
```
|
|
116
|
+
9. In Roblox Studio, click on the "Connect" button in the Azul plugin.
|
|
117
|
+
|
|
118
|
+
## Recommended Tools & Extensions
|
|
119
|
+
|
|
120
|
+
### VSCode with Luau-LSP
|
|
121
|
+
|
|
122
|
+
To get the best experience, use [Visual Studio Code](https://code.visualstudio.com/) with the [Luau Language Server extension](https://marketplace.visualstudio.com/items?itemName=JohnnyMorganz.luau-lsp).
|
|
123
|
+
|
|
124
|
+
To get IntelliSense working, open your `User Settings (JSON)` from the command palette (`Ctrl+Shift+P` or `Cmd+Shift+P`) and make sure to set up luau-lsp like this:
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
"luau-lsp.plugin.enabled": true,
|
|
128
|
+
"luau-lsp.sourcemap.enabled": true,
|
|
129
|
+
"luau-lsp.sourcemap.autogenerate": false,
|
|
130
|
+
"luau-lsp.sourcemap.sourcemapFile": "sourcemap.json",
|
|
131
|
+
"luau-lsp.sourcemap.includeNonScripts": true,
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
This is my recommended setup for Azul projects. That said, Azul is compatible with any IDE or text editor that can edit `.luau` files. Luau-LSP is also available for other editors like [Neovim](https://github.com/lopi-py/luau-lsp.nvim).
|
|
135
|
+
|
|
136
|
+
### VSCode with Verde
|
|
137
|
+
|
|
138
|
+
[Verde](https://marketplace.visualstudio.com/items?itemName=Dvitash.verde) is a VSCode extension that mimics the Roblox Studio Explorer and Properties windows. It works great alongside Azul to provide a seamless development experience.
|
|
139
|
+
|
|
140
|
+
## Contributing
|
|
141
|
+
|
|
142
|
+
Contributions are welcome! Please open issues or pull requests on GitHub. I want to make Azul the best it can be for myself and anybody who wants to use it.
|
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface BuildOptions {
|
|
2
|
+
syncDir?: string;
|
|
3
|
+
rojoMode?: boolean;
|
|
4
|
+
rojoProjectFile?: string;
|
|
5
|
+
applySourcemap?: boolean;
|
|
6
|
+
fromSourcemap?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class BuildCommand {
|
|
9
|
+
private ipc;
|
|
10
|
+
private syncDir;
|
|
11
|
+
private rojoMode;
|
|
12
|
+
private rojoProjectFile?;
|
|
13
|
+
private applySourcemap;
|
|
14
|
+
private fromSourcemap;
|
|
15
|
+
constructor(options?: BuildOptions);
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAcA,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,GAAG,CAAY;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,eAAe,CAAC,CAAS;IACjC,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,aAAa,CAAU;gBAEnB,OAAO,GAAE,YAAiB;IAWzB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA8ElC"}
|
package/dist/build.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { IPCServer } from "./ipc/server.js";
|
|
4
|
+
import { config } from "./config.js";
|
|
5
|
+
import { log } from "./util/log.js";
|
|
6
|
+
import { SnapshotBuilder } from "./snapshot.js";
|
|
7
|
+
import { RojoSnapshotBuilder } from "./snapshot/rojo.js";
|
|
8
|
+
import { applySourcemapProperties, buildInstancesFromSourcemap, loadSourcemapPropertyIndex, } from "./sourcemap/propertyLoader.js";
|
|
9
|
+
export class BuildCommand {
|
|
10
|
+
ipc;
|
|
11
|
+
syncDir;
|
|
12
|
+
rojoMode;
|
|
13
|
+
rojoProjectFile;
|
|
14
|
+
applySourcemap;
|
|
15
|
+
fromSourcemap;
|
|
16
|
+
constructor(options = {}) {
|
|
17
|
+
this.syncDir = path.resolve(options.syncDir ?? config.syncDir);
|
|
18
|
+
this.rojoMode = Boolean(options.rojoMode);
|
|
19
|
+
this.rojoProjectFile = options.rojoProjectFile;
|
|
20
|
+
this.applySourcemap = options.applySourcemap !== false;
|
|
21
|
+
this.fromSourcemap = options.fromSourcemap === true;
|
|
22
|
+
this.ipc = new IPCServer(config.port, undefined, {
|
|
23
|
+
requestSnapshotOnConnect: false,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async run() {
|
|
27
|
+
const builder = this.rojoMode
|
|
28
|
+
? new RojoSnapshotBuilder({
|
|
29
|
+
projectFile: this.rojoProjectFile,
|
|
30
|
+
cwd: process.cwd(),
|
|
31
|
+
destPrefix: [],
|
|
32
|
+
})
|
|
33
|
+
: new SnapshotBuilder({
|
|
34
|
+
sourceDir: this.syncDir,
|
|
35
|
+
destPrefix: [],
|
|
36
|
+
skipSymlinks: true,
|
|
37
|
+
});
|
|
38
|
+
if (this.rojoMode) {
|
|
39
|
+
log.info(`Preparing Rojo compatibility build from ${this.rojoProjectFile ?? "default.project.json"}`);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
log.info(`Preparing build snapshot from ${this.syncDir}`);
|
|
43
|
+
}
|
|
44
|
+
let instances = [];
|
|
45
|
+
if (!this.rojoMode && this.fromSourcemap) {
|
|
46
|
+
const built = buildInstancesFromSourcemap(config.sourcemapPath);
|
|
47
|
+
if (!built) {
|
|
48
|
+
log.warn("Falling back to filesystem build because sourcemap import failed.");
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
instances = built;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (instances.length === 0) {
|
|
55
|
+
try {
|
|
56
|
+
instances = await builder.build();
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
log.error(`${error}`);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (!this.rojoMode && this.applySourcemap && !this.fromSourcemap) {
|
|
64
|
+
const index = loadSourcemapPropertyIndex(config.sourcemapPath);
|
|
65
|
+
const applied = applySourcemapProperties(instances, index);
|
|
66
|
+
if (applied > 0) {
|
|
67
|
+
log.success(`Applied properties/attributes from sourcemap to ${applied} instance(s)`);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
if (!index && fs.existsSync(config.sourcemapPath)) {
|
|
71
|
+
log.warn("Sourcemap present but could not be parsed; continuing without properties.");
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
log.info("No packed properties found in sourcemap; continuing with script/folder snapshot only.");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
log.info(`Waiting for Studio to connect on port ${config.port}...`);
|
|
79
|
+
await new Promise((resolve) => {
|
|
80
|
+
this.ipc.onConnection(() => {
|
|
81
|
+
log.info("Studio connected. Sending build snapshot...");
|
|
82
|
+
this.ipc.send({ type: "buildSnapshot", data: instances });
|
|
83
|
+
log.success(`Sent ${instances.length} instances`);
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
this.ipc.close();
|
|
86
|
+
resolve();
|
|
87
|
+
}, 200);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRo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