@marko/run 0.2.7 → 0.2.8
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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/adapter/default-entry.mjs +2 -2
- package/dist/adapter/dev-server.d.ts +1 -1
- package/dist/adapter/index.cjs +385 -17
- package/dist/adapter/index.d.ts +1 -1
- package/dist/adapter/index.js +385 -17
- package/dist/adapter/load-dev-worker.mjs +11 -10
- package/dist/adapter/middleware.cjs +15 -3
- package/dist/adapter/middleware.js +15 -3
- package/dist/adapter/runtime.cjs +22 -0
- package/dist/adapter/runtime.d.ts +1 -0
- package/dist/adapter/runtime.js +0 -0
- package/dist/adapter/utils.d.ts +10 -0
- package/dist/cli/index.mjs +27 -23
- package/dist/runtime/index.d.ts +2 -0
- package/dist/vite/index.cjs +23 -21
- package/dist/vite/index.js +23 -21
- package/dist/vite/types.d.ts +1 -0
- package/package.json +15 -12
package/dist/cli/index.mjs
CHANGED
|
@@ -1115,10 +1115,18 @@ export async function fetch(request, platform) {
|
|
|
1115
1115
|
const route = match(request.method, pathname);
|
|
1116
1116
|
return await invoke(route, request, platform, url);
|
|
1117
1117
|
} catch (error) {
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1118
|
+
if (import.meta.env.DEV) {
|
|
1119
|
+
let body;
|
|
1120
|
+
if (error.cause) {
|
|
1121
|
+
body = error.cause.stack || error.cause.message || error.cause;
|
|
1122
|
+
} else {
|
|
1123
|
+
body = error.stack || error.message || "Internal Server Error";
|
|
1124
|
+
}
|
|
1125
|
+
return new Response(body, {
|
|
1126
|
+
status: 500
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
return new Response(null, {
|
|
1122
1130
|
status: 500
|
|
1123
1131
|
});
|
|
1124
1132
|
}
|
|
@@ -1611,7 +1619,9 @@ function logRoutesTable(routes, bundle, options) {
|
|
|
1611
1619
|
entryType.push(kleur.yellow("page"));
|
|
1612
1620
|
size = prettySize(computeRouteSize(getRouteChunkName(route), bundle));
|
|
1613
1621
|
}
|
|
1614
|
-
const row = [
|
|
1622
|
+
const row = [
|
|
1623
|
+
kleur.bold(HttpVerbColors[verb](verb.toUpperCase()))
|
|
1624
|
+
];
|
|
1615
1625
|
if (verbs.length === 1 || firstRow) {
|
|
1616
1626
|
row.push({ rowSpan: verbs.length, content: prettyPath(path4.path) });
|
|
1617
1627
|
firstRow = false;
|
|
@@ -1649,10 +1659,7 @@ function byteSize(source) {
|
|
|
1649
1659
|
}
|
|
1650
1660
|
function computeChunkSize(chunk, bundle, seen = /* @__PURE__ */ new Set()) {
|
|
1651
1661
|
if (chunk.type === "asset") {
|
|
1652
|
-
return [
|
|
1653
|
-
byteSize(chunk.source),
|
|
1654
|
-
gzipSize(chunk.source)
|
|
1655
|
-
];
|
|
1662
|
+
return [byteSize(chunk.source), gzipSize(chunk.source)];
|
|
1656
1663
|
}
|
|
1657
1664
|
const size = [byteSize(chunk.code), gzipSize(chunk.code)];
|
|
1658
1665
|
for (const id of chunk.imports) {
|
|
@@ -1739,12 +1746,10 @@ function markoRun(opts = {}) {
|
|
|
1739
1746
|
const routerOptions = {
|
|
1740
1747
|
trailingSlashes: opts.trailingSlashes || "RedirectWithout"
|
|
1741
1748
|
};
|
|
1742
|
-
if (!render) {
|
|
1743
|
-
virtualFiles.clear();
|
|
1744
|
-
isRendered = false;
|
|
1745
|
-
}
|
|
1746
1749
|
try {
|
|
1747
1750
|
if (isStale) {
|
|
1751
|
+
virtualFiles.clear();
|
|
1752
|
+
isRendered = false;
|
|
1748
1753
|
const buildStartTime = performance.now();
|
|
1749
1754
|
routes = await buildRoutes(
|
|
1750
1755
|
createFSWalker(resolvedRoutesDir),
|
|
@@ -2035,13 +2040,10 @@ function markoRun(opts = {}) {
|
|
|
2035
2040
|
if (virtualFiles.has(importee)) {
|
|
2036
2041
|
resolved = importee;
|
|
2037
2042
|
} else if (virtualFilePath) {
|
|
2038
|
-
const
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
skipSelf: true
|
|
2043
|
-
}
|
|
2044
|
-
);
|
|
2043
|
+
const filePath = path2.resolve(__dirname, "..", virtualFilePath);
|
|
2044
|
+
const resolution = await this.resolve(filePath, importer, {
|
|
2045
|
+
skipSelf: true
|
|
2046
|
+
});
|
|
2045
2047
|
return resolution;
|
|
2046
2048
|
}
|
|
2047
2049
|
return resolved || null;
|
|
@@ -2051,7 +2053,7 @@ function markoRun(opts = {}) {
|
|
|
2051
2053
|
id = id.slice(0, -serverEntryQuery.length);
|
|
2052
2054
|
}
|
|
2053
2055
|
if (virtualFiles.has(id)) {
|
|
2054
|
-
if (!isRendered) {
|
|
2056
|
+
if (isStale || !isRendered) {
|
|
2055
2057
|
await buildVirtualFiles(true);
|
|
2056
2058
|
}
|
|
2057
2059
|
return virtualFiles.get(id);
|
|
@@ -2233,7 +2235,7 @@ var __dirname2 = path3.dirname(fileURLToPath2(import.meta.url));
|
|
|
2233
2235
|
var defaultPort = Number(process.env.PORT || 3e3);
|
|
2234
2236
|
var defaultConfigFileBases = ["serve.config", "vite.config"];
|
|
2235
2237
|
var defaultConfigFileExts = [".js", ".cjs", ".mjs", ".ts", ".mts"];
|
|
2236
|
-
async function preview(entry, cwd, configFile, port, outDir, envFile, args = []) {
|
|
2238
|
+
async function preview(sourceEntry, entry, cwd, configFile, port, outDir, envFile, args = []) {
|
|
2237
2239
|
const resolvedConfig = await resolveConfig(
|
|
2238
2240
|
{ root: cwd, configFile, logLevel: "silent", build: { outDir } },
|
|
2239
2241
|
"serve"
|
|
@@ -2257,7 +2259,8 @@ async function preview(entry, cwd, configFile, port, outDir, envFile, args = [])
|
|
|
2257
2259
|
dir,
|
|
2258
2260
|
args,
|
|
2259
2261
|
port: availablePort,
|
|
2260
|
-
envFile
|
|
2262
|
+
envFile,
|
|
2263
|
+
sourceEntry
|
|
2261
2264
|
};
|
|
2262
2265
|
return await adapter.startPreview(entryFile, options);
|
|
2263
2266
|
}
|
|
@@ -2409,6 +2412,7 @@ prog.command("preview [entry]").describe("Start a production-like server for alr
|
|
|
2409
2412
|
const config2 = await getViteConfig(cwd, opts.config);
|
|
2410
2413
|
await build(entry, cwd, config2, opts.output, opts.env);
|
|
2411
2414
|
await preview(
|
|
2415
|
+
entry,
|
|
2412
2416
|
opts.file,
|
|
2413
2417
|
cwd,
|
|
2414
2418
|
config2,
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { InlineConfig } from "vite";
|
|
1
2
|
import { NotHandled, NotMatched } from "./namespace";
|
|
2
3
|
import type { GetPaths, PostPaths, GetablePath, GetableHref, PostablePath, PostableHref, Platform, HandlerTypeFn, RuntimeModule, AnyRoute, AnyContext, AnyHandler } from "./types";
|
|
3
4
|
declare global {
|
|
4
5
|
var __marko_run__: RuntimeModule;
|
|
6
|
+
var __marko_run_vite_config__: InlineConfig | undefined;
|
|
5
7
|
namespace MarkoRun {
|
|
6
8
|
export const route: HandlerTypeFn;
|
|
7
9
|
export { GetPaths, PostPaths, GetablePath, GetableHref, PostablePath, PostableHref, Platform, NotHandled, NotMatched, AnyRoute as Route, AnyContext as Context, AnyHandler as Handler, };
|
package/dist/vite/index.cjs
CHANGED
|
@@ -1100,10 +1100,18 @@ export async function fetch(request, platform) {
|
|
|
1100
1100
|
const route = match(request.method, pathname);
|
|
1101
1101
|
return await invoke(route, request, platform, url);
|
|
1102
1102
|
} catch (error) {
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1103
|
+
if (import.meta.env.DEV) {
|
|
1104
|
+
let body;
|
|
1105
|
+
if (error.cause) {
|
|
1106
|
+
body = error.cause.stack || error.cause.message || error.cause;
|
|
1107
|
+
} else {
|
|
1108
|
+
body = error.stack || error.message || "Internal Server Error";
|
|
1109
|
+
}
|
|
1110
|
+
return new Response(body, {
|
|
1111
|
+
status: 500
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
return new Response(null, {
|
|
1107
1115
|
status: 500
|
|
1108
1116
|
});
|
|
1109
1117
|
}
|
|
@@ -1596,7 +1604,9 @@ function logRoutesTable(routes, bundle, options) {
|
|
|
1596
1604
|
entryType.push(import_kleur.default.yellow("page"));
|
|
1597
1605
|
size = prettySize(computeRouteSize(getRouteChunkName(route), bundle));
|
|
1598
1606
|
}
|
|
1599
|
-
const row = [
|
|
1607
|
+
const row = [
|
|
1608
|
+
import_kleur.default.bold(HttpVerbColors[verb](verb.toUpperCase()))
|
|
1609
|
+
];
|
|
1600
1610
|
if (verbs.length === 1 || firstRow) {
|
|
1601
1611
|
row.push({ rowSpan: verbs.length, content: prettyPath(path3.path) });
|
|
1602
1612
|
firstRow = false;
|
|
@@ -1634,10 +1644,7 @@ function byteSize(source) {
|
|
|
1634
1644
|
}
|
|
1635
1645
|
function computeChunkSize(chunk, bundle, seen = /* @__PURE__ */ new Set()) {
|
|
1636
1646
|
if (chunk.type === "asset") {
|
|
1637
|
-
return [
|
|
1638
|
-
byteSize(chunk.source),
|
|
1639
|
-
gzipSize(chunk.source)
|
|
1640
|
-
];
|
|
1647
|
+
return [byteSize(chunk.source), gzipSize(chunk.source)];
|
|
1641
1648
|
}
|
|
1642
1649
|
const size = [byteSize(chunk.code), gzipSize(chunk.code)];
|
|
1643
1650
|
for (const id of chunk.imports) {
|
|
@@ -1738,12 +1745,10 @@ function markoRun(opts = {}) {
|
|
|
1738
1745
|
const routerOptions = {
|
|
1739
1746
|
trailingSlashes: opts.trailingSlashes || "RedirectWithout"
|
|
1740
1747
|
};
|
|
1741
|
-
if (!render) {
|
|
1742
|
-
virtualFiles.clear();
|
|
1743
|
-
isRendered = false;
|
|
1744
|
-
}
|
|
1745
1748
|
try {
|
|
1746
1749
|
if (isStale) {
|
|
1750
|
+
virtualFiles.clear();
|
|
1751
|
+
isRendered = false;
|
|
1747
1752
|
const buildStartTime = performance.now();
|
|
1748
1753
|
routes = await buildRoutes(
|
|
1749
1754
|
createFSWalker(resolvedRoutesDir),
|
|
@@ -2034,13 +2039,10 @@ function markoRun(opts = {}) {
|
|
|
2034
2039
|
if (virtualFiles.has(importee)) {
|
|
2035
2040
|
resolved = importee;
|
|
2036
2041
|
} else if (virtualFilePath) {
|
|
2037
|
-
const
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
skipSelf: true
|
|
2042
|
-
}
|
|
2043
|
-
);
|
|
2042
|
+
const filePath = import_path2.default.resolve(__dirname, "..", virtualFilePath);
|
|
2043
|
+
const resolution = await this.resolve(filePath, importer, {
|
|
2044
|
+
skipSelf: true
|
|
2045
|
+
});
|
|
2044
2046
|
return resolution;
|
|
2045
2047
|
}
|
|
2046
2048
|
return resolved || null;
|
|
@@ -2050,7 +2052,7 @@ function markoRun(opts = {}) {
|
|
|
2050
2052
|
id = id.slice(0, -serverEntryQuery.length);
|
|
2051
2053
|
}
|
|
2052
2054
|
if (virtualFiles.has(id)) {
|
|
2053
|
-
if (!isRendered) {
|
|
2055
|
+
if (isStale || !isRendered) {
|
|
2054
2056
|
await buildVirtualFiles(true);
|
|
2055
2057
|
}
|
|
2056
2058
|
return virtualFiles.get(id);
|
package/dist/vite/index.js
CHANGED
|
@@ -1056,10 +1056,18 @@ export async function fetch(request, platform) {
|
|
|
1056
1056
|
const route = match(request.method, pathname);
|
|
1057
1057
|
return await invoke(route, request, platform, url);
|
|
1058
1058
|
} catch (error) {
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1059
|
+
if (import.meta.env.DEV) {
|
|
1060
|
+
let body;
|
|
1061
|
+
if (error.cause) {
|
|
1062
|
+
body = error.cause.stack || error.cause.message || error.cause;
|
|
1063
|
+
} else {
|
|
1064
|
+
body = error.stack || error.message || "Internal Server Error";
|
|
1065
|
+
}
|
|
1066
|
+
return new Response(body, {
|
|
1067
|
+
status: 500
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
return new Response(null, {
|
|
1063
1071
|
status: 500
|
|
1064
1072
|
});
|
|
1065
1073
|
}
|
|
@@ -1552,7 +1560,9 @@ function logRoutesTable(routes, bundle, options) {
|
|
|
1552
1560
|
entryType.push(kleur.yellow("page"));
|
|
1553
1561
|
size = prettySize(computeRouteSize(getRouteChunkName(route), bundle));
|
|
1554
1562
|
}
|
|
1555
|
-
const row = [
|
|
1563
|
+
const row = [
|
|
1564
|
+
kleur.bold(HttpVerbColors[verb](verb.toUpperCase()))
|
|
1565
|
+
];
|
|
1556
1566
|
if (verbs.length === 1 || firstRow) {
|
|
1557
1567
|
row.push({ rowSpan: verbs.length, content: prettyPath(path3.path) });
|
|
1558
1568
|
firstRow = false;
|
|
@@ -1590,10 +1600,7 @@ function byteSize(source) {
|
|
|
1590
1600
|
}
|
|
1591
1601
|
function computeChunkSize(chunk, bundle, seen = /* @__PURE__ */ new Set()) {
|
|
1592
1602
|
if (chunk.type === "asset") {
|
|
1593
|
-
return [
|
|
1594
|
-
byteSize(chunk.source),
|
|
1595
|
-
gzipSize(chunk.source)
|
|
1596
|
-
];
|
|
1603
|
+
return [byteSize(chunk.source), gzipSize(chunk.source)];
|
|
1597
1604
|
}
|
|
1598
1605
|
const size = [byteSize(chunk.code), gzipSize(chunk.code)];
|
|
1599
1606
|
for (const id of chunk.imports) {
|
|
@@ -1694,12 +1701,10 @@ function markoRun(opts = {}) {
|
|
|
1694
1701
|
const routerOptions = {
|
|
1695
1702
|
trailingSlashes: opts.trailingSlashes || "RedirectWithout"
|
|
1696
1703
|
};
|
|
1697
|
-
if (!render) {
|
|
1698
|
-
virtualFiles.clear();
|
|
1699
|
-
isRendered = false;
|
|
1700
|
-
}
|
|
1701
1704
|
try {
|
|
1702
1705
|
if (isStale) {
|
|
1706
|
+
virtualFiles.clear();
|
|
1707
|
+
isRendered = false;
|
|
1703
1708
|
const buildStartTime = performance.now();
|
|
1704
1709
|
routes = await buildRoutes(
|
|
1705
1710
|
createFSWalker(resolvedRoutesDir),
|
|
@@ -1990,13 +1995,10 @@ function markoRun(opts = {}) {
|
|
|
1990
1995
|
if (virtualFiles.has(importee)) {
|
|
1991
1996
|
resolved = importee;
|
|
1992
1997
|
} else if (virtualFilePath) {
|
|
1993
|
-
const
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
skipSelf: true
|
|
1998
|
-
}
|
|
1999
|
-
);
|
|
1998
|
+
const filePath = path2.resolve(__dirname, "..", virtualFilePath);
|
|
1999
|
+
const resolution = await this.resolve(filePath, importer, {
|
|
2000
|
+
skipSelf: true
|
|
2001
|
+
});
|
|
2000
2002
|
return resolution;
|
|
2001
2003
|
}
|
|
2002
2004
|
return resolved || null;
|
|
@@ -2006,7 +2008,7 @@ function markoRun(opts = {}) {
|
|
|
2006
2008
|
id = id.slice(0, -serverEntryQuery.length);
|
|
2007
2009
|
}
|
|
2008
2010
|
if (virtualFiles.has(id)) {
|
|
2009
|
-
if (!isRendered) {
|
|
2011
|
+
if (isStale || !isRendered) {
|
|
2010
2012
|
await buildVirtualFiles(true);
|
|
2011
2013
|
}
|
|
2012
2014
|
return virtualFiles.get(id);
|
package/dist/vite/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/run",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "The Marko application framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/marko-js/run/tree/main/packages/run",
|
|
@@ -92,42 +92,45 @@
|
|
|
92
92
|
"@marko/fixture-snapshots": "^2.1.7",
|
|
93
93
|
"@marko/testing-library": "^6.1.2",
|
|
94
94
|
"@types/glob": "^8.0.1",
|
|
95
|
-
"@types/human-format": "^1.0.
|
|
96
|
-
"@types/jsdom": "^21.1.
|
|
95
|
+
"@types/human-format": "^1.0.2",
|
|
96
|
+
"@types/jsdom": "^21.1.4",
|
|
97
97
|
"@types/mocha": "^9.1.1",
|
|
98
|
-
"@types/node": "^20.
|
|
98
|
+
"@types/node": "^20.8.7",
|
|
99
99
|
"acorn": "^8.8.0",
|
|
100
|
+
"body-parser": "^1.20.2",
|
|
100
101
|
"cross-env": "^7.0.3",
|
|
101
|
-
"esbuild": "^0.19.
|
|
102
|
+
"esbuild": "^0.19.5",
|
|
103
|
+
"express": "^4.18.2",
|
|
102
104
|
"jsdom": "^21.1.1",
|
|
103
|
-
"marko": "^5.
|
|
105
|
+
"marko": "^5.31.12",
|
|
104
106
|
"mocha": "^10.2.0",
|
|
105
107
|
"mocha-snap": "^4.3.0",
|
|
106
|
-
"playwright": "^1.
|
|
108
|
+
"playwright": "^1.39.0",
|
|
107
109
|
"prettier": "^2.7.1",
|
|
108
110
|
"ts-mocha": "^10.0.0",
|
|
109
111
|
"ts-node": "^10.9.1",
|
|
110
112
|
"tslib": "^2.5.0",
|
|
111
113
|
"tsm": "^2.3.0",
|
|
112
|
-
"tsx": "^3.
|
|
114
|
+
"tsx": "^3.14.0",
|
|
113
115
|
"typescript": "^4.7.4"
|
|
114
116
|
},
|
|
115
117
|
"dependencies": {
|
|
116
|
-
"@marko/vite": "^3",
|
|
118
|
+
"@marko/vite": "^3.1.4",
|
|
117
119
|
"browserslist": "^4.22.1",
|
|
118
120
|
"cli-table3": "^0.6.3",
|
|
119
121
|
"compression": "^1.7.4",
|
|
120
122
|
"dotenv": "^16.0.3",
|
|
121
123
|
"esbuild-plugin-browserslist": "^0.9.1",
|
|
122
124
|
"glob": "^8.1.0",
|
|
123
|
-
"human-format": "^1.0.
|
|
125
|
+
"human-format": "^1.0.2",
|
|
124
126
|
"kleur": "^4.1.5",
|
|
125
127
|
"parse-node-args": "^1.1.2",
|
|
126
128
|
"sade": "^1.8.1",
|
|
127
129
|
"serve-static": "^1.15.0",
|
|
128
130
|
"strip-ansi": "^7.0.1",
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
+
"supports-color": "^9.4.0",
|
|
132
|
+
"undici": "^5.26.3",
|
|
133
|
+
"vite": "^4.5.0",
|
|
131
134
|
"warp10": "^2.1.0"
|
|
132
135
|
}
|
|
133
136
|
}
|