@torpor/build 0.0.1 → 0.0.3

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +5 -2
  3. package/dist/bin/index.cjs +16 -15
  4. package/dist/bin/index.cjs.map +1 -1
  5. package/dist/bin/index.js +6 -93
  6. package/dist/bin/index.js.map +1 -1
  7. package/dist/chunk-L7GOYKUG.js +93 -0
  8. package/dist/chunk-L7GOYKUG.js.map +1 -0
  9. package/dist/index.cjs +103 -9
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +20 -17
  12. package/dist/index.d.ts +20 -17
  13. package/dist/index.js +4 -5
  14. package/dist/index.js.map +1 -1
  15. package/dist/metafile-cjs.json +1 -1
  16. package/dist/metafile-esm.json +1 -1
  17. package/dist/response.cjs.map +1 -1
  18. package/dist/response.d.cts +4 -0
  19. package/dist/response.d.ts +4 -0
  20. package/dist/response.js.map +1 -1
  21. package/package.json +10 -7
  22. package/src/bin/index.ts +4 -3
  23. package/src/index.ts +7 -7
  24. package/src/response/serverError.ts +2 -0
  25. package/src/response/unauthorized.ts +2 -0
  26. package/src/site/FileSystemRouter.ts +1 -0
  27. package/src/site/clientEntry.ts +3 -3
  28. package/src/site/defineConfig.ts +73 -3
  29. package/src/site/routeHandlers.ts +8 -6
  30. package/src/site/serverEntry.ts +10 -10
  31. package/src/types/CookieHelper.ts +3 -3
  32. package/src/types/PageEndPoint.ts +4 -4
  33. package/src/types/PageEvent.ts +2 -2
  34. package/src/types/PageServerEndPoint.ts +3 -3
  35. package/src/types/RouteHandler.ts +3 -3
  36. package/src/types/RouteHandlerCollection.ts +4 -4
  37. package/src/types/RouteLayoutHandler.ts +2 -2
  38. package/src/types/RouteMatchResult.ts +3 -3
  39. package/src/types/ServerEndPoint.ts +3 -3
  40. package/src/types/ServerEvent.ts +3 -3
  41. package/src/types/ServerHook.ts +3 -3
  42. package/src/types/UserConfig.ts +2 -2
  43. package/src/vite-env.d.ts +2 -0
  44. package/tsconfig.json +7 -2
  45. package/src/site/defineSite.ts +0 -74
