hackmud-script-manager 0.19.1-8719c7d → 0.19.1-875bbe4
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/hsm.js +7 -6
- package/env.d.ts +1357 -0
- package/index.d.ts +2 -2
- package/package.json +4 -1
- package/processScript/index.d.ts +4 -3
- package/processScript/index.js +6 -6
- package/processScript/minify.d.ts +3 -3
- package/processScript/preprocess.d.ts +5 -4
- package/processScript/preprocess.js +2 -2
- package/processScript/transform.d.ts +4 -3
- package/processScript/transform.js +38 -37
- package/push.d.ts +5 -5
- package/push.js +83 -214
- package/syncMacros.js +1 -1
- package/typescript.patch +882 -0
- package/watch.d.ts +3 -3
- package/watch.js +8 -8
package/index.d.ts
CHANGED
@@ -6,8 +6,8 @@ export { push } from "./push";
|
|
6
6
|
export { syncMacros } from "./syncMacros";
|
7
7
|
export { watch } from "./watch";
|
8
8
|
export type Info = {
|
9
|
-
|
9
|
+
path: string;
|
10
10
|
users: string[];
|
11
|
-
|
11
|
+
characterCount: number;
|
12
12
|
error: Error | undefined;
|
13
13
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "hackmud-script-manager",
|
3
|
-
"version": "0.19.1-
|
3
|
+
"version": "0.19.1-875bbe4",
|
4
4
|
"description": "Script manager for game hackmud, with minification, TypeScript support, and player script type definition generation.",
|
5
5
|
"keywords": [
|
6
6
|
"api",
|
@@ -69,6 +69,9 @@
|
|
69
69
|
"rollup": "^4.14.2",
|
70
70
|
"terser": "^5.30.3"
|
71
71
|
},
|
72
|
+
"peerDependencies": {
|
73
|
+
"typescript": "5.4.5"
|
74
|
+
},
|
72
75
|
"type": "module",
|
73
76
|
"exports": {
|
74
77
|
".": "./index.js",
|
package/processScript/index.d.ts
CHANGED
@@ -3,11 +3,10 @@ export { minify } from "./minify";
|
|
3
3
|
export { postprocess } from "./postprocess";
|
4
4
|
export { preprocess } from "./preprocess";
|
5
5
|
export { transform } from "./transform";
|
6
|
-
export type ProcessOptions = {
|
6
|
+
export type ProcessOptions = LaxPartial<{
|
7
7
|
/** whether to minify the given code */ minify: boolean;
|
8
8
|
/** 11 a-z 0-9 characters */ uniqueID: string;
|
9
9
|
/** the user going to be hosting this script (or set to `true` if not yet known) */ scriptUser: string | true;
|
10
|
-
/** the name of this script (or set to `true` if not yet known) */ scriptName: string | true;
|
11
10
|
filePath: string;
|
12
11
|
/** whether to mangle function and class names (defaults to `false`) */ mangleNames: boolean;
|
13
12
|
/** when set to `true` forces use of quine cheats
|
@@ -17,11 +16,13 @@ export type ProcessOptions = {
|
|
17
16
|
* when left unset or set to `undefined`, automatically uses or doesn't use quine cheats based on character count
|
18
17
|
*/
|
19
18
|
forceQuineCheats: boolean;
|
19
|
+
}> & {
|
20
|
+
scriptName: string | true;
|
20
21
|
};
|
21
22
|
/** Minifies a given script
|
22
23
|
* @param code JavaScript or TypeScript code
|
23
24
|
* @param options {@link ProcessOptions details} */
|
24
|
-
export declare function processScript(code: string, { minify: shouldMinify, uniqueID, scriptUser, scriptName, filePath, mangleNames, forceQuineCheats }
|
25
|
+
export declare function processScript(code: string, { minify: shouldMinify, uniqueID, scriptUser, scriptName, filePath, mangleNames, forceQuineCheats }: ProcessOptions): Promise<{
|
25
26
|
script: string;
|
26
27
|
warnings: {
|
27
28
|
message: string;
|
package/processScript/index.js
CHANGED
@@ -48,13 +48,13 @@ async function processScript(
|
|
48
48
|
.toString(36)
|
49
49
|
.padStart(11, "0"),
|
50
50
|
scriptUser,
|
51
|
-
scriptName
|
51
|
+
scriptName,
|
52
52
|
filePath,
|
53
53
|
mangleNames = !1,
|
54
54
|
forceQuineCheats
|
55
|
-
}
|
55
|
+
}
|
56
56
|
) {
|
57
|
-
assert(/^\w{11}$/.exec(uniqueID), "src/processScript/index.ts:
|
57
|
+
assert(/^\w{11}$/.exec(uniqueID), "src/processScript/index.ts:77:36")
|
58
58
|
const sourceCode = code
|
59
59
|
let autocomplete, statedSeclevel
|
60
60
|
const autocompleteMatch = /^function\s*\(.+\/\/(?<autocomplete>.+)/.exec(code)
|
@@ -115,7 +115,7 @@ async function processScript(
|
|
115
115
|
}
|
116
116
|
}
|
117
117
|
}
|
118
|
-
assert(/^\w{11}$/.exec(uniqueID), "src/processScript/index.ts:
|
118
|
+
assert(/^\w{11}$/.exec(uniqueID), "src/processScript/index.ts:158:36")
|
119
119
|
const plugins = [
|
120
120
|
[babelPluginProposalDecorators.default, { decoratorsBeforeExport: !0 }],
|
121
121
|
[babelPluginTransformClassProperties.default],
|
@@ -249,7 +249,7 @@ async function processScript(
|
|
249
249
|
traverse(file, {
|
250
250
|
MemberExpression({ node: memberExpression }) {
|
251
251
|
if (!memberExpression.computed) {
|
252
|
-
assert("Identifier" == memberExpression.property.type, "src/processScript/index.ts:
|
252
|
+
assert("Identifier" == memberExpression.property.type, "src/processScript/index.ts:321:60")
|
253
253
|
if ("prototype" == memberExpression.property.name) {
|
254
254
|
memberExpression.computed = !0
|
255
255
|
memberExpression.property = t.stringLiteral("prototype")
|
@@ -279,7 +279,7 @@ async function processScript(
|
|
279
279
|
break
|
280
280
|
case "ObjectPattern":
|
281
281
|
for (const property of lValue.properties) {
|
282
|
-
assert("ObjectProperty" == property.type, "src/processScript/index.ts:
|
282
|
+
assert("ObjectProperty" == property.type, "src/processScript/index.ts:351:51")
|
283
283
|
renameVariables(property.value)
|
284
284
|
}
|
285
285
|
break
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { File } from "@babel/types";
|
2
2
|
import type { LaxPartial } from "@samual/lib";
|
3
|
-
type MinifyOptions = {
|
3
|
+
type MinifyOptions = LaxPartial<{
|
4
4
|
/** 11 a-z 0-9 characters */ uniqueID: string;
|
5
5
|
/** whether to mangle function and class names (defaults to `false`) */ mangleNames: boolean;
|
6
6
|
/** when set to `true` forces use of quine cheats
|
@@ -11,8 +11,8 @@ type MinifyOptions = {
|
|
11
11
|
*/
|
12
12
|
forceQuineCheats: boolean;
|
13
13
|
/** the comment inserted after the function signature */ autocomplete: string;
|
14
|
-
}
|
14
|
+
}>;
|
15
15
|
/** @param file babel ast node representing a file containing transformed code
|
16
16
|
* @param options {@link MinifyOptions details} */
|
17
|
-
export declare function minify(file: File, { uniqueID, mangleNames, forceQuineCheats, autocomplete }?:
|
17
|
+
export declare function minify(file: File, { uniqueID, mangleNames, forceQuineCheats, autocomplete }?: MinifyOptions): Promise<string>;
|
18
18
|
export {};
|
@@ -1,8 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
import type { LaxPartial } from "@samual/lib";
|
2
|
+
export type PreprocessOptions = LaxPartial<{
|
3
|
+
uniqueID: string;
|
4
|
+
}>;
|
4
5
|
/** @param code source code for preprocessing
|
5
6
|
* @param options {@link PreprocessOptions details} */
|
6
|
-
export declare function preprocess(code: string, { uniqueID }?:
|
7
|
+
export declare function preprocess(code: string, { uniqueID }?: PreprocessOptions): Promise<{
|
7
8
|
code: string;
|
8
9
|
}>;
|
@@ -8,7 +8,7 @@ import { resolve } from "import-meta-resolve"
|
|
8
8
|
const { default: traverse } = babelTraverse,
|
9
9
|
{ default: generate } = babelGenerator
|
10
10
|
async function preprocess(code, { uniqueID = "00000000000" } = {}) {
|
11
|
-
assert(/^\w{11}$/.test(uniqueID), "src/processScript/preprocess.ts:
|
11
|
+
assert(/^\w{11}$/.test(uniqueID), "src/processScript/preprocess.ts:22:36")
|
12
12
|
const sourceCode = code
|
13
13
|
let lengthBefore, file, program
|
14
14
|
do {
|
@@ -47,7 +47,7 @@ async function preprocess(code, { uniqueID = "00000000000" } = {}) {
|
|
47
47
|
})
|
48
48
|
break
|
49
49
|
} catch (error_) {
|
50
|
-
assert(error_ instanceof SyntaxError, "src/processScript/preprocess.ts:
|
50
|
+
assert(error_ instanceof SyntaxError, "src/processScript/preprocess.ts:66:42")
|
51
51
|
error = error_
|
52
52
|
}
|
53
53
|
if ("BABEL_PARSER_SYNTAX_ERROR" != error.code || "PrivateInExpectedIn" != error.reasonCode) {
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import type { File } from "@babel/types";
|
2
2
|
import type { LaxPartial } from "@samual/lib";
|
3
|
-
export type TransformOptions = {
|
3
|
+
export type TransformOptions = LaxPartial<{
|
4
4
|
/** 11 a-z 0-9 characters */ uniqueID: string;
|
5
5
|
/** the user going to be hosting this script (or set to `true` if not yet known) */ scriptUser: string | true;
|
6
|
-
/** the name of this script (or set to `true` if not yet known) */ scriptName: string | true;
|
7
6
|
seclevel: number;
|
7
|
+
}> & {
|
8
|
+
scriptName: string | true;
|
8
9
|
};
|
9
10
|
/** transform a given babel `File` to be hackmud compatible
|
10
11
|
*
|
@@ -12,7 +13,7 @@ export type TransformOptions = {
|
|
12
13
|
* @param file babel ast node representing a file containing preprocessed code
|
13
14
|
* @param sourceCode the original untouched source code
|
14
15
|
* @param options {@link TransformOptions details} */
|
15
|
-
export declare function transform(file: File, sourceCode: string, { uniqueID, scriptUser, scriptName, seclevel }
|
16
|
+
export declare function transform(file: File, sourceCode: string, { uniqueID, scriptUser, scriptName, seclevel }: TransformOptions): {
|
16
17
|
file: File;
|
17
18
|
seclevel: number;
|
18
19
|
};
|
@@ -21,11 +21,7 @@ const { default: traverse } = babelTraverse,
|
|
21
21
|
"Symbol",
|
22
22
|
"BigInt"
|
23
23
|
]
|
24
|
-
function transform(
|
25
|
-
file,
|
26
|
-
sourceCode,
|
27
|
-
{ uniqueID = "00000000000", scriptUser, scriptName = "UNKNOWN", seclevel = 4 } = {}
|
28
|
-
) {
|
24
|
+
function transform(file, sourceCode, { uniqueID = "00000000000", scriptUser, scriptName, seclevel = 4 }) {
|
29
25
|
const topFunctionName = `_${uniqueID}_SCRIPT_`,
|
30
26
|
exports = new Map(),
|
31
27
|
liveExports = new Map()
|
@@ -55,13 +51,18 @@ function transform(
|
|
55
51
|
referencePath.replaceWith(t.stringLiteral(1 == scriptName ? `$${uniqueID}$SCRIPT_NAME$` : scriptName))
|
56
52
|
if (program.scope.hasGlobal("_FULL_SCRIPT_NAME"))
|
57
53
|
for (const referencePath of getReferencePathsToGlobal("_FULL_SCRIPT_NAME", program))
|
58
|
-
|
59
|
-
t.stringLiteral(
|
60
|
-
|
61
|
-
|
62
|
-
|
54
|
+
if (1 == scriptUser || 1 == scriptName)
|
55
|
+
referencePath.replaceWith(t.stringLiteral(`$${uniqueID}$FULL_SCRIPT_NAME$`))
|
56
|
+
else if (null == scriptUser) {
|
57
|
+
uniqueIdScriptUserNeeded = !0
|
58
|
+
referencePath.replaceWith(
|
59
|
+
t.binaryExpression(
|
60
|
+
"+",
|
61
|
+
t.identifier(`_${uniqueID}_SCRIPT_USER_`),
|
62
|
+
t.stringLiteral("." + scriptName)
|
63
|
+
)
|
63
64
|
)
|
64
|
-
)
|
65
|
+
} else referencePath.replaceWith(t.stringLiteral(`${scriptUser}.${scriptName}`))
|
65
66
|
let functionDotPrototypeIsReferencedMultipleTimes = !1
|
66
67
|
if (program.scope.hasGlobal("Function")) {
|
67
68
|
const FunctionReferencePaths = getReferencePathsToGlobal("Function", program)
|
@@ -69,30 +70,30 @@ function transform(
|
|
69
70
|
const referencePath = FunctionReferencePaths[0]
|
70
71
|
assert(
|
71
72
|
"MemberExpression" == referencePath.parent.type,
|
72
|
-
"src/processScript/transform.ts:
|
73
|
+
"src/processScript/transform.ts:105:8 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
|
73
74
|
)
|
74
75
|
assert(
|
75
76
|
"Identifier" == referencePath.parent.property.type,
|
76
|
-
"src/processScript/transform.ts:
|
77
|
+
"src/processScript/transform.ts:110:8 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
|
77
78
|
)
|
78
79
|
assert(
|
79
80
|
"prototype" == referencePath.parent.property.name,
|
80
|
-
"src/processScript/transform.ts:
|
81
|
+
"src/processScript/transform.ts:115:8 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
|
81
82
|
)
|
82
83
|
referencePath.parentPath.replaceWith(createGetFunctionPrototypeNode())
|
83
84
|
} else {
|
84
85
|
for (const referencePath of FunctionReferencePaths) {
|
85
86
|
assert(
|
86
87
|
"MemberExpression" == referencePath.parent.type,
|
87
|
-
"src/processScript/transform.ts:
|
88
|
+
"src/processScript/transform.ts:123:9 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
|
88
89
|
)
|
89
90
|
assert(
|
90
91
|
"Identifier" == referencePath.parent.property.type,
|
91
|
-
"src/processScript/transform.ts:
|
92
|
+
"src/processScript/transform.ts:128:9 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
|
92
93
|
)
|
93
94
|
assert(
|
94
95
|
"prototype" == referencePath.parent.property.name,
|
95
|
-
"src/processScript/transform.ts:
|
96
|
+
"src/processScript/transform.ts:133:9 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
|
96
97
|
)
|
97
98
|
functionDotPrototypeIsReferencedMultipleTimes = !0
|
98
99
|
referencePath.parentPath.replaceWith(t.identifier(`_${uniqueID}_FUNCTION_DOT_PROTOTYPE_`))
|
@@ -128,12 +129,12 @@ function transform(
|
|
128
129
|
const neededDbMethodLets = new Set()
|
129
130
|
if (program.scope.hasGlobal("$db"))
|
130
131
|
for (const referencePath of getReferencePathsToGlobal("$db", program)) {
|
131
|
-
assert("MemberExpression" == referencePath.parentPath.node.type, "src/processScript/transform.ts:
|
132
|
-
assert("Identifier" == referencePath.parentPath.node.property.type, "src/processScript/transform.ts:
|
132
|
+
assert("MemberExpression" == referencePath.parentPath.node.type, "src/processScript/transform.ts:187:69")
|
133
|
+
assert("Identifier" == referencePath.parentPath.node.property.type, "src/processScript/transform.ts:188:72")
|
133
134
|
const databaseOpMethodName = referencePath.parentPath.node.property.name
|
134
135
|
assert(
|
135
136
|
validDBMethods.includes(databaseOpMethodName),
|
136
|
-
`src/processScript/transform.ts:
|
137
|
+
`src/processScript/transform.ts:194:8 invalid db method "${databaseOpMethodName}", valid db methods are "${validDBMethods.join('", "')}"`
|
137
138
|
)
|
138
139
|
if ("CallExpression" == referencePath.parentPath.parentPath?.type)
|
139
140
|
referencePath.parentPath.replaceWith(t.identifier(`$${uniqueID}$DB$${databaseOpMethodName}$`))
|
@@ -166,7 +167,7 @@ function transform(
|
|
166
167
|
if (program.scope.hasGlobal("Object"))
|
167
168
|
for (const referencePath of getReferencePathsToGlobal("Object", program))
|
168
169
|
if ("MemberExpression" == referencePath.parent.type && !referencePath.parent.computed) {
|
169
|
-
assert("Identifier" == referencePath.parent.property.type, "src/processScript/transform.ts:
|
170
|
+
assert("Identifier" == referencePath.parent.property.type, "src/processScript/transform.ts:241:64")
|
170
171
|
if ("getPrototypeOf" == referencePath.parent.property.name) {
|
171
172
|
referencePath.parentPath.replaceWith(t.identifier(`_${uniqueID}_GET_PROTOTYPE_OF_`))
|
172
173
|
needGetPrototypeOf = !0
|
@@ -176,7 +177,7 @@ function transform(
|
|
176
177
|
if (program.scope.hasGlobal("console"))
|
177
178
|
for (const referencePath of getReferencePathsToGlobal("console", program))
|
178
179
|
if ("MemberExpression" == referencePath.parent.type && !referencePath.parent.computed) {
|
179
|
-
assert("Identifier" == referencePath.parent.property.type, "src/processScript/transform.ts:
|
180
|
+
assert("Identifier" == referencePath.parent.property.type, "src/processScript/transform.ts:256:64")
|
180
181
|
referencePath.parentPath.replaceWith(
|
181
182
|
t.identifier(`_${uniqueID}_CONSOLE_METHOD_${referencePath.parent.property.name}_`)
|
182
183
|
)
|
@@ -184,13 +185,13 @@ function transform(
|
|
184
185
|
}
|
185
186
|
const lastStatement = program.node.body.at(-1)
|
186
187
|
let exportDefaultName
|
187
|
-
assert(lastStatement, "src/processScript/transform.ts:
|
188
|
+
assert(lastStatement, "src/processScript/transform.ts:270:27 program is empty")
|
188
189
|
if ("ExportNamedDeclaration" == lastStatement.type) {
|
189
190
|
program.node.body.pop()
|
190
191
|
for (const specifier of lastStatement.specifiers) {
|
191
192
|
assert(
|
192
193
|
"ExportSpecifier" == specifier.type,
|
193
|
-
`src/processScript/transform.ts:
|
194
|
+
`src/processScript/transform.ts:276:51 ${specifier.type} is currently unsupported`
|
194
195
|
)
|
195
196
|
const exportedName =
|
196
197
|
"Identifier" == specifier.exported.type ? specifier.exported.name : specifier.exported.value
|
@@ -313,11 +314,11 @@ function transform(
|
|
313
314
|
let hoistedGlobalBlockFunctions = 0
|
314
315
|
for (const [globalBlockIndex, globalBlockStatement] of [...globalBlock.body.entries()].reverse())
|
315
316
|
if ("VariableDeclaration" == globalBlockStatement.type) {
|
316
|
-
assert(1 == globalBlockStatement.declarations.length, "src/processScript/transform.ts:
|
317
|
+
assert(1 == globalBlockStatement.declarations.length, "src/processScript/transform.ts:410:59")
|
317
318
|
const declarator = globalBlockStatement.declarations[0]
|
318
319
|
assert(
|
319
320
|
"Identifier" == declarator.id.type,
|
320
|
-
`src/processScript/transform.ts:
|
321
|
+
`src/processScript/transform.ts:414:51 declarator.id.type was "${declarator.id.type}"`
|
321
322
|
)
|
322
323
|
program.scope.crawl()
|
323
324
|
if (program.scope.hasGlobal(declarator.id.name)) {
|
@@ -332,9 +333,9 @@ function transform(
|
|
332
333
|
Object.keys(program.scope.globals).some(global => globalBlockVariables.has(global))
|
333
334
|
) {
|
334
335
|
const binding = program.scope.getBinding(declarator.id.name)
|
335
|
-
assert(binding, "src/processScript/transform.ts:
|
336
|
+
assert(binding, "src/processScript/transform.ts:433:23")
|
336
337
|
for (const referencePath of binding.referencePaths) {
|
337
|
-
assert("Identifier" == referencePath.node.type, "src/processScript/transform.ts:
|
338
|
+
assert("Identifier" == referencePath.node.type, "src/processScript/transform.ts:436:56")
|
338
339
|
referencePath.replaceWith(
|
339
340
|
t.memberExpression(
|
340
341
|
t.identifier(`$${uniqueID}$GLOBAL$`),
|
@@ -378,16 +379,16 @@ function transform(
|
|
378
379
|
} else globalBlockVariables.add(declarator.id.name)
|
379
380
|
} else if ("ClassDeclaration" == globalBlockStatement.type) {
|
380
381
|
program.scope.crawl()
|
381
|
-
assert(globalBlockStatement.id, "src/processScript/transform.ts:
|
382
|
+
assert(globalBlockStatement.id, "src/processScript/transform.ts:487:37")
|
382
383
|
if (program.scope.hasGlobal(globalBlockStatement.id.name)) {
|
383
384
|
globalBlock.body.splice(globalBlockIndex, 1)
|
384
385
|
const [globalBlockPath] = program.unshiftContainer("body", globalBlock),
|
385
386
|
[globalBlockStatementPath] = program.unshiftContainer("body", globalBlockStatement)
|
386
387
|
program.scope.crawl()
|
387
388
|
const binding = program.scope.getBinding(globalBlockStatement.id.name)
|
388
|
-
assert(binding, "src/processScript/transform.ts:
|
389
|
+
assert(binding, "src/processScript/transform.ts:499:22")
|
389
390
|
for (const referencePath of binding.referencePaths) {
|
390
|
-
assert("Identifier" == referencePath.node.type, "src/processScript/transform.ts:
|
391
|
+
assert("Identifier" == referencePath.node.type, "src/processScript/transform.ts:502:55")
|
391
392
|
referencePath.replaceWith(
|
392
393
|
t.memberExpression(
|
393
394
|
t.identifier(`$${uniqueID}$GLOBAL$`),
|
@@ -554,7 +555,7 @@ function transform(
|
|
554
555
|
}
|
555
556
|
},
|
556
557
|
ClassBody({ node: classBody, scope, parent }) {
|
557
|
-
assert(t.isClass(parent), "src/processScript/transform.ts:
|
558
|
+
assert(t.isClass(parent), "src/processScript/transform.ts:669:30")
|
558
559
|
let thisIsReferenced = !1
|
559
560
|
for (const classMethod of classBody.body) {
|
560
561
|
if ("ClassMethod" != classMethod.type) continue
|
@@ -660,23 +661,23 @@ function transform(
|
|
660
661
|
}
|
661
662
|
function processFakeSubscriptObject(fakeSubscriptObjectName) {
|
662
663
|
for (const referencePath of getReferencePathsToGlobal(fakeSubscriptObjectName, program)) {
|
663
|
-
assert("MemberExpression" == referencePath.parent.type, "src/processScript/transform.ts:
|
664
|
+
assert("MemberExpression" == referencePath.parent.type, "src/processScript/transform.ts:783:60")
|
664
665
|
assert("Identifier" == referencePath.parent.property.type)
|
665
666
|
assert(
|
666
667
|
"MemberExpression" == referencePath.parentPath.parentPath?.node.type,
|
667
|
-
"src/processScript/transform.ts:
|
668
|
+
"src/processScript/transform.ts:785:81"
|
668
669
|
)
|
669
670
|
assert(
|
670
671
|
"Identifier" == referencePath.parentPath.parentPath.node.property.type,
|
671
|
-
"src/processScript/transform.ts:
|
672
|
+
"src/processScript/transform.ts:786:83"
|
672
673
|
)
|
673
674
|
assert(
|
674
675
|
/^[_a-z][\d_a-z]{0,24}$/.test(referencePath.parent.property.name),
|
675
|
-
`src/processScript/transform.ts:
|
676
|
+
`src/processScript/transform.ts:790:8 invalid user "${referencePath.parent.property.name}" in subscript`
|
676
677
|
)
|
677
678
|
assert(
|
678
679
|
/^[_a-z][\d_a-z]{0,24}$/.test(referencePath.parentPath.parentPath.node.property.name),
|
679
|
-
`src/processScript/transform.ts:
|
680
|
+
`src/processScript/transform.ts:795:8 invalid script name "${referencePath.parentPath.parentPath.node.property.name}" in subscript`
|
680
681
|
)
|
681
682
|
if ("CallExpression" == referencePath.parentPath.parentPath.parentPath?.type)
|
682
683
|
referencePath.parentPath.parentPath.replaceWith(
|
package/push.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { LaxPartial } from "@samual/lib";
|
2
2
|
import type { Info } from ".";
|
3
|
-
export type PushOptions = {
|
3
|
+
export type PushOptions = LaxPartial<{
|
4
4
|
/** whether to do the minify step (defaults to `true`) */ minify: boolean;
|
5
5
|
/** whether to mangle function and class names (defaults to `false`) */ mangleNames: boolean;
|
6
6
|
/** array of scripts in the format `foo.bar`
|
@@ -17,12 +17,12 @@ export type PushOptions = {
|
|
17
17
|
* when left unset or set to `undefined`, automatically uses or doesn't use quine cheats based on character count
|
18
18
|
*/
|
19
19
|
forceQuineCheats: boolean;
|
20
|
-
}
|
20
|
+
}>;
|
21
21
|
/** Push scripts from a source directory to the hackmud directory.
|
22
22
|
*
|
23
23
|
* Pushes files directly in the source folder to all users
|
24
|
-
* @param
|
25
|
-
* @param
|
24
|
+
* @param sourcePath directory containing source code
|
25
|
+
* @param hackmudPath directory created by hackmud containing user data including scripts
|
26
26
|
* @param options {@link PushOptions details}
|
27
27
|
* @returns array of info on pushed scripts */
|
28
|
-
export declare function push(
|
28
|
+
export declare function push(sourcePath: string, hackmudPath: string, { scripts, onPush, minify, mangleNames, forceQuineCheats }?: PushOptions): Promise<Info[]>;
|