polybundle 0.1.1 → 0.1.2
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 +6 -4
- package/package.json +2 -2
- package/src/cli.js +7 -0
package/README.md
CHANGED
|
@@ -48,6 +48,8 @@ An array of entry script paths (order matters):
|
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
## Example Output:
|
|
51
|
+
[Instance2Lua](https://github.com/geringverdien/Polytoria-Instance2Lua) is built using polybundle! Below is the bundled output from the boilerplate init scripts
|
|
52
|
+
|
|
51
53
|
```lua
|
|
52
54
|
local __module_env = {}
|
|
53
55
|
|
|
@@ -63,18 +65,18 @@ return returnedLib
|
|
|
63
65
|
end)()
|
|
64
66
|
|
|
65
67
|
-- polybundle: begin scripts\init1.lua
|
|
66
|
-
|
|
68
|
+
spawn(function()
|
|
67
69
|
local lib = __module_env["scripts/lib/library1.module.lua"]
|
|
68
70
|
|
|
69
71
|
local addResult = lib.Add(2, 50)
|
|
70
72
|
|
|
71
73
|
print(addResult)
|
|
72
74
|
print("added successfully in init1")
|
|
73
|
-
end)
|
|
75
|
+
end)
|
|
74
76
|
-- polybundle: end scripts\init1.lua
|
|
75
77
|
|
|
76
78
|
-- polybundle: begin scripts\init2.lua
|
|
77
|
-
|
|
79
|
+
spawn(function()
|
|
78
80
|
local addLib = __module_env["scripts/lib/library1.module.lua"]
|
|
79
81
|
|
|
80
82
|
local addResult = addLib.Add(9, 10)
|
|
@@ -84,6 +86,6 @@ local res = "add result is "
|
|
|
84
86
|
local final = res .. tostring(addResult)
|
|
85
87
|
|
|
86
88
|
print(final)
|
|
87
|
-
end)
|
|
89
|
+
end)
|
|
88
90
|
-- polybundle: end scripts\init2.lua
|
|
89
91
|
```
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polybundle",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Lua script bundler for Polytoria.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
7
|
-
"polybundle": "
|
|
7
|
+
"polybundle": "bin/polybundle.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"bin/",
|
package/src/cli.js
CHANGED
|
@@ -123,7 +123,14 @@ function run(args) {
|
|
|
123
123
|
: path.resolve(cwd, "dist", "bundle.lua");
|
|
124
124
|
|
|
125
125
|
try {
|
|
126
|
+
// save output file, warn user about localscript string lenght limit if output exceeds 65,535 characters
|
|
126
127
|
const bundled = bundleEntries(entries, cwd);
|
|
128
|
+
if (bundled.length > 65535) {
|
|
129
|
+
console.warn(
|
|
130
|
+
"Warning: Output exceeds 65,535 characters, which is the limit for LocalScripts in Polytoria.\n" +
|
|
131
|
+
"Consider splitting your code into multiple bundles or optimizing your code to reduce size."
|
|
132
|
+
);
|
|
133
|
+
}
|
|
127
134
|
fs.mkdirSync(path.dirname(outFile), { recursive: true });
|
|
128
135
|
fs.writeFileSync(outFile, bundled, "utf8");
|
|
129
136
|
console.log(`Bundled ${entries.length} entries into ${outFile}`);
|