@akanjs/cli 2.1.0-rc.9 → 2.1.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/incrementalBuilder.proc.js +106 -53
- package/index.js +391 -108
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
4
|
// pkgs/@akanjs/devkit/incrementalBuilder/incrementalBuilder.proc.ts
|
|
5
|
-
import
|
|
5
|
+
import path37 from "path";
|
|
6
6
|
|
|
7
7
|
// pkgs/@akanjs/devkit/aiEditor.ts
|
|
8
8
|
import { input, select } from "@inquirer/prompts";
|
|
@@ -486,7 +486,18 @@ var DEFAULT_OPTIMIZE_IMPORTS = [
|
|
|
486
486
|
var WORKSPACE_BARREL_FACETS = ["ui", "webkit", "common", "client", "server"];
|
|
487
487
|
var SSR_RUNTIME_PACKAGES = ["react", "react-dom", "react-server-dom-webpack"];
|
|
488
488
|
var NATIVE_RUNTIME_PACKAGES = ["sharp"];
|
|
489
|
-
var
|
|
489
|
+
var DEFAULT_BACKEND_RUNTIME_PACKAGES = ["croner"];
|
|
490
|
+
var DATABASE_MODE_RUNTIME_PACKAGES = {
|
|
491
|
+
single: [],
|
|
492
|
+
multiple: ["@libsql/client", "bullmq", "ioredis", "protobufjs"],
|
|
493
|
+
cluster: ["bullmq", "ioredis", "postgres", "protobufjs"]
|
|
494
|
+
};
|
|
495
|
+
var AKAN_RUNTIME_PACKAGES = new Set([
|
|
496
|
+
...SSR_RUNTIME_PACKAGES,
|
|
497
|
+
...NATIVE_RUNTIME_PACKAGES,
|
|
498
|
+
...DEFAULT_BACKEND_RUNTIME_PACKAGES,
|
|
499
|
+
...Object.values(DATABASE_MODE_RUNTIME_PACKAGES).flat()
|
|
500
|
+
]);
|
|
490
501
|
var DEFAULT_AKAN_IMAGE_CONFIG = {
|
|
491
502
|
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
|
|
492
503
|
imageSizes: [32, 48, 64, 96, 128, 256, 384],
|
|
@@ -695,13 +706,22 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
|
695
706
|
if (AKAN_RUNTIME_PACKAGES.has(lib))
|
|
696
707
|
return akanPackageJson.dependencies?.[lib] ?? akanPackageJson.peerDependencies?.[lib];
|
|
697
708
|
}
|
|
709
|
+
#getProductionRuntimePackages() {
|
|
710
|
+
return [
|
|
711
|
+
...this.externalLibs,
|
|
712
|
+
...SSR_RUNTIME_PACKAGES,
|
|
713
|
+
...NATIVE_RUNTIME_PACKAGES,
|
|
714
|
+
...DEFAULT_BACKEND_RUNTIME_PACKAGES,
|
|
715
|
+
...DATABASE_MODE_RUNTIME_PACKAGES[this.defaultDatabaseMode]
|
|
716
|
+
];
|
|
717
|
+
}
|
|
698
718
|
getProductionPackageJson(data = {}) {
|
|
699
719
|
return {
|
|
700
720
|
name: this.app.name,
|
|
701
721
|
description: this.app.name,
|
|
702
722
|
version: "1.0.0",
|
|
703
723
|
main: "./main.js",
|
|
704
|
-
dependencies: Object.fromEntries([...new Set(
|
|
724
|
+
dependencies: Object.fromEntries([...new Set(this.#getProductionRuntimePackages())].map((lib) => {
|
|
705
725
|
const version = this.#resolveProductionDependencyVersion(lib);
|
|
706
726
|
if (!version)
|
|
707
727
|
throw new Error(`Dependency ${lib} not found in package.json`);
|
|
@@ -7168,9 +7188,19 @@ var SSR_RENDER_EXTERNALS = [
|
|
|
7168
7188
|
"react/jsx-dev-runtime",
|
|
7169
7189
|
"react-dom",
|
|
7170
7190
|
"react-dom/server.browser",
|
|
7191
|
+
"react-server-dom-webpack",
|
|
7192
|
+
"react-server-dom-webpack/server.node",
|
|
7171
7193
|
"react-server-dom-webpack/client.node",
|
|
7172
7194
|
"react-server-dom-webpack/client.browser"
|
|
7173
7195
|
];
|
|
7196
|
+
var AKAN_OPTIONAL_BACKEND_EXTERNALS = [
|
|
7197
|
+
"@libsql/client",
|
|
7198
|
+
"bullmq",
|
|
7199
|
+
"croner",
|
|
7200
|
+
"ioredis",
|
|
7201
|
+
"postgres",
|
|
7202
|
+
"protobufjs"
|
|
7203
|
+
];
|
|
7174
7204
|
|
|
7175
7205
|
class ApplicationBuildRunner {
|
|
7176
7206
|
#app;
|
|
@@ -7239,7 +7269,9 @@ class ApplicationBuildRunner {
|
|
|
7239
7269
|
}
|
|
7240
7270
|
async#buildBackend() {
|
|
7241
7271
|
const akanConfig2 = await this.#app.getConfig();
|
|
7242
|
-
const backendExternals = [
|
|
7272
|
+
const backendExternals = [
|
|
7273
|
+
...new Set([...akanConfig2.externalLibs, ...SSR_RENDER_EXTERNALS, ...AKAN_OPTIONAL_BACKEND_EXTERNALS])
|
|
7274
|
+
];
|
|
7243
7275
|
const backendEntryPoints = [`${this.#app.cwdPath}/main.ts`, `${this.#app.cwdPath}/server.ts`];
|
|
7244
7276
|
for (const entrypoint of backendEntryPoints) {
|
|
7245
7277
|
if (!await Bun.file(entrypoint).exists())
|
|
@@ -7261,7 +7293,7 @@ class ApplicationBuildRunner {
|
|
|
7261
7293
|
naming: { entry: "[name].[ext]", chunk: "chunk-[hash].[ext]" },
|
|
7262
7294
|
conditions: ["react-server"],
|
|
7263
7295
|
define: { "process.env.NODE_ENV": JSON.stringify("production") },
|
|
7264
|
-
plugins:
|
|
7296
|
+
plugins: backendExternals.length > 0 ? [this.#createExternalSpecifiersPlugin(backendExternals)] : []
|
|
7265
7297
|
});
|
|
7266
7298
|
return {
|
|
7267
7299
|
entrypoints: backendEntryPoints.length + 1,
|
|
@@ -7609,10 +7641,31 @@ class ApplicationReleasePackager {
|
|
|
7609
7641
|
`;
|
|
7610
7642
|
}
|
|
7611
7643
|
}
|
|
7644
|
+
// pkgs/@akanjs/devkit/applicationTestPreload.ts
|
|
7645
|
+
import path33 from "path";
|
|
7646
|
+
var SIGNAL_TEST_PRELOAD_PATH = "test/signalTest.preload.ts";
|
|
7647
|
+
async function resolveSignalTestPreloadPath(target) {
|
|
7648
|
+
const candidates = [];
|
|
7649
|
+
const addResolvedPackageCandidate = (basePath2) => {
|
|
7650
|
+
try {
|
|
7651
|
+
candidates.push(path33.join(path33.dirname(Bun.resolveSync("akanjs/package.json", basePath2)), SIGNAL_TEST_PRELOAD_PATH));
|
|
7652
|
+
} catch {}
|
|
7653
|
+
};
|
|
7654
|
+
addResolvedPackageCandidate(target.cwdPath);
|
|
7655
|
+
addResolvedPackageCandidate(process.cwd());
|
|
7656
|
+
addResolvedPackageCandidate(path33.dirname(Bun.main));
|
|
7657
|
+
addResolvedPackageCandidate(import.meta.dir);
|
|
7658
|
+
candidates.push(path33.join(target.cwdPath, "../../node_modules/akanjs", SIGNAL_TEST_PRELOAD_PATH), path33.join(target.cwdPath, "../../pkgs/akanjs", SIGNAL_TEST_PRELOAD_PATH), path33.join(process.cwd(), "node_modules/akanjs", SIGNAL_TEST_PRELOAD_PATH), path33.join(process.cwd(), "pkgs/akanjs", SIGNAL_TEST_PRELOAD_PATH), path33.join(path33.dirname(Bun.main), "../../akanjs", SIGNAL_TEST_PRELOAD_PATH), path33.resolve(import.meta.dir, "../../akanjs", SIGNAL_TEST_PRELOAD_PATH));
|
|
7659
|
+
for (const candidate of [...new Set(candidates)]) {
|
|
7660
|
+
if (await Bun.file(candidate).exists())
|
|
7661
|
+
return candidate;
|
|
7662
|
+
}
|
|
7663
|
+
throw new Error(`Failed to locate ${SIGNAL_TEST_PRELOAD_PATH} from ${target.cwdPath}`);
|
|
7664
|
+
}
|
|
7612
7665
|
// pkgs/@akanjs/devkit/builder.ts
|
|
7613
7666
|
import { existsSync as existsSync2 } from "fs";
|
|
7614
7667
|
import { mkdir as mkdir9 } from "fs/promises";
|
|
7615
|
-
import
|
|
7668
|
+
import path34 from "path";
|
|
7616
7669
|
var SKIP_ENTRY_DIR_SET = new Set(["node_modules", "dist", "build", ".git", ".next"]);
|
|
7617
7670
|
var assetExtensions = [".css", ".md", ".js", ".png", ".ico", ".svg", ".json", ".template"];
|
|
7618
7671
|
var assetLoader = Object.fromEntries(assetExtensions.map((ext) => [ext, "file"]));
|
|
@@ -7629,14 +7682,14 @@ class Builder {
|
|
|
7629
7682
|
#globEntrypoints(cwd, pattern) {
|
|
7630
7683
|
const glob = new Bun.Glob(pattern);
|
|
7631
7684
|
return Array.from(glob.scanSync({ cwd, onlyFiles: true })).filter((relativePath) => {
|
|
7632
|
-
const segments = relativePath.split(
|
|
7685
|
+
const segments = relativePath.split(path34.sep);
|
|
7633
7686
|
return !segments.some((segment) => SKIP_ENTRY_DIR_SET.has(segment));
|
|
7634
|
-
}).map((rel) =>
|
|
7687
|
+
}).map((rel) => path34.join(cwd, rel));
|
|
7635
7688
|
}
|
|
7636
7689
|
#globFiles(cwd, pattern = "**/*.*") {
|
|
7637
7690
|
const glob = new Bun.Glob(pattern);
|
|
7638
7691
|
return Array.from(glob.scanSync({ cwd, onlyFiles: true })).filter((relativePath) => {
|
|
7639
|
-
const segments = relativePath.split(
|
|
7692
|
+
const segments = relativePath.split(path34.sep);
|
|
7640
7693
|
return !segments.some((segment) => SKIP_ENTRY_DIR_SET.has(segment));
|
|
7641
7694
|
});
|
|
7642
7695
|
}
|
|
@@ -7644,17 +7697,17 @@ class Builder {
|
|
|
7644
7697
|
const out = [];
|
|
7645
7698
|
for (const p of additionalEntryPoints) {
|
|
7646
7699
|
if (p.includes("*")) {
|
|
7647
|
-
const rel = p.startsWith(`${cwd}/`) || p.startsWith(`${cwd}${
|
|
7700
|
+
const rel = p.startsWith(`${cwd}/`) || p.startsWith(`${cwd}${path34.sep}`) ? p.slice(cwd.length + 1) : p;
|
|
7648
7701
|
out.push(...this.#globEntrypoints(cwd, rel));
|
|
7649
7702
|
} else
|
|
7650
|
-
out.push(
|
|
7703
|
+
out.push(path34.isAbsolute(p) ? p : path34.join(cwd, p));
|
|
7651
7704
|
}
|
|
7652
7705
|
return out;
|
|
7653
7706
|
}
|
|
7654
7707
|
#getBuildOptions({ bundle = false, additionalEntryPoints = [] } = {}) {
|
|
7655
7708
|
const cwd = this.#executor.cwdPath;
|
|
7656
7709
|
const entrypoints = [
|
|
7657
|
-
...bundle ? [
|
|
7710
|
+
...bundle ? [path34.join(cwd, "index.ts")] : this.#globEntrypoints(cwd, "**/*.{ts,tsx}"),
|
|
7658
7711
|
...this.#resolveAdditionalEntrypoints(cwd, additionalEntryPoints)
|
|
7659
7712
|
];
|
|
7660
7713
|
return {
|
|
@@ -7675,9 +7728,9 @@ class Builder {
|
|
|
7675
7728
|
for (const relativePath of this.#globFiles(cwd)) {
|
|
7676
7729
|
if (relativePath === "package.json")
|
|
7677
7730
|
continue;
|
|
7678
|
-
const sourcePath =
|
|
7679
|
-
const targetPath =
|
|
7680
|
-
await mkdir9(
|
|
7731
|
+
const sourcePath = path34.join(cwd, relativePath);
|
|
7732
|
+
const targetPath = path34.join(this.#distExecutor.cwdPath, relativePath);
|
|
7733
|
+
await mkdir9(path34.dirname(targetPath), { recursive: true });
|
|
7681
7734
|
await Bun.write(targetPath, Bun.file(sourcePath));
|
|
7682
7735
|
}
|
|
7683
7736
|
}
|
|
@@ -7688,13 +7741,13 @@ class Builder {
|
|
|
7688
7741
|
return withoutFormatDir;
|
|
7689
7742
|
if (!hasDotSlash && withoutFormatDir === publishedPath)
|
|
7690
7743
|
return publishedPath;
|
|
7691
|
-
const parsed =
|
|
7744
|
+
const parsed = path34.posix.parse(withoutFormatDir);
|
|
7692
7745
|
if (![".js", ".mjs", ".cjs"].includes(parsed.ext))
|
|
7693
7746
|
return withoutFormatDir;
|
|
7694
|
-
const withoutExt =
|
|
7747
|
+
const withoutExt = path34.posix.join(parsed.dir, parsed.name);
|
|
7695
7748
|
const sourcePath = withoutExt.startsWith("./") ? withoutExt.slice(2) : withoutExt;
|
|
7696
7749
|
const sourceCandidates = [`${sourcePath}.ts`, `${sourcePath}.tsx`];
|
|
7697
|
-
const matchedSource = sourceCandidates.find((candidate) => existsSync2(
|
|
7750
|
+
const matchedSource = sourceCandidates.find((candidate) => existsSync2(path34.join(this.#executor.cwdPath, candidate)));
|
|
7698
7751
|
if (!matchedSource)
|
|
7699
7752
|
return withoutFormatDir;
|
|
7700
7753
|
return hasDotSlash ? `./${matchedSource}` : matchedSource;
|
|
@@ -7744,7 +7797,7 @@ class Builder {
|
|
|
7744
7797
|
}
|
|
7745
7798
|
// pkgs/@akanjs/devkit/capacitorApp.ts
|
|
7746
7799
|
import { cp as cp2, mkdir as mkdir10, rm as rm4 } from "fs/promises";
|
|
7747
|
-
import
|
|
7800
|
+
import path35 from "path";
|
|
7748
7801
|
import { MobileProject } from "@trapezedev/project";
|
|
7749
7802
|
import { capitalize as capitalize2 } from "akanjs/common";
|
|
7750
7803
|
|
|
@@ -7938,10 +7991,10 @@ class CapacitorApp {
|
|
|
7938
7991
|
constructor(app, target) {
|
|
7939
7992
|
this.app = app;
|
|
7940
7993
|
this.target = target;
|
|
7941
|
-
this.targetRootPath =
|
|
7942
|
-
this.targetRoot =
|
|
7943
|
-
this.targetWebRoot =
|
|
7944
|
-
this.targetAssetRoot =
|
|
7994
|
+
this.targetRootPath = path35.posix.join("mobile", this.target.name);
|
|
7995
|
+
this.targetRoot = path35.join(this.app.cwdPath, this.targetRootPath);
|
|
7996
|
+
this.targetWebRoot = path35.join(this.targetRoot, "www");
|
|
7997
|
+
this.targetAssetRoot = path35.join(this.targetRoot, "assets");
|
|
7945
7998
|
this.project = new MobileProject(this.app.cwdPath, {
|
|
7946
7999
|
android: { path: this.androidRootPath },
|
|
7947
8000
|
ios: { path: this.iosProjectPath }
|
|
@@ -7957,9 +8010,9 @@ class CapacitorApp {
|
|
|
7957
8010
|
await this.#writeCapacitorConfig();
|
|
7958
8011
|
if (regenerate) {
|
|
7959
8012
|
if (!platform || platform === "ios")
|
|
7960
|
-
await rm4(
|
|
8013
|
+
await rm4(path35.join(this.app.cwdPath, this.iosRootPath), { recursive: true, force: true });
|
|
7961
8014
|
if (!platform || platform === "android")
|
|
7962
|
-
await rm4(
|
|
8015
|
+
await rm4(path35.join(this.app.cwdPath, this.androidRootPath), { recursive: true, force: true });
|
|
7963
8016
|
}
|
|
7964
8017
|
const project = this.project;
|
|
7965
8018
|
await this.project.load();
|
|
@@ -8021,7 +8074,7 @@ class CapacitorApp {
|
|
|
8021
8074
|
await this.#spawnMobile("npx", ["cap", "sync", "android"], { operation, env });
|
|
8022
8075
|
}
|
|
8023
8076
|
async#updateAndroidBuildTypes() {
|
|
8024
|
-
const appGradle = await FileEditor.create(
|
|
8077
|
+
const appGradle = await FileEditor.create(path35.join(this.app.cwdPath, this.androidRootPath, "app/build.gradle"));
|
|
8025
8078
|
const buildTypesBlock = `
|
|
8026
8079
|
debug {
|
|
8027
8080
|
applicationIdSuffix ".debug"
|
|
@@ -8064,7 +8117,7 @@ class CapacitorApp {
|
|
|
8064
8117
|
const gradleCommand = isWindows ? "gradlew.bat" : "./gradlew";
|
|
8065
8118
|
await this.app.spawn(gradleCommand, [assembleType === "apk" ? "assembleRelease" : "bundleRelease"], {
|
|
8066
8119
|
stdio: "inherit",
|
|
8067
|
-
cwd:
|
|
8120
|
+
cwd: path35.join(this.app.cwdPath, this.androidRootPath),
|
|
8068
8121
|
env: this.#commandEnv("release", env)
|
|
8069
8122
|
});
|
|
8070
8123
|
}
|
|
@@ -8093,12 +8146,12 @@ class CapacitorApp {
|
|
|
8093
8146
|
await this.#prepareAndroid({ operation: "release", env: "main" });
|
|
8094
8147
|
}
|
|
8095
8148
|
async prepareWww() {
|
|
8096
|
-
const htmlSource =
|
|
8149
|
+
const htmlSource = path35.join(this.app.dist.cwdPath, "csr", targetHtmlFilename(this.target));
|
|
8097
8150
|
if (!await Bun.file(htmlSource).exists())
|
|
8098
8151
|
throw new Error(`CSR html for mobile target '${this.target.name}' not found: ${htmlSource}`);
|
|
8099
8152
|
await rm4(this.targetWebRoot, { recursive: true, force: true });
|
|
8100
8153
|
await mkdir10(this.targetWebRoot, { recursive: true });
|
|
8101
|
-
await Bun.write(
|
|
8154
|
+
await Bun.write(path35.join(this.targetWebRoot, "index.html"), this.#injectMobileTargetMeta(await Bun.file(htmlSource).text()));
|
|
8102
8155
|
}
|
|
8103
8156
|
#injectMobileTargetMeta(html) {
|
|
8104
8157
|
const basePath2 = this.target.basePath?.replace(/^\/+|\/+$/g, "") ?? "";
|
|
@@ -8110,7 +8163,7 @@ class CapacitorApp {
|
|
|
8110
8163
|
}
|
|
8111
8164
|
async#writeCapacitorConfig() {
|
|
8112
8165
|
await mkdir10(this.targetRoot, { recursive: true });
|
|
8113
|
-
const appInfoPath =
|
|
8166
|
+
const appInfoPath = path35.relative(this.app.cwdPath, path35.join(this.app.cwdPath, "akan.app.json")).split(path35.sep).join("/");
|
|
8114
8167
|
const content = `import type { AppScanResult } from "akanjs";
|
|
8115
8168
|
import { withBase } from "akanjs/capacitor.base.config";
|
|
8116
8169
|
import appInfo from "${appInfoPath.startsWith(".") ? appInfoPath : `./${appInfoPath}`}";
|
|
@@ -8131,18 +8184,18 @@ export default withBase(
|
|
|
8131
8184
|
appInfo as AppScanResult,
|
|
8132
8185
|
);
|
|
8133
8186
|
`;
|
|
8134
|
-
await Bun.write(
|
|
8187
|
+
await Bun.write(path35.join(this.app.cwdPath, "capacitor.config.ts"), content);
|
|
8135
8188
|
}
|
|
8136
8189
|
async#prepareTargetAssets() {
|
|
8137
8190
|
if (!this.target.assets)
|
|
8138
8191
|
return;
|
|
8139
8192
|
await mkdir10(this.targetAssetRoot, { recursive: true });
|
|
8140
8193
|
if (this.target.assets.icon)
|
|
8141
|
-
await cp2(
|
|
8194
|
+
await cp2(path35.join(this.app.cwdPath, this.target.assets.icon), path35.join(this.targetAssetRoot, "icon.png"), {
|
|
8142
8195
|
force: true
|
|
8143
8196
|
});
|
|
8144
8197
|
if (this.target.assets.splash)
|
|
8145
|
-
await cp2(
|
|
8198
|
+
await cp2(path35.join(this.app.cwdPath, this.target.assets.splash), path35.join(this.targetAssetRoot, "splash.png"), {
|
|
8146
8199
|
force: true
|
|
8147
8200
|
});
|
|
8148
8201
|
}
|
|
@@ -8150,11 +8203,11 @@ export default withBase(
|
|
|
8150
8203
|
const files = this.target.files?.[platform];
|
|
8151
8204
|
if (!files)
|
|
8152
8205
|
return;
|
|
8153
|
-
const platformRoot =
|
|
8206
|
+
const platformRoot = path35.join(this.app.cwdPath, platform === "ios" ? this.iosRootPath : this.androidRootPath);
|
|
8154
8207
|
await Promise.all(Object.entries(files).map(async ([to, from]) => {
|
|
8155
|
-
const targetPath =
|
|
8156
|
-
await mkdir10(
|
|
8157
|
-
await cp2(
|
|
8208
|
+
const targetPath = path35.join(platformRoot, to);
|
|
8209
|
+
await mkdir10(path35.dirname(targetPath), { recursive: true });
|
|
8210
|
+
await cp2(path35.join(this.app.cwdPath, from), targetPath, { force: true });
|
|
8158
8211
|
}));
|
|
8159
8212
|
}
|
|
8160
8213
|
async#generateAssets({ operation, env }) {
|
|
@@ -8164,7 +8217,7 @@ export default withBase(
|
|
|
8164
8217
|
"@capacitor/assets",
|
|
8165
8218
|
"generate",
|
|
8166
8219
|
"--assetPath",
|
|
8167
|
-
|
|
8220
|
+
path35.posix.join(this.targetRootPath, "assets"),
|
|
8168
8221
|
"--iosProject",
|
|
8169
8222
|
this.iosProjectPath,
|
|
8170
8223
|
"--androidProject",
|
|
@@ -8349,7 +8402,7 @@ var Pkg = createInternalArgToken("Pkg");
|
|
|
8349
8402
|
var Module = createInternalArgToken("Module");
|
|
8350
8403
|
var Workspace = createInternalArgToken("Workspace");
|
|
8351
8404
|
// pkgs/@akanjs/devkit/commandDecorators/command.ts
|
|
8352
|
-
import
|
|
8405
|
+
import path36 from "path";
|
|
8353
8406
|
import { confirm, input as input2, select as select2 } from "@inquirer/prompts";
|
|
8354
8407
|
import { Logger as Logger11 } from "akanjs/common";
|
|
8355
8408
|
import chalk6 from "chalk";
|
|
@@ -8849,7 +8902,7 @@ var runCommands = async (...commands) => {
|
|
|
8849
8902
|
process.exit(1);
|
|
8850
8903
|
});
|
|
8851
8904
|
const __dirname2 = getDirname(import.meta.url);
|
|
8852
|
-
const packageJsonCandidates = [`${
|
|
8905
|
+
const packageJsonCandidates = [`${path36.dirname(Bun.main)}/package.json`, `${__dirname2}/../package.json`];
|
|
8853
8906
|
let cliPackageJson = null;
|
|
8854
8907
|
for (const packageJsonPath of packageJsonCandidates) {
|
|
8855
8908
|
if (!await FileSys.fileExists(packageJsonPath))
|
|
@@ -9125,8 +9178,8 @@ var scanModuleSpecifiers = (source, filePath, includeExports) => {
|
|
|
9125
9178
|
return importSpecifiers;
|
|
9126
9179
|
};
|
|
9127
9180
|
var parseTsConfig = (tsConfigPath = "./tsconfig.json") => {
|
|
9128
|
-
const configFile = ts6.readConfigFile(tsConfigPath, (
|
|
9129
|
-
return ts6.sys.readFile(
|
|
9181
|
+
const configFile = ts6.readConfigFile(tsConfigPath, (path37) => {
|
|
9182
|
+
return ts6.sys.readFile(path37);
|
|
9130
9183
|
});
|
|
9131
9184
|
return ts6.parseJsonConfigFileContent(configFile.config, ts6.sys, realpathSync(tsConfigPath).replace(/[^/\\]+$/, ""));
|
|
9132
9185
|
};
|
|
@@ -9428,10 +9481,10 @@ class IncrementalBuilder {
|
|
|
9428
9481
|
}
|
|
9429
9482
|
}
|
|
9430
9483
|
batchTouchesPagesTree(appDir, batch) {
|
|
9431
|
-
const absAppDir =
|
|
9484
|
+
const absAppDir = path37.resolve(appDir);
|
|
9432
9485
|
for (const f of batch.files) {
|
|
9433
|
-
const abs =
|
|
9434
|
-
if (!abs.startsWith(`${absAppDir}${
|
|
9486
|
+
const abs = path37.resolve(f);
|
|
9487
|
+
if (!abs.startsWith(`${absAppDir}${path37.sep}`) && abs !== absAppDir)
|
|
9435
9488
|
continue;
|
|
9436
9489
|
if (/\.(tsx|ts|jsx|js)$/.test(abs))
|
|
9437
9490
|
return true;
|
|
@@ -9439,15 +9492,15 @@ class IncrementalBuilder {
|
|
|
9439
9492
|
return false;
|
|
9440
9493
|
}
|
|
9441
9494
|
async batchMayChangePageKeys(appDir, batch) {
|
|
9442
|
-
const absAppDir =
|
|
9443
|
-
const pageKeys = new Set((await this.#app.getPageKeys()).map((key) =>
|
|
9495
|
+
const absAppDir = path37.resolve(appDir);
|
|
9496
|
+
const pageKeys = new Set((await this.#app.getPageKeys()).map((key) => path37.normalize(key)));
|
|
9444
9497
|
for (const f of batch.files) {
|
|
9445
|
-
const abs =
|
|
9446
|
-
if (!abs.startsWith(`${absAppDir}${
|
|
9498
|
+
const abs = path37.resolve(f);
|
|
9499
|
+
if (!abs.startsWith(`${absAppDir}${path37.sep}`) && abs !== absAppDir)
|
|
9447
9500
|
continue;
|
|
9448
9501
|
if (!/\.(tsx|ts|jsx|js)$/.test(abs))
|
|
9449
9502
|
continue;
|
|
9450
|
-
const rel =
|
|
9503
|
+
const rel = path37.normalize(path37.relative(absAppDir, abs));
|
|
9451
9504
|
if (!await Bun.file(abs).exists() || !pageKeys.has(rel))
|
|
9452
9505
|
return true;
|
|
9453
9506
|
}
|
|
@@ -9475,7 +9528,7 @@ class IncrementalBuilder {
|
|
|
9475
9528
|
${cssText}`).toString(36);
|
|
9476
9529
|
const cssRelPath = `styles/${cssAssetName}-${cssHash}.css`;
|
|
9477
9530
|
const cssUrl = `/_akan/styles/${cssAssetName}-${cssHash}.css`;
|
|
9478
|
-
await Bun.write(
|
|
9531
|
+
await Bun.write(path37.join(artifactDir, cssRelPath), cssText);
|
|
9479
9532
|
cssAssetEntries.push([basePath2, { cssUrl, cssRelPath }]);
|
|
9480
9533
|
cssBase64ByUrl[cssUrl] = Buffer.from(new TextEncoder().encode(cssText)).toString("base64");
|
|
9481
9534
|
})()
|
|
@@ -9535,10 +9588,10 @@ ${cssText}`).toString(36);
|
|
|
9535
9588
|
if (changedFiles.length === 0)
|
|
9536
9589
|
return false;
|
|
9537
9590
|
return changedFiles.some((file) => {
|
|
9538
|
-
const normalized =
|
|
9591
|
+
const normalized = path37.resolve(file);
|
|
9539
9592
|
if (/\.(woff2?|ttf|otf)$/i.test(normalized))
|
|
9540
9593
|
return true;
|
|
9541
|
-
return this.#optimizedFonts.files.some((fontFile) =>
|
|
9594
|
+
return this.#optimizedFonts.files.some((fontFile) => path37.resolve(fontFile) === normalized);
|
|
9542
9595
|
});
|
|
9543
9596
|
}
|
|
9544
9597
|
async installWatcher() {
|