@absolutejs/absolute 0.15.11 → 0.15.13
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 +2 -2
- package/dist/cli/index.js +391 -16
- package/dist/index.js +64 -44
- package/dist/index.js.map +7 -7
- package/dist/src/cli/interactive.d.ts +2 -0
- package/dist/src/cli/scripts/dev.d.ts +1 -0
- package/dist/src/cli/utils.d.ts +11 -0
- package/dist/src/utils/logger.d.ts +22 -13
- package/dist/types/cli.d.ts +17 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/types/cli.ts +20 -0
- package/types/index.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -1510,24 +1510,32 @@ var logWarn = (message) => {
|
|
|
1510
1510
|
const tag = `${colors.yellow}[hmr]${colors.reset}`;
|
|
1511
1511
|
console.warn(`${timestamp} ${tag} ${colors.yellow}warning${colors.reset} ${message}`);
|
|
1512
1512
|
};
|
|
1513
|
+
var startupBanner = (options) => {
|
|
1514
|
+
const { version, duration, port, host, networkUrl } = options;
|
|
1515
|
+
const name = `${colors.cyan}${colors.bold}ABSOLUTEJS${colors.reset}`;
|
|
1516
|
+
const ver = `${colors.dim}v${version}${colors.reset}`;
|
|
1517
|
+
const time = `${colors.dim}ready in${colors.reset} ${colors.bold}${getDurationString(duration)}${colors.reset}`;
|
|
1518
|
+
console.log("");
|
|
1519
|
+
console.log(` ${name} ${ver} ${time}`);
|
|
1520
|
+
console.log("");
|
|
1521
|
+
console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Local:${colors.reset} http://${host === "0.0.0.0" ? "localhost" : host}:${port}/`);
|
|
1522
|
+
if (networkUrl) {
|
|
1523
|
+
console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Network:${colors.reset} ${networkUrl}`);
|
|
1524
|
+
}
|
|
1525
|
+
console.log("");
|
|
1526
|
+
};
|
|
1513
1527
|
var logger = {
|
|
1514
|
-
hmrUpdate(path, framework) {
|
|
1515
|
-
log("hmr update", { path, framework });
|
|
1516
|
-
},
|
|
1517
|
-
pageReload(path, framework) {
|
|
1518
|
-
log("page reload", { path, framework });
|
|
1528
|
+
hmrUpdate(path, framework, duration) {
|
|
1529
|
+
log("hmr update", { path, framework, duration });
|
|
1519
1530
|
},
|
|
1520
|
-
|
|
1521
|
-
log("
|
|
1531
|
+
pageReload(path, framework, duration) {
|
|
1532
|
+
log("page reload", { path, framework, duration });
|
|
1522
1533
|
},
|
|
1523
|
-
|
|
1524
|
-
log("
|
|
1534
|
+
cssUpdate(path, framework, duration) {
|
|
1535
|
+
log("css update", { path, framework: framework ?? "css", duration });
|
|
1525
1536
|
},
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
const tag = `${colors.cyan}[hmr]${colors.reset}`;
|
|
1529
|
-
const message = `${colors.green}rebuilt${colors.reset} ${colors.dim}(${duration}ms)${colors.reset}`;
|
|
1530
|
-
console.log(`${timestamp} ${tag} ${message}`);
|
|
1537
|
+
scriptUpdate(path, framework, duration) {
|
|
1538
|
+
log("script update", { path, framework, duration });
|
|
1531
1539
|
},
|
|
1532
1540
|
error(message, error) {
|
|
1533
1541
|
logError(message, error);
|
|
@@ -1537,7 +1545,11 @@ var logger = {
|
|
|
1537
1545
|
},
|
|
1538
1546
|
info(message) {
|
|
1539
1547
|
log(message);
|
|
1540
|
-
}
|
|
1548
|
+
},
|
|
1549
|
+
serverReload() {
|
|
1550
|
+
log(`${colors.cyan}server module reloaded${colors.reset}`);
|
|
1551
|
+
},
|
|
1552
|
+
ready: startupBanner
|
|
1541
1553
|
};
|
|
1542
1554
|
// src/utils/validateSafePath.ts
|
|
1543
1555
|
import { resolve as resolve5, relative as relative3 } from "path";
|
|
@@ -1576,9 +1588,6 @@ var build2 = async ({
|
|
|
1576
1588
|
const projectRoot = cwd();
|
|
1577
1589
|
const isIncremental = incrementalFiles && incrementalFiles.length > 0;
|
|
1578
1590
|
const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
|
|
1579
|
-
if (isIncremental) {
|
|
1580
|
-
console.log(`\u26A1 Incremental build: ${incrementalFiles.length} file(s) to rebuild`);
|
|
1581
|
-
}
|
|
1582
1591
|
const throwOnError = options?.throwOnError === true;
|
|
1583
1592
|
const hmr = options?.injectHMR === true;
|
|
1584
1593
|
const buildPath = validateSafePath(buildDirectory, projectRoot);
|
|
@@ -1926,7 +1935,9 @@ var build2 = async ({
|
|
|
1926
1935
|
svelteDir,
|
|
1927
1936
|
vueDir
|
|
1928
1937
|
});
|
|
1929
|
-
|
|
1938
|
+
if (!isIncremental && !options?.injectHMR) {
|
|
1939
|
+
console.log(`Build completed in ${getDurationString(performance.now() - buildStart)}`);
|
|
1940
|
+
}
|
|
1930
1941
|
return manifest;
|
|
1931
1942
|
};
|
|
1932
1943
|
// src/core/devBuild.ts
|
|
@@ -2937,7 +2948,6 @@ var triggerRebuild = async (state, config, onRebuildComplete, filesToRebuild) =>
|
|
|
2937
2948
|
throw new Error("Build failed - no manifest generated");
|
|
2938
2949
|
}
|
|
2939
2950
|
const duration = Date.now() - startTime;
|
|
2940
|
-
logger.rebuilt(duration);
|
|
2941
2951
|
broadcastToClients(state, {
|
|
2942
2952
|
data: {
|
|
2943
2953
|
affectedFrameworks,
|
|
@@ -2970,9 +2980,9 @@ var triggerRebuild = async (state, config, onRebuildComplete, filesToRebuild) =>
|
|
|
2970
2980
|
const hasComponentChanges = reactFiles.some((file4) => file4.endsWith(".tsx") || file4.endsWith(".ts") || file4.endsWith(".jsx"));
|
|
2971
2981
|
const hasCSSChanges = reactFiles.some((file4) => file4.endsWith(".css"));
|
|
2972
2982
|
if (hasCSSChanges && !hasComponentChanges) {
|
|
2973
|
-
logger.cssUpdate(primarySource ?? reactFiles[0] ?? "", "react");
|
|
2983
|
+
logger.cssUpdate(primarySource ?? reactFiles[0] ?? "", "react", duration);
|
|
2974
2984
|
} else {
|
|
2975
|
-
logger.hmrUpdate(primarySource ?? reactFiles[0] ?? "", "react");
|
|
2985
|
+
logger.hmrUpdate(primarySource ?? reactFiles[0] ?? "", "react", duration);
|
|
2976
2986
|
}
|
|
2977
2987
|
broadcastToClients(state, {
|
|
2978
2988
|
data: {
|
|
@@ -3002,7 +3012,7 @@ var triggerRebuild = async (state, config, onRebuildComplete, filesToRebuild) =>
|
|
|
3002
3012
|
const manifestKey = pascalName;
|
|
3003
3013
|
const scriptPath = manifest[manifestKey] || null;
|
|
3004
3014
|
if (scriptPath) {
|
|
3005
|
-
logger.scriptUpdate(scriptFile, "html");
|
|
3015
|
+
logger.scriptUpdate(scriptFile, "html", duration);
|
|
3006
3016
|
broadcastToClients(state, {
|
|
3007
3017
|
data: {
|
|
3008
3018
|
framework: "html",
|
|
@@ -3033,7 +3043,7 @@ var triggerRebuild = async (state, config, onRebuildComplete, filesToRebuild) =>
|
|
|
3033
3043
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
3034
3044
|
const newHTML = await handleHTMLUpdate2(builtHtmlPagePath);
|
|
3035
3045
|
if (newHTML) {
|
|
3036
|
-
logger.hmrUpdate(pageFile, "html");
|
|
3046
|
+
logger.hmrUpdate(pageFile, "html", duration);
|
|
3037
3047
|
broadcastToClients(state, {
|
|
3038
3048
|
data: {
|
|
3039
3049
|
framework: "html",
|
|
@@ -3064,7 +3074,7 @@ var triggerRebuild = async (state, config, onRebuildComplete, filesToRebuild) =>
|
|
|
3064
3074
|
const cssPascalName = toPascal2(cssBaseName);
|
|
3065
3075
|
const cssKey = `${cssPascalName}CSS`;
|
|
3066
3076
|
const cssUrl = manifest[cssKey] || null;
|
|
3067
|
-
logger.cssUpdate(cssFile, "vue");
|
|
3077
|
+
logger.cssUpdate(cssFile, "vue", duration);
|
|
3068
3078
|
broadcastToClients(state, {
|
|
3069
3079
|
data: {
|
|
3070
3080
|
framework: "vue",
|
|
@@ -3093,7 +3103,7 @@ var triggerRebuild = async (state, config, onRebuildComplete, filesToRebuild) =>
|
|
|
3093
3103
|
const hmrMeta = vueHmrMetadata2.get(resolve17(vuePagePath));
|
|
3094
3104
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
3095
3105
|
if (changeType === "style-only") {
|
|
3096
|
-
logger.cssUpdate(vuePagePath, "vue");
|
|
3106
|
+
logger.cssUpdate(vuePagePath, "vue", duration);
|
|
3097
3107
|
broadcastToClients(state, {
|
|
3098
3108
|
data: {
|
|
3099
3109
|
framework: "vue",
|
|
@@ -3112,7 +3122,7 @@ var triggerRebuild = async (state, config, onRebuildComplete, filesToRebuild) =>
|
|
|
3112
3122
|
const { handleVueUpdate: handleVueUpdate2 } = await Promise.resolve().then(() => (init_simpleVueHMR(), exports_simpleVueHMR));
|
|
3113
3123
|
const newHTML = await handleVueUpdate2(vuePagePath, manifest, state.resolvedPaths.buildDir);
|
|
3114
3124
|
const componentPath = manifest[`${pascalName}Client`] || null;
|
|
3115
|
-
logger.hmrUpdate(vuePagePath, "vue");
|
|
3125
|
+
logger.hmrUpdate(vuePagePath, "vue", duration);
|
|
3116
3126
|
broadcastToClients(state, {
|
|
3117
3127
|
data: {
|
|
3118
3128
|
framework: "vue",
|
|
@@ -3148,7 +3158,7 @@ var triggerRebuild = async (state, config, onRebuildComplete, filesToRebuild) =>
|
|
|
3148
3158
|
const cssPascalName = toPascal2(cssBaseName);
|
|
3149
3159
|
const cssKey = `${cssPascalName}CSS`;
|
|
3150
3160
|
const cssUrl = manifest[cssKey] || null;
|
|
3151
|
-
logger.cssUpdate(cssFile, "svelte");
|
|
3161
|
+
logger.cssUpdate(cssFile, "svelte", duration);
|
|
3152
3162
|
broadcastToClients(state, {
|
|
3153
3163
|
data: {
|
|
3154
3164
|
framework: "svelte",
|
|
@@ -3173,7 +3183,7 @@ var triggerRebuild = async (state, config, onRebuildComplete, filesToRebuild) =>
|
|
|
3173
3183
|
const pascalName = toPascal2(baseName);
|
|
3174
3184
|
const cssKey = `${pascalName}CSS`;
|
|
3175
3185
|
const cssUrl = manifest[cssKey] || null;
|
|
3176
|
-
logger.hmrUpdate(sveltePagePath, "svelte");
|
|
3186
|
+
logger.hmrUpdate(sveltePagePath, "svelte", duration);
|
|
3177
3187
|
broadcastToClients(state, {
|
|
3178
3188
|
data: {
|
|
3179
3189
|
framework: "svelte",
|
|
@@ -3204,7 +3214,7 @@ var triggerRebuild = async (state, config, onRebuildComplete, filesToRebuild) =>
|
|
|
3204
3214
|
const manifestKey = pascalName;
|
|
3205
3215
|
const scriptPath = manifest[manifestKey] || null;
|
|
3206
3216
|
if (scriptPath) {
|
|
3207
|
-
logger.scriptUpdate(scriptFile, "htmx");
|
|
3217
|
+
logger.scriptUpdate(scriptFile, "htmx", duration);
|
|
3208
3218
|
broadcastToClients(state, {
|
|
3209
3219
|
data: {
|
|
3210
3220
|
framework: "htmx",
|
|
@@ -3232,7 +3242,7 @@ var triggerRebuild = async (state, config, onRebuildComplete, filesToRebuild) =>
|
|
|
3232
3242
|
const { handleHTMXUpdate: handleHTMXUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMXHMR(), exports_simpleHTMXHMR));
|
|
3233
3243
|
const newHTML = await handleHTMXUpdate2(builtHtmxPagePath);
|
|
3234
3244
|
if (newHTML) {
|
|
3235
|
-
logger.hmrUpdate(htmxPageFile, "htmx");
|
|
3245
|
+
logger.hmrUpdate(htmxPageFile, "htmx", duration);
|
|
3236
3246
|
broadcastToClients(state, {
|
|
3237
3247
|
data: {
|
|
3238
3248
|
framework: "htmx",
|
|
@@ -3347,10 +3357,9 @@ var devBuild = async (config) => {
|
|
|
3347
3357
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
3348
3358
|
globalThis.__hmrServerMtime = serverMtime;
|
|
3349
3359
|
if (serverMtime !== lastMtime) {
|
|
3350
|
-
|
|
3360
|
+
logger.serverReload();
|
|
3351
3361
|
} else {
|
|
3352
3362
|
globalThis.__hmrSkipServerRestart = true;
|
|
3353
|
-
console.log("\x1B[36m[hmr] Hot module update detected\x1B[0m");
|
|
3354
3363
|
}
|
|
3355
3364
|
return cached;
|
|
3356
3365
|
}
|
|
@@ -3360,7 +3369,13 @@ var devBuild = async (config) => {
|
|
|
3360
3369
|
if (config.reactDirectory) {
|
|
3361
3370
|
setDevVendorPaths(computeVendorPaths());
|
|
3362
3371
|
}
|
|
3363
|
-
|
|
3372
|
+
try {
|
|
3373
|
+
const pkg = await Bun.file(resolve18(import.meta.dir, "..", "..", "package.json")).json();
|
|
3374
|
+
if (pkg.name === "@absolutejs/absolute") {
|
|
3375
|
+
globalThis.__absoluteVersion = pkg.version;
|
|
3376
|
+
}
|
|
3377
|
+
} catch {}
|
|
3378
|
+
const buildStart = performance.now();
|
|
3364
3379
|
const manifest = await build2({
|
|
3365
3380
|
...config,
|
|
3366
3381
|
options: {
|
|
@@ -3385,19 +3400,16 @@ var devBuild = async (config) => {
|
|
|
3385
3400
|
}
|
|
3386
3401
|
} catch {}
|
|
3387
3402
|
}
|
|
3388
|
-
console.log("\u2705 Build completed successfully");
|
|
3389
3403
|
startFileWatching(state, config, (filePath) => {
|
|
3390
3404
|
queueFileChange(state, filePath, config, (newBuildResult) => {
|
|
3391
3405
|
Object.assign(manifest, newBuildResult.manifest);
|
|
3392
3406
|
});
|
|
3393
3407
|
});
|
|
3394
|
-
|
|
3395
|
-
console.log("\uD83D\uDD25 HMR: Ready");
|
|
3408
|
+
globalThis.__hmrBuildDuration = performance.now() - buildStart;
|
|
3396
3409
|
const result = {
|
|
3397
3410
|
hmrState: state,
|
|
3398
3411
|
manifest
|
|
3399
3412
|
};
|
|
3400
|
-
globalThis.__hmrServerStartup = Date.now().toString();
|
|
3401
3413
|
globalThis.__hmrDevResult = result;
|
|
3402
3414
|
globalThis.__hmrServerMtime = statSync(resolve18(Bun.main)).mtimeMs;
|
|
3403
3415
|
return result;
|
|
@@ -3504,12 +3516,20 @@ var networking = (app) => app.listen({
|
|
|
3504
3516
|
hostname: host,
|
|
3505
3517
|
port
|
|
3506
3518
|
}, () => {
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
console.log(`Server started on http://${host}:${port}`);
|
|
3519
|
+
const isHotReload = !!globalThis.__hmrServerStartup;
|
|
3520
|
+
globalThis.__hmrServerStartup = true;
|
|
3521
|
+
if (isHotReload) {
|
|
3522
|
+
return;
|
|
3512
3523
|
}
|
|
3524
|
+
const buildDuration = globalThis.__hmrBuildDuration ?? 0;
|
|
3525
|
+
const version = globalThis.__absoluteVersion ?? "";
|
|
3526
|
+
logger.ready({
|
|
3527
|
+
duration: buildDuration,
|
|
3528
|
+
host,
|
|
3529
|
+
networkUrl: hostFlag ? `http://${localIP}:${port}/` : undefined,
|
|
3530
|
+
port,
|
|
3531
|
+
version
|
|
3532
|
+
});
|
|
3513
3533
|
});
|
|
3514
3534
|
// src/utils/getEnv.ts
|
|
3515
3535
|
var {env: env4 } = globalThis.Bun;
|
|
@@ -3636,5 +3656,5 @@ export {
|
|
|
3636
3656
|
BUN_BUILD_WARNING_SUPPRESSION
|
|
3637
3657
|
};
|
|
3638
3658
|
|
|
3639
|
-
//# debugId=
|
|
3659
|
+
//# debugId=D632BA6ED9E5CC8464756E2164756E21
|
|
3640
3660
|
//# sourceMappingURL=index.js.map
|