hackmud-script-manager 0.21.1-6d6aa5b → 0.21.1-6eb310a

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/bin/hsm.js CHANGED
@@ -64,7 +64,7 @@ if (process.version.startsWith("v21.")) {
64
64
  )
65
65
  }
66
66
  if ("v" == commands[0] || "version" == commands[0] || popOption("version", "v")?.value) {
67
- console.log("0.21.1-6d6aa5b")
67
+ console.log("0.21.1-6eb310a")
68
68
  process.exit()
69
69
  }
70
70
  let warnedDeprecatedEmitDtsAlias = !1
@@ -412,7 +412,7 @@ function logHelp() {
412
412
  default:
413
413
  console.log(
414
414
  colourS(
415
- `${colourJ("Hackmud Script Manager")}\n${colourN("Version") + colourS(": ") + colourV("0.21.1-6d6aa5b")}\n\n${colourA("Commands:")}\n${colourL("push")}\n ${pushCommandDescription}\n${colourL("minify")}\n Minify a script file on the spot\n${colourL("emit-dts")}\n Generate a type declaration file for a directory of scripts\n${colourL("sync-macros")}\n Sync macros across all hackmud users\n${colourL("pull")}\n Pull a script a from a hackmud user's script directory\n\n${colourA("Options:")}\n${colourN("--help")}\n Can be used on any command e.g. ${colourC("hsm")} ${colourL("push")} ${colourN("--help")} to show helpful information`
415
+ `${colourJ("Hackmud Script Manager")}\n${colourN("Version") + colourS(": ") + colourV("0.21.1-6eb310a")}\n\n${colourA("Commands:")}\n${colourL("push")}\n ${pushCommandDescription}\n${colourL("minify")}\n Minify a script file on the spot\n${colourL("emit-dts")}\n Generate a type declaration file for a directory of scripts\n${colourL("sync-macros")}\n Sync macros across all hackmud users\n${colourL("pull")}\n Pull a script a from a hackmud user's script directory\n\n${colourA("Options:")}\n${colourN("--help")}\n Can be used on any command e.g. ${colourC("hsm")} ${colourL("push")} ${colourN("--help")} to show helpful information`
416
416
  )
417
417
  )
418
418
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hackmud-script-manager",
3
- "version": "0.21.1-6d6aa5b",
3
+ "version": "0.21.1-6eb310a",
4
4
  "description": "Script manager for game hackmud, with minification, TypeScript support, and player script type definition generation.",
5
5
  "keywords": [
6
6
  "api",
@@ -24,7 +24,8 @@
24
24
  "contributors": [
25
25
  "Daniel Swann (https://github.com/danswann)",
26
26
  "Longboyy",
27
- "Helloman892"
27
+ "Helloman892",
28
+ "Sarah Klocke (https://sarahisweird.dev/)"
28
29
  ],
29
30
  "main": "index.js",
30
31
  "repository": {
@@ -23,7 +23,7 @@ import rollupPluginCommonJS from "@rollup/plugin-commonjs"
23
23
  import rollupPluginJSON from "@rollup/plugin-json"
24
24
  import rollupPluginNodeResolve from "@rollup/plugin-node-resolve"
25
25
  import { assert } from "@samual/lib/assert"
26
- import { relative } from "path"
26
+ import { relative, isAbsolute, sep } from "path"
27
27
  import prettier from "prettier"
28
28
  import { rollup } from "rollup"
29
29
  import { supportedExtensions } from "../constants.js"
@@ -210,7 +210,7 @@ async function processScript(
210
210
  {
211
211
  name: "hackmud-script-manager",
212
212
  async transform(code, id) {
213
- if (id.startsWith("/") && !id.includes("/node_modules/"))
213
+ if (isAbsolute(id) && !id.includes(`${sep}node_modules${sep}`))
214
214
  return (await preprocess(code, { uniqueId })).code
215
215
  let program
216
216
  traverse(parse(code, { sourceType: "module" }), {
@@ -595,7 +595,9 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
595
595
  thisIsReferenced = !0
596
596
  path.replaceWith(t.identifier(`_${uniqueId}_THIS_`))
597
597
  },
598
- Function: path => path.skip()
598
+ Function(path) {
599
+ "ArrowFunctionExpression" != path.node.type && path.skip()
600
+ }
599
601
  },
600
602
  scope
601
603
  )
@@ -682,23 +684,23 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
682
684
  }
683
685
  function processFakeSubscriptObject(fakeSubscriptObjectName, seclevel) {
684
686
  for (const referencePath of getReferencePathsToGlobal(fakeSubscriptObjectName, program)) {
685
- assert("MemberExpression" == referencePath.parent.type, "src/processScript/transform.ts:807:60")
687
+ assert("MemberExpression" == referencePath.parent.type, "src/processScript/transform.ts:811:60")
686
688
  assert("Identifier" == referencePath.parent.property.type)
687
689
  assert(
688
690
  "MemberExpression" == referencePath.parentPath.parentPath?.node.type,
689
- "src/processScript/transform.ts:809:81"
691
+ "src/processScript/transform.ts:813:81"
690
692
  )
691
693
  assert(
692
694
  "Identifier" == referencePath.parentPath.parentPath.node.property.type,
693
- "src/processScript/transform.ts:810:83"
695
+ "src/processScript/transform.ts:814:83"
694
696
  )
695
697
  assert(
696
698
  /^[_a-z][\d_a-z]{0,24}$/.test(referencePath.parent.property.name),
697
- `src/processScript/transform.ts:814:8 invalid user "${referencePath.parent.property.name}" in subscript`
699
+ `src/processScript/transform.ts:818:8 invalid user "${referencePath.parent.property.name}" in subscript`
698
700
  )
699
701
  assert(
700
702
  /^[_a-z][\d_a-z]{0,24}$/.test(referencePath.parentPath.parentPath.node.property.name),
701
- `src/processScript/transform.ts:819:8 invalid script name "${referencePath.parentPath.parentPath.node.property.name}" in subscript`
703
+ `src/processScript/transform.ts:823:8 invalid script name "${referencePath.parentPath.parentPath.node.property.name}" in subscript`
702
704
  )
703
705
  if ("CallExpression" == referencePath.parentPath.parentPath.parentPath?.type)
704
706
  referencePath.parentPath.parentPath.replaceWith(