lilact 0.16.0 → 0.16.1

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 CHANGED
@@ -29,7 +29,7 @@ If you find Lilact useful, please consider sponsoring. Your support funds ongoin
29
29
 
30
30
  ## Overview
31
31
 
32
- `Lilact` is a very lightweight implementation of the React API designed to run in the browser. It can be used as a single script that is around `90kb` minified and around `32kb` gzipped, and includes its whole API.
32
+ `Lilact` is a very lightweight implementation of the React API designed to run in the browser. It can be used as a single script that is around `90kb` minified and around `32kb` gzipped and includes its whole API.
33
33
 
34
34
  `Lilact` is very fast, uses minimal resources, and handles memory very efficiently.
35
35
 
@@ -81,14 +81,14 @@ Note: modules are separated in the documentation to improve structure, but in pr
81
81
 
82
82
  ## ESBuild-based Bundler
83
83
 
84
- A `ESBuild` based bundler is available in the `bin` directory. It can be used like this:
84
+ An `ESBuild` based bundler is available in the `bin` directory. It can be used like this:
85
85
 
86
86
  ```bash
87
- npx lilact-bundle --entry client/App.jsx --mode production --name bundle.js --out public/dist
87
+ npx lilact-bundle --watch --minify --entry client/App.jsx --mode production --name bundle.js --out public/dist
88
88
  ```
89
89
 
90
- If you add a `--watch` argument, the bundler will not exit and keep watching the input file(s),
91
- and update the bundle if any file is changed.
90
+ If you add a `--watch` argument, the bundler will stay running and keep watching the input file(s),
91
+ and update the bundle if any file is changed.
92
92
 
93
93
  ---
94
94
 
package/bin/bundle.cjs CHANGED
@@ -100,7 +100,7 @@ function parseArgs(argv) {
100
100
  if (!k || !k.startsWith("--")) continue;
101
101
  const key = k.slice(2);
102
102
 
103
- if (key === "watch") {
103
+ if (key === "watch" || key === "minify") {
104
104
  args[key] = true;
105
105
  continue;
106
106
  }
@@ -118,18 +118,19 @@ async function run() {
118
118
 
119
119
  if (!userEntry) {
120
120
  console.error(
121
- "Usage: lilact-bundler --watch --entry ./path/to/entry.js --mode production --out ./dist --name bundle.js"
121
+ "Usage: lilact-bundler --watch --minify --entry ./path/to/entry.js --mode production --out ./dist --name bundle.js"
122
122
  );
123
123
  process.exit(1);
124
124
  }
125
125
 
126
126
  const name = args.name ?? "bundle.js";
127
127
  const mode = args.mode ?? "production";
128
- const watch = args.watch === true;
128
+ const watch = args?.watch === true;
129
+ const minify = args?.minify === true;
129
130
 
130
131
  const userOutDir = args.out
131
- ? path.resolve(userProjectRoot, args.out)
132
- : path.resolve(userProjectRoot, "dist");
132
+ ? path.resolve(userProjectRoot, args.out)
133
+ : path.resolve(userProjectRoot, "dist");
133
134
 
134
135
  const outFile = path.join(userOutDir, name);
135
136
 
@@ -155,10 +156,10 @@ async function run() {
155
156
  platform: "browser",
156
157
 
157
158
  outfile: outFile,
158
- sourcemap: mode === "development",
159
+ sourcemap: true,
159
160
  target: ["es2018"],
160
161
 
161
- minify: mode === "production",
162
+ minify: minify,
162
163
  define,
163
164
 
164
165
  absWorkingDir: userProjectRoot,
@@ -177,15 +178,23 @@ async function run() {
177
178
  ],
178
179
  });
179
180
 
181
+ const shutdown = async () => {
182
+ try {
183
+ await ctx.dispose();
184
+ } finally {
185
+ process.exit(0);
186
+ }
187
+ };
188
+
180
189
  const buildOpts = {
181
190
  entryPoints: [userEntry],
182
191
  bundle: true,
183
192
  format: "esm",
184
193
  platform: "browser",
185
194
  outfile: outFile,
186
- sourcemap: mode === "development",
195
+ sourcemap: true,
187
196
  target: ["es2018"],
188
- minify: mode === "production",
197
+ minify: minify,
189
198
  define,
190
199
  loader: { ".js": "js", ".jsx": "jsx", ".css": "css" },
191
200
  resolveExtensions: [".js", ".jsx", ".json"],
@@ -199,15 +208,9 @@ async function run() {
199
208
  console.log(`Watching... output: ${outFile}`);
200
209
  } else {
201
210
  await ctx.rebuild();
211
+ await shutdown();
202
212
  }
203
213
 
204
- const shutdown = async () => {
205
- try {
206
- await ctx.dispose();
207
- } finally {
208
- process.exit(0);
209
- }
210
- };
211
214
 
212
215
  process.on("SIGINT", shutdown);
213
216
  process.on("SIGTERM", shutdown);
@@ -5301,10 +5301,10 @@ function parseXML(code2, index2, container2, look_behind = false) {
5301
5301
  if (res2[0] > index2) index2 = res2[0];
5302
5302
  else index2++;
5303
5303
  break;
5304
- case ">": {
5305
- const i3 = parseXMLContent(code2, index2, b2);
5306
- if (i3 === null) return;
5307
- if (i3 > index2) index2 = i3;
5304
+ case ">":
5305
+ const j = parseXMLContent(code2, index2, b2);
5306
+ if (j === null) return;
5307
+ if (j > index2) index2 = j;
5308
5308
  else index2++;
5309
5309
  if (b2.end) {
5310
5310
  if (container2) container2.children.push(b2);
@@ -5313,7 +5313,6 @@ function parseXML(code2, index2, container2, look_behind = false) {
5313
5313
  index2++;
5314
5314
  }
5315
5315
  break;
5316
- }
5317
5316
  case " ":
5318
5317
  case " ":
5319
5318
  case "\n":