@cedarjs/vite 5.0.0-canary.2565 → 5.0.0-canary.2567

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.
@@ -1,2 +1,14 @@
1
+ export declare function parseCliArgs(argv?: string[]): {
2
+ forceOptimize: any;
3
+ debug: any;
4
+ portArg: any;
5
+ debugPort: any;
6
+ debugBrk: any;
7
+ serverArgs: {
8
+ [argName: string]: any;
9
+ "--"?: Array<string | number>;
10
+ };
11
+ };
12
+ export declare function openDebugger(port: number, waitForDebugger?: boolean): Promise<void>;
1
13
  export declare function startUnifiedDevServer(): Promise<void>;
2
14
  //# sourceMappingURL=cedar-unified-dev.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cedar-unified-dev.d.ts","sourceRoot":"","sources":["../src/cedar-unified-dev.ts"],"names":[],"mappings":"AA+BA,wBAAsB,qBAAqB,kBAsI1C"}
1
+ {"version":3,"file":"cedar-unified-dev.d.ts","sourceRoot":"","sources":["../src/cedar-unified-dev.ts"],"names":[],"mappings":"AA+BA,wBAAgB,YAAY,CAAC,IAAI,WAAe;;;;;;;;;;EAwB/C;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,UAAQ,iBAMvE;AAED,wBAAsB,qBAAqB,kBAiI1C"}
@@ -10,25 +10,49 @@ function isViteInternalRequest(url) {
10
10
  function isApiRequest(url, apiUrl, apiGqlUrl) {
11
11
  return url === apiUrl || url.startsWith(apiUrl + "/") || url.startsWith(apiUrl + "?") || url === apiGqlUrl || url.startsWith(apiGqlUrl + "/") || url.startsWith(apiGqlUrl + "?");
12
12
  }
13
- async function startUnifiedDevServer() {
14
- process.env.__CEDAR_UNIFIED_DEV = "true";
15
- const rwPaths = getPaths();
16
- const cedarConfig = getConfig();
17
- const configFile = rwPaths.web.viteConfig;
18
- if (!configFile) {
19
- throw new Error("Could not locate your web/vite.config.{js,ts} file");
20
- }
13
+ function parseCliArgs(argv = process.argv) {
21
14
  const {
22
15
  force: forceOptimize,
23
16
  debug,
24
17
  port: portArg,
25
18
  apiPort: _apiPortArg,
19
+ "debug-port": debugPort,
20
+ "debug-brk": debugBrk,
26
21
  _: _positional,
27
22
  ...serverArgs
28
- } = yargsParser(process.argv.slice(2), {
29
- boolean: ["https", "open", "strictPort", "force", "cors", "debug"],
30
- number: ["port", "apiPort"]
23
+ } = yargsParser(argv.slice(2), {
24
+ boolean: [
25
+ "https",
26
+ "open",
27
+ "strictPort",
28
+ "force",
29
+ "cors",
30
+ "debug",
31
+ "debug-brk"
32
+ ],
33
+ number: ["port", "apiPort", "debug-port"]
31
34
  });
35
+ return { forceOptimize, debug, portArg, debugPort, debugBrk, serverArgs };
36
+ }
37
+ async function openDebugger(port, waitForDebugger = false) {
38
+ const inspector = await import("node:inspector");
39
+ inspector.open(port, "127.0.0.1");
40
+ if (waitForDebugger) {
41
+ inspector.waitForDebugger();
42
+ }
43
+ }
44
+ async function startUnifiedDevServer() {
45
+ process.env.__CEDAR_UNIFIED_DEV = "true";
46
+ const rwPaths = getPaths();
47
+ const cedarConfig = getConfig();
48
+ const configFile = rwPaths.web.viteConfig;
49
+ if (!configFile) {
50
+ throw new Error("Could not locate your web/vite.config.{js,ts} file");
51
+ }
52
+ const { forceOptimize, debug, portArg, debugPort, debugBrk, serverArgs } = parseCliArgs();
53
+ if (debugPort !== void 0) {
54
+ await openDebugger(debugPort, debugBrk);
55
+ }
32
56
  const webPort = portArg ?? cedarConfig.web.port ?? 8910;
33
57
  const { close: closeApi, handler: apiHandler } = await startApiDevMiddleware();
34
58
  const apiAdapter = createServerAdapter(apiHandler);
@@ -113,5 +137,7 @@ async function startUnifiedDevServer() {
113
137
  process.on("SIGTERM", shutdown);
114
138
  }
115
139
  export {
140
+ openDebugger,
141
+ parseCliArgs,
116
142
  startUnifiedDevServer
117
143
  };
@@ -28,6 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var cedar_unified_dev_exports = {};
30
30
  __export(cedar_unified_dev_exports, {
31
+ openDebugger: () => openDebugger,
32
+ parseCliArgs: () => parseCliArgs,
31
33
  startUnifiedDevServer: () => startUnifiedDevServer
32
34
  });
33
35
  module.exports = __toCommonJS(cedar_unified_dev_exports);
@@ -43,25 +45,49 @@ function isViteInternalRequest(url) {
43
45
  function isApiRequest(url, apiUrl, apiGqlUrl) {
44
46
  return url === apiUrl || url.startsWith(apiUrl + "/") || url.startsWith(apiUrl + "?") || url === apiGqlUrl || url.startsWith(apiGqlUrl + "/") || url.startsWith(apiGqlUrl + "?");
45
47
  }
46
- async function startUnifiedDevServer() {
47
- process.env.__CEDAR_UNIFIED_DEV = "true";
48
- const rwPaths = (0, import_project_config.getPaths)();
49
- const cedarConfig = (0, import_project_config.getConfig)();
50
- const configFile = rwPaths.web.viteConfig;
51
- if (!configFile) {
52
- throw new Error("Could not locate your web/vite.config.{js,ts} file");
53
- }
48
+ function parseCliArgs(argv = process.argv) {
54
49
  const {
55
50
  force: forceOptimize,
56
51
  debug,
57
52
  port: portArg,
58
53
  apiPort: _apiPortArg,
54
+ "debug-port": debugPort,
55
+ "debug-brk": debugBrk,
59
56
  _: _positional,
60
57
  ...serverArgs
61
- } = (0, import_yargs_parser.default)(process.argv.slice(2), {
62
- boolean: ["https", "open", "strictPort", "force", "cors", "debug"],
63
- number: ["port", "apiPort"]
58
+ } = (0, import_yargs_parser.default)(argv.slice(2), {
59
+ boolean: [
60
+ "https",
61
+ "open",
62
+ "strictPort",
63
+ "force",
64
+ "cors",
65
+ "debug",
66
+ "debug-brk"
67
+ ],
68
+ number: ["port", "apiPort", "debug-port"]
64
69
  });
70
+ return { forceOptimize, debug, portArg, debugPort, debugBrk, serverArgs };
71
+ }
72
+ async function openDebugger(port, waitForDebugger = false) {
73
+ const inspector = await import("node:inspector");
74
+ inspector.open(port, "127.0.0.1");
75
+ if (waitForDebugger) {
76
+ inspector.waitForDebugger();
77
+ }
78
+ }
79
+ async function startUnifiedDevServer() {
80
+ process.env.__CEDAR_UNIFIED_DEV = "true";
81
+ const rwPaths = (0, import_project_config.getPaths)();
82
+ const cedarConfig = (0, import_project_config.getConfig)();
83
+ const configFile = rwPaths.web.viteConfig;
84
+ if (!configFile) {
85
+ throw new Error("Could not locate your web/vite.config.{js,ts} file");
86
+ }
87
+ const { forceOptimize, debug, portArg, debugPort, debugBrk, serverArgs } = parseCliArgs();
88
+ if (debugPort !== void 0) {
89
+ await openDebugger(debugPort, debugBrk);
90
+ }
65
91
  const webPort = portArg ?? cedarConfig.web.port ?? 8910;
66
92
  const { close: closeApi, handler: apiHandler } = await (0, import_apiDevMiddleware.startApiDevMiddleware)();
67
93
  const apiAdapter = (0, import_server.createServerAdapter)(apiHandler);
@@ -147,5 +173,7 @@ async function startUnifiedDevServer() {
147
173
  }
148
174
  // Annotate the CommonJS export names for ESM import in node:
149
175
  0 && (module.exports = {
176
+ openDebugger,
177
+ parseCliArgs,
150
178
  startUnifiedDevServer
151
179
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "5.0.0-canary.2565",
3
+ "version": "5.0.0-canary.2567",
4
4
  "description": "Vite configuration package for CedarJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -67,17 +67,17 @@
67
67
  "@babel/parser": "7.29.7",
68
68
  "@babel/traverse": "7.29.7",
69
69
  "@babel/types": "7.29.7",
70
- "@cedarjs/api": "5.0.0-canary.2565",
71
- "@cedarjs/auth": "5.0.0-canary.2565",
72
- "@cedarjs/babel-config": "5.0.0-canary.2565",
73
- "@cedarjs/context": "5.0.0-canary.2565",
74
- "@cedarjs/cookie-jar": "5.0.0-canary.2565",
75
- "@cedarjs/graphql-server": "5.0.0-canary.2565",
76
- "@cedarjs/internal": "5.0.0-canary.2565",
77
- "@cedarjs/project-config": "5.0.0-canary.2565",
78
- "@cedarjs/server-store": "5.0.0-canary.2565",
79
- "@cedarjs/testing": "5.0.0-canary.2565",
80
- "@cedarjs/web": "5.0.0-canary.2565",
70
+ "@cedarjs/api": "5.0.0-canary.2567",
71
+ "@cedarjs/auth": "5.0.0-canary.2567",
72
+ "@cedarjs/babel-config": "5.0.0-canary.2567",
73
+ "@cedarjs/context": "5.0.0-canary.2567",
74
+ "@cedarjs/cookie-jar": "5.0.0-canary.2567",
75
+ "@cedarjs/graphql-server": "5.0.0-canary.2567",
76
+ "@cedarjs/internal": "5.0.0-canary.2567",
77
+ "@cedarjs/project-config": "5.0.0-canary.2567",
78
+ "@cedarjs/server-store": "5.0.0-canary.2567",
79
+ "@cedarjs/testing": "5.0.0-canary.2567",
80
+ "@cedarjs/web": "5.0.0-canary.2567",
81
81
  "@fastify/url-data": "6.0.3",
82
82
  "@swc/core": "1.15.41",
83
83
  "@universal-deploy/store": "^0.2.1",