@sandustry-modding/types 0.3.0 → 0.4.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/LICENSE +21 -0
  3. package/README.md +8 -19
  4. package/package.json +65 -5
  5. package/src/configs/index.d.ts +38 -0
  6. package/src/configs/modinfo.d.ts +751 -0
  7. package/src/configs/patches.d.ts +195 -0
  8. package/src/sandkit/api/action.d.ts +5 -0
  9. package/src/sandkit/api/blueprints.d.ts +5 -3
  10. package/src/sandkit/api/camera.d.ts +5 -0
  11. package/src/sandkit/api/effects.d.ts +28 -7
  12. package/src/sandkit/api/elements.d.ts +124 -39
  13. package/src/sandkit/api/energy.d.ts +8 -0
  14. package/src/sandkit/api/entities.d.ts +15 -8
  15. package/src/sandkit/api/events.d.ts +139 -2
  16. package/src/sandkit/api/excavation.d.ts +33 -3
  17. package/src/sandkit/api/factory.d.ts +6 -4
  18. package/src/sandkit/api/fire.d.ts +7 -4
  19. package/src/sandkit/api/game.d.ts +8 -2
  20. package/src/sandkit/api/grid.d.ts +72 -23
  21. package/src/sandkit/api/hooks.d.ts +362 -2
  22. package/src/sandkit/api/i18n.d.ts +65 -20
  23. package/src/sandkit/api/input.d.ts +15 -0
  24. package/src/sandkit/api/items.d.ts +7 -0
  25. package/src/sandkit/api/lights.d.ts +55 -8
  26. package/src/sandkit/api/maps.d.ts +10 -1
  27. package/src/sandkit/api/patterns.d.ts +22 -0
  28. package/src/sandkit/api/pickups.d.ts +14 -8
  29. package/src/sandkit/api/pipes.d.ts +9 -5
  30. package/src/sandkit/api/player.d.ts +29 -15
  31. package/src/sandkit/api/progression.d.ts +8 -0
  32. package/src/sandkit/api/reactions.d.ts +11 -0
  33. package/src/sandkit/api/rendering.d.ts +25 -2
  34. package/src/sandkit/api/resources.d.ts +5 -0
  35. package/src/sandkit/api/schedule.d.ts +7 -0
  36. package/src/sandkit/api/settings.d.ts +7 -0
  37. package/src/sandkit/api/shared.d.ts +13 -3
  38. package/src/sandkit/api/signals.d.ts +29 -0
  39. package/src/sandkit/api/sound.d.ts +14 -8
  40. package/src/sandkit/api/structureBehaviors.d.ts +8 -0
  41. package/src/sandkit/api/structures.d.ts +353 -43
  42. package/src/sandkit/api/tech.d.ts +73 -9
  43. package/src/sandkit/api/terrains.d.ts +25 -13
  44. package/src/sandkit/api/triggers.d.ts +10 -0
  45. package/src/sandkit/api/ui.d.ts +146 -1
  46. package/src/sandkit/api/upgrades.d.ts +2 -1
  47. package/src/sandkit/api/utils.d.ts +10 -5
  48. package/src/sandkit/api/world.d.ts +30 -25
  49. package/src/sandkit/index.d.ts +12 -1
  50. package/src/shared/api/elements.d.ts +36 -22
  51. package/src/shared/api/grid.d.ts +11 -6
  52. package/src/shared/api/player.d.ts +8 -4
  53. package/src/shared/api/shared.d.ts +2 -1
  54. package/src/shared/api/structures.d.ts +55 -17
  55. package/src/shared/api/terrains.d.ts +39 -23
  56. package/src/shared/api/ui.d.ts +5 -0
  57. package/src/shared/api/world.d.ts +9 -9
  58. package/src/worker/api/effects.d.ts +11 -3
  59. package/src/worker/api/elements.d.ts +54 -19
  60. package/src/worker/api/events.d.ts +31 -2
  61. package/src/worker/api/fire.d.ts +4 -2
  62. package/src/worker/api/grid.d.ts +10 -2
  63. package/src/worker/api/hooks.d.ts +68 -2
  64. package/src/worker/api/lights.d.ts +13 -3
  65. package/src/worker/api/shared.d.ts +12 -2
  66. package/src/worker/sandkit-api.d.ts +2 -1
  67. package/docs/Changelog.md +0 -46
  68. package/docs/README.md +0 -62
