hackmud-script-manager 0.21.1-2db6aca → 0.21.1-2f94c60

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.
Files changed (4) hide show
  1. package/bin/hsm.js +2 -2
  2. package/env.d.ts +11 -10
  3. package/package.json +1 -1
  4. package/watch.js +13 -4
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-2db6aca")
67
+ console.log("0.21.1-2f94c60")
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-2db6aca")}\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
+ `${colourJ("Hackmud Script Manager")}\n${colourN("Version") + colourS(": ") + colourV("0.21.1-2f94c60")}\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/env.d.ts CHANGED
@@ -703,14 +703,14 @@ type MongoObject = { [k: string]: MongoValue, [k: `$${string}`]: never }
703
703
  type MongoQueryValue = MongoPrimitive | MongoQueryValue[] | MongoQueryObject
704
704
 
705
705
  type MongoQueryObject =
706
- { [k: string]: MongoQueryValue, [k: `$${string}`]: MongoValue, $type?: keyof MongoTypeStringsToTypes | (string & {}) }
706
+ { [k: string]: MongoQueryValue, [k: `$${string}`]: MongoValue } & { $type?: keyof MongoTypeStringsToTypes | (string & {}) }
707
707
 
708
708
  type MongoTypeStringsToTypes = {
709
709
  double: number
710
710
  string: string
711
711
  object: MongoObject
712
712
  array: MongoValue[]
713
- objectId: ObjectId
713
+ objectId: MongoObjectId
714
714
  bool: boolean
715
715
  date: Date
716
716
  null: null
@@ -720,8 +720,8 @@ type MongoTypeStringsToTypes = {
720
720
 
721
721
  type MongoTypeString = keyof MongoTypeStringsToTypes
722
722
  type MongoTypeNumber = -1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 127
723
- type MongoId = Exclude<MongoPrimitive, null> | MongoObject
724
- type MongoQueryId = Exclude<MongoPrimitive, null> | MongoQueryObject
723
+ type MongoId = Exclude<MongoPrimitive, null | false> | MongoObjectId | MongoObject
724
+ type MongoQueryId = Exclude<MongoPrimitive, null | false> | MongoObjectId | MongoQueryObject
725
725
  type MongoDocument = MongoObject & { _id?: MongoId }
726
726
 
727
727
  type MongoQueryType<TQuery extends MongoQueryObject> = {
@@ -865,8 +865,8 @@ type BrainContext = Replace<CliContext, { /** Whether the script is being run vi
865
865
  // when anyField: true is given, other fields (except _id) are omitted
866
866
 
867
867
  type MongoProject<TDocument, TProjection> =
868
- true extends (1 extends TProjection[keyof TProjection] ? true : TProjection[keyof TProjection]) ?
869
- (TProjection extends { _id: false | 0 } ? {} : { _id: TDocument extends { _id: infer TId } ? TId : MongoId }) &
868
+ (TProjection extends { _id: false | 0 } ? {} : { _id: TDocument extends { _id: infer TId } ? TId : MongoId }) & (
869
+ true extends (1 extends TProjection[keyof TProjection] ? true : TProjection[keyof TProjection]) ?
870
870
  {
871
871
  [K in
872
872
  keyof TDocument as K extends keyof TProjection ? TProjection[K] extends true | 1 ? K : never : never
@@ -877,7 +877,8 @@ type MongoProject<TDocument, TProjection> =
877
877
  keyof TProjection as TProjection[K] extends true | 1 ? K extends keyof TDocument ? never : K : never
878
878
  ]?: MongoValue
879
879
  }
880
- : { [k: string]: MongoValue } & { [K in keyof TDocument as K extends keyof TProjection ? never : K]: TDocument[K] }
880
+ : { [k: string]: MongoValue } & { [K in keyof TDocument as K extends keyof TProjection ? never : K]: TDocument[K] }
881
+ )
881
882
 
882
883
  type DeepFreeze<T> = { readonly [P in keyof T]: DeepFreeze<T[P]> }
883
884
 
@@ -885,9 +886,9 @@ declare global {
885
886
  type ScriptSuccess<T = unknown> = { ok: true } & T
886
887
  type ScriptFailure = { ok: false, msg?: string }
887
888
  type ScriptResponse<T = unknown> = ScriptSuccess<T> | ScriptFailure
888
- type Scriptor<TArgs extends any[] = any[]> = { name: string, call: (...args: TArgs) => unknown }
889
+ type Scriptor<TArgs = any> = { name: string, call: (args: TArgs) => unknown }
889
890
  type Context = CliContext | SubscriptContext | ScriptorContext | BrainContext
890
- type ObjectId = { $oid: string }
891
+ type MongoObjectId = { $oid: string }
891
892
 
892
893
  interface PlayerFullsec {}
893
894
  interface PlayerHighsec {}
@@ -978,7 +979,7 @@ declare global {
978
979
  us: <T extends MongoDocument>(query: MongoQuery<T> | MongoQuery<T>[], command: MongoUpdateCommand<T>) =>
979
980
  { n: number, ok: 0 | 1, opTime: { t: number }, nModified: number }[]
980
981
 
981
- ObjectId: () => ObjectId
982
+ ObjectId: () => MongoObjectId
982
983
  }
983
984
 
984
985
  /** Debug Log.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hackmud-script-manager",
3
- "version": "0.21.1-2db6aca",
3
+ "version": "0.21.1-2f94c60",
4
4
  "description": "Script manager for game hackmud, with minification, TypeScript support, and player script type definition generation.",
5
5
  "keywords": [
6
6
  "api",
package/watch.js CHANGED
@@ -133,10 +133,19 @@ async function watch(
133
133
  try {
134
134
  ;({ script: minifiedCode, warnings } = await processScript(
135
135
  await readFile(filePath, { encoding: "utf8" }),
136
- { minify, scriptUser: !0, scriptName, uniqueId, filePath, mangleNames, forceQuineCheats }
136
+ {
137
+ minify,
138
+ scriptUser: !0,
139
+ scriptName,
140
+ uniqueId,
141
+ filePath,
142
+ mangleNames,
143
+ forceQuineCheats,
144
+ rootFolderPath
145
+ }
137
146
  ))
138
147
  } catch (error) {
139
- assert(error instanceof Error, "src/watch.ts:151:36")
148
+ assert(error instanceof Error, "src/watch.ts:160:36")
140
149
  onPush?.({ path, users: [], characterCount: 0, error, warnings: [] })
141
150
  return
142
151
  }
@@ -184,7 +193,7 @@ async function watch(
184
193
  rootFolderPath
185
194
  }))
186
195
  } catch (error) {
187
- assert(error instanceof Error, "src/watch.ts:198:35")
196
+ assert(error instanceof Error, "src/watch.ts:207:35")
188
197
  onPush?.({ path, users: [], characterCount: 0, error, warnings: [] })
189
198
  return
190
199
  }
@@ -199,7 +208,7 @@ async function watch(
199
208
  try {
200
209
  await writeFile(typeDeclarationPath, typeDeclaration)
201
210
  } catch (error) {
202
- assert(error instanceof Error, "src/watch.ts:231:35")
211
+ assert(error instanceof Error, "src/watch.ts:240:35")
203
212
  if ("EISDIR" != error.code) throw error
204
213
  typeDeclarationPath = resolve(typeDeclarationPath, "player.d.ts")
205
214
  await writeFile(typeDeclarationPath, typeDeclaration)