Skip to content

Commit

Permalink
0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Astrid committed Feb 18, 2024
1 parent 8117cf3 commit 572bf18
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "scribunto-bundler",
"description": "Lua bundler for Scribunto",
"version": "0.2.0",
"version": "0.2.1",
"author": "Astrid <[email protected]>",
"license": "MIT",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions src/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ const bundlerReturnTemplate = fs.readFileSync(
);

export interface Module {
id: string;
path: string;
content: string;
id: string;
requiredBy: Array<{ name: string; path: string }>;
}

Expand All @@ -42,7 +42,7 @@ function generateMain(modules: Module[]) {
formatString(
bundlerModuleTemplate,
{
name: module.id as string,
id: module.id,
content: module.content,
},
{
Expand Down
1 change: 1 addition & 0 deletions src/utils/lua.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default async function index(mainLuaFile: string): Promise<Module[]> {
(v) => v.path === requiredByPart.path,
);
if (moduleIndex === -1) continue;

modules[moduleIndex].content = modules[moduleIndex].content.replace(
customRequireRegex(requiredByPart.name),
`_bundler_load("${id}")`,
Expand Down
2 changes: 1 addition & 1 deletion templates/bundler/module.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_bundler_register('--{{name}}', function()
_bundler_register('--{{id}}', function()
--{{content}}
end)

0 comments on commit 572bf18

Please sign in to comment.