@jxsuite/compiler 11.1.2 → 11.2.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/dist/cli.js +254 -206
- package/dist/compiler.js +183 -135
- package/package.json +10 -18
- package/src/cli.ts +25 -3
- package/src/compiler.ts +13 -0
- package/src/shared.ts +521 -64
- package/src/site/asset-mounts.ts +2 -5
- package/src/site/build-time-request.ts +144 -0
- package/src/site/component-set.ts +117 -6
- package/src/site/db-push.ts +22 -2
- package/src/site/format-host.ts +2 -1
- package/src/site/i18n.ts +10 -137
- package/src/site/layout-resolver.ts +20 -3
- package/src/site/pages-discovery.ts +90 -4
- package/src/site/preview-server.ts +39 -10
- package/src/site/project-sections.ts +34 -2
- package/src/site/prototype-resolver.ts +74 -19
- package/src/site/schema-command.ts +4 -0
- package/src/site/section-push.ts +132 -0
- package/src/site/site-build.ts +353 -139
- package/src/site/validate-command.ts +146 -12
- package/src/site/well-known.ts +2 -2
- package/src/switch-cases.ts +176 -0
- package/src/targets/compile-client.ts +324 -72
- package/src/targets/compile-element.ts +165 -17
- package/src/targets/compile-static.ts +28 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jxsuite/compiler",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "Jx static HTML compiler, island detector, and site builder",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"./site-loader": "./src/site/site-loader.ts",
|
|
38
38
|
"./types": "./src/types.ts",
|
|
39
39
|
"./db-push": "./src/site/db-push.ts",
|
|
40
|
+
"./section-push": "./src/site/section-push.ts",
|
|
40
41
|
"./document-scripts": "./src/site/document-scripts.ts",
|
|
41
42
|
"./pack": "./src/targets/compile-pack.ts",
|
|
42
43
|
"./bundler": "./src/site/bundler.ts",
|
|
@@ -56,30 +57,21 @@
|
|
|
56
57
|
},
|
|
57
58
|
"dependencies": {
|
|
58
59
|
"@jxsuite/compiler-binding": "^0.3.0",
|
|
59
|
-
"@jxsuite/create": "^1.8.
|
|
60
|
-
"@jxsuite/erase": "^0.3.
|
|
61
|
-
"@jxsuite/runtime": "^9.0
|
|
62
|
-
"@jxsuite/schema": "^8.
|
|
63
|
-
"@jxsuite/site": "^4.
|
|
60
|
+
"@jxsuite/create": "^1.8.9",
|
|
61
|
+
"@jxsuite/erase": "^0.3.8",
|
|
62
|
+
"@jxsuite/runtime": "^9.1.0",
|
|
63
|
+
"@jxsuite/schema": "^8.3.0",
|
|
64
|
+
"@jxsuite/site": "^4.2.0",
|
|
64
65
|
"@vue/reactivity": "3.5.46",
|
|
65
66
|
"esbuild": "^0.28.2",
|
|
66
67
|
"lit-html": "^3.3.3"
|
|
67
68
|
},
|
|
68
69
|
"devDependencies": {
|
|
69
70
|
"@happy-dom/global-registrator": "^21.0.4",
|
|
70
|
-
"@jxsuite/
|
|
71
|
-
"@jxsuite/
|
|
71
|
+
"@jxsuite/auth": "^0.9.0",
|
|
72
|
+
"@jxsuite/connector": "^0.9.0",
|
|
73
|
+
"@jxsuite/parser": "^5.3.0",
|
|
72
74
|
"@jxsuite/test-support": "^0.0.0",
|
|
73
75
|
"@types/mdast": "^4.0.4"
|
|
74
|
-
},
|
|
75
|
-
"optionalDependencies": {
|
|
76
|
-
"@jxsuite/compiler-binding-linux-x64-gnu": "0.3.0",
|
|
77
|
-
"@jxsuite/compiler-binding-linux-x64-musl": "0.3.0",
|
|
78
|
-
"@jxsuite/compiler-binding-linux-arm64-gnu": "0.3.0",
|
|
79
|
-
"@jxsuite/compiler-binding-linux-arm64-musl": "0.3.0",
|
|
80
|
-
"@jxsuite/compiler-binding-darwin-x64": "0.3.0",
|
|
81
|
-
"@jxsuite/compiler-binding-darwin-arm64": "0.3.0",
|
|
82
|
-
"@jxsuite/compiler-binding-win32-x64-msvc": "0.3.0",
|
|
83
|
-
"@jxsuite/compiler-binding-win32-arm64-msvc": "0.3.0"
|
|
84
76
|
}
|
|
85
77
|
}
|
package/src/cli.ts
CHANGED
|
@@ -31,7 +31,7 @@ Commands:
|
|
|
31
31
|
validate [root] Validate the whole project: project.json, documents, classes, and fragments
|
|
32
32
|
convert <paths…> Move documents and the project file between .json and .jxn, repairing references
|
|
33
33
|
format [paths…] Format .jxn files and the code they hold (requires @jxsuite/server and Bun)
|
|
34
|
-
db push [root] Sync
|
|
34
|
+
db push [root] Sync data tables, then section owners' steps, to their connections (additive-only)
|
|
35
35
|
|
|
36
36
|
Options:
|
|
37
37
|
--verbose Print detailed build progress
|
|
@@ -102,13 +102,17 @@ Options:
|
|
|
102
102
|
process.exit(1);
|
|
103
103
|
}
|
|
104
104
|
const dryRun = flags.has("--dry-run");
|
|
105
|
+
let sectionFailed = false;
|
|
105
106
|
try {
|
|
106
107
|
const { dbPush } = await import("./site/db-push.ts");
|
|
107
108
|
const pushOptions: DbPushOptions = { dryRun };
|
|
108
109
|
if (connectionArg !== undefined) {
|
|
109
110
|
pushOptions.connection = connectionArg;
|
|
110
111
|
}
|
|
111
|
-
const { results, bindingsPatched, wranglerPath } = await dbPush(
|
|
112
|
+
const { results, sections, bindingsPatched, wranglerPath } = await dbPush(
|
|
113
|
+
projectRoot,
|
|
114
|
+
pushOptions,
|
|
115
|
+
);
|
|
112
116
|
for (const result of results) {
|
|
113
117
|
const mode = result.applied ? "applied" : "dry-run";
|
|
114
118
|
console.log(
|
|
@@ -122,13 +126,31 @@ Options:
|
|
|
122
126
|
console.warn(` warning: ${warning}`);
|
|
123
127
|
}
|
|
124
128
|
}
|
|
129
|
+
for (const section of sections) {
|
|
130
|
+
const mode = section.applied ? "applied" : "dry-run";
|
|
131
|
+
console.log(`${section.section} (section) — ${section.steps.length} step(s) [${mode}]`);
|
|
132
|
+
for (const step of section.steps) {
|
|
133
|
+
console.log(` ${step.sql ?? step.summary}`);
|
|
134
|
+
}
|
|
135
|
+
for (const warning of section.warnings) {
|
|
136
|
+
console.warn(` warning: ${warning}`);
|
|
137
|
+
}
|
|
138
|
+
if (section.error !== undefined) {
|
|
139
|
+
console.error(` error: ${section.error}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
125
142
|
if (bindingsPatched && wranglerPath) {
|
|
126
143
|
console.log(`Updated bindings in ${relative(projectRoot, wranglerPath)}`);
|
|
127
144
|
}
|
|
145
|
+
sectionFailed = sections.some((section) => section.error !== undefined);
|
|
128
146
|
} catch (error) {
|
|
129
147
|
console.error(`db push failed: ${errorMessage(error)}`);
|
|
130
148
|
process.exit(1);
|
|
131
149
|
}
|
|
150
|
+
// A section owner's failure prints with the whole push, then fails the command.
|
|
151
|
+
if (sectionFailed) {
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
132
154
|
return;
|
|
133
155
|
}
|
|
134
156
|
|
|
@@ -181,7 +203,7 @@ Options:
|
|
|
181
203
|
}
|
|
182
204
|
const { startPreviewServer } = await import("./site/preview-server.ts");
|
|
183
205
|
const port = portArg ?? 4173;
|
|
184
|
-
startPreviewServer(distDir, port);
|
|
206
|
+
startPreviewServer(distDir, port, projectRoot);
|
|
185
207
|
console.log(`Previewing ${distDir} at http://localhost:${port}`);
|
|
186
208
|
} else if (command === "schema") {
|
|
187
209
|
try {
|
package/src/compiler.ts
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
isDynamic,
|
|
25
25
|
pageImportMap,
|
|
26
26
|
tagNameToClassName,
|
|
27
|
+
assertExpressionRules,
|
|
27
28
|
} from "./shared.ts";
|
|
28
29
|
|
|
29
30
|
import { emitElementModule } from "./targets/compile-element.ts";
|
|
@@ -78,6 +79,11 @@ export interface CompileOptions {
|
|
|
78
79
|
* it today: the document's own `lang` is what reaches the emitted markup.
|
|
79
80
|
*/
|
|
80
81
|
lang?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Generated case tag to the module specifier (relative to the page module) that defines it. A
|
|
84
|
+
* site build supplies it so a lowered external `$switch` case loads its module on first use.
|
|
85
|
+
*/
|
|
86
|
+
caseModules?: ReadonlyMap<string, string>;
|
|
81
87
|
}
|
|
82
88
|
|
|
83
89
|
/** The page-target options {@link compile} forwards only when its caller set them. */
|
|
@@ -141,6 +147,8 @@ export async function compile(sourcePath: string | JxDocument, opts: CompileOpti
|
|
|
141
147
|
return { files: [{ content: jsContent, path: outputPath }], html: "" };
|
|
142
148
|
}
|
|
143
149
|
|
|
150
|
+
assertExpressionRules(raw);
|
|
151
|
+
|
|
144
152
|
// Route 1: Fully static → plain HTML/CSS
|
|
145
153
|
if (!isDynamic(raw)) {
|
|
146
154
|
// The static target emits no module, so it takes no runtime source and no `$src` rewriter.
|
|
@@ -164,6 +172,8 @@ export async function compile(sourcePath: string | JxDocument, opts: CompileOpti
|
|
|
164
172
|
opts.serverBaseUrl,
|
|
165
173
|
[],
|
|
166
174
|
opts.resolveClass,
|
|
175
|
+
null,
|
|
176
|
+
opts.caseModules,
|
|
167
177
|
);
|
|
168
178
|
const moduleFile = {
|
|
169
179
|
content: moduleContent,
|
|
@@ -207,6 +217,9 @@ export async function compile(sourcePath: string | JxDocument, opts: CompileOpti
|
|
|
207
217
|
if (opts.runtimeImports !== undefined) {
|
|
208
218
|
clientOptions.runtimeImports = opts.runtimeImports;
|
|
209
219
|
}
|
|
220
|
+
if (opts.caseModules !== undefined) {
|
|
221
|
+
clientOptions.caseModules = opts.caseModules;
|
|
222
|
+
}
|
|
210
223
|
return compileClient(raw, clientOptions);
|
|
211
224
|
}
|
|
212
225
|
|