factoriomod-debug 2.0.5 → 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.
- package/.c8rc.json +2 -2
- package/.mocharc.json +1 -1
- package/CHANGELOG.md +26 -0
- package/dist/ModSettingsWebview.js +274 -292
- package/dist/ScriptDatWebview.js +1 -1
- package/dist/chunk-M5LZ6CNU.js +3420 -0
- package/dist/chunk-ZLQDNPPN.js +36 -0
- package/dist/fmtk-cli.js +97 -193
- package/dist/fmtk-vscode.js +25 -58
- package/dist/multipart-parser-3M5RC66T.js +7 -0
- package/doc/debugapi.md +4 -0
- package/doc/internal/noncharacters.md +1 -0
- package/doc/language-lua.md +0 -4
- package/eslint.config.ts +102 -0
- package/package.json +32 -25
- package/schema/campaign.json +1 -1
- package/schema/datainfo.json +4 -4
- package/schema/localeinfo.json +1 -1
- package/schema/mapgen.json +1 -1
- package/schema/mapsettings.json +1 -1
- package/schema/migration.json +1 -1
- package/schema/modinfo.json +1 -1
- package/schema/scenario.json +1 -1
- package/schema/serversettings.json +1 -1
- package/dist/fmtk.js +0 -3406
|
@@ -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`.
|
package/doc/language-lua.md
CHANGED
|
@@ -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.
|
package/eslint.config.ts
ADDED
|
@@ -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
|
+
}]);
|
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
|
+
"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.
|
|
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
|
|
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": "
|
|
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.
|
|
50
|
-
"@types/chai-as-promised": "^8.0.
|
|
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.
|
|
57
|
+
"@types/inquirer": "^9.0.8",
|
|
55
58
|
"@types/mocha": "^10.0.10",
|
|
56
|
-
"@types/
|
|
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.
|
|
61
|
-
"@types/vscode": "^1.
|
|
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.
|
|
70
|
+
"@vscode/vsce": "^3.5.0",
|
|
67
71
|
"@vscode/webview-ui-toolkit": "^1.4.0",
|
|
68
72
|
"archiver": "^7.0.1",
|
|
69
73
|
"c8": "^10.1.3",
|
|
70
|
-
"chai": "^5.
|
|
74
|
+
"chai": "^5.2.0",
|
|
71
75
|
"chai-as-promised": "^8.0.1",
|
|
72
|
-
"commander": "^
|
|
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.
|
|
80
|
+
"esbuild": "^0.25.5",
|
|
77
81
|
"esbuild-plugin-import-glob": "^0.1.1",
|
|
78
|
-
"esbuild-visualizer": "^0.
|
|
79
|
-
"eslint": "^9.
|
|
82
|
+
"esbuild-visualizer": "^0.7.0",
|
|
83
|
+
"eslint": "^9.28.0",
|
|
84
|
+
"globals": "^16.2.0",
|
|
80
85
|
"ini": "^5.0.0",
|
|
81
|
-
"
|
|
86
|
+
"jiti": "^2.4.2",
|
|
82
87
|
"jsonc-parser": "^3.3.1",
|
|
83
|
-
"
|
|
84
|
-
"mocha": "^11.0
|
|
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.
|
|
94
|
+
"semver": "^7.7.2",
|
|
90
95
|
"tree-kill": "^1.2.2",
|
|
91
|
-
"tsx": "^4.19.
|
|
92
|
-
"typescript": "^5.
|
|
93
|
-
"typescript-eslint": "^8.
|
|
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
|
|
102
|
+
"vscode-uri": "^3.1.0",
|
|
103
|
+
"yoctocolors": "^2.1.1"
|
|
98
104
|
},
|
|
99
105
|
"extensionDependencies": [
|
|
100
106
|
"sumneko.lua"
|
|
101
107
|
],
|
|
102
|
-
"
|
|
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"
|
package/schema/campaign.json
CHANGED
package/schema/datainfo.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"title": "Factorio Data info.json",
|
|
3
|
-
"$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": "
|
|
47
|
+
"pattern": "^\\d+\\.\\d+$"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"type":"array",
|
package/schema/localeinfo.json
CHANGED
package/schema/mapgen.json
CHANGED
package/schema/mapsettings.json
CHANGED
package/schema/migration.json
CHANGED
package/schema/modinfo.json
CHANGED
package/schema/scenario.json
CHANGED