@marko/run 0.5.17 → 0.6.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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/adapter/index.cjs +71 -193
- package/dist/adapter/index.js +71 -193
- package/dist/adapter/middleware.cjs +70 -202
- package/dist/adapter/middleware.js +70 -192
- package/dist/cli/index.mjs +30 -31
- package/dist/runtime/internal.cjs +1 -1
- package/dist/runtime/internal.js +1 -1
- package/dist/vite/index.cjs +30 -31
- package/dist/vite/index.js +30 -31
- package/package.json +12 -13
- package/dist/adapter/polyfill.d.ts +0 -11
package/dist/cli/index.mjs
CHANGED
|
@@ -25,7 +25,6 @@ import {
|
|
|
25
25
|
// src/vite/plugin.ts
|
|
26
26
|
import markoVitePlugin from "@marko/vite";
|
|
27
27
|
import browserslist from "browserslist";
|
|
28
|
-
import { createHash } from "crypto";
|
|
29
28
|
import createDebug from "debug";
|
|
30
29
|
import { resolveToEsbuildTarget } from "esbuild-plugin-browserslist";
|
|
31
30
|
import fs3 from "fs";
|
|
@@ -1781,6 +1780,8 @@ function markoRun(opts = {}) {
|
|
|
1781
1780
|
let { routesDir, adapter, ...markoVitePluginOptions } = opts;
|
|
1782
1781
|
let store;
|
|
1783
1782
|
let root;
|
|
1783
|
+
let shouldEmptyOutDir = false;
|
|
1784
|
+
let outputDir;
|
|
1784
1785
|
let resolvedRoutesDir;
|
|
1785
1786
|
let entryFilesDir;
|
|
1786
1787
|
let entryFilesDirPosix;
|
|
@@ -1964,7 +1965,7 @@ function markoRun(opts = {}) {
|
|
|
1964
1965
|
name: `${PLUGIN_NAME_PREFIX}:pre`,
|
|
1965
1966
|
enforce: "pre",
|
|
1966
1967
|
async config(config2, env) {
|
|
1967
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1968
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1968
1969
|
const externalPluginOptions = getExternalPluginOptions(config2);
|
|
1969
1970
|
if (externalPluginOptions) {
|
|
1970
1971
|
opts = mergeConfig(opts, externalPluginOptions);
|
|
@@ -1995,11 +1996,8 @@ function markoRun(opts = {}) {
|
|
|
1995
1996
|
markoVitePluginOptions.runtimeId = opts.runtimeId;
|
|
1996
1997
|
markoVitePluginOptions.basePathVar = opts.basePathVar;
|
|
1997
1998
|
resolvedRoutesDir = path4.resolve(root, routesDir);
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
".marko",
|
|
2001
|
-
createHash("shake256", { outputLength: 4 }).update(root).digest("hex")
|
|
2002
|
-
);
|
|
1999
|
+
outputDir = path4.join(root, ((_d = config2.build) == null ? void 0 : _d.outDir) || "dist");
|
|
2000
|
+
entryFilesDir = path4.join(outputDir, ".marko-run");
|
|
2003
2001
|
entryFilesDirPosix = normalizePath(entryFilesDir);
|
|
2004
2002
|
relativeEntryFilesDirPosix = normalizePath(
|
|
2005
2003
|
path4.relative(root, entryFilesDir)
|
|
@@ -2007,9 +2005,9 @@ function markoRun(opts = {}) {
|
|
|
2007
2005
|
typesDir = path4.join(root, ".marko-run");
|
|
2008
2006
|
devEntryFile = path4.join(root, "index.html");
|
|
2009
2007
|
devEntryFilePosix = normalizePath(devEntryFile);
|
|
2010
|
-
let outDir = ((
|
|
2011
|
-
const assetsDir = ((
|
|
2012
|
-
let rollupOutputOptions = (
|
|
2008
|
+
let outDir = ((_e = config2.build) == null ? void 0 : _e.outDir) || "dist";
|
|
2009
|
+
const assetsDir = ((_f = config2.build) == null ? void 0 : _f.assetsDir) || "assets";
|
|
2010
|
+
let rollupOutputOptions = (_h = (_g = config2.build) == null ? void 0 : _g.rollupOptions) == null ? void 0 : _h.output;
|
|
2013
2011
|
if (isBuild) {
|
|
2014
2012
|
if (!isSSRBuild) {
|
|
2015
2013
|
outDir = path4.join(outDir, CLIENT_OUT_DIR);
|
|
@@ -2049,9 +2047,10 @@ function markoRun(opts = {}) {
|
|
|
2049
2047
|
}));
|
|
2050
2048
|
}
|
|
2051
2049
|
}
|
|
2052
|
-
const browserslistTarget = isBuild && !((
|
|
2050
|
+
const browserslistTarget = isBuild && !((_i = config2.build) == null ? void 0 : _i.target) ? browserslist(void 0, {
|
|
2053
2051
|
path: root
|
|
2054
2052
|
}) : void 0;
|
|
2053
|
+
shouldEmptyOutDir = ((_j = config2.build) == null ? void 0 : _j.emptyOutDir) ?? true;
|
|
2055
2054
|
let pluginConfig = {
|
|
2056
2055
|
logLevel: isBuild ? "warn" : void 0,
|
|
2057
2056
|
define: isBuild ? {
|
|
@@ -2069,18 +2068,17 @@ function markoRun(opts = {}) {
|
|
|
2069
2068
|
target: (browserslistTarget == null ? void 0 : browserslistTarget.length) ? resolveToEsbuildTarget(browserslistTarget, {
|
|
2070
2069
|
printUnknownTargets: false
|
|
2071
2070
|
}) : void 0,
|
|
2072
|
-
emptyOutDir: isSSRBuild,
|
|
2073
|
-
// Avoid server & client deleting files from each other.
|
|
2074
2071
|
copyPublicDir: !isSSRBuild,
|
|
2075
2072
|
ssrEmitAssets: false,
|
|
2073
|
+
emptyOutDir: false,
|
|
2076
2074
|
rollupOptions: {
|
|
2077
2075
|
output: rollupOutputOptions
|
|
2078
2076
|
},
|
|
2079
2077
|
modulePreload: { polyfill: false },
|
|
2080
|
-
sourcemap: ((
|
|
2078
|
+
sourcemap: ((_k = config2.build) == null ? void 0 : _k.sourcemap) ?? (isBuild && !isSSRBuild)
|
|
2081
2079
|
},
|
|
2082
2080
|
optimizeDeps: {
|
|
2083
|
-
entries: !((
|
|
2081
|
+
entries: !((_l = config2.optimizeDeps) == null ? void 0 : _l.entries) ? [
|
|
2084
2082
|
"src/pages/**/*+{page,layout}.marko",
|
|
2085
2083
|
"!**/__snapshots__/**",
|
|
2086
2084
|
`!**/__tests__/**`,
|
|
@@ -2168,6 +2166,11 @@ function markoRun(opts = {}) {
|
|
|
2168
2166
|
}).unwatch(typesDir + "/*");
|
|
2169
2167
|
},
|
|
2170
2168
|
async buildStart(_options) {
|
|
2169
|
+
if (isSSRBuild && shouldEmptyOutDir) {
|
|
2170
|
+
if (fs3.existsSync(outputDir)) {
|
|
2171
|
+
fs3.rmSync(outputDir, { recursive: true });
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2171
2174
|
if (isBuild && !isSSRBuild) {
|
|
2172
2175
|
try {
|
|
2173
2176
|
routeData = await store.read();
|
|
@@ -2272,13 +2275,18 @@ function markoRun(opts = {}) {
|
|
|
2272
2275
|
}
|
|
2273
2276
|
},
|
|
2274
2277
|
async closeBundle() {
|
|
2275
|
-
if (isBuild && !isSSRBuild
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2278
|
+
if (isBuild && !isSSRBuild) {
|
|
2279
|
+
if (fs3.existsSync(entryFilesDir)) {
|
|
2280
|
+
fs3.rmSync(entryFilesDir, { recursive: true });
|
|
2281
|
+
}
|
|
2282
|
+
if ((adapter == null ? void 0 : adapter.buildEnd) && routes) {
|
|
2283
|
+
await adapter.buildEnd(
|
|
2284
|
+
resolvedConfig,
|
|
2285
|
+
routes.list,
|
|
2286
|
+
routeData.builtEntries,
|
|
2287
|
+
routeData.sourceEntries
|
|
2288
|
+
);
|
|
2289
|
+
}
|
|
2282
2290
|
}
|
|
2283
2291
|
}
|
|
2284
2292
|
}
|
|
@@ -2370,15 +2378,6 @@ function getImporters(module, fileName, seen = /* @__PURE__ */ new Set()) {
|
|
|
2370
2378
|
}
|
|
2371
2379
|
return seen;
|
|
2372
2380
|
}
|
|
2373
|
-
function getModulesDir(root, dir = __dirname) {
|
|
2374
|
-
if (dir.startsWith(root)) {
|
|
2375
|
-
const index = dir.indexOf("node_modules");
|
|
2376
|
-
if (index >= 0) {
|
|
2377
|
-
return dir.slice(0, index + 12);
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
return path4.join(root, "node_modules");
|
|
2381
|
-
}
|
|
2382
2381
|
var defaultConfigPlugin = {
|
|
2383
2382
|
name: `${PLUGIN_NAME_PREFIX}:defaults`,
|
|
2384
2383
|
enforce: "pre",
|
|
@@ -89,7 +89,7 @@ function createContext(route, request, platform, url = new URL(request.url)) {
|
|
|
89
89
|
}
|
|
90
90
|
async function call(handler, next, context) {
|
|
91
91
|
let response;
|
|
92
|
-
if (process.env.NODE_ENV
|
|
92
|
+
if (!process.env.NODE_ENV || process.env.NODE_ENV === "development") {
|
|
93
93
|
let nextCallCount = 0;
|
|
94
94
|
let didThrow = false;
|
|
95
95
|
try {
|
package/dist/runtime/internal.js
CHANGED
|
@@ -47,7 +47,7 @@ function createContext(route, request, platform, url = new URL(request.url)) {
|
|
|
47
47
|
}
|
|
48
48
|
async function call(handler, next, context) {
|
|
49
49
|
let response;
|
|
50
|
-
if (process.env.NODE_ENV
|
|
50
|
+
if (!process.env.NODE_ENV || process.env.NODE_ENV === "development") {
|
|
51
51
|
let nextCallCount = 0;
|
|
52
52
|
let didThrow = false;
|
|
53
53
|
try {
|
package/dist/vite/index.cjs
CHANGED
|
@@ -57,7 +57,6 @@ var __importMetaURL = (0, import_url.pathToFileURL)(__filename);
|
|
|
57
57
|
// src/vite/plugin.ts
|
|
58
58
|
var import_vite = __toESM(require("@marko/vite"), 1);
|
|
59
59
|
var import_browserslist = __toESM(require("browserslist"), 1);
|
|
60
|
-
var import_crypto = require("crypto");
|
|
61
60
|
var import_debug = __toESM(require("debug"), 1);
|
|
62
61
|
var import_esbuild_plugin_browserslist = require("esbuild-plugin-browserslist");
|
|
63
62
|
var import_fs3 = __toESM(require("fs"), 1);
|
|
@@ -1812,6 +1811,8 @@ function markoRun(opts = {}) {
|
|
|
1812
1811
|
let { routesDir, adapter, ...markoVitePluginOptions } = opts;
|
|
1813
1812
|
let store;
|
|
1814
1813
|
let root;
|
|
1814
|
+
let shouldEmptyOutDir = false;
|
|
1815
|
+
let outputDir;
|
|
1815
1816
|
let resolvedRoutesDir;
|
|
1816
1817
|
let entryFilesDir;
|
|
1817
1818
|
let entryFilesDirPosix;
|
|
@@ -1995,7 +1996,7 @@ function markoRun(opts = {}) {
|
|
|
1995
1996
|
name: `${PLUGIN_NAME_PREFIX}:pre`,
|
|
1996
1997
|
enforce: "pre",
|
|
1997
1998
|
async config(config2, env) {
|
|
1998
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1999
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1999
2000
|
const externalPluginOptions = getExternalPluginOptions(config2);
|
|
2000
2001
|
if (externalPluginOptions) {
|
|
2001
2002
|
opts = (0, import_vite2.mergeConfig)(opts, externalPluginOptions);
|
|
@@ -2026,11 +2027,8 @@ function markoRun(opts = {}) {
|
|
|
2026
2027
|
markoVitePluginOptions.runtimeId = opts.runtimeId;
|
|
2027
2028
|
markoVitePluginOptions.basePathVar = opts.basePathVar;
|
|
2028
2029
|
resolvedRoutesDir = import_path4.default.resolve(root, routesDir);
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
".marko",
|
|
2032
|
-
(0, import_crypto.createHash)("shake256", { outputLength: 4 }).update(root).digest("hex")
|
|
2033
|
-
);
|
|
2030
|
+
outputDir = import_path4.default.join(root, ((_d = config2.build) == null ? void 0 : _d.outDir) || "dist");
|
|
2031
|
+
entryFilesDir = import_path4.default.join(outputDir, ".marko-run");
|
|
2034
2032
|
entryFilesDirPosix = normalizePath(entryFilesDir);
|
|
2035
2033
|
relativeEntryFilesDirPosix = normalizePath(
|
|
2036
2034
|
import_path4.default.relative(root, entryFilesDir)
|
|
@@ -2038,9 +2036,9 @@ function markoRun(opts = {}) {
|
|
|
2038
2036
|
typesDir = import_path4.default.join(root, ".marko-run");
|
|
2039
2037
|
devEntryFile = import_path4.default.join(root, "index.html");
|
|
2040
2038
|
devEntryFilePosix = normalizePath(devEntryFile);
|
|
2041
|
-
let outDir = ((
|
|
2042
|
-
const assetsDir = ((
|
|
2043
|
-
let rollupOutputOptions = (
|
|
2039
|
+
let outDir = ((_e = config2.build) == null ? void 0 : _e.outDir) || "dist";
|
|
2040
|
+
const assetsDir = ((_f = config2.build) == null ? void 0 : _f.assetsDir) || "assets";
|
|
2041
|
+
let rollupOutputOptions = (_h = (_g = config2.build) == null ? void 0 : _g.rollupOptions) == null ? void 0 : _h.output;
|
|
2044
2042
|
if (isBuild) {
|
|
2045
2043
|
if (!isSSRBuild) {
|
|
2046
2044
|
outDir = import_path4.default.join(outDir, CLIENT_OUT_DIR);
|
|
@@ -2080,9 +2078,10 @@ function markoRun(opts = {}) {
|
|
|
2080
2078
|
}));
|
|
2081
2079
|
}
|
|
2082
2080
|
}
|
|
2083
|
-
const browserslistTarget = isBuild && !((
|
|
2081
|
+
const browserslistTarget = isBuild && !((_i = config2.build) == null ? void 0 : _i.target) ? (0, import_browserslist.default)(void 0, {
|
|
2084
2082
|
path: root
|
|
2085
2083
|
}) : void 0;
|
|
2084
|
+
shouldEmptyOutDir = ((_j = config2.build) == null ? void 0 : _j.emptyOutDir) ?? true;
|
|
2086
2085
|
let pluginConfig = {
|
|
2087
2086
|
logLevel: isBuild ? "warn" : void 0,
|
|
2088
2087
|
define: isBuild ? {
|
|
@@ -2100,18 +2099,17 @@ function markoRun(opts = {}) {
|
|
|
2100
2099
|
target: (browserslistTarget == null ? void 0 : browserslistTarget.length) ? (0, import_esbuild_plugin_browserslist.resolveToEsbuildTarget)(browserslistTarget, {
|
|
2101
2100
|
printUnknownTargets: false
|
|
2102
2101
|
}) : void 0,
|
|
2103
|
-
emptyOutDir: isSSRBuild,
|
|
2104
|
-
// Avoid server & client deleting files from each other.
|
|
2105
2102
|
copyPublicDir: !isSSRBuild,
|
|
2106
2103
|
ssrEmitAssets: false,
|
|
2104
|
+
emptyOutDir: false,
|
|
2107
2105
|
rollupOptions: {
|
|
2108
2106
|
output: rollupOutputOptions
|
|
2109
2107
|
},
|
|
2110
2108
|
modulePreload: { polyfill: false },
|
|
2111
|
-
sourcemap: ((
|
|
2109
|
+
sourcemap: ((_k = config2.build) == null ? void 0 : _k.sourcemap) ?? (isBuild && !isSSRBuild)
|
|
2112
2110
|
},
|
|
2113
2111
|
optimizeDeps: {
|
|
2114
|
-
entries: !((
|
|
2112
|
+
entries: !((_l = config2.optimizeDeps) == null ? void 0 : _l.entries) ? [
|
|
2115
2113
|
"src/pages/**/*+{page,layout}.marko",
|
|
2116
2114
|
"!**/__snapshots__/**",
|
|
2117
2115
|
`!**/__tests__/**`,
|
|
@@ -2199,6 +2197,11 @@ function markoRun(opts = {}) {
|
|
|
2199
2197
|
}).unwatch(typesDir + "/*");
|
|
2200
2198
|
},
|
|
2201
2199
|
async buildStart(_options) {
|
|
2200
|
+
if (isSSRBuild && shouldEmptyOutDir) {
|
|
2201
|
+
if (import_fs3.default.existsSync(outputDir)) {
|
|
2202
|
+
import_fs3.default.rmSync(outputDir, { recursive: true });
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2202
2205
|
if (isBuild && !isSSRBuild) {
|
|
2203
2206
|
try {
|
|
2204
2207
|
routeData = await store.read();
|
|
@@ -2303,13 +2306,18 @@ function markoRun(opts = {}) {
|
|
|
2303
2306
|
}
|
|
2304
2307
|
},
|
|
2305
2308
|
async closeBundle() {
|
|
2306
|
-
if (isBuild && !isSSRBuild
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2309
|
+
if (isBuild && !isSSRBuild) {
|
|
2310
|
+
if (import_fs3.default.existsSync(entryFilesDir)) {
|
|
2311
|
+
import_fs3.default.rmSync(entryFilesDir, { recursive: true });
|
|
2312
|
+
}
|
|
2313
|
+
if ((adapter == null ? void 0 : adapter.buildEnd) && routes) {
|
|
2314
|
+
await adapter.buildEnd(
|
|
2315
|
+
resolvedConfig,
|
|
2316
|
+
routes.list,
|
|
2317
|
+
routeData.builtEntries,
|
|
2318
|
+
routeData.sourceEntries
|
|
2319
|
+
);
|
|
2320
|
+
}
|
|
2313
2321
|
}
|
|
2314
2322
|
}
|
|
2315
2323
|
}
|
|
@@ -2396,15 +2404,6 @@ function getImporters(module2, fileName, seen = /* @__PURE__ */ new Set()) {
|
|
|
2396
2404
|
}
|
|
2397
2405
|
return seen;
|
|
2398
2406
|
}
|
|
2399
|
-
function getModulesDir(root, dir = __dirname) {
|
|
2400
|
-
if (dir.startsWith(root)) {
|
|
2401
|
-
const index = dir.indexOf("node_modules");
|
|
2402
|
-
if (index >= 0) {
|
|
2403
|
-
return dir.slice(0, index + 12);
|
|
2404
|
-
}
|
|
2405
|
-
}
|
|
2406
|
-
return import_path4.default.join(root, "node_modules");
|
|
2407
|
-
}
|
|
2408
2407
|
var defaultConfigPlugin = {
|
|
2409
2408
|
name: `${PLUGIN_NAME_PREFIX}:defaults`,
|
|
2410
2409
|
enforce: "pre",
|
package/dist/vite/index.js
CHANGED
|
@@ -12,7 +12,6 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
12
12
|
// src/vite/plugin.ts
|
|
13
13
|
import markoVitePlugin from "@marko/vite";
|
|
14
14
|
import browserslist from "browserslist";
|
|
15
|
-
import { createHash } from "crypto";
|
|
16
15
|
import createDebug from "debug";
|
|
17
16
|
import { resolveToEsbuildTarget } from "esbuild-plugin-browserslist";
|
|
18
17
|
import fs3 from "fs";
|
|
@@ -1767,6 +1766,8 @@ function markoRun(opts = {}) {
|
|
|
1767
1766
|
let { routesDir, adapter, ...markoVitePluginOptions } = opts;
|
|
1768
1767
|
let store;
|
|
1769
1768
|
let root;
|
|
1769
|
+
let shouldEmptyOutDir = false;
|
|
1770
|
+
let outputDir;
|
|
1770
1771
|
let resolvedRoutesDir;
|
|
1771
1772
|
let entryFilesDir;
|
|
1772
1773
|
let entryFilesDirPosix;
|
|
@@ -1950,7 +1951,7 @@ function markoRun(opts = {}) {
|
|
|
1950
1951
|
name: `${PLUGIN_NAME_PREFIX}:pre`,
|
|
1951
1952
|
enforce: "pre",
|
|
1952
1953
|
async config(config2, env) {
|
|
1953
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1954
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1954
1955
|
const externalPluginOptions = getExternalPluginOptions(config2);
|
|
1955
1956
|
if (externalPluginOptions) {
|
|
1956
1957
|
opts = mergeConfig(opts, externalPluginOptions);
|
|
@@ -1981,11 +1982,8 @@ function markoRun(opts = {}) {
|
|
|
1981
1982
|
markoVitePluginOptions.runtimeId = opts.runtimeId;
|
|
1982
1983
|
markoVitePluginOptions.basePathVar = opts.basePathVar;
|
|
1983
1984
|
resolvedRoutesDir = path4.resolve(root, routesDir);
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
".marko",
|
|
1987
|
-
createHash("shake256", { outputLength: 4 }).update(root).digest("hex")
|
|
1988
|
-
);
|
|
1985
|
+
outputDir = path4.join(root, ((_d = config2.build) == null ? void 0 : _d.outDir) || "dist");
|
|
1986
|
+
entryFilesDir = path4.join(outputDir, ".marko-run");
|
|
1989
1987
|
entryFilesDirPosix = normalizePath(entryFilesDir);
|
|
1990
1988
|
relativeEntryFilesDirPosix = normalizePath(
|
|
1991
1989
|
path4.relative(root, entryFilesDir)
|
|
@@ -1993,9 +1991,9 @@ function markoRun(opts = {}) {
|
|
|
1993
1991
|
typesDir = path4.join(root, ".marko-run");
|
|
1994
1992
|
devEntryFile = path4.join(root, "index.html");
|
|
1995
1993
|
devEntryFilePosix = normalizePath(devEntryFile);
|
|
1996
|
-
let outDir = ((
|
|
1997
|
-
const assetsDir = ((
|
|
1998
|
-
let rollupOutputOptions = (
|
|
1994
|
+
let outDir = ((_e = config2.build) == null ? void 0 : _e.outDir) || "dist";
|
|
1995
|
+
const assetsDir = ((_f = config2.build) == null ? void 0 : _f.assetsDir) || "assets";
|
|
1996
|
+
let rollupOutputOptions = (_h = (_g = config2.build) == null ? void 0 : _g.rollupOptions) == null ? void 0 : _h.output;
|
|
1999
1997
|
if (isBuild) {
|
|
2000
1998
|
if (!isSSRBuild) {
|
|
2001
1999
|
outDir = path4.join(outDir, CLIENT_OUT_DIR);
|
|
@@ -2035,9 +2033,10 @@ function markoRun(opts = {}) {
|
|
|
2035
2033
|
}));
|
|
2036
2034
|
}
|
|
2037
2035
|
}
|
|
2038
|
-
const browserslistTarget = isBuild && !((
|
|
2036
|
+
const browserslistTarget = isBuild && !((_i = config2.build) == null ? void 0 : _i.target) ? browserslist(void 0, {
|
|
2039
2037
|
path: root
|
|
2040
2038
|
}) : void 0;
|
|
2039
|
+
shouldEmptyOutDir = ((_j = config2.build) == null ? void 0 : _j.emptyOutDir) ?? true;
|
|
2041
2040
|
let pluginConfig = {
|
|
2042
2041
|
logLevel: isBuild ? "warn" : void 0,
|
|
2043
2042
|
define: isBuild ? {
|
|
@@ -2055,18 +2054,17 @@ function markoRun(opts = {}) {
|
|
|
2055
2054
|
target: (browserslistTarget == null ? void 0 : browserslistTarget.length) ? resolveToEsbuildTarget(browserslistTarget, {
|
|
2056
2055
|
printUnknownTargets: false
|
|
2057
2056
|
}) : void 0,
|
|
2058
|
-
emptyOutDir: isSSRBuild,
|
|
2059
|
-
// Avoid server & client deleting files from each other.
|
|
2060
2057
|
copyPublicDir: !isSSRBuild,
|
|
2061
2058
|
ssrEmitAssets: false,
|
|
2059
|
+
emptyOutDir: false,
|
|
2062
2060
|
rollupOptions: {
|
|
2063
2061
|
output: rollupOutputOptions
|
|
2064
2062
|
},
|
|
2065
2063
|
modulePreload: { polyfill: false },
|
|
2066
|
-
sourcemap: ((
|
|
2064
|
+
sourcemap: ((_k = config2.build) == null ? void 0 : _k.sourcemap) ?? (isBuild && !isSSRBuild)
|
|
2067
2065
|
},
|
|
2068
2066
|
optimizeDeps: {
|
|
2069
|
-
entries: !((
|
|
2067
|
+
entries: !((_l = config2.optimizeDeps) == null ? void 0 : _l.entries) ? [
|
|
2070
2068
|
"src/pages/**/*+{page,layout}.marko",
|
|
2071
2069
|
"!**/__snapshots__/**",
|
|
2072
2070
|
`!**/__tests__/**`,
|
|
@@ -2154,6 +2152,11 @@ function markoRun(opts = {}) {
|
|
|
2154
2152
|
}).unwatch(typesDir + "/*");
|
|
2155
2153
|
},
|
|
2156
2154
|
async buildStart(_options) {
|
|
2155
|
+
if (isSSRBuild && shouldEmptyOutDir) {
|
|
2156
|
+
if (fs3.existsSync(outputDir)) {
|
|
2157
|
+
fs3.rmSync(outputDir, { recursive: true });
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2157
2160
|
if (isBuild && !isSSRBuild) {
|
|
2158
2161
|
try {
|
|
2159
2162
|
routeData = await store.read();
|
|
@@ -2258,13 +2261,18 @@ function markoRun(opts = {}) {
|
|
|
2258
2261
|
}
|
|
2259
2262
|
},
|
|
2260
2263
|
async closeBundle() {
|
|
2261
|
-
if (isBuild && !isSSRBuild
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2264
|
+
if (isBuild && !isSSRBuild) {
|
|
2265
|
+
if (fs3.existsSync(entryFilesDir)) {
|
|
2266
|
+
fs3.rmSync(entryFilesDir, { recursive: true });
|
|
2267
|
+
}
|
|
2268
|
+
if ((adapter == null ? void 0 : adapter.buildEnd) && routes) {
|
|
2269
|
+
await adapter.buildEnd(
|
|
2270
|
+
resolvedConfig,
|
|
2271
|
+
routes.list,
|
|
2272
|
+
routeData.builtEntries,
|
|
2273
|
+
routeData.sourceEntries
|
|
2274
|
+
);
|
|
2275
|
+
}
|
|
2268
2276
|
}
|
|
2269
2277
|
}
|
|
2270
2278
|
}
|
|
@@ -2351,15 +2359,6 @@ function getImporters(module, fileName, seen = /* @__PURE__ */ new Set()) {
|
|
|
2351
2359
|
}
|
|
2352
2360
|
return seen;
|
|
2353
2361
|
}
|
|
2354
|
-
function getModulesDir(root, dir = __dirname) {
|
|
2355
|
-
if (dir.startsWith(root)) {
|
|
2356
|
-
const index = dir.indexOf("node_modules");
|
|
2357
|
-
if (index >= 0) {
|
|
2358
|
-
return dir.slice(0, index + 12);
|
|
2359
|
-
}
|
|
2360
|
-
}
|
|
2361
|
-
return path4.join(root, "node_modules");
|
|
2362
|
-
}
|
|
2363
2362
|
var defaultConfigPlugin = {
|
|
2364
2363
|
name: `${PLUGIN_NAME_PREFIX}:defaults`,
|
|
2365
2364
|
enforce: "pre",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/run",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "The Marko application framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"marko"
|
|
@@ -54,24 +54,23 @@
|
|
|
54
54
|
"build": "rm -rf ./dist && tsc -b && tsx scripts/build.ts"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@marko/run-explorer": "^0.
|
|
58
|
-
"@marko/vite": "^5.0.
|
|
59
|
-
"browserslist": "^4.24.
|
|
57
|
+
"@marko/run-explorer": "^1.0.0",
|
|
58
|
+
"@marko/vite": "^5.0.14",
|
|
59
|
+
"browserslist": "^4.24.4",
|
|
60
60
|
"cli-table3": "^0.6.5",
|
|
61
|
-
"compression": "^1.
|
|
62
|
-
"debug": "^4.
|
|
63
|
-
"dotenv": "^16.4.
|
|
61
|
+
"compression": "^1.8.0",
|
|
62
|
+
"debug": "^4.4.0",
|
|
63
|
+
"dotenv": "^16.4.7",
|
|
64
64
|
"draftlog": "^1.0.13",
|
|
65
|
-
"esbuild-plugin-browserslist": "^0.
|
|
66
|
-
"glob": "^11.0.
|
|
65
|
+
"esbuild-plugin-browserslist": "^0.16.0",
|
|
66
|
+
"glob": "^11.0.1",
|
|
67
67
|
"human-format": "^1.2.1",
|
|
68
68
|
"kleur": "^4.1.5",
|
|
69
69
|
"parse-node-args": "^1.1.2",
|
|
70
70
|
"sade": "^1.8.1",
|
|
71
71
|
"serve-static": "^1.16.2",
|
|
72
|
-
"supports-color": "^
|
|
73
|
-
"
|
|
74
|
-
"vite": "^6.0.0",
|
|
72
|
+
"supports-color": "^10.0.0",
|
|
73
|
+
"vite": "^6.2.1",
|
|
75
74
|
"warp10": "^2.1.0"
|
|
76
75
|
},
|
|
77
76
|
"devDependencies": {
|
|
@@ -89,7 +88,7 @@
|
|
|
89
88
|
"body-parser": "^1.20.3",
|
|
90
89
|
"cross-env": "^7.0.3",
|
|
91
90
|
"diff": "^7.0.0",
|
|
92
|
-
"esbuild": "^0.
|
|
91
|
+
"esbuild": "^0.25.1",
|
|
93
92
|
"express": "^4.21.1",
|
|
94
93
|
"jsdom": "^25.0.1",
|
|
95
94
|
"mocha": "^10.8.2",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ServerResponse } from "http";
|
|
2
|
-
declare global {
|
|
3
|
-
interface Headers {
|
|
4
|
-
getSetCookie: () => string[];
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
export declare const appendHeader: typeof appendHeader_platform;
|
|
8
|
-
declare function appendHeader_platform(response: ServerResponse, name: string, value: string | readonly string[]): void;
|
|
9
|
-
export declare const getSetCookie: typeof getSetCookie_fallback;
|
|
10
|
-
export declare function getSetCookie_fallback(headers: Headers): string | string[] | undefined;
|
|
11
|
-
export {};
|