@kitsy/cnos 0.0.1 → 1.0.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 -1
- package/dist/chunk-BSETFXI3.js +23 -0
- package/dist/chunk-BSOPGV7G.js +49 -0
- package/dist/chunk-D7AYK7X5.js +8899 -0
- package/dist/chunk-I6QXNQEF.js +202 -0
- package/dist/chunk-QNGS4HFP.js +109 -0
- package/dist/chunk-TYA4BNYT.js +83 -0
- package/dist/chunk-V4LCFDBY.js +35 -0
- package/dist/envNaming-BrOk5ndZ.d.cts +8 -0
- package/dist/envNaming-DCaNdnrF.d.ts +8 -0
- package/dist/index.cjs +9244 -28
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +109 -23
- package/dist/internal.cjs +7593 -0
- package/dist/internal.d.cts +20 -0
- package/dist/internal.d.ts +20 -0
- package/dist/internal.js +18 -0
- package/dist/plugin/basic-schema.cjs +7519 -3
- package/dist/plugin/basic-schema.d.cts +5 -6
- package/dist/plugin/basic-schema.d.ts +5 -6
- package/dist/plugin/basic-schema.js +7 -2
- package/dist/plugin/cli-args.cjs +7437 -3
- package/dist/plugin/cli-args.d.cts +12 -1
- package/dist/plugin/cli-args.d.ts +12 -1
- package/dist/plugin/cli-args.js +11 -2
- package/dist/plugin/dotenv.cjs +7517 -3
- package/dist/plugin/dotenv.d.cts +8 -1
- package/dist/plugin/dotenv.d.ts +8 -1
- package/dist/plugin/dotenv.js +11 -2
- package/dist/plugin/env-export.cjs +7527 -3
- package/dist/plugin/env-export.d.cts +7 -1
- package/dist/plugin/env-export.d.ts +7 -1
- package/dist/plugin/env-export.js +14 -2
- package/dist/plugin/filesystem.cjs +7625 -3
- package/dist/plugin/filesystem.d.cts +17 -1
- package/dist/plugin/filesystem.d.ts +17 -1
- package/dist/plugin/filesystem.js +17 -2
- package/dist/plugin/process-env.cjs +7431 -3
- package/dist/plugin/process-env.d.cts +7 -1
- package/dist/plugin/process-env.d.ts +7 -1
- package/dist/plugin/process-env.js +9 -2
- package/dist/plugin-BVNEHj19.d.cts +309 -0
- package/dist/plugin-BVNEHj19.d.ts +309 -0
- package/dist/toPublicEnv-Dd152fFy.d.cts +7 -0
- package/dist/toPublicEnv-Gwz3xTK0.d.ts +7 -0
- package/package.json +14 -18
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
# @kitsy/cnos
|
|
2
2
|
|
|
3
|
-
Developer-friendly CNOS runtime assembly. It
|
|
3
|
+
Developer-friendly CNOS runtime assembly. It bundles the core engine plus the official built-in plugins, exposes the main `createCnos(...)` entry point for app code, and re-exports the built-ins under `@kitsy/cnos/plugins/*`.
|
|
4
|
+
|
|
5
|
+
Use `@kitsy/cnos-vite` for Vite projects and `@kitsy/cnos-next` for Next.js projects when you want CNOS public values projected into framework-native env surfaces.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applySchemaRules
|
|
3
|
+
} from "./chunk-D7AYK7X5.js";
|
|
4
|
+
|
|
5
|
+
// ../../plugins/basic-schema/src/index.ts
|
|
6
|
+
function createBasicSchemaPlugin() {
|
|
7
|
+
return {
|
|
8
|
+
id: "@kitsy/cnos/plugins/basic-schema",
|
|
9
|
+
kind: "validator",
|
|
10
|
+
async validate(graph, context) {
|
|
11
|
+
const result = applySchemaRules(graph, context.schema ?? {});
|
|
12
|
+
return {
|
|
13
|
+
pluginId: "@kitsy/cnos/plugins/basic-schema",
|
|
14
|
+
valid: result.issues.length === 0,
|
|
15
|
+
issues: result.issues
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
createBasicSchemaPlugin
|
|
23
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
envVarToLogicalKey
|
|
3
|
+
} from "./chunk-D7AYK7X5.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
|
+
};
|