@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
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createFilesystemSecretsPlugin,
|
|
3
|
+
createFilesystemValuesPlugin
|
|
4
|
+
} from "./chunk-SXTMTACL.js";
|
|
5
|
+
import {
|
|
6
|
+
createProcessEnvPlugin
|
|
7
|
+
} from "./chunk-WHUGFPE4.js";
|
|
8
|
+
import {
|
|
9
|
+
createBasicSchemaPlugin
|
|
10
|
+
} from "./chunk-MLQGYCO7.js";
|
|
11
|
+
import {
|
|
12
|
+
createCliArgsPlugin
|
|
13
|
+
} from "./chunk-ZA74BO47.js";
|
|
14
|
+
import {
|
|
15
|
+
createDotenvPlugin
|
|
16
|
+
} from "./chunk-RD5WMHPM.js";
|
|
17
|
+
import {
|
|
18
|
+
createEnvExportPlugin,
|
|
19
|
+
createPublicEnvExportPlugin
|
|
20
|
+
} from "./chunk-EIN55XXA.js";
|
|
21
|
+
import {
|
|
22
|
+
createCnos,
|
|
23
|
+
createProvenanceInspector
|
|
24
|
+
} from "./chunk-APCTXRUN.js";
|
|
25
|
+
|
|
26
|
+
// src/defaultPlugins.ts
|
|
27
|
+
function defaultPlugins() {
|
|
28
|
+
return [
|
|
29
|
+
createFilesystemValuesPlugin(),
|
|
30
|
+
createFilesystemSecretsPlugin(),
|
|
31
|
+
createDotenvPlugin(),
|
|
32
|
+
createProcessEnvPlugin(),
|
|
33
|
+
createCliArgsPlugin(),
|
|
34
|
+
createBasicSchemaPlugin(),
|
|
35
|
+
createEnvExportPlugin(),
|
|
36
|
+
createPublicEnvExportPlugin(),
|
|
37
|
+
createProvenanceInspector()
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/runtime/state.ts
|
|
42
|
+
var singletonRuntime;
|
|
43
|
+
var singletonReady;
|
|
44
|
+
function getSingletonRuntime() {
|
|
45
|
+
return singletonRuntime;
|
|
46
|
+
}
|
|
47
|
+
function setSingletonRuntime(runtime) {
|
|
48
|
+
singletonRuntime = runtime;
|
|
49
|
+
singletonReady = Promise.resolve(runtime);
|
|
50
|
+
return runtime;
|
|
51
|
+
}
|
|
52
|
+
function getSingletonReady() {
|
|
53
|
+
return singletonReady;
|
|
54
|
+
}
|
|
55
|
+
function setSingletonReady(promise) {
|
|
56
|
+
singletonReady = promise;
|
|
57
|
+
return promise;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// package.json
|
|
61
|
+
var package_default = {
|
|
62
|
+
name: "@kitsy/cnos",
|
|
63
|
+
version: "1.2.0",
|
|
64
|
+
description: "Batteries-included CNOS runtime package wired with the official plugins.",
|
|
65
|
+
type: "module",
|
|
66
|
+
main: "./dist/index.cjs",
|
|
67
|
+
module: "./dist/index.js",
|
|
68
|
+
types: "./dist/index.d.ts",
|
|
69
|
+
exports: {
|
|
70
|
+
".": {
|
|
71
|
+
types: "./dist/index.d.ts",
|
|
72
|
+
import: "./dist/index.js",
|
|
73
|
+
require: "./dist/index.cjs"
|
|
74
|
+
},
|
|
75
|
+
"./internal": {
|
|
76
|
+
types: "./dist/internal.d.ts",
|
|
77
|
+
import: "./dist/internal.js",
|
|
78
|
+
require: "./dist/internal.cjs"
|
|
79
|
+
},
|
|
80
|
+
"./runtime": {
|
|
81
|
+
types: "./dist/runtime/index.d.ts",
|
|
82
|
+
import: "./dist/runtime/index.js",
|
|
83
|
+
require: "./dist/runtime/index.cjs"
|
|
84
|
+
},
|
|
85
|
+
"./browser": {
|
|
86
|
+
types: "./dist/browser/index.d.ts",
|
|
87
|
+
import: "./dist/browser/index.js",
|
|
88
|
+
require: "./dist/browser/index.cjs"
|
|
89
|
+
},
|
|
90
|
+
"./build": {
|
|
91
|
+
types: "./dist/build/index.d.ts",
|
|
92
|
+
import: "./dist/build/index.js",
|
|
93
|
+
require: "./dist/build/index.cjs"
|
|
94
|
+
},
|
|
95
|
+
"./plugins/filesystem": {
|
|
96
|
+
types: "./dist/plugin/filesystem.d.ts",
|
|
97
|
+
import: "./dist/plugin/filesystem.js",
|
|
98
|
+
require: "./dist/plugin/filesystem.cjs"
|
|
99
|
+
},
|
|
100
|
+
"./plugins/dotenv": {
|
|
101
|
+
types: "./dist/plugin/dotenv.d.ts",
|
|
102
|
+
import: "./dist/plugin/dotenv.js",
|
|
103
|
+
require: "./dist/plugin/dotenv.cjs"
|
|
104
|
+
},
|
|
105
|
+
"./plugins/process-env": {
|
|
106
|
+
types: "./dist/plugin/process-env.d.ts",
|
|
107
|
+
import: "./dist/plugin/process-env.js",
|
|
108
|
+
require: "./dist/plugin/process-env.cjs"
|
|
109
|
+
},
|
|
110
|
+
"./plugins/cli-args": {
|
|
111
|
+
types: "./dist/plugin/cli-args.d.ts",
|
|
112
|
+
import: "./dist/plugin/cli-args.js",
|
|
113
|
+
require: "./dist/plugin/cli-args.cjs"
|
|
114
|
+
},
|
|
115
|
+
"./plugins/basic-schema": {
|
|
116
|
+
types: "./dist/plugin/basic-schema.d.ts",
|
|
117
|
+
import: "./dist/plugin/basic-schema.js",
|
|
118
|
+
require: "./dist/plugin/basic-schema.cjs"
|
|
119
|
+
},
|
|
120
|
+
"./plugins/env-export": {
|
|
121
|
+
types: "./dist/plugin/env-export.d.ts",
|
|
122
|
+
import: "./dist/plugin/env-export.js",
|
|
123
|
+
require: "./dist/plugin/env-export.cjs"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
files: [
|
|
127
|
+
"dist"
|
|
128
|
+
],
|
|
129
|
+
license: "MIT",
|
|
130
|
+
repository: {
|
|
131
|
+
type: "git",
|
|
132
|
+
url: "https://github.com/kitsyai/cnos.git",
|
|
133
|
+
directory: "packages/cnos"
|
|
134
|
+
},
|
|
135
|
+
homepage: "https://github.com/kitsyai/cnos/tree/main/packages/cnos",
|
|
136
|
+
bugs: {
|
|
137
|
+
url: "https://github.com/kitsyai/cnos/issues"
|
|
138
|
+
},
|
|
139
|
+
keywords: [
|
|
140
|
+
"cnos",
|
|
141
|
+
"config",
|
|
142
|
+
"runtime"
|
|
143
|
+
],
|
|
144
|
+
publishConfig: {
|
|
145
|
+
access: "public"
|
|
146
|
+
},
|
|
147
|
+
dependencies: {
|
|
148
|
+
yaml: "^2.8.3"
|
|
149
|
+
},
|
|
150
|
+
scripts: {
|
|
151
|
+
build: "rimraf dist && tsup --config tsup.config.ts",
|
|
152
|
+
clean: "rimraf dist",
|
|
153
|
+
dev: "tsup --config tsup.config.ts --watch",
|
|
154
|
+
lint: "eslint src test",
|
|
155
|
+
prepack: "pnpm build",
|
|
156
|
+
test: "vitest run",
|
|
157
|
+
typecheck: "tsc -p tsconfig.json --noEmit"
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// src/createCnos.ts
|
|
162
|
+
async function createCnos2(options = {}) {
|
|
163
|
+
const runtime = await createCnos({
|
|
164
|
+
...options,
|
|
165
|
+
cnosVersion: package_default.version,
|
|
166
|
+
plugins: [...defaultPlugins(), ...options.plugins ?? []]
|
|
167
|
+
});
|
|
168
|
+
setSingletonRuntime(runtime);
|
|
169
|
+
return runtime;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export {
|
|
173
|
+
defaultPlugins,
|
|
174
|
+
getSingletonRuntime,
|
|
175
|
+
setSingletonRuntime,
|
|
176
|
+
getSingletonReady,
|
|
177
|
+
setSingletonReady,
|
|
178
|
+
createCnos2 as createCnos
|
|
179
|
+
};
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
resolveSecretPassphrase,
|
|
7
7
|
resolveSecretStoreRoot,
|
|
8
8
|
toPortablePath
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-APCTXRUN.js";
|
|
10
10
|
|
|
11
11
|
// ../../plugins/filesystem/src/helpers.ts
|
|
12
12
|
import { readdir } from "fs/promises";
|
|
@@ -114,7 +114,7 @@ async function resolveSecretValue(value, processEnv) {
|
|
|
114
114
|
value.vault
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
|
-
if (value.provider === "env") {
|
|
117
|
+
if (value.provider === "env" || value.provider === "github-secrets") {
|
|
118
118
|
const resolved = processEnv?.[value.ref];
|
|
119
119
|
if (resolved === void 0) {
|
|
120
120
|
return value;
|