@kitsy/cnos 1.2.0 → 1.4.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 +3 -3
- package/dist/build/index.cjs +1003 -121
- package/dist/build/index.d.cts +1 -1
- package/dist/build/index.d.ts +1 -1
- package/dist/build/index.js +22 -10
- package/dist/{chunk-APCTXRUN.js → chunk-APIU4GTB.js} +1012 -195
- package/dist/chunk-EQSKV3DP.js +105 -0
- package/dist/{chunk-MLQGYCO7.js → chunk-FWJC4Y2D.js} +1 -1
- package/dist/{chunk-RD5WMHPM.js → chunk-HMM76UYZ.js} +1 -1
- package/dist/{chunk-EIN55XXA.js → chunk-J4K4JUJL.js} +1 -1
- package/dist/{chunk-SO5XREEU.js → chunk-JSBVYK2T.js} +32 -11
- package/dist/chunk-LJD4SM32.js +189 -0
- package/dist/{chunk-SXTMTACL.js → chunk-T6Y57KTT.js} +20 -31
- package/dist/chunk-WCHX2QFY.js +115 -0
- package/dist/{chunk-ZA74BO47.js → chunk-ZTPSFXWP.js} +1 -1
- package/dist/configure/index.cjs +3021 -0
- package/dist/configure/index.d.cts +12 -0
- package/dist/configure/index.d.ts +12 -0
- package/dist/configure/index.js +24 -0
- package/dist/{envNaming-CcsqAel3.d.ts → envNaming-Dvm_LP2D.d.ts} +1 -1
- package/dist/{envNaming-BTJpH93W.d.cts → envNaming-S4B-dHUx.d.cts} +1 -1
- package/dist/index.cjs +1243 -186
- package/dist/index.d.cts +2 -13
- package/dist/index.d.ts +2 -13
- package/dist/index.js +13 -25
- package/dist/internal.cjs +1525 -81
- package/dist/internal.d.cts +171 -14
- package/dist/internal.d.ts +171 -14
- package/dist/internal.js +652 -5
- package/dist/plugin/basic-schema.cjs +29 -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.cjs +29 -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 +36 -9
- 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 +31 -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.cjs +65 -91
- 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 +105 -11
- package/dist/plugin/process-env.d.cts +4 -3
- package/dist/plugin/process-env.d.ts +4 -3
- package/dist/plugin/process-env.js +6 -4
- package/dist/{plugin-DkOIT5uI.d.cts → plugin-B4xwySxw.d.cts} +15 -2
- package/dist/{plugin-DkOIT5uI.d.ts → plugin-B4xwySxw.d.ts} +15 -2
- package/dist/runtime/index.cjs +1057 -136
- package/dist/runtime/index.d.cts +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +11 -186
- package/dist/{toPublicEnv-C9clvXLo.d.ts → toPublicEnv-CvhGAfsB.d.ts} +1 -1
- package/dist/{toPublicEnv-DvFeV3qG.d.cts → toPublicEnv-ggmphZFs.d.cts} +1 -1
- package/package.json +11 -1
- package/dist/chunk-JUHPBAEH.js +0 -20
- package/dist/chunk-PQ4KSV76.js +0 -50
- package/dist/chunk-WHUGFPE4.js +0 -49
package/dist/runtime/index.d.cts
CHANGED
package/dist/runtime/index.d.ts
CHANGED
package/dist/runtime/index.js
CHANGED
|
@@ -1,190 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-MLQGYCO7.js";
|
|
14
|
-
import "../chunk-ZA74BO47.js";
|
|
15
|
-
import "../chunk-RD5WMHPM.js";
|
|
16
|
-
import "../chunk-EIN55XXA.js";
|
|
17
|
-
import {
|
|
18
|
-
inspectValue,
|
|
19
|
-
readOrValue,
|
|
20
|
-
readValue,
|
|
21
|
-
requireValue,
|
|
22
|
-
toEnv,
|
|
23
|
-
toLogicalKey,
|
|
24
|
-
toNamespaceObject,
|
|
25
|
-
toPublicEnv
|
|
26
|
-
} from "../chunk-APCTXRUN.js";
|
|
27
|
-
|
|
28
|
-
// src/runtime/index.ts
|
|
29
|
-
var NOT_READY_MESSAGE = "CNOS not initialized. Call await cnos.ready() or use cnos run.";
|
|
30
|
-
function getRuntimeOrThrow() {
|
|
31
|
-
const runtime = getSingletonRuntime();
|
|
32
|
-
if (!runtime) {
|
|
33
|
-
throw new Error(NOT_READY_MESSAGE);
|
|
34
|
-
}
|
|
35
|
-
return runtime;
|
|
36
|
-
}
|
|
37
|
-
function attachBootstrappedGraph(graph) {
|
|
38
|
-
if (getSingletonRuntime()) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const bootstrappedManifest = {
|
|
42
|
-
version: 1,
|
|
43
|
-
project: {
|
|
44
|
-
name: "bootstrapped"
|
|
45
|
-
},
|
|
46
|
-
workspaces: {
|
|
47
|
-
global: {
|
|
48
|
-
enabled: Boolean(graph.workspace.globalRoot),
|
|
49
|
-
...graph.workspace.globalRoot ? {
|
|
50
|
-
root: graph.workspace.globalRoot
|
|
51
|
-
} : {},
|
|
52
|
-
allowWrite: false
|
|
53
|
-
},
|
|
54
|
-
items: {},
|
|
55
|
-
...graph.workspace.workspaceSource === "implicit" ? {} : {
|
|
56
|
-
default: graph.workspace.workspaceId
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
profiles: {
|
|
60
|
-
default: graph.profile,
|
|
61
|
-
resolveFrom: ["default"]
|
|
62
|
-
},
|
|
63
|
-
plugins: {
|
|
64
|
-
loaders: [],
|
|
65
|
-
resolver: "profile-aware",
|
|
66
|
-
validators: [],
|
|
67
|
-
exporters: [],
|
|
68
|
-
inspectors: []
|
|
69
|
-
},
|
|
70
|
-
sources: {},
|
|
71
|
-
resolution: {
|
|
72
|
-
precedence: [],
|
|
73
|
-
arrayPolicy: "replace"
|
|
74
|
-
},
|
|
75
|
-
envMapping: {
|
|
76
|
-
explicit: {}
|
|
77
|
-
},
|
|
78
|
-
public: {
|
|
79
|
-
promote: [],
|
|
80
|
-
frameworks: {}
|
|
81
|
-
},
|
|
82
|
-
namespaces: {},
|
|
83
|
-
vaults: {},
|
|
84
|
-
writePolicy: {
|
|
85
|
-
define: {
|
|
86
|
-
defaultProfile: graph.profile,
|
|
87
|
-
targets: {
|
|
88
|
-
value: "./values/app.yml",
|
|
89
|
-
secret: "./secrets/app.yml"
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
schema: {}
|
|
94
|
-
};
|
|
95
|
-
const runtime = {
|
|
96
|
-
manifest: bootstrappedManifest,
|
|
97
|
-
plugins: [],
|
|
98
|
-
graph,
|
|
99
|
-
read(key) {
|
|
100
|
-
return readValue(graph, key);
|
|
101
|
-
},
|
|
102
|
-
require(key) {
|
|
103
|
-
return requireValue(graph, key);
|
|
104
|
-
},
|
|
105
|
-
readOr(key, fallback) {
|
|
106
|
-
return readOrValue(graph, key, fallback);
|
|
107
|
-
},
|
|
108
|
-
value(path) {
|
|
109
|
-
return readValue(graph, toLogicalKey("value", path));
|
|
110
|
-
},
|
|
111
|
-
secret(path) {
|
|
112
|
-
return readValue(graph, toLogicalKey("secret", path));
|
|
113
|
-
},
|
|
114
|
-
meta(path) {
|
|
115
|
-
return readValue(graph, toLogicalKey("meta", path));
|
|
116
|
-
},
|
|
117
|
-
inspect(key) {
|
|
118
|
-
return inspectValue(graph, key);
|
|
119
|
-
},
|
|
120
|
-
toObject() {
|
|
121
|
-
return toNamespaceObject(graph);
|
|
122
|
-
},
|
|
123
|
-
toNamespace(namespace) {
|
|
124
|
-
return toNamespaceObject(graph, namespace);
|
|
125
|
-
},
|
|
126
|
-
toEnv(options) {
|
|
127
|
-
return toEnv(graph, bootstrappedManifest, options);
|
|
128
|
-
},
|
|
129
|
-
toPublicEnv(options) {
|
|
130
|
-
return toPublicEnv(graph, bootstrappedManifest, options);
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
setSingletonRuntime(runtime);
|
|
134
|
-
}
|
|
135
|
-
function bootstrapFromProcessEnv() {
|
|
136
|
-
if (typeof process === "undefined") {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
try {
|
|
140
|
-
const graph = readRuntimeGraphFromEnv(process.env);
|
|
141
|
-
if (graph) {
|
|
142
|
-
attachBootstrappedGraph(graph);
|
|
143
|
-
}
|
|
144
|
-
} catch {
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
bootstrapFromProcessEnv();
|
|
148
|
-
var cnos = Object.assign(
|
|
149
|
-
((key) => readValue(getRuntimeOrThrow().graph, key)),
|
|
150
|
-
{
|
|
151
|
-
read(key) {
|
|
152
|
-
return readValue(getRuntimeOrThrow().graph, key);
|
|
153
|
-
},
|
|
154
|
-
require(key) {
|
|
155
|
-
return requireValue(getRuntimeOrThrow().graph, key);
|
|
156
|
-
},
|
|
157
|
-
readOr(key, fallback) {
|
|
158
|
-
return readOrValue(getRuntimeOrThrow().graph, key, fallback);
|
|
159
|
-
},
|
|
160
|
-
value(path) {
|
|
161
|
-
return readValue(getRuntimeOrThrow().graph, toLogicalKey("value", path));
|
|
162
|
-
},
|
|
163
|
-
secret(path) {
|
|
164
|
-
return readValue(getRuntimeOrThrow().graph, toLogicalKey("secret", path));
|
|
165
|
-
},
|
|
166
|
-
meta(path) {
|
|
167
|
-
return readValue(getRuntimeOrThrow().graph, toLogicalKey("meta", path));
|
|
168
|
-
},
|
|
169
|
-
async ready() {
|
|
170
|
-
if (getSingletonRuntime()) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
const existing = getSingletonReady();
|
|
174
|
-
if (existing) {
|
|
175
|
-
await existing;
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
const readyPromise = createCnos().then((runtime) => {
|
|
179
|
-
setSingletonRuntime(runtime);
|
|
180
|
-
return runtime;
|
|
181
|
-
});
|
|
182
|
-
setSingletonReady(readyPromise);
|
|
183
|
-
await readyPromise;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
);
|
|
187
|
-
var runtime_default = cnos;
|
|
2
|
+
runtime_default
|
|
3
|
+
} from "../chunk-LJD4SM32.js";
|
|
4
|
+
import "../chunk-EQSKV3DP.js";
|
|
5
|
+
import "../chunk-JSBVYK2T.js";
|
|
6
|
+
import "../chunk-J4K4JUJL.js";
|
|
7
|
+
import "../chunk-T6Y57KTT.js";
|
|
8
|
+
import "../chunk-WCHX2QFY.js";
|
|
9
|
+
import "../chunk-FWJC4Y2D.js";
|
|
10
|
+
import "../chunk-ZTPSFXWP.js";
|
|
11
|
+
import "../chunk-HMM76UYZ.js";
|
|
12
|
+
import "../chunk-APIU4GTB.js";
|
|
188
13
|
export {
|
|
189
14
|
runtime_default as default
|
|
190
15
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ResolvedGraph, N as NormalizedManifest, T as ToEnvOptions,
|
|
1
|
+
import { R as ResolvedGraph, N as NormalizedManifest, T as ToEnvOptions, c as ToPublicEnvOptions } from './plugin-B4xwySxw.js';
|
|
2
2
|
|
|
3
3
|
declare function toEnv(graph: ResolvedGraph, manifest: NormalizedManifest, options?: ToEnvOptions): Record<string, string>;
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ResolvedGraph, N as NormalizedManifest, T as ToEnvOptions,
|
|
1
|
+
import { R as ResolvedGraph, N as NormalizedManifest, T as ToEnvOptions, c as ToPublicEnvOptions } from './plugin-B4xwySxw.cjs';
|
|
2
2
|
|
|
3
3
|
declare function toEnv(graph: ResolvedGraph, manifest: NormalizedManifest, options?: ToEnvOptions): Record<string, string>;
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitsy/cnos",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Batteries-included CNOS runtime package wired with the official plugins.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -12,6 +12,16 @@
|
|
|
12
12
|
"import": "./dist/index.js",
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
14
|
},
|
|
15
|
+
"./configure": {
|
|
16
|
+
"types": "./dist/configure/index.d.ts",
|
|
17
|
+
"import": "./dist/configure/index.js",
|
|
18
|
+
"require": "./dist/configure/index.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./create": {
|
|
21
|
+
"types": "./dist/configure/index.d.ts",
|
|
22
|
+
"import": "./dist/configure/index.js",
|
|
23
|
+
"require": "./dist/configure/index.cjs"
|
|
24
|
+
},
|
|
15
25
|
"./internal": {
|
|
16
26
|
"types": "./dist/internal.d.ts",
|
|
17
27
|
"import": "./dist/internal.js",
|
package/dist/chunk-JUHPBAEH.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createCnos
|
|
3
|
-
} from "./chunk-SO5XREEU.js";
|
|
4
|
-
|
|
5
|
-
// src/build/index.ts
|
|
6
|
-
async function resolveBrowserData(options = {}) {
|
|
7
|
-
const runtime = await createCnos(options);
|
|
8
|
-
const browserData = {};
|
|
9
|
-
for (const [key, entry] of runtime.graph.entries) {
|
|
10
|
-
if (!key.startsWith("public.")) {
|
|
11
|
-
continue;
|
|
12
|
-
}
|
|
13
|
-
browserData[key] = entry.value;
|
|
14
|
-
}
|
|
15
|
-
return browserData;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
resolveBrowserData
|
|
20
|
-
};
|
package/dist/chunk-PQ4KSV76.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// src/runtime/bootstrap.ts
|
|
2
|
-
var CNOS_GRAPH_ENV_VAR = "__CNOS_GRAPH__";
|
|
3
|
-
function serializeRuntimeGraph(graph) {
|
|
4
|
-
const payload = {
|
|
5
|
-
entries: Array.from(graph.entries.values()),
|
|
6
|
-
profile: graph.profile,
|
|
7
|
-
resolvedAt: graph.resolvedAt,
|
|
8
|
-
profileSource: graph.profileSource,
|
|
9
|
-
workspace: graph.workspace
|
|
10
|
-
};
|
|
11
|
-
return JSON.stringify(payload);
|
|
12
|
-
}
|
|
13
|
-
function deserializeRuntimeGraph(source) {
|
|
14
|
-
const payload = JSON.parse(source);
|
|
15
|
-
if (!payload || !Array.isArray(payload.entries) || typeof payload.profile !== "string" || typeof payload.resolvedAt !== "string" || !payload.profileSource || !payload.workspace || typeof payload.workspace.workspaceId !== "string" || !Array.isArray(payload.workspace.workspaceChain) || !Array.isArray(payload.workspace.workspaceRoots)) {
|
|
16
|
-
throw new Error("Invalid CNOS runtime bootstrap payload");
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
entries: new Map(
|
|
20
|
-
payload.entries.map((entry) => [
|
|
21
|
-
entry.key,
|
|
22
|
-
{
|
|
23
|
-
key: entry.key,
|
|
24
|
-
value: entry.value,
|
|
25
|
-
namespace: entry.namespace,
|
|
26
|
-
winner: entry.winner,
|
|
27
|
-
overridden: entry.overridden ?? []
|
|
28
|
-
}
|
|
29
|
-
])
|
|
30
|
-
),
|
|
31
|
-
profile: payload.profile,
|
|
32
|
-
resolvedAt: payload.resolvedAt,
|
|
33
|
-
profileSource: payload.profileSource,
|
|
34
|
-
workspace: payload.workspace
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function readRuntimeGraphFromEnv(processEnv = process.env) {
|
|
38
|
-
const serialized = processEnv[CNOS_GRAPH_ENV_VAR];
|
|
39
|
-
if (!serialized) {
|
|
40
|
-
return void 0;
|
|
41
|
-
}
|
|
42
|
-
return deserializeRuntimeGraph(serialized);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export {
|
|
46
|
-
CNOS_GRAPH_ENV_VAR,
|
|
47
|
-
serializeRuntimeGraph,
|
|
48
|
-
deserializeRuntimeGraph,
|
|
49
|
-
readRuntimeGraphFromEnv
|
|
50
|
-
};
|
package/dist/chunk-WHUGFPE4.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
envVarToLogicalKey
|
|
3
|
-
} from "./chunk-APCTXRUN.js";
|
|
4
|
-
|
|
5
|
-
// ../../plugins/process-env/src/index.ts
|
|
6
|
-
var PROCESS_ENV_PLUGIN_ID = "@kitsy/cnos/plugins/process-env";
|
|
7
|
-
function processEnvEntriesFromObject(env, mapping = {}, workspaceId = "default") {
|
|
8
|
-
return Object.entries(env).flatMap(([envVar, value]) => {
|
|
9
|
-
if (typeof value !== "string") {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
const logicalKey = envVarToLogicalKey(envVar, mapping);
|
|
13
|
-
if (!logicalKey) {
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
return [
|
|
17
|
-
{
|
|
18
|
-
key: logicalKey,
|
|
19
|
-
value,
|
|
20
|
-
namespace: logicalKey.startsWith("secret.") ? "secret" : "value",
|
|
21
|
-
sourceId: "process-env",
|
|
22
|
-
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
23
|
-
workspaceId,
|
|
24
|
-
origin: {
|
|
25
|
-
envVar
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
];
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
function createProcessEnvPlugin() {
|
|
32
|
-
return {
|
|
33
|
-
id: "process-env",
|
|
34
|
-
kind: "loader",
|
|
35
|
-
async load(context) {
|
|
36
|
-
const config = context.manifestConfig;
|
|
37
|
-
return processEnvEntriesFromObject(
|
|
38
|
-
context.processEnv ?? process.env,
|
|
39
|
-
config.envMapping,
|
|
40
|
-
context.workspace.workspaceId
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export {
|
|
47
|
-
processEnvEntriesFromObject,
|
|
48
|
-
createProcessEnvPlugin
|
|
49
|
-
};
|