package/CHANGELOG.md ADDED
@@ -0,0 +1,88 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## Unreleased
9
+
10
+ ## 0.4.0 - 2026-08-29
11
+
12
+ https://github.com/sandustry-modding/SandustryTypes/releases/tag/v0.4.0
13
+
14
+ ### Added
15
+
16
+ - `npm run release` script: changelog/registry/auth checks, `validate`, then `npm publish` (optional `--dry-run`)
17
+ - `src/configs/` types for `modinfo.json` and `patches.json` (`@sandustry-modding/types/configs`), with JSDoc on every key
18
+ - Stronger structure definition fields: `tooltipHover`, `spanTiles`, `linkedClearance`, spritesheet/ui render blocks
19
+ - Stronger `TechDefinition` fields used by tech nodes (`cost`, `unlocks`, `currencyType`, `branch`)
20
+ - JSDoc `@example` blocks on many Sandkit members (main, worker, and configs)
21
+ - Prebuilt Docsify search index (`docs/assets/search-index.js`) so API search works without a runtime crawl
22
+ - Nested namespace roots in the docs sidebar (`sandkit`, `sandkit.api`, worker, engine, react)
23
+
24
+ ### Changed
25
+
26
+ - Official `@see` links use a short “Official docs” label that deep-links to Sandkit HTML sections
27
+ - Docs search ranks full runtime paths (`sandkit.api.settings.get()`) instead of local member names only
28
+ - Move Full API reference to the bottom of the docs root nav block
29
+ - Drop the page TOC plugin and the nested `docs/api/_sidebar.md` in favor of one site sidebar
30
+
31
+ ## 0.3.1 - 2026-08-27
32
+
33
+ https://github.com/sandustry-modding/SandustryTypes/releases/tag/v0.3.1
34
+
35
+
36
+
37
+ ### Fixed
38
+
39
+ - Deep package imports such as `@sandustry-modding/types/sandkit/engine` (Node `exports` `*` matches one path segment; map file and `index.d.ts` targets under `src/`)
40
+ - Ship root `CHANGELOG.md` and `LICENSE` in the npm tarball
41
+ - Document ambient setup with `/// <reference types="@sandustry-modding/types" />` (do not list this package under `compilerOptions.types`)
42
+
43
+ ### Added
44
+
45
+ - `npm run validate` gate: declaration typecheck, unit tests, and packed-tarball consumer probes
46
+
47
+ ## 0.3.0 - 2026-08-27
48
+
49
+ https://github.com/sandustry-modding/SandustryTypes/releases/tag/v0.3.0
50
+
51
+ ### Changed
52
+
53
+ - Move declaration sources into `src/` (`src/sandkit`, `src/worker`, `src/shared`, `src/global.d.ts`). Package subpaths such as `@sandustry-modding/types/sandkit/engine` stay the same
54
+ - Show local names for API member headings in the Docsify reference (full runtime path stays under each heading)
55
+
56
+ ## 0.2.0 - 2026-08-27
57
+
58
+ https://github.com/sandustry-modding/SandustryTypes/releases/tag/v0.2.0
59
+
60
+ ### Added
61
+
62
+ - Official Sandkit API coverage from [sandustry.com/sandkit.html](https://sandustry.com/sandkit.html): `api.entities`, `api.pipes`, `api.factory`, `api.game`, `api.blueprints`, `api.pickups`, `api.grid.mutate`, and related worker surfaces
63
+ - JSDoc `@see` links back to the official Sandkit page on documented members
64
+
65
+ ### Changed
66
+
67
+ - Canonical mutation names match official docs (`createAtCell`, `grid.mutate`, `getTypeById`, and similar). Old names stay as `@deprecated` aliases (`*WhenIdle`, `api.world`, `getTypeFromId`, and similar)
68
+
69
+ ## 0.1.1 - 2026-08-27
70
+
71
+ https://github.com/sandustry-modding/SandustryTypes/releases/tag/v0.1.1
72
+
73
+ ### Changed
74
+
75
+ - Export subpaths (`./*`) so mods can import declaration modules such as `@sandustry-modding/types/sandkit/engine`
76
+
77
+ ## 0.1.0 - 2026-08-27
78
+
79
+ https://github.com/sandustry-modding/SandustryTypes/releases/tag/v0.1.0
80
+
81
+ ### Added
82
+
83
+ - Initial public release of `@sandustry-modding/types`
84
+ - TypeScript declarations for main-thread `sandkit` (`sandkit/api`, `sandkit/engine`, `sandkit/enums`, `sandkit/react`)
85
+ - Worker-thread declarations under `worker/` (`WorkerSandkitApi`)
86
+ - Shared base shapes under `shared/` for main and worker reuse
87
+ - Ambient `sandkit` free variable and type aliases via `global.d.ts`
88
+ - Docsify API reference generated from the declarations
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 sandustry-modding
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -19,6 +19,7 @@ Folder layout mirrors runtime shape so you can jump from code to the matching `.
19
19
  | `src/global.d.ts` | Ambient `sandkit` free variable and type aliases |
20
20
  | `src/worker/` | Worker-thread `sandkit.api` (see `WorkerSandkitApi`) |
21
21
  | `src/shared/` | Internal base shapes reused by main and worker declarations |
22
+ | `src/configs/` | `modinfo.json` / `patches.json` schemas (not a runtime object) |
22
23
 
23
24
  ## Runtime shape vs `export namespace`
24
25
 
@@ -37,36 +38,23 @@ Declaration files use `export namespace` because it is the usual `.d.ts` pattern
37
38
  npm install @sandustry-modding/types
38
39
  ```
39
40
 
40
- ### Project config (preferred)
41
+ ### Ambient types (preferred)
41
42
 
42
- Add the package to `compilerOptions.types` in `tsconfig.json` or `jsconfig.json`:
43
-
44
- ```json
45
- {
46
- "compilerOptions": {
47
- "types": ["@sandustry-modding/types"]
48
- }
49
- }
50
- ```
51
-
52
- If you already list other packages in `types` (for example `"react"` or `"node"`), keep those entries and add `"@sandustry-modding/types"` to the same array. A non-empty `types` list replaces TypeScript’s default auto-inclusion of all `@types/*` packages.
53
-
54
- `jsconfig.json` uses the same shape for JavaScript mods.
55
-
56
- ### Per-file reference
57
-
58
- You can also pull the ambient types into one file:
43
+ Pull the host `sandkit` ambient into your project with a triple-slash reference. Put it at the top of `main.js` / `worker.js`, or in a small ambient `.d.ts` that your `tsconfig` / `jsconfig` includes:
59
44
 
60
45
  ```ts
61
46
  /// <reference types="@sandustry-modding/types" />
62
47
  ```
63
48
 
64
- That triple-slash directive works in `.ts` and `.js` (including checked JS with `checkJs`). Put it at the top of `main.js` / `worker.js`, or in a small ambient `.d.ts` included by your project.
49
+ That works in `.ts` and `.js` (including checked JS with `checkJs`).
50
+
51
+ Do **not** list `@sandustry-modding/types` under `compilerOptions.types`. That list only loads packages from `node_modules/@types` (for example `"react"` or `"node"`).
65
52
 
66
53
  Deep declaration modules are also available, for example:
67
54
 
68
55
  ```ts
69
56
  import type { RetroConsoleGame } from "@sandustry-modding/types/sandkit/engine";
57
+ import type { ModInfo, BundlePatch } from "@sandustry-modding/types/configs";
70
58
  ```
71
59
 
72
60
  ## Usage
@@ -74,6 +62,7 @@ import type { RetroConsoleGame } from "@sandustry-modding/types/sandkit/engine";
74
62
  - **Main mod (`main.js`):** use the ambient free name `sandkit`. Type aliases such as `SandkitApi` are global; do not import a value binding.
75
63
  - **Worker mod (`worker.js`):** type `sandkit.api` as `WorkerSandkitApi`. Worker and main APIs overlap but are not interchangeable.
76
64
  - **Shared folder:** not a runtime namespace. It holds domain shapes and API bases that main and worker modules extend.
65
+ - **Configs folder:** `modinfo.json` and `patches.json` schemas (`@sandustry-modding/types/configs`). Not part of the live `sandkit` object.
77
66
 
78
67
  ## Maintaining types
79
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sandustry-modding/types",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "TypeScript declarations and API docs for the Sandustry Sandkit host API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,14 +17,70 @@
17
17
  "types": "./src/global.d.ts"
18
18
  },
