hackmud-script-manager 0.19.1-b720a68 → 0.19.1-b80922d
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/hsm.js +1 -1
- package/package.json +1 -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 +27 -31
- package/push.d.ts +3 -3
- package/watch.d.ts +3 -3
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.19.1-
|
15
|
+
const version = "0.19.1-b80922d",
|
16
16
|
options = new Map(),
|
17
17
|
commands = [],
|
18
18
|
userColours = new Cache(user => {
|
package/package.json
CHANGED
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()
|
@@ -69,30 +65,30 @@ function transform(
|
|
69
65
|
const referencePath = FunctionReferencePaths[0]
|
70
66
|
assert(
|
71
67
|
"MemberExpression" == referencePath.parent.type,
|
72
|
-
"src/processScript/transform.ts:
|
68
|
+
"src/processScript/transform.ts:98:8 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
|
73
69
|
)
|
74
70
|
assert(
|
75
71
|
"Identifier" == referencePath.parent.property.type,
|
76
|
-
"src/processScript/transform.ts:
|
72
|
+
"src/processScript/transform.ts:103:8 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
|
77
73
|
)
|
78
74
|
assert(
|
79
75
|
"prototype" == referencePath.parent.property.name,
|
80
|
-
"src/processScript/transform.ts:
|
76
|
+
"src/processScript/transform.ts:108:8 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
|
81
77
|
)
|
82
78
|
referencePath.parentPath.replaceWith(createGetFunctionPrototypeNode())
|
83
79
|
} else {
|
84
80
|
for (const referencePath of FunctionReferencePaths) {
|
85
81
|
assert(
|
86
82
|
"MemberExpression" == referencePath.parent.type,
|
87
|
-
"src/processScript/transform.ts:
|
83
|
+
"src/processScript/transform.ts:116:9 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
|
88
84
|
)
|
89
85
|
assert(
|
90
86
|
"Identifier" == referencePath.parent.property.type,
|
91
|
-
"src/processScript/transform.ts:
|
87
|
+
"src/processScript/transform.ts:121:9 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
|
92
88
|
)
|
93
89
|
assert(
|
94
90
|
"prototype" == referencePath.parent.property.name,
|
95
|
-
"src/processScript/transform.ts:
|
91
|
+
"src/processScript/transform.ts:126:9 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
|
96
92
|
)
|
97
93
|
functionDotPrototypeIsReferencedMultipleTimes = !0
|
98
94
|
referencePath.parentPath.replaceWith(t.identifier(`_${uniqueID}_FUNCTION_DOT_PROTOTYPE_`))
|
@@ -128,12 +124,12 @@ function transform(
|
|
128
124
|
const neededDbMethodLets = new Set()
|
129
125
|
if (program.scope.hasGlobal("$db"))
|
130
126
|
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:
|
127
|
+
assert("MemberExpression" == referencePath.parentPath.node.type, "src/processScript/transform.ts:180:69")
|
128
|
+
assert("Identifier" == referencePath.parentPath.node.property.type, "src/processScript/transform.ts:181:72")
|
133
129
|
const databaseOpMethodName = referencePath.parentPath.node.property.name
|
134
130
|
assert(
|
135
131
|
validDBMethods.includes(databaseOpMethodName),
|
136
|
-
`src/processScript/transform.ts:
|
132
|
+
`src/processScript/transform.ts:187:8 invalid db method "${databaseOpMethodName}", valid db methods are "${validDBMethods.join('", "')}"`
|
137
133
|
)
|
138
134
|
if ("CallExpression" == referencePath.parentPath.parentPath?.type)
|
139
135
|
referencePath.parentPath.replaceWith(t.identifier(`$${uniqueID}$DB$${databaseOpMethodName}$`))
|
@@ -166,7 +162,7 @@ function transform(
|
|
166
162
|
if (program.scope.hasGlobal("Object"))
|
167
163
|
for (const referencePath of getReferencePathsToGlobal("Object", program))
|
168
164
|
if ("MemberExpression" == referencePath.parent.type && !referencePath.parent.computed) {
|
169
|
-
assert("Identifier" == referencePath.parent.property.type, "src/processScript/transform.ts:
|
165
|
+
assert("Identifier" == referencePath.parent.property.type, "src/processScript/transform.ts:234:64")
|
170
166
|
if ("getPrototypeOf" == referencePath.parent.property.name) {
|
171
167
|
referencePath.parentPath.replaceWith(t.identifier(`_${uniqueID}_GET_PROTOTYPE_OF_`))
|
172
168
|
needGetPrototypeOf = !0
|
@@ -176,7 +172,7 @@ function transform(
|
|
176
172
|
if (program.scope.hasGlobal("console"))
|
177
173
|
for (const referencePath of getReferencePathsToGlobal("console", program))
|
178
174
|
if ("MemberExpression" == referencePath.parent.type && !referencePath.parent.computed) {
|
179
|
-
assert("Identifier" == referencePath.parent.property.type, "src/processScript/transform.ts:
|
175
|
+
assert("Identifier" == referencePath.parent.property.type, "src/processScript/transform.ts:249:64")
|
180
176
|
referencePath.parentPath.replaceWith(
|
181
177
|
t.identifier(`_${uniqueID}_CONSOLE_METHOD_${referencePath.parent.property.name}_`)
|
182
178
|
)
|
@@ -184,13 +180,13 @@ function transform(
|
|
184
180
|
}
|
185
181
|
const lastStatement = program.node.body.at(-1)
|
186
182
|
let exportDefaultName
|
187
|
-
assert(lastStatement, "src/processScript/transform.ts:
|
183
|
+
assert(lastStatement, "src/processScript/transform.ts:263:27 program is empty")
|
188
184
|
if ("ExportNamedDeclaration" == lastStatement.type) {
|
189
185
|
program.node.body.pop()
|
190
186
|
for (const specifier of lastStatement.specifiers) {
|
191
187
|
assert(
|
192
188
|
"ExportSpecifier" == specifier.type,
|
193
|
-
`src/processScript/transform.ts:
|
189
|
+
`src/processScript/transform.ts:269:51 ${specifier.type} is currently unsupported`
|
194
190
|
)
|
195
191
|
const exportedName =
|
196
192
|
"Identifier" == specifier.exported.type ? specifier.exported.name : specifier.exported.value
|
@@ -313,11 +309,11 @@ function transform(
|
|
313
309
|
let hoistedGlobalBlockFunctions = 0
|
314
310
|
for (const [globalBlockIndex, globalBlockStatement] of [...globalBlock.body.entries()].reverse())
|
315
311
|
if ("VariableDeclaration" == globalBlockStatement.type) {
|
316
|
-
assert(1 == globalBlockStatement.declarations.length, "src/processScript/transform.ts:
|
312
|
+
assert(1 == globalBlockStatement.declarations.length, "src/processScript/transform.ts:403:59")
|
317
313
|
const declarator = globalBlockStatement.declarations[0]
|
318
314
|
assert(
|
319
315
|
"Identifier" == declarator.id.type,
|
320
|
-
`src/processScript/transform.ts:
|
316
|
+
`src/processScript/transform.ts:407:51 declarator.id.type was "${declarator.id.type}"`
|
321
317
|
)
|
322
318
|
program.scope.crawl()
|
323
319
|
if (program.scope.hasGlobal(declarator.id.name)) {
|
@@ -332,9 +328,9 @@ function transform(
|
|
332
328
|
Object.keys(program.scope.globals).some(global => globalBlockVariables.has(global))
|
333
329
|
) {
|
334
330
|
const binding = program.scope.getBinding(declarator.id.name)
|
335
|
-
assert(binding, "src/processScript/transform.ts:
|
331
|
+
assert(binding, "src/processScript/transform.ts:426:23")
|
336
332
|
for (const referencePath of binding.referencePaths) {
|
337
|
-
assert("Identifier" == referencePath.node.type, "src/processScript/transform.ts:
|
333
|
+
assert("Identifier" == referencePath.node.type, "src/processScript/transform.ts:429:56")
|
338
334
|
referencePath.replaceWith(
|
339
335
|
t.memberExpression(
|
340
336
|
t.identifier(`$${uniqueID}$GLOBAL$`),
|
@@ -378,16 +374,16 @@ function transform(
|
|
378
374
|
} else globalBlockVariables.add(declarator.id.name)
|
379
375
|
} else if ("ClassDeclaration" == globalBlockStatement.type) {
|
380
376
|
program.scope.crawl()
|
381
|
-
assert(globalBlockStatement.id, "src/processScript/transform.ts:
|
377
|
+
assert(globalBlockStatement.id, "src/processScript/transform.ts:480:37")
|
382
378
|
if (program.scope.hasGlobal(globalBlockStatement.id.name)) {
|
383
379
|
globalBlock.body.splice(globalBlockIndex, 1)
|
384
380
|
const [globalBlockPath] = program.unshiftContainer("body", globalBlock),
|
385
381
|
[globalBlockStatementPath] = program.unshiftContainer("body", globalBlockStatement)
|
386
382
|
program.scope.crawl()
|
387
383
|
const binding = program.scope.getBinding(globalBlockStatement.id.name)
|
388
|
-
assert(binding, "src/processScript/transform.ts:
|
384
|
+
assert(binding, "src/processScript/transform.ts:492:22")
|
389
385
|
for (const referencePath of binding.referencePaths) {
|
390
|
-
assert("Identifier" == referencePath.node.type, "src/processScript/transform.ts:
|
386
|
+
assert("Identifier" == referencePath.node.type, "src/processScript/transform.ts:495:55")
|
391
387
|
referencePath.replaceWith(
|
392
388
|
t.memberExpression(
|
393
389
|
t.identifier(`$${uniqueID}$GLOBAL$`),
|
@@ -554,7 +550,7 @@ function transform(
|
|
554
550
|
}
|
555
551
|
},
|
556
552
|
ClassBody({ node: classBody, scope, parent }) {
|
557
|
-
assert(t.isClass(parent), "src/processScript/transform.ts:
|
553
|
+
assert(t.isClass(parent), "src/processScript/transform.ts:662:30")
|
558
554
|
let thisIsReferenced = !1
|
559
555
|
for (const classMethod of classBody.body) {
|
560
556
|
if ("ClassMethod" != classMethod.type) continue
|
@@ -660,23 +656,23 @@ function transform(
|
|
660
656
|
}
|
661
657
|
function processFakeSubscriptObject(fakeSubscriptObjectName) {
|
662
658
|
for (const referencePath of getReferencePathsToGlobal(fakeSubscriptObjectName, program)) {
|
663
|
-
assert("MemberExpression" == referencePath.parent.type, "src/processScript/transform.ts:
|
659
|
+
assert("MemberExpression" == referencePath.parent.type, "src/processScript/transform.ts:776:60")
|
664
660
|
assert("Identifier" == referencePath.parent.property.type)
|
665
661
|
assert(
|
666
662
|
"MemberExpression" == referencePath.parentPath.parentPath?.node.type,
|
667
|
-
"src/processScript/transform.ts:
|
663
|
+
"src/processScript/transform.ts:778:81"
|
668
664
|
)
|
669
665
|
assert(
|
670
666
|
"Identifier" == referencePath.parentPath.parentPath.node.property.type,
|
671
|
-
"src/processScript/transform.ts:
|
667
|
+
"src/processScript/transform.ts:779:83"
|
672
668
|
)
|
673
669
|
assert(
|
674
670
|
/^[_a-z][\d_a-z]{0,24}$/.test(referencePath.parent.property.name),
|
675
|
-
`src/processScript/transform.ts:
|
671
|
+
`src/processScript/transform.ts:783:8 invalid user "${referencePath.parent.property.name}" in subscript`
|
676
672
|
)
|
677
673
|
assert(
|
678
674
|
/^[_a-z][\d_a-z]{0,24}$/.test(referencePath.parentPath.parentPath.node.property.name),
|
679
|
-
`src/processScript/transform.ts:
|
675
|
+
`src/processScript/transform.ts:788:8 invalid script name "${referencePath.parentPath.parentPath.node.property.name}" in subscript`
|
680
676
|
)
|
681
677
|
if ("CallExpression" == referencePath.parentPath.parentPath.parentPath?.type)
|
682
678
|
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,7 +17,7 @@ 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
|
@@ -25,4 +25,4 @@ export type PushOptions = {
|
|
25
25
|
* @param hackmudDirectory 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(sourceDirectory: string, hackmudDirectory: string, { scripts, onPush, minify, mangleNames, forceQuineCheats }?:
|
28
|
+
export declare function push(sourceDirectory: string, hackmudDirectory: string, { scripts, onPush, minify, mangleNames, forceQuineCheats }?: PushOptions): Promise<Info[]>;
|
package/watch.d.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
import type { LaxPartial } from "@samual/lib";
|
2
2
|
import type { PushOptions } from "./push";
|
3
|
-
export type WatchOptions = PushOptions & {
|
3
|
+
export type WatchOptions = PushOptions & LaxPartial<{
|
4
4
|
/** if provided, will write typescript type declarations for all the scripts on every change detected
|
5
5
|
*
|
6
6
|
* writing the type declarations enables interscript type checking and autocompletetes for the args */
|
7
7
|
typeDeclarationPath: string;
|
8
8
|
onReady: () => void;
|
9
|
-
}
|
9
|
+
}>;
|
10
10
|
/** Watches target file or folder for updates and builds and pushes updated file.
|
11
11
|
* @param sourceDirectory path to folder containing source files
|
12
12
|
* @param hackmudDirectory path to hackmud directory
|
13
13
|
* @param options {@link WatchOptions details} and {@link PushOptions more details} */
|
14
|
-
export declare function watch(sourceDirectory: string, hackmudDirectory: string, { scripts, onPush, minify, mangleNames, typeDeclarationPath: typeDeclarationPath_, onReady, forceQuineCheats }?:
|
14
|
+
export declare function watch(sourceDirectory: string, hackmudDirectory: string, { scripts, onPush, minify, mangleNames, typeDeclarationPath: typeDeclarationPath_, onReady, forceQuineCheats }?: WatchOptions): Promise<void>;
|