qarpeo 0.4.2 → 0.4.4

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.
@@ -11,7 +11,7 @@ import { useRuntimeConfig, defineEventHandler } from 'nuxt/server';
11
11
  import { mkdir, writeFile, readFile } from 'node:fs/promises';
12
12
  import { defu } from 'defu';
13
13
 
14
- const version = "0.4.1";
14
+ const version = "0.4.4";
15
15
 
16
16
  function resolveBindingName(service, override, defaultName) {
17
17
  if (override && typeof override === "string") {
@@ -268,9 +268,9 @@ function discoverDatabases(layers, options) {
268
268
  const dbOpts = typeof options?.db === "object" ? options.db : {};
269
269
  for (const layer of layers) {
270
270
  const baseDirs = /* @__PURE__ */ new Set();
271
- if (layer.config?.srcDir) baseDirs.add(layer.config.srcDir);
272
271
  if (layer.config?.rootDir) baseDirs.add(layer.config.rootDir);
273
272
  if (layer.cwd) baseDirs.add(layer.cwd);
273
+ if (layer.config?.srcDir) baseDirs.add(layer.config.srcDir);
274
274
  for (const baseDir of baseDirs) {
275
275
  const rootDbDir = resolve(baseDir, "db");
276
276
  const collectSchemaFromDir = (dirPath, targetSet) => {
@@ -317,19 +317,32 @@ function discoverDatabases(layers, options) {
317
317
  const primaryBinding = resolveBindingName("db", dbOpts.binding);
318
318
  const primaryId = dbOpts.databaseId || process.env.QARPEO_DB_ID || process.env.DATABASE_ID || process.env.DB_ID || `${primaryBinding}_LOCAL_DEV`;
319
319
  const primaryMigrationsDir = resolve(baseDir, "db/migrations");
320
- dbs.set("default", {
321
- name: "default",
322
- dirName: "schema",
323
- isPrimary: true,
324
- binding: primaryBinding,
325
- databaseName: dbOpts.databaseName || primaryBinding,
326
- databaseId: primaryId,
327
- dir: rootDbDir,
328
- migrationsDir: primaryMigrationsDir,
329
- schemaFiles: Array.from(primarySchemaFiles),
330
- dialect: "sqlite",
331
- identifiers: getDatabaseIdentifiers("schema", true)
332
- });
320
+ const existingDefault = dbs.get("default");
321
+ if (existingDefault) {
322
+ if (primarySchemaFiles.size > 0) {
323
+ if (existingDefault.schemaFiles.length === 0) {
324
+ existingDefault.dir = rootDbDir;
325
+ existingDefault.migrationsDir = primaryMigrationsDir;
326
+ }
327
+ existingDefault.schemaFiles = Array.from(
328
+ /* @__PURE__ */ new Set([...existingDefault.schemaFiles, ...primarySchemaFiles])
329
+ );
330
+ }
331
+ } else {
332
+ dbs.set("default", {
333
+ name: "default",
334
+ dirName: "schema",
335
+ isPrimary: true,
336
+ binding: primaryBinding,
337
+ databaseName: dbOpts.databaseName || primaryBinding,
338
+ databaseId: primaryId,
339
+ dir: rootDbDir,
340
+ migrationsDir: primaryMigrationsDir,
341
+ schemaFiles: Array.from(primarySchemaFiles),
342
+ dialect: "sqlite",
343
+ identifiers: getDatabaseIdentifiers("schema", true)
344
+ });
345
+ }
333
346
  }
334
347
  if (existsSync(rootDbDir) && statSync(rootDbDir).isDirectory()) {
335
348
  try {
package/dist/module.mjs CHANGED
@@ -5351,17 +5351,46 @@ async function setupConsole(options, nuxt, resolver, logger) {
5351
5351
  }
5352
5352
 
5353
5353
  async function setupCMS(options, nuxt, resolver, logger) {
5354
+ if (options.cms) {
5355
+ const cmsOptions = typeof options.cms === "object" ? options.cms : {};
5356
+ const pluginConfig = cmsOptions.plugins || {};
5357
+ const shikiOption = cmsOptions.shiki !== void 0 ? cmsOptions.shiki : pluginConfig.shiki;
5358
+ const shikiEnabled = shikiOption !== false;
5359
+ await ensurePackage("@comark/vue", {
5360
+ cwd: nuxt.options.rootDir,
5361
+ dev: false,
5362
+ purpose: "CMS markdown rendering"
5363
+ });
5364
+ await ensurePackage("comark", {
5365
+ cwd: nuxt.options.rootDir,
5366
+ dev: false,
5367
+ purpose: "CMS markdown parsing"
5368
+ });
5369
+ if (shikiEnabled) {
5370
+ await ensurePackage("shiki", {
5371
+ cwd: nuxt.options.rootDir,
5372
+ dev: false,
5373
+ purpose: "CMS code syntax highlighting"
5374
+ });
5375
+ }
5376
+ }
5354
5377
  if (options.cms && !hasNuxtModule("@comark/vue/nuxt") && !hasNuxtModule("@comark/vue") && !hasNuxtModule("@comark/nuxt")) {
5355
5378
  try {
5356
- const comarkModulePath = fileURLToPath(import.meta.resolve("@comark/vue/nuxt"));
5379
+ const rootReq = createRequire(resolve(nuxt.options.rootDir, "package.json"));
5380
+ const comarkModulePath = rootReq.resolve("@comark/vue/nuxt");
5357
5381
  await installModule(comarkModulePath);
5358
5382
  } catch {
5359
5383
  try {
5360
- await installModule("@comark/vue/nuxt");
5384
+ const comarkModulePath = fileURLToPath(import.meta.resolve("@comark/vue/nuxt"));
5385
+ await installModule(comarkModulePath);
5361
5386
  } catch {
5362
5387
  try {
5363
- await installModule("@comark/nuxt");
5388
+ await installModule("@comark/vue/nuxt");
5364
5389
  } catch {
5390
+ try {
5391
+ await installModule("@comark/nuxt");
5392
+ } catch {
5393
+ }
5365
5394
  }
5366
5395
  }
5367
5396
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qarpeo",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Zero-config Cloudflare Edge Platform for Nuxt",
5
5
  "keywords": [
6
6
  "analytics-engine",