package/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # @torpor/build
2
+
3
+ ## 0.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [76dd6ea]
8
+ - Updated dependencies [8f0a0a1]
9
+ - @torpor/view@0.0.4
10
+ - @torpor/unplugin@0.0.3
11
+
12
+ ## 0.0.2
13
+
14
+ ### Patch Changes
15
+
16
+ - Fix: use /~server for hooks as well as layouts
17
+ - Fix: catch-all routes should get checked last
18
+ - Updated dependencies
19
+ - Updated dependencies
20
+ - Updated dependencies
21
+ - Updated dependencies
22
+ - Updated dependencies
23
+ - @torpor/view@0.0.3
24
+ - @torpor/unplugin@0.0.2
package/README.md CHANGED
@@ -8,10 +8,13 @@ Built on top of [Vinxi](https://github.com/nksaraf/vinxi).
8
8
 
9
9
  ## Installation
10
10
 
11
- Use `npm` (or your preferred package manager) to create a Vite project:
11
+ Use `npm` (or your preferred package manager) to create a starter project:
12
12
 
13
13
  ```bash
14
- npm create vite
14
+ npm init @torpor/build my-project
15
+ cd my-project
16
+ npm install
17
+ npm run dev
15
18
  ```
16
19
 
17
20
  ## Folder structure
@@ -25,11 +25,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
 
26
26
  // src/bin/index.ts
27
27
  var import_node_fs = __toESM(require("fs"), 1);
28
- var import_path2 = __toESM(require("path"), 1);
28
+ var import_path = __toESM(require("path"), 1);
29
29
 
30
- // src/site/defineSite.ts
30
+ // src/site/defineConfig.ts
31
31
  var import_vite = __toESM(require("@torpor/unplugin/vite"), 1);
32
- var import_path = __toESM(require("path"), 1);
32
+ var import_node_path = __toESM(require("path"), 1);
33
33
  var import_vinxi = require("vinxi");
34
34
  var import_config = require("vinxi/plugins/config");
35
35
 
@@ -37,7 +37,7 @@ var import_config = require("vinxi/plugins/config");
37
37
  var import_fs_router = require("vinxi/fs-router");
38
38
  var FileSystemRouter = class extends import_fs_router.BaseFileSystemRouter {
39
39
  toPath(src) {
40
- let routePath = (0, import_fs_router.cleanPath)(src, this.config).replace(/^\//, "").replace(/_layout.server$/, "_layout/~server").replace(/\+page.server$/, "~server").replace(/\+page$/, "").replace(/\+server$/, "").replace(/\/$/, "");
40
+ let routePath = (0, import_fs_router.cleanPath)(src, this.config).replace(/^\//, "").replace(/_hook.server$/, "_hook/~server").replace(/_layout.server$/, "_layout/~server").replace(/\+page.server$/, "~server").replace(/\+page$/, "").replace(/\+server$/, "").replace(/\/$/, "");
41
41
  return routePath?.length > 0 ? `/${routePath}` : "/";
42
42
  }
43
43
  toRoute(filePath) {
@@ -51,10 +51,11 @@ var FileSystemRouter = class extends import_fs_router.BaseFileSystemRouter {
51
51
  }
52
52
  };
53
53
 
54
- // src/site/defineSite.ts
55
- function defineSite(options2) {
54
+ // src/site/defineConfig.ts
55
+ function defineConfig(options2) {
56
56
  process.env.PORT = (options2?.port || 7059).toString();
57
57
  return (0, import_vinxi.createApp)({
58
+ name: "torpor",
58
59
  routers: [
59
60
  {
60
61
  name: "assets",
@@ -78,7 +79,7 @@ function defineSite(options2) {
78
79
  type: "http",
79
80
  target: "server",
80
81
  // TODO: change this when published
81
- handler: "node_modules/@torpor/build/src/site/serverEntry.ts",
82
+ handler: "./node_modules/@torpor/build/src/site/serverEntry.ts",
82
83
  routes,
83
84
  plugins: () => [(0, import_config.config)("custom", viteOptions()), (0, import_vite.default)({ server: true })]
84
85
  },
@@ -87,7 +88,7 @@ function defineSite(options2) {
87
88
  type: "client",
88
89
  target: "browser",
89
90
  // TODO: change this when published
90
- handler: "node_modules/@torpor/build/src/site/clientEntry.ts",
91
+ handler: "./node_modules/@torpor/build/src/site/clientEntry.ts",
91
92
  base: "/_build",
92
93
  routes,
93
94
  plugins: () => [(0, import_config.config)("custom", viteOptions()), (0, import_vite.default)()]
@@ -95,21 +96,21 @@ function defineSite(options2) {
95
96
  ]
96
97
  });
97
98
  }
98
- function routes(router, app2) {
99
+ function routes(router, app) {
99
100
  return new FileSystemRouter(
100
101
  {
101
- dir: import_path.default.resolve("src/routes"),
102
+ dir: import_node_path.default.resolve("src/routes"),
102
103
  extensions: ["js", "ts"]
103
104
  },
104
105
  router,
105
- app2
106
+ app
106
107
  );
107
108
  }
108
109
  function viteOptions() {
109
110
  return {
110
111
  resolve: {
111
112
  alias: {
112
- "@": import_path.default.resolve("src")
113
+ "@": import_node_path.default.resolve("src")
113
114
  }
114
115
  }
115
116
  };
@@ -118,8 +119,8 @@ function viteOptions() {
118
119
  // src/bin/index.ts
119
120
  var options;
120
121
  var workingDir = process.cwd();
121
- var jsConfigFile = import_path2.default.join(workingDir, "torpor.config.js");
122
- var tsConfigFile = import_path2.default.join(workingDir, "torpor.config.ts");
122
+ var jsConfigFile = import_path.default.join(workingDir, "torpor.config.js");
123
+ var tsConfigFile = import_path.default.join(workingDir, "torpor.config.ts");
123
124
  var source;
124
125
  if (import_node_fs.default.existsSync(jsConfigFile)) {
125
126
  source = import_node_fs.default.readFileSync(jsConfigFile, "utf8");
@@ -133,5 +134,5 @@ if (import_node_fs.default.existsSync(jsConfigFile)) {
133
134
  if (source) {
134
135
  options = eval(source);
135
136
  }
136
- var app = defineSite(options);
137
+ defineConfig(options);
137
138
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/bin/index.ts","../../src/site/defineSite.ts","../../src/site/FileSystemRouter.ts"],"sourcesContent":["#! /usr/bin/env node\n//import { existsSync, promises as fs } from \"node:fs\";\nimport fs from \"node:fs\";\nimport path from \"path\";\nimport defineSite from \"../site/defineSite\";\nimport type UserConfig from \"../types/UserConfig\";\n\n// Check for a torpor.config.js/ts file in the working directory\n// TODO: Make sure it's valid, try/catch, etc\n// TODO: There has GOT to be an easier way\nlet options: UserConfig | undefined;\nconst workingDir = process.cwd();\nconst jsConfigFile = path.join(workingDir, \"torpor.config.js\");\nconst tsConfigFile = path.join(workingDir, \"torpor.config.ts\");\nlet source: string | undefined;\nif (fs.existsSync(jsConfigFile)) {\n\t//const configFile = path.relative(\".\", tsConfigFile);\n\t//options = await import(configFile);\n\tsource = fs.readFileSync(jsConfigFile, \"utf8\");\n\tsource = source\n\t\t.replace(\n\t\t\t/import\\s+\\{\\s+defineConfig\\s+\\}\\s+from\\s+[\"']@torpor\\/build[\"']/,\n\t\t\t\"const defineConfig = (x) => x\",\n\t\t)\n\t\t.replace(\"export default\", \"\");\n} else if (fs.existsSync(tsConfigFile)) {\n\tconsole.log(\"TS config file is not supported\");\n}\n\nif (source) {\n\toptions = eval(source);\n}\n\nconst app = defineSite(options);\n\n// This already gets done in vinxi.createApp so we can't do it twice\n//if (process.argv.includes(\"--dev\")) {\n//\tawait app.dev();\n//} else if (process.argv.includes(\"--build\")) {\n//\tawait app.build();\n//}\n","import torpor from \"@torpor/unplugin/vite\";\nimport path from \"path\";\nimport { AppOptions, RouterSchemaInput, createApp } from \"vinxi\";\nimport { config } from \"vinxi/plugins/config\";\nimport type UserConfig from \"../types/UserConfig\";\nimport FileSystemRouter from \"./FileSystemRouter\";\n\nexport default function defineSite(options?: UserConfig) {\n\t// Set the port\n\tprocess.env.PORT = (options?.port || 7059).toString();\n\n\t// Get Vinxi to create and serve the app\n\treturn createApp({\n\t\trouters: [\n\t\t\t{\n\t\t\t\tname: \"assets\",\n\t\t\t\ttype: \"static\",\n\t\t\t\tdir: \"./src/assets\",\n\t\t\t},\n\t\t\t// Doesn't look like we can have two server routes?\n\t\t\t// Have to put api in /routes\n\t\t\t// Maybe we can support having /routes/api and routes/site and stripping /site from the start?\n\t\t\t//{\n\t\t\t//\tname: \"api\",\n\t\t\t//\ttype: \"http\",\n\t\t\t//\ttarget: \"server\",\n\t\t\t//\t// TODO: change this when published\n\t\t\t//\thandler: \"node_modules/@torpor/build/src/site/serverEntry.ts\",\n\t\t\t//\troutes: apiRoutes,\n\t\t\t//\tplugins: () => [config(\"custom\", viteOptions())],\n\t\t\t//},\n\t\t\t{\n\t\t\t\tname: \"server\",\n\t\t\t\ttype: \"http\",\n\t\t\t\ttarget: \"server\",\n\t\t\t\t// TODO: change this when published\n\t\t\t\thandler: \"node_modules/@torpor/build/src/site/serverEntry.ts\",\n\t\t\t\troutes,\n\t\t\t\tplugins: () => [config(\"custom\", viteOptions()), torpor({ server: true })],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"client\",\n\t\t\t\ttype: \"client\",\n\t\t\t\ttarget: \"browser\",\n\t\t\t\t// TODO: change this when published\n\t\t\t\thandler: \"node_modules/@torpor/build/src/site/clientEntry.ts\",\n\t\t\t\tbase: \"/_build\",\n\t\t\t\troutes,\n\t\t\t\tplugins: () => [config(\"custom\", viteOptions()), torpor()],\n\t\t\t},\n\t\t],\n\t});\n}\n\nfunction routes(router: RouterSchemaInput, app: AppOptions) {\n\treturn new FileSystemRouter(\n\t\t{\n\t\t\tdir: path.resolve(\"src/routes\"),\n\t\t\textensions: [\"js\", \"ts\"],\n\t\t},\n\t\trouter,\n\t\tapp,\n\t);\n}\n\nfunction viteOptions() {\n\treturn {\n\t\tresolve: {\n\t\t\talias: {\n\t\t\t\t\"@\": path.resolve(\"src\"),\n\t\t\t},\n\t\t},\n\t};\n}\n","import { BaseFileSystemRouter, cleanPath } from \"vinxi/fs-router\";\n\nexport default class FileSystemRouter extends BaseFileSystemRouter {\n\ttoPath(src: string) {\n\t\tlet routePath = cleanPath(src, this.config)\n\t\t\t.replace(/^\\//, \"\")\n\t\t\t.replace(/_layout.server$/, \"_layout/~server\")\n\t\t\t.replace(/\\+page.server$/, \"~server\")\n\t\t\t.replace(/\\+page$/, \"\")\n\t\t\t.replace(/\\+server$/, \"\")\n\t\t\t.replace(/\\/$/, \"\");\n\t\treturn routePath?.length > 0 ? `/${routePath}` : \"/\";\n\t}\n\n\ttoRoute(filePath: string) {\n\t\treturn {\n\t\t\tpath: this.toPath(filePath),\n\t\t\t$handler: {\n\t\t\t\tsrc: filePath,\n\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;AAAA,QACN,QAAQ;AAAA;AAAA,QAER,SAAS;AAAA,QACT,MAAM;AAAA,QACN;AAAA,QACA,SAAS,MAAM,KAAC,sBAAO,UAAU,YAAY,CAAC,OAAG,YAAAA,SAAO,CAAC;AAAA,MAC1D;AAAA,IACD;AAAA,EACD,CAAC;AACF;AAEA,SAAS,OAAO,QAA2BC,MAAiB;AAC3D,SAAO,IAAI;AAAA,IACV;AAAA,MACC,KAAK,YAAAC,QAAK,QAAQ,YAAY;AAAA,MAC9B,YAAY,CAAC,MAAM,IAAI;AAAA,IACxB;AAAA,IACA;AAAA,IACAD;AAAA,EACD;AACD;AAEA,SAAS,cAAc;AACtB,SAAO;AAAA,IACN,SAAS;AAAA,MACR,OAAO;AAAA,QACN,KAAK,YAAAC,QAAK,QAAQ,KAAK;AAAA,MACxB;AAAA,IACD;AAAA,EACD;AACD;;;AD/DA,IAAI;AACJ,IAAM,aAAa,QAAQ,IAAI;AAC/B,IAAM,eAAe,aAAAC,QAAK,KAAK,YAAY,kBAAkB;AAC7D,IAAM,eAAe,aAAAA,QAAK,KAAK,YAAY,kBAAkB;AAC7D,IAAI;AACJ,IAAI,eAAAC,QAAG,WAAW,YAAY,GAAG;AAGhC,WAAS,eAAAA,QAAG,aAAa,cAAc,MAAM;AAC7C,WAAS,OACP;AAAA,IACA;AAAA,IACA;AAAA,EACD,EACC,QAAQ,kBAAkB,EAAE;AAC/B,WAAW,eAAAA,QAAG,WAAW,YAAY,GAAG;AACvC,UAAQ,IAAI,iCAAiC;AAC9C;AAEA,IAAI,QAAQ;AACX,YAAU,KAAK,MAAM;AACtB;AAEA,IAAM,MAAM,WAAW,OAAO;","names":["import_path","options","torpor","app","path","path","fs"]}
1
+ {"version":3,"sources":["../../src/bin/index.ts","../../src/site/defineConfig.ts","../../src/site/FileSystemRouter.ts"],"sourcesContent":["#! /usr/bin/env node\n//import { existsSync, promises as fs } from \"node:fs\";\nimport fs from \"node:fs\";\nimport path from \"path\";\nimport defineConfig from \"../site/defineConfig\";\nimport { type UserConfig } from \"../types/UserConfig\";\n\n// Check for a torpor.config.js/ts file in the working directory\n// TODO: Make sure it's valid, try/catch, etc\n// TODO: There has GOT to be an easier way\nlet options: UserConfig | undefined;\nconst workingDir = process.cwd();\nconst jsConfigFile = path.join(workingDir, \"torpor.config.js\");\nconst tsConfigFile = path.join(workingDir, \"torpor.config.ts\");\nlet source: string | undefined;\nif (fs.existsSync(jsConfigFile)) {\n\t//const configFile = path.relative(\".\", tsConfigFile);\n\t//options = await import(configFile);\n\tsource = fs.readFileSync(jsConfigFile, \"utf8\");\n\tsource = source\n\t\t.replace(\n\t\t\t/import\\s+\\{\\s+defineConfig\\s+\\}\\s+from\\s+[\"']@torpor\\/build[\"']/,\n\t\t\t\"const defineConfig = (x) => x\",\n\t\t)\n\t\t.replace(\"export default\", \"\");\n} else if (fs.existsSync(tsConfigFile)) {\n\tconsole.log(\"TS config file is not supported\");\n}\n\nif (source) {\n\toptions = eval(source);\n}\n\ndefineConfig(options);\n\n// This already gets done in vinxi.createApp so we can't do it twice\n//const app = defineConfig(options);\n//if (process.argv.includes(\"--dev\")) {\n//\tawait app.dev();\n//} else if (process.argv.includes(\"--build\")) {\n//\tawait app.build();\n//}\n","import torpor from \"@torpor/unplugin/vite\";\nimport path from \"node:path\";\nimport { type AppOptions, type RouterSchemaInput, createApp } from \"vinxi\";\nimport { config } from \"vinxi/plugins/config\";\nimport { type UserConfig } from \"../types/UserConfig\";\nimport FileSystemRouter from \"./FileSystemRouter\";\n\nexport default function defineConfig(options?: UserConfig) {\n\t// Set the port\n\tprocess.env.PORT = (options?.port || 7059).toString();\n\n\t// Get Vinxi to create and serve the app\n\treturn createApp({\n\t\tname: \"torpor\",\n\t\trouters: [\n\t\t\t{\n\t\t\t\tname: \"assets\",\n\t\t\t\ttype: \"static\",\n\t\t\t\tdir: \"./src/assets\",\n\t\t\t},\n\t\t\t// Doesn't look like we can have two server routes?\n\t\t\t// Have to put api in /routes\n\t\t\t// Maybe we can support having /routes/api and routes/site and stripping /site from the start?\n\t\t\t//{\n\t\t\t//\tname: \"api\",\n\t\t\t//\ttype: \"http\",\n\t\t\t//\ttarget: \"server\",\n\t\t\t//\t// TODO: change this when published\n\t\t\t//\thandler: \"node_modules/@torpor/build/src/site/serverEntry.ts\",\n\t\t\t//\troutes: apiRoutes,\n\t\t\t//\tplugins: () => [config(\"custom\", viteOptions())],\n\t\t\t//},\n\t\t\t{\n\t\t\t\tname: \"server\",\n\t\t\t\ttype: \"http\",\n\t\t\t\ttarget: \"server\",\n\t\t\t\t// TODO: change this when published\n\t\t\t\thandler: \"./node_modules/@torpor/build/src/site/serverEntry.ts\",\n\t\t\t\troutes,\n\t\t\t\tplugins: () => [config(\"custom\", viteOptions()), torpor({ server: true })],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"client\",\n\t\t\t\ttype: \"client\",\n\t\t\t\ttarget: \"browser\",\n\t\t\t\t// TODO: change this when published\n\t\t\t\thandler: \"./node_modules/@torpor/build/src/site/clientEntry.ts\",\n\t\t\t\tbase: \"/_build\",\n\t\t\t\troutes,\n\t\t\t\tplugins: () => [config(\"custom\", viteOptions()), torpor()],\n\t\t\t},\n\t\t],\n\t});\n}\n\nfunction routes(router: RouterSchemaInput, app: AppOptions) {\n\treturn new FileSystemRouter(\n\t\t{\n\t\t\tdir: path.resolve(\"src/routes\"),\n\t\t\textensions: [\"js\", \"ts\"],\n\t\t},\n\t\trouter,\n\t\tapp,\n\t);\n}\n\nfunction viteOptions() {\n\treturn {\n\t\tresolve: {\n\t\t\talias: {\n\t\t\t\t\"@\": path.resolve(\"src\"),\n\t\t\t},\n\t\t},\n\t};\n}\n","import { BaseFileSystemRouter, cleanPath } from \"vinxi/fs-router\";\n\nexport default class FileSystemRouter extends BaseFileSystemRouter {\n\ttoPath(src: string) {\n\t\tlet routePath = cleanPath(src, this.config)\n\t\t\t.replace(/^\\//, \"\")\n\t\t\t.replace(/_hook.server$/, \"_hook/~server\")\n\t\t\t.replace(/_layout.server$/, \"_layout/~server\")\n\t\t\t.replace(/\\+page.server$/, \"~server\")\n\t\t\t.replace(/\\+page$/, \"\")\n\t\t\t.replace(/\\+server$/, \"\")\n\t\t\t.replace(/\\/$/, \"\");\n\t\treturn routePath?.length > 0 ? `/${routePath}` : \"/\";\n\t}\n\n\ttoRoute(filePath: string) {\n\t\treturn {\n\t\t\tpath: this.toPath(filePath),\n\t\t\t$handler: {\n\t\t\t\tsrc: filePath,\n\t\t\t\tpick: [\"default\"],\n\t\t\t},\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,qBAAe;AACf,kBAAiB;;;ACHjB,kBAAmB;AACnB,uBAAiB;AACjB,mBAAmE;AACnE,oBAAuB;;;ACHvB,uBAAgD;AAEhD,IAAqB,mBAArB,cAA8C,sCAAqB;AAAA,EAClE,OAAO,KAAa;AACnB,QAAI,gBAAY,4BAAU,KAAK,KAAK,MAAM,EACxC,QAAQ,OAAO,EAAE,EACjB,QAAQ,iBAAiB,eAAe,EACxC,QAAQ,mBAAmB,iBAAiB,EAC5C,QAAQ,kBAAkB,SAAS,EACnC,QAAQ,WAAW,EAAE,EACrB,QAAQ,aAAa,EAAE,EACvB,QAAQ,OAAO,EAAE;AACnB,WAAO,WAAW,SAAS,IAAI,IAAI,SAAS,KAAK;AAAA,EAClD;AAAA,EAEA,QAAQ,UAAkB;AACzB,WAAO;AAAA,MACN,MAAM,KAAK,OAAO,QAAQ;AAAA,MAC1B,UAAU;AAAA,QACT,KAAK;AAAA,QACL,MAAM,CAAC,SAAS;AAAA,MACjB;AAAA,IACD;AAAA,EACD;AACD;;;ADjBe,SAAR,aAA8BA,UAAsB;AAE1D,UAAQ,IAAI,QAAQA,UAAS,QAAQ,MAAM,SAAS;AAGpD,aAAO,wBAAU;AAAA,IAChB,MAAM;AAAA,IACN,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,MAAM;AAAA,QACN,KAAK;AAAA,MACN;AAAA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AAG;AACvC,UAAQ,IAAI,iCAAiC;AAC9C;AAEA,IAAI,QAAQ;AACX,YAAU,KAAK,MAAM;AACtB;AAEA,aAAa,OAAO;","names":["options","torpor","path","path","fs"]}
package/dist/bin/index.js CHANGED
@@ -1,102 +1,15 @@
1
1
  #! /usr/bin/env node
2
+ import {
3
+ defineConfig
4
+ } from "../chunk-L7GOYKUG.js";
2
5
 
3
6
  // src/bin/index.ts
4
7
  import fs from "node:fs";
5
- import path2 from "path";
6
-
7
- // src/site/defineSite.ts
8
- import torpor from "@torpor/unplugin/vite";
9
8
  import path from "path";
10
- import { createApp } from "vinxi";
11
- import { config } from "vinxi/plugins/config";
12
-
13
- // src/site/FileSystemRouter.ts
14
- import { BaseFileSystemRouter, cleanPath } from "vinxi/fs-router";
15
- var FileSystemRouter = class extends BaseFileSystemRouter {
16
- toPath(src) {
17
- let routePath = cleanPath(src, this.config).replace(/^\//, "").replace(/_layout.server$/, "_layout/~server").replace(/\+page.server$/, "~server").replace(/\+page$/, "").replace(/\+server$/, "").replace(/\/$/, "");
18
- return routePath?.length > 0 ? `/${routePath}` : "/";
19
- }
20
- toRoute(filePath) {
21
- return {
22
- path: this.toPath(filePath),
23
- $handler: {
24
- src: filePath,
25
- pick: ["default"]
26
- }
27
- };
28
- }
29
- };
30
-
31
- // src/site/defineSite.ts
32
- function defineSite(options2) {
33
- process.env.PORT = (options2?.port || 7059).toString();
34
- return createApp({
35
- routers: [
36
- {
37
- name: "assets",
38
- type: "static",
39
- dir: "./src/assets"
40
- },
41
- // Doesn't look like we can have two server routes?
42
- // Have to put api in /routes
43
- // Maybe we can support having /routes/api and routes/site and stripping /site from the start?
44
- //{
45
- // name: "api",
46
- // type: "http",
47
- // target: "server",
48
- // // TODO: change this when published
49
- // handler: "node_modules/@torpor/build/src/site/serverEntry.ts",
50
- // routes: apiRoutes,
51
- // plugins: () => [config("custom", viteOptions())],
52
- //},
53
- {
54
- name: "server",
55
- type: "http",
56
- target: "server",
57
- // TODO: change this when published
58
- handler: "node_modules/@torpor/build/src/site/serverEntry.ts",
59
- routes,
60
- plugins: () => [config("custom", viteOptions()), torpor({ server: true })]
61
- },
62
- {
63
- name: "client",
64
- type: "client",
65
- target: "browser",
66
- // TODO: change this when published
67
- handler: "node_modules/@torpor/build/src/site/clientEntry.ts",
68
- base: "/_build",
69
- routes,
70
- plugins: () => [config("custom", viteOptions()), torpor()]
71
- }
72
- ]
73
- });
74
- }
75
- function routes(router, app2) {
76
- return new FileSystemRouter(
77
- {
78
- dir: path.resolve("src/routes"),
79
- extensions: ["js", "ts"]
80
- },
81
- router,
82
- app2
83
- );
84
- }
85
- function viteOptions() {
86
- return {
87
- resolve: {
88
- alias: {
89
- "@": path.resolve("src")
90
- }
91
- }
92
- };
93
- }
94
-
95
- // src/bin/index.ts
96
9
  var options;
97
10
  var workingDir = process.cwd();
98
- var jsConfigFile = path2.join(workingDir, "torpor.config.js");
99
- var tsConfigFile = path2.join(workingDir, "torpor.config.ts");
11
+ var jsConfigFile = path.join(workingDir, "torpor.config.js");
12
+ var tsConfigFile = path.join(workingDir, "torpor.config.ts");
100
13
  var source;
101
14
  if (fs.existsSync(jsConfigFile)) {
102
15
  source = fs.readFileSync(jsConfigFile, "utf8");
@@ -110,5 +23,5 @@ if (fs.existsSync(jsConfigFile)) {
110
23
  if (source) {
111
24
  options = eval(source);
112
25
  }
113
- var app = defineSite(options);
26
+ defineConfig(options);
114
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/bin/index.ts","../../src/site/defineSite.ts","../../src/site/FileSystemRouter.ts"],"sourcesContent":["#! /usr/bin/env node\n//import { existsSync, promises as fs } from \"node:fs\";\nimport fs from \"node:fs\";\nimport path from \"path\";\nimport defineSite from \"../site/defineSite\";\nimport type UserConfig from \"../types/UserConfig\";\n\n// Check for a torpor.config.js/ts file in the working directory\n// TODO: Make sure it's valid, try/catch, etc\n// TODO: There has GOT to be an easier way\nlet options: UserConfig | undefined;\nconst workingDir = process.cwd();\nconst jsConfigFile = path.join(workingDir, \"torpor.config.js\");\nconst tsConfigFile = path.join(workingDir, \"torpor.config.ts\");\nlet source: string | undefined;\nif (fs.existsSync(jsConfigFile)) {\n\t//const configFile = path.relative(\".\", tsConfigFile);\n\t//options = await import(configFile);\n\tsource = fs.readFileSync(jsConfigFile, \"utf8\");\n\tsource = source\n\t\t.replace(\n\t\t\t/import\\s+\\{\\s+defineConfig\\s+\\}\\s+from\\s+[\"']@torpor\\/build[\"']/,\n\t\t\t\"const defineConfig = (x) => x\",\n\t\t)\n\t\t.replace(\"export default\", \"\");\n} else if (fs.existsSync(tsConfigFile)) {\n\tconsole.log(\"TS config file is not supported\");\n}\n\nif (source) {\n\toptions = eval(source);\n}\n\nconst app = defineSite(options);\n\n// This already gets done in vinxi.createApp so we can't do it twice\n//if (process.argv.includes(\"--dev\")) {\n//\tawait app.dev();\n//} else if (process.argv.includes(\"--build\")) {\n//\tawait app.build();\n//}\n","import torpor from \"@torpor/unplugin/vite\";\nimport path from \"path\";\nimport { AppOptions, RouterSchemaInput, createApp } from \"vinxi\";\nimport { config } from \"vinxi/plugins/config\";\nimport type UserConfig from \"../types/UserConfig\";\nimport FileSystemRouter from \"./FileSystemRouter\";\n\nexport default function defineSite(options?: UserConfig) {\n\t// Set the port\n\tprocess.env.PORT = (options?.port || 7059).toString();\n\n\t// Get Vinxi to create and serve the app\n\treturn createApp({\n\t\trouters: [\n\t\t\t{\n\t\t\t\tname: \"assets\",\n\t\t\t\ttype: \"static\",\n\t\t\t\tdir: \"./src/assets\",\n\t\t\t},\n\t\t\t// Doesn't look like we can have two server routes?\n\t\t\t// Have to put api in /routes\n\t\t\t// Maybe we can support having /routes/api and routes/site and stripping /site from the start?\n\t\t\t//{\n\t\t\t//\tname: \"api\",\n\t\t\t//\ttype: \"http\",\n\t\t\t//\ttarget: \"server\",\n\t\t\t//\t// TODO: change this when published\n\t\t\t//\thandler: \"node_modules/@torpor/build/src/site/serverEntry.ts\",\n\t\t\t//\troutes: apiRoutes,\n\t\t\t//\tplugins: () => [config(\"custom\", viteOptions())],\n\t\t\t//},\n\t\t\t{\n\t\t\t\tname: \"server\",\n\t\t\t\ttype: \"http\",\n\t\t\t\ttarget: \"server\",\n\t\t\t\t// TODO: change this when published\n\t\t\t\thandler: \"node_modules/@torpor/build/src/site/serverEntry.ts\",\n\t\t\t\troutes,\n\t\t\t\tplugins: () => [config(\"custom\", viteOptions()), torpor({ server: true })],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"client\",\n\t\t\t\ttype: \"client\",\n\t\t\t\ttarget: \"browser\",\n\t\t\t\t// TODO: change this when published\n\t\t\t\thandler: \"node_modules/@torpor/build/src/site/clientEntry.ts\",\n\t\t\t\tbase: \"/_build\",\n\t\t\t\troutes,\n\t\t\t\tplugins: () => [config(\"custom\", viteOptions()), torpor()],\n\t\t\t},\n\t\t],\n\t});\n}\n\nfunction routes(router: RouterSchemaInput, app: AppOptions) {\n\treturn new FileSystemRouter(\n\t\t{\n\t\t\tdir: path.resolve(\"src/routes\"),\n\t\t\textensions: [\"js\", \"ts\"],\n\t\t},\n\t\trouter,\n\t\tapp,\n\t);\n}\n\nfunction viteOptions() {\n\treturn {\n\t\tresolve: {\n\t\t\talias: {\n\t\t\t\t\"@\": path.resolve(\"src\"),\n\t\t\t},\n\t\t},\n\t};\n}\n","import { BaseFileSystemRouter, cleanPath } from \"vinxi/fs-router\";\n\nexport default class FileSystemRouter extends BaseFileSystemRouter {\n\ttoPath(src: string) {\n\t\tlet routePath = cleanPath(src, this.config)\n\t\t\t.replace(/^\\//, \"\")\n\t\t\t.replace(/_layout.server$/, \"_layout/~server\")\n\t\t\t.replace(/\\+page.server$/, \"~server\")\n\t\t\t.replace(/\\+page$/, \"\")\n\t\t\t.replace(/\\+server$/, \"\")\n\t\t\t.replace(/\\/$/, \"\");\n\t\treturn routePath?.length > 0 ? `/${routePath}` : \"/\";\n\t}\n\n\ttoRoute(filePath: string) {\n\t\treturn {\n\t\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;AAAA,MAC1E;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,MAAM;AAAA,QACN,QAAQ;AAAA;AAAA,QAER,SAAS;AAAA,QACT,MAAM;AAAA,QACN;AAAA,QACA,SAAS,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,GAAG,OAAO,CAAC;AAAA,MAC1D;AAAA,IACD;AAAA,EACD,CAAC;AACF;AAEA,SAAS,OAAO,QAA2BC,MAAiB;AAC3D,SAAO,IAAI;AAAA,IACV;AAAA,MACC,KAAK,KAAK,QAAQ,YAAY;AAAA,MAC9B,YAAY,CAAC,MAAM,IAAI;AAAA,IACxB;AAAA,IACA;AAAA,IACAA;AAAA,EACD;AACD;AAEA,SAAS,cAAc;AACtB,SAAO;AAAA,IACN,SAAS;AAAA,MACR,OAAO;AAAA,QACN,KAAK,KAAK,QAAQ,KAAK;AAAA,MACxB;AAAA,IACD;AAAA,EACD;AACD;;;AD/DA,IAAI;AACJ,IAAM,aAAa,QAAQ,IAAI;AAC/B,IAAM,eAAeC,MAAK,KAAK,YAAY,kBAAkB;AAC7D,IAAM,eAAeA,MAAK,KAAK,YAAY,kBAAkB;AAC7D,IAAI;AACJ,IAAI,GAAG,WAAW,YAAY,GAAG;AAGhC,WAAS,GAAG,aAAa,cAAc,MAAM;AAC7C,WAAS,OACP;AAAA,IACA;AAAA,IACA;AAAA,EACD,EACC,QAAQ,kBAAkB,EAAE;AAC/B,WAAW,GAAG,WAAW,YAAY,GAAG;AACvC,UAAQ,IAAI,iCAAiC;AAC9C;AAEA,IAAI,QAAQ;AACX,YAAU,KAAK,MAAM;AACtB;AAEA,IAAM,MAAM,WAAW,OAAO;","names":["path","options","app","path"]}
1
+ {"version":3,"sources":["../../src/bin/index.ts"],"sourcesContent":["#! /usr/bin/env node\n//import { existsSync, promises as fs } from \"node:fs\";\nimport fs from \"node:fs\";\nimport path from \"path\";\nimport defineConfig from \"../site/defineConfig\";\nimport { type UserConfig } from \"../types/UserConfig\";\n\n// Check for a torpor.config.js/ts file in the working directory\n// TODO: Make sure it's valid, try/catch, etc\n// TODO: There has GOT to be an easier way\nlet options: UserConfig | undefined;\nconst workingDir = process.cwd();\nconst jsConfigFile = path.join(workingDir, \"torpor.config.js\");\nconst tsConfigFile = path.join(workingDir, \"torpor.config.ts\");\nlet source: string | undefined;\nif (fs.existsSync(jsConfigFile)) {\n\t//const configFile = path.relative(\".\", tsConfigFile);\n\t//options = await import(configFile);\n\tsource = fs.readFileSync(jsConfigFile, \"utf8\");\n\tsource = source\n\t\t.replace(\n\t\t\t/import\\s+\\{\\s+defineConfig\\s+\\}\\s+from\\s+[\"']@torpor\\/build[\"']/,\n\t\t\t\"const defineConfig = (x) => x\",\n\t\t)\n\t\t.replace(\"export default\", \"\");\n} else if (fs.existsSync(tsConfigFile)) {\n\tconsole.log(\"TS config file is not supported\");\n}\n\nif (source) {\n\toptions = eval(source);\n}\n\ndefineConfig(options);\n\n// This already gets done in vinxi.createApp so we can't do it twice\n//const app = defineConfig(options);\n//if (process.argv.includes(\"--dev\")) {\n//\tawait app.dev();\n//} else if (process.argv.includes(\"--build\")) {\n//\tawait app.build();\n//}\n"],"mappings":";;;;;;AAEA,OAAO,QAAQ;AACf,OAAO,UAAU;AAOjB,IAAI;AACJ,IAAM,aAAa,QAAQ,IAAI;AAC/B,IAAM,eAAe,KAAK,KAAK,YAAY,kBAAkB;AAC7D,IAAM,eAAe,KAAK,KAAK,YAAY,kBAAkB;AAC7D,IAAI;AACJ,IAAI,GAAG,WAAW,YAAY,GAAG;AAGhC,WAAS,GAAG,aAAa,cAAc,MAAM;AAC7C,WAAS,OACP;AAAA,IACA;AAAA,IACA;AAAA,EACD,EACC,QAAQ,kBAAkB,EAAE;AAC/B,WAAW,GAAG,WAAW,YAAY,GAAG;AACvC,UAAQ,IAAI,iCAAiC;AAC9C;AAEA,IAAI,QAAQ;AACX,YAAU,KAAK,MAAM;AACtB;AAEA,aAAa,OAAO;","names":[]}
@@ -0,0 +1,93 @@
1
+ // src/site/defineConfig.ts
2
+ import torpor from "@torpor/unplugin/vite";
3
+ import path from "node:path";
4
+ import { createApp } from "vinxi";
5
+ import { config } from "vinxi/plugins/config";
6
+
7
+ // src/site/FileSystemRouter.ts
8
+ import { BaseFileSystemRouter, cleanPath } from "vinxi/fs-router";
9
+ var FileSystemRouter = class extends BaseFileSystemRouter {
10
+ toPath(src) {
11
+ let routePath = cleanPath(src, this.config).replace(/^\//, "").replace(/_hook.server$/, "_hook/~server").replace(/_layout.server$/, "_layout/~server").replace(/\+page.server$/, "~server").replace(/\+page$/, "").replace(/\+server$/, "").replace(/\/$/, "");
12
+ return routePath?.length > 0 ? `/${routePath}` : "/";
13
+ }
14
+ toRoute(filePath) {
15
+ return {
16
+ path: this.toPath(filePath),
17
+ $handler: {
18
+ src: filePath,
19
+ pick: ["default"]
20
+ }
21
+ };
22
+ }
23
+ };
24
+
25
+ // src/site/defineConfig.ts
26
+ function defineConfig(options) {
27
+ process.env.PORT = (options?.port || 7059).toString();
28
+ return createApp({
29
+ name: "torpor",
30
+ routers: [
31
+ {
32
+ name: "assets",
33
+ type: "static",
34
+ dir: "./src/assets"
35
+ },
36
+ // Doesn't look like we can have two server routes?
37
+ // Have to put api in /routes
38
+ // Maybe we can support having /routes/api and routes/site and stripping /site from the start?
39
+ //{
40
+ // name: "api",
41
+ // type: "http",
42
+ // target: "server",
43
+ // // TODO: change this when published
44
+ // handler: "node_modules/@torpor/build/src/site/serverEntry.ts",
45
+ // routes: apiRoutes,
46
+ // plugins: () => [config("custom", viteOptions())],
47
+ //},
48
+ {
49
+ name: "server",
50
+ type: "http",
51
+ target: "server",
52
+ // TODO: change this when published
53
+ handler: "./node_modules/@torpor/build/src/site/serverEntry.ts",
54
+ routes,
55
+ plugins: () => [config("custom", viteOptions()), torpor({ server: true })]
56
+ },
57
+ {
58
+ name: "client",
59
+ type: "client",
60
+ target: "browser",
61
+ // TODO: change this when published
62
+ handler: "./node_modules/@torpor/build/src/site/clientEntry.ts",
63
+ base: "/_build",
64
+ routes,
65
+ plugins: () => [config("custom", viteOptions()), torpor()]
66
+ }
67
+ ]
68
+ });
69
+ }
70
+ function routes(router, app) {
71
+ return new FileSystemRouter(
72
+ {
73
+ dir: path.resolve("src/routes"),
74
+ extensions: ["js", "ts"]
75
+ },
76
+ router,
77
+ app
78
+ );
79
+ }
80
+ function viteOptions() {
81
+ return {
82
+ resolve: {
83
+ alias: {
84
+ "@": path.resolve("src")
85
+ }
86
+ }
87
+ };
88
+ }
89
+
90
+ export {
91
+ defineConfig
92
+ };
93
+ //# sourceMappingURL=chunk-L7GOYKUG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/site/defineConfig.ts","../src/site/FileSystemRouter.ts"],"sourcesContent":["import torpor from \"@torpor/unplugin/vite\";\nimport path from \"node:path\";\nimport { type AppOptions, type RouterSchemaInput, createApp } from \"vinxi\";\nimport { config } from \"vinxi/plugins/config\";\nimport { type UserConfig } from \"../types/UserConfig\";\nimport FileSystemRouter from \"./FileSystemRouter\";\n\nexport default function defineConfig(options?: UserConfig) {\n\t// Set the port\n\tprocess.env.PORT = (options?.port || 7059).toString();\n\n\t// Get Vinxi to create and serve the app\n\treturn createApp({\n\t\tname: \"torpor\",\n\t\trouters: [\n\t\t\t{\n\t\t\t\tname: \"assets\",\n\t\t\t\ttype: \"static\",\n\t\t\t\tdir: \"./src/assets\",\n\t\t\t},\n\t\t\t// Doesn't look like we can have two server routes?\n\t\t\t// Have to put api in /routes\n\t\t\t// Maybe we can support having /routes/api and routes/site and stripping /site from the start?\n\t\t\t//{\n\t\t\t//\tname: \"api\",\n\t\t\t//\ttype: \"http\",\n\t\t\t//\ttarget: \"server\",\n\t\t\t//\t// TODO: change this when published\n\t\t\t//\thandler: \"node_modules/@torpor/build/src/site/serverEntry.ts\",\n\t\t\t//\troutes: apiRoutes,\n\t\t\t//\tplugins: () => [config(\"custom\", viteOptions())],\n\t\t\t//},\n\t\t\t{\n\t\t\t\tname: \"server\",\n\t\t\t\ttype: \"http\",\n\t\t\t\ttarget: \"server\",\n\t\t\t\t// TODO: change this when published\n\t\t\t\thandler: \"./node_modules/@torpor/build/src/site/serverEntry.ts\",\n\t\t\t\troutes,\n\t\t\t\tplugins: () => [config(\"custom\", viteOptions()), torpor({ server: true })],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"client\",\n\t\t\t\ttype: \"client\",\n\t\t\t\ttarget: \"browser\",\n\t\t\t\t// TODO: change this when published\n\t\t\t\thandler: \"./node_modules/@torpor/build/src/site/clientEntry.ts\",\n\t\t\t\tbase: \"/_build\",\n\t\t\t\troutes,\n\t\t\t\tplugins: () => [config(\"custom\", viteOptions()), torpor()],\n\t\t\t},\n\t\t],\n\t});\n}\n\nfunction routes(router: RouterSchemaInput, app: AppOptions) {\n\treturn new FileSystemRouter(\n\t\t{\n\t\t\tdir: path.resolve(\"src/routes\"),\n\t\t\textensions: [\"js\", \"ts\"],\n\t\t},\n\t\trouter,\n\t\tapp,\n\t);\n}\n\nfunction viteOptions() {\n\treturn {\n\t\tresolve: {\n\t\t\talias: {\n\t\t\t\t\"@\": path.resolve(\"src\"),\n\t\t\t},\n\t\t},\n\t};\n}\n","import { BaseFileSystemRouter, cleanPath } from \"vinxi/fs-router\";\n\nexport default class FileSystemRouter extends BaseFileSystemRouter {\n\ttoPath(src: string) {\n\t\tlet routePath = cleanPath(src, this.config)\n\t\t\t.replace(/^\\//, \"\")\n\t\t\t.replace(/_hook.server$/, \"_hook/~server\")\n\t\t\t.replace(/_layout.server$/, \"_layout/~server\")\n\t\t\t.replace(/\\+page.server$/, \"~server\")\n\t\t\t.replace(/\\+page$/, \"\")\n\t\t\t.replace(/\\+server$/, \"\")\n\t\t\t.replace(/\\/$/, \"\");\n\t\treturn routePath?.length > 0 ? `/${routePath}` : \"/\";\n\t}\n\n\ttoRoute(filePath: string) {\n\t\treturn {\n\t\t\tpath: this.toPath(filePath),\n\t\t\t$handler: {\n\t\t\t\tsrc: filePath,\n\t\t\t\tpick: [\"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;AAAA;AAAA,QAER,SAAS;AAAA,QACT,MAAM;AAAA,QACN;AAAA,QACA,SAAS,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,GAAG,OAAO,CAAC;AAAA,MAC1D;AAAA,IACD;AAAA,EACD,CAAC;AACF;AAEA,SAAS,OAAO,QAA2B,KAAiB;AAC3D,SAAO,IAAI;AAAA,IACV;AAAA,MACC,KAAK,KAAK,QAAQ,YAAY;AAAA,MAC9B,YAAY,CAAC,MAAM,IAAI;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEA,SAAS,cAAc;AACtB,SAAO;AAAA,IACN,SAAS;AAAA,MACR,OAAO;AAAA,QACN,KAAK,KAAK,QAAQ,KAAK;AAAA,MACxB;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
package/dist/index.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,20 +17,28 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
23
33
  buildRoutePath: () => buildRoutePath,
24
34
  defineConfig: () => defineConfig
25
35
  });
26
- module.exports = __toCommonJS(src_exports);
36
+ module.exports = __toCommonJS(index_exports);
27
37
 
28
38
  // src/site/buildRoutePath.ts
29
- function buildRoutePath(path, routeParams, urlParams) {
39
+ function buildRoutePath(path2, routeParams, urlParams) {
30
40
  for (let [key, value] of Object.entries(routeParams)) {
31
- path = path.replace(`[${key}]`, value);
41
+ path2 = path2.replace(`[${key}]`, value);
32
42
  }
33
43
  if (urlParams) {
34
44
  let params = Object.entries(urlParams).map(([key, value]) => {
@@ -37,15 +47,99 @@ function buildRoutePath(path, routeParams, urlParams) {
37
47
  }
38
48
  }).filter(Boolean);
39
49
  if (params.length) {
40
- path += `?${params.join("&")}`;
50
+ path2 += `?${params.join("&")}`;
41
51
  }
42
52
  }
43
- return path;
53
+ return path2;
44
54
  }
45
55
 
46
56
  // src/site/defineConfig.ts
47
- function defineConfig(config) {
48
- return config;
57
+ var import_vite = __toESM(require("@torpor/unplugin/vite"), 1);
58
+ var import_node_path = __toESM(require("path"), 1);
59
+ var import_vinxi = require("vinxi");
60
+ var import_config = require("vinxi/plugins/config");
61
+
62
+ // src/site/FileSystemRouter.ts
63
+ var import_fs_router = require("vinxi/fs-router");
64
+ var FileSystemRouter = class extends import_fs_router.BaseFileSystemRouter {
65
+ toPath(src) {
66
+ let routePath = (0, import_fs_router.cleanPath)(src, this.config).replace(/^\//, "").replace(/_hook.server$/, "_hook/~server").replace(/_layout.server$/, "_layout/~server").replace(/\+page.server$/, "~server").replace(/\+page$/, "").replace(/\+server$/, "").replace(/\/$/, "");
67
+ return routePath?.length > 0 ? `/${routePath}` : "/";
68
+ }
69
+ toRoute(filePath) {
70
+ return {
71
+ path: this.toPath(filePath),
72
+ $handler: {
73
+ src: filePath,
74
+ pick: ["default"]
75
+ }
76
+ };
77
+ }
78
+ };
79
+
80
+ // src/site/defineConfig.ts
81
+ function defineConfig(options) {
82
+ process.env.PORT = (options?.port || 7059).toString();
83
+ return (0, import_vinxi.createApp)({
84
+ name: "torpor",
85
+ routers: [
86
+ {
87
+ name: "assets",
88
+ type: "static",
89
+ dir: "./src/assets"
90
+ },
91
+ // Doesn't look like we can have two server routes?
92
+ // Have to put api in /routes
93
+ // Maybe we can support having /routes/api and routes/site and stripping /site from the start?
94
+ //{
95
+ // name: "api",
96
+ // type: "http",
97
+ // target: "server",
98
+ // // TODO: change this when published
99
+ // handler: "node_modules/@torpor/build/src/site/serverEntry.ts",
100
+ // routes: apiRoutes,
101
+ // plugins: () => [config("custom", viteOptions())],
102
+ //},
103
+ {
104
+ name: "server",
105
+ type: "http",
106
+ target: "server",
107
+ // TODO: change this when published
108
+ handler: "./node_modules/@torpor/build/src/site/serverEntry.ts",
109
+ routes,
110
+ plugins: () => [(0, import_config.config)("custom", viteOptions()), (0, import_vite.default)({ server: true })]
111
+ },
112
+ {
113
+ name: "client",
114
+ type: "client",
115
+ target: "browser",
116
+ // TODO: change this when published
117
+ handler: "./node_modules/@torpor/build/src/site/clientEntry.ts",
118
+ base: "/_build",
119
+ routes,
120
+ plugins: () => [(0, import_config.config)("custom", viteOptions()), (0, import_vite.default)()]
121
+ }
122
+ ]
123
+ });
124
+ }
125
+ function routes(router, app) {
126
+ return new FileSystemRouter(
127
+ {
128
+ dir: import_node_path.default.resolve("src/routes"),
129
+ extensions: ["js", "ts"]
130
+ },
131
+ router,
132
+ app
133
+ );
134
+ }
135
+ function viteOptions() {
136
+ return {
137
+ resolve: {
138
+ alias: {
139
+ "@": import_node_path.default.resolve("src")
140
+ }
141
+ }
142
+ };
49
143
  }
50
144
  // Annotate the CommonJS export names for ESM import in node:
51
145
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/site/buildRoutePath.ts","../src/site/defineConfig.ts"],"sourcesContent":["import buildRoutePath from \"./site/buildRoutePath\";\nimport defineConfig from \"./site/defineConfig\";\nimport type PageEndPoint from \"./types/PageEndPoint\";\nimport type PageEvent from \"./types/PageEvent\";\nimport type PageServerEndPoint from \"./types/PageServerEndPoint\";\nimport type ServerEndPoint from \"./types/ServerEndPoint\";\nimport type ServerEvent from \"./types/ServerEvent\";\nimport type ServerHook from \"./types/ServerHook\";\nimport type UserConfig from \"./types/UserConfig\";\n\n// NOTE: Do not export anything that relies on vinxi/vite from here, or it will\n// cause problems when they are re-imported when routes are lazily loaded\n\nexport { defineConfig, buildRoutePath };\n\nexport type {\n\tUserConfig,\n\tPageEndPoint,\n\tPageServerEndPoint,\n\tServerEndPoint,\n\tServerHook,\n\tPageEvent,\n\tServerEvent,\n};\n","type ParamsType = Record<PropertyKey, any>;\n\nexport default function buildRoutePath<RP extends ParamsType, UP extends ParamsType>(\n\tpath: string,\n\trouteParams: RP,\n\turlParams?: UP,\n) {\n\tfor (let [key, value] of Object.entries(routeParams)) {\n\t\tpath = path.replace(`[${key}]`, value);\n\t}\n\tif (urlParams) {\n\t\t// TODO: More sophisticated url params serialization\n\t\tlet params = Object.entries(urlParams)\n\t\t\t.map(([key, value]) => {\n\t\t\t\tif (value != null) {\n\t\t\t\t\treturn `${key}=${value}`;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter(Boolean);\n\t\tif (params.length) {\n\t\t\tpath += `?${params.join(\"&\")}`;\n\t\t}\n\t}\n\treturn path;\n}\n","import type UserConfig from \"../types/UserConfig\";\n\nexport default function defineConfig(config: UserConfig): UserConfig {\n\treturn config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEe,SAAR,eACN,MACA,aACA,WACC;AACD,WAAS,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,WAAW,GAAG;AACrD,WAAO,KAAK,QAAQ,IAAI,GAAG,KAAK,KAAK;AAAA,EACtC;AACA,MAAI,WAAW;AAEd,QAAI,SAAS,OAAO,QAAQ,SAAS,EACnC,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AACtB,UAAI,SAAS,MAAM;AAClB,eAAO,GAAG,GAAG,IAAI,KAAK;AAAA,MACvB;AAAA,IACD,CAAC,EACA,OAAO,OAAO;AAChB,QAAI,OAAO,QAAQ;AAClB,cAAQ,IAAI,OAAO,KAAK,GAAG,CAAC;AAAA,IAC7B;AAAA,EACD;AACA,SAAO;AACR;;;ACtBe,SAAR,aAA8B,QAAgC;AACpE,SAAO;AACR;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/site/buildRoutePath.ts","../src/site/defineConfig.ts","../src/site/FileSystemRouter.ts"],"sourcesContent":["import buildRoutePath from \"./site/buildRoutePath\";\nimport defineConfig from \"./site/defineConfig\";\nimport { type PageEndPoint } from \"./types/PageEndPoint\";\nimport { type PageEvent } from \"./types/PageEvent\";\nimport { type PageServerEndPoint } from \"./types/PageServerEndPoint\";\nimport { type ServerEndPoint } from \"./types/ServerEndPoint\";\nimport { type ServerEvent } from \"./types/ServerEvent\";\nimport { type ServerHook } from \"./types/ServerHook\";\nimport { type UserConfig } from \"./types/UserConfig\";\n\n// NOTE: Do not export anything that relies on vinxi/vite from here, or it will\n// cause problems when they are re-imported when routes are lazily loaded\n\nexport { defineConfig, buildRoutePath };\n\nexport type {\n\tUserConfig,\n\tPageEndPoint,\n\tPageServerEndPoint,\n\tServerEndPoint,\n\tServerHook,\n\tPageEvent,\n\tServerEvent,\n};\n","type ParamsType = Record<PropertyKey, any>;\n\nexport default function buildRoutePath<RP extends ParamsType, UP extends ParamsType>(\n\tpath: string,\n\trouteParams: RP,\n\turlParams?: UP,\n) {\n\tfor (let [key, value] of Object.entries(routeParams)) {\n\t\tpath = path.replace(`[${key}]`, value);\n\t}\n\tif (urlParams) {\n\t\t// TODO: More sophisticated url params serialization\n\t\tlet params = Object.entries(urlParams)\n\t\t\t.map(([key, value]) => {\n\t\t\t\tif (value != null) {\n\t\t\t\t\treturn `${key}=${value}`;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter(Boolean);\n\t\tif (params.length) {\n\t\t\tpath += `?${params.join(\"&\")}`;\n\t\t}\n\t}\n\treturn path;\n}\n","import torpor from \"@torpor/unplugin/vite\";\nimport path from \"node:path\";\nimport { type AppOptions, type RouterSchemaInput, createApp } from \"vinxi\";\nimport { config } from \"vinxi/plugins/config\";\nimport { type UserConfig } from \"../types/UserConfig\";\nimport FileSystemRouter from \"./FileSystemRouter\";\n\nexport default function defineConfig(options?: UserConfig) {\n\t// Set the port\n\tprocess.env.PORT = (options?.port || 7059).toString();\n\n\t// Get Vinxi to create and serve the app\n\treturn createApp({\n\t\tname: \"torpor\",\n\t\trouters: [\n\t\t\t{\n\t\t\t\tname: \"assets\",\n\t\t\t\ttype: \"static\",\n\t\t\t\tdir: \"./src/assets\",\n\t\t\t},\n\t\t\t// Doesn't look like we can have two server routes?\n\t\t\t// Have to put api in /routes\n\t\t\t// Maybe we can support having /routes/api and routes/site and stripping /site from the start?\n\t\t\t//{\n\t\t\t//\tname: \"api\",\n\t\t\t//\ttype: \"http\",\n\t\t\t//\ttarget: \"server\",\n\t\t\t//\t// TODO: change this when published\n\t\t\t//\thandler: \"node_modules/@torpor/build/src/site/serverEntry.ts\",\n\t\t\t//\troutes: apiRoutes,\n\t\t\t//\tplugins: () => [config(\"custom\", viteOptions())],\n\t\t\t//},\n\t\t\t{\n\t\t\t\tname: \"server\",\n\t\t\t\ttype: \"http\",\n\t\t\t\ttarget: \"server\",\n\t\t\t\t// TODO: change this when published\n\t\t\t\thandler: \"./node_modules/@torpor/build/src/site/serverEntry.ts\",\n\t\t\t\troutes,\n\t\t\t\tplugins: () => [config(\"custom\", viteOptions()), torpor({ server: true })],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"client\",\n\t\t\t\ttype: \"client\",\n\t\t\t\ttarget: \"browser\",\n\t\t\t\t// TODO: change this when published\n\t\t\t\thandler: \"./node_modules/@torpor/build/src/site/clientEntry.ts\",\n\t\t\t\tbase: \"/_build\",\n\t\t\t\troutes,\n\t\t\t\tplugins: () => [config(\"custom\", viteOptions()), torpor()],\n\t\t\t},\n\t\t],\n\t});\n}\n\nfunction routes(router: RouterSchemaInput, app: AppOptions) {\n\treturn new FileSystemRouter(\n\t\t{\n\t\t\tdir: path.resolve(\"src/routes\"),\n\t\t\textensions: [\"js\", \"ts\"],\n\t\t},\n\t\trouter,\n\t\tapp,\n\t);\n}\n\nfunction viteOptions() {\n\treturn {\n\t\tresolve: {\n\t\t\talias: {\n\t\t\t\t\"@\": path.resolve(\"src\"),\n\t\t\t},\n\t\t},\n\t};\n}\n","import { BaseFileSystemRouter, cleanPath } from \"vinxi/fs-router\";\n\nexport default class FileSystemRouter extends BaseFileSystemRouter {\n\ttoPath(src: string) {\n\t\tlet routePath = cleanPath(src, this.config)\n\t\t\t.replace(/^\\//, \"\")\n\t\t\t.replace(/_hook.server$/, \"_hook/~server\")\n\t\t\t.replace(/_layout.server$/, \"_layout/~server\")\n\t\t\t.replace(/\\+page.server$/, \"~server\")\n\t\t\t.replace(/\\+page$/, \"\")\n\t\t\t.replace(/\\+server$/, \"\")\n\t\t\t.replace(/\\/$/, \"\");\n\t\treturn routePath?.length > 0 ? `/${routePath}` : \"/\";\n\t}\n\n\ttoRoute(filePath: string) {\n\t\treturn {\n\t\t\tpath: this.toPath(filePath),\n\t\t\t$handler: {\n\t\t\t\tsrc: filePath,\n\t\t\t\tpick: [\"default\"],\n\t\t\t},\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEe,SAAR,eACNA,OACA,aACA,WACC;AACD,WAAS,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,WAAW,GAAG;AACrD,IAAAA,QAAOA,MAAK,QAAQ,IAAI,GAAG,KAAK,KAAK;AAAA,EACtC;AACA,MAAI,WAAW;AAEd,QAAI,SAAS,OAAO,QAAQ,SAAS,EACnC,IAAI,CAAC,CAAC,KAA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