hackmud-script-manager 0.21.1-2f94c60 → 0.21.1-43deef2
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/preprocess.js +3 -15
- package/push.js +3 -1
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-
|
67
|
+
console.log("0.21.1-43deef2")
|
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-
|
415
|
+
`${colourJ("Hackmud Script Manager")}\n${colourN("Version") + colourS(": ") + colourV("0.21.1-43deef2")}\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
@@ -4,23 +4,11 @@ import babelTraverse 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
|
-
import { tokenizer, tokTypes } from "acorn"
|
8
7
|
import { resolve } from "import-meta-resolve"
|
9
8
|
const { default: traverse } = babelTraverse,
|
10
|
-
{ default: generate } = babelGenerator
|
11
|
-
SUBSCRIPT_PREFIXES = ["s", "fs", "4s", "hs", "3s", "ms", "2s", "ls", "1s", "ns", "0s"]
|
9
|
+
{ default: generate } = babelGenerator
|
12
10
|
async function preprocess(code, { uniqueId = "00000000000" } = {}) {
|
13
|
-
assert(/^\w{11}$/.test(uniqueId), "src/processScript/preprocess.ts:
|
14
|
-
const tokensIterable = tokenizer(code, { ecmaVersion: "latest" })
|
15
|
-
for (const token of tokensIterable) {
|
16
|
-
assert("value" in token, "src/processScript/preprocess.ts:31:28")
|
17
|
-
if (token.type != tokTypes.privateId) continue
|
18
|
-
assert("string" == typeof token.value, "src/processScript/preprocess.ts:36:42")
|
19
|
-
if (!SUBSCRIPT_PREFIXES.includes(token.value)) continue
|
20
|
-
const nextToken = tokensIterable.getToken()
|
21
|
-
if (nextToken.type != tokTypes._in && nextToken.type != tokTypes.dot)
|
22
|
-
throw SyntaxError("Subscripts must be in the form of #fs.foo.bar")
|
23
|
-
}
|
11
|
+
assert(/^\w{11}$/.test(uniqueId), "src/processScript/preprocess.ts:23:36")
|
24
12
|
const sourceCode = code
|
25
13
|
let lengthBefore, file, program
|
26
14
|
do {
|
@@ -59,7 +47,7 @@ async function preprocess(code, { uniqueId = "00000000000" } = {}) {
|
|
59
47
|
})
|
60
48
|
break
|
61
49
|
} catch (error_) {
|
62
|
-
assert(error_ instanceof SyntaxError, "src/processScript/preprocess.ts:
|
50
|
+
assert(error_ instanceof SyntaxError, "src/processScript/preprocess.ts:67:42")
|
63
51
|
error = error_
|
64
52
|
}
|
65
53
|
if ("BABEL_PARSER_SYNTAX_ERROR" != error.code || "PrivateInExpectedIn" != error.reasonCode) {
|
package/push.js
CHANGED
@@ -70,7 +70,9 @@ async function push(
|
|
70
70
|
])
|
71
71
|
if (sourceFolder instanceof Error) return sourceFolder
|
72
72
|
if (hackmudFolder instanceof Error) return hackmudFolder
|
73
|
-
const sourceFolderFolders = sourceFolder.filter(
|
73
|
+
const sourceFolderFolders = sourceFolder.filter(
|
74
|
+
({ name, stats }) => stats.isDirectory() && /^[a-z_][a-z\d_]{0,24}$/.test(name)
|
75
|
+
),
|
74
76
|
allUsers = new Set([
|
75
77
|
...scripts
|
76
78
|
.map(scriptName => ensure(scriptName.split(".")[0], "src/push.ts:85:65"))
|