@jxsuite/compiler 0.23.2 → 0.24.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.23.2",
3
+ "version": "0.24.0",
4
4
  "description": "Jx static HTML compiler, island detector, and site builder",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -9,7 +9,7 @@
9
9
  "directory": "packages/compiler"
10
10
  },
11
11
  "bin": {
12
- "jx": "./src/cli.js"
12
+ "jx": "./src/cli.ts"
13
13
  },
14
14
  "files": [
15
15
  "src/",
@@ -17,29 +17,31 @@
17
17
  ],
18
18
  "type": "module",
19
19
  "exports": {
20
- ".": "./src/compiler.js",
21
- "./content-loader": "./src/site/content-loader.js",
22
- "./context-injection": "./src/site/context-injection.js",
23
- "./head-merger": "./src/site/head-merger.js",
24
- "./layout-resolver": "./src/site/layout-resolver.js",
25
- "./pages-discovery": "./src/site/pages-discovery.js",
26
- "./site": "./src/site/site-build.js",
27
- "./site-loader": "./src/site/site-loader.js"
20
+ ".": "./src/compiler.ts",
21
+ "./content-loader": "./src/site/content-loader.ts",
22
+ "./context-injection": "./src/site/context-injection.ts",
23
+ "./head-merger": "./src/site/head-merger.ts",
24
+ "./layout-resolver": "./src/site/layout-resolver.ts",
25
+ "./pages-discovery": "./src/site/pages-discovery.ts",
26
+ "./site": "./src/site/site-build.ts",
27
+ "./site-loader": "./src/site/site-loader.ts",
28
+ "./types": "./src/types.ts"
28
29
  },
29
30
  "publishConfig": {
30
31
  "provenance": true
31
32
  },
32
33
  "scripts": {
33
- "build": "bun build src/compiler.js --outdir=dist --format=esm --minify",
34
- "build:site": "bun src/cli.js build",
35
- "test": "bun test",
36
- "test:coverage": "bun test --coverage",
34
+ "build": "bun build src/compiler.ts --outdir=dist --format=esm --minify",
35
+ "build:site": "bun src/cli.ts build",
36
+ "test": "bun test --isolate",
37
+ "test:coverage": "bun test --isolate --coverage",
37
38
  "upgrade": "bunx npm-check-updates -u && bun install"
38
39
  },
39
40
  "dependencies": {
40
41
  "@apidevtools/json-schema-ref-parser": "^15.3.5",
41
- "@jxsuite/parser": "^0.23.2",
42
- "@jxsuite/runtime": "^0.23.2",
42
+ "@jxsuite/parser": "^0.24.0",
43
+ "@jxsuite/runtime": "^0.24.0",
44
+ "@jxsuite/schema": "^0.23.2",
43
45
  "remark-gfm": "^4.0.1",
44
46
  "remark-stringify": "^11.0.0",
45
47
  "sharp": "^0.34.5",
@@ -36,7 +36,7 @@ if (command === "build") {
36
36
  console.log(`Building site from ${projectRoot}...`);
37
37
 
38
38
  try {
39
- const { buildSite } = await import("./site/site-build.js");
39
+ const { buildSite } = await import("./site/site-build.ts");
40
40
  const result = await buildSite(projectRoot, { verbose, clean });
41
41
 
42
42
  if (result.errors.length > 0) {
@@ -49,7 +49,7 @@ if (command === "build") {
49
49
 
50
50
  console.log(`\nDone: ${result.routes} routes → ${result.files} files`);
51
51
  } catch (e) {
52
- const err = /** @type {Error} */ (e);
52
+ const err = e as Error;
53
53
  console.error(`Build failed: ${err.message}`);
54
54
  process.exit(1);
55
55
  }
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from "./compiler.js";
2
+ import { runCli } from "./compiler.ts";
3
3
 
4
4
  const [, , src, out] = process.argv;
5
5
  if (src) {
@@ -21,19 +21,21 @@ import {
21
21
  tagNameToClassName,
22
22
  DEFAULT_REACTIVITY_SRC,
23
23
  DEFAULT_LIT_HTML_SRC,
24
- } from "./shared.js";
24
+ } from "./shared.ts";
25
25
  import {
26
26
  compileServer,
27
27
  compileSiteServer,
28
28
  compilePagesFunctions,
29
- } from "./targets/compile-server.js";
29
+ } from "./targets/compile-server.ts";
30
+
30
31
  import {
31
32
  compileElement,
32
33
  compileElementPage,
33
34
  emitElementModule,
34
- } from "./targets/compile-element.js";
35
- import { compileStaticPage } from "./targets/compile-static.js";
36
- import { compileClient } from "./targets/compile-client.js";
35
+ } from "./targets/compile-element.ts";
36
+ import { compileStaticPage } from "./targets/compile-static.ts";
37
+ import { compileClient } from "./targets/compile-client.ts";
38
+ import type { JxMutableNode } from "@jxsuite/schema/types";
37
39
 
38
40
  // Re-exports for consumers
39
41
  export {
@@ -61,13 +63,13 @@ export {
61
63
  * files: { path: string; content: string; tagName?: string }[];
62
64
  * }>}
63
65
  */
64
- export async function compile(sourcePath, opts = {}) {
66
+ export async function compile(sourcePath: string | any, opts: Record<string, unknown> = {}) {
65
67
  const {
66
68
  title = "Jx App",
67
69
  reactivitySrc = DEFAULT_REACTIVITY_SRC,
68
70
  litHtmlSrc = DEFAULT_LIT_HTML_SRC,
69
71
  projectStyle = null,
70
- } = /** @type {JxMutableNode} */ (opts);
72
+ } = opts as JxMutableNode;
71
73
 
72
74
  let raw;
73
75
  if (typeof sourcePath === "string") {
@@ -141,7 +143,7 @@ export async function compile(sourcePath, opts = {}) {
141
143
  * @param {string} src
142
144
  * @param {string} [out]
143
145
  */
144
- export async function runCli(src, out) {
146
+ export async function runCli(src: string, out?: string) {
145
147
  const [result, server] = await Promise.all([compile(src), compileServer(src)]);
146
148
  const { writeFileSync, mkdirSync } = await import("node:fs");
147
149
  const { dirname, join } = await import("node:path");