@kitsy/cnos 1.1.2 → 1.2.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/README.md +4 -1
- package/dist/browser/index.cjs +94 -0
- package/dist/browser/index.d.cts +16 -0
- package/dist/browser/index.d.ts +16 -0
- package/dist/browser/index.js +67 -0
- package/dist/build/index.cjs +2100 -0
- package/dist/build/index.d.cts +5 -0
- package/dist/build/index.d.ts +5 -0
- package/dist/build/index.js +14 -0
- package/dist/{chunk-33ZDYDQJ.js → chunk-APCTXRUN.js} +550 -349
- package/dist/{chunk-IHSV5AFX.js → chunk-EIN55XXA.js} +1 -1
- package/dist/chunk-JUHPBAEH.js +20 -0
- package/dist/{chunk-JQGGSNCL.js → chunk-MLQGYCO7.js} +1 -1
- package/dist/chunk-PQ4KSV76.js +50 -0
- package/dist/{chunk-IQOUWY6T.js → chunk-RD5WMHPM.js} +1 -1
- package/dist/chunk-SO5XREEU.js +179 -0
- package/dist/{chunk-7FBRVJD6.js → chunk-SXTMTACL.js} +2 -2
- package/dist/{chunk-53HXUSM6.js → chunk-WHUGFPE4.js} +1 -1
- package/dist/{chunk-HOS4E7XO.js → chunk-ZA74BO47.js} +1 -1
- package/dist/{envNaming-BrOk5ndZ.d.cts → envNaming-BTJpH93W.d.cts} +1 -1
- package/dist/{envNaming-DCaNdnrF.d.ts → envNaming-CcsqAel3.d.ts} +1 -1
- package/dist/index.cjs +242 -74
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +14 -132
- package/dist/internal.cjs +428 -10
- package/dist/internal.d.cts +29 -3
- package/dist/internal.d.ts +29 -3
- package/dist/internal.js +27 -1
- 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 +4 -4
- 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.cjs +29 -46
- 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.cjs +1 -1
- 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.cjs +4 -4
- 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/{plugin-BVNEHj19.d.cts → plugin-DkOIT5uI.d.cts} +30 -2
- package/dist/{plugin-BVNEHj19.d.ts → plugin-DkOIT5uI.d.ts} +30 -2
- package/dist/runtime/index.cjs +2288 -0
- package/dist/runtime/index.d.cts +23 -0
- package/dist/runtime/index.d.ts +23 -0
- package/dist/runtime/index.js +190 -0
- package/dist/{toPublicEnv-Gwz3xTK0.d.ts → toPublicEnv-C9clvXLo.d.ts} +1 -1
- package/dist/{toPublicEnv-Dd152fFy.d.cts → toPublicEnv-DvFeV3qG.d.cts} +1 -1
- package/package.json +16 -1
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
createCnos: () => createCnos2,
|
|
34
34
|
defaultPlugins: () => defaultPlugins,
|
|
35
35
|
planDump: () => planDump,
|
|
36
|
+
resolveBrowserData: () => resolveBrowserData,
|
|
36
37
|
toEnv: () => toEnv,
|
|
37
38
|
toPublicEnv: () => toPublicEnv,
|
|
38
39
|
writeDump: () => writeDump
|
|
@@ -53,6 +54,11 @@ var CnosManifestError = class extends CnosError {
|
|
|
53
54
|
}
|
|
54
55
|
manifestPath;
|
|
55
56
|
};
|
|
57
|
+
var CnosSecurityError = class extends CnosError {
|
|
58
|
+
constructor(message) {
|
|
59
|
+
super(message);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
56
62
|
var CnosKeyNotFoundError = class extends CnosError {
|
|
57
63
|
constructor(key) {
|
|
58
64
|
super(`Missing required CNOS config key: ${key}`);
|
|
@@ -212,6 +218,34 @@ var DEFAULT_FRAMEWORK_PREFIXES = {
|
|
|
212
218
|
vite: "VITE_",
|
|
213
219
|
nuxt: "NUXT_PUBLIC_"
|
|
214
220
|
};
|
|
221
|
+
var DEFAULT_NAMESPACES = {
|
|
222
|
+
value: {
|
|
223
|
+
kind: "data",
|
|
224
|
+
shareable: true
|
|
225
|
+
},
|
|
226
|
+
secret: {
|
|
227
|
+
kind: "data",
|
|
228
|
+
shareable: false,
|
|
229
|
+
sensitive: true
|
|
230
|
+
},
|
|
231
|
+
meta: {
|
|
232
|
+
kind: "system",
|
|
233
|
+
shareable: false,
|
|
234
|
+
readonly: true
|
|
235
|
+
},
|
|
236
|
+
public: {
|
|
237
|
+
kind: "projection",
|
|
238
|
+
source: "promote",
|
|
239
|
+
shareable: true,
|
|
240
|
+
readonly: true
|
|
241
|
+
},
|
|
242
|
+
env: {
|
|
243
|
+
kind: "projection",
|
|
244
|
+
source: "envMapping",
|
|
245
|
+
shareable: true,
|
|
246
|
+
readonly: true
|
|
247
|
+
}
|
|
248
|
+
};
|
|
215
249
|
function validateResolveFrom(resolveFrom) {
|
|
216
250
|
const validValues = ["cli.profile", "env.CNOS_PROFILE", "default"];
|
|
217
251
|
for (const entry of resolveFrom) {
|
|
@@ -232,6 +266,43 @@ function normalizeWorkspaceItems(items) {
|
|
|
232
266
|
])
|
|
233
267
|
);
|
|
234
268
|
}
|
|
269
|
+
function normalizeNamespaces(namespaces) {
|
|
270
|
+
const normalized = Object.fromEntries(
|
|
271
|
+
Object.entries(namespaces ?? {}).map(([namespace, definition]) => [
|
|
272
|
+
namespace,
|
|
273
|
+
{
|
|
274
|
+
kind: definition.kind ?? "data",
|
|
275
|
+
shareable: definition.shareable ?? false,
|
|
276
|
+
...definition.sensitive !== void 0 ? { sensitive: definition.sensitive } : {},
|
|
277
|
+
...definition.readonly !== void 0 ? { readonly: definition.readonly } : {},
|
|
278
|
+
...definition.source ? { source: definition.source } : {}
|
|
279
|
+
}
|
|
280
|
+
])
|
|
281
|
+
);
|
|
282
|
+
return {
|
|
283
|
+
...DEFAULT_NAMESPACES,
|
|
284
|
+
...normalized
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function normalizeVaults(vaults) {
|
|
288
|
+
return Object.fromEntries(
|
|
289
|
+
Object.entries(vaults ?? {}).map(([name, definition]) => {
|
|
290
|
+
const provider = definition.provider?.trim();
|
|
291
|
+
if (!provider) {
|
|
292
|
+
throw new CnosManifestError(`Vault "${name}" requires a provider`);
|
|
293
|
+
}
|
|
294
|
+
return [
|
|
295
|
+
name,
|
|
296
|
+
{
|
|
297
|
+
provider,
|
|
298
|
+
...definition.passphrase?.trim() ? {
|
|
299
|
+
passphrase: definition.passphrase.trim()
|
|
300
|
+
} : {}
|
|
301
|
+
}
|
|
302
|
+
];
|
|
303
|
+
})
|
|
304
|
+
);
|
|
305
|
+
}
|
|
235
306
|
function normalizeManifest(manifest) {
|
|
236
307
|
const version = manifest.version ?? 1;
|
|
237
308
|
if (version !== 1) {
|
|
@@ -316,6 +387,8 @@ function normalizeManifest(manifest) {
|
|
|
316
387
|
...manifest.public?.frameworks ?? {}
|
|
317
388
|
}
|
|
318
389
|
},
|
|
390
|
+
namespaces: normalizeNamespaces(manifest.namespaces),
|
|
391
|
+
vaults: normalizeVaults(manifest.vaults),
|
|
319
392
|
writePolicy: {
|
|
320
393
|
define: {
|
|
321
394
|
defaultProfile: manifest.writePolicy?.define?.defaultProfile ?? defaultProfile,
|
|
@@ -519,6 +592,86 @@ async function expandProfileChain(activeProfile, options = {}) {
|
|
|
519
592
|
};
|
|
520
593
|
}
|
|
521
594
|
|
|
595
|
+
// ../core/src/promotions/validatePromotion.ts
|
|
596
|
+
var DEFAULT_DATA_NAMESPACE = {
|
|
597
|
+
kind: "data",
|
|
598
|
+
shareable: false
|
|
599
|
+
};
|
|
600
|
+
function getNamespaceNameForKey(key) {
|
|
601
|
+
const [namespace] = key.split(".");
|
|
602
|
+
if (!namespace || !key.includes(".")) {
|
|
603
|
+
throw new CnosManifestError(`Logical key must be namespace-qualified: ${key}`);
|
|
604
|
+
}
|
|
605
|
+
return namespace;
|
|
606
|
+
}
|
|
607
|
+
function getNamespaceDefinition(manifest, namespaceOrKey) {
|
|
608
|
+
const namespace = namespaceOrKey.includes(".") ? getNamespaceNameForKey(namespaceOrKey) : namespaceOrKey;
|
|
609
|
+
return manifest.namespaces[namespace] ?? DEFAULT_DATA_NAMESPACE;
|
|
610
|
+
}
|
|
611
|
+
function ensureProjectionAllowed(manifest, key, target) {
|
|
612
|
+
const namespace = getNamespaceNameForKey(key);
|
|
613
|
+
const definition = getNamespaceDefinition(manifest, namespace);
|
|
614
|
+
if (definition.kind !== "data") {
|
|
615
|
+
throw new CnosManifestError(
|
|
616
|
+
`Cannot promote ${key} to ${target} because namespace "${namespace}" is not a data namespace.`
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
if (definition.sensitive) {
|
|
620
|
+
throw new CnosSecurityError(
|
|
621
|
+
`Cannot promote ${key} to ${target} because namespace "${namespace}" is sensitive.`
|
|
622
|
+
);
|
|
623
|
+
}
|
|
624
|
+
if (!definition.shareable) {
|
|
625
|
+
throw new CnosSecurityError(
|
|
626
|
+
`Cannot promote ${key} to ${target} because namespace "${namespace}" is not shareable.`
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
// ../core/src/promotions/promoteToPublic.ts
|
|
632
|
+
function toPublicKey(key) {
|
|
633
|
+
const namespace = getNamespaceNameForKey(key);
|
|
634
|
+
return namespace === "value" ? `public.${stripNamespace(key)}` : `public.${key}`;
|
|
635
|
+
}
|
|
636
|
+
function toPromotedConfigEntry(entry, key, promotedFrom) {
|
|
637
|
+
return {
|
|
638
|
+
...entry,
|
|
639
|
+
key,
|
|
640
|
+
namespace: "public",
|
|
641
|
+
sourceId: "public-promote",
|
|
642
|
+
pluginId: "core",
|
|
643
|
+
metadata: {
|
|
644
|
+
...entry.metadata ?? {},
|
|
645
|
+
promotedFrom
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
function toPromotedResolvedEntry(entry) {
|
|
650
|
+
const key = toPublicKey(entry.key);
|
|
651
|
+
return {
|
|
652
|
+
key,
|
|
653
|
+
value: entry.value,
|
|
654
|
+
namespace: "public",
|
|
655
|
+
winner: toPromotedConfigEntry(entry.winner, key, entry.key),
|
|
656
|
+
overridden: entry.overridden.map((override) => toPromotedConfigEntry(override, key, entry.key))
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
function promoteToPublic(graph, manifest) {
|
|
660
|
+
const entries = new Map(graph.entries);
|
|
661
|
+
for (const key of manifest.public.promote) {
|
|
662
|
+
ensureProjectionAllowed(manifest, key, "public");
|
|
663
|
+
const resolved = graph.entries.get(key);
|
|
664
|
+
if (!resolved) {
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
667
|
+
entries.set(toPublicKey(key), toPromotedResolvedEntry(resolved));
|
|
668
|
+
}
|
|
669
|
+
return {
|
|
670
|
+
...graph,
|
|
671
|
+
entries
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
|
|
522
675
|
// ../core/src/profiles/resolveActiveProfile.ts
|
|
523
676
|
function resolveActiveProfile(manifest, options = {}) {
|
|
524
677
|
for (const source of manifest.profiles.resolveFrom) {
|
|
@@ -1076,6 +1229,10 @@ function toEnv(graph, manifest, options = {}) {
|
|
|
1076
1229
|
if (!entry) {
|
|
1077
1230
|
continue;
|
|
1078
1231
|
}
|
|
1232
|
+
const namespaceDefinition = getNamespaceDefinition(manifest, entry.namespace);
|
|
1233
|
+
if (namespaceDefinition.kind !== "data" || !namespaceDefinition.shareable || namespaceDefinition.sensitive) {
|
|
1234
|
+
continue;
|
|
1235
|
+
}
|
|
1079
1236
|
if (entry.namespace === "secret" && !includeSecrets) {
|
|
1080
1237
|
continue;
|
|
1081
1238
|
}
|
|
@@ -1087,64 +1244,9 @@ function toEnv(graph, manifest, options = {}) {
|
|
|
1087
1244
|
return output;
|
|
1088
1245
|
}
|
|
1089
1246
|
|
|
1090
|
-
// ../core/src/utils/envNaming.ts
|
|
1091
|
-
function normalizeMappingConfig(config = {}) {
|
|
1092
|
-
return {
|
|
1093
|
-
convention: config.convention,
|
|
1094
|
-
explicit: config.explicit ?? {}
|
|
1095
|
-
};
|
|
1096
|
-
}
|
|
1097
|
-
function toScreamingSnakeSegment(segment) {
|
|
1098
|
-
return segment.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
|
|
1099
|
-
}
|
|
1100
|
-
function toScreamingSnake(path10) {
|
|
1101
|
-
return path10.split(".").map((segment) => toScreamingSnakeSegment(segment)).filter(Boolean).join("_");
|
|
1102
|
-
}
|
|
1103
|
-
function fromScreamingSnake(path10) {
|
|
1104
|
-
return path10.split("_").map((segment) => segment.trim().toLowerCase()).filter(Boolean).join(".");
|
|
1105
|
-
}
|
|
1106
|
-
function logicalKeyToEnvVar(key, config = {}) {
|
|
1107
|
-
const normalized = normalizeMappingConfig(config);
|
|
1108
|
-
const explicitEntry = Object.entries(normalized.explicit).find(([, logicalKey]) => logicalKey === key);
|
|
1109
|
-
if (explicitEntry) {
|
|
1110
|
-
return explicitEntry[0];
|
|
1111
|
-
}
|
|
1112
|
-
if (normalized.convention !== "SCREAMING_SNAKE") {
|
|
1113
|
-
return void 0;
|
|
1114
|
-
}
|
|
1115
|
-
if (key.startsWith("value.")) {
|
|
1116
|
-
return toScreamingSnake(key.slice("value.".length));
|
|
1117
|
-
}
|
|
1118
|
-
if (key.startsWith("secret.")) {
|
|
1119
|
-
return `SECRET_${toScreamingSnake(key.slice("secret.".length))}`;
|
|
1120
|
-
}
|
|
1121
|
-
return void 0;
|
|
1122
|
-
}
|
|
1123
|
-
function envVarToLogicalKey(envVar, config = {}) {
|
|
1124
|
-
const normalized = normalizeMappingConfig(config);
|
|
1125
|
-
const explicitMatch = normalized.explicit[envVar];
|
|
1126
|
-
if (explicitMatch) {
|
|
1127
|
-
return explicitMatch;
|
|
1128
|
-
}
|
|
1129
|
-
if (normalized.convention !== "SCREAMING_SNAKE") {
|
|
1130
|
-
return void 0;
|
|
1131
|
-
}
|
|
1132
|
-
if (envVar.startsWith("SECRET_")) {
|
|
1133
|
-
const stripped = envVar.slice("SECRET_".length);
|
|
1134
|
-
if (!stripped) {
|
|
1135
|
-
return void 0;
|
|
1136
|
-
}
|
|
1137
|
-
return `secret.${fromScreamingSnake(stripped)}`;
|
|
1138
|
-
}
|
|
1139
|
-
if (!/^[A-Z][A-Z0-9_]*$/.test(envVar)) {
|
|
1140
|
-
return void 0;
|
|
1141
|
-
}
|
|
1142
|
-
return `value.${fromScreamingSnake(envVar)}`;
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
1247
|
// ../core/src/runtime/toPublicEnv.ts
|
|
1146
|
-
function
|
|
1147
|
-
return
|
|
1248
|
+
function fallbackPublicEnvVar(valuePath) {
|
|
1249
|
+
return valuePath.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
|
|
1148
1250
|
}
|
|
1149
1251
|
function normalizeEnvValue2(value) {
|
|
1150
1252
|
if (value === void 0 || value === null) {
|
|
@@ -1171,22 +1273,12 @@ function resolvePublicPrefix(manifest, options) {
|
|
|
1171
1273
|
}
|
|
1172
1274
|
return configuredPrefix;
|
|
1173
1275
|
}
|
|
1174
|
-
function ensurePublicPromotionKey(key) {
|
|
1175
|
-
if (!key.startsWith("value.")) {
|
|
1176
|
-
throw new CnosManifestError(`public.promote may only contain value.* keys: ${key}`);
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
1276
|
function toPublicEnv(graph, manifest, options = {}) {
|
|
1180
1277
|
const prefix = resolvePublicPrefix(manifest, options);
|
|
1181
1278
|
const output = {};
|
|
1182
|
-
const promotions =
|
|
1183
|
-
for (const
|
|
1184
|
-
|
|
1185
|
-
const resolved = graph.entries.get(key);
|
|
1186
|
-
if (!resolved) {
|
|
1187
|
-
continue;
|
|
1188
|
-
}
|
|
1189
|
-
const baseEnvVar = logicalKeyToEnvVar(key, manifest.envMapping) ?? fallbackValueEnvVar(key);
|
|
1279
|
+
const promotions = Array.from(graph.entries.values()).filter((entry) => entry.namespace === "public").sort((left, right) => left.key.localeCompare(right.key));
|
|
1280
|
+
for (const resolved of promotions) {
|
|
1281
|
+
const baseEnvVar = fallbackPublicEnvVar(stripNamespace(resolved.key));
|
|
1190
1282
|
const envVar = prefix && !baseEnvVar.startsWith(prefix) ? `${prefix}${baseEnvVar}` : baseEnvVar;
|
|
1191
1283
|
output[envVar] = normalizeEnvValue2(resolved.value);
|
|
1192
1284
|
}
|
|
@@ -1330,6 +1422,9 @@ function appendMetaEntries(graph, cnosVersion) {
|
|
|
1330
1422
|
}
|
|
1331
1423
|
async function createCnos(options = {}) {
|
|
1332
1424
|
const loadedManifest = await loadManifest(options.root ? { root: options.root } : {});
|
|
1425
|
+
for (const key of loadedManifest.manifest.public.promote) {
|
|
1426
|
+
ensureProjectionAllowed(loadedManifest.manifest, key, "public");
|
|
1427
|
+
}
|
|
1333
1428
|
const workspaceFile = await loadWorkspaceFile(loadedManifest.repoRoot);
|
|
1334
1429
|
const workspace = await resolveWorkspaceContext(loadedManifest.manifest, {
|
|
1335
1430
|
manifestRoot: loadedManifest.manifestRoot,
|
|
@@ -1369,10 +1464,11 @@ async function createCnos(options = {}) {
|
|
|
1369
1464
|
workspace
|
|
1370
1465
|
});
|
|
1371
1466
|
const schemaApplied = applySchemaRules(graph, loadedManifest.manifest.schema);
|
|
1467
|
+
const promotedGraph = promoteToPublic(schemaApplied.graph, loadedManifest.manifest);
|
|
1372
1468
|
return createRuntime(
|
|
1373
1469
|
loadedManifest.manifest,
|
|
1374
1470
|
appendMetaEntries({
|
|
1375
|
-
...
|
|
1471
|
+
...promotedGraph,
|
|
1376
1472
|
profileSource: activeProfile.source
|
|
1377
1473
|
}, options.cnosVersion),
|
|
1378
1474
|
plugins
|
|
@@ -1425,10 +1521,42 @@ async function writeDump(graph, options) {
|
|
|
1425
1521
|
};
|
|
1426
1522
|
}
|
|
1427
1523
|
|
|
1524
|
+
// ../core/src/utils/envNaming.ts
|
|
1525
|
+
function normalizeMappingConfig(config = {}) {
|
|
1526
|
+
return {
|
|
1527
|
+
convention: config.convention,
|
|
1528
|
+
explicit: config.explicit ?? {}
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1531
|
+
function fromScreamingSnake(path10) {
|
|
1532
|
+
return path10.split("_").map((segment) => segment.trim().toLowerCase()).filter(Boolean).join(".");
|
|
1533
|
+
}
|
|
1534
|
+
function envVarToLogicalKey(envVar, config = {}) {
|
|
1535
|
+
const normalized = normalizeMappingConfig(config);
|
|
1536
|
+
const explicitMatch = normalized.explicit[envVar];
|
|
1537
|
+
if (explicitMatch) {
|
|
1538
|
+
return explicitMatch;
|
|
1539
|
+
}
|
|
1540
|
+
if (normalized.convention !== "SCREAMING_SNAKE") {
|
|
1541
|
+
return void 0;
|
|
1542
|
+
}
|
|
1543
|
+
if (envVar.startsWith("SECRET_")) {
|
|
1544
|
+
const stripped = envVar.slice("SECRET_".length);
|
|
1545
|
+
if (!stripped) {
|
|
1546
|
+
return void 0;
|
|
1547
|
+
}
|
|
1548
|
+
return `secret.${fromScreamingSnake(stripped)}`;
|
|
1549
|
+
}
|
|
1550
|
+
if (!/^[A-Z][A-Z0-9_]*$/.test(envVar)) {
|
|
1551
|
+
return void 0;
|
|
1552
|
+
}
|
|
1553
|
+
return `value.${fromScreamingSnake(envVar)}`;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1428
1556
|
// package.json
|
|
1429
1557
|
var package_default = {
|
|
1430
1558
|
name: "@kitsy/cnos",
|
|
1431
|
-
version: "1.
|
|
1559
|
+
version: "1.2.0",
|
|
1432
1560
|
description: "Batteries-included CNOS runtime package wired with the official plugins.",
|
|
1433
1561
|
type: "module",
|
|
1434
1562
|
main: "./dist/index.cjs",
|
|
@@ -1445,6 +1573,21 @@ var package_default = {
|
|
|
1445
1573
|
import: "./dist/internal.js",
|
|
1446
1574
|
require: "./dist/internal.cjs"
|
|
1447
1575
|
},
|
|
1576
|
+
"./runtime": {
|
|
1577
|
+
types: "./dist/runtime/index.d.ts",
|
|
1578
|
+
import: "./dist/runtime/index.js",
|
|
1579
|
+
require: "./dist/runtime/index.cjs"
|
|
1580
|
+
},
|
|
1581
|
+
"./browser": {
|
|
1582
|
+
types: "./dist/browser/index.d.ts",
|
|
1583
|
+
import: "./dist/browser/index.js",
|
|
1584
|
+
require: "./dist/browser/index.cjs"
|
|
1585
|
+
},
|
|
1586
|
+
"./build": {
|
|
1587
|
+
types: "./dist/build/index.d.ts",
|
|
1588
|
+
import: "./dist/build/index.js",
|
|
1589
|
+
require: "./dist/build/index.cjs"
|
|
1590
|
+
},
|
|
1448
1591
|
"./plugins/filesystem": {
|
|
1449
1592
|
types: "./dist/plugin/filesystem.d.ts",
|
|
1450
1593
|
import: "./dist/plugin/filesystem.js",
|
|
@@ -1834,7 +1977,7 @@ async function resolveSecretValue(value, processEnv) {
|
|
|
1834
1977
|
value.vault
|
|
1835
1978
|
);
|
|
1836
1979
|
}
|
|
1837
|
-
if (value.provider === "env") {
|
|
1980
|
+
if (value.provider === "env" || value.provider === "github-secrets") {
|
|
1838
1981
|
const resolved = processEnv?.[value.ref];
|
|
1839
1982
|
if (resolved === void 0) {
|
|
1840
1983
|
return value;
|
|
@@ -1970,19 +2113,44 @@ function defaultPlugins() {
|
|
|
1970
2113
|
];
|
|
1971
2114
|
}
|
|
1972
2115
|
|
|
2116
|
+
// src/runtime/state.ts
|
|
2117
|
+
var singletonRuntime;
|
|
2118
|
+
var singletonReady;
|
|
2119
|
+
function setSingletonRuntime(runtime) {
|
|
2120
|
+
singletonRuntime = runtime;
|
|
2121
|
+
singletonReady = Promise.resolve(runtime);
|
|
2122
|
+
return runtime;
|
|
2123
|
+
}
|
|
2124
|
+
|
|
1973
2125
|
// src/createCnos.ts
|
|
1974
2126
|
async function createCnos2(options = {}) {
|
|
1975
|
-
|
|
2127
|
+
const runtime = await createCnos({
|
|
1976
2128
|
...options,
|
|
1977
2129
|
cnosVersion: package_default.version,
|
|
1978
2130
|
plugins: [...defaultPlugins(), ...options.plugins ?? []]
|
|
1979
2131
|
});
|
|
2132
|
+
setSingletonRuntime(runtime);
|
|
2133
|
+
return runtime;
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
// src/build/index.ts
|
|
2137
|
+
async function resolveBrowserData(options = {}) {
|
|
2138
|
+
const runtime = await createCnos2(options);
|
|
2139
|
+
const browserData = {};
|
|
2140
|
+
for (const [key, entry] of runtime.graph.entries) {
|
|
2141
|
+
if (!key.startsWith("public.")) {
|
|
2142
|
+
continue;
|
|
2143
|
+
}
|
|
2144
|
+
browserData[key] = entry.value;
|
|
2145
|
+
}
|
|
2146
|
+
return browserData;
|
|
1980
2147
|
}
|
|
1981
2148
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1982
2149
|
0 && (module.exports = {
|
|
1983
2150
|
createCnos,
|
|
1984
2151
|
defaultPlugins,
|
|
1985
2152
|
planDump,
|
|
2153
|
+
resolveBrowserData,
|
|
1986
2154
|
toEnv,
|
|
1987
2155
|
toPublicEnv,
|
|
1988
2156
|
writeDump
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { R as ResolvedGraph, D as DumpPlanOptions, a as DumpPlan, b as DumpOptions, c as DumpResult, C as CnosCreateOptions, d as CnosRuntime, e as CnosPlugin } from './plugin-
|
|
2
|
-
export { f as ConfigEntry, I as InspectResult, L as LoaderPlugin, g as LogicalKey, M as ManifestFile, N as NormalizedManifest, T as ToEnvOptions, h as ToPublicEnvOptions } from './plugin-
|
|
3
|
-
export { t as toEnv, a as toPublicEnv } from './toPublicEnv-
|
|
1
|
+
import { R as ResolvedGraph, D as DumpPlanOptions, a as DumpPlan, b as DumpOptions, c as DumpResult, C as CnosCreateOptions, d as CnosRuntime, e as CnosPlugin } from './plugin-DkOIT5uI.cjs';
|
|
2
|
+
export { f as ConfigEntry, I as InspectResult, L as LoaderPlugin, g as LogicalKey, M as ManifestFile, N as NormalizedManifest, T as ToEnvOptions, h as ToPublicEnvOptions } from './plugin-DkOIT5uI.cjs';
|
|
3
|
+
export { t as toEnv, a as toPublicEnv } from './toPublicEnv-DvFeV3qG.cjs';
|
|
4
|
+
export { resolveBrowserData } from './build/index.cjs';
|
|
4
5
|
|
|
5
6
|
declare function planDump(graph: ResolvedGraph, options?: DumpPlanOptions): DumpPlan;
|
|
6
7
|
declare function writeDump(graph: ResolvedGraph, options: DumpOptions): Promise<DumpResult>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { R as ResolvedGraph, D as DumpPlanOptions, a as DumpPlan, b as DumpOptions, c as DumpResult, C as CnosCreateOptions, d as CnosRuntime, e as CnosPlugin } from './plugin-
|
|
2
|
-
export { f as ConfigEntry, I as InspectResult, L as LoaderPlugin, g as LogicalKey, M as ManifestFile, N as NormalizedManifest, T as ToEnvOptions, h as ToPublicEnvOptions } from './plugin-
|
|
3
|
-
export { t as toEnv, a as toPublicEnv } from './toPublicEnv-
|
|
1
|
+
import { R as ResolvedGraph, D as DumpPlanOptions, a as DumpPlan, b as DumpOptions, c as DumpResult, C as CnosCreateOptions, d as CnosRuntime, e as CnosPlugin } from './plugin-DkOIT5uI.js';
|
|
2
|
+
export { f as ConfigEntry, I as InspectResult, L as LoaderPlugin, g as LogicalKey, M as ManifestFile, N as NormalizedManifest, T as ToEnvOptions, h as ToPublicEnvOptions } from './plugin-DkOIT5uI.js';
|
|
3
|
+
export { t as toEnv, a as toPublicEnv } from './toPublicEnv-C9clvXLo.js';
|
|
4
|
+
export { resolveBrowserData } from './build/index.js';
|
|
4
5
|
|
|
5
6
|
declare function planDump(graph: ResolvedGraph, options?: DumpPlanOptions): DumpPlan;
|
|
6
7
|
declare function writeDump(graph: ResolvedGraph, options: DumpOptions): Promise<DumpResult>;
|
package/dist/index.js
CHANGED
|
@@ -1,145 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
createCliArgsPlugin
|
|
6
|
-
} from "./chunk-HOS4E7XO.js";
|
|
7
|
-
import {
|
|
8
|
-
createDotenvPlugin
|
|
9
|
-
} from "./chunk-IQOUWY6T.js";
|
|
10
|
-
import {
|
|
11
|
-
createEnvExportPlugin,
|
|
12
|
-
createPublicEnvExportPlugin
|
|
13
|
-
} from "./chunk-IHSV5AFX.js";
|
|
14
|
-
import {
|
|
15
|
-
createFilesystemSecretsPlugin,
|
|
16
|
-
createFilesystemValuesPlugin
|
|
17
|
-
} from "./chunk-7FBRVJD6.js";
|
|
18
|
-
import {
|
|
19
|
-
createProcessEnvPlugin
|
|
20
|
-
} from "./chunk-53HXUSM6.js";
|
|
2
|
+
resolveBrowserData
|
|
3
|
+
} from "./chunk-JUHPBAEH.js";
|
|
21
4
|
import {
|
|
22
5
|
createCnos,
|
|
23
|
-
|
|
6
|
+
defaultPlugins
|
|
7
|
+
} from "./chunk-SO5XREEU.js";
|
|
8
|
+
import "./chunk-SXTMTACL.js";
|
|
9
|
+
import "./chunk-WHUGFPE4.js";
|
|
10
|
+
import "./chunk-MLQGYCO7.js";
|
|
11
|
+
import "./chunk-ZA74BO47.js";
|
|
12
|
+
import "./chunk-RD5WMHPM.js";
|
|
13
|
+
import "./chunk-EIN55XXA.js";
|
|
14
|
+
import {
|
|
24
15
|
planDump,
|
|
25
16
|
toEnv,
|
|
26
17
|
toPublicEnv,
|
|
27
18
|
writeDump
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
|
|
30
|
-
// package.json
|
|
31
|
-
var package_default = {
|
|
32
|
-
name: "@kitsy/cnos",
|
|
33
|
-
version: "1.1.2",
|
|
34
|
-
description: "Batteries-included CNOS runtime package wired with the official plugins.",
|
|
35
|
-
type: "module",
|
|
36
|
-
main: "./dist/index.cjs",
|
|
37
|
-
module: "./dist/index.js",
|
|
38
|
-
types: "./dist/index.d.ts",
|
|
39
|
-
exports: {
|
|
40
|
-
".": {
|
|
41
|
-
types: "./dist/index.d.ts",
|
|
42
|
-
import: "./dist/index.js",
|
|
43
|
-
require: "./dist/index.cjs"
|
|
44
|
-
},
|
|
45
|
-
"./internal": {
|
|
46
|
-
types: "./dist/internal.d.ts",
|
|
47
|
-
import: "./dist/internal.js",
|
|
48
|
-
require: "./dist/internal.cjs"
|
|
49
|
-
},
|
|
50
|
-
"./plugins/filesystem": {
|
|
51
|
-
types: "./dist/plugin/filesystem.d.ts",
|
|
52
|
-
import: "./dist/plugin/filesystem.js",
|
|
53
|
-
require: "./dist/plugin/filesystem.cjs"
|
|
54
|
-
},
|
|
55
|
-
"./plugins/dotenv": {
|
|
56
|
-
types: "./dist/plugin/dotenv.d.ts",
|
|
57
|
-
import: "./dist/plugin/dotenv.js",
|
|
58
|
-
require: "./dist/plugin/dotenv.cjs"
|
|
59
|
-
},
|
|
60
|
-
"./plugins/process-env": {
|
|
61
|
-
types: "./dist/plugin/process-env.d.ts",
|
|
62
|
-
import: "./dist/plugin/process-env.js",
|
|
63
|
-
require: "./dist/plugin/process-env.cjs"
|
|
64
|
-
},
|
|
65
|
-
"./plugins/cli-args": {
|
|
66
|
-
types: "./dist/plugin/cli-args.d.ts",
|
|
67
|
-
import: "./dist/plugin/cli-args.js",
|
|
68
|
-
require: "./dist/plugin/cli-args.cjs"
|
|
69
|
-
},
|
|
70
|
-
"./plugins/basic-schema": {
|
|
71
|
-
types: "./dist/plugin/basic-schema.d.ts",
|
|
72
|
-
import: "./dist/plugin/basic-schema.js",
|
|
73
|
-
require: "./dist/plugin/basic-schema.cjs"
|
|
74
|
-
},
|
|
75
|
-
"./plugins/env-export": {
|
|
76
|
-
types: "./dist/plugin/env-export.d.ts",
|
|
77
|
-
import: "./dist/plugin/env-export.js",
|
|
78
|
-
require: "./dist/plugin/env-export.cjs"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
files: [
|
|
82
|
-
"dist"
|
|
83
|
-
],
|
|
84
|
-
license: "MIT",
|
|
85
|
-
repository: {
|
|
86
|
-
type: "git",
|
|
87
|
-
url: "https://github.com/kitsyai/cnos.git",
|
|
88
|
-
directory: "packages/cnos"
|
|
89
|
-
},
|
|
90
|
-
homepage: "https://github.com/kitsyai/cnos/tree/main/packages/cnos",
|
|
91
|
-
bugs: {
|
|
92
|
-
url: "https://github.com/kitsyai/cnos/issues"
|
|
93
|
-
},
|
|
94
|
-
keywords: [
|
|
95
|
-
"cnos",
|
|
96
|
-
"config",
|
|
97
|
-
"runtime"
|
|
98
|
-
],
|
|
99
|
-
publishConfig: {
|
|
100
|
-
access: "public"
|
|
101
|
-
},
|
|
102
|
-
dependencies: {
|
|
103
|
-
yaml: "^2.8.3"
|
|
104
|
-
},
|
|
105
|
-
scripts: {
|
|
106
|
-
build: "rimraf dist && tsup --config tsup.config.ts",
|
|
107
|
-
clean: "rimraf dist",
|
|
108
|
-
dev: "tsup --config tsup.config.ts --watch",
|
|
109
|
-
lint: "eslint src test",
|
|
110
|
-
prepack: "pnpm build",
|
|
111
|
-
test: "vitest run",
|
|
112
|
-
typecheck: "tsc -p tsconfig.json --noEmit"
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
// src/defaultPlugins.ts
|
|
117
|
-
function defaultPlugins() {
|
|
118
|
-
return [
|
|
119
|
-
createFilesystemValuesPlugin(),
|
|
120
|
-
createFilesystemSecretsPlugin(),
|
|
121
|
-
createDotenvPlugin(),
|
|
122
|
-
createProcessEnvPlugin(),
|
|
123
|
-
createCliArgsPlugin(),
|
|
124
|
-
createBasicSchemaPlugin(),
|
|
125
|
-
createEnvExportPlugin(),
|
|
126
|
-
createPublicEnvExportPlugin(),
|
|
127
|
-
createProvenanceInspector()
|
|
128
|
-
];
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// src/createCnos.ts
|
|
132
|
-
async function createCnos2(options = {}) {
|
|
133
|
-
return createCnos({
|
|
134
|
-
...options,
|
|
135
|
-
cnosVersion: package_default.version,
|
|
136
|
-
plugins: [...defaultPlugins(), ...options.plugins ?? []]
|
|
137
|
-
});
|
|
138
|
-
}
|
|
19
|
+
} from "./chunk-APCTXRUN.js";
|
|
139
20
|
export {
|
|
140
|
-
|
|
21
|
+
createCnos,
|
|
141
22
|
defaultPlugins,
|
|
142
23
|
planDump,
|
|
24
|
+
resolveBrowserData,
|
|
143
25
|
toEnv,
|
|
144
26
|
toPublicEnv,
|
|
145
27
|
writeDump
|