@farm.js/core 0.1.0-beta.16 → 0.1.0-beta.17
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/after.d.mts +25 -0
- package/dist/after.d.ts +25 -0
- package/dist/agent-runtime.d.mts +96 -0
- package/dist/agent-runtime.d.ts +96 -0
- package/dist/api/route-manager.d.mts +66 -0
- package/dist/api/route-manager.d.ts +66 -0
- package/dist/api/runtime.d.mts +3 -0
- package/dist/api/runtime.d.ts +3 -0
- package/dist/api.d.mts +48 -0
- package/dist/api.d.ts +48 -0
- package/dist/app-B0tE1I3o.d.ts +306 -0
- package/dist/app-Dv2JJb7X.d.mts +306 -0
- package/dist/app-markdown.d.mts +24 -0
- package/dist/app-markdown.d.ts +24 -0
- package/dist/cache.d.mts +192 -0
- package/dist/cache.d.ts +192 -0
- package/dist/{chunk-AN3PQVKH.mjs → chunk-2FLBZFPG.mjs} +9 -7
- package/dist/chunk-2FLBZFPG.mjs.map +1 -0
- package/dist/chunk-E257KFBU.mjs +227 -0
- package/dist/chunk-E257KFBU.mjs.map +1 -0
- package/dist/{chunk-SLDBGSC3.mjs → chunk-JAEAE27K.mjs} +2 -2
- package/dist/{chunk-T2KL7VEL.mjs → chunk-PZXBQKCH.mjs} +13 -4
- package/dist/chunk-PZXBQKCH.mjs.map +1 -0
- package/dist/{chunk-UXUAWNO5.mjs → chunk-RIXKJPGI.mjs} +117 -55
- package/dist/chunk-RIXKJPGI.mjs.map +1 -0
- package/dist/{chunk-OSWV5IJB.mjs → chunk-T2M5QANG.mjs} +32 -9
- package/dist/chunk-T2M5QANG.mjs.map +1 -0
- package/dist/{chunk-BWJC5ZOD.mjs → chunk-VFDBC3W7.mjs} +2 -2
- package/dist/{chunk-BWJC5ZOD.mjs.map → chunk-VFDBC3W7.mjs.map} +1 -1
- package/dist/chunk-recovery-lnQFzcQP.d.mts +26 -0
- package/dist/chunk-recovery-lnQFzcQP.d.ts +26 -0
- package/dist/client-BT1mFQas.d.mts +447 -0
- package/dist/client-Nn0q4eO4.d.ts +447 -0
- package/dist/client-cache-CIlyBlmx.d.ts +6 -0
- package/dist/client-cache-D-EZ7XVW.d.mts +6 -0
- package/dist/client-plugins-278AvYHE.d.mts +2021 -0
- package/dist/client-plugins-CTQAkr7R.d.ts +2021 -0
- package/dist/client-plugins.d.mts +24 -0
- package/dist/client-plugins.d.ts +24 -0
- package/dist/client.d.mts +452 -0
- package/dist/client.d.ts +452 -0
- package/dist/config.d.mts +31 -0
- package/dist/config.d.ts +31 -0
- package/dist/cron.d.mts +78 -0
- package/dist/cron.d.ts +78 -0
- package/dist/deferred.d.mts +42 -0
- package/dist/deferred.d.ts +42 -0
- package/dist/deployment.d.mts +36 -0
- package/dist/deployment.d.ts +36 -0
- package/dist/{devtools-E4YNCY5J.mjs → devtools-K2ERKGNI.mjs} +3 -3
- package/dist/docs.cjs.map +1 -1
- package/dist/docs.d.mts +80 -0
- package/dist/docs.d.ts +80 -0
- package/dist/docs.mjs +3 -3
- package/dist/env-types.d.mts +12 -0
- package/dist/env-types.d.ts +12 -0
- package/dist/env.d.mts +45 -0
- package/dist/env.d.ts +45 -0
- package/dist/environment/vite.d.mts +22 -0
- package/dist/environment/vite.d.ts +22 -0
- package/dist/environment.d.mts +18 -0
- package/dist/environment.d.ts +18 -0
- package/dist/font.d.mts +95 -0
- package/dist/font.d.ts +95 -0
- package/dist/headers.d.mts +22 -0
- package/dist/headers.d.ts +22 -0
- package/dist/i18n/client.d.mts +32 -0
- package/dist/i18n/client.d.ts +32 -0
- package/dist/i18n/index.d.mts +20 -0
- package/dist/i18n/index.d.ts +20 -0
- package/dist/i18n/server.d.mts +30 -0
- package/dist/i18n/server.d.ts +30 -0
- package/dist/image/server.d.mts +37 -0
- package/dist/image/server.d.ts +37 -0
- package/dist/image/sharp.d.mts +7 -0
- package/dist/image/sharp.d.ts +7 -0
- package/dist/image-config-Duob7wER.d.mts +50 -0
- package/dist/image-config-Duob7wER.d.ts +50 -0
- package/dist/image.d.mts +39 -0
- package/dist/image.d.ts +39 -0
- package/dist/index.cjs +293 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +477 -0
- package/dist/index.d.ts +477 -0
- package/dist/index.mjs +22 -18
- package/dist/index.mjs.map +1 -1
- package/dist/integration-api-CHT2OKAf.d.mts +93 -0
- package/dist/integration-api-CHT2OKAf.d.ts +93 -0
- package/dist/integrations.d.mts +24 -0
- package/dist/integrations.d.ts +24 -0
- package/dist/internal/build-runtime.cjs +306 -137
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.d.mts +41 -0
- package/dist/internal/build-runtime.d.ts +41 -0
- package/dist/internal/build-runtime.mjs +7 -7
- package/dist/internal/client-runtime.d.mts +17 -0
- package/dist/internal/client-runtime.d.ts +17 -0
- package/dist/internal/config-runtime.cjs +140 -1
- package/dist/internal/config-runtime.cjs.map +1 -1
- package/dist/internal/config-runtime.d.mts +41 -0
- package/dist/internal/config-runtime.d.ts +41 -0
- package/dist/internal/config-runtime.mjs +2 -2
- package/dist/internal/metadata-image-runtime.d.mts +25 -0
- package/dist/internal/metadata-image-runtime.d.ts +25 -0
- package/dist/internal/production-node-env.d.mts +12 -0
- package/dist/internal/production-node-env.d.ts +12 -0
- package/dist/internal/production-runtime.d.mts +44 -0
- package/dist/internal/production-runtime.d.ts +44 -0
- package/dist/island-CfGru1MO.d.mts +9 -0
- package/dist/island-CfGru1MO.d.ts +9 -0
- package/dist/markdown.d.mts +60 -0
- package/dist/markdown.d.ts +60 -0
- package/dist/metadata-DmCudMw_.d.mts +22 -0
- package/dist/metadata-xghtOlbR.d.ts +22 -0
- package/dist/middleware.cjs +116 -98
- package/dist/middleware.cjs.map +1 -1
- package/dist/middleware.d.mts +171 -0
- package/dist/middleware.d.ts +171 -0
- package/dist/middleware.mjs +5 -2
- package/dist/navigation-errors-Dvwpzaer.d.mts +13 -0
- package/dist/navigation-errors-Dvwpzaer.d.ts +13 -0
- package/dist/navigation.d.mts +14 -0
- package/dist/navigation.d.ts +14 -0
- package/dist/observability.d.mts +335 -0
- package/dist/observability.d.ts +335 -0
- package/dist/params-BALtrRim.d.ts +15 -0
- package/dist/params-ry-lxqmy.d.mts +15 -0
- package/dist/plugin-BJDf43dc.d.mts +165 -0
- package/dist/plugin-BJDf43dc.d.ts +165 -0
- package/dist/plugin.cjs +132 -0
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.mts +24 -0
- package/dist/plugin.d.ts +24 -0
- package/dist/plugin.mjs +4 -4
- package/dist/production-runtime-BLxSv9cU.d.ts +79 -0
- package/dist/production-runtime-DFN2_RXq.d.mts +79 -0
- package/dist/query/client.d.mts +61 -0
- package/dist/query/client.d.ts +61 -0
- package/dist/query/index.d.mts +90 -0
- package/dist/query/index.d.ts +90 -0
- package/dist/query/parsers.d.mts +25 -0
- package/dist/query/parsers.d.ts +25 -0
- package/dist/query/server.d.mts +55 -0
- package/dist/query/server.d.ts +55 -0
- package/dist/request-Cq5d6qmE.d.mts +6 -0
- package/dist/request-LoxDW3lp.d.ts +6 -0
- package/dist/request.d.mts +25 -0
- package/dist/request.d.ts +25 -0
- package/dist/resolver-DJqjLMg_.d.mts +14 -0
- package/dist/resolver-IH4RmPEl.d.ts +14 -0
- package/dist/route-runtime-DoOHzCAD.d.mts +38 -0
- package/dist/route-runtime-DoOHzCAD.d.ts +38 -0
- package/dist/router.d.mts +36 -0
- package/dist/router.d.ts +36 -0
- package/dist/routes.d.mts +226 -0
- package/dist/routes.d.ts +226 -0
- package/dist/runtime-BA9TOSu1.d.mts +231 -0
- package/dist/runtime-Cxpq6xZN.d.mts +27 -0
- package/dist/runtime-DTAQ2HDv.d.ts +231 -0
- package/dist/runtime-bv63eUiO.d.ts +27 -0
- package/dist/server-action-security.d.mts +45 -0
- package/dist/server-action-security.d.ts +45 -0
- package/dist/server-fn-client.d.mts +33 -0
- package/dist/server-fn-client.d.ts +33 -0
- package/dist/server-fn-error-DDh14a0V.d.mts +26 -0
- package/dist/server-fn-error-DDh14a0V.d.ts +26 -0
- package/dist/server-fn.d.mts +121 -0
- package/dist/server-fn.d.ts +121 -0
- package/dist/server-plugins.d.mts +57 -0
- package/dist/server-plugins.d.ts +57 -0
- package/dist/server-query-client.d.mts +51 -0
- package/dist/server-query-client.d.ts +51 -0
- package/dist/server-query.d.mts +37 -0
- package/dist/server-query.d.ts +37 -0
- package/dist/server.cjs +170 -3
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.mts +51 -0
- package/dist/server.d.ts +51 -0
- package/dist/server.mjs +6 -6
- package/dist/storage.d.mts +52 -0
- package/dist/storage.d.ts +52 -0
- package/dist/testing.d.mts +103 -0
- package/dist/testing.d.ts +103 -0
- package/dist/transport-BmbGTXA5.d.mts +49 -0
- package/dist/transport-BmbGTXA5.d.ts +49 -0
- package/dist/types-BMxWr97v.d.mts +81 -0
- package/dist/types-BMxWr97v.d.ts +81 -0
- package/dist/types-D1A6-XvH.d.mts +73 -0
- package/dist/types-D1A6-XvH.d.ts +73 -0
- package/dist/types-DTzm4TCl.d.mts +78 -0
- package/dist/types-DTzm4TCl.d.ts +78 -0
- package/dist/utils-B6GaYNJL.d.ts +23 -0
- package/dist/utils-CKSHiip6.d.mts +23 -0
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.mts +3 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +140 -2
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.mts +24 -0
- package/dist/vite.d.ts +24 -0
- package/dist/vite.mjs +4 -4
- package/dist/workflows.d.mts +110 -0
- package/dist/workflows.d.ts +110 -0
- package/package.json +1 -1
- package/types/middleware.d.ts +36 -11
- package/dist/chunk-AN3PQVKH.mjs.map +0 -1
- package/dist/chunk-I4CUBGVF.mjs +0 -93
- package/dist/chunk-I4CUBGVF.mjs.map +0 -1
- package/dist/chunk-OSWV5IJB.mjs.map +0 -1
- package/dist/chunk-T2KL7VEL.mjs.map +0 -1
- package/dist/chunk-UXUAWNO5.mjs.map +0 -1
- /package/dist/{chunk-SLDBGSC3.mjs.map → chunk-JAEAE27K.mjs.map} +0 -0
- /package/dist/{devtools-E4YNCY5J.mjs.map → devtools-K2ERKGNI.mjs.map} +0 -0
package/dist/server.cjs
CHANGED
|
@@ -5396,6 +5396,143 @@ var init_preload = __esm({
|
|
|
5396
5396
|
}
|
|
5397
5397
|
});
|
|
5398
5398
|
|
|
5399
|
+
// src/security.ts
|
|
5400
|
+
function resolveFarmSecurityConfig(input) {
|
|
5401
|
+
if (input === void 0) return { csp: false };
|
|
5402
|
+
if (!isPlainRecord(input)) {
|
|
5403
|
+
throw new TypeError("security must be an object containing the csp option.");
|
|
5404
|
+
}
|
|
5405
|
+
if (Object.prototype.hasOwnProperty.call(input, "contentSecurityPolicy")) {
|
|
5406
|
+
throw new TypeError(
|
|
5407
|
+
"security.contentSecurityPolicy is not supported. Use security.csp instead."
|
|
5408
|
+
);
|
|
5409
|
+
}
|
|
5410
|
+
const csp = input.csp;
|
|
5411
|
+
if (csp === void 0 || csp === false) return { csp: false };
|
|
5412
|
+
if (typeof csp === "string") {
|
|
5413
|
+
return {
|
|
5414
|
+
csp: {
|
|
5415
|
+
value: validateSerializedCsp(csp),
|
|
5416
|
+
reportOnly: false
|
|
5417
|
+
}
|
|
5418
|
+
};
|
|
5419
|
+
}
|
|
5420
|
+
if (!isPlainRecord(csp)) {
|
|
5421
|
+
throw new TypeError("security.csp must be a policy string, false, or an options object.");
|
|
5422
|
+
}
|
|
5423
|
+
const reportOnly = validateReportOnly(csp.reportOnly);
|
|
5424
|
+
if (Object.prototype.hasOwnProperty.call(csp, "value")) {
|
|
5425
|
+
if (Object.prototype.hasOwnProperty.call(csp, "policy") || Object.prototype.hasOwnProperty.call(csp, "directives")) {
|
|
5426
|
+
throw new TypeError(
|
|
5427
|
+
"Resolved security.csp values cannot include policy or directives options."
|
|
5428
|
+
);
|
|
5429
|
+
}
|
|
5430
|
+
return {
|
|
5431
|
+
csp: {
|
|
5432
|
+
value: validateSerializedCsp(csp.value),
|
|
5433
|
+
reportOnly
|
|
5434
|
+
}
|
|
5435
|
+
};
|
|
5436
|
+
}
|
|
5437
|
+
const { policy, directives } = csp;
|
|
5438
|
+
if (policy !== void 0 && directives !== void 0) {
|
|
5439
|
+
throw new TypeError("security.csp accepts either policy or directives, not both.");
|
|
5440
|
+
}
|
|
5441
|
+
if (policy === void 0 && directives === void 0) {
|
|
5442
|
+
throw new TypeError("security.csp requires a policy string or directives object.");
|
|
5443
|
+
}
|
|
5444
|
+
return {
|
|
5445
|
+
csp: {
|
|
5446
|
+
value: policy !== void 0 ? validateSerializedCsp(policy) : serializeFarmCspDirectives(directives),
|
|
5447
|
+
reportOnly
|
|
5448
|
+
}
|
|
5449
|
+
};
|
|
5450
|
+
}
|
|
5451
|
+
function serializeFarmCspDirectives(directives) {
|
|
5452
|
+
if (!isPlainRecord(directives)) {
|
|
5453
|
+
throw new TypeError("security.csp.directives must be an object.");
|
|
5454
|
+
}
|
|
5455
|
+
const serialized = [];
|
|
5456
|
+
const normalizedNames = /* @__PURE__ */ new Set();
|
|
5457
|
+
for (const [configuredName, configuredValue] of Object.entries(directives)) {
|
|
5458
|
+
if (configuredValue === false || configuredValue === null || configuredValue === void 0) {
|
|
5459
|
+
continue;
|
|
5460
|
+
}
|
|
5461
|
+
const name = normalizeDirectiveName(configuredName);
|
|
5462
|
+
if (normalizedNames.has(name)) {
|
|
5463
|
+
throw new TypeError(`security.csp contains the duplicate directive ${JSON.stringify(name)}.`);
|
|
5464
|
+
}
|
|
5465
|
+
normalizedNames.add(name);
|
|
5466
|
+
const values = configuredValue === true ? [] : (Array.isArray(configuredValue) ? configuredValue : [configuredValue]).map(
|
|
5467
|
+
validateDirectiveValue
|
|
5468
|
+
);
|
|
5469
|
+
serialized.push(values.length > 0 ? `${name} ${values.join(" ")}` : name);
|
|
5470
|
+
}
|
|
5471
|
+
if (serialized.length === 0) {
|
|
5472
|
+
throw new TypeError("security.csp.directives must contain at least one enabled directive.");
|
|
5473
|
+
}
|
|
5474
|
+
return serialized.join("; ");
|
|
5475
|
+
}
|
|
5476
|
+
function getFarmSecurityHeader(security) {
|
|
5477
|
+
if (!security.csp) return void 0;
|
|
5478
|
+
return {
|
|
5479
|
+
key: security.csp.reportOnly ? "Content-Security-Policy-Report-Only" : "Content-Security-Policy",
|
|
5480
|
+
value: security.csp.value
|
|
5481
|
+
};
|
|
5482
|
+
}
|
|
5483
|
+
function normalizeDirectiveName(value) {
|
|
5484
|
+
const name = value.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
5485
|
+
if (!/^[a-z][a-z0-9-]*$/.test(name)) {
|
|
5486
|
+
throw new TypeError(`Invalid security.csp directive name: ${JSON.stringify(value)}.`);
|
|
5487
|
+
}
|
|
5488
|
+
return name;
|
|
5489
|
+
}
|
|
5490
|
+
function validateDirectiveValue(value) {
|
|
5491
|
+
if (typeof value !== "string") {
|
|
5492
|
+
throw new TypeError("security.csp directive values must be strings or booleans.");
|
|
5493
|
+
}
|
|
5494
|
+
const normalized = value.trim();
|
|
5495
|
+
if (!normalized || /[;\r\n]/.test(normalized) || normalized.includes("\0")) {
|
|
5496
|
+
throw new TypeError(`Invalid security.csp directive value: ${JSON.stringify(value)}.`);
|
|
5497
|
+
}
|
|
5498
|
+
return normalized;
|
|
5499
|
+
}
|
|
5500
|
+
function validateSerializedCsp(value) {
|
|
5501
|
+
if (typeof value !== "string") {
|
|
5502
|
+
throw new TypeError("security.csp policy must be a non-empty single-line string.");
|
|
5503
|
+
}
|
|
5504
|
+
const normalized = value.trim().replace(/;+$/g, "").trim();
|
|
5505
|
+
if (!normalized || /[\r\n]/.test(normalized) || normalized.includes("\0")) {
|
|
5506
|
+
throw new TypeError("security.csp policy must be a non-empty single-line string.");
|
|
5507
|
+
}
|
|
5508
|
+
return normalized;
|
|
5509
|
+
}
|
|
5510
|
+
function validateReportOnly(value) {
|
|
5511
|
+
if (value === void 0) return false;
|
|
5512
|
+
if (typeof value !== "boolean") {
|
|
5513
|
+
throw new TypeError("security.csp.reportOnly must be a boolean.");
|
|
5514
|
+
}
|
|
5515
|
+
return value;
|
|
5516
|
+
}
|
|
5517
|
+
function isPlainRecord(value) {
|
|
5518
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
5519
|
+
const prototype = Object.getPrototypeOf(value);
|
|
5520
|
+
return prototype === Object.prototype || prototype === null;
|
|
5521
|
+
}
|
|
5522
|
+
var init_security = __esm({
|
|
5523
|
+
"src/security.ts"() {
|
|
5524
|
+
"use strict";
|
|
5525
|
+
__name(resolveFarmSecurityConfig, "resolveFarmSecurityConfig");
|
|
5526
|
+
__name(serializeFarmCspDirectives, "serializeFarmCspDirectives");
|
|
5527
|
+
__name(getFarmSecurityHeader, "getFarmSecurityHeader");
|
|
5528
|
+
__name(normalizeDirectiveName, "normalizeDirectiveName");
|
|
5529
|
+
__name(validateDirectiveValue, "validateDirectiveValue");
|
|
5530
|
+
__name(validateSerializedCsp, "validateSerializedCsp");
|
|
5531
|
+
__name(validateReportOnly, "validateReportOnly");
|
|
5532
|
+
__name(isPlainRecord, "isPlainRecord");
|
|
5533
|
+
}
|
|
5534
|
+
});
|
|
5535
|
+
|
|
5399
5536
|
// src/write-file-if-changed.ts
|
|
5400
5537
|
function writeFileIfChanged(filePath, content) {
|
|
5401
5538
|
try {
|
|
@@ -10154,6 +10291,8 @@ async function resolveConfig(userConfig, mode) {
|
|
|
10154
10291
|
const routeRules = normalizeRouteRules(userConfig.routeRules);
|
|
10155
10292
|
const routeRuleRedirects = routeRulesToRedirects(routeRules);
|
|
10156
10293
|
const routeRuleHeaders = routeRulesToHeaders(routeRules);
|
|
10294
|
+
const security = resolveFarmSecurityConfig(userConfig.security);
|
|
10295
|
+
const securityHeader = getFarmSecurityHeader(security);
|
|
10157
10296
|
const deploy = resolveDeployConfig(userConfig);
|
|
10158
10297
|
const root = userConfig.root || process.cwd();
|
|
10159
10298
|
const srcDir = userConfig.srcDir || "src";
|
|
@@ -10209,7 +10348,11 @@ async function resolveConfig(userConfig, mode) {
|
|
|
10209
10348
|
trailingSlash: userConfig.trailingSlash ?? false,
|
|
10210
10349
|
redirects: /* @__PURE__ */ __name(() => [...redirects, ...routeRuleRedirects], "redirects"),
|
|
10211
10350
|
rewrites: /* @__PURE__ */ __name(() => rewrites, "rewrites"),
|
|
10212
|
-
headers: /* @__PURE__ */ __name(() => [
|
|
10351
|
+
headers: /* @__PURE__ */ __name(() => [
|
|
10352
|
+
...headers,
|
|
10353
|
+
...routeRuleHeaders,
|
|
10354
|
+
...securityHeader ? [{ source: "/*", headers: [securityHeader] }] : []
|
|
10355
|
+
], "headers"),
|
|
10213
10356
|
routeRules,
|
|
10214
10357
|
images: resolveFarmImageConfig(userConfig.images),
|
|
10215
10358
|
performance: resolveFarmPerformanceConfig(userConfig.performance),
|
|
@@ -10228,6 +10371,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
10228
10371
|
notFound: userConfig.notFound || {},
|
|
10229
10372
|
context: userConfig.context || (() => void 0),
|
|
10230
10373
|
serverActions: resolveServerActionsConfig(userConfig.serverActions),
|
|
10374
|
+
security,
|
|
10231
10375
|
deploymentId,
|
|
10232
10376
|
output: userConfig.output || "standalone",
|
|
10233
10377
|
distDir: userConfig.distDir || ".farm",
|
|
@@ -10307,6 +10451,7 @@ var init_config2 = __esm({
|
|
|
10307
10451
|
init_config();
|
|
10308
10452
|
init_auth_config();
|
|
10309
10453
|
init_preload();
|
|
10454
|
+
init_security();
|
|
10310
10455
|
init_config_entry();
|
|
10311
10456
|
FARM_RESOLVED_CUSTOM_CONTEXT = /* @__PURE__ */ Symbol.for("farm.resolvedCustomContext");
|
|
10312
10457
|
__name(normalizeDeployTarget, "normalizeDeployTarget");
|
|
@@ -21190,6 +21335,7 @@ init_devtools_config();
|
|
|
21190
21335
|
init_config();
|
|
21191
21336
|
init_auth_config();
|
|
21192
21337
|
init_preload();
|
|
21338
|
+
init_security();
|
|
21193
21339
|
var defaultDocsConfig = {
|
|
21194
21340
|
enabled: false,
|
|
21195
21341
|
entry: "/docs",
|
|
@@ -21257,6 +21403,7 @@ var _FarmApp = class _FarmApp {
|
|
|
21257
21403
|
routeRules: normalizeRouteRules(config.routeRules),
|
|
21258
21404
|
context: config.context || (() => void 0),
|
|
21259
21405
|
serverActions: resolveServerActionsConfig(config.serverActions),
|
|
21406
|
+
security: resolveFarmSecurityConfig(config.security),
|
|
21260
21407
|
images: resolveFarmImageConfig(config.images),
|
|
21261
21408
|
performance: resolveFarmPerformanceConfig(config.performance),
|
|
21262
21409
|
i18n: isResolvedI18nConfig(config.i18n) ? config.i18n : resolveFarmI18nConfig(config.i18n, {
|
|
@@ -23941,7 +24088,7 @@ function transformError(id, message) {
|
|
|
23941
24088
|
__name(transformError, "transformError");
|
|
23942
24089
|
|
|
23943
24090
|
// package.json
|
|
23944
|
-
var version = "0.1.0-beta.
|
|
24091
|
+
var version = "0.1.0-beta.17";
|
|
23945
24092
|
|
|
23946
24093
|
// src/version.ts
|
|
23947
24094
|
var FARM_VERSION = version;
|
|
@@ -24268,12 +24415,31 @@ function createFarmClientOptimizeDepsConfig(entries) {
|
|
|
24268
24415
|
};
|
|
24269
24416
|
}
|
|
24270
24417
|
__name(createFarmClientOptimizeDepsConfig, "createFarmClientOptimizeDepsConfig");
|
|
24418
|
+
function createFarmSourceAlias(projectRoot, srcDir = "src") {
|
|
24419
|
+
return {
|
|
24420
|
+
"@": import_node_path9.default.resolve(projectRoot, srcDir)
|
|
24421
|
+
};
|
|
24422
|
+
}
|
|
24423
|
+
__name(createFarmSourceAlias, "createFarmSourceAlias");
|
|
24271
24424
|
function mergeNoExternal(farmValue, userValue) {
|
|
24272
24425
|
if (farmValue === true || userValue === true) return true;
|
|
24273
24426
|
const normalize = /* @__PURE__ */ __name((value) => value == null || value === true ? [] : Array.isArray(value) ? value : [value], "normalize");
|
|
24274
24427
|
return Array.from(/* @__PURE__ */ new Set([...normalize(farmValue), ...normalize(userValue)]));
|
|
24275
24428
|
}
|
|
24276
24429
|
__name(mergeNoExternal, "mergeNoExternal");
|
|
24430
|
+
function mergeAlias(farmValue, userValue) {
|
|
24431
|
+
if (!farmValue) return userValue || {};
|
|
24432
|
+
if (!userValue) return farmValue;
|
|
24433
|
+
if (!Array.isArray(farmValue) && !Array.isArray(userValue)) {
|
|
24434
|
+
return {
|
|
24435
|
+
...farmValue,
|
|
24436
|
+
...userValue
|
|
24437
|
+
};
|
|
24438
|
+
}
|
|
24439
|
+
const normalize = /* @__PURE__ */ __name((value) => Array.isArray(value) ? [...value] : Object.entries(value).map(([find, replacement]) => ({ find, replacement })), "normalize");
|
|
24440
|
+
return [...normalize(userValue), ...normalize(farmValue)];
|
|
24441
|
+
}
|
|
24442
|
+
__name(mergeAlias, "mergeAlias");
|
|
24277
24443
|
function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
24278
24444
|
const noDiscovery = userConfig.optimizeDeps?.noDiscovery ?? farmConfig.optimizeDeps?.noDiscovery;
|
|
24279
24445
|
const holdUntilCrawlEnd = userConfig.optimizeDeps?.holdUntilCrawlEnd ?? (userConfig.optimizeDeps?.noDiscovery === true ? false : farmConfig.optimizeDeps?.holdUntilCrawlEnd);
|
|
@@ -24288,6 +24454,7 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
|
24288
24454
|
resolve: {
|
|
24289
24455
|
...farmConfig.resolve,
|
|
24290
24456
|
...userConfig.resolve,
|
|
24457
|
+
alias: mergeAlias(farmConfig.resolve?.alias, userConfig.resolve?.alias),
|
|
24291
24458
|
dedupe: Array.from(
|
|
24292
24459
|
/* @__PURE__ */ new Set([...farmConfig.resolve?.dedupe || [], ...userConfig.resolve?.dedupe || []])
|
|
24293
24460
|
)
|
|
@@ -28076,7 +28243,7 @@ async function defineConfig2(config = {}) {
|
|
|
28076
28243
|
// Stub out problematic server-only modules during dev mode
|
|
28077
28244
|
alias: {
|
|
28078
28245
|
...getFarmLayerAliases(config.layers),
|
|
28079
|
-
|
|
28246
|
+
...createFarmSourceAlias(appRoot, config.srcDir),
|
|
28080
28247
|
// Nitro internals that should not be resolved in browser
|
|
28081
28248
|
"supports-color": "data:text/javascript,export default false; export const supportsColor = false; export const stdout = false; export const stderr = false;",
|
|
28082
28249
|
"@poppinss/dumper": "data:text/javascript,export default {};",
|