@cequrebackends/plugin-vite 0.15.0 → 0.16.5

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/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { Plugin } from "vite";
2
2
  export interface CequreViteOptions {
3
3
  /** URL prefix for API routes. Defaults to `"/api"`. */
4
4
  apiPrefix?: string;
5
- /** Custom entry point for the Cequre server. Defaults to auto-detecting `src/server/index.ts`, `server/index.ts`, `src/index.ts`, or `api/index.ts`. */
5
+ /** Custom entry point for the Cequre server. Defaults to auto-detecting `cequre/server/app.ts`, `cequre/server/index.ts`, or legacy `src/server/index.ts`. */
6
6
  entry?: string;
7
7
  /** Automatically run backend production build during Vite build closeBundle hook. Defaults to `false`. */
8
8
  autoBuild?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAMlD,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wJAAwJ;IACxJ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0GAA0G;IAC1G,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAOD,wBAAgB,gBAAgB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAoC9D;AAED,wBAAgB,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAkB9D;AAED,wBAAgB,oBAAoB,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAMhF;AAqBD,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAmMlE;yBAnMe,UAAU;0BA4MkB,sBAAsB;;AAPlE,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAMlD,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8JAA8J;IAC9J,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0GAA0G;IAC1G,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAOD,wBAAgB,gBAAgB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAsD9D;AAED,wBAAgB,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAoB9D;AAED,wBAAgB,oBAAoB,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAMhF;AAqBD,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAqMlE;yBArMe,UAAU;0BA8MkB,sBAAsB;;AAPlE,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
package/dist/index.js CHANGED
@@ -24,6 +24,22 @@ function resolveApiPrefix(customPrefix) {
24
24
  }
25
25
  } catch {}
26
26
  }
27
+ const cequreSchemaDir = path.resolve(process.cwd(), "cequre", "schema");
28
+ if (fs.existsSync(cequreSchemaDir)) {
29
+ try {
30
+ const files = fs.readdirSync(cequreSchemaDir);
31
+ for (const f of files) {
32
+ if (f.endsWith(".cequre")) {
33
+ const content = fs.readFileSync(path.join(cequreSchemaDir, f), "utf-8");
34
+ const match = content.match(/prefix:\s*["']([^"']+)["']/);
35
+ if (match && match[1]) {
36
+ const prefix = match[1];
37
+ return prefix.startsWith("/") ? prefix : "/" + prefix;
38
+ }
39
+ }
40
+ }
41
+ } catch {}
42
+ }
27
43
  const cequreDir = path.resolve(process.cwd(), "cequre");
28
44
  if (fs.existsSync(cequreDir)) {
29
45
  try {
@@ -47,6 +63,8 @@ function resolveEntryPoint(customEntry) {
47
63
  return customEntry;
48
64
  }
49
65
  const candidates = [
66
+ "cequre/server/app.ts",
67
+ "cequre/server/index.ts",
50
68
  "src/server/app.ts",
51
69
  "src/app.ts",
52
70
  "src/server/index.ts",
@@ -59,7 +77,7 @@ function resolveEntryPoint(customEntry) {
59
77
  return cand;
60
78
  }
61
79
  }
62
- return "src/index.ts";
80
+ return "cequre/server/index.ts";
63
81
  }
64
82
  function getExecutableCommand() {
65
83
  const localBin = path.join(process.cwd(), "node_modules", ".bin", "cequre");
@@ -222,6 +240,8 @@ function cequreVite(options = {}) {
222
240
  };
223
241
  const cequrePaths = [
224
242
  path.resolve(process.cwd(), "cequre"),
243
+ path.resolve(process.cwd(), "cequre/server"),
244
+ path.resolve(process.cwd(), "cequre/schema"),
225
245
  path.resolve(process.cwd(), "src/server"),
226
246
  path.resolve(process.cwd(), "src/routes"),
227
247
  path.resolve(process.cwd(), "cequre.config.json")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cequrebackends/plugin-vite",
3
- "version": "0.15.0",
3
+ "version": "0.16.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",