Skip to content

Commit 2e834c7

Browse files
committed
vite 6.3 support, including basic sample
1 parent b40ef6e commit 2e834c7

File tree

5 files changed

+40
-35
lines changed

5 files changed

+40
-35
lines changed

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vite-plugin-openfl",
3-
"version": "1.0.0",
3+
"version": "2.0.0",
44
"description": "Vite plugin for OpenFL",
55
"license": "MIT",
66
"repository": "https://github.com/feathersui/vite-plugin-openfl.git",
@@ -10,17 +10,21 @@
1010
"author": "Josh Tynjala",
1111
"keywords": [
1212
"vite",
13-
"OpenFL"
13+
"vite-plugin",
14+
"rollup-plugin",
15+
"OpenFL",
16+
"haxe"
1417
],
15-
"main": "./vite-plugin-openfl.js",
18+
"type": "module",
19+
"main": "./vite-plugin-openfl.mjs",
1620
"files": [
17-
"vite-plugin-openfl.js"
21+
"vite-plugin-openfl.mjs"
1822
],
1923
"peerDependencies": {
20-
"vite": "^3.1.0"
24+
"vite": "^6.3.0"
2125
},
2226
"engines": {
23-
"node": ">=14.18 <15.x || >=16.x"
27+
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
2428
},
2529
"scripts": {}
2630
}

samples/basic/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "vite-plugin-openfl-basic-sample",
3-
"version": "1.0.0",
3+
"version": "2.0.0",
44
"description": "A basic sample to demonstrate vite-plugin-openfl",
55
"repository": "https://github.com/feathersui/vite-plugin-openfl.git",
66
"devDependencies": {
7-
"vite": "^3.1.0",
8-
"vite-plugin-openfl": "^1.0.0"
7+
"vite": "^6.3.0",
8+
"vite-plugin-openfl": "^2.0.0"
99
},
1010
"scripts": {
1111
"start": "vite",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ import openflPlugin from "vite-plugin-openfl";
33

44
export default defineConfig({
55
plugins: [openflPlugin()],
6+
build: {
7+
chunkSizeWarningLimit: 2000,
8+
},
69
});

templates/default/html5/output.js

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
(function ($hx_exports, $global) {
2-
"use strict";
3-
var $hx_script = (function (exports, global) { ::SOURCE_FILE::
4-
});
5-
$hx_exports.lime = $hx_exports.lime || {};
6-
$hx_exports.lime.$scripts = $hx_exports.lime.$scripts || {};
7-
$hx_exports.lime.$scripts["::APP_FILE::"] = $hx_script;
8-
$hx_exports.lime.embed = function(projectName) {
9-
var exports = {};
10-
var script = $hx_exports.lime.$scripts[projectName];
11-
if (!script) throw Error("Cannot find project name \"" + projectName + "\"");
12-
script(exports, $global);
13-
for (var key in exports) $hx_exports[key] = $hx_exports[key] || exports[key];
14-
var lime = exports.lime || window.lime;
15-
if (lime && lime.embed && this != lime.embed) lime.embed.apply(lime, arguments);
16-
return exports;
17-
};
18-
1+
(function(){(function($hx_exports, $global){"use strict";var $hx_script = (function (exports, global) { ::SOURCE_FILE::
2+
});
3+
$hx_exports.lime = $hx_exports.lime || {};
4+
$hx_exports.lime.$scripts = $hx_exports.lime.$scripts || {};
5+
$hx_exports.lime.$scripts["::APP_FILE::"] = $hx_script;
6+
$hx_exports.lime.embed = function(projectName) {
7+
var exports = {};
8+
var script = $hx_exports.lime.$scripts[projectName];
9+
if (!script) throw Error("Cannot find project name \"" + projectName + "\"");
10+
script(exports, $global);
11+
for (var key in exports) $hx_exports[key] = $hx_exports[key] || exports[key];
12+
var lime = exports.lime || window.lime;
13+
if (lime && lime.embed && this != lime.embed) lime.embed.apply(lime, arguments);
14+
return exports;
15+
};
1916
})(window, window);
2017
::if embeddedLibraries::::foreach (embeddedLibraries)::
2118
::__current__::::end::::end::
19+
}).apply(globalThis);
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
const child_process = require("node:child_process");
2-
const fs = require("node:fs");
3-
const path = require("node:path");
4-
const vite = require("vite");
1+
import child_process from "node:child_process";
2+
import fs from "node:fs";
3+
import path from "node:path";
4+
import { createLogger } from "vite";
55

6-
module.exports = function openflPlugin() {
6+
export default function openflPlugin() {
77
/** @type vite.ResolvedConfig */ let config = null;
88
return {
99
name: "openfl",
@@ -97,9 +97,9 @@ module.exports = function openflPlugin() {
9797
id,
9898
"html5",
9999
mode,
100-
`--template=${path.resolve(__dirname, templateDir)}`,
100+
`--template=${path.resolve(import.meta.dirname, templateDir)}`,
101101
]);
102-
const logger = vite.createLogger("info");
102+
const logger = createLogger("info");
103103
result.output.forEach((line) => {
104104
if (!line) {
105105
return;
@@ -127,7 +127,7 @@ module.exports = function openflPlugin() {
127127
};
128128
},
129129
};
130-
};
130+
}
131131

132132
function isInXMLComment(projectXML, index) {
133133
const startCommentIndex = projectXML.lastIndexOf("<!--", index);

0 commit comments

Comments
 (0)