@marko/run 0.1.2 → 0.1.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.
@@ -3,7 +3,7 @@ import path2 from "path";
3
3
  import crypto from "crypto";
4
4
  import fs2 from "fs";
5
5
  import glob from "glob";
6
- import { mergeConfig } from "vite";
6
+ import { mergeConfig, resolvePackageData } from "vite";
7
7
  import markoVitePlugin, { FileStore } from "@marko/vite";
8
8
 
9
9
  // src/vite/constants.ts
@@ -626,7 +626,7 @@ function renderRouter(routes, options = {
626
626
  writer.writeLines(`// @marko/run/router`);
627
627
  const imports = writer.branch("imports");
628
628
  imports.writeLines(
629
- `import { NotHandled, NotMatched, createInput } from 'virtual:marko-run/internal';`
629
+ `import { NotHandled, NotMatched, createContext } from 'virtual:marko-run/internal';`
630
630
  );
631
631
  for (const route of routes.list) {
632
632
  const verbs = getVerbs(route);
@@ -643,7 +643,17 @@ function renderRouter(routes, options = {
643
643
  `import page${key} from '${virtualFilePrefix}/${markoRunFilePrefix}special__${key}.marko${serverEntryQuery}';`
644
644
  );
645
645
  }
646
- writer.writeLines(``).writeBlockStart(`export function match(method, pathname) {`).writeLines(
646
+ writer.writeLines(
647
+ `
648
+ const page404ResponseInit = {
649
+ status: 404,
650
+ headers: { "content-type": "text/html;charset=UTF-8" },
651
+ };
652
+ const page500ResponseInit = {
653
+ status: 404,
654
+ headers: { "content-type": "text/html;charset=UTF-8" },
655
+ };`
656
+ ).writeBlockStart(`export function match(method, pathname) {`).writeLines(
647
657
  `if (!pathname) {
648
658
  pathname = '/';
649
659
  } else if (pathname.charAt(0) !== '/') {
@@ -661,17 +671,10 @@ function renderRouter(routes, options = {
661
671
  }
662
672
  writer.writeBlockEnd("}").writeLines("return null;").writeBlockEnd("}");
663
673
  writer.write(`
664
- export async function invoke(route, request, platform, url = new URL(request.url)) {
665
- const context = {
666
- url,
667
- request,
668
- platform
669
- };
670
- const buildInput = createInput(context);
674
+ export async function invoke(route, request, platform, url) {
675
+ const [context, buildInput] = createContext(route, request, platform, url);
671
676
  try {
672
677
  if (route) {
673
- context.params = route.params;
674
- context.meta = route.meta;
675
678
  try {
676
679
  const response = await route.handler(context, buildInput);
677
680
  if (response) return response;
@@ -686,14 +689,9 @@ export async function invoke(route, request, platform, url = new URL(request.url
686
689
  if (routes.special[RoutableFileTypes.NotFound]) {
687
690
  writer.write(
688
691
  ` } else {
689
- context.params = {};
690
- context.meta = {};
691
692
  }
692
693
  if (context.request.headers.get('Accept')?.includes('text/html')) {
693
- return new Response(page404.stream(buildInput()), {
694
- status: 404,
695
- headers: { "content-type": "text/html;charset=UTF-8" },
696
- });
694
+ return new Response(page404.stream(buildInput()), page404ResponseInit);
697
695
  }
698
696
  `
699
697
  );
@@ -705,13 +703,8 @@ export async function invoke(route, request, platform, url = new URL(request.url
705
703
  if (routes.special[RoutableFileTypes.Error]) {
706
704
  writer.writeBlockStart(
707
705
  `if (context.request.headers.get('Accept')?.includes('text/html')) {`
708
- ).writeBlock(
709
- `return new Response(page500.stream(buildInput({ error })), {`,
710
- [
711
- `status: 500,`,
712
- `headers: { "content-type": "text/html;charset=UTF-8" },`
713
- ],
714
- `});`
706
+ ).writeLines(
707
+ `return new Response(page500.stream(buildInput({ error })), page500ResponseInit);`
715
708
  ).writeBlockEnd("}");
716
709
  }
717
710
  writer.writeLines(`throw error;`).writeBlockEnd("}").writeBlockEnd("}").write(`
@@ -947,8 +940,8 @@ function stripTsExtension(path3) {
947
940
  }
948
941
  return path3;
949
942
  }
950
- function renderRouteTypeInfo(routes, pathPrefix = ".", adapterTypes = "") {
951
- var _a, _b;
943
+ async function renderRouteTypeInfo(routes, pathPrefix = ".", adapter) {
944
+ var _a, _b, _c, _d;
952
945
  const writer = createStringWriter();
953
946
  writer.writeLines(
954
947
  `/*
@@ -956,28 +949,25 @@ function renderRouteTypeInfo(routes, pathPrefix = ".", adapterTypes = "") {
956
949
  Do NOT manually edit this file or your changes will be lost.
957
950
  */
958
951
  `,
959
- `import type { HandlerLike, Route as AnyRoute, Context as AnyContext, ValidatePath, ValidateHref } from "@marko/run";`,
960
- adapterTypes,
961
- `
962
-
963
- declare global {
964
- namespace MarkoRun {`
952
+ `import type { HandlerLike, Route as AnyRoute, Context as AnyContext, ParamsObject, ValidatePath, ValidateHref } from "@marko/run";`
965
953
  );
966
- const pathsWriter = writer.branch("paths");
967
- writer.write(`
968
- type GetablePath<T extends string> = ValidatePath<GetPaths, T>;
969
- type GetableHref<T extends string> = ValidateHref<GetPaths, T>;
970
- type PostablePath<T extends string> = ValidatePath<PostPaths, T>;
971
- type PostableHref<T extends string> = ValidateHref<PostPaths, T>;
954
+ let platformType = "unknown";
955
+ if (adapter && adapter.typeInfo) {
956
+ platformType = await adapter.typeInfo((data) => writer.write(data));
957
+ writer.writeLines("");
972
958
  }
973
- }
959
+ writer.writeLines(`
960
+ interface NoParams extends ParamsObject {}
961
+ interface NoMeta {}
974
962
  `);
963
+ const pathsWriter = writer.branch("paths");
975
964
  const routesWriter = writer.branch("types");
976
965
  const serverWriter = writer.branch("server");
977
966
  const middlewareRouteTypes = /* @__PURE__ */ new Map();
978
967
  const layoutRouteTypes = /* @__PURE__ */ new Map();
979
968
  const getPaths = /* @__PURE__ */ new Set();
980
969
  const postPaths = /* @__PURE__ */ new Set();
970
+ writeModuleDeclaration(serverWriter, void 0, void 0, platformType);
981
971
  for (const route of routes.list) {
982
972
  const { meta, handler, params, middleware, page, layouts } = route;
983
973
  const routeType = `Route${route.index}`;
@@ -985,8 +975,8 @@ declare global {
985
975
  /\/\$(\$?)([^\/]*)/,
986
976
  (_, catchAll, name) => catchAll ? `/:${name || "rest"}*` : `/:${name}`
987
977
  )}\``;
988
- const paramsType = params ? renderParamsInfoType(params) : "{}";
989
- let metaType = "undefined";
978
+ const paramsType = (params == null ? void 0 : params.length) ? renderParamsInfoType(params) : "NoParams";
979
+ let metaType = "NoMeta";
990
980
  if (page || handler) {
991
981
  const isGet = page || ((_a = handler == null ? void 0 : handler.verbs) == null ? void 0 : _a.includes("get"));
992
982
  const isPost = (_b = handler == null ? void 0 : handler.verbs) == null ? void 0 : _b.includes("post");
@@ -1006,31 +996,31 @@ declare global {
1006
996
  }
1007
997
  }
1008
998
  if (meta) {
1009
- metaType = `typeof import('${pathPrefix}/${stripTsExtension(
1010
- meta.relativePath
1011
- )}')`;
999
+ const path3 = stripTsExtension(`${pathPrefix}/${meta.relativePath}`);
1000
+ metaType = `typeof import('${path3}')`;
1012
1001
  if (/\.(ts|js|mjs)$/.test(meta.relativePath)) {
1013
1002
  metaType += `['default']`;
1014
1003
  }
1015
1004
  }
1016
1005
  if (handler) {
1017
- writeRouteTypeModule(
1006
+ writeModuleDeclaration(
1018
1007
  serverWriter,
1019
- pathPrefix,
1020
- handler.relativePath,
1021
- routeType
1008
+ `${pathPrefix}/${handler.relativePath}`,
1009
+ routeType,
1010
+ platformType
1022
1011
  );
1023
1012
  }
1024
1013
  if (page) {
1025
- writer.writeLines(`
1026
- declare module '${pathPrefix}/${page.relativePath}' {
1027
- export interface Input {}
1028
-
1029
- namespace MarkoRun {
1030
- type Route = ${routeType};
1031
- type Context = AnyContext<AnyContext['platform'], Route>;
1032
- }
1033
- }`);
1014
+ writeModuleDeclaration(
1015
+ writer,
1016
+ `${pathPrefix}/${page.relativePath}`,
1017
+ routeType,
1018
+ platformType,
1019
+ `
1020
+ export interface Input {
1021
+ renderBody: Marko.Body;
1022
+ }`
1023
+ );
1034
1024
  }
1035
1025
  if (middleware) {
1036
1026
  let i = 0;
@@ -1060,74 +1050,106 @@ declare module '${pathPrefix}/${page.relativePath}' {
1060
1050
  }
1061
1051
  }
1062
1052
  routesWriter.writeLines(
1063
- `interface ${routeType} extends AnyRoute<${paramsType}, ${metaType}, ${pathType}> {}`
1053
+ `type ${routeType} = AnyRoute<${paramsType}, ${metaType}, ${pathType}>;`
1064
1054
  );
1065
1055
  }
1066
- pathsWriter.write(" type GetPaths =");
1067
- for (const path3 of getPaths) {
1068
- pathsWriter.write(`
1069
- | '${path3}'`);
1056
+ pathsWriter.write(`type Get =`);
1057
+ if (getPaths.size) {
1058
+ for (const path3 of getPaths) {
1059
+ pathsWriter.write(`
1060
+ | '${path3}'`);
1061
+ }
1062
+ } else {
1063
+ pathsWriter.write(" never");
1070
1064
  }
1071
1065
  pathsWriter.writeLines(";", "");
1072
- pathsWriter.write(" type PostPaths =");
1073
- for (const path3 of postPaths) {
1074
- pathsWriter.write(`
1075
- | '${path3}'`);
1066
+ pathsWriter.write("type Post =");
1067
+ if (postPaths.size) {
1068
+ for (const path3 of postPaths) {
1069
+ pathsWriter.write(`
1070
+ | '${path3}'`);
1071
+ }
1072
+ } else {
1073
+ pathsWriter.write(" never");
1076
1074
  }
1077
- pathsWriter.writeLines(";");
1075
+ pathsWriter.writeLines(";", "");
1078
1076
  pathsWriter.join();
1079
1077
  for (const [file, { routeTypes }] of middlewareRouteTypes) {
1080
- writeRouteTypeModule(
1078
+ writeModuleDeclaration(
1081
1079
  serverWriter,
1082
- pathPrefix,
1083
- file.relativePath,
1084
- routeTypes.join(" | ")
1080
+ `${pathPrefix}/${file.relativePath}`,
1081
+ routeTypes.join(" | "),
1082
+ platformType
1085
1083
  );
1086
1084
  }
1087
1085
  for (const [file, { routeTypes }] of layoutRouteTypes) {
1088
- writer.writeLines(`
1089
- declare module '${pathPrefix}/${file.relativePath}' {
1086
+ writeModuleDeclaration(
1087
+ writer,
1088
+ `${pathPrefix}/${file.relativePath}`,
1089
+ routeTypes.join(" | "),
1090
+ platformType,
1091
+ `
1090
1092
  export interface Input {
1091
1093
  renderBody: Marko.Body;
1094
+ }`
1095
+ );
1092
1096
  }
1093
-
1094
- namespace MarkoRun {
1095
- type Route = ${routeTypes.join(" | ")};
1096
- type Context = AnyContext<AnyContext['platform'], Route>;
1097
- }
1098
- }`);
1097
+ if ((_c = routes.special["404"]) == null ? void 0 : _c.page) {
1098
+ writeModuleDeclaration(
1099
+ writer,
1100
+ `${pathPrefix}/${routes.special["404"].page.relativePath}`,
1101
+ void 0,
1102
+ platformType,
1103
+ `
1104
+ export interface Input {}`
1105
+ );
1099
1106
  }
1100
- for (const route of [routes.special["404"], routes.special["500"]]) {
1101
- if (route && route.page) {
1102
- writer.write(`
1103
- declare module '${pathPrefix}/${route.page.relativePath}' {
1104
- export interface Input {`);
1105
- if (route.page.type === RoutableFileTypes.Error) {
1106
- writer.write(`
1107
+ if ((_d = routes.special["500"]) == null ? void 0 : _d.page) {
1108
+ writeModuleDeclaration(
1109
+ writer,
1110
+ `${pathPrefix}/${routes.special["500"].page.relativePath}`,
1111
+ void 0,
1112
+ platformType,
1113
+ `
1114
+ export interface Input {
1107
1115
  error: unknown;
1108
- `);
1109
- }
1110
- writer.writeLines(`}
1111
-
1112
- namespace MarkoRun {
1113
- type Route = AnyRoute;
1114
- type Context = AnyContext<AnyContext['platform'], Route>;
1115
- }
1116
- }`);
1117
- }
1116
+ }`
1117
+ );
1118
1118
  }
1119
1119
  serverWriter.join();
1120
1120
  return writer.end();
1121
1121
  }
1122
- function writeRouteTypeModule(writer, pathPrefix, path3, routeType) {
1123
- writer.writeLines(`
1124
- declare module '${pathPrefix}/${stripTsExtension(path3)}' {
1122
+ function writeModuleDeclaration(writer, path3 = "global", routeType = "AnyRoute", platformType = "unknown", moduleTypes) {
1123
+ writer.writeLines("");
1124
+ if (path3 === "global") {
1125
+ writer.write("declare global {");
1126
+ } else {
1127
+ writer.write(`declare module '${stripTsExtension(path3)}' {`);
1128
+ }
1129
+ if (moduleTypes) {
1130
+ writer.writeLines(moduleTypes);
1131
+ }
1132
+ const isMarko = path3.endsWith(".marko");
1133
+ writer.write(`
1125
1134
  namespace MarkoRun {
1135
+ type GetPaths = Get;
1136
+ type PostPaths = Post;
1137
+ type GetablePath<T extends string> = ValidatePath<Get, T>;
1138
+ type GetableHref<T extends string> = ValidateHref<Get, T>;
1139
+ type PostablePath<T extends string> = ValidatePath<Post, T>;
1140
+ type PostableHref<T extends string> = ValidateHref<Post, T>;
1141
+ type Platform = ${platformType};`);
1142
+ if (path3 !== "global") {
1143
+ writer.write(`
1126
1144
  type Route = ${routeType};
1127
- type Context = AnyContext<AnyContext['platform'], Route>;
1145
+ type Context = AnyContext<Platform, Route>${isMarko ? " & Marko.Global" : ""};
1128
1146
  type Handler<_Params = Route['params'], _Meta = Route['meta']> = HandlerLike<Route>;
1129
1147
  function route(handler: Handler): typeof handler;
1130
1148
  function route<_Params = Route['params'], _Meta = Route['meta']>(handler: Handler): typeof handler;
1149
+ const NotHandled: unique symbol;
1150
+ const NotMatched: unique symbol;`);
1151
+ }
1152
+ writer.writeLines(`
1131
1153
  }
1132
1154
  }`);
1133
1155
  }
@@ -1325,8 +1347,9 @@ var normalizePath = path2.sep === WINDOWS_SEP ? (id) => id.replace(/\\/g, POSIX_
1325
1347
  function isMarkoFile(id) {
1326
1348
  return id.endsWith(markoExt);
1327
1349
  }
1328
- function markoServe(opts = {}) {
1329
- const { routesDir = "src/routes", adapter, ...markoOptions } = opts;
1350
+ function markoRun(opts = {}) {
1351
+ let { routesDir = "src/routes", adapter, ...markoOptions } = opts;
1352
+ let compiler;
1330
1353
  let store;
1331
1354
  let root;
1332
1355
  let resolvedRoutesDir;
@@ -1357,8 +1380,11 @@ function markoServe(opts = {}) {
1357
1380
  "{.tsconfig*,tsconfig*.json}"
1358
1381
  ))) {
1359
1382
  const filepath = path2.join(typesDir, "routes.d.ts");
1360
- const adapterTypeInfo = (adapter == null ? void 0 : adapter.writeTypeInfo) && await (adapter == null ? void 0 : adapter.writeTypeInfo());
1361
- const data = renderRouteTypeInfo(routes, path2.relative(typesDir, routesDir), adapterTypeInfo);
1383
+ const data = await renderRouteTypeInfo(
1384
+ routes,
1385
+ path2.relative(typesDir, routesDir),
1386
+ adapter
1387
+ );
1362
1388
  if (data !== typesFile || !fs2.existsSync(filepath)) {
1363
1389
  await ensureDir(typesDir);
1364
1390
  await fs2.promises.writeFile(filepath, typesFile = data);
@@ -1371,13 +1397,16 @@ function markoServe(opts = {}) {
1371
1397
  route.handler.verbs = await extractVerbs(route.handler.filePath);
1372
1398
  if (!route.handler.verbs.length) {
1373
1399
  console.warn(
1374
- `Did not find any valid exports in middleware entry file:'${route.handler.filePath}' - expected to find any of 'get', 'post', 'put' or 'del'`
1400
+ `Did not find any valid exports in middleware entry file:'${route.handler.filePath}' - expected to find any of 'GET', 'POST', 'PUT' or 'DELETE'`
1375
1401
  );
1376
1402
  }
1377
1403
  }
1378
1404
  if (route.page) {
1379
1405
  virtualFiles.set(
1380
- path2.posix.join(root, `${markoRunFilePrefix}route__${route.key}.marko`),
1406
+ path2.posix.join(
1407
+ root,
1408
+ `${markoRunFilePrefix}route__${route.key}.marko`
1409
+ ),
1381
1410
  render ? renderRouteTemplate(route) : ""
1382
1411
  );
1383
1412
  }
@@ -1388,7 +1417,10 @@ function markoServe(opts = {}) {
1388
1417
  }
1389
1418
  for (const route of Object.values(routes.special)) {
1390
1419
  virtualFiles.set(
1391
- path2.posix.join(root, `${markoRunFilePrefix}special__${route.key}.marko`),
1420
+ path2.posix.join(
1421
+ root,
1422
+ `${markoRunFilePrefix}special__${route.key}.marko`
1423
+ ),
1392
1424
  render ? renderRouteTemplate(route) : ""
1393
1425
  );
1394
1426
  }
@@ -1428,22 +1460,32 @@ function markoServe(opts = {}) {
1428
1460
  if (externalPluginOptions) {
1429
1461
  opts = mergeConfig(opts, externalPluginOptions);
1430
1462
  }
1463
+ root = normalizePath(config2.root || process.cwd());
1464
+ isBuild = env.command === "build";
1465
+ isSSRBuild = isBuild && Boolean((_a = config2.build) == null ? void 0 : _a.ssr);
1466
+ adapter = await resolveAdapter(root, opts, config2.logLevel !== "silent" && !isBuild || isSSRBuild);
1431
1467
  if (adapter) {
1432
1468
  const externalAdapterConfig = getExternalAdapterOptions(config2);
1433
1469
  if (externalAdapterConfig && adapter.configure) {
1434
1470
  adapter.configure(externalAdapterConfig);
1435
1471
  }
1436
- const adapterOptions = await ((_a = adapter.pluginOptions) == null ? void 0 : _a.call(adapter, opts));
1472
+ const adapterOptions = await ((_b = adapter.pluginOptions) == null ? void 0 : _b.call(adapter, opts));
1437
1473
  if (adapterOptions) {
1438
1474
  opts = mergeConfig(opts, adapterOptions);
1439
1475
  }
1440
1476
  }
1441
- root = normalizePath(config2.root || process.cwd());
1477
+ compiler ?? (compiler = await import(opts.compiler || "@marko/compiler"));
1478
+ compiler.taglib.register("@marko/run", {
1479
+ "<*>": {
1480
+ template: path2.resolve(
1481
+ __dirname,
1482
+ "../components/src-attributes-transformer.cjs"
1483
+ )
1484
+ }
1485
+ });
1442
1486
  store = opts.store || new FileStore(
1443
1487
  `marko-serve-vite-${crypto.createHash("SHA1").update(root).digest("hex")}`
1444
1488
  );
1445
- isBuild = env.command === "build";
1446
- isSSRBuild = isBuild && Boolean((_b = config2.build) == null ? void 0 : _b.ssr);
1447
1489
  resolvedRoutesDir = path2.resolve(root, routesDir);
1448
1490
  typesDir = path2.join(root, ".marko-run");
1449
1491
  devEntryFile = path2.join(root, "index.html");
@@ -1685,6 +1727,31 @@ async function ensureDir(dir) {
1685
1727
  await fs2.promises.mkdir(dir, { recursive: true });
1686
1728
  }
1687
1729
  }
1730
+ async function resolveAdapter(root, options, log) {
1731
+ const { adapter } = options;
1732
+ if (adapter !== void 0) {
1733
+ return adapter;
1734
+ }
1735
+ const pkg = resolvePackageData(".", root);
1736
+ if (pkg) {
1737
+ const dependecies = { ...pkg.data.dependecies, ...pkg.data.devDependencies };
1738
+ for (const name of Object.keys(dependecies)) {
1739
+ if (name.startsWith("@marko/run-adapter") || name.indexOf("marko-run-adapter") !== -1) {
1740
+ try {
1741
+ const module2 = await import(name);
1742
+ log && console.log(`Using adapter ${name} listed in your package.json dependecies`);
1743
+ return module2.default();
1744
+ } catch (err) {
1745
+ log && console.warn(`Attempt to use package '${name}' failed`, err);
1746
+ }
1747
+ }
1748
+ }
1749
+ }
1750
+ const defaultAdapter = "@marko/run/adapter";
1751
+ const module = await import(defaultAdapter);
1752
+ log && console.log("Using default adapter");
1753
+ return module.default();
1754
+ }
1688
1755
 
1689
1756
  // src/vite/utils/server.ts
1690
1757
  import net from "net";
@@ -1756,7 +1823,7 @@ function sleep(ms) {
1756
1823
  return new Promise((resolve) => setTimeout(resolve, ms));
1757
1824
  }
1758
1825
  export {
1759
- markoServe as default,
1826
+ markoRun as default,
1760
1827
  getAvailablePort,
1761
1828
  isPortInUse,
1762
1829
  loadEnv,
@@ -1,3 +1,4 @@
1
1
  import type { Plugin } from "vite";
2
- import type { Options } from "./types";
3
- export default function markoServe(opts?: Options): Plugin[];
2
+ import type { Options, Adapter } from "./types";
3
+ export default function markoRun(opts?: Options): Plugin[];
4
+ export declare function resolveAdapter(root: string, options: Options, log?: boolean): Promise<Adapter | null>;
@@ -8,7 +8,7 @@ export interface WalkOptions {
8
8
  onEnter?: (dir: WalkEntry) => (() => void) | false | void;
9
9
  maxDepth?: number;
10
10
  }
11
- export declare type Walker = (options: WalkOptions) => Promise<void>;
11
+ export type Walker = (options: WalkOptions) => Promise<void>;
12
12
  export declare function createFSWalker(dir: string): Walker;
13
- export declare type TestFileTree = [string, (string | TestFileTree)[]];
13
+ export type TestFileTree = [string, (string | TestFileTree)[]];
14
14
  export declare function createTestWalker(dir: TestFileTree): Walker;
@@ -2,7 +2,7 @@ import type { RoutableFileType, HttpVerb, RoutableFileTypes } from "./constants"
2
2
  import type { Options as MarkoViteOptions } from "@marko/vite";
3
3
  import type { ResolvedConfig, UserConfig } from "vite";
4
4
  export type { RoutableFileType, HttpVerb };
5
- export declare type StartServer = (port?: number) => Promise<void>;
5
+ export type StartServer = (port?: number) => Promise<void>;
6
6
  export interface AdapterConfig {
7
7
  [name: PropertyKey]: any;
8
8
  }
@@ -15,7 +15,7 @@ export interface Adapter {
15
15
  startDev?(configFile: string, port: number, envFile?: string): Promise<void> | void;
16
16
  startPreview?(dir: string, entry?: string, port?: number, envFile?: string): Promise<void> | void;
17
17
  buildEnd?(config: ResolvedConfig, routes: Route[], builtEntries: string[], sourceEntries: string[]): Promise<void> | void;
18
- writeTypeInfo?(): Promise<string> | string;
18
+ typeInfo?(writer: (data: string) => void): Promise<string> | string;
19
19
  }
20
20
  export interface RouterOptions {
21
21
  trailingSlashes: 'Ignore' | 'RedirectWithout' | 'RedirectWith' | 'RewriteWithout' | 'RewriteWith';
@@ -23,9 +23,9 @@ export interface RouterOptions {
23
23
  export interface MarkoServeOptions extends Partial<RouterOptions> {
24
24
  routesDir?: string;
25
25
  emitRoutes?(routes: Route[]): void | Promise<void>;
26
- adapter?: Adapter;
26
+ adapter?: Adapter | null;
27
27
  }
28
- export declare type Options = MarkoServeOptions & MarkoViteOptions;
28
+ export type Options = MarkoServeOptions & MarkoViteOptions;
29
29
  export interface Route {
30
30
  key: string;
31
31
  index: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/run",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "The Marko application framework.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/marko-js/run/tree/main/packages/run",
@@ -108,7 +108,9 @@
108
108
  "kleur": "^4.1.5",
109
109
  "sade": "^1.8.1",
110
110
  "serve-static": "^1.15.0",
111
+ "strip-ansi": "^7.0.1",
111
112
  "undici": "^5.20.0",
112
- "vite": "^4.1.4"
113
+ "vite": "^4.1.4",
114
+ "warp10": "^2.1.0"
113
115
  }
114
116
  }