@marko/run 0.9.6 → 0.10.0

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.
@@ -65,6 +65,7 @@ var import_kleur = __toESM(require("kleur"), 1);
65
65
  var import_supports_color = __toESM(require("supports-color"), 1);
66
66
  function stripAnsi(string) {
67
67
  return string.replace(
68
+ /* cspell:disable-next-line */
68
69
  /([\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><])/g,
69
70
  ""
70
71
  );
@@ -88,7 +89,7 @@ function logInfoBox(address, explorer) {
88
89
  const color = !!import_supports_color.default.stdout;
89
90
  let message = import_kleur.default.bold("Marko Run");
90
91
  if (true) {
91
- message += ` v${"0.9.6"}`;
92
+ message += ` v${"0.10.0"}`;
92
93
  }
93
94
  message += "\n\n";
94
95
  message += import_kleur.default.dim("Server listening at");
@@ -274,7 +275,7 @@ var httpVerbOrder = httpVerbs.reduce(
274
275
  var import_path3 = __toESM(require("path"), 1);
275
276
  var markoFiles = `(${RoutableFileTypes.Layout}|${RoutableFileTypes.Page}|${RoutableFileTypes.NotFound}|${RoutableFileTypes.Error})\\.(?:.*\\.)?(marko)`;
276
277
  var nonMarkoFiles = `(${RoutableFileTypes.Middleware}|${RoutableFileTypes.Handler}|${RoutableFileTypes.Meta})\\.(?:.*\\.)?(.+)`;
277
- var routeableFileRegex = new RegExp(
278
+ var RoutableFileRegex = new RegExp(
278
279
  `[+](?:${markoFiles}|${nonMarkoFiles})$`,
279
280
  "i"
280
281
  );
@@ -344,11 +345,11 @@ async function resolveAdapter(root, options, log) {
344
345
  }
345
346
  const pkg = await getPackageData(root);
346
347
  if (pkg) {
347
- let dependecies = pkg.dependencies ? Object.keys(pkg.dependencies) : [];
348
+ let dependencies = pkg.dependencies ? Object.keys(pkg.dependencies) : [];
348
349
  if (pkg.devDependencies) {
349
- dependecies = dependecies.concat(Object.keys(pkg.devDependencies));
350
+ dependencies = dependencies.concat(Object.keys(pkg.devDependencies));
350
351
  }
351
- for (const name of dependecies) {
352
+ for (const name of dependencies) {
352
353
  if (name.startsWith("@marko/run-adapter") || name.indexOf("marko-run-adapter") !== -1) {
353
354
  try {
354
355
  const module3 = await import(
@@ -356,7 +357,7 @@ async function resolveAdapter(root, options, log) {
356
357
  name
357
358
  );
358
359
  log && debug(
359
- `Using adapter ${name} listed in your package.json dependecies`
360
+ `Using adapter ${name} listed in your package.json dependencies`
360
361
  );
361
362
  return module3.default();
362
363
  } catch (err) {
@@ -501,7 +502,7 @@ async function waitForServer(port, wait = 0) {
501
502
  await sleep(100);
502
503
  } else {
503
504
  throw new Error(
504
- `Timeout while wating for server to start on port "${port}".`
505
+ `Timeout while waiting for server to start on port "${port}".`
505
506
  );
506
507
  }
507
508
  }
@@ -802,12 +803,12 @@ function copyResponseHeaders(response, headers) {
802
803
  response.appendHeader("set-cookie", setCookies);
803
804
  }
804
805
  }
805
- function createMiddleware(fetch, options) {
806
+ function createMiddleware(fetch, options = {}) {
806
807
  const {
807
808
  origin = process.env.ORIGIN,
808
809
  trustProxy = process.env.TRUST_PROXY === "1",
809
810
  createPlatform = (platform) => platform
810
- } = options ?? (options = {});
811
+ } = options;
811
812
  return async (req, res, next) => {
812
813
  var _a, _b, _c;
813
814
  try {
@@ -1063,8 +1064,8 @@ function adapter() {
1063
1064
  port,
1064
1065
  envFile
1065
1066
  );
1066
- nextWorker.on("message", (messsage) => {
1067
- if (messsage === "restart") {
1067
+ nextWorker.on("message", (message) => {
1068
+ if (message === "restart") {
1068
1069
  start();
1069
1070
  }
1070
1071
  }).send({ type: "start", entry, config: config2 });
@@ -1,6 +1,6 @@
1
1
  // src/adapter/index.ts
2
2
  import fs5 from "fs";
3
- import inspector from "inspector";
3
+ import inspector2 from "inspector";
4
4
  import path8 from "path";
5
5
  import { fileURLToPath as fileURLToPath2 } from "url";
6
6
 
@@ -20,9 +20,10 @@ import {
20
20
 
21
21
  // src/adapter/utils.ts
22
22
  import kleur from "kleur";
23
- import supporsColor from "supports-color";
23
+ import supportsColor from "supports-color";
24
24
  function stripAnsi(string) {
25
25
  return string.replace(
26
+ /* cspell:disable-next-line */
26
27
  /([\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><])/g,
27
28
  ""
28
29
  );
@@ -43,10 +44,10 @@ function prepareError(err) {
43
44
  };
44
45
  }
45
46
  function logInfoBox(address, explorer) {
46
- const color = !!supporsColor.stdout;
47
+ const color = !!supportsColor.stdout;
47
48
  let message = kleur.bold("Marko Run");
48
49
  if (true) {
49
- message += ` v${"0.9.6"}`;
50
+ message += ` v${"0.10.0"}`;
50
51
  }
51
52
  message += "\n\n";
52
53
  message += kleur.dim("Server listening at");
@@ -232,7 +233,7 @@ var httpVerbOrder = httpVerbs.reduce(
232
233
  import path3 from "path";
233
234
  var markoFiles = `(${RoutableFileTypes.Layout}|${RoutableFileTypes.Page}|${RoutableFileTypes.NotFound}|${RoutableFileTypes.Error})\\.(?:.*\\.)?(marko)`;
234
235
  var nonMarkoFiles = `(${RoutableFileTypes.Middleware}|${RoutableFileTypes.Handler}|${RoutableFileTypes.Meta})\\.(?:.*\\.)?(.+)`;
235
- var routeableFileRegex = new RegExp(
236
+ var RoutableFileRegex = new RegExp(
236
237
  `[+](?:${markoFiles}|${nonMarkoFiles})$`,
237
238
  "i"
238
239
  );
@@ -302,11 +303,11 @@ async function resolveAdapter(root, options, log) {
302
303
  }
303
304
  const pkg = await getPackageData(root);
304
305
  if (pkg) {
305
- let dependecies = pkg.dependencies ? Object.keys(pkg.dependencies) : [];
306
+ let dependencies = pkg.dependencies ? Object.keys(pkg.dependencies) : [];
306
307
  if (pkg.devDependencies) {
307
- dependecies = dependecies.concat(Object.keys(pkg.devDependencies));
308
+ dependencies = dependencies.concat(Object.keys(pkg.devDependencies));
308
309
  }
309
- for (const name of dependecies) {
310
+ for (const name of dependencies) {
310
311
  if (name.startsWith("@marko/run-adapter") || name.indexOf("marko-run-adapter") !== -1) {
311
312
  try {
312
313
  const module2 = await import(
@@ -314,7 +315,7 @@ async function resolveAdapter(root, options, log) {
314
315
  name
315
316
  );
316
317
  log && debug(
317
- `Using adapter ${name} listed in your package.json dependecies`
318
+ `Using adapter ${name} listed in your package.json dependencies`
318
319
  );
319
320
  return module2.default();
320
321
  } catch (err) {
@@ -459,7 +460,7 @@ async function waitForServer(port, wait = 0) {
459
460
  await sleep(100);
460
461
  } else {
461
462
  throw new Error(
462
- `Timeout while wating for server to start on port "${port}".`
463
+ `Timeout while waiting for server to start on port "${port}".`
463
464
  );
464
465
  }
465
466
  }
@@ -532,9 +533,9 @@ import {
532
533
  // src/adapter/logger.ts
533
534
  import DraftLog from "draftlog";
534
535
  import format2 from "human-format";
535
- import inpspector from "inspector";
536
+ import inspector from "inspector";
536
537
  import kleur3 from "kleur";
537
- if (!inpspector.url()) {
538
+ if (!inspector.url()) {
538
539
  DraftLog.into(console);
539
540
  DraftLog.defaults.canReWrite = false;
540
541
  }
@@ -763,12 +764,12 @@ function copyResponseHeaders(response, headers) {
763
764
  response.appendHeader("set-cookie", setCookies);
764
765
  }
765
766
  }
766
- function createMiddleware(fetch, options) {
767
+ function createMiddleware(fetch, options = {}) {
767
768
  const {
768
769
  origin = process.env.ORIGIN,
769
770
  trustProxy = process.env.TRUST_PROXY === "1",
770
771
  createPlatform = (platform) => platform
771
- } = options ?? (options = {});
772
+ } = options;
772
773
  return async (req, res, next) => {
773
774
  var _a, _b, _c;
774
775
  try {
@@ -1024,8 +1025,8 @@ function adapter() {
1024
1025
  port,
1025
1026
  envFile
1026
1027
  );
1027
- nextWorker.on("message", (messsage) => {
1028
- if (messsage === "restart") {
1028
+ nextWorker.on("message", (message) => {
1029
+ if (message === "restart") {
1029
1030
  start();
1030
1031
  }
1031
1032
  }).send({ type: "start", entry, config: config2 });
@@ -1055,7 +1056,7 @@ function adapter() {
1055
1056
  envFile && await loadEnv(envFile);
1056
1057
  const inspect = getInspectOptions(options.args);
1057
1058
  if (inspect) {
1058
- inspector.open(inspect.port, inspect.host, inspect.wait);
1059
+ inspector2.open(inspect.port, inspect.host, inspect.wait);
1059
1060
  }
1060
1061
  const listenerPromise = new Promise((resolve) => {
1061
1062
  const listener2 = devServer.middlewares.listen(port, () => {
@@ -70,12 +70,12 @@ function copyResponseHeaders(response, headers) {
70
70
  response.appendHeader("set-cookie", setCookies);
71
71
  }
72
72
  }
73
- function createMiddleware(fetch, options) {
73
+ function createMiddleware(fetch, options = {}) {
74
74
  const {
75
75
  origin = process.env.ORIGIN,
76
76
  trustProxy = process.env.TRUST_PROXY === "1",
77
77
  createPlatform = (platform) => platform
78
- } = options ?? (options = {});
78
+ } = options;
79
79
  return async (req, res, next) => {
80
80
  var _a, _b, _c;
81
81
  try {
@@ -38,12 +38,12 @@ function copyResponseHeaders(response, headers) {
38
38
  response.appendHeader("set-cookie", setCookies);
39
39
  }
40
40
  }
41
- function createMiddleware(fetch, options) {
41
+ function createMiddleware(fetch, options = {}) {
42
42
  const {
43
43
  origin = process.env.ORIGIN,
44
44
  trustProxy = process.env.TRUST_PROXY === "1",
45
45
  createPlatform = (platform) => platform
46
- } = options ?? (options = {});
46
+ } = options;
47
47
  return async (req, res, next) => {
48
48
  var _a, _b, _c;
49
49
  try {
@@ -1,6 +1,6 @@
1
- import type { Rollup } from "vite";
2
- type RollupError = Rollup.RollupError;
3
- export declare function prepareError(err: Error | RollupError): {
1
+ import type { Rolldown } from "vite";
2
+ type RolldownError = Rolldown.RolldownError;
3
+ export declare function prepareError(err: Error | RolldownError): {
4
4
  message: string;
5
5
  stack: string;
6
6
  id: string | undefined;
@@ -9,7 +9,7 @@ export declare function prepareError(err: Error | RollupError): {
9
9
  pluginCode: string | undefined;
10
10
  loc: {
11
11
  column: number;
12
- file?: string | undefined;
12
+ file?: string;
13
13
  line: number;
14
14
  } | undefined;
15
15
  };
@@ -21,7 +21,7 @@ import { build as viteBuild, resolveConfig } from "vite";
21
21
 
22
22
  // src/adapter/index.ts
23
23
  import fs5 from "fs";
24
- import inspector from "inspector";
24
+ import inspector2 from "inspector";
25
25
  import path8 from "path";
26
26
  import { fileURLToPath as fileURLToPath2 } from "url";
27
27
 
@@ -41,9 +41,10 @@ import {
41
41
 
42
42
  // src/adapter/utils.ts
43
43
  import kleur from "kleur";
44
- import supporsColor from "supports-color";
44
+ import supportsColor from "supports-color";
45
45
  function stripAnsi(string) {
46
46
  return string.replace(
47
+ /* cspell:disable-next-line */
47
48
  /([\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><])/g,
48
49
  ""
49
50
  );
@@ -438,7 +439,6 @@ function writeRouteEntryHandler(writer, route, verb) {
438
439
  continuations.writeLines(
439
440
  `const ${currentName} = () => context.render(page, {});`
440
441
  );
441
- nextName = currentName;
442
442
  } else {
443
443
  writer.writeLines(`return context.render(page, {});`);
444
444
  hasBody = true;
@@ -1352,12 +1352,12 @@ var VDir = _VDir;
1352
1352
  // src/vite/routes/builder.ts
1353
1353
  var markoFiles = `(${RoutableFileTypes.Layout}|${RoutableFileTypes.Page}|${RoutableFileTypes.NotFound}|${RoutableFileTypes.Error})\\.(?:.*\\.)?(marko)`;
1354
1354
  var nonMarkoFiles = `(${RoutableFileTypes.Middleware}|${RoutableFileTypes.Handler}|${RoutableFileTypes.Meta})\\.(?:.*\\.)?(.+)`;
1355
- var routeableFileRegex = new RegExp(
1355
+ var RoutableFileRegex = new RegExp(
1356
1356
  `[+](?:${markoFiles}|${nonMarkoFiles})$`,
1357
1357
  "i"
1358
1358
  );
1359
1359
  function matchRoutableFile(filename) {
1360
- const match = filename.match(routeableFileRegex);
1360
+ const match = filename.match(RoutableFileRegex);
1361
1361
  return match && (match[1] || match[3]).toLowerCase();
1362
1362
  }
1363
1363
  async function buildRoutes(sources, outDir) {
@@ -1399,7 +1399,7 @@ async function buildRoutes(sources, outDir) {
1399
1399
  },
1400
1400
  onFile(file) {
1401
1401
  const { name } = file;
1402
- const match = name.match(routeableFileRegex);
1402
+ const match = name.match(RoutableFileRegex);
1403
1403
  if (!match) {
1404
1404
  return;
1405
1405
  }
@@ -1819,6 +1819,7 @@ var ReadOncePersistedStore = class {
1819
1819
  constructor(uid) {
1820
1820
  this.uid = uid;
1821
1821
  }
1822
+ uid;
1822
1823
  write(value) {
1823
1824
  values.set(this.uid, value);
1824
1825
  }
@@ -2120,7 +2121,7 @@ function markoRun(opts = {}) {
2120
2121
  }
2121
2122
  },
2122
2123
  async config(config2, env) {
2123
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
2124
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
2124
2125
  const externalPluginOptions = getExternalPluginOptions(config2);
2125
2126
  if (externalPluginOptions) {
2126
2127
  opts = mergeConfig(opts, externalPluginOptions);
@@ -2167,51 +2168,54 @@ function markoRun(opts = {}) {
2167
2168
  devEntryFilePosix = normalizePath(devEntryFile);
2168
2169
  let outDir = ((_e = config2.build) == null ? void 0 : _e.outDir) || "dist";
2169
2170
  const assetsDir = ((_f = config2.build) == null ? void 0 : _f.assetsDir) || "assets";
2170
- let rollupOutputOptions = (_h = (_g = config2.build) == null ? void 0 : _g.rollupOptions) == null ? void 0 : _h.output;
2171
+ let rolldownOutputOptions = (_h = (_g = config2.build) == null ? void 0 : _g.rolldownOptions) == null ? void 0 : _h.output;
2171
2172
  if (isBuild) {
2172
2173
  if (!isSSRBuild) {
2173
2174
  outDir = path6.join(outDir, CLIENT_OUT_DIR);
2174
2175
  }
2175
- rollupOutputOptions = mergeOutputOptions(
2176
+ rolldownOutputOptions = mergeOutputOptions(
2176
2177
  {
2177
- assetFileNames: `${assetsDir}/[name]-[hash].[ext]`,
2178
+ assetFileNames(info) {
2179
+ var _a2;
2180
+ const name = ((_a2 = info.names) == null ? void 0 : _a2[0]) && cleanFileName(info.names[0]);
2181
+ return name ? `${assetsDir}/${name}-[hash].[ext]` : `${assetsDir}/_[hash].[ext]`;
2182
+ },
2178
2183
  entryFileNames(info) {
2179
- return `${assetsDir}/${getEntryFileName(info.name) || "[name]"}-[hash].js`;
2184
+ const raw = getEntryFileName(info.name) || info.name;
2185
+ const name = raw && cleanFileName(raw);
2186
+ return name ? `${assetsDir}/${name}-[hash].js` : `${assetsDir}/_[hash].js`;
2180
2187
  },
2181
2188
  chunkFileNames: isSSRBuild ? `_[hash].js` : `${assetsDir}/_[hash].js`
2182
2189
  },
2183
- rollupOutputOptions
2190
+ rolldownOutputOptions
2184
2191
  );
2185
2192
  }
2186
- const browserslistTarget = isBuild && !((_i = config2.build) == null ? void 0 : _i.target) ? browserslist(void 0, {
2187
- path: root
2188
- }) : void 0;
2189
- shouldEmptyOutDir = ((_j = config2.build) == null ? void 0 : _j.emptyOutDir) ?? true;
2190
- const pluginConfig = await ((_k = adapter == null ? void 0 : adapter.viteConfig) == null ? void 0 : _k.call(adapter, config2)) || {};
2193
+ shouldEmptyOutDir = ((_i = config2.build) == null ? void 0 : _i.emptyOutDir) ?? true;
2194
+ const pluginConfig = await ((_j = adapter == null ? void 0 : adapter.viteConfig) == null ? void 0 : _j.call(adapter, config2)) || {};
2191
2195
  pluginConfig.ssr ?? (pluginConfig.ssr = {});
2192
- (_l = pluginConfig.ssr).noExternal ?? (_l.noExternal = /@marko\/run($|\/)/);
2196
+ (_k = pluginConfig.ssr).noExternal ?? (_k.noExternal = /@marko\/run($|\/)/);
2193
2197
  pluginConfig.css ?? (pluginConfig.css = {});
2194
- (_m = pluginConfig.css).devSourcemap ?? (_m.devSourcemap = true);
2198
+ (_l = pluginConfig.css).devSourcemap ?? (_l.devSourcemap = true);
2195
2199
  pluginConfig.build ?? (pluginConfig.build = {});
2196
- (_n = pluginConfig.build).outDir ?? (_n.outDir = outDir);
2197
- (_o = pluginConfig.build).assetsDir ?? (_o.assetsDir = assetsDir);
2198
- (_p = pluginConfig.build).copyPublicDir ?? (_p.copyPublicDir = !isSSRBuild);
2199
- (_q = pluginConfig.build).ssrEmitAssets ?? (_q.ssrEmitAssets = false);
2200
- (_r = pluginConfig.build).emptyOutDir ?? (_r.emptyOutDir = false);
2201
- (_s = pluginConfig.build).rollupOptions ?? (_s.rollupOptions = {});
2202
- if (rollupOutputOptions) {
2203
- pluginConfig.build.rollupOptions.output = mergeOutputOptions(
2204
- rollupOutputOptions,
2205
- pluginConfig.build.rollupOptions.output
2200
+ (_m = pluginConfig.build).outDir ?? (_m.outDir = outDir);
2201
+ (_n = pluginConfig.build).assetsDir ?? (_n.assetsDir = assetsDir);
2202
+ (_o = pluginConfig.build).copyPublicDir ?? (_o.copyPublicDir = !isSSRBuild);
2203
+ (_p = pluginConfig.build).ssrEmitAssets ?? (_p.ssrEmitAssets = false);
2204
+ (_q = pluginConfig.build).emptyOutDir ?? (_q.emptyOutDir = false);
2205
+ (_r = pluginConfig.build).rolldownOptions ?? (_r.rolldownOptions = {});
2206
+ if (rolldownOutputOptions) {
2207
+ pluginConfig.build.rolldownOptions.output = mergeOutputOptions(
2208
+ rolldownOutputOptions,
2209
+ pluginConfig.build.rolldownOptions.output
2206
2210
  );
2207
2211
  }
2208
- (_u = pluginConfig.build).sourcemap ?? (_u.sourcemap = ((_t = config2.build) == null ? void 0 : _t.sourcemap) ?? (isBuild && !isSSRBuild));
2209
- (_v = pluginConfig.build).modulePreload ?? (_v.modulePreload = {});
2212
+ (_t = pluginConfig.build).sourcemap ?? (_t.sourcemap = ((_s = config2.build) == null ? void 0 : _s.sourcemap) ?? (isBuild && !isSSRBuild));
2213
+ (_u = pluginConfig.build).modulePreload ?? (_u.modulePreload = {});
2210
2214
  if (typeof pluginConfig.build.modulePreload !== "boolean") {
2211
2215
  pluginConfig.build.modulePreload.polyfill = false;
2212
2216
  }
2213
2217
  pluginConfig.optimizeDeps ?? (pluginConfig.optimizeDeps = {});
2214
- if (!((_w = config2.optimizeDeps) == null ? void 0 : _w.entries)) {
2218
+ if (!((_v = config2.optimizeDeps) == null ? void 0 : _v.entries)) {
2215
2219
  pluginConfig.optimizeDeps.entries = [
2216
2220
  `${normalizePath(path6.relative(root, routesDir))}/**/*+{page,layout}.marko`,
2217
2221
  "!**/__snapshots__/**",
@@ -2219,21 +2223,16 @@ function markoRun(opts = {}) {
2219
2223
  "!**/coverage/**"
2220
2224
  ];
2221
2225
  }
2222
- if (browserslistTarget == null ? void 0 : browserslistTarget.length) {
2223
- (_x = pluginConfig.build).target ?? (_x.target = resolveToEsbuildTarget(
2224
- browserslistTarget,
2225
- {
2226
- printUnknownTargets: false
2227
- }
2228
- ));
2226
+ if (isBuild && !((_w = config2.build) == null ? void 0 : _w.target)) {
2227
+ pluginConfig.build.target = getBrowserslistTargets(root);
2229
2228
  }
2230
2229
  if (isBuild) {
2231
2230
  pluginConfig.logLevel ?? (pluginConfig.logLevel = "warn");
2232
2231
  pluginConfig.define ?? (pluginConfig.define = {});
2233
- (_y = pluginConfig.define)["process.env.NODE_ENV"] ?? (_y["process.env.NODE_ENV"] = "'production'");
2232
+ (_x = pluginConfig.define)["process.env.NODE_ENV"] ?? (_x["process.env.NODE_ENV"] = "'production'");
2234
2233
  pluginConfig.resolve ?? (pluginConfig.resolve = {});
2235
- (_z = pluginConfig.resolve).mainFields ?? (_z.mainFields = (isSSRBuild ? [] : ["browser"]).concat(["module", "jsnext:main", "jsnext", "main"]));
2236
- (_A = pluginConfig.resolve).conditions ?? (_A.conditions = [
2234
+ (_y = pluginConfig.resolve).mainFields ?? (_y.mainFields = (isSSRBuild ? [] : ["browser"]).concat(["module", "jsnext:main", "jsnext", "main"]));
2235
+ (_z = pluginConfig.resolve).conditions ?? (_z.conditions = [
2237
2236
  isSSRBuild ? "node" : "browser",
2238
2237
  "import",
2239
2238
  "require",
@@ -2247,7 +2246,7 @@ function markoRun(opts = {}) {
2247
2246
  resolvedConfig = config2;
2248
2247
  const {
2249
2248
  ssr,
2250
- rollupOptions: { input }
2249
+ rolldownOptions: { input }
2251
2250
  } = config2.build;
2252
2251
  if (typeof ssr === "string") {
2253
2252
  ssrEntryFiles = [ssr];
@@ -2458,11 +2457,11 @@ async function resolveAdapter(root, options, log) {
2458
2457
  }
2459
2458
  const pkg = await getPackageData(root);
2460
2459
  if (pkg) {
2461
- let dependecies = pkg.dependencies ? Object.keys(pkg.dependencies) : [];
2460
+ let dependencies = pkg.dependencies ? Object.keys(pkg.dependencies) : [];
2462
2461
  if (pkg.devDependencies) {
2463
- dependecies = dependecies.concat(Object.keys(pkg.devDependencies));
2462
+ dependencies = dependencies.concat(Object.keys(pkg.devDependencies));
2464
2463
  }
2465
- for (const name of dependecies) {
2464
+ for (const name of dependencies) {
2466
2465
  if (name.startsWith("@marko/run-adapter") || name.indexOf("marko-run-adapter") !== -1) {
2467
2466
  try {
2468
2467
  const module2 = await import(
@@ -2470,7 +2469,7 @@ async function resolveAdapter(root, options, log) {
2470
2469
  name
2471
2470
  );
2472
2471
  log && debug(
2473
- `Using adapter ${name} listed in your package.json dependecies`
2472
+ `Using adapter ${name} listed in your package.json dependencies`
2474
2473
  );
2475
2474
  return module2.default();
2476
2475
  } catch (err) {
@@ -2492,6 +2491,9 @@ function getEntryFileName(file) {
2492
2491
  const match = file && markoEntryFileRegex.exec(file);
2493
2492
  return match ? match[1] : void 0;
2494
2493
  }
2494
+ function cleanFileName(name) {
2495
+ return name.replace(/\.[^/.]+$/, "").replace(/[^a-zA-Z0-9._[\]-]+/g, "-").replace(/-{2,}/g, "-").replace(/^-|-$/g, "");
2496
+ }
2495
2497
  function getPlugin(config2) {
2496
2498
  return config2.plugins.find(
2497
2499
  (plugin) => plugin.name === `${PLUGIN_NAME_PREFIX}:pre`
@@ -2524,6 +2526,33 @@ var defaultConfigPlugin = {
2524
2526
  };
2525
2527
  }
2526
2528
  };
2529
+ function getBrowserslistTargets(path10) {
2530
+ var _a;
2531
+ const browserslistTarget = browserslist(void 0, { path: path10 });
2532
+ if (browserslistTarget.length) {
2533
+ const versions = /* @__PURE__ */ new Map();
2534
+ for (const target of resolveToEsbuildTarget(browserslistTarget, {
2535
+ printUnknownTargets: false
2536
+ })) {
2537
+ const index = (_a = /\d/.exec(target)) == null ? void 0 : _a.index;
2538
+ if (index) {
2539
+ const browser = target.slice(0, index);
2540
+ const version = Number(target.slice(index));
2541
+ const existingVersion = versions.get(browser);
2542
+ if (!existingVersion || version < existingVersion) {
2543
+ versions.set(browser, version);
2544
+ }
2545
+ }
2546
+ }
2547
+ if (versions.size) {
2548
+ const targets = [];
2549
+ for (const [browser, version] of versions) {
2550
+ targets.push(browser + version);
2551
+ }
2552
+ return targets;
2553
+ }
2554
+ }
2555
+ }
2527
2556
 
2528
2557
  // src/vite/utils/server.ts
2529
2558
  import cp from "child_process";
@@ -2566,9 +2595,9 @@ import {
2566
2595
  // src/adapter/logger.ts
2567
2596
  import DraftLog from "draftlog";
2568
2597
  import format2 from "human-format";
2569
- import inpspector from "inspector";
2598
+ import inspector from "inspector";
2570
2599
  import kleur3 from "kleur";
2571
- if (!inpspector.url()) {
2600
+ if (!inspector.url()) {
2572
2601
  DraftLog.into(console);
2573
2602
  DraftLog.defaults.canReWrite = false;
2574
2603
  }
@@ -2755,7 +2784,7 @@ async function build(entry, cwd, configFile, outDir, envFile) {
2755
2784
  target: "esnext",
2756
2785
  ...buildConfig.build,
2757
2786
  ssr: entry,
2758
- rollupOptions: {
2787
+ rolldownOptions: {
2759
2788
  output: {
2760
2789
  entryFileNames: "index.mjs"
2761
2790
  // Would rather build with `.js` extension but that will fail in zero-config projects where node runs in cjs mode
@@ -84,10 +84,10 @@ function getMetaDataLookup(data) {
84
84
  }
85
85
 
86
86
  // src/runtime/internal.ts
87
- var NotHandled = Symbol(
87
+ var NotHandled = /* @__PURE__ */ Symbol(
88
88
  "marko-run not handled"
89
89
  );
90
- var NotMatched = Symbol(
90
+ var NotMatched = /* @__PURE__ */ Symbol(
91
91
  "marko-run not matched"
92
92
  );
93
93
  var parentContextLookup = /* @__PURE__ */ new WeakMap();
@@ -154,15 +154,10 @@ function createContext(route, request, platform, url = new URL(request.url)) {
154
154
  serializedGlobals,
155
155
  parent: parentContextLookup.get(request),
156
156
  async fetch(resource, init) {
157
- let request2;
158
- let url2;
159
- if (resource instanceof Request) {
160
- request2 = new Request(resource, init);
161
- url2 = new URL(request2.url);
162
- } else {
163
- url2 = typeof resource === "string" ? new URL(resource, this.url) : resource;
164
- request2 = new Request(url2, init);
165
- }
157
+ const request2 = new Request(
158
+ typeof resource === "string" ? new URL(resource, this.url) : resource,
159
+ init
160
+ );
166
161
  parentContextLookup.set(request2, this);
167
162
  return await globalThis.__marko_run__.fetch(request2, this.platform) || new Response(null, { status: 404 });
168
163
  },
@@ -42,10 +42,10 @@ function getMetaDataLookup(data) {
42
42
  }
43
43
 
44
44
  // src/runtime/internal.ts
45
- var NotHandled = Symbol(
45
+ var NotHandled = /* @__PURE__ */ Symbol(
46
46
  "marko-run not handled"
47
47
  );
48
- var NotMatched = Symbol(
48
+ var NotMatched = /* @__PURE__ */ Symbol(
49
49
  "marko-run not matched"
50
50
  );
51
51
  var parentContextLookup = /* @__PURE__ */ new WeakMap();
@@ -112,15 +112,10 @@ function createContext(route, request, platform, url = new URL(request.url)) {
112
112
  serializedGlobals,
113
113
  parent: parentContextLookup.get(request),
114
114
  async fetch(resource, init) {
115
- let request2;
116
- let url2;
117
- if (resource instanceof Request) {
118
- request2 = new Request(resource, init);
119
- url2 = new URL(request2.url);
120
- } else {
121
- url2 = typeof resource === "string" ? new URL(resource, this.url) : resource;
122
- request2 = new Request(url2, init);
123
- }
115
+ const request2 = new Request(
116
+ typeof resource === "string" ? new URL(resource, this.url) : resource,
117
+ init
118
+ );
124
119
  parentContextLookup.set(request2, this);
125
120
  return await globalThis.__marko_run__.fetch(request2, this.platform) || new Response(null, { status: 404 });
126
121
  },