19
19
  "./package.json": "./package.json",
20
- "./*": {
21
- "types": "./src/*"
20
+ "./sandkit": {
21
+ "types": "./src/sandkit/index.d.ts"
22
+ },
23
+ "./sandkit/*": {
24
+ "types": [
25
+ "./src/sandkit/*.d.ts",
26
+ "./src/sandkit/*/index.d.ts"
27
+ ]
28
+ },
29
+ "./sandkit/*/*": {
30
+ "types": [
31
+ "./src/sandkit/*/*.d.ts",
32
+ "./src/sandkit/*/*/index.d.ts"
33
+ ]
34
+ },
35
+ "./sandkit/*/*/*": {
36
+ "types": [
37
+ "./src/sandkit/*/*/*.d.ts",
38
+ "./src/sandkit/*/*/*/index.d.ts"
39
+ ]
40
+ },
41
+ "./shared": {
42
+ "types": "./src/shared/index.d.ts"
43
+ },
44
+ "./shared/*": {
45
+ "types": [
46
+ "./src/shared/*.d.ts",
47
+ "./src/shared/*/index.d.ts"
48
+ ]
49
+ },
50
+ "./shared/*/*": {
51
+ "types": [
52
+ "./src/shared/*/*.d.ts",
53
+ "./src/shared/*/*/index.d.ts"
54
+ ]
55
+ },
56
+ "./worker": {
57
+ "types": "./src/worker/index.d.ts"
58
+ },
59
+ "./worker/*": {
60
+ "types": [
61
+ "./src/worker/*.d.ts",
62
+ "./src/worker/*/index.d.ts"
63
+ ]
64
+ },
65
+ "./worker/*/*": {
66
+ "types": [
67
+ "./src/worker/*/*.d.ts",
68
+ "./src/worker/*/*/index.d.ts"
69
+ ]
70
+ },
71
+ "./configs": {
72
+ "types": "./src/configs/index.d.ts"
73
+ },
74
+ "./configs/*": {
75
+ "types": [
76
+ "./src/configs/*.d.ts",
77
+ "./src/configs/*/index.d.ts"
78
+ ]
22
79
  }
23
80
  },
