samengine 1.9.0 → 1.10.0
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/LICENSE +201 -0
- package/README.md +203 -0
- package/dist/config/buildconfig.d.ts +146 -0
- package/dist/config/buildconfig.js +115 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.js +1 -0
- package/dist/core.d.ts +17 -0
- package/dist/core.js +24 -0
- package/dist/html.d.ts +29 -0
- package/dist/html.js +20 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -2
- package/dist/input.d.ts +51 -0
- package/dist/input.js +44 -3
- package/dist/keys.d.ts +6 -0
- package/dist/keys.js +6 -2
- package/dist/logger.d.ts +8 -0
- package/dist/logger.js +8 -1
- package/dist/nonbrowser/getversion.d.ts +13 -0
- package/dist/nonbrowser/getversion.js +35 -0
- package/dist/nonbrowser/ghresolver.d.ts +1 -0
- package/dist/nonbrowser/ghresolver.js +7 -0
- package/dist/nonbrowser/index.d.ts +9 -0
- package/dist/nonbrowser/index.js +9 -0
- package/dist/nonbrowser/internal/buildhelper.d.ts +42 -0
- package/dist/nonbrowser/internal/buildhelper.js +144 -0
- package/dist/nonbrowser/internal/cli/argparser.d.ts +20 -0
- package/dist/nonbrowser/internal/cli/argparser.js +36 -0
- package/dist/nonbrowser/internal/cli/main.d.ts +13 -0
- package/dist/nonbrowser/internal/cli/main.js +262 -0
- package/dist/nonbrowser/internal/config.d.ts +9 -0
- package/dist/nonbrowser/internal/config.js +40 -0
- package/dist/nonbrowser/internal/exporthtml.d.ts +37 -0
- package/dist/nonbrowser/internal/exporthtml.js +622 -0
- package/dist/nonbrowser/internal/projcreator/downloadZip.d.ts +4 -0
- package/dist/nonbrowser/internal/projcreator/downloadZip.js +83 -0
- package/dist/nonbrowser/internal/projcreator/main.d.ts +1 -0
- package/dist/nonbrowser/internal/projcreator/main.js +81 -0
- package/dist/nonbrowser/utils.d.ts +8 -0
- package/dist/nonbrowser/utils.js +18 -0
- package/dist/physics/collision.d.ts +33 -0
- package/dist/physics/collision.js +27 -0
- package/dist/physics/physicsEngine.d.ts +18 -0
- package/dist/physics/physicsEngine.js +18 -0
- package/dist/physics/physicsObject.d.ts +20 -0
- package/dist/physics/physicsObject.js +20 -0
- package/dist/renderer.d.ts +85 -2
- package/dist/renderer.js +86 -7
- package/dist/samegui/index.d.ts +49 -0
- package/dist/samegui/index.js +137 -0
- package/dist/save.d.ts +30 -0
- package/dist/save.js +25 -0
- package/dist/sound/audioplayer.d.ts +39 -0
- package/dist/sound/audioplayer.js +39 -5
- package/dist/storage/index.d.ts +57 -0
- package/dist/storage/index.js +89 -0
- package/dist/text/index.d.ts +14 -0
- package/dist/text/index.js +58 -0
- package/dist/texture.d.ts +100 -0
- package/dist/texture.js +75 -41
- package/dist/types/button.d.ts +25 -0
- package/dist/types/button.js +22 -0
- package/dist/types/circle.d.ts +26 -0
- package/dist/types/circle.js +21 -7
- package/dist/types/color.d.ts +17 -0
- package/dist/types/color.js +11 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/rectangle.d.ts +29 -0
- package/dist/types/rectangle.js +23 -6
- package/dist/types/triangle.d.ts +23 -0
- package/dist/types/triangle.js +20 -6
- package/dist/types/vector2d.d.ts +42 -0
- package/dist/types/vector2d.js +39 -11
- package/dist/types/vector3d.d.ts +38 -0
- package/dist/types/vector3d.js +35 -11
- package/dist/utils/index.d.ts +13 -4
- package/dist/utils/index.js +26 -2
- package/dist/utils/logger/index.d.ts +24 -0
- package/dist/utils/logger/index.js +44 -0
- package/dist/utils/math.d.ts +18 -0
- package/dist/utils/math.js +18 -4
- package/package.json +40 -10
- package/dist/utils/jsonc-parser.d.ts +0 -4
- package/dist/utils/jsonc-parser.js +0 -166
- package/dist/utils/markdown.d.ts +0 -41
- package/dist/utils/markdown.js +0 -699
package/package.json
CHANGED
|
@@ -1,41 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "samengine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "A TypeScript game library to make HTML Games",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
|
+
"dev": "npx samengine-build",
|
|
10
11
|
"build": "tsc",
|
|
11
|
-
"pack": "node scripts/clean.js && npm run build && npm pack && git push --follow-tags",
|
|
12
|
+
"pack": "node ../../scripts/clean.js && npm run build && npm pack && git push --follow-tags && npm run up",
|
|
12
13
|
"test": "bun test"
|
|
13
14
|
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"samengine": "dist/nonbrowser/internal/cli/main.js",
|
|
17
|
+
"samengine-proj": "dist/nonbrowser/internal/projcreator/main.js"
|
|
18
|
+
},
|
|
14
19
|
"exports": {
|
|
15
20
|
".": "./dist/index.js",
|
|
16
21
|
"./types": "./dist/types/index.js",
|
|
17
22
|
"./sound": "./dist/sound/index.js",
|
|
18
23
|
"./utils": "./dist/utils/index.js",
|
|
24
|
+
"./utils/logger": "./dist/utils/logger/index.js",
|
|
19
25
|
"./build": "./dist/build/index.js",
|
|
20
|
-
"./physics": "./dist/physics/index.js"
|
|
26
|
+
"./physics": "./dist/physics/index.js",
|
|
27
|
+
"./samegui": "./dist/samegui/index.js",
|
|
28
|
+
"./storage": "./dist/storage/index.js",
|
|
29
|
+
"./text": "./dist/text/index.js",
|
|
30
|
+
"./config": "./dist/config/index.js",
|
|
31
|
+
"./nonbrowser": "./dist/nonbrowser/index.js"
|
|
21
32
|
},
|
|
22
33
|
"keywords": [
|
|
23
34
|
"game",
|
|
24
|
-
"typescript"
|
|
35
|
+
"typescript",
|
|
36
|
+
"gamelib"
|
|
25
37
|
],
|
|
26
38
|
"author": "Shadowdara",
|
|
27
|
-
"license": "
|
|
39
|
+
"license": "Apache-2.0",
|
|
28
40
|
"devDependencies": {
|
|
29
|
-
"
|
|
30
|
-
"@types/
|
|
31
|
-
"
|
|
41
|
+
"@types/fs-extra": "^11.0.4",
|
|
42
|
+
"@types/html-minifier-terser": "^7.0.2",
|
|
43
|
+
"@types/node": "^25.9.4",
|
|
44
|
+
"@types/unzipper": "^0.10.11",
|
|
45
|
+
"@types/ws": "^8.18.1",
|
|
46
|
+
"rimraf": "^6.1.3",
|
|
47
|
+
"ts-node": "^10.9.2",
|
|
48
|
+
"typescript": "^6.0.3"
|
|
32
49
|
},
|
|
33
50
|
"repository": {
|
|
34
51
|
"type": "git",
|
|
35
|
-
"url": "https://github.com/shadowdara/samengine"
|
|
52
|
+
"url": "https://github.com/shadowdara/samengine",
|
|
53
|
+
"directory": "packages/samengine"
|
|
36
54
|
},
|
|
37
55
|
"bugs": {
|
|
38
56
|
"url": "https://github.com/shadowdara/samengine/issues"
|
|
39
57
|
},
|
|
40
|
-
"type": "module"
|
|
58
|
+
"type": "module",
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"esbuild": "^0.28.0",
|
|
61
|
+
"fs-extra": "^11.3.5",
|
|
62
|
+
"html-minifier-terser": "^7.2.0",
|
|
63
|
+
"inquirer": "^14.0.2",
|
|
64
|
+
"mime": "^4.1.0",
|
|
65
|
+
"node-fetch": "^3.3.2",
|
|
66
|
+
"unzipper": "^0.12.5",
|
|
67
|
+
"ws": "^8.20.0",
|
|
68
|
+
"chalk": "^5.6.2",
|
|
69
|
+
"samengine-cli": "2.0.4"
|
|
70
|
+
}
|
|
41
71
|
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
// jsonc-parser.ts
|
|
2
|
-
// JSON with comments (// and /* */) parser in TypeScript
|
|
3
|
-
export function parseJSONC(input) {
|
|
4
|
-
let i = 0;
|
|
5
|
-
function error(msg) {
|
|
6
|
-
throw new SyntaxError(`${msg} at position ${i}`);
|
|
7
|
-
}
|
|
8
|
-
function peek(offset = 0) {
|
|
9
|
-
return input[i + offset];
|
|
10
|
-
}
|
|
11
|
-
function consume() {
|
|
12
|
-
return input[i++];
|
|
13
|
-
}
|
|
14
|
-
function skipWhitespaceAndComments() {
|
|
15
|
-
while (i < input.length) {
|
|
16
|
-
// whitespace
|
|
17
|
-
if (/\s/.test(peek())) {
|
|
18
|
-
i++;
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
// line comment //
|
|
22
|
-
if (peek() === '/' && peek(1) === '/') {
|
|
23
|
-
i += 2;
|
|
24
|
-
while (i < input.length && peek() !== '\n')
|
|
25
|
-
i++;
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
// block comment /* */
|
|
29
|
-
if (peek() === '/' && peek(1) === '*') {
|
|
30
|
-
i += 2;
|
|
31
|
-
while (i < input.length && !(peek() === '*' && peek(1) === '/')) {
|
|
32
|
-
i++;
|
|
33
|
-
}
|
|
34
|
-
if (i >= input.length)
|
|
35
|
-
error("Unterminated block comment");
|
|
36
|
-
i += 2;
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function parseValue() {
|
|
43
|
-
skipWhitespaceAndComments();
|
|
44
|
-
const ch = peek();
|
|
45
|
-
if (ch === '"')
|
|
46
|
-
return parseString();
|
|
47
|
-
if (ch === '{')
|
|
48
|
-
return parseObject();
|
|
49
|
-
if (ch === '[')
|
|
50
|
-
return parseArray();
|
|
51
|
-
if (ch === '-' || /[0-9]/.test(ch))
|
|
52
|
-
return parseNumber();
|
|
53
|
-
if (input.startsWith("true", i)) {
|
|
54
|
-
i += 4;
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
if (input.startsWith("false", i)) {
|
|
58
|
-
i += 5;
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
if (input.startsWith("null", i)) {
|
|
62
|
-
i += 4;
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
error("Unexpected token");
|
|
66
|
-
}
|
|
67
|
-
function parseString() {
|
|
68
|
-
consume(); // "
|
|
69
|
-
let result = "";
|
|
70
|
-
while (i < input.length) {
|
|
71
|
-
const ch = consume();
|
|
72
|
-
if (ch === '"')
|
|
73
|
-
return result;
|
|
74
|
-
if (ch === '\\') {
|
|
75
|
-
const next = consume();
|
|
76
|
-
if (next === 'n')
|
|
77
|
-
result += '\n';
|
|
78
|
-
else if (next === 't')
|
|
79
|
-
result += '\t';
|
|
80
|
-
else if (next === 'r')
|
|
81
|
-
result += '\r';
|
|
82
|
-
else
|
|
83
|
-
result += next;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
result += ch;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
error("Unterminated string");
|
|
90
|
-
}
|
|
91
|
-
function parseNumber() {
|
|
92
|
-
let num = "";
|
|
93
|
-
while (/[-+0-9.eE]/.test(peek())) {
|
|
94
|
-
num += consume();
|
|
95
|
-
}
|
|
96
|
-
const value = Number(num);
|
|
97
|
-
if (Number.isNaN(value))
|
|
98
|
-
error("Invalid number");
|
|
99
|
-
return value;
|
|
100
|
-
}
|
|
101
|
-
function parseArray() {
|
|
102
|
-
consume(); // [
|
|
103
|
-
const arr = [];
|
|
104
|
-
skipWhitespaceAndComments();
|
|
105
|
-
if (peek() === ']') {
|
|
106
|
-
consume();
|
|
107
|
-
return arr;
|
|
108
|
-
}
|
|
109
|
-
while (true) {
|
|
110
|
-
arr.push(parseValue());
|
|
111
|
-
skipWhitespaceAndComments();
|
|
112
|
-
const ch = consume();
|
|
113
|
-
if (ch === ']')
|
|
114
|
-
break;
|
|
115
|
-
if (ch !== ',')
|
|
116
|
-
error("Expected ',' or ']'");
|
|
117
|
-
skipWhitespaceAndComments();
|
|
118
|
-
if (peek() === ']') {
|
|
119
|
-
consume();
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return arr;
|
|
124
|
-
}
|
|
125
|
-
function parseObject() {
|
|
126
|
-
consume(); // {
|
|
127
|
-
const obj = {};
|
|
128
|
-
skipWhitespaceAndComments();
|
|
129
|
-
if (peek() === '}') {
|
|
130
|
-
consume();
|
|
131
|
-
return obj;
|
|
132
|
-
}
|
|
133
|
-
while (true) {
|
|
134
|
-
skipWhitespaceAndComments();
|
|
135
|
-
const key = parseKey();
|
|
136
|
-
skipWhitespaceAndComments();
|
|
137
|
-
if (consume() !== ':')
|
|
138
|
-
error("Expected ':'");
|
|
139
|
-
const value = parseValue();
|
|
140
|
-
obj[key] = value;
|
|
141
|
-
skipWhitespaceAndComments();
|
|
142
|
-
const ch = consume();
|
|
143
|
-
if (ch === '}')
|
|
144
|
-
break;
|
|
145
|
-
if (ch !== ',')
|
|
146
|
-
error("Expected ',' or '}'");
|
|
147
|
-
skipWhitespaceAndComments();
|
|
148
|
-
if (peek() === '}') {
|
|
149
|
-
consume();
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return obj;
|
|
154
|
-
}
|
|
155
|
-
function parseKey() {
|
|
156
|
-
skipWhitespaceAndComments();
|
|
157
|
-
if (peek() === '"')
|
|
158
|
-
return parseString();
|
|
159
|
-
error("Keys must be strings in JSONC");
|
|
160
|
-
}
|
|
161
|
-
const result = parseValue();
|
|
162
|
-
skipWhitespaceAndComments();
|
|
163
|
-
if (i < input.length)
|
|
164
|
-
error("Unexpected trailing input");
|
|
165
|
-
return result;
|
|
166
|
-
}
|
package/dist/utils/markdown.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* markdown-parser.ts
|
|
3
|
-
* Ein vollständiger Markdown → HTML Parser in TypeScript.
|
|
4
|
-
* Unterstützt: Überschriften, Absätze, Fett/Kursiv/Durchgestrichen,
|
|
5
|
-
* Inline-Code, Code-Blöcke (mit Sprach-Tag), Blockquotes (verschachtelt),
|
|
6
|
-
* geordnete & ungeordnete Listen (verschachtelt), Aufgabenlisten,
|
|
7
|
-
* horizontale Linien, Links, Bilder, Tabellen, Fußnoten, HTML-Entities.
|
|
8
|
-
*/
|
|
9
|
-
export interface ParseOptions {
|
|
10
|
-
/** Fügt target="_blank" rel="noopener noreferrer" zu externen Links hinzu */
|
|
11
|
-
externalLinks?: boolean;
|
|
12
|
-
/** Bricht einfache Zeilenumbrüche in <br> um */
|
|
13
|
-
breaks?: boolean;
|
|
14
|
-
/** Gibt typographische Anführungszeichen zurück (Smartquotes) */
|
|
15
|
-
smartypants?: boolean;
|
|
16
|
-
/** Sanitisiert rohes HTML im Quelltext */
|
|
17
|
-
sanitize?: boolean;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Konvertiert Markdown-Text in HTML.
|
|
21
|
-
*
|
|
22
|
-
* @param markdown Eingabe-Markdown
|
|
23
|
-
* @param options Optionale Parser-Einstellungen
|
|
24
|
-
* @returns Gerendertes HTML
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* import { parse } from "./markdown-parser";
|
|
29
|
-
* const html = parse("# Hallo Welt\n\nDas ist **Markdown**.");
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function parse(markdown: string, options?: ParseOptions): string;
|
|
33
|
-
/**
|
|
34
|
-
* Gibt ein vollständiges HTML-Dokument zurück (optional mit eigenem CSS).
|
|
35
|
-
*/
|
|
36
|
-
export declare function parseToDocument(markdown: string, options?: ParseOptions & {
|
|
37
|
-
title?: string;
|
|
38
|
-
css?: string;
|
|
39
|
-
header?: string;
|
|
40
|
-
}): string;
|
|
41
|
-
export declare function exportcss(): string;
|