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,5 +1,5 @@
1
- import { readDirectoryWithStats } from "@samual/lib/readDirectoryWithStats"
2
1
  import { basename, resolve } from "path"
2
+ import { readDirectoryWithStats } from "@samual/lib/readDirectoryWithStats"
3
3
  async function generateTypeDeclaration(sourceDirectory, hackmudPath) {
4
4
  const users = new Set()
5
5
  if (hackmudPath)
package/index.js CHANGED
@@ -5,8 +5,8 @@ export { pull } from "./pull.js"
5
5
  export { push } from "./push.js"
6
6
  export { syncMacros } from "./syncMacros.js"
7
7
  export { watch } from "./watch.js"
8
- import "@samual/lib/readDirectoryWithStats"
9
8
  import "path"
9
+ import "@samual/lib/readDirectoryWithStats"
10
10
  import "@babel/generator"
11
11
  import "@babel/parser"
12
12
  import "@babel/plugin-proposal-decorators"
@@ -46,7 +46,7 @@ import "import-meta-resolve"
46
46
  import "./processScript/transform.js"
47
47
  import "@samual/lib/clearObject"
48
48
  import "@samual/lib/copyFilePersistent"
49
+ import "fs/promises"
49
50
  import "@samual/lib/AutoMap"
50
51
  import "@samual/lib/writeFilePersistent"
51
- import "fs/promises"
52
52
  import "chokidar"
package/package.json CHANGED
@@ -1,7 +1,22 @@
1
1
  {
2
2
  "name": "hackmud-script-manager",
3
- "version": "0.21.1-d4bf990",
3
+ "type": "module",
4
+ "version": "0.21.1-e3e8246",
4
5
  "description": "Script manager for game hackmud, with minification, TypeScript support, and player script type definition generation.",
6
+ "author": "Samual Norman <me@samual.uk> (https://samual.uk/)",
7
+ "contributors": [
8
+ "Daniel Swann (https://github.com/danswann)",
9
+ "Longboyy",
10
+ "Helloman892",
11
+ "Sarah Klocke (https://sarahisweird.dev/)"
12
+ ],
13
+ "license": "MIT",
14
+ "homepage": "https://github.com/samualtnorman/hackmud-script-manager#readme",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/samualtnorman/hackmud-script-manager.git"
18
+ },
19
+ "bugs": "https://github.com/samualtnorman/hackmud-script-manager/issues",
5
20
  "keywords": [
6
21
  "api",
7
22
  "command-line",
@@ -17,20 +32,17 @@
17
32
  "golf",
18
33
  "golfer"
19
34
  ],
20
- "homepage": "https://github.com/samualtnorman/hackmud-script-manager#readme",
21
- "bugs": "https://github.com/samualtnorman/hackmud-script-manager/issues",
22
- "license": "MIT",
23
- "author": "Samual Norman <me@samual.uk> (https://samual.uk/)",
24
- "contributors": [
25
- "Daniel Swann (https://github.com/danswann)",
26
- "Longboyy",
27
- "Helloman892",
28
- "Sarah Klocke (https://sarahisweird.dev/)"
29
- ],
35
+ "exports": {
36
+ ".": "./index.js",
37
+ "./*": "./*.js",
38
+ "./*.js": "./*.js"
39
+ },
30
40
  "main": "index.js",
31
- "repository": {
32
- "type": "git",
33
- "url": "https://github.com/samualtnorman/hackmud-script-manager.git"
41
+ "bin": {
42
+ "hsm": "bin/hsm.js"
43
+ },
44
+ "peerDependencies": {
45
+ "typescript": "^5.4.5"
34
46
  },
35
47
  "dependencies": {
36
48
  "@babel/generator": "^7.26.2",
@@ -76,18 +88,6 @@
76
88
  "rollup": "^4.27.4",
77
89
  "terser": "^5.36.0"
78
90
  },
79
- "peerDependencies": {
80
- "typescript": "^5.4.5"
81
- },
82
- "type": "module",
83
- "exports": {
84
- ".": "./index.js",
85
- "./*": "./*.js",
86
- "./*.js": "./*.js"
87
- },
88
- "bin": {
89
- "hsm": "bin/hsm.js"
90
- },
91
91
  "engines": {
92
92
  "node": "^18 || >=20"
93
93
  }
@@ -9,20 +9,23 @@ export type ProcessOptions = LaxPartial<{
9
9
  /** the user going to be hosting this script (or set to `true` if not yet known) */ scriptUser: string | true;
10
10
  filePath: string;
11
11
  /** whether to mangle function and class names (defaults to `false`) */ mangleNames: boolean;
12
- /** when set to `true` forces use of quine cheats
13
- *
14
- * when set to `false` forces quine cheats not to be used
15
- *
16
- * when left unset or set to `undefined`, automatically uses or doesn't use quine cheats based on character count
17
- */
12
+ /**
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
+ */
18
19
  forceQuineCheats: boolean;
19
20
  rootFolderPath: string;
20
21
  }> & {
21
22
  scriptName: string | true;
22
23
  };
23
- /** Minifies a given script
24
- * @param code JavaScript or TypeScript code
25
- * @param options {@link ProcessOptions details} */
24
+ /**
25
+ * Minifies a given script
26
+ * @param code JavaScript or TypeScript code
27
+ * @param options {@link ProcessOptions details}
28
+ */
26
29
  export declare function processScript(code: string, { minify: shouldMinify, uniqueId, scriptUser, scriptName, filePath, mangleNames, forceQuineCheats, rootFolderPath }: ProcessOptions): Promise<{
27
30
  script: string;
28
31
  warnings: {
@@ -1,21 +1,22 @@
1
- import awpz3osbzbgie0diqla53jdp from "@babel/generator"
1
+ import { relative, isAbsolute, sep } from "path"
2
+ import n3ha3edvh5zk1ro8veo8wvy2 from "@babel/generator"
2
3
  import { parse } from "@babel/parser"
3
- import n7j5rk65x3x68f0977sx3p32 from "@babel/plugin-proposal-decorators"
4
- import ta0frirmi3s2jq08l6cht3uk from "@babel/plugin-proposal-destructuring-private"
5
- import k3l88m4rzomnxi1nyaws0uf4 from "@babel/plugin-proposal-explicit-resource-management"
6
- import d8vrbov1hvzild8irq5ej6a5 from "@babel/plugin-transform-class-properties"
7
- import yluenyq31jclk2gspvfqqhdw from "@babel/plugin-transform-class-static-block"
8
- import s83tktwy1wj5yii2modwcpsu from "@babel/plugin-transform-exponentiation-operator"
9
- import gjxa6uc9geesg3fse9p6nz2t from "@babel/plugin-transform-json-strings"
10
- import hpo770a0fczabe5gqnfx5zuh from "@babel/plugin-transform-logical-assignment-operators"
11
- import kzbxvgtuqrrh91fwlvcsrheu from "@babel/plugin-transform-nullish-coalescing-operator"
12
- import meo269rn6bx4ct4wluvbjqan from "@babel/plugin-transform-numeric-separator"
13
- import o997fnadhqb0j0fcvivsfr58 from "@babel/plugin-transform-object-rest-spread"
14
- import sy7mwdqgoccmlrptsvyavb2g from "@babel/plugin-transform-optional-catch-binding"
15
- import ylulmkigu6sywpswowfw2ont from "@babel/plugin-transform-optional-chaining"
16
- import apo7v29f7l9cy104xqjwyavh from "@babel/plugin-transform-private-property-in-object"
17
- import e4n14nj86a5rtu8hkil6ioxe from "@babel/plugin-transform-unicode-sets-regex"
18
- import ons4yi64j2vp9u6vpqkt1emx from "@babel/traverse"
4
+ import je9pzbbof1st6boak6d6crsm from "@babel/plugin-proposal-decorators"
5
+ import lwclo4xmm1gq7llijvl8grh6 from "@babel/plugin-proposal-destructuring-private"
6
+ import lh8vcuevzb86egw39i6x76dq from "@babel/plugin-proposal-explicit-resource-management"
7
+ import sxewr76clr9u1q17stritg0q from "@babel/plugin-transform-class-properties"
8
+ import w6byfi8co37l9dijjqtjhfhr from "@babel/plugin-transform-class-static-block"
9
+ import mvg1lyd8g0iisgneo8zt29v7 from "@babel/plugin-transform-exponentiation-operator"
10
+ import wiq63d0b3jzmtftmi5tuy94k from "@babel/plugin-transform-json-strings"
11
+ import rc0486b8bqf6tbxnw4g39i6x from "@babel/plugin-transform-logical-assignment-operators"
12
+ import s232f7y5ripv8oyf5f2bx1qi from "@babel/plugin-transform-nullish-coalescing-operator"
13
+ import f9ajkvv5ikiihcmh8ccayzlb from "@babel/plugin-transform-numeric-separator"
14
+ import txw5yspnpyviihdg8s33iz0s from "@babel/plugin-transform-object-rest-spread"
15
+ import hsvriafkupocvvxakbzsaf3o from "@babel/plugin-transform-optional-catch-binding"
16
+ import kovmcpnhh7cttg1pxob2wz9o from "@babel/plugin-transform-optional-chaining"
17
+ import ax3pa6k08o1mieqfjlhn3sp7 from "@babel/plugin-transform-private-property-in-object"
18
+ import vnpgmdb3g8bdstmihe50nrap from "@babel/plugin-transform-unicode-sets-regex"
19
+ import kwmn7lp0r5s0ul58gd0l3ldw from "@babel/traverse"
19
20
  import t from "@babel/types"
20
21
  import rollupPluginAlias from "@rollup/plugin-alias"
21
22
  import { babel } from "@rollup/plugin-babel"
@@ -23,7 +24,6 @@ import rollupPluginCommonJS from "@rollup/plugin-commonjs"
23
24
  import rollupPluginJSON from "@rollup/plugin-json"
24
25
  import rollupPluginNodeResolve from "@rollup/plugin-node-resolve"
25
26
  import { assert } from "@samual/lib/assert"
26
- import { relative, isAbsolute, sep } from "path"
27
27
  import prettier from "prettier"
28
28
  import { rollup } from "rollup"
29
29
  import { supportedExtensions } from "../constants.js"
@@ -38,23 +38,23 @@ import "acorn"
38
38
  import "terser"
39
39
  import "import-meta-resolve"
40
40
  import "@samual/lib/clearObject"
41
- const generate = awpz3osbzbgie0diqla53jdp.default,
42
- babelPluginProposalDecorators = n7j5rk65x3x68f0977sx3p32.default,
43
- babelPluginProposalDestructuringPrivate = ta0frirmi3s2jq08l6cht3uk.default,
44
- babelPluginProposalExplicitResourceManagement = k3l88m4rzomnxi1nyaws0uf4.default,
45
- babelPluginTransformClassProperties = d8vrbov1hvzild8irq5ej6a5.default,
46
- babelPluginTransformClassStaticBlock = yluenyq31jclk2gspvfqqhdw.default,
47
- babelPluginTransformExponentiationOperator = s83tktwy1wj5yii2modwcpsu.default,
48
- babelPluginTransformJsonStrings = gjxa6uc9geesg3fse9p6nz2t.default,
49
- babelPluginTransformLogicalAssignmentOperators = hpo770a0fczabe5gqnfx5zuh.default,
50
- babelPluginTransformNullishCoalescingOperator = kzbxvgtuqrrh91fwlvcsrheu.default,
51
- babelPluginTransformNumericSeparator = meo269rn6bx4ct4wluvbjqan.default,
52
- babelPluginTransformObjectRestSpread = o997fnadhqb0j0fcvivsfr58.default,
53
- babelPluginTransformOptionalCatchBinding = sy7mwdqgoccmlrptsvyavb2g.default,
54
- babelPluginTransformOptionalChaining = ylulmkigu6sywpswowfw2ont.default,
55
- babelPluginTransformPrivatePropertyInObject = apo7v29f7l9cy104xqjwyavh.default,
56
- babelPluginTransformUnicodeSetsRegex = e4n14nj86a5rtu8hkil6ioxe.default,
57
- traverse = ons4yi64j2vp9u6vpqkt1emx.default,
41
+ const generate = n3ha3edvh5zk1ro8veo8wvy2.default,
42
+ babelPluginProposalDecorators = je9pzbbof1st6boak6d6crsm.default,
43
+ babelPluginProposalDestructuringPrivate = lwclo4xmm1gq7llijvl8grh6.default,
44
+ babelPluginProposalExplicitResourceManagement = lh8vcuevzb86egw39i6x76dq.default,
45
+ babelPluginTransformClassProperties = sxewr76clr9u1q17stritg0q.default,
46
+ babelPluginTransformClassStaticBlock = w6byfi8co37l9dijjqtjhfhr.default,
47
+ babelPluginTransformExponentiationOperator = mvg1lyd8g0iisgneo8zt29v7.default,
48
+ babelPluginTransformJsonStrings = wiq63d0b3jzmtftmi5tuy94k.default,
49
+ babelPluginTransformLogicalAssignmentOperators = rc0486b8bqf6tbxnw4g39i6x.default,
50
+ babelPluginTransformNullishCoalescingOperator = s232f7y5ripv8oyf5f2bx1qi.default,
51
+ babelPluginTransformNumericSeparator = f9ajkvv5ikiihcmh8ccayzlb.default,
52
+ babelPluginTransformObjectRestSpread = txw5yspnpyviihdg8s33iz0s.default,
53
+ babelPluginTransformOptionalCatchBinding = hsvriafkupocvvxakbzsaf3o.default,
54
+ babelPluginTransformOptionalChaining = kovmcpnhh7cttg1pxob2wz9o.default,
55
+ babelPluginTransformPrivatePropertyInObject = ax3pa6k08o1mieqfjlhn3sp7.default,
56
+ babelPluginTransformUnicodeSetsRegex = vnpgmdb3g8bdstmihe50nrap.default,
57
+ traverse = kwmn7lp0r5s0ul58gd0l3ldw.default,
58
58
  { format } = prettier
59
59
  async function processScript(
60
60
  code,
@@ -71,7 +71,7 @@ async function processScript(
71
71
  rootFolderPath
72
72
  }
73
73
  ) {
74
- assert(/^\w{11}$/.exec(uniqueId), "src/processScript/index.ts:78:36")
74
+ assert(/^\w{11}$/.exec(uniqueId), "src/processScript/index.ts:82:36")
75
75
  const sourceCode = code
76
76
  let autocomplete, statedSeclevel
77
77
  const autocompleteMatch = /^function\s*\(.+\/\/(?<autocomplete>.+)/.exec(code)
@@ -132,7 +132,7 @@ async function processScript(
132
132
  }
133
133
  }
134
134
  }
135
- assert(/^\w{11}$/.exec(uniqueId), "src/processScript/index.ts:159:36")
135
+ assert(/^\w{11}$/.exec(uniqueId), "src/processScript/index.ts:161:36")
136
136
  const plugins = [
137
137
  [babelPluginProposalDecorators, { decoratorsBeforeExport: !0 }],
138
138
  [babelPluginTransformClassProperties],
@@ -224,7 +224,14 @@ async function processScript(
224
224
  rollupPluginJSON({ preferConst: !0 }),
225
225
  {
226
226
  name: "hackmud-script-manager",
227
+ resolveId(source) {
228
+ if (source == filePathResolved) return filePathResolved
229
+ },
230
+ async load(id) {
231
+ if (id == filePathResolved) return (await preprocess(code, { uniqueId })).code
232
+ },
227
233
  async transform(code, id) {
234
+ if (id == filePathResolved) return
228
235
  if (isAbsolute(id) && !id.includes(`${sep}node_modules${sep}`))
229
236
  return (await preprocess(code, { uniqueId })).code
230
237
  let program
@@ -268,7 +275,7 @@ async function processScript(
268
275
  traverse(file, {
269
276
  MemberExpression({ node: memberExpression }) {
270
277
  if (!memberExpression.computed) {
271
- assert("Identifier" == memberExpression.property.type, "src/processScript/index.ts:323:60")
278
+ assert("Identifier" == memberExpression.property.type, "src/processScript/index.ts:336:60")
272
279
  if ("prototype" == memberExpression.property.name) {
273
280
  memberExpression.computed = !0
274
281
  memberExpression.property = t.stringLiteral("prototype")
@@ -298,7 +305,7 @@ async function processScript(
298
305
  break
299
306
  case "ObjectPattern":
300
307
  for (const property of lValue.properties) {
301
- assert("ObjectProperty" == property.type, "src/processScript/index.ts:353:51")
308
+ assert("ObjectProperty" == property.type, "src/processScript/index.ts:367:51")
302
309
  renameVariables(property.value)
303
310
  }
304
311
  break
@@ -3,16 +3,19 @@ import type { LaxPartial } from "@samual/lib";
3
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
- /** when set to `true` forces use of quine cheats
7
- *
8
- * when set to `false` forces quine cheats not to be used
9
- *
10
- * when left unset or set to `undefined`, automatically uses or doesn't use quine cheats based on character count
11
- */
6
+ /**
7
+ * when set to `true` forces use of quine cheats
8
+ *
9
+ * when set to `false` forces quine cheats not to be used
10
+ *
11
+ * when left unset or set to `undefined`, automatically uses or doesn't use quine cheats based on character count
12
+ */
12
13
  forceQuineCheats: boolean;
13
14
  /** the comment inserted after the function signature */ autocomplete: string;
14
15
  }>;
15
- /** @param file babel ast node representing a file containing transformed code
16
- * @param options {@link MinifyOptions details} */
16
+ /**
17
+ * @param file babel ast node representing a file containing transformed code
18
+ * @param options {@link MinifyOptions details}
19
+ */
17
20
  export declare function minify(file: File, { uniqueId, mangleNames, forceQuineCheats, autocomplete }?: MinifyOptions): Promise<string>;
18
21
  export {};
@@ -1,5 +1,5 @@
1
- import awpz3osbzbgie0diqla53jdp from "@babel/generator"
2
- import ons4yi64j2vp9u6vpqkt1emx from "@babel/traverse"
1
+ import n3ha3edvh5zk1ro8veo8wvy2 from "@babel/generator"
2
+ import kwmn7lp0r5s0ul58gd0l3ldw from "@babel/traverse"
3
3
  import t from "@babel/types"
4
4
  import { assert } from "@samual/lib/assert"
5
5
  import { countHackmudCharacters } from "@samual/lib/countHackmudCharacters"
@@ -7,12 +7,12 @@ import { spliceString } from "@samual/lib/spliceString"
7
7
  import { tokenizer, tokTypes } from "acorn"
8
8
  import * as terser from "terser"
9
9
  import { getReferencePathsToGlobal, includesIllegalString, replaceUnsafeStrings } from "./shared.js"
10
- const generate = awpz3osbzbgie0diqla53jdp.default,
11
- traverse = ons4yi64j2vp9u6vpqkt1emx.default,
10
+ const generate = n3ha3edvh5zk1ro8veo8wvy2.default,
11
+ traverse = kwmn7lp0r5s0ul58gd0l3ldw.default,
12
12
  minifyNumber = async number =>
13
13
  /\$\((?<number>.+)\)/.exec((await terser.minify(`$(${number})`, { ecma: 2015 })).code).groups.number
14
14
  async function minify(file, { uniqueId = "00000000000", mangleNames = !1, forceQuineCheats, autocomplete } = {}) {
15
- assert(/^\w{11}$/.exec(uniqueId), "src/processScript/minify.ts:41:36")
15
+ assert(/^\w{11}$/.exec(uniqueId), "src/processScript/minify.ts:45:36")
16
16
  let program
17
17
  traverse(file, {
18
18
  Program(path) {
@@ -52,7 +52,7 @@ async function minify(file, { uniqueId = "00000000000", mangleNames = !1, forceQ
52
52
  traverse(fileBeforeJSONValueReplacement, {
53
53
  MemberExpression({ node: memberExpression }) {
54
54
  if (!memberExpression.computed) {
55
- assert("Identifier" == memberExpression.property.type, "src/processScript/minify.ts:110:60")
55
+ assert("Identifier" == memberExpression.property.type, "src/processScript/minify.ts:113:60")
56
56
  if ("prototype" == memberExpression.property.name) {
57
57
  memberExpression.computed = !0
58
58
  memberExpression.property = t.identifier(`_${uniqueId}_PROTOTYPE_PROPERTY_`)
@@ -164,7 +164,7 @@ async function minify(file, { uniqueId = "00000000000", mangleNames = !1, forceQ
164
164
  },
165
165
  MemberExpression({ node: memberExpression }) {
166
166
  if (!memberExpression.computed) {
167
- assert("Identifier" == memberExpression.property.type, "src/processScript/minify.ts:244:62")
167
+ assert("Identifier" == memberExpression.property.type, "src/processScript/minify.ts:248:62")
168
168
  if (!(memberExpression.property.name.length < 3)) {
169
169
  memberExpression.computed = !0
170
170
  memberExpression.property = t.stringLiteral(memberExpression.property.name)
@@ -238,7 +238,7 @@ async function minify(file, { uniqueId = "00000000000", mangleNames = !1, forceQ
238
238
  })
239
239
  await Promise.all(promises)
240
240
  const functionDeclaration = file.program.body[0]
241
- assert("FunctionDeclaration" == functionDeclaration.type, "src/processScript/minify.ts:349:61")
241
+ assert("FunctionDeclaration" == functionDeclaration.type, "src/processScript/minify.ts:350:61")
242
242
  if (jsonValues.length) {
243
243
  hasComment = !0
244
244
  if (1 == jsonValues.length)
@@ -358,7 +358,7 @@ async function minify(file, { uniqueId = "00000000000", mangleNames = !1, forceQ
358
358
  )
359
359
  }
360
360
  if (1 == forceQuineCheats) return code
361
- assert(scriptBeforeJSONValueReplacement, "src/processScript/minify.ts:480:43")
361
+ assert(scriptBeforeJSONValueReplacement, "src/processScript/minify.ts:481:43")
362
362
  return countHackmudCharacters(scriptBeforeJSONValueReplacement) <= countHackmudCharacters(code) + Number(hasComment)
363
363
  ? scriptBeforeJSONValueReplacement
364
364
  : code
@@ -371,7 +371,7 @@ function parseObjectExpression(node, o) {
371
371
  "Identifier" == property.key.type ||
372
372
  "NumericLiteral" == property.key.type ||
373
373
  "StringLiteral" == property.key.type,
374
- "src/processScript/minify.ts:502:4"
374
+ "src/processScript/minify.ts:503:4"
375
375
  )
376
376
  if ("ArrayExpression" == property.value.type) {
377
377
  const childArray = []
@@ -2,8 +2,10 @@ import type { LaxPartial } from "@samual/lib";
2
2
  export type PreprocessOptions = LaxPartial<{
3
3
  uniqueId: string;
4
4
  }>;
5
- /** @param code source code for preprocessing
6
- * @param options {@link PreprocessOptions details} */
5
+ /**
6
+ * @param code source code for preprocessing
7
+ * @param options {@link PreprocessOptions details}
8
+ */
7
9
  export declare function preprocess(code: string, { uniqueId }?: PreprocessOptions): Promise<{
8
10
  code: string;
9
11
  }>;
@@ -1,14 +1,14 @@
1
- import awpz3osbzbgie0diqla53jdp from "@babel/generator"
1
+ import n3ha3edvh5zk1ro8veo8wvy2 from "@babel/generator"
2
2
  import { parse } from "@babel/parser"
3
- import ons4yi64j2vp9u6vpqkt1emx from "@babel/traverse"
3
+ import kwmn7lp0r5s0ul58gd0l3ldw 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
7
  import { resolve } from "import-meta-resolve"
8
- const generate = awpz3osbzbgie0diqla53jdp.default,
9
- traverse = ons4yi64j2vp9u6vpqkt1emx.default
8
+ const generate = n3ha3edvh5zk1ro8veo8wvy2.default,
9
+ traverse = kwmn7lp0r5s0ul58gd0l3ldw.default
10
10
  async function preprocess(code, { uniqueId = "00000000000" } = {}) {
11
- assert(/^\w{11}$/.test(uniqueId), "src/processScript/preprocess.ts:18:36")
11
+ assert(/^\w{11}$/.test(uniqueId), "src/processScript/preprocess.ts:20:36")
12
12
  const sourceCode = code
13
13
  let lengthBefore, file, program
14
14
  do {
@@ -47,11 +47,11 @@ async function preprocess(code, { uniqueId = "00000000000" } = {}) {
47
47
  })
48
48
  break
49
49
  } catch (error_) {
50
- assert(error_ instanceof SyntaxError, "src/processScript/preprocess.ts:62:42")
50
+ assert(error_ instanceof SyntaxError, "src/processScript/preprocess.ts:64:42")
51
51
  error = error_
52
52
  }
53
53
  if ("BABEL_PARSER_SYNTAX_ERROR" != error.code || "PrivateInExpectedIn" != error.reasonCode) {
54
- console.log(/.+/.exec(code.slice(error.pos))?.[0])
54
+ console.error(/.+/.exec(code.slice(error.pos))?.[0])
55
55
  throw error
56
56
  }
57
57
  const codeSlice = code.slice(error.pos)
@@ -7,12 +7,14 @@ export type TransformOptions = LaxPartial<{
7
7
  }> & {
8
8
  scriptName: string | true;
9
9
  };
10
- /** transform a given babel `File` to be hackmud compatible
11
- *
12
- * (returned File will need `postprocess()`ing)
13
- * @param file babel ast node representing a file containing preprocessed code
14
- * @param sourceCode the original untouched source code
15
- * @param options {@link TransformOptions details} */
10
+ /**
11
+ * transform a given babel `File` to be hackmud compatible
12
+ *
13
+ * (returned File will need `postprocess()`ing)
14
+ * @param file babel ast node representing a file containing preprocessed code
15
+ * @param sourceCode the original untouched source code
16
+ * @param options {@link TransformOptions details}
17
+ */
16
18
  export declare function transform(file: File, sourceCode: string, { uniqueId, scriptUser, scriptName, seclevel }: TransformOptions): {
17
19
  file: File;
18
20
  seclevel: number;