@jxsuite/compiler 0.20.0 → 0.21.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jxsuite/compiler",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "Jx static HTML compiler, island detector, and site builder",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,13 +33,13 @@
33
33
  "build": "bun build src/compiler.js --outdir=dist --format=esm --minify",
34
34
  "build:site": "bun src/cli.js build",
35
35
  "test": "bun test",
36
+ "test:coverage": "bun test --coverage",
36
37
  "upgrade": "bunx npm-check-updates -u && bun install"
37
38
  },
38
39
  "dependencies": {
39
40
  "@apidevtools/json-schema-ref-parser": "^15.3.5",
40
- "@jxsuite/parser": "^0.20.0",
41
- "@jxsuite/runtime": "^0.20.0",
42
- "glob": "^13.0.6",
41
+ "@jxsuite/parser": "^0.21.0",
42
+ "@jxsuite/runtime": "^0.21.0",
43
43
  "remark-gfm": "^4.0.1",
44
44
  "remark-stringify": "^11.0.0",
45
45
  "sharp": "^0.34.5",
@@ -9,9 +9,8 @@
9
9
  * @module content-loader
10
10
  */
11
11
 
12
- import { readFileSync } from "node:fs";
12
+ import { readFileSync, readdirSync, existsSync, globSync } from "node:fs";
13
13
  import { resolve, basename, extname } from "node:path";
14
- import { globSync } from "glob";
15
14
 
16
15
  // ─── CSV Parser (minimal, spec-compliant) ─────────────────────────────────────
17
16
 
@@ -287,9 +286,27 @@ async function loadContentType(name, contentTypeDef, projectRoot) {
287
286
  }
288
287
  : undefined;
289
288
 
290
- // Resolve the glob pattern relative to project root
291
- const pattern = resolve(projectRoot, source).split("\\").join("/");
292
- const files = globSync(pattern, { absolute: true });
289
+ // Resolve source path and discover files
290
+ const resolvedSource = resolve(projectRoot, source).split("\\").join("/");
291
+ /** @type {string[]} */
292
+ let files;
293
+
294
+ if (source.includes("*") || source.includes("?")) {
295
+ files = globSync(source, { cwd: projectRoot }).map((f) => resolve(projectRoot, f));
296
+ } else if (extname(source)) {
297
+ files = existsSync(resolvedSource) ? [resolvedSource] : [];
298
+ } else {
299
+ const format = contentTypeDef.format || "md";
300
+ const ext = `.${format}`;
301
+ const dir = resolvedSource.endsWith("/") ? resolvedSource : resolvedSource + "/";
302
+ try {
303
+ files = readdirSync(dir, { recursive: true })
304
+ .filter((f) => String(f).endsWith(ext))
305
+ .map((f) => resolve(dir, String(f)));
306
+ } catch {
307
+ files = [];
308
+ }
309
+ }
293
310
 
294
311
  /** @type {ContentLoaderEntry[]} */
295
312
  const entries = [];