24
81
  "files": [
25
82
  "src/**/*.d.ts",
26
83
  "CHANGELOG.md",
27
- "docs/Changelog.md",
28
84
  "LICENSE",
29
85
  "README.md"
30
86
  ],
@@ -33,7 +89,11 @@
33
89
  "docs:api": "node scripts/generate-api-docs.mjs",
34
90
  "docs:serve": "npx --yes docsify-cli serve docs",
35
91
  "test": "node --test scripts/api-search.test.js",
36
- "typecheck": "tsc -p tsconfig.json --noEmit"
92
+ "typecheck": "tsc -p tsconfig.json --noEmit",
93
+ "verify-package": "node scripts/verify-package.mjs",
94
+ "validate": "npm run typecheck && npm test && npm run verify-package",
95
+ "prepack": "npm run validate",
96
+ "release": "node scripts/publish.mjs"
37
97
  },
38
98
  "devDependencies": {
39
99
  "@types/react": "^18.3.1",
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Sandkit mod file schemas: `modinfo.json` and `patches.json`.
3
+ *
4
+ * These are not runtime `sandkit` properties. Import from
5
+ * `@sandustry-modding/types/configs` when typing mod folder config files.
6
+ *
7
+ * @module
8
+ *
9
+ * @see [Official docs](https://sandustry.com/sandkit.html#mod-files-heading)
10
+ */
11
+
12
+ export type {
13
+ ConfigSchemaBoolean,
14
+ ConfigSchemaChoice,
15
+ ConfigSchemaChoiceOption,
16
+ ConfigSchemaEntry,
17
+ ConfigSchemaNumber,
18
+ ModGameVersion,
19
+ ModInfo,
20
+ ModMapBlueprints,
21
+ ModMapColorMapping,
22
+ ModMapColorMappingLayers,
23
+ ModMapDefinition,
24
+ ModMapDepthLight,
25
+ ModMapParallax,
26
+ ModMapPoint,
27
+ ModMapTopBounds,
28
+ ModProvide,
29
+ TextureOverride,
30
+ } from "./modinfo";
31
+
32
+ export type {
33
+ BundlePatch,
34
+ BundlePatchRegex,
35
+ BundlePatchesFile,
36
+ PatchOperation,
37
+ PatchTargetFile,
38
+ } from "./patches";