@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/version.mjs
CHANGED
package/dist/vite.cjs
CHANGED
|
@@ -4254,6 +4254,135 @@ var init_preload = __esm({
|
|
|
4254
4254
|
}
|
|
4255
4255
|
});
|
|
4256
4256
|
|
|
4257
|
+
// src/security.ts
|
|
4258
|
+
function resolveFarmSecurityConfig(input) {
|
|
4259
|
+
if (input === void 0) return { csp: false };
|
|
4260
|
+
if (!isPlainRecord(input)) {
|
|
4261
|
+
throw new TypeError("security must be an object containing the csp option.");
|
|
4262
|
+
}
|
|
4263
|
+
if (Object.prototype.hasOwnProperty.call(input, "contentSecurityPolicy")) {
|
|
4264
|
+
throw new TypeError(
|
|
4265
|
+
"security.contentSecurityPolicy is not supported. Use security.csp instead."
|
|
4266
|
+
);
|
|
4267
|
+
}
|
|
4268
|
+
const csp = input.csp;
|
|
4269
|
+
if (csp === void 0 || csp === false) return { csp: false };
|
|
4270
|
+
if (typeof csp === "string") {
|
|
4271
|
+
return {
|
|
4272
|
+
csp: {
|
|
4273
|
+
value: validateSerializedCsp(csp),
|
|
4274
|
+
reportOnly: false
|
|
4275
|
+
}
|
|
4276
|
+
};
|
|
4277
|
+
}
|
|
4278
|
+
if (!isPlainRecord(csp)) {
|
|
4279
|
+
throw new TypeError("security.csp must be a policy string, false, or an options object.");
|
|
4280
|
+
}
|
|
4281
|
+
const reportOnly = validateReportOnly(csp.reportOnly);
|
|
4282
|
+
if (Object.prototype.hasOwnProperty.call(csp, "value")) {
|
|
4283
|
+
if (Object.prototype.hasOwnProperty.call(csp, "policy") || Object.prototype.hasOwnProperty.call(csp, "directives")) {
|
|
4284
|
+
throw new TypeError(
|
|
4285
|
+
"Resolved security.csp values cannot include policy or directives options."
|
|
4286
|
+
);
|
|
4287
|
+
}
|
|
4288
|
+
return {
|
|
4289
|
+
csp: {
|
|
4290
|
+
value: validateSerializedCsp(csp.value),
|
|
4291
|
+
reportOnly
|
|
4292
|
+
}
|
|
4293
|
+
};
|
|
4294
|
+
}
|
|
4295
|
+
const { policy, directives } = csp;
|
|
4296
|
+
if (policy !== void 0 && directives !== void 0) {
|
|
4297
|
+
throw new TypeError("security.csp accepts either policy or directives, not both.");
|
|
4298
|
+
}
|
|
4299
|
+
if (policy === void 0 && directives === void 0) {
|
|
4300
|
+
throw new TypeError("security.csp requires a policy string or directives object.");
|
|
4301
|
+
}
|
|
4302
|
+
return {
|
|
4303
|
+
csp: {
|
|
4304
|
+
value: policy !== void 0 ? validateSerializedCsp(policy) : serializeFarmCspDirectives(directives),
|
|
4305
|
+
reportOnly
|
|
4306
|
+
}
|
|
4307
|
+
};
|
|
4308
|
+
}
|
|
4309
|
+
function serializeFarmCspDirectives(directives) {
|
|
4310
|
+
if (!isPlainRecord(directives)) {
|
|
4311
|
+
throw new TypeError("security.csp.directives must be an object.");
|
|
4312
|
+
}
|
|
4313
|
+
const serialized = [];
|
|
4314
|
+
const normalizedNames = /* @__PURE__ */ new Set();
|
|
4315
|
+
for (const [configuredName, configuredValue] of Object.entries(directives)) {
|
|
4316
|
+
if (configuredValue === false || configuredValue === null || configuredValue === void 0) {
|
|
4317
|
+
continue;
|
|
4318
|
+
}
|
|
4319
|
+
const name = normalizeDirectiveName(configuredName);
|
|
4320
|
+
if (normalizedNames.has(name)) {
|
|
4321
|
+
throw new TypeError(`security.csp contains the duplicate directive ${JSON.stringify(name)}.`);
|
|
4322
|
+
}
|
|
4323
|
+
normalizedNames.add(name);
|
|
4324
|
+
const values = configuredValue === true ? [] : (Array.isArray(configuredValue) ? configuredValue : [configuredValue]).map(
|
|
4325
|
+
validateDirectiveValue
|
|
4326
|
+
);
|
|
4327
|
+
serialized.push(values.length > 0 ? `${name} ${values.join(" ")}` : name);
|
|
4328
|
+
}
|
|
4329
|
+
if (serialized.length === 0) {
|
|
4330
|
+
throw new TypeError("security.csp.directives must contain at least one enabled directive.");
|
|
4331
|
+
}
|
|
4332
|
+
return serialized.join("; ");
|
|
4333
|
+
}
|
|
4334
|
+
function normalizeDirectiveName(value) {
|
|
4335
|
+
const name = value.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
4336
|
+
if (!/^[a-z][a-z0-9-]*$/.test(name)) {
|
|
4337
|
+
throw new TypeError(`Invalid security.csp directive name: ${JSON.stringify(value)}.`);
|
|
4338
|
+
}
|
|
4339
|
+
return name;
|
|
4340
|
+
}
|
|
4341
|
+
function validateDirectiveValue(value) {
|
|
4342
|
+
if (typeof value !== "string") {
|
|
4343
|
+
throw new TypeError("security.csp directive values must be strings or booleans.");
|
|
4344
|
+
}
|
|
4345
|
+
const normalized = value.trim();
|
|
4346
|
+
if (!normalized || /[;\r\n]/.test(normalized) || normalized.includes("\0")) {
|
|
4347
|
+
throw new TypeError(`Invalid security.csp directive value: ${JSON.stringify(value)}.`);
|
|
4348
|
+
}
|
|
4349
|
+
return normalized;
|
|
4350
|
+
}
|
|
4351
|
+
function validateSerializedCsp(value) {
|
|
4352
|
+
if (typeof value !== "string") {
|
|
4353
|
+
throw new TypeError("security.csp policy must be a non-empty single-line string.");
|
|
4354
|
+
}
|
|
4355
|
+
const normalized = value.trim().replace(/;+$/g, "").trim();
|
|
4356
|
+
if (!normalized || /[\r\n]/.test(normalized) || normalized.includes("\0")) {
|
|
4357
|
+
throw new TypeError("security.csp policy must be a non-empty single-line string.");
|
|
4358
|
+
}
|
|
4359
|
+
return normalized;
|
|
4360
|
+
}
|
|
4361
|
+
function validateReportOnly(value) {
|
|
4362
|
+
if (value === void 0) return false;
|
|
4363
|
+
if (typeof value !== "boolean") {
|
|
4364
|
+
throw new TypeError("security.csp.reportOnly must be a boolean.");
|
|
4365
|
+
}
|
|
4366
|
+
return value;
|
|
4367
|
+
}
|
|
4368
|
+
function isPlainRecord(value) {
|
|
4369
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
4370
|
+
const prototype = Object.getPrototypeOf(value);
|
|
4371
|
+
return prototype === Object.prototype || prototype === null;
|
|
4372
|
+
}
|
|
4373
|
+
var init_security = __esm({
|
|
4374
|
+
"src/security.ts"() {
|
|
4375
|
+
"use strict";
|
|
4376
|
+
__name(resolveFarmSecurityConfig, "resolveFarmSecurityConfig");
|
|
4377
|
+
__name(serializeFarmCspDirectives, "serializeFarmCspDirectives");
|
|
4378
|
+
__name(normalizeDirectiveName, "normalizeDirectiveName");
|
|
4379
|
+
__name(validateDirectiveValue, "validateDirectiveValue");
|
|
4380
|
+
__name(validateSerializedCsp, "validateSerializedCsp");
|
|
4381
|
+
__name(validateReportOnly, "validateReportOnly");
|
|
4382
|
+
__name(isPlainRecord, "isPlainRecord");
|
|
4383
|
+
}
|
|
4384
|
+
});
|
|
4385
|
+
|
|
4257
4386
|
// src/write-file-if-changed.ts
|
|
4258
4387
|
function writeFileIfChanged(filePath, content) {
|
|
4259
4388
|
try {
|
|
@@ -8922,6 +9051,7 @@ var init_config2 = __esm({
|
|
|
8922
9051
|
init_config();
|
|
8923
9052
|
init_auth_config();
|
|
8924
9053
|
init_preload();
|
|
9054
|
+
init_security();
|
|
8925
9055
|
init_config_entry();
|
|
8926
9056
|
__name(getDeployTargetForPreset, "getDeployTargetForPreset");
|
|
8927
9057
|
DOCS_CONFIG_FILENAMES = [
|
|
@@ -19518,6 +19648,7 @@ init_devtools_config();
|
|
|
19518
19648
|
init_config();
|
|
19519
19649
|
init_auth_config();
|
|
19520
19650
|
init_preload();
|
|
19651
|
+
init_security();
|
|
19521
19652
|
var defaultDocsConfig = {
|
|
19522
19653
|
enabled: false,
|
|
19523
19654
|
entry: "/docs",
|
|
@@ -19585,6 +19716,7 @@ var _FarmApp = class _FarmApp {
|
|
|
19585
19716
|
routeRules: normalizeRouteRules(config.routeRules),
|
|
19586
19717
|
context: config.context || (() => void 0),
|
|
19587
19718
|
serverActions: resolveServerActionsConfig(config.serverActions),
|
|
19719
|
+
security: resolveFarmSecurityConfig(config.security),
|
|
19588
19720
|
images: resolveFarmImageConfig(config.images),
|
|
19589
19721
|
performance: resolveFarmPerformanceConfig(config.performance),
|
|
19590
19722
|
i18n: isResolvedI18nConfig(config.i18n) ? config.i18n : resolveFarmI18nConfig(config.i18n, {
|
|
@@ -22265,7 +22397,7 @@ function transformError(id, message) {
|
|
|
22265
22397
|
__name(transformError, "transformError");
|
|
22266
22398
|
|
|
22267
22399
|
// package.json
|
|
22268
|
-
var version = "0.1.0-beta.
|
|
22400
|
+
var version = "0.1.0-beta.17";
|
|
22269
22401
|
|
|
22270
22402
|
// src/version.ts
|
|
22271
22403
|
var FARM_VERSION = version;
|
|
@@ -22501,6 +22633,12 @@ function createFarmClientOptimizeDepsConfig(entries) {
|
|
|
22501
22633
|
};
|
|
22502
22634
|
}
|
|
22503
22635
|
__name(createFarmClientOptimizeDepsConfig, "createFarmClientOptimizeDepsConfig");
|
|
22636
|
+
function createFarmSourceAlias(projectRoot, srcDir = "src") {
|
|
22637
|
+
return {
|
|
22638
|
+
"@": import_node_path9.default.resolve(projectRoot, srcDir)
|
|
22639
|
+
};
|
|
22640
|
+
}
|
|
22641
|
+
__name(createFarmSourceAlias, "createFarmSourceAlias");
|
|
22504
22642
|
|
|
22505
22643
|
// src/vite.ts
|
|
22506
22644
|
init_fonts();
|
|
@@ -26259,7 +26397,7 @@ async function defineConfig2(config = {}) {
|
|
|
26259
26397
|
// Stub out problematic server-only modules during dev mode
|
|
26260
26398
|
alias: {
|
|
26261
26399
|
...getFarmLayerAliases(config.layers),
|
|
26262
|
-
|
|
26400
|
+
...createFarmSourceAlias(appRoot, config.srcDir),
|
|
26263
26401
|
// Nitro internals that should not be resolved in browser
|
|
26264
26402
|
"supports-color": "data:text/javascript,export default false; export const supportsColor = false; export const stdout = false; export const stderr = false;",
|
|
26265
26403
|
"@poppinss/dumper": "data:text/javascript,export default {};",
|