@easy-cms/core 0.1.0 → 0.1.1
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/index.js +28 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -896,7 +896,11 @@ function validateConfig(config) {
|
|
|
896
896
|
function validateSecret(secret, add) {
|
|
897
897
|
const hint = `set EASY_CMS_SECRET to a random string of at least ${MIN_SECRET_LENGTH} characters, e.g. \`openssl rand -hex 32\``;
|
|
898
898
|
if (typeof secret !== "string" || secret.length === 0) {
|
|
899
|
-
add(
|
|
899
|
+
add(
|
|
900
|
+
"secret",
|
|
901
|
+
"is required",
|
|
902
|
+
`${hint}. In production, set it in the server's environment: not every server reads .env (Nuxt's does not)`
|
|
903
|
+
);
|
|
900
904
|
} else if (secret.length < MIN_SECRET_LENGTH) {
|
|
901
905
|
add("secret", `must be at least ${MIN_SECRET_LENGTH} characters (got ${secret.length})`, hint);
|
|
902
906
|
}
|
|
@@ -1156,8 +1160,15 @@ var CONFIG_FILE_NAMES = [
|
|
|
1156
1160
|
];
|
|
1157
1161
|
function findConfigFile(cwd = process.cwd()) {
|
|
1158
1162
|
for (const name of CONFIG_FILE_NAMES) {
|
|
1159
|
-
const path = resolve(
|
|
1160
|
-
|
|
1163
|
+
const path = resolve(
|
|
1164
|
+
/* turbopackIgnore: true */
|
|
1165
|
+
cwd,
|
|
1166
|
+
name
|
|
1167
|
+
);
|
|
1168
|
+
if (existsSync(
|
|
1169
|
+
/* turbopackIgnore: true */
|
|
1170
|
+
path
|
|
1171
|
+
)) return path;
|
|
1161
1172
|
}
|
|
1162
1173
|
return void 0;
|
|
1163
1174
|
}
|
|
@@ -1361,9 +1372,16 @@ function collectSlots(fields, data, bySlug, slots) {
|
|
|
1361
1372
|
import { mkdir, readFile, rm, stat, writeFile } from "fs/promises";
|
|
1362
1373
|
import { dirname, isAbsolute, join, normalize, resolve as resolve2, sep } from "path";
|
|
1363
1374
|
function localStorage(options = {}) {
|
|
1364
|
-
let root = resolve2(
|
|
1375
|
+
let root = resolve2(
|
|
1376
|
+
/* turbopackIgnore: true */
|
|
1377
|
+
options.dir ?? "uploads"
|
|
1378
|
+
);
|
|
1365
1379
|
const pathOf = (key2) => {
|
|
1366
|
-
const path = normalize(join(
|
|
1380
|
+
const path = normalize(join(
|
|
1381
|
+
/* turbopackIgnore: true */
|
|
1382
|
+
root,
|
|
1383
|
+
key2
|
|
1384
|
+
));
|
|
1367
1385
|
if (!path.startsWith(root + sep)) throw new Error(`Invalid storage key "${key2}"`);
|
|
1368
1386
|
return path;
|
|
1369
1387
|
};
|
|
@@ -1371,7 +1389,11 @@ function localStorage(options = {}) {
|
|
|
1371
1389
|
name: "local",
|
|
1372
1390
|
init({ cwd }) {
|
|
1373
1391
|
const dir = options.dir ?? "uploads";
|
|
1374
|
-
root = isAbsolute(dir) ? dir : resolve2(
|
|
1392
|
+
root = isAbsolute(dir) ? dir : resolve2(
|
|
1393
|
+
/* turbopackIgnore: true */
|
|
1394
|
+
cwd,
|
|
1395
|
+
dir
|
|
1396
|
+
);
|
|
1375
1397
|
},
|
|
1376
1398
|
async put(key2, data) {
|
|
1377
1399
|
const path = pathOf(key2);
|