@absolutejs/absolute 0.20.0-beta.160 → 0.20.0-beta.161
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/CHANGELOG.md +7 -0
- package/changelog.json +14 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/build.js +155 -138
- package/dist/build.js.map +5 -4
- package/dist/cli/{index-55k7vn84.js → index-f82hvr9c.js} +65 -10
- package/dist/cli/index.js +3 -3
- package/dist/cli/{mobile-0r1y2hwc.js → mobile-2f54v4by.js} +1 -1
- package/dist/cli/{start-4rpdy8hg.js → start-0bx1rkx4.js} +1 -1
- package/dist/index.js +671 -654
- package/dist/index.js.map +5 -4
- package/dist/src/core/productionRuntime.d.ts +11 -0
- package/package.json +1 -1
|
@@ -52,8 +52,61 @@ import {
|
|
|
52
52
|
|
|
53
53
|
// src/cli/scripts/start.ts
|
|
54
54
|
var {env } = globalThis.Bun;
|
|
55
|
-
import { existsSync, readFileSync, rmSync } from "fs";
|
|
56
|
-
import { basename, join, resolve } from "path";
|
|
55
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, rmSync } from "fs";
|
|
56
|
+
import { basename, join as join2, resolve } from "path";
|
|
57
|
+
|
|
58
|
+
// src/core/productionRuntime.ts
|
|
59
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
60
|
+
import { join } from "path";
|
|
61
|
+
var PRODUCTION_RUNTIME_FILE = "absolute-runtime.json";
|
|
62
|
+
var PRODUCTION_RUNTIME_VERSION = 1;
|
|
63
|
+
var RUNTIME_KEYS = [
|
|
64
|
+
"angularDirectory",
|
|
65
|
+
"assetsDirectory",
|
|
66
|
+
"astroDirectory",
|
|
67
|
+
"emberDirectory",
|
|
68
|
+
"htmlDirectory",
|
|
69
|
+
"htmxDirectory",
|
|
70
|
+
"images",
|
|
71
|
+
"islands",
|
|
72
|
+
"mobile",
|
|
73
|
+
"openapi",
|
|
74
|
+
"publicDirectory",
|
|
75
|
+
"reactDirectory",
|
|
76
|
+
"static",
|
|
77
|
+
"svelteDirectory",
|
|
78
|
+
"telemetry",
|
|
79
|
+
"vueDirectory"
|
|
80
|
+
];
|
|
81
|
+
var productionRuntimeConfigOf = (config) => {
|
|
82
|
+
const picked = {};
|
|
83
|
+
for (const key of RUNTIME_KEYS)
|
|
84
|
+
if (config[key] !== undefined)
|
|
85
|
+
picked[key] = config[key];
|
|
86
|
+
const runtime = JSON.parse(JSON.stringify(picked));
|
|
87
|
+
return runtime;
|
|
88
|
+
};
|
|
89
|
+
var writeProductionRuntime = (config, buildDirectory) => {
|
|
90
|
+
const file = {
|
|
91
|
+
config: productionRuntimeConfigOf(config),
|
|
92
|
+
version: PRODUCTION_RUNTIME_VERSION
|
|
93
|
+
};
|
|
94
|
+
writeFileSync(join(buildDirectory, PRODUCTION_RUNTIME_FILE), `${JSON.stringify(file)}
|
|
95
|
+
`);
|
|
96
|
+
};
|
|
97
|
+
var isRuntimeFile = (value) => typeof value === "object" && value !== null && ("version" in value) && value.version === PRODUCTION_RUNTIME_VERSION && ("config" in value) && typeof value.config === "object" && value.config !== null;
|
|
98
|
+
var readProductionRuntime = (buildDirectory) => {
|
|
99
|
+
const path = join(buildDirectory, PRODUCTION_RUNTIME_FILE);
|
|
100
|
+
if (!existsSync(path))
|
|
101
|
+
return null;
|
|
102
|
+
const parsed = JSON.parse(readFileSync(path, "utf-8"));
|
|
103
|
+
if (!isRuntimeFile(parsed))
|
|
104
|
+
return null;
|
|
105
|
+
const config = { ...parsed.config, buildDirectory };
|
|
106
|
+
return config;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// src/cli/scripts/start.ts
|
|
57
110
|
var cliTag = (color, message) => `\x1B[2m${formatTimestamp2()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`;
|
|
58
111
|
var resolvePackageVersion = (candidates) => {
|
|
59
112
|
for (const candidate of candidates) {
|
|
@@ -66,7 +119,7 @@ var resolvePackageVersion = (candidates) => {
|
|
|
66
119
|
};
|
|
67
120
|
var readPackageVersion = (candidate) => {
|
|
68
121
|
try {
|
|
69
|
-
const pkg = JSON.parse(
|
|
122
|
+
const pkg = JSON.parse(readFileSync2(candidate, "utf-8"));
|
|
70
123
|
if (pkg.name !== "@absolutejs/absolute")
|
|
71
124
|
return null;
|
|
72
125
|
const ver = pkg.version;
|
|
@@ -116,7 +169,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
116
169
|
resolve(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
117
170
|
];
|
|
118
171
|
for (const candidate of candidates) {
|
|
119
|
-
if (
|
|
172
|
+
if (existsSync2(candidate))
|
|
120
173
|
return candidate;
|
|
121
174
|
}
|
|
122
175
|
return resolve(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
@@ -156,7 +209,7 @@ var runPreparedServer = async ({
|
|
|
156
209
|
serverEntry,
|
|
157
210
|
totalDuration
|
|
158
211
|
}) => {
|
|
159
|
-
const usesDocker =
|
|
212
|
+
const usesDocker = existsSync2(resolve(COMPOSE_PATH));
|
|
160
213
|
const scripts = usesDocker ? await readDbScripts() : null;
|
|
161
214
|
if (scripts)
|
|
162
215
|
await startDatabase(scripts);
|
|
@@ -253,7 +306,8 @@ var start2 = async (serverEntry, outdir, configPath, options = {}) => {
|
|
|
253
306
|
resolve(import.meta.dir, "..", "..", "..", "package.json"),
|
|
254
307
|
resolve(import.meta.dir, "..", "..", "package.json")
|
|
255
308
|
]);
|
|
256
|
-
const
|
|
309
|
+
const builtConfig = options.prebuilt ? readProductionRuntime(resolvedOutdir) : null;
|
|
310
|
+
const buildConfig = builtConfig ?? await loadConfig(configPath);
|
|
257
311
|
buildConfig.buildDirectory = resolvedOutdir;
|
|
258
312
|
buildConfig.mode = "production";
|
|
259
313
|
if (buildConfig.mobile)
|
|
@@ -268,7 +322,7 @@ var start2 = async (serverEntry, outdir, configPath, options = {}) => {
|
|
|
268
322
|
].filter((val) => Boolean(val));
|
|
269
323
|
const outputPath = resolve(resolvedOutdir, `${entryName}.js`);
|
|
270
324
|
if (options.prebuilt) {
|
|
271
|
-
if (!
|
|
325
|
+
if (!existsSync2(outputPath)) {
|
|
272
326
|
throw new Error(`Prepared production server not found: ${outputPath}`);
|
|
273
327
|
}
|
|
274
328
|
return runPreparedServer({
|
|
@@ -295,7 +349,7 @@ var start2 = async (serverEntry, outdir, configPath, options = {}) => {
|
|
|
295
349
|
if (!build)
|
|
296
350
|
throw new Error("Could not locate build module");
|
|
297
351
|
await build(buildConfig);
|
|
298
|
-
rmSync(
|
|
352
|
+
rmSync(join2(resolvedOutdir, "_prerendered"), {
|
|
299
353
|
force: true,
|
|
300
354
|
recursive: true
|
|
301
355
|
});
|
|
@@ -400,11 +454,11 @@ var start2 = async (serverEntry, outdir, configPath, options = {}) => {
|
|
|
400
454
|
if (!serverBundle.success) {
|
|
401
455
|
handleBundleFailure(serverBundle, bundleStart, serverEntry);
|
|
402
456
|
}
|
|
403
|
-
if (!
|
|
457
|
+
if (!existsSync2(outputPath)) {
|
|
404
458
|
console.error(cliTag("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
405
459
|
process.exit(1);
|
|
406
460
|
}
|
|
407
|
-
if (
|
|
461
|
+
if (existsSync2(resolve(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
408
462
|
const { readdirSync } = await import("fs");
|
|
409
463
|
const vendorDir = resolve(resolvedOutdir, "angular", "vendor", "server");
|
|
410
464
|
const vendorEntries = readdirSync(vendorDir).filter((fileName) => fileName.endsWith(".js"));
|
|
@@ -424,6 +478,7 @@ var start2 = async (serverEntry, outdir, configPath, options = {}) => {
|
|
|
424
478
|
await rewriteImports([outputPath], angularServerVendorPaths);
|
|
425
479
|
}
|
|
426
480
|
}
|
|
481
|
+
writeProductionRuntime(buildConfig, resolvedOutdir);
|
|
427
482
|
if (buildConfig.mobile) {
|
|
428
483
|
await finalizeAbsoluteMobileCompatibilityBuild({
|
|
429
484
|
buildDirectory: resolvedOutdir,
|
package/dist/cli/index.js
CHANGED
|
@@ -70,7 +70,7 @@ if (command === "dev") {
|
|
|
70
70
|
const configPath = parseNamedArg("--config");
|
|
71
71
|
const positionalArgs = stripNamedArgs("--outdir", "--config").filter((arg) => arg !== "--prebuilt");
|
|
72
72
|
const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
|
|
73
|
-
const { start } = await import("./start-
|
|
73
|
+
const { start } = await import("./start-0bx1rkx4.js");
|
|
74
74
|
await start(serverEntry, outdir, configPath, {
|
|
75
75
|
prebuilt: args.includes("--prebuilt")
|
|
76
76
|
});
|
|
@@ -80,7 +80,7 @@ if (command === "dev") {
|
|
|
80
80
|
const configPath = parseNamedArg("--config");
|
|
81
81
|
const positionalArgs = stripNamedArgs("--outdir", "--config");
|
|
82
82
|
const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
|
|
83
|
-
const { start } = await import("./start-
|
|
83
|
+
const { start } = await import("./start-0bx1rkx4.js");
|
|
84
84
|
await start(serverEntry, outdir, configPath, { prepareOnly: true });
|
|
85
85
|
} else if (command === "build") {
|
|
86
86
|
sendTelemetryEvent("cli:command", { command });
|
|
@@ -211,7 +211,7 @@ if (command === "dev") {
|
|
|
211
211
|
sendTelemetryEvent("cli:command", {
|
|
212
212
|
command: `mobile:${workspaceCommand ?? "unknown"}`
|
|
213
213
|
});
|
|
214
|
-
const { runMobile } = await import("./mobile-
|
|
214
|
+
const { runMobile } = await import("./mobile-2f54v4by.js");
|
|
215
215
|
try {
|
|
216
216
|
await runMobile(args);
|
|
217
217
|
} catch (error) {
|