hackmud-script-manager 0.21.1-d4bf990 → 0.21.1-e3e8246

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.
@@ -1,10 +1,10 @@
1
- import ons4yi64j2vp9u6vpqkt1emx from "@babel/traverse"
1
+ import kwmn7lp0r5s0ul58gd0l3ldw 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 = ons4yi64j2vp9u6vpqkt1emx.default,
7
+ const traverse = kwmn7lp0r5s0ul58gd0l3ldw.default,
8
8
  globalFunctionsUnder7Characters = [
9
9
  "Map",
10
10
  "Set",
@@ -77,30 +77,30 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
77
77
  const referencePath = FunctionReferencePaths[0]
78
78
  assert(
79
79
  "MemberExpression" == referencePath.parent.type,
80
- "src/processScript/transform.ts:108:8 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
80
+ "src/processScript/transform.ts:111:8 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
81
81
  )
82
82
  assert(
83
83
  "Identifier" == referencePath.parent.property.type,
84
- "src/processScript/transform.ts:113:8 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
84
+ "src/processScript/transform.ts:116:8 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
85
85
  )
86
86
  assert(
87
87
  "prototype" == referencePath.parent.property.name,
88
- "src/processScript/transform.ts:118:8 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
88
+ "src/processScript/transform.ts:121:8 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
89
89
  )
90
90
  referencePath.parentPath.replaceWith(createGetFunctionPrototypeNode())
91
91
  } else {
92
92
  for (const referencePath of FunctionReferencePaths) {
93
93
  assert(
94
94
  "MemberExpression" == referencePath.parent.type,
95
- "src/processScript/transform.ts:126:9 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
95
+ "src/processScript/transform.ts:129:9 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
96
96
  )
97
97
  assert(
98
98
  "Identifier" == referencePath.parent.property.type,
99
- "src/processScript/transform.ts:131:9 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
99
+ "src/processScript/transform.ts:134:9 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
100
100
  )
101
101
  assert(
102
102
  "prototype" == referencePath.parent.property.name,
103
- "src/processScript/transform.ts:136:9 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
103
+ "src/processScript/transform.ts:139:9 `Function` isn't available in hackmud, only `Function.prototype` is accessible"
104
104
  )
105
105
  functionDotPrototypeIsReferencedMultipleTimes = !0
106
106
  referencePath.parentPath.replaceWith(t.identifier(`_${uniqueId}_FUNCTION_DOT_PROTOTYPE_`))
@@ -141,12 +141,12 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
141
141
  const neededDbMethodLets = new Set()
142
142
  if (program.scope.hasGlobal("$db"))
143
143
  for (const referencePath of getReferencePathsToGlobal("$db", program)) {
144
- assert("MemberExpression" == referencePath.parentPath.node.type, "src/processScript/transform.ts:196:69")
145
- assert("Identifier" == referencePath.parentPath.node.property.type, "src/processScript/transform.ts:197:72")
144
+ assert("MemberExpression" == referencePath.parentPath.node.type, "src/processScript/transform.ts:198:69")
145
+ assert("Identifier" == referencePath.parentPath.node.property.type, "src/processScript/transform.ts:199:72")
146
146
  const databaseOpMethodName = referencePath.parentPath.node.property.name
147
147
  assert(
148
148
  validDBMethods.includes(databaseOpMethodName),
149
- `src/processScript/transform.ts:203:8 invalid db method "${databaseOpMethodName}", valid db methods are "${validDBMethods.join('", "')}"`
149
+ `src/processScript/transform.ts:205:8 invalid db method "${databaseOpMethodName}", valid db methods are "${validDBMethods.join('", "')}"`
150
150
  )
151
151
  if ("CallExpression" == referencePath.parentPath.parentPath?.type)
152
152
  referencePath.parentPath.replaceWith(t.identifier(`$${uniqueId}$DB$${databaseOpMethodName}$`))
@@ -181,7 +181,7 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
181
181
  if (program.scope.hasGlobal("Object"))
182
182
  for (const referencePath of getReferencePathsToGlobal("Object", program))
183
183
  if ("MemberExpression" == referencePath.parent.type && !referencePath.parent.computed) {
184
- assert("Identifier" == referencePath.parent.property.type, "src/processScript/transform.ts:253:64")
184
+ assert("Identifier" == referencePath.parent.property.type, "src/processScript/transform.ts:255:64")
185
185
  if ("getPrototypeOf" == referencePath.parent.property.name) {
186
186
  referencePath.parentPath.replaceWith(t.identifier(`_${uniqueId}_GET_PROTOTYPE_OF_`))
187
187
  needGetPrototypeOf = !0
@@ -194,7 +194,7 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
194
194
  if (program.scope.hasGlobal("console"))
195
195
  for (const referencePath of getReferencePathsToGlobal("console", program))
196
196
  if ("MemberExpression" == referencePath.parent.type && !referencePath.parent.computed) {
197
- assert("Identifier" == referencePath.parent.property.type, "src/processScript/transform.ts:271:64")
197
+ assert("Identifier" == referencePath.parent.property.type, "src/processScript/transform.ts:273:64")
198
198
  referencePath.parentPath.replaceWith(
199
199
  t.identifier(`_${uniqueId}_CONSOLE_METHOD_${referencePath.parent.property.name}_`)
200
200
  )
@@ -202,13 +202,13 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
202
202
  }
203
203
  const lastStatement = program.node.body.at(-1)
204
204
  let exportDefaultName
205
- assert(lastStatement, "src/processScript/transform.ts:285:27 program is empty")
205
+ assert(lastStatement, "src/processScript/transform.ts:287:27 program is empty")
206
206
  if ("ExportNamedDeclaration" == lastStatement.type) {
207
207
  program.node.body.pop()
208
208
  for (const specifier of lastStatement.specifiers) {
209
209
  assert(
210
210
  "ExportSpecifier" == specifier.type,
211
- `src/processScript/transform.ts:291:51 ${specifier.type} is currently unsupported`
211
+ `src/processScript/transform.ts:293:51 ${specifier.type} is currently unsupported`
212
212
  )
213
213
  if (
214
214
  "default" !=
@@ -310,11 +310,11 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
310
310
  let hoistedGlobalBlockFunctions = 0
311
311
  for (const [globalBlockIndex, globalBlockStatement] of [...globalBlock.body.entries()].reverse())
312
312
  if ("VariableDeclaration" == globalBlockStatement.type) {
313
- assert(1 == globalBlockStatement.declarations.length, "src/processScript/transform.ts:405:59")
313
+ assert(1 == globalBlockStatement.declarations.length, "src/processScript/transform.ts:406:59")
314
314
  const declarator = globalBlockStatement.declarations[0]
315
315
  assert(
316
316
  "Identifier" == declarator.id.type,
317
- `src/processScript/transform.ts:409:51 declarator.id.type was "${declarator.id.type}"`
317
+ `src/processScript/transform.ts:410:51 declarator.id.type was "${declarator.id.type}"`
318
318
  )
319
319
  program.scope.crawl()
320
320
  if (program.scope.hasGlobal(declarator.id.name)) {
@@ -329,9 +329,9 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
329
329
  Object.keys(program.scope.globals).some(global => globalBlockVariables.has(global))
330
330
  ) {
331
331
  const binding = program.scope.getBinding(declarator.id.name)
332
- assert(binding, "src/processScript/transform.ts:428:23")
332
+ assert(binding, "src/processScript/transform.ts:429:23")
333
333
  for (const referencePath of binding.referencePaths) {
334
- assert("Identifier" == referencePath.node.type, "src/processScript/transform.ts:431:56")
334
+ assert("Identifier" == referencePath.node.type, "src/processScript/transform.ts:432:56")
335
335
  referencePath.replaceWith(
336
336
  t.memberExpression(
337
337
  t.identifier(`_${uniqueId}_G_`),
@@ -379,16 +379,16 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
379
379
  } else globalBlockVariables.add(declarator.id.name)
380
380
  } else if ("ClassDeclaration" == globalBlockStatement.type) {
381
381
  program.scope.crawl()
382
- assert(globalBlockStatement.id, "src/processScript/transform.ts:488:37")
382
+ assert(globalBlockStatement.id, "src/processScript/transform.ts:489:37")
383
383
  if (program.scope.hasGlobal(globalBlockStatement.id.name)) {
384
384
  globalBlock.body.splice(globalBlockIndex, 1)
385
385
  const [globalBlockPath] = program.unshiftContainer("body", globalBlock),
386
386
  [globalBlockStatementPath] = program.unshiftContainer("body", globalBlockStatement)
387
387
  program.scope.crawl()
388
388
  const binding = program.scope.getBinding(globalBlockStatement.id.name)
389
- assert(binding, "src/processScript/transform.ts:500:22")
389
+ assert(binding, "src/processScript/transform.ts:501:22")
390
390
  for (const referencePath of binding.referencePaths) {
391
- assert("Identifier" == referencePath.node.type, "src/processScript/transform.ts:503:55")
391
+ assert("Identifier" == referencePath.node.type, "src/processScript/transform.ts:504:55")
392
392
  referencePath.replaceWith(
393
393
  t.memberExpression(t.identifier(`_${uniqueId}_G_`), t.identifier(referencePath.node.name))
394
394
  )
@@ -588,9 +588,9 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
588
588
  "VariableDeclarator" == parent.type &&
589
589
  "VariableDeclaration" == path.parentPath?.parentPath?.node?.type &&
590
590
  "const" == path.parentPath?.parentPath?.node?.kind &&
591
- "Identifier" == parent.id.type
592
- let thisId = reuseDeclaredName ? parent.id.name : `_${evenMoreUniqueId}_THIS_`,
593
- thisIsReferenced = !1
591
+ "Identifier" == parent.id.type,
592
+ thisId = reuseDeclaredName ? parent.id.name : `_${evenMoreUniqueId}_THIS_`
593
+ let thisIsReferenced = !1
594
594
  if ("ObjectExpression" == object.type)
595
595
  for (const property of object.properties)
596
596
  "ObjectMethod" == property.type &&
@@ -616,7 +616,7 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
616
616
  }
617
617
  currentParent = currentParent.parentPath
618
618
  }
619
- assert(null != someBlock, "src/processScript/transform.ts:705:29")
619
+ assert(null != someBlock, "src/processScript/transform.ts:709:29")
620
620
  return someBlock
621
621
  })(path)
622
622
  parentBlock.body.unshift(t.variableDeclaration("let", [t.variableDeclarator(t.identifier(thisId), null)]))
@@ -647,7 +647,7 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
647
647
  replaceThisInObjectLikeDefinition(path)
648
648
  },
649
649
  ClassBody({ node: classBody, scope, parent }) {
650
- assert(t.isClass(parent), "src/processScript/transform.ts:804:30")
650
+ assert(t.isClass(parent), "src/processScript/transform.ts:814:30")
651
651
  let thisIsReferenced = !1
652
652
  for (const classMethod of classBody.body) {
653
653
  if ("ClassMethod" != classMethod.type) continue
@@ -759,23 +759,23 @@ function transform(file, sourceCode, { uniqueId = "00000000000", scriptUser, scr
759
759
  }
760
760
  function processFakeSubscriptObject(fakeSubscriptObjectName, seclevel) {
761
761
  for (const referencePath of getReferencePathsToGlobal(fakeSubscriptObjectName, program)) {
762
- assert("MemberExpression" == referencePath.parent.type, "src/processScript/transform.ts:928:60")
762
+ assert("MemberExpression" == referencePath.parent.type, "src/processScript/transform.ts:937:60")
763
763
  assert("Identifier" == referencePath.parent.property.type)
764
764
  assert(
765
765
  "MemberExpression" == referencePath.parentPath.parentPath?.node.type,
766
- "src/processScript/transform.ts:930:81"
766
+ "src/processScript/transform.ts:939:81"
767
767
  )
768
768
  assert(
769
769
  "Identifier" == referencePath.parentPath.parentPath.node.property.type,
770
- "src/processScript/transform.ts:931:83"
770
+ "src/processScript/transform.ts:940:83"
771
771
  )
772
772
  assert(
773
773
  /^[_a-z][\d_a-z]{0,24}$/.test(referencePath.parent.property.name),
774
- `src/processScript/transform.ts:935:8 invalid user "${referencePath.parent.property.name}" in subscript`
774
+ `src/processScript/transform.ts:944:8 invalid user "${referencePath.parent.property.name}" in subscript`
775
775
  )
776
776
  assert(
777
777
  /^[_a-z][\d_a-z]{0,24}$/.test(referencePath.parentPath.parentPath.node.property.name),
778
- `src/processScript/transform.ts:940:8 invalid script name "${referencePath.parentPath.parentPath.node.property.name}" in subscript`
778
+ `src/processScript/transform.ts:949:8 invalid script name "${referencePath.parentPath.parentPath.node.property.name}" in subscript`
779
779
  )
780
780
  if ("CallExpression" == referencePath.parentPath.parentPath.parentPath?.type)
781
781
  referencePath.parentPath.parentPath.replaceWith(
package/pull.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- /** Copies script from hackmud to local source folder.
2
- * @param sourceFolderPath path to folder containing source files
3
- * @param hackmudPath path to hackmud directory
4
- * @param script to pull in `user.name` format */
1
+ /**
2
+ * Copies script from hackmud to local source folder.
3
+ * @param sourceFolderPath path to folder containing source files
4
+ * @param hackmudPath path to hackmud directory
5
+ * @param script to pull in `user.name` format
6
+ */
5
7
  export declare function pull(sourceFolderPath: string, hackmudPath: string, script: string): Promise<void>;
package/pull.js CHANGED
@@ -1,5 +1,5 @@
1
- import { copyFilePersistent } from "@samual/lib/copyFilePersistent"
2
1
  import { resolve } from "path"
2
+ import { copyFilePersistent } from "@samual/lib/copyFilePersistent"
3
3
  async function pull(sourceFolderPath, hackmudPath, script) {
4
4
  const [user, name] = script.split(".")
5
5
  if (!user || !name) throw Error('`script` argument must be in "user.name" format')
package/push.d.ts CHANGED
@@ -3,19 +3,22 @@ import type { Info } from ".";
3
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
- /** array of scripts in the format `foo.bar`
7
- *
8
- * also accepts wild card (`*`) e.g. `*.bar` or `foo.*`
9
- *
10
- * pushes everything by default (`*.*`) */
6
+ /**
7
+ * array of scripts in the format `foo.bar`
8
+ *
9
+ * also accepts wild card (`*`) e.g. `*.bar` or `foo.*`
10
+ *
11
+ * pushes everything by default (`*.*`)
12
+ */
11
13
  scripts: string[];
12
14
  /** callback called on script push */ onPush: (info: Info) => void;
13
- /** when set to `true` forces use of quine cheats
14
- *
15
- * when set to `false` forces quine cheats not to be used
16
- *
17
- * when left unset or set to `undefined`, automatically uses or doesn't use quine cheats based on character count
18
- */
15
+ /**
16
+ * when set to `true` forces use of quine cheats
17
+ *
18
+ * when set to `false` forces quine cheats not to be used
19
+ *
20
+ * when left unset or set to `undefined`, automatically uses or doesn't use quine cheats based on character count
21
+ */
19
22
  forceQuineCheats: boolean;
20
23
  rootFolderPath: string;
21
24
  }>;
@@ -27,11 +30,13 @@ export declare class NoUsersError extends Error {
27
30
  }
28
31
  export declare class NoScriptsError extends Error {
29
32
  }
30
- /** Push scripts from a source directory to the hackmud directory.
31
- *
32
- * Pushes files directly in the source folder to all users
33
- * @param sourcePath directory containing source code
34
- * @param hackmudPath directory created by hackmud containing user data including scripts
35
- * @param options {@link PushOptions details}
36
- * @returns array of info on pushed scripts */
33
+ /**
34
+ * Push scripts from a source directory to the hackmud directory.
35
+ *
36
+ * Pushes files directly in the source folder to all users
37
+ * @param sourcePath directory containing source code
38
+ * @param hackmudPath directory created by hackmud containing user data including scripts
39
+ * @param options {@link PushOptions details}
40
+ * @returns array of info on pushed scripts
41
+ */
37
42
  export declare function push(sourcePath: string, hackmudPath: string, { scripts, onPush, minify, mangleNames, forceQuineCheats, rootFolderPath }?: PushOptions): Promise<MissingSourceFolderError | MissingHackmudFolderError | NoUsersError | NoScriptsError | Info[]>;
package/push.js CHANGED
@@ -1,10 +1,10 @@
1
- import { AutoMap } from "@samual/lib/AutoMap"
1
+ import { readFile } from "fs/promises"
2
+ import { basename, resolve } from "path"
2
3
  import { ensure, assert } from "@samual/lib/assert"
4
+ import { AutoMap } from "@samual/lib/AutoMap"
3
5
  import { countHackmudCharacters } from "@samual/lib/countHackmudCharacters"
4
6
  import { readDirectoryWithStats } from "@samual/lib/readDirectoryWithStats"
5
7
  import { writeFilePersistent } from "@samual/lib/writeFilePersistent"
6
- import { readFile } from "fs/promises"
7
- import { basename, resolve } from "path"
8
8
  import { processScript } from "./processScript/index.js"
9
9
  import "@babel/generator"
10
10
  import "@babel/parser"
@@ -75,7 +75,7 @@ async function push(
75
75
  ),
76
76
  allUsers = new Set([
77
77
  ...scripts
78
- .map(scriptName => ensure(scriptName.split(".")[0], "src/push.ts:85:65"))
78
+ .map(scriptName => ensure(scriptName.split(".")[0], "src/push.ts:94:65"))
79
79
  .filter(name => "*" != name),
80
80
  ...sourceFolderFolders.map(({ name }) => name),
81
81
  ...hackmudFolder.filter(({ stats }) => stats.isDirectory()).map(({ name }) => name),
@@ -91,8 +91,8 @@ async function push(
91
91
  scriptNamesToUsers = new AutoMap(_scriptName => new Set())
92
92
  for (const script of scripts) {
93
93
  const [user, scriptName] = script.split(".")
94
- assert(user, "src/push.ts:108:16")
95
- assert(scriptName, "src/push.ts:109:22")
94
+ assert(user, "src/push.ts:117:16")
95
+ assert(scriptName, "src/push.ts:118:22")
96
96
  "*" == user ? scriptNamesToUsers.set(scriptName, allUsers) : scriptNamesToUsers.get(scriptName).add(user)
97
97
  }
98
98
  const sourceFolderFiles = sourceFolder.filter(({ stats }) => stats.isFile()),
package/syncMacros.js CHANGED
@@ -1,6 +1,6 @@
1
- import { readDirectoryWithStats } from "@samual/lib/readDirectoryWithStats"
2
1
  import { readFile, stat, writeFile } from "fs/promises"
3
2
  import { extname, basename, resolve } from "path"
3
+ import { readDirectoryWithStats } from "@samual/lib/readDirectoryWithStats"
4
4
  async function syncMacros(hackmudPath) {
5
5
  const files = await readDirectoryWithStats(hackmudPath),
6
6
  macros = new Map(),
@@ -9,22 +9,21 @@ async function syncMacros(hackmudPath) {
9
9
  files.map(async file => {
10
10
  if (file.stats.isFile())
11
11
  switch (extname(file.name)) {
12
- case ".macros":
13
- {
14
- const [lines, date] = await Promise.all([
15
- readFile(resolve(hackmudPath, file.name), { encoding: "utf8" }).then(file =>
16
- file.split("\n")
17
- ),
18
- stat(resolve(hackmudPath, file.name)).then(({ mtime }) => mtime)
19
- ])
20
- for (let index = 0; index < lines.length / 2 - 1; index++) {
21
- const macroName = lines[2 * index],
22
- currentMacro = macros.get(macroName)
23
- ;(!currentMacro || date > currentMacro.date) &&
24
- macros.set(macroName, { date, macro: lines[2 * index + 1] })
25
- }
12
+ case ".macros": {
13
+ const [lines, date] = await Promise.all([
14
+ readFile(resolve(hackmudPath, file.name), { encoding: "utf8" }).then(file =>
15
+ file.split("\n")
16
+ ),
17
+ stat(resolve(hackmudPath, file.name)).then(({ mtime }) => mtime)
18
+ ])
19
+ for (let index = 0; index < lines.length / 2 - 1; index++) {
20
+ const macroName = lines[2 * index],
21
+ currentMacro = macros.get(macroName)
22
+ ;(!currentMacro || date > currentMacro.date) &&
23
+ macros.set(macroName, { date, macro: lines[2 * index + 1] })
26
24
  }
27
25
  break
26
+ }
28
27
  case ".key":
29
28
  users.push(basename(file.name, ".key"))
30
29
  }
package/watch.d.ts CHANGED
@@ -1,15 +1,19 @@
1
1
  import type { LaxPartial } from "@samual/lib";
2
2
  import type { PushOptions } from "./push";
3
3
  export type WatchOptions = PushOptions & LaxPartial<{
4
- /** if provided, will write typescript type declarations for all the scripts on every change detected
5
- *
6
- * writing the type declarations enables interscript type checking and autocompletetes for the args */
4
+ /**
5
+ * if provided, will write typescript type declarations for all the scripts on every change detected
6
+ *
7
+ * writing the type declarations enables interscript type checking and autocompletetes for the args
8
+ */
7
9
  typeDeclarationPath: string;
8
10
  onReady: () => void;
9
11
  rootFolderPath: string;
10
12
  }>;
11
- /** Watches target file or folder for updates and builds and pushes updated file.
12
- * @param sourceDirectory path to folder containing source files
13
- * @param hackmudDirectory path to hackmud directory
14
- * @param options {@link WatchOptions details} and {@link PushOptions more details} */
13
+ /**
14
+ * Watches target file or folder for updates and builds and pushes updated file.
15
+ * @param sourceDirectory path to folder containing source files
16
+ * @param hackmudDirectory path to hackmud directory
17
+ * @param options {@link WatchOptions details} and {@link PushOptions more details}
18
+ */
15
19
  export declare function watch(sourceDirectory: string, hackmudDirectory: string, { scripts, onPush, minify, mangleNames, typeDeclarationPath: typeDeclarationPath_, onReady, forceQuineCheats, rootFolderPath }?: WatchOptions): Promise<void>;
package/watch.js CHANGED
@@ -1,11 +1,11 @@
1
- import { AutoMap } from "@samual/lib/AutoMap"
1
+ import { stat, readFile, writeFile } from "fs/promises"
2
+ import { extname, basename, resolve } from "path"
2
3
  import { assert } from "@samual/lib/assert"
4
+ import { AutoMap } from "@samual/lib/AutoMap"
3
5
  import { countHackmudCharacters } from "@samual/lib/countHackmudCharacters"
4
6
  import { readDirectoryWithStats } from "@samual/lib/readDirectoryWithStats"
5
7
  import { writeFilePersistent } from "@samual/lib/writeFilePersistent"
6
8
  import { watch as watch$1 } from "chokidar"
7
- import { stat, readFile, writeFile } from "fs/promises"
8
- import { extname, basename, resolve } from "path"
9
9
  import { supportedExtensions } from "./constants.js"
10
10
  import { generateTypeDeclaration } from "./generateTypeDeclaration.js"
11
11
  import { processScript } from "./processScript/index.js"
@@ -144,7 +144,7 @@ async function watch(
144
144
  }
145
145
  ))
146
146
  } catch (error) {
147
- assert(error instanceof Error, "src/watch.ts:160:36")
147
+ assert(error instanceof Error, "src/watch.ts:165:36")
148
148
  onPush?.({ path, users: [], characterCount: 0, error, warnings: [] })
149
149
  return
150
150
  }
@@ -192,7 +192,7 @@ async function watch(
192
192
  rootFolderPath
193
193
  }))
194
194
  } catch (error) {
195
- assert(error instanceof Error, "src/watch.ts:207:35")
195
+ assert(error instanceof Error, "src/watch.ts:212:35")
196
196
  onPush?.({ path, users: [], characterCount: 0, error, warnings: [] })
197
197
  return
198
198
  }
@@ -207,7 +207,7 @@ async function watch(
207
207
  try {
208
208
  await writeFile(typeDeclarationPath, typeDeclaration)
209
209
  } catch (error) {
210
- assert(error instanceof Error, "src/watch.ts:240:35")
210
+ assert(error instanceof Error, "src/watch.ts:245:35")
211
211
  if ("EISDIR" != error.code) throw error
212
212
  typeDeclarationPath = resolve(typeDeclarationPath, "player.d.ts")
213
213
  await writeFile(typeDeclarationPath, typeDeclaration)