@kitsy/cnos 1.9.2 → 1.10.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/build/index.cjs +193 -18
- package/dist/build/index.d.cts +1 -1
- package/dist/build/index.d.ts +1 -1
- package/dist/build/index.js +8 -8
- package/dist/{chunk-2JBA2LXU.js → chunk-3EZGPQCE.js} +35 -6
- package/dist/{chunk-6QQPHDUI.js → chunk-A5U7EZCJ.js} +1 -1
- package/dist/{chunk-CPGRRZLP.js → chunk-CSA4L64V.js} +10 -10
- package/dist/{chunk-QK7BMU47.js → chunk-EIK7OUFP.js} +3 -3
- package/dist/{chunk-A2WG3ZKW.js → chunk-ESBHCFC6.js} +1 -1
- package/dist/{chunk-7JZO6XN3.js → chunk-FHXLOWAB.js} +1 -1
- package/dist/{chunk-7KVM5PUW.js → chunk-MQ4WG3K6.js} +158 -12
- package/dist/{chunk-LURQ4LAK.js → chunk-RTHKUGJV.js} +1 -1
- package/dist/{chunk-L7JVECPE.js → chunk-UGLATJJD.js} +1 -1
- package/dist/{chunk-NVFACB64.js → chunk-UKNL2Y4N.js} +1 -1
- package/dist/configure/index.cjs +193 -18
- package/dist/configure/index.d.cts +3 -3
- package/dist/configure/index.d.ts +3 -3
- package/dist/configure/index.js +8 -8
- package/dist/{core-zDTUSVx9.d.cts → core-Ud1o2MBn.d.cts} +12 -5
- package/dist/{core-zDTUSVx9.d.ts → core-Ud1o2MBn.d.ts} +12 -5
- package/dist/{envNaming-BkorOKW_.d.ts → envNaming-CPwXl4I6.d.ts} +1 -1
- package/dist/{envNaming-EFzezmB3.d.cts → envNaming-DxxqiGKN.d.cts} +1 -1
- package/dist/index.cjs +193 -18
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -10
- package/dist/internal.cjs +289 -31
- package/dist/internal.d.cts +31 -3
- package/dist/internal.d.ts +31 -3
- package/dist/internal.js +141 -23
- package/dist/plugin/basic-schema.cjs +9 -2
- package/dist/plugin/basic-schema.d.cts +1 -1
- package/dist/plugin/basic-schema.d.ts +1 -1
- package/dist/plugin/basic-schema.js +2 -2
- package/dist/plugin/cli-args.d.cts +1 -1
- package/dist/plugin/cli-args.d.ts +1 -1
- package/dist/plugin/cli-args.js +2 -2
- package/dist/plugin/dotenv.cjs +34 -5
- package/dist/plugin/dotenv.d.cts +2 -2
- package/dist/plugin/dotenv.d.ts +2 -2
- package/dist/plugin/dotenv.js +2 -2
- package/dist/plugin/env-export.d.cts +2 -2
- package/dist/plugin/env-export.d.ts +2 -2
- package/dist/plugin/env-export.js +2 -2
- package/dist/plugin/filesystem.d.cts +1 -1
- package/dist/plugin/filesystem.d.ts +1 -1
- package/dist/plugin/filesystem.js +2 -2
- package/dist/plugin/process-env.d.cts +2 -2
- package/dist/plugin/process-env.d.ts +2 -2
- package/dist/plugin/process-env.js +2 -2
- package/dist/runtime/index.cjs +193 -18
- package/dist/runtime/index.d.cts +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +10 -10
- package/dist/{toPublicEnv-CT265rzS.d.ts → toPublicEnv-C9wPSpRo.d.ts} +1 -1
- package/dist/{toPublicEnv-Ds1DRwCX.d.cts → toPublicEnv-fUZMRUOz.d.cts} +1 -1
- package/package.json +1 -1
package/dist/build/index.cjs
CHANGED
|
@@ -1340,6 +1340,134 @@ function stripNamespace(key) {
|
|
|
1340
1340
|
return key.split(".").slice(1).join(".");
|
|
1341
1341
|
}
|
|
1342
1342
|
|
|
1343
|
+
// ../core/src/spec/normalizeSpecRule.ts
|
|
1344
|
+
var ALLOWED_TYPES = /* @__PURE__ */ new Set(["string", "number", "boolean", "object", "array"]);
|
|
1345
|
+
var SECRET_FORBIDDEN_FIELDS = ["default", "examples", "enum"];
|
|
1346
|
+
function hasOwn(target, key) {
|
|
1347
|
+
return Object.prototype.hasOwnProperty.call(target, key);
|
|
1348
|
+
}
|
|
1349
|
+
function normalizeOptionalString(value, fieldName, logicalKey) {
|
|
1350
|
+
if (value === void 0) {
|
|
1351
|
+
return void 0;
|
|
1352
|
+
}
|
|
1353
|
+
if (typeof value !== "string") {
|
|
1354
|
+
throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: "${fieldName}" must be a string.`);
|
|
1355
|
+
}
|
|
1356
|
+
const nextValue = value.trim();
|
|
1357
|
+
return nextValue.length > 0 ? nextValue : void 0;
|
|
1358
|
+
}
|
|
1359
|
+
function normalizeStringArray(value, fieldName, logicalKey) {
|
|
1360
|
+
if (value === void 0) {
|
|
1361
|
+
return void 0;
|
|
1362
|
+
}
|
|
1363
|
+
if (!Array.isArray(value)) {
|
|
1364
|
+
throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: "${fieldName}" must be an array.`);
|
|
1365
|
+
}
|
|
1366
|
+
const nextValue = value.map((entry) => {
|
|
1367
|
+
if (typeof entry !== "string") {
|
|
1368
|
+
throw new CnosManifestError(
|
|
1369
|
+
`Invalid schema rule for ${logicalKey}: "${fieldName}" entries must be strings.`
|
|
1370
|
+
);
|
|
1371
|
+
}
|
|
1372
|
+
return entry.trim();
|
|
1373
|
+
}).filter(Boolean);
|
|
1374
|
+
return nextValue.length > 0 ? nextValue : void 0;
|
|
1375
|
+
}
|
|
1376
|
+
function normalizeUnknownArray(value, fieldName, logicalKey) {
|
|
1377
|
+
if (value === void 0) {
|
|
1378
|
+
return void 0;
|
|
1379
|
+
}
|
|
1380
|
+
if (!Array.isArray(value)) {
|
|
1381
|
+
throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: "${fieldName}" must be an array.`);
|
|
1382
|
+
}
|
|
1383
|
+
return value.length > 0 ? value : void 0;
|
|
1384
|
+
}
|
|
1385
|
+
function assertValidPatternRegex(pattern, logicalKey) {
|
|
1386
|
+
try {
|
|
1387
|
+
void new RegExp(pattern);
|
|
1388
|
+
} catch (error) {
|
|
1389
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
1390
|
+
throw new CnosManifestError(
|
|
1391
|
+
`Invalid schema rule for ${logicalKey}: "pattern" must be a valid regex (${reason}).`
|
|
1392
|
+
);
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
function assertSecretRuleSafety(logicalKey, rule) {
|
|
1396
|
+
if (!logicalKey.startsWith("secret.")) {
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1399
|
+
const offendingFields = SECRET_FORBIDDEN_FIELDS.filter((field) => hasOwn(rule, field));
|
|
1400
|
+
if (offendingFields.length === 0) {
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
throw new CnosManifestError(
|
|
1404
|
+
`Invalid schema rule for ${logicalKey}: secret specs cannot include ${offendingFields.join(", ")}. Store secret values in the vault, not schema metadata. Remove ${offendingFields.map((field) => `schema.${logicalKey}.${field}`).join(", ")} to continue.`
|
|
1405
|
+
);
|
|
1406
|
+
}
|
|
1407
|
+
function normalizeSpecRule(logicalKey, rule) {
|
|
1408
|
+
if (!rule || typeof rule !== "object" || Array.isArray(rule)) {
|
|
1409
|
+
throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: expected an object.`);
|
|
1410
|
+
}
|
|
1411
|
+
const candidate = rule;
|
|
1412
|
+
assertSecretRuleSafety(logicalKey, candidate);
|
|
1413
|
+
const normalized = {};
|
|
1414
|
+
if (candidate.type !== void 0) {
|
|
1415
|
+
if (typeof candidate.type !== "string" || !ALLOWED_TYPES.has(candidate.type)) {
|
|
1416
|
+
throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: unsupported type "${String(candidate.type)}".`);
|
|
1417
|
+
}
|
|
1418
|
+
normalized.type = candidate.type;
|
|
1419
|
+
}
|
|
1420
|
+
if (candidate.required !== void 0) {
|
|
1421
|
+
if (typeof candidate.required !== "boolean") {
|
|
1422
|
+
throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: "required" must be a boolean.`);
|
|
1423
|
+
}
|
|
1424
|
+
normalized.required = candidate.required;
|
|
1425
|
+
}
|
|
1426
|
+
if (hasOwn(candidate, "default")) {
|
|
1427
|
+
normalized.default = candidate.default;
|
|
1428
|
+
}
|
|
1429
|
+
const normalizedEnum = normalizeUnknownArray(candidate.enum, "enum", logicalKey);
|
|
1430
|
+
if (normalizedEnum !== void 0) {
|
|
1431
|
+
normalized.enum = normalizedEnum;
|
|
1432
|
+
}
|
|
1433
|
+
const normalizedPattern = normalizeOptionalString(candidate.pattern, "pattern", logicalKey);
|
|
1434
|
+
if (normalizedPattern !== void 0) {
|
|
1435
|
+
assertValidPatternRegex(normalizedPattern, logicalKey);
|
|
1436
|
+
normalized.pattern = normalizedPattern;
|
|
1437
|
+
}
|
|
1438
|
+
const normalizedSummary = normalizeOptionalString(candidate.summary, "summary", logicalKey);
|
|
1439
|
+
if (normalizedSummary !== void 0) {
|
|
1440
|
+
normalized.summary = normalizedSummary;
|
|
1441
|
+
}
|
|
1442
|
+
const normalizedDescription = normalizeOptionalString(candidate.description, "description", logicalKey);
|
|
1443
|
+
if (normalizedDescription !== void 0) {
|
|
1444
|
+
normalized.description = normalizedDescription;
|
|
1445
|
+
}
|
|
1446
|
+
const normalizedExamples = normalizeUnknownArray(candidate.examples, "examples", logicalKey);
|
|
1447
|
+
if (normalizedExamples !== void 0) {
|
|
1448
|
+
normalized.examples = normalizedExamples;
|
|
1449
|
+
}
|
|
1450
|
+
const normalizedUsedBy = normalizeStringArray(candidate.usedBy, "usedBy", logicalKey);
|
|
1451
|
+
if (normalizedUsedBy !== void 0) {
|
|
1452
|
+
normalized.usedBy = normalizedUsedBy;
|
|
1453
|
+
}
|
|
1454
|
+
if (candidate.deprecated !== void 0) {
|
|
1455
|
+
if (typeof candidate.deprecated !== "boolean") {
|
|
1456
|
+
throw new CnosManifestError(`Invalid schema rule for ${logicalKey}: "deprecated" must be a boolean.`);
|
|
1457
|
+
}
|
|
1458
|
+
normalized.deprecated = candidate.deprecated;
|
|
1459
|
+
}
|
|
1460
|
+
const normalizedDeprecationMessage = normalizeOptionalString(
|
|
1461
|
+
candidate.deprecationMessage,
|
|
1462
|
+
"deprecationMessage",
|
|
1463
|
+
logicalKey
|
|
1464
|
+
);
|
|
1465
|
+
if (normalizedDeprecationMessage !== void 0) {
|
|
1466
|
+
normalized.deprecationMessage = normalizedDeprecationMessage;
|
|
1467
|
+
}
|
|
1468
|
+
return normalized;
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1343
1471
|
// ../core/src/manifest/normalizeManifest.ts
|
|
1344
1472
|
var DEFAULT_RESOLVE_FROM = ["cli.profile", "env.CNOS_PROFILE", "default"];
|
|
1345
1473
|
var DEFAULT_LOADERS = [
|
|
@@ -1538,6 +1666,14 @@ function normalizeVaultAuth(vaultName, provider, auth) {
|
|
|
1538
1666
|
...auth?.config ? { config: auth.config } : {}
|
|
1539
1667
|
};
|
|
1540
1668
|
}
|
|
1669
|
+
function normalizeSchema(schema) {
|
|
1670
|
+
return Object.fromEntries(
|
|
1671
|
+
Object.entries(schema ?? {}).map(([logicalKey, rule]) => [
|
|
1672
|
+
logicalKey,
|
|
1673
|
+
normalizeSpecRule(logicalKey, rule)
|
|
1674
|
+
])
|
|
1675
|
+
);
|
|
1676
|
+
}
|
|
1541
1677
|
function normalizeManifest(manifest) {
|
|
1542
1678
|
const version = manifest.version ?? 1;
|
|
1543
1679
|
if (version !== 1) {
|
|
@@ -1635,7 +1771,7 @@ function normalizeManifest(manifest) {
|
|
|
1635
1771
|
}
|
|
1636
1772
|
}
|
|
1637
1773
|
},
|
|
1638
|
-
schema: manifest.schema
|
|
1774
|
+
schema: normalizeSchema(manifest.schema)
|
|
1639
1775
|
};
|
|
1640
1776
|
}
|
|
1641
1777
|
|
|
@@ -2269,6 +2405,13 @@ function enumMatches(value, allowed) {
|
|
|
2269
2405
|
const serialized = JSON.stringify(value);
|
|
2270
2406
|
return allowed.some((candidate) => JSON.stringify(candidate) === serialized);
|
|
2271
2407
|
}
|
|
2408
|
+
function testPattern(pattern, value) {
|
|
2409
|
+
try {
|
|
2410
|
+
return new RegExp(pattern).test(value);
|
|
2411
|
+
} catch {
|
|
2412
|
+
return false;
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2272
2415
|
function applySchemaRules(graph, schema) {
|
|
2273
2416
|
const nextEntries = new Map(graph.entries);
|
|
2274
2417
|
const issues = [];
|
|
@@ -2335,11 +2478,11 @@ function applySchemaRules(graph, schema) {
|
|
|
2335
2478
|
key,
|
|
2336
2479
|
message: `Config key ${key} must be a string to match pattern ${rule.pattern}`
|
|
2337
2480
|
});
|
|
2338
|
-
} else if (!
|
|
2481
|
+
} else if (!testPattern(rule.pattern, coercedValue)) {
|
|
2339
2482
|
issues.push({
|
|
2340
2483
|
code: "schema.pattern",
|
|
2341
2484
|
key,
|
|
2342
|
-
message: `Config key ${key} does not match pattern ${rule.pattern}
|
|
2485
|
+
message: `Config key ${key} does not match pattern ${rule.pattern} (or the pattern is invalid).`
|
|
2343
2486
|
});
|
|
2344
2487
|
}
|
|
2345
2488
|
}
|
|
@@ -2739,16 +2882,19 @@ function resolveVaultDefinition(vaults, vault = "default") {
|
|
|
2739
2882
|
// ../core/src/secrets/auditLog.ts
|
|
2740
2883
|
async function appendAuditEvent(event, processEnv = process.env) {
|
|
2741
2884
|
const auditFile = processEnv.CNOS_AUDIT_FILE ?? import_node_path12.default.join(resolveSecretStoreRoot(processEnv), "audit", "access.log");
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2885
|
+
try {
|
|
2886
|
+
await (0, import_promises11.mkdir)(import_node_path12.default.dirname(auditFile), { recursive: true });
|
|
2887
|
+
await (0, import_promises11.appendFile)(
|
|
2888
|
+
auditFile,
|
|
2889
|
+
`${JSON.stringify({
|
|
2890
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2891
|
+
...event
|
|
2892
|
+
})}
|
|
2749
2893
|
`,
|
|
2750
|
-
|
|
2751
|
-
|
|
2894
|
+
"utf8"
|
|
2895
|
+
);
|
|
2896
|
+
} catch {
|
|
2897
|
+
}
|
|
2752
2898
|
}
|
|
2753
2899
|
|
|
2754
2900
|
// ../core/src/secrets/secretCache.ts
|
|
@@ -3720,7 +3866,7 @@ function envVarToLogicalKey(envVar, config = {}) {
|
|
|
3720
3866
|
// package.json
|
|
3721
3867
|
var package_default = {
|
|
3722
3868
|
name: "@kitsy/cnos",
|
|
3723
|
-
version: "1.
|
|
3869
|
+
version: "1.10.0",
|
|
3724
3870
|
description: "Batteries-included CNOS runtime package wired with the official plugins.",
|
|
3725
3871
|
type: "module",
|
|
3726
3872
|
main: "./dist/index.cjs",
|
|
@@ -3925,9 +4071,30 @@ var DOTENV_PLUGIN_ID = "@kitsy/cnos/plugins/dotenv";
|
|
|
3925
4071
|
function parseDoubleQuoted(value) {
|
|
3926
4072
|
return value.replace(/\\n/g, "\n").replace(/\\r/g, "\r").replace(/\\t/g, " ").replace(/\\"/g, '"').replace(/\\\\/g, "\\");
|
|
3927
4073
|
}
|
|
4074
|
+
function isEscapedCharacter(value, index) {
|
|
4075
|
+
let slashCount = 0;
|
|
4076
|
+
for (let cursor = index - 1; cursor >= 0 && value[cursor] === "\\"; cursor -= 1) {
|
|
4077
|
+
slashCount += 1;
|
|
4078
|
+
}
|
|
4079
|
+
return slashCount % 2 === 1;
|
|
4080
|
+
}
|
|
4081
|
+
function findClosingQuote(value, quote) {
|
|
4082
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
4083
|
+
if (value[index] !== quote) {
|
|
4084
|
+
continue;
|
|
4085
|
+
}
|
|
4086
|
+
if (quote === '"' && isEscapedCharacter(value, index)) {
|
|
4087
|
+
continue;
|
|
4088
|
+
}
|
|
4089
|
+
return index;
|
|
4090
|
+
}
|
|
4091
|
+
return -1;
|
|
4092
|
+
}
|
|
3928
4093
|
function parseDotenv(document) {
|
|
3929
4094
|
const parsed = {};
|
|
3930
|
-
|
|
4095
|
+
const lines = document.split(/\r?\n/);
|
|
4096
|
+
for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
|
|
4097
|
+
const rawLine = lines[lineIndex] ?? "";
|
|
3931
4098
|
const line = rawLine.trim();
|
|
3932
4099
|
if (!line || line.startsWith("#")) {
|
|
3933
4100
|
continue;
|
|
@@ -3942,10 +4109,18 @@ function parseDotenv(document) {
|
|
|
3942
4109
|
if (!envVar) {
|
|
3943
4110
|
continue;
|
|
3944
4111
|
}
|
|
3945
|
-
if (value.startsWith('"')
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
4112
|
+
if (value.startsWith('"') || value.startsWith("'")) {
|
|
4113
|
+
const quote = value.startsWith('"') ? '"' : "'";
|
|
4114
|
+
let quotedContent = value.slice(1);
|
|
4115
|
+
let closingIndex = findClosingQuote(quotedContent, quote);
|
|
4116
|
+
while (closingIndex === -1 && lineIndex < lines.length - 1) {
|
|
4117
|
+
lineIndex += 1;
|
|
4118
|
+
quotedContent = `${quotedContent}
|
|
4119
|
+
${lines[lineIndex] ?? ""}`;
|
|
4120
|
+
closingIndex = findClosingQuote(quotedContent, quote);
|
|
4121
|
+
}
|
|
4122
|
+
const rawQuotedValue = closingIndex === -1 ? quotedContent : quotedContent.slice(0, closingIndex);
|
|
4123
|
+
value = quote === '"' ? parseDoubleQuoted(rawQuotedValue) : rawQuotedValue;
|
|
3949
4124
|
} else {
|
|
3950
4125
|
value = value.replace(/\s+#.*$/, "").trim();
|
|
3951
4126
|
}
|
package/dist/build/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CnosCreateOptions, S as ServerProjection } from '../core-
|
|
1
|
+
import { C as CnosCreateOptions, S as ServerProjection } from '../core-Ud1o2MBn.cjs';
|
|
2
2
|
|
|
3
3
|
type BrowserDataMap = Record<string, unknown>;
|
|
4
4
|
type FrameworkEnvTarget = 'generic' | 'vite' | 'next' | 'webpack' | (string & {});
|
package/dist/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CnosCreateOptions, S as ServerProjection } from '../core-
|
|
1
|
+
import { C as CnosCreateOptions, S as ServerProjection } from '../core-Ud1o2MBn.js';
|
|
2
2
|
|
|
3
3
|
type BrowserDataMap = Record<string, unknown>;
|
|
4
4
|
type FrameworkEnvTarget = 'generic' | 'vite' | 'next' | 'webpack' | (string & {});
|
package/dist/build/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCnos
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-CSA4L64V.js";
|
|
4
|
+
import "../chunk-3EZGPQCE.js";
|
|
5
|
+
import "../chunk-RTHKUGJV.js";
|
|
6
|
+
import "../chunk-ESBHCFC6.js";
|
|
7
|
+
import "../chunk-UGLATJJD.js";
|
|
8
|
+
import "../chunk-A5U7EZCJ.js";
|
|
9
|
+
import "../chunk-FHXLOWAB.js";
|
|
10
10
|
import {
|
|
11
11
|
CnosManifestError,
|
|
12
12
|
createSecretVaultProvider,
|
|
13
13
|
isSecretReference
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-MQ4WG3K6.js";
|
|
15
15
|
|
|
16
16
|
// src/build/index.ts
|
|
17
17
|
async function resolveBrowserData(options = {}) {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
envVarToLogicalKey,
|
|
3
3
|
resolveWorkspaceScopedPath,
|
|
4
4
|
toPortablePath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MQ4WG3K6.js";
|
|
6
6
|
|
|
7
7
|
// ../../plugins/dotenv/src/index.ts
|
|
8
8
|
import { readFile } from "fs/promises";
|
|
@@ -11,9 +11,30 @@ var DOTENV_PLUGIN_ID = "@kitsy/cnos/plugins/dotenv";
|
|
|
11
11
|
function parseDoubleQuoted(value) {
|
|
12
12
|
return value.replace(/\\n/g, "\n").replace(/\\r/g, "\r").replace(/\\t/g, " ").replace(/\\"/g, '"').replace(/\\\\/g, "\\");
|
|
13
13
|
}
|
|
14
|
+
function isEscapedCharacter(value, index) {
|
|
15
|
+
let slashCount = 0;
|
|
16
|
+
for (let cursor = index - 1; cursor >= 0 && value[cursor] === "\\"; cursor -= 1) {
|
|
17
|
+
slashCount += 1;
|
|
18
|
+
}
|
|
19
|
+
return slashCount % 2 === 1;
|
|
20
|
+
}
|
|
21
|
+
function findClosingQuote(value, quote) {
|
|
22
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
23
|
+
if (value[index] !== quote) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (quote === '"' && isEscapedCharacter(value, index)) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
return index;
|
|
30
|
+
}
|
|
31
|
+
return -1;
|
|
32
|
+
}
|
|
14
33
|
function parseDotenv(document) {
|
|
15
34
|
const parsed = {};
|
|
16
|
-
|
|
35
|
+
const lines = document.split(/\r?\n/);
|
|
36
|
+
for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
|
|
37
|
+
const rawLine = lines[lineIndex] ?? "";
|
|
17
38
|
const line = rawLine.trim();
|
|
18
39
|
if (!line || line.startsWith("#")) {
|
|
19
40
|
continue;
|
|
@@ -28,10 +49,18 @@ function parseDotenv(document) {
|
|
|
28
49
|
if (!envVar) {
|
|
29
50
|
continue;
|
|
30
51
|
}
|
|
31
|
-
if (value.startsWith('"')
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
52
|
+
if (value.startsWith('"') || value.startsWith("'")) {
|
|
53
|
+
const quote = value.startsWith('"') ? '"' : "'";
|
|
54
|
+
let quotedContent = value.slice(1);
|
|
55
|
+
let closingIndex = findClosingQuote(quotedContent, quote);
|
|
56
|
+
while (closingIndex === -1 && lineIndex < lines.length - 1) {
|
|
57
|
+
lineIndex += 1;
|
|
58
|
+
quotedContent = `${quotedContent}
|
|
59
|
+
${lines[lineIndex] ?? ""}`;
|
|
60
|
+
closingIndex = findClosingQuote(quotedContent, quote);
|
|
61
|
+
}
|
|
62
|
+
const rawQuotedValue = closingIndex === -1 ? quotedContent : quotedContent.slice(0, closingIndex);
|
|
63
|
+
value = quote === '"' ? parseDoubleQuoted(rawQuotedValue) : rawQuotedValue;
|
|
35
64
|
} else {
|
|
36
65
|
value = value.replace(/\s+#.*$/, "").trim();
|
|
37
66
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createDotenvPlugin
|
|
3
|
+
} from "./chunk-3EZGPQCE.js";
|
|
1
4
|
import {
|
|
2
5
|
createEnvExportPlugin,
|
|
3
6
|
createPublicEnvExportPlugin
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RTHKUGJV.js";
|
|
5
8
|
import {
|
|
6
9
|
createFilesystemSecretsPlugin,
|
|
7
10
|
createFilesystemValuesPlugin
|
|
8
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ESBHCFC6.js";
|
|
9
12
|
import {
|
|
10
13
|
createProcessEnvPlugin
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UGLATJJD.js";
|
|
12
15
|
import {
|
|
13
16
|
createBasicSchemaPlugin
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-A5U7EZCJ.js";
|
|
15
18
|
import {
|
|
16
19
|
createCliArgsPlugin
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import {
|
|
19
|
-
createDotenvPlugin
|
|
20
|
-
} from "./chunk-2JBA2LXU.js";
|
|
20
|
+
} from "./chunk-FHXLOWAB.js";
|
|
21
21
|
import {
|
|
22
22
|
createCnos,
|
|
23
23
|
createProvenanceInspector
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-MQ4WG3K6.js";
|
|
25
25
|
|
|
26
26
|
// src/defaultPlugins.ts
|
|
27
27
|
function defaultPlugins() {
|
|
@@ -68,7 +68,7 @@ function setBootstrappedSecretHydrationRequired(value) {
|
|
|
68
68
|
// package.json
|
|
69
69
|
var package_default = {
|
|
70
70
|
name: "@kitsy/cnos",
|
|
71
|
-
version: "1.
|
|
71
|
+
version: "1.10.0",
|
|
72
72
|
description: "Batteries-included CNOS runtime package wired with the official plugins.",
|
|
73
73
|
type: "module",
|
|
74
74
|
main: "./dist/index.cjs",
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
graphRequiresSecretHydration,
|
|
4
4
|
readRuntimeGraphFromEnv,
|
|
5
5
|
readServerProjectionFromEnv
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UKNL2Y4N.js";
|
|
7
7
|
import {
|
|
8
8
|
createCnos,
|
|
9
9
|
getBootstrappedSecretHydrationRequired,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
setBootstrappedSecretHydrationRequired,
|
|
13
13
|
setSingletonReady,
|
|
14
14
|
setSingletonRuntime
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CSA4L64V.js";
|
|
16
16
|
import {
|
|
17
17
|
createDefaultRuntimeProviders,
|
|
18
18
|
createDerivedRuntimeSupport,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
toLogicalKey,
|
|
29
29
|
toNamespaceObject,
|
|
30
30
|
toPublicEnv
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-MQ4WG3K6.js";
|
|
32
32
|
|
|
33
33
|
// src/runtime/index.ts
|
|
34
34
|
import { existsSync, readFileSync } from "fs";
|