@flare-engine/cli 0.2.1 → 0.3.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 -21
- package/NOTICE +2 -0
- package/README.md +5 -4
- package/dist/bin.js +76 -326
- package/dist/bin.js.map +1 -1
- package/dist/bin.mjs +74 -72
- package/dist/bin.mjs.map +1 -1
- package/dist/index.d.mts +86 -80
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +86 -80
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -272
- package/dist/index.mjs +2 -9
- package/dist/tiled-to-flare-CEdmaHp_.js +273 -0
- package/dist/tiled-to-flare-CEdmaHp_.js.map +1 -0
- package/dist/tiled-to-flare-Cc-ofNer.mjs +239 -0
- package/dist/tiled-to-flare-Cc-ofNer.mjs.map +1 -0
- package/package.json +12 -7
- package/dist/chunk-SUMZ7TVL.mjs +0 -235
- package/dist/chunk-SUMZ7TVL.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,272 +1,4 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
convertTiled: () => convertTiled,
|
|
34
|
-
packAtlas: () => packAtlas
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(index_exports);
|
|
37
|
-
|
|
38
|
-
// src/pack-atlas.ts
|
|
39
|
-
var import_promises = require("fs/promises");
|
|
40
|
-
var import_node_path = require("path");
|
|
41
|
-
var import_maxrects_packer = require("maxrects-packer");
|
|
42
|
-
var import_sharp = __toESM(require("sharp"));
|
|
43
|
-
function absPath(p) {
|
|
44
|
-
return (0, import_node_path.isAbsolute)(p) ? p : (0, import_node_path.resolve)(process.cwd(), p);
|
|
45
|
-
}
|
|
46
|
-
async function listPngs(dir) {
|
|
47
|
-
const entries = await (0, import_promises.readdir)(dir, { withFileTypes: true });
|
|
48
|
-
const result = [];
|
|
49
|
-
for (const e of entries) {
|
|
50
|
-
if (!e.isFile()) continue;
|
|
51
|
-
if ((0, import_node_path.extname)(e.name).toLowerCase() === ".png") result.push((0, import_node_path.join)(dir, e.name));
|
|
52
|
-
}
|
|
53
|
-
result.sort();
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
async function readSprite(path) {
|
|
57
|
-
const meta = await (0, import_sharp.default)(path).metadata();
|
|
58
|
-
if (!meta.width || !meta.height) {
|
|
59
|
-
throw new Error(`[pack-atlas] unable to read dimensions for ${path}`);
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
name: (0, import_node_path.basename)(path, (0, import_node_path.extname)(path)),
|
|
63
|
-
path,
|
|
64
|
-
width: meta.width,
|
|
65
|
-
height: meta.height
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
async function packAtlas(opts) {
|
|
69
|
-
const inputDir = absPath(opts.input);
|
|
70
|
-
const outDir = absPath(opts.out ?? opts.input);
|
|
71
|
-
const name = opts.name ?? "atlas";
|
|
72
|
-
const padding = opts.padding ?? 2;
|
|
73
|
-
const maxSize = opts.maxSize ?? 2048;
|
|
74
|
-
const format = opts.format ?? "png";
|
|
75
|
-
await (0, import_promises.mkdir)(outDir, { recursive: true });
|
|
76
|
-
const files = await listPngs(inputDir);
|
|
77
|
-
if (files.length === 0) {
|
|
78
|
-
throw new Error(`[pack-atlas] no .png files found in ${inputDir}`);
|
|
79
|
-
}
|
|
80
|
-
const sprites = [];
|
|
81
|
-
for (const f of files) sprites.push(await readSprite(f));
|
|
82
|
-
const packer = new import_maxrects_packer.MaxRectsPacker(maxSize, maxSize, padding, {
|
|
83
|
-
smart: true,
|
|
84
|
-
pot: false,
|
|
85
|
-
square: false,
|
|
86
|
-
allowRotation: false,
|
|
87
|
-
tag: false,
|
|
88
|
-
border: 0
|
|
89
|
-
});
|
|
90
|
-
for (const s of sprites) packer.add(s.width, s.height, s);
|
|
91
|
-
if (packer.bins.length !== 1) {
|
|
92
|
-
throw new Error(
|
|
93
|
-
`[pack-atlas] sprites do not fit in a single ${maxSize}x${maxSize} atlas (got ${packer.bins.length} bins)`
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
const bin = packer.bins[0];
|
|
97
|
-
if (!bin) throw new Error("[pack-atlas] packing produced no bin");
|
|
98
|
-
const atlasWidth = bin.width;
|
|
99
|
-
const atlasHeight = bin.height;
|
|
100
|
-
const frames = [];
|
|
101
|
-
const composites = [];
|
|
102
|
-
for (const rect of bin.rects) {
|
|
103
|
-
const sprite = rect.data;
|
|
104
|
-
const buf = await (0, import_promises.readFile)(sprite.path);
|
|
105
|
-
composites.push({ input: buf, left: rect.x, top: rect.y });
|
|
106
|
-
frames.push({
|
|
107
|
-
name: sprite.name,
|
|
108
|
-
x: rect.x,
|
|
109
|
-
y: rect.y,
|
|
110
|
-
w: sprite.width,
|
|
111
|
-
h: sprite.height
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
frames.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
115
|
-
const imageName = `${name}.${format}`;
|
|
116
|
-
const jsonName = `${name}.json`;
|
|
117
|
-
const imagePath = (0, import_node_path.join)(outDir, imageName);
|
|
118
|
-
const jsonPath = (0, import_node_path.join)(outDir, jsonName);
|
|
119
|
-
let pipeline = (0, import_sharp.default)({
|
|
120
|
-
create: {
|
|
121
|
-
width: atlasWidth,
|
|
122
|
-
height: atlasHeight,
|
|
123
|
-
channels: 4,
|
|
124
|
-
background: { r: 0, g: 0, b: 0, alpha: 0 }
|
|
125
|
-
}
|
|
126
|
-
}).composite(composites);
|
|
127
|
-
pipeline = format === "webp" ? pipeline.webp() : pipeline.png();
|
|
128
|
-
await pipeline.toFile(imagePath);
|
|
129
|
-
const jsonFrames = {};
|
|
130
|
-
for (const f of frames) {
|
|
131
|
-
jsonFrames[f.name] = { frame: { x: f.x, y: f.y, w: f.w, h: f.h } };
|
|
132
|
-
}
|
|
133
|
-
const jsonDoc = {
|
|
134
|
-
frames: jsonFrames,
|
|
135
|
-
meta: {
|
|
136
|
-
app: "@flare-engine/cli",
|
|
137
|
-
version: "1.0",
|
|
138
|
-
image: imageName,
|
|
139
|
-
format: "RGBA8888",
|
|
140
|
-
size: { w: atlasWidth, h: atlasHeight },
|
|
141
|
-
scale: "1"
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
await (0, import_promises.writeFile)(jsonPath, `${JSON.stringify(jsonDoc, null, 2)}
|
|
145
|
-
`, "utf8");
|
|
146
|
-
return {
|
|
147
|
-
jsonPath,
|
|
148
|
-
imagePath,
|
|
149
|
-
frames,
|
|
150
|
-
width: atlasWidth,
|
|
151
|
-
height: atlasHeight
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// src/tiled-to-flare.ts
|
|
156
|
-
var import_promises2 = require("fs/promises");
|
|
157
|
-
var import_node_path2 = require("path");
|
|
158
|
-
function absPath2(p, base) {
|
|
159
|
-
return (0, import_node_path2.isAbsolute)(p) ? p : (0, import_node_path2.resolve)(base, p);
|
|
160
|
-
}
|
|
161
|
-
function propsToRecord(props) {
|
|
162
|
-
const out = {};
|
|
163
|
-
if (!props) return out;
|
|
164
|
-
for (const p of props) out[p.name] = p.value;
|
|
165
|
-
return out;
|
|
166
|
-
}
|
|
167
|
-
async function resolveTileset(ref, mapDir, embed) {
|
|
168
|
-
let data = ref;
|
|
169
|
-
if (ref.source && embed) {
|
|
170
|
-
const srcPath = absPath2(ref.source, mapDir);
|
|
171
|
-
const raw = await (0, import_promises2.readFile)(srcPath, "utf8");
|
|
172
|
-
const external = JSON.parse(raw);
|
|
173
|
-
data = { ...external, firstgid: ref.firstgid };
|
|
174
|
-
}
|
|
175
|
-
return {
|
|
176
|
-
name: data.name ?? "tileset",
|
|
177
|
-
firstgid: data.firstgid,
|
|
178
|
-
tilewidth: data.tilewidth ?? 0,
|
|
179
|
-
tileheight: data.tileheight ?? 0,
|
|
180
|
-
columns: data.columns ?? 0,
|
|
181
|
-
tilecount: data.tilecount ?? 0,
|
|
182
|
-
image: data.image ?? "",
|
|
183
|
-
imagewidth: data.imagewidth ?? 0,
|
|
184
|
-
imageheight: data.imageheight ?? 0
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
function flattenLayers(layers) {
|
|
188
|
-
const out = [];
|
|
189
|
-
const walk = (ls) => {
|
|
190
|
-
for (const l of ls) {
|
|
191
|
-
if (l.type === "group") {
|
|
192
|
-
const inner = l.layers;
|
|
193
|
-
if (inner) walk(inner);
|
|
194
|
-
} else {
|
|
195
|
-
out.push(l);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
walk(layers);
|
|
200
|
-
return out;
|
|
201
|
-
}
|
|
202
|
-
function convertLayer(layer) {
|
|
203
|
-
const visible = layer.visible !== false;
|
|
204
|
-
const opacity = typeof layer.opacity === "number" ? layer.opacity : 1;
|
|
205
|
-
if (layer.type === "tilelayer") {
|
|
206
|
-
const tile = {
|
|
207
|
-
kind: "tile",
|
|
208
|
-
name: layer.name,
|
|
209
|
-
width: layer.width ?? 0,
|
|
210
|
-
height: layer.height ?? 0,
|
|
211
|
-
data: layer.data ?? [],
|
|
212
|
-
visible,
|
|
213
|
-
opacity
|
|
214
|
-
};
|
|
215
|
-
return tile;
|
|
216
|
-
}
|
|
217
|
-
if (layer.type === "objectgroup") {
|
|
218
|
-
const objects = (layer.objects ?? []).map((o) => ({
|
|
219
|
-
id: o.id,
|
|
220
|
-
name: o.name ?? "",
|
|
221
|
-
type: o.type ?? o.class ?? "",
|
|
222
|
-
x: o.x,
|
|
223
|
-
y: o.y,
|
|
224
|
-
width: o.width,
|
|
225
|
-
height: o.height,
|
|
226
|
-
properties: propsToRecord(o.properties)
|
|
227
|
-
}));
|
|
228
|
-
const obj = {
|
|
229
|
-
kind: "object",
|
|
230
|
-
name: layer.name,
|
|
231
|
-
objects,
|
|
232
|
-
visible,
|
|
233
|
-
opacity
|
|
234
|
-
};
|
|
235
|
-
return obj;
|
|
236
|
-
}
|
|
237
|
-
return null;
|
|
238
|
-
}
|
|
239
|
-
async function convertTiled(opts) {
|
|
240
|
-
const inputPath = absPath2(opts.input, process.cwd());
|
|
241
|
-
const outPath = opts.out ? absPath2(opts.out, process.cwd()) : (0, import_node_path2.join)((0, import_node_path2.dirname)(inputPath), `${inputPath.replace(/\.tmj$|\.json$/i, "")}.flare.json`);
|
|
242
|
-
const embed = opts.embedTilesets !== false;
|
|
243
|
-
const raw = await (0, import_promises2.readFile)(inputPath, "utf8");
|
|
244
|
-
const parsed = JSON.parse(raw);
|
|
245
|
-
const mapDir = (0, import_node_path2.dirname)(inputPath);
|
|
246
|
-
const tilesets = [];
|
|
247
|
-
for (const ref of parsed.tilesets ?? []) {
|
|
248
|
-
tilesets.push(await resolveTileset(ref, mapDir, embed));
|
|
249
|
-
}
|
|
250
|
-
const layers = [];
|
|
251
|
-
for (const l of flattenLayers(parsed.layers ?? [])) {
|
|
252
|
-
const converted = convertLayer(l);
|
|
253
|
-
if (converted) layers.push(converted);
|
|
254
|
-
}
|
|
255
|
-
const map = {
|
|
256
|
-
width: parsed.width,
|
|
257
|
-
height: parsed.height,
|
|
258
|
-
tilewidth: parsed.tilewidth,
|
|
259
|
-
tileheight: parsed.tileheight,
|
|
260
|
-
tilesets,
|
|
261
|
-
layers
|
|
262
|
-
};
|
|
263
|
-
await (0, import_promises2.writeFile)(outPath, `${JSON.stringify(map, null, 2)}
|
|
264
|
-
`, "utf8");
|
|
265
|
-
return { outPath, layers, tilesets, map };
|
|
266
|
-
}
|
|
267
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
268
|
-
0 && (module.exports = {
|
|
269
|
-
convertTiled,
|
|
270
|
-
packAtlas
|
|
271
|
-
});
|
|
272
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_tiled_to_flare = require("./tiled-to-flare-CEdmaHp_.js");
|
|
3
|
+
exports.convertTiled = require_tiled_to_flare.convertTiled;
|
|
4
|
+
exports.packAtlas = require_tiled_to_flare.packAtlas;
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
packAtlas
|
|
4
|
-
} from "./chunk-SUMZ7TVL.mjs";
|
|
5
|
-
export {
|
|
6
|
-
convertTiled,
|
|
7
|
-
packAtlas
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
import { n as packAtlas, t as convertTiled } from "./tiled-to-flare-Cc-ofNer.mjs";
|
|
2
|
+
export { convertTiled, packAtlas };
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
let node_fs_promises = require("node:fs/promises");
|
|
24
|
+
let node_path = require("node:path");
|
|
25
|
+
let maxrects_packer = require("maxrects-packer");
|
|
26
|
+
let sharp = require("sharp");
|
|
27
|
+
sharp = __toESM(sharp);
|
|
28
|
+
//#region src/pack-atlas.ts
|
|
29
|
+
function absPath$1(p) {
|
|
30
|
+
return (0, node_path.isAbsolute)(p) ? p : (0, node_path.resolve)(process.cwd(), p);
|
|
31
|
+
}
|
|
32
|
+
async function listPngs(dir) {
|
|
33
|
+
const entries = await (0, node_fs_promises.readdir)(dir, { withFileTypes: true });
|
|
34
|
+
const result = [];
|
|
35
|
+
for (const e of entries) {
|
|
36
|
+
if (!e.isFile()) continue;
|
|
37
|
+
if ((0, node_path.extname)(e.name).toLowerCase() === ".png") result.push((0, node_path.join)(dir, e.name));
|
|
38
|
+
}
|
|
39
|
+
result.sort();
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
async function readSprite(path) {
|
|
43
|
+
const meta = await (0, sharp.default)(path).metadata();
|
|
44
|
+
if (!meta.width || !meta.height) throw new Error(`[pack-atlas] unable to read dimensions for ${path}`);
|
|
45
|
+
return {
|
|
46
|
+
name: (0, node_path.basename)(path, (0, node_path.extname)(path)),
|
|
47
|
+
path,
|
|
48
|
+
width: meta.width,
|
|
49
|
+
height: meta.height
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Pack a directory of PNG sprites into a single TexturePacker-compatible
|
|
54
|
+
* atlas (JSON + image) consumable by `@flare-engine/assets`.
|
|
55
|
+
*/
|
|
56
|
+
async function packAtlas(opts) {
|
|
57
|
+
const inputDir = absPath$1(opts.input);
|
|
58
|
+
const outDir = absPath$1(opts.out ?? opts.input);
|
|
59
|
+
const name = opts.name ?? "atlas";
|
|
60
|
+
const padding = opts.padding ?? 2;
|
|
61
|
+
const maxSize = opts.maxSize ?? 2048;
|
|
62
|
+
const format = opts.format ?? "png";
|
|
63
|
+
await (0, node_fs_promises.mkdir)(outDir, { recursive: true });
|
|
64
|
+
const files = await listPngs(inputDir);
|
|
65
|
+
if (files.length === 0) throw new Error(`[pack-atlas] no .png files found in ${inputDir}`);
|
|
66
|
+
const sprites = [];
|
|
67
|
+
for (const f of files) sprites.push(await readSprite(f));
|
|
68
|
+
const packer = new maxrects_packer.MaxRectsPacker(maxSize, maxSize, padding, {
|
|
69
|
+
smart: true,
|
|
70
|
+
pot: false,
|
|
71
|
+
square: false,
|
|
72
|
+
allowRotation: false,
|
|
73
|
+
tag: false,
|
|
74
|
+
border: 0
|
|
75
|
+
});
|
|
76
|
+
for (const s of sprites) packer.add(s.width, s.height, s);
|
|
77
|
+
if (packer.bins.length !== 1) throw new Error(`[pack-atlas] sprites do not fit in a single ${maxSize}x${maxSize} atlas (got ${packer.bins.length} bins)`);
|
|
78
|
+
const bin = packer.bins[0];
|
|
79
|
+
if (!bin) throw new Error("[pack-atlas] packing produced no bin");
|
|
80
|
+
const atlasWidth = bin.width;
|
|
81
|
+
const atlasHeight = bin.height;
|
|
82
|
+
const frames = [];
|
|
83
|
+
const composites = [];
|
|
84
|
+
for (const rect of bin.rects) {
|
|
85
|
+
const sprite = rect.data;
|
|
86
|
+
const buf = await (0, node_fs_promises.readFile)(sprite.path);
|
|
87
|
+
composites.push({
|
|
88
|
+
input: buf,
|
|
89
|
+
left: rect.x,
|
|
90
|
+
top: rect.y
|
|
91
|
+
});
|
|
92
|
+
frames.push({
|
|
93
|
+
name: sprite.name,
|
|
94
|
+
x: rect.x,
|
|
95
|
+
y: rect.y,
|
|
96
|
+
w: sprite.width,
|
|
97
|
+
h: sprite.height
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
frames.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
101
|
+
const imageName = `${name}.${format}`;
|
|
102
|
+
const jsonName = `${name}.json`;
|
|
103
|
+
const imagePath = (0, node_path.join)(outDir, imageName);
|
|
104
|
+
const jsonPath = (0, node_path.join)(outDir, jsonName);
|
|
105
|
+
let pipeline = (0, sharp.default)({ create: {
|
|
106
|
+
width: atlasWidth,
|
|
107
|
+
height: atlasHeight,
|
|
108
|
+
channels: 4,
|
|
109
|
+
background: {
|
|
110
|
+
r: 0,
|
|
111
|
+
g: 0,
|
|
112
|
+
b: 0,
|
|
113
|
+
alpha: 0
|
|
114
|
+
}
|
|
115
|
+
} }).composite(composites);
|
|
116
|
+
pipeline = format === "webp" ? pipeline.webp() : pipeline.png();
|
|
117
|
+
await pipeline.toFile(imagePath);
|
|
118
|
+
const jsonFrames = {};
|
|
119
|
+
for (const f of frames) jsonFrames[f.name] = { frame: {
|
|
120
|
+
x: f.x,
|
|
121
|
+
y: f.y,
|
|
122
|
+
w: f.w,
|
|
123
|
+
h: f.h
|
|
124
|
+
} };
|
|
125
|
+
await (0, node_fs_promises.writeFile)(jsonPath, `${JSON.stringify({
|
|
126
|
+
frames: jsonFrames,
|
|
127
|
+
meta: {
|
|
128
|
+
app: "@flare-engine/cli",
|
|
129
|
+
version: "1.0",
|
|
130
|
+
image: imageName,
|
|
131
|
+
format: "RGBA8888",
|
|
132
|
+
size: {
|
|
133
|
+
w: atlasWidth,
|
|
134
|
+
h: atlasHeight
|
|
135
|
+
},
|
|
136
|
+
scale: "1"
|
|
137
|
+
}
|
|
138
|
+
}, null, 2)}\n`, "utf8");
|
|
139
|
+
return {
|
|
140
|
+
jsonPath,
|
|
141
|
+
imagePath,
|
|
142
|
+
frames,
|
|
143
|
+
width: atlasWidth,
|
|
144
|
+
height: atlasHeight
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/tiled-to-flare.ts
|
|
149
|
+
function absPath(p, base) {
|
|
150
|
+
return (0, node_path.isAbsolute)(p) ? p : (0, node_path.resolve)(base, p);
|
|
151
|
+
}
|
|
152
|
+
function propsToRecord(props) {
|
|
153
|
+
const out = {};
|
|
154
|
+
if (!props) return out;
|
|
155
|
+
for (const p of props) out[p.name] = p.value;
|
|
156
|
+
return out;
|
|
157
|
+
}
|
|
158
|
+
async function resolveTileset(ref, mapDir, embed) {
|
|
159
|
+
let data = ref;
|
|
160
|
+
if (ref.source && embed) {
|
|
161
|
+
const raw = await (0, node_fs_promises.readFile)(absPath(ref.source, mapDir), "utf8");
|
|
162
|
+
data = {
|
|
163
|
+
...JSON.parse(raw),
|
|
164
|
+
firstgid: ref.firstgid
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
name: data.name ?? "tileset",
|
|
169
|
+
firstgid: data.firstgid,
|
|
170
|
+
tilewidth: data.tilewidth ?? 0,
|
|
171
|
+
tileheight: data.tileheight ?? 0,
|
|
172
|
+
columns: data.columns ?? 0,
|
|
173
|
+
tilecount: data.tilecount ?? 0,
|
|
174
|
+
image: data.image ?? "",
|
|
175
|
+
imagewidth: data.imagewidth ?? 0,
|
|
176
|
+
imageheight: data.imageheight ?? 0,
|
|
177
|
+
...ref.source && !embed ? { source: ref.source } : {}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function flattenLayers(layers) {
|
|
181
|
+
const out = [];
|
|
182
|
+
const walk = (ls) => {
|
|
183
|
+
for (const l of ls) if (l.type === "group") {
|
|
184
|
+
const inner = l.layers;
|
|
185
|
+
if (inner) walk(inner);
|
|
186
|
+
} else out.push(l);
|
|
187
|
+
};
|
|
188
|
+
walk(layers);
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
191
|
+
function convertLayer(layer) {
|
|
192
|
+
const visible = layer.visible !== false;
|
|
193
|
+
const opacity = typeof layer.opacity === "number" ? layer.opacity : 1;
|
|
194
|
+
if (layer.type === "tilelayer") return {
|
|
195
|
+
kind: "tile",
|
|
196
|
+
name: layer.name,
|
|
197
|
+
width: layer.width ?? 0,
|
|
198
|
+
height: layer.height ?? 0,
|
|
199
|
+
data: layer.data ?? [],
|
|
200
|
+
visible,
|
|
201
|
+
opacity
|
|
202
|
+
};
|
|
203
|
+
if (layer.type === "objectgroup") {
|
|
204
|
+
const objects = (layer.objects ?? []).map((o) => ({
|
|
205
|
+
id: o.id,
|
|
206
|
+
name: o.name ?? "",
|
|
207
|
+
type: o.type ?? o.class ?? "",
|
|
208
|
+
x: o.x,
|
|
209
|
+
y: o.y,
|
|
210
|
+
width: o.width,
|
|
211
|
+
height: o.height,
|
|
212
|
+
properties: propsToRecord(o.properties)
|
|
213
|
+
}));
|
|
214
|
+
return {
|
|
215
|
+
kind: "object",
|
|
216
|
+
name: layer.name,
|
|
217
|
+
objects,
|
|
218
|
+
visible,
|
|
219
|
+
opacity
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Convert a Tiled `.tmj` JSON map into Flare's normalized runtime format.
|
|
226
|
+
* Flattens group layers, resolves external tilesets (when `embedTilesets`),
|
|
227
|
+
* and drops image/editor-only layers.
|
|
228
|
+
*/
|
|
229
|
+
async function convertTiled(opts) {
|
|
230
|
+
const inputPath = absPath(opts.input, process.cwd());
|
|
231
|
+
const outPath = opts.out ? absPath(opts.out, process.cwd()) : (0, node_path.join)((0, node_path.dirname)(inputPath), `${(0, node_path.basename)(inputPath).replace(/\.(tmj|json)$/i, "")}.flare.json`);
|
|
232
|
+
const embed = opts.embedTilesets !== false;
|
|
233
|
+
const raw = await (0, node_fs_promises.readFile)(inputPath, "utf8");
|
|
234
|
+
const parsed = JSON.parse(raw);
|
|
235
|
+
const mapDir = (0, node_path.dirname)(inputPath);
|
|
236
|
+
const tilesets = [];
|
|
237
|
+
for (const ref of parsed.tilesets ?? []) tilesets.push(await resolveTileset(ref, mapDir, embed));
|
|
238
|
+
const layers = [];
|
|
239
|
+
for (const l of flattenLayers(parsed.layers ?? [])) {
|
|
240
|
+
const converted = convertLayer(l);
|
|
241
|
+
if (converted) layers.push(converted);
|
|
242
|
+
}
|
|
243
|
+
const map = {
|
|
244
|
+
width: parsed.width,
|
|
245
|
+
height: parsed.height,
|
|
246
|
+
tilewidth: parsed.tilewidth,
|
|
247
|
+
tileheight: parsed.tileheight,
|
|
248
|
+
tilesets,
|
|
249
|
+
layers
|
|
250
|
+
};
|
|
251
|
+
await (0, node_fs_promises.writeFile)(outPath, `${JSON.stringify(map, null, 2)}\n`, "utf8");
|
|
252
|
+
return {
|
|
253
|
+
outPath,
|
|
254
|
+
layers,
|
|
255
|
+
tilesets,
|
|
256
|
+
map
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
//#endregion
|
|
260
|
+
Object.defineProperty(exports, "convertTiled", {
|
|
261
|
+
enumerable: true,
|
|
262
|
+
get: function() {
|
|
263
|
+
return convertTiled;
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
Object.defineProperty(exports, "packAtlas", {
|
|
267
|
+
enumerable: true,
|
|
268
|
+
get: function() {
|
|
269
|
+
return packAtlas;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
//# sourceMappingURL=tiled-to-flare-CEdmaHp_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tiled-to-flare-CEdmaHp_.js","names":["absPath","MaxRectsPacker"],"sources":["../src/pack-atlas.ts","../src/tiled-to-flare.ts"],"sourcesContent":["import { mkdir, readdir, readFile, writeFile } from 'node:fs/promises';\nimport { basename, extname, isAbsolute, join, resolve } from 'node:path';\nimport { MaxRectsPacker } from 'maxrects-packer';\nimport sharp from 'sharp';\nimport type { AtlasFrame, AtlasPackerOptions, AtlasResult } from './types.js';\n\ninterface SpriteInput {\n name: string;\n path: string;\n width: number;\n height: number;\n}\n\nfunction absPath(p: string): string {\n return isAbsolute(p) ? p : resolve(process.cwd(), p);\n}\n\nasync function listPngs(dir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true });\n const result: string[] = [];\n for (const e of entries) {\n if (!e.isFile()) continue;\n if (extname(e.name).toLowerCase() === '.png') result.push(join(dir, e.name));\n }\n result.sort();\n return result;\n}\n\nasync function readSprite(path: string): Promise<SpriteInput> {\n const meta = await sharp(path).metadata();\n if (!meta.width || !meta.height) {\n throw new Error(`[pack-atlas] unable to read dimensions for ${path}`);\n }\n return {\n name: basename(path, extname(path)),\n path,\n width: meta.width,\n height: meta.height,\n };\n}\n\n/**\n * Pack a directory of PNG sprites into a single TexturePacker-compatible\n * atlas (JSON + image) consumable by `@flare-engine/assets`.\n */\nexport async function packAtlas(opts: AtlasPackerOptions): Promise<AtlasResult> {\n const inputDir = absPath(opts.input);\n const outDir = absPath(opts.out ?? opts.input);\n const name = opts.name ?? 'atlas';\n const padding = opts.padding ?? 2;\n const maxSize = opts.maxSize ?? 2048;\n const format = opts.format ?? 'png';\n\n await mkdir(outDir, { recursive: true });\n\n const files = await listPngs(inputDir);\n if (files.length === 0) {\n throw new Error(`[pack-atlas] no .png files found in ${inputDir}`);\n }\n\n const sprites: SpriteInput[] = [];\n for (const f of files) sprites.push(await readSprite(f));\n\n const packer = new MaxRectsPacker(maxSize, maxSize, padding, {\n smart: true,\n pot: false,\n square: false,\n allowRotation: false,\n tag: false,\n border: 0,\n });\n for (const s of sprites) packer.add(s.width, s.height, s);\n\n if (packer.bins.length !== 1) {\n throw new Error(\n `[pack-atlas] sprites do not fit in a single ${maxSize}x${maxSize} atlas (got ${packer.bins.length} bins)`,\n );\n }\n const bin = packer.bins[0];\n if (!bin) throw new Error('[pack-atlas] packing produced no bin');\n\n const atlasWidth = bin.width;\n const atlasHeight = bin.height;\n\n const frames: AtlasFrame[] = [];\n const composites: { input: Buffer; left: number; top: number }[] = [];\n\n for (const rect of bin.rects) {\n const sprite = rect.data as SpriteInput;\n const buf = await readFile(sprite.path);\n composites.push({ input: buf, left: rect.x, top: rect.y });\n frames.push({\n name: sprite.name,\n x: rect.x,\n y: rect.y,\n w: sprite.width,\n h: sprite.height,\n });\n }\n frames.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));\n\n const imageName = `${name}.${format}`;\n const jsonName = `${name}.json`;\n const imagePath = join(outDir, imageName);\n const jsonPath = join(outDir, jsonName);\n\n let pipeline = sharp({\n create: {\n width: atlasWidth,\n height: atlasHeight,\n channels: 4,\n background: { r: 0, g: 0, b: 0, alpha: 0 },\n },\n }).composite(composites);\n pipeline = format === 'webp' ? pipeline.webp() : pipeline.png();\n await pipeline.toFile(imagePath);\n\n // TexturePacker-compatible JSON (hash format).\n const jsonFrames: Record<string, { frame: { x: number; y: number; w: number; h: number } }> = {};\n for (const f of frames) {\n jsonFrames[f.name] = { frame: { x: f.x, y: f.y, w: f.w, h: f.h } };\n }\n const jsonDoc = {\n frames: jsonFrames,\n meta: {\n app: '@flare-engine/cli',\n version: '1.0',\n image: imageName,\n format: 'RGBA8888',\n size: { w: atlasWidth, h: atlasHeight },\n scale: '1',\n },\n };\n await writeFile(jsonPath, `${JSON.stringify(jsonDoc, null, 2)}\\n`, 'utf8');\n\n return {\n jsonPath,\n imagePath,\n frames,\n width: atlasWidth,\n height: atlasHeight,\n };\n}\n","import { readFile, writeFile } from 'node:fs/promises';\nimport { basename, dirname, isAbsolute, join, resolve } from 'node:path';\nimport type {\n FlareLayer,\n FlareMap,\n FlareObject,\n FlareObjectLayer,\n FlareTileLayer,\n FlareTileset,\n TiledConvertOptions,\n TiledResult,\n} from './types.js';\n\ninterface TiledProperty {\n name: string;\n type?: string;\n value: string | number | boolean;\n}\n\ninterface TiledObject {\n id: number;\n name?: string;\n type?: string;\n class?: string;\n x: number;\n y: number;\n width: number;\n height: number;\n visible?: boolean;\n properties?: TiledProperty[];\n}\n\ninterface TiledLayer {\n type: 'tilelayer' | 'objectgroup' | 'imagelayer' | 'group';\n name: string;\n visible?: boolean;\n opacity?: number;\n width?: number;\n height?: number;\n data?: number[];\n objects?: TiledObject[];\n}\n\ninterface TiledTilesetRef {\n firstgid: number;\n source?: string;\n name?: string;\n tilewidth?: number;\n tileheight?: number;\n columns?: number;\n tilecount?: number;\n image?: string;\n imagewidth?: number;\n imageheight?: number;\n}\n\ninterface TiledMap {\n width: number;\n height: number;\n tilewidth: number;\n tileheight: number;\n layers: TiledLayer[];\n tilesets: TiledTilesetRef[];\n}\n\nfunction absPath(p: string, base: string): string {\n return isAbsolute(p) ? p : resolve(base, p);\n}\n\nfunction propsToRecord(\n props: TiledProperty[] | undefined,\n): Record<string, string | number | boolean> {\n const out: Record<string, string | number | boolean> = {};\n if (!props) return out;\n for (const p of props) out[p.name] = p.value;\n return out;\n}\n\nasync function resolveTileset(\n ref: TiledTilesetRef,\n mapDir: string,\n embed: boolean,\n): Promise<FlareTileset> {\n let data: TiledTilesetRef = ref;\n if (ref.source && embed) {\n const srcPath = absPath(ref.source, mapDir);\n const raw = await readFile(srcPath, 'utf8');\n const external = JSON.parse(raw) as TiledTilesetRef;\n data = { ...external, firstgid: ref.firstgid };\n }\n return {\n name: data.name ?? 'tileset',\n firstgid: data.firstgid,\n tilewidth: data.tilewidth ?? 0,\n tileheight: data.tileheight ?? 0,\n columns: data.columns ?? 0,\n tilecount: data.tilecount ?? 0,\n image: data.image ?? '',\n imagewidth: data.imagewidth ?? 0,\n imageheight: data.imageheight ?? 0,\n ...(ref.source && !embed ? { source: ref.source } : {}),\n };\n}\n\nfunction flattenLayers(layers: TiledLayer[]): TiledLayer[] {\n const out: TiledLayer[] = [];\n const walk = (ls: TiledLayer[]): void => {\n for (const l of ls) {\n if (l.type === 'group') {\n const inner = (l as unknown as { layers?: TiledLayer[] }).layers;\n if (inner) walk(inner);\n } else {\n out.push(l);\n }\n }\n };\n walk(layers);\n return out;\n}\n\nfunction convertLayer(layer: TiledLayer): FlareLayer | null {\n const visible = layer.visible !== false;\n const opacity = typeof layer.opacity === 'number' ? layer.opacity : 1;\n if (layer.type === 'tilelayer') {\n const tile: FlareTileLayer = {\n kind: 'tile',\n name: layer.name,\n width: layer.width ?? 0,\n height: layer.height ?? 0,\n data: layer.data ?? [],\n visible,\n opacity,\n };\n return tile;\n }\n if (layer.type === 'objectgroup') {\n const objects: FlareObject[] = (layer.objects ?? []).map((o) => ({\n id: o.id,\n name: o.name ?? '',\n type: o.type ?? o.class ?? '',\n x: o.x,\n y: o.y,\n width: o.width,\n height: o.height,\n properties: propsToRecord(o.properties),\n }));\n const obj: FlareObjectLayer = {\n kind: 'object',\n name: layer.name,\n objects,\n visible,\n opacity,\n };\n return obj;\n }\n return null;\n}\n\n/**\n * Convert a Tiled `.tmj` JSON map into Flare's normalized runtime format.\n * Flattens group layers, resolves external tilesets (when `embedTilesets`),\n * and drops image/editor-only layers.\n */\nexport async function convertTiled(opts: TiledConvertOptions): Promise<TiledResult> {\n const inputPath = absPath(opts.input, process.cwd());\n const outPath = opts.out\n ? absPath(opts.out, process.cwd())\n : join(dirname(inputPath), `${basename(inputPath).replace(/\\.(tmj|json)$/i, '')}.flare.json`);\n const embed = opts.embedTilesets !== false;\n\n const raw = await readFile(inputPath, 'utf8');\n const parsed = JSON.parse(raw) as TiledMap;\n const mapDir = dirname(inputPath);\n\n const tilesets: FlareTileset[] = [];\n for (const ref of parsed.tilesets ?? []) {\n tilesets.push(await resolveTileset(ref, mapDir, embed));\n }\n\n const layers: FlareLayer[] = [];\n for (const l of flattenLayers(parsed.layers ?? [])) {\n const converted = convertLayer(l);\n if (converted) layers.push(converted);\n }\n\n const map: FlareMap = {\n width: parsed.width,\n height: parsed.height,\n tilewidth: parsed.tilewidth,\n tileheight: parsed.tileheight,\n tilesets,\n layers,\n };\n\n await writeFile(outPath, `${JSON.stringify(map, null, 2)}\\n`, 'utf8');\n return { outPath, layers, tilesets, map };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,SAASA,UAAQ,GAAmB;CAClC,QAAA,GAAA,UAAA,WAAA,CAAkB,CAAC,IAAI,KAAA,GAAA,UAAA,QAAA,CAAY,QAAQ,IAAI,GAAG,CAAC;AACrD;AAEA,eAAe,SAAS,KAAgC;CACtD,MAAM,UAAU,OAAA,GAAA,iBAAA,QAAA,CAAc,KAAK,EAAE,eAAe,KAAK,CAAC;CAC1D,MAAM,SAAmB,CAAC;CAC1B,KAAK,MAAM,KAAK,SAAS;EACvB,IAAI,CAAC,EAAE,OAAO,GAAG;EACjB,KAAA,GAAA,UAAA,QAAA,CAAY,EAAE,IAAI,CAAC,CAAC,YAAY,MAAM,QAAQ,OAAO,MAAA,GAAA,UAAA,KAAA,CAAU,KAAK,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