isaacscript 3.15.3 → 3.16.1-dev.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 (215) hide show
  1. package/dist/checkForWindowsTerminalBugs.js +57 -0
  2. package/{src → dist}/classes/Config.js +1 -6
  3. package/dist/classes/ValidatedConfig.js +1 -0
  4. package/{src → dist}/commands/check/check.js +67 -64
  5. package/dist/commands/check/check.test.js +86 -0
  6. package/dist/commands/copy/copy.js +29 -0
  7. package/dist/commands/init/checkIfProjectPathExists.js +21 -0
  8. package/dist/commands/init/checkModSubdirectory.js +9 -0
  9. package/dist/commands/init/checkModTargetDirectory.js +24 -0
  10. package/dist/commands/init/createProject.js +199 -0
  11. package/dist/commands/init/getAuthorName.js +22 -0
  12. package/dist/commands/init/getModsDir.js +48 -0
  13. package/dist/commands/init/getProjectPath.js +84 -0
  14. package/dist/commands/init/init.js +73 -0
  15. package/dist/commands/init/installVSCodeExtensions.js +27 -0
  16. package/dist/commands/init/promptSaveSlot.js +17 -0
  17. package/{src → dist}/commands/init/promptVSCode.js +5 -10
  18. package/dist/commands/monitor/copyWatcherMod.js +31 -0
  19. package/dist/commands/monitor/modDirectorySyncer/modDirectorySyncer.js +44 -0
  20. package/dist/commands/monitor/monitor.js +154 -0
  21. package/{src → dist}/commands/monitor/notifyGame.js +14 -22
  22. package/{src → dist}/commands/monitor/saveDatWriter/saveDatWriter.js +24 -27
  23. package/dist/commands/monitor/saveDatWriter/types.js +1 -0
  24. package/dist/commands/monitor/spawnModDirectorySyncer.js +31 -0
  25. package/dist/commands/monitor/spawnSaveDatWriter.js +29 -0
  26. package/dist/commands/monitor/spawnTSTLWatcher.js +74 -0
  27. package/dist/commands/monitor/touchWatcherSaveDatFiles.js +15 -0
  28. package/dist/commands/publish/isaacscriptMod.js +90 -0
  29. package/dist/commands/publish/prePublish.js +105 -0
  30. package/dist/commands/publish/publish.js +39 -0
  31. package/dist/commands/publish/validate.js +46 -0
  32. package/dist/common.js +65 -0
  33. package/dist/configFile.js +54 -0
  34. package/dist/constants.js +61 -0
  35. package/dist/customStage.js +298 -0
  36. package/dist/dev.js +10 -0
  37. package/{src/enums → dist/enums/copied}/DoorSlot.js +5 -6
  38. package/dist/enums/copied/DoorSlotFlag.js +35 -0
  39. package/{src/enums → dist/enums/copied}/RoomShape.js +5 -6
  40. package/{src → dist}/exec.js +19 -28
  41. package/dist/git.js +133 -0
  42. package/dist/interfaces/GitHubCLIHostsYAML.js +1 -0
  43. package/dist/interfaces/IsaacScriptTSConfig.js +1 -0
  44. package/dist/interfaces/ShadersXML.js +1 -0
  45. package/dist/interfaces/copied/CustomStageTSConfig.js +4 -0
  46. package/dist/interfaces/copied/JSONRoomsFile.js +4 -0
  47. package/dist/main.js +132 -0
  48. package/dist/objects/copied/doorSlotToDoorSlotFlag.js +16 -0
  49. package/dist/objects/copied/roomShapeToDoorSlotCoordinates.js +112 -0
  50. package/dist/packageManager.js +68 -0
  51. package/{src → dist}/parseArgs.js +36 -15
  52. package/dist/prompt.js +79 -0
  53. package/dist/tsconfig.js +98 -0
  54. package/dist/types/Command.js +4 -0
  55. package/dist/utils.js +8 -0
  56. package/dist/validateInIsaacScriptProject.js +29 -0
  57. package/dist/validateNodeVersion.js +20 -0
  58. package/file-templates/dynamic/.github/workflows/setup/action.yml +21 -0
  59. package/file-templates/dynamic/.yarnrc.yml +1 -0
  60. package/file-templates/dynamic/README.mod.md +4 -3
  61. package/file-templates/dynamic/_gitignore +0 -2
  62. package/file-templates/dynamic/package.mod.json +8 -0
  63. package/file-templates/dynamic/package.ts.json +5 -1
  64. package/file-templates/{dynamic → static}/.github/workflows/ci.yml +10 -38
  65. package/file-templates/static/scripts/tsconfig.json +28 -0
  66. package/file-templates/static-mod/.vscode/settings.json +1 -1
  67. package/file-templates/static-mod/{_cspell.json → _cspell.jsonc} +2 -2
  68. package/file-templates/static-mod/_eslintrc.cjs +1 -1
  69. package/file-templates/static-mod/prettier.config.mjs +6 -1
  70. package/file-templates/static-mod/scripts/lint.ts +36 -0
  71. package/file-templates/static-mod/tsconfig.json +5 -5
  72. package/file-templates/static-ts/.vscode/settings.json +1 -1
  73. package/file-templates/static-ts/{_cspell.json → _cspell.jsonc} +5 -5
  74. package/file-templates/static-ts/_eslintrc.cjs +1 -1
  75. package/file-templates/static-ts/knip.jsonc +6 -0
  76. package/file-templates/static-ts/prettier.config.mjs +6 -1
  77. package/file-templates/static-ts/scripts/lint.ts +30 -0
  78. package/file-templates/static-ts/tsconfig.json +3 -3
  79. package/package.json +27 -9
  80. package/plugins/addCrashDebugStatements.cjs +56 -0
  81. package/plugins/addCrashDebugStatements.ts +39 -0
  82. package/{src/plugins/addIsaacScriptCommentHeader.js → plugins/addIsaacScriptCommentHeader.cjs} +1 -1
  83. package/plugins/addIsaacScriptCommentHeader.ts +42 -0
  84. package/{src/plugins/addIsaacScriptCommentHeaderCommon.js → plugins/addIsaacScriptCommentHeaderCommon.cjs} +6 -4
  85. package/plugins/addIsaacScriptCommentHeaderCommon.ts +59 -0
  86. package/{src/plugins/noExtendedEnums.js → plugins/noExtendedEnums.cjs} +25 -4
  87. package/plugins/noExtendedEnums.ts +83 -0
  88. package/plugins/tsconfig.json +28 -0
  89. package/schemas/tsconfig-isaacscript-section-schema.json +1 -0
  90. package/file-templates/static/nuke.sh +0 -53
  91. package/file-templates/static/update.sh +0 -26
  92. package/file-templates/static-mod/build.sh +0 -22
  93. package/file-templates/static-mod/lint.sh +0 -43
  94. package/file-templates/static-mod/publish.sh +0 -10
  95. package/file-templates/static-mod/run.sh +0 -10
  96. package/file-templates/static-ts/build.sh +0 -53
  97. package/file-templates/static-ts/lint.sh +0 -35
  98. package/file-templates/static-ts/publish.sh +0 -10
  99. package/file-templates/static-ts/run.sh +0 -42
  100. package/src/checkForWindowsTerminalBugs.js +0 -71
  101. package/src/checkForWindowsTerminalBugs.js.map +0 -1
  102. package/src/classes/Config.js.map +0 -1
  103. package/src/classes/ValidatedConfig.js +0 -3
  104. package/src/classes/ValidatedConfig.js.map +0 -1
  105. package/src/commands/check/check.js.map +0 -1
  106. package/src/commands/check/check.test.js +0 -87
  107. package/src/commands/check/check.test.js.map +0 -1
  108. package/src/commands/copy/copy.js +0 -38
  109. package/src/commands/copy/copy.js.map +0 -1
  110. package/src/commands/init/checkIfProjectPathExists.js +0 -28
  111. package/src/commands/init/checkIfProjectPathExists.js.map +0 -1
  112. package/src/commands/init/checkModSubdirectory.js +0 -16
  113. package/src/commands/init/checkModSubdirectory.js.map +0 -1
  114. package/src/commands/init/checkModTargetDirectory.js +0 -31
  115. package/src/commands/init/checkModTargetDirectory.js.map +0 -1
  116. package/src/commands/init/createProject.js +0 -215
  117. package/src/commands/init/createProject.js.map +0 -1
  118. package/src/commands/init/getAuthorName.js +0 -27
  119. package/src/commands/init/getAuthorName.js.map +0 -1
  120. package/src/commands/init/getModsDir.js +0 -58
  121. package/src/commands/init/getModsDir.js.map +0 -1
  122. package/src/commands/init/getProjectPath.js +0 -89
  123. package/src/commands/init/getProjectPath.js.map +0 -1
  124. package/src/commands/init/init.js +0 -78
  125. package/src/commands/init/init.js.map +0 -1
  126. package/src/commands/init/installVSCodeExtensions.js +0 -35
  127. package/src/commands/init/installVSCodeExtensions.js.map +0 -1
  128. package/src/commands/init/promptSaveSlot.js +0 -22
  129. package/src/commands/init/promptSaveSlot.js.map +0 -1
  130. package/src/commands/init/promptVSCode.js.map +0 -1
  131. package/src/commands/monitor/copyWatcherMod.js +0 -39
  132. package/src/commands/monitor/copyWatcherMod.js.map +0 -1
  133. package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js +0 -47
  134. package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js.map +0 -1
  135. package/src/commands/monitor/monitor.js +0 -263
  136. package/src/commands/monitor/monitor.js.map +0 -1
  137. package/src/commands/monitor/notifyGame.js.map +0 -1
  138. package/src/commands/monitor/saveDatWriter/saveDatWriter.js.map +0 -1
  139. package/src/commands/monitor/saveDatWriter/types.js +0 -3
  140. package/src/commands/monitor/saveDatWriter/types.js.map +0 -1
  141. package/src/commands/monitor/spawnSaveDatWriter.js +0 -35
  142. package/src/commands/monitor/spawnSaveDatWriter.js.map +0 -1
  143. package/src/commands/monitor/touchWatcherSaveDatFiles.js +0 -21
  144. package/src/commands/monitor/touchWatcherSaveDatFiles.js.map +0 -1
  145. package/src/commands/publish/isaacscriptMod.js +0 -97
  146. package/src/commands/publish/isaacscriptMod.js.map +0 -1
  147. package/src/commands/publish/prePublish.js +0 -120
  148. package/src/commands/publish/prePublish.js.map +0 -1
  149. package/src/commands/publish/publish.js +0 -42
  150. package/src/commands/publish/publish.js.map +0 -1
  151. package/src/commands/publish/validate.js +0 -58
  152. package/src/commands/publish/validate.js.map +0 -1
  153. package/src/common.js +0 -69
  154. package/src/common.js.map +0 -1
  155. package/src/configFile.js +0 -64
  156. package/src/configFile.js.map +0 -1
  157. package/src/constants.js +0 -65
  158. package/src/constants.js.map +0 -1
  159. package/src/customStage.js +0 -304
  160. package/src/customStage.js.map +0 -1
  161. package/src/dev.js +0 -19
  162. package/src/dev.js.map +0 -1
  163. package/src/enums/DoorSlot.js.map +0 -1
  164. package/src/enums/DoorSlotFlag.js +0 -37
  165. package/src/enums/DoorSlotFlag.js.map +0 -1
  166. package/src/enums/PackageManager.js +0 -10
  167. package/src/enums/PackageManager.js.map +0 -1
  168. package/src/enums/RoomShape.js.map +0 -1
  169. package/src/exec.js.map +0 -1
  170. package/src/file.js +0 -247
  171. package/src/file.js.map +0 -1
  172. package/src/git.js +0 -154
  173. package/src/git.js.map +0 -1
  174. package/src/interfaces/GitHubCLIHostsYAML.js +0 -3
  175. package/src/interfaces/GitHubCLIHostsYAML.js.map +0 -1
  176. package/src/interfaces/IsaacScriptTSConfig.js +0 -3
  177. package/src/interfaces/IsaacScriptTSConfig.js.map +0 -1
  178. package/src/interfaces/ShadersXML.js +0 -3
  179. package/src/interfaces/ShadersXML.js.map +0 -1
  180. package/src/interfaces/copied/CustomStageTSConfig.js +0 -4
  181. package/src/interfaces/copied/CustomStageTSConfig.js.map +0 -1
  182. package/src/interfaces/copied/JSONRoomsFile.js +0 -4
  183. package/src/interfaces/copied/JSONRoomsFile.js.map +0 -1
  184. package/src/isaacScriptCommonTS.js +0 -233
  185. package/src/isaacScriptCommonTS.js.map +0 -1
  186. package/src/json.js +0 -42
  187. package/src/json.js.map +0 -1
  188. package/src/main.js +0 -127
  189. package/src/main.js.map +0 -1
  190. package/src/objects/doorSlotToDoorSlotFlag.js +0 -17
  191. package/src/objects/doorSlotToDoorSlotFlag.js.map +0 -1
  192. package/src/objects/roomShapeDoorToSlotCoordinates.js +0 -115
  193. package/src/objects/roomShapeDoorToSlotCoordinates.js.map +0 -1
  194. package/src/packageManager.js +0 -153
  195. package/src/packageManager.js.map +0 -1
  196. package/src/parseArgs.js.map +0 -1
  197. package/src/plugins/addCrashDebugStatements.js +0 -32
  198. package/src/plugins/addCrashDebugStatements.js.map +0 -1
  199. package/src/plugins/addIsaacScriptCommentHeader.js.map +0 -1
  200. package/src/plugins/addIsaacScriptCommentHeaderCommon.js.map +0 -1
  201. package/src/plugins/noExtendedEnums.js.map +0 -1
  202. package/src/prompt.js +0 -87
  203. package/src/prompt.js.map +0 -1
  204. package/src/tsconfig.js +0 -103
  205. package/src/tsconfig.js.map +0 -1
  206. package/src/types/Command.js +0 -9
  207. package/src/types/Command.js.map +0 -1
  208. package/src/utils.js +0 -15
  209. package/src/utils.js.map +0 -1
  210. package/src/validateInIsaacScriptProject.js +0 -36
  211. package/src/validateInIsaacScriptProject.js.map +0 -1
  212. package/src/validateNodeVersion.js +0 -29
  213. package/src/validateNodeVersion.js.map +0 -1
  214. package/src/version.js +0 -20
  215. package/src/version.js.map +0 -1
@@ -4,7 +4,7 @@
4
4
  "$schema": "https://raw.githubusercontent.com/IsaacScript/isaacscript/main/packages/isaacscript-cli/schemas/tsconfig-isaacscript-schema.json",
5
5
 
6
6
  // We extend the standard IsaacScript config:
7
- // https://github.com/IsaacScript/isaacscript/blob/main/packages/isaacscript-tsconfig/configs/tsconfig.mod.json
7
+ // https://github.com/IsaacScript/isaacscript/blob/main/packages/isaacscript-tsconfig/tsconfig.mod.json
8
8
  "extends": "isaacscript-tsconfig/tsconfig.mod.json",
9
9
 
10
10
  // A list of the TypeScript files to compile.
@@ -17,16 +17,16 @@
17
17
  "luaBundleEntry": "./src/bundleEntry.ts",
18
18
  "luaPlugins": [
19
19
  // A plugin to add an explanatory comment at the top of the compiled "main.lua" file.
20
- { "name": "isaacscript/src/plugins/addIsaacScriptCommentHeader.js" },
20
+ { "name": "isaacscript/plugins/addIsaacScriptCommentHeader.cjs" },
21
21
 
22
22
  // A plugin to make enums safe from global variables.
23
- { "name": "isaacscript/src/plugins/noExtendedEnums.js" },
23
+ { "name": "isaacscript/plugins/noExtendedEnums.cjs" },
24
24
 
25
25
  // Uncomment this and recompile the mod to enable crash debugging, which will tell you the
26
26
  // exact line of the mod that is causing the crash. For more information, read the comment at
27
27
  // the top of the file:
28
- // https://github.com/IsaacScript/isaacscript/blob/main/packages/isaacscript-cli/src/plugins/addCrashDebugStatements.ts
29
- // { "name": "isaacscript/src/plugins/addCrashDebugStatements.js" },
28
+ // https://github.com/IsaacScript/isaacscript/blob/main/packages/isaacscript-cli/plugins/addCrashDebugStatements.ts
29
+ // { "name": "isaacscript/plugins/addCrashDebugStatements.cjs" },
30
30
  ],
31
31
  "noHeader": true,
32
32
  "noImplicitGlobalVariables": true,
@@ -34,7 +34,7 @@
34
34
  // Extension settings
35
35
  // ------------------
36
36
 
37
- // Use Prettier to format "cspell.json".
37
+ // Use Prettier to format "cspell.jsonc".
38
38
  "cSpell.autoFormatConfigFile": true,
39
39
 
40
40
  // -----------------
@@ -13,17 +13,17 @@
13
13
  "node_modules/**",
14
14
  "package-lock.json",
15
15
  "pnpm-lock.yaml",
16
- "yarn.lock"
16
+ "yarn.lock",
17
17
  ],
18
18
  "words": [
19
19
  "autocrlf",
20
20
  "dbaeumer",
21
21
  "esbenp",
22
22
  "isaacscript",
23
- "loglevel",
24
- "pnpm",
23
+ "knip",
24
+ "packagejson",
25
25
  "sarisia",
26
26
  "technote",
27
- "Zamiell"
28
- ]
27
+ "Zamiell",
28
+ ],
29
29
  }
@@ -5,7 +5,7 @@
5
5
  const config = {
6
6
  extends: [
7
7
  // The linter base is the shared IsaacScript config:
8
- // https://github.com/IsaacScript/isaacscript/blob/main/packages/eslint-config-isaacscript/configs/base.js
8
+ // https://github.com/IsaacScript/isaacscript/blob/main/packages/eslint-config-isaacscript/base.js
9
9
  "eslint-config-isaacscript/base",
10
10
  ],
11
11
 
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://unpkg.com/knip/schema.json",
3
+ "eslint": true,
4
+ "prettier": true,
5
+ "ignoreDependencies": ["isaacscript", "isaacscript-lint"],
6
+ }
@@ -9,7 +9,12 @@ const config = {
9
9
  // Allow proper formatting of JSONC files:
10
10
  // https://github.com/prettier/prettier/issues/5708
11
11
  {
12
- files: ["**/.vscode/*.json", "**/tsconfig.json", "**/tsconfig.*.json"],
12
+ files: [
13
+ "**/*.jsonc",
14
+ "**/.vscode/*.json",
15
+ "**/tsconfig.json",
16
+ "**/tsconfig.*.json",
17
+ ],
13
18
  options: {
14
19
  parser: "json5",
15
20
  quoteProps: "preserve",
@@ -0,0 +1,30 @@
1
+ import { $, lintScript } from "isaacscript-common-node";
2
+
3
+ await lintScript(async () => {
4
+ const promises: Array<Promise<unknown>> = [];
5
+
6
+ promises.push(
7
+ // Use Prettier to check formatting.
8
+ // - "--log-level=warn" makes it only output errors.
9
+ $`npx prettier --log-level=warn --check .`,
10
+
11
+ // Type-check the code using the TypeScript compiler.
12
+ $`tsc --noEmit`,
13
+
14
+ // Use ESLint to lint the TypeScript.
15
+ // - "--max-warnings 0" makes warnings fail, since we set all ESLint errors to warnings.
16
+ $`eslint --max-warnings 0 .`,
17
+
18
+ // Check for unused files, dependencies, and exports.
19
+ $`npx knip`,
20
+
21
+ // Spell check every file using CSpell.
22
+ // - "--no-progress" and "--no-summary" make it only output errors.
23
+ $`npx cspell --no-progress --no-summary .`,
24
+
25
+ // Check for unused CSpell words.
26
+ $`npx cspell-check-unused-words`,
27
+ );
28
+
29
+ await Promise.all(promises);
30
+ });
@@ -1,12 +1,12 @@
1
1
  // The configuration file for TypeScript.
2
2
  {
3
- // We extend the standard IsaacScript config:
4
- // https://github.com/IsaacScript/isaacscript/blob/main/packages/isaacscript-tsconfig/configs/tsconfig.node.json
3
+ // We extend the IsaacScript config for Node.js:
4
+ // https://github.com/IsaacScript/isaacscript/blob/main/packages/isaacscript-tsconfig/tsconfig.node.json
5
5
  "extends": "isaacscript-tsconfig/tsconfig.node.json",
6
6
 
7
7
  // https://www.typescriptlang.org/docs/handbook/compiler-options.html
8
8
  "compilerOptions": {
9
- "outDir": "./dist",
9
+ "outDir": "dist",
10
10
  },
11
11
 
12
12
  // A list of the TypeScript files to compile.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript",
3
- "version": "3.15.3",
3
+ "version": "3.16.1-dev.0",
4
4
  "description": "A command line tool for managing Isaac mods written in TypeScript.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -21,26 +21,44 @@
21
21
  },
22
22
  "license": "GPL-3.0",
23
23
  "author": "Zamiell",
24
- "type": "commonjs",
24
+ "type": "module",
25
25
  "bin": {
26
- "isaacscript": "./src/main.js"
26
+ "isaacscript": "./dist/main.js"
27
+ },
28
+ "files": [
29
+ "custom-stage",
30
+ "dist",
31
+ "file-templates",
32
+ "isaacscript-watcher",
33
+ "plugins",
34
+ "schemas",
35
+ "LICENSE",
36
+ "package.json",
37
+ "README.md"
38
+ ],
39
+ "scripts": {
40
+ "build": "tsx ./scripts/build.ts",
41
+ "lint": "tsx ./scripts/lint.ts",
42
+ "run": "tsx ./src/main.ts",
43
+ "test": "glob \"./src/**/*.test.ts\" --cmd=\"node --import tsx --test --test-reporter spec\""
27
44
  },
28
45
  "dependencies": {
46
+ "@zamiell/sync-directory": "^6.0.5",
29
47
  "ajv": "^8.12.0",
30
- "chalk": "4.1.2",
48
+ "chalk": "^5.3.0",
31
49
  "command-exists": "^1.2.9",
32
50
  "figlet": "^1.7.0",
51
+ "isaacscript-common-node": "^1.0.6",
52
+ "isaacscript-common-ts": "^11.3.1",
33
53
  "jsonc-parser": "^3.2.0",
34
54
  "klaw-sync": "^6.0.0",
35
55
  "moment": "^2.29.4",
36
- "npm-check-updates": "^16.14.6",
37
56
  "prompt": "^1.3.0",
38
57
  "source-map-support": "^0.5.21",
39
- "sync-directory": "^6.0.4",
40
- "tslib": "^2.6.2",
41
- "typescript-to-lua": "^1.20.1",
58
+ "tsx": "^3.14.0",
59
+ "typescript-to-lua": "^1.21.0",
42
60
  "xml2js": "^0.6.2",
43
- "yaml": "^2.3.3",
61
+ "yaml": "^2.3.4",
44
62
  "yargs": "^17.7.2"
45
63
  },
46
64
  "peerDependencies": {
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /**
3
+ * When you write code that causes the game to crash, it can be difficult to find the exact line of
4
+ * code that is causing the crash.
5
+ *
6
+ * In these situations, you can enable this plugin, which will add a log statement in between every
7
+ * line of Lua code with a randomly-generated UUID. That way, you can cause the crash, and then look
8
+ * at the bottom of the "log.txt" for the final UUID that shows up.
9
+ *
10
+ * Next, you can Ctrl + f in the "main.lua" file for the matching UUID, which will bring you to the
11
+ * exact point in the code where the crash happened.
12
+ */
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ const node_crypto_1 = __importDefault(require("node:crypto"));
41
+ const tstl = __importStar(require("typescript-to-lua"));
42
+ class CustomPrinter extends tstl.LuaPrinter {
43
+ printStatement(statement) {
44
+ const uuid = node_crypto_1.default.randomUUID();
45
+ const debugLineToInsert = `Isaac.DebugString("CRASH DEBUG ${uuid}")\n`;
46
+ const originalResult = super.printStatement(statement);
47
+ return this.createSourceNode(statement, [
48
+ debugLineToInsert,
49
+ originalResult,
50
+ ]);
51
+ }
52
+ }
53
+ const plugin = {
54
+ printer: (program, emitHost, fileName, file) => new CustomPrinter(emitHost, program, fileName).print(file),
55
+ };
56
+ exports.default = plugin;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * When you write code that causes the game to crash, it can be difficult to find the exact line of
3
+ * code that is causing the crash.
4
+ *
5
+ * In these situations, you can enable this plugin, which will add a log statement in between every
6
+ * line of Lua code with a randomly-generated UUID. That way, you can cause the crash, and then look
7
+ * at the bottom of the "log.txt" for the final UUID that shows up.
8
+ *
9
+ * Next, you can Ctrl + f in the "main.lua" file for the matching UUID, which will bring you to the
10
+ * exact point in the code where the crash happened.
11
+ */
12
+
13
+ import crypto from "node:crypto";
14
+ import type { SourceNode } from "source-map";
15
+ import type * as ts from "typescript";
16
+ import * as tstl from "typescript-to-lua";
17
+
18
+ class CustomPrinter extends tstl.LuaPrinter {
19
+ override printStatement(statement: tstl.Statement): SourceNode {
20
+ const uuid = crypto.randomUUID();
21
+ const debugLineToInsert = `Isaac.DebugString("CRASH DEBUG ${uuid}")\n`;
22
+ const originalResult = super.printStatement(statement);
23
+ return this.createSourceNode(statement, [
24
+ debugLineToInsert,
25
+ originalResult,
26
+ ]);
27
+ }
28
+ }
29
+
30
+ const plugin: tstl.Plugin = {
31
+ printer: (
32
+ program: ts.Program,
33
+ emitHost: tstl.EmitHost,
34
+ fileName: string,
35
+ file: tstl.File,
36
+ ) => new CustomPrinter(emitHost, program, fileName).print(file),
37
+ };
38
+
39
+ export default plugin;
@@ -20,6 +20,7 @@ see the official website: https://isaacscript.github.io/
20
20
  --]]
21
21
 
22
22
  ---@diagnostic disable
23
+ -- cspell:disable
23
24
 
24
25
  `;
25
26
  const plugin = {
@@ -30,4 +31,3 @@ const plugin = {
30
31
  },
31
32
  };
32
33
  exports.default = plugin;
33
- //# sourceMappingURL=addIsaacScriptCommentHeader.js.map
@@ -0,0 +1,42 @@
1
+ /** This plugin adds an explanatory header to the top of the generated Lua code. */
2
+
3
+ import type * as ts from "typescript";
4
+ import type * as tstl from "typescript-to-lua";
5
+
6
+ const INFORMATIONAL_HEADER = `--[[
7
+
8
+ This Isaac mod was created with the IsaacScript tool.
9
+
10
+ DO NOT EDIT THIS FILE DIRECTLY!
11
+
12
+ The Lua code in this file is not actually the source code for the program. Rather, it was
13
+ automatically generated from higher-level TypeScript code, and might be hard to read. If you want to
14
+ understand how the code in this mod works, you should read the actual TypeScript source code
15
+ directly instead of trying to read this file. Usually, the link to the source code can be found in
16
+ the mod's description on the Steam Workshop. If not, you can ask the mod author directly if the
17
+ source code is publicly available.
18
+
19
+ IsaacScript provides a lot of advantages over using raw Lua. For more information about the tool,
20
+ see the official website: https://isaacscript.github.io/
21
+
22
+ --]]
23
+
24
+ ---@diagnostic disable
25
+ -- cspell:disable
26
+
27
+ `;
28
+
29
+ const plugin: tstl.Plugin = {
30
+ beforeEmit(
31
+ _program: ts.Program,
32
+ _options: tstl.CompilerOptions,
33
+ _emitHost: tstl.EmitHost,
34
+ result: tstl.EmitFile[],
35
+ ) {
36
+ for (const file of result) {
37
+ file.code = INFORMATIONAL_HEADER + file.code;
38
+ }
39
+ },
40
+ };
41
+
42
+ export default plugin;
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  /** This plugin adds an explanatory header to the top of the generated Lua code. */
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
3
6
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const tslib_1 = require("tslib");
5
- const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
6
- const node_path_1 = tslib_1.__importDefault(require("node:path"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
7
9
  const cwd = process.cwd();
8
10
  const packageJSONPath = node_path_1.default.join(cwd, "package.json");
9
11
  const packageJSONContents = node_fs_1.default.readFileSync(packageJSONPath, "utf8");
@@ -37,6 +39,7 @@ information about using TypeScript, see the website: https://isaacscript.github.
37
39
  --]]
38
40
 
39
41
  ---@diagnostic disable
42
+ -- cspell:disable
40
43
 
41
44
  `;
42
45
  const plugin = {
@@ -47,4 +50,3 @@ const plugin = {
47
50
  },
48
51
  };
49
52
  exports.default = plugin;
50
- //# sourceMappingURL=addIsaacScriptCommentHeaderCommon.js.map
@@ -0,0 +1,59 @@
1
+ /** This plugin adds an explanatory header to the top of the generated Lua code. */
2
+
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import type * as ts from "typescript";
6
+ import type * as tstl from "typescript-to-lua";
7
+
8
+ const cwd = process.cwd();
9
+ const packageJSONPath = path.join(cwd, "package.json");
10
+ const packageJSONContents = fs.readFileSync(packageJSONPath, "utf8");
11
+ const packageJSON = JSON.parse(packageJSONContents) as Record<string, unknown>;
12
+ const { version } = packageJSON;
13
+
14
+ const INFORMATIONAL_HEADER = `--[[
15
+
16
+ isaacscript-common ${version}
17
+
18
+ This is the "isaacscript-common" library, which was created with the IsaacScript tool.
19
+
20
+ This library contains helper functions and features that abstract away much of the complexity in
21
+ working with the Isaac API. For more information on how to use this library, see the manual:
22
+ https://isaacscript.github.io/main/isaacscript-in-lua
23
+
24
+ DO NOT EDIT THIS FILE DIRECTLY!
25
+
26
+ The Lua code in this file is not actually the source code for the program. Rather, it was
27
+ automatically generated from higher-level TypeScript code, and might be hard to read. If you want to
28
+ understand how the code in this library works, you should read the actual TypeScript source code
29
+ directly, which is located at:
30
+ https://github.com/IsaacScript/isaacscript/tree/main/packages/isaacscript-common
31
+
32
+ Please open bug reports and pull requests on GitHub. You can also ask questions in the Discord
33
+ server: https://discord.gg/KapmKQ2gUD
34
+
35
+ Note that if you are writing your mod in TypeScript, using this file is unnecessary, as every
36
+ "isaacscript-common" feature will be automatically bundled with your mod as needed. For more
37
+ information about using TypeScript, see the website: https://isaacscript.github.io/main/features
38
+
39
+ --]]
40
+
41
+ ---@diagnostic disable
42
+ -- cspell:disable
43
+
44
+ `;
45
+
46
+ const plugin: tstl.Plugin = {
47
+ beforeEmit(
48
+ _program: ts.Program,
49
+ _options: tstl.CompilerOptions,
50
+ _emitHost: tstl.EmitHost,
51
+ result: tstl.EmitFile[],
52
+ ) {
53
+ for (const file of result) {
54
+ file.code = INFORMATIONAL_HEADER + file.code;
55
+ }
56
+ },
57
+ };
58
+
59
+ export default plugin;
@@ -40,10 +40,32 @@
40
40
  * Unfortunately, this design decision means that local enums will essentially turn into global
41
41
  * variables. This plugin removes this behavior, always making enums local variables.
42
42
  */
43
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
44
+ if (k2 === undefined) k2 = k;
45
+ var desc = Object.getOwnPropertyDescriptor(m, k);
46
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
47
+ desc = { enumerable: true, get: function() { return m[k]; } };
48
+ }
49
+ Object.defineProperty(o, k2, desc);
50
+ }) : (function(o, m, k, k2) {
51
+ if (k2 === undefined) k2 = k;
52
+ o[k2] = m[k];
53
+ }));
54
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
55
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
56
+ }) : function(o, v) {
57
+ o["default"] = v;
58
+ });
59
+ var __importStar = (this && this.__importStar) || function (mod) {
60
+ if (mod && mod.__esModule) return mod;
61
+ var result = {};
62
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
63
+ __setModuleDefault(result, mod);
64
+ return result;
65
+ };
43
66
  Object.defineProperty(exports, "__esModule", { value: true });
44
- const tslib_1 = require("tslib");
45
- const ts = tslib_1.__importStar(require("typescript"));
46
- const tstl = tslib_1.__importStar(require("typescript-to-lua"));
67
+ const ts = __importStar(require("typescript"));
68
+ const tstl = __importStar(require("typescript-to-lua"));
47
69
  const plugin = {
48
70
  visitors: {
49
71
  [ts.SyntaxKind.EnumDeclaration]: (node, context) => {
@@ -73,4 +95,3 @@ const plugin = {
73
95
  },
74
96
  };
75
97
  exports.default = plugin;
76
- //# sourceMappingURL=noExtendedEnums.js.map
@@ -0,0 +1,83 @@
1
+ /**
2
+ * This plugin prevents transpiled enums from using global variables as a base (if present).
3
+ *
4
+ * For example, by default, the following enum:
5
+ *
6
+ * ```ts
7
+ * export enum Foo {
8
+ * Value1,
9
+ * Value2,
10
+ * }
11
+ * ```
12
+ *
13
+ * Will be transpiled to this:
14
+ *
15
+ * ```lua
16
+ * local ____exports = {}
17
+ * ____exports.Foo = Foo or ({})
18
+ * ____exports.Foo.Value1 = 0
19
+ * ____exports.Foo[____exports.Foo.Value1] = "Value1"
20
+ * ____exports.Foo.Value2 = 1
21
+ * ____exports.Foo[____exports.Foo.Value2] = "Value2"
22
+ * return ____exports
23
+ * ```
24
+ *
25
+ * As we can see, the first line uses the existing global variable of "Foo" as a base, if present.
26
+ * The reason it does this is because TSTL needs to support the TypeScript feature of combining
27
+ * enums, like this:
28
+ *
29
+ * ```ts
30
+ * enum Foo {
31
+ * Value1,
32
+ * }
33
+ *
34
+ * enum Foo {
35
+ * Value2,
36
+ * }
37
+ * ```
38
+ *
39
+ * Unfortunately, this design decision means that local enums will essentially turn into global
40
+ * variables. This plugin removes this behavior, always making enums local variables.
41
+ */
42
+
43
+ import * as ts from "typescript";
44
+ import * as tstl from "typescript-to-lua";
45
+
46
+ const plugin: tstl.Plugin = {
47
+ visitors: {
48
+ [ts.SyntaxKind.EnumDeclaration]: (node, context) => {
49
+ // Call the normal TSTL enum transpilation method.
50
+ const statements = context.superTransformStatements(node);
51
+
52
+ // Get the first element, which will be equal to something like:
53
+
54
+ // ```lua
55
+ // local Foo = Foo or ({})
56
+ // ```
57
+
58
+ // Or, if exported:
59
+
60
+ // ```lua
61
+ // local ____exports.Foo = Foo or ({})
62
+ // ```
63
+ const oldDeclaration = statements[0];
64
+ if (
65
+ oldDeclaration !== undefined &&
66
+ (tstl.isAssignmentStatement(oldDeclaration) ||
67
+ tstl.isVariableDeclarationStatement(oldDeclaration))
68
+ ) {
69
+ // Replace the right side of the assignment with a blank Lua table, e.g.
70
+
71
+ // ```lua
72
+ // local ____exports.Foo = {}
73
+ // ```
74
+ const blankTable = tstl.createTableExpression();
75
+ oldDeclaration.right = [blankTable];
76
+ }
77
+
78
+ return statements;
79
+ },
80
+ },
81
+ };
82
+
83
+ export default plugin;
@@ -0,0 +1,28 @@
1
+ {
2
+ "extends": "../../isaacscript-tsconfig/tsconfig.node.json",
3
+
4
+ "compilerOptions": {
5
+ // Plugins need to be in CJS format so that CJS mods can use them.
6
+ "module": "CommonJS",
7
+ "moduleResolution": "Node10",
8
+ },
9
+
10
+ "include": [
11
+ "./**/*.js",
12
+ "./**/.*.js",
13
+ "./**/*.cjs",
14
+ "./**/.*.cjs",
15
+ "./**/*.mjs",
16
+ "./**/.*.mjs",
17
+ "./**/*.jsx",
18
+ "./**/.*.jsx",
19
+ "./**/*.ts",
20
+ "./**/.*.ts",
21
+ "./**/*.cts",
22
+ "./**/.*.cts",
23
+ "./**/*.mts",
24
+ "./**/.*.mts",
25
+ "./**/*.tsx",
26
+ "./**/.*.tsx",
27
+ ],
28
+ }
@@ -82,6 +82,7 @@
82
82
  },
83
83
  "CustomStageTSConfig": {
84
84
  "additionalProperties": false,
85
+ "description": "This is the format of a custom stage in the \"isaacscript\" section of the \"tsconfig.json\" file.\n\nThe contents of this interface are used to create a \"tsconfig-isaacscript-section-schema.json\" schema with the \"ts-json-schema-generator\" library.\n\nThe contents of this interface are validated at run-time against the schema.\n\nThe `CustomStageLua` interface extends this, adding room metadata.",
85
86
  "properties": {
86
87
  "backdropPNGPaths": {
87
88
  "additionalProperties": false,
@@ -1,53 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -euo pipefail # Exit on errors and undefined variables.
4
-
5
- # Get the directory of this script:
6
- # https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
7
- DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
8
-
9
- NPM_LOCK="$DIR/package-lock.json"
10
- NPM_LOCK_EXISTS=""
11
- if [[ -f "$NPM_LOCK" ]]; then
12
- NPM_LOCK_EXISTS="1"
13
- rm -f "$NPM_LOCK"
14
- echo "Successfully deleted: $NPM_LOCK"
15
- fi
16
-
17
- YARN_LOCK="$DIR/yarn.lock"
18
- YARN_LOCK_EXISTS=""
19
- if [[ -f "$YARN_LOCK" ]]; then
20
- YARN_LOCK_EXISTS="1"
21
- rm -f "$YARN_LOCK"
22
- echo "Successfully deleted: $YARN_LOCK"
23
- fi
24
-
25
- PNPM_LOCK="$DIR/pnpm-lock.yaml"
26
- PNPM_LOCK_EXISTS=""
27
- if [[ -f "$PNPM_LOCK" ]]; then
28
- PNPM_LOCK_EXISTS="1"
29
- rm -f "$PNPM_LOCK"
30
- echo "Successfully deleted: $PNPM_LOCK"
31
- fi
32
-
33
- NODE_MODULES="$DIR/node_modules"
34
- if [[ -d "$NODE_MODULES" ]]; then
35
- rm -rf "$NODE_MODULES"
36
- echo "Successfully deleted: $NODE_MODULES"
37
- fi
38
-
39
- if [[ -z "$NPM_LOCK_EXISTS" && -z "$YARN_LOCK_EXISTS" && -z "$PNPM_LOCK_EXISTS" ]]; then
40
- echo "No package manager lock files were found. You should manually invoke the package manager that you want to use for this project. e.g. \"npm install\""
41
- exit 1
42
- elif [[ -n "$NPM_LOCK_EXISTS" && -z "$YARN_LOCK_EXISTS" && -z "$PNPM_LOCK_EXISTS" ]]; then
43
- npm install
44
- elif [[ -z "$NPM_LOCK_EXISTS" && -n "$YARN_LOCK_EXISTS" && -z "$PNPM_LOCK_EXISTS" ]]; then
45
- yarn install
46
- elif [[ -z "$NPM_LOCK_EXISTS" && -z "$YARN_LOCK_EXISTS" && -n "$PNPM_LOCK_EXISTS" ]]; then
47
- pnpm install
48
- else
49
- echo "Error: Multiple different kinds of package manager lock files were found. You should delete the ones that you are not using so that this program can correctly detect your package manager."
50
- exit 1
51
- fi
52
-
53
- echo "Successfully reinstalled Node dependencies."