typed-factorio 1.8.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,153 @@
1
+ import {ChildProcess} from 'child_process';
2
+
3
+ declare namespace open {
4
+ interface Options {
5
+ /**
6
+ Wait for the opened app to exit before fulfilling the promise. If `false` it's fulfilled immediately when opening the app.
7
+
8
+ Note that it waits for the app to exit, not just for the window to close.
9
+
10
+ On Windows, you have to explicitly specify an app for it to be able to wait.
11
+
12
+ @default false
13
+ */
14
+ readonly wait?: boolean;
15
+
16
+ /**
17
+ __macOS only__
18
+
19
+ Do not bring the app to the foreground.
20
+
21
+ @default false
22
+ */
23
+ readonly background?: boolean;
24
+
25
+ /**
26
+ __macOS only__
27
+
28
+ Open a new instance of the app even it's already running.
29
+
30
+ A new instance is always opened on other platforms.
31
+
32
+ @default false
33
+ */
34
+ readonly newInstance?: boolean;
35
+
36
+ /**
37
+ Specify the `name` of the app to open the `target` with, and optionally, app `arguments`. `app` can be an array of apps to try to open and `name` can be an array of app names to try. If each app fails, the last error will be thrown.
38
+
39
+ The app name is platform dependent. Don't hard code it in reusable modules. For example, Chrome is `google chrome` on macOS, `google-chrome` on Linux and `chrome` on Windows. If possible, use [`open.apps`](#openapps) which auto-detects the correct binary to use.
40
+
41
+ You may also pass in the app's full path. For example on WSL, this can be `/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe` for the Windows installation of Chrome.
42
+
43
+ The app `arguments` are app dependent. Check the app's documentation for what arguments it accepts.
44
+ */
45
+ readonly app?: App | readonly App[];
46
+
47
+ /**
48
+ Allow the opened app to exit with nonzero exit code when the `wait` option is `true`.
49
+
50
+ We do not recommend setting this option. The convention for success is exit code zero.
51
+
52
+ @default false
53
+ */
54
+ readonly allowNonzeroExitCode?: boolean;
55
+ }
56
+
57
+ interface OpenAppOptions extends Omit<Options, 'app'> {
58
+ /**
59
+ Arguments passed to the app.
60
+
61
+ These arguments are app dependent. Check the app's documentation for what arguments it accepts.
62
+ */
63
+ readonly arguments?: readonly string[];
64
+ }
65
+
66
+ type AppName =
67
+ | 'chrome'
68
+ | 'firefox'
69
+ | 'edge';
70
+
71
+ type App = {
72
+ name: string | readonly string[];
73
+ arguments?: readonly string[];
74
+ };
75
+ }
76
+
77
+ // eslint-disable-next-line no-redeclare
78
+ declare const open: {
79
+ /**
80
+ Open stuff like URLs, files, executables. Cross-platform.
81
+
82
+ Uses the command `open` on macOS, `start` on Windows and `xdg-open` on other platforms.
83
+
84
+ There is a caveat for [double-quotes on Windows](https://github.com/sindresorhus/open#double-quotes-on-windows) where all double-quotes are stripped from the `target`.
85
+
86
+ @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. For example, URLs open in your default browser.
87
+ @returns The [spawned child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess). You would normally not need to use this for anything, but it can be useful if you'd like to attach custom event listeners or perform other operations directly on the spawned process.
88
+
89
+ @example
90
+ ```
91
+ import open = require('open');
92
+
93
+ // Opens the image in the default image viewer
94
+ await open('unicorn.png', {wait: true});
95
+ console.log('The image viewer app closed');
96
+
97
+ // Opens the url in the default browser
98
+ await open('https://sindresorhus.com');
99
+
100
+ // Opens the URL in a specified browser.
101
+ await open('https://sindresorhus.com', {app: {name: 'firefox'}});
102
+
103
+ // Specify app arguments.
104
+ await open('https://sindresorhus.com', {app: {name: 'google chrome', arguments: ['--incognito']}});
105
+ ```
106
+ */
107
+ (
108
+ target: string,
109
+ options?: open.Options
110
+ ): Promise<ChildProcess>;
111
+
112
+ /**
113
+ An object containing auto-detected binary names for common apps. Useful to work around cross-platform differences.
114
+
115
+ @example
116
+ ```
117
+ import open = require('open');
118
+
119
+ await open('https://google.com', {
120
+ app: {
121
+ name: open.apps.chrome
122
+ }
123
+ });
124
+ ```
125
+ */
126
+ apps: Record<open.AppName, string | readonly string[]>;
127
+
128
+ /**
129
+ Open an app. Cross-platform.
130
+
131
+ Uses the command `open` on macOS, `start` on Windows and `xdg-open` on other platforms.
132
+
133
+ @param name - The app you want to open. Can be either builtin supported `open.apps` names or other name supported in platform.
134
+ @returns The [spawned child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess). You would normally not need to use this for anything, but it can be useful if you'd like to attach custom event listeners or perform other operations directly on the spawned process.
135
+
136
+ @example
137
+ ```
138
+ const {apps, openApp} = require('open');
139
+
140
+ // Open Firefox
141
+ await openApp(apps.firefox);
142
+
143
+ // Open Chrome incognito mode
144
+ await openApp(apps.chrome, {arguments: ['--incognito']});
145
+
146
+ // Open Xcode
147
+ await openApp('xcode');
148
+ ```
149
+ */
150
+ openApp: (name: open.App['name'], options?: open.OpenAppOptions) => Promise<ChildProcess>;
151
+ };
152
+
153
+ export = open;
@@ -19496,6 +19496,7 @@ interface LuaRemote {
19496
19496
  * @param args Arguments to pass to the called function.
19497
19497
  * @see {@link https://lua-api.factorio.com/latest/LuaRemote.html#LuaRemote.call Online documentation}
19498
19498
  */
19499
+ call<T extends (...args: any) => any>(_interface: string, _function: string, ...args: Parameters<T>): ReturnType<T>
19499
19500
  call(_interface: string, _function: string, ...args: readonly Any[]): Any | nil
19500
19501
  /**
19501
19502
  * List of all registered interfaces. For each interface name, `remote.interfaces[name]` is a dictionary mapping the interface's registered functions to the value `true`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typed-factorio",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Featureful typescript definitions for the the Factorio modding lua api.",
5
5
  "keywords": [
6
6
  "factorio",
@@ -58,4 +58,4 @@
58
58
  "typescript-to-lua": "^1.10.0"
59
59
  },
60
60
  "packageManager": "yarn@3.2.3"
61
- }
61
+ }
package/Changelog.md DELETED
@@ -1,256 +0,0 @@
1
- # v1.8.0
2
-
3
- - Updated to factorio version 1.1.69
4
-
5
- # v1.7.4
6
-
7
- - Fix advanced types of method returns (nullability, string unions, etc.)
8
-
9
- # v1.7.3
10
-
11
- - Improve types of "util" lualib module
12
- - Made compatible with typescript v4.8
13
-
14
- # v1.7.1
15
-
16
- - Added proper nullablity to members with different read/write types
17
- - Deduped union types
18
-
19
- # v1.7.0
20
-
21
- - Updated to factorio version 1.1.67
22
-
23
- # v1.6.1
24
-
25
- - Fixed write type for `BoundingBox`.
26
- - Simplified types for BlueprintEntity.
27
-
28
- # v1.6.0
29
-
30
- - Updated to factorio version 1.1.64
31
-
32
- # v1.5.1
33
-
34
- - Added old `Read` types as deprecated type aliases of new types; to help with migration.
35
-
36
- # v1.5.0
37
-
38
- ### BREAKING
39
-
40
- - Read-only forms of concepts (the most common form used) is now specified with just the name; forms with a `Read` or `Table` suffix have been removed.
41
- - Write forms are now specified as either a union of table and array forms, or with a `Write` suffix for concepts.
42
- - For table-or-array concepts: `MapPositionRead` -> `MapPosition`, `MapPosition` -> `MapPosition | PositionArray`
43
- - For table concepts: `ScriptAreaRead` -> `ScriptArea`, `ScriptArea` -> `ScriptAreaWrite`
44
- - The minimum TSTL version has been increased to v1.6.1 (A bug with documentation comments was fixed in that version).
45
-
46
- ### Other
47
-
48
- - Updated to factorio version 1.1.63.
49
- - Upgraded to factorio api docs json version 3.
50
- - The new type `nil` is used instead of `undefined` (they are equivalent).
51
- - More complete type for `BlueprintEntity`.
52
- - Fixed missing read-write forms for more concepts.
53
- - Improved documentation comments (enabled by json docs version 3).
54
- - Improved documentation comments for variant parameter groups.
55
-
56
- # v1.4.0
57
-
58
- - Improve doc comments for enum concepts
59
- - Improve doc comment formatting
60
- - Improve types of concepts with literal union types
61
- - Add read-specific types to AutoplaceControl and ComparatorString
62
-
63
- # v1.3.2
64
-
65
- - Move "notes" comment into the main body of doc comment, instead of in @remarks. This works around #13.
66
- - Add manually defined overload for LuaControl::teleport().
67
-
68
- # v1.3.1
69
-
70
- - Use @linkplain instead of @link for web links. This hopefully works around issue #13
71
-
72
- # v1.3.0
73
-
74
- - Updated to factorio version 1.1.61
75
-
76
- # v1.2.0
77
-
78
- - Updated to factorio version 1.1.60
79
-
80
- # v1.1.0
81
-
82
- - Updated to factorio version 1.1.59
83
-
84
- # v1.0.0
85
-
86
- - This project now has all the features that was originally planned, and can now guarantee reasonable backwards compatibility for future releases.
87
- - Updated to factorio version 1.1.57
88
-
89
- # v0.20.0
90
-
91
- - Updated to factorio version 1.1.56
92
- - This is an **opt-in** feature: Some numeric types which represent indices/number,e.g. player_index, entity_number, are now branded numbers with their own type, e.g. `PlayerIndex` and `EntityNumber`. See the README for more info.
93
- - Added custom-index-template.d.ts to assist trying out custom changes to types in a project.
94
-
95
- # v0.19.0
96
-
97
- - Updated to factorio version 1.1.53
98
- - Updated to json api version 2
99
- - Improved documentation comments
100
-
101
- ## Changes
102
-
103
- - `Position`, `PositionArray`, and `PositionTable` have been replaced by `MapPosition`, `MapPositionArray`, and `MapPositionTable` respectively. These are now deprecated and may be removed in a future version.
104
-
105
- # v0.18.1
106
-
107
- - `TechnologyIdentification` now also has a more specific type when read.
108
-
109
- # v0.18.0
110
-
111
- - `ForceIdentification` and `ItemPrototypeIdentification` now have more specific types when read.
112
- - Properties which represent a flag concept now have the correct specific type, instead of `string`.
113
-
114
- # v0.17.1
115
-
116
- - Fixed documentation links for events
117
-
118
- # v0.17.0
119
-
120
- - Updated to factorio version 1.1.52
121
-
122
- # v0.16.0
123
-
124
- - `LuaCustomTable` can be iterated on in a for-of loop directly (without using `pairs`). This requires TSTL v1.3.0 or later.
125
- - TSTL dependency minimum version is now v1.3.0.
126
-
127
- # v0.15.0
128
-
129
- - Table or array concepts are now declared in table form wherever it is an "read" position.
130
- - This works with setter overloading for applicable properties: `player.color.x; player.color = [1, 1, 1]` is now valid!
131
- - This also applies to concepts/complex types which contain table_or_array properties.
132
- - Some concepts now also have a special form where it is known to be in a "read" position, where all table_or_array concepts are declared in table form. These concepts are suffixed with "Read", e.g. `ScriptAreaRead`.
133
- - Arrays which are known to be in a "write" only form (e.g. method parameters) now are marked readonly. This means you can now pass readonly arrays to these methods.
134
- - `MapPosition` is now a table or array concept.
135
- - Classes with subclasses are now declared with all properties, instead of an intersection of subclasses (reversion)
136
- - Subclass specializations added for some missing classes
137
-
138
- # v0.14.1
139
-
140
- - LuaStyle: `extra_margin/padding_when_activated` is now for subclass scroll_pane
141
-
142
- # v0.14.0
143
-
144
- - LuaStyle size, margin/padding setters now have more specific array types. These array types are `SizeArray` and `StyleValuesArray` for size and margin/padding, respectively.
145
- - `@noSelf` annotation is now only present when necessary.
146
- - For classes with subclasses:
147
- - The original class name (e.g. `LuaItemStack`) still contains attributes of all subclasses (same as before).
148
- - There is now a `Base` type (e.g. `BaseItemStack`) which only includes attributes common to all subclasses.
149
- - There is a separate type definition for each subclass, e.g. `BlueprintItem`. Note that one instance may still belong to multiple subclasses (the subclasses are not mutually exclusive).
150
- - The above two can be optionally used for stricter types.
151
-
152
- # v0.13.2
153
-
154
- - Fix: resize_to_sprite property should not be on subclass sprite-button
155
- - Fix: ChooseElemButtonSpec filters should be named elem_filters
156
- - Switch back to `/latest` api docs link
157
- - New version of web api docs is now active
158
-
159
- # v0.13.0
160
-
161
- - Update to factorio version 1.1.49
162
-
163
- # v0.12.0
164
-
165
- - Update to factorio version 1.1.48
166
-
167
- # v0.11.1
168
-
169
- - Localised strings now accept boolean and undefined.
170
-
171
- # v0.11.0
172
-
173
- - Update to factorio version 1.1.46
174
-
175
- # v0.10.0
176
-
177
- - LuaGuiElement.style and LuaControl.opened now have different get/set types (more specific get type).
178
- - The array form of LocalizedString is now readonly.
179
-
180
- # v0.9.0
181
-
182
- - Update to factorio version 1.1.43
183
- - The `defines.events `_type_ was renamed to `defines.Events`, to reduce confusion between the namespace/type
184
-
185
- # v0.8.0
186
-
187
- - All event types now explicitly extend `EventData`
188
- - Variant parameter groups without additional fields now have their own type, instead of all being grouped into `Other`
189
-
190
- # v0.7.3
191
-
192
- - Update to factorio version 1.1.42
193
- - No api changes, but improvements to descriptions
194
-
195
- # v0.7.2
196
-
197
- - Fix minor issue for event types
198
-
199
- # v0.7.0
200
-
201
- - Updated to factorio version 1.1.41 (no changes to lua api)
202
- - Improved smart types for events
203
-
204
- # v0.6.1
205
-
206
- - Added type for BlueprintControlBehavior
207
-
208
- # v0.6.0
209
-
210
- - Updated to factorio version 1.1.40
211
- - Fixed regression with duplicate strings in string union types
212
-
213
- # v0.5.0
214
-
215
- - Updated to factorio version 1.1.39
216
- - Documentation links now point to the new API docs website. More info here: https://forums.factorio.com/viewtopic.php?f=34&t=99797
217
-
218
- # v0.4.1
219
-
220
- ### Changed
221
-
222
- - LuaRemote.addInterface now lets remote functions take any arguments.
223
-
224
- # v0.4.0
225
-
226
- ## **BREAKING**
227
-
228
- - Only the latest version api is now provided.
229
- - It is now accessed using `typed-factorio/runtime` instead of `typed-factorio/<version>`
230
-
231
- ### Added
232
-
233
- - Basic types for settings and data stage. See README for more details.
234
- - Types for "util" and "mod-gui" lualib modules
235
-
236
- ### Fixed
237
-
238
- - LuaGuiElement::add with a literal now give diagnostic if you supply a field that shouldn't be there.
239
-
240
- ### Internal
241
-
242
- - Split generated files into multiple files
243
- - Improved compilation tests
244
-
245
- # v0.3.0
246
-
247
- - Added factorio version `1.1.38`
248
-
249
- # v0.2.0
250
-
251
- - `AnyBasic` now uses type `table` instead of type `Record<any, AnyBasic>`
252
- - README changes
253
-
254
- # v0.1.0
255
-
256
- - Initial release