@bscotch/gml-parser 1.14.2
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/LICENSE.md +29 -0
- package/README.md +151 -0
- package/assets/GmlSpec.xml +11419 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/jsdoc.d.ts +79 -0
- package/dist/jsdoc.d.ts.map +1 -0
- package/dist/jsdoc.feather.d.ts +23 -0
- package/dist/jsdoc.feather.d.ts.map +1 -0
- package/dist/jsdoc.feather.js +143 -0
- package/dist/jsdoc.feather.js.map +1 -0
- package/dist/jsdoc.js +468 -0
- package/dist/jsdoc.js.map +1 -0
- package/dist/jsdoc.test.d.ts +2 -0
- package/dist/jsdoc.test.d.ts.map +1 -0
- package/dist/jsdoc.test.js +185 -0
- package/dist/jsdoc.test.js.map +1 -0
- package/dist/lexer.d.ts +3 -0
- package/dist/lexer.d.ts.map +1 -0
- package/dist/lexer.js +14 -0
- package/dist/lexer.js.map +1 -0
- package/dist/lexer.test.d.ts +2 -0
- package/dist/lexer.test.d.ts.map +1 -0
- package/dist/lexer.test.js +78 -0
- package/dist/lexer.test.js.map +1 -0
- package/dist/lib.objects.d.ts +190 -0
- package/dist/lib.objects.d.ts.map +1 -0
- package/dist/lib.objects.js +242 -0
- package/dist/lib.objects.js.map +1 -0
- package/dist/logger.d.ts +13 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +14 -0
- package/dist/logger.js.map +1 -0
- package/dist/modules.d.ts +19 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +320 -0
- package/dist/modules.js.map +1 -0
- package/dist/modules.test.d.ts +2 -0
- package/dist/modules.test.d.ts.map +1 -0
- package/dist/modules.test.js +57 -0
- package/dist/modules.test.js.map +1 -0
- package/dist/modules.types.d.ts +78 -0
- package/dist/modules.types.d.ts.map +1 -0
- package/dist/modules.types.js +2 -0
- package/dist/modules.types.js.map +1 -0
- package/dist/modules.util.d.ts +5 -0
- package/dist/modules.util.d.ts.map +1 -0
- package/dist/modules.util.js +13 -0
- package/dist/modules.util.js.map +1 -0
- package/dist/parser.d.ts +121 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +571 -0
- package/dist/parser.js.map +1 -0
- package/dist/parser.test.d.ts +2 -0
- package/dist/parser.test.d.ts.map +1 -0
- package/dist/parser.test.js +143 -0
- package/dist/parser.test.js.map +1 -0
- package/dist/parser.utility.d.ts +29 -0
- package/dist/parser.utility.d.ts.map +1 -0
- package/dist/parser.utility.js +125 -0
- package/dist/parser.utility.js.map +1 -0
- package/dist/project.asset.d.ts +115 -0
- package/dist/project.asset.d.ts.map +1 -0
- package/dist/project.asset.js +802 -0
- package/dist/project.asset.js.map +1 -0
- package/dist/project.code.d.ts +130 -0
- package/dist/project.code.d.ts.map +1 -0
- package/dist/project.code.js +570 -0
- package/dist/project.code.js.map +1 -0
- package/dist/project.d.ts +533 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.diagnostics.d.ts +32 -0
- package/dist/project.diagnostics.d.ts.map +1 -0
- package/dist/project.diagnostics.js +23 -0
- package/dist/project.diagnostics.js.map +1 -0
- package/dist/project.js +1216 -0
- package/dist/project.js.map +1 -0
- package/dist/project.location.d.ts +133 -0
- package/dist/project.location.d.ts.map +1 -0
- package/dist/project.location.js +219 -0
- package/dist/project.location.js.map +1 -0
- package/dist/project.native.d.ts +26 -0
- package/dist/project.native.d.ts.map +1 -0
- package/dist/project.native.js +321 -0
- package/dist/project.native.js.map +1 -0
- package/dist/project.spec.d.ts +1298 -0
- package/dist/project.spec.d.ts.map +1 -0
- package/dist/project.spec.js +263 -0
- package/dist/project.spec.js.map +1 -0
- package/dist/project.test.d.ts +2 -0
- package/dist/project.test.d.ts.map +1 -0
- package/dist/project.test.js +633 -0
- package/dist/project.test.js.map +1 -0
- package/dist/shaderDefaults.d.ts +3 -0
- package/dist/shaderDefaults.d.ts.map +1 -0
- package/dist/shaderDefaults.js +32 -0
- package/dist/shaderDefaults.js.map +1 -0
- package/dist/signifiers.d.ts +54 -0
- package/dist/signifiers.d.ts.map +1 -0
- package/dist/signifiers.flags.d.ts +38 -0
- package/dist/signifiers.flags.d.ts.map +1 -0
- package/dist/signifiers.flags.js +131 -0
- package/dist/signifiers.flags.js.map +1 -0
- package/dist/signifiers.js +117 -0
- package/dist/signifiers.js.map +1 -0
- package/dist/spine.d.ts +28 -0
- package/dist/spine.d.ts.map +1 -0
- package/dist/spine.js +64 -0
- package/dist/spine.js.map +1 -0
- package/dist/spine.test.d.ts +2 -0
- package/dist/spine.test.d.ts.map +1 -0
- package/dist/spine.test.js +420 -0
- package/dist/spine.test.js.map +1 -0
- package/dist/spine.types.d.ts +89 -0
- package/dist/spine.types.d.ts.map +1 -0
- package/dist/spine.types.js +2 -0
- package/dist/spine.types.js.map +1 -0
- package/dist/test.lib.d.ts +3 -0
- package/dist/test.lib.d.ts.map +1 -0
- package/dist/test.lib.js +16 -0
- package/dist/test.lib.js.map +1 -0
- package/dist/tokens.categories.d.ts +22 -0
- package/dist/tokens.categories.d.ts.map +1 -0
- package/dist/tokens.categories.js +78 -0
- package/dist/tokens.categories.js.map +1 -0
- package/dist/tokens.code.d.ts +2 -0
- package/dist/tokens.code.d.ts.map +1 -0
- package/dist/tokens.code.js +523 -0
- package/dist/tokens.code.js.map +1 -0
- package/dist/tokens.d.ts +130 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +13 -0
- package/dist/tokens.js.map +1 -0
- package/dist/tokens.lib.d.ts +15 -0
- package/dist/tokens.lib.d.ts.map +1 -0
- package/dist/tokens.lib.js +12 -0
- package/dist/tokens.lib.js.map +1 -0
- package/dist/tokens.shared.d.ts +4 -0
- package/dist/tokens.shared.d.ts.map +1 -0
- package/dist/tokens.shared.js +35 -0
- package/dist/tokens.shared.js.map +1 -0
- package/dist/tokens.strings.d.ts +5 -0
- package/dist/tokens.strings.d.ts.map +1 -0
- package/dist/tokens.strings.js +111 -0
- package/dist/tokens.strings.js.map +1 -0
- package/dist/types.checks.d.ts +50 -0
- package/dist/types.checks.d.ts.map +1 -0
- package/dist/types.checks.js +246 -0
- package/dist/types.checks.js.map +1 -0
- package/dist/types.d.ts +152 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.feather.d.ts +21 -0
- package/dist/types.feather.d.ts.map +1 -0
- package/dist/types.feather.js +156 -0
- package/dist/types.feather.js.map +1 -0
- package/dist/types.hover.d.ts +4 -0
- package/dist/types.hover.d.ts.map +1 -0
- package/dist/types.hover.js +99 -0
- package/dist/types.hover.js.map +1 -0
- package/dist/types.js +457 -0
- package/dist/types.js.map +1 -0
- package/dist/types.primitives.d.ts +10 -0
- package/dist/types.primitives.d.ts.map +1 -0
- package/dist/types.primitives.js +88 -0
- package/dist/types.primitives.js.map +1 -0
- package/dist/types.sprites.d.ts +8 -0
- package/dist/types.sprites.d.ts.map +1 -0
- package/dist/types.sprites.js +417 -0
- package/dist/types.sprites.js.map +1 -0
- package/dist/types.test.d.ts +2 -0
- package/dist/types.test.d.ts.map +1 -0
- package/dist/types.test.js +62 -0
- package/dist/types.test.js.map +1 -0
- package/dist/util.d.ts +50 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +168 -0
- package/dist/util.js.map +1 -0
- package/dist/util.test.d.ts +3 -0
- package/dist/util.test.d.ts.map +1 -0
- package/dist/util.test.js +63 -0
- package/dist/util.test.js.map +1 -0
- package/dist/visitor.assign.d.ts +24 -0
- package/dist/visitor.assign.d.ts.map +1 -0
- package/dist/visitor.assign.js +112 -0
- package/dist/visitor.assign.js.map +1 -0
- package/dist/visitor.d.ts +89 -0
- package/dist/visitor.d.ts.map +1 -0
- package/dist/visitor.functionExpression.d.ts +7 -0
- package/dist/visitor.functionExpression.d.ts.map +1 -0
- package/dist/visitor.functionExpression.js +216 -0
- package/dist/visitor.functionExpression.js.map +1 -0
- package/dist/visitor.globals.d.ts +59 -0
- package/dist/visitor.globals.d.ts.map +1 -0
- package/dist/visitor.globals.js +271 -0
- package/dist/visitor.globals.js.map +1 -0
- package/dist/visitor.identifierAccessor.d.ts +6 -0
- package/dist/visitor.identifierAccessor.d.ts.map +1 -0
- package/dist/visitor.identifierAccessor.js +381 -0
- package/dist/visitor.identifierAccessor.js.map +1 -0
- package/dist/visitor.js +605 -0
- package/dist/visitor.js.map +1 -0
- package/dist/visitor.processor.d.ts +66 -0
- package/dist/visitor.processor.d.ts.map +1 -0
- package/dist/visitor.processor.js +147 -0
- package/dist/visitor.processor.js.map +1 -0
- package/package.json +63 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# License for the Stitch Monorepo
|
|
2
|
+
|
|
3
|
+
License information for the content of this git repository. The various packages in this repo are developed by [Butterscotch Shenanigans](https://www.bscotch.net) ("Bscotch").
|
|
4
|
+
|
|
5
|
+
## License files
|
|
6
|
+
|
|
7
|
+
Whenever a `LICENSE` file is found in a folder, or a license is specified by a `package.json` or similar manifest file, that license takes precedence for all files in that folder and its subfolders.
|
|
8
|
+
|
|
9
|
+
This is the root-most `LICENSE` file, and therefore dictates the default licensing in this repository.
|
|
10
|
+
|
|
11
|
+
## Stitch name and logo
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
Stitch™ and its logo are trademarks of Bscotch. Bscotch reserves all rights to Stitch and its logo.
|
|
16
|
+
|
|
17
|
+
Stitch Logo ©2022 by Bscotch. All rights reserved.
|
|
18
|
+
|
|
19
|
+
## Other code and content
|
|
20
|
+
|
|
21
|
+
Everything found in this project, except for the Stitch name and logo as described above or unless otherwise specified by a more proximal LICENSE file, falls under the MIT license (https://opensource.org/license/mit/):
|
|
22
|
+
|
|
23
|
+
Copyright 2023 Butterscotch Shenanigans
|
|
24
|
+
|
|
25
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
26
|
+
|
|
27
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
28
|
+
|
|
29
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# GameMaker Language (GML) Parser (`gml-parser`)
|
|
2
|
+
|
|
3
|
+
A parser, project model, and meta-programming tool for [GameMaker](https://gamemaker.io/) projects, which provides the core project-management features provided by [Stitch for VSCode](https://marketplace.visualstudio.com/items?itemName=bscotch.bscotch-stitch-vscode).
|
|
4
|
+
|
|
5
|
+
This package can also be used independently of Stitch for VSCode to create automations and pipelines for working with GameMaker projects.
|
|
6
|
+
|
|
7
|
+
**⚠️💀 Use at your own risk, and use source control! This is a meta-programming tool, so it _will_ make changes to and _might_ completely break your project! 💀⚠️**
|
|
8
|
+
|
|
9
|
+
Stitch is developed by [Butterscotch Shenanigans](https://www.bscotch.net) ("Bscotch"). Support this project by buying [our games](https://www.bscotch.net), [reporting issues](https://github.com/bscotch/stitch/issues), and [contributing](https://github.com/bscotch/stitch/tree/develop/packages/parser).
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
This package was developed to replaced our [Stitch CLI](https://github.com/bscotch/stitch/tree/develop/packages/core), so that we could support newer versions of GameMaker and provide underlying features for using VSCode as an alternate GameMaker IDE via [Stitch for VSCode](https://marketplace.visualstudio.com/items?itemName=bscotch.bscotch-stitch-vscode).
|
|
14
|
+
|
|
15
|
+
Unlike the Stitch CLI, which is focused on high-level project management, this parser fully models an entire project, including reference and resource tracking.
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
- [Node.js](https://nodejs.org) v20+
|
|
20
|
+
- Windows. Might partially work on other operating systems, but it is developed and tested only on Windows.
|
|
21
|
+
|
|
22
|
+
⚠️ This project supports a narrow set of GameMaker versions. It does not try to be backwards-compatible with every version of GameMaker, and may not properly handle changes in the most recent versions either. It may break your project if your GameMaker version isn't fully compatible.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
This package does not provide a CLI, but it can be imported into Node.js projects to make your own pipelines and automations for GameMaker projects.
|
|
27
|
+
|
|
28
|
+
If you have Node installed, you can use this package by:
|
|
29
|
+
|
|
30
|
+
1. Opening a terminal
|
|
31
|
+
2. Changing the working directory to wherever your scripts live
|
|
32
|
+
3. Adding a `package.json` file if you don't already have one (by running `npm init`)
|
|
33
|
+
4. Installing this package via `npm install @bscotch/gml-parser` (or the equivalent with another package manager)
|
|
34
|
+
|
|
35
|
+
Then you can import things from this package (ESM-style):
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
import { Project } from '@bscotch/gml-parser';
|
|
39
|
+
|
|
40
|
+
const project = await Project.initialize('path/to/your/project.yyp');
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
This package provides a lot of features, which are mostly exposed via instances of the `Project` class. Some examples are provided here, but these docs are incomplete. You can use Typescript's inference/autocomplete and [peruse this package's source code](https://github.com/bscotch/stitch/tree/develop/packages/parser) to discover more parts of the API.
|
|
46
|
+
|
|
47
|
+
### (Re)load a project
|
|
48
|
+
|
|
49
|
+
When the parser loads a project it has to discover every asset and parse every line of code, so it can take a while for large projects!
|
|
50
|
+
|
|
51
|
+
However, once it's been loaded it'll stay up to date whenever you manipulate your project using the Project instance's methods. So you only have to load things once, unless you manipulate your project externally to the Project instance's methods.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { Project } from '@bscotch/gml-parser';
|
|
55
|
+
|
|
56
|
+
// Load a project into memory, which will parse all of the code,
|
|
57
|
+
// discover all assets,
|
|
58
|
+
// and create a model of the project you can then interact with.
|
|
59
|
+
const project = await Project.initialize('path/to/your/project.yyp');
|
|
60
|
+
|
|
61
|
+
// If you've changed something in the project's files *externally*
|
|
62
|
+
// to the Project model, you can do a full reload of the project
|
|
63
|
+
// to make sure you're up to date.
|
|
64
|
+
await project.reload();
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### View/Manage Project metadata
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
// Get the project's directory
|
|
71
|
+
project.dir;
|
|
72
|
+
|
|
73
|
+
// Get the config (see https://github.com/bscotch/stitch/tree/develop/packages/config)
|
|
74
|
+
project.stitchConfig;
|
|
75
|
+
|
|
76
|
+
// Get the names of each GameMaker config
|
|
77
|
+
project.configs;
|
|
78
|
+
|
|
79
|
+
// List the included files
|
|
80
|
+
project.datafiles;
|
|
81
|
+
|
|
82
|
+
// List the folders defined in the resource tree in the IDE as POSIX paths.
|
|
83
|
+
project.folders;
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Programmatically manage assets
|
|
87
|
+
|
|
88
|
+
A `Project` instance provides methods for adding and removing assets, which you can use to build pipelines and other programmatic tools.
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
// Get a GML file in its parsed state. Returns a Code instance,
|
|
92
|
+
// which includes various methods for querying/modifying them.
|
|
93
|
+
const code = project.getGmlFile(
|
|
94
|
+
'/path/to/my/project/scripts/some_script/some_script.gml',
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// Find an asset. Assets are represented by Asset instances,
|
|
98
|
+
// which include a variety of methods to query and manipulate them.
|
|
99
|
+
const asset = project.getAssetByName('a_room_or_sprite_or_whatever_name');
|
|
100
|
+
|
|
101
|
+
// List the assets found in a given asset-tree folder
|
|
102
|
+
await project.listAssetsInFolder('some/folder', { recursive: true });
|
|
103
|
+
|
|
104
|
+
// Rename an asset-tree folder (equivalent to "moving" it)
|
|
105
|
+
await project.renameFolder('old/folder/path', 'new/folder/path');
|
|
106
|
+
|
|
107
|
+
// Create an asset-tree folder
|
|
108
|
+
await project.createFolder('new/folder/path');
|
|
109
|
+
|
|
110
|
+
// Rename an asset, including all of its references in code and by other asset definitions.
|
|
111
|
+
await project.renameAsset('old_name', 'new_name');
|
|
112
|
+
|
|
113
|
+
// Delete an asset from the project. This does not remove code
|
|
114
|
+
// references, but does try to clean up other kinds of references.
|
|
115
|
+
// E.g. removing a sprite will also remove references to that sprite
|
|
116
|
+
// in Object definitions, and removing an object asset will remove
|
|
117
|
+
// its references as a parent to any of its children.
|
|
118
|
+
await project.removeAssetByName('unwanted_asset_name');
|
|
119
|
+
|
|
120
|
+
// Create a sound asset from an audio file
|
|
121
|
+
await project.createSound(
|
|
122
|
+
'folder/subfolder/my_new_sound',
|
|
123
|
+
'/path/to/source/file.wav',
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
// Create a sprite asset from an image
|
|
127
|
+
await project.createSprite(
|
|
128
|
+
'folder/subfolder/sp_my_sprite',
|
|
129
|
+
'/path/to/source/file.png',
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
// And so on and so on. You can create new objects, rooms, etc.
|
|
133
|
+
// Each asset is modeled by an Asset instance, which will allow
|
|
134
|
+
// you to do further queries and manipulations (like adding a sprite
|
|
135
|
+
// to a room, or adding a new object event, or setting the code
|
|
136
|
+
// for a script, or adding a sprite to an object, or setting an
|
|
137
|
+
// object's parent, etc)
|
|
138
|
+
|
|
139
|
+
// Import assets from another project into this one
|
|
140
|
+
await project.import(someOtherProject, {
|
|
141
|
+
/* import options */
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// Sync the project's Included Files with the files found on disk
|
|
145
|
+
await project.syncIncludedFiles();
|
|
146
|
+
|
|
147
|
+
// Ensure that a discovered asset's yy file is represented
|
|
148
|
+
// by an entry in the project's yyp file. Useful for recovering
|
|
149
|
+
// orphaned assets!
|
|
150
|
+
await project.addAssetToYyp('paty/to/orphaned/resource.yy');
|
|
151
|
+
```
|