@kitsy/cnos 1.3.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/dist/build/index.cjs +102 -9
- 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-DRKDNY4I.js → chunk-APIU4GTB.js} +14 -4
- package/dist/{chunk-K6QYI2T4.js → chunk-EQSKV3DP.js} +1 -1
- package/dist/{chunk-JDII6O72.js → chunk-FWJC4Y2D.js} +1 -1
- package/dist/{chunk-QTKXPY3N.js → chunk-HMM76UYZ.js} +1 -1
- package/dist/{chunk-OOKFRWTN.js → chunk-J4K4JUJL.js} +1 -1
- package/dist/{chunk-EDCLLCNL.js → chunk-JSBVYK2T.js} +8 -8
- package/dist/{chunk-E7SE6N26.js → chunk-LJD4SM32.js} +3 -3
- package/dist/{chunk-FC3IV6A7.js → chunk-T6Y57KTT.js} +20 -1
- package/dist/chunk-WCHX2QFY.js +115 -0
- package/dist/{chunk-OWUZQ4OH.js → chunk-ZTPSFXWP.js} +1 -1
- package/dist/configure/index.cjs +102 -9
- 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/{envNaming-Dy3WYiGK.d.ts → envNaming-Dvm_LP2D.d.ts} +1 -1
- package/dist/{envNaming-D6k66myh.d.cts → envNaming-S4B-dHUx.d.cts} +1 -1
- package/dist/index.cjs +102 -9
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -10
- package/dist/internal.cjs +14 -2
- package/dist/internal.d.cts +5 -4
- package/dist/internal.d.ts +5 -4
- package/dist/internal.js +10 -3
- 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.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.cjs +19 -0
- 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 +74 -7
- 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-CyNkf7Dm.d.cts → plugin-B4xwySxw.d.cts} +2 -1
- package/dist/{plugin-CyNkf7Dm.d.ts → plugin-B4xwySxw.d.ts} +2 -1
- package/dist/runtime/index.cjs +102 -9
- 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-D2PZkaN-.d.ts → toPublicEnv-CvhGAfsB.d.ts} +1 -1
- package/dist/{toPublicEnv-Cz72m6y0.d.cts → toPublicEnv-ggmphZFs.d.cts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-CDXJISGB.js +0 -49
package/dist/plugin/cli-args.js
CHANGED
package/dist/plugin/dotenv.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LoaderPlugin, a as ConfigEntry } from '../plugin-
|
|
2
|
-
import { E as EnvMappingConfig } from '../envNaming-
|
|
1
|
+
import { L as LoaderPlugin, a as ConfigEntry } from '../plugin-B4xwySxw.cjs';
|
|
2
|
+
import { E as EnvMappingConfig } from '../envNaming-S4B-dHUx.cjs';
|
|
3
3
|
|
|
4
4
|
declare function parseDotenv(document: string): Record<string, string>;
|
|
5
5
|
declare function dotenvEntriesFromObject(values: Record<string, string>, mapping?: EnvMappingConfig, originFile?: string, workspaceId?: string): ConfigEntry[];
|
package/dist/plugin/dotenv.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LoaderPlugin, a as ConfigEntry } from '../plugin-
|
|
2
|
-
import { E as EnvMappingConfig } from '../envNaming-
|
|
1
|
+
import { L as LoaderPlugin, a as ConfigEntry } from '../plugin-B4xwySxw.js';
|
|
2
|
+
import { E as EnvMappingConfig } from '../envNaming-Dvm_LP2D.js';
|
|
3
3
|
|
|
4
4
|
declare function parseDotenv(document: string): Record<string, string>;
|
|
5
5
|
declare function dotenvEntriesFromObject(values: Record<string, string>, mapping?: EnvMappingConfig, originFile?: string, workspaceId?: string): ConfigEntry[];
|
package/dist/plugin/dotenv.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ExporterPlugin } from '../plugin-
|
|
2
|
-
export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-
|
|
1
|
+
import { E as ExporterPlugin } from '../plugin-B4xwySxw.cjs';
|
|
2
|
+
export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-ggmphZFs.cjs';
|
|
3
3
|
|
|
4
4
|
declare function createEnvExportPlugin(): ExporterPlugin;
|
|
5
5
|
declare function createPublicEnvExportPlugin(): ExporterPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ExporterPlugin } from '../plugin-
|
|
2
|
-
export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-
|
|
1
|
+
import { E as ExporterPlugin } from '../plugin-B4xwySxw.js';
|
|
2
|
+
export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-CvhGAfsB.js';
|
|
3
3
|
|
|
4
4
|
declare function createEnvExportPlugin(): ExporterPlugin;
|
|
5
5
|
declare function createPublicEnvExportPlugin(): ExporterPlugin;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createEnvExportPlugin,
|
|
3
3
|
createPublicEnvExportPlugin
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-J4K4JUJL.js";
|
|
5
5
|
import {
|
|
6
6
|
toEnv,
|
|
7
7
|
toPublicEnv
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-APIU4GTB.js";
|
|
9
9
|
export {
|
|
10
10
|
createEnvExportPlugin,
|
|
11
11
|
createPublicEnvExportPlugin,
|
|
@@ -282,11 +282,30 @@ function createFilesystemValuesPlugin() {
|
|
|
282
282
|
sourceRoot,
|
|
283
283
|
context.profileActivation.values
|
|
284
284
|
);
|
|
285
|
+
const customNamespaces = Object.entries(context.manifest.namespaces).filter(
|
|
286
|
+
([namespace, definition]) => namespace !== "value" && namespace !== "secret" && definition.kind === "data" && !definition.sensitive
|
|
287
|
+
).map(([namespace]) => namespace);
|
|
285
288
|
const entries = [];
|
|
286
289
|
for (const file of files) {
|
|
287
290
|
const document = await (0, import_promises12.readFile)(file.absolutePath, "utf8");
|
|
288
291
|
entries.push(...filesystemValuesReader(file.relativePath, document, file.workspaceId));
|
|
289
292
|
}
|
|
293
|
+
for (const namespace of customNamespaces) {
|
|
294
|
+
const layers = [
|
|
295
|
+
namespace,
|
|
296
|
+
...context.profileChain.filter((profile) => profile !== "base").map((profile) => `profiles/${profile}/${namespace}`)
|
|
297
|
+
];
|
|
298
|
+
const namespaceFiles = await collectFilesystemLayerFiles(
|
|
299
|
+
context.manifestRoot,
|
|
300
|
+
context.workspace.workspaceRoots,
|
|
301
|
+
sourceRoot,
|
|
302
|
+
layers
|
|
303
|
+
);
|
|
304
|
+
for (const file of namespaceFiles) {
|
|
305
|
+
const document = await (0, import_promises12.readFile)(file.absolutePath, "utf8");
|
|
306
|
+
entries.push(...yamlObjectToEntries(document, file.relativePath, namespace, "filesystem-values", file.workspaceId));
|
|
307
|
+
}
|
|
308
|
+
}
|
|
290
309
|
return entries;
|
|
291
310
|
}
|
|
292
311
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as LoaderPlugin, a as ConfigEntry, W as WorkspaceRoot, i as NamespaceName } from '../plugin-
|
|
1
|
+
import { L as LoaderPlugin, a as ConfigEntry, W as WorkspaceRoot, i as NamespaceName } from '../plugin-B4xwySxw.cjs';
|
|
2
2
|
|
|
3
3
|
declare function filesystemSecretsReader(filePath: string, document: string, workspaceId?: string): ConfigEntry[];
|
|
4
4
|
declare function createFilesystemSecretsPlugin(): LoaderPlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as LoaderPlugin, a as ConfigEntry, W as WorkspaceRoot, i as NamespaceName } from '../plugin-
|
|
1
|
+
import { L as LoaderPlugin, a as ConfigEntry, W as WorkspaceRoot, i as NamespaceName } from '../plugin-B4xwySxw.js';
|
|
2
2
|
|
|
3
3
|
declare function filesystemSecretsReader(filePath: string, document: string, workspaceId?: string): ConfigEntry[];
|
|
4
4
|
declare function createFilesystemSecretsPlugin(): LoaderPlugin;
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
filesystemSecretsReader,
|
|
6
6
|
filesystemValuesReader,
|
|
7
7
|
yamlObjectToEntries
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-T6Y57KTT.js";
|
|
9
|
+
import "../chunk-APIU4GTB.js";
|
|
10
10
|
export {
|
|
11
11
|
collectFilesystemLayerFiles,
|
|
12
12
|
createFilesystemSecretsPlugin,
|
|
@@ -31,7 +31,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var process_env_exports = {};
|
|
32
32
|
__export(process_env_exports, {
|
|
33
33
|
createProcessEnvPlugin: () => createProcessEnvPlugin,
|
|
34
|
-
processEnvEntriesFromObject: () => processEnvEntriesFromObject
|
|
34
|
+
processEnvEntriesFromObject: () => processEnvEntriesFromObject,
|
|
35
|
+
processNamespaceEntriesFromContext: () => processNamespaceEntriesFromContext
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(process_env_exports);
|
|
37
38
|
|
|
@@ -129,6 +130,11 @@ function envVarToLogicalKey(envVar, config = {}) {
|
|
|
129
130
|
|
|
130
131
|
// ../../plugins/process-env/src/index.ts
|
|
131
132
|
var PROCESS_ENV_PLUGIN_ID = "@kitsy/cnos/plugins/process-env";
|
|
133
|
+
var PROCESS_GRAPH_OMIT = /* @__PURE__ */ new Set([
|
|
134
|
+
"__CNOS_GRAPH__",
|
|
135
|
+
"__CNOS_SECRET_PAYLOAD__",
|
|
136
|
+
"__CNOS_SESSION_KEY__"
|
|
137
|
+
]);
|
|
132
138
|
function processEnvEntriesFromObject(env, mapping = {}, workspaceId = "default") {
|
|
133
139
|
return Object.entries(env).flatMap(([envVar, value]) => {
|
|
134
140
|
if (typeof value !== "string") {
|
|
@@ -153,22 +159,83 @@ function processEnvEntriesFromObject(env, mapping = {}, workspaceId = "default")
|
|
|
153
159
|
];
|
|
154
160
|
});
|
|
155
161
|
}
|
|
162
|
+
function processNamespaceEntriesFromContext(env, workspaceId = "default") {
|
|
163
|
+
const envEntries = Object.entries(env).filter((entry) => typeof entry[1] === "string").filter(([envVar]) => !PROCESS_GRAPH_OMIT.has(envVar)).map(([envVar, value]) => ({
|
|
164
|
+
key: `process.env.${envVar}`,
|
|
165
|
+
value,
|
|
166
|
+
namespace: "process",
|
|
167
|
+
sourceId: "process-runtime",
|
|
168
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
169
|
+
workspaceId,
|
|
170
|
+
origin: {
|
|
171
|
+
envVar
|
|
172
|
+
}
|
|
173
|
+
}));
|
|
174
|
+
const runtimeEntries = [
|
|
175
|
+
{
|
|
176
|
+
key: "process.cwd",
|
|
177
|
+
value: process.cwd(),
|
|
178
|
+
namespace: "process",
|
|
179
|
+
sourceId: "process-runtime",
|
|
180
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
181
|
+
workspaceId
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
key: "process.platform",
|
|
185
|
+
value: process.platform,
|
|
186
|
+
namespace: "process",
|
|
187
|
+
sourceId: "process-runtime",
|
|
188
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
189
|
+
workspaceId
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
key: "process.arch",
|
|
193
|
+
value: process.arch,
|
|
194
|
+
namespace: "process",
|
|
195
|
+
sourceId: "process-runtime",
|
|
196
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
197
|
+
workspaceId
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
key: "process.node.version",
|
|
201
|
+
value: process.version,
|
|
202
|
+
namespace: "process",
|
|
203
|
+
sourceId: "process-runtime",
|
|
204
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
205
|
+
workspaceId
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
key: "process.args.raw",
|
|
209
|
+
value: process.argv.slice(2),
|
|
210
|
+
namespace: "process",
|
|
211
|
+
sourceId: "process-runtime",
|
|
212
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
213
|
+
workspaceId
|
|
214
|
+
}
|
|
215
|
+
];
|
|
216
|
+
return [...runtimeEntries, ...envEntries];
|
|
217
|
+
}
|
|
156
218
|
function createProcessEnvPlugin() {
|
|
157
219
|
return {
|
|
158
220
|
id: "process-env",
|
|
159
221
|
kind: "loader",
|
|
160
222
|
async load(context) {
|
|
161
223
|
const config = context.manifestConfig;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
224
|
+
const env = context.processEnv ?? process.env;
|
|
225
|
+
return [
|
|
226
|
+
...processEnvEntriesFromObject(
|
|
227
|
+
env,
|
|
228
|
+
config.envMapping,
|
|
229
|
+
context.workspace.workspaceId
|
|
230
|
+
),
|
|
231
|
+
...processNamespaceEntriesFromContext(env, context.workspace.workspaceId)
|
|
232
|
+
];
|
|
167
233
|
}
|
|
168
234
|
};
|
|
169
235
|
}
|
|
170
236
|
// Annotate the CommonJS export names for ESM import in node:
|
|
171
237
|
0 && (module.exports = {
|
|
172
238
|
createProcessEnvPlugin,
|
|
173
|
-
processEnvEntriesFromObject
|
|
239
|
+
processEnvEntriesFromObject,
|
|
240
|
+
processNamespaceEntriesFromContext
|
|
174
241
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { L as LoaderPlugin, a as ConfigEntry } from '../plugin-
|
|
2
|
-
import { E as EnvMappingConfig } from '../envNaming-
|
|
1
|
+
import { L as LoaderPlugin, a as ConfigEntry } from '../plugin-B4xwySxw.cjs';
|
|
2
|
+
import { E as EnvMappingConfig } from '../envNaming-S4B-dHUx.cjs';
|
|
3
3
|
|
|
4
4
|
declare function processEnvEntriesFromObject(env: Record<string, string | undefined>, mapping?: EnvMappingConfig, workspaceId?: string): ConfigEntry[];
|
|
5
|
+
declare function processNamespaceEntriesFromContext(env: Record<string, string | undefined>, workspaceId?: string): ConfigEntry[];
|
|
5
6
|
declare function createProcessEnvPlugin(): LoaderPlugin;
|
|
6
7
|
|
|
7
|
-
export { createProcessEnvPlugin, processEnvEntriesFromObject };
|
|
8
|
+
export { createProcessEnvPlugin, processEnvEntriesFromObject, processNamespaceEntriesFromContext };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { L as LoaderPlugin, a as ConfigEntry } from '../plugin-
|
|
2
|
-
import { E as EnvMappingConfig } from '../envNaming-
|
|
1
|
+
import { L as LoaderPlugin, a as ConfigEntry } from '../plugin-B4xwySxw.js';
|
|
2
|
+
import { E as EnvMappingConfig } from '../envNaming-Dvm_LP2D.js';
|
|
3
3
|
|
|
4
4
|
declare function processEnvEntriesFromObject(env: Record<string, string | undefined>, mapping?: EnvMappingConfig, workspaceId?: string): ConfigEntry[];
|
|
5
|
+
declare function processNamespaceEntriesFromContext(env: Record<string, string | undefined>, workspaceId?: string): ConfigEntry[];
|
|
5
6
|
declare function createProcessEnvPlugin(): LoaderPlugin;
|
|
6
7
|
|
|
7
|
-
export { createProcessEnvPlugin, processEnvEntriesFromObject };
|
|
8
|
+
export { createProcessEnvPlugin, processEnvEntriesFromObject, processNamespaceEntriesFromContext };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProcessEnvPlugin,
|
|
3
|
-
processEnvEntriesFromObject
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
processEnvEntriesFromObject,
|
|
4
|
+
processNamespaceEntriesFromContext
|
|
5
|
+
} from "../chunk-WCHX2QFY.js";
|
|
6
|
+
import "../chunk-APIU4GTB.js";
|
|
6
7
|
export {
|
|
7
8
|
createProcessEnvPlugin,
|
|
8
|
-
processEnvEntriesFromObject
|
|
9
|
+
processEnvEntriesFromObject,
|
|
10
|
+
processNamespaceEntriesFromContext
|
|
9
11
|
};
|
|
@@ -295,6 +295,7 @@ interface CnosPlugin {
|
|
|
295
295
|
kind: CnosPluginKind;
|
|
296
296
|
}
|
|
297
297
|
interface LoaderContext {
|
|
298
|
+
manifest: NormalizedManifest;
|
|
298
299
|
manifestConfig: Record<string, unknown>;
|
|
299
300
|
profile: string;
|
|
300
301
|
profileChain: string[];
|
|
@@ -346,4 +347,4 @@ interface ExporterPlugin extends CnosPlugin {
|
|
|
346
347
|
export(graph: ResolvedGraph, context: ExportContext): Promise<ExportResult>;
|
|
347
348
|
}
|
|
348
349
|
|
|
349
|
-
export type { CnosCreateOptions as C, DumpPlanOptions as D, ExporterPlugin as E, InspectResult as I, LoaderPlugin as L, ManifestFile as M, NormalizedManifest as N, ResolvedGraph as R, ToEnvOptions as T, ValidatorPlugin as V, WorkspaceRoot as W, ConfigEntry as a, LogicalKey as b, ToPublicEnvOptions as c, DumpPlan as d, DumpOptions as e, DumpResult as f, CnosRuntime as g, CnosPlugin as h, NamespaceName as i, LoadManifestOptions as j, LoadedManifest as k,
|
|
350
|
+
export type { CnosCreateOptions as C, DumpPlanOptions as D, ExporterPlugin as E, InspectResult as I, LoaderPlugin as L, ManifestFile as M, NormalizedManifest as N, ResolvedGraph as R, ToEnvOptions as T, ValidatorPlugin as V, WorkspaceRoot as W, ConfigEntry as a, LogicalKey as b, ToPublicEnvOptions as c, DumpPlan as d, DumpOptions as e, DumpResult as f, CnosRuntime as g, CnosPlugin as h, NamespaceName as i, LoadManifestOptions as j, LoadedManifest as k, NamespaceDefinition as l, VaultDefinition as m, ValidationSummary as n, ValidationIssue as o, WorkspaceFile as p };
|
|
@@ -295,6 +295,7 @@ interface CnosPlugin {
|
|
|
295
295
|
kind: CnosPluginKind;
|
|
296
296
|
}
|
|
297
297
|
interface LoaderContext {
|
|
298
|
+
manifest: NormalizedManifest;
|
|
298
299
|
manifestConfig: Record<string, unknown>;
|
|
299
300
|
profile: string;
|
|
300
301
|
profileChain: string[];
|
|
@@ -346,4 +347,4 @@ interface ExporterPlugin extends CnosPlugin {
|
|
|
346
347
|
export(graph: ResolvedGraph, context: ExportContext): Promise<ExportResult>;
|
|
347
348
|
}
|
|
348
349
|
|
|
349
|
-
export type { CnosCreateOptions as C, DumpPlanOptions as D, ExporterPlugin as E, InspectResult as I, LoaderPlugin as L, ManifestFile as M, NormalizedManifest as N, ResolvedGraph as R, ToEnvOptions as T, ValidatorPlugin as V, WorkspaceRoot as W, ConfigEntry as a, LogicalKey as b, ToPublicEnvOptions as c, DumpPlan as d, DumpOptions as e, DumpResult as f, CnosRuntime as g, CnosPlugin as h, NamespaceName as i, LoadManifestOptions as j, LoadedManifest as k,
|
|
350
|
+
export type { CnosCreateOptions as C, DumpPlanOptions as D, ExporterPlugin as E, InspectResult as I, LoaderPlugin as L, ManifestFile as M, NormalizedManifest as N, ResolvedGraph as R, ToEnvOptions as T, ValidatorPlugin as V, WorkspaceRoot as W, ConfigEntry as a, LogicalKey as b, ToPublicEnvOptions as c, DumpPlan as d, DumpOptions as e, DumpResult as f, CnosRuntime as g, CnosPlugin as h, NamespaceName as i, LoadManifestOptions as j, LoadedManifest as k, NamespaceDefinition as l, VaultDefinition as m, ValidationSummary as n, ValidationIssue as o, WorkspaceFile as p };
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -294,6 +294,11 @@ var DEFAULT_NAMESPACES = {
|
|
|
294
294
|
shareable: false,
|
|
295
295
|
readonly: true
|
|
296
296
|
},
|
|
297
|
+
process: {
|
|
298
|
+
kind: "system",
|
|
299
|
+
shareable: false,
|
|
300
|
+
readonly: true
|
|
301
|
+
},
|
|
297
302
|
public: {
|
|
298
303
|
kind: "projection",
|
|
299
304
|
source: "promote",
|
|
@@ -953,12 +958,15 @@ async function exists2(targetPath) {
|
|
|
953
958
|
return false;
|
|
954
959
|
}
|
|
955
960
|
}
|
|
956
|
-
async function resolveLocalWorkspaceRoot(manifestRoot, workspaceId) {
|
|
961
|
+
async function resolveLocalWorkspaceRoot(manifestRoot, workspaceId, manifest) {
|
|
957
962
|
const workspaceRoot = import_node_path5.default.join(manifestRoot, "workspaces", workspaceId);
|
|
958
963
|
if (await exists2(workspaceRoot)) {
|
|
959
964
|
return workspaceRoot;
|
|
960
965
|
}
|
|
961
|
-
const
|
|
966
|
+
const customDataNamespaceRoots = Object.entries(manifest.namespaces).filter(
|
|
967
|
+
([namespace, definition]) => namespace !== "value" && namespace !== "secret" && definition.kind === "data" && !definition.sensitive
|
|
968
|
+
).map(([namespace]) => namespace);
|
|
969
|
+
const legacyMarkers = ["values", "secrets", "env", "profiles", ...customDataNamespaceRoots].map(
|
|
962
970
|
(segment) => import_node_path5.default.join(manifestRoot, segment)
|
|
963
971
|
);
|
|
964
972
|
if ((await Promise.all(legacyMarkers.map((marker) => exists2(marker)))).some(Boolean)) {
|
|
@@ -1045,7 +1053,7 @@ async function resolveWorkspaceContext(manifest, options) {
|
|
|
1045
1053
|
workspaceRoots.push({
|
|
1046
1054
|
scope: "local",
|
|
1047
1055
|
workspaceId: chainWorkspaceId,
|
|
1048
|
-
path: await resolveLocalWorkspaceRoot(options.manifestRoot, chainWorkspaceId)
|
|
1056
|
+
path: await resolveLocalWorkspaceRoot(options.manifestRoot, chainWorkspaceId, manifest)
|
|
1049
1057
|
});
|
|
1050
1058
|
}
|
|
1051
1059
|
return {
|
|
@@ -1210,6 +1218,7 @@ async function runPipeline(options) {
|
|
|
1210
1218
|
const collectedEntries = await Promise.all(
|
|
1211
1219
|
options.plugins.map(
|
|
1212
1220
|
(plugin) => plugin.load({
|
|
1221
|
+
manifest: options.manifest,
|
|
1213
1222
|
manifestConfig: {
|
|
1214
1223
|
...options.manifest.sources[plugin.id] ?? {},
|
|
1215
1224
|
envMapping: options.manifest.envMapping
|
|
@@ -2308,7 +2317,7 @@ function envVarToLogicalKey(envVar, config = {}) {
|
|
|
2308
2317
|
// package.json
|
|
2309
2318
|
var package_default = {
|
|
2310
2319
|
name: "@kitsy/cnos",
|
|
2311
|
-
version: "1.
|
|
2320
|
+
version: "1.4.0",
|
|
2312
2321
|
description: "Batteries-included CNOS runtime package wired with the official plugins.",
|
|
2313
2322
|
type: "module",
|
|
2314
2323
|
main: "./dist/index.cjs",
|
|
@@ -2782,11 +2791,30 @@ function createFilesystemValuesPlugin() {
|
|
|
2782
2791
|
sourceRoot,
|
|
2783
2792
|
context.profileActivation.values
|
|
2784
2793
|
);
|
|
2794
|
+
const customNamespaces = Object.entries(context.manifest.namespaces).filter(
|
|
2795
|
+
([namespace, definition]) => namespace !== "value" && namespace !== "secret" && definition.kind === "data" && !definition.sensitive
|
|
2796
|
+
).map(([namespace]) => namespace);
|
|
2785
2797
|
const entries = [];
|
|
2786
2798
|
for (const file of files) {
|
|
2787
2799
|
const document = await (0, import_promises13.readFile)(file.absolutePath, "utf8");
|
|
2788
2800
|
entries.push(...filesystemValuesReader(file.relativePath, document, file.workspaceId));
|
|
2789
2801
|
}
|
|
2802
|
+
for (const namespace of customNamespaces) {
|
|
2803
|
+
const layers = [
|
|
2804
|
+
namespace,
|
|
2805
|
+
...context.profileChain.filter((profile) => profile !== "base").map((profile) => `profiles/${profile}/${namespace}`)
|
|
2806
|
+
];
|
|
2807
|
+
const namespaceFiles = await collectFilesystemLayerFiles(
|
|
2808
|
+
context.manifestRoot,
|
|
2809
|
+
context.workspace.workspaceRoots,
|
|
2810
|
+
sourceRoot,
|
|
2811
|
+
layers
|
|
2812
|
+
);
|
|
2813
|
+
for (const file of namespaceFiles) {
|
|
2814
|
+
const document = await (0, import_promises13.readFile)(file.absolutePath, "utf8");
|
|
2815
|
+
entries.push(...yamlObjectToEntries(document, file.relativePath, namespace, "filesystem-values", file.workspaceId));
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2790
2818
|
return entries;
|
|
2791
2819
|
}
|
|
2792
2820
|
};
|
|
@@ -2794,6 +2822,11 @@ function createFilesystemValuesPlugin() {
|
|
|
2794
2822
|
|
|
2795
2823
|
// ../../plugins/process-env/src/index.ts
|
|
2796
2824
|
var PROCESS_ENV_PLUGIN_ID = "@kitsy/cnos/plugins/process-env";
|
|
2825
|
+
var PROCESS_GRAPH_OMIT = /* @__PURE__ */ new Set([
|
|
2826
|
+
"__CNOS_GRAPH__",
|
|
2827
|
+
"__CNOS_SECRET_PAYLOAD__",
|
|
2828
|
+
"__CNOS_SESSION_KEY__"
|
|
2829
|
+
]);
|
|
2797
2830
|
function processEnvEntriesFromObject(env, mapping = {}, workspaceId = "default") {
|
|
2798
2831
|
return Object.entries(env).flatMap(([envVar, value]) => {
|
|
2799
2832
|
if (typeof value !== "string") {
|
|
@@ -2818,17 +2851,77 @@ function processEnvEntriesFromObject(env, mapping = {}, workspaceId = "default")
|
|
|
2818
2851
|
];
|
|
2819
2852
|
});
|
|
2820
2853
|
}
|
|
2854
|
+
function processNamespaceEntriesFromContext(env, workspaceId = "default") {
|
|
2855
|
+
const envEntries = Object.entries(env).filter((entry) => typeof entry[1] === "string").filter(([envVar]) => !PROCESS_GRAPH_OMIT.has(envVar)).map(([envVar, value]) => ({
|
|
2856
|
+
key: `process.env.${envVar}`,
|
|
2857
|
+
value,
|
|
2858
|
+
namespace: "process",
|
|
2859
|
+
sourceId: "process-runtime",
|
|
2860
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2861
|
+
workspaceId,
|
|
2862
|
+
origin: {
|
|
2863
|
+
envVar
|
|
2864
|
+
}
|
|
2865
|
+
}));
|
|
2866
|
+
const runtimeEntries = [
|
|
2867
|
+
{
|
|
2868
|
+
key: "process.cwd",
|
|
2869
|
+
value: process.cwd(),
|
|
2870
|
+
namespace: "process",
|
|
2871
|
+
sourceId: "process-runtime",
|
|
2872
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2873
|
+
workspaceId
|
|
2874
|
+
},
|
|
2875
|
+
{
|
|
2876
|
+
key: "process.platform",
|
|
2877
|
+
value: process.platform,
|
|
2878
|
+
namespace: "process",
|
|
2879
|
+
sourceId: "process-runtime",
|
|
2880
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2881
|
+
workspaceId
|
|
2882
|
+
},
|
|
2883
|
+
{
|
|
2884
|
+
key: "process.arch",
|
|
2885
|
+
value: process.arch,
|
|
2886
|
+
namespace: "process",
|
|
2887
|
+
sourceId: "process-runtime",
|
|
2888
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2889
|
+
workspaceId
|
|
2890
|
+
},
|
|
2891
|
+
{
|
|
2892
|
+
key: "process.node.version",
|
|
2893
|
+
value: process.version,
|
|
2894
|
+
namespace: "process",
|
|
2895
|
+
sourceId: "process-runtime",
|
|
2896
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2897
|
+
workspaceId
|
|
2898
|
+
},
|
|
2899
|
+
{
|
|
2900
|
+
key: "process.args.raw",
|
|
2901
|
+
value: process.argv.slice(2),
|
|
2902
|
+
namespace: "process",
|
|
2903
|
+
sourceId: "process-runtime",
|
|
2904
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2905
|
+
workspaceId
|
|
2906
|
+
}
|
|
2907
|
+
];
|
|
2908
|
+
return [...runtimeEntries, ...envEntries];
|
|
2909
|
+
}
|
|
2821
2910
|
function createProcessEnvPlugin() {
|
|
2822
2911
|
return {
|
|
2823
2912
|
id: "process-env",
|
|
2824
2913
|
kind: "loader",
|
|
2825
2914
|
async load(context) {
|
|
2826
2915
|
const config = context.manifestConfig;
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2916
|
+
const env = context.processEnv ?? process.env;
|
|
2917
|
+
return [
|
|
2918
|
+
...processEnvEntriesFromObject(
|
|
2919
|
+
env,
|
|
2920
|
+
config.envMapping,
|
|
2921
|
+
context.workspace.workspaceId
|
|
2922
|
+
),
|
|
2923
|
+
...processNamespaceEntriesFromContext(env, context.workspace.workspaceId)
|
|
2924
|
+
];
|
|
2832
2925
|
}
|
|
2833
2926
|
};
|
|
2834
2927
|
}
|
package/dist/runtime/index.d.cts
CHANGED
package/dist/runtime/index.d.ts
CHANGED
package/dist/runtime/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runtime_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
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";
|
|
13
13
|
export {
|
|
14
14
|
runtime_default as default
|
|
15
15
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ResolvedGraph, N as NormalizedManifest, T as ToEnvOptions, c as ToPublicEnvOptions } from './plugin-
|
|
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, c as ToPublicEnvOptions } from './plugin-
|
|
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
package/dist/chunk-CDXJISGB.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
envVarToLogicalKey
|
|
3
|
-
} from "./chunk-DRKDNY4I.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
|
-
};
|