hackmud-script-manager 0.20.4-d8ff7a5 → 0.20.4-d9a4cf1

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Hackmud Script Manager
2
- Command made for [hackmud-environment](https://github.com/samualtnorman/hackmud-environment), which is a scripting environment for hackmud with minification, autocompletes / intellisense, and TypeScript support.
2
+ Command made for [Hackmud Scripting Environment](https://github.com/samualtnorman/hackmud-environment), which is a scripting environment for hackmud with minification, autocompletes / intellisense, and TypeScript support.
3
3
 
4
4
  [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/R6R0XN5CX)
5
5
 
package/bin/hsm.js CHANGED
@@ -12,7 +12,7 @@ import { pull } from "../pull.js"
12
12
  import { syncMacros } from "../syncMacros.js"
13
13
  import "@samual/lib/readDirectoryWithStats"
14
14
  import "@samual/lib/copyFilePersistent"
15
- const version = "0.20.4-d8ff7a5",
15
+ const version = "0.20.4-d9a4cf1",
16
16
  options = new Map(),
17
17
  commands = [],
18
18
  userColours = new Cache(user => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hackmud-script-manager",
3
- "version": "0.20.4-d8ff7a5",
3
+ "version": "0.20.4-d9a4cf1",
4
4
  "description": "Script manager for game hackmud, with minification, TypeScript support, and player script type definition generation.",
5
5
  "keywords": [
6
6
  "api",
@@ -20,7 +20,11 @@
20
20
  "homepage": "https://github.com/samualtnorman/hackmud-script-manager#readme",
21
21
  "bugs": "https://github.com/samualtnorman/hackmud-script-manager/issues",
22
22
  "license": "MIT",
23
- "author": "Samual Norman",
23
+ "author": "Samual Norman <me@samual.uk> (https://samual.uk/)",
24
+ "contributors": [
25
+ "Daniel Swann (https://github.com/danswann)",
26
+ "Longboyy"
27
+ ],
24
28
  "main": "index.js",
25
29
  "repository": {
26
30
  "type": "git",
@@ -220,8 +220,10 @@ async function minify(file, { uniqueId = "00000000000", mangleNames = !1, forceQ
220
220
  )
221
221
  },
222
222
  StringLiteral(path) {
223
- path.node.value = replaceUnsafeStrings(uniqueId, path.node.value)
224
- if (JSON.stringify(path.node.value).includes("\\u00") || path.toString().length < 4) return
223
+ if (JSON.stringify(path.node.value).includes("\\u00") || path.toString().length < 4) {
224
+ path.node.value = replaceUnsafeStrings(uniqueId, path.node.value)
225
+ return
226
+ }
225
227
  "key" == path.parentKey && "ObjectProperty" == path.parent.type && (path.parent.computed = !0)
226
228
  let jsonValueIndex = jsonValues.indexOf(path.node.value)
227
229
  ;-1 == jsonValueIndex && (jsonValueIndex += jsonValues.push(path.node.value))
@@ -244,7 +246,7 @@ async function minify(file, { uniqueId = "00000000000", mangleNames = !1, forceQ
244
246
  })
245
247
  await Promise.all(promises)
246
248
  const functionDeclaration = file.program.body[0]
247
- assert("FunctionDeclaration" == functionDeclaration.type, "src/processScript/minify.ts:363:61")
249
+ assert("FunctionDeclaration" == functionDeclaration.type, "src/processScript/minify.ts:364:61")
248
250
  if (jsonValues.length) {
249
251
  hasComment = !0
250
252
  if (1 == jsonValues.length)
@@ -361,7 +363,7 @@ async function minify(file, { uniqueId = "00000000000", mangleNames = !1, forceQ
361
363
  )
362
364
  }
363
365
  if (1 == forceQuineCheats) return code
364
- assert(scriptBeforeJSONValueReplacement, "src/processScript/minify.ts:494:43")
366
+ assert(scriptBeforeJSONValueReplacement, "src/processScript/minify.ts:495:43")
365
367
  return (
366
368
  countHackmudCharacters(scriptBeforeJSONValueReplacement) <=
367
369
  countHackmudCharacters(code) + Number(hasComment)
@@ -377,7 +379,7 @@ function parseObjectExpression(node, o) {
377
379
  "Identifier" == property.key.type ||
378
380
  "NumericLiteral" == property.key.type ||
379
381
  "StringLiteral" == property.key.type,
380
- "src/processScript/minify.ts:516:4"
382
+ "src/processScript/minify.ts:517:4"
381
383
  )
382
384
  if ("ArrayExpression" == property.value.type) {
383
385
  const childArray = []
@@ -631,7 +631,9 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
631
631
  VariableDeclaration({ node: variableDeclaration }) {
632
632
  "const" == variableDeclaration.kind && (variableDeclaration.kind = "let")
633
633
  },
634
- ThisExpression: path => path.replaceWith(t.identifier("undefined")),
634
+ ThisExpression: path => {
635
+ path.replaceWith(t.identifier("undefined"))
636
+ },
635
637
  BigIntLiteral(path) {
636
638
  const bigIntAsNumber = Number(path.node.value)
637
639
  path.replaceWith(
@@ -661,23 +663,23 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
661
663
  }
662
664
  function processFakeSubscriptObject(fakeSubscriptObjectName) {
663
665
  for (const referencePath of getReferencePathsToGlobal(fakeSubscriptObjectName, program)) {
664
- assert("MemberExpression" == referencePath.parent.type, "src/processScript/transform.ts:783:60")
666
+ assert("MemberExpression" == referencePath.parent.type, "src/processScript/transform.ts:785:60")
665
667
  assert("Identifier" == referencePath.parent.property.type)
666
668
  assert(
667
669
  "MemberExpression" == referencePath.parentPath.parentPath?.node.type,
668
- "src/processScript/transform.ts:785:81"
670
+ "src/processScript/transform.ts:787:81"
669
671
  )
670
672
  assert(
671
673
  "Identifier" == referencePath.parentPath.parentPath.node.property.type,
672
- "src/processScript/transform.ts:786:83"
674
+ "src/processScript/transform.ts:788:83"
673
675
  )
674
676
  assert(
675
677
  /^[_a-z][\d_a-z]{0,24}$/.test(referencePath.parent.property.name),
676
- `src/processScript/transform.ts:790:8 invalid user "${referencePath.parent.property.name}" in subscript`
678
+ `src/processScript/transform.ts:792:8 invalid user "${referencePath.parent.property.name}" in subscript`
677
679
  )
678
680
  assert(
679
681
  /^[_a-z][\d_a-z]{0,24}$/.test(referencePath.parentPath.parentPath.node.property.name),
680
- `src/processScript/transform.ts:795:8 invalid script name "${referencePath.parentPath.parentPath.node.property.name}" in subscript`
682
+ `src/processScript/transform.ts:797:8 invalid script name "${referencePath.parentPath.parentPath.node.property.name}" in subscript`
681
683
  )
682
684
  if ("CallExpression" == referencePath.parentPath.parentPath.parentPath?.type)
683
685
  referencePath.parentPath.parentPath.replaceWith(