@cancia/astro 0.4.0 → 0.4.2
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/{chunk-AE4SIY24.js → chunk-CJDIVWO3.js} +3 -0
- package/dist/{chunk-5AUIPW2I.js → chunk-GNWD7EL2.js} +3 -0
- package/dist/{chunk-U46HCJN3.js → chunk-Q4AAGYBN.js} +1 -1
- package/dist/index.js +6 -5
- package/dist/runtime.d.ts +6 -2
- package/dist/runtime.js +2 -2
- package/dist/storage/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// src/storage/sqlite.ts
|
|
2
2
|
import { createRequire } from "module";
|
|
3
|
+
import { mkdirSync } from "fs";
|
|
4
|
+
import { dirname } from "path";
|
|
3
5
|
var require2 = createRequire(import.meta.url);
|
|
4
6
|
var _db = null;
|
|
5
7
|
function createDB(dbPath) {
|
|
6
8
|
const Database = require2("better-sqlite3");
|
|
9
|
+
if (dbPath !== ":memory:") mkdirSync(dirname(dbPath), { recursive: true });
|
|
7
10
|
const sqlite = new Database(dbPath);
|
|
8
11
|
sqlite.pragma("journal_mode = WAL");
|
|
9
12
|
sqlite.exec(`
|
|
@@ -11,9 +11,12 @@ import {
|
|
|
11
11
|
// src/storage/sqlite-v2.ts
|
|
12
12
|
import { createRequire } from "module";
|
|
13
13
|
import { randomUUID } from "crypto";
|
|
14
|
+
import { mkdirSync } from "fs";
|
|
15
|
+
import { dirname } from "path";
|
|
14
16
|
var require2 = createRequire(import.meta.url);
|
|
15
17
|
function openDB(dbPath) {
|
|
16
18
|
const Database = require2("better-sqlite3");
|
|
19
|
+
if (dbPath !== ":memory:") mkdirSync(dirname(dbPath), { recursive: true });
|
|
17
20
|
const db = new Database(dbPath);
|
|
18
21
|
db.pragma("journal_mode = WAL");
|
|
19
22
|
db.pragma("foreign_keys = ON");
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
makeR2UploadHandler,
|
|
15
15
|
makeUploadRoute,
|
|
16
16
|
setCanciaRuntime
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-Q4AAGYBN.js";
|
|
18
18
|
import {
|
|
19
19
|
defineField,
|
|
20
20
|
defineList,
|
|
@@ -26,12 +26,12 @@ import {
|
|
|
26
26
|
} from "./chunk-UR5WC3RA.js";
|
|
27
27
|
import {
|
|
28
28
|
createSQLiteAdapter
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-CJDIVWO3.js";
|
|
30
30
|
import {
|
|
31
31
|
closeSqliteAdapterV2,
|
|
32
32
|
createGitBackedAdapter,
|
|
33
33
|
createSqliteAdapterV2
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-GNWD7EL2.js";
|
|
35
35
|
import "./chunk-U7V53JX7.js";
|
|
36
36
|
import {
|
|
37
37
|
createJsonFileAdapter,
|
|
@@ -273,6 +273,7 @@ function canciaIntegration(opts = {}) {
|
|
|
273
273
|
}
|
|
274
274
|
const hasDeployHook = !!(opts.deployHook ?? env.CANCIA_DEPLOY_HOOK ?? process.env.CANCIA_DEPLOY_HOOK);
|
|
275
275
|
resolvedPublishRepo = opts.publish?.github?.repo ?? opts.git?.repo;
|
|
276
|
+
const canPublish = hasDeployHook || !!resolvedPublishRepo;
|
|
276
277
|
let storageDescriptor;
|
|
277
278
|
if (opts.git) {
|
|
278
279
|
storageDescriptor = {
|
|
@@ -307,7 +308,7 @@ function canciaIntegration(opts = {}) {
|
|
|
307
308
|
locales: resolvedLocales,
|
|
308
309
|
maxUploadMB: opts.maxUploadMB ?? 10,
|
|
309
310
|
public: opts.public ?? false,
|
|
310
|
-
|
|
311
|
+
canPublish,
|
|
311
312
|
deployHookMethod: opts.deployHookMethod,
|
|
312
313
|
deployHookHeaders: opts.deployHookHeaders,
|
|
313
314
|
publishRepo: resolvedPublishRepo,
|
|
@@ -324,7 +325,7 @@ function canciaIntegration(opts = {}) {
|
|
|
324
325
|
languages,
|
|
325
326
|
page: "unknown",
|
|
326
327
|
public: opts.public ?? false,
|
|
327
|
-
|
|
328
|
+
canPublish
|
|
328
329
|
})};`
|
|
329
330
|
);
|
|
330
331
|
injectScript("page", `import "@cancia/toolbar";`);
|
package/dist/runtime.d.ts
CHANGED
|
@@ -81,8 +81,12 @@ interface BakedConfig {
|
|
|
81
81
|
maxUploadMB: number;
|
|
82
82
|
/** When true, endpoints skip auth (public demos). Baked, never a secret. */
|
|
83
83
|
public: boolean;
|
|
84
|
-
/**
|
|
85
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Whether the site can publish — a deploy hook (030) OR a repository_dispatch
|
|
86
|
+
* repo (031) is configured. Client-inject flag for the toolbar's Publish
|
|
87
|
+
* button; the actual publish credentials are read from env at request time.
|
|
88
|
+
*/
|
|
89
|
+
canPublish: boolean;
|
|
86
90
|
/** Optional deploy-hook HTTP method (default POST). Non-secret. */
|
|
87
91
|
deployHookMethod: string | undefined;
|
|
88
92
|
/** Optional deploy-hook extra headers. Non-secret (the token stays in env). */
|
package/dist/runtime.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
getCanciaRuntime,
|
|
3
3
|
setBakedConfig,
|
|
4
4
|
setCanciaRuntime
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-Q4AAGYBN.js";
|
|
6
|
+
import "./chunk-GNWD7EL2.js";
|
|
7
7
|
import "./chunk-U7V53JX7.js";
|
|
8
8
|
import "./chunk-L2VKQJPY.js";
|
|
9
9
|
import "./chunk-7IA5B5CF.js";
|
package/dist/storage/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSQLiteAdapter
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-CJDIVWO3.js";
|
|
4
4
|
import {
|
|
5
5
|
closeSqliteAdapterV2,
|
|
6
6
|
createGitBackedAdapter,
|
|
7
7
|
createSqliteAdapterV2
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-GNWD7EL2.js";
|
|
9
9
|
import {
|
|
10
10
|
createGitHubClient
|
|
11
11
|
} from "../chunk-U7V53JX7.js";
|