hackmud-script-manager 0.21.1-d4bf990 → 0.21.1-e0cdb53
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 +2 -2
- package/package.json +1 -1
- package/processScript/index.js +34 -34
- package/processScript/minify.js +4 -4
- package/processScript/preprocess.js +4 -4
- package/processScript/transform.js +8 -18
package/bin/hsm.js
CHANGED
@@ -63,7 +63,7 @@ if (process.version.startsWith("v21.")) {
|
|
63
63
|
)
|
64
64
|
}
|
65
65
|
if ("v" == commands[0] || "version" == commands[0] || popOption("version", "v")?.value) {
|
66
|
-
console.log("0.21.1-
|
66
|
+
console.log("0.21.1-e0cdb53")
|
67
67
|
process.exit()
|
68
68
|
}
|
69
69
|
let warnedDeprecatedEmitDtsAlias = !1
|
@@ -411,7 +411,7 @@ function logHelp() {
|
|
411
411
|
default:
|
412
412
|
console.log(
|
413
413
|
colourS(
|
414
|
-
`${colourJ("Hackmud Script Manager")}\n${colourN("Version") + colourS(": ") + colourV("0.21.1-
|
414
|
+
`${colourJ("Hackmud Script Manager")}\n${colourN("Version") + colourS(": ") + colourV("0.21.1-e0cdb53")}\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
415
|
)
|
416
416
|
)
|
417
417
|
}
|
package/package.json
CHANGED
package/processScript/index.js
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
import
|
1
|
+
import kw4mqitfesprjelxpcglr7bo from "@babel/generator"
|
2
2
|
import { parse } from "@babel/parser"
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import
|
11
|
-
import
|
12
|
-
import
|
13
|
-
import
|
14
|
-
import
|
15
|
-
import
|
16
|
-
import
|
17
|
-
import
|
18
|
-
import
|
3
|
+
import n6kwtvbshu6z08m7n6ppve8v from "@babel/plugin-proposal-decorators"
|
4
|
+
import katyembxa4zjuk4ago5fe1wf from "@babel/plugin-proposal-destructuring-private"
|
5
|
+
import j48vn9jptsm0bh1b5qq7hjzn from "@babel/plugin-proposal-explicit-resource-management"
|
6
|
+
import d0sdeyxfpsn92quhb3ke0qtk from "@babel/plugin-transform-class-properties"
|
7
|
+
import obublfgsyh6qk69criue3f5c from "@babel/plugin-transform-class-static-block"
|
8
|
+
import zm73tzx4bbqdbpkbdp07vjw2 from "@babel/plugin-transform-exponentiation-operator"
|
9
|
+
import vddkn7yd5uxy2n5yjs0h6mx0 from "@babel/plugin-transform-json-strings"
|
10
|
+
import hhxv6gfrar2wfcukgwjk35g3 from "@babel/plugin-transform-logical-assignment-operators"
|
11
|
+
import c1rkpstkzooqen8we55xsro4 from "@babel/plugin-transform-nullish-coalescing-operator"
|
12
|
+
import aivwzpktux86j66kkia8n2wj from "@babel/plugin-transform-numeric-separator"
|
13
|
+
import zwqleized0bxqeq0klje5t4c from "@babel/plugin-transform-object-rest-spread"
|
14
|
+
import qpw7zzdqe5f2f6f851b08o42 from "@babel/plugin-transform-optional-catch-binding"
|
15
|
+
import f2jhxfh87voqygi08j2u6xh1 from "@babel/plugin-transform-optional-chaining"
|
16
|
+
import ymyx3h3zb0h762jn089d94hz from "@babel/plugin-transform-private-property-in-object"
|
17
|
+
import kuyjrgf5jx9tw5o8f7vvtd0h from "@babel/plugin-transform-unicode-sets-regex"
|
18
|
+
import x7nkcgsxzau27g4gq6kmxlmn from "@babel/traverse"
|
19
19
|
import t from "@babel/types"
|
20
20
|
import rollupPluginAlias from "@rollup/plugin-alias"
|
21
21
|
import { babel } from "@rollup/plugin-babel"
|
@@ -38,23 +38,23 @@ import "acorn"
|
|
38
38
|
import "terser"
|
39
39
|
import "import-meta-resolve"
|
40
40
|
import "@samual/lib/clearObject"
|
41
|
-
const generate =
|
42
|
-
babelPluginProposalDecorators =
|
43
|
-
babelPluginProposalDestructuringPrivate =
|
44
|
-
babelPluginProposalExplicitResourceManagement =
|
45
|
-
babelPluginTransformClassProperties =
|
46
|
-
babelPluginTransformClassStaticBlock =
|
47
|
-
babelPluginTransformExponentiationOperator =
|
48
|
-
babelPluginTransformJsonStrings =
|
49
|
-
babelPluginTransformLogicalAssignmentOperators =
|
50
|
-
babelPluginTransformNullishCoalescingOperator =
|
51
|
-
babelPluginTransformNumericSeparator =
|
52
|
-
babelPluginTransformObjectRestSpread =
|
53
|
-
babelPluginTransformOptionalCatchBinding =
|
54
|
-
babelPluginTransformOptionalChaining =
|
55
|
-
babelPluginTransformPrivatePropertyInObject =
|
56
|
-
babelPluginTransformUnicodeSetsRegex =
|
57
|
-
traverse =
|
41
|
+
const generate = kw4mqitfesprjelxpcglr7bo.default,
|
42
|
+
babelPluginProposalDecorators = n6kwtvbshu6z08m7n6ppve8v.default,
|
43
|
+
babelPluginProposalDestructuringPrivate = katyembxa4zjuk4ago5fe1wf.default,
|
44
|
+
babelPluginProposalExplicitResourceManagement = j48vn9jptsm0bh1b5qq7hjzn.default,
|
45
|
+
babelPluginTransformClassProperties = d0sdeyxfpsn92quhb3ke0qtk.default,
|
46
|
+
babelPluginTransformClassStaticBlock = obublfgsyh6qk69criue3f5c.default,
|
47
|
+
babelPluginTransformExponentiationOperator = zm73tzx4bbqdbpkbdp07vjw2.default,
|
48
|
+
babelPluginTransformJsonStrings = vddkn7yd5uxy2n5yjs0h6mx0.default,
|
49
|
+
babelPluginTransformLogicalAssignmentOperators = hhxv6gfrar2wfcukgwjk35g3.default,
|
50
|
+
babelPluginTransformNullishCoalescingOperator = c1rkpstkzooqen8we55xsro4.default,
|
51
|
+
babelPluginTransformNumericSeparator = aivwzpktux86j66kkia8n2wj.default,
|
52
|
+
babelPluginTransformObjectRestSpread = zwqleized0bxqeq0klje5t4c.default,
|
53
|
+
babelPluginTransformOptionalCatchBinding = qpw7zzdqe5f2f6f851b08o42.default,
|
54
|
+
babelPluginTransformOptionalChaining = f2jhxfh87voqygi08j2u6xh1.default,
|
55
|
+
babelPluginTransformPrivatePropertyInObject = ymyx3h3zb0h762jn089d94hz.default,
|
56
|
+
babelPluginTransformUnicodeSetsRegex = kuyjrgf5jx9tw5o8f7vvtd0h.default,
|
57
|
+
traverse = x7nkcgsxzau27g4gq6kmxlmn.default,
|
58
58
|
{ format } = prettier
|
59
59
|
async function processScript(
|
60
60
|
code,
|
package/processScript/minify.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import
|
2
|
-
import
|
1
|
+
import kw4mqitfesprjelxpcglr7bo from "@babel/generator"
|
2
|
+
import x7nkcgsxzau27g4gq6kmxlmn from "@babel/traverse"
|
3
3
|
import t from "@babel/types"
|
4
4
|
import { assert } from "@samual/lib/assert"
|
5
5
|
import { countHackmudCharacters } from "@samual/lib/countHackmudCharacters"
|
@@ -7,8 +7,8 @@ import { spliceString } from "@samual/lib/spliceString"
|
|
7
7
|
import { tokenizer, tokTypes } from "acorn"
|
8
8
|
import * as terser from "terser"
|
9
9
|
import { getReferencePathsToGlobal, includesIllegalString, replaceUnsafeStrings } from "./shared.js"
|
10
|
-
const generate =
|
11
|
-
traverse =
|
10
|
+
const generate = kw4mqitfesprjelxpcglr7bo.default,
|
11
|
+
traverse = x7nkcgsxzau27g4gq6kmxlmn.default,
|
12
12
|
minifyNumber = async number =>
|
13
13
|
/\$\((?<number>.+)\)/.exec((await terser.minify(`$(${number})`, { ecma: 2015 })).code).groups.number
|
14
14
|
async function minify(file, { uniqueId = "00000000000", mangleNames = !1, forceQuineCheats, autocomplete } = {}) {
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import
|
1
|
+
import kw4mqitfesprjelxpcglr7bo from "@babel/generator"
|
2
2
|
import { parse } from "@babel/parser"
|
3
|
-
import
|
3
|
+
import x7nkcgsxzau27g4gq6kmxlmn from "@babel/traverse"
|
4
4
|
import t from "@babel/types"
|
5
5
|
import { assert } from "@samual/lib/assert"
|
6
6
|
import { spliceString } from "@samual/lib/spliceString"
|
7
7
|
import { resolve } from "import-meta-resolve"
|
8
|
-
const generate =
|
9
|
-
traverse =
|
8
|
+
const generate = kw4mqitfesprjelxpcglr7bo.default,
|
9
|
+
traverse = x7nkcgsxzau27g4gq6kmxlmn.default
|
10
10
|
async function preprocess(code, { uniqueId = "00000000000" } = {}) {
|
11
11
|
assert(/^\w{11}$/.test(uniqueId), "src/processScript/preprocess.ts:18:36")
|
12
12
|
const sourceCode = code
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import
|
1
|
+
import x7nkcgsxzau27g4gq6kmxlmn from "@babel/traverse"
|
2
2
|
import t from "@babel/types"
|
3
3
|
import { assert } from "@samual/lib/assert"
|
4
4
|
import { clearObject } from "@samual/lib/clearObject"
|
5
5
|
import { validDBMethods } from "../constants.js"
|
6
6
|
import { getReferencePathsToGlobal } from "./shared.js"
|
7
|
-
const traverse =
|
7
|
+
const traverse = x7nkcgsxzau27g4gq6kmxlmn.default,
|
8
8
|
globalFunctionsUnder7Characters = [
|
9
9
|
"Map",
|
10
10
|
"Set",
|
@@ -723,17 +723,7 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
|
|
723
723
|
!parent.superClass && thisIsReferenced && (parent.superClass = t.identifier("Object"))
|
724
724
|
},
|
725
725
|
VariableDeclaration({ node: variableDeclaration }) {
|
726
|
-
|
727
|
-
variableDeclaration.kind = "let"
|
728
|
-
variableDeclaration.extra = { ...variableDeclaration.extra, usedToBeConst: !0 }
|
729
|
-
}
|
730
|
-
},
|
731
|
-
AssignmentExpression({ node: assignment, scope }) {
|
732
|
-
const lhs = assignment.left
|
733
|
-
if ("Identifier" != lhs.type) return
|
734
|
-
const binding = scope.getBinding(lhs.name)
|
735
|
-
if (binding?.path?.parentPath?.node?.extra?.usedToBeConst)
|
736
|
-
throw Error(`Reassignment to const variable ${lhs.name} is not allowed!`)
|
726
|
+
"const" == variableDeclaration.kind && (variableDeclaration.kind = "let")
|
737
727
|
},
|
738
728
|
ThisExpression: path => {
|
739
729
|
path.replaceWith(t.identifier("undefined"))
|
@@ -759,23 +749,23 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
|
|
759
749
|
}
|
760
750
|
function processFakeSubscriptObject(fakeSubscriptObjectName, seclevel) {
|
761
751
|
for (const referencePath of getReferencePathsToGlobal(fakeSubscriptObjectName, program)) {
|
762
|
-
assert("MemberExpression" == referencePath.parent.type, "src/processScript/transform.ts:
|
752
|
+
assert("MemberExpression" == referencePath.parent.type, "src/processScript/transform.ts:914:60")
|
763
753
|
assert("Identifier" == referencePath.parent.property.type)
|
764
754
|
assert(
|
765
755
|
"MemberExpression" == referencePath.parentPath.parentPath?.node.type,
|
766
|
-
"src/processScript/transform.ts:
|
756
|
+
"src/processScript/transform.ts:916:81"
|
767
757
|
)
|
768
758
|
assert(
|
769
759
|
"Identifier" == referencePath.parentPath.parentPath.node.property.type,
|
770
|
-
"src/processScript/transform.ts:
|
760
|
+
"src/processScript/transform.ts:917:83"
|
771
761
|
)
|
772
762
|
assert(
|
773
763
|
/^[_a-z][\d_a-z]{0,24}$/.test(referencePath.parent.property.name),
|
774
|
-
`src/processScript/transform.ts:
|
764
|
+
`src/processScript/transform.ts:921:8 invalid user "${referencePath.parent.property.name}" in subscript`
|
775
765
|
)
|
776
766
|
assert(
|
777
767
|
/^[_a-z][\d_a-z]{0,24}$/.test(referencePath.parentPath.parentPath.node.property.name),
|
778
|
-
`src/processScript/transform.ts:
|
768
|
+
`src/processScript/transform.ts:926:8 invalid script name "${referencePath.parentPath.parentPath.node.property.name}" in subscript`
|
779
769
|
)
|
780
770
|
if ("CallExpression" == referencePath.parentPath.parentPath.parentPath?.type)
|
781
771
|
referencePath.parentPath.parentPath.replaceWith(
|