@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.
@@ -73,6 +73,7 @@ var import_kleur = __toESM(require("kleur"), 1);
73
73
  var import_supports_color = __toESM(require("supports-color"), 1);
74
74
  function stripAnsi(string) {
75
75
  return string.replace(
76
+ /* cspell:disable-next-line */
76
77
  /([\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><])/g,
77
78
  ""
78
79
  );
@@ -467,7 +468,6 @@ function writeRouteEntryHandler(writer, route, verb) {
467
468
  continuations.writeLines(
468
469
  `const ${currentName} = () => context.render(page, {});`
469
470
  );
470
- nextName = currentName;
471
471
  } else {
472
472
  writer.writeLines(`return context.render(page, {});`);
473
473
  hasBody = true;
@@ -1381,12 +1381,12 @@ var VDir = _VDir;
1381
1381
  // src/vite/routes/builder.ts
1382
1382
  var markoFiles = `(${RoutableFileTypes.Layout}|${RoutableFileTypes.Page}|${RoutableFileTypes.NotFound}|${RoutableFileTypes.Error})\\.(?:.*\\.)?(marko)`;
1383
1383
  var nonMarkoFiles = `(${RoutableFileTypes.Middleware}|${RoutableFileTypes.Handler}|${RoutableFileTypes.Meta})\\.(?:.*\\.)?(.+)`;
1384
- var routeableFileRegex = new RegExp(
1384
+ var RoutableFileRegex = new RegExp(
1385
1385
  `[+](?:${markoFiles}|${nonMarkoFiles})$`,
1386
1386
  "i"
1387
1387
  );
1388
1388
  function matchRoutableFile(filename) {
1389
- const match = filename.match(routeableFileRegex);
1389
+ const match = filename.match(RoutableFileRegex);
1390
1390
  return match && (match[1] || match[3]).toLowerCase();
1391
1391
  }
1392
1392
  async function buildRoutes(sources, outDir) {
@@ -1428,7 +1428,7 @@ async function buildRoutes(sources, outDir) {
1428
1428
  },
1429
1429
  onFile(file) {
1430
1430
  const { name } = file;
1431
- const match = name.match(routeableFileRegex);
1431
+ const match = name.match(RoutableFileRegex);
1432
1432
  if (!match) {
1433
1433
  return;
1434
1434
  }
@@ -1847,6 +1847,7 @@ var ReadOncePersistedStore = class {
1847
1847
  constructor(uid) {
1848
1848
  this.uid = uid;
1849
1849
  }
1850
+ uid;
1850
1851
  write(value) {
1851
1852
  values.set(this.uid, value);
1852
1853
  }
@@ -2148,7 +2149,7 @@ function markoRun(opts = {}) {
2148
2149
  }
2149
2150
  },
2150
2151
  async config(config2, env) {
2151
- 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;
2152
+ 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;
2152
2153
  const externalPluginOptions = getExternalPluginOptions(config2);
2153
2154
  if (externalPluginOptions) {
2154
2155
  opts = (0, import_vite2.mergeConfig)(opts, externalPluginOptions);
@@ -2195,51 +2196,54 @@ function markoRun(opts = {}) {
2195
2196
  devEntryFilePosix = normalizePath(devEntryFile);
2196
2197
  let outDir = ((_e = config2.build) == null ? void 0 : _e.outDir) || "dist";
2197
2198
  const assetsDir = ((_f = config2.build) == null ? void 0 : _f.assetsDir) || "assets";
2198
- let rollupOutputOptions = (_h = (_g = config2.build) == null ? void 0 : _g.rollupOptions) == null ? void 0 : _h.output;
2199
+ let rolldownOutputOptions = (_h = (_g = config2.build) == null ? void 0 : _g.rolldownOptions) == null ? void 0 : _h.output;
2199
2200
  if (isBuild) {
2200
2201
  if (!isSSRBuild) {
2201
2202
  outDir = import_path6.default.join(outDir, CLIENT_OUT_DIR);
2202
2203
  }
2203
- rollupOutputOptions = mergeOutputOptions(
2204
+ rolldownOutputOptions = mergeOutputOptions(
2204
2205
  {
2205
- assetFileNames: `${assetsDir}/[name]-[hash].[ext]`,
2206
+ assetFileNames(info) {
2207
+ var _a2;
2208
+ const name = ((_a2 = info.names) == null ? void 0 : _a2[0]) && cleanFileName(info.names[0]);
2209
+ return name ? `${assetsDir}/${name}-[hash].[ext]` : `${assetsDir}/_[hash].[ext]`;
2210
+ },
2206
2211
  entryFileNames(info) {
2207
- return `${assetsDir}/${getEntryFileName(info.name) || "[name]"}-[hash].js`;
2212
+ const raw = getEntryFileName(info.name) || info.name;
2213
+ const name = raw && cleanFileName(raw);
2214
+ return name ? `${assetsDir}/${name}-[hash].js` : `${assetsDir}/_[hash].js`;
2208
2215
  },
2209
2216
  chunkFileNames: isSSRBuild ? `_[hash].js` : `${assetsDir}/_[hash].js`
2210
2217
  },
2211
- rollupOutputOptions
2218
+ rolldownOutputOptions
2212
2219
  );
2213
2220
  }
2214
- const browserslistTarget = isBuild && !((_i = config2.build) == null ? void 0 : _i.target) ? (0, import_browserslist.default)(void 0, {
2215
- path: root
2216
- }) : void 0;
2217
- shouldEmptyOutDir = ((_j = config2.build) == null ? void 0 : _j.emptyOutDir) ?? true;
2218
- const pluginConfig = await ((_k = adapter == null ? void 0 : adapter.viteConfig) == null ? void 0 : _k.call(adapter, config2)) || {};
2221
+ shouldEmptyOutDir = ((_i = config2.build) == null ? void 0 : _i.emptyOutDir) ?? true;
2222
+ const pluginConfig = await ((_j = adapter == null ? void 0 : adapter.viteConfig) == null ? void 0 : _j.call(adapter, config2)) || {};
2219
2223
  pluginConfig.ssr ?? (pluginConfig.ssr = {});
2220
- (_l = pluginConfig.ssr).noExternal ?? (_l.noExternal = /@marko\/run($|\/)/);
2224
+ (_k = pluginConfig.ssr).noExternal ?? (_k.noExternal = /@marko\/run($|\/)/);
2221
2225
  pluginConfig.css ?? (pluginConfig.css = {});
2222
- (_m = pluginConfig.css).devSourcemap ?? (_m.devSourcemap = true);
2226
+ (_l = pluginConfig.css).devSourcemap ?? (_l.devSourcemap = true);
2223
2227
  pluginConfig.build ?? (pluginConfig.build = {});
2224
- (_n = pluginConfig.build).outDir ?? (_n.outDir = outDir);
2225
- (_o = pluginConfig.build).assetsDir ?? (_o.assetsDir = assetsDir);
2226
- (_p = pluginConfig.build).copyPublicDir ?? (_p.copyPublicDir = !isSSRBuild);
2227
- (_q = pluginConfig.build).ssrEmitAssets ?? (_q.ssrEmitAssets = false);
2228
- (_r = pluginConfig.build).emptyOutDir ?? (_r.emptyOutDir = false);
2229
- (_s = pluginConfig.build).rollupOptions ?? (_s.rollupOptions = {});
2230
- if (rollupOutputOptions) {
2231
- pluginConfig.build.rollupOptions.output = mergeOutputOptions(
2232
- rollupOutputOptions,
2233
- pluginConfig.build.rollupOptions.output
2228
+ (_m = pluginConfig.build).outDir ?? (_m.outDir = outDir);
2229
+ (_n = pluginConfig.build).assetsDir ?? (_n.assetsDir = assetsDir);
2230
+ (_o = pluginConfig.build).copyPublicDir ?? (_o.copyPublicDir = !isSSRBuild);
2231
+ (_p = pluginConfig.build).ssrEmitAssets ?? (_p.ssrEmitAssets = false);
2232
+ (_q = pluginConfig.build).emptyOutDir ?? (_q.emptyOutDir = false);
2233
+ (_r = pluginConfig.build).rolldownOptions ?? (_r.rolldownOptions = {});
2234
+ if (rolldownOutputOptions) {
2235
+ pluginConfig.build.rolldownOptions.output = mergeOutputOptions(
2236
+ rolldownOutputOptions,
2237
+ pluginConfig.build.rolldownOptions.output
2234
2238
  );
2235
2239
  }
2236
- (_u = pluginConfig.build).sourcemap ?? (_u.sourcemap = ((_t = config2.build) == null ? void 0 : _t.sourcemap) ?? (isBuild && !isSSRBuild));
2237
- (_v = pluginConfig.build).modulePreload ?? (_v.modulePreload = {});
2240
+ (_t = pluginConfig.build).sourcemap ?? (_t.sourcemap = ((_s = config2.build) == null ? void 0 : _s.sourcemap) ?? (isBuild && !isSSRBuild));
2241
+ (_u = pluginConfig.build).modulePreload ?? (_u.modulePreload = {});
2238
2242
  if (typeof pluginConfig.build.modulePreload !== "boolean") {
2239
2243
  pluginConfig.build.modulePreload.polyfill = false;
2240
2244
  }
2241
2245
  pluginConfig.optimizeDeps ?? (pluginConfig.optimizeDeps = {});
2242
- if (!((_w = config2.optimizeDeps) == null ? void 0 : _w.entries)) {
2246
+ if (!((_v = config2.optimizeDeps) == null ? void 0 : _v.entries)) {
2243
2247
  pluginConfig.optimizeDeps.entries = [
2244
2248
  `${normalizePath(import_path6.default.relative(root, routesDir))}/**/*+{page,layout}.marko`,
2245
2249
  "!**/__snapshots__/**",
@@ -2247,21 +2251,16 @@ function markoRun(opts = {}) {
2247
2251
  "!**/coverage/**"
2248
2252
  ];
2249
2253
  }
2250
- if (browserslistTarget == null ? void 0 : browserslistTarget.length) {
2251
- (_x = pluginConfig.build).target ?? (_x.target = (0, import_esbuild_plugin_browserslist.resolveToEsbuildTarget)(
2252
- browserslistTarget,
2253
- {
2254
- printUnknownTargets: false
2255
- }
2256
- ));
2254
+ if (isBuild && !((_w = config2.build) == null ? void 0 : _w.target)) {
2255
+ pluginConfig.build.target = getBrowserslistTargets(root);
2257
2256
  }
2258
2257
  if (isBuild) {
2259
2258
  pluginConfig.logLevel ?? (pluginConfig.logLevel = "warn");
2260
2259
  pluginConfig.define ?? (pluginConfig.define = {});
2261
- (_y = pluginConfig.define)["process.env.NODE_ENV"] ?? (_y["process.env.NODE_ENV"] = "'production'");
2260
+ (_x = pluginConfig.define)["process.env.NODE_ENV"] ?? (_x["process.env.NODE_ENV"] = "'production'");
2262
2261
  pluginConfig.resolve ?? (pluginConfig.resolve = {});
2263
- (_z = pluginConfig.resolve).mainFields ?? (_z.mainFields = (isSSRBuild ? [] : ["browser"]).concat(["module", "jsnext:main", "jsnext", "main"]));
2264
- (_A = pluginConfig.resolve).conditions ?? (_A.conditions = [
2262
+ (_y = pluginConfig.resolve).mainFields ?? (_y.mainFields = (isSSRBuild ? [] : ["browser"]).concat(["module", "jsnext:main", "jsnext", "main"]));
2263
+ (_z = pluginConfig.resolve).conditions ?? (_z.conditions = [
2265
2264
  isSSRBuild ? "node" : "browser",
2266
2265
  "import",
2267
2266
  "require",
@@ -2275,7 +2274,7 @@ function markoRun(opts = {}) {
2275
2274
  resolvedConfig = config2;
2276
2275
  const {
2277
2276
  ssr,
2278
- rollupOptions: { input }
2277
+ rolldownOptions: { input }
2279
2278
  } = config2.build;
2280
2279
  if (typeof ssr === "string") {
2281
2280
  ssrEntryFiles = [ssr];
@@ -2486,11 +2485,11 @@ async function resolveAdapter(root, options, log) {
2486
2485
  }
2487
2486
  const pkg = await getPackageData(root);
2488
2487
  if (pkg) {
2489
- let dependecies = pkg.dependencies ? Object.keys(pkg.dependencies) : [];
2488
+ let dependencies = pkg.dependencies ? Object.keys(pkg.dependencies) : [];
2490
2489
  if (pkg.devDependencies) {
2491
- dependecies = dependecies.concat(Object.keys(pkg.devDependencies));
2490
+ dependencies = dependencies.concat(Object.keys(pkg.devDependencies));
2492
2491
  }
2493
- for (const name of dependecies) {
2492
+ for (const name of dependencies) {
2494
2493
  if (name.startsWith("@marko/run-adapter") || name.indexOf("marko-run-adapter") !== -1) {
2495
2494
  try {
2496
2495
  const module3 = await import(
@@ -2498,7 +2497,7 @@ async function resolveAdapter(root, options, log) {
2498
2497
  name
2499
2498
  );
2500
2499
  log && debug(
2501
- `Using adapter ${name} listed in your package.json dependecies`
2500
+ `Using adapter ${name} listed in your package.json dependencies`
2502
2501
  );
2503
2502
  return module3.default();
2504
2503
  } catch (err) {
@@ -2520,6 +2519,9 @@ function getEntryFileName(file) {
2520
2519
  const match = file && markoEntryFileRegex.exec(file);
2521
2520
  return match ? match[1] : void 0;
2522
2521
  }
2522
+ function cleanFileName(name) {
2523
+ return name.replace(/\.[^/.]+$/, "").replace(/[^a-zA-Z0-9._[\]-]+/g, "-").replace(/-{2,}/g, "-").replace(/^-|-$/g, "");
2524
+ }
2523
2525
  function getPlugin(config2) {
2524
2526
  return config2.plugins.find(
2525
2527
  (plugin) => plugin.name === `${PLUGIN_NAME_PREFIX}:pre`
@@ -2556,6 +2558,33 @@ var defaultConfigPlugin = {
2556
2558
  };
2557
2559
  }
2558
2560
  };
2561
+ function getBrowserslistTargets(path7) {
2562
+ var _a;
2563
+ const browserslistTarget = (0, import_browserslist.default)(void 0, { path: path7 });
2564
+ if (browserslistTarget.length) {
2565
+ const versions = /* @__PURE__ */ new Map();
2566
+ for (const target of (0, import_esbuild_plugin_browserslist.resolveToEsbuildTarget)(browserslistTarget, {
2567
+ printUnknownTargets: false
2568
+ })) {
2569
+ const index = (_a = /\d/.exec(target)) == null ? void 0 : _a.index;
2570
+ if (index) {
2571
+ const browser = target.slice(0, index);
2572
+ const version = Number(target.slice(index));
2573
+ const existingVersion = versions.get(browser);
2574
+ if (!existingVersion || version < existingVersion) {
2575
+ versions.set(browser, version);
2576
+ }
2577
+ }
2578
+ }
2579
+ if (versions.size) {
2580
+ const targets = [];
2581
+ for (const [browser, version] of versions) {
2582
+ targets.push(browser + version);
2583
+ }
2584
+ return targets;
2585
+ }
2586
+ }
2587
+ }
2559
2588
 
2560
2589
  // src/vite/utils/meta-data.ts
2561
2590
  var verbKeys = new Set(httpVerbs.map((v) => v.toUpperCase()));
@@ -2694,7 +2723,7 @@ async function waitForServer(port, wait = 0) {
2694
2723
  await sleep(100);
2695
2724
  } else {
2696
2725
  throw new Error(
2697
- `Timeout while wating for server to start on port "${port}".`
2726
+ `Timeout while waiting for server to start on port "${port}".`
2698
2727
  );
2699
2728
  }
2700
2729
  }
@@ -25,9 +25,10 @@ import {
25
25
 
26
26
  // src/adapter/utils.ts
27
27
  import kleur from "kleur";
28
- import supporsColor from "supports-color";
28
+ import supportsColor from "supports-color";
29
29
  function stripAnsi(string) {
30
30
  return string.replace(
31
+ /* cspell:disable-next-line */
31
32
  /([\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><])/g,
32
33
  ""
33
34
  );
@@ -422,7 +423,6 @@ function writeRouteEntryHandler(writer, route, verb) {
422
423
  continuations.writeLines(
423
424
  `const ${currentName} = () => context.render(page, {});`
424
425
  );
425
- nextName = currentName;
426
426
  } else {
427
427
  writer.writeLines(`return context.render(page, {});`);
428
428
  hasBody = true;
@@ -1336,12 +1336,12 @@ var VDir = _VDir;
1336
1336
  // src/vite/routes/builder.ts
1337
1337
  var markoFiles = `(${RoutableFileTypes.Layout}|${RoutableFileTypes.Page}|${RoutableFileTypes.NotFound}|${RoutableFileTypes.Error})\\.(?:.*\\.)?(marko)`;
1338
1338
  var nonMarkoFiles = `(${RoutableFileTypes.Middleware}|${RoutableFileTypes.Handler}|${RoutableFileTypes.Meta})\\.(?:.*\\.)?(.+)`;
1339
- var routeableFileRegex = new RegExp(
1339
+ var RoutableFileRegex = new RegExp(
1340
1340
  `[+](?:${markoFiles}|${nonMarkoFiles})$`,
1341
1341
  "i"
1342
1342
  );
1343
1343
  function matchRoutableFile(filename) {
1344
- const match = filename.match(routeableFileRegex);
1344
+ const match = filename.match(RoutableFileRegex);
1345
1345
  return match && (match[1] || match[3]).toLowerCase();
1346
1346
  }
1347
1347
  async function buildRoutes(sources, outDir) {
@@ -1383,7 +1383,7 @@ async function buildRoutes(sources, outDir) {
1383
1383
  },
1384
1384
  onFile(file) {
1385
1385
  const { name } = file;
1386
- const match = name.match(routeableFileRegex);
1386
+ const match = name.match(RoutableFileRegex);
1387
1387
  if (!match) {
1388
1388
  return;
1389
1389
  }
@@ -1802,6 +1802,7 @@ var ReadOncePersistedStore = class {
1802
1802
  constructor(uid) {
1803
1803
  this.uid = uid;
1804
1804
  }
1805
+ uid;
1805
1806
  write(value) {
1806
1807
  values.set(this.uid, value);
1807
1808
  }
@@ -2103,7 +2104,7 @@ function markoRun(opts = {}) {
2103
2104
  }
2104
2105
  },
2105
2106
  async config(config2, env) {
2106
- 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;
2107
+ 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;
2107
2108
  const externalPluginOptions = getExternalPluginOptions(config2);
2108
2109
  if (externalPluginOptions) {
2109
2110
  opts = mergeConfig(opts, externalPluginOptions);
@@ -2150,51 +2151,54 @@ function markoRun(opts = {}) {
2150
2151
  devEntryFilePosix = normalizePath(devEntryFile);
2151
2152
  let outDir = ((_e = config2.build) == null ? void 0 : _e.outDir) || "dist";
2152
2153
  const assetsDir = ((_f = config2.build) == null ? void 0 : _f.assetsDir) || "assets";
2153
- let rollupOutputOptions = (_h = (_g = config2.build) == null ? void 0 : _g.rollupOptions) == null ? void 0 : _h.output;
2154
+ let rolldownOutputOptions = (_h = (_g = config2.build) == null ? void 0 : _g.rolldownOptions) == null ? void 0 : _h.output;
2154
2155
  if (isBuild) {
2155
2156
  if (!isSSRBuild) {
2156
2157
  outDir = path6.join(outDir, CLIENT_OUT_DIR);
2157
2158
  }
2158
- rollupOutputOptions = mergeOutputOptions(
2159
+ rolldownOutputOptions = mergeOutputOptions(
2159
2160
  {
2160
- assetFileNames: `${assetsDir}/[name]-[hash].[ext]`,
2161
+ assetFileNames(info) {
2162
+ var _a2;
2163
+ const name = ((_a2 = info.names) == null ? void 0 : _a2[0]) && cleanFileName(info.names[0]);
2164
+ return name ? `${assetsDir}/${name}-[hash].[ext]` : `${assetsDir}/_[hash].[ext]`;
2165
+ },
2161
2166
  entryFileNames(info) {
2162
- return `${assetsDir}/${getEntryFileName(info.name) || "[name]"}-[hash].js`;
2167
+ const raw = getEntryFileName(info.name) || info.name;
2168
+ const name = raw && cleanFileName(raw);
2169
+ return name ? `${assetsDir}/${name}-[hash].js` : `${assetsDir}/_[hash].js`;
2163
2170
  },
2164
2171
  chunkFileNames: isSSRBuild ? `_[hash].js` : `${assetsDir}/_[hash].js`
2165
2172
  },
2166
- rollupOutputOptions
2173
+ rolldownOutputOptions
2167
2174
  );
2168
2175
  }
2169
- const browserslistTarget = isBuild && !((_i = config2.build) == null ? void 0 : _i.target) ? browserslist(void 0, {
2170
- path: root
2171
- }) : void 0;
2172
- shouldEmptyOutDir = ((_j = config2.build) == null ? void 0 : _j.emptyOutDir) ?? true;
2173
- const pluginConfig = await ((_k = adapter == null ? void 0 : adapter.viteConfig) == null ? void 0 : _k.call(adapter, config2)) || {};
2176
+ shouldEmptyOutDir = ((_i = config2.build) == null ? void 0 : _i.emptyOutDir) ?? true;
2177
+ const pluginConfig = await ((_j = adapter == null ? void 0 : adapter.viteConfig) == null ? void 0 : _j.call(adapter, config2)) || {};
2174
2178
  pluginConfig.ssr ?? (pluginConfig.ssr = {});
2175
- (_l = pluginConfig.ssr).noExternal ?? (_l.noExternal = /@marko\/run($|\/)/);
2179
+ (_k = pluginConfig.ssr).noExternal ?? (_k.noExternal = /@marko\/run($|\/)/);
2176
2180
  pluginConfig.css ?? (pluginConfig.css = {});
2177
- (_m = pluginConfig.css).devSourcemap ?? (_m.devSourcemap = true);
2181
+ (_l = pluginConfig.css).devSourcemap ?? (_l.devSourcemap = true);
2178
2182
  pluginConfig.build ?? (pluginConfig.build = {});
2179
- (_n = pluginConfig.build).outDir ?? (_n.outDir = outDir);
2180
- (_o = pluginConfig.build).assetsDir ?? (_o.assetsDir = assetsDir);
2181
- (_p = pluginConfig.build).copyPublicDir ?? (_p.copyPublicDir = !isSSRBuild);
2182
- (_q = pluginConfig.build).ssrEmitAssets ?? (_q.ssrEmitAssets = false);
2183
- (_r = pluginConfig.build).emptyOutDir ?? (_r.emptyOutDir = false);
2184
- (_s = pluginConfig.build).rollupOptions ?? (_s.rollupOptions = {});
2185
- if (rollupOutputOptions) {
2186
- pluginConfig.build.rollupOptions.output = mergeOutputOptions(
2187
- rollupOutputOptions,
2188
- pluginConfig.build.rollupOptions.output
2183
+ (_m = pluginConfig.build).outDir ?? (_m.outDir = outDir);
2184
+ (_n = pluginConfig.build).assetsDir ?? (_n.assetsDir = assetsDir);
2185
+ (_o = pluginConfig.build).copyPublicDir ?? (_o.copyPublicDir = !isSSRBuild);
2186
+ (_p = pluginConfig.build).ssrEmitAssets ?? (_p.ssrEmitAssets = false);
2187
+ (_q = pluginConfig.build).emptyOutDir ?? (_q.emptyOutDir = false);
2188
+ (_r = pluginConfig.build).rolldownOptions ?? (_r.rolldownOptions = {});
2189
+ if (rolldownOutputOptions) {
2190
+ pluginConfig.build.rolldownOptions.output = mergeOutputOptions(
2191
+ rolldownOutputOptions,
2192
+ pluginConfig.build.rolldownOptions.output
2189
2193
  );
2190
2194
  }
2191
- (_u = pluginConfig.build).sourcemap ?? (_u.sourcemap = ((_t = config2.build) == null ? void 0 : _t.sourcemap) ?? (isBuild && !isSSRBuild));
2192
- (_v = pluginConfig.build).modulePreload ?? (_v.modulePreload = {});
2195
+ (_t = pluginConfig.build).sourcemap ?? (_t.sourcemap = ((_s = config2.build) == null ? void 0 : _s.sourcemap) ?? (isBuild && !isSSRBuild));
2196
+ (_u = pluginConfig.build).modulePreload ?? (_u.modulePreload = {});
2193
2197
  if (typeof pluginConfig.build.modulePreload !== "boolean") {
2194
2198
  pluginConfig.build.modulePreload.polyfill = false;
2195
2199
  }
2196
2200
  pluginConfig.optimizeDeps ?? (pluginConfig.optimizeDeps = {});
2197
- if (!((_w = config2.optimizeDeps) == null ? void 0 : _w.entries)) {
2201
+ if (!((_v = config2.optimizeDeps) == null ? void 0 : _v.entries)) {
2198
2202
  pluginConfig.optimizeDeps.entries = [
2199
2203
  `${normalizePath(path6.relative(root, routesDir))}/**/*+{page,layout}.marko`,
2200
2204
  "!**/__snapshots__/**",
@@ -2202,21 +2206,16 @@ function markoRun(opts = {}) {
2202
2206
  "!**/coverage/**"
2203
2207
  ];
2204
2208
  }
2205
- if (browserslistTarget == null ? void 0 : browserslistTarget.length) {
2206
- (_x = pluginConfig.build).target ?? (_x.target = resolveToEsbuildTarget(
2207
- browserslistTarget,
2208
- {
2209
- printUnknownTargets: false
2210
- }
2211
- ));
2209
+ if (isBuild && !((_w = config2.build) == null ? void 0 : _w.target)) {
2210
+ pluginConfig.build.target = getBrowserslistTargets(root);
2212
2211
  }
2213
2212
  if (isBuild) {
2214
2213
  pluginConfig.logLevel ?? (pluginConfig.logLevel = "warn");
2215
2214
  pluginConfig.define ?? (pluginConfig.define = {});
2216
- (_y = pluginConfig.define)["process.env.NODE_ENV"] ?? (_y["process.env.NODE_ENV"] = "'production'");
2215
+ (_x = pluginConfig.define)["process.env.NODE_ENV"] ?? (_x["process.env.NODE_ENV"] = "'production'");
2217
2216
  pluginConfig.resolve ?? (pluginConfig.resolve = {});
2218
- (_z = pluginConfig.resolve).mainFields ?? (_z.mainFields = (isSSRBuild ? [] : ["browser"]).concat(["module", "jsnext:main", "jsnext", "main"]));
2219
- (_A = pluginConfig.resolve).conditions ?? (_A.conditions = [
2217
+ (_y = pluginConfig.resolve).mainFields ?? (_y.mainFields = (isSSRBuild ? [] : ["browser"]).concat(["module", "jsnext:main", "jsnext", "main"]));
2218
+ (_z = pluginConfig.resolve).conditions ?? (_z.conditions = [
2220
2219
  isSSRBuild ? "node" : "browser",
2221
2220
  "import",
2222
2221
  "require",
@@ -2230,7 +2229,7 @@ function markoRun(opts = {}) {
2230
2229
  resolvedConfig = config2;
2231
2230
  const {
2232
2231
  ssr,
2233
- rollupOptions: { input }
2232
+ rolldownOptions: { input }
2234
2233
  } = config2.build;
2235
2234
  if (typeof ssr === "string") {
2236
2235
  ssrEntryFiles = [ssr];
@@ -2441,11 +2440,11 @@ async function resolveAdapter(root, options, log) {
2441
2440
  }
2442
2441
  const pkg = await getPackageData(root);
2443
2442
  if (pkg) {
2444
- let dependecies = pkg.dependencies ? Object.keys(pkg.dependencies) : [];
2443
+ let dependencies = pkg.dependencies ? Object.keys(pkg.dependencies) : [];
2445
2444
  if (pkg.devDependencies) {
2446
- dependecies = dependecies.concat(Object.keys(pkg.devDependencies));
2445
+ dependencies = dependencies.concat(Object.keys(pkg.devDependencies));
2447
2446
  }
2448
- for (const name of dependecies) {
2447
+ for (const name of dependencies) {
2449
2448
  if (name.startsWith("@marko/run-adapter") || name.indexOf("marko-run-adapter") !== -1) {
2450
2449
  try {
2451
2450
  const module2 = await import(
@@ -2453,7 +2452,7 @@ async function resolveAdapter(root, options, log) {
2453
2452
  name
2454
2453
  );
2455
2454
  log && debug(
2456
- `Using adapter ${name} listed in your package.json dependecies`
2455
+ `Using adapter ${name} listed in your package.json dependencies`
2457
2456
  );
2458
2457
  return module2.default();
2459
2458
  } catch (err) {
@@ -2475,6 +2474,9 @@ function getEntryFileName(file) {
2475
2474
  const match = file && markoEntryFileRegex.exec(file);
2476
2475
  return match ? match[1] : void 0;
2477
2476
  }
2477
+ function cleanFileName(name) {
2478
+ return name.replace(/\.[^/.]+$/, "").replace(/[^a-zA-Z0-9._[\]-]+/g, "-").replace(/-{2,}/g, "-").replace(/^-|-$/g, "");
2479
+ }
2478
2480
  function getPlugin(config2) {
2479
2481
  return config2.plugins.find(
2480
2482
  (plugin) => plugin.name === `${PLUGIN_NAME_PREFIX}:pre`
@@ -2511,6 +2513,33 @@ var defaultConfigPlugin = {
2511
2513
  };
2512
2514
  }
2513
2515
  };
2516
+ function getBrowserslistTargets(path7) {
2517
+ var _a;
2518
+ const browserslistTarget = browserslist(void 0, { path: path7 });
2519
+ if (browserslistTarget.length) {
2520
+ const versions = /* @__PURE__ */ new Map();
2521
+ for (const target of resolveToEsbuildTarget(browserslistTarget, {
2522
+ printUnknownTargets: false
2523
+ })) {
2524
+ const index = (_a = /\d/.exec(target)) == null ? void 0 : _a.index;
2525
+ if (index) {
2526
+ const browser = target.slice(0, index);
2527
+ const version = Number(target.slice(index));
2528
+ const existingVersion = versions.get(browser);
2529
+ if (!existingVersion || version < existingVersion) {
2530
+ versions.set(browser, version);
2531
+ }
2532
+ }
2533
+ }
2534
+ if (versions.size) {
2535
+ const targets = [];
2536
+ for (const [browser, version] of versions) {
2537
+ targets.push(browser + version);
2538
+ }
2539
+ return targets;
2540
+ }
2541
+ }
2542
+ }
2514
2543
 
2515
2544
  // src/vite/utils/meta-data.ts
2516
2545
  var verbKeys = new Set(httpVerbs.map((v) => v.toUpperCase()));
@@ -2649,7 +2678,7 @@ async function waitForServer(port, wait = 0) {
2649
2678
  await sleep(100);
2650
2679
  } else {
2651
2680
  throw new Error(
2652
- `Timeout while wating for server to start on port "${port}".`
2681
+ `Timeout while waiting for server to start on port "${port}".`
2653
2682
  );
2654
2683
  }
2655
2684
  }
@@ -1,3 +1,3 @@
1
- import type { OutputBundle } from "rollup";
1
+ import type { OutputBundle } from "rolldown";
2
2
  import type { BuiltRoutes, ExternalRoutes } from "../types";
3
3
  export declare function logRoutesTable(routes: BuiltRoutes, externalRoutes: ExternalRoutes[], bundle: OutputBundle): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/run",
3
- "version": "0.9.6",
3
+ "version": "0.10.0",
4
4
  "description": "The Marko application framework.",
5
5
  "keywords": [
6
6
  "marko"
@@ -54,23 +54,23 @@
54
54
  "build": "rm -rf ./dist && tsc -b && tsx scripts/build.ts"
55
55
  },
56
56
  "dependencies": {
57
- "@marko/run-explorer": "^2.0.1",
58
- "@marko/vite": "^5.4.2",
59
- "browserslist": "^4.24.4",
57
+ "@marko/run-explorer": "^2.0.3",
58
+ "@marko/vite": "^6.0.3",
59
+ "browserslist": "^4.28.2",
60
60
  "cli-table3": "^0.6.5",
61
- "compression": "^1.8.0",
62
- "debug": "^4.4.0",
63
- "dotenv": "^16.4.7",
61
+ "compression": "^1.8.1",
62
+ "debug": "^4.4.3",
63
+ "dotenv": "^17.4.1",
64
64
  "draftlog": "^1.0.13",
65
- "esbuild-plugin-browserslist": "^0.16.0",
66
- "glob": "^11.0.1",
65
+ "esbuild-plugin-browserslist": "^2.0.0",
66
+ "glob": "^13.0.6",
67
67
  "human-format": "^1.2.1",
68
68
  "kleur": "^4.1.5",
69
- "parse-node-args": "^1.1.2",
69
+ "parse-node-args": "^1.1.3",
70
70
  "sade": "^1.8.1",
71
- "serve-static": "^1.16.2",
72
- "supports-color": "^10.0.0",
73
- "vite": "^7.0.0",
71
+ "serve-static": "^2.2.1",
72
+ "supports-color": "^10.2.2",
73
+ "vite": "^8.0.7",
74
74
  "warp10": "^2.1.0"
75
75
  },
76
76
  "peerDependencies": {