@number10/phaserjsx 0.6.1 → 4.1.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/README.md +43 -3
- package/dist/chunk-C2EiDwsr.cjs +35 -0
- package/dist/clip/index.cjs +696 -0
- package/dist/clip/index.cjs.map +1 -0
- package/dist/clip/index.d.ts +3 -0
- package/dist/clip/index.d.ts.map +1 -0
- package/dist/clip/index.js +688 -0
- package/dist/clip/index.js.map +1 -0
- package/dist/clip/stencil-clip-extension.d.ts +18 -0
- package/dist/clip/stencil-clip-extension.d.ts.map +1 -0
- package/dist/clip/stencil-clip.d.ts +134 -0
- package/dist/clip/stencil-clip.d.ts.map +1 -0
- package/dist/components/appliers/applyBackground.d.ts +2 -1
- package/dist/components/appliers/applyBackground.d.ts.map +1 -1
- package/dist/components/appliers/applyGestures.d.ts.map +1 -1
- package/dist/components/appliers/applyTooltip.d.ts.map +1 -1
- package/dist/components/backgroundImage.d.ts +12 -0
- package/dist/components/backgroundImage.d.ts.map +1 -0
- package/dist/components/creators/createBackground.d.ts +2 -1
- package/dist/components/creators/createBackground.d.ts.map +1 -1
- package/dist/components/creators/createGestures.d.ts.map +1 -1
- package/dist/components/custom/Accordion.d.ts.map +1 -1
- package/dist/components/custom/CharText/CharText.d.ts.map +1 -1
- package/dist/components/custom/Dialog.d.ts +1 -1
- package/dist/components/custom/Divider.d.ts +1 -1
- package/dist/components/custom/Dropdown.d.ts.map +1 -1
- package/dist/components/custom/Graphics.d.ts +1 -1
- package/dist/components/custom/Graphics.d.ts.map +1 -1
- package/dist/components/custom/Icon.d.ts.map +1 -1
- package/dist/components/custom/Image.d.ts.map +1 -1
- package/dist/components/custom/Joystick.d.ts +1 -1
- package/dist/components/custom/NineSlice.d.ts.map +1 -1
- package/dist/components/custom/Particles.d.ts +1 -1
- package/dist/components/custom/Particles.d.ts.map +1 -1
- package/dist/components/custom/Portal.d.ts.map +1 -1
- package/dist/components/custom/RefOriginView.d.ts +1 -1
- package/dist/components/custom/ScrollView.d.ts.map +1 -1
- package/dist/components/custom/Sprite.d.ts +1 -1
- package/dist/components/custom/Sprite.d.ts.map +1 -1
- package/dist/components/custom/Text.d.ts.map +1 -1
- package/dist/components/custom/TileSprite.d.ts +1 -1
- package/dist/components/custom/TileSprite.d.ts.map +1 -1
- package/dist/components/custom/View.d.ts.map +1 -1
- package/dist/components/custom/index.cjs +34 -36
- package/dist/components/custom/index.js +2 -37
- package/dist/components/primitives/graphics.d.ts.map +1 -1
- package/dist/components/primitives/image.d.ts.map +1 -1
- package/dist/components/primitives/nineslice.d.ts.map +1 -1
- package/dist/components/primitives/particles.d.ts.map +1 -1
- package/dist/components/primitives/sprite.d.ts.map +1 -1
- package/dist/components/primitives/text.d.ts.map +1 -1
- package/dist/components/primitives/tilesprite.d.ts.map +1 -1
- package/dist/components/primitives/view.d.ts.map +1 -1
- package/dist/custom-C_w8D39m.js +29259 -0
- package/dist/custom-C_w8D39m.js.map +1 -0
- package/dist/custom-Dp3yAJdU.cjs +30498 -0
- package/dist/custom-Dp3yAJdU.cjs.map +1 -0
- package/dist/fx/fx-creators/blur.d.ts.map +1 -1
- package/dist/fx/fx-creators/color-matrix.d.ts.map +1 -1
- package/dist/fx/fx-creators/glow.d.ts.map +1 -1
- package/dist/fx/fx-creators/pixelate.d.ts.map +1 -1
- package/dist/fx/fx-creators/shadow.d.ts.map +1 -1
- package/dist/fx/fx-creators/vignette.d.ts.map +1 -1
- package/dist/fx/use-fx.d.ts +3 -3
- package/dist/fx/use-fx.d.ts.map +1 -1
- package/dist/gestures/gesture-manager.d.ts +3 -1
- package/dist/gestures/gesture-manager.d.ts.map +1 -1
- package/dist/gestures/gesture-types.d.ts +1 -1
- package/dist/gestures/gesture-types.d.ts.map +1 -1
- package/dist/hooks.d.ts +9 -8
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.cjs +1628 -2837
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1430 -2866
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.cjs +12 -7
- package/dist/jsx-dev-runtime.cjs.map +1 -1
- package/dist/jsx-dev-runtime.js +11 -11
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.cjs +55 -33
- package/dist/jsx-runtime.cjs.map +1 -1
- package/dist/jsx-runtime.js +56 -37
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/layout/appliers/background-applier.d.ts.map +1 -1
- package/dist/layout/layout-engine.d.ts.map +1 -1
- package/dist/layout/types.d.ts +2 -1
- package/dist/layout/types.d.ts.map +1 -1
- package/dist/scene-backgrounds.d.ts +51 -1
- package/dist/scene-backgrounds.d.ts.map +1 -1
- package/dist/scripts/generate-icon-loaders.js +146 -143
- package/dist/scripts/generate-icon-types.js +94 -83
- package/dist/scripts/generate-icons.d.ts +1 -2
- package/dist/scripts/generate-icons.d.ts.map +1 -1
- package/dist/scripts/generate-icons.js +381 -399
- package/dist/scripts/icon-generator-config.d.ts +0 -1
- package/dist/scripts/icon-generator-config.js +7 -4
- package/dist/theme-base.d.ts.map +1 -1
- package/dist/vite-plugin-icons.d.ts +1 -2
- package/dist/vite-plugin-icons.js +109 -90
- package/package.json +29 -22
- package/dist/TransformOriginView-Dw_HKnFH.cjs +0 -17116
- package/dist/TransformOriginView-Dw_HKnFH.cjs.map +0 -1
- package/dist/TransformOriginView-i8uVBHb1.js +0 -17100
- package/dist/TransformOriginView-i8uVBHb1.js.map +0 -1
- package/dist/components/custom/index.cjs.map +0 -1
- package/dist/components/custom/index.js.map +0 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
//#region src/scripts/icon-generator-config.ts
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to define config with type safety
|
|
4
|
+
*/
|
|
1
5
|
function defineIconConfig(config) {
|
|
2
|
-
|
|
6
|
+
return config;
|
|
3
7
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { defineIconConfig };
|
package/dist/theme-base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-base.d.ts","sourceRoot":"","sources":["../src/theme-base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,cAAc,EACf,MAAM,cAAc,CAAA;AAErB;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;KACjC,CAAC,IAAI,OAAO,CACX,MAAM,eAAe,EACrB,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,YAAY,GAAG,WAAW,CAC7F,CAAC,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;CACjC,CAAA;AAED;;;GAGG;AACH,MAAM,WAAW,SACf,
|
|
1
|
+
{"version":3,"file":"theme-base.d.ts","sourceRoot":"","sources":["../src/theme-base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,cAAc,EACf,MAAM,cAAc,CAAA;AAErB;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;KACjC,CAAC,IAAI,OAAO,CACX,MAAM,eAAe,EACrB,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,YAAY,GAAG,WAAW,CAC7F,CAAC,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;CACjC,CAAA;AAED;;;GAGG;AACH,MAAM,WAAW,SACf,SACE,OAAO,CAAC,cAAc,CAAC,EACvB,O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EAAE,eAAe,CAAA;IAC3B,SAAS,EAAE,cAAc,CAAA;IACzB,IAAI,EAAE,SAAS,CAAA;CAChB;AAED;;GAEG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAE3D;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,sBAAsB,EAAE,qBAAqB;CAAG;AAGzF,YAAY,EAAE,qBAAqB,EAAE,CAAA;AAErC;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;KACxB,CAAC,IAAI,MAAM,eAAe,CAAC,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;CAC3D,GAAG;IACF,0CAA0C;IAC1C,aAAa,CAAC,EAAE;QACd,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;KACxB,CAAA;CACF,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,KAAK,GAAG;KACjB,CAAC,IAAI,MAAM,sBAAsB,GAAG,sBAAsB,CAAC,CAAC,CAAC;CAC/D,GAAG;KACD,CAAC,IAAI,MAAM,IAAI,CAAC,eAAe,EAAE,MAAM,sBAAsB,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;CACtF,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin } from 'vite';
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
2
|
export interface IconGeneratorPluginOptions {
|
|
3
3
|
/** Path to icon generator config file */
|
|
4
4
|
configPath: string;
|
|
@@ -26,4 +26,3 @@ export interface IconGeneratorPluginOptions {
|
|
|
26
26
|
* Vite plugin for icon generation
|
|
27
27
|
*/
|
|
28
28
|
export declare function iconGeneratorPlugin(options: IconGeneratorPluginOptions): Plugin;
|
|
29
|
-
//# sourceMappingURL=vite-plugin-icons.d.ts.map
|
|
@@ -1,95 +1,114 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
|
+
//#region src/vite-plugin-icons.ts
|
|
3
|
+
/**
|
|
4
|
+
* Vite plugin for automatic icon generation
|
|
5
|
+
* Integrates icon generator into Vite's build pipeline
|
|
6
|
+
*
|
|
7
|
+
* Usage in vite.config.ts:
|
|
8
|
+
* import { iconGeneratorPlugin } from '@number10/phaserjsx/vite-plugin-icons'
|
|
9
|
+
*
|
|
10
|
+
* export default defineConfig({
|
|
11
|
+
* plugins: [
|
|
12
|
+
* iconGeneratorPlugin({
|
|
13
|
+
* configPath: './icon-generator.config.ts',
|
|
14
|
+
* watch: true, // Enable in dev mode
|
|
15
|
+
* })
|
|
16
|
+
* ]
|
|
17
|
+
* })
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Import generation functions dynamically to avoid circular deps
|
|
21
|
+
*/
|
|
2
22
|
async function loadGeneratorFunctions() {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
23
|
+
const module = await import("./scripts/generate-icons.js");
|
|
24
|
+
return {
|
|
25
|
+
loadConfig: module.loadConfig,
|
|
26
|
+
generateTypes: module.generateTypes,
|
|
27
|
+
generateLoaders: module.generateLoaders,
|
|
28
|
+
scanIconSources: module.scanIconSources
|
|
29
|
+
};
|
|
10
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Vite plugin for icon generation
|
|
33
|
+
*/
|
|
11
34
|
function iconGeneratorPlugin(options) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
};
|
|
35
|
+
let config;
|
|
36
|
+
let root;
|
|
37
|
+
let isDevMode = false;
|
|
38
|
+
return {
|
|
39
|
+
name: "vite-plugin-icon-generator",
|
|
40
|
+
async configResolved(resolvedConfig) {
|
|
41
|
+
root = resolvedConfig.root;
|
|
42
|
+
isDevMode = resolvedConfig.command === "serve";
|
|
43
|
+
try {
|
|
44
|
+
const { loadConfig } = await loadGeneratorFunctions();
|
|
45
|
+
config = await loadConfig(options.configPath, root);
|
|
46
|
+
if (options.typesOnly && config.loaders) config = {
|
|
47
|
+
...config,
|
|
48
|
+
loaders: {
|
|
49
|
+
...config.loaders,
|
|
50
|
+
enabled: false
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
if (options.loadersOnly && config.types) config = {
|
|
54
|
+
...config,
|
|
55
|
+
types: {
|
|
56
|
+
...config.types,
|
|
57
|
+
enabled: false
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
} catch (error) {
|
|
61
|
+
this.error(`Icon Generator Plugin: ${error}`);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
async buildStart() {
|
|
65
|
+
if (!config) return;
|
|
66
|
+
const scanIconDirectory = config.types?.scanIconDirectory ?? options.scanIconDirectory ?? "watch";
|
|
67
|
+
const generateLoadersMode = config.loaders?.generateLoaders ?? options.generateLoaders ?? "watch";
|
|
68
|
+
const shouldGenerateTypes = scanIconDirectory !== "never" && config.types?.enabled;
|
|
69
|
+
const shouldGenerateLoaders = config.loaders?.enabled && (isDevMode ? generateLoadersMode === "start" : true);
|
|
70
|
+
if (!shouldGenerateTypes && !shouldGenerateLoaders) return;
|
|
71
|
+
console.log("🎨 [Icon Generator] Generating icons...");
|
|
72
|
+
try {
|
|
73
|
+
const { generateTypes, generateLoaders, scanIconSources } = await loadGeneratorFunctions();
|
|
74
|
+
let typesResult = shouldGenerateTypes ? await generateTypes(config, root) : null;
|
|
75
|
+
if (shouldGenerateLoaders) {
|
|
76
|
+
if (!typesResult && config.types?.enabled) typesResult = await scanIconSources(config, root);
|
|
77
|
+
await generateLoaders(config, root, typesResult || void 0);
|
|
78
|
+
}
|
|
79
|
+
console.log("✨ [Icon Generator] Done!");
|
|
80
|
+
} catch (error) {
|
|
81
|
+
this.error(`Icon Generator Plugin: ${error}`);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
async handleHotUpdate({ file, server }) {
|
|
85
|
+
if (!isDevMode || !config || options.watch === false) return;
|
|
86
|
+
const scanIconDirectory = config.types?.scanIconDirectory ?? options.scanIconDirectory ?? "watch";
|
|
87
|
+
const generateLoadersMode = config.loaders?.generateLoaders ?? options.generateLoaders ?? "watch";
|
|
88
|
+
const scanDirAbs = config.loaders?.enabled ? resolve(root, config.loaders.scanDir) : null;
|
|
89
|
+
const shouldRegenerateLoaders = generateLoadersMode === "watch" && config.loaders?.enabled && scanDirAbs && file.startsWith(scanDirAbs) && /\.(tsx?|jsx?)$/.test(file) && !file.endsWith(".generated.ts");
|
|
90
|
+
const sourceAbsPaths = (Array.isArray(config.source) ? config.source : [config.source]).filter((s) => s.directory).map((s) => resolve(root, s.directory));
|
|
91
|
+
const shouldRegenerateTypes = scanIconDirectory === "watch" && config.types?.enabled && file.endsWith(".svg") && sourceAbsPaths.some((path) => file.startsWith(path));
|
|
92
|
+
if (shouldRegenerateLoaders || shouldRegenerateTypes) {
|
|
93
|
+
console.log("🔄 [Icon Generator] File changed, regenerating...");
|
|
94
|
+
try {
|
|
95
|
+
const { generateTypes, generateLoaders, scanIconSources } = await loadGeneratorFunctions();
|
|
96
|
+
let typesResult = null;
|
|
97
|
+
if (shouldRegenerateTypes) typesResult = await generateTypes(config, root);
|
|
98
|
+
else if (shouldRegenerateLoaders && config.types?.enabled) if (scanIconDirectory === "watch") typesResult = await generateTypes(config, root);
|
|
99
|
+
else typesResult = await scanIconSources(config, root);
|
|
100
|
+
if (shouldRegenerateLoaders) await generateLoaders(config, root, typesResult || void 0);
|
|
101
|
+
console.log("✅ [Icon Generator] Regenerated");
|
|
102
|
+
server.ws.send({
|
|
103
|
+
type: "full-reload",
|
|
104
|
+
path: "*"
|
|
105
|
+
});
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error("❌ [Icon Generator] Error:", error);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
92
112
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
};
|
|
113
|
+
//#endregion
|
|
114
|
+
export { iconGeneratorPlugin };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@number10/phaserjsx",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Declarative
|
|
5
|
+
"description": "Declarative Phaser 4 + UI renderer core library",
|
|
6
6
|
"author": "Michael Rieck (Michael--) <mr@number10.de>",
|
|
7
7
|
"main": "./dist/index.cjs",
|
|
8
8
|
"module": "./dist/index.js",
|
|
@@ -38,6 +38,11 @@
|
|
|
38
38
|
"import": "./dist/jsx-dev-runtime.js",
|
|
39
39
|
"require": "./dist/jsx-dev-runtime.cjs"
|
|
40
40
|
},
|
|
41
|
+
"./clip": {
|
|
42
|
+
"types": "./dist/clip/index.d.ts",
|
|
43
|
+
"import": "./dist/clip/index.js",
|
|
44
|
+
"require": "./dist/clip/index.cjs"
|
|
45
|
+
},
|
|
41
46
|
"./components/custom": {
|
|
42
47
|
"types": "./dist/components/custom/index.d.ts",
|
|
43
48
|
"import": "./dist/components/custom/index.js",
|
|
@@ -59,7 +64,7 @@
|
|
|
59
64
|
],
|
|
60
65
|
"keywords": [
|
|
61
66
|
"phaser",
|
|
62
|
-
"
|
|
67
|
+
"phaser4",
|
|
63
68
|
"declarative",
|
|
64
69
|
"typescript",
|
|
65
70
|
"game-engine",
|
|
@@ -83,25 +88,26 @@
|
|
|
83
88
|
"url": "https://github.com/Michael--/phaserjsx/issues"
|
|
84
89
|
},
|
|
85
90
|
"devDependencies": {
|
|
86
|
-
"@
|
|
87
|
-
"@types/
|
|
88
|
-
"@
|
|
89
|
-
"@typescript-eslint/
|
|
90
|
-
"@
|
|
91
|
-
"
|
|
91
|
+
"@eslint/js": "^10.0.1",
|
|
92
|
+
"@types/lodash": "^4.17.24",
|
|
93
|
+
"@types/node": "^25.9.0",
|
|
94
|
+
"@typescript-eslint/eslint-plugin": "^8.59.4",
|
|
95
|
+
"@typescript-eslint/parser": "^8.59.4",
|
|
96
|
+
"@vitest/coverage-v8": "4.1.6",
|
|
97
|
+
"eslint": "^10.4.0",
|
|
92
98
|
"eslint-config-prettier": "^10.1.8",
|
|
93
99
|
"eslint-plugin-import": "^2.32.0",
|
|
94
|
-
"eslint-plugin-unused-imports": "^4.
|
|
95
|
-
"happy-dom": "^20.0
|
|
96
|
-
"jsdom": "^
|
|
97
|
-
"prettier": "^3.
|
|
98
|
-
"typescript": "^
|
|
99
|
-
"vite": "^
|
|
100
|
-
"vite-plugin-dts": "^
|
|
101
|
-
"vitest": "^4.
|
|
100
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
101
|
+
"happy-dom": "^20.9.0",
|
|
102
|
+
"jsdom": "^29.1.1",
|
|
103
|
+
"prettier": "^3.8.3",
|
|
104
|
+
"typescript": "^6.0.3",
|
|
105
|
+
"vite": "^8.0.13",
|
|
106
|
+
"vite-plugin-dts": "^5.0.1",
|
|
107
|
+
"vitest": "^4.1.6"
|
|
102
108
|
},
|
|
103
109
|
"peerDependencies": {
|
|
104
|
-
"phaser": "^
|
|
110
|
+
"phaser": "^4.1.0"
|
|
105
111
|
},
|
|
106
112
|
"peerDependenciesMeta": {
|
|
107
113
|
"phaser": {
|
|
@@ -109,15 +115,16 @@
|
|
|
109
115
|
}
|
|
110
116
|
},
|
|
111
117
|
"dependencies": {
|
|
112
|
-
"@preact/signals-core": "^1.
|
|
118
|
+
"@preact/signals-core": "^1.14.2",
|
|
113
119
|
"fast-deep-equal": "^3.1.3",
|
|
114
|
-
"lodash": "^4.
|
|
115
|
-
"tsx": "^4.
|
|
120
|
+
"lodash": "^4.18.1",
|
|
121
|
+
"tsx": "^4.22.3"
|
|
116
122
|
},
|
|
117
123
|
"scripts": {
|
|
118
124
|
"dev": "vite build --watch",
|
|
119
125
|
"build": "tsc --noEmit && vite build && pnpm build:scripts",
|
|
120
|
-
"build:scripts": "vite build --config scripts.vite.config.ts && chmod +x dist/scripts/*.js",
|
|
126
|
+
"build:scripts": "vite build --config scripts.vite.config.ts && pnpm build:scripts:types && chmod +x dist/scripts/*.js",
|
|
127
|
+
"build:scripts:types": "tsc --ignoreConfig src/scripts/icon-generator-config.ts src/vite-plugin-icons.ts --declaration --emitDeclarationOnly --declarationMap false --outDir dist --moduleResolution bundler --module ESNext --target ES2022 --skipLibCheck --types node",
|
|
121
128
|
"test": "vitest run",
|
|
122
129
|
"test:watch": "vitest",
|
|
123
130
|
"test:coverage": "vitest run --coverage",
|