factoriomod-debug 2.0.4 → 2.0.6

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.
@@ -0,0 +1,7 @@
1
+
2
+ import {createRequire} from 'module'
3
+ const require = createRequire(import.meta.url)
4
+
5
+ import{i as F,j as U}from"./chunk-ZLQDNPPN.js";var f=0,t={START_BOUNDARY:f++,HEADER_FIELD_START:f++,HEADER_FIELD:f++,HEADER_VALUE_START:f++,HEADER_VALUE:f++,HEADER_VALUE_ALMOST_DONE:f++,HEADERS_ALMOST_DONE:f++,PART_DATA_START:f++,PART_DATA:f++,END:f++},w=1,_={PART_BOUNDARY:w,LAST_BOUNDARY:w*=2},O=10,g=13,B=32,m=45,V=58,Y=97,x=122,C=u=>u|32,R=()=>{},y=class{constructor(o){this.index=0,this.flags=0,this.onHeaderEnd=R,this.onHeaderField=R,this.onHeadersEnd=R,this.onHeaderValue=R,this.onPartBegin=R,this.onPartData=R,this.onPartEnd=R,this.boundaryChars={},o=`\r
6
+ --`+o;let n=new Uint8Array(o.length);for(let r=0;r<o.length;r++)n[r]=o.charCodeAt(r),this.boundaryChars[n[r]]=!0;this.boundary=n,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=t.START_BOUNDARY}write(o){let n=0,r=o.length,E=this.index,{lookbehind:l,boundary:d,boundaryChars:H,index:e,state:i,flags:A}=this,b=this.boundary.length,p=b-1,N=o.length,a,S,h=c=>{this[c+"Mark"]=n},s=c=>{delete this[c+"Mark"]},D=(c,P,T,k)=>{(P===void 0||P!==T)&&this[c](k&&k.subarray(P,T))},L=(c,P)=>{let T=c+"Mark";T in this&&(P?(D(c,this[T],n,o),delete this[T]):(D(c,this[T],o.length,o),this[T]=0))};for(n=0;n<r;n++)switch(a=o[n],i){case t.START_BOUNDARY:if(e===d.length-2){if(a===m)A|=_.LAST_BOUNDARY;else if(a!==g)return;e++;break}else if(e-1===d.length-2){if(A&_.LAST_BOUNDARY&&a===m)i=t.END,A=0;else if(!(A&_.LAST_BOUNDARY)&&a===O)e=0,D("onPartBegin"),i=t.HEADER_FIELD_START;else return;break}a!==d[e+2]&&(e=-2),a===d[e+2]&&e++;break;case t.HEADER_FIELD_START:i=t.HEADER_FIELD,h("onHeaderField"),e=0;case t.HEADER_FIELD:if(a===g){s("onHeaderField"),i=t.HEADERS_ALMOST_DONE;break}if(e++,a===m)break;if(a===V){if(e===1)return;L("onHeaderField",!0),i=t.HEADER_VALUE_START;break}if(S=C(a),S<Y||S>x)return;break;case t.HEADER_VALUE_START:if(a===B)break;h("onHeaderValue"),i=t.HEADER_VALUE;case t.HEADER_VALUE:a===g&&(L("onHeaderValue",!0),D("onHeaderEnd"),i=t.HEADER_VALUE_ALMOST_DONE);break;case t.HEADER_VALUE_ALMOST_DONE:if(a!==O)return;i=t.HEADER_FIELD_START;break;case t.HEADERS_ALMOST_DONE:if(a!==O)return;D("onHeadersEnd"),i=t.PART_DATA_START;break;case t.PART_DATA_START:i=t.PART_DATA,h("onPartData");case t.PART_DATA:if(E=e,e===0){for(n+=p;n<N&&!(o[n]in H);)n+=b;n-=p,a=o[n]}if(e<d.length)d[e]===a?(e===0&&L("onPartData",!0),e++):e=0;else if(e===d.length)e++,a===g?A|=_.PART_BOUNDARY:a===m?A|=_.LAST_BOUNDARY:e=0;else if(e-1===d.length)if(A&_.PART_BOUNDARY){if(e=0,a===O){A&=~_.PART_BOUNDARY,D("onPartEnd"),D("onPartBegin"),i=t.HEADER_FIELD_START;break}}else A&_.LAST_BOUNDARY&&a===m?(D("onPartEnd"),i=t.END,A=0):e=0;if(e>0)l[e-1]=a;else if(E>0){let c=new Uint8Array(l.buffer,l.byteOffset,l.byteLength);D("onPartData",0,E,c),E=0,h("onPartData"),n--}break;case t.END:break;default:throw new Error(`Unexpected state entered: ${i}`)}L("onHeaderField"),L("onHeaderValue"),L("onPartData"),this.index=e,this.state=i,this.flags=A}end(){if(this.state===t.HEADER_FIELD_START&&this.index===0||this.state===t.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==t.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}};function I(u){let o=u.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!o)return;let n=o[2]||o[3]||"",r=n.slice(n.lastIndexOf("\\")+1);return r=r.replace(/%22/g,'"'),r=r.replace(/&#(\d{4});/g,(E,l)=>String.fromCharCode(l)),r}async function v(u,o){if(!/multipart/i.test(o))throw new TypeError("Failed to fetch");let n=o.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!n)throw new TypeError("no or bad content-type header, no multipart boundary");let r=new y(n[1]||n[2]),E,l,d,H,e,i,A=[],b=new U,p=s=>{d+=h.decode(s,{stream:!0})},N=s=>{A.push(s)},a=()=>{let s=new F(A,i,{type:e});b.append(H,s)},S=()=>{b.append(H,d)},h=new TextDecoder("utf-8");h.decode(),r.onPartBegin=function(){r.onPartData=p,r.onPartEnd=S,E="",l="",d="",H="",e="",i=null,A.length=0},r.onHeaderField=function(s){E+=h.decode(s,{stream:!0})},r.onHeaderValue=function(s){l+=h.decode(s,{stream:!0})},r.onHeaderEnd=function(){if(l+=h.decode(),E=E.toLowerCase(),E==="content-disposition"){let s=l.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);s&&(H=s[2]||s[3]||""),i=I(l),i&&(r.onPartData=N,r.onPartEnd=a)}else E==="content-type"&&(e=l);l="",E=""};for await(let s of u)r.write(s);return r.end(),b}export{v as toFormData};
7
+ //# sourceMappingURL=multipart-parser-3M5RC66T.js.map
package/doc/debugapi.md CHANGED
@@ -24,6 +24,10 @@ If normal breakpoints are unusable for some reason, you can call `__DebugAdapter
24
24
 
25
25
  `__DebugAdapter.terminate()` can be used to terminate a debug session from mod code.
26
26
 
27
+ ## Restart Session
28
+
29
+ `__DebugAdapter.restart()` can be used to restart a debug session from mod code.
30
+
27
31
  ## Simulate Events
28
32
 
29
33
  `__DebugAdapter.raise_event(event:defines.events|number|string,data:EventData,modname:string)` can be used to call event handlers directly for testing. `data` is not validated, so you must ensure it is a well-formed event payload for `event` yourself. All event and custom-input handlers are raisable, even those not raisable through `script`.
@@ -67,6 +67,7 @@ PUA U+E000-U+F8FF also available for use?
67
67
  | EE 80 8D | E00D | ~~step~~ | |
68
68
  | EE 80 8E | E00E | ~~breakpoint~~ | |
69
69
  | EE 80 8F | E00F | ~~exception~~ | |
70
+ | EE 80 90 | E010 | restart | |
70
71
 
71
72
  ## after FDD7 in buffer:
72
73
 
@@ -101,10 +101,6 @@ remote.__typed_interfaces.foo = ({
101
101
  remote.__typed_interfaces.foo.bar("arg 1", "arg 2")
102
102
  ```
103
103
 
104
- ### LuaObject Type Tests
105
-
106
- To allow the Language Server to see that `LuaObject.object_name` is "like `type()`" for type tests, such as `if obj.object_name == "LuaPlayer" then end`, the plugin rewrites it to appear as an internal function `if __object_name(obj) == "LuaPlayer" then end`, and this function is marked as "like `type()`" in the configuration.
107
-
108
104
  ### Commands
109
105
 
110
106
  In-game lua commands `/c`, `/command`, `/silent-command`, `/sc`, and `/measured-command` will be ignored at the start of any line, including the optional `__modname__` designator if present.
@@ -0,0 +1,102 @@
1
+ import { globalIgnores } from "eslint/config";
2
+ import globals from "globals";
3
+ import tseslint from 'typescript-eslint';
4
+ import stylisticTs from '@stylistic/eslint-plugin-ts';
5
+
6
+ export default tseslint.config([
7
+ globalIgnores(["dist", "coverage", "test/factorio"]),
8
+ ...tseslint.configs.recommendedTypeChecked,
9
+ {
10
+ plugins: {
11
+ "@stylistic/ts": stylisticTs,
12
+ },
13
+
14
+ languageOptions: {
15
+ globals: {
16
+ ...globals.browser,
17
+ ...globals.node,
18
+ },
19
+
20
+ ecmaVersion: 2022,
21
+ sourceType: "module",
22
+
23
+ parserOptions: {
24
+ project: "./tsconfig.json",
25
+ },
26
+ },
27
+
28
+ rules: {
29
+ "@stylistic/ts/member-delimiter-style": ["error", {
30
+ multiline: {
31
+ delimiter: "none",
32
+ requireLast: true,
33
+ },
34
+
35
+ singleline: {
36
+ delimiter: "semi",
37
+ requireLast: false,
38
+ },
39
+ }],
40
+
41
+
42
+ "@stylistic/ts/semi": ["error"],
43
+ "brace-style": ["error", "1tbs", {
44
+ allowSingleLine: true,
45
+ }],
46
+
47
+ "block-spacing": "error",
48
+ "space-before-blocks": "error",
49
+ "keyword-spacing": "error",
50
+
51
+ "arrow-spacing": ["error", {
52
+ before: false,
53
+ after: false,
54
+ }],
55
+
56
+ "switch-colon-spacing": "error",
57
+ "comma-spacing": "error",
58
+ "comma-style": "error",
59
+
60
+ "comma-dangle": ["error", {
61
+ arrays: "always-multiline",
62
+ objects: "always-multiline",
63
+ imports: "always-multiline",
64
+ exports: "always-multiline",
65
+ functions: "only-multiline",
66
+ }],
67
+
68
+ "key-spacing": "error",
69
+
70
+ indent: ["error", "tab", {
71
+ SwitchCase: 1,
72
+ flatTernaryExpressions: true,
73
+ }],
74
+
75
+ curly: "error",
76
+ eqeqeq: ["error", "always"],
77
+ "no-bitwise": "error",
78
+ "no-redeclare": "off",
79
+ "@typescript-eslint/no-redeclare": "error",
80
+
81
+ "@typescript-eslint/no-unused-vars": "off",
82
+ "@typescript-eslint/no-explicit-any": "off",
83
+ "@typescript-eslint/no-unsafe-assignment": "off",
84
+ "@typescript-eslint/no-unsafe-member-access": "off",
85
+ "@typescript-eslint/no-unsafe-call": "off",
86
+ "@typescript-eslint/no-unsafe-return": "off",
87
+ "@typescript-eslint/no-unsafe-argument": "off",
88
+ "@typescript-eslint/restrict-template-expressions": "off",
89
+
90
+ "no-var": "error",
91
+
92
+ "@typescript-eslint/consistent-type-imports": ["error", {
93
+ disallowTypeAnnotations: true,
94
+ fixStyle: 'separate-type-imports',
95
+ prefer: 'type-imports',
96
+ }],
97
+ "@typescript-eslint/consistent-type-exports": "error",
98
+
99
+ "@typescript-eslint/no-deprecated": "error",
100
+ "@typescript-eslint/no-extraneous-class": "error",
101
+ },
102
+ }]);
@@ -37,7 +37,7 @@
37
37
  }
38
38
  },
39
39
  {
40
- "match": "^ (((Major|Minor) )?Features|Graphics|Sounds|Optimi[sz]ations|(Combat )?Balancing|Circuit Network|Changes|Bugfixes|Modding|Scripting|Gui|Control|Translation|Debug|Ease of use|Info|Locale|Other):$",
40
+ "match": "^ (((Major|Minor) )?Features|Graphics|Sounds|Optimizations|(Combat )?Balancing|Circuit Network|Changes|Bugfixes|Modding|Scripting|Gui|Control|Translation|Debug|Ease of use|Info|Locale|Compatibility|Other):?$",
41
41
  "captures": {
42
42
  "1": {
43
43
  "name": "entity.name.class.factorio-changelog"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "factoriomod-debug",
3
3
  "displayName": "Factorio Modding Tool Kit",
4
- "version": "2.0.4",
4
+ "version": "2.0.6",
5
5
  "publisher": "justarandomgeek",
6
6
  "description": "Debug Tools for developing Factorio Mods",
7
7
  "author": {
@@ -13,7 +13,7 @@
13
13
  "multi-root ready"
14
14
  ],
15
15
  "engines": {
16
- "vscode": "^1.95.0",
16
+ "vscode": "^1.100.0",
17
17
  "node": ">20"
18
18
  },
19
19
  "icon": "images/factoriomod-debug-icon.png",
@@ -30,10 +30,10 @@
30
30
  "url": "https://github.com/justarandomgeek/vscode-factoriomod-debug/issues"
31
31
  },
32
32
  "scripts": {
33
- "lint": "eslint src --ext ts",
33
+ "lint": "eslint . --ext ts",
34
34
  "typecheck": "tsc -p tsconfig.json --noEmit",
35
35
  "typecheck-watch": "tsc -p tsconfig.json --noEmit --watch",
36
- "esbuild": "tsx ./build.ts",
36
+ "esbuild": "node ./build.ts",
37
37
  "watch": "npm run esbuild -- --watch",
38
38
  "stats": "npm run esbuild -- --minify --meta && esbuild-visualizer --metadata ./out/meta.json --filename ./out/stats.html",
39
39
  "vscode:prepublish": "npm run prepare",
@@ -44,62 +44,69 @@
44
44
  "test": "c8 mocha"
45
45
  },
46
46
  "devDependencies": {
47
+ "@inquirer/input": "^4.1.12",
48
+ "@inquirer/password": "^4.0.15",
49
+ "@stylistic/eslint-plugin-ts": "^4.4.1",
47
50
  "@types/archiver": "^6.0.3",
48
51
  "@types/buffers": "^0.1.34",
49
- "@types/chai": "^5.0.1",
50
- "@types/chai-as-promised": "^8.0.1",
52
+ "@types/chai": "^5.2.2",
53
+ "@types/chai-as-promised": "^8.0.2",
51
54
  "@types/d3": "^7.4.3",
52
55
  "@types/dot-object": "^2.1.6",
53
56
  "@types/ini": "^4.1.1",
54
- "@types/inquirer": "^9.0.7",
57
+ "@types/inquirer": "^9.0.8",
55
58
  "@types/mocha": "^10.0.10",
56
- "@types/node": "^22.10.1",
59
+ "@types/mute-stream": "^0.0.4",
60
+ "@types/node": "^22.15.30",
57
61
  "@types/node-fetch": "^2.6.12",
58
62
  "@types/readdir-glob": "^1.1.5",
59
63
  "@types/request": "^2.48.12",
60
- "@types/semver": "^7.5.8",
61
- "@types/vscode": "^1.95.0",
64
+ "@types/semver": "^7.7.0",
65
+ "@types/vscode": "^1.100.0",
62
66
  "@types/vscode-webview": "^1.57.5",
63
67
  "@vscode/codicons": "^0.0.36",
64
68
  "@vscode/debugadapter": "^1.68.0",
65
69
  "@vscode/debugadapter-testsupport": "^1.68.0",
66
- "@vscode/vsce": "^3.2.1",
70
+ "@vscode/vsce": "^3.5.0",
67
71
  "@vscode/webview-ui-toolkit": "^1.4.0",
68
72
  "archiver": "^7.0.1",
69
- "c8": "^10.1.2",
70
- "chai": "^5.1.2",
73
+ "c8": "^10.1.3",
74
+ "chai": "^5.2.0",
71
75
  "chai-as-promised": "^8.0.1",
72
- "commander": "^12.1.0",
76
+ "commander": "^14.0.0",
73
77
  "d3": "^7.9.0",
74
78
  "d3-flame-graph": "^4.1.3",
75
79
  "dot-object": "^2.1.5",
76
- "esbuild": "^0.24.0",
80
+ "esbuild": "^0.25.5",
77
81
  "esbuild-plugin-import-glob": "^0.1.1",
78
- "esbuild-visualizer": "^0.6.0",
79
- "eslint": "^9.16.0",
82
+ "esbuild-visualizer": "^0.7.0",
83
+ "eslint": "^9.28.0",
84
+ "globals": "^16.2.0",
80
85
  "ini": "^5.0.0",
81
- "inquirer": "^12.1.0",
86
+ "jiti": "^2.4.2",
82
87
  "jsonc-parser": "^3.3.1",
83
- "mimer": "^2.0.2",
84
- "mocha": "^11.0.1",
88
+ "mime": "^4.0.7",
89
+ "mocha": "^11.5.0",
85
90
  "node-fetch": "^3.3.2",
86
91
  "readdir-glob": "^2.0.1",
87
92
  "remark": "^15.0.1",
88
93
  "rimraf": "^6.0.1",
89
- "semver": "^7.6.3",
94
+ "semver": "^7.7.2",
90
95
  "tree-kill": "^1.2.2",
91
- "tsx": "^4.19.2",
92
- "typescript": "^5.7.2",
93
- "typescript-eslint": "^8.17.0",
96
+ "tsx": "^4.19.4",
97
+ "typescript": "^5.8.3",
98
+ "typescript-eslint": "^8.33.1",
94
99
  "vscode-languageclient": "^9.0.1",
95
100
  "vscode-languageserver": "^9.0.1",
96
101
  "vscode-languageserver-textdocument": "^1.0.12",
97
- "vscode-uri": "^3.0.8"
102
+ "vscode-uri": "^3.1.0",
103
+ "yoctocolors": "^2.1.1"
98
104
  },
99
105
  "extensionDependencies": [
100
106
  "sumneko.lua"
101
107
  ],
102
- "main": "./dist/fmtk-vscode.js",
108
+ "type": "module",
109
+ "main": "dist/fmtk-vscode.js",
103
110
  "bin": {
104
111
  "fmtk": "dist/fmtk-cli.js",
105
112
  "factoriomod-debug": "dist/fmtk-cli.js"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "title": "Factorio Campaign description.json",
3
- "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$schema": "https://json-schema.org/draft-07/schema#",
4
4
  "oneOf": [
5
5
  {
6
6
  "allOf":[
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "title": "Factorio Data info.json",
3
- "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$schema": "https://json-schema.org/draft-07/schema",
4
4
  "type": "object",
5
5
  "properties": {
6
6
  "name":{
7
7
  "type":"string",
8
8
  "title": "Internal name of the mod",
9
- "pattern": "[a-zA-Z0-9_-]+",
9
+ "pattern": "^[a-zA-Z0-9_\\-]+$",
10
10
  "maxLength": 49,
11
11
  "minLength": 4
12
12
  },
13
13
  "version": {
14
14
  "type":"string",
15
15
  "title": "Version String",
16
- "pattern": "(\\d+\\.){2}\\d+"
16
+ "pattern": "^(\\d+\\.){2}\\d+$"
17
17
  },
18
18
  "title": {
19
19
  "type": "string",
@@ -44,7 +44,7 @@
44
44
  "factorio_version": {
45
45
  "type":"string",
46
46
  "title": "The Factorio major version this mod supports",
47
- "pattern": "\\d+\\.\\d+"
47
+ "pattern": "^\\d+\\.\\d+$"
48
48
  },
49
49
  "dependencies": {
50
50
  "type":"array",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "title": "Factorio Locale info.json",
3
- "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$schema": "https://json-schema.org/draft-07/schema#",
4
4
  "type": "object",
5
5
  "required":[
6
6
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "title": "Factorio Map Gen Settings",
3
- "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$schema": "https://json-schema.org/draft-07/schema#",
4
4
  "type": "object",
5
5
  "properties": {
6
6
  "terrain_segmentation": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "title": "Factorio Map Settings",
3
- "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$schema": "https://json-schema.org/draft-07/schema#",
4
4
  "type": "object",
5
5
  "properties": {
6
6
  "difficulty_settings":
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "title": "Factorio json migration",
3
- "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$schema": "https://json-schema.org/draft-07/schema#",
4
4
  "type": "object",
5
5
  "definitions": {
6
6
  "migration_item": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "title": "Factorio Mod info.json",
3
- "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$schema": "https://json-schema.org/draft-07/schema",
4
4
  "allOf":[
5
5
  {
6
6
  "$ref": "datainfo.json"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "title": "Factorio Scenario description.json",
3
- "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$schema": "https://json-schema.org/draft-07/schema#",
4
4
  "oneOf": [
5
5
  {
6
6
  "type": "object",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "title": "Factorio Server Settings",
3
- "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$schema": "https://json-schema.org/draft-07/schema#",
4
4
  "type": "object",
5
5
  "properties": {
6
6
  